Magento transactionnal emails order.getBillingAddress() - email

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.

Related

How to customize email template in crm 2016 by code

I am using CRM 2016, and trying to customize email template by adding a dynamic data. I know that CRM allows to use only specific vanilla entities, but when I explorer an old code I found an option to use {0}, {1} etc' for injecting data from non vanilla entities (by code) - unfortunately that code cannot be tested...
Have someone heard or know about that way? is it possible? what to google for?
You can do this by manually typing similar marker what CRM is using. Note that this is not documented in SDK.
Dynamic Values For Custom Entities In Email Templates
In the template, where you want the value to appear, type within 2 brackets an exclamation point followed by the entity logical name. After the entity name, add a colon, and then the field logical name, ending it with a semi colon. If you’d like a default value if nothing was found, after the semi colon add the default value.
{!<entitylogicalname>: <fieldlogicalname>; <Default Text>}
More in part 2:
The Global Template Type is what you’d want to use for custom
entities, or any other entity not listed in the template type drop
down menu. And just to reiterate, regardless of the way you insert
values, whether you use the out of the box insert method or you
manually type it in, you can only insert values from one record.
Dynamic Values For Email Templates - Part 2
Dynamics' email templates are flawed. You either can't use custom entities or you have no translation. I use this workflow instead. It can do everything : https://github.com/rtebar/dynamics-custom-emails

Specify table/column/cell widths in Outlook email from SAS

Is it possible to specify table/column/cell widths of a HTML table in Outlook using proc print?
I've tried defining templates and specifying via styles and the tagattr option.
Using the style= option on proc print.
Formatting emails for certain clients (Outlook, gmail, yahoo etc) is a job role all in itself. There are books written on the subject, but a primer can be found here. The short answer is that no, it is not possible using proc print.. instead you are going to have to generate very specific HTML and CSS in order to get around the rules applied by the Outlook rendering engine.
For instance, Outlook will strip all of your default styles - they have to be applied as attribute specific styles (eg <table style="width:300px">) .
Further tips here, but many can be found with a keyword search on "outlook email styles"..
No it is not possible. I just spent 4 hours trying every permutation of every option available.

Ordering Meetings Fields For SuiteCRM Calendar

In the SuiteCRM calendar the default for Meetings is to show the SUBJECT of the Meeting followed by the MEETING OBJECTIVES.
I want to modify it so that on the first line it shows the MEETING OBJECTIVES and the second line is the SUBJECT of the Meeting.
I've looked in modules/Calendar and modules/Meetings and I'm still a bit lost. Any idea on which file I need to modify to be able to change the order of these two fields?
Calendar module files are placed inside "modules/Calendar" folder. It contain tpl,js and php classes and functions for calendar module. "get_activities" function inside "modules/Calendar/CalendarActivity.php" actually load activities. You can change text here before it assigned to tpl/js file.
Further more you can also do changes inside this file: "modules/Calendar/Calendar.php" , see function "load_activities"
I think changing in JS should be last option because that is to complex and changes there need more time then doing it in alternative way in PHP file.

drupal form textfield name -value changed and does not validate any more

i have a checkout-page (drupal commerce) form with an address section generated by the module addressfield. currently all text-inputfields have this markup-structure:
<input class="last-name" id="edit-last-name" name="customer_profile_billing[commerce_customer_address][und][0][last_name]">
class + id + name
with this config they validate.
if i change the value of the name attribute the form doesnt validate anymore, the form says:
field XY is required
the form-validator obviously doesnt recognise my inputs.
question: how can i get the validation process to work with a modified name attribute?
You should not be altering the generated HTML in any way. Drupal provides a special way of handling forms and a special way to alter other modules forms. To change the form you should use the configuration options presented to you by the module. If those are insufficient you should create your own Drupal module and then implement hook_form_alter to change the other form. You will need to understand Drupal's hook system.

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!