You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.
I have some items we want to offer free shipping to lower 48 on but not international. We are not shipping all lower 48 for free.
The script I am currently using is below:
<?php
$info = $this->globals('ecom.customship');
$custom = array();
$delinfo = array('stateprov' => $info['stateprov'],
'country' => $info['country'],
'postalcode' => $info['postalcode'],
'rescom' => $info['rescom'],
'shipstateprov' => $info['shipstateprov'],
'shipcountry' => $info['shipcountry'],
'shipzip' => $info['shipzip'],
'shipmethods' => 'USPS',
'shiptype' => 'R');
$result = $this->include_namespace('ecom','shiprealtime',array('delinfo' => $delinfo,
'packages' => $info['packages']));
foreach ($result as $num => $service) {
$custom[$service['name']] = $service['amount'];
} // End of foreach statement.
$custom['~Local Pickup at our Shop~'] = '-1.50';
$this->globals('ecom.customship_response',$custom);
?>
Offline
This should work much better for you:
<?php // +-- // | Variable definition. // +-- $info = $this->globals('ecom.customship'); $custom = array(); // +-- // | Get rates from USPS. // +-- $delinfo = array('stateprov' => $info['stateprov'], 'country' => $info['country'], 'postalcode' => $info['postalcode'], 'rescom' => $info['rescom'], 'shipstateprov' => $info['shipstateprov'], 'shipcountry' => $info['shipcountry'], 'shipzip' => $info['shipzip'], 'shipmethods' => 'USPS', 'shiptype' => 'R'); $result = $this->include_namespace('ecom','shiprealtime',array('delinfo' => $delinfo, 'packages' => $info['packages'])); if ((!($this->isError($result))) && (!(empty($result)))) { foreach ($result as $num => $service) {$custom[$service['name']] = $service['amount'];} } // End of foreach statement. // +-- // | Sort rates by amount (lowest to highest) and make the lowest cost option free // | Only if in the US and not AK or HI. // +-- if ((!(empty($custom))) && ($info['country'] == 'United States') && ($info['stateprov'] != 'Alaska') && ($info['stateprov'] != 'Hawaii')) { asort($custom); foreach ($custom as $service => $rate) {$custom[$service] = 0; break 1;} } // End of if statement. // +-- // | Add local pickup if shipping within the same state. // +-- if ($info['stateprov'] == $info['shipstateprov']) {$custom['Local Pickup at our Shop'] = 0;} // +-- // | Globalize and return. // +-- $this->globals('ecom.customship_response',$custom); ?>
Offline
Thank you
So if I want to remove the free shipping take code out?
asort($custom); foreach ($custom as $service => $rate) {$custom[$service] = 0; break 1;}
I assume I would need to have 2 scripts one for the products I want to offer free shipping on and another for the products we would not have free shipping promotion on. We only do free shipping on special products for limited time.
Offline
You could disable the free shipping portion by commenting out that line like so:
//asort($custom); foreach ($custom as $service => $rate) {$custom[$service] = 0; break 1;}
Two shipping scripts is the easiest way in V8 to do what you want with your subset of products. It's a shame you're not on K9, as that has an absolutely fantastic way of handling this.
Offline
We are actually looking at going to V9.. Since we the person that originally did our site is not longer available.
Offline
Existing clients can upgrade to K9. Just submit this form with your requirements:
https://kryptronic.com/Form/Custom-Shop … t-Upgrades
Offline
Thanks Nick
I submitted the forum on Friday.
Offline
webmaster wrote:
Great. I replied back to your ticket on Friday with a few questions and a demo link. I'll resend that now.
My email must be blocking you. I get the reply from this forum. I will put in new request tomorrow.
Offline
bkc0508 wrote:
My email must be blocking you. I get the reply from this forum. I will put in new request tomorrow.
Looks like you figured out the mail issue, so we'll continue with the ticket. Thanks.
Offline