How to change content of order confirmation email template in prestashop? - prestashop

I want to change the content of order confirmation email template, only if a particular product has ordered. Is there any solution?

You can find the general template of email order confirmation in mails/language/order_conf.(html/txt).
The product list template in mails/languages/order_conf_product_list.(tpl/txt)
Called in classes/PaymentModule.php, validateOrder() function if you want to add variables.

Related

Prestashop add custom radio button on shipping carriers on front end checkout

I have created one custom module in Prestashop 1.7.8.7 which will add multiple shipping methods (Carrier) and will show shipping cost based on product dimensions and delivery address. So shipping carrier will look something like this on front-end checkout page. https://prnt.sc/E1avDASyJYYW
Now if someone select SameDay Courier Shipping then i need to show two radio button to select which service they want.
It will have two radio options like
Delivery pickup (by default this option will be selected)
Locker pickup
So if someone select Delivery pickup then it will have different shipping cost and if someone select Locker pickup then it will have different shipping cost.
Can anybody help me how can i achieve this functionality.
While digging, i found that we have file called DeliveryOptionsFinder.php and in that file we have one public function called getDeliveryOptions() where we have this line of code
if ($moduleId = Module::getModuleIdByName($carrier['external_module_name'])) {
$carrier['extraContent'] = Hook::exec('displayCarrierExtraContent', ['carrier' => $carrier], $moduleId);
}
}
So if i set is_module to 1 to all my carriers directly from DB then on frontend checkout page, no carriers is being displayed.
Thanks in advance.
I've already done something like this in the last 2 year as prestashop developer.
The truth is that you can't achieve what you want by "respecting" prestashop processes.
Maybe you can hook using a module the hookDisplayCarrierExtraContent($data) and then return the 2 radios if carrier is certain one (use $data).
But you can't handle a form submit or something else, or include it to prestashop checkout data.
But what you can do as workaround, for example, is the following.
In your module, as I said, hook the extra content, render a template with the 2 radios. Hook displayHeader too and use $this->context->controller->addJS() to add your own js if the current controller is the checkout one.
Then in this JS code you can handle the "change" event of the radios and send an ajax request to your module.
You can create inside {your_module}/controllers/front/ a controller called, for example, radio-choose and handle the js ajax request by saving inside your own table the choosen one.
Obviously you can disable the "next" button in checkout untill one of the two radios are selected, or maybe you can just set a radio button as default one to simplify.
For example your table "ps_cart_choosen_radio" could look like this |id_cart|choosen_radio|.
Then you have all the data you needed. When a cart is converted into an order you will have inside Order object (and ps_orders table as well) the id_cart.
Just select / join choosen radio from your own table by using order's id_cart.
"SELECT choosen_radio FROM ps_cart_choosen_radio WHERE id_cart = {$order.id_cart}"
If you need to show data depending on choosen_radio in frontend you can hook everywhere an order is present and select these data. Or maybe you can edit carrier name in ps_orders table by adding a piece of string. Let' say carrier is "express" and customer choosed "24h". You can update that column with carrier name by changing it to "express-24h" so around the whole prestashop ecosystem everybody will see that's a 24h choice.
Remember that the carrier name related to an order is not the carrier name inside the carriers table. So you can edit it without having trouble.
All these problems comes from the "need" to show some nested choices instead of listing all these in the main selections. In that case it would be easy (just create carrier in the prestashop backoffice)

Prestashop 1.7.6.9 display default category_name into email and backoffice order

I need to show:
"default category name" of the purchased products into email template
order_conf "default category name" of the purchased products into
backoffice > single order (where at the moment it shows product_name + reference)
BO > orders > order > purchased product
Would you give me some indication on the files to be modified to show the category name (default_category) of the purchased products?
I have searched around the web but I can't find any solution / instructions to do this
Thanks to anyone who will be able to help me
Prestashop 1.7.6.9
To show info in back office order detail you can use hook displayAdminOrderLeft.
For more info look at https://devdocs.prestashop.com/1.7/modules/concepts/hooks/list-of-hooks/
For mail you must change order_conf.html in mails directory.
To put extra data in template vars you can use actionEmailAddBeforeContent hook.
Thankyou Fran Cerezo for the indication to investigate.
To show Default Category name into hook "displayAdminOrderLeft", i opened
/admin123456/themes/default/template/controllers/orders/_product_line.tpl file
So i added
{if isset($product.id_category_default)}
{assign var='catname' value=Category::getCategoryInformations(array($product.id_category_default))}
{$catname[$product.id_category_default].name}
{/if}
Otherwise, to show the "default category name" in the order confirmation email (for single product purchased) I'm in trouble ..
The /mails/it/order_conf.html file declares the {products} variable.
Where do I find the template to edit the {products} variable and then add the category name information?
Where is the reference file located?
Thanks
{products variable into order_conf.html}

Modify or Disable HTML for "Sales Order - Send by Email" template

How to change Sales Order - Send by Email template, not the text but style of the sent mail.
For example, change header/footer color or if possible completely disable HTML and send all e-mail messages as plain text.
Looks like this is pulling from the Sale Order Notification Email. I went into Settings > Technical > Email > Templates, searched for that Notification Email template and replaced the Content with the following:
${object.body | safe}
This is defined in the paynow and other Views that apply to the mail model.
Look in table mail.message and see which layout it's using.

Override email templates (mailalert module) in prestashop

We have an eshop in prestashop (1.6.1.12 version) with mail alerts module installed. The concept is to modify the email template in order to change the way some values are being displayed. In particular we would like to modify the new_order email notification (the one that the shop owner receive for every new order) removing the product links from the product list and display the shipping costs without tax (the total tax is visible on the next field of the email).
You have the template files in this directory:
/modules/mailalerts/mails/[your-language]

How to Personalize window behavior in odoo 8 livechat

How to Personalize window behavior in Odoo 8
Goals for now are:
add fields asking visitors Name, Email and Concern, As you can see at first image "A" the customer name is "Visitor"
change visitors name base on his/her Name input
change the design (background color, font, etc)
I already search on odoo documentation but no tutorials for Live Chat customization.
TIA
The appearance and the behaviour of the live_chat window is defined in the files addons/im_chat/static/src/js/im_chat.js, addons/im_chat/static/src/xml/im_chat.xml and addons/im_livechat/static/src/js/im_livechat.js
Depending on your needs your will have to modify these files. For the needs you have outlined in your question you have to:
1) add fields asking visitors Name, Email and Concern, As you can see
at first image "A" the customer name is "Visitor"
You have to modify the send_welcome_message function on the im_livechat.js in order for you to send a custom initial message and you have to change the im_chat.Conversation_message_bubble template in order to give each "text bubble" a different look (for example to insert a textbox asking for user's info)
2) change visitors name base on his/her Name input
When you collect your data, the user's name is saved in the variable defaultUsername in im_livechat.js, you will have to set it there
3) change the design (background color, font, etc)
All of this can happen from changing the template with the name = im_chat.Conversation_message_bubble from the im_chat.xml file accordingly.