How do you add pagination to a new page ( view page dispatch) for the products listed on that page?
How do you add products to a page?
Not sure if it is the correct method but what we tried was as below:
Goto Design > Layouts > Add Location
Add a new location with details as below:
Dispatch : View Page : pages.view
Name: TESTPAGE
Goto Pages Tab > Add Page > (eg. TESTPAGE) which was created as below
[From the Website > Content > Add Page > TEST PAGE]
Now on the Layout of the Page created above in the LAYOUT
Add a Grid > Add a block > Product Showcase
Now add Products manually to this block.
Goto the Page created in the Website > Content and do a Preview that page the products will show but they come all together without no pagination.
How to add Pagination?
I am afraid, it is not possible to add pagination for blocks with products.
But please check how the new pages with products are realized in the Bestsellers module (on sale, newest, etc)
Controller:
app/addons/bestsellers/controllers/frontend/products.post.php
Templates:
design/themes/YOUR_THEME/templates/addons/bestsellers/views/products/bestsellers.tpl
Is there a help / guide on how to create a page with pagination for products ?
I am afraid, it is not possible to add pagination for blocks with products.
But please check how the new pages with products are realized in the Bestsellers module (on sale, newest, etc)
Controller:
app/addons/bestsellers/controllers/frontend/products.post.php
Templates:
design/themes/YOUR_THEME/templates/addons/bestsellers/views/products/bestsellers.tpl
We dont have a frontend folder below bestseller\controllers
We dont have a frontend folder below bestseller\controllers
Sorry, it was added in the latest CS-Cart versions
A page with pagination should receive not only 'products' array, but the 'search' one.
You can see in app/controllers/frontend/products.php the following lines:
list($products, $search) = fn_get_products($params, Registry::get('settings.Appearance.products_per_page')); ... Registry::get('view')->assign('products', $products); Registry::get('view')->assign('search', $search);
The $products array is products as they are.
The $search array is used in the 'common/pagination.tpl' for creating pages.
But when you add products to the products block, only $products array is passed. Even if you do include the common/pagination.tpl file, there will not be anything to display
Thanks Simtech for the info, but then what is the workaround to have pagination on a page with products in a block?
I am afraid - too many code changes should be performed. Manual filling even cannot take the 'items per page' parameter to split the array into pages.
Thanks Simtech for the info, but then what is the workaround to have pagination on a page with products in a block?
It is not a trivial task since blocks can have different types of filling (manually, newest, bestsellers, etc) and different amount of items per page. So we recommend you to create separate page with products which will use built-in functions as in the Bestsellers module in the latest CS-Cart versions.
You can download the latest version from the CS-Cart website and check the mentioned files. The code is quite clear there
You can also try another filling, not manual.
When you use 'manual' filling, all selected items will be loaded as if on one page, without separating or limitation of 'items per page'.
You can also try another filling, not manual.
When you use 'manual' filling, all selected items will be loaded as if on one page, without separating or limitation of 'items per page'.
Unfortunately, it does not depend on filling types
Hi,
How to sorting manual selected products order by timestamp on manually filling block?
this code not working after 'picker' line
'params' => array ( 'sort_by' => 'timestamp', ),
Try to enable My changes addon and create the following file
app/addons/my_changes/schemas/block_manager/blocks.post.php
$schema[‘products’][‘content’][‘items’][‘fillings’][‘manually’][‘params’] = array(
‘sort_by’ => ‘timestamp’,
‘sort_order’ => ‘desc’,
);return $schema;
Then clear cache
(!) Not tested
hello eComlabs,
Try to enable My changes addon and create the following file
app/addons/my_changes/schemas/block_manager/blocks.post.php
php
$schema['products']['content']['items']['fillings']['manually']['params'] = array(
'sort_by' => 'timestamp',
'sort_order' => 'desc',
);
return $schema;Then clear cache
not working!
thank you
hello eComlabs,
not working!
thank you
It should work. Try to delete the var/cache directory manually