VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: stAn99 on January 24, 2012, 14:22:48 PM

Title: VM2 + J1.7 Shipping not updated
Post by: stAn99 on January 24, 2012, 14:22:48 PM
Hello Everyone,
i believe i found a bug in the latest VM2 full release while developing my checkout extension.

I am running into this problem:
- when i set shipping like below where shipping_method is an object from getShipments() from shipmentModel the configuration of the shipping method does not reload for the last shipping listed (the configuration stays at the middle one which is not valid). Therefore the bottom shipping method is not validated and thus returns no price information or name.


$cart =& VirtueMartCart::getCart();
$calc = calculationHelper::getInstance();
foreach ($shipping_array as $shipping_method)
{
$id = (int)$shipping_method->virtuemart_shipmentmethod_id;
$cart->setShipment($id);
$prices = $calc->getCheckoutPrices(  $cart, false);
var_dump($prices);
}

shipping1 is configured with empty countries (id1)
shipping2 is configured with a specific country
shipping3 is configured with empty countries

I fixed this (one week of debugging and learning VM2) by editing this file:
\administrator\components\com_virtuemart\plugins\vmplugin.php

by commenting this line in this function :

protected function getVmPluginMethod($int){
//if($this->_vmpCtable===0){
....

This way the configuration reloads correctly according to the code above and the prices are set correctly. I am not saying that this is a general bug in VM2 as i haven't tested all the consenquences in normal VM operation, but I encountered this while developing my component.

If there is any other way how to reload _vmpCtable when it is already set, i will be glad to learn.

Best Regards,
Stan Scholtz, RuposTel.com