Quote Originally Posted by mc12345678 View Post
Yup, and I'll look at how "best" such a statement can be easily added in the future. (Have an idea, but want to try to keep it easy for those that choose to modify it such as the above request.)

File: includes/classes/pad_sba_sequenced_dropdowns.php

Line 508:
Can change from:

Code:
            $out.=" + '" . PWA_STOCK_QTY . "' + stk2";
to:
Code:
            $out.=" + '" . PWA_STOCK_QTY . "' + stk2" . " Available";
For the fix, I'm looking at modifying PWA_STOCK_QTY and the remainder of that statement to possibly sprint the value, or more simply to have it defined as the entire text that follows the current PWA_STOCK_QTY, such that the define in: includes/languages/english/extra_definitions/products_with_attributes.php
Line 15 would be changed from:
Code:
define('PWA_STOCK_QTY', ' Qty: ');
to (untested):
Code:
define('PWA_STOCK_QTY', ' + " Qty: " + stk2 + " Available"');
Might have to reverse all the quotes on the right side of the define changing single quotes into double and double into single to support the javascript portion, and then line 508 of the previous file would be simply:

Code:
            $out.= PWA_STOCK_QTY;
Or some variation on that "thought"...

Or since I see the constant is used in the class, that it would need to be a different constant in order to work or back to the previous "thought" of using sprint to provide the data... Again, the reason behind at least offering such a "prefix"/"suffix" option is to handle multiple languages as well where the word(s) may need to follow the number instead and further why an sprint option may be better so that the code can be consistent, but the resulting text be as desired/formed.

Anyways, more than you needed, but there ya' go. :)
Not quite so simple as just changing line 508, but I got it.
To allow any combination of prefixes and suffixes, I added
Code:
define('PWA_STOCK_QTY_PFX', ' :');
define('PWA_STOCK_QTY_SFX', ' Available');
to /includes/languages/english/extra_definitions/products_with_attributes.php

Changed /includes/classes/pad_sba_sequenced_dropdowns.php (lines 506 +)
Code:
        if ($curattr == sizeof($attributes) - 2) {
          if (STOCK_SHOW_ATTRIB_LEVEL_STOCK == 'true') {
          //$out.=" + '" . PWA_STOCK_QTY . "' + stk2";
            $out.=" + '" . PWA_STOCK_QTY_PFX . "' + stk2";//Put prefix here
            $out.=$outArray;
            $out.="[opt]";
          }
        }
      //$out.=",opt.substring(1));\n";
        $out.="+ '" . PWA_STOCK_QTY_SFX . "',opt.substring(1));\n";//Added the suffix here
        $out.="        } else {\n";
Now for the second dropdown it shows
Black :2 Available
Blue :4 Available
Green :2 Available
Red :3 Available

...which works for us and is flexible should our passions change.

Quote Originally Posted by mc12345678 View Post
Code:
define('PWA_STOCK_QTY', ' + " Qty: " + stk2 + " Available"');
This will totally puke, since "stk2" is the name of the array holding the second-tier attributes stock quantities, which has to be accessed to determine the quantity. Once I got it to work with Prefix and Suffix, this is how the relevant line of Java is put together:
Code:
frm['id[6]'].options[frm['id[6]'].length]=new Option(htmlEnDeCode.htmlDecode(txt6[opt]) + ' :' + stk2['_'+frm['id[1]'].value][opt]+ ' Available',opt.substring(1));
It worked fine with just a prefix, but the suffix gets in the way of accessing the array.