Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New to the CF scene
    Join Date
    May 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Can Javascript add something to a shopping cart?

    I read the guidelines for posting. Did a search and did not find the answer to my problem. Any help would be most appreciated.

    Please look at this page:

    http://www.robinsonnews.com/TEST/classads.html

    It's a classified ad order form page. It uses Mal's E-com at the bottom of the page.
    A user clicks on the ad type of their choice (3 line, 4 line and so on) and the Mal's E-com page opens to show them what their cost is.

    HERE'S the problem.

    If you look about halfway down the page you will see the button to
    ADD SPECIAL ATTENTION GETTING CHARACTERS. This opens a small window that shows these characters. I need to have a value of "Fifty Cents" show up in the FINAL Mal's E-Com page but ONLY after the end user clicks the button at the bottom of the page. In other words..THIS portion of the purchase should NOT open the Mal's ecom page (the user should stay on the order form page)...but SHOULD show up in the total. Mal's will add a cumulative total so that's ok.
    I paid a developer to create the symbol picker script...and it works just fine, putting the number in the text box. But it does NOT currently add fifty cents to the total cost of the ad.

    HOW CAN THIS BE ACCOMPLISHED? PLEASE!!!! I am truly stuck here!!!

    Patrick Robinson
    bigpr@comcast.net

  • #2
    Banned
    Join Date
    May 2005
    Location
    Midwest, U.S.
    Posts
    118
    Thanks
    1
    Thanked 26 Times in 23 Posts
    Patrick:

    I know you have more code than would be reasonable to post. From your narrative, I'm not sure if EACH special character costs an additional fifty cents. I assumed not, because you didn't specifically state so.

    The code below, onsubmit, tests whether there is at least one special character in that textarea, and if so, it inserts .5 into a hidden form field.

    I don't know what happens next. But, I'll assume that all of your form data is sent to a summary page. To add the fifty cents, you'll need to convert it to a number, from a string by:

    extraFee = parseFloat(isForm.specCharFee.value);

    You can then add it to your total.

    [code]
    <HTML>
    <Head>
    <Script Language=JavaScript>

    function testAddlFee(isForm){

    isChar = isForm.specialChar.value;
    if (isChar != ""){isForm.specCharFee.value = ".5"}
    alert(isForm.specCharFee.value);
    }


    </Script>
    </Head>
    <Body>
    <Form name='orderForm' onsubmit="testAddlFee(this)">
    <textarea name='specialChar' rows=10 cols=15>#17</textarea>
    <br>
    <input type=hidden name='specCharFee'>
    <input type=submit value='Submit'>
    </Form>
    </Body>
    </HTML>
    [code]

  • #3
    New to the CF scene
    Join Date
    May 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Yes...EACH character adds Fifty Cents

    Thanks for your reply Mike...Most appreciated.

    What I don't really understand is this:

    How does the number...that fifty cents...get sent to the e-commerce shopping cart so that it adds to the total?

    If you go to the page, click on the "3 line ad" button it opens the E-com page
    and shows you the total. If you hit the browser "back" button and click on the same button again...it adds to the total. SO...what I'm hoping to have happen is for the end user to click on a special character and have that add Fifty cents to their total cost WITHOUT opening the e-com page until they choose
    a button at the bottom.

    Thanks again for any help you can provide.

  • #4
    Banned
    Join Date
    May 2005
    Location
    Midwest, U.S.
    Posts
    118
    Thanks
    1
    Thanked 26 Times in 23 Posts
    Patrick:

    I see now that your "summary" page is .cfm type. You are not going to be able to edit that to add the fifty cents. And to pay the authors of the code to make that modification... well, if were me, I'd be thrilled to sell ads, and I'd "eat" the fifty cents, or bump up the other rates by a nickel.

    JavaScript can't help you with this.

  • #5
    Regular Coder
    Join Date
    Feb 2005
    Posts
    679
    Thanks
    0
    Thanked 16 Times in 15 Posts
    The price can be submitted by adding the .50 to the hidden inputs in the various payment forms at the bottom of the page.
    It looks like the author of the popup window tried to do it , but there are errors in the conditionals and regular expressions that fail and the n_price variable in the function does not appear to have a value.

    But, just as the special characters numbers are added to the textarea, the math to add the .50 cents can also be done.

    The only requirement in all this is the browser must support and have Javascript turned on, which is assumed by the script.

    /Bob

  • #6
    New to the CF scene
    Join Date
    May 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    .CFM type pages...OK...I understand

    Thank you Mike....

    My knowledge of Javascript is terribly limited but I understand that this type of page cannot be edited. For future reference can you tell me what type CAN be edited or recommend a good shopping cart for use for the type of application the newspaper needs?

    Patrick

  • #7
    Banned
    Join Date
    May 2005
    Location
    Midwest, U.S.
    Posts
    118
    Thanks
    1
    Thanked 26 Times in 23 Posts
    Patrick:

    To my knowledge, if your host supports it, .php files can contain JavaScript, and of course, .htm and .html. You can check the details of your hosting account for the server-side languages it supports.

    Although, I haven't made any effort to learn it, others have told me that PHP is fairly easy to learn, easier than JavaScript.

    My host, godaddy.com has an add-on feature for $9.95 month to quickly and easily implement PayPal's shopping cart. No coding necessary. Of course, you could also spend time with PayPal's 100 page manual and attempt to implement the shopping cart on your own.

    Maybe you just need to find another host. Many hosts have add-on shopping carts. But, with PayPay, at least you know what you are getting. It's secure, and I've never heard any complaints about it.

    And, I'm sure you've seen it. PayPal has the "Buy Now" button. That's what I use on my site. If you don't want to deal with a shopping cart, you can have multiple "Buy Now" buttons. You CAN implement that on your own, without much difficulty.

    Anyway, good luck to you.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •