Skip to main content

Posts

Showing posts from August, 2015

Customize or Merge the fields in admin grid Magento

Sometimes we need to customize the columns of grid list other than the table fields. Like, merging two fields into one column or displaying content after conditional check. For this we need to add a renderer. Renderer is the class that can render the values of a column by manipulating the data and outputting the data as we like. For this, 1. Create a folder Renderer inside "Block/Adminhtml" of our module. 2. Create a file Somefilename.php with following contents class Organicfeast_Customshipping_Block_Adminhtml_Renderer_Suburbname extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract {     public function render(Varien_Object $row) {                 if ($row->getData('first_name') != NULL || $row->getData('last_name') != NULL) {             $firstName = $row->getData('first_name');                     $lastName = $row->getData('last_name');             if ($lastName != NULL) {                 return $firstName .

Print Customer's Group Name on the transactional emails

For printing the customer’s group name on the order confirmation email, Firstly, we need to copy the following file "app/code/core/Mage/Sales/Model/Order.php" to  "app/code/local/Mage/Sales/Model/Order.php" as core files shouldn't be changed. In Order.php, we should add the following function. This function will return the customer group name. public function getCustomerGroupName(){     if ($groupId = $this->getCustomerGroupId()){         $group = Mage::getModel ('customer/group')->load($groupId);         if ($group->getId()){             return $group->getCode();         }     }     return ''; } Finally, we need to add the following code on the email template to get the group name, {{htmlescape var=order.getCustomerGroupName()}} Cheers!!

Error 503: Service Temporarily Unavailable Magento

We can come across a situation in magento where we are presented with the following message, "Service Temporarily Unavailable  The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later." This happens because when Magento is performing certain tasks, it temporarily creates a file called maintenance.flag. Magento automatically deletes this file when the task is complete. But when the task is incomplete or something wrong happen in between, then this file remains there. Magento checks for its existence and if found redirects to error 503 page. So, the solution is to check if the file maintenance.flag is in magento root. If it is there, then delete it. Cheers!!