2017-02-17 1 views
2

백 오피스에있을 때 주문을 추가하고 고객을 검색하려고하면 작은 상자에 고객의 주소를 표시하고 싶습니다.Prestashop - 백 오피스 - 추가 주문 표시 주소

function searchCustomers() 
    { 
.......................... 
      html += '<div class="panel-heading">'+this.company+' '+this.firstname+' '+this.lastname; 
      html += '<span class="pull-right">#'+this.id_customer+'</span></div>'; 
      html += '<span>'+this.email+'</span><br/>'; 
      html += '<span>'+this.addresses+'</span><br/>'; 

을하지만 그건 그냥 그래서 난 내가 뭔가를 추가 할 필요가 있다고 생각 "정의되지 않은"으로 표시 : /themes/default/template/controllers/orders/form.tpl에서 AddOrder-Search for Customer screenshot

난이 controllers/admin/AdminCustomersController.php (searchCustomers)하지만 확실하지 않습니다.

누군가 어떤 코드가 누락 되었습니까? 거기 아니라면

내가 데이터를 표시하려면

답변

1

PrestaShop 버전 1.6.1.7을 사용하고, 당신은 데이터를 얻을 필요가있다. 이 경우 this.address는 "존재하지"않기 때문에 undefined를 알립니다.

당신은 당신이 더 많은 단지 라인 $result['addresses'] .= $address['alias'].'<br />';을 변경해야하는 경우/AdminCustomerControllers.php

public function ajaxProcessSearchCustomers() 
    { 
     $searches = explode(' ', Tools::getValue('customer_search')); 
     $customers = array(); 
     $searches = array_unique($searches); 
     foreach ($searches as $search) { 
      if (!empty($search) && $results = Customer::searchByName($search, 50)) { 
       foreach ($results as $result) { 
        if ($result['active']) { 
         $customer = new Customer($result['id_customer']); 
         $addresses = $customer->getAddresses($this->context->language->id); 
         $result['addresses'] = ''; 
         if(is_array($addresses) and !empty($addresses)) 
         { 
          foreach ($addresses as $address) { 
           $result['addresses'] .= $address['alias'].'<br />'; 
          } 
         } 
         $customers[$result['id_customer']] = $result; 
        } 
       } 
      } 
     } 

     if (count($customers)) { 
      $to_return = array(
       'customers' => $customers, 
       'found' => true 
      ); 
     } else { 
      $to_return = array('found' => false); 
     } 

     $this->content = Tools::jsonEncode($to_return); 
    } 

이, 주소 (주소의 별칭을 정의하고 재정/컨트롤러/관리자에서 이것을 사용할 수 있습니다.

올바른 클래스를 설정하고 파일을 삭제하는 것을 잊지 마십시오. cache/class_index.php

+0

고맙습니다! 완벽하게 작동합니다! – qqlaw

관련 문제