Jump to content

Resolved - Upgrade to 5.2.2 done but Stock level colum gone in Product


Nick F
 Share

Recommended Posts

Hi,

 

I've done an upgrade to 5.2.2 directly from the previous version and the webshop admin guys at work has noticed that on the product invetory page the Stock colum has now gone.

 

The boys used that as a quick and easy way to keep a current eye on the stock level per product.  They could also click the little breadcrumb triangle thingy and sort by the stock level colum.

 

I found that single page very usefull when keeping an eye on the webshop from my phone as i travel out of the office as that product inventory page told me everything i need to know from one glance - from stock to what the boys had been changing / adding and when.

 

Is this just an upgrade glitch as i think the upgrade took a few attempts to auto update or has it this stock coloum been dropped for some reason does anyone know?

 

i've include a picture of our shop with the stock colum gone after upgrade.

 

On the plus side we really do like the new shop and its paid for its self already in its low costs and ease of use.  We upgraded from the free version of V3 and after a few years of running that we find the V5 does everythign we need,

 

version 5.2.2

php ver 5.3.23

my sql ver 50168

 

thanks

Nick.

 

 

 

Link to comment
Share on other sites

I found it's been commented out in 5.2.2 admin/skins/default/products.index.php AND admin/source/product.index.inc.php, which maybe makes sense if you're using the Option Matrix. But it worked for me when I took the comment code off, because I do NOT have any options on my estates store.

Link to comment
Share on other sites

  • 3 weeks later...
Guest lil-redrex

Same issue for us, frustrating not having it there since going 5.2.2.

Very handy for quick check of stock levels.

 

I have reported it as a bug in the bug tracker. Will see how it goes.

 

Should be shown even if using product options etc.

Link to comment
Share on other sites

Should be shown even if using product options etc.

 

When the Option Matrix is set up, the Stock Level on the General tab of the product is set to zero, and the stock levels are on each option. Therefore, showing the stock level on the Product Summary screen would show the stock level as zero, IF you use Options.

Link to comment
Share on other sites

  • 1 month later...

I found it's been commented out in 5.2.2 admin/skins/default/products.index.php AND admin/source/product.index.inc.php, which maybe makes sense if you're using the Option Matrix. But it worked for me when I took the comment code off, because I do NOT have any options on my estates store.

 

The code is fixable easily enough in these two files - just take the comment code off - BUT it won't work if you use Option Matrix stock control on items. So I use it on one site, but not on another.

Link to comment
Share on other sites

There is also an edit a bit further down:

                <td>{$product.product_code}</td>
                <td>{$product.price}</td>
<td align="center"><span class="editable number" name="stock_update[{$product.product_id}]" title="{$LANG.common.click_edit}">{$product.stock_level}</span></td>
                <td>{$product.updated}</td>

This will add the ability to update stock levels from the listing.

 

In product.index.inc.php, find near line 580, this:

#: Product Clone :#

 

Scan upwards until you find this:

  $GLOBALS['cache']->clear();
  httpredir(currentPage(array('delete')));
}

 

Replace whatever is between these two end points with:

if (isset($_POST['status']) && is_array($_POST['status']) && Admin::getInstance()->permissions('products', CC_PERM_EDIT)) {
    /* !Update Status */
    foreach ($_POST['status'] as $product_id => $status) {
        $GLOBALS['db']->update('CubeCart_inventory', array('status' => $status), array('product_id' => $product_id));
    } $status_updated = true;
}

if (isset($_POST['stock_update']) && is_array($_POST['stock_update']) && Admin::getInstance()->permissions('products', CC_PERM_EDIT)) {
    /* !Update Stock Levels */
    foreach ($_POST['stock_update'] as $product_id => $stock_level) {
        $GLOBALS['db']->update('CubeCart_inventory', array('stock_level' => $stock_level), array('product_id' => $product_id));
    } $stock_updated = true;
}
if($status_updated || $stock_updated) { $GLOBALS['cache']->clear(); httpredir(currentPage()); }

This will database the new stock levels.

 

When getting the products for the list, the stock_level will be available -- if it was recorded when the product was added to the database.

Link to comment
Share on other sites

In product.index.inc.php, find near line 580, this:

#: Product Clone :#

 

Scan upwards until you find this:

  $GLOBALS['cache']->clear();
  httpredir(currentPage(array('delete')));
}

 

Replace whatever is between these two end points -- which, in a stock, unedited file, is:

if (isset($_POST['status']) && is_array($_POST['status']) && Admin::getInstance()->permissions('products', CC_PERM_EDIT)) {
    /* !Update Status */
    foreach ($_POST['status'] as $product_id => $status) {
        $GLOBALS['db']->update('CubeCart_inventory', array('status' => $status), array('product_id' => $product_id));
    }
    $GLOBALS['cache']->clear();
    httpredir(currentPage());
}

with:

if (isset($_POST['status']) && is_array($_POST['status']) && Admin::getInstance()->permissions('products', CC_PERM_EDIT)) {
    /* !Update Status */
    foreach ($_POST['status'] as $product_id => $status) {
        $GLOBALS['db']->update('CubeCart_inventory', array('status' => $status), array('product_id' => $product_id));
    } $status_updated = true;
}

if (isset($_POST['stock_update']) && is_array($_POST['stock_update']) && Admin::getInstance()->permissions('products', CC_PERM_EDIT)) {
    /* !Update Stock Levels */
    foreach ($_POST['stock_update'] as $product_id => $stock_level) {
        $GLOBALS['db']->update('CubeCart_inventory', array('stock_level' => $stock_level), array('product_id' => $product_id));
    } $stock_updated = true;
}

if($status_updated || $stock_updated) { $GLOBALS['cache']->clear(); httpredir(currentPage()); }

Also, in the template file, the second edit, there is a open bracket that got in to my post above somehow. That needs to be removed. It is removed in the post above.

Link to comment
Share on other sites

  • 1 month later...
  • 2 weeks later...

Open the file /admin/sources/products.index.inc.php for editing, and go to line 580.

 

Line 580 is:

#: Product Clone :#

 

Lines 567-569 is:

    $GLOBALS['cache']->clear();
    httpredir(currentPage(array('delete')));
}

 

So, the code that is between these two locations is:

if (isset($_POST['status']) && is_array($_POST['status']) && Admin::getInstance()->permissions('products', CC_PERM_EDIT)) {
    /* !Update Status */
    foreach ($_POST['status'] as $product_id => $status) {
        $GLOBALS['db']->update('CubeCart_inventory', array('status' => $status), array('product_id' => $product_id));
    }
    $GLOBALS['cache']->clear();
    httpredir(currentPage());
}

Replace this code with what is given in post #12.

 

If you cannot find the code as stated at lines 567-569 and line 580, then you are not looking at the correct file.

Link to comment
Share on other sites

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

 Share

×
×
  • Create New...