Skip to content

Instantly share code, notes, and snippets.

@kurozumi
Last active Mar 14, 2017
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 onFrontProductDetailComplete(EventArgs $event)
{
$form = $event->getArgument('form');
$addCartData = $form->getData();
$quantity = $this->app['eccube.service.cart']->getProductQuantity($addCartData["product_class_id"]);
echo $quantity;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment