如何获得送货地址prestashop

时间:2016-03-01 17:31:50

标签: arrays prestashop

我创建了一个带有两种送货方式的运营商模块,我有一个功能来获取订单运费,这里我想获得一系列送货地址来验证邮政编码,

这里的代码我试试,

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="searchStudentResults" cssClass="table table-hover" AllowSorting="True" OnRowUpdated="GridView1_RowUpdated1" >
             <Columns>

                 <asp:BoundField DataField="StudentNo" HeaderText="StudentNo" SortExpression="StudentNo" ReadOnly="true" />
                 <asp:BoundField DataField="ExamMark" HeaderText="Exam %" SortExpression="ExamMark" />
                 <asp:BoundField DataField="AssignmentMark" HeaderText="Assignment %" SortExpression="AssignmentMark" />
                 <asp:BoundField DataField="ModuleMarks" SortExpression="ModuleMarks" HeaderText="ModuleMarks" ReadOnly="true" DataFormatString="{0:0}"  />
                 <asp:CommandField ShowEditButton="True" ButtonType="Button" EditText="Add Marks"  ControlStyle-CssClass="btn btn-primary" ItemStyle-Width="100px" >
                <ControlStyle CssClass="btn btn-primary"></ControlStyle>

                <ItemStyle Width="100px"></ItemStyle>
                 </asp:CommandField>
                 <asp:BoundField DataField="MarkID" ControlStyle-CssClass="hidden" ItemStyle-CssClass="hidden" HeaderStyle-CssClass="hidden"  >  
                <ControlStyle CssClass="hidden"></ControlStyle>
                <HeaderStyle CssClass="hidden"></HeaderStyle>
                <ItemStyle CssClass="hidden"></ItemStyle>
                 </asp:BoundField>
             </Columns>
             <EmptyDataTemplate>
                 No marks to enter
             </EmptyDataTemplate>
         </asp:GridView>

在debbug中运行我的商店,向我展示public function getOrderShippingCost($params, $shipping_cost, $package = array()) { $postal_code = $package['destination']['postcode']; $country = $package['destination']['country']; $contents_cost = $package['contents_cost']; } 目的地和contents_cost。

如何获得所有送货地址值?

1 个答案:

答案 0 :(得分:0)

您可以使用以下方法获取送货地址:

public function loadReceiverAddress($cart) // Cart or order object
 {

  $address = new Address($cart->id_address_delivery);
  $city = $address->city;
  $zip = $address->postcode;
  $country = $address->country;
  $state = State::getNameById($address->id_state);
  $street_no=$address->address1;

  return array($city,$zip,$country,$state,$street_no);
 }

当您想通过购物车或订单对象获取送货地址时,可以调用此方法,这是一个使用示例:

// Create a new Order Object with order id    
$order = new Order((int)Tools::getValue('id_order'));

// Get delivery address details 
list($firstname,$lastname,$company,$phone_mobile,$city,$zip,$country,$state,$street_no,$email)=$this->loadReceiverAddress($order,true);