Re: Re: Re: Re: Re: seller address

j0rd's picture
Offline
Getting busy with the Ubercode.
Joined: 07/16/2008
Juice: 452
Re: Re: Re: Re: Re: seller address

from a quick glance at the code "case 'product_node_form':" is missing a "break;" and there's one too many closing brackets.

Change

<?php
         
}
       }
       default:
       ...
?>

to

<?php

         

}
          break;
        default:
        ...
?>

I apologize for the poor cut & paste.

It also appears that since I'm a slacker I didn't post the rest of the code which populates $vendor->default_address. That's done in hook_user which I'll provide here.

<?php
function mymodule_user($op, &$edit, &$account, $category = NULL) {
  global
$base_url;

   switch(

$op) {
      case
'load':
         if(
user_access('act as seller', $account)) {
           
$aid = _uc_addresses_get_default_address_id($account->uid);
           
$address = _uc_addresses_db_get_address($account->uid, $aid);
           
$country_data = uc_get_country_data(array('country_id' => $address->country));
            if(
$country_data) {
               foreach(
$country_data as $cd) {
                 
$address->country_iso_code_2 = $cd['country_iso_code_2'];
                 
$address->country_name = $cd['country_name'];
               }
            }
            else {
              
$address->country_name = t('N/A');
            }
           
$account->default_address = $address;
         }
         break;
   }
}
?>

This hook takes the default address from uc_addresses and loads it into $user->default_address for your "act as seller" users. uc_addresses code there is written against the outdated 5.x-2.0 instead of the latest 5.x-2.1 code, but I assume it should still work.

Ubercart Marketplace - Multiple Seller Support By: Turgrid (102 replies) Fri, 06/27/2008 - 13:35