CCK Products

Posts: 12
Joined: 10/30/2007

Well for starters...I got this message when I logged in to this site:

    * warning: array_keys() [function.array-keys]: The first argument should be an array in /var/www/vhosts/ubercart.org/modules/user/user.module on line 368.
    * warning: array_fill() [function.array-fill]: Number of elements must be positive in /var/www/vhosts/ubercart.org/modules/user/user.module on line 369.
    * warning: implode() [function.implode]: Bad arguments. in /var/www/vhosts/ubercart.org/modules/user/user.module on line 369.
    * user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1 query: SELECT DISTINCT(p.perm) FROM role r INNER JOIN permission p ON p.rid = r.rid WHERE r.rid IN () in /var/www/vhosts/ubercart.org/includes/database.mysql.inc on line 172.

Now to my question. I have a site that was previously not an e-commerce site, but it had "products" (done using CCK). Customers could reserve the product then come pick it up. Now I want to turn them into ubercart products. Can this be done easily, like the way the ecommerce module allows you to simply turn any node into a product? I have probably 100 of them, so doing them from scratch would be a lot of work and there are numerous fields.

Any idea what can be done?

Thanks.

Posts: 2244
Joined: 08/07/2007
AdministratoreLiTe!

I was surprised by how easy this was to do. There was some new code that had to be written, so this will only work in Alpha 8. You can actually try it with earlier versions, but that's really messy.

What's going to happen is that you can create a product class with the same name as the CCK node type. Übercart will tell Drupal that it is now a product node type and give it some default values for the product fields. It doesn't matter to CCK what module handles a node type, so all of the fields will be unaffected.

You will only be able to do this with custom node types, though. The product module has to hijack hook_load(), hook_insert(), and hook_update() for it to work properly. This would make a node-type module completely unusable if you turned that type into a product. There will be an update soon to prevent that. Edit: And by "soon", I mean "now".

Posts: 2
Joined: 11/14/2007

I want to turn image nodes (generated with image module) into products. Any idea?

thanks Smiling

Posts: 203
Joined: 09/06/2007

look at the sql how products are made up, then fill in for your image node...

Posts: 2
Joined: 11/14/2007

These are some details about what i need...

i'm a photographer and with image module i can take and generate nodes and galleries from a directory on the server. It is very simple and fast to upload them via ftp and automatically creating nodes and galleries.
Now i have to sell them... and i need these photos to be immediately products. But it doesn't seem possible with ubercart. Maybe i have to re- consider e-commerce package. Am i wrong?

Posts: 12
Joined: 10/30/2007

It is possible. A programmer I work with wrote an import script that took all my cck products and converted them to ubercart products. It automatically added a sku to all of them and imported the cck fields.

I had to pay him of course. Contact me to discuss.