Magento: Get Customer Attribute

This article contains code snippet to get customer attributes in Magento. Get Customer Collection $collection = Mage::getResourceModel('customer/customer_collection'); Get Customer’s Name in Customer Collection $collection = Mage::getResourceModel('customer/customer_collection') ->addNameToSelect(); Get Custom Attribute in Customer Collection $collection = Mage::getResourceModel('customer/customer_collection') ->addAttributeToFilter('your_attribute_code', array('notnull' => true)); Thanks.

Magento: Get Custom Option Value from Order

This article contains code snippet to get custom options value of all products in any Magento order. Suppose, there is a product with a custom option dropdown list. You chose one of the option from the dropdown list and purchased that product. The code below fetches product’s custom option value selected in any particular order. … Read more

Magento: TinyMCE not displayed / Shows error

I was working with a custom Magento module. I had to display TinyMCE editor in an admin form field. I was getting this error when I try to add/edit data from the custom module:- Warning: Invalid argument supplied for foreach() in lib\Varien\Data\Form\Element\Editor.php on line 225 I tried some workaround and was able to see the … Read more

Magento: Show Billing-Shipping Address in Customer Signup-Registration page

Here are some ways (2 ways below) to show customer address information in registration page. When you fill up the address fields and signup then both your billing and shipping addresses are filled up. Here is how to enable address fields in signup page:- 1) First way [EASY] – Open template/customer/form/register.phtml – Just above this … Read more

Magento: SEO Tips on Meta Tags – Title, Keywords & Description

Here is a quick tip on how meta tags – title, keywords and description work on Magento. Meta information are not visible directly to end users but they are read by search engine spiders (bots). Meta tags are very important parameters for Search Engine Optimization (SEO). In Magento, you can keep meta tags for Category, … Read more

Magento: System Configuration with Tab for Custom Module

This article shows how to add system configuration (System -> Configuration) menu with menu tab for your custom module. Let us suppose, you have already created a local module. Module Namespace: Chapagain Module Name: News Here is a step-by-step guide:- 1) Create app/code/local/Chapagain/News/etc/system.xml with the following code:- <?xml version="1.0" ?> <config> <tabs> <news translate="label" module="news"> … Read more

Magento: Creating Varien Object & Collection from any Array data

Varien_Object and Varien_Collection are the parent/super class for most of the Magento Models and Collections respectively. The path for Varien_Object is lib/Varien/Object & for Varien_Collection is lib/Varien/Data/Collection.php. This article shows how you can create new Varien objects and collections from any array or object data you have. Here is the code:- /** * Creating new … Read more