├── .editorconfig ├── .gitignore ├── .travis.yml ├── CHANGELOG.md ├── CONTRIBUTING.md ├── ISSUE_TEMPLATE.md ├── LICENSE.txt ├── README.md ├── app ├── code │ └── community │ │ └── Ebizmarts │ │ └── MailChimp │ │ ├── Block │ │ ├── Adminhtml │ │ │ ├── Customer │ │ │ │ └── Edit │ │ │ │ │ └── Tab │ │ │ │ │ └── Mailchimp.php │ │ │ ├── Ecommerce │ │ │ │ ├── Resendecommercedata.php │ │ │ │ └── Resendecommercedata │ │ │ │ │ └── Form.php │ │ │ ├── Mailchimperrors.php │ │ │ ├── Mailchimperrors │ │ │ │ ├── Grid.php │ │ │ │ └── Link.php │ │ │ ├── Mailchimpstores.php │ │ │ ├── Mailchimpstores │ │ │ │ ├── Edit.php │ │ │ │ ├── Edit │ │ │ │ │ └── Form.php │ │ │ │ └── Grid.php │ │ │ ├── Mergevars │ │ │ │ ├── Add.php │ │ │ │ └── Add │ │ │ │ │ └── Form.php │ │ │ ├── Newsletter │ │ │ │ └── Subscriber │ │ │ │ │ └── Renderer │ │ │ │ │ ├── Firstname.php │ │ │ │ │ └── Lastname.php │ │ │ ├── Notifications.php │ │ │ ├── Sales │ │ │ │ └── Order │ │ │ │ │ ├── Creditmemo │ │ │ │ │ └── Unsubscribe.php │ │ │ │ │ ├── Grid │ │ │ │ │ └── Renderer │ │ │ │ │ │ ├── Mailchimp.php │ │ │ │ │ │ └── MailchimpOrder.php │ │ │ │ │ └── View │ │ │ │ │ └── Info │ │ │ │ │ └── Monkey.php │ │ │ └── System │ │ │ │ └── Config │ │ │ │ ├── Account.php │ │ │ │ ├── CreateMergeFields.php │ │ │ │ ├── CreateWebhook.php │ │ │ │ ├── Date.php │ │ │ │ ├── Fieldset │ │ │ │ ├── Mailchimp │ │ │ │ │ └── Hint.php │ │ │ │ └── Mandrill │ │ │ │ │ └── Hint.php │ │ │ │ ├── Form │ │ │ │ └── Field │ │ │ │ │ └── Mapfields.php │ │ │ │ ├── OauthWizard.php │ │ │ │ ├── ResendEcommerceData.php │ │ │ │ ├── ResendSubscribers.php │ │ │ │ ├── ResetErrors.php │ │ │ │ └── Userinfo.php │ │ ├── Checkout │ │ │ ├── Subscribe.php │ │ │ └── Success │ │ │ │ └── Groups.php │ │ ├── Customer │ │ │ └── Newsletter │ │ │ │ └── Index.php │ │ ├── Group │ │ │ └── Type.php │ │ └── Popup │ │ │ └── Emailcatcher.php │ │ ├── Helper │ │ ├── Curl.php │ │ ├── Data.php │ │ ├── Data │ │ │ └── ApiKeyException.php │ │ ├── Date.php │ │ ├── File.php │ │ ├── Mandrill.php │ │ ├── Migration.php │ │ ├── Oauth2.php │ │ └── Webhook.php │ │ ├── Model │ │ ├── Adminhtml │ │ │ ├── Includetaxes │ │ │ │ └── Comment.php │ │ │ ├── Resendecommercedata │ │ │ │ └── Comment.php │ │ │ ├── Resendsubscribers │ │ │ │ └── Comment.php │ │ │ ├── Reseterrors │ │ │ │ └── Comment.php │ │ │ └── Storeid │ │ │ │ └── Comment.php │ │ ├── Api │ │ │ ├── Batches.php │ │ │ ├── Carts.php │ │ │ ├── Customers.php │ │ │ ├── ItemSynchronizer.php │ │ │ ├── Orders.php │ │ │ ├── Products.php │ │ │ ├── PromoCodes.php │ │ │ ├── PromoRules.php │ │ │ ├── Stores.php │ │ │ ├── Subscribers.php │ │ │ └── Subscribers │ │ │ │ ├── InterestGroupHandle.php │ │ │ │ └── MailchimpTags.php │ │ ├── ClearBatches.php │ │ ├── ClearEcommerce.php │ │ ├── Config.php │ │ ├── Cron.php │ │ ├── Ecommercesyncdata.php │ │ ├── Ecommercesyncdata │ │ │ └── Quote.php │ │ ├── Email │ │ │ ├── Queue.php │ │ │ ├── Template.php │ │ │ └── TemplateBase.php │ │ ├── Interestgroup.php │ │ ├── Mailchimperrors.php │ │ ├── Observer.php │ │ ├── ProcessWebhook.php │ │ ├── Resource │ │ │ ├── Ecommercesyncdata.php │ │ │ ├── Ecommercesyncdata │ │ │ │ ├── Collection.php │ │ │ │ ├── Customers │ │ │ │ │ └── Collection.php │ │ │ │ ├── Orders.php │ │ │ │ ├── Orders │ │ │ │ │ └── Collection.php │ │ │ │ ├── Product.php │ │ │ │ ├── Product │ │ │ │ │ └── Collection.php │ │ │ │ ├── PromoCodes.php │ │ │ │ ├── PromoCodes │ │ │ │ │ └── Collection.php │ │ │ │ ├── PromoRules │ │ │ │ │ └── Collection.php │ │ │ │ ├── Quote.php │ │ │ │ ├── Quote │ │ │ │ │ └── Collection.php │ │ │ │ └── Subscribers │ │ │ │ │ └── Collection.php │ │ │ ├── Interestgroup.php │ │ │ ├── Interestgroup │ │ │ │ └── Collection.php │ │ │ ├── Mailchimperrors.php │ │ │ ├── Mailchimperrors │ │ │ │ └── Collection.php │ │ │ ├── Stores.php │ │ │ ├── Stores │ │ │ │ └── Collection.php │ │ │ ├── Synchbatches.php │ │ │ ├── Synchbatches │ │ │ │ └── Collection.php │ │ │ ├── Webhookrequest.php │ │ │ └── Webhookrequest │ │ │ │ └── Collection.php │ │ ├── Stores.php │ │ ├── Subscriber.php │ │ ├── Synchbatches.php │ │ ├── System │ │ │ └── Config │ │ │ │ ├── Backend │ │ │ │ ├── Active.php │ │ │ │ ├── Apikey.php │ │ │ │ ├── Ecommerce.php │ │ │ │ ├── List.php │ │ │ │ ├── Mapfield.php │ │ │ │ ├── Store.php │ │ │ │ └── Twowaysync.php │ │ │ │ └── Source │ │ │ │ ├── Account.php │ │ │ │ ├── BatchLimit.php │ │ │ │ ├── Checkoutsubscribe.php │ │ │ │ ├── Cmspage.php │ │ │ │ ├── ConnectionTimeout.php │ │ │ │ ├── CustomerGroup.php │ │ │ │ ├── Fieldtype.php │ │ │ │ ├── ImageSize.php │ │ │ │ ├── IncludingTaxes.php │ │ │ │ ├── List.php │ │ │ │ ├── Log.php │ │ │ │ ├── MailchimpStoreView.php │ │ │ │ ├── OrderGrid.php │ │ │ │ ├── Store.php │ │ │ │ ├── Userinfo.php │ │ │ │ └── WebhookDelete.php │ │ └── Webhookrequest.php │ │ ├── controllers │ │ ├── Adminhtml │ │ │ ├── EcommerceController.php │ │ │ ├── MailchimpController.php │ │ │ ├── MailchimperrorsController.php │ │ │ ├── MailchimpstoresController.php │ │ │ └── MergevarsController.php │ │ ├── CartController.php │ │ ├── GroupController.php │ │ └── WebhookController.php │ │ ├── etc │ │ ├── adminhtml.xml │ │ ├── config.xml │ │ └── system.xml │ │ └── sql │ │ └── mailchimp_setup │ │ ├── mysql4-install-0.0.1.php │ │ ├── mysql4-upgrade-1.0.1-1.0.2.php │ │ ├── mysql4-upgrade-1.0.3-1.0.4.php │ │ ├── mysql4-upgrade-1.0.5-1.0.6.php │ │ ├── mysql4-upgrade-1.1.1-1.1.2.php │ │ ├── mysql4-upgrade-1.1.10-1.1.11.php │ │ ├── mysql4-upgrade-1.1.12-1.1.12.2.php │ │ ├── mysql4-upgrade-1.1.14-1.1.15.php │ │ ├── mysql4-upgrade-1.1.15-1.1.15.1.php │ │ ├── mysql4-upgrade-1.1.15.1-1.1.15.2.php │ │ ├── mysql4-upgrade-1.1.16.1-1.1.16.2.php │ │ ├── mysql4-upgrade-1.1.20-1.1.21.php │ │ ├── mysql4-upgrade-1.1.21-1.1.22.php │ │ ├── mysql4-upgrade-1.1.4-1.1.5.php │ │ ├── mysql4-upgrade-1.1.5-1.1.5.6.php │ │ ├── mysql4-upgrade-1.1.5.6-1.1.6.php │ │ ├── mysql4-upgrade-1.1.6-1.1.6.1.php │ │ ├── mysql4-upgrade-1.1.6.3-1.1.6.4.php │ │ ├── mysql4-upgrade-1.1.6.4-1.1.6.5.php │ │ ├── mysql4-upgrade-1.1.6.7-1.1.6.8.php │ │ ├── mysql4-upgrade-1.1.7-1.1.8.php │ │ ├── mysql4-upgrade-1.1.9.1-1.1.9.2.php │ │ └── mysql4-upgrade-1.1.9.2-1.1.9.3.php ├── design │ ├── adminhtml │ │ └── default │ │ │ └── default │ │ │ ├── layout │ │ │ └── ebizmarts │ │ │ │ └── mailchimp.xml │ │ │ └── template │ │ │ └── ebizmarts │ │ │ ├── mailchimp │ │ │ ├── customer │ │ │ │ └── tab │ │ │ │ │ └── mailchimp.phtml │ │ │ ├── notifications.phtml │ │ │ ├── sales │ │ │ │ └── order │ │ │ │ │ ├── creditmemo │ │ │ │ │ └── create │ │ │ │ │ │ └── unsubscribe.phtml │ │ │ │ │ └── view │ │ │ │ │ └── monkey.phtml │ │ │ └── system │ │ │ │ └── config │ │ │ │ ├── createmergefields.phtml │ │ │ │ ├── createwebhook.phtml │ │ │ │ ├── fieldset │ │ │ │ └── hint.phtml │ │ │ │ ├── form │ │ │ │ └── field │ │ │ │ │ └── array_dropdown.phtml │ │ │ │ ├── oauth_wizard.phtml │ │ │ │ ├── resendecommercedata.phtml │ │ │ │ ├── resendsubscribers.phtml │ │ │ │ └── reseterrors.phtml │ │ │ └── mandrill │ │ │ └── system │ │ │ └── config │ │ │ └── fieldset │ │ │ └── hint.phtml │ └── frontend │ │ └── base │ │ └── default │ │ ├── layout │ │ └── ebizmarts │ │ │ └── mailchimp.xml │ │ └── template │ │ └── ebizmarts │ │ └── mailchimp │ │ ├── checkout │ │ ├── subscribe.phtml │ │ └── success │ │ │ └── groups.phtml │ │ ├── customer │ │ └── newsletter │ │ │ └── index.phtml │ │ ├── group │ │ └── type │ │ │ ├── checkboxes.phtml │ │ │ ├── dropdown.phtml │ │ │ └── radio.phtml │ │ └── popup │ │ └── emailcatcher.phtml ├── etc │ └── modules │ │ └── Ebizmarts_MailChimp.xml └── locale │ └── en_US │ └── Ebizmarts_MailChimp.csv ├── composer.json ├── composer.lock ├── dev └── tests │ └── mailchimp │ ├── autoload.php │ ├── phpunit.xml │ └── tests │ ├── app │ └── Ebizmarts │ │ └── MailChimp │ │ ├── Block │ │ ├── Adminhtml │ │ │ ├── NotificationsTest.php │ │ │ └── Sales │ │ │ │ └── Order │ │ │ │ ├── Grid │ │ │ │ └── Renderer │ │ │ │ │ └── MailchimpOrderTest.php │ │ │ │ └── View │ │ │ │ └── Info │ │ │ │ └── MonkeyTest.php │ │ ├── Checkout │ │ │ └── Success │ │ │ │ └── GroupsTest.php │ │ └── Customer │ │ │ └── Newsletter │ │ │ └── IndexTest.php │ │ ├── Helper │ │ ├── DataTest.php │ │ ├── MigrationTest.php │ │ └── WebhookTest.php │ │ ├── Model │ │ ├── Adminhtml │ │ │ ├── Resendecommercedata │ │ │ │ └── CommentTest.php │ │ │ ├── Resendsubscribers │ │ │ │ └── CommentTest.php │ │ │ └── Reseterrors │ │ │ │ └── CommentTest.php │ │ ├── Api │ │ │ ├── BatchesTest.php │ │ │ ├── CartsTest.php │ │ │ ├── CustomersTest.php │ │ │ ├── ItemSynchronizerTest.php │ │ │ ├── OrdersTest.php │ │ │ ├── ProductsTest.php │ │ │ ├── PromoCodesTest.php │ │ │ ├── PromoRulesTest.php │ │ │ ├── StoresTest.php │ │ │ ├── Subscribers │ │ │ │ ├── InterestGroupHandleTest.php │ │ │ │ └── MailchimpTagsTest.php │ │ │ └── SubscribersTest.php │ │ ├── ClearEcommerceTest.php │ │ ├── Email │ │ │ └── TemplateTest.php │ │ ├── ObserverTest.php │ │ ├── ProcessWebhookTest.php │ │ └── System │ │ │ └── Config │ │ │ └── Source │ │ │ ├── ListTest.php │ │ │ └── StoreTest.php │ │ └── controllers │ │ ├── Adminhtml │ │ ├── EcommerceControllerTest.php │ │ ├── MailchimpControllerTest.php │ │ ├── MailchimperrorsControllerTest.php │ │ └── MailchimpstoresControllerTest.php │ │ └── GroupControllerTest.php │ └── lib │ ├── Ebizmarts │ └── MailChimpTest.php │ └── Mandrill │ └── MessageTest.php ├── js └── ebizmarts │ └── mailchimp │ ├── campaignCatcher.js │ ├── config.js │ ├── editstores.js │ ├── popup.css │ └── xmark.png ├── lib ├── Ebizmarts │ ├── MailChimp.php │ └── MailChimp │ │ ├── Abstract.php │ │ ├── AuthorizedApps.php │ │ ├── Automation.php │ │ ├── AutomationEmails.php │ │ ├── AutomationEmailsQueue.php │ │ ├── BatchOperations.php │ │ ├── CampaignFolders.php │ │ ├── Campaigns.php │ │ ├── CampaignsContent.php │ │ ├── CampaignsFeedback.php │ │ ├── CampaignsSendChecklist.php │ │ ├── Conversations.php │ │ ├── ConversationsMessages.php │ │ ├── Ecommerce.php │ │ ├── EcommerceCarts.php │ │ ├── EcommerceCustomers.php │ │ ├── EcommerceOrders.php │ │ ├── EcommerceOrdersLines.php │ │ ├── EcommerceProducts.php │ │ ├── EcommerceProductsVariants.php │ │ ├── EcommercePromoRules.php │ │ ├── EcommercePromoRulesPromoCodes.php │ │ ├── EcommerceStores.php │ │ ├── Exceptions.php │ │ ├── FileManagerFiles.php │ │ ├── FileManagerFolders.php │ │ ├── HttpError.php │ │ ├── Lists.php │ │ ├── ListsAbuseReports.php │ │ ├── ListsActivity.php │ │ ├── ListsClients.php │ │ ├── ListsGrowthHistory.php │ │ ├── ListsInterestCategory.php │ │ ├── ListsInterestCategoryInterests.php │ │ ├── ListsMembers.php │ │ ├── ListsMembersActivity.php │ │ ├── ListsMembersGoals.php │ │ ├── ListsMembersNotes.php │ │ ├── ListsMergeFields.php │ │ ├── ListsSegments.php │ │ ├── ListsSegmentsMembers.php │ │ ├── ListsWebhooks.php │ │ ├── Reports.php │ │ ├── ReportsCampaignAdvice.php │ │ ├── ReportsClickReports.php │ │ ├── ReportsClickReportsMembers.php │ │ ├── ReportsDomainPerformance.php │ │ ├── ReportsEapURLReport.php │ │ ├── ReportsEmailActivity.php │ │ ├── ReportsLocation.php │ │ ├── ReportsSentTo.php │ │ ├── ReportsSubReports.php │ │ ├── ReportsUnsubscribes.php │ │ ├── Root.php │ │ ├── TemplateFolders.php │ │ ├── Templates.php │ │ └── TemplatesDefaultContent.php └── Mandrill │ ├── Mandrill.php │ ├── Mandrill │ ├── Exceptions.php │ ├── Exports.php │ ├── Inbound.php │ ├── Internal.php │ ├── Ips.php │ ├── Messages.php │ ├── Metadata.php │ ├── Rejects.php │ ├── Senders.php │ ├── Subaccounts.php │ ├── Tags.php │ ├── Templates.php │ ├── Urls.php │ ├── Users.php │ ├── Webhooks.php │ └── Whitelists.php │ └── Message.php ├── modman ├── package.json ├── shell ├── getMailchimpResponse.php └── m4mlogs.sh └── skin └── adminhtml └── default └── default └── ebizmarts ├── mailchimp ├── css │ └── mailchimp.css └── images │ ├── logo-freddie-monocolor-200.png │ ├── mailchimp-ico.png │ └── mailchimp-tab.png └── mandrill ├── css └── mandrill.css └── images └── mandrill-tab.png /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig is awesome: http://EditorConfig.org 2 | 3 | root = true 4 | 5 | [*] 6 | charset = utf-8 7 | end_of_line = lf 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | app/code/community/Ebizmarts/MailChimp/controllers/TestController.php 3 | /vendor/ 4 | /node_modules/ 5 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | dist: trusty 2 | language: php 3 | php: 4 | - 5.5 5 | - 5.6 6 | - 7.0 7 | 8 | env: 9 | global: 10 | - COMPOSER_BIN_DIR=~/bin 11 | - CODE_EXTENSIONS=phtml,php,js,css 12 | - MAGENTO_ARCHIVE=magento-1.9.4.0.tar.bz2 13 | - MAGENTO_ROOT=$TRAVIS_BUILD_DIR/magento 14 | matrix: 15 | - TEST_SUITE=marketplace_review 16 | - TEST_SUITE=phpunit 17 | - TEST_SUITE=ecg_coding_standards 18 | - TEST_SUITE=meqp1_coding_standards 19 | 20 | matrix: 21 | allow_failures: 22 | - env: TEST_SUITE=ecg_coding_standards 23 | - env: TEST_SUITE=meqp1_coding_standards 24 | include: 25 | - php: 7.0 26 | env: TEST_SUITE=editorconfig NODE_JS_VERSION=6 27 | 28 | cache: 29 | directories: 30 | - $HOME/.composer/cache 31 | 32 | before_install: 33 | - test -n "$GITHUB_TOKEN" && echo "Found GitHub token" && composer config github-oauth.github.com "$GITHUB_TOKEN" || echo "No GitHub token found" 34 | - test -n "$NODE_JS_VERSION" && . $HOME/.nvm/nvm.sh && nvm install "$NODE_JS_VERSION" && nvm use "$NODE_JS_VERSION" || true 35 | install: 36 | - composer install --no-interaction --prefer-dist 37 | - test -n "$NODE_JS_VERSION" && npm install || true 38 | - | 39 | if [ "$TEST_SUITE" = "phpunit" ]; then 40 | wget http://ebizmartsbackup.s3.amazonaws.com/$MAGENTO_ARCHIVE && 41 | tar xjf $MAGENTO_ARCHIVE && 42 | cd magento && 43 | modman init && 44 | modman link $TRAVIS_BUILD_DIR && 45 | cd $TRAVIS_BUILD_DIR 46 | fi 47 | 48 | before_script: phpcs --config-set installed_paths vendor/magento-ecg/coding-standard,vendor/magento/marketplace-eqp 49 | script: 50 | - | 51 | if [ "$TEST_SUITE" = "marketplace_review" ]; then 52 | phpcs ./ --ignore=./vendor --extensions="$CODE_EXTENSIONS" --standard="MEQP1" --severity="10" 53 | fi 54 | - | 55 | if [ "$TEST_SUITE" = "ecg_coding_standards" ]; then 56 | phpcs ./ --ignore=./vendor --extensions="$CODE_EXTENSIONS" --standard="Ecg" 57 | fi 58 | - | 59 | if [ "$TEST_SUITE" = "meqp1_coding_standards" ]; then 60 | phpcs ./ --ignore=./vendor --extensions="$CODE_EXTENSIONS" --standard="MEQP1" 61 | fi 62 | - | 63 | if [ "$TEST_SUITE" = "phpunit" ]; then 64 | cd magento/dev/tests/mailchimp && phpunit && cd $TRAVIS_BUILD_DIR 65 | fi 66 | - | 67 | if [ "$TEST_SUITE" = "editorconfig" ]; then 68 | git grep --cached -Il '' | xargs `npm bin`/editorconfig-tools check 69 | fi 70 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contribution requirements 2 | 3 | 1. Contributions must adhere to Magento coding standards. 4 | 2. Pull requests (PRs) must be accompanied by a meaningful description of their purpose. Comprehensive descriptions increase the chances of a pull request to be merged quickly and without additional clarification requests. 5 | 3. Commits must be accompanied by meaningful commit messages. 6 | 4. PRs which include bug fixing, must be accompanied with step-by-step description of how to reproduce the bug. 7 | 3. PRs which include new logic or new features must be submitted along with Unit test coverage. 8 | 4. For large features or changes, please [open an issue](https://github.com/mailchimp/mc-magento/issues) and discuss first. This may prevent duplicate or unnecessary effort, and it may gain you some additional contributors. 9 | 5. All automated tests are passed successfully (all builds on [Travis CI](https://travis-ci.org/mailchimp/mc-magento) must be green). 10 | -------------------------------------------------------------------------------- /ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ### Preconditions 5 | 6 | 7 | 1. 8 | 2. 9 | 10 | ### Steps to reproduce 11 | 12 | 1. 13 | 2. 14 | 3. 15 | 16 | ### Expected result 17 | 18 | 1. 19 | 20 | ### Actual result 21 | 22 | 1. [Screenshot, logs] 23 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Block/Adminhtml/Ecommerce/Resendecommercedata.php: -------------------------------------------------------------------------------- 1 | _controller = 'adminhtml_ecommerce'; 10 | $this->_blockGroup = 'mailchimp'; 11 | 12 | parent::__construct(); 13 | $this->_removeButton("delete"); 14 | $this->_removeButton("back"); 15 | $this->_removeButton("reset"); 16 | } 17 | 18 | public function getHeaderText() 19 | { 20 | return Mage::helper('mailchimp')->__('Data to send'); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Block/Adminhtml/Mailchimperrors.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright Ebizmarts (http://ebizmarts.com) 10 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 11 | * @date: 6/10/16 1:42 PM 12 | * @file: Mailchimperrors.php 13 | */ 14 | class Ebizmarts_MailChimp_Block_Adminhtml_Mailchimperrors extends Mage_Adminhtml_Block_Widget_Grid_Container 15 | { 16 | public function __construct() 17 | { 18 | // The blockGroup must match the first half of how we call the block, and controller matches the second half 19 | // ie. foo_bar/adminhtml_baz 20 | $this->_blockGroup = 'mailchimp'; 21 | $this->_controller = 'adminhtml_mailchimperrors'; 22 | $this->_headerText = $this->__('Mailchimp errors'); 23 | 24 | parent::__construct(); 25 | $this->removeButton('add'); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Block/Adminhtml/Mailchimpstores.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright Ebizmarts (http://ebizmarts.com) 10 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 11 | * @date: 3/6/18 2:22 PM 12 | * @file: Mailchimpstores.php 13 | */ 14 | class Ebizmarts_MailChimp_Block_Adminhtml_Mailchimpstores extends Mage_Adminhtml_Block_Widget_Grid_Container 15 | { 16 | public function __construct() 17 | { 18 | $this->_blockGroup = 'mailchimp'; 19 | $this->_controller = 'adminhtml_mailchimpstores'; 20 | $this->_headerText = $this->__('Mailchimp stores'); 21 | 22 | parent::__construct(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Block/Adminhtml/Mergevars/Add.php: -------------------------------------------------------------------------------- 1 | 4 | * Date : 4/24/13 5 | * Time : 1:15 PM 6 | * File : Add.php 7 | * Module : Ebizmarts_MailChimp 8 | */ 9 | class Ebizmarts_MailChimp_Block_Adminhtml_Mergevars_Add extends Mage_Adminhtml_Block_Widget_Form_Container 10 | { 11 | protected $_mode = 'add'; 12 | public function __construct() 13 | { 14 | $this->_controller = 'adminhtml_mergevars'; 15 | $this->_blockGroup = 'mailchimp'; 16 | 17 | parent::__construct(); 18 | $this->_removeButton("delete"); 19 | $this->_removeButton("back"); 20 | $this->_removeButton("reset"); 21 | } 22 | 23 | /** 24 | * @return string 25 | */ 26 | public function getHeaderText() 27 | { 28 | return Mage::helper('mailchimp')->__('New Field Type'); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Block/Adminhtml/Newsletter/Subscriber/Renderer/Firstname.php: -------------------------------------------------------------------------------- 1 | getData('subscriber_firstname'); 15 | $customerFirstName = $row->getData('customer_firstname'); 16 | if ($customerFirstName) { 17 | return $this->escapeHtml($customerFirstName); 18 | } elseif ($subscriberFirstName) { 19 | return $this->escapeHtml($subscriberFirstName); 20 | } else { 21 | return '----'; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Block/Adminhtml/Newsletter/Subscriber/Renderer/Lastname.php: -------------------------------------------------------------------------------- 1 | getData('subscriber_lastname'); 15 | $customerLastName = $row->getData('customer_lastname'); 16 | if ($customerLastName) { 17 | return $this->escapeHtml($customerLastName); 18 | } elseif ($subscriberLastName) { 19 | return $this->escapeHtml($subscriberLastName); 20 | } else { 21 | return '----'; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Block/Adminhtml/Notifications.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright Ebizmarts (http://ebizmarts.com) 10 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 11 | * @date: 2/20/19 10:37 AM 12 | * @file: Notifications.php 13 | */ 14 | class Ebizmarts_MailChimp_Block_Adminhtml_Notifications extends Mage_Adminhtml_Block_Template 15 | { 16 | 17 | public function getMessageNotification() 18 | { 19 | $helper = $this->makeHelper(); 20 | if ($helper->isImageCacheFlushed() && $helper->isEcomSyncDataEnabledInAnyScope()) { 21 | $message = 'Important: ' . 22 | 'Image cache has been flushed please ' 23 | . '' 24 | . 'resend the products in order to update image URL'; 25 | return $message; 26 | } 27 | } 28 | 29 | /** 30 | * @return string 31 | */ 32 | public function getMessage() 33 | { 34 | $helper = $this->makeHelper(); 35 | $message = 'Are you sure you want to delete the local data in order to send all items again?\n' 36 | . 'Automations will work normally but the synchronization process for the old data will take ' 37 | . 'longer than resetting the MailChimp store.'; 38 | return $helper->__($message); 39 | } 40 | 41 | public function getAjaxCheckUrl() 42 | { 43 | $helper = $this->makeHelper(); 44 | 45 | return $helper->getUrlForNotification(); 46 | } 47 | 48 | public function getUrlForResendEcommerce() 49 | { 50 | $helper = $this->makeHelper(); 51 | $scopeArray = $helper->getCurrentScope(); 52 | $url = Mage::helper('adminhtml') 53 | ->getUrl( 54 | 'adminhtml/ecommerce/renderresendecom', 55 | array('scope' => $scopeArray['scope'], 'scope_id' => $scopeArray['scope_id'] 56 | ) 57 | ); 58 | 59 | return $url; 60 | } 61 | 62 | 63 | /** 64 | * @return Ebizmarts_MailChimp_Helper_Data 65 | */ 66 | protected function makeHelper() 67 | { 68 | return Mage::helper('mailchimp'); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Block/Adminhtml/Sales/Order/Creditmemo/Unsubscribe.php: -------------------------------------------------------------------------------- 1 | 8 | * @copyright Ebizmarts (http://ebizmarts.com) 9 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 10 | * @date: 7/7/16 1:31 PM 11 | * @file: Abandoned.php 12 | */ 13 | class Ebizmarts_MailChimp_Block_Adminhtml_Sales_Order_Grid_Renderer_Mailchimp 14 | extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract 15 | { 16 | /** 17 | * @param Varien_Object $row 18 | * @return string 19 | */ 20 | public function render(Varien_Object $row) 21 | { 22 | $result = ''; 23 | 24 | try { 25 | $order = Mage::getModel('sales/order') 26 | ->load($row->getData('entity_id')); 27 | 28 | if ($order->getMailchimpAbandonedcartFlag() || $order->getMailchimpCampaignId()) { 29 | $result = ''; 32 | } 33 | } catch (Exception $e) { 34 | Mage::throwException($e->getMessage()); 35 | } 36 | 37 | return $result; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Block/Adminhtml/Sales/Order/Grid/Renderer/MailchimpOrder.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright Ebizmarts (http://ebizmarts.com) 10 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 11 | * @date: 12/12/17 3:28 PM 12 | * @file: Abandoned.php 13 | */ 14 | class Ebizmarts_MailChimp_Block_Adminhtml_Sales_Order_Grid_Renderer_MailchimpOrder 15 | extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract 16 | { 17 | const SYNCED = 1; 18 | 19 | public function render(Varien_Object $row) 20 | { 21 | $storeId = $row->getStoreId(); 22 | $orderId = $row->getEntityId(); 23 | $orderDate = $row->getCreatedAt(); 24 | $helper = $this->makeHelper(); 25 | if ($helper->isEcomSyncDataEnabled($storeId)) { 26 | $mailchimpStoreId = $helper->getMCStoreId($storeId); 27 | $resultArray = $this->makeApiOrders()->getSyncedOrder($orderId, $mailchimpStoreId); 28 | $id = $resultArray['order_id']; 29 | $status = $resultArray['synced_status']; 30 | 31 | if ($status == self::SYNCED) { 32 | $result = '
' . $helper->__("Yes") . '
'; 33 | } elseif ($status === null && $id !== null) { 34 | $result = '
' . $helper->__("Processing") . '
'; 35 | } elseif ($status === null && $orderDate > $helper->getEcommerceFirstDate($storeId)) { 36 | $result = '
' . $helper->__("In queue") . '
'; 37 | } else { 38 | $result = '
' . $helper->__("No") . '
'; 39 | } 40 | } else { 41 | $result = '
' . $helper->__("No") . '
'; 42 | } 43 | 44 | return $result; 45 | } 46 | 47 | /** 48 | * @return Ebizmarts_MailChimp_Helper_Data 49 | */ 50 | protected function makeHelper() 51 | { 52 | return Mage::helper('mailchimp'); 53 | } 54 | 55 | /** 56 | * @return Ebizmarts_MailChimp_Model_Api_Orders 57 | */ 58 | protected function makeApiOrders() 59 | { 60 | return Mage::getModel('mailchimp/api_orders'); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Block/Adminhtml/System/Config/Account.php: -------------------------------------------------------------------------------- 1 | 7 | * @copyright Ebizmarts (http://ebizmarts.com) 8 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 9 | * @date: 4/29/16 3:55 PM 10 | * @file: Account.php 11 | */ 12 | class Ebizmarts_MailChimp_Block_Adminhtml_System_Config_Account extends Mage_Adminhtml_Block_System_Config_Form_Field 13 | { 14 | protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) 15 | { 16 | $firstErrorKey = Ebizmarts_MailChimp_Model_System_Config_Source_Account::NO_STORE_TEXT_KEY; 17 | $firstMigrationKey = Ebizmarts_MailChimp_Model_System_Config_Source_Account::STORE_MIGRATION_TEXT_KEY; 18 | $syncLabelKey = Ebizmarts_MailChimp_Model_System_Config_Source_Account::SYNC_LABEL_KEY; 19 | $values = $element->getValues(); 20 | $html = ''; 35 | 36 | return $html; 37 | } 38 | 39 | /** 40 | * @param $dat 41 | * @param $html 42 | * @return string 43 | */ 44 | protected function getSyncFlagDataHtml($dat, $html) 45 | { 46 | $helper = $this->makeHelper(); 47 | $html = $helper->getSyncFlagDataHtml($dat, $html); 48 | return $html; 49 | } 50 | 51 | /** 52 | * @return Ebizmarts_MailChimp_Helper_Data 53 | */ 54 | protected function makeHelper() 55 | { 56 | return Mage::helper('mailchimp'); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Block/Adminhtml/System/Config/CreateWebhook.php: -------------------------------------------------------------------------------- 1 | setTemplate('ebizmarts/mailchimp/system/config/createwebhook.phtml'); 16 | } 17 | 18 | protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) 19 | { 20 | return $this->_toHtml(); 21 | } 22 | 23 | public function getButtonHtml() 24 | { 25 | $helper = $this->makeHelper(); 26 | $button = $this->getLayout()->createBlock('adminhtml/widget_button') 27 | ->setData( 28 | array( 29 | 'id' => 'createwebhook_button', 30 | 'label' => $helper->__('Create Webhook'), 31 | 'onclick' => 'javascript:createwebhook(); return false;', 32 | 'title' => $helper->__('Create the webhook for the audience in current scope') 33 | ) 34 | ); 35 | 36 | return $button->toHtml(); 37 | } 38 | 39 | /** 40 | * @return string 41 | */ 42 | public function getSuccessMessage() 43 | { 44 | $helper = $this->makeHelper(); 45 | $message = 'The webhook was created successfully.'; 46 | return $helper->__($message); 47 | } 48 | 49 | /** 50 | * @return string 51 | */ 52 | public function getFailureMessage() 53 | { 54 | $helper = $this->makeHelper(); 55 | $message = 'Something went wrong.'; 56 | return $helper->__($message); 57 | } 58 | 59 | public function getAjaxCheckUrl() 60 | { 61 | $helper = $this->makeHelper(); 62 | $scopeArray = $helper->getCurrentScope(); 63 | return Mage::helper('adminhtml')->getUrl('adminhtml/mailchimp/createWebhook', $scopeArray); 64 | } 65 | 66 | /** 67 | * @return Ebizmarts_MailChimp_Helper_Data 68 | */ 69 | protected function makeHelper() 70 | { 71 | return $this->helper('mailchimp'); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Block/Adminhtml/System/Config/Date.php: -------------------------------------------------------------------------------- 1 | 8 | * @copyright Ebizmarts (http://ebizmarts.com) 9 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 10 | * @date: 7/5/16 2:19 PM 11 | * @file: Date.php 12 | */ 13 | class Ebizmarts_MailChimp_Block_Adminhtml_System_Config_Date extends Mage_Adminhtml_Block_System_Config_Form_Field 14 | { 15 | public function render(Varien_Data_Form_Element_Abstract $element) 16 | { 17 | $element->setFormat(Varien_Date::DATE_INTERNAL_FORMAT); 18 | $element->setImage($this->getSkinUrl('images/grid-cal.gif')); 19 | return parent::render($element); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Block/Adminhtml/System/Config/Fieldset/Mandrill/Hint.php: -------------------------------------------------------------------------------- 1 | 7 | * @copyright Ebizmarts (http://ebizmarts.com) 8 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 9 | * @date: 4/29/16 3:55 PM 10 | * @file: Hint.php 11 | */ 12 | class Ebizmarts_MailChimp_Block_Adminhtml_System_Config_Fieldset_Mandrill_Hint 13 | extends Mage_Adminhtml_Block_Abstract implements Varien_Data_Form_Element_Renderer_Interface 14 | { 15 | protected $_template = 'ebizmarts/mandrill/system/config/fieldset/hint.phtml'; 16 | 17 | /** 18 | * Render fieldset html 19 | * 20 | * @param Varien_Data_Form_Element_Abstract $element 21 | * @return string 22 | */ 23 | public function render(Varien_Data_Form_Element_Abstract $element) 24 | { 25 | return $this->toHtml(); 26 | } 27 | 28 | public function getMandrillVersion() 29 | { 30 | return (string)Mage::getConfig()->getNode('modules/Ebizmarts_Mandrill/version'); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Block/Adminhtml/System/Config/OauthWizard.php: -------------------------------------------------------------------------------- 1 | 7 | * @copyright Ebizmarts (http://ebizmarts.com) 8 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 9 | * @date: 4/29/16 3:55 PM 10 | * @file: OauthWizard.php 11 | */ 12 | class Ebizmarts_MailChimp_Block_Adminhtml_System_Config_OauthWizard 13 | extends Mage_Adminhtml_Block_System_Config_Form_Field 14 | { 15 | 16 | /** 17 | * Set template to itself 18 | */ 19 | protected function _prepareLayout() 20 | { 21 | parent::_prepareLayout(); 22 | if (!$this->getTemplate()) { 23 | $this->setTemplate('ebizmarts/mailchimp/system/config/oauth_wizard.phtml'); 24 | } 25 | 26 | return $this; 27 | } 28 | 29 | /** 30 | * Unset some non-related element parameters 31 | * 32 | * @param Varien_Data_Form_Element_Abstract $element 33 | * @return string 34 | */ 35 | public function render(Varien_Data_Form_Element_Abstract $element) 36 | { 37 | $element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue(); 38 | return parent::render($element); 39 | } 40 | 41 | /** 42 | * Get the button and scripts contents 43 | * 44 | * @param Varien_Data_Form_Element_Abstract $element 45 | * @return string 46 | */ 47 | protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) 48 | { 49 | $originalData = $element->getOriginalData(); 50 | 51 | $label = $originalData['button_label']; 52 | 53 | $this->addData( 54 | array( 55 | 'button_label' => $this->helper('mailchimp')->__($label), 56 | 'button_url' => $this->helper('mailchimp/oauth2')->authorizeRequestUrl(), 57 | 'html_id' => $element->getHtmlId(), 58 | ) 59 | ); 60 | return $this->_toHtml(); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Block/Adminhtml/System/Config/ResendEcommerceData.php: -------------------------------------------------------------------------------- 1 | 8 | * @copyright Ebizmarts (http://ebizmarts.com) 9 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 10 | * @date: 5/27/16 1:16 PM 11 | * @file: ResendEcommerceData.php 12 | */ 13 | class Ebizmarts_MailChimp_Block_Adminhtml_System_Config_ResendEcommerceData 14 | extends Mage_Adminhtml_Block_System_Config_Form_Field 15 | { 16 | protected function _construct() 17 | { 18 | parent::_construct(); 19 | $this->setTemplate('ebizmarts/mailchimp/system/config/resendecommercedata.phtml'); 20 | } 21 | 22 | protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) 23 | { 24 | return $this->_toHtml(); 25 | } 26 | 27 | public function getButtonHtml() 28 | { 29 | $helper = $this->makeHelper(); 30 | $scopeArray = $helper->getCurrentScope(); 31 | if ($helper->getIfConfigExistsForScope( 32 | Ebizmarts_MailChimp_Model_Config::GENERAL_MCSTOREID, 33 | $scopeArray['scope_id'], 34 | $scopeArray['scope'] 35 | ) 36 | ) { 37 | $label = $helper->__('Resend Ecommerce Data'); 38 | $button = $this->getLayout()->createBlock('adminhtml/widget_button') 39 | ->setData( 40 | array( 41 | 'id' => 'resendecommercedata_button', 42 | 'label' => $label, 43 | 'onclick' => 'javascript:openResendEcommerceDialog(); return false;', 44 | 'title' => $helper->__('Resend Ecommerce Data current scope') 45 | ) 46 | ); 47 | 48 | return $button->toHtml(); 49 | } 50 | } 51 | 52 | /** 53 | * @return Ebizmarts_MailChimp_Helper_Data 54 | */ 55 | protected function makeHelper() 56 | { 57 | return $this->helper('mailchimp'); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Block/Adminhtml/System/Config/ResendSubscribers.php: -------------------------------------------------------------------------------- 1 | 8 | * @copyright Ebizmarts (http://ebizmarts.com) 9 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 10 | * @date: 5/27/16 1:02 PM 11 | * @file: ResendSubscribers.php 12 | */ 13 | class Ebizmarts_MailChimp_Block_Adminhtml_System_Config_ResendSubscribers 14 | extends Mage_Adminhtml_Block_System_Config_Form_Field 15 | { 16 | protected function _construct() 17 | { 18 | parent::_construct(); 19 | $this->setTemplate('ebizmarts/mailchimp/system/config/resendsubscribers.phtml'); 20 | } 21 | 22 | protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) 23 | { 24 | return $this->_toHtml(); 25 | } 26 | 27 | public function getButtonHtml() 28 | { 29 | $helper = $this->makeHelper(); 30 | $scopeArray = $helper->getCurrentScope(); 31 | if ($helper->isSubscriptionEnabled($scopeArray['scope_id'], $scopeArray['scope']) 32 | || $scopeArray['scope_id'] == 0 33 | ) { 34 | $button = $this->getLayout()->createBlock('adminhtml/widget_button') 35 | ->setData( 36 | array( 37 | 'id' => 'resendsubscribers_button', 38 | 'label' => $helper->__('Resend Subscribers'), 39 | 'onclick' => 'javascript:resendsubscribers(); return false;', 40 | 'title' => $helper->__('Send all subscribers again only for current scope') 41 | ) 42 | ); 43 | 44 | return $button->toHtml(); 45 | } 46 | } 47 | public function getAjaxCheckUrl() 48 | { 49 | $helper = $this->makeHelper(); 50 | $scopeArray = $helper->getCurrentScope(); 51 | return Mage::helper('adminhtml')->getUrl('adminhtml/mailchimp/resendSubscribers', $scopeArray); 52 | } 53 | 54 | /** 55 | * @return Ebizmarts_MailChimp_Helper_Data 56 | */ 57 | protected function makeHelper() 58 | { 59 | return $this->helper('mailchimp'); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Block/Adminhtml/System/Config/ResetErrors.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright Ebizmarts (http://ebizmarts.com) 10 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 11 | * @date: 5/27/16 1:02 PM 12 | * @file: ResetErrors.php 13 | */ 14 | class Ebizmarts_MailChimp_Block_Adminhtml_System_Config_ResetErrors 15 | extends Mage_Adminhtml_Block_System_Config_Form_Field 16 | { 17 | protected function _construct() 18 | { 19 | parent::_construct(); 20 | $this->setTemplate('ebizmarts/mailchimp/system/config/reseterrors.phtml'); 21 | } 22 | 23 | protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) 24 | { 25 | return $this->_toHtml(); 26 | } 27 | 28 | public function getButtonHtml() 29 | { 30 | $helper = $this->makeHelper(); 31 | $scopeArray = $helper->getCurrentScope(); 32 | 33 | if ($helper->isSubscriptionEnabled($scopeArray['scope_id'], $scopeArray['scope']) 34 | || $scopeArray['scope_id'] == 0 35 | ) { 36 | $button = $this->getLayout()->createBlock('adminhtml/widget_button') 37 | ->setData( 38 | array( 39 | 'id' => 'reseterrors_button', 40 | 'label' => $helper->__('Reset Local Errors'), 41 | 'onclick' => 'javascript:reseterrors(); return false;', 42 | 'title' => $helper->__('Reset Local Errors only for current scope') 43 | ) 44 | ); 45 | 46 | return $button->toHtml(); 47 | } 48 | } 49 | 50 | public function getAjaxCheckUrl() 51 | { 52 | $helper = $this->makeHelper(); 53 | $scopeArray = $helper->getCurrentScope(); 54 | return Mage::helper('adminhtml')->getUrl('adminhtml/ecommerce/resetLocalErrors', $scopeArray); 55 | } 56 | 57 | /** 58 | * @return Ebizmarts_MailChimp_Helper_Data 59 | */ 60 | protected function makeHelper() 61 | { 62 | return $this->helper('mailchimp'); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Block/Adminhtml/System/Config/Userinfo.php: -------------------------------------------------------------------------------- 1 | 9 | * @license http://opensource.org/licenses/osl-3.0.php 10 | */ 11 | class Ebizmarts_MailChimp_Block_Adminhtml_System_Config_Userinfo extends Mage_Adminhtml_Block_System_Config_Form_Field 12 | { 13 | 14 | protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) 15 | { 16 | $values = $element->getValues(); 17 | 18 | $html = ''; 25 | 26 | return $html; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Block/Group/Type.php: -------------------------------------------------------------------------------- 1 | 9 | * @license http://opensource.org/licenses/osl-3.0.php 10 | */ 11 | class Ebizmarts_MailChimp_Block_Group_Type extends Mage_Core_Block_Template 12 | { 13 | protected $_currentInterest; 14 | protected $_helper; 15 | 16 | public function __construct(array $args = array()) 17 | { 18 | $this->_helper = Mage::helper('mailchimp'); 19 | 20 | if (isset($args['interests'])) { 21 | $this->_currentInterest = $interests = $args['interests']; 22 | $type = $interests['interest']['type']; 23 | $this->setTemplate("ebizmarts/mailchimp/group/type/$type.phtml"); 24 | } 25 | 26 | parent::__construct($args); 27 | } 28 | 29 | /** 30 | * @param $data 31 | * @return string 32 | */ 33 | public function escapeQuote($data) 34 | { 35 | return $this->getHelper()->mcEscapeQuote($data); 36 | } 37 | 38 | /** 39 | * @return Ebizmarts_MailChimp_Helper_Data 40 | */ 41 | public function getHelper($type='') 42 | { 43 | return $this->_helper; 44 | } 45 | 46 | /** 47 | * @return mixed 48 | */ 49 | protected function getCurrentInterest() 50 | { 51 | return $this->_currentInterest; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Helper/Curl.php: -------------------------------------------------------------------------------- 1 | 10 | * @copyright Ebizmarts (http://ebizmarts.com) 11 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 12 | * @date: 9/5/19 3:55 PM 13 | * @file: Curl.php 14 | */ 15 | 16 | class Ebizmarts_MailChimp_Helper_Curl extends Mage_Core_Helper_Abstract 17 | { 18 | /** 19 | * @var Mage_HTTP_Client_Curl 20 | */ 21 | protected $_curl; 22 | /** 23 | * @param $url 24 | * @param $httpMethod 25 | * @param array $curlOptions 26 | * @param array $params 27 | * @return array 28 | */ 29 | public function curlExec($url, $httpMethod, $curlOptions = array(), $params = array()) 30 | { 31 | if ($url === false) { 32 | return array('error' => "It's required an URL to be requested with any http method."); 33 | } 34 | 35 | if ($httpMethod === false) { 36 | return array('error' => "It's required to specify the HTTP method."); 37 | } 38 | 39 | $curlError = null; 40 | $this->_curl = new Mage_HTTP_Client_Curl(); 41 | 42 | foreach ($curlOptions as $key => $value) { 43 | if (isset($value)) { 44 | $this->_curl->setOption($key, $value); 45 | } 46 | } 47 | 48 | $curlResult = null; 49 | 50 | try { 51 | if ($httpMethod == Zend_Http_Client::GET) { 52 | $this->_curl->get($url); 53 | } elseif ($httpMethod == Zend_Http_Client::POST) { 54 | $this->_curl->post($url, $params); 55 | } 56 | 57 | $curlResult = $this->_curl->getBody(); 58 | } catch (Exception $e) { 59 | $curlError = $e->getMessage(); 60 | } 61 | 62 | return array('response' => $curlResult, 'error' => $curlError); 63 | } 64 | 65 | /**+ 66 | * @return int 67 | */ 68 | public function getStatus() 69 | { 70 | return $this->_curl->getStatus(); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Helper/Data/ApiKeyException.php: -------------------------------------------------------------------------------- 1 | 7 | * @copyright Ebizmarts (http://ebizmarts.com) 8 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 9 | * @date: 4/29/16 3:55 PM 10 | * @file: ApiKeyException.php 11 | */ 12 | class Ebizmarts_MailChimp_Helper_Data_ApiKeyException extends Mage_Core_Exception 13 | { 14 | 15 | } 16 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Helper/Oauth2.php: -------------------------------------------------------------------------------- 1 | 8 | * @copyright Ebizmarts (http://ebizmarts.com) 9 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 10 | * @date: 4/29/16 3:55 PM 11 | * @file: Oauth2.php 12 | */ 13 | class Ebizmarts_MailChimp_Helper_Oauth2 extends Mage_Core_Helper_Abstract 14 | { 15 | 16 | protected $_authorizeUri = "https://login.mailchimp.com/oauth2/authorize"; 17 | protected $_accessTokenUri = "https://login.mailchimp.com/oauth2/token"; 18 | protected $_redirectUri = "https://ebizmarts.com/magento/mc-magento/oauth2/complete.php"; 19 | protected $_clientId = 200573319150; 20 | 21 | public function authorizeRequestUrl() 22 | { 23 | 24 | $url = $this->_authorizeUri; 25 | $redirectUri = urlencode($this->_redirectUri); 26 | 27 | return "{$url}?redirect_uri={$redirectUri}&response_type=code&client_id={$this->_clientId}"; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Model/Adminhtml/Includetaxes/Comment.php: -------------------------------------------------------------------------------- 1 | 8 | * @copyright Ebizmarts (http://ebizmarts.com) 9 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 10 | * @date: 3/1/19 11:45 AM 11 | * @file Comment.php 12 | */ 13 | class Ebizmarts_MailChimp_Model_Adminhtml_Includetaxes_Comment 14 | { 15 | public function getCommentText() 16 | { 17 | $helper = Mage::helper('mailchimp'); 18 | return $helper->__( 19 | 'Send product price including tax if ' 20 | ) 21 | . ''. $helper->__("display prices") .'' 24 | . $helper->__(' are configured in the same way.'); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Model/Adminhtml/Resendecommercedata/Comment.php: -------------------------------------------------------------------------------- 1 | setMcHelper(); 13 | } 14 | 15 | /** 16 | * @return Ebizmarts_MailChimp_Helper_Data 17 | */ 18 | public function getMcHelper() 19 | { 20 | return $this->_mcHelper; 21 | } 22 | 23 | /** 24 | * @param Ebizmarts_MailChimp_Helper_Data $mcHelper 25 | */ 26 | public function setMcHelper() 27 | { 28 | $this->_mcHelper = Mage::helper('mailchimp'); 29 | } 30 | 31 | /** 32 | * @return string 33 | */ 34 | public function getCommentText() 35 | { 36 | $helper = $this->getMcHelper(); 37 | $scopeArray = $helper->getCurrentScope(); 38 | $scope = $scopeArray['scope']; 39 | 40 | if ($scope === "default"){ 41 | $comment = $helper->__("This will resend the ecommerce data " 42 | ."for all Websites and Store Views."); 43 | } else { 44 | $websiteOrStoreViewScope = $this->_getScope($scopeArray); 45 | $comment = $helper->__("This will resend the ecommerce data " 46 | ."for %s only.", $websiteOrStoreViewScope); 47 | } 48 | 49 | return $comment; 50 | } 51 | 52 | /** 53 | * @param $scopeArray 54 | * @return string 55 | */ 56 | protected function _getScope($scopeArray) 57 | { 58 | $scope = $scopeArray['scope']; 59 | if ($scope == "websites"){ 60 | $result = "this Website"; 61 | } else { 62 | $result = "this Store View"; 63 | } 64 | 65 | return $result; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Model/Adminhtml/Resendsubscribers/Comment.php: -------------------------------------------------------------------------------- 1 | setMcHelper(); 13 | } 14 | 15 | /** 16 | * @return Ebizmarts_MailChimp_Helper_Data 17 | */ 18 | public function getMcHelper() 19 | { 20 | return $this->_mcHelper; 21 | } 22 | 23 | /** 24 | * @param Ebizmarts_MailChimp_Helper_Data $mcHelper 25 | */ 26 | public function setMcHelper() 27 | { 28 | $this->_mcHelper = Mage::helper('mailchimp'); 29 | } 30 | 31 | /** 32 | * @return string 33 | */ 34 | public function getCommentText() 35 | { 36 | $helper = $this->getMcHelper(); 37 | $scopeArray = $helper->getCurrentScope(); 38 | $scope = $scopeArray['scope']; 39 | 40 | if ($scope === "default"){ 41 | $comment = $helper->__("This will resend the subscribers " 42 | ."for all Websites and Store Views."); 43 | } else { 44 | $websiteOrStoreViewScope = $this->_getScope($scopeArray); 45 | $comment = $helper->__("This will resend the subscribers " 46 | ."for %s only.", $websiteOrStoreViewScope); 47 | } 48 | 49 | return $comment; 50 | } 51 | 52 | /** 53 | * @param $scopeArray 54 | * @return string 55 | */ 56 | protected function _getScope($scopeArray) 57 | { 58 | $scope = $scopeArray['scope']; 59 | if ($scope == "websites"){ 60 | $result = "this Website"; 61 | } else { 62 | $result = "this Store View"; 63 | } 64 | 65 | return $result; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Model/Adminhtml/Reseterrors/Comment.php: -------------------------------------------------------------------------------- 1 | setMcHelper(); 13 | } 14 | 15 | /** 16 | * @return Ebizmarts_MailChimp_Helper_Data 17 | */ 18 | public function getMcHelper() 19 | { 20 | return $this->_mcHelper; 21 | } 22 | 23 | /** 24 | * @param Ebizmarts_MailChimp_Helper_Data $mcHelper 25 | */ 26 | public function setMcHelper() 27 | { 28 | $this->_mcHelper = Mage::helper('mailchimp'); 29 | } 30 | 31 | /** 32 | * @return string 33 | */ 34 | public function getCommentText() 35 | { 36 | $helper = $this->getMcHelper(); 37 | $scopeArray = $helper->getCurrentScope(); 38 | $scope = $scopeArray['scope']; 39 | 40 | if ($scope == "default"){ 41 | $comment = $helper->__("This will reset the errors " 42 | ."for all Websites and Store Views."); 43 | } else { 44 | $websiteOrStoreViewScope = $this->_getScope($scopeArray); 45 | $comment = $helper->__("This will reset the errors " 46 | ."for %s only.", $websiteOrStoreViewScope); 47 | } 48 | 49 | return $comment; 50 | } 51 | 52 | /** 53 | * @param $scopeArray 54 | * @return string 55 | */ 56 | protected function _getScope($scopeArray) 57 | { 58 | $scope = $scopeArray['scope']; 59 | if ($scope == "websites"){ 60 | $result = "this Website"; 61 | } else { 62 | $result = "this Store View"; 63 | } 64 | 65 | return $result; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Model/Adminhtml/Storeid/Comment.php: -------------------------------------------------------------------------------- 1 | __( 9 | 'Select the Mailchimp store you want to associate with this scope. ' 10 | . 'You can create a new store at ' 11 | ) 12 | . ''.$helper->__('Newsletter -> Mailchimp -> Mailchimp Stores').''; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Model/ClearBatches.php: -------------------------------------------------------------------------------- 1 | _helper = Mage::helper('mailchimp'); 12 | 13 | } 14 | public function clearBatches() 15 | { 16 | // Clean batches table, remove all the canceled or completed batch jobs 17 | try { 18 | $resource = $this->_helper->getCoreResource(); 19 | $connection = $resource->getConnection('core_write'); 20 | $tableNameBatches = $resource->getTableName('mailchimp/synchbatches'); 21 | $where = 'status IN("completed","canceled") and ( date_add(modified_date, interval 1 month) < now() OR modified_date IS NULL)'; 22 | $connection->delete($tableNameBatches, $where); 23 | } catch (\Exception $e) { 24 | $this->_helper->logBatchStatus($e->getMessage()); 25 | } 26 | // Clean errors table, remove all the errors that belongs to a non existing batch 27 | try { 28 | $resource = $this->_helper->getCoreResource(); 29 | $connection = $resource->getConnection('core_write'); 30 | $tableNameBatches = $resource->getTableName('mailchimp/synchbatches'); 31 | $select = $connection->select(); 32 | $select->from($tableNameBatches, ['batch_id']); 33 | $select->where('status IN("completed","canceled") and ( date_add(modified_date, interval 1 month) < now() OR modified_date IS NULL)'); 34 | $existingBatchIds = $connection->fetchCol($select); 35 | $tableNameErrors = $resource->getTableName('mailchimp/mailchimperrors'); 36 | if ($existingBatchIds) { 37 | $connection->delete($tableNameErrors, ['batch_id NOT IN ?' => $existingBatchIds]); 38 | } else { 39 | $connection->delete($tableNameErrors); 40 | } 41 | } catch (\Exception $e) { 42 | $this->_helper->logBatchStatus($e->getMessage()); 43 | } 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Model/Cron.php: -------------------------------------------------------------------------------- 1 | 6 | * @copyright Ebizmarts (http://ebizmarts.com) 7 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 8 | */ 9 | 10 | /** 11 | * Cron processor class 12 | */ 13 | class Ebizmarts_MailChimp_Model_Cron 14 | { 15 | /** 16 | * @var Ebizmarts_MailChimp_Helper_Data 17 | */ 18 | protected $_mailChimpHelper; 19 | /** 20 | * @var Ebizmarts_MailChimp_Helper_Migration 21 | */ 22 | protected $_mailChimpMigrationHelper; 23 | 24 | public function __construct() 25 | { 26 | $this->_mailChimpHelper = Mage::helper('mailchimp'); 27 | $this->_mailChimpMigrationHelper = Mage::helper('mailchimp/migration'); 28 | } 29 | 30 | public function syncEcommerceBatchData() 31 | { 32 | if ($this->getMigrationHelper()->migrationFinished()) { 33 | Mage::getModel('mailchimp/api_batches')->handleEcommerceBatches(); 34 | } else { 35 | $this->getMigrationHelper()->handleMigrationUpdates(); 36 | } 37 | } 38 | 39 | public function syncSubscriberBatchData() 40 | { 41 | Mage::getModel('mailchimp/api_batches')->handleSubscriberBatches(); 42 | } 43 | 44 | public function processWebhookData() 45 | { 46 | Mage::getModel('mailchimp/processWebhook')->processWebhookData(); 47 | } 48 | 49 | public function deleteWebhookRequests() 50 | { 51 | Mage::getModel('mailchimp/processWebhook')->deleteProcessed(); 52 | } 53 | 54 | public function clearEcommerceData() 55 | { 56 | Mage::getModel('mailchimp/clearEcommerce')->clearEcommerceData(); 57 | } 58 | public function clearBatches() 59 | { 60 | Mage::getModel('mailchimp/clearBatches')->clearBatches(); 61 | } 62 | 63 | protected function getHelper($type='') 64 | { 65 | return $this->_mailChimpHelper; 66 | } 67 | 68 | protected function getMigrationHelper() 69 | { 70 | return $this->_mailChimpMigrationHelper; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Model/Ecommercesyncdata/Quote.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright Ebizmarts (http://ebizmarts.com) 10 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 11 | * @date: 2019-10-02 15:53 12 | * @file: Ecommercesyncdata.php 13 | */ 14 | class Ebizmarts_MailChimp_Model_Ecommercesyncdata_Quote extends Ebizmarts_MailChimp_Model_Ecommercesyncdata 15 | { 16 | 17 | /** 18 | * Initialize 19 | * 20 | * @return void 21 | */ 22 | public function _construct() 23 | { 24 | 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Model/Email/TemplateBase.php: -------------------------------------------------------------------------------- 1 | isModuleEnabled('Aschroder_SMTPPro') 3 | && class_exists('Aschroder_SMTPPro_Model_Email_Template') 4 | ) { 5 | class_alias('Aschroder_SMTPPro_Model_Email_Template', 'Ebizmarts_MailChimp_Model_Email_TemplateBase'); 6 | } elseif (Mage::helper('core')->isModuleEnabled('Aschroder_Email') 7 | && class_exists('Aschroder_Email_Model_Email_Template') 8 | ) { 9 | class_alias('Aschroder_Email_Model_Email_Template', 'Ebizmarts_MailChimp_Model_Email_TemplateBase'); 10 | } else { 11 | class Ebizmarts_MailChimp_Model_Email_TemplateBase extends Mage_Core_Model_Email_Template 12 | { 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Model/Interestgroup.php: -------------------------------------------------------------------------------- 1 | 8 | * @copyright Ebizmarts (http://ebizmarts.com) 9 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 10 | * @date: 5/16/16 6:23 PM 11 | * @file: Interestgroup.php 12 | */ 13 | 14 | class Ebizmarts_MailChimp_Model_Interestgroup extends Mage_Core_Model_Abstract 15 | { 16 | /** 17 | * Initialize model 18 | * 19 | * @return void 20 | */ 21 | public function _construct() 22 | { 23 | parent::_construct(); 24 | $this->_init('mailchimp/interestgroup'); 25 | } 26 | 27 | public function getByRelatedIdStoreId($customerId, $subscriberId, $storeId) 28 | { 29 | $this->addData($this->getResource()->getByRelatedIdStoreId($customerId, $subscriberId, $storeId)); 30 | return $this; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Model/Mailchimperrors.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright Ebizmarts (http://ebizmarts.com) 10 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 11 | * @date: 6/9/16 4:44 PM 12 | * @file: Mailchimperrors.php 13 | */ 14 | class Ebizmarts_MailChimp_Model_Mailchimperrors extends Mage_Core_Model_Abstract 15 | { 16 | /** 17 | * Initialize model 18 | * 19 | * @return void 20 | */ 21 | public function _construct() 22 | { 23 | parent::_construct(); 24 | $this->_init('mailchimp/mailchimperrors'); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Model/Resource/Ecommercesyncdata.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright Ebizmarts (http://ebizmarts.com) 10 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 11 | * @date: 2019-10-02 15:53 12 | * @file: Ecommercesyncdata.php 13 | */ 14 | class Ebizmarts_MailChimp_Model_Resource_Ecommercesyncdata extends Mage_Core_Model_Resource_Db_Abstract 15 | { 16 | 17 | /** 18 | * Initialize 19 | * 20 | * @return void 21 | */ 22 | public function _construct() 23 | { 24 | $this->_init('mailchimp/ecommercesyncdata', 'id'); 25 | } 26 | public function markAllAsModified($id,$type) 27 | { 28 | $connection = $this->_getWriteAdapter(); 29 | $connection->update( 30 | $this->getMainTable(), 31 | array('mailchimp_sync_modified'=>1), 32 | array('related_id = ?'=> $id, 'type = ?'=>$type) 33 | ); 34 | return $this; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Model/Resource/Ecommercesyncdata/Customers/Collection.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright Ebizmarts (http://ebizmarts.com) 10 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 11 | * @date: 2019-11-04 17:32 12 | */ 13 | class Ebizmarts_MailChimp_Model_Resource_Ecommercesyncdata_Customers_Collection extends 14 | Ebizmarts_MailChimp_Model_Resource_Ecommercesyncdata_Collection 15 | { 16 | 17 | /** 18 | * Set resource type 19 | * 20 | * @return void 21 | */ 22 | public function _construct() 23 | { 24 | parent::_construct(); 25 | } 26 | 27 | /** 28 | * @param Mage_Customer_Model_Resource_Customer_Collection $preFilteredCustomersCollection 29 | */ 30 | public function joinLeftEcommerceSyncData($preFilteredCustomersCollection) 31 | { 32 | $mailchimpTableName = $this->getMailchimpEcommerceDataTableName(); 33 | $joinCondition = "m4m.related_id = e.entity_id AND m4m.type = '%s' AND m4m.mailchimp_store_id = '%s'"; 34 | $preFilteredCustomersCollection->getSelect()->joinLeft( 35 | array("m4m" => $mailchimpTableName), 36 | sprintf($joinCondition, Ebizmarts_MailChimp_Model_Config::IS_CUSTOMER, $this->getMailchimpStoreId()) 37 | ); 38 | 39 | $preFilteredCustomersCollection->getSelect()->where("m4m.mailchimp_sync_delta IS null OR m4m.mailchimp_sync_modified = 1"); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Model/Resource/Ecommercesyncdata/Orders.php: -------------------------------------------------------------------------------- 1 | 12 | * @copyright Ebizmarts (http://ebizmarts.com) 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | * @date: 2019-11-04 17:41 15 | */ 16 | class Ebizmarts_MailChimp_Model_Resource_Ecommercesyncdata_Orders extends 17 | Ebizmarts_MailChimp_Model_Resource_Ecommercesyncdata 18 | { 19 | public function _construct() 20 | { 21 | parent::_construct(); 22 | $this->setType(Ebizmarts_MailChimp_Model_Config::IS_ORDER); 23 | } 24 | } 25 | 26 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Model/Resource/Ecommercesyncdata/Orders/Collection.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright Ebizmarts (http://ebizmarts.com) 10 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 11 | * @date: 2019-11-04 17:32 12 | */ 13 | class Ebizmarts_MailChimp_Model_Resource_Ecommercesyncdata_Orders_Collection extends 14 | Ebizmarts_MailChimp_Model_Resource_Ecommercesyncdata_Collection 15 | { 16 | 17 | /** 18 | * Set resource type 19 | * 20 | * @return void 21 | */ 22 | public function _construct() 23 | { 24 | parent::_construct(); 25 | } 26 | 27 | /** 28 | * @param Mage_Sales_Model_Resource_Order_Collection $preFilteredOrdersCollection 29 | */ 30 | public function joinLeftEcommerceSyncData($preFilteredOrdersCollection) 31 | { 32 | $mailchimpTableName = $this->getMailchimpEcommerceDataTableName(); 33 | $preFilteredOrdersCollection->getSelect()->joinLeft( 34 | array('m4m' => $mailchimpTableName), 35 | "m4m.related_id = main_table.entity_id AND m4m.type = '" 36 | . Ebizmarts_MailChimp_Model_Config::IS_ORDER 37 | . "' AND m4m.mailchimp_store_id = '" . $this->getMailchimpStoreId() . "'", 38 | array('m4m.*') 39 | ); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Model/Resource/Ecommercesyncdata/Product.php: -------------------------------------------------------------------------------- 1 | 12 | * @copyright Ebizmarts (http://ebizmarts.com) 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | * @date: 2019-11-04 17:41 15 | */ 16 | class Ebizmarts_MailChimp_Model_Resource_Ecommercesyncdata_Product extends 17 | Ebizmarts_MailChimp_Model_Resource_Ecommercesyncdata 18 | { 19 | public function _construct() 20 | { 21 | parent::_construct(); 22 | $this->setType(Ebizmarts_MailChimp_Model_Config::IS_PRODUCT); 23 | } 24 | } 25 | 26 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Model/Resource/Ecommercesyncdata/PromoCodes.php: -------------------------------------------------------------------------------- 1 | 12 | * @copyright Ebizmarts (http://ebizmarts.com) 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | * @date: 2019-11-04 17:41 15 | */ 16 | class Ebizmarts_MailChimp_Model_Resource_Ecommercesyncdata_Promocodes extends 17 | Ebizmarts_MailChimp_Model_Resource_Ecommercesyncdata 18 | { 19 | public function _construct() 20 | { 21 | parent::_construct(); 22 | $this->setType(Ebizmarts_MailChimp_Model_Config::IS_PROMO_CODE); 23 | } 24 | } 25 | 26 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Model/Resource/Ecommercesyncdata/PromoRules/Collection.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright Ebizmarts (http://ebizmarts.com) 10 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 11 | * @date: 2019-11-04 17:32 12 | */ 13 | class Ebizmarts_MailChimp_Model_Resource_Ecommercesyncdata_PromoRules_Collection extends 14 | Ebizmarts_MailChimp_Model_Resource_Ecommercesyncdata_Collection 15 | { 16 | 17 | /** 18 | * Set resource type 19 | * 20 | * @return void 21 | */ 22 | public function _construct() 23 | { 24 | parent::_construct(); 25 | } 26 | 27 | /** 28 | * @param Mage_SalesRule_Model_Resource_Rule_Collection $preFilteredPromoRulesCollection 29 | */ 30 | public function joinLeftEcommerceSyncData($preFilteredPromoRulesCollection, $columns = array('m4m.*')) 31 | { 32 | $mailchimpTableName = $this->getMailchimpEcommerceDataTableName(); 33 | $preFilteredPromoRulesCollection->getSelect()->joinLeft( 34 | array('m4m' => $mailchimpTableName), 35 | "m4m.related_id = main_table.entity_id AND m4m.type = '" . Ebizmarts_MailChimp_Model_Config::IS_PROMO_RULE 36 | . "' AND m4m.mailchimp_store_id = '" . $this->getMailchimpStoreId() . "'", 37 | $columns 38 | ); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Model/Resource/Ecommercesyncdata/Quote.php: -------------------------------------------------------------------------------- 1 | 12 | * @copyright Ebizmarts (http://ebizmarts.com) 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | * @date: 2019-11-04 17:41 15 | */ 16 | class Ebizmarts_MailChimp_Model_Resource_Ecommercesyncdata_Quote extends 17 | Ebizmarts_MailChimp_Model_Resource_Ecommercesyncdata 18 | { 19 | public function _construct() 20 | { 21 | parent::_construct(); 22 | $this->setType(Ebizmarts_MailChimp_Model_Config::IS_QUOTE); 23 | } 24 | } 25 | 26 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Model/Resource/Ecommercesyncdata/Quote/Collection.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright Ebizmarts (http://ebizmarts.com) 10 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 11 | * @date: 2019-11-04 17:32 12 | */ 13 | class Ebizmarts_MailChimp_Model_Resource_Ecommercesyncdata_Quote_Collection extends 14 | Ebizmarts_MailChimp_Model_Resource_Ecommercesyncdata_Collection 15 | { 16 | 17 | /** 18 | * Set resource type 19 | * 20 | * @return void 21 | */ 22 | public function _construct() 23 | { 24 | parent::_construct(); 25 | } 26 | 27 | /** 28 | * @param Mage_Sales_Model_Resource_Quote_Collection $preFilteredQuotesCollection 29 | */ 30 | public function joinLeftEcommerceSyncData($preFilteredQuotesCollection) 31 | { 32 | $mailchimpTableName = $this->getMailchimpEcommerceDataTableName(); 33 | $preFilteredQuotesCollection->getSelect()->joinLeft( 34 | array('m4m' => $mailchimpTableName), 35 | "m4m.related_id = main_table.entity_id AND m4m.type = '" . Ebizmarts_MailChimp_Model_Config::IS_QUOTE 36 | . "' AND m4m.mailchimp_store_id = '" . $this->getMailchimpStoreId() . "'", 37 | array('m4m.*') 38 | ); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Model/Resource/Ecommercesyncdata/Subscribers/Collection.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright Ebizmarts (http://ebizmarts.com) 10 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 11 | * @date: 2019-11-04 17:32 12 | */ 13 | class Ebizmarts_MailChimp_Model_Resource_Ecommercesyncdata_Subscribers_Collection extends 14 | Ebizmarts_MailChimp_Model_Resource_Ecommercesyncdata_Collection 15 | { 16 | 17 | /** 18 | * Set resource type 19 | * 20 | * @return void 21 | */ 22 | public function _construct() 23 | { 24 | parent::_construct(); 25 | } 26 | 27 | /** 28 | * @param Mage_Newsletter_Model_Resource_Subscriber_Collection $preFilteredOrdersCollection 29 | */ 30 | public function joinLeftEcommerceSyncData($preFilteredOrdersCollection) 31 | { 32 | $mailchimpTableName = $this->getMailchimpEcommerceDataTableName(); 33 | $preFilteredOrdersCollection->getSelect()->joinLeft( 34 | array('m4m' => $mailchimpTableName), 35 | "m4m.related_id = main_table.entity_id AND m4m.type = '" . Ebizmarts_MailChimp_Model_Config::IS_CUSTOMER 36 | . "' AND m4m.mailchimp_store_id = '" . $this->getMailchimpStoreId() . "'", 37 | array('m4m.*') 38 | ); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Model/Resource/Interestgroup.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright Ebizmarts (http://ebizmarts.com) 10 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 11 | * @date: 2019-10-02 15:54 12 | * @file: Interestgroup.php 13 | */ 14 | class Ebizmarts_MailChimp_Model_Resource_Interestgroup extends Mage_Core_Model_Resource_Db_Abstract 15 | { 16 | 17 | /** 18 | * Initialize 19 | * 20 | * @return void 21 | */ 22 | public function _construct() 23 | { 24 | $this->_init('mailchimp/interestgroup', 'id'); 25 | } 26 | 27 | /** 28 | * @param int $customerId 29 | * @param int $subscriberId 30 | * @param int $storeId 31 | * @return array 32 | */ 33 | public function getByRelatedIdStoreId($customerId = 0, $subscriberId = 0, $storeId = 0) 34 | { 35 | $read = $this->_getReadAdapter(); 36 | $select = $read->select() 37 | ->from($this->getMainTable()) 38 | ->where('store_id = ?', $storeId) 39 | ->where( 40 | '(' 41 | . $read->quoteInto('customer_id = ?', $customerId) 42 | . ' OR ' . $read->quoteInto('subscriber_id = ?', $subscriberId) 43 | . ')' 44 | ); 45 | 46 | $result = $read->fetchRow($select); 47 | 48 | if (!$result) { 49 | return array(); 50 | } 51 | 52 | return $result; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Model/Resource/Interestgroup/Collection.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright Ebizmarts (http://ebizmarts.com) 10 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 11 | * @date: 2019-10-02 15:57 12 | */ 13 | class Ebizmarts_MailChimp_Model_Resource_Interestgroup_Collection extends 14 | Mage_Core_Model_Resource_Db_Collection_Abstract 15 | { 16 | 17 | /** 18 | * Set resource type 19 | * 20 | * @return void 21 | */ 22 | public function _construct() 23 | { 24 | parent::_construct(); 25 | $this->_init('mailchimp/interestgroup'); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Model/Resource/Mailchimperrors.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright Ebizmarts (http://ebizmarts.com) 10 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 11 | * @date: 2019-10-02 15:54 12 | * @file: Mailchimperrors.php 13 | */ 14 | class Ebizmarts_MailChimp_Model_Resource_Mailchimperrors extends Mage_Core_Model_Resource_Db_Abstract 15 | { 16 | 17 | /** 18 | * Initialize 19 | * 20 | * @return void 21 | */ 22 | public function _construct() 23 | { 24 | $this->_init('mailchimp/mailchimperrors', 'id'); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Model/Resource/Mailchimperrors/Collection.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright Ebizmarts (http://ebizmarts.com) 10 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 11 | * @date: 2019-10-02 15:57 12 | */ 13 | class Ebizmarts_MailChimp_Model_Resource_Mailchimperrors_Collection extends 14 | Mage_Core_Model_Resource_Db_Collection_Abstract 15 | { 16 | 17 | /** 18 | * Set resource type 19 | * 20 | * @return void 21 | */ 22 | public function _construct() 23 | { 24 | parent::_construct(); 25 | $this->_init('mailchimp/mailchimperrors'); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Model/Resource/Stores.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright Ebizmarts (http://ebizmarts.com) 10 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 11 | * @date: 2019-10-02 15:54 12 | * @file: Stores.php 13 | */ 14 | class Ebizmarts_MailChimp_Model_Resource_Stores extends Mage_Core_Model_Resource_Db_Abstract 15 | { 16 | 17 | /** 18 | * Initialize 19 | * 20 | * @return void 21 | */ 22 | public function _construct() 23 | { 24 | $this->_init('mailchimp/stores', 'id'); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Model/Resource/Stores/Collection.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright Ebizmarts (http://ebizmarts.com) 10 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 11 | * @date: 2019-10-02 15:57 12 | */ 13 | 14 | class Ebizmarts_MailChimp_Model_Resource_Stores_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract 15 | { 16 | 17 | /** 18 | * Set resource type 19 | * 20 | * @return void 21 | */ 22 | public function _construct() 23 | { 24 | parent::_construct(); 25 | $this->_init('mailchimp/stores'); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Model/Resource/Synchbatches.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright Ebizmarts (http://ebizmarts.com) 10 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 11 | * @date: 2019-10-02 15:54 12 | * @file: SychBatches.php 13 | */ 14 | class Ebizmarts_MailChimp_Model_Resource_SynchBatches extends Mage_Core_Model_Resource_Db_Abstract 15 | { 16 | 17 | /** 18 | * Initialize 19 | * 20 | * @return void 21 | */ 22 | public function _construct() 23 | { 24 | $this->_init('mailchimp/synchbatches', 'id'); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Model/Resource/Synchbatches/Collection.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright Ebizmarts (http://ebizmarts.com) 10 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 11 | * @date: 2019-10-02 15:58 12 | */ 13 | class Ebizmarts_MailChimp_Model_Resource_Synchbatches_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract 14 | { 15 | 16 | /** 17 | * Set resource type 18 | * 19 | * @return void 20 | */ 21 | public function _construct() 22 | { 23 | parent::_construct(); 24 | $this->_init('mailchimp/synchbatches'); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Model/Resource/Webhookrequest.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright Ebizmarts (http://ebizmarts.com) 10 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 11 | * @date: 2019-10-02 15:56 12 | * @file: Mailchimperrors.php 13 | */ 14 | class Ebizmarts_MailChimp_Model_Resource_Webhookrequest extends Mage_Core_Model_Resource_Db_Abstract 15 | { 16 | 17 | /** 18 | * Initialize 19 | * 20 | * @return void 21 | */ 22 | public function _construct() 23 | { 24 | $this->_init('mailchimp/webhookrequest', 'id'); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Model/Resource/Webhookrequest/Collection.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright Ebizmarts (http://ebizmarts.com) 10 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 11 | * @date: 2019-10-02 15:58 12 | */ 13 | class Ebizmarts_MailChimp_Model_Resource_Webhookrequest_Collection extends 14 | Mage_Core_Model_Resource_Db_Collection_Abstract 15 | { 16 | 17 | /** 18 | * Set resource type 19 | * 20 | * @return void 21 | */ 22 | public function _construct() 23 | { 24 | parent::_construct(); 25 | $this->_init('mailchimp/webhookrequest'); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Model/Stores.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright Ebizmarts (http://ebizmarts.com) 10 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 11 | * @date: 3/5/18 1:30 PM 12 | * @file: Stores.php 13 | */ 14 | class Ebizmarts_MailChimp_Model_Stores extends Mage_Core_Model_Abstract 15 | { 16 | /** 17 | * Initialize model 18 | * 19 | * @return void 20 | */ 21 | public function _construct() 22 | { 23 | parent::_construct(); 24 | $this->_init('mailchimp/stores'); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Model/Subscriber.php: -------------------------------------------------------------------------------- 1 | getCode() == $code) { 63 | $this->setStatus(self::STATUS_SUBSCRIBED) 64 | ->setIsStatusChanged(true) 65 | ->setSubscriberSource(Ebizmarts_MailChimp_Model_Subscriber::SUBSCRIBE_CONFIRMATION) 66 | ->save(); 67 | return true; 68 | } 69 | 70 | return false; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Model/Synchbatches.php: -------------------------------------------------------------------------------- 1 | 8 | * @copyright Ebizmarts (http://ebizmarts.com) 9 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 10 | * @date: 5/16/16 6:23 PM 11 | * @file: MailchimpSychBatches.php 12 | */ 13 | 14 | class Ebizmarts_MailChimp_Model_Synchbatches extends Mage_Core_Model_Abstract 15 | { 16 | /** 17 | * Initialize model 18 | * 19 | * @return void 20 | */ 21 | public function _construct() 22 | { 23 | parent::_construct(); 24 | $this->_init('mailchimp/synchbatches'); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Model/System/Config/Backend/Apikey.php: -------------------------------------------------------------------------------- 1 | 8 | * @copyright Ebizmarts (http://ebizmarts.com) 9 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 10 | * @date: 8/4/16 5:56 PM 11 | * @file: Apikey.php 12 | */ 13 | class Ebizmarts_MailChimp_Model_System_Config_Backend_Apikey extends Mage_Core_Model_Config_Data 14 | { 15 | protected function _afterSave() 16 | { 17 | $helper = $this->makeHelper(); 18 | $scopeId = $this->getScopeId(); 19 | $scope = $this->getScope(); 20 | $valueChanged = $this->isValueChanged(); 21 | 22 | if ($valueChanged && !$this->getValue()) { 23 | $configValue = array(array(Ebizmarts_MailChimp_Model_Config::GENERAL_ACTIVE, false)); 24 | $helper->saveMailchimpConfig($configValue, $scopeId, $scope); 25 | $message = $helper->__( 26 | 'Please note the extension has been disabled due to the lack of an api key or audience configured.' 27 | ); 28 | $this->getAdminSession()->addWarning($message); 29 | } 30 | } 31 | 32 | /** 33 | * @return Ebizmarts_MailChimp_Helper_Data 34 | */ 35 | protected function makeHelper() 36 | { 37 | return Mage::helper('mailchimp'); 38 | } 39 | 40 | /** 41 | * @return Mage_Adminhtml_Model_Session 42 | */ 43 | protected function getAdminSession() 44 | { 45 | return Mage::getSingleton('adminhtml/session'); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Model/System/Config/Backend/Ecommerce.php: -------------------------------------------------------------------------------- 1 | 8 | * @copyright Ebizmarts (http://ebizmarts.com) 9 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 10 | * @date: 8/4/16 8:28 PM 11 | * @file: List.php 12 | */ 13 | class Ebizmarts_MailChimp_Model_System_Config_Backend_Ecommerce extends Mage_Core_Model_Config_Data 14 | { 15 | protected function _afterSave() 16 | { 17 | $scopeId = $this->getScopeId(); 18 | $scope = $this->getScope(); 19 | $helper = $this->makeHelper(); 20 | $groups = $this->getData('groups'); 21 | //If settings are inherited get from config. 22 | $moduleIsActive = (isset($groups['general']['fields']['active']['value'])) 23 | ? $groups['general']['fields']['active']['value'] 24 | : $helper->isMailChimpEnabled($this->getScopeId(), $this->getScope()); 25 | $apiKey = (isset($groups['general']['fields']['apikey']['value'])) 26 | ? $groups['general']['fields']['apikey']['value'] 27 | : $helper->getApiKey($this->getScopeId(), $this->getScope()); 28 | if (isset($groups['general']['fields']['list']) && isset($groups['general']['fields']['list']['value'])) { 29 | $listId = $groups['general']['fields']['list']['value']; 30 | } else { 31 | $listId = $helper->getGeneralList($this->getScopeId(), $this->getScope()); 32 | } 33 | 34 | if ((!$apiKey || !$moduleIsActive || !$listId) && $this->isValueChanged() && $this->getValue()) { 35 | $configValue = array(array(Ebizmarts_MailChimp_Model_Config::GENERAL_ACTIVE, false)); 36 | $helper->saveMailchimpConfig($configValue, $scopeId, $scope); 37 | $message = $helper->__('Please add an api key and select an audience before enabling the extension.'); 38 | $helper->getAdminSession()->addError($message); 39 | } 40 | } 41 | 42 | /** 43 | * @return Ebizmarts_MailChimp_Helper_Data 44 | */ 45 | protected function makeHelper() 46 | { 47 | return Mage::helper('mailchimp'); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Model/System/Config/Backend/Mapfield.php: -------------------------------------------------------------------------------- 1 | 8 | * @copyright Ebizmarts (http://ebizmarts.com) 9 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 10 | * @date: 8/4/16 5:56 PM 11 | * @file: Apikey.php 12 | */ 13 | class Ebizmarts_MailChimp_Model_System_Config_Backend_Mapfield 14 | extends Mage_Adminhtml_Model_System_Config_Backend_Serialized_Array 15 | { 16 | /** 17 | * @var Ebizmarts_MailChimp_Helper_Data 18 | */ 19 | protected $_helper; 20 | 21 | protected function _afterLoad() 22 | { 23 | $this->_helper = Mage::helper('mailchimp'); 24 | 25 | if (!is_array($this->getValue())) { 26 | if (is_object($this->getValue())) { 27 | $serializedValue = $this->getValue()->asArray(); 28 | } else { 29 | $serializedValue = $this->getValue(); 30 | } 31 | 32 | $unserializedValue = false; 33 | 34 | if (!empty($serializedValue)) { 35 | try { 36 | $unserializedValue = $this->_helper->unserialize($serializedValue); 37 | } catch (Exception $e) { 38 | Mage::logException($e); 39 | } 40 | } 41 | 42 | $this->setValue($unserializedValue); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Model/System/Config/Backend/Twowaysync.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright Ebizmarts (http://ebizmarts.com) 10 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 11 | * @date: 8/4/16 5:56 PM 12 | * @file: Apikey.php 13 | */ 14 | class Ebizmarts_MailChimp_Model_System_Config_Backend_Twowaysync extends Mage_Core_Model_Config_Data 15 | { 16 | protected function _afterSave() 17 | { 18 | $helper = $this->makeHelper(); 19 | $webhookHelper = $this->makeWebhookHelper(); 20 | $groups = $this->getData('groups'); 21 | $moduleIsActive = (isset($groups['general']['fields']['active']['value'])) 22 | ? $groups['general']['fields']['active']['value'] 23 | : $helper->isMailChimpEnabled($this->getScopeId(), $this->getScope()); 24 | $apiKey = (isset($groups['general']['fields']['apikey']['value'])) 25 | ? $groups['general']['fields']['apikey']['value'] 26 | : $helper->getApiKey($this->getScopeId(), $this->getScope()); 27 | $listId = $helper->getGeneralList($this->getScopeId(), $this->getScope()); 28 | if ($apiKey && $moduleIsActive && $listId && $this->isValueChanged()) { 29 | $webhookHelper->handleWebhookChange($this->getScopeId(), $this->getScope()); 30 | } 31 | } 32 | 33 | /** 34 | * @return Ebizmarts_MailChimp_Helper_Data 35 | */ 36 | protected function makeHelper() 37 | { 38 | return Mage::helper('mailchimp'); 39 | } 40 | 41 | /** 42 | * @return Ebizmarts_MailChimp_Helper_Webhook 43 | */ 44 | protected function makeWebhookHelper() 45 | { 46 | return Mage::helper('mailchimp/webhook'); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Model/System/Config/Source/BatchLimit.php: -------------------------------------------------------------------------------- 1 | 8 | * @license http://opensource.org/licenses/osl-3.0.php 9 | */ 10 | class Ebizmarts_MailChimp_Model_System_Config_Source_BatchLimit 11 | { 12 | /** 13 | * Options getter 14 | * 15 | * @return array 16 | */ 17 | public function toOptionArray() 18 | { 19 | return array( 20 | array('value' => 50, 'label' => Mage::helper('mailchimp')->__('50')), 21 | array('value' => 100, 'label' => Mage::helper('mailchimp')->__('100')), 22 | array('value' => 200, 'label' => Mage::helper('mailchimp')->__('200')), 23 | array('value' => 500, 'label' => Mage::helper('mailchimp')->__('500')) 24 | ); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Model/System/Config/Source/Checkoutsubscribe.php: -------------------------------------------------------------------------------- 1 | 9 | * @license http://opensource.org/licenses/osl-3.0.php 10 | */ 11 | class Ebizmarts_MailChimp_Model_System_Config_Source_Checkoutsubscribe 12 | { 13 | const DISABLED = 0; 14 | const CHECKED_BY_DEFAULT = 1; 15 | const NOT_CHECKED_BY_DEFAULT = 2; 16 | const FORCE_HIDDEN = 3; 17 | const FORCE_VISIBLE = 4; 18 | 19 | /** 20 | * Options getter 21 | * 22 | * @return array 23 | */ 24 | public function toOptionArray() 25 | { 26 | $helper = Mage::helper('mailchimp'); 27 | return array( 28 | array('value' => self::CHECKED_BY_DEFAULT, 'label' => $helper->__('Enabled - Checked by default')), 29 | array('value' => self::NOT_CHECKED_BY_DEFAULT, 'label' => $helper->__('Enabled - Not Checked by default')), 30 | array('value' => self::FORCE_HIDDEN, 'label' => $helper->__('Enabled - Force subscription hidden')), 31 | array('value' => self::FORCE_VISIBLE, 'label' => $helper->__('Enabled - Force subscription')), 32 | array('value' => self::DISABLED, 'label' => $helper->__('-- Disabled --')) 33 | ); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Model/System/Config/Source/Cmspage.php: -------------------------------------------------------------------------------- 1 | 8 | * @copyright Ebizmarts (http://ebizmarts.com) 9 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 10 | * @date: 7/6/16 2:56 PM 11 | * @file: Cmspage.php 12 | */ 13 | class Ebizmarts_MailChimp_Model_System_Config_Source_Cmspage 14 | { 15 | 16 | public function toOptionArray() 17 | { 18 | $collection = Mage::getResourceModel('cms/page_collection')->addOrder('title', 'asc'); 19 | return array('checkout/cart' => "Shopping Cart (default page)") + $collection->toOptionIdArray(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Model/System/Config/Source/ConnectionTimeout.php: -------------------------------------------------------------------------------- 1 | 8 | * @license http://opensource.org/licenses/osl-3.0.php 9 | */ 10 | class Ebizmarts_MailChimp_Model_System_Config_Source_ConnectionTimeout 11 | { 12 | /** 13 | * Options getter 14 | * 15 | * @return array 16 | */ 17 | public function toOptionArray() 18 | { 19 | return array( 20 | array('value' => 10, 'label' => Mage::helper('mailchimp')->__('10')), 21 | array('value' => 20, 'label' => Mage::helper('mailchimp')->__('20')), 22 | array('value' => 30, 'label' => Mage::helper('mailchimp')->__('30')), 23 | array('value' => 40, 'label' => Mage::helper('mailchimp')->__('40')), 24 | array('value' => 50, 'label' => Mage::helper('mailchimp')->__('50')), 25 | array('value' => 60, 'label' => Mage::helper('mailchimp')->__('60')) 26 | ); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Model/System/Config/Source/CustomerGroup.php: -------------------------------------------------------------------------------- 1 | 5 | * Date : 8/29/14 6 | * Time : 3:36 PM 7 | * File : CustomerGroup.php 8 | * Module : magemonkey 9 | */ 10 | class Ebizmarts_MailChimp_Model_System_Config_Source_CustomerGroup 11 | { 12 | protected $_categories = null; 13 | 14 | /** 15 | * Ebizmarts_MailChimp_Model_System_Config_Source_CustomerGroup constructor. 16 | * 17 | * @param $params 18 | * @throws Mage_Core_Exception 19 | */ 20 | public function __construct($params) 21 | { 22 | $helper = $this->makeHelper(); 23 | $scopeArray = $helper->getCurrentScope(); 24 | $apiKey = (!empty($params)) 25 | ? $params['api_key'] 26 | : $helper->getApiKey($scopeArray['scope_id'], $scopeArray['scope']); 27 | $listId = (!empty($params)) 28 | ? $params['list_id'] 29 | : $helper->getGeneralList($scopeArray['scope_id'], $scopeArray['scope']); 30 | 31 | if (!empty($apiKey) && !empty($listId)) { 32 | $this->_categories = $helper->getListInterestCategoriesByKeyAndList($apiKey, $listId); 33 | } 34 | } 35 | 36 | /** 37 | * Options getter 38 | * 39 | * @return array 40 | */ 41 | public function toOptionArray() 42 | { 43 | $groups = array(); 44 | $helper = $this->makeHelper(); 45 | if (!empty($this->_categories)) { 46 | foreach ($this->_categories as $category) { 47 | $groups[] = array('value'=> $category['id'], 'label' => $category['title']); 48 | } 49 | } else { 50 | $groups[] = array('value' => '', 'label' => $helper->__('--- No data ---')); 51 | } 52 | 53 | return $groups; 54 | } 55 | 56 | /** 57 | * @return Ebizmarts_MailChimp_Helper_Data 58 | */ 59 | protected function makeHelper() 60 | { 61 | return Mage::helper('mailchimp'); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Model/System/Config/Source/Fieldtype.php: -------------------------------------------------------------------------------- 1 | 5 | * File : Fieldtype.php 6 | * Module : Ebizmarts_MailChimp 7 | */ 8 | class Ebizmarts_MailChimp_Model_System_Config_Source_Fieldtype 9 | { 10 | public function getFieldTypes() 11 | { 12 | $fieldTypes = array( 13 | 'text' => 'Text', 14 | 'number' => 'Number', 15 | 'radio' => 'Radio Buttons', 16 | 'dropdown' => 'Drop Down', 17 | 'date' => 'Date', 18 | 'birthday' => 'Birthday', 19 | 'address' => 'Address', 20 | 'zip' => 'Zip Code (US Only)', 21 | 'phone' => 'Phone', 22 | 'website' => 'Website', 23 | 'image' => 'Image' 24 | ); 25 | return $fieldTypes; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Model/System/Config/Source/ImageSize.php: -------------------------------------------------------------------------------- 1 | 9 | * @license http://opensource.org/licenses/osl-3.0.php 10 | */ 11 | class Ebizmarts_MailChimp_Model_System_Config_Source_ImageSize 12 | { 13 | const BASE = 0; 14 | const SMALL = 1; 15 | const THUMBNAIL = 2; 16 | const ORIGINAL = 3; 17 | 18 | /** 19 | * Options getter 20 | * 21 | * @return array 22 | */ 23 | public function toOptionArray() 24 | { 25 | $helper = Mage::helper('mailchimp'); 26 | return array( 27 | array('value' => self::BASE, 'label' => $helper->__('Base')), 28 | array('value' => self::SMALL, 'label' => $helper->__('Small')), 29 | array('value' => self::THUMBNAIL, 'label' => $helper->__('Thumbnail')), 30 | array('value' => self::ORIGINAL, 'label' => $helper->__('Original')) 31 | ); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Model/System/Config/Source/IncludingTaxes.php: -------------------------------------------------------------------------------- 1 | 6 | * @license http://opensource.org/licenses/osl-3.0.php 7 | */ 8 | 9 | class Ebizmarts_MailChimp_Model_System_Config_Source_IncludingTaxes 10 | { 11 | /** 12 | * Options getter 13 | * 14 | * @return array 15 | */ 16 | public function toOptionArray() 17 | { 18 | $helper = $this->getHelper(); 19 | return array( 20 | array('value' => 0, 'label' => $helper->__('No')), 21 | array('value' => 1, 'label' => $helper->__('Yes')) 22 | ); 23 | } 24 | 25 | /** 26 | * @return Mage_Core_Helper_Abstract 27 | */ 28 | protected function getHelper($type='mailchimp') 29 | { 30 | return Mage::helper($type); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Model/System/Config/Source/Log.php: -------------------------------------------------------------------------------- 1 | 9 | * @license http://opensource.org/licenses/osl-3.0.php 10 | */ 11 | class Ebizmarts_MailChimp_Model_System_Config_Source_Log 12 | { 13 | const NONE = 0; 14 | const ERROR_LOG = 1; 15 | const REQUEST_LOG = 2; 16 | const BOTH = 3; 17 | 18 | 19 | /** 20 | * Options getter 21 | * 22 | * @return array 23 | */ 24 | public function toOptionArray() 25 | { 26 | $helper = Mage::helper('mailchimp'); 27 | return array( 28 | array('value' => self::NONE, 'label' => $helper->__('None')), 29 | array('value' => self::ERROR_LOG, 'label' => $helper->__('Error logs')), 30 | array('value' => self::REQUEST_LOG, 'label' => $helper->__('Request logs')), 31 | array('value' => self::BOTH, 'label' => $helper->__('Both')) 32 | 33 | ); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Model/System/Config/Source/MailchimpStoreView.php: -------------------------------------------------------------------------------- 1 | 9 | * @license http://opensource.org/licenses/osl-3.0.php 10 | */ 11 | class Ebizmarts_MailChimp_Model_System_Config_Source_MailchimpStoreView 12 | extends Mage_Eav_Model_Entity_Attribute_Source_Abstract 13 | { 14 | 15 | public function getAllOptions() 16 | { 17 | return Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Model/System/Config/Source/OrderGrid.php: -------------------------------------------------------------------------------- 1 | 9 | * @license http://opensource.org/licenses/osl-3.0.php 10 | */ 11 | class Ebizmarts_MailChimp_Model_System_Config_Source_OrderGrid 12 | { 13 | const NONE = 0; 14 | const ICON = 1; 15 | const SYNCED = 2; 16 | const BOTH = 3; 17 | 18 | 19 | /** 20 | * Options getter 21 | * 22 | * @return array 23 | */ 24 | public function toOptionArray() 25 | { 26 | $helper = Mage::helper('mailchimp'); 27 | return array( 28 | array('value' => self::NONE, 'label' => $helper->__('None')), 29 | array('value' => self::ICON, 'label' => $helper->__('Icon for Mailchimp orders')), 30 | array('value' => self::SYNCED, 'label' => $helper->__('If orders are synced to Mailchimp')), 31 | array('value' => self::BOTH, 'label' => $helper->__('Both')) 32 | ); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Model/System/Config/Source/WebhookDelete.php: -------------------------------------------------------------------------------- 1 | 8 | * @copyright Ebizmarts (http://ebizmarts.com) 9 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 10 | * @date: 5/19/16 3:55 PM 11 | * @file: WebhookDelete.php 12 | */ 13 | class Ebizmarts_MailChimp_Model_System_Config_Source_WebhookDelete 14 | { 15 | /** 16 | * Options getter 17 | * 18 | * @return array 19 | */ 20 | public function toOptionArray() 21 | { 22 | $mailchimpHelper = Mage::helper('mailchimp'); 23 | 24 | return array( 25 | array('value' => 0, 'label' => $mailchimpHelper->__('Unsubscribe')), 26 | array('value' => 1, 'label' => $mailchimpHelper->__('Delete subscriber')) 27 | ); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/Model/Webhookrequest.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright Ebizmarts (http://ebizmarts.com) 10 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 11 | * @date: 6/9/16 4:44 PM 12 | * @file: ProcessWebhookData.php 13 | */ 14 | class Ebizmarts_MailChimp_Model_Webhookrequest extends Mage_Core_Model_Abstract 15 | { 16 | /** 17 | * Initialize model 18 | * 19 | * @return void 20 | */ 21 | public function _construct() 22 | { 23 | parent::_construct(); 24 | $this->_init('mailchimp/webhookrequest'); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/sql/mailchimp_setup/mysql4-install-0.0.1.php: -------------------------------------------------------------------------------- 1 | startSetup(); 6 | 7 | $installer->getConnection()->addColumn( 8 | $installer->getTable('newsletter_subscriber'), 9 | 'subscriber_firstname', 10 | 'varchar(50)' 11 | ); 12 | 13 | $installer->getConnection()->addColumn( 14 | $installer->getTable('newsletter_subscriber'), 15 | 'subscriber_lastname', 16 | 'varchar(50)' 17 | ); 18 | 19 | $installer->run( 20 | " 21 | CREATE TABLE IF NOT EXISTS `{$this->getTable('mailchimp_sync_batches')}` ( 22 | `id` int(10) unsigned NOT NULL auto_increment, 23 | `store_id` int(11) NOT NULL, 24 | `batch_id` varchar(24) NOT NULL, 25 | `status` varchar(10) NOT NULL, 26 | PRIMARY KEY (`id`) 27 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 28 | " 29 | ); 30 | 31 | $baseDir = Mage::getBaseDir(); 32 | 33 | try { 34 | /** 35 | * @var $fileHelper Ebizmarts_MailChimp_Helper_File 36 | */ 37 | $fileHelper = Mage::helper('mailchimp/file'); 38 | $fileHelper->mkDir($baseDir . DS . 'var' . DS . 'mailchimp'); 39 | } catch (Exception $e) { 40 | Mage::log($e->getMessage(), null, 'MailChimp_Errors.log', true); 41 | } 42 | 43 | $installer->endSetup(); 44 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/sql/mailchimp_setup/mysql4-upgrade-1.0.1-1.0.2.php: -------------------------------------------------------------------------------- 1 | 8 | * @copyright Ebizmarts (http://ebizmarts.com) 9 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 10 | * @date: 6/9/16 4:05 PM 11 | * @file: mysql4-upgrade-1.0.1-1.0.2.php 12 | */ 13 | 14 | $installer = $this; 15 | 16 | $installer->startSetup(); 17 | 18 | $installer->run( 19 | " 20 | CREATE TABLE IF NOT EXISTS `{$this->getTable('mailchimp_errors')}` ( 21 | `id` INT(10) unsigned NOT NULL auto_increment, 22 | `type` VARCHAR(256) DEFAULT '', 23 | `title` VARCHAR(128) DEFAULT '', 24 | `status` INT(5) DEFAULT 0, 25 | `errors` TEXT, 26 | `regtype` CHAR(3) DEFAULT '', 27 | `original_id` INT(10) DEFAULT 0, 28 | `created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, 29 | PRIMARY KEY (`id`) 30 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 31 | " 32 | ); 33 | 34 | try { 35 | $installer->run( 36 | " 37 | ALTER TABLE `{$this->getTable('mailchimp_sync_batches')}` MODIFY `store_id` VARCHAR(50) NOT NULL; 38 | " 39 | ); 40 | } catch (Exception $e) { 41 | Mage::log($e->getMessage(), null, 'MailChimp_Errors.log', true); 42 | } 43 | 44 | $installer->endSetup(); 45 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/sql/mailchimp_setup/mysql4-upgrade-1.0.3-1.0.4.php: -------------------------------------------------------------------------------- 1 | 8 | * @copyright Ebizmarts (http://ebizmarts.com) 9 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 10 | * @date: 6/9/16 4:05 PM 11 | * @file: mysql4-upgrade-1.0.1-1.0.2.php 12 | */ 13 | 14 | $installer = $this; 15 | 16 | $installer->startSetup(); 17 | 18 | try { 19 | $installer->run( 20 | " 21 | ALTER TABLE `{$this->getTable('sales_flat_order')}` ADD COLUMN `mailchimp_campaign_id` VARCHAR(16) DEFAULT NULL; 22 | ALTER TABLE `{$this->getTable('newsletter_subscriber')}` ADD column `mailchimp_sync_delta` datetime NOT NULL; 23 | ALTER TABLE `{$this->getTable('newsletter_subscriber')}` ADD column `mailchimp_sync_error` VARCHAR(255) NOT NULL; 24 | " 25 | ); 26 | } catch (Exception $e) { 27 | Mage::log($e->getMessage(), null, 'MailChimp_Errors.log', true); 28 | } 29 | 30 | $installer->endSetup(); 31 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/sql/mailchimp_setup/mysql4-upgrade-1.0.5-1.0.6.php: -------------------------------------------------------------------------------- 1 | 8 | * @copyright Ebizmarts (http://ebizmarts.com) 9 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 10 | * @date: 6/9/16 4:05 PM 11 | * @file: mysql4-upgrade-1.0.1-1.0.2.php 12 | */ 13 | 14 | $installer = $this; 15 | 16 | $installer->startSetup(); 17 | 18 | 19 | try { 20 | $installer->run( 21 | " 22 | ALTER TABLE `{$this->getTable('sales_flat_quote')}` 23 | ADD column `mailchimp_abandonedcart_flag` INT(1) NOT NULL DEFAULT 0; 24 | ALTER TABLE `{$this->getTable('sales_flat_order')}` 25 | ADD column `mailchimp_abandonedcart_flag` INT(1) NOT NULL DEFAULT 0; 26 | " 27 | ); 28 | } catch (Exception $e) { 29 | Mage::log($e->getMessage(), null, 'MailChimp_Errors.log', true); 30 | } 31 | 32 | $installer->endSetup(); 33 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/sql/mailchimp_setup/mysql4-upgrade-1.1.1-1.1.2.php: -------------------------------------------------------------------------------- 1 | 8 | * @copyright Ebizmarts (http://ebizmarts.com) 9 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 10 | * @date: 6/9/16 4:05 PM 11 | * @file: mysql4-upgrade-1.0.1-1.0.2.php 12 | */ 13 | 14 | $installer = $this; 15 | 16 | $installer->startSetup(); 17 | 18 | 19 | try { 20 | $installer->run( 21 | " 22 | ALTER TABLE `{$this->getTable('mailchimp_errors')}` 23 | ADD column `batch_id` varchar(64) NOT NULL DEFAULT 0; 24 | " 25 | ); 26 | } catch (Exception $e) { 27 | Mage::log($e->getMessage(), null, 'MailChimp_Errors.log', true); 28 | } 29 | 30 | $installer->endSetup(); 31 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/sql/mailchimp_setup/mysql4-upgrade-1.1.10-1.1.11.php: -------------------------------------------------------------------------------- 1 | 8 | * @copyright Ebizmarts (http://ebizmarts.com) 9 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 10 | * @date: 27/12/17 6:23 PM 11 | * @file: mysql4-upgrade-1.0.1-1.0.2.php 12 | */ 13 | 14 | $installer = $this; 15 | 16 | $installer->startSetup(); 17 | 18 | try { 19 | $installer->run( 20 | " 21 | ALTER TABLE `{$this->getTable('mailchimp_ecommerce_sync_data')}` 22 | ADD column `mailchimp_synced_flag` INT(1) DEFAULT NULL; 23 | " 24 | ); 25 | } catch (Exception $e) { 26 | Mage::log($e->getMessage(), null, 'MailChimp_Errors.log', true); 27 | } 28 | 29 | try { 30 | $installer->run( 31 | " 32 | ALTER TABLE `{$this->getTable('mailchimp_ecommerce_sync_data')}` 33 | ADD INDEX `type` (`type`); 34 | " 35 | ); 36 | } catch (Exception $e) { 37 | Mage::log($e->getMessage(), null, 'MailChimp_Errors.log', true); 38 | } 39 | 40 | $installer->endSetup(); 41 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/sql/mailchimp_setup/mysql4-upgrade-1.1.12-1.1.12.2.php: -------------------------------------------------------------------------------- 1 | startSetup(); 9 | 10 | try { 11 | $salesOrderTableName = $installer->getTable('sales/order'); 12 | $indexFields = array('customer_id'); 13 | 14 | $installer->getConnection()->addIndex( 15 | $salesOrderTableName, 16 | $installer->getIdxName($salesOrderTableName, $indexFields), 17 | $indexFields, 18 | Varien_Db_Adapter_Interface::INDEX_TYPE_INDEX 19 | ); 20 | } catch (Exception $e) { 21 | Mage::log($e->getMessage(), null, 'MailChimp_Errors.log', true); 22 | } 23 | 24 | $setup = new Mage_Eav_Model_Entity_Setup('core_setup'); 25 | 26 | $entityTypeId = $setup->getEntityTypeId('customer'); 27 | $attributeSetId = $setup->getDefaultAttributeSetId($entityTypeId); 28 | $attributeGroupId = $setup->getDefaultAttributeGroupId($entityTypeId, $attributeSetId); 29 | 30 | $setup->addAttribute( 31 | "customer", "mailchimp_store_view", array( 32 | "type" => "int", 33 | "label" => "Store View (For MailChimp)", 34 | "input" => "select", 35 | "source" => "mailchimp/system_config_source_mailchimpStoreView", 36 | "visible" => true, 37 | "required" => false, 38 | "unique" => false, 39 | "note" => "A store view must be specified to sync this customer to MailChimp" 40 | 41 | ) 42 | ); 43 | 44 | try { 45 | $attribute = Mage::getSingleton("eav/config")->getAttribute("customer", "mailchimp_store_view"); 46 | 47 | 48 | $setup->addAttributeToGroup( 49 | $entityTypeId, 50 | $attributeSetId, 51 | $attributeGroupId, 52 | 'mailchimp_store_view', 53 | '999' //sort_order 54 | ); 55 | 56 | $usedInForms = array(); 57 | 58 | $usedInForms[] = "adminhtml_customer"; 59 | 60 | $attribute->setData("used_in_forms", $usedInForms) 61 | ->setData("is_used_for_customer_segment", true) 62 | ->setData("is_system", 0) 63 | ->setData("is_user_defined", 1) 64 | ->setData("is_visible", 1) 65 | ->setData("sort_order", 100); 66 | $attribute->save(); 67 | } catch (Exception $e) { 68 | Mage::log($e->getMessage(), null, 'MailChimp_Errors.log', true); 69 | } 70 | 71 | $installer->deleteConfigData(Ebizmarts_MailChimp_Model_Config::ENABLE_POPUP); 72 | 73 | $installer->endSetup(); 74 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/sql/mailchimp_setup/mysql4-upgrade-1.1.14-1.1.15.php: -------------------------------------------------------------------------------- 1 | run( 6 | " 7 | CREATE TABLE IF NOT EXISTS `{$this->getTable('mailchimp_interest_group')}` ( 8 | `id` INT(10) unsigned NOT NULL auto_increment, 9 | `customer_id` INT(10) DEFAULT NULL, 10 | `subscriber_id` INT(10) DEFAULT NULL, 11 | `store_id` SMALLINT (5) NOT NULL DEFAULT 0, 12 | `created_at` DATETIME DEFAULT CURRENT_TIMESTAMP, 13 | `updated_at` DATETIME DEFAULT CURRENT_TIMESTAMP, 14 | `groupdata` TEXT(4096) NOT NULL, 15 | PRIMARY KEY (`id`) 16 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 17 | " 18 | ); 19 | 20 | $installer->endSetup(); 21 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/sql/mailchimp_setup/mysql4-upgrade-1.1.15-1.1.15.1.php: -------------------------------------------------------------------------------- 1 | run( 7 | " 8 | ALTER TABLE `{$this->getTable('mailchimp_sync_batches')}` 9 | ADD INDEX `idx_status_store_id` (`status`,`store_id`); 10 | " 11 | ); 12 | } catch (Exception $e) { 13 | Mage::log($e->getMessage(), null, 'MailChimp_Errors.log', true); 14 | } 15 | 16 | 17 | $installer->endSetup(); 18 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/sql/mailchimp_setup/mysql4-upgrade-1.1.15.1-1.1.15.2.php: -------------------------------------------------------------------------------- 1 | run( 6 | " 7 | CREATE TABLE IF NOT EXISTS `{$this->getTable('mailchimp_stores')}` ( 8 | `id` INT(10) unsigned NOT NULL auto_increment, 9 | `apikey` VARCHAR(50) NOT NULL, 10 | `storeid` VARCHAR(50) NOT NULL, 11 | `listid` VARCHAR(50) NOT NULL, 12 | `name` VARCHAR(128) NOT NULL, 13 | `platform` VARCHAR(50) NOT NULL, 14 | `is_sync` INT(1) NOT NULL DEFAULT 0, 15 | `email_address` VARCHAR(128) NOT NULL, 16 | `currency_code` CHAR(3) NOT NULL, 17 | `money_format` VARCHAR(10) NOT NULL, 18 | `primary_locale` VARCHAR(5) NOT NULL, 19 | `timezone` VARCHAR(20) NOT NULL, 20 | `phone` VARCHAR(50) NOT NULL, 21 | `address_address_one` VARCHAR(50) NOT NULL, 22 | `address_address_two` VARCHAR(50) NOT NULL, 23 | `address_city` VARCHAR(50) NOT NULL, 24 | `address_province` VARCHAR(50) NOT NULL, 25 | `address_province_code` CHAR(2) NOT NULL, 26 | `address_postal_code` VARCHAR(50) NOT NULL, 27 | `address_country` VARCHAR(50) NOT NULL, 28 | `address_country_code` CHAR(2) NOT NULL, 29 | `domain` VARCHAR(512) NOT NULL, 30 | `mc_account_name` VARCHAR(512) NOT NULL, 31 | `list_name` VARCHAR(512) NOT NULL, 32 | PRIMARY KEY (`id`) 33 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 34 | " 35 | ); 36 | 37 | $installer->endSetup(); 38 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/sql/mailchimp_setup/mysql4-upgrade-1.1.16.1-1.1.16.2.php: -------------------------------------------------------------------------------- 1 | run( 8 | "ALTER TABLE `{$this->getTable('mailchimp_stores')}` 9 | CHANGE COLUMN `apikey` `apikey` VARCHAR(128) NOT NULL;" 10 | ); 11 | 12 | $installer->run( 13 | "TRUNCATE `{$this->getTable('mailchimp_stores')}`;" 14 | ); 15 | 16 | $configDataCollection = Mage::getModel('core/config_data') 17 | ->getCollection() 18 | ->addFieldToFilter('path', 'mailchimp/general/apikey'); 19 | 20 | $mailchimpShards = array('us'); 21 | foreach ($configDataCollection as $data) { 22 | $dbApiKey = $data->getValue(); 23 | foreach ($mailchimpShards as $shard) { 24 | if (strpos($dbApiKey, "-$shard") !== false) { 25 | list($hash, $server) = explode("-$shard", $dbApiKey); 26 | if (is_numeric($server) && strlen($hash) === 32) { 27 | $encryptedApiKey = Mage::helper('core')->encrypt($dbApiKey); 28 | $installer->setConfigData( 29 | 'mailchimp/general/apikey', 30 | $encryptedApiKey, 31 | $data->getScope(), 32 | $data->getScopeId() 33 | ); 34 | } 35 | } 36 | } 37 | } 38 | 39 | /* Mandrill migration */ 40 | $configDataCollection = Mage::getModel('core/config_data') 41 | ->getCollection() 42 | ->addFieldToFilter('path', 'mandrill/general/apikey'); 43 | 44 | foreach ($configDataCollection as $data) { 45 | $dbApiKey = $data->getValue(); 46 | if (strlen($dbApiKey) == 22) { 47 | $encryptedApiKey = Mage::helper('core')->encrypt($dbApiKey); 48 | $installer->setConfigData( 49 | 'mandrill/general/apikey', 50 | $encryptedApiKey, 51 | $data->getScope(), 52 | $data->getScopeId() 53 | ); 54 | } 55 | } 56 | } catch (Exception $e) { 57 | Mage::log($e->getMessage(), null, 'MailChimp_Errors.log', true); 58 | } 59 | 60 | 61 | $installer->endSetup(); 62 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/sql/mailchimp_setup/mysql4-upgrade-1.1.20-1.1.21.php: -------------------------------------------------------------------------------- 1 | getCollection() 11 | ->addFieldToFilter('path', 'mailchimp/general/webhook_id'); 12 | 13 | /* If webhook is created, edites it and place the new "event" variable */ 14 | if ($configDataCollection->getSize()) { 15 | // Sets the migration flag to edit webhooks. 16 | Mage::helper('mailchimp') 17 | ->saveMailChimpConfig( 18 | array( 19 | array( 20 | Ebizmarts_MailChimp_Model_Config::GENERAL_MIGRATE_FROM_1120, 21 | 1) 22 | ), 23 | 0, 24 | 'default' 25 | ); 26 | } 27 | } catch (Exception $e) { 28 | Mage::log($e->getMessage(), null, 'MailChimp_Errors.log', true); 29 | } 30 | 31 | $installer->endSetup(); 32 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/sql/mailchimp_setup/mysql4-upgrade-1.1.21-1.1.22.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright Ebizmarts (http://ebizmarts.com) 10 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 11 | * @date: 27/12/17 6:23 PM 12 | * @file: mysql4-upgrade-1.1.21-1.1.22.php 13 | */ 14 | 15 | $installer = $this; 16 | 17 | $installer->startSetup(); 18 | 19 | try { 20 | $installer->run( 21 | " 22 | ALTER TABLE `{$this->getTable('mailchimp_sync_batches')}` 23 | ADD column `modified_date` DATETIME DEFAULT NULL; 24 | " 25 | ); 26 | } catch (Exception $e) { 27 | Mage::log($e->getMessage(), null, 'MailChimp_Errors.log', true); 28 | } 29 | 30 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/sql/mailchimp_setup/mysql4-upgrade-1.1.4-1.1.5.php: -------------------------------------------------------------------------------- 1 | 8 | * @copyright Ebizmarts (http://ebizmarts.com) 9 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 10 | * @date: 6/9/16 4:05 PM 11 | * @file: mysql4-upgrade-1.0.1-1.0.2.php 12 | */ 13 | 14 | $installer = $this; 15 | 16 | $installer->startSetup(); 17 | 18 | 19 | try { 20 | $installer->run( 21 | " 22 | ALTER TABLE `{$this->getTable('sales_flat_quote')}` 23 | ADD column `mailchimp_landing_page` VARCHAR (512) NOT NULL DEFAULT ''; 24 | ALTER TABLE `{$this->getTable('sales_flat_quote')}` 25 | ADD column `mailchimp_campaign_id` VARCHAR (16) NOT NULL DEFAULT ''; 26 | ALTER TABLE `{$this->getTable('sales_flat_order')}` 27 | ADD column `mailchimp_landing_page` VARCHAR (512) NOT NULL DEFAULT ''; 28 | " 29 | ); 30 | } catch (Exception $e) { 31 | Mage::log($e->getMessage(), null, 'MailChimp_Errors.log', true); 32 | } 33 | 34 | 35 | $installer->endSetup(); 36 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/sql/mailchimp_setup/mysql4-upgrade-1.1.5-1.1.5.6.php: -------------------------------------------------------------------------------- 1 | 8 | * @copyright Ebizmarts (http://ebizmarts.com) 9 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 10 | * @date: 6/9/16 4:05 PM 11 | * @file: mysql4-upgrade-1.0.1-1.0.2.php 12 | */ 13 | 14 | $installer = $this; 15 | 16 | $installer->startSetup(); 17 | 18 | $installer->run( 19 | " 20 | CREATE TABLE IF NOT EXISTS `{$this->getTable('mailchimp_ecommerce_sync_data')}` ( 21 | `id` INT(10) unsigned NOT NULL auto_increment, 22 | `related_id` INT(10) DEFAULT 0, 23 | `type` VARCHAR(3) NOT NULL, 24 | `mailchimp_store_id` VARCHAR(50) NOT NULL DEFAULT '', 25 | `mailchimp_sync_error` VARCHAR(255) NOT NULL DEFAULT '', 26 | `mailchimp_sync_delta` DATETIME NOT NULL, 27 | `mailchimp_sync_modified` INT(1) NOT NULL DEFAULT 0, 28 | `mailchimp_sync_deleted` INT(1) NOT NULL DEFAULT 0, 29 | `mailchimp_token` VARCHAR(32) NOT NULL DEFAULT '', 30 | PRIMARY KEY (`id`) 31 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 32 | " 33 | ); 34 | 35 | try { 36 | $installer->run( 37 | " 38 | ALTER TABLE `{$this->getTable('mailchimp_errors')}` 39 | ADD column `store_id` INT(5) DEFAULT 0; 40 | " 41 | ); 42 | } catch (Exception $e) { 43 | Mage::log($e->getMessage(), null, 'MailChimp_Errors.log', true); 44 | } 45 | 46 | Mage::helper('mailchimp') 47 | ->saveMailChimpConfig( 48 | array( 49 | array( 50 | Ebizmarts_MailChimp_Model_Config::GENERAL_MIGRATE_FROM_115, 51 | 1) 52 | ), 53 | 0, 54 | 'default' 55 | ); 56 | 57 | 58 | $installer->endSetup(); 59 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/sql/mailchimp_setup/mysql4-upgrade-1.1.5.6-1.1.6.php: -------------------------------------------------------------------------------- 1 | 8 | * @copyright Ebizmarts (http://ebizmarts.com) 9 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 10 | * @date: 6/9/16 4:05 PM 11 | * @file: mysql4-upgrade-1.0.1-1.0.2.php 12 | */ 13 | 14 | $installer = $this; 15 | 16 | $installer->startSetup(); 17 | 18 | try { 19 | $installer->run( 20 | " 21 | ALTER TABLE `{$this->getTable('mailchimp_errors')}` 22 | ADD column `mailchimp_store_id` VARCHAR(50) NOT NULL DEFAULT ''; 23 | ALTER TABLE `{$this->getTable('newsletter_subscriber')}` 24 | ADD column `mailchimp_sync_modified` INT(1) NOT NULL DEFAULT 0; 25 | " 26 | ); 27 | } catch (Exception $e) { 28 | Mage::log($e->getMessage(), null, 'MailChimp_Errors.log', true); 29 | } 30 | 31 | $installer->endSetup(); 32 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/sql/mailchimp_setup/mysql4-upgrade-1.1.6-1.1.6.1.php: -------------------------------------------------------------------------------- 1 | run( 7 | " 8 | ALTER TABLE `{$this->getTable('mailchimp_ecommerce_sync_data')}` 9 | ADD INDEX `mailchimp_store_id` (`mailchimp_store_id`), ADD INDEX `related_id` (`related_id`); 10 | " 11 | ); 12 | } catch (Exception $e) { 13 | Mage::log($e->getMessage(), null, 'MailChimp_Errors.log', true); 14 | } 15 | 16 | $installer->endSetup(); 17 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/sql/mailchimp_setup/mysql4-upgrade-1.1.6.3-1.1.6.4.php: -------------------------------------------------------------------------------- 1 | saveMailChimpConfig( 7 | array( 8 | array( 9 | Ebizmarts_MailChimp_Model_Config::GENERAL_MIGRATE_FROM_116, 10 | 1) 11 | ), 12 | 0, 13 | 'default' 14 | ); 15 | 16 | $installer->endSetup(); 17 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/sql/mailchimp_setup/mysql4-upgrade-1.1.6.4-1.1.6.5.php: -------------------------------------------------------------------------------- 1 | run( 7 | " 8 | ALTER TABLE `{$this->getTable('mailchimp_ecommerce_sync_data')}` 9 | ADD column `batch_id` VARCHAR (10) DEFAULT NULL; 10 | " 11 | ); 12 | 13 | Mage::helper('mailchimp') 14 | ->saveMailChimpConfig( 15 | array( 16 | array( 17 | Ebizmarts_MailChimp_Model_Config::GENERAL_MIGRATE_FROM_1164, 18 | 1) 19 | ), 20 | 0, 21 | 'default' 22 | ); 23 | } catch (Exception $e) { 24 | Mage::log($e->getMessage(), null, 'MailChimp_Errors.log', true); 25 | } 26 | 27 | $installer->endSetup(); 28 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/sql/mailchimp_setup/mysql4-upgrade-1.1.6.7-1.1.6.8.php: -------------------------------------------------------------------------------- 1 | run( 6 | " 7 | CREATE TABLE IF NOT EXISTS `{$this->getTable('mailchimp_webhook_request')}` ( 8 | `id` INT(10) unsigned NOT NULL auto_increment, 9 | `type` VARCHAR(20) NOT NULL, 10 | `fired_at` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', 11 | `data_request` VARCHAR(4096), 12 | `processed` INT(1) NOT NULL DEFAULT 0, 13 | PRIMARY KEY (`id`) 14 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 15 | " 16 | ); 17 | 18 | $installer->endSetup(); 19 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/sql/mailchimp_setup/mysql4-upgrade-1.1.7-1.1.8.php: -------------------------------------------------------------------------------- 1 | run( 7 | " 8 | ALTER TABLE `{$this->getTable('sales_flat_order')}` 9 | ADD INDEX `IDX_M4M_SALES_FLAT_ORDER_CUSTOMER_EMAIL` (`customer_email`); 10 | " 11 | ); 12 | } catch (Exception $e) { 13 | Mage::log($e->getMessage(), null, 'MailChimp_Errors.log', true); 14 | } 15 | 16 | try { 17 | $installer->run( 18 | " 19 | ALTER TABLE `{$this->getTable('mailchimp_ecommerce_sync_data')}` 20 | ADD INDEX `batch_id` (`batch_id`); 21 | " 22 | ); 23 | } catch (Exception $e) { 24 | Mage::log($e->getMessage(), null, 'MailChimp_Errors.log', true); 25 | } 26 | 27 | $installer->endSetup(); 28 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/sql/mailchimp_setup/mysql4-upgrade-1.1.9.1-1.1.9.2.php: -------------------------------------------------------------------------------- 1 | deleteConfigData(Ebizmarts_MailChimp_Model_Config::ECOMMERCE_MC_JS_URL); 6 | 7 | $installer->endSetup(); 8 | -------------------------------------------------------------------------------- /app/code/community/Ebizmarts/MailChimp/sql/mailchimp_setup/mysql4-upgrade-1.1.9.2-1.1.9.3.php: -------------------------------------------------------------------------------- 1 | run( 7 | " 8 | ALTER TABLE `{$this->getTable('mailchimp_ecommerce_sync_data')}` 9 | ADD COLUMN `deleted_related_id` INT(10) DEFAULT NULL; 10 | " 11 | ); 12 | } catch (Exception $e) { 13 | Mage::log($e->getMessage(), null, 'MailChimp_Errors.log', true); 14 | } 15 | 16 | $installer->endSetup(); 17 | -------------------------------------------------------------------------------- /app/design/adminhtml/default/default/template/ebizmarts/mailchimp/notifications.phtml: -------------------------------------------------------------------------------- 1 | getMessageNotification()) : ?> 2 |
3 | 4 | 5 | 30 | -------------------------------------------------------------------------------- /app/design/adminhtml/default/default/template/ebizmarts/mailchimp/sales/order/creditmemo/create/unsubscribe.phtml: -------------------------------------------------------------------------------- 1 |

2 | 3 | 4 |

5 | -------------------------------------------------------------------------------- /app/design/adminhtml/default/default/template/ebizmarts/mailchimp/sales/order/view/monkey.phtml: -------------------------------------------------------------------------------- 1 | isReferred()) : ?> 2 |
3 |
4 |

escapeQuote($this->__('MailChimp')) ?>

5 |
6 |
7 |
8 | 9 | 10 | 17 | 38 | 39 |
11 | 16 | 18 | isDataAvailable()): ?> 19 | escapeQuote( 20 | $this->__("Yaay! Recovered by Mailchimp's campaign.") . 21 | "
" . 22 | $this->__("Name") . 23 | ": " . 24 | $this->getCampaignName() . 25 | "
" . 26 | $this->__("Id") . ": " . $this->getCampaignId() 27 | ); ?> 28 |
29 | 30 | escapeQuote( 31 | $this->__("The campaign does not belong to the audience configured for ") . 32 | $this->getStoreCodeFromOrder() . 33 | $this->__(" view.") 34 | ); ?> 35 | 36 | 37 |
40 |
41 |
42 |
43 |
44 | 45 | -------------------------------------------------------------------------------- /app/design/adminhtml/default/default/template/ebizmarts/mailchimp/system/config/createmergefields.phtml: -------------------------------------------------------------------------------- 1 | 23 | 24 | 25 | getButtonHtml(); ?> 26 | -------------------------------------------------------------------------------- /app/design/adminhtml/default/default/template/ebizmarts/mailchimp/system/config/createwebhook.phtml: -------------------------------------------------------------------------------- 1 | 21 | 22 | 23 | getButtonHtml(); ?> 24 | -------------------------------------------------------------------------------- /app/design/adminhtml/default/default/template/ebizmarts/mailchimp/system/config/fieldset/hint.phtml: -------------------------------------------------------------------------------- 1 | 6 | 12 |
13 | 14 |

15 | 16 | escapeHtml( 17 | Mage::helper('mailchimp')->__( 18 | 'Mailchimp For Magento v%s by', 19 | $this->getMailChimpVersion() 20 | ) 21 | ) ?> 22 | 23 | 24 | ebizmarts 25 | 26 |
27 | escapeHtml( 28 | Mage::helper('mailchimp')->__('Need help? Read how to') 29 | ); ?> 30 | 33 | escapeHtml(Mage::helper('mailchimp')->__('Configure and Connect')); ?> 34 | escapeHtml(Mage::helper('mailchimp')->__('or browse our ')); ?> 35 | 36 | escapeHtml(Mage::helper('mailchimp')->__('support forums')); ?> 37 | 38 |

39 | isApiKeySet() ) : ?> 40 |

47 | Support Mailchimp4Magento, Subscribe for a free Mailchimp Account! 48 |

49 | 50 |
51 | -------------------------------------------------------------------------------- /app/design/adminhtml/default/default/template/ebizmarts/mailchimp/system/config/oauth_wizard.phtml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 29 | 30 |
9 | 28 |
31 | -------------------------------------------------------------------------------- /app/design/adminhtml/default/default/template/ebizmarts/mailchimp/system/config/resendecommercedata.phtml: -------------------------------------------------------------------------------- 1 | getButtonHtml(); ?> 2 | -------------------------------------------------------------------------------- /app/design/adminhtml/default/default/template/ebizmarts/mailchimp/system/config/resendsubscribers.phtml: -------------------------------------------------------------------------------- 1 | 22 | 23 | 24 | getButtonHtml(); ?> 25 | -------------------------------------------------------------------------------- /app/design/adminhtml/default/default/template/ebizmarts/mailchimp/system/config/reseterrors.phtml: -------------------------------------------------------------------------------- 1 | 22 | 23 | 24 | getButtonHtml(); ?> 25 | -------------------------------------------------------------------------------- /app/design/adminhtml/default/default/template/ebizmarts/mandrill/system/config/fieldset/hint.phtml: -------------------------------------------------------------------------------- 1 | 6 |
7 | 8 |

9 | 10 | escapeHtml( 11 | Mage::helper('mailchimp')->__( 12 | 'Mandrill For Magento v%s by', 13 | $this->getMandrillVersion() 14 | ) 15 | ); ?> 16 | 17 | 18 | ebizmarts 19 | 20 |
21 | escapeHtml(Mage::helper('mailchimp')->__('Need help? See our ')); ?> 22 | Wiki 23 | escapeHtml(Mage::helper('mailchimp')->__('or browse our ')); ?> 24 | 25 | escapeHtml(Mage::helper('mailchimp')->__('support forums.')); ?> 26 | 27 |

28 |
29 | -------------------------------------------------------------------------------- /app/design/frontend/base/default/template/ebizmarts/mailchimp/checkout/success/groups.phtml: -------------------------------------------------------------------------------- 1 | getInterest(); 4 | $helper = $block->getMailChimpHelper(); 5 | ?> 6 |

7 | isInterestGroupEnabled($this->_getStoreId())): ?> 8 | escapeQuote($block->getMessageBefore()) ?> 9 |

10 |
11 | 12 |
13 | 16 |
17 |
18 | getLayout()->createBlock( 19 | 'mailchimp/group_type', 20 | 'mailchimp.group.type', 21 | array('interests' => $i) 22 | )->toHtml(); ?> 23 |
24 |
25 |
26 | 27 |
28 |
29 |
30 | 37 |
38 |
39 |
40 | escapeHtml($block->getMessageAfter()) ?> 41 | 42 | 43 |

44 | -------------------------------------------------------------------------------- /app/design/frontend/base/default/template/ebizmarts/mailchimp/customer/newsletter/index.phtml: -------------------------------------------------------------------------------- 1 | getInterest(); 4 | ?> 5 |
6 | 7 | 19 | 20 |
21 | -------------------------------------------------------------------------------- /app/design/frontend/base/default/template/ebizmarts/mailchimp/group/type/checkboxes.phtml: -------------------------------------------------------------------------------- 1 | getCurrentInterest(); 4 | ?> 5 | 29 | -------------------------------------------------------------------------------- /app/design/frontend/base/default/template/ebizmarts/mailchimp/group/type/dropdown.phtml: -------------------------------------------------------------------------------- 1 | getCurrentInterest(); 4 | ?> 5 |
6 | 18 |
19 | -------------------------------------------------------------------------------- /app/design/frontend/base/default/template/ebizmarts/mailchimp/group/type/radio.phtml: -------------------------------------------------------------------------------- 1 | getCurrentInterest(); 4 | ?> 5 | 24 | -------------------------------------------------------------------------------- /app/etc/modules/Ebizmarts_MailChimp.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | true 6 | community 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ebizmarts/mc-magento", 3 | "type": "magento-module", 4 | "license": "OSL-3.0", 5 | "homepage": "https://connect.mailchimp.com/integrations/magento", 6 | "description": "FULL SUPPORTED integration with MailChimp Email Marketing and Mandrill Transactional Emails for Magento.", 7 | "authors": [ 8 | { 9 | "name": "Ebizmarts", 10 | "email": "mailchimp@ebizmarts-desk.zendesk.com" 11 | } 12 | ], 13 | "suggest": { 14 | "magento-hackathon/magento-composer-installer": "Map/copy module files with your Magento installation" 15 | }, 16 | "require-dev": { 17 | "colinmollenhour/modman": "^1.12", 18 | "magento-ecg/coding-standard": "^2.0", 19 | "magento/marketplace-eqp": "^1.0", 20 | "phpunit/phpunit": "^4.8" 21 | }, 22 | "repositories": [ 23 | { 24 | "type": "vcs", 25 | "url": "https://github.com/magento/marketplace-eqp.git" 26 | } 27 | ] 28 | } 29 | -------------------------------------------------------------------------------- /dev/tests/mailchimp/autoload.php: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | tests 14 | 15 | 16 | 17 | ../../../app/code/community/Ebizmarts/ 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /dev/tests/mailchimp/tests/app/Ebizmarts/MailChimp/Helper/MigrationTest.php: -------------------------------------------------------------------------------- 1 | true, '116' => true, '1164' => true); 13 | 14 | $migrationHelperMock = $this->getMockBuilder(Ebizmarts_MailChimp_Helper_Migration::class) 15 | ->disableOriginalConstructor() 16 | ->setMethods( 17 | array( 18 | 'delete115MigrationConfigData', 'delete116MigrationConfigData', 19 | 'delete1164MigrationConfigData', 'getHelper' 20 | ) 21 | ) 22 | ->getMock(); 23 | 24 | $helperMock = $this->getMockBuilder(Ebizmarts_MailChimp_Helper_Data::class) 25 | ->disableOriginalConstructor() 26 | ->setMethods(array('getConfig')) 27 | ->getMock(); 28 | 29 | $modelConfigMock = $this->getMockBuilder(Mage_Core_Model_Config::class) 30 | ->disableOriginalConstructor() 31 | ->setMethods(array('cleanCache')) 32 | ->getMock(); 33 | 34 | $migrationHelperMock->expects($this->once())->method('getHelper')->willReturn($helperMock); 35 | $migrationHelperMock->expects($this->once())->method('delete115MigrationConfigData'); 36 | $migrationHelperMock->expects($this->once())->method('delete116MigrationConfigData'); 37 | $migrationHelperMock->expects($this->once())->method('delete1164MigrationConfigData'); 38 | $helperMock->expects($this->once())->method('getConfig')->willReturn($modelConfigMock); 39 | 40 | $modelConfigMock->expects($this->once())->method('cleanCache'); 41 | 42 | $migrationHelperMock->handleDeleteMigrationConfigData($arrayMigrationConfigData); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /dev/tests/mailchimp/tests/app/Ebizmarts/MailChimp/Helper/WebhookTest.php: -------------------------------------------------------------------------------- 1 | 0, 'scope' => 'default'); 15 | $listId = 'a1s2d3f4g5'; 16 | 17 | $webhookHelperMock = $this->getMockBuilder(Ebizmarts_MailChimp_Helper_Webhook::class) 18 | ->disableOriginalConstructor() 19 | ->setMethods( 20 | array('deleteCurrentWebhook', 'createNewWebhook', 'getHelper') 21 | ) 22 | ->getMock(); 23 | 24 | $helperMock = $this->getMockBuilder(Ebizmarts_MailChimp_Helper_Data::class) 25 | ->disableOriginalConstructor() 26 | ->setMethods( 27 | array('getRealScopeForConfig', 'getGeneralList', 'isSubscriptionEnabled') 28 | ) 29 | ->getMock(); 30 | 31 | $webhookHelperMock->expects($this->once())->method('getHelper')->willReturn($helperMock); 32 | $helperMock 33 | ->expects($this->once()) 34 | ->method('getRealScopeForConfig') 35 | ->with(Ebizmarts_MailChimp_Model_Config::GENERAL_LIST, $scopeId, $scope) 36 | ->willReturn($realScopeArray); 37 | $helperMock->expects($this->once())->method('getGeneralList')->with($scopeId, $scope)->willReturn($listId); 38 | $webhookHelperMock 39 | ->expects($this->once()) 40 | ->method('deleteCurrentWebhook') 41 | ->with($realScopeArray['scope_id'], $realScopeArray['scope'], $listId); 42 | $helperMock->expects($this->once())->method('isSubscriptionEnabled')->with($scopeId, $scope)->willReturn(1); 43 | $webhookHelperMock->expects($this->once())->method('createNewWebhook')->with($scopeId, $scope, $listId); 44 | 45 | $webhookHelperMock->handleWebhookChange($scopeId, $scope); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /dev/tests/mailchimp/tests/app/Ebizmarts/MailChimp/Model/Adminhtml/Resendecommercedata/CommentTest.php: -------------------------------------------------------------------------------- 1 | getMockBuilder(Ebizmarts_MailChimp_Helper_Data::class) 12 | ->disableOriginalConstructor() 13 | ->setMethods(array('getCurrentScope')) 14 | ->getMock(); 15 | 16 | $commentMock = $this->getMockBuilder(Ebizmarts_MailChimp_Model_Adminhtml_Resendecommercedata_Comment::class) 17 | ->disableOriginalConstructor() 18 | ->setMethods(array('getMcHelper')) 19 | ->getMock(); 20 | 21 | $commentMock 22 | ->expects($this->once()) 23 | ->method('getMcHelper') 24 | ->willReturn($helperMock); 25 | 26 | $helperMock 27 | ->expects($this->once()) 28 | ->method('getCurrentScope') 29 | ->willReturn($data['scopeArray']); 30 | 31 | $result = $commentMock->getCommentText(); 32 | 33 | $this->assertEquals($data['text'], $result); 34 | 35 | } 36 | 37 | public function commentTextProvider() 38 | { 39 | return array( 40 | "testDefaultConfig" => array( 41 | array( 42 | "scopeArray" => array("scope" => "default"), 43 | "text" => "This will resend the ecommerce data for all Websites and Store Views." 44 | ) 45 | ), 46 | "testWebsiteScope" => array( 47 | array( 48 | "scopeArray" => array("scope" => "websites"), 49 | "text" => "This will resend the ecommerce data for this Website only." 50 | ) 51 | ), 52 | "testStoreViewScope" => array( 53 | array( 54 | "scopeArray" => array("scope" => "stores"), 55 | "text" => "This will resend the ecommerce data for this Store View only." 56 | ) 57 | ) 58 | ); 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /dev/tests/mailchimp/tests/app/Ebizmarts/MailChimp/Model/Adminhtml/Resendsubscribers/CommentTest.php: -------------------------------------------------------------------------------- 1 | getMockBuilder(Ebizmarts_MailChimp_Helper_Data::class) 12 | ->disableOriginalConstructor() 13 | ->setMethods(array('getCurrentScope')) 14 | ->getMock(); 15 | 16 | $commentMock = $this->getMockBuilder(Ebizmarts_MailChimp_Model_Adminhtml_Resendsubscribers_Comment::class) 17 | ->disableOriginalConstructor() 18 | ->setMethods(array('getMcHelper')) 19 | ->getMock(); 20 | 21 | $commentMock 22 | ->expects($this->once()) 23 | ->method('getMcHelper') 24 | ->willReturn($helperMock); 25 | 26 | $helperMock 27 | ->expects($this->once()) 28 | ->method('getCurrentScope') 29 | ->willReturn($data['scopeArray']); 30 | 31 | $result = $commentMock->getCommentText(); 32 | 33 | $this->assertEquals($data['text'], $result); 34 | 35 | } 36 | 37 | public function commentTextProvider() 38 | { 39 | return array( 40 | "testDefaultConfig" => array( 41 | array( 42 | "scopeArray" => array("scope" => "default"), 43 | "text" => "This will resend the subscribers for all Websites and Store Views." 44 | ) 45 | ), 46 | "testWebsiteScope" => array( 47 | array( 48 | "scopeArray" => array("scope" => "websites"), 49 | "text" => "This will resend the subscribers for this Website only." 50 | ) 51 | ), 52 | "testStoreViewScope" => array( 53 | array( 54 | "scopeArray" => array("scope" => "stores"), 55 | "text" => "This will resend the subscribers for this Store View only." 56 | ) 57 | ) 58 | ); 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /dev/tests/mailchimp/tests/app/Ebizmarts/MailChimp/Model/Adminhtml/Reseterrors/CommentTest.php: -------------------------------------------------------------------------------- 1 | getMockBuilder(Ebizmarts_MailChimp_Helper_Data::class) 12 | ->disableOriginalConstructor() 13 | ->setMethods(array('getCurrentScope')) 14 | ->getMock(); 15 | 16 | $commentMock = $this->getMockBuilder(Ebizmarts_MailChimp_Model_Adminhtml_Reseterrors_Comment::class) 17 | ->disableOriginalConstructor() 18 | ->setMethods(array('getMcHelper')) 19 | ->getMock(); 20 | 21 | $commentMock 22 | ->expects($this->once()) 23 | ->method('getMcHelper') 24 | ->willReturn($helperMock); 25 | 26 | $helperMock 27 | ->expects($this->once()) 28 | ->method('getCurrentScope') 29 | ->willReturn($data['scopeArray']); 30 | 31 | $result = $commentMock->getCommentText(); 32 | 33 | $this->assertEquals($data['text'], $result); 34 | 35 | } 36 | 37 | public function commentTextProvider() 38 | { 39 | return array( 40 | "testDefaultConfig" => array( 41 | array( 42 | "scopeArray" => array("scope" => "default"), 43 | "text" => "This will reset the errors for all Websites and Store Views." 44 | ) 45 | ), 46 | "testWebsiteScope" => array( 47 | array( 48 | "scopeArray" => array("scope" => "websites"), 49 | "text" => "This will reset the errors for this Website only." 50 | ) 51 | ), 52 | "testStoreViewScope" => array( 53 | array( 54 | "scopeArray" => array("scope" => "stores"), 55 | "text" => "This will reset the errors for this Store View only." 56 | ) 57 | ) 58 | ); 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /dev/tests/mailchimp/tests/app/Ebizmarts/MailChimp/Model/Api/ItemSynchronizerTest.php: -------------------------------------------------------------------------------- 1 | _syncItemApiMock = $this->getMockBuilder(Ebizmarts_MailChimp_Model_Api_ItemSynchronizer::class); 15 | } 16 | 17 | public function tearDown() 18 | { 19 | $this->_syncItemApiMock = null; 20 | } 21 | 22 | public function testGetSyncDataTableName() 23 | { 24 | $_syncItemApiMock = $this->_syncItemApiMock 25 | ->setMethods(array('getCoreResource')) 26 | ->getMock(); 27 | 28 | $coreResourceMock = $this->getMockBuilder(Mage_Core_Model_Resource::class) 29 | ->setMethods(array('getTableName')) 30 | ->getMock(); 31 | 32 | $_syncItemApiMock->expects($this->once())->method('getCoreResource')->willReturn($coreResourceMock); 33 | 34 | $coreResourceMock 35 | ->expects($this->once()) 36 | ->method('getTableName') 37 | ->with('mailchimp/ecommercesyncdata') 38 | ->willReturn('mailchimp_ecommerce_sync_data'); 39 | 40 | $_syncItemApiMock->getMailchimpEcommerceDataTableName(); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /dev/tests/mailchimp/tests/app/Ebizmarts/MailChimp/Model/Api/SubscribersTest.php: -------------------------------------------------------------------------------- 1 | getMockBuilder(Ebizmarts_MailChimp_Model_Api_Subscribers::class) 21 | ->disableOriginalConstructor() 22 | ->setMethods(array('magentoConfigNeedsConfirmation')) 23 | ->getMock(); 24 | 25 | $return = $subscribersApiMock->translateMagentoStatusToMailchimpStatus($magentoStatus); 26 | 27 | $this->assertEquals($expected, $return); 28 | } 29 | 30 | /** 31 | * @return array(subscriber_status, magento_store_id, subscriber_status_string) 32 | */ 33 | public function magentoSubscriberStatus() 34 | { 35 | return array( 36 | array(Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED, "subscribed"), 37 | array(Mage_Newsletter_Model_Subscriber::STATUS_NOT_ACTIVE, "pending"), 38 | array(Mage_Newsletter_Model_Subscriber::STATUS_UNSUBSCRIBED, "unsubscribed"), 39 | array(Mage_Newsletter_Model_Subscriber::STATUS_UNCONFIRMED, "pending"), 40 | ); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /dev/tests/mailchimp/tests/app/Ebizmarts/MailChimp/Model/ProcessWebhookTest.php: -------------------------------------------------------------------------------- 1 | 'a1s2d3f4t5', 'email' => 'pepe@ebizmarts.com'); 13 | 14 | $processWebhookMock = $this->getMockBuilder(Ebizmarts_MailChimp_Model_ProcessWebhook::class) 15 | ->disableOriginalConstructor() 16 | ->setMethods(array('getMailchimpTagsModel')) 17 | ->getMock(); 18 | 19 | $mailchimpTagsApiMock = $this->getMockBuilder(Ebizmarts_MailChimp_Model_Api_Subscribers_MailchimpTags::class) 20 | ->disableOriginalConstructor() 21 | ->setMethods(array('processMergeFields')) 22 | ->getMock(); 23 | 24 | $processWebhookMock->expects($this->once()) 25 | ->method('getMailchimpTagsModel') 26 | ->willReturn($mailchimpTagsApiMock); 27 | 28 | $mailchimpTagsApiMock->expects($this->once()) 29 | ->method('processMergeFields') 30 | ->with($data) 31 | ->willReturnSelf(); 32 | 33 | $processWebhookMock->_profile($data); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /dev/tests/mailchimp/tests/app/Ebizmarts/MailChimp/Model/System/Config/Source/ListTest.php: -------------------------------------------------------------------------------- 1 | $scopeId, 'scope' => $scope); 17 | $listId = 'a1s2d3f4g5'; 18 | $mcLists = array( 19 | 'lists' => array(array( 20 | 'id' => $listId, 21 | 'name' => 'Newsletter', 22 | 'stats' => array( 23 | 'member_count' => 18 24 | ) 25 | )) 26 | ); 27 | 28 | $listMock = $this->getMockBuilder(Ebizmarts_MailChimp_Model_System_Config_Source_List::class) 29 | ->disableOriginalConstructor() 30 | ->setMethods(array('getHelper', 'getMCLists')) 31 | ->getMock(); 32 | 33 | $helperMock = $this->getMockBuilder(Ebizmarts_MailChimp_Helper_Data::class) 34 | ->disableOriginalConstructor() 35 | ->setMethods(array('getCurrentScope', 'getGeneralList')) 36 | ->getMock(); 37 | 38 | $listMock->expects($this->once())->method('getHelper')->willReturn($helperMock); 39 | $listMock->expects($this->once())->method('getMCLists')->willReturn($mcLists); 40 | 41 | $expectedResult = array(array( 42 | 'value' => $listId, 43 | 'label' => 'Newsletter (18 members)' 44 | )); 45 | 46 | $result = $listMock->toOptionArray(); 47 | $this->assertEquals($expectedResult, $result); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /dev/tests/mailchimp/tests/lib/Ebizmarts/MailChimpTest.php: -------------------------------------------------------------------------------- 1 | getMockBuilder('Ebizmarts_MailChimp') 17 | ->disableOriginalConstructor() 18 | ->getMock(); 19 | 20 | $this->assertObjectHasAttribute('root', $apiMock); 21 | $this->assertObjectHasAttribute('authorizedApps', $apiMock); 22 | $this->assertObjectHasAttribute('automation', $apiMock); 23 | $this->assertObjectHasAttribute('batchOperation', $apiMock); 24 | $this->assertObjectHasAttribute('campaignFolders', $apiMock); 25 | $this->assertObjectHasAttribute('campaigns', $apiMock); 26 | $this->assertObjectHasAttribute('conversations', $apiMock); 27 | $this->assertObjectHasAttribute('ecommerce', $apiMock); 28 | $this->assertObjectHasAttribute('fileManagerFiles', $apiMock); 29 | $this->assertObjectHasAttribute('fileManagerFolders', $apiMock); 30 | $this->assertObjectHasAttribute('lists', $apiMock); 31 | $this->assertObjectHasAttribute('reports', $apiMock); 32 | $this->assertObjectHasAttribute('templateFolders', $apiMock); 33 | $this->assertObjectHasAttribute('templates', $apiMock); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /js/ebizmarts/mailchimp/campaignCatcher.js: -------------------------------------------------------------------------------- 1 | function getCampaign() { 2 | let urlparams = null; 3 | let isGet = location.search.search('\\?'); 4 | let mc_cid = null; 5 | let isMailchimp = false; 6 | 7 | if (isGet !== -1) { 8 | urlparams = getUrlVars(); 9 | urlparams.forEach( 10 | function (item) { 11 | if (item.key === 'utm_source') { 12 | let reg = /^mailchimp$/; 13 | 14 | if (reg.exec(item.value)) { 15 | isMailchimp = true; 16 | } 17 | } else { 18 | if (item.key === 'mc_cid') { 19 | mc_cid = item.value; 20 | } 21 | } 22 | } 23 | ); 24 | } else { 25 | urlparams = location.href.split('/'); 26 | let utmIndex = jQuery.inArray('utm_source', urlparams); 27 | let mccidIndex = jQuery.inArray('mc_cid', urlparams); 28 | 29 | if (utmIndex !== -1) { 30 | let value = urlparams[utmIndex + 1]; 31 | let reg = /^mailchimp$/; 32 | 33 | if (reg.exec(value)) { 34 | isMailchimp = true; 35 | } 36 | } else { 37 | if (mccidIndex !== -1) { 38 | mc_cid = urlparams[mccidIndex + 1]; 39 | } 40 | } 41 | } 42 | 43 | if (mc_cid && !isMailchimp) { 44 | Mage.Cookies.clear('mailchimp_campaign_id'); 45 | Mage.Cookies.set('mailchimp_campaign_id', mc_cid); 46 | } 47 | 48 | let landingPage = Mage.Cookies.get('mailchimp_landing_page'); 49 | 50 | if (!landingPage) { 51 | Mage.Cookies.set('mailchimp_landing_page', location); 52 | } 53 | 54 | if (isMailchimp) { 55 | Mage.Cookies.clear('mailchimp_campaign_id'); 56 | Mage.Cookies.set('mailchimp_landing_page', location); 57 | } 58 | } 59 | 60 | function getUrlVars() { 61 | let vars = []; 62 | let i = 0; 63 | window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, 64 | function (m, key, value) { 65 | vars[i] = {'value': value, 'key': key}; 66 | i++; 67 | } 68 | ); 69 | return vars; 70 | } 71 | 72 | if (document.loaded) { 73 | getCampaign(); 74 | } else { 75 | document.observe('dom:loaded', getCampaign); 76 | } 77 | -------------------------------------------------------------------------------- /js/ebizmarts/mailchimp/editstores.js: -------------------------------------------------------------------------------- 1 | function setRedColorInvalidAPIkey() 2 | { 3 | var apiKeySelect = $('apikey'); 4 | var text = apiKeySelect[apiKeySelect.selectedIndex].text; 5 | 6 | if(text.startsWith("[Invalid]")) { 7 | apiKeySelect.style.color = 'red'; 8 | } 9 | else{ 10 | apiKeySelect.style.color = 'black'; 11 | } 12 | } 13 | 14 | function loadStores() 15 | { 16 | var apiKey = $('apikey').value; 17 | 18 | $("listid").select('option').each( 19 | function (i) { 20 | i.remove(); 21 | } 22 | ); 23 | 24 | new Ajax.Request( 25 | GET_STORES_URL, { 26 | method: 'get', 27 | parameters: {api_key: apiKey}, 28 | onComplete: function (transport) { 29 | var json = transport.responseText.evalJSON(); 30 | 31 | if (!json.error) { 32 | $H(json).each( 33 | function (item) { 34 | option = new Option(item.value.name, item.value.id); 35 | $("listid").options.add(option); 36 | } 37 | ); 38 | } 39 | } 40 | } 41 | ); 42 | setRedColorInvalidAPIkey(); 43 | } 44 | 45 | function loadApiKeys() 46 | { 47 | let $apikey = $('apikey'); 48 | 49 | if ($apikey != undefined && $apikey.offsetWidth > 0 && $apikey.offsetHeight > 0) { 50 | loadStores(); 51 | $apikey.onchange = loadStores; 52 | } 53 | } 54 | 55 | if (document.loaded) { 56 | loadApiKeys(); 57 | } else { 58 | document.observe('dom:loaded', loadApiKeys); 59 | } 60 | -------------------------------------------------------------------------------- /js/ebizmarts/mailchimp/xmark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailchimp/mc-magento/e6c26e56cd69d2ca48588068706eed6a2409313b/js/ebizmarts/mailchimp/xmark.png -------------------------------------------------------------------------------- /lib/Ebizmarts/MailChimp/Abstract.php: -------------------------------------------------------------------------------- 1 | 8 | * @copyright Ebizmarts (http://ebizmarts.com) 9 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 10 | * @date: 4/29/16 4:22 PM 11 | * @file: Ecommerce.php 12 | */ 13 | class MailChimp_Abstract 14 | { 15 | /** 16 | * @var Mailchimp 17 | */ 18 | protected $_master; 19 | 20 | /** 21 | * MailChimp_Abstract constructor. 22 | * 23 | * @param Ebizmarts_MailChimp $m 24 | */ 25 | public function __construct(Ebizmarts_MailChimp $m) 26 | { 27 | $this->_master = $m; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /lib/Ebizmarts/MailChimp/AuthorizedApps.php: -------------------------------------------------------------------------------- 1 | 8 | * @copyright Ebizmarts (http://ebizmarts.com) 9 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 10 | * @date: 4/29/16 3:47 PM 11 | * @file: AuthorizedApps.php 12 | */ 13 | class MailChimp_AuthorizedApps extends MailChimp_Abstract 14 | { 15 | /** 16 | * @var MailChimp_AuthorizedApps 17 | */ 18 | public $apps; 19 | } 20 | -------------------------------------------------------------------------------- /lib/Ebizmarts/MailChimp/Automation.php: -------------------------------------------------------------------------------- 1 | 8 | * @copyright Ebizmarts (http://ebizmarts.com) 9 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 10 | * @date: 4/29/16 3:47 PM 11 | * @file: Automation.php 12 | */ 13 | class MailChimp_Automation extends MailChimp_Abstract 14 | { 15 | /** 16 | * @var MailChimp_AutomationEmails 17 | */ 18 | public $emails; 19 | 20 | public function get( 21 | $id = null, 22 | $fields = null, 23 | $excludeFields = null, 24 | $status = null, 25 | $beforeSendTime = null, 26 | $sinceSendTime = null, 27 | $beforeCreateTime = null, 28 | $sinceCreateTime = null 29 | ) { 30 | $_params = array(); 31 | 32 | if ($fields) { 33 | $_params['fields'] = $fields; 34 | } 35 | 36 | if ($excludeFields) { 37 | $_params['exclude_fields'] = $excludeFields; 38 | } 39 | 40 | if ($status) { 41 | $_params['status'] = $status; 42 | } 43 | 44 | if ($beforeSendTime) { 45 | $_params['before_send_time'] = $beforeSendTime; 46 | } 47 | 48 | if ($sinceSendTime) { 49 | $_params['since_send_time'] = $sinceSendTime; 50 | } 51 | 52 | if ($beforeCreateTime) { 53 | $_params['before_create_time'] = $beforeCreateTime; 54 | } 55 | 56 | if ($sinceCreateTime) { 57 | $_params['since_create_time'] = $sinceCreateTime; 58 | } 59 | 60 | if ($id) { 61 | return $this->_master->call('automations/' . $id, $_params, Ebizmarts_MailChimp::GET); 62 | } else { 63 | return $this->_master->call('automations', $_params, Ebizmarts_MailChimp::GET); 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /lib/Ebizmarts/MailChimp/AutomationEmails.php: -------------------------------------------------------------------------------- 1 | 8 | * @copyright Ebizmarts (http://ebizmarts.com) 9 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 10 | * @date: 5/2/16 4:12 PM 11 | * @file: AutomationEmails.php 12 | */ 13 | class MailChimp_AutomationEmails extends MailChimp_Abstract 14 | { 15 | /** 16 | * @var MailChimp_AutomationEmailsQuque 17 | */ 18 | public $queue; 19 | } 20 | -------------------------------------------------------------------------------- /lib/Ebizmarts/MailChimp/AutomationEmailsQueue.php: -------------------------------------------------------------------------------- 1 | 8 | * @copyright Ebizmarts (http://ebizmarts.com) 9 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 10 | * @date: 5/2/16 4:13 PM 11 | * @file: AutomationEmailsQueue.php 12 | */ 13 | class MailChimp_AutomationEmailsQuque extends MailChimp_Abstract 14 | { 15 | /** 16 | * @var MailChimp_AutomationEmailsQuque 17 | */ 18 | public $queue; 19 | } 20 | -------------------------------------------------------------------------------- /lib/Ebizmarts/MailChimp/CampaignFolders.php: -------------------------------------------------------------------------------- 1 | 8 | * @copyright Ebizmarts (http://ebizmarts.com) 9 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 10 | * @date: 4/29/16 3:53 PM 11 | * @file: CampaignFolders.php 12 | */ 13 | class MailChimp_CampaignFolders extends MailChimp_Abstract 14 | { 15 | /** 16 | * @var MailChimp_CampaignFolders 17 | */ 18 | public $folders; 19 | } 20 | -------------------------------------------------------------------------------- /lib/Ebizmarts/MailChimp/CampaignsContent.php: -------------------------------------------------------------------------------- 1 | 8 | * @copyright Ebizmarts (http://ebizmarts.com) 9 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 10 | * @date: 5/2/16 4:16 PM 11 | * @file: CampaignsContent.php 12 | */ 13 | class MailChimp_CampaignsContent extends MailChimp_Abstract 14 | { 15 | /** 16 | * @var MailChimp_CampaignsContent 17 | */ 18 | public $content; 19 | } 20 | -------------------------------------------------------------------------------- /lib/Ebizmarts/MailChimp/CampaignsFeedback.php: -------------------------------------------------------------------------------- 1 | 8 | * @copyright Ebizmarts (http://ebizmarts.com) 9 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 10 | * @date: 5/2/16 4:18 PM 11 | * @file: CampaignsFeedback.php 12 | */ 13 | class MailChimp_CampaignsFeedback extends MailChimp_Abstract 14 | { 15 | /** 16 | * @var MailChimp_CampaignsFeedback 17 | */ 18 | public $feedback; 19 | } 20 | -------------------------------------------------------------------------------- /lib/Ebizmarts/MailChimp/CampaignsSendChecklist.php: -------------------------------------------------------------------------------- 1 | 8 | * @copyright Ebizmarts (http://ebizmarts.com) 9 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 10 | * @date: 5/2/16 4:19 PM 11 | * @file: CampaignsSendChecklist.php 12 | */ 13 | class MailChimp_CampaignsSendChecklist extends MailChimp_Abstract 14 | { 15 | /** 16 | * @var MailChimp_CampaignsSendChecklist 17 | */ 18 | public $checklist; 19 | } 20 | -------------------------------------------------------------------------------- /lib/Ebizmarts/MailChimp/Conversations.php: -------------------------------------------------------------------------------- 1 | 8 | * @copyright Ebizmarts (http://ebizmarts.com) 9 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 10 | * @date: 4/29/16 3:58 PM 11 | * @file: Conversations.php 12 | */ 13 | class MailChimp_Conversations extends MailChimp_Abstract 14 | { 15 | /** 16 | * @var MailChimp_ConversationsMessages 17 | */ 18 | public $messages; 19 | } 20 | -------------------------------------------------------------------------------- /lib/Ebizmarts/MailChimp/ConversationsMessages.php: -------------------------------------------------------------------------------- 1 | 8 | * @copyright Ebizmarts (http://ebizmarts.com) 9 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 10 | * @date: 5/2/16 4:26 PM 11 | * @file: ConversationsMessages.php 12 | */ 13 | class MailChimp_ConversationsMessages extends MailChimp_Abstract 14 | { 15 | /** 16 | * @var MailChimp_ConversationsMessages 17 | */ 18 | public $messages; 19 | } 20 | -------------------------------------------------------------------------------- /lib/Ebizmarts/MailChimp/Ecommerce.php: -------------------------------------------------------------------------------- 1 | 8 | * @copyright Ebizmarts (http://ebizmarts.com) 9 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 10 | * @date: 5/2/16 3:59 PM 11 | * @file: Ecommerce.php 12 | */ 13 | class MailChimp_Ecommerce extends MailChimp_Abstract 14 | { 15 | /** 16 | * @var MailChimp_EcommerceStore 17 | */ 18 | public $stores; 19 | /** 20 | * @var MailChimp_EcommerceCarts 21 | */ 22 | public $carts; 23 | /** 24 | * @var MailChimp_EcommerceCustomers 25 | */ 26 | public $customers; 27 | /** 28 | * @var MailChimp_EcommerceOrders 29 | */ 30 | public $orders; 31 | /** 32 | * @var MailChimp_EcommerceProducts 33 | */ 34 | public $products; 35 | /** 36 | * @var MailChimp_EcommercePromoRules 37 | */ 38 | public $promoRules; 39 | 40 | /** 41 | * @return MailChimp_EcommerceStore 42 | */ 43 | public function getStores() 44 | { 45 | return $this->stores; 46 | } 47 | 48 | /** 49 | * @return MailChimp_EcommerceCarts 50 | */ 51 | public function getCarts() 52 | { 53 | return $this->carts; 54 | } 55 | 56 | /** 57 | * @return MailChimp_EcommerceCustomers 58 | */ 59 | public function getCustomers() 60 | { 61 | return $this->customers; 62 | } 63 | 64 | /** 65 | * @return MailChimp_EcommerceOrders 66 | */ 67 | public function getOrders() 68 | { 69 | return $this->orders; 70 | } 71 | 72 | /** 73 | * @return MailChimp_EcommerceProducts 74 | */ 75 | public function getProducts() 76 | { 77 | return $this->products; 78 | } 79 | 80 | /** 81 | * @return MailChimp_EcommercePromoRules 82 | */ 83 | public function getPromoRules() 84 | { 85 | return $this->promoRules; 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /lib/Ebizmarts/MailChimp/EcommerceCarts.php: -------------------------------------------------------------------------------- 1 | 8 | * @copyright Ebizmarts (http://ebizmarts.com) 9 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 10 | * @date: 4/29/16 4:12 PM 11 | * @file: EcommerceStoresCarts.php 12 | */ 13 | class MailChimp_EcommerceCarts extends MailChimp_Abstract 14 | { 15 | /** 16 | * @param $storeId The store id. 17 | * @param null $fields A comma-separated list of fields to return. Reference parameters of sub-objects 18 | * with dot notation. 19 | * @param null $excludeFields A comma-separated list of fields to exclude. Reference parameters of sub-objects 20 | * with dot notation. 21 | * @param null $count The number of records to return. 22 | * @param null $offset The number of records from a collection to skip. Iterating over large collections 23 | * with this parameter can be slow. 24 | * @return mixed 25 | * @throws MailChimp_Error 26 | * @throws MailChimp_HttpError 27 | */ 28 | public function getAll($storeId, $fields = null, $excludeFields = null, $count = null, $offset = null) 29 | { 30 | $_params = array(); 31 | 32 | if ($fields) { 33 | $_params['fields'] = $fields; 34 | } 35 | 36 | if ($excludeFields) { 37 | $_params['exclude_fields'] = $excludeFields; 38 | } 39 | 40 | if ($count) { 41 | $_params['count'] = $count; 42 | } 43 | 44 | if ($offset) { 45 | $_params['offset'] = $offset; 46 | } 47 | 48 | return $this->_master->call('ecommerce/stores/' . $storeId . '/carts', $_params, Ebizmarts_MailChimp::GET); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /lib/Ebizmarts/MailChimp/Exceptions.php: -------------------------------------------------------------------------------- 1 | 8 | * @copyright Ebizmarts (http://ebizmarts.com) 9 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 10 | * @date: 4/27/16 4:45 PM 11 | * @file: Exceptions.php 12 | */ 13 | 14 | class MailChimp_Error extends Exception 15 | { 16 | 17 | /** 18 | * @var string 19 | */ 20 | protected $_mailchimpMessage; 21 | 22 | public function __construct($message = "") 23 | { 24 | $this->_mailchimpMessage = $message; 25 | parent::__construct($message); 26 | } 27 | 28 | public function getFriendlyMessage() 29 | { 30 | $friendlyMessage = "Mailchimp error with the next message: " . $this->_mailchimpMessage; 31 | 32 | return $friendlyMessage; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /lib/Ebizmarts/MailChimp/FileManagerFiles.php: -------------------------------------------------------------------------------- 1 | 8 | * @copyright Ebizmarts (http://ebizmarts.com) 9 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 10 | * @date: 4/29/16 4:41 PM 11 | * @file: FileManagerFiles.php 12 | */ 13 | class MailChimp_FileManagerFiles extends MailChimp_Abstract 14 | { 15 | /** 16 | * @var MailChimp_FileManagerFiles 17 | */ 18 | public $files; 19 | } 20 | -------------------------------------------------------------------------------- /lib/Ebizmarts/MailChimp/FileManagerFolders.php: -------------------------------------------------------------------------------- 1 | 8 | * @copyright Ebizmarts (http://ebizmarts.com) 9 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 10 | * @date: 4/29/16 4:57 PM 11 | * @file: FileManagerFolders.php 12 | */ 13 | class MailChimp_FileManagerFolders extends MailChimp_Abstract 14 | { 15 | /** 16 | * @var MailChimp_FileManagerFolders 17 | */ 18 | public $folders; 19 | } 20 | -------------------------------------------------------------------------------- /lib/Ebizmarts/MailChimp/ListsActivity.php: -------------------------------------------------------------------------------- 1 | 8 | * @copyright Ebizmarts (http://ebizmarts.com) 9 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 10 | * @date: 5/2/16 3:44 PM 11 | * @file: ListsActivity.php 12 | */ 13 | class MailChimp_ListsActivity extends MailChimp_Abstract 14 | { 15 | /** 16 | * @param $listId The unique id for the list. 17 | * @param null $fields A comma-separated list of fields to return. Reference parameters of sub-objects 18 | * with dot notation. 19 | * @param null $excludeFields A comma-separated list of fields to exclude. Reference parameters of sub-objects 20 | * with dot notation. 21 | * @return mixed 22 | * @throws MailChimp_Error 23 | * @throws MailChimp_HttpError 24 | */ 25 | public function get($listId, $fields = null, $excludeFields = null) 26 | { 27 | $_params = array(); 28 | 29 | if ($fields) { 30 | $_params['fields'] = $fields; 31 | } 32 | 33 | if ($excludeFields) { 34 | $_params['exclude_fields'] = $excludeFields; 35 | } 36 | 37 | return $this->_master->call('lists/' . $listId . '/activity', $_params, Ebizmarts_MailChimp::GET); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /lib/Ebizmarts/MailChimp/ListsClients.php: -------------------------------------------------------------------------------- 1 | 8 | * @copyright Ebizmarts (http://ebizmarts.com) 9 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 10 | * @date: 5/2/16 3:45 PM 11 | * @file: ListsClients.php 12 | */ 13 | class MailChimp_ListsClients extends MailChimp_Abstract 14 | { 15 | /** 16 | * @param $listId The unique id for the list. 17 | * @param null $fields A comma-separated list of fields to return. Reference parameters of sub-objects 18 | * with dot notation. 19 | * @param null $excludeFields A comma-separated list of fields to exclude. Reference parameters of sub-objects 20 | * with dot notation. 21 | * @return mixed 22 | * @throws MailChimp_Error 23 | * @throws MailChimp_HttpError 24 | */ 25 | public function getTop($listId, $fields = null, $excludeFields = null) 26 | { 27 | $_params = array(); 28 | 29 | if ($fields) { 30 | $_params['fields'] = $fields; 31 | } 32 | 33 | if ($excludeFields) { 34 | $_params['exclude_fields'] = $excludeFields; 35 | } 36 | 37 | return $this->_master->call('lists/' . $listId . '/clients', $_params, Ebizmarts_MailChimp::GET); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /lib/Ebizmarts/MailChimp/ListsMembersActivity.php: -------------------------------------------------------------------------------- 1 | 8 | * @copyright Ebizmarts (http://ebizmarts.com) 9 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 10 | * @date: 5/2/16 4:31 PM 11 | * @file: ListsMembersActivity.php 12 | */ 13 | class MailChimp_ListsMembersActivity extends MailChimp_Abstract 14 | { 15 | /** 16 | * @param $listId The unique id for the list. 17 | * @param $subscriberHash The MD5 hash of the lowercase version of the list member’s email address. 18 | * @param $fields A comma-separated list of fields to return. Reference parameters of sub-objects 19 | * with dot notation. 20 | * @param $excludeFields A comma-separated list of fields to exclude. Reference parameters of sub-objects 21 | * with dot notation. 22 | * @return mixed 23 | * @throws MailChimp_Error 24 | * @throws MailChimp_HttpError 25 | */ 26 | public function get($listId, $subscriberHash, $fields, $excludeFields) 27 | { 28 | $_params = array(); 29 | 30 | if ($fields) { 31 | $_params['fields'] = $fields; 32 | } 33 | 34 | if ($excludeFields) { 35 | $_params['exclude_fields'] = $excludeFields; 36 | } 37 | 38 | $url = 'lists/' . $listId . '/members/' . $subscriberHash . '/activity'; 39 | 40 | return $this->_master->call($url, $_params, Ebizmarts_MailChimp::GET); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /lib/Ebizmarts/MailChimp/ListsMembersGoals.php: -------------------------------------------------------------------------------- 1 | 8 | * @copyright Ebizmarts (http://ebizmarts.com) 9 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 10 | * @date: 5/2/16 4:32 PM 11 | * @file: ListsMembersGoals.php 12 | */ 13 | class MailChimp_ListsMembersGoals extends MailChimp_Abstract 14 | { 15 | /** 16 | * @param $listId The unique id for the list. 17 | * @param $subscriberHash The MD5 hash of the lowercase version of the list member’s email address. 18 | * @param $fields A comma-separated list of fields to return. Reference parameters of sub-objects 19 | * with dot notation. 20 | * @param $excludeFields A comma-separated list of fields to exclude. Reference parameters of sub-objects 21 | * with dot notation. 22 | * @return mixed 23 | * @throws MailChimp_Error 24 | * @throws MailChimp_HttpError 25 | */ 26 | public function get($listId, $subscriberHash, $fields, $excludeFields) 27 | { 28 | $_params = array(); 29 | 30 | if ($fields) { 31 | $_params['fields'] = $fields; 32 | } 33 | 34 | if ($excludeFields) { 35 | $_params['exclude_fields'] = $excludeFields; 36 | } 37 | 38 | $url = 'lists/' . $listId . '/members/' . $subscriberHash . '/goals'; 39 | 40 | return $this->_master->call($url, $_params, Ebizmarts_MailChimp::GET); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /lib/Ebizmarts/MailChimp/Reports.php: -------------------------------------------------------------------------------- 1 | 8 | * @copyright Ebizmarts (http://ebizmarts.com) 9 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 10 | * @date: 5/2/16 4:48 PM 11 | * @file: Reports.php 12 | */ 13 | class MailChimp_Reports extends MailChimp_Abstract 14 | { 15 | /** 16 | * @var MailChimp_ReportsCampaignAdvice 17 | */ 18 | public $campaignAdvice; 19 | /** 20 | * @var MailChimp_ReportsClickReports 21 | */ 22 | public $clickReports; 23 | /** 24 | * @var MailChimp_ReportsDomainPerformance 25 | */ 26 | public $domainPerformance; 27 | /** 28 | * @var ReportsEapURLReport 29 | */ 30 | public $eapURLReport; 31 | /** 32 | * @var MailChimp_ReportsEmailActivity 33 | */ 34 | public $emailActivity; 35 | /** 36 | * @var ReportsLocation 37 | */ 38 | public $location; 39 | /** 40 | * @var MailChimp_ReportsSentTo 41 | */ 42 | public $sentTo; 43 | /** 44 | * @var MailChimp_ReportsSubReports 45 | */ 46 | public $subReports; 47 | /** 48 | * @var MailChimp_ReportsUnsubscribes 49 | */ 50 | public $unsubscribes; 51 | } 52 | -------------------------------------------------------------------------------- /lib/Ebizmarts/MailChimp/ReportsCampaignAdvice.php: -------------------------------------------------------------------------------- 1 | 8 | * @copyright Ebizmarts (http://ebizmarts.com) 9 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 10 | * @date: 5/2/16 4:51 PM 11 | * @file: ReportsCampaignAdvice.php 12 | */ 13 | class MailChimp_ReportsCampaignAdvice extends MailChimp_Abstract 14 | { 15 | /** 16 | * @var MailChimp_ReportsCampaignAdvice 17 | */ 18 | public $campaignAdvice; 19 | } 20 | -------------------------------------------------------------------------------- /lib/Ebizmarts/MailChimp/ReportsClickReports.php: -------------------------------------------------------------------------------- 1 | 8 | * @copyright Ebizmarts (http://ebizmarts.com) 9 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 10 | * @date: 5/2/16 5:01 PM 11 | * @file: ReportsClickReports.php 12 | */ 13 | class MailChimp_ReportsClickReports extends MailChimp_Abstract 14 | { 15 | /** 16 | * @var MailChimp_ReportsClickReportsMembers 17 | */ 18 | public $clickReportMembers; 19 | } 20 | -------------------------------------------------------------------------------- /lib/Ebizmarts/MailChimp/ReportsClickReportsMembers.php: -------------------------------------------------------------------------------- 1 | 8 | * @copyright Ebizmarts (http://ebizmarts.com) 9 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 10 | * @date: 5/2/16 5:17 PM 11 | * @file: ReportsClickReportsMembers.php 12 | */ 13 | class MailChimp_ReportsClickReportsMembers extends MailChimp_Abstract 14 | { 15 | /** 16 | * @var MailChimp_ReportsClickReportsMembers 17 | */ 18 | public $members; 19 | } 20 | -------------------------------------------------------------------------------- /lib/Ebizmarts/MailChimp/ReportsDomainPerformance.php: -------------------------------------------------------------------------------- 1 | 8 | * @copyright Ebizmarts (http://ebizmarts.com) 9 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 10 | * @date: 5/2/16 5:01 PM 11 | * @file: ReportsDomainPerformance.php 12 | */ 13 | class MailChimp_ReportsDomainPerformance extends MailChimp_Abstract 14 | { 15 | /** 16 | * @var MailChimp_ReportsDomainPerformance 17 | */ 18 | public $domainPerformance; 19 | } 20 | -------------------------------------------------------------------------------- /lib/Ebizmarts/MailChimp/ReportsEapURLReport.php: -------------------------------------------------------------------------------- 1 | 8 | * @copyright Ebizmarts (http://ebizmarts.com) 9 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 10 | * @date: 5/2/16 5:02 PM 11 | * @file: ReportsEapURLReport.php 12 | */ 13 | class MailChimp_ReportsEapURLReport extends MailChimp_Abstract 14 | { 15 | /** 16 | * @var MailChimp_ReportsEapURLReport 17 | */ 18 | public $report; 19 | } 20 | -------------------------------------------------------------------------------- /lib/Ebizmarts/MailChimp/ReportsEmailActivity.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright Ebizmarts (http://ebizmarts.com) 10 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 11 | * @date: 5/2/16 5:03 PM 12 | * @file: ReportsEmailActivity.php 13 | */ 14 | class MailChimp_ReportsEmailActivity extends MailChimp_Abstract 15 | { 16 | /** 17 | * @var MailChimp_ReportsEmailActivity 18 | */ 19 | public $emailActivity; 20 | } 21 | -------------------------------------------------------------------------------- /lib/Ebizmarts/MailChimp/ReportsLocation.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright Ebizmarts (http://ebizmarts.com) 10 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 11 | * @date: 5/2/16 5:04 PM 12 | * @file: ReportsLocation.php 13 | */ 14 | class MailChimp_ReportsLocation extends MailChimp_Abstract 15 | { 16 | /** 17 | * @var MailChimp_ReportsLocation 18 | */ 19 | public $location; 20 | } 21 | -------------------------------------------------------------------------------- /lib/Ebizmarts/MailChimp/ReportsSentTo.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright Ebizmarts (http://ebizmarts.com) 10 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 11 | * @date: 5/2/16 5:05 PM 12 | * @file: ReportsSentTo.php 13 | */ 14 | class MailChimp_ReportsSentTo extends MailChimp_Abstract 15 | { 16 | /** 17 | * @var MailChimp_ReportsSentTo 18 | */ 19 | public $sentTo; 20 | } 21 | -------------------------------------------------------------------------------- /lib/Ebizmarts/MailChimp/ReportsSubReports.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright Ebizmarts (http://ebizmarts.com) 10 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 11 | * @date: 5/2/16 5:06 PM 12 | * @file: ReportsSubReports.php 13 | */ 14 | class MailChimp_ReportsSubReports extends MailChimp_Abstract 15 | { 16 | /** 17 | * @var MailChimp_ReportsSubReports 18 | */ 19 | public $subReports; 20 | } 21 | -------------------------------------------------------------------------------- /lib/Ebizmarts/MailChimp/ReportsUnsubscribes.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright Ebizmarts (http://ebizmarts.com) 10 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 11 | * @date: 5/2/16 5:07 PM 12 | * @file: ReportsUnsubscribes.php 13 | */ 14 | class MailChimp_ReportsUnsubscribes extends MailChimp_Abstract 15 | { 16 | /** 17 | * @var MailChimp_ReportsUnsubscribes 18 | */ 19 | public $unsubscribes; 20 | } 21 | -------------------------------------------------------------------------------- /lib/Ebizmarts/MailChimp/Root.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright Ebizmarts (http://ebizmarts.com) 10 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 11 | * @date: 4/29/16 1:18 PM 12 | * @file: Root.php 13 | */ 14 | class MailChimp_Root extends MailChimp_Abstract 15 | { 16 | public function info($fields = null, $excludeFields = null) 17 | { 18 | $_params = array(); 19 | 20 | if ($fields) { 21 | $_params['fields'] = $fields; 22 | } 23 | 24 | if ($excludeFields) { 25 | $_params['exclude_fields'] = $excludeFields; 26 | } 27 | 28 | return $this->_master->call('', $_params, Ebizmarts_MailChimp::GET); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /lib/Ebizmarts/MailChimp/TemplateFolders.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright Ebizmarts (http://ebizmarts.com) 10 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 11 | * @date: 5/2/16 5:21 PM 12 | * @file: TemplateFolders.php 13 | */ 14 | class MailChimp_TemplateFolders extends MailChimp_Abstract 15 | { 16 | /** 17 | * @var MailChimp_TemplateFolders 18 | */ 19 | public $folders; 20 | } 21 | -------------------------------------------------------------------------------- /lib/Ebizmarts/MailChimp/Templates.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright Ebizmarts (http://ebizmarts.com) 10 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 11 | * @date: 5/2/16 5:23 PM 12 | * @file: Templates.php 13 | */ 14 | class MailChimp_Templates extends MailChimp_Abstract 15 | { 16 | /** 17 | * @var MailChimp_TemplatesDefaultContent 18 | */ 19 | public $defaultContent; 20 | } 21 | -------------------------------------------------------------------------------- /lib/Ebizmarts/MailChimp/TemplatesDefaultContent.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright Ebizmarts (http://ebizmarts.com) 10 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 11 | * @date: 5/2/16 5:24 PM 12 | * @file: TemplatesDefaultContent.php 13 | */ 14 | class MailChimp_TemplatesDefaultContent extends MailChimp_Abstract 15 | { 16 | /** 17 | * @var MailChimp_TemplatesDefaultContent 18 | */ 19 | public $defaultContent; 20 | } 21 | -------------------------------------------------------------------------------- /lib/Mandrill/Mandrill/Internal.php: -------------------------------------------------------------------------------- 1 | master = $master; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /lib/Mandrill/Mandrill/Whitelists.php: -------------------------------------------------------------------------------- 1 | master = $master; 8 | } 9 | 10 | /** 11 | * Adds an email to your email rejection whitelist. If the address is 12 | * currently on your blacklist, that blacklist entry will be removed 13 | * automatically. 14 | * 15 | * @param string $email an email address to add to the whitelist 16 | * @param string $comment an optional description of why the email was whitelisted 17 | * @return struct a status object containing the address and the result of the operation 18 | * - email string the email address you provided 19 | * - added boolean whether the operation succeeded 20 | */ 21 | public function add($email, $comment = null) 22 | { 23 | $_params = array("email" => $email, "comment" => $comment); 24 | return $this->master->call('whitelists/add', $_params); 25 | } 26 | 27 | /** 28 | * Retrieves your email rejection whitelist. You can provide an email 29 | * address or search prefix to limit the results. Returns up to 1000 results. 30 | * 31 | * @param string $email an optional email address or prefix to search by 32 | * @return array up to 1000 whitelist entries 33 | * - return[] struct the information for each whitelist entry 34 | * - email string the email that is whitelisted 35 | * - detail string a description of why the email was whitelisted 36 | * - created_at string when the email was added to the whitelist 37 | */ 38 | public function getList($email = null) 39 | { 40 | $_params = array("email" => $email); 41 | return $this->master->call('whitelists/list', $_params); 42 | } 43 | 44 | /** 45 | * Removes an email address from the whitelist. 46 | * 47 | * @param string $email the email address to remove from the whitelist 48 | * @return struct a status object containing the address and whether the deletion succeeded 49 | * - email string the email address that was removed from the blacklist 50 | * - deleted boolean whether the address was deleted successfully 51 | */ 52 | public function delete($email) 53 | { 54 | $_params = array("email" => $email); 55 | return $this->master->call('whitelists/delete', $_params); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /modman: -------------------------------------------------------------------------------- 1 | app/code/community/Ebizmarts/MailChimp app/code/community/Ebizmarts/MailChimp 2 | app/design/adminhtml/default/default/layout/ebizmarts/mailchimp.xml app/design/adminhtml/default/default/layout/ebizmarts/mailchimp.xml 3 | app/design/adminhtml/default/default/template/ebizmarts/mandrill app/design/adminhtml/default/default/template/ebizmarts/mandrill 4 | app/design/adminhtml/default/default/template/ebizmarts/mailchimp app/design/adminhtml/default/default/template/ebizmarts/mailchimp 5 | app/design/frontend/base/default/layout/ebizmarts/mailchimp.xml app/design/frontend/base/default/layout/ebizmarts/mailchimp.xml 6 | app/design/frontend/base/default/template/ebizmarts/mailchimp app/design/frontend/base/default/template/ebizmarts/mailchimp 7 | app/etc/modules/Ebizmarts_MailChimp.xml app/etc/modules/Ebizmarts_MailChimp.xml 8 | app/locale/en_US/Ebizmarts_MailChimp.csv app/locale/en_US/Ebizmarts_MailChimp.csv 9 | dev/tests/mailchimp/ dev/tests/mailchimp/ 10 | js/ebizmarts/mailchimp js/ebizmarts/mailchimp 11 | lib/Ebizmarts/MailChimp.php lib/Ebizmarts/MailChimp.php 12 | lib/Ebizmarts/MailChimp lib/Ebizmarts/MailChimp 13 | lib/Mandrill lib/Mandrill 14 | skin/adminhtml/default/default/ebizmarts/mailchimp skin/adminhtml/default/default/ebizmarts/mailchimp 15 | skin/adminhtml/default/default/ebizmarts/mandrill skin/adminhtml/default/default/ebizmarts/mandrill 16 | shell/m4mlogs.sh shell/m4mlogs.sh 17 | shell/getMailchimpResponse.php shell/getMailchimpResponse.php 18 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mc-magento", 3 | "devDependencies": { 4 | "editorconfig-tools": "^0.1.1" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /shell/getMailchimpResponse.php: -------------------------------------------------------------------------------- 1 | "https://$dc.api.mailchimp.com/3.0/batches/$batchId", 27 | CURLOPT_RETURNTRANSFER => true, 28 | CURLOPT_ENCODING => "", 29 | CURLOPT_MAXREDIRS => 10, 30 | CURLOPT_TIMEOUT => 30, 31 | CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, 32 | CURLOPT_CUSTOMREQUEST => "GET", 33 | CURLOPT_POSTFIELDS => "", 34 | CURLOPT_USERPWD => "noname:$apiKey", 35 | CURLOPT_HTTPHEADER => array( 36 | "accept: application/json", 37 | "cache-control: no-cache", 38 | "content-type: application/json" 39 | ), 40 | ) 41 | ); 42 | 43 | $response = curl_exec($curl); 44 | $err = curl_error($curl); 45 | 46 | curl_close($curl); 47 | 48 | if ($err) { 49 | printf("cURL Error #:" . $err); 50 | } else { 51 | $jsonResponse = json_decode($response, true); 52 | 53 | if ($jsonResponse['status'] == 'finished') { 54 | $fileUrl = $jsonResponse['response_body_url']; 55 | // check if the file is not expired 56 | parse_str($fileUrl, $fileParams); 57 | 58 | try { 59 | $fd = fopen("$batchId.response.tar.gz", 'w'); 60 | $ch = curl_init(); 61 | curl_setopt($ch, CURLOPT_URL, $fileUrl); 62 | curl_setopt($ch, CURLOPT_FILE, $fd); 63 | curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); // this will follow redirects 64 | $r = curl_exec($ch); 65 | curl_close($ch); 66 | fclose($fd); 67 | printf("$batchId.response.tar.gz\n"); 68 | } catch (Exception $e) { 69 | printf($e->getMessage()); 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /shell/m4mlogs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | case "$#" in 3 | 2) 4 | apikey="$1" 5 | op="$2" 6 | ;; 7 | 3) 8 | apikey="$1" 9 | op="$2" 10 | id="$3" 11 | ;; 12 | *) 13 | echo $"Usage: $0 apikey option [id]" 14 | exit 1 15 | esac 16 | batches=$(grep -l $2_.*$id ../var/log/*.Request.log | cut -d'/' -f3 $a | cut -d'.' -f1) 17 | allresponses="" 18 | allrequests="" 19 | for a in ${batches}; 20 | do 21 | echo $"Downloading response for batch $a" 22 | allresponses="$allresponses $(php getMailchimpResponse.php $apikey $a)" 23 | allrequests="$allrequests ../var/log/$a.Request.log" 24 | done; 25 | resp=$(tar cvzf responses.tgz $allresponses) 26 | req=$(tar cvzf requests.tgz $allrequests) 27 | resp=$(rm -f $allresponses) 28 | -------------------------------------------------------------------------------- /skin/adminhtml/default/default/ebizmarts/mailchimp/images/logo-freddie-monocolor-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailchimp/mc-magento/e6c26e56cd69d2ca48588068706eed6a2409313b/skin/adminhtml/default/default/ebizmarts/mailchimp/images/logo-freddie-monocolor-200.png -------------------------------------------------------------------------------- /skin/adminhtml/default/default/ebizmarts/mailchimp/images/mailchimp-ico.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailchimp/mc-magento/e6c26e56cd69d2ca48588068706eed6a2409313b/skin/adminhtml/default/default/ebizmarts/mailchimp/images/mailchimp-ico.png -------------------------------------------------------------------------------- /skin/adminhtml/default/default/ebizmarts/mailchimp/images/mailchimp-tab.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailchimp/mc-magento/e6c26e56cd69d2ca48588068706eed6a2409313b/skin/adminhtml/default/default/ebizmarts/mailchimp/images/mailchimp-tab.png -------------------------------------------------------------------------------- /skin/adminhtml/default/default/ebizmarts/mandrill/css/mandrill.css: -------------------------------------------------------------------------------- 1 | ul.tabs a.mandrill-section:hover { 2 | background-color: #D8E6E6; 3 | background-image: url(../../../images/tabs_link_over_bg.gif); 4 | } 5 | 6 | ul.tabs a.mandrill-section { 7 | border-bottom: 1px; 8 | border-bottom-style: dotted; 9 | } 10 | 11 | ul.tabs a.mandrill-section:hover { 12 | border-bottom: 1px; 13 | border-bottom-style: dotted; 14 | } 15 | 16 | ul.tabs a.mandrill-section span, 17 | ul.tabs a.mandrill-section:hover span { 18 | background: url(../images/mandrill-tab.png) no-repeat 17px 3px; 19 | overflow: hidden; 20 | padding: 0; 21 | padding-left: 43px; 22 | width: 120px; 23 | height: 24px; 24 | line-height: 24px; 25 | } 26 | 27 | ul.tabs a.mandrill-section.active, ul.tabs a.mandrill-section.active:hover { 28 | background-color: white; 29 | border-bottom-color: #8BA5A5; 30 | } 31 | 32 | small { 33 | font-size: 9px; 34 | } 35 | 36 | div.mandrill-notice { 37 | background: none repeat scroll 0 0 #EAF0EE; 38 | border: 1px solid #CCCCCC; 39 | margin-bottom: 10px; 40 | padding: 11px 0 0 10px; 41 | } 42 | 43 | h3.mandrill-header { 44 | background: url("../images/mandrill-tab.png") no-repeat scroll 0 0 transparent; 45 | height: 22px; 46 | overflow: hidden; 47 | padding: 0; 48 | text-indent: -9999px; 49 | width: 120px; 50 | } 51 | -------------------------------------------------------------------------------- /skin/adminhtml/default/default/ebizmarts/mandrill/images/mandrill-tab.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailchimp/mc-magento/e6c26e56cd69d2ca48588068706eed6a2409313b/skin/adminhtml/default/default/ebizmarts/mandrill/images/mandrill-tab.png --------------------------------------------------------------------------------