Version: 3.0.3.2 (Also in in 2.0.3.2)
Product quantity: 1
Option quantity: 1
Minimum quantity: 1
Subtract stock: Yes
Out of stock status: Out of stock
Show Out Of Stock Warning: Yes
Stock Checkout: No
Why not show Out Of Stock warning in cart page when I added the same product twice and one of them has option, then after order became -1 product quantity?
Thank you.
Attachments
opt1.png (46.73 KiB) Viewed 1793 times
pro2.png (116.79 KiB) Viewed 1793 times
مصمم ومطور متاجر إلكترونية | @Oc_Style
لطلبات التصميم، تعريب القوالب والاضافات، ترقية الإصدار، حماية المتجر قم بمراسلتي من خلال المنتدى
موديل: إشعارات البنوك السعودية
1 | 2 | O :طرق لحماية السكربت
What should then happened due to this transition period between that time?
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Default a product with options is regarded as a different product than the same product without options.
He has a point.
Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces
“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
now it checks one cart item at a time.
In this case you would have multiple cart items with the same product_id.
So perhaps instead of checking the stock of each product per cart item, check the stock levels of each product cart-wide.
No need to touch the stock checking of the options.
Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces
“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.
Which is why, it is not as simple as it seem. I do have one unpublished extension where an event is initiated after the getProductOptions method has been called in order to verify the product option quantity value and also with the orders where store owners receives an email whenever the product option quantity value is below 1 but not sure politically if this would be the right call.
If there are more users posting about the best options, I'll see what I can do to suggest the change in the core if the changes haven't been made before by then.
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
As I understand it:
I have product A which has options.
I only have 1 product A in stock and do not allow checkout without stock.
I can add product A to my cart, quantity 1 without options.
I can add product A to my cart, quantity 1 with options.
Then I can checkout 2 products A while I do not have 2 in stock because the stock check does not take both cart items onto account even though the product is the same.
That is what I understand the OP was referring to, the stock levels of the options itself play no part in this.
What you are describing is a separate issue I think.
Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces
“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.
Both products A should be regrouped as the same product in the cart database table but only the quantity should vary which is why we don't include the category ID into the cart database table by default. Otherwise, the identical products A would be redundant into the cart database table as the stock level would be almost impossible to validate with the same products unless the stock levels would be provided categorically from the OC admin.Then I can checkout 2 products A while I do not have 2 in stock because the stock check does not take both cart items onto account even though the product is the same.
Are you both implying that the same products can be added by default as separated rows in the cart page?
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
well, I am.Are you both implying that the same products can be added by default as separated rows in the cart page?
you can add all these:
product A without options
product A with option 1
product A with option 2
product A with option 1 and option 2
etc.
no problem as each cart item is stock checked on its own ignoring the other items with the same product id.
In essence, it treats a product with an option as a separate product which is fine except where stock is concerned.
Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces
“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.
Code: Select all
// Stock
if (!$product_query->row['quantity'] || ($product_query->row['quantity'] < $cart['quantity'])) {
$stock = false;
}
Code: Select all
$productCartQuantity = 0;
foreach ($cart_query->rows as $cart_3) {
if ($cart_3['product_id'] == $cart['product_id']) $productCartQuantity = $productCartQuantity + $cart_3['quantity'];
}
// Stock
if (!$product_query->row['quantity'] || ($product_query->row['quantity'] < $productCartQuantity)) {
$stock = false;
}
Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces
“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces
“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.
Yes … which is why I wrote this at the bottom:
However, the OC core uses the total terms for float variables, not integers. It simply got me confused for a second when I analyzed your code on the above due to this reason.Edit: The ptotal is an integer, not a float, I see.
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces
“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces
“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.
My modification code post has been edited as well.
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Thank you that's what i need.letxobnav wrote: ↑Mon May 06, 2019 8:35 amin order to prevent this I have to change
intoCode: Select all
// Stock if (!$product_query->row['quantity'] || ($product_query->row['quantity'] < $cart['quantity'])) { $stock = false; }
Code: Select all
$productCartQuantity = 0; foreach ($cart_query->rows as $cart_3) { if ($cart_3['product_id'] == $cart['product_id']) $productCartQuantity = $productCartQuantity + $cart_3['quantity']; } // Stock if (!$product_query->row['quantity'] || ($product_query->row['quantity'] < $productCartQuantity)) { $stock = false; }
مصمم ومطور متاجر إلكترونية | @Oc_Style
لطلبات التصميم، تعريب القوالب والاضافات، ترقية الإصدار، حماية المتجر قم بمراسلتي من خلال المنتدى
موديل: إشعارات البنوك السعودية
1 | 2 | O :طرق لحماية السكربت
It made no difference. Am I doing this correctly. I have opencart 3.03
Thanks
Tim
There is no Opencart 3.03 ??timbits451 wrote: ↑Thu Apr 08, 2021 11:41 pmHello! I too am looking for this solution. I installed your code in the system/library/cart/cart.php
It made no difference. Am I doing this correctly. I have opencart 3.03
Thanks
Tim
Try this Ensure you clear and refresh your modification caches
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
Users browsing this forum: Ahrefs [Bot], Baidu [Spider], musicweb, Semrush [Bot] and 36 guests