Hi there,
I need to remove a list of products from all the up-sells lists; so what I'm doing is checking the IDs of the up-sells products for each product in the database and ideally remove the IDs of the products I don't need anymore and save it.
How can I update the up-sells product list or just remove the item I don't want (having its ID)?
Part of the code I wrote:
- $collection is a Mage Module, Mage::getModel('catalog/product')
- $discontinued is an array which has as key the entity_id of the product
foreach($collection as $p) { $upsell = $p->getUpSellProductIds(); if ( count($upsell) > 0 ) { foreach ($upsell as $k => $u) { // Check if the entity_id is among the discontinued products if ( isset($discontinued[ $u ]) ) { // TODO : Remove the discontinued entity from the up-sells list } } } }Thanks in advance for your help