瀏覽代碼

add cart data pc

NoteStar 5 年之前
父節點
當前提交
5a52053029

+ 2 - 0
vendor/fancyecommerce/fecshop/app/appfront/modules/Checkout/controllers/CartController.php

@@ -48,6 +48,7 @@ class CartController extends AppfrontController
         $custom_option = Yii::$app->request->post('custom_option');
         $product_id = Yii::$app->request->post('product_id');
         $qty = Yii::$app->request->post('qty');
+        $customsize = Yii::$app->request->post('customsize');
         //$custom_option  = \Yii::$service->helper->htmlEncode($custom_option);
         $product_id = \Yii::$service->helper->htmlEncode($product_id);
         $qty = \Yii::$service->helper->htmlEncode($qty);
@@ -63,6 +64,7 @@ class CartController extends AppfrontController
                 'product_id' => $product_id,
                 'qty'        =>  $qty,
                 'custom_option_sku' => $custom_option_sku,
+                'customsize' => addslashes( $customsize ),
             ];
             $innerTransaction = Yii::$app->db->beginTransaction();
             try {

+ 4 - 0
vendor/fancyecommerce/fecshop/services/cart/QuoteItem.php

@@ -76,6 +76,9 @@ class QuoteItem extends Service
         if (isset($item['custom_option_sku']) && !empty($item['custom_option_sku'])) {
             $where['custom_option_sku'] = $item['custom_option_sku'];
         }
+        if (isset($item['customsize']) && !empty($item['customsize'])) {
+            $where['customsize'] = $item['customsize'];
+        }
         /** @var \fecshop\models\mysqldb\cart\Item $item_one */
         $item_one = $this->_itemModel->find()->where($where)->one();
         if ($item_one['cart_id']) {
@@ -91,6 +94,7 @@ class QuoteItem extends Service
             $item_one->created_at = time();
             $item_one->updated_at = time();
             $item_one->product_id = $item['product_id'];
+            $item_one->customsize = $item['customsize'];
             $item_one->qty = $item['qty'];
             $item_one->active = $this->itemDefaultActiveStatus;
             $item_one->custom_option_sku = ($item['custom_option_sku'] ? $item['custom_option_sku'] : '');