Our site www.viart.com site is operated by latest Viart Shop 5 with default Clear design
Topic Information
Roger (Guest)
Roger (Guest)
my client only ships within South Africa and have two flat rate costs R35 or R60.
 
For orders where all the products are of type 'Flowers' the R35 rate applies. For an order that includes any other product type the R60 rate applies.
 
How do I go about setting up this calculation? I guess that I need to create a custom php script. Looking at the supplied scripts for FedEx and UPS I can sort of see how to do it. Do you have any kind of guide or API spec to help me? How do I iterate over the cart contents and check the product types? What variables need to be set by the script for the shipping cost to be added to the order and shown on the checkout confirmation page?
 
 
Roger (Guest)
Roger (Guest)
OK. I worked it out for myself. Here's the code.
 
<?php
 
/* Default charge is that for flowers only.
* If there is any item in the shopping cart that is not of
* type flowers then the standard rate aplies.
*/
 
$shipping_charge = $module_params['Delivery_Charge_Flowers_Only'];
foreach ($shopping_cart as $cart_item) {
if ($cart_item['ITEM_TYPE_ID'] != '3') {
$shipping_charge = $module_params['Delivery_Charge_Standard'];
break;
}
}
 
$shipping_types[] = array(54, '', 'Delivery Charge', $shipping_charge, 0, 1, 0);
 
?>
 
Sorry about the formating. Forum does not seem to allow any formatting, it even removes white space at start of lines.
 
strophy
strophy
Hi,
 
thanks for the code. As a less experienced programmer, I would really appreciate if anyone could document what the contents of the $shipping_types array mean, and how to reference such a file so that it is used by my custom shipping module. I guess it is using the 'Is External' setting, right?
 
Thanks for any help
Leon
 
benshanks
benshanks
Has anyone managed to set custom shipping rates using external PHP code, have tried but no joy yet
 
Anyone ?
 
foxtrotdomains.com
foxtrotdomains.com
I am trying with a few others to request a custom shipping module from ViArt, read the Customization Forum.
 
If you are interested Ben, please let us know on that forum.
 
Please advise.