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.

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

Featured products on home page (0.82)


Reply


2 Posts   838 Views

Avatar
MCK

Community Member, 9 Posts

7 September 2011 at 3:12pm

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

Avatar
lanks

Community Member, 61 Posts

23 September 2011 at 7:41pm

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", "", "");
   }