renaud2263 Posted June 18, 2016 Share Posted June 18, 2016 Hi All, I just need to place my functions (which send all the details of each order in an xml file in a specific folder). This methods have to be called in these cases : - From BO : when I change the status of an order manually to "paid" - FROM front: in the payment validation pages (Paypal, CB etc...) What is the best ? Create my own class ? In this case how can I declare / include the file ? Write the functions in a file which is called everywhere ? Could you help me ? Link to comment Share on other sites More sharing options...
renaud2263 Posted June 18, 2016 Author Share Posted June 18, 2016 Hello and thanks for your answer You mean I need to create a module with install and uninstall methods and install from BO ? Link to comment Share on other sites More sharing options...
renaud2263 Posted June 18, 2016 Author Share Posted June 18, 2016 Ok... I will try to do that. I'm a starter in Photoshop organisation but I saw some goog tutos. Could you tell me how I call these 2 methods "hooks" from the paypal_validation page (by example) when Paypal returns payment ok ? And from which page I must call them when I change the order status to "paid" from BO / orders / edit order ? Thanking you in advance. Link to comment Share on other sites More sharing options...
renaud2263 Posted June 19, 2016 Author Share Posted June 19, 2016 Many thanks for this very good tuto. I read it carefully and it's helpfull ! However the thing I don't understand is the link between such module and the concerned page. By example a Paypal payment. When customer has paid on the Paypal site, Paypal call the ipn.php page in my Paypal module and send a response with payment ok or not. The customer never see this page. No message, nothing, only database update to validate the order. In this page, if response is OK, I need to use my personnal functions. So suppose my new module is "dropship". In my dropship.php this code : public function hookDisplayOrderConfirmation($params) { } In this function, all I need to do. $params will take the value of id_order. OK. But how I call that from Paypal ipn's page ??? Sorry if I look like little bit stupid... Link to comment Share on other sites More sharing options...
renaud2263 Posted June 19, 2016 Author Share Posted June 19, 2016 (edited) Many thanks. I will try that. So I just create my new module and install in the BO with these methods. No need to call them from validateOrder in PaymentModule or in the ipn.php page in the Paypal module or somewhere else ? Edited June 19, 2016 by renaud2263 (see edit history) Link to comment Share on other sites More sharing options...
renaud2263 Posted June 19, 2016 Author Share Posted June 19, 2016 Call theme in your module. Don't use overrides refer to the code from the payment module. Soory...oup's ! I don't understand "Call theme in your module." ... In fact my function must be executed by OrderValidate method in PaymentModule. If the payment is OK I write all the datas of the order in a XML file and write it in a folder. That's all. Link to comment Share on other sites More sharing options...
renaud2263 Posted June 21, 2016 Author Share Posted June 21, 2016 Hi All, Then I come back after I created and installed my new mudule called "dropship". As per the example given by ndiaga, I added a method "hookPaymentReturn($params)". But after complete check I see that this method is in the 2 concerned modules: Paypal and Saferpay (CB payments). Here is the method from the saferpay.php : public function hookPaymentReturn($params) { if (!$this->active) return ; $smarty = $this->context->smarty; $state = $params['objOrder']->getCurrentState(); if ($state == Configuration::get('SAFERPAY_ID_ORDER_STATE') OR $state == _PS_OS_OUTOFSTOCK_) $smarty->assign(array( 'total_to_pay' => Tools::displayPrice($params['total_to_pay'], $params['currencyObj'], false), 'status' => 'ok', 'id_order' => $params['objOrder']->id )); else $smarty->assign('status', 'failed'); return $this->display(__FILE__, 'payment_return.tpl'); } So OK this method calls the template and show a message to the customer after his payment: ok or error. But now I don't understand the utility of my dropship module ! I cannot use the above method to call my own functions ??? Or If I use my own method "hookPaymentReturn($params)" in my dropship module, how can I call it instead of the Paypal's and Saferpay's method ? Really complicated... Link to comment Share on other sites More sharing options...
renaud2263 Posted June 23, 2016 Author Share Posted June 23, 2016 Progress ! I built my own dropship module. I call the hook hookActionOrderStatusUpdate for all the orders from the BO. Creation ever paid or payment update. The method is called ! But new problem: I need this method be executed AFTER the validateOrder function because I need all the details of the order. At this stage, all my tests show all the arrays (product list...) are empty. So I suppose it is because all the order is not still created but only the cart. So how can I do ? I looked at all the hooks but I don't know which one is executed in last after payment ok and order registration. I see a column "position" in the hook_module table. I must change something here ? 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