Magento 2 - Include Custom Attribute to Email Template - attributes

I want add Attributes that are on the Product to an Email Template - for example - a custom attribute I have added to appear on the shipping email template.
I have successfully added a new template and that is working fine - I just can't 'get' the infomation on to it.
For example - I have added both: (for the attribute eco_collection
{{var order.getEcoCollection()}}
{{var EcoCollection|raw}}
to no effect.

Related

Druplal view in twig is not rendered

new to drupal.
I have created a view called "my_view_2".
Inside my twig templates I use {{ my_view_2}} to render that view but nothing appears on the page.
If I declare the display of the view as page and assign a node to the view, then the view is rendered. But this way the node template is lost.
The above happens only to some views not very view I have and I can not find the differences between those that working and those that does not working.
any help is appreciated.
Looks like you want to create a view with some kind of display then use twig template to style it. If that's the case, then decide which twig template you want override and copy it over to your /theme folder.
Locate the template you wish to override.
Copy the template file from its base location into your theme folder.
(optionally) Rename the template according to the naming conventions in order to target a more specific subset of areas where the template is used.
Modify the template as you want.
With respect to views look at the below location for which template to copy/override :
core/themes/stable/templates/views/views-view.html.twig).
For example, if we want to override "views-view.html.twig" template for our view, the following template names are valid:
views-view--[viewid]--[view-display-id].html.twig
views-view--[viewid]--page.html.twig
views-view--block.html.twig
views-view--[viewid].html.twig
views-view.html.twig
Once you copy a template file into your theme and clear the cache, Drupal will start using your instance of the template file instead of the base version.
Reference:
Documentation:
https://www.drupal.org/docs/8/theming/twig/twig-template-naming-conventions
https://www.drupal.org/docs/8/theming/twig/working-with-twig-templates

Access portlet namespace in Freemarker template

I'm using a freemarker template to display web contents listed in an asset publisher.
In the template I'm trying to assign the portlet-namespace in order to use some asset features (like printing the entry) like this
<#attempt>
<#assign namespace = request["portlet-namespace"]>
<#recover>
<#assign namespace = 'undefined'>
</#attempt>
So, the print button is holding te code below
<a href="javascript:${namespace}printPage_0();" title='Print'>
printPage is the method used in liferay asset publisher code in asset_print.jspf
Well, everything is working fine: when inspecting the page in a browser, I verified that the namespace has been calculated and assigned to namespace variable as well (and no error displayed in UI). However, liferay portal logs the following each time a user tries to see the whole web content (ie. clicks on read more) from the asset publisher
Expression request["portlet-namespace"] is undefined on line
Anyone has seen this problem ? Is there another way to get the portlet-namespace in a freemarker template ?
#attempt/#recover is not for recovering from normal situations, and by default it logs the error when it recovers (so that the operators will be alerted). You should instead use the exp!default operator:
<#assign namespace = request["portlet-namespace"]!'undefined'>
(Though I'm not sure why printing undefinedprintPage_0(); makes sense, but that's a different issue.)

Bolt-CMS Using extensions in page?

I read this from a recent answer to a question:
After enabling the extension, just use {{ twitterfeed() }} in your templates.
But, what if I only want say a contact form on one page? Putting the tag in the page's text field doesn't work. And putting it in the template would have it available on all the pages using that template. Do I have to duplicate a template to use only for the contact page? If not where do I put the contact form tag?
I went to Bolt's extension page, selected "how to use extensions" from the menu, and got this message:
No proper name for a page in the docs. Bye!
Perhaps someone at Bolt could fix the URL?
I would like to know why none of the extensions I want to use are not working. I am clearly missing a vital piece of info.
Thank you.
After enabling the extension, just use {{ twitterfeed() }} in your templates.
The Twig function {{ twitterfeed() }} belongs (generally speaking) in a Twig template file. You can use Twig in record fields, but that requires setting allowtwig: true for that Contenttype field.
But, what if I only want say a contact form on one page?
There are a few ways to do this, but the easiest way is to make a copy of your sites template file for the page's Contenttype and select that template for the 'Contact' record. The default 'pages' Contenttype that comes with Bolt has a templateselect field type that enables this.
No proper name for a page in the docs. Bye!
Fixed! Thanks for pointing it out.

Call a string value to create a meta tag?

I need to create meta tags for the seo of my website.
I am using WHMCS and a custom template
Any page is compiled through the header.tpl, footer.php page1.tpl and page1.php pages
What I tried was to add
">
to header.tpl which does add the line of code to the "output source"
and I added
$pgDesc = 'Any custom description';
to the page1.php
Somehow the echo $pgDesc does not call the value correct
Any ideas ?
Just add your metatags to header.tpl. And that's all. You can get your title/desctiption/keywords strings from various sources: whmcs variables, translation strings, and even some db.
See http://docs.whmcs.com/Seo

Contents of h:head are not getting updated while using template in JSF (ICEFACES)

Requirement:
Adding javascript file for a given page (which uses templates).
Details:
After successful login, user is navigated to a page, where he can perform different actions.
I have used common template in all the pages (apart from login page).
The template contains head tag, code for including header, footer and body (in which dynamic content will be included).
I observed that contents of head tag of the template are not getting updated (i.e. title tag, script tag).
The contents of head tag remains same as that of login page and also the URL of my browser.
Can you please let me know the possible cause for above.
It is probably related to the fact partial updates require id of a tag to be updated and html head element does not support id. There is no address in the html to apply update to. Icefaces are using partial updates heavily. You can try to enforce full update upon interaction which triggers changes to head element.

Resources