Using templates for conditions HTML fragments

This commit is contained in:
Franck Allimant
2014-05-02 12:06:21 +02:00
parent d8c100373b
commit bbe7634ad4
4 changed files with 34 additions and 5 deletions

View File

@@ -18,6 +18,8 @@ use Symfony\Component\Translation\Translator;
use Symfony\Component\Translation\TranslatorInterface;
use Thelia\Condition\ConditionEvaluator;
use Thelia\Core\HttpFoundation\Request;
use Thelia\Core\Template\ParserInterface;
use Thelia\Core\Template\TemplateHelper;
use Thelia\Model\Coupon;
use Thelia\Model\CouponQuery;
use Thelia\Cart\CartTrait;
@@ -43,6 +45,9 @@ class BaseFacade implements FacadeInterface
/** @var Translator Service Translator */
protected $translator = null;
/** @var ParserInterface The thelia parser */
private $parser = null;
/**
* Constructor
*
@@ -197,6 +202,23 @@ class BaseFacade implements FacadeInterface
return $this->container->get('thelia.translator');
}
/**
* Return platform Parser
*
* @return ParserInterface
*/
public function getParser()
{
if ($this->parser == null) {
$this->parser = $this->container->get('thelia.parser');
// Define the current back-office template that should be used
$this->parser->setTemplateDefinition(TemplateHelper::getInstance()->getActiveAdminTemplate());
}
return $this->parser;
}
/**
* Return the main currency
* THe one used to set prices in BackOffice

View File

@@ -17,6 +17,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Translation\TranslatorInterface;
use Thelia\Condition\ConditionEvaluator;
use Thelia\Core\HttpFoundation\Request;
use Thelia\Core\Template\ParserInterface;
use Thelia\Model\Coupon;
/**
@@ -129,6 +130,12 @@ interface FacadeInterface
* @return TranslatorInterface
*/
public function getTranslator();
/**
* Return platform ParserInterface
*
* @return ParserInterface
*/
public function getParser();
/**
* Return the main currency

View File

@@ -33,7 +33,7 @@ class RemoveXAmount extends CouponAbstract
{
return $this->facade
->getTranslator()
->trans('Remove X amount to total cart', array(), 'coupon');
->trans('Fixed Amount Discount', array(), 'coupon');
}
/**
@@ -45,7 +45,7 @@ class RemoveXAmount extends CouponAbstract
{
return $this->facade
->getTranslator()
->trans('Amount removed from the cart', array(), 'coupon');
->trans('Discount amount', array(), 'coupon');
}
/**
@@ -58,7 +58,7 @@ class RemoveXAmount extends CouponAbstract
$toolTip = $this->facade
->getTranslator()
->trans(
'This coupon will remove the entered amount to the customer total checkout. If the discount is superior to the total checkout price the customer will only pay the postage. Unless if the coupon is set to remove postage too.',
'This coupon will subtracts a set amount from the total cost of an order. If the discount is greater than the total order corst, the customer will only pay the shipping, or nothing if the coupon also provides free shipping.',
array(),
'coupon'
);

View File

@@ -116,7 +116,7 @@ class RemoveXPercent extends CouponAbstract
{
return $this->facade
->getTranslator()
->trans('Percentage removed from the cart', array(), 'coupon');
->trans('Percent Discount', array(), 'coupon');
}
/**
@@ -129,7 +129,7 @@ class RemoveXPercent extends CouponAbstract
$toolTip = $this->facade
->getTranslator()
->trans(
'This coupon will remove the entered percentage to the customer total checkout. If the discount is superior to the total checkout price the customer will only pay the postage. Unless if the coupon is set to remove postage too.',
'This coupon will offert a flat percentage off a shopper\'s entire order (not applied to shipping costs or tax rates). If the discount is greater than the total order corst, the customer will only pay the shipping, or nothing if the coupon also provides free shipping.',
array(),
'coupon'
);