75 $this->_taxHelper = $taxHelper;
76 $this->_addressConfig = $addressConfig;
77 parent::__construct($context,
$data);
99 return $this->_quote->getBillingAddress();
109 if ($this->_quote->getIsVirtual()) {
112 return $this->_quote->getShippingAddress();
121 public function renderAddress(
$address)
124 $renderer = $this->_addressConfig->getFormatByCode(
'html')->getRenderer();
137 if (
$name = $this->_scopeConfig->getValue(
138 "carriers/{$carrierCode}/title",
139 \
Magento\Store\Model\ScopeInterface::SCOPE_STORE
155 if (
$rate->getErrorMessage()) {
158 return $rate->getCode();
171 $renderedInclTax =
'';
172 if (
$rate->getErrorMessage()) {
177 $this->_taxHelper->displayShippingPriceIncludingTax()
181 if ($incl !=
$price && $this->_taxHelper->displayShippingBothPrices()) {
182 $renderedInclTax = sprintf($inclTaxFormat, $this->
escapeHtml(
__(
'Incl. Tax')), $incl);
227 $this->_controllerPath =
$prefix;
239 return $this->
_formatPrice($this->_taxHelper->getShippingPrice(
$price, $isInclTax, $this->_address));
250 return $this->priceCurrency->convertAndFormat(
254 $this->_quote->getStore()
266 $methodInstance = $this->_quote->getPayment()->getMethodInstance();
267 $this->setPaymentMethodTitle($methodInstance->getTitle());
269 $this->setShippingRateRequired(
true);
270 if ($this->_quote->getIsVirtual()) {
271 $this->setShippingRateRequired(
false);
274 $this->_address = $this->_quote->getShippingAddress();
275 $groups = $this->_address->getGroupedAllShippingRates();
276 if ($groups && $this->_address) {
277 $this->setShippingRateGroups($groups);
281 if ($this->_address->getShippingMethod() ==
$rate->getCode()) {
282 $this->_currentShippingRate =
$rate;
289 $canEditShippingAddress = $this->_quote->getMayEditShippingAddress() && $this->_quote->getPayment()
292 $this->setShippingMethodSubmitUrl(
293 $this->
getUrl(
"{$this->_controllerPath}/saveShippingMethod", [
'_secure' =>
true])
294 )->setCanEditShippingAddress(
295 $canEditShippingAddress
296 )->setCanEditShippingMethod(
297 $this->_quote->getMayEditShippingMethod()
302 $this->
getUrl(
"{$this->_controllerPath}/edit")
304 $this->
getUrl(
"{$this->_controllerPath}/placeOrder", [
'_secure' =>
true])
307 return parent::_beforeToHtml();
__construct(\Magento\Framework\View\Element\Template\Context $context, \Magento\Tax\Helper\Data $taxHelper, \Magento\Customer\Model\Address\Config $addressConfig, PriceCurrencyInterface $priceCurrency, array $data=[])
_getShippingPrice($price, $isInclTax)
getData($key='', $index=null)
getCarrierName($carrierCode)
escapeHtml($data, $allowedTags=null)
static toFlatArray($data)
getUrl($route='', $params=[])
renderShippingRateValue(\Magento\Framework\DataObject $rate)
setControllerPath($prefix)
setQuote(\Magento\Quote\Model\Quote $quote)
const PAYMENT_INFO_BUTTON
renderShippingRateOption($rate, $format='%s - %s%s', $inclTaxFormat='(%s %s)')
if(!isset($_GET['name'])) $name