Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
I have a client that is looking at creating temporary nodes that could be converted to Ubercart products. However, there are some fields from Ubercart that are not created via CCK, and I'm curious if anybody has tried or had any success.
Sincerely,
Rene
Comments
Comment #1
alcroito CreditAttribution: alcroito commentedWell, I'm not sure if Ubercart is a node, but if it is, the 6.x version of the module has a hook that lets you make some additional changes while the node conversion, so you can create a module to deal with ubercart products. But there is a need to backport that feature to the 5.x version, and I currently don't have the time.
Comment #2
rhache CreditAttribution: rhache commentedI've tested this and can confirm it doesn't work.
Thanks,
Rene
Comment #3
websule-old CreditAttribution: websule-old commentedHi Rene,
It is possible with drupal 6.14, We just did it.
Let me know if you still need help with this?
Comment #4
marrop CreditAttribution: marrop commentedI would like to create a complex node (e.g. via CCK) and make this type a ubercart product. Essentially, the customer is to "configure" the product before checkout adding an address, a multi line text, a date etc.
I'm using 6.x-1.4 and ubercart 2. Is the above somewhat like what you have succeeded in doing? Any pointers and advice would be greatly appreciated!
Thanks
Comment #5
3goose CreditAttribution: 3goose commentedCopy the exact machine readable name of the content type you want converted to an ubercart product.
Browse to Administer › Store administration › Products > Manage classes
Enter the machine readable name of the content type into the class ID field and fill out the rest of the form. That content type is now an ubercart product!
Comment #6
texas-bronius CreditAttribution: texas-bronius commented..and by the same token, you can demote a node from being a product by deleting the Product Class under store administration (but don't delete the Content Type under admin>>Manage Content!). Not sure what this does for Ubercart-managed cck fields.
Comment #7
ocamp CreditAttribution: ocamp commentedhow did you fill in the product fields?
I cant even seem to edit them after I convert a node to a product
Comment #8
texas-bronius CreditAttribution: texas-bronius commentedocamp- Can you provide more info? Are you logged in as someone with permissions to edit Ubercart Products (store admin?) or the content type?
Comment #9
ocamp CreditAttribution: ocamp commentedhi, ive tried with admin, and other users with varied permissions, always get same result though.
I create a node, tried with a range of different types.
Convert that node to a product, the cck fields that can be converted to the new node do, and the fields that cant be converted get discarded.
I have the ubercart product with additional cck fields, filled in from the node that was converted.
Now I can click to edit the product, and edit the cck fields, and node elements such as node author etc. and click save, when i save it the cck/node elements get saved, the node product fields dont get saved.
Comment #10
texas-bronius CreditAttribution: texas-bronius commentedocamp- How are you "converting from cck to uc product?" I don't get why any cck fields would not be "supported" and would get discarded.
Comment #11
ocamp CreditAttribution: ocamp commentedhi, no i mean the cck fields get discarded when there isnt a relevant field on the product.
The situation is,
a user might upload artwork/portfolio, So ill have a content type called image, add cck file fields, for the users to upload their art work.
Then the user may decide that they want to sell their art work, not just display it. So i have the option to convert the image type to a product type.
Clicking on the convert tab at the top of the node works, the image type gets converted into product, the file field from image gets put in the file field on the product content type. Publishing/unpublishing the node, adding url alias, changing the image, etc all work,
but then the product specific fields dont work. A user can click to edit the product, and edit any field, but only the cck fields get saved. SKU, price, etc can be edited, but do not update when the node is saved.
Comment #12
alcroito CreditAttribution: alcroito commentedI've added code to make ubercart conversion work. Basically, if you use the initially created "product" content type, you should have no problems.
Comment #13
alcroito CreditAttribution: alcroito commentedAnd yeah, it's in the dev release.
Comment #15
samgreco CreditAttribution: samgreco commentedI am seeing this issue with 6.x-1.7.
I converted an existing Product to a new Product Type (made from a new class). Recreated the 4 custom CCK fields I had. The CCK fields converted without a problem.
Unfortunately, all of the price and shipping related fields (standard Ubercart fields) did not. And if I try and manually enter those after the conversion, it will not save any of the values. Always shows 0.
Comment #16
samgreco CreditAttribution: samgreco commentedComment #17
Zalatar CreditAttribution: Zalatar commentedI am seeing the same issue in Post 15. I create a "Product". Then when I convert that product to another Ubercart node type, I lose the pricing and I am unable to edit the SKU number. If I try to edit the SKU, upon saving the node, it deletes the SKU I put in and says it needs to have one due to it being a required field.
Hopefully someone has a fix for it.
Thx,
Z
Comment #18
islanddogg CreditAttribution: islanddogg commentedI'm having the same issues regarding updating product information. I converted one product class to another one, but I cannot update the product information fields, as the info is not saved.
Comment #19
rkeppner CreditAttribution: rkeppner commentedI think I've found a workaround for the problem described in posts 15 and 18, converting one Ubercart product class to another.
In the end, all I had to do was check the "Create new revision" box under "Revision information" and the changes saved correctly. Hopefully this helps a few frustrated converters like myself.
Comment #20
momper CreditAttribution: momper commentedsub
Comment #21
sherred CreditAttribution: sherred commentedI fixed the issue described in posts 15 & 18, i.e. converting a Ubercart Product node to a Ubercart Product Class node by modifying one line of code in uc_product.node_convert.inc :
Line 25 From:
if ($data['node']->type == 'product' && module_exists('uc_product')) {
To:
if (in_array($data['node']->type, uc_product_types()) && !in_array($data['dest_node_type'], uc_product_types()) && module_exists('uc_product'))
This way when both source and destination nodes are products the product does not get deleted from uc_products so product information such as SKU & cost remain linked to the node.
Comment #22
gregaltuna CreditAttribution: gregaltuna commentedHey all, sorry, but I'm a bit of a newb with Ubercart. The client's got books full of user bios. Need a product where the user fills out form then selects how many editions to subscribe to below it.
I've been banging my head against this real bad. First thought of using node checkout to buy the node, but couldn't figure out how to pass the value from the cck field to the cart.
So I stumbled upon this thread. But now I'm in the same predicament. Any way to pass the value of one of the CCK fields to the cart as the "price"???????
My PHP is still novice, but I know just enough to be dangerous so please be gentle.
Comment #23
MPforce CreditAttribution: MPforce commentedThanks to sherred. This was helpful information. Although, I have little to no PHP knowledge. I have searched for the original:
Line 25 From:
if ($data['node']->type == 'product' && module_exists('uc_product')) {
But can't find code resembling this in any of the .inc files. Any more specific information on where to put:
if (in_array($data['node']->type, uc_product_types()) && !in_array($data['dest_node_type'], uc_product_types()) && module_exists('uc_product'))
????? Thanks.
Comment #24
shingle CreditAttribution: shingle commentedIn response to #21
In my version there are 4 places the check:
is done, one for 'insert', 'delete', 'options' and 'options validate'. Line 25 is only for 'delete'. Should the check be modified to:
only for 'delete' or all 4 checks?
Comment #25
drupalmeister CreditAttribution: drupalmeister commentedHi,
I would like to convert a plain vanilla node to an ubercart product using the "node convert templates" (and have it produce an action).
I have two content types: "dummy_product" (which is NOT an ubercart procduct, but rather a plain content type with CCK fields) and "product" (Which IS indeed the default ubercart product class).
Now, I need to allow my customers to create "dummy_product" and only on some certain events will I want to use the action from the 'node convert' template to convert a 'dummy_product' to an ubercart 'product'.
If I currently try to convert anything that is not an ubercart product to an ubercart product, I get a form asking me to fill out the 'Product Information' (Preceeded by the text "Also the following parameters are available"), and I have to fill in the SKU and other information for the newly converted product.
What I would like to do is have some CCK fields on the original 'dummy_product" which will be converted and their values should be inserted into predefined mapped fields. For example, I would like to have a CCK field called 'dummy_sku' which when converted to a 'product' type should be automatically inserted as the 'product' SKU, and so on for price, weight, etc.
I would very much appreciate if anyone could give me some pointers to fix this issue, or help explain what needs to be done so that I can look it up and maybe contribute this back to the module.
Comment #26
alcroito CreditAttribution: alcroito commentedYour best bet is to write a custom module which uses the node_convert API.
You'll have to give all the necessary arguments to node_convert_node_convert(), and write an implementation for hook_node_convert_change, probably re-using the one in uc_product.node_convert.inc, which will transfer the cck field values into the corresponding ubercart fields. You'll also have to hack the module, and add your include to be loaded in hook_init().
By the time your hook_node_convert_change() is called, the node will already be converted in the database, but the cck values will still be available in the passed $node variable.
Comment #27
drupalmeister CreditAttribution: drupalmeister commentedThanks so much. I will look into it, and I hope I will be able to write such a module. Thanks so so much for your time and effort. I very much appreciate it.
Comment #28
Baibhav Kumar CreditAttribution: Baibhav Kumar commentedThanks buddy your post was really helpful
Comment #29
jasonabc CreditAttribution: jasonabc commented@sherred - a thousand thank-yous for posting this solution in #21! Was noticing all the price and shipping data was being lost when converting from the default "Product" to a custom Product Class. Your solution solved the problem - thanks!
Comment #30
forhaud CreditAttribution: forhaud commented@sherred - a thousand thank-yous for posting this solution in #21! Was noticing all the price and shipping data was being lost when converting from the default "Product" to a custom Product Class. Your solution solved the problem - thanks!
+10000
Why is not entered in the official version?