我已经安装了SyliusCartBundle。
我想在我的购物车中添加商品,但是当我尝试执行此操作时,我得到:“变量”产品“在SyliusCartBundle中不存在:购物车:第7行的summary.html.twig”
summary.html.twig
{% set cart = sylius_cart_get() %}
Current cart totals: {{ cart.total }} for {{ cart.totalItems }} items!
<a href="{{ path('sylius_cart_item_add', {'productId': product.getId() }) }}">Add product to cart</a>
syliusAction()
/**
*
* @Route("/sylius")
*/
public function syliusAction()
{
$em = $this->getDoctrine()->getManager();
$product = $em->getRepository('DTRBundle:Product')->find(2);
return $this->render(
'SyliusCartBundle\views\Cart\summary.html.twig',
array(
'product' => $product
)
);
}