Forums / Bug Reports / Product List Validation Errors

Product List Validation Errors

Locked

Started by rispku on 8 Aug 2006, 11:30 AM · Views: 2,422

Results 1 to 3 of 3
This thread is locked. New replies are disabled.
8 Aug 2006, 11:30 AM
#1
rispku avatar

rispku

New Zenner

Join Date:
Jun 2006
Posts:
9
Plugin Contributions:
0

Product List Validation Errors

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):

<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: ```
      if (isset($list_box_contents[$row][$col]['align'])) $c_params .= ' ' . $list_box_contents[$row][$col]['align'];
``` to this: ```
      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):```
<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>
8 Aug 2006, 11:36 AM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: Product List Validation Errors

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

8 Aug 2006, 12:21 PM
#3
rispku avatar

rispku

New Zenner

Join Date:
Jun 2006
Posts:
9
Plugin Contributions:
0

Re: Product List Validation Errors

Sorry, you're right, it is the same issue, and I didn't see that before posting.