diff --git a/core/lib/Thelia/Config/Resources/config.xml b/core/lib/Thelia/Config/Resources/config.xml index d8bdfbf19..74e1f4629 100755 --- a/core/lib/Thelia/Config/Resources/config.xml +++ b/core/lib/Thelia/Config/Resources/config.xml @@ -149,11 +149,7 @@ - - - - - + %thelia.parser.loops% diff --git a/core/lib/Thelia/Core/Template/Element/BaseLoop.php b/core/lib/Thelia/Core/Template/Element/BaseLoop.php index d74f9894b..209973112 100755 --- a/core/lib/Thelia/Core/Template/Element/BaseLoop.php +++ b/core/lib/Thelia/Core/Template/Element/BaseLoop.php @@ -23,6 +23,7 @@ namespace Thelia\Core\Template\Element; +use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Thelia\Core\Template\Loop\Argument\Argument; @@ -52,6 +53,9 @@ abstract class BaseLoop */ protected $securityContext; + /** @var ContainerInterface Service Container */ + protected $container = null; + protected $args; public $countable = true; @@ -61,15 +65,15 @@ abstract class BaseLoop /** * Create a new Loop * - * @param Request $request - * @param EventDispatcherInterface $dispatcher - * @param SecurityContext $securityContext + * @param ContainerInterface $container */ - public function __construct(Request $request, EventDispatcherInterface $dispatcher, SecurityContext $securityContext) + public function __construct(ContainerInterface $container) { - $this->request = $request; - $this->dispatcher = $dispatcher; - $this->securityContext = $securityContext; + $this->container = $container; + + $this->request = $container->get('request'); + $this->dispatcher = $container->get('event_dispatcher'); + $this->securityContext = $container->get('thelia.securityContext'); $this->args = $this->getArgDefinitions()->addArguments($this->getDefaultArgs(), false); } diff --git a/core/lib/Thelia/Core/Template/Smarty/Plugins/TheliaLoop.php b/core/lib/Thelia/Core/Template/Smarty/Plugins/TheliaLoop.php index e9c91b7df..2c7601dc4 100755 --- a/core/lib/Thelia/Core/Template/Smarty/Plugins/TheliaLoop.php +++ b/core/lib/Thelia/Core/Template/Smarty/Plugins/TheliaLoop.php @@ -23,6 +23,7 @@ namespace Thelia\Core\Template\Smarty\Plugins; +use Symfony\Component\DependencyInjection\ContainerInterface; use Thelia\Core\Template\Element\BaseLoop; use Thelia\Core\Template\Smarty\AbstractSmartyPlugin; use Thelia\Core\Template\Smarty\SmartyPluginDescriptor; @@ -44,14 +45,22 @@ class TheliaLoop extends AbstractSmartyPlugin protected $dispatcher; protected $securityContext; + /** @var ContainerInterface Service Container */ + protected $container = null; + protected $loopstack = array(); protected $varstack = array(); - public function __construct(Request $request, EventDispatcherInterface $dispatcher, SecurityContext $securityContext) + /** + * @param ContainerInterface $container + */ + public function __construct(ContainerInterface $container) { - $this->request = $request; - $this->dispatcher = $dispatcher; - $this->securityContext = $securityContext; + $this->container = $container; + + $this->request = $container->get('request'); + $this->dispatcher = $container->get('event_dispatcher'); + $this->securityContext = $container->get('thelia.securityContext'); } /** @@ -315,9 +324,7 @@ class TheliaLoop extends AbstractSmartyPlugin } $loop = $class->newInstance( - $this->request, - $this->dispatcher, - $this->securityContext + $this->container ); $loop->initializeArgs($smartyParams); diff --git a/core/lib/Thelia/Model/Cart.php b/core/lib/Thelia/Model/Cart.php index 7493546ae..55b697379 100755 --- a/core/lib/Thelia/Model/Cart.php +++ b/core/lib/Thelia/Model/Cart.php @@ -71,4 +71,9 @@ class Cart extends BaseCart ->findOne() ; } + + public function getTaxedAmount() + { + + } }