From 9e3b5bce4039c1f9ce2da6d88f55e9a36750891c Mon Sep 17 00:00:00 2001 From: Igor Date: Mon, 6 Jan 2014 11:49:48 +0200 Subject: [PATCH] Use translates for Quote\Address\Total\Shipping Use case: We should disable visibility of Shipping & Handling description in some theme(for example block with totals is very small). Before this change, we should rewrite this block and make some changes. After - we may add some translation to translate.csv file in some theme --- .../Magento/Sales/Model/Quote/Address/Total/Shipping.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Sales/Model/Quote/Address/Total/Shipping.php b/app/code/Magento/Sales/Model/Quote/Address/Total/Shipping.php index 94b704018ed35..39a4cd56d79b3 100644 --- a/app/code/Magento/Sales/Model/Quote/Address/Total/Shipping.php +++ b/app/code/Magento/Sales/Model/Quote/Address/Total/Shipping.php @@ -182,10 +182,9 @@ public function fetch(\Magento\Sales\Model\Quote\Address $address) { $amount = $address->getShippingAmount(); if ($amount != 0 || $address->getShippingDescription()) { - $title = __('Shipping & Handling'); - if ($address->getShippingDescription()) { - $title .= ' (' . $address->getShippingDescription() . ')'; - } + $shippingDescription = $address->getShippingDescription(); + $title = $shippingDescription ? __('Shipping & Handling (%s)', $shippingDescription) : __('Shipping & Handling'); + $address->addTotal(array( 'code' => $this->getCode(), 'title' => $title,