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" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<update handle="checkout_cart_item_renderers"/>
<body>
<referenceContainer name="page.messages">
<block class="Magento\Checkout\Block\Cart\ValidationMessages" name="checkout.cart.validationmessages"/>
</referenceContainer>
<referenceContainer name="content">
<block class="Magento\Checkout\Block\Cart" name="checkout.cart" template="Magento_Checkout::cart.phtml" cacheable="false">
<container name="checkout.cart.items" as="with-items">
<container name="checkout.cart.container" htmlTag="div" htmlClass="cart-container" before="-">
<container name="checkout.cart.form.before" as="form_before" label="Shopping Cart Items Before" htmlTag="div" htmlClass="rewards"/>
<container name="cart.summary" label="Cart Summary Container" htmlTag="div" htmlClass="cart-summary" after="-">
<block class="Magento\Framework\View\Element\Template" name="checkout.cart.summary.title" before="-" template="Magento_Theme::text.phtml">
<arguments>
<argument translate="true" name="text" xsi:type="string">Summary</argument>
<argument name="tag" xsi:type="string">strong</argument>
<argument name="css_class" xsi:type="string">summary title</argument>
</arguments>
</block>
<block class="Magento\Checkout\Block\Cart\Shipping" name="checkout.cart.shipping" as="shipping" template="Magento_Checkout::cart/shipping.phtml" after="checkout.cart.summary.title">
<arguments>
<argument name="jsLayout" xsi:type="array">
<item name="types" xsi:type="array">
<item name="form.input" xsi:type="array">
<item name="component" xsi:type="string">Magento_Ui/js/form/element/abstract</item>
<item name="config" xsi:type="array">
<item name="provider" xsi:type="string">checkoutProvider</item>
<item name="deps" xsi:type="array">
<item name="0" xsi:type="string">checkoutProvider</item>
</item>
<item name="template" xsi:type="string">ui/form/field</item>
<item name="elementTmpl" xsi:type="string">ui/form/element/input</item>
</item>
</item>
</item>
<item name="components" xsi:type="array">
<item name="summary-block-config" xsi:type="array">
<item name="component" xsi:type="string">uiComponent</item>
<item name="children" xsi:type="array">
<item name="shipping-rates-validation" xsi:type="array">
<item name="children" xsi:type="array">
<!--Step configuration components-->
</item>
</item>
</item>
</item>
<item name="block-summary" xsi:type="array">
<item name="component" xsi:type="string">uiComponent</item>
<item name="deps" xsi:type="array">
<item name="0" xsi:type="string">summary-block-config</item>
</item>
<item name="children" xsi:type="array">
<item name="block-rates" xsi:type="array">
<item name="component" xsi:type="string">Magento_Checkout/js/view/cart/shipping-rates</item>
<item name="sortOrder" xsi:type="string">2</item>
</item>
<item name="block-shipping" xsi:type="array">
<item name="component" xsi:type="string">Magento_Checkout/js/view/cart/shipping-estimation</item>
<item name="provider" xsi:type="string">checkoutProvider</item>
<item name="sortOrder" xsi:type="string">1</item>
<item name="deps" xsi:type="array">
<item name="0" xsi:type="string">block-summary.block-shipping.address-fieldsets</item>
</item>
<item name="children" xsi:type="array">
<item name="address-fieldsets" xsi:type="array">
<item name="component" xsi:type="string">uiComponent</item>
<item name="config" xsi:type="array">
<item name="deps" xsi:type="array">
<item name="0" xsi:type="string">checkoutProvider</item>
</item>
</item>
<item name="displayArea" xsi:type="string">address-fieldsets</item>
<item name="children" xsi:type="array">
<item name="city" xsi:type="array">
<item name="sortOrder" xsi:type="string">115</item>
<item name="dataScope" xsi:type="string">shippingAddress.city</item>
<item name="provider" xsi:type="string">checkoutProvider</item>
</item>
<item name="country_id" xsi:type="array">
<item name="sortOrder" xsi:type="string">110</item>
<item name="dataScope" xsi:type="string">shippingAddress.country_id</item>
<item name="provider" xsi:type="string">checkoutProvider</item>
</item>
<item name="region_id" xsi:type="array">
<item name="component" xsi:type="string">Magento_Ui/js/form/element/region</item>
<item name="sortOrder" xsi:type="string">112</item>
<item name="config" xsi:type="array">
<item name="template" xsi:type="string">ui/form/field</item>
<item name="elementTmpl" xsi:type="string">ui/form/element/select</item>
<item name="customEntry" xsi:type="string">shippingAddress.region</item>
</item>
<!-- Value of region_id field is filtered by the value of county_id attribute -->
<item name="filterBy" xsi:type="array">
<item name="target" xsi:type="string"><![CDATA[${ $.provider }:${ $.parentScope }.country_id]]></item>
<item name="field" xsi:type="string">country_id</item>
</item>
</item>
<!-- The following items override configuration of corresponding address attributes -->
<item name="region" xsi:type="array">
<!-- Make region attribute invisible on frontend. Corresponding input element is created by region_id field -->
<item name="visible" xsi:type="boolean">false</item>
<item name="component" xsi:type="string">Magento_Ui/js/form/element/abstract</item>
<item name="sortOrder" xsi:type="string">111</item>
<item name="dataScope" xsi:type="string">shippingAddress.region</item>
</item>
<item name="postcode" xsi:type="array">
<!-- post-code field has custom UI component -->
<item name="component" xsi:type="string">Magento_Ui/js/form/element/abstract</item>
<item name="dataScope" xsi:type="string">shippingAddress.postcode</item>
<item name="sortOrder" xsi:type="string">114</item>
<item name="provider" xsi:type="string">checkoutProvider</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
<item name="checkoutProvider" xsi:type="array">
<item name="component" xsi:type="string">uiComponent</item>
</item>
</item>
</argument>
</arguments>
</block>
<container name="checkout.cart.totals.container" as="totals" label="Shopping Cart Totals">
<block class="Magento\Checkout\Block\Cart\Totals" name="checkout.cart.totals" template="Magento_Checkout::cart/totals.phtml">
<arguments>
<argument name="jsLayout" xsi:type="array">
<item name="components" xsi:type="array">
<item name="block-totals" xsi:type="array">
<item name="component" xsi:type="string">Magento_Checkout/js/view/cart/totals</item>
<item name="displayArea" xsi:type="string">totals</item>
<item name="config" xsi:type="array">
<item name="template" xsi:type="string">Magento_Checkout/cart/totals</item>
</item>
<item name="children" xsi:type="array">
<!-- sort order for this totals is configured on admin panel-->
<!-- Stores->Configuration->SALES->Sales->General->Checkout Totals Sort Order -->
<item name="subtotal" xsi:type="array">
<item name="component" xsi:type="string">Magento_Checkout/js/view/summary/subtotal</item>
<item name="config" xsi:type="array">
<item name="title" xsi:type="string" translate="true">Subtotal</item>
<item name="template" xsi:type="string">Magento_Checkout/cart/totals/subtotal</item>
</item>
</item>
<item name="shipping" xsi:type="array">
<item name="component" xsi:type="string">Magento_Checkout/js/view/cart/totals/shipping</item>
<item name="config" xsi:type="array">
<item name="title" xsi:type="string" translate="true">Shipping</item>
<item name="template" xsi:type="string">Magento_Checkout/cart/totals/shipping</item>
</item>
</item>
<item name="grand-total" xsi:type="array">
<item name="component" xsi:type="string">Magento_Checkout/js/view/summary/grand-total</item>
<item name="config" xsi:type="array">
<item name="title" xsi:type="string" translate="true">Order Total</item>
<item name="template" xsi:type="string">Magento_Checkout/cart/totals/grand-total</item>
</item>
</item>
</item>
</item>
</item>
</argument>
</arguments>
</block>
</container>
<block class="Magento\Checkout\Block\Cart\Coupon" name="checkout.cart.coupon" as="coupon" template="Magento_Checkout::cart/coupon.phtml"/>
<block class="Magento\Checkout\Block\Cart" name="checkout.cart.methods.bottom" template="Magento_Checkout::cart/methods.phtml">
<container name="checkout.cart.methods" as="methods" label="Payment Methods After Checkout Button">
<block class="Magento\Checkout\Block\Onepage\Link" name="checkout.cart.methods.onepage.bottom" template="Magento_Checkout::onepage/link.phtml" />
<block class="Magento\Checkout\Block\QuoteShortcutButtons" name="checkout.cart.shortcut.buttons" />
</container>
</block>
</container>
<block class="Magento\Checkout\Block\Cart\Grid" name="checkout.cart.form" as="cart-items" template="Magento_Checkout::cart/form.phtml" after="cart.summary">
<arguments>
<argument name="view_model" xsi:type="object">Magento\Checkout\ViewModel\Cart</argument>
</arguments>
<block class="Magento\Framework\View\Element\RendererList" name="checkout.cart.item.renderers" as="renderer.list"/>
<block class="Magento\Framework\View\Element\Text\ListText" name="checkout.cart.order.actions"/>
</block>
<container name="checkout.cart.widget" as="checkout_cart_widget" label="Shopping Cart Items After" after="cart-items"/>
</container>
<block class="Magento\Checkout\Block\Cart\Crosssell" name="checkout.cart.crosssell" template="Magento_Catalog::product/list/items.phtml" after="-" ifconfig="checkout/cart/crosssell_enabled">
<arguments>
<argument name="type" xsi:type="string">crosssell</argument>
<argument name="view_model" xsi:type="object">Magento\Catalog\ViewModel\Product\Listing\PreparePostData</argument>
</arguments>
<block class="Magento\Catalog\Block\Product\ProductList\Item\Container" name="crosssell.product.addto" as="addto">
<block class="Magento\Catalog\Block\Product\ProductList\Item\AddTo\Compare"
name="crosssell.product.addto.compare" as="compare"
template="Magento_Catalog::product/list/addto/compare.phtml"/>
</block>
</block>
</container>
<container name="checkout.cart.noitems" as="no-items">
<block class="Magento\Checkout\Block\Cart" name="checkout.cart.empty" before="-" template="Magento_Checkout::cart/noItems.phtml">
<container name="checkout.cart.empty.widget" as="checkout_cart_empty_widget" label="Empty Shopping Cart Content Before"/>
</block>
</container>
</block>
</referenceContainer>
<block class="Magento\Checkout\Block\Cart\Additional\Info" name="additional.product.info" template="Magento_Checkout::cart/additional/info.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" 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" layout="checkout" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<block class="Magento\Checkout\Block\Onepage" name="checkout.root" template="Magento_Checkout::onepage.phtml" cacheable="false">
<arguments>
<argument name="jsLayout" xsi:type="array">
<item name="types" xsi:type="array">
<item name="form.input" xsi:type="array">
<item name="component" xsi:type="string">Magento_Ui/js/form/element/abstract</item>
<item name="config" xsi:type="array">
<item name="provider" xsi:type="string">checkoutProvider</item>
<item name="deps" xsi:type="array">
<item name="0" xsi:type="string">checkoutProvider</item>
</item>
<item name="template" xsi:type="string">ui/form/field</item>
<item name="elementTmpl" xsi:type="string">ui/form/element/input</item>
</item>
</item>
</item>
<item name="components" xsi:type="array">
<item name="checkout" 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/onepage</item>
</item>
<item name="children" xsi:type="array">
<item name="errors" xsi:type="array">
<item name="component" xsi:type="string">Magento_Ui/js/view/messages</item>
<item name="displayArea" xsi:type="string">messages</item>
</item>
<item name="authentication" xsi:type="array">
<item name="component" xsi:type="string">Magento_Checkout/js/view/authentication</item>
<item name="displayArea" xsi:type="string">authentication</item>
<item name="children" xsi:type="array">
<!--Additional authentication fields-->
<item name="errors" xsi:type="array">
<item name="sortOrder" xsi:type="string">0</item>
<item name="component" xsi:type="string">Magento_Checkout/js/view/authentication-messages</item>
<item name="displayArea" xsi:type="string">messages</item>
</item>
</item>
</item>
<item name="progressBar" xsi:type="array">
<item name="component" xsi:type="string">Magento_Checkout/js/view/progress-bar</item>
<item name="displayArea" xsi:type="string">progressBar</item>
<item name="config" xsi:type="array">
<item name="deps" xsi:type="array">
<item name="0" xsi:type="string">checkout.steps.shipping-step.shippingAddress</item>
<item name="1" xsi:type="string">checkout.steps.billing-step.payment</item>
</item>
</item>
</item>
<item name="estimation" xsi:type="array">
<item name="component" xsi:type="string">Magento_Checkout/js/view/estimation</item>
<item name="displayArea" xsi:type="string">estimation</item>
<item name="config" xsi:type="array">
<item name="template" xsi:type="string">Magento_Checkout/estimation</item>
<item name="deps" xsi:type="array">
<item name="0" xsi:type="string">checkout.sidebar</item>
</item>
</item>
</item>
<item name="steps" xsi:type="array">
<item name="component" xsi:type="string">uiComponent</item>
<item name="displayArea" xsi:type="string">steps</item>
<item name="children" xsi:type="array">
<item name="shipping-step" xsi:type="array">
<item name="component" xsi:type="string">uiComponent</item>
<item name="sortOrder" xsi:type="string">1</item>
<item name="children" xsi:type="array">
<item name="step-config" xsi:type="array">
<item name="component" xsi:type="string">uiComponent</item>
<item name="children" xsi:type="array">
<item name="shipping-rates-validation" xsi:type="array">
<item name="children" xsi:type="array">
<!--Step configuration components-->
</item>
</item>
</item>
</item>
<item name="shippingAddress" xsi:type="array">
<item name="config" xsi:type="array">
<item name="deps" xsi:type="array">
<item name="0" xsi:type="string">checkout.steps.shipping-step.step-config</item>
<item name="1" xsi:type="string">checkoutProvider</item>
</item>
<item name="popUpForm" xsi:type="array">
<item name="element" xsi:type="string">#opc-new-shipping-address</item>
<item name="options" xsi:type="array">
<item name="type" xsi:type="string">popup</item>
<item name="responsive" xsi:type="boolean">true</item>
<item name="innerScroll" xsi:type="boolean">true</item>
<item name="title" xsi:type="string" translate="true">Shipping Address</item>
<item name="trigger" xsi:type="string">opc-new-shipping-address</item>
<item name="buttons" xsi:type="array">
<item name="save" xsi:type="array">
<item name="text" xsi:type="string" translate="true">Ship Here</item>
<item name="class" xsi:type="string">action primary action-save-address</item>
</item>
<item name="cancel" xsi:type="array">
<item name="text" xsi:type="string" translate="true">Cancel</item>
<item name="class" xsi:type="string">action secondary action-hide-popup</item>
</item>
</item>
</item>
</item>
</item>
<item name="component" xsi:type="string">Magento_Checkout/js/view/shipping</item>
<item name="provider" xsi:type="string">checkoutProvider</item>
<item name="sortOrder" xsi:type="string">10</item>
<item name="children" xsi:type="array">
<item name="customer-email" xsi:type="array">
<item name="component" xsi:type="string">Magento_Checkout/js/view/form/element/email</item>
<item name="displayArea" xsi:type="string">customer-email</item>
<item name="tooltip" xsi:type="array">
<item name="description" xsi:type="string" translate="true">We'll send your order confirmation here.</item>
</item>
<item name="children" xsi:type="array">
<item name="before-login-form" xsi:type="array">
<item name="component" xsi:type="string">uiComponent</item>
<item name="displayArea" xsi:type="string">before-login-form</item>
<item name="children" xsi:type="array">
<!-- before login form fields -->
</item>
</item>
<item name="additional-login-form-fields" xsi:type="array">
<item name="component" xsi:type="string">uiComponent</item>
<item name="displayArea" xsi:type="string">additional-login-form-fields</item>
<item name="children" xsi:type="array">
<!-- additional login form fields -->
</item>
</item>
</item>
</item>
<item name="before-form" xsi:type="array">
<item name="component" xsi:type="string">uiComponent</item>
<item name="displayArea" xsi:type="string">before-form</item>
<item name="children" xsi:type="array">
<!-- before form fields -->
</item>
</item>
<item name="before-fields" xsi:type="array">
<item name="component" xsi:type="string">uiComponent</item>
<item name="displayArea" xsi:type="string">before-fields</item>
<item name="children" xsi:type="array">
<!-- before fields -->
</item>
</item>
<item name="address-list" xsi:type="array">
<item name="component" xsi:type="string">Magento_Checkout/js/view/shipping-address/list</item>
<item name="displayArea" xsi:type="string">address-list</item>
</item>
<item name="address-list-additional-addresses" xsi:type="array">
<item name="component" xsi:type="string">uiComponent</item>
<item name="displayArea" xsi:type="string">address-list-additional-addresses</item>
<item name="children" xsi:type="array">
<!-- address-list-additional-addresses -->
</item>
</item>
<item name="before-shipping-method-form" xsi:type="array">
<item name="component" xsi:type="string">uiComponent</item>
<item name="displayArea" xsi:type="string">before-shipping-method-form</item>
<item name="children" xsi:type="array">
<!-- address-list-additional-addresses -->
</item>
</item>
<item name="shipping-address-fieldset" xsi:type="array">
<item name="component" xsi:type="string">uiComponent</item>
<item name="config" xsi:type="array">
<item name="deps" xsi:type="array">
<item name="0" xsi:type="string">checkoutProvider</item>
</item>
</item>
<item name="displayArea" xsi:type="string">additional-fieldsets</item>
<item name="children" xsi:type="array">
<!-- The following items override configuration of corresponding address attributes -->
<item name="region" xsi:type="array">
<!-- Make region attribute invisible on frontend. Corresponding input element is created by region_id field -->
<item name="visible" xsi:type="boolean">false</item>
</item>
<item name="region_id" xsi:type="array">
<item name="component" xsi:type="string">Magento_Ui/js/form/element/region</item>
<item name="config" xsi:type="array">
<item name="template" xsi:type="string">ui/form/field</item>
<item name="elementTmpl" xsi:type="string">ui/form/element/select</item>
<item name="customEntry" xsi:type="string">shippingAddress.region</item>
</item>
<item name="validation" xsi:type="array">
<item name="required-entry" xsi:type="boolean">true</item>
</item>
<!-- Value of region_id field is filtered by the value of county_id attribute -->
<item name="filterBy" xsi:type="array">
<item name="target" xsi:type="string"><![CDATA[${ $.provider }:${ $.parentScope }.country_id]]></item>
<item name="field" xsi:type="string">country_id</item>
</item>
</item>
<item name="postcode" xsi:type="array">
<!-- post-code field has custom UI component -->
<item name="component" xsi:type="string">Magento_Ui/js/form/element/post-code</item>
<item name="validation" xsi:type="array">
<item name="required-entry" xsi:type="boolean">true</item>
</item>
</item>
<item name="company" xsi:type="array">
<item name="validation" xsi:type="array">
<item name="min_text_length" xsi:type="number">0</item>
</item>
</item>
<item name="fax" xsi:type="array">
<item name="validation" xsi:type="array">
<item name="min_text_length" xsi:type="number">0</item>
</item>
</item>
<item name="telephone" xsi:type="array">
<item name="config" xsi:type="array">
<item name="tooltip" xsi:type="array">
<item name="description" xsi:type="string" translate="true">For delivery questions.</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
<item name="billing-step" xsi:type="array">
<item name="component" xsi:type="string">uiComponent</item>
<item name="sortOrder" xsi:type="string">2</item>
<item name="children" xsi:type="array">
<item name="payment" xsi:type="array">
<item name="component" xsi:type="string">Magento_Checkout/js/view/payment</item>
<item name="config" xsi:type="array">
<item name="title" xsi:type="string" translate="true">Payment</item>
<item name="sortOrder" xsi:type="string">20</item>
</item>
<item name="children" xsi:type="array">
<item name="renders" xsi:type="array">
<item name="component" xsi:type="string">uiComponent</item>
<item name="children" xsi:type="array">
<!-- merge payment method renders here -->
</item>
</item>
<item name="additional-payment-validators" xsi:type="array">
<item name="component" xsi:type="string">uiComponent</item>
<item name="children" xsi:type="array">
<!-- merge payment validators here -->
<item name="email-validator" xsi:type="array">
<item name="component" xsi:type="string">Magento_Checkout/js/view/payment/email-validator</item>
</item>
</item>
</item>
<item name="customer-email" xsi:type="array">
<item name="component" xsi:type="string">Magento_Checkout/js/view/form/element/email</item>
<item name="displayArea" xsi:type="string">customer-email</item>
<item name="tooltip" xsi:type="array">
<item name="description" xsi:type="string" translate="true">We'll send your order confirmation here.</item>
</item>
<item name="children" xsi:type="array">
<item name="before-login-form" xsi:type="array">
<item name="component" xsi:type="string">uiComponent</item>
<item name="displayArea" xsi:type="string">before-login-form</item>
<item name="children" xsi:type="array">
<!-- before login form fields -->
</item>
</item>
<item name="additional-login-form-fields" xsi:type="array">
<item name="component" xsi:type="string">uiComponent</item>
<item name="displayArea" xsi:type="string">additional-login-form-fields</item>
<item name="children" xsi:type="array">
<!-- additional login form fields -->
</item>
</item>
</item>
</item>
<item name="place-order-captcha" xsi:type="array">
<item name="component" xsi:type="string">Magento_Checkout/js/view/checkout/placeOrderCaptcha</item>
<item name="displayArea" xsi:type="string">place-order-captcha</item>
<item name="formId" xsi:type="string">payment_processing_request</item>
<item name="configSource" xsi:type="string">checkoutConfig</item>
</item>
<item name="beforeMethods" xsi:type="array">
<item name="component" xsi:type="string">uiComponent</item>
<item name="displayArea" xsi:type="string">beforeMethods</item>
<item name="children" xsi:type="array">
<!-- merge additional data before payment methods here -->
</item>
<item name="validation" xsi:type="array">
<item name="validate-select" xsi:type="string">true</item>
</item>
<!-- Value of region_id field is filtered by the value of county_id attribute -->
<item name="filterBy" xsi:type="array">
<item name="target" xsi:type="string">${ $.provider }:${ $.parentScope }.country_id</item>
<item name="field" xsi:type="string">country_id</item>
</item>
</item>
<item name="payments-list" xsi:type="array">
<item name="component" xsi:type="string">Magento_Checkout/js/view/payment/list</item>
<item name="displayArea" xsi:type="string">payment-methods-list</item>
<item name="config" xsi:type="array">
<item name="deps" xsi:type="array">
<item name="0" xsi:type="string">checkout.steps.billing-step.payment.renders</item>
<item name="1" xsi:type="string">checkout.steps.billing-step.payment.additional-payment-validators</item>
</item>
</item>
<item name="children" xsi:type="array">
<item name="before-place-order" xsi:type="array">
<item name="component" xsi:type="string">uiComponent</item>
<item name="displayArea" xsi:type="string">before-place-order</item>
<item name="dataScope" xsi:type="string">before-place-order</item>
<item name="provider" xsi:type="string">checkoutProvider</item>
<item name="config" xsi:type="array">
<item name="template" xsi:type="string">Magento_Checkout/payment/before-place-order</item>
</item>
</item>
</item>
</item>
<!-- merge your payment methods here -->
<item name="afterMethods" xsi:type="array">
<item name="component" xsi:type="string">uiComponent</item>
<item name="displayArea" xsi:type="string">afterMethods</item>
<item name="children" xsi:type="array">
<!-- merge additional data after payment methods here -->
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
<item name="sidebar" xsi:type="array">
<item name="component" xsi:type="string">Magento_Checkout/js/view/sidebar</item>
<item name="displayArea" xsi:type="string">sidebar</item>
<item name="config" xsi:type="array">
<item name="template" xsi:type="string">Magento_Checkout/sidebar</item>
<item name="deps" xsi:type="array">
<item name="0" xsi:type="string">checkout.steps</item>
</item>
</item>
<item name="children" xsi:type="array">
<item name="summary" xsi:type="array">
<item name="component" xsi:type="string">Magento_Checkout/js/view/summary</item>
<item name="displayArea" xsi:type="string">summary</item>
<item name="config" xsi:type="array">
<item name="template" xsi:type="string">Magento_Checkout/summary</item>
</item>
<item name="children" xsi:type="array">
<item name="totals" xsi:type="array">
<item name="component" xsi:type="string">Magento_Checkout/js/view/summary/totals</item>
<item name="displayArea" xsi:type="string">totals</item>
<item name="config" xsi:type="array">
<item name="template" xsi:type="string">Magento_Checkout/summary/totals</item>
</item>
<item name="children" xsi:type="array">
<!-- sort order for this totals is configured on admin panel-->
<!-- Stores->Configuration->SALES->Sales->General->Checkout Totals Sort Order -->
<item name="subtotal" xsi:type="array">
<item name="component" xsi:type="string">Magento_Checkout/js/view/summary/subtotal</item>
<item name="config" xsi:type="array">
<item name="title" xsi:type="string" translate="true">Cart Subtotal</item>
</item>
</item>
<item name="shipping" xsi:type="array">
<item name="component" xsi:type="string">Magento_Checkout/js/view/summary/shipping</item>
<item name="config" xsi:type="array">
<item name="title" xsi:type="string" translate="true">Shipping</item>
<item name="notCalculatedMessage" xsi:type="string" translate="true">Not yet calculated</item>
</item>
</item>
<item name="grand-total" xsi:type="array">
<item name="component" xsi:type="string">Magento_Checkout/js/view/summary/grand-total</item>
<item name="config" xsi:type="array">
<item name="title" xsi:type="string" translate="true">Order Total</item>
</item>
</item>
</item>
</item>
<item name="itemsBefore" xsi:type="array">
<item name="component" xsi:type="string">uiComponent</item>
<item name="children" xsi:type="array">
<!-- merge your components here -->
</item>
</item>
<item name="cart_items" xsi:type="array">
<item name="component" xsi:type="string">Magento_Checkout/js/view/summary/cart-items</item>
<item name="children" xsi:type="array">
<item name="details" xsi:type="array">
<item name="component" xsi:type="string">Magento_Checkout/js/view/summary/item/details</item>
<item name="children" xsi:type="array">
<item name="thumbnail" xsi:type="array">
<item name="component" xsi:type="string">Magento_Checkout/js/view/summary/item/details/thumbnail</item>
<item name="displayArea" xsi:type="string">before_details</item>
</item>
<item name="subtotal" xsi:type="array">
<item name="component" xsi:type="string">Magento_Checkout/js/view/summary/item/details/subtotal</item>
<item name="displayArea" xsi:type="string">after_details</item>
</item>
<item name="message" xsi:type="array">
<item name="component" xsi:type="string">Magento_Checkout/js/view/summary/item/details/message</item>
<item name="displayArea" xsi:type="string">item_message</item>
</item>
</item>
</item>
</item>
</item>
<item name="itemsAfter" xsi:type="array">
<item name="component" xsi:type="string">uiComponent</item>
<item name="children" xsi:type="array">
<!-- merge your components here -->
</item>
</item>
</item>
</item>
<item name="shipping-information" xsi:type="array">
<item name="component" xsi:type="string">Magento_Checkout/js/view/shipping-information</item>
<item name="config" xsi:type="array">
<item name="deps" xsi:type="string">checkout.steps.shipping-step.shippingAddress</item>
</item>
<item name="displayArea" xsi:type="string">shipping-information</item>
<item name="children" xsi:type="array">
<item name="ship-to" xsi:type="array">
<item name="component" xsi:type="string">Magento_Checkout/js/view/shipping-information/list</item>
<item name="displayArea" xsi:type="string">ship-to</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
<item name="checkoutProvider" xsi:type="array">
<item name="component" xsi:type="string">uiComponent</item>
</item>
</item>
</argument>
</arguments>
</block>
</referenceContainer>
<referenceContainer name="page.messages" remove="true"/>
</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.
*/
/**
* Checkout adapter for customer data storage
*/
define([
'Magento_Customer/js/model/address-list',
'Magento_Checkout/js/model/quote',
'Magento_Checkout/js/checkout-data',
'Magento_Checkout/js/action/create-shipping-address',
'Magento_Checkout/js/action/select-shipping-address',
'Magento_Checkout/js/action/select-shipping-method',
'Magento_Checkout/js/model/payment-service',
'Magento_Checkout/js/action/select-payment-method',
'Magento_Checkout/js/model/address-converter',
'Magento_Checkout/js/action/select-billing-address',
'Magento_Checkout/js/action/create-billing-address',
'underscore'
], function (
addressList,
quote,
checkoutData,
createShippingAddress,
selectShippingAddress,
selectShippingMethodAction,
paymentService,
selectPaymentMethodAction,
addressConverter,
selectBillingAddress,
createBillingAddress,
_
) {
'use strict';
var isBillingAddressResolvedFromBackend = false;
return {
/**
* Resolve estimation address. Used local storage
*/
resolveEstimationAddress: function () {
var address;
if (checkoutData.getShippingAddressFromData()) {
address = addressConverter.formAddressDataToQuoteAddress(checkoutData.getShippingAddressFromData());
selectShippingAddress(address);
} else {
this.resolveShippingAddress();
}
if (quote.isVirtual()) {
if (checkoutData.getBillingAddressFromData()) {
address = addressConverter.formAddressDataToQuoteAddress(
checkoutData.getBillingAddressFromData()
);
selectBillingAddress(address);
} else {
this.resolveBillingAddress();
}
}
},
/**
* Resolve shipping address. Used local storage
*/
resolveShippingAddress: function () {
var newCustomerShippingAddress;
if (!checkoutData.getShippingAddressFromData() &&
window.checkoutConfig.shippingAddressFromData
) {
checkoutData.setShippingAddressFromData(window.checkoutConfig.shippingAddressFromData);
}
newCustomerShippingAddress = checkoutData.getNewCustomerShippingAddress();
if (newCustomerShippingAddress) {
createShippingAddress(newCustomerShippingAddress);
}
this.applyShippingAddress();
},
/**
* Apply resolved estimated address to quote
*
* @param {Object} isEstimatedAddress
*/
applyShippingAddress: function (isEstimatedAddress) {
var address,
shippingAddress,
isConvertAddress;
if (addressList().length === 0) {
address = addressConverter.formAddressDataToQuoteAddress(
checkoutData.getShippingAddressFromData()
);
selectShippingAddress(address);
}
shippingAddress = quote.shippingAddress();
isConvertAddress = isEstimatedAddress || false;
if (!shippingAddress) {
shippingAddress = this.getShippingAddressFromCustomerAddressList();
if (shippingAddress) {
selectShippingAddress(
isConvertAddress ?
addressConverter.addressToEstimationAddress(shippingAddress)
: shippingAddress
);
}
}
},
/**
* @param {Object} ratesData
*/
resolveShippingRates: function (ratesData) {
var selectedShippingRate = checkoutData.getSelectedShippingRate(),
availableRate = false;
if (ratesData.length === 1 && !quote.shippingMethod()) {
//set shipping rate if we have only one available shipping rate
selectShippingMethodAction(ratesData[0]);
return;
}
if (quote.shippingMethod()) {
availableRate = _.find(ratesData, function (rate) {
return rate['carrier_code'] == quote.shippingMethod()['carrier_code'] && //eslint-disable-line
rate['method_code'] == quote.shippingMethod()['method_code']; //eslint-disable-line eqeqeq
});
}
if (!availableRate && selectedShippingRate) {
availableRate = _.find(ratesData, function (rate) {
return rate['carrier_code'] + '_' + rate['method_code'] === selectedShippingRate;
});
}
if (!availableRate && window.checkoutConfig.selectedShippingMethod) {
availableRate = _.find(ratesData, function (rate) {
var selectedShippingMethod = window.checkoutConfig.selectedShippingMethod;
return rate['carrier_code'] == selectedShippingMethod['carrier_code'] && //eslint-disable-line
rate['method_code'] == selectedShippingMethod['method_code']; //eslint-disable-line eqeqeq
});
}
//Unset selected shipping method if not available
if (!availableRate) {
selectShippingMethodAction(null);
} else {
selectShippingMethodAction(availableRate);
}
},
/**
* Resolve payment method. Used local storage
*/
resolvePaymentMethod: function () {
var availablePaymentMethods = paymentService.getAvailablePaymentMethods(),
selectedPaymentMethod = checkoutData.getSelectedPaymentMethod();
if (selectedPaymentMethod) {
availablePaymentMethods.some(function (payment) {
if (payment.method == selectedPaymentMethod) { //eslint-disable-line eqeqeq
selectPaymentMethodAction(payment);
}
});
}
},
/**
* Resolve billing address. Used local storage
*/
resolveBillingAddress: function () {
var selectedBillingAddress,
newCustomerBillingAddressData;
selectedBillingAddress = checkoutData.getSelectedBillingAddress();
newCustomerBillingAddressData = checkoutData.getNewCustomerBillingAddress();
if (selectedBillingAddress) {
if (selectedBillingAddress === 'new-customer-billing-address' && newCustomerBillingAddressData) {
selectBillingAddress(createBillingAddress(newCustomerBillingAddressData));
} else {
addressList.some(function (address) {
if (selectedBillingAddress === address.getKey()) {
selectBillingAddress(address);
}
});
}
} else {
this.applyBillingAddress();
}
if (!isBillingAddressResolvedFromBackend &&
!checkoutData.getBillingAddressFromData() &&
!_.isEmpty(window.checkoutConfig.billingAddressFromData) &&
!quote.billingAddress()
) {
if (window.checkoutConfig.isBillingAddressFromDataValid === true) {
selectBillingAddress(createBillingAddress(window.checkoutConfig.billingAddressFromData));
} else {
checkoutData.setBillingAddressFromData(window.checkoutConfig.billingAddressFromData);
}
isBillingAddressResolvedFromBackend = true;
}
},
/**
* Apply resolved billing address to quote
*/
applyBillingAddress: function () {
var shippingAddress,
isBillingAddressInitialized;
if (quote.billingAddress()) {
selectBillingAddress(quote.billingAddress());
return;
}
if (quote.isVirtual() || !quote.billingAddress()) {
isBillingAddressInitialized = addressList.some(function (addrs) {
if (addrs.isDefaultBilling()) {
selectBillingAddress(addrs);
return true;
}
return false;
});
}
shippingAddress = quote.shippingAddress();
if (!isBillingAddressInitialized &&
shippingAddress &&
shippingAddress.canUseForBilling() &&
(shippingAddress.isDefaultShipping() || !quote.isVirtual())
) {
//set billing address same as shipping by default if it is not empty
selectBillingAddress(quote.shippingAddress());
}
},
/**
* Get shipping address from address list
*
* @return {Object|null}
*/
getShippingAddressFromCustomerAddressList: function () {
var shippingAddress = _.find(
addressList(),
function (address) {
return checkoutData.getSelectedShippingAddress() == address.getKey() //eslint-disable-line
}
);
if (!shippingAddress) {
shippingAddress = _.find(
addressList(),
function (address) {
return address.isDefaultShipping();
}
);
}
if (!shippingAddress && addressList().length === 1) {
shippingAddress = addressList()[0];
}
return shippingAddress;
}
};
});
/**
* 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;
}
};
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/**
* @api
*/
define([
'Magento_Checkout/js/model/shipping-save-processor/default'
], function (defaultProcessor) {
'use strict';
var processors = {};
processors['default'] = defaultProcessor;
return {
/**
* @param {String} type
* @param {*} processor
*/
registerProcessor: function (type, processor) {
processors[type] = processor;
},
/**
* @param {String} type
* @return {Array}
*/
saveShippingInformation: function (type) {
var rates = [];
if (processors[type]) {
rates = processors[type].saveShippingInformation();
} else {
rates = processors['default'].saveShippingInformation();
}
return rates;
}
};
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'ko',
'Magento_Checkout/js/model/quote',
'Magento_Checkout/js/model/resource-url-manager',
'mage/storage',
'Magento_Checkout/js/model/payment-service',
'Magento_Checkout/js/model/payment/method-converter',
'Magento_Checkout/js/model/error-processor',
'Magento_Checkout/js/model/full-screen-loader',
'Magento_Checkout/js/action/select-billing-address',
'Magento_Checkout/js/model/shipping-save-processor/payload-extender'
], function (
ko,
quote,
resourceUrlManager,
storage,
paymentService,
methodConverter,
errorProcessor,
fullScreenLoader,
selectBillingAddressAction,
payloadExtender
) {
'use strict';
return {
/**
* @return {jQuery.Deferred}
*/
saveShippingInformation: function () {
var payload;
if (!quote.billingAddress() && quote.shippingAddress().canUseForBilling()) {
selectBillingAddressAction(quote.shippingAddress());
}
payload = {
addressInformation: {
'shipping_address': quote.shippingAddress(),
'billing_address': quote.billingAddress(),
'shipping_method_code': quote.shippingMethod()['method_code'],
'shipping_carrier_code': quote.shippingMethod()['carrier_code']
}
};
payloadExtender(payload);
fullScreenLoader.startLoader();
return storage.post(
resourceUrlManager.getUrlForSetShippingInformation(quote),
JSON.stringify(payload)
).done(
function (response) {
quote.setTotals(response.totals);
paymentService.setPaymentMethods(methodConverter(response['payment_methods']));
fullScreenLoader.stopLoader();
}
).fail(
function (response) {
errorProcessor.process(response);
fullScreenLoader.stopLoader();
}
);
}
};
});
define([], function () {
'use strict';
return function (payload) {
payload.addressInformation['extension_attributes'] = {};
return payload;
};
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'ko',
'Magento_Checkout/js/model/checkout-data-resolver'
], function (ko, checkoutDataResolver) {
'use strict';
var shippingRates = ko.observableArray([]);
return {
isLoading: ko.observable(false),
/**
* Set shipping rates
*
* @param {*} ratesData
*/
setShippingRates: function (ratesData) {
shippingRates(ratesData);
shippingRates.valueHasMutated();
checkoutDataResolver.resolveShippingRates(ratesData);
},
/**
* Get shipping rates
*
* @returns {*}
*/
getShippingRates: function () {
return shippingRates;
}
};
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([], function () {
'use strict';
return {
popUp: false,
/**
* @param {Object} popUp
*/
setPopup: function (popUp) {
this.popUp = popUp;
},
/**
* Show popup.
*/
show: function () {
if (this.popUp) {
this.popUp.modal('openModal');
}
},
/**
* Hide popup.
*/
hide: function () {
if (this.popUp) {
this.popUp.modal('closeModal');
}
}
};
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/**
* @api
*/
define([
'jquery',
'ko'
], function ($, ko) {
'use strict';
var steps = ko.observableArray();
return {
steps: steps,
stepCodes: [],
validCodes: [],
/**
* @return {Boolean}
*/
handleHash: function () {
var hashString = window.location.hash.replace('#', ''),
isRequestedStepVisible;
if (hashString === '') {
return false;
}
if ($.inArray(hashString, this.validCodes) === -1) {
window.location.href = window.checkoutConfig.pageNotFoundUrl;
return false;
}
isRequestedStepVisible = steps.sort(this.sortItems).some(function (element) {
return (element.code == hashString || element.alias == hashString) && element.isVisible(); //eslint-disable-line
});
//if requested step is visible, then we don't need to load step data from server
if (isRequestedStepVisible) {
return false;
}
steps().sort(this.sortItems).forEach(function (element) {
if (element.code == hashString || element.alias == hashString) { //eslint-disable-line eqeqeq
element.navigate(element);
} else {
element.isVisible(false);
}
});
return false;
},
/**
* @param {String} code
* @param {*} alias
* @param {*} title
* @param {Function} isVisible
* @param {*} navigate
* @param {*} sortOrder
*/
registerStep: function (code, alias, title, isVisible, navigate, sortOrder) {
var hash, active;
if ($.inArray(code, this.validCodes) !== -1) {
throw new DOMException('Step code [' + code + '] already registered in step navigator');
}
if (alias != null) {
if ($.inArray(alias, this.validCodes) !== -1) {
throw new DOMException('Step code [' + alias + '] already registered in step navigator');
}
this.validCodes.push(alias);
}
this.validCodes.push(code);
steps.push({
code: code,
alias: alias != null ? alias : code,
title: title,
isVisible: isVisible,
navigate: navigate,
sortOrder: sortOrder
});
active = this.getActiveItemIndex();
steps.each(function (elem, index) {
if (active !== index) {
elem.isVisible(false);
}
});
this.stepCodes.push(code);
hash = window.location.hash.replace('#', '');
if (hash != '' && hash != code) { //eslint-disable-line eqeqeq
//Force hiding of not active step
isVisible(false);
}
},
/**
* @param {Object} itemOne
* @param {Object} itemTwo
* @return {Number}
*/
sortItems: function (itemOne, itemTwo) {
return itemOne.sortOrder > itemTwo.sortOrder ? 1 : -1;
},
/**
* @return {Number}
*/
getActiveItemIndex: function () {
var activeIndex = 0;
steps().sort(this.sortItems).some(function (element, index) {
if (element.isVisible()) {
activeIndex = index;
return true;
}
return false;
});
return activeIndex;
},
/**
* @param {*} code
* @return {Boolean}
*/
isProcessed: function (code) {
var activeItemIndex = this.getActiveItemIndex(),
sortedItems = steps().sort(this.sortItems),
requestedItemIndex = -1;
sortedItems.forEach(function (element, index) {
if (element.code == code) { //eslint-disable-line eqeqeq
requestedItemIndex = index;
}
});
return activeItemIndex > requestedItemIndex;
},
/**
* @param {*} code
* @param {*} scrollToElementId
*/
navigateTo: function (code, scrollToElementId) {
var sortedItems = steps().sort(this.sortItems),
bodyElem = $('body');
scrollToElementId = scrollToElementId || null;
if (!this.isProcessed(code)) {
return;
}
sortedItems.forEach(function (element) {
if (element.code == code) { //eslint-disable-line eqeqeq
element.isVisible(true);
bodyElem.animate({
scrollTop: $('#' + code).offset().top
}, 0, function () {
window.location = window.checkoutConfig.checkoutUrl + '#' + code;
});
if (scrollToElementId && $('#' + scrollToElementId).length) {
bodyElem.animate({
scrollTop: $('#' + scrollToElementId).offset().top
}, 0);
}
} else {
element.isVisible(false);
}
});
},
/**
* Sets window location hash.
*
* @param {String} hash
*/
setHash: function (hash) {
window.location.hash = hash;
},
/**
* Next step.
*/
next: function () {
var activeIndex = 0,
code;
steps().sort(this.sortItems).forEach(function (element, index) {
if (element.isVisible()) {
element.isVisible(false);
activeIndex = index;
}
});
if (steps().length > activeIndex + 1) {
code = steps()[activeIndex + 1].code;
steps()[activeIndex + 1].isVisible(true);
this.setHash(code);
document.body.scrollTop = document.documentElement.scrollTop = 0;
}
}
};
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/**
* @api
*/
define([
'ko',
'Magento_Checkout/js/model/quote',
'Magento_Customer/js/customer-data'
], function (ko, quote, customerData) {
'use strict';
var quoteItems = ko.observable(quote.totals().items),
cartData = customerData.get('cart'),
quoteSubtotal = parseFloat(quote.totals().subtotal),
subtotalAmount = parseFloat(cartData().subtotalAmount);
quote.totals.subscribe(function (newValue) {
quoteItems(newValue.items);
});
if (!isNaN(subtotalAmount) && quoteSubtotal !== subtotalAmount) {
customerData.reload(['cart'], false);
}
return {
totals: quote.totals,
isLoading: ko.observable(false),
/**
* @return {Function}
*/
getItems: function () {
return quoteItems;
},
/**
* @param {*} code
* @return {*}
*/
getSegment: function (code) {
var i, total;
if (!this.totals()) {
return null;
}
for (i in this.totals()['total_segments']) { //eslint-disable-line guard-for-in
total = this.totals()['total_segments'][i];
if (total.code == code) { //eslint-disable-line eqeqeq
return total;
}
}
return null;
}
};
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define(['jquery'], function ($) {
'use strict';
return {
method: 'rest',
storeCode: window.checkoutConfig.storeCode,
version: 'V1',
serviceUrl: ':method/:storeCode/:version',
/**
* @param {String} url
* @param {Object} params
* @return {*}
*/
createUrl: function (url, params) {
var completeUrl = this.serviceUrl + url;
return this.bindParams(completeUrl, params);
},
/**
* @param {String} url
* @param {Object} params
* @return {*}
*/
bindParams: function (url, params) {
var urlParts;
params.method = this.method;
params.storeCode = this.storeCode;
params.version = this.version;
urlParts = url.split('/');
urlParts = urlParts.filter(Boolean);
$.each(urlParts, function (key, part) {
part = part.replace(':', '');
if (params[part] != undefined) { //eslint-disable-line eqeqeq
urlParts[key] = params[part];
}
});
return urlParts.join('/');
}
};
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'jquery',
'Magento_Customer/js/model/authentication-popup',
'Magento_Customer/js/customer-data'
], function ($, authenticationPopup, customerData) {
'use strict';
return function (config, element) {
$(element).click(function (event) {
var cart = customerData.get('cart'),
customer = customerData.get('customer');
event.preventDefault();
if (!customer().firstname && cart().isGuestCheckoutAllowed === false) {
authenticationPopup.showModal();
return false;
}
$(element).attr('disabled', true);
location.href = config.checkoutUrl;
});
};
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'jquery',
'mage/template',
'underscore',
'jquery-ui-modules/widget',
'mage/validation'
], function ($, mageTemplate, _) {
'use strict';
$.widget('mage.regionUpdater', {
options: {
regionTemplate:
'<option value="<%- data.value %>" <% if (data.isSelected) { %>selected="selected"<% } %>>' +
'<%- data.title %>' +
'</option>',
isRegionRequired: true,
isZipRequired: true,
isCountryRequired: true,
currentRegion: null,
isMultipleCountriesAllowed: true
},
/**
*
* @private
*/
_create: function () {
this._initCountryElement();
this.currentRegionOption = this.options.currentRegion;
this.regionTmpl = mageTemplate(this.options.regionTemplate);
this._updateRegion(this.element.find('option:selected').val());
$(this.options.regionListId).on('change', $.proxy(function (e) {
this.setOption = false;
this.currentRegionOption = $(e.target).val();
}, this));
$(this.options.regionInputId).on('focusout', $.proxy(function () {
this.setOption = true;
}, this));
},
/**
*
* @private
*/
_initCountryElement: function () {
if (this.options.isMultipleCountriesAllowed) {
this.element.parents('div.field').show();
this.element.on('change', $.proxy(function (e) {
// clear region inputs on country change
$(this.options.regionListId).val('');
$(this.options.regionInputId).val('');
this._updateRegion($(e.target).val());
}, this));
if (this.options.isCountryRequired) {
this.element.addClass('required-entry');
this.element.parents('div.field').addClass('required');
}
} else {
this.element.parents('div.field').hide();
}
},
/**
* Remove options from dropdown list
*
* @param {Object} selectElement - jQuery object for dropdown list
* @private
*/
_removeSelectOptions: function (selectElement) {
selectElement.find('option').each(function (index) {
if (index) {
$(this).remove();
}
});
},
/**
* Render dropdown list
* @param {Object} selectElement - jQuery object for dropdown list
* @param {String} key - region code
* @param {Object} value - region object
* @private
*/
_renderSelectOption: function (selectElement, key, value) {
selectElement.append($.proxy(function () {
var name = value.name.replace(/[!"#$%&'()*+,.\/:;<=>?@[\\\]^`{|}~]/g, '\\$&'),
tmplData,
tmpl;
if (value.code && $(name).is('span')) {
key = value.code;
value.name = $(name).text();
}
tmplData = {
value: key,
title: value.name,
isSelected: false
};
if (this.options.defaultRegion === key) {
tmplData.isSelected = true;
}
tmpl = this.regionTmpl({
data: tmplData
});
return $(tmpl);
}, this));
},
/**
* Takes clearError callback function as first option
* If no form is passed as option, look up the closest form and call clearError method.
* @private
*/
_clearError: function () {
var args = ['clearError', this.options.regionListId, this.options.regionInputId, this.options.postcodeId];
if (this.options.clearError && typeof this.options.clearError === 'function') {
this.options.clearError.call(this);
} else {
if (!this.options.form) {
this.options.form = this.element.closest('form').length ? $(this.element.closest('form')[0]) : null;
}
this.options.form = $(this.options.form);
this.options.form && this.options.form.data('validator') &&
this.options.form.validation.apply(this.options.form, _.compact(args));
// Clean up errors on region & zip fix
$(this.options.regionInputId).removeClass('mage-error').parent().find('[generated]').remove();
$(this.options.regionListId).removeClass('mage-error').parent().find('[generated]').remove();
$(this.options.postcodeId).removeClass('mage-error').parent().find('[generated]').remove();
}
},
/**
* Update dropdown list based on the country selected
*
* @param {String} country - 2 uppercase letter for country code
* @private
*/
_updateRegion: function (country) {
// Clear validation error messages
var regionList = $(this.options.regionListId),
regionInput = $(this.options.regionInputId),
postcode = $(this.options.postcodeId),
label = regionList.parent().siblings('label'),
container = regionList.parents('div.field'),
regionsEntries,
regionId,
regionData;
this._clearError();
this._checkRegionRequired(country);
// Populate state/province dropdown list if available or use input box
if (this.options.regionJson[country]) {
this._removeSelectOptions(regionList);
regionsEntries = _.pairs(this.options.regionJson[country]);
regionsEntries.sort(function (a, b) {
return a[1].name > b[1].name ? 1 : -1;
});
$.each(regionsEntries, $.proxy(function (key, value) {
regionId = value[0];
regionData = value[1];
this._renderSelectOption(regionList, regionId, regionData);
}, this));
if (this.currentRegionOption) {
regionList.val(this.currentRegionOption);
}
if (this.setOption) {
regionList.find('option').filter(function () {
return this.text === regionInput.val();
}).attr('selected', true);
}
if (this.options.isRegionRequired) {
regionList.addClass('required-entry').removeAttr('disabled');
container.addClass('required').show();
} else {
regionList.removeClass('required-entry validate-select').removeAttr('data-validate');
container.removeClass('required');
if (!this.options.optionalRegionAllowed) { //eslint-disable-line max-depth
regionList.hide();
container.hide();
} else {
regionList.removeAttr('disabled').show();
}
}
regionList.show();
regionInput.hide();
label.attr('for', regionList.attr('id'));
} else {
this._removeSelectOptions(regionList);
if (this.options.isRegionRequired) {
regionInput.addClass('required-entry').removeAttr('disabled');
container.addClass('required').show();
} else {
if (!this.options.optionalRegionAllowed) { //eslint-disable-line max-depth
regionInput.attr('disabled', 'disabled');
container.hide();
}
container.removeClass('required');
regionInput.removeClass('required-entry');
}
regionList.removeClass('required-entry').prop('disabled', 'disabled').hide();
regionInput.show();
label.attr('for', regionInput.attr('id'));
}
// If country is in optionalzip list, make postcode input not required
if (this.options.isZipRequired) {
$.inArray(country, this.options.countriesWithOptionalZip) >= 0 ?
postcode.removeClass('required-entry').closest('.field').removeClass('required') :
postcode.addClass('required-entry').closest('.field').addClass('required');
}
// Add defaultvalue attribute to state/province select element
regionList.attr('defaultvalue', this.options.defaultRegion);
this.options.form.find('[type="submit"]').removeAttr('disabled').show();
},
/**
* Check if the selected country has a mandatory region selection
*
* @param {String} country - Code of the country - 2 uppercase letter for country code
* @private
*/
_checkRegionRequired: function (country) {
var self = this;
this.options.isRegionRequired = false;
$.each(this.options.regionJson.config['regions_required'], function (index, elem) {
if (elem === country) {
self.options.isRegionRequired = true;
}
});
}
});
return $.mage.regionUpdater;
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'jquery',
'Magento_Ui/js/modal/confirm',
'jquery-ui-modules/widget',
'mage/translate'
], function ($, confirm) {
'use strict';
$.widget('mage.shoppingCart', {
/** @inheritdoc */
_create: function () {
var items, i, reload;
$(this.options.emptyCartButton).on('click', $.proxy(function () {
this._confirmClearCart();
}, this));
items = $.find('[data-role="cart-item-qty"]');
for (i = 0; i < items.length; i++) {
$(items[i]).on('keypress', $.proxy(function (event) { //eslint-disable-line no-loop-func
var keyCode = event.keyCode ? event.keyCode : event.which;
if (keyCode == 13) { //eslint-disable-line eqeqeq
$(this.options.emptyCartButton).attr('name', 'update_cart_action_temp');
$(this.options.updateCartActionContainer)
.attr('name', 'update_cart_action').attr('value', 'update_qty');
}
}, this));
}
$(this.options.continueShoppingButton).on('click', $.proxy(function () {
location.href = this.options.continueShoppingUrl;
}, this));
$(document).on('ajax:removeFromCart', $.proxy(function () {
reload = true;
$('div.block.block-minicart').on('dropdowndialogclose', $.proxy(function () {
if (reload === true) {
location.reload();
reload = false;
}
$('div.block.block-minicart').off('dropdowndialogclose');
}));
}, this));
$(document).on('ajax:updateItemQty', $.proxy(function () {
reload = true;
$('div.block.block-minicart').on('dropdowndialogclose', $.proxy(function () {
if (reload === true) {
location.reload();
reload = false;
}
$('div.block.block-minicart').off('dropdowndialogclose');
}));
}, this));
},
/**
* Display confirmation modal for clearing the cart
* @private
*/
_confirmClearCart: function () {
var self = this;
confirm({
content: $.mage.__('Are you sure you want to remove all items from your shopping cart?'),
actions: {
/**
* Confirmation modal handler to execute clear cart action
*/
confirm: function () {
self.clearCart();
}
}
});
},
/**
* Prepares the form and submit to clear the cart
* @public
*/
clearCart: function () {
$(this.options.emptyCartButton).attr('name', 'update_cart_action_temp');
$(this.options.updateCartActionContainer)
.attr('name', 'update_cart_action').attr('value', 'empty_cart');
if ($(this.options.emptyCartButton).parents('form').length > 0) {
$(this.options.emptyCartButton).parents('form').trigger('submit');
}
}
});
return $.mage.shoppingCart;
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'jquery',
'Magento_Customer/js/model/authentication-popup',
'Magento_Customer/js/customer-data',
'Magento_Ui/js/modal/alert',
'Magento_Ui/js/modal/confirm',
'underscore',
'jquery-ui-modules/widget',
'mage/decorate',
'mage/collapsible',
'mage/cookies',
'jquery-ui-modules/effect-fade'
], function ($, authenticationPopup, customerData, alert, confirm, _) {
'use strict';
$.widget('mage.sidebar', {
options: {
isRecursive: true,
minicart: {
maxItemsVisible: 3
}
},
scrollHeight: 0,
shoppingCartUrl: window.checkout.shoppingCartUrl,
/**
* Create sidebar.
* @private
*/
_create: function () {
this._initContent();
},
/**
* Update sidebar block.
*/
update: function () {
$(this.options.targetElement).trigger('contentUpdated');
this._calcHeight();
},
/**
* @private
*/
_initContent: function () {
var self = this,
events = {};
this.element.decorate('list', this.options.isRecursive);
/**
* @param {jQuery.Event} event
*/
events['click ' + this.options.button.close] = function (event) {
event.stopPropagation();
$(self.options.targetElement).dropdownDialog('close');
};
events['click ' + this.options.button.checkout] = $.proxy(function () {
var cart = customerData.get('cart'),
customer = customerData.get('customer'),
element = $(this.options.button.checkout);
if (!customer().firstname && cart().isGuestCheckoutAllowed === false) {
// set URL for redirect on successful login/registration. It's postprocessed on backend.
$.cookie('login_redirect', this.options.url.checkout);
if (this.options.url.isRedirectRequired) {
element.prop('disabled', true);
location.href = this.options.url.loginUrl;
} else {
authenticationPopup.showModal();
}
return false;
}
element.prop('disabled', true);
location.href = this.options.url.checkout;
}, this);
/**
* @param {jQuery.Event} event
*/
events['click ' + this.options.button.remove] = function (event) {
event.stopPropagation();
confirm({
content: self.options.confirmMessage,
actions: {
/** @inheritdoc */
confirm: function () {
self._removeItem($(event.currentTarget));
},
/** @inheritdoc */
always: function (e) {
e.stopImmediatePropagation();
}
}
});
};
/**
* @param {jQuery.Event} event
*/
events['keyup ' + this.options.item.qty] = function (event) {
self._showItemButton($(event.target));
};
/**
* @param {jQuery.Event} event
*/
events['change ' + this.options.item.qty] = function (event) {
self._showItemButton($(event.target));
};
/**
* @param {jQuery.Event} event
*/
events['click ' + this.options.item.button] = function (event) {
event.stopPropagation();
self._updateItemQty($(event.currentTarget));
};
/**
* @param {jQuery.Event} event
*/
events['focusout ' + this.options.item.qty] = function (event) {
self._validateQty($(event.currentTarget));
};
this._on(this.element, events);
this._calcHeight();
},
/**
* @param {HTMLElement} elem
* @private
*/
_showItemButton: function (elem) {
var itemId = elem.data('cart-item'),
itemQty = elem.data('item-qty');
if (this._isValidQty(itemQty, elem.val())) {
$('#update-cart-item-' + itemId).show('fade', 300);
} else if (elem.val() == 0) { //eslint-disable-line eqeqeq
this._hideItemButton(elem);
} else {
this._hideItemButton(elem);
}
},
/**
* @param {*} origin - origin qty. 'data-item-qty' attribute.
* @param {*} changed - new qty.
* @returns {Boolean}
* @private
*/
_isValidQty: function (origin, changed) {
return origin != changed && //eslint-disable-line eqeqeq
changed.length > 0 &&
changed - 0 == changed && //eslint-disable-line eqeqeq
changed - 0 > 0;
},
/**
* @param {Object} elem
* @private
*/
_validateQty: function (elem) {
var itemQty = elem.data('item-qty');
if (!this._isValidQty(itemQty, elem.val())) {
elem.val(itemQty);
}
},
/**
* @param {HTMLElement} elem
* @private
*/
_hideItemButton: function (elem) {
var itemId = elem.data('cart-item');
$('#update-cart-item-' + itemId).hide('fade', 300);
},
/**
* @param {HTMLElement} elem
* @private
*/
_updateItemQty: function (elem) {
var itemId = elem.data('cart-item');
this._ajax(this.options.url.update, {
'item_id': itemId,
'item_qty': $('#cart-item-' + itemId + '-qty').val()
}, elem, this._updateItemQtyAfter);
},
/**
* Update content after update qty
*
* @param {HTMLElement} elem
*/
_updateItemQtyAfter: function (elem) {
var productData = this._getProductById(Number(elem.data('cart-item')));
if (!_.isUndefined(productData)) {
$(document).trigger('ajax:updateCartItemQty');
if (window.location.href === this.shoppingCartUrl) {
window.location.reload(false);
}
}
this._hideItemButton(elem);
},
/**
* @param {HTMLElement} elem
* @private
*/
_removeItem: function (elem) {
var itemId = elem.data('cart-item');
this._ajax(this.options.url.remove, {
'item_id': itemId
}, elem, this._removeItemAfter);
},
/**
* Update content after item remove
*
* @param {Object} elem
* @private
*/
_removeItemAfter: function (elem) {
var productData = this._getProductById(Number(elem.data('cart-item')));
if (!_.isUndefined(productData)) {
$(document).trigger('ajax:removeFromCart', {
productIds: [productData['product_id']],
productInfo: [
{
'id': productData['product_id']
}
]
});
if (window.location.href.indexOf(this.shoppingCartUrl) === 0) {
window.location.reload();
}
}
},
/**
* Retrieves product data by Id.
*
* @param {Number} productId - product Id
* @returns {Object|undefined}
* @private
*/
_getProductById: function (productId) {
return _.find(customerData.get('cart')().items, function (item) {
return productId === Number(item['item_id']);
});
},
/**
* @param {String} url - ajax url
* @param {Object} data - post data for ajax call
* @param {Object} elem - element that initiated the event
* @param {Function} callback - callback method to execute after AJAX success
*/
_ajax: function (url, data, elem, callback) {
$.extend(data, {
'form_key': $.mage.cookies.get('form_key')
});
$.ajax({
url: url,
data: data,
type: 'post',
dataType: 'json',
context: this,
/** @inheritdoc */
beforeSend: function () {
elem.attr('disabled', 'disabled');
},
/** @inheritdoc */
complete: function () {
elem.attr('disabled', null);
}
})
.done(function (response) {
var msg;
if (response.success) {
callback.call(this, elem, response);
} else {
msg = response['error_message'];
if (msg) {
alert({
content: msg
});
}
}
})
.fail(function (error) {
console.log(JSON.stringify(error));
});
},
/**
* Calculate height of minicart list
*
* @private
*/
_calcHeight: function () {
var self = this,
height = 0,
counter = this.options.minicart.maxItemsVisible,
target = $(this.options.minicart.list),
outerHeight;
self.scrollHeight = 0;
target.children().each(function () {
if ($(this).find('.options').length > 0) {
$(this).collapsible();
}
outerHeight = $(this).outerHeight(true);
if (counter-- > 0) {
height += outerHeight;
}
self.scrollHeight += outerHeight;
});
target.parent().height(height);
}
});
return $.mage.sidebar;
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'Magento_Ui/js/view/messages',
'Magento_Checkout/js/model/authentication-messages'
], function (Component, messageContainer) {
'use strict';
return Component.extend({
/** @inheritdoc */
initialize: function (config) {
return this._super(config, messageContainer);
}
});
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'jquery',
'Magento_Ui/js/form/form',
'Magento_Customer/js/action/login',
'Magento_Customer/js/model/customer',
'mage/validation',
'Magento_Checkout/js/model/authentication-messages',
'Magento_Checkout/js/model/full-screen-loader'
], function ($, Component, loginAction, customer, validation, messageContainer, fullScreenLoader) {
'use strict';
var checkoutConfig = window.checkoutConfig;
return Component.extend({
isGuestCheckoutAllowed: checkoutConfig.isGuestCheckoutAllowed,
isCustomerLoginRequired: checkoutConfig.isCustomerLoginRequired,
registerUrl: checkoutConfig.registerUrl,
forgotPasswordUrl: checkoutConfig.forgotPasswordUrl,
autocomplete: checkoutConfig.autocomplete,
defaults: {
template: 'Magento_Checkout/authentication'
},
/**
* Is login form enabled for current customer.
*
* @return {Boolean}
*/
isActive: function () {
return !customer.isLoggedIn();
},
/**
* Provide login action.
*
* @param {HTMLElement} loginForm
*/
login: function (loginForm) {
var loginData = {},
formDataArray = $(loginForm).serializeArray();
formDataArray.forEach(function (entry) {
loginData[entry.name] = entry.value;
});
if ($(loginForm).validation() &&
$(loginForm).validation('isValid')
) {
fullScreenLoader.startLoader();
loginAction(loginData, checkoutConfig.checkoutUrl, undefined, messageContainer).always(function () {
fullScreenLoader.stopLoader();
});
}
}
});
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/**
* @deprecated since version 2.2.0
*/
define(['uiComponent'], function (Component) {
'use strict';
return Component.extend({
defaults: {
displayArea: 'beforePlaceOrder'
}
});
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'ko',
'underscore',
'Magento_Ui/js/form/form',
'Magento_Customer/js/model/customer',
'Magento_Customer/js/model/address-list',
'Magento_Checkout/js/model/quote',
'Magento_Checkout/js/action/create-billing-address',
'Magento_Checkout/js/action/select-billing-address',
'Magento_Checkout/js/checkout-data',
'Magento_Checkout/js/model/checkout-data-resolver',
'Magento_Customer/js/customer-data',
'Magento_Checkout/js/action/set-billing-address',
'Magento_Ui/js/model/messageList',
'mage/translate',
'Magento_Checkout/js/model/billing-address-postcode-validator',
'Magento_Checkout/js/model/address-converter'
],
function (
ko,
_,
Component,
customer,
addressList,
quote,
createBillingAddress,
selectBillingAddress,
checkoutData,
checkoutDataResolver,
customerData,
setBillingAddressAction,
globalMessageList,
$t,
billingAddressPostcodeValidator,
addressConverter
) {
'use strict';
var lastSelectedBillingAddress = null,
addressUpadated = false,
addressEdited = false,
countryData = customerData.get('directory-data'),
addressOptions = addressList().filter(function (address) {
return address.getType() === 'customer-address';
});
return Component.extend({
defaults: {
template: 'Magento_Checkout/billing-address',
actionsTemplate: 'Magento_Checkout/billing-address/actions',
formTemplate: 'Magento_Checkout/billing-address/form',
detailsTemplate: 'Magento_Checkout/billing-address/details',
links: {
isAddressFormVisible: '${$.billingAddressListProvider}:isNewAddressSelected'
}
},
currentBillingAddress: quote.billingAddress,
customerHasAddresses: addressOptions.length > 0,
/**
* Init component
*/
initialize: function () {
this._super();
quote.paymentMethod.subscribe(function () {
checkoutDataResolver.resolveBillingAddress();
}, this);
billingAddressPostcodeValidator.initFields(this.get('name') + '.form-fields');
},
/**
* @return {exports.initObservable}
*/
initObservable: function () {
this._super()
.observe({
selectedAddress: null,
isAddressDetailsVisible: quote.billingAddress() != null,
isAddressFormVisible: !customer.isLoggedIn() || !addressOptions.length,
isAddressSameAsShipping: false,
saveInAddressBook: 1
});
quote.billingAddress.subscribe(function (newAddress) {
if (quote.isVirtual()) {
this.isAddressSameAsShipping(false);
} else {
this.isAddressSameAsShipping(
newAddress != null &&
newAddress.getCacheKey() == quote.shippingAddress().getCacheKey() //eslint-disable-line eqeqeq
);
}
if (newAddress != null && newAddress.saveInAddressBook !== undefined) {
this.saveInAddressBook(newAddress.saveInAddressBook);
} else {
this.saveInAddressBook(1);
}
this.isAddressDetailsVisible(true);
}, this);
return this;
},
canUseShippingAddress: ko.computed(function () {
return !quote.isVirtual() && quote.shippingAddress() && quote.shippingAddress().canUseForBilling();
}),
/**
* @param {Object} address
* @return {*}
*/
addressOptionsText: function (address) {
return address.getAddressInline();
},
/**
* @return {Boolean}
*/
useShippingAddress: function () {
if (this.isAddressSameAsShipping()) {
selectBillingAddress(quote.shippingAddress());
this.updateAddresses();
this.isAddressDetailsVisible(true);
} else {
lastSelectedBillingAddress = quote.billingAddress();
quote.billingAddress(null);
this.isAddressDetailsVisible(false);
}
checkoutData.setSelectedBillingAddress(null);
return true;
},
/**
* Update address action
*/
updateAddress: function () {
var addressData, newBillingAddress;
addressUpadated = true;
if (this.selectedAddress() && !this.isAddressFormVisible()) {
selectBillingAddress(this.selectedAddress());
checkoutData.setSelectedBillingAddress(this.selectedAddress().getKey());
} else {
this.source.set('params.invalid', false);
this.source.trigger(this.dataScopePrefix + '.data.validate');
if (this.source.get(this.dataScopePrefix + '.custom_attributes')) {
this.source.trigger(this.dataScopePrefix + '.custom_attributes.data.validate');
}
if (!this.source.get('params.invalid')) {
addressData = this.source.get(this.dataScopePrefix);
if (customer.isLoggedIn() && !this.customerHasAddresses) { //eslint-disable-line max-depth
this.saveInAddressBook(1);
}
addressData['save_in_address_book'] = this.saveInAddressBook() ? 1 : 0;
newBillingAddress = createBillingAddress(addressData);
// New address must be selected as a billing address
selectBillingAddress(newBillingAddress);
checkoutData.setSelectedBillingAddress(newBillingAddress.getKey());
checkoutData.setNewCustomerBillingAddress(addressData);
}
}
setBillingAddressAction(globalMessageList);
this.updateAddresses();
},
/**
* Edit address action
*/
editAddress: function () {
addressUpadated = false;
addressEdited = true;
lastSelectedBillingAddress = quote.billingAddress();
quote.billingAddress(null);
this.isAddressDetailsVisible(false);
},
/**
* Cancel address edit action
*/
cancelAddressEdit: function () {
addressUpadated = true;
this.restoreBillingAddress();
if (quote.billingAddress()) {
// restore 'Same As Shipping' checkbox state
this.isAddressSameAsShipping(
quote.billingAddress() != null &&
quote.billingAddress().getCacheKey() == quote.shippingAddress().getCacheKey() && //eslint-disable-line
!quote.isVirtual()
);
this.isAddressDetailsVisible(true);
}
},
/**
* Manage cancel button visibility
*/
canUseCancelBillingAddress: ko.computed(function () {
return quote.billingAddress() || lastSelectedBillingAddress;
}),
/**
* Check if Billing Address Changes should be canceled
*/
needCancelBillingAddressChanges: function () {
if (addressEdited && !addressUpadated) {
this.cancelAddressEdit();
}
},
/**
* Restore billing address
*/
restoreBillingAddress: function () {
var lastBillingAddress;
if (lastSelectedBillingAddress != null) {
selectBillingAddress(lastSelectedBillingAddress);
lastBillingAddress = addressConverter.quoteAddressToFormAddressData(lastSelectedBillingAddress);
checkoutData.setNewCustomerBillingAddress(lastBillingAddress);
}
},
/**
* @param {Number} countryId
* @return {*}
*/
getCountryName: function (countryId) {
return countryData()[countryId] != undefined ? countryData()[countryId].name : ''; //eslint-disable-line
},
/**
* Trigger action to update shipping and billing addresses
*/
updateAddresses: function () {
if (window.checkoutConfig.reloadOnBillingAddress ||
!window.checkoutConfig.displayBillingOnPaymentMethod
) {
setBillingAddressAction(globalMessageList);
}
},
/**
* Get code
* @param {Object} parent
* @returns {String}
*/
getCode: function (parent) {
return _.isFunction(parent.getCode) ? parent.getCode() : 'shared';
},
/**
* Get customer attribute label
*
* @param {*} attribute
* @returns {*}
*/
getCustomAttributeLabel: function (attribute) {
var label;
if (typeof attribute === 'string') {
return attribute;
}
if (attribute.label) {
return attribute.label;
}
if (_.isArray(attribute.value)) {
label = _.map(attribute.value, function (value) {
return this.getCustomAttributeOptionLabel(attribute['attribute_code'], value) || value;
}, this).join(', ');
} else {
label = this.getCustomAttributeOptionLabel(attribute['attribute_code'], attribute.value);
}
return label || attribute.value;
},
/**
* Get option label for given attribute code and option ID
*
* @param {String} attributeCode
* @param {String} value
* @returns {String|null}
*/
getCustomAttributeOptionLabel: function (attributeCode, value) {
var option,
label,
options = this.source.get('customAttributes') || {};
if (options[attributeCode]) {
option = _.findWhere(options[attributeCode], {
value: value
});
if (option) {
label = option.label;
}
}
return label;
}
});
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'uiComponent',
'Magento_Customer/js/model/address-list',
'mage/translate',
'Magento_Customer/js/model/customer'
], function (Component, addressList, $t, customer) {
'use strict';
var newAddressOption = {
/**
* Get new address label
* @returns {String}
*/
getAddressInline: function () {
return $t('New Address');
},
customerAddressId: null
},
addressOptions = addressList().filter(function (address) {
return address.getType() === 'customer-address';
}),
addressDefaultIndex = addressOptions.findIndex(function (address) {
return address.isDefaultBilling();
});
return Component.extend({
defaults: {
template: 'Magento_Checkout/billing-address',
selectedAddress: null,
isNewAddressSelected: false,
addressOptions: addressOptions,
exports: {
selectedAddress: '${ $.parentName }:selectedAddress'
}
},
/**
* @returns {Object} Chainable.
*/
initConfig: function () {
this._super();
this.addressOptions.push(newAddressOption);
return this;
},
/**
* @return {exports.initObservable}
*/
initObservable: function () {
this._super()
.observe('selectedAddress isNewAddressSelected')
.observe({
isNewAddressSelected: !customer.isLoggedIn() || !addressOptions.length,
selectedAddress: this.addressOptions[addressDefaultIndex]
});
return this;
},
/**
* @param {Object} address
* @return {*}
*/
addressOptionsText: function (address) {
return address.getAddressInline();
},
/**
* @param {Object} address
*/
onAddressChange: function (address) {
this.isNewAddressSelected(address === newAddressOption);
}
});
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'uiComponent'
], function (Component) {
'use strict';
return Component.extend({
/**
* Prepare the product name value to be rendered as HTML
*
* @param {String} productName
* @return {String}
*/
getProductNameUnsanitizedHtml: function (productName) {
// product name has already escaped on backend
return productName;
},
/**
* Prepare the given option value to be rendered as HTML
*
* @param {String} optionValue
* @return {String}
*/
getOptionValueUnsanitizedHtml: function (optionValue) {
// option value has already escaped on backend
return optionValue;
}
});
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define(
[
'jquery',
'Magento_Ui/js/form/form',
'Magento_Checkout/js/action/select-shipping-address',
'Magento_Checkout/js/model/address-converter',
'Magento_Checkout/js/model/cart/estimate-service',
'Magento_Checkout/js/checkout-data',
'Magento_Checkout/js/model/shipping-rates-validator',
'uiRegistry',
'Magento_Checkout/js/model/quote',
'Magento_Checkout/js/model/checkout-data-resolver',
'Magento_Checkout/js/model/shipping-service',
'mage/validation'
],
function (
$,
Component,
selectShippingAddress,
addressConverter,
estimateService,
checkoutData,
shippingRatesValidator,
registry,
quote,
checkoutDataResolver,
shippingService
) {
'use strict';
return Component.extend({
defaults: {
template: 'Magento_Checkout/cart/shipping-estimation'
},
isVirtual: quote.isVirtual(),
/**
* @override
*/
initialize: function () {
this._super();
// Prevent shipping methods showing none available whilst we resolve
shippingService.isLoading(true);
registry.async('checkoutProvider')(function (checkoutProvider) {
var address, estimatedAddress;
shippingService.isLoading(false);
checkoutDataResolver.resolveEstimationAddress();
address = quote.isVirtual() ? quote.billingAddress() : quote.shippingAddress();
if (!address && quote.isVirtual()) {
address = addressConverter.formAddressDataToQuoteAddress(
checkoutData.getSelectedBillingAddress()
);
}
if (address) {
estimatedAddress = address.isEditable() ?
addressConverter.quoteAddressToFormAddressData(address) :
{
// only the following fields must be used by estimation form data provider
'country_id': address.countryId,
region: address.region,
'region_id': address.regionId,
postcode: address.postcode
};
checkoutProvider.set(
'shippingAddress',
$.extend({}, checkoutProvider.get('shippingAddress'), estimatedAddress)
);
}
if (!quote.isVirtual()) {
checkoutProvider.on('shippingAddress', function (shippingAddressData) {
//jscs:disable requireCamelCaseOrUpperCaseIdentifiers
if (quote.shippingAddress().countryId !== shippingAddressData.country_id ||
(shippingAddressData.postcode || shippingAddressData.region_id)
) {
checkoutData.setShippingAddressFromData(shippingAddressData);
}
//jscs:enable requireCamelCaseOrUpperCaseIdentifiers
});
} else {
checkoutProvider.on('shippingAddress', function (shippingAddressData) {
checkoutData.setBillingAddressFromData(shippingAddressData);
});
}
});
return this;
},
/**
* @override
*/
initElement: function (element) {
this._super();
if (element.index === 'address-fieldsets') {
shippingRatesValidator.bindChangeHandlers(element.elems(), true, 500);
element.elems.subscribe(function (elems) {
shippingRatesValidator.doElementBinding(elems[elems.length - 1], true, 500);
});
}
return this;
},
/**
* Returns shipping rates for address
* @returns void
*/
getEstimationInfo: function () {
var addressData = null;
this.source.set('params.invalid', false);
this.source.trigger('shippingAddress.data.validate');
if (!this.source.get('params.invalid')) {
addressData = this.source.get('shippingAddress');
selectShippingAddress(addressConverter.formAddressDataToQuoteAddress(addressData));
}
}
});
}
);
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'ko',
'underscore',
'uiComponent',
'Magento_Checkout/js/model/shipping-service',
'Magento_Catalog/js/price-utils',
'Magento_Checkout/js/model/quote',
'Magento_Checkout/js/action/select-shipping-method',
'Magento_Checkout/js/checkout-data'
], function (ko, _, Component, shippingService, priceUtils, quote, selectShippingMethodAction, checkoutData) {
'use strict';
return Component.extend({
defaults: {
template: 'Magento_Checkout/cart/shipping-rates'
},
isVisible: ko.observable(!quote.isVirtual()),
isLoading: shippingService.isLoading,
shippingRates: shippingService.getShippingRates(),
shippingRateGroups: ko.observableArray([]),
selectedShippingMethod: ko.computed(function () {
return quote.shippingMethod() ?
quote.shippingMethod()['carrier_code'] + '_' + quote.shippingMethod()['method_code'] :
null;
}),
/**
* @override
*/
initObservable: function () {
var self = this;
this._super();
this.shippingRates.subscribe(function (rates) {
self.shippingRateGroups([]);
_.each(rates, function (rate) {
var carrierTitle = rate['carrier_title'];
if (self.shippingRateGroups.indexOf(carrierTitle) === -1) {
self.shippingRateGroups.push(carrierTitle);
}
});
});
return this;
},
/**
* Get shipping rates for specific group based on title.
* @returns Array
*/
getRatesForGroup: function (shippingRateGroupTitle) {
return _.filter(this.shippingRates(), function (rate) {
return shippingRateGroupTitle === rate['carrier_title'];
});
},
/**
* Format shipping price.
* @returns {String}
*/
getFormattedPrice: function (price) {
return priceUtils.formatPrice(price, quote.getPriceFormat());
},
/**
* Set shipping method.
* @param {String} methodData
* @returns bool
*/
selectShippingMethod: function (methodData) {
selectShippingMethodAction(methodData);
checkoutData.setSelectedShippingRate(methodData['carrier_code'] + '_' + methodData['method_code']);
return true;
}
});
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'jquery',
'uiComponent',
'Magento_Checkout/js/model/totals',
'Magento_Checkout/js/model/shipping-service'
], function ($, Component, totalsService, shippingService) {
'use strict';
return Component.extend({
isLoading: totalsService.isLoading,
/**
* @override
*/
initialize: function () {
this._super();
totalsService.totals.subscribe(function () {
$(window).trigger('resize');
});
shippingService.getShippingRates().subscribe(function () {
$(window).trigger('resize');
});
}
});
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'Magento_Checkout/js/view/summary/shipping',
'Magento_Checkout/js/model/quote'
], function (Component, quote) {
'use strict';
return Component.extend({
/**
* @override
*/
isCalculated: function () {
return !!quote.shippingMethod();
}
});
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'ko',
'uiComponent',
'Magento_Customer/js/customer-data'
], function (ko, Component, customerData) {
'use strict';
return Component.extend({
displaySubtotal: ko.observable(true),
/**
* @override
*/
initialize: function () {
this._super();
this.cart = customerData.get('cart');
}
});
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'Magento_Captcha/js/view/checkout/defaultCaptcha',
'Magento_Captcha/js/model/captchaList',
'underscore',
'Magento_Checkout/js/model/payment/place-order-hooks'
],
function (defaultCaptcha, captchaList, _, placeOrderHooks) {
'use strict';
return defaultCaptcha.extend({
/** @inheritdoc */
initialize: function () {
var self = this,
currentCaptcha;
this._super();
currentCaptcha = captchaList.getCaptchaByFormId(this.formId);
if (currentCaptcha != null) {
currentCaptcha.setIsVisible(true);
this.setCurrentCaptcha(currentCaptcha);
placeOrderHooks.requestModifiers.push(function (headers) {
if (self.isRequired()) {
headers['X-Captcha'] = self.captchaValue()();
}
});
placeOrderHooks.afterRequestListeners.push(function () {
self.refresh();
});
}
}
});
});
require([
'jquery',
'Magento_Customer/js/customer-data',
'underscore',
'domReady!'
], function ($, customerData, _) {
'use strict';
var selectors = {
qtySelector: '#product_addtocart_form [name="qty"]',
productIdSelector: '#product_addtocart_form [name="product"]',
itemIdSelector: '#product_addtocart_form [name="item"]'
},
cartData = customerData.get('cart'),
productId = $(selectors.productIdSelector).val(),
itemId = $(selectors.itemIdSelector).val(),
productQty,
productQtyInput,
/**
* Updates product's qty input value according to actual data
*/
updateQty = function () {
if (productQty || productQty === 0) {
productQtyInput = productQtyInput || $(selectors.qtySelector);
if (productQtyInput && productQty.toString() !== productQtyInput.val()) {
productQtyInput.val(productQty);
}
}
},
/**
* Sets productQty according to cart data from customer-data
*
* @param {Object} data - cart data from customer-data
*/
setProductQty = function (data) {
var product;
if (!(data && data.items && data.items.length && productId)) {
return;
}
product = _.find(data.items, function (item) {
if (item['item_id'] === itemId) {
return item['product_id'] === productId ||
item['item_id'] === productId;
}
});
if (!product) {
return;
}
productQty = product.qty;
};
cartData.subscribe(function (updateCartData) {
setProductQty(updateCartData);
updateQty();
});
setProductQty(cartData());
updateQty();
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'uiComponent',
'Magento_Checkout/js/model/quote',
'Magento_Catalog/js/price-utils',
'Magento_Checkout/js/model/totals',
'Magento_Checkout/js/model/sidebar'
], function (Component, quote, priceUtils, totals, sidebarModel) {
'use strict';
return Component.extend({
isLoading: totals.isLoading,
/**
* @return {Number}
*/
getQuantity: function () {
if (totals.totals()) {
return parseFloat(totals.totals()['items_qty']);
}
return 0;
},
/**
* @return {Number}
*/
getPureValue: function () {
if (totals.totals()) {
return parseFloat(totals.getSegment('grand_total').value);
}
return 0;
},
/**
* Show sidebar.
*/
showSidebar: function () {
sidebarModel.show();
},
/**
* @param {*} price
* @return {*|String}
*/
getFormattedPrice: function (price) {
return priceUtils.formatPrice(price, quote.getPriceFormat());
},
/**
* @return {*|String}
*/
getValue: function () {
return this.getFormattedPrice(this.getPureValue());
}
});
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'jquery',
'uiComponent',
'ko',
'Magento_Customer/js/model/customer',
'Magento_Customer/js/action/check-email-availability',
'Magento_Customer/js/action/login',
'Magento_Checkout/js/model/quote',
'Magento_Checkout/js/checkout-data',
'Magento_Checkout/js/model/full-screen-loader',
'mage/validation'
], function ($, Component, ko, customer, checkEmailAvailability, loginAction, quote, checkoutData, fullScreenLoader) {
'use strict';
var validatedEmail;
if (!checkoutData.getValidatedEmailValue() &&
window.checkoutConfig.validatedEmailValue
) {
checkoutData.setInputFieldEmailValue(window.checkoutConfig.validatedEmailValue);
checkoutData.setValidatedEmailValue(window.checkoutConfig.validatedEmailValue);
}
validatedEmail = checkoutData.getValidatedEmailValue();
if (validatedEmail && !customer.isLoggedIn()) {
quote.guestEmail = validatedEmail;
}
return Component.extend({
defaults: {
template: 'Magento_Checkout/form/element/email',
email: checkoutData.getInputFieldEmailValue(),
emailFocused: false,
isLoading: false,
isPasswordVisible: false,
listens: {
email: 'emailHasChanged',
emailFocused: 'validateEmail'
},
ignoreTmpls: {
email: true
}
},
checkDelay: 2000,
checkRequest: null,
isEmailCheckComplete: null,
isCustomerLoggedIn: customer.isLoggedIn,
forgotPasswordUrl: window.checkoutConfig.forgotPasswordUrl,
emailCheckTimeout: 0,
/**
* Initializes regular properties of instance.
*
* @returns {Object} Chainable.
*/
initConfig: function () {
this._super();
this.isPasswordVisible = this.resolveInitialPasswordVisibility();
return this;
},
/**
* Initializes observable properties of instance
*
* @returns {Object} Chainable.
*/
initObservable: function () {
this._super()
.observe(['email', 'emailFocused', 'isLoading', 'isPasswordVisible']);
return this;
},
/**
* Callback on changing email property
*/
emailHasChanged: function () {
var self = this;
clearTimeout(this.emailCheckTimeout);
if (self.validateEmail()) {
quote.guestEmail = self.email();
checkoutData.setValidatedEmailValue(self.email());
}
this.emailCheckTimeout = setTimeout(function () {
if (self.validateEmail()) {
self.checkEmailAvailability();
} else {
self.isPasswordVisible(false);
}
}, self.checkDelay);
checkoutData.setInputFieldEmailValue(self.email());
},
/**
* Check email existing.
*/
checkEmailAvailability: function () {
this.validateRequest();
this.isEmailCheckComplete = $.Deferred();
this.isLoading(true);
this.checkRequest = checkEmailAvailability(this.isEmailCheckComplete, this.email());
$.when(this.isEmailCheckComplete).done(function () {
this.isPasswordVisible(false);
checkoutData.setCheckedEmailValue('');
}.bind(this)).fail(function () {
this.isPasswordVisible(true);
checkoutData.setCheckedEmailValue(this.email());
}.bind(this)).always(function () {
this.isLoading(false);
}.bind(this));
},
/**
* If request has been sent -> abort it.
* ReadyStates for request aborting:
* 1 - The request has been set up
* 2 - The request has been sent
* 3 - The request is in process
*/
validateRequest: function () {
if (this.checkRequest != null && $.inArray(this.checkRequest.readyState, [1, 2, 3])) {
this.checkRequest.abort();
this.checkRequest = null;
}
},
/**
* Local email validation.
*
* @param {Boolean} focused - input focus.
* @returns {Boolean} - validation result.
*/
validateEmail: function (focused) {
var loginFormSelector = 'form[data-role=email-with-possible-login]',
usernameSelector = loginFormSelector + ' input[name=username]',
loginForm = $(loginFormSelector),
validator,
valid;
loginForm.validation();
if (focused === false && !!this.email()) {
valid = !!$(usernameSelector).valid();
if (valid) {
$(usernameSelector).removeAttr('aria-invalid aria-describedby');
}
return valid;
}
if (loginForm.is(':visible')) {
validator = loginForm.validate();
return validator.check(usernameSelector);
}
return true;
},
/**
* Log in form submitting callback.
*
* @param {HTMLElement} loginForm - form element.
*/
login: function (loginForm) {
var loginData = {},
formDataArray = $(loginForm).serializeArray();
formDataArray.forEach(function (entry) {
loginData[entry.name] = entry.value;
});
if (this.isPasswordVisible() && $(loginForm).validation() && $(loginForm).validation('isValid')) {
fullScreenLoader.startLoader();
loginAction(loginData).always(function () {
fullScreenLoader.stopLoader();
});
}
},
/**
* Resolves an initial state of a login form.
*
* @returns {Boolean} - initial visibility state.
*/
resolveInitialPasswordVisibility: function () {
if (checkoutData.getInputFieldEmailValue() !== '' && checkoutData.getCheckedEmailValue() !== '') {
return true;
}
if (checkoutData.getInputFieldEmailValue() !== '') {
return checkoutData.getInputFieldEmailValue() === checkoutData.getCheckedEmailValue();
}
return false;
}
});
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'uiComponent',
'Magento_Customer/js/customer-data',
'jquery',
'ko',
'underscore',
'sidebar',
'mage/translate',
'mage/dropdown'
], function (Component, customerData, $, ko, _) {
'use strict';
var sidebarInitialized = false,
addToCartCalls = 0,
miniCart;
miniCart = $('[data-block=\'minicart\']');
/**
* @return {Boolean}
*/
function initSidebar() {
if (miniCart.data('mageSidebar')) {
miniCart.sidebar('update');
}
if (!$('[data-role=product-item]').length) {
return false;
}
miniCart.trigger('contentUpdated');
if (sidebarInitialized) {
return false;
}
sidebarInitialized = true;
miniCart.sidebar({
'targetElement': 'div.block.block-minicart',
'url': {
'checkout': window.checkout.checkoutUrl,
'update': window.checkout.updateItemQtyUrl,
'remove': window.checkout.removeItemUrl,
'loginUrl': window.checkout.customerLoginUrl,
'isRedirectRequired': window.checkout.isRedirectRequired
},
'button': {
'checkout': '#top-cart-btn-checkout',
'remove': '#mini-cart a.action.delete',
'close': '#btn-minicart-close'
},
'showcart': {
'parent': 'span.counter',
'qty': 'span.counter-number',
'label': 'span.counter-label'
},
'minicart': {
'list': '#mini-cart',
'content': '#minicart-content-wrapper',
'qty': 'div.items-total',
'subtotal': 'div.subtotal span.price',
'maxItemsVisible': window.checkout.minicartMaxItemsVisible
},
'item': {
'qty': ':input.cart-item-qty',
'button': ':button.update-cart-item'
},
'confirmMessage': $.mage.__('Are you sure you would like to remove this item from the shopping cart?')
});
}
miniCart.on('dropdowndialogopen', function () {
initSidebar();
});
return Component.extend({
shoppingCartUrl: window.checkout.shoppingCartUrl,
maxItemsToDisplay: window.checkout.maxItemsToDisplay,
cart: {},
// jscs:disable requireCamelCaseOrUpperCaseIdentifiers
/**
* @override
*/
initialize: function () {
var self = this,
cartData = customerData.get('cart');
this.update(cartData());
cartData.subscribe(function (updatedCart) {
addToCartCalls--;
this.isLoading(addToCartCalls > 0);
sidebarInitialized = false;
this.update(updatedCart);
initSidebar();
}, this);
$('[data-block="minicart"]').on('contentLoading', function () {
addToCartCalls++;
self.isLoading(true);
});
if (
cartData().website_id !== window.checkout.websiteId && cartData().website_id !== undefined ||
cartData().storeId !== window.checkout.storeId && cartData().storeId !== undefined
) {
customerData.reload(['cart'], false);
}
return this._super();
},
//jscs:enable requireCamelCaseOrUpperCaseIdentifiers
isLoading: ko.observable(false),
initSidebar: initSidebar,
/**
* Close mini shopping cart.
*/
closeMinicart: function () {
$('[data-block="minicart"]').find('[data-role="dropdownDialog"]').dropdownDialog('close');
},
/**
* @param {String} productType
* @return {*|String}
*/
getItemRenderer: function (productType) {
return this.itemRenderer[productType] || 'defaultRenderer';
},
/**
* Update mini shopping cart content.
*
* @param {Object} updatedCart
* @returns void
*/
update: function (updatedCart) {
_.each(updatedCart, function (value, key) {
if (!this.cart.hasOwnProperty(key)) {
this.cart[key] = ko.observable();
}
this.cart[key](value);
}, this);
},
/**
* Get cart param by name.
*
* @param {String} name
* @returns {*}
*/
getCartParamUnsanitizedHtml: function (name) {
if (!_.isUndefined(name)) {
if (!this.cart.hasOwnProperty(name)) {
this.cart[name] = ko.observable();
}
}
return this.cart[name]();
},
/**
* @deprecated please use getCartParamUnsanitizedHtml.
* @param {String} name
* @returns {*}
*/
getCartParam: function (name) {
return this.getCartParamUnsanitizedHtml(name);
},
/**
* Returns array of cart items, limited by 'maxItemsToDisplay' setting
* @returns []
*/
getCartItems: function () {
var items = this.getCartParamUnsanitizedHtml('items') || [];
items = items.slice(parseInt(-this.maxItemsToDisplay, 10));
return items;
},
/**
* Returns count of cart line items
* @returns {Number}
*/
getCartLineItemsCount: function () {
var items = this.getCartParamUnsanitizedHtml('items') || [];
return parseInt(items.length, 10);
}
});
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'jquery',
'underscore',
'uiComponent',
'ko',
'Magento_Checkout/js/model/quote',
'Magento_Checkout/js/model/step-navigator',
'Magento_Checkout/js/model/payment-service',
'Magento_Checkout/js/model/payment/method-converter',
'Magento_Checkout/js/action/get-payment-information',
'Magento_Checkout/js/model/checkout-data-resolver',
'mage/translate'
], function (
$,
_,
Component,
ko,
quote,
stepNavigator,
paymentService,
methodConverter,
getPaymentInformation,
checkoutDataResolver,
$t
) {
'use strict';
/** Set payment methods to collection */
paymentService.setPaymentMethods(methodConverter(window.checkoutConfig.paymentMethods));
return Component.extend({
defaults: {
template: 'Magento_Checkout/payment',
activeMethod: ''
},
isVisible: ko.observable(quote.isVirtual()),
quoteIsVirtual: quote.isVirtual(),
isPaymentMethodsAvailable: ko.computed(function () {
return paymentService.getAvailablePaymentMethods().length > 0;
}),
/** @inheritdoc */
initialize: function () {
this._super();
checkoutDataResolver.resolvePaymentMethod();
stepNavigator.registerStep(
'payment',
null,
$t('Review & Payments'),
this.isVisible,
_.bind(this.navigate, this),
this.sortOrder
);
return this;
},
/**
* Navigate method.
*/
navigate: function () {
var self = this;
if (!self.hasShippingMethod()) {
this.isVisible(false);
stepNavigator.setHash('shipping');
} else {
getPaymentInformation().done(function () {
self.isVisible(true);
});
}
},
/**
* @return {Boolean}
*/
hasShippingMethod: function () {
return window.checkoutConfig.selectedShippingMethod !== null;
},
/**
* @return {*}
*/
getFormKey: function () {
return window.checkoutConfig.formKey;
}
});
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'ko',
'jquery',
'uiComponent',
'Magento_Checkout/js/action/place-order',
'Magento_Checkout/js/action/select-payment-method',
'Magento_Checkout/js/model/quote',
'Magento_Customer/js/model/customer',
'Magento_Checkout/js/model/payment-service',
'Magento_Checkout/js/checkout-data',
'Magento_Checkout/js/model/checkout-data-resolver',
'uiRegistry',
'Magento_Checkout/js/model/payment/additional-validators',
'Magento_Ui/js/model/messages',
'uiLayout',
'Magento_Checkout/js/action/redirect-on-success'
], function (
ko,
$,
Component,
placeOrderAction,
selectPaymentMethodAction,
quote,
customer,
paymentService,
checkoutData,
checkoutDataResolver,
registry,
additionalValidators,
Messages,
layout,
redirectOnSuccessAction
) {
'use strict';
return Component.extend({
redirectAfterPlaceOrder: true,
isPlaceOrderActionAllowed: ko.observable(quote.billingAddress() != null),
/**
* After place order callback
*/
afterPlaceOrder: function () {
// Override this function and put after place order logic here
},
/**
* Initialize view.
*
* @return {exports}
*/
initialize: function () {
var billingAddressCode,
billingAddressData,
defaultAddressData;
this._super().initChildren();
quote.billingAddress.subscribe(function (address) {
this.isPlaceOrderActionAllowed(address !== null);
}, this);
checkoutDataResolver.resolveBillingAddress();
billingAddressCode = 'billingAddress' + this.getCode();
registry.async('checkoutProvider')(function (checkoutProvider) {
defaultAddressData = checkoutProvider.get(billingAddressCode);
if (defaultAddressData === undefined) {
// Skip if payment does not have a billing address form
return;
}
billingAddressData = checkoutData.getBillingAddressFromData();
if (billingAddressData) {
checkoutProvider.set(
billingAddressCode,
$.extend(true, {}, defaultAddressData, billingAddressData)
);
}
checkoutProvider.on(billingAddressCode, function (providerBillingAddressData) {
checkoutData.setBillingAddressFromData(providerBillingAddressData);
}, billingAddressCode);
});
return this;
},
/**
* Initialize child elements
*
* @returns {Component} Chainable.
*/
initChildren: function () {
this.messageContainer = new Messages();
this.createMessagesComponent();
return this;
},
/**
* Create child message renderer component
*
* @returns {Component} Chainable.
*/
createMessagesComponent: function () {
var messagesComponent = {
parent: this.name,
name: this.name + '.messages',
displayArea: 'messages',
component: 'Magento_Ui/js/view/messages',
config: {
messageContainer: this.messageContainer
}
};
layout([messagesComponent]);
return this;
},
/**
* Place order.
*/
placeOrder: function (data, event) {
var self = this;
if (event) {
event.preventDefault();
}
if (this.validate() &&
additionalValidators.validate() &&
this.isPlaceOrderActionAllowed() === true
) {
this.isPlaceOrderActionAllowed(false);
this.getPlaceOrderDeferredObject()
.done(
function () {
self.afterPlaceOrder();
if (self.redirectAfterPlaceOrder) {
redirectOnSuccessAction.execute();
}
}
).always(
function () {
self.isPlaceOrderActionAllowed(true);
}
);
return true;
}
return false;
},
/**
* @return {*}
*/
getPlaceOrderDeferredObject: function () {
return $.when(
placeOrderAction(this.getData(), this.messageContainer)
);
},
/**
* @return {Boolean}
*/
selectPaymentMethod: function () {
selectPaymentMethodAction(this.getData());
checkoutData.setSelectedPaymentMethod(this.item.method);
return true;
},
isChecked: ko.computed(function () {
return quote.paymentMethod() ? quote.paymentMethod().method : null;
}),
isRadioButtonVisible: ko.computed(function () {
return paymentService.getAvailablePaymentMethods().length !== 1;
}),
/**
* Get payment method data
*/
getData: function () {
return {
'method': this.item.method,
'po_number': null,
'additional_data': null
};
},
/**
* Get payment method type.
*/
getTitle: function () {
return this.item.title;
},
/**
* Get payment method code.
*/
getCode: function () {
return this.item.method;
},
/**
* @return {Boolean}
*/
validate: function () {
return true;
},
/**
* @return {String}
*/
getBillingAddressFormName: function () {
return 'billing-address-form-' + this.item.method;
},
/**
* Dispose billing address subscriptions
*/
disposeSubscriptions: function () {
// dispose all active subscriptions
var billingAddressCode = 'billingAddress' + this.getCode();
registry.async('checkoutProvider')(function (checkoutProvider) {
checkoutProvider.off(billingAddressCode);
});
}
});
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define(
[
'uiComponent',
'Magento_Checkout/js/model/payment/additional-validators',
'Magento_Checkout/js/model/customer-email-validator'
],
function (Component, additionalValidators, agreementValidator) {
'use strict';
additionalValidators.registerValidator(agreementValidator);
return Component.extend({});
}
);
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'underscore',
'ko',
'mageUtils',
'uiComponent',
'Magento_Checkout/js/model/payment/method-list',
'Magento_Checkout/js/model/payment/renderer-list',
'uiLayout',
'Magento_Checkout/js/model/checkout-data-resolver',
'mage/translate',
'uiRegistry'
], function (_, ko, utils, Component, paymentMethods, rendererList, layout, checkoutDataResolver, $t, registry) {
'use strict';
return Component.extend({
defaults: {
template: 'Magento_Checkout/payment-methods/list',
visible: paymentMethods().length > 0,
configDefaultGroup: {
name: 'methodGroup',
component: 'Magento_Checkout/js/model/payment/method-group'
},
paymentGroupsList: [],
defaultGroupTitle: $t('Select a new payment method')
},
/**
* Initialize view.
*
* @returns {Component} Chainable.
*/
initialize: function () {
this._super().initDefaulGroup().initChildren();
paymentMethods.subscribe(
function (changes) {
checkoutDataResolver.resolvePaymentMethod();
//remove renderer for "deleted" payment methods
_.each(changes, function (change) {
if (change.status === 'deleted') {
this.removeRenderer(change.value.method);
}
}, this);
//add renderer for "added" payment methods
_.each(changes, function (change) {
if (change.status === 'added') {
this.createRenderer(change.value);
}
}, this);
}, this, 'arrayChange');
return this;
},
/** @inheritdoc */
initObservable: function () {
this._super().
observe(['paymentGroupsList']);
return this;
},
/**
* Creates default group
*
* @returns {Component} Chainable.
*/
initDefaulGroup: function () {
layout([
this.configDefaultGroup
]);
return this;
},
/**
* Create renders for child payment methods.
*
* @returns {Component} Chainable.
*/
initChildren: function () {
var self = this;
_.each(paymentMethods(), function (paymentMethodData) {
self.createRenderer(paymentMethodData);
});
return this;
},
/**
* @returns
*/
createComponent: function (payment) {
var rendererTemplate,
rendererComponent,
templateData;
templateData = {
parentName: this.name,
name: payment.name
};
rendererTemplate = {
parent: '${ $.$data.parentName }',
name: '${ $.$data.name }',
displayArea: payment.displayArea,
component: payment.component
};
rendererComponent = utils.template(rendererTemplate, templateData);
utils.extend(rendererComponent, {
item: payment.item,
config: payment.config
});
return rendererComponent;
},
/**
* Create renderer.
*
* @param {Object} paymentMethodData
*/
createRenderer: function (paymentMethodData) {
var isRendererForMethod = false,
currentGroup;
registry.get(this.configDefaultGroup.name, function (defaultGroup) {
_.each(rendererList(), function (renderer) {
if (renderer.hasOwnProperty('typeComparatorCallback') &&
typeof renderer.typeComparatorCallback == 'function'
) {
isRendererForMethod = renderer.typeComparatorCallback(renderer.type, paymentMethodData.method);
} else {
isRendererForMethod = renderer.type === paymentMethodData.method;
}
if (isRendererForMethod) {
currentGroup = renderer.group ? renderer.group : defaultGroup;
this.collectPaymentGroups(currentGroup);
layout([
this.createComponent(
{
config: renderer.config,
component: renderer.component,
name: renderer.type,
method: paymentMethodData.method,
item: paymentMethodData,
displayArea: currentGroup.displayArea
}
)]);
}
}.bind(this));
}.bind(this));
},
/**
* Collects unique groups of available payment methods
*
* @param {Object} group
*/
collectPaymentGroups: function (group) {
var groupsList = this.paymentGroupsList(),
isGroupExists = _.some(groupsList, function (existsGroup) {
return existsGroup.alias === group.alias;
});
if (!isGroupExists) {
groupsList.push(group);
groupsList = _.sortBy(groupsList, function (existsGroup) {
return existsGroup.sortOrder;
});
this.paymentGroupsList(groupsList);
}
},
/**
* Returns payment group title
*
* @param {Object} group
* @returns {String}
*/
getGroupTitle: function (group) {
var title = group().title;
if (group().isDefault() && this.paymentGroupsList().length > 1) {
title = this.defaultGroupTitle;
}
return title;
},
/**
* Checks if at least one payment method available
*
* @returns {String}
*/
isPaymentMethodsAvailable: function () {
return _.some(this.paymentGroupsList(), function (group) {
return this.regionHasElements(group.displayArea);
}, this);
},
/**
* Remove view renderer.
*
* @param {String} paymentMethodCode
*/
removeRenderer: function (paymentMethodCode) {
var items;
_.each(this.paymentGroupsList(), function (group) {
items = this.getRegion(group.displayArea);
_.find(items(), function (value) {
if (value.item.method.indexOf(paymentMethodCode) === 0) {
value.disposeSubscriptions();
value.destroy();
}
});
}, this);
}
});
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'jquery',
'underscore',
'ko',
'uiComponent',
'Magento_Checkout/js/model/step-navigator',
'Magento_Checkout/js/view/billing-address'
], function ($, _, ko, Component, stepNavigator, billingAddress) {
'use strict';
var steps = stepNavigator.steps;
return Component.extend({
defaults: {
template: 'Magento_Checkout/progress-bar',
visible: true
},
steps: steps,
/** @inheritdoc */
initialize: function () {
var stepsValue;
this._super();
window.addEventListener('hashchange', _.bind(stepNavigator.handleHash, stepNavigator));
if (!window.location.hash) {
stepsValue = stepNavigator.steps();
if (stepsValue.length) {
stepNavigator.setHash(stepsValue.sort(stepNavigator.sortItems)[0].code);
}
}
stepNavigator.handleHash();
},
/**
* @param {*} itemOne
* @param {*} itemTwo
* @return {*|Number}
*/
sortItems: function (itemOne, itemTwo) {
return stepNavigator.sortItems(itemOne, itemTwo);
},
/**
* @param {Object} step
*/
navigateTo: function (step) {
if (step.code === 'shipping') {
billingAddress().needCancelBillingAddressChanges();
}
stepNavigator.navigateTo(step.code);
},
/**
* @param {Object} item
* @return {*|Boolean}
*/
isProcessed: function (item) {
return stepNavigator.isProcessed(item.code);
}
});
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'jquery',
'uiComponent',
'Magento_Ui/js/model/messageList'
], function ($, Component, messageList) {
'use strict';
return Component.extend({
defaults: {
template: 'Magento_Checkout/registration',
accountCreated: false,
creationStarted: false,
isFormVisible: true
},
/**
* @inheritdoc
*/
initObservable: function () {
this._super()
.observe('accountCreated')
.observe('isFormVisible')
.observe('creationStarted');
return this;
},
/**
* @return {*}
*/
getEmailAddress: function () {
return this.email;
},
/**
* @return String
*/
getUrl: function () {
return this.registrationUrl;
},
/**
* Create new user account.
*
* @deprecated
*/
createAccount: function () {
this.creationStarted(true);
$.post(
this.registrationUrl
).done(
function (response) {
if (response.errors == false) { //eslint-disable-line eqeqeq
this.accountCreated(true);
} else {
messageList.addErrorMessage(response);
}
this.isFormVisible(false);
}.bind(this)
).fail(
function (response) {
this.accountCreated(false);
this.isFormVisible(false);
messageList.addErrorMessage(response);
}.bind(this)
);
}
});
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/**
* @deprecated since version 2.2.0
*/
define([
'uiComponent',
'Magento_Checkout/js/model/quote',
'underscore'
], function (Component, quote, _) {
'use strict';
return Component.extend({
defaults: {
template: 'Magento_Checkout/review/actions',
displayArea: 'actions'
},
/**
* @return {*}
*/
getActiveView: function () {
var view = this.getViewByCode(quote.paymentMethod());
return view ? view : this.getDefaultView();
},
/**
* @param {*} code
* @return {Object}
*/
getViewByCode: function (code) {
return _.find(this.elems(), function (elem) {
return elem.index == code && !elem.isDefault; //eslint-disable-line eqeqeq
});
},
/**
* Get default view.
*
* @return {Object}
*/
getDefaultView: function () {
return _.find(this.elems(), function (elem) {
return elem.isDefault;
});
}
});
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/**
* @deprecated since version 2.2.0
*/
define([
'uiComponent'
], function (Component) {
'use strict';
return Component.extend({
defaults: {
template: 'Magento_Checkout/review/actions/default'
},
/**
* @param {Object} parent
* @return {Function}
*/
placeOrder: function (parent) {
return parent.placeOrder.bind(parent);
}
});
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'jquery',
'ko',
'uiComponent',
'underscore',
'Magento_Checkout/js/action/select-shipping-address',
'Magento_Checkout/js/model/quote',
'Magento_Checkout/js/model/shipping-address/form-popup-state',
'Magento_Checkout/js/checkout-data',
'Magento_Customer/js/customer-data'
], function ($, ko, Component, _, selectShippingAddressAction, quote, formPopUpState, checkoutData, customerData) {
'use strict';
var countryData = customerData.get('directory-data');
return Component.extend({
defaults: {
template: 'Magento_Checkout/shipping-address/address-renderer/default'
},
/** @inheritdoc */
initObservable: function () {
this._super();
this.isSelected = ko.computed(function () {
var isSelected = false,
shippingAddress = quote.shippingAddress();
if (shippingAddress) {
isSelected = shippingAddress.getKey() == this.address().getKey(); //eslint-disable-line eqeqeq
}
return isSelected;
}, this);
return this;
},
/**
* @param {String} countryId
* @return {String}
*/
getCountryName: function (countryId) {
return countryData()[countryId] != undefined ? countryData()[countryId].name : ''; //eslint-disable-line
},
/**
* Get customer attribute label
*
* @param {*} attribute
* @returns {*}
*/
getCustomAttributeLabel: function (attribute) {
var label;
if (typeof attribute === 'string') {
return attribute;
}
if (attribute.label) {
return attribute.label;
}
if (_.isArray(attribute.value)) {
label = _.map(attribute.value, function (value) {
return this.getCustomAttributeOptionLabel(attribute['attribute_code'], value) || value;
}, this).join(', ');
} else {
label = this.getCustomAttributeOptionLabel(attribute['attribute_code'], attribute.value);
}
return label || attribute.value;
},
/**
* Get option label for given attribute code and option ID
*
* @param {String} attributeCode
* @param {String} value
* @returns {String|null}
*/
getCustomAttributeOptionLabel: function (attributeCode, value) {
var option,
label,
options = this.source.get('customAttributes') || {};
if (options[attributeCode]) {
option = _.findWhere(options[attributeCode], {
value: value
});
if (option) {
label = option.label;
}
}
return label;
},
/** Set selected customer shipping address */
selectAddress: function () {
selectShippingAddressAction(this.address());
checkoutData.setSelectedShippingAddress(this.address().getKey());
},
/**
* Edit address.
*/
editAddress: function () {
formPopUpState.isVisible(true);
this.showPopup();
},
/**
* Show popup.
*/
showPopup: function () {
$('[data-open-modal="opc-new-shipping-address"]').trigger('click');
}
});
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'underscore',
'ko',
'mageUtils',
'uiComponent',
'uiLayout',
'Magento_Customer/js/model/address-list'
], function (_, ko, utils, Component, layout, addressList) {
'use strict';
var defaultRendererTemplate = {
parent: '${ $.$data.parentName }',
name: '${ $.$data.name }',
component: 'Magento_Checkout/js/view/shipping-address/address-renderer/default',
provider: 'checkoutProvider'
};
return Component.extend({
defaults: {
template: 'Magento_Checkout/shipping-address/list',
visible: addressList().length > 0,
rendererTemplates: []
},
/** @inheritdoc */
initialize: function () {
this._super()
.initChildren();
addressList.subscribe(function (changes) {
var self = this;
changes.forEach(function (change) {
if (change.status === 'added') {
self.createRendererComponent(change.value, change.index);
}
});
},
this,
'arrayChange'
);
return this;
},
/** @inheritdoc */
initConfig: function () {
this._super();
// the list of child components that are responsible for address rendering
this.rendererComponents = [];
return this;
},
/** @inheritdoc */
initChildren: function () {
_.each(addressList(), this.createRendererComponent, this);
return this;
},
/**
* Create new component that will render given address in the address list
*
* @param {Object} address
* @param {*} index
*/
createRendererComponent: function (address, index) {
var rendererTemplate, templateData, rendererComponent;
if (index in this.rendererComponents) {
this.rendererComponents[index].address(address);
} else {
// rendererTemplates are provided via layout
rendererTemplate = address.getType() != undefined && this.rendererTemplates[address.getType()] != undefined ? //eslint-disable-line
utils.extend({}, defaultRendererTemplate, this.rendererTemplates[address.getType()]) :
defaultRendererTemplate;
templateData = {
parentName: this.name,
name: index
};
rendererComponent = utils.template(rendererTemplate, templateData);
utils.extend(rendererComponent, {
address: ko.observable(address)
});
layout([rendererComponent]);
this.rendererComponents[index] = rendererComponent;
}
}
});
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'jquery',
'uiComponent',
'Magento_Checkout/js/model/quote',
'Magento_Checkout/js/model/step-navigator',
'Magento_Checkout/js/model/sidebar'
], function ($, Component, quote, stepNavigator, sidebarModel) {
'use strict';
return Component.extend({
defaults: {
template: 'Magento_Checkout/shipping-information'
},
/**
* @return {Boolean}
*/
isVisible: function () {
return !quote.isVirtual() && stepNavigator.isProcessed('shipping');
},
/**
* @return {String}
*/
getShippingMethodTitle: function () {
var shippingMethod = quote.shippingMethod(),
shippingMethodTitle = '';
if (!shippingMethod) {
return '';
}
shippingMethodTitle = shippingMethod['carrier_title'];
if (typeof shippingMethod['method_title'] !== 'undefined') {
shippingMethodTitle += ' - ' + shippingMethod['method_title'];
}
return shippingMethodTitle;
},
/**
* Back step.
*/
back: function () {
sidebarModel.hide();
stepNavigator.navigateTo('shipping');
},
/**
* Back to shipping method.
*/
backToShippingMethod: function () {
sidebarModel.hide();
stepNavigator.navigateTo('shipping', 'opc-shipping_method');
}
});
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'uiComponent',
'underscore',
'Magento_Customer/js/customer-data'
], function (Component, _, customerData) {
'use strict';
var countryData = customerData.get('directory-data');
return Component.extend({
defaults: {
template: 'Magento_Checkout/shipping-information/address-renderer/default'
},
/**
* @param {*} countryId
* @return {String}
*/
getCountryName: function (countryId) {
return countryData()[countryId] != undefined ? countryData()[countryId].name : ''; //eslint-disable-line
},
/**
* Get customer attribute label
*
* @param {*} attribute
* @returns {*}
*/
getCustomAttributeLabel: function (attribute) {
var label;
if (typeof attribute === 'string') {
return attribute;
}
if (attribute.label) {
return attribute.label;
}
if (_.isArray(attribute.value)) {
label = _.map(attribute.value, function (value) {
return this.getCustomAttributeOptionLabel(attribute['attribute_code'], value) || value;
}, this).join(', ');
} else {
label = this.getCustomAttributeOptionLabel(attribute['attribute_code'], attribute.value);
}
return label || attribute.value;
},
/**
* Get option label for given attribute code and option ID
*
* @param {String} attributeCode
* @param {String} value
* @returns {String|null}
*/
getCustomAttributeOptionLabel: function (attributeCode, value) {
var option,
label,
options = this.source.get('customAttributes') || {};
if (options[attributeCode]) {
option = _.findWhere(options[attributeCode], {
value: value
});
if (option) {
label = option.label;
}
}
return label;
}
});
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'jquery',
'ko',
'mageUtils',
'uiComponent',
'uiLayout',
'Magento_Checkout/js/model/quote'
], function ($, ko, utils, Component, layout, quote) {
'use strict';
var defaultRendererTemplate = {
parent: '${ $.$data.parentName }',
name: '${ $.$data.name }',
component: 'Magento_Checkout/js/view/shipping-information/address-renderer/default',
provider: 'checkoutProvider'
};
return Component.extend({
defaults: {
template: 'Magento_Checkout/shipping-information/list',
rendererTemplates: {}
},
/** @inheritdoc */
initialize: function () {
var self = this;
this._super()
.initChildren();
quote.shippingAddress.subscribe(function (address) {
self.createRendererComponent(address);
});
return this;
},
/** @inheritdoc */
initConfig: function () {
this._super();
// the list of child components that are responsible for address rendering
this.rendererComponents = {};
return this;
},
/** @inheritdoc */
initChildren: function () {
return this;
},
/**
* Create new component that will render given address in the address list
*
* @param {Object} address
*/
createRendererComponent: function (address) {
var rendererTemplate, templateData, rendererComponent;
$.each(this.rendererComponents, function (index, component) {
component.visible(false);
});
if (this.rendererComponents[address.getType()]) {
this.rendererComponents[address.getType()].address(address);
this.rendererComponents[address.getType()].visible(true);
} else {
// rendererTemplates are provided via layout
rendererTemplate = address.getType() != undefined && this.rendererTemplates[address.getType()] != undefined ? //eslint-disable-line
utils.extend({}, defaultRendererTemplate, this.rendererTemplates[address.getType()]) :
defaultRendererTemplate;
templateData = {
parentName: this.name,
name: address.getType()
};
rendererComponent = utils.template(rendererTemplate, templateData);
utils.extend(
rendererComponent,
{
address: ko.observable(address),
visible: ko.observable(true)
}
);
layout([rendererComponent]);
this.rendererComponents[address.getType()] = rendererComponent;
}
}
});
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'jquery',
'underscore',
'Magento_Ui/js/form/form',
'ko',
'Magento_Customer/js/model/customer',
'Magento_Customer/js/model/address-list',
'Magento_Checkout/js/model/address-converter',
'Magento_Checkout/js/model/quote',
'Magento_Checkout/js/action/create-shipping-address',
'Magento_Checkout/js/action/select-shipping-address',
'Magento_Checkout/js/model/shipping-rates-validator',
'Magento_Checkout/js/model/shipping-address/form-popup-state',
'Magento_Checkout/js/model/shipping-service',
'Magento_Checkout/js/action/select-shipping-method',
'Magento_Checkout/js/model/shipping-rate-registry',
'Magento_Checkout/js/action/set-shipping-information',
'Magento_Checkout/js/model/step-navigator',
'Magento_Ui/js/modal/modal',
'Magento_Checkout/js/model/checkout-data-resolver',
'Magento_Checkout/js/checkout-data',
'uiRegistry',
'mage/translate',
'Magento_Checkout/js/model/shipping-rate-service'
], function (
$,
_,
Component,
ko,
customer,
addressList,
addressConverter,
quote,
createShippingAddress,
selectShippingAddress,
shippingRatesValidator,
formPopUpState,
shippingService,
selectShippingMethodAction,
rateRegistry,
setShippingInformationAction,
stepNavigator,
modal,
checkoutDataResolver,
checkoutData,
registry,
$t
) {
'use strict';
var popUp = null;
return Component.extend({
defaults: {
template: 'Magento_Checkout/shipping',
shippingFormTemplate: 'Magento_Checkout/shipping-address/form',
shippingMethodListTemplate: 'Magento_Checkout/shipping-address/shipping-method-list',
shippingMethodItemTemplate: 'Magento_Checkout/shipping-address/shipping-method-item',
imports: {
countryOptions: '${ $.parentName }.shippingAddress.shipping-address-fieldset.country_id:indexedOptions'
}
},
visible: ko.observable(!quote.isVirtual()),
errorValidationMessage: ko.observable(false),
isCustomerLoggedIn: customer.isLoggedIn,
isFormPopUpVisible: formPopUpState.isVisible,
isFormInline: addressList().length === 0,
isNewAddressAdded: ko.observable(false),
saveInAddressBook: 1,
quoteIsVirtual: quote.isVirtual(),
/**
* @return {exports}
*/
initialize: function () {
var self = this,
hasNewAddress,
fieldsetName = 'checkout.steps.shipping-step.shippingAddress.shipping-address-fieldset';
this._super();
if (!quote.isVirtual()) {
stepNavigator.registerStep(
'shipping',
'',
$t('Shipping'),
this.visible, _.bind(this.navigate, this),
this.sortOrder
);
}
checkoutDataResolver.resolveShippingAddress();
hasNewAddress = addressList.some(function (address) {
return address.getType() == 'new-customer-address'; //eslint-disable-line eqeqeq
});
this.isNewAddressAdded(hasNewAddress);
this.isFormPopUpVisible.subscribe(function (value) {
if (value) {
self.getPopUp().openModal();
}
});
quote.shippingMethod.subscribe(function () {
self.errorValidationMessage(false);
});
registry.async('checkoutProvider')(function (checkoutProvider) {
var shippingAddressData = checkoutData.getShippingAddressFromData();
if (shippingAddressData) {
checkoutProvider.set(
'shippingAddress',
$.extend(true, {}, checkoutProvider.get('shippingAddress'), shippingAddressData)
);
}
checkoutProvider.on('shippingAddress', function (shippingAddrsData) {
if (shippingAddrsData.street && !_.isEmpty(shippingAddrsData.street[0])) {
checkoutData.setShippingAddressFromData(shippingAddrsData);
}
});
shippingRatesValidator.initFields(fieldsetName);
});
return this;
},
/**
* Navigator change hash handler.
*
* @param {Object} step - navigation step
*/
navigate: function (step) {
step && step.isVisible(true);
},
/**
* @return {*}
*/
getPopUp: function () {
var self = this,
buttons;
if (!popUp) {
buttons = this.popUpForm.options.buttons;
this.popUpForm.options.buttons = [
{
text: buttons.save.text ? buttons.save.text : $t('Save Address'),
class: buttons.save.class ? buttons.save.class : 'action primary action-save-address',
click: self.saveNewAddress.bind(self)
},
{
text: buttons.cancel.text ? buttons.cancel.text : $t('Cancel'),
class: buttons.cancel.class ? buttons.cancel.class : 'action secondary action-hide-popup',
/** @inheritdoc */
click: this.onClosePopUp.bind(this)
}
];
/** @inheritdoc */
this.popUpForm.options.closed = function () {
self.isFormPopUpVisible(false);
};
this.popUpForm.options.modalCloseBtnHandler = this.onClosePopUp.bind(this);
this.popUpForm.options.keyEventHandlers = {
escapeKey: this.onClosePopUp.bind(this)
};
/** @inheritdoc */
this.popUpForm.options.opened = function () {
// Store temporary address for revert action in case when user click cancel action
self.temporaryAddress = $.extend(true, {}, checkoutData.getShippingAddressFromData());
};
popUp = modal(this.popUpForm.options, $(this.popUpForm.element));
}
return popUp;
},
/**
* Revert address and close modal.
*/
onClosePopUp: function () {
checkoutData.setShippingAddressFromData($.extend(true, {}, this.temporaryAddress));
this.getPopUp().closeModal();
},
/**
* Show address form popup
*/
showFormPopUp: function () {
this.isFormPopUpVisible(true);
},
/**
* Save new shipping address
*/
saveNewAddress: function () {
var addressData,
newShippingAddress;
this.source.set('params.invalid', false);
this.triggerShippingDataValidateEvent();
if (!this.source.get('params.invalid')) {
addressData = this.source.get('shippingAddress');
// if user clicked the checkbox, its value is true or false. Need to convert.
addressData['save_in_address_book'] = this.saveInAddressBook ? 1 : 0;
// New address must be selected as a shipping address
newShippingAddress = createShippingAddress(addressData);
selectShippingAddress(newShippingAddress);
checkoutData.setSelectedShippingAddress(newShippingAddress.getKey());
checkoutData.setNewCustomerShippingAddress($.extend(true, {}, addressData));
this.getPopUp().closeModal();
this.isNewAddressAdded(true);
}
},
/**
* Shipping Method View
*/
rates: shippingService.getShippingRates(),
isLoading: shippingService.isLoading,
isSelected: ko.computed(function () {
return quote.shippingMethod() ?
quote.shippingMethod()['carrier_code'] + '_' + quote.shippingMethod()['method_code'] :
null;
}),
/**
* @param {Object} shippingMethod
* @return {Boolean}
*/
selectShippingMethod: function (shippingMethod) {
selectShippingMethodAction(shippingMethod);
checkoutData.setSelectedShippingRate(shippingMethod['carrier_code'] + '_' + shippingMethod['method_code']);
return true;
},
/**
* Set shipping information handler
*/
setShippingInformation: function () {
if (this.validateShippingInformation()) {
quote.billingAddress(null);
checkoutDataResolver.resolveBillingAddress();
registry.async('checkoutProvider')(function (checkoutProvider) {
var shippingAddressData = checkoutData.getShippingAddressFromData();
if (shippingAddressData) {
checkoutProvider.set(
'shippingAddress',
$.extend(true, {}, checkoutProvider.get('shippingAddress'), shippingAddressData)
);
}
});
setShippingInformationAction().done(
function () {
stepNavigator.next();
}
);
}
},
/**
* @return {Boolean}
*/
validateShippingInformation: function () {
var shippingAddress,
addressData,
loginFormSelector = 'form[data-role=email-with-possible-login]',
emailValidationResult = customer.isLoggedIn(),
field,
option = _.isObject(this.countryOptions) && this.countryOptions[quote.shippingAddress().countryId],
messageContainer = registry.get('checkout.errors').messageContainer;
if (!quote.shippingMethod()) {
this.errorValidationMessage(
$t('The shipping method is missing. Select the shipping method and try again.')
);
return false;
}
if (!customer.isLoggedIn()) {
$(loginFormSelector).validation();
emailValidationResult = Boolean($(loginFormSelector + ' input[name=username]').valid());
}
if (this.isFormInline) {
this.source.set('params.invalid', false);
this.triggerShippingDataValidateEvent();
if (!quote.shippingMethod()['method_code']) {
this.errorValidationMessage(
$t('The shipping method is missing. Select the shipping method and try again.')
);
}
if (emailValidationResult &&
this.source.get('params.invalid') ||
!quote.shippingMethod()['method_code'] ||
!quote.shippingMethod()['carrier_code']
) {
this.focusInvalid();
return false;
}
shippingAddress = quote.shippingAddress();
addressData = addressConverter.formAddressDataToQuoteAddress(
this.source.get('shippingAddress')
);
//Copy form data to quote shipping address object
for (field in addressData) {
if (addressData.hasOwnProperty(field) && //eslint-disable-line max-depth
shippingAddress.hasOwnProperty(field) &&
typeof addressData[field] != 'function' &&
_.isEqual(shippingAddress[field], addressData[field])
) {
shippingAddress[field] = addressData[field];
} else if (typeof addressData[field] != 'function' &&
!_.isEqual(shippingAddress[field], addressData[field])) {
shippingAddress = addressData;
break;
}
}
if (customer.isLoggedIn()) {
shippingAddress['save_in_address_book'] = 1;
}
selectShippingAddress(shippingAddress);
} else if (customer.isLoggedIn() &&
option &&
option['is_region_required'] &&
!quote.shippingAddress().region
) {
messageContainer.addErrorMessage({
message: $t('Please specify a regionId in shipping address.')
});
return false;
}
if (!emailValidationResult) {
$(loginFormSelector + ' input[name=username]').focus();
return false;
}
return true;
},
/**
* Trigger Shipping data Validate Event.
*/
triggerShippingDataValidateEvent: function () {
this.source.trigger('shippingAddress.data.validate');
if (this.source.get('shippingAddress.custom_attributes')) {
this.source.trigger('shippingAddress.custom_attributes.data.validate');
}
}
});
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'uiComponent',
'ko',
'jquery',
'Magento_Checkout/js/model/sidebar'
], function (Component, ko, $, sidebarModel) {
'use strict';
return Component.extend({
/**
* @param {HTMLElement} element
*/
setModalElement: function (element) {
sidebarModel.setPopup($(element));
}
});
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'uiComponent',
'Magento_Checkout/js/model/totals'
], function (Component, totals) {
'use strict';
return Component.extend({
isLoading: totals.isLoading
});
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'uiComponent',
'Magento_Checkout/js/model/quote',
'Magento_Catalog/js/price-utils',
'Magento_Checkout/js/model/totals',
'Magento_Checkout/js/model/step-navigator'
], function (Component, quote, priceUtils, totals, stepNavigator) {
'use strict';
return Component.extend({
/**
* @param {*} price
* @return {*|String}
*/
getFormattedPrice: function (price) {
return priceUtils.formatPrice(price, quote.getPriceFormat());
},
/**
* @return {*}
*/
getTotals: function () {
return totals.totals();
},
/**
* @return {*}
*/
isFullMode: function () {
if (!this.getTotals()) {
return false;
}
return stepNavigator.isProcessed('shipping');
}
});
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'ko',
'Magento_Checkout/js/model/totals',
'uiComponent',
'Magento_Checkout/js/model/step-navigator',
'Magento_Checkout/js/model/quote'
], function (ko, totals, Component, stepNavigator, quote) {
'use strict';
var useQty = window.checkoutConfig.useQty;
return Component.extend({
defaults: {
template: 'Magento_Checkout/summary/cart-items'
},
totals: totals.totals(),
items: ko.observable([]),
maxCartItemsToDisplay: window.checkoutConfig.maxCartItemsToDisplay,
cartUrl: window.checkoutConfig.cartUrl,
/**
* @deprecated Please use observable property (this.items())
*/
getItems: totals.getItems(),
/**
* Returns cart items qty
*
* @returns {Number}
*/
getItemsQty: function () {
return parseFloat(this.totals['items_qty']);
},
/**
* Returns count of cart line items
*
* @returns {Number}
*/
getCartLineItemsCount: function () {
return parseInt(totals.getItems()().length, 10);
},
/**
* Returns shopping cart items summary (includes config settings)
*
* @returns {Number}
*/
getCartSummaryItemsCount: function () {
return useQty ? this.getItemsQty() : this.getCartLineItemsCount();
},
/**
* @inheritdoc
*/
initialize: function () {
this._super();
// Set initial items to observable field
this.setItems(totals.getItems()());
// Subscribe for items data changes and refresh items in view
totals.getItems().subscribe(function (items) {
this.setItems(items);
}.bind(this));
},
/**
* Set items to observable field
*
* @param {Object} items
*/
setItems: function (items) {
if (items && items.length > 0) {
items = items.slice(parseInt(-this.maxCartItemsToDisplay, 10));
}
this.items(items);
},
/**
* Returns bool value for items block state (expanded or not)
*
* @returns {*|Boolean}
*/
isItemsBlockExpanded: function () {
return quote.isVirtual() || stepNavigator.isProcessed('shipping');
}
});
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'Magento_Checkout/js/view/summary/abstract-total',
'Magento_Checkout/js/model/quote'
], function (Component, quote) {
'use strict';
return Component.extend({
defaults: {
template: 'Magento_Checkout/summary/grand-total'
},
/**
* @return {*}
*/
isDisplayed: function () {
return this.isFullMode();
},
/**
* Get pure value.
*/
getPureValue: function () {
var totals = quote.getTotals()();
if (totals) {
return totals['grand_total'];
}
return quote['grand_total'];
},
/**
* @return {*|String}
*/
getValue: function () {
return this.getFormattedPrice(this.getPureValue());
}
});
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'uiComponent',
'escaper'
], function (Component, escaper) {
'use strict';
return Component.extend({
defaults: {
template: 'Magento_Checkout/summary/item/details',
allowedTags: ['b', 'strong', 'i', 'em', 'u']
},
/**
* @param {Object} quoteItem
* @return {String}
*/
getNameUnsanitizedHtml: function (quoteItem) {
var txt = document.createElement('textarea');
txt.innerHTML = quoteItem.name;
return escaper.escapeHtml(txt.value, this.allowedTags);
},
/**
* @param {Object} quoteItem
* @return {String}Magento_Checkout/js/region-updater
*/
getValue: function (quoteItem) {
return quoteItem.name;
}
});
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define(['uiComponent'], function (Component) {
'use strict';
var quoteMessages = window.checkoutConfig.quoteMessages;
return Component.extend({
defaults: {
template: 'Magento_Checkout/summary/item/details/message'
},
displayArea: 'item_message',
quoteMessages: quoteMessages,
/**
* @param {Object} item
* @return {null}
*/
getMessage: function (item) {
if (this.quoteMessages[item['item_id']]) {
return this.quoteMessages[item['item_id']];
}
return null;
}
});
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'Magento_Checkout/js/view/summary/abstract-total'
], function (viewModel) {
'use strict';
return viewModel.extend({
defaults: {
displayArea: 'after_details',
template: 'Magento_Checkout/summary/item/details/subtotal'
},
/**
* @param {Object} quoteItem
* @return {*|String}
*/
getValue: function (quoteItem) {
return this.getFormattedPrice(quoteItem['row_total']);
}
});
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define(['uiComponent'], function (Component) {
'use strict';
var imageData = window.checkoutConfig.imageData;
return Component.extend({
defaults: {
template: 'Magento_Checkout/summary/item/details/thumbnail'
},
displayArea: 'before_details',
imageData: imageData,
/**
* @param {Object} item
* @return {Array}
*/
getImageItem: function (item) {
if (this.imageData[item['item_id']]) {
return this.imageData[item['item_id']];
}
return [];
},
/**
* @param {Object} item
* @return {null}
*/
getSrc: function (item) {
if (this.imageData[item['item_id']]) {
return this.imageData[item['item_id']].src;
}
return null;
},
/**
* @param {Object} item
* @return {null}
*/
getWidth: function (item) {
if (this.imageData[item['item_id']]) {
return this.imageData[item['item_id']].width;
}
return null;
},
/**
* @param {Object} item
* @return {null}
*/
getHeight: function (item) {
if (this.imageData[item['item_id']]) {
return this.imageData[item['item_id']].height;
}
return null;
},
/**
* @param {Object} item
* @return {null}
*/
getAlt: function (item) {
if (this.imageData[item['item_id']]) {
return this.imageData[item['item_id']].alt;
}
return null;
}
});
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'jquery',
'underscore',
'Magento_Checkout/js/view/summary/abstract-total',
'Magento_Checkout/js/model/quote',
'Magento_SalesRule/js/view/summary/discount'
], function ($, _, Component, quote, discountView) {
'use strict';
return Component.extend({
defaults: {
template: 'Magento_Checkout/summary/shipping'
},
quoteIsVirtual: quote.isVirtual(),
totals: quote.getTotals(),
/**
* @return {*}
*/
getShippingMethodTitle: function () {
var shippingMethod,
shippingMethodTitle = '';
if (!this.isCalculated()) {
return '';
}
shippingMethod = quote.shippingMethod();
if (!_.isArray(shippingMethod) && !_.isObject(shippingMethod)) {
return '';
}
if (typeof shippingMethod['method_title'] !== 'undefined') {
shippingMethodTitle = ' - ' + shippingMethod['method_title'];
}
return shippingMethodTitle ?
shippingMethod['carrier_title'] + shippingMethodTitle :
shippingMethod['carrier_title'];
},
/**
* @return {*|Boolean}
*/
isCalculated: function () {
return this.totals() && this.isFullMode() && quote.shippingMethod() != null; //eslint-disable-line eqeqeq
},
/**
* @return {*}
*/
getValue: function () {
var price;
if (!this.isCalculated()) {
return this.notCalculatedMessage;
}
price = this.totals()['shipping_amount'];
return this.getFormattedPrice(price);
},
/**
* If is set coupon code, but there wasn't displayed discount view.
*
* @return {Boolean}
*/
haveToShowCoupon: function () {
var couponCode = this.totals()['coupon_code'];
if (typeof couponCode === 'undefined') {
couponCode = false;
}
return couponCode && !discountView().isDisplayed();
},
/**
* Returns coupon code description.
*
* @return {String}
*/
getCouponDescription: function () {
if (!this.haveToShowCoupon()) {
return '';
}
return '(' + this.totals()['coupon_code'] + ')';
}
});
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'Magento_Checkout/js/view/summary/abstract-total',
'Magento_Checkout/js/model/quote'
], function (Component, quote) {
'use strict';
return Component.extend({
defaults: {
template: 'Magento_Checkout/summary/subtotal'
},
/**
* Get pure value.
*
* @return {*}
*/
getPureValue: function () {
var totals = quote.getTotals()();
if (totals) {
return totals.subtotal;
}
return quote.subtotal;
},
/**
* @return {*|String}
*/
getValue: function () {
return this.getFormattedPrice(this.getPureValue());
}
});
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'Magento_Checkout/js/view/summary/abstract-total'
], function (Component) {
'use strict';
return Component.extend({
/**
* @return {*}
*/
isDisplayed: function () {
return this.isFullMode();
}
});
});
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<div class="authentication-wrapper" data-block="authentication" data-bind="visible: isActive()">
<button
type="button"
class="action action-auth-toggle"
data-trigger="authentication">
<span data-bind="i18n: 'Sign In'"></span>
</button>
<div class="block-authentication"
style="display: none"
data-bind="mageInit: {
'Magento_Ui/js/modal/modal':{
'type': 'custom',
'modalClass': 'authentication-dropdown',
'trigger': '[data-trigger=authentication]',
'wrapperClass': 'authentication-wrapper',
'parentModalClass': '_has-modal-custom _has-auth-shown',
'responsive': true,
'responsiveClass': 'custom-slide',
'overlayClass': 'dropdown-overlay modal-custom-overlay',
'buttons': []
}}">
<!-- ko foreach: getRegion('before') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!-- /ko -->
<div class="block block-customer-login"
data-bind="attr: {'data-label': $t('or')}">
<div class="block-title">
<strong id="block-customer-login-heading"
role="heading"
aria-level="2"
data-bind="i18n: 'Sign In'"></strong>
</div>
<!-- ko foreach: getRegion('messages') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
<div class="block-content" aria-labelledby="block-customer-login-heading">
<form data-role="login"
data-bind="submit:login"
method="post">
<div class="fieldset"
data-bind="attr: {'data-hasrequired': $t('* Required Fields')}">
<div class="field field-email required">
<label class="label" for="login-email"><span data-bind="i18n: 'Email Address'"></span></label>
<div class="control">
<input type="email"
class="input-text"
id="login-email"
name="username"
data-bind="attr: {autocomplete: autocomplete}"
data-validate="{required:true, 'validate-email':true}" />
</div>
</div>
<div class="field field-password required">
<label for="login-password" class="label"><span data-bind="i18n: 'Password'"></span></label>
<div class="control">
<input type="password"
class="input-text"
id="login-password"
name="password"
data-bind="attr: {autocomplete: autocomplete}"
data-validate="{required:true}"
autocomplete="off"/>
</div>
</div>
<!-- ko foreach: getRegion('additional-login-form-fields') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!-- /ko -->
</div>
<div class="actions-toolbar">
<input name="context" type="hidden" value="checkout" />
<div class="primary">
<button type="submit" class="action action-login secondary"><span data-bind="i18n: 'Sign In'"></span></button>
</div>
<div class="secondary">
<a class="action action-remind" data-bind="attr: { href: forgotPasswordUrl }">
<span data-bind="i18n: 'Forgot Your Password?'"></span>
</a>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<div class="checkout-billing-address">
<div class="billing-address-same-as-shipping-block field choice" data-bind="visible: canUseShippingAddress()">
<input type="checkbox" name="billing-address-same-as-shipping"
data-bind="checked: isAddressSameAsShipping, click: useShippingAddress, attr: {id: 'billing-address-same-as-shipping-' + getCode($parent)}"/>
<label data-bind="attr: {for: 'billing-address-same-as-shipping-' + getCode($parent)}"><span
data-bind="i18n: 'My billing and shipping address are the same'"></span></label>
</div>
<render args="detailsTemplate"></render>
<fieldset class="fieldset" data-bind="visible: !isAddressDetailsVisible()">
<each args="getRegion('billing-address-list')" render=""></each>
<div data-bind="fadeVisible: isAddressFormVisible">
<render args="formTemplate"></render>
</div>
<render args="actionsTemplate"></render>
</fieldset>
</div>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<div class="actions-toolbar">
<div class="primary">
<button class="action action-update"
type="button"
click="updateAddress">
<span translate="'Update'"></span>
</button>
<button class="action action-cancel"
type="button"
click="cancelAddressEdit"
visible="canUseCancelBillingAddress()">
<span translate="'Cancel'"></span>
</button>
</div>
</div>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<div if="isAddressDetailsVisible() && currentBillingAddress()" class="billing-address-details">
<text args="currentBillingAddress().prefix"></text> <text args="currentBillingAddress().firstname"></text>
<text args="currentBillingAddress().middlename"></text>
<text args="currentBillingAddress().lastname"></text> <text args="currentBillingAddress().suffix"></text><br/>
<text args="currentBillingAddress().street.join(', ')"></text><br/>
<text args="currentBillingAddress().city "></text>, <span text="currentBillingAddress().region"></span>
<text args="currentBillingAddress().postcode"></text><br/>
<text args="getCountryName(currentBillingAddress().countryId)"></text><br/>
<a if="currentBillingAddress().telephone" attr="'href': 'tel:' + currentBillingAddress().telephone" text="currentBillingAddress().telephone"></a><br/>
<each args="data: currentBillingAddress().customAttributes, as: 'element'">
<text args="$parent.getCustomAttributeLabel(element)"></text>
<br/>
</each>
<button visible="!isAddressSameAsShipping()"
type="button"
class="action action-edit-address"
click="editAddress">
<span translate="'Edit'"></span>
</button>
</div>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<div class="billing-address-form">
<!-- ko foreach: getRegion('before-fields') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
<form data-bind="attr: {'data-hasrequired': $t('* Required Fields')}">
<fieldset class="fieldset address" data-form="billing-new-address">
<!-- ko foreach: getRegion('additional-fieldsets') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
<!-- ko if: (isCustomerLoggedIn && customerHasAddresses) -->
<div class="choice field">
<input type="checkbox" class="checkbox" data-bind="checked: saveInAddressBook, attr: {id: 'billing-save-in-address-book-' + getCode($parent)}" />
<label class="label" data-bind="attr: {for: 'billing-save-in-address-book-' + getCode($parent)}" >
<span data-bind="i18n: 'Save in address book'"></span>
</label>
</div>
<!-- /ko -->
</fieldset>
</form>
</div>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<div class="field field-select-billing">
<label class="label"><span data-bind="i18n: 'Billing Address'"></span></label>
<div class="control" data-bind="if: (addressOptions.length > 1)">
<select class="select" name="billing_address_id" data-bind="
options: addressOptions,
optionsText: addressOptionsText,
value: selectedAddress,
event: {change: onAddressChange(selectedAddress())};
"></select>
</div>
</div>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<form method="post" id="shipping-zip-form">
<fieldset class="fieldset estimate">
<legend class="legend">
<span data-bind="text: isVirtual ? $t('Estimate Tax') : $t('Estimate Shipping and Tax') "></span>
</legend><br>
<p class="field note" data-bind="text: isVirtual ? $t('Enter your billing address to get a tax estimate.') : $t('Enter your destination to get a shipping estimate.')"></p>
<!-- ko foreach: getRegion('address-fieldsets') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
</fieldset>
</form>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<form id="co-shipping-method-form" data-bind="blockLoader: isLoading, visible: isVisible()">
<p class="field note" data-bind="visible: (!isLoading() && shippingRates().length <= 0)">
<!-- ko text: $t('Sorry, no quotes are available for this order at this time')--><!-- /ko -->
</p>
<fieldset class="fieldset rate" data-bind="visible: (shippingRates().length > 0)">
<dl class="items methods" data-bind="foreach: shippingRateGroups">
<dt class="item-title"><span data-bind="text: $data"></span></dt>
<dd class="item-options" data-bind="foreach: { data:$parent.getRatesForGroup($data), as: 'method' }">
<div data-bind="css: {'field choice item': available, 'message error': !available} ">
<!-- ko ifnot: (available) -->
<div data-bind="text: error_message"></div>
<!-- /ko -->
<!-- ko if: (available) -->
<input type="radio"
class="radio"
data-bind="
click: $parents[1].selectShippingMethod,
checked: $parents[1].selectedShippingMethod,
attr: {
value: carrier_code + '_' + method_code,
id: 's_method_' + carrier_code + '_' + method_code,
disabled: false
}
"/>
<label class="label" data-bind="attr: {for: 's_method_' + carrier_code + '_' + method_code}">
<!-- ko text: $data.method_title --><!-- /ko -->
<each args="element.getRegion('price')" render=""></each>
</label>
<!-- /ko -->
</div>
</dd>
</dl>
</fieldset>
</form>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<div class="table-wrapper" data-bind="blockLoader: isLoading">
<table class="data table totals">
<caption class="table-caption" data-bind="text: $t('Total')"></caption>
<tbody>
<!-- ko foreach: elems() -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!-- /ko -->
</tbody>
</table>
</div>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<tr class="grand totals">
<th class="mark" colspan="1" scope="row">
<strong data-bind="i18n: title"></strong>
</th>
<td class="amount" data-th="Order Total">
<strong><span class="price" data-bind="text: getValue()"></span></strong>
</td>
</tr>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<!-- ko if: isCalculated() -->
<tr class="totals shipping excl">
<th class="mark" colspan="1" scope="row" data-bind="text: title + ' (' + getShippingMethodTitle() + ')'"></th>
<td class="amount">
<span class="price" data-bind="text: getValue()"></span>
</td>
</tr>
<!-- /ko -->
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<tr class="totals sub">
<th class="mark" colspan="1" scope="row" data-bind="i18n: title"></th>
<td class="amount" data-th="Subtotal">
<span class="price" data-bind="text: getValue()"></span>
</td>
</tr>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<div class="opc-estimated-wrapper" data-bind="blockLoader: isLoading">
<div class="estimated-block">
<span class="estimated-label" data-bind="i18n: 'Estimated Total'"></span>
<span class="estimated-price" data-bind="text: getValue()"></span>
</div>
<div class="minicart-wrapper">
<button type="button" class="action showcart" data-bind="click: showSidebar" data-toggle="opc-summary">
<span class="counter qty">
<span class="counter-number" data-bind="text: getQuantity()"></span>
</span>
</button>
</div>
</div>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<!-- ko ifnot: isCustomerLoggedIn() -->
<!-- ko foreach: getRegion('before-login-form') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!-- /ko -->
<form class="form form-login" data-role="email-with-possible-login"
data-bind="submit:login"
method="post">
<fieldset id="customer-email-fieldset" class="fieldset" data-bind="blockLoader: isLoading">
<div class="field required">
<label class="label" for="customer-email"><span data-bind="i18n: 'Email Address'"></span></label>
<div class="control _with-tooltip">
<input class="input-text"
type="email"
data-bind="
textInput: email,
hasFocus: emailFocused,
afterRender: emailHasChanged,
mageInit: {'mage/trim-input':{}}"
name="username"
data-validate="{required:true, 'validate-email':true}"
id="customer-email" />
<!-- ko template: 'ui/form/element/helper/tooltip' --><!-- /ko -->
<span class="note" data-bind="fadeVisible: isPasswordVisible() == false"><!-- ko i18n: 'You can create an account after checkout.'--><!-- /ko --></span>
</div>
</div>
<!--Hidden fields -->
<fieldset class="fieldset hidden-fields" data-bind="fadeVisible: isPasswordVisible">
<div class="field">
<label class="label" for="customer-password"><span data-bind="i18n: 'Password'"></span></label>
<div class="control">
<input class="input-text"
data-bind="
attr: {
placeholder: $t('Password'),
}"
type="password"
name="password"
id="customer-password"
data-validate="{required:true}" autocomplete="off"/>
<span class="note" data-bind="i18n: 'You already have an account with us. Sign in or continue as guest.'"></span>
</div>
</div>
<!-- ko foreach: getRegion('additional-login-form-fields') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!-- /ko -->
<div class="actions-toolbar">
<input name="context" type="hidden" value="checkout" />
<div class="primary">
<button type="submit" class="action login primary" data-action="checkout-method-login"><span data-bind="i18n: 'Login'"></span></button>
</div>
<div class="secondary">
<a class="action remind" data-bind="attr: { href: forgotPasswordUrl }">
<span data-bind="i18n: 'Forgot Your Password?'"></span>
</a>
</div>
</div>
</fieldset>
<!--Hidden fields -->
</fieldset>
</form>
<!-- /ko -->
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<div class="block-title">
<strong>
<span class="text" translate="'My Cart'"></span>
<span
class="qty empty"
text="getCartParam('summary_count')"
data-bind="css: { empty: !!getCartParam('summary_count') == false },
attr: { title: $t('Items in Cart') }">
</span>
</strong>
</div>
<div class="block-content">
<button type="button"
id="btn-minicart-close"
class="action close"
data-action="close"
data-bind="
attr: {
title: $t('Close')
},
click: closeMinicart()
">
<span translate="'Close'"></span>
</button>
<if args="getCartParam('summary_count')">
<div class="items-total">
<span class="count" if="maxItemsToDisplay < getCartLineItemsCount()" text="maxItemsToDisplay"></span>
<translate args="'of'" if="maxItemsToDisplay < getCartLineItemsCount()"></translate>
<span class="count" text="getCartParam('summary_count')"></span>
<!-- ko if: (getCartParam('summary_count') > 1) -->
<span translate="'Items in Cart'"></span>
<!--/ko-->
<!-- ko if: (getCartParam('summary_count') === 1) -->
<span translate="'Item in Cart'"></span>
<!--/ko-->
</div>
<each args="getRegion('subtotalContainer')" render=""></each>
<each args="getRegion('extraInfo')" render=""></each>
<div class="actions" if="getCartParam('possible_onepage_checkout')">
<div class="primary">
<button
id="top-cart-btn-checkout"
type="button"
class="action primary checkout"
data-action="close"
data-bind="
attr: {
title: $t('Proceed to Checkout')
},
click: closeMinicart()
"
translate="'Proceed to Checkout'">
</button>
<div data-bind="html: getCartParamUnsanitizedHtml('extra_actions')"></div>
</div>
</div>
</if>
<if args="getCartParam('summary_count')">
<strong class="subtitle" translate="'Recently added item(s)'"></strong>
<div data-action="scroll" class="minicart-items-wrapper">
<ol id="mini-cart" class="minicart-items" data-bind="foreach: { data: getCartItems(), as: 'item' }">
<each args="$parent.getRegion($parent.getItemRenderer(item.product_type))"
render="{name: getTemplate(), data: item, afterRender: function() {$parents[1].initSidebar()}}"></each>
</ol>
</div>
</if>
<ifnot args="getCartParam('summary_count')">
<strong class="subtitle empty"
translate="'You have no items in your shopping cart.'"></strong>
<if args="getCartParam('cart_empty_message')">
<p class="minicart empty text" text="getCartParam('cart_empty_message')"></p>
<div class="actions">
<div class="secondary">
<a class="action viewcart" data-bind="attr: {href: shoppingCartUrl}">
<span translate="'View and Edit Cart'"></span>
</a>
</div>
</div>
</if>
</ifnot>
<div class="actions" if="getCartParam('summary_count')">
<div class="secondary">
<a class="action viewcart" data-bind="attr: {href: shoppingCartUrl}">
<span translate="'View and Edit Cart'"></span>
</a>
</div>
</div>
<div id="minicart-widgets" class="minicart-widgets" if="regionHasElements('promotion')">
<each args="getRegion('promotion')" render=""></each>
</div>
</div>
<each args="getRegion('sign-in-popup')" render=""></each>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<li class="item product product-item" data-role="product-item">
<div class="product">
<!-- ko if: product_has_url -->
<a data-bind="attr: {href: product_url, title: product_name}" tabindex="-1" class="product-item-photo">
<!-- ko foreach: $parent.getRegion('itemImage') -->
<!-- ko template: {name: getTemplate(), data: item.product_image} --><!-- /ko -->
<!-- /ko -->
</a>
<!-- /ko -->
<!-- ko ifnot: product_has_url -->
<span class="product-item-photo">
<!-- ko foreach: $parent.getRegion('itemImage') -->
<!-- ko template: {name: getTemplate(), data: item.product_image} --><!-- /ko -->
<!-- /ko -->
</span>
<!-- /ko -->
<div class="product-item-details">
<strong class="product-item-name">
<!-- ko if: product_has_url -->
<a data-bind="attr: {href: product_url}, html: $parent.getProductNameUnsanitizedHtml(product_name)"></a>
<!-- /ko -->
<!-- ko ifnot: product_has_url -->
<span data-bind="html: $parent.getProductNameUnsanitizedHtml(product_name)"></span>
<!-- /ko -->
</strong>
<!-- ko if: options.length -->
<div class="product options" data-mage-init='{"collapsible":{"openedState": "active", "saveState": false}}'>
<span data-role="title" class="toggle"><!-- ko i18n: 'See Details' --><!-- /ko --></span>
<div data-role="content" class="content">
<strong class="subtitle"><!-- ko i18n: 'Options Details' --><!-- /ko --></strong>
<dl class="product options list">
<!-- ko foreach: { data: options, as: 'option' } -->
<dt class="label"><!-- ko text: option.label --><!-- /ko --></dt>
<dd class="values">
<!-- ko if: Array.isArray(option.value) -->
<span data-bind="html: $parents[1].getOptionValueUnsanitizedHtml(option.value.join('<br/>'))"></span>
<!-- /ko -->
<!-- ko if: (!Array.isArray(option.value) && ['file', 'html'].includes(option.option_type)) -->
<span data-bind="html: $parents[1].getOptionValueUnsanitizedHtml(option.value)"></span>
<!-- /ko -->
<!-- ko if: (!Array.isArray(option.value) && !['file', 'html'].includes(option.option_type)) -->
<span data-bind="text: option.value"></span>
<!-- /ko -->
</dd>
<!-- /ko -->
</dl>
</div>
</div>
<!-- /ko -->
<div class="product-item-pricing">
<!-- ko if: canApplyMsrp -->
<div class="details-map">
<span class="label" data-bind="i18n: 'Price'"></span>
<span class="value" data-bind="i18n: 'See price before order confirmation.'"></span>
</div>
<!-- /ko -->
<!-- ko ifnot: canApplyMsrp -->
<!-- ko foreach: $parent.getRegion('priceSidebar') -->
<!-- ko template: {name: getTemplate(), data: item.product_price, as: 'price'} --><!-- /ko -->
<!-- /ko -->
<!-- /ko -->
<div class="details-qty qty">
<label class="label" data-bind="i18n: 'Qty', attr: {
for: 'cart-item-'+item_id+'-qty'}"></label>
<input data-bind="attr: {
id: 'cart-item-'+item_id+'-qty',
'data-cart-item': item_id,
'data-item-qty': qty,
'data-cart-item-id': product_sku
}, value: qty"
type="number"
size="4"
class="item-qty cart-item-qty"/>
<button data-bind="attr: {
id: 'update-cart-item-'+item_id,
'data-cart-item': item_id,
title: $t('Update')
}"
class="update-cart-item"
style="display: none">
<span data-bind="i18n: 'Update'"></span>
</button>
</div>
</div>
<div class="product actions">
<!-- ko if: is_visible_in_site_visibility -->
<div class="primary">
<a data-bind="attr: {href: configure_url, title: $t('Edit item')}" class="action edit">
<span data-bind="i18n: 'Edit'"></span>
</a>
</div>
<!-- /ko -->
<div class="secondary">
<a href="#" data-bind="attr: {'data-cart-item': item_id, title: $t('Remove item')}"
class="action delete">
<span data-bind="i18n: 'Remove'"></span>
</a>
</div>
</div>
</div>
</div>
<div class="message notice" if="$data.message">
<div data-bind="text: $data.message"></div>
</div>
</li>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<div class="price-container">
<span class="price-wrapper" data-bind="html: price"></span>
</div>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<div class="subtotal">
<span class="label">
<!-- ko i18n: 'Cart Subtotal' --><!-- /ko -->
</span>
<!-- ko foreach: elems -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!-- /ko -->
</div>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<div class="amount price-container">
<span class="price-wrapper" data-bind="html: cart().subtotal"></span>
</div>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<!-- ko foreach: getRegion('authentication') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
<!-- ko foreach: getRegion('progressBar') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
<!-- ko foreach: getRegion('estimation') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
<!-- ko foreach: getRegion('messages') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
<div class="opc-wrapper">
<ol class="opc" id="checkoutSteps">
<!-- ko foreach: getRegion('steps') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
</ol>
</div>
<!-- ko foreach: getRegion('sidebar') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<div if="isPaymentMethodsAvailable()"
class="items payment-methods">
<div repeat="foreach: paymentGroupsList, item: '$group'"
class="payment-group">
<div if="regionHasElements($group().displayArea)"
translate="getGroupTitle($group)"
class="step-title"
data-role="title">
</div>
<each args="data: getRegion($group().displayArea), as: 'method'" render=""></each>
</div>
</div>
<div ifnot="isPaymentMethodsAvailable()"
class="no-payments-block"
translate="'No Payment Methods'">
</div>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<li id="payment" role="presentation" class="checkout-payment-method" data-bind="fadeVisible: isVisible">
<div id="checkout-step-payment"
class="step-content"
data-role="content"
role="tabpanel"
aria-hidden="false">
<!-- ko if: (quoteIsVirtual) -->
<!-- ko foreach: getRegion('customer-email') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
<!--/ko-->
<form id="co-payment-form" class="form payments" novalidate="novalidate">
<input data-bind='attr: {value: getFormKey()}' type="hidden" name="form_key"/>
<fieldset class="fieldset">
<legend class="legend">
<span data-bind="i18n: 'Payment Information'"></span>
</legend><br />
<!-- ko foreach: getRegion('place-order-captcha') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!-- /ko -->
<br />
<!-- ko foreach: getRegion('beforeMethods') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!-- /ko -->
<div id="checkout-payment-method-load" class="opc-payment" data-bind="visible: isPaymentMethodsAvailable">
<!-- ko foreach: getRegion('payment-methods-list') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!-- /ko -->
</div>
<div class="no-quotes-block" data-bind="visible: isPaymentMethodsAvailable() == false">
<!-- ko i18n: 'No Payment method available.'--><!-- /ko -->
</div>
<!-- ko foreach: getRegion('afterMethods') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!-- /ko -->
</fieldset>
</form>
</div>
</li>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<!-- ko foreach: { data: elems, as: 'element' } -->
<!-- ko if: hasTemplate() -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!-- /ko -->
<!-- /ko -->
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<!-- ko text: getTitle() --><!-- /ko -->
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<ul class="opc-progress-bar">
<!-- ko foreach: { data: steps().sort(sortItems), as: 'item' } -->
<li class="opc-progress-bar-item" data-bind="css: item.isVisible() ? '_active' : ($parent.isProcessed(item) ? '_complete' : '')">
<span data-bind="i18n: item.title, click: $parent.navigateTo"></span>
</li>
<!-- /ko -->
</ul>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<!-- ko foreach: getRegion('messages') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
<div>
<!-- ko if: isFormVisible -->
<p data-bind="i18n: 'You can track your order status by creating an account.'"></p>
<p><span data-bind="i18n: 'Email Address'"></span>: <span data-bind="text: getEmailAddress()"></span></p>
<a class="action primary" data-bind="attr: { href: getUrl() }">
<span data-bind="i18n: 'Create an Account'"></span>
</a>
<!--/ko-->
</div>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<!-- ko with: getActiveView() -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!-- /ko -->
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<div class="actions-toolbar" id="review-buttons-container">
<div class="primary">
<button data-role="review-save" type="submit"
data-bind="click: placeOrder($parents[1]), attr: {title: $t('Place Order')}"
class="button action primary checkout"><span data-bind="i18n: 'Place Order'"></span></button>
</div>
<div class="secondary">
<span id="checkout-review-edit-label" data-bind="i18n: 'Forgot an Item?'"></span>
<a data-bind="attr: {href: $parents[1].cartUrl}"
aria-describedby="checkout-review-edit-label"
class="action edit">
<span data-bind="i18n: 'Edit Your Cart'"></span>
</a>
</div>
</div>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<div class="shipping-address-item" css="'selected-item' : isSelected() , 'not-selected-item':!isSelected()">
<text args="address().prefix"></text> <text args="address().firstname"></text> <text args="address().middlename"></text>
<text args="address().lastname"></text> <text args="address().suffix"></text><br/>
<text args="_.values(address().street).join(', ')"></text><br/>
<text args="address().city "></text>, <span text="address().region"></span> <text args="address().postcode"></text><br/>
<text args="getCountryName(address().countryId)"></text><br/>
<a if="address().telephone" attr="'href': 'tel:' + address().telephone" text="address().telephone"></a><br/>
<each args="data: address().customAttributes, as: 'element'">
<text args="$parent.getCustomAttributeLabel(element)"></text>
<br/>
</each>
<button visible="address().isEditable()" type="button"
class="action edit-address-link"
click="editAddress">
<span translate="'Edit'"></span>
</button>
<!-- ko if: (!isSelected()) -->
<button type="button" click="selectAddress" class="action action-select-shipping-item">
<span translate="'Ship Here'"></span>
</button>
<!-- /ko -->
</div>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<form class="form form-shipping-address" id="co-shipping-form" data-bind="attr: {'data-hasrequired': $t('* Required Fields')}">
<!-- ko foreach: getRegion('before-fields') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
<div id="shipping-new-address-form" class="fieldset address">
<!-- ko foreach: getRegion('additional-fieldsets') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
<!-- ko if: (isCustomerLoggedIn) -->
<div class="field choice" data-bind="visible: !isFormInline">
<input type="checkbox" class="checkbox" id="shipping-save-in-address-book" data-bind="checked: saveInAddressBook" />
<label class="label" for="shipping-save-in-address-book">
<span data-bind="i18n: 'Save in address book'"></span>
</label>
</div>
<!-- /ko -->
</div>
</form>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<!-- ko if: (visible)-->
<div class="field addresses">
<div class="control">
<div class="shipping-address-items">
<!-- ko foreach: { data: elems, as: 'element' } -->
<!-- ko template: element.getTemplate() --><!-- /ko -->
<!-- /ko -->
</div>
</div>
</div>
<!-- /ko -->
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<tr class="row"
click="element.selectShippingMethod">
<td class="col col-method">
<input type="radio"
class="radio"
ifnot="method.error_message"
ko-checked="element.isSelected"
ko-value="method.carrier_code + '_' + method.method_code"
attr="'aria-labelledby': 'label_method_' + method.method_code + '_' + method.carrier_code + ' ' + 'label_carrier_' + method.method_code + '_' + method.carrier_code,
'checked': element.rates().length == 1 || element.isSelected" />
</td>
<!-- ko ifnot: (method.error_message) -->
<td class="col col-price">
<each args="element.getRegion('price')" render=""></each>
</td>
<!-- /ko -->
<td class="col col-method"
attr="'id': 'label_method_' + method.method_code + '_' + method.carrier_code"
text="method.method_title"></td>
<td class="col col-carrier"
attr="'id': 'label_carrier_' + method.method_code + '_' + method.carrier_code"
text="method.carrier_title"></td>
</tr>
<tr class="row row-error"
if="method.error_message">
<td class="col col-error" colspan="4">
<div role="alert" class="message error">
<div text="method.error_message"></div>
</div>
<span class="no-display">
<input type="radio"
attr="'value' : method.method_code, 'id': 's_method_' + method.method_code">
</span>
</td>
</tr>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<div id="checkout-shipping-method-load">
<table class="table-checkout-shipping-method">
<thead>
<tr class="row">
<th class="col col-method" translate="'Select Method'"></th>
<th class="col col-price" translate="'Price'"></th>
<th class="col col-method" translate="'Method Title'"></th>
<th class="col col-carrier" translate="'Carrier Title'"></th>
</tr>
</thead>
<tbody>
<!-- ko foreach: { data: rates(), as: 'method'} -->
<!--ko template: { name: element.shippingMethodItemTemplate} --><!-- /ko -->
<!-- /ko -->
</tbody>
</table>
</div>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<!-- ko if: (isVisible()) -->
<div class="shipping-information">
<div class="ship-to">
<div class="shipping-information-title">
<span data-bind="i18n: 'Ship To:'"></span>
<button class="action action-edit" data-bind="click: back">
<span data-bind="i18n: 'edit'"></span>
</button>
</div>
<div class="shipping-information-content">
<!-- ko foreach: getRegion('ship-to') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
</div>
</div>
<div class="ship-via">
<div class="shipping-information-title">
<span data-bind="i18n: 'Shipping Method:'"></span>
<button class="action action-edit" data-bind="click: backToShippingMethod">
<span data-bind="i18n: 'edit'"></span>
</button>
</div>
<div class="shipping-information-content">
<span class="value" data-bind="text: getShippingMethodTitle()"></span>
</div>
</div>
</div>
<!--/ko-->
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<if args="visible()">
<text args="address().prefix"></text> <text args="address().firstname"></text> <text args="address().middlename"></text>
<text args="address().lastname"></text> <text args="address().suffix"></text><br/>
<text args="_.values(address().street).join(', ')"></text><br/>
<text args="address().city "></text>, <span text="address().region"></span> <text args="address().postcode"></text><br/>
<text args="getCountryName(address().countryId)"></text><br/>
<a if="address().telephone" attr="'href': 'tel:' + address().telephone" text="address().telephone"></a><br/>
<each args="data: address().customAttributes, as: 'element'">
<text args="$parent.getCustomAttributeLabel(element)"></text>
<br/>
</each>
</if>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<!-- ko foreach: { data: elems, as: 'element' } -->
<!-- ko template: element.getTemplate() --><!-- /ko -->
<!-- /ko -->
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<li id="shipping" class="checkout-shipping-address" data-bind="fadeVisible: visible()">
<div class="step-title" translate="'Shipping Address'" data-role="title" />
<div id="checkout-step-shipping"
class="step-content"
data-role="content">
<each if="!quoteIsVirtual" args="getRegion('customer-email')" render="" />
<each args="getRegion('address-list')" render="" />
<each args="getRegion('address-list-additional-addresses')" render="" />
<!-- Address form pop up -->
<if args="!isFormInline">
<div class="new-address-popup">
<button type="button"
class="action action-show-popup"
click="showFormPopUp"
visible="!isNewAddressAdded()">
<span translate="'New Address'" />
</button>
</div>
<div id="opc-new-shipping-address"
visible="isFormPopUpVisible()"
render="shippingFormTemplate" />
</if>
<each args="getRegion('before-form')" render="" />
<!-- Inline address form -->
<render if="isFormInline" args="shippingFormTemplate" />
</div>
</li>
<!--Shipping method template-->
<li id="opc-shipping_method"
class="checkout-shipping-method"
data-bind="fadeVisible: visible(), blockLoader: isLoading"
role="presentation">
<div class="checkout-shipping-method">
<div class="step-title"
translate="'Shipping Methods'"
data-role="title" />
<each args="getRegion('before-shipping-method-form')" render="" />
<div id="checkout-step-shipping_method"
class="step-content"
data-role="content"
role="tabpanel"
aria-hidden="false">
<form id="co-shipping-method-form"
class="form methods-shipping"
if="rates().length"
submit="setShippingInformation"
novalidate="novalidate">
<render args="shippingMethodListTemplate"/>
<div id="onepage-checkout-shipping-method-additional-load">
<each args="getRegion('shippingAdditional')" render="" />
</div>
<div role="alert"
if="errorValidationMessage().length"
class="message notice">
<span text="errorValidationMessage()" />
</div>
<div class="actions-toolbar" id="shipping-method-buttons-container">
<div class="primary">
<button data-role="opc-continue" type="submit" class="button action continue primary">
<span translate="'Next'" />
</button>
</div>
</div>
</form>
<div class="no-quotes-block"
ifnot="rates().length > 0"
translate="'Sorry, no quotes are available for this order at this time'" />
</div>
</div>
</li>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<div id="opc-sidebar"
data-bind="afterRender:setModalElement, mageInit: {
'Magento_Ui/js/modal/modal':{
'type': 'custom',
'modalClass': 'opc-sidebar opc-summary-wrapper',
'wrapperClass': 'checkout-container',
'parentModalClass': '_has-modal-custom',
'responsive': true,
'responsiveClass': 'custom-slide',
'overlayClass': 'modal-custom-overlay',
'buttons': []
}}">
<!-- ko foreach: getRegion('summary') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
<div class="opc-block-shipping-information">
<!-- ko foreach: getRegion('shipping-information') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
</div>
</div>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<div class="opc-block-summary" data-bind="blockLoader: isLoading">
<span data-bind="i18n: 'Order Summary'" class="title"></span>
<!-- ko foreach: elems() -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!-- /ko -->
</div>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<div class="block items-in-cart" data-bind="mageInit: {'collapsible':{'openedState': 'active', 'active': isItemsBlockExpanded()}}">
<div class="title" data-role="title">
<strong role="heading" aria-level="1">
<translate args="maxCartItemsToDisplay" if="maxCartItemsToDisplay < getCartLineItemsCount()"></translate>
<translate args="'of'" if="maxCartItemsToDisplay < getCartLineItemsCount()"></translate>
<span data-bind="text: getCartSummaryItemsCount()"></span>
<translate args="'Item in Cart'" if="getCartSummaryItemsCount() === 1"></translate>
<translate args="'Items in Cart'" if="getCartSummaryItemsCount() > 1"></translate>
</strong>
</div>
<div class="content minicart-items" data-role="content">
<div class="minicart-items-wrapper">
<ol class="minicart-items">
<each args="items()">
<li class="product-item">
<div class="product">
<each args="$parent.elems()" render=""></each>
</div>
</li>
</each>
</ol>
</div>
</div>
<div class="actions-toolbar" if="maxCartItemsToDisplay < getCartLineItemsCount()">
<div class="secondary">
<a class="action viewcart" data-bind="attr: {href: cartUrl}">
<span data-bind="i18n: 'View and Edit Cart'"></span>
</a>
</div>
</div>
</div>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<!-- ko if: isDisplayed() -->
<tr class="grand totals">
<td class="mark" scope="row">
<strong data-bind="i18n: title"></strong>
</td>
<td class="amount" data-bind="attr: {'data-th': $t(title)}">
<strong><span class="price" data-bind="text: getValue()"></span></strong>
<!-- ko foreach: elems() -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!-- /ko -->
</td>
</tr>
<!-- /ko -->
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<!-- ko foreach: getRegion('before_details') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!-- /ko -->
<div class="product-item-details">
<div class="product-item-inner">
<div class="product-item-name-block">
<strong class="product-item-name" data-bind="html: getNameUnsanitizedHtml($parent)"></strong>
<div class="details-qty">
<span class="label"><!-- ko i18n: 'Qty' --><!-- /ko --></span>
<span class="value" data-bind="text: $parent.qty"></span>
</div>
</div>
<!-- ko foreach: getRegion('after_details') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!-- /ko -->
</div>
<!-- ko if: (JSON.parse($parent.options).length > 0)-->
<div class="product options" data-bind="mageInit: {'collapsible':{'openedState': 'active'}}">
<span data-role="title" class="toggle"><!-- ko i18n: 'View Details' --><!-- /ko --></span>
<div data-role="content" class="content">
<strong class="subtitle"><!-- ko i18n: 'Options Details' --><!-- /ko --></strong>
<dl class="item-options">
<!--ko foreach: JSON.parse($parent.options)-->
<dt class="label" data-bind="text: label"></dt>
<!-- ko if: ($data.full_view)-->
<!-- ko with: {full_viewUnsanitizedHtml: $data.full_view}-->
<dd class="values" data-bind="html: full_viewUnsanitizedHtml"></dd>
<!-- /ko -->
<!-- /ko -->
<!-- ko ifnot: ($data.full_view)-->
<!-- ko with: {valueUnsanitizedHtml: $data.value}-->
<dd class="values" data-bind="html: valueUnsanitizedHtml"></dd>
<!-- /ko -->
<!-- /ko -->
<!-- /ko -->
</dl>
</div>
</div>
<!-- /ko -->
</div>
<!-- ko foreach: getRegion('item_message') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!-- /ko -->
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<div class="cart item message notice" if="getMessage($parents[1])">
<div data-bind="text: getMessage($parents[1])"></div>
</div>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<span class="subtotal" data-bind="text: getValue($parents[1])"></span>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<span class="product-image-container"
data-bind="attr: {'style': 'height: ' + getHeight($parents[1])/2 + 'px; width: ' + getWidth($parents[1])/2 + 'px;' }">
<span class="product-image-wrapper">
<img
data-bind="attr: {'src': getSrc($parents[1]), 'width': getWidth($parents[1]), 'height': getHeight($parents[1]), 'alt': getAlt($parents[1]), 'title': getAlt($parents[1]) }"/>
</span>
</span>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<!-- ko if: quoteIsVirtual == 0 -->
<tr class="totals shipping excl">
<th class="mark" scope="row">
<span class="label" data-bind="i18n: title"></span>
<span class="value" data-bind="text: getShippingMethodTitle()"></span>
</th>
<td class="amount">
<!-- ko if: isCalculated() -->
<span class="price"
data-bind="text: getValue(), attr: {'data-th': title}"></span>
<!-- /ko -->
<!-- ko ifnot: isCalculated() -->
<span class="not-calculated"
data-bind="text: getValue(), attr: {'data-th': title}"></span>
<!-- /ko -->
</td>
</tr>
<!-- /ko -->
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<tr class="totals">
<th class="mark" scope="row" data-bind="text: title"></th>
<td class="amount">
<span class="price" data-bind ="text: getValue(), attr:{'data-label': title}"></span>
<!-- ko foreach: elems() -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!-- /ko -->
</td>
</tr>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<!-- ko if: isDisplayed() -->
<table class="data table table-totals">
<caption class="table-caption" data-bind="i18n: 'Order Summary'"></caption>
<tbody>
<!-- ko foreach: elems() -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!-- /ko -->
</tbody>
</table>
<!-- /ko -->
<?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="sidebar.additional">
<block class="Magento\Paypal\Block\Logo" name="paypal.partner.right.logo" template="Magento_Paypal::partner/logo.phtml"/>
<block class="Magento\Paypal\Block\Bml\Banners" name="bml.right.logo" template="Magento_Paypal::bml.phtml">
<arguments>
<argument name="section" xsi:type="string">categorypage</argument>
<argument name="position" xsi:type="number">1</argument>
</arguments>
</block>
<block class="Magento\Paypal\Block\PayLater\Banner" name="sidebar.banner.paylater"
template="Magento_Paypal::paylater/banner.phtml">
<arguments>
<argument name="placement" xsi:type="string">category</argument>
<argument name="position" xsi:type="string">sidebar</argument>
</arguments>
</block>
</referenceContainer>
<referenceContainer name="top.container">
<block class="Magento\Paypal\Block\Bml\Banners" name="bml.center.logo" template="Magento_Paypal::bml.phtml">
<arguments>
<argument name="section" xsi:type="string">categorypage</argument>
<argument name="position" xsi:type="number">0</argument>
</arguments>
</block>
<block class="Magento\Paypal\Block\PayLater\Banner" name="top.banner.paylater"
template="Magento_Paypal::paylater/banner.phtml">
<arguments>
<argument name="placement" xsi:type="string">category</argument>
<argument name="position" xsi:type="string">header</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="top.container">
<block class="Magento\Paypal\Block\Bml\Banners" name="bml.center.logo" template="Magento_Paypal::bml.phtml">
<arguments>
<argument name="section" xsi:type="string">productpage</argument>
<argument name="position" xsi:type="number">0</argument>
</arguments>
</block>
<block class="Magento\Paypal\Block\PayLater\Banner" name="top.container.paylater"
template="Magento_Paypal::paylater/banner.phtml">
<arguments>
<argument name="placement" xsi:type="string">product</argument>
<argument name="position" xsi:type="string">header</argument>
<argument name="jsLayout" xsi:type="array">
<item name="components" xsi:type="array">
<item name="payLater" xsi:type="array">
<item name="config" xsi:type="array">
<item name="displayAmount" xsi:type="boolean">true</item>
<item name="amountComponentConfig" xsi:type="array">
<item name="component" xsi:type="string">
Magento_Paypal/js/view/amountProviders/product
</item>
</item>
</item>
</item>
</item>
</argument>
</arguments>
</block>
</referenceContainer>
<referenceContainer name="product.info.addtocart">
<block class="Magento\Paypal\Block\Bml\Banners" name="bml.right.logo" template="Magento_Paypal::bml.phtml">
<arguments>
<argument name="section" xsi:type="string">productpage</argument>
<argument name="position" xsi:type="number">1</argument>
</arguments>
</block>
<block class="Magento\Paypal\Block\PayLater\Banner" name="product.info.addtocart.paylater"
template="Magento_Paypal::paylater/banner.phtml">
<arguments>
<argument name="placement" xsi:type="string">product</argument>
<argument name="position" xsi:type="string">near_pp_button</argument>
<argument name="jsLayout" xsi:type="array">
<item name="components" xsi:type="array">
<item name="payLater" xsi:type="array">
<item name="config" xsi:type="array">
<item name="displayAmount" xsi:type="boolean">true</item>
<item name="amountComponentConfig" xsi:type="array">
<item name="component" xsi:type="string">
Magento_Paypal/js/view/amountProviders/product
</item>
</item>
</item>
</item>
</item>
</argument>
</arguments>
</block>
</referenceContainer>
<referenceBlock name="product.info.addtocart.additional">
<block class="Magento\Paypal\Block\PayLater\Banner" name="product.info.addtocart.additional.paylater"
template="Magento_Paypal::paylater/banner.phtml">
<arguments>
<argument name="placement" xsi:type="string">product</argument>
<argument name="position" xsi:type="string">near_pp_button</argument>
<argument name="jsLayout" xsi:type="array">
<item name="components" xsi:type="array">
<item name="payLater" xsi:type="array">
<item name="config" xsi:type="array">
<item name="displayAmount" xsi:type="boolean">true</item>
<item name="amountComponentConfig" xsi:type="array">
<item name="component" xsi:type="string">
Magento_Paypal/js/view/amountProviders/product
</item>
</item>
</item>
</item>
</item>
</argument>
</arguments>
</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="product.info.addtocart.bundle">
<block class="Magento\Paypal\Block\PayLater\Banner" name="product.info.addtocart.additional.paylater"
template="Magento_Paypal::paylater/banner.phtml">
<arguments>
<argument name="placement" xsi:type="string">product</argument>
<argument name="position" xsi:type="string">near_pp_button</argument>
<argument name="jsLayout" xsi:type="array">
<item name="components" xsi:type="array">
<item name="payLater" xsi:type="array">
<item name="config" xsi:type="array">
<item name="refreshSelector" xsi:type="string">#bundle-slide</item>
<item name="displayAmount" xsi:type="boolean">true</item>
<item name="amountComponentConfig" xsi:type="array">
<item name="component" xsi:type="string">
Magento_Paypal/js/view/amountProviders/product
</item>
</item>
</item>
</item>
</item>
</argument>
</arguments>
</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>
<referenceContainer name="top.container">
<block class="Magento\Paypal\Block\PayLater\Banner" name="top.container.paylater"
template="Magento_Paypal::paylater/banner.phtml">
<arguments>
<argument name="placement" xsi:type="string">product</argument>
<argument name="position" xsi:type="string">header</argument>
<argument name="jsLayout" xsi:type="array">
<item name="components" xsi:type="array">
<item name="payLater" xsi:type="array">
<item name="config" xsi:type="array">
<item name="displayAmount" xsi:type="boolean">true</item>
<item name="amountComponentConfig" xsi:type="array">
<item name="component" xsi:type="string">
Magento_Paypal/js/view/amountProviders/product-grouped
</item>
</item>
</item>
</item>
</item>
</argument>
</arguments>
</block>
</referenceContainer>
<referenceContainer name="product.info.addtocart">
<block class="Magento\Paypal\Block\PayLater\Banner" name="product.info.addtocart.paylater"
template="Magento_Paypal::paylater/banner.phtml">
<arguments>
<argument name="placement" xsi:type="string">product</argument>
<argument name="position" xsi:type="string">near_pp_button</argument>
<argument name="jsLayout" xsi:type="array">
<item name="components" xsi:type="array">
<item name="payLater" xsi:type="array">
<item name="config" xsi:type="array">
<item name="displayAmount" xsi:type="boolean">true</item>
<item name="amountComponentConfig" xsi:type="array">
<item name="component" xsi:type="string">
Magento_Paypal/js/view/amountProviders/product-grouped
</item>
</item>
</item>
</item>
</item>
</argument>
</arguments>
</block>
</referenceContainer>
<referenceBlock name="product.info.addtocart.additional">
<block class="Magento\Paypal\Block\PayLater\Banner" name="product.info.addtocart.additional.paylater"
template="Magento_Paypal::paylater/banner.phtml">
<arguments>
<argument name="placement" xsi:type="string">product</argument>
<argument name="position" xsi:type="string">near_pp_button</argument>
<argument name="jsLayout" xsi:type="array">
<item name="components" xsi:type="array">
<item name="payLater" xsi:type="array">
<item name="config" xsi:type="array">
<item name="displayAmount" xsi:type="boolean">true</item>
<item name="amountComponentConfig" xsi:type="array">
<item name="component" xsi:type="string">
Magento_Paypal/js/view/amountProviders/product-grouped
</item>
</item>
</item>
</item>
</item>
</argument>
</arguments>
</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>
<referenceContainer name="top.container">
<block class="Magento\Paypal\Block\Bml\Banners" name="bml.center.logo" template="Magento_Paypal::bml.phtml">
<arguments>
<argument name="section" xsi:type="string">checkout</argument>
<argument name="position" xsi:type="number">0</argument>
</arguments>
</block>
<block class="Magento\Paypal\Block\PayLater\Banner" name="top.container.paylater"
template="Magento_Paypal::paylater/banner.phtml">
<arguments>
<argument name="placement" xsi:type="string">cart</argument>
<argument name="position" xsi:type="string">header</argument>
<argument name="jsLayout" xsi:type="array">
<item name="components" xsi:type="array">
<item name="payLater" xsi:type="array">
<item name="config" xsi:type="array">
<item name="displayAmount" xsi:type="boolean">true</item>
<item name="amountComponentConfig" xsi:type="array">
<item name="component" xsi:type="string">
Magento_Paypal/js/view/amountProviders/checkout
</item>
</item>
</item>
</item>
</item>
</argument>
</arguments>
</block>
</referenceContainer>
<referenceContainer name="checkout.cart.methods">
<block class="Magento\Paypal\Block\Bml\Banners" name="bml.right.logo" after="checkout.cart.methods.onepage.bottom" template="Magento_Paypal::bml.phtml">
<arguments>
<argument name="section" xsi:type="string">checkout</argument>
<argument name="position" xsi:type="number">1</argument>
</arguments>
</block>
<block class="Magento\Paypal\Block\PayLater\Banner" name="paylater.right.logo"
after="checkout.cart.methods.onepage.bottom"
template="Magento_Paypal::paylater/banner.phtml">
<arguments>
<argument name="placement" xsi:type="string">cart</argument>
<argument name="position" xsi:type="string">near_pp_button</argument>
<argument name="jsLayout" xsi:type="array">
<item name="components" xsi:type="array">
<item name="payLater" xsi:type="array">
<item name="config" xsi:type="array">
<item name="displayAmount" xsi:type="boolean">true</item>
<item name="amountComponentConfig" xsi:type="array">
<item name="component" xsi:type="string">
Magento_Paypal/js/view/amountProviders/checkout
</item>
</item>
</item>
</item>
</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="after.body.start">
<referenceBlock remove="true" name="paypal.express-in-context.component"/>
</referenceContainer>
<referenceBlock name="checkout.root">
<arguments>
<argument name="jsLayout" xsi:type="array">
<item name="components" xsi:type="array">
<item name="checkout" xsi:type="array">
<item name="children" xsi:type="array">
<item name="steps" xsi:type="array">
<item name="children" xsi:type="array">
<item name="billing-step" xsi:type="array">
<item name="component" xsi:type="string">uiComponent</item>
<item name="children" xsi:type="array">
<item name="payment" xsi:type="array">
<item name="children" xsi:type="array">
<item name="payments-list" xsi:type="array">
<item name="children" xsi:type="array">
<item name="paypal-method-extra-content" xsi:type="array">
<item name="component" xsi:type="string">uiComponent</item>
<item name="displayArea" xsi:type="string">paypal-method-extra-content</item>
<item name="children" xsi:type="array">
<item name="paylater-place-order" xsi:type="array">
<item name="component" xsi:type="string">Magento_Paypal/js/view/paylater</item>
<item name="displayArea" xsi:type="string">paypal-method-extra-content</item>
</item>
</item>
</item>
</item>
</item>
<item name="renders" xsi:type="array">
<!-- merge payment method renders here -->
<item name="children" xsi:type="array">
<item name="paypal-payments" xsi:type="array">
<item name="component" xsi:type="string">Magento_Paypal/js/view/payment/paypal-payments</item>
<item name="methods" xsi:type="array">
<item name="payflowpro" xsi:type="array">
<item name="isBillingAddressRequired" xsi:type="boolean">true</item>
</item>
<item name="payflow_link" xsi:type="array">
<item name="isBillingAddressRequired" xsi:type="boolean">true</item>
</item>
<item name="payflow_advanced" xsi:type="array">
<item name="isBillingAddressRequired" xsi:type="boolean">true</item>
</item>
<item name="hosted_pro" xsi:type="array">
<item name="isBillingAddressRequired" xsi:type="boolean">true</item>
</item>
<item name="paypal_billing_agreement" xsi:type="array">
<item name="isBillingAddressRequired" xsi:type="boolean">true</item>
</item>
<item name="paypal_express" xsi:type="array">
<item name="isBillingAddressRequired" xsi:type="boolean">false</item>
</item>
<item name="payflow_express_bml" xsi:type="array">
<item name="isBillingAddressRequired" xsi:type="boolean">false</item>
</item>
</item>
</item>
</item>
</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>
<referenceContainer name="checkout.onepage.review.info.items.after">
<block class="Magento\Paypal\Block\Iframe" name="paypal.iframe" cacheable="false"/>
</referenceContainer>
<referenceBlock name="checkout.onepage.review.button">
<action method="setTemplate">
<argument name="template" xsi:type="helper" helper="Magento\Paypal\Helper\Hss::getReviewButtonTemplate">
<param name="name">Magento_Paypal::hss/review/button.phtml</param>
</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">
<body>
<referenceContainer name="order.success.additional.info">
<block class="Magento\Paypal\Block\Checkout\Onepage\Success\BillingAgreement" name="onepage.success.billing_agreement" template="Magento_Paypal::checkout/onepage/success/billing_agreement.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">
<body>
<referenceContainer name="sidebar.additional">
<block class="Magento\Paypal\Block\Logo" name="paypal.partner.right.logo" template="Magento_Paypal::partner/logo.phtml"/>
<block class="Magento\Paypal\Block\Bml\Banners" name="bml.right.logo" template="Magento_Paypal::bml.phtml">
<arguments>
<argument name="section" xsi:type="string">homepage</argument>
<argument name="position" xsi:type="number">1</argument>
</arguments>
</block>
<block class="Magento\Paypal\Block\PayLater\Banner" name="sidebar.container.paylater"
template="Magento_Paypal::paylater/banner.phtml">
<arguments>
<argument name="placement" xsi:type="string">home</argument>
<argument name="position" xsi:type="string">sidebar</argument>
</arguments>
</block>
</referenceContainer>
<referenceContainer name="top.container">
<block class="Magento\Paypal\Block\Bml\Banners" name="bml.center.logo" template="Magento_Paypal::bml.phtml">
<arguments>
<argument name="section" xsi:type="string">homepage</argument>
<argument name="position" xsi:type="number">0</argument>
</arguments>
</block>
<block class="Magento\Paypal\Block\PayLater\Banner" name="top.container.paylater"
template="Magento_Paypal::paylater/banner.phtml">
<arguments>
<argument name="placement" xsi:type="string">home</argument>
<argument name="position" xsi:type="string">header</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>
<referenceBlock name="customer_account_navigation">
<block class="Magento\Customer\Block\Account\SortLinkInterface"
name="customer-account-navigation-billing-agreements-link"
ifconfig="payment/paypal_express/active"
>
<arguments>
<argument name="path" xsi:type="string">paypal/billing_agreement</argument>
<argument name="label" xsi:type="string" translate="true">Billing Agreements</argument>
<argument name="sortOrder" xsi:type="number">140</argument>
</arguments>
</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>
<referenceContainer name="after.body.start">
<block class="Magento\Paypal\Block\Express\InContext\Component"
name="paypal.express-in-context.component">
<arguments>
<argument name="is_button_context" xsi:type="boolean">true</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">
<update handle="customer_account"/>
<body>
<referenceContainer name="content">
<block class="Magento\Paypal\Block\Billing\Agreements" name="customer.account.billing.agreement" template="Magento_Paypal::billing/agreements.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="customer_account"/>
<body>
<referenceContainer name="content">
<block class="Magento\Paypal\Block\Billing\Agreement\View" name="customer.account.billing.agreement" template="Magento_Paypal::billing/agreement/view.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" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
<title>Review Order</title>
</head>
<update handle="checkout_onepage_review_item_renderers"/>
<body>
<referenceBlock name="head.components">
<block class="Magento\Framework\View\Element\Js\Components" name="paypal_express_review_checkout_head_components" template="Magento_Checkout::js/components.phtml"/>
<block class="Magento\Framework\View\Element\Js\Components" name="paypal_express_review_head_components" template="Magento_Paypal::js/components.phtml"/>
</referenceBlock>
<referenceContainer name="page.messages">
<block class="Magento\Paypal\Block\Cart\ValidationMessages" name="paypal.validation.messages"/>
</referenceContainer>
<referenceContainer name="content">
<block class="Magento\Paypal\Block\Express\Review" name="paypal.express.review" template="Magento_Paypal::express/review.phtml">
<block class="Magento\Paypal\Block\Express\Review" name="express.review.shipping.method" as="shipping_method" template="Magento_Paypal::express/review/shipping/method.phtml"/>
<block class="Magento\Framework\View\Element\Text\ListText" name="paypal.additional.actions">
<block class="Magento\Checkout\Block\Cart\Coupon" name="paypal.cart.coupon" as="coupon" template="Magento_Checkout::cart/coupon.phtml"/>
</block>
<block class="Magento\Paypal\Block\Express\Review\Details" name="paypal.express.review.details" as="details" template="Magento_Paypal::express/review/details.phtml">
<block class="Magento\Framework\View\Element\RendererList" name="checkout.onepage.review.item.renderers" as="renderer.list"/>
<block class="Magento\Checkout\Block\Cart\Totals" name="paypal.express.review.details.totals" as="totals" template="Magento_Paypal::checkout/onepage/review/totals.phtml"/>
</block>
<block class="Magento\CheckoutAgreements\Block\Agreements" name="paypal.express.review.details.agreements" as="agreements" template="Magento_CheckoutAgreements::additional_agreements.phtml"/>
</block>
</referenceContainer>
<block class="Magento\Framework\View\Element\Template" name="additional.product.info" template="Magento_Theme::template.phtml"/>
</body>
</page>
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/layout_generic.xsd">
<update handle="checkout_onepage_review_item_renderers"/>
<container name="root">
<block class="Magento\Paypal\Block\Express\Review\Details" name="page.block" template="Magento_Paypal::express/review/details.phtml">
<block class="Magento\Framework\View\Element\RendererList" name="checkout.onepage.review.item.renderers" as="renderer.list"/>
<block class="Magento\Checkout\Block\Cart\Totals" name="paypal.express.review.details.totals" as="totals" template="Magento_Paypal::checkout/onepage/review/totals.phtml"/>
</block>
</container>
</layout>
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/layout_generic.xsd">
<container name="root">
<block class="Magento\Paypal\Block\Payflow\Link\Iframe" name="payflow.link.iframe" template="Magento_Paypal::payflowlink/redirect.phtml" cacheable="false"/>
</container>
</layout>
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/layout_generic.xsd">
<container name="root">
<block class="Magento\Paypal\Block\Payflow\Link\Iframe" name="payflow.link.iframe" template="Magento_Paypal::payflowlink/form.phtml" cacheable="false"/>
</container>
</layout>
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/layout_generic.xsd">
<container name="root">
<block class="Magento\Paypal\Block\Payflow\Link\Iframe" name="payflow.link.iframe" template="Magento_Paypal::payflowlink/redirect.phtml" cacheable="false"/>
</container>
</layout>
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/layout_generic.xsd">
<container name="root">
<block class="Magento\Paypal\Block\Payflow\Advanced\Iframe" name="payflow.advanced.iframe" template="Magento_Paypal::payflowlink/redirect.phtml" cacheable="false"/>
</container>
</layout>
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/layout_generic.xsd">
<container name="root">
<block class="Magento\Paypal\Block\Payflow\Advanced\Iframe" name="payflow.advanced.iframe" template="Magento_Paypal::payflowadvanced/form.phtml" cacheable="false"/>
</container>
</layout>
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/layout_generic.xsd">
<container name="root">
<block class="Magento\Paypal\Block\Payflow\Advanced\Iframe" name="payflow.advanced.iframe" template="Magento_Paypal::payflowlink/redirect.phtml" cacheable="false"/>
</container>
</layout>
<?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>Review Order</title>
</head>
<update handle="checkout_onepage_review_item_renderers"/>
<body>
<referenceBlock name="head.components">
<block class="Magento\Framework\View\Element\Js\Components" name="paypal_payflowexpress_review_checkout_head_components" template="Magento_Checkout::js/components.phtml"/>
<block class="Magento\Framework\View\Element\Js\Components" name="paypal_payflowexpress_review_head_components" template="Magento_Paypal::js/components.phtml"/>
</referenceBlock>
<referenceContainer name="page.messages">
<block class="Magento\Paypal\Block\Cart\ValidationMessages" name="paypal.validation.messages"/>
</referenceContainer>
<referenceContainer name="content">
<block class="Magento\Paypal\Block\Express\Review" name="paypal.express.review" template="Magento_Paypal::express/review.phtml">
<action method="setControllerPath">
<argument name="prefix" xsi:type="string">paypal/payflowexpress</argument>
</action>
<block class="Magento\Paypal\Block\Express\Review" name="express.review.shipping.method" as="shipping_method" template="Magento_Paypal::express/review/shipping/method.phtml"/>
<block class="Magento\Framework\View\Element\Text\ListText" name="paypal.additional.actions">
<block class="Magento\Checkout\Block\Cart\Coupon" name="paypal.cart.coupon" as="coupon" template="Magento_Checkout::cart/coupon.phtml"/>
</block>
<block class="Magento\Paypal\Block\Express\Review\Details" name="paypal.express.review.details" as="details" template="Magento_Paypal::express/review/details.phtml">
<block class="Magento\Framework\View\Element\RendererList" name="checkout.onepage.review.item.renderers" as="renderer.list"/>
<block class="Magento\Checkout\Block\Cart\Totals" name="paypal.express.review.details.totals" as="totals" template="Magento_Paypal::checkout/onepage/review/totals.phtml"/>
</block>
<block class="Magento\CheckoutAgreements\Block\Agreements" name="paypal.express.review.details.agreements" as="agreements" template="Magento_CheckoutAgreements::additional_agreements.phtml"/>
</block>
</referenceContainer>
<block class="Magento\Framework\View\Element\Template" name="additional.product.info" template="Magento_Theme::template.phtml"/>
</body>
</page>
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/layout_generic.xsd">
<container name="root" label="Root">
<block class="Magento\Payment\Block\Transparent\Redirect" name="transparent_redirect" template="Magento_Payment::transparent/redirect.phtml">
<arguments>
<argument name="route_path" xsi:type="string">paypal/transparent/response</argument>
</arguments>
</block>
</container>
</layout>
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/layout_generic.xsd">
<container name="root" label="Root">
<block class="Magento\Payment\Block\Transparent\Iframe" name="transparent_iframe" template="Magento_Payment::transparent/iframe.phtml"/>
</container>
</layout>
<?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">
<referenceBlock name="vault.cards.list">
<block class="Magento\Paypal\Block\Payflow\Customer\CardRenderer" name="payflow.card.renderer" template="Magento_Vault::customer_account/credit_card.phtml"/>
</referenceBlock>
</referenceContainer>
</body>
</page>
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/**
* @var \Magento\Paypal\Block\Express\Shortcut $block
*/
?>
<?php
$labelPosition = '';
if ($block->isOrPositionBefore()) {
$labelPosition = ' before';
} elseif ($block->isOrPositionAfter()) {
$labelPosition = ' after';
}
$shortcutHtmlId = $block->escapeHtml($block->getShortcutHtmlId());
$isInCatalogProduct = false;
if ($block->getIsInCatalogProduct()) {
$isInCatalogProduct = $block->getIsInCatalogProduct();
}
?>
<div data-label="<?= $block->escapeHtml(__('or')) ?>"
class="paypal checkout <?= /* @noEscape */ $labelPosition ?> paypal-logo
<?= /* @noEscape */ $shortcutHtmlId ?>"
data-mage-init='{
"paypalCheckout": {
"isCatalogProduct": "<?= /* @noEscape */ !empty($isInCatalogProduct) ? (bool)$isInCatalogProduct : false ?>",
"shortcutContainerClass": "<?= /* @noEscape */ "." . $shortcutHtmlId ?>"
}
}'
>
<?php
if(strpos($block->escapeUrl($block->getImageUrl()),'checkout-logo-medium') !== false){
$imgsrc = $block->getViewFileUrl('Magento_Paypal::images/paypal-color.svg');
$class = 'checkout-logo-medium';
} else {
$imgsrc = $block->getViewFileUrl('Magento_Paypal::images/paypal-credit.png');
$class = 'paypal-credit';
}
?>
<div class="<?= $class ?>">
<input type="image" data-action="checkout-form-submit"
data-checkout-url="<?= $block->escapeUrl($block->getCheckoutUrl()) ?>"
src="<?= $imgsrc ?>"
alt="<?= $block->escapeHtml(__('Checkout with PayPal')) ?>"
title="<?= $block->escapeHtml(__('Checkout with PayPal')) ?>"/>
<?php if ($block->getAdditionalLinkImage()) : ?>
<?php $linkImage = $block->getAdditionalLinkImage(); ?>
<a href="<?= $block->escapeUrl($linkImage['href']) ?>">
<img src="<?= $block->escapeHtml($linkImage['src']) ?>" />
</a>
<?php endif; ?>
<div class="checkout-txt">Checkout</div>
</div>
</div>
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 188 49"><path fill="#0070E0" d="M164.01 11.446l-4.012 25.207a.643.643 0 0 0 .642.746h4.748a.701.701 0 0 0 .698-.589l4.012-25.207a.643.643 0 0 0-.642-.746h-4.748a.692.692 0 0 0-.698.589zm-5.07 7.356h-4.505a.699.699 0 0 0-.697.588l-.149.928s-3.499-3.794-9.694-1.23c-3.554 1.468-5.26 4.501-5.986 6.723 0 0-2.304 6.753 2.907 10.47 0 0 4.832 3.575 10.273-.22l-.094.592a.644.644 0 0 0 .37.686c.085.04.178.06.272.06h4.508a.692.692 0 0 0 .698-.589l2.742-17.262a.632.632 0 0 0-.149-.521.643.643 0 0 0-.496-.226zm-6.629 9.54a5.005 5.005 0 0 1-1.715 3.095 5.073 5.073 0 0 1-3.345 1.203 4.602 4.602 0 0 1-1.416-.206c-1.945-.62-3.055-2.474-2.736-4.484a5.01 5.01 0 0 1 1.717-3.093 5.08 5.08 0 0 1 3.343-1.207 4.6 4.6 0 0 1 1.416.208c1.957.616 3.062 2.473 2.741 4.485h-.005zm-24.056.477c2.443 0 4.806-.868 6.662-2.446a10.147 10.147 0 0 0 3.456-6.158c.789-4.993-3.14-9.351-8.71-9.351h-8.973a.699.699 0 0 0-.697.589L115.98 36.66a.644.644 0 0 0 .37.686c.086.04.178.06.272.06h4.751a.699.699 0 0 0 .697-.589l1.178-7.402a.692.692 0 0 1 .698-.59l4.309-.006zm3.974-8.831c-.293 1.846-1.731 3.205-4.482 3.205h-3.517l1.068-6.713h3.454c2.844.005 3.77 1.67 3.477 3.513v-.005z"/><path fill="#003087" d="M110.567 19.23l-5.434 9.105-2.758-9.038a.694.694 0 0 0-.672-.495h-4.904a.526.526 0 0 0-.527.446.515.515 0 0 0 .025.247l4.942 15.224-4.47 7.174a.516.516 0 0 0 .18.728.527.527 0 0 0 .269.07h5.282a.876.876 0 0 0 .751-.42l13.804-22.667a.512.512 0 0 0 .011-.53.524.524 0 0 0-.463-.263h-5.28a.877.877 0 0 0-.756.419zm-16.548-.428H89.51a.7.7 0 0 0-.698.59l-.146.927s-3.502-3.794-9.697-1.23c-3.553 1.468-5.26 4.501-5.983 6.723 0 0-2.306 6.753 2.904 10.47 0 0 4.833 3.575 10.274-.22l-.094.592a.642.642 0 0 0 .37.686c.085.04.178.06.272.06h4.508a.701.701 0 0 0 .697-.589l2.743-17.262a.642.642 0 0 0-.37-.687.655.655 0 0 0-.272-.06zm-6.63 9.542a5.011 5.011 0 0 1-1.716 3.091 5.082 5.082 0 0 1-3.343 1.206 4.605 4.605 0 0 1-1.414-.206c-1.944-.62-3.053-2.474-2.734-4.485a5.011 5.011 0 0 1 1.723-3.098 5.082 5.082 0 0 1 3.353-1.201c.48-.005.959.065 1.417.208 1.937.616 3.04 2.472 2.72 4.485h-.005zm-24.055.476a10.284 10.284 0 0 0 6.656-2.449 10.144 10.144 0 0 0 3.452-6.156c.79-4.992-3.14-9.35-8.708-9.35H55.76a.7.7 0 0 0-.698.588l-4 25.2a.642.642 0 0 0 .37.687c.085.039.178.06.272.06h4.748a.7.7 0 0 0 .698-.59l1.176-7.402a.692.692 0 0 1 .698-.589h4.31zm3.974-8.832c-.293 1.846-1.73 3.205-4.481 3.205H59.31l1.066-6.713h3.454c2.845.005 3.77 1.671 3.478 3.513v-.005z"/><path fill="#001C64" d="M32.639 12.16c.107-5.566-4.484-9.836-10.797-9.836H8.784a1.277 1.277 0 0 0-1.262 1.078L2.29 36.095a1.038 1.038 0 0 0 1.025 1.2h7.736l-1.209 7.57a1.038 1.038 0 0 0 1.025 1.2h6.302c.304 0 .575-.109.807-.306.23-.198.268-.471.316-.772l1.85-10.884c.047-.3.2-.69.431-.888.231-.198.433-.306.738-.306h3.856c6.183 0 11.428-4.395 12.387-10.507.679-4.338-1.181-8.286-4.915-10.243z"/><path fill="#0070E0" d="M12.725 25.238l-1.927 12.218-1.21 7.664a1.038 1.038 0 0 0 1.026 1.199h6.67a1.276 1.276 0 0 0 1.26-1.078l1.758-11.139a1.277 1.277 0 0 1 1.261-1.078h3.926c6.183 0 11.428-4.51 12.388-10.622.68-4.338-1.504-8.286-5.238-10.243-.01.462-.05.923-.121 1.38-.959 6.11-6.206 10.621-12.387 10.621h-6.145a1.278 1.278 0 0 0-1.261 1.079"/><path fill="#003087" d="M10.797 37.456h-7.76a1.037 1.037 0 0 1-1.024-1.2L7.245 3.078A1.277 1.277 0 0 1 8.506 2h13.336c6.313 0 10.904 4.594 10.797 10.159-1.571-.824-3.417-1.295-5.439-1.295H16.082a1.277 1.277 0 0 0-1.262 1.078l-2.094 13.296-1.93 12.218z"/></svg>
\ No newline at end of file
......@@ -1666,19 +1666,7 @@ footer{
width: 100%;
display: inline-block;
}
.cart.table-wrapper .product-item-details{max-width:78px;}
.cart.table-wrapper .product-item-details .product-item-name{display: unset;}
.cart.table-wrapper .product-item-details .product-item-name a{
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
cursor: pointer;
width: 100%;
display: inline-block;
color: #222222;
font-family: Outfit-Regular;
font-size: 12px;
}
}
//.product-items .product-item-photo:hover {
// transform: scale(1.02);
......@@ -1710,90 +1698,8 @@ footer{
color: #333333;
font-size: 12px;
}
.cart-container .checkout.checkout-methods-items li{width: 100%;}
//.cart-container .checkout.checkout-methods-items li .checkout-logo-medium,.cart-container .checkout.checkout-methods-items li .paypal-credit{
//
// background: #ffc439;
// align-items: center;
// font-weight: 700;
// justify-content: center;
//}
.block-minicart .block-content > .actions .action.checkout ~ div:not(:empty){
display: unset !important;
}
.checkout-logo-medium,.paypal-credit{
display: flex;
background:#ffc439;
margin-bottom: 10px;
font-size: 14px;
align-items: center;
font-weight: 700;
justify-content: center;
font-family: Outfit-Regular;
}
.block.block-minicart .checkout-logo-medium,.block.block-minicart .paypal-credit{
font-size: 12px;
color: #333333;
font-weight: 600;
}
.opc-block-summary .totals.discount .title{
font-weight: unset;
font-size: 16px;
color: unset;
}
.checkout-txt{font-size: 18px;}
.paypal-credit .checkout-txt{margin-left: 15px;}
.checkout-logo-medium input,.paypal-credit input{
background: #ffc439;
outline: none;
position: relative;
display: inline-flex;
justify-content: center;
align-items: center;
gap: 0.25rem;
height: 55px;
padding: 8px 0;
}
.block-minicart .block-content > .actions input{
height: 45px;
}
.cart-container .checkout.checkout-methods-items li .checkout-txt{font-weight: 700;}
#minicart-content-wrapper .product.options.list{display: flex;}
#minicart-content-wrapper .product-item-pricing{display: flex;font-size: 13px;}
#minicart-content-wrapper .product-item-pricing .details-qty.qty{margin-right: 4px;gap: 0.175rem !important;color: #333333;}
#minicart-content-wrapper .minicart-items .actions{bottom: 1.5rem !important;}
#minicart-content-wrapper .item-total-subtotal{display: flex;align-items: center;justify-content: space-between;}
.block-minicart .items-total{display: block !important;font-size: 18px;color: #666666;}
#minicart-content-wrapper .action.primary.checkout{display: none !important;}
#minicart-content-wrapper .actio.delete{color: #999999 !important;}
#minicart-content-wrapper .actions .secondary a.action.viewcart{
outline: none;
position: relative;
display: inline-flex;
justify-content: center;
align-items: center;
gap: 0.25rem;
font-weight: 400;
padding: 0.5rem 1.25rem;
color: #ffffff;
background-color: #ffa800;
text-decoration: none !important;
white-space: nowrap;
height: 45px;
text-transform: capitalize;
font-size: 18px;
border-radius: 2px;
width: 100%;
}
.minicart-items .action.delete::before{
background-color: #999999;
-webkit-mask: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" /></svg>') no-repeat 50% 50%;
-webkit-mask-size: 1.25rem 1.25rem;
}
.product-items .product-item-photo{
overflow: hidden;
}
@media (min-width: 992px) {
.product-item:hover .product-item-info .image0,
.product-list-item:hover .product-item-info .image0 {
......@@ -1952,72 +1858,7 @@ button.action.submit.primary {
white-space: nowrap;
}
//购物车按钮样式
.action.primary.tocart{
font-size: smaller;
background-color: #000;
max-width: 100%;
font-weight: 600;
height: 55px;
width: 300px;
}
.block-minicart .block-content>.actions a.action{
color: #333333;
text-transform: uppercase;
}
.block-minicart .subtotal{
justify-content: right;
}
.block-minicart .subtotal .label{
font-size: 18px;
color: #333333;
}
.block-minicart .subtotal .price-wrapper{
font-size: 18px;
margin-left: 2px;
}
.block-minicart .action.primary.checkout{
height: 45px;
text-transform: uppercase;
font-size: 13px;
border-radius: 5px;
}
.block-minicart .subtitle.empty{
color: #e63500;
font-size: 14px;
font-family: 'Outfit-Regular';
}
.block-minicart .product-item-details .product-item-name a{
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
cursor: pointer;
width: 100%;
display: inline-block;
color: #222222;
font-family: Outfit-Regular;
font-size: 14px;
}
.block-minicart .product.options .toggle{font-size: 13px;}
.block-minicart dl{margin:0;}
.block-minicart dt,dd{ display:inline; margin:0; padding:0;}
.block-minicart dt { font-weight: bold; }
.block-minicart dt::after { content: ": "; }
.block-minicart dd::after{ content:"\0A"; white-space:pre; }
.block-minicart .product.options.list{font-size: 12px;}
.minicart-items-wrapper dl{margin:0;}
.minicart-items-wrapper dt,dd{ display:inline; margin:0; padding:0;}
.minicart-items-wrapper dt { font-weight: bold; }
.minicart-items-wrapper dt::after { content: ": "; }
.minicart-items-wrapper dd::after{ content:"\0A"; white-space:pre; }
@media (min-width: 780px) {
.action.primary.tocart{
width: 500px !important;
}
}
#product-intro__freeshipping-more-3{
display: inline-block;
......@@ -2291,44 +2132,8 @@ background-color: #000;
.amreview-images.slick-slider .slick-slide{
width: 100px !important;
}
@media(min-width: 640px) {
.cart-container {
width: 81%;
margin: 0 auto;
}
.scroll-active{
background: #ffffff;
z-index: 1000;
width: 100%;
position: fixed;
padding-right: 20px;
top: 0;
transition: transform .3s;
}
.checkout-cart-index .page.messages{
width: 81%;
margin: 0 auto;
}
}
.checkout.checkout-methods-items li{display: block;}
.checkout.checkout-methods-items li .paypal.checkout{margin-bottom: 15px;}
.cart.table-wrapper .cart.table td{vertical-align: middle;}
.checkout-cart-index .cart-empty{text-align: center;margin-top: 50px;}
.checkout-cart-index .cart-empty .empty-img{margin-bottom: 20px;}
.checkout-cart-index .cart-empty .empty-img img{width: 120px;}
.checkout-cart-index .cart-empty a{
background: #ffa800;
color: #ffffff;
padding: 8px 15px;
text-transform: uppercase;
font-size: 12px;
}
span.swatch-attribute-selected-option{
margin-left: 20px;
color: blue;
}
//product view right
@media(min-width: 1024px) {
......
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