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 12-15-2025 13:46:40

Murphys001
Member
Registered: 09-06-2014
Posts: 24

Custom Shipping Script

Hi,

I have two questions concernig a Custom Shipping Script (which is the only shipping method I use to calculate shipping costs based on weight):--

1)  Can you test if the customer is a wholesale or retail cusrtomer? Here I'm thinking of offering free shipping if a retail customer's shopping cart exceeds a certain value, but not to a wholesale customer.

2) Can you check the dimensional length of each item in a shopping cart? I'm already using a PHP array to check the total weight of all of the items in a shopping cart to calculate shipping cost. The idea here is to see if any one item in the cart exceds a certain length for voulmetric calculatons. If true a calculation of shiiping cost would be performed based on the volumetric weight rather than the physical weight. All other items in a cart (regardless of length) would be assumed to fit into the external package of any one item that exceeds a certain length

Thanks, Murphys001

Last edited by Murphys001 (12-15-2025 13:49:17)

Offline

 

#2 12-15-2025 15:34:17

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

Re: Custom Shipping Script

(1) Yes, just check the usergroup for the customer.  You can do so like:

Code:

if ($this->globals('core_user.usergroup') == 'wholesale') {}

(1) Yes.  Every custom shipping script has an info array passed to it which holds all the info for the shipment.  You can get the value and do something with the 'packages' key in it.  The 'packages' key will hold an array with all the packages and their dimensions.

Code:

$info = $this->globals('ecom.customship');
print_r($info['packages']);

Nick Hendler

Offline

 

Board footer