MODULES
...
eCommerce
Cart, Checkout, Shipping and O...
Cart, Checkout and Orders Flow with Secure Zones Module - Tutorial
10min
this tutorial shows you how to use the ecommerce and secure zones modules together prerequisites you have read how to set up a shopping cart and guest checkout you have installed the ecommerce module you have installed the secure zone module using paypal as a payment gateway? there are additional setup instructions here introduction siteglide ecommerce is even more powerful with secure zones with the security of a secure zone, you can show your users more sensitive data about their shopping experience 1\) create a secure zone create a secure zone which will used by shoppers on your ecommerce site alternatively, you can use a secure zone that you have created already find out more about the secure zones module here 2\) create a "my orders" page in a secure zone create a new page which will display a list of products users have ordered learn more about creating pages here make a note of the page slug, because you will want to add this to the checkout form’s "redirect url" field later click the secure zones accordion to reveal the "select a secure zone" field click in this to open a drop down list of your secure zones and select the one you wish to be accessed by users after they complete checkout 3\) add the secure zone to the checkout form make sure your checkout form is still in "test mode" unless the site is live the document how to set up a shopping cart and guest checkout, explained how to create a checkout form here we will modify this form so that it also either signs in a user or logs them in, depending on their current status find forms in the siteglide admin’s left hand side menu under cms / forms select the pencil icon on the right hand side of your checkout form to edit the structure of your form in the "redirect url" field add your orders page slug, preceded by a forward slash e g /my orders select the secure zones tag and then click in the secure zones input field to see a dropdown of secure zones you have already created select the secure zone you want to log your users in to when they complete the form press the "save" button to save your changes at this point completing the checkout form will log users in to the secure zone it will also redirect the users to the my orders page the users will be allowed to access the my orders page, because they are logged into the secure zone other users who are not logged in will be unable to access the my orders page 4\) create an orders list layout as orders list layouts are for showing secure information about users, they are stored under the following file structure layouts modules module 5 user orders name of my layout liquid create a new file in the user orders folder and give it a name of your choice make a note of the name you gave it 5\) develop your layout your layout will have access to the "orders" object you can loop over each order in the "order" object with the following liquid (the "order" variable can be renamed to anything you like) {% for order in orders %} {% endfor %} inside this loop, you can access the following fields (if you have renamed the order variable, make sure you also rename it when outputting the fields ) field name liquid tag description order id {{ order id }} the unique id of the order order url {{ order slug }} the unique slug of the order order full url {{ order full slug }} the unique slug of the order including order slug user id {{ order user id }} the unique id of the current user user email {{ order email }} the email address of the user who completed the order status {{ order status }} the status of the order billing address {{ order billing address }} not yet available shipping address {{ order shipping address }} not yet available payment method {{ order payment method }} not yet available shipping method {{ order shipping method }} coming soon! tracking number {{ order tracking number }} not yet available price {{ order price }} the price paid for the order as a decimal currency {{ order currency }} the currency the order was made in 6\) add orders layout to the orders page add the following liquid to your orders page to output a list of the current logged in user’s orders {% include 'user orders', layout 'my orders list layout', sort type 'id', sort order 'asc', show pagination 'false' %} the layout parameter should take the name of the list layout you created other ways to use secure zones with ecommerce you could add a secure zone to other pages related to your ecommerce flow, for example the cart, in the same way you did with the orders page you could redirect the users to a login page when they visit the cart page and are not logged in learn more about secure zones here