// AdminCartRulesController : fixed toolbar in initForm()
This commit is contained in:
@@ -1,3 +1,18 @@
|
|||||||
|
{if $show_toolbar}
|
||||||
|
<div class="toolbar-placeholder">
|
||||||
|
<div class="toolbarBox {if $toolbar_fix}toolbarHead{/if}">
|
||||||
|
{include file="toolbar.tpl" toolbar_btn=$toolbar_btn}
|
||||||
|
<div class="pageTitle">
|
||||||
|
<h3>
|
||||||
|
{block name=pageTitle}
|
||||||
|
<span id="current_obj" style="font-weight: normal;">{$title|default:' '}</span>
|
||||||
|
{/block}
|
||||||
|
</h3>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="leadin">{block name="leadin"}{/block}</div>
|
||||||
|
{/if}
|
||||||
<div>
|
<div>
|
||||||
<div class="productTabs">
|
<div class="productTabs">
|
||||||
<ul class="tab">
|
<ul class="tab">
|
||||||
|
|||||||
@@ -270,48 +270,68 @@ class AdminCartRulesControllerCore extends AdminController
|
|||||||
|
|
||||||
public function initForm()
|
public function initForm()
|
||||||
{
|
{
|
||||||
|
$back = Tools::safeOutput(Tools::getValue('back', ''));
|
||||||
|
if (empty($back))
|
||||||
|
$back = self::$currentIndex.'&token='.$this->token;
|
||||||
|
|
||||||
|
$this->toolbar_btn['cancel'] = array(
|
||||||
|
'href' => $back,
|
||||||
|
'desc' => $this->l('Cancel')
|
||||||
|
);
|
||||||
|
|
||||||
// Todo: change for "Media" version
|
// Todo: change for "Media" version
|
||||||
$this->addJs(_PS_JS_DIR_.'jquery/plugins/fancybox/jquery.fancybox.js');
|
$this->addJs(_PS_JS_DIR_.'jquery/plugins/fancybox/jquery.fancybox.js');
|
||||||
$this->addJs(_PS_JS_DIR_.'jquery/plugins/autocomplete/jquery.autocomplete.js');
|
$this->addJs(_PS_JS_DIR_.'jquery/plugins/autocomplete/jquery.autocomplete.js');
|
||||||
$this->addCss(_PS_JS_DIR_.'jquery/plugins/fancybox/jquery.fancybox.css');
|
$this->addCss(_PS_JS_DIR_.'jquery/plugins/fancybox/jquery.fancybox.css');
|
||||||
$this->addCss(_PS_JS_DIR_.'jquery/plugins/autocomplete/jquery.autocomplete.css');
|
$this->addCss(_PS_JS_DIR_.'jquery/plugins/autocomplete/jquery.autocomplete.css');
|
||||||
|
|
||||||
$currentObject = $this->loadObject(true);
|
$current_object = $this->loadObject(true);
|
||||||
|
|
||||||
// All the filter are prefilled with the correct information
|
// All the filter are prefilled with the correct information
|
||||||
$customerFilter = '';
|
$customer_filter = '';
|
||||||
if (Validate::isUnsignedId($currentObject->id_customer) AND $customer = new Customer($currentObject->id_customer) AND Validate::isLoadedObject($customer))
|
if (Validate::isUnsignedId($current_object->id_customer) AND
|
||||||
$customerFilter = $customer->firstname.' '.$customer->lastname.' ('.$customer->email.')';
|
$customer = new Customer($current_object->id_customer) AND
|
||||||
$giftProductFilter = '';
|
Validate::isLoadedObject($customer))
|
||||||
if (Validate::isUnsignedId($currentObject->gift_product) AND $product = new Product($currentObject->gift_product, false, Context::getContext()->language->id) AND Validate::isLoadedObject($product))
|
$customer_filter = $customer->firstname.' '.$customer->lastname.' ('.$customer->email.')';
|
||||||
$giftProductFilter = trim($product->reference.' '.$product->name);
|
|
||||||
$reductionProductFilter = '';
|
|
||||||
if (Validate::isUnsignedId($currentObject->reduction_product) AND $product = new Product($currentObject->reduction_product, false, Context::getContext()->language->id) AND Validate::isLoadedObject($product))
|
|
||||||
$reductionProductFilter = trim($product->reference.' '.$product->name);
|
|
||||||
|
|
||||||
$product_rules = $this->getProductRulesDisplay($currentObject);
|
$gift_product_filter = '';
|
||||||
|
if (Validate::isUnsignedId($current_object->gift_product) AND
|
||||||
|
$product = new Product($current_object->gift_product, false, Context::getContext()->language->id) AND
|
||||||
|
Validate::isLoadedObject($product))
|
||||||
|
$gift_product_filter = trim($product->reference.' '.$product->name);
|
||||||
|
|
||||||
|
$reduction_product_filter = '';
|
||||||
|
if (Validate::isUnsignedId($current_object->reduction_product) AND
|
||||||
|
$product = new Product($current_object->reduction_product, false, Context::getContext()->language->id) AND
|
||||||
|
Validate::isLoadedObject($product))
|
||||||
|
$reduction_product_filter = trim($product->reference.' '.$product->name);
|
||||||
|
|
||||||
|
$product_rules = $this->getProductRulesDisplay($current_object);
|
||||||
|
|
||||||
Context::getContext()->smarty->assign(
|
Context::getContext()->smarty->assign(
|
||||||
array(
|
array(
|
||||||
|
'show_toolbar' => true,
|
||||||
|
'toolbar_btn' => $this->toolbar_btn,
|
||||||
|
'title' => $this->l('Payment : Cart Rules '),
|
||||||
'languages' => Language::getLanguages(),
|
'languages' => Language::getLanguages(),
|
||||||
'defaultDateFrom' => date('Y-m-d H:00:00'),
|
'defaultDateFrom' => date('Y-m-d H:00:00'),
|
||||||
'defaultDateTo' => date('Y-m-d H:00:00', strtotime('+1 year')),
|
'defaultDateTo' => date('Y-m-d H:00:00', strtotime('+1 year')),
|
||||||
'customerFilter' => $customerFilter,
|
'customerFilter' => $customer_filter,
|
||||||
'giftProductFilter' => $giftProductFilter,
|
'giftProductFilter' => $gift_product_filter,
|
||||||
'reductionProductFilter' => $reductionProductFilter,
|
'reductionProductFilter' => $reduction_product_filter,
|
||||||
'defaultCurrency' => Configuration::get('PS_CURRENCY_DEFAULT'),
|
'defaultCurrency' => Configuration::get('PS_CURRENCY_DEFAULT'),
|
||||||
'defaultLanguage' => Configuration::get('PS_LANG_DEFAULT'),
|
'defaultLanguage' => Configuration::get('PS_LANG_DEFAULT'),
|
||||||
'currencies' => Currency::getCurrencies(),
|
'currencies' => Currency::getCurrencies(),
|
||||||
'countries' => $currentObject->getAssociatedRestrictions('country', 1),
|
'countries' => $current_object->getAssociatedRestrictions('country', 1),
|
||||||
'carriers' => $currentObject->getAssociatedRestrictions('carrier', 1),
|
'carriers' => $current_object->getAssociatedRestrictions('carrier', 1),
|
||||||
'groups' => $currentObject->getAssociatedRestrictions('group', 0),
|
'groups' => $current_object->getAssociatedRestrictions('group', 0),
|
||||||
'cart_rules' => $currentObject->getAssociatedRestrictions('cart_rule', 1),
|
'cart_rules' => $current_object->getAssociatedRestrictions('cart_rule', 1),
|
||||||
'product_rules' => $product_rules,
|
'product_rules' => $product_rules,
|
||||||
'product_rules_counter' => count($product_rules),
|
'product_rules_counter' => count($product_rules),
|
||||||
'attribute_groups' => AttributeGroup::getAttributesGroups(Context::getContext()->language->id),
|
'attribute_groups' => AttributeGroup::getAttributesGroups(Context::getContext()->language->id),
|
||||||
'currentIndex' => self::$currentIndex,
|
'currentIndex' => self::$currentIndex,
|
||||||
'currentToken' => $this->token,
|
'currentToken' => $this->token,
|
||||||
'currentObject' => $currentObject,
|
'currentObject' => $current_object,
|
||||||
'currentTab' => $this
|
'currentTab' => $this
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user