@@ -27,7 +27,7 @@ use Thelia\Condition\Implementation\ConditionInterface;
|
||||
class ConditionCollection implements Iterator, Countable, ArrayAccess
|
||||
{
|
||||
/** @var array Array of ConditionInterface */
|
||||
protected $conditions = array();
|
||||
protected $conditions = [];
|
||||
|
||||
/**
|
||||
* (PHP 5 >= 5.0.0)
|
||||
@@ -180,7 +180,7 @@ class ConditionCollection implements Iterator, Countable, ArrayAccess
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
$arrayToSerialize = array();
|
||||
$arrayToSerialize = [];
|
||||
/** @var ConditionInterface $condition */
|
||||
foreach ($this as $condition) {
|
||||
$arrayToSerialize[] = $condition->getSerializableCondition();
|
||||
|
||||
@@ -61,7 +61,7 @@ class ConditionFactory
|
||||
);
|
||||
$collection[] = $conditionNone;
|
||||
}
|
||||
$serializableConditions = array();
|
||||
$serializableConditions = [];
|
||||
/** @var $condition ConditionInterface */
|
||||
foreach ($collection as $condition) {
|
||||
$serializableConditions[] = $condition->getSerializableCondition();
|
||||
|
||||
@@ -18,6 +18,7 @@ use Thelia\Condition\SerializableCondition;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
use Thelia\Coupon\FacadeInterface;
|
||||
use Thelia\Exception\InvalidConditionValueException;
|
||||
use Thelia\Model\Base\CurrencyQuery;
|
||||
use Thelia\Model\Currency;
|
||||
use Thelia\Type\FloatType;
|
||||
|
||||
@@ -35,10 +36,10 @@ abstract class ConditionAbstract implements ConditionInterface
|
||||
protected $serviceId = null;
|
||||
|
||||
/** @var array Available Operators (Operators::CONST) */
|
||||
protected $availableOperators = array();
|
||||
protected $availableOperators = [];
|
||||
|
||||
/** @var array Parameters validating parameters against */
|
||||
protected $validators = array();
|
||||
protected $validators = [];
|
||||
|
||||
/** @var FacadeInterface Provide necessary value from Thelia */
|
||||
protected $facade = null;
|
||||
@@ -47,10 +48,10 @@ abstract class ConditionAbstract implements ConditionInterface
|
||||
protected $translator = null;
|
||||
|
||||
/** @var array Operators set by Admin in BackOffice */
|
||||
protected $operators = array();
|
||||
protected $operators = [];
|
||||
|
||||
/** @var array Values set by Admin in BackOffice */
|
||||
protected $values = array();
|
||||
protected $values = [];
|
||||
|
||||
/** @var ConditionEvaluator Conditions validator */
|
||||
protected $conditionValidator = null;
|
||||
@@ -86,9 +87,9 @@ abstract class ConditionAbstract implements ConditionInterface
|
||||
{
|
||||
$this->validators = $this->generateInputs();
|
||||
|
||||
$translatedInputs = array();
|
||||
$translatedInputs = [];
|
||||
foreach ($this->validators as $key => $validator) {
|
||||
$translatedOperators = array();
|
||||
$translatedOperators = [];
|
||||
foreach ($validator['availableOperators'] as $availableOperators) {
|
||||
$translatedOperators[$availableOperators] = Operators::getI18n(
|
||||
$this->translator,
|
||||
@@ -99,7 +100,7 @@ abstract class ConditionAbstract implements ConditionInterface
|
||||
$validator['availableOperators'] = $translatedOperators;
|
||||
$translatedInputs[$key] = $validator;
|
||||
}
|
||||
$validators = array();
|
||||
$validators = [];
|
||||
$validators['inputs'] = $translatedInputs;
|
||||
$validators['setOperators'] = $this->operators;
|
||||
$validators['setValues'] = $this->values;
|
||||
@@ -216,27 +217,21 @@ abstract class ConditionAbstract implements ConditionInterface
|
||||
*/
|
||||
protected function drawBackOfficeInputOperators($inputKey)
|
||||
{
|
||||
$selectHtml = '';
|
||||
$optionHtml = '';
|
||||
$inputs = $this->getValidators();
|
||||
if (isset($inputs['inputs'][$inputKey])) {
|
||||
$operators = $inputs['inputs'][$inputKey]['availableOperators'];
|
||||
foreach ($operators as $key => $operator) {
|
||||
$selected = '';
|
||||
if (isset($this->operators) && isset($this->operators[$inputKey]) && $this->operators[$inputKey] == $key) {
|
||||
$selected = ' selected="selected"';
|
||||
}
|
||||
$optionHtml .= '<option value="' . $key . '" '. $selected . '>' . $operator . '</option>';
|
||||
}
|
||||
$html = '';
|
||||
|
||||
$selectHtml .= '
|
||||
<select class="form-control" id="' . $inputKey . '-operator" name="' . $inputKey . '[operator]">
|
||||
' . $optionHtml . '
|
||||
</select>
|
||||
';
|
||||
$inputs = $this->getValidators();
|
||||
|
||||
if (isset($inputs['inputs'][$inputKey])) {
|
||||
|
||||
$html = $this->facade->getParser()->render('coupon/condition-fragments/condition-selector.html', [
|
||||
'operators' => $inputs['inputs'][$inputKey]['availableOperators'],
|
||||
'value' => isset($this->operators[$inputKey]) ? $this->operators[$inputKey] : '',
|
||||
'inputKey' => $inputKey
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
return $selectHtml;
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -251,26 +246,19 @@ abstract class ConditionAbstract implements ConditionInterface
|
||||
protected function drawBackOfficeBaseInputsText($label, $inputKey)
|
||||
{
|
||||
$operatorSelectHtml = $this->drawBackOfficeInputOperators($inputKey);
|
||||
|
||||
$currentValue = '';
|
||||
if (isset($this->values) && isset($this->values[$inputKey])) {
|
||||
$currentValue = $this->values[$inputKey];
|
||||
}
|
||||
|
||||
$html = '
|
||||
<div id="condition-add-operators-values" class="form-group col-md-6">
|
||||
<label for="operator">' . $label . '</label>
|
||||
<div class="row">
|
||||
<div class="col-lg-6">
|
||||
' . $operatorSelectHtml . '
|
||||
</div>
|
||||
<div class="input-group col-lg-6">
|
||||
<input type="text" class="form-control" id="' . $inputKey . '-value" name="' . $inputKey . '[value]" value="' . $currentValue . '">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
';
|
||||
|
||||
return $html;
|
||||
return $this->facade->getParser()->render('coupon/conditions-fragments/base-input-text.html', [
|
||||
'label' => $label,
|
||||
'inputKey' => $inputKey,
|
||||
'currentValue' => $currentValue,
|
||||
'operatorSelectHtml' => $operatorSelectHtml
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -285,23 +273,39 @@ abstract class ConditionAbstract implements ConditionInterface
|
||||
*/
|
||||
protected function drawBackOfficeInputQuantityValues($inputKey, $max = 10, $min = 0)
|
||||
{
|
||||
$selectHtml = '';
|
||||
$optionHtml = '';
|
||||
for ($i = $min; $i <= $max; $i++) {
|
||||
$selected = '';
|
||||
if (isset($this->values) && isset($this->values[$inputKey]) && $this->values[$inputKey] == $i) {
|
||||
$selected = ' selected="selected"';
|
||||
}
|
||||
$optionHtml .= '<option value="' . $i . '" ' . $selected . '>' . $i . '</option>';
|
||||
}
|
||||
|
||||
$selectHtml .= '
|
||||
<select class="form-control" id="' . $inputKey . '-value" name="' . $inputKey . '[value]">
|
||||
' . $optionHtml . '
|
||||
</select>
|
||||
';
|
||||
|
||||
return $selectHtml;
|
||||
return $this->facade->getParser()->render('coupon/condition-fragments/quantity-selector.html', [
|
||||
'min' => $min,
|
||||
'max' => $max,
|
||||
'value' => isset($this->values[$inputKey]) ? $this->values[$inputKey] : '',
|
||||
'inputKey' => $inputKey
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw the currency input displayed in the BackOffice
|
||||
* allowing Admin to set its Coupon Conditions
|
||||
*
|
||||
* @param string $inputKey Input key (ex: self::INPUT1)
|
||||
*
|
||||
* @return string HTML string
|
||||
*/
|
||||
protected function drawBackOfficeCurrencyInput($inputKey)
|
||||
{
|
||||
$currencies = CurrencyQuery::create()->find();
|
||||
|
||||
$cleanedCurrencies = [];
|
||||
|
||||
/** @var Currency $currency */
|
||||
foreach ($currencies as $currency) {
|
||||
$cleanedCurrencies[$currency->getCode()] = $currency->getSymbol();
|
||||
}
|
||||
|
||||
return $this->facade->getParser()->render('coupon/condition-fragments/currency-selector.html', [
|
||||
'currencies' => $cleanedCurrencies,
|
||||
'value' => isset($this->values[$inputKey]) ? $this->values[$inputKey] : '',
|
||||
'inputKey' => $inputKey
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,7 @@ class MatchForEveryone extends ConditionAbstract
|
||||
protected $serviceId = 'thelia.condition.match_for_everyone';
|
||||
|
||||
/** @var array Available Operators (Operators::CONST) */
|
||||
protected $availableOperators = array();
|
||||
protected $availableOperators = [];
|
||||
|
||||
/**
|
||||
* Check validators relevancy and store them
|
||||
@@ -51,8 +51,8 @@ class MatchForEveryone extends ConditionAbstract
|
||||
*/
|
||||
protected function setValidators()
|
||||
{
|
||||
$this->operators = array();
|
||||
$this->values = array();
|
||||
$this->operators = [];
|
||||
$this->values = [];
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -75,8 +75,8 @@ class MatchForEveryone extends ConditionAbstract
|
||||
public function getName()
|
||||
{
|
||||
return $this->translator->trans(
|
||||
'Everybody can use it (no condition)',
|
||||
array(),
|
||||
'Unconditional usage',
|
||||
[],
|
||||
'condition'
|
||||
);
|
||||
}
|
||||
@@ -90,8 +90,8 @@ class MatchForEveryone extends ConditionAbstract
|
||||
public function getToolTip()
|
||||
{
|
||||
$toolTip = $this->translator->trans(
|
||||
'Will return always true',
|
||||
array(),
|
||||
'This condition is always true',
|
||||
[],
|
||||
'condition'
|
||||
);
|
||||
|
||||
@@ -107,8 +107,8 @@ class MatchForEveryone extends ConditionAbstract
|
||||
public function getSummary()
|
||||
{
|
||||
$toolTip = $this->translator->trans(
|
||||
'Will return always true',
|
||||
array(),
|
||||
'Unconditionnal usage',
|
||||
[],
|
||||
'condition'
|
||||
);
|
||||
|
||||
@@ -122,7 +122,7 @@ class MatchForEveryone extends ConditionAbstract
|
||||
*/
|
||||
protected function generateInputs()
|
||||
{
|
||||
return array();
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -153,7 +153,7 @@ class MatchForTotalAmount extends ConditionAbstract
|
||||
{
|
||||
return $this->translator->trans(
|
||||
'By cart total amount',
|
||||
array(),
|
||||
[],
|
||||
'condition'
|
||||
);
|
||||
}
|
||||
@@ -168,7 +168,7 @@ class MatchForTotalAmount extends ConditionAbstract
|
||||
{
|
||||
$toolTip = $this->translator->trans(
|
||||
'Check the total Cart amount in the given currency',
|
||||
array(),
|
||||
[],
|
||||
'condition'
|
||||
);
|
||||
|
||||
@@ -208,7 +208,7 @@ class MatchForTotalAmount extends ConditionAbstract
|
||||
protected function generateInputs()
|
||||
{
|
||||
$currencies = CurrencyQuery::create()->find();
|
||||
$cleanedCurrencies = array();
|
||||
$cleanedCurrencies = [];
|
||||
/** @var Currency $currency */
|
||||
foreach ($currencies as $currency) {
|
||||
$cleanedCurrencies[$currency->getCode()] = $currency->getSymbol();
|
||||
@@ -240,7 +240,7 @@ class MatchForTotalAmount extends ConditionAbstract
|
||||
{
|
||||
$labelPrice = $this->facade
|
||||
->getTranslator()
|
||||
->trans('Price', array(), 'condition');
|
||||
->trans('Cart total amount is', [], 'condition');
|
||||
|
||||
$html = $this->drawBackOfficeBaseInputsText($labelPrice, self::INPUT1);
|
||||
|
||||
@@ -258,66 +258,17 @@ class MatchForTotalAmount extends ConditionAbstract
|
||||
*/
|
||||
protected function drawBackOfficeBaseInputsText($label, $inputKey)
|
||||
{
|
||||
$operatorSelectHtml = $this->drawBackOfficeInputOperators(self::INPUT1);
|
||||
$currencySelectHtml = $this->drawBackOfficeCurrencyInput(self::INPUT2);
|
||||
$selectedAmount = '';
|
||||
if (isset($this->values) && isset($this->values[$inputKey])) {
|
||||
$selectedAmount = $this->values[$inputKey];
|
||||
}
|
||||
return $this->facade->getParser()->render('coupon/condition-fragments/cart-total-amount-condition.html', [
|
||||
'label' => $label,
|
||||
'inputKey' => $inputKey,
|
||||
'value' => isset($this->values[$inputKey]) ? $this->values[$inputKey] : '',
|
||||
|
||||
$html = '
|
||||
<label for="operator">' . $label . '</label>
|
||||
<div class="row">
|
||||
<div class="col-lg-6">
|
||||
' . $operatorSelectHtml . '
|
||||
</div>
|
||||
<div class="input-group col-lg-3">
|
||||
<input type="text" class="form-control" id="' . self::INPUT1 . '-value" name="' . self::INPUT1 . '[value]" value="' . $selectedAmount . '">
|
||||
</div>
|
||||
<div class="input-group col-lg-3">
|
||||
<input type="hidden" id="' . self::INPUT2 . '-operator" name="' . self::INPUT2 . '[operator]" value="==" />
|
||||
' . $currencySelectHtml . '
|
||||
</div>
|
||||
</div>
|
||||
';
|
||||
'field_1_name' => self::INPUT1,
|
||||
'field_2_name' => self::INPUT2,
|
||||
|
||||
return $html;
|
||||
'operatorSelectHtml' => $this->drawBackOfficeInputOperators(self::INPUT1),
|
||||
'currencySelectHtml' => $this->drawBackOfficeCurrencyInput(self::INPUT2),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw the currency input displayed in the BackOffice
|
||||
* allowing Admin to set its Coupon Conditions
|
||||
*
|
||||
* @param string $inputKey Input key (ex: self::INPUT1)
|
||||
*
|
||||
* @return string HTML string
|
||||
*/
|
||||
protected function drawBackOfficeCurrencyInput($inputKey)
|
||||
{
|
||||
$optionHtml = '';
|
||||
|
||||
$currencies = CurrencyQuery::create()->find();
|
||||
$cleanedCurrencies = array();
|
||||
/** @var Currency $currency */
|
||||
foreach ($currencies as $currency) {
|
||||
$cleanedCurrencies[$currency->getCode()] = $currency->getSymbol();
|
||||
}
|
||||
|
||||
foreach ($cleanedCurrencies as $key => $cleanedCurrency) {
|
||||
$selected = '';
|
||||
if (isset($this->values) && isset($this->values[$inputKey]) && $this->values[$inputKey] == $key) {
|
||||
$selected = ' selected="selected"';
|
||||
}
|
||||
$optionHtml .= '<option value="' . $key . '" ' . $selected . '>' . $cleanedCurrency . '</option>';
|
||||
}
|
||||
|
||||
$selectHtml = '
|
||||
<select class="form-control" id="' . $inputKey . '-value" name="' . $inputKey . '[value]">
|
||||
' . $optionHtml . '
|
||||
</select>
|
||||
';
|
||||
|
||||
return $selectHtml;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -127,8 +127,8 @@ class MatchForXArticles extends ConditionAbstract
|
||||
public function getName()
|
||||
{
|
||||
return $this->translator->trans(
|
||||
'By number of articles in cart',
|
||||
array(),
|
||||
'Cart item count condition',
|
||||
[],
|
||||
'condition'
|
||||
);
|
||||
}
|
||||
@@ -142,8 +142,8 @@ class MatchForXArticles extends ConditionAbstract
|
||||
public function getToolTip()
|
||||
{
|
||||
$toolTip = $this->translator->trans(
|
||||
'Check the amount of product in the Cart',
|
||||
array(),
|
||||
'The cart item count should match the condition',
|
||||
[],
|
||||
'condition'
|
||||
);
|
||||
|
||||
@@ -163,7 +163,7 @@ class MatchForXArticles extends ConditionAbstract
|
||||
);
|
||||
|
||||
$toolTip = $this->translator->trans(
|
||||
'If cart products quantity is <strong>%operator%</strong> %quantity%',
|
||||
'If cart item count is <strong>%operator%</strong> %quantity%',
|
||||
array(
|
||||
'%operator%' => $i18nOperator,
|
||||
'%quantity%' => $this->values[self::INPUT1]
|
||||
@@ -200,7 +200,7 @@ class MatchForXArticles extends ConditionAbstract
|
||||
{
|
||||
$labelQuantity = $this->facade
|
||||
->getTranslator()
|
||||
->trans('Quantity', array(), 'condition');
|
||||
->trans('Cart item count is', [], 'condition');
|
||||
|
||||
$html = $this->drawBackOfficeBaseInputsText($labelQuantity, self::INPUT1);
|
||||
|
||||
@@ -218,24 +218,11 @@ class MatchForXArticles extends ConditionAbstract
|
||||
*/
|
||||
protected function drawBackOfficeBaseInputsText($label, $inputKey)
|
||||
{
|
||||
$operatorSelectHtml = $this->drawBackOfficeInputOperators($inputKey);
|
||||
$quantitySelectHtml = $this->drawBackOfficeInputQuantityValues($inputKey, 20, 1);
|
||||
|
||||
$html = '
|
||||
<div id="condition-add-operators-values" class="form-group col-md-6">
|
||||
<label for="operator">' . $label . '</label>
|
||||
<div class="row">
|
||||
<div class="col-lg-6">
|
||||
' . $operatorSelectHtml . '
|
||||
</div>
|
||||
<div class="input-group col-lg-6">
|
||||
' . $quantitySelectHtml . '
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
';
|
||||
|
||||
return $html;
|
||||
return $this->facade->getParser()->render('coupon/condition-fragments/cart-item-count-condition.html', [
|
||||
'label' => $label,
|
||||
'operatorSelectHtml' => $this->drawBackOfficeInputOperators($inputKey),
|
||||
'quantitySelectHtml' => $this->drawBackOfficeInputQuantityValues($inputKey, 20, 1)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -54,57 +54,57 @@ abstract class Operators
|
||||
switch ($operator) {
|
||||
case self::INFERIOR:
|
||||
$ret = $translator->trans(
|
||||
'inferior to',
|
||||
array(),
|
||||
'Less than',
|
||||
[],
|
||||
'condition'
|
||||
);
|
||||
break;
|
||||
case self::INFERIOR_OR_EQUAL:
|
||||
$ret = $translator->trans(
|
||||
'inferior or equal to',
|
||||
array(),
|
||||
'Less than or equals',
|
||||
[],
|
||||
'condition'
|
||||
);
|
||||
break;
|
||||
case self::EQUAL:
|
||||
$ret = $translator->trans(
|
||||
'equal to',
|
||||
array(),
|
||||
'Equals',
|
||||
[],
|
||||
'condition'
|
||||
);
|
||||
break;
|
||||
case self::SUPERIOR_OR_EQUAL:
|
||||
$ret = $translator->trans(
|
||||
'superior or equal to',
|
||||
array(),
|
||||
'Greater than or equals',
|
||||
[],
|
||||
'condition'
|
||||
);
|
||||
break;
|
||||
case self::SUPERIOR:
|
||||
$ret = $translator->trans(
|
||||
'superior to',
|
||||
array(),
|
||||
'Greater than',
|
||||
[],
|
||||
'condition'
|
||||
);
|
||||
break;
|
||||
case self::DIFFERENT:
|
||||
$ret = $translator->trans(
|
||||
'different from',
|
||||
array(),
|
||||
'Not equals',
|
||||
[],
|
||||
'condition'
|
||||
);
|
||||
break;
|
||||
case self::IN:
|
||||
$ret = $translator->trans(
|
||||
'in',
|
||||
array(),
|
||||
'In',
|
||||
[],
|
||||
'condition'
|
||||
);
|
||||
break;
|
||||
case self::OUT:
|
||||
$ret = $translator->trans(
|
||||
'not in',
|
||||
array(),
|
||||
'Not in',
|
||||
[],
|
||||
'condition'
|
||||
);
|
||||
break;
|
||||
|
||||
@@ -25,9 +25,9 @@ class SerializableCondition
|
||||
public $conditionServiceId = null;
|
||||
|
||||
/** @var array Operators set by Admin for this Condition */
|
||||
public $operators = array();
|
||||
public $operators = [];
|
||||
|
||||
/** @var array Values set by Admin for this Condition */
|
||||
public $values = array();
|
||||
public $values = [];
|
||||
|
||||
}
|
||||
|
||||
@@ -27,7 +27,6 @@ return array(
|
||||
'Alerts' => 'Alertes',
|
||||
'Alpha code 2 *' => 'Code Alpha 2 *',
|
||||
'Alpha code 3 *' => 'Code Alpha 3 *',
|
||||
'Amount removed from the cart' => 'Montant déduit du panier',
|
||||
'Apply exchange rates on price in %sym' => 'Appliquer le taux de change sur le prix en %sym',
|
||||
'Attribute ID:Attribute AV ID' => 'Déclinaison ID : Valeur de déclinaison ID',
|
||||
'Auth mode' => 'Mode d\'authentification',
|
||||
@@ -37,14 +36,15 @@ return array(
|
||||
'Bad tax list JSON' => 'Mauvais JSON de la liste des taxes',
|
||||
'Business ID' => 'ID du business',
|
||||
'By cart total amount' => 'Montant total du panier',
|
||||
'By number of articles in cart' => 'Nombre d\'articles dans le panier',
|
||||
'Cannot find a default country. Please define one.' => 'Impossible de trouver un pays par défaut. Veuillez en définir un.',
|
||||
'Cannot find the shop country. Please select a shop country.' => 'Impossible de trouver le pays du magasin. Veuillez en sélectionner un.',
|
||||
'Cannot instanciante module "%name%": the namespace is null. Maybe the model is not loaded ?' => 'Ne peut instancier le module "%name%": le namespace est null. Peut-être que le modèle n\'est pas chargé ?',
|
||||
'Cart item count condition' => 'Nombre d\'articles dans le panier',
|
||||
'Cart item count is' => 'Le nombre d\'articles dans le panier est',
|
||||
'Cart total amount is' => 'Le total du panier est',
|
||||
'Category title *' => 'Titre de la catégorie *',
|
||||
'Cellphone' => 'Numéro de portable',
|
||||
'Chapo' => 'Chapeau',
|
||||
'Check the amount of product in the Cart' => 'Applique une condition sur le nombre total d\'articles dans le panier',
|
||||
'Check the total Cart amount in the given currency' => 'Applique une condition sur le montant total du panier dans la devise indiquée.',
|
||||
'City' => 'Ville',
|
||||
'Combination builder' => 'générateur de combinaison',
|
||||
@@ -61,6 +61,7 @@ return array(
|
||||
'Country title *' => 'Pays *',
|
||||
'Critical' => 'Critique',
|
||||
'Current Password' => 'Mot de passe actuel.',
|
||||
'Date \'%date\' is invalid, please enter a valid date using %fmt format' => 'La date \'%date\' est incorrecte, merci d\'indiquer une date au format %fmt',
|
||||
'Debug' => 'Debug',
|
||||
'Default folder *' => 'Dossier par défaut *',
|
||||
'Default product category *' => 'Catégorie du produit par défaut *',
|
||||
@@ -71,6 +72,7 @@ return array(
|
||||
'Description' => 'Description',
|
||||
'Detailed description' => 'Description détaillée',
|
||||
'Disabled' => 'Désactivé',
|
||||
'Discount amount' => 'Montant de la remise',
|
||||
'Document deleted successfully' => 'Le document a été supprimé.',
|
||||
'Document position updated' => 'La position du document a été modfiée',
|
||||
'EAN Code' => 'Code EAN',
|
||||
@@ -79,10 +81,10 @@ return array(
|
||||
'Emergency' => 'Urgence',
|
||||
'Enable remote SMTP use' => 'Activer l\'utilisation d\'un serveur SMTP distant.',
|
||||
'Encryption' => 'Chiffrement',
|
||||
'Equals' => 'Egal à',
|
||||
'Error during %action process : %error. Exception was %exc' => 'Erreur lors de %action: %error. Exception: %exc ',
|
||||
'Error occured while processing order ref. %ref, ID %id: %err' => 'Un erreur est survenue paedant le traitement de la commande ref. %ref, ID %id; %err',
|
||||
'Errors' => 'Erreurs',
|
||||
'Everybody can use it (no condition)' => 'Tout le monde peut l\'utiliser (pas de condition)',
|
||||
'Fail to delete document for %id% with parent id %parentId% (Exception : %e%)' => 'Echec lors de la suppression du document %id% avec l\'ID parent %parentId% (Exception : %e%)',
|
||||
'Fail to delete image for %id% with parent id %parentId% (Exception : %e%)' => 'Echec lors de la suppression de l\'image %id% avec l\'ID parent %parentId% (Exception : %e%)',
|
||||
'Fail to update document position' => 'La position du document e n\'a pas pu être modfiée',
|
||||
@@ -96,8 +98,11 @@ return array(
|
||||
'File is too heavy, please retry with a file having a size less than %size%.' => 'La taille du fichier est trop importante, et doit être inféreiure à %size%.',
|
||||
'First Name' => 'Prénom',
|
||||
'Firstname' => 'Prénom',
|
||||
'Fixed Amount Discount' => 'Remise d\'un montant fixe',
|
||||
'Folder title *' => 'Titre du dossier *',
|
||||
'Full Name' => 'Nom complet',
|
||||
'Greater than' => 'Supérieur à',
|
||||
'Greater than or equals' => 'Supérieur ou égal à',
|
||||
'HTML Message' => 'Message au format HTML',
|
||||
'Host' => 'Nom de l\'hôte',
|
||||
'I would like to receive the newsletter or the latest news.' => 'Je souhaite recevoir la lettre d\'information ou les dernières actualités.',
|
||||
@@ -105,11 +110,12 @@ return array(
|
||||
'ISO 639-1 Code' => 'Code ISO 639-1',
|
||||
'ISO Code *' => 'Code ISO *',
|
||||
'If a translation is missing or incomplete :' => 'Si une traduction est manquante ou incomplète :',
|
||||
'If cart products quantity is <strong>%operator%</strong> %quantity%' => 'Si le nombre total d\'articles dans le panier est <strong>%operator%</strong> %quantity%',
|
||||
'If cart item count is <strong>%operator%</strong> %quantity%' => 'Le nombre d\'articles dans le panier est <strong>%operator%</strong> %quantity% ',
|
||||
'If cart total amount is <strong>%operator%</strong> %amount% %currency%' => 'Si le total du panier est <strong>%operator%</strong> %amount% %currency% ',
|
||||
'Image position updated' => 'La position de l\'image a été modfiée',
|
||||
'Images deleted successfully' => 'L\'image a été supprimée.',
|
||||
'Impossible to delete a customer who already have orders' => 'Impossible de supprimer un client si celui-ci a déjà une commande',
|
||||
'In' => 'Compris dans',
|
||||
'Information' => 'Information',
|
||||
'Invalid product_sale_elements' => 'product_sale_elements invalide',
|
||||
'Invalid value "%value" for "%param" parameter in loop type: %type, name: %name' => 'La valeur "%value" est invalide pour le paramètre "%param" dans la boucle type: %type, nom: %name ',
|
||||
@@ -118,6 +124,8 @@ return array(
|
||||
'Language name' => 'Nom de la langue',
|
||||
'Last Name' => 'Nom',
|
||||
'Lastname' => 'Nom',
|
||||
'Less than' => 'Inférieur à',
|
||||
'Less than or equals' => 'Inférieur ou égal à',
|
||||
'Log format *' => 'Format des logs *',
|
||||
'Log level *' => 'Niveau de log *',
|
||||
'Login' => 'Connexion',
|
||||
@@ -149,7 +157,9 @@ return array(
|
||||
'No module found for code \'%item\'' => 'Aucun module trouvé pour \'%item\' ',
|
||||
'No pagination currently defined for loop name \'%name\'' => 'La pagination n\'est pas définie pour la boucle \'%name\'',
|
||||
'No, I am a new customer.' => 'Non, je suis un nouveau client.',
|
||||
'Not equals' => 'Différent de',
|
||||
'Not found' => 'Non trouvé.',
|
||||
'Not in' => 'Non compris dans',
|
||||
'Notices' => 'Notices',
|
||||
'Order address ID not found' => 'ID de l\'adresse de la commande non trouvé',
|
||||
'Order ref. %ref is now unpaid.' => 'La commande %ref, ID %id est désormais non payée',
|
||||
@@ -160,8 +170,8 @@ return array(
|
||||
'Password' => 'Mot de passe',
|
||||
'Password *' => 'Mot de passe *',
|
||||
'Password confirmation' => 'Confirmation du mot de passe.',
|
||||
'Percent Discount' => 'Remise en pourcentage de la commande',
|
||||
'Percentage of the product price' => 'Pourcentage du prix du produit',
|
||||
'Percentage removed from the cart' => 'Pourcentage déduit du panier',
|
||||
'Phone' => 'Téléphone',
|
||||
'Please accept the Terms and conditions in order to register.' => 'Veuillez accepter les termes et conditions pour vous inscrire.',
|
||||
'Please check your input: %error' => 'Merci de vérifier votre saisie: %error',
|
||||
@@ -174,7 +184,6 @@ return array(
|
||||
'Preferred locale' => 'locale souhaitée',
|
||||
'Prevent mailing template modification or deletion, except for super-admin' => 'Prévenir la suppression ou la modification ds templates de mail, excepté pour les super-administrateurs.',
|
||||
'Prevent variable modification or deletion, except for super-admin' => 'Prévenir la suppression ou la modification de variables, excepté pour les super-administrateurs.',
|
||||
'Price' => 'Prix',
|
||||
'Price currency *' => 'Devise *',
|
||||
'Processing cancelation of payment for order ref. %ref' => 'Traitement de l\'annulation du paiement de la commande %ref, ID %id',
|
||||
'Processing confirmation of order ref. %ref, ID %id' => 'Traitement de la confirmation de la commande %ref, ID %id',
|
||||
@@ -204,7 +213,6 @@ return array(
|
||||
'Reference *' => 'Référence *',
|
||||
'Related loop name \'%name\'\' is not defined.' => 'La boucle \'%name\' n\'est pas définie.',
|
||||
'Remember me ?' => 'Se souvenir de moi ?',
|
||||
'Remove X amount to total cart' => 'Enlève un montant fixe du total du panier',
|
||||
'Remove X percent to total cart' => 'Enlève un pourcentage du panier total',
|
||||
'Replace by the default language' => 'Remplacer par la langue par défaut',
|
||||
'Replace current document by this file' => 'Remplacer le document courant par ce fichier',
|
||||
@@ -218,6 +226,7 @@ return array(
|
||||
'Shipping zone name' => 'Nom de la zone de livraison',
|
||||
'Show redirections *' => 'Montrer les redirections *',
|
||||
'Sorry, an error occured: %msg' => 'Désolé, une erreur est survenue : %msg',
|
||||
'Sorry, an error occurred: %err' => 'Désolé, une erreur est survenue: %err',
|
||||
'Sorry, you are not allowed to perform this action.' => 'Désolé, vous n\'êtes pas autorisé à réaliser cette action.',
|
||||
'Sorry, you\'re not allowed to perform this action' => 'Désolé, vous n\'êtes pas autorisé à réaliser cette action.',
|
||||
'Source IP' => 'IP source',
|
||||
@@ -243,13 +252,15 @@ return array(
|
||||
'Text File' => 'Fichier texte',
|
||||
'Text Message' => 'Message au format texte',
|
||||
'The TaxEngine should be passed to this form before using it.' => 'Le moteur de taxe doit être passé au formulaire avant d\'être utilisé.',
|
||||
'The cart item count should match the condition' => 'Le nombre d\'articles dans le panier doit vérifier la condition',
|
||||
'The image which replaces an undefined country flag (%file) was not found. Please check unknown-flag-path configuration variable, and check that the image exists.' => 'L\'image qui remplace un drapeau de pays manquant (%file) n\'a pas été trouvée. Merci de vérifier la variable de configuration unknown-flag-path.',
|
||||
'The loop name \'%name\' is already defined in %className class' => 'La boucle \'%name\' est déjà définir dans la classe %className',
|
||||
'This category is online.' => 'Cette catégorie est en ligne.',
|
||||
'This condition is always true' => 'Cette condition est troujours vérifiée',
|
||||
'This content is online.' => 'Ce contenu est en ligne.',
|
||||
'This coupon does not exists' => 'Ce code promo n\'existe pas',
|
||||
'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.' => 'Ce code promo retire le montant indiqué du total de la commande. Si ce montant est supérieur au total de la commande, le client ne paiera que les frais de port, à moins que ce code promo n\'offre aussi les frais de port.',
|
||||
'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.' => 'Ce code promo retire le pourcentage indiqué du total de la commande. Si ce montant est supérieur au total de la commande, le client ne paiera que les frais de port, à moins que ce code promo n\'offre aussi les frais de port.',
|
||||
'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.' => 'Ce code promo retire le pourcentage indiqué du total de la commande, hors frais de port et taxes. Si la remise est supérieur au total de la commande, seul le port sera facturé, à moins que le code promo n\'offre aussi les frais port.',
|
||||
'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.' => 'Ce code promo retire le montant indiqué du total de la commande, hors frais de port et taxes. Si la remise est supérieur au total de la commande, seul le port sera facturé, à moins que le code promo n\'offre aussi les frais port.',
|
||||
'This email already exists.' => 'Cette adresse email existe déjà',
|
||||
'This email does not exists' => 'Cette adresse email n\'existe pas',
|
||||
'This extension must be installed and loaded' => 'Cette extension doit être installée et chargée.',
|
||||
@@ -267,6 +278,8 @@ return array(
|
||||
'Type' => 'Type',
|
||||
'Unable to process your request. Please try again (%err).' => 'Echec lors du traitement de votre requête. Merci de ré-essayer (%err).',
|
||||
'Unavailable' => 'Non disponible.',
|
||||
'Unconditional usage' => 'Utilisable sans conditions',
|
||||
'Unconditionnal usage' => 'Utilisable sans conditions',
|
||||
'Undefined loop argument "%name"' => 'Argument de boucle invalide: "%name" ',
|
||||
'Undefined search mode \'%mode\'' => 'Mode de recherche \'%mode\' invalide',
|
||||
'Undefined translation type: %item' => 'Type de traduction inconnu:%item ',
|
||||
@@ -278,7 +291,6 @@ return array(
|
||||
'Value *' => 'Valeur *',
|
||||
'Warnings' => 'Avertissements',
|
||||
'Weight' => 'Poids',
|
||||
'Will return always true' => 'Retourne toujours "vrai"',
|
||||
'Yes, I have a password :' => 'Oui, j\'ai un mot de passe :',
|
||||
'You are already registered!' => 'Vous êtes déjà enregistré !',
|
||||
'You can only upload images (.png, .jpg, .jpeg, .gif)' => 'Seules les images sont autorisées (.png, .jpg, .jpeg, .gif)',
|
||||
@@ -288,21 +300,13 @@ return array(
|
||||
'Zip code' => 'Code postal',
|
||||
'date format' => 'Format de date',
|
||||
'delivery module %s is not a Thelia\Module\DeliveryModuleInterface' => 'le module de livraison %s n\'est pas un Thelia\Module\DeliveryModuleInterface',
|
||||
'different from' => 'différent de',
|
||||
'equal to' => 'égal à',
|
||||
'in' => 'est parmis',
|
||||
'inferior or equal to' => 'inférieur ou égal à',
|
||||
'inferior to' => 'inférieur à',
|
||||
'language locale' => 'Langue locale',
|
||||
'mailing system modification' => 'Modification du système d\'envoi de mail.',
|
||||
'not in' => 'n\'est pas parmis',
|
||||
'password confirmation is not the same as password field' => 'le mot de passe de confirmation n\'est pas le même que le champ mot de passe',
|
||||
'password must be composed of at least 4 characters' => 'le mot de passe doit être composé d\'au moins 4 caractères',
|
||||
'payment module %s is not a Thelia\Module\PaymentModuleInterface' => 'Le module de paiement %s n\'est pas une instance de Thelia\Module\PaymentModuleInterface ',
|
||||
'permanent discount (in percent)' => 'Remise permanente (en pourcentage)',
|
||||
'quantity value is not valid' => 'la valeur de la quantité n\'est pas valide',
|
||||
'superior or equal to' => 'supérieur ou égal à',
|
||||
'superior to' => 'supérieur à',
|
||||
'this product id does not exists : %d' => 'l\'id du produit %d n\'existe pas',
|
||||
'time format' => 'Format d\'heure',
|
||||
);
|
||||
|
||||
@@ -512,10 +512,6 @@
|
||||
<default key="_controller">Thelia\Controller\Admin\CouponController::updateAction</default>
|
||||
<requirement key="couponId">\d+</requirement>
|
||||
</route>
|
||||
<route id="admin.coupon.read" path="/admin/coupon/read/{couponId}">
|
||||
<default key="_controller">Thelia\Controller\Admin\CouponController::readAction</default>
|
||||
<requirement key="couponId">\d+</requirement>
|
||||
</route>
|
||||
<route id="admin.coupon.draw.inputs.ajax" path="/admin/coupon/draw/inputs/{couponServiceId}">
|
||||
<default key="_controller">Thelia\Controller\Admin\CouponController::getBackOfficeInputsAjaxAction</default>
|
||||
<requirement key="couponServiceId">.*</requirement>
|
||||
@@ -549,7 +545,7 @@
|
||||
|
||||
<!-- Routes to the Config (system variables) controller -->
|
||||
|
||||
<route id="admin.configuration.inedx" path="/admin/configuration">
|
||||
<route id="admin.configuration.index" path="/admin/configuration">
|
||||
<default key="_controller">Thelia\Controller\Admin\ConfigurationController::indexAction</default>
|
||||
</route>
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ use Thelia\Log\Tlog;
|
||||
use Thelia\Model\Coupon;
|
||||
use Thelia\Model\CouponQuery;
|
||||
use Thelia\Model\Lang;
|
||||
use Thelia\Model\LangQuery;
|
||||
use Thelia\Tools\I18n;
|
||||
use Thelia\Tools\Rest\ResponseRest;
|
||||
|
||||
@@ -53,54 +54,13 @@ class CouponController extends BaseAdminController
|
||||
*/
|
||||
public function browseAction()
|
||||
{
|
||||
$this->checkAuth(AdminResources::COUPON, array(), AccessManager::VIEW);
|
||||
|
||||
$args['urlReadCoupon'] = $this->getRoute(
|
||||
'admin.coupon.read',
|
||||
array('couponId' => 0),
|
||||
Router::ABSOLUTE_URL
|
||||
);
|
||||
|
||||
$args['urlEditCoupon'] = $this->getRoute(
|
||||
'admin.coupon.update',
|
||||
array('couponId' => 0),
|
||||
Router::ABSOLUTE_URL
|
||||
);
|
||||
|
||||
$args['urlCreateCoupon'] = $this->getRoute(
|
||||
'admin.coupon.create',
|
||||
array(),
|
||||
Router::ABSOLUTE_URL
|
||||
);
|
||||
|
||||
return $this->render('coupon-list', $args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Manage Coupons read display
|
||||
*
|
||||
* @param int $couponId Coupon Id
|
||||
*
|
||||
* @return \Thelia\Core\HttpFoundation\Response
|
||||
*/
|
||||
public function readAction($couponId)
|
||||
{
|
||||
$this->checkAuth(AdminResources::COUPON, array(), AccessManager::VIEW);
|
||||
|
||||
$coupon = CouponQuery::create()->findPk($couponId);
|
||||
|
||||
if ($coupon === null) {
|
||||
return $this->pageNotFound();
|
||||
if (null !== $response = $this->checkAuth(AdminResources::COUPON, [], AccessManager::VIEW)) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
$args['couponId'] = $couponId;
|
||||
$args['urlEditCoupon'] = $this->getRoute(
|
||||
'admin.coupon.update',
|
||||
array('couponId' => $couponId),
|
||||
Router::ABSOLUTE_URL
|
||||
);
|
||||
$args['coupon_order'] = $this->getListOrderFromSession('coupon', 'coupon_order', 'code');
|
||||
|
||||
return $this->render('coupon-read', $args);
|
||||
return $this->render('coupon-list', $args);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -110,24 +70,17 @@ class CouponController extends BaseAdminController
|
||||
*/
|
||||
public function createAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
$response = $this->checkAuth(AdminResources::COUPON, array(), AccessManager::CREATE);
|
||||
if ($response !== null) {
|
||||
if (null !== $response = $this->checkAuth(AdminResources::COUPON, [], AccessManager::CREATE)) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
// Parameters given to the template
|
||||
$args = array();
|
||||
$args = [];
|
||||
|
||||
$i18n = new I18n();
|
||||
/** @var Lang $lang */
|
||||
$lang = $this->getSession()->getLang();
|
||||
$eventToDispatch = TheliaEvents::COUPON_CREATE;
|
||||
|
||||
if ($this->getRequest()->isMethod('POST')) {
|
||||
$this->validateCreateOrUpdateForm(
|
||||
$i18n,
|
||||
$lang,
|
||||
$eventToDispatch,
|
||||
'created',
|
||||
'creation'
|
||||
@@ -135,15 +88,14 @@ class CouponController extends BaseAdminController
|
||||
} else {
|
||||
// If no input for expirationDate, now + 2 months
|
||||
$defaultDate = new \DateTime();
|
||||
$args['defaultDate'] = $defaultDate->modify('+2 month')
|
||||
->format('Y-m-d');
|
||||
$args['defaultDate'] = $defaultDate->modify('+2 month')->format($this->getDefaultDateFormat());
|
||||
}
|
||||
|
||||
$args['dateFormat'] = $this->getSession()->getLang()->getDateFormat();
|
||||
$args['dateFormat'] = $this->getDefaultDateFormat();
|
||||
$args['availableCoupons'] = $this->getAvailableCoupons();
|
||||
$args['urlAjaxAdminCouponDrawInputs'] = $this->getRoute(
|
||||
'admin.coupon.draw.inputs.ajax',
|
||||
array('couponServiceId' => 'couponServiceId'),
|
||||
['couponServiceId' => 'couponServiceId'],
|
||||
Router::ABSOLUTE_URL
|
||||
);
|
||||
$args['formAction'] = 'admin/coupon/create';
|
||||
@@ -163,9 +115,7 @@ class CouponController extends BaseAdminController
|
||||
*/
|
||||
public function updateAction($couponId)
|
||||
{
|
||||
// Check current user authorization
|
||||
$response = $this->checkAuth(AdminResources::COUPON, array(), AccessManager::UPDATE);
|
||||
if ($response !== null) {
|
||||
if (null !== $response = $this->checkAuth(AdminResources::COUPON, [], AccessManager::UPDATE)) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
@@ -183,18 +133,13 @@ class CouponController extends BaseAdminController
|
||||
$couponManager = $couponFactory->buildCouponFromModel($coupon);
|
||||
|
||||
// Parameters given to the template
|
||||
$args = array();
|
||||
$args = [];
|
||||
|
||||
$i18n = new I18n();
|
||||
/** @var Lang $lang */
|
||||
$lang = $this->getSession()->getLang();
|
||||
$eventToDispatch = TheliaEvents::COUPON_UPDATE;
|
||||
|
||||
// Update
|
||||
if ($this->getRequest()->isMethod('POST')) {
|
||||
$this->validateCreateOrUpdateForm(
|
||||
$i18n,
|
||||
$lang,
|
||||
$eventToDispatch,
|
||||
'updated',
|
||||
'update',
|
||||
@@ -209,7 +154,7 @@ class CouponController extends BaseAdminController
|
||||
$coupon->getSerializedConditions()
|
||||
);
|
||||
|
||||
$data = array(
|
||||
$data = [
|
||||
'code' => $coupon->getCode(),
|
||||
'title' => $coupon->getTitle(),
|
||||
'amount' => $coupon->getAmount(),
|
||||
@@ -217,14 +162,14 @@ class CouponController extends BaseAdminController
|
||||
'shortDescription' => $coupon->getShortDescription(),
|
||||
'description' => $coupon->getDescription(),
|
||||
'isEnabled' => $coupon->getIsEnabled(),
|
||||
'expirationDate' => $coupon->getExpirationDate('Y-m-d'),
|
||||
'expirationDate' => $coupon->getExpirationDate($this->getDefaultDateFormat()),
|
||||
'isAvailableOnSpecialOffers' => $coupon->getIsAvailableOnSpecialOffers(),
|
||||
'isCumulative' => $coupon->getIsCumulative(),
|
||||
'isRemovingPostage' => $coupon->getIsRemovingPostage(),
|
||||
'maxUsage' => $coupon->getMaxUsage(),
|
||||
'conditions' => $conditions,
|
||||
'locale' => $this->getCurrentEditionLocale(),
|
||||
);
|
||||
];
|
||||
|
||||
$args['conditions'] = $this->cleanConditionForTemplate($conditions);
|
||||
|
||||
@@ -234,50 +179,53 @@ class CouponController extends BaseAdminController
|
||||
// Pass it to the parser
|
||||
$this->getParserContext()->addForm($changeForm);
|
||||
}
|
||||
|
||||
$args['couponCode'] = $coupon->getCode();
|
||||
$args['availableCoupons'] = $this->getAvailableCoupons();
|
||||
$args['couponInputsHtml'] = $couponManager->drawBackOfficeInputs();
|
||||
$args['urlAjaxAdminCouponDrawInputs'] = $this->getRoute(
|
||||
'admin.coupon.draw.inputs.ajax',
|
||||
array('couponServiceId' => 'couponServiceId'),
|
||||
['couponServiceId' => 'couponServiceId'],
|
||||
Router::ABSOLUTE_URL
|
||||
);
|
||||
$args['availableConditions'] = $this->getAvailableConditions();
|
||||
$args['urlAjaxGetConditionInputFromServiceId'] = $this->getRoute(
|
||||
'admin.coupon.draw.condition.read.inputs.ajax',
|
||||
array('conditionId' => 'conditionId'),
|
||||
['conditionId' => 'conditionId'],
|
||||
Router::ABSOLUTE_URL
|
||||
);
|
||||
$args['urlAjaxGetConditionInputFromConditionInterface'] = $this->getRoute(
|
||||
'admin.coupon.draw.condition.update.inputs.ajax',
|
||||
array(
|
||||
[
|
||||
'couponId' => $couponId,
|
||||
'conditionIndex' => 8888888
|
||||
),
|
||||
],
|
||||
Router::ABSOLUTE_URL
|
||||
);
|
||||
|
||||
$args['urlAjaxSaveConditions'] = $this->getRoute(
|
||||
'admin.coupon.condition.save',
|
||||
array('couponId' => $couponId),
|
||||
['couponId' => $couponId],
|
||||
Router::ABSOLUTE_URL
|
||||
);
|
||||
$args['urlAjaxDeleteConditions'] = $this->getRoute(
|
||||
'admin.coupon.condition.delete',
|
||||
array(
|
||||
[
|
||||
'couponId' => $couponId,
|
||||
'conditionIndex' => 8888888
|
||||
),
|
||||
],
|
||||
Router::ABSOLUTE_URL
|
||||
);
|
||||
$args['urlAjaxGetConditionSummaries'] = $this->getRoute(
|
||||
'admin.coupon.draw.condition.summaries.ajax',
|
||||
array('couponId' => $couponId),
|
||||
['couponId' => $couponId],
|
||||
Router::ABSOLUTE_URL
|
||||
);
|
||||
|
||||
$args['formAction'] = 'admin/coupon/update/' . $couponId;
|
||||
|
||||
$args['dateFormat'] = $this->getDefaultDateFormat();
|
||||
|
||||
return $this->render('coupon-update', $args);
|
||||
}
|
||||
|
||||
@@ -290,31 +238,44 @@ class CouponController extends BaseAdminController
|
||||
*/
|
||||
public function getConditionEmptyInputAjaxAction($conditionId)
|
||||
{
|
||||
$this->checkAuth(AdminResources::COUPON, array(), AccessManager::VIEW);
|
||||
if (null !== $response = $this->checkAuth(AdminResources::COUPON, [], AccessManager::VIEW)) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
$this->checkXmlHttpRequest();
|
||||
|
||||
/** @var ConditionFactory $conditionFactory */
|
||||
$conditionFactory = $this->container->get('thelia.condition.factory');
|
||||
$inputs = $conditionFactory->getInputsFromServiceId($conditionId);
|
||||
if (!$this->container->has($conditionId)) {
|
||||
return false;
|
||||
if (! empty($conditionId)) {
|
||||
|
||||
/** @var ConditionFactory $conditionFactory */
|
||||
$conditionFactory = $this->container->get('thelia.condition.factory');
|
||||
$inputs = $conditionFactory->getInputsFromServiceId($conditionId);
|
||||
|
||||
if (!$this->container->has($conditionId)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($inputs === null) {
|
||||
return $this->pageNotFound();
|
||||
}
|
||||
|
||||
/** @var ConditionInterface $condition */
|
||||
$condition = $this->container->get($conditionId);
|
||||
|
||||
$html = $condition->drawBackOfficeInputs();
|
||||
$serviceId = $condition->getServiceId();
|
||||
}
|
||||
|
||||
/** @var ConditionInterface $condition */
|
||||
$condition = $this->container->get($conditionId);
|
||||
|
||||
if ($inputs === null) {
|
||||
return $this->pageNotFound();
|
||||
else {
|
||||
$html = '';
|
||||
$serviceId = '';
|
||||
}
|
||||
|
||||
return $this->render(
|
||||
'coupon/condition-input-ajax',
|
||||
array(
|
||||
'inputsDrawn' => $condition->drawBackOfficeInputs(),
|
||||
'conditionServiceId' => $condition->getServiceId(),
|
||||
'conditionIndex' => -1,
|
||||
)
|
||||
[
|
||||
'inputsDrawn' => $html,
|
||||
'conditionServiceId' => $serviceId,
|
||||
'conditionIndex' => ''
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@@ -328,7 +289,9 @@ class CouponController extends BaseAdminController
|
||||
*/
|
||||
public function getConditionToUpdateInputAjaxAction($couponId, $conditionIndex)
|
||||
{
|
||||
$this->checkAuth(AdminResources::COUPON, array(), AccessManager::VIEW);
|
||||
if (null !== $response = $this->checkAuth(AdminResources::COUPON, [], AccessManager::VIEW)) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
$this->checkXmlHttpRequest();
|
||||
|
||||
@@ -363,13 +326,11 @@ class CouponController extends BaseAdminController
|
||||
}
|
||||
|
||||
return $this->render(
|
||||
'coupon/condition-input-ajax',
|
||||
array(
|
||||
'coupon/condition-input-ajax', [
|
||||
'inputsDrawn' => $condition->drawBackOfficeInputs(),
|
||||
'conditionServiceId' => $condition->getServiceId(),
|
||||
'conditionIndex' => $conditionIndex,
|
||||
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@@ -382,7 +343,9 @@ class CouponController extends BaseAdminController
|
||||
*/
|
||||
public function saveConditionsAction($couponId)
|
||||
{
|
||||
$this->checkAuth(AdminResources::COUPON, array(), AccessManager::VIEW);
|
||||
if (null !== $response = $this->checkAuth(AdminResources::COUPON, [], AccessManager::UPDATE)) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
$this->checkXmlHttpRequest();
|
||||
|
||||
@@ -429,7 +392,9 @@ class CouponController extends BaseAdminController
|
||||
*/
|
||||
public function deleteConditionsAction($couponId, $conditionIndex)
|
||||
{
|
||||
$this->checkAuth(AdminResources::COUPON, array(), AccessManager::VIEW);
|
||||
if (null !== $response = $this->checkAuth(AdminResources::COUPON, [], AccessManager::UPDATE)) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
$this->checkXmlHttpRequest();
|
||||
|
||||
@@ -457,41 +422,6 @@ class CouponController extends BaseAdminController
|
||||
return new Response();
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a Coupon from its form
|
||||
*
|
||||
* @param array $data Form data
|
||||
*
|
||||
* @return Coupon
|
||||
*/
|
||||
protected function buildCouponFromForm(array $data)
|
||||
{
|
||||
$couponBeingCreated = new Coupon();
|
||||
$couponBeingCreated->setCode($data['code']);
|
||||
$couponBeingCreated->setType($data['type']);
|
||||
$couponBeingCreated->setTitle($data['title']);
|
||||
$couponBeingCreated->setShortDescription($data['shortDescription']);
|
||||
$couponBeingCreated->setDescription($data['description']);
|
||||
$couponBeingCreated->setAmount($data['amount']);
|
||||
$couponBeingCreated->setIsEnabled($data['isEnabled']);
|
||||
$couponBeingCreated->setExpirationDate($data['expirationDate']);
|
||||
$couponBeingCreated->setSerializedConditions(
|
||||
new ConditionCollection(
|
||||
array()
|
||||
)
|
||||
);
|
||||
$couponBeingCreated->setIsCumulative($data['isCumulative']);
|
||||
$couponBeingCreated->setIsRemovingPostage(
|
||||
$data['isRemovingPostage']
|
||||
);
|
||||
$couponBeingCreated->setMaxUsage($data['maxUsage']);
|
||||
$couponBeingCreated->setIsAvailableOnSpecialOffers(
|
||||
$data['isAvailableOnSpecialOffers']
|
||||
);
|
||||
|
||||
return $couponBeingCreated;
|
||||
}
|
||||
|
||||
/**
|
||||
* Log error message
|
||||
*
|
||||
@@ -517,8 +447,6 @@ class CouponController extends BaseAdminController
|
||||
/**
|
||||
* Validate the CreateOrUpdate form
|
||||
*
|
||||
* @param I18n $i18n Local code (fr_FR)
|
||||
* @param Lang $lang Local variables container
|
||||
* @param string $eventToDispatch Event which will activate actions
|
||||
* @param string $log created|edited
|
||||
* @param string $action creation|edition
|
||||
@@ -526,15 +454,15 @@ class CouponController extends BaseAdminController
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
protected function validateCreateOrUpdateForm(I18n $i18n, Lang $lang, $eventToDispatch, $log, $action, Coupon $model = null)
|
||||
protected function validateCreateOrUpdateForm($eventToDispatch, $log, $action, Coupon $model = null)
|
||||
{
|
||||
// Create the form from the request
|
||||
$creationForm = new CouponCreationForm($this->getRequest());
|
||||
$couponForm = new CouponCreationForm($this->getRequest());
|
||||
|
||||
$message = false;
|
||||
try {
|
||||
// Check the form against conditions violations
|
||||
$form = $this->validateForm($creationForm, 'POST');
|
||||
$form = $this->validateForm($couponForm, 'POST');
|
||||
|
||||
$couponEvent = $this->feedCouponCreateOrUpdateEvent($form, $model);
|
||||
|
||||
@@ -553,31 +481,39 @@ class CouponController extends BaseAdminController
|
||||
)
|
||||
);
|
||||
|
||||
$this->redirect(
|
||||
str_replace(
|
||||
'{id}',
|
||||
$couponEvent->getCouponModel()->getId(),
|
||||
$creationForm->getSuccessUrl()
|
||||
)
|
||||
);
|
||||
if ($this->getRequest()->get('save_mode') == 'stay') {
|
||||
$this->redirect(
|
||||
str_replace(
|
||||
'{id}',
|
||||
$couponEvent->getCouponModel()->getId(),
|
||||
$couponForm->getSuccessUrl()
|
||||
)
|
||||
);
|
||||
|
||||
} catch (FormValidationException $e) {
|
||||
exit();
|
||||
}
|
||||
|
||||
// Redirect to the success URL
|
||||
$this->redirectToRoute('admin.coupon.list');
|
||||
|
||||
} catch (FormValidationException $ex) {
|
||||
// Invalid data entered
|
||||
$message = 'Please check your input:';
|
||||
$message = $this->createStandardFormValidationErrorMessage($ex);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
} catch (\Exception $ex) {
|
||||
// Any other error
|
||||
$message = 'Sorry, an error occurred:';
|
||||
$this->logError($action, $message, $e);
|
||||
$message = $this->getTranslator()->trans('Sorry, an error occurred: %err', ['%err' => $ex->getMessage()]);
|
||||
|
||||
$this->logError($action, $message, $ex);
|
||||
}
|
||||
|
||||
if ($message !== false) {
|
||||
// Mark the form as with error
|
||||
$creationForm->setErrorMessage($message);
|
||||
$couponForm->setErrorMessage($message);
|
||||
|
||||
// Send the form and the error to the parser
|
||||
$this->getParserContext()
|
||||
->addForm($creationForm)
|
||||
->addForm($couponForm)
|
||||
->setGeneralError($message);
|
||||
}
|
||||
|
||||
@@ -594,10 +530,10 @@ class CouponController extends BaseAdminController
|
||||
/** @var CouponManager $couponManager */
|
||||
$couponManager = $this->container->get('thelia.coupon.manager');
|
||||
$availableConditions = $couponManager->getAvailableConditions();
|
||||
$cleanedConditions = array();
|
||||
$cleanedConditions = [];
|
||||
/** @var ConditionInterface $availableCondition */
|
||||
foreach ($availableConditions as $availableCondition) {
|
||||
$condition = array();
|
||||
$condition = [];
|
||||
$condition['serviceId'] = $availableCondition->getServiceId();
|
||||
$condition['name'] = $availableCondition->getName();
|
||||
$condition['toolTip'] = $availableCondition->getToolTip();
|
||||
@@ -617,10 +553,10 @@ class CouponController extends BaseAdminController
|
||||
/** @var CouponManager $couponManager */
|
||||
$couponManager = $this->container->get('thelia.coupon.manager');
|
||||
$availableCoupons = $couponManager->getAvailableCoupons();
|
||||
$cleanedCoupons = array();
|
||||
$cleanedCoupons = [];
|
||||
/** @var CouponInterface $availableCoupon */
|
||||
foreach ($availableCoupons as $availableCoupon) {
|
||||
$condition = array();
|
||||
$condition = [];
|
||||
$condition['serviceId'] = $availableCoupon->getServiceId();
|
||||
$condition['name'] = $availableCoupon->getName();
|
||||
$condition['toolTip'] = $availableCoupon->getToolTip();
|
||||
@@ -640,17 +576,17 @@ class CouponController extends BaseAdminController
|
||||
*/
|
||||
protected function cleanConditionForTemplate(ConditionCollection $conditions)
|
||||
{
|
||||
$cleanedConditions = array();
|
||||
$cleanedConditions = [];
|
||||
/** @var $condition ConditionInterface */
|
||||
foreach ($conditions as $index => $condition) {
|
||||
$temp = array(
|
||||
$temp = [
|
||||
'serviceId' => $condition->getServiceId(),
|
||||
'index' => $index,
|
||||
'name' => $condition->getName(),
|
||||
'toolTip' => $condition->getToolTip(),
|
||||
'summary' => $condition->getSummary(),
|
||||
'validators' => $condition->getValidators()
|
||||
);
|
||||
];
|
||||
$cleanedConditions[] = $temp;
|
||||
}
|
||||
|
||||
@@ -667,7 +603,10 @@ class CouponController extends BaseAdminController
|
||||
*/
|
||||
public function getBackOfficeInputsAjaxAction($couponServiceId)
|
||||
{
|
||||
$this->checkAuth(AdminResources::COUPON, array(), AccessManager::VIEW);
|
||||
if (null !== $response = $this->checkAuth(AdminResources::COUPON, [], AccessManager::VIEW)) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
$this->checkXmlHttpRequest();
|
||||
|
||||
/** @var CouponInterface $coupon */
|
||||
@@ -692,7 +631,10 @@ class CouponController extends BaseAdminController
|
||||
*/
|
||||
public function getBackOfficeConditionSummariesAjaxAction($couponId)
|
||||
{
|
||||
$this->checkAuth(AdminResources::COUPON, array(), AccessManager::VIEW);
|
||||
if (null !== $response = $this->checkAuth(AdminResources::COUPON, [], AccessManager::VIEW)) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
$this->checkXmlHttpRequest();
|
||||
|
||||
/** @var Coupon $coupon */
|
||||
@@ -710,7 +652,7 @@ class CouponController extends BaseAdminController
|
||||
return $this->pageNotFound();
|
||||
}
|
||||
|
||||
$args = array();
|
||||
$args = [];
|
||||
$args['conditions'] = $this->cleanConditionForTemplate($couponManager->getConditions());
|
||||
|
||||
return $this->render('coupon/conditions', $args);
|
||||
@@ -761,7 +703,7 @@ class CouponController extends BaseAdminController
|
||||
$serviceId = $data['type'];
|
||||
/** @var CouponInterface $couponManager */
|
||||
$couponManager = $this->container->get($serviceId);
|
||||
$effects = array(CouponAbstract::INPUT_AMOUNT_NAME => $data[CouponAbstract::INPUT_AMOUNT_NAME]);
|
||||
$effects = [CouponAbstract::INPUT_AMOUNT_NAME => $data[CouponAbstract::INPUT_AMOUNT_NAME]];
|
||||
$effects = $this->addExtendedLogic($effects, $couponManager->getExtendedInputs());
|
||||
|
||||
$couponEvent = new CouponCreateOrUpdateEvent(
|
||||
@@ -772,7 +714,7 @@ class CouponController extends BaseAdminController
|
||||
$data['shortDescription'],
|
||||
$data['description'],
|
||||
$data['isEnabled'],
|
||||
\DateTime::createFromFormat('Y-m-d', $data['expirationDate']),
|
||||
\DateTime::createFromFormat($this->getDefaultDateFormat(), $data['expirationDate']),
|
||||
$data['isAvailableOnSpecialOffers'],
|
||||
$data['isCumulative'],
|
||||
$data['isRemovingPostage'],
|
||||
@@ -798,8 +740,8 @@ class CouponController extends BaseAdminController
|
||||
$request = $this->getRequest();
|
||||
$post = $request->request->getIterator();
|
||||
$serviceId = $request->request->get('categoryCondition');
|
||||
$operators = array();
|
||||
$values = array();
|
||||
$operators = [];
|
||||
$values = [];
|
||||
foreach ($post as $key => $input) {
|
||||
if (isset($input['operator']) && isset($input['value'])) {
|
||||
$operators[$key] = $input['operator'];
|
||||
@@ -857,4 +799,8 @@ class CouponController extends BaseAdminController
|
||||
);
|
||||
}
|
||||
|
||||
protected function getDefaultDateFormat()
|
||||
{
|
||||
return LangQuery::create()->findOneByByDefault(true)->getDateFormat();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,9 @@ use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||
use Thelia\Coupon\Type\CouponInterface;
|
||||
use Thelia\Model\Coupon as MCoupon;
|
||||
use Thelia\Model\CouponQuery;
|
||||
use Thelia\Model\Map\CouponTableMap;
|
||||
use Thelia\Type\EnumListType;
|
||||
use Thelia\Type\TypeCollection;
|
||||
|
||||
/**
|
||||
* Coupon Loop
|
||||
@@ -44,7 +47,23 @@ class Coupon extends BaseI18nLoop implements PropelSearchLoopInterface
|
||||
{
|
||||
return new ArgumentCollection(
|
||||
Argument::createIntListTypeArgument('id'),
|
||||
Argument::createBooleanOrBothTypeArgument('is_enabled')
|
||||
Argument::createBooleanOrBothTypeArgument('is_enabled'),
|
||||
new Argument(
|
||||
'order',
|
||||
new TypeCollection(
|
||||
new EnumListType(array(
|
||||
'id', 'id-reverse',
|
||||
'code', 'code-reverse',
|
||||
'title', 'title-reverse',
|
||||
'enabled', 'enabled-reverse',
|
||||
'expiration-date', 'expiration-date-reverse',
|
||||
'days-left', 'days-left-reverse',
|
||||
'usages-left', 'usages-left-reverse'
|
||||
)
|
||||
)
|
||||
),
|
||||
'code'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -66,6 +85,63 @@ class Coupon extends BaseI18nLoop implements PropelSearchLoopInterface
|
||||
$search->filterByIsEnabled($isEnabled ? true : false);
|
||||
}
|
||||
|
||||
$search->addAsColumn('days_left', 'DATEDIFF('.CouponTableMap::EXPIRATION_DATE.', CURDATE()) - 1');
|
||||
|
||||
$orders = $this->getOrder();
|
||||
|
||||
foreach ($orders as $order) {
|
||||
switch ($order) {
|
||||
case 'id':
|
||||
$search->orderById(Criteria::ASC);
|
||||
break;
|
||||
case 'id-reverse':
|
||||
$search->orderById(Criteria::DESC);
|
||||
break;
|
||||
|
||||
case 'code':
|
||||
$search->orderByCode(Criteria::ASC);
|
||||
break;
|
||||
case 'code-reverse':
|
||||
$search->orderByCode(Criteria::DESC);
|
||||
break;
|
||||
|
||||
case 'title':
|
||||
$search->addAscendingOrderByColumn('i18n_TITLE');
|
||||
break;
|
||||
case 'title-reverse':
|
||||
$search->addDescendingOrderByColumn('i18n_TITLE');
|
||||
break;
|
||||
|
||||
case 'enabled':
|
||||
$search->orderByIsEnabled(Criteria::ASC);
|
||||
break;
|
||||
case 'enabled-reverse':
|
||||
$search->orderByIsEnabled(Criteria::DESC);
|
||||
break;
|
||||
|
||||
case 'expiration-date':
|
||||
$search->orderByExpirationDate(Criteria::ASC);
|
||||
break;
|
||||
case 'expiration-date-reverse':
|
||||
$search->orderByExpirationDate(Criteria::DESC);
|
||||
break;
|
||||
|
||||
case 'usages-left':
|
||||
$search->orderByMaxUsage(Criteria::ASC);
|
||||
break;
|
||||
case 'usages-left-reverse':
|
||||
$search->orderByMaxUsage(Criteria::DESC);
|
||||
break;
|
||||
|
||||
case 'days-left':
|
||||
$search->addAscendingOrderByColumn('days_left');
|
||||
break;
|
||||
case 'days-left-reverse':
|
||||
$search->addDescendingOrderByColumn('days_left');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $search;
|
||||
}
|
||||
|
||||
@@ -81,7 +157,9 @@ class Coupon extends BaseI18nLoop implements PropelSearchLoopInterface
|
||||
|
||||
/** @var MCoupon $coupon */
|
||||
foreach ($loopResult->getResultDataCollection() as $coupon) {
|
||||
|
||||
$loopResultRow = new LoopResultRow($coupon);
|
||||
|
||||
$conditions = $conditionFactory->unserializeConditionCollection(
|
||||
$coupon->getSerializedConditions()
|
||||
);
|
||||
@@ -103,10 +181,6 @@ class Coupon extends BaseI18nLoop implements PropelSearchLoopInterface
|
||||
$coupon->getExpirationDate()
|
||||
);
|
||||
|
||||
$now = time();
|
||||
$datediff = $coupon->getExpirationDate()->getTimestamp() - $now;
|
||||
$daysLeftBeforeExpiration = floor($datediff/(60*60*24));
|
||||
|
||||
$cleanedConditions = array();
|
||||
/** @var ConditionInterface $condition */
|
||||
foreach ($conditions as $condition) {
|
||||
@@ -116,14 +190,16 @@ class Coupon extends BaseI18nLoop implements PropelSearchLoopInterface
|
||||
);
|
||||
$cleanedConditions[] = $temp;
|
||||
}
|
||||
$loopResultRow->set("ID", $coupon->getId())
|
||||
|
||||
$loopResultRow
|
||||
->set("ID", $coupon->getId())
|
||||
->set("IS_TRANSLATED", $coupon->getVirtualColumn('IS_TRANSLATED'))
|
||||
->set("LOCALE", $this->locale)
|
||||
->set("CODE", $coupon->getCode())
|
||||
->set("TITLE", $coupon->getVirtualColumn('i18n_TITLE'))
|
||||
->set("SHORT_DESCRIPTION", $coupon->getVirtualColumn('i18n_SHORT_DESCRIPTION'))
|
||||
->set("DESCRIPTION", $coupon->getVirtualColumn('i18n_DESCRIPTION'))
|
||||
->set("EXPIRATION_DATE", $coupon->getExpirationDate($lang->getDateFormat()))
|
||||
->set("EXPIRATION_DATE", $coupon->getExpirationDate())
|
||||
->set("USAGE_LEFT", $coupon->getMaxUsage())
|
||||
->set("IS_CUMULATIVE", $coupon->getIsCumulative())
|
||||
->set("IS_REMOVING_POSTAGE", $coupon->getIsRemovingPostage())
|
||||
@@ -132,7 +208,7 @@ class Coupon extends BaseI18nLoop implements PropelSearchLoopInterface
|
||||
->set("AMOUNT", $coupon->getAmount())
|
||||
->set("APPLICATION_CONDITIONS", $cleanedConditions)
|
||||
->set("TOOLTIP", $couponManager->getToolTip())
|
||||
->set("DAY_LEFT_BEFORE_EXPIRATION", $daysLeftBeforeExpiration)
|
||||
->set("DAY_LEFT_BEFORE_EXPIRATION", max(0, $coupon->getVirtualColumn('days_left')))
|
||||
->set("SERVICE_ID", $couponManager->getServiceId());
|
||||
$loopResult->addRow($loopResultRow);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -350,22 +350,16 @@ abstract class CouponAbstract implements CouponInterface
|
||||
/**
|
||||
* Draw the input displayed in the BackOffice
|
||||
* allowing Admin to set its Coupon effect
|
||||
* Override this method to do something useful
|
||||
*
|
||||
* @return string HTML string
|
||||
*/
|
||||
public function drawBackOfficeInputs()
|
||||
{
|
||||
$label = $this->getInputName();
|
||||
$value = $this->amount;
|
||||
|
||||
$html = '
|
||||
<div class="form-group input-' . self::INPUT_AMOUNT_NAME . ' ">
|
||||
<label for="' . self::INPUT_AMOUNT_NAME . '" class="control-label">' . $label . '</label>
|
||||
<input id="' . self::INPUT_AMOUNT_NAME . '" type="text" class="form-control" name="thelia_coupon_creation[' . self::INPUT_AMOUNT_NAME . ']" value="' . $value . '" placeholder="14.50">
|
||||
</div>
|
||||
';
|
||||
|
||||
return $html;
|
||||
public function drawBackOfficeInputs() {
|
||||
return $this->facade->getParser()->render('coupon/type-fragments/remove-x.html', [
|
||||
'label' => $this->getInputName(),
|
||||
'fieldName' => self::INPUT_AMOUNT_NAME,
|
||||
'value' => $this->amount
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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,11 +58,20 @@ 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'
|
||||
);
|
||||
|
||||
return $toolTip;
|
||||
}
|
||||
|
||||
public function drawBackOfficeInputs()
|
||||
{
|
||||
return $this->facade->getParser()->render('coupon/type-fragments/remove-x-amount.html', [
|
||||
'label' => $this->getInputName(),
|
||||
'fieldName' => self::INPUT_AMOUNT_NAME,
|
||||
'value' => $this->amount
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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'
|
||||
);
|
||||
@@ -145,17 +145,12 @@ class RemoveXPercent extends CouponAbstract
|
||||
*/
|
||||
public function drawBackOfficeInputs()
|
||||
{
|
||||
$labelPercentage = $this->getInputName();
|
||||
|
||||
$html = '
|
||||
<input type="hidden" name="thelia_coupon_creation[' . self::INPUT_AMOUNT_NAME . ']" value="0"/>
|
||||
<div class="form-group input-' . self::INPUT_PERCENTAGE_NAME . '">
|
||||
<label for="' . self::INPUT_PERCENTAGE_NAME . '" class="control-label">' . $labelPercentage . '</label>
|
||||
<input id="' . self::INPUT_PERCENTAGE_NAME . '" class="form-control" name="' . self::INPUT_EXTENDED__NAME . '[' . self::INPUT_PERCENTAGE_NAME . ']' . '" type="text" value="' . $this->percentage . '"/>
|
||||
</div>
|
||||
';
|
||||
|
||||
return $html;
|
||||
return $this->facade->getParser()->render('coupon/type-fragments/remove-x-percent.html', [
|
||||
'label' => $this->getInputName(),
|
||||
'typeKey' => self::INPUT_AMOUNT_NAME,
|
||||
'fieldId' => self::INPUT_PERCENTAGE_NAME,
|
||||
'fieldName' => self::INPUT_EXTENDED__NAME,
|
||||
'value' => $this->percentage
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,10 +12,13 @@
|
||||
|
||||
namespace Thelia\Form;
|
||||
|
||||
use Symfony\Component\Validator\Constraints\Date;
|
||||
use Symfony\Component\Validator\Constraints\Callback;
|
||||
use Symfony\Component\Validator\Constraints\GreaterThanOrEqual;
|
||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||
use Symfony\Component\Validator\Constraints\NotEqualTo;
|
||||
use Symfony\Component\Validator\ExecutionContextInterface;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
use Thelia\Model\Base\LangQuery;
|
||||
|
||||
/**
|
||||
* Allow to build a form Coupon
|
||||
@@ -95,7 +98,11 @@ class CouponCreationForm extends BaseForm
|
||||
array(
|
||||
'constraints' => array(
|
||||
new NotBlank(),
|
||||
new Date()
|
||||
new Callback(array(
|
||||
"methods" => array(
|
||||
array($this, "checkLocalizedDate"),
|
||||
),
|
||||
))
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -120,11 +127,7 @@ class CouponCreationForm extends BaseForm
|
||||
array(
|
||||
'constraints' => array(
|
||||
new NotBlank(),
|
||||
new GreaterThanOrEqual(
|
||||
array(
|
||||
'value' => -1
|
||||
)
|
||||
)
|
||||
new GreaterThanOrEqual(['value' => -1])
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -139,6 +142,24 @@ class CouponCreationForm extends BaseForm
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate a date entered with the default Language date format.
|
||||
*
|
||||
* @param string $value
|
||||
* @param ExecutionContextInterface $context
|
||||
*/
|
||||
public function checkLocalizedDate($value, ExecutionContextInterface $context)
|
||||
{
|
||||
$format = LangQuery::create()->findOneByByDefault(true)->getDateFormat();
|
||||
|
||||
if (false === \DateTime::createFromFormat($format, $value)) {
|
||||
$context->addViolation(Translator::getInstance()->trans("Date '%date' is invalid, please enter a valid date using %fmt format", [
|
||||
'%fmt' => $format,
|
||||
'%date' => $value
|
||||
]));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get form name
|
||||
*
|
||||
|
||||
@@ -64,7 +64,8 @@ class Coupon extends BaseCoupon
|
||||
*/
|
||||
public function createOrUpdate($code, $title, array $effects, $type, $isRemovingPostage, $shortDescription, $description, $isEnabled, $expirationDate, $isAvailableOnSpecialOffers, $isCumulative, $maxUsage, $defaultSerializedRule, $locale = null)
|
||||
{
|
||||
$this->setCode($code)
|
||||
$this
|
||||
->setCode($code)
|
||||
->setType($type)
|
||||
->setEffects($effects)
|
||||
->setIsRemovingPostage($isRemovingPostage)
|
||||
@@ -72,8 +73,9 @@ class Coupon extends BaseCoupon
|
||||
->setExpirationDate($expirationDate)
|
||||
->setIsAvailableOnSpecialOffers($isAvailableOnSpecialOffers)
|
||||
->setIsCumulative($isCumulative)
|
||||
->setMaxUsage($maxUsage);
|
||||
$this->setTitle($title)
|
||||
->setMaxUsage($maxUsage)
|
||||
->setLocale($locale)
|
||||
->setTitle($title)
|
||||
->setShortDescription($shortDescription)
|
||||
->setDescription($description);
|
||||
|
||||
@@ -82,21 +84,7 @@ class Coupon extends BaseCoupon
|
||||
$this->setSerializedConditions($defaultSerializedRule);
|
||||
}
|
||||
|
||||
// Set object language (i18n)
|
||||
if (!is_null($locale)) {
|
||||
$this->setLocale($locale);
|
||||
}
|
||||
|
||||
$con = Propel::getWriteConnection(CouponTableMap::DATABASE_NAME);
|
||||
$con->beginTransaction();
|
||||
try {
|
||||
$this->save($con);
|
||||
$con->commit();
|
||||
|
||||
} catch (\Exception $e) {
|
||||
$con->rollback();
|
||||
throw $e;
|
||||
}
|
||||
$this->save();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -116,15 +104,7 @@ class Coupon extends BaseCoupon
|
||||
$this->setLocale($locale);
|
||||
}
|
||||
|
||||
$con = Propel::getWriteConnection(CouponTableMap::DATABASE_NAME);
|
||||
$con->beginTransaction();
|
||||
try {
|
||||
$this->save($con);
|
||||
$con->commit();
|
||||
} catch (\Exception $e) {
|
||||
$con->rollback();
|
||||
throw $e;
|
||||
}
|
||||
$this->save();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -44,35 +44,35 @@ class OperatorsTest extends \PHPUnit_Framework_TestCase
|
||||
->will($this->returnCallback((array($this, 'callbackI18n'))));
|
||||
|
||||
$actual = Operators::getI18n($stubTranslator, Operators::INFERIOR);
|
||||
$expected = 'inferior to';
|
||||
$expected = 'Less than';
|
||||
$this->assertEquals($expected, $actual);
|
||||
|
||||
$actual = Operators::getI18n($stubTranslator, Operators::INFERIOR_OR_EQUAL);
|
||||
$expected = 'inferior or equal to';
|
||||
$expected = 'Less than or equals';
|
||||
$this->assertEquals($expected, $actual);
|
||||
|
||||
$actual = Operators::getI18n($stubTranslator, Operators::EQUAL);
|
||||
$expected = 'equal to';
|
||||
$expected = 'Equals';
|
||||
$this->assertEquals($expected, $actual);
|
||||
|
||||
$actual = Operators::getI18n($stubTranslator, Operators::SUPERIOR_OR_EQUAL);
|
||||
$expected = 'superior or equal to';
|
||||
$expected = 'Greater than or equals';
|
||||
$this->assertEquals($expected, $actual);
|
||||
|
||||
$actual = Operators::getI18n($stubTranslator, Operators::SUPERIOR);
|
||||
$expected = 'superior to';
|
||||
$expected = 'Greater than';
|
||||
$this->assertEquals($expected, $actual);
|
||||
|
||||
$actual = Operators::getI18n($stubTranslator, Operators::DIFFERENT);
|
||||
$expected = 'different from';
|
||||
$expected = 'Not equals';
|
||||
$this->assertEquals($expected, $actual);
|
||||
|
||||
$actual = Operators::getI18n($stubTranslator, Operators::IN);
|
||||
$expected = 'in';
|
||||
$expected = 'In';
|
||||
$this->assertEquals($expected, $actual);
|
||||
|
||||
$actual = Operators::getI18n($stubTranslator, Operators::OUT);
|
||||
$expected = 'not in';
|
||||
$expected = 'Not in';
|
||||
$this->assertEquals($expected, $actual);
|
||||
|
||||
$actual = Operators::getI18n($stubTranslator, 'unexpected operator');
|
||||
|
||||
@@ -502,6 +502,7 @@ try {
|
||||
|
||||
} catch (Exception $e) {
|
||||
echo "error : ".$e->getMessage()."\n";
|
||||
echo $e->getTraceAsString();
|
||||
$con->rollBack();
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ return array(
|
||||
'Actions' => 'Actions',
|
||||
'Activate this log destination' => 'Activer cette destination',
|
||||
'Add' => 'Ajouter',
|
||||
'Add a condition' => 'Ajouter une condition',
|
||||
'Add a new Customer' => 'Ajouter un client',
|
||||
'Add a new address' => 'Ajouter une nouvelle adresse',
|
||||
'Add a new category' => 'Ajouter une catégorie',
|
||||
@@ -60,7 +61,6 @@ return array(
|
||||
'Amount' => 'Montant',
|
||||
'An error occured' => 'Une erreur est survenue',
|
||||
'And' => 'Et',
|
||||
'Application field' => 'Champs d\'application',
|
||||
'Apply' => 'Appliquer',
|
||||
'Associated countries' => 'Pays dans la zone',
|
||||
'Associations' => 'Associations',
|
||||
@@ -83,7 +83,6 @@ return array(
|
||||
'Browse files' => 'Parcourir les fichiers',
|
||||
'Browse this category' => 'Parcourir cette catégorie',
|
||||
'Browse this folder' => 'Parcourir ce dossier',
|
||||
'Can\'t be cumulative' => 'Ne peut pas se cumuler',
|
||||
'Can\'t load documents, please refresh this page.' => 'Impossible de charger les documents. Rechargez la page',
|
||||
'Can\'t load images, please refresh this page.' => 'Impossible de charger l\'image. Rechargez la page',
|
||||
'Can\'t reorder documents, please refresh this page.' => 'Impossible de trier les documents. Rechargez la page',
|
||||
@@ -101,7 +100,9 @@ return array(
|
||||
'Cellular phone number' => 'Numéro de portable',
|
||||
'Change this administrator' => 'Modifier cet administrateur',
|
||||
'Change this attribute' => 'Modifier cette déclinaison',
|
||||
'Change this condition' => 'Modifier cette condition',
|
||||
'Change this country' => 'Modifier ce pays',
|
||||
'Change this coupon' => 'Modifier ce code promo',
|
||||
'Change this currency' => 'Modifier cette devise',
|
||||
'Change this feature' => 'Modifier cette caractéristique',
|
||||
'Change this language' => 'Modifier cette langue',
|
||||
@@ -125,13 +126,13 @@ return array(
|
||||
'Close' => 'Fermer',
|
||||
'Close administation session' => 'Quitter l\'interface d\'administration',
|
||||
'Code' => 'Code',
|
||||
'Code :' => 'Code : ',
|
||||
'Combinable with other promotions' => 'Cumulable avec d\'autres promotions',
|
||||
'Combination EAN Code' => 'Combinaison de code EAN',
|
||||
'Combination builder' => 'Générateur de combinaison',
|
||||
'Combination reference' => 'Référence de la combinaison',
|
||||
'Company' => 'Entreprise',
|
||||
'Condition\'s category :' => 'Rubrique de la condition',
|
||||
'Conditions' => 'Conditions',
|
||||
'Condition category :' => 'Catégorie de condition',
|
||||
'Condition description' => 'Type de condition',
|
||||
'Configuration' => 'Configuration',
|
||||
'Configuration mailing system' => 'Configuration du système de mailing',
|
||||
'Configure' => 'Configurer',
|
||||
@@ -151,8 +152,10 @@ return array(
|
||||
'Country title' => 'Titre du pays',
|
||||
'Coupon' => 'Code promo',
|
||||
'Coupon code' => 'Code promo',
|
||||
'Coupon code * :' => 'Code promo * :',
|
||||
'Coupon conditions' => 'Conditions d\'utilisation',
|
||||
'Coupon type * :' => 'Type de promotion * :',
|
||||
'Coupons' => 'Codes promo',
|
||||
'Coupons : ' => 'Codes promo : ',
|
||||
'Create' => 'Créer',
|
||||
'Create a customer address' => 'Créer une adresse',
|
||||
'Create a new administrator' => 'Créer un nouvel administrateur',
|
||||
@@ -249,6 +252,7 @@ return array(
|
||||
'Delete this attribute' => 'Supprimer cette déclinaison',
|
||||
'Delete this category and all its contents' => 'Supprimer cette rubrique et tout ce qu\'elle contient ?',
|
||||
'Delete this combination' => 'Supprimer cette combinaison',
|
||||
'Delete this condition' => 'Supprimer cette condition',
|
||||
'Delete this content' => 'Supprimer ce contenu',
|
||||
'Delete this country' => 'Supprimer ce pays',
|
||||
'Delete this currency' => 'Supprimer cette devise',
|
||||
@@ -275,7 +279,7 @@ return array(
|
||||
'Description' => 'Description',
|
||||
'Destinations' => 'Destinations',
|
||||
'Details' => 'Détails',
|
||||
'Disabled coupons' => 'Codes promo désactivés',
|
||||
'Disabled' => 'Désactivé',
|
||||
'Discount' => 'Remise',
|
||||
'Do not use a product template' => 'Ne pas utiliser de gabarit',
|
||||
'Do you really want to add this attribute to all product templates ?' => 'Voulez-vous vraiment ajouter cette déclinaison de tous les gabarits de produit ?',
|
||||
@@ -287,6 +291,7 @@ return array(
|
||||
'Do you really want to delete this attribute value ?' => 'Voulez-vous vraiment supprimer cette déclinaison ?',
|
||||
'Do you really want to delete this category and all its content ?' => 'Voulez-vous vraiment supprimer cette rubrique et tout ce qu\'elle contient ?',
|
||||
'Do you really want to delete this combination ?' => 'Voulez-vous vraiment supprimer cette combinaison ?',
|
||||
'Do you really want to delete this condition ?' => 'Supprimer cette condition ?',
|
||||
'Do you really want to delete this content ?' => 'Voulez-vous vraiment supprimer ce contenu ?',
|
||||
'Do you really want to delete this country ?' => 'Voulez-vous vraiment supprimer ce pays ?',
|
||||
'Do you really want to delete this currency ?' => 'Voulez-vous vraiment supprimer cette devise ?',
|
||||
@@ -295,6 +300,7 @@ return array(
|
||||
'Do you really want to delete this feature ? It will be removed from all product templates.' => 'Voulez-vous vraiment supprimer cette caractéristique ? Elle sera supprimée de tous les gabarits de produit',
|
||||
'Do you really want to delete this feature value ?' => 'Voulez-vous vraiment supprimer cette valeur de caractéristique ?',
|
||||
'Do you really want to delete this folder and all its content ?' => 'Voulez-vous vraiment supprimer ce dossier et tous ses contenus ?',
|
||||
'Do you really want to delete this image ?' => 'Confirmez-vous la suppression de cette image ?',
|
||||
'Do you really want to delete this language ?' => 'Voulez-vous vraiment supprimer cette langue ?',
|
||||
'Do you really want to delete this mailing template ?' => 'Voulez-vous vraiment supprimer ce template de mailing ?',
|
||||
'Do you really want to delete this module ?' => 'Voulez-vous vraiment supprimer ce module ?',
|
||||
@@ -305,7 +311,6 @@ return array(
|
||||
'Do you really want to delete this tax rule ?' => 'Voulez-vous vraiment supprimer cette règle de taxe ?',
|
||||
'Do you really want to delete this template ? It will be removed from all products.' => 'Voulez-vous vraiment supprimer ce gabarit ? Il sera supprimé de tous les produits.',
|
||||
'Do you really want to delete this variable ?' => 'Voulez-vous vraiment supprimer cette variable ?',
|
||||
'Do you really want to enable this element ?' => 'Voulez-vous vraiment activer cet élément ?',
|
||||
'Do you really want to remove the content from this folder ?' => 'Voulez-vous vraiment enlever le contenu de ce dossier ?',
|
||||
'Do you really want to remove the product from this category ?' => 'êtes-vous sur de vouloir enlever le produit de cette rubrique',
|
||||
'Do you really want to remove this accessory from the product ?' => 'êtes-vous sur de vouloir supprimer cet accessoire ?',
|
||||
@@ -332,8 +337,6 @@ return array(
|
||||
'E-mail templates' => 'Templates E-mail',
|
||||
'EAN Code' => 'Code EAN',
|
||||
'Ecotax is a tax wich add a defined amount (throug a product feature) to the product price.' => 'L\'écotaxe est une taxe qui ajoute un montant défini (grâce à une caractéristique produit) au prix du produit.',
|
||||
'Edit' => 'Editer',
|
||||
'Edit %title' => 'Modifier %title',
|
||||
'Edit a country' => 'Modifier un pays',
|
||||
'Edit a currency' => 'Modifier une devise',
|
||||
'Edit a customer' => 'Éditer un client',
|
||||
@@ -400,6 +403,7 @@ return array(
|
||||
'Editing %title' => 'En cours de modification de %title',
|
||||
'Editing attribute "%name"' => 'En cours de modification de la déclinaison "%name"',
|
||||
'Editing country "%name"' => 'En cours de modification du pays "%name"',
|
||||
'Editing coupon "%title"' => 'Edition du code promo "%title" ',
|
||||
'Editing currency "%name"' => 'En cours de modification de la devise "%name"',
|
||||
'Editing document "%name"' => 'Modification du document "%name"',
|
||||
'Editing feature "%name"' => 'En cours de modification de la caractéristique "%name"',
|
||||
@@ -419,7 +423,7 @@ return array(
|
||||
'Email used when you send an email to your customers (Order confirmations, etc).' => 'Adresse email utilisé pour envoyer les mails à vos clients',
|
||||
'Enable remote SMTP use : ' => 'Activer l\'utilisation d\'un serveur SMTP distant:',
|
||||
'Enable/Disable' => 'Activer/Désactiver',
|
||||
'Enabled coupons' => 'Codes promo disponibles',
|
||||
'Enabled' => 'Activé',
|
||||
'Encryption' => 'Chiffrement',
|
||||
'Encryption :' => 'Chiffrement :',
|
||||
'Enter here all possible attribute values.' => 'Entrez ici toutes les valeurs de déclinaison possible.',
|
||||
@@ -458,7 +462,8 @@ return array(
|
||||
'Example :' => 'Exemple :',
|
||||
'Existing combinations will be deleted. Do you want to continue ?' => 'Les combinaisons existantes seront supprimées. Voulez-vous continuer ?',
|
||||
'Expiration date' => 'Date de fin de validité',
|
||||
'Expiration date :' => 'Date de fin de validité : ',
|
||||
'Expiration date * :' => 'Date d\'expiration * :',
|
||||
'Expired' => 'Expiré',
|
||||
'Export' => 'Export',
|
||||
'Exports' => 'Exports',
|
||||
'Failed to get converted prices. Please try again.' => 'Erreur lors de la récupération des prix convertis. Veuillez réessayer.',
|
||||
@@ -485,6 +490,7 @@ return array(
|
||||
'Folder title' => 'Titre du dossier',
|
||||
'Folders' => 'Dossiers',
|
||||
'Folders in %fold' => 'Dossier dans %fold',
|
||||
'Format: %fmt, e.g. %date' => 'Format: %fmt, ex. %date ',
|
||||
'French 19.6% VAT is a tax which add a 19.6% tax to the product price.' => 'La TVA française de 20% est une taxe qui ajoute 20% au prix du produit.',
|
||||
'French 19.6% VAT with ecotax is the applicance of the ecotax (on the product price) then the applicance of the 19.6% tax (on the product price + the ecotax amount).' => 'La TVA française de 20% avec écotaxe est l\'application de l\'écotaxe (sur le prix du produit) puis l\'application de la taxe de20% (sur le prix du produit + le montant écotaxe).',
|
||||
'From' => 'De',
|
||||
@@ -526,12 +532,6 @@ return array(
|
||||
'Invoice date' => 'Date de facturation',
|
||||
'Invoice informations' => 'Informations de facturation',
|
||||
'Invoice reference' => 'Facture ref',
|
||||
'Is available on special offers' => 'Est valide sur les offres promotionnelles',
|
||||
'Is cumulative' => 'Est cumulable',
|
||||
'Is disabled' => 'Désactivé',
|
||||
'Is enabled' => 'Est activé',
|
||||
'Is removing postage' => 'Offre les frais de port',
|
||||
'Is unlimited' => 'Est illimité',
|
||||
'Items to translate' => 'Elément à traduire',
|
||||
'Keep the most important part of your description in the first 150-160 characters.' => 'Votre description ne devrait pas dépasser 150 à 160 caractères',
|
||||
'Kg' => 'Kg',
|
||||
@@ -569,8 +569,7 @@ return array(
|
||||
'Manage resource rights' => 'Gestion de droits pour les ressources',
|
||||
'Manage taxes' => 'Gérer les taxes',
|
||||
'Manage the tax rule taxes appliance order' => 'Gérer les règles de taxe et leur ordre d\'application',
|
||||
'Max usage :' => 'Utilisations max : ',
|
||||
'May be cumulative' => 'Peut être cumulé',
|
||||
'Maximum usage count :' => 'Nombre maximum d\'utilisations',
|
||||
'Message created on %date_create. Last modification: %date_change' => 'Message créé le %date_create. Dernière modification le %date_change',
|
||||
'Message level' => 'Message level',
|
||||
'Messages which have a level greater or equal to the selected level will be added to the log destinations. ' => 'Les messages avec un niveau d\'erreur supérieur ou égal à celui sélectionné seront rajoutés dans les logs',
|
||||
@@ -635,8 +634,8 @@ return array(
|
||||
'Phone' => 'Téléphone',
|
||||
'Phone number' => 'Numéro de téléphone',
|
||||
'Please retry' => 'Merci de réessayer',
|
||||
'Please save your Coupon in oder to affect it some conditions' => 'Veuillez sauvegarder votre code promo afin de pouvoir lui affecter des conditions',
|
||||
'Please select a condition category' => 'Merci d\'entrer le type de condition',
|
||||
'Please save this coupon first to define coupon conditions' => 'Enregistrez ce nouveau code promo pour définir les conditions d\'utilisation',
|
||||
'Please select a condition' => 'Choisissez une condition',
|
||||
'Please select a coupon type' => 'Merci d\'entrer le type de code',
|
||||
'Please select another condition' => 'Merci de sélectionner une autre condition',
|
||||
'Please select items to translate' => 'Veuillez sélectionner un élément',
|
||||
@@ -688,6 +687,7 @@ return array(
|
||||
'Profile created on %date_create. Last modification: %date_change' => 'Profil crée le %date_create. Dernière modification le %date_change ',
|
||||
'Profiles' => 'Profils',
|
||||
'Promotion' => 'Promo',
|
||||
'Provides free shipping' => 'Offre le port',
|
||||
'Published by OpenStudio' => 'Développé par OpenStudio',
|
||||
'Purpose' => 'Objet',
|
||||
'Quantity' => 'Quantité',
|
||||
@@ -731,7 +731,6 @@ return array(
|
||||
'Save changes' => 'Enregistrer les modifications',
|
||||
'Save this address' => 'Sauvegarder cette adresse',
|
||||
'Save this condition' => 'Enregistrer cette condition',
|
||||
'Save your modifications' => 'Enregistrer les modifications',
|
||||
'Search' => 'Recherche',
|
||||
'Search for \'%term\'' => 'Recherche de \'%term\'',
|
||||
'Select a category and click (+) to add it to the additional category list' => 'Sélectionner une rubrique et cliquez sur (+) pour la rajouter dans la liste des rubrique associées',
|
||||
@@ -861,12 +860,12 @@ return array(
|
||||
'This category doesn\'t contains any products. To add a new product, <strong>click the + button</strong> above.' => 'Cette rubrique n\'a aucun produit. Pour créer un nouveau produit, <strong>cliquer sur le bouton +</strong> ci-dessus. ',
|
||||
'This category has no sub-categories.' => 'Cette rubrique n\'a pas de sous-rubrique.',
|
||||
'This category has no sub-categories. To create a new one, click the + button above.' => 'Cette rubrique n\'a pas de sous-rubrique. Pour en créer une nouvelle, cliquez sur le bouton + ci-dessus.',
|
||||
'This coupon is disabled, you can enable at the bottom of this form.' => 'Le code promo est désactivé. Vous pouvez l\'activer au début de ce formulaire',
|
||||
'This customer has not defined any delivery address' => 'Ce client n\'a pas saisi aucune adresse de livraison',
|
||||
'This delivery module handles all shipping zones.' => 'Ce module livre dans toutes les zones de livraison.',
|
||||
'This folder doesn\'t contains any contents. To add a new content, <strong>click the + button</strong> above.' => 'Ce dossier n\'a aucun contenu. Pour ajouter un nouveau contenu, <strong>cliquez sur le bouton + ci-dessus</strong>.',
|
||||
'This folder has no sub-folders.' => 'Ce dossier n\'a pas de sous-dossiers.',
|
||||
'This folder has no sub-folders. To create a new one, click the + button above.' => 'Ce dossier n\'a pas de sous-dossiers. Afin de créer un nouveau, cliquez sur le bouton + ci-dessus.',
|
||||
'This is the code entered by your customers to use this coupon' => 'Il s\'agit du code qui sera saisi par vos clients',
|
||||
'This is the message purpose, such as \'Order confirmation\'.' => 'Titre du message (ex : confirmation de commande)',
|
||||
'This is the subject of the e-mail, such as \'Your order is confirmed\'.' => 'Sujet du message (ex : votre commande est validée)',
|
||||
'This mailing template could not be changed.' => 'Le template de mailing ne peut pas être changé',
|
||||
@@ -887,7 +886,7 @@ return array(
|
||||
'Timeout' => 'Délai d\'attente expiré',
|
||||
'Timeout :' => 'Délai d\'attente expiré : ',
|
||||
'Title' => 'Titre',
|
||||
'Title :' => 'Titre : ',
|
||||
'Title * :' => 'Titre * : ',
|
||||
'To' => 'A',
|
||||
'To create a new content, select an existing folder, or create a new one.' => 'Pour créer un nouveau contenu, sélectionnez un dossier existant ou créez en un nouveau',
|
||||
'To create a new product, select an existing category, or create a new one.' => 'Pour créer un nouveau produit, veuillez sélectionner une rubrique existante ou en créer une nouvelle',
|
||||
@@ -906,18 +905,19 @@ return array(
|
||||
'Transaction reference' => 'Référence de la transaction',
|
||||
'Translation' => 'Traductions',
|
||||
'Translations' => 'Traductions',
|
||||
'Type :' => 'Type : ',
|
||||
'Unassigned countries' => 'Pays sans zone de livraison',
|
||||
'Unit taxed price' => 'Prix unitaire TTC',
|
||||
'Unit. price' => 'Prix unitaire',
|
||||
'Unlimited' => 'Illimité',
|
||||
'Unlimited number of uses' => 'Nombre d\'utilisations illimité',
|
||||
'Update' => 'Mettre à jour',
|
||||
'Update an administrator' => 'Mettre à jour cet administrateur',
|
||||
'Update coupon' => 'Mettre à jour le code',
|
||||
'Update rates' => 'Mettre à jour les taux',
|
||||
'Update tax rule taxes' => 'Mettre à jour les taxes de la règle de taxe',
|
||||
'Update this image' => 'Modifier cette image',
|
||||
'Usage left' => 'Utilisation restante',
|
||||
'Usage count' => 'Nombre d\'utilisations',
|
||||
'Usages left' => 'Utulisations restantes',
|
||||
'Use Ctrl+click to select more than one value. You can also <a href="#" class="clear_feature_value" data-id="%id">clear selected values</a>.' => 'Utilisez Ctrl+clic pour choisir plus d\'une valeur. Vous pouvez aussi <a href="#" class="clear_feature_value" data-id="%id">tout désélectionner</a>.',
|
||||
'Use HTML message defined below' => 'Utiliser le message HTML définie ci-dessous',
|
||||
'Use Text message defined below' => 'Utiliser la version texte définie ci-dessous',
|
||||
@@ -929,6 +929,7 @@ return array(
|
||||
'Username' => 'Nom d\'utilisateur',
|
||||
'Username :' => 'Nom d\'utilisateur : ',
|
||||
'Using a domain or subdomain for each language' => 'Utiliser un domaine ou un sous domaine pour chaque langue',
|
||||
'Valid on special offers' => 'Valide pour les offres spéciales',
|
||||
'Value' => 'Valeur',
|
||||
'Variable created on %date_create. Last modification: %date_change' => 'Variable créée le %date_create. Dernière modification: %date_change',
|
||||
'Variable name' => 'Nom de la variable',
|
||||
@@ -943,10 +944,6 @@ return array(
|
||||
'Warning' => 'Attention',
|
||||
'Weight<br />(Kg)' => 'Poids<br />(Kg)',
|
||||
'Welcome' => 'Bienvenue',
|
||||
'Will be available on special offers' => 'Sera disponible pour les produits en promotion',
|
||||
'Will remove postage' => 'Supprimera les frais de port',
|
||||
'Won\'t be available on special offers' => 'N\'est pas disponible pour les offres spéciales',
|
||||
'Won\'t remove postage' => 'Ne supprimera pas les frais de port',
|
||||
'Yes' => 'Oui',
|
||||
'Yesterday sales' => 'Ventes de la veille',
|
||||
'You can attach here some content to this category' => 'Vous pouvez lier ici des contenus à cette rubrique',
|
||||
@@ -976,15 +973,14 @@ return array(
|
||||
'd-m-Y' => 'd-m-Y',
|
||||
'date form' => 'formulaire de date',
|
||||
'date in yyyy-mm-dd format' => 'date in yyyy-mm-dd format',
|
||||
'days left' => 'jours restants',
|
||||
'deactivate' => 'désactiver',
|
||||
'deactivation' => 'désactivation',
|
||||
'delete image' => 'Supprimer l\'image',
|
||||
'en_US' => 'en_US',
|
||||
'firstname & lastname' => 'Prénom & nom',
|
||||
'hour in hh:mm:ss format' => 'hour in hh:mm:ss format',
|
||||
'last order' => 'Dernière commande',
|
||||
'long description' => 'description longue',
|
||||
'max usage' => 'utilisations max',
|
||||
'newsletter subscribers' => 'Inscrits à la newsletter',
|
||||
'order amount' => 'Montant de la commande',
|
||||
'orders for this customer' => 'commandes pour ce client',
|
||||
@@ -997,5 +993,4 @@ return array(
|
||||
'tracking reference' => 'Reference Tracking',
|
||||
'uncheck all' => 'tout décocher',
|
||||
'you can combine taxes in tax rules and chose if they are applied one after the other or at the same time : it allows to apply taxes on an already taxed price or not.' => 'vous pouvez combiner des taxes en règles de taxe et choisir si elle sont appliquées l\'une après l\'autre ou en même temps: cela permet d\'appliquer des taxes sur un produit déjà taxé ou non.',
|
||||
'yyyy-mm-dd' => 'yyyy-mm-dd',
|
||||
);
|
||||
|
||||
@@ -560,12 +560,12 @@ $(function() {
|
||||
}
|
||||
});
|
||||
|
||||
// Initialize folder (id={$folder_id}) select value
|
||||
// Initialize folder select value
|
||||
{if $folder_id != 0}
|
||||
$('#folder_id').val("{$folder_id}").change();
|
||||
{/if}
|
||||
|
||||
// Initialize accessory category id (id={$accessory_category_id}) select value
|
||||
// Initialize accessory category id select value
|
||||
{if $accessory_category_id != 0}
|
||||
$('#accessory_category_id').val("{$accessory_category_id}").change();
|
||||
{/if}
|
||||
|
||||
@@ -4,7 +4,7 @@ $(function($){
|
||||
$.couponManager = {};
|
||||
|
||||
// Condition being updated category id
|
||||
$.couponManager.conditionToUpdateServiceId = -1;
|
||||
$.couponManager.conditionToUpdateServiceId = '';
|
||||
// Condition being updated index
|
||||
$.couponManager.conditionToUpdateIndex = false;
|
||||
|
||||
@@ -20,6 +20,7 @@ $(function($){
|
||||
$.couponManager.intlPleaseRetry = '';
|
||||
$.couponManager.intlPleaseSelectAnotherCondition = '';
|
||||
$.couponManager.intlDoYouReallyWantToSetCouponAvailableForEveryOne = '';
|
||||
$.couponManager.intlDoYouReallyWantToDeleteThisCondition = '';
|
||||
|
||||
// *****************************************
|
||||
// ****************** Delete ***************
|
||||
@@ -28,11 +29,13 @@ $(function($){
|
||||
$.couponManager.onClickDeleteCondition = function() {
|
||||
$('.condition-delete-btn').on('click', function (e) {
|
||||
e.preventDefault();
|
||||
var $this = $(this);
|
||||
var index = $this.attr('data-conditionIndex');
|
||||
$.couponManager.conditionToUpdateServiceId = -1;
|
||||
$.couponManager.conditionToUpdateIndex = false;
|
||||
$.couponManager.removeConditionAjax(index);
|
||||
if (confirm($.couponManager.intlDoYouReallyWantToDeleteThisCondition)) {
|
||||
var $this = $(this);
|
||||
var index = $this.data('condition-index');
|
||||
$.couponManager.conditionToUpdateServiceId = '';
|
||||
$.couponManager.conditionToUpdateIndex = false;
|
||||
$.couponManager.removeConditionAjax(index);
|
||||
}
|
||||
});
|
||||
};
|
||||
$.couponManager.onClickDeleteCondition();
|
||||
@@ -53,7 +56,7 @@ $(function($){
|
||||
$('#condition-list').html($.couponManager.intlPleaseSelectAnotherCondition);
|
||||
}
|
||||
}
|
||||
}).done(function(data) {
|
||||
}).done(function() {
|
||||
// Reload condition summaries ajax
|
||||
$.couponManager.displayConditionsSummary();
|
||||
});
|
||||
@@ -92,9 +95,10 @@ $(function($){
|
||||
).done(function() {
|
||||
$.couponManager.displayConditionsSummary();
|
||||
$('#condition-add-operators-values').html('');
|
||||
$('#condition-add-type').find('.typeToolTip').html('');
|
||||
// Set the condition selector to default
|
||||
$("#category-condition option").filter(function() {
|
||||
return $(this).val() == '-1';
|
||||
return $(this).val() == '';
|
||||
}).prop('selected', true);
|
||||
}).fail(function() {
|
||||
$('#condition-add-operators-values').html(
|
||||
@@ -115,8 +119,8 @@ $(function($){
|
||||
$('.condition-update-btn').on('click', function (e) {
|
||||
e.preventDefault();
|
||||
var $this = $(this);
|
||||
$.couponManager.conditionToUpdateServiceId = $this.attr('data-serviceId');
|
||||
$.couponManager.conditionToUpdateIndex = $this.attr('data-conditionIndex');
|
||||
$.couponManager.conditionToUpdateServiceId = $this.data('service-id');
|
||||
$.couponManager.conditionToUpdateIndex = $this.data('condition-index');
|
||||
|
||||
$.couponManager.updateConditionSelectFromConditionInterfaceAjax(
|
||||
$.couponManager.conditionToUpdateIndex,
|
||||
@@ -135,7 +139,7 @@ $(function($){
|
||||
var $this = $(this);
|
||||
var mainDiv = $('#condition-add-type');
|
||||
var optionSelected = $('option:selected', this);
|
||||
mainDiv.find('.typeToolTip').html(optionSelected.attr('data-description'));
|
||||
mainDiv.find('.typeToolTip').html(optionSelected.data('description'));
|
||||
|
||||
// Only if add mode
|
||||
if (false != $.couponManager.conditionToUpdateIndex) {
|
||||
@@ -179,7 +183,7 @@ $(function($){
|
||||
}
|
||||
}).done(function(data) {
|
||||
$('#condition-add-operators-values').html(data);
|
||||
if ($.couponManager.conditionToUpdateServiceId == -1) {
|
||||
if ($.couponManager.conditionToUpdateServiceId == '') {
|
||||
// Placeholder can't be saved
|
||||
$('#condition-save-btn').hide();
|
||||
} else {
|
||||
@@ -204,28 +208,13 @@ $(function($){
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
// ***********************************************
|
||||
// *************** Manager Coupon ****************
|
||||
// ***********************************************
|
||||
// Reload effect inputs when changing effect
|
||||
$.couponManager.onEffectChange = function() {
|
||||
var mainDiv = $('#coupon-type');
|
||||
var optionSelected = mainDiv.find('#type option:selected');
|
||||
mainDiv.find('.typeToolTip').html(optionSelected.attr('data-description'));
|
||||
|
||||
mainDiv.find('#type').on('change', function () {
|
||||
var optionSelected = $('option:selected', this);
|
||||
$.couponManager.displayEfffect(optionSelected);
|
||||
|
||||
});
|
||||
};
|
||||
$.couponManager.onEffectChange();
|
||||
|
||||
$.couponManager.displayEfffect = function(optionSelected) {
|
||||
var mainDiv = $('#coupon-type');
|
||||
mainDiv.find('.typeToolTip').html(optionSelected.attr('data-description'));
|
||||
mainDiv.find('.typeToolTip').html(optionSelected.data('description'));
|
||||
|
||||
var inputsDiv = mainDiv.find('.inputs');
|
||||
inputsDiv.html('<div class="loading" ></div>');
|
||||
@@ -248,6 +237,20 @@ $(function($){
|
||||
});
|
||||
};
|
||||
|
||||
// Reload effect inputs when changing effect
|
||||
$.couponManager.onEffectChange = function() {
|
||||
var mainDiv = $('#coupon-type');
|
||||
var optionSelected = mainDiv.find('#type option:selected');
|
||||
mainDiv.find('.typeToolTip').html(optionSelected.data('description'));
|
||||
|
||||
mainDiv.find('#type').on('change', function () {
|
||||
var optionSelected = $('option:selected', this);
|
||||
$.couponManager.displayEfffect(optionSelected);
|
||||
|
||||
});
|
||||
};
|
||||
$.couponManager.onEffectChange();
|
||||
|
||||
$.couponManager.displayConditionsSummary = function() {
|
||||
var mainDiv = $('#condition-list');
|
||||
mainDiv.html('<div class="loading" ></div>');
|
||||
@@ -274,7 +277,9 @@ $(function($){
|
||||
// Set max usage to unlimited or not
|
||||
$.couponManager.onUsageUnlimitedChange = function() {
|
||||
var $isUnlimited = $('#is-unlimited');
|
||||
$maxUsage = $('#max-usage');
|
||||
|
||||
var $maxUsage = $('#max-usage');
|
||||
|
||||
if ($maxUsage.val() == -1) {
|
||||
$isUnlimited.prop('checked', true);
|
||||
$maxUsage.hide();
|
||||
@@ -296,5 +301,6 @@ $(function($){
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$.couponManager.onUsageUnlimitedChange();
|
||||
});
|
||||
@@ -380,7 +380,7 @@ $(function() {
|
||||
}
|
||||
});
|
||||
|
||||
// Initialize folder (id={$folder_id}) select value
|
||||
// Initialize folder select value
|
||||
{if $folder_id != 0}
|
||||
$('#folder_id').val("{$folder_id}").change();
|
||||
{/if}
|
||||
|
||||
@@ -268,7 +268,7 @@ form_content = {$smarty.capture.delete_folder_dialog nofilter}
|
||||
});
|
||||
});
|
||||
|
||||
// Initialize folder (id=
|
||||
// Initialize folder select value
|
||||
{if $folder_id != 0}
|
||||
$('#folder_id').val("{$folder_id}").change();
|
||||
{/if}
|
||||
|
||||
@@ -17,12 +17,8 @@
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
<div class="page-header">
|
||||
<h1>{intl l='Coupons : '}<small>{intl l='Create a new coupon'}</small></h1>
|
||||
</div>
|
||||
|
||||
{form name="thelia.admin.coupon.creation"}
|
||||
{include file='coupon/form.html' formAction={url path={$formAction}} noConditions=true}
|
||||
{include file='coupon/form.html' formAction={url path={$formAction}} noConditions=true title={intl l='Create a new coupon'}}
|
||||
{/form}
|
||||
</section> <!-- #wrapper -->
|
||||
|
||||
@@ -48,6 +44,7 @@
|
||||
$.couponManager.urlAjaxAdminCouponDrawInputs = "{$urlAjaxAdminCouponDrawInputs}";
|
||||
$.couponManager.intlPleaseRetry = '{intl l='Please retry'}';
|
||||
$.couponManager.intlDoYouReallyWantToSetCouponAvailableForEveryOne = '{intl l='Do you really want to set this coupon available to everyone ?'}';
|
||||
$.couponManager.intlDoYouReallyWantToDeleteThisCondition = '{intl l='Do you really want to delete this condition ?'}';
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@@ -14,22 +14,25 @@
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="{url path='admin/home'}">{intl l='Home'}</a></li>
|
||||
<li><a href="{url path='admin/tools'}">{intl l='Tools'}</a></li>
|
||||
<li><a href="{url path='admin/coupon'}">{intl l='Coupon'}</a></li>
|
||||
<li><a href="{url path='admin/coupon'}">{intl l='Coupons'}</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
{module_include location='coupon_top'}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="general-block-decorator">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-condensed" id="folder_list">
|
||||
|
||||
<caption>
|
||||
{intl l='Enabled coupons'}
|
||||
{intl l='Coupons'}
|
||||
|
||||
{module_include location='coupon_list_caption'}
|
||||
|
||||
{loop type="auth" name="can_create" role="ADMIN" resource="admin.coupon" access="CREATE"}
|
||||
<a class="btn btn-default btn-primary action-btn" title="{intl l='Create a new coupon'}" href="{$urlCreateCoupon}">
|
||||
<a class="btn btn-default btn-primary action-btn" title="{intl l='Create a new coupon'}" href="{url path='/admin/coupon/create'}">
|
||||
<span class="glyphicon glyphicon-plus-sign"></span>
|
||||
</a>
|
||||
{/loop}
|
||||
@@ -37,98 +40,119 @@
|
||||
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{block name="coupon-label-code"}{intl l='Code'}{/block}</th>
|
||||
<th>{block name="coupon-label-title"}{intl l='Title'}{/block}</th>
|
||||
<th>{block name="coupon-label-expiration-date"}{intl l='Days before expiration'}{/block}</th>
|
||||
<th>{block name="coupon-label-usage-left"}{intl l='Usage left'}{/block}</th>
|
||||
<th class="sorter-false filter-false">{block name="coupon-label-action"}{/block}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{loop type="coupon" name="list_coupon" is_enabled="1" backend_context="true"}
|
||||
<tr>
|
||||
<td>{block name="coupon-code"}<a href="{$urlReadCoupon|replace:'0':$ID}">{$CODE}</a>{/block}</td>
|
||||
<td>{block name="coupon-title"}{$TITLE}{/block}</td>
|
||||
<td>{block name="coupon-expiration-date"}{$DAY_LEFT_BEFORE_EXPIRATION}{/block}</td>
|
||||
<td>
|
||||
{block name="coupon-usage-left"}
|
||||
{if $USAGE_LEFT == -1}
|
||||
<span class="label label-success">
|
||||
{intl l="Unlimited"}
|
||||
</span>
|
||||
{elseif $USAGE_LEFT}
|
||||
<span class="label label-success">
|
||||
{$USAGE_LEFT}
|
||||
</span>
|
||||
{else}
|
||||
<span class="label label-warning">
|
||||
0
|
||||
</span>
|
||||
{/if}
|
||||
{/block}
|
||||
</td>
|
||||
<td>
|
||||
{block name="coupon-action"}
|
||||
<a href="{$urlEditCoupon|replace:'0':$ID}" class="btn btn-default btn-primary btn-medium">
|
||||
<span class="glyphicon glyphicon-edit"></span> {intl l='Edit'}
|
||||
</a>
|
||||
{/block}
|
||||
</td>
|
||||
</tr>
|
||||
{/loop}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<th>{admin_sortable_header
|
||||
current_order=$coupon_order
|
||||
order='code'
|
||||
reverse_order='code-reverse'
|
||||
path={url path='/admin/coupon'}
|
||||
request_parameter_name='coupon_order'
|
||||
label="{intl l='Code'}"
|
||||
}
|
||||
</th>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="general-block-decorator">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-condensed" id="folder_list">
|
||||
<caption>
|
||||
{intl l='Disabled coupons'}
|
||||
</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{block name="coupon-label-code"}{intl l='Code'}{/block}</th>
|
||||
<th>{block name="coupon-label-title"}{intl l='Title'}{/block}</th>
|
||||
<th>{block name="coupon-label-expiration-date"}{intl l='Expiration date'}{/block}</th>
|
||||
<th>{block name="coupon-label-usage-left"}{intl l='Usage left'}{/block}</th>
|
||||
<th class="sorter-false filter-false">{block name="coupon-label-action"}{/block}</th>
|
||||
<th>{admin_sortable_header
|
||||
current_order=$coupon_order
|
||||
order='title'
|
||||
reverse_order='title-reverse'
|
||||
path={url path='/admin/coupon'}
|
||||
request_parameter_name='coupon_order'
|
||||
label="{intl l='Title'}"
|
||||
}
|
||||
</th>
|
||||
|
||||
<th class="text-center">{admin_sortable_header
|
||||
current_order=$coupon_order
|
||||
order='enabled'
|
||||
reverse_order='enabled-reverse'
|
||||
path={url path='/admin/coupon'}
|
||||
request_parameter_name='coupon_order'
|
||||
label="{intl l='Status'}"
|
||||
}
|
||||
</th>
|
||||
|
||||
<th class="text-center">{admin_sortable_header
|
||||
current_order=$coupon_order
|
||||
order='expiration-date'
|
||||
reverse_order='expiration-date-reverse'
|
||||
path={url path='/admin/coupon'}
|
||||
request_parameter_name='coupon_order'
|
||||
label="{intl l='Expiration date'}"
|
||||
}
|
||||
</th>
|
||||
|
||||
<th class="text-center">{admin_sortable_header
|
||||
current_order=$coupon_order
|
||||
order='days-left'
|
||||
reverse_order='days-left-reverse'
|
||||
path={url path='/admin/coupon'}
|
||||
request_parameter_name='coupon_order'
|
||||
label="{intl l='Days before expiration'}"
|
||||
}
|
||||
</th>
|
||||
|
||||
<th class="text-center">{admin_sortable_header
|
||||
current_order=$coupon_order
|
||||
order='usages-left'
|
||||
reverse_order='usages-left-reverse'
|
||||
path={url path='/admin/coupon'}
|
||||
request_parameter_name='coupon_order'
|
||||
label="{intl l='Usages left'}"
|
||||
}
|
||||
</th>
|
||||
|
||||
{module_include location='coupon_table_header'}
|
||||
|
||||
<th> </th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{loop type="coupon" name="list_coupon" is_enabled="0" backend_context="true"}
|
||||
{loop type="coupon" name="list_coupon" order={$coupon_order|default:'code'} backend_context="true"}
|
||||
<tr>
|
||||
<td>{block name="coupon-code"}<a href="{$urlReadCoupon|replace:'0':$ID}">{$CODE}</a>{/block}</td>
|
||||
<td>{block name="coupon-title"}{$TITLE}{/block}</td>
|
||||
<td>{block name="coupon-expiration-date"}{$EXPIRATION_DATE}{/block}</td>
|
||||
<td>
|
||||
{block name="coupon-usage-left"}
|
||||
{if $USAGE_LEFT == -1}
|
||||
<span class="label label-success">
|
||||
{intl l="Unlimited"}
|
||||
</span>
|
||||
{elseif $USAGE_LEFT}
|
||||
<span class="label label-success">
|
||||
{$USAGE_LEFT}
|
||||
</span>
|
||||
{else}
|
||||
<span class="label label-warning">
|
||||
0
|
||||
</span>
|
||||
{/if}
|
||||
{/block}
|
||||
{loop type="auth" name="can_change" role="ADMIN" resource="admin.coupon" access="UPDATE"}
|
||||
<a title="{intl l='Change this coupon'}" href="{url path="/admin/coupon/update/$ID"}">{$CODE}</a>
|
||||
{/loop}
|
||||
{elseloop rel="can_change"}
|
||||
{$CODE}
|
||||
{/elseloop}
|
||||
</td>
|
||||
<td>
|
||||
{block name="coupon-action"}
|
||||
<a href="{$urlEditCoupon|replace:'couponId':$ID}" class="btn btn-default btn-primary btn-medium">
|
||||
<span class="glyphicon glyphicon-edit"></span> {intl l='Edit'}
|
||||
</a>
|
||||
{/block}
|
||||
|
||||
<td>{$TITLE}</td>
|
||||
|
||||
<td class="text-center">
|
||||
{if $IS_ENABLED}
|
||||
<span class="label label-success">{intl l="Enabled"}</span>
|
||||
{else}
|
||||
<span class="label label-default">{intl l="Disabled"}</span>
|
||||
{/if}
|
||||
</td>
|
||||
|
||||
<td class="text-center">{format_date date=$EXPIRATION_DATE output="date"}</td>
|
||||
|
||||
<td class="text-center">
|
||||
{if $DAY_LEFT_BEFORE_EXPIRATION <= 0}
|
||||
<span class="label label-default">{intl l='Expired'}</span>
|
||||
{else}
|
||||
{$DAY_LEFT_BEFORE_EXPIRATION}
|
||||
{/if}
|
||||
</td>
|
||||
|
||||
<td class="text-center">
|
||||
{if $USAGE_LEFT == -1}
|
||||
{intl l="Unlimited"}
|
||||
{elseif $USAGE_LEFT}
|
||||
{$USAGE_LEFT}
|
||||
{else}
|
||||
<span class="label label-default">0</span>
|
||||
{/if}
|
||||
</td>
|
||||
|
||||
{module_include location='coupon_table_row'}
|
||||
|
||||
<td class="text-center">
|
||||
{loop type="auth" name="can_change" role="ADMIN" resource="admin.coupon" access="UPDATE"}
|
||||
<a title="{intl l='Change this coupon'}" href="{url path="/admin/coupon/update/$ID"}"><i class="glyphicon glyphicon-edit"></i></a>
|
||||
{/loop}
|
||||
</td>
|
||||
</tr>
|
||||
{/loop}
|
||||
@@ -136,6 +160,9 @@
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{module_include location='coupon_bottom'}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,173 +0,0 @@
|
||||
{extends file="admin-layout.tpl"}
|
||||
|
||||
{block name="check-resource"}admin.coupon{/block}
|
||||
{block name="check-access"}view{/block}
|
||||
|
||||
{block name="page-title"}{intl l='Coupon'}{/block}
|
||||
|
||||
{block name="main-content"}
|
||||
<div class="coupons">
|
||||
|
||||
<div id="wrapper" class="container">
|
||||
|
||||
{loop type="coupon" name="read_coupon" id={$couponId} backend_context="true"}
|
||||
<nav>
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="{url path='admin/home'}">{intl l='Home'}</a></li>
|
||||
<li><a href="{url path='admin/tools'}">{intl l='Tools'}</a></li>
|
||||
<li><a href="{url path='admin/coupon'}">{intl l='Coupon'}</a></li>
|
||||
<li>{$CODE}</li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="general-block-decorator">
|
||||
<div class="table-responsive">
|
||||
|
||||
{if !$IS_ENABLED}
|
||||
<div class="alert alert-info">
|
||||
<span class="glyphicon glyphicon-question-sign"></span>
|
||||
{intl l='This coupon is disabled, you can enable at the bottom of this form.'}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<table class="table table-striped">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>{intl l='Title'}</td>
|
||||
<td>{$TITLE}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
{if $IS_ENABLED}
|
||||
<span class="label label-success">
|
||||
{intl l="Is enabled"}
|
||||
</span>
|
||||
{else}
|
||||
<span class="label label-warning">
|
||||
{intl l="Is disabled"}
|
||||
</span>
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
{$SUMMARY}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{intl l='Amount'}</td>
|
||||
<td>{$AMOUNT}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{intl l='Expiration date'}</td>
|
||||
<td>{$EXPIRATION_DATE} ({$DAY_LEFT_BEFORE_EXPIRATION} {intl l="days left"})</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{intl l='Usage left'}</td>
|
||||
<td>
|
||||
{if $USAGE_LEFT == -1}
|
||||
<span class="label label-success">
|
||||
{intl l="Unlimited"}
|
||||
</span>
|
||||
{elseif $USAGE_LEFT}
|
||||
<span class="label label-success">
|
||||
{$USAGE_LEFT}
|
||||
</span>
|
||||
{else}
|
||||
<span class="label label-warning">
|
||||
0
|
||||
</span>
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
{if $IS_CUMULATIVE}
|
||||
<span class="label label-success">
|
||||
{intl l="May be cumulative"}
|
||||
</span>
|
||||
{else}
|
||||
<span class="label label-warning">
|
||||
{intl l="Can't be cumulative"}
|
||||
</span>
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
{if $IS_REMOVING_POSTAGE}
|
||||
<span class="label label-warning">
|
||||
{intl l="Will remove postage"}
|
||||
</span>
|
||||
{else}
|
||||
<span class="label label-success">
|
||||
{intl l="Won't remove postage"}
|
||||
</span>
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
{if $IS_AVAILABLE_ON_SPECIAL_OFFERS}
|
||||
<span class="label label-warning">
|
||||
{intl l="Will be available on special offers"}
|
||||
</span>
|
||||
{else}
|
||||
<span class="label label-success">
|
||||
{intl l="Won't be available on special offers"}
|
||||
</span>
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{intl l='Application field'}</td>
|
||||
<td>
|
||||
<ul class="list-unstyled">
|
||||
{foreach from=$APPLICATION_CONDITIONS item=condition name=conditionsForeach}
|
||||
{if !$smarty.foreach.conditionsForeach.first}
|
||||
<li><span class="label label-info">{intl l='And'}</span></li>
|
||||
{/if}
|
||||
<li>{$condition nofilter}</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">{$SHORT_DESCRIPTION}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">{$DESCRIPTION}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<a href="{$urlEditCoupon}" class="btn btn-default btn-primary btn-medium pull-right">
|
||||
<span class="glyphicon glyphicon-edit"></span> {intl l='Edit'}
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/loop}
|
||||
</div> <!-- #wrapper -->
|
||||
</div>
|
||||
|
||||
{include file='includes/confirmation-modal.html' id="enable" message="{intl l='Do you really want to enable this element ?'}"}
|
||||
|
||||
{/block}
|
||||
|
||||
{block name="javascript-initialization"}
|
||||
{javascripts file='assets/js/main.js'}
|
||||
<script src="{$asset_url}"></script>
|
||||
{/javascripts}
|
||||
|
||||
{/block}
|
||||
|
||||
{block name="javascript-last-call"}
|
||||
{module_include location='coupon-read-js'}
|
||||
{/block}
|
||||
@@ -14,12 +14,12 @@
|
||||
<li><a href="{url path='admin/home'}">{intl l='Home'}</a></li>
|
||||
<li><a href="{url path='admin/tools'}">{intl l='Tools'}</a></li>
|
||||
<li><a href="{url path='admin/coupon'}">{intl l='Coupon'}</a></li>
|
||||
<li>{intl l="Editing %title" title="$couponCode"}</li>
|
||||
<li>{intl l='Editing coupon "%title"' title="$couponCode"}</li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
{form name="thelia.admin.coupon.creation"}
|
||||
{include file='coupon/form.html' formAction={url path={$formAction}} form=$form noConditions=false}
|
||||
{include file='coupon/form.html' formAction={url path={$formAction}} form=$form noConditions=false title={intl l='Editing coupon "%title"' title=$couponCode}}
|
||||
{/form}
|
||||
</div> <!-- #wrapper -->
|
||||
</div>
|
||||
@@ -52,6 +52,7 @@
|
||||
$.couponManager.intlPleaseRetry = '{intl l='Please retry'}';
|
||||
$.couponManager.intlPleaseSelectAnotherCondition = '{intl l='Please select another condition'}';
|
||||
$.couponManager.intlDoYouReallyWantToSetCouponAvailableForEveryOne = '{intl l='Do you really want to set this coupon available to everyone ?'}';
|
||||
$.couponManager.intlDoYouReallyWantToDeleteThisCondition = '{intl l='Do you really want to delete this condition ?'}';
|
||||
|
||||
$('#condition-save-btn').hide();
|
||||
});
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
<div id="condition-add-operators-values" class="form-group">
|
||||
<label for="operator">{$label}</label>
|
||||
<div class="row">
|
||||
<div class="col-lg-6">
|
||||
{$operatorSelectHtml nofilter}
|
||||
</div>
|
||||
<div class="input-group col-lg-6">
|
||||
<input type="text" class="form-control" id="{$inputKey}-value" name="{$inputKey}[value]" value="{$currentValue}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,11 @@
|
||||
<div id="condition-add-operators-values" class="form-group">
|
||||
<label for="operator">{$label}</label>
|
||||
<div class="row">
|
||||
<div class="col-lg-6">
|
||||
{$operatorSelectHtml nofilter}
|
||||
</div>
|
||||
<div class="input-group col-lg-6">
|
||||
{$quantitySelectHtml nofilter}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,20 @@
|
||||
<div class="form-group">
|
||||
|
||||
<label for="operator">{$label}</label>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-6">
|
||||
{$operatorSelectHtml nofilter}
|
||||
</div>
|
||||
|
||||
<div class="col-lg-4">
|
||||
<input type="text" class="form-control" id="{$field_1_name}-value" name="{$field_1_name}[value]" value="{$value}" placeholder="{intl l='Amount'}">
|
||||
</div>
|
||||
|
||||
<div class="col-lg-2">
|
||||
<input type="hidden" id="{$field_2_name}-operator" name="{$field_2_name}[operator]" value="=="/>
|
||||
{$currencySelectHtml nofilter}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,5 @@
|
||||
<select class="form-control" id="{$inputKey}-operator" name="{$inputKey}[operator]">
|
||||
{foreach $operators as $key => $operator}
|
||||
<option value="{$key}"{if $key == $value}selected="selected"{/if}>{$operator}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
@@ -0,0 +1,5 @@
|
||||
<select class="form-control" id="{$inputKey}-value" name="{$inputKey}[value]">
|
||||
{foreach $currencies as $key => $currency}
|
||||
<option value="{$key}"{if $key == $value}selected="selected"{/if}>{$currency}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
@@ -0,0 +1,9 @@
|
||||
<input type="number" value="{$value}" class="form-control" id="{$inputKey}-value" name="{$inputKey}[value]" placeholder="Enter quantity" />
|
||||
{* Use a text field instead
|
||||
<select class="form-control" id="{$inputKey}-value" name="{$inputKey}[value]">
|
||||
{for $index=$min to $max}
|
||||
<option value="{$index}" {if $index == $value}selected="selected"{/if}>{$index}</option>
|
||||
{/for}
|
||||
</select>
|
||||
*}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{* List all condition with their summary *}
|
||||
{foreach from=$conditions item=condition key=i name=conditionsForeach}
|
||||
{foreach from=$conditions item=condition name=conditionsForeach}
|
||||
<tr>
|
||||
<td>
|
||||
{if !$smarty.foreach.conditionsForeach.first}
|
||||
@@ -7,13 +7,15 @@
|
||||
{/if}
|
||||
{$condition.summary nofilter}
|
||||
</td>
|
||||
<td>
|
||||
<a data-serviceId="{$condition.serviceId}" data-conditionIndex="{$condition.index}" class="btn btn-default btn-primary btn-medium condition-update-btn" href="{$urlEdit}">
|
||||
<span class="glyphicon glyphicon-edit"></span> {intl l='Edit'}
|
||||
|
||||
<td class="text-center">
|
||||
<a title="{intl l='Change this condition'}" data-service-id="{$condition.serviceId}" data-condition-index="{$condition.index}" class="condition-update-btn" href="{$urlEdit}">
|
||||
<span class="glyphicon glyphicon-edit"></span>
|
||||
</a>
|
||||
|
||||
{if $conditions|count != 1}
|
||||
<a data-conditionIndex="{$condition.index}" data-target="#delete" data-toggle="confirm" class="btn btn-default btn-danger btn-medium condition-delete-btn" href="{$urlDelete}">
|
||||
<span class="glyphicon glyphicon-remove"></span> {intl l='Delete'}
|
||||
<a title="{intl l='Delete this condition'}" data-condition-index="{$condition.index}" data-target="#delete" data-toggle="confirm" class="condition-delete-btn" href="{$urlDelete}">
|
||||
<span class="glyphicon glyphicon-remove"></span>
|
||||
</a>
|
||||
{/if}
|
||||
</td>
|
||||
|
||||
@@ -3,9 +3,10 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12 general-block-decorator">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-7 title">
|
||||
{intl l='Edit %title' title={$couponCode}}
|
||||
<div class="col-md-12 title title-without-tabs">
|
||||
{$title}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -25,27 +26,31 @@
|
||||
|
||||
{if !$noConditions}
|
||||
{include
|
||||
file = "includes/inner-form-toolbar.html"
|
||||
hide_submit_buttons = false
|
||||
file = "includes/inner-form-toolbar.html"
|
||||
hide_submit_buttons = false
|
||||
|
||||
page_url = "{url path="{$formAction}"}"
|
||||
page_url = {url path=$formAction}
|
||||
close_url = {url path='/admin/coupon'}
|
||||
}
|
||||
{else}
|
||||
{include
|
||||
file = "includes/inner-form-toolbar.html"
|
||||
hide_submit_buttons = false
|
||||
hide_save_and_close_button = true
|
||||
hide_flags = true
|
||||
|
||||
page_url = {url path=$formAction}
|
||||
close_url = {url path='/admin/coupon'}
|
||||
}
|
||||
{/if}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="col-md-3">
|
||||
{form_field form=$form field='code'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label class="control-label" for="code">{intl l='Code :'}</label>
|
||||
<input id="code" class="form-control" type="text" name="{$name}" value="{$value}" placeholder="{intl l='code'}">
|
||||
{if $error}{$message}{/if}
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='title'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="title" class="control-label" >{intl l='Title :'}</label>
|
||||
<input id="title" class="form-control" type="text" name="{$name}" value="{$value}" placeholder="{intl l='title'}">
|
||||
<label class="control-label" for="code">{intl l='Coupon code * :'}</label>
|
||||
<input required id="code" class="form-control" type="text" name="{$name}" value="{$value}" placeholder="{intl l='code'}">
|
||||
<span class="help-block">{intl l='This is the code entered by your customers to use this coupon'}</span>
|
||||
{if $error}{$message}{/if}
|
||||
</div>
|
||||
{/form_field}
|
||||
@@ -55,7 +60,7 @@
|
||||
<label for="is-enabled" class="checkbox control-label">
|
||||
<input id="is-enabled" type="checkbox" name="{$name}" {if $value}value="1" checked{/if} />
|
||||
{if $error}{$message}{/if}
|
||||
{intl l='Is enabled'}
|
||||
{intl l='Enabled'}
|
||||
</label>
|
||||
</div>
|
||||
{/form_field}
|
||||
@@ -65,7 +70,7 @@
|
||||
<label for="is-available-on-special-offers" class="checkbox control-label">
|
||||
<input id="is-available-on-special-offers" type="checkbox" name="{$name}" {if $value}value="1" checked{/if} />
|
||||
{if $error}{$message}{/if}
|
||||
{intl l='Is available on special offers'}
|
||||
{intl l='Valid on special offers'}
|
||||
</label>
|
||||
</div>
|
||||
{/form_field}
|
||||
@@ -75,7 +80,7 @@
|
||||
<label for="is-cumulative" class="checkbox control-label">
|
||||
<input id="is-cumulative" type="checkbox" name="{$name}" {if $value}value="1" checked{/if} />
|
||||
{if $error}{$message}{/if}
|
||||
{intl l='Is cumulative'}
|
||||
{intl l='Combinable with other promotions'}
|
||||
</label>
|
||||
</div>
|
||||
{/form_field}
|
||||
@@ -85,19 +90,16 @@
|
||||
<label for="is-removing-postage" class="checkbox control-label">
|
||||
<input id="is-removing-postage" type="checkbox" name="{$name}" {if $value}value="1" checked{/if} />
|
||||
{if $error}{$message}{/if}
|
||||
{intl l='Is removing postage'}
|
||||
{intl l='Provides free shipping'}
|
||||
</label>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='expirationDate'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="expiration-date" class="control-label">{intl l='Expiration date :'}</label>
|
||||
<div class="input-append date" data-date="12/02/2012" data-date-format="dd/mm/yyyy">
|
||||
<input type="text" id="expiration-date" name="{$name}" class="form-control datepicker" data-date-format="yyyy-mm-dd" value="{if $defaultDate}{$defaultDate}{else}{$value}{/if}" placeholder="{intl l='yyyy-mm-dd'}">
|
||||
{if $error}{$message}{/if}
|
||||
<span class="add-on"><span class="icon-th"></span></span>
|
||||
</div>
|
||||
<label for="expiration-date" class="control-label">{intl l='Expiration date * :'}</label>
|
||||
<input required type="date" id="expiration-date" name="{$name}" class="form-control" value="{if $defaultDate}{$defaultDate}{else}{$value}{/if}" placeholder="{intl l='Format: %fmt, e.g. %date' fmt=$dateFormat date={$smarty.now|date_format:$dateFormat}}">
|
||||
{if $error}{$message}{/if}
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
@@ -105,126 +107,132 @@
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
|
||||
<label for="is-unlimited" class="checkbox control-label">
|
||||
<input id="is-unlimited" type="checkbox" name="is-unlimited" >
|
||||
{intl l='Is unlimited'}
|
||||
<input id="is-unlimited" type="checkbox" name="is-unlimited" {if $value == '' || $value == -1}checked="checked"{/if}>
|
||||
{intl l='Unlimited number of uses'}
|
||||
</label>
|
||||
<label id="max-usage-label" for="max-usage" class="control-label">{intl l='Max usage :'}</label>
|
||||
<input id="max-usage" type="text" class="form-control" name="{$name}" value="{if !$value}-1{else}{$value}{/if}" placeholder="{intl l='max usage'}">
|
||||
|
||||
<label id="max-usage-label" for="max-usage" class="control-label">{intl l='Maximum usage count :'}</label>
|
||||
<input id="max-usage" type="text" class="form-control" name="{$name}" value="{if $value == ''}-1{else}{$value}{/if}" placeholder="{intl l='Usage count'}">
|
||||
{if $error}{$message}{/if}
|
||||
</div>
|
||||
{/form_field}
|
||||
</div>
|
||||
|
||||
<div class="col-md-8">
|
||||
<div id="coupon-type" class="well clearfix">
|
||||
<div class="col-md-6">
|
||||
{form_field form=$form field='type'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="type" class="control-label">{intl l='Type :'}</label>
|
||||
<select name="{$name}" id="type" class="col-md-12 form-control">
|
||||
<option value="-1" data-description="" data-inputName="">{intl l='Please select a coupon type'}</option>
|
||||
{foreach from=$availableCoupons item=availableCoupon}
|
||||
<option value="{$availableCoupon.serviceId}" data-description="{$availableCoupon.toolTip}" data-inputName="{$availableCoupon.inputName}" {if $value == $availableCoupon.serviceId}selected{/if}>
|
||||
{$availableCoupon.name}
|
||||
</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
{if $error}{$message}{/if}
|
||||
<span class="help-block typeToolTip">{$availableCoupons.0.toolTip}</span>
|
||||
</div>
|
||||
{/form_field}
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div id="coupon-type">
|
||||
{form_field form=$form field='type'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="type" class="control-label">{intl l='Coupon type * :'}</label>
|
||||
<select required name="{$name}" id="type" class="col-md-12 form-control">
|
||||
<option value="" data-description="" data-inputName="">{intl l='Please select a coupon type'}</option>
|
||||
{foreach from=$availableCoupons item=availableCoupon}
|
||||
<option value="{$availableCoupon.serviceId}" data-description="{$availableCoupon.toolTip}" data-inputName="{$availableCoupon.inputName}" {if $value == $availableCoupon.serviceId}selected{/if}>
|
||||
{$availableCoupon.name}
|
||||
</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
{if $error}{$message}{/if}
|
||||
<span class="help-block typeToolTip">{$availableCoupons.0.toolTip}</span>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
<div class="col-md-6 inputs">
|
||||
<div class="inputs">
|
||||
{form_field form=$form field='amount'}
|
||||
{$couponInputsHtml nofilter}
|
||||
{$couponInputsHtml nofilter}
|
||||
{/form_field}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{form_field form=$form field='shortDescription'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="short-description" class="control-label">{intl l='Short description :'}</label>
|
||||
<textarea id="short-description" name="{$name}" class="form-control" placeholder="{intl l='short description'}" class="span12" rows="5">{$value nofilter}</textarea>
|
||||
{if $error}{$message}{/if}
|
||||
</div>
|
||||
{/form_field}
|
||||
</div>
|
||||
|
||||
<div class="clearfix"></div>
|
||||
<div class="col-md-6">
|
||||
|
||||
<div class="col-md-12">
|
||||
{form_field form=$form field='description'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="description" class="control-label">{intl l='Long description :'}</label>
|
||||
<textarea id="description" name="{$name}" placeholder="{intl l='long description'}" class="form-control wysiwyg" rows="10">{$value nofilter}</textarea>
|
||||
{if $error}{$message}{/if}
|
||||
</div>
|
||||
{/form_field}
|
||||
{loop type="lang" name="get-flag" id=$edit_language_id}
|
||||
{form_field form=$form field='title'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="title" class="control-label" >{intl l='Title * :'}</label>
|
||||
<div class="input-group">
|
||||
<input required id="title" class="form-control" type="text" name="{$name}" value="{$value}" placeholder="{intl l='title'}">
|
||||
<span class="input-group-addon"><img src="{image file="assets/img/flags/{$CODE}.png"}" alt="{$TITLE}" /></span>
|
||||
</div>
|
||||
{if $error}{$message}{/if}
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{if $noConditions}
|
||||
<button id="save-coupon-btn" type="submit" class="btn btn-default btn-primary">{intl l='Save your modifications'}</button>
|
||||
{/if}
|
||||
{form_field form=$form field='shortDescription'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="short-description" class="control-label">{intl l='Short description :'} <img src="{image file="assets/img/flags/{$CODE}.png"}" alt="{$TITLE}" /></label>
|
||||
<textarea id="short-description" name="{$name}" class="form-control" placeholder="{intl l='short description'}" rows="3">{$value nofilter}</textarea>
|
||||
{if $error}{$message}{/if}
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='description'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="description" class="control-label">{intl l='Long description :'} <img src="{image file="assets/img/flags/{$CODE}.png"}" alt="{$TITLE}" /></label>
|
||||
<textarea id="description" name="{$name}" placeholder="{intl l='long description'}" class="form-control wysiwyg" rows="3">{$value nofilter}</textarea>
|
||||
{if $error}{$message}{/if}
|
||||
</div>
|
||||
{/form_field}
|
||||
{/loop}
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{if $noConditions}
|
||||
{include file='includes/notifications.html' message={intl l='Please save your Coupon in oder to affect it some conditions'}}
|
||||
{else}
|
||||
<div class="row">
|
||||
<div class="col-md-12 general-block-decorator">
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-condensed" id="folder_list">
|
||||
<caption class="clearfix">
|
||||
{intl l='Conditions'}
|
||||
</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{intl l='Conditions'}</th>
|
||||
<th>{intl l='Actions'}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="condition-list">
|
||||
{include file='coupon/conditions.html' conditions=$conditions}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12 general-block-decorator">
|
||||
|
||||
<div class="form-container">
|
||||
<form id="condition-form" action="{$urlAjaxSaveConditions}" {form_enctype form=$form} method="POST" >
|
||||
<div class="well clearfix">
|
||||
<a id="condition-save-btn" title="{intl l='Save this condition'}" class="btn btn-default btn-primary pull-right" data-toggle="confirm" data-script="">
|
||||
<span class="glyphicon glyphicon-plus-sign"></span> {intl l='Save this condition'}
|
||||
</a>
|
||||
|
||||
<div id="condition-add-type" class="form-group col-md-4">
|
||||
<label for="categoryCondition">{intl l='Condition\'s category :'}</label>
|
||||
<select name="categoryCondition" id="category-condition" class="form-control">
|
||||
<option value="-1" data-description="">{intl l='Please select a condition category'}</option>
|
||||
{foreach from=$availableConditions item=availableCondition}
|
||||
<option value="{$availableCondition.serviceId}" data-description="{$availableCondition.toolTip}">{$availableCondition.name}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
<span class="help-block typeToolTip"></span>
|
||||
</div>
|
||||
|
||||
<div id="condition-add-operators-values" class="form-group col-md-6"></div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
{if $noConditions}
|
||||
<div class="col-md-12">
|
||||
<p class="title title-without-tabs">{intl l="Coupon conditions"}</p>
|
||||
<br />
|
||||
{include file='includes/notifications.html' type='info' dismissable=false message={intl l='Please save this coupon first to define coupon conditions'}}
|
||||
</div>
|
||||
{else}
|
||||
<div class="col-md-6">
|
||||
<p class="title title-without-tabs">{intl l="Coupon conditions"}</p>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-condensed" id="folder_list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{intl l='Condition description'}</th>
|
||||
<th class="text-center">{intl l='Actions'}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="condition-list">
|
||||
{include file='coupon/conditions.html' conditions=$conditions}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
|
||||
<p class="title title-without-tabs">{intl l="Add a condition"}</p>
|
||||
|
||||
<form id="condition-form" action="{$urlAjaxSaveConditions}" {form_enctype form=$form} method="POST" >
|
||||
|
||||
<div id="condition-add-type" class="form-group">
|
||||
<label for="categoryCondition">{intl l='Condition category :'}</label>
|
||||
<select name="categoryCondition" id="category-condition" class="form-control">
|
||||
<option value="" data-description="">{intl l='Please select a condition'}</option>
|
||||
{foreach from=$availableConditions item=availableCondition}
|
||||
<option value="{$availableCondition.serviceId}" data-description="{$availableCondition.toolTip}">{$availableCondition.name}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
<span class="help-block typeToolTip"></span>
|
||||
</div>
|
||||
|
||||
<div id="condition-add-operators-values" class="form-group">
|
||||
|
||||
</div>
|
||||
|
||||
<a id="condition-save-btn" title="{intl l='Save this condition'}" class="btn btn-default btn-primary pull-right" data-toggle="confirm" data-script="">
|
||||
<span class="glyphicon glyphicon-plus-sign"></span> {intl l='Save this condition'}
|
||||
</a>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
<div class="form-group input-{$fieldName}">
|
||||
<label for="{$fieldName}" class="control-label">{$label}</label>
|
||||
<div class="input-group">
|
||||
<input id="{$fieldName}" type="money" class="form-control" name="thelia_coupon_creation[{$fieldName}]" value="{$value}" placeholder="14.50">
|
||||
{loop type="currency" name="get-symbol" default_only="true"}
|
||||
<div class="input-group-addon">{$SYMBOL}</div>
|
||||
{/loop}
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,8 @@
|
||||
<input type="hidden" name="thelia_coupon_creation[{$typeKey}]" value="0"/>
|
||||
<div class="form-group input-{$fieldId}">
|
||||
<label for="{$fieldId}" class="control-label">{$label}</label>
|
||||
<div class="input-group">
|
||||
<input id="{$fieldId}" class="form-control" name="[$fieldName][{$fieldId}]" type="text" value="{$value}"/>
|
||||
<div class="input-group-addon">%</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,4 @@
|
||||
<div class="form-group input-{$fieldName}">
|
||||
<label for="{$fieldName}" class="control-label">{$label}</label>
|
||||
<input id="{$fieldName}" type="money" class="form-control" name="thelia_coupon_creation[{$fieldName}]" value="{$value}">
|
||||
</div>
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
{block name="page-title"}{intl l='Edit a document'}{/block}
|
||||
|
||||
{block name="check-resource"}admin.document{/block}
|
||||
{block name="check-access"}update{/block}
|
||||
|
||||
{block name="main-content"}
|
||||
|
||||
@@ -226,7 +226,7 @@
|
||||
});
|
||||
});
|
||||
|
||||
// Initialize folder (id={$folder_id}) select value
|
||||
// Initialize folder select value
|
||||
{if $folder_id != 0}
|
||||
$('#folder_id').val("{$folder_id}").change();
|
||||
{/if}
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="general-block-decorator text-center">
|
||||
<h1>{intl l="Oops! An Error Occurred"}</h1>
|
||||
<h1 style="padding: 40px 0">{intl l="Oops! An Error Occurred"}</h1>
|
||||
|
||||
{block name="error-message"}<p>{$error_message}</p>{/block}
|
||||
{block name="error-message"}<p style="padding: 20px 0">{$error_message}</p>{/block}
|
||||
|
||||
<a href="{url path='/admin'}" class="btn btn-default btn-info btn-lg"><span class="glyphicon glyphicon-home"></span> {intl l="Go to administration home"}</a>
|
||||
</div>
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
{block name="page-title"}{intl l='Edit an image'}{/block}
|
||||
|
||||
{block name="check-resource"}admin.image{/block}
|
||||
{block name="check-access"}update{/block}
|
||||
|
||||
{block name="main-content"}
|
||||
|
||||
@@ -4,7 +4,9 @@ A toolbar displayed in forms, to display language change flags, submit and close
|
||||
Parameters:
|
||||
|
||||
- hide_flags: true / false. If true, the flags will not be visible
|
||||
- hide_submit_buttons: true / false. If true, only the close button will be deplayed.
|
||||
- hide_submit_buttons: true / false. If true, only the close button will be displayed.
|
||||
- hide_save_buttons: true / false. If true, the "Save" button will be hidden
|
||||
- hide_save_and_close_button: true / false. If true, the "Save and close" button will be hidden
|
||||
- show_currencies: true/false. If true, show the currency selection bar
|
||||
- page_url: the current page URL. Default is $current_url. Used to switchedition anguage.
|
||||
- close_url: no default. URL displayed when close button is clicked. If empty, the close button is not displayed.
|
||||
@@ -48,8 +50,12 @@ Parameters:
|
||||
|
||||
<div class="col-md-6 inner-actions">
|
||||
{if $hide_submit_buttons != true}
|
||||
<button type="submit" name="save_mode" value="stay" class="form-submit-button btn btn-sm btn-default btn-success" title="{intl l='Save'}">{intl l='Save'} <span class="glyphicon glyphicon-ok"></span></button>
|
||||
<button type="submit" name="save_mode" value="close" class="form-submit-button btn btn-sm btn-default btn-info" title="{intl l='Save and close'}">{intl l='Save and close'} <span class="glyphicon glyphicon-remove"></span></button>
|
||||
{if $hide_save_buttons != true}
|
||||
<button type="submit" name="save_mode" value="stay" class="form-submit-button btn btn-sm btn-default btn-success" title="{intl l='Save'}">{intl l='Save'} <span class="glyphicon glyphicon-ok"></span></button>
|
||||
{/if}
|
||||
{if $hide_save_and_close_button != true}
|
||||
<button type="submit" name="save_mode" value="close" class="form-submit-button btn btn-sm btn-default btn-info" title="{intl l='Save and close'}">{intl l='Save and close'} <span class="glyphicon glyphicon-remove"></span></button>
|
||||
{/if}
|
||||
{/if}
|
||||
{if ! empty($close_url)}
|
||||
<a href="{$close_url}" class="page-close-button btn btn-sm btn-default">{intl l='Close'} <span class="glyphicon glyphicon-remove"></span></a>
|
||||
|
||||
Reference in New Issue
Block a user