close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Changing price and adding a tax value to a hand coded cart / PayPal integration

Thread began 3/30/2023 11:10 am by Nathon Jones Web Design | Last modified 4/05/2023 12:18 pm by Ray Borduin | 173 views | 3 replies |

Nathon Jones Web Design

Changing price and adding a tax value to a hand coded cart / PayPal integration

Hi Ray. I hope you're doing ok man.

I've a quick question about the Sports Medical Certificates website (www.sportsmedicalcertificates.com) you'd assisted me with in the past. This website has quite a convoluted form but, essentially, passes a single value (65.00) to PayPal for the card processing bit.

The client is now VAT registered so this price needs to change to 62.50 and also add a 20% vat value (12.50). There was significant hand-coding on this, at the time, so I'm a bit terrified about changing anything universal so wanted to ask your advice on it.

I can open the eCart behaviour and I note that I could add the Tax value in there. That would be a start I guess.
Will that value automatically be passed to PayPal?

I've found the Add to Cart button and it has this line of code:

$ATC_itemPrice = floatval("65");// column binding



If I change this static value, I assume I won't need to change it anywhere else.
That, and adding the TAX value via the eCart server behaviour panel, and that should be it, right?

Would appreciate your advice and guidance. Thank you.
NJ

Sign in to reply to this post

Ray BorduinWebAssist

Yes I think you got it right. That should do the trick. I'll be around the next few days if you need help just message me in Skype and I'll screen share with you to figure it out.

Sign in to reply to this post
Did this help? Tips are appreciated...

Nathon Jones Web Design

It seems to have worked, but I have an additional question. At present, where the order is stored to database, I have the following INSERT behaviour:

<?php
if ($rsISFORMINORDERS->TotalRows == 0) {
if (isset($_POST["eCartSMC_1_ATC"]) || isset($_POST["eCartSMC_1_ATC_x"])) {
$InsertQuery = new WA_MySQLi_Query($csdbmysqli);
$InsertQuery->Action = "insert";
$InsertQuery->Table = "SMCorders";
$InsertQuery->bindColumn("SMCorderUSERID", "i", "".($rsEDITFORM->getColumnVal("SMCformUSERID"))."", "WA_DEFAULT");
$InsertQuery->bindColumn("SMCorderFORMID", "i", "".($rsEDITFORM->getColumnVal("SMCformID"))."", "WA_DEFAULT");
$InsertQuery->bindColumn("SMCorderTOTAL", "s", "75", "WA_DEFAULT");
$InsertQuery->bindColumn("SMCorderSTATUSID", "i", "5", "WA_DEFAULT");
$InsertQuery->bindColumn("SMCorderREFER", "s", "".((isset($_SESSION['SMCreferral']))?$_SESSION['SMCreferral']:"") ."", "WA_DEFAULT");
$InsertQuery->saveInSession("eCartSMC_OrderID");
$InsertQuery->execute();
$InsertGoTo = "";
if (function_exists("rel2abs")) $InsertGoTo = $InsertGoTo?rel2abs($InsertGoTo,dirname(__FILE__)):"";
$InsertQuery->redirect($InsertGoTo);
}
}
?>



As you can see, I'm statically adding the order total, "75", in this behaviour. What I'd prefer to do is add two new columns to the orders table, SubTotal and Tax, and update the INSERT behaviour to the following:

<?php
if ($rsISFORMINORDERS->TotalRows == 0) {
if (isset($_POST["eCartSMC_1_ATC"]) || isset($_POST["eCartSMC_1_ATC_x"])) {
$InsertQuery = new WA_MySQLi_Query($csdbmysqli);
$InsertQuery->Action = "insert";
$InsertQuery->Table = "SMCorders";
$InsertQuery->bindColumn("SMCorderUSERID", "i", "".($rsEDITFORM->getColumnVal("SMCformUSERID"))."", "WA_DEFAULT");
$InsertQuery->bindColumn("SMCorderFORMID", "i", "".($rsEDITFORM->getColumnVal("SMCformID"))."", "WA_DEFAULT");
$InsertQuery->bindColumn("SMCorderSUBTOTAL", "s", "<eCART Subtotal Value Here>", "WA_DEFAULT");
$InsertQuery->bindColumn("SMCorderTAX", "s", "<eCART Tax Value Here>", "WA_DEFAULT");
$InsertQuery->bindColumn("SMCorderTOTAL", "s", "<eCART GrandTotal Value Here>", "WA_DEFAULT");
$InsertQuery->bindColumn("SMCorderSTATUSID", "i", "5", "WA_DEFAULT");
$InsertQuery->bindColumn("SMCorderREFER", "s", "".((isset($_SESSION['SMCreferral']))?$_SESSION['SMCreferral']:"") ."", "WA_DEFAULT");
$InsertQuery->saveInSession("eCartSMC_OrderID");
$InsertQuery->execute();
$InsertGoTo = "";
if (function_exists("rel2abs")) $InsertGoTo = $InsertGoTo?rel2abs($InsertGoTo,dirname(__FILE__)):"";
$InsertQuery->redirect($InsertGoTo);
}
}
?>



I'm a bit cautious about using the behaviour panel to make this change because of all the hand-coded stuff on this site. How do I add the following into the above INSERT behaviour:

SubTotal

<?php echo WA_eCart_DisplayMoney($eCartSMC, $eCartSMC->TotalColumn("TotalPrice")); ?>



Tax

<?php echo WA_eCart_DisplayMoney($eCartSMC, $eCartSMC->GetTax()); ?>



SubTotal

<?php echo WA_eCart_DisplayMoney($eCartSMC, $eCartSMC->GrandTotal()); ?>



Thank you.
NJ

Sign in to reply to this post

Ray BorduinWebAssist

php:
$InsertQuery->bindColumn("SMCorderSUBTOTAL", "s", "". ($eCartSMC->TotalColumn("TotalPrice")) ."", "WA_DEFAULT");

  $InsertQuery->bindColumn("SMCorderTAX", "s", "". ($eCartSMC->GetTax()) ."", "WA_DEFAULT");
  $InsertQuery->bindColumn("SMCorderTOTAL", "s", "". ($eCartSMC->GrandTotal()) ."", "WA_DEFAULT");
Sign in to reply to this post
Did this help? Tips are appreciated...

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