Question for next meetup...

rggoode's picture

...assuming we're meeting this month, I have some questions that I would love some help with. I have a site I built a while ago that has a Drupal Commerce shopping cart enabled. However, the model was a real hack, as the owner never wanted to have credit card orders... It was just built to allow users to organize an order.

Big mistake...

Anyway, maintaining it using that model has been a headache ever since, and we've agreed to disable the cart and revert to the old model of a simpler brochure site (users will call in to order, as before).

Problem is, I'm having issues disabling the Commerce stuff. Of 33 modules that had been enabled (yes... 33!!!), I've gone through and disabled all but 6. Obviously I have to disable them in order dictated by dependencies, but now when I try to disable the PRODUCT module, I get a fatal error and the whole thing craps out.

If anyone has any experience in dealing with this, I'd love to hear it. Otherwise, I'd like to discuss the option of just maintaining the site with those 6 modules left enabled (the cart and any visible indication of an eCommerce site are gone with the modules already disabled).

Would leaving those things active but unused in the database expose the site to issues down the road? Does it invite future incompatibilities or vulnerabilities to hacks? I'm hoping not to have to rebuild this thing from scratch, but I'm pretty stuck right now.


Hi, Roger. I had a similar

peezy's picture

Hi, Roger. I had a similar issue uninstalling Commerce in the past. I found that the issue was product reference fields, which need to be deleted as part of the uninstallation process. I followed the advice in this post and it worked for me. Specifically, the first suggestion I have is to check /admin/reports/fields to see which content types are using product reference fields. You need to delete all of those product references, run cron (maybe even twice), and then try to uninstall another one or two modules at a time. My second suggestion to follow from the post is to use drush to uninstall the modules.

I hope that helps!

Thanks Peezy... I'd already

rggoode's picture

Thanks Peezy... I'd already deleted the Product Reference field from my display Content Type, but there is still a commerce_product Product Reference field in the line item types in the store for Commerce Product. That field is locked and I can't delete it.



Art has gone to the dogs

The field is locked because

peezy's picture

The field is locked because it is either in-use somewhere (an abandoned cart for example) or you could have an orphaned line-item.

If it is the former, you need to find everywhere it is being used and delete all those references. This is easier said than done. After backing everything up, I suggest doing this: First, visit /admin/commerce/orders and delete every order there. Next, visit /admin/commerce/orders/carts and delete all of those orders. Next, visit /admin/commerce/products and delete all the Products there, and finally visit /admin/commerce/products/types and delete all the Product variations.

If deleting all the orders, products, and product variations does not let you delete the field, that probably means you have an orphaned line-item. This can happen when modules create line-items, so you can try to uninstall one or two of your remaining modules and then try again. The next step involves the database (which is not my area of expertise). This comment shows the exact steps to follow. Please note that you should do not do this directly on the production environment.

You mentioned an alternative to uninstalling Commerce this in your original question: keeping these Commerce modules enabled and simply not using them. You can absolutely do that, as long as someone keeps doing security updates on those modules. To start on this path, you can set all the products' status to disabled, restrict access to Commerce's views (e.g. the cart), and restrict Permissions (e.g. Access checkout and create orders). That should keep people from being able to accidentally buy anything.

If you're like me and not comfortable in DB-land, then "turning off" the store may be the best option.

Whatever you end-up doing please let me know!

I'm stumped... I deleted all

rggoode's picture

I'm stumped... I deleted all of the products (unfortunately no bulk operation to do this) and found that the commerce_product Product Reference field was now completely missing. So I tried disabling the Product module again and got the same WSOD.

I'd backed up the database prior to doing this, so I reverted back and looked at the field list again and found that commerce_price was also locked. So that must be hiding somewhere.

In an earlier step, I'd disabled the Orders module, and found the Orders list seemed to have been emptied, although there was a page list remaining (each page being also empty). The first column header at the top of the empty table read "Broken handler commerce_order.order_number".

I hadn't deleted the orders prior to disabling, so i suspect there must be something buried in the database there. I suspect that there.

I've been saving incremental copies of the clone-site database as I've been going through this, so I guess my next step is to revert to before disabling orders and go through and delete all orders and all products first. (sigh).



Art has gone to the dogs

Unfortunately, the order in

peezy's picture

Unfortunately, the order in which the modules are disabled matters quite a bit. It might be worthwhile going back and re-enabling a few to help get you unstuck.

There are a couple of modules that could have helped with bulk deleting of orders: Commerce Backoffice and Commerce Order Cleanup. In fact, the latter might get you through this.

Good luck!

I've deleted all of the data

rggoode's picture

I've deleted all of the data in the Commerce Store (Orders, Shopping Carts, Customer Profiles, and Products). But when I disable the Products module, The site continues to crash. With Error Logging turned on, I get an error that begins with:

( ! ) Fatal error: Call to undefined function commerce_product_type_get_name() in /Users/rggoode/Dropbox/websites/htdocs/gpsimple/sites/all/modules/contrib/commerce_feeds/plugins/ on line 72

So it seems like Commerce Feeds may possibly be the culprit here? It's been a while, But I'm pretty sure that I used feeds to import a bunch of data for the products. So I wonder if that my be the issue here.

And if that's the case, I don't have a clue how to address it. I can't find anything online that means anything to me.



Art has gone to the dogs

Commerce Feeds requires

Perignon's picture

Commerce Feeds requires Commerce Product. So If you forcibly killed Product then Commerce Feeds will crash.

I haven't read your entire thread yet to see what the issue is.

Quick question. Does the site

Perignon's picture

Quick question. Does the site make use of Features?

Since Commerce Feeds depends

rggoode's picture

Since Commerce Feeds depends on Commerce Product, it's greyed out and I'm not able to disable it. And since it crashes when I try to disable Product, then I'm kinda stuck.

My goal is to disable everything related to Commerce at this point. But with Commerce Product not cooperating, I'm down to about 6 modules (including Commerce core, itself) that have dependencies and are still running.

To answer your other question, I do have Features running , but the only feature enabled uses a custom Content Type and View that I imported. But it has nothing to do with Commerce.



Art has gone to the dogs

I'm going to go with what has

Perignon's picture

I'm going to go with what has already been said. There are some orphaned fields somewhere in the database. I have had this happen when I am developing a module and you have to whip out your SQL skils to fix it. It cannot be fixed any other way because something has went wrong.

With you removing/disabling so many modules my bet is there is an orphaned field in the {field_config} and {field_config_instance} table. One of those modules left it behind. And since it is in the two aforementioned tables Drupal will not let you disable Commerce Product since they are tied to that module.

If you are ok with SQL. Run this query on the DB

SELECT * FROM field_config where type LIKE '%commerce%';

If you tables have a prefix be sure to add it.

See what fields are left that is tied to the module commerce_product_reference.

This is screen grab from MySQL Workbench of what you are going to see from that query: Only local images are allowed.

I misspoke... Since Commerce

rggoode's picture

I misspoke... Since Commerce Feeds does NOT appear to depend on Commerce Product. It requires Feeds, Chaos Tools, Commerce, and a couple of others.

And there's a note on the Module page that reads "Required by: Drupal (Feeds is currently using this module for one or more importers), Commerce Feeds Example "

I have a couple of Importers that I'd created to pull in some CSV data for the Products list. If I were to disable or delete those importers, might that allow me to disable the other Commerce modules?



Art has gone to the dogs

Commerce Feeds depends on

Perignon's picture

Commerce Feeds depends on Commerce Product and Commerce:

I would still check the fields_config DB. I would also say I have never used the Commerce Feeds module either. We did our product imports in code.

So I may have solved the

rggoode's picture

So I may have solved the problem.

Working off that Commerce Feeds module note that read (Feeds is currently using this module for one or more importers), I found the list of Feeds Importers and discovered that I had two custom f importers I'd made to pull in product data when I started using Commerce.

I deleted the importers and found that I was now able to disable Commerce Feeds. And with that disabled, I tried disabling the problematic Commerce Products module again. THIS time it worked. The module disabled without the WSOD site crash.

After that, I could go through and disable the last remaining Commerce modules completely.

I did notice however, that before I disabled the final core Commerce module, that there was a long list of log messages beginning with "Notice: Undefined index: ..." and a few log Warnings like: "Warning: Invalid argument supplied for foreach() in xmlsitemap_get_link_info()..."

After I disabled Commerce core, those messages ceased (?)

So being a complete paranoid now, my question is: Have I done something that may leave some hidden instability in the database that may come back and bite me at some later date.

Any comments here, or at tonight's meetup would be welcome. I'll have the cloned site with me on my laptop for you to look at the Recent log messages and such.



Art has gone to the dogs

Yes, bring your laptop tonight!

miche's picture

See you soon. :)

Michelle Lauer

Nice work! As long as those

peezy's picture

Nice work! As long as those messages are no longer appearing in the log, you should be OK. After the modules are safely uninstalled, be sure to remove the module folder itself from sites/all/modules.

I supposed that after uninstalling and removing the modules, you could query the DB and see if there is any lingering commerce data. That would be one way to confirm that Commerce is completely gone.

New Hampshire

Group categories

Regional Audience

Group events

Add to calendar

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: