Skip to content

magento-1.9

Auto Added by WPeMatico

Magento 1.9 – Is it save to delete all categories associated with products with ‘parent_id’ equals 0?

In a custom module in Magento 1.9 I was associating products to categories using the following method: public function addProductToCategory($productId, $categoryId) { $category = Mage::getModel(‘catalog/category’) ->setStoreId(Mage::app()->getStore()->getId()) ->load($categoryId); $productsInCategory = $category->getProductsPosition(); $productsInCategory[$productId] = 1; $category->setPostedProducts($productsInCategory); $category->save(); } But, as you can… Read More »Magento 1.9 – Is it save to delete all categories associated with products with ‘parent_id’ equals 0?

How to remove cache images if they not in used in magento 2?

i need to create new script if the image not present in real folder and not in used than delete from cache folder example Cach folder image pub/media/catalog/product/cache/2a584e14ed2061ee0dac7db2e52f28f9/1/_/1_asc-d-404-mn_dollcarrier_minnie_2000.jpg “pub/media/catalog/product/1/_/1_asc-d-404-mn_dollcarrier_minnie_2000.jpg” if this image not present in => “pub/media/catalog/product/” than delete from… Read More »How to remove cache images if they not in used in magento 2?