Jump to content

Get shipping address from backoffice module


dhurley

Recommended Posts

Don't know of a built-in method  but you could include a simple function like following in your module's class. Better practice would be to use sql join in one single query to return just the single value you wish but i thought maybe it's more widely useful demonstrating all the data that can be retrieved within an array.

//a function that returns all order data in the $orderdata array. Debug the array to see how you canretrieve the field you are interested in. For example to retrieve delivery address1 use getOrderData($orderid)['address1'];  ($orderid is the id of your order)


private function getOrderData($orderid){
            
        $sql='SELECT * FROM '._DB_PREFIX_.'orders o WHERE `id_order`='.(int)$orderid;//$orderid is the id of your order
      
        
        $result = Db::getInstance()->ExecuteS($sql);
       if($result){
      foreach ($result as $row){
         foreach ($row as $key=>$value){
          $data[$key]=$value;
            }
         }  
     
      }
     
    
      
      $query='SELECT * FROM `'._DB_PREFIX_.'address` WHERE `id_address`='.(int)$data["id_address_delivery"];
      $result = Db::getInstance()->ExecuteS($query);
    if($result){
      foreach($result as $row){
           foreach ($row as $key=>$value){
      $orderData[$key]=$value;
           }
      }
}
      
      return $orderData;
     
        } 
Link to comment
Share on other sites

Hi dhurley,

 

I want to create a simple module to add some information on the order page in the back office.

 

I don't know how to start and I would save a lot of time with your module

 

Could you gave me the structure of your module please? I can edit your shipping address and put the information I need.

 

Thank you in advance.

 

Regards.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...