FilipeSilva11 Posted February 14, 2023 Share Posted February 14, 2023 (edited) 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 February 14, 2023 by FilipeSilva11 (see edit history) Link to comment Share on other sites More sharing options...
s4lvozesta Posted February 14, 2023 Share Posted February 14, 2023 There are many ways. Hardcoding like your example is one way. For me, I would find the 'nearest' hook and assign my variable on the hook (using module) Link to comment Share on other sites More sharing options...
FilipeSilva11 Posted February 15, 2023 Author Share Posted February 15, 2023 (edited) 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 February 15, 2023 by FilipeSilva11 (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now