Jump to content

Pagination - View All


Claudia

Recommended Posts

As best I can determine, there are about three areas in the code that affect the page=all situation on the storefront. None actually stop CubeCart from delivering all pertinent records. But these changes do implement a new pagination sequence on the storefront and a per page selector - the selections of which can be customized.

Let's look at the skin's config.xml file: <products>, <perpage> array. Note that the last array element is (probably) set to an amount equal to 96. More <perpage> elements can be added - an amount equal to 192, for example. (Have CubeCart clear its internal cache if this file gets changed.)

The first area in the code is the element.paginate.php skin template. In the various skin's that were published with and for CC5, there is code to show a 'All' link when the Smarty variable {$view_all} is true. For Foundation (the only skin published with CC6), that 'All' code was commented out, showing instead a drop-down selector listing the various <perpage> amounts. In CC652, that commented out 'All' code was removed.

Should the visitor want to see more products per page, using the drop-down selector is how it is done. Should the store owner want to have a 'All' pseudo-capability, add a <perpage> element with an amount equal to some large number - 192, for example.

As was mentioned, be sure the environment that hosts your site is capable. (And, if the page is to show a couple dozen rows of product panels, look into implementing a "lazy-load" of product images.)

The second area is in the database class, pagination function. In CC6410 and CC652, when calculating the pagination data for the skin's element.paginate.php template, if there should be page=all in the link, then the data given to the template will be changed to page=1 and per_page=X where X is the last <perpage> amount - 192, for example. So, if there are less than this amount to show, there will be no pagination, thus, a 'All' pseudo-capability.

Note that this pagination function still provides a true (default) or false value to the Smarty variable {$view_all}, for CC5 skins, or any skin that really wants to have this in the pagination string.

The third area is in the catalogue class, searchCatalogue function. This function returns search hits, products on sale, and products belonging to a given category.

If page=all is found here, CubeCart sets a hard limit of 100 records to be returned from the database for sale items and search hits.

For products belonging to a given category, the getCategoryProducts function will not use page and per_page when page=all, thus all pertinent records are returned.

Lists in admin have also, recently, adopted this paradigm.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...