Jump to content

Currency ISO Code page Order Confirmation


Recommended Posts

Bonjour

je cherche a avoir la variable " de la devise en code Iso c'est a dire EUR , GBP, USD  " dans la page  order confirmation 

J'ai surchargé la classe OrderConfirmationController 

j'ai bien créer un overdrive mais quand j'appel dans le tpl {$ordersCurrency} ou {$Currency} il n'y a rien qui remonte 

<?php

class OrderConfirmationController extends OrderConfirmationControllerCore
{

    public function initContent()
    {
        parent::initContent();
		
		$order = new Order($this->id_order);
		$cart_rules = $order->getCartRules();

        $this->context->smarty->assign(array(
            'is_guest' => $this->context->customer->is_guest,
            'HOOK_ORDER_CONFIRMATION' => $this->displayOrderConfirmation(),
            'HOOK_PAYMENT_RETURN' => $this->displayPaymentReturn(),
			'total_paid_tax_incl' => number_format($order->total_paid_tax_incl, 2, ',', ' '),
			'total_paid_tax_excl' => number_format($order->total_paid_tax_excl, 2, ',', ' '),
			'total_shipping_tax_incl' => number_format($order->total_shipping_tax_incl, 2, ',', ' '),
			'total_shipping_tax_excl' => number_format($order->total_shipping_tax_excl, 2, ',', ' '),
			'total_products_wt' => number_format($order->total_products_wt, 2, ',', ' '),
			'total_products' => number_format($order->total_products, 2, ',', ' '),
			'id_order' => $this->id_order,
			'payment_method' => $order->payment,
			'order_reference' => $order->reference,
			'ordersTotalPaid' => $order->getOrdersTotalPaid(),
			'ordersCurrency' => $currency->iso_code,
			'currency'=>$order->currency->iso_code,
			'reduction_wt' => isset($cart_rules[0]['id_order_cart_rule']) ? number_format($cart_rules[0]['value'], 2, ',', ' ') : 0,
			'reduction_tax_excl' => isset($cart_rules[0]['id_order_cart_rule']) ? number_format($cart_rules[0]['value_tax_excl'], 2, ',', ' ') : 0,
			'voucher_code' => isset($cart_rules[0]['id_cart_rule']) ? $this->getVoucherCodeById($cart_rules[0]['id_cart_rule']) : ''
        ));

        if ($this->context->customer->is_guest) {
            $this->context->smarty->assign(array(
                'id_order' => $this->id_order,
                'reference_order' => $this->reference,
                'id_order_formatted' => sprintf('#%06d', $this->id_order),
                'email' => $this->context->customer->email
            ));
            /* If guest we clear the cookie for security reason */
            $this->context->customer->mylogout();
        }
 
$order = new Order($this->id_order);
$cart = new Cart($order->id_cart);
$description="";
foreach ($cart->getProducts() AS $k=>$v){
$description.=$v['name'];
}   
$description=urlencode($description);
 
$this->context->smarty->assign(array(
'total_products'=>$order->total_products,
'description'=>$description, 
'currency'=>$order->currency->iso_code,
'vc'=>$cart->cart_rule->code
));
        $this->setTemplate(_PS_THEME_DIR_.'order-confirmation.tpl');
    }
	
	public static function getVoucherCodeById($id_cart_rule)
    {
        if (!Validate::isCleanHtml($id_cart_rule)) {
            return false;
        }
        return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('SELECT `code` FROM `'._DB_PREFIX_.'cart_rule` WHERE `id_cart_rule` = \''.pSQL($id_cart_rule).'\'');
    }

 public static function curr_iso($id){
        $currency = new Currency($id);
        return $currency->iso_code;
    }
}

Merci de votre aide 

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