This method doesn't work.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; ?>" /> <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.
I am researching a shop for someone selling antiques. This is going to be 1 item each and wondered if this is an option yet without a hack or on the road map. I don't like changing code and worry about updates messing with this setting.
There must be a good percentage of people selling single items and could use this option.
Thank you
There must be a good percentage of people selling single items and could use this option.
Thank you
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!
I agree, I am shocked this isn't an option. It is a pain to manually have to do this, but if you are not on top of it you could easily oversell product that you don't have in stock. Then you would have to offer refunds. yuck.
We have developed something like that in our store:
Products with stock = 0, you will be able to:
- Hide product
or
- Hide "add to cart" button
or
- Change "add to cart" button behavior, to redirect to "Contact to get a quote" or a custom text.
We plan to convert this into an extension.
Any more ideas to add?
Products with stock = 0, you will be able to:
- Hide product
or
- Hide "add to cart" button
or
- Change "add to cart" button behavior, to redirect to "Contact to get a quote" or a custom text.
We plan to convert this into an extension.
Any more ideas to add?
Thanks for the mod Qphoria. Works great except for one problem that I am seeing. It doesn't hide the product on the category page. I don't think there were categories yet in the version this was intended for, however it does work for every page but that one. Not sure what code I would need to edit to ensure it is hidden on this page as well. Any ideas?
For esponi: Any news on this mod you are referring?
For esponi: Any news on this mod you are referring?
Yes, we will port to an extension in a few days:
Included features in each product form:
If stock = 0:
[ x ] Hide this product.
[ x ] Hide only "add to cart" button.
[ x ] Change text "add to cart" to new text: ..........................
[ x ] Change "add to cart" button behavior, redirect to ................................?product_id={this}
What do you think.
Included features in each product form:
If stock = 0:
[ x ] Hide this product.
[ x ] Hide only "add to cart" button.
[ x ] Change text "add to cart" to new text: ..........................
[ x ] Change "add to cart" button behavior, redirect to ................................?product_id={this}
What do you think.
Thanks a lot. This solution worked like a charm on Version 1.5.5.1.Qphoria wrote:1. Edit: catalog/model/catalog/product.php
2. All places you find:3. Replace with:Code: Select all
p.status = '1'
Code: Select all
p.status = '1' AND p.quantity > '0'
Hello
InStock Only for all page when show products: category, special, search, manufacturer
https://www.opencart.com/index.php?rout ... n_id=33009
InStock Only for all page when show products: category, special, search, manufacturer
https://www.opencart.com/index.php?rout ... n_id=33009
Opencart Solutions | opencart-solutions.com
It's not good for SEO to remove products.
Go to /opencart/catalog/view/theme/mytheme/template/product/product.tpl
and change:
To:
Go to /opencart/catalog/view/theme/mytheme/template/product/product.tpl
and change:
Code: Select all
<button type="button" id="button-cart" data-loading-text="<?php echo $text_loading; ?>" class="btn btn-primary btn-lg btn-block"><?php echo $button_cart; ?></button>
Code: Select all
<?php if ($stockqty) { ?>
<button type="button" id="button-cart" data-loading-text="<?php echo $text_loading; ?>" class="btn btn-primary btn-lg btn-block"><?php echo $button_cart; ?></button>
<?php } else {?>
<span class="btn btn-primary btn-lg btn-block">Out of Stock</span>
<?php } ?>
Pottery Glaze shop
I wonder where this variable is coming from . . .<?php if ($stockqty) { ?>
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Who is online
Users browsing this forum: No registered users and 312 guests