Showing posts with label Products. Show all posts
Showing posts with label Products. Show all posts

Friday, 6 March 2015

How to Delete all products programmatically in Magento

Please try below code,

$products = Mage::getResourceModel('catalog/product_collection')->getAllIds();
foreach ($products as $key => $productId)
{
    try {
        $product = Mage::getSingleton('catalog/product')->load($productId);
        Mage::dispatchEvent('catalog_controller_product_delete', array('product' => $product));
        $product->delete();
    } catch (Exception $e) {
        echo "<br />Cannot delete product ID: $productId";
        }
}

Saturday, 23 August 2014

Magento not displaying Group price for Products

Magento will show the minimum price, because the retail price should always be higher then the group prices.

The regular price of the product was $150. The retailer group price I set as $250, and the wholesale group price I set as $125. The wholesale displayed as $125, however the retailer group price was $150. Again, this is as scenario, it's not a bug but a feature.

Solutions for your needs.
  1. Make sure your regular price is always higher then groups
  2. Possibly create an extension that extends the logic in app/code/core/Mage/Catalog/Model/Product/Type/Price.php (this may not be the only file you need to extend, however it is the file with the majority of the pricing logic).

If you do end up creating your own extension, always remember to never edit core code.

Saturday, 1 March 2014

Magento Display all products within the category on a product view page

Please see the below link,

http://stackoverflow.com/questions/11993953/magento-display-all-products-within-the-category-on-a-product-view-page