How to inherit OrderReceipt file from PoS app - odoo-15

I'm trying to inherit OrderReceipt.xml file from PoS to change the way cashier name is displayed. So far I tried this -> put the file in my module in this location: static > src > XML > orderReceipt_inherited.xml
Inside of it is this code:
And inside of my manifest file I am calling it with qweb like this:
I got no luck with it, changes are not showing on receipt. Can someone please help. Odoo version is 15.

You need to use the 'point_of_sale.assets' entry under assets.
You can find an example in the l10n_co_pos module
'assets': {
'point_of_sale.assets': [
'l10n_co_pos/static/src/js/**/*',
'l10n_co_pos/static/src/xml/**/*',
],
},
You need also to use the module name in the file path as you can see in the example above

Related

WHMCS how to find right tpl files in pages

i'm using WHMCS and i want to make some changes in part of the page but its so hard and takes so much time for me to find the right tpl file and edit it in the template.
for example for this "search for domains" tab in this url =>
example.com/cart.php?a=add&domain=register
where is the .tpl file.
For example.com/cart.php?a=add&domain=register the file is at templates/orderforms/standard_cart/adddomain.tpl
In general, when url has cart.php, the file in cart template.
Also, you can add the following to hooks to tell you which tpl file was used for current page.
1- Create file includes/hooks/tpl_locator.php
2- Add the following code:
<?php
add_hook('ClientAreaPage', 1, function($vars) {
error_log(print_r([$vars['currentpagelinkback'],$vars['templatefile']], true), 3, __DIR__.'/tpl_file_location.log');
});
3- Visit the page you want to know which tpl file is used.
4- Result will be at file includes/hooks/tpl_file_location.log, sample below:
Array
(
[0] => /cart.php?a=add&pid=1&
[1] => configureproductdomain
)
This was tested on WHMCS 8.0
The tpl for cart.php?a=add&domain=register is actually located at /whmcs/templates/orderforms/standard_cart/domainregister.tpl if I understand your question.

How to use a template view in prestashop?

I want to use an existing template in prestashop (product-list.tpl), i use this code in my module controller (method: initContent() ):
$this->setTemplate(_PS_THEME_DIR_ . 'templates/catalog/listing/product-list.tpl');
But prestashop return me that error :
[PrestaShopException]
No template found for C:\wamp64\www\prestashop/themes/classic/templates/catalog/listing/product-list.tpl
at line 68 in file classes/Smarty/TemplateFinder.php
Thank's you very much for you'r help !
The problem lies with the method setTemplate(), which is calling getTemplatePath(), a method that check if the desired template is located either in the module directory or in the module directory inside the current theme.
To make it work i would simply copy the product-list.tpl inside the directory :
"YourTheme"/modules/"Your module"/views/templates/front/

prestashop mail customisation, and module translation

i have two question
1 - i installed referral program module , and i would like to customise the referralprogram-invitation.html mail template
so i putted the new template under : prestashop_root/themes/my_theme/modules/referralprogram/mails/referralprogram-invitation.html
but i doesn't work !
2 - i would like to add some extra text to the program page of referral program module
so i copied the file already included with the module under
prestashop_root/themes/my_theme/modules/referralprogram/translations/fr.php and I added the new text translation in this form
$_MODULE['<{referralprogram}prestashop>program_MD5'] = 'new text';
and it does not work?!!
You only forgot the language folder. Your mail templates must not be in :
prestashop_root/themes/my_theme/modules/referralprogram/mails/referralprogram-invitation.html
but in
prestashop_root/themes/my_theme/modules/referralprogram/mails/fr/referralprogram-invitation.html
If you want to add text to the program page, you must:
First, make a copy of the file : prestashop_root/modules/referralprogram/views/templates/front/program.tpl to prestashop_root/themes/my_theme/modules/referralprogram/views/templates/front/program.tpl
Then, you need to modify this file and add the text you want, where you want. To be translatable, your text must be added like this {l s='new text' mod='referralprogram'}.
Finally, you need to translate this text via the Localization > Traductions page of your BO and not directly in the fr.php file.
Do not hesitate if you need more information,
Paul.

Opencart display one module conents into another module

I'm having custom footer module in my template. Also i'm using testimonial module in the position content bottom. I'm trying to display testimonial inside custom footer.
To do this i simply copied testimonial.tpl and testimonial.php contents and pasted into customfooter.tpl and customfooter.php
After this i'm getting errors stating
undefined variable and class name already assigned error
Did you know how to do this?
See this answer for how to do use a module in a separate modification/controller
opencart - How to manually display a module inside a template file?
You simply need to change from the common/home to your module's controller and view files
please define variable.
how can you define i will show you.
catalog > controller > header.php
for static variable
$this->load->language('common/header');
$data['text_home'] = $this->language->get('text_home');
// Where language file in assign this variable with different language foler
$data['text_home'] = $this->url->link('information/contact');
and you can tpl file in use this varible.
<?php echo $text_home; ?>
make sure 100% erorr has not facing
for dynamic variable

Dynamic including/autoload of external TypoScript templates

Is it possible to include automatically all external TS templates in some folders to avoid manual linking ?
Instead of writing each time manually INCLUDE_TYPOSCRIPT like this :
Constants :
<INCLUDE_TYPOSCRIPT: source="FILE:fileadmin/templates/typoscript/setup/1.ts">
<INCLUDE_TYPOSCRIPT: source="FILE:fileadmin/templates/typoscript/setup/2.ts">
...
<INCLUDE_TYPOSCRIPT: source="FILE:fileadmin/templates/typoscript/setup/999.ts">
Setup :
<INCLUDE_TYPOSCRIPT: source="FILE:fileadmin/templates/typoscript/constants/1.ts">
<INCLUDE_TYPOSCRIPT: source="FILE:fileadmin/templates/typoscript/constants/2.ts">
...
<INCLUDE_TYPOSCRIPT: source="FILE:fileadmin/templates/typoscript/constants/999.ts">
I would like to have something like this instead of manual include file per file :
Constants :
<INCLUDE_TYPOSCRIPT_ALL: source="FILE:fileadmin/templates/typoscript/constants/">
Setup :
<INCLUDE_TYPOSCRIPT_ALL: source="FILE:fileadmin/templates/typoscript/setup/">
Recursive option could be helpful also.
Is it possible, or I need to hack the core to realize such functionality ?
The only way is including sub-files in one main file. It's similar approach like using #import in CSS files for including other substyles.
Then you can just include one file in your TS:
<INCLUDE_TYPOSCRIPT: source="FILE:fileadmin/templates/typoscript/setup/main.ts">
and at the main.ts you can paste additional includes