Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

E-Commerce Modules /

Discuss about the various e-commerce modules available:
Ecommerce, SS Shop, SilverCart and SwipeStripe
Alternatively, have a look the shared mailinglist.

Moderators: martimiz, Nicolaas, Sean, Ed, frankmullenger, biapar, Willr, Ingo, Jedateach, swaiba

Dynamic Silvershop Sort options


Go to End


1391 Views

Avatar
Skullies

Community Member, 19 Posts

23 November 2016 at 11:02pm

I have been breaking my head on how to do a dynamic sort option, which will show/hide the sort option, depending on whether the category has the "Manufacturer" that the sorter is looking for...

public static $sort_options         = array(
    'Alphabetical' => 'URLSegment',
    'Lowest Price'        => 'BasePrice');

Normally the sorter gets its options like this, but this will not seem to cut it for the task at hand.

If anyone can give some tips or ideas of what I can try, that would be really helpful. What am I missing?

Just to sume up my problem Product Category has Many Products Products has Many Categories Product has one Manufacturer Manufacturer has many Products
What I need to do is have a sorter that shows the Manufacturers that the products in that Category has and hide the Manufacturers that do not have Products in the Category