Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
fbroz
Nope, that update query made it so that the single entry (as far as I have directed) is no longer a factor in the overall stock evaluation and therefore the stock quantities associated with pink for that specific product are again controlled by what you enter in the sba admin table regardless of how it is entered (combined like you currently have, individual attribute(s) as in each option value listed individually with one or more option names and a single option name).
Further indicates that right now as written, having nothing in the table is a problem. Because of the "business" associated with attributes, a "database" friendly alternative to constantly checking it is needed. Whether it is an admin switch to use/not use the extra feature, or a "test" in the system that is occasionally run when manipulating the admin side to validate that at least one value is present or some other solution, but at least both the current problem and a potential solution are identified. Thank you.
2 Attachment(s)
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
mc12345678,
I think I am getting close with my SBA implementation, but I currently don't see attributes on some products in the shopping cart page and I wonder if you have some insights. I have other mods that may be affecting this page as well.
Products with zero or two option names associated seem fine, but products with one option name show up in the cart without their attributes listed. For example this product: https://www.tokyopenshop.com/shop2/m...cil-p-624.html
I believe this "if" is failing in the tpl_shopping_cart_default.php file in my template
Code:
if (isset($product['attributes']) && is_array($product['attributes'])) {
Here are my current settings that I think might be relevant to SBA:
Attachment 17260Attachment 17259
Thanks in advance for any help!
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
fbroz
mc12345678,
I think I am getting close with my SBA implementation, but I currently don't see attributes on some products in the shopping cart page and I wonder if you have some insights. I have other mods that may be affecting this page as well.
Products with zero or two option names associated seem fine, but products with one option name show up in the cart without their attributes listed. For example this product:
https://www.tokyopenshop.com/shop2/m...cil-p-624.html
I believe this "if" is failing in the tpl_shopping_cart_default.php file in my template
Code:
if (isset($product['attributes']) && is_array($product['attributes'])) {
Here are my current settings that I think might be relevant to SBA:
Attachment 17260Attachment 17259
Thanks in advance for any help!
Actually, and unfortunate for the formal lack of instruction, but basically, in the Dynamic Dropdowns section, the single_dropdown per the original dynamic dropdown instruction does not work properly and that if anything the multiple dropdowns option should be chosen. As written elsewhere in this thread, the single selection feature had already been developed and was functional, it was the multiple attributes that needed to be further implemented and Dynamic Dropdowns was the closest public application that supported it, but it also had its own other "issues". For some, they have worked out those issues, for others, they have used it as originally described. In trying not to break apart others work, I developed an alternative selection that offered the features that were missing and worked to get the desired results.
That said, the better option for single option name attributes to a product is to leave dynamic dropdowns set to the default setting for enable dynamic dropdowns (for multiple attributes only or the value of 2), to restore the Product Info Single Attribute Display Plugin to multiple_dropdowns (though it will not have an effect with the setting above set) and then to modify the option name type (in Option Names Manager) to the SBA Select List (Dropdown) Basic option type instead of the standard Dropdown option.
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
This was working fine. I'm not sure when the problem started. This occurs only on one, not very popular product.
When clicking Add to Cart, I get:
WARNING: An Error occurred, please refresh the page and try again.
Error log contains:
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 'and products_id = 110
OR (options_id = 3 AND options_values_' at line 4 :: select products_attributes_id
from products_attributes
where options_values_id =
and products_id = 110
OR (options_id = 3 AND options_values_id = 0 AND products_id = 110)
order by products_attributes_id ==> (as called by) /home/agag/public_html/includes/functions/extra_functions/products_with_attributes.php on line 350 <== in /home/agag/public_html/includes/classes/db/mysql/query_factory.php on line 167
Zen Cart 1.5.1a
SBA Version 1.5.4 for Zen Cart Version 1.5.5a
The item has one attribute which is not tracked by SBA, the option type is Text. When I do add it, I get the same error. If I add a second attribute, no error. It will add to cart.
https://www.shopasgoodasgold.com/don...bandanna-p-110
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
jeking
This was working fine. I'm not sure when the problem started. This occurs only on one, not very popular product.
When clicking Add to Cart, I get:
WARNING: An Error occurred, please refresh the page and try again.
Error log contains:
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 'and products_id = 110
OR (options_id = 3 AND options_values_' at line 4 :: select products_attributes_id
from products_attributes
where options_values_id =
and products_id = 110
OR (options_id = 3 AND options_values_id = 0 AND products_id = 110)
order by products_attributes_id ==> (as called by) /home/agag/public_html/includes/functions/extra_functions/products_with_attributes.php on line 350 <== in /home/agag/public_html/includes/classes/db/mysql/query_factory.php on line 167
Zen Cart 1.5.1a
SBA Version 1.5.4 for Zen Cart Version 1.5.5a
The item has one attribute which is not tracked by SBA, the option type is Text. When I do add it, I get the same error. If I add a second attribute, no error. It will add to cart.
https://www.shopasgoodasgold.com/don...bandanna-p-110
The version of that file is from Mar 27, 2016 or earlier (older). There is some code that was added above there at a later time to address that potential result, and actually as the plugin stands, that file no longer contains execution code (all commented out), but the installer has not been updated to remove it. If you wish to continue using that version of the software, there is a single fix for that area of the code:
At/around line 320 change:
Code:
if ($multi) {
$first_search = 'where options_values_id in (' . implode(',', $temp_attributes) . ')'; // This helps make a list of items where the options_values_id is compared to each individual attribute ("x","y","z")
} else {
$first_search = 'where options_values_id = ' . implode(',', $temp_attributes); // This helps make a list of items where the options_values_id is compared to each individual attribute ("x","y","z")
// $first_search = 'where options_values_id = "' . $attribute . '"';
}
to the following by adding the below highlighted if statement:
Code:
if ($multi) {
$first_search = 'where options_values_id in (' . implode(',', $temp_attributes) . ')'; // This helps make a list of items where the options_values_id is compared to each individual attribute ("x","y","z")
} else {
$first_search = 'where options_values_id = ' . implode(',', $temp_attributes); // This helps make a list of items where the options_values_id is compared to each individual attribute ("x","y","z")
if (implode(',', $temp_attributes) == "") {
$first_search = 'where options_values_id = 0'; // This helps make a list of items where the options_values_id is compared to each individual attribute ("x","y","z")
}
// $first_search = 'where options_values_id = "' . $attribute . '"';
}
Also, above that code area is some missing sanitization that is shown in the current version of that function which is located in includes/classes/class.products_with_attributes_class_stock.php around line 453 of that file as available from github.
Code:
} elseif ($optvalid == 0) {
$specAttributes[$optid] = (int)$optvalid;
} elseif (is_array($optvalid)) {
if ($multi == false && count($optvalid) > 1) {
$multi = true;
}
foreach($optvalid as $optid2=>$optvalid2) {
$temp_attributes[] = (int)$optvalid2;
}
} elseif (true) { // mc12345678 Here is one place where verification can be performed as to whether a particular attribute should be added. This is probably the best place to do the review because all aspects of the attribute are available.
$temp_attributes[] = (int)$optvalid;
}
Lastly, though I stopped searching backwards to see when line 350 had become the sql execution line to present that error, this link shows all of the changes that have been made since March 27, 2016: https://github.com/mc12345678/Stock_...b5d4d...master
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
That fix did it, thank you!
I do have plans to upgrade the site and SBA. Just need to find the time. Being that I support this in my free time, that has been difficult. :-)
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
jeking
That fix did it, thank you!
I do have plans to upgrade the site and SBA. Just need to find the time. Being that I support this in my free time, that has been difficult. :-)
Roger that, I know the feeling...
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
I searched this thread and could not find info on this. I installed both the Dynamic Drpodown and the SBA add on to my Zen shop. I am getting a warning under the add to cart and am trying to figure out why. It is not allowing the drop down. here is the link here -->http://underworldfigures.com/index.p...products_id=67
I am using Zen cart 1.5.0
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
Zoloworld
I searched this thread and could not find info on this. I installed both the Dynamic Drpodown and the SBA add on to my Zen shop. I am getting a warning under the add to cart and am trying to figure out why. It is not allowing the drop down. here is the link here -->
http://underworldfigures.com/index.p...products_id=67
Ok, so when you say you installed both SBA and Dynamic Dropdowns, need to back up a second. The distribution available from https://github.com/mc12345678/Stock_...butes_Combined, has or is both of those. So, the statement makes one wonder what the source of your install was.
That said, anytime you see an error (which may actually be unrelated to the above distribution), there are some easy actions to perform as identified in this ZC provided FAQ: https://www.zen-cart.com/content.php...-and-try-again
Whatever the case, if you would be so kind as to identify how the site got to where it is in relation to the above and then if you need assistance interpreting the associated information (preferably as it relates to the install as described above) then feel free to post the contents here (sanitize out any specific file path information of concern and please press the # button in the message box toolbar just before pasting.
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
mc12345678
Ok, so when you say you installed both SBA and Dynamic Dropdowns, need to back up a second. The distribution available from
https://github.com/mc12345678/Stock_...butes_Combined, has or is both of those. So, the statement makes one wonder what the source of your install was.
That said, anytime you see an error (which may actually be unrelated to the above distribution), there are some easy actions to perform as identified in this ZC provided FAQ:
https://www.zen-cart.com/content.php...-and-try-again
Whatever the case, if you would be so kind as to identify how the site got to where it is in relation to the above and then if you need assistance interpreting the associated information (preferably as it relates to the install as described above) then feel free to post the contents here (sanitize out any specific file path information of concern and please press the
# button in the message box toolbar just before pasting.
Thank you so much for the reply.
I downloaded it from the plug-ins section. It did not have both as I was looking after I added the SQL info. I am going to run a debug log to see if an error shows up.