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
Pop-up applet on javascript

Knowledge Base Lobby : uShop Support Conference : Programmer Tips
Nov-21-17 04:24 PM EST
Original Message
Pop-up applet on javascript
Author Matt on 06-08-2002 at 23:51 (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
E-MAIL AUTHOR | TABLE OF CONTENTS

Table Of Contents
  Nevermind... got this one figured out too... Matt, 2002-06-09 00:58:14 (1)
            Javascript Alert Box Ron Harter, 2002-06-09 16:57:26 (2)
                 RE: Javascript Alert Box Bill Weiner, 2002-06-10 05:05:52 (3)
                      Tried this... same problem - last one shows throughout Matt, 2002-06-10 11:36:45 (4)
                           Let's try that again! Matt, 2002-06-10 11:40:11 (5)
                                Re: Popup Pete Burford, 2002-06-10 12:06:33 (6)
                                     Re: Popup Pete Burford, 2002-06-10 12:11:19 (7)
                                     Only 10 minutes longer... geez Matt, 2002-06-10 12:12:28 (8)
                                          RE: Only 10 minutes longer... geez Bill Weiner, 2002-06-11 04:10:24 (9)
                                               but how to show the product name? kepitech, 2002-06-29 14:29:25 (11)
                                                    RE: but how to show the product name? Bill Weiner, 2002-07-01 04:27:48 (12)
                 Javascript Alert Box Ron Harter, 2002-06-12 10:01:03 (10)

Messages In This Discussion
         1. Nevermind... got this one figured out too...
        Author Matt on 06-09-2002 at 00:58 (EST)
Nevermind... got this one figured out too...

Thanks though!

Matt
TABLE OF CONTENTS
                 2. Javascript Alert Box
                Author Ron Harter on 06-09-2002 at 16:57 (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
TABLE OF CONTENTS
                         3. RE: Javascript Alert Box
                        Author Bill Weiner on 06-10-2002 at 05:05 (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");
TABLE OF CONTENTS
                                 4. Tried this... same problem - last one shows throughout
                                Author Matt on 06-10-2002 at 11:36 (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
TABLE OF CONTENTS
                                         5. Let's try that again!
                                        Author Matt on 06-10-2002 at 11:40 (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-
TABLE OF CONTENTS
                                                 6. Re: Popup
                                                Author Pete Burford on 06-10-2002 at 12:06 (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.')
TABLE OF CONTENTS
                                                         7. Re: Popup
                                                        Author Pete Burford on 06-10-2002 at 12:11 (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.'


TABLE OF CONTENTS
                                                         8. Only 10 minutes longer... geez
                                                        Author Matt on 06-10-2002 at 12:12 (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!
TABLE OF CONTENTS
                                                                 9. RE: Only 10 minutes longer... geez
                                                                Author Bill Weiner on 06-11-2002 at 04:10 (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!
TABLE OF CONTENTS
                                                                         11. but how to show the product name?
                                                                        Author kepitech on 06-29-2002 at 14:29 (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.
TABLE OF CONTENTS
                                                                                 12. RE: but how to show the product name?
                                                                                Author Bill Weiner on 07-01-2002 at 04:27 (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.
TABLE OF CONTENTS
                         10. Javascript Alert Box
                        Author Ron Harter on 06-12-2002 at 10:01 (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
TABLE OF CONTENTS

© 2003 Microburst Technologies, Inc.