Found the solution like 2 hours ago, but haven't had a chance to write it up for others to reproduce. Involves changing a for loop into a foreach loop.
Found the solution like 2 hours ago, but haven't had a chance to write it up for others to reproduce. Involves changing a for loop into a foreach loop.
ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...
Let me see if I have enough resources immediately available.
I know it's in the includes/functions/extra_functions file.
Then in zen_get_sba_stock_attribute there is theIf changed to like:Code:for ($j =0; $j < $k; $j++)
I'm not sure if I'm set on the second part of the variable, but for current operation and coding it doesn't matter, the stock of a multi-attribute (combined) variant did get reduced. I had tried a couple of other things as well, but when I restored the for loop it broke it, when I used foreach it worked...Code:foreach ($attribute_list as $j => $attrib_data)
ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...
That worked fine. Thanks!
Here's the code to change at line 243 from
Change it toPHP Code:
if (isset($attribute_list) && is_array($attribute_list) && ($k = sizeof($attribute_list) > 0)) {
if ($from == 'order') {
for ($j = 0; $j < $k; $j++) { // Change this line to fix update stock
if (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[$attribute_list[$j]['option_id']] = $attribute_list[$j]['value_id'];
}
}
$attribute_list = $temp_attributes;
PHP Code:
if (isset($attribute_list) && is_array($attribute_list) && ($k = sizeof($attribute_list) > 0)) {
if ($from == 'order') {
foreach ($attribute_list as $j => $attrib_data) { //Changed to fix update stock
if (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[$attribute_list[$j]['option_id']] = $attribute_list[$j]['value_id'];
}
}
$attribute_list = $temp_attributes;
Last edited by badarac; 20 Jul 2016 at 08:20 PM.
So I committed that solution to the github repo, though I continued to use spaces instead of tabs.Still need/want to verify that quantities for all entries decrease as expected if the product is made up of multiple individual attributes...
Again, thank you for the backup, comment, and testing... I did find a few other minor improvements, but that type of thing I think is going to continue as I now get more of a chance to review the code rather than either write new or rewrite existing code. Starting to slip little things in like buttons to move from one area to another to make manipulation/navigation easier, going to modify some of the admin portion of the SBA editing area so that can grow a little and maybe add some additional fields, either add a switch or an indicator if a set of attributes are using the simple SBA dropdown option and allow that setting to be modified (for all such attributes, or could specialize it for just that/those attributes on that product, etc), looking to move those extra functions into a class instead so that at least things are consolidated and since it seems the SBA "code" really is only used by SBA, otherwise there's a few pieces of information to be displayed which could come from SBA. Lot's of little things, but want to tidy up a little and get some additional consistency on the customid. :)
ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...
SBA is something I really could use, but do I understand that it's not compatible with Zencart v.155? Would it be better for me to wait until 1.6 is released? I don't have such huge inventory that it will be a major problem right now, but that is likely to change.
Umm... Did you happen to look back a "page" (assuming your view supports page viewing?) Or at post 2571?
It has not been issued to the ZC site yet for ZC 1.5.5, but that is because there are a few known things still being worked on, but in general it is pretty darn close. Trying to touch a few odds and ends that seem easy to address, and then should be able to get the instructions updated that potteryhouse worked on and submit as an updated plugin compatible with ZC 1.5.1 through 1.5.5.
Current location is on github.
ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...
Help, I'm trying to get Stock_By_Attributes_Combined-master working on the new ZC 1.5.5.
But somewere I get stucked.
It's all working fine untill I try to put something in the basket. Then the store gives a faillure.
Fatal error: 1054:Unknown column 'Array' in 'where clause' :: select products_attributes_id
from products_attributes
where options_values_id = Array
and products_id = 1
order by products_attributes_id ==> (as called by) /customers/4/8/9/phaedram.nl/httpd.www/includes/functions/extra_functions/products_with_attributes.php on line 378 <== in /customers/4/8/9/phaedram.nl/httpd.www/includes/classes/db/mysql/query_factory.php on line 167
Can someone please give me a hint where to look for?
So, looking at the code that is available right now, it seems like that area of the includes/functions/extra_functions/products_with_attributes.php file is supposed to be provided a value that is fed to an array and then the array is imploded (which takes each array item, and puts it together with the previous) thus no array is left behind...
What is unique about the product? Is it some sort of special product type? What plugin(s) are also installed. Can't reproduce the issue unless the attribute(s) of the product are themselves some sort of array of additional attributes or the like.
How about a Web address?
ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...
The webstore is: http://www.phaedram.nl
And other plugin's are: edit orders, super orders, ideal and dutch translation. These plugins work just fine.
And also Stock by attribute, that is until I try to put a item in the basket.
Tjalling
Last edited by Tjalling; 25 Jul 2016 at 08:12 PM. Reason: better weblink
Bookmarks