Multiple products one node?

ck9 - June 21, 2009 - 15:59
Project:UC Node Checkout
Version:6.x-2.0-beta3
Component:Miscellaneous
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed
Description

Great module. There's one more thing I'm trying to do and was wondering how best to achieve it. I have a product which is associated with a node type 'Specification Form', which allows the user to specify in detail what they want, then check out, allowing the manager to create the product to their specification.

So far no problem. However, when I add several more products it seems I can't associate them with the same node type 'Specification Form'. It seems I need a new node type 'Specification Form A' for Product A, etc. etc. Is that correct? Is there any way to associate multiple products with one node type?

#1

intuited - July 2, 2009 - 12:58

That would be great, agreed.

#2

fred0 - July 7, 2009 - 18:19

Or, alternately, associate the node type with a product class instead of an individual product.

#3

mkeith - July 14, 2009 - 19:59

i agree with fred0. i'm in the exact same situation and don't want to have to create a new content type for each product.

#4

echoz - July 14, 2009 - 22:40

A very helpful person provided some code to do this in a comment here (#38)
http://drupaleasy.com/blogs/ultimike/2009/03/event-registration-ubercart...

besides this being an extremely helpful tutorial for using UC Node Checkout.

#5

fred0 - July 16, 2009 - 00:56

echoz: I'm afraid I don't see how that applies to what we're discussing here. I'd tried that tutorial before and, while thta post is new since then, it is in regards to creating a view of purchased uc nodes and related orders. This thread is discussing how the current incarnation of uc_node_checkout only allows one to relate a checkout node to an individual product (as opposed to a product class) forcing one to create a unique node type for every product should your desired workflow be to have many different products that all use the same form for options (be it registration or other configuration).
Please enlighten me if I am missing something.

#6

intuited - July 17, 2009 - 10:10

Hi folks,
Haven't had time for thorough testing yet, but this patch does seem to be working, at least for what I'm using it for. If you do try it out, any feedback you can provide would be quite welcome.
What it does:
Adds a column to the uc_node_checkout admin page to provide for the possibility of mapping a content-type to a product class rather than (or actually in addition to) a specific product or a view.
A click on the "Add to Cart" button for any product that's in a thus-associated class will send the user through the process of creating a node of the associated content type. That created node will then be associated with the product whose Add to Cart button was clicked, in the same way that uc_node_checkout creates the usual node-to-product associations.
It's possible to map a ctype to both a product and a class; this I think will actually work, meaning that if you create a node through Add Content it will map to the product you associated the ctype with, but if you create it by clicking on Add to Cart for a product-class-member product, the created node will map to the product that the Add to Cart button was for. At least it might work that way... I haven't tested this functionality and don't plan to since I have no foreseeable need for it.
Also added are Views 2 relationships that you can use to build views that relate ordered products to the node that was created when they were ordered. I've got the uc_views module installed; I'm not sure how useful the relationships will be without it.
Since it's helpful to confirm that the order actually completed you may want to use a patch I wrote for uc_views: http://drupal.org/node/505992. This fixes a bug that enables the Order Status filter (among others) for Ubercart orders.
I found it useful to relate the uc_order_products table back to node; a patch for uc_views that adds this relationship is at http://drupal.org/node/522198.
If you're not using uc_views, note that although it creates database 'view tables' which are not necessarily portable (depending on DB permissions and possibly underlying database architecture), the module and the functionality I've mentioned here should be usable even if you don't have permission to create views, since it doesn't make use of any of those tables.
echoz: Using Views in this way would seem to alleviate the need for some of the awkward aspects of the tutorial you mentioned; eg storing the event NID in the created content node is not necessary, you just relate them through the uc_node_checkout db table that's already storing that info. This eliminates needless data duplication and scales much more readily to mapping multiple products to one content type, which is something that, as I understand it, that tutorial doesn't cover.

AttachmentSize
map_ctype_to_pclass.patch 10.84 KB

#7

intuited - July 17, 2009 - 10:26

PS Please ignore the sketchy commented-out code at the end of the patch. It's been hacked to bits and doesn't really make sense any more.

#8

sanguis - July 21, 2009 - 13:50

subscribing

#9

rszrama - July 23, 2009 - 06:14
Priority:critical» normal
Status:active» fixed

This was the whole reason Views support was added. With Views 2 installed, create a View that will list any product node you want to associate with a node type form in the View's default display. When any matching product is added to the cart, the customer will be redirected to the node add form.

#10

fred0 - July 23, 2009 - 18:19

rszrama: Thanks for that. It seems this is an poorly documented feature. I'd read all the documentation and tutorials for node checkout that I could find and none of them presented the use of views in this manner. My impression of the Views2 integration from all that I read was that it was meant to allow a workflow where one selected a node type form and were then asked to select a product from a pop-up menu. I was getting ready to spend several days writing my own version. So happy I don't have to!

#11

rszrama - July 24, 2009 - 04:16

hehe Yeah, the documentation is in a poor state. Sorry for lagging behind.

#12

SocialNicheGuru - July 24, 2009 - 22:15

I am new to ubercart and products.

I have a product with multiple attributes.

Each attribute combination creates a product sku. Ubercart defaults this to the sku or the base product.

Right now I have to go in and modify these skus for each attribute. (Can someone confirm this? Is there anyway to automatically created different product sku?)

I would like to associate a different uc_node_checkout content type to each product sku from an attribute.

Will uc_node_checkout allow me to do this?

would i have to create a view that returns the skus for the products and then manually select the products that i want the uc node checkout associated with?

#13

wesoccer2003 - July 25, 2009 - 08:27

intuited,

i tried your patch but i keep getting the following error at the top of my site after i apply the patch:

Fatal error: require_once() [function.require]: Failed opening required './sites/all/modules/uc_node_checkout/uc_node_checkout.install' (include_path='.;C:\php5\pear') in C:\wamp\www\ads\includes\module.inc on line 262

Any idea why I would be getting this error? The site is down once i apply the patch. i get a white screen with the message above.

Thanks

#14

fred0 - July 25, 2009 - 17:37

wesoccer2003, per comment #9, you don't need the patch. Just use the Views2 function to relate a node type to products/product classes.

#15

System Message - August 8, 2009 - 17:40
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

#16

glennnz - August 9, 2009 - 05:36

Hi Ryan

Functionally, this works perfectly. From a user's perspective though, it's a bit flaky (IMHO!!). Unless I'm missing something...

The reason is that my user has already pressed, "Add to cart" on my product node. They shouldn't need to select again which product they want to buy from the select list (or have I missed a setting...????)

In my site at the moment, the user sees these steps:

1. View product. Click "Add to Cart"
2. Page with a list of Views appears. Click the View title.
3. Page with a dropdown select appears with the products associated with that View.
4. Finally they get to enter information for the event registration.

Cheers

Glenn

For an example see http://203.118.157.191/chess4life

#17

echoz - August 9, 2009 - 05:38

Not a page view, a view of Row style: Node (which has no fields). It's one click extra through your node checkout form.

#18

rszrama - August 9, 2009 - 17:31

I'm not sure why a View is being displayed for you. This isn't normal... if they get there from a product add to cart button, it should go straight to the node/add form unless the View isn't working properly for some reason. Also, fwiw, you don't have to use the add to cart button. You could just throw an image button on a page that links straight to the node/add URL. When UCNC was originally developed, it wasn't intended for stores to even display the associated product nodes.

#19

glennnz - August 9, 2009 - 21:53

Hi Ryan

I can see what's happening, but I've no idea why...

Originally I had three different tournaments, each with their own content type. To make the store more extensible (to allow for hundreds of different tournaments) I removed the extra content types, and made one, "Tournament Registration." Previously I had, "Tournament 1 Registration, Tournament 2 Registration," etc...

If you look at the URL as you go through the process, you can see the error. When I click on, "Add to Cart", I should get a URL of www.example.com/?q=node/add/tournament-registration&product_nid=83&qty=1. Instead I am getting www.example.com/?q=node/add/tournament-1-registration&product_nid=83&qty=1.

It is somehow remembering my old content types..... I've cleared the caches with no effect. Next I'll delete all my products and content types and start again...

Cheers

Glenn

--UPDATE--

Deleting my tournament products and re-entering them worked fine, I'm away laughing.

Maybe this is an issue that needs escalating to a bug?

Cheers

Glenn

#20

glennnz - September 7, 2009 - 00:21

Ryan

Any plans to add Views support for D5 version?

Glenn

#21

valariems - October 19, 2009 - 15:10

Just so you know, the problem glennnz was having is not isolated. I was also having the same (or very similar) problem.

A user would select a product from a view I had created that listed all the products. They should have been directed to the node content type I created for the user's registration information. Instead of taking them directly to that node, when they clicked "add to cart," it would take them to the "create content" page where all the content types that they had permissions to create were listed. Also, after they created their node, it would take them to another page where they had to reselect the product from a dropdown box.

This was only happening when I was using a view, rather than a product nid, in the settings in node checkout.

Like glennnz suggested, I deleted all the products, create new products, and everything worked as advertised.

I messed with this so long that I can't point specifically to what I did that caused this problem, and I apologize for that. I do know that somewhere along the line, I changed my Node Content Type name and type. Perhaps that's what broke everything with the existing products, even when I went back and made the related changed to the node checkout settings. I'm a newbie, so I'm kind of making a mess as I try to get everything to work.

 
 

Drupal is a registered trademark of Dries Buytaert.