Edit multiple products via editablefields module

Posts: 8
Joined: 09/28/2007
Bug Finder

Editablefields is a cool module that allows editing of CCK fields, regular node fields, etc ... but NOT Product fields from Ubercart.

I'm not sure why this is, but it would be really helpful to be able to adjust the price of multiple products from a custom view (or any other UB field - SKU, etc).

With 1000s of products to manage, the ability to bulk update or tweak products becomes essential.

Is there already some other means of achieving this?

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

It looks like he just didn't write code to support it: http://drupal.org/node/174600. Which is kind of a shame because I don't think everything needs to be done with CCK. Can you imagine the consistency problems we'd have to deal with here if we went that way? Barf!

Posts: 291
Joined: 08/28/2007
Early adopter... addicted to alphas.Not KulvikTheminator

We're currently looking for a way to edit multiple product prices at once. We thought about using CSV but editable fields within a controlled view would be so much better. I read the issue that Lyle posted and it seems Ryan wrote a patch for editablefields, did this get any further and is there any hope on the horizon for this functionality to be possible with Ubercart/editablefields? Is the patch Ryan submitted working in any way?

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

I wrote a patch for it and committed it to the HEAD CVS branch. As far as I know, that's the only way to get it. If someone is willing and able to test it out, I can see about releasing a new version on drupal.org.

Posts: 291
Joined: 08/28/2007
Early adopter... addicted to alphas.Not KulvikTheminator

Hey Lyle, very sorry, I thought Island Usurper was Ryan but it's you!

I'm going to grab it and test now. Thanks a lot.

Posts: 291
Joined: 08/28/2007
Early adopter... addicted to alphas.Not KulvikTheminator

Hi Lyle, I have installed editablefields HEAD from CVS but it seems I need to make a new content type and rebuild the products to make a field editable. Could you please confirm how I must proceed?

Posts: 291
Joined: 08/28/2007
Early adopter... addicted to alphas.Not KulvikTheminator

I'd just like to add that I tried Editview and it works well for SKU and node title but I was unable to get sell_price to show up at all.

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

For editablefields, you need to make a new View that is of the editable type. Once this becomes stable, I want to make it a default page in Übercart, but you have to do it manually for now. As you're building the editable View, add fields and make them editable as well. Continue with filters and sorts as necessary.

When you view the View, it becomes a form that updates all of the nodes that are visible on the page.

Posts: 291
Joined: 08/28/2007
Early adopter... addicted to alphas.Not KulvikTheminator

Hi Lyle, that's exactly what I did but I don't see any way to make the fields editable. Is that supposed to be an option within the fields section of the views create/edit page? I looked in the content types section the option to make anything editable doesn't seem to be there either.

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

It turns out there's an error in uc_product.module. The function uc_product_views_tables_alter() should be passed the $tables array by reference, so change line 1085 to

<?php
function uc_product_views_tables_alter(&$tables){
?>

Once that's saved, clear out the views cache (or at least the views_tables row) and the options should show up on the fields properly.

I'm pretty sure I had it working before, so I don't know why it would be broken now. *shrug*

Posts: 291
Joined: 08/28/2007
Early adopter... addicted to alphas.Not KulvikTheminator

Thanks Lyle, that works wonderfully now. I'll test it out on a clone of one of my live sites and report back here with my findings.

Posts: 291
Joined: 08/28/2007
Early adopter... addicted to alphas.Not KulvikTheminator

This is so good Lyle! The only thing I came across in my testing was a message of "enable CCK if you wish to edit fields" which happens when viewing the products_edit page view without being logged in as an admin user. It should really not show that page at all and I think this is a problem with views rather than editablefields.

I am installing it on a site for my users to test and they will surely find a problem if one exists. Will report back any issues. Thanks so much for taking this on, it is such a worthwhile addition to Ubercart.

Posts: 291
Joined: 08/28/2007
Early adopter... addicted to alphas.Not KulvikTheminator

One of my users has asked about how he can update prices for attributes but I assume there is no way to expose those to the views system.

Posts: 291
Joined: 08/28/2007
Early adopter... addicted to alphas.Not KulvikTheminator

Here's a bit of CSS I used to format the editablefields view page to make it easier to work with:

#editablefields table {
width: 100%;
}
#editablefields div.description,
#editablefields label {
display:none;
}
#editablefields .form-text {
width: 8em;
}
#editablefields .view-field-uc-products-sell-price .form-text {
width: 5em;
}

Pretty simple stuff but it might help someone.

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

While I think I know how to get attributes and options exposed to Views, I'm not sure it would actually be useful. First of all, there are typically several attributes per product, and several options per attribute. This makes the view very large and complicated really quick. Secondly, I don't think the attribute and option forms are compatible with editable fields. Editablefields uses the node system to save the data, and attributes have nothing to do with that. That's why they're on a separate tab from the edit form.

Posts: 291
Joined: 08/28/2007
Early adopter... addicted to alphas.Not KulvikTheminator

Yes, I agree with you. I have since spoken to my users and they were happy to use the attributes and options edit forms to add their price adjustments anyway, I think there were some cross wires. They probably have less than 5% of their products with price adjusting options and since the values are relative to the main price it's not even really an issue in the first place. I have no problems to report with the editable fields module and everything seems to be working perfectly with the latest bazaar.

Thanks again for this. It's going to be such a time saver and beats exporting and importing just to update fields.

Posts: 15
Joined: 09/20/2007
Bug Finder

You can use a MySQL editor as an alternative way of editing these value.

Try logging in, then go to the uc_products table and adjust prices based on model number.

To edit the weight of a product, look in the node_revisions table under format column.

Good luck.

Posts: 60
Joined: 09/04/2007

Hi. I would also like to get the 'Sell Price' field displayed using EditView. I actually got the 'SKU' field displayed, however, when I try to update the SKU value, it seems that no change is saved. Any idea? I did have the patch applied :S

I tried searching for

<?php
function uc_product_views_tables_alter(&$tables){
?>

but I couldn't find that line in uc_product.module. I'm still using Alpha 8 (sorry for that >_<), so I wonder how could I manage to succeed in this.

Thanks for any help! =)

Posts: 60
Joined: 09/04/2007

Moreover, I also tried using editable fields. With that, I was finally able to get the 'Sell Price' field displayed, as well as the SKU, but no way I could make those fields editable. I tried using Island Usurper's modification, but I'm not sure if it was necessary or how to apply it (I replaced the original editablefields.module). What am I missing?

Thanks again for any suggestion =)