3

Odd one, we have an SKU that is 063.665.

Frontend however under additional information it shows as 63.67.

So it strips the leading 0 and rounds the end.

Does anyone know how I can stop this rounding under additional information?

enter image description here

2

I found that Magento rounds if an attribute value is numeric, to fix this for SKU I did the following:

In app/design/frontend/YOURTHEME/YOURTHEME/template/catalog/product/view/attributes.phtml

Change

<?php
  $_MyValue = $_data['value'];
  if (is_numeric($_MyValue))
  {
    $_MyValue = round($_MyValue, 2); //round to 0.00
  }
?>

To:

<?php
  $_MyValue = $_data['value'];
  //IF ATTRIBUTE IS NOT SKU THEN GO AHEAD AND ROUND IT
  if($_data['label'] !== "SKU"){
    if (is_numeric($_MyValue))
    {
      $_MyValue = round($_MyValue, 2); //round to 0.00
    }
  }
?>

This will only round attributes that aren't SKU.

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.