February 11, 20197 yr Hello, Inside the products admin page, There are 2 fields for the weight, one for the weight, one for the weight type. my question is I want to make a module to display different weight type conversion. Can I do that, or I make to write something to display the conversion. Example : Kg => Lb Edited February 11, 20197 yr by Snoopy
February 11, 20197 yr Hello @Snoopy If you look inside the administration Configuration, you a weight menu where can add different weight conversation. Now how to make that on the catalog ! Below the element can help you. This code allow you to convert all in Kg. $CLICSHOPPING_Weight = Registry::get('Weight'); $CLICSHOPPING_ProductsCommon = Registry::get('ProductsCommon'); $defaultUnitWeight = SHIPPING_WEIGHT_UNIT; // 2 in the default configuration KG shipping_weight = getProductsWeight // Take only the kg // gr to kg if ( $defaultUnitWeight == 1) { $weight = round($CLICSHOPPING_Weight->convert($shipping_weight, $defaultUnitWeight, 2), 3); } //Ounce to kg if ( $defaultUnitWeight == 3) { $weight = round($CLICSHOPPING_Weight->convert($shipping_weight, $defaultUnitWeight, 2), 3); } //Ounce to kg if ( $defaultUnitWeight == 4) { $weight = round($CLICSHOPPING_Weight->convert($shipping_weight, $defaultUnitWeight, 2), 3); } echo $weight; Edited February 11, 20197 yr by Patrick
February 11, 20197 yr Info a little mistake : $shipping_weight = CLICSHOPPING_ProductsCommon->getProductsWeight();
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.