Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2008
    Posts
    37
    Plugin Contributions
    0

    Default Implementing Javascript?

    Alrighty. So basically I've been trying to implement dynamic attribute pricing into my website for a while now. If you don't know what I mean by "dynamic attribute pricing" (I basically just made up the phrase) here's a rundown of what I mean:

    You have three radio button attributes. Attribute A is +$5, Attribute B is +$7 and Attribute C is +$10. When you click Attribute A $5 is added to the price, but Attribute B still says +$7, even though its not $7 greater than the new price. Dynamic attribute pricing would change the Attribute B to +$2 and Attribute C to +$3 (and if you selected Attribute B, Attribute A would change to -$2 etc etc.)


    I understand that javascript is necessary in doing this. And I have the javascript necessary. I just don't know how to impliment it into the website.

    Is there anyone out there who can help me at all? I've been looking to put this into my website for a while now, and feel that it is pretty crucial to my website functioning.



    The Coding
    Here's what I've figured will work:

    First, need to set the base attribute price in a javascript file:

    Code:
    var basePrice = 10;
    
    function makePrice(val){
    productPrice = basePrice + val;
    }

    Second, need to set the attributes to change based upon the baseprice

    Code:
    <input type="radio" name=".." value=".." onclick="makePrice(10);">

  2. #2
    Join Date
    Mar 2008
    Location
    Cape Town & London (depends on the season)
    Posts
    2,975
    Plugin Contributions
    0

    Default Re: Implementing Javascript?

    Surely if you are using radio buttons (option VALUES) for one option name, then it's not possible to multi-select the radio buttons. So as only one radio button can be selected the $5 , OR the $7, OR the $10 is added to the base price.

    Perhaps you are not setting up the option NAMES-to-VALUES relationships properly?

    I think you are creating several option NAMES, and giving them one value each, instead of setting up ONE name, and giving it several values.

  3. #3
    Join Date
    Jun 2008
    Posts
    37
    Plugin Contributions
    0

    Default Re: Implementing Javascript?

    The way I need this to work is:

    You can only select one radio button.

    If you select Attribute A, then Attribute B is no longer +$7, it is now +$2 greater than the new price. So I want the attribute name to change from:

    Attribute B - +$7

    to

    Attribute B - +$2



    This is because I have dynamic price changing. So the price on my website changes when you select the attributes (and the customer can see the new price before he adds it to his cart.)


    Here's a product on my website

    Notice that the sidebox to the right updates the price. But I want the value next to the attributes to change depending on what you choose, so it doesn't look like if you choose the +$90 dollar attribute and you want to change to the +$70 you'd have to pay $70 more (because really its $20 less.)

    You can see an example of the dynamic attribute prices Here if you select the different attributes and watch the values next to them change.

  4. #4
    Join Date
    Jun 2008
    Posts
    37
    Plugin Contributions
    0

    Default Re: Implementing Javascript?

    Any ideas? lol

 

 

Similar Threads

  1. implementing javascript across the site
    By xrich in forum Templates, Stylesheets, Page Layout
    Replies: 6
    Last Post: 22 Mar 2010, 05:32 PM
  2. Implementing SSL
    By pieceinthehoop in forum General Questions
    Replies: 2
    Last Post: 15 Mar 2008, 12:52 AM
  3. Implementing Override
    By enginemike in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 14 Mar 2008, 08:33 PM
  4. Implementing javascript on Worldpay Confirmation Page
    By knuckles199 in forum General Questions
    Replies: 0
    Last Post: 11 May 2006, 04:46 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR