Is this going to be ported to D7?

Thanks

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rfay’s picture

Title: D7 » Drupal 7 Port
Status: Active » Needs review
FileSize
1.58 KB
10.19 KB

Here's a first "Works for me" port. I doubt it does the uc_attribute (options?) stuff right. I'm just delighted to be able to import a store so we can try out commerce_migrate_ubercart on it.

I've attached both the patch against current master branch and the module as a tarball.

Poieo’s picture

Status: Needs review » Needs work

Thanks for your work on this rfay. However, it doesn't seem to work with the alpha4 version of feeds.

Tested your version on clean D7/Ubercart install and an attempt to import returns the following:

An AJAX HTTP error occurred. HTTP Result Code: 500 Debugging information follows. Path: /batch?id=29&op=do StatusText: Internal Server Error ResponseText: 

This error occurs for any csv import using feeds as long as uc_feeds is enabled. Disable the module, import works great. Enable the module, and no imports work regardless of whether you're importing product info.

I know this isn't your module, but any help would be appreciated as this module appears to be pretty much abandoned.

rfay’s picture

I used it quite successfully for an import (with attributes turned off)

Poieo’s picture

Yes, you're right. It works just fine as long as the attributes module is disabled. Thanks!

Lirkun’s picture

FileSize
92.37 KB
57.49 KB

Thanks for module, rfay. It looks to work fine (I see new TARGET fields for UC in mapping menu). But I can't import new products, because of "Cannot acquire lock for source Product / 0." error. (screen shot is attached).

I'm using such settings:

UC Attributes turned off
Attach to content type -> use standalone form (tried "Product" didn't help)
Import on submission -> checked
CSV parser & File Upload
Mapping is attached as a screen shot.

I'm using Google docs to create CSV file (also tried Excel).

May be I need to add some Mapping TARGET fields?

Please help.

PI_Ron’s picture

This worked great for me, thanks.

Initially I was giving myself a headached by trying to make the csv tab delimited, because I thought some of my category fields would create new columns (terms seperated by commas). In the end I just pressed the big red button with a Google Docs generated .csv without worrying about tabs and the computer said YES!

Lirkun’s picture

Problem is solved.
I just had a second importer that had a Attach to content type -> product. That's why the right importer with Attach to content type->stand along form couldn't import products.

I also tried this http://drupal.org/node/1100528 patch to add Dimensions and it works perfect.

Thanks for module, I hope there will be an official release soon.

bigals’s picture

I found the attached on the drupal site and made a change for how the sql works in 7.x . The code is a little repetitive (hey I was in a hurry!) but it gets the job done for me at least! Good luck. There is another topic here: http://drupal.org/node/768528#comment-4804890 .

rfay’s picture

@alansroe it would be nice of you to say where #8 comes from. And how it relates to #1, which is what's currently under consideration here. It would also be nice of you to provide it as a patch.

bensey’s picture

#1 worked for me until I added an uc weight unit column to my CSV, or maybe it just stopped working for some other reason. Wouldn't be the first time I've had feeds problems that I can't figure out what has changed between imports...

#8 seemed to fix this whatever the issue was. Thanks guys!

Quarantine’s picture

Subscribing.

patrick.thurmond@gmail.com’s picture

Status: Needs work » Needs review
FileSize
9.59 KB

Just for grins, here is a version with all the above combined and the code cleaned up a bit (removed commented out code, consistently uses spaces as tabs now, cleaner in general). It looks like the very first function in the end will have to be changed to include three inputs (based on the feeds D7 mappers that come with the base module). I am not going to worry about it now. It works and that is what I care about.

- Patrick

christelle41’s picture

The module worked for me but with bugs everytime I create one new node even if it's not a product node. I have the following error message :

Notice : Undefined property: stdClass::$attributes dans uc_feeds_node_insert() (ligne 249 dans /myserverpath/sites/all/modules/uc_feeds/uc_feeds.module).
Warning : Invalid argument supplied for foreach() dans uc_feeds_node_insert() (ligne 249 dans /myserverpath/sites/all/modules/uc_feeds/uc_feeds.module).

sdfoui’s picture

how can we add the stock and the threshold ?

asimon’s picture

I recommend just using a cron hook for stock to read a file with stock info periodically and update the uc_producs_stock table.

goodeit’s picture

FileSize
1.54 KB

I have fixed attributes and removed unnecessary code in #12.

Useful information:

  • Column headers must not have spaces!
  • You must have either a weight or price field set up in admin/structure/feeds/edit/your_importer/mapping for each option you want to be able to import.
  • To activate an option on a product, you must enter a number in the weight or price field (or both; 0 works) for that option. If you leave the weight and price cells empty, that option will not be activated. If all cells for all options of a particular attribute are left blank, that attribute will not be applied to the product.

Please test and review this code and let me know if you find any bugs.

bevenson’s picture

Thank you to all on this thread. I am an amateur coder, so this is much appreciated.

I have one more thing to ask. Starting from #16 uc_feeds, how can I integrate role-based pricing?

Here is a patch from D6 http://drupal.org/files/uc_feeds_price_per_role.patch

Any help will be appreciated, and I will test immediately.

rfay’s picture

@goodeit why don't you request commit privileges for this module? It seems like you're the one to take it forward. In the meantime, you might consider putting your code in a sandbox.

goodeit’s picture

@rfay I'll look into applying, thanks. As it is my first time using a Sandbox (or git for that matter), please bear with me while I get the hang of all this. My uc_feeds d7 sandbox project is at http://drupal.org/sandbox/goodeit/1413664, but I hope that's just temporary until I can get it committed as a D7 release of this module.

Rar9’s picture

D7 UB Rc4 not working anymore..
Getting an error when creating new content.

• Notice: Undefined property: stdClass::$attributes in uc_feeds_node_insert() (Zeile 237 von ...../www/drupal/sites/all/modules/ubercart/uc_feeds/uc_feeds.module).
• Warning: Invalid argument supplied for foreach() in uc_feeds_node_insert() (Zeile 237 von ...../www/drupal/sites/all/modules/ubercart/uc_feeds/uc_feeds.module).

christelle41’s picture

Is it a fatal error ? Are your nodes created or not ? Thank you for your reply.

Anonymous’s picture

Hi, I need help. I've got a server failing with an archaic db which I'm porting over to a new site and need to import products. I've got latest drupal 7, uc 3, feeds, uc_feeds. Just mapping product fields: GUID, Title, Description, UC: Model/SKU, UC: Sell price.

And, get this:
Recoverable fatal error: Object of class stdClass could not be converted to string in DatabaseStatementBase->execute() (line 2139 of xxx/includes/database/database.inc).

Thanks.

goodeit’s picture

@Rar9: Thanks for the heads up. A fix has been pushed to my sandbox (http://drupal.org/sandbox/goodeit/1413664). A direct link to the most recent version is http://drupalcode.org/sandbox/goodeit/1413664.git/blob_plain/HEAD:/uc_fe...

@theitgirl: I haven't done any testing on importing GUIDs, so I'm not sure if the code for that is even correct for D7. Can you try to import the products without it and see if that works?

Anonymous’s picture

Thanks @goodeit! It did complain the that guid was required (feeds). I've got everything working except the stock updates! I really could a solution right now for drupal 7 uc 3. I've got Power Product Tools setting my stock (active, stock & threshold) setting my initial import to '1'. Looking just to update stock. (20,000 plus records to update.) (I've tried to implement the 6x uc feed map stock_level code but, haven't been successful.)

Masala’s picture

Thanks for the code. The latest version works fine for adding products.
I am try update products, new cards are added / duplicated each import. Unable to import by a unique sku, there is no unique checkbox.
I added the line
'optional_unique' => TRUE, after the 'description' => 'Ubercart:'. t ('Model / SKU'),
and received the checkbox.
But it does not work, cards also continue adds each import.

I use a different set of import / update, and each creates its own set of goods. In the redistribution of one set for the import update occurs, for example, the GUID and new items are added.

What can you invent to make the update records in such a situation? Thanks in advance! ver.7.x

Udzzis’s picture

For those who concerned about a "Notice: Undefined property: stdClass::$attributes in uc_feeds_node_insert()":
I got rid of it by changing first line of function "uc_feeds_node_insert()" from
if (uc_product_is_product($node) && module_exists("uc_attribute")) {
to
if (uc_product_is_product($node) && module_exists("uc_attribute") && isset($node->attributes)) {

zeezhao’s picture

Title: Drupal 7 Port » Drupal 7 Port of uc_feeds

In reference to #25, please were you able to resolve using SKU as unique field?

Masala’s picture

#27
I added the line
'optional_unique' => TRUE, after the 'description' => 'Ubercart:'. t ('Model / SKU'),
and received a check box "SKU as unique field", but I know that's not enough, so it will not work.

I also noticed a controversial work of imports by a unique field.
If you make two import sets and assign unique field "GUID", entries will be double. If different sets of import to use a unique field "title" it will be really unique! But this is just a bug.

and in addition, I install the FEEDS DEV version, and now the price is not imported.
import error
SQLSTATE[HY000]: General error: 1366 Incorrect decimal value: '' for column 'list_price' at row 1
I try this version because it has patches of unique fields , terms and stuff.

zeezhao’s picture

I am using feeds dev version of 2012-03-01 with uc_feeds from #16 above, and I can import prices. Make sure data in your csv file is okay.

midoriconcept’s picture

HI sorry, but I am a seriously a newbie on the matter.
How can I install this .module file in Drupal.
I read I should use the patch unix executable, but on which file? I am using the file from post 16.

Thanks

Masala’s picture

Many thanks zeezhao, I figured. This is due to the fact, in dev that only the first four columns in the CSV file can pass values ​​to the additional modules. 4 is not bad. I have tried many different variations of imports. Imports usually than not.

midoriconcept I use a # 8 module and the code in the sandbox.
see http://www.ubercart.org/comment/67624

zeezhao’s picture

Please has anyone done a patch for "file download" products? e.g. software or music tracks

Masala’s picture

#23 works great
Thanks goodeit for the code!
I tested it many times, everything works as expected. Is it possible to magically programing a unique SKU code? It would be great if the opportunity was. Please, this is a very necessary thing.

rafaeldwan’s picture

Here's a link to a working module file: http://www.ubercart.org/files/uc_feeds_7x.zip

noizo’s picture

Thanks for that!

InvDeath’s picture

I'd like to add Stock field in this list. How can I do this?

goodale’s picture

@rafaeldwan is this based upon @goodeit's work, or a separate port?

goodeit’s picture

@goodale: The code $rafaeldwan posted is the same as the module as I posted, with the addition of a "UC: Name" field, which just maps to $node->Name (I'm not sure what that is for, or if that even exists).

@Masala: Are you referring to unique SKUs generated based on combinations of attributes or just on a the base node? If you're talking about the base SKU, you can easily generate it during import by using hook_feeds_after_parse() (see https://drupal.org/node/1360518 for more info). If you want to generate unique attribute SKUs, I actually implemented that privately and have been testing it. Unfortunately, it requires you to define the partial SKU of each option available on the product which is why I have not yet released it.

I have also developed a module that provides an Action (usable in views bulk operations) which automatically generates unique attribute SKUs using the names of the options. If enough people are interested in this I'll try to get the time to create a project for it.

@InvDeath: add 'stock' to the targets array in uc_feeds_feeds_processor_targets_alter(), then in uc_feeds_set_target() you'd have to figure out the appropriate node field to save it into. You may have to store it in the node temporarily and then actually put it in the db inside uc_feeds_node_insert(); I'm not sure offhand.

InvDeath’s picture

http://code.google.com/p/uc-feeds-7-ext/
I've added the ability to import in uc_price_per_role ( http://drupal.org/project/uc_price_per_role )

@bevenson, I didn't see your pach... wasted time(

--
upd: added Stock field

tchurch’s picture

I would like to consider using this for a possible customer site. Can we get an official dev version for Drupal 7 from here? It would keep better track of changes.

thatjustin’s picture

+1 Would install again. (That's also my vote for committing the code to a release.)

Thanks everyone who worked on this.

dogosoft’s picture

# 34 works perfectly, my problem is that the files are downloadable, use uc_file Why are not increasing the module for this option? very poor job of code: (, you can help to improve this function by adding uc_feeds
Thanks in advance and best regards

Luciuz’s picture

@goodeit
What hook or method in callback should i use to prevent generation new nodes for existing SKU?
Is it possible to replace new node obj by existing node or somthing?

Dubs’s picture

Thanks for your work on this. I'll make a D7 branch next week.

Dubs’s picture

Released as a 7.x version. Thanks so much to everyone who helped release this version.

Dubs’s picture

Status: Needs review » Closed (fixed)
Anandyrh’s picture

Status: Closed (fixed) » Active

I am sorry to switch this topic ON again.

Am looking for a mapping on file download field (uc_file) option. Could any of you please recommend a solution for importing the uc_file names using CSV?

Thanks in advance,
AnAnD

Dubs’s picture

Please can you re-open as a new issue as the port to D7 is done, and the functionality is additional to the D6 and D7 functionality provided so far. I will try to look at it this week but I am super busy. It's not too difficult to add to the code actually so if you can figure it out and add a patch I could certainly commit it.

Dubs’s picture

Status: Active » Closed (fixed)
Anandyrh’s picture

Thanks a lot Dubs,

I have opened a new ticket here: http://drupal.org/node/1894212

but please forgive me for my bad PHP knowledge.

Thanks,
Anand