This extension allows to get the content of any product listing (category page or search results) in JSON format.
Example:
https://[mymagentostore]/women.html?p=2&ajax=1
{
"success": true,
"current_page_url": "https:\/\/[mymagentostore]\/women.html?p=2",
"previous_page_url": "https:\/\/[mymagentostore]\/women.html",
"next_page_url": "https:\/\/[mymagentostore]\/women.html?p=3",
"html": {
"content": "[html_content]",
"sidebar_main": "[html_content]",
}
}
Magento Open Source Edition 2.2 or 2.3
- Switch to your Magento project root
- Run
composer require shopigo/magento2-extension-ajax-listing
- Download ZIP Archive
- Switch to your Magento project root
- Create folder
app/code/Shopigo/CatalogAjaxListing
- Extract zip into path
- Switch to your Magento project root
- Run the following commands to enable the module and clear static contents generated by Magento:
php bin/magento module:enable Shopigo_CatalogAjaxListing
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy
- On any product listing (category page or search results), add a parameter "ajax=1" to the URL
Field | Format | Description | Example |
---|---|---|---|
success | boolean | Response state. Set to true in case of success. |
true |
current_page_url | string | Current page URL | https://[mymagentostore]/women.html?p=3 |
previous_page_url | string | Previous page URL (if existing) | https://[mymagentostore]/women.html?p=2 |
next_page_url | string | Next page URL (if existing) | https://[mymagentostore]/women.html?p=4 |
html[content] | string | HTML content of the products list | - |
html[sidebar_main] | string | HTML content of the main sidebar | - |
Field | Format | Description | Example |
---|---|---|---|
success | boolean | Response state. Set to false in case of error. |
false |
error_message | string | Error message | Unable to load block content. |
If you have any issues, open a bug report in GitHub's issue tracker.
Version 1.0.1 (2019-02-07)
- Fix composer.json for Magento 2.3
Version 1.0.0 (2018-10-09)
- First version
The code is licensed under Open Software License ("OSL") v. 3.0.
Enjoy!