I have a pretty big store with over 4000 products and client requires to display different prices for roles. It creates the role-based price fields in product edit page and you can add them manually easily enough. My question is, how can I populate those fields as a bulk operation using Node Import. Adding CCK fields is easy but I have no idea how to post the data in correct fields. Any help is appreciated.

Comments

teoverton’s picture

Hi z1rra,

Did you have any luck with this? I find myself in he same situation where the price per role is not being exposed as a field which I can then map to in node import for mass importation of the products.

Any help would be appreciated.

Thomas

Anonymous’s picture

Hello
I have the same issue as yours.

teoverton’s picture

Unless I am missing something, the import of the price per role looks as if it should work quite easily(at least with just a single other role) if the field is imported as an array of the relevant role ID and the corresponding price.

Is their anyone that knows how to import a field as an array within the following array? If I add this to the uc_product.inc:

$fields['role_prices'] = array(
'title' => t('Dealer price'),
'group' => t('Product information'),
'weight' => 15,

I get the price field to associate for the import, but of course nothing shows up in the uc_price_per_role table because it appears the field needs to be an array ("RID", ""price"). I'm missing how to add in the role ID into the array (or make the field input an array). In my case the role id for the "dealer" is 8, so I believe the 'role_prices ' field should be an array of ['8'=>'relevant price] but how do I format that as a filed in the uc_product.inc.

Can someone give me a pointer on this. I'd really appreciate it. I see people have been looking how to do this for over a while but I don't see any success yet. This is fairly important functionality for real-world ubercart!

drummondf’s picture

I too am looking for some help with this issue - teoverton, wonderful solution so far - wondering if anyone can finish this up?

nvl.sateesh’s picture

StatusFileSize
new961 bytes

Hi Friends,

I had the same situation where I had to import Price Per Role via Node Import. The CSV file had the price per role in separate columns. Here is how I achieved it. It works for me, you can see the attached .inc file if it works for you too.

  • I created my own .inc file in node_import/supported/ubercart/ directory
  • Then, using hook_node_import_fields() i added my own field mapping called Role Prices and set 'has_multiple' => TRUE
  • Then, using hook_node_import_values_alter(), I am turning the multiple values into the array which node_save understands
criznach’s picture

I also put some research into this, and created a rough version of a helper module that adds a mapping field for each enabled role on the price per role settings page, which can be mapped to any column. If anyone is interested in sponsoring my work, I'll do the work to polish and share it, and/or submit it to the node_import maintainer.

drummondf’s picture

Sateesh, this is fantastic! Thank you so much! I have a question however:

I have two Price-per-Role prices for my products in addition to the retail price and sell price (not using cost). How do I get this add-on to let me assign the two prices to the proper Price-per-Role fields?

Would it be possible to use this same method for flat rate shipping options? I know that would fall outside of this issue queue but its something I'm looking to resolve.

Do you also have a page where I can make a donation to you? I'll owe you one if I can get this working!

Sincerely,
Eric G.

nvl.sateesh’s picture

Hi Eric,

I am glad it helped.

I did not understand what you meant by "How do I get this add-on to let me assign the two prices to the proper Price-per-Role fields?".

Yes you can use this same method for flat rate shipping options as well. Once you are in the post-process part, you can do all that you need. If you can elaborate more, maybe I can help more.

For some reason, I am not getting any email updates when a reply is posted to my queue. So late reply :-) No donations page as such bro; I will send my PayPal if you get it working and want to donate :-) Cheers!

criznach’s picture

StatusFileSize
new1.05 KB

Here is my price per role import module. I hope you find it useful.

Chris

SeanA’s picture

Version: 6.x-1.0-rc4 » 6.x-1.x-dev
Status: Active » Needs review
StatusFileSize
new2.07 KB

Thanks criznach and nvl.sateesh for your work on this, it's really nice to have this working.

Here's a patch based on the code in #9. If anyone tries this, please post a review and let us know how it went.