|
@@ 311-345 (lines=35) @@
|
| 308 |
|
* @param $productClassId |
| 309 |
|
* @return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response |
| 310 |
|
*/ |
| 311 |
|
public function remove(Application $app, Request $request, $productClassId) |
| 312 |
|
{ |
| 313 |
|
$this->isTokenValid($app); |
| 314 |
|
|
| 315 |
|
log_info('カート削除処理開始', array('product_class_id' => $productClassId)); |
| 316 |
|
|
| 317 |
|
// FRONT_CART_REMOVE_INITIALIZE |
| 318 |
|
$event = new EventArgs( |
| 319 |
|
array( |
| 320 |
|
'productClassId' => $productClassId, |
| 321 |
|
), |
| 322 |
|
$request |
| 323 |
|
); |
| 324 |
|
$app['eccube.event.dispatcher']->dispatch(EccubeEvents::FRONT_CART_REMOVE_INITIALIZE, $event); |
| 325 |
|
|
| 326 |
|
$productClassId = $event->getArgument('productClassId'); |
| 327 |
|
$app['eccube.service.cart']->removeProduct($productClassId)->save(); |
| 328 |
|
|
| 329 |
|
log_info('カート削除処理完了', array('product_class_id' => $productClassId)); |
| 330 |
|
|
| 331 |
|
// FRONT_CART_REMOVE_COMPLETE |
| 332 |
|
$event = new EventArgs( |
| 333 |
|
array( |
| 334 |
|
'productClassId' => $productClassId, |
| 335 |
|
), |
| 336 |
|
$request |
| 337 |
|
); |
| 338 |
|
$app['eccube.event.dispatcher']->dispatch(EccubeEvents::FRONT_CART_REMOVE_COMPLETE, $event); |
| 339 |
|
|
| 340 |
|
if ($event->hasResponse()) { |
| 341 |
|
return $event->getResponse(); |
| 342 |
|
} |
| 343 |
|
|
| 344 |
|
return $app->redirect($app->url('cart')); |
| 345 |
|
} |
| 346 |
|
|
| 347 |
|
/** |
| 348 |
|
* カートに入っている商品の個数を1増やす. |
|
@@ 489-523 (lines=35) @@
|
| 486 |
|
* @param $cart_no |
| 487 |
|
* @return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response |
| 488 |
|
*/ |
| 489 |
|
public function removeCartNo(Application $app, Request $request, $cart_no) |
| 490 |
|
{ |
| 491 |
|
$this->isTokenValid($app); |
| 492 |
|
|
| 493 |
|
log_info('カート削除処理開始', array('cart_no' => $cart_no)); |
| 494 |
|
|
| 495 |
|
// FRONT_CART_REMOVE_INITIALIZE |
| 496 |
|
$event = new EventArgs( |
| 497 |
|
array( |
| 498 |
|
'cart_no' => $cart_no, |
| 499 |
|
), |
| 500 |
|
$request |
| 501 |
|
); |
| 502 |
|
$app['eccube.event.dispatcher']->dispatch(EccubeEvents::FRONT_CART_REMOVE_INITIALIZE, $event); |
| 503 |
|
|
| 504 |
|
$cart_no = $event->getArgument('cart_no'); |
| 505 |
|
$app['eccube.service.cart']->removeCartNo($cart_no)->save(); |
| 506 |
|
|
| 507 |
|
log_info('カート削除処理完了', array('cart_no' => $cart_no)); |
| 508 |
|
|
| 509 |
|
// FRONT_CART_REMOVE_COMPLETE |
| 510 |
|
$event = new EventArgs( |
| 511 |
|
array( |
| 512 |
|
'cart_no' => $cart_no, |
| 513 |
|
), |
| 514 |
|
$request |
| 515 |
|
); |
| 516 |
|
$app['eccube.event.dispatcher']->dispatch(EccubeEvents::FRONT_CART_REMOVE_COMPLETE, $event); |
| 517 |
|
|
| 518 |
|
if ($event->hasResponse()) { |
| 519 |
|
return $event->getResponse(); |
| 520 |
|
} |
| 521 |
|
|
| 522 |
|
return $app->redirect($app->url('cart')); |
| 523 |
|
} |
| 524 |
|
|
| 525 |
|
/** |
| 526 |
|
* カートに商品を個数を指定して設定する. |