From 14e5ee62a79042abf69698d28506a31a7328a64c Mon Sep 17 00:00:00 2001 From: touffies Date: Wed, 6 Nov 2013 18:57:22 +0100 Subject: [PATCH] Hide pagination if there is only 1 page --- templates/default/category.html | 5 +-- templates/default/includes/toolbar.html | 46 +++++++++++++------------ templates/default/search.html | 5 +-- templates/default/view_all.html | 6 ++-- 4 files changed, 33 insertions(+), 29 deletions(-) diff --git a/templates/default/category.html b/templates/default/category.html index f89deef2c..c47708ced 100644 --- a/templates/default/category.html +++ b/templates/default/category.html @@ -19,7 +19,8 @@ {$product_order={$smarty.get.order|default:'alpha'}}
{ifloop rel="product_list"} - {include file="includes/toolbar.html" toolbar="top" limit=$limit order=$product_order amount={count type="product" category={category attr="id"}}} + {assign var="amount" value="{count type="product" category={category attr="id"}}"} + {include file="includes/toolbar.html" toolbar="top" limit=$limit order=$product_order amount={$amount}}
    @@ -29,7 +30,7 @@
- {include file="includes/toolbar.html" toolbar="bottom"} + {include file="includes/toolbar.html" toolbar="bottom" amount={$amount}} {/ifloop} {elseloop rel="product_list"}
diff --git a/templates/default/includes/toolbar.html b/templates/default/includes/toolbar.html index 07733634b..ff8b0d69b 100644 --- a/templates/default/includes/toolbar.html +++ b/templates/default/includes/toolbar.html @@ -37,31 +37,33 @@
{else} -
- {intl l="Pagination"} -
    + {if $amount > $limit} +
    + {intl l="Pagination"} +
      - {if $product_page > 1} -
    • - {else} -
    • - {/if} - {pageloop rel="product_list"} - {if $PAGE != $CURRENT} -
    • {$PAGE}
    • - {else} -
    • {$PAGE}
    • - {/if} - {if $PAGE == $LAST} - {if $CURRENT < $LAST} -
    • + {if $product_page > 1} +
    • {else} -
    • +
    • {/if} + {pageloop rel="product_list"} + {if $PAGE != $CURRENT} +
    • {$PAGE}
    • + {else} +
    • {$PAGE}
    • + {/if} + {if $PAGE == $LAST} + {if $CURRENT < $LAST} +
    • + {else} +
    • + {/if} - {/if} - {/pageloop} -
    -
    + {/if} + {/pageloop} +
+
+ {/if} {/if} diff --git a/templates/default/search.html b/templates/default/search.html index ff8955cf0..2151ace21 100644 --- a/templates/default/search.html +++ b/templates/default/search.html @@ -20,7 +20,8 @@

{intl l="Search Result for"} {$smarty.get.q}

- {include file="includes/toolbar.html" toolbar="top" limit=$limit order=$product_order amount={count type="product" title="{$smarty.get.q}"}} + {assign var="amount" value="{count type="product" title="{$smarty.get.q}"}"} + {include file="includes/toolbar.html" toolbar="top" limit=$limit order=$product_order amount={$amount}}
{ifloop rel="product_list"} @@ -36,7 +37,7 @@
{ifloop rel="product_list"} - {include file="includes/toolbar.html" toolbar="bottom"} + {include file="includes/toolbar.html" toolbar="bottom" amount={$amount}} {/ifloop}
diff --git a/templates/default/view_all.html b/templates/default/view_all.html index 4d2fb66be..6e2c709bc 100644 --- a/templates/default/view_all.html +++ b/templates/default/view_all.html @@ -22,8 +22,8 @@

{if $product_type == "new"}{intl l="Latest products"}{elseif $product_type == "offers"}{intl l="Product Offers"}{/if}

- - {include file="includes/toolbar.html" toolbar="top" limit=$limit order=$product_order amount={count type="product" promo="{$product_type == "offers"}" new="{$product_type == "new"}"}} + {assign var="amount" value="{count type="product" promo="{$product_type == "offers"}" new="{$product_type == "new"}"}"} + {include file="includes/toolbar.html" toolbar="top" limit=$limit order=$product_order amount={$amount}}
{ifloop rel="product_list"} @@ -39,7 +39,7 @@
{ifloop rel="product_list"} - {include file="includes/toolbar.html" toolbar="bottom"} + {include file="includes/toolbar.html" toolbar="bottom" amount={$amount}} {/ifloop}