X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Let Customer choose number of products displayed on page (https://forum.x-cart.com/showthread.php?t=38695)

royng 07-09-2009 03:55 PM

Re: Let Customer choose number of products displayed on page
 
I got it. it's simple!

Just use
<form method="POST" action="/store/change_ppp.php" id="pppForm">
Show products per page
<select name="ppp" onchange="this.form.submit()">
<option value="9" {if $products_per_page eq 9}selected{/if}>9</option>
<option value="12" {if $products_per_page eq 12}selected{/if}>12</option>
<option value="15" {if $products_per_page eq 15}selected{/if}>15</option>
<option value="18" {if $products_per_page eq 18}selected{/if}>18</option>
<option value="21" {if $products_per_page eq 21}selected{/if}>21</option>
<option value="24" {if $products_per_page eq 24}selected{/if}>24</option>
<option value="99" {if $products_per_page eq 99}selected{/if}>all</option>
</select>

</form>

in products.tpl

presson83 11-10-2009 10:02 AM

Re: Let Customer choose number of products displayed on page
 
Hi All,

This is a great mod and came in super handy. I modified it slightly to have a "view all" button outside of the drop-down menu. When you click it it will show the "all" option in the drop-down (for clarity's sake), otherwise it's not there. Here's the code and thanks Holub!

HTML Code:


<form method="POST" action="change_ppp.php" class="productsPerPage">
        Show products per page
        <select name="ppp" onchange="javascript: this.form.submit();">
        <option value="5" {if $products_per_page eq 5}selected{/if}>5</option>
        <option value="10" {if $products_per_page eq 10}selected{/if}>10</option>
        <option value="20" {if $products_per_page eq 20}selected{/if}>20</option>
        <option value="30" {if $products_per_page eq 30}selected{/if}>30</option>
        <option value="50" {if $products_per_page eq 50}selected{/if}>50</option>
        {if $products_per_page eq 100}<option value="100" {if $products_per_page eq 100}selected{/if}>all</option>{/if}
        </select>
    </form>
   
    <form method="POST" action="change_ppp.php" class="viewAll">
        <input type="hidden" name="ppp" value="100" />
        <input type="submit" value="view all" onclick="javascript: this.form.submit();"/>
    </form>


kidroush 01-05-2010 11:32 AM

Re: Let Customer choose number of products displayed on page
 
I have this search sort by feature on my site. However, the options to sort by are Product, Price or Default. This is fine but I want to change the word product to movies even though I want it to sort by the product still. The only thing I want to change is the label, not the function. Anyone know how?

Pyro 03-28-2010 11:51 AM

Re: Let Customer choose number of products displayed on page
 
Has any one tried this on 4.3.x?

mrerotic 04-06-2010 11:51 PM

Re: Let Customer choose number of products displayed on page
 
How can I get this to work in the manufacturers area as well?

FTI 04-28-2010 02:42 AM

Re: Let Customer choose number of products displayed on page
 
Hello Sir,
Looking through the X-cart forum I came across this topic.

I need the same thing but for manufacturers. I need a drop down menu with the manufacturers, that stands next to the search box on my website. So when the user chooses to search "mascara" for example, he can search only for mascara, maunfactured by Lancome. I badly need some help, and I will appreciate it.

Thanks in advance.

Christofer 05-02-2010 03:26 PM

Re: Let Customer choose number of products displayed on page
 
works for 4.2.1? thank you

jlrentertainment 06-07-2010 12:31 PM

Re: Let Customer choose number of products displayed on page
 
I have something similar but not in dropdown format over here:

http://forum.x-cart.com/showthread.php?t=23796&page=6

It's working on 4.3.2.

minfinger 06-13-2010 06:46 AM

Re: Let Customer choose number of products displayed on page
 
I would love this option in 4.3.x

I did see the thread you posted above and Show All won't really work for my customer.

cherie 08-18-2012 05:16 PM

Re: Let Customer choose number of products displayed on page
 
I've completed this for 4.3. I couldn't find this mentioned elsewhere so hopefully this isn't redundant.

New file change_ppp.php:

PHP Code:

<?php
if (!defined('XCART_SESSION_START') && $_SERVER['REQUEST_METHOD'] != 'POST') {
    
header('Location: home.php');
    die(
'Access denied');
}

require 
'./auth.php';
x_session_register('products_per_page');

if (
$_SERVER['REQUEST_METHOD'] == 'POST' && $ppp) {

    
$back $_SERVER['HTTP_REFERER'];
    if (!
$back)
        
$back '/home.php';

    if (
$ppp == 'all')
        
$ppp 32767;

    
$products_per_page = (int)$ppp;
    
x_session_save('products_per_page');

    
func_header_location($back);
}

if ((int)
$products_per_page 0)
    
$objects_per_page $config['Appearance']['products_per_page'] = $products_per_page;

$smarty->assign('products_per_page'$config['Appearance']['products_per_page']);

$pppList = array(
    
6,12,24,48,72,120,32767
);
$smarty->assign('pppList'$pppList)
?>


New file skin1/customer/change_ppp.tpl:

PHP Code:

<form method="post" action="{$xcart_web_dir}/change_ppp.php" style="float:right">
    
Show products per page
    
<select name="ppp" onchange="this.form.submit()">
        {foreach 
from=$pppList item=pli name=pli}
            <
option value="{if $smarty.foreach.pli.last}all{else}{$pli}{/if}"{if $products_per_page eq $pliselected{/if}>{if $smarty.foreach.pli.last}all{else}{$pli}{/if}</option>
        {/foreach}
    </
select>
</
form>
<
div class="clearing"></div


Add the following to home.php just below the auth.php line:

PHP Code:

if (!empty($cat))
    include 
$xcart_dir.'/change_ppp.php'


Add the following to the very end of skin1/customer/main/navigation.tpl:

PHP Code:

{include file="customer/change_ppp.tpl"


Add the following to .nav-pages in skin1/main.css:

Code:

  float: left;


All times are GMT -8. The time now is 09:02 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.