Community Forums

Remove (disable) out of stock items

General support for technical problems with OpenCart v1.x

Remove (disable) out of stock items

Postby sgfx » Wed Oct 14, 2009 11:46 pm

Most of the items in my store will be in stock only once. so when they are sold out, most likely they will not be restocked.
How would someone change a items status in the db to "disable", instead of simply listed out of stock in the front end?

Once a item is gone I have no reason for it to still show up in the store.

I don't what to delete the item from the db yet, I would rather do that in the admin once I know for sure it was really sold out or not going to be restocked.

It might be good if this could be made an option that could be triggered off of the "Out Of Stock Status:" in the admin area so if you chose let say "disable item" instead of "More Coming Soon" or "Out of stock" then it would automatically disable the item. - I am sure there are others who could use something like this.
User avatar
sgfx
 
Posts: 18
Joined: Wed Oct 07, 2009 8:56 pm

Re: Remove (disable) out of stock items

Postby Jan R » Thu Oct 15, 2009 1:33 pm

Oh my.. That is just what i needed. Have you found a way to do this yet?
I have been using Open Cart for a friends store but i can see that Would help her us so much. :D :D
»-(¯`·.·´¯)->"The most wasted day in that in which we have not laughed."<-(¯`·.·´¯)-«
User avatar
Jan R
 
Posts: 29
Joined: Thu Oct 15, 2009 1:20 pm

Re: Remove (disable) out of stock items

Postby Qphoria » Thu Oct 15, 2009 4:17 pm

1. Edit: catalog/model/catalog/product.php
2. All places you find:
Code: Select all
p.status = '1'

3. Replace with:
Code: Select all
p.status = '1' AND p.quantity > '0'
ImageImage
Donate!|OpenCart Basics|GeoZones
Help me get more development cloud storage - Click Here to get DropBox
User avatar
Qphoria
Administrator
 
Posts: 19193
Joined: Mon Jul 21, 2008 2:02 pm
Donate to Qphoria

Re: Remove (disable) out of stock items

Postby sgfx » Thu Oct 15, 2009 5:13 pm

Works like a charm... I love simple solutions.!

I also had to make that same change to your Controller/product/all.php so that it works with your free "Show All Products" plugin.

Thanks Qphoria .

Perhaps that will be an standard option in an upcoming upgrade.
User avatar
sgfx
 
Posts: 18
Joined: Wed Oct 07, 2009 8:56 pm

Re: Remove (disable) out of stock items

Postby Qphoria » Thu Oct 15, 2009 8:19 pm

why does it need to be? The change was so simple and you are done.
ImageImage
Donate!|OpenCart Basics|GeoZones
Help me get more development cloud storage - Click Here to get DropBox
User avatar
Qphoria
Administrator
 
Posts: 19193
Joined: Mon Jul 21, 2008 2:02 pm
Donate to Qphoria

Re: Remove (disable) out of stock items

Postby sgfx » Thu Oct 15, 2009 8:43 pm

Oh yes it was simple .. I just think that it would be a good option (because it is so easy to do) to have for others and something that would not have to redone after each update (assuming the file changes in an update)
I don't know perhaps no one else needs such a thing.
Thanks again.
User avatar
sgfx
 
Posts: 18
Joined: Wed Oct 07, 2009 8:56 pm

Re: Remove (disable) out of stock items

Postby Jan R » Fri Oct 16, 2009 12:49 pm

Jan here
What a simple fix, (thanks Qphoria) Sally said this is going to help us out a lot. :)

I agree with sgfx. If it was settable in the administration area in the future, that would be cool. 8)
I like the ideal of adding it to the pull down were we select 'out of stock' or 'more coming soon'

Good job guys. -=:@:=-
»-(¯`·.·´¯)->"The most wasted day in that in which we have not laughed."<-(¯`·.·´¯)-«
User avatar
Jan R
 
Posts: 29
Joined: Thu Oct 15, 2009 1:20 pm

Re: Remove (disable) out of stock items

Postby mat-ko » Mon Nov 08, 2010 9:07 am

both cases make sence to me, it may or may not be wanted to display products of quantity=0. Me I need to display all enabled products, even if they aren't actually on stock. A setting would be a great solution I think :)
User avatar
mat-ko
 
Posts: 8
Joined: Wed Oct 27, 2010 6:35 am

Re: Remove (disable) out of stock items

Postby nakz » Mon Nov 29, 2010 4:55 am

Thanks Qphoria!
How do I disable this for "Option" item?
Current option item with vale "0" still showing in the drop down box.

Thanks.
nakz
 
Posts: 12
Joined: Wed Apr 28, 2010 12:27 am

Re: Remove (disable) out of stock items

Postby jamesw » Fri Dec 03, 2010 9:52 pm

nakz wrote:Thanks Qphoria!
How do I disable this for "Option" item?
Current option item with vale "0" still showing in the drop down box.

Thanks.


Yes I have the same issue - is there a simple way to make 'options values' not in stock not display on the dropdown?
jamesw
 
Posts: 2
Joined: Sun Jul 18, 2010 9:16 pm

Re: Remove (disable) out of stock items

Postby egejo » Mon Apr 25, 2011 3:26 pm

Please I'm having and issue when I do this mod after editing the catalog/model/catalog/product.php
and replacing all the p.status = '1' as told... the out of stock items stop displaying but the search function stops working and I'm getting this message when I do a search:

Code: Select all
Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'p.status = '1' AND p.quantity > '0' AND p.date_available <= NOW()' at line 1
Error No: 1064
SELECT COUNT(*) AS total FROM product p LEFT JOIN product_description pd ON (p.product_id = pd.product_id) LEFT JOIN product_tags pt ON (p.product_id = pt.product_id) LEFT JOIN product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN manufacturer m ON (p.manufacturer_id = m.manufacturer_id) LEFT JOIN stock_status ss ON (p.stock_status_id = ss.stock_status_id) WHERE pd.language_id = '2' AND p2s.store_id = '0' AND ss.language_id = '2' AND pt.language_id = '2' AND (LCASE(pt.tag) = 'i4' OR LCASE(pt.tag) = 'i4') p.status = '1' AND p.quantity > '0' AND p.date_available <= NOW()


Please help me I need this mod but can't afford to loose searching capabilities neither.
Thanks for the help in advance
egejo
 
Posts: 3
Joined: Sun Apr 24, 2011 12:00 am

Re: Remove (disable) out of stock items

Postby maperdel » Fri May 06, 2011 7:36 pm

Your query is lacking an 'AND' before the 'p.status = '1'' string...it should say AND p.status = '1'

Best.
maperdel
 
Posts: 29
Joined: Fri Mar 25, 2011 5:38 pm

Re: Remove (disable) out of stock items

Postby StudioImpact » Tue Sep 27, 2011 7:18 am

Hi,
Love this simple fix which makes perfect sense to me, and I thought a client wanted it, but as it turns out he just added a lot of "coming soon" products with quantity of 0, and he does want to display these items of course. Is there a way to show coming soon, and not show out of stock?

edit: it concerns OpenCart v1.4.9.1. additional, we have 4 statusses for products: in stock, out of stock, coming soon, not online available (i'm new to OpenCart and working on an existing shop I'm not even sure if this is default or personalized) obviously i only want out of stock disabled.
StudioImpact
 
Posts: 2
Joined: Tue Sep 27, 2011 7:12 am

Re: Remove (disable) out of stock items

Postby shiokguy » Fri Sep 30, 2011 1:50 am

Dear all
How about having the ADD to Cart Graphic change to SOLD OUT Graphic?

I am using 1.5.1.1
Anyone can help me in doing this?

Regards
Shiok Guy
shiokguy
 
Posts: 35
Joined: Wed Jul 13, 2011 2:28 am

Re: Remove (disable) out of stock items

Postby proveyourselfthom » Fri Oct 28, 2011 11:22 am

I totally agree with sgfx, it should be an option in admin. It's hard to update when you do changes to the core.

Or maybe it would be great to display the product (product's profile, in search, etc) and instead of allow users to click on "Add to Cart", it should show up a message. "Unavailable product", "No longer available" or something like that.

I don't understand why users can add unavailable products to the cart with System => Settings => Option => Stock Checkout disabled.

Using version 1.5.1.2 here.

Thank you.
proveyourselfthom
 
Posts: 8
Joined: Wed Sep 21, 2011 11:53 am

Re: Remove (disable) out of stock items

Postby proveyourselfthom » Fri Oct 28, 2011 1:00 pm

Instead of change core files, I've made changes to my template files, removing the button when stock = 0. For example:

/opencart/catalog/view/theme/mytheme/template/product/product.tpl (~line 180):

Code: Select all
<?php if ($product_info['quantity']) { ?>
<div class="cart">
    <div><?php echo $text_qty; ?>
        <input type="text" name="quantity" size="2" value="<?php echo $minimum; ?>" />
        <input type="hidden" name="product_id" size="2" value="<?php echo $product_id; ?>" />&nbsp;<a id="button-cart" class="button"><span><?php echo $button_cart; ?></span></a>
    </div>
    <?php if ($minimum > 1) { ?>
    <div class="minimum"><?php echo $text_minimum; ?></div>
    <?php } ?>
</div>
<?php } ?>

I've added the first if statement. That's it.
proveyourselfthom
 
Posts: 8
Joined: Wed Sep 21, 2011 11:53 am

Re: Remove (disable) out of stock items

Postby proveyourselfthom » Mon Oct 31, 2011 7:35 am

Unfortunately, it can't be made changing template files... You can't check the stock on /www/megaminiaturas/catalog/view/theme/megaminiaturas/template/product/category.tpl. I'll need to do changes in OpenCart's core.
Any alternative?
Thanks :(
proveyourselfthom
 
Posts: 8
Joined: Wed Sep 21, 2011 11:53 am

Re: Remove (disable) out of stock items

Postby proveyourselfthom » Mon Nov 07, 2011 6:17 am

vqmod has saved my life :)
But anyway, it would be great to have an admin option.
Thanks.
proveyourselfthom
 
Posts: 8
Joined: Wed Sep 21, 2011 11:53 am

Re: Remove (disable) out of stock items

Postby pramathesh » Tue Nov 22, 2011 2:12 am

I think there should be 2 options in the admin panel for out of stock items.

1. Remove Add to Cart Button - This will the add to cart button in the product page, category listing and remove the item in the featured list, Latest List etc.
2. Remove Listing - That will hide the product from the site.
pramathesh
 
Posts: 7
Joined: Sun Nov 20, 2011 3:33 am

Re: Remove (disable) out of stock items

Postby i2Paq » Tue Nov 22, 2011 2:29 am

pramathesh wrote:2. Remove Listing - That will hide the product from the site.


Set the product inactive.
Norman in 't Veldt
Moderator OpenCart Forums

_________________ READ and Search BEFORE POSTING _________________
Our FREE search: Find your answer FAST!.

FREE manuals: ShowMe Guides OpenCart, Opencart Check List and Our Documentation section.

BUGs?: Known BUGS for All OC Versions.

[How to] OC 1.5.4.x en hoger; BTW + Verzend + betaalmethodes.
User avatar
i2Paq
Global Moderator
 
Posts: 10971
Joined: Mon Nov 09, 2009 6:00 am
Location: Winkel - The Netherlands

Next

Return to General Support

Who is online

Users browsing this forum: Chris_AXA, Google [Bot], pbischof2014 and 80 guests

Hosted by Arvixe Web Hosting