Jump to content

[Resolved] Featured Product doesn't always display


Mike MacKechnie

Recommended Posts

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.php

CubeCart Version 6.0.5
Crosshatch skin
PHP Version 5.4.40
MySQL Version 5.5.42-37.1-log

Link to comment
Share on other sites

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.   

 

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

  • 3 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...