Hi All,
I'm using VM2.6.10 now starting add some shipment method but the result is not fit to Indonesian shipping model which is Shipping Cost = Shipment Cost * weight + Package Fee.
I found below function script in weight_countries.php file located in /plugins/vmshipment/weight_countries/ folder
function getCosts (VirtueMartCart $cart, $method, $cart_prices) {
if ($method->free_shipment && $cart_prices['salesPrice'] >= $method->free_shipment) {
return 0;
} else {
return $method->cost + $method->package_fee;
}
}
and I modify some mathematical expressions line return $method->cost + $method->package_fee; to be return $method->cost * 10 + $method->package_fee; which 10 is represent weight, the result is fit with general Indonesia shipping methods. I need replace 10 with variable that get from order weight (total order weight)
unfortunately I'm not a programmer therfore I don't know how to get the order weight variable. I tried some variable that available on script such as $orderWeight but the result is only display package fee it's mean value of $orderWeight always 0 (zero).
if anyone can help me, would be appreciated.
PS: general shipping order weight is round up, if you can share how to do it, I would be appreciated.
there is a built in function for this
$Order_WeightKG = $this->getOrderWeight($cart, 'KG');// native func vmsplugin
but I think the free "rules" shipping plugin would be more useful for you
Also have a look at the Advanced Shipping by Rules Plugin
http://open-tools.net/virtuemart-2-extensions/vm2-shipping-by-rules-plugin.html
GJC,
thanks for your respond, it's same with $orderWeight that I use and it's not working, you are right the rules shipping plugin is fit but it's not free.
jenkinhill,
Thanks for your suggestion. I installed the standard one but limited future because I cannot using mathematical expressions on free version, I have to use Advanced Shipping by Rules Plugin as you suggest.
I believe that plugin is answer all I need.
I thought it only add/modify simple command, I wish I understood the programming :'(
Thanks any way guys
Hi All,
Finally I found it, below is little modification that I made, thanks to GJC.
function getCosts (VirtueMartCart $cart, $method, $cart_prices) {
if ($method->free_shipment && $cart_prices['salesPrice'] >= $method->free_shipment) {
return 0;
} else {
return ($method->cost * $this->getOrderWeight ($cart, $method->weight_unit)) + $method->package_fee;
}
}