0

I need to show weight attribute without any decimal points in admin panel on front end that is working fine but I need to remove the 4 decimal points from admin panel where site admin enter the product details.

Any help in terms of code or database changes will be appreciated.

image url : http://sale24by7.com/weight.png

Thanks & Regards

user1765285
  • 3
  • 1
  • 2

3 Answers3

1

You can use Event

adminhtml_catalog_product_edit_prepare_form

To catch the form output and modify it as you want !

The method will look like this :

   public function renderWeight( Varien_Event_Observer $observer )
    {
        $form = $observer->getForm();
        $element = $form->getElement('weight'); // Weight attribute from the Form Data
        if($element){
            $oldWeight = $element->getValue(); // Weight Value you want to modify
            $values['weight'] = (int) $oldWeight; // Assign the new Weight Value
            $form->addValues($values); // Add it to the form
        }
    }

I have created the module you downloaded from here Download

Meabed
  • 3,828
  • 1
  • 27
  • 37
0

I just use this:

.$this->htmlEscape(number_format($weight));

0

To change the decimal precision of attributes that have a backend_type set to decimal,

You have to change the type of value in this table :

catalog_product_entity_decimal

If you have not change yet, you should see :

decimal(12,4)

You should replace with

decimal(12,0)
vhanahrni
  • 79
  • 8