Jump to content


Photo

How to display voucher on order lists in back office?

prestashop 1.6 order back office cart rules voucher discount

  • Please log in to reply
3 replies to this topic

#1 LindaMari

LindaMari

    Advanced Member

  • Members
  • PipPipPip
  • 54 posts

Posted 26 April 2014 - 08:28 PM

i started camaping on groupon, my customers received voucher codes.

now i want to display (only if voucher code was used) voucher code on orders product list

 



looking for the best presta addons with outstanding support? check this: PrestaShop Modules

#2 hrbj

hrbj

    Member

  • Administrators
  • 64 posts

Posted 27 April 2014 - 10:31 AM

in this case it's necessary to modify controller named AdminOrdersController located in directory:
/controllers/admin/ filename: AdminOrdersController.php

use this __construct() function instead of original:

	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 = '
        ocr.`name` AS vname,
		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,
		country_lang.name as cname,
		IF(a.valid, 1, 0) badge_success';

		$this->_join = '
        LEFT JOIN `'._DB_PREFIX_.'order_cart_rule` AS ocr ON ocr.`id_order` = a.`id_order`
		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';

		$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'
			),
			'reference' => array(
				'title' => $this->l('Reference')
			),
			'vname' => array(
				'title' => $this->l('voucher name')
			),
			'new' => array(
				'title' => $this->l('New client'),
				'align' => 'text-center',
				'type' => 'bool',
				'tmpTableFilter' => true,
				'orderby' => false
			),
			'customer' => array(
				'title' => $this->l('Customer'),
				'havingFilter' => true,
			),
		);

effect:
sxQu62e.png



#3 emvoo

emvoo

    Newbie

  • Members
  • Pip
  • 1 posts

Posted 21 March 2015 - 12:53 PM

Hi there

 

I would like to know how to display voucher codes used in order page in Back Office. below Discounts -> amount id like to have something like Voucher code/s -> voucher code/name

 

post-472489-0-66912300-1403517574.png

 

Is it possible to achieve?

 

Prestashop 1.6.0.14

 

Thanks



#4 Jerryy

Jerryy

    Newbie

  • Members
  • Pip
  • 1 posts

Posted 12 May 2015 - 05:12 AM

This is great Coding technique.. you are genius We offer Best Service for prestashop http://evincetech.co...tomisation.html







IPB Skin By Virteq