Page Numbering

Questions and answers about ShopSite Custom Templates

Page Numbering

Postby koryb1 » Mon Jun 27, 2016 4:44 pm

The template portion of our page numbering previously read like this:

[-- IF PAGE.NumProducts "0" --][-- ELSE --][-- VAR.ProductType "full" --]
[-- IF PAGE.ProductsPerPage NE "0" --]<div id="bbpag1" class="bbpagination">[-- IF PAGE.PaginatedPageNumMax GT 0 --]<span>Page</span>[-- END_IF --][-- PrevNext NoCenter --]</div>[-- END_IF --]
<div id="bblpprods" class="loop[-- VAR.Cols --][-- IF PAGE.DisplayColumnBorders --] borders[-- END_IF --]"><ul id="bb-loopproducts" class="bb-loopheight">[-- VAR.Count 0 --][-- LOOP PRODUCTS --]<li class="prod bb-matchheight">[-- PRODUCT --]</li>[-- IF VAR.Count EQ VAR.MaxCount --][-- VAR.Count 0 --][-- END_IF --][-- END_LOOP PRODUCTS --]</ul><div class="clear"></div></div>

A result might look like this:

Page 1 2 3 4 Next

I typically show 18 products per page, but in addition to this I wanted to add a "View All" feature to our website. My solution (using my "Bags" page as an example) was:
1. Copy Bags page keeping all page links and assigned products. I named this new page Bags - All (filename bags-all.html).
2. On the Layout Settings of Bags - All I changed the Max # of products per page to 1,000, essentially making this a View All page for this category.
3. I created a custom Page Field 2. In this field on my original Bags page, I entered <a href="http://www.dancesupplies.com/bags-all.html">View All</a>.

I placed the [-- PAGE.Field2 --] in the template, so it now reads like this:

[-- IF PAGE.NumProducts "0" --][-- ELSE --][-- VAR.ProductType "full" --]
[-- IF PAGE.ProductsPerPage NE "0" --]<div id="bbpag1" class="bbpagination">[-- IF PAGE.PaginatedPageNumMax GT 0 --]<span>Page</span>[-- END_IF --][-- PrevNext NoCenter --][-- PAGE.Field2 --]</div>[-- END_IF --]
<div id="bblpprods" class="loop[-- VAR.Cols --][-- IF PAGE.DisplayColumnBorders --] borders[-- END_IF --]"><ul id="bb-loopproducts" class="bb-loopheight">[-- VAR.Count 0 --][-- LOOP PRODUCTS --]<li class="prod bb-matchheight">[-- PRODUCT --]</li>[-- IF VAR.Count EQ VAR.MaxCount --][-- VAR.Count 0 --][-- END_IF --][-- END_LOOP PRODUCTS --]</ul><div class="clear"></div></div>

The result is:

Page 1 2 3 4 Next View All

This works pretty well. The "View All" links to the new Bags page that lists all assigned products to it. However, I would like to improve it further:

For pages with 18 products or less, I still see this:

Page View All

Is there a way edit the code to hide the page navigation altogether when there is only one page, and have it show up only when there is more than one page?

Thanks in advance!
koryb1
 
Posts: 88
Joined: Tue Feb 14, 2012 7:10 pm

Re: Page Numbering

Postby ShopSite Lauren » Sat Aug 06, 2016 6:02 pm

Kory, I know you already have this changed but I wanted to include more information for any other merchant with this same question on the forum.

You can add an additional IF statement that says IF the page number of products is greater than (GT) the product page page number then add "Page" in front.

[-- IF PAGE.NumProducts GT PAGE.ProductsPerPage --][-- END_IF --]
- ShopSite Lauren
Contact me for help with any of your
custom ShopSite template questions.
ShopSite Lauren
 
Posts: 889
Joined: Fri Aug 11, 2006 1:35 pm
Location: Orem, UT


Return to Custom Template Questions

Who is online

Users browsing this forum: No registered users and 2 guests