I'm not sure if this is even possible but say for example i have a category called X with 100 products in it, can i add say 3 products to all them 100 products in that particular category without manually going through every single product selecting which product(s) i would like to cross sell.

  • means you want to set cross products randomly any 3 to each product Feb 8, 2017 at 15:28

1 Answer 1


You can try below code:

$categoryId= 123;
$categoryProducts = Mage::getModel('catalog/category')->load($categoryId)->getProductCollection();
foreach($categoryProducts as $product){
     $param = array();
     $crosssells = $product->getCrossSellProducts();
     foreach ($crosssells as $item) {
           $param[$item->getId()] = array('position' =>$item->getPosition());
    foreach ($newCrossSellProductsIds as $productID) {
     if (!isset($param[$productID])){ 
          $param[$productID]= array(

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.