close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

excluding certain products from delivery calculation

Thread began 9/06/2016 4:44 pm by Christopher West | Last modified 9/13/2016 6:55 pm by Christopher West | 1397 views | 13 replies

Christopher WestCommunity Expert

Hi Ray, it seems I have it working (I may have mande it sound complicated but it was simply to setup after some thought). But I am just a little confused why it works because of the way I used >= in my recordset doesnt seem right to me (even though it works). I just want to learn from this?

I am also including what I have in the eCart Object.
COLUMNS
ProductFreeDelivery (Number)
ProductCollectionOnly (Number)

CALCULATIONS
TotalWeight = [Weight] * [Quantity] * [ProductCollectionOnly] * [ProductFreeDelivery]
TotalSize = ([Width] * [Height] * [Depth]) * [Quantity] * [ProductCollectionOnly] * [ProductFreeDelivery]

SHIPPING RULE
EstimatedDelivery
If Session variable exists: EstimatedDeliveryCost
AND SubTotal of ProductFreeDelivery == 1
AND SubTotal of ProductCollection == 1
Create a flat rate shipping of <?php echo $_SESSION['EstimatedDeliveryCost']; ?>

NOTE: In my database for ProductFreeDelivery and ProductCollectionOnly a value of 1 means to include that product in my calculations and a value of 0 means don't add it.
I am getting the correct results. it just confuses me to why because of the recordset below suggests IF the database value is more than the session stored value. (I assumed it be be the other way round <=)

php:
<?php

$rsShippingZone 
= new WA_MySQLi_RS("rsShippingZone",$ecartdb,1);
$rsShippingZone->setQuery("SELECT * FROM shippingzones WHERE ShippingZoneCode = ?");
$rsShippingZone->bindParam("s""".(isset($_SESSION['ZonePostCode'])?$_SESSION['ZonePostCode']:"")  ."""-1"); //colname
$rsShippingZone->execute();
?>
<?php
$rsDeliveryCost 
= new WA_MySQLi_RS("rsDeliveryCost",$ecartdb,1);
$rsDeliveryCost->setQuery("SELECT * FROM shippingcosts WHERE ShippingCostZone = ? AND ShippingCostWeightTo >= ? AND ShippingCostSize >= ? ORDER BY ShippingCostValue ASC");
$rsDeliveryCost->bindParam("s""".$rsShippingZone->getColumnVal("ShippingZone")  ."""-1"); //colname
$rsDeliveryCost->bindParam("s""".$eCart->TotalColumn("TotalWeight")  ."""-1"); //colname2
$rsDeliveryCost->bindParam("s""".$eCart->TotalColumn("TotalSize")  ."""-1"); //colname3
$rsDeliveryCost->execute();?>
<?php
@session_start();
if(
"" == "")     {
    
    if (
"".(WA_getSavedFormValue("checkoutform","deliverymethod"))  ."" != "Shop Collection") {  // WebAssist Show If
    
$_SESSION["EstimatedDeliveryCost"] = "".($rsDeliveryCost->getColumnVal("ShippingCostValue"))  ."";
    
    } 
    else {
    
$_SESSION["EstimatedDeliveryCost"] = 0;        
    } 
    
}
?>

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

Content

rating

Layout

rating

Ease of use

rating

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...