Show Values of Multi-Select Attribute in Magento

Posted on September 11th, 2012 | Posted by admin

In Magento, multi-select attributes are a great way to create a very detailed attribute for products. However, if you want to display them on the product page outside of the default Attribute table, it can be a bit trickier. Using this snippet of code, you can show a comma separated list on the product page from your multi-select attribute.

When would that be useful? We recently built a Magento store for a company that sells handguns online. These handguns cannot be shipped to some states (we call these “restricted states”). Instead of having the client enter that information into the Description field of every single product, we created a multi-select attribute and then wrote out it’s values on each product page.

How to change Weight Attribute decimals Magento

Posted on October 6th, 2011 | Posted by admin

There is no simple way to change the decimal numbers in the Weight Attribute in Magento.

And is not a specific solution either.
What can we do?
For example, we can force to all numeric attributes to show with 2 decimals.

Open the attributes.phtml located in:

app/design/frontend/YOUR THEME/template/catalog/product/view/

I changed this:

How to add new custom category attribute in Magento

Posted on June 23rd, 2011 | Posted by admin

Sometimes you need to extend functionality of Magento categories. There is several ways to do that, I will show you how it can be done.
You can do that by modifying and adding data into some of tables directly, but it can be waste of time if you don’t know what you are doing.
This post will describe how you can add new custom category attribute in your Magento store via sql_setup script.

MySQL setup script will look something like this, it depends on your needs and how you would like to configure your new attribute:

How To Pre Populate Product Dropdown Attribute Values

Posted on June 6th, 2011 | Posted by admin

If you are looking to pre-populate product drop down attributes (custom types) i.e. “Partners” attribute etc. then you must be wondering how to pre-populate the product drop down attribute values in that attribute. One option is to manually enter all the data which is time consuming specially if you are supposed to fill large data set. What if the source of the data is large enough to enter and update? Situation gets worse if you are asked to check whether the data is upto-date or not.

Lets take a scenario where people are coming to a separate part of your website and registering as a partner which is getting stored in other database (Non-Magento database).

Now, we have to fetch partners from this remote site and pre-populate (upto-date) data in our newly created custom attribute dropdown (partners).

Magento product attributes are extremely flexible, but having dynamic values per product would mean you would need one attribute per product which doesn’t make much sense so I am assuming that these attribute values share some things in common among products in your store so you will have a limited number of attributes (or one?). For each such attribute you should create the attribute and the backend model for it beforehand and then use a cron job or event update the attribute value options from your API and cache them locally in the database or some other method. You can add an attribute in your module installer like this:

Add custom attribute to Magento’s PDF invoice

Posted on May 17th, 2011 | Posted by admin

Hello everyone! Today I’ll show you how to add custom attribute to Magento’s generated PDF invoice in just a few steps. Since this article is pretty straight-forward, here we go.

One of my recent tasks was to create a custom attribute for products called inchoo_warehouse_location, and output it when click on “Print” (invoice in admin section) occurs. Since PDF generation is Magento’s core functionality, we’ll have to rewrite it a bit.

Step 1

Create the following three files in your Magento’s installation:

Those will be used for our extension that will modify Magento’s core functionality.

Page 2 of 3«123»