Magento: How to get all associated children product of a configurable product?

A configurable product can have multiple other products associated to it. This article shows how to fetch all the children products that are associated with a configurable product. Here is the code: /** * Load product by product id */ $product = Mage::getModel('catalog/product') ->load(YOUR_PRODUCT_ID); /** * Get child products id (only ids) */ $childIds = … Read more

Magento: How to change Currency symbol ?

I had to change the currency symbol of Nepalese Rupee (from Nrs to Rs). By default, the currency symbol for Nepalese Rupee is Nrs. For this, you need to edit lib/Zend/Locale/Data/en.xml Well, the xml file to edit depends upon your locale settings. My locale is set to English (United States). So, I will have to … Read more

Magento: How to get Currency Rates?

You can see the currency Rates from Magento Admin System -> Manage Currency Rates You can change base currency and allowed currencies from System -> Configuration -> GENERAL -> Currency Setup -> Currency Options Now, here I will show you how you can get currency rates values for any given currency code. Here, I will … Read more

Magento: How to change order status programmatically?

This article shows how to change your order status programmatically in Magento. First, you need to load your order. You can load order by either order_id or order_increment_id. Load order by “order id” $orderId = YOUR_ORDER_ID; $order = Mage::getModel('sales/order')->load($orderId); Load order by “order increment id” $orderIncrementId = YOUR_ORDER_INCREMENT_ID; $order = Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId); Change order status to … Read more

Magento Error – Notice: Undefined index: 0 app/code/core/Mage/Core/Model/Mysql4/Config.php on line 92

I got this error message when migrating my Magento files and database from one server to another. Notice: Undefined index: 0 in app/code/core/Mage/Core/Model/Mysql4/Config.php on line 92 Solution: – Open PhpMyAdmin – Go to your database – Click SQL – Run the following SQL Query: SET FOREIGN_KEY_CHECKS=0; UPDATE `core_store` SET store_id = 0 WHERE code='admin'; UPDATE … Read more

Magento: There has been an error processing your request. Exception printing is disabled by default for security reasons

Problem: I am using Magento 1.4. Homepage loads fine. When I go to category (product listing) page, it works fine. But when I go to any product detail page, I get the following error:- There has been an error processing your request Exception printing is disabled by default for security reasons. I don’t get the … Read more

Magento: Rewrite/Override Block Controller Model Helper

This article will show how you can override/rewrite Magento Block, Controller, Model and Helper files. We will be dealing with the config XML files and the class files to override. We override Magento core classes to update/modify the core functionalities according to our need. We can directly makes changes in the core Magento classes but … Read more

Magento: Quick way to create order invoice programmatically

Here is a quick and easy way to create order invoice programmatically. Suppose, $_order contains your order. Here goes the code to create invoice:- if($_order->canInvoice()) { /** * Create invoice * The invoice will be in 'Pending' state */ $invoiceId = Mage::getModel('sales/order_invoice_api') ->create($_order->getIncrementId(), array()); $invoice = Mage::getModel('sales/order_invoice') ->loadByIncrementId($invoiceId); /** * Pay invoice * i.e. the … Read more

Magento: Downloadable products not displayed in Associated Products tab in Grouped Product

Scenario: – I created downloadable products. – Then I created a grouped product. – But, when I go to the ‘Associated Products’ tab in product add/edit page for Grouped product, I don’t see the downloadable products that I created before in the list. Cause/Solution: – Edit downloadable product – Go to Downloadable Information tab (the … Read more