Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2006
    Posts
    229
    Plugin Contributions
    0

    Default Table layout issues

    Hey all. I'm doing a cart with the newest version here (1.3.8), and I'm noticing an issue. I searched for the answer first, but either this hasn't been asked before, or I'm searching for the wrong thing. So I don't know if this is something *I've* done or if this is an actual bug that needs reported.

    So, here's the thing. On my store, I have it set to show 12 items per page, in 3 columns (so it should display 12 items, with 3 items in each row). However, they're showing one per row.

    I viewed the source code, and this is what I see:

    <table border="0" width="100%" cellspacing="2" cellpadding="2">
    <tr>
    <td colspan="3"><hr /></td>
    </tr>
    <tr class="productListing-odd">
    <td width="150" valign="top" class="main" align="center">
    <a href="http://localhost/ZenCart1.3.8/index.php?main_page=product_info&amp;cPath=1&amp;products_id=1"><img src="images/anna-blue.jpg" alt="Anna" title=" Anna " width="104" height="88" /></a><br clear="all" /><a href="http://localhost/ZenCart1.3.8/index.php?main_page=product_info&amp;cPath=1&amp;products_id=1"><strong>Anna</strong></a><br clear="all" /><br clear="all" /> </td>
    <td colspan="2" valign="top" class="main">
    </td>
    </tr>

    Now, I don't know if you can tell through that jumble there, but what it's doing is providing a "td" with a colspan of "3", instead of making the *table* a colspan of 3.

    ow, like I said, I don't know if I have a setting wrong (which I very well may - I've been scouring the admin are trying to find that setting because I cant remember where it is!) or if this is an actual boo-boo in the code itself. So if someone could smack me with the answer, I'd appreciate it :)

    Thanks!

  2. #2
    Join Date
    Jan 2006
    Posts
    229
    Plugin Contributions
    0

    Default Re: Table layout issues

    Okay, nevermind. I got it. I hate to leave people hanging (in case anyone else runs into this issue, and it truly hasn't been posted anywhere else) - so I'll leave my solution.

    I *didn't* set the columns - the cart is set by default in the code to display one item per row, and then have the info displayed in 3 columns within each row. What I was looking for was to display each item side-by side - just the image and the name of the item, 3 items per row. So I had to edit the code.

    What I did was open up tpl_modules_products_all_listing.php and basically edited the hell out of it. I needed it to have td cells side-by-side, with ebery third cell having the table row break (tr tag), so basically I did this:

    replaced the beginning with this:

    <table border="0" width="100%" cellspacing="2" cellpadding="2" colspan="3">
    <tr class="<?php echo ((int)($row_counter/2)==($row_counter/2)) ? 'productListing-even' : 'productListing-odd'; ?>">

    <?php
    $group_id = zen_get_configuration_key_value('PRODUCT_ALL_LIST_GROUP_ID');

    at this point I left stuff alone until I got to the "<tr class="</php echo((int)) {..." section (around lin 118). I deleted that line. In the next line, I added <?php $row_counter;?> *immediately * after the opening <td> tag, so set what TD we were on.

    At the next section (line 154, I think?) There's a closing td tag, and a bunch of stuff after that. I replaced *all* of that (after the closing </td> tag) with the following:

    <?php if ($row_counter == "3") { echo "</tr>"; $row_counter == "0";} ?>

    <?php
    $products_all->MoveNext();
    }
    } ?>
    </table>


    Granted, I removed a lot of stuff, but in my specific case, I didn't need it, so it works for me If you need some alterations, then you'll have to edit as you see fit. but basically, what this does is watch the $row_counter, and when it hits "3", it inserts the closing </tr> tag and starts the loop over again - resetting the count to "0" - that way every third item breaks into a new row.

    Hopefully that helps someone else :)

  3. #3
    Join Date
    Mar 2008
    Location
    Cape Town & London (depends on the season)
    Posts
    2,975
    Plugin Contributions
    0

    Default Re: Table layout issues


  4. #4
    Join Date
    Jan 2006
    Posts
    229
    Plugin Contributions
    0

    Default Re: Table layout issues

    Ha! Nope - didn't know about it - but thanks! That'll make it MUCH easier next time!

 

 

Similar Threads

  1. PayPal_Session DB Table Issues
    By johnkosh in forum PayPal Website Payments Pro support
    Replies: 5
    Last Post: 11 May 2009, 07:30 PM
  2. Table Rate Issues when based on Price (getting 0.00)
    By bunnyrific in forum Built-in Shipping and Payment Modules
    Replies: 40
    Last Post: 1 Feb 2009, 05:01 PM
  3. MYSQL table EMPTY causing issues
    By lindasdd in forum General Questions
    Replies: 3
    Last Post: 18 May 2008, 01:41 PM
  4. Major issues with Column Layout / Grid Layout for Products Listing
    By kinget in forum All Other Contributions/Addons
    Replies: 5
    Last Post: 27 Jul 2007, 10:11 PM
  5. Table Issues
    By sickfishsigns in forum Templates, Stylesheets, Page Layout
    Replies: 5
    Last Post: 21 Dec 2006, 08:56 PM

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