VirtueMart Forum

VirtueMart 2 + 3 + 4 => Frontend Modules => Topic started by: Lydiasupplyingdirect on May 05, 2022, 11:06:47 AM

Title: How can we add a sort by filter to our product pages? 'Sort by Name' Etc
Post by: Lydiasupplyingdirect on May 05, 2022, 11:06:47 AM
Hello,

We're looking to add a 'sort by' filter/drop down to our product pages which sorts by name, product, price etc. We have selected the filters in Virtuemart configuration > Sort & Search, but nothing is showing front end.

We have contacted Yootheme about this and they have said it's a Virtuemart thing, does anyone know how we can display this sort by filter front end?

We currently have it on one of our old websites but have no idea how we got it there as it was created years ago (see image attached)

Website we want to add it to: https://www.schoolfurniture-direct.co.uk/

Any help would be much appreciated, thank you.

Lydia

Title: Re: How can we add a sort by filter to our product pages? 'Sort by Name' Etc
Post by: jenkinhill on May 05, 2022, 11:33:39 AM
Looks like your template overrides do not have the code to display the orderlist.

In default VM the code is in /components/com_virtuemart/views/category/tmpl/default.php  - look for orderlistcontainer

You can see it on (eg) http://demo.virtuemart.net/wear
Title: Re: How can we add a sort by filter to our product pages? 'Sort by Name' Etc
Post by: Lydiasupplyingdirect on May 05, 2022, 17:24:55 PM
Hi,

So we can see code in both files please see screen shot attached.

Does this look right? If so there must be something else missing.
Title: Re: How can we add a sort by filter to our product pages? 'Sort by Name' Etc
Post by: Studio 42 on May 05, 2022, 19:59:53 PM
This is the javascript, jenkinhill speak about PHP

Code should be
[/size][/font][/size][/font][/color] <div class="orderby-displaynumber"> <div class="width70 floatleft"> <?php echo $this->orderByList['orderby']; ?> <?php echo $this->orderByList['manufacturer']; ?> </div> <div class="width30 floatright display-number"><?php echo $this->vmPagination->getResultsCounter();?><br/><?php echo $this->vmPagination->getLimitBox(); ?></div> <div class="vm-pagination"> <?php echo $this->vmPagination->getPagesLinks(); ?> <span style="float:right"><?php echo $this->vmPagination->getPagesCounter(); ?></span> </div> <div class="clear"></div> <>
Title: Re: How can we add a sort by filter to our product pages? 'Sort by Name' Etc
Post by: Lydiasupplyingdirect on May 09, 2022, 10:37:09 AM
Hello,

So I've attached a screenshot of where I think the code should go but I am probably completely wrong? But it matches what you've said to a certain extent.

You'll have to apologies, I'm not a coder but I do try my best  :)

Thanks,

Lydia
Title: Re: How can we add a sort by filter to our product pages? 'Sort by Name' Etc
Post by: Studio 42 on May 11, 2022, 08:07:44 AM
Remove
if(!empty($this->orderByList)) {
orderByList is never empty
Title: Re: How can we add a sort by filter to our product pages? 'Sort by Name' Etc
Post by: Lydiasupplyingdirect on May 12, 2022, 09:58:20 AM
Hi so I've added the code in, but nothing is showing front end so I must be missing something?

https://www.schoolfurniture-direct.co.uk/

Any ideas would be much appreciated!

Thank you,

Lydia