2033 Posts in 568 Topics by 443 members
|Go to End|
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.
23 September 2011 at 7:41pm
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.
return DataObject::get("Product","FeaturedProduct = 1", "", "");
|Go to Top|