Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
【EC-CUBE3】カートページで数量を増やした後の在庫数を取得するイベント
<?php
/*
* This file is part of the Sample
*
* Copyright (C) 2017 サンプルプラグイン for EC-CUBE3
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Plugin\Sample;
use Eccube\Application;
use Eccube\Event\EventArgs;
class SampleEvent
{
/** @var \Eccube\Application $app */
private $app;
public function __construct(Application $app)
{
$this->app = $app;
}
/**
* 数量を増やした時
*
* @param EventArgs $event
*/
public function onFrontCartUpComplete(EventArgs $event)
{
$productClassId = $event->getArgument('productClassId');
$quantity = $this->app['eccube.service.cart']->getProductQuantity($productClassId);
echo $quantity;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment