www.uburst.com www.uburst.com

"Pop-up applet on javascript"

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
 
"Pop-up applet on javascript"
Posted by Matt on Jun-08-02 at 11:51 PM (EST)
Question that I haven't been able to find an answer to is this:

When using the JavaScript INPUT EXAMPLE 1 in version 3.50, there is no option in the applet for a popup confirmation. How do I go about adding it. Check out this link... and see what I mean....

http://www.websystemz.com/Intro.php

There is no way for the customer to know that the item was successfully added to the cart unless they visit the cart page (link not added yet)

Thanks for the information...

Matt

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

 Table of Contents

Nevermind... got this one figured o..., Matt, Jun-09-02, (1)
Javascript Alert Box, Ron Harter, Jun-09-02, (2)
RE: Javascript Alert Box, Bill Weiner, Jun-10-02, (3)
Tried this... same problem - last o..., Matt, Jun-10-02, (4)
Let's try that again!, Matt, Jun-10-02, (5)
Re: Popup, Pete Burford, Jun-10-02, (6)
Re: Popup, Pete Burford, Jun-10-02, (7)
Only 10 minutes longer... geez, Matt, Jun-10-02, (8)
RE: Only 10 minutes longer... geez, Bill Weiner, Jun-11-02, (9)
but how to show the product name?, kepitech, Jun-29-02, (11)
RE: but how to show the product nam..., Bill Weiner, Jul-01-02, (12)
Javascript Alert Box, Ron Harter, Jun-12-02, (10)

 

 
Click here to goto Click here to goto the Lobby
Messages in this discussion
 
1 . "Nevermind... got this one figured out too..."
Posted by Matt on Jun-09-02 at 00:58 AM (EST)
Nevermind... got this one figured out too...

Thanks though!

Matt

Remove this Message: Administrator and Moderator onlyClick to Send Alert Message to the Administrator Click to edit this messageClick to EMail Click here to reply to this messageClick here to reply to this message with quotesClick to goto the Table of Contents
 
2 . "Javascript Alert Box"
Posted by Ron Harter on Jun-09-02 at 04:57 PM (EST)
I like this idea but ran into a problem. It always shows the last Alert message on a page with multiple items. This would be ok if you just wanted to say "Item added to cart" but if you want to identify the item being added it doesn't. The only way I could make it work was to rename the sub_alert to sub_alert1, sub_alert2 etc for each item.

Since I have over a 100 pages with at least 20 items per page this would be a lot of work and prone to error.

I am not a programmer so maybe somebody can find a better way.
Thanks
Ron

Remove this Message: Administrator and Moderator onlyClick to Send Alert Message to the Administrator Click to edit this messageClick to EMail Click here to reply to this messageClick here to reply to this message with quotesClick to goto the Table of Contents
 
3 . "RE: Javascript Alert Box"
Posted by Bill Weiner on Jun-10-02 at 05:05 AM (EST)
It sounds like you are using a JavaScript to input the items into the shopping cart... and a JavaScript "alert()" function display an "Item Added" popup window? And you just want to avoid writing a different "display alert" subroutine for each item?

You could just try writing a "wrapper" function around the standard JavaScript "alert" function... One in which you pass the item name/description via a parameter... for example:

function show_alert(productName)
{
var message = productName + "has just been added to your cart.";
alert(message);
}

Then when you call the function, specify the product name as a parameter, such as:

show_alert("My Product");

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 . "Tried this... same problem - last one shows throughout"
Posted by Matt on Jun-10-02 at 11:36 AM (EST)
Bill,

I tried doing what you suggested only to find errors on the page... no matter what I add, I still end up with errors though. In the HTML side, it looks ok, but I can't see the problem as to WHY it would create problems!

I have included the HTML side of the script I am using with the page for dynamic data (using PHP)

Please advise!

You can see it in action at http://www.websystemz.com/Intro2.php

choose a category, then add some items using the MAIN page... not the product details page. You'll see what I mean. I may be working on it a little, but see if you can find the problem!?

================================
-SCRIPT LANGUAGE="Javascript"-
function add()
{
document.uShopJSI.addProduct(
"",
"",
"",
"0",
"1",
"",
"$0.00",
"$0.00",
"$0.00",
"YES");
}

function show_alert()
{
var message = " has just been added to your cart."
}
-/SCRIPT-

-A HREF=""onClick="show_alert("");add();return false;"-
-IMG SRC="images/addcart.gif" border=0- -/A-
================================

Now, where the script actually calls the onclick alert, I tried both with and without quotes, you know, where YOU put the "My Product". I tried both, but can't seem to get it right!

Thanks again Bill,

Matt

Remove this Message: Administrator and Moderator onlyClick to Send Alert Message to the Administrator Click to edit this messageClick to EMail Click here to reply to this messageClick here to reply to this message with quotesClick to goto the Table of Contents
 
5 . "Let's try that again!"
Posted by Matt on Jun-10-02 at 11:40 AM (EST)
This time, replaced the obvious html greater/less than symbols with a "-" (dash).

Please disregard last post!

Thanks again

-SCRIPT LANGUAGE="Javascript"-
function add-? echo "$ProductCode"?-()
{
document.uShopJSI.addProduct(
"-? echo "$ProductCode"?-", -!-- Product ID ---
"-? echo "$ProductName"?-", -!-- Product Name ---
"-? echo "$ProductDescription"?-", -!-- Product Description ---
"0", -!-- Product Weight ---
"1", -!-- Product Quantity ---
"-? echo "$DiscountPrice"?-", -!-- Product Price (Each) ---
"$0.00", -!-- Extra Price Modifiers ---
"$0.00", -!-- Product Classification ---
"$0.00", -!-- Product Shipping Modifier ---
"YES"); -!-- Taxable? ---
}

function show_alert(-? echo "$ProductCode"?-)
{
var message = "-? echo "$ProductName"?- has just been added to your cart."
}
-/SCRIPT-

-A HREF=""onClick="show_alert("-? echo "$ProductCode"?-");add-? echo "$ProductCode"?-();return false;"-
-IMG SRC="images/addcart.gif" border=0- -/A-

Remove this Message: Administrator and Moderator onlyClick to Send Alert Message to the Administrator Click to edit this messageClick to EMail Click here to reply to this messageClick here to reply to this message with quotesClick to goto the Table of Contents
 
6 . "Re: Popup"
Posted by Pete Burford on Jun-10-02 at 12:06 PM (EST)
I use this instead of the standard alert, it allows us to pass the php variable directly.

//located at end of Taxable row
MM_popupMsg('Item code;?> added to Shopping Cart.')

Remove this Message: Administrator and Moderator onlyClick to Send Alert Message to the Administrator Click to edit this messageClick to EMail Click here to reply to this messageClick here to reply to this message with quotesClick to goto the Table of Contents
 
7 . "Re: Popup"
Posted by Pete Burford on Jun-10-02 at 12:11 PM (EST)
I use this instead of the standard
alert, it allows us to pass
the php variable directly.

script language="JavaScript"
function MM_popupMsg(msg) { //v1.0
alert(msg);

/script


"YES"); //Taxable?
MM_popupMsg('Item ? echo $row->code;? added to Shopping Cart.'


Remove this Message: Administrator and Moderator onlyClick to Send Alert Message to the Administrator Click to edit this messageClick to EMail Click here to reply to this messageClick here to reply to this message with quotesClick to goto the Table of Contents
 
8 . "Only 10 minutes longer... geez"
Posted by Matt on Jun-10-02 at 12:12 PM (EST)
Got it to work, I needed to delete the "My Product" section from the code.

If anyone wants full code, be happy to send it!

Thanks again Support Staff - keep up the good work!

Remove this Message: Administrator and Moderator onlyClick to Send Alert Message to the Administrator Click to edit this messageClick to EMail Click here to reply to this messageClick here to reply to this message with quotesClick to goto the Table of Contents
 
9 . "RE: Only 10 minutes longer... geez"
Posted by Bill Weiner on Jun-11-02 at 04:10 AM (EST)

Another option would have been to make the call to show_alert().... right in your add() function. That is, rather than try to put the show_alert() call in the "onClick" action, you could have added the show_alert() call directly after your document.uShopJSI.addProduct() call in the add() function. May have been easier.

But in any case, glad you got it working!

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
 
11 . "but how to show the product name?"
Posted by kepitech on Jun-29-02 at 02:29 PM (EST)
This function works fine but I don't see the answer to how to actually show the product name. I have managed to show the values of the selected parameters, but not the product name.

If I use document.P00004.name, I get P0004

Isn't there a value for the product name to simply automatically show the product name without having to enter it individually for each product?

Thanks.

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
 
12 . "RE: but how to show the product name?"
Posted by Bill Weiner on Jul-01-02 at 04:27 AM (EST)
Well, obviously you have to enter the product name at least once... like in the example "addP000x" JavaScript functions.... but if you want to avoid having to enter it again for the JavaScript popup window, then just define a variable such as:

var productName = "My Product";

And then use that variable in both the addProduct() function call and the alert() function call.

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
 
10 . "Javascript Alert Box"
Posted by Ron Harter on Jun-12-02 at 10:01 AM (EST)
Thanks guys,
For my purposes I just added the javascript to the bottom of each page:


function sub_alert()
{
window.alert("Item has been added to your cart.");
}


and then did a search and replace on onClick="add and replaced it with onClick="sub_alert();add

saved me a lot of time. Maybe I can have it show the actual item added at some future time. The main thing was to satisfy customers who expect a response to clicking the add button.

I use a few Java applets on the page and noticed that they only show that the item has been added when you use the popup option.

Ron

Remove this Message: Administrator and Moderator onlyClick to Send Alert Message to the Administrator Click to edit this messageClick to EMail Click 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.