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,344

Results 2,421 to 2,440 of 3,609
05 Jan 2016, 23:43
#2421
jnabird333 avatar

jnabird333

New Zenner

Join Date:
Dec 2015
Location:
Ohio
Posts:
16
Plugin Contributions:
0

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

I noticed that the dynamic dropdowns are working for the items with only one dropdown menu (which by the way I do not want my custom ID to show in the drop down menus). If there are 2 drop down menus (1 for size and 1 for color), it's not showing any qty or custom ID. However, I noticed that on the items that have additional charges like sizes 2X and 3X are showing 2 dollar amounts and I have no idea where the first one (the lower one) came from. Where is this at?

2XL (+$1.66) (+$2.00)

Alana

05 Jan 2016, 23:45
#2422
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

jnabird333:

I apologize for the delayed response...day job. :)

I am using a radio button for the one color because there is only one color. I did add in a display only "Please select..." so that a drop down would show and it did't change anything.

I had not even looked at the dynamic dropdowns menu until you said something about it. I set the ZC default HTML Attribute Tags to false as instructed. I noticed that the drop down menus have not changed. Below are the settings I have for that screen.

Dynamic Drop Downs
Title Value
Enable Dynamic Dropdowns 1
Product Info Single Attribute Display Plugin sba_sequenced_dropdowns
Product Info Multiple Attribute Display Plugin sba_sequenced_dropdowns
Use ZC default HTML Attribute Tags false
Show Out of Stock Attributes True
Mark Out of Stock Attributes Right
SBA Number of Records to Displayed 25
Display Out of Stock Message Line True
Prevent Adding Out of Stock to Cart True
Display Javascript Popup for Out-of-Stock Selection True

If the entire group is out of stock, then it will show out of stock when you look at your cart. For example, if you choose a small JK T-shirt in pink, it will show out of stock. But, if you choose a small zip hoodie in grey, it will NOT and I have that item as a quantity of 0.

I am completely new to Zen Cart and running a website as a whole. I am learning as I go. So, if there is something else that I need to look at, then please let me know. If I missed any info, it was not done intentionally...I just don't know what else you would need to see.

Alana
Understand about not being sure of what is needed... The above is a good start to the overall issues. At the moment, I would suggest Enable Dynamic Dropdowns to be set to 2 (Multiple Attributes Only). (There is other code that provides "pretty" dropdowns for single attribute display and I haven't gone through the effort to modify Dynamic Dropdowns to work as well or better than that for single attributes...)

Normally at this point I would also ask for the specific variant setup for the product, but I think that you have provided or partially provided it. So I actually think this may be an installation issue. There is very little that is touched by this plugin in the template arena, but, it seems like if the above were set as true, the page(s) are not rendering the full content because I can't find the expected javascript on the page...

So do you have the file: tpl_modules_attributes.php located in:
includes/templates/valyria/templates ?

Or is there now a directory called:
includes/templates/YOUR_TEMPLATE/templates that has that plus four other files?

If that is the case, also would question what version of the attributes.php file is located at: includes/modules/valyria/

05 Jan 2016, 23:54
#2423
jnabird333 avatar

jnabird333

New Zenner

Join Date:
Dec 2015
Location:
Ohio
Posts:
16
Plugin Contributions:
0

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

mc12345678:

Understand about not being sure of what is needed... The above is a good start to the overall issues. At the moment, I would suggest Enable Dynamic Dropdowns to be set to 2 (Multiple Attributes Only). (There is other code that provides "pretty" dropdowns for single attribute display and I haven't gone through the effort to modify Dynamic Dropdowns to work as well or better than that for single attributes...)

Normally at this point I would also ask for the specific variant setup for the product, but I think that you have provided or partially provided it. So I actually think this may be an installation issue. There is very little that is touched by this plugin in the template arena, but, it seems like if the above were set as true, the page(s) are not rendering the full content because I can't find the expected javascript on the page...

So do you have the file: tpl_modules_attributes.php located in:
includes/templates/valyria/templates ?

Or is there now a directory called:
includes/templates/YOUR_TEMPLATE/templates that has that plus four other files?

If that is the case, also would question what version of the attributes.php file is located at: includes/modules/valyria/

Yes, that php file is in the includes/templates/valyria/templates. I made sure to change the YOUR_TEMPLATE folder to valyria before I uploaded the files. The attributes.php file that is located in includes/modules/valyria is yours...Here's the beginning info.

  • attributes module
  • Prepares attributes content for rendering in the template system
  • Prepares HTML for input fields with required uniqueness so template can display them as needed and keep collected data in proper fields
  • @package modules
  • @copyright Copyright 2003-2012 Zen Cart Development Team
  • @copyright Portions Copyright 2003 osCommerce
  • @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
  • @version GIT: $Id: Author: Ian Wilson Tue Aug 14 14:56:11 2012 +0100 Modified in v1.5.1 $
  • Stock by Attributes 1.5.4 : mc12345678 16-01-02
    */

I updated the setting for the enable dynamic dropdowns as suggested. What do these settings stand for?

05 Jan 2016, 23:57
#2424
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

jnabird333:

I noticed that the dynamic dropdowns are working for the items with only one dropdown menu (which by the way I do not want my custom ID to show in the drop down menus). If there are 2 drop down menus (1 for size and 1 for color), it's not showing any qty or custom ID. However, I noticed that on the items that have additional charges like sizes 2X and 3X are showing 2 dollar amounts and I have no idea where the first one (the lower one) came from. Where is this at?

2XL (+$1.66) (+$2.00)

Alana

I would disagree, the dynamic dropdowns if active would present the first attribute saying please select this, and the second attribute would state "Next select.." and upon selection would have nothing to select.

So, today have had two individuals request something to be done about the customid not being displayed in dropdowns but want it elsewhere... Guess it's time to add another admin switch.. Once I figure out what it is expected to be in the final code I can post a sql statement here.

Regarding those prices? It looks like there is some form of tax possibly being applied (removed) or possibly a sale... The addition of text to the dropdown again is primarily covered in the includes/classes/observers/class.products_with_attributes_stock.php file in the code that is observing for the notifier to tell it to "run"...

To immediately address the customid for display on the attributes listing, please see the post within the last where line numbers were provided within the class file and it can be modified.

06 Jan 2016, 00:03
#2425
jnabird333 avatar

jnabird333

New Zenner

Join Date:
Dec 2015
Location:
Ohio
Posts:
16
Plugin Contributions:
0

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

mc12345678:

I would disagree, the dynamic dropdowns if active would present the first attribute saying please select this, and the second attribute would state "Next select.." and upon selection would have nothing to select.

So, today have had two individuals request something to be done about the customid not being displayed in dropdowns but want it elsewhere... Guess it's time to add another admin switch.. Once I figure out what it is expected to be in the final code I can post a sql statement here.

Regarding those prices? It looks like there is some form of tax possibly being applied (removed) or possibly a sale... The addition of text to the dropdown again is primarily covered in the includes/classes/observers/class.products_with_attributes_stock.php file in the code that is observing for the notifier to tell it to "run"...

To immediately address the customid for display on the attributes listing, please see the post within the last where line numbers were provided within the class file and it can be modified.

My dropdown menus are not displaying that...they look the same as they were before I installed SBA.

Yes, I do have them as a taxable good BUT only if they are purchased within my state. I will look into those files to see what I can modify for the other two items.

Please include directions on how to do the sql statement....sorry newbie.

06 Jan 2016, 00:28
#2426
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

jnabird333:

Yes, that php file is in the includes/templates/valyria/templates. I made sure to change the YOUR_TEMPLATE folder to valyria before I uploaded the files. The attributes.php file that is located in includes/modules/valyria is yours...Here's the beginning info.

  • attributes module
  • Prepares attributes content for rendering in the template system
  • Prepares HTML for input fields with required uniqueness so template can display them as needed and keep collected data in proper fields
  • @package modules
  • @copyright Copyright 2003-2012 Zen Cart Development Team
  • @copyright Portions Copyright 2003 osCommerce
  • @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
  • @version GIT: $Id: Author: Ian Wilson Tue Aug 14 14:56:11 2012 +0100 Modified in v1.5.1 $
  • Stock by Attributes 1.5.4 : mc12345678 16-01-02
    */

I updated the setting for the enable dynamic dropdowns as suggested. What do these settings stand for?

So, perhaps a little history if I am able to provide some without too much butchery.. SBA was first being developed, it spawned off into multiple branches, each being developed with one or more goals, someone wanted to have multiple attributes, someone wanted one attribute, this or that and they pretty much all said that they could do the same thing, but never really able to do so. Then, somebody (credit is still given in the files but I forget who it is/was) got creative and tried to make a way using javascript to provide all of the options available for the product and when it was in stock to show how much was in stock. Generally it worked to some extent though as provided it pretty much required every product that had attributes to be tracked by SBA if the attributes were to be selectable in a multiple attribute environment.

Needless to say, there were about three or four "versions" of SBA that were out there. Some incorporated Dynamic Dropdowns (requiring all attribute product to be tracked by SBA), some did not and only offered single attribute product stock tracking. So, then came along potteryhouse and jeking about 2 years ago I think it was now. They picked up a lot of the pieces, sat down to get something that worked and gave some of the additional features that seemed lacking/needed to meet their business needs. They specifically were targeting single attribute type product, but were keeping things clean-n-clear to possibly handle multiple attributes. Some time around then I was put into contact with the two of them and began poking around to see what could be done with it.

Anyways, the concept of Dynamic Dropdowns became tempting as compared to just displaying a list of options in multiple places, but again, installing that plugin meant an all or nothing approach. So, instead, modified the template file so that it could be active as desired and while at it to activate only a "portion" of it if necessary/desired. Well, seeing that potteryhouse/jeking had developed a sort of "informative" dropdown for single attributes, I saw no reason to work on revising the single dropdown version of dynamic dropdowns if there was already something functional and there was other work to be done... So, the one setting requested to be changed was to activate dynamic dropdowns only for multiple attribute product. If the option name box for dropdowns was set to the SBA dropdown list also created by potteryhouse/jeking then it will provide the additional "scripting" to display.

So then, why all these options and things? Well, ZC is an open source platform, the file(s) added/modified by this plugin have been done so that users of historical copies that have overcome this issue or that can continue to use that modified version to their liking but also to use the modified version provided here. Now those things that have been started here specifically I don't have a hard spot with improving upon because well, what was created for this plugin well, if broke needs fixing.. :)

I did forget to mention that there is another plugin that is out there that is supposed to be compatible with SBA, though I haven't tried it in a while, it has to do with grids and product selection such that there is a column and a heading where product is selected by entering at the intersection of the two the desired number of items to add to the cart. I have some proposed modifications to it as well so that it would play a little nicer with ZC overall, but that too is on a back burner for now.. Only have so much that can be done in so little time. :)

So... Your issue though....

If the file(s) are where they are said to be (no reason not to believe) and seeing the template that is being used, it would seem to me that the file tpl_modules_attributes.php actually isn't used at all by the template and would need to track down how it is displaying/selecting the items being displayed... Probably something that calls (include or require) attributes.php, or something that echoes $options_name, $options_comment, $options_menu, etc...

06 Jan 2016, 00:33
#2427
jnabird333 avatar

jnabird333

New Zenner

Join Date:
Dec 2015
Location:
Ohio
Posts:
16
Plugin Contributions:
0

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

mc12345678:

Regarding those prices? It looks like there is some form of tax possibly being applied (removed) or possibly a sale... The addition of text to the dropdown again is primarily covered in the includes/classes/observers/class.products_with_attributes_stock.php file in the code that is observing for the notifier to tell it to "run"...

I have isolated it to it taking into account the sale I have on the t-shirts. If I remove the sale, they display correctly. If I turn it back on, the additional amounts are there. Why is it figuring in the sale on the additional cost especially since it is a set amount off and not a set percentage?

Quite honestly, when I try to read the php files, I get very confused trying to figure out where to make a change as I do not have line numbers on my page when I am editing.

06 Jan 2016, 00:37
#2428
michael_rebreathe avatar

michael_rebreathe

New Zenner

Join Date:
Jul 2015
Posts:
43
Plugin Contributions:
0

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

mc12345678:

Are you saying that if you goto the option Names Manager and look at the ID for the Color option that it has the same ID as the Bottle Size option? Are you able to provide a link to look at where this is an issue? Have you tried creating another product with those option names and values to see if the same issue carries over or if it is something that just got "created" with this product? Possibly tried to recreate the option name(s) and assign to the product, etc... ?

Sorry to not state what I considered obvious. Each Option Name has its own distinct ID, as does each Option Value. Out of the non-db-constrained unique fields, the only differences between the options is the option name and products_options.products_options_track_stock

mc12345678:

As to how the variant(s) are populated for that product, are you doing:
Stock ID:
X having color and capacity assigned with a quantity of availability for that combination and associated customid, or are you doing:

Stock ID:
X color quantity of "color" and customid (if one assigned).
Y capacity quantity of "capacity" and customid (if one assigned).

such that there is a color availability of quantity W and capacity of Z and the availability is the lesser of the two?

Doesn't exactly seem to be an issue specifically with the plugin, but something that has been discovered through its use...

Regarding the field(s), I don't see that products_options_track_stock is currently a part of this plugin. I believe that the original Dynamic Dropdowns plugin (earlier version of this plugin included it as was) included that field, but I think I removed it for the time being so that it wouldn't negatively affect databases until fully/properly incorporated.. So an earlier installation of some type may have used that data, though I can't say that I have seen (though haven't dug deep into all) a publicly available set of code that made that additional field directly accessible (ie not requiring database manipulation through external sql or phpmyadmin modification). Otherwise, only having the one "table" as the restraining location seems to me to be a little limiting, but development does have to start/go somewhere. :) At the moment though, this code does not "respect" the setting in that table field. At the same time, installation does not remove it if it is there just doesn't add it nor read it, directly.. Sure if pulls all fields from the table then it would be included, but isn't currently a part of the operation.

Stock ID:
Capacity: Slim (2.5ml) Color: Clear Qty: 3
Capacity: Slim (2.5ml) Color: Black Qty: 8
Capacity: Slim (2.5ml) Color: Blue Qty: 7
Capacity: Slim (2.5ml) Color: Orange Qty: 12
Capacity: Slim (2.5ml) Color: Pink Qty: 4
Capacity: Large (5.0ml) Color: Clear Qty: 6
Capacity: Large (5.0ml) Color: Black Qty: 10
Capacity: Large (5.0ml) Color: Blue Qty: 7
Capacity: Large (5.0ml) Color: Orange Qty: 2
Capacity: Large (5.0ml) Color: Pink Qty: 6

Capacity is one Option with Slim and Large as options values
Color is the other option with Clear, Black, Blue, Orange and Pink as options values
We track all inventory by product for products with no attributes, Product AND attribute 1 for single-option products, and Product AND attribute 1 AND attribute 2 for two-option products. There's no product in our catalog where we stock by one attribute and can change the second attribute on-the-fly.

Each SKU is unique to the products_with_attributes_stock.stock_id (items with attributes) or products.products_id (items without attributes). We have an additional module we created, which creates SKUs for each stocked item, such as
A0832075009. This number is useless to the customer, and would be confusing or irritating, but is essential to fulfilling orders, since it is broken down as such:

A - Department (shelving Unit)
08 - Shelf number
32 - Slot Number *** These three data points give the picker the precise location of the item
07 - counter - Once we no longer stock an item, the stock location is available, so the next item put in the location receives the next number in sequence
50 - Value for the first attribute, such as 50 for 5.0 ml and 25 for 2.5ml
09 - Value for the second attribute *** Once the pickers are familiar with these last two fields, they provide a sanity check to ensure the item in-hand is the right size/color, etc.

Our SKU Module updates the products.products_model OR products_with_attributes_stock.customid with our SKU, depending on whether or not the item has attributes. Our module reads a number of other tables, but only updates these two fields, since Zen Cart/SBA already use them (mostly) how we want/need them to be used. The "mostly" is my question of whether Configuration => Stock => SBA Display Custom ID = false hides the customid on pick slips and invoices *as well as *the attribute selection dropdowns and shopping cart.

I've already considered deleting and recreating the SBA tracking for this problem child. If you'd like to see the symptom before I try to dump and recreate, PM me and I can get you inside the "down for maintenance" wall.

06 Jan 2016, 00:57
#2429
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

jnabird333:

My dropdown menus are not displaying that...they look the same as they were before I installed SBA.

Yes, I do have them as a taxable good BUT only if they are purchased within my state. I will look into those files to see what I can modify for the other two items.

Please include directions on how to do the sql statement....sorry newbie.

We all began somewhere. :)

SQL statements can be run from the admin panel: tools->install SQL patches

There is text that is on that screen that is/can be confusing to new users. It says something to the effect of not to use it for ZC install scripts... The minor SQL queries you see around the site are not the same as the "Hey I want to install or upgrade ZC" type SQL queries.

Still working on the code, though been writing a lot as well. :) Have to balance forum with coding. :)

So, ZC doesn't really know where the customer is when simply navigating around... The code portion that shows the "tax/sale" would need to include additional "restraints" to only show that revised price when the "person" is logged in. See without "having" the person, the basic ZC code just keeps on chugging basically treating everyone the same. :)

06 Jan 2016, 01:10
#2430
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

michael_rebreathe:

Sorry to not state what I considered obvious. Each Option Name has its own distinct ID, as does each Option Value. Out of the non-db-constrained unique fields, the only differences between the options is the option name and products_options.products_options_track_stock

Stock ID:
Capacity: Slim (2.5ml) Color: Clear Qty: 3
Capacity: Slim (2.5ml) Color: Black Qty: 8
Capacity: Slim (2.5ml) Color: Blue Qty: 7
Capacity: Slim (2.5ml) Color: Orange Qty: 12
Capacity: Slim (2.5ml) Color: Pink Qty: 4
Capacity: Large (5.0ml) Color: Clear Qty: 6
Capacity: Large (5.0ml) Color: Black Qty: 10
Capacity: Large (5.0ml) Color: Blue Qty: 7
Capacity: Large (5.0ml) Color: Orange Qty: 2
Capacity: Large (5.0ml) Color: Pink Qty: 6

Capacity is one Option with Slim and Large as options values
Color is the other option with Clear, Black, Blue, Orange and Pink as options values
We track all inventory by product for products with no attributes, Product AND attribute 1 for single-option products, and Product AND attribute 1 AND attribute 2 for two-option products. There's no product in our catalog where we stock by one attribute and can change the second attribute on-the-fly.

Each SKU is unique to the products_with_attributes_stock.stock_id (items with attributes) or products.products_id (items without attributes). We have an additional module we created, which creates SKUs for each stocked item, such as
A0832075009. This number is useless to the customer, and would be confusing or irritating, but is essential to fulfilling orders, since it is broken down as such:

A - Department (shelving Unit)
08 - Shelf number
32 - Slot Number *** These three data points give the picker the precise location of the item
07 - counter - Once we no longer stock an item, the stock location is available, so the next item put in the location receives the next number in sequence
50 - Value for the first attribute, such as 50 for 5.0 ml and 25 for 2.5ml
09 - Value for the second attribute *** Once the pickers are familiar with these last two fields, they provide a sanity check to ensure the item in-hand is the right size/color, etc.

Our SKU Module updates the products.products_model OR products_with_attributes_stock.customid with our SKU, depending on whether or not the item has attributes. Our module reads a number of other tables, but only updates these two fields, since Zen Cart/SBA already use them (mostly) how we want/need them to be used. The "mostly" is my question of whether Configuration => Stock => SBA Display Custom ID = false hides the customid on pick slips and invoices *as well as *the attribute selection dropdowns and shopping cart.

I've already considered deleting and recreating the SBA tracking for this problem child. If you'd like to see the symptom before I try to dump and recreate, PM me and I can get you inside the "down for maintenance" wall.

At "last" check, yes > The "mostly" is my question of whether Configuration => Stock => SBA Display Custom ID = false hides the customid on pick slips and invoices *as well as *the attribute selection dropdowns and shopping cart. as I recall controls the overall usage not just in one place or another. But, with that in mind, one could either hard code replace the constant with a "false" or "true" for all cases, or as desired including adding one's own "on/off" switch...

Here's my thoughts for the "settings". One for the Attributes.php file such that is possible to have in no particular order (off entirely, on always, on with the overall setting just discussed), then also to provide a "no-customer side" type option... Like said, doesn't help the customer to know some of that customid data, so may make sense for some to not have it displayed on the customer side except for packing slips that may be received, etc... Kind of a "side" issue versus say the email? Haven't really thought about how/when one would want to disable it, so open to suggestions, although again not trying to make this thing overly complicated or to have too many options that need to be "explained". :)

06 Jan 2016, 01:32
#2431
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

jnabird333:

I have isolated it to it taking into account the sale I have on the t-shirts. If I remove the sale, they display correctly. If I turn it back on, the additional amounts are there. Why is it figuring in the sale on the additional cost especially since it is a set amount off and not a set percentage?

Quite honestly, when I try to read the php files, I get very confused trying to figure out where to make a change as I do not have line numbers on my page when I am editing.

Btw, fwiw, the line numbers in such a situation can be found on github wthin the specific file. That's how I found them while I was using my cell phone to provide the response on the previous page.

But, also suggest obtaining a text only editor to help you with such changes... There's a list of recommended applications in the FAQs, and I thought that the likes of notepad++ was still one of those. Last I knew it had line numbers and some basic context display (color changes based on what the code has in it). I could be wrong on that last part though. I have other IDE type tools that help me out in a jam if the code isn't nicely formatted for readability.

06 Jan 2016, 02:49
#2432
michael_rebreathe avatar

michael_rebreathe

New Zenner

Join Date:
Jul 2015
Posts:
43
Plugin Contributions:
0

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

mc12345678:

At "last" check, yes as I recall controls the overall usage not just in one place or another. But, with that in mind, one could either hard code replace the constant with a "false" or "true" for all cases, or as desired including adding one's own "on/off" switch...

Here's my thoughts for the "settings". One for the Attributes.php file such that is possible to have in no particular order (off entirely, on always, on with the overall setting just discussed), then also to provide a "no-customer side" type option... Like said, doesn't help the customer to know some of that customid data, so may make sense for some to not have it displayed on the customer side except for packing slips that may be received, etc... Kind of a "side" issue versus say the email? Haven't really thought about how/when one would want to disable it, so open to suggestions, although again not trying to make this thing overly complicated or to have too many options that need to be "explained". :)

Hmmm...I saw where the setting is used for populating the dropdowns, but just used the Key name to find it in Configuration => Stock => SBA Display Custom ID. Haven't traced it all the way through packing lists and invoices. I guess I'll do that.

The customid and item number stood out as a blaringly obvious solution for our SKUs. I'm kind of surprised that you haven't had others trying the same thing. I agree that lots of settings with necessarily detailed explanations are hard to balance with all of the other needs for a module like this...The added fun is someone like me trying to balance rapid upgrades with minimum post-upgrade re-dos of hard coding changes like you're suggesting.

..If only there were a "perfect" way to build a module like this...:P

I'll gladly tweak the order form to remove the customid from the dropdowns in our implementation. It just clutters the dropdown too much. The customid showing up on the shopping cart or invoice is not a problem either way (doesn't hurt, doesn't help), but is essential for us on packing slips. This way, we only need to propagate our update on a single file (from what it looks like).

06 Jan 2016, 03:36
#2433
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

michael_rebreathe:

Hmmm...I saw where the setting is used for populating the dropdowns, but just used the Key name to find it in Configuration => Stock => SBA Display Custom ID. Haven't traced it all the way through packing lists and invoices. I guess I'll do that.

The customid and item number stood out as a blaringly obvious solution for our SKUs. I'm kind of surprised that you haven't had others trying the same thing. I agree that lots of settings with necessarily detailed explanations are hard to balance with all of the other needs for a module like this...The added fun is someone like me trying to balance rapid upgrades with minimum post-upgrade re-dos of hard coding changes like you're suggesting.

..If only there were a "perfect" way to build a module like this...:P

I'll gladly tweak the order form to remove the customid from the dropdowns in our implementation. It just clutters the dropdown too much. The customid showing up on the shopping cart or invoice is not a problem either way (doesn't hurt, doesn't help), but is essential for us on packing slips. This way, we only need to propagate our update on a single file (from what it looks like).

Well, actually the initial intent as I've seen by potteryhouse and jeking was exactly to provide such a "model" number for each attribute variant. Some use it for things like Quickbooks or other financial software where it is needed to link uniquely to each "object". As to display/hide, well either they have accepted it to be present, modified it themselves, or hidden it to only be used by that other software.

I was thinking though, that in the end it still could be helpful for the store owner and customer if the data remains present so that if there is any question about what is what, the customer has access to that information to make sure that both parties are speaking a "unique" language that ties items to each other. Means nothing to the "world" but can be very helpful in the "quick" call...

I'm working on the quick mod for at least to remove from the attributes dropdown by admin option. For information, because of some other comments in other threads, I'm looking at applying the option into the configuration->attributes menu instead of being only associated with Stock or Dynamic Dropdowns.

On another note, and this applies to anyone looking to use Dynamic Dropdowns (or almost any javascript), the page needs to validate properly before applying additional javascript. I say this from review of sites where there have been problems with the dynamic dropdowns display (multiple attributes).

06 Jan 2016, 05:17
#2434
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

SQL Statement to install the new "feature" of controlling the display of CustomID on the attributes dropdown without using the Install/update option in the SBA install list. This will add the option to the end of the Attribute Settings Menu:

SELECT @sort_order := (c.sort_order + 1) FROM configuration c
            WHERE c.configuration_group_id = 13
            order by c.sort_order desc limit 1;

INSERT INTO `configuration` (configuration_title, configuration_key, configuration_value, 
           configuration_description, configuration_group_id, sort_order, 
           date_added, use_function, set_function) 
           VALUES 
 ('SBA Display CustomID in Attribute Dropdowns', 'ATTRIBUTES_SBA_DISPLAY_CUSTOMID', '2', 
            'Display the CustomID in the Attribute Dropdown list(s) for the customer to see while selecting an option.<br /><br /> 0 - Hide the Custom ID<br /> 1 - Display the Custom ID depending on the setting for display throughout<br ?> 2 - Always display the Custom ID (default)<br />',
            13,@sort_order ,now(),null,'zen_cfg_select_drop_down(array(array(\'id\'=>\'0\', \'text\'=>\'Off\'), array(\'id\'=>\'1\', \'text''=>\'On Pending SBA Stock\'), array(\'id\'=>\'2\', \'text''=>\'Always On\'), ),');

Deletion SQL if needed:

DELETE FROM `configuration` WHERE configuration_key = 'ATTRIBUTES_SBA_DISPLAY_CUSTOMID';

Code will be incorporated into the plugin as well as a change of the default option for the HTML away from defaulting to true. That default will change in the future when Dynamic Dropdowns (or appropriate variation) does fully/sufficiently handles all of the basic types of option name.

Code change needed in includes/classes/observers/class.products_with_attributes_stock.php:

from line 163 through 184 inclusive changing (text to be changed is in red here):

                  if (STOCK_SBA_DISPLAY_CUSTOMID == 'true' AND ! empty($products_options->fields['customid'])) {
                    $PWA_STOCK_QTY .= ' (' . $products_options->fields['customid'] . ') ';
                  }
                }
              } elseif (STOCK_SHOW_ATTRIB_LEVEL_STOCK == 'true' && $products_options->fields['pasqty'] < 1 && $products_options->fields['pasid'] < 1) {
                //test, only applicable to products with-out the display-only attribute set
                if ($products_options_DISPLAYONLY->fields['attributes_display_only'] < 1) {
                  //use the qty from the product, unless it is 0, then set to out of stock.
                  if ($this->_products_options_names_count <= 1) {
                    if ($products_options->fields['products_quantity'] > 0) {
                      $PWA_STOCK_QTY = PWA_STOCK_QTY . $products_options->fields['products_quantity'] . ' ';
                    } else {
                      $products_options->fields['products_options_values_name'] = $products_options->fields['products_options_values_name'] . PWA_OUT_OF_STOCK;
                    }
                  }
                  //show custom ID if flag set to true
                  if (STOCK_SBA_DISPLAY_CUSTOMID == 'true' AND ! empty($products_options->fields['customid'])) {
                    $PWA_STOCK_QTY .= ' (' . $products_options->fields['customid'] . ') ';
                  }
                }
              } elseif (STOCK_SBA_DISPLAY_CUSTOMID == 'true' AND ! empty($products_options->fields['customid'])) {

To (replacing above red with below blue):

                  if (!empty($products_options->fields['customid']) && (!defined('ATTRIBUTES_SBA_DISPLAY_CUSTOMID') || (STOCK_SBA_DISPLAY_CUSTOMID == 'true' && ATTRIBUTES_SBA_DISPLAY_CUSTOMID == '1') || ATTRIBUTES_SBA_DISPLAY_CUSTOMID == '2')) {
                    $PWA_STOCK_QTY .= ' (' . $products_options->fields['customid'] . ') ';
                  }
                }
              } elseif (STOCK_SHOW_ATTRIB_LEVEL_STOCK == 'true' && $products_options->fields['pasqty'] < 1 && $products_options->fields['pasid'] < 1) {
                //test, only applicable to products with-out the display-only attribute set
                if ($products_options_DISPLAYONLY->fields['attributes_display_only'] < 1) {
                  //use the qty from the product, unless it is 0, then set to out of stock.
                  if ($this->_products_options_names_count <= 1) {
                    if ($products_options->fields['products_quantity'] > 0) {
                      $PWA_STOCK_QTY = PWA_STOCK_QTY . $products_options->fields['products_quantity'] . ' ';
                    } else {
                      $products_options->fields['products_options_values_name'] = $products_options->fields['products_options_values_name'] . PWA_OUT_OF_STOCK;
                    }
                  }

                  //show custom ID if flag set to true
                  if (!empty($products_options->fields['customid']) && (!defined('ATTRIBUTES_SBA_DISPLAY_CUSTOMID') || (STOCK_SBA_DISPLAY_CUSTOMID == 'true' && ATTRIBUTES_SBA_DISPLAY_CUSTOMID == '1') || ATTRIBUTES_SBA_DISPLAY_CUSTOMID == '2')) {
                    $PWA_STOCK_QTY .= ' (' . $products_options->fields['customid'] . ') ';
                  }
                }
              } elseif (!empty($products_options->fields['customid']) && (!defined('ATTRIBUTES_SBA_DISPLAY_CUSTOMID') || (STOCK_SBA_DISPLAY_CUSTOMID == 'true' && ATTRIBUTES_SBA_DISPLAY_CUSTOMID == '1') || ATTRIBUTES_SBA_DISPLAY_CUSTOMID == '2')) {

Now in testing this (which worked) I noticed that I may have left behind some errant code in the includes/functions/extra_functions/products_with_attributes.php file that cause an error... On lines 568 and 569 there is " . at the end of each that should be deleted (will be fixed momentarily on github). Also I hadn't incorporated the changes into the ZC 1.5.1 version of the plugin so need to do that as well... Anyways... Above should address the "concerns" expressed today by both michael_rebreathe and jnabird333...

products_with_attributes.php

06 Jan 2016, 09:37
#2435
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

Another update pushed to github... Added the above code, corrected the above identified issue. Also in testing for the issue that jnabird333 is/was experiencing (outside of the lack of dynamic dropdowns displaying) discovered that there was some aspects of the data validation not performed for variants that are not listed in the SBA table but the product is tracked by SBA... (In other words for those conditions where say dynamic dropdowns is not functioning for multiple attribute product and therefore there is no "immediate"/"interactive" user notification of product availability. Instead, users adding product that meet that condition should immediately see the error message on the product page (at least with setup that don't go to the cart after adding product).

Also updated the ZC 1.5.1 version of files as I hadn't gotten to that earlier.

07 Jan 2016, 00:14
#2436
jnabird333 avatar

jnabird333

New Zenner

Join Date:
Dec 2015
Location:
Ohio
Posts:
16
Plugin Contributions:
0

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

My hubby assisted in fixing the pricing issue...had to turn off an option for those attributes. Now, still working on the dynamic dropdowns not displaying as intended and allowing out of stock items to be added to the cart without warning.

07 Jan 2016, 00:26
#2437
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

jnabird333:

My hubby assisted in fixing the pricing issue...had to turn off an option for those attributes. Now, still working on the dynamic dropdowns not displaying as intended and allowing out of stock items to be added to the cart without warning.

Congrats on fixing that issue, mind sharing what was done so that others that experience the same issue can overcome it as well?

07 Jan 2016, 00:31
#2438
jnabird333 avatar

jnabird333

New Zenner

Join Date:
Dec 2015
Location:
Ohio
Posts:
16
Plugin Contributions:
0

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

mc12345678:

Congrats on fixing that issue, mind sharing what was done so that others that experience the same issue can overcome it as well?

Under Catalog/Attributes Controller there is an option to "Apply discounts used by product Special/Sale: No or Yes" I had it marked as Yes and switched it to No. The additional charges disappeared.

07 Jan 2016, 01:03
#2439
jnabird333 avatar

jnabird333

New Zenner

Join Date:
Dec 2015
Location:
Ohio
Posts:
16
Plugin Contributions:
0

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

mc12345678:

Another update pushed to github... Added the above code, corrected the above identified issue. Also in testing for the issue that jnabird333 is/was experiencing (outside of the lack of dynamic dropdowns displaying) discovered that there was some aspects of the data validation not performed for variants that are not listed in the SBA table but the product is tracked by SBA... (In other words for those conditions where say dynamic dropdowns is not functioning for multiple attribute product and therefore there is no "immediate"/"interactive" user notification of product availability. Instead, users adding product that meet that condition should immediately see the error message on the product page (at least with setup that don't go to the cart after adding product).

Also updated the ZC 1.5.1 version of files as I hadn't gotten to that earlier.

What did you mean by this statement? Did you work this fix into the last update or are you still testing it?

07 Jan 2016, 01:13
#2440
jnabird333 avatar

jnabird333

New Zenner

Join Date:
Dec 2015
Location:
Ohio
Posts:
16
Plugin Contributions:
0

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

jnabird333:

My hubby assisted in fixing the pricing issue...had to turn off an option for those attributes. Now, still working on the dynamic dropdowns not displaying as intended and allowing out of stock items to be added to the cart without warning.

Where does the quantity get checked for the attributes in SBA to show "out of stock"? What .php file controls this?

While I am still setting up and testing, I have not gone through a test purchase to verify the correct product quantity goes down. (I buy 1 small blue t-shirt, then the small blue t-shirt product quantity in the SBA screen goes down.)