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.
Change CSS Class With JavaScript
If we need to change the CSS class of a div or any other element with onclick or onmouseover etc. dynamically using JavaScript, you can do so using className. Follow the below example – Click here to see the class change Mouse over to see the class change
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
Open Thickbox With Onclick
There might be certain times when you would want to open a thickbox with onclick instead of the regular a href. Say you want to make a whole td cell clickable. To do so follow the below steps. 1. Open thickbox.js 2. Find the line – tb_init(‘a.thickbox, area.thickbox, input.thickbox’);//pass where to apply thickbox 3. Add… Continue reading Open Thickbox With Onclick
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
Shortcuts Not Working In Dreamweaver
While using Adobe Dreamweaver many a times the short cuts ( Ctrl+b , Ctrl+i etc.) refuse to work. To solve follow the below steps – 1. Under Window top menu select Workspace Layout 2. Under Workspace Layout the different layouts are listed. Select a layout apart from the one used currently. Then again switch back… Continue reading Shortcuts Not Working In Dreamweaver
Handle Quotes In MySQL Query Using Zend Framework
When a value that needs to be inserted into database, contains a mix of ‘ and ” , problem will arise with normal MySQL query. We can handle the situation when using plain PHP with this solution. But if we are using Zend Framework the solution will be – $db = Zend_Db::factory(‘PDO_MYSQL’, $params);$sql =… Continue reading Handle Quotes In MySQL Query Using Zend Framework
Open And Convert CDR , PSD Files For Free
Many a times it happens that as the developer of a certain project you will get a PSD (Photoshop) or CDR (Coreldraw) file from either the designer or the client. And as a developer its more than possible that you wont be having software like Photoshop or Coreldraw installed in your desktop. So if you… Continue reading Open And Convert CDR , PSD Files For Free