// fix on attribute positions in FO (Attribute constructor was incorrect)
This commit is contained in:
@@ -186,6 +186,18 @@ class AdminAttributes extends AdminTab
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Modifying initial getList method to display position feature (drag and drop)
|
||||||
|
*/
|
||||||
|
public function getList($id_lang, $order_by = null, $order_way = null, $start = 0, $limit = null, $id_lang_shop = false)
|
||||||
|
{
|
||||||
|
if ($order_by && $this->context->cookie->__get($this->table.'Orderby'))
|
||||||
|
$order_by = $this->context->cookie->__get($this->table.'Orderby');
|
||||||
|
else
|
||||||
|
$order_by = 'position';
|
||||||
|
|
||||||
|
parent::getList($id_lang, $order_by, $order_way, $start, $limit, $id_lang_shop);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ class AdminAttributesGroups extends AdminTab
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
$this->adminAttributes->tabAccess = Profile::getProfileAccess(Context::getContext()->employee->id_profile, $this->id);
|
$this->adminAttributes->tabAccess = Profile::getProfileAccess(Context::getContext()->employee->id_profile, $this->id);
|
||||||
if (Tools::isSubmit('submitAddattribute') || Tools::isSubmit('submitDelattribute'))
|
if (Tools::isSubmit('submitAddattribute') || Tools::isSubmit('submitDelattribute') || (Tools::getValue('position') && Tools::getValue('id_attribute')))
|
||||||
$this->adminAttributes->postProcess($this->token);
|
$this->adminAttributes->postProcess($this->token);
|
||||||
|
|
||||||
Module::hookExec('postProcessAttributeGroup',
|
Module::hookExec('postProcessAttributeGroup',
|
||||||
@@ -279,6 +279,10 @@ class AdminAttributesGroups extends AdminTab
|
|||||||
* displayListAttributes
|
* displayListAttributes
|
||||||
*
|
*
|
||||||
* Display a list of attributes from a group
|
* Display a list of attributes from a group
|
||||||
|
* @param integer $id
|
||||||
|
* @param integer $irow
|
||||||
|
* @param array $tr
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function displayListAttributes($id, $irow, $tr)
|
public function displayListAttributes($id, $irow, $tr)
|
||||||
{
|
{
|
||||||
@@ -296,8 +300,9 @@ class AdminAttributesGroups extends AdminTab
|
|||||||
<tbody>';
|
<tbody>';
|
||||||
$attributes = AttributeGroup::getAttributes(Context::getContext()->language->id, $id);
|
$attributes = AttributeGroup::getAttributes(Context::getContext()->language->id, $id);
|
||||||
$nbrow = 0;
|
$nbrow = 0;
|
||||||
foreach ($attributes AS $attribute)
|
foreach ($attributes as $attribute)
|
||||||
{
|
{
|
||||||
|
$id_category = 1;
|
||||||
$class = ($irow % 2) ? '': 'not_';
|
$class = ($irow % 2) ? '': 'not_';
|
||||||
echo '
|
echo '
|
||||||
<tr'.($nbrow++ % 2 ? ' class="'.$class.'alt_row"' : '').' id="tr_'.$attribute['id_attribute_group'].'_'.$attribute['id_attribute'].'_'.$attribute['position'].'">
|
<tr'.($nbrow++ % 2 ? ' class="'.$class.'alt_row"' : '').' id="tr_'.$attribute['id_attribute_group'].'_'.$attribute['id_attribute'].'_'.$attribute['position'].'">
|
||||||
@@ -306,7 +311,7 @@ class AdminAttributesGroups extends AdminTab
|
|||||||
'.($tr['is_color_group'] ? '<div style="float: left; width: 18px; height: 12px; border: 1px solid #996633; background-color: '.$attribute['color'].'; margin-right: 4px;"></div>' : '')
|
'.($tr['is_color_group'] ? '<div style="float: left; width: 18px; height: 12px; border: 1px solid #996633; background-color: '.$attribute['color'].'; margin-right: 4px;"></div>' : '')
|
||||||
.$attribute['name'].'
|
.$attribute['name'].'
|
||||||
</td>
|
</td>
|
||||||
<td class="dragHandle">';
|
<td class="dragHandle" '.(isset($attribute['position']) ? ' id="td_'.(isset($id_category) && $id_category ? $id_category : 0).'_'.$attribute['id_attribute'].'"' : '').'">';
|
||||||
|
|
||||||
echo '<a'.(!($attribute['position'] != $attributes[sizeof($attributes) - 1]['position']) ? ' style="display: none;"' : '').' href="'.self::$currentIndex.
|
echo '<a'.(!($attribute['position'] != $attributes[sizeof($attributes) - 1]['position']) ? ' style="display: none;"' : '').' href="'.self::$currentIndex.
|
||||||
'&id_attribute_group='.(int)($attribute['id_attribute_group']).'&id_attribute='.$attribute['id_attribute'].'
|
'&id_attribute_group='.(int)($attribute['id_attribute_group']).'&id_attribute='.$attribute['id_attribute'].'
|
||||||
@@ -337,6 +342,19 @@ class AdminAttributesGroups extends AdminTab
|
|||||||
onclick="changeFormParam(this.form, \''.self::$currentIndex.'\', '.$id.'); return confirm(\''.$this->l('Delete selected items?', __CLASS__, true, false).'\');" /></p>
|
onclick="changeFormParam(this.form, \''.self::$currentIndex.'\', '.$id.'); return confirm(\''.$this->l('Delete selected items?', __CLASS__, true, false).'\');" /></p>
|
||||||
</div>';
|
</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Modifying initial getList method to display position feature (drag and drop)
|
||||||
|
*/
|
||||||
|
public function getList($id_lang, $order_by = null, $order_way = null, $start = 0, $limit = null, $id_lang_shop = false)
|
||||||
|
{
|
||||||
|
if ($order_by && $this->context->cookie->__get($this->table.'Orderby'))
|
||||||
|
$order_by = $this->context->cookie->__get($this->table.'Orderby');
|
||||||
|
else
|
||||||
|
$order_by = 'position';
|
||||||
|
|
||||||
|
parent::getList($id_lang, $order_by, $order_way, $start, $limit, $id_lang_shop);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -281,4 +281,17 @@ class AdminFeatures extends AdminTab
|
|||||||
else
|
else
|
||||||
parent::postProcess();
|
parent::postProcess();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Modifying initial getList method to display position feature (drag and drop)
|
||||||
|
*/
|
||||||
|
public function getList($id_lang, $order_by = null, $order_way = null, $start = 0, $limit = null, $id_lang_shop = false)
|
||||||
|
{
|
||||||
|
if ($order_by && $this->context->cookie->__get($this->table.'Orderby'))
|
||||||
|
$order_by = $this->context->cookie->__get($this->table.'Orderby');
|
||||||
|
else
|
||||||
|
$order_by = 'position';
|
||||||
|
|
||||||
|
parent::getList($id_lang, $order_by, $order_way, $start, $limit, $id_lang_shop);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,11 +54,11 @@ class AttributeCore extends ObjectModel
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
public function __construct()
|
public function __construct($id = null, $id_lang = null, $id_shop = null)
|
||||||
{
|
{
|
||||||
$this->image_dir = _PS_COL_IMG_DIR_;
|
$this->image_dir = _PS_COL_IMG_DIR_;
|
||||||
|
|
||||||
parent::__construct();
|
parent::__construct($id, $id_lang, $id_shop);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFields()
|
public function getFields()
|
||||||
|
|||||||
@@ -107,6 +107,27 @@ class HelperOptionsCore extends Helper
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// pre-assign vars to the tpl
|
||||||
|
if ($field['type'] == 'maintenance_ip')
|
||||||
|
{
|
||||||
|
$field['script_ip'] = '
|
||||||
|
<script type="text/javascript">
|
||||||
|
function addRemoteAddr()
|
||||||
|
{
|
||||||
|
var length = $(\'input[name=PS_MAINTENANCE_IP]\').attr(\'value\').length;
|
||||||
|
if (length > 0)
|
||||||
|
$(\'input[name=PS_MAINTENANCE_IP]\').attr(\'value\',$(\'input[name=PS_MAINTENANCE_IP]\').attr(\'value\') +\','.Tools::getRemoteAddr().'\');
|
||||||
|
else
|
||||||
|
$(\'input[name=PS_MAINTENANCE_IP]\').attr(\'value\',\''.Tools::getRemoteAddr().'\');
|
||||||
|
}
|
||||||
|
</script>';
|
||||||
|
$field['link_remove_ip'] = '  <a href="#" class="button" onclick="addRemoteAddr(); return false;">'.$this->l('Add my IP').'</a>';
|
||||||
|
} else if ($field['type'] == 'price')
|
||||||
|
{
|
||||||
|
$field['currency_left'] = $this->context->currency->getSign('left');
|
||||||
|
$field['currency_right'] = $this->context->currency->getSign('right').' '.$this->l('(tax excl.)');
|
||||||
|
}
|
||||||
|
|
||||||
// Multishop default value
|
// Multishop default value
|
||||||
$field['multishop_default'] = (Shop::isFeatureActive() && Context::shop() != Shop::CONTEXT_ALL && !$isInvisible);
|
$field['multishop_default'] = (Shop::isFeatureActive() && Context::shop() != Shop::CONTEXT_ALL && !$isInvisible);
|
||||||
|
|
||||||
@@ -116,6 +137,7 @@ class HelperOptionsCore extends Helper
|
|||||||
// Is at least one required field present?
|
// Is at least one required field present?
|
||||||
if (isset($field['required']) && $field['required'])
|
if (isset($field['required']) && $field['required'])
|
||||||
$required_fields = true;
|
$required_fields = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
// Assign the modifications back to parent array
|
// Assign the modifications back to parent array
|
||||||
$option_list[$category] = $category_data;
|
$option_list[$category] = $category_data;
|
||||||
|
|||||||
Reference in New Issue
Block a user