Jump to content

Edit History

obewanz

obewanz


updated with possible option

On 2/9/2019 at 3:09 AM, folkifoon said:

Hi, i use Mollie (Netherlands). I have around 20 orders a day, but already 3 times at the same time giving me problems.

I use your code, that is perfect for me, but it needs to check if the reference number does exist. So i think i need a part of the code that is posted by Fertechpl.

So my reference is
ML121500  (order id is 500)

The next one will be ML121501. Now  a second customers comes on the the site, and is paying before the one that started payment first. This will give a problem.
So for that i need the reference to be changed to QML12150Q or something

ML121500  (order id 500)
ML121501  (order id 501)
ML12150Q (order id 502)
ML121503 (order id 503)

Can you help me with that? 

So I made an assumption that I should not have made and did not ask... What version of Prestashop are you running?
 

The Technical Concepts:
The Reference Number in the ps_orders table is NOT unique (see screencap below) and so duplicates would only stop an order from processing if the selected payment provider is being fed the Reference Number from the 'ps_orders' table and said provider requires that value to be UNIQUE. (This could possibly be addressed in the payment module.) Having said that, in order to replicate your issue, I believe one would have to have two browsers open and submit both orders at EXACTLY the same time. The solution requested to append a letter and disturb the natural sequential interval would not be acceptable to me, nor would I expect it to be for most other larger store owners.

So at first glance, to fix the level of problem you explain, one would likely have to write a substantially more complex override that would actually store the order, grab the value in the 'order_id' field of the ps_orders table (since that IS a UNIQUE value), then return a prepended string of that value storing it in the 'reference' field and THEN allowing the process to continue within the Prestashop order flow. On second thought, THIS could (possibly) be accomplished with an override to the PaymentModule.php class, but the public function validateOrder is complex enough that I'm a little concerned with this approach given Prestashop's history with code patching, etc. With that in mind, I'll work to add a new override in a followup post with the changes needed to insure the reference number is as unique as the order_id.

So the short answer is - off the top of my head - there is no simple solution to your dilemma other than to address the apparent latency issues or write a different override.

Sorry!

image.png.103050b542fc1e1ef6a019bfe89cc9fa.png

obewanz

obewanz


updated with possible option

On 2/9/2019 at 3:09 AM, folkifoon said:

Hi, i use Mollie (Netherlands). I have around 20 orders a day, but already 3 times at the same time giving me problems.

I use your code, that is perfect for me, but it needs to check if the reference number does exist. So i think i need a part of the code that is posted by Fertechpl.

So my reference is
ML121500  (order id is 500)

The next one will be ML121501. Now  a second customers comes on the the site, and is paying before the one that started payment first. This will give a problem.
So for that i need the reference to be changed to QML12150Q or something

ML121500  (order id 500)
ML121501  (order id 501)
ML12150Q (order id 502)
ML121503 (order id 503)

Can you help me with that? 

So I made an assumption that I should not have made and did not ask... What version of Prestashop are you running?
If you are running 1.7.x , I would need to setup a new test site as I have not reinstalled PS 1.7.x since I changed providers and I have no intention of upgrading to v1.7.x in the foreseeable future.
If you are running 1.6.x, it would appear that you have some serious latency problems in your server and/or payment provider - maybe the easiest solution is to fix that problem first.

The Technical Concepts:
The Reference Number in the ps_orders table is NOT unique (see screencap below) and so duplicates would only stop an order from processing if the selected payment provider is being fed the Reference Number from the 'ps_orders' table and said provider requires that value to be UNIQUE. (This could possibly be addressed in the payment module.) Having said that, in order to replicate your issue, I believe one would have to have two browsers open and submit both orders at EXACTLY the same time. The solution requested to append a letter and disturb the natural sequential interval would not be acceptable to me, nor would I expect it to be for most other larger store owners.

So at first glance, to fix the level of problem you explain, one would likely have to write a substantially more complex override that would actually store the order, grab the value in the 'order_id' field of the ps_orders table (since that IS a UNIQUE value), then return a prepended string of that value storing it in the 'reference' field and THEN allowing the process to continue within the Prestashop order flow. On second thought, THIS COULD be accomplished with an override to the PaymentModule.php class, but the public function validateOrder is complex enough that I'm a little concerned with this approach given Prestashop's history with code patching, etc. With that in mind, I'll add the override in a followup post with the changes needed to insure the reference number is as unique as the order_id.

So the short answer is - off the top of my head - there is no simple solution to your dilemma other than to address the apparent latency issues.

Sorry!

image.png.103050b542fc1e1ef6a019bfe89cc9fa.png

obewanz

obewanz


updated with possible option

On 2/9/2019 at 3:09 AM, folkifoon said:

Hi, i use Mollie (Netherlands). I have around 20 orders a day, but already 3 times at the same time giving me problems.

I use your code, that is perfect for me, but it needs to check if the reference number does exist. So i think i need a part of the code that is posted by Fertechpl.

So my reference is
ML121500  (order id is 500)

The next one will be ML121501. Now  a second customers comes on the the site, and is paying before the one that started payment first. This will give a problem.
So for that i need the reference to be changed to QML12150Q or something

ML121500  (order id 500)
ML121501  (order id 501)
ML12150Q (order id 502)
ML121503 (order id 503)

Can you help me with that? 

So I made an assumption that I should not have made and did not ask... What version of Prestashop are you running?
If you are running 1.7.x , I would need to setup a new test site as I have not reinstalled PS 1.7.x since I changed providers and I have no intention of upgrading to v1.7.x in the foreseeable future.
If you are running 1.6.x, it would appear that you have some serious latency problems in your server and/or payment provider - maybe the easiest solution is to fix that problem first.

The Technical Concepts:
The Reference Number in the ps_orders table is NOT unique (see screencap below) and so duplicates would only stop an order from processing if the selected payment provider is being fed the Reference Number from the 'ps_orders' table and said provider requires that value to be UNIQUE. (This could possibly be addressed in the payment module.) Having said that, in order to replicate your issue, I believe one would have to have two browsers open and submit both orders at EXACTLY the same time. The solution requested to append a letter and disturb the natural sequential interval would not be acceptable to me, nor would I expect it to be for most other larger store owners.

So at first glance, to fix the level of problem you explain, one would likely have to write a substantially more complex override that would actually store the order, grab the value in the 'order_id' field of the ps_orders table (since that IS a UNIQUE value), then return a prepended string of that value storing it in the 'reference' field and THEN allowing the process to continue within the Prestashop order flow. On second thought, THIS COULD be accomplished with an override to the PaymentModule.php class, but the public function validateOrder is complex enough that Prestashop could change the code in this function and break your order processing without notice. With that in mind, I'll add the override in a followup post with the changes needed to insure the reference number is as unique as the order_id.

So the short answer is - off the top of my head - there is no simple solution to your dilemma other than to address the apparent latency issues.

Sorry!

image.png.103050b542fc1e1ef6a019bfe89cc9fa.png

obewanz

obewanz


clarification

On 2/9/2019 at 3:09 AM, folkifoon said:

Hi, i use Mollie (Netherlands). I have around 20 orders a day, but already 3 times at the same time giving me problems.

I use your code, that is perfect for me, but it needs to check if the reference number does exist. So i think i need a part of the code that is posted by Fertechpl.

So my reference is
ML121500  (order id is 500)

The next one will be ML121501. Now  a second customers comes on the the site, and is paying before the one that started payment first. This will give a problem.
So for that i need the reference to be changed to QML12150Q or something

ML121500  (order id 500)
ML121501  (order id 501)
ML12150Q (order id 502)
ML121503 (order id 503)

Can you help me with that? 

So I made an assumption that I should not have made and did not ask... What version of Prestashop are you running?
If you are running 1.7.x , I would need to setup a new test site as I have not reinstalled PS 1.7.x since I changed providers and I have no intention of upgrading to v1.7.x in the foreseeable future.
If you are running 1.6.x, it would appear that you have some serious latency problems in your server and/or payment provider - maybe the easiest solution is to fix that problem first.

The Technical Concepts:
The Reference Number in the ps_orders table is NOT unique (see screencap below) and so duplicates would only stop an order from processing if the selected payment provider is being fed the Reference Number from the 'ps_orders' table and said provider requires that value to be UNIQUE. (This could possibly be addressed in the payment module.) Having said that, in order to replicate your issue, I believe one would have to have two browsers open and submit both orders at EXACTLY the same time. The solution requested to append a letter and disturb the natural sequential interval would not be acceptable to me, nor would I expect it to be for most other larger store owners. So at first glance, to fix the level of problem you explain, one would likely have to write a substantially more complex override that would actually store the order, grab the value in the 'order_id' field of the ps_orders table (since that IS a UNIQUE value), then return a prepended string of that value storing it in the 'reference' field and THEN allowing the process to continue within the Prestashop order flow.

So the short answer is - off the top of my head - there is no simple solution to your dilemma other than to address the apparent latency issues.

Sorry!

image.png.103050b542fc1e1ef6a019bfe89cc9fa.png

obewanz

obewanz

On 2/9/2019 at 3:09 AM, folkifoon said:

Hi, i use Mollie (Netherlands). I have around 20 orders a day, but already 3 times at the same time giving me problems.

I use your code, that is perfect for me, but it needs to check if the reference number does exist. So i think i need a part of the code that is posted by Fertechpl.

So my reference is
ML121500  (order id is 500)

The next one will be ML121501. Now  a second customers comes on the the site, and is paying before the one that started payment first. This will give a problem.
So for that i need the reference to be changed to QML12150Q or something

ML121500  (order id 500)
ML121501  (order id 501)
ML12150Q (order id 502)
ML121503 (order id 503)

Can you help me with that? 

So I made an assumption that I should not have made and did not ask... What version of Prestashop are you running?
If you are running 1.7.x , I would need to setup a new test site as I have not reinstalled PS 1.7.x since I changed providers and I have no intention of upgrading to v1.7.x in the foreseeable future.
If you are running 1.6.x, it would appear that you have some serious latency problems in your server and/or payment provider - maybe the easiest solution is to fix that problem first.

The Technical Concepts:
The Reference Number in the ps_orders table is NOT unique (see screencap below) and so duplicates would only stop an order from processing if the selected payment provider is being fed the Reference Number from the 'ps_orders' table and said provider requires that value to be UNIQUE. Having said that, in order to replicate your issue, I believe one would have to have two browsers open and submit both orders at EXACTLY the same time. The solution requested to append a letter and disturb the natural sequential interval would not be acceptable to me, nor would I expect it to be for most other larger store owners. So at first glance, to fix the level of problem you explain, one would likely have to write a substantially more complex override that would actually store the order, grab the value in the 'order_id' field of the ps_orders table (since that IS a UNIQUE value), then return a prepended string of that value storing it in the 'reference' field and THEN allowing the process to continue within the Prestashop order flow.

So the short answer is - off the top of my head - there is no simple solution to your dilemma other than to address the apparent latency issues.

Sorry!

image.png.103050b542fc1e1ef6a019bfe89cc9fa.png

×
×
  • Create New...