close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

tax based on either or session

Thread began 4/01/2013 7:51 pm by bryan107833 | Last modified 4/03/2013 12:44 pm by Jason Byrnes | 462 views | 4 replies |

bryan107833

tax based on either or session

Can someone please help me with this code. I am close but...

This code works:
//eCart Rule
function WAEC_cali_cart_PaotherSalesTax() {
$totalTax = 0;
if (true && (((isset($_SESSION['PayPal_ExpressCheckout_ship_countypp2'])?$_SESSION['PayPal_ExpressCheckout_ship_countypp2']:"") == "PAOTHER")) && ((isset($_SESSION['eCartCheckoutForm_shipping_state_province'])?$_SESSION['eCartCheckoutForm_shipping_state_province']:"") == "PA"))
{
$totalTax += ($this->GetTaxableTotal() * 0.06);//Result


This creates tax based on two session variables needing to be satisfied but I want to add an either / or session variable as well like below (but it does not work):

//eCart Rule
function WAEC_cali_cart_PaphiladelphiaSalesTax() {
$totalTax = 0;
if (true && (((isset($_SESSION['eCartCheckoutForm_ship_countypa'])?$_SESSION['eCartCheckoutForm_ship_countypa']:"") == "PAOTHER")) || (((isset($_SESSION['PayPal_ExpressCheckout_ship_countypp2'])?$_SESSION['eCartCheckoutForm_ship_countypp2']:"") == "PAOTHER")) && ((isset($_SESSION['eCartCheckoutForm_shipping_state_province'])?$_SESSION['eCartCheckoutForm_shipping_state_province']:"") == "PA")) {
$totalTax += ($this->GetTaxableTotal() * 0.06);//Result
}
return WA_eCart_FormatNumber($totalTax, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule

Thank you in advance.

Sign in to reply to this post

Jason ByrnesWebAssist

please provide more details.

Please explain how you would like the condition for the tax to work. a faulty code example does not give me enough to go on.

Sign in to reply to this post

bryan107833

I am trying to create a work around to deal with the fact that PayPal does not have a system to calculate sales tax based on county. So, I have added two dropdown boxes (one for New York & one for Pennsylvania) above the PayPal Express Checkout button so that a session variable for their county can be set prior to going to PayPal. This being said, if the customer use our local checkout then I also need to set a county session variable set for tax calculation. Based on other parts of this (validation / two state..) it was easier to have two different county variable for each state - 1 for paypal & 1 for local. So what I am trying to accomplish is a tax calculation based on if either of the county 2 county variable exist in addition to the shipping_state_province.

i.e. -

if either eCartCheckoutForm_ship_countypa = PAOTHER
or
eCartCheckoutForm_ship_countypp2 = PAOTHER
&
eCartCheckoutForm_shipping_state_province = PA
then add tax.

Hope this helps. Thanks.

Sign in to reply to this post

bryan107833

I think I have found a work around. As I have set the assignment of the subject variable "eCartCheckoutForm_ship_county" on the confirm page and "PayPal_ExpressCheckout_ship_countypp" on the pp_confirm page the following code seems to be working. My concern was potentially having the tax charged twice if eCart (the page) found both session variables matching. If you have another suggestion I would, of course, be glad to hear it otherwise I will try using the below.

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

//eCart Rule
function WAEC_cali_cart_NyonondagaSalesTax() {
$totalTax = 0;
if (true && (((isset($_SESSION['PayPal_ExpressCheckout_ship_countypp'])?$_SESSION['PayPal_ExpressCheckout_ship_countypp']:"") == "NYONONDAGA")) && ((isset($_SESSION['eCartCheckoutForm_shipping_state_province'])?$_SESSION['eCartCheckoutForm_shipping_state_province']:"") == "NY") || (((isset($_SESSION['eCartCheckoutForm_ship_county'])?$_SESSION['eCartCheckoutForm_ship_county']:"") == "NYONONDAGA")) && ((isset($_SESSION['eCartCheckoutForm_shipping_state_province'])?$_SESSION['eCartCheckoutForm_shipping_state_province']:"") == "NY")) {
$totalTax += ($this->GetTaxableTotal() * 0.08);//Result
}
return WA_eCart_FormatNumber($totalTax, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule

Sign in to reply to this post

Jason ByrnesWebAssist

OK, that looks like it should work.

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