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

rating

Adding other charge from database field

Thread began 5/16/2011 11:12 pm by info271221 | Last modified 2/21/2012 1:21 pm by Jason Byrnes | 1444 views | 7 replies |

info271221

Adding other charge from database field

I want to add a charge to the order, but not a flat fee or calculated fee, just add an amount from the database which the client enters. I also want to add 10% to the order as a variable to allow the admin the ability to charge as much as 10% over the order on the credit card.

Sign in to reply to this post

Jason ByrnesWebAssist

you would need to create a database table to contain each of these charges.

the table should contain only one record with a column for each charge set one column to hold the amount of the flat rate, set the other column to hold the percentage amount as a decimal, i.e. "0.10" for %10.

on the cart page, create a recordset to return the record from this table.

Go to the Server behaviors panel and click the plus button. select eCart -> General -> Set Session Value. set the trigger to "If session Variable is not defined", give the session a unique name like "FlatRate", click the lightning bolt next to value and select the flat rate column from the recordset.

Repeat this step for the percentage column to store the database values in the session variables.

In the eCart object, you can create the charges t use the session variables.

use the triggers:
Session Variable Exists:
Session Variable name "FlatRate"

And
Total number of unique items > 0

for the calculation use flat rate and enter:
$_SESSION['FlatRate']


for the percentage rule, use based on the cart subtotal:
subtotal "Times" "$_SESSION['percentage']

make sure to use the same names for the session variables as you use when setting them in the set session value behavior.

Sign in to reply to this post

info271221

Adding flat rate from column in database

The customer decided he did not need the 10%, so we just need the flat rate from the column in the database to work. I am getting this error on the confirm page.
Notice: Undefined variable: itmObj in /services9/webpages/h/o/homesteadnaturalmeats.com/secure/WA_eCart/WA_eCart_Definition_PHP.php(477) : eval()'d code on line 1

Notice: Trying to get property of non-object in /services9/webpages/h/o/homesteadnaturalmeats.com/secure/WA_eCart/WA_eCart_Definition_PHP.php(477) : eval()'d code on line 1

Notice: Undefined variable: itmObj in /services9/webpages/h/o/homesteadnaturalmeats.com/secure/WA_eCart/WA_eCart_Definition_PHP.php(477) : eval()'d code on line 1

Notice: Trying to get property of non-object in /services9/webpages/h/o/homesteadnaturalmeats.com/secure/WA_eCart/WA_eCart_Definition_PHP.php(477) : eval()'d code on line 1

Warning: Cannot modify header information - headers already sent by (output started at /services9/webpages/h/o/homesteadnaturalmeats.com/secure/WA_eCart/WA_eCart_Definition_PHP.php(477) : eval()'d code:1) in /services9/webpages/h/o/homesteadnaturalmeats.com/secure/confirm.php on line 472

Sign in to reply to this post

Jason ByrnesWebAssist

in the eCart object, the Full Details calcualtion is wrong:

[Quantity] . ' ' . [Name] . '[SKU] (' . [ID] . ')'



should be:

[Quantity] . ' ' . [Name] . ' ' . [SKU] . ' (' . [ID] . ')'
Sign in to reply to this post

afeliksas433126

How to add a variable option to cart total?

I'm trying to add an option "Pay by Instalment" on the cart Page.
As I'll be invoicing customers manually from PayPal, all I need is:

Give an option to customer to pay instalments increasing total amount in the cart.
If customer chooses to pay by instalments (clicks on check box), certain percentage (e.g 10%) is added to the bottom cart total amount.
This amount needs to be recorded on Order Summary table and Order Detail table.

Can you suggest how can I do this?

Sign in to reply to this post

Jason ByrnesWebAssist

add the checkbox to the checkout page named installments and set the checked value to 1:
[php]<input name="installments" type="checkbox" id="installments" value="1" />[php]

on the confirm page, there is a collection of hidden form elements near the bottom, add a new one with the same name as the checkbox and set to capture the value posted from the checkout page:

php:
<input name="installments" type="hidden" id="installments" value="<?php echo((isset($_POST["installments"]))?$_POST["installments"]:""?>" />




open the server behaviors panel on the confirm page and click the plus button, select eCart -> General -> Set Session Value

for the trigger and the value click the lightning bolt icon and select the installments form element, set the name to "installments"

in the eCart object, create a new charge.

Name:
Installment charge

Triggers:
"Bassed on Session Variable Value"
If the session variable "installments" has a value of "1"

Calculation:
"Based on cart subtotal"
cart Subtotal "times" "0.1"

Sign in to reply to this post

afeliksas433126

Thank you Jason

That's exactly what I wanted. Works well.

Sign in to reply to this post

Jason ByrnesWebAssist

glad to hear it is working.

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