Skip to content

Weight units #1702

Closed
Closed
@pronto2000

Description

@pronto2000

Right now when you enter product weight it also displays weight unit (LBS) which is nice touch. However when I started to investigate how to change it I found that it generated by following code:

    public function getElementHtml()
    {
        if (!$this->getForm()->getDataObject()->getTypeInstance()->hasWeight()) {
            $this->_virtual->setChecked('checked');
        }
        if ($this->getDisabled()) {
            $this->_virtual->setDisabled($this->getDisabled());
        }
        return '<div class="fields-group-2"><div class="field"><div class="addon"><div class="control">' .
            parent::getElementHtml() .
            '<label class="addafter" for="' .
            $this->getHtmlId() .
            '"><strong>' .
            __('lbs') .
            '</strong></label>' .
            '</div></div></div><div class="field choice">' .
            $this->_virtual->getElementHtml() .
            $this->_virtual->getLabelHtml() .
            '</div></div>';
    }

This is wrong on so many levels that I don't even know where to start. Basically weight unit is right now part of the translation which means that that different language packages may (and probably will) have different labels which can seriously mess things up, especially when we take into consideration that vast majority of world uses KG-s instead of LBS.

My suggestion -- either make weight unit configurable under inventory (Pounds, Ounces, Kilos, Tons, Grams, whatever) which would be great or remove the unit from there altogether (Magento 1 style).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions