diff --git a/src/app/outlet-details/outlet-details.page.html b/src/app/outlet-details/outlet-details.page.html index 0f32a27..532431f 100644 --- a/src/app/outlet-details/outlet-details.page.html +++ b/src/app/outlet-details/outlet-details.page.html @@ -13,7 +13,7 @@ {{ outlet_details.rating }} -
+
diff --git a/src/app/outlet-details/outlet-details.page.ts b/src/app/outlet-details/outlet-details.page.ts index f2eb765..130e1a8 100644 --- a/src/app/outlet-details/outlet-details.page.ts +++ b/src/app/outlet-details/outlet-details.page.ts @@ -29,9 +29,7 @@ export class OutletDetailsPage implements OnInit { private location: Location, ) { } - ngOnInit() { - - } + ngOnInit() { } getFormatterDateTime(date: any, format: string) { return moment(date).format(format); @@ -40,8 +38,21 @@ export class OutletDetailsPage implements OnInit { ionViewDidEnter() { this.outlet_details = JSON.parse(this.route.snapshot.paramMap.get('outlet')); this.mallId = Number(this.route.snapshot.paramMap.get('mallId')); + this.fetchCartItems(); } + fetchCartItems() { + if (localStorage.userCart) { + this.userCart = JSON.parse(localStorage.userCart); + } else { + localStorage.userCart = JSON.stringify(this.userCart); + } + } + + ionViewDidLeave() { + localStorage.userCart = JSON.stringify(this.userCart); + } + addToCart(item: any) { this.userCart.orderedlist.push({ mall_id: this.mallId, @@ -54,8 +65,6 @@ export class OutletDetailsPage implements OnInit { total_price: item.item_price, soft_delete: false }); - - console.log(this.userCart); } isItemPresentInCart(itemId: number) {