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?

29 Oct 2015, 2:50 PM
#101
mc12345678 avatar

mc12345678

Totally Zenned

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

Post #101 by mc12345678

mattys:

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

matt

Figured out the why, now just need to implement a solution... Three schools of thought on resolution.

Issue is that the keys of the objects are numeric not text...

One solution is to incorporate a character into the keys and all references calling each object (stk, stk2, etc).

Second is to use an array that maintains the order.

Third is to basically create a storage class that offers operations to access the data and maintains the order...

The third appears to offer the most operational freedom but also the most javascript to the visitor. The first is probably easiest to implement but browsers may eventually sort on text keys as well resulting in the same result as seen above...

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

29 Oct 2015, 3:33 PM
#102
mattys avatar

mattys

Zen Follower

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

Post #102 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

29 Oct 2015, 3:52 PM
#103
mc12345678 avatar

mc12345678

Totally Zenned

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

Post #103 by mc12345678

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:

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:

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...).

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

29 Oct 2015, 4:02 PM
#104
mattys avatar

mattys

Zen Follower

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

Post #104 by mattys

mc12345678:

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.

How would one go about adding the underscore_?

mc12345678:

for which other great pains were taken to provide at least the above sequence

thanks for the work you have done on this, super quick response time too.

29 Oct 2015, 4:11 PM
#105
mc12345678 avatar

mc12345678

Totally Zenned

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

Post #105 by mc12345678

mattys:

How would one go about adding the underscore_?

thanks for the work you have done on this, super quick response time too.

Well, for the stk= portion that is buried in the Dynamic Dropdowns base class if I remember correctly, I may have overridden parts of it in the modified sba dropdown option... The other parts are in the sba dropdown class code such that when generating the javascript for say:

    for (opt in stk[frm['id[1]'].value]) {

Would read like:

    for (opt in stk["_"+frm['id[1]'].value]) {

I think that will work, but haven't tested it yet... It's just one thing I've seen as a way to concatenate two items (string with a value that is to be treated or type cast as a string eventually). It may need single quotes (') around the underscore or any single character as a possible requirement, a little "dabbling" to do. :)

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

10 Jan 2016, 11:36 PM
#106
ibuttons avatar

ibuttons

New Zenner

Join Date:
Nov 2008
Posts:
51
Plugin Contributions:
0

Post #106 by ibuttons

Has anyone successfully used Stock by Attributes 1.5.3 with and Responsive Sheffield Blue V 2.0 ?

I gave it a try today on brand new vanilla Zen Cart 1.5.5-beta with only Responsive Sheffield Blue V 2.0. It broke the admin area--all I get is a blank page and the install script in the admin area also did not work - just gave me a blank screen.

I could really use these both together. Anybody have experience with this?

TIA

10 Jan 2016, 11:45 PM
#107
ibuttons avatar

ibuttons

New Zenner

Join Date:
Nov 2008
Posts:
51
Plugin Contributions:
0

Post #107 by ibuttons

Is it possible to have horizontal tabs on the category pages (like you can on the product info pages)?

My products have a lot of technical info (like features, warranty, dimensions, colors, how to operate, etc) which is the same for each product model . It would be great if this information could be stored in tabs that expand when clicked, since there is so much to stuff to look through.

any suggestions would be appreciated.

tia

10 Jan 2016, 11:46 PM
#108
ibuttons avatar

ibuttons

New Zenner

Join Date:
Nov 2008
Posts:
51
Plugin Contributions:
0

Post #108 by ibuttons

Can the contents of the tabs (regardless of what page they are on) be "included" from a file, so that if/when the info has to be update, I only have to edit the included file? Also, this way, I can be sure that it is always the same on each place it is shown.

Any suggestions would be appreciated.

tia

11 Jan 2016, 12:05 AM
#109
mc12345678 avatar

mc12345678

Totally Zenned

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

Post #109 by mc12345678

ibuttons:

Has anyone successfully used Stock by Attributes 1.5.3 with and Responsive Sheffield Blue V 2.0 ?

I gave it a try today on brand new vanilla Zen Cart 1.5.5-beta with only Responsive Sheffield Blue V 2.0. It broke the admin area--all I get is a blank page and the install script in the admin area also did not work - just gave me a blank screen.

I could really use these both together. Anybody have experience with this?

TIA

First of all SBA 1.5.3 is for ZC 1.5.1... Not ZC 1.5.3 and above.. They have very different methods of communicating with the database and other interactions. Second, this particular thread was begun like many of the others after a conversation has continued at: https://www.zen-cart.com/showthread.php?47180-Stock-by-Attribute-v4-0-addon-for-v1-3-5-1-3-9

In that thread it has been identified that there is now a combined version of SBA that supports installation into each of the ZC versions 1.5.1, 1.5.3, 1.5.4, and a previous beta version of 1.5.5. It has yet not been tested/verified to be fully functional but has been merged with the applicable files. In fact there have been some improvements in ZC 1.5.5 that would remove the need to merge some if not most of the files that are otherwise modified for SBA to work with ZC. There does remain one or two functions that I can recall will still need to be overridden/merged because there is yet no notifiers or other overrides introduced into them.

So, the latest version of SBA originally begun by potteryhouse/jeking and described as part of this thread is being maintained at: https://github.com/mc12345678/Stock_By_Attributes_Combined

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

11 Jan 2016, 12:12 AM
#110
mc12345678 avatar

mc12345678

Totally Zenned

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

Post #110 by mc12345678

ibuttons:

Is it possible to have horizontal tabs on the category pages (like you can on the product info pages)?

My products have a lot of technical info (like features, warranty, dimensions, colors, how to operate, etc) which is the same for each product model . It would be great if this information could be stored in tabs that expand when clicked, since there is so much to stuff to look through.

any suggestions would be appreciated.

tia

No reason not to, but I don't see how that is related to Stock By Attributes, perhaps yet on another thread?

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

11 Jan 2016, 8:20 PM
#111
ibuttons avatar

ibuttons

New Zenner

Join Date:
Nov 2008
Posts:
51
Plugin Contributions:
0

Post #111 by ibuttons

Thank you for that info. I have downloaded the combined version from github (mc12345678/Stock_By_Attributes_Combined) and am trying it now. I have a few initial questions:

  1. Is there a readme or an installation doc for 1.5.5? The only readme I see is at the top level and it says:

This SBA Modification will only work with Zen Cart 1.5.1, Zen Cart 1.5.3 and Zen Cart 1.5.4.

  1. Under the includes/templates folder there are 2 folders at the same level. Why are there 2?

YOUR_CLASSIC_RESPONSIVE
YOUR_TEMPLATE

  1. Also, what should these be set to if I have already installed responsive_sheffield_blue? Obviously, I cannot set both to the same value (responsive_sheffield_blue) since they are in the same folder.

tia

11 Jan 2016, 8:30 PM
#112
ibuttons avatar

ibuttons

New Zenner

Join Date:
Nov 2008
Posts:
51
Plugin Contributions:
0

Post #112 by ibuttons

You are correct, that should have been posted on Responsive Sheffield Blue V 2.0! So sorry.

I could not find a way to delete or move a posting once submitted.

Let me know if you know how.

11 Jan 2016, 8:33 PM
#113
ibuttons avatar

ibuttons

New Zenner

Join Date:
Nov 2008
Posts:
51
Plugin Contributions:
0

Post #113 by ibuttons

Plz ignore. this post should have been posted on Responsive Sheffield Blue V 2.0!

11 Jan 2016, 9:48 PM
#114
mc12345678 avatar

mc12345678

Totally Zenned

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

Post #114 by mc12345678

ibuttons:

Thank you for that info. I have downloaded the combined version from github (mc12345678/Stock_By_Attributes_Combined) and am trying it now. I have a few initial questions:

  1. Is there a readme or an installation doc for 1.5.5? The only readme I see is at the top level and it says:
  1. Under the includes/templates folder there are 2 folders at the same level. Why are there 2?
  1. Also, what should these be set to if I have already installed responsive_sheffield_blue? Obviously, I cannot set both to the same value (responsive_sheffield_blue) since they are in the same folder.

tia

  1. Nothing highly specific has been written other than the few comments in the thread referenced above... The software has not been fully tested on ZC 1.5.5, simply merged from what was available from zc 1.5.4. There is a helpfile generated by potteryhouse/jeking at http://github.com/potteryhouse that is expected to be updated when this is posted for update on the zc site.

  2. and 3. If you have become familiar with ZC 1.5.5, then will see that there are two templates. To support installation into either (both) templates the override files were incorporated to each... For any other template, merging of the code would need to follow a similar process of identifying the differences applied by the code against a default template and incorporating the same changes into whatever template is being used... Again not exactly sure whiich of the two directories would be needed, but would think that the responsive template folder for a responsive template would be applicable/appropriate...

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

11 Jan 2016, 9:49 PM
#115
mc12345678 avatar

mc12345678

Totally Zenned

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

Post #115 by mc12345678

ibuttons:

You are correct, that should have been posted on Responsive Sheffield Blue V 2.0! So sorry.

I could not find a way to delete or move a posting once submitted.

Let me know if you know how.

If "caught" within a short time period, then the original author can modify the post, after that a forum admin/moderator would be able to address changes/moves.

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

23 Jan 2016, 12:00 AM
#116
muteyaar avatar

muteyaar

Zen Follower

Join Date:
Oct 2007
Posts:
134
Plugin Contributions:
0

Post #116 by muteyaar

Hi,
I wish to use this module on my website, but I do not need to maintain stock by attributes for all categories.
Is there any way that i can use the stock by attributes for only ONE category?

If you can help me in this regard, I will be very thankful to you.

23 Jan 2016, 6:03 AM
#117
mc12345678 avatar

mc12345678

Totally Zenned

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

Post #117 by mc12345678

muteyaar:

Hi,
I wish to use this module on my website, but I do not need to maintain stock by attributes for all categories.
Is there any way that i can use the stock by attributes for only ONE category?

If you can help me in this regard, I will be very thankful to you.

You can use SBA to control the stock on a single product if that is all that is desired...not sure what suggests otherwise...

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

23 Jan 2016, 6:33 AM
#118
muteyaar avatar

muteyaar

Zen Follower

Join Date:
Oct 2007
Posts:
134
Plugin Contributions:
0

Post #118 by muteyaar

mc12345678:

You can use SBA to control the stock on a single product if that is all that is desired...not sure what suggests otherwise...

Do you mean that I can use this MOD without any alteration for a single category or item?
Some items in one category need stock by attributes, but all other items in all other categories do not need stock by attributes.
So, can I really use this MOD just as available in downloads section to solve my problem?

23 Jan 2016, 11:27 AM
#119
mc12345678 avatar

mc12345678

Totally Zenned

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

Post #119 by mc12345678

muteyaar:

Do you mean that I can use this MOD without any alteration for a single category or item?
Some items in one category need stock by attributes, but all other items in all other categories do not need stock by attributes.
[B]So, can I really use this MOD just as available in downloads section to solve my problem[/B?

Ahhh, well that might be an issue at the moment... The work of potteryhouse/jeking has been further modified and upgraded. The most current version of it can be located at http://github.com/mc12345678/Stock_By_Attributes_Combined

The version available for download (written for ZC 1.5.1) as I recall will work with. Product that have single attributes, but doesn't display correctly for multiple attributes and I forget what caveats were added to permit use of the plugin on stores that have attributes but aren't tracked by SBA... It is intended to be updated shortly but there are a few other odds and ends to do to support understanding how everything fits together. In the mean time there are instructions on github under potteryhouse's files: https://github.com/potteryhouse.

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