VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: kratzi on April 26, 2016, 19:25:29 PM

Title: Shiping costs bug in frontend. Shipping module does not consider weight any more
Post by: kratzi on April 26, 2016, 19:25:29 PM
Hi I have tested the following on different Joomla 3.4.6 -3.5.1 and VM versions 3.0.14-3.0.16 and do not see it working any more even though the feature was good working in J2.5 and VM 2.6

I use product weight to show different shipping cost on the productdetails page. If  I have defined a product with over  30kg the customer gets free shipping and below 25kg I charge shipping.

In the backend there is a feature "Show on productdetails page" which I have active for free shipping (over 30kg). However the module will not consider the weight any more but always show shipping costs to the customer because it seems it does not look for the product weight any more.

Is there alredy a fix for this?

Thank you

kratzi
Title: Re: Shiping costs bug in frontend. Shipping module does not consider weight any more
Post by: kratzi on May 16, 2016, 01:34:36 AM
push
Title: Re: Shiping costs bug in frontend. Shipping module does not consider weight any more
Post by: GJC Web Design on June 03, 2016, 20:33:20 PM
Yes - this is broken

in the weight - countries ship plugin any way.. the function plgVmOnProductDisplayShipment() is called by the view.html.php 

in the weight - countries ship plugin this function tries to call the  if($this->checkConditions($cart,$this->_currentMethod,$prices,$product)){

but func. is  protected function checkConditions ($cart, $method, $cart_prices) - i.e. no $product  - oddly? this is then true

added this which makes it work

protected function checkConditions ($cart, $method, $cart_prices, $product) {

and

//GJC
if(!empty($product->product_weight)){
$orderWeight = $product->product_weight;
}else{
$orderWeight = $this->getOrderWeight ($cart, $method->weight_unit);
}
//GJC


as a quick fix - of course gives warnings of missing 4th argument &

plgVmShipmentWeight_countries::checkConditions() should be compatible with vmPSPlugin::checkConditions($cart, $method, $cart_prices)

but don't know how the function is intended to be or what the final fix will be
Title: Re: Shiping costs bug in frontend. Shipping module does not consider weight any more
Post by: Milbo on June 06, 2016, 13:41:45 PM
The order weight is taken from the cart, not from the product

$orderWeight = $this->getOrderWeight ($cart, $method->weight_unit);

is in line 250, you should find the reason, why it does not calculate the weight.
Title: Re: Shiping costs bug in frontend. Shipping module does not consider weight any more
Post by: Milbo on June 06, 2016, 13:44:34 PM
I think the right solution is to use


var $_productAdded = true;


in cart.php helper, line 35.