Basket Page - View
Login
Basket page consists of 4 main components: "Product List", "Campaigns and Discounts Area", "Cart Summary" and "Discount Form". There may be different components under the main components.
Html(Jinja)
andJavascript
are used together while creating page contents.For the
Html(Jinja)
andJavascript
side, thebasket
object contains the same properties.
Product Listing
HTML Path: templates/basket/basket-list/index.html
Js Path: templates/basket/basket-list/list.js
The html file of the product list is included in
templates/basket/index.html
in the relevant field.The
BasketList
andBasketListItem
js classes are imported undertemplates/basket/index.js
.The
BasketList
js class is called in theconstructor
method under theBasket
class intemplates/basket/index.js
.When calling class; It takes the selector of the class it is called in its constructor (ie:
this.$basketContent
) as a parameter and takes theBasketListItem
class as a parameter to its ownsetViewHolder
method .Since
BasketList
is extended fromList
class, it containssetViewHolder
method. The class passed as a parameter to thesetViewHolder
method will be the template of the list elements.
Product
HTML Path: templates/basket/basket-list/index.html
Js Path: templates/basket/basket-list/item.js
In the
BasketListItem
js class, the html template elements in which we will fill and manipulate the data must have class names in the formatjs-basket-item-{...name...}
.Rendering is done in the
render
method under theBasketListItem
js class.
Basket Summary
HTML Path: templates/basket/summary/index.html
Js Path: templates/basket/summary/index.js
The html file is included in a suitable place in
templates/basket/index.html
where you want the basket summary to be displayed.BasketSummary
js class is imported undertemplates/basket/index.js
.The
BasketSummary
js class is called in theconstructor
method under theBasket
class intemplates/basket/index.js
.When calling class; It takes as a parameter the selector (ie:
this.$basketContent
) of the class for which it is called in its constructor.In the
BasketSummary
js class, the html elements in which we will fill and manipulate the data must have class names in the formatjs-basket-summary-{...name...}
.Class selectors must be written in the
constructor
method underBasketSummary
js class.observe(basketSelector).subscribe((basket) => {...});
inconstructor
method underBasketSummary
js class; rendering is done.
Discount Form
HTML Path: templates/basket/voucher-form/index.html
Js Path: templates/basket/voucher-form/index.js
The html file should be included in a suitable place in
templates/basket/index.html
where the discount form is desired to be displayed.VoucherForm
js class is imported undertemplates/basket/index.js
.The
VoucherForm
js class is called in theconstructor`` method under the
Basketclass in
templates/basket/index.js`.When calling class; It takes as a parameter the selector (ie: ```this.$basketContent`````) of the class in which it is called in its constructor.
In the
VoucherForm
js class, the html elements on which we will work must have class names in the formatjs-basket-voucher-form-{...name...}
.Class selectors must be written in the
constructor
method under theVoucherForm
js class.Rendering is done in
observe(basketSelector).subscribe(({ voucher_code }) => {...});
structure in theconstructor
method under theVoucherForm
js class.
Campaigns and Discounts Area
HTML Path: templates/basket/upsell-and-discount-messages/index.html
Js Path: templates/basket/upsell-and-discount-messages/index.js
The html file should be included in a suitable place in "templates/basket/index.html" where discount campaigns and discounts are desired to be displayed.
UpsellAndDiscountMessages
js class is imported undertemplates/basket/index.js
.The
UpsellAndDiscountMessages
js class is called in theconstructor
method under theBasket
class intemplates/basket/index.js
.When calling class; It takes as a parameter the selector (ie:
this.$basketContent
) of the class for which it is called in its constructor.In the
UpsellAndDiscountMessages
js class, the html elements in which you will fill and manipulate the data must be found in the filetemplates/basket/upsell-and-discount-messages/index.html
.Class selectors must be written in the
constructor
method under theUpsellAndDiscountMessages
js class.Rendering is done under
observe(basketReducer).subscribe(({ basket, pending }) => {...});
in theconstructor
method under theUpsellAndDiscountMessages
js class.
Last updated
Was this helpful?