Print Page | Close Window

ProductCart bug in viewPrd.asp

Printed From: ProductCart E-Commerce Solutions
Category: ProductCart
Forum Name: Suggestions
Forum Description: ProductCart Suggestions
URL: https://forum.productcart.com/forum_posts.asp?TID=185
Printed Date: 21-November-2024 at 10:17pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: ProductCart bug in viewPrd.asp
Posted By: dfinster
Subject: ProductCart bug in viewPrd.asp
Date Posted: 27-April-2006 at 7:57pm
I've discovered errors in ProductCart when configuring a product with two option groups and three custom fields.

The client Javascript fails in that situation.  See line 697 of viewPrd.asp.  That Javascript validation function (cdd6) has errors in the alert statements.  It refers to variables named "option", when it should be "option1", "option2", etc.  Easy fix, took me 20 minutes to find it.  It's a serious bug, it prevents the item from being added to the shopping cart.  IE and Firefox blow up on it differently, but either way, it screws up the purchase.

In addition, I've found that when returning from the shopping cart via the "Edit product options" link, the custom fields do not retain the original values.  That's a hassle for the user, I'm looking at writing a patch now.

Can you confirm my findings, and do I get a cookie?



Replies:
Posted By: ProductCart
Date Posted: 27-April-2006 at 8:18pm

We cannot replicate the JavaScript problem that you described. Please contact us by opening a support ticket so that we can log into your Control Panel and look at the product settings.

As for the other issue, it will be fixed in the next ProductCart version.



-------------
The ProductCart Team

Home of ProductCart http://www.productcart.com" rel="nofollow - shopping cart software


Posted By: dfinster
Date Posted: 27-April-2006 at 8:36pm
No need to log into my cart, I've fixed the code and it's working fine for me now.  It just looks like a copy-paste error.  Below is the full function, and below that is my correction. 

The issue is that lines that read:
alert("<%=dictLanguage.Item(Session("language")&"_ale rt_1")%>\n"+ option + "<%=dictLanguage.Item(Session("language")&"_alert_ 2")%>.\n");

Should read:
alert("<%=dictLanguage.Item(Session("language")&"_ale rt_1")%>\n"+ option1 + "<%=dictLanguage.Item(Session("language")&"_alert_ 2")%>.\n");

I've bolded the part in error.  It's a client-side error, the Javascript engine is trying to access a variable named "option" that doesn't exist.  It should be "option1" or "option2" etc.  Compare function cdd5 at line 675 and cdd6 at line 697 - it'll be obvious then.

Here's the full function for context.

Bad function beginning on line 697 of viewPrd.asp (from ProductCart_276_PATCH_101005.zip)
========
        function cdd6(choice1, option1, choice2, option2, choice3, option3, choice4, option4, choice5, option5) {
        if (choice1== 0) {
            alert("<%=dictLanguage.Item(Session("language")& ;"_alert_1")%>\n"+ option + "<%=dictLanguage.Item(Session("language")&"_alert_2") %>.\n");
            } else {
            if (choice2== 0) {
                alert("<%=dictLanguage.Item(Session("language")& ;"_alert_1")%>\n"+ option + "<%=dictLanguage.Item(Session("language")&"_alert_2") %>.\n");
                } else {
                if (choice3== 0) {
                    alert("<%=dictLanguage.Item(Session("language")& ;"_alert_1")%>\n"+ option + "<%=dictLanguage.Item(Session("language")&"_alert_2") %>.\n");
                    } else {
                    if (choice4== 0) {
                        alert("<%=dictLanguage.Item(Session("language")& ;"_alert_1")%>\n"+ option + "<%=dictLanguage.Item(Session("language")&"_alert_2") %>.\n");
                        } else {
                        if (choice5== 0) {
                            alert("<%=dictLanguage.Item(Session("language")& ;"_alert_1")%>\n"+ option + "<%=dictLanguage.Item(Session("language")&"_alert_2") %>.\n");
                            } else {
                            document.additem.action="instPrd.asp";
                            document.additem.method="POST";
                            document.additem.submit();
                            }
                        }
                    }
                }
            }
        }
=============

Corrected function
========
        function cdd6(choice1, option1, choice2, option2, choice3, option3, choice4, option4, choice5, option5) {
        if (choice1== 0) {
            alert("<%=dictLanguage.Item(Session("language")& ;"_alert_1")%>\n"+ option1 + "<%=dictLanguage.Item(Session("language")&"_alert_2") %>.\n");
            } else {
            if (choice2== 0) {
                alert("<%=dictLanguage.Item(Session("language")& ;"_alert_1")%>\n"+ option2 + "<%=dictLanguage.Item(Session("language")&"_alert_2") %>.\n");
                } else {
                if (choice3== 0) {
                    alert("<%=dictLanguage.Item(Session("language")& ;"_alert_1")%>\n"+ option3 + "<%=dictLanguage.Item(Session("language")&"_alert_2") %>.\n");
                    } else {
                    if (choice4== 0) {
                        alert("<%=dictLanguage.Item(Session("language")& ;"_alert_1")%>\n"+ option4 + "<%=dictLanguage.Item(Session("language")&"_alert_2") %>.\n");
                        } else {
                        if (choice5== 0) {
                            alert("<%=dictLanguage.Item(Session("language")& ;"_alert_1")%>\n"+ option5 + "<%=dictLanguage.Item(Session("language")&"_alert_2") %>.\n");
                            } else {
                            document.additem.action="instPrd.asp";
                            document.additem.method="POST";
                            document.additem.submit();
                            }
                        }
                    }
                }
            }
        }
=============



Posted By: ProductCart
Date Posted: 27-April-2006 at 8:55pm
You are using an older version of ProductCart. This issue was fixed months ago.

-------------
The ProductCart Team

Home of ProductCart http://www.productcart.com" rel="nofollow - shopping cart software


Posted By: dfinster
Date Posted: 27-April-2006 at 9:40pm
I'm running 2.76p2, with the 11/10/2005 security update.  I can't find a release after that when I click on "check for updates" from my cart.  What am I missing?  I just purchased this cart about 8 weeks ago, and this is the code I got.


Posted By: ProductCart
Date Posted: 28-April-2006 at 12:19am
That security update does not apply to v2.76p2, as indicated in the corresponding ReadMe file. Reupload the files from the v2.76p2 build to overwrite the ones that you replaced.

-------------
The ProductCart Team

Home of ProductCart http://www.productcart.com" rel="nofollow - shopping cart software


Posted By: dfinster
Date Posted: 28-April-2006 at 10:01am
To double check myself, and make sure there was no mistake, I asked to have my download link re-enabled so I could pull down a fresh, official build of productcart.

This morning I downloaded and unzipped ProductCart_v276p2_012406.zip into a clean folder and checked the file.  This error still exists in both "parent paths enabled" and "parent paths disabled".  It has not been corrected in this build. 

The security patch mentioned above was my confusion, but it's a red herring.  That patch only contains two files, and they are identical (except for a single comment) to the 276p2 build.  When I check for updates from my cart, that patch still shows as an available update, so I was confused.

If this bug was corrected months ago, I'm not seeing the fix.  Is this the latest build?  Are there other patches I'm missing also?





Posted By: ProductCart
Date Posted: 28-April-2006 at 1:46pm

You're right. Our mistake. We had found the problem and the fix, but the edited file had not made it into the master. Sometimes it happens. Thanks for the feedback.

By the way: this area of the cart has been substantially rewritten in v3 (next release - should be out by the end of June), and the problem does not exist there.



-------------
The ProductCart Team

Home of ProductCart http://www.productcart.com" rel="nofollow - shopping cart software


Posted By: dfinster
Date Posted: 28-April-2006 at 2:43pm
No sweat - I was confused for a bit... i have two clients using PC, one at 2.76p and the other at 2.76p2 and I thought I was looking at the wrong stuff.  Any word on upgrade pricing for version 3?

By the way - I've used 4 different carts in the past, and each one of them I swore it was the first and last time I'd ever use the product. 

Your product is the first cart that made me a repeat customer.  I've rolled it out twice, and I'm planning to use it in the future.



Posted By: ProductCart
Date Posted: 28-April-2006 at 2:50pm

That's great to hear, thanks!

We haven't finalized pricing for v3, but we will soon :-)



-------------
The ProductCart Team

Home of ProductCart http://www.productcart.com" rel="nofollow - shopping cart software



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net