Zen Cart Logo
If this is your first visit, check our documentation. To post, register or login.
Forums / Community Contributed Add-Ons / All Other Contributions/Addons / "Stock by Attributes" (version 1.5.3). This MOD is ONLY for v1.5.1 ..whaddda?

"Stock by Attributes" (version 1.5.3). This MOD is ONLY for v1.5.1 ..whaddda?

1 Jul 2015, 11:03 PM
#81
malaperth avatar

malaperth

New Zenner

Join Date:
Dec 2013
Location:
Maine
Posts:
77
Plugin Contributions:
0

Post #81 by malaperth

mc12345678:

Another user identified a similar issue to an extent, though identified the issue a different way. In the setup provided, a quantity of 1 was displayed as available although 0 was entered. There was a logic error in the zen_products_stock code that caused this issue. It has been resolved in the latest set of files for SBA 1.5.4 and as soon as I have compared the SBA 1.5.3 files against a vanilla install to validate that the only changes are those necessary to support the plugin changes. Haven't since been able to reproduce the problem described. So should be good to go with the newest files for SBA 1.5.4 and soon for SBA 1.5.3.

Do you by any chance have the code that needs to be changed in zen_products_stock to fix this problem? I've been too busy to test the new version for 1.5.1 and the site owner does not want it installed without lots of testing (I can understand that).

Mal

1 Jul 2015, 11:34 PM
#82
mc12345678 avatar

mc12345678

Totally Zenned

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

Post #82 by mc12345678

Malaperth:

Do you by any chance have the code that needs to be changed in zen_products_stock to fix this problem? I've been too busy to test the new version for 1.5.1 and the site owner does not want it installed without lots of testing (I can understand that).

Mal

That issue is resolved in both versions. There remain some known issues that are primarily documented in the SBA 1.5.4 version of github. As they are resolved, they are carried over to the SBA 1.5.3 version.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

13 Jul 2015, 11:39 AM
#83
simon1066 avatar

simon1066

Totally Zenned

Join Date:
Feb 2009
Location:
UK
Posts:
1,326
Plugin Contributions:
0

Post #83 by simon1066

Zen Cart v1.54
SBA v1.54
Zen Magnific v1.5

So, I can get the main product image to change according to the attribute selected, but I've hit a brick wall when it comes to clicking on the attribute image to view its larger version.

I'm using a lightbox to display the larger images but for simplicity sake and to make it more relevant to this thread it might be best to use the stock SBA code in tpl_modules_main_product_image.php

<script language="javascript" type="text/javascript"><!--
document.write('<?php echo '<a href="javascript:popupWindow(\\\'' . zen_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $_GET['products_id']) . '\\\')">' . zen_image(addslashes($products_image_medium),
 addslashes($products_name), MEDIUM_IMAGE_WIDTH, MEDIUM_IMAGE_HEIGHT,'id="SBA_ProductImage"') . '<br /><span class="imgLink">' . TEXT_CLICK_TO_ENLARGE . '</span></a>'; ?>');
//--></script>

I think that the

FILENAME_POPUP_IMAGE, 'pID=' . $_GET['products_id']

has to be replaced with something like

$products_image_large, $products_name, LARGE_IMAGE_WIDTH, LARGE_IMAGE_HEIGHT

with the $products_image_large being defined in \modules\main_product_image.php and I probably need to reference the 'attributes_image' field from TABLE_PRODUCTS_ATTRIBUTES

I'm stuck. Has anyone been able to get a larger version of the attribute image?

If it helps, the relevant bit of my lightbox (Zen Magnific) code in tpl_modules_main_product_image.php is

document.write('<?php echo $relBOF . '<a href="' . zen_magnific($products_image_large, addslashes($products_name), LARGE_IMAGE_WIDTH, LARGE_IMAGE_HEIGHT) . '" class="' . "nofollow" . '" title="' . addslashes($products_name) . '">' . zen_image($products_image_medium, addslashes($products_name), MEDIUM_IMAGE_WIDTH, MEDIUM_IMAGE_HEIGHT,'id="SBA_ProductImage"') . '<br /><span class="imgLink">' . TEXT_CLICK_TO_ENLARGE . '</span></a>' . $relEOF; ?>');

Simon

14 Jul 2015, 11:23 AM
#84
simon1066 avatar

simon1066

Totally Zenned

Join Date:
Feb 2009
Location:
UK
Posts:
1,326
Plugin Contributions:
0

Post #84 by simon1066

Great, I've been able to get the large image of the attribute in my lightbox by using

$products_options->fields['attributes_image']

in the link to the larger image. Trouble is it only links to the last attribute in the set and doesn't 'switch' when SBA switches the main product image.

Simon

14 Jul 2015, 3:37 PM
#85
mc12345678 avatar

mc12345678

Totally Zenned

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

Post #85 by mc12345678

I added the previous post to the github repository to address this overall issue. I haven't looked into it yet, but it would seem that the overall process isn't taking into account the jscript/jquery (whatever was used) transformation/status of what is changed. Either, SBA isn't providing the modified image with the standard data to support the follow-on lightbox, or perhaps not the data necessary to support it.

Yes, providing ```
$products_options->fields['attributes_image']


Overall, I believe that this feature is still in development although it has not been something that I have put focus on in comparison to the other functional aspects of the base SBA processing and display.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

17 Jul 2015, 11:49 AM
#86
simon1066 avatar

simon1066

Totally Zenned

Join Date:
Feb 2009
Location:
UK
Posts:
1,326
Plugin Contributions:
0

Post #86 by simon1066

mc12345678:

I added the previous post to the github repository to address this overall issue. I haven't looked into it yet, but it would seem that the overall process isn't taking into account the jscript/jquery (whatever was used) transformation/status of what is changed. Either, SBA isn't providing the modified image with the standard data to support the follow-on lightbox, or perhaps not the data necessary to support it.

Yes, providing ```
$products_options->fields['attributes_image']

> 
> Overall, I believe that this feature is still in development although it has not been something that I have put focus on in comparison to the other functional aspects of the base SBA processing and display.

Thank you for that. I think I also concluded that jscript was need to make the change - I had a play but to no avail.

As a workaround, I've copied the attribute images as additional images - this means that when the dynamically displayed attribute images are clicked a large version (additional images) are shown in the lightbox.

The issue with this is that the first image displayed in the lightbox is not always the same as the attribute that was clicked,

and the additional images on the product_info page need to be hidden.

Both of these I can live with for the time being.

Thanks again

Simon

Simon

14 Aug 2015, 9:07 AM
#87
marton_1 avatar

marton_1

Totally Zenned

Join Date:
Apr 2013
Location:
eglisau switzerland
Posts:
568
Plugin Contributions:
0

Post #87 by marton_1

Apologies if this has been raised before, I did a search and did not find anything!

If I have a product where more than one attribute is set as "dropdown" then no attributes show up on the product listing. I mean there are no attributes shown to select or choose from.
Is there a fix for this or is it a feature :)

I have the latest plug in from the plugins section, classic template and v1.5.1.

14 Aug 2015, 9:23 AM
#88
mc12345678 avatar

mc12345678

Totally Zenned

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

Post #88 by mc12345678

marton_1:

Apologies if this has been raised before, I did a search and did not find anything!

If I have a product where more than one attribute is set as "dropdown" then no attributes show up on the product listing. I mean there are no attributes shown to select or choose from.
Is there a fix for this or is it a feature :)

I have the latest plug in from the plugins section, classic template and v1.5.1.

This is partially a "feature". There are a few things. One verify the stock quantity in your admin for the product and it's individual variants. Basically if stock is present for one or more combinations of the attributes for that product and no choices appear on the product info page, then verify that the page passes html validation. If the attribute combinations are out-of-stock, you could setup the variants to be displayed with out-of-stock next to them. If however, it is not desired to identify out-of-stock, at the there is not yet a statement added to state that the product is out-of-stock and this results in "blank" being shown.

It is identified in the sequenced_sba_dropdown code where such a statement is needed, but it hasn't been written yet... It isn't expected to be difficult/complex, just hadn't done it yet and wasn't sure what wording would be desired. :)

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

14 Aug 2015, 9:53 AM
#89
marton_1 avatar

marton_1

Totally Zenned

Join Date:
Apr 2013
Location:
eglisau switzerland
Posts:
568
Plugin Contributions:
0

Post #89 by marton_1

mc12345678:

This is partially a "feature". There are a few things. One verify the stock quantity in your admin for the product and it's individual variants. Basically if stock is present for one or more combinations of the attributes for that product and no choices appear on the product info page, then verify that the page passes html validation. If the attribute combinations are out-of-stock, you could setup the variants to be displayed with out-of-stock next to them. If however, it is not desired to identify out-of-stock, at the there is not yet a statement added to state that the product is out-of-stock and this results in "blank" being shown.

It is identified in the sequenced_sba_dropdown code where such a statement is needed, but it hasn't been written yet... It isn't expected to be difficult/complex, just hadn't done it yet and wasn't sure what wording would be desired. :)

Thanks for your lightning fast reply.

I did check the stock quantities are OK, will do the other check :)

29 Oct 2015, 9:29 AM
#90
mattys avatar

mattys

Zen Follower

Join Date:
Sep 2006
Location:
North Devon, England, UK
Posts:
289
Plugin Contributions:
0

Post #90 by mattys

i am using SBA Version 1.5.4 for Zen Cart Version 1.5.4, but on zencart 1.5.3

is working, but with a few niggles

one of them being the sort order of colours, e.g. https://www.jarbon.com/alpaca-socks/alpaca-country-socks/alpaca-country-socks, if you first select shoe size you will then see the colour options, these are in the incorrect order, as set in attributes controller

SBA is setting the sort order by attribute value ID, lowest first:

<select name="id[3]" onchange="i3(this.form);"> <option value="0" selected="selected">Next select colour</option> <option value="18">Black </option><option value="21">dark green </option><option value="272">Red </option><option value="367">damson </option><option value="370">natural white </option></select>

this is overriding the order i set in attributes controller

i tried using the sort order you get when adding stock, but this didnt work

any ideas how this might be fixed?

29 Oct 2015, 10:21 AM
#91
mc12345678 avatar

mc12345678

Totally Zenned

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

Post #91 by mc12345678

mattys:

i am using SBA Version 1.5.4 for Zen Cart Version 1.5.4, but on zencart 1.5.3

is working, but with a few niggles

one of them being the sort order of colours, e.g. https://www.jarbon.com/alpaca-socks/alpaca-country-socks/alpaca-country-socks, if you first select shoe size you will then see the colour options, these are in the incorrect order, as set in attributes controller

SBA is setting the sort order by attribute value ID, lowest first:

<select name="id[3]" onchange="i3(this.form);"> <option value="0" selected="selected">Next select colour</option> <option value="18">Black </option><option value="21">dark green </option><option value="272">Red </option><option value="367">damson </option><option value="370">natural white </option></select>

this is overriding the order i set in attributes controller

i tried using the sort order you get when adding stock, but this didnt work

any ideas how this might be fixed?

Looked at site... Order of attributes was different than described above and appeared to match the sequence of the items in the javascript as expected. What was done to resolve your issue? I wasn't able to reproduce it.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

29 Oct 2015, 10:33 AM
#92
mattys avatar

mattys

Zen Follower

Join Date:
Sep 2006
Location:
North Devon, England, UK
Posts:
289
Plugin Contributions:
0

Post #92 by mattys

This is how they are ordered:

<select name="id[3]" onchange="i3(this.form);"> <option value="0" selected="selected">Next select colour</option> <option value="18">Black </option> <option value="21">dark green </option> <option value="272">Red </option> <option value="367">damson </option> <option value="370">natural white </option> </select>

as you can see, ordered numerically by attribute option value

they should be ordered as per:
Attachment 15753

29 Oct 2015, 10:40 AM
#93
mc12345678 avatar

mc12345678

Totally Zenned

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

Post #93 by mc12345678

That's the sequence my browser presents and how I see it... Sorry can't take a screen capture... Try a dfferent browser or something, as the issue makes little sense unless they were originally filtered in that order, the page loaded, the order changed, and the page "reloaded"... When dealing with attributes, not clearing the cache/session can cause changes to not appear.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

29 Oct 2015, 10:55 AM
#94
mattys avatar

mattys

Zen Follower

Join Date:
Sep 2006
Location:
North Devon, England, UK
Posts:
289
Plugin Contributions:
0

Post #94 by mattys

Here are 3 screen grabs, one for firefox, one for ie, one for chrome, all the incorrect order:

Chrome
Attachment 15754

firefox
Attachment 15755

internet explorer
Attachment 15756

they all list the colours numerically, which is incorrect:

Black
dark green
Red
damson
natural white

i would like them to be ordered as i have set them up in attributes controller:

natural white
Black
damson
Red
dark green

Attachment 15757

P.S.
The client also sees the incorrect order, so, not just me.

29 Oct 2015, 11:31 AM
#95
mc12345678 avatar

mc12345678

Totally Zenned

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

Post #95 by mc12345678

Here is the source code that I see whch produces the desired order as expected:

<tr><td align="right" class="main"><b>colour:</b></td><td class="main"><select name="id[3]" onchange="i3(this.form);">
  <option value="0" selected="selected">Next select colour</option>
</select>
</td></tr>
<tr><td> </td><td><span id="oosmsg" class="errorBox"></span>
<tr><td colspan="2"> 
<script type="text/javascript" language="javascript"><!--
  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}};
  var stk2={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}};
  var txt3={370:'natural white ',18:'Black ',367:'damson ',272:'Red ',21:'dark green '};
  function i1(frm) {
    var displayshown = false;
    var span=document.getElementById("oosmsg");
    while (span.childNodes[0]) {
      span.removeChild(span.childNodes[0]);
    }
    frm['id[3]'].length=1;
    for (opt in stk[frm['id[1]'].value]) {
      if (typeof stk2[frm['id[1]'].value] != "undefined") {
        if (typeof stk2[frm['id[1]'].value][opt] != "undefined") {
          frm['id[3]'].options[frm['id[3]'].length]=new Option(txt3[opt],opt);
        } else {
          frm['id[3]'].options[frm['id[3]'].length]=new Option(txt3[opt] + '- Unavailable ',opt);
        }
      } else {
        frm['id[3]'].options[frm['id[3]'].length]=new Option(txt3[opt] + '- Unavailable ',opt);
        if (displayshown != true) {
          alert('All selections of the attributes below this one are Out of Stock. Please select a different option.');
          stkmsg(frm);
          displayshown=true;
        }
      }
    }

The mportant part being the sequence ofthe sub groups of stk.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

29 Oct 2015, 11:43 AM
#96
mc12345678 avatar

mc12345678

Totally Zenned

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

Post #96 by mc12345678

Also, may want to correct the validation issues with that page (and likely other product pages).

Further, may want to try turning off the Dynamic Dropdown part and see if the same result or different. May have sme sort of Javascript conflict not appearing on my device.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

29 Oct 2015, 11:48 AM
#97
mattys avatar

mattys

Zen Follower

Join Date:
Sep 2006
Location:
North Devon, England, UK
Posts:
289
Plugin Contributions:
0

Post #97 by mattys

I can see that the code looks like it should be working, but it would be great if you could provide a screen grab of it working as a drop down, can you sort this please?

the javascript code above appears after the drop downs, i wander whether this is why the sort order isnt working??

29 Oct 2015, 11:50 AM
#98
mattys avatar

mattys

Zen Follower

Join Date:
Sep 2006
Location:
North Devon, England, UK
Posts:
289
Plugin Contributions:
0

Post #98 by mattys

mc12345678:

Also, may want to correct the validation issues with that page (and likely other product pages).

Further, may want to try turning off the Dynamic Dropdown part and see if the same result or different. May have sme sort of Javascript conflict not appearing on my device.

ok, i'll try this

thanks

29 Oct 2015, 12:00 PM
#99
mattys avatar

mattys

Zen Follower

Join Date:
Sep 2006
Location:
North Devon, England, UK
Posts:
289
Plugin Contributions:
0

Post #99 by mattys

i plumped for deactivating dynamic drop downs, all seems to be working now

matt

29 Oct 2015, 12:14 PM
#100
mattys avatar

mattys

Zen Follower

Join Date:
Sep 2006
Location:
North Devon, England, UK
Posts:
289
Plugin Contributions:
0

Post #100 by mattys

actually, deactivating dynamic drop down creates to many issues, so am reactivating, will investigate why javascript order not being displayed

matt