Documentation
Feedback
Guides
Learning Center

Learning Center
Learning Center
Quick View
View in Portuguese
This content was migrated from the VTEX Learning Center and is no longer being actively maintained. For the most accurate and up-to-date information, please check the official documentation.

Introduction

We will follow the concepts learned in the previous step and go a little deeper to learn how to build the behavior of Quick View on a product shelf.

Activity

  1. Add a shelf to your home page:

_18
{
_18
"store.home": {
_18
"blocks": [
_18
...
_18
+ "list-context.product-list"
_18
]
_18
},
_18
+ "list-context.product-list": {
_18
+ "blocks": ["product-summary.shelf"],
_18
+ "children": ["slider-layout"]
_18
+ },
_18
+ "product-summary.shelf": {
_18
+ "children": [
_18
+ "product-summary-name",
_18
+ "product-selling-price"
_18
+ ]
_18
+ }
_18
}

  1. In the product-summary add a trigger for the modal:

_10
{
_10
...
_10
"product-summary.shelf": {
_10
"children": [
_10
+ "modal-trigger#quickview",
_10
"product-summary-name",
_10
"product-selling-price"
_10
]
_10
}
_10
}

  1. So, let's make the trigger for the modal the product image and define that we will use a layout:

_13
{
_13
...
_13
"product-summary.shelf": {
_13
"children": [
_13
"modal-trigger#quickview",
_13
"product-summary-name",
_13
"product-selling-price"
_13
]
_13
},
_13
+ "modal-trigger#quickview": {
_13
+ "children": ["product-summary-image", "modal-layout#quickview"]
_13
+ }
_13
}

  1. To close, let's define a simple modal with some product options:

_12
{
_12
...
_12
+ "modal-layout#quickview": {
_12
+ "children": [
_12
+ "product-summary-name",
_12
+ "product-images",
_12
+ "product-summary-sku-selector",
_12
+ "product-summary-quantity",
_12
+ "add-to-cart-button"
_12
+ ]
_12
+ }
_12
}

The result, then, should be:

{"base64":"  ","img":{"width":752,"height":484,"type":"gif","mime":"image/gif","wUnits":"px","hUnits":"px","length":4823726,"url":"https://user-images.githubusercontent.com/18701182/90278764-585c3d00-de3e-11ea-8fa9-491a1cfd6001.gif"}}

Answer sheet

See answer sheet for home.jsonc
home.jsonc

_28
{
_28
"store.home": {
_28
"blocks": ["list-context.product-list"]
_28
},
_28
"list-context.product-list": {
_28
"blocks": ["product-summary.shelf"],
_28
"children": ["slider-layout"]
_28
},
_28
"product-summary.shelf": {
_28
"children": [
_28
"modal-trigger#quickview",
_28
"product-summary-name",
_28
"product-selling-price"
_28
]
_28
},
_28
"modal-trigger#quickview": {
_28
"children": ["product-summary-image", "modal-layout#quickview"]
_28
},
_28
"modal-layout#quickview": {
_28
"children": [
_28
"product-summary-name",
_28
"product-images",
_28
"product-summary-sku-selector",
_28
"product-summary-quantity",
_28
"add-to-cart-button"
_28
]
_28
}
_28
}

On this page