I have custom attributes, such as "Carats" - these are whole numbers, I want to avoid storing the data as a text field like "14 Cts" or "14 Ct" due to the ease of the data becoming de-normalized over time.

Ideally I would like them to be stored as number columns, but how can I add "Cts" to the displaying of these columns everywhere on the frontend with ease?

2 Answers 2


To do this you'll need to add some code, using the translation functionalities provided by Magento.

Lookup the file frontend\base\default\template\catalog/product/view/attributes.phtml, this is the phtml file you'll need to edit for this. Copy it to your local template directory and edit it.

Go to line 46, there the value is outputted. Replace

<td class="data"><?php echo $_helper->productAttribute($_product, $_data['value'], $_data['code']) ?></td>


<td class="data"><?php echo $this->__('%d attr_' . $_data['code'], (int)$_helper->productAttribute($_product, $_data['value'], $_data['code'])) ?></td>

Let's say your attribute code is carats, the Magento translate function will now look for the string %d attr_carats in the translation CSVs. All you need to do now is add this string to the local translation CSV like this "%d attr_carats","%d Cts" and you will get the right label outputted in the attributes table in the Product detail page.

You can do this for every attribute you want to add a suffix to.


I'd like to achieve this partially, so not only for decimal attributes. When I follow your guiding, the decimal fields are showing up correctly :)


But how do I achieve this for the non-decimal attributes? When I don't submit a translation line, it gives a number with 'attr_****' after it. I hope you or someone has a solution for me :) And maybe tell me if it's required to add all of the attributes to the local translation file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.