Trying to get length, width, height and length units into my feed and strangely adding the following to uc_feeds_feeds_node_processor_targets_alter:

		// Dims
		$targets['length'] = array(
			'name' => t('UC: Length'),
			'callback' => 'uc_feeds_feeds_set_target',
			'description' => 'Ubercart:'. t('Length'),
		);
		$targets['width'] = array(
			'name' => t('UC: Width'),
			'callback' => 'uc_feeds_feeds_set_target',
			'description' => 'Ubercart:'. t('Width'),
		);
		$targets['height'] = array(
			'name' => t('UC: Height'),
			'callback' => 'uc_feeds_feeds_set_target',
			'description' => 'Ubercart:'. t('Height'),
		);
		$targets['length_units'] = array(
			'name' => t('UC: Dimension Units'),
			'callback' => 'uc_feeds_feeds_set_target',
			'description' => 'Ubercart:'. t('Dimension Units'),
		);

Doesn't do the trick. Is there some other magic I'm missing? Thanks!

Mike

CommentFileSizeAuthor
#1 uc_feeds.dims_.patch1.46 KBmpaler

Comments

mpaler’s picture

Status: Active » Needs review
StatusFileSize
new1.46 KB

The reason is because the node object identifiers for dimensions differ from database ids...eg:

Node = $node->dim_length, $node->dim_width, $node->dim_height
Db = length, width, height

Attached is a patch that solves this problem.

dariusj18’s picture

So #1 I am confused by this patch. Does this mean that to make it import the dimensions we don't need to modify the "INSERT INTO {uc_product_options}" query To add the dimension fields to it?

tommeir’s picture

Title: Length, width, height? » Length, width, height, default & package qty

here is another product settings I used for my import, thought sharing it...

		$targets['pkg_qty'] = array(
			'name' => t('UC: pkg_qty'),
			'callback' => 'uc_feeds_feeds_set_target',
			'description' => 'Ubercart:'. t('Package Quantity'),
		);
		$targets['default_qty'] = array(
			'name' => t('UC: default_qty'),
			'callback' => 'uc_feeds_feeds_set_target',
			'description' => 'Ubercart:'. t('Default Quantity to add to cart'),
		);
dimitriseng’s picture

Hi, I have tested all the above and it all works as expected.

Please see also issue #1031700: Stock Levels. The patch at #9 of that issue adds the stock functionality but also makes a few modifications to the code that are not compatible with the above solutions. Please see my comment #12 at that issue, hopefully all of this functionality can be commited in a uniform way, thanks.

vin247’s picture

this is just what I needed, thanks!!

Robin Millette’s picture

Assigned: Unassigned » Robin Millette

I'm working on fitting this patch with #1031700: Stock Levels with a new dev release out soon.

dubs’s picture

Status: Needs review » Closed (fixed)

Patched...

proxima8’s picture

Issue summary: View changes

#1 patch works in 7.x but you need to rename callback method from "uc_feeds_feeds_set_target" to "uc_feeds_set_target".
Like this:

    // Dims
    $targets['length'] = array(
      'name' => t('UC: Length'),
      'callback' => 'uc_feeds_set_target',
      'description' => 'Ubercart:'. t('Length'),
    );
    $targets['width'] = array(
      'name' => t('UC: Width'),
      'callback' => 'uc_feeds_set_target',
      'description' => 'Ubercart:'. t('Width'),
    );
    $targets['height'] = array(
      'name' => t('UC: Height'),
      'callback' => 'uc_feeds_set_target',
      'description' => 'Ubercart:'. t('Height'),
    );
    $targets['length_units'] = array(
      'name' => t('UC: Dimension Units'),
      'callback' => 'uc_feeds_set_target',
      'description' => 'Ubercart:'. t('Dimension Units'),
    );