Currently, attribute options support adjusting "Cost", "Price", and "Weight".

Our company sells products with various sizes. Some of these sizes require multiple packages to ship. Therefore, we need to be able to adjust the package quantity for accurate shipping quotes for attribute options.

Comments

tr’s picture

Category: bug » feature
philbar’s picture

Title: Adjust Package Quantity in Attribute Options » Adjust Package Quantity and Size in Attribute Options

I guess I will start working on adding this:

Added the following to uc_attribute.install in the $schema['uc_attribute_options'] = array

      'length' => array(
        'description' => t('The adjustment to physical length of the product or its packaging.'),
        'type' => 'float',
        'not null' => TRUE,
        'default' => 0.0,
      ),
      'width' => array(
        'description' => t('The adjustment to physical width of the product or its packaging.'),
        'type' => 'float',
        'not null' => TRUE,
        'default' => 0.0,
      ),
      'height' => array(
        'description' => t('The adjustment to physical height of the product or its packaging.'),
        'type' => 'float',
        'not null' => TRUE,
        'default' => 0.0,
      ),
      'pkg_qty' => array(
        'description' => t('The adjustment to the number of this product that fit in one package.'),
        'type' => 'int',
        'size' => 'small',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),

Now on to uc_attribute.module and uc_attribute.admin.inc

philbar’s picture

Added the following to function uc_attribute_option_form($form_state, $attribute, $option = NULL) of uc_attribute.admin.inc:

  $form['adjustments']['weight'] = array(
    '#type' => 'textfield',
    '#title' => t('Weight'),
    '#default_value' => $option->weight,
    '#weight' => 3,
  );
    $form['adjustments']['length'] = array(
    '#type' => 'textfield',
    '#title' => t('Length'),
    '#default_value' => $option->length,
    '#weight' => 4,
  );
    $form['adjustments']['width'] = array(
    '#type' => 'textfield',
    '#title' => t('Width'),
    '#default_value' => $option->width,
    '#weight' => 5,
  );
    $form['adjustments']['height'] = array(
    '#type' => 'textfield',
    '#title' => t('Height'),
    '#default_value' => $option->height,
    '#weight' => 6,
  );
    $form['adjustments']['pkg_qty'] = array(
    '#type' => 'textfield',
    '#title' => t('Package Quantity'),
    '#default_value' => $option->pkg_qty,
    '#weight' => 7,
  );
philbar’s picture

Ok, I've given up on trying to code this.

Instead, I created the following work around:

Items that ship in multiple packages...

  1. Create a "Product" for each package
  2. Create a "Product Kit" for the complete product which includes the "Product" for each package

If you don't want people buying the packages individually, you can hide the newly created "Products" by using the Private module. This will hide the "Product" node from users, preventing them from adding it to the cart individually, but will still allow the "Product" to be added to the cart when it is included in the "Product Kit".

This work around will allow shipping rates to be calculated accurately based on package quantity, size, and weight.

philbar’s picture

Status: Active » Postponed

This functionality seems to be dependent on #802372: Allow Products to have Multiple Packages

Once that gets closed, then the same functionality can be added to the option adjustments.

tr’s picture

Version: 6.x-2.2 » 7.x-3.x-dev

New features should go into 7.x-3.x first.