Jump to content

Filter orders by carrier


Doko

Recommended Posts

Is there a way to filter orders in back office by carrier? Something like the payment method filter.

 

Additionally I need to display all orders that are not shipped to a specific country, how do I do it?

 

Afaik there's no built in method, so I'm looking for a module or code modification.

Link to comment
Share on other sites

by default there is no possibility, only with modificaiton of adminOrdersController

 

you can add there id_carier to object definition, effect:

0bN0oN5.png

 

of course instead of id of carrier you can use carrier name or other carrier related field

Link to comment
Share on other sites

Okay, modified the AdminOrderController file. I have added another row ("Carrier"), cleared cache but I can't see the id_carrier row I added. I just probably did something wrong, could you plese take a look? Or maybe there's something else I need to change as well?

 

 

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
),
'id_carrier' => array(
'title' => $this->l('Carrier ID: '),
'width' => 100
),
'payment' => array(
'title' => $this->l('Carrier: '),
'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',
'order_key' => 'osname'
),
'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();
}
Link to comment
Share on other sites

  • 1 year later...

Could you please tell me how to include a column with the carrier name rather than ID? I've had a try but am a bit lost, getting a blank page..

I saw you solved by PM, sorry, I cant see that.

 

Im trying to use an override AdminOrdersController.php

 

Thanks, Nik

I'm using PS 1.5.6. something.

Edited by nikmagnus (see edit history)
  • Like 1
Link to comment
Share on other sites

  • 2 months later...

try with this one: http://pastebin.com/enEpF8BD

Hi Vekia, can you add your code to this for me? I have ps 1.6.1.1

 

Many thanks, Marco your customer for Back office Sticky Notes

 

<?php
/**
* 2013 torcu.com
*
* NOTICE OF LICENSE
*
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* DISCLAIMER
*
* If you wish to customize this module for your needs please
* refer to [email protected] for more information.
*
*  @author    torcu.com <[email protected]>
*  @copyright 2013 torcu.com
*  @license   commercial
*/
 
class AdminOrdersController extends AdminOrdersControllerCore
{
public function setMedia()
{
parent::setMedia();
$this->addJqueryUI('ui.dialog');
}
 
public function __construct()
{
$this->bulk_actions = array(
'StickyLabels' => array('text' => $this->l('Generate Package Labels')),
);
parent::__construct();
}
}
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...