Jump to content

Passing product information and updating of an order


Recommended Posts

Hi,

 

I have customized order history page so that customers can complete the payment from their end.

 

I had added pay button in orderhistory page when customer clicks on the particular order pay button the payment of that order should be completed.

 

Now customers clicks on pay button will go to payment gateway page. I have to pass the order details instead of cart details which customer had clicked.

 

How to remove the below values? 

 

        $address = new Address((int)$this->context->cart->id_address_invoice);
        $address_state =  new State($address->id_state);
        $customer = new Customer($this->context->cart->id_customer);
        $amount = $this->context->cart->getOrderTotal();    
 
And update the order with the status instead of creating new one
 
/* Create the PrestaShop order in database */
$this->validateOrder((int)$this->context->cart->id, (int)$order_status, $amount, $this->displayName, $message, array(), null, false, $this->context->customer->secure_key);
 
 
 
I want to change this code. Can someone please help me

 

Link to comment
Share on other sites

You are going the wrong way dear friend. It's like starting at the end of a shipped order to get a cart as final result.

But if you want to go this way, use the order object instead of the cart object. Above code - where ever it comes from - refers to the cart object. I gives  the impression you are missing some basic knowledge of prestashop.

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

You have to load the order object before you have access to its values and methods. Please note that load doesn't mean create. Since you start your scruffy approach from the order history, you already have the order ID there which is very convenient. Load the order with that id and then load the procuts for this order. This two methods are heavily used all around prestashop. They don't create any new order but just read existing data.
 
Regarding data transfer in between orderhistory and whatever else: If you are not familiar how to pass values from one step to another, you should make yourself familiar with the essentials for php. It's not a php forum here. There are many ways to do that but the best way depends on where and how data is expected from the other side. Is it the same server, is it a different server, do you have access to a remote server. Or can you directly write to a remote database? Questions over questions. We have a quite huge lack of information regarding your setup.

 

Besides that:

I don't know what securesubmit.php is - the only I know: it's not part of PrestaShop. Again: You did not feel constraint to explain more about it. So do your thing.

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

Hi,

 

securesubmit.php is from the hearland payment module. In their default approach they are taking cart details as I shown in the question. For me the cart thing is not needed. In default they are taking cart elements and completing payment.

 

so I am changing the workflow but I am struggling on passing the values to that page since order id is assigned to smarty in Parent OrderController and assigned to the tpl file. How would I take that value and pass to my payment gateway module?

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