close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Charges calculation

Thread began 8/07/2012 6:02 am by Suggs | Last modified 8/08/2012 9:19 am by Suggs | 1856 views | 8 replies |

Suggs

Charges calculation

Hi folks,

Need a bit of help creating a charge for a certain product based on one of its column values in the recordset.

I have a table with a column called ChargeType.
I have created a column in the eCart Object Called ChargeType1

The information held in the column field for ChargeType in the database can either be "" (empty), INJ or DISP

If the product chosen has an empty field value for ChargeType then the normal price is to be passed through.

If the product chosen has a field value of DISP for ChargeType then I want it to add 3.89 to the existing price.

If the product chosen has a field value of INJ for ChargeType then I want it to add 7.00 to the existing price

Can you help?

Cheers

Paul

Sign in to reply to this post

Jason ByrnesWebAssist

Create a new calculation named truePrice as:

[Price] + (abs([ChargeType] == 'INJ')?3.89:0) + (abs([ChargeType] == 'DISP')?7:0)




you will also need to edit the Total Price calculation from:

[Price] * [Quantity]



to:

([Price] + (abs([ChargeType] == 'INJ')?3.89:0) + (abs([ChargeType] == 'DISP')?7:0)) * [Quantity]



In the cart display page, you will want to replace the Price Display to use the truePrice instead, you can do this using the bindings panel. and in the Checkout code, you will need to edit the checkout behavior to pass the true price instead price to the gateway.

Sign in to reply to this post

Suggs

Hi Jason,

Thanks for the reply.
The eCart object bombs out with the code added.. could it be to do with the ?'s added?

Also, the Price Display, is that the "TotalPrice"

Cheers

Paul

Sign in to reply to this post

Jason ByrnesWebAssist

Sorry, I missed that the column in the eCart object was named "ChargeType1". the calculations should be:

truePrice

[Price] + (abs([ChargeType1] == 'INJ')?3.89:0) + (abs([ChargeType1] == 'DISP')?7:0)



TotalPrice

([Price] + (abs([ChargeType1] == 'INJ')?3.89:0) + (abs([ChargeType1] == 'DISP')?7:0)) * [Quantity]





"Also, the Price Display, is that the "TotalPrice""

In the cart display, there will be a row to show the item price, and a row to show the total for that line item.

The item price in the cart display will need to use the truePrice binding.

Sign in to reply to this post

Suggs

Cheers for that, however it doesn't add the charges as expected.

The eCart add to cart script has the info coming in from the database recordset as below.

$ATC_itemChargeType1 = "".$row_rsInvoice['ChargeType'] ."";// column binding

It just adds the normal price for all products regardless of whether they are meeting the DISP or INJ criteria or not instead of the added charges for DISP and INJ and normal priced for products that don't meet these two.

And adding the truePrice binding only shows the original item price so lets say its $1, If i then change the quantity to 3 and update, it still shows as $1 but the grand total further down the basket shows the $3 it should be.. this is on an item where it should have added a $7 additional charge based on the ChargeType code

Any further ideas?

Sign in to reply to this post

Jason ByrnesWebAssist

to troubleshoot, create a blank page, and add a cart display to it. On the second page of the cart display manager wizard, click the plus button and select All to show all cart columns in the display.

Once the cart display page is created, send a link where i can see the problem and a copy of the cart object file in the WA_eCart folder.

Sign in to reply to this post

Suggs

Hi Jason,

Did what you said and replicated the page and copied the freshly generated cart code over the existing cart code and it worked a treat so it resolved the issue.

The thing I need it to do is just add a singe charge of $7 to an item that meets the criteria, or $3.89 that meets the alternative criteria no matter how many of that item is in the basket, so for instance the item that meets the criteria for a $7 premium costs 1$, then this would show as $8 ($1 cost + $7 charge) Now if there was 3 of that item it should show in the basket as $10 ($3 dollars for the 3 $1 items and a charge of $7)

Almost there now.

Can you help?

Thanks

Paul

Sign in to reply to this post

Jason ByrnesWebAssist

ok, I guess i misread your initial question.

to add the charge regardless of quantity, you wont need the calculations i had you create yesterday, the true price calculation can be deleted and the Total Price calculation can be set back to the original:
[Price] * [Quantity]

the single charge regardless of quantity can be accomplished using only the Charges tab of the eCart object window.

you will need to create 2 charges:
INJ

Triggers:
"Number of Items With A Specific Column Value"
If the Total Number of Items where "ChargeType1" has a value of "INJ" is ">" a value of "0"


Calculations:
Flat rate Charge of "3.89"


DISP

Triggers:
"Number of Items With A Specific Column Value"
If the Total Number of Items where "ChargeType1" has a value of "DISP" is ">" a value of "0"


Calculations:
Flat rate Charge of "7"

Sign in to reply to this post

Suggs

Awesome,

That's done the trick,

Thanks for all your help with this Jason,

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