www.uburst.com www.uburst.com

"How can you add a different Price depending on product size?"

Go back to the LobbyClick here to Go Back to Main ListingClick here to see helpClick here to Search the Forum

Programmer Tips
Forum Type: Public
Moderator: edmunds
Time Zone: EST
Printer Friendly Format
Original Message
 
"How can you add a different Price depending on product size?"
Posted by Deroy on Jul-01-02 at 08:55 AM (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

Click to Send Alert Message to the Administrator Click to edit this messageClick here to reply to this messageClick here to reply to this message with quotesClick to goto the Table of Contents

 Table of Contents

RE: How can you add a different Pri..., Bill Weiner, Jul-02-02, (1)
"RE: How can you add a differe..., Deroy, Jul-02-02, (2)
RE: How can you add a different Pri..., Bill Weiner, Jul-03-02, (3)
Bill, you are brilliant., Deroy, Jul-03-02, (4)
RE: Bill, you are brilliant., Bill Weiner, Jul-03-02, (5)

 

 
Click here to goto Click here to goto the Lobby
Messages in this discussion
 
1 . "RE: How can you add a different Price depending on product size?"
Posted by Bill Weiner on Jul-02-02 at 05:03 AM (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.

Remove this Message: Administrator and Moderator onlyClick to Send Alert Message to the Administrator Click to edit this messageClick here to reply to this messageClick here to reply to this message with quotesClick to goto the Table of Contents
 
2 . ""RE: How can you add a different Price depending on product size?""
Posted by Deroy on Jul-02-02 at 08:34 AM (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

Remove this Message: Administrator and Moderator onlyClick to Send Alert Message to the Administrator Click to edit this messageClick here to reply to this messageClick here to reply to this message with quotesClick to goto the Table of Contents
 
3 . "RE: How can you add a different Price depending on product size?"
Posted by Bill Weiner on Jul-03-02 at 04:33 AM (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");
}

Remove this Message: Administrator and Moderator onlyClick to Send Alert Message to the Administrator Click to edit this messageClick here to reply to this messageClick here to reply to this message with quotesClick to goto the Table of Contents
 
4 . "Bill, you are brilliant."
Posted by Deroy on Jul-03-02 at 04:49 AM (EST)
Bill, you are a star. That code works.

Thank you very much :)

Dan

Remove this Message: Administrator and Moderator onlyClick to Send Alert Message to the Administrator Click to edit this messageClick here to reply to this messageClick here to reply to this message with quotesClick to goto the Table of Contents
 
5 . "RE: Bill, you are brilliant."
Posted by Bill Weiner on Jul-03-02 at 09:55 PM (EST)
Glad that worked for you. Take care. :^)
Remove this Message: Administrator and Moderator onlyClick to Send Alert Message to the Administrator Click to edit this messageClick here to reply to this messageClick here to reply to this message with quotesClick to goto the Table of Contents


Archive This Thread: Admin and Moderator OnlyRemove This Thread: Admin and Moderator Only
Click here to goto Click here to goto the Lobby

 

 

 

 

 

 

 

 

 

 

 

 
Questions or problems regarding this bulletin board should be directed to Webmaster
©1997-1999 by DCScripts. All rights reserved.