Hello,
I discovered a minor bug while attempting to validate the category/manufacturer product list pages on a fresh install of 1.3.0.2. The validation fails due to a change in the way the attributes are added to the product list table by the tpl_tabular_display.php script.
Here's an example of the default output (note: links/content removed):
Code:
<table width="100%" border="0" cellspacing="0" cellpadding="0" id="cat30Table" class="tabTable">
<tr class="productListing-rowheading">
<th class="productListing-heading" center scope="col" id="listCell0-0">Product Image</th>
<th class="productListing-heading" scope="col" id="listCell0-1">Item Name-</th>
<th class="productListing-heading" right" width="125 scope="col id="listCell0-2">Price</th>
</tr>
<tr class="productListing-odd">
<td class="productListing-data" center></td>
<td class="productListing-data" ></td>
<td class="productListing-data" right></td>
</tr>
</table>
The offending code is highlighted. The alignment attribute won't validate since shorttags is not enabled. Also, there's an extra quotation mark added to the price th tag; this is left over behavior from the 1.2.x version (at least) that would add quotation marks around the alignment value (see line 40 in includes/modules/product_listing.php).
I fixed this by mimicking the method used in 1.2.x which added "align=" before the alignment values. In 'includes/templates/TEMPLATE_NAME/common/tpl_tabular_display.php' I changed line 32 from this:
Code:
if (isset($list_box_contents[$row][$col]['align'])) $c_params .= ' ' . $list_box_contents[$row][$col]['align'];
to this:
Code:
if (isset($list_box_contents[$row][$col]['align']) && $list_box_contents[$row][$col]['align']) $c_params .= ' align="' . $list_box_contents[$row][$col]['align'] . '"';
I added the extra conditional because isset will return true regardless of whether or not the variable has any value assigned to it (so long as it isn't NULL). Without it, you'd get align="", which is not valid, for any of the columns that aren't assigned an alignment value in product_listing.php.
This should produce code that validates as xhtml transitional 1.0 (does for me):
Code:
<table width="100%" border="0" cellspacing="0" cellpadding="0" id="cat30Table" class="tabTable">
<tr class="productListing-rowheading">
<th class="productListing-heading" align="center" scope="col" id="listCell0-0">Product Image</th>
<th class="productListing-heading" scope="col" id="listCell0-1">Item Name-</th>
<th class="productListing-heading" align="right" width="125" scope="col" id="listCell0-2">Price</th>
</tr>
<tr class="productListing-odd">
<td class="productListing-data" align="center"></td>
<td class="productListing-data" ></td>
<td class="productListing-data" align="right"></td>
</tr>
</table>
Bookmarks