Post by sgfx » Thu Oct 15, 2009 12: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

Posts

Joined
Thu Oct 08, 2009 9:56 am

Post by Jan R » Fri Oct 16, 2009 2:33 am

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

Posts

Joined
Fri Oct 16, 2009 2:20 am

Post by Qphoria » Fri Oct 16, 2009 5:17 am

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'

OpenCart 2.0.x Mod Update Info

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by sgfx » Fri Oct 16, 2009 6:13 am

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

Posts

Joined
Thu Oct 08, 2009 9:56 am

Post by Qphoria » Fri Oct 16, 2009 9:19 am

why does it need to be? The change was so simple and you are done.

OpenCart 2.0.x Mod Update Info

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by sgfx » Fri Oct 16, 2009 9:43 am

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

Posts

Joined
Thu Oct 08, 2009 9:56 am

Post by Jan R » Sat Oct 17, 2009 1:49 am

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

Posts

Joined
Fri Oct 16, 2009 2:20 am

Post by mat-ko » Mon Nov 08, 2010 10:07 pm

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

Posts

Joined
Wed Oct 27, 2010 7:35 pm

Post by nakz » Mon Nov 29, 2010 5:55 pm

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

Thanks.


Posts

Joined
Wed Apr 28, 2010 1:27 pm

Post by jamesw » Sat Dec 04, 2010 10:52 am

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?


Posts

Joined
Mon Jul 19, 2010 10:16 am

Post by egejo » Tue Apr 26, 2011 4:26 am

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


Posts

Joined
Sun Apr 24, 2011 1:00 pm

Post by maperdel » Sat May 07, 2011 8:36 am

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

Best.

Zapatos Andrea - Andrea Zapatos



Posts

Joined
Sat Mar 26, 2011 6:38 am


Post by StudioImpact » Tue Sep 27, 2011 8:18 pm

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.


Posts

Joined
Tue Sep 27, 2011 8:12 pm

Post by shiokguy » Fri Sep 30, 2011 2:50 pm

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


Posts

Joined
Wed Jul 13, 2011 3:28 pm

Post by proveyourselfthom » Sat Oct 29, 2011 12: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.


Posts

Joined
Thu Sep 22, 2011 12:53 am

Post by proveyourselfthom » Sat Oct 29, 2011 2:00 am

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.


Posts

Joined
Thu Sep 22, 2011 12:53 am

Post by proveyourselfthom » Mon Oct 31, 2011 8:35 pm

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 :(


Posts

Joined
Thu Sep 22, 2011 12:53 am

Post by proveyourselfthom » Mon Nov 07, 2011 7:17 pm

vqmod has saved my life :)
But anyway, it would be great to have an admin option.
Thanks.


Posts

Joined
Thu Sep 22, 2011 12:53 am

Post by pramathesh » Tue Nov 22, 2011 3:12 pm

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.


Posts

Joined
Sun Nov 20, 2011 4:33 pm

Post by i2Paq » Tue Nov 22, 2011 3:29 pm

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 _________________

UPGRADE to 2.x: Contemplate before thou begins!

Our FREE search: Find your answer FAST!.

BUGs?: Known BUGS for All OC Versions.

[How to] BTW + Verzend + betaal setup.


User avatar
Global Moderator

Posts

Joined
Mon Nov 09, 2009 7:00 pm
Location - Winkel - The Netherlands
Who is online

Users browsing this forum: Yahoo [Bot] and 41 guests