2019-03-19 06:18:32 +00:00
|
|
|
$(() => {
|
|
|
|
class ProductListing {
|
|
|
|
constructor() {
|
2021-05-17 15:14:41 +00:00
|
|
|
let me = this;
|
2021-05-12 19:52:05 +00:00
|
|
|
let is_item_group_page = $(".item-group-content").data("item-group");
|
2021-05-17 15:14:41 +00:00
|
|
|
this.item_group = is_item_group_page || null;
|
2021-05-12 19:52:05 +00:00
|
|
|
|
2021-06-29 05:52:27 +00:00
|
|
|
let view_type = localStorage.getItem("product_view") || "List View";
|
2021-05-24 20:05:22 +00:00
|
|
|
|
2021-06-01 07:14:49 +00:00
|
|
|
// Render Product Views, Filters & Search
|
2022-01-31 18:33:08 +00:00
|
|
|
new erpnext.ProductView({
|
|
|
|
view_type: view_type,
|
|
|
|
products_section: $('#product-listing'),
|
|
|
|
item_group: me.item_group
|
2021-05-12 19:52:05 +00:00
|
|
|
});
|
|
|
|
|
2021-03-11 15:54:47 +00:00
|
|
|
this.bind_card_actions();
|
2019-03-19 06:18:32 +00:00
|
|
|
}
|
|
|
|
|
2021-03-11 15:54:47 +00:00
|
|
|
bind_card_actions() {
|
2021-08-26 13:44:10 +00:00
|
|
|
erpnext.e_commerce.shopping_cart.bind_add_to_cart_action();
|
|
|
|
erpnext.e_commerce.wishlist.bind_wishlist_action();
|
2021-03-14 11:58:49 +00:00
|
|
|
}
|
2019-03-19 06:18:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
new ProductListing();
|
|
|
|
});
|