maz Posted April 5, 2009 Posted April 5, 2009 Does anyone know how to call this extra image module on the Product Listing page. The idea is to show multiple extra images on product listing pages instead of linking to the Product Description page. I'm at my witts end with this on this one. The contribution I have used is extra_images_v1-61. The general code which I can place on the product info page is this: <div align="center"> <?php if (DISPLAY_EXTRA_IMAGES == 'true'){ if ($product_check['total'] >= 1) { include (DIR_WS_INCLUDES . 'products_extra_images.php'); } }; ?> </div> AND THAT WORKS FINE. Probably because its so easy to place this code within table cells, which are clearly marked on the product_info.php page. However, what's confusing is that on the product_listing.php page all the php and html table code is mixed. I'm gettiing all types of errors becasue i don't know the correct way to call this. Do I need to create a 'case 'PRODUCT_EXTRA_IMAGES:' ..... or what? . I am a bit lost. My product_listing.php page looks like this: (I made other changes and they are all working). I need to insert to call extra_images.php in a cell around line 322. (But it could be any table cell). <?php /* $Id: counter.php 1739 2007-12-20 00:52:16Z hpdl $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ // MAZ BOF ATTRIBUTES ON PODDUCT LISTING PAGE $list_box_contents = array(); $list_box_contents[] = array('params' => 'class="productListing-heading"'); $cur_row = sizeof($list_box_contents) - 1; for ($col=0, $n=sizeof($column_list); $col<$n; $col++) { switch ($column_list[$col]) { case 'PRODUCT_LIST_MULTIPLE': $add_multiple = "1"; echo '<form name="buy_now_" method="post" action="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=add_multiple', 'NONSSL') . '">'; break; } } // MAZ EOF ATTRIBUTES ON PODDUCT LISTING PAGE $listing_split = new splitPageResults($listing_sql, MAX_DISPLAY_SEARCH_RESULTS, 'p.products_id'); if ( ($listing_split->number_of_rows > 0) && ( (PREV_NEXT_BAR_LOCATION == '1') || (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 } $list_box_contents = array(); for ($col=0, $n=sizeof($column_list); $col<$n; $col++) { switch ($column_list[$col]) { case 'PRODUCT_LIST_MODEL': $lc_text = TABLE_HEADING_MODEL; $lc_align = ''; break; case 'PRODUCT_LIST_NAME': $lc_text = TABLE_HEADING_PRODUCTS; $lc_align = ''; break; case 'PRODUCT_LIST_MANUFACTURER': $lc_text = TABLE_HEADING_MANUFACTURER; $lc_align = ''; break; case 'PRODUCT_LIST_PRICE': $lc_text = TABLE_HEADING_PRICE; $lc_align = 'right'; break; case 'PRODUCT_LIST_QUANTITY': $lc_text = TABLE_HEADING_QUANTITY; $lc_align = 'right'; break; case 'PRODUCT_LIST_WEIGHT': $lc_text = TABLE_HEADING_WEIGHT; $lc_align = 'right'; break; case 'PRODUCT_LIST_IMAGE': $lc_text = TABLE_HEADING_IMAGE; $lc_align = 'center'; break; case 'PRODUCT_LIST_BUY_NOW': $lc_text = TABLE_HEADING_BUY_NOW; $lc_align = 'center'; break; // MAZ BOF ATTRIBUTES ON PODDUCT LISTING PAGE case 'PRODUCT_LIST_MULTIPLE': $lc_text = TABLE_HEADING_MULTIPLE; $lc_align = 'center'; break; // MAZ EOF ATTRIBUTES ON PODDUCT LISTING PAGE } // MAZ BOF ATTRIBUTES ON PODDUCT LISTING PAGE //if ( ($column_list[$col] != 'PRODUCT_LIST_BUY_NOW') && ($column_list[$col] != 'PRODUCT_LIST_IMAGE') ) { if ( ($column_list[$col] != 'PRODUCT_LIST_BUY_NOW') && ($column_list[$col] != 'PRODUCT_LIST_IMAGE') && ($column_list[$col] != 'PRODUCT_LIST_MULTIPLE')) { //MAZ EOF ATTRIBUTES ON PODDUCT LISTING PAGE $lc_text = tep_create_sort_heading($HTTP_GET_VARS['sort'], $col+1, $lc_text); } $list_box_contents[0][] = array('align' => $lc_align, 'params' => 'class="productListing-heading"', 'text' => ' ' . $lc_text . ' '); } if ($listing_split->number_of_rows > 0) { $rows = 0; $column = 0; echo ' <table cellpadding="0" cellspacing="0"> <tr> <td width="250" height="33" valign="middle"> <table cellpadding="0" cellspacing="0"><tr> <td width="5"></td> <td></td> <td width="6"></td> <td width="95%"><span></span></td> </tr></table></td></tr> <tr><td height="1"></td></tr> <tr><td height="2" bgcolor="transparent"> <!-- MAZ bar at top of page header was bgcolor="#E9E6E3"--> <table cellpadding="0" border=0 cellspacing="0"><tr><td height="10"></td></tr> <tr><td width="5"></td> <td><span></span> </td> </tr> <tr><td height="7"></td></tr> </table> </td> </tr> <tr> <td valign="top"><table cellpadding="0" cellspacing="0"><tr> '; $listing_query = tep_db_query($listing_split->sql_query); while ($listing = tep_db_fetch_array($listing_query)) { $product_contents = array(); $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 = ''; switch ($column_list[$col]) { case 'PRODUCT_LIST_MODEL': $lc_align = ''; $lc_text = ' ' . $listing['products_model'] . ' '; break; // BOF MAZ replaced for NEWcategory menu system STRANDS*/ /* case 'PRODUCT_LIST_NAME': $lc_align = ''; if (isset($HTTP_GET_VARS['manufacturers_id'])) { $lc_text = '<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 = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a>'; } */ case 'PRODUCT_LIST_NAME': $lc_align = ''; if (isset($HTTP_GET_VARS['manufacturers_id'])) { $lc_text = '<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 = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a> '; } //MAZ EOF replaced for NEWcategory menu system STRANDS break; case 'PRODUCT_LIST_MANUFACTURER': $lc_align = ''; $lc_text = ' <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'])) { $lc_text = '<span style="color:#7F7F7F;font-size:12px"><s>' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</s></span><br>' . $currencies->display_price($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . ''; } else { $lc_text = '' . $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 = ' ' . $listing['products_quantity'] . ' '; break; case 'PRODUCT_LIST_WEIGHT': $lc_align = 'right'; $lc_text = ' ' . $listing['products_weight'] . ' '; break; /* BOF MAZ replaced for NEWcategory menu system STRANDS*/ /* case 'PRODUCT_LIST_IMAGE': $lc_align = 'center'; if (isset($HTTP_GET_VARS['manufacturers_id'])) { $lc_text = '<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, 'class=imageborder1') . '</a>'; // maz added , 'class=imageborder1' for image border } else { $lc_text = ' <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, 'class=imageborder1') . '</a> '; // maz added , 'class=imageborder1' for image border } */ case 'PRODUCT_LIST_IMAGE': $lc_align = 'center'; if (isset($HTTP_GET_VARS['manufacturers_id'])) { $lc_text = '<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'], LISTING_IMAGE_WIDTH, LISTING_IMAGE_HEIGHT, 'class=imageborder1') . '</a>'; // maz added , 'class=imageborder1' for image border } else { $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'], LISTING_IMAGE_WIDTH, LISTING_IMAGE_HEIGHT, 'class=imageborder1') . '</a> '; // maz added , 'class=imageborder1' for image border } /* EOF MAZ replaced for NEWcategory menu system STRANDS*/ break; // // MAZ BOF ATTRIBUTES ON PODDUCT LISTING PAGE /* case 'PRODUCT_LIST_BUY_NOW': $lc_align = 'center'; $lc_text = '<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; */ // Begin Buy Now button with attributes and quantity mod case 'PRODUCT_LIST_BUY_NOW': $lc_align = 'center'; $lc_text = '<form name="buy_now_' . $listing['products_id'] . '" method="post" action="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now_form', 'NONSSL') . '">'; $lc_text .= '<input type="text" name="cart_quantity" value="1" maxlength="6" size="4">'; $lc_text .= '<input type="hidden" name="products_id" value="' . $listing['products_id'] . '">' . tep_image_submit('button_buy_now.gif', 'BUY NOW' ) . ' '; $product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . $listing['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . $languages_id . "'"); $product_info = tep_db_fetch_array($product_info_query); $products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . $listing['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . $languages_id . "'"); $products_attributes = tep_db_fetch_array($products_attributes_query); if ($products_attributes['total'] > 0) { $lc_text .= '<table border="0" cellpadding="0" cellspacing"0">'; $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . $listing['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . $languages_id . "'"); while ($products_options_name = tep_db_fetch_array($products_options_name_query)) { $selected = 0; $products_options_array = array(); $lc_text .= '<tr><td class="main">' . $products_options_name['products_options_name'] . ':</td><td>' . "\n"; $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . $listing['products_id'] . "' and pa.options_id = '" . $products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . $languages_id . "'"); while ($products_options = tep_db_fetch_array($products_options_query)) { $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']); if ($products_options['options_values_price'] != '0') { $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') '; } } $lc_text .= tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']]); $lc_text .= '</td></tr>'; } $lc_text .= '</table>'; } $lc_text .= '</form>'; break; // End Buy Now button mod // Begin Add Multiple with attributes Contrib case 'PRODUCT_LIST_MULTIPLE': $lc_align = 'right'; $lc_valign = 'top'; $lc_text = 'Qty: <input type="text" name="Qty_ProdId_' . $listing['products_id'] . '" value="0" maxlength="6" size="4">'; $product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . $listing['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . $languages_id . "'"); $product_info = tep_db_fetch_array($product_info_query); $products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . $listing['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . $languages_id . "'"); $products_attributes = tep_db_fetch_array($products_attributes_query); if ($products_attributes['total'] > 0) { $lc_text .= '<table border="0" cellpadding="0" cellspacing"0">'; $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . $listing['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . $languages_id . "'"); while ($products_options_name = tep_db_fetch_array($products_options_name_query)) { $selected = 0; $products_options_array = array(); $lc_text .= '<tr><td class="main">' . $products_options_name['products_options_name'] . ':</td><td>' . "\n"; $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . $listing['products_id'] . "' and pa.options_id = '" . $products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . $languages_id . "'"); while ($products_options = tep_db_fetch_array($products_options_query)) { $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']); if ($products_options['options_values_price'] != '0') { $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') '; } } $lc_text .= tep_draw_pull_down_menu('id'.$listing['products_id'].'[' . $products_options_name['products_options_id'] . ']', $products_options_array, $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']]); $lc_text .= '</td></tr>'; } $lc_text .= '</table>'; } break; // End Add Multiple mod // // MAZ EOF ATTRIBUTES ON PODDUCT LISTING PAGE } // // MAZ BOF ATTRIBUTES ON PODDUCT LISTING PAGE /* $list_box_contents[$cur_row][] = array('align' => $lc_align, 'params' => 'class="productListing-data"', 'text' => $lc_text); */ $list_box_contents[$cur_row][] = array('align' => $lc_align, 'valign' => $lc_valign, 'params' => 'class="productListing-data"', 'text' => $lc_text); //// MAZ EOF ATTRIBUTES ON PODDUCT LISTING PAGE $product_contents[] = $lc_text; } $product_query = tep_db_query("select products_description from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$listing['products_id'] . "' and language_id = '" . (int)1 . "'"); $product = tep_db_fetch_array($product_query); $new_products['products_description'] = $product['products_description']; echo ' <td valign="top" bgcolor="transparent"> <!-- maz was transparent or #cccccc --> <table cellpadding="0" cellspacing="0" width=100%> <tr> <td valign="top" width=257> <!-- maz was 257 width of complete row --> <table cellpadding="10" border="0" cellspacing="0" width=100%> <!-- maz test border1 around complete row --> <tr> <td width="15"></td> <td valign="top" width=150> <table cellpadding="0" border=0 cellspacing="0"> <tr><td height=30 valign=top>'.$product_contents[2].' </td></tr><!-- maz this is image --> <tr> <td height="10"></td><!-- maz this is empty row --> </tr> <tr> <td height=45 valign=middle> </td><!-- maz row available for PRODUCT EXTRA IMAGES--> </tr> <tr><td> <table cellpadding="0" cellspacing="0"> <tr><td height="5"></td></tr> <tr> <td width="100" valign="top" cellpadding="0"> <table width="120" cellpadding="0" border="0" cellspacing="0"> </table> </td> </tr> </table> </td> </tr> </table> </td> <td valign="top" bgcolor="" > <!-- maz agives background colour to info #2F323C--> <table cellpadding="0" cellspacing="0" width="350"> <!-- maz adjust width right --> <tr><b>'.$listing['products_name'].' </b></tr> </br> <tr><b>Product code: </b>'.$listing['products_model'].'</tr> </br> <tr><b>Price: </b>'.$product_contents[5].'</tr><!-- price --> </br> <tr>'.$product['products_description'].'</tr> </br> <tr ><b></b></tr> </br> <tr> <td height="10">'.$product_contents[1].'</td><!-- maz this is buy now --> </tr> </br> </table> </td> </tr> <tr><td height="11"></td></tr> </table> </td> </tr> </table> </td> '; $column ++; //maz was if ($column >= 2) changed for 1product per row if ($column >= 1) { $rows ++; $column = 0; echo ' </tr> <tr><td height="1"></td></tr> <tr> '; } else echo '<td width="1"></td>'; } echo ' </tr> </table> </td> </tr> </table> '; //new productListingBox($list_box_contents); } else { $list_box_contents = array(); $list_box_contents[0] = array('params' => 'class="productListing-odd"'); $list_box_contents[0][] = array('params' => 'class="productListing-data"', 'text' => TEXT_NO_PRODUCTS); echo '<div class=PageHeading>Categories</div>'; new productListingBox($list_box_contents); } 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 height=2></td></tr> <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 } ?>
maz Posted April 7, 2009 Author Posted April 7, 2009 Anyone who canat least give some guidance....please.
BryceJr Posted April 7, 2009 Posted April 7, 2009 ... However, what's confusing is that on the product_listing.php page all the php and html table code is mixed. I'm gettiing all types of errors becasue i don't know the correct way to call this. Do I need to create a 'case 'PRODUCT_EXTRA_IMAGES:' ..... or what? . I am a bit lost. My product_listing.php page looks like this: (I made other changes and they are all working). I need to insert to call extra_images.php in a cell around line 322. (But it could be any table cell). I'm looking at instructions on installation of "extra_images_v1-61" 28 Apr 2007 download. Where does it say that you need to add or alter code to product_listing.php?
maz Posted April 7, 2009 Author Posted April 7, 2009 I'm looking at instructions on installation of "extra_images_v1-61" 28 Apr 2007 download. Where does it say that you need to add or alter code to product_listing.php? Hi Bryce. IT DOESN'T. I have modified the product listing page myself, so that it now lists products (all items by specific category) and now also has buy now buttons, attributes and product descriptions. Everything works great. These were fairly easy to do. But I got stuck on what should have been the EASIEST of the lot (lol). Just cant get the 'extra images to appear on product_listing.php ! Any help would be apreciated. Thanks.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.