Ubercart & Content Type machine names
If you use Ubercart on your Drupal website you may be familiar with product classes. Ubercart has, by default, a product content type, however say you have other content types on your site that you want to sell, you can create product classes from those – http://www.ubercart.org/docs/user/3341/understanding_product_classes.
This works nicely until that moment when you want to rename your content type machine name.. e.g from “contenttype” to “content_type”
I did that recently thinking everything would be hunky dory once I made the change, the results were not so nice. So to help prevent this from happening to anyone else, here’s a simple rule to follow before making changes to your content type machine name.
Make sure you remove your content type as a product class before changing it’s machine name.
It’s that easy, simply disassociate your content type from Ubercart. The page to do this can be a little scary (www.yoursite.com/admin/store/products/classes), but just click the delete link on the class you want to disassociate and you’ll get a “Are you sure you want to do this message”, go ahead, it won’t delete your nodes, it just removes a flag that tells Ubercart they’re products. Also, if you’re worried about losing your product data, like SKU, Price, Shipping info etc, in my case it retained all product info when I re-instated it. Please backup your data before doing this, I cannot be responsible for any problems this causes on your site. Now, go to your content type, change the machine name.
Oh, and don’t forget to double check all your views are still working, you may need to edit them to ensure they’ve picked up the new content type machine name. I guess this is a good lesson to remind you to give your content types a machine name that you will not want change later.
Tags: Ubercart
January 29th, 2010 at 5:55 am
I tried Ubercart but it lacked a full set of functionality required for online payment processing. As an alternative option for you, I tried aMember (good, but complex to install & administer) but ended up using DLGuard (http://tinyurl.com/dlguardlearn) for its security and automation. I put up a full review at sell eBooks and software online