Magento Forum

   
Related products in both directions
 
Georg Ringer
Member
 
Avatar
Total Posts:  63
Joined:  2008-07-04
Linz, Austria
 

Hi,

is it possible to add related products to just 1 product and get the related ones at the others too?

Imagine:
Product A, Product B, Product C.

If I add B & C as related products to A, I see them there but I also would like to see A + C at B without setting those relations again at B and C

Thx a lot for any help!
Georg

 
Magento Community Magento Community
Magento Community
Magento Community
 
Georg Ringer
Member
 
Avatar
Total Posts:  63
Joined:  2008-07-04
Linz, Austria
 

Hi,

i know did it myself (my first changes in the admin section).

app\code\core\Mage\Adminhtml\controllers\Catalog\ProductController.php

change this code (~277)

if (isset($links['related'])) {
            $product
->setRelatedLinkData($this->_decodeInput($links['related']));
        
}

to

if (isset($links['related'])) {

                        $tmpproduct1 
explode('&',$links['related']);
                        
$tmpproduct = array();

                        foreach (
$tmpproduct1 as $key=>$value{
                      $part 
explode('=',$value);
                      
$tmpproduct[$part[0]] $part[1];
                  
}
                  
                        $newRelated 
$this->_decodeInput($links['related']);
                        
$newRelated[$product->getId()= array('qty' => 0'position' => 0);
                  
                        foreach (
$tmpproduct as $key=>$value{
                      $newProduct 
Mage::getModel('catalog/product')->load($key);
                      
$newProduct->setRelatedLinkData($newRelated);

                try 
{
                    $newProduct
->save();
                
}
                
catch (Mage_Core_Exception $e{
                    $this
->_getSession()->addError($e->getMessage())
                        ->
setProductData($data);
                    
$redirectBack true;
                
}
                
catch (Exception $e{
                    
echo $e;
                    
$this->_getSession()->addException($e$this->__('Product saving error.'));
                    
$redirectBack true;
                
}                      
                  }            
        }

any comments about it?
thanks a lot

Georg

 
Magento Community Magento Community
Magento Community
Magento Community
 
doctorlogos
Sr. Member
 
Avatar
Total Posts:  178
Joined:  2008-05-06
 

Hi, I like your post. It must be a option from backend.

But I don´t want to touch the core.

Magento Team, please take that!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Ec1ipse
Jr. Member
 
Total Posts:  2
Joined:  2008-04-10
 
bijalbhavsar99 - 11 May 2010 08:56 PM

Extension “SQLi Reverse Cross-Selling” You can add extension for reverse related products, upsells, crossels below is the link of extension.

http://www.magentocommerce.com/magento-connect/Laurent+Bourrel/extension/1567/sqli-reverse-cross-selling

This however doesn’t seem to work for Magento 1.4.  Does anyone have an extension that works?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Ec1ipse
Jr. Member
 
Total Posts:  2
Joined:  2008-04-10
 
Georg Ringer - 08 July 2008 09:04 PM

Hi,

i know did it myself (my first changes in the admin section).

app\code\core\Mage\Adminhtml\controllers\Catalog\ProductController.php

change this code (~277)

if (isset($links['related'])) {
            $product
->setRelatedLinkData($this->_decodeInput($links['related']));
        
}

to

if (isset($links['related'])) {

                        $tmpproduct1 
explode('&',$links['related']);
                        
$tmpproduct = array();

                        foreach (
$tmpproduct1 as $key=>$value{
                      $part 
explode('=',$value);
                      
$tmpproduct[$part[0]] $part[1];
                  
}
                  
                        $newRelated 
$this->_decodeInput($links['related']);
                        
$newRelated[$product->getId()= array('qty' => 0'position' => 0);
                  
                        foreach (
$tmpproduct as $key=>$value{
                      $newProduct 
Mage::getModel('catalog/product')->load($key);
                      
$newProduct->setRelatedLinkData($newRelated);

                try 
{
                    $newProduct
->save();
                
}
                
catch (Mage_Core_Exception $e{
                    $this
->_getSession()->addError($e->getMessage())
                        ->
setProductData($data);
                    
$redirectBack true;
                
}
                
catch (Exception $e{
                    
echo $e;
                    
$this->_getSession()->addException($e$this->__('Product saving error.'));
                    
$redirectBack true;
                
}                      
                  }            
        }


any comments about it?
thanks a lot

Georg

Is there an update for this for Magento 1.4?

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