By larrynichols on
I'm interested in paying someone to write a product import module for e-commerce in Drupal 5.0. It's for a book store, and we'd also need the ability to upload images (or rather a file reference to an image on the server) and taxonomies for the books. The developers of the E-Commerce set of modules have consistently placed a pretty low priority on a product import function (though it seems so fundamental to any shopping cart system) so we're finally just looking to have someone build it for us. Thanks.
Comments
Import from what type?
You want to be able to import from a comma delimited file type? I guess you want to upload an Excel spreadsheet in a certain format, and have each row of the spreadsheet converted into a product?
I'm certainly willing to take a look at the feasibility of this, I'll need to look into the E-commerce product API and see how difficult this would be.
You can get in touch with me via my contact form if you like.
Dave
Don't be surprised to have
Don't be surprised to have to pay for this, open source is a scratch your own itch world. Why would the core Ecommerce developers want to do this without some sort of financial incentive? That said, if you're willing to help fund this I'm sure that they'd be willing to give a bit of direction for the hired developer.
Check out Node Import (http://drupal.org/project/node_import) as it does what you want for normal nodes, cck, events and more. At my first glance the best way to go about getting import/export working would be to extend and upgrade this module, although I haven't looked into the technical side of this. Good luck with this... my work might have a similar need in an upcoming project so I'll let you know if anything happens on this front.
-------------------------------------------------------------------
Rick Vugteveen | Image X Media (work) | Blog (personal)
-------------------------------------------------------------------
Rick Vugteveen |rickvug.com @rickvug on Twitter
I think we're going to hold
I think we're going to hold off until E-Commerce for 5.0 is released. But I'm still a little surprised at the lack of this feature so far, mainly because I remember some of the developers insisting after the last release that it would be in the next. Without it, it's hard to imagine who'd have much use for these modules other than companies that just started out yesterday. It seems less like, say, the difference between power windows and regular windows and more like the difference between having doors or not, or having four wheels as opposed to three. Of course if if the car is being given away for free one can build it anyway one wants, but one can expect a few surprised looks. :)
the latest node_import seems to do this...
I only just downloaded it so don't know how well it works, but the node_import module files for 5.x contain a directory for ecommerce a with a readme and an include file that allows you to import tangible products and instructions on how to import other extended product types you might have created yourself.
www.indytech.ie
A Pint of Drupal
import products/items
I'm willing to throw some cash this way too! I have a small inventory (109 items as of today) and even that small amount would be a major headache to recreate within drupal ecommerce without some sort of import. I looked into all the databases, and tried finding where all the data was stored. The only tables i could find with product info were "ec_product" and "node_revisions". I added my products to the two tables, but only four of the 109 items were visible. Is any progress being made on this front?
I just got my feet wet in
I just got my feet wet in node_import (and I used to play with ecommerce) so you may keep me in mind as a potential developer. I am in the First World, though :)
Data Storage
It's always tricky to muck about with the database directly, but do be aware that each item has to have an entry in the 'node' table with nid and vid matching those in ec_product and node_revisions. In this case you'll want to give it a type='product' (or whatever your product type is called) and status=1 also.
The most reliable way to create a node is to let Drupal do it for you: assemble the node structure and use the node_save() function to run through all of Drupal's little hoops and set all the flanges. See http://groups.drupal.org/node/2197#comment-11129 for an example of this - if it seems daunting that's because it is ;)
++Andy
import
I just put together a very simple product import solution based on import_image. It's far from perfect, but it does allow you to do bulk product imports based on a gallery of images. import_image loads the images as nodes, and with this mod you now have the option to get them added as products. You'll still have to go in and manually edit the prices, but it might save some time.
to import_image.module, added this around line 80:
if (module_exists('product')) {
$form['type'] = array('#type' => 'value', '#value' => 'image');
$form['#node'] = new stdClass();
$form['#node']->type = 'image';
product_form_alter('image_node_form', $form);
unset($form['type']);
unset($form['#node']);
}
and this around like 205 (after the "if ($node)"):
if ($form_values['ptype'] != '0') {
$node->ptype = $form_values['ptype'];
product_save($node);
}
Maybe this helps someone else.
"Quick 'n' Dirty' bulk import....
I had 520 products to add and couldn't figure out a way to do it....
I looked at hacking each table but that seemed doomed to failure with 10+ cross references to screw up.
In the end I put all my product data into a new table - copied the source from the 'add content' page for my product type and then got PHP to auto-fill each field from my new table on load - setting a flag to say which had been done. I set the page to auto-submit using a javascript onload() event. On the page that's displayed after the product's added (page.tpl.php) in a default setup I set a temporary refresh back to my hacked add content page.
For some reason it didn't quite behave as I'd hoped - the hacked page would submit - but then the 'proper' add content page would display with all the data I was trying to add and I'd have to click the submit button manually. After hacking node.module to leave off the 'preview' button (it shared the same name as the submit button) I inserted another javascript onload event to simulate a clicked submit button as submit() wouldn't work for some reason.
I end up watching the three pages pass data from one to another and within 30 minutes I had added 520 products whilst eating my lunch.
The only drawback is that I couldn't automatically load the pictures as it's not possible to pre-configure the file upload field due to security constraints.
Does that make sense?