Custom Shopping Cart Field Verification Help

This is an archive of old posting to the User Forum

Custom Shopping Cart Field Verification Help

Postby Chris » Tue Jul 01, 2003 7:36 am

Hi,

(Trying to do something tricky here, so bear with me...)

We require that all our International customers agree to assume
responsibility for any duties and taxes imposed on their order by their
local governments. Currently, this requires back and forth e-mails, a
long delay, and a lot of unanswered orders.

I'd like to use the Custom Shopping Cart field in Shopsite 6.3 Pro to
have a check box for consenting to this before they can submit the
order. I read the documentation and think I can get through that part
OK.

However, I'd LIKE to have this box required to be checked only if they
choose a country OUTSIDE the USA and Canada. So, I wrote a Javascript
verifier function as below:

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

<SCRIPT LANGUAGE="Javascript" TYPE="text/javascript">
<!--hide script from older browser

function submitIt(Order)

{if (Order.country.options.value != "US", "CA", "UV") &&
(Order.duties.options.value="")

{alert("International Customers must agree to assume responsibility for
any duties, taxes, or fees imposed by their national and local
governments. Please check the box to continue.") }

else return true }
//end hiding script-->

</SCRIPT>
------------------------------------------------------------------------------------------------------------

Problem 1, it seems, is that I need to put the command <FORM
onSubmit="return submitIt(this)"> into the form field within the cart
page and I don't have access to this part of the html.

Also, how do I put the verifier script from above inside the <HEAD> tags
for the cart page?

Is there any other way I can run this check without needing access to
the FORM SUBMIT html string?

THanks for the help.

Chris

MLCS
Chris
 

Re: Custom Shopping Cart Field Verification Help

Postby Chris » Tue Jul 01, 2003 9:38 am

Oops.

I realized the custom cart fields come up on the billing address page, not the first cart page as I'd thought
before.

So, the country field is already set by this point. Luckily, we have foreign customers choose a state from the
drop-down menu as "(Outside US & Canada)". I altered the script to check on this point:
----------------------------------------------------------------------
<SCRIPT LANGUAGE="Javascript" TYPE="text/javascript">
<!--hide script from older browser

function submitIt(Order)

{if (document.billing.State.value == "(Outside US & Canada)") && (document.billing.field01.value=" ")

{alert("International Customers must agree to assume responsibility for any duties, taxes, or fees imposed by
their national and local governments. Please check the box to continue.") }

else return true }
//end hiding script-->

</SCRIPT>
---------------------------------------------------------------------

Of course, I still have the problem of where/how to call the function.

Chris

MLCS

Chris wrote:

Hi,

(Trying to do something tricky here, so bear with me...)

We require that all our International customers agree to assume
responsibility for any duties and taxes imposed on their order by their
local governments. Currently, this requires back and forth e-mails, a
long delay, and a lot of unanswered orders.

I'd like to use the Custom Shopping Cart field in Shopsite 6.3 Pro to
have a check box for consenting to this before they can submit the
order. I read the documentation and think I can get through that part
OK.

However, I'd LIKE to have this box required to be checked only if they
choose a country OUTSIDE the USA and Canada. So, I wrote a Javascript
verifier function as below:

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

SCRIPT LANGUAGE="Javascript" TYPE="text/javascript"
!--hide script from older browser

function submitIt(Order)

{if (Order.country.options.value != "US", "CA", "UV") &&
(Order.duties.options.value="")

{alert("International Customers must agree to assume responsibility for
any duties, taxes, or fees imposed by their national and local
governments. Please check the box to continue.") }

else return true }
//end hiding script--

/SCRIPT
------------------------------------------------------------------------------------------------------------

Problem 1, it seems, is that I need to put the command <FORM
onSubmit="return submitIt(this)"> into the form field within the cart
page and I don't have access to this part of the html.

Also, how do I put the verifier script from above inside the <HEAD> tags
for the cart page?

Is there any other way I can run this check without needing access to
the FORM SUBMIT html string?

THanks for the help.

Chris

MLCS
Chris
 

Re: Custom Shopping Cart Field Verification Help

Postby loren_d_c » Tue Jul 01, 2003 9:46 am

If you need to put your JavaScript function in the HEAD section, then this cannot currently be done.

I don't think you need the onSubmit in the FORM tag (and there is no way that I know of to get it in there
anyway). If you view the source of the shopping cart screen, you will see that ShopSite uses a JavaScript
function to check several fields, and it is not called in the FORM tag, rather there is a onClick call to that
function in each of the submit button tags. I am not sure if you can have mroe than one onClick per submit
button, but if you can, and you can define the function outside of the head section, then you can create your own
submit buttons by copying the HTML from the source for the current submit buttons, modify it in notepad or
something to be all on one line, add your onClick function, then add this HTML to one of the text fields in
Preferences -> Store Text -> Shopping Cart, perhaps at the beginning or end of the 'Any changes above should be
verified by pressing 'Recalculate' before clicking on 'Checkout'.' text (see related Knowledgebase solution
S02618).

Note: The ShopSite Pro feature 'Custom Checkout Fields' are on the checkout screen, not the shopping cart screen,
so not sure if you can work in conjunction with these.

So, maybe it can work, maybe it can't. The only way to know would be to try it.

-Loren



Chris wrote:

Hi,

(Trying to do something tricky here, so bear with me...)

We require that all our International customers agree to assume
responsibility for any duties and taxes imposed on their order by their
local governments. Currently, this requires back and forth e-mails, a
long delay, and a lot of unanswered orders.

I'd like to use the Custom Shopping Cart field in Shopsite 6.3 Pro to
have a check box for consenting to this before they can submit the
order. I read the documentation and think I can get through that part
OK.

However, I'd LIKE to have this box required to be checked only if they
choose a country OUTSIDE the USA and Canada. So, I wrote a Javascript
verifier function as below:

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

SCRIPT LANGUAGE="Javascript" TYPE="text/javascript"
!--hide script from older browser

function submitIt(Order)

{if (Order.country.options.value != "US", "CA", "UV") &&
(Order.duties.options.value="")

{alert("International Customers must agree to assume responsibility for
any duties, taxes, or fees imposed by their national and local
governments. Please check the box to continue.") }

else return true }
//end hiding script--

/SCRIPT
------------------------------------------------------------------------------------------------------------

Problem 1, it seems, is that I need to put the command <FORM
onSubmit="return submitIt(this)"> into the form field within the cart
page and I don't have access to this part of the html.

Also, how do I put the verifier script from above inside the <HEAD> tags
for the cart page?

Is there any other way I can run this check without needing access to
the FORM SUBMIT html string?

THanks for the help.

Chris

MLCS
loren_d_c
 
Posts: 2571
Joined: Fri Aug 04, 2006 12:02 pm
Location: Anywhere


Return to User Forum Archive

Who is online

Users browsing this forum: No registered users and 9 guests