Post by FFJim » Thu Aug 05, 2010 5:14 am

I take pre-orders on some items but do not allow "stock checkout" for out-of-stock items. Instead of having availability display as "In Stock" I want these items to show "Pre-Order".

To accomplish this, for the pre-order items I set the product's out-of-stock message to "Pre-Order" instead of the default setting. (Whatever non-default message you select will be displayed.) I also set the stock to whatever my incoming stock will be. Then I altered catalog/controller/product/product.php as follows:

Find this:

Code: Select all

			if ($product_info['quantity'] <= 0) {
				$this->data['stock'] = $product_info['stock'];
			} else {
				if ($this->config->get('config_stock_display')) {
					$this->data['stock'] = $product_info['quantity'];
				} else {
					$this->data['stock'] = $this->language->get('text_instock');
				}
			}
Replace with this:

Code: Select all

			if ($product_info['quantity'] <= 0) {
				$this->data['stock'] = $product_info['stock'];
			} else {
				if ($this->config->get('config_stock_display')) {
					$this->data['stock'] = $product_info['quantity'];
				} else {
					if ($product_info['stock_status_id'] == $this->config->get('config_stock_status_id')) {
						$this->data['stock'] = $this->language->get('text_instock');
					} else {
						$this->data['stock'] = $product_info['stock'];
					}
				}
			}
Now availability shows as follows:

(1) If stock is zero and out-of-stock is the default, shows the default "Out Of Stock" text
(2) If stock is zero and out-of-stock is not the default, shows product's OOS text
(3) If stock is 1 or more and out-of-stock is the default, shows "In Stock" text
(4) If stock is 1 or more and out-of-stock is not the default, shows the product's OOS text

This doesn't completely resolve pre-ordering needs, but it at least gives a better availability status. I hope its helpful to others who take pre-orders.

User avatar
New member

Posts

Joined
Wed Jul 21, 2010 6:44 am

Post by FFJim » Thu Aug 05, 2010 7:24 am

If you're using the mod to hide the add button when items reach zero, found here, make the following change to catalog/view/theme/yourtheme/template/product/product.php:

Find this:

Code: Select all

<?php if($stock == $this->language->get('text_instock') || $stock > 0): ?>
Replace with this:

Code: Select all

<?php if($stock == $this->language->get('text_instock') || $product_info['stock_status_id'] <> $this->config->get('config_stock_status_id') || $stock > 0): ?>

User avatar
New member

Posts

Joined
Wed Jul 21, 2010 6:44 am

Post by SXGuy » Thu Aug 05, 2010 3:58 pm

Good work, i made a mod similiar to this a little while ago.

A Client basically wanted a way to have different options depending on stock qty.

So i pulled the stock qty down to the product pages, and used that as a guide to what would show depending on how much stock was left, very simple to do and not alot of editing was needed.

Rather than messing with stock at 1 or above or whether an item is "instock" or "out of stock" i decided to just use minus figures for different options.

So if all products are set to in stock, but one has a stock count of -1 the add to cart button was removed and replaced with something else, i.e Contact us for details.

Same applied to -2 or -3

Active Member

Posts

Joined
Sun Nov 08, 2009 2:07 am

Post by vkaltchev » Fri Sep 10, 2010 2:08 pm

You are quite knowledgeable guys and I have a question re availability, so hope you can help me. The majority of my products are made to order with availability/delivery 3-4 weeks. I want the customer to be able to purchase the item and make the payment/checkout without the system dealing with any "stock" on hand. Can you please validate if what I did is correct:
1. In Settings/Option I set:
- "Out of Stock Warning" to "no"
- "Stock Checkout" to "yes"
- "Out of Stock Status" to "2-3 days" for default out of stock
2. In Product/Data for each product I set:
- "Quantity" to "0"
- "Subtract Stock" to "no"

It seems to be working but I am not 100% sure.

The second part of my question is how to change the text of the "Out of Stock Status"; instead of "2-3 Days" I'd like it to read "3-4 Weeks Delivery" or something in those lines. How can I do that?

Cheers,
Valentina

New member

Posts

Joined
Fri Apr 16, 2010 11:02 am

Post by fido-x » Fri Sep 10, 2010 7:22 pm

vkaltchev wrote:... The second part of my question is how to change the text of the "Out of Stock Status"; instead of "2-3 Days" I'd like it to read "3-4 Weeks Delivery" or something in those lines. How can I do that?

Cheers,
Valentina
Log in to your administration. From the menu, select "System->Localisation->Stock Statuses", then click the "Edit" link in the "Action" column for the entry you want to edit.

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 vkaltchev » Sun Sep 12, 2010 1:20 pm

I feel like an idiot - didn't expect to have the "fix" in admin and was waiting to see a long list of codes.
Thank you Fido for opening my eyes and solving my "big" problem :)

Any way to change the text color to red (not a must, just want to experiment)?

Cheers,
Valentina

New member

Posts

Joined
Fri Apr 16, 2010 11:02 am

Post by fido-x » Sun Sep 12, 2010 1:34 pm

You can change the colour in your template file (catalog/view/theme/default/template/product/product.tpl). Find the following (around lines 27 to 30):

Code: Select all

<tr>
  <td><b><?php echo $text_availability; ?></b></td>
  <td><?php echo $stock; ?></td>
</tr>
And change to:

Code: Select all

<tr>
  <td><b><?php echo $text_availability; ?></b></td>
  <td><span style="color: #FF0000;"><?php echo $stock; ?></span></td>
</tr>
This will then display your stock status in red.

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 vkaltchev » Wed Sep 22, 2010 4:25 am

Thank you so much, Fido; it did the job!
Cheers,
Valentina

New member

Posts

Joined
Fri Apr 16, 2010 11:02 am

Post by schlegk » Mon Feb 21, 2011 12:51 am

Just what I need, but it has to be compatible with PAPs (Product Image Attributes).
http://www.opencart.com/index.php?route ... order=DESC

Any ideas?

Newbie

Posts

Joined
Sun Jan 16, 2011 1:30 am

Post by funkyou86 » Wed May 18, 2011 5:57 am

Thank you very much for this modifications. Works perfectly on OC 1.4.9.4 :)

Newbie

Posts

Joined
Tue Mar 01, 2011 11:02 pm

Post by funkyou86 » Wed May 18, 2011 8:24 pm

Any idea how can I edit the color of the "Pre-Order" status? I alredy did the in stock color change, but can't find the others. Please advise. Thanks :)

Newbie

Posts

Joined
Tue Mar 01, 2011 11:02 pm

Post by yiyinlah » Fri Feb 24, 2012 5:18 am

Great work!!! :)

I'm using Opencart 1.5.4.1 & vQmod 2.3.2.


User avatar
Active Member

Posts

Joined
Thu Sep 23, 2010 1:19 pm
Location - Singapore

Post by PlusCybernet » Wed Feb 27, 2013 6:17 pm

FFJim wrote:I take pre-orders on some items but do not allow "stock checkout" for out-of-stock items. Instead of having availability display as "In Stock" I want these items to show "Pre-Order".

To accomplish this, for the pre-order items I set the product's out-of-stock message to "Pre-Order" instead of the default setting. (Whatever non-default message you select will be displayed.) I also set the stock to whatever my incoming stock will be. Then I altered catalog/controller/product/product.php as follows:

Find this:

Code: Select all

			if ($product_info['quantity'] <= 0) {
				$this->data['stock'] = $product_info['stock'];
			} else {
				if ($this->config->get('config_stock_display')) {
					$this->data['stock'] = $product_info['quantity'];
				} else {
					$this->data['stock'] = $this->language->get('text_instock');
				}
			}
Replace with this:

Code: Select all

			if ($product_info['quantity'] <= 0) {
				$this->data['stock'] = $product_info['stock'];
			} else {
				if ($this->config->get('config_stock_display')) {
					$this->data['stock'] = $product_info['quantity'];
				} else {
					if ($product_info['stock_status_id'] == $this->config->get('config_stock_status_id')) {
						$this->data['stock'] = $this->language->get('text_instock');
					} else {
						$this->data['stock'] = $product_info['stock'];
					}
				}
			}
Now availability shows as follows:

(1) If stock is zero and out-of-stock is the default, shows the default "Out Of Stock" text
(2) If stock is zero and out-of-stock is not the default, shows product's OOS text
(3) If stock is 1 or more and out-of-stock is the default, shows "In Stock" text
(4) If stock is 1 or more and out-of-stock is not the default, shows the product's OOS text

This doesn't completely resolve pre-ordering needs, but it at least gives a better availability status. I hope its helpful to others who take pre-orders.
It's not working with OC 1541, can you please provide code for latest version.

User avatar
Active Member

Posts

Joined
Sun Dec 25, 2011 12:01 pm

Post by modmyairsoft » Mon Jul 15, 2013 7:55 am

Here is what I get for product pages that have product availability set to out of stock or pre order.

Notice: Undefined index: stock in /home1/modmyair/public_html/Shop/catalog/controller/product/product.php on line 282

I need some help.

Newbie

Posts

Joined
Thu Jan 17, 2013 5:29 am
Who is online

Users browsing this forum: No registered users and 61 guests