Prestashop: Add a text in the order payment page - php

I 'm trying to customize the order payment page (step 5),
it's the page shown just before the order confirmation.
The text to add in this page is a simple sentence that include the variables "order-ID" and the "total amount".
Example od sentence to add: "Your order number is: XXX and the amount is: YYY"
I guess that the first thing to do is to add the sentence and the 2 variables in the controller (probabily in the file "OrderController.php" or "OrderDetailController.php" Im not sure...)
Then the last step should be to add {$my_sentence} in the "order-payment.tpl" file?
I'm familiar with PHP, i just need to understand what files/function i need to edit.
Could someone please help me?
PS: My prestashop version is the 1.4, as payment module there is paypal pro and wire.

I stricly recommend that you modify anything using a module :
Create a simple module (look up simple module tutorials on the web)
Find exec() function in Hook.php, use error_log($hook_name) to find out which hooks are executed.
Regsiter the hook you selected in your module's install function. Then create a function public funtion hook{HOOK_NAME}($args){ error_log(print_r($args, 1)); }
You should find a hook that adds things to that page (adds display).
There is on problem though. I believe that the order is not formed until it is confirmed (in the enxt step). So the only thing you will probably have available in that page is Cart and Customer data.

Related

Trigger a specific button and run some code with Prestashop

I wanted to run some code via PrestanShop when a specific button is pressed, before/after the designed action is happened.It's not alter the designed action, just is send some notification to an external system (notify the 3-rd party that we have a new sale and maybe with sales detalis: product, prices, etc)
To be more specific the action is finish a sale(or make an order) when click the related button.
I read something related (hooks and module) but maybe someone have the same issue then any help is appreciated.(even with no code, but good hints)
Maybe what hook is to be triggered here or some hints how to alter the code using PS-standards.
(light way and not just adding some php code to alter in the hard way the core)
Note: language on interface is romanian and the action is when a sale is post into the system (became an order, payments is not relevant/order_status).
Thank you,
Traian
You can use actionValidateOrder and make your call to your 3rd party in this function.
This hook is called here :
classes/PaymentModule.php line 716

Prestashop Module - Control user postal code

I am trying to develop a Prestashop module for reading the sending address postal code of the user and, depending on the code do some actions. I am beginning with the modules developing and I am a bit lost. I suppose that I have to use a certain hook, but cant find the right, could be authentication, but I am not sure.
Which is the correct hook?
When ever a new object is saved or updated following hooks are called:
actionObjectAddBefore
actionObjectAddBefore
actionObjectAddAfter
actionObjectAddAfter
actionObjectUpdateBefore
actionObjectUpdateBefore
actionObjectUpdateAfter
actionObjectUpdateAfter
So in your case you should be able to use actionObjectAddressAddAfter.

Add comment when using Paypal checkout in magento

I want to know if there is any way to allow customers to add comments during checkout process when using Paypal checkout?.
EDIT: this comment will show up in the sales email and order.
I found some comments modules but seems to work only with the regular checkout process!.
Thanks in advance.
Adding that functionality with PayPal isn't an option, but you can add a comment after the order is placed on the thanks page.
You'll want to add a form with a text area to success.phtml, then follow the steps on the controller that it submits to. You'll probably want to submit to a custom module.
First, get the customer's last order:
$order = Mage::getModel('sales/order')->load(Mage::getSingleton('checkout/session')->getLastOrderId());
Next, take that order and update its comment.
$order->setCustomerNote($this->getRequest()->getParam('YOUR_COMMENT_FIELD_NAME'));
$order->save();
If you use AJAX you can return JSON stating the note has been saved (or a validation error occurred) directly from the controller and avoid the need for a view.
If you're unsure of how to go about creating a custom module I'd recommend starting here:
http://blog.baobaz.com/en/blog/developing-module-for-magento-tutorial-where-to-begin-part-1
The only change I'd recommend is not echoing your output (even if it is JSON directly from the controller), but instead using something like this:
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode(array('status'=>'success')));

Magento backend shipping selection

Heyhey,
I made a pretty kickass Magento 1.6 module to select a store and time to come pick stuff up at the shop, and it works fine in the front end. It doesn´t however appear in the backend, and the backend order creation system needs to have the same functionality.
How do I enable my module for backend order creation?
I'll supply any details needed!
Kind regards,
Alex
in the file:
/app/design/adminhtml/default/default/layout/sales.xml
around line 497 (on my version, which is Enterprise 1.10.0.1)
you should find
<adminhmtl_sales_order_create_index>
I strongly believe that has the information on what you want. Your module will need it's own layout xml file that references these areas to insert its own content. Then, you will need to hook into the order create event with an observer to run your own code to deal with the data. This may already be happening, as I'm not sure if the backend code creating the order is any different from the front end.
Hope this helps as a jumping off point.

How can I do Magento one page checkout (together with the UI) using API calls?

I want to implement one page checkout part of Magento from the outside of Magento structure (i.e. using API calls). If it is possible, I want to start using the existing code to reduce the implementation effort. So, how can I modify the existing checkout implementation in order to make it run from outside? Or, is there any other implementation which provides Magento checkout functionality together with the UI?
I'm not entirely sure what it is your after but if you're thinking of using Magento checkout say in Wordpress then you could simply include app/Mage.php and use pretty much all the functionality provided by Magento.
Say create a product (you would need one to check out) on the fly if it isn't already in Magento or render any templates - checkout in your case.
Not a problem to insert "add to cart" buttons to any website and use AJAX to request cart contents to the same page.
Also I just needed to code pretty much the same thing for OneStepCheckout which opens up in lightbox and allows you to check out from pretty much anywhere. HTML onepager for example or from Facebook:P

Categories