Hi,
This is a question involving one of the classes under ecommerce module but I think it is more like a general question about customized page relationship. So I believe better to put under General Questions.
I have created an additional relation for a PageA class to PageB class by:
class SpecialPage extend Page {
static $has_many = array(
'MyProducts' => 'Product'
);
}
where Product is the ecommerce Product class which extends Page as well.
After successfully database rebuilt and put some testing relationships, database data is updated correctly, i.e. table Product gets a new column called SpecialPageID with the corresponding page IDs. However, this is not able to be displayed in the template:
SpecialPage.ss
<% if MyProducts %>
<% control MyProducts %>
$ProductName, $Price...
($Pos / $TotalITems)
<% end_control %>
<% else %>
no products...
<% end_if %>
No matter how many Products are linked to a SpecialPage, it always shows "no products..."
It works fine if:
1. the SpecialPage has_many non-page object, or
2. the Product (which is a page) is a child page of the SpeicalPage
Am I missing something for Page-has_many-page relationship?
Any help is greatly appreciated.