{"action":"opened","issue":{"url":"https://api.github.com/repos/cubecart/v6/issues/1266","repository_url":"https://api.github.com/repos/cubecart/v6","labels_url":"https://api.github.com/repos/cubecart/v6/issues/1266/labels{/name}","comments_url":"https://api.github.com/repos/cubecart/v6/issues/1266/comments","events_url":"https://api.github.com/repos/cubecart/v6/issues/1266/events","html_url":"https://github.com/cubecart/v6/issues/1266","id":179473834,"number":1266,"title":"BUG - ctrl_stock logic is incorrect","user":{"login":"Noodleyman","id":10614018,"avatar_url":"https://avatars.githubusercontent.com/u/10614018?v=3","gravatar_id":"","url":"https://api.github.com/users/Noodleyman","html_url":"https://github.com/Noodleyman","followers_url":"https://api.github.com/users/Noodleyman/followers","following_url":"https://api.github.com/users/Noodleyman/following{/other_user}","gists_url":"https://api.github.com/users/Noodleyman/gists{/gist_id}","starred_url":"https://api.github.com/users/Noodleyman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Noodleyman/subscriptions","organizations_url":"https://api.github.com/users/Noodleyman/orgs","repos_url":"https://api.github.com/users/Noodleyman/repos","events_url":"https://api.github.com/users/Noodleyman/events{/privacy}","received_events_url":"https://api.github.com/users/Noodleyman/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-09-27T12:01:59Z","updated_at":"2016-09-27T12:01:59Z","closed_at":null,"body":"stumbled across this today when trying to figure out why all of the inventory was showing out of stock when stock control was disabled in the category view.\r\n\r\n\"ctrl_stock\" has a true/false value. True means we are enforcing stock levels, false means we are not. For category view this is done in catalogue.class.php\r\n`$product['ctrl_stock'] = (!$product['use_stock_level'] || $GLOBALS['config']->get('config', 'basket_out_of_stock_purchase') || ($product['use_stock_level'] && $GLOBALS['catalogue']->getProductStock($product['product_id'], null, true))) ? true : false;`\r\n\r\nwith \"Allow out-of-stock purchases\" iin store settings disabled, and \"Use Stock Level\" at the product level unchecked, ctrl_stock = true, but it should be false. \r\n\r\nThe logic is flawed, it should be:\r\n`$product['ctrl_stock'] = ($product['use_stock_level'] && $GLOBALS['catalogue']->getProductStock($product['product_id'], null, true) && !$GLOBALS['config']->get('config', 'basket_out_of_stock_purchase')) ? true : false;`\r\n\r\n\r\n"}}
{"actor":{"display_login":"Noodleyman"}}