![]() |
Add "View All" to Products Per Page Dropdown
Hello all,
I'm looking to add a "view all" option to customer/main/per_page.tpl in a 4.4.4 store. Try as I might, the only way I could figure to do it was to hand code the options into the dropdown, one of which is "2000" (effectively, "All"). The issue with this is that is doesn't remember the previous selection when the page refreshes: http://future.thefutureforward.com/~clover/home.php?cat=1 This seems like a feature that should just be there, but alas it is not. If anyone has any thoughts on how to edit customer/main/per_page.tpl and include/search.php to include a "view all" option, that would be amazing! |
Re: Add "View All" to "Products Per Page" Dropdown
These values are hard coded in include/search.php
|
Re: Add "View All" to "Products Per Page" Dropdown
Hey Steve,
I just noticed that. Here's where I'm guessing I need to make a change: PHP Code:
I totally get how to change the values in the dropdown, but I'm a bit unclear as to how to add one option to the end of the dropdown with a value of, let's say, 2000 that reads in the dropdown as "View All". Any idea on how to implement that type of a selection into this thing? |
Re: Add "View All" to "Products Per Page" Dropdown
for ($i = 5; 50 >= $i; $i = $i + 5) {
$perPageValues[] = $i; } $perPageValues[2000] = 'View All'; This will only show the selection option - you still have to implement the code what will happen when this options is selected - if you have over 2000 products not all will show |
Re: Add "View All" to "Products Per Page" Dropdown
Hey Steve,
Thanks for the tip. I've got it setup like so: PHP Code:
Here's the result - http://future.thefutureforward.com/~clover/home.php?cat=1 Like you said, this put "View All" into both the "Value" and the "Text" of the option value. While I need it to be the "Text", I need "2000" to be the value. I tried replacing the value with jQuery, but to no avail. Any thoughts on how to get 2000 to be the value? |
Re: Add "View All" to "Products Per Page" Dropdown
Try with quotes for 2000
$perPageValues['2000'] = 'View All'; |
Re: Add "View All" to "Products Per Page" Dropdown
Hmm, tried that and it still seems to be rendering the following html:
HTML Code:
Instead of: HTML Code:
<option value="2000">View All</option> Here's the current PHP: PHP Code:
Thanks for all your help on this Steve. It's so appreciated. |
Re: Add "View All" to "Products Per Page" Dropdown
Just like I had it first
for ($i = 5; 50 >= $i; $i = $i + 5) { $perPageValues[] = $i; } $perPageValues[2000] = 'View All'; Then in /skin/common_files/customer/main/per_page.tpl replace PHP Code:
with PHP Code:
Then you also have to take care of $objects_per_page so it is selected if view all is selected |
Re: Add "View All" to "Products Per Page" Dropdown
Pure brilliance steve. I knew there had to be a way to specify the "key", but it was eluding me.
I ended up changing the option tag to: HTML Code:
And this correctly sets "view all" to selected when you select it. http://future.thefutureforward.com/~clover/home.php?cat=8 Thanks so much steve! |
Re: Add "View All" to "Products Per Page" Dropdown
Nick, Steve,
Thanks very much for this. Just added it to 4.4.3 site. Should be an "off the shelf" item just like X-Cart's competitors. Regards, David X Cart Gold 4.4.3 |
All times are GMT -8. The time now is 12:19 AM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.