// Fix SpecificPriceRule form and multishop

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@11502 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
tDidierjean
2011-12-21 15:40:41 +00:00
parent 272ce10298
commit bbaa2154de
3 changed files with 16 additions and 7 deletions
@@ -115,6 +115,9 @@
</div> </div>
</div> </div>
</fieldset> </fieldset>
{if !$is_multishop}
<input type="hidden" name="id_shop" value=1 />
{/if}
{/block} {/block}
{block name="script"} {block name="script"}
+4 -1
View File
@@ -81,10 +81,13 @@ class HelperFormCore extends Helper
$color = true; $color = true;
$date = true; $date = true;
$tinymce = true; $tinymce = true;
foreach ($this->fields_form as $fieldset) foreach ($this->fields_form as $fieldset_key => $fieldset)
if (isset($fieldset['form']['input'])) if (isset($fieldset['form']['input']))
foreach ($fieldset['form']['input'] as $key => $params) foreach ($fieldset['form']['input'] as $key => $params)
{ {
// If the condition is not met, the field will not be displayed
if (isset($params['condition']) && !$params['condition'])
unset($this->fields_form[$fieldset_key]['form']['input'][$key]);
switch ($params['type']) switch ($params['type'])
{ {
case 'categories': case 'categories':
@@ -93,12 +93,10 @@ class AdminSpecificPriceRuleController extends AdminController
'from' => array( 'from' => array(
'title' => $this->l('From'), 'title' => $this->l('From'),
'align' => 'center', 'align' => 'center',
), ),
'to' => array( 'to' => array(
'title' => $this->l('To'), 'title' => $this->l('To'),
'align' => 'center', 'align' => 'center',
), ),
); );
@@ -129,6 +127,7 @@ class AdminSpecificPriceRuleController extends AdminController
'id' => 'id_shop', 'id' => 'id_shop',
'name' => 'name' 'name' => 'name'
), ),
'condition' => Shop::isFeatureActive()
), ),
array( array(
'type' => 'select', 'type' => 'select',
@@ -166,7 +165,8 @@ class AdminSpecificPriceRuleController extends AdminController
'name' => 'from_quantity', 'name' => 'from_quantity',
'size' => 6, 'size' => 6,
'maxlength' => 10, 'maxlength' => 10,
'value' => '1' 'value' => '1',
'required' => true
), ),
array( array(
'type' => 'text', 'type' => 'text',
@@ -182,12 +182,14 @@ class AdminSpecificPriceRuleController extends AdminController
'label' => $this->l('From:'), 'label' => $this->l('From:'),
'name' => 'from', 'name' => 'from',
'size' => 12, 'size' => 12,
'required' => true
), ),
array( array(
'type' => 'date', 'type' => 'date',
'label' => $this->l('To:'), 'label' => $this->l('To:'),
'name' => 'to', 'name' => 'to',
'size' => 12, 'size' => 12,
'required' => true
), ),
array( array(
'type' => 'select', 'type' => 'select',
@@ -211,7 +213,7 @@ class AdminSpecificPriceRuleController extends AdminController
'class' => 'button' 'class' => 'button'
), ),
); );
$attribute_groups = array(); $attribute_groups = array();
$attributes = Attribute::getAttributes((int)$this->context->language->id); $attributes = Attribute::getAttributes((int)$this->context->language->id);
foreach ($attributes as $attribute) foreach ($attributes as $attribute)
@@ -236,7 +238,8 @@ class AdminSpecificPriceRuleController extends AdminController
'attributes_group' => $attribute_groups, 'attributes_group' => $attribute_groups,
'features' => $features, 'features' => $features,
'categories' => Category::getSimpleCategories((int)$this->context->language->id), 'categories' => Category::getSimpleCategories((int)$this->context->language->id),
'conditions' => $this->object->getConditions() 'conditions' => $this->object->getConditions(),
'is_multishop' => Shop::isFeatureActive()
); );
return parent::renderForm(); return parent::renderForm();
@@ -260,7 +263,7 @@ class AdminSpecificPriceRuleController extends AdminController
$object->addConditions($conditions); $object->addConditions($conditions);
} }
} }
$object->apply();
} }
$object->apply();
} }
} }