close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

ecart Object setup for delivery cost based on cart weight

Thread began 10/21/2014 11:32 am by Christopher West | Last modified 10/21/2014 1:22 pm by Jason Byrnes | 1768 views | 7 replies |

Christopher WestCommunity Expert

ecart Object setup for delivery cost based on cart weight

HI Jason, I spoke to Ray and he told me this could be something that could be helped with on the forum since its not really using custom code, but just configuring of the eCart Object.

What I would like to do is configure the eCart Object so that it can calculate the shopping basket delivery cost based on the weight total of the basket. Its in early stages of coding, as I wanted to configure it at the same time after I have run the Checkout Wizard to generate the pages. So wanted to get a head start on knowing how to configure the eCart Object (note: it be great at somepoint if there is a masterclass on the eCart Object and some of the things that can be done inside it, I certainly pay for that).

My client has a shop selling furniture so could range from bulky tables and chairs to less bulky items such as lamps. So they may delivery themsleves in their own van or use a courier. (I assume a courier if this shipping address so to far away for them to delivery in their own van).

I am storing the shipping costs related to weight in 3 seperate database tables:
ShippingCosts
ShippingLocation
ShippingOptions

Im using this structure so that I can usein future projects where the client can chose different delivery methods (but For now they cust want to delivery in the UK (which is stored in ShippingLocation and I assume they just want 1 delivery method (which is stored in ShippingOptions.

So for example

ShippingLocation has the following fields and data: (1 record)
ShippingLocationID = 1
ShippingLocationCountry = United Kingdom
ShippingCode = GB
ShippingLocationZones = World Zone 1

ShippingOptions has the following fields and data: (1 record)
ShippingOptionsID = 1
ShippingOptionsType Standard Delivery

and ShippingCosts has the following fields and data: (this is an example of 1 record so there will be many records with different WeightsTo And different CostsValue)
ShippingCostsID = 1
ShippingCostsType = Standard Delivery
ShippingCostZone = World Zone 1
ShippingCostsWeightTo = 500 (ths would be in Kg)
ShippingCostsValue = 10 (ths would be in British Pounds)

The ShippingCosts table is what I need to use in the eCart Object to calculate the total basket weight to then assign the value stored in ShippingCostsValue to the basket.

NOTE: I wanted to show the tables for ShippingLocation and ShippingOptions as the data in these tables will be used to created new records in ShippingCosts so that I have a level of flexability in creating future ShippingCosts that the client may want to add (such as next day delivery, 2 day delivery and even different countries). But for now they just want to delivery in the UK and assume they just one 1 delivery option (a delivery of a few days since its bulty furniture).

So please could you give me a run through on how to configure the eCart object to calculate shipping cost based on total basket weight please?

Chris

Sign in to reply to this post

Jason ByrnesWebAssist

You would need to have a cart column for the weight (by default, a Weight column is created), and in the add to cart button, set the weight for each item

then you would need to create a recordset that filters the tables based on the shipping country selected on the checkout page, (Shipping county should be stored in a session, so use that in the recordset) and the total weight.

you can return the total weight using
$eCart->TotalColumn("TotalWeight")


Save the value returned by the recordset into a session variable.

and use that session in the shipping calculation.

Sign in to reply to this post

Christopher WestCommunity Expert

ok that part I understand, but in the eCart Object how would I create the calculation (I do remember a while back when I tried to put calculations in the Shipping tab I had issues.


at the moment eCart Wizard has generated the following in the shipping tab (should i ammend these or create a new rule)
Shipping & Handling
Shipping & Handling per item

also in the Columns tab I see Weight is defined. (I assume I dont need to change anything in this tab)
Name = Weight ; Type = Weight (and Unique checkbox is unseleted)

In the calculations tab the default is: (I assume I dont need to add anything in this tab)
TotalWeight = [Weight] * [Quantity] Weight
TotalPrice = [Price] * [Quantity] Currency
FullDetails = [Quantity] . '' . [Name] . '( [ID] . ')'

So I just need direction on how to configure the calculation in the Shipping tab of the eCart object.

Chris

Sign in to reply to this post

Jason ByrnesWebAssist

It up to you if you want to keep the existing shipping rules or not. if the existing rules fit your needs keep them, they won't be configured for what you are asking about

you would save the weight from the recordset as a session.

then create a rule that uses the session variable in the trigger and calculation

Sign in to reply to this post

Christopher WestCommunity Expert

I see, I guess since the calcuation is setup in the eCart object as soon as the customer is on the checkout page, and selected country (well for this website the default is United Kingdom as currently will not be able to change countries as the client doesnt want that for the time being) It will also display the delivery cost upon entering the Checkout page as the calcualtion is in the eCart object (or would the session thats required for the calculation only be set once the form has been submitted on the checkout page (unless of course I use AJAX so it creates the session). Or can the session be set on initial page load since the only current selection will be United Kingdom so the page would already know (thinking out loud) Chris

Sign in to reply to this post

Jason ByrnesWebAssist

If the only country will be UK< then the recordset used to filter out the shipping cost wouldn't need to filter by the selected country and filter using only the total weight, so in that case, the session could be set and calculated on the cart page itself.

Sign in to reply to this post

Christopher WestCommunity Expert

That makes things easier. OK looking at the available options for the calculation (I attaching a screenshot) Which would I pick and what what I put in the field box. (Sorry for being confused).

Chris

Sign in to reply to this post

Jason ByrnesWebAssist

for the tiger use session variable exists and enter the name of the session

if the session contains the amount you wish to charge, use Flat rate and enter:

$_SESSION['sessionName']

where sessionName is the name of the session.

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

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