crissie2389 Merchant From United States Member since Mar 2022 crissie2389 Apr 1 2022 01:16 AM When selecting a product combo, json output is blank. The part that is failing seems to be this: if (count($product->options_stock) > 0) { foreach ($product->options_stock as $stock_option) { foreach (explode(',', $stock_option['combination']) as $pair) { if (!in_array($pair, $selected_options)) continue 2; }``` It seems to never match anything, I put: ```print "if not in array $pair, of ". print_r($selected_options); print "\n"; if (!in_array($pair, $selected_options)) print "continue";``` to debug it, and here were the results: ```Array ( [0] => 1-0 [1] => 2-0 ) if not in array 1-0:"Black", of 1 continue Array ( [0] => 1-0 [1] => 2-0 ) if not in array 1-0:"Black", of 1 continue Array ( [0] => 1-0 [1] => 2-0 ) if not in array 1-0:"Grey", of 1 continue Array ( [0] => 1-0 [1] => 2-0 ) if not in array 1-0:"Grey", of 1 continue I am not sure how to fix this, please help if you can.
tim Founder From Sweden Member since May 2013 tim Apr 2 2022 03:54 AM I had a newer version locally that I published. If that doesn't solve the problem I will dig into it. Let me know if it solves your problem.
crissie2389 Merchant From United States Member since Mar 2022 crissie2389 Apr 5 2022 11:20 PM Thank you, Tim! Unfortunately it still doesn't work. The behavior is the same. What should be json output is just 6 lines but blank.
tim Founder From Sweden Member since May 2013 tim Apr 7 2022 02:27 AM Worked for me. Any errors in logs/errors.log?
crissie2389 Merchant From United States Member since Mar 2022 crissie2389 Apr 7 2022 10:19 PM No errors in error.log for this. The $_POST contents: ( [product_id] => 6 [options] => Array ( [Color] => Black [Size] => X-Small ) [quantity] => 1 ) And the output in the part again that I believe is failing (?) ( [0] => 1-0 [1] => 2-0 ) if not in array 1-0:"Black", of 1 continueArray ( [0] => 1-0 [1] => 2-0 ) if not in array 1-0:"Black", of 1 continueArray ( [0] => 1-0 [1] => 2-0 ) if not in array 1-0:"Grey", of 1 continueArray ( [0] => 1-0 [1] => 2-0 ) if not in array 1-0:"Grey", of 1 continue If there is anything else I can do to place print_r or var_dumps to help debug why this isn't working, please let me know. Thanks for your help. It seems to just fail to find it and continues through all the products and doesn't stop.
crissie2389 Merchant From United States Member since Mar 2022 crissie2389 Apr 18 2022 07:27 PM I've tried going back to the beginning, uninstalling the mod, and redoing everything step by step just to ensure I didn't miss anything, same result. If this cannot be fixed because it is not a paid modification, is there a mod in the store otherwise that would incorporate this functionality? Even if it's paid, I would pay for it to work. Without this mod, the default stock amount is misleading. I might have a total of 9 stocked shirts but which combination? It could be 6 gray shirts, and 3 black shirts. The customer has no idea what combinations are actually stocked, until they try and add them and this will be confusing when some combinations are sold out.
tim Founder From Sweden Member since May 2013 tim Apr 29 2022 02:28 AM I will rewrite this addon when I get the chance. Right now I have work over my head. Remind me in a week or two.
crissie2389 Merchant From United States Member since Mar 2022 crissie2389 May 15 2022 05:15 PM Thank you tim, I appreciate your time. I'm still very interested in getting this addon to work!
tim Founder From Sweden Member since May 2013 tim Jun 20 2022 02:47 AM This addon has been implemented in the coming 2.5.0. See the commit here if you want to add it to the currrent version: https://github.com/litecart/litecart/commit/9db5691c285fca1c37763008993864929ab7d526