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

Front end CheckBox sorting


Go to End


10 Posts   5402 Views

Avatar
Jedateach

Forum Moderator, 238 Posts

26 April 2012 at 1:48pm

To interact with the session you'll want to make use of the Session class:
http://api.silverstripe.org/2.4/sapphire/control/Session.html

Here is some more of the example fleshed out.

function savefilter($data,$form){
    Session::set("productfilter",$data);
    Director::redirectBack();
    return;
} 

function FilteredProducts(){
$data = Session:get('productfilter');
$savedfilter = "\"ParentID\" IN (".implode(",",$data["Categories"]).")"; //where $data["Categories"] is an array

return $this->ProductsShowable($savedfilter);

} 

The limiting is done by passing the savedfilter to ProductsShowable, which makes sure the products it retrieves only belong to the given categories (Product Groups).

This is far from complete, and you'd need to somehow get the ids of subcategories if you wanted to include products from those.

I will be devoting some time to improving the ability to browse / search products in the future sometime.
Here's a ticket I made: https://github.com/burnbright/silverstripe-shop/issues/36

Avatar
ambient

Community Member, 130 Posts

11 May 2012 at 3:33am

Hey Jeremy,

Sorry I've been awol these last few weeks.

I appreciate your help and hopefully the ecommerce module will get the upgrade sooner rather than later.

The project I'm working on has unfortunately been shelved.

Thanks again :)

Go to Top