Add pagination to the product list (backOffice)
This commit is contained in:
@@ -169,7 +169,8 @@ class CategoryController extends AbstractSeoCrudController
|
|||||||
return array(
|
return array(
|
||||||
'category_id' => $this->getRequest()->get('category_id', 0),
|
'category_id' => $this->getRequest()->get('category_id', 0),
|
||||||
'folder_id' => $this->getRequest()->get('folder_id', 0),
|
'folder_id' => $this->getRequest()->get('folder_id', 0),
|
||||||
'current_tab' => $this->getRequest()->get('current_tab', 'general')
|
'current_tab' => $this->getRequest()->get('current_tab', 'general'),
|
||||||
|
'page' => $this->getRequest()->get('page', 1)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -182,14 +183,17 @@ class CategoryController extends AbstractSeoCrudController
|
|||||||
array(
|
array(
|
||||||
'category_order' => $currentOrder,
|
'category_order' => $currentOrder,
|
||||||
'product_order' => $product_order,
|
'product_order' => $product_order,
|
||||||
'category_id' => $this->getRequest()->get('category_id', 0)
|
'category_id' => $this->getRequest()->get('category_id', 0),
|
||||||
|
'page' => $this->getRequest()->get('page', 1)
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function redirectToListTemplate()
|
protected function redirectToListTemplate()
|
||||||
{
|
{
|
||||||
$category_id = $this->getRequest()->get('category_id', 0);
|
$this->redirectToRoute('admin.categories', array(
|
||||||
$this->redirectToListTemplateWithId($category_id);
|
'category_id' => $this->getRequest()->get('category_id', 0),
|
||||||
|
'page' => $this->getRequest()->get('page', 1))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function redirectToListTemplateWithId($category_id)
|
protected function redirectToListTemplateWithId($category_id)
|
||||||
|
|||||||
@@ -361,7 +361,8 @@ class ProductController extends AbstractSeoCrudController
|
|||||||
'product_id' => $this->getRequest()->get('product_id', 0),
|
'product_id' => $this->getRequest()->get('product_id', 0),
|
||||||
'folder_id' => $this->getRequest()->get('folder_id', 0),
|
'folder_id' => $this->getRequest()->get('folder_id', 0),
|
||||||
'accessory_category_id' => $this->getRequest()->get('accessory_category_id', 0),
|
'accessory_category_id' => $this->getRequest()->get('accessory_category_id', 0),
|
||||||
'current_tab' => $this->getRequest()->get('current_tab', 'general')
|
'current_tab' => $this->getRequest()->get('current_tab', 'general'),
|
||||||
|
'page' => $this->getRequest()->get('page', 1)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -386,7 +387,8 @@ class ProductController extends AbstractSeoCrudController
|
|||||||
return $this->render('categories',
|
return $this->render('categories',
|
||||||
array(
|
array(
|
||||||
'product_order' => $currentOrder,
|
'product_order' => $currentOrder,
|
||||||
'category_id' => $this->getCategoryId()
|
'category_id' => $this->getCategoryId(),
|
||||||
|
'page' => $this->getRequest()->get('page', 1)
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -394,7 +396,10 @@ class ProductController extends AbstractSeoCrudController
|
|||||||
{
|
{
|
||||||
$this->redirectToRoute(
|
$this->redirectToRoute(
|
||||||
'admin.products.default',
|
'admin.products.default',
|
||||||
array('category_id' => $this->getCategoryId())
|
array(
|
||||||
|
'category_id' => $this->getCategoryId(),
|
||||||
|
'page' => $this->getRequest()->get('page', 1)
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -438,18 +443,6 @@ class ProductController extends AbstractSeoCrudController
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function performAdditionalUpdateAction($updateEvent)
|
|
||||||
{
|
|
||||||
if ($this->getRequest()->get('save_mode') != 'stay') {
|
|
||||||
|
|
||||||
// Redirect to parent product list
|
|
||||||
$this->redirectToRoute(
|
|
||||||
'admin.categories.default',
|
|
||||||
array('category_id' => $this->getCategoryId())
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function performAdditionalUpdatePositionAction($positionEvent)
|
protected function performAdditionalUpdatePositionAction($positionEvent)
|
||||||
{
|
{
|
||||||
// Redirect to parent product list
|
// Redirect to parent product list
|
||||||
|
|||||||
@@ -270,20 +270,20 @@
|
|||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
<tbody>
|
<tbody>
|
||||||
{loop name="product_list" type="product" visible="*" category_default=$category_id order=$product_order}
|
{loop name="product_list" type="product" visible="*" category_default=$category_id order=$product_order page=$page limit=#max_displayed_products#}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{$ID}</td>
|
<td>{$ID}</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
{loop type="image" name="cat_image" source="product" source_id="$ID" limit="1" width="50" height="50" resize_mode="crop" backend_context="1"}
|
{loop type="image" name="cat_image" source="product" source_id="$ID" limit="1" width="50" height="50" resize_mode="crop" backend_context="1"}
|
||||||
<a href="{url path='/admin/products/update' product_id=$OBJECT_ID}" title="{intl l='Edit this product'}">
|
<a href="{url path='/admin/products/update' product_id=$OBJECT_ID page=$page}" title="{intl l='Edit this product'}">
|
||||||
<img src="{$IMAGE_URL}" alt="{$TITLE}" />
|
<img src="{$IMAGE_URL}" alt="{$TITLE}" />
|
||||||
</a>
|
</a>
|
||||||
{/loop}
|
{/loop}
|
||||||
|
|
||||||
<td class="object-title"><a href="{url path='/admin/products/update' product_id=$ID}" title="{intl l='Edit this product'}">{$REF}</a></td>
|
<td class="object-title"><a href="{url path='/admin/products/update' product_id=$ID page=$page}" title="{intl l='Edit this product'}">{$REF}</a></td>
|
||||||
|
|
||||||
<td class="object-title"><a href="{url path='/admin/products/update' product_id=$ID}" title="{intl l='Edit this product'}">{$TITLE}</a></td>
|
<td class="object-title"><a href="{url path='/admin/products/update' product_id=$ID page=$page}" title="{intl l='Edit this product'}">{$TITLE}</a></td>
|
||||||
|
|
||||||
{module_include location='product_list_row'}
|
{module_include location='product_list_row'}
|
||||||
|
|
||||||
@@ -316,7 +316,7 @@
|
|||||||
<td class="actions">
|
<td class="actions">
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
{loop type="auth" name="can_change" role="ADMIN" resource="admin.product" access="UPDATE"}
|
{loop type="auth" name="can_change" role="ADMIN" resource="admin.product" access="UPDATE"}
|
||||||
<a class="btn btn-default btn-xs" title="{intl l='Edit this product'}" href="{url path='/admin/products/update' product_id=$ID}"><i class="glyphicon glyphicon-edit"></i></a>
|
<a class="btn btn-default btn-xs" title="{intl l='Edit this product'}" href="{url path='/admin/products/update' product_id=$ID page=$page}"><i class="glyphicon glyphicon-edit"></i></a>
|
||||||
{/loop}
|
{/loop}
|
||||||
|
|
||||||
{loop type="auth" name="can_delete" role="ADMIN" resource="admin.product" access="DELETE"}
|
{loop type="auth" name="can_delete" role="ADMIN" resource="admin.product" access="DELETE"}
|
||||||
@@ -327,6 +327,20 @@
|
|||||||
</tr>
|
</tr>
|
||||||
{/loop}
|
{/loop}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
<tfoot>
|
||||||
|
<tr>
|
||||||
|
<td colspan="6">
|
||||||
|
{include
|
||||||
|
file = "includes/pagination.html"
|
||||||
|
|
||||||
|
loop_ref = "product_list"
|
||||||
|
max_page_count = 10
|
||||||
|
page_url = "{url path="/admin/categories" category_id=$category_id product_order=$product_order}"
|
||||||
|
}
|
||||||
|
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tfoot>
|
||||||
{/ifloop}
|
{/ifloop}
|
||||||
|
|
||||||
{elseloop rel="product_list"}
|
{elseloop rel="product_list"}
|
||||||
@@ -610,6 +624,7 @@
|
|||||||
{capture "product_delete_dialog"}
|
{capture "product_delete_dialog"}
|
||||||
<input type="hidden" name="product_id" id="product_delete_id" value="" />
|
<input type="hidden" name="product_id" id="product_delete_id" value="" />
|
||||||
<input type="hidden" name="category_id" value="{$category_id}" />
|
<input type="hidden" name="category_id" value="{$category_id}" />
|
||||||
|
<input type="hidden" name="page" value="{$page}">
|
||||||
|
|
||||||
{module_include location='product_delete_form'}
|
{module_include location='product_delete_form'}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
# --------------------------------
|
# --------------------------------
|
||||||
max_displayed_orders = 20
|
max_displayed_orders = 20
|
||||||
max_displayed_customers = 20
|
max_displayed_customers = 20
|
||||||
|
max_displayed_products = 20
|
||||||
|
|
||||||
# order status - seems ununsed ?
|
# order status - seems ununsed ?
|
||||||
# ------------------------------
|
# ------------------------------
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
{* Be sure to get the product ID, even if the form could not be validated*}
|
{* Be sure to get the product ID, even if the form could not be validated*}
|
||||||
|
<input type="hidden" name="page" value="{$page}" />
|
||||||
<input type="hidden" name="product_id" value="{$product_id}">
|
<input type="hidden" name="product_id" value="{$product_id}">
|
||||||
<input type="hidden" name="current_tab" value="general">
|
<input type="hidden" name="current_tab" value="general">
|
||||||
|
|
||||||
@@ -22,7 +23,7 @@
|
|||||||
{/form_field}
|
{/form_field}
|
||||||
|
|
||||||
{form_field form=$form field='success_url'}
|
{form_field form=$form field='success_url'}
|
||||||
<input type="hidden" name="{$name}" value="{url path='/admin/categories' category_id=$DEFAULT_CATEGORY}">
|
<input type="hidden" name="{$name}" value="{url path='/admin/categories' category_id=$DEFAULT_CATEGORY page=$page}">
|
||||||
{/form_field}
|
{/form_field}
|
||||||
|
|
||||||
{form_field form=$form field='locale'}
|
{form_field form=$form field='locale'}
|
||||||
|
|||||||
Reference in New Issue
Block a user