w^2 Posted April 17, 2008 Posted April 17, 2008 Can anyone direct me to a thread on customizing the product listing page? I'd like to just have them fill the page in ~200x200pixel boxes with the image, name, and price but after much scouring of the code (and even Google), I can't seem to win the war against the default 100% wide table that lists the products in rows. Let me know what you think. many thanks, -Ryan w^2 Quote
dmnalven Posted April 18, 2008 Posted April 18, 2008 How about just using the code from the new product listing and modifying it to show your viewing category products instead? Quote For ALL problems, please review this link first -> osCommerce Knowledge Base
dmnalven Posted April 20, 2008 Posted April 20, 2008 This still does not use div's but will display a 'Show All' link at your split page location (top and or bottom) and return a category product listing all in one table cell using the generated rendering of new_products.php. YMMV This is NOT at the level of a contribution yet. Based on 2.2rc2a code, it has not been tested with all the features of a default install. Requirements and caveats: Copy all_products.php (below) to includes/modules/. Add the filename, " define('FILENAME_ALL_PRODUCTS', 'all_products.php');", to includes/filenames.php Add definition to your_language/index.php for 'TABLE_HEADING_ALL_PRODUCTS', "define('TABLE_HEADING_ALL_PRODUCTS', 'All Products in Category');" Add definition to your_language.php for 'TEXT_SHOW_ALL', "define('TEXT_SHOW_ALL', 'Show All in One Page');" Add: <td class="smallText"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT, ($cPath ? 'cPath=' . $cPath . '&show_all=1' : '')) . '">'; ?><font color="#000099"><?php echo TEXT_SHOW_ALL; ?></font></a></td> between the table cells for 'display_count' and display_links at the beginning and end of includes/modules/product_listing.php Replace:" <td><?php include(DIR_WS_MODULES . FILENAME_NEW_PRODUCTS); ?></td>" // default lines #121 & #280, index.php with: <td> <?php if ($HTTP_GET_VARS['show_all']) { include(DIR_WS_MODULES . FILENAME_ALL_PRODUCTS); } else { include(DIR_WS_MODULES . FILENAME_NEW_PRODUCTS); } ?> </td> I added another image size definition to the configuration table though the code below uses the 'SMALL' image settings. You could test against MAX_DISPLAY_SEARCH_RESULTS to only show the link if it exceeds the value. Any and all corrections and improvements welcomed. Enjoy <?php /* $Id: all_products.php 0000 2008-04-20 21:38:44Z dmn $ modified from: $id: new_products.php 1806 2008-01-11 22:48:15Z hpdl $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2008 osCommerce changes Copyright (c) 2008 Dan M Nalven, [email protected] Released under the GNU General Public License */ ?> <!-- all_products //--> <?php $info_box_contents = array(); $info_box_contents[] = array('text' => sprintf(TABLE_HEADING_ALL_PRODUCTS)); new contentBoxHeading($info_box_contents); if ( (!isset($current_category_id)) || ($current_category_id == '0') ) { $all_products_query = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, pd.products_name, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by rand()"); } else { $all_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, pd.products_name, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.categories_id = '" . (int)$current_category_id . "' and p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by rand()"); } $row = 0; $col = 0; $info_box_contents = array(); while ($all_products = tep_db_fetch_array($all_products_query)) { // changed by dmn 04/15/08 valign from 'top' // and image size to new config define LARGE_IMAGE_* from SMALL_IMAGE_* $info_box_contents[$row][$col] = array('align' => 'center', 'params' => 'class="smallText" width="33%" valign="middle"', 'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $all_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $all_products['products_image'], $all_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $all_products['products_id']) . '">' . $all_products['products_name'] . '</a><br>' . $currencies->display_price($all_products['products_price'], tep_get_tax_rate($all_products['products_tax_class_id']))); $col ++; if ($col > 2) { $col = 0; $row ++; } } new contentBox($info_box_contents); ?> <!-- all_products_eof //--> Quote For ALL problems, please review this link first -> osCommerce Knowledge Base
dmnalven Posted April 20, 2008 Posted April 20, 2008 Install modification change (already). Don't show the "Show All" link in the search results. Listing this is not implemented in all_products.php . Instead of the simple one line addition to includes/modules/product_listing.php, add below between the the table cells for 'display_count' and 'display_links' at the beginning and end. <?php if (strpos($PHP_SELF, 'search')) { } else { echo '<td class="smallText"><a href="' . tep_href_link(FILENAME_DEFAULT, ($cPath ? 'cPath=' . $cPath. '&show_all=1' : '')) . '"><font color="#000099">' . TEXT_SHOW_ALL . '</font></a></td>'; } ?> Quote For ALL problems, please review this link first -> osCommerce Knowledge Base
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.