Commit f5332f12 by lmf

移除默认checkout和paypal

parent 5ff406bd
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<block class="Magento\Cookie\Block\RequireCookie" name="require-cookie" template="Magento_Cookie::require_cookie.phtml">
<arguments>
<argument name="triggers" xsi:type="array">
<item name="addToCartLink" xsi:type="string">.action.tocart</item>
</argument>
</arguments>
</block>
</referenceContainer>
</body>
</page>
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<block class="Magento\Cookie\Block\RequireCookie" name="require-cookie" template="Magento_Cookie::require_cookie.phtml">
<arguments>
<argument name="triggers" xsi:type="array">
<item name="addToCartLink" xsi:type="string">.action.tocart</item>
</argument>
</arguments>
</block>
</referenceContainer>
</body>
</page>
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
<link src="Magento_Checkout::js/view/configure/product-customer-data.js"/>
</head>
<update handle="catalog_product_view"/>
<body>
<referenceBlock name="head.components">
<block class="Magento\Framework\View\Element\Js\Components" name="checkout_cart_configure_head_components" template="Magento_Checkout::js/components.phtml"/>
</referenceBlock>
<referenceBlock name="product.info">
<block class="Magento\Checkout\Block\Cart\Item\Configure" name="checkout.cart.item.configure.block"/>
</referenceBlock>
<referenceBlock name="product.info.addtocart">
<action method="setTemplate">
<argument name="template" xsi:type="string">Magento_Checkout::cart/item/configure/updatecart.phtml</argument>
</action>
</referenceBlock>
<referenceBlock name="product.info.addtocart.additional">
<action method="setTemplate">
<argument name="template" xsi:type="string">Magento_Checkout::cart/item/configure/updatecart.phtml</argument>
</action>
</referenceBlock>
</body>
</page>
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<update handle="catalog_product_view_type_simple"/>
<body/>
</page>
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<update handle="checkout_item_price_renderers"/>
<body>
<referenceBlock name="checkout.cart.item.renderers">
<block class="Magento\Checkout\Block\Cart\Item\Renderer" name="checkout.cart.item.renderers.default" as="default" template="Magento_Checkout::cart/item/default.phtml">
<block class="Magento\Checkout\Block\Cart\Item\Renderer\Actions" name="checkout.cart.item.renderers.default.actions" as="actions">
<block class="Magento\Checkout\Block\Cart\Item\Renderer\Actions\Edit" name="checkout.cart.item.renderers.default.actions.edit" template="Magento_Checkout::cart/item/renderer/actions/edit.phtml"/>
<block class="Magento\Checkout\Block\Cart\Item\Renderer\Actions\Remove" name="checkout.cart.item.renderers.default.actions.remove" template="Magento_Checkout::cart/item/renderer/actions/remove.phtml"/>
</block>
</block>
<block class="Magento\Checkout\Block\Cart\Item\Renderer" name="checkout.cart.item.renderers.simple" as="simple" template="Magento_Checkout::cart/item/default.phtml">
<block class="Magento\Checkout\Block\Cart\Item\Renderer\Actions" name="checkout.cart.item.renderers.simple.actions" as="actions">
<block class="Magento\Checkout\Block\Cart\Item\Renderer\Actions\Edit" name="checkout.cart.item.renderers.simple.actions.edit" template="Magento_Checkout::cart/item/renderer/actions/edit.phtml"/>
<block class="Magento\Checkout\Block\Cart\Item\Renderer\Actions\Remove" name="checkout.cart.item.renderers.simple.actions.remove" template="Magento_Checkout::cart/item/renderer/actions/remove.phtml"/>
</block>
</block>
</referenceBlock>
</body>
</page>
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="minicart">
<block class="Magento\Checkout\Block\Item\Price\Renderer" name="checkout.cart.item.price.sidebar" template="Magento_Checkout::cart/item/price/sidebar.phtml"/>
<arguments>
<argument name="jsLayout" xsi:type="array">
<item name="components" xsi:type="array">
<item name="minicart_content" xsi:type="array">
<item name="children" xsi:type="array">
<item name="item.renderer" xsi:type="array">
<item name="children" xsi:type="array">
<item name="checkout.cart.item.price.sidebar" xsi:type="array">
<item name="component" xsi:type="string">uiComponent</item>
<item name="config" xsi:type="array">
<item name="template" xsi:type="string">Magento_Checkout/minicart/item/price</item>
<item name="displayArea" xsi:type="string">priceSidebar</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</argument>
</arguments>
</referenceBlock>
</body>
</page>
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="minicart">
<arguments>
<argument name="jsLayout" xsi:type="array">
<item name="components" xsi:type="array">
<item name="minicart_content" xsi:type="array">
<item name="config" xsi:type="array">
<item name="itemRenderer" xsi:type="array">
<item name="default" xsi:type="string">defaultRenderer</item>
<item name="simple" xsi:type="string">defaultRenderer</item>
<item name="virtual" xsi:type="string">defaultRenderer</item>
</item>
</item>
<item name="children" xsi:type="array">
<item name="item.renderer" xsi:type="array">
<item name="component" xsi:type="string">Magento_Checkout/js/view/cart-item-renderer</item>
<item name="config" xsi:type="array">
<item name="displayArea" xsi:type="string">defaultRenderer</item>
<item name="template" xsi:type="string">Magento_Checkout/minicart/item/default</item>
</item>
<item name="children" xsi:type="array">
<item name="item.image" xsi:type="array">
<item name="component" xsi:type="string">Magento_Catalog/js/view/image</item>
<item name="config" xsi:type="array">
<item name="template" xsi:type="string">Magento_Catalog/product/image</item>
<item name="displayArea" xsi:type="string">itemImage</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</argument>
</arguments>
</referenceBlock>
</body>
</page>
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="minicart">
<arguments>
<argument name="jsLayout" xsi:type="array">
<item name="components" xsi:type="array">
<item name="minicart_content" xsi:type="array">
<item name="children" xsi:type="array">
<item name="subtotal.container" xsi:type="array">
<item name="children" xsi:type="array">
<item name="subtotal" xsi:type="array">
<item name="children" xsi:type="array">
<item name="subtotal.totals" xsi:type="array">
<item name="component" xsi:type="string">Magento_Checkout/js/view/checkout/minicart/subtotal/totals</item>
<item name="config" xsi:type="array">
<item name="template" xsi:type="string">Magento_Checkout/minicart/subtotal/totals</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</argument>
</arguments>
</referenceBlock>
</body>
</page>
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<block class="Magento\Checkout\Block\Item\Price\Renderer" name="checkout.item.price.unit" template="Magento_Checkout::item/price/unit.phtml"/>
<block class="Magento\Checkout\Block\Item\Price\Renderer" name="checkout.item.price.row" template="Magento_Checkout::item/price/row.phtml"/>
<block class="Magento\Checkout\Block\Item\Price\Renderer" name="checkout.onepage.review.item.price.unit.excl" template="Magento_Checkout::onepage/review/item/price/unit_excl_tax.phtml"/>
<block class="Magento\Checkout\Block\Item\Price\Renderer" name="checkout.onepage.review.item.price.unit.incl" template="Magento_Checkout::onepage/review/item/price/unit_incl_tax.phtml"/>
<block class="Magento\Checkout\Block\Item\Price\Renderer" name="checkout.onepage.review.item.price.rowtotal.excl" template="Magento_Checkout::onepage/review/item/price/row_excl_tax.phtml"/>
<block class="Magento\Checkout\Block\Item\Price\Renderer" name="checkout.onepage.review.item.price.rowtotal.incl" template="Magento_Checkout::onepage/review/item/price/row_incl_tax.phtml"/>
</body>
</page>
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="page.main.title">
<action method="setPageTitle">
<argument translate="true" name="title" xsi:type="string">The order was not successful!</argument>
</action>
</referenceBlock>
<referenceContainer name="content">
<block class="Magento\Checkout\Block\Onepage\Failure" name="checkout.failure" template="Magento_Checkout::onepage/failure.phtml"/>
</referenceContainer>
</body>
</page>
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<update handle="checkout_item_price_renderers"/>
<body>
<referenceBlock name="checkout.onepage.review.item.renderers">
<block class="Magento\Checkout\Block\Cart\Item\Renderer" name="checkout.onepage.review.item.renderers.default" as="default" template="Magento_Checkout::onepage/review/item.phtml"/>
</referenceBlock>
</body>
</page>
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
<title>Success Page</title>
</head>
<body>
<referenceBlock name="page.main.title">
<block class="Magento\Checkout\Block\Onepage\Success" name="checkout.success.print.button" template="Magento_Checkout::button.phtml"/>
<action method="setPageTitle">
<argument translate="true" name="title" xsi:type="string">Thank you for your purchase!</argument>
</action>
</referenceBlock>
<referenceContainer name="content">
<block class="Magento\Checkout\Block\Onepage\Success" name="checkout.success" template="Magento_Checkout::success.phtml" cacheable="false">
<container name="order.success.additional.info" label="Order Success Additional Info"/>
</block>
<block class="Magento\Checkout\Block\Registration" name="checkout.registration" template="Magento_Checkout::registration.phtml" cacheable="false"/>
</referenceContainer>
</body>
</page>
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<update handle="checkout_cart_sidebar_item_renderers"/>
<update handle="checkout_cart_sidebar_item_price_renderers"/>
<update handle="checkout_cart_sidebar_total_renderers"/>
<body>
<referenceBlock name="head.components">
<block class="Magento\Framework\View\Element\Js\Components" name="checkout_page_head_components" template="Magento_Checkout::js/components.phtml"/>
</referenceBlock>
<referenceContainer name="header-wrapper">
<block class="Magento\Checkout\Block\Cart\Sidebar" name="minicart" as="minicart" after="logo" template="Magento_Checkout::cart/minicart.phtml">
<arguments>
<argument name="jsLayout" xsi:type="array">
<item name="types" xsi:type="array"/>
<item name="components" xsi:type="array">
<item name="minicart_content" xsi:type="array">
<item name="component" xsi:type="string">Magento_Checkout/js/view/minicart</item>
<item name="config" xsi:type="array">
<item name="template" xsi:type="string">Magento_Checkout/minicart/content</item>
</item>
<item name="children" xsi:type="array">
<item name="subtotal.container" xsi:type="array">
<item name="component" xsi:type="string">uiComponent</item>
<item name="config" xsi:type="array">
<item name="displayArea" xsi:type="string">subtotalContainer</item>
</item>
<item name="children" xsi:type="array">
<item name="subtotal" xsi:type="array">
<item name="component" xsi:type="string">uiComponent</item>
<item name="config" xsi:type="array">
<item name="template" xsi:type="string">Magento_Checkout/minicart/subtotal</item>
</item>
</item>
</item>
</item>
<item name="extra_info" xsi:type="array">
<item name="component" xsi:type="string">uiComponent</item>
<item name="config" xsi:type="array">
<item name="displayArea" xsi:type="string">extraInfo</item>
</item>
</item>
<item name="promotion" xsi:type="array">
<item name="component" xsi:type="string">uiComponent</item>
<item name="config" xsi:type="array">
<item name="displayArea" xsi:type="string">promotion</item>
</item>
</item>
</item>
</item>
</item>
</argument>
</arguments>
<container name="minicart.addons" label="Mini-cart promotion block"/>
</block>
</referenceContainer>
</body>
</page>
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
?>
<?php /** @var $block \Magento\Checkout\Block\Onepage\Success */ ?>
<?php if ($block->getCanViewOrder() && $block->getCanPrintOrder()) :?>
<a href="<?= $block->escapeUrl($block->getPrintUrl()) ?>"
class="action print"
target="_blank"
rel="noopener">
<?= $block->escapeHtml(__('Print receipt')) ?>
</a>
<?= $block->getChildHtml() ?>
<?php endif;?>
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
?>
<?php
/**
* Shopping cart template
*
* @var $block \Magento\Checkout\Block\Cart
*/
if ($block->getItemsCount()) {
// phpcs:ignore Magento2.Security.LanguageConstruct.DirectOutput
echo $block->getChildHtml('with-items');
} else {
// phpcs:ignore Magento2.Security.LanguageConstruct.DirectOutput
echo $block->getChildHtml('no-items');
}
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
?>
<?php
/**
* Shopping cart additional info
* @var $block \Magento\Framework\View\Element\Template
*/
?>
<?php
$name = $block->getNameInLayout();
foreach ($block->getChildNames($name) as $childName) {
// phpcs:ignore Magento2.Security.LanguageConstruct.DirectOutput
echo $block->getChildBlock($childName)->setItem($block->getItem())->toHtml();
}
?>
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/**
* @var \Magento\Framework\View\Element\AbstractBlock $block
*/
// We should use strlen function because coupon code could be "0", converted to bool will lead to false
$hasCouponCode = (bool) strlen($block->getCouponCode());
?>
<div class="block discount"
id="block-discount"
data-mage-init='{"collapsible":{"active": <?= $hasCouponCode ? 'true' : 'false' ?>, "openedState": "active", "saveState": false}}'
>
<div class="title" data-role="title">
<strong id="block-discount-heading" role="heading" aria-level="2"><?= $block->escapeHtml(__('Apply Discount Code')) ?></strong>
</div>
<div class="content" data-role="content" aria-labelledby="block-discount-heading">
<form id="discount-coupon-form"
action="<?= $block->escapeUrl($block->getUrl('checkout/cart/couponPost')) ?>"
method="post"
data-mage-init='{"discountCode":{"couponCodeSelector": "#coupon_code",
"removeCouponSelector": "#remove-coupon",
"applyButton": "button.action.apply",
"cancelButton": "button.action.cancel"}}'>
<div class="fieldset coupon<?= $hasCouponCode ? ' applied' : '' ?>">
<input type="hidden" name="remove" id="remove-coupon" value="0" />
<div class="field">
<label for="coupon_code" class="label"><span><?= $block->escapeHtml(__('Enter discount code')) ?></span></label>
<div class="control">
<input type="text"
class="input-text"
id="coupon_code"
name="coupon_code"
value="<?= $block->escapeHtmlAttr($block->getCouponCode()) ?>"
placeholder="<?= $block->escapeHtmlAttr(__('Enter discount code')) ?>"
<?php if ($hasCouponCode) :?>
disabled="disabled"
<?php endif; ?>
/>
</div>
</div>
<div class="actions-toolbar">
<?php if (!$hasCouponCode) :?>
<div class="primary">
<button class="action apply primary" type="button" value="<?= $block->escapeHtmlAttr(__('Apply Discount')) ?>">
<span><?= $block->escapeHtml(__('Apply Discount')) ?></span>
</button>
</div>
<?php else :?>
<div class="primary">
<button type="button" class="action cancel primary" value="<?= $block->escapeHtmlAttr(__('Cancel Coupon')) ?>"><span><?= $block->escapeHtml(__('Cancel Coupon')) ?></span></button>
</div>
<?php endif; ?>
</div>
</div>
<?php if (!$hasCouponCode) : ?>
<?= /* @noEscape */ $block->getChildHtml('captcha') ?>
<?php endif; ?>
</form>
</div>
</div>
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
// phpcs:disable Magento2.Templates.ThisInTemplate
/** @var $block \Magento\Checkout\Block\Cart\Grid */
?>
<?php $mergedCells = ($this->helper(Magento\Tax\Helper\Data::class)->displayCartBothPrices() ? 2 : 1); ?>
<?= $block->getChildHtml('form_before') ?>
<form action="<?= $block->escapeUrl($block->getUrl('checkout/cart/updatePost')) ?>"
method="post"
id="form-validate"
data-mage-init='{"Magento_Checkout/js/action/update-shopping-cart":
{"validationURL" : "<?= $block->escapeUrl($block->getUrl('checkout/cart/updateItemQty')) ?>",
"updateCartActionContainer": "#update_cart_action_container"}
}'
class="form form-cart">
<?= $block->getBlockHtml('formkey') ?>
<div class="cart table-wrapper<?= $mergedCells == 2 ? ' detailed' : '' ?>">
<?php if ($block->getPagerHtml()): ?>
<div class="cart-products-toolbar cart-products-toolbar-top toolbar"
data-attribute="cart-products-toolbar-top"><?= $block->getPagerHtml() ?>
</div>
<?php endif ?>
<table id="shopping-cart-table"
class="cart items data table"
data-mage-init='{"shoppingCart":{"emptyCartButton": ".action.clear",
"updateCartActionContainer": "#update_cart_action_container"}}'>
<caption class="table-caption"><?= $block->escapeHtml(__('Shopping Cart Items')) ?></caption>
<thead>
<tr>
<th class="col item" scope="col"><span><?= $block->escapeHtml(__('Item')) ?></span></th>
<th class="col price" scope="col"><span><?= $block->escapeHtml(__('Price')) ?></span></th>
<th class="col qty" scope="col"><span><?= $block->escapeHtml(__('Qty')) ?></span></th>
<th class="col subtotal" scope="col"><span><?= $block->escapeHtml(__('Subtotal')) ?></span></th>
</tr>
</thead>
<?php foreach ($block->getItems() as $_item): ?>
<?= $block->getItemHtml($_item) ?>
<?php endforeach ?>
</table>
<?php if ($block->getPagerHtml()): ?>
<div class="cart-products-toolbar cart-products-toolbar-bottom toolbar"
data-attribute="cart-products-toolbar-bottom"><?= $block->getPagerHtml() ?>
</div>
<?php endif ?>
</div>
<div class="cart main actions">
<?php if ($block->getContinueShoppingUrl()): ?>
<a class="action continue"
href="<?= $block->escapeUrl($block->getContinueShoppingUrl()) ?>"
title="<?= $block->escapeHtml(__('Continue Shopping')) ?>">
<span><?= $block->escapeHtml(__('Continue Shopping')) ?></span>
</a>
<?php endif; ?>
<?php if ($block->getViewModel()->isClearShoppingCartEnabled()): ?>
<button type="button"
name="update_cart_action"
data-cart-empty=""
value="empty_cart"
title="<?= $block->escapeHtml(__('Clear Shopping Cart')) ?>"
class="action clear" id="empty_cart_button">
<span><?= $block->escapeHtml(__('Clear Shopping Cart')) ?></span>
</button>
<?php endif ?>
<button type="submit"
name="update_cart_action"
data-cart-item-update=""
value="update_qty"
title="<?= $block->escapeHtml(__('Update Shopping Cart')) ?>"
class="action update">
<span><?= $block->escapeHtml(__('Update Shopping Cart')) ?></span>
</button>
<input type="hidden" value="" id="update_cart_action_container" data-cart-item-update=""/>
</div>
</form>
<?= $block->getChildHtml('checkout.cart.order.actions') ?>
<?= $block->getChildHtml('shopping.cart.table.after') ?>
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/** @var $block \Magento\Catalog\Block\Product\View */
?>
<?php $_product = $block->getProduct(); ?>
<?php $buttonTitle = __('Update Cart'); ?>
<?php if ($_product->isSaleable()) :?>
<div class="box-tocart update">
<fieldset class="fieldset">
<?php if ($block->shouldRenderQuantity()) :?>
<div class="field qty">
<label class="label" for="qty"><span><?= $block->escapeHtml(__('Qty')) ?></span></label>
<div class="control">
<input type="number"
name="qty"
id="qty"
min="0"
value=""
title="<?= $block->escapeHtmlAttr(__('Qty')) ?>"
class="input-text qty"
data-validate="<?= $block->escapeHtml(json_encode($block->getQuantityValidators())) ?>"/>
</div>
</div>
<?php endif; ?>
<div class="actions">
<button type="submit"
title="<?= $block->escapeHtmlAttr($buttonTitle) ?>"
class="action primary tocart"
id="product-updatecart-button">
<span><?= $block->escapeHtml($buttonTitle) ?></span>
</button>
<?= $block->getChildHtml('', true) ?>
</div>
</fieldset>
</div>
<script type="text/x-magento-init">
{
"#product_addtocart_form": {
"validation": {},
"addToCart": {
"cartButtonId": "#product-updatecart-button",
"cartForm": "#product_addtocart_form"
}
}
}
</script>
<?php endif; ?>
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
// phpcs:disable Magento2.Templates.ThisInTemplate
// phpcs:disable Magento2.Files.LineLength.MaxExceeded
/** @var $block \Magento\Checkout\Block\Cart\Item\Renderer */
$_item = $block->getItem();
$product = $_item->getProduct();
$isVisibleProduct = $product->isVisibleInSiteVisibility();
/** @var \Magento\Msrp\Helper\Data $helper */
$helper = $this->helper(Magento\Msrp\Helper\Data::class);
$canApplyMsrp = $helper->isShowBeforeOrderConfirm($product) && $helper->isMinimalPriceLessMsrp($product);
?>
<tbody class="cart item">
<tr class="item-info">
<td data-th="<?= $block->escapeHtml(__('Item')) ?>" class="col item">
<?php if ($block->hasProductUrl()) :?>
<a href="<?= $block->escapeUrl($block->getProductUrl()) ?>"
title="<?= $block->escapeHtml($block->getProductName()) ?>"
tabindex="-1"
class="product-item-photo">
<?php else :?>
<span class="product-item-photo">
<?php endif;?>
<?= $block->getImage($block->getProductForThumbnail(), 'cart_page_product_thumbnail')->toHtml() ?>
<?php if ($block->hasProductUrl()) :?>
</a>
<?php else :?>
</span>
<?php endif; ?>
<div class="product-item-details">
<strong class="product-item-name">
<?php if ($block->hasProductUrl()) :?>
<a href="<?= $block->escapeUrl($block->getProductUrl()) ?>"><?= $block->escapeHtml($block->getProductName()) ?></a>
<?php else :?>
<?= $block->escapeHtml($block->getProductName()) ?>
<?php endif; ?>
</strong>
<?php if ($_options = $block->getOptionList()) :?>
<dl class="item-options">
<?php foreach ($_options as $_option) :?>
<?php $_formatedOptionValue = $block->getFormatedOptionValue($_option) ?>
<dt><?= $block->escapeHtml($_option['label']) ?></dt>
<dd>
<?php if (isset($_formatedOptionValue['full_view'])) :?>
<?= $block->escapeHtml($_formatedOptionValue['full_view']) ?>
<?php else :?>
<?= $block->escapeHtml($_formatedOptionValue['value'], ['span', 'a']) ?>
<?php endif; ?>
</dd>
<?php endforeach; ?>
</dl>
<?php endif;?>
<?php if ($messages = $block->getMessages()) :?>
<?php foreach ($messages as $message) :?>
<div class= "cart item message <?= $block->escapeHtmlAttr($message['type']) ?>">
<div><?= $block->escapeHtml($message['text']) ?></div>
</div>
<?php endforeach; ?>
<?php endif; ?>
<?php $addInfoBlock = $block->getProductAdditionalInformationBlock(); ?>
<?php if ($addInfoBlock) :?>
<?= $addInfoBlock->setItem($_item)->toHtml() ?>
<?php endif;?>
</div>
</td>
<?php if ($canApplyMsrp) :?>
<td class="col msrp" data-th="<?= $block->escapeHtml(__('Price')) ?>">
<span class="pricing msrp">
<span class="msrp notice"><?= $block->escapeHtml(__('See price before order confirmation.')) ?></span>
<?php $helpLinkId = 'cart-msrp-help-' . $_item->getId(); ?>
<a href="#" class="action help map"
id="<?= ($block->escapeHtmlAttr($helpLinkId)) ?>"
data-mage-init='{"addToCart":{
"helpLinkId": "#<?= $block->escapeJs($block->escapeHtml($helpLinkId)) ?>",
"productName": "<?= $block->escapeJs($block->escapeHtml($product->getName())) ?>",
"showAddToCart": false
}
}'
>
<span><?= $block->escapeHtml(__("What's this?")) ?></span>
</a>
</span>
</td>
<?php else :?>
<td class="col price" data-th="<?= $block->escapeHtml(__('Price')) ?>">
<?= $block->getUnitPriceHtml($_item) ?>
</td>
<?php endif; ?>
<td class="col qty" data-th="<?= $block->escapeHtml(__('Qty')) ?>">
<div class="field qty">
<div class="control qty">
<label for="cart-<?= $block->escapeHtmlAttr($_item->getId()) ?>-qty">
<span class="label"><?= $block->escapeHtml(__('Qty')) ?></span>
<input id="cart-<?= $block->escapeHtmlAttr($_item->getId()) ?>-qty"
name="cart[<?= $block->escapeHtmlAttr($_item->getId()) ?>][qty]"
data-cart-item-id="<?= $block->escapeHtmlAttr($_item->getSku()) ?>"
value="<?= $block->escapeHtmlAttr($block->getQty()) ?>"
type="number"
size="4"
step="any"
title="<?= $block->escapeHtmlAttr(__('Qty')) ?>"
class="input-text qty"
data-validate="{required:true,'validate-greater-than-zero':true}"
data-role="cart-item-qty"/>
</label>
</div>
</div>
</td>
<td class="col subtotal" data-th="<?= $block->escapeHtml(__('Subtotal')) ?>">
<?php if ($canApplyMsrp) :?>
<span class="cart msrp subtotal">--</span>
<?php else :?>
<?= $block->getRowTotalHtml($_item) ?>
<?php endif; ?>
</td>
</tr>
<tr class="item-actions">
<td colspan="4">
<div class="actions-toolbar">
<?= /* @noEscape */ $block->getActions($_item) ?>
</div>
</td>
</tr>
</tbody>
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
// phpcs:disable Magento2.Templates.ThisInTemplate
/** @var $block \Magento\Checkout\Block\Item\Price\Renderer */
?>
<?php $_item = $block->getItem() ?>
<div class="price-container">
<span class="price-label"><?= $block->escapeHtml(__('Price')) ?></span>
<span class="price-wrapper">
<?= $block->escapeHtml(
$this->helper(Magento\Checkout\Helper\Data::class)->formatPrice($_item->getCalculationPrice()),
['span']
) ?>
</span>
</div>
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/** @var $block \Magento\Checkout\Block\Cart\Item\Renderer\Actions\Edit */
?>
<?php if ($block->isProductVisibleInSiteVisibility()) :?>
<a class="action action-edit"
href="<?= $block->escapeUrl($block->getConfigureUrl()) ?>"
title="<?= $block->escapeHtmlAttr(__('Edit item parameters')) ?>">
<span><?= $block->escapeHtml(__('Edit')) ?></span>
</a>
<?php endif ?>
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/** @var $block \Magento\Checkout\Block\Cart\Item\Renderer\Actions\Remove */
?>
<a href="#"
title="<?= $block->escapeHtml(__('Remove item')) ?>"
class="action action-delete"
data-post='<?= /* @noEscape */ $block->getDeletePostJson() ?>'>
<span>
<?= $block->escapeHtml(__('Remove item')) ?>
</span>
</a>
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
?>
<?php
/** @var $block \Magento\Checkout\Block\Cart */
?>
<?php if (!$block->hasError()) :?>
<?php $methods = $block->getMethods('methods') ?: $block->getMethods('top_methods') ?>
<ul class="checkout methods items checkout-methods-items">
<?php foreach ($methods as $method) :?>
<?php $methodHtml = $block->getMethodHtml($method); ?>
<?php if (trim($methodHtml) !== '') :?>
<li class="item"><?= /* @noEscape */ $methodHtml ?></li>
<?php endif; ?>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/** @var $block \Magento\Checkout\Block\Cart\Sidebar */
/** @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer */
?>
<div data-block="minicart" class="minicart-wrapper">
<a class="action showcart" href="<?= $block->escapeUrl($block->getShoppingCartUrl()) ?>"
data-bind="scope: 'minicart_content'">
<span class="text"><?= $block->escapeHtml(__('My Cart')) ?></span>
<span class="counter qty empty"
data-bind="css: { empty: !!getCartParam('summary_count') == false && !isLoading() },
blockLoader: isLoading">
<span class="counter-number"><!-- ko text: getCartParam('summary_count') --><!-- /ko --></span>
<span class="counter-label">
<!-- ko if: getCartParam('summary_count') -->
<!-- ko text: getCartParam('summary_count') --><!-- /ko -->
<!-- ko i18n: 'items' --><!-- /ko -->
<!-- /ko -->
</span>
</span>
</a>
<?php if ($block->getIsNeedToDisplaySideBar()):?>
<div class="block block-minicart"
data-role="dropdownDialog"
data-mage-init='{"dropdownDialog":{
"appendTo":"[data-block=minicart]",
"triggerTarget":".showcart",
"timeout": "2000",
"closeOnMouseLeave": false,
"closeOnEscape": true,
"triggerClass":"active",
"parentClass":"active",
"buttons":[]}}'>
<div id="minicart-content-wrapper" data-bind="scope: 'minicart_content'">
<!-- ko template: getTemplate() --><!-- /ko -->
</div>
<?= $block->getChildHtml('minicart.addons') ?>
</div>
<?php else: ?>
<?php $scriptString = <<<script
require(['jquery'], function ($) {
$('a.action.showcart').click(function() {
$(document.body).trigger('processStart');
});
});
script;
?>
<?= /* @noEscape */ $secureRenderer->renderTag('script', [], $scriptString, false); ?>
<?php endif ?>
<?= /* @noEscape */ $secureRenderer->renderTag('script', [], 'window.checkout = ' .
/* @noEscape */ $block->getSerializedConfig(), false); ?>
<script type="text/x-magento-init">
{
"[data-block='minicart']": {
"Magento_Ui/js/core/app": <?= /* @noEscape */ $block->getJsLayout() ?>
},
"*": {
"Magento_Ui/js/block-loader": "<?= $block->escapeJs(
$block->escapeUrl($block->getViewFileUrl('images/loader-1.gif'))
) ?>"
}
}
</script>
</div>
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/** @var $block \Magento\Checkout\Block\Cart */
?>
<div class="cart-empty">
<?= $block->getChildHtml('checkout_cart_empty_widget') ?>
<p><?= $block->escapeHtml(__('You have no items in your shopping cart.')) ?></p>
<p><?= $block->escapeHtml(
__(
'Click <a href="%1">here</a> to continue shopping.',
$block->escapeUrl($block->getContinueShoppingUrl())
),
['a']
) ?>
</p>
<?= $block->getChildHtml('shopping.cart.table.after') ?>
</div>
<script type="text/x-magento-init">
{
"*": {
"Magento_Checkout/js/empty-cart": {}
}
}
</script>
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
?>
<?php /** @var $block \Magento\Checkout\Block\Cart\Shipping */ ?>
<?php /** @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer */ ?>
<div id="block-shipping"
class="block shipping"
data-mage-init='{"collapsible":{"openedState": "active", "saveState": true}}'
>
<div class="title" data-role="title">
<strong id="block-shipping-heading" role="heading" aria-level="2">
<?= $block->getQuote()->isVirtual()
? $block->escapeHtml(__('Estimate Tax'))
: $block->escapeHtml(__('Estimate Shipping and Tax'))
?>
</strong>
</div>
<div id="block-summary"
data-bind="scope:'block-summary'"
class="content"
data-role="content"
aria-labelledby="block-shipping-heading"
>
<!-- ko template: getTemplate() --><!-- /ko -->
<script type="text/x-magento-init">
{
"#block-summary": {
"Magento_Ui/js/core/app": <?= /* @noEscape */ $block->getJsLayout() ?>
}
}
</script>
<?php $serializedCheckoutConfig = /* @noEscape */ $block->getSerializedCheckoutConfig();
$scriptString = <<<script
window.checkoutConfig = {$serializedCheckoutConfig};
window.customerData = window.checkoutConfig.customerData;
window.isCustomerLoggedIn = window.checkoutConfig.isCustomerLoggedIn;
require([
'mage/url',
'Magento_Ui/js/block-loader'
], function(url, blockLoader) {
blockLoader(
"{$block->escapeJs($block->escapeUrl($block->getViewFileUrl('images/loader-1.gif')))}"
);
return url.setBaseUrl('{$block->escapeJs($block->escapeUrl($block->getBaseUrl()))}');
})
script;
?>
<?= /* @noEscape */ $secureRenderer->renderTag('script', [], $scriptString, false) ?>
</div>
</div>
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
?>
<?php
/**
* Shopping cart totals template
* @var $block \Magento\Checkout\Block\Cart\Totals
*/
?>
<div id="cart-totals" class="cart-totals" data-bind="scope:'block-totals'">
<!-- ko template: getTemplate() --><!-- /ko -->
<script type="text/x-magento-init">
{
"#cart-totals": {
"Magento_Ui/js/core/app": <?= /* @noEscape */ $block->getJsLayout() ?>
}
}
</script>
</div>
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
// phpcs:disable Magento2.Templates.ThisInTemplate
/** @var $block \Magento\Checkout\Block\Item\Price\Renderer */
$_item = $block->getItem();
?>
<span class="price-excluding-tax" data-label="<?= $block->escapeHtml(__('Excl. Tax')) ?>">
<span class="cart-price">
<?= $block->escapeHtml(
$this->helper(Magento\Checkout\Helper\Data::class)->formatPrice($_item->getRowTotal()),
['span']
) ?>
</span>
</span>
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
// phpcs:disable Magento2.Templates.ThisInTemplate
/** @var $block \Magento\Checkout\Block\Item\Price\Renderer */
$_item = $block->getItem();
?>
<span class="price-including-tax" data-label="<?= $block->escapeHtml(__('Excl. Tax')) ?>">
<span class="cart-price">
<?= $block->escapeHtml(
$this->helper(Magento\Checkout\Helper\Data::class)->formatPrice($_item->getCalculationPrice()),
['span']
) ?>
</span>
</span>
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
?>
<?= $block->getChildHtml() ?>
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/** @var \Magento\Framework\View\Element\Template $block */
?>
<?= $block->escapeHtml(__(
'You added %1 to your <a href="%2">shopping cart</a>.',
$block->getData('product_name'),
$block->getData('cart_url')
), ['a']);
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/** @var $block \Magento\Checkout\Block\Onepage */
/** @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer */
?>
<div id="checkout" data-bind="scope:'checkout'" class="checkout-container">
<div id="checkout-loader" data-role="checkout-loader" class="loading-mask" data-mage-init='{"checkoutLoader": {}}'>
<div class="loader">
<img src="<?= $block->escapeUrl($block->getViewFileUrl('images/loader-1.gif')) ?>"
alt="<?= $block->escapeHtmlAttr(__('Loading...')) ?>">
</div>
</div>
<?= /* @noEscape */ $secureRenderer->renderStyleAsTag("position: absolute;", "#checkout-loader img") ?>
<!-- ko template: getTemplate() --><!-- /ko -->
<script type="text/x-magento-init">
{
"#checkout": {
"Magento_Ui/js/core/app": <?= /* @noEscape */ $block->getJsLayout() ?>
}
}
</script>
<?php $serializedCheckoutConfig = /* @noEscape */ $block->getSerializedCheckoutConfig();
$scriptString = <<<script
window.checkoutConfig = {$serializedCheckoutConfig};
// Create aliases for customer.js model from customer module
window.isCustomerLoggedIn = window.checkoutConfig.isCustomerLoggedIn;
window.customerData = window.checkoutConfig.customerData;
script;
?>
<?= /* @noEscape */ $secureRenderer->renderTag('script', [], $scriptString, false) ?>
<?php $scriptString = <<<script
require([
'mage/url',
'Magento_Ui/js/block-loader'
], function(url, blockLoader) {
blockLoader("{$block->escapeJs($block->escapeUrl($block->getViewFileUrl('images/loader-1.gif')))}");
return url.setBaseUrl('{$block->escapeJs($block->escapeUrl($block->getBaseUrl()))}');
})
script;
?>
<?= /* @noEscape */ $secureRenderer->renderTag('script', [], $scriptString, false) ?>
</div>
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/** @var $block \Magento\Checkout\Block\Onepage\Failure */
?>
<?php if ($block->getRealOrderId()) :?>
<p><?= $block->escapeHtml(__('Order #') . $block->getRealOrderId()) ?></p>
<?php endif ?>
<?php if ($error = $block->getErrorMessage()) :?>
<p><?= $block->escapeHtml($error) ?></p>
<?php endif ?>
<p><?= $block->escapeHtml(
__('Click <a href="%1">here</a> to continue shopping.', $block->escapeUrl($block->getContinueShoppingUrl())),
['a']
) ?>
</p>
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
use Magento\Checkout\Block\Onepage\Link;
use Magento\Framework\Escaper;
/**
* @var Link $block
* @var Escaper $escaper
*/
?>
<?php if ($block->isPossibleOnepageCheckout()): ?>
<button type="button"
data-role="proceed-to-checkout"
title="<?= $escaper->escapeHtmlAttr(__('Proceed to Checkout')) ?>"
data-mage-init='{
"Magento_Checkout/js/proceed-to-checkout":{
"checkoutUrl":"<?= $escaper->escapeJs($block->getCheckoutUrl()) ?>"
}
}'
class="action primary checkout<?= ($block->isDisabled()) ? ' disabled' : '' ?>"
<?php if ($block->isDisabled()): ?>
disabled="disabled"
<?php endif; ?>>
<span><?= $escaper->escapeHtml(__('Proceed to Checkout')) ?></span>
</button>
<?php endif?>
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
// phpcs:disable Magento2.Templates.ThisInTemplate
/** @var $block Magento\Checkout\Block\Cart\Item\Renderer */
$_item = $block->getItem();
$taxDataHelper = $this->helper(Magento\Tax\Helper\Data::class);
?>
<tbody class="cart item">
<tr>
<td class="col item" data-th="<?= $block->escapeHtml(__('Product Name')) ?>">
<span class="product-item-photo">
<?= $block->getImage($block->getProductForThumbnail(), 'cart_page_product_thumbnail')->toHtml() ?>
</span>
<div class="product-item-details">
<strong class="product name product-item-name">
<?= $block->escapeHtml($block->getProductName()) ?>
</strong>
<?php if ($_options = $block->getOptionList()) :?>
<dl class="item-options">
<?php foreach ($_options as $_option) :?>
<?php $_formatedOptionValue = $block->getFormatedOptionValue($_option) ?>
<dt><?= $block->escapeHtml($_option['label']) ?></dt>
<dd>
<?php if (isset($_formatedOptionValue['full_view'])) :?>
<?= /* @noEscape */ $_formatedOptionValue['full_view'] ?>
<?php else :?>
<?= /* @noEscape */ $_formatedOptionValue['value'] ?>
<?php endif; ?>
</dd>
<?php endforeach; ?>
</dl>
<?php endif;?>
<?php if ($addtInfoBlock = $block->getProductAdditionalInformationBlock()) :?>
<?= $addtInfoBlock->setItem($_item)->toHtml() ?>
<?php endif;?>
</div>
</td>
<td class="col price" data-th="<?= $block->escapeHtml(__('Price')) ?>">
<?php if ($taxDataHelper->displayCartPriceInclTax() || $taxDataHelper->displayCartBothPrices()) :?>
<span class="price-including-tax" data-label="<?= $block->escapeHtml(__('Incl. Tax')) ?>">
<?= $block->getUnitPriceInclTaxHtml($_item) ?>
</span>
<?php endif; ?>
<?php if ($taxDataHelper->displayCartPriceExclTax() || $taxDataHelper->displayCartBothPrices()) :?>
<span class="price-excluding-tax" data-label="<?= $block->escapeHtml(__('Excl. Tax')) ?>">
<?= $block->getUnitPriceExclTaxHtml($_item) ?>
</span>
<?php endif; ?>
</td>
<td class="col qty"
data-th="<?= $block->escapeHtml(__('Qty')) ?>"
>
<span class="qty"><?= $block->escapeHtml($_item->getQty()) ?></span>
</td>
<td class="col subtotal" data-th="<?= $block->escapeHtml(__('Subtotal')) ?>">
<?php if ($taxDataHelper->displayCartPriceInclTax() || $taxDataHelper->displayCartBothPrices()) :?>
<span class="price-including-tax" data-label="<?= $block->escapeHtml(__('Incl. Tax')) ?>">
<?= $block->getRowTotalInclTaxHtml($_item) ?>
</span>
<?php endif; ?>
<?php if ($taxDataHelper->displayCartPriceExclTax() || $taxDataHelper->displayCartBothPrices()) :?>
<span class="price-excluding-tax" data-label="<?= $block->escapeHtml(__('Excl. Tax')) ?>">
<?= $block->getRowTotalExclTaxHtml($_item) ?>
</span>
<?php endif; ?>
</td>
</tr>
</tbody>
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
// phpcs:disable Magento2.Templates.ThisInTemplate
/** @var $block \Magento\Checkout\Block\Item\Price\Renderer */
$_item = $block->getItem();
?>
<span class="cart-price">
<?= $block->escapeHtml(
$this->helper(Magento\Checkout\Helper\Data::class)->formatPrice($_item->getRowTotal()),
['span']
) ?>
</span>
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
// phpcs:disable Magento2.Templates.ThisInTemplate
/** @var $block \Magento\Checkout\Block\Item\Price\Renderer */
$_item = $block->getItem();
?>
<?php $_incl = $this->helper(Magento\Checkout\Helper\Data::class)->getSubtotalInclTax($_item); ?>
<span class="cart-price">
<?= $block->escapeHtml(
$this->helper(Magento\Checkout\Helper\Data::class)->formatPrice($_incl),
['span']
) ?>
</span>
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis
/** @var $block \Magento\Checkout\Block\Item\Price\Renderer */
$_item = $block->getItem();
?>
<span class="cart-price">
<?= $block->escapeHtml(
$this->helper(Magento\Checkout\Helper\Data::class)->formatPrice($_item->getCalculationPrice()),
['span']
) ?>
</span>
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
// phpcs:disable Magento2.Templates.ThisInTemplate
/** @var $block \Magento\Checkout\Block\Item\Price\Renderer */
$_item = $block->getItem();
?>
<?php $_incl = $this->helper(Magento\Checkout\Helper\Data::class)->getPriceInclTax($_item); ?>
<span class="cart-price">
<?= $block->escapeHtml(
$this->helper(Magento\Checkout\Helper\Data::class)->formatPrice($_incl),
['span']
) ?>
</span>
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/** @var $block \Magento\Checkout\Block\Registration */
?>
<div id="registration" data-bind="scope:'registration'">
<br />
<!-- ko template: getTemplate() --><!-- /ko -->
<script type="text/x-magento-init">
{
"#registration": {
"Magento_Ui/js/core/app": {
"components": {
"registration": {
"component": "Magento_Checkout/js/view/registration",
"config": {
"registrationUrl":
"<?= $block->escapeJs($block->escapeUrl($block->getCreateAccountUrl())) ?>",
"email": "<?= $block->escapeJs($block->getEmailAddress()) ?>"
},
"children": {
"errors": {
"component": "Magento_Ui/js/view/messages",
"sortOrder": 0,
"displayArea": "messages",
"config": {
"autoHideTimeOut": -1
}
}
}
}
}
}
}
}
</script>
</div>
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
?>
<?php /** @var $block \Magento\Checkout\Block\Shipping\Price */ ?>
<?php $shippingPrice = $block->getShippingPrice(); ?>
<?= $block->escapeHtml($shippingPrice) ?>
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
?>
<?php /** @var $block \Magento\Checkout\Block\Onepage\Success */ ?>
<div class="checkout-success">
<?php if ($block->getOrderId()) :?>
<?php if ($block->getCanViewOrder()) :?>
<p><?= $block->escapeHtml(__('Your order number is: %1.', sprintf('<a href="%s" class="order-number"><strong>%s</strong></a>', $block->escapeUrl($block->getViewOrderUrl()), $block->getOrderId())), ['a', 'strong']) ?></p>
<?php else :?>
<p><?= $block->escapeHtml(__('Your order # is: <span>%1</span>.', $block->getOrderId()), ['span']) ?></p>
<?php endif;?>
<p><?= $block->escapeHtml(__('We\'ll email you an order confirmation with details and tracking info.')) ?></p>
<?php endif;?>
<?= $block->getAdditionalInfoHtml() ?>
<div class="actions-toolbar">
<div class="primary">
<a class="action primary continue" href="<?= $block->escapeUrl($block->getContinueUrl()) ?>"><span><?= $block->escapeHtml(__('Continue Shopping')) ?></span></a>
</div>
</div>
</div>
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/** @var $block \Magento\Checkout\Block\Total\DefaultTotal */
/** @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer */
?>
<?php
/** @var \Magento\Checkout\Helper\Data $checkoutHelper */
$checkoutHelper = $block->getData('checkoutHelper');
?>
<tr class="totals">
<th colspan="<?= $block->escapeHtmlAttr($block->getColspan()) ?>"
class="mark" scope="row">
<?php if ($block->getRenderingArea() == $block->getTotal()->getArea()):?>
<strong>
<?php endif; ?>
<?= $block->escapeHtml($block->getTotal()->getTitle()) ?>
<?php if ($block->getRenderingArea() == $block->getTotal()->getArea()):?>
</strong>
<?php endif; ?>
</th>
<td class="amount"
data-th="<?= $block->escapeHtmlAttr($block->getTotal()->getTitle()) ?>">
<?php if ($block->getRenderingArea() == $block->getTotal()->getArea()):?>
<strong>
<?php endif; ?>
<span>
<?= $block->escapeHtml(
$checkoutHelper->formatPrice($block->getTotal()->getValue()),
['span']
) ?>
</span>
<?php if ($block->getRenderingArea() == $block->getTotal()->getArea()):?>
</strong>
<?php endif; ?>
</td>
</tr>
<?php if ($block->getTotal()->getStyle()): ?>
<?= /* @noEscape */ $secureRenderer->renderStyleAsTag($block->getTotal()->getStyle(), 'tr.totals th.mark') ?>
<?= /* @noEscape */ $secureRenderer->renderStyleAsTag($block->getTotal()->getStyle(), 'tr.totals td.amount') ?>
<?php endif; ?>
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1666333165025" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="13278" width="200" height="200" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M725.333333 981.333333a42.666667 42.666667 0 1 1 42.666667-42.666666 42.713333 42.713333 0 0 1-42.666667 42.666666z m0-42.666666z m-384 42.666666a42.666667 42.666667 0 1 1 42.666667-42.666666 42.713333 42.713333 0 0 1-42.666667 42.666666z m0-42.666666z m382.313334-128H347.146667a85.333333 85.333333 0 0 1-82.146667-62.226667L90.506667 128H21.333333a21.333333 21.333333 0 0 1 0-42.666667h85.333334a21.333333 21.333333 0 0 1 20.533333 15.56L170.826667 256h766.086666a37.333333 37.333333 0 0 1 34.953334 50.44l-168.32 448.853333a85.333333 85.333333 0 0 1-79.9 55.373334zM182.826667 298.666667l123.246666 438.22a42.82 42.82 0 0 0 41.073334 31.113333h376.5a42.873333 42.873333 0 0 0 39.953333-27.686667L929.213333 298.666667z" fill="#bfbfbf" p-id="13279"></path></svg>
\ No newline at end of file
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/**
* @api
*/
define([
'Magento_Checkout/js/model/address-converter'
], function (addressConverter) {
'use strict';
return function (addressData) {
var address = addressConverter.formAddressDataToQuoteAddress(addressData);
/**
* Returns new customer billing address type.
*
* @returns {String}
*/
address.getType = function () {
return 'new-customer-billing-address';
};
return address;
};
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/**
* @api
*/
define([
'Magento_Customer/js/model/address-list',
'Magento_Checkout/js/model/address-converter'
], function (addressList, addressConverter) {
'use strict';
return function (addressData) {
var address = addressConverter.formAddressDataToQuoteAddress(addressData),
isAddressUpdated = addressList().some(function (currentAddress, index, addresses) {
if (currentAddress.getKey() == address.getKey()) { //eslint-disable-line eqeqeq
addresses[index] = address;
return true;
}
return false;
});
if (!isAddressUpdated) {
addressList.push(address);
} else {
addressList.valueHasMutated();
}
return address;
};
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/**
* @api
*/
define([
'jquery',
'Magento_Checkout/js/model/quote',
'Magento_Checkout/js/model/url-builder',
'mage/storage',
'Magento_Checkout/js/model/error-processor',
'Magento_Customer/js/model/customer',
'Magento_Checkout/js/model/payment/method-converter',
'Magento_Checkout/js/model/payment-service'
], function ($, quote, urlBuilder, storage, errorProcessor, customer, methodConverter, paymentService) {
'use strict';
return function (deferred, messageContainer) {
var serviceUrl;
deferred = deferred || $.Deferred();
/**
* Checkout for guest and registered customer.
*/
if (!customer.isLoggedIn()) {
serviceUrl = urlBuilder.createUrl('/guest-carts/:cartId/payment-information', {
cartId: quote.getQuoteId()
});
} else {
serviceUrl = urlBuilder.createUrl('/carts/mine/payment-information', {});
}
return storage.get(
serviceUrl, false
).done(function (response) {
quote.setTotals(response.totals);
paymentService.setPaymentMethods(methodConverter(response['payment_methods']));
deferred.resolve();
}).fail(function (response) {
errorProcessor.process(response, messageContainer);
deferred.reject();
});
};
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/**
* @api
*/
define([
'jquery',
'../model/quote',
'Magento_Checkout/js/model/resource-url-manager',
'Magento_Checkout/js/model/error-processor',
'mage/storage',
'Magento_Checkout/js/model/totals'
], function ($, quote, resourceUrlManager, errorProcessor, storage, totals) {
'use strict';
return function (callbacks, deferred) {
deferred = deferred || $.Deferred();
totals.isLoading(true);
return storage.get(
resourceUrlManager.getUrlForCartTotals(quote),
false
).done(function (response) {
var proceed = true;
totals.isLoading(false);
if (callbacks.length > 0) {
$.each(callbacks, function (index, callback) {
proceed = proceed && callback();
});
}
if (proceed) {
quote.setTotals(response);
deferred.resolve();
}
}).fail(function (response) {
totals.isLoading(false);
deferred.reject();
errorProcessor.process(response);
}).always(function () {
totals.isLoading(false);
});
};
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/**
* @api
*/
define([
'Magento_Checkout/js/model/quote',
'Magento_Checkout/js/model/url-builder',
'Magento_Customer/js/model/customer',
'Magento_Checkout/js/model/place-order'
], function (quote, urlBuilder, customer, placeOrderService) {
'use strict';
return function (paymentData, messageContainer) {
var serviceUrl, payload;
payload = {
cartId: quote.getQuoteId(),
billingAddress: quote.billingAddress(),
paymentMethod: paymentData
};
if (customer.isLoggedIn()) {
serviceUrl = urlBuilder.createUrl('/carts/mine/payment-information', {});
} else {
serviceUrl = urlBuilder.createUrl('/guest-carts/:quoteId/payment-information', {
quoteId: quote.getQuoteId()
});
payload.email = quote.guestEmail;
}
return placeOrderService(serviceUrl, payload, messageContainer);
};
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/**
* @api
*/
define([
'Magento_Checkout/js/model/quote',
'Magento_Checkout/js/action/select-shipping-address',
'Magento_Checkout/js/model/shipping-rate-registry'
], function (quote, selectShippingAddress, rateRegistry) {
'use strict';
return function () {
var shippingAddress = null;
if (!quote.isVirtual()) {
shippingAddress = quote.shippingAddress();
rateRegistry.set(shippingAddress.getCacheKey(), null);
selectShippingAddress(shippingAddress);
}
};
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/**
* @api
*/
define(
[
'mage/url',
'Magento_Checkout/js/model/full-screen-loader'
],
function (url, fullScreenLoader) {
'use strict';
return {
redirectUrl: window.checkoutConfig.defaultSuccessPageUrl,
/**
* Provide redirect to page
*/
execute: function () {
fullScreenLoader.startLoader();
window.location.replace(url.build(this.redirectUrl));
}
};
}
);
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/**
* @api
*/
define([
'jquery',
'../model/quote'
], function ($, quote) {
'use strict';
return function (billingAddress) {
var address = null;
if (quote.shippingAddress() && billingAddress.getCacheKey() == //eslint-disable-line eqeqeq
quote.shippingAddress().getCacheKey()
) {
address = $.extend(true, {}, billingAddress);
address.saveInAddressBook = null;
} else {
address = billingAddress;
}
quote.billingAddress(address);
};
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/**
* @api
*/
define([
'Magento_Checkout/js/model/quote'
], function (quote) {
'use strict';
return function (paymentMethod) {
if (paymentMethod) {
paymentMethod.__disableTmpl = {
title: true
};
}
quote.paymentMethod(paymentMethod);
};
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/**
* @api
*/
define([
'Magento_Checkout/js/model/quote'
], function (quote) {
'use strict';
return function (shippingAddress) {
quote.shippingAddress(shippingAddress);
};
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/**
* @api
*/
define([
'../model/quote'
], function (quote) {
'use strict';
return function (shippingMethod) {
quote.shippingMethod(shippingMethod);
};
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/**
* @api
*/
define(
[
'jquery',
'Magento_Checkout/js/model/quote',
'Magento_Checkout/js/model/url-builder',
'mage/storage',
'Magento_Checkout/js/model/error-processor',
'Magento_Customer/js/model/customer',
'Magento_Checkout/js/model/full-screen-loader',
'Magento_Checkout/js/action/get-payment-information'
],
function ($,
quote,
urlBuilder,
storage,
errorProcessor,
customer,
fullScreenLoader,
getPaymentInformationAction
) {
'use strict';
return function (messageContainer) {
var serviceUrl,
payload;
/**
* Checkout for guest and registered customer.
*/
if (!customer.isLoggedIn()) {
serviceUrl = urlBuilder.createUrl('/guest-carts/:cartId/billing-address', {
cartId: quote.getQuoteId()
});
payload = {
cartId: quote.getQuoteId(),
address: quote.billingAddress()
};
} else {
serviceUrl = urlBuilder.createUrl('/carts/mine/billing-address', {});
payload = {
cartId: quote.getQuoteId(),
address: quote.billingAddress()
};
}
fullScreenLoader.startLoader();
return storage.post(
serviceUrl, JSON.stringify(payload)
).done(
function () {
var deferred = $.Deferred();
getPaymentInformationAction(deferred);
$.when(deferred).done(function () {
fullScreenLoader.stopLoader();
});
}
).fail(
function (response) {
errorProcessor.process(response, messageContainer);
fullScreenLoader.stopLoader();
}
);
};
}
);
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/**
* @api
*/
define([
'Magento_Checkout/js/model/quote',
'Magento_Checkout/js/model/url-builder',
'mage/storage',
'Magento_Checkout/js/model/error-processor',
'Magento_Customer/js/model/customer',
'Magento_Checkout/js/action/get-totals',
'Magento_Checkout/js/model/full-screen-loader',
'underscore',
'Magento_Checkout/js/model/payment/place-order-hooks'
], function (quote, urlBuilder, storage, errorProcessor, customer, getTotalsAction, fullScreenLoader, _, hooks) {
'use strict';
/**
* Filter template data.
*
* @param {Object|Array} data
*/
var filterTemplateData = function (data) {
return _.each(data, function (value, key, list) {
if (_.isArray(value) || _.isObject(value)) {
list[key] = filterTemplateData(value);
}
if (key === '__disableTmpl' || key === 'title') {
delete list[key];
}
});
};
return function (messageContainer, paymentData, skipBilling) {
var serviceUrl,
payload,
headers = {};
paymentData = filterTemplateData(paymentData);
skipBilling = skipBilling || false;
payload = {
cartId: quote.getQuoteId(),
paymentMethod: paymentData
};
/**
* Checkout for guest and registered customer.
*/
if (!customer.isLoggedIn()) {
serviceUrl = urlBuilder.createUrl('/guest-carts/:cartId/set-payment-information', {
cartId: quote.getQuoteId()
});
payload.email = quote.guestEmail;
} else {
serviceUrl = urlBuilder.createUrl('/carts/mine/set-payment-information', {});
}
if (skipBilling === false) {
payload.billingAddress = quote.billingAddress();
}
fullScreenLoader.startLoader();
_.each(hooks.requestModifiers, function (modifier) {
modifier(headers, payload);
});
return storage.post(
serviceUrl, JSON.stringify(payload), true, 'application/json', headers
).fail(
function (response) {
errorProcessor.process(response, messageContainer);
}
).always(
function () {
fullScreenLoader.stopLoader();
_.each(hooks.afterRequestListeners, function (listener) {
listener();
});
}
);
};
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/**
* @api
*/
define([
'Magento_Checkout/js/action/set-payment-information-extended'
], function (setPaymentInformationExtended) {
'use strict';
return function (messageContainer, paymentData) {
return setPaymentInformationExtended(messageContainer, paymentData, false);
};
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/**
* @api
*/
define([
'../model/quote',
'Magento_Checkout/js/model/shipping-save-processor'
], function (quote, shippingSaveProcessor) {
'use strict';
return function () {
return shippingSaveProcessor.saveShippingInformation(quote.shippingAddress().getType());
};
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'Magento_Ui/js/modal/alert',
'jquery',
'jquery-ui-modules/widget',
'mage/validation'
], function (alert, $) {
'use strict';
$.widget('mage.updateShoppingCart', {
options: {
validationURL: '',
eventName: 'updateCartItemQty',
updateCartActionContainer: ''
},
/** @inheritdoc */
_create: function () {
this._on(this.element, {
'submit': this.onSubmit
});
},
/**
* Prevents default submit action and calls form validator.
*
* @param {Event} event
* @return {Boolean}
*/
onSubmit: function (event) {
var action = this.element.find(this.options.updateCartActionContainer).val();
if (!this.options.validationURL || action === 'empty_cart') {
return true;
}
if (this.isValid()) {
event.preventDefault();
this.validateItems(this.options.validationURL, this.element.serialize());
}
return false;
},
/**
* Validates requested form.
*
* @return {Boolean}
*/
isValid: function () {
return this.element.validation() && this.element.validation('isValid');
},
/**
* Validates updated shopping cart data.
*
* @param {String} url - request url
* @param {Object} data - post data for ajax call
*/
validateItems: function (url, data) {
$.extend(data, {
'form_key': $.mage.cookies.get('form_key')
});
$.ajax({
url: url,
data: data,
type: 'post',
dataType: 'json',
context: this,
/** @inheritdoc */
beforeSend: function () {
$(document.body).trigger('processStart');
},
/** @inheritdoc */
complete: function () {
$(document.body).trigger('processStop');
}
})
.done(function (response) {
if (response.success) {
this.onSuccess();
} else {
this.onError(response);
}
})
.fail(function () {
this.submitForm();
});
},
/**
* Form validation succeed.
*/
onSuccess: function () {
$(document).trigger('ajax:' + this.options.eventName);
this.submitForm();
},
/**
* Form validation failed.
*/
onError: function (response) {
if (response['error_message']) {
alert({
content: response['error_message']
});
} else {
this.submitForm();
}
},
/**
* Real submit of validated form.
*/
submitForm: function () {
this.element
.off('submit', this.onSubmit)
.on('submit', function () {
$(document.body).trigger('processStart');
})
.trigger('submit');
}
});
return $.mage.updateShoppingCart;
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/**
* Checkout adapter for customer data storage
*
* @api
*/
define([
'jquery',
'Magento_Customer/js/customer-data',
'mageUtils',
'jquery/jquery-storageapi'
], function ($, storage, utils) {
'use strict';
var cacheKey = 'checkout-data',
/**
* @param {Object} data
*/
saveData = function (data) {
storage.set(cacheKey, data);
},
/**
* @return {*}
*/
initData = function () {
return {
'selectedShippingAddress': null, //Selected shipping address pulled from persistence storage
'shippingAddressFromData': null, //Shipping address pulled from persistence storage
'newCustomerShippingAddress': null, //Shipping address pulled from persistence storage for customer
'selectedShippingRate': null, //Shipping rate pulled from persistence storage
'selectedPaymentMethod': null, //Payment method pulled from persistence storage
'selectedBillingAddress': null, //Selected billing address pulled from persistence storage
'billingAddressFromData': null, //Billing address pulled from persistence storage
'newCustomerBillingAddress': null //Billing address pulled from persistence storage for new customer
};
},
/**
* @return {*}
*/
getData = function () {
var data = storage.get(cacheKey)();
if ($.isEmptyObject(data)) {
data = $.initNamespaceStorage('mage-cache-storage').localStorage.get(cacheKey);
if ($.isEmptyObject(data)) {
data = initData();
saveData(data);
}
}
return data;
};
return {
/**
* Setting the selected shipping address pulled from persistence storage
*
* @param {Object} data
*/
setSelectedShippingAddress: function (data) {
var obj = getData();
obj.selectedShippingAddress = data;
saveData(obj);
},
/**
* Pulling the selected shipping address from persistence storage
*
* @return {*}
*/
getSelectedShippingAddress: function () {
return getData().selectedShippingAddress;
},
/**
* Setting the shipping address pulled from persistence storage
*
* @param {Object} data
*/
setShippingAddressFromData: function (data) {
var obj = getData();
obj.shippingAddressFromData = utils.filterFormData(data);
saveData(obj);
},
/**
* Pulling the shipping address from persistence storage
*
* @return {*}
*/
getShippingAddressFromData: function () {
return getData().shippingAddressFromData;
},
/**
* Setting the shipping address pulled from persistence storage for new customer
*
* @param {Object} data
*/
setNewCustomerShippingAddress: function (data) {
var obj = getData();
obj.newCustomerShippingAddress = data;
saveData(obj);
},
/**
* Pulling the shipping address from persistence storage for new customer
*
* @return {*}
*/
getNewCustomerShippingAddress: function () {
return getData().newCustomerShippingAddress;
},
/**
* Setting the selected shipping rate pulled from persistence storage
*
* @param {Object} data
*/
setSelectedShippingRate: function (data) {
var obj = getData();
obj.selectedShippingRate = data;
saveData(obj);
},
/**
* Pulling the selected shipping rate from local storage
*
* @return {*}
*/
getSelectedShippingRate: function () {
return getData().selectedShippingRate;
},
/**
* Setting the selected payment method pulled from persistence storage
*
* @param {Object} data
*/
setSelectedPaymentMethod: function (data) {
var obj = getData();
obj.selectedPaymentMethod = data;
saveData(obj);
},
/**
* Pulling the payment method from persistence storage
*
* @return {*}
*/
getSelectedPaymentMethod: function () {
return getData().selectedPaymentMethod;
},
/**
* Setting the selected billing address pulled from persistence storage
*
* @param {Object} data
*/
setSelectedBillingAddress: function (data) {
var obj = getData();
obj.selectedBillingAddress = data;
saveData(obj);
},
/**
* Pulling the selected billing address from persistence storage
*
* @return {*}
*/
getSelectedBillingAddress: function () {
return getData().selectedBillingAddress;
},
/**
* Setting the billing address pulled from persistence storage
*
* @param {Object} data
*/
setBillingAddressFromData: function (data) {
var obj = getData();
obj.billingAddressFromData = utils.filterFormData(data);
saveData(obj);
},
/**
* Pulling the billing address from persistence storage
*
* @return {*}
*/
getBillingAddressFromData: function () {
return getData().billingAddressFromData;
},
/**
* Setting the billing address pulled from persistence storage for new customer
*
* @param {Object} data
*/
setNewCustomerBillingAddress: function (data) {
var obj = getData();
obj.newCustomerBillingAddress = data;
saveData(obj);
},
/**
* Pulling the billing address from persistence storage for new customer
*
* @return {*}
*/
getNewCustomerBillingAddress: function () {
return getData().newCustomerBillingAddress;
},
/**
* Pulling the email address from persistence storage
*
* @return {*}
*/
getValidatedEmailValue: function () {
var obj = getData();
return obj.validatedEmailValue ? obj.validatedEmailValue : '';
},
/**
* Setting the email address pulled from persistence storage
*
* @param {String} email
*/
setValidatedEmailValue: function (email) {
var obj = getData();
obj.validatedEmailValue = email;
saveData(obj);
},
/**
* Pulling the email input field value from persistence storage
*
* @return {*}
*/
getInputFieldEmailValue: function () {
var obj = getData();
return obj.inputFieldEmailValue ? obj.inputFieldEmailValue : '';
},
/**
* Setting the email input field value pulled from persistence storage
*
* @param {String} email
*/
setInputFieldEmailValue: function (email) {
var obj = getData();
obj.inputFieldEmailValue = email;
saveData(obj);
},
/**
* Pulling the checked email value from persistence storage
*
* @return {*}
*/
getCheckedEmailValue: function () {
var obj = getData();
return obj.checkedEmailValue ? obj.checkedEmailValue : '';
},
/**
* Setting the checked email value pulled from persistence storage
*
* @param {String} email
*/
setCheckedEmailValue: function (email) {
var obj = getData();
obj.checkedEmailValue = email;
saveData(obj);
}
};
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'rjsResolver'
], function (resolver) {
'use strict';
/**
* Removes provided loader element from DOM.
*
* @param {HTMLElement} $loader - Loader DOM element.
*/
function hideLoader($loader) {
$loader.parentNode.removeChild($loader);
}
/**
* Initializes assets loading process listener.
*
* @param {Object} config - Optional configuration
* @param {HTMLElement} $loader - Loader DOM element.
*/
function init(config, $loader) {
resolver(hideLoader.bind(null, $loader));
}
return init;
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'jquery',
'jquery-ui-modules/widget'
], function ($) {
'use strict';
$.widget('mage.discountCode', {
options: {
},
/** @inheritdoc */
_create: function () {
this.couponCode = $(this.options.couponCodeSelector);
this.removeCoupon = $(this.options.removeCouponSelector);
$(this.options.applyButton).on('click', $.proxy(function () {
this.couponCode.attr('data-validate', '{required:true}');
this.removeCoupon.attr('value', '0');
$(this.element).validation().trigger('submit');
}, this));
$(this.options.cancelButton).on('click', $.proxy(function () {
this.couponCode.removeAttr('data-validate');
this.removeCoupon.attr('value', '1');
this.element.trigger('submit');
}, this));
}
});
return $.mage.discountCode;
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define(['Magento_Customer/js/customer-data'], function (customerData) {
'use strict';
return function () {
var cartData = customerData.get('cart');
customerData.getInitCustomerData().done(function () {
if (cartData().items && cartData().items.length !== 0) {
customerData.reload(['cart'], false);
}
});
};
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/**
* @api
*/
define([
'jquery',
'Magento_Checkout/js/model/new-customer-address',
'Magento_Customer/js/customer-data',
'mage/utils/objects',
'underscore'
], function ($, address, customerData, mageUtils, _) {
'use strict';
var countryData = customerData.get('directory-data');
return {
/**
* Convert address form data to Address object
*
* @param {Object} formData
* @returns {Object}
*/
formAddressDataToQuoteAddress: function (formData) {
// clone address form data to new object
var addressData = $.extend(true, {}, formData),
region,
regionName = addressData.region,
customAttributes;
if (mageUtils.isObject(addressData.street)) {
addressData.street = this.objectToArray(addressData.street);
}
addressData.region = {
'region_id': addressData['region_id'],
'region_code': addressData['region_code'],
region: regionName
};
if (addressData['region_id'] &&
countryData()[addressData['country_id']] &&
countryData()[addressData['country_id']].regions
) {
region = countryData()[addressData['country_id']].regions[addressData['region_id']];
if (region) {
addressData.region['region_id'] = addressData['region_id'];
addressData.region['region_code'] = region.code;
addressData.region.region = region.name;
}
} else if (
!addressData['region_id'] &&
countryData()[addressData['country_id']] &&
countryData()[addressData['country_id']].regions
) {
addressData.region['region_code'] = '';
addressData.region.region = '';
}
delete addressData['region_id'];
if (addressData['custom_attributes']) {
addressData['custom_attributes'] = _.map(
addressData['custom_attributes'],
function (value, key) {
customAttributes = {
'attribute_code': key,
'value': value
};
if (typeof value === 'boolean') {
customAttributes = {
'attribute_code': key,
'value': value,
'label': value === true ? 'Yes' : 'No'
};
}
return customAttributes;
}
);
}
return address(addressData);
},
/**
* Convert Address object to address form data.
*
* @param {Object} addrs
* @returns {Object}
*/
quoteAddressToFormAddressData: function (addrs) {
var self = this,
output = {},
streetObject,
customAttributesObject;
$.each(addrs, function (key) {
if (addrs.hasOwnProperty(key) && !$.isFunction(addrs[key])) {
output[self.toUnderscore(key)] = addrs[key];
}
});
if ($.isArray(addrs.street)) {
streetObject = {};
addrs.street.forEach(function (value, index) {
streetObject[index] = value;
});
output.street = streetObject;
}
//jscs:disable requireCamelCaseOrUpperCaseIdentifiers
if ($.isArray(addrs.customAttributes)) {
customAttributesObject = {};
addrs.customAttributes.forEach(function (value) {
customAttributesObject[value.attribute_code] = value.value;
});
output.custom_attributes = customAttributesObject;
}
//jscs:enable requireCamelCaseOrUpperCaseIdentifiers
return output;
},
/**
* @param {String} string
*/
toUnderscore: function (string) {
return string.replace(/([A-Z])/g, function ($1) {
return '_' + $1.toLowerCase();
});
},
/**
* @param {Object} formProviderData
* @param {String} formIndex
* @return {Object}
*/
formDataProviderToFlatData: function (formProviderData, formIndex) {
var addressData = {};
$.each(formProviderData, function (path, value) {
var pathComponents = path.split('.'),
dataObject = {};
pathComponents.splice(pathComponents.indexOf(formIndex), 1);
pathComponents.reverse();
$.each(pathComponents, function (index, pathPart) {
var parent = {};
if (index == 0) { //eslint-disable-line eqeqeq
dataObject[pathPart] = value;
} else {
parent[pathPart] = dataObject;
dataObject = parent;
}
});
$.extend(true, addressData, dataObject);
});
return addressData;
},
/**
* Convert object to array
* @param {Object} object
* @returns {Array}
*/
objectToArray: function (object) {
var convertedArray = [];
$.each(object, function (key) {
return typeof object[key] === 'string' ? convertedArray.push(object[key]) : false;
});
return convertedArray.slice(0);
},
/**
* @param {Object} addrs
* @return {*|Object}
*/
addressToEstimationAddress: function (addrs) {
var self = this,
estimatedAddressData = {};
$.each(addrs, function (key) {
estimatedAddressData[self.toUnderscore(key)] = addrs[key];
});
return this.formAddressDataToQuoteAddress(estimatedAddressData);
}
};
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'ko',
'Magento_Ui/js/model/messages'
], function (ko, Messages) {
'use strict';
return new Messages();
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'jquery',
'Magento_Checkout/js/model/postcode-validator',
'mage/translate',
'uiRegistry'
], function (
$,
postcodeValidator,
$t,
uiRegistry
) {
'use strict';
var postcodeElementName = 'postcode';
return {
validateZipCodeTimeout: 0,
validateDelay: 2000,
/**
* Perform postponed binding for fieldset elements
*
* @param {String} formPath
*/
initFields: function (formPath) {
var self = this;
uiRegistry.async(formPath + '.' + postcodeElementName)(self.bindHandler.bind(self));
},
/**
* @param {Object} element
* @param {Number} delay
*/
bindHandler: function (element, delay) {
var self = this;
delay = typeof delay === 'undefined' ? self.validateDelay : delay;
element.on('value', function () {
clearTimeout(self.validateZipCodeTimeout);
self.validateZipCodeTimeout = setTimeout(function () {
self.postcodeValidation(element);
}, delay);
});
},
/**
* @param {Object} postcodeElement
* @return {*}
*/
postcodeValidation: function (postcodeElement) {
var countryId = $('select[name="country_id"]:visible').val(),
validationResult,
warnMessage;
if (postcodeElement == null || postcodeElement.value() == null) {
return true;
}
postcodeElement.warn(null);
validationResult = postcodeValidator.validate(postcodeElement.value(), countryId);
if (!validationResult) {
warnMessage = $t('Provided Zip/Postal Code seems to be invalid.');
if (postcodeValidator.validatedPostCodeExample.length) {
warnMessage += $t(' Example: ') + postcodeValidator.validatedPostCodeExample.join('; ') + '. ';
}
warnMessage += $t('If you believe it is the right one you can ignore this notice.');
postcodeElement.warn(warnMessage);
}
return validationResult;
}
};
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/**
* Cart adapter for customer data storage.
* It stores cart data in customer data(localStorage) without saving on server.
* Adapter is created for shipping rates and totals data caching. It eliminates unneeded calculations requests.
*/
define([
'underscore',
'Magento_Customer/js/customer-data',
'mageUtils'
], function (_, storage, utils) {
'use strict';
var cacheKey = 'cart-data',
cartData = {
totals: null,
address: null,
cartVersion: null,
shippingMethodCode: null,
shippingCarrierCode: null,
rates: null
},
/**
* Set data to local storage.
*
* @param {Object} checkoutData
*/
setData = function (checkoutData) {
storage.set(cacheKey, checkoutData);
},
/**
* Get data from local storage.
*
* @param {String} [key]
* @returns {*}
*/
getData = function (key) {
var data = key ? storage.get(cacheKey)()[key] : storage.get(cacheKey)();
if (_.isEmpty(storage.get(cacheKey)())) {
setData(utils.copy(cartData));
}
return data;
},
/**
* Build method name base on name, prefix and suffix.
*
* @param {String} name
* @param {String} prefix
* @param {String} suffix
* @return {String}
*/
getMethodName = function (name, prefix, suffix) {
prefix = prefix || '';
suffix = suffix || '';
return prefix + name.charAt(0).toUpperCase() + name.slice(1) + suffix;
};
/**
* Provides get/set/isChanged/clear methods for work with cart data.
* Can be customized via mixin functionality.
*/
return {
cartData: cartData,
/**
* Array of required address fields
*/
requiredFields: ['countryId', 'region', 'regionId', 'postcode'],
/**
* Get data from customer data.
* Concatenate provided key with method name and call method if it exist or makes get by key.
*
* @param {String} key
* @return {*}
*/
get: function (key) {
var methodName = getMethodName(key, '_get');
if (key === cacheKey) {
return getData();
}
if (this[methodName]) {
return this[methodName]();
}
return getData(key);
},
/**
* Set data to customer data.
* Concatenate provided key with method name and call method if it exist or makes set by key.
* @example _setCustomAddress method will be called, if it exists.
* set('address', customAddressValue)
* @example Will set value by provided key.
* set('rates', ratesToCompare)
*
* @param {String} key
* @param {*} value
*/
set: function (key, value) {
var methodName = getMethodName(key, '_set'),
obj;
if (key === cacheKey) {
_.each(value, function (val, k) {
this.set(k, val);
}, this);
return;
}
if (this[methodName]) {
this[methodName](value);
} else {
obj = getData();
obj[key] = value;
setData(obj);
}
},
/**
* Clear data in cache.
* Concatenate provided key with method name and call method if it exist or clear by key.
* @example _clearCustomAddress method will be called, if it exist.
* clear('customAddress')
* @example Will clear data by provided key.
* clear('rates')
*
* @param {String} key
*/
clear: function (key) {
var methodName = getMethodName(key, '_clear');
if (key === cacheKey) {
setData(this.cartData);
return;
}
if (this[methodName]) {
this[methodName]();
} else {
this.set(key, null);
}
},
/**
* Check if provided data has difference with cached data.
* Concatenate provided key with method name and call method if it exist or makes strict equality.
* @example Will call existing _isAddressChanged.
* isChanged('address', addressToCompare)
* @example Will get data by provided key and make strict equality with provided value.
* isChanged('rates', ratesToCompare)
*
* @param {String} key
* @param {*} value
* @return {Boolean}
*/
isChanged: function (key, value) {
var methodName = getMethodName(key, '_is', 'Changed');
if (this[methodName]) {
return this[methodName](value);
}
return this.get(key) !== value;
},
/**
* Compare cached address with provided.
* Custom method for check object equality.
*
* @param {Object} address
* @returns {Boolean}
*/
_isAddressChanged: function (address) {
return JSON.stringify(_.pick(this.get('address'), this.requiredFields)) !==
JSON.stringify(_.pick(address, this.requiredFields));
},
/**
* Compare cached subtotal with provided.
* Custom method for check object equality.
*
* @param {float} subtotal
* @returns {Boolean}
*/
_isSubtotalChanged: function (subtotal) {
var cached = parseFloat(this.get('totals').subtotal);
return subtotal !== cached;
}
};
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'Magento_Checkout/js/model/quote',
'Magento_Checkout/js/model/shipping-rate-processor/new-address',
'Magento_Checkout/js/model/cart/totals-processor/default',
'Magento_Checkout/js/model/shipping-service',
'Magento_Checkout/js/model/cart/cache',
'Magento_Customer/js/customer-data'
], function (quote, defaultProcessor, totalsDefaultProvider, shippingService, cartCache, customerData) {
'use strict';
var rateProcessors = {},
totalsProcessors = {},
/**
* Estimate totals for shipping address and update shipping rates.
*/
estimateTotalsAndUpdateRates = function () {
var type = quote.shippingAddress().getType();
if (
quote.isVirtual() ||
window.checkoutConfig.activeCarriers && window.checkoutConfig.activeCarriers.length === 0
) {
// update totals block when estimated address was set
totalsProcessors['default'] = totalsDefaultProvider;
totalsProcessors[type] ?
totalsProcessors[type].estimateTotals(quote.shippingAddress()) :
totalsProcessors['default'].estimateTotals(quote.shippingAddress());
} else {
// check if user data not changed -> load rates from cache
if (!cartCache.isChanged('address', quote.shippingAddress()) &&
!cartCache.isChanged('cartVersion', customerData.get('cart')()['data_id']) &&
cartCache.get('rates')
) {
shippingService.setShippingRates(cartCache.get('rates'));
return;
}
// update rates list when estimated address was set
rateProcessors['default'] = defaultProcessor;
rateProcessors[type] ?
rateProcessors[type].getRates(quote.shippingAddress()) :
rateProcessors['default'].getRates(quote.shippingAddress());
// save rates to cache after load
shippingService.getShippingRates().subscribe(function (rates) {
cartCache.set('rates', rates);
});
}
},
/**
* Estimate totals for shipping address.
*/
estimateTotalsShipping = function () {
totalsDefaultProvider.estimateTotals(quote.shippingAddress());
},
/**
* Estimate totals for billing address.
*/
estimateTotalsBilling = function () {
var type = quote.billingAddress().getType();
if (quote.isVirtual()) {
// update totals block when estimated address was set
totalsProcessors['default'] = totalsDefaultProvider;
totalsProcessors[type] ?
totalsProcessors[type].estimateTotals(quote.billingAddress()) :
totalsProcessors['default'].estimateTotals(quote.billingAddress());
}
};
quote.shippingAddress.subscribe(estimateTotalsAndUpdateRates);
quote.shippingMethod.subscribe(estimateTotalsShipping);
quote.billingAddress.subscribe(estimateTotalsBilling);
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'underscore',
'Magento_Checkout/js/model/resource-url-manager',
'Magento_Checkout/js/model/quote',
'mage/storage',
'Magento_Checkout/js/model/totals',
'Magento_Checkout/js/model/error-processor',
'Magento_Checkout/js/model/cart/cache',
'Magento_Customer/js/customer-data'
], function (_, resourceUrlManager, quote, storage, totalsService, errorProcessor, cartCache, customerData) {
'use strict';
/**
* Load data from server.
*
* @param {Object} address
*/
var loadFromServer = function (address) {
var serviceUrl,
payload;
// Start loader for totals block
totalsService.isLoading(true);
serviceUrl = resourceUrlManager.getUrlForTotalsEstimationForNewAddress(quote);
payload = {
addressInformation: {
address: _.pick(address, cartCache.requiredFields)
}
};
if (quote.shippingMethod() && quote.shippingMethod()['method_code']) {
payload.addressInformation['shipping_method_code'] = quote.shippingMethod()['method_code'];
payload.addressInformation['shipping_carrier_code'] = quote.shippingMethod()['carrier_code'];
}
return storage.post(
serviceUrl, JSON.stringify(payload), false
).done(function (result) {
var data = {
totals: result,
address: address,
cartVersion: customerData.get('cart')()['data_id'],
shippingMethodCode: null,
shippingCarrierCode: null
};
if (quote.shippingMethod() && quote.shippingMethod()['method_code']) {
data.shippingMethodCode = quote.shippingMethod()['method_code'];
data.shippingCarrierCode = quote.shippingMethod()['carrier_code'];
}
quote.setTotals(result);
cartCache.set('cart-data', data);
}).fail(function (response) {
errorProcessor.process(response);
}).always(function () {
// Stop loader for totals block
totalsService.isLoading(false);
});
};
return {
/**
* Array of required address fields.
* @property {Array.String} requiredFields
* @deprecated Use cart cache.
*/
requiredFields: cartCache.requiredFields,
/**
* Get shipping rates for specified address.
* @param {Object} address
*/
estimateTotals: function (address) {
var data = {
shippingMethodCode: null,
shippingCarrierCode: null
};
if (quote.shippingMethod() && quote.shippingMethod()['method_code']) {
data.shippingMethodCode = quote.shippingMethod()['method_code'];
data.shippingCarrierCode = quote.shippingMethod()['carrier_code'];
}
return loadFromServer(address);
}
};
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'jquery',
'Magento_Customer/js/model/customer',
'mage/validation'
], function ($, customer) {
'use strict';
return {
/**
* Validate checkout agreements
*
* @returns {Boolean}
*/
validate: function () {
var emailValidationResult = customer.isLoggedIn(),
loginFormSelector = 'form[data-role=email-with-possible-login]';
if (!customer.isLoggedIn()) {
$(loginFormSelector).validation();
emailValidationResult = Boolean($(loginFormSelector + ' input[name=username]').valid());
}
return emailValidationResult;
}
};
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([], function () {
'use strict';
return {
/**
* @return {Object}
*/
getRules: function () {
return {
'country_id': {
'required': true
}
};
}
};
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'jquery',
'mageUtils',
'./default-validation-rules',
'mage/translate'
], function ($, utils, validationRules, $t) {
'use strict';
return {
validationErrors: [],
/**
* @param {Object} address
* @return {Boolean}
*/
validate: function (address) {
var self = this;
this.validationErrors = [];
$.each(validationRules.getRules(), function (field, rule) {
var message;
if (rule.required && utils.isEmpty(address[field])) {
message = $t('Field ') + field + $t(' is required.');
self.validationErrors.push(message);
}
});
return !this.validationErrors.length;
}
};
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/**
* @api
*/
define([
'mage/url',
'Magento_Ui/js/model/messageList',
'mage/translate'
], function (url, globalMessageList, $t) {
'use strict';
return {
/**
* @param {Object} response
* @param {Object} messageContainer
*/
process: function (response, messageContainer) {
var error;
messageContainer = messageContainer || globalMessageList;
if (response.status == 401) { //eslint-disable-line eqeqeq
window.location.replace(url.build('customer/account/login/'));
} else {
try {
error = JSON.parse(response.responseText);
} catch (exception) {
error = {
message: $t('Something went wrong with your request. Please try again later.')
};
}
messageContainer.addErrorMessage(error);
}
}
};
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'jquery',
'rjsResolver'
], function ($, resolver) {
'use strict';
var containerId = '#checkout';
return {
/**
* Start full page loader action
*/
startLoader: function () {
$(containerId).trigger('processStart');
},
/**
* Stop full page loader action
*
* @param {Boolean} [forceStop]
*/
stopLoader: function (forceStop) {
var $elem = $(containerId),
stop = $elem.trigger.bind($elem, 'processStop');
forceStop ? stop() : resolver(stop);
}
};
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/**
* @api
*/
define([
'underscore',
'Magento_Checkout/js/model/default-post-code-resolver'
], function (_, DefaultPostCodeResolver) {
'use strict';
/**
* @param {Object} addressData
* Returns new address object
*/
return function (addressData) {
var identifier = Date.now(),
countryId = addressData['country_id'] || addressData.countryId || window.checkoutConfig.defaultCountryId,
regionId;
if (addressData.region && addressData.region['region_id']) {
regionId = addressData.region['region_id'];
} else if (!addressData['region_id']) {
regionId = undefined;
} else if (
/* eslint-disable */
addressData['country_id'] && addressData['country_id'] == window.checkoutConfig.defaultCountryId ||
!addressData['country_id'] && countryId == window.checkoutConfig.defaultCountryId
/* eslint-enable */
) {
regionId = window.checkoutConfig.defaultRegionId || undefined;
}
return {
email: addressData.email,
countryId: countryId,
regionId: regionId || addressData.regionId,
regionCode: addressData.region ? addressData.region['region_code'] : null,
region: addressData.region ? addressData.region.region : null,
customerId: addressData['customer_id'] || addressData.customerId,
street: addressData.street ? _.compact(addressData.street) : addressData.street,
company: addressData.company,
telephone: addressData.telephone,
fax: addressData.fax,
postcode: addressData.postcode ? addressData.postcode : DefaultPostCodeResolver.resolve(),
city: addressData.city,
firstname: addressData.firstname,
lastname: addressData.lastname,
middlename: addressData.middlename,
prefix: addressData.prefix,
suffix: addressData.suffix,
vatId: addressData['vat_id'],
saveInAddressBook: addressData['save_in_address_book'],
customAttributes: addressData['custom_attributes'],
extensionAttributes: addressData['extension_attributes'],
/**
* @return {*}
*/
isDefaultShipping: function () {
return addressData['default_shipping'];
},
/**
* @return {*}
*/
isDefaultBilling: function () {
return addressData['default_billing'];
},
/**
* @return {String}
*/
getType: function () {
return 'new-customer-address';
},
/**
* @return {String}
*/
getKey: function () {
return this.getType();
},
/**
* @return {String}
*/
getCacheKey: function () {
return this.getType() + identifier;
},
/**
* @return {Boolean}
*/
isEditable: function () {
return true;
},
/**
* @return {Boolean}
*/
canUseForBilling: function () {
return true;
}
};
};
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'underscore',
'Magento_Checkout/js/model/quote',
'Magento_Checkout/js/model/payment/method-list',
'Magento_Checkout/js/action/select-payment-method'
], function (_, quote, methodList, selectPaymentMethod) {
'use strict';
/**
* Free method filter
* @param {Object} paymentMethod
* @return {Boolean}
*/
var isFreePaymentMethod = function (paymentMethod) {
return paymentMethod.method === 'free';
},
/**
* Grabs the grand total from quote
* @return {Number}
*/
getGrandTotal = function () {
return quote.totals()['grand_total'];
};
return {
isFreeAvailable: false,
/**
* Populate the list of payment methods
* @param {Array} methods
*/
setPaymentMethods: function (methods) {
var freeMethod,
filteredMethods,
methodIsAvailable,
methodNames;
freeMethod = _.find(methods, isFreePaymentMethod);
this.isFreeAvailable = !!freeMethod;
if (freeMethod && getGrandTotal() <= 0) {
methods.splice(0, methods.length, freeMethod);
selectPaymentMethod(freeMethod);
}
filteredMethods = _.without(methods, freeMethod);
if (filteredMethods.length === 1) {
selectPaymentMethod(filteredMethods[0]);
} else if (quote.paymentMethod()) {
methodIsAvailable = methods.some(function (item) {
return item.method === quote.paymentMethod().method;
});
//Unset selected payment method if not available
if (!methodIsAvailable) {
selectPaymentMethod(null);
}
}
/**
* Overwrite methods with existing methods to preserve ko array references.
* This prevent ko from re-rendering those methods.
*/
methodNames = _.pluck(methods, 'method');
_.map(methodList(), function (existingMethod) {
var existingMethodIndex = methodNames.indexOf(existingMethod.method);
if (existingMethodIndex !== -1) {
methods[existingMethodIndex] = existingMethod;
}
});
methodList(methods);
},
/**
* Get the list of available payment methods.
* @return {Array}
*/
getAvailablePaymentMethods: function () {
var allMethods = methodList().slice(),
grandTotalOverZero = getGrandTotal() > 0;
if (!this.isFreeAvailable) {
return allMethods;
}
if (grandTotalOverZero) {
return _.reject(allMethods, isFreePaymentMethod);
}
return _.filter(allMethods, isFreePaymentMethod);
}
};
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/**
* @api
*/
define([], function () {
'use strict';
var validators = [];
return {
/**
* Register unique validator
*
* @param {*} validator
*/
registerValidator: function (validator) {
validators.push(validator);
},
/**
* Returns array of registered validators
*
* @returns {Array}
*/
getValidators: function () {
return validators;
},
/**
* Process validators
*
* @returns {Boolean}
*/
validate: function (hideError) {
var validationResult = true;
hideError = hideError || false;
if (validators.length <= 0) {
return validationResult;
}
validators.forEach(function (item) {
if (item.validate(hideError) == false) { //eslint-disable-line eqeqeq
validationResult = false;
return false;
}
});
return validationResult;
}
};
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'underscore'
], function (_) {
'use strict';
return function (methods) {
_.each(methods, function (method) {
if (method.hasOwnProperty('code')) {
method.method = method.code;
delete method.code;
}
});
return methods;
};
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'uiElement',
'mage/translate'
], function (Element, $t) {
'use strict';
var DEFAULT_GROUP_ALIAS = 'default';
return Element.extend({
defaults: {
alias: DEFAULT_GROUP_ALIAS,
title: $t('Payment Method'),
sortOrder: 100,
displayArea: 'payment-methods-items-${ $.alias }'
},
/**
* Checks if group instance is default
*
* @returns {Boolean}
*/
isDefault: function () {
return this.alias === DEFAULT_GROUP_ALIAS;
}
});
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'ko'
], function (ko) {
'use strict';
return ko.observableArray([]);
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([], function () {
'use strict';
return {
requestModifiers: [],
afterRequestListeners: []
};
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'ko'
], function (ko) {
'use strict';
return ko.observableArray([]);
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/**
* @api
*/
define(
[
'mage/storage',
'Magento_Checkout/js/model/error-processor',
'Magento_Checkout/js/model/full-screen-loader',
'Magento_Customer/js/customer-data',
'Magento_Checkout/js/model/payment/place-order-hooks',
'underscore'
],
function (storage, errorProcessor, fullScreenLoader, customerData, hooks, _) {
'use strict';
return function (serviceUrl, payload, messageContainer) {
var headers = {};
fullScreenLoader.startLoader();
_.each(hooks.requestModifiers, function (modifier) {
modifier(headers, payload);
});
return storage.post(
serviceUrl, JSON.stringify(payload), true, 'application/json', headers
).fail(
function (response) {
errorProcessor.process(response, messageContainer);
}
).done(
function (response) {
var clearData = {
'selectedShippingAddress': null,
'shippingAddressFromData': null,
'newCustomerShippingAddress': null,
'selectedShippingRate': null,
'selectedPaymentMethod': null,
'selectedBillingAddress': null,
'billingAddressFromData': null,
'newCustomerBillingAddress': null
};
if (response.responseType !== 'error') {
customerData.set('checkout-data', clearData);
}
}
).always(
function () {
fullScreenLoader.stopLoader();
_.each(hooks.afterRequestListeners, function (listener) {
listener();
});
}
);
};
}
);
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'mageUtils'
], function (utils) {
'use strict';
return {
validatedPostCodeExample: [],
/**
* @param {*} postCode
* @param {*} countryId
* @param {Array} postCodesPatterns
* @return {Boolean}
*/
validate: function (postCode, countryId, postCodesPatterns) {
var pattern, regex,
patterns = postCodesPatterns ? postCodesPatterns[countryId] :
window.checkoutConfig.postCodes[countryId];
this.validatedPostCodeExample = [];
if (!utils.isEmpty(postCode) && !utils.isEmpty(patterns)) {
for (pattern in patterns) {
if (patterns.hasOwnProperty(pattern)) { //eslint-disable-line max-depth
this.validatedPostCodeExample.push(patterns[pattern].example);
regex = new RegExp(patterns[pattern].pattern);
if (regex.test(postCode)) { //eslint-disable-line max-depth
return true;
}
}
}
return false;
}
return true;
}
};
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/**
* @api
*/
define([
'ko',
'underscore',
'domReady!'
], function (ko, _) {
'use strict';
/**
* Get totals data from the extension attributes.
* @param {*} data
* @returns {*}
*/
var proceedTotalsData = function (data) {
if (_.isObject(data) && _.isObject(data['extension_attributes'])) {
_.each(data['extension_attributes'], function (element, index) {
data[index] = element;
});
}
return data;
},
billingAddress = ko.observable(null),
shippingAddress = ko.observable(null),
shippingMethod = ko.observable(null),
paymentMethod = ko.observable(null),
quoteData = window.checkoutConfig.quoteData,
basePriceFormat = window.checkoutConfig.basePriceFormat,
priceFormat = window.checkoutConfig.priceFormat,
storeCode = window.checkoutConfig.storeCode,
totalsData = proceedTotalsData(window.checkoutConfig.totalsData),
totals = ko.observable(totalsData),
collectedTotals = ko.observable({});
return {
totals: totals,
shippingAddress: shippingAddress,
shippingMethod: shippingMethod,
billingAddress: billingAddress,
paymentMethod: paymentMethod,
guestEmail: null,
/**
* @return {*}
*/
getQuoteId: function () {
return quoteData['entity_id'];
},
/**
* @return {Boolean}
*/
isVirtual: function () {
return !!Number(quoteData['is_virtual']);
},
/**
* @return {*}
*/
getPriceFormat: function () {
return priceFormat;
},
/**
* @return {*}
*/
getBasePriceFormat: function () {
return basePriceFormat;
},
/**
* @return {*}
*/
getItems: function () {
return window.checkoutConfig.quoteItemData;
},
/**
*
* @return {*}
*/
getTotals: function () {
return totals;
},
/**
* @param {Object} data
*/
setTotals: function (data) {
data = proceedTotalsData(data);
totals(data);
this.setCollectedTotals('subtotal_with_discount', parseFloat(data['subtotal_with_discount']));
},
/**
* @param {*} paymentMethodCode
*/
setPaymentMethod: function (paymentMethodCode) {
paymentMethod(paymentMethodCode);
},
/**
* @return {*}
*/
getPaymentMethod: function () {
return paymentMethod;
},
/**
* @return {*}
*/
getStoreCode: function () {
return storeCode;
},
/**
* @param {String} code
* @param {*} value
*/
setCollectedTotals: function (code, value) {
var colTotals = collectedTotals();
colTotals[code] = value;
collectedTotals(colTotals);
},
/**
* @return {Number}
*/
getCalculatedTotal: function () {
var total = 0.; //eslint-disable-line no-floating-decimal
_.each(collectedTotals(), function (value) {
total += value;
});
return total;
}
};
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/**
* @api
*/
define([
'Magento_Customer/js/model/customer',
'Magento_Checkout/js/model/url-builder',
'mageUtils'
], function (customer, urlBuilder, utils) {
'use strict';
return {
/**
* @param {Object} quote
* @return {*}
*/
getUrlForTotalsEstimationForNewAddress: function (quote) {
var params = this.getCheckoutMethod() == 'guest' ? //eslint-disable-line eqeqeq
{
cartId: quote.getQuoteId()
} : {},
urls = {
'guest': '/guest-carts/:cartId/totals-information',
'customer': '/carts/mine/totals-information'
};
return this.getUrl(urls, params);
},
/**
* @param {Object} quote
* @return {*}
*/
getUrlForEstimationShippingMethodsForNewAddress: function (quote) {
var params = this.getCheckoutMethod() == 'guest' ? //eslint-disable-line eqeqeq
{
quoteId: quote.getQuoteId()
} : {},
urls = {
'guest': '/guest-carts/:quoteId/estimate-shipping-methods',
'customer': '/carts/mine/estimate-shipping-methods'
};
return this.getUrl(urls, params);
},
/**
* @param {Object} quote
* @return {*}
*/
getUrlForEstimationShippingMethodsByAddressId: function (quote) {
var params = this.getCheckoutMethod() == 'guest' ? //eslint-disable-line eqeqeq
{
quoteId: quote.getQuoteId()
} : {},
urls = {
'default': '/carts/mine/estimate-shipping-methods-by-address-id'
};
return this.getUrl(urls, params);
},
/**
* @param {String} couponCode
* @param {String} quoteId
* @return {*}
*/
getApplyCouponUrl: function (couponCode, quoteId) {
var params = this.getCheckoutMethod() == 'guest' ? //eslint-disable-line eqeqeq
{
quoteId: quoteId
} : {},
urls = {
'guest': '/guest-carts/' + quoteId + '/coupons/' + encodeURIComponent(couponCode),
'customer': '/carts/mine/coupons/' + encodeURIComponent(couponCode)
};
return this.getUrl(urls, params);
},
/**
* @param {String} quoteId
* @return {*}
*/
getCancelCouponUrl: function (quoteId) {
var params = this.getCheckoutMethod() == 'guest' ? //eslint-disable-line eqeqeq
{
quoteId: quoteId
} : {},
urls = {
'guest': '/guest-carts/' + quoteId + '/coupons/',
'customer': '/carts/mine/coupons/'
};
return this.getUrl(urls, params);
},
/**
* @param {Object} quote
* @return {*}
*/
getUrlForCartTotals: function (quote) {
var params = this.getCheckoutMethod() == 'guest' ? //eslint-disable-line eqeqeq
{
quoteId: quote.getQuoteId()
} : {},
urls = {
'guest': '/guest-carts/:quoteId/totals',
'customer': '/carts/mine/totals'
};
return this.getUrl(urls, params);
},
/**
* @param {Object} quote
* @return {*}
*/
getUrlForSetShippingInformation: function (quote) {
var params = this.getCheckoutMethod() == 'guest' ? //eslint-disable-line eqeqeq
{
cartId: quote.getQuoteId()
} : {},
urls = {
'guest': '/guest-carts/:cartId/shipping-information',
'customer': '/carts/mine/shipping-information'
};
return this.getUrl(urls, params);
},
/**
* Get url for service.
*
* @param {*} urls
* @param {*} urlParams
* @return {String|*}
*/
getUrl: function (urls, urlParams) {
var url;
if (utils.isEmpty(urls)) {
return 'Provided service call does not exist.';
}
if (!utils.isEmpty(urls['default'])) {
url = urls['default'];
} else {
url = urls[this.getCheckoutMethod()];
}
return urlBuilder.createUrl(url, urlParams);
},
/**
* @return {String}
*/
getCheckoutMethod: function () {
return customer.isLoggedIn() ? 'customer' : 'guest';
}
};
}
);
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'ko'
], function (ko) {
'use strict';
return {
isVisible: ko.observable(false)
};
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'Magento_Checkout/js/model/resource-url-manager',
'Magento_Checkout/js/model/quote',
'mage/storage',
'Magento_Checkout/js/model/shipping-service',
'Magento_Checkout/js/model/shipping-rate-registry',
'Magento_Checkout/js/model/error-processor'
], function (resourceUrlManager, quote, storage, shippingService, rateRegistry, errorProcessor) {
'use strict';
return {
/**
* @param {Object} address
*/
getRates: function (address) {
var cache;
shippingService.isLoading(true);
cache = rateRegistry.get(address.getKey());
if (cache) {
shippingService.setShippingRates(cache);
shippingService.isLoading(false);
} else {
storage.post(
resourceUrlManager.getUrlForEstimationShippingMethodsByAddressId(),
JSON.stringify({
addressId: address.customerAddressId
}),
false
).done(function (result) {
rateRegistry.set(address.getKey(), result);
shippingService.setShippingRates(result);
}).fail(function (response) {
shippingService.setShippingRates([]);
errorProcessor.process(response);
}).always(function () {
shippingService.isLoading(false);
}
);
}
}
};
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'Magento_Checkout/js/model/resource-url-manager',
'Magento_Checkout/js/model/quote',
'mage/storage',
'Magento_Checkout/js/model/shipping-service',
'Magento_Checkout/js/model/shipping-rate-registry',
'Magento_Checkout/js/model/error-processor'
], function (resourceUrlManager, quote, storage, shippingService, rateRegistry, errorProcessor) {
'use strict';
return {
/**
* Get shipping rates for specified address.
* @param {Object} address
*/
getRates: function (address) {
var cache, serviceUrl, payload;
shippingService.isLoading(true);
cache = rateRegistry.get(address.getCacheKey());
serviceUrl = resourceUrlManager.getUrlForEstimationShippingMethodsForNewAddress(quote);
payload = JSON.stringify({
address: {
'street': address.street,
'city': address.city,
'region_id': address.regionId,
'region': address.region,
'country_id': address.countryId,
'postcode': address.postcode,
'email': address.email,
'customer_id': address.customerId,
'firstname': address.firstname,
'lastname': address.lastname,
'middlename': address.middlename,
'prefix': address.prefix,
'suffix': address.suffix,
'vat_id': address.vatId,
'company': address.company,
'telephone': address.telephone,
'fax': address.fax,
'custom_attributes': address.customAttributes,
'save_in_address_book': address.saveInAddressBook
}
}
);
if (cache) {
shippingService.setShippingRates(cache);
shippingService.isLoading(false);
} else {
storage.post(
serviceUrl, payload, false
).done(function (result) {
rateRegistry.set(address.getCacheKey(), result);
shippingService.setShippingRates(result);
}).fail(function (response) {
shippingService.setShippingRates([]);
errorProcessor.process(response);
}).always(function () {
shippingService.isLoading(false);
});
}
}
};
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([], function () {
'use strict';
var cache = [];
return {
/**
* @param {String} addressKey
* @return {*}
*/
get: function (addressKey) {
if (cache[addressKey]) {
return cache[addressKey];
}
return false;
},
/**
* @param {String} addressKey
* @param {*} data
*/
set: function (addressKey, data) {
cache[addressKey] = data;
}
};
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'Magento_Checkout/js/model/quote',
'Magento_Checkout/js/model/shipping-rate-processor/new-address',
'Magento_Checkout/js/model/shipping-rate-processor/customer-address'
], function (quote, defaultProcessor, customerAddressProcessor) {
'use strict';
var processors = {};
processors.default = defaultProcessor;
processors['customer-address'] = customerAddressProcessor;
quote.shippingAddress.subscribe(function () {
var type = quote.shippingAddress().getType();
if (processors[type]) {
processors[type].getRates(quote.shippingAddress());
} else {
processors.default.getRates(quote.shippingAddress());
}
});
return {
/**
* @param {String} type
* @param {*} processor
*/
registerProcessor: function (type, processor) {
processors[type] = processor;
}
};
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/**
* @api
*/
define(['jquery'], function ($) {
'use strict';
var ratesRules = {},
checkoutConfig = window.checkoutConfig;
return {
/**
* @param {String} carrier
* @param {Object} rules
*/
registerRules: function (carrier, rules) {
if (checkoutConfig.activeCarriers.indexOf(carrier) !== -1) {
ratesRules[carrier] = rules.getRules();
}
},
/**
* @return {Object}
*/
getRules: function () {
return ratesRules;
},
/**
* @return {Array}
*/
getObservableFields: function () {
var self = this,
observableFields = [];
$.each(self.getRules(), function (carrier, fields) {
$.each(fields, function (field) {
if (observableFields.indexOf(field) === -1) {
observableFields.push(field);
}
});
});
return observableFields;
}
};
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/**
* @api
*/
define([
'jquery',
'ko',
'./shipping-rates-validation-rules',
'../model/address-converter',
'../action/select-shipping-address',
'./postcode-validator',
'./default-validator',
'mage/translate',
'uiRegistry',
'Magento_Checkout/js/model/shipping-address/form-popup-state',
'Magento_Checkout/js/model/quote'
], function (
$,
ko,
shippingRatesValidationRules,
addressConverter,
selectShippingAddress,
postcodeValidator,
defaultValidator,
$t,
uiRegistry,
formPopUpState
) {
'use strict';
var checkoutConfig = window.checkoutConfig,
validators = [],
observedElements = [],
postcodeElements = [],
postcodeElementName = 'postcode';
validators.push(defaultValidator);
return {
validateAddressTimeout: 0,
validateZipCodeTimeout: 0,
validateDelay: 2000,
/**
* @param {String} carrier
* @param {Object} validator
*/
registerValidator: function (carrier, validator) {
if (checkoutConfig.activeCarriers.indexOf(carrier) !== -1) {
validators.push(validator);
}
},
/**
* @param {Object} address
* @return {Boolean}
*/
validateAddressData: function (address) {
return validators.some(function (validator) {
return validator.validate(address);
});
},
/**
* Perform postponed binding for fieldset elements
*
* @param {String} formPath
*/
initFields: function (formPath) {
var self = this,
elements = shippingRatesValidationRules.getObservableFields();
if ($.inArray(postcodeElementName, elements) === -1) {
// Add postcode field to observables if not exist for zip code validation support
elements.push(postcodeElementName);
}
$.each(elements, function (index, field) {
uiRegistry.async(formPath + '.' + field)(self.doElementBinding.bind(self));
});
},
/**
* Bind shipping rates request to form element
*
* @param {Object} element
* @param {Boolean} force
* @param {Number} delay
*/
doElementBinding: function (element, force, delay) {
var observableFields = shippingRatesValidationRules.getObservableFields();
if (element && (observableFields.indexOf(element.index) !== -1 || force)) {
if (element.index !== postcodeElementName) {
this.bindHandler(element, delay);
}
}
if (element.index === postcodeElementName) {
this.bindHandler(element, delay);
postcodeElements.push(element);
}
},
/**
* @param {*} elements
* @param {Boolean} force
* @param {Number} delay
*/
bindChangeHandlers: function (elements, force, delay) {
var self = this;
$.each(elements, function (index, elem) {
self.doElementBinding(elem, force, delay);
});
},
/**
* @param {Object} element
* @param {Number} delay
*/
bindHandler: function (element, delay) {
var self = this;
delay = typeof delay === 'undefined' ? self.validateDelay : delay;
if (element.component.indexOf('/group') !== -1) {
$.each(element.elems(), function (index, elem) {
self.bindHandler(elem);
});
} else {
element.on('value', function () {
clearTimeout(self.validateZipCodeTimeout);
self.validateZipCodeTimeout = setTimeout(function () {
if (element.index === postcodeElementName) {
self.postcodeValidation(element);
} else {
$.each(postcodeElements, function (index, elem) {
self.postcodeValidation(elem);
});
}
}, delay);
if (!formPopUpState.isVisible()) {
clearTimeout(self.validateAddressTimeout);
self.validateAddressTimeout = setTimeout(function () {
self.validateFields();
}, delay);
}
});
observedElements.push(element);
}
},
/**
* @return {*}
*/
postcodeValidation: function (postcodeElement) {
var countryId = $('select[name="country_id"]:visible').val(),
validationResult,
warnMessage;
if (postcodeElement == null || postcodeElement.value() == null) {
return true;
}
postcodeElement.warn(null);
validationResult = postcodeValidator.validate(postcodeElement.value(), countryId);
if (!validationResult) {
warnMessage = $t('Provided Zip/Postal Code seems to be invalid.');
if (postcodeValidator.validatedPostCodeExample.length) {
warnMessage += $t(' Example: ') + postcodeValidator.validatedPostCodeExample.join('; ') + '. ';
}
warnMessage += $t('If you believe it is the right one you can ignore this notice.');
postcodeElement.warn(warnMessage);
}
return validationResult;
},
/**
* Convert form data to quote address and validate fields for shipping rates
*/
validateFields: function () {
var addressFlat = addressConverter.formDataProviderToFlatData(
this.collectObservedData(),
'shippingAddress'
),
address;
if (this.validateAddressData(addressFlat)) {
addressFlat = uiRegistry.get('checkoutProvider').shippingAddress;
address = addressConverter.formAddressDataToQuoteAddress(addressFlat);
selectShippingAddress(address);
}
},
/**
* Collect observed fields data to object
*
* @returns {*}
*/
collectObservedData: function () {
var observedValues = {};
$.each(observedElements, function (index, field) {
observedValues[field.dataScope] = field.value();
});
return observedValues;
}
};
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment