WIP : coupon refactor + fix
This commit is contained in:
@@ -206,7 +206,7 @@ class CouponController extends BaseAdminController
|
||||
/** @var ConditionFactory $conditionFactory */
|
||||
$conditionFactory = $this->container->get('thelia.condition.factory');
|
||||
$conditions = $conditionFactory->unserializeConditionCollection(
|
||||
$coupon->getSerializedRules()
|
||||
$coupon->getSerializedConditions()
|
||||
);
|
||||
var_dump($coupon->getIsEnabled());;
|
||||
var_dump($coupon->getIsAvailableOnSpecialOffers());;
|
||||
|
||||
@@ -106,7 +106,7 @@ class Coupon extends BaseI18nLoop
|
||||
foreach ($coupons as $coupon) {
|
||||
$loopResultRow = new LoopResultRow();
|
||||
$conditions = $conditionFactory->unserializeConditionCollection(
|
||||
$coupon->getSerializedRules()
|
||||
$coupon->getSerializedConditions()
|
||||
);
|
||||
|
||||
/** @var CouponInterface $couponManager */
|
||||
|
||||
@@ -132,7 +132,7 @@ class CouponFactory
|
||||
/** @var ConditionFactory $conditionFactory */
|
||||
$conditionFactory = $this->container->get('thelia.condition.factory');
|
||||
$conditions = $conditionFactory->unserializeConditionCollection(
|
||||
$model->getSerializedRules()
|
||||
$model->getSerializedConditions()
|
||||
);
|
||||
|
||||
$couponManager->setConditions($conditions);
|
||||
|
||||
@@ -84,8 +84,8 @@ class Coupon extends BaseCoupon
|
||||
->setMaxUsage($maxUsage);
|
||||
|
||||
// If no rule given, set default rule
|
||||
if (null === $this->getSerializedRules()) {
|
||||
$this->setSerializedRules($defaultSerializedRule);
|
||||
if (null === $this->getSerializedConditions()) {
|
||||
$this->setSerializedConditions($defaultSerializedRule);
|
||||
}
|
||||
|
||||
// Set object language (i18n)
|
||||
@@ -115,7 +115,7 @@ class Coupon extends BaseCoupon
|
||||
*/
|
||||
public function createOrUpdateConditions($serializableConditions, $locale)
|
||||
{
|
||||
$this->setSerializedRules($serializableConditions);
|
||||
$this->setSerializedConditions($serializableConditions);
|
||||
|
||||
// Set object language (i18n)
|
||||
if (!is_null($locale)) {
|
||||
|
||||
@@ -327,7 +327,7 @@ class CouponFactoryTest extends \PHPUnit_Framework_TestCase
|
||||
// $rules = $this->generateValidRules();
|
||||
// }
|
||||
//
|
||||
// $coupon->setSerializedRules(base64_encode(serialize($rules)));
|
||||
// $coupon->setSerializedConditions(base64_encode(serialize($rules)));
|
||||
//
|
||||
// $coupon->setIsCumulative($isCumulative);
|
||||
// $coupon->setIsRemovingPostage($isRemovingPostage);
|
||||
|
||||
@@ -463,7 +463,8 @@ try {
|
||||
$featureAvId[array_rand($featureAvId, 1)]
|
||||
);
|
||||
} else { //no av
|
||||
$featureProduct->setByDefault($faker->text(10));
|
||||
// @todo uncomment
|
||||
// $featureProduct->setByDefault($faker->text(10));
|
||||
}
|
||||
|
||||
$featureProduct->save();
|
||||
@@ -696,7 +697,7 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua
|
||||
$conditionFactory = $container->get('thelia.condition.factory');
|
||||
|
||||
$serializedConditions = $conditionFactory->serializeConditionCollection($conditions);
|
||||
$coupon1->setSerializedRules($serializedConditions);
|
||||
$coupon1->setSerializedConditions($serializedConditions);
|
||||
$coupon1->setMaxUsage(40);
|
||||
$coupon1->setIsCumulative(true);
|
||||
$coupon1->setIsRemovingPostage(false);
|
||||
@@ -740,7 +741,7 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua
|
||||
$conditionFactory = $container->get('thelia.condition.factory');
|
||||
|
||||
$serializedConditions = $conditionFactory->serializeConditionCollection($conditions);
|
||||
$coupon2->setSerializedRules($serializedConditions);
|
||||
$coupon2->setSerializedConditions($serializedConditions);
|
||||
$coupon2->setMaxUsage(-1);
|
||||
$coupon2->setIsCumulative(false);
|
||||
$coupon2->setIsRemovingPostage(true);
|
||||
@@ -780,7 +781,7 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua
|
||||
$constraintCondition = $container->get('thelia.condition.factory');
|
||||
|
||||
$serializedConditions = $constraintCondition->serializeConditionCollection($conditions);
|
||||
$coupon3->setSerializedRules($serializedConditions);
|
||||
$coupon3->setSerializedConditions($serializedConditions);
|
||||
$coupon3->setMaxUsage(-1);
|
||||
$coupon3->setIsCumulative(true);
|
||||
$coupon3->setIsRemovingPostage(false);
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
<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-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>
|
||||
@@ -41,7 +41,7 @@
|
||||
<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-expiration-date"}{$DAY_LEFT_BEFORE_EXPIRATION}{/block}</td>
|
||||
<td>
|
||||
{block name="coupon-usage-left"}
|
||||
{if $USAGE_LEFT == -1}
|
||||
|
||||
Reference in New Issue
Block a user