Jump to content
tijojoel

Pass custom values from parentOrderController to order-payment.tpl

Recommended Posts

Hi,

 

I had modified some part of reorder in parentOrderController, created a variable. Now I want to pass that variable into the order-payment.tpl so that I can check a condition with that. Can someone please help me?

 

ParentOrderContoller.php(Added Part)

-------------------------------------------------------------

 

   if (Tools::isSubmit('submitPay') && $id_order = (int)Tools::getValue('id_order')) {
 
            //To check the order is in print ready state
            $order = new Order((int)$id_order);
            $current_order_state = $order->getCurrentOrderState();                      
            $current_order_state_id = $current_order_state->id;
            //ends here
            //d($current_order_state_id);
 
 
            // $this->context->cookie->current_order_state_id = $current_order_state->id;
 
            $oldCart = new Cart(Order::getCartIdStatic($id_order, $this->context->customer->id));            
            $duplication = $oldCart->duplicate();
 
            if (!$duplication || !Validate::isLoadedObject($duplication['cart'])) {
                $this->errors[] = Tools::displayError('Sorry. We cannot renew your order.');
            } elseif (!$duplication['success']) {
                $this->errors[] = Tools::displayError('Some items are no longer available, and we are unable to renew your order.');
            } else {
                $this->context->cookie->id_cart = $duplication['cart']->id;
               
                $context = $this->context;
                $context->cart = $duplication['cart'];
                CartRule::autoAddToCart($context);
                $this->context->cookie->write();
                d(Configuration::get('PS_ORDER_PROCESS_TYPE'));
                if (Configuration::get('PS_ORDER_PROCESS_TYPE') == 1) {
                    Tools::redirect('index.php?controller=order-opc');
                }               
                Tools::redirect('index.php?controller=order');
            } 
        }
 
 
I want $current_order_state_id to be passed to order-payment.tpl. How to do it?

Share this post


Link to post
Share on other sites

when i pass $this->context->smarty->assign('current_order_state_id',$current_order_state_id); inside the condition, it is not coming. I think tpl is not rendering inside. How to render it?

 

 

It is not going inside the    if (Tools::isSubmit('submitPay') && $id_order = (int)Tools::getValue('id_order'))  condition.

Edited by tijopromantia (see edit history)

Share this post


Link to post
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...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More