Jump to content

Edit History

Andrei H

Andrei H

Hello,

Thank you for pointing that out. I haven't tested with the UNIQUE constraint, because I thought it should work, but it looks like the product was saved once more before that line.

Here is the correct solution:

On the line 275 above, add the following:

$shopProduct->reference = $duplicatedProduct->reference;

Also, on line 304 - old line 303, insert a new line and add the following:

$duplicatedObject->reference = bin2hex(random_bytes(10));

With these two changes, things should be working as expected.

I added two screenshots that also highlight where the code should be placed.

Screenshot 2025-06-08 143029.png

Screenshot 2025-06-08 143049.png

Andrei H

Andrei H

Hello,

Thank you for pointing that out. I haven't tested with the UNIQUE constraint, because I thought it should work, but it looks like the product was saved one more before that line.

Here is the correct solution:

On the line 275 above, add the following:

$shopProduct->reference = $duplicatedProduct->reference;

Also, on line 304 - old line 303, insert a new line and add the following:

$duplicatedObject->reference = bin2hex(random_bytes(10));

With these two changes, things should be working as expected.

I added two screenshots that also highlight where the code should be placed.

Screenshot 2025-06-08 143029.png

Screenshot 2025-06-08 143049.png

Andrei H

Andrei H

Hello,

Thank you for pointing that out. I haven't tested with the UNIQUE constraint, because I thought it should work, but it looks like the product was saved before that line as well.

Here is the correct solution:

On the line 275 above, add the following:

$shopProduct->reference = $duplicatedProduct->reference;

Also, on line 304 - old line 303, insert a new line and add the following:

$duplicatedObject->reference = bin2hex(random_bytes(10));

With these two changes, things should be working as expected.

I added two screenshots that also highlight where the code should be placed.

Screenshot 2025-06-08 143029.png

Screenshot 2025-06-08 143049.png

×
×
  • Create New...