Kryptronic Software Support Forum

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.

#1 09-07-2017 13:19:31

Blitzen
Member
From: USA
Registered: 01-01-2005
Posts: 936

Custom Shipping by TOTAL ORDER, not items, and then some.

Client needs the shipping as a percentage based on total _order, not total of each item.
We need to charge $5 for total ORDER <$100, $10 for total ORDER < $200, and free shipping for total ORDER > $200 (IF in conUSA, not AK, not HI, not outside USA).

Actually, it's more complicated. If not contiguous USA, then use USPS. I have that programmed okay to redefine the vars in ECOM_Ship.php as

Code:

     if (preg_match('/AK|Alaska|HI|Hawaii/i', $sihash['stateprov']) || !preg_match('/UNITED STATES/i', $sihash['country'])) {
          $sinshipinfo['shiptype'] == 'R';
     } else {
          $sinshipinfo['customship'] = 'flatRateConUSA';
          $sinshipinfo['shiptype'] =  'C';
     }

and

Code:

     if (preg_match('/AK|Alaska|HI|Hawaii/i', $sihash['stateprov']) || !preg_match('/UNITED STATES/i', $sihash['country'])) {
          $sinshipinfo['shiptype'] == 'R';
     } else {
          $sinshipinfo['customship'] = 'flatRateConUSA';
          $sinshipinfo['shiptype'] =  'C';
     }

and, later on

Code:

     if ((!preg_match('/AK|Alaska|HI|Hawaii/i', $sihash['stateprov']) && preg_match('/UNITED STATES/i', $sihash['country'])) || !preg_match('/UNITED STATES/i', $sihash['country'])) {
          $freeship = 200;
     }

The 'flatRateConUSA' custom script determines the rate depending on what $info['total'] is.
However, I now assume that total is each item, not order total.

How/where do I edit to apply the rate depending on total order? There must be a way.

Thanks! Glad you're still successful smile

Offline

 

#2 09-08-2017 06:42:05

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19818
Website

Re: Custom Shipping by TOTAL ORDER, not items, and then some.

I recommend removing all mods from ECOM_Ship.  Instead, assign all items to custom shipping, and use one custom shipping script that forks based on your logic.  You can pull USPS rates from a custom shipping script, examples exist out here that show how to do that.  Doing it all in one place will make it easier and you'll get past the issue you're seeing now, which is due to where in the code's logic you've implemented your change.


Nick Hendler

Offline

 

#3 09-09-2017 13:33:42

Blitzen
Member
From: USA
Registered: 01-01-2005
Posts: 936

Re: Custom Shipping by TOTAL ORDER, not items, and then some.

Thank you. How would I pull USPS rates from a custom shipping script?
And, what var is the ORDER total? It seems that $info['total'] is total for each item quantity, not the order total because when I use that, the flat rates are taken for each item, not the total order.

Last edited by Blitzen (09-09-2017 13:46:24)

Offline

 

#4 09-11-2017 08:01:24

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19818
Website

Re: Custom Shipping by TOTAL ORDER, not items, and then some.

$info['total'] is what you want to use, that's the total of all items being rated by the custom shipping script.  The KEY is to have ALL items using that same script, so that all items are rated together in one shot, and $info['total'] is the order total.  With that said, here's a good thread showing custom shipping script examples using realtime:

https://forum.kryptronic.com/viewtopic.php?id=30509

Be sure you use 'USPS' for the 'shipmethod' when you get to coding.


Nick Hendler

Offline

 

#5 09-12-2017 15:49:20

Blitzen
Member
From: USA
Registered: 01-01-2005
Posts: 936

Re: Custom Shipping by TOTAL ORDER, not items, and then some.

Thanks. I'll look at that now.
Make it a great day! You certainly deserve it.

Offline

 

Board footer