Custom card layout for e-commerce app

Custom card layout for e-commerce app

Requirement

Display products in a card layout with a button to add required products to a cart.

Use Case

An e-commerce business uses an order management app to process orders. Products need to be displayed in a card layout with product images, and customers can add required products to their cart to make an order.

Steps to follow

1. Create the forms with the following details:

Form

Form Link Name

Field Type

Field Name

Field Link Name

Products

Products

Single Line

Product

Product

Image

Image

Image

Currency

Price

Price

Items

Items

 

Lookup

Product

Product

Number

Quantity

Quantity

Currency

Price

Price

Currency

Total

Total

Email

Email

Email

Order

Order

Name

Name

Name

Address

Address

Address

Phone

Phone

Phone_Number

SubForm

Items
(Existing Form)

Items

Currency

Total

Total


2. Set the initial value of email field in Items form to ${zoho.loginuserid}.

3. Rename the Items Report to My Cart, and set the following Layout to it under Quick View > Layout.


4. Navigate to QuickView > Actions, and rename the Delete action to Remove form Cart, and remove the additional actions like Edit, and Duplicate.



5. Set a filter in Report Properties of My Cart report as shown below. This is to ensure that customers see only their products in the report.


6. Create a page named Product Listing.

7. Add a button named Raise Order and set the following parameters under Action tab.


The URL should redirect to the Orders form. It will be in the following format:
https://creatorapp.zoho.com/<app-owner-name>/<app-linkname>/#Form:Order
8. Add an HTML snippet and paste the below HTML code.

  1. <%{
  2. %>

  3. /* class to define font length*/

  4. <style>
  5.         .product-link {
  6. text-decoration: none;
  7. font-size: 1rem;
  8. }

  9. /* class to define Card Layout */

  10. .product-cards {
  11. display: grid;
  12. grid-template-columns: repeat(3, 1fr);
  13. grid-auto-rows: auto;
  14. gap: 0.5rem;
  15. }

  16. /* will get back */

  17. .no_record_wrapper {
  18.     display: none;
  19. }

  20. /* to remove text No Records Added */

  21. .row.reportfullwidth.custom-report.zc-card-report
  22. {
  23. background-color: white;
  24. }

  25. /* class to define details in individual Card */

  26. .product-card {
  27. box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
  28. transition: 0.3s;
  29. width: 70%;
  30. height: fit-content;
  31. text-align: center;
  32. padding: 1rem;
  33. float: left;
  34. margin: 25px;
  35. }

  36. /* class to add space between product name and Add to Cart text */

  37. .product-card .product-container-card {
  38. padding: 1rem;
  39. }

  40. /* class to define Image dimensions*/

  41. .product-header-image {
  42. display: block;
  43. margin: auto;
  44. max-width: 150px;
  45. height: 60%;
  46. }
  47. </style>

  48. /* class to fetch images from report */

  49. <div class="product-cards">
  50. <%
  51. for each  product in Products[ID != null]
  52. {
  53. var = product.Image.getprefix("\" lowqual").getsuffix("<img src = \"").replaceAll("/sharedBy/appLinkName/viewLinkName/fieldName",zoho.appuri + "All_Products/Image");
  54. %>

  55. /* class to display product image in each card fetched in above snippet*/

  56. <div class="product-card">
  57.    <img src=<%=var%> class="product-header-image" alt=<%=product.Product%>/>
  58.    <div class="product-container-card">
  59.     <h4><b><%=product.Product%></b></h4>
  60.     /* action to open form on click of Add to Cart*/

  61. <p><a class="product-link" href="#Form:Items?zc_LoadIn=dialog&Product=<%=product.ID%>">Add To Cart</a></p>
  62.    </div>
  63.   </div>
  64. <%
  65. }
  66. %>
  67. </div>
  68. <% 
  69. }%>
9. Embed the My Cart report on the page and position it in parallel to the HTML snippet as displayed below.


10. Create a workflow to populate quantity with value "1" and price of the product when the Items form loads.


11. Click Add New Action and add the following snippet in the deluge editor:
  1. // fetch details of the selected Product
  2. productDetails = Products[ID == input.Product];
  3. // Assign the product details to the form fields
  4. input.Price = productDetails.Price;
  5. input.Quantity = 1;
  6. input.Total = productDetails.Price;
  7. // hide email field as it is used only to track the current user's products
  8. hide Email;
  9. // disable Price and Total fields from manual updation
  10. disable Price;
  11. disable Total;
12. Now set a condition so that the above script executes only when Product value is not null.


13. Let's add another workflow to calculate the Total when the Quantity is updated.


14. Click Add New Action and add the following snippet.
  1. input.Total = input.Quantity * input.Price;
15. Now create a workflow to redirect users to the Product Listing page after an item has been added to the cart.


16. Click Add New Action > Deluge Script and add the following script to the editor:
  1. openUrl("https://creatorapp.zoho.com/<owner-name>/<app-linkname>/#Product_Listing","same window");
  2. reload;
17. Now let's add a workflow in the Orders form to add subform rows with the selected items.


18. Click Add New Action and add the following snippet:
  1. // hide the email field
  2. hide Items.Email;
  3. // insert subform rows with selected Items
  4. rows = Collection();
  5. // declare initial value to calculate the sum later
  6. sum = 0.0;
  7. // iterate though records of current user in Items form to fetch values and insert in subform
  8. for each  rec in Items[Email == zoho.loginuserid]
  9. {
  10. row1 = Order.Items();
  11. row1.Product=rec.Product;
  12. row1.Price=rec.Price;
  13. row1.Quantity=rec.Quantity;
  14. row1.Total=rec.Total;
  15. rows.insert(row1);
  16. sum = sum + rec.Total;
  17. }
  18. input.Items.insert(rows);
  19. input.Total = sum;
19. Let's add a workflow to update the price if the selected product is changed in the Orders form.


20. Click Add New Action and add the following snippet:
  1. row.Price=row.Products.Price;
21. Let's add a workflow to update the price if the selected quantity is changed in the Orders form, and to calculate the total cost of the selected items.


22. Click Add New Action and add the following snippet:
  1. if(row.Quantity != 0 && row.Quantity != null)
  2. {
  3. row.Cost=row.Quantity * row.Price;
  4. }
  5. input.Total = input.Items.sum(Cost);
23. Lastly, let's add a workflow to remove the records from Items form after the order has been placed.


24. Click Add New Action > Deluge Script and add the following script to the editor:
  1. delete from Items[ID != 0];
  2. openUrl("https://creatorapp.zoho.com/<app-owner>/<app-linkname>/#Product_Listing","parent window");

See how it works


Points to Note

  1. Custom card layout could also be implemented with ZML snippet in a similar way.
  2. The Items form can be hidden from customers to restrict it from appearing as a standalone component.
  1. Pages
  2. Deluge

      Create. Review. Publish.

      Write, edit, collaborate on, and publish documents to different content management platforms.

      Get Started Now


        Access your files securely from anywhere

          Zoho CRM Training Programs

          Learn how to use the best tools for sales force automation and better customer engagement from Zoho's implementation specialists.

          Zoho CRM Training
            Redefine the way you work
            with Zoho Workplace

              Zoho DataPrep Personalized Demo

              If you'd like a personalized walk-through of our data preparation tool, please request a demo and we'll be happy to show you how to get the best out of Zoho DataPrep.

              Zoho CRM Training

                Create, share, and deliver

                beautiful slides from anywhere.

                Get Started Now


                  Zoho Sign now offers specialized one-on-one training for both administrators and developers.

                  BOOK A SESSION







                              Quick LinksWorkflow AutomationData Collection
                              Web FormsEnterpriseOnline Data Collection Tool
                              Embeddable FormsBankingBegin Data Collection
                              Interactive FormsWorkplaceData Collection App
                              CRM FormsCustomer ServiceAccessible Forms
                              Digital FormsMarketingForms for Small Business
                              HTML FormsEducationForms for Enterprise
                              Contact FormsE-commerceForms for any business
                              Lead Generation FormsHealthcareForms for Startups
                              Wordpress FormsCustomer onboardingForms for Small Business
                              No Code FormsConstructionRSVP tool for holidays
                              Free FormsTravelFeatures for Order Forms
                              Prefill FormsNon-Profit
                              Intake FormsLegalMobile App
                              Form DesignerHRMobile Forms
                              Card FormsFoodOffline Forms
                              Assign FormsPhotographyMobile Forms Features
                              Translate FormsReal EstateKiosk in Mobile Forms
                              Electronic Forms
                              Drag & drop form builder

                              Notification Emails for FormsAlternativesSecurity & Compliance
                              Holiday FormsGoogle Forms alternative GDPR
                              Form to PDFJotform alternativeHIPAA Forms
                              Email FormsEncrypted Forms

                              Secure Forms

                              WCAG

                                      Create. Review. Publish.

                                      Write, edit, collaborate on, and publish documents to different content management platforms.

                                      Get Started Now




                                                        You are currently viewing the help pages of Qntrl’s earlier version. Click here to view our latest version—Qntrl 3.0's help articles.




                                                            Manage your brands on social media


                                                              • Desk Community Learning Series


                                                              • Digest


                                                              • Functions


                                                              • Meetups


                                                              • Kbase


                                                              • Resources


                                                              • Glossary


                                                              • Desk Marketplace


                                                              • MVP Corner


                                                              • Word of the Day


                                                              • Ask the Experts


                                                                Zoho Sheet Resources

                                                                 

                                                                    Zoho Forms Resources


                                                                      Secure your business
                                                                      communication with Zoho Mail


                                                                      Mail on the move with
                                                                      Zoho Mail mobile application

                                                                        Stay on top of your schedule
                                                                        at all times


                                                                        Carry your calendar with you
                                                                        Anytime, anywhere




                                                                              Zoho Sign Resources

                                                                                Sign, Paperless!

                                                                                Sign and send business documents on the go!

                                                                                Get Started Now




                                                                                        Zoho TeamInbox Resources





                                                                                                  Zoho DataPrep Demo

                                                                                                  Get a personalized demo or POC

                                                                                                  REGISTER NOW


                                                                                                    Design. Discuss. Deliver.

                                                                                                    Create visually engaging stories with Zoho Show.

                                                                                                    Get Started Now









                                                                                                                        • Related Articles

                                                                                                                        • Creating a custom layout

                                                                                                                          1. What does this page cover? Learn to design a custom layout corresponding to your business requirements for the detailed view of your records using the Canvas layout builder. Before moving ahead, you can learn more about canvas layout builder and ...
                                                                                                                        • Understanding canvas layout designer

                                                                                                                          1. What does this page cover? Learn about how you can use Canvas layout builder in Creator to design the detailed view layout of your records, corresponding to your business requirements. 2. Availability This help page is for users in Creator 5 and ...
                                                                                                                        • Use widgets to create an online mobile store

                                                                                                                          Requirement Display a card layout with each card containing mobile details like an image, company, model, and features. Any third party languages can also be used, provided the required dependencies like packages, CDN URLs etc. are included. Users ...
                                                                                                                        • Understand Pages

                                                                                                                          1. What Does This Page Cover? Learn about pages and how they are used to create user-friendly, customized dashboards for your applications. Via these dashboards, you can display dynamic elements and visually represent the data stored in Creator. 2. ...
                                                                                                                        • Manage custom layout

                                                                                                                          1. What Does This Page Cover? Learn how to name, rename, edit, and perform other customizations on the custom layouts you have designed for the detailed view of your records using the Canvas layout builder. Before moving ahead, you can learn more ...
                                                                                                                          Wherever you are is as good as
                                                                                                                          your workplace

                                                                                                                            Resources

                                                                                                                            Videos

                                                                                                                            Watch comprehensive videos on features and other important topics that will help you master Zoho CRM.



                                                                                                                            eBooks

                                                                                                                            Download free eBooks and access a range of topics to get deeper insight on successfully using Zoho CRM.



                                                                                                                            Webinars

                                                                                                                            Sign up for our webinars and learn the Zoho CRM basics, from customization to sales force automation and more.



                                                                                                                            CRM Tips

                                                                                                                            Make the most of Zoho CRM with these useful tips.



                                                                                                                              Zoho Show Resources