Jen29 Posted September 1, 2017 Share Posted September 1, 2017 I'm selling exclusive digital content. When someone purchases an item it can not be purchased by anyone else. I have the stock level set to 1 but it shows as infinity available on the Product Inventory page. Where/how can I change this? Quote Link to comment Share on other sites More sharing options...
bsmither Posted September 1, 2017 Share Posted September 1, 2017 (edited) Welcome Jen29! Glad to see you made it to the forums. Currently, CubeCart is not coded to do this. That is, a digital item cannot be restricted by stock levels. But we can probably develop a code snippet to override this. Please let us know if you are running a specific version of CubeCart, or if we can plan for the latest version. My initial reply was probably for CubeCart many versions ago. Edited September 1, 2017 by bsmither Quote Link to comment Share on other sites More sharing options...
bsmither Posted September 1, 2017 Share Posted September 1, 2017 There is a very simple edit to show actual stock levels on digital items when viewing the Product Inventory list. Also, experiments with my installation of CC618 will restrict purchases of digital items to the actual stock level - provided that, in admin: Store Settings, Stock tab: "Allow out-of-stock purchases" is unchecked, and "Reduce stock levels" is set to Pending (probably the better of the three settings). Add/Edit a digital product, General tab: "Use Stock Level" is checked, and there is a numeric value for Stock Level. Here is the code edit: Using a programmer's text editor, in the file /admin/sources/products.index.inc.php, near line 1180: From: if ($result['use_stock_level'] == 0 || $result['digital'] > 0 || !empty($result['digital_path'])) { $result['stock_level'] = "∞"; } To: if ($result['use_stock_level'] == 0 || $result['digital'] > 0 || !empty($result['digital_path'])) { // $result['stock_level'] = "∞"; } Quote Link to comment Share on other sites More sharing options...
Jen29 Posted September 1, 2017 Author Share Posted September 1, 2017 Thanks so much! Quote Link to comment Share on other sites More sharing options...
harrisorganic Posted December 30, 2017 Share Posted December 30, 2017 Hi Brian, Happy New Year and all the best for 2018. Your snippet of code has saved me once again. Thanks to Jen29 for asking too. regards Duncan Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.