This is more of an advanced topic, but I'll give you the overview. It's going to require for you to do some custom programming and reading some documentation.
uc_addresses allows you to associate multiple addresses with any particular user. Sellers in uc_marketplace are "users", so we can use uc_addresses to store multiple addresses for your sellers.
When you create a product in Ubercart there's an area which allows you to enter a different address where that item will ship from instead of your stores default shipping address. I personally only pull in their default address from uc_addresses.
What I've done, is use hook_form_alter (see drupal api docs) to modify the product add/edit form (form_id product_node_form) to include the additional addresses associated with the user from uc_addresses into the shipping addresses drop down.
Here's the snippet
<?php
function mymodule_form_alter($form_id, &$form) {
switch($form_id) {
case 'product_node_form':
$node = $form['#node'];
$vendor = user_load(array('uid' => $node->uid));
//dpm(array("VENDOR" => $vendor));
if(empty($node->nid)) {
# NEW Product
//dpm(array("BEFORE" => $form['shipping']['default_address']));
$form['shipping']['default_address']['first_name']['#default_value'] = $vendor->default_address->first_name;
$form['shipping']['default_address']['last_name']['#default_value'] = $vendor->default_address->last_name;
$form['shipping']['default_address']['company']['#default_value'] = $vendor->default_address->company;
$form['shipping']['default_address']['street1']['#default_value'] = $vendor->default_address->street1;
$form['shipping']['default_address']['street2']['#default_value'] = $vendor->default_address->street2;
$form['shipping']['default_address']['city']['#default_value'] = $vendor->default_address->city;
$form['shipping']['default_address']['postal_code']['#default_value'] = $vendor->default_address->postal_code;
}
else {
# Editing a product
}
# I use this to require proper fields get entered, if they want to use a different address
foreach(array('first_name', 'last_name', 'phone', 'company', 'street1', 'street2', 'city', 'zone', 'postal_code', 'country') as $field) {
$form['shipping']['default_address'][$field]['#required'] = uc_address_field_required($field);
}
}
default:
//dpm(array("FORM_ID" => $form_id));
break;
}
}
?>Can't confirm the code will work 100% because it's cut and paste, but should give you a general idea of the direction you should be heading.
