Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Grouped Product <-> Associated Product
 
Charles
Member
 
Avatar
Total Posts:  73
Joined:  2008-03-27
Belgium
 

I’ve noticed that there are some functions to get the associated product from a grouped product.
Is the opposite also true?
I.e. from an associated product, how can one get the info from the grouped product?

 
Magento Community Magento Community
Magento Community
Magento Community
 
dan_w
Sr. Member
 
Total Posts:  290
Joined:  2008-01-04
 

I’d imagine that it could be true, just maybe not out-of-the-box. If I get a chance I’ll see what it’ll take tomorrow.

Dan

 
Magento Community Magento Community
Magento Community
Magento Community
 
Charles
Member
 
Avatar
Total Posts:  73
Joined:  2008-03-27
Belgium
 

Well, I found on various occasions a reference to getSuperProduct.

It is used mostly in Model-code.

Does anyone know how me might use it in the design code?
Till know, code like $_product->getSuperProduct() produces no result.

Thanks,

Charles

 
Magento Community Magento Community
Magento Community
Magento Community
 
Charles
Member
 
Avatar
Total Posts:  73
Joined:  2008-03-27
Belgium
 

I’m getting pretty desperate by now.

What I’ve come up so far:

- there is a table that links products together (catalog_product_link). So yes, there should be a way to get the info from an associated product to its grouped product
- there is a function “getSuperProduct” that seems to be able to get called from a couple Model files
- when I perform a print_r from an associated product, there is no info whatsoever that refers to the ‘superproduct’ -> how does getSuperProduct work?

However, I don’t seem to be able to connect all the dots.

What I need to do is call a getDescription from the superproduct.

Eg. In Catalog/Product/View.phtml I’d like to have something like

if ($_superProduct=$_product->getSuperProduct()){
echo $_superProduct->getDescription();else {
echo $_product->getDescription();}

Does anyone have any clue on how to continue on that road?

Thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
Charles
Member
 
Avatar
Total Posts:  73
Joined:  2008-03-27
Belgium
 

I think I made some great progress on that one.

To get a product’s parent you do the following:

$_parentId Mage::getResourceModel('catalog/product')->getParentProductIds($_product);
$_parentProduct Mage::getModel('catalog/product')->load($_parentId[0]);

But, I’m not out of the woods yet.
Because it seems that the data loaded comes from the default store.

Now what I’d like to know is how to load the data from the active store, not the default store.

Can anyone help me with that?

Or, please excuse me for being so blant, is this whole forum absolutely useless?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Charles
Member
 
Avatar
Total Posts:  73
Joined:  2008-03-27
Belgium
 

Well, I did it.

The

Mage::(app)

functions do the trick

You’re all very welcome !

 
Magento Community Magento Community
Magento Community
Magento Community
 
freshwebs
Sr. Member
 
Total Posts:  153
Joined:  2008-05-27
Leicestershire, UK
 

Charles,
Thanks for the update - much appreciated.
Eddie

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top