// fix position in list for products, product images. still need to fix display after change position product images

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@10302 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
tDidierjean
2011-11-20 19:47:07 +00:00
parent 70c92e1d38
commit 9e8d16ad6a
5 changed files with 10 additions and 24 deletions
@@ -178,10 +178,10 @@
</td> </td>
<td class="center positionImage">{$image->position}</td> <td class="center positionImage">{$image->position}</td>
<td id="td_{$image->id}" class="pointer dragHandle center"> <td id="td_{$image->id}" class="pointer dragHandle center">
<a {if $image->position}style="display: none;"{/if} href="{$currentIndex}&amp;id_image={$image->id_image}&amp;imgPosition={$image->position -1}&amp;imgDirection=0&amp;token={$token}"> <a {if $image->position == 1}style="display: none;"{/if} href="{$currentIndex}&amp;id_image={$image->id_image}&amp;imgPosition={$image->position -1}&amp;imgDirection=0&amp;token={$token}">
<img src="../img/admin/up.gif" alt="" border="0"> <img src="../img/admin/up.gif" alt="" border="0">
</a> </a>
<a {if $image->position} == $imagesTotal} style="display: none;"{/if} href="{$currentIndex}&amp;id_image={$image->id_image}&amp;imgPosition={$image->position+1}&amp;imgDirection=1&amp;token={$token}"> <a {if $image->position == count($images)} style="display: none;"{/if} href="{$currentIndex}&amp;id_image={$image->id_image}&amp;imgPosition={$image->position+1}&amp;imgDirection=1&amp;token={$token}">
<img src="../img/admin/down.gif" alt="" border="0"> <img src="../img/admin/down.gif" alt="" border="0">
</a> </a>
</td> </td>
@@ -33,6 +33,7 @@ class AdminAttributesGroupsControllerCore extends AdminController
$this->table = 'attribute_group'; $this->table = 'attribute_group';
$this->className = 'AttributeGroup'; $this->className = 'AttributeGroup';
$this->lang = true; $this->lang = true;
$this->_defaultOrderBy = 'position';
$this->fieldsDisplay = array( $this->fieldsDisplay = array(
'id_attribute_group' => array( 'id_attribute_group' => array(
@@ -41,7 +42,7 @@ class AdminAttributesGroupsControllerCore extends AdminController
), ),
'name' => array( 'name' => array(
'title' => $this->l('Name'), 'title' => $this->l('Name'),
'width' => 140, 'width' => 'auto',
'filter_key' => 'b!name' 'filter_key' => 'b!name'
), ),
'position' => array( 'position' => array(
@@ -530,17 +531,4 @@ class AdminAttributesGroupsControllerCore extends AdminController
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);
}
} }
@@ -37,6 +37,7 @@ class AdminCarriersControllerCore extends AdminController
$this->addRowAction('edit'); $this->addRowAction('edit');
$this->addRowAction('delete'); $this->addRowAction('delete');
$this->_defaultOrderBy = 'position';
$this->requiredDatabase = true; $this->requiredDatabase = true;
$this->context = Context::getContext(); $this->context = Context::getContext();
@@ -630,11 +631,6 @@ class AdminCarriersControllerCore extends AdminController
*/ */
public function getList($id_lang, $order_by = null, $order_way = null, $start = 0, $limit = null, $id_lang_shop = false) 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); parent::getList($id_lang, $order_by, $order_way, $start, $limit, $id_lang_shop);
foreach ($this->_list as $key => $list) foreach ($this->_list as $key => $list)
@@ -58,6 +58,7 @@ class AdminProductsController extends AdminController
$this->duplicate = true; $this->duplicate = true;
$this->imageType = 'jpg'; $this->imageType = 'jpg';
$this->context = Context::getContext(); $this->context = Context::getContext();
$this->_defaultOrderBy = 'position';
$this->fieldsDisplay = array( $this->fieldsDisplay = array(
'id_product' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 20), 'id_product' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 20),
@@ -47,14 +47,15 @@ class AdminTaxRulesGroupControllerCore extends AdminController
), ),
'name' => array( 'name' => array(
'title' => $this->l('Name'), 'title' => $this->l('Name'),
'width' => 140 'width' => 'auto'
), ),
'active' => array( 'active' => array(
'title' => $this->l('Enabled'), 'title' => $this->l('Enabled'),
'width' => 25, 'width' => 25,
'active' => 'status', 'active' => 'status',
'type' => 'bool', 'type' => 'bool',
'orderby' => false 'orderby' => false,
'align' => 'center'
) )
); );