Skip to content

Latest commit

 

History

History

products-dynamic

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Dynamic Products Example

This example demonstrates how to link components together to create a fully featured store with products, categories and a shopping cart.

Dynamic Products

The Products example demonstrates how you can link a Product List and a Product component together, so that clicking an item in the list leads you to a full product page.

How it works

  • Product List has the data-reflow-product-link attribute set to ./product.html?product={id}. This instructs Reflow to wrap each list item in a link, and replace the {id} placeholder with the actual product id.
  • The product page looks for the product query parameter, and sets the data-reflow-product attribute on the tag on page load.

Dynamic Categories

In the Categories example you can learn how to connect a Category List and a Product List component together. This creates a navigation menu for browsing all categories and products from the store.

How it works

  • Category List has the data-reflow-category-link attribute set to ./index.html?category={id} (the product list example page). This instructs Reflow to wrap each list item in a link, and replace the {id} placeholder with the actual category id.
  • The product list page looks for the category query parameter, and sets the data-reflow-category attribute on the tag on page load. It then lists all products from the specified category.

Shopping Cart

The Cart example displays a shopping cart where you can see all the Products that were added for purchase.

How it works

  • The Product component has the data-reflow-shoppingcart-url attribute set to ./cart.html.
  • This links the components together, so that when the Add to Cart button is pressed products are correctly added for purchase.