Since it's possible to put html on service name in #display_title in hook_commerce_shipping_service_info(), it should be allowed in checkout/review to.
So in commerce_shipping_pane_review, replace @service by !service.
Example :
/**
* Implements hook_commerce_shipping_service_info().
*/
function chronopost_shipping_commerce_shipping_service_info() {
$shipping_services['chronopost'] = array(
'title' => t('Chronopost'),
'description' => t('Home delivery.'),
'display_title' => '<span id="chronopost-logo"></span>' . t('Chronopost'),
'shipping_method' => 'chronopost',
'price_component' => 'shipping',
'callbacks' => array(
'rate' => 'chronopost_default_service_rate',
),
);
return $shipping_services;
}
in commerce_shipping.checkout_pane.inc, replace @service by !service to allowed html markup.
/**
* Checkout pane callback: show the selected shipping service on the review pane.
*/
function commerce_shipping_pane_review($form, $form_state, $checkout_pane, $order) {
$order_wrapper = entity_metadata_wrapper('commerce_order', $order);
// Loop over all the line items on the order.
foreach ($order_wrapper->commerce_line_items as $delta => $line_item_wrapper) {
// If the current line item is a shipping line item...
if ($line_item_wrapper->type->value() == 'shipping') {
// Return its label and formatted total price.
$total_price = $line_item_wrapper->commerce_total->value();
$rate = commerce_currency_format($total_price['amount'], $total_price['currency_code'], $line_item_wrapper->value());
return t('!service: @rate', array('!service' => $line_item_wrapper->line_item_label->value(), '@rate' => $rate));
}
}
}
Comments
Comment #1
goz commentedComment #2
goz commentedHere patch to make this.
Comment #3
goz commentedComment #4
joelpittet@GoZ let's do this for both. The rate is already escaped heavily in commerce_currency_format().
In my case I've overridden that format_callback and wrapped the code and symbol in a span tag for styling purposes and escaped the variable going into them.
Comment #5
joelpittetAnd if this can't make it in, we can fallback to hook_commerce_checkout_pane_info_alter;)
Comment #6
googletorp commentedSorry for missing this.
I don't see why we shouldn't include this, review and committed.
Comment #7
googletorp commented