| ||||||||||
![]() |
Shopping cart software Solutions for online shops and malls | |||||||||
![]() |
![]() |
|
X-Cart Home | ![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Add "View All" to "Products Per Page" Dropdown | ||||
![]() |
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
![]() 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!
__________________
nick hoag looking forward to the future http://thefutureforward.com xcart versions 4.2.x, 4.3.x, 4.4.x |
|||||||
#2
|
|||||||||
|
|||||||||
![]() These values are hard coded in include/search.php
__________________
Steve Stoyanov CFLSystems.com Web Development |
|||||||||
#3
|
|||||||
|
|||||||
![]() 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?
__________________
nick hoag looking forward to the future http://thefutureforward.com xcart versions 4.2.x, 4.3.x, 4.4.x |
|||||||
#4
|
|||||||||
|
|||||||||
![]() 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
__________________
Steve Stoyanov CFLSystems.com Web Development |
|||||||||
#5
|
|||||||
|
|||||||
![]() 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?
__________________
nick hoag looking forward to the future http://thefutureforward.com xcart versions 4.2.x, 4.3.x, 4.4.x |
|||||||
#6
|
|||||||||
|
|||||||||
![]() Try with quotes for 2000
$perPageValues['2000'] = 'View All';
__________________
Steve Stoyanov CFLSystems.com Web Development |
|||||||||
#7
|
|||||||
|
|||||||
![]() Hmm, tried that and it still seems to be rendering the following html:
HTML Code:
Instead of: HTML Code:
Here's the current PHP: PHP Code:
Thanks for all your help on this Steve. It's so appreciated.
__________________
nick hoag looking forward to the future http://thefutureforward.com xcart versions 4.2.x, 4.3.x, 4.4.x |
|||||||
#8
|
|||||||||
|
|||||||||
![]() 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
__________________
Steve Stoyanov CFLSystems.com Web Development |
|||||||||
|
#9
|
|||||||
|
|||||||
![]() 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!
__________________
nick hoag looking forward to the future http://thefutureforward.com xcart versions 4.2.x, 4.3.x, 4.4.x |
|||||||
#10
|
|||||||
|
|||||||
![]() 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
__________________
Version 4.4.2 |
|||||||
|
|||
X-Cart forums © 2001-2020
|