Git Product home page Git Product logo

shelf's Introduction

📢 Use this project, contribute to it or open issues to help evolve it using Store Discussion.

Shelf

⚠️ With the goal of displaying a flexible product list, the shelf and shelf.relatedProducts blocks are deprecated and now configured using the Product Summary List, the Product Summary Shelf, and the Slider Layout blocks. To learn how to configure it, please refer to Building a Shelf.

The Shelf app displays a list of products on your store pages, helping you build your shop window and work on your visual merchandising.

shelf

Configuration

  1. Add the shelf app to your theme dependencies in the manifest.json file:
  "dependencies": {
    "vtex.shelf": "1.x",
  }

Now, you can use all the blocks exported by the shelf app. See the full list below:

Block name Description
shelf https://img.shields.io/badge/-Deprecated-red Renders a list of products in the store home page.
shelf.relatedProducts https://img.shields.io/badge/-Deprecated-red Renders a list of related products in the product details page.
  1. Declare the shelf.relatedProduct in the product template (store.product) using its props. For example:
{
  "store.product": {
    "children": [
      "breadcrumb",
      "flex-layout.row#main",
      "shelf.relatedProducts"
    ]
  }
}

⚠️ Warning

Note that for hiding unavailable/out-of-stock items, there are 2 different props: hideUnavailableItems and hideOutOfStockItems. They do the same thing, but each is used by a different component: Shelf and RelatedProducts, respectively.

Shelf

Prop name Type Description Default value
category String The category ID
collection String The collection ID
orderBy Enum OrderByTopSaleDESC, OrderByPriceDESC, OrderByPriceASC, OrderByNameASC, OrderByNameDESC, OrderByReleaseDateDESC, OrderByBestDiscountDESC
hideUnavailableItems Boolean Whether out of stock items should be hidden (true) or not (false) false
paginationDotsVisibility Enum visible, hidden, mobileOnly, desktopOnly
productList ProductListSchema Product list schema. See ProductListSchema -
trackingId String Name to show in the Google Analytics. If nothing is passed it will use the name of the block instead
maxItems Number Max items

RelatedProducts

Prop name Type Description Default value
recommendation enum Type of recommendations that will be displayed on the shelf. Possible values: similars, suggestions, and accessories (these depend on the product information given in the Admin Catalog); and view, buy, and viewandBought (these are automatically generated according to the activity of the store). similars
groupBy enum Defines if you are ot nog going to group your recommendations by: PRODUCT (only display individual products and not SKUs, limited by 12 products) or NONE (if you want to display all registered SKUs, limited by 50 products). PRODUCT
hideOutOfStockItems boolean Whether out of stock items should be hidden: (true) or (false). false
productList ProductListSchema Product list schema. See ProductListSchema. -

ProductListSchema:

Prop name Type Description Default value
maxItems number Maximum number of items to be displayed on the related product shelf. 10
scroll enum Slide transition scroll type. Possible values: BY_PAGE, and ONE_BY_ONE. BY_PAGE
arrows boolean Whether the arrows should be displayed on the shelf (true) or not (false). true
showTitle boolean Whether a title should be displayed on the product-related shelf (true) or not (false). true
titleText string Related product shelf title. null
gap enum Space between items being displayed. Possible values are: ph0, ph3,ph5, and ph7. ph3
minItemsPerPage number Minimum number of items per shelf slides. This prop defines how many items will be displayed on the related product shelf, even in the smallest screen size. Its value can be a float, which means that you can choose a multiple of 0.5 to indicate that you want to show a peek of the next slide on the shelf. 1
itemsPerPage number Maximum number of items per shelf slides. This prop defines how many items will be displayed on the related product shelf, even in the largest screen size. Its value can be a float, which means that you can choose a multiple of 0.5 to indicate that you want to show a peek of the next slide on the shelf. 5
summary object Schema declaring the desired related product shelf items. This prop object must contain the product-summary.shelf block props. undefined

Customization

To apply CSS customizations to this and other blocks, follow the instructions in Using CSS Handles for store customization.

CSS Handles
relatedProducts

⚠️ The CSS Handles list above refers to the shelf.relatedProducts block. Since the shelf block is deprecated, your shelf customization must be done using the CSS Handles available for the Product Summary List, the Product Summary Shelf, and the Slider Layout blocks.

Contributors ✨

Thanks goes to these wonderful people (emoji key):


Sahan Jayawardana

💻

Lucas Pacheco

💻

This project follows the all-contributors specification. Contributions of any kind welcome!

shelf's People

Contributors

amoreira avatar arthursampaio avatar claudiu-iviteb avatar claudivanfilho avatar estacioneto avatar guerreirobeatriz avatar gugabribeiro avatar guifromrio avatar gustavorosolem avatar iaronaraujo avatar italo-batista avatar jeymisson avatar jgfidelis avatar juanalmeida12 avatar kaisermann avatar klynger avatar klzns avatar koz avatar lbebber avatar lucasecdb avatar mariana-caetano avatar rerissondaniel avatar rodrigomuniz avatar tamorim avatar theomoura avatar thiagomurakami avatar tlgimenes avatar victorhmp avatar vtex-io-ci-cd[bot] avatar vwraposo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

shelf's Issues

Possibility of shelf carousel to be autoplay.

Expected Behavior

Send a props auto play as boolean to enable / disable the function.

Current Behavior

we don`t have this function.

Possible Solution

Since they already use the slick it is enough to persist this props until the slider of store-components.

Possibility to orderBy Product Cluster's Ordination (Collection)

Should be great to have the possibility to have an option on the List Ordination field to set the same ordination from the product cluster's (Collection) configuration.

User Stories

As an e-commerce Admin user, using the Site Editor, I want to select a product list block, set up a collection Id and choose the ordination to be the same as the collection's ordination.

Add title prop to ActionBar

Now the ActionBar needs to receive the title prop for title display:

<ActionBar title={this.props.title} onSave={this.handleSave.bind(this)}/>

@BrenoC

Sorting related products

We need to be able to order the products that are similar, or suggested in some particular way. how can I do? Thank you

Unavailable product not properly ordered on shelf

Unavailable items have the priced marked as 00,00 so when the parameter OrderByPriceASC is used, the first items to be displayed are unavailable.

Expected Behavior

Unavailable items should be displayed after the rest of the search results.

Current Behavior

Unavailable items are being displayed before the rest of the search results, due to their price being loaded as zero.

Steps to Reproduce (for bugs)

Create a shelf with the code below:

"shelf#ofertas": {
    "props": {
      "orderBy": "OrderByPriceAsc",
      "productList": {
        "maxItems": 4,
        "itemsPerPage": 4,
        "scroll": "BY_PAGE",
        "arrows": false,
        "titleText": "O patrão tá maluco",
        "summary": {
          "isOneClickBuy": false,
          "showBadge": true,
          "badgeText": "OFF",
          "buyButtonText": "Leva agora meu!",
          "displayBuyButton": "displayButtonHover",
          "showCollections": false,
          "showListPrice": true,
          "showLabels": true,
          "showInstallments": true,
          "showSavings": true,
          "name": {
            "showBrandName": true,
            "showSku": true,
            "showProductReference": true
          }
        }
      }
    }
  }

Context

The expected behavior is to display the results currently available, followed by the unavailable items. Displaying unavailable products can be frustrating to the customer.

Your Environment

This test was performed in the workspace novaloja--pilateslovers.myvtex.com.

image

Hide unavailable products

Is there any possibility to hide unavailable products in the shelf.product component?

I saw that list-context.product-list has the prop that helps me (hideUnavailableItems), but it doesn't work for shelf.product.

Or is there any option to build a shelf containing similar products using list-context.product-list component?

Storefront settings not working

If I configure "items per page" on Storefront for the shelf (eg.: Related Products on product page), it doesn't render like that on the front-end, and it has weird behaviour. It usually shows 1 or 2 items per page (even if there are more than that shown), instead of the 3/4/5 that can be set per page.

Expected Behaviour

Slick slider should follow the settings for the app on Storefront.

Current Behaviour

I think because of adaptToScreen, slick doesn't respect the other settings and shows 1 or 2 items, and that behaviour is weird too because on the same screen width it alternates between them.

adaptToScreen

Possible Solution

Remove adaptToScreen and implement responsiveness in another way?

Steps to Reproduce (for bugs)

On storefront product page, create a configuration for "Related Products" with "Items per page" option o layout tab

Context

screenshot at nov 12 10-40-40
screenshot at nov 12 10-40-59

Your Environment

  • Version used: latest
  • Environment name and version (e.g. Chrome 39, node.js 5.4): Chrome Version 70.0.3538.77 (Official Build) (64-bit)
  • Operating System and version (desktop or mobile): macOS High Sierra
  • Link to your project:

Create a shelf without using slider?

Is it possible to create a shelf without creating a slider for the products? I would like to show all the products of a shelf at once so I don't have to navigate throught slides.

Send productImpressions in batch instead of sending for each product

Today productImpression is being sent separately for each product on the shelf. For each product we trigger a hit to GA and eventually that can exceed a limit stablished in the contract. To save hits we should send them in batches so we hit GA fewer times.

We should beware that there's a limit of 8kb for a hit, that can happen if we send more than 50 products in a hit, for example. One solution for that is to send only productImpressions of products visible in the screen.

Possible Solution

We might use context in the Shelf component to listen to events triggered by each product and then trigger the event after some miliseconds.

We could also use intersectionobserver to trigger only events to products visible on the screen.

Steps to Reproduce (for bugs)

Open a store with a shelf and see that productImpression is sent N times.

Shelf bug report

Shelf bug report

Current Behavior

when the shelf is loaded several react errors appear on the console
** main problem is the infinite loop

Print: https://share.getcloudapp.com/12u1xexB

Steps to Reproduce (for bugs)

  1. go to https://shop.samsung.com.ar
  2. open dev tools
  3. check the dev tools console

Possible Solution

check that line of code: https://github.com/vtex-apps/shelf/blob/master/react/components/ShelfContent.js#L65

Your Environment

  • Version used: 1.34.4
  • Environment name and version: Version 79.0.3945.130
  • Operating System and version (desktop or mobile): windows 10 / windows 7
  • Link to your project: https://shop.samsung.com.ar

Shelf bug report

Describe the bug
On Mobile devices, when the home page is loaded the produtcs occupy the full width of the screen. But when you swipe to the next product the "product-summary" srinks.

To Reproduce
Steps to reproduce the behavior:

  1. Using a mobile device or on inspect mode (using a desktop) go to https://demoio--imaginarium.myvtex.com/
  2. Swipre the first shelf
  3. See error

Expected behavior
It is expected that the shelf maintain the original size, full width

Screenshots
Initial State
shelf_initial_state

Error State
shelf_error_state

Desktop (please complete the following information):

  • OS: All
  • Browser: All

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.