Skip to content

acharrex/magento2-extension-ajax-listing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Shopigo

Magento 2 AJAX Listing extension by Shopigo

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]",
    }
}

Requirements

Magento Open Source Edition 2.2 or 2.3

Installation

Method 1 - Installing via composer

  • Switch to your Magento project root
  • Run composer require shopigo/magento2-extension-ajax-listing

Method 2 - Installing using archive

  • Download ZIP Archive
  • Switch to your Magento project root
  • Create folder app/code/Shopigo/CatalogAjaxListing
  • Extract zip into path

Enable extension

  • 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

How to use it

  • On any product listing (category page or search results), add a parameter "ajax=1" to the URL

Response

Success

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 -

Error

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.

Support

If you have any issues, open a bug report in GitHub's issue tracker.

Change logs

Version 1.0.1 (2019-02-07)

  • Fix composer.json for Magento 2.3

Version 1.0.0 (2018-10-09)

  • First version

License

The code is licensed under Open Software License ("OSL") v. 3.0.


Enjoy!