Jump to:

2084 Posts in 1005 Topics by 453 members

E-Commerce Modules

SilverStripe Forums » E-Commerce Modules » Sorting Products in the PageTree

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, frankmullenger, biapar, Willr, Ingo, Jedateach, swaiba, simon_w

Page: 1
Go to End
Author Topic: 621 Views
  • ambient
    Avatar
    Community Member
    123 Posts

    Sorting Products in the PageTree Link to this post

    Hi All

    Does anyone know if it's possible to have my product list display in the same order that it is in my PageTree?
    I'd like to be able to use the drag and drop to change the order of the products.

    I know that if I was to move my Contact page to the top of the PageTree and save it it will move to the front spot in my navigation.
    I kind of thought that the products would do the same.

    Any help would be appreciated.

    Thanks!

  • Jedateach
    Avatar
    Forum Moderator
    227 Posts

    Re: Sorting Products in the PageTree Link to this post

    Hi Ambient,

    If you can find the right place in code, it should just be a matter of using the SiteTree "Sort" field for sorting. However, if your products are nested, that is a different story.

    regards
    Jeremy

  • ambient
    Avatar
    Community Member
    123 Posts

    Re: Sorting Products in the PageTree Link to this post

    Hi Jeremy,

    Could you expand a little on that? I've played around with
    SiteTree::$default_sort =
    and
    static $default_sort =

    But I can't get the products to display in the same order on the live site as they do in the Admin PageTree

  • Jedateach
    Avatar
    Forum Moderator
    227 Posts

    Re: Sorting Products in the PageTree Link to this post

    If you are using the shop module, look at the ProductCategory class. You can pass ?sort=Sort in the url to sort by Sort, but you need to make sure it is in the sort options array:

    ProductCategory::set_sort_options(array(
    'Sort' => 'Default',
    'URLSegment' => 'Alphabetical',
    'Price' => 'Lowest Price'
    ));

    Note that the default sort is 'FeaturedProduct', and is currently hard coded. I've made an issue here: https://github.com/burnbright/silverstripe-shop/issues/123

    621 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.