2017 © Pedro Peláez
 

magento-module mbiz_ajax

Magento module which adds some ajax features.

image

monsieurbiz/mbiz_ajax

Magento module which adds some ajax features.

  • Friday, July 22, 2016
  • by jacquesbh
  • Repository
  • 1 Watchers
  • 1 Stars
  • 4 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Mbiz_Ajax

This modules adds AJAX_ handles if the request is performed using ajax call., (*1)

It also adds a simple JSON response of the category view., (*2)

You have to write your own ajax if you want to make it works., (*3)

Javascript example:, (*4)

(function ($) {
  $(document).ready(function () {
    // Catalog Category View
    if ($('.catalog-category-view').length) {

      // If we have a load more button
      var $more = $('.js-load-more');
      if ($more.length) {

        // On click on this button
        $more.click(function () {

          // Call the next page url in ajax
          var pagerData = {};
          pagerData[$more.attr('data-page-var-name')] = $more.attr('data-next-page');
          $.getJSON(
            {
              url: $more.attr('data-url'),
              dataType: 'json',
              data: pagerData,
              success: function (data) {

                // Disable if last page
                if (data.is_last_page) {
                  $more
                    .attr('disabled', true)
                    .addClass('disabled')
                  ;
                }

                // Insert products
                $('.product-list').append(data.body);

                // Update next page
                $more.attr('data-next-page', data.next_page);
              }
            }
          );

        });
      }
    }
  });
})(jQuery);

You can also use the handles to perform some updates on the page in ajax mode., (*5)

Example:, (*6)

<AJAX_catalog_category_view>
    <reference name="product_list">
        <!-- Change template of the product list -->
        <action method="setTemplate">
            <template>catalog/product/list_ajax.phtml</template>
        </action>
    </reference>
</AJAX_catalog_category_view>

The Versions

22/07 2016

dev-master

9999999-dev

Magento module which adds some ajax features.

  Sources   Download

GPL-3.0

22/07 2016

0.1.0

0.1.0.0

Magento module which adds some ajax features.

  Sources   Download

GPL-3.0