Post by Kinetsu » Wed Oct 19, 2016 11:59 am

OC 2.3.0.2 is trying to get the mannual vourcher order info when you send it:

File: admin/model/sale/voucher.php
Function: sendVoucher($voucher_id)

Code: Select all

public function sendVoucher($voucher_id) {
	...
	$order_info = $this->model_sale_order->getOrder($order_id);

	// If voucher belongs to an order
	if ($order_info) {
		...
	else {
		...
		$data['text_greeting'] = sprintf($this->language->get('text_greeting'), $this->currency->format($voucher_info['amount'], $order_info['currency_code'], $order_info['currency_value']));
		...
In this case, the var $order_info is null, so this will throw the followin warnings:

Code: Select all

PHP Notice:  Undefined index:  in system/library/cart/currency.php on line 25
PHP Notice:  Undefined index:  in system/library/cart/currency.php on line 26
PHP Notice:  Undefined index:  in system/library/cart/currency.php on line 27
PHP Notice:  Undefined index:  in system/library/cart/currency.php on line 30
Although these warnings, the email is sent normally.
But to solve this, i made this little VQMOD:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<modification>
   <id>Voucher Send Fix</id>
   <version>2.3.0.2</version>
   <vqmver required="true">2.6.1</vqmver>
   <author>Kinetsu</author>
   
   <file name="admin/model/sale/voucher.php">
      <operation info="Fix Send Voucher">
         <search position="before">
            <![CDATA[
               $data['text_greeting'] = sprintf($this->language->get('text_greeting'), $this->currency->format($voucher_info['amount'], $order_info['currency_code'], $order_info['currency_value']));
            ]]>
         </search>
         <add trim="true">
            <![CDATA[
               $order_info['currency_code'] = 'USD'; $order_info['currency_value'] = 1;
            ]]>
         </add>
      </operation>
   </file>
</modification>

Newbie

Posts

Joined
Mon Oct 10, 2016 6:21 am

Post by carmonaweb » Wed Mar 13, 2019 11:21 am

the correct code is:

Code: Select all

$data['text_greeting'] = sprintf($this->language->get('text_greeting'), $this->currency->format($voucher_info['amount'], $order_info['currency_code'] = 'USD', $order_info['currency_value'] = '1'));

Carlanga
Santiago de Chile


User avatar
Newbie

Posts

Joined
Fri Feb 17, 2012 9:58 am
Location - Santiago Chile
Who is online

Users browsing this forum: No registered users and 2 guests