News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Default weight and LWH is not defaulting when adding new products

Started by capewellmj, May 07, 2014, 21:10:17 PM

Previous topic - Next topic

capewellmj

Hello

Not a big deal I don't think . In the Virtuemart configuration we have Default Weight Unit = Pounds and Default LWH Unit = Foot.

However when we add new products it no longer defaults to pounds and feet. It defaults to Killogrammes and Metres.

Any help would be appreciated

Thanks :-)

Martin


yorair

have the same problem but with Centimeters. new products are defaulted to Meters.

Milbo

Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

testingaja

VirtueMart 2.6.6  still has this problem... any solutions ?

testingaja

found the solutions... hope it will be fix in the next version...

file: administrator\components\com_virtuemart\views\product\view.html.php

search for this row --> if(!empty($product->product_weight_uom))

replace all if else with this one:

            if(!empty($product->product_weight_uom))
            {   // or !$task=='add'
               $product_weight_uom = $product->product_weight_uom;
               $product_unit = $product->product_unit;

               if(!empty($product->product_lwh_uom))
               {
                  $product_lwh_uom = $product->product_lwh_uom;
               }
               else
               {
                  $product_lwh_uom = VmConfig::get('lwh_unit_default');
               }
            }
            else if(!empty($product_parent))
            {
               $product_weight_uom = $product_parent->product_weight_uom;
               $product_unit = $product_parent->product_unit;

               if(!empty($product_parent->product_lwh_uom))
               {
                  $product_lwh_uom = $product_parent->product_lwh_uom;
               }
               else
               {
                  $product_lwh_uom = VmConfig::get('lwh_unit_default');
               }
            }
            else
            {
               $product_weight_uom = VmConfig::get('weight_unit_default');
               $product_unit = VmConfig::get('weight_unit_default');
               $product_lwh_uom = VmConfig::get('lwh_unit_default');
            }

Milbo

?
This?
Quote
if(!empty($product->product_weight_uom)){   // or !$task=='add'
               $product_weight_uom = $product->product_weight_uom;
               $product_unit = $product->product_unit;
               $product_lwh_uom = $product->product_lwh_uom;
            } else if(!empty($product_parent)){
               $product_weight_uom = $product_parent->product_weight_uom;
               $product_unit = $product_parent->product_unit;
               $product_lwh_uom = $product_parent->product_lwh_uom;
            } else {
               $product_weight_uom = VmConfig::get('weight_unit_default');
               $product_unit = VmConfig::get('weight_unit_default');
               $product_lwh_uom= VmConfig::get('lwh_unit_default');
            }
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

testingaja

Quote from: Milbo on August 14, 2014, 02:23:44 AM
?
This?
Quote
if(!empty($product->product_weight_uom)){   // or !$task=='add'
               $product_weight_uom = $product->product_weight_uom;
               $product_unit = $product->product_unit;
               $product_lwh_uom = $product->product_lwh_uom;
            } else if(!empty($product_parent)){
               $product_weight_uom = $product_parent->product_weight_uom;
               $product_unit = $product_parent->product_unit;
               $product_lwh_uom = $product_parent->product_lwh_uom;
            } else {
               $product_weight_uom = VmConfig::get('weight_unit_default');
               $product_unit = VmConfig::get('weight_unit_default');
               $product_lwh_uom= VmConfig::get('lwh_unit_default');
            }

yes... that section.... :)

Milbo

What about this solution?


if(!empty($product->product_weight_uom)){
$product_weight_uom = $product->product_weight_uom;
} else if(!empty($product_parent)){
$product_weight_uom = $product_parent->product_weight_uom;
} else {
$product_weight_uom = VmConfig::get('weight_unit_default');
}

if(!empty($product->product_lwh_uom)){
$product_lwh_uom = $product->product_lwh_uom;
} else if(!empty($product_parent)){
$product_lwh_uom = $product_parent->product_lwh_uom;
} else {
$product_lwh_uom = VmConfig::get('lwh_unit_default');
}

if(!empty($product->product_unit)){
$product_unit = $product->product_unit;
} else if(!empty($product_parent)){
$product_unit = $product_parent->product_unit;
} else {
$product_unit = VmConfig::get('product_unit_default','KG');
}
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

testingaja

Quote from: Milbo on August 15, 2014, 10:42:18 AM
What about this solution?


if(!empty($product->product_weight_uom)){
$product_weight_uom = $product->product_weight_uom;
} else if(!empty($product_parent)){
$product_weight_uom = $product_parent->product_weight_uom;
} else {
$product_weight_uom = VmConfig::get('weight_unit_default');
}

if(!empty($product->product_lwh_uom)){
$product_lwh_uom = $product->product_lwh_uom;
} else if(!empty($product_parent)){
$product_lwh_uom = $product_parent->product_lwh_uom;
} else {
$product_lwh_uom = VmConfig::get('lwh_unit_default');
}

if(!empty($product->product_unit)){
$product_unit = $product->product_unit;
} else if(!empty($product_parent)){
$product_unit = $product_parent->product_unit;
} else {
$product_unit = VmConfig::get('product_unit_default','KG');
}


nope... it didn't work for this situation: Create New Product...

In Virtuemart Configurations -> ShopFront, I set Default LWH Unit  to Centimeters. But in Create New Product, it shows Metres...

thx in advance....

Milbo

just try the new version, there is another line missing, setting the parent to false if there is no parent (id =0)
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

testingaja

Quote from: Milbo on August 16, 2014, 04:03:01 AM
just try the new version, there is another line missing, setting the parent to false if there is no parent (id =0)

ok... i'll try it... thx... :)