Magento e-mail template not loading - email

Im trying to create a new e-mail template for customers.
Normaly you can load the basic one and adjust that. But for some reason it isn't loading anymore ( it was before )
I don't have a clue what could be wrong. some other templates are loading so it's not a jquery bug or anything like that. And if i go to app/locale/nl_NL/template/email/sales
The templates are just where they should be
Any ideas ?

check this points:
1) check system->configuration -> general->locale -> values is "dutch(Netherland)"
2) check app/locale/nl_NL/template/email/account_new.html file exist or not
3) check in app/code/core/Mage/Customer/etc/config.xml file following code is exist or not.
<template>
<email>
<customer_create_account_email_template translate="label" module="customer">
<label>New account</label>
<file>account_new.html</file>
<type>html</type>
</customer_create_account_email_template>
.........

Related

TYPO3 11 Sitepackage Tutorial expected template file Standard/1.html

TL;DR:
The Backend Layouts of the site package tutorial (Default/Standard and Two Columns) do not show up for new pages in Appearance -> Backend Layout. The error message in this thread (1.html) is an artefact of prior Backend Layouts which came from the original old site setup.
Solution:
To make the Backend Layouts of the site package tutorial show up there, I had to edit the root page of the site: Resources -> Include static Page TSconfig (from extensions) and add site-package from the Available Items list.
This can also be achieved without "Resources -> Include static Page TSconfig (from extensions)" but via file ext_localconf.php in the root of the site package extension (gpcf_theme):
<?php
defined('TYPO3_MODE') || die();
$boot = function (string $_EXTKEY): void {
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig('
<INCLUDE_TYPOSCRIPT: source="FILE:EXT:'.$_EXTKEY.'/Configuration/TsConfig/Page/Page.tsconfig">
');
};
$boot('gpcf_theme');
unset($boot);
Original Question:
I'm still trying to bring an existing (older) web page into Typo3 11 following the TYPO3 Sitepackage Tutorial.
Currently I get an
"Oops, an error occurred! Code: 202111161210589c32f8c0"
and can't get rid of it whatever I do.
The corresponding entry in the log files is (line breaks added by me):
../../var/log/typo3_61306f633c.log:Tue, 16 Nov 2021 12:10:58 +0000 [ALERT] request="30cc4e082c853"
component="TYPO3.CMS.Frontend.ContentObject.Exception.ProductionExceptionHandler":
Oops, an error occurred! Code: 202111161210589c32f8c0- InvalidTemplateResourceException:
Tried resolving a template file for controller action "Standard->1" in format ".html",
but none of the paths contained the expected template file (Standard/1.html).
The following paths were checked:
/var/www/html/typo3_11/public/typo3conf/ext/gpcf_theme/Resources/Private/Templates/Page/,
in file /var/www/html/typo3_11/vendor/typo3fluid/fluid/src/View/TemplatePaths.php
I can't find the reason of this error, because I have no idea, where the needed template Standard/1.html is requested from.
Is this some kind of hard coded default if nothing else is found?
If this is the case, the real problem is, that my customizations to the Sitepackage Tutorial source code seems to be wrong, but it never produced any different error despite the above one, which isn't really helpful. Ok, this is speculation, because I don't know.
As you can see, the site package was renamed to gpcf_theme, it's available in the backend and applied as root template to the site. No other template is active (AFAIK). A simple newly created test page creates above error.
If I uncomment in Configuration/TypoScript/Setup/Page.typoscript the lines so that:
page = PAGE
page {
typeNum = 0
10 = TEXT
10.value = Hello World!
}
same error, no hello world.
Any idea how to locate the reason for my misery?
Maybe the fix is really simple. Try to go into the backend:
Edit the homepage
To to the "Appearance" tab
Set the Backend Layout for this and subpages
Save your change
There is a good chance that it is working now.
Whats going on?
You can cast this query on your database:
SELECT
uid, pid, title, backend_layout, backend_layout_next_level
FROM
pages;
Here you get a list of pages, some with backend_layout and backend_layout_next_level filled. Most likely your home pages has some values in this fields?
The value of this field is generated by the TSConfig for backend layouts you set in:
https://docs.typo3.org/m/typo3/tutorial-sitepackage/11.5/en-us/ContentMapping/Index.html#dynamic-content-rendering-in-typoscript
This column is then read and processed in your TypoScript:
https://docs.typo3.org/m/typo3/tutorial-sitepackage/11.5/en-us/TypoScriptConfiguration/Index.html#part-1-fluid-template-section
It is explained below the code snippet.
If the 4 steps from the beginning of my answer did not solve your problem, then this are the places to look.
In TSConfig is the definition of the backend layouts, columns, labels and what is written in the pages.backend_layout db-field
DB columns if the value makes sense pagets__<yourTemplateName>
The TypoScript that reads this db-field cuts of the pagets__ takes the rest, adds .html and searches in the paths defined in the TypoScript below.
check if the Folder and Filename of your Template file are correct.
the error message states that the file 1.html is expected in the folder /var/www/html/typo3_11/public/typo3conf/ext/gpcf_theme/Resources/Private/Templates/Page/
as you noted that you have renamed the site package you may have missed some occurrences of the original package name and so some configuration is missing or pointing to nirvana.

Magento 2 - Edit Invoice PDF in a custom theme

I want to edit the printable PDF invoice in Magento 2. To do this, I need to edit:
vendor/magento/module-sales/Model/Order/Pdf/AbstractPdf.php
But, what is the path I need so it does not get overridden during upgrade. I know the path should be something like this (but i cant figure it out):
/app/design/frontend/Vendor/Theme/Magento_Sales/ ? / ? / AbstractPdf.php
With templates, I know the path is /template/...but this is a Model - so Im not sure I know how that works.
The path is the same as is in module-sales, so: /app/design/frontend/Vendor/Theme/Magento_Sales/Model/Order/Pdf/AbstractPdf.php
is where to put it.

image showing like <img alt="" index.jpg"}}"="" wysiwyg="" src="{{media url="> in magento frontend

I have added one custom attribute in category section in admin.
when I have uploaded image, it's look like
in frontend.
I have use $_category->getBannername(); code for display attribute in magento frontend on category page.
Please help
Thanks in advance.
Use the Below Code :
<?php echo Mage::helper('cms')->getBlockTemplateProcessor()->filter($text);?>
Go to System -> Configuration -> Catalogue -> frontend and check option:
Allow Dynamic Media URLs in Products and Categories set it as "Yes"
Underneath that dropdown you can see comment as below too.
E.g. {{media url="path/to/image.jpg"}} {{skin url="path/to/picture.gif"}}. Dynamic directives parsing impacts catalog performance.
This worked for me
<?php echo Mage::helper('cms')->getBlockTemplateProcessor()->filter($text);?>
app/code/core/Mage/Cms/Helper/Wysiwyg/Images.php
replace (line 178)
$directive = sprintf('{{media url="%s"}}', $mediaPath);
with
$directive = sprintf("{{media url='%s'}}", $mediaPath);

Magento transactionnal emails order.getBillingAddress()

I'm searching the block that is called when I used the var {{var order.getBillingAddress().format('html')}} in order_new.html email template.
I need to remove some information displayed by this block.
Thank for your precious help.
The formatting of the address is done in the class Mage_Customer_Block_Address_Renderer_Default.
The best way to remove some data from the rendered address is by adjusting the address templates. In order to do that let me explain how Magento chooses an address template.
1) In a nutshell, first Magento tries to load a format template from the table directory_country_format for the specified type (html, pdf, oneline, text). This gives Magento the capability to have country specific address templates.
If it doesn't find one, it will use the format template from the configuration, using the xpath customer/address_templates/$type.
The defaults can be found in the Mage/Customer/etc/config.xml file.
They can be overridden using the system configuration interface found under System > Config > Customer Configuration > Address Templates on a store level.

Editing Magento sales e-mail payment block

app\locale\en_US\template\email\sales\order_new.html is the file in question.
How would one go about editing {{var payment_html}} without affecting other sections of the site?
It seems like the section comes from: app\design\frontend\base\default\template\payment\info\default.phtml
Am I correct about this? But that file is used in other places on the site. Is that correct too?
I want to create a separate file, say default_email.phtml, style it separately, and have order_new.phtml include the new file instead.
I assume that I need to include my default_email.phtml file in layout\***.xml. Where would I do this?
The first thing I did was a search in the source code of Magento. Assuming the {{var payment_html}} is processed somewhere I searched on payment_html.
Several results are matching the search;
Mage_Sales_Model_Order
Mage_Sales_Model_Order_Creditmemo
Mage_Sales_Model_Order_Invoice
Mage_Sales_Model_Order_Shipment
So the information for that payment block has to be in there. I took Mage_Sales_Model_Order and checked the variable $paymentBlockHtml. This is pointed to further logic to fill the payment block by payment information. It's creating a block and it looks like this is not easy to extend/change/modify on the first look.
Yes, we can apply a template to the specific (payment) block type since there’s a block created, but we can’t easily check which block we want to load. Also the template is overruled in the construct of Mage_Payment_Block_Info
Let’s check the other way.
Let’s do something cool, why we don’t add a block to the email which contains the correct information but more important where it’s possible to make a switch to the correct case. Since template parser is used for parsing the variables and layout handles we could add the following on instead of the {{var payment_html}} block and retrieving that information in the block itself.
{{block type='core/template' template='email/templatename.phtml'}}
The above code is parsing the email/templatename.phtml into the email, which means that you could do anything in that template to show the correct data.
Before we can retrieve the payment data in this template we have to add the order argument with the order data. That’s quite simple;
{{block type='core/template' order=$order template='email/templatename.phtml'}}
In the template we can do $this->getOrder()->getPayment() to retrieve the payment information, or $this->getOrder->getPayment()->toHtml() or process the data in another way.
Bonus;
Another solution is working with layout handles and set the correct template and type in the layout.xml, below an example for the order items in the same email. It’s working the same as the block, but only with some settings in the layout xml.
{{layout handle="sales_email_order_items" order=$order}}
In /app/code/core/Mage/Sales/Model/Order.php there is a method called "sendNewOrderEmail". This is what you need to affect. You will find code simmilar to the following:
$mailTemplate->setDesignConfig(array('area'=>'frontend', 'store'=>$this->getStoreId()))
->sendTransactional(
$template,
Mage::getStoreConfig(self::XML_PATH_EMAIL_IDENTITY, $this->getStoreId()),
$recipient['email'],
$recipient['name'],
array(
'order' => $this,
'billing' => $this->getBillingAddress(),
'payment_html' => $paymentBlock->toHtml(), //Just change this line
)
);
You can see that this is where the "payment_html" data gets set. Just swap it out to what you want it to be.
I had the same issue. What I did to only change the email was add the following to the payment info class.
protected function _construct() {
parent::_construct();
$this->setTemplate('payment/info/{new template}.phtml');
}
Then create the template and the email will insert this template to the payment section if this payment method is used.
Hope that's helpful!