バージョン選択

フォーラム

メニュー

オンライン状況

71 人のユーザが現在オンラインです。 (62 人のユーザが フォーラム を参照しています。)
登録ユーザ: 0
ゲスト: 71
もっと...

サイト内検索

質問 > 管理機能 > 商品種別エラー

管理機能

新規スレッドを追加する

スレッド表示 | 新しいものから 前のトピック | 次のトピック | 下へ
投稿者 スレッド
acxAura
投稿日時: 2022/10/12 14:57
対応状況: 開発中
半人前
登録日: 2022/10/6
居住地:
投稿: 17
商品種別エラー
▼テンプレート
[EC-CUBE] 4.1.2

お世話になっております
eccubeで色々なパーツを組み合わせて商品を作ろうと思っています
流れは
Parts A table / Parts B table / Parts C tableから選んだパーツをcustomというテーブルに入れて、customのidをproduct codeに入れた新しいentityを生成して直接にdtb_product_classに入れました
それで、ちゃんとカートに入れられました
でも、商品種別が違う商品が先にカートにあったら、

An exception occurred while executing 'INSERT INTO dtb_cart (cart_key, pre_order_id, total_price, delivery_fee_total, sort_no, create_date, update_date, add_point, use_point, customer_id, discriminator_type) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)' with params ["f7yLmv3BIhMfvbKRirBR7NswtT6QZdDi_2", null, null, null, null, "2022-10-12 03:10:23", "2022-10-12 03:10:23", "0", "0", null, "cart"]:

SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'total_price' cannot be null

こんなエラーが出てます
二つのカートがあったら、二つ目のカートのtotal_priceがnullになっています
$errorMessages = [];
         $event = new EventArgs(
            [
                'Product' => $Product,
            ],
            $request
         );
        $this->eventDispatcher->dispatch(EccubeEvents::FRONT_PRODUCT_CART_ADD_INITIALIZE, $event);

         $this->cartService->addProduct($ring_product_class->getId()); 

         $Cart = $this->cartService->getCart();
         $result = $this->purchaseFlow->validate($Cart, new PurchaseContext($Cart, $this->getUser()));
         
         
         if($result->hasError()){
            $this->cartService->removeProduct($ring_product_class->getId());
            foreach ($result->getErrors() as $error) {
               $errorMessages[] = $error->getMessage();
           }
            foreach ($result->getWarning() as $warning) {
               $errorMessages[] = $warning->getMessage();
            }

         }

         $this->cartService->save();

         $event = new EventArgs(
            [
                'Product' => $Product,
            ],
            $request
         );
         $this->eventDispatcher->dispatch(EccubeEvents::FRONT_PRODUCT_CART_ADD_COMPLETE, $event);
         


これが作ったproduct_classをカートに入れるためのコードです
addProductの後
dump($this->cartService->getCarts())でチェックしてみましたが、二つ目のカートのtotal priceは商品が中にあるのにnullでした
acxAura
投稿日時: 2022/10/12 19:24
対応状況: −−−
半人前
登録日: 2022/10/6
居住地:
投稿: 17
Re: 商品種別エラー
SaleTypeCartAllocator.phpのallocateをreturn 1にして、カートを一つ商品種別に構わず一つのカートを生成することで解決しました
スレッド表示 | 新しいものから 前のトピック | 次のトピック | トップ


 



ログイン


EC-CUBE公式 Amazon Payプラグイン

統計情報

総メンバー数は88,841名です
総投稿数は109,985件です

投稿数ランキング

1
seasoft
7367
2
468
3217
3
AMUAMU
2712
4
nanasess
2313
5
umebius
2085
6
yuh
1819
7
h_tanaka
1646
8
red
1570
9
mcontact
1291
10
tsuji
958
11
fukap
907
12
shutta
835
13
tao_s
799
14 ramrun 789
15 karin 689
16 sumida 641
17
homan
633
18 DELIGHT 572
19
patapata
502
20
flealog
485


ネットショップの壺

EC-CUBEインテグレートパートナー

Copyright© EC-CUBE CO.,LTD. All Rights Reserved.