Post by vimal » Mon Oct 05, 2009 8:03 pm

Does the out of stock status change automatic? I think it should by counting the number of products left. If it is 0 then the status should change automatically. It doesn't seem to do that. Is that a bug or is it just not working in my shop? I had to manually go and change it.

Is there a better way to handle it?

www.beeshop.se
Starta webbshop, Starta e-butik, Starta e-handel


Active Member

Posts

Joined
Wed Aug 26, 2009 8:54 am
Location - Sweden

Post by Qphoria » Mon Oct 05, 2009 8:07 pm

That is what it does for me. All automatic.

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by vimal » Tue Oct 06, 2009 2:37 pm

Any idea Qphoria why it doesn't change automatically for me? I keep the product status to "in stock" by default. I think earlier it was on out of stock by default.

Will it show "in stock" in the store If I change the status to "out of stock" and keep number of products more than 0?

www.beeshop.se
Starta webbshop, Starta e-butik, Starta e-handel


Active Member

Posts

Joined
Wed Aug 26, 2009 8:54 am
Location - Sweden

Post by gavin m » Tue Oct 06, 2009 3:58 pm

Is your out of stock status set to 'out of stock'? Sound slike you have set it to 'In Stock'

Active Member

Posts

Joined
Thu Jun 04, 2009 3:23 pm

Post by fido-x » Tue Oct 06, 2009 4:28 pm

You need to set the "Out Of Stock Status" on your product to "Out Of Stock". You'll find it under the "Data" tab.

You'll also need to ensure that "Stock Subtract" is set to "Yes" in your settings ("Admin->Configuration->Setting, under the "Option" tab).

Image
Modules for OpenCart 2.3.0.2
Homepage Module [Free - since OpenCart 0.7.7]
Multistore Extensions
Store Manager Multi-Vendor/Multi-Store management tool

If you're not living on the edge ... you're taking up too much space!


User avatar
Expert Member

Posts

Joined
Sat Jun 28, 2008 1:09 am
Location - Tasmania, Australia

Post by vimal » Tue Oct 06, 2009 5:59 pm

Yep! got it..I had set my product status to "In stock" and stock substract to yes. I have changed the product status to out of stock and it is now working like it should.

Thanks all!
Vimal.

www.beeshop.se
Starta webbshop, Starta e-butik, Starta e-handel


Active Member

Posts

Joined
Wed Aug 26, 2009 8:54 am
Location - Sweden

Post by deeve » Thu Dec 10, 2009 6:33 pm

Apologies for opening this thread up again, but wondered whether it was possible for auto 'Out of Stock' option to actually not show the item until its quantity is adjusted [re-stocked]? Currently I get the item + 'Out of Stock' displayed but would prefer the item not appear until back in stock. Is this possible?

update: Just realized this is down to the 'Status enabled' not being set to 'false'. Can this be achieved automatically?

Thanks.

Active Member

Posts

Joined
Tue Oct 20, 2009 4:31 pm

Post by Qphoria » Thu Dec 10, 2009 8:38 pm

1. EDIT: catalog/model/catalog/product.php

2. FIND:

Code: Select all

p.status = '1' 
3. GLOBALLY REPLACE WITH:

Code: Select all

p.status = '1' AND p.quantity > 0

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by deeve » Thu Dec 10, 2009 10:13 pm

Thanks once again, Q - you're a Star!

Active Member

Posts

Joined
Tue Oct 20, 2009 4:31 pm

Post by robisrob » Tue Jan 26, 2010 9:08 pm

Is it also possible to show only the optionsvalues of the products that are in stock. For example you have a shirt in size 36 and 38, but when 36 is out of stock you see only the option 38

New member

Posts

Joined
Mon Jan 25, 2010 12:29 am

Post by robisrob » Wed Jan 27, 2010 1:24 am

I think I found it myself :D .

I just add quantity>0 to the next rule in the same page as before.

$product_option_value_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_option_value WHERE product_option_id = '" . (int)$product_option['product_option_id'] . "'and quantity>0 ORDER BY sort_order");

New member

Posts

Joined
Mon Jan 25, 2010 12:29 am

Post by Qphoria » Wed Jan 27, 2010 2:56 am

correct

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by robisrob » Wed Jan 27, 2010 9:32 pm

Is their also a possibility so that the product that are out of stock aren't showed as best sales and latest products? Or which files do I need to adjust. Maybe then I can find it myself :)

New member

Posts

Joined
Mon Jan 25, 2010 12:29 am

Post by nathalie » Mon Mar 08, 2010 3:26 am

Thank you so much!
It works perfectly! ;D

New member

Posts

Joined
Tue Feb 23, 2010 12:19 am

Post by i2Paq » Mon Mar 08, 2010 4:25 am

I think it would be also nice to have the Add to Cart button removed instead of the whole product.

Norman in 't Veldt
Moderator OpenCart Forums

_________________ READ and Search BEFORE POSTING _________________

Our FREE search: Find your answer FAST!.

[How to] BTW + Verzend + betaal setup.


User avatar
Global Moderator

Posts

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

Post by padred123 » Thu May 06, 2010 6:51 am

i2Paq wrote:I think it would be also nice to have the Add to Cart button removed instead of the whole product.
This works for me. It removes the add to cart button if the stock is anything different than "In Stock".

Look in file:
catalog\view\theme\"your_theme"\template\product\product.tpl

Find (around line 100):

Code: Select all

			  
 <div style="background: #F7F7F7; border: 1px solid #DDDDDD; padding: 10px;"><?php echo $text_qty; ?>
   <input type="text" name="quantity" size="3" value="1" />
   <a onclick="$('#product').submit();" id="add_to_cart" class="button"><span><?php echo $button_add_to_cart; ?></span> </a></div>
 <input type="hidden" name="product_id" value="<?php echo $product_id; ?>" />
 <input type="hidden" name="redirect" value="<?php echo $redirect; ?>" />
</form>
Add this before the DIV tag:

Code: Select all

<?php  if($stock == 'In Stock' || $stock > 0){ ?>
Add this before the FORM tag :

Code: Select all

<?php } ?>
Result:

Code: Select all

  <?php  if($stock == 'In Stock' || $stock > 0){ ?>
  <div style="background: #F7F7F7; border: 1px solid #DDDDDD; padding: 10px;"><?php echo $text_qty; ?>
     <input type="text" name="quantity" size="3" value="1" />
     <a onclick="$('#product').submit();" id="add_to_cart" class="button"><span><?php echo $button_add_to_cart; ?></span></a></div>
    <input type="hidden" name="product_id" value="<?php echo $product_id; ?>" />
    <input type="hidden" name="redirect" value="<?php echo $redirect; ?>" />
   <?php } ?>
  </form>

New member

Posts

Joined
Wed Mar 24, 2010 6:05 am

Post by schlegk » Sun Jan 16, 2011 1:32 am

As someone mentioned earlier - I would like to simply have out of stock items not display. I have managed to do this with the change shown earlier in this thread, but the out of stock items are still showing up in Bestsellers and latest products. How can I fix this, please?

Thanks in advance!

Newbie

Posts

Joined
Sun Jan 16, 2011 1:30 am

Post by Sidecutter » Sun Mar 06, 2011 2:36 pm

Padred123, your code works perfectly, glad I found this thread.

It needs a little tweak for 1.4.9.3 though. The additions are the same, just the underlying code to be modified is different.

Look for this code:

Code: Select all

<div class="content">
                <?php echo $text_qty; ?>
                <input type="text" name="quantity" size="3" value="<?php echo $minimum; ?>" />
                <a onclick="$('#product').submit();" id="add_to_cart" class="button"><span><?php echo $button_add_to_cart; ?></span></a>
                <?php if ($minimum > 1) { ?><br/><small><?php echo $text_minimum; ?></small><?php } ?>
              </div>
              <div>
                <input type="hidden" name="product_id" value="<?php echo $product_id; ?>" />
                <input type="hidden" name="redirect" value="<?php echo str_replace('&', '&', $redirect); ?>" />                
              </div>
            </form>
Add this before <div class="content">:

Code: Select all

<?php  if($stock == 'In Stock' || $stock > 0){ ?>
Add this before </form>:

Code: Select all

<?php } ?>
The result should be:

Code: Select all

<?php  if($stock == 'In Stock' || $stock > 0){ ?>
              <div class="content">
                <?php echo $text_qty; ?>
                <input type="text" name="quantity" size="3" value="<?php echo $minimum; ?>" />
                <a onclick="$('#product').submit();" id="add_to_cart" class="button"><span><?php echo $button_add_to_cart; ?></span></a>
                <?php if ($minimum > 1) { ?><br/><small><?php echo $text_minimum; ?></small><?php } ?>
              </div>
              <div>
                <input type="hidden" name="product_id" value="<?php echo $product_id; ?>" />
                <input type="hidden" name="redirect" value="<?php echo str_replace('&', '&', $redirect); ?>" />                
              </div>
              <?php } ?>
            </form>

Active Member

Posts

Joined
Tue Jan 18, 2011 6:58 am

Post by nathalie » Sun Apr 03, 2011 4:06 am

is it also possible that when you have different selections of a product, lets say, size S , M , L and S is sold out, that there's a automaticly a message saying S is sold out?

And how can I put another image over a sold out product? I'd like to create sticker saying "sold out".
Like this website http://www.demo.opencart4u.com/ but here they dont have the option of sold out, only new/best products

New member

Posts

Joined
Tue Feb 23, 2010 12:19 am

Post by barblask » Wed May 25, 2011 6:40 pm

Code: Select all

<?php  if($stock == 'In Stock' || $stock > 0){ ?>
It works only on standard englich translation. Bether is to make it in this way:

Code: Select all

if($stock == $this->language->get('text_instock') || $stock > 0){ 

User avatar
Newbie

Posts

Joined
Thu Sep 16, 2010 5:42 pm

Who is online

Users browsing this forum: Bing [Bot] and 4 guests