uShop English (U.S.) for 179!

uStorekeeper English (U.S.) for 149!

 Products
       uTest
       uReserve
       uShop
       uStorekeeper
       uGolf
       uDirectory
       uSignIn
 Tech Support
       Support Policy
       Knowledge Base
            uTest
            uReserve
            uShop
            uStorekeeper
            uGolf
            uDirectory
            uSignIn
       Documentation
       Reference Sites
 Legal
       Software Piracy
       Legal Notices
       Privacy Policy
       Licensing
 Miscellaneous
       Reseller Info
       Contact Us
       Site Map
How can you add a different Price depending on product size?

Knowledge Base Lobby : uShop Support Conference : Programmer Tips
Nov-21-17 06:39 AM EST
Original Message
How can you add a different Price depending on product size?
Author Deroy on 07-01-2002 at 08:55 (EST)
I am nearly there with my form the only problem is that I need on the Clara Espresso Pots for the Large pot to be 39.95 and the small one to be 34.95. Does anyone know what code to add to make this work.

My Form is on:
http://www.clients.sjidesign.com/ushop/demo/thumbs.html

Thanks

Dan
TABLE OF CONTENTS

Table Of Contents
  RE: How can you add a different Price depending on product size? Bill Weiner, 2002-07-02 05:03:15 (1)
            "RE: How can you add a different Price depending on product size?" Deroy, 2002-07-02 08:34:50 (2)
                 RE: How can you add a different Price depending on product size? Bill Weiner, 2002-07-03 04:33:30 (3)
                      Bill, you are brilliant. Deroy, 2002-07-03 04:49:20 (4)
                           RE: Bill, you are brilliant. Bill Weiner, 2002-07-03 21:55:16 (5)

Messages In This Discussion
         1. RE: How can you add a different Price depending on product size?
        Author Bill Weiner on 07-02-2002 at 05:03 (EST)
Since you are using uShop JavaScript Interface, try using something like this in your JavaScript to set a variable named "price" based on your "size" form field:

--------

var price = 0.00;
var size = document.aero05.size.options[document.aero05.size.selectedIndex].value;
if (size == "Large")
{
price = 39.95;
}
else
{
price = 34.95;
}

--------

... then just use the variable price when calling the document.uShopJSI.addProduct(...) function.
TABLE OF CONTENTS
                 2. "RE: How can you add a different Price depending on product size?"
                Author Deroy on 07-02-2002 at 08:34 (EST)
LAST EDITED ON Jul-02-02 AT 08:36 AM (EST)


Sorry Bill,

I am a little bit confused. I have tried adding the script to mine but I can;t get it to work.

Could you please tell me where to put each bit of the code.

eg. Do I have to remove any of the code that I have for aero05 (which parts) and where do I add the code "... then just use the variable price when calling the document.uShopJSI.addProduct(...) function."

Is the following code added to the add button code "var qty = parseInt(document.aero05.quantity.value);
if (qty > 0)addaero05();" at the bottom of the page, if it is do I have to take any of my code out?

Thanks

Dan

TABLE OF CONTENTS
                         3. RE: How can you add a different Price depending on product size?
                        Author Bill Weiner on 07-03-2002 at 04:33 (EST)
I couldn't see your actual JavaScript code.... I'm guessing because you have it in a ".js" file on your server.... but where I believe you need to add the code is to your "addaero05()" function. So it will be something like this:

(Note that I changed some of the variable names for clarity.)

function addaero05()
{
var itemPrice = "0.00";
var itemQuantity = document.aero05.quantity.value;
var itemColor = document.aero05.color.options[document.aero05.color.selectedIndex].value;
var itemSize = document.aero05.size.options[document.aero05.size.selectedIndex].value;
if (itemSize == "Large")
{
itemPrice = "39.95";
}
else
{
itemPrice = "34.95";
}

document.uShopJSI.addProduct(
"aero05",
"Espresso Pot",
"Size = " + itemSize + "; Color = " + itemColor,
"0",
itemQuantity,
itemPrice,
"$0.00",
"$0.00",
"$0.00",
"YES");
}
TABLE OF CONTENTS
                                 4. Bill, you are brilliant.
                                Author Deroy on 07-03-2002 at 04:49 (EST)
Bill, you are a star. That code works.

Thank you very much :)

Dan
TABLE OF CONTENTS
                                         5. RE: Bill, you are brilliant.
                                        Author Bill Weiner on 07-03-2002 at 21:55 (EST)
Glad that worked for you. Take care. :^)
TABLE OF CONTENTS

© 2003 Microburst Technologies, Inc.