// AdminCartRulesController : fixed toolbar in initForm()
This commit is contained in:
1 parent
eb2b923568
commit
f0eecb587f
2 files changed
+54
-19
No files matched your search
@@ -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 class="productTabs">
|
||||
<ul class="tab">
|
||||
|
||||
@@ -270,48 +270,68 @@ class AdminCartRulesControllerCore extends AdminController
|
||||
|
||||
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
|
||||
$this->addJs(_PS_JS_DIR_.'jquery/plugins/fancybox/jquery.fancybox.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/autocomplete/jquery.autocomplete.css');
|
||||
|
||||
$currentObject = $this->loadObject(true);
|
||||
$current_object = $this->loadObject(true);
|
||||
|
||||
// All the filter are prefilled with the correct information
|
||||
$customerFilter = '';
|
||||
if (Validate::isUnsignedId($currentObject->id_customer) AND $customer = new Customer($currentObject->id_customer) AND Validate::isLoadedObject($customer))
|
||||
$customerFilter = $customer->firstname.' '.$customer->lastname.' ('.$customer->email.')';
|
||||
$giftProductFilter = '';
|
||||
if (Validate::isUnsignedId($currentObject->gift_product) AND $product = new Product($currentObject->gift_product, false, Context::getContext()->language->id) AND Validate::isLoadedObject($product))
|
||||
$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);
|
||||
$customer_filter = '';
|
||||
if (Validate::isUnsignedId($current_object->id_customer) AND
|
||||
$customer = new Customer($current_object->id_customer) AND
|
||||
Validate::isLoadedObject($customer))
|
||||
$customer_filter = $customer->firstname.' '.$customer->lastname.' ('.$customer->email.')';
|
||||
|
||||
$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(
|
||||
array(
|
||||
'show_toolbar' => true,
|
||||
'toolbar_btn' => $this->toolbar_btn,
|
||||
'title' => $this->l('Payment : Cart Rules '),
|
||||
'languages' => Language::getLanguages(),
|
||||
'defaultDateFrom' => date('Y-m-d H:00:00'),
|
||||
'defaultDateTo' => date('Y-m-d H:00:00', strtotime('+1 year')),
|
||||
'customerFilter' => $customerFilter,
|
||||
'giftProductFilter' => $giftProductFilter,
|
||||
'reductionProductFilter' => $reductionProductFilter,
|
||||
'customerFilter' => $customer_filter,
|
||||
'giftProductFilter' => $gift_product_filter,
|
||||
'reductionProductFilter' => $reduction_product_filter,
|
||||
'defaultCurrency' => Configuration::get('PS_CURRENCY_DEFAULT'),
|
||||
'defaultLanguage' => Configuration::get('PS_LANG_DEFAULT'),
|
||||
'currencies' => Currency::getCurrencies(),
|
||||
'countries' => $currentObject->getAssociatedRestrictions('country', 1),
|
||||
'carriers' => $currentObject->getAssociatedRestrictions('carrier', 1),
|
||||
'groups' => $currentObject->getAssociatedRestrictions('group', 0),
|
||||
'cart_rules' => $currentObject->getAssociatedRestrictions('cart_rule', 1),
|
||||
'countries' => $current_object->getAssociatedRestrictions('country', 1),
|
||||
'carriers' => $current_object->getAssociatedRestrictions('carrier', 1),
|
||||
'groups' => $current_object->getAssociatedRestrictions('group', 0),
|
||||
'cart_rules' => $current_object->getAssociatedRestrictions('cart_rule', 1),
|
||||
'product_rules' => $product_rules,
|
||||
'product_rules_counter' => count($product_rules),
|
||||
'attribute_groups' => AttributeGroup::getAttributesGroups(Context::getContext()->language->id),
|
||||
'currentIndex' => self::$currentIndex,
|
||||
'currentToken' => $this->token,
|
||||
'currentObject' => $currentObject,
|
||||
'currentObject' => $current_object,
|
||||
'currentTab' => $this
|
||||
)
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user