Since I'm not a js expert....it looks to me like there are some basic problems with this script....but since you guys are better at this than me..... I mean it looks like there are some quotation issues...bracket issues..... I don't know...what do you see?
<script type="text/javascript">function addToRegistry() {var q = "add= =$_GET['products_id']?>";for(i=0; i{if(document.cart_quantity.elements[i].type!="checkbox) {q += "&" + document.cart_quantity.elements[i].name + "=" +document.cart_quantity.elements[i].value;}else {if(document.cart_quantity.elements[i].checked==true) {q += "&" +document.cart_quantity.elements[i].name + "=" +document.cart_quantity.elements[i].value;}}}window.location = "registry.php?"+q;}</script>
6/26/2009 4:15:31 PM
use the [ code ] tag, plz (remove the spaces)
6/26/2009 4:25:26 PM
not sure which spaces you were referring to but I was attempting to keep the code as it was given to me in case that's where any of the problems lie...
6/26/2009 4:31:05 PM
1. It would help if you told us what you're trying to do2. Line 4 is boned: for(i=0; i3. Line 6: "checkbox[Edited on June 26, 2009 at 4:49 PM. Reason : "]
6/26/2009 4:39:01 PM
<script type="text/javascript">function addToRegistry() { var q = "add= "; for(i=0; i { if(document.cart_quantity.elements[i].type!="checkbox) { q += "&" + document.cart_quantity.elements[i].name + "=" + document.cart_quantity.elements[i].value; } else { if(document.cart_quantity.elements[i].checked==true) { q += "&" + document.cart_quantity.elements[i].name + "=" + document.cart_quantity.elements[i].value; } }}window.location = "registry.php?"+q;}</script>
6/26/2009 4:39:04 PM
I see a woman behind the keyboard, that's usually not a good sign
6/26/2009 4:46:47 PM
my apologies agentlion....I didn't know the code tag allowed you to do that....but thanksErnie...well it's part of a bigger script that is a mod to something else but the basic script looked like it was missing something and I think the problem is that there needed to be a quotations mark after the checkbox in line 6.Now there are other issues but I think they need to be sorted out by the guy who did this mod to begin with.
6/26/2009 4:52:03 PM
f'ing double post...sorry[Edited on June 26, 2009 at 4:52 PM. Reason : ]
6/26/2009 4:54:01 PM
also the string concatenations in the if statements probably won't work if there are line breaks between the +es[Edited on June 26, 2009 at 5:05 PM. Reason : also it looks like your query string is going to start out "and= &"]
6/26/2009 5:03:47 PM
This is why you don't use odesk
6/26/2009 5:07:08 PM
Didn't use odesk...don't even know what it is....Since you guys seem to want the full story:I have a site which makes use of the Zencart shopping cart installation. I've made a lot of mods to the basic install already but I wanted to add a gift registry. The problem is that there is only one person who created a registry specifically for zencart...and because of a previous mod I made, his script was not set up to handle this so he's been working on it for a few weeks and today sent me the files to try out...As for the broken loop.....since I'm not sure how it is supposed to look, or how it's supposed to relate to the other parts of the script, I'm going to have to ask him on monday.
6/26/2009 5:20:50 PM
function addToRegistry() { var q = "add= "; var e = document.cart_quantity.elements.length; for(i=0; i<=e; i++) { if(document.cart_quantity.elements[i].type!="checkbox) { q += "&" + document.cart_quantity.elements[i].name + "=" + document.cart_quantity.elements[i].value; } else { if(document.cart_quantity.elements[i].checked == true) { q += "&" + document.cart_quantity.elements[i].name + "=" + document.cart_quantity.elements[i].value; } } } window.location = "registry.php?"+q;}
6/26/2009 5:25:06 PM
oops.....just realized that the php didn't make it through initially....though not sure if it would make a difference to the js part of it but there is supposed to be a
var q = "add= php=$_GET['products_id']php";
6/26/2009 5:29:28 PM
No, the for loop needs three parameters: an initial value, an ending value and an increment value. Yours seems to have been chopped off.
6/26/2009 5:38:48 PM
OK.....I'm going to try this another way..... anyone see how the following 2 javascripts could be combined?(and I know you guys said there were problems with this first one, but all I can tell you is that it works, and the other way doesn't)
<script type="text/javascript">function addToRegistry() {var q = "add= =$_GET['products_id']?>";for(i=0; i{if(document.cart_quantity.elements[i].type!="checkbox") {q += "&" + document.cart_quantity.elements[i].name + "=" +document.cart_quantity.elements[i].value;}else {if(document.cart_quantity.elements[i].checked==true) {q += "&" + document.cart_quantity.elements[i].name + "=" +document.cart_quantity.elements[i].value;}}}window.location = "registry.php?"+q;}</script>
8/5/2009 3:02:40 PM
ok....apparently there is a problem with the g'damn code cause it's fucking up this page....I'll make a text page of the second script......http://www.thespinzone.com/temp/twwjs.txt
8/5/2009 3:12:01 PM
I think you should call Sun and Netscape and pretend to be a reporter for a very prominent news station in the area. Then you can pit them against each other until they fix the script for you under warranty and free of charge.
8/5/2009 3:14:44 PM
last month called.....it wants it's thread back
8/5/2009 3:16:14 PM
OK....how bout this.....since the way the store is set up (mysql wise)....every product has an id as does every option, and since the default option id = "0", is there anyway to add into that initial script something that says, 'if that option id=0, then give an alert, otherwise add it to the registry?And example of how something gets added to the registry is the following:if there is an actual option then when relating to "registry.php?"+q, the q would be something like:37&id[4]=366&cart_quantity=1&products_id=37 (where the product id is 37 and the option id is 366)and if there WASN'T such an actual option, it would look like:37&id[4]=0&cart_quantity=1&products_id=37 (where the product id is 37 and the option id is 0) and it is in this case that I would want that alert....
8/5/2009 6:17:52 PM