Support for Ubercart products
Oliver Coleman - June 19, 2008 - 06:46
| Project: | Node import |
| Version: | HEAD |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
Support file for Ubercart products, see http://www.ubercart.org/contrib/5221 for details.

#1
Hmm, file attachments don't seem to be working. The file is available at the link given in the original issue post.
#2
Since no one at ubercart's forum noticed or found need answering that, maybe someone here might understand the problem better.
I followed all the steps at http://www.ubercart.org/forum/support/4483/importing_new_list_productsprices and what happened is something much like what was once reported in here and here, only that during Field Mapping phase, everything is listed out correctly.
When I hit the Preview page, the only thing listed are the products' name. No price, no SKU, no anything. If I proceed, the node is added, but not as a product. As a matter of fact, when I list Content (admin/content/node), content type is even empty, and Edit returns an error, something like:
warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, '_node_form' was given in \includes\form.inc on line 218.
With the contribution from this page, the results are the same, except that during mapping phase, it says:
user warning: Table 'mydatabase.uc_attributes' doesn't exist query: SELECT aid FROM uc_attributes in C:\Site\includes\database.mysql.inc on line 172.
Anyone can figure out what probably went wrong?
I'm using node_import-5.x-1.6 under ubercart 1.0.
#3
This is because node_import needs a support file to tell it how to import Product node types, which is what this contribution is for.
Was the uc_attributes module enabled? I think this has occurred because the attributes module wasn't installed and so the database tables for attributes weren't created. The support file should check to see if the attributes module is enabled, which I'll make it do now...
#4
A new version (beta 2) is now available at http://www.ubercart.org/contrib/5221 that fixes the "uc_attributes table not found" problem (it now checks to see if uc_attributes is enabled *sheepish grin*).
#5
Which is what I did... or I thought I did.
I probably didn't make myself clear previously. I've got uc_product.inc placed under sites/all/modules/node_import/supported/ubercart. Version using as of now corresponds to you beta3 version. Either on my live site or localhost, the results are the same: mapping is correct, once I reach the preview page (before hitting the nodes to import button), the page's top does state that:
File:
test2.csv (1.01 KB)
File format:
Comma Separated Values (CSV) text file
Type:
Product
which is correct. But underneath it, the list only shows products' names; nothing else.
Needless to say, if I proceed to adding the nodes, only the names show up (admin/content/node shows that Type is empty) and if I try to edit it, the following error occurs:
warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, '_node_form' was given in ...\Site\includes\form.inc on line 218.
A little help to shed some light would be much appreciated.
It was my stupidity that allowed the localhost version not having the uc_attributes module enabled. My bad. Thanks for reminding.
#6
Hmm, are you able to import other node types without problems? Are you using version 1.6 of node_import?
Not sure what would be causing this problem. I put uc_product.inc in node_import/supported/ instead of node_import/supported/ubercart/ , but I don't think that should matter (unless there's the same file name in both and one of which is an old or broken version...)
Can you write a bit of PHP to see what's happening in uc_product.inc or node_import.module?
#7
Oliver,
I'm not sure whether this would be the correct place or not, but would it be easy to add a field for the "shippable" flag, so that we could add a column to the CSV that allowed for (T/F) or (1,0) or something to determine whether the product was shippable or not?
Thanks
#8
Beta 4:
- Added all remaining standard product fields (weight units, length, width, height, dimension units, package quantity, default quantity, ordering, shippable). All are validated.
- Fixed body/description field (wrong node field referenced).
- Changed boolean value validation (for shippable and attribute enable fields), now accepts 1, y, yes, t, true, n, no, f, false (not case sensitive, values yes, true, no, false are translatable).
#9
awesome, will test soon. Thanks so much!
#10
Oliver, are the (package, default) quantities and the list position fields mandatory? It appears as if you are not checking to see if they are actually set first (see lines 144-160). They are throwing three errors that are preventing a successful import. If they need to be set, I will certainly add the correct columns into my csv, but otherwise I think they need to be checked to see if they are set first.
thanks.
#11
Hi Goodeit, this is now fixed in Beta 5, thanks for the feedback. :)
Beta 5 (http://www.ubercart.org/files/uc_product.inc-beta5.tar.gz):
#12
OK, I think I sorted out a few things, but let's get back to your questions/recommendations first:
I haven't tried other node types since I only needed to upload products. And yes, I mentioned in #2 that I am using 1.6.
Not sure exactly what kind of code you think I should write to test this out. :-\
Here is why I found interest in this contribution: with the original ubercart xml import, I would need to write the whole products tree, with codes of each category in mind (hard to remember them all since I've got a lot of them) and the resulting document is far too extended to read and keep track.
With this solution, it would be easy to just grab and paste or type from scratch products' listings from various suppliers, have final retail price calculations within OpenOffice Calc. My idea was to drastically speed up products' information updates to the website to quickly inform my customers of future availability and to meet up suppliers' pre-order deadlines (hope one day there will be support for pre-order stock management situations within ubercart!!! Far too important to be overlooked!).
So basically what thought would be nice is to upload basic information first (title, body, model, cost, sell_price), submit the file with products unpublished and leave out others in blank for later treatment, since there are products of different manufacturers, categories, related series/franchises and images per product.
What wen't wrong with versions beta1 to beta3 was that I never realized that if a field is blank, but in the input form I don't specifically force "Import to field" as , it will generate the blank info I first mentioned. This may sound very noobish from the source code writer or seasoned drupal user's point of view (I'm still relatively new to drupal/ubercart, and that's why my site is not yet ready for general public viewing ;)), but I didn't find documentation regarding this, so I caused the error to happen.
Beginning beta4 this issue was solved. node_import prevented an upload if 'shippable' is not present, but some of the fields are absent in my cvs and the script didn't find bark (what's 'type', if I don't have product classes and during 1st stage of import I already chose type as 'Product'?), which leads me to ask the following: which fields are absolutely mandatory for everything to work sharp?
I ask this because currently the troubles I found are:
* once upload is complete, product is orphaned. Once edited the remaining fields and publish it, it's not orphaned anymore but...;
* ...search form can't find uploaded products (!), but the node exists and listed in /admin/content/node and /tracker. What went wrong? Simple: search module needs to reindex the newly imported items, so it will take time (either reindex and/or run cron);
Unsolved issues:
* how to successfully upload a batch of products with different manufacturers, different custom category fields (I have manufacturers and series)?
* I have CKK Date fields for pre-order deadline and estimated arrival week, separated by drop-down lists for each day/month/year. How should I input this in the CVS?
Sorry for the long post, I hope I've cleared out some of my troubles and have this served as a reference for other users that might come across anything similar to what happened to me. All there's left to say is that this contribution is really really in the right path! Congrats!
#13
Nakano,
Are you still having the issue where only the title seems to be imported? There was a bug which prevented the body/description from being imported which is fixed in the latest version. If this is still happening with the latest version can you please try importing a standard node type like a Page?
You might need to assign a category/term that belongs to the vocab used by ubercart, either with a mapping from a column in the CSV file or using the generic node import options page.
Is the manufacturers field provided by another module? It doesn't seem to be standard with UC.
I'm not sure what format CCK Date fields should be in, perhaps there's some documentation for it in the node_import documentation (I don't know what documentation exists for node_import, if any). Have you tried some obvious formats like 1/2/2008, 01/02/2008 or 20080201?
#14
Oliver,
b5 is working great! One thing I have noticed while doing imports (and I'm thinking its more of a node_import or cck imagefield patch problem) is that when there are images in the import, the description does not show in the preview. Everything gets imported just fine though, so it doesn't really matter.
thanks!
#15
When trying to add a product to shopping cart by clicking "add to cart" button you receive a WSOD (white screen of death): http://hera.progenealogists.com/TESTimmigration.htm
The drupal admin log confirms the following:
Cannot modify header information - headers already sent by (output started at /home/progen/public_html/sites/all/themes/progenealogists/template.php:2) in /home/progen/public_html/includes/common.inc on line 319.
PHP 5
Drupal 6.8
MySQL 5
I attempted to locate where header information is being sent prior to the call of uc_product_add_to_cart_form_submit function in the uc_product.module file. I had no success in doing so. Any help would be appreciated.
Thanks.
#16
Surely this blatant thread hijacking was a mistake? :P
#17
No one using Ubercart 2.x and Drupal 6.x??
Thanks!
#18
I'm am successfully importing products.
The only issues i have:
1. Stock
2. Attributes/options (inc. custom pricing)
Besides that - import is nice and smooth (mostly...)
#19
Subscribing, interested in Ubercart 2/D6 node import also. greetings, Martijn
#20
I had no problem with importing 200 products using ubercart2/D6.13. The only errors I got --- mb_strlen() errors --- were eliminated by taking out the ">>" for category hierarchy. http://drupal.org/node/383926#comment-1827462
My problem is how to update all these products in the future. http://drupal.org/node/410770
#21
Can you post a sample of your csv for us to look at? I am having an issue with the import where it will not import more than one line of products. I have posted here: http://drupal.org/node/534044
Thx,
Z
#22
Here's my CSV. http://www.box.net/shared/qv9o9860ki