Advertisement
Guest User

Untitled

a guest
Dec 15th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 14.07 KB | None | 0 0
  1. <iscontent type="text/html" charset="UTF-8" compact="true"/>
  2. <isinclude template="util/modules"/>
  3.  
  4. <isscript>
  5.     var pageContext = {
  6.         title: 'Checkout',
  7.         type: 'checkout',
  8.         ns: 'checkout'
  9.     };
  10. </isscript>
  11.  
  12. <isdecorate template="layout/base">
  13.  
  14.  
  15. <iscomment>
  16.     This template visualizes the first step of the single shipping checkout
  17.     scenario. It renders a form for the shipping address and shipping method
  18.     selection. Both are stored at a single shipment only.
  19. </iscomment>
  20.  
  21. <iscomment>Report this checkout step (we need to report two steps)</iscomment>
  22.  
  23. <isreportcheckout checkoutstep="${2}" checkoutname="${'ShippingAddress'}"/>
  24. <isreportcheckout checkoutstep="${3}" checkoutname="${'ShippingMethod'}"/>
  25. <isscript>
  26.     importScript("cart/CartUtils.ds");
  27.     var productListAddresses = CartUtils.getAddressList(pdict.Basket, pdict.CurrentCustomer, true);
  28. </isscript>
  29.  
  30. <div class="row" id="checkout">
  31.  
  32.     <div class="small-12 medium-12 columns">
  33.  
  34.         <div class="small-12 medium-9 columns">
  35.  
  36.             <iscomment>checkout progress indicator</iscomment>
  37.  
  38.             <ischeckoutprogressindicator step="1" rendershipping="${pdict.Basket.productLineItems.size() == 0 ? 'false' : 'true'}"/>
  39.  
  40.             <form action="${URLUtils.continueURL()}" method="post" id="${pdict.CurrentForms.singleshipping.shippingAddress.htmlName}" class="checkout-shipping address form-horizontal">
  41.  
  42.                 <isif condition="${pdict.HomeDeliveries}">
  43.  
  44.                     <fieldset>
  45.  
  46.                         <div class="small-12 medium-12 columns">
  47.  
  48.                             <div class="small-12 medium-2 columns">
  49.                                 <div class="iconContainer">
  50.                                     <div class="icon">
  51.                                         <svg><use xlink:href="${URLUtils.staticURL('/images/sprite.svg#account-addresses')}" /></use></svg>
  52.                                     </div>
  53.                                 </div>    
  54.                             </div>
  55.  
  56.                             <div class="small-12 medium-10 columns">
  57.  
  58.                                 <isif condition="${dw.system.Site.getCurrent().getCustomPreferenceValue('enableShipToStore')}">
  59.  
  60.                                     <div id="typesOfShippmentGroup">
  61.                                         <legend>
  62.                                             ${Resource.msg('checkout.typeofshipping.title','forms',null)}
  63.                                         </legend>
  64.                                         <isinputfield formfield="${pdict.CurrentForms.singleshipping.shippingAddress.isShipToStore}" type="radio" />
  65.                                     </div>  
  66.                                    
  67.                                     <script>
  68.                                         $('#typesOfShippmentGroup input').on('change', function () {
  69.                                             var sectionSelected = $('#typesOfShippmentGroup input[checked]').val();
  70.                                             console.log(sectionSelected);
  71.                                             if (sectionSelected === 'false') {
  72.                                                 // show ship to address section
  73.                                                 $('#shippingToAddressSection').removeClass('hide');
  74.                                                 $('#shippingToStoreSection').addClass('hide');
  75.                                             }
  76.                                             else if (sectionSelected === 'true') {
  77.                                                 // show ship to store section
  78.                                                 $('#shippingToAddressSection').addClass('hide');
  79.                                                 $('#shippingToStoreSection').removeClass('hide');
  80.                                             }
  81.                                         });
  82.                                     </script>
  83.  
  84.                                 </isif>
  85.                                
  86.                                 <div id="shippingToAddressSection">
  87.                                     <iscomment>shipping address area</iscomment>
  88.  
  89.                                     <legend>
  90.                                         ${Resource.msg('singleshipping.enteraddress','checkout',null)}
  91.                                         <div class="dialog-required"> <span class="required-indicator">&#8226; <em>${Resource.msg('global.requiredfield','locale',null)}</em></span></div>
  92.                                     </legend>
  93.  
  94.                                     <iscomment>Entry point for Multi-Shipping (disabled on purpose)</iscomment>
  95.                                     <isif condition="${dw.system.Site.getCurrent().getCustomPreferenceValue('enableMultiShipping')}">
  96.                                         <isscript>
  97.                                             var plicount = 0;
  98.  
  99.                                             for each (var shipment in pdict.Basket.shipments) {
  100.                                                 for each (var product in shipment.productLineItems) {
  101.                                                     plicount += product.quantity;
  102.                                                 }
  103.                                             }
  104.                                         </isscript>
  105.                                         <isif condition="${plicount > 1 }">
  106.                                             <div class="ship-to-multiple">
  107.                                                 ${Resource.msg('singleshipping.multiple','checkout',null)}
  108.                                                 <button class="shiptomultiplebutton button-fancy-medium cancel" type="submit" name="${pdict.CurrentForms.singleshipping.shipToMultiple.htmlName}" value="${Resource.msg('global.yes','locale',null)}">
  109.                                                     ${Resource.msg('global.yes','locale',null)}
  110.                                                 </button>
  111.                                             </div>
  112.                                         </isif>
  113.                                     </isif>
  114.  
  115.                                     <iscomment>display select box with stored addresses if customer is authenticated and there are saved addresses</iscomment>
  116.                                     <isif condition="${pdict.CurrentCustomer.authenticated && pdict.CurrentCustomer.profile.addressBook.addresses.size() > 0}">
  117.                                         <div class="select-address form-row">
  118.                                             <label for="${pdict.CurrentForms.singleshipping.addressList.htmlName}">
  119.                                                 ${Resource.msg('global.selectaddressmessage','locale',null)}
  120.                                             </label>
  121.                                             <div class="field-wrapper">
  122.                                                 <isaddressselectlist p_listId="${pdict.CurrentForms.singleshipping.addressList.htmlName}" p_listaddresses="${productListAddresses}" />
  123.                                             </div>
  124.                                         </div>
  125.                                     </isif>
  126.  
  127.                                     <isscript>
  128.                                         var currentCountry = require('~/cartridge/scripts/util/Countries').getCurrent(pdict);
  129.                                     </isscript>
  130.                                     <isdynamicform formobject="${pdict.CurrentForms.singleshipping.shippingAddress.addressFields}" formdata="${currentCountry.dynamicForms.addressDetails}"/>
  131.  
  132.                                     <iscomment>Add address to Address Book</iscomment>
  133.                                     <isif condition="${pdict.CurrentCustomer.authenticated}">
  134.                                         <isinputfield formfield="${pdict.CurrentForms.singleshipping.shippingAddress.addToAddressBook}" type="checkbox"/>
  135.                                     </isif>
  136.  
  137.                                     <iscomment>Use address for Billing Address</iscomment>
  138.                                     <isinputfield formfield="${pdict.CurrentForms.singleshipping.shippingAddress.useAsBillingAddress}" type="checkbox"/>
  139.  
  140.                                 </div>
  141.  
  142.                                 <div id="shippingToStoreSection" class="hide">
  143.                                    
  144.                                     <isinputfield formfield="${pdict.CurrentForms.singleshipping.shippingType.storeId}" type="text" />
  145.                                    
  146.                                 </div>
  147.                            
  148.                             </div>
  149.  
  150.                         </div>  
  151.  
  152.                         <isif condition="${dw.system.Site.getCurrent().getCustomPreferenceValue('enableGiftBox')}">
  153.  
  154.                             <div class="small-12 medium-12 columns">
  155.  
  156.                                 <div class="small-12 medium-2 columns">
  157.                                     <div class="iconContainer">
  158.                                         <div class="icon">
  159.                                             <svg><use xlink:href="${URLUtils.staticURL('/images/sprite.svg#shipping-gift')}" /></use></svg>
  160.                                         </div>
  161.                                     </div>  
  162.                                 </div>
  163.  
  164.                                 <div class="small-12 medium-10 columns">
  165.  
  166.                                     <iscomment>Is this a gift</iscomment>
  167.                                     <isinputfield formfield="${pdict.CurrentForms.singleshipping.shippingAddress.isGift}" type="radio"/>
  168.  
  169.                                     <isscript>
  170.                                         var attributes = {
  171.                                             rows: 4,
  172.                                             cols: 10,
  173.                                             'data-character-limit': 250
  174.                                         };
  175.                                     </isscript>
  176.                                     <isinputfield rowclass="gift-message-text" formfield="${pdict.CurrentForms.singleshipping.shippingAddress.giftMessage}" type="textarea" attributes="${attributes}"/>
  177.  
  178.                                 </div>  
  179.  
  180.                             </div>    
  181.                        
  182.                         </isif>
  183.  
  184.                     </fieldset>
  185.  
  186.                             <div class="small-12 medium-12 columns">
  187.  
  188.                                 <div class="small-12 medium-2 columns">
  189.                                     <div class="iconContainer">
  190.                                         <div class="icon">
  191.                                             <svg><use xlink:href="${URLUtils.staticURL('/images/sprite.svg#shipping-shipping-method')}" /></use></svg>
  192.                                         </div>
  193.                                     </div>    
  194.                                 </div>
  195.  
  196.                                 <div class="small-12 medium-10 columns">
  197.                                     <div id="shipping-method-list">
  198.                                         <isinclude url="${URLUtils.https('COShipping-UpdateShippingMethodList')}"/>
  199.                                     </div>
  200.                                 </div>
  201.  
  202.                             </div>
  203.  
  204.                 </isif>
  205.                
  206.  
  207.                 <div class="small-12 medium-12 columns">
  208.  
  209.                     <fieldset>
  210.  
  211.                         <isif condition="${dw.system.Site.getCurrent().getCustomPreferenceValue('enableStorePickUp')}">
  212.                             <isset name="instoreShipmentsExists" value="${false}" scope="page"/>
  213.                             <isinclude template="checkout/shipping/storepickup/instoremessages"/>
  214.                         <iselse/>
  215.                             <isset name="instoreShipmentsExists" value="${false}" scope="page"/>
  216.                         </isif>
  217.  
  218.  
  219.                         <isif condition="${dw.system.Site.getCurrent().getCustomPreferenceValue('enableStorePickUp') && instoreShipmentsExists}">
  220.                             <div class="form-row form-row-button instore-continue-button">
  221.                         <iselse/>
  222.                             <div class="form-row form-row-button">
  223.                         </isif>
  224.  
  225.                             <button class="btn button-fancy-large" type="submit" name="${pdict.CurrentForms.singleshipping.shippingAddress.save.htmlName}" value="${Resource.msg('global.continuebilling','locale',null)}"><span>${Resource.msg('global.continuebilling','locale',null)}</span></button>
  226.                         </div>
  227.  
  228.                         <iscomment>Entry point for Multi-Shipping (disabled on purpose)</iscomment>
  229.                         <isif condition="${pdict.Basket.productLineItems.size() > 1 && false}">
  230.                            <div class="ship-to-multiple">
  231.                                ${Resource.msg('singleshipping.multiple','checkout',null)} <a href="${URLUtils.https('COShippingMultiple-Start')}">${Resource.msg('global.yes','locale',null)}</a>
  232.                            </div>
  233.                        </isif>
  234.  
  235.                        <input type="hidden" name="${dw.web.CSRFProtection.getTokenName()}" value="${dw.web.CSRFProtection.generateToken()}"/>
  236.  
  237.                    </fieldset>
  238.  
  239.                </div>
  240.  
  241.            </form>
  242.        
  243.        </div>
  244.  
  245.        <div class="small-12 medium-3 columns">
  246.            <isinclude template="checkout/minisummary"/>
  247.        </div>
  248.  
  249.    </div>
  250.  
  251. </div>
  252.  
  253.    <isscript>
  254.        importScript("util/ViewHelpers.ds");
  255.         var addressForm = pdict.CurrentForms.singleshipping.shippingAddress.addressFields;
  256.         var countries = ViewHelpers.getCountriesAndRegions(addressForm);
  257.         var json = JSON.stringify(countries);
  258.     </isscript>
  259.     <script>window.Countries = <isprint value="${json}" encoding="off"/>;</script>
  260.  
  261.     <iscontentasset aid="checkout-shipping"/>
  262.  
  263.     <isset name="checkoutStep" value="2" scope="page" />
  264.     <isset name="option" value="" scope="page" />
  265.     <isinclude template="checkout/checkout-gtm" />
  266. </isdecorate>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement