For security reason we should change the admin path from the very obvious admin to something else. Like for example it can be backend or back or even abracadabra. Whatever you think will be secure can be set as admin path by the following steps – 1. Open file \app\etc\local.xml2. Look for the line 3.… Continue reading Magento – Changing Admin Path
Category: Uncategorized
Magento – Fetch All The Products Under A Certain Category
If you want to fetch all the products under a certain category in Magento, use the below code – $catObj = Mage::getModel(‘catalog/category’)->load($catId);$prodObj = $catObj->getProductCollection()->getData(); Here $catId is the id of the category whose product you want to fetch. And $prodObj will return the array of products, each of whose values will be an array like… Continue reading Magento – Fetch All The Products Under A Certain Category
Magento – How To Get All the Products
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
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
Div Center Aligned And Margin Auto Problem For IE6 Fixed
If you want to place your div in the center of its container with the help of CSS, you can do so following below process – Hi margin 0 sets the margin to 0px and auto sets equal space on either side of the div making it center aligned.Here both the outer and inner div… Continue reading Div Center Aligned And Margin Auto Problem For IE6 Fixed
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.
Style HR Tag With CSS
There are pages which have a few hr tags thrown here and there. If the page is designed nicely, the hr tags look ugly, if not styled properly. To make them look fine use the following CSS properties. 1. border:none; – Will remove the border2. background-color:#000000; – Add color as required3. height:1px; – Adjust the… Continue reading Style HR Tag With CSS
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
Import large database in MySQL
We generally use phpMyAdmin for importing database / tables from mySQL dump files. But when the file is large (can be 50 MB or even 700 MB) it is not possible to import it via a web interface. We can import such large files from the command prompt. 1. Open the Command prompt. 2. Go… Continue reading Import large database in MySQL