Author Topic: How can we add a sort by filter to our product pages? 'Sort by Name' Etc  (Read 282 times)

Lydiasupplyingdirect

  • Beginner
  • *
  • Posts: 43
  • A beginner
  • VirtueMart Version: 3.8.9
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

L Bustin

jenkinhill

  • UK Web Developer & Consultant
  • Global Moderator
  • Super Hero
  • *
  • Posts: 28302
  • Always on vacation
    • Jenkin Hill Internet
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
Kelvyn

Jenkin Hill Internet,
Lowestoft, Suffolk, UK

Unsolicited PMs/emails will be ignored.

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

Currently using VirtueMart 3.8.9.10473 on Joomla 3.9.28 PHP 7.4.14

Lydiasupplyingdirect

  • Beginner
  • *
  • Posts: 43
  • A beginner
  • VirtueMart Version: 3.8.9
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.
L Bustin

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4607
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
This is the javascript, jenkinhill speak about PHP

Code should be
[/size][/font][/size][/font][/color]
Code: [Select]
<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> <>

Lydiasupplyingdirect

  • Beginner
  • *
  • Posts: 43
  • A beginner
  • VirtueMart Version: 3.8.9
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
L Bustin

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4607
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Remove
if(!empty($this->orderByList)) {
orderByList is never empty

Lydiasupplyingdirect

  • Beginner
  • *
  • Posts: 43
  • A beginner
  • VirtueMart Version: 3.8.9
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
L Bustin