Hallo,
hoffe Ihr könnt mir weiterhelfen.
Benutze einen opensource Shop und habe bei der Produktaufluistung etwas am Code geändert.
Nun kann man über den Adminbereich das Style ändern.
Mittels elseif abfrage wird der Style zugeordnet.
Nun habe ich das Problem das er das elseif nicht richtig zuweist oder beide Anzeigt.
Wie könnte ich am besten die 3 Optionswerte am besten auseinander halten
Hier mal ein Textschnippsel
Es soll also entweder nur der Options wert 1 oder nur der 2te ausgegeben werden. Momentan wird bei Option 1 der 2te direkt darunter dargestellt. Wählt man Option 2 über den Admin, funktioniert es.
LG Fallout
hoffe Ihr könnt mir weiterhelfen.
Benutze einen opensource Shop und habe bei der Produktaufluistung etwas am Code geändert.
Nun kann man über den Adminbereich das Style ändern.
Mittels elseif abfrage wird der Style zugeordnet.
Nun habe ich das Problem das er das elseif nicht richtig zuweist oder beide Anzeigt.
Wie könnte ich am besten die 3 Optionswerte am besten auseinander halten
Hier mal ein Textschnippsel
Code:
<?php
}
Option 1
-----------------------------------------------------------------------------------------------------------------------------------------------
if (PRODUCT_LISTING_DISPLAY_STYLE == 'list') {
-----------------------------------------------------------------------------------------------------------------------------------------------
$info_box_contents = array();
if ($listing_split->number_of_rows > 0) {
$row = 0;
$col = 0;
$listing_query = tep_db_query($listing_split->sql_query);
while ($listing = tep_db_fetch_array($listing_query)) {
$listing['products_name'] = tep_get_products_name($listing['products_id']);
if (PRODUCT_LIST_IMAGE > 0) {
$lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br>';
}
if (PRODUCT_LIST_NAME > 0) {
$lc_text .= '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a><br>';
}
if (PRODUCT_LIST_MODEL > 0) {
$lc_text .= '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $listing['products_id']) . '">' . $listing['products_model'] . '</a><br>';
}
if (PRODUCT_LIST_MANUFACTURER > 0) {
$lc_text .= '<a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $listing['manufacturers_id']) . '">' . $listing['manufacturers_name'] . '</a><br>';
}
if (PRODUCT_LIST_PRICE > 0) {
if (tep_not_null($listing['specials_new_products_price'])) {
$lc_text .= '<s>' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span>';
} else {
$lc_text .= ' ' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . ' ';
}
}
if (PRODUCT_LIST_BUY_NOW) {
$lc_text .= '<br><a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id'], 'NONSSL') . '">' . tep_image_button('button_buy_now.gif', TEXT_BUY . $listing['products_name'] . TEXT_NOW) . '</a>';
}
$info_box_contents[$row][$col] = array('align' => 'center', 'params' => 'class="smallText" width="33%" valign="top"',
'text' => $lc_text);
$col ++;
if ($col > PRODUCT_LIST_COL_NUM-1) {
$col = 0;
$row ++;
}
}
new contentBox($info_box_contents);
} else {
$info_box_contents = array();
$info_box_contents[0] = array('params' => 'class="productListing-odd"');
$info_box_contents[0][] = array('params' => 'class="productListing-data"',
'text' => TEXT_NO_PRODUCTS);
new contentBox($info_box_contents);
}
Option 2
-----------------------------------------------------------------------------------------------------------------------------------------------
} elseif (PRODUCT_LISTING_DISPLAY_STYLE == 'style1') {
-----------------------------------------------------------------------------------------------------------------------------------------------
if ($column_list[$col] != 'PRODUCT_LIST_BUY_NOW' &&
$column_list[$col] != 'PRODUCT_LIST_IMAGE' &&
$column_list[$col] != 'PRODUCT_LIST_DESCRIPTION')
$lc_text = tep_create_sort_heading($HTTP_GET_VARS['sort'], $col+1, $lc_text);
if ($column_list[$col] != 'PRODUCT_LIST_DESCRIPTION') {
$list_box_contents[0][] = array('align' => $lc_align,
'params' => 'class="productListing-heading"',
'text' => " " . $lc_text . " ");
}
}
if ($listing_split->number_of_rows > 0) {
$rows = 0;
$listing_query = tep_db_query($listing_split->sql_query);
while ($listing = tep_db_fetch_array($listing_query)) {
$rows++;
if (($rows/2) == floor($rows/2)) {
$list_box_contents[] = array('params' => 'class="productListing-even"');
} else {
$list_box_contents[] = array('params' => 'class="productListing-odd"');
}
$cur_row = sizeof($list_box_contents) - 1;
for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {
$lc_align = '';
$lc_params = '';
switch ($column_list[$col]) {
case 'PRODUCT_LIST_MODEL':
$lc_align = '';
$lc_text_product_model = ' ' . $listing['products_model'] . ' ';
break;
case 'PRODUCT_LIST_NAME':
$lc_align = '';
if (isset($HTTP_GET_VARS['manufacturers_id'])) {
$lc_text_product_name = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a>';
} else {
$lc_text_product_name = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a> ';
}
break;
case 'PRODUCT_LIST_DESCRIPTION':
$lc_text_short_description = ' ' . osc_trunc_string(strip_tags($listing['products_description'], '<a><b><em><font><i><s><span><strong><sub><sup><u>'), PRODUCT_LIST_DESCRIPTION_LENGTH) . ' ';
$col_to_span = sizeof($column_list)-1;
if (PRODUCT_LIST_IMAGE > 0) {
$col_to_span -= 1;
}
$lc_params = 'colspan="' . $col_to_span . '" ';
break;
case 'PRODUCT_LIST_MANUFACTURER':
$lc_align = '';
$lc_text_manufacturer = ' <a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $listing['manufacturers_id']) . '">' . $listing['manufacturers_name'] . '</a> ';
break;
case 'PRODUCT_LIST_PRICE':
$lc_align = 'right';
if (tep_not_null($listing['specials_new_products_price'])) {
//GroupDiscount start
$lc_text_product_price = ' <span class="productSpecialPrice">' . $currencies->display_price_nodiscount($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span><br><span class="productSpecialPrice3">statt vorher</span><br><s><span class="productSpecialPrice2">' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span></s>';
//$lc_text_product_price = ' <s>' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</s> aa <span class="productSpecialPrice">' . $currencies->display_price_nodiscount($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span> ';
//GroupDiscount end
} else {
$lc_text_product_price = ' ' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . ' ';
}
break;
case 'PRODUCT_LIST_QUANTITY':
$lc_align = 'right';
$lc_text_product_quantity = 'Lagerbestand:<br>' . $listing['products_quantity'] . '<br>';
break;
case 'PRODUCT_LIST_WEIGHT':
$lc_align = 'right';
$lc_text_product_weight = 'Produktgewicht:<br>' . $listing['products_weight'] . 'kg>';
break;
case 'PRODUCT_LIST_IMAGE':
$lc_align = 'center';
if (isset($HTTP_GET_VARS['manufacturers_id'])) {
$lc_text_product_image = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>';
} else {
$lc_text_product_image = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a> ';
}
if (PRODUCT_LIST_DESCRIPTION > 0) {
$lc_params = 'rowspan="2" ';
}
break;
case 'PRODUCT_LIST_BUY_NOW':
$lc_align = 'center';
$lc_text_product_buy_now = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> ';
break;
case 'PRODUCT_SORT_ORDER';
$lc_align = 'center';
$lc_text = ' ' . $listing['products_sort_order'] . ' ';
break;
}
$list_box_contents[$cur_row][] = array('align' => $lc_align,
'params' => 'class="productListing-data"',
'text' => $lc_text);
}
echo("
<tr>
<td>
<table class=\"katbox\" width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"2\">
<tr>
<td class=\"katboxInfoBoxHeading\" align=\"left\"> " . $lc_text_product_name . "</td>
</tr>
<tr>
<td>
<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\">
<tr>
<td class=\"main\" width=\"10%\" align=\"center\"> " . CENTER_BILD . "</td>
<td class=\"main\" width=\"90%\" colspan=\"2\"> " . CENTER_KURZ . "</td>
</tr>
<tr>
<td class=\"main\" width=\"10%\"> " . $lc_text_product_image . "</td>
<td class=\"main\" width=\"90%\" colspan=\"2\"><p align=\"justify\"> " . $lc_text_short_description . " </td>
</tr>
<tr>
<td class=\"main\" width=\"10%\" align=\"center\"> </td>
<td class=\"main\" width=\"50%\"> </td>
<td class=\"price1\" width=\"40%\" rowspan=\"3\" align=\"center\"> " . TEXT_PRICE . "<b><font size=\"4\"> " . $lc_text_product_price . "</font></b></td>
</tr>
<tr>
<td class=\"main\" width=\"10%\" align=\"center\"> " . TEXT_MANUFACTURER . "</td>
<td class=\"main\" width=\"50%\"> " . CENTER_MODEL . "</td>
</tr>
<tr>
<td class=\"main\" width=\"10%\" valign=\"top\" align=\"center\"> " . $lc_text_manufacturer . "</td>
<td class=\"main\" width=\"50%\" valign=\"top\"> " . $lc_text_product_model . "</td>
</tr>
<tr>
<td class=\"main\" width=\"10%\" align=\"center\">
<?php echo $lc_text_product_quantity; ?>
<?php echo $lc_text_product_weight; ?>
</td>
<td class=\"main\" width=\"50%\"> </td>
<td class=\"main\" width=\"40%\" valign=\"top\" align=\"center\"> " . $lc_text_product_buy_now . "</td>
</table>
</td>
</tr
</form>
</table></td>
</tr>
");
}
}
if ( ($listing_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3')) ) {
?>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td class="smallText"><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td>
<td class="smallText" align="right"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>
</tr>
</table>
<?php
}
?>
Es soll also entweder nur der Options wert 1 oder nur der 2te ausgegeben werden. Momentan wird bei Option 1 der 2te direkt darunter dargestellt. Wählt man Option 2 über den Admin, funktioniert es.
LG Fallout
Zuletzt bearbeitet: