Skip to content

Instantly share code, notes, and snippets.

@kurozumi
Created March 14, 2017 12:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kurozumi/9d805a55047dbeb1009596da99641bdd to your computer and use it in GitHub Desktop.
Save kurozumi/9d805a55047dbeb1009596da99641bdd to your computer and use it in GitHub Desktop.
【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