Mike MacKechnie Posted June 18, 2015 Share Posted June 18, 2015 I've added BSmither's rpis@cubecart600+ code snippet to ensure that only in-stock items show in the Featured Items box, as per http://forums.cubecart.com/topic/49346-changing-foundation-layout-need-help/#entry206383 but the box doesn't always display. I would say on average for every 3 clicks, it displays twice.2 out of 3 ain't bad I know, but is there a code fix or snippet out there that ensures that the Featured Items box always displays?I find that the storefront looks a bit lop-sided without the Featured Items box.http://www.wymeruk.co.uk/Store/index.phpCubeCart Version 6.0.5Crosshatch skinPHP Version 5.4.40MySQL Version 5.5.42-37.1-log Quote Link to comment Share on other sites More sharing options...
bsmither Posted June 18, 2015 Share Posted June 18, 2015 I can revisit this for CC605.My comment is that CubeCart will try up to 20 times to find a product in stock.So, I have to ask, what is the ratio of inventory you have that is in stock versus out of stock? Quote Link to comment Share on other sites More sharing options...
bsmither Posted June 18, 2015 Share Posted June 18, 2015 My testing shows the snippet still works as is for CC605. Quote Link to comment Share on other sites More sharing options...
Mike MacKechnie Posted June 18, 2015 Author Share Posted June 18, 2015 You've probably got the answer there.My client's catalogue is a bit of a mess to be honest. There are 1043 items in the catalogue, but only 60 of them are currently available for purchase, and of that 60, 14 of those have either zero (out of stock) or null (order on demand) stock levels.I can see from the _displayRandomProduct code that the products have to be available for purchase ('status' => '1'), so I guess it's the 14 with no stock level that are causing the problem. I will get back to my client and tell him to tidy up. Quote Link to comment Share on other sites More sharing options...
bsmither Posted June 18, 2015 Share Posted June 18, 2015 In admin, Store Settings, Advanced tab, enable debugging and enter your IP address (www.whatismyip.com).Then have the browser fetch the Homepage.In the debug section that appears at the bottom of the page, scan the SQL queries for this query:SELECT * FROM `CubeCart_inventory` JOIN (SELECT CEIL(RAND() * (SELECT MAX(`product_id`) FROM `CubeCart_inventory`)) AS `product_id`) AS `r` USING (`product_id`) WHERE CubeCart_inventory.status = '1'It will probably show up more than once and be at the bottom of the list. How many times is it listed when there is no Featured Product showing? Quote Link to comment Share on other sites More sharing options...
Mike MacKechnie Posted July 9, 2015 Author Share Posted July 9, 2015 Brian sorry for the delay in getting back to you with this.I get 21 instances of the SQL query that you mentioned. Quote Link to comment Share on other sites More sharing options...
bsmither Posted July 9, 2015 Share Posted July 9, 2015 Ok. CubeCart tried 20 times.I will say that as there become more products that are made available for purchase, the odds of finding a Featured Product increase. Quote Link to comment Share on other sites More sharing options...
Mike MacKechnie Posted July 10, 2015 Author Share Posted July 10, 2015 Yeah thanks Brian. My client doesn't seem unduly bothered by this, and his stock base is slowly increasing, so I'll leave it as is. 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.