Jump to content

Create a new variable to show on order confirmation template


FilipeSilva11

Recommended Posts

hello,

I need to create a variable to show the promo code user in the twig confirmation template ex:{{ order.promo }}, but i don't know where the variables are stored in prestashop, or if that is the correct way to do it.

Help? thanks

 

EDIT: i've added on "OrderConfirmationController.php":

$regra = $this->context->cart->getCartRules();
		$codigo = $regra[0]["code"];
        $this->context->smarty->assign(array(
            'HOOK_ORDER_CONFIRMATION' => $this->displayOrderConfirmation($order),
            'HOOK_PAYMENT_RETURN' => $this->displayPaymentReturn($order),
            'order' => $presentedOrder,
            'register_form' => $register_form,
			'codigo' => $codigo,
        ));

Returns nothing..

Edited by FilipeSilva11 (see edit history)
Link to comment
Share on other sites

Ended up making a query:

$id_carro = intval($this->id_cart);
$codigo = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue("SELECT code FROM ps_cart_rule INNER JOIN ps_cart_cart_rule ON ps_cart_rule.id_cart_rule = ps_cart_cart_rule.id_cart_rule AND ps_cart_cart_rule.id_cart =".$id_carro.";");
        

 

Edited by FilipeSilva11 (see edit history)
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...