I wrote an uc_stock implementation.

Can be used to update the ubercart stock from an csv specifying the sku and the stock level. The script resolves skus to node id and updates the stock table, if uc_attributes is enabled it will also search for skus in the attributes table.

It's usable right now i can add more options if requested.

It will be great to include-it in the main distribution.

CommentFileSizeAuthor
uc_stock.inc_.txt5.3 KBjoanpc
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

smscotten’s picture

Version: 6.x-1.0-rc4 » 6.x-1.0

This would be awesome, but I'm not seeing it work against 6.x-1.0... or maybe I'm doing it wrong? I put the uc_stock.inc file in the 'node_import/supported/' directory and I don't see stock showing up as an option for mapping to a column in the import at step 4.

Am I looking in the wrong place or adding the file in the wrong place?

Edit to add: yes, I was looking in the wrong place.

OK, I see it in step 6: track stock, yes or no. But how do I tell it which column in the import it should look at for stock?

smscotten’s picture

Status: Needs review » Needs work

OK, I see my issue. Around line 104 of this file is the following:

/*
 * Implementation of hook_node_import_fields().
 */
function uc_stock_node_import_fields($type) {
  $fields = array();

  if ($type == 'uc_stock') {

but $type is never uc_stock. It's always "node:xxxx" where xxxx is the machine readable name of the the content type.

For the time being I'm going to comment out that requirement and play some more but could you shed some light on what that is supposed to be checking?

zeezhao’s picture

Also see latest version of node_import for ubercart referenced on this thread:
http://www.ubercart.org/project/node_import_uc_stock?page=1#comment-58097

joanpc’s picture

Sorry for the long delay I wasn't subscribed to the issue.

I think i misunderstood the hook_node_import_fields() I was just checking that the current user can modify the stock.