magepal/magento2-ajax-newsletter-subscribe 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

magepal/magento2-ajax-newsletter-subscribe

最新稳定版本:1.2.1

Composer 安装命令:

composer require magepal/magento2-ajax-newsletter-subscribe

包简介

Ajax Newsletter Subscription

README 文档

README

Ajax Newsletter Subscription for Magento 2

Installation

Step 1

Using Composer (recommended)
composer require magepal/magento2-ajax-newsletter-subscribe
Manually
  • Download the extension
  • Unzip the file
  • Create a folder {Magento 2 root}/app/code/MagePal/AjaxNewsletterSubscribe
  • Copy the content from *unzip folder

Step 2 - Enable extension ("cd" to {Magento root} folder)

  php -f bin/magento module:enable --clear-static-content MagePal_AjaxNewsletterSubscribe
  php -f bin/magento setup:upgrade

Usage

$('#newsletter-validate-detail').submit(function (e) {
    if ($(this).valid()) {
         var url = $form.attr('action');
         var postData = $form.serializeArray();
    
        try {
            $.ajax({
                url: url,
                dataType: 'json',
                type: 'POST',
                showLoader: true,
                data: $.param(postData),
                complete: function (data) {
                    if (typeof data === 'object') {
                        data = data.responseJSON;
                        //json object
                    } else {
                        //Unknown Error
                    }
                }
            });
        } catch (e) {
                //check for errors
        }
    }
    
    return false;
});

Return JSON

$response = [
    'status' => 1,
    'msg' => __('The confirmation request has been sent.'),
];

$response = [
    'status' => 0,
    'msg' => __('There was a problem with the subscription: %1', $e->getMessage()),
];

© MagePal LLC. | www.magepal.com

统计信息

  • 总下载量: 4.85k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 2
  • Forks: 5
  • 开发语言: PHP

其他信息

  • 授权协议: proprietary
  • 更新时间: 2020-12-25