Magento: Show Success, Error or notice message

Share
Posted on April 7th, 2013 | Posted by admin

If you want to show a success message or an error message in your custom module or in anything else in magento, we can use the addSuccess() and addError() functions. These functions show the respective messages in the magento format. You don’t have to build a seperate markup for you custom module messages you can use the magento default html for showing messages using the 2 functions.

Showing messages on the frontend

$message = 'Your message ... ';
Mage::getSingleton('core/session')->addError($message);
Mage::getSingleton('core/session')->addSuccess($message);

Dynamically adding and changing blocks in Magento

Share
Posted on April 4th, 2013 | Posted by admin

Sometimes when we’re developing specific functionality for a Magento website, we’ll need to shift around, modify, add, or remove blocks within the layout. Sometimes this is a skinning issue and can be achieved by moving around the calls to echo $this->getChildHtml(), other times it may require an override within our custom theme’s local.xml file. However, what if we wanted to change the layout or change blocks dependant on some custom factors? There are some built-in methods in Magento which I’ll mention now, however it’s worth looking a little more in-depth and getting our hands dirty.

Page-Specific Handles

Handles are used in Magento as the “parent nodes” in the layout XML for defining which layout we’re using. Example: catalog_product_view is the handle for the product view page in Magento, and cms_index_index is used for the homepage. These handles can extend beyond the basic front_name / controller_name / action_name in that we can target specific categories, products and stores. In certain controllers (category controllers, product controllers) they directly use the addHandle(‘handle_name’) function on an update object. You should be able to get the current update object in any controller, helper, or block if you’ve extended classes correctly via $this->getLayout()->getUpdate(). Below are some layout handles which can be used to target specific cases within your Magento site:

How to Obtain Custom Attribute Values in Magento

Share
Posted on April 3rd, 2013 | Posted by admin

Today let’s talk about Magento and custom attributes. With Magento you can create as many custom attributes for your products as you like, and there are different attribute types such as:

  • Text Field
  • Text Area
  • Date
  • Yes/No
  • Multiple Select
  • Dropdown
  • Price
  • Gallery
  • Media Image
  • Fixed Product Tax

Magento: How to get all attribute codes by product object or attribute set ID

Share
Posted on April 1st, 2013 | Posted by admin

I’m writing an script for exporting Magento products to an XML file. In my PHP script, I have decided to create an class for holding the data of Magento product. In that class which defines all attributes from a product like the editing product screen from back-end

Magento: How to get all attribute codes by product object or attribute set ID

Convert Magento Database to Innodb

Share
Posted on March 31st, 2013 | Posted by admin

Convert Magento Database to Innodb

ALTER TABLE `admin_assert` ENGINE=InnoDB;
ALTER TABLE `admin_role` ENGINE=InnoDB;
ALTER TABLE `admin_rule` ENGINE=InnoDB;
ALTER TABLE `admin_user` ENGINE=InnoDB;
ALTER TABLE `adminnotification_inbox` ENGINE=InnoDB;
ALTER TABLE `api_assert` ENGINE=InnoDB;
ALTER TABLE `api_role` ENGINE=InnoDB;
ALTER TABLE `api_rule` ENGINE=InnoDB;
ALTER TABLE `api_user` ENGINE=InnoDB;
ALTER TABLE `catalog_category_entity` ENGINE=InnoDB;
ALTER TABLE `catalog_category_entity_datetime` ENGINE=InnoDB;
ALTER TABLE `catalog_category_entity_decimal` ENGINE=InnoDB;
ALTER TABLE `catalog_category_entity_int` ENGINE=InnoDB;

Page 10 of 90« First...«89101112»203040...Last »