Recently we have this bug ” Notice: Undefined variable: block in …/Template/Filter.php line 187 ” on a project after updating SUPEE-6788 in Magento 1.9.2.x . After installation of the patch some parts of the front-end home page template stayed blank. Review of the exception.log file shows a number of exceptions that occur from…
Recently, I have worked on a project which has this strange bug, the image url in Wysiwyg is not correctly. Only administrator can see this image while guess users can not see it. For example : the image url which is generated by Wysiwyg : <img src=”http://www.mysite.com//index.php/admin/cms_wysiwyg/directive/___directive/e3ttZWRpYSB1cmw9Ind5c2l3eWcvcmd0LXNsaWRlci1pbWcwMS5qcGcifX0/key/ceed8184f5f336aafcc307f8623aff45/” /> In that case, the…
Follow the below codes to get addtional attributes product Magento $tmpProd = Mage::getModel(‘catalog/product’)->load($product->getId()); $attributes = $tmpProd->getAttributes(); $addtionalAttributes = array(); foreach ($attributes as $attribute) { if ($attribute->getIsVisibleOnFront()) { $addtionalAttributes[“{$attribute->getStoreLabel()}”] = $attribute->getFrontend()->getValue($tmpProd); } }
You can follow those below codes to get products tax percentage magento: $store = Mage::app()->getStore(‘default’); $request = Mage::getSingleton(‘tax/calculation’)->getRateRequest(null, null, null, $store); $taxclassid = $product->getData(‘tax_class_id’); $percent = Mage::getSingleton(‘tax/calculation’)->getRate($request->setProductClassId($taxclassid));
Get all configured rates of the tablerate shipping module : $tablerateColl = Mage::getResourceModel(‘shipping/carrier_tablerate_collection’); /* @var $tablerateColl Mage_Shipping_Model_Resource_Carrier_Tablerate_Collection */ foreach ($tablerateColl as $tablerate) { /* @var $tablerate Mage_Shipping_Model_Carrier_Tablerate */ Zend_Debug::dump($tablerate->debug()); }
By default, Magento returns XML format when you try to access REST API resources. For example : You try to access REST url to get product’s information of this site : http://localhost/magento/api/rest/products It will return in XML format.But some cases, other developers want you to send them JSON format instead of XML….
There are many problems when you’re working with configurable products. One of annoying issue was we forgot to make associated simple products inherit parent product categories. And of course, It will take us a lot of time to accomplish it manually. Therefore, I wrote scripts for this task. You can…
Update : From magento 1.9 , it’s not allowed to call cron.php directly via http. So you could change command : curl -s -o /dev/null http://your-domain.com/cron.php to /bin/sh/YOUR_WEBSITE_DIRECTORY/public_html/cron.sh There are many Magento tutorials guiding how to set up a cron job in Magento. But I like to post this tutorial for…
Here is the useful code for a purpose : update stock item quantity for a product in magento: $product = Mage::getModel(‘catalog/product’)->load($productId); if ($product){ if (!($stockItem = $product->getStockItem())) { $stockItem = Mage::getModel(‘cataloginventory/stock_item’); $stockItem->assignProduct($product); } $stockItem->setData(‘qty’,intval($qty)) ->setData(‘is_in_stock’, intval($qty) > 0 ? 1 : 0) ->setData(‘manage_stock’, 1) ->setData(‘use_config_manage_stock’, 0) ->save(); }
SQLSTATE[22003]: Numeric value out of range: 1690 BIGINT UNSIGNED value is out of range in ‘(`DB`.`tag_summary`.`products` – 1)’ Magento Version 1.9.0.1 Project Fix: I recently had to resolve this issue for a customer, and since it was quite easy to fix, I figured I’d share with all you developer and do…