Zen Cart Logo
Forums / All Other Contributions/Addons / Stock by Attribute v4.0 addon for v1.3.5-1.3.9

Stock by Attribute v4.0 addon for v1.3.5-1.3.9

Views: 658,363

Results 2,881 to 2,900 of 3,609
10 Feb 2018, 20:47
#2881
soxophoneplayer avatar

soxophoneplayer

Totally Zenned

Join Date:
Feb 2008
Posts:
534
Plugin Contributions:
0

Stock by Attribute v4.0 addon for v1.3.5-1.3.9

This isn't really a question as much as a comment ;o)

Live site is zc 1.5.5e recently update to f. Responsive Sheffield Blue 2.0, many mods. In preparation for eventual aging out of my template I built two test sites first. One updating and testing my live site files with live site db, and the other with a clean install of zc 1.5.5f and a clone responsive_classic template.

On the latter, I installed Canada Post, ckEditor, OPC 5.0, EZPop4 and Colorbox 1.2.2 followed later by IH5, SbyA most recent, and Attribute Replace Main Image.

Following the instructions on the Misc tab of IH5 I used the IH5 version of incl/modules/YOUR TEMP/additional images.php instead of Colorbox v. To my great surprise, everything worked nicely together with very little fiddling. Attribute images swapped, stock counted and adjusted, lightbox with additional images fully functional.

So next, I took the test site copy of my live site and tried to replicate this success, beginning by cloning a responsive_classic template. I didn't remove Responsive Sheffiled Blue. While it may be easier just to make my virgin site into my livesite I have great fear of losing my google rankings.

I ran into some snags. Biggest difference I can think of - non-template files merged as part of RSB template package or other mods added over the years. And perhaps relevant, Colorbox and IH4 were both resident on the RSB test site. I updated them to newest versions before adding SbyA, Attribute Image replace Main Image mods.

On my sample product I hit a snag with Attribute Images replace Main Image in both clone responsive and RSB - images wouldn't replace. Hit partial snag with SbyA - radio buttons for attribute showed but one button insisted on being default (not set that way) and the stock was being counted but didn't show (like it I try to add more than available to cart). Strangely, everything worked if I switched to Classic Green or Responsive Classic. My clone Responsive worked perfectly in the clean install test site, but not in the reworked test site.

I Beyond Compared everything to death, and eventually arrived at this solution:

Removing completely includes/YOUR TEMP/templates/tpl_modules_attributes and includes/modules/YOUR TEMP/main_product_image from both my RSB and clone Resp Classic folders rendered everything fully functional. Those files are both present in my clean test site and work fine.

I have no idea why, and I post this only in the event that it means something to anyone else ;o) I flipped a coin where to post this as it involves interplay of many mods, but I didn't want to cross post.

11 Feb 2018, 00:46
#2882
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

soxophoneplayer:

This isn't really a question as much as a comment ;o)

Live site is zc 1.5.5e recently update to f. Responsive Sheffield Blue 2.0, many mods. In preparation for eventual aging out of my template I built two test sites first. One updating and testing my live site files with live site db, and the other with a clean install of zc 1.5.5f and a clone responsive_classic template.

On the latter, I installed Canada Post, ckEditor, OPC 5.0, EZPop4 and Colorbox 1.2.2 followed later by IH5, SbyA most recent, and Attribute Replace Main Image.

Following the instructions on the Misc tab of IH5 I used the IH5 version of incl/modules/YOUR TEMP/additional images.php instead of Colorbox v. To my great surprise, everything worked nicely together with very little fiddling. Attribute images swapped, stock counted and adjusted, lightbox with additional images fully functional.

So next, I took the test site copy of my live site and tried to replicate this success, beginning by cloning a responsive_classic template. I didn't remove Responsive Sheffiled Blue. While it may be easier just to make my virgin site into my livesite I have great fear of losing my google rankings.

I ran into some snags. Biggest difference I can think of - non-template files merged as part of RSB template package or other mods added over the years. And perhaps relevant, Colorbox and IH4 were both resident on the RSB test site. I updated them to newest versions before adding SbyA, Attribute Image replace Main Image mods.

On my sample product I hit a snag with Attribute Images replace Main Image in both clone responsive and RSB - images wouldn't replace. Hit partial snag with SbyA - radio buttons for attribute showed but one button insisted on being default (not set that way) and the stock was being counted but didn't show (like it I try to add more than available to cart). Strangely, everything worked if I switched to Classic Green or Responsive Classic. My clone Responsive worked perfectly in the clean install test site, but not in the reworked test site.

I Beyond Compared everything to death, and eventually arrived at this solution:

Removing completely includes/YOUR TEMP/templates/tpl_modules_attributes and includes/modules/YOUR TEMP/main_product_image from both my RSB and clone Resp Classic folders rendered everything fully functional. Those files are both present in my clean test site and work fine.

I have no idea why, and I post this only in the event that it means something to anyone else ;o) I flipped a coin where to post this as it involves interplay of many mods, but I didn't want to cross post.

So, on the one hand it sounds like the problems were that a radio button styled attribute did not default to the attributes controller default and that there was an issue with some stock level display (don't follow what was expected where), but then there is some discussion of everything working fine versus another template it seems. I mean were doing really well up front explaining all that was going on, but then I get lost in what has been done to apply the same software to the other template(s).

I can say that SBA does do some data review and potentially will change the default selection of attributes if the original default is for an attribute selection that is out-of-stock (would need information about the SBA setup/configuration as well as information about the applicable variant(s).

For SBA, the file includes/templates/YOUR_TEMPLATE/templates/tpl_modules_attributes.php is what allows the dynamic dropdown aspect of the plugin to be displayed/operate. SBA will still manage the addition of product to the shopping cart, but there may be some other things that do not work as expected. Removal of includes/modules/YOUR_TEMPLATE/main_product_image.php may affect the built-in SBA image swap for single attribute product, but that too depends on the settings in attribute configuration area.

11 Feb 2018, 14:04
#2883
soxophoneplayer avatar

soxophoneplayer

Totally Zenned

Join Date:
Feb 2008
Posts:
534
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

mc12345678:

So, on the one hand it sounds like the problems were that a radio button styled attribute did not default to the attributes controller default and that there was an issue with some stock level display (don't follow what was expected where)

On the product listing page, each attribute showed with a radio button, but no stock level visible. If you added to cart more than was in stock you would get the warning on the cart page. This behaviour was on my modified existing test site, both in the Responsive Sheffield Blue template and newly created clone Responsive_Classic. On my second clean test site with only one test product the stock levels (and everything else) functioned perfectly.

but then there is some discussion of everything working fine versus another template it seems. I mean were doing really well up front explaining all that was going on, but then I get lost in what has been done to apply the same software to the other template(s).

On the updating of existing test site, all mods were present, but in earlier versions, except SbyA and Attrib Image Swap which were not present. I updated the existing mods, in particular Colorbox and IH5, then added SbyA and Attrib Image. On the second test site - new clean install - all mods were installed from scratch. I noted that IH5 was installed after Colorbox as that had different implications for merging additional_images php according to the Misc tab in the readme folder. The clean install site was zc 1.5.5f with clone Responsive Classic.

I can say that SBA does do some data review and potentially will change the default selection of attributes if the original default is for an attribute selection that is out-of-stock (would need information about the SBA setup/configuration as well as information about the applicable variant(s).

Set up on both test sites involved one sample product with a single attribute - Size with 4 vatriants. I don't anticipate doing multiple attribute products.

My Dynamic Dropdown config first three settings: 1, radio, radio. On the Attribute Controller no attributes are set to Default, and each attribute has stock and each has an image file. On the Option Name Manager the single attirbute is Size and is set to Radio button and stlye 8. (6 and 7 also worked).These settings worked on the second (clean) test site without further adieu. On the updated existing test site these setting would not work until I removed the two files named above - this was with template set to Responsive Sheffield Blue, clone Responsive_Classic, and also the two stock templates.

This is why I think 'some other' mod or bits of old code junk on my existing test site mustn't be playing nice. The site was originally zc 1.5.1 first edition, which in turn was a rebuild of my original zc 1.3.7.

For SBA, the file includes/templates/YOUR_TEMPLATE/templates/tpl_modules_attributes.php is what allows the dynamic dropdown aspect of the plugin to be displayed/operate. SBA will still manage the addition of product to the shopping cart, but there may be some other things that do not work as expected. Removal of includes/modules/YOUR_TEMPLATE/main_product_image.php may affect the built-in SBA image swap for single attribute product, but that too depends on the settings in attribute configuration area.

Oh - SbyA has image swap built in? I installed most recent SbyA but also Attrib_Image_Swap.6 (on both test sites). Would this cause issues?

My crude hack of removing the two files has everything, seemingly, working with whatever old files weren't playing nice. It's still an interesting riddle to me as to what old spanner in my files was mucking up the works.

As a point if interest - it took me but a few hours to build a clean test site with zc 1.5.5f, clone a template, install Colorbox, IH5, SbyA, Attrib_Switch, CanadaPost, EZPop, OnePageCheckout, ckEditor, ColumnLayoutGrid, and to set up a test product with additional images, swappable images and stock control.

11 Feb 2018, 15:26
#2884
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

soxophoneplayer:

On the product listing page, each attribute showed with a radio button, but no stock level visible. If you added to cart more than was in stock you would get the warning on the cart page. This behaviour was on my modified existing test site, both in the Responsive Sheffield Blue template and newly created clone Responsive_Classic. On my second clean test site with only one test product the stock levels (and everything else) functioned perfectly.

On the updating of existing test site, all mods were present, but in earlier versions, except SbyA and Attrib Image Swap which were not present. I updated the existing mods, in particular Colorbox and IH5, then added SbyA and Attrib Image. On the second test site - new clean install - all mods were installed from scratch. I noted that IH5 was installed after Colorbox as that had different implications for merging additional_images php according to the Misc tab in the readme folder. The clean install site was zc 1.5.5f with clone Responsive Classic.

Set up on both test sites involved one sample product with a single attribute - Size with 4 vatriants. I don't anticipate doing multiple attribute products.

My Dynamic Dropdown config first three settings: 1, radio, radio. On the Attribute Controller no attributes are set to Default, and each attribute has stock and each has an image file. On the Option Name Manager the single attirbute is Size and is set to Radio button and stlye 8. (6 and 7 also worked).These settings worked on the second (clean) test site without further adieu. On the updated existing test site these setting would not work until I removed the two files named above - this was with template set to Responsive Sheffield Blue, clone Responsive_Classic, and also the two stock templates.

This is why I think 'some other' mod or bits of old code junk on my existing test site mustn't be playing nice. The site was originally zc 1.5.1 first edition, which in turn was a rebuild of my original zc 1.3.7.

Oh - SbyA has image swap built in? I installed most recent SbyA but also Attrib_Image_Swap.6 (on both test sites). Would this cause issues?

My crude hack of removing the two files has everything, seemingly, working with whatever old files weren't playing nice. It's still an interesting riddle to me as to what old spanner in my files was mucking up the works.

As a point if interest - it took me but a few hours to build a clean test site with zc 1.5.5f, clone a template, install Colorbox, IH5, SbyA, Attrib_Switch, CanadaPost, EZPop, OnePageCheckout, ckEditor, ColumnLayoutGrid, and to set up a test product with additional images, swappable images and stock control.

So, again... I can not yet vouch for the operability of Dynamic Dropdowns when it is used for only a single option name (single attribute), like it is above, its inclusion is to address multiple attributes/multiple option names.

SBA was rebuilt by potteryhouse (quite successfully) to work with tracking stock of a single option name/attribute which includes the display of stock adjacent or as part of the selection(s). This is also basically how the default install is arranged... If you do not have items to track that have multiple option names, then there is no reason to even access the dynamic dropdowns area after initial installation, all necessary settings are (or should be) in either the stock or attributes configuration screen.

Part of the stock display also involves using the updated includes/modules/YOUR_TEMPLATE/attributes.php file which is the same/similar to the ZC 1.5.5 version but with a few added notifiers and some other items and could potentially explain the lack of additional information (although the settings to use dynamic dropdowns in this case also could be the cause).

Note that at least without SBA, a product that has radio buttons without a default selected is one that can be selected/added to the cart without any attribute being selected.... This can cause problems for the store owner if there is none selected, especially if the product is priced-by-attributes and none are selected... When using radio buttons pretty much like any of the attribute options, a default should be selected that also is a display only option. This way if selected and the product added to the cart then ZC kicks back to identify an issue and that the customer needs to select a product.

SBA has been written to try to prevent selecting an option that has not been populated as a variant, though I do not recall the result of testing a product setup in this condition (radio button options none selected, all variants identified to product), though the expectation is that if the product has attributes and all variants identify that there are attributes selected then it seems like it should also bounce back to say that something is not right, but I'm also sure I'll be quickly corrected on this. :)

So removal of the files...
Removal of includes/templates/YOUR_TEMPLATE/templates/tpl_modules_attributes.php basically disabled the Dynamic Dropdown "features" from being displayed which would have also been corrected by restoring the Dynamic Dropdown options back to their default(s).

I'm guessing and could be wrong here, that the includes/templates/YOUR_TEMPLATE/templates/tpl_modules_attributes.php file was the second file to be removed at which point "everything" started working correctly. This is for a couple of "known" reasons, dynamic dropdowns unfortunately does not provide the same html tags around information as a default ZC store, and therefore there are some aspects of attribute monitoring that do not (yet) work as expected/desired... Again, I've been trying to maintain existing functionality and add to it rather than take over things, disable options/code that others have been paid to make get functionl, etc... What that means is that while not all of the files provided also do everything expected they are present for th previously existing functionality and if someone has rewritten some of the code to work further, it still will work.

Lastly for now, yes there is some minor image swap capability already within the SBA code for single option name type product, but it has not proven to conflict with the other attribute image swap software that you have loaded.

25 Feb 2018, 12:07
#2885
madshaun1984 avatar

madshaun1984

New Zenner

Join Date:
Feb 2018
Posts:
19
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

Hey, not sure what I've done wrong but cant seem to find a solution myself.

Basically when adding a price offset for a product with a variant, in the dynamic dropdown to select said item, I see the offset price, but the currency symbol shows as "+£" which looks horrible.

How would I go about soeting this for zen cart 1.5.5f? Ideal behaviour would be to display the selected currency symbol (my site only uses GBP, so a £ symbol in this case).

An example can be seen on the following link by selecting strength:0mg & size:50ml.

https://phantomvaper.com/store/e-liquids-juices-c-3/momo-sodalish-p-88.html

Thanks!

25 Feb 2018, 12:53
#2886
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

madshaun1984:

Hey, not sure what I've done wrong but cant seem to find a solution myself.

Basically when adding a price offset for a product with a variant, in the dynamic dropdown to select said item, I see the offset price, but the currency symbol shows as "+£" which looks horrible.

How would I go about soeting this for zen cart 1.5.5f? Ideal behaviour would be to display the selected currency symbol (my site only uses GBP, so a £ symbol in this case).

An example can be seen on the following link by selecting strength:0mg & size:50ml.

https://phantomvaper.com/store/e-liquids-juices-c-3/momo-sodalish-p-88.html

Thanks!

Please see post 2875 for the solution that was posted for this problem.

25 Feb 2018, 16:20
#2887
madshaun1984 avatar

madshaun1984

New Zenner

Join Date:
Feb 2018
Posts:
19
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

mc12345678:

Please see post 2875 for the solution that was posted for this problem.

Thanks have applied both variants (not at the same time) of the code change suggested there but am still not getting the converted symbol displayed.

The latter version of code in that post is applied now, and
I added the offset price via the attributes manager, is that the correct way to do it when using product variants? Or is this just a caching thing?

Thanks,
Shaun

25 Feb 2018, 17:59
#2888
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

madshaun1984:

Thanks have applied both variants (not at the same time) of the code change suggested there but am still not getting the converted symbol displayed.

The latter version of code in that post is applied now, and
I added the offset price via the attributes manager, is that the correct way to do it when using product variants? Or is this just a caching thing?

Thanks,
Shaun
I would suspect a caching issue; however, I can not confirm as there is now a 500 error reported when attempting to access the provided link.

25 Feb 2018, 18:05
#2889
madshaun1984 avatar

madshaun1984

New Zenner

Join Date:
Feb 2018
Posts:
19
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

mc12345678:

I would suspect a caching issue; however, I can not confirm as there is now a 500 error reported when attempting to access the provided link.

Sorry was playing with the code, missed a curly brace... Sorted now and sites back up. I've also purged the cache via cdn, still not resolved...

25 Feb 2018, 19:38
#2890
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

madshaun1984:

Sorry was playing with the code, missed a curly brace... Sorted now and sites back up. I've also purged the cache via cdn, still not resolved...

Ok, I seeall that is/was going on. When the dynamic dropdowns was edited to support things like quotes and other "special" characters in the products_options_values_name that was incorporated first which then was applied to single attributes for consistency (which is what the referenced post addresses).

So, a similar change is needed to the dynamic dropdowns file(s) as was done for single attributes. I'm on my phone at the moment which makes it a little difficult to provide all of the change correctly/quickly, but the file in question is: includes/classes/pad_sba_sequenced_dropdowns.php

Then at line 833 modifying:

       $out.='"_' . $oval['id'] . '"' . ': "' . zen_output_string_protected($oval['text']) . '", ';

(if there are #s in there, ignore them/treat as spaces.
To use the function provided by:

zen_output_string($values[$i]['text'], array('"' => '"', '\'' => ''', '<' => '<', '>' => '>', ' & ' => ' & ')) . '</option>' . "\n";

In place of the zen_output_string_protected portion of the above.

25 Feb 2018, 20:07
#2891
madshaun1984 avatar

madshaun1984

New Zenner

Join Date:
Feb 2018
Posts:
19
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

mc12345678:

Ok, I seeall that is/was going on. When the dynamic dropdowns was edited to support things like quotes and other "special" characters in the products_options_values_name that was incorporated first which then was applied to single attributes for consistency (which is what the referenced post addresses).

So, a similar change is needed to the dynamic dropdowns file(s) as was done for single attributes. I'm on my phone at the moment which makes it a little difficult to provide all of the change correctly/quickly, but the file in question is: includes/classes/pad_sba_sequenced_dropdowns.php

Then at line 833 modifying:

   $out.='"_' . $oval['id'] . '"' . ': "' . zen_output_string_protected($oval['text']) . '", ';
> (if there are #s in there, ignore them/treat as spaces.
> To use the function provided by:
> ```
zen_output_string($values[$i]['text'], array('"' => '"', '\'' => ''', '<' => '<', '>' => '>', ' & ' => ' & ')) . '</option>' . "\n";

In place of the zen_output_string_protected portion of the above.

Thanks, edited the suggested line to be the following,

$out.='"_' . $oval['id'] . '"' . ': "' . zen_output_string($oval['text'], array('"' => '"', '\'' => ''', '<' => '<', '>' => '>', ' & ' => ' & ')) . '", ';

Unfortunately still no change :(

Have I edited correctly?

25 Feb 2018, 20:34
#2892
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

madshaun1984:

Thanks, edited the suggested line to be the following,

$out.='"_' . $oval['id'] . '"' . ': "' . zen_output_string($oval['text'], array('"' => '"', ''' => ''', '<' => '<', '>' => '>', ' & ' => ' & ')) . '", ';

> 
> Unfortunately still no change :(
> 
> Have I edited correctly?
Actually, there is/was a change, but not for the better. The code incorporated looks correct on its own; however, I believe the mix of single and double quotes within the line are causing issues and is part of why I was saying it's difficult on a cell phone. :)

What I suggest is to use a "temporary" variable that is to be set to the result of the zen_output_string function. That string variable is then used in place of the entire protected portion of the original code. This way the single/double quotes do not play a factor in the line that is puting together the javascriopt.

It could also be that in copying/pasting on either side (yours or mine) that some character "got in the way" that shouldn't be there.

Regardless suggest checking the logs directory again as page is only partially displayed.
25 Feb 2018, 20:41
#2893
madshaun1984 avatar

madshaun1984

New Zenner

Join Date:
Feb 2018
Posts:
19
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

mc12345678:

Actually, there is/was a change, but not for the better. The code incorporated looks correct on its own; however, I believe the mix of single and double quotes within the line are causing issues and is part of why I was saying it's difficult on a cell phone. :)

What I suggest is to use a "temporary" variable that is to be set to the result of the zen_output_string function. That string variable is then used in place of the entire protected portion of the original code. This way the single/double quotes do not play a factor in the line that is puting together the javascriopt.

It could also be that in copying/pasting on either side (yours or mine) that some character "got in the way" that shouldn't be there.

Regardless suggest checking the logs directory again as page is only partially displayed.

Hmmm, the page is displaying in full for me, but with no difference pre/post edit (the partial page I believe you saw was the result of me editing the line I eventually settled on and pasted into my last post).

I'll try the temp var suggestion you made now though, will update with results.

Also, is there anyway to step through website code in a similar fashion to a c# application? (I'm familiar with debugging via Visual studio, and have worked on asp.net apps / pure html / js sites previously, but never a live website that wasn't of my own creation), so not sure how it works with zen cart etc... This would save me keep coming back and might enable me to lend a better hand / start adding my own contributions.

Thanks again!

25 Feb 2018, 20:53
#2894
madshaun1984 avatar

madshaun1984

New Zenner

Join Date:
Feb 2018
Posts:
19
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

Update: adding the protected string to the temp var and then passing that through didn't make any difference.

$x = $out.='"_' . $oval['id'] . '"' . ': "' . zen_output_string_protected($oval['text']) . '", ';
		
		$out.='"_' . $x['id'] . '"' . ': "' . zen_output_string($x['text'], array('"' => '"', '\'' => ''', '<' => '<', '>' => '>', ' & ' => ' & ')) . '", ';

Pretty sure the edit I made last time was ok and have a hunch that there's still something deeper not quite right.

25 Feb 2018, 21:56
#2895
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

How about this
At line 833 of includes/classes/pad_sba_sequenced_dropdowns.php

change:

$out.='"_' . $oval['id'] . '"' . ': "' . zen_output_string_protected($oval['text']) . '", ';

to:

        $out.='"_' . $oval['id'] . '"' . ': "';
//        $out.=zen_output_string_protected($oval['text']);
        $out.=zen_output_string($oval['text'],
                  array(
                    '"' => '"',
                    '\'' => ''',
                    '<' => '<',
                    '>' => '>',
                    ' & ' => ' & ',
                    '& ' => '& '
                  )
              );
        $out.='", ';

So that area of code would go from:

      foreach ($attr['ovals'] as $oval) {
        $out.='"_' . $oval['id'] . '"' . ': "' . zen_output_string_protected($oval['text']) . '", ';[/TD]
      }

To:

      foreach ($attr['ovals'] as $oval) {
        $out.='"_' . $oval['id'] . '"' . ': "';
//        $out.=zen_output_string_protected($oval['text']);
        $out.=zen_output_string($oval['text'],
                  array(
                    '"' => '"',
                    '\'' => ''',
                    '<' => '<',
                    '>' => '>',
                    ' & ' => ' & ',
                    '& ' => '& '
                  )
              );
        $out.='", ';
      }

This is another way to accomplish the "interim" variable perspective and is a little cleaner to some extent but also not as easy to read.

There is something that was not right about how it was put together in the previous method/attempts and it currently still displays this html code which is causing the problem:

var txt3 = {"_38": "10ml ", "_<": "<", "_40": "50ml (+&pound;15.00) ", "_<": "<"};

It is this result that we are trying to modify. The ```
£


It should instead look like:

var txt3 = {"38": "10ml ", "<": "<", "40": "50ml (+&pound;15.00) ", "<": "<"};

25 Feb 2018, 22:32
#2896
madshaun1984 avatar

madshaun1984

New Zenner

Join Date:
Feb 2018
Posts:
19
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

Just added the change suggested, not getting an sba dropdown shown at all now, (partial page).

Rolled code back to as I pasted earlier.

Its as if these sections of code are having no impact on the string, or the string being processed by any replace method.

25 Feb 2018, 23:14
#2897
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

madshaun1984:

Just added the change suggested, not getting an sba dropdown shown at all now, (partial page).

Rolled code back to as I pasted earlier.

Its as if these sections of code are having no impact on the string, or the string being processed by any replace method.
The blank/partial blank page would have generated an error as described here: http://www.zen-cart.com/content.php?124-blank-page

The information from that would help identify what was causing the issue.

I didn't see anything that again modified the code content after that txt3 code is generated. I'll have to look at one of my test sites as set for an alternate currency to see how it plays out with the proposed change incorporated.

26 Feb 2018, 14:19
#2898
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

mc12345678:

The blank/partial blank page would have generated an error as described here: http://www.zen-cart.com/content.php?124-blank-page

The information from that would help identify what was causing the issue.

I didn't see anything that again modified the code content after that txt3 code is generated. I'll have to look at one of my test sites as set for an alternate currency to see how it plays out with the proposed change incorporated.
@madshaun1984, et al...

Ok, figured out what's going on.

There were two things, one was the additional encoding that caused £ to become $amp;pound; in the txtXXX section (should be addressed by the above change(s) though processing of the code may make that change unnecessary), the other is/was that when selecting a "parent" option, the child select options are added by pushing the content to the option list. This push (creating a new option) though populated the text of the option not the html of the option. I.e put £ directly in the output text instead of the more "inner" html. So, while this was tested for the change identified at line 1053 below it has not been tested in absence of the previously posed changes or other similar changes that I made on my test server. I do think the below changes would address the wrongful display of ```
£


I'm providing line numbers here working from the "bottom" to the "top" so that as each change is made the identified line numbers will still line up with the content on github at the moment (haven't pushed an update, just realized what needed to be done and proved that at least adding the change to line 1053 worked, though had also made some other changes as well that need to be validated as unnecessary.)

Between lines 1091 and 1092 having this content:
      $out.='), opt.substring(1));' . "\n";
      if ((STOCK_ALLOW_CHECKOUT == 'false' && ($curattr == count($attributes) - 2)) || PRODINFO_ATTRIBUTE_NO_ADD_OUT_OF_STOCK == 'True') {

Modify it to look like the below:
      $out.='), opt.substring(1));' . "\n";
      $out.='                        frm["id[' . $attributes[$nextattr]['oid'] . ']"].options[frm["id[' . $attributes[$nextattr]['oid'] . ']"].length].innerHTML = frm["id[' . $attributes[$nextattr]['oid'] . ']"].options[frm["id[' . $attributes[$nextattr]['oid'] . ']"].length].text;' . "\n";
      if ((STOCK_ALLOW_CHECKOUT == 'false' && ($curattr == count($attributes) - 2)) || PRODINFO_ATTRIBUTE_NO_ADD_OUT_OF_STOCK == 'True') {

and then again between lines 1066 and 1067 having this content:
      $out.='), opt.substring(1));' . "\n";
      if ((STOCK_ALLOW_CHECKOUT == 'false' && ($curattr == count($attributes) - 2)) || PRODINFO_ATTRIBUTE_NO_ADD_OUT_OF_STOCK == 'True') {

Modify it to look like:
      $out.='), opt.substring(1));' . "\n";
      $out.='                            frm["id[' . $attributes[$nextattr]['oid'] . ']"].options[frm["id[' . $attributes[$nextattr]['oid'] . ']"].length].innerHTML = frm["id[' . $attributes[$nextattr]['oid'] . ']"].options[frm["id[' . $attributes[$nextattr]['oid'] . ']"].length].text;' . "\n";
      if ((STOCK_ALLOW_CHECKOUT == 'false' && ($curattr == count($attributes) - 2)) || PRODINFO_ATTRIBUTE_NO_ADD_OUT_OF_STOCK == 'True') {

Between Lines 1052 and 1053 having this content:
    $out.=', opt.substring(1));' . "\n";
    $out.='                        }';

have it look like the following:
    $out.=', opt.substring(1));' . "\n";
    $out.='                            frm["id[' . $attributes[$nextattr]['oid'] . ']"].options[frm["id[' . $attributes[$nextattr]['oid'] . ']"].length].innerHTML = frm["id[' . $attributes[$nextattr]['oid'] . ']"].options[frm["id[' . $attributes[$nextattr]['oid'] . ']"].length].text;' . "\n";
    $out.='                        }';
26 Feb 2018, 22:02
#2899
madshaun1984 avatar

madshaun1984

New Zenner

Join Date:
Feb 2018
Posts:
19
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

Not had a chance to look at this today, been a long day.

Will try and get on ot tomorrow and report outcome.

Thanks again,
Shaun

26 Feb 2018, 22:51
#2900
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

madshaun1984:

Not had a chance to look at this today, been a long day.

Will try and get on ot tomorrow and report outcome.

Thanks again,
Shaun
Look forwards to the report. Thanks for identifying the issue.