Jump to content

[solved]Pagination


LLT

Recommended Posts

When I click on a category, how do I limit the number of products shown in that category to 7 and then create a new page? I also want to remove the option to display more than 7 products.

 

Basically, I want the product page to always display 7 products per page and not allow the visitor to change it.

I'm using version 1.4.

 

Any help is appreciated.

Link to comment
Share on other sites

You can change the number of products per page in 'Backoffice->Preferences->Products'. Then fill in de desired number in the field 'Products per page'.

 

I'm not sure why you don't want visitors to change the numbers of products per page. Still, it's doable. You'll need to delete this part of the code in 'pagination.tpl' in your theme folder:

 

{if $nb_products > 10}
	<form action="{if !is_array($requestNb)}{$requestNb}{else}{$requestNb.requestUrl}{/if}" method="get" class="pagination">
		<p>
			{if isset($search_query) AND $search_query}<input type="hidden" name="search_query" value="{$search_query|escape:'htmlall':'UTF-8'}" />{/if}
			{if isset($tag) AND $tag AND !is_array($tag)}<input type="hidden" name="tag" value="{$tag|escape:'htmlall':'UTF-8'}" />{/if}
			<input type="submit" class="button_mini" value="{l s='OK'}" />
			<label for="nb_item">{l s='items:'}</label>
			<select name="n" id="nb_item">
			{assign var="lastnValue" value="0"}
			{foreach from=$nArray item=nValue}
				{if $lastnValue <= $nb_products}
					<option value="{$nValue|escape:'htmlall':'UTF-8'}" {if $n == $nValue}selected="selected"{/if}>{$nValue|escape:'htmlall':'UTF-8'}</option>
				{/if}
				{assign var="lastnValue" value=$nValue}
			{/foreach}
			</select>
			{if is_array($requestNb)}
				{foreach from=$requestNb item=requestValue key=requestKey}
					{if $requestKey != 'requestUrl'}
						<input type="hidden" name="{$requestKey|escape:'htmlall':'UTF-8'}" value="{$requestValue|escape:'htmlall':'UTF-8'}" />
					{/if}
				{/foreach}
			{/if}
		</p>
	</form>
{/if}

 

Or better yet, comment out the code by adding {* before and *} after the code. This way, you can easily restore the code when needed.

 

Don't forget to enable 'Force compile' and disable 'Cache' in Backoffice->Preferences to implement changes to .tpl files and to change back these settings once you're done.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...