biz9-store 1.0.49 → 1.0.51

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/biz9_config +1 -1
  2. package/index.js +15 -2
  3. package/package.json +3 -3
package/biz9_config CHANGED
@@ -1,4 +1,4 @@
1
- VERSION='1.0.49'
1
+ VERSION='1.0.51'
2
2
  TITLE='BiZ9-Store'
3
3
  REPO='git@github.com:biz9framework/biz9-store.git'
4
4
  BRANCH='main'
package/index.js CHANGED
@@ -65,12 +65,12 @@ class Store_Table {
65
65
  static CART_ITEM="cart_item_biz";
66
66
  static CART_SUB_ITEM="cart_sub_item_biz";
67
67
  //order
68
- static ORDER_PAYMENT = 'order_payment_biz';
68
+ static ORDER_PAYMENT='order_payment_biz';
69
69
  static ORDER="order_biz";
70
70
  static ORDER_ITEM="order_item_biz";
71
71
  static ORDER_SUB_ITEM="order_sub_item_biz";
72
72
  //product
73
- static PRODUCT = 'product_biz';
73
+ static PRODUCT='product_biz';
74
74
  }
75
75
  class Store_Stat {
76
76
  static POST_VIEW="post_view";
@@ -82,10 +82,14 @@ class Store_Field {
82
82
  static CART_NUMBER = 'cart_number';
83
83
  static CART_ID = 'cart_id';
84
84
  static CART_ITEM_ID = 'cart_item_id';
85
+ static CART_SUB_ITEMS = 'cart_sub_items';
86
+ static CART_ITEMS = 'cart_items';
85
87
  //order
86
88
  static ORDER_NUMBER = 'order_number';
87
89
  static ORDER_ID = 'order_id';
88
90
  static ORDER_ITEM_ID = 'order_item_id';
91
+ static ORDER_SUB_ITEMS = 'order_sub_items';
92
+ static ORDER_ITEMS = 'order_items';
89
93
  //other
90
94
  static COST = 'cost';
91
95
  static GRAND_TOTAL = 'grand_total';
@@ -159,6 +163,12 @@ class Cart_Logic {
159
163
  ];
160
164
  };
161
165
  static get_total = (cart) => {
166
+ if(!cart){
167
+ cart = {};
168
+ }
169
+ if(!cart.cart_items.length){
170
+ cart.cart_items = [];
171
+ }
162
172
  let grand_total = 0;
163
173
  cart.cart_items.forEach(cart_item => {
164
174
  cart_item.sub_total = 0;
@@ -166,6 +176,9 @@ class Cart_Logic {
166
176
  cart_item.sub_total = (cart_item.sub_total + cart_item.cost) * cart_item.quanity;
167
177
  grand_total = grand_total + cart_item.sub_total;
168
178
  }
179
+ if(!cart_item.cart_sub_items){
180
+ cart_item.cart_sub_items = [];
181
+ }
169
182
  cart_item.cart_sub_items.forEach(cart_sub_item => {
170
183
  cart_sub_item.sub_total = 0;
171
184
  if(!isNaN(cart_sub_item.cost)){
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "biz9-store",
3
- "version": "1.0.49",
3
+ "version": "1.0.51",
4
4
  "description": "** Description",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -10,9 +10,9 @@
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "async": "^3.2.6",
13
- "biz9-data-logic": "^11.7.40",
13
+ "biz9-data-logic": "^11.7.44",
14
14
  "biz9-scriptz": "^5.8.30",
15
- "biz9-utility": "^4.7.53"
15
+ "biz9-utility": "^4.7.57"
16
16
  },
17
17
  "repository": {
18
18
  "type": "git",