Post by jjtansg » Tue Apr 10, 2012 12:22 am

Hi,

I have been a big supporter of Opencart all these while as I feel that it is easily customizable (with the MVC concept). However, it is lacking the solution for the classic concurrent problem below (I am using opencart 1.5.1).

1. Product A has quantity of 1
2. User A sees Product A and adds to cart. At the same time User B sees Product B and adds to cart.
3. Both User A and B check out and make payment. The quantity of Product A becomes negative (-1).

To solve this problem, I come out with a solution

1. Whenever a user adds an item to the cart, the system checks the quantity whether it is sufficient.
2. If the quantity is enough, the quantity is reduced and the item is added to the cart. The system creates a temporary order and saves it in the database. The timestamp of the order gets updated whenever the user visits a page.
3. If the quantity is not enough, the item is not added to the cart.
4. When user checks out and makes payment, the order gets updated with the shipping and payment details.
5. A cron job is executed every interval (e.g. 1 hour) to retrieve temporary orders with timestamp older than 30 mins. The temporary orders are deleted and the quantity is restored back to the inventory.

This solution ensures that there is no negative quantity for the items.

I will love to hear feedbacks and suggestions on this solution and perhaps other solutions which are being implemented to solve this problem.

Thanks!

Newbie

Posts

Joined
Mon Feb 06, 2012 2:00 pm

Post by bingo » Tue Apr 10, 2012 12:54 am

I think opencart already do this.In your example:
1. Product A has quantity of 1
2. User A sees Product A and adds to cart. At the same time User B sees Product B and adds to cart.---yes,they both can add to cart.
3. Both User A and B check out and make payment. The quantity of Product A becomes negative (-1).---if a checkout and make payment faster than b,then b can not checkout and make payment.Opencart will force b return to shopping cart with message the item out of stock.

One Page Checkout Professional - More flexible and powerful one page checkout solution.
One Page Checkout Standard - Best one page checkout solution,separate module,no core files replace.
Product Import Export - Bulk insert update download product excel format.
Order Manager - help you manage orders more effectively.


User avatar
Active Member

Posts

Joined
Sun Sep 04, 2011 6:57 am


Post by xlam » Fri Mar 07, 2014 11:49 pm

Hi jjtansg,
i have big problem like you, for a long time i looking for this error... any solution to fix it?

Baju Muslim Baju Pria Baju Anak Baju Korea Sparepart Printer Baju Muslim JNE Surabaya


New member

Posts

Joined
Sun Dec 25, 2011 2:58 pm

Post by xlam » Mon May 26, 2014 10:48 pm

Does anybody fix this issue?

Baju Muslim Baju Pria Baju Anak Baju Korea Sparepart Printer Baju Muslim JNE Surabaya


New member

Posts

Joined
Sun Dec 25, 2011 2:58 pm

Post by straightlight » Wed May 28, 2014 9:59 pm

For which OC version is this topic reported about?

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Opencart.com contractor officials representative


Administrator
Online

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by xlam » Thu Sep 25, 2014 1:02 am

straightlight wrote:For which OC version is this topic reported about?
I use opencart 1.5.5.1, how to report bug?

Baju Muslim Baju Pria Baju Anak Baju Korea Sparepart Printer Baju Muslim JNE Surabaya


New member

Posts

Joined
Sun Dec 25, 2011 2:58 pm
Who is online

Users browsing this forum: No registered users and 10 guests