close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Shipping costs not working out as they should

Thread began 3/15/2012 2:52 pm by Christopher West | Last modified 4/02/2012 12:43 pm by Jason Byrnes | 2492 views | 13 replies |

Christopher WestCommunity Expert

Shipping costs not working out as they should

Hi (again)

Well I have product(A) and product(B)
Product(A) needs a delivery charge of £7
Product(B) needs a delivery charge of 99pence
However if Product(B) is purchased at the same time as Product(A) then I need to subject the shipping cost of 99pence from the order.

I have tried so many different variations and I just cannot get it to play nicely. Whats happening is the calculations seem to be backwards.

current my first shipping rule is from an example on this forum as I needed the functionality:
pickup -> IF Session variable pickup !=1 AND Based on session variable value IF the value of the Session variable pickup is != a value of 1 FLAT RATE of £7

(the above works)

But I need to include the Flat rate of 0.99 if the product is a certain type (ie vouchers that the website sells only charges 0.99 for shipping) I have used the column WEIGHT in my database as I dont require it for this online store so figured to use it to store either a 1 or a 0 to determine if the shipping costs should be excluded. (I set 1 for selling vouchers) so I can use this value in my shipping calculations. but I just cannot seem to get it working correctly.

any ideas from what i described? What sore of shipping rules should I be using?

Sign in to reply to this post

Jason ByrnesWebAssist

just to make sure I have it correctly, you need to have 2 different shipping rules for 2 different product types:


product type A = £7 per product Type A item

product type B = £0.99 per product type B item


meaning that if you had 5 items in the cart, 2 where item type A and 3 where item type B, the total shipping should be:
7 + 7 + 0.99 + 0.99 + 0.99 = 16.97

If that is the case:

create a new column in the cart object named "itemType"

in the add to cart button behavior, set the itemType column to A or B depending on the item.

create a shipping rule for item Type A as:
Triggers:
"Number of items with a specific column value"
if the number items where "itemType" has a value of "A" is ">" a value of "0"

Calculation:
"Based on items with a specific value"
Total of "Quantity" where "itemType" has a value of "A" "times" "7"


the shipping rule for item type B will be similar:

Triggers:
"Number of items with a specific column value"
if the number items where "itemType" has a value of "B" is ">" a value of "0"

Calculation:
"Based on items with a specific value"
Total of "Quantity" where "itemType" has a value of "B" "times" "0.99"

Sign in to reply to this post

Christopher WestCommunity Expert

Hi Jason, no the shipping would NOT be £16.97 (it should be £7) the ideas if if a customer orders a product type B on it's own or many product type Bs then shipping is 99p HOWEVER if the customer has any product type As in the same order then the shipping cost of 99p is NOT included (only the shipping cost of £7 is including) its only included once NOT by the amount of products on order. Does that make sense now :)

Sign in to reply to this post

Jason ByrnesWebAssist

ok, well, that was less than clear in the initial post.

still need the product type column set to A or B depending on the product.

the product A rule will be set as:
Triggers:
"Number of items with a specific column value"
if the number items where "itemType" has a value of "A" is ">" a value of "0"

Calculation:
Falt Rate of "7"

the product B rule will be set as:
Triggers:
"Number of items with a specific column value"
if the number items where "itemType" has a value of "B" is ">" a value of "0"

AND
"Number of items with a specific column value"
if the number items where "itemType" has a value of "A" is "<" a value of "1"

Calculation:
Falt Rate of "0.99"

Sign in to reply to this post

Christopher WestCommunity Expert

ok one question before I try all that.

currently I have one shipping rule active (which is needed - its to test if a customer ticks a box to collect instore rather then have it delivered)

that rule is:
Rule name: pickup
Trigger: IF Session variable pickup != 1
AND Based on session variable value
If the value of the session variable pickup is != a value of 1
Calculation: Flat rate 7

Now with the above rule (thats needed) how can I integrate your previous method?

Sign in to reply to this post

Jason ByrnesWebAssist

Rule name: pickup
Trigger: IF Session variable pickup != 1
AND Based on session variable value
If the value of the session variable pickup is != a value of 1
AND
"Number of items with a specific column value"
if the number items where "itemType" has a value of "A" is ">" a value of "0"
Calculation: Flat rate 7

Sign in to reply to this post

Christopher WestCommunity Expert

Late reply...but you are a star! as it now all works perfectly :) I am wondering though in the ecart object rather then putting 7 in the "Create a flat shipping of $" input box - Can i simple put in a <? php .... ?> which then passing through a reference to a field in my database...this way the Admin of the website can change shipping costs at any time.

would I then just add a new line to this code:

for example, would I add:

$ATC_itemShip = floatval("".$row_itemDetail['ShipCost'] ."");// column binding

---------------------------------------------------------------------------------

// WA eCart AddToCart
if (isset($_POST["DinkyCart_1_ATC"]) || isset($_POST["DinkyCart_1_ATC_x"])) {
$ATC_itemID = $_POST["DinkyCart_1_ID_Add"];
$ATC_AddIfIn = 0;
$ATC_RedirectAfter = "cart.php";
$ATC_RedirectIfIn = "";
if (isset($totalRows_ItemDetail) && $totalRows_ItemDetail > 0) {
$row_ItemDetail = WAEC_findRecordMySQL($ItemDetail, "ProductID", $ATC_itemID);
if ($row_ItemDetail) {
$ATC_itemName = "".$row_ItemDetail['ProductName'] ."";// column binding
$ATC_itemDescription = "".$row_ItemDetail['ProductCartDesc'] ."";// column binding
$ATC_itemThumbnail = "".$row_ItemDetail['ProductThumb'] ."";// column binding
$ATC_itemWeight = floatval("".$row_ItemDetail['ProductWeight'] ."");// column binding
$ATC_itemQuantity = floatval("1");// column binding
$ATC_itemPrice = floatval("".$row_ItemDetail['ProductPrice'] ."");// column binding
$ATC_itemOptions = "".$optionText. "";// column binding
$ATC_itemOptionsPrice = floatval("".$addPrice ."");// column binding
mysql_data_seek($ItemDetail, 0);
$row_ItemDetail = mysql_fetch_assoc($ItemDetail);
}

Sign in to reply to this post

Jason ByrnesWebAssist

yes, this can be done, but not the way you are describing unless the shipping cost cost where to change from item to item, but then you wouldn't be using a flat rate anyway.

create a new table for siteSettings:

settingID - primary key
settingName - varchar
settingValue - varchar

in the database, create a record and set settingName to typeAShipRate and set the settingValue column to 7

then create a recordset to lookup the typeAShipRate

SELECT * FROM siteSettings WHERE settingName = 'typeAShipRate'


the use the set session value behavior to store the ship rate in a session variable. On the server behaviors panel, click the plus button and select eCart -> General -> Set Session Value


set the trigger to settings recordset not empty. set the name to typeAShipRate and for the value click the lightning bolt and select the settingValue column from the recordset.


the in the rule set the calculation to;
Calculation: Flat rate '$_SESSION['typeAShipRate']'

Sign in to reply to this post

Christopher WestCommunity Expert

Thats very useful to know for future...with my current project though, certain products will have different shipping costs - currently I have 2 shipping costs in use. So im guessing the method you mentioned wouldnt work for that - if i am planning on using shipping cost as a item per item then why wouldnt it be a fixed shipping cost value?

Sign in to reply to this post

Jason ByrnesWebAssist

"So im guessing the method you mentioned wouldnt work for that"

you could crate another record in the settings table for the second items shipping. Add another recordset to retrieve it, and add another set session value behavior


"if i am planning on using shipping cost as a item per item then why wouldnt it be a fixed shipping cost value"

because a flat rate wouldn't take into account the items in the cart and the shipping amount to apply to them, it's just that: a flat rat. regardless of what is in the cart it is the same rate.


for per item shipping, you would store the shipping rate in a cart column, then you could do a multiple of column subtotal calculation to use the subtotal of the shipping rate column.

Sign in to reply to this post
loading

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