close ad
Help us test the new Databridge BETA with MySQLi support
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues


Need help with shipping rule

Thread began 8/18/2011 7:52 am by Base5 Designs | Last modified 8/23/2011 4:40 am by Base5 Designs | 1289 views | 6 replies |

Base5 Designs

Need help with shipping rule

Hi there am hoping you can pint me in the right direction.

My client is a wine warehouse the shipping works out like this:

there is a flat rate per case (stored in my shipping table)

the flat rate applies to 1 case which holds up to 12 bottles, so for example

£12 for 1 - 12 bottles (1 case) 12*1
£24 for 13 - 24 bottles (2 cases) 12*2
£36 fr 25 - 36 bottles (3 cases) 12 * 3
and so on

ive followed the guide on how to create the session variable for the shipping rate (shiprate).

is it possible to create this rule? and if so how?

thanks for your time

Sign in to reply to this post

Jason ByrnesWebAssist

Sounds like a pretty simple simple quantity discount.

you will need to create a separate rule for each quantity break on the shipping tab of the eCart object, for example:

1 - 12:
"SubTotal for any column"
If the Subtotal for column "Quantity" is ">" a value of "0"

"SubTotal for any column"
If the Subtotal for column "Quantity" is "<=" a value of "12"

Flat rate charge of "12"

the other rules will follow the same pattern, just changing the quantity and the flat rate charge.

Sign in to reply to this post

Base5 Designs

Hi Jason thanks for your reply

i can easily add the rules as static, but would prefer it to be dynamic if possible

for example if i wrote the following in php:

//quantity is the number of items,
//shipcost is the cost of shipping 1 box stored in a session variable
myshipping = function($quantity, $shipCost){
$boxHolds = 12;

//get number of complete boxes
$completeBoxes = floor($totalQuantity / $boxHolds);

//check too see if there are extra bottles
$extraItems = ($totalQuantity % $boxHolds);

if ($extraItems >0){
$completeBoxes +1;
$myshippingAmount = $completeBoxes * $shipCost;

i could return either complete boxes from the function and have the rule calculate the shipping or return an actual cost for the shipping

would it work and how would i create a shipping rule using this function?

Sign in to reply to this post

Jason ByrnesWebAssist

assuming your function returns the correct amount, store the $myShippingAmount in a session variable, then use the session variable in your shipping rule

set the shipping rule to use the trigger:
Number of unique items in the cart > 0

and a flat rate shipping of '$_SESSION['myShippingAmount']'

Sign in to reply to this post

Base5 Designs

Hi Jason

I'm still struggling with this

the steps i have taken are as follows

in my ecart object i have a colulmn called totalbottles which sums up how many bottles need to be shipped (the number of bottles per product is stored in my product table)

the cost of shipping 1 case is in a recordset that is filtered by the country code (in fact its the same table that stores all my countrys for the select list)

i have a function as described earlier that works out the shipping rate (i have checked this function and it does work as expected if i put in static values)

on my checkout page i have created a session variable to hold the returned value from my shippingcost function

to the function i pass the cost of shipping one case and the totalbottles amount

$bottleAmount = $eCart1->DisplayInfo("TotalBottles");
$shippingCost = $row_rs_saleparams['shipcost_scn'];
$shippingAmount = myshipping($bottleAmount, $shippingCost);

this i then store in a session variable

if (!session_id()) session_start();
if(isset($_POST["Checkout_x"])) {
$_SESSION["myShippingAmount"] = "".$shippingAmount ."";
when i get to the confirm page no shipping is displayed.

i'm not sure if i understand the flow of the checkout pages correctly

if the checkout form submits to confirm.php then i am guessing the session variable will not be set as the code is not on that page,
If i put the all the code to set the shipping on confirm.php then the session variable wont be avaliable to work out and display the shipping cost. (as it will need a page refresh to pick up the session variable)

if you could give me a detailed workflow of what to put where i would appreciate it.

Sign in to reply to this post

Base5 Designs

hi Jason

I have been playing around some more and seeing what values were being echoed out

it seems that my calculation in ecart for total bottles is not being calculated correctly

i have the calulation named total bottles which is bottles * quantity

however this only seems to work on a per row basis how do i get the total amount of bottles for the whole cart???

Sign in to reply to this post

Base5 Designs

managed to get it working, not quite sure what i did to get it working, but its working !!! is all thats important for now!!!

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question





Ease of use


security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...