Call-back icon  Sales: Call 877.832.5289 (N America)|310.295.4144 (International)

Magento

eCommerce Software for Online Growth

Magento Forum

   
Grouped Product <-> Associated Product
 
Charles
Member
 
Avatar
Total Posts:  47
Joined:  2008-03-28
 

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:  245
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:  47
Joined:  2008-03-28
 

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:  47
Joined:  2008-03-28
 

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:  47
Joined:  2008-03-28
 

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:  47
Joined:  2008-03-28
 

Well, I did it.

The

Mage::(app)

functions do the trick

You’re all very welcome !

 
Magento Community Magento Community
Magento Community
Magento Community
 
freshwebservices
Member
 
Total Posts:  38
Joined:  2008-05-27
Leicestershire, UK
 

Charles,
Thanks for the update - much appreciated.
Eddie

 Signature 

Web Design Leicestershire

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top
 
Sales: Call 877.832.5289 (North America) 310.295.4144 (International)
© Copyright 2008 Varien. Magento, eCommerce software, is a trademark of Irubin Consulting Inc. DBA Varien
Privacy Policy|Terms of Service
Magento Community Count
52323 users|430 users currently online|105667 forum posts