When I delete orders, I see the table commerce_option is cleaned but the table field_data_field_myoption is not .

should it not be cleaned as well ?

Comments

tajindersingh’s picture

This appears to be resulting in PDOException: SQLSTATE[23000]
https://drupal.org/node/1475592

tajindersingh’s picture

Priority: Normal » Major

Updating priority as it makes impossible to let customer buy products in case it is the reason of products not getting added to cart as it results in PDOException:
https://drupal.org/node/1475592

kevinsiji’s picture

At the moment it seems, only available option is, not to delete orders on a production website.

tajindersingh’s picture

Isn't there any way we can track the fields being used using records in commerce_option?

Usually it is required to delete all the orders and reset primary key for commerce_order table, before delivering the site for production use. So, it throws the Exception when customer first tries to purchase till the auto increment for line_item doesn't reach above already used in the field_data table.

anybody’s picture

Issue summary: View changes

This is still a very important issue and doesn't seem to be fixed yet. Can we use the power of entities to delete the orphaned entries?

anybody’s picture

I think the solution is to hook into the line item delete process and delete the related options before?
Perhaps https://api.drupal.org/api/drupal/modules!system!system.api.php/function...

tajindersingh’s picture

Similar issue was at https://drupal.org/node/1475592
and got solved by patch in #12 there.

The patch improved the code in same hook in commerce_option module.

Seems that will also this issue in case commerce_line_item delete is issued on order delete.

  • ce248db committed on 7.x-1.x
    Issue #1886140 Delete field data from commerce_option entities upon...
Anonymous’s picture

Status: Active » Closed (fixed)

This issue is fixed in the latest dev. Field data should now be deleted if the owning commerce option entity is deleted.

peter caritas’s picture

Hello,
I've downloaded the latest 7.x-1.x-dev and the fix referenced in #8 is not in there.

Anonymous’s picture

The fix is in the 2.x branch. Sort of messed up the commit message

egarbeil’s picture

I'm glad the fix is in the 2.x branch, but my client's site was installed in 1.x, and according to the documentation - there's no update path. This is a huge and ongoing problem. If you are not going to update 1.x branch, please provide an upgrade path to the 2.x branch. It's a production site and I can't experiment too much, so I need a clear path.

I have already applied the patches mentioned in the other issues, but the problem still occurs. I can't disable the delete orders, and it wouldn't matter because it happens when items are removed from the cart as well.

egarbeil’s picture

Status: Closed (fixed) » Active
solideogloria’s picture

Version: 7.x-1.0-beta2 » 7.x-1.x-dev
solideogloria’s picture

Status: Active » Fixed

Re #12, if you look at #8, the fix was applied to both branches.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

sano’s picture

I am running the Commerce Product Option version 7.x-1.0-beta2+35-dev (2015-Feb-05) and still see the problem.

...and regarding this statement:

Re #12, if you look at #8, the fix was applied to both branches.

...but the comment #11 by @samspinoy suggests, that the 7.x-1.0 dev version was not fixed.

solideogloria’s picture

It was fixed. But the maintainer reverted basically everything.

"Revert files to state of before project takeover. All new development will be on 2.x"

https://git.drupalcode.org/project/commerce_option/-/commit/a7766c87862d...

So if you want the fix, get a version of dev before the maintainer reverted everything. You can use the 08 Nov, 2014 version of dev. And you may have to fix the 2015 issue #2417947: Commerce 7.x-1.11: Option values are not stored with a patch.

sano’s picture

I used the patch #11 from the related issue and the problem seems to be gone.