Jump to content

Hiding out of stock items not working


slic535

Recommended Posts

A few conditions must exist: the person viewing (does not need to be logged in as a customer) the storefront must not be logged in as an admin (using the same browser which then shares a session cookie), the "Hide-out-of-stock" general setting must be checked, the product must have the "Use Stock Level" checked and have a stock level of zero, and possibly "Allow out-of-stock purchases" general setting must be unchecked.

Then have CubeCart clear its internal cache.

From what version of CubeCart did you upgrade from, where the Hide out-of-stock setting worked last?

Link to comment
Share on other sites

  • 3 months later...

I have just used or ticked this hide out of stock feature myself to see what happens, as I have a few listings with different colours and have the odd colour option that is now out of stock and it seems to break my shop category's.

All 7 shop categories are displayed correctly but they only link to category ID No.1 and only show ID no.1 category even when you click on category no 3, 4 or 5.

All 7 categories link and display correctly when I untick this hide out of stock feature and I will just leave the shop like this as I usually have it 100% stocked.

I am using CC 6.4.9

Link to comment
Share on other sites

Is trying the Hide-Out-of-Stock feature new to you? Which is to ask, do you think this is new to CC649, or maybe this scenario has existed for many past versions?

I see nothing in Amzin that might cause issues with links to category pages.

Link to comment
Share on other sites

Please keep in mind that if you are signed in to administration, and viewing the storefront, out-of-stock products will still be shown.

So, be sure to Clear Cubecart's cache and log out after setting and saving this feature.

Also, the seven categories listed are in Amzin's list of categories?

 

Link to comment
Share on other sites

On my development system, I am trying Amzin 1.05 on CC647 running under PHP8.1. (Found a bug in a template.)

But the links appear correct.

I have not yet installed CC649. But analyzing code differences between CC647 and CC649 shows no likely source of this situation.

  • Thanks 1
Link to comment
Share on other sites

Please try this edit:

In the file /classes/catalogue.class.php, near lines 1781-1783, find:

        if($GLOBALS['config']->get('config', 'hide_out_of_stock')=='1') {
            $search_data['inStock'] = true;
        }

CUT to the system clipboard, then PASTE these lines just below this line, just a few lines down:

        if (!empty($joins) || is_array($search_data)) {

So that the resulting area of code looks like:

        // Presence of a join is similar to presence of a search keyword
        if (!empty($joins) || is_array($search_data)) {

            if($GLOBALS['config']->get('config', 'hide_out_of_stock')=='1') {
                $search_data['inStock'] = true;
            }

            if (!empty($search_data['priceVary'])) {

 

Link to comment
Share on other sites

The edit as requested now looks like

 

if($GLOBALS['config']->get('config', 'hide_out_of_stock')=='1') {
            $search_data['inStock'] = true;
        }
        
        // Presence of a join is similar to presence of a search keyword
        if (!empty($joins) || is_array($search_data)) {
            if($GLOBALS['config']->get('config', 'hide_out_of_stock')=='1') {
                $search_data['inStock'] = true;
            }
            if (!empty($search_data['priceVary'])) {
                // Allow for a 5% variance in prices

 

I believe this to be correct, But still the same problem.

Link to comment
Share on other sites

For a product with no colour options, when this is zero stock a banner across the image appears to say "Out of Stock" and with products with various colour options, any option then showing zero, the customer gets an error warning saying

" Sorry but the chosen product option combination is out of stock or the last of the stock is already in your basket "

when they attempt to add that item to the basket. Hopefully everything is now working correctly.

Link to comment
Share on other sites

In my opinion, CubeCart is not yet coded to instantly detect when a given combination of option choices - including there being only one option - are not available.

That is to say, red and blue, small and large, but only red small is not available, CubeCart still shows all assigned options. This is normal behavior.

There are (or have been) plugins available to query CubeCart when the customer changes options.

 

Link to comment
Share on other sites

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