1

I have an e-commerce site with drupal commerce kickstart and I added an additional field called "list price" and setted it as Price field (the same type of the default price).

Now I'm trying to update some of these prices via drupal views and VBO but I can't set them to NULL, I have an error: "Integrity constraint violation: 1048 Column 'field_list_price_amount' cannot be null"

But if I change that price manually via the standard windows and leaving the field empty, drupal accepts the update, why?!

Via VBO I can update normal prices (increase, decrease and more other things) but I can't reset them to its default values...

0

This would be because an empty value and NULL are two different things to a database. Deleting the value in the UI is not the same as setting it to be NULL. That field is stored in the database with the setting that I cannot be NULL and so the VBO operation is failing.

  • I checked the database tables regarding my filed, I allowed NULL value both in revision and field table and now it works, thank you very much! – SmurfXXX Mar 13 '15 at 8:17
  • If you are using a core field type. Changing the DB table (in a way, hacking Drupal core) to allow NULL values can potentially cause problems with your site down the road and is not recommended. – Brady Mar 13 '15 at 16:52
  • No, it isn't a core field, it's a custom field of type "price". – SmurfXXX Mar 13 '15 at 20:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.