質問 > フロント機能 > カート情報の取得箇所について |
フロント機能
フラット表示 | 前のトピック | 次のトピック |
投稿者 | スレッド |
---|---|
yoshiaki |
投稿日時: 2016/6/29 13:45
対応状況: −−−
|
半人前 登録日: 2016/6/22 居住地: 投稿: 11 |
カート情報の取得箇所について 初歩的なことなのかもしれませんが、まだ勉強し始めでいろいろと調べたりソースを追いながらになってしまうため認識の誤り等があった場合はヒントなどをいただければと思っています。
商品を選択するとカートに、選択した商品が入っているかと思うのですが その商品の情報というのはセッションが持っているという形でしょうか? src\Eccube\ControllerProviderのFrontControllerProvider.phpから // cart $c->match('/cart', '\Eccube\Controller\CartController::index')->bind('cart'); $c->post('/cart/add', '\Eccube\Controller\CartController::add')->bind('cart_add'); $c->put('/cart/up/{productClassId}', '\Eccube\Controller\CartController::up')->bind('cart_up')->assert('productClassId', '\d+'); $c->put('/cart/down/{productClassId}', '\Eccube\Controller\CartController::down')->bind('cart_down')->assert('productClassId', '\d+'); // setquantity deprecated since 3.0.0, to be removed in 3.1 $c->put('/cart/setQuantity/{productClassId}/{quantity}', '\Eccube\Controller\CartController::setQuantity')->bind('cart_set_quantity')->assert('productClassId', '\d+')->assert('quantity', '\d+'); $c->put('/cart/remove/{productClassId}', '\Eccube\Controller\CartController::remove')->bind('cart_remove')->assert('productClassId', '\d+'); $c->match('/cart/buystep', '\Eccube\Controller\CartController::buystep')->bind('cart_buystep'); このようにカートに関する部分を確認し、CartController.phpの各メソッドが呼ばれるということがわかり カート画面を見る場合はcontrollerのindexメソッドということも理解ができました。 indexメソッドの最初で $Cart = $app['eccube.service.cart']->getCart(); このように書かれているため、 CartService.phpのgetCartメソッドを呼び出し処理が行われるかと思います。 この、CartService.phpのコンストラクタ部分にて $this->app = $app; $this->session = $app['session']; $this->entityManager = $app['orm.em']; if ($this->session->has('cart')) { $this->cart = $this->session->get('cart'); } else { $this->cart = new \Eccube\Entity\Cart(); } $this->loadProductClassFromCart(); $this->BaseInfo = $app['eccube.repository.base_info']->get(); この部分でセッションからカートの情報をとってきていると思うのですが認識はあっているでしょうか? お願いいたします。 |
フラット表示 | 前のトピック | 次のトピック |
題名 | 投稿者 | 日時 |
---|---|---|
» カート情報の取得箇所について | yoshiaki | 2016/6/29 13:45 |
Re: カート情報の取得箇所について | tacky | 2016/6/29 15:21 |
Re: カート情報の取得箇所について | yoshiaki | 2016/6/29 15:40 |