
Originally Posted by
mattys
are the keys of the object the value, e.g. the '18' in <option value="18">Black </option>, is 18 the key? if so, how do add a character to the key? the key, or attribute value id, is automatically generated...
when you say array, you mean create php/javascript code - i am not a developer!, so, all refs to arrays are out!
it sounds like you are suggesting there is an issue with the software and it needs a hack to fix. I thought earlier you were suggesting it was an issue peculiar to my installation, as such i am a bit lost as to where to head with this
if you can clarify that would be great thanks
also, would you be available to do any paid work to get this sorted? (i think i may have asked this before and you politely said no, so, apologies if this is the case)
Matt
Yes the key is the value that is presented as part of the option tag for example:
Code:
var stk={1:{370:1,18:1,367:1,272:1,21:1},2:{370:1,18:1,367:1,272:1,21:1},3:{370:1,18:1,367:1,272:1,21:1}};
There is a key of 1 that has sub objects, each having a key such as 370, 18, 367, 272, and 21. Each of those keys have a value associated with it. Because the setting for the site is such to not show the quantity of stock available a value of 1 is assigned to all items so that they at least appear in stock.
In order to maintain continuity of the plugin with ZC, the option value="370" needs to stay that way because those numbers are passed upon add to cart to downstream processing that I have no desire to change if not necessary. So the solution is to modify the above code to something like:
Code:
var stk={_1:{_370:1,_18:1,_367:1,_272:1,_21:1},2:{_370:1,_18:1,_367:1,_272:1,_21:1},_3:{_370:1,_18:1,_367:1,_272:1,_21:1}};
Where an underscore has been added to each of the "keys" thus forcing the object to treat _370 as a string rather than a number. From what I have seen this would be sufficient to maintain the order that is provided above, but a test would be needed across browsers to see that it holds true. Otherwise one of the other methods would need to be applied making the code control the situation rather than the expected operation (perceived expectation?) of browsers.
Yes, there is a problem with the javascript/code of the plugin and it needs to be updated/modified to support maintaining the sequence that was expected to be maintained and for which other great pains were taken to provide at least the above sequence... While close to correct, it's wrong and doesn't provide the intended result...
As to discussion of paid work, that is something expected to occur outside of the public forum... Please forgive me I vaguely remember a conversation, but not the details. Again, something for outside the public forum (PM, direct contact, carrier pigeon, etc...).
Bookmarks