Looking for someone who can help me create this for my store.
Opencart only has 2 options or Triggers rather for showing stock statuses :
+ve values of stock as in stock, or Zero or -ve values as out of stock. yes i can edit the out of stock status to show anything i want but i need a 3rd trigger rather.
I want a third trigger - i want to be able to enter a value of -1 and for the status to then be Pre-order
I also then want to be able to allow Store checkout when values are negative ( as they will now be on pre-order) . My store as default is set to not allow checkout on out of stock items as i dont want people buying out of stock items. However when i know i am getting specific items in i can set the value to -1 and set it to pre-order, then and only then will it again allow store checkout.
so for example
value 1 or higher - IN STOCK ( and this will allow store checkout)
Value 0 - OUT OF STOCK ( and no store checkout is allowed)
Value -1 or lower ( PRE_ORDER) and store checkout is allowed)
Lastly the ability to have the pre-order able to be set at a discounted rate by % could also be useful.
All pre-orders can then be set by me by choosing each product i need by setting the value to -1
Opencart only has 2 options or Triggers rather for showing stock statuses :
+ve values of stock as in stock, or Zero or -ve values as out of stock. yes i can edit the out of stock status to show anything i want but i need a 3rd trigger rather.
I want a third trigger - i want to be able to enter a value of -1 and for the status to then be Pre-order
I also then want to be able to allow Store checkout when values are negative ( as they will now be on pre-order) . My store as default is set to not allow checkout on out of stock items as i dont want people buying out of stock items. However when i know i am getting specific items in i can set the value to -1 and set it to pre-order, then and only then will it again allow store checkout.
so for example
value 1 or higher - IN STOCK ( and this will allow store checkout)
Value 0 - OUT OF STOCK ( and no store checkout is allowed)
Value -1 or lower ( PRE_ORDER) and store checkout is allowed)
Lastly the ability to have the pre-order able to be set at a discounted rate by % could also be useful.
All pre-orders can then be set by me by choosing each product i need by setting the value to -1
You can add any shop status in the back end system => localisation => stock status
here you can add pre-order - since it is coming into stock you can add the stock that is coming in
This can be done in the catalog/controller/catalog/product.php
a crude but easy to follow quick example
from
Code: Select all
if ($product_info['quantity'] <= 0) {
$data['stock'] = $product_info['stock_status'];
} elseif ($this->config->get('config_stock_display')) {
$data['stock'] = $product_info['quantity'];
} else {
$data['stock'] = $this->language->get('text_instock');
}
Code: Select all
if ($product_info['quantity'] == 0) {
$data['stock'] = $product_info['stock_status'];
} elseif($product_info['quantity'] < 0) {
$data['stock'] = 'PRE-ORDER';
} elseif ($this->config->get('config_stock_display')) {
$data['stock'] = $product_info['quantity'];
} else {
$data['stock'] = $this->language->get('text_instock');
}
If you add a Pre-Order status then this will not be a problem as there will be stock.
If you insist on -1 stock then yes that will have to be written, but I don’t think you realise that you can add a stock status.
That again can be done via the admin per product, but I assume you mean automatically
20% discount (assuming you use a pre_order status)
again catalog/controller/catalog/product.php and not very pretty but as an example
change
Code: Select all
if ((float)$product_info['special']) {
$data['special'] = $this->currency->format($this->tax->calculate($product_info['special'], $product_info['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']);
} else {
$data['special'] = false;
}
Code: Select all
if($product_info['stock_status'] == 8 ) { // where the stock status_id for pre-order is 8
$data['special'] = $this->currency->format($this->tax->calculate( ($product_info['price'] * .8), $product_info['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']);
} elseif ((float)$product_info['special']) {
$data['special'] = $this->currency->format($this->tax->calculate($product_info['special'], $product_info['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']);
} else {
$data['special'] = false;
}
So there seems to me not to be an issue adding a new status rather than 'recreating the wheel' so to speak.
DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.
https://www.youtube.com/watch?v=zXIxDoCRc84
[/quote]
Mona, thanks so much for the reply! i will go though more detail later.
Yes i can edit back end system => localisation => stock status
here you can add pre-order, but there is only 1 trigger for when you add stock qty, it will always then show 'In Stock'
i cannot choose to say Pre-order while the site shows we have stock, only when the site is 0 or less then the 'out of stock' status is shown which can be of course anything i want.....
ok
Code: Select all
if ($product_info['quantity'] == 987654) {
$data['stock'] = 'PRE-ORDER';
} elseif ($product_info['quantity'] <= 0) {
$data['stock'] = $product_info['stock_status'];
} elseif ($this->config->get('config_stock_display')) {
$data['stock'] = $product_info['quantity'];
} else {
$data['stock'] = $this->language->get('text_instock');
}
DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.
https://www.youtube.com/watch?v=zXIxDoCRc84
Mona,
thanks! i have changed it a bit to work like i wanted with -ve numbers Like the below. the only issue is I now need Stock checkout to be enabled at stock above ZERO, no store checkout if stock is ZERO, and again to allow store checkout when stock is less than ZERO!
the reason not to use ==987654 is that as soon as 1 customer places an order it will go back to 'In stock' when actually its not in stock. i could allow for a range of numbers between 999 and 899 for example ....... but i feel easier to use negative numbers for me as i know that is the pre-order stock numbers
then i will be all sorted
thanks! i have changed it a bit to work like i wanted with -ve numbers Like the below. the only issue is I now need Stock checkout to be enabled at stock above ZERO, no store checkout if stock is ZERO, and again to allow store checkout when stock is less than ZERO!
the reason not to use ==987654 is that as soon as 1 customer places an order it will go back to 'In stock' when actually its not in stock. i could allow for a range of numbers between 999 and 899 for example ....... but i feel easier to use negative numbers for me as i know that is the pre-order stock numbers
then i will be all sorted
if ($product_info['quantity'] <= -1) {
$data['stock'] = 'PRE-ORDER';
} elseif ($product_info['quantity'] == 0) {
$data['stock'] = $product_info['stock_status'];
} elseif ($this->config->get('config_stock_display')) {
$data['stock'] = $product_info['quantity'];
} else {
$data['stock'] = $this->language->get('text_instock');
}
Sent you message
DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.
https://www.youtube.com/watch?v=zXIxDoCRc84
Who is online
Users browsing this forum: No registered users and 65 guests