Jump to content

Recommended Posts

Cela ne le prend pas en override.

Il faut ouvrir le fichier AdminOrdersController.php (dans controllers/admin/)

 

Dans la public function __construct()

je te joint la fonction avec plus d'options (transporteur, id panier, id facture)

public function __construct()
{
 $this->table = 'order';
 $this->className = 'Order';
 $this->lang = false;
 $this->addRowAction('view');
 $this->explicitSelect = true;
 $this->allow_export = true;
 $this->deleted = false;
 $this->context = Context::getContext();
 $this->_select = '
 a.id_currency,
 a.id_order AS id_pdf,
 CONCAT(LEFT(c.`firstname`, 1), \'. \', c.`lastname`) AS `customer`,
 osl.`name` AS `osname`,
 os.`color`,
 IF((SELECT COUNT(so.id_order) FROM `'._DB_PREFIX_.'orders` so WHERE so.id_customer = a.id_customer) > 1, 0, 1) as new';
 $this->_join = '
 LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = a.`id_customer`)
 LEFT JOIN `'._DB_PREFIX_.'order_state` os ON (os.`id_order_state` = a.`current_state`)
 LEFT JOIN `'._DB_PREFIX_.'order_state_lang` osl ON (os.`id_order_state` = osl.`id_order_state` AND osl.`id_lang` = '.(int)$this->context->language->id.')';
 $this->_orderBy = 'id_order';
 $this->_orderWay = 'DESC';
 $statuses_array = array();
 $statuses = OrderState::getOrderStates((int)$this->context->language->id);
 foreach ($statuses as $status)
  $statuses_array[$status['id_order_state']] = $status['name'];
 $this->fields_list = array(
 'id_order' => array(
  'title' => $this->l('ID'),
  'align' => 'center',
  'width' => 25
 ),
 'reference' => array(
  'title' => $this->l('Reference'),
  'align' => 'center',
  'width' => 65
 ),
 'new' => array(
  'title' => $this->l('New'),
  'width' => 25,
  'align' => 'center',
  'type' => 'bool',
  'tmpTableFilter' => true,
  'icon' => array(
   0 => 'blank.gif',
   1 => array(
 'src' => 'note.png',
 'alt' => $this->l('First customer order'),
   )
  ),
  'orderby' => false
 ),
 'customer' => array(
  'title' => $this->l('Customer'),
  'havingFilter' => true,
 ),
 'total_paid_tax_incl' => array(
  'title' => $this->l('Total'),
  'width' => 70,
  'align' => 'right',
  'prefix' => '<b>',
  'suffix' => '</b>',
  'type' => 'price',
  'currency' => true
 ),
 'payment' => array(
  'title' => $this->l('Payment: '),
  'width' => 100
 ),
 'osname' => array(
  'title' => $this->l('Status'),
  'color' => 'color',
  'width' => 280,
  'type' => 'select',
  'list' => $statuses_array,
  'filter_key' => 'os!id_order_state',
  'filter_type' => 'int'
 ),
 'date_add' => array(
  'title' => $this->l('Date'),
  'width' => 130,
  'align' => 'right',
  'type' => 'datetime',
  'filter_key' => 'a!date_add'
 ),
 'id_pdf' => array(
  'title' => $this->l('PDF'),
  'width' => 35,
  'align' => 'center',
  'callback' => 'printPDFIcons',
  'orderby' => false,
  'search' => false,
  'remove_onclick' => true)
 );
 $this->shopLinkType = 'shop';
 $this->shopShareDatas = Shop::SHARE_ORDER;
 if (Tools::isSubmit('id_order'))
 {
  // Save context (in order to apply cart rule)
  $order = new Order((int)Tools::getValue('id_order'));
  if (!Validate::isLoadedObject($order))
   throw new PrestaShopException('Cannot load Order object');
  $this->context->cart = new Cart($order->id_cart);
  $this->context->customer = new Customer($order->id_customer);
 }
 parent::__construct();
}

  • Like 1
Link to comment
Share on other sites

  • 6 months later...

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...