Hi all. I am close to getting my first ViArt shop up and running. All that I have left is to get the shipping portion working. My needs are actually quite simple but I can't figure out a way to do it.
I just want it to put in a shipping value of the greater of $15 or 9% of the total goods cost.
I can see how to do the minimum easily enough with a shipping type in the shipping methods. But it only lets me put in dollar amounts based on cart totals not a percentage value so I can't get the second part of my shipping equation in there.
You could create your own shipping method, and there's a place to put a script that can be used to calculate your shipping based on your own needs. I haven't done it, but pretty sure it will work. I have used my own shipping methods for flat rate.
Adding a calculation with a PHP script is easy. Since you need the order ID and the weight, you will have to pass those in via the parameters, and sort them out inside the script.
Worst case, you decide which is best for your customers, a % or a flat rate per weight, or such.
Hope it helps!
Ed
daviswe
11 Feb 2014 8:26 PM
BTW, a clarification: Using the passed-in parameters & sources of your custom shipping module will only work if you pass in the weight and order_ID. Since you don't have access to those, you can take code from USPS_Functions.php, which carries the info you need to do the calculation.
For example, this line is mostly what you need to implement:
----------------------------------------------
<?php
function usps_prepare_rate_request($module_params, $usps_api_name)
{
global $r, $db, $table_prefix, $shipping_weight, $state_code, $country_code, $postal_code, $usps_countries, $shipping_packages;
------------------------------------------------
Note that it includes variables for weight, if not order_id, which you probably really don't need.
Thanks for your insight Daviswe, but I didn't want to calculate shipping based on weight. I wanted to calculate shipping based on cart value. So to be clear the shipping is based on how many dollars worth of merchandise the client has in their shopping cart. It looks like if I had your PHP skills I could have done this myself but at the end of the day I just paid ViArt to add the feature for me. It was a couple hundred bucks but is now up and running on my site.