Browse files

[+] BO : you can now choose if a voucher is displayed under the cart …

…in the frontend
  • Loading branch information...
1 parent 070a4b0 commit c4d8bff01c34fa859fd96137885513354644254c Damien Metzger committed Dec 27, 2012
View
12 admin-dev/themes/default/template/controllers/cart_rules/informations.tpl
@@ -24,6 +24,18 @@
<a href="javascript:gencode(8);" class="button">{l s='(Click to generate random code)'}</a>
<p class="preference_description">{l s='Caution! The rule will automatically be applied if you leave this field blank.'}</p>
</div>
+ <label>{l s='Highlight'}</label>
+ <div class="margin-form">
+ &nbsp;&nbsp;
+ <input type="radio" name="highlight" id="highlight_on" value="1" {if $currentTab->getFieldValue($currentObject, 'highlight')|intval}checked="checked"{/if} />
+ <label class="t" for="highlight_on"> <img src="../img/admin/enabled.gif" alt="{l s='Yes'}" title="{l s='Yes'}" style="cursor:pointer" /></label>
+ &nbsp;&nbsp;
+ <input type="radio" name="highlight" id="highlight_off" value="0" {if !$currentTab->getFieldValue($currentObject, 'highlight')|intval}checked="checked"{/if} />
+ <label class="t" for="highlight_off"> <img src="../img/admin/disabled.gif" alt="{l s='No'}" title="{l s='No'}" style="cursor:pointer" /></label>
+ <p class="preference_description">
+ {l s='If the voucher is not yet in the cart, it will be displayed under the cart in the cart summary.'}
+ </p>
+ </div>
<label>{l s='Partial use'}</label>
<div class="margin-form">
&nbsp;&nbsp;
View
3 classes/CartRule.php
@@ -64,6 +64,7 @@ class CartRuleCore extends ObjectModel
public $reduction_product;
public $gift_product;
public $gift_product_attribute;
+ public $highlight;
public $active = 1;
public $date_add;
public $date_upd;
@@ -103,6 +104,7 @@ class CartRuleCore extends ObjectModel
'reduction_product' => array('type' => self::TYPE_INT, 'validate' => 'isInt'),
'gift_product' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
'gift_product_attribute' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
+ 'highlight' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
'active' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
@@ -215,6 +217,7 @@ public static function getCustomerCartRules($id_lang, $id_customer, $active = fa
cr.`id_customer` = '.(int)$id_customer.'
'.($includeGeneric ? 'OR cr.`id_customer` = 0' : '').'
)
+ AND highlight = 1
'.($active ? 'AND cr.`active` = 1' : '').'
'.($inStock ? 'AND cr.`quantity` > 0' : ''));
View
1 install-dev/data/db_structure.sql
@@ -225,6 +225,7 @@ CREATE TABLE `PREFIX_cart_rule` (
`reduction_product` int(10) NOT NULL default 0,
`gift_product` int(10) unsigned NOT NULL default 0,
`gift_product_attribute` int(10) unsigned NOT NULL default 0,
+ `highlight` tinyint(1) unsigned NOT NULL default 0,
`active` tinyint(1) unsigned NOT NULL default 0,
`date_add` datetime NOT NULL,
`date_upd` datetime NOT NULL,
View
2 install-dev/upgrade/sql/1.5.3.0.sql
@@ -36,3 +36,5 @@ INSERT INTO `PREFIX_configuration`(`name`, `value`, `id_shop`, `id_shop_group`,
);
DELETE FROM `PREFIX_configuration` WHERE name='PS_GIFT_WRAPPING_TAX';
+
+ALTER TABLE `PREFIX_cart_rule` ADD `highlight` tinyint(1) unsigned NOT NULL default 0 AFTER `gift_product_attribute`;

0 comments on commit c4d8bff

Please sign in to comment.