To fetch all the products in Magento you can use the below code – $prodobj = Mage::getResourceModel(‘catalog/product_collection’)->getData(); $prodobj is an array which will contain all the products, each as an array. The values returned for the products are – Array( [entity_id] => 1 [entity_type_id] => 4 [attribute_set_id] => 4 [type_id] => simple [sku] => product-a… Continue reading Magento – How To Get All the Products
Tag: PHP
Magento Problem In Creating New Product
In the last few Magento releases (I have personally faced the issue in versions 1.4.1.1 and 1.4.2.0) when trying to create a new product in the back end Magento returns an error and products are not created. The error message is Fatal error: Call to a member function deletePriceData() on a non-object in \app\code\core\Mage\Catalog\Model\Product\Attribute\Backend\Tierprice.php on… Continue reading Magento Problem In Creating New Product
Magento – Form Not Submitting In Backend – Formkey
In Magento back end to properly submit a form, a value called formkey must be submitted with the form. Or else the form will never submit itself. The formkey can be submitted with a hidden field as below – $formKey = Mage::getSingleton(‘core/session’)->getFormKey();
Magento – Load A Product By Any Attribute
While generally we load a product in Magento by its id, it is also possible to load it by any of its attribute. To do that use the following code – $_p = Mage::getModel(‘catalog/product’)->loadByAttribute(‘attr_name’, $attrib); Just replace ‘attr_name’ with the name of the attribute and $attrib with the value and then Magento will fetch matching products.
Double Dollar Or Variable Variables In PHP
Apart from the normal variables in PHP, which we write like $a, there is also a variable variable which is written like $$a. The problem is when someone wants to search what does this double dollar mean, they do not know how to search. Well searching will be a lot easier if they search by… Continue reading Double Dollar Or Variable Variables In PHP
Magento Format Price To Default Currency
Use the below code to format a price according to default currency in Magento $price = $_product->getPrice() /// This is in product details page. /// Replace it with necessary price value according to your requirement. $formatted price = Mage::helper(‘core’)->currency($price);
"Flex Library Not Loaded" Error In Magento
The Problem Image upload not working in Magento backend. Whenever entering product details getting an error alert saying Flex Library Not Loaded The Solution This happens due to improper Magento installation. Just give full permission to the following folder /js/lib That should solve the problem. Njoy 🙂
Magento :: Images Not Showing In Front End
It is a common issue in Magento. After uploading images from back end, the images are shown in back end, but are not displayed on the front end. To solve follow the below steps. Any one of them might solve the issue for you, or even you might need to apply all. Try your luck… Continue reading Magento :: Images Not Showing In Front End
Magento Customize Error Page
After spending a lot of time and energy creating a beautiful Magento theme, once you get an error somewhere, you would notice that you are shown the default vanilla Magento theme. Whats worse is that it still has the Magento logo!!!Actually the error page Magento shows is not placed inside the theme folder. To customize… Continue reading Magento Customize Error Page
Drupal Database Installation Problem Solved
While installing Drupal sometimes you might get stuck on the database configuration page. After entering the data and submitting, the page just reloads and nothing happens. Follow the below steps for the solution. 1. I know you have already done this step, but just to mention, please go through the database details once again and… Continue reading Drupal Database Installation Problem Solved