Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weight units #1702

Closed
pronto2000 opened this issue Aug 18, 2015 · 8 comments
Closed

Weight units #1702

pronto2000 opened this issue Aug 18, 2015 · 8 comments

Comments

@pronto2000
Copy link

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).

@vpelipenko vpelipenko added the MX label Aug 19, 2015
@choukalos
Copy link

In Magento ( both 1.x and 2.x ) the weight dimension for catalog is hard coded as lbs. We plan on changing this in the future (current backlog item - MAGETWO-36345). @ilol is the owner for that epic and would appreciate any insight on how you-all would like to control that dimension.

@pronto2000
Copy link
Author

Well, in Magento 1 the weight dimension is somewhat vague and for my purposes it could be anything I want it to be. In Magento 2 it's currently hardcoded to lbs. It looks much nicer, though.

My suggestion -- create a list of most used weight units and a way to convert them from one unit to another. Allow merchant to define default weight (base) unit. Allow merchant to choose among alternate weight units when filling product information (for example instead of default kg use g for a pen instead). All shipping methods use base units for calculations and recalculate alternate units to base units using conversion table mentioned above. There's probably no need to add backend editor for alternate values as those do not change in time (unlike currency rates) and there's a limited number of them. Such solution should be easy to implement and should have little or no ramification to the rest of system.

Anyone else caring to weight in? I could implement it myself and submit it as a PR, but it sounds like pretty fundamental issue so I'd like to make sure that it fits into big picture.

@Vinai
Copy link
Contributor

Vinai commented Aug 27, 2015

In Germany all Magento 1 merchants I know use the weight units KG or Gram.

@choukalos I haven't actually found a place in the code stating weight in Magento in is in lbs. Can you please let me know where that is the case? I always assumed it was a non-specific value. There never was an issue with merchants using it as a KG value.

From my perspective it is better to have a non-specified unit rather then having it hardcoded to lbs (or any one other unit). The only alternative besides the non-specific value would be to have it be freely configurable.

As far as I know the one place where the weight is needed is shipping cost calculation. But even there I haven't run into issues when merchants used different values as long as it was done consistently within one installation.
For shipping calculation it probably would make sense however to provide a factor (also configurable) to convert weight to one fixed unit. I would vote for a metric unit since that is a legal unit in every country from what I know (including the US and China).

@piotrekkaminski
Copy link
Contributor

Internal issue MAGETWO-43788 was created to address this problem.

@choukalos
Copy link

Clarification - 43788 is for a very simple solution. @Vinai digg the thoughts for conversion - will update MAGETWO-36345 and let @ilol know.

@daim2k5
Copy link
Contributor

daim2k5 commented Nov 10, 2015

fixed.

@daim2k5 daim2k5 closed this as completed Nov 10, 2015
@RemcoShopCommerce
Copy link

'kgs' is not a weight unit - 'kg' is.

@chickenland
Copy link
Contributor

For those looking where to configure this, it is in Stores | Configuration -> General | General -> Locale Options -> Weight Unit

okorshenko pushed a commit that referenced this issue Nov 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants