-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
jnabird333
Hello, I am running into a small issue with trying to install this on my 1.5.4 Zen cart...I have already backed up my website and made an exact copy of my existing database. I uploaded the files and chose replace existing. I went to the install.php address and logged in to my Zen cart admin area. I selected check files and verified no errors. I selected the Full/Upgrade option and ran the script. Nothing happened...my screen didn't change in display and it never said the database was successfully changed as the directions state would happen. Please advise as I still don't see the SBA option under Catalodg.
I am new to this and REALLY need this add-on to track my inventory.
Alana
Adding: The screen shows SBA Version 1.5.3 for Zen Cart Version 1.5.1. I chose the most recent download which showed that it works with 1.5.4.
Ohh.. So the source of your download was the plugins section of this website, then?
Umm.. So there are those individuals that have been able to use that provided version to install onto a more recent version of ZC, which in a way was how it was first adapted to ZC 1.5.3+, but... There is work that has to be done in order to merge the files appropriately. That work has been done in a version that is available from github. The most recent version being kept at https://www.github.com/mc12345678/St...butes_Combined with the other storage locations to potentially be phased out as it is getting to be more difficult than necessary to independently maintain two-three different storage locations for a single plugin.
Anyways, I'm about to post an update to that location when I saw your message... You may need to repair some files on your system if you simply copied over the files that were provided in that download and did not merge only the SBA differences into your 1.5.4 system.
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Okay, just pushed changes to the combined location... (Haven't updated the ZC 1.5.5 version with the latest provided on github, more to come on that)
Functionality difference(s) include:
Text attributes can be tracked by SBA; however, currently if a product is added to the cart with the text field in one condition a second "version" of the product can be added to the cart with just as many quantity. Each quantity is limited to the maximum that is assigned to the product. Also, the text option name ought to be added to the SBA variant of the product. I am waiting/open to more testing on this. I have found where I need to apply a condition to prevent the text field from being treated as something that makes the product unique to the cart, but it will require a bit more coding and I wanted to get this out there even with this "issue". (Not everyone uses text/upload file fields that uses SBA.
Forced the sorted order of attributes in includes/modules/YOUR_TEMPLATE/attributes.php by enforcing the sort order of the option names if the selection to sort by sort order/option name was chosen in the admin. Previously the code only forced the sort order, and there was some "randomness" to the option name sorting. Also forced the sort order of the option values. The settings for these sort orders is found in the configuration->Product Info section regarding option names and option values.
Similar sorting applied to admin's products SBA menu display, though the sort order of those is still a little less than fully desired at least it is possible to make head's or tails of it. :)
Moved some code out of main files (more to be moved) into an observer to minimize the amount of code modifications necessary. Come ZC 1.5.5, this is starting to look like it will not need to modify very much at all of the core/standard code.
Used some of the functions built for SBA to simplify/shorten some of the code.
Corrected another found statement that read something like ...this is to force hiding READ ONLY attributes... Well the operation of the code actually was to force hiding DISPLAY ONLY attributes which is a different animal. Read Only is an option name that can have multiple option values. Display only is a designation to an option value made through the attributes controller. The intention of a display only attribute is to not allow the selection to be added to the cart, but to provide some form of information to the customer while they look at the list of items... It is also handy to use as a default option for an attribute so that the customer must select something other than the default display option to add the "correct" product to the cart. Dynamic Dropdowns as modified for this plugin generally accomplishes this by forcing the selection of one attribute before being allowed to select the next and then resetting those that follow if one above is modified... Unfortunately DD remains limited at the moment on the attribute(s) to which it can be applied... More coding needed.
Okay, hopefully enough to chew on for everyone. Thinking may be able to submit this again soon if can overcome the above text/upload filename issue.
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
mc12345678
Ohh.. So the source of your download was the plugins section of this website, then?
Umm.. So there are those individuals that have been able to use that provided version to install onto a more recent version of ZC, which in a way was how it was first adapted to ZC 1.5.3+, but... There is work that has to be done in order to merge the files appropriately. That work has been done in a version that is available from github. The most recent version being kept at
https://www.github.com/mc12345678/St...butes_Combined with the other storage locations to potentially be phased out as it is getting to be more difficult than necessary to independently maintain two-three different storage locations for a single plugin.
Anyways, I'm about to post an update to that location when I saw your message... You may need to repair some files on your system if you simply copied over the files that were provided in that download and did not merge only the SBA differences into your 1.5.4 system.
I can start over...I am so new to this that it isn't funny!! I will replace my admin and includes folders with my archived ones to put me back to where I was before I started. Now, how to get the correct file at the github site?
Thanks - Alana
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
I was able to download the zip file from github...The Readme file is empty. Where can get explicit directions on how to install?
The Wiki install directions say that I need to create a database. The plugin directions says that I needed to upload the folders. I just need to know how to install this and I should be good to go.
Alana
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
jnabird333
I was able to download the zip file from github...The Readme file is empty. Where can get explicit directions on how to install?
The Wiki install directions say that I need to create a database. The plugin directions says that I needed to upload the folders. I just need to know how to install this and I should be good to go.
Alana
Not to bounce you around too much, and well to maybe get some feedback on it, but potteryhouse/jeking had created some instructions (I have not modified them yet/recently) that may help? Otherwise would be sending you down the "figure it out" path. :)
https://github.com/potteryhouse/stoc...X_Instructions
The files in the download are arranged a little differently than described in the instructions.
General installation (also discussed within the last three pages),
1. Place/merge the files in the admin/includes folders (there are folders in the includes/modules and includes/templates that should be "manually" lined up with your template folder)
2. Go into the folder for your version of ZC and repeat,
3. Using your admin filepath (ie. while logged into the admin) goto: stores_admin_site_with_folder_path/stock_by_attr_install.php
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Well, I got the github version installed and it is working.... for the most part. I have my cart set to be able to add an item to the cart even if it is out of stock (I want to be able to do pre-orders and not sure how else to do that), but I want the warning to show. Unfortunately, the latter part is not happening. I have tried to find the answer but there are sooooooo many different forum threads for sooooooo many different versions that I cannot keep fixes straight.
For example: I have grey hoodies but only in Med, large, and XL in stock. When I add a small one to the cart, it does NOT display the out of stock notification.
Alana
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
jnabird333
Well, I got the github version installed and it is working.... for the most part. I have my cart set to be able to add an item to the cart even if it is out of stock (I want to be able to do pre-orders and not sure how else to do that), but I want the warning to show. Unfortunately, the latter part is not happening. I have tried to find the answer but there are sooooooo many different forum threads for sooooooo many different versions that I cannot keep fixes straight.
For example: I have grey hoodies but only in Med, large, and XL in stock. When I add a small one to the cart, it does NOT display the out of stock notification.
Alana
Well, can only help so much... Be nice to know settings, variant configuration, associated quantities, etc... Otherwise operating pretty blindly...
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
mc12345678
Well, can only help so much... Be nice to know settings, variant configuration, associated quantities, etc... Otherwise operating pretty blindly...
Settings: Configuration/Stock - Check Stock level, Subtract stock, and allow checkout are all True and mark product out of stock is set with ***. SBA settings are all defaults with only Display Search Box only and Display Attributes Images are set to False.
Variant Configuration: one color as a radio box and multiple sizes in a drop down menu.
Associated quantities: small (0), medium (1), large (1), XL (2), 2XL (0), 3XL (0).
Is this what you are needing? If you need something else specific, let me know.
I also have T-shirts that come in 3 different colors and the same 6 different sizes. Each one is set up with 0 quantity. These DO show up as out of stock.
You can check it out at www.sevenslotsyndicate.com/cart...by the way, this is not a live site.
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
jnabird333
Settings: Configuration/Stock - Check Stock level, Subtract stock, and allow checkout are all True and mark product out of stock is set with ***. SBA settings are all defaults with only Display Search Box only and Display Attributes Images are set to False.
Variant Configuration: one color as a radio box and multiple sizes in a drop down menu.
Associated quantities: small (0), medium (1), large (1), XL (2), 2XL (0), 3XL (0).
Is this what you are needing? If you need something else specific, let me know.
I also have T-shirts that come in 3 different colors and the same 6 different sizes. Each one is set up with 0 quantity. These DO show up as out of stock.
You can check it out at
www.sevenslotsyndicate.com/cart...by the way, this is not a live site.
Regarding the problem product... Is the single radio box by design (choice) or is it a result of having only one color active on a dropdown box?
Is the option name id for the first product the same as the second?
What is the quantity of grey entered for the first product? Really though, if you are offering grey medium, grey large and grey XL (plus all the others that are to have zero quantity), then it makes more sense for each variant to be described that way if the color is going to be described as an attribute... Ie. Grey small (0), Grey Medium (1), Grey Large (1), Grey XL (2), etc...
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Did figure out that if tried to obtain 5 (one more than the total available) that then the product showed as out-of-stock...
Is there a reason you're not using the dynamic dropdowns aspect? It cares for/displays the out-of-stock on page (in the list) rather than waiting for the product to be added to the cart to discover that. And the terminology can be changed in the file definitions to show back-order instead of out-of-stock or something like that...
Also from the post at the top of the previous page:
Under Configuration->Dynamic Dropdowns->Use ZC default HTML Attribute Tags
set it to false if it is not
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Had figured out that the color option name was assigned the same to both product, the difference being that on one product there is but one choice (now a radio button by default) while on the other there are sufficient product listed to give two dropdowns.
Okay, so I haven't gone through to verify/test if there is still an issue with the code or with the way things were setup, because I didn't fully understand the setup for the product that is the problem and the product that is reportedly not a problem (I didn't try all combinations or extents), but there is an update that has been pushed which primarily revolves around having data entry fields such as a text box or an upload file box. Now, still don't have dynamic dropdowns setup to take advantage of their presence, but at least when adding a product to the cart it now does some handling of its own...
Product that are to have a text/upload file field (from hereon out in this post as text field) must have the text field added to the variant in order to add the product to the cart if it is tracked by SBA. It can be a combined variant or all of them split out, but at the moment the text of such a text field is not stock changing (meaning, if the text field is empty the product is treated the same as if the text field had something in it). While it is/can be visioned that such a text field could be considered a stockable item, (ie. badges) at the moment such a plan is not incorporated.
It's not pretty, and there is a bit of code cleanup to be done, but for the time being I need to work on some other things unless there is a blatant error/issue that needs to be resolved with this...
So, badarac, please test, jnabird333, please test and post the status on the above reported issue(s). Would like to be able to reproduce the issue so that it can be addressed, michael_rebreathe well it should simply add some more functionality :).
Anyone willing to test is welcome to do so, please report issues here or at github, as always, please consider the posting tips when posting (almost anywhere) so that the issue can be reproduced and resolved quickly, otherwise we're all just waiting around on someone to give enough info to figure out what's going on... :)
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
mc12345678--
I see that the repo on GitHub was updated less than an hour ago. Is it safe to assume that you're only updating the repo with released changes?
I can't say it enough - You've been a great help, so thank you.
--Our Custom IDs are ridiculously long, so would prefer they not show up in the dropdowns. They appeared as soon as the quantities reappeared in the dropdowns. Do you know if there's a way to turn that off, or at least where (what page) the customid is added to the dropdown? We really want them to show up on pick lists, which is why we're using that field, but don't want to have superfluous info in the dropdowns.
We're still having difficulty with one product with two attributes (post 2387, Page 239 this thread), but have been bouncing between this and two other issues so haven't updated with your updates in a couple of days...If the repo that was most recently updated is ready, I'll give it a shot, and hopefully this resolves it.
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Haven't done anything to affect the generation of the "unique_id" described in that post. Not sure what action(s) have been taken to cause it to be unpopulated. Perhaps if you can reproduce the issue/describe the actions taken to cause those to go blank, it would help.
Yes it is an updated version that worked for adding product with attributes tracked and those not tracked by SBA as well as adding product without attributes. This testing was done wiith product that did have text field(s) mixed with another attribute and product without text fields.
As to the customid, that is controlled en masse in. The configuration->stock section. To specifically remove from just the dropdown display would require looking into the code that generates the attributes list which has predominantly been moved to the includes/classes/observers file when addressing the model number. I can't recall if it got incorporated into the dynamic dropdown file yet or not...
What are the two other issues (assuming related to use of this plugin)?
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
mc12345678
Product that are to have a text/upload file field (from hereon out in this post as text field) must have the text field added to the variant in order to add the product to the cart if it is tracked by SBA. It can be a combined variant or all of them split out, but at the moment the text of such a text field is not stock changing (meaning, if the text field is empty the product is treated the same as if the text field had something in it). While it is/can be visioned that such a text field could be considered a stockable item, (ie. badges) at the moment such a plan is not incorporated.
So just to make sure I understand you correctly. In my case there is a product that has a color attribute and a text attribute.
Option Name:Cover color
Option values: White, Black, or Select (display only, default)
Option name: Personalized text (text input field)
What you are saying is that I must create SBA combos for all orderable combinations:
Cover color - white, text
Cover color - black, text
No combo would be required for the select option value since it is display only and could not be added to the cart anyway. This would need to be done for ALL products that have multiple option names, where at least one has option names/values with stock tracked, and where at least one option name is text.
Does this sound right?
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Lines 163, 180 and 187 of
Includes/classes/observers/class.products_with_attributes_stock.php
Contain the "inquiries" to display the customid on items processed through the attributes file. Other places it is used are presented "as necessary". Still working out some ways to present that "better"/consistently, but hasn't been as high of a priority.
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
badarac
So just to make sure I understand you correctly. In my case there is a product that has a color attribute and a text attribute.
Option Name:Cover color
Option values: White, Black, or Select (display only, default)
Option name: Personalized text (text input field)
What you are saying is that I must create SBA combos for all orderable combinations:
Cover color - white, text
Cover color - black, text
No combo would be required for the select option value since it is display only and could not be added to the cart anyway. This would need to be done for ALL products that have multiple option names, where at least one has option names/values with stock tracked, and where at least one option name is text.
Does this sound right?
Yes, this is relatively correct... I didn't try adding the text attribute as a separate "stocked" quantity, but the process used to manage this should allow for it.
I also get the "lots of work" perspective... I will say this, Easypopulate V4 has a feature to manage stock of existing variants... So if you go through the process of creating the variants (whether you keep/remove the previous at this time or not), then the entered stock from the existing variants can be copied/moved to the variants just created... That also I believe is one reason that potteryhouse/jeking created an option to add all attributes as variants in the install code... I haven't looked at how that is resolved, but it could prove to be useful to a store just starting to use this.
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
mc12345678
Haven't done anything to affect the generation of the "unique_id" described in that post. Not sure what action(s) have been taken to cause it to be unpopulated. Perhaps if you can reproduce the issue/describe the actions taken to cause those to go blank, it would help.
Yes it is an updated version that worked for adding product with attributes tracked and those not tracked by SBA as well as adding product without attributes. This testing was done wiith product that did have text field(s) mixed with another attribute and product without text fields.
As to the customid, that is controlled en masse in. The configuration->stock section. To specifically remove from just the dropdown display would require looking into the code that generates the attributes list which has predominantly been moved to the includes/classes/observers file when addressing the model number. I can't recall if it got incorporated into the dynamic dropdown file yet or not...
What are the two other issues (assuming related to use of this plugin)?
Sorry, we already determined that the unique_combo issue isn't really an issue.
The outstanding issue is the product with Color and Capacity, where Color dropdown shows up twice on the page, and no manner of selection order makes it possible to add to the cart. We are using the Color option on a whole lot of products, and even with lots of browsing the site, we haven't found another item with the Color option displaying the Color select field twice. This is the only product that uses the Capacity Option, but the Option and it's values (aside from values names) seem to be identical to our "Bottle Size" option. We use each of the Color values present in this product with other products, just different combinations of the 31 colors we offer.
In the weeds (the database itself), I see that products_options.products_options_track_stock is different between the two options (1 for Capacity, and 10 for Bottle Size), but it's also different for other options which are playing well. After a LOT of digging, this is genuinely the only difference I'm seeing for this problem child product.
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
mc12345678
Lines 163, 180 and 187 of
Includes/classes/observers/class.products_with_attributes_stock.php
Contain the "inquiries" to display the customid on items processed through the attributes file. Other places it is used are presented "as necessary". Still working out some ways to present that "better"/consistently, but hasn't been as high of a priority.
Thanks for the direction. The class file uses STOCK_SBA_DISPLAY_CUSTOMID, which is in Configuration => Stock => SBA Display Custom ID.
The description for this setting is "Display the Custom ID value in history, checkout, and order forms"...I've followed to see that the customid doesn't display in the dropdowns and in the shopping cart. What is meant by display in history and order forms? Is the order form the form on the product page or packing slip and/or invoice? Also, what history is it referring to?
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
mc12345678
Did figure out that if tried to obtain 5 (one more than the total available) that then the product showed as out-of-stock...
Is there a reason you're not using the dynamic dropdowns aspect? It cares for/displays the out-of-stock on page (in the list) rather than waiting for the product to be added to the cart to discover that. And the terminology can be changed in the file definitions to show back-order instead of out-of-stock or something like that...
Also from the post at the top of the previous page:
Under Configuration->Dynamic Dropdowns->Use ZC default HTML Attribute Tags
set it to false if it is not
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
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
michael_rebreathe
Sorry, we already determined that the unique_combo issue isn't really an issue.
The outstanding issue is the product with Color and Capacity, where Color dropdown shows up twice on the page, and no manner of selection order makes it possible to add to the cart. We are using the Color option on a whole lot of products, and even with lots of browsing the site, we haven't found another item with the Color option displaying the Color select field twice. This is the only product that uses the Capacity Option, but the Option and it's values (aside from values names) seem to be identical to our "Bottle Size" option. We use each of the Color values present in this product with other products, just different combinations of the 31 colors we offer.
In the weeds (the database itself), I see that products_options.products_options_track_stock is different between the two options (1 for Capacity, and 10 for Bottle Size), but it's also different for other options which are playing well. After a LOT of digging, this is genuinely the only difference I'm seeing for this problem child product.
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... ?
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.
-
Re: 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
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
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/
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
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?
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
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.
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
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.
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
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...
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
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.
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
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
Quote:
Originally Posted by
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.
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
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. :)
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
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
Quote:
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". :)
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
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.
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
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).
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
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).
-
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:
Code:
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:
Code:
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):
Code:
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):
Code:
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
-
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.
-
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.
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
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?
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
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.
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
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?
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
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.)
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
jnabird333
What did you mean by this statement? Did you work this fix into the last update or are you still testing it?
Yes, the files have been updated to support an admin switch (placed in the attrbute settings section of the configuration menu) to disable display of the customid in the attribute dropdowns. Installation for those that have already gotten their SBA related settings would be to upload the files and run the sql provided above, or for those with a new setup/don't mind adjusting the SBA (dynamic dropdowns as well) setting can do the install/upgrade provided in the SBA configuration menu *after* the files are uploaded... If the files are not uploaded but the sql is performed, then the switch does nothng. If the files are uploaded but the sql (setup) is not performed then the customid will default to being on.
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Besides the one question about where the quantity is checked by attributes php....where are the dynamic dropdowns controlled as I feel they are still not working as described?
alana
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
jnabird333
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.)
Two maybe three areas to address that question... The "display" of out-of-stock in the dropdowns is done in the includes/classes/observers/class.products_with_attributes_stock.php (if I remember the full filename correctly, there's only one such file added by the plugin) in the sections of code that start with updateAttributes as the includes/modules/YOUR_TEMPLATE/attributes.php file is processed... Those sections go out to the includes/functions/extra_functions/products_with_attributes.php (I think it's called) file to process the data passed to it.
Now, if dynamic dropdowns is "activated" and being used, then the stock verification is done throught the combination of includes/classes/pad_base.php and pad_sbadropdown (or whatever it got called) with the functions of the second file overriding the equivalent functions of the first. (I still think the creation of that plugin was rather ingenious). The "stock" check is then performed through some javascript calculations/comparisons.
Now the issue of decrement of stock... Well, before it gets purchased there is an extra_cart actions file that inspects the contents being passed to the cart... That code is what is run regardless of DD being used or not... The DD "interface" is just a bit of a nicety showing the customer up front the current status. The real meat though is in this extra cart file. It performs a check of the provided attributes that are expected to be formatted in a typical ZC fashion to
1) Verify that the provided attributes make a product that exists in the SBA table
2) Verify that there is a quantity currently available as determined by the SBA table stock quantities...
3) If the quantity in the cart is adjusted it again verifies the presence of quantity. It does not again check for the accuracy of the combinations of attributes of the product to be defined.
Failure of either of the first two prevents addition of the product to the cart/adjustment of the requested quantity to that on hand. Failure of the third adjusts quantity to the maximum available assuming that's how the store is setup... There's also caveats for those that allow selling on "backorder"..
Now the last part, that is done/addressed through the includes/classes/orders.php file and the same observers file from above... Btw, all of those files rely on the functions file above as well...
Best in all to be sure that all of the files of the plugin are up-to-date with the current distribution so that they can all interact properly together...
I do look forward to your test purchase results assuming the other issues up to that point are resolved.. Remember you don't have to use paypal or something that actually takes your money, you could use a "mail my payment" type purchase to get the same result (downloads are a little tricky for testing in that situation, but that comment is for others than your store).
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
jnabird333
Besides the one question about where the quantity is checked by attributes php....where are the dynamic dropdowns controlled as I feel they are still not working as described?
alana
So, in a "default" install the DD would be presented through includes/templates/YOUR_TEMPLATE/templates/tpl_modules_attributes.php as called through the process of generating the page from includes/templates/YOUR_TEMPLATE/templates/tpl_product_info_default.php and "gathering" the attributes... But seeing the way yours are setup in the template, it appears your template author has "bypassed" that file in place of something else... That is why I identified the variables I did because those variables are the ones generated by attributes.php to be used for display (though that too could have been bypassed by the template author).. In summary, I would say that issue is something you either need to ferret out or discuss with the template provider...
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Fyi, ran through a few purchase tests... Currently, purchasng two or more "different" product (different text only) does not reduce the stock for all purchased quantity. Test was: had a total of 25 product, in cart had 10 quantity with one version of text. Added the same product but with different text in quantity of 7. Went through the purchase process and only 7 were removed from stock of that product... Not 17... So, need to look at the orders process regarding multiple copies of the same product but different associated data in regards to how SBA does that reduction...
To qualm any other concerns though, tried a purchase of a product that had 2 attributes assigned, one attribute had one and only one choice. The other had three choices. Different quantity (5, 7, and 10) were populated for each of the total three variants. Each variant was a combination of the two attributes. I then added 3 of the first from the above quantity and 7 of the last. The final result was as expected: 2, 7, and 3, respectively.
Now I did have to do something "special" on the add-to-cart in order to account for adding the appropriate quantity of such "non-stock affecting" attributes... Probably have to duplicate something about that in the orders processing part...
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
My guess (yet to be able to prove) is that the query of line 317 of includes/classes/observers/class.products_with_attributes_stock.php needs to be formatted like that of includes/classes/order.php line 734 (zc 1.5.3/1.5.4) such that the select query is "refreshed" for each occurrence, which isn't an issue when the attrbutes (sans text) are different...
So I would think that:
Code:
$attribute_stock_available = $db->Execute($get_quantity_query);
Should be:
Code:
$attribute_stock_available = $db->Execute($get_quantity_query, false, false, 0, true));
Inside of includes/classes/observers/class.products_with_attributes_stock.php line 317...
Reason behind this thought? Well, the sock quantity only reduced by the "last" product of the same product_id... This meant that the previous select/update combo was run a second time using the same initial data of the original available stock.... Thus, after the first product was removed from stock, when the query was asked again without clearing the cache, the result was the same on the second and final product (same products_id and sba table stock_id, but different text). Will test as soon as I get back to a computer where I can modify the code.
Sorry badarac. :)
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Yup, that fixed it... Btw, the overall stock *did* decrement on the "problematic" listing earlier before the above fix, just not the individual stock (at the time). Applying the above "fix" allowed checkout stock tracking of product that were listed more than once in the cart, each with different text only,,,
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
mc12345678
Yup, that fixed it... Btw, the overall stock *did* decrement on the "problematic" listing earlier before the above fix, just not the individual stock (at the time). Applying the above "fix" allowed checkout stock tracking of product that were listed more than once in the cart, each with different text only,,,
The minor fix identified above that changed the $db->Execute command has been incorporated into the download. If the software was up-to-date to yesterday or so, then should only have to apply the above posted fixes, otherwise recommend installing the current/new fileset and doing the install. BTW, also added the remove sql to the fileset to support deleting the newly added option. :)
Two files affected: the storeside observers class and the admin's install file.
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Sorry for the delay testing things. Been busy with my day job. What should I download to pick up all the changes to test?
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
badarac
Sorry for the delay testing things. Been busy with my day job. What should I download to pick up all the changes to test?
I thought your day job might be golfing. :P
Well, would say latest from http://www.github.com/mc12345678/Sto...butes_Combined. I hadn't done any special download this tag arrangement. It's been quiet there I think for 24 hours now. :P
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
mc12345678
If I hit the lottery this weekend it could be. :cool: In the absence of a small fortune I suppose I'll need to keep working to pay the bills. I'll download the most recent and test it out.
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
@jnabird333
At last swing by of the sample product in your store, I saw that you had overcome the issue of dynamic dropdowns. But (and it's been a few days) I noticed that it doesn't quite work right...
Once the first or greater choice has been selected, a change of any selection before the last available should reset all options "below" that one... In your case, you have a two attribute selecter, the first size, the second color. Once each of those have been selected, if the first is changed, the second is not reset... Watching the operations on the page, there was also a javascript error that occurred in that process...
Now I'm not sure which of the many javascripts on that page was causing the issue, but I'm guessing that it is the one that deals with selectors (something like that in the filename). I didn't spend much more time troubleshooting it, but thought I would let you know the expected operation and how it isn't following that "process".
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
@michael_rebreathe,
Your siteat last check was still presenting three attributes when it appears that only 2 are defined. Based on the source code of the displaayed page it appears as if there might have been some code merging performed with the tpl_modules_attributes.php file as there is code present only introduced in this version/ZC 1.5.5 and only to be displayed when dynamic dropdowns is disabled which makes the situation even odder as it is acting as both enabled in full and disabled in part...
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
mc12345678
@michael_rebreathe,
Your siteat last check was still presenting three attributes when it appears that only 2 are defined. Based on the source code of the displaayed page it appears as if there might have been some code merging performed with the tpl_modules_attributes.php file as there is code present only introduced in this version/ZC 1.5.5 and only to be displayed when dynamic dropdowns is disabled which makes the situation even odder as it is acting as both enabled in full and disabled in part...
Which is why I've been banging my head trying to figure it out. It makes no sense to me, either. Since this is only one of >400 products, we didn't let this delay release. We are now live!
I haven't touched tpl_modules_attributes.php, it doesn't appear to be a partial copy of the content, and the time stamp is synced with the other files included in the last update. I'm considering completely deleting the product and its attributes links and then recreating the product from scratch (kind of shotgun, but it's only three minutes wasted).
Something I thought I solved, but only half way...The day after we went live, a customer reiterated a concern I saw and thought I fixed. Turns out, I only fixed it on single-attribute dropdowns. We really want the quantity available to display on the product page, but "Black Qty 2" can be perceived as forcing the customer to order in pairs. I updated \includes\classes\observers\class.products_with_attributes_stock.php [161] to change it to say "Black: 2 Available" Since this is a change to the actual construction of the content of the dropdown, this isn't just a change to a language define file. Thoughts on where this is is for multi-attributes in the sea of pages?
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
michael_rebreathe
Which is why I've been banging my head trying to figure it out. It makes no sense to me, either. Since this is only one of >400 products, we didn't let this delay release. We are now live!
I haven't touched tpl_modules_attributes.php, it doesn't appear to be a partial copy of the content, and the time stamp is synced with the other files included in the last update. I'm considering completely deleting the product and its attributes links and then recreating the product from scratch (kind of shotgun, but it's only three minutes wasted).
Something I thought I solved, but only half way...The day after we went live, a customer reiterated a concern I saw and thought I fixed. Turns out, I only fixed it on single-attribute dropdowns. We really want the quantity available to display on the product page, but "Black Qty 2" can be perceived as forcing the customer to order in pairs. I updated \includes\classes\observers\class.products_with_attributes_stock.php [161] to change it to say "Black: 2 Available" Since this is a change to the actual construction of the content of the dropdown, this isn't just a change to a language define file. Thoughts on where this is is for multi-attributes in the sea of pages?
Yup, and I'll look at how "best" such a statement can be easily added in the future. (Have an idea, but want to try to keep it easy for those that choose to modify it such as the above request.)
File: includes/classes/pad_sba_sequenced_dropdowns.php
Line 508:
Can change from:
Code:
$out.=" + '" . PWA_STOCK_QTY . "' + stk2";
to:
Code:
$out.=" + '" . PWA_STOCK_QTY . "' + stk2" . " Available";
For the fix, I'm looking at modifying PWA_STOCK_QTY and the remainder of that statement to possibly sprint the value, or more simply to have it defined as the entire text that follows the current PWA_STOCK_QTY, such that the define in: includes/languages/english/extra_definitions/products_with_attributes.php
Line 15 would be changed from:
Code:
define('PWA_STOCK_QTY', ' Qty: ');
to (untested):
Code:
define('PWA_STOCK_QTY', ' + " Qty: " + stk2 + " Available"');
Might have to reverse all the quotes on the right side of the define changing single quotes into double and double into single to support the javascript portion, and then line 508 of the previous file would be simply:
Code:
$out.= PWA_STOCK_QTY;
Or some variation on that "thought"...
Or since I see the constant is used in the class, that it would need to be a different constant in order to work or back to the previous "thought" of using sprint to provide the data... Again, the reason behind at least offering such a "prefix"/"suffix" option is to handle multiple languages as well where the word(s) may need to follow the number instead and further why an sprint option may be better so that the code can be consistent, but the resulting text be as desired/formed.
Anyways, more than you needed, but there ya' go. :)
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
@michael_rebreathe
I have some other non-SBA related things to do, but took a look at tpl_modules_attributes, while I don't think there is an issue there, some of the coding pre-existed functionality that has been added. Basically there is an internal check for the product being an SBA controlled product, and then the variable is set and used for later checks. Problem might be that in the global aspect, the variable might be revised... Anyways, thinking of changing the tests in that file so that only the status as determined at that point is possible to affect operation...
I had been trying to get "creative" and rely on certain data being maintained to minimize function calls, database searches, etc... But if it the current code is potentially affecting results, first need to ensure functionality.
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
mc12345678
Yup, and I'll look at how "best" such a statement can be easily added in the future. (Have an idea, but want to try to keep it easy for those that choose to modify it such as the above request.)
File: includes/classes/pad_sba_sequenced_dropdowns.php
Line 508:
Can change from:
Code:
$out.=" + '" . PWA_STOCK_QTY . "' + stk2";
to:
Code:
$out.=" + '" . PWA_STOCK_QTY . "' + stk2" . " Available";
For the fix, I'm looking at modifying PWA_STOCK_QTY and the remainder of that statement to possibly sprint the value, or more simply to have it defined as the entire text that follows the current PWA_STOCK_QTY, such that the define in: includes/languages/english/extra_definitions/products_with_attributes.php
Line 15 would be changed from:
Code:
define('PWA_STOCK_QTY', ' Qty: ');
to (untested):
Code:
define('PWA_STOCK_QTY', ' + " Qty: " + stk2 + " Available"');
Might have to reverse all the quotes on the right side of the define changing single quotes into double and double into single to support the javascript portion, and then line 508 of the previous file would be simply:
Code:
$out.= PWA_STOCK_QTY;
Or some variation on that "thought"...
Or since I see the constant is used in the class, that it would need to be a different constant in order to work or back to the previous "thought" of using sprint to provide the data... Again, the reason behind at least offering such a "prefix"/"suffix" option is to handle multiple languages as well where the word(s) may need to follow the number instead and further why an sprint option may be better so that the code can be consistent, but the resulting text be as desired/formed.
Anyways, more than you needed, but there ya' go. :)
Not quite so simple as just changing line 508, but I got it.
To allow any combination of prefixes and suffixes, I added
Code:
define('PWA_STOCK_QTY_PFX', ' :');
define('PWA_STOCK_QTY_SFX', ' Available');
to /includes/languages/english/extra_definitions/products_with_attributes.php
Changed /includes/classes/pad_sba_sequenced_dropdowns.php (lines 506 +)
Code:
if ($curattr == sizeof($attributes) - 2) {
if (STOCK_SHOW_ATTRIB_LEVEL_STOCK == 'true') {
//$out.=" + '" . PWA_STOCK_QTY . "' + stk2";
$out.=" + '" . PWA_STOCK_QTY_PFX . "' + stk2";//Put prefix here
$out.=$outArray;
$out.="[opt]";
}
}
//$out.=",opt.substring(1));\n";
$out.="+ '" . PWA_STOCK_QTY_SFX . "',opt.substring(1));\n";//Added the suffix here
$out.=" } else {\n";
Now for the second dropdown it shows
Black :2 Available
Blue :4 Available
Green :2 Available
Red :3 Available
...which works for us and is flexible should our passions change.
Quote:
Originally Posted by
mc12345678
Code:
define('PWA_STOCK_QTY', ' + " Qty: " + stk2 + " Available"');
This will totally puke, since "stk2" is the name of the array holding the second-tier attributes stock quantities, which has to be accessed to determine the quantity. Once I got it to work with Prefix and Suffix, this is how the relevant line of Java is put together:
Code:
frm['id[6]'].options[frm['id[6]'].length]=new Option(htmlEnDeCode.htmlDecode(txt6[opt]) + ' :' + stk2['_'+frm['id[1]'].value][opt]+ ' Available',opt.substring(1));
It worked fine with just a prefix, but the suffix gets in the way of accessing the array.
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
michael_rebreathe
Not quite so simple as just changing line 508, but I got it.
To allow any combination of prefixes and suffixes, I added
Code:
define('PWA_STOCK_QTY_PFX', ' :');
define('PWA_STOCK_QTY_SFX', ' Available');
to /includes/languages/english/extra_definitions/products_with_attributes.php
Changed /includes/classes/pad_sba_sequenced_dropdowns.php (lines 506 +)
Code:
if ($curattr == sizeof($attributes) - 2) {
if (STOCK_SHOW_ATTRIB_LEVEL_STOCK == 'true') {
//$out.=" + '" . PWA_STOCK_QTY . "' + stk2";
$out.=" + '" . PWA_STOCK_QTY_PFX . "' + stk2";//Put prefix here
$out.=$outArray;
$out.="[opt]";
}
}
//$out.=",opt.substring(1));\n";
$out.="+ '" . PWA_STOCK_QTY_SFX . "',opt.substring(1));\n";//Added the suffix here
$out.=" } else {\n";
Now for the second dropdown it shows
Black :2 Available
Blue :4 Available
Green :2 Available
Red :3 Available
...which works for us and is flexible should our passions change.
This will totally puke, since "stk2" is the name of the array holding the second-tier attributes stock quantities, which has to be accessed to determine the quantity. Once I got it to work with Prefix and Suffix, this is how the relevant line of Java is put together:
Code:
frm['id[6]'].options[frm['id[6]'].length]=new Option(htmlEnDeCode.htmlDecode(txt6[opt]) + ' :' + stk2['_'+frm['id[1]'].value][opt]+ ' Available',opt.substring(1));
It worked fine with just a prefix, but the suffix gets in the way of accessing the array.
Pushed this solution to single attribute dropdowns as well...Once implemented, any changes to prefix or suffix will hit single and multi-attribute dropdowns simultaneously
/includes/classes/observers/class.products_with_attributes_stock.php (line ~158 +)
Code:
if (STOCK_SHOW_ATTRIB_LEVEL_STOCK == 'true' && $products_options->fields['pasqty'] > 0) {
//test, only applicable to products with-out the read-only attribute set
if ($products_options_DISPLAYONLY->fields['attributes_display_only'] < 1) {
//$PWA_STOCK_QTY = PWA_STOCK_QTY . $products_options->fields['pasqty'] . ' ';
$PWA_STOCK_QTY = PWA_STOCK_QTY_PFX . $products_options->fields['pasqty'] . PWA_STOCK_QTY_SFX .' ';//Changed to Prefix, added Suffix
//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'] . ') ';//We have this commented out to prevent customids in the dropdowns, but allow them on shopping cart and pick lists
}
}
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Thanks for doing all the leg work, I did kind of think it wouldn't quite be as easy as I described, but I still think it can be... More to follow on that. :) glad that the issue was resolved and shared with others...
As to the customid on the multiple attributes, I actually thought I hadn't included it yet, but am wrong based on the commenting out of the code above... Need an if statement surrounding that line to evaulate against the same constant that was added in the other file where it was presented in three rows of the file... Also need to incorporate a prefix/suffix to the model# as well to expand on user modification options...
Thanks again!!!
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Discovered while viewing a customer's order in admin:
criteria to reproduce:
product has attributes, but product is not tracked by SBA and STOCK_SBA_DISPLAY_CUSTOMID == 'true' (ie. expecting to have the custom_id displayed).
SQL error thrown at line 794 of admin/includes/classes/products_with_attributes_stock.php
Error is equivalent to below:
Code:
PHP Fatal error: 1064:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 4 :: select customid as products_model
from products_with_attributes_stock
where products_id = 5
and stock_attributes in () ==> (as called by) path_to_admin/includes/classes/products_with_attributes_stock.php on line 794 <== in path_to_store_includes/classes/db/mysql/query_factory.php on line 155
Error may be slightly different on various ZC versions (ie. the line number associated to query_factory.php); however, the above was from running on ZC 1.5.3. The same issue would occur on any version of ZC that this code is run.
How to fix:
replace line 787 with:
Code:
if ($attribute_stock->RecordCount() > 0 && !$customid->RecordCount()){ // if a customid does not exist for the combination of attributes then perhaps the attributes are individually listed.
Original code in this "area":
Code:
if(is_array($attributes) and sizeof($attributes) > 0){
// check if attribute stock values have been set for the product
// if there are will we continue, otherwise we'll use product level data
$attribute_stock = $db->Execute("select stock_id
from " . TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK . "
where products_id = " . (int)$products_id . ";");
if ($attribute_stock->RecordCount() > 0) {
// search for details for the particular attributes combination
$first_search = 'where options_values_id in ("'.implode('","',$attributes).'")';
// obtain the attribute ids
$query = 'select products_attributes_id
from '.TABLE_PRODUCTS_ATTRIBUTES.'
'.$first_search.'
and products_id='.$products_id.'
order by products_attributes_id;';
$attributes_new = $db->Execute($query);
while(!$attributes_new->EOF){
$stock_attributes[] = $attributes_new->fields['products_attributes_id'];
$attributes_new->MoveNext();
}
$stock_attributes_comb = implode(',',$stock_attributes);
}
//Get product model
$customid_model_query = 'select products_model
from '.TABLE_PRODUCTS.'
where products_id = '. (int)$products_id . ';';
//Get custom id as products_model
$customid_query = 'select customid as products_model
from '.TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK.'
where products_id = :products_id:
and stock_attributes in (:stock_attributes:);';
$customid_query = $db->bindVars($customid_query, ':products_id:', $products_id, 'integer');
$customid_query = $db->bindVars($customid_query, ':stock_attributes:', $stock_attributes_comb, 'string');
$customid = $db->Execute($customid_query); //moved to inside this loop as for some reason it has made
if (!$customid->RecordCount()){ // if a customid does not exist for the combination of attributes then perhaps the attributes are individually listed.
$customid_query = 'select customid as products_model
from '.TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK.'
where products_id = :products_id:
and stock_attributes in (:stock_attributes:)';
$customid_query = $db->bindVars($customid_query, ':products_id:', $products_id, 'integer');
$customid_query = $db->bindVars($customid_query, ':stock_attributes:', $stock_attributes_comb, 'passthru');
$customid = $db->Execute($customid_query); //moved to inside this loop as for some reason it has made
}
}
Revised Code:
Code:
if(is_array($attributes) and sizeof($attributes) > 0){
// check if attribute stock values have been set for the product
// if there are will we continue, otherwise we'll use product level data
$attribute_stock = $db->Execute("select stock_id
from " . TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK . "
where products_id = " . (int)$products_id . ";");
if ($attribute_stock->RecordCount() > 0) {
// search for details for the particular attributes combination
$first_search = 'where options_values_id in ("'.implode('","',$attributes).'")';
// obtain the attribute ids
$query = 'select products_attributes_id
from '.TABLE_PRODUCTS_ATTRIBUTES.'
'.$first_search.'
and products_id='.$products_id.'
order by products_attributes_id;';
$attributes_new = $db->Execute($query);
while(!$attributes_new->EOF){
$stock_attributes[] = $attributes_new->fields['products_attributes_id'];
$attributes_new->MoveNext();
}
$stock_attributes_comb = implode(',',$stock_attributes);
}
//Get product model
$customid_model_query = 'select products_model
from '.TABLE_PRODUCTS.'
where products_id = '. (int)$products_id . ';';
//Get custom id as products_model
$customid_query = 'select customid as products_model
from '.TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK.'
where products_id = :products_id:
and stock_attributes in (:stock_attributes:);';
$customid_query = $db->bindVars($customid_query, ':products_id:', $products_id, 'integer');
$customid_query = $db->bindVars($customid_query, ':stock_attributes:', $stock_attributes_comb, 'string');
$customid = $db->Execute($customid_query); //moved to inside this loop as for some reason it has made
if ($attribute_stock->RecordCount() > 0 && !$customid->RecordCount()){ // if a customid does not exist for the combination of attributes then perhaps the attributes are individually listed.
$customid_query = 'select customid as products_model
from '.TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK.'
where products_id = :products_id:
and stock_attributes in (:stock_attributes:)';
$customid_query = $db->bindVars($customid_query, ':products_id:', $products_id, 'integer');
$customid_query = $db->bindVars($customid_query, ':stock_attributes:', $stock_attributes_comb, 'passthru');
$customid = $db->Execute($customid_query); //moved to inside this loop as for some reason it has made
}
}
FWIW, the above is expected to be revised again, there are some additional logic functions that can be applied to provide a smoother operation and would have prevented finding that error. Ie., the error was present because any check performed regarding if the products_id in question was tracked by SBA did not properly/promptly address that condition... Now there is actually a function that returns a true/false condition if a product is tracked by SBA and therefore, that can be incorporated up front and any "special" custom_id handling after that. To be addressed in a later change.
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
mc12345678
Thanks for doing all the leg work, I did kind of think it wouldn't quite be as easy as I described, but I still think it can be... More to follow on that. :) glad that the issue was resolved and shared with others...
As to the customid on the multiple attributes, I actually thought I hadn't included it yet, but am wrong based on the commenting out of the code above... Need an if statement surrounding that line to evaulate against the same constant that was added in the other file where it was presented in three rows of the file... Also need to incorporate a prefix/suffix to the model# as well to expand on user modification options...
Thanks again!!!
I'm always willing to help when I can. We're all trying
Keep in mind our intent in this: We want the customid to show on packing slips and invoices but not in the dropdowns. We don't really care either way if it shows up in the shopping cart. Current settings are all or nothing.
Total tangent, but I'm hoping it is as simple as I think it is: The "from" name in all of our Zen Cart emails is "Sales," since the source email address is [email protected]. That's obviously going to be flagged as spam in 1.2 nanoseconds. Most applications that generate email will allow addresses like "Our Company<[email protected]>." Nowhere in any of the Zen Cart documentation I have found clarifies whether or not Zen Cart can accept this format for email addresses. Searching the term "email" in the forum returns so many threads it'll take me forever to trudge through them. Tools => Send Email doesn't pull the email address automatically, so is (presumably) useless for testing, and the one thing we don't have configured on our sandbox server is email...
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
michael_rebreathe
I'm always willing to help when I can. We're all trying
Keep in mind our intent in this: We want the customid to show on packing slips and invoices but not in the dropdowns. We don't really care either way if it shows up in the shopping cart. Current settings are all or nothing.
Total tangent, but I'm hoping it is as simple as I think it is: The "from" name in all of our Zen Cart emails is "Sales," since the source email address is
[email protected]. That's obviously going to be flagged as spam in 1.2 nanoseconds. Most applications that generate email will allow addresses like "Our Company<
[email protected]>." Nowhere in any of the Zen Cart documentation I have found clarifies whether or not Zen Cart can accept this format for email addresses. Searching the term "email" in the forum returns so many threads it'll take me forever to trudge through them. Tools => Send Email doesn't pull the email address automatically, so is (presumably) useless for testing, and the one thing we don't have configured on our sandbox server is email...
Then you must have missed this post or not downloaded since then..
Ummm, the email thing? Have you taken a look in the admin at the description for: Configuration->E-mail Options->Send Copy of Order Confirmation Emails To... They all follow that format, just don't all say so. :) Also, it doesn't necessarily make sense for an email to come from multiple addresses, but at least the Name <email> format is consistent.
Quote:
Send Copy of Order Confirmation Emails To
Send COPIES of order confirmation emails to the following email addresses, in this format: Name 1 <email@address1>, Name 2 <email@address2>
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
mc12345678
Then you must have missed
this post or not downloaded since then..
Ummm, the email thing? Have you taken a look in the admin at the description for: Configuration->E-mail Options->Send Copy of Order Confirmation Emails To... They all follow that format, just don't all say so. :) Also, it doesn't necessarily make sense for an email to come from multiple addresses, but at least the Name <email> format is consistent.
No, I hadn't looked at those because they deal with TO email addresses, not FROM email addresses.
Thanks for the quick reply!
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
mc12345678
Then you must have missed
this post or not downloaded since then..
This was just a friendly reminder of what we were looking for, which we already implemented. You mentioned you were considering a bit of a rework to when customids may be desired, and ours is just one scenario. :cool:
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
michael_rebreathe
This was just a friendly reminder of what we were looking for, which we already implemented. You mentioned you were considering a bit of a rework to when customids may be desired, and ours is just one scenario. :cool:
Well, other places where customid is displayed is somewhat similar. The customid is "determined" and then applied/presented as a "separate" action. There was another that indicated having the customid in the dropdown was "inconvenient" so it made sense for it to be hidden or possible to be hidden by admin control... Seemed like though that the post was to indicate that it wasn't possible on the store in question. In fact one of the other recent posts still included a comment that the customid was temporarily commented out which led me to think/believe that the above post hadn't been noticed still...
One of the things being done to "simplify" the customid part is to have the customid determined in one set of code instead of a group of code that is copied into many different places... I've seen that it is/can be created differently and that doesn't lend itself to consistent presentation... It's on the list for doing, but trying to clean up things in a little bigger approach and to address some of the remaining functionality desired for it to apply to larger "groups"... In fact right now trying to incorporate some of what was determined in the last page and to see if it can be taken a little further while still "simple" for expandability and multi-location application.
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
mc12345678
Well, other places where customid is displayed is somewhat similar. The customid is "determined" and then applied/presented as a "separate" action. There was another that indicated having the customid in the dropdown was "inconvenient" so it made sense for it to be hidden or possible to be hidden by admin control... Seemed like though that the post was to indicate that it wasn't possible on the store in question. In fact one of the other recent posts still included a comment that the customid was temporarily commented out which led me to think/believe that the above post hadn't been noticed still...
One of the things being done to "simplify" the customid part is to have the customid determined in one set of code instead of a group of code that is copied into many different places... I've seen that it is/can be created differently and that doesn't lend itself to consistent presentation... It's on the list for doing, but trying to clean up things in a little bigger approach and to address some of the remaining functionality desired for it to apply to larger "groups"... In fact right now trying to incorporate some of what was determined in the last page and to see if it can be taken a little further while still "simple" for expandability and multi-location application.
I made the choice to not update with your most recent update because the issues I'm addressing with you are actually on the smaller-scale side of what our management wants tackled (like adding blog and forum functions, with recent blog posts displaying in Zen Cart, which mgmt should take a week or so). I'm always wary of just pushing an update without sandbox testing, and I'm struggling to keep the live site updates and sandbox development isolated and organized.
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Hi,
I am using the latest ZC version.
I have renamed the necessary folders, and uploaded everything via FileZilla. When I try to run the install file, I get this error -
The website encountered an error while retrieving http://www.chads420.com/MY_Domain/MY...tr_install.php. It may be down for maintenance or configured incorrectly.
Any suggestions? Currently my site admin is completely inaccessible. I have a good backup- but would really like to see this plug-in work
Thanks for any help!
LS
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Quote:
Originally Posted by
Lorrie Syms
Hi,
I am using the latest ZC version.
I have renamed the necessary folders, and uploaded everything via FileZilla. When I try to run the install file, I get this error -
The website encountered an error while retrieving
http://www.chads420.com/MY_Domain/MY...tr_install.php. It may be down for maintenance or configured incorrectly.
Any suggestions? Currently my site admin is completely inaccessible. I have a good backup- but would really like to see this plug-in work
Thanks for any help!
LS
From whence did you download the copy of SBA? (Sorry, got artsy all of a sudden.)
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Quote:
Originally Posted by
Lorrie Syms
Hi,
I am using the latest ZC version.
I have renamed the necessary folders, and uploaded everything via FileZilla. When I try to run the install file, I get this error -
The website encountered an error while retrieving
http://www.chads420.com/MY_Domain/MY...tr_install.php. It may be down for maintenance or configured incorrectly.
Any suggestions? Currently my site admin is completely inaccessible. I have a good backup- but would really like to see this plug-in work
Thanks for any help!
LS
You're supposed to replace MY_Domain/MY_ADMIN with your site values. These are placeholders.
You admin being inaccessible may or may not be related. Check your /logss/ folder for an error message.
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Quote:
Originally Posted by
jeking
You're supposed to replace MY_Domain/MY_ADMIN with your site values. These are placeholders.
You admin being inaccessible may or may not be related. Check your /logss/ folder for an error message.
I did replace those when I entered my URL - just replaced with generic for my post - actual URL - http://www.chads420.com/shop/zgtb5co...tr_install.php - comes up with the error posted earlier
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Quote:
Originally Posted by
mc12345678
From whence did you download the copy of SBA? (Sorry, got artsy all of a sudden.)
I downloaded it from the ZC plugin repository. Is there a better download?
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Quote:
Originally Posted by
Lorrie Syms
I downloaded it from the ZC plugin repository. Is there a better download?
This one? https://www.zen-cart.com/downloads.php?do=file&id=202
This is for Zen Cart 1.5.1. You said you're using the latest version which would be 1.5.4.
Was your admin working prior to installing this plugin?
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Quote:
Originally Posted by
jeking
Yes...it was working fine before uploading the files. It works fine if I restore my backup. I just can't figure out which file is causing the problem.
Could it be my Zen Cart is not compatible?
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Quote:
Originally Posted by
Lorrie Syms
Could it be my Zen Cart is not compatible?
Almost certainly. The version of this plugin for ZC 1.5.4 is available on github.com. Search the thread and you'll find it. Be aware it is under development so use are your own risk. That being said, many are using it on live sites, just be aware of the risk.
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Quote:
Originally Posted by
jeking
Almost certainly. The version of this plugin for ZC 1.5.4 is available on github.com. Search the thread and you'll find it. Be aware it is under development so use are your own risk. That being said, many are using it on live sites, just be aware of the risk.
Thanks JEKing. I'll check it out...isn't it all at our own risk???
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Quote:
Originally Posted by
Lorrie Syms
isn't it all at our own risk???
Yes, pretty much. Just wanted to avoid any misunderstanding. There is a difference between plugins available here in the forums and those posted outside of the forums.
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Quote:
Originally Posted by
Lorrie Syms
Thanks JEKing. I'll check it out...isn't it all at our own risk???
Quote:
Originally Posted by
jeking
Yes, pretty much. Just wanted to avoid any misunderstanding. There is a difference between plugins available here in the forums and those posted outside of the forums.
"Fortunately" the current version on github at least had a basis from the 1.5.1 version posted on this site. :)
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
zc 1.5.5 with responsive sheffield blue
I must have mixed up my downloads from github - installed what I thought was latest update on 3_21_2016 and installed that. With a little fiddling it worked. Reading about SbyA on a separate zc post made me look again at github and I found the z.c. 1.5.5 folder for SbyA. I went through and merged the changes. Site (test) still seems to be functioning correctly.
In my earlier merging I had difficulty with includes/modules/pages/shopping cart/header.php so I tried the SbyA version from my zc 1.5.4 livesite - and I noted today that it says SbyA 1.5.5 on the top of the file. When I went to merge in the most recent github file downloaded this morning, it says SbyA 1.5.4 at the top. I'm confused ;-) The files are very different.
I actually tried both files and each seems to work and I don't notice anything different in the appearance of my cart, or in the admin configs.
Am I correct in assuming I should go with the most recent github 1.5.5 folder download even though the versions appear to suggest otherwise.
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Quote:
Originally Posted by
soxophoneplayer
zc 1.5.5 with responsive sheffield blue
I must have mixed up my downloads from github - installed what I thought was latest update on 3_21_2016 and installed that. With a little fiddling it worked. Reading about SbyA on a separate zc post made me look again at github and I found the z.c. 1.5.5 folder for SbyA. I went through and merged the changes. Site (test) still seems to be functioning correctly.
In my earlier merging I had difficulty with includes/modules/pages/shopping cart/header.php so I tried the SbyA version from my zc 1.5.4 livesite - and I noted today that it says SbyA 1.5.5 on the top of the file. When I went to merge in the most recent github file downloaded this morning, it says SbyA 1.5.4 at the top. I'm confused ;-) The files are very different.
I actually tried both files and each seems to work and I don't notice anything different in the appearance of my cart, or in the admin configs.
Am I correct in assuming I should go with the most recent github 1.5.5 folder download even though the versions appear to suggest otherwise.
If I may put it this way, 1) the change to that file for SBA is minor, 2) the 1.5.5 files included there were from one point in the beta process (headers not updated), 3) a final comparison remains to be performed, 4) if at all able to forgive me, I've got several different major applications on which I work and am trying to get/keep them up-to-date...
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Quote:
Originally Posted by
mc12345678
If I may put it this way, 1) the change to that file for SBA is minor, 2) the 1.5.5 files included there were from one point in the beta process (headers not updated), 3) a final comparison remains to be performed, 4) if at all able to forgive me, I've got several different major applications on which I work and am trying to get/keep them up-to-date...
Thanks. I realize its a work in progress ;o) Just wasn't sure if I'd gone down the rabbit hole....
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Hello...Zen Cart 1.5.4 - upgraded 1.3.x (can't remember)
We are using the Stock by Attribute and all seems goods - works as intended. BUT one situation is our inventory - when out could be out forever - so there is no back order.
1. So if customer A puts item size 12 in cart and checks out - item size 12 is no longer available to see at site - perfect -exactly as should be (thanks...good plug-in).
2. BUT if customer A puts item size 12 ins cart and customer B puts item size 12 in cart - this is also good - as we don't want inventory to change just because it's in a cart - but rather that it's been checkout then it's gone.
3. BUT if customer A checkouts and there is only one size 12 customer B can also check out - What I want is customer B to get a message at cart and not be able to check out if customer A already did. We were able to set this up for general inventory - it can be in two carts but only one can checkout - but couldn't get to this to work at the attributes level.
Questions:
1) Is this possible? (two attributes in cart but only one can checkout if attribute inventory is gone after that first checkout)
2) Anyone else solved this issue? Simple fix that you can describe here - or very complex that you hired someone to fix (and they actually fixed it)?
Thanks so much.
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Quote:
Originally Posted by
eyeb
Hello...Zen Cart 1.5.4 - upgraded 1.3.x (can't remember)
We are using the Stock by Attribute and all seems goods - works as intended. BUT one situation is our inventory - when out could be out forever - so there is no back order.
1. So if customer A puts item size 12 in cart and checks out - item size 12 is no longer available to see at site - perfect -exactly as should be (thanks...good plug-in).
2. BUT if customer A puts item size 12 ins cart and customer B puts item size 12 in cart - this is also good - as we don't want inventory to change just because it's in a cart - but rather that it's been checkout then it's gone.
3. BUT if customer A checkouts and there is only one size 12 customer B can also check out - What I want is customer B to get a message at cart and not be able to check out if customer A already did. We were able to set this up for general inventory - it can be in two carts but only one can checkout - but couldn't get to this to work at the attributes level.
Questions:
1) Is this possible? (two attributes in cart but only one can checkout if attribute inventory is gone after that first checkout)
2) Anyone else solved this issue? Simple fix that you can describe here - or very complex that you hired someone to fix (and they actually fixed it)?
Thanks so much.
Not sure about the "notification", but this condition is now addressed in this plugin as obtained from https://github.com/mc12345678/Stock_...butes_Combined. It still respects the "first-purchase" first "wins" philosphy.
In testing this condition has also been difficult to reproduce, but in following the code logic it is addressed such that if two persons have the same exact item in the cart and that the purchase by either results in stock being depeleted and no "backorder" or oversell is available, then the second individual will not be able to checkout with that item. I thought it actually either gets removed with thenotification that the stock quantity in the cart exceeds theavailable quantity or some similar message...
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
zc 1.5.5 with SbyA from github
Apologies if I'm asking in wrong forum. I'm getting a log error that I think is SbyA related.
Quote:
-Apr-2016 02:16:07 UTC] Request URI: /index.php?main_page=product_info&products_id=10, IP address: 164.132.161.11
#1 queryFactoryResult->__construct() called at /xxxxxxxxxxxxx/tpl_modules_attributes.php:59]
#2 require(/xxxxxxxxxxxxx/templates/tpl_modules_attributes.php) called at [xxxxxxxxxxxx/templates/tpl_product_info_display.php:118]
#3 require(/xxxxxxxxx/templates/tpl_product_info_display.php) called at [xxxxxxxxxx/product_info/main_template_vars.php:178]
#4 require(/xxxxx/includes/modules/pages/product_info/main_template_vars.php) called at [/xxxxxxxxxxxx/tpl_main_page.php:251]
#5 require(/xxxxxx/common/tpl_main_page.php) called at [/xxxxx/public_html/index.php:97]
[09-Apr-2016 02:16:07 UTC] PHP Warning: Missing argument 1 for queryFactoryResult::__construct(), called in /xxxxxxxxx/tpl_modules_attributes.php on line 59 and defined in /xxxxxxx/includes/classes/db/mysql/query_factory.php on line 550
The bit in tpl_modules/attributes is:
PHP Code:
$inSBA = new queryFactoryResult;
$inSBA->EOF = true;
?>
<h3 id="attribsOptionsText"><?php echo TEXT_PRODUCT_OPTIONS; ?> </h3>
<?php } // END NON-SBA SPECIFIC: show please select unless all are readonly ?>
and the bit in query_factory is:
PHP Code:
* Constructs a new Query Factory Result
*/
function __construct($link) {
$this->is_cached = false;
$this->EOF = true;
$this->result = array();
$this->cursor = 0;
$this->link = $link;
}
I don't think this is causing me grief other than running up log files, so not sure what I should do about it.
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Quote:
Originally Posted by
soxophoneplayer
zc 1.5.5 with SbyA from github
Apologies if I'm asking in wrong forum. I'm getting a log error that I think is SbyA related.
The bit in tpl_modules/attributes is:
PHP Code:
$inSBA = new queryFactoryResult;
$inSBA->EOF = true;
?>
<h3 id="attribsOptionsText"><?php echo TEXT_PRODUCT_OPTIONS; ?> </h3>
<?php } // END NON-SBA SPECIFIC: show please select unless all are readonly ?>
and the bit in query_factory is:
PHP Code:
* Constructs a new Query Factory Result
*/
function __construct($link) {
$this->is_cached = false;
$this->EOF = true;
$this->result = array();
$this->cursor = 0;
$this->link = $link;
}
I don't think this is causing me grief other than running up log files, so not sure what I should do about it.
Already addressed/corrected in the current download, but add $db->link between ().
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Sorry, line in tpl_modules_attributes.php should read:
Code:
$inSBA = new queryFactoryResult($db->link);
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Quote:
Originally Posted by
mc12345678
Sorry, line in tpl_modules_attributes.php should read:
Code:
$inSBA = new queryFactoryResult($db->link);
Thank you, kind sir.
I added edited that bit. Also grabbed current github - I see there is quite a diff in includes/functions/extra_functions/products_with_attributes.php. So I replaced the previous version I had (January I think) with that while I was at it. (just sayin')
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Quote:
Originally Posted by
soxophoneplayer
Thank you, kind sir.
I added edited that bit. Also grabbed current github - I see there is quite a diff in includes/functions/extra_functions/products_with_attributes.php. So I replaced the previous version I had (January I think) with that while I was at it. (just sayin')
Yeah, I think it was around that time that I was trying to address several issues with compatibility of Dynamic Dropdowns and various in-stock out-of-stock options, identifying upon submitting a product to the cart whether the attributes were in stock or not, etc... and had made several changes. For what it's worth, recently product grid attributes has been updated to work on ZC 1.5.3 and above and integrate with SBA. There's still quite a bit to be done with that module, but it offers some basic functionality that works...
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
I'm trying out the beta version of SbyA with a Zen Cart version 1.5.5 install. So far it seems to work, which is really cool! To anyone else who is trying it, does the jQuery live editing of quantities work for you? I'm not sure if I missed a merge somewhere or if that isn't supposed to work yet. Thanks!
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
The big thing/difference in ZC 1.5.5 and the previous versions is that in ZC 1.5.5 in the admin jquery is loaded in one of the files after earlier versions would have loaded the necessary script which in turn disables/resets the already loaded script. Thought this had already been so incorporated, but then again there is a minor change that needs to be merged in from one of the GitHub branches.
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
I had the exact same error as below. I made the changes outlined, and now it is showing a different error, when viewing the order in orders.php (admin panel)
From error log,
Quote:
[26-Apr-2016 18:03:37 UTC] PHP Warning: implode(): Invalid arguments passed in /home/username/public_html/admindir/includes/classes/products_with_attributes_stock.php on line 771
[26-Apr-2016 18:03:37 UTC] PHP Fatal error: 1064:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 4 :: select customid as products_model
from products_with_attributes_stock
where products_id = 336
and stock_attributes in () ==> (as called by) /home/username/public_html/admindir/includes/classes/products_with_attributes_stock.php on line 794 <== in /home/username/public_html/includes/classes/db/mysql/query_factory.php on line 155
When viewing the order in orders.php (admin panel) it shows,
Quote:
1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 4
in:
[select customid as products_model from products_with_attributes_stock where products_id = 336 and stock_attributes in ()]
Would you have any idea what might be the cause? Thanks
Quote:
Originally Posted by
mc12345678
Discovered while viewing a customer's order in admin:
criteria to reproduce:
product has attributes, but product is not tracked by SBA and STOCK_SBA_DISPLAY_CUSTOMID == 'true' (ie. expecting to have the custom_id displayed).
SQL error thrown at line 794 of admin/includes/classes/products_with_attributes_stock.php
Error is equivalent to below:
Code:
PHP Fatal error: 1064:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 4 :: select customid as products_model
from products_with_attributes_stock
where products_id = 5
and stock_attributes in () ==> (as called by) path_to_admin/includes/classes/products_with_attributes_stock.php on line 794 <== in path_to_store_includes/classes/db/mysql/query_factory.php on line 155
Error may be slightly different on various ZC versions (ie. the line number associated to query_factory.php); however, the above was from running on ZC 1.5.3. The same issue would occur on any version of ZC that this code is run.
How to fix:
replace line 787 with:
Code:
if ($attribute_stock->RecordCount() > 0 && !$customid->RecordCount()){ // if a customid does not exist for the combination of attributes then perhaps the attributes are individually listed.
Original code in this "area":
Code:
if(is_array($attributes) and sizeof($attributes) > 0){
// check if attribute stock values have been set for the product
// if there are will we continue, otherwise we'll use product level data
$attribute_stock = $db->Execute("select stock_id
from " . TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK . "
where products_id = " . (int)$products_id . ";");
if ($attribute_stock->RecordCount() > 0) {
// search for details for the particular attributes combination
$first_search = 'where options_values_id in ("'.implode('","',$attributes).'")';
// obtain the attribute ids
$query = 'select products_attributes_id
from '.TABLE_PRODUCTS_ATTRIBUTES.'
'.$first_search.'
and products_id='.$products_id.'
order by products_attributes_id;';
$attributes_new = $db->Execute($query);
while(!$attributes_new->EOF){
$stock_attributes[] = $attributes_new->fields['products_attributes_id'];
$attributes_new->MoveNext();
}
$stock_attributes_comb = implode(',',$stock_attributes);
}
//Get product model
$customid_model_query = 'select products_model
from '.TABLE_PRODUCTS.'
where products_id = '. (int)$products_id . ';';
//Get custom id as products_model
$customid_query = 'select customid as products_model
from '.TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK.'
where products_id = :products_id:
and stock_attributes in (:stock_attributes:);';
$customid_query = $db->bindVars($customid_query, ':products_id:', $products_id, 'integer');
$customid_query = $db->bindVars($customid_query, ':stock_attributes:', $stock_attributes_comb, 'string');
$customid = $db->Execute($customid_query); //moved to inside this loop as for some reason it has made
if (!$customid->RecordCount()){ // if a customid does not exist for the combination of attributes then perhaps the attributes are individually listed.
$customid_query = 'select customid as products_model
from '.TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK.'
where products_id = :products_id:
and stock_attributes in (:stock_attributes:)';
$customid_query = $db->bindVars($customid_query, ':products_id:', $products_id, 'integer');
$customid_query = $db->bindVars($customid_query, ':stock_attributes:', $stock_attributes_comb, 'passthru');
$customid = $db->Execute($customid_query); //moved to inside this loop as for some reason it has made
}
}
Revised Code:
Code:
if(is_array($attributes) and sizeof($attributes) > 0){
// check if attribute stock values have been set for the product
// if there are will we continue, otherwise we'll use product level data
$attribute_stock = $db->Execute("select stock_id
from " . TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK . "
where products_id = " . (int)$products_id . ";");
if ($attribute_stock->RecordCount() > 0) {
// search for details for the particular attributes combination
$first_search = 'where options_values_id in ("'.implode('","',$attributes).'")';
// obtain the attribute ids
$query = 'select products_attributes_id
from '.TABLE_PRODUCTS_ATTRIBUTES.'
'.$first_search.'
and products_id='.$products_id.'
order by products_attributes_id;';
$attributes_new = $db->Execute($query);
while(!$attributes_new->EOF){
$stock_attributes[] = $attributes_new->fields['products_attributes_id'];
$attributes_new->MoveNext();
}
$stock_attributes_comb = implode(',',$stock_attributes);
}
//Get product model
$customid_model_query = 'select products_model
from '.TABLE_PRODUCTS.'
where products_id = '. (int)$products_id . ';';
//Get custom id as products_model
$customid_query = 'select customid as products_model
from '.TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK.'
where products_id = :products_id:
and stock_attributes in (:stock_attributes:);';
$customid_query = $db->bindVars($customid_query, ':products_id:', $products_id, 'integer');
$customid_query = $db->bindVars($customid_query, ':stock_attributes:', $stock_attributes_comb, 'string');
$customid = $db->Execute($customid_query); //moved to inside this loop as for some reason it has made
if ($attribute_stock->RecordCount() > 0 && !$customid->RecordCount()){ // if a customid does not exist for the combination of attributes then perhaps the attributes are individually listed.
$customid_query = 'select customid as products_model
from '.TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK.'
where products_id = :products_id:
and stock_attributes in (:stock_attributes:)';
$customid_query = $db->bindVars($customid_query, ':products_id:', $products_id, 'integer');
$customid_query = $db->bindVars($customid_query, ':stock_attributes:', $stock_attributes_comb, 'passthru');
$customid = $db->Execute($customid_query); //moved to inside this loop as for some reason it has made
}
}
FWIW, the above is expected to be revised again, there are some additional logic functions that can be applied to provide a smoother operation and would have prevented finding that error. Ie., the error was present because any check performed regarding if the products_id in question was tracked by SBA did not properly/promptly address that condition... Now there is actually a function that returns a true/false condition if a product is tracked by SBA and therefore, that can be incorporated up front and any "special" custom_id handling after that. To be addressed in a later change.
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
ivopivo
I had the exact same error as below. I made the changes outlined, and now it is showing a different error, when viewing the order in orders.php (admin panel)
From error log,
When viewing the order in orders.php (admin panel) it shows,
Would you have any idea what might be the cause? Thanks
Would be very helpful to have additional information.
1) ZC version.
2) Source of the SBA files (and possibly when they were downloaded).
3) The product in question, is it tracked by SBA?
4) If it is, how is/are the associated variants populated?
5) How many option names are associated with the product?
6) What type of option name(s) are they? (ie. read only, radio, etc...)
In just looking at the code and the above error message(s), it may be that a variable falls out of scope which is why the empty (), but that also depends on some of the above. I do note that a similar function is in the store side of the fileset and the particular area that is causing that problem in the admin where it starts with an if statement to the end of that if statement is in the admin only side. Makes me somewhat wonder if it is even necessary, but it got added in at some point and with purpose, so would rather make it work than make it go away. :)
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Still be nice to get the above requested information in case there is something else that needs to be addressed; however, please also see the proposed "fix" posted here.
If that works, it would be great to know. :) Again, difficult thing here is being able to reproduce the problem which can pretty much only do with sufficient information being provided.
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
mc12345678
Would be very helpful to have additional information.
1) ZC version.
2) Source of the SBA files (and possibly when they were downloaded).
3) The product in question, is it tracked by SBA?
4) If it is, how is/are the associated variants populated?
5) How many option names are associated with the product?
6) What type of option name(s) are they? (ie. read only, radio, etc...)
In just looking at the code and the above error message(s), it may be that a variable falls out of scope which is why the empty (), but that also depends on some of the above. I do note that a similar function is in the store side of the fileset and the particular area that is causing that problem in the admin where it starts with an if statement to the end of that if statement is in the admin only side. Makes me somewhat wonder if it is even necessary, but it got added in at some point and with purpose, so would rather make it work than make it go away. :)
Hello, thank you for the prompt reply!
1) ZC Version: v1.5.4
2) Source of the SBA files: Version: 1.5.3 from pottery house, downloaded here - https://www.zen-cart.com/downloads.php?do=file&id=202
3) The product in question, is it tracked by SBA? Yes (no custom id, sort order or description set)
4) If it is, how is/are the associated variants populated? There is an option for colour (radio) with only one option that is selected by default. The other option is for size and there are 6 choices in drop-down format.
5) How many option names are associated with the product? 2
6) What type of option name(s) are they? Radio and drop-down
Its ironic that no errors are generated from the store-side and the flow is seamless, however, it is causing issues when trying to view the order/make updates to it in the admin section.
The rest of the process works fine. The purchased stock is correctly deducted by SBA, etc.
Thanks again.
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
ivopivo
Hello, thank you for the prompt reply!
1)
ZC Version: v1.5.4
2)
Source of the SBA files: Version: 1.5.3 from pottery house, downloaded here -
https://www.zen-cart.com/downloads.php?do=file&id=202
3)
The product in question, is it tracked by SBA? Yes (no custom id, sort order or description set)
4) If it is, how is/are the associated variants populated? There is an option for colour (radio) with only one option that is selected by default. The other option is for size and there are 6 choices in drop-down format.
5) How many option names are associated with the product? 2
6) What type of option name(s) are they? Radio and drop-down
Its ironic that no errors are generated from the store-side and the flow is seamless, however, it is causing issues when trying to view the order/make updates to it in the admin section.
The rest of the process works fine. The purchased stock is correctly deducted by SBA, etc.
Thanks again.
Thank you for those answers. Item 4 could use some clarification, by variant I am referring to how information is populated in the admin under the catalog drop down and data entry for SBA. Do you have 6 lines of items each with a stock quantity where each row shows like: colour followed by size "1", colour followed by size "2", colour followed by size "3", etc... or do you have one entry with colour and six entries one for each size?
Also, if using ZC 1.5.4, the version currently available for download from this site is technically for ZC 1.5.1 and hasn't been updated (that I'm aware of) with the changes that have been ongoing on github (https://github.com/mc12345678/Stock_...butes_Combined).
Lastly, based on the provided information the change that I made to the code and linked above is not expected to correct your issue. The change I made was based on the "notes" that I left at the bottom of that previous post and were to exit out of the customid "loop" if the product was not tracked by SBA, but had attributes. Still might be back to the "out-of-scope" variable... Let me know if you did/did not apply the previous patch so that I can give line numbers appropriately to try something.
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
mc12345678
Thank you for those answers. Item 4 could use some clarification, by variant I am referring to how information is populated in the admin under the catalog drop down and data entry for SBA. Do you have 6 lines of items each with a stock quantity where each row shows like: colour followed by size "1", colour followed by size "2", colour followed by size "3", etc... or do you have one entry with colour and six entries one for each size?
I have attached a screenshot to provide more clarity. (easier than my attempts at explaining)
http://i63.tinypic.com/2wp7cb9.jpg
Quote:
Originally Posted by
mc12345678
Actually, upon second look, I installed it from a zip file titled "Stock_By_Attributes_Combined-master.zip". The stock by attributes file has * Stock by Attributes 1.5.4 15-11-14 mc12345678 in the opening.
Quote:
Originally Posted by
mc12345678
Lastly, based on the provided information the change that I made to the code and linked above is not expected to correct your issue. The change I made was based on the "notes" that I left at the bottom of that previous post and were to exit out of the customid "loop" if the product was not tracked by SBA, but had attributes. Still might be back to the "out-of-scope" variable... Let me know if you did/did not apply the previous patch so that I can give line numbers appropriately to try something.
I have restored the original file (without the changes from the bottom of the post). Thanks
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
ivopivo
I have attached a screenshot to provide more clarity. (easier than my attempts at explaining)
http://i63.tinypic.com/2wp7cb9.jpg
Actually, upon second look, I installed it from a zip file titled "Stock_By_Attributes_Combined-master.zip". The stock by attributes file has *
Stock by Attributes 1.5.4 15-11-14 mc12345678 in the opening.
I have restored the original file (without the changes from the bottom of the post). Thanks
Okay, and in a way good... Hmm.. Two options of potential solutions... Based on no customid being defined, I'm thinking the query may be returning nothing when asking for the customid on the product because no customid is defined, the other is the potential out-of-scope issue...
So first to try to address the potential out-of-scope variable... At line 727 of admin/includes/classes/products_with_attributes_stock.php, please add:
Code:
$stock_attributes_comb = null;
This would be just below:
Code:
$products_id = zen_get_prid($products_id);
Clear your cache/logout of the admin screen then return to the order and see if the error remains.
Okay I should have posted this a while back when I first wrote it, but I wanted an opportunity to run some of the code basically through some sql tests to see if there was an issue with the sql queries specifically, but have again come back to the fact that $stock_attributes_comb is "empty" within the second query loop... One way around that is to join the values differently so that worst case there would be a series of values like ("","") but ultimately that shouldn't even happen either, because $stock_attributes_comb ought to have values in it if the product 1) has attributes (obviously it does) and 2) is tracked by SBA... So, try the above first and then I may have to modify how the check is done, but that also seems like it will not return any values...
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Cheers for the help.
Tried the changes, the same error remains in the admin section. Log below:
Quote:
[26-Apr-2016 23:03:45 UTC] PHP Warning: implode(): Invalid arguments passed in products_with_attributes_stock.php on line 781
[26-Apr-2016 23:03:45 UTC] PHP Fatal error: 1064:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 4 :: select customid as products_model
from products_with_attributes_stock
where products_id = 334
and stock_attributes in () ==> (as called by)
products_with_attributes_stock.php on line 804 <== in query_factory.php on line 155
Contents of my products_with_attributes_stock.php - http://paste.ofcode.org/i2gJ2XegqNfZaMVXgNw2dW
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Now, I just tried in ZC 1.5.5 to purchase a product that has two option names (each having more than one option value), no customid assigned to the product, I have the admin set to display customid, and when I go to the admin customers->orders page, I am not having a problem with the "customid" and my store's files are the same as what has been uploaded to github as the current version (where version control/documentation hasn't been the best). Almost better off basing the date of the fileset on the date of the download. :) I have a 1.5.4 and 1.5.3 store with it installed at some level, but don't see how that part of the versioning plays a factor. The 1.5.5 fileset was basically made from the 1.5.4 and 1.5.3 set and then trimmed back based on changes made to ZC that made incorporation of this plugin easier/better. So, thing is I haven't yet been able to re-duplicate this issue after the post from this January.
Is the purchased item in some way at the beginning or end of the listings for that product?
I'm grasping at straws (assuming that your fileset is up-to-date with the current file set) because I don't yet (again?) know what conditions are fully causing this. May have to ask for some additional testing if the above doesn't work. If this is causing a problem to be able to do what you need, I can provide direction about how to comment out that section that is causing the problem. Considering you are using combined option names, it wouldn't pose a problem for your store when using multiple option name or single option name product.
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Upon further testing, It is happening to every single product that is SBA tracked. If the product isn't SBA tracked, there is no issue at all (displays perfectly fine).
When viewing customers -> orders in the admin panel, the products will display in the panel to right correctly without any error.
The error only appeals in the sections like "Display order details", "Display invoice", etc.
I have checked the files that I used from the master zip, It was installed in the last 2 months - I don't think there were any changes?
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
ivopivo
Upon further testing, It is happening to every single product that is SBA tracked. If the product isn't SBA tracked, there is no issue at all (displays perfectly fine).
When viewing customers -> orders in the admin panel, the products will display in the panel to right correctly without any error.
The error only appeals in the sections like "Display order details", "Display invoice", etc.
I have checked the files that I used from the master zip, It was installed in the last 2 months - I don't think there were any changes?
Would have to look at the commit history to identify changes. What if you applied a customid to eitherone of the purchased product or just any at all? I've made some changes to other aspects like supporting the product attribute grid plugin, but also work on a number of other things and cannot recall specifics