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

Relating Simple Products
 
mirage
Member
 
Avatar
Total Posts:  40
Joined:  2008-06-09
Milwaukee, WI
 

Hi, I need to figure out how to relate products based on attribute or partial attribute (e.g. chunk of the sku). I think I’ll need to do this in code, perhaps adding a module extension. I know how to make modules and write code, but I need a jump start on how to best solve the specific problem.

Example of what I need to do in Magento:
http://www.flor.com/service/flor/shop/rug/Button/R104C00004-98225.html

See at the bottom, the additional colors for the same product. Each color/size leads to the simple product for that options.

1) I thought about using a configurable product. But the client really wants it to work like it currently does, which is basically only simple products. So I’m going to have build the relation on the fly.

2) Next I thought about using related products for this, though that’s really not their purpose for this I think. It also seems a pain to relate products this way. In the admin when I relate product A to product B, it doesn’t automatically relate product B to product A. Perhaps this is intentional, but I think it’s wrong. If two things are ‘related’ they should be related both ways, no???

3) So to save my self from an admin nightmare of relating thousands of products, I thought there maybe is a way that I could grab a style number from an attribute field and have Magento fetch me a list of products with the same style number. Question is: How deep do I have to dig. Are there any functions I can use to run a custom query like this or do I need to move to the SQL level? Where should I tie into the code?

I welcome any and all suggestions on how to best solve this.

Thanks,
J

 
Magento Community Magento Community
Magento Community
Magento Community
 
mzentrale1
Guru
 
Total Posts:  731
Joined:  2007-12-06
Stuttgart, Germany
 

Hi,

the idea of unique indetifier for related products is a good one. create a product attrib calld f.e. product_connector and define your own identifiers. Than create a own module with a new block which displays the related products. Therefore you can use a collection like the following collection:

$products     $product->getCollection()                        
                        ->
addStoreFilter()
                        ->
addAttributeToFilter('product_connector ''your unique identifier');                

Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($products);
Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($products);

$productsCollection $products->load();

cheers

 
Magento Community Magento Community
Magento Community
Magento Community
 
mirage
Member
 
Avatar
Total Posts:  40
Joined:  2008-06-09
Milwaukee, WI
 

Danke! Das ist genau was ich brauchte!

Jûrgen

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