Jump to:

2088 Posts in 1008 Topics by 455 members

E-Commerce Modules

SilverStripe Forums » E-Commerce Modules » Featured products on home page (0.82)

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: 802 Views
  • MCK
    Avatar
    Community Member
    9 Posts

    Featured products on home page (0.82) Link to this post

    ecommerce module 0.82 has featured products as a feature (no pun intended).

    I can get the FeaturedProducts to work (<% If FeaturedProducts %>) but how do I get these products to appear when the parent page doesn’t have the products as children, e.g., the Home page would be a great place to display the featured products but I don’t want the Products as children of the Home page.

    I think it is just a simple logic problem but I can’t get my head around it.

    Graeme McKinstry

  • lanks
    Avatar
    Community Member
    61 Posts

    Re: Featured products on home page (0.82) Link to this post

    Hi

    The best way to do this is:

    1. Create a new page type for your home page e.g. HomePage
    2. In the controller of the HomePage page type add a new function to get the featured products. This function won't rely on a relationship with itself to query the for the featured products rather it will just select the products that have been flagged as featured.

    e.g.

    function getFeaturedProducts(){
             return DataObject::get("Product","FeaturedProduct = 1", "", "");
       }

    802 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.