nitra / e-commerce-site-storetiresbundle
此包已被弃用,不再维护。未建议替代包。
商店轮胎包
dev-master
2015-11-10 09:19 UTC
This package is auto-updated.
Last update: 2018-04-08 15:38:25 UTC
README
描述
主要互联网商店包。将商店数据记录到缓存中,订单处理,基本模板。
连接
要连接此模块到项目,需要
- composer.json:
{
...
"require": {
...
"nitra/e-commerce-site-storebundle": "dev-master",
...
}
...
}
- app/AppKernel.php:
<?php
//...
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;
class AppKernel extends Kernel
{
//...
public function registerBundles()
{
//...
$bundles = array(
//...
new Nitra\StoreBundle\NitraStoreBundle(),
//...
);
//...
return $bundles;
}
//...
}
设置
parameters.yml
- 订单处理时发送电子邮件通知
- 经理 - send_email_order_manager: true|false
- 客户 - send_email_order_buyer: true|false
config.yml
#.....
nitra_store:
cart_products_group:
fields: []
anti_bot:
enabled: true
field_name: __antibot__
#.....
- cart_products_group - 设置购物车中商品分组。为保证分组字段正确工作,这些字段必须是 必需的。
- fields - 分组字段,默认无分组,指定为 fields: [ getModel, getColor ]
- anti_bot - 防止机器人设置
- enabled - 是否启用保护
- field_name - 隐藏字段的名称
如何在控制器中为特定action禁用防止机器人保护
这通过添加注释 `
@AntiBot(check=false)`
实现
示例
<?php
namespace Nitra\YourBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Nitra\StoreBundle\Annotations\AntiBot;
class DefaultController extends Controller
{
//...
/**
* @Route("/", name="index")
* @Template()
* @AntiBot(check=false)
*/
public function indexAction()
{
//...
return array();
}
//...
}