8 replies [Last post]
WesleyTx's picture
Offline
Bug Finder
Joined: 09/14/2007
Juice: 89
Was this information Helpful?

OK, so I've got Ubercart 2 installed and working on a freshly updated Drupal 6 site featuring photos that I'm hoping to sell prints of.

Each photo is a node and I've successfully converted the "photo" type nodes into products by creating a class of the same name. I've also created the attribute "Print Size," with options like 8x10, 11x14, etc., and I've added that attribute to the class "photo."

As I've discovered, this does not automatically attach the attribute and its options to the existing nodes, which is disconcerting since I've already got dozens of nodes that need to have these options. It's also disconcerting to think that if I ever change the prices of those options in the future, I can't simply change them in one place and have them automatically reflected in all products of the same class, which, in my opinion, is how a system like this should logically work. (No offense to the creators intended; it's a great system and I know what a monumental effort it is to create something like this.)

I've done some searching and this is a concern that appears not uncommon. However, I haven't come across a workaround short of manually manipulating the database. Neither have I been able to dig up a project issue that clearly addresses this concern so I can monitor any progress.

Can anyone point me to something I've missed in either case?

harrisben's picture
Offline
Joined: 04/17/2009
Juice: 192
Re: Updating All Products

The way the system is designed seems to be that when you define the attribute and its options these are on defaults that will be available when you first attach them to a product, so you're correct in saying that updating attribute option defaults will have no effect on the attribute options you've already attached to products.

The only way I know to do a mass product update like what you're talking about is via sql. It is a pain, but if you're familiar with databases at all it isn't too hard.

Edit: I take that back, I've just looked at the database and see that product attributes and options are stored in different tables (?!), thus making it quite difficult to update via the database. I have no idea why product attributes and options would need to be in seperate tables, options cannot exist without an attribute and attributes have no purpose without options after all.

If they were in the same table it would have been incredibly straight forward. Sorry I can't be of more help.

WesleyTx's picture
Offline
Bug Finder
Joined: 09/14/2007
Juice: 89
Re: Re: Updating All Products

Thanks for taking a look. Unfortunately, I don't think I have the proper SQL skills to safely change things in this case.

Anyone know if there's some workaround I haven't come across?

And would it be a good idea to submit this as a feature request?

WesleyTx's picture
Offline
Bug Finder
Joined: 09/14/2007
Juice: 89
Product Retrospect Module

OK, I decided to take matters into my own hands and actually see if I could solve this problem for myself.

The result: a module I call Product Retrospect. Here's a summary:

Quote:

Unfortunately, updating the attributes for a particular product class only changes the default attributes that are applied to newly created products. In other words, making changes to a class's attributes will not affect already existing product nodes. Moreover, you cannot by default make changes to the pricing, weight or other information for multiple products at once, as these settings are stored separately for each product.

The Product Retrospect module, however, offers the following functions:

Update attributes & options
Select any class and apply its current settings retroactively to all existing products that share that class.

Update product information
Select one or more settings from any product node (e.g. price, weight, shipping) and copy them to all products of a particular class at once.

Drop it into the uc_ubercart/contrib/ directory, enable it and proceed to Store Administration > Products.

This module is currently in beta. It is the first module I've ever put together that I've dared release to the public and I do not warrant that it uses proper methods or even conforms to Drupal coding standards. Do not use this module on a production site.

I appreciate anyone trying it out or taking a look at the code and offering feedback.

AttachmentSize
uc_prodretro-6.x-1.0-beta1.tar.gz 4.99 KB
torgosPizza's picture
Offline
Bug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.
Joined: 08/14/2007
Juice: 4111
Re: Product Retrospect Module

Cool concept! I haven't looked at your code yet but in the Drupal User Group meetup tonight (San Diego) the module Views Bulk Operations was mentioned. I imagine that, once Ubercart has more exposure to Views, that this module would come in handy for doing this same kind of thing, but it'd be handled through the usual Drupal means (like Views).

--
Help directly fund development: Donate via PayPal!

WesleyTx's picture
Offline
Bug Finder
Joined: 09/14/2007
Juice: 89
Re: Re: Product Retrospect Module

Just noticed a horrible bug. Here's an update for anyone who's interested.

AttachmentSize
uc_prodretro-6.x-1.0-beta2.tar.gz 4.98 KB
livewire1337's picture
Offline
Joined: 06/04/2009
Juice: 37
Awesome!!

I was looking for a module to do exactly this!! Thank you for making it! Laughing out loud

livewire1337's picture
Offline
Joined: 06/04/2009
Juice: 37
Re: Awesome!!

This is not updating the attribute prices for me. It always sets all prices to 0 for any of the product attributes. How can I fix this?

I am using a drop-down box with about 18 different options, each with a different price. The price of each option gets set to 0 and the order of the options are all mixed up.

AllyMediaGroup's picture
Offline
Joined: 01/25/2011
Juice: 18
Doesn't work like I expected

I expected different results. When you run this module it removes all the attributes to products already in the database. I was looking for something to update option pricing to existing products.