Custom card layout for e-commerce app

Custom card layout for e-commerce app


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 Link Name

Field Type

Field Name

Field Link Name



Single Line







































(Existing Form)





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:<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("<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("<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

    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

                        Still can't find what you're looking for?

                        Write to us:



                          Manage your brands on social media

                              Zoho Marketing Automation

                                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 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

                                                                                          • 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 ...
                                                                                          • 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 ...
                                                                                          • Customize tablet layout

                                                                                            Customize your page layout, for a tablet view. You can set a compact layout or retain the original page layout while accessing the page from your tablet. The following are the steps to customize the page layout for tablet: Go to the Design view of ...
                                                                                          • Create 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 ...
                                                                                          • Customized search component for report data, using pages

                                                                                            Requirement             Provide a search component for users to search for the required data. Data is fetched from reports based on the search keyword. Use Case   A library or a book management system wants to allow for searching. Any customer who ...
                                                                                          Wherever you are is as good as
                                                                                          your workplace



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


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


                                                                                            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