Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2006
    Posts
    9
    Plugin Contributions
    0

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

  2. #2
    Join Date
    Jan 2004
    Posts
    66,364
    Blog Entries
    7
    Plugin Contributions
    274

    Default 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.

  3. #3
    Join Date
    Jun 2006
    Posts
    9
    Plugin Contributions
    0

    Default Re: Product List Validation Errors

    Sorry, you're right, it is the same issue, and I didn't see that before posting.
    Last edited by rispku; 8 Aug 2006 at 01:26 PM.

 

 

Similar Threads

  1. Validation errors
    By maxy007 in forum General Questions
    Replies: 16
    Last Post: 21 Mar 2011, 01:32 PM
  2. Validation Errors
    By vitalwares in forum General Questions
    Replies: 6
    Last Post: 31 May 2008, 10:15 AM
  3. Validation Errors
    By fantasticals in forum General Questions
    Replies: 2
    Last Post: 1 Apr 2008, 06:38 PM
  4. Validation errors
    By Woody619 in forum General Questions
    Replies: 6
    Last Post: 16 Apr 2007, 09:48 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR