質問 > 管理機能 > 商品新規登録でエラーになる |
管理機能
フラット表示 | 前のトピック | 次のトピック |
投稿者 | スレッド |
---|---|
Rights |
投稿日時: 2020/10/23 14:23
対応状況: −−−
|
一人前 登録日: 2019/3/12 居住地: 投稿: 99 |
商品新規登録でエラーになる 商品情報登録でカテゴリー選択をして登録するロジックを流用して、別の属性情報を登録するロジック追加しましたが、既存の商品情報では追加属性情報の登録・変更はできますが、新規で商品情報を登録する際にエラーとなります。
/app/Customize/Controller/Admin/Product 既存のProductController.phpを複製してカスタマイズ /app/Customize/Entity/ ProductTrait.php 追加属性情報用のEntityを下記ファイルを流用して作成 Category.php ProductCategory.php /app/Customize/Repository/ 追加属性情報用のRepositoryを下記ファイルを流用して作成 CategoryRepository.php ProductCategoryRepository.php /app/Customize/Form/Type /Admin 追加属性情報用のTypeを下記ファイルを流用して作成 CategoryType.php /app/Customize/Form/Extension 商品登録画面の拡張 ProductTypeExtension.php /app/template/admin/Product テンプレートの変更 product.twig 既存商品の追加属性情報の選択追加・変更 → 〇 新規商品の登録 → 商品登録のナビゲーションをクリックした時点でエラー ProductController.php public function edit(Request $request, $id = null, RouterInterface $router, CacheUtil $cacheUtil) (途中省略) $categories = []; $ProductCategories = $Product->getProductCategories(); foreach ($ProductCategories as $ProductCategory) { /* @var $ProductCategory \Eccube\Entity\ProductCategory */ $categories[] = $ProductCategory->getCategory(); } $form['Category']->setData($categories); // ▼ 追加 $delivery_classes = []; $ProductDeliveryClasses = $Product->getProductDeliveryClasses(); foreach ($ProductDeliveryClasses as $ProductDeliveryClass) { ← Warning: Invalid argument supplied for foreach() /* @var $ProductDeliveryClass \Customize\Entity\ProductDeliveryClass */ $delivery_classes[] = $ProductDeliveryClass->getDeliveryClass(); } $form['DeliveryClass']->setData($delivery_classes); // ▲ 追加 商品に関連づけた追加の属性情報が取得できていないため(新規なので取得できていない)だと考えますが、この場合のロジックを実装している箇所が見当たりません。 何か参考になる情報があればご教示ください。 |
フラット表示 | 前のトピック | 次のトピック |
題名 | 投稿者 | 日時 |
---|---|---|
» 商品新規登録でエラーになる | Rights | 2020/10/23 14:23 |
Re: 商品新規登録でエラーになる | 468 | 2020/10/23 18:24 |
Re: 商品新規登録でエラーになる | Rights | 2020/10/23 21:50 |
Re: 商品新規登録でエラーになる | Rights | 2020/11/6 18:54 |