If you have done the renaming correctly by editing a define file, it will make no difference to the code function.
Note that this mod will not show the description at all, whether you have set it to display or not. You can fix this by adding a line in the middle of the main new code section. This code is poorly adapted as is, with unnecessary duplication, but if you want to display the description in a place of your choosing, the duplication becomes necessary.
Original mod:```php
//...
if (PRODUCT_ALL_LIST_DESCRIPTION != '0') {
$disp_text = zen_get_products_description($products_all->fields['products_id']);
$disp_text = zen_clean_html($disp_text);
$display_products_description = stripslashes(zen_trunc_string($disp_text, 150, '<a href="' . zen_href_link(zen_get_info_page($products_all->fields['products_id']), 'products_id=' . $products_all->fields['products_id']) . '"> ' . MORE_INFO_TEXT . '</a>'));
} else {
$display_products_description = '';
}
?>
<?php
if(($row_counter-1)%4 == 0)
{
?>
<tr>
<?php
}
?>
<td width="<?php echo IMAGE_PRODUCT_ALL_LISTING_WIDTH + 10; ?>" valign="top" class="main" align="center">
<?php
$disp_sort_order = $db->Execute("select configuration_key, configuration_value from " . TABLE_CONFIGURATION . " where configuration_group_id='" . $group_id . "' and (configuration_value >= 1000 and configuration_value <= 1999) order by LPAD(configuration_value,11,0)");
while (!$disp_sort_order->EOF) {
if ($disp_sort_order->fields['configuration_key'] == 'PRODUCT_ALL_LIST_IMAGE') {
echo $display_products_image;
}
if ($disp_sort_order->fields['configuration_key'] == 'PRODUCT_ALL_BUY_NOW') {
echo $display_products_button;
}
if ($disp_sort_order->fields['configuration_key'] == 'PRODUCT_ALL_LIST_NAME') {
echo $display_products_name;
}
if ($disp_sort_order->fields['configuration_key'] == 'PRODUCT_ALL_LIST_PRICE') {
echo $display_products_price;
}
$disp_sort_order->MoveNext();
}
$disp_sort_order = $db->Execute("select configuration_key, configuration_value from " . TABLE_CONFIGURATION . " where configuration_group_id='" . $group_id . "' and (configuration_value >= 2000 and configuration_value <= 2999) order by LPAD(configuration_value,11,0)");
while (!$disp_sort_order->EOF) {
if ($disp_sort_order->fields['configuration_key'] == 'PRODUCT_ALL_LIST_IMAGE') {
echo $display_products_image;
}
if ($disp_sort_order->fields['configuration_key'] == 'PRODUCT_ALL_BUY_NOW') {
echo $display_products_button;
}
if ($disp_sort_order->fields['configuration_key'] == 'PRODUCT_ALL_LIST_NAME') {
echo $display_products_name;
}
if ($disp_sort_order->fields['configuration_key'] == 'PRODUCT_ALL_LIST_PRICE') {
echo $display_products_price;
}
$disp_sort_order->MoveNext();
}
?>
</td>
<?php
$products_all->MoveNext();
}
} else {
?>
<tr>
<td class="main" colspan="2"><?php echo TEXT_NO_ALL_PRODUCTS; ?></td>
</tr>
<?php
}
?>
</tr>
</table>
```
Add a line
echo $display_products_description . '<br />';
Remove the hard-coded styling from the table cell, as this is better controlled in the stylesheet.
width="<?php echo IMAGE_PRODUCT_ALL_LISTING_WIDTH + 10; ?>" valign="top" ... align="center"
The more I look at this the more logic errors I find...
The row logic is set to make rows of four products
if(($row_counter-1)%4 == 0)
but the old row is never closed when the new one is started.
The first row is given the odd/even classname, but subsequent rows have no classname (the odd/even logic is out of the loop).
The odd/even logic is based on two alternating products, and will not work correctly for other numbers even if it is moved to a useful location. Of course, the whole thing is not applicable to this layout and needs to be rethought.
I have done a basic functional version of row naming.
Slightly improved version:```php
<?php
/**
* Module Template
*
* Loaded automatically by index.php?main_page=products_all.<br />
* Displays listing of All Products
*
* @package templateSystem
* @copyright Copyright 2003-2006 Zen Cart Development Team
* @copyright Portions Copyright 2003 osCommerce
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
*
@version $Id: tpl_modules_products_all_listing.php 4629 2006-09-28 15:29:18Z ajeh $
*/
?>
<table border="0" width="100%" cellspacing="2" cellpadding="2">
<tr>
<td colspan="3"><hr /></td>
</tr>
<?php
$group_id = zen_get_configuration_key_value('PRODUCT_ALL_LIST_GROUP_ID');
if ($products_all_split->number_of_rows > 0) {
$products_all = $db->Execute($products_all_split->sql_query);
$row_counter = 1;
$col_counter = 0;
while (!$products_all->EOF) {
if (PRODUCT_ALL_LIST_IMAGE != '0') {
//lots of code...
if (PRODUCT_ALL_LIST_DESCRIPTION != '0') {
$disp_text = zen_get_products_description($products_all->fields['products_id']);
$disp_text = zen_clean_html($disp_text);
$display_products_description = stripslashes(zen_trunc_string($disp_text, 150, '<a href="' . zen_href_link(zen_get_info_page($products_all->fields['products_id']), 'products_id=' . $products_all->fields['products_id']) . '"> ' . MORE_INFO_TEXT . '</a>'));
} else {
$display_products_description = '';
}
?>
<?php
if($col_counter == 3) { //start a new row - change "3" to products per row desired
$col_counter = -1;//reset column
if($row_counter > 1) {
echo '</tr>'; //close the previous <tr> for all but the first row
}
$row_counter++;//increment row
echo '<tr class="productListing-row">';
}
$col_counter++;//increment column
?>
<td class="main">
<?php
$disp_sort_order = $db->Execute("select configuration_key, configuration_value from " . TABLE_CONFIGURATION . " where configuration_group_id='" . $group_id . "' and (configuration_value >= 1000 and configuration_value <= 1999) order by LPAD(configuration_value,11,0)");
while (!$disp_sort_order->EOF) {
if ($disp_sort_order->fields['configuration_key'] == 'PRODUCT_ALL_LIST_IMAGE') {
echo $display_products_image;
}
if ($disp_sort_order->fields['configuration_key'] == 'PRODUCT_ALL_BUY_NOW') {
echo $display_products_button;
}
if ($disp_sort_order->fields['configuration_key'] == 'PRODUCT_ALL_LIST_NAME') {
echo $display_products_name;
}
if ($disp_sort_order->fields['configuration_key'] == 'PRODUCT_ALL_LIST_PRICE') {
echo $display_products_price;
}
$disp_sort_order->MoveNext();
}
echo $display_products_description . '<br />'; //add product description if enabled
$disp_sort_order = $db->Execute("select configuration_key, configuration_value from " . TABLE_CONFIGURATION . " where configuration_group_id='" . $group_id . "' and (configuration_value >= 2000 and configuration_value <= 2999) order by LPAD(configuration_value,11,0)");
while (!$disp_sort_order->EOF) {
if ($disp_sort_order->fields['configuration_key'] == 'PRODUCT_ALL_LIST_IMAGE') {
echo $display_products_image;
}
if ($disp_sort_order->fields['configuration_key'] == 'PRODUCT_ALL_BUY_NOW') {
echo $display_products_button;
}
if ($disp_sort_order->fields['configuration_key'] == 'PRODUCT_ALL_LIST_NAME') {
echo $display_products_name;
}
if ($disp_sort_order->fields['configuration_key'] == 'PRODUCT_ALL_LIST_PRICE') {
echo $display_products_price;
}
$disp_sort_order->MoveNext();
}
?>
</td>
<?php
$products_all->MoveNext();
}
} else {
?>
<tr>
<td class="main" colspan="2"><?php echo TEXT_NO_ALL_PRODUCTS; ?></td>
</tr>
<?php
}
?>
</tr>
</table>
```Add to your stylesheet```
.productListing-row .main {
vertical-align: top;
text-align: center;
}
```
Note: This is not tested, so might have a typo or two. if you try it, please post with results.