Jump to content

1.6 date filter not working in order list


Recommended Posts

hi all

 

i upgraded my store in 1.6.0.9 and the date filter don t work on the order list. I always have all the orders in the list even if i select 1 period of date.

i checked everywhere on the forums but i haven t find solution. i checked my adminorderscontroler.php but i haven t see something wrong.

does anyone have an idea about this problem ?

 

thanks a lot for help

 

extract of adminorderscontroler.php

 

	public function __construct()
	{
		$this->bootstrap = true;
		$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 = '
		ROUND( ( ( a.total_paid_tax_excl - (SELECT SUM(pro.wholesale_price*ode.product_quantity) FROM `'._DB_PREFIX_.'product` pro, `'._DB_PREFIX_.'order_detail` ode WHERE pro.id_product = ode.product_id AND ode.id_order = a.id_order) ) / a.total_paid_tax_excl * 100 ) ) AS marge,
		
		(a.total_paid_tax_excl - (SELECT SUM(pro.wholesale_price*ode.product_quantity) FROM `'._DB_PREFIX_.'product` pro, `'._DB_PREFIX_.'order_detail` ode WHERE pro.id_product = ode.product_id AND ode.id_order = a.id_order)) AS marge2,
        ( a.total_paid - IF((SELECT SUM(op.amount) FROM `'._DB_PREFIX_.'order_payment` op WHERE op.order_reference = a.reference) > 0, (SELECT SUM(op.amount) FROM `'._DB_PREFIX_.'order_payment` op WHERE op.order_reference = a.reference), 0) ) AS reste,
									
		a.id_currency,
		a.id_order AS id_pdf,
		CONCAT(LEFT(c.`firstname`, 1), \'. \', c.`lastname`) AS `customer`,
		
		(SELECT oi.`number` FROM `'._DB_PREFIX_.'order_invoice` oi WHERE oi.`id_order` = a.`id_order`) AS `numero_facture`,
		
		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,

		IF(a.valid, 1, 0) badge_success';

		$this->_join = '
		LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = a.`id_customer`)
		INNER JOIN `'._DB_PREFIX_.'address` address ON address.id_address = a.id_address_delivery
		INNER JOIN `'._DB_PREFIX_.'country` country ON address.id_country = country.id_country
		INNER JOIN `'._DB_PREFIX_.'country_lang` country_lang ON (country.`id_country` = country_lang.`id_country` AND country_lang.`id_lang` = '.(int)$this->context->language->id.')
		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';
//mail('[email protected]', '1', $this->_select);
//mail('[email protected]', '$this', print_r($this, true));
		$statuses_array = array();
		$statuses = OrderState::getOrderStates((int)$this->context->language->id);
		foreach ($statuses as $status)
			$this->statuses_array[$status['id_order_state']] = $status['name'];

		$this->fields_list = array(
			'id_order' => array(
				'title' => $this->l('ID'),
				'align' => 'text-center',
				'class' => 'fixed-width-xs'
			),
			'new' => array(
				'title' => $this->l('New client'),
				'align' => 'text-center',
				'type' => 'bool',
				'tmpTableFilter' => true,
				'orderby' => false
			),
			'customer' => array(
				'title' => $this->l('Customer'),
				'havingFilter' => true
			),
		);

		if (Configuration::get('PS_B2B_ENABLE'))
		{
			$this->fields_list = array_merge($this->fields_list, array(
				'company' => array(
					'title' => $this->l('Company'),
					'filter_key' => 'c!company'
				),
			));
		}

		$this->fields_list = array_merge($this->fields_list, array(
			'total_paid_tax_incl' => array(
				'title' => $this->l('Total'),
				'align' => 'text-right',
				'type' => 'price',
				'currency' => true,
				'callback' => 'setOrderCurrency',
				'badge_success' => true
			),
		'marge2' => array(
			'title' => $this->l('Marge'),
			'width' => 70,
			'align' => 'center',
			'prefix' => '<b>',
			'suffix' => '</b>',
			'type' => 'price',
			'currency' => true,
            'search' => false
		),
		'marge' => array(
			'title' => $this->l('Marge (%)'),
			'width' => 70,
			'align' => 'center',
			'prefix' => '<b>',
			'suffix' => ' %</b>',
            'search' => false
		),
		'reste' => array(
			'title' => $this->l('Reste'),
			'width' => 70,
			'align' => 'right',
			'prefix' => '<b>',
			'suffix' => '</b>',
			'type' => 'price',
			'currency' => true,
            'search' => false
		),
		'id_default_group' => array(
			'title' => $this->l('Group clt'),
			'width' => 100,
			'align' => 'center',
			'havingFilter' => true

		),
					'city' => array(
					'title' => $this->l('Ville'),
					'havingFilter' => true
				),
			'osname' => array(
				'title' => $this->l('Status'),
				'type' => 'select',
				'color' => 'color',
				'list' => $this->statuses_array,
				'filter_key' => 'os!id_order_state',
				'filter_type' => 'int',
				'order_key' => 'osname'
			),
			'date_add' => array(
				'title' => $this->l('Date'),
				'align' => 'text-right',
				'type' => 'datetime',
				'filter_key' => 'a!date_add'
								
			),
		'numero_facture' => array(
			'title' => $this->l('N. Facture'),
			'width' => 70,
			'align' => 'center',
			'prefix' => '<b>',
			'suffix' => '</b>'
		),
			'id_pdf' => array(
				'title' => $this->l('PDF'),
				'align' => 'text-center',
				'callback' => 'printPDFIcons',
				'orderby' => false,
				'search' => false,
				'remove_onclick' => true
			)
		));
		

		$this->shopLinkType = 'shop';
		$this->shopShareDatas = Shop::SHARE_ORDER;

*** after 2 days of searching i found the solution :

https://github.com/PrestaShop/PrestaShop/commit/9fe656a36cb868c391b7514bc337298015ee75dd

Edited by [email protected] (see edit history)
  • Like 2
Link to comment
Share on other sites

  • 3 weeks later...

hi all

 

i upgraded my store in 1.6.0.9 and the date filter don t work on the order list. I always have all the orders in the list even if i select 1 period of date.

i checked everywhere on the forums but i haven t find solution. i checked my adminorderscontroler.php but i haven t see something wrong.

does anyone have an idea about this problem ?

 

thanks a lot for help

 

extract of adminorderscontroler.php

 

	public function __construct()
	{
		$this->bootstrap = true;
		$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 = '
		ROUND( ( ( a.total_paid_tax_excl - (SELECT SUM(pro.wholesale_price*ode.product_quantity) FROM `'._DB_PREFIX_.'product` pro, `'._DB_PREFIX_.'order_detail` ode WHERE pro.id_product = ode.product_id AND ode.id_order = a.id_order) ) / a.total_paid_tax_excl * 100 ) ) AS marge,
		
		(a.total_paid_tax_excl - (SELECT SUM(pro.wholesale_price*ode.product_quantity) FROM `'._DB_PREFIX_.'product` pro, `'._DB_PREFIX_.'order_detail` ode WHERE pro.id_product = ode.product_id AND ode.id_order = a.id_order)) AS marge2,
        ( a.total_paid - IF((SELECT SUM(op.amount) FROM `'._DB_PREFIX_.'order_payment` op WHERE op.order_reference = a.reference) > 0, (SELECT SUM(op.amount) FROM `'._DB_PREFIX_.'order_payment` op WHERE op.order_reference = a.reference), 0) ) AS reste,
									
		a.id_currency,
		a.id_order AS id_pdf,
		CONCAT(LEFT(c.`firstname`, 1), \'. \', c.`lastname`) AS `customer`,
		
		(SELECT oi.`number` FROM `'._DB_PREFIX_.'order_invoice` oi WHERE oi.`id_order` = a.`id_order`) AS `numero_facture`,
		
		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,

		IF(a.valid, 1, 0) badge_success';

		$this->_join = '
		LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = a.`id_customer`)
		INNER JOIN `'._DB_PREFIX_.'address` address ON address.id_address = a.id_address_delivery
		INNER JOIN `'._DB_PREFIX_.'country` country ON address.id_country = country.id_country
		INNER JOIN `'._DB_PREFIX_.'country_lang` country_lang ON (country.`id_country` = country_lang.`id_country` AND country_lang.`id_lang` = '.(int)$this->context->language->id.')
		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';
//mail('[email protected]', '1', $this->_select);
//mail('[email protected]', '$this', print_r($this, true));
		$statuses_array = array();
		$statuses = OrderState::getOrderStates((int)$this->context->language->id);
		foreach ($statuses as $status)
			$this->statuses_array[$status['id_order_state']] = $status['name'];

		$this->fields_list = array(
			'id_order' => array(
				'title' => $this->l('ID'),
				'align' => 'text-center',
				'class' => 'fixed-width-xs'
			),
			'new' => array(
				'title' => $this->l('New client'),
				'align' => 'text-center',
				'type' => 'bool',
				'tmpTableFilter' => true,
				'orderby' => false
			),
			'customer' => array(
				'title' => $this->l('Customer'),
				'havingFilter' => true
			),
		);

		if (Configuration::get('PS_B2B_ENABLE'))
		{
			$this->fields_list = array_merge($this->fields_list, array(
				'company' => array(
					'title' => $this->l('Company'),
					'filter_key' => 'c!company'
				),
			));
		}

		$this->fields_list = array_merge($this->fields_list, array(
			'total_paid_tax_incl' => array(
				'title' => $this->l('Total'),
				'align' => 'text-right',
				'type' => 'price',
				'currency' => true,
				'callback' => 'setOrderCurrency',
				'badge_success' => true
			),
		'marge2' => array(
			'title' => $this->l('Marge'),
			'width' => 70,
			'align' => 'center',
			'prefix' => '<b>',
			'suffix' => '</b>',
			'type' => 'price',
			'currency' => true,
            'search' => false
		),
		'marge' => array(
			'title' => $this->l('Marge (%)'),
			'width' => 70,
			'align' => 'center',
			'prefix' => '<b>',
			'suffix' => ' %</b>',
            'search' => false
		),
		'reste' => array(
			'title' => $this->l('Reste'),
			'width' => 70,
			'align' => 'right',
			'prefix' => '<b>',
			'suffix' => '</b>',
			'type' => 'price',
			'currency' => true,
            'search' => false
		),
		'id_default_group' => array(
			'title' => $this->l('Group clt'),
			'width' => 100,
			'align' => 'center',
			'havingFilter' => true

		),
					'city' => array(
					'title' => $this->l('Ville'),
					'havingFilter' => true
				),
			'osname' => array(
				'title' => $this->l('Status'),
				'type' => 'select',
				'color' => 'color',
				'list' => $this->statuses_array,
				'filter_key' => 'os!id_order_state',
				'filter_type' => 'int',
				'order_key' => 'osname'
			),
			'date_add' => array(
				'title' => $this->l('Date'),
				'align' => 'text-right',
				'type' => 'datetime',
				'filter_key' => 'a!date_add'
								
			),
		'numero_facture' => array(
			'title' => $this->l('N. Facture'),
			'width' => 70,
			'align' => 'center',
			'prefix' => '<b>',
			'suffix' => '</b>'
		),
			'id_pdf' => array(
				'title' => $this->l('PDF'),
				'align' => 'text-center',
				'callback' => 'printPDFIcons',
				'orderby' => false,
				'search' => false,
				'remove_onclick' => true
			)
		));
		

		$this->shopLinkType = 'shop';
		$this->shopShareDatas = Shop::SHARE_ORDER;

*** after 2 days of searching i found the solution :

https://github.com/PrestaShop/PrestaShop/commit/9fe656a36cb868c391b7514bc337298015ee75dd

 

Perfect!!! Many Thanks

Me too I had the same bug and I solved it with the solution you found.

 

Ciao

Angela

Link to comment
Share on other sites

  • 3 weeks later...
  • 4 weeks later...
  • 1 month later...
  • 11 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...