Useful Tricks

This section contains some useful programming tricks.
Get all disabled products programmatically in Magento

Get all disabled products from Magento using product collection: <?phpset_time_limit(0);error_reporting(E_ALL ^ E_NOTICE);ini_set(“display_errors”,’On’); require_once ‘app/Mage.php’;umask(0);Mage::app(‘default’); $products = Mage::getModel(‘catalog/product’)->getCollection()    ->addAttributeToSelect(‘*’)  ->addFieldToFilter(‘status’,Mage_Catalog_Model_Product_Status::STATUS_DISABLED); $products->load();foreach($products…

Sepia effect on an image using PHP

Below is the code for converting a image using Sepia Effect <?php$img = imagecreatefrompng(‘images.png’);imagefilter($img,IMG_FILTER_GRAYSCALE);imagefilter($img,IMG_FILTER_COLORIZE,100,50,0);imagepng($img,’sepia.png’);imagedestroy($img);?> Here images.png is original image and…

Negative effect on an image using PHP

Below is the code for converting a image to Negative <?php$img = imagecreatefrompng(‘images.png’);imagefilter($img,IMG_FILTER_NEGATE);imagepng($img,’negative.png’);imagedestroy($img);?> Here images.png is original image and negative.png…

1 5 6 7 42