Posted on 22/06/2018 14:37:53
Why a template? In the end, all you need is HTML that gets sent to the browser. Here's an excerpt from the PostDanmark provider:
public override string RenderFrontend(Order order)
{
if (!string.IsNullOrEmpty(ShippingProviderTemplate))
{
var template = new Template(ShippingProviderTemplate);
if (string.IsNullOrEmpty(template.Html))
{
return string.Empty;
}
template.SetTag("Order.IsComplete", order.Complete);
template.SetTag("Order.Customer.Address", order.CustomerAddress);
template.SetTag("Order.Customer.Address2", order.CustomerAddress2);
template.SetTag("Order.Customer.City", order.CustomerCity);
template.SetTag("Order.Customer.Country", order.CustomerCountry);
template.SetTag("Order.Customer.Country.Code", order.CustomerCountryCode);
template.SetTag("Order.Customer.Region", order.CustomerRegion);
template.SetTag("Order.Customer.Zip", order.CustomerZip);
template.SetTag("Order.Customer.ZipCode", order.CustomerZip);
...
RenderServicePoint(GetServicePoint(order), template, true, "ServicePoint.");
return template.Output();
}
return base.RenderFrontend(order);
}
which is how I envisioned it: an interal template, that emits HTML in RenderFrontend.
Does that help?
Imar