Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2008
    Posts
    6
    Plugin Contributions
    0

    help question 3 items per page, except for some..

    Hey guys,

    When displaying items in a category, I want to only show 3 items per page. That's no big deal, but, the client wants some pages to only show 2 item images, with one of the images taking up the space of 2 normal images. Ex:

    Normal page:

    |pic| |pic| |pic|

    A few pages:

    |pic| |---pic---|

    So, some pages would have 3 images, and others have 2. I don't know what you'd even base it off of, but I wanted to know if it was do-able to begin with.

    Thanks,

    Matt

  2. #2
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: 3 items per page, except for some..

    For starters, get the Column Layout Grid mod from Downloads. That will allow you to specify that the products appear side by side.

    Then there is the issue of displaying the wide images, and only displaying two images per page when one is wide.
    I don't have time to think about those tonight, but look at product_listing.php in the mod files and you may see a way to proceed. For the wide images, I would remove the percent width calculation and let the images control the space taken.

  3. #3
    Join Date
    Jun 2008
    Posts
    6
    Plugin Contributions
    0

    Default Re: 3 items per page, except for some..

    Yeah, it's not so much the issue of having an image take up the extra space, but rather of having the cart only pull 2 items from the database for a page, but only if one of the images is larger. Otherwise pull 3.

    The database can't really determine that, and once you get past that initial pull from the database (if you'd do the logic in PHP), you'd loose using the database for the paging with it's LIMIT and OFFSET features. The database can't do the logic of "there's 30 items, and 3 per page, but on page 5, 7, and 8 there will only be 2 products since the images are wider, so that makes it 9 pages rather than 10".

    Does that make sense? I just don't see how it is even possible, but maybe I'm missing something.

    Thanks,

    Matt

  4. #4
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: 3 items per page, except for some..

    It may require another product field in the db for "width" or something like that. Once the db has the info, the php can be coded to account for all the ramifications of the wide images.

  5. #5
    Join Date
    Jun 2008
    Posts
    1
    Plugin Contributions
    0

    Default Re: 3 items per page, except for some..

    Quote Originally Posted by mdewyer View Post
    The database can't do the logic of "there's 30 items, and 3 per page, but on page 5, 7, and 8 there will only be 2 products since the images are wider, so that makes it 9 pages rather than 10".
    You're correct. Even if you were to add a field to the database to indicate that an image was bigger, it still doesn't solve the issue of determining the paging. The problem lies in the fact that a larger image would take the space of two products. So, if you pull three items and one has a larger image, it will be taking up a total of four widths, rather than three. And, if you'd hide one of the smaller images on that page (so you get to the needed three widths), then the database offset for the next page would be off, and the hidden product would not be displayed on the following page.

    This is not an issue with ZenCart, but rather a limitation of what's possible with paging based off a database, like you explained. You can't, in a query, look at what you're about too pull and if one of the items has a larger image, only pull two, and still keep the paging intact, because the paging is going off of the fact that there are supposed to be three items per page, not three sometimes, and two other times. It throws the whole paging logic out of sync.

    Sorry, but I think you're going to have to tell the client that it's not feasible.

 

 

Similar Threads

  1. add some items for contact_us page
    By win8win in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 12 Sep 2012, 11:20 AM
  2. Shipping via USPS except some items need to be flat rate
    By kylex in forum Built-in Shipping and Payment Modules
    Replies: 1
    Last Post: 6 May 2010, 11:22 PM
  3. Change number of items per page, and adding multiple images per product
    By aidanacker in forum Templates, Stylesheets, Page Layout
    Replies: 5
    Last Post: 8 May 2008, 01:17 AM
  4. per-item shipping - can some items count as 2?
    By pglenn in forum Built-in Shipping and Payment Modules
    Replies: 3
    Last Post: 22 Jan 2008, 04:05 AM
  5. per unite weight only for some items
    By bangsters in forum General Questions
    Replies: 6
    Last Post: 13 Dec 2006, 04:44 AM

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