Post by steveclv2 » Wed Jul 14, 2021 10:04 pm

I am not sure if this is the right place to discuss self modifications and changes but I'll see what response I get :)
V 3.0.2.0 with default template.
I sell customized products that are not in stock and I have enabled selling out of stock items.
I have created several stock status ids - Made to Order (2-3 days), Made to Order (1-2 weeks) etc including Out of Stock
Customers can order items that have zero stock and will see the status. However I want anything that has the stock status of 'Out of Stock' to be treated as such by the cart and checkout logic and display the error that the item is really out of stock and I think I have narrowed it down to changes in the Catalog -> Controller -> Checkout -> Cart.php

if ($this->cart->hasProducts() || !empty($this->session->data['vouchers'])) {
if (!$this->cart->hasStock() && (!$this->config->get('config_stock_checkout') || $this->config->get('config_stock_warning'))) {
$data['error_warning'] = $this->language->get('error_stock');
} elseif (isset($this->session->data['error'])) {
$data['error_warning'] = $this->session->data['error'];

unset($this->session->data['error']);
} else {
$data['error_warning'] = '';
}
specifically the bold conditional statement that I believe I need to add in something that references the status of each product in the cart.
Is this the right way to implement this change to the logic or is there some config already in OC that I am missing that will achieve this?
Many thanks!

New member

Posts

Joined
Sat Jul 03, 2021 10:38 pm

Post by by mona » Wed Jul 14, 2021 10:15 pm

Thank you for your OC version and theme :)

There is quite a lot to read and it is possible that I have misunderstood
In admin -> settings you can select SHOW STOCK WARNING
OPTION tab under STOCK

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


User avatar
Expert Member

Posts

Joined
Mon Jun 10, 2019 9:31 am

Post by steveclv2 » Wed Jul 14, 2021 11:58 pm

I'm learning LOL

Sorry, my explanation probably wasn't that clear.
I have the option to sell with zero stock enabled - so customers can currently buy everything that has 0 stock. The Out of Stock message for each product is set accordingly to 3 days, 1 week, 1 month etc to indicate how long it will take to make.
However, I want anything where I have set the Out of Stock message to be 'OUT OF STOCK' to be treated exactly as if the option to sell out of stock was not enabled - ie it would not allow purchase of the item and would display the error message.

Does that make it any clearer - it's a bit of a convoluted logic I'm trying to do :)
Basically, I hold a stock of raw material that I use to make the item for the customer, but if I run out of the raw material, I need to stop customers from buying the items.

New member

Posts

Joined
Sat Jul 03, 2021 10:38 pm

Post by JNeuhoff » Thu Jul 15, 2021 5:25 pm

I am struggling to understand what exactly you want to change ...

Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig


User avatar
Guru Member

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by steveclv2 » Thu Jul 15, 2021 11:47 pm

I'll try again lol

I sell customized products and so I have set the site to sell 0 stock items and the 'out of stock' variable is set to the amount of time it takes me to make the product - 2 days, 1 week, 1 month for example.
I have set the site to not deduct the sold item from stock.
So I have say 10 raw products in stock but my site is still set to 0 so that when people order, they get to see the appropriate 'out of stock' variable that will tell them to expect the item in so many days/weeks.

This all works just fine.

However, when I have run out of the raw products, I want the site to be able to recognise that if I set the 'Out of stock' variable to be OUT OF STOCK then it will treat it as if it was really out of stock and display the message 'this item is out of stock' and prevent the checkout progressing.

At the moment, the only way to stop the item from selling is to remove it /disable it and I don't want to do that as I still want people to be able to search and find it.

Does that help? Thanks!

New member

Posts

Joined
Sat Jul 03, 2021 10:38 pm

Post by by mona » Fri Jul 16, 2021 12:08 am

The part that is confusing us is

"I have out of stock variables”

out of stock - 0 - do not deduct - no checkout - warning will show - and checkout is prevented
2 weeks - 1 - do not deduct - no checkout - warning will not show and checkout will proceed

which part of this are we missing?

it is useful to understand you are made to measure - ty - that part we understand -
but if we are still missing something it is the status of each stock and why you can’t just add product quantity 1 to the product with other stock statuses ?

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


User avatar
Expert Member

Posts

Joined
Mon Jun 10, 2019 9:31 am

Post by OSWorX » Fri Jul 16, 2021 1:34 am

steveclv2 wrote:
Thu Jul 15, 2021 11:47 pm
So I have say 10 raw products in stock but my site is still set to 0 so that when people order, they get to see the appropriate 'out of stock' variable that will tell them to expect the item in so many days/weeks.

This all works just fine.

However, when I have run out of the raw products, I want the site to be able to recognise that if I set the 'Out of stock' variable to be OUT OF STOCK then it will treat it as if it was really out of stock and display the message 'this item is out of stock' and prevent the checkout progressing.

At the moment, the only way to stop the item from selling is to remove it /disable it and I don't want to do that as I still want people to be able to search and find it.

Does that help? Thanks!
Sound still confusing ..
Why not creating a new category, assign those products/articles to that category and define the category text telling the people that items of this category have to be made and will be deliverable with 2/3 days, 1 week, 1 months, etc.
Therefore you can set the correct stock and when there no items anymore, it depends what you have defined in the system settings.

All other solutions require some extra coding you will not get here for free.

On the other hand, where is you business located?
Because if inside the EC, delivery times are binding and must be visible at each product!
Means, no delivery time, contract is not valid.
Means also, if you define e.g. 1 week and you do not deliver within 1 week, customer can cancel the order without any cost.

Full Stack Web Developer :: Dedicated OpenCart Development & Support DACH Region
Contact for Custom Work / Fast Support.


User avatar
Guru Member

Posts

Joined
Mon Jan 11, 2010 10:52 pm
Location - Austria

Post by JNeuhoff » Fri Jul 16, 2021 1:41 am

However, when I have run out of the raw products, I want the site to be able to recognise that if I set the 'Out of stock' variable to be OUT OF STOCK then it will treat it as if it was really out of stock and display the message 'this item is out of stock' and prevent the checkout progressing.
This is exactly how a standard OpenCart works.

So what exactly is it you want to achieve?

Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig


User avatar
Guru Member

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by steveclv2 » Fri Jul 16, 2021 7:19 pm

by mona wrote:
Fri Jul 16, 2021 12:08 am
The part that is confusing us is

"I have out of stock variables”

out of stock - 0 - do not deduct - no checkout - warning will show - and checkout is prevented
2 weeks - 1 - do not deduct - no checkout - warning will not show and checkout will proceed

which part of this are we missing?
Ahh, so it is the fact that when the customer buys a product that has a 2 week delivery, they will not see the message under Availability: on the product page that tells them it is 2 weeks delivery - it simply says "In Stock".

I am going to attempt the coding myself but maybe I can get by with simply adding some Delivery Time: coding instead that will appear after the Availability:
In fact I think that's the answer rather than changing some built in logic of OC - at least there is less chance of me breaking something LOL

New member

Posts

Joined
Sat Jul 03, 2021 10:38 pm

Post by by mona » Fri Jul 16, 2021 8:18 pm

Now I get it

so this is pre-made to do just that
https://www.opencart.com/index.php?rout ... n_id=38198

and yes I think we will all agree with you having other options rather than mess with the core functionality
- you can also use other fields for example product code if you are not using it
but to note what OSWorX said you do need to be careful with regulations - ie. Made-to-Order: Approx 2-3 days

You might find something useful here
https://www.opencart.com/index.php?rout ... ct%20field

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


User avatar
Expert Member

Posts

Joined
Mon Jun 10, 2019 9:31 am

Post by steveclv2 » Sat Jul 17, 2021 4:00 am

Thanks!
Yes, aware of the EU regs and the Tc & Cs requirements :)
Steve

New member

Posts

Joined
Sat Jul 03, 2021 10:38 pm

Post by grgr » Sun Jul 18, 2021 12:15 pm

Seems to me that you just want to allow backordering of specified products.

One of my extensions deals with that and another one can keep track of backorders, I should combine them, I think I'll go do that.

-
Image Image Image Image
VIEW ALL EXTENSIONS * EXTENSION SUPPORT * WEBSITE * CUSTOM REQUESTS


User avatar
Active Member

Posts

Joined
Mon Mar 28, 2011 4:08 pm
Location - UK
Who is online

Users browsing this forum: Google [Bot] and 231 guests