Version Notes
-- version 1.1.16 stable
- fix for abandoned cart when a logged customer abandon an order and make this order as guess
- introduce autologin feature for abandoned carts
-- version 1.1.15 stable
- fix for abandoned cart cron configuration
-- version 1.1.14 stable
- Add grid for sent email (autoresponder and abandoned carts)
- Minor fix for mandrill tags
-- version 1.1.13 stable
- Fix for mandrill tags
- Fix for autoresponders admin configuration
-- version 1.1.12 stable
- Fix for autoresponders
-- version 1.1.11 stable
- fix for abandoned carts
-- fix for multistore templates
- first release of autoresponders
-- version 1.1.10 stable
- fix for abandondedcart dashboard
-- version 1.1.9 stable
- Fix for mandrill tags
-- version 1.1.8 stable
- Fix render group errors when user it's guest
- Improve merge var to get address fields
- Fix Bulk Sync import functionality when we create new customers in case doesn't exist
- Fix dashboard in abandoned cart
- Fix database definition in abandoned cart
- Add logs in abandoned cart settings
- Fix for tags in abandoned carts mandrill
- Add subject email to the admin in abandoned cart
-- version 1.17 stable
- Add customer groups to abandoned cart
- Fix abandoned cart orders grid
- Fix for unsuscribe
-- version 1.1.6 stable
- Improve Abandoned Cart template (add tax, skus in configurable/bundle products)
- Add option to send abandoned cart emails By Days/Hours
- Add new Ecommerce360 option to send orders to MailChimp (By Cron depending on the Orders Status)
- Fix Wrong Store Name display error on BulkSync exports
- Posibility to Delete Ecommerce360 Orders in Magento (Not in MailChimp)
- Improve data Sync between Magento -> MailChimp (add telephone and company) Send Billing and Shipping address on Exports
- Show interest groups on Checkout in case has enable the subscribe on checkout
- Add createAtachment and addTo in the Emails functionality
-- version 1.1.5 stable
- Fix for abandoned cart, enable to put a specific coupon created on magento
-- version 1.1.4 stable
- Fix for abandoned cart multi store management
- Fix for abandoned cart not send email for a quote who has an order posterior from the same customer
-- version 1.1.3 stable
- Support for mandrill attachments
-- version 1.1.2 stable
- Fix for abandoned cart, coupon qty > 1 for the same product
- Fix for abandoned cart, customer name in email
- Fix for abandoned cart, cart content in email
- Fix for database with prefix
-- version 1.1.1 stable
- Adding configuration field to Start Date for abandoned carts
- Add abandonedflag to sales_flat_order
- Change for magento 1.4.2 and 1.5.*
-- version 1.1.0 stable
- Adding abandoned order manager (beta)
-- version 1.0.22 stable
- Adding Oauth2 support to connect MageMonkey with MailChimp
- Fallback on setReplyTo in Mandrill when transactional email is not enabled
- addBcc Fix on Mandrill
-- version 1.0.21 stable
- Fix duplicated confirmation email notifications
- Add success message when customer register from the "My Account" section
- Add mass action option to Sales -> Order grid in admin panel to send orders to MC
- Fix Mandrill_API::addTo() and Mandrill_API::replyTo() issues in the Mandrill module
- Add version information in the configuration for the Mandrill module
-- version 1.0.19 stable
- Fix automatic unsubscribe issue when users create orders from backend
- Adding BCC support for Mandrill Emails
- Remove enconding from subject for Mandrill Emails
- Add tags in emails sent from Mandrill
-- version 1.0.18 stable
Independence between MageMonkey and Mandrill modules
-- version 1.0.17 stable
-Fix "unsubscribe" when place an order
-- version 1.0.16 stable
- Fix progress bar on export function
- Add option in admin for limit of customers per round for export and import and delete customers in Magento when are removed in MailChimp
- Fix unsubscribe on edit customer from the admin panel
- Add version in the config
- Fix "Fatal error: Cannot use string offset as an array"
-- version 1.0.15 stable
- fix rendering of additional lists html elements
- Fix force subscription on checkout when use a payment method wich redirects to a payment page like PayPal Express Checkout.
-- version 1.0.14 stable
Fix Export functionality, only customers with status "subscribed" are exported now.
Increase the limit of customers for exports from 200 to 1000 per hour
Fix bug in unsubscribe customers.
Send email confirmation in double opt-in is not used.
Improve the save configuration proccess, add warnings, remove blank messages, improve the auto save webhooks in MailChimp.
Fix force subscription on checkout when use a payment method wich redirects to a payment page like PayPal Express Checkout.
Add new help links in the configuration ("What's MailChimp my IP Key?" and "How to segment your list based on your customers purchase activity").
Don't display additional lists newsletter block on checkout when there are no additional lists selected
-- version 1.0.13 stable
Fixing bug on admin urls when store code is used, more bugs fixed.
-- version 1.0.12 stable
Fixing bug on renderer for old magentos
-- version 1.0.11 stable
Adding export jobs per store id
-- version 1.0.10 stable
Fixing Ebizmarts_MageMonkey_Block_Adminhtml_Renderer_Lists bug
Fixing bug on MyAccount when subscribing, unsubscribing
Fix for bug on account creation, automatically subscribing
Ecommerce360 total with discount
Fixing but on order saving issue when customer is subscribed on MailChimp
Fixing error on cart page when compilation is ON
-- version 1.0.9 stable
Bug fix on webhooks url when Rewrites are not enabled
-- version 1.0.8 stable
Bug fix on checkout subscribe issues and EE customer credit balance issue fix (Customer is not set or does not exist.)
-- version 1.0.7 stable
Bug fix on TinyMCE inserting image, workaround for Magento passing a store parameter with undefined value.
-- version 1.0.6 stable
Fix bug when on hardcoded default store code. Additional Lists.
-- version 1.0.4 stable
Fix bug when checking newsletter box when registering. Adding customer groups as Interest Grouping
-- version 1.0.2 beta
Fixing bug on bulk export for customers, gets stuck on 200
-- version 1.0.1 beta
Bug fixing when deleting a subscriber
-- version 1.0.0 beta
Including STS
First public release 0.0.9, January 2012
Release Info
| Developer | Magento Core Team |
| Extension | Ebizmarts_MageMonkey |
| Version | 1.1.16 |
| Comparing to | |
| See all releases | |
Version 1.1.16
- app/code/community/Ebizmarts/AbandonedCart/Block/Adminhtml/Abandonedmails.php +24 -0
- app/code/community/Ebizmarts/AbandonedCart/Block/Adminhtml/Abandonedmails/Grid.php +97 -0
- app/code/community/Ebizmarts/AbandonedCart/Block/Adminhtml/Abandonedorder.php +23 -0
- app/code/community/Ebizmarts/AbandonedCart/Block/Adminhtml/Abandonedorder/Grid.php +148 -0
- app/code/community/Ebizmarts/AbandonedCart/Block/Adminhtml/Dashboard.php +38 -0
- app/code/community/Ebizmarts/AbandonedCart/Block/Adminhtml/Dashboard/Sales.php +54 -0
- app/code/community/Ebizmarts/AbandonedCart/Block/Adminhtml/Dashboard/Totals.php +197 -0
- app/code/community/Ebizmarts/AbandonedCart/Block/Adminhtml/System/Config/Date.php +16 -0
- app/code/community/Ebizmarts/AbandonedCart/Block/Adminhtml/System/Config/Fieldset/Hint.php +52 -0
- app/code/community/Ebizmarts/AbandonedCart/Block/Email/Order/Items.php +22 -0
- app/code/community/Ebizmarts/AbandonedCart/Helper/Data.php +64 -0
- app/code/community/Ebizmarts/AbandonedCart/Model/Config.php +35 -0
- app/code/community/Ebizmarts/AbandonedCart/Model/Cron.php +253 -0
- app/code/community/Ebizmarts/AbandonedCart/Model/Mailssent.php +15 -0
- app/code/community/Ebizmarts/AbandonedCart/Model/Resource/Mailssent.php +16 -0
- app/code/community/Ebizmarts/AbandonedCart/Model/Resource/Mailssent/Collection.php +16 -0
- app/code/community/Ebizmarts/AbandonedCart/Model/Resource/Order/Collection.php +193 -0
- app/code/community/Ebizmarts/AbandonedCart/Model/System/Config/Automatic.php +21 -0
- app/code/community/Ebizmarts/AbandonedCart/Model/System/Config/Customergroup.php +21 -0
- app/code/community/Ebizmarts/AbandonedCart/Model/System/Config/Discounttype.php +22 -0
- app/code/community/Ebizmarts/AbandonedCart/Model/System/Config/Unit.php +19 -0
- app/code/community/Ebizmarts/AbandonedCart/controllers/AbandonedController.php +47 -0
- app/code/community/Ebizmarts/AbandonedCart/controllers/Adminhtml/AbandonedmailsController.php +68 -0
- app/code/community/Ebizmarts/AbandonedCart/controllers/Adminhtml/AbandonedorderController.php +94 -0
- app/code/community/Ebizmarts/AbandonedCart/etc/adminhtml.xml +70 -0
- app/code/community/Ebizmarts/AbandonedCart/etc/config.xml +132 -0
- app/code/community/Ebizmarts/AbandonedCart/etc/system.xml +314 -0
- app/code/community/Ebizmarts/AbandonedCart/sql/ebizmarts_abandonedcart_setup/mysql4-install-0.1.0.php +9 -0
- app/code/community/Ebizmarts/AbandonedCart/sql/ebizmarts_abandonedcart_setup/mysql4-upgrade-0.1.12-0.1.13.php +21 -0
- app/code/community/Ebizmarts/AbandonedCart/sql/ebizmarts_abandonedcart_setup/mysql4-upgrade-0.1.18-0.1.19.php +28 -0
- app/code/community/Ebizmarts/AbandonedCart/sql/ebizmarts_abandonedcart_setup/mysql4-upgrade-0.1.2-0.1.3.php +16 -0
- app/code/community/Ebizmarts/AbandonedCart/sql/ebizmarts_abandonedcart_setup/mysql4-upgrade-0.1.6-0.1.7.php +17 -0
- app/code/community/Ebizmarts/Autoresponder/Block/Adminhtml/System/Config/Birthday/Fieldset/Hint.php +25 -0
- app/code/community/Ebizmarts/Autoresponder/Block/Adminhtml/System/Config/Fieldset/Hint.php +52 -0
- app/code/community/Ebizmarts/Autoresponder/Block/Adminhtml/System/Config/Review/Fieldset/Hint.php +25 -0
- app/code/community/Ebizmarts/Autoresponder/Block/Adminhtml/System/Config/Wishlist/Fieldset/Hint.php +25 -0
- app/code/community/Ebizmarts/Autoresponder/Block/Customer/Account/List.php +20 -0
- app/code/community/Ebizmarts/Autoresponder/Block/Email/Related/Items.php +15 -0
- app/code/community/Ebizmarts/Autoresponder/Block/Email/Review/Items.php +15 -0
- app/code/community/Ebizmarts/Autoresponder/Block/Email/Wishlist/Items.php +15 -0
- app/code/community/Ebizmarts/Autoresponder/Block/Unsubscribe.php +15 -0
- app/code/community/Ebizmarts/Autoresponder/Helper/Data.php +41 -0
- app/code/community/Ebizmarts/Autoresponder/Model/Config.php +70 -0
- app/code/community/Ebizmarts/Autoresponder/Model/Cron.php +412 -0
- app/code/community/Ebizmarts/Autoresponder/Model/EventObserver.php +44 -0
- app/code/community/Ebizmarts/Autoresponder/Model/Resource/Unsubscribe.php +16 -0
- app/code/community/Ebizmarts/Autoresponder/Model/Resource/Unsubscribe/Collection.php +15 -0
- app/code/community/Ebizmarts/Autoresponder/Model/System/Config/Automatic.php +22 -0
- app/code/community/Ebizmarts/Autoresponder/Model/System/Config/Customergroup.php +21 -0
- app/code/community/Ebizmarts/Autoresponder/Model/System/Config/Discounttype.php +22 -0
- app/code/community/Ebizmarts/Autoresponder/Model/Unsubscribe.php +14 -0
- app/code/community/Ebizmarts/Autoresponder/controllers/AutoresponderController.php +81 -0
- app/code/community/Ebizmarts/Autoresponder/etc/adminhtml.xml +31 -0
- app/code/community/Ebizmarts/Autoresponder/etc/config.xml +201 -0
- app/code/community/Ebizmarts/Autoresponder/etc/system.xml +710 -0
- app/code/community/Ebizmarts/Autoresponder/sql/ebizmarts_autoresponder_setup/mysql4-install-0.1.0.php +27 -0
- app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Bulksync/Export.php +29 -0
- app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Bulksync/Export/Form.php +71 -0
- app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Bulksync/Import.php +29 -0
- app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Bulksync/Import/Form.php +85 -0
- app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Bulksync/Queue.php +30 -0
- app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Bulksync/Queue/Grid.php +67 -0
- app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Bulksync/QueueExport.php +45 -0
- app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Bulksync/QueueExport/Grid.php +140 -0
- app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Bulksync/QueueImport.php +45 -0
- app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Bulksync/QueueImport/Grid.php +144 -0
- app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Customer/Edit/Tab/Memberactivity.php +81 -0
- app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Ecommerce.php +37 -0
- app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Ecommerce/Grid.php +92 -0
- app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Ecommerceapi.php +37 -0
- app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Ecommerceapi/Grid.php +91 -0
- app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Ecommerceapi/Renderer/Items.php +25 -0
- app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Memberactivity/Grid.php +96 -0
- app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Renderer/Date.php +24 -0
- app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Renderer/Importypes.php +24 -0
- app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Renderer/Lists.php +35 -0
- app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Renderer/Progress.php +21 -0
- app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Renderer/Yesno.php +24 -0
- app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/System/Config/Account.php +27 -0
- app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/System/Config/Fieldset/Hint.php +45 -0
- app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/System/Config/Form/Field/Mapfields.php +28 -0
- app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/System/Config/OauthWizard.php +59 -0
- app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Transactionalemail/Mandrill.php +32 -0
- app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Transactionalemail/Mandrill/Grid.php +102 -0
- app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Transactionalemail/Newemail.php +29 -0
- app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Transactionalemail/Newemail/Form.php +54 -0
- app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Transactionalemail/Sts.php +32 -0
- app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Transactionalemail/Sts/Grid.php +86 -0
- app/code/community/Ebizmarts/MageMonkey/Block/Checkout/Subscribe.php +61 -0
- app/code/community/Ebizmarts/MageMonkey/Block/Customer/Account/Lists.php +13 -0
- app/code/community/Ebizmarts/MageMonkey/Block/Lists.php +367 -0
- app/code/community/Ebizmarts/MageMonkey/Block/Signup.php +13 -0
- app/code/community/Ebizmarts/MageMonkey/Helper/Cache.php +114 -0
- app/code/community/Ebizmarts/MageMonkey/Helper/Data.php +854 -0
- app/code/community/Ebizmarts/MageMonkey/Helper/Export.php +63 -0
- app/code/community/Ebizmarts/MageMonkey/Helper/Oauth2.php +24 -0
- app/code/community/Ebizmarts/MageMonkey/Model/Api.php +176 -0
- app/code/community/Ebizmarts/MageMonkey/Model/Apidebug.php +23 -0
- app/code/community/Ebizmarts/MageMonkey/Model/BulksyncExport.php +33 -0
- app/code/community/Ebizmarts/MageMonkey/Model/BulksyncImport.php +43 -0
- app/code/community/Ebizmarts/MageMonkey/Model/Cache.php +140 -0
- app/code/community/Ebizmarts/MageMonkey/Model/Cron.php +423 -0
- app/code/community/Ebizmarts/MageMonkey/Model/Custom/Collection.php +64 -0
- app/code/community/Ebizmarts/MageMonkey/Model/Ecommerce.php +22 -0
- app/code/community/Ebizmarts/MageMonkey/Model/Ecommerce360.php +316 -0
- app/code/community/Ebizmarts/MageMonkey/Model/Email/Template.php +87 -0
- app/code/community/Ebizmarts/MageMonkey/Model/Feed/Updates.php +127 -0
- app/code/community/Ebizmarts/MageMonkey/Model/MCAPI.php +2499 -0
- app/code/community/Ebizmarts/MageMonkey/Model/MCEXPORTAPI.php +129 -0
- app/code/community/Ebizmarts/MageMonkey/Model/Monkey.php +227 -0
- app/code/community/Ebizmarts/MageMonkey/Model/Mysql4/Apidebug.php +22 -0
- app/code/community/Ebizmarts/MageMonkey/Model/Mysql4/Apidebug/Collection.php +23 -0
- app/code/community/Ebizmarts/MageMonkey/Model/Mysql4/Bulksync/Export.php +37 -0
- app/code/community/Ebizmarts/MageMonkey/Model/Mysql4/Bulksync/Export/Collection.php +37 -0
- app/code/community/Ebizmarts/MageMonkey/Model/Mysql4/Bulksync/Import.php +37 -0
- app/code/community/Ebizmarts/MageMonkey/Model/Mysql4/Bulksync/Import/Collection.php +37 -0
- app/code/community/Ebizmarts/MageMonkey/Model/Mysql4/Ecommerce.php +22 -0
- app/code/community/Ebizmarts/MageMonkey/Model/Mysql4/Ecommerce/Collection.php +23 -0
- app/code/community/Ebizmarts/MageMonkey/Model/Observer.php +500 -0
- app/code/community/Ebizmarts/MageMonkey/Model/System/Config/Source/Account.php +52 -0
- app/code/community/Ebizmarts/MageMonkey/Model/System/Config/Source/BulksyncDatasource.php +26 -0
- app/code/community/Ebizmarts/MageMonkey/Model/System/Config/Source/BulksyncStatus.php +46 -0
- app/code/community/Ebizmarts/MageMonkey/Model/System/Config/Source/Checkoutsubscribe.php +27 -0
- app/code/community/Ebizmarts/MageMonkey/Model/System/Config/Source/CronProcessLimit.php +30 -0
- app/code/community/Ebizmarts/MageMonkey/Model/System/Config/Source/Ecommerce360.php +26 -0
- app/code/community/Ebizmarts/MageMonkey/Model/System/Config/Source/List.php +56 -0
- app/code/community/Ebizmarts/MageMonkey/Model/System/Config/Source/OrderStatus.php +27 -0
- app/code/community/Ebizmarts/MageMonkey/Model/System/Config/Source/Status.php +28 -0
- app/code/community/Ebizmarts/MageMonkey/Model/System/Config/Source/TransactionalEmails.php +27 -0
- app/code/community/Ebizmarts/MageMonkey/Model/System/Config/Source/WebhookDelete.php +25 -0
- app/code/community/Ebizmarts/MageMonkey/Model/TransactionalEmail/Adapter.php +29 -0
- app/code/community/Ebizmarts/MageMonkey/Model/TransactionalEmail/MANDRILL.php +354 -0
- app/code/community/Ebizmarts/MageMonkey/Model/TransactionalEmail/STS.php +242 -0
- app/code/community/Ebizmarts/MageMonkey/controllers/Adminhtml/BulksyncController.php +207 -0
- app/code/community/Ebizmarts/MageMonkey/controllers/Adminhtml/EcommerceController.php +110 -0
- app/code/community/Ebizmarts/MageMonkey/controllers/Adminhtml/TransactionalemailController.php +133 -0
- app/code/community/Ebizmarts/MageMonkey/controllers/Customer/AccountController.php +53 -0
- app/code/community/Ebizmarts/MageMonkey/controllers/SignupController.php +45 -0
- app/code/community/Ebizmarts/MageMonkey/controllers/WebhookController.php +47 -0
- app/code/community/Ebizmarts/MageMonkey/etc/adminhtml.xml +66 -0
- app/code/community/Ebizmarts/MageMonkey/etc/config.xml +253 -0
- app/code/community/Ebizmarts/MageMonkey/etc/system.xml +222 -0
- app/code/community/Ebizmarts/MageMonkey/sql/monkey_setup/mysql4-install-0.0.1.php +20 -0
- app/code/community/Ebizmarts/MageMonkey/sql/monkey_setup/mysql4-upgrade-0.0.1-0.0.2.php +22 -0
- app/code/community/Ebizmarts/MageMonkey/sql/monkey_setup/mysql4-upgrade-0.0.2-0.0.3.php +24 -0
- app/code/community/Ebizmarts/MageMonkey/sql/monkey_setup/mysql4-upgrade-0.0.3-0.0.4.php +25 -0
- app/code/community/Ebizmarts/MageMonkey/sql/monkey_setup/mysql4-upgrade-0.0.4-0.0.5.php +7 -0
- app/code/community/Ebizmarts/MageMonkey/sql/monkey_setup/mysql4-upgrade-0.0.5-0.0.6.php +10 -0
- app/code/community/Ebizmarts/MageMonkey/sql/monkey_setup/mysql4-upgrade-0.0.6-0.0.7.php +10 -0
- app/code/community/Ebizmarts/MageMonkey/sql/monkey_setup/mysql4-upgrade-1.0.10-1.0.11.php +7 -0
- app/code/community/Ebizmarts/MageMonkey/sql/monkey_setup/mysql4-upgrade-1.1.5-1.1.6.php +7 -0
- app/code/community/Ebizmarts/Mandrill/Block/Adminhtml/System/Config/Fieldset/Hint.php +39 -0
- app/code/community/Ebizmarts/Mandrill/Block/Adminhtml/System/Config/Userinfo.php +27 -0
- app/code/community/Ebizmarts/Mandrill/Block/Adminhtml/Users/Senders.php +35 -0
- app/code/community/Ebizmarts/Mandrill/Block/Adminhtml/Users/Senders/Grid.php +131 -0
- app/code/community/Ebizmarts/Mandrill/Helper/Data.php +65 -0
- app/code/community/Ebizmarts/Mandrill/Model/Customcollection.php +61 -0
- app/code/community/Ebizmarts/Mandrill/Model/Email/Template.php +175 -0
- app/code/community/Ebizmarts/Mandrill/Model/System/Config/Source/Userinfo.php +62 -0
- app/code/community/Ebizmarts/Mandrill/controllers/Adminhtml/Mandrill/UsersController.php +34 -0
- app/code/community/Ebizmarts/Mandrill/etc/adminhtml.xml +41 -0
- app/code/community/Ebizmarts/Mandrill/etc/config.xml +87 -0
- app/code/community/Ebizmarts/Mandrill/etc/system.xml +63 -0
- app/design/adminhtml/default/default/layout/ebizmarts/abandonedcart.xml +33 -0
- app/design/adminhtml/default/default/layout/magemonkey.xml +92 -0
- app/design/adminhtml/default/default/layout/mandrill.xml +18 -0
- app/design/adminhtml/default/default/template/ebizmarts/abandonedcart/dashboard/index.phtml +72 -0
- app/design/adminhtml/default/default/template/ebizmarts/abandonedcart/dashboard/salebar.phtml +10 -0
- app/design/adminhtml/default/default/template/ebizmarts/abandonedcart/dashboard/totalbar.phtml +46 -0
- app/design/adminhtml/default/default/template/ebizmarts/abandonedcart/system/config/fieldset/hint.phtml +6 -0
- app/design/adminhtml/default/default/template/ebizmarts/autoresponder/system/config/birthday/fieldset/hint.phtml +5 -0
- app/design/adminhtml/default/default/template/ebizmarts/autoresponder/system/config/fieldset/hint.phtml +12 -0
- app/design/adminhtml/default/default/template/ebizmarts/autoresponder/system/config/review/fieldset/hint.phtml +5 -0
- app/design/adminhtml/default/default/template/ebizmarts/autoresponder/system/config/wishlist/fieldset/hint.phtml +5 -0
- app/design/adminhtml/default/default/template/magemonkey/system/config/fieldset/hint.phtml +13 -0
- app/design/adminhtml/default/default/template/magemonkey/system/config/oauth_wizard.phtml +14 -0
- app/design/adminhtml/default/default/template/mandrill/system/config/fieldset/hint.phtml +8 -0
- app/design/frontend/base/default/layout/ebizmarts/abandonedcart.xml +11 -0
- app/design/frontend/base/default/layout/ebizmarts/autoresponder.xml +30 -0
- app/design/frontend/base/default/layout/magemonkey.xml +50 -0
- app/design/frontend/base/default/template/ebizmarts/autoresponder/customer/list.phtml +24 -0
- app/design/frontend/base/default/template/ebizmarts/autoresponder/related/items.phtml +9 -0
- app/design/frontend/base/default/template/ebizmarts/autoresponder/review/items.phtml +9 -0
- app/design/frontend/base/default/template/ebizmarts/autoresponder/unsubscribe.phtml +8 -0
- app/design/frontend/base/default/template/ebizmarts/autoresponder/wishlist/items.phtml +9 -0
- app/design/frontend/base/default/template/ebizmarts_abandonedcart/email/order/items.phtml +69 -0
- app/design/frontend/base/default/template/ebizmarts_abandonedcart/email/order/items/order/default.phtml +111 -0
- app/design/frontend/base/default/template/magemonkey/checkout/subscribe.phtml +176 -0
- app/design/frontend/base/default/template/magemonkey/customer/account/lists.phtml +96 -0
- app/design/frontend/base/default/template/magemonkey/lists.phtml +121 -0
- app/etc/modules/Ebizmarts_AbandonedCart.xml +9 -0
- app/etc/modules/Ebizmarts_Autoresponder.xml +9 -0
- app/etc/modules/Ebizmarts_MageMonkey.xml +12 -0
- app/etc/modules/Ebizmarts_Mandrill.xml +12 -0
- app/locale/en_US/Ebizmarts_AbandonedCart.csv +45 -0
- app/locale/en_US/Ebizmarts_MageMonkey.csv +41 -0
- app/locale/en_US/Ebizmarts_Mandrill.csv +1 -0
- app/locale/en_US/template/email/ebizmarts/autoresponder/birthday.html +37 -0
- app/locale/en_US/template/email/ebizmarts/autoresponder/neworder.html +36 -0
- app/locale/en_US/template/email/ebizmarts/autoresponder/noactivity.html +33 -0
- app/locale/en_US/template/email/ebizmarts/autoresponder/relatedproducts.html +36 -0
- app/locale/en_US/template/email/ebizmarts/autoresponder/review.html +37 -0
- app/locale/en_US/template/email/ebizmarts/autoresponder/wishlist.html +37 -0
- app/locale/en_US/template/email/sales/abandoned_cart.html +43 -0
- lib/Mandrill/API.php +367 -0
- package.xml +191 -0
- skin/adminhtml/default/default/magemonkey/magemonkey.css +53 -0
- skin/adminhtml/default/default/magemonkey/magemonkey.js +26 -0
- skin/adminhtml/default/default/magemonkey/mailchimp-connected-ebizmarts-title.png +0 -0
- skin/adminhtml/default/default/magemonkey/mailchimp-ico.png +0 -0
- skin/adminhtml/default/default/magemonkey/mailchimp-section-background.png +0 -0
- skin/adminhtml/default/default/magemonkey/mailchimp-tab.png +0 -0
- skin/adminhtml/default/default/mandrill/mandrill-tab.png +0 -0
- skin/adminhtml/default/default/mandrill/mandrill.css +24 -0
- skin/frontend/base/default/magemonkey/magemonkey.css +20 -0
- skin/frontend/base/default/magemonkey/monkey.js +22 -0
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Author : Ebizmarts <info@ebizmarts.com>
|
| 4 |
+
* Date : 5/7/13
|
| 5 |
+
* Time : 11:52 PM
|
| 6 |
+
* File : Abandonedmails.php
|
| 7 |
+
* Module : Ebizmarts_Magemonkey
|
| 8 |
+
*/
|
| 9 |
+
class Ebizmarts_AbandonedCart_Block_Adminhtml_Abandonedmails extends Mage_Adminhtml_Block_Widget_Grid_Container
|
| 10 |
+
{
|
| 11 |
+
public function __construct()
|
| 12 |
+
{
|
| 13 |
+
// The blockGroup must match the first half of how we call the block, and controller matches the second half
|
| 14 |
+
// ie. foo_bar/adminhtml_baz
|
| 15 |
+
$this->_blockGroup = 'ebizmarts_abandonedcart';
|
| 16 |
+
$this->_controller = 'adminhtml_abandonedmails';
|
| 17 |
+
$this->_headerText = $this->__('Mails sent from autoresponders and abandoned carts');
|
| 18 |
+
|
| 19 |
+
parent::__construct();
|
| 20 |
+
$this->removeButton('add');
|
| 21 |
+
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Author : Ebizmarts <info@ebizmarts.com>
|
| 4 |
+
* Date : 5/7/13
|
| 5 |
+
* Time : 11:08 PM
|
| 6 |
+
* File : Grid.php
|
| 7 |
+
* Module : Ebizmarts_Magemonkey
|
| 8 |
+
*/
|
| 9 |
+
class Ebizmarts_AbandonedCart_Block_Adminhtml_Abandonedmails_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
| 10 |
+
{
|
| 11 |
+
public function __construct()
|
| 12 |
+
{
|
| 13 |
+
parent::__construct();
|
| 14 |
+
$this->setDefaultSort('id');
|
| 15 |
+
$this->setId('ebizmarts_abandonedcart_abandonedmails_grid');
|
| 16 |
+
$this->setUseAjax(true);
|
| 17 |
+
$this->setDefaultSort('created_at');
|
| 18 |
+
$this->setDefaultDir('DESC');
|
| 19 |
+
$this->setSaveParametersInSession(true);
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
protected function _getCollectionClass()
|
| 23 |
+
{
|
| 24 |
+
return 'ebizmarts_abandonedcart/mailssent_collection';
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
protected function _prepareCollection()
|
| 28 |
+
{
|
| 29 |
+
$collection = Mage::getResourceModel($this->_getCollectionClass());
|
| 30 |
+
$this->setCollection($collection);
|
| 31 |
+
return parent::_prepareCollection();
|
| 32 |
+
}
|
| 33 |
+
protected function _prepareColumns()
|
| 34 |
+
{
|
| 35 |
+
|
| 36 |
+
$this->addColumn('store', array(
|
| 37 |
+
'header' => Mage::helper('ebizmarts_abandonedcart')->__('Store'),
|
| 38 |
+
'type' => 'store',
|
| 39 |
+
'index' => 'store_id'
|
| 40 |
+
));
|
| 41 |
+
|
| 42 |
+
$this->addColumn('sent_at', array(
|
| 43 |
+
'header' => Mage::helper('ebizmarts_abandonedcart')->__('Sent At'),
|
| 44 |
+
'index' => 'sent_at',
|
| 45 |
+
'filter_index' => 'sent_at',
|
| 46 |
+
'type' => 'datetime',
|
| 47 |
+
'width' => '100px',
|
| 48 |
+
));
|
| 49 |
+
|
| 50 |
+
$this->addColumn('customer_email', array(
|
| 51 |
+
'header' => Mage::helper('ebizmarts_abandonedcart')->__('Customer Email'),
|
| 52 |
+
'index' => 'customer_email',
|
| 53 |
+
));
|
| 54 |
+
|
| 55 |
+
$this->addColumn('customer_name', array(
|
| 56 |
+
'header' => Mage::helper('ebizmarts_abandonedcart')->__('Customer Name'),
|
| 57 |
+
'index' => 'customer_name',
|
| 58 |
+
));
|
| 59 |
+
|
| 60 |
+
$this->addColumn('mail_type', array(
|
| 61 |
+
'header' => Mage::helper('ebizmarts_abandonedcart')->__('Mail Type'),
|
| 62 |
+
'index' => 'mail_type',
|
| 63 |
+
'type' => 'options',
|
| 64 |
+
'options' => $this->getMailTypeOptions(),
|
| 65 |
+
));
|
| 66 |
+
$this->addColumn('coupon', array(
|
| 67 |
+
'header' => Mage::helper('ebizmarts_abandonedcart')->__('Coupon #'),
|
| 68 |
+
'index' => 'coupon_number',
|
| 69 |
+
));
|
| 70 |
+
$this->addColumn('coupon_type', array(
|
| 71 |
+
'header' => Mage::helper('ebizmarts_abandonedcart')->__('Coupon type'),
|
| 72 |
+
'type' => 'options',
|
| 73 |
+
'index' => 'coupon_type',
|
| 74 |
+
'options' => Mage::getModel('Ebizmarts_AbandonedCart_Model_System_Config_Discounttype')->options(),
|
| 75 |
+
));
|
| 76 |
+
$this->addColumn('coupon_amount', array(
|
| 77 |
+
'header' => Mage::helper('ebizmarts_abandonedcart')->__('Coupon amount'),
|
| 78 |
+
'index' => 'coupon_amount',
|
| 79 |
+
));
|
| 80 |
+
|
| 81 |
+
$this->addExportType('*/*/exportCsv', Mage::helper('sales')->__('CSV'));
|
| 82 |
+
$this->addExportType('*/*/exportExcel', Mage::helper('sales')->__('Excel XML'));
|
| 83 |
+
|
| 84 |
+
return parent::_prepareColumns();
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
public function getGridUrl()
|
| 88 |
+
{
|
| 89 |
+
return $this->getUrl('*/*/grid', array('_current'=>true));
|
| 90 |
+
}
|
| 91 |
+
|
| 92 |
+
protected function getMailTypeOptions()
|
| 93 |
+
{
|
| 94 |
+
return array('abandoned cart'=>'abandoned cart','happy birthday'=>'happy birthday','new order'=>'new order', 'related products'=>'related products', 'product review'=>'product review', 'no activity'=>'no activity', 'wishlist'=>'wishlist');
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Created by Ebizmarts
|
| 4 |
+
* User: gonzalo@ebizmarts.com
|
| 5 |
+
* Date: 1/16/13
|
| 6 |
+
* Time: 2:16 PM
|
| 7 |
+
*/
|
| 8 |
+
class Ebizmarts_AbandonedCart_Block_Adminhtml_Abandonedorder extends Mage_Adminhtml_Block_Widget_Grid_Container
|
| 9 |
+
{
|
| 10 |
+
public function __construct()
|
| 11 |
+
{
|
| 12 |
+
// The blockGroup must match the first half of how we call the block, and controller matches the second half
|
| 13 |
+
// ie. foo_bar/adminhtml_baz
|
| 14 |
+
$this->_blockGroup = 'ebizmarts_abandonedcart';
|
| 15 |
+
$this->_controller = 'adminhtml_abandonedorder';
|
| 16 |
+
$this->_headerText = $this->__('Orders made from abandoned carts (Ebizmarts)');
|
| 17 |
+
|
| 18 |
+
parent::__construct();
|
| 19 |
+
$this->removeButton('add');
|
| 20 |
+
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
}
|
|
@@ -0,0 +1,148 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Created by Ebizmarts
|
| 4 |
+
* User: gonzalo@ebizmarts.com
|
| 5 |
+
* Date: 1/16/13
|
| 6 |
+
* Time: 2:17 PM
|
| 7 |
+
*/
|
| 8 |
+
class Ebizmarts_AbandonedCart_Block_Adminhtml_Abandonedorder_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
| 9 |
+
{
|
| 10 |
+
/**
|
| 11 |
+
*
|
| 12 |
+
*/
|
| 13 |
+
public function __construct()
|
| 14 |
+
{
|
| 15 |
+
parent::__construct();
|
| 16 |
+
// Set some defaults for our grid
|
| 17 |
+
$this->setDefaultSort('id');
|
| 18 |
+
$this->setId('ebizmarts_abandonedcart_abandonedorder_grid');
|
| 19 |
+
$this->setUseAjax(true);
|
| 20 |
+
$this->setDefaultSort('created_at');
|
| 21 |
+
$this->setDefaultDir('DESC');
|
| 22 |
+
$this->setSaveParametersInSession(true);
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
/**
|
| 26 |
+
* @return string
|
| 27 |
+
*/
|
| 28 |
+
protected function _getCollectionClass()
|
| 29 |
+
{
|
| 30 |
+
return 'sales/order_grid_collection';
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
/**
|
| 34 |
+
* @return this
|
| 35 |
+
*/
|
| 36 |
+
protected function _prepareCollection()
|
| 37 |
+
{
|
| 38 |
+
$collection = Mage::getResourceModel($this->_getCollectionClass());
|
| 39 |
+
$this->setCollection($collection);
|
| 40 |
+
$sales_flat_order_table = Mage::getSingleton('core/resource')->getTableName('sales_flat_order');
|
| 41 |
+
$collection->getSelect()->join($sales_flat_order_table , 'main_table.increment_id = '.$sales_flat_order_table.'.increment_id', 'ebizmarts_abandonedcart_flag');
|
| 42 |
+
$collection->addFieldToFilter($sales_flat_order_table.'.ebizmarts_abandonedcart_flag',array('eq' => 1));
|
| 43 |
+
return parent::_prepareCollection();
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
/**
|
| 47 |
+
* @return Mage_Adminhtml_Block_Widget_Grid
|
| 48 |
+
*/
|
| 49 |
+
protected function _prepareColumns()
|
| 50 |
+
{
|
| 51 |
+
|
| 52 |
+
$this->addColumn('real_order_id', array(
|
| 53 |
+
'header'=> Mage::helper('sales')->__('Order #'),
|
| 54 |
+
'width' => '80px',
|
| 55 |
+
'type' => 'text',
|
| 56 |
+
'index' => 'increment_id',
|
| 57 |
+
));
|
| 58 |
+
|
| 59 |
+
if (!Mage::app()->isSingleStoreMode()) {
|
| 60 |
+
$this->addColumn('store_id', array(
|
| 61 |
+
'header' => Mage::helper('sales')->__('Purchased From (Store)'),
|
| 62 |
+
'index' => 'store_id',
|
| 63 |
+
'filter_index' => 'main_table.store_id',
|
| 64 |
+
'type' => 'store',
|
| 65 |
+
'store_view'=> true,
|
| 66 |
+
'display_deleted' => true,
|
| 67 |
+
));
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
$this->addColumn('created_at', array(
|
| 71 |
+
'header' => Mage::helper('sales')->__('Purchased On'),
|
| 72 |
+
'index' => 'created_at',
|
| 73 |
+
'filter_index' => 'main_table.created_at',
|
| 74 |
+
'type' => 'datetime',
|
| 75 |
+
'width' => '100px',
|
| 76 |
+
));
|
| 77 |
+
|
| 78 |
+
$this->addColumn('billing_name', array(
|
| 79 |
+
'header' => Mage::helper('sales')->__('Bill to Name'),
|
| 80 |
+
'index' => 'billing_name',
|
| 81 |
+
));
|
| 82 |
+
|
| 83 |
+
$this->addColumn('shipping_name', array(
|
| 84 |
+
'header' => Mage::helper('sales')->__('Ship to Name'),
|
| 85 |
+
'index' => 'shipping_name',
|
| 86 |
+
));
|
| 87 |
+
|
| 88 |
+
$this->addColumn('base_grand_total', array(
|
| 89 |
+
'header' => Mage::helper('sales')->__('G.T. (Base)'),
|
| 90 |
+
'index' => 'base_grand_total',
|
| 91 |
+
'type' => 'currency',
|
| 92 |
+
'currency' => 'base_currency_code',
|
| 93 |
+
));
|
| 94 |
+
|
| 95 |
+
$this->addColumn('grand_total', array(
|
| 96 |
+
'header' => Mage::helper('sales')->__('G.T. (Purchased)'),
|
| 97 |
+
'index' => 'grand_total',
|
| 98 |
+
'type' => 'currency',
|
| 99 |
+
'currency' => 'order_currency_code',
|
| 100 |
+
));
|
| 101 |
+
|
| 102 |
+
$this->addColumn('status', array(
|
| 103 |
+
'header' => Mage::helper('sales')->__('Status'),
|
| 104 |
+
'index' => 'status',
|
| 105 |
+
'type' => 'options',
|
| 106 |
+
'width' => '70px',
|
| 107 |
+
'options' => Mage::getSingleton('sales/order_config')->getStatuses(),
|
| 108 |
+
));
|
| 109 |
+
|
| 110 |
+
|
| 111 |
+
$this->addExportType('*/*/exportCsv', Mage::helper('sales')->__('CSV'));
|
| 112 |
+
$this->addExportType('*/*/exportExcel', Mage::helper('sales')->__('Excel XML'));
|
| 113 |
+
|
| 114 |
+
return parent::_prepareColumns();
|
| 115 |
+
}
|
| 116 |
+
|
| 117 |
+
/**
|
| 118 |
+
* @return Ebizmarts_AbandonedCart_Block_Adminhtml_Abandonedorder_Grid|Mage_Adminhtml_Block_Widget_Grid
|
| 119 |
+
*/
|
| 120 |
+
protected function _prepareMassaction()
|
| 121 |
+
{
|
| 122 |
+
$this->setMassactionIdField('entity_id');
|
| 123 |
+
$this->getMassactionBlock()->setFormFieldName('order_ids');
|
| 124 |
+
$this->getMassactionBlock()->setUseSelectAll(false);
|
| 125 |
+
return $this;
|
| 126 |
+
|
| 127 |
+
}
|
| 128 |
+
|
| 129 |
+
/**
|
| 130 |
+
* @param $row
|
| 131 |
+
* @return bool|string
|
| 132 |
+
*/
|
| 133 |
+
public function getRowUrl($row)
|
| 134 |
+
{
|
| 135 |
+
// if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
|
| 136 |
+
// return $this->getUrl('*/sales_order/view', array('order_id' => $row->getId()));
|
| 137 |
+
// }
|
| 138 |
+
return false;
|
| 139 |
+
}
|
| 140 |
+
|
| 141 |
+
/**
|
| 142 |
+
* @return string
|
| 143 |
+
*/
|
| 144 |
+
public function getGridUrl()
|
| 145 |
+
{
|
| 146 |
+
return $this->getUrl('*/*/grid', array('_current'=>true));
|
| 147 |
+
}
|
| 148 |
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Created by Ebizmarts
|
| 4 |
+
* User: gonzalo@ebizmarts.com
|
| 5 |
+
* Date: 1/17/13
|
| 6 |
+
* Time: 3:15 PM
|
| 7 |
+
*/
|
| 8 |
+
class Ebizmarts_AbandonedCart_Block_Adminhtml_Dashboard extends Mage_Adminhtml_Block_Template
|
| 9 |
+
{
|
| 10 |
+
public function __construct()
|
| 11 |
+
{
|
| 12 |
+
$this->_headerText = $this->__('Abandoned Cart Dashboard (Ebizmarts)');
|
| 13 |
+
parent::__construct();
|
| 14 |
+
$this->setTemplate('ebizmarts/abandonedcart/dashboard/index.phtml');
|
| 15 |
+
|
| 16 |
+
}
|
| 17 |
+
protected function _prepareLayout()
|
| 18 |
+
{
|
| 19 |
+
$this->setChild('sales',
|
| 20 |
+
$this->getLayout()->createBlock('ebizmarts_abandonedcart/adminhtml_dashboard_sales')
|
| 21 |
+
);
|
| 22 |
+
$this->setChild('totals',
|
| 23 |
+
$this->getLayout()->createBlock('ebizmarts_abandonedcart/adminhtml_dashboard_totals')
|
| 24 |
+
);
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
}
|
| 28 |
+
public function ajaxBlockAction()
|
| 29 |
+
{
|
| 30 |
+
$output = '';
|
| 31 |
+
$blockTab = $this->getRequest()->getParam('block');
|
| 32 |
+
if (in_array($blockTab, array('totals'))) {
|
| 33 |
+
$output = $this->getLayout()->createBlock('ebizmarts_abandonedcart/adminhtml_dashboard_' . $blockTab)->toHtml();
|
| 34 |
+
}
|
| 35 |
+
$this->getResponse()->setBody($output);
|
| 36 |
+
return;
|
| 37 |
+
}
|
| 38 |
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Created by Ebizmarts
|
| 4 |
+
* User: gonzalo@ebizmarts.com
|
| 5 |
+
* Date: 1/18/13
|
| 6 |
+
* Time: 4:34 PM
|
| 7 |
+
*/
|
| 8 |
+
|
| 9 |
+
class Ebizmarts_AbandonedCart_Block_Adminhtml_Dashboard_Sales extends Mage_Adminhtml_Block_Dashboard_Bar
|
| 10 |
+
{
|
| 11 |
+
/**
|
| 12 |
+
*
|
| 13 |
+
*/
|
| 14 |
+
protected function _construct()
|
| 15 |
+
{
|
| 16 |
+
parent::_construct();
|
| 17 |
+
$this->setTemplate('ebizmarts/abandonedcart/dashboard/salebar.phtml');
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
/**
|
| 23 |
+
* @return Ebizmarts_AbandonedCart_Block_Adminhtml_Dashboard_Sales|Mage_Core_Block_Abstract
|
| 24 |
+
*/
|
| 25 |
+
protected function _prepareLayout()
|
| 26 |
+
{
|
| 27 |
+
if (!Mage::helper('core')->isModuleEnabled('Mage_Reports')) {
|
| 28 |
+
return $this;
|
| 29 |
+
}
|
| 30 |
+
$isFilter = $this->getRequest()->getParam('store') || $this->getRequest()->getParam('website') || $this->getRequest()->getParam('group');
|
| 31 |
+
|
| 32 |
+
$collection = Mage::getResourceModel('ebizmarts_abandonedcart/order_collection')
|
| 33 |
+
->calculateSales($isFilter);
|
| 34 |
+
// $collection->getSelect()->join('sales_flat_quote' , 'main_table.increment_id = sales_flat_quote.reserved_order_id', 'ebizmarts_abandonedcart_flag');
|
| 35 |
+
$collection->addFieldToFilter('main_table.ebizmarts_abandonedcart_flag',array('eq' => 1));
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
if ($this->getRequest()->getParam('store')) {
|
| 39 |
+
$collection->addFieldToFilter('main_table.store_id', $this->getRequest()->getParam('store'));
|
| 40 |
+
} else if ($this->getRequest()->getParam('website')){
|
| 41 |
+
$storeIds = Mage::app()->getWebsite($this->getRequest()->getParam('website'))->getStoreIds();
|
| 42 |
+
$collection->addFieldToFilter('main_table.store_id', array('in' => $storeIds));
|
| 43 |
+
} else if ($this->getRequest()->getParam('group')){
|
| 44 |
+
$storeIds = Mage::app()->getGroup($this->getRequest()->getParam('group'))->getStoreIds();
|
| 45 |
+
$collection->addFieldToFilter('main_table.store_id', array('in' => $storeIds));
|
| 46 |
+
}
|
| 47 |
+
$collection->load();
|
| 48 |
+
$sales = $collection->getFirstItem();
|
| 49 |
+
|
| 50 |
+
$this->addTotal($this->__('Lifetime Generate Revenue'), $sales->getLifetime());
|
| 51 |
+
$this->addTotal($this->__('Average Orders'), $sales->getAverage());
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
}
|
|
@@ -0,0 +1,197 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Created by Ebizmarts
|
| 4 |
+
* User: gonzalo@ebizmarts.com
|
| 5 |
+
* Date: 1/18/13
|
| 6 |
+
* Time: 5:11 PM
|
| 7 |
+
*/
|
| 8 |
+
class Ebizmarts_AbandonedCart_Block_Adminhtml_Dashboard_Totals extends Mage_Adminhtml_Block_Dashboard_Bar
|
| 9 |
+
{
|
| 10 |
+
/**
|
| 11 |
+
*
|
| 12 |
+
*/
|
| 13 |
+
protected function _construct()
|
| 14 |
+
{
|
| 15 |
+
parent::_construct();
|
| 16 |
+
$this->setTemplate('ebizmarts/abandonedcart/dashboard/totalbar.phtml');
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
/**
|
| 20 |
+
* @return Ebizmarts_AbandonedCart_Block_Adminhtml_Dashboard_Totals|Mage_Core_Block_Abstract
|
| 21 |
+
*/
|
| 22 |
+
protected function _prepareLayout()
|
| 23 |
+
{
|
| 24 |
+
if (!Mage::helper('core')->isModuleEnabled('Mage_Reports')) {
|
| 25 |
+
return $this;
|
| 26 |
+
}
|
| 27 |
+
$isFilter = $this->getRequest()->getParam('store') || $this->getRequest()->getParam('website') || $this->getRequest()->getParam('group');
|
| 28 |
+
$period = $this->getRequest()->getParam('period', '24h');
|
| 29 |
+
|
| 30 |
+
$collection = Mage::getResourceModel('ebizmarts_abandonedcart/order_collection')
|
| 31 |
+
->addCreateAtPeriodFilter($period)
|
| 32 |
+
->calculateTotals($isFilter);
|
| 33 |
+
// $collection->getSelect()->join('sales_flat_quote' , 'main_table.increment_id = sales_flat_quote.reserved_order_id', 'ebizmarts_abandonedcart_flag');
|
| 34 |
+
$collection->addFieldToFilter('main_table.ebizmarts_abandonedcart_flag',array('eq' => 1));
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
if ($this->getRequest()->getParam('store')) {
|
| 39 |
+
$collection->addFieldToFilter('main_table.store_id', $this->getRequest()->getParam('store'));
|
| 40 |
+
} else if ($this->getRequest()->getParam('website')){
|
| 41 |
+
$storeIds = Mage::app()->getWebsite($this->getRequest()->getParam('website'))->getStoreIds();
|
| 42 |
+
$collection->addFieldToFilter('main_table.store_id', array('in' => $storeIds));
|
| 43 |
+
} else if ($this->getRequest()->getParam('group')){
|
| 44 |
+
$storeIds = Mage::app()->getGroup($this->getRequest()->getParam('group'))->getStoreIds();
|
| 45 |
+
$collection->addFieldToFilter('main_table.store_id', array('in' => $storeIds));
|
| 46 |
+
} elseif (!$collection->isLive()) {
|
| 47 |
+
$collection->addFieldToFilter('main_table.store_id',
|
| 48 |
+
array('eq' => Mage::app()->getStore(Mage_Core_Model_Store::ADMIN_CODE)->getId())
|
| 49 |
+
);
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
$collection->load();
|
| 53 |
+
|
| 54 |
+
$totals = $collection->getFirstItem();
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
$collection2 = Mage::getResourceModel('ebizmarts_abandonedcart/order_collection')
|
| 58 |
+
->addCreateAtPeriodFilter($period)
|
| 59 |
+
->calculateTotals($isFilter);
|
| 60 |
+
if ($this->getRequest()->getParam('store')) {
|
| 61 |
+
$collection2->addFieldToFilter('store_id', $this->getRequest()->getParam('store'));
|
| 62 |
+
} else if ($this->getRequest()->getParam('website')){
|
| 63 |
+
$storeIds = Mage::app()->getWebsite($this->getRequest()->getParam('website'))->getStoreIds();
|
| 64 |
+
$collection2->addFieldToFilter('store_id', array('in' => $storeIds));
|
| 65 |
+
} else if ($this->getRequest()->getParam('group')){
|
| 66 |
+
$storeIds = Mage::app()->getGroup($this->getRequest()->getParam('group'))->getStoreIds();
|
| 67 |
+
$collection2->addFieldToFilter('store_id', array('in' => $storeIds));
|
| 68 |
+
} elseif (!$collection2->isLive()) {
|
| 69 |
+
$collection->addFieldToFilter('store_id',
|
| 70 |
+
array('eq' => Mage::app()->getStore(Mage_Core_Model_Store::ADMIN_CODE)->getId())
|
| 71 |
+
);
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
$collection2->load();
|
| 75 |
+
|
| 76 |
+
$totals2 = $collection2->getFirstItem();
|
| 77 |
+
|
| 78 |
+
// add totals for generated orders
|
| 79 |
+
if($totals2->getQuantity()) {
|
| 80 |
+
$convrate = (string)($totals->getQuantity()*100/$totals2->getQuantity());
|
| 81 |
+
$convrate = round($convrate*100)/100;
|
| 82 |
+
}
|
| 83 |
+
else {
|
| 84 |
+
$convrate = 0;
|
| 85 |
+
}
|
| 86 |
+
$this->addTotal($this->__('Generated Revenue'),$totals->getRevenue());
|
| 87 |
+
$this->addTotal($this->__('Generated Tax'), $totals->getTax());
|
| 88 |
+
$this->addTotal($this->__('Generated Shipping'), $totals->getShipping());
|
| 89 |
+
$this->addTotal($this->__('Generated Orders'),$totals->getQuantity()*1,true);
|
| 90 |
+
$this->addTotal($this->__('Generated Conv. Rate'),$convrate.'%',true);
|
| 91 |
+
// get Mandrill statistics
|
| 92 |
+
if(Mage::helper('core')->isModuleEnabled('Ebizmarts_Mandrill')
|
| 93 |
+
&& Mage::getConfig()->getNode()->modules->Ebizmarts_Mandrill->version > '1.0.4'
|
| 94 |
+
&& Mage::helper('mandrill')->useTransactionalService()) {
|
| 95 |
+
if(!$isFilter) {
|
| 96 |
+
$stores = Mage::app()->getStores();
|
| 97 |
+
$__particular = array('sent' => 0, 'soft_bounces' => 0,'hard_bounces'=>0,'unique_opens'=>0,'unique_clicks'=>0);
|
| 98 |
+
foreach($stores as $__store => $val) {
|
| 99 |
+
$storeid = Mage::app()->getStore($__store)->getId();
|
| 100 |
+
$aux = $this->__getMandrillStatistics($period,$storeid);
|
| 101 |
+
$__particular['sent'] += $aux['sent'];
|
| 102 |
+
$__particular['soft_bounces'] += $aux['soft_bounces'];
|
| 103 |
+
$__particular['hard_bounces'] += $aux['hard_bounces'];
|
| 104 |
+
$__particular['unique_opens'] += $aux['unique_opens'];
|
| 105 |
+
$__particular['unique_clicks'] += $aux['unique_clicks'];
|
| 106 |
+
}
|
| 107 |
+
$particular = $__particular;
|
| 108 |
+
}
|
| 109 |
+
else {
|
| 110 |
+
$particular = $this->__getMandrillStatistics($period,$this->getRequest()->getParam('store'));
|
| 111 |
+
}
|
| 112 |
+
// add totals for emails
|
| 113 |
+
if($particular) {
|
| 114 |
+
|
| 115 |
+
$_sent = $particular['sent'];
|
| 116 |
+
$_hard_bounces = $particular['hard_bounces'];
|
| 117 |
+
$_unique_opens = $particular['unique_opens'];
|
| 118 |
+
$_unique_clicks = $particular['unique_clicks'];
|
| 119 |
+
|
| 120 |
+
|
| 121 |
+
//Emails Sent and Received
|
| 122 |
+
$aux = $_sent - $_hard_bounces; // - $particular['soft_bounces'];
|
| 123 |
+
if($aux > 0) {
|
| 124 |
+
$aux2 = $aux/ $_sent*100;
|
| 125 |
+
}else{
|
| 126 |
+
$aux2 = 0;
|
| 127 |
+
}
|
| 128 |
+
$received = sprintf('%d (%2.2f%%)', $aux, $aux2);
|
| 129 |
+
|
| 130 |
+
$this->addTotal($this->__('Emails Sent'), $_sent,true);
|
| 131 |
+
$this->addTotal($this->__('Emails Received'), $received,true);
|
| 132 |
+
|
| 133 |
+
//Emails Opened
|
| 134 |
+
if($_unique_opens > 0) {
|
| 135 |
+
$emailsOpened = $_unique_opens / $_sent*100;
|
| 136 |
+
}else{
|
| 137 |
+
$emailsOpened = 0;
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
+
$opens = sprintf('%d (%2.2f%%)', $_unique_opens, $emailsOpened);
|
| 141 |
+
$this->addTotal($this->__('Emails Opened'),$opens,true);
|
| 142 |
+
|
| 143 |
+
//Emails Clicked
|
| 144 |
+
if($_unique_clicks > 0){
|
| 145 |
+
$emailsClicked = $_unique_clicks / $_unique_opens*100;
|
| 146 |
+
}else{
|
| 147 |
+
$emailsClicked = 0;
|
| 148 |
+
}
|
| 149 |
+
|
| 150 |
+
$clicks = sprintf('%d (%2.2f%%)', $_unique_clicks, $emailsClicked);
|
| 151 |
+
$this->addTotal($this->__('Emails Clicked'), $clicks,true);
|
| 152 |
+
}
|
| 153 |
+
}
|
| 154 |
+
}
|
| 155 |
+
|
| 156 |
+
/**
|
| 157 |
+
* @param $period
|
| 158 |
+
* @param $store
|
| 159 |
+
* @return array|bool
|
| 160 |
+
*/
|
| 161 |
+
private function __getMandrillStatistics($period,$store)
|
| 162 |
+
{
|
| 163 |
+
$mandrill = Mage::helper('mandrill')->api();
|
| 164 |
+
$mandrill->setApiKey(Mage::helper('mandrill')->getApiKey($store));
|
| 165 |
+
$mandrillTag = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::MANDRILL_TAG, $store)."_$store";
|
| 166 |
+
$tags = $mandrill->tagsInfo($mandrillTag);
|
| 167 |
+
if(!$tags) {
|
| 168 |
+
return false;
|
| 169 |
+
}
|
| 170 |
+
$general = (array)$tags;
|
| 171 |
+
switch($period) {
|
| 172 |
+
case '24h':
|
| 173 |
+
$index = 'today';
|
| 174 |
+
break;
|
| 175 |
+
case '7d':
|
| 176 |
+
$index = 'last_7_days';
|
| 177 |
+
break;
|
| 178 |
+
case '30d':
|
| 179 |
+
$index = 'last_30_days';
|
| 180 |
+
break;
|
| 181 |
+
case '60d':
|
| 182 |
+
$index = 'last_60_days';
|
| 183 |
+
break;
|
| 184 |
+
case '90d':
|
| 185 |
+
$index = 'last_90_days';
|
| 186 |
+
break;
|
| 187 |
+
case 'lifetime':
|
| 188 |
+
unset($general['stats']);
|
| 189 |
+
return $general;
|
| 190 |
+
|
| 191 |
+
}
|
| 192 |
+
$stats = (array)$general['stats'];
|
| 193 |
+
$particular = (array)$stats[$index];
|
| 194 |
+
return $particular;
|
| 195 |
+
|
| 196 |
+
}
|
| 197 |
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Created by Ebizmarts
|
| 4 |
+
* User: gonzalo@ebizmarts.com
|
| 5 |
+
* Date: 3/11/13
|
| 6 |
+
* Time: 3:03 PM
|
| 7 |
+
*/
|
| 8 |
+
class Ebizmarts_AbandonedCart_Block_Adminhtml_System_Config_Date extends Mage_Adminhtml_Block_System_Config_Form_Field
|
| 9 |
+
{
|
| 10 |
+
public function render(Varien_Data_Form_Element_Abstract $element)
|
| 11 |
+
{
|
| 12 |
+
$element->setFormat(Varien_Date::DATE_INTERNAL_FORMAT);
|
| 13 |
+
$element->setImage($this->getSkinUrl('images/grid-cal.gif'));
|
| 14 |
+
return parent::render($element);
|
| 15 |
+
}
|
| 16 |
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class Ebizmarts_AbandonedCart_Block_Adminhtml_System_Config_Fieldset_Hint
|
| 4 |
+
extends Mage_Adminhtml_Block_Abstract
|
| 5 |
+
implements Varien_Data_Form_Element_Renderer_Interface
|
| 6 |
+
{
|
| 7 |
+
protected $_template = 'ebizmarts/abandonedcart/system/config/fieldset/hint.phtml';
|
| 8 |
+
|
| 9 |
+
/**
|
| 10 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
| 11 |
+
* @return string
|
| 12 |
+
*/
|
| 13 |
+
public function render(Varien_Data_Form_Element_Abstract $element)
|
| 14 |
+
{
|
| 15 |
+
return $this->toHtml();
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
/**
|
| 19 |
+
* @return string
|
| 20 |
+
*/
|
| 21 |
+
public function getVersion()
|
| 22 |
+
{
|
| 23 |
+
return (string) Mage::getConfig()->getNode('modules/Ebizmarts_AbandonedCart/version');
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
/**
|
| 27 |
+
* @return string
|
| 28 |
+
*/
|
| 29 |
+
public function getPxParams() {
|
| 30 |
+
$v = (string)Mage::getConfig()->getNode('modules/Ebizmarts_AbandonedCart/version');
|
| 31 |
+
$ext = "Abandoned Cart;{$v}";
|
| 32 |
+
|
| 33 |
+
$modulesArray = (array)Mage::getConfig()->getNode('modules')->children();
|
| 34 |
+
$aux = (array_key_exists('Enterprise_Enterprise', $modulesArray))? 'EE' : 'CE' ;
|
| 35 |
+
$mageVersion = Mage::getVersion();
|
| 36 |
+
$mage = "Magento {$aux};{$mageVersion}";
|
| 37 |
+
|
| 38 |
+
$hash = md5($ext . '_' . $mage . '_' . $ext);
|
| 39 |
+
|
| 40 |
+
return "ext=$ext&mage={$mage}&ctrl={$hash}";
|
| 41 |
+
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
/**
|
| 45 |
+
* @return mixed
|
| 46 |
+
*/
|
| 47 |
+
public function verify()
|
| 48 |
+
{
|
| 49 |
+
return Mage::helper('ebizmarts_abandonedcart')->verify();
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class Ebizmarts_AbandonedCart_Block_Email_Order_Items extends Mage_Sales_Block_Items_Abstract
|
| 4 |
+
{
|
| 5 |
+
public function _construct()
|
| 6 |
+
{
|
| 7 |
+
$this->setTemplate('ebizmarts_abandonedcart/email_order_items.phtml');
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
public function getTax($_item)
|
| 11 |
+
{
|
| 12 |
+
if (Mage::helper('tax')->displayCartPriceInclTax()){
|
| 13 |
+
$subtotal = Mage::helper('tax')->__('Incl. Tax') . ' : ' .Mage::helper('checkout')->formatPrice($_item['row_total_incl_tax']);
|
| 14 |
+
} elseif(Mage::helper('tax')->displayCartBothPrices()) {
|
| 15 |
+
$subtotal = Mage::helper('tax')->__('Excl. Tax') . ' : ' . Mage::helper('checkout')->formatPrice($_item['row_total']) . '<br>'. Mage::helper('tax')->__('Incl. Tax') . ' : ' . Mage::helper('checkout')->formatPrice($_item['row_total_incl_tax']);
|
| 16 |
+
} else {
|
| 17 |
+
$subtotal = Mage::helper('tax')->__('Excl. Tax') . ' : ' . Mage::helper('checkout')->formatPrice($_item['row_total']);
|
| 18 |
+
}
|
| 19 |
+
return $subtotal;
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class Ebizmarts_AbandonedCart_Helper_Data extends Mage_Core_Helper_Abstract {
|
| 4 |
+
|
| 5 |
+
/**
|
| 6 |
+
* @return string
|
| 7 |
+
*/
|
| 8 |
+
public function getVersion()
|
| 9 |
+
{
|
| 10 |
+
return (string) Mage::getConfig()->getNode('modules/Ebizmarts_AbandonedCart/version');
|
| 11 |
+
}
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
/**
|
| 15 |
+
* @return array
|
| 16 |
+
*/
|
| 17 |
+
public function getDatePeriods()
|
| 18 |
+
{
|
| 19 |
+
return array(
|
| 20 |
+
'24h' => $this->__('Last 24 Hours'),
|
| 21 |
+
'7d' => $this->__('Last 7 Days'),
|
| 22 |
+
'30d' => $this->__('Last 30 Days'),
|
| 23 |
+
'60d' => $this->__('Last 60 Days'),
|
| 24 |
+
'90d' => $this->__('Last 90 Days'),
|
| 25 |
+
'lifetime' => $this->__('Lifetime'),
|
| 26 |
+
);
|
| 27 |
+
}
|
| 28 |
+
public function log($message)
|
| 29 |
+
{
|
| 30 |
+
if(Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::LOG)) {
|
| 31 |
+
Mage::log($message);
|
| 32 |
+
}
|
| 33 |
+
}
|
| 34 |
+
public function saveMail($mailType,$mail,$name,$couponCode,$storeId)
|
| 35 |
+
{
|
| 36 |
+
if($couponCode!='') {
|
| 37 |
+
$coupon = Mage::getModel('salesrule/coupon')->load($couponCode, 'code');
|
| 38 |
+
$rule = Mage::getModel('salesrule/rule')->load($coupon->getRuleId());
|
| 39 |
+
$couponAmount = $rule->getDiscountAmount();
|
| 40 |
+
switch($rule->getSimpleAction()) {
|
| 41 |
+
case 'cart_fixed':
|
| 42 |
+
$couponType = 1;
|
| 43 |
+
break;
|
| 44 |
+
case 'by_percent':
|
| 45 |
+
$couponType = 2;
|
| 46 |
+
break;
|
| 47 |
+
}
|
| 48 |
+
}
|
| 49 |
+
else {
|
| 50 |
+
$couponType = 0;
|
| 51 |
+
$couponAmount = 0;
|
| 52 |
+
}
|
| 53 |
+
$sent = Mage::getModel('ebizmarts_abandonedcart/mailssent');
|
| 54 |
+
$sent->setMailType($mailType)
|
| 55 |
+
->setStoreId($storeId)
|
| 56 |
+
->setCustomerEmail($mail)
|
| 57 |
+
->setCustomerName($name)
|
| 58 |
+
->setCouponNumber($couponCode)
|
| 59 |
+
->setCouponType($couponType)
|
| 60 |
+
->setCouponAmount($couponAmount)
|
| 61 |
+
->setSentAt(Mage::getModel('core/date')->gmtDate())
|
| 62 |
+
->save();
|
| 63 |
+
}
|
| 64 |
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Created by Ebizmarts
|
| 4 |
+
* User: gonzalo@ebizmarts.com
|
| 5 |
+
* Date: 3/20/13
|
| 6 |
+
* Time: 8:34 AM
|
| 7 |
+
*/
|
| 8 |
+
class Ebizmarts_AbandonedCart_Model_Config
|
| 9 |
+
{
|
| 10 |
+
const ACTIVE = "ebizmarts_abandonedcart/general/active";
|
| 11 |
+
const EMAIL_TEMPLATE_XML_PATH = 'ebizmarts_abandonedcart/general/template';
|
| 12 |
+
const MANDRILL_TAG = 'ebizmarts_abandonedcart/general/mandrill-tag';
|
| 13 |
+
const EMAIL_TEMPLATE_XML_PATH_W_COUPON = 'ebizmarts_abandonedcart/general/coupon_template';
|
| 14 |
+
const DAYS = "ebizmarts_abandonedcart/general/days";
|
| 15 |
+
const UNIT = "ebizmarts_abandonedcart/general/unit";
|
| 16 |
+
const SENDER = "ebizmarts_abandonedcart/general/identity";
|
| 17 |
+
const MAXTIMES = "ebizmarts_abandonedcart/general/max";
|
| 18 |
+
const COUPON_DAYS = "ebizmarts_abandonedcart/coupon/sendon";
|
| 19 |
+
const SEND_COUPON = "ebizmarts_abandonedcart/coupon/create";
|
| 20 |
+
const FIRST_DATE = "ebizmarts_abandonedcart/general/firstdate";
|
| 21 |
+
const COUPON_AMOUNT = "ebizmarts_abandonedcart/coupon/discount";
|
| 22 |
+
const COUPON_AUTOMATIC = "ebizmarts_abandonedcart/coupon/automatic";
|
| 23 |
+
const COUPON_CODE = "ebizmarts_abandonedcart/coupon/couponcode";
|
| 24 |
+
const COUPON_EXPIRE = "ebizmarts_abandonedcart/coupon/expire";
|
| 25 |
+
const COUPON_TYPE = "ebizmarts_abandonedcart/coupon/discounttype";
|
| 26 |
+
const COUPON_LENGTH = "ebizmarts_abandonedcart/coupon/length";
|
| 27 |
+
const COUPON_LABEL = "ebizmarts_abandonedcart/coupon/couponlabel";
|
| 28 |
+
const CUSTOMER_GROUPS = "ebizmarts_abandonedcart/general/customer";
|
| 29 |
+
const SUBJECT = "ebizmarts_abandonedcart/general/subject";
|
| 30 |
+
const LOG = "ebizmarts_abandonedcart/general/log";
|
| 31 |
+
const AUTOLOGIN = "ebizmarts_abandonedcart/general/autologin";
|
| 32 |
+
const ABANDONED_TAGS = 'global/ebizmarts_abandonedcart/mandrill-tag';
|
| 33 |
+
const IN_DAYS = 0;
|
| 34 |
+
const IN_HOURS = 1;
|
| 35 |
+
}
|
|
@@ -0,0 +1,253 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
class Ebizmarts_AbandonedCart_Model_Cron
|
| 3 |
+
{
|
| 4 |
+
// const EMAIL_TEMPLATE_XML_PATH = 'ebizmarts_abandonedcart/general/template';
|
| 5 |
+
// const EMAIL_TEMPLATE_XML_PATH_W_COUPON = 'ebizmarts_abandonedcart/general/coupon_template';
|
| 6 |
+
|
| 7 |
+
/**
|
| 8 |
+
*
|
| 9 |
+
*/
|
| 10 |
+
public function abandoned()
|
| 11 |
+
{
|
| 12 |
+
$allStores = Mage::app()->getStores();
|
| 13 |
+
foreach($allStores as $storeid => $val)
|
| 14 |
+
{
|
| 15 |
+
if(Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::ACTIVE,$storeid)) {
|
| 16 |
+
$this->_proccess($storeid);
|
| 17 |
+
}
|
| 18 |
+
}
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
/**
|
| 22 |
+
* @param $store
|
| 23 |
+
*/
|
| 24 |
+
protected function _proccess($store)
|
| 25 |
+
{
|
| 26 |
+
Mage::app()->setCurrentStore($store);
|
| 27 |
+
|
| 28 |
+
$adapter = Mage::getSingleton('core/resource')->getConnection('sales_read');
|
| 29 |
+
$days = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::DAYS, $store);
|
| 30 |
+
$maxtimes = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::MAXTIMES, $store);
|
| 31 |
+
$sendcoupondays = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::COUPON_DAYS, $store);
|
| 32 |
+
$sendcoupon = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::SEND_COUPON, $store);
|
| 33 |
+
$firstdate = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::FIRST_DATE, $store);
|
| 34 |
+
$unit = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::UNIT, $store);
|
| 35 |
+
$customergroups = explode(",",Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::CUSTOMER_GROUPS, $store));
|
| 36 |
+
$mailsubject = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::SUBJECT, $store);
|
| 37 |
+
$mandrillTag = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::MANDRILL_TAG, $store)."_$store";
|
| 38 |
+
|
| 39 |
+
if(!$days) {
|
| 40 |
+
return;
|
| 41 |
+
}
|
| 42 |
+
if($unit == Ebizmarts_AbandonedCart_Model_Config::IN_DAYS) {
|
| 43 |
+
$expr = sprintf('DATE_SUB(%s, %s)', $adapter->quote(now()), $this->_getIntervalUnitSql($days, 'DAY'));
|
| 44 |
+
$from = new Zend_Db_Expr($expr);
|
| 45 |
+
|
| 46 |
+
// get a collection of abandoned carts
|
| 47 |
+
$collection = Mage::getResourceModel('reports/quote_collection');
|
| 48 |
+
$collection->addFieldToFilter('items_count', array('neq' => '0'))
|
| 49 |
+
->addFieldToFilter('main_table.is_active', '1')
|
| 50 |
+
->addFieldToFilter('main_table.store_id',array('eq'=>$store))
|
| 51 |
+
->addSubtotal($store)
|
| 52 |
+
->setOrder('updated_at');
|
| 53 |
+
|
| 54 |
+
$collection->addFieldToFilter('main_table.converted_at', array(array('null'=>true),$this->_getSuggestedZeroDate()))
|
| 55 |
+
->addFieldToFilter('main_table.updated_at', array('to' => $from,'from' => $firstdate))
|
| 56 |
+
->addFieldToFilter('main_table.ebizmarts_abandonedcart_counter',array('lt' => $maxtimes));
|
| 57 |
+
|
| 58 |
+
$collection->addFieldToFilter('main_table.customer_email', array('neq' => ''));
|
| 59 |
+
if(count($customergroups)) {
|
| 60 |
+
$collection->addFieldToFilter('main_table.customer_group_id', array('in', $customergroups));
|
| 61 |
+
}
|
| 62 |
+
} else {
|
| 63 |
+
// make the collection for first run
|
| 64 |
+
$expr = sprintf('DATE_SUB(%s, %s)', $adapter->quote(now()), $this->_getIntervalUnitSql($days, 'HOUR'));
|
| 65 |
+
$from = new Zend_Db_Expr($expr);
|
| 66 |
+
|
| 67 |
+
// get a collection of abandoned carts
|
| 68 |
+
$collection1 = Mage::getResourceModel('reports/quote_collection');
|
| 69 |
+
$collection1->addFieldToFilter('items_count', array('neq' => '0'))
|
| 70 |
+
->addFieldToFilter('main_table.is_active', '1')
|
| 71 |
+
->addFieldToFilter('main_table.store_id',array('eq'=>$store))
|
| 72 |
+
->addSubtotal($store)
|
| 73 |
+
->setOrder('updated_at');
|
| 74 |
+
|
| 75 |
+
|
| 76 |
+
$collection1->addFieldToFilter('main_table.converted_at', array(array('null'=>true),$this->_getSuggestedZeroDate()))
|
| 77 |
+
->addFieldToFilter('main_table.updated_at', array('to' => $from,'from' => $firstdate))
|
| 78 |
+
->addFieldToFilter('main_table.ebizmarts_abandonedcart_counter',array('eq' => 0));
|
| 79 |
+
|
| 80 |
+
$collection1->addFieldToFilter('main_table.customer_email', array('neq' => ''));
|
| 81 |
+
if(count($customergroups)) {
|
| 82 |
+
$collection1->addFieldToFilter('main_table.customer_group_id', array('in', $customergroups));
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
$expr = sprintf('DATE_SUB(%s, %s)', $adapter->quote(now()), $this->_getIntervalUnitSql(1, 'DAY'));
|
| 86 |
+
$from = new Zend_Db_Expr($expr);
|
| 87 |
+
// get a collection of abandoned carts who aren't the first run
|
| 88 |
+
$collection2 = Mage::getResourceModel('reports/quote_collection');
|
| 89 |
+
$collection2->addFieldToFilter('items_count', array('neq' => '0'))
|
| 90 |
+
->addFieldToFilter('main_table.is_active', '1')
|
| 91 |
+
->addFieldToFilter('main_table.store_id',array('eq'=>$store))
|
| 92 |
+
->addSubtotal($store)
|
| 93 |
+
->setOrder('updated_at');
|
| 94 |
+
|
| 95 |
+
$collection2->addFieldToFilter('main_table.converted_at', array(array('null'=>true),$this->_getSuggestedZeroDate()))
|
| 96 |
+
->addFieldToFilter('main_table.updated_at', array('to' => $from,'from' => $firstdate))
|
| 97 |
+
->addFieldToFilter('main_table.ebizmarts_abandonedcart_counter',array('from' => 1,'to' => $maxtimes-1));
|
| 98 |
+
|
| 99 |
+
$collection2->addFieldToFilter('main_table.customer_email', array('neq' => ''));
|
| 100 |
+
if(count($customergroups)) {
|
| 101 |
+
$collection2->addFieldToFilter('main_table.customer_group_id', array('in', $customergroups));
|
| 102 |
+
}
|
| 103 |
+
Mage::helper('ebizmarts_abandonedcart')->log((string)$collection1->getSelect());
|
| 104 |
+
Mage::helper('ebizmarts_abandonedcart')->log((string)$collection2->getSelect());
|
| 105 |
+
$collection = $collection1;
|
| 106 |
+
foreach($collection2 as $quote) {
|
| 107 |
+
$collection->addItem($quote);
|
| 108 |
+
}
|
| 109 |
+
}
|
| 110 |
+
|
| 111 |
+
// for each cart
|
| 112 |
+
foreach($collection as $quote)
|
| 113 |
+
{
|
| 114 |
+
// check if they are any order from the customer with date >=
|
| 115 |
+
$collection2 = Mage::getResourceModel('reports/quote_collection');
|
| 116 |
+
$collection2->addFieldToFilter('main_table.is_active', '0')
|
| 117 |
+
->addFieldToFilter('main_table.reserved_order_id',array('neq' => 'NULL' ))
|
| 118 |
+
->addFieldToFilter('main_table.customer_email',array('eq' => $quote->getCustomerEmail()))
|
| 119 |
+
->addFieldToFilter('main_table.updated_at',array('from'=>$quote->getUpdatedAt()));
|
| 120 |
+
if($collection2->getSize()) {
|
| 121 |
+
continue;
|
| 122 |
+
}
|
| 123 |
+
//
|
| 124 |
+
//$url = Mage::getBaseUrl('web').'ebizmarts_abandonedcart/abandoned/loadquote?id='.$quote->getEntityId();
|
| 125 |
+
$url = Mage::getModel('core/url')->setStore($store)->getUrl().'ebizmarts_abandonedcart/abandoned/loadquote?id='.$quote->getEntityId();
|
| 126 |
+
|
| 127 |
+
$data = array('AbandonedURL'=>$url, 'AbandonedDate' => $quote->getUpdatedAt());
|
| 128 |
+
// send email
|
| 129 |
+
|
| 130 |
+
$senderid = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::SENDER, $store);
|
| 131 |
+
$sender = array('name'=>Mage::getStoreConfig("trans_email/ident_$senderid/name",$store), 'email'=> Mage::getStoreConfig("trans_email/ident_$senderid/email",$store));
|
| 132 |
+
|
| 133 |
+
$email = $quote->getCustomerEmail();
|
| 134 |
+
if($this->_isSubscribed($email,'abandonedcart',$store)) {
|
| 135 |
+
$name = $quote->getCustomerFirstname().' '.$quote->getCustomerLastname();
|
| 136 |
+
$quote2 = Mage::getModel('sales/quote')->loadByIdWithoutStore($quote->getId());
|
| 137 |
+
$unsubscribeUrl = Mage::getModel('core/url')->setStore($store)->getUrl().'ebizautoresponder/autoresponder/unsubscribe?list=abandonedcart&email='.$email.'&store='.$store;
|
| 138 |
+
$couponcode = '';
|
| 139 |
+
if($sendcoupon && $quote2->getEbizmartsAbandonedcartCounter() + 1 == $sendcoupondays)
|
| 140 |
+
{
|
| 141 |
+
$templateId = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::EMAIL_TEMPLATE_XML_PATH);
|
| 142 |
+
// create a new coupon
|
| 143 |
+
if(Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::COUPON_AUTOMATIC)==2) {
|
| 144 |
+
list($couponcode,$discount,$toDate) = $this->_createNewCoupon($store,$email);
|
| 145 |
+
$vars = array('quote'=>$quote,'url'=>$url, 'couponcode'=>$couponcode,'discount' => $discount,
|
| 146 |
+
'todate' => $toDate, 'name' => $name,'tags'=>array($mandrillTag),'unsubscribeurl'=>$unsubscribeUrl);
|
| 147 |
+
}
|
| 148 |
+
else {
|
| 149 |
+
$couponcode = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::COUPON_CODE);
|
| 150 |
+
$vars = array('quote'=>$quote,'url'=>$url, 'couponcode'=>$couponcode, 'name' => $name,'tags'=>array($mandrillTag),'unsubscribeurl'=>$unsubscribeUrl);
|
| 151 |
+
}
|
| 152 |
+
}
|
| 153 |
+
else {
|
| 154 |
+
$templateId = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::EMAIL_TEMPLATE_XML_PATH);
|
| 155 |
+
$vars = array('quote'=>$quote,'url'=>$url,'unsubscribeurl'=>$unsubscribeUrl,'tags'=>array($mandrillTag));
|
| 156 |
+
|
| 157 |
+
}
|
| 158 |
+
$translate = Mage::getSingleton('core/translate');
|
| 159 |
+
$mail = Mage::getModel('core/email_template')->setTemplateSubject($mailsubject)->sendTransactional($templateId,$sender,$email,$name,$vars,$store);
|
| 160 |
+
$translate->setTranslateInLine(true);
|
| 161 |
+
$quote2->setEbizmartsAbandonedcartCounter($quote2->getEbizmartsAbandonedcartCounter()+1);
|
| 162 |
+
$quote2->save();
|
| 163 |
+
Mage::helper('ebizmarts_abandonedcart')->saveMail('abandoned cart',$email,$name,$couponcode,$store);
|
| 164 |
+
}
|
| 165 |
+
}
|
| 166 |
+
|
| 167 |
+
}
|
| 168 |
+
|
| 169 |
+
/**
|
| 170 |
+
* @param $store
|
| 171 |
+
* @param $email
|
| 172 |
+
* @return array
|
| 173 |
+
*/
|
| 174 |
+
protected function _createNewCoupon($store,$email)
|
| 175 |
+
{
|
| 176 |
+
$couponamount = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::COUPON_AMOUNT, $store);
|
| 177 |
+
$couponexpiredays = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::COUPON_EXPIRE, $store);
|
| 178 |
+
$coupontype = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::COUPON_TYPE, $store);
|
| 179 |
+
$couponlength = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::COUPON_LENGTH, $store);
|
| 180 |
+
$couponlabel = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::COUPON_LABEL, $store);
|
| 181 |
+
$websiteid = Mage::getModel('core/store')->load($store)->getWebsiteId();
|
| 182 |
+
|
| 183 |
+
$fromDate = date("Y-m-d");
|
| 184 |
+
$toDate = date('Y-m-d', strtotime($fromDate. " + $couponexpiredays day"));
|
| 185 |
+
if($coupontype == 1) {
|
| 186 |
+
$action = 'cart_fixed';
|
| 187 |
+
$discount = Mage::app()->getStore($store)->getCurrentCurrencyCode()."$couponamount";
|
| 188 |
+
}
|
| 189 |
+
elseif($coupontype == 2) {
|
| 190 |
+
$action = 'by_percent';
|
| 191 |
+
$discount = "$couponamount%";
|
| 192 |
+
}
|
| 193 |
+
$customer_group = new Mage_Customer_Model_Group();
|
| 194 |
+
$allGroups = $customer_group->getCollection()->toOptionHash();
|
| 195 |
+
$groups = array();
|
| 196 |
+
foreach($allGroups as $groupid=>$name) {
|
| 197 |
+
$groups[] = $groupid;
|
| 198 |
+
}
|
| 199 |
+
$coupon_rule = Mage::getModel('salesrule/rule');
|
| 200 |
+
$coupon_rule->setName("Abandoned coupon $email")
|
| 201 |
+
->setDescription("Abandoned coupon $email")
|
| 202 |
+
->setFromDate($fromDate)
|
| 203 |
+
->setToDate($toDate)
|
| 204 |
+
->setIsActive(1)
|
| 205 |
+
->setCouponType(2)
|
| 206 |
+
->setUsesPerCoupon(1)
|
| 207 |
+
->setUsesPerCustomer(1)
|
| 208 |
+
->setCustomerGroupIds($groups)
|
| 209 |
+
->setProductIds('')
|
| 210 |
+
->setLengthMin($couponlength)
|
| 211 |
+
->setLengthMax($couponlength)
|
| 212 |
+
->setSortOrder(0)
|
| 213 |
+
->setStoreLabels(array($couponlabel))
|
| 214 |
+
->setSimpleAction($action)
|
| 215 |
+
->setDiscountAmount($couponamount)
|
| 216 |
+
->setDiscountQty(0)
|
| 217 |
+
->setDiscountStep('0')
|
| 218 |
+
->setSimpleFreeShipping('0')
|
| 219 |
+
->setApplyToShipping('0')
|
| 220 |
+
->setIsRss(0)
|
| 221 |
+
->setWebsiteIds($websiteid);
|
| 222 |
+
$uniqueId = Mage::getSingleton('salesrule/coupon_codegenerator', array('length' => $couponlength))->generateCode();
|
| 223 |
+
$coupon_rule->setCouponCode($uniqueId);
|
| 224 |
+
$coupon_rule->save();
|
| 225 |
+
return array($uniqueId,$discount,$toDate);
|
| 226 |
+
}
|
| 227 |
+
|
| 228 |
+
/**
|
| 229 |
+
* @param $interval
|
| 230 |
+
* @param $unit
|
| 231 |
+
* @return string
|
| 232 |
+
*/
|
| 233 |
+
function _getIntervalUnitSql($interval, $unit)
|
| 234 |
+
{
|
| 235 |
+
return sprintf('INTERVAL %d %s', $interval, $unit);
|
| 236 |
+
}
|
| 237 |
+
|
| 238 |
+
/**
|
| 239 |
+
* @return string
|
| 240 |
+
*/
|
| 241 |
+
function _getSuggestedZeroDate()
|
| 242 |
+
{
|
| 243 |
+
return '0000-00-00 00:00:00';
|
| 244 |
+
}
|
| 245 |
+
protected function _isSubscribed($email,$list,$storeId)
|
| 246 |
+
{
|
| 247 |
+
$collection = Mage::getModel('ebizmarts_autoresponder/unsubscribe')->getCollection();
|
| 248 |
+
$collection->addFieldtoFilter('main_table.email',array('eq'=>$email))
|
| 249 |
+
->addFieldtoFilter('main_table.list',array('eq'=>$list))
|
| 250 |
+
->addFieldtoFilter('main_table.store_id',array('eq'=>$storeId));
|
| 251 |
+
return $collection->getSize() == 0;
|
| 252 |
+
}
|
| 253 |
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Author : Ebizmarts <info@ebizmarts.com>
|
| 4 |
+
* Date : 7/15/13
|
| 5 |
+
* Time : 1:21 PM
|
| 6 |
+
* File : MailsSent.php
|
| 7 |
+
* Module : Ebizmarts_Magemonkey
|
| 8 |
+
*/
|
| 9 |
+
class Ebizmarts_AbandonedCart_Model_Mailssent extends Mage_Core_Model_Abstract
|
| 10 |
+
{
|
| 11 |
+
public function _construct() {
|
| 12 |
+
$this->_init('ebizmarts_abandonedcart/mailssent');
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Author : Ebizmarts <info@ebizmarts.com>
|
| 4 |
+
* Date : 7/15/13
|
| 5 |
+
* Time : 1:24 PM
|
| 6 |
+
* File : MailsSent.php
|
| 7 |
+
* Module : Ebizmarts_Magemonkey
|
| 8 |
+
*/
|
| 9 |
+
class Ebizmarts_AbandonedCart_Model_Resource_Mailssent extends Mage_Core_Model_Mysql4_Abstract
|
| 10 |
+
{
|
| 11 |
+
public function _construct()
|
| 12 |
+
{
|
| 13 |
+
$this->_init('ebizmarts_abandonedcart/mailssent','id');
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Author : Ebizmarts <info@ebizmarts.com>
|
| 4 |
+
* Date : 7/15/13
|
| 5 |
+
* Time : 1:26 PM
|
| 6 |
+
* File : Collection.php
|
| 7 |
+
* Module : Ebizmarts_Magemonkey
|
| 8 |
+
*/
|
| 9 |
+
class Ebizmarts_AbandonedCart_Model_Resource_Mailssent_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
| 10 |
+
{
|
| 11 |
+
protected function _construct()
|
| 12 |
+
{
|
| 13 |
+
$this->_init('ebizmarts_abandonedcart/mailssent');
|
| 14 |
+
}
|
| 15 |
+
}
|
| 16 |
+
|
|
@@ -0,0 +1,193 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Created by Ebizmarts
|
| 4 |
+
* User: gonzalo@ebizmarts.com
|
| 5 |
+
* Date: 1/21/13
|
| 6 |
+
* Time: 3:26 PM
|
| 7 |
+
*/
|
| 8 |
+
|
| 9 |
+
class Ebizmarts_AbandonedCart_Model_Resource_Order_Collection extends Mage_Reports_Model_Mysql4_Order_Collection
|
| 10 |
+
{
|
| 11 |
+
/**
|
| 12 |
+
* @param string $period
|
| 13 |
+
* @return Ebizmarts_AbandonedCart_Model_Resource_Order_Collection|Mage_Reports_Model_Resource_Order_Collection
|
| 14 |
+
*/
|
| 15 |
+
public function addCreateAtPeriodFilter($period)
|
| 16 |
+
{
|
| 17 |
+
list($from, $to) = $this->getDateRange($period, 0, 0, true);
|
| 18 |
+
|
| 19 |
+
$this->checkIsLive($period);
|
| 20 |
+
|
| 21 |
+
if ($this->isLive()) {
|
| 22 |
+
$fieldToFilter = 'main_table.created_at';
|
| 23 |
+
} else {
|
| 24 |
+
$fieldToFilter = 'period';
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
$this->addFieldToFilter($fieldToFilter, array(
|
| 28 |
+
'from' => $from->toString(Varien_Date::DATETIME_INTERNAL_FORMAT),
|
| 29 |
+
'to' => $to->toString(Varien_Date::DATETIME_INTERNAL_FORMAT)
|
| 30 |
+
));
|
| 31 |
+
|
| 32 |
+
return $this;
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
/**
|
| 36 |
+
* @param int $isFilter
|
| 37 |
+
* @return Ebizmarts_AbandonedCart_Model_Resource_Order_Collection|Mage_Reports_Model_Resource_Order_Collection
|
| 38 |
+
*/
|
| 39 |
+
public function calculateSales($isFilter = 0)
|
| 40 |
+
{
|
| 41 |
+
$statuses = Mage::getSingleton('sales/config')
|
| 42 |
+
->getOrderStatusesForState(Mage_Sales_Model_Order::STATE_CANCELED);
|
| 43 |
+
|
| 44 |
+
if (empty($statuses)) {
|
| 45 |
+
$statuses = array(0);
|
| 46 |
+
}
|
| 47 |
+
$adapter = $this->getConnection();
|
| 48 |
+
|
| 49 |
+
if (Mage::getStoreConfig('sales/dashboard/use_aggregated_data')==8) {
|
| 50 |
+
$this->setMainTable('sales/order_aggregated_created');
|
| 51 |
+
$this->removeAllFieldsFromSelect();
|
| 52 |
+
$averageExpr = $adapter->getCheckSql(
|
| 53 |
+
'SUM(main_table.orders_count) > 0',
|
| 54 |
+
'SUM(main_table.total_revenue_amount)/SUM(main_table.orders_count)',
|
| 55 |
+
0);
|
| 56 |
+
$this->getSelect()->columns(array(
|
| 57 |
+
'lifetime' => 'SUM(main_table.total_revenue_amount)',
|
| 58 |
+
'average' => $averageExpr
|
| 59 |
+
));
|
| 60 |
+
|
| 61 |
+
if (!$isFilter) {
|
| 62 |
+
$this->addFieldToFilter('main_table.store_id',
|
| 63 |
+
array('eq' => Mage::app()->getStore(Mage_Core_Model_Store::ADMIN_CODE)->getId())
|
| 64 |
+
);
|
| 65 |
+
}
|
| 66 |
+
$this->getSelect()->where('main_table.order_status NOT IN(?)', $statuses);
|
| 67 |
+
} else {
|
| 68 |
+
$this->setMainTable('sales/order');
|
| 69 |
+
$this->removeAllFieldsFromSelect();
|
| 70 |
+
if(version_compare(Mage::getVersion(), '1.6.0.0')==1) {
|
| 71 |
+
$expr = 'IFNULL(main_table.base_subtotal, 0) - IFNULL(main_table.base_subtotal_refunded, 0)'
|
| 72 |
+
. ' - IFNULL(main_table.base_subtotal_canceled, 0) - ABS(IFNULL(main_table.base_discount_amount, 0))'
|
| 73 |
+
. ' + IFNULL(main_table.base_discount_refunded, 0)';
|
| 74 |
+
}
|
| 75 |
+
else {
|
| 76 |
+
$expr = sprintf('%s - %s - %s - (%s - %s - %s)',
|
| 77 |
+
$adapter->getIfNullSql('main_table.base_total_invoiced', 0),
|
| 78 |
+
$adapter->getIfNullSql('main_table.base_tax_invoiced', 0),
|
| 79 |
+
$adapter->getIfNullSql('main_table.base_shipping_invoiced', 0),
|
| 80 |
+
$adapter->getIfNullSql('main_table.base_total_refunded', 0),
|
| 81 |
+
$adapter->getIfNullSql('main_table.base_tax_refunded', 0),
|
| 82 |
+
$adapter->getIfNullSql('main_table.base_shipping_refunded', 0)
|
| 83 |
+
);
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
if ($isFilter == 0) {
|
| 87 |
+
$expr = '(' . $expr . ') * main_table.base_to_global_rate';
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
$this->getSelect()
|
| 91 |
+
->columns(array(
|
| 92 |
+
'lifetime' => "SUM({$expr})",
|
| 93 |
+
'average' => "AVG({$expr})"
|
| 94 |
+
))
|
| 95 |
+
->where('main_table.status NOT IN(?)', $statuses)
|
| 96 |
+
->where('main_table.state NOT IN(?)', array(
|
| 97 |
+
Mage_Sales_Model_Order::STATE_NEW,
|
| 98 |
+
Mage_Sales_Model_Order::STATE_PENDING_PAYMENT)
|
| 99 |
+
);
|
| 100 |
+
}
|
| 101 |
+
return $this;
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
/**
|
| 105 |
+
* @param string $range
|
| 106 |
+
* @param string $customStart
|
| 107 |
+
* @param string $customEnd
|
| 108 |
+
* @param bool $returnObjects
|
| 109 |
+
* @return array
|
| 110 |
+
*/
|
| 111 |
+
public function getDateRange($range, $customStart, $customEnd, $returnObjects = false)
|
| 112 |
+
{
|
| 113 |
+
$dateEnd = Mage::app()->getLocale()->date();
|
| 114 |
+
$dateStart = clone $dateEnd;
|
| 115 |
+
|
| 116 |
+
// go to the end of a day
|
| 117 |
+
$dateEnd->setHour(23);
|
| 118 |
+
$dateEnd->setMinute(59);
|
| 119 |
+
$dateEnd->setSecond(59);
|
| 120 |
+
|
| 121 |
+
$dateStart->setHour(0);
|
| 122 |
+
$dateStart->setMinute(0);
|
| 123 |
+
$dateStart->setSecond(0);
|
| 124 |
+
|
| 125 |
+
switch ($range)
|
| 126 |
+
{
|
| 127 |
+
case '24h':
|
| 128 |
+
$dateEnd = Mage::app()->getLocale()->date();
|
| 129 |
+
$dateEnd->addHour(1);
|
| 130 |
+
$dateStart = clone $dateEnd;
|
| 131 |
+
$dateStart->subDay(1);
|
| 132 |
+
break;
|
| 133 |
+
|
| 134 |
+
case '7d':
|
| 135 |
+
// substract 6 days we need to include
|
| 136 |
+
// only today and not hte last one from range
|
| 137 |
+
$dateStart->subDay(6);
|
| 138 |
+
break;
|
| 139 |
+
case '30d':
|
| 140 |
+
$dateEnd = Mage::app()->getLocale()->date();
|
| 141 |
+
$dateEnd->addHour(1);
|
| 142 |
+
$dateStart = clone $dateEnd;
|
| 143 |
+
$dateStart->subMonth(1);
|
| 144 |
+
break;
|
| 145 |
+
case '60d':
|
| 146 |
+
$dateEnd = Mage::app()->getLocale()->date();
|
| 147 |
+
$dateEnd->addHour(1);
|
| 148 |
+
$dateStart = clone $dateEnd;
|
| 149 |
+
$dateStart->subMonth(2);
|
| 150 |
+
break;
|
| 151 |
+
case '90d':
|
| 152 |
+
$dateEnd = Mage::app()->getLocale()->date();
|
| 153 |
+
$dateEnd->addHour(1);
|
| 154 |
+
$dateStart = clone $dateEnd;
|
| 155 |
+
$dateStart->subMonth(3);
|
| 156 |
+
break;
|
| 157 |
+
|
| 158 |
+
case '1m':
|
| 159 |
+
$dateStart->setDay(Mage::getStoreConfig('reports/dashboard/mtd_start'));
|
| 160 |
+
break;
|
| 161 |
+
case 'custom':
|
| 162 |
+
$dateStart = $customStart ? $customStart : $dateEnd;
|
| 163 |
+
$dateEnd = $customEnd ? $customEnd : $dateEnd;
|
| 164 |
+
break;
|
| 165 |
+
|
| 166 |
+
case '1y':
|
| 167 |
+
case '2y':
|
| 168 |
+
case 'lifetime':
|
| 169 |
+
$startMonthDay = explode(',', Mage::getStoreConfig('reports/dashboard/ytd_start'));
|
| 170 |
+
$startMonth = isset($startMonthDay[0]) ? (int)$startMonthDay[0] : 1;
|
| 171 |
+
$startDay = isset($startMonthDay[1]) ? (int)$startMonthDay[1] : 1;
|
| 172 |
+
$dateStart->setMonth($startMonth);
|
| 173 |
+
$dateStart->setDay($startDay);
|
| 174 |
+
if ($range == '2y') {
|
| 175 |
+
$dateStart->subYear(1);
|
| 176 |
+
}
|
| 177 |
+
elseif($range == 'lifetime') {
|
| 178 |
+
$dateStart->subYear(1000);
|
| 179 |
+
}
|
| 180 |
+
break;
|
| 181 |
+
}
|
| 182 |
+
|
| 183 |
+
$dateStart->setTimezone('Etc/UTC');
|
| 184 |
+
$dateEnd->setTimezone('Etc/UTC');
|
| 185 |
+
|
| 186 |
+
if ($returnObjects) {
|
| 187 |
+
return array($dateStart, $dateEnd);
|
| 188 |
+
} else {
|
| 189 |
+
return array('from' => $dateStart, 'to' => $dateEnd, 'datetime' => true);
|
| 190 |
+
}
|
| 191 |
+
}
|
| 192 |
+
|
| 193 |
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Created by Ebizmarts
|
| 4 |
+
* User: gonzalo@ebizmarts.com
|
| 5 |
+
* Date: 3/20/13
|
| 6 |
+
* Time: 4:07 PM
|
| 7 |
+
*/
|
| 8 |
+
class Ebizmarts_AbandonedCart_Model_System_Config_Automatic
|
| 9 |
+
{
|
| 10 |
+
/**
|
| 11 |
+
* @return array
|
| 12 |
+
*/
|
| 13 |
+
public function toOptionArray()
|
| 14 |
+
{
|
| 15 |
+
$options = array(
|
| 16 |
+
array('value'=> 1, 'label' => Mage::helper('ebizmarts_abandonedcart')->__('Specific')),
|
| 17 |
+
array('value'=> 2, 'label' => Mage::helper('ebizmarts_abandonedcart')->__('Automatic'))
|
| 18 |
+
);
|
| 19 |
+
return $options;
|
| 20 |
+
}
|
| 21 |
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Author : Ebizmarts <info@ebizmarts.com>
|
| 4 |
+
* Date : 5/3/13
|
| 5 |
+
* Time : 12:47 PM
|
| 6 |
+
* File : Customergroup.php
|
| 7 |
+
* Module : Ebizmarts_Magemonkey
|
| 8 |
+
*/
|
| 9 |
+
class Ebizmarts_AbandonedCart_Model_System_Config_Customergroup
|
| 10 |
+
{
|
| 11 |
+
protected $_options;
|
| 12 |
+
|
| 13 |
+
public function toOptionArray()
|
| 14 |
+
{
|
| 15 |
+
if (!$this->_options) {
|
| 16 |
+
$this->_options = Mage::getResourceModel('customer/group_collection')
|
| 17 |
+
->loadData()->toOptionArray();
|
| 18 |
+
}
|
| 19 |
+
return $this->_options;
|
| 20 |
+
}
|
| 21 |
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class Ebizmarts_AbandonedCart_Model_System_Config_Discounttype
|
| 4 |
+
{
|
| 5 |
+
/**
|
| 6 |
+
* @return array
|
| 7 |
+
*/
|
| 8 |
+
public function toOptionArray()
|
| 9 |
+
{
|
| 10 |
+
$options = array(
|
| 11 |
+
array('value'=> 1, 'label' => Mage::helper('ebizmarts_abandonedcart')->__('Fixed amount')),
|
| 12 |
+
array('value'=> 2, 'label' => Mage::helper('ebizmarts_abandonedcart')->__('Percentage'))
|
| 13 |
+
);
|
| 14 |
+
return $options;
|
| 15 |
+
}
|
| 16 |
+
public function options()
|
| 17 |
+
{
|
| 18 |
+
$options[1] = Mage::helper('ebizmarts_abandonedcart')->__('Fixed amount');
|
| 19 |
+
$options[2] = Mage::helper('ebizmarts_abandonedcart')->__('Percentage');
|
| 20 |
+
return $options;
|
| 21 |
+
}
|
| 22 |
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Created by Ebizmarts
|
| 4 |
+
* User: gonzalo@ebizmarts.com
|
| 5 |
+
* Date: 4/8/13
|
| 6 |
+
* Time: 11:46 AM
|
| 7 |
+
*/
|
| 8 |
+
class Ebizmarts_AbandonedCart_Model_System_Config_Unit
|
| 9 |
+
{
|
| 10 |
+
public function toOptionArray()
|
| 11 |
+
{
|
| 12 |
+
$options = array(
|
| 13 |
+
array('value'=> Ebizmarts_AbandonedCart_Model_Config::IN_DAYS, 'label' => Mage::helper('ebizmarts_abandonedcart')->__('Days')),
|
| 14 |
+
array('value'=> Ebizmarts_AbandonedCart_Model_Config::IN_HOURS, 'label' => Mage::helper('ebizmarts_abandonedcart')->__('Hours'))
|
| 15 |
+
);
|
| 16 |
+
return $options;
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
require_once Mage::getModuleDir('controllers','Mage_Checkout').DS.'CartController.php';
|
| 4 |
+
|
| 5 |
+
class Ebizmarts_AbandonedCart_AbandonedController extends Mage_Checkout_CartController
|
| 6 |
+
{
|
| 7 |
+
/**
|
| 8 |
+
*
|
| 9 |
+
*/
|
| 10 |
+
public function loadquoteAction()
|
| 11 |
+
{
|
| 12 |
+
$params = $this->getRequest()->getParams();
|
| 13 |
+
if(isset($params['id']))
|
| 14 |
+
{
|
| 15 |
+
//restore the quote
|
| 16 |
+
// Mage::log($params['id']);
|
| 17 |
+
|
| 18 |
+
$quote = Mage::getModel('sales/quote')->load($params['id']);
|
| 19 |
+
$quote->setEbizmartsAbandonedcartFlag(1);
|
| 20 |
+
$quote->save();
|
| 21 |
+
if(!$quote->getCustomerId()) {
|
| 22 |
+
$this->_getSession()->setQuoteId($quote->getId());
|
| 23 |
+
$this->_redirect('checkout/cart');
|
| 24 |
+
}
|
| 25 |
+
else {
|
| 26 |
+
if(Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::AUTOLOGIN,$quote->getStoreId())) {
|
| 27 |
+
$customer = Mage::getModel('customer/customer')->load($quote->getCustomerId());
|
| 28 |
+
if($customer->getId())
|
| 29 |
+
{
|
| 30 |
+
Mage::getSingleton('customer/session')->setCustomerAsLoggedIn($customer);
|
| 31 |
+
}
|
| 32 |
+
$this->_redirect('checkout/cart');
|
| 33 |
+
}
|
| 34 |
+
else {
|
| 35 |
+
if(Mage::helper('customer')->isLoggedIn()) {
|
| 36 |
+
$this->_redirect('checkout/cart');
|
| 37 |
+
}
|
| 38 |
+
else {
|
| 39 |
+
Mage::getSingleton('customer/session')->addNotice("Login to complete your order");
|
| 40 |
+
$this->_redirect('customer/account');
|
| 41 |
+
}
|
| 42 |
+
}
|
| 43 |
+
}
|
| 44 |
+
}
|
| 45 |
+
// $this->_redirect('checkout/cart');
|
| 46 |
+
}
|
| 47 |
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Author : Ebizmarts <info@ebizmarts.com>
|
| 4 |
+
* Date : 5/7/13
|
| 5 |
+
* Time : 11:33 PM
|
| 6 |
+
* File : AbandonedmailsController.php
|
| 7 |
+
* Module : Ebizmarts_Magemonkey
|
| 8 |
+
*/
|
| 9 |
+
class Ebizmarts_AbandonedCart_Adminhtml_AbandonedmailsController extends Mage_Adminhtml_Controller_Action
|
| 10 |
+
{
|
| 11 |
+
/**
|
| 12 |
+
*
|
| 13 |
+
*/
|
| 14 |
+
public function indexAction()
|
| 15 |
+
{
|
| 16 |
+
// Let's call our initAction method which will set some basic params for each action
|
| 17 |
+
$this->_initAction()
|
| 18 |
+
->renderLayout();
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
/**
|
| 22 |
+
* @return Ebizmarts_AbandonedCart_Adminhtml_AbandonedorderController
|
| 23 |
+
*/
|
| 24 |
+
protected function _initAction()
|
| 25 |
+
{
|
| 26 |
+
$this->loadLayout()
|
| 27 |
+
// Make the active menu match the menu config nodes (without 'children' inbetween)
|
| 28 |
+
->_setActiveMenu('newsletter/ebizmarts_emails')
|
| 29 |
+
->_title($this->__('Newsletter'))->_title($this->__('Emails Sent'))
|
| 30 |
+
->_addBreadcrumb($this->__('Newsletter'), $this->__('Newsletter'))
|
| 31 |
+
->_addBreadcrumb($this->__('abandonedorder'), $this->__('Mails'));
|
| 32 |
+
|
| 33 |
+
return $this;
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
/**
|
| 37 |
+
*
|
| 38 |
+
*/
|
| 39 |
+
public function exportCsvAction()
|
| 40 |
+
{
|
| 41 |
+
$fileName = 'orders.csv';
|
| 42 |
+
$grid = $this->getLayout()->createBlock('ebizmarts_abandonedcart/adminhtml_abandonedmails_grid');
|
| 43 |
+
$this->_prepareDownloadResponse($fileName, $grid->getCsvFile());
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
/**
|
| 47 |
+
* Export order grid to Excel XML format
|
| 48 |
+
*/
|
| 49 |
+
public function exportExcelAction()
|
| 50 |
+
{
|
| 51 |
+
$fileName = 'orders.xml';
|
| 52 |
+
$grid = $this->getLayout()->createBlock('ebizmarts_abandonedcart/adminhtml_abandonedmails_grid');
|
| 53 |
+
$this->_prepareDownloadResponse($fileName, $grid->getExcelFile($fileName));
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
/**
|
| 57 |
+
*
|
| 58 |
+
*/
|
| 59 |
+
public function gridAction()
|
| 60 |
+
{
|
| 61 |
+
$this->loadLayout(false);
|
| 62 |
+
$this->renderLayout();
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
/**
|
| 66 |
+
*
|
| 67 |
+
*/
|
| 68 |
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Created by Ebizmarts
|
| 4 |
+
* User: gonzalo@ebizmarts.com
|
| 5 |
+
* Date: 1/16/13
|
| 6 |
+
* Time: 2:22 PM
|
| 7 |
+
*/
|
| 8 |
+
|
| 9 |
+
class Ebizmarts_AbandonedCart_Adminhtml_AbandonedorderController extends Mage_Adminhtml_Controller_Action
|
| 10 |
+
{
|
| 11 |
+
/**
|
| 12 |
+
*
|
| 13 |
+
*/
|
| 14 |
+
public function indexAction()
|
| 15 |
+
{
|
| 16 |
+
// Let's call our initAction method which will set some basic params for each action
|
| 17 |
+
$this->_initAction()
|
| 18 |
+
->renderLayout();
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
/**
|
| 22 |
+
* @return Ebizmarts_AbandonedCart_Adminhtml_AbandonedorderController
|
| 23 |
+
*/
|
| 24 |
+
protected function _initAction()
|
| 25 |
+
{
|
| 26 |
+
$this->loadLayout()
|
| 27 |
+
// Make the active menu match the menu config nodes (without 'children' inbetween)
|
| 28 |
+
->_setActiveMenu('sales/ebizmarts_abandonedcart')
|
| 29 |
+
->_title($this->__('Sales'))->_title($this->__('Abandoned'))
|
| 30 |
+
->_addBreadcrumb($this->__('Sales'), $this->__('Sales'))
|
| 31 |
+
->_addBreadcrumb($this->__('abandonedorder'), $this->__('Abandoned'));
|
| 32 |
+
|
| 33 |
+
return $this;
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
/**
|
| 37 |
+
*
|
| 38 |
+
*/
|
| 39 |
+
public function exportCsvAction()
|
| 40 |
+
{
|
| 41 |
+
$fileName = 'orders.csv';
|
| 42 |
+
$grid = $this->getLayout()->createBlock('ebizmarts_abandonedcart/adminhtml_abandonedorder_grid');
|
| 43 |
+
$this->_prepareDownloadResponse($fileName, $grid->getCsvFile());
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
/**
|
| 47 |
+
* Export order grid to Excel XML format
|
| 48 |
+
*/
|
| 49 |
+
public function exportExcelAction()
|
| 50 |
+
{
|
| 51 |
+
$fileName = 'orders.xml';
|
| 52 |
+
$grid = $this->getLayout()->createBlock('ebizmarts_abandonedcart/adminhtml_abandonedorder_grid');
|
| 53 |
+
$this->_prepareDownloadResponse($fileName, $grid->getExcelFile($fileName));
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
/**
|
| 57 |
+
*
|
| 58 |
+
*/
|
| 59 |
+
public function gridAction()
|
| 60 |
+
{
|
| 61 |
+
$this->loadLayout(false);
|
| 62 |
+
$this->renderLayout();
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
/**
|
| 66 |
+
*
|
| 67 |
+
*/
|
| 68 |
+
public function dashboardAction()
|
| 69 |
+
{
|
| 70 |
+
// $this->_initAction()
|
| 71 |
+
// ->renderLayout();
|
| 72 |
+
$this->loadLayout()
|
| 73 |
+
->_setActiveMenu('dashboard/ebizmarts_abandonedcart')
|
| 74 |
+
->_title($this->__('Dashboard'))->_title($this->__('Abandoned'))
|
| 75 |
+
->_addBreadcrumb($this->__('Dashboard'), $this->__('Dashboard'))
|
| 76 |
+
->_addBreadcrumb($this->__('abandonedorder'), $this->__('Abandoned'))
|
| 77 |
+
->renderLayout();
|
| 78 |
+
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
/**
|
| 82 |
+
*
|
| 83 |
+
*/
|
| 84 |
+
public function ajaxBlockAction()
|
| 85 |
+
{
|
| 86 |
+
$output = '';
|
| 87 |
+
$blockTab = $this->getRequest()->getParam('block');
|
| 88 |
+
if ($blockTab =='totals') {
|
| 89 |
+
$output = $this->getLayout()->createBlock('ebizmarts_abandonedcart/adminhtml_dashboard_' . $blockTab)->toHtml();
|
| 90 |
+
}
|
| 91 |
+
$this->getResponse()->setBody($output);
|
| 92 |
+
return;
|
| 93 |
+
}
|
| 94 |
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
+
<config>
|
| 3 |
+
<menu>
|
| 4 |
+
<sales>
|
| 5 |
+
<children>
|
| 6 |
+
<ebizmarts_abandonedcart translate="title" module="ebizmarts_abandonedcart">
|
| 7 |
+
<title>Abandoned Cart Orders</title>
|
| 8 |
+
<sort_order>800</sort_order>
|
| 9 |
+
<action>adminhtml/abandonedorder/index</action>
|
| 10 |
+
</ebizmarts_abandonedcart>
|
| 11 |
+
</children>
|
| 12 |
+
</sales>
|
| 13 |
+
<newsletter>
|
| 14 |
+
<children>
|
| 15 |
+
<magemonkey>
|
| 16 |
+
<children>
|
| 17 |
+
<ebizmarts_emails translate="title" module="ebizmarts_abandonedcart">
|
| 18 |
+
<title>Emails Sent</title>
|
| 19 |
+
<sort_order>810</sort_order>
|
| 20 |
+
<action>adminhtml/abandonedmails/index</action>
|
| 21 |
+
</ebizmarts_emails>
|
| 22 |
+
</children>
|
| 23 |
+
</magemonkey>
|
| 24 |
+
</children>
|
| 25 |
+
</newsletter>
|
| 26 |
+
<dashboard>
|
| 27 |
+
<children>
|
| 28 |
+
<ebizmarts_abandonedcart translate="title" module="ebizmarts_abandonedcart">
|
| 29 |
+
<title>Abandoned Cart Dashboard</title>
|
| 30 |
+
<sort_order>800</sort_order>
|
| 31 |
+
<!--depends>
|
| 32 |
+
<module>Ebizmarts_Mandrill</module>
|
| 33 |
+
</depends-->
|
| 34 |
+
<action>adminhtml/abandonedorder/dashboard</action>
|
| 35 |
+
</ebizmarts_abandonedcart>
|
| 36 |
+
</children>
|
| 37 |
+
</dashboard>
|
| 38 |
+
</menu>
|
| 39 |
+
<acl>
|
| 40 |
+
<resources>
|
| 41 |
+
<admin>
|
| 42 |
+
<children>
|
| 43 |
+
<system>
|
| 44 |
+
<children>
|
| 45 |
+
<config>
|
| 46 |
+
<children>
|
| 47 |
+
<ebizmarts_abandonedcart translate="title" module="ebizmarts_abandonedcart">
|
| 48 |
+
<title>Ebizmarts Abandoned Cart</title>
|
| 49 |
+
</ebizmarts_abandonedcart>
|
| 50 |
+
<ebizmarts_emails translate="title" module="ebizmarts_abandonedcart">
|
| 51 |
+
<title>Ebizmarts Emails</title>
|
| 52 |
+
</ebizmarts_emails>
|
| 53 |
+
</children>
|
| 54 |
+
</config>
|
| 55 |
+
</children>
|
| 56 |
+
</system>
|
| 57 |
+
</children>
|
| 58 |
+
</admin>
|
| 59 |
+
</resources>
|
| 60 |
+
</acl>
|
| 61 |
+
<translate>
|
| 62 |
+
<modules>
|
| 63 |
+
<Ebizmarts_AbandonedCart>
|
| 64 |
+
<files>
|
| 65 |
+
<default>Ebizmarts_AbandonedCart.csv</default>
|
| 66 |
+
</files>
|
| 67 |
+
</Ebizmarts_AbandonedCart>
|
| 68 |
+
</modules>
|
| 69 |
+
</translate>
|
| 70 |
+
</config>
|
|
@@ -0,0 +1,132 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<Ebizmarts_AbandonedCart>
|
| 5 |
+
<version>0.1.20</version>
|
| 6 |
+
</Ebizmarts_AbandonedCart>
|
| 7 |
+
</modules>
|
| 8 |
+
<global>
|
| 9 |
+
<template>
|
| 10 |
+
<email>
|
| 11 |
+
<ebizmarts_abandonedcart_general_template translate="label" module="ebizmarts_abandonedcart">
|
| 12 |
+
<label>Abandoned Cart Mail</label>
|
| 13 |
+
<file>sales/abandoned_cart.html</file>
|
| 14 |
+
<type>html</type>
|
| 15 |
+
</ebizmarts_abandonedcart_general_template>
|
| 16 |
+
</email>
|
| 17 |
+
</template>
|
| 18 |
+
<ebizmarts_abandonedcart>
|
| 19 |
+
<mandrill-tag>AbandonedCart</mandrill-tag>
|
| 20 |
+
</ebizmarts_abandonedcart>
|
| 21 |
+
<models>
|
| 22 |
+
<ebizmarts_abandonedcart>
|
| 23 |
+
<class>Ebizmarts_AbandonedCart_Model</class>
|
| 24 |
+
<resourceModel>ebizmarts_abandonedcart_resource</resourceModel>
|
| 25 |
+
</ebizmarts_abandonedcart>
|
| 26 |
+
<ebizmarts_abandonedcart_resource>
|
| 27 |
+
<class>Ebizmarts_AbandonedCart_Model_Resource</class>
|
| 28 |
+
<deprecatedNode>ebizmarts_abandonedcart_mysql4</deprecatedNode>
|
| 29 |
+
<entities>
|
| 30 |
+
<mailssent>
|
| 31 |
+
<table>magemonkey_mails_sent</table>
|
| 32 |
+
</mailssent>
|
| 33 |
+
</entities>
|
| 34 |
+
</ebizmarts_abandonedcart_resource>
|
| 35 |
+
</models>
|
| 36 |
+
<blocks>
|
| 37 |
+
<ebizmarts_abandonedcart>
|
| 38 |
+
<class>Ebizmarts_AbandonedCart_Block</class>
|
| 39 |
+
</ebizmarts_abandonedcart>
|
| 40 |
+
</blocks>
|
| 41 |
+
<helpers>
|
| 42 |
+
<ebizmarts_abandonedcart>
|
| 43 |
+
<class>Ebizmarts_AbandonedCart_Helper</class>
|
| 44 |
+
</ebizmarts_abandonedcart>
|
| 45 |
+
</helpers>
|
| 46 |
+
<resources>
|
| 47 |
+
<ebizmarts_abandonedcart_setup>
|
| 48 |
+
<setup>
|
| 49 |
+
<module>Ebizmarts_AbandonedCart</module>
|
| 50 |
+
</setup>
|
| 51 |
+
</ebizmarts_abandonedcart_setup>
|
| 52 |
+
</resources>
|
| 53 |
+
<fieldsets>
|
| 54 |
+
<sales_convert_quote>
|
| 55 |
+
<ebizmarts_abandonedcart_flag>
|
| 56 |
+
<to_order>*</to_order>
|
| 57 |
+
</ebizmarts_abandonedcart_flag>
|
| 58 |
+
</sales_convert_quote>
|
| 59 |
+
</fieldsets>
|
| 60 |
+
</global>
|
| 61 |
+
|
| 62 |
+
<admin>
|
| 63 |
+
<routers>
|
| 64 |
+
<adminhtml>
|
| 65 |
+
<args>
|
| 66 |
+
<modules>
|
| 67 |
+
<Ebizmarts_Abandonedcart before="Mage_Adminhtml">Ebizmarts_AbandonedCart_Adminhtml</Ebizmarts_Abandonedcart>
|
| 68 |
+
</modules>
|
| 69 |
+
</args>
|
| 70 |
+
</adminhtml>
|
| 71 |
+
</routers>
|
| 72 |
+
</admin>
|
| 73 |
+
|
| 74 |
+
<adminhtml>
|
| 75 |
+
<layout>
|
| 76 |
+
<updates>
|
| 77 |
+
<ebizmarts_abandonedcart>
|
| 78 |
+
<file>ebizmarts/abandonedcart.xml</file>
|
| 79 |
+
</ebizmarts_abandonedcart>
|
| 80 |
+
</updates>
|
| 81 |
+
</layout>
|
| 82 |
+
<translate>
|
| 83 |
+
<modules>
|
| 84 |
+
<Ebizmarts_AbandonedCart>
|
| 85 |
+
<files>
|
| 86 |
+
<default>Ebizmarts_AbandonedCart.csv</default>
|
| 87 |
+
</files>
|
| 88 |
+
</Ebizmarts_AbandonedCart>
|
| 89 |
+
</modules>
|
| 90 |
+
</translate>
|
| 91 |
+
</adminhtml>
|
| 92 |
+
|
| 93 |
+
<frontend>
|
| 94 |
+
<routers>
|
| 95 |
+
<ebizmarts_abandonedcart>
|
| 96 |
+
<use>standard</use>
|
| 97 |
+
<args>
|
| 98 |
+
<module>Ebizmarts_AbandonedCart</module>
|
| 99 |
+
<frontName>ebizmarts_abandonedcart</frontName>
|
| 100 |
+
</args>
|
| 101 |
+
</ebizmarts_abandonedcart>
|
| 102 |
+
</routers>
|
| 103 |
+
<layout>
|
| 104 |
+
<updates>
|
| 105 |
+
<ebizmarts_abandonedcart>
|
| 106 |
+
<file>ebizmarts/abandonedcart.xml</file>
|
| 107 |
+
</ebizmarts_abandonedcart>
|
| 108 |
+
</updates>
|
| 109 |
+
</layout>
|
| 110 |
+
</frontend>
|
| 111 |
+
<crontab>
|
| 112 |
+
<jobs>
|
| 113 |
+
<ebizmarts_abandoned_cart>
|
| 114 |
+
<schedule>
|
| 115 |
+
<cron_expr>0 */1 * * *</cron_expr>
|
| 116 |
+
</schedule>
|
| 117 |
+
<run>
|
| 118 |
+
<model>ebizmarts_abandonedcart/cron::abandoned</model>
|
| 119 |
+
</run>
|
| 120 |
+
</ebizmarts_abandoned_cart>
|
| 121 |
+
</jobs>
|
| 122 |
+
</crontab>
|
| 123 |
+
<default>
|
| 124 |
+
<ebizmarts_abandonedcart>
|
| 125 |
+
<general>
|
| 126 |
+
<subject>Abandoned Cart Email</subject>
|
| 127 |
+
<mandrill-tag>AbandonedCart</mandrill-tag>
|
| 128 |
+
<autologin>0</autologin>
|
| 129 |
+
</general>
|
| 130 |
+
</ebizmarts_abandonedcart>
|
| 131 |
+
</default>
|
| 132 |
+
</config>
|
|
@@ -0,0 +1,314 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<sections>
|
| 4 |
+
<ebizmarts_abandonedcart translate="label" module="ebizmarts_abandonedcart">
|
| 5 |
+
<label><![CDATA[Abandoned Carts Recovery]]></label>
|
| 6 |
+
<tab>monkey</tab>
|
| 7 |
+
<sort_order>300</sort_order>
|
| 8 |
+
<show_in_default>1</show_in_default>
|
| 9 |
+
<show_in_website>1</show_in_website>
|
| 10 |
+
<show_in_store>1</show_in_store>
|
| 11 |
+
<groups>
|
| 12 |
+
<hint>
|
| 13 |
+
<frontend_model>ebizmarts_abandonedcart/adminhtml_system_config_fieldset_hint</frontend_model>
|
| 14 |
+
<sort_order>0</sort_order>
|
| 15 |
+
<show_in_default>1</show_in_default>
|
| 16 |
+
<show_in_website>1</show_in_website>
|
| 17 |
+
<show_in_store>1</show_in_store>
|
| 18 |
+
</hint>
|
| 19 |
+
<general translate="label comment">
|
| 20 |
+
<label>General</label>
|
| 21 |
+
<sort_order>1</sort_order>
|
| 22 |
+
<frontend_type>text</frontend_type>
|
| 23 |
+
<show_in_default>1</show_in_default>
|
| 24 |
+
<show_in_website>1</show_in_website>
|
| 25 |
+
<show_in_store>1</show_in_store>
|
| 26 |
+
<fields>
|
| 27 |
+
<active translate="label">
|
| 28 |
+
<label>Enabled</label>
|
| 29 |
+
<frontend_type>select</frontend_type>
|
| 30 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 31 |
+
<sort_order>10</sort_order>
|
| 32 |
+
<show_in_default>1</show_in_default>
|
| 33 |
+
<show_in_website>1</show_in_website>
|
| 34 |
+
<show_in_store>1</show_in_store>
|
| 35 |
+
</active>
|
| 36 |
+
<log translate="label">
|
| 37 |
+
<label>Log activated</label>
|
| 38 |
+
<frontend_type>select</frontend_type>
|
| 39 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 40 |
+
<sort_order>11</sort_order>
|
| 41 |
+
<show_in_default>1</show_in_default>
|
| 42 |
+
<show_in_website>1</show_in_website>
|
| 43 |
+
<show_in_store>1</show_in_store>
|
| 44 |
+
<depends>
|
| 45 |
+
<active>1</active>
|
| 46 |
+
</depends>
|
| 47 |
+
</log>
|
| 48 |
+
<firstdate translate="label">
|
| 49 |
+
<label>First date</label>
|
| 50 |
+
<frontend_type>date</frontend_type>
|
| 51 |
+
<frontend_model>ebizmarts_abandonedcart/adminhtml_system_config_date</frontend_model>
|
| 52 |
+
<sort_order>12</sort_order>
|
| 53 |
+
<show_in_default>1</show_in_default>
|
| 54 |
+
<show_in_website>1</show_in_website>
|
| 55 |
+
<show_in_store>1</show_in_store>
|
| 56 |
+
<comment><![CDATA[Carts previous than this value, will be ignored]]></comment>
|
| 57 |
+
<depends>
|
| 58 |
+
<active>1</active>
|
| 59 |
+
</depends>
|
| 60 |
+
</firstdate>
|
| 61 |
+
|
| 62 |
+
<identity translate="label">
|
| 63 |
+
<label>Sender</label>
|
| 64 |
+
<frontend_type>select</frontend_type>
|
| 65 |
+
<source_model>adminhtml/system_config_source_email_identity</source_model>
|
| 66 |
+
<sort_order>15</sort_order>
|
| 67 |
+
<show_in_default>1</show_in_default>
|
| 68 |
+
<show_in_website>1</show_in_website>
|
| 69 |
+
<show_in_store>1</show_in_store>
|
| 70 |
+
<depends>
|
| 71 |
+
<active>1</active>
|
| 72 |
+
</depends>
|
| 73 |
+
</identity>
|
| 74 |
+
<template translate="label">
|
| 75 |
+
<label>Email Template</label>
|
| 76 |
+
<frontend_type>select</frontend_type>
|
| 77 |
+
<config_path>ebizmarts_abandonedcart/general/template</config_path>
|
| 78 |
+
<source_model>adminhtml/system_config_source_email_template</source_model>
|
| 79 |
+
<sort_order>20</sort_order>
|
| 80 |
+
<show_in_default>1</show_in_default>
|
| 81 |
+
<show_in_website>1</show_in_website>
|
| 82 |
+
<show_in_store>1</show_in_store>
|
| 83 |
+
<depends>
|
| 84 |
+
<active>1</active>
|
| 85 |
+
</depends>
|
| 86 |
+
</template>
|
| 87 |
+
<subject translate="label comment">
|
| 88 |
+
<label>Email Subject</label>
|
| 89 |
+
<frontend_type>text</frontend_type>
|
| 90 |
+
<sort_order>25</sort_order>
|
| 91 |
+
<show_in_default>1</show_in_default>
|
| 92 |
+
<show_in_website>1</show_in_website>
|
| 93 |
+
<show_in_store>1</show_in_store>
|
| 94 |
+
<can_be_empty>0</can_be_empty>
|
| 95 |
+
<comment><![CDATA[The subject for the email abandoned cart]]></comment>
|
| 96 |
+
<depends>
|
| 97 |
+
<active>1</active>
|
| 98 |
+
</depends>
|
| 99 |
+
</subject>
|
| 100 |
+
|
| 101 |
+
<mandrill-tag translate="label">
|
| 102 |
+
<label>Mandrill Tag</label>
|
| 103 |
+
<frontend_type>text</frontend_type>
|
| 104 |
+
<sort_order>27</sort_order>
|
| 105 |
+
<show_in_default>1</show_in_default>
|
| 106 |
+
<show_in_website>1</show_in_website>
|
| 107 |
+
<show_in_store>1</show_in_store>
|
| 108 |
+
<depends>
|
| 109 |
+
<active>1</active>
|
| 110 |
+
</depends>
|
| 111 |
+
</mandrill-tag>
|
| 112 |
+
<days translate="label comment">
|
| 113 |
+
<label>Send email after</label>
|
| 114 |
+
<frontend_type>text</frontend_type>
|
| 115 |
+
<sort_order>30</sort_order>
|
| 116 |
+
<show_in_default>1</show_in_default>
|
| 117 |
+
<show_in_website>1</show_in_website>
|
| 118 |
+
<show_in_store>1</show_in_store>
|
| 119 |
+
<can_be_empty>0</can_be_empty>
|
| 120 |
+
<comment><![CDATA[This value depends of the next unit parameter]]></comment>
|
| 121 |
+
<depends>
|
| 122 |
+
<active>1</active>
|
| 123 |
+
</depends>
|
| 124 |
+
</days>
|
| 125 |
+
<unit translate="label comment">
|
| 126 |
+
<label>Unit</label>
|
| 127 |
+
<frontend_type>select</frontend_type>
|
| 128 |
+
<source_model>ebizmarts_abandonedcart/system_config_unit</source_model>
|
| 129 |
+
<sort_order>35</sort_order>
|
| 130 |
+
<show_in_default>1</show_in_default>
|
| 131 |
+
<show_in_website>1</show_in_website>
|
| 132 |
+
<show_in_store>1</show_in_store>
|
| 133 |
+
<can_be_empty>0</can_be_empty>
|
| 134 |
+
<comment><![CDATA[Enter the unit for considering in the first email]]></comment>
|
| 135 |
+
<depends>
|
| 136 |
+
<active>1</active>
|
| 137 |
+
</depends>
|
| 138 |
+
</unit>
|
| 139 |
+
<max translate="label comment">
|
| 140 |
+
<label>Max number of email to send</label>
|
| 141 |
+
<frontend_type>text</frontend_type>
|
| 142 |
+
<sort_order>40</sort_order>
|
| 143 |
+
<show_in_default>1</show_in_default>
|
| 144 |
+
<show_in_website>1</show_in_website>
|
| 145 |
+
<show_in_store>1</show_in_store>
|
| 146 |
+
<can_be_empty>0</can_be_empty>
|
| 147 |
+
<comment><![CDATA[Max]]></comment>
|
| 148 |
+
<depends>
|
| 149 |
+
<active>1</active>
|
| 150 |
+
</depends>
|
| 151 |
+
</max>
|
| 152 |
+
<customer translate="label comment">
|
| 153 |
+
<label>Customer Groups</label>
|
| 154 |
+
<frontend_type>multiselect</frontend_type>
|
| 155 |
+
<source_model>ebizmarts_abandonedcart/system_config_customergroup</source_model>
|
| 156 |
+
<sort_order>50</sort_order>
|
| 157 |
+
<show_in_default>1</show_in_default>
|
| 158 |
+
<show_in_website>1</show_in_website>
|
| 159 |
+
<show_in_store>1</show_in_store>
|
| 160 |
+
<can_be_empty>0</can_be_empty>
|
| 161 |
+
<comment><![CDATA[]]></comment>
|
| 162 |
+
<depends>
|
| 163 |
+
<active>1</active>
|
| 164 |
+
</depends>
|
| 165 |
+
</customer>
|
| 166 |
+
<autologin translate="label comment">
|
| 167 |
+
<label>Auto Login link</label>
|
| 168 |
+
<frontend_type>select</frontend_type>
|
| 169 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 170 |
+
<sort_order>60</sort_order>
|
| 171 |
+
<show_in_default>1</show_in_default>
|
| 172 |
+
<show_in_website>1</show_in_website>
|
| 173 |
+
<show_in_store>1</show_in_store>
|
| 174 |
+
<comment><![CDATA[The client will be autologed when click on mail link]]></comment>
|
| 175 |
+
<depends>
|
| 176 |
+
<active>1</active>
|
| 177 |
+
</depends>
|
| 178 |
+
</autologin>
|
| 179 |
+
|
| 180 |
+
</fields>
|
| 181 |
+
</general>
|
| 182 |
+
<coupon>
|
| 183 |
+
<label>Coupon</label>
|
| 184 |
+
<sort_order>99</sort_order>
|
| 185 |
+
<frontend_type>text</frontend_type>
|
| 186 |
+
<show_in_default>1</show_in_default>
|
| 187 |
+
<show_in_website>1</show_in_website>
|
| 188 |
+
<show_in_store>1</show_in_store>
|
| 189 |
+
<fields>
|
| 190 |
+
<create translate="label">
|
| 191 |
+
<label>Create Coupon?</label>
|
| 192 |
+
<frontend_type>select</frontend_type>
|
| 193 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 194 |
+
<sort_order>100</sort_order>
|
| 195 |
+
<show_in_default>1</show_in_default>
|
| 196 |
+
<show_in_website>1</show_in_website>
|
| 197 |
+
<show_in_store>1</show_in_store>
|
| 198 |
+
</create>
|
| 199 |
+
<sendon translate="label">
|
| 200 |
+
<label>On email number?</label>
|
| 201 |
+
<frontend_type>text</frontend_type>
|
| 202 |
+
<sort_order>110</sort_order>
|
| 203 |
+
<show_in_default>1</show_in_default>
|
| 204 |
+
<show_in_website>1</show_in_website>
|
| 205 |
+
<show_in_store>1</show_in_store>
|
| 206 |
+
<can_be_empty>0</can_be_empty>
|
| 207 |
+
<comment><![CDATA[The coupon will be created on the email number]]></comment>
|
| 208 |
+
<depends>
|
| 209 |
+
<create>1</create>
|
| 210 |
+
</depends>
|
| 211 |
+
</sendon>
|
| 212 |
+
<automatic translate="label">
|
| 213 |
+
<label>Option</label>
|
| 214 |
+
<frontend_type>select</frontend_type>
|
| 215 |
+
<source_model>ebizmarts_abandonedcart/system_config_automatic</source_model>
|
| 216 |
+
<sort_order>115</sort_order>
|
| 217 |
+
<show_in_default>1</show_in_default>
|
| 218 |
+
<show_in_website>1</show_in_website>
|
| 219 |
+
<show_in_store>1</show_in_store>
|
| 220 |
+
<depends>
|
| 221 |
+
<create>1</create>
|
| 222 |
+
</depends>
|
| 223 |
+
</automatic>
|
| 224 |
+
<couponcode>
|
| 225 |
+
<label>Coupon Code</label>
|
| 226 |
+
<frontend_type>text</frontend_type>
|
| 227 |
+
<sort_order>120</sort_order>
|
| 228 |
+
<show_in_default>1</show_in_default>
|
| 229 |
+
<show_in_website>1</show_in_website>
|
| 230 |
+
<show_in_store>1</show_in_store>
|
| 231 |
+
<can_be_empty>0</can_be_empty>
|
| 232 |
+
<comment><![CDATA[The code of an existing coupon]]></comment>
|
| 233 |
+
<depends>
|
| 234 |
+
<create>1</create>
|
| 235 |
+
<automatic>1</automatic>
|
| 236 |
+
</depends>
|
| 237 |
+
</couponcode>
|
| 238 |
+
<expire>
|
| 239 |
+
<label>Expire on</label>
|
| 240 |
+
<frontend_type>text</frontend_type>
|
| 241 |
+
<sort_order>120</sort_order>
|
| 242 |
+
<show_in_default>1</show_in_default>
|
| 243 |
+
<show_in_website>1</show_in_website>
|
| 244 |
+
<show_in_store>1</show_in_store>
|
| 245 |
+
<can_be_empty>0</can_be_empty>
|
| 246 |
+
<comment><![CDATA[The coupon expiration in days]]></comment>
|
| 247 |
+
<depends>
|
| 248 |
+
<create>1</create>
|
| 249 |
+
<automatic>2</automatic>
|
| 250 |
+
</depends>
|
| 251 |
+
</expire>
|
| 252 |
+
<length>
|
| 253 |
+
<label>Coupon length</label>
|
| 254 |
+
<frontend_type>text</frontend_type>
|
| 255 |
+
<sort_order>130</sort_order>
|
| 256 |
+
<show_in_default>1</show_in_default>
|
| 257 |
+
<show_in_website>1</show_in_website>
|
| 258 |
+
<show_in_store>1</show_in_store>
|
| 259 |
+
<can_be_empty>0</can_be_empty>
|
| 260 |
+
<!--comment><![CDATA[The coupon expiration in days]]></comment-->
|
| 261 |
+
<depends>
|
| 262 |
+
<create>1</create>
|
| 263 |
+
<automatic>2</automatic>
|
| 264 |
+
</depends>
|
| 265 |
+
</length>
|
| 266 |
+
<discounttype>
|
| 267 |
+
<label>Discount type</label>
|
| 268 |
+
<frontend_type>select</frontend_type>
|
| 269 |
+
<source_model>ebizmarts_abandonedcart/system_config_discounttype</source_model>
|
| 270 |
+
<sort_order>140</sort_order>
|
| 271 |
+
<show_in_default>1</show_in_default>
|
| 272 |
+
<show_in_website>1</show_in_website>
|
| 273 |
+
<show_in_store>1</show_in_store>
|
| 274 |
+
<can_be_empty>0</can_be_empty>
|
| 275 |
+
<comment><![CDATA[Select percentage or fixed discount]]></comment>
|
| 276 |
+
<depends>
|
| 277 |
+
<create>1</create>
|
| 278 |
+
<automatic>2</automatic>
|
| 279 |
+
</depends>
|
| 280 |
+
</discounttype>
|
| 281 |
+
<discount>
|
| 282 |
+
<label>Discount amount</label>
|
| 283 |
+
<frontend_type>text</frontend_type>
|
| 284 |
+
<sort_order>150</sort_order>
|
| 285 |
+
<show_in_default>1</show_in_default>
|
| 286 |
+
<show_in_website>1</show_in_website>
|
| 287 |
+
<show_in_store>1</show_in_store>
|
| 288 |
+
<can_be_empty>0</can_be_empty>
|
| 289 |
+
<comment><![CDATA[Amount]]></comment>
|
| 290 |
+
<depends>
|
| 291 |
+
<create>1</create>
|
| 292 |
+
<automatic>2</automatic>
|
| 293 |
+
</depends>
|
| 294 |
+
</discount>
|
| 295 |
+
<couponlabel>
|
| 296 |
+
<label>Label for coupon</label>
|
| 297 |
+
<frontend_type>text</frontend_type>
|
| 298 |
+
<sort_order>160</sort_order>
|
| 299 |
+
<show_in_default>1</show_in_default>
|
| 300 |
+
<show_in_website>1</show_in_website>
|
| 301 |
+
<show_in_store>1</show_in_store>
|
| 302 |
+
<can_be_empty>0</can_be_empty>
|
| 303 |
+
<comment><![CDATA[]]></comment>
|
| 304 |
+
<depends>
|
| 305 |
+
<create>1</create>
|
| 306 |
+
<automatic>2</automatic>
|
| 307 |
+
</depends>
|
| 308 |
+
</couponlabel>
|
| 309 |
+
</fields>
|
| 310 |
+
</coupon>
|
| 311 |
+
</groups>
|
| 312 |
+
</ebizmarts_abandonedcart>
|
| 313 |
+
</sections>
|
| 314 |
+
</config>
|
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
$installer = $this;
|
| 3 |
+
|
| 4 |
+
$installer->startSetup();
|
| 5 |
+
|
| 6 |
+
$installer->getConnection()->addColumn(
|
| 7 |
+
$installer->getTable('sales_flat_quote'), 'ebizmarts_abandonedcart_counter', 'int(5)', null, array('default' => '0')
|
| 8 |
+
);
|
| 9 |
+
$installer->endSetup();
|
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Author : Ebizmarts <info@ebizmarts.com>
|
| 4 |
+
* Date : 6/5/13
|
| 5 |
+
* Time : 12:42 PM
|
| 6 |
+
* File : mysql4-upgrade-0.1.7-0.1.8.php
|
| 7 |
+
* Module : Ebizmarts_Magemonkey
|
| 8 |
+
*/
|
| 9 |
+
$installer = $this;
|
| 10 |
+
|
| 11 |
+
$installer->startSetup();
|
| 12 |
+
|
| 13 |
+
$installer->run("
|
| 14 |
+
|
| 15 |
+
ALTER TABLE `{$this->getTable('sales_flat_quote')}` CHANGE `ebizmarts_abandonedcart_counter` `ebizmarts_abandonedcart_counter` INT( 5 ) NOT NULL DEFAULT '0';
|
| 16 |
+
ALTER TABLE `{$this->getTable('sales_flat_quote')}` CHANGE `ebizmarts_abandonedcart_flag` `ebizmarts_abandonedcart_flag` INT( 5 ) NOT NULL DEFAULT '0';
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
");
|
| 20 |
+
|
| 21 |
+
$installer->endSetup();
|
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Author : Ebizmarts <info@ebizmarts.com>
|
| 4 |
+
* Date : 6/5/13
|
| 5 |
+
* Time : 12:42 PM
|
| 6 |
+
* File : mysql4-upgrade-0.1.7-0.1.8.php
|
| 7 |
+
* Module : Ebizmarts_Magemonkey
|
| 8 |
+
*/
|
| 9 |
+
$installer = $this;
|
| 10 |
+
|
| 11 |
+
$installer->startSetup();
|
| 12 |
+
|
| 13 |
+
$installer->run("
|
| 14 |
+
CREATE TABLE IF NOT EXISTS `{$this->getTable('magemonkey_mails_sent')}` (
|
| 15 |
+
`id` INT(10) unsigned NOT NULL auto_increment,
|
| 16 |
+
`store_id` smallint(5),
|
| 17 |
+
`mail_type` ENUM('abandoned cart','happy birthday','new order', 'related products', 'product review', 'no activity', 'wishlist') NOT NULL,
|
| 18 |
+
`customer_email` varchar(255),
|
| 19 |
+
`customer_name` varchar(255),
|
| 20 |
+
`coupon_number` varchar(255),
|
| 21 |
+
`coupon_type` smallint(2),
|
| 22 |
+
`coupon_amount` decimal(10,2),
|
| 23 |
+
`sent_at` DATETIME NOT NULL ,
|
| 24 |
+
PRIMARY KEY (`id`)
|
| 25 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
| 26 |
+
");
|
| 27 |
+
|
| 28 |
+
$installer->endSetup();
|
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Created by Ebizmarts
|
| 4 |
+
* User: gonzalo@ebizmarts.com
|
| 5 |
+
* Date: 1/15/13
|
| 6 |
+
* Time: 3:42 PM
|
| 7 |
+
*/
|
| 8 |
+
$installer = $this;
|
| 9 |
+
|
| 10 |
+
$installer->startSetup();
|
| 11 |
+
|
| 12 |
+
$installer->getConnection()->addColumn(
|
| 13 |
+
$installer->getTable('sales_flat_quote'), 'ebizmarts_abandonedcart_flag', 'int(1)', null, array('default' => '0')
|
| 14 |
+
);
|
| 15 |
+
|
| 16 |
+
$installer->endSetup();
|
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Created by Ebizmarts
|
| 4 |
+
* User: gonzalo@ebizmarts.com
|
| 5 |
+
* Date: 3/12/13
|
| 6 |
+
* Time: 10:25 AM
|
| 7 |
+
*/
|
| 8 |
+
|
| 9 |
+
$installer = $this;
|
| 10 |
+
|
| 11 |
+
$installer->startSetup();
|
| 12 |
+
|
| 13 |
+
$installer->getConnection()->addColumn(
|
| 14 |
+
$installer->getTable('sales_flat_order'), 'ebizmarts_abandonedcart_flag', 'int(1)', null, array('default' => '0')
|
| 15 |
+
);
|
| 16 |
+
|
| 17 |
+
$installer->endSetup();
|
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Author : Ebizmarts <info@ebizmarts.com>
|
| 4 |
+
* Date : 6/25/13
|
| 5 |
+
* Time : 2:15 PM
|
| 6 |
+
* File : Hint.php
|
| 7 |
+
* Module : Ebizmarts_Magemonkey
|
| 8 |
+
*/
|
| 9 |
+
class Ebizmarts_Autoresponder_Block_Adminhtml_System_Config_Birthday_Fieldset_Hint
|
| 10 |
+
extends Mage_Adminhtml_Block_Abstract
|
| 11 |
+
implements Varien_Data_Form_Element_Renderer_Interface
|
| 12 |
+
{
|
| 13 |
+
protected $_template = 'ebizmarts/autoresponder/system/config/birthday/fieldset/hint.phtml';
|
| 14 |
+
|
| 15 |
+
/**
|
| 16 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
| 17 |
+
* @return string
|
| 18 |
+
*/
|
| 19 |
+
public function render(Varien_Data_Form_Element_Abstract $element)
|
| 20 |
+
{
|
| 21 |
+
return $this->toHtml();
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class Ebizmarts_Autoresponder_Block_Adminhtml_System_Config_Fieldset_Hint
|
| 4 |
+
extends Mage_Adminhtml_Block_Abstract
|
| 5 |
+
implements Varien_Data_Form_Element_Renderer_Interface
|
| 6 |
+
{
|
| 7 |
+
protected $_template = 'ebizmarts/autoresponder/system/config/fieldset/hint.phtml';
|
| 8 |
+
|
| 9 |
+
/**
|
| 10 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
| 11 |
+
* @return string
|
| 12 |
+
*/
|
| 13 |
+
public function render(Varien_Data_Form_Element_Abstract $element)
|
| 14 |
+
{
|
| 15 |
+
return $this->toHtml();
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
/**
|
| 19 |
+
* @return string
|
| 20 |
+
*/
|
| 21 |
+
public function getVersion()
|
| 22 |
+
{
|
| 23 |
+
return (string) Mage::getConfig()->getNode('modules/Ebizmarts_Autoresponder/version');
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
/**
|
| 27 |
+
* @return string
|
| 28 |
+
*/
|
| 29 |
+
public function getPxParams() {
|
| 30 |
+
$v = (string)Mage::getConfig()->getNode('modules/Ebizmarts_Autoresponder/version');
|
| 31 |
+
$ext = "Abandoned Cart;{$v}";
|
| 32 |
+
|
| 33 |
+
$modulesArray = (array)Mage::getConfig()->getNode('modules')->children();
|
| 34 |
+
$aux = (array_key_exists('Enterprise_Enterprise', $modulesArray))? 'EE' : 'CE' ;
|
| 35 |
+
$mageVersion = Mage::getVersion();
|
| 36 |
+
$mage = "Magento {$aux};{$mageVersion}";
|
| 37 |
+
|
| 38 |
+
$hash = md5($ext . '_' . $mage . '_' . $ext);
|
| 39 |
+
|
| 40 |
+
return "ext=$ext&mage={$mage}&ctrl={$hash}";
|
| 41 |
+
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
/**
|
| 45 |
+
* @return mixed
|
| 46 |
+
*/
|
| 47 |
+
public function verify()
|
| 48 |
+
{
|
| 49 |
+
return Mage::helper('ebizmarts_autoresponder')->verify();
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Author : Ebizmarts <info@ebizmarts.com>
|
| 4 |
+
* Date : 6/28/13
|
| 5 |
+
* Time : 2:35 PM
|
| 6 |
+
* File : Hint.php
|
| 7 |
+
* Module : Ebizmarts_Magemonkey
|
| 8 |
+
*/
|
| 9 |
+
class Ebizmarts_Autoresponder_Block_Adminhtml_System_Config_Review_Fieldset_Hint
|
| 10 |
+
extends Mage_Adminhtml_Block_Abstract
|
| 11 |
+
implements Varien_Data_Form_Element_Renderer_Interface
|
| 12 |
+
{
|
| 13 |
+
protected $_template = 'ebizmarts/autoresponder/system/config/review/fieldset/hint.phtml';
|
| 14 |
+
|
| 15 |
+
/**
|
| 16 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
| 17 |
+
* @return string
|
| 18 |
+
*/
|
| 19 |
+
public function render(Varien_Data_Form_Element_Abstract $element)
|
| 20 |
+
{
|
| 21 |
+
return $this->toHtml();
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Author : Ebizmarts <info@ebizmarts.com>
|
| 4 |
+
* Date : 6/28/13
|
| 5 |
+
* Time : 3:13 PM
|
| 6 |
+
* File : Hint.php
|
| 7 |
+
* Module : Ebizmarts_Magemonkey
|
| 8 |
+
*/
|
| 9 |
+
class Ebizmarts_Autoresponder_Block_Adminhtml_System_Config_Wishlist_Fieldset_Hint
|
| 10 |
+
extends Mage_Adminhtml_Block_Abstract
|
| 11 |
+
implements Varien_Data_Form_Element_Renderer_Interface
|
| 12 |
+
{
|
| 13 |
+
protected $_template = 'ebizmarts/autoresponder/system/config/wishlist/fieldset/hint.phtml';
|
| 14 |
+
|
| 15 |
+
/**
|
| 16 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
| 17 |
+
* @return string
|
| 18 |
+
*/
|
| 19 |
+
public function render(Varien_Data_Form_Element_Abstract $element)
|
| 20 |
+
{
|
| 21 |
+
return $this->toHtml();
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Author : Ebizmarts <info@ebizmarts.com>
|
| 4 |
+
* Date : 6/26/13
|
| 5 |
+
* Time : 1:02 PM
|
| 6 |
+
* File : List.php
|
| 7 |
+
* Module : Ebizmarts_Magemonkey
|
| 8 |
+
*/
|
| 9 |
+
class Ebizmarts_Autoresponder_Block_Customer_Account_List extends Mage_Core_Block_Template
|
| 10 |
+
{
|
| 11 |
+
public function getLists()
|
| 12 |
+
{
|
| 13 |
+
return Mage::helper('ebizmarts_autoresponder')->getLists();
|
| 14 |
+
}
|
| 15 |
+
public function getSaveUrl()
|
| 16 |
+
{
|
| 17 |
+
return $this->getUrl('ebizautoresponder/autoresponder/savelist');
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Author : Ebizmarts <info@ebizmarts.com>
|
| 4 |
+
* Date : 6/19/13
|
| 5 |
+
* Time : 2:50 PM
|
| 6 |
+
* File : Items.php
|
| 7 |
+
* Module : Ebizmarts_Magemonkey
|
| 8 |
+
*/
|
| 9 |
+
class Ebizmarts_Autoresponder_Block_Email_Related_Items extends Mage_Sales_Block_Items_Abstract
|
| 10 |
+
{
|
| 11 |
+
public function _construct()
|
| 12 |
+
{
|
| 13 |
+
$this->setTemplate('ebizmarts/autoresponder_related_items.phtml');
|
| 14 |
+
}
|
| 15 |
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Author : Ebizmarts <info@ebizmarts.com>
|
| 4 |
+
* Date : 6/21/13
|
| 5 |
+
* Time : 1:43 PM
|
| 6 |
+
* File : Items.php
|
| 7 |
+
* Module : Ebizmarts_Magemonkey
|
| 8 |
+
*/
|
| 9 |
+
class Ebizmarts_Autoresponder_Block_Email_Review_Items extends Mage_Sales_Block_Items_Abstract
|
| 10 |
+
{
|
| 11 |
+
public function _construct()
|
| 12 |
+
{
|
| 13 |
+
$this->setTemplate('ebizmarts/autoresponder_review_items.phtml');
|
| 14 |
+
}
|
| 15 |
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Author : Ebizmarts <info@ebizmarts.com>
|
| 4 |
+
* Date : 6/24/13
|
| 5 |
+
* Time : 4:37 PM
|
| 6 |
+
* File : Items.php
|
| 7 |
+
* Module : Ebizmarts_Magemonkey
|
| 8 |
+
*/
|
| 9 |
+
class Ebizmarts_Autoresponder_Block_Email_Wishlist_Items extends Mage_Sales_Block_Items_Abstract
|
| 10 |
+
{
|
| 11 |
+
public function _construct()
|
| 12 |
+
{
|
| 13 |
+
$this->setTemplate('ebizmarts/autoresponder_wishlist_items.phtml');
|
| 14 |
+
}
|
| 15 |
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Author : Ebizmarts <info@ebizmarts.com>
|
| 4 |
+
* Date : 6/26/13
|
| 5 |
+
* Time : 8:55 AM
|
| 6 |
+
* File : Unsubscribe.php
|
| 7 |
+
* Module : Ebizmarts_Magemonkey
|
| 8 |
+
*/
|
| 9 |
+
class Ebizmarts_Autoresponder_Block_Unsubscribe extends Mage_Core_Block_Template
|
| 10 |
+
{
|
| 11 |
+
public function _construct() {
|
| 12 |
+
parent::_construct();
|
| 13 |
+
$this->setTemplate('ebizmarts/autoresponder/unsubscribe.phtml');
|
| 14 |
+
}
|
| 15 |
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Author : Ebizmarts <info@ebizmarts.com>
|
| 4 |
+
* Date : 4/28/13
|
| 5 |
+
* Time : 11:20 AM
|
| 6 |
+
* File : Data.php
|
| 7 |
+
* Module : Ebizmarts_Magemonkey
|
| 8 |
+
*/
|
| 9 |
+
class Ebizmarts_Autoresponder_Helper_Data extends Mage_Core_Helper_Abstract {
|
| 10 |
+
|
| 11 |
+
public function getLists()
|
| 12 |
+
{
|
| 13 |
+
$types = array();
|
| 14 |
+
$storeId = Mage::app()->getStore()->getStoreId();
|
| 15 |
+
$lists = Mage::getConfig()->getNode('default/ebizmarts_autoresponder')->asArray();
|
| 16 |
+
$lists['abandonedcart'] = array('listname'=>'Abandoned Carts List');
|
| 17 |
+
foreach ($lists as $key =>$data) {
|
| 18 |
+
if(isset($data['listname'])) {
|
| 19 |
+
if(Mage::getStoreConfig("ebizmarts_autoresponder/$key/active",$storeId)||($key=='abandonedcart'&&Mage::getStoreConfig("ebizmarts_abandonedcart/general/active",$storeId))) {
|
| 20 |
+
$types[$key]['listname'] = (string)$data['listname'];
|
| 21 |
+
$collection = Mage::getModel('ebizmarts_autoresponder/unsubscribe')->getCollection();
|
| 22 |
+
$email = $this->_getEmail();
|
| 23 |
+
$collection->addFieldToFilter('main_table.email',array('eq'=>$email))
|
| 24 |
+
->addFieldToFilter('main_table.list',array('eq'=>$key))
|
| 25 |
+
->addFieldToFilter('main_table.store_id',array('eq'=>$storeId));
|
| 26 |
+
if($collection->getSize() > 0) {
|
| 27 |
+
$types[$key]['checked'] = "";
|
| 28 |
+
}
|
| 29 |
+
else {
|
| 30 |
+
$types[$key]['checked'] = "checked";
|
| 31 |
+
}
|
| 32 |
+
}
|
| 33 |
+
}
|
| 34 |
+
}
|
| 35 |
+
return $types;
|
| 36 |
+
}
|
| 37 |
+
protected function _getEmail()
|
| 38 |
+
{
|
| 39 |
+
return Mage::helper('customer')->getCustomer()->getEmail();
|
| 40 |
+
}
|
| 41 |
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Author : Ebizmarts <info@ebizmarts.com>
|
| 4 |
+
* Date : 6/14/13
|
| 5 |
+
* Time : 5:10 PM
|
| 6 |
+
* File : Config.php
|
| 7 |
+
* Module : Ebizmarts_Magemonkey
|
| 8 |
+
*/
|
| 9 |
+
class Ebizmarts_Autoresponder_Model_Config
|
| 10 |
+
{
|
| 11 |
+
const GENERAL_ACTIVE = 'ebizmarts_autoresponder/general/active';
|
| 12 |
+
const GENERAL_SENDER = 'ebizmarts_autoresponder/general/identity';
|
| 13 |
+
|
| 14 |
+
const NEWORDER_ACTIVE = 'ebizmarts_autoresponder/neworder/active';
|
| 15 |
+
const NEWORDER_DAYS = 'ebizmarts_autoresponder/neworder/days';
|
| 16 |
+
const NEWORDER_CUSTOMER_GROUPS = 'ebizmarts_autoresponder/neworder/customer';
|
| 17 |
+
const NEWORDER_TEMPLATE = 'ebizmarts_autoresponder/neworder/template';
|
| 18 |
+
const NEWORDER_MANDRILL_TAG = 'ebizmarts_autoresponder/neworder/mandrill-tag';
|
| 19 |
+
const NEWORDER_SUBJECT = 'ebizmarts_autoresponder/neworder/subject';
|
| 20 |
+
|
| 21 |
+
const RELATED_ACTIVE = 'ebizmarts_autoresponder/related/active';
|
| 22 |
+
const RELATED_DAYS = 'ebizmarts_autoresponder/related/days';
|
| 23 |
+
const RELATED_CUSTOMER_GROUPS = 'ebizmarts_autoresponder/related/customer';
|
| 24 |
+
const RELATED_TEMPLATE = 'ebizmarts_autoresponder/related/template';
|
| 25 |
+
const RELATED_MANDRILL_TAG = 'ebizmarts_autoresponder/related/mandrill-tag';
|
| 26 |
+
const RELATED_SUBJECT = 'ebizmarts_autoresponder/related/subject';
|
| 27 |
+
const RELATED_MAX = 'ebizmarts_autoresponder/related/max-related';
|
| 28 |
+
|
| 29 |
+
const REVIEW_ACTIVE = 'ebizmarts_autoresponder/review/active';
|
| 30 |
+
const REVIEW_DAYS = 'ebizmarts_autoresponder/review/days';
|
| 31 |
+
const REVIEW_CUSTOMER_GROUPS = 'ebizmarts_autoresponder/review/customer';
|
| 32 |
+
const REVIEW_TEMPLATE = 'ebizmarts_autoresponder/review/template';
|
| 33 |
+
const REVIEW_MANDRILL_TAG = 'ebizmarts_autoresponder/review/mandrill-tag';
|
| 34 |
+
const REVIEW_SUBJECT = 'ebizmarts_autoresponder/review/subject';
|
| 35 |
+
|
| 36 |
+
const BIRTHDAY_ACTIVE = 'ebizmarts_autoresponder/birthday/active';
|
| 37 |
+
const BIRTHDAY_DAYS = 'ebizmarts_autoresponder/birthday/days';
|
| 38 |
+
const BIRTHDAY_CUSTOMER_GROUPS = 'ebizmarts_autoresponder/birthday/customer';
|
| 39 |
+
const BIRTHDAY_TEMPLATE = 'ebizmarts_autoresponder/birthday/template';
|
| 40 |
+
const BIRTHDAY_SUBJECT = 'ebizmarts_autoresponder/birthday/subject';
|
| 41 |
+
const BIRTHDAY_MANDRILL_TAG = 'ebizmarts_autoresponder/birthday/mandrill-tag';
|
| 42 |
+
const BIRTHDAY_COUPON = 'ebizmarts_autoresponder/birthday/coupon';
|
| 43 |
+
const BIRTHDAY_CUSTOMER_COUPON = 'ebizmarts_autoresponder/birthday/customer_coupon';
|
| 44 |
+
const BIRTHDAY_AUTOMATIC = 'ebizmarts_autoresponder/birthday/automatic';
|
| 45 |
+
const BIRTHDAY_COUPON_CODE = 'ebizmarts_autoresponder/birthday/coupon_code';
|
| 46 |
+
const BIRTHDAY_EXPIRE = 'ebizmarts_autoresponder/birthday/expire';
|
| 47 |
+
const BIRTHDAY_LENGTH = 'ebizmarts_autoresponder/birthday/length';
|
| 48 |
+
const BIRTHDAY_DISCOUNT_TYPE = 'ebizmarts_autoresponder/birthday/discounttype';
|
| 49 |
+
const BIRTHDAY_DISCOUNT = 'ebizmarts_autoresponder/birthday/discount';
|
| 50 |
+
const BIRTHDAY_COUPON_LABEL = 'ebizmarts_autoresponder/birthday/couponlabel';
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
const NOACTIVITY_ACTIVE = 'ebizmarts_autoresponder/noactivity/active';
|
| 54 |
+
const NOACTIVITY_DAYS = 'ebizmarts_autoresponder/noactivity/days';
|
| 55 |
+
const NOACTIVITY_CUSTOMER_GROUPS = 'ebizmarts_autoresponder/noactivity/customer';
|
| 56 |
+
const NOACTIVITY_TEMPLATE = 'ebizmarts_autoresponder/noactivity/template';
|
| 57 |
+
const NOACTIVITY_MANDRILL_TAG = 'ebizmarts_autoresponder/noactivity/mandrill-tag';
|
| 58 |
+
const NOACTIVITY_SUBJECT = 'ebizmarts_autoresponder/noactivity/subject';
|
| 59 |
+
|
| 60 |
+
const WISHLIST_ACTIVE = 'ebizmarts_autoresponder/wishlist/active';
|
| 61 |
+
const WISHLIST_DAYS = 'ebizmarts_autoresponder/wishlist/days';
|
| 62 |
+
const WISHLIST_CUSTOMER_GROUPS = 'ebizmarts_autoresponder/wishlist/customer';
|
| 63 |
+
const WISHLIST_TEMPLATE = 'ebizmarts_autoresponder/wishlist/template';
|
| 64 |
+
const WISHLIST_MANDRILL_TAG = 'ebizmarts_autoresponder/wishlist/mandrill-tag';
|
| 65 |
+
const WISHLIST_SUBJECT = 'ebizmarts_autoresponder/wishlist/subject';
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
const COUPON_AUTOMATIC = 2;
|
| 69 |
+
const COUPON_MANUAL = 1;
|
| 70 |
+
}
|
|
@@ -0,0 +1,412 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Author : Ebizmarts <info@ebizmarts.com>
|
| 4 |
+
* Date : 6/14/13
|
| 5 |
+
* Time : 5:05 PM
|
| 6 |
+
* File : Cron.php
|
| 7 |
+
* Module : Ebizmarts_Magemonkey
|
| 8 |
+
*/
|
| 9 |
+
class Ebizmarts_Autoresponder_Model_Cron
|
| 10 |
+
{
|
| 11 |
+
/**
|
| 12 |
+
*
|
| 13 |
+
*/
|
| 14 |
+
public function process()
|
| 15 |
+
{
|
| 16 |
+
$allStores = Mage::app()->getStores();
|
| 17 |
+
foreach($allStores as $storeId => $val)
|
| 18 |
+
{
|
| 19 |
+
if(Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::GENERAL_ACTIVE,$storeId)) {
|
| 20 |
+
$this->_processStore($storeId);
|
| 21 |
+
}
|
| 22 |
+
}
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
/**
|
| 26 |
+
* @param $storeId
|
| 27 |
+
*/
|
| 28 |
+
protected function _processStore($storeId)
|
| 29 |
+
{
|
| 30 |
+
Mage::app()->setCurrentStore($storeId);
|
| 31 |
+
|
| 32 |
+
if(Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::NEWORDER_ACTIVE,$storeId)) { // done
|
| 33 |
+
$this->_processNewOrders($storeId);
|
| 34 |
+
}
|
| 35 |
+
if(Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::RELATED_ACTIVE,$storeId)) { // done
|
| 36 |
+
$this->_processRelated($storeId);
|
| 37 |
+
}
|
| 38 |
+
if(Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::REVIEW_ACTIVE,$storeId)) { // done
|
| 39 |
+
$this->_processReview($storeId);
|
| 40 |
+
}
|
| 41 |
+
if(Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::BIRTHDAY_ACTIVE,$storeId)) { // done
|
| 42 |
+
$this->_processBirthday($storeId);
|
| 43 |
+
}
|
| 44 |
+
if(Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::NOACTIVITY_ACTIVE,$storeId)) { // done
|
| 45 |
+
$this->_processNoActivity($storeId);
|
| 46 |
+
}
|
| 47 |
+
if(Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::WISHLIST_ACTIVE,$storeId)) { // done
|
| 48 |
+
$this->_processWishlist($storeId);
|
| 49 |
+
}
|
| 50 |
+
}
|
| 51 |
+
protected function _processNewOrders($storeId)
|
| 52 |
+
{
|
| 53 |
+
$customerGroups = explode(",",Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::NEWORDER_CUSTOMER_GROUPS, $storeId));
|
| 54 |
+
$days = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::NEWORDER_DAYS,$storeId);
|
| 55 |
+
$tags = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::NEWORDER_MANDRILL_TAG,$storeId)."_$storeId";
|
| 56 |
+
$adapter = Mage::getSingleton('core/resource')->getConnection('sales_read');
|
| 57 |
+
$mailSubject = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::NEWORDER_SUBJECT,$storeId);
|
| 58 |
+
$senderId = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::GENERAL_SENDER,$storeId);
|
| 59 |
+
$sender = array('name'=>Mage::getStoreConfig("trans_email/ident_$senderId/name",$storeId), 'email'=> Mage::getStoreConfig("trans_email/ident_$senderId/email",$storeId));
|
| 60 |
+
$templateId = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::NEWORDER_TEMPLATE,$storeId);
|
| 61 |
+
|
| 62 |
+
$expr = sprintf('DATE_SUB(%s, %s)', $adapter->quote(now()), $this->_getIntervalUnitSql($days, 'DAY'));
|
| 63 |
+
$from = new Zend_Db_Expr($expr);
|
| 64 |
+
$expr = sprintf('DATE_SUB(%s, %s)', $adapter->quote(now()), $this->_getIntervalUnitSql($days-1, 'DAY'));
|
| 65 |
+
$to = new Zend_Db_Expr($expr);
|
| 66 |
+
$collection = Mage::getResourceModel('sales/order_collection');
|
| 67 |
+
$collection->addFieldToFilter('main_table.store_id',array('eq'=>$storeId))
|
| 68 |
+
->addFieldToFilter('main_table.created_at',array('from'=>$from,'to'=>$to));
|
| 69 |
+
if(count($customerGroups)) {
|
| 70 |
+
$collection->addFieldToFilter('main_table.customer_group_id',array('in'=> $customerGroups));
|
| 71 |
+
}
|
| 72 |
+
foreach($collection as $order) {
|
| 73 |
+
$translate = Mage::getSingleton('core/translate');
|
| 74 |
+
$email = $order->getCustomerEmail();
|
| 75 |
+
if($this->_isSubscribed($email,'neworder',$storeId)) {
|
| 76 |
+
$name = $order->getCustomerFirstname().' '.$order->getCustomerLastname();
|
| 77 |
+
$url = Mage::getModel('core/url')->setStore($storeId)->getUrl().'ebizautoresponder/autoresponder/unsubscribe?list=neworder&email='.$email.'&store='.$storeId;
|
| 78 |
+
$vars = array('tags'=>array($tags),'url'=>$url);
|
| 79 |
+
|
| 80 |
+
$mail = Mage::getModel('core/email_template')->setTemplateSubject($mailSubject)->sendTransactional($templateId,$sender,$email,$name,$vars,$storeId);
|
| 81 |
+
$translate->setTranslateInLine(true);
|
| 82 |
+
Mage::helper('ebizmarts_abandonedcart')->saveMail('new order',$email,$name,"",$storeId);
|
| 83 |
+
}
|
| 84 |
+
}
|
| 85 |
+
}
|
| 86 |
+
protected function _processBirthday($storeId)
|
| 87 |
+
{
|
| 88 |
+
$days = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::BIRTHDAY_DAYS,$storeId);
|
| 89 |
+
$customerGroups = explode(",",Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::BIRTHDAY_CUSTOMER_GROUPS, $storeId));
|
| 90 |
+
$senderId = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::GENERAL_SENDER,$storeId);
|
| 91 |
+
$sender = array('name'=>Mage::getStoreConfig("trans_email/ident_$senderId/name",$storeId), 'email'=> Mage::getStoreConfig("trans_email/ident_$senderId/email",$storeId));
|
| 92 |
+
$templateId = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::BIRTHDAY_TEMPLATE,$storeId);
|
| 93 |
+
$mailSubject = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::BIRTHDAY_SUBJECT,$storeId);
|
| 94 |
+
$tags = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::BIRTHDAY_MANDRILL_TAG,$storeId)."_$storeId";
|
| 95 |
+
$sendCoupon = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::BIRTHDAY_COUPON,$storeId);
|
| 96 |
+
$customerGroupsCoupon = explode(",",Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::BIRTHDAY_CUSTOMER_COUPON, $storeId));
|
| 97 |
+
|
| 98 |
+
|
| 99 |
+
$adapter = Mage::getSingleton('core/resource')->getConnection('sales_read');
|
| 100 |
+
$expr = sprintf('DATE_SUB(%s, %s)', $adapter->quote(now()), $this->_getIntervalUnitSql($days, 'DAY'));
|
| 101 |
+
$from = new Zend_Db_Expr($expr);
|
| 102 |
+
$expr = sprintf('DATE_SUB(%s, %s)', $adapter->quote(now()), $this->_getIntervalUnitSql($days-1, 'DAY'));
|
| 103 |
+
$to = new Zend_Db_Expr($expr);
|
| 104 |
+
$collection = Mage::getModel('customer/customer')->getCollection();
|
| 105 |
+
$date = date("Y-m-d H:i:s");
|
| 106 |
+
$date2 = date("Y-m-d H:i:s",strtotime(" - $days days"));
|
| 107 |
+
$month = date("m",strtotime($date2));
|
| 108 |
+
$day = date("d",strtotime($date2));
|
| 109 |
+
$moreselect = "MONTH(at_dob.value) = $month AND DAY(at_dob.value) = $day";
|
| 110 |
+
|
| 111 |
+
|
| 112 |
+
$collection->addAttributeToFilter('dob',array('neq'=>'null'))
|
| 113 |
+
->addFieldToFilter('store_id',array('eq'=>$storeId));
|
| 114 |
+
if(count($customerGroups)) {
|
| 115 |
+
$collection->addFieldToFilter('group_id',array('in'=>$customerGroups));
|
| 116 |
+
}
|
| 117 |
+
$collection->getSelect()->where($moreselect);
|
| 118 |
+
foreach($collection as $customer) {
|
| 119 |
+
$translate = Mage::getSingleton('core/translate');
|
| 120 |
+
$cust = Mage::getModel('customer/customer')->load($customer->getEntityId());
|
| 121 |
+
$email = $cust->getEmail();
|
| 122 |
+
$name = $cust->getFirstname().' '.$cust->getLastname();
|
| 123 |
+
if($this->_isSubscribed($email,'birthday',$storeId)) {
|
| 124 |
+
$vars = array();
|
| 125 |
+
$url = Mage::getModel('core/url')->setStore($storeId)->getUrl().'ebizautoresponder/autoresponder/unsubscribe?list=birthday&email='.$email.'&store='.$storeId;
|
| 126 |
+
$couponcode = '';
|
| 127 |
+
if($sendCoupon && in_array($customer->getGroupId(),$customerGroupsCoupon)) {
|
| 128 |
+
if(Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::BIRTHDAY_AUTOMATIC,$storeId)==Ebizmarts_Autoresponder_Model_Config::COUPON_AUTOMATIC) {
|
| 129 |
+
list($couponcode,$discount,$toDate) = $this->_createNewCoupon($storeId,$email);
|
| 130 |
+
$vars = array('couponcode'=>$couponcode,'discount' => $discount, 'todate' => $toDate, 'name' => $name,'tags'=>array($tags),'url'=>$url);
|
| 131 |
+
}
|
| 132 |
+
else {
|
| 133 |
+
$couponcode = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::BIRTHDAY_COUPON_CODE);
|
| 134 |
+
$vars = array('couponcode'=>$couponcode, 'name' => $name,'tags'=>array($tags),'url'=>$url);
|
| 135 |
+
}
|
| 136 |
+
|
| 137 |
+
}
|
| 138 |
+
$mail = Mage::getModel('core/email_template')->setTemplateSubject($mailSubject)->sendTransactional($templateId,$sender,$email,$name,$vars,$storeId);
|
| 139 |
+
$translate->setTranslateInLine(true);
|
| 140 |
+
Mage::helper('ebizmarts_abandonedcart')->saveMail('happy birthday',$email,$name,$couponcode,$storeId);
|
| 141 |
+
}
|
| 142 |
+
}
|
| 143 |
+
|
| 144 |
+
}
|
| 145 |
+
protected function _processNoActivity($storeId)
|
| 146 |
+
{
|
| 147 |
+
$days = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::NOACTIVITY_DAYS,$storeId);
|
| 148 |
+
$customerGroups = explode(",",Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::NOACTIVITY_CUSTOMER_GROUPS, $storeId));
|
| 149 |
+
$senderId = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::GENERAL_SENDER,$storeId);
|
| 150 |
+
$sender = array('name'=>Mage::getStoreConfig("trans_email/ident_$senderId/name",$storeId), 'email'=> Mage::getStoreConfig("trans_email/ident_$senderId/email",$storeId));
|
| 151 |
+
$templateId = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::NOACTIVITY_TEMPLATE,$storeId);
|
| 152 |
+
$mailSubject = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::NOACTIVITY_SUBJECT,$storeId);
|
| 153 |
+
$tags = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::NOACTIVITY_MANDRILL_TAG,$storeId)."_$storeId";
|
| 154 |
+
|
| 155 |
+
$collection = Mage::getModel('customer/customer')->getCollection();
|
| 156 |
+
|
| 157 |
+
|
| 158 |
+
if(count($customerGroups)) {
|
| 159 |
+
$collection->addFieldToFilter('group_id',array('in'=>$customerGroups));
|
| 160 |
+
}
|
| 161 |
+
$collection->addFieldToFilter('store_id',array('eq'=>$storeId));
|
| 162 |
+
|
| 163 |
+
foreach($collection as $customer) {
|
| 164 |
+
$customerId = $customer->getEntityId();
|
| 165 |
+
// get the orders for this customer for this store
|
| 166 |
+
$orderCollection = Mage::getModel('sales/order')->getCollection();
|
| 167 |
+
$orderCollection->addFieldToFilter('customer_id',array('eq'=>$customerId))
|
| 168 |
+
->addFieldToFilter('store_id',array('eq'=>$storeId));
|
| 169 |
+
if($orderCollection->getSize()>0) { // if the customer has any order for this store
|
| 170 |
+
$logCustomer = Mage::getModel('log/customer')->loadByCustomer($customer);
|
| 171 |
+
$lastVisited = $logCustomer->getLoginAt();
|
| 172 |
+
$limit = date("Y-m-d H:i:s",strtotime(" - $days days"));
|
| 173 |
+
if($limit>$lastVisited) {
|
| 174 |
+
$translate = Mage::getSingleton('core/translate');
|
| 175 |
+
$cust = Mage::getModel('customer/customer')->load($customerId);
|
| 176 |
+
$email = $cust->getEmail();
|
| 177 |
+
$name = $cust->getFirstname().' '.$cust->getLastname();
|
| 178 |
+
if($this->_isSubscribed($email,'noactivity',$storeId)) {
|
| 179 |
+
$url = Mage::getModel('core/url')->setStore($storeId)->getUrl().'ebizautoresponder/autoresponder/unsubscribe?list=noactivity&email='.$email.'&store='.$storeId;
|
| 180 |
+
$vars = array('name' => $name,'tags'=>array($tags),'lastlogin'=>$lastVisited,'url'=>$url);
|
| 181 |
+
$mail = Mage::getModel('core/email_template')->setTemplateSubject($mailSubject)->sendTransactional($templateId,$sender,$email,$name,$vars,$storeId);
|
| 182 |
+
$translate->setTranslateInLine(true);
|
| 183 |
+
Mage::helper('ebizmarts_abandonedcart')->saveMail('no activity',$email,$name,"",$storeId);
|
| 184 |
+
}
|
| 185 |
+
}
|
| 186 |
+
}
|
| 187 |
+
}
|
| 188 |
+
|
| 189 |
+
}
|
| 190 |
+
protected function _processRelated($storeId)
|
| 191 |
+
{
|
| 192 |
+
$customerGroups = explode(",",Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::RELATED_CUSTOMER_GROUPS, $storeId));
|
| 193 |
+
$days = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::RELATED_DAYS,$storeId);
|
| 194 |
+
$tags = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::RELATED_MANDRILL_TAG,$storeId)."_$storeId";
|
| 195 |
+
$adapter = Mage::getSingleton('core/resource')->getConnection('sales_read');
|
| 196 |
+
$mailSubject = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::RELATED_SUBJECT,$storeId);
|
| 197 |
+
$senderId = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::GENERAL_SENDER,$storeId);
|
| 198 |
+
$sender = array('name'=>Mage::getStoreConfig("trans_email/ident_$senderId/name",$storeId), 'email'=> Mage::getStoreConfig("trans_email/ident_$senderId/email",$storeId));
|
| 199 |
+
$templateId = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::RELATED_TEMPLATE,$storeId);
|
| 200 |
+
$maxRelated = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::RELATED_MAX,$storeId);
|
| 201 |
+
|
| 202 |
+
$expr = sprintf('DATE_SUB(%s, %s)', $adapter->quote(now()), $this->_getIntervalUnitSql($days, 'DAY'));
|
| 203 |
+
$from = new Zend_Db_Expr($expr);
|
| 204 |
+
$expr = sprintf('DATE_SUB(%s, %s)', $adapter->quote(now()), $this->_getIntervalUnitSql($days-1, 'DAY'));
|
| 205 |
+
$to = new Zend_Db_Expr($expr);
|
| 206 |
+
$collection = Mage::getResourceModel('sales/order_collection');
|
| 207 |
+
$collection->addFieldToFilter('main_table.store_id',array('eq'=>$storeId))
|
| 208 |
+
->addFieldToFilter('main_table.created_at',array('from'=>$from,'to'=>$to));
|
| 209 |
+
if(count($customerGroups)) {
|
| 210 |
+
$collection->addFieldToFilter('main_table.customer_group_id',array('in'=> $customerGroups));
|
| 211 |
+
}
|
| 212 |
+
foreach($collection as $order) {
|
| 213 |
+
$counter = 0;
|
| 214 |
+
$allRelated = array();
|
| 215 |
+
foreach($order->getAllItems() as $itemId => $item) {
|
| 216 |
+
if($maxRelated && $maxRelated < $counter) {
|
| 217 |
+
break;
|
| 218 |
+
}
|
| 219 |
+
$product = Mage::getModel('catalog/product')->load($item->getProductId());
|
| 220 |
+
foreach($product->getRelatedLinkCollection() as $related) {
|
| 221 |
+
if($maxRelated && $maxRelated < $counter) {
|
| 222 |
+
break;
|
| 223 |
+
}
|
| 224 |
+
$relatedProduct = Mage::getModel('catalog/product')->load($related->getLinkedProductId());
|
| 225 |
+
$allRelated[$counter++] = $relatedProduct;
|
| 226 |
+
}
|
| 227 |
+
}
|
| 228 |
+
if($counter > 0) {
|
| 229 |
+
$translate = Mage::getSingleton('core/translate');
|
| 230 |
+
if($this->_isSubscribed($email,'related',$storeId)) {
|
| 231 |
+
$email = $order->getCustomerEmail();
|
| 232 |
+
$name = $order->getCustomerFirstname().' '.$order->getCustomerLastname();
|
| 233 |
+
$url = Mage::getModel('core/url')->setStore($storeId)->getUrl().'ebizautoresponder/autoresponder/unsubscribe?list=related&email='.$email.'&store='.$storeId;
|
| 234 |
+
$vars = array('name' => $name,'tags'=>array($tags),'related'=>$allRelated,'url'=>$url);
|
| 235 |
+
$mail = Mage::getModel('core/email_template')->setTemplateSubject($mailSubject)->sendTransactional($templateId,$sender,$email,$name,$vars,$storeId);
|
| 236 |
+
$translate->setTranslateInLine(true);
|
| 237 |
+
Mage::helper('ebizmarts_abandonedcart')->saveMail('related products',$email,$name,"",$storeId);
|
| 238 |
+
}
|
| 239 |
+
}
|
| 240 |
+
}
|
| 241 |
+
|
| 242 |
+
}
|
| 243 |
+
protected function _processReview($storeId)
|
| 244 |
+
{
|
| 245 |
+
$customerGroups = explode(",",Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::REVIEW_CUSTOMER_GROUPS, $storeId));
|
| 246 |
+
$days = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::REVIEW_DAYS,$storeId);
|
| 247 |
+
$tags = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::REVIEW_MANDRILL_TAG,$storeId)."_$storeId";
|
| 248 |
+
$adapter = Mage::getSingleton('core/resource')->getConnection('sales_read');
|
| 249 |
+
$mailSubject = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::REVIEW_SUBJECT,$storeId);
|
| 250 |
+
$senderId = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::GENERAL_SENDER,$storeId);
|
| 251 |
+
$sender = array('name'=>Mage::getStoreConfig("trans_email/ident_$senderId/name",$storeId), 'email'=> Mage::getStoreConfig("trans_email/ident_$senderId/email",$storeId));
|
| 252 |
+
$templateId = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::REVIEW_TEMPLATE,$storeId);
|
| 253 |
+
|
| 254 |
+
$expr = sprintf('DATE_SUB(%s, %s)', $adapter->quote(now()), $this->_getIntervalUnitSql($days, 'DAY'));
|
| 255 |
+
$from = new Zend_Db_Expr($expr);
|
| 256 |
+
$expr = sprintf('DATE_SUB(%s, %s)', $adapter->quote(now()), $this->_getIntervalUnitSql($days-1, 'DAY'));
|
| 257 |
+
$to = new Zend_Db_Expr($expr);
|
| 258 |
+
$collection = Mage::getResourceModel('sales/order_collection');
|
| 259 |
+
$collection->addFieldToFilter('main_table.store_id',array('eq'=>$storeId))
|
| 260 |
+
->addFieldToFilter('main_table.created_at',array('from'=>$from,'to'=>$to));
|
| 261 |
+
if(count($customerGroups)) {
|
| 262 |
+
$collection->addFieldToFilter('main_table.customer_group_id',array('in'=> $customerGroups));
|
| 263 |
+
}
|
| 264 |
+
foreach($collection as $order) {
|
| 265 |
+
$translate = Mage::getSingleton('core/translate');
|
| 266 |
+
$email = $order->getCustomerEmail();
|
| 267 |
+
if($this->_isSubscribed($email,'review',$storeId)) {
|
| 268 |
+
$name = $order->getCustomerFirstname().' '.$order->getCustomerLastname();
|
| 269 |
+
$products = array();
|
| 270 |
+
foreach($order->getAllItems() as $item) {
|
| 271 |
+
$products[] = Mage::getModel('catalog/product')->load($item->getProductId());
|
| 272 |
+
}
|
| 273 |
+
$orderNum = $order->getIncrementId();
|
| 274 |
+
$url = Mage::getModel('core/url')->setStore($storeId)->getUrl().'ebizautoresponder/autoresponder/unsubscribe?list=review&email='.$email.'&store='.$storeId;
|
| 275 |
+
$vars = array('name' => $name,'tags'=>array($tags),'products'=>$products,'ordernum'=>$orderNum,'url'=>$url);
|
| 276 |
+
$mail = Mage::getModel('core/email_template')->setTemplateSubject($mailSubject)->sendTransactional($templateId,$sender,$email,$name,$vars,$storeId);
|
| 277 |
+
$translate->setTranslateInLine(true);
|
| 278 |
+
Mage::helper('ebizmarts_abandonedcart')->saveMail('product review',$email,$name,"",$storeId);
|
| 279 |
+
}
|
| 280 |
+
}
|
| 281 |
+
|
| 282 |
+
}
|
| 283 |
+
protected function _processWishlist($storeId)
|
| 284 |
+
{
|
| 285 |
+
$customerGroups = explode(",",Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::WISHLIST_CUSTOMER_GROUPS, $storeId));
|
| 286 |
+
$days = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::WISHLIST_DAYS,$storeId);
|
| 287 |
+
$tags = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::WISHLIST_MANDRILL_TAG,$storeId)."_$storeId";
|
| 288 |
+
$adapter = Mage::getSingleton('core/resource')->getConnection('sales_read');
|
| 289 |
+
$mailSubject = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::WISHLIST_SUBJECT,$storeId);
|
| 290 |
+
$senderId = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::GENERAL_SENDER,$storeId);
|
| 291 |
+
$sender = array('name'=>Mage::getStoreConfig("trans_email/ident_$senderId/name",$storeId), 'email'=> Mage::getStoreConfig("trans_email/ident_$senderId/email",$storeId));
|
| 292 |
+
$templateId = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::WISHLIST_TEMPLATE,$storeId);
|
| 293 |
+
|
| 294 |
+
$expr = sprintf('DATE_SUB(%s, %s)', $adapter->quote(now()), $this->_getIntervalUnitSql($days, 'DAY'));
|
| 295 |
+
$from = new Zend_Db_Expr($expr);
|
| 296 |
+
$expr = sprintf('DATE_SUB(%s, %s)', $adapter->quote(now()), $this->_getIntervalUnitSql($days-1, 'DAY'));
|
| 297 |
+
$to = new Zend_Db_Expr($expr);
|
| 298 |
+
|
| 299 |
+
$collection = Mage::getModel('wishlist/item')->getCollection();
|
| 300 |
+
$collection->addFieldToFilter('main_table.added_at',array('from'=>$from,'to'=>$to))
|
| 301 |
+
->addFieldToFilter('main_table.store_id',array('eq'=>$storeId))
|
| 302 |
+
->setOrder('main_table.wishlist_id');
|
| 303 |
+
$wishlist_ant = -1;
|
| 304 |
+
$wishlistId = $collection->getFirstItem()->getWishlistId();
|
| 305 |
+
$products = array();
|
| 306 |
+
foreach($collection as $item) {
|
| 307 |
+
if($wishlistId != $wishlist_ant) {
|
| 308 |
+
if($wishlist_ant != -1 && count($products) > 0) {
|
| 309 |
+
$translate = Mage::getSingleton('core/translate');
|
| 310 |
+
$email = $customer->getEmail();
|
| 311 |
+
if($this->_isSubscribed($email,'wishlist',$storeId)) {
|
| 312 |
+
$name = $customer->getFirstname().' '.$customer->getLastname();
|
| 313 |
+
$url = Mage::getModel('core/url')->setStore($storeId)->getUrl().'ebizautoresponder/autoresponder/unsubscribe?list=wishlist&email='.$email.'&store='.$storeId;
|
| 314 |
+
$vars = array('name' => $name,'tags'=>array($tags),'products'=>$products,'url'=>$url);
|
| 315 |
+
$mail = Mage::getModel('core/email_template')->setTemplateSubject($mailSubject)->sendTransactional($templateId,$sender,$email,$name,$vars,$storeId);
|
| 316 |
+
$translate->setTranslateInLine(true);
|
| 317 |
+
Mage::helper('ebizmarts_abandonedcart')->saveMail('wishlist',$email,$name,"",$storeId);
|
| 318 |
+
}
|
| 319 |
+
|
| 320 |
+
}
|
| 321 |
+
$wishlist_ant = $wishlistId;
|
| 322 |
+
$wishlistId = $item->getWishlistId();
|
| 323 |
+
$wishlist = Mage::getModel('wishlist/wishlist')->load($wishlistId);
|
| 324 |
+
$customer = Mage::getModel('customer/customer')->load($wishlist->getCustomerId());
|
| 325 |
+
$products = array();
|
| 326 |
+
}
|
| 327 |
+
if(in_array($customer->getGroupId(),$customerGroups)) {
|
| 328 |
+
$products[] = Mage::getModel('catalog/product')->load($item->getProductId());
|
| 329 |
+
}
|
| 330 |
+
}
|
| 331 |
+
if(count($products)) {
|
| 332 |
+
$translate = Mage::getSingleton('core/translate');
|
| 333 |
+
$email = $customer->getEmail();
|
| 334 |
+
if($this->_isSubscribed($email,'wishlist',$storeId)) {
|
| 335 |
+
$name = $customer->getFirstname().' '.$customer->getLastname();
|
| 336 |
+
$url = Mage::getModel('core/url')->setStore($storeId)->getUrl().'ebizautoresponder/autoresponder/unsubscribe?list=wishlist&email='.$email.'&store='.$storeId;
|
| 337 |
+
$vars = array('name' => $name,'tags'=>array($tags),'products'=>$products,'url'=>$url);
|
| 338 |
+
$mail = Mage::getModel('core/email_template')->setTemplateSubject($mailSubject)->sendTransactional($templateId,$sender,$email,$name,$vars,$storeId);
|
| 339 |
+
$translate->setTranslateInLine(true);
|
| 340 |
+
Mage::helper('ebizmarts_abandonedcart')->saveMail('wishlist',$email,$name,"",$storeId);
|
| 341 |
+
}
|
| 342 |
+
}
|
| 343 |
+
|
| 344 |
+
}
|
| 345 |
+
protected function _createNewCoupon($store,$email)
|
| 346 |
+
{
|
| 347 |
+
$couponamount = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::BIRTHDAY_DISCOUNT, $store);
|
| 348 |
+
$couponexpiredays = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::BIRTHDAY_EXPIRE, $store);
|
| 349 |
+
$coupontype = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::BIRTHDAY_DISCOUNT_TYPE, $store);
|
| 350 |
+
$couponlength = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::BIRTHDAY_LENGTH, $store);
|
| 351 |
+
$couponlabel = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::BIRTHDAY_COUPON_LABEL, $store);
|
| 352 |
+
$websiteid = Mage::getModel('core/store')->load($store)->getWebsiteId();
|
| 353 |
+
|
| 354 |
+
$fromDate = date("Y-m-d");
|
| 355 |
+
$toDate = date('Y-m-d', strtotime($fromDate. " + $couponexpiredays day"));
|
| 356 |
+
if($coupontype == 1) {
|
| 357 |
+
$action = 'cart_fixed';
|
| 358 |
+
$discount = Mage::app()->getStore($store)->getCurrentCurrencyCode()."$couponamount";
|
| 359 |
+
}
|
| 360 |
+
elseif($coupontype == 2) {
|
| 361 |
+
$action = 'by_percent';
|
| 362 |
+
$discount = "$couponamount%";
|
| 363 |
+
}
|
| 364 |
+
$customer_group = new Mage_Customer_Model_Group();
|
| 365 |
+
$allGroups = $customer_group->getCollection()->toOptionHash();
|
| 366 |
+
$groups = array();
|
| 367 |
+
foreach($allGroups as $groupid=>$name) {
|
| 368 |
+
$groups[] = $groupid;
|
| 369 |
+
}
|
| 370 |
+
$coupon_rule = Mage::getModel('salesrule/rule');
|
| 371 |
+
$coupon_rule->setName("Birthday coupon $email")
|
| 372 |
+
->setDescription("Birthday coupon $email")
|
| 373 |
+
->setFromDate($fromDate)
|
| 374 |
+
->setToDate($toDate)
|
| 375 |
+
->setIsActive(1)
|
| 376 |
+
->setCouponType(2)
|
| 377 |
+
->setUsesPerCoupon(1)
|
| 378 |
+
->setUsesPerCustomer(1)
|
| 379 |
+
->setCustomerGroupIds($groups)
|
| 380 |
+
->setProductIds('')
|
| 381 |
+
->setLengthMin($couponlength)
|
| 382 |
+
->setLengthMax($couponlength)
|
| 383 |
+
->setSortOrder(0)
|
| 384 |
+
->setStoreLabels(array($couponlabel))
|
| 385 |
+
->setSimpleAction($action)
|
| 386 |
+
->setDiscountAmount($couponamount)
|
| 387 |
+
->setDiscountQty(0)
|
| 388 |
+
->setDiscountStep('0')
|
| 389 |
+
->setSimpleFreeShipping('0')
|
| 390 |
+
->setApplyToShipping('0')
|
| 391 |
+
->setIsRss(0)
|
| 392 |
+
->setWebsiteIds($websiteid);
|
| 393 |
+
$uniqueId = Mage::getSingleton('salesrule/coupon_codegenerator', array('length' => $couponlength))->generateCode();
|
| 394 |
+
$coupon_rule->setCouponCode($uniqueId);
|
| 395 |
+
$coupon_rule->save();
|
| 396 |
+
return array($uniqueId,$discount,$toDate);
|
| 397 |
+
}
|
| 398 |
+
|
| 399 |
+
function _getIntervalUnitSql($interval, $unit)
|
| 400 |
+
{
|
| 401 |
+
return sprintf('INTERVAL %d %s', $interval, $unit);
|
| 402 |
+
}
|
| 403 |
+
protected function _isSubscribed($email,$list,$storeId)
|
| 404 |
+
{
|
| 405 |
+
$collection = Mage::getModel('ebizmarts_autoresponder/unsubscribe')->getCollection();
|
| 406 |
+
$collection->addFieldtoFilter('main_table.email',array('eq'=>$email))
|
| 407 |
+
->addFieldtoFilter('main_table.list',array('eq'=>$list))
|
| 408 |
+
->addFieldtoFilter('main_table.store_id',array('eq'=>$storeId));
|
| 409 |
+
return $collection->getSize() == 0;
|
| 410 |
+
|
| 411 |
+
}
|
| 412 |
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Author : Ebizmarts <info@ebizmarts.com>
|
| 4 |
+
* Date : 6/24/13
|
| 5 |
+
* Time : 5:27 PM
|
| 6 |
+
* File : EventObserver.php
|
| 7 |
+
* Module : Ebizmarts_Magemonkey
|
| 8 |
+
*/
|
| 9 |
+
class Ebizmarts_Autoresponder_Model_EventObserver
|
| 10 |
+
{
|
| 11 |
+
/**
|
| 12 |
+
* @param Varien_Event_Observer $o
|
| 13 |
+
*/
|
| 14 |
+
public function saveConfig(Varien_Event_Observer $o)
|
| 15 |
+
{
|
| 16 |
+
$store = is_null($o->getEvent()->getStore()) ? 'default': $o->getEvent()->getStore();
|
| 17 |
+
if(!Mage::helper('mandrill')->useTransactionalService()) {
|
| 18 |
+
$config = new Mage_Core_Model_Config();
|
| 19 |
+
$config->saveConfig(Ebizmarts_Autoresponder_Model_Config::GENERAL_ACTIVE,false,"default",$store);
|
| 20 |
+
Mage::getConfig()->cleanCache();
|
| 21 |
+
}
|
| 22 |
+
if(!Mage::getStoreConfig('customer/address/dob_show')) {
|
| 23 |
+
$config = new Mage_Core_Model_Config();
|
| 24 |
+
$config->saveConfig(Ebizmarts_Autoresponder_Model_Config::BIRTHDAY_ACTIVE,false,"default",$store);
|
| 25 |
+
Mage::getConfig()->cleanCache();
|
| 26 |
+
}
|
| 27 |
+
if(!Mage::getStoreConfig('customer/address/dob_show',$store)) {
|
| 28 |
+
$config = new Mage_Core_Model_Config();
|
| 29 |
+
$config->saveConfig(Ebizmarts_Autoresponder_Model_Config::BIRTHDAY_ACTIVE,false,"default",$store);
|
| 30 |
+
Mage::getConfig()->cleanCache();
|
| 31 |
+
}
|
| 32 |
+
if(Mage::getStoreConfig('advanced/modules_disable_output/Mage_Wishlist',$store)) {
|
| 33 |
+
$config = new Mage_Core_Model_Config();
|
| 34 |
+
$config->saveConfig(Ebizmarts_Autoresponder_Model_Config::WISHLIST_ACTIVE,false,"default",$store);
|
| 35 |
+
Mage::getConfig()->cleanCache();
|
| 36 |
+
}
|
| 37 |
+
if(Mage::getStoreConfig('advanced/modules_disable_output/Mage_Review',$store)) {
|
| 38 |
+
$config = new Mage_Core_Model_Config();
|
| 39 |
+
$config->saveConfig(Ebizmarts_Autoresponder_Model_Config::REVIEW_ACTIVE,false,"default",$store);
|
| 40 |
+
Mage::getConfig()->cleanCache();
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
}
|
| 44 |
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Author : Ebizmarts <info@ebizmarts.com>
|
| 4 |
+
* Date : 6/25/13
|
| 5 |
+
* Time : 5:24 PM
|
| 6 |
+
* File : Unsubscribe.php
|
| 7 |
+
* Module : Ebizmarts_Magemonkey
|
| 8 |
+
*/
|
| 9 |
+
class Ebizmarts_Autoresponder_Model_Resource_Unsubscribe extends Mage_Core_Model_Mysql4_Abstract
|
| 10 |
+
{
|
| 11 |
+
public function _construct()
|
| 12 |
+
{
|
| 13 |
+
$this->_init('ebizmarts_autoresponder/unsubscribe','id');
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Author : Ebizmarts <info@ebizmarts.com>
|
| 4 |
+
* Date : 6/26/13
|
| 5 |
+
* Time : 7:51 AM
|
| 6 |
+
* File : Collection.php
|
| 7 |
+
* Module : Ebizmarts_Magemonkey
|
| 8 |
+
*/
|
| 9 |
+
class Ebizmarts_Autoresponder_Model_Resource_Unsubscribe_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
| 10 |
+
{
|
| 11 |
+
protected function _construct()
|
| 12 |
+
{
|
| 13 |
+
$this->_init('ebizmarts_autoresponder/unsubscribe');
|
| 14 |
+
}
|
| 15 |
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Author : Ebizmarts <info@ebizmarts.com>
|
| 4 |
+
* Date : 6/14/13
|
| 5 |
+
* Time : 4:15 PM
|
| 6 |
+
* File : Automatic.php
|
| 7 |
+
* Module : Ebizmarts_Magemonkey
|
| 8 |
+
*/
|
| 9 |
+
class Ebizmarts_Autoresponder_Model_System_Config_Automatic
|
| 10 |
+
{
|
| 11 |
+
/**
|
| 12 |
+
* @return array
|
| 13 |
+
*/
|
| 14 |
+
public function toOptionArray()
|
| 15 |
+
{
|
| 16 |
+
$options = array(
|
| 17 |
+
array('value'=> 1, 'label' => Mage::helper('ebizmarts_autoresponder')->__('Specific')),
|
| 18 |
+
array('value'=> 2, 'label' => Mage::helper('ebizmarts_autoresponder')->__('Automatic'))
|
| 19 |
+
);
|
| 20 |
+
return $options;
|
| 21 |
+
}
|
| 22 |
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Author : Ebizmarts <info@ebizmarts.com>
|
| 4 |
+
* Date : 6/14/13
|
| 5 |
+
* Time : 4:21 PM
|
| 6 |
+
* File : Customergroup.php
|
| 7 |
+
* Module : Ebizmarts_Magemonkey
|
| 8 |
+
*/
|
| 9 |
+
class Ebizmarts_Autoresponder_Model_System_Config_Customergroup
|
| 10 |
+
{
|
| 11 |
+
protected $_options;
|
| 12 |
+
|
| 13 |
+
public function toOptionArray()
|
| 14 |
+
{
|
| 15 |
+
if (!$this->_options) {
|
| 16 |
+
$this->_options = Mage::getResourceModel('customer/group_collection')
|
| 17 |
+
->loadData()->toOptionArray();
|
| 18 |
+
}
|
| 19 |
+
return $this->_options;
|
| 20 |
+
}
|
| 21 |
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Author : Ebizmarts <info@ebizmarts.com>
|
| 4 |
+
* Date : 6/14/13
|
| 5 |
+
* Time : 4:16 PM
|
| 6 |
+
* File : Discounttype.php
|
| 7 |
+
* Module : Ebizmarts_Magemonkey
|
| 8 |
+
*/
|
| 9 |
+
class Ebizmarts_Autoresponder_Model_System_Config_Discounttype
|
| 10 |
+
{
|
| 11 |
+
/**
|
| 12 |
+
* @return array
|
| 13 |
+
*/
|
| 14 |
+
public function toOptionArray()
|
| 15 |
+
{
|
| 16 |
+
$options = array(
|
| 17 |
+
array('value'=> 1, 'label' => Mage::helper('ebizmarts_abandonedcart')->__('Fixed amount')),
|
| 18 |
+
array('value'=> 2, 'label' => Mage::helper('ebizmarts_abandonedcart')->__('Percentage'))
|
| 19 |
+
);
|
| 20 |
+
return $options;
|
| 21 |
+
}
|
| 22 |
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Author : Ebizmarts <info@ebizmarts.com>
|
| 4 |
+
* Date : 6/25/13
|
| 5 |
+
* Time : 5:21 PM
|
| 6 |
+
* File : Unsubscribe.php
|
| 7 |
+
* Module : Ebizmarts_Magemonkey
|
| 8 |
+
*/
|
| 9 |
+
class Ebizmarts_Autoresponder_Model_Unsubscribe extends Mage_Core_Model_Abstract
|
| 10 |
+
{
|
| 11 |
+
public function _construct() {
|
| 12 |
+
$this->_init('ebizmarts_autoresponder/unsubscribe');
|
| 13 |
+
}
|
| 14 |
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Author : Ebizmarts <info@ebizmarts.com>
|
| 4 |
+
* Date : 6/25/13
|
| 5 |
+
* Time : 3:22 PM
|
| 6 |
+
* File : AutoresponderController.php
|
| 7 |
+
* Module : Ebizmarts_Magemonkey
|
| 8 |
+
*/
|
| 9 |
+
class Ebizmarts_Autoresponder_AutoresponderController extends Mage_Core_Controller_Front_Action
|
| 10 |
+
{
|
| 11 |
+
public function indexAction()
|
| 12 |
+
{
|
| 13 |
+
if(!Mage::helper('customer')->isLoggedIn()) {
|
| 14 |
+
$this->_redirect('/');
|
| 15 |
+
}
|
| 16 |
+
$this->loadLayout();
|
| 17 |
+
$this->_initLayoutMessages('customer/session');
|
| 18 |
+
$navigationBlock = $this->getLayout()->getBlock('customer_account_navigation');
|
| 19 |
+
$this->getLayout()->getBlock('head')->setTitle($this->__('Newsletter Subscription'));
|
| 20 |
+
$this->renderLayout();
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
}
|
| 24 |
+
public function unsubscribeAction(){
|
| 25 |
+
$params = $this->getRequest()->getParams();
|
| 26 |
+
if(isset($params['email'])&&isset($params['list'])&&$params['store']) {
|
| 27 |
+
$collection = Mage::getModel('ebizmarts_autoresponder/unsubscribe')->getCollection();
|
| 28 |
+
$collection->addFieldToFilter('main_table.email',array('eq'=>$params['email']))
|
| 29 |
+
->addFieldToFilter('main_table.list',array('eq'=>$params['list']))
|
| 30 |
+
->addFieldToFilter('main_table.store_id',array('eq'=>$params['store']));
|
| 31 |
+
if($collection->getSize() == 0) {
|
| 32 |
+
$unsubscribe = Mage::getModel('ebizmarts_autoresponder/unsubscribe');
|
| 33 |
+
$unsubscribe->setEmail($params['email'])
|
| 34 |
+
->setList($params['list'])
|
| 35 |
+
->setStoreId($params['store']);
|
| 36 |
+
$unsubscribe->save();
|
| 37 |
+
}
|
| 38 |
+
}
|
| 39 |
+
$this->loadLayout();
|
| 40 |
+
$this->renderLayout();
|
| 41 |
+
}
|
| 42 |
+
public function savelistAction()
|
| 43 |
+
{
|
| 44 |
+
if(!Mage::helper('customer')->isLoggedIn()) {
|
| 45 |
+
$this->_redirect('/');
|
| 46 |
+
}
|
| 47 |
+
$params = $this->getRequest()->getParams();
|
| 48 |
+
$lists = Mage::helper('ebizmarts_autoresponder')->getLists();
|
| 49 |
+
$email = Mage::helper('customer')->getCustomer()->getEmail();
|
| 50 |
+
$storeId = Mage::app()->getStore()->getStoreId();
|
| 51 |
+
|
| 52 |
+
foreach($lists as $key => $list) {
|
| 53 |
+
$collection = Mage::getModel('ebizmarts_autoresponder/unsubscribe')->getCollection();
|
| 54 |
+
$collection->addFieldToFilter('main_table.email',array('eq'=>$email))
|
| 55 |
+
->addFieldToFilter('main_table.list',array('eq'=>$key))
|
| 56 |
+
->addFieldToFilter('main_table.store_id',array('eq'=>$storeId));
|
| 57 |
+
if(array_key_exists($key,$params) && $collection->getSize() > 0) { //try to remove
|
| 58 |
+
$collection->getFirstItem()->delete();
|
| 59 |
+
}
|
| 60 |
+
else if(!array_key_exists($key,$params)&&$collection->getSize() == 0){
|
| 61 |
+
$unsubscribe = Mage::getModel('ebizmarts_autoresponder/unsubscribe');
|
| 62 |
+
$unsubscribe->setEmail($email)
|
| 63 |
+
->setList($key)
|
| 64 |
+
->setStoreId($storeId);
|
| 65 |
+
Mage::log($unsubscribe);
|
| 66 |
+
$unsubscribe->save();
|
| 67 |
+
}
|
| 68 |
+
}
|
| 69 |
+
Mage::getSingleton('core/session')
|
| 70 |
+
->addSuccess($this->__('Lists updated'));
|
| 71 |
+
|
| 72 |
+
$this->_redirect('ebizautoresponder/autoresponder');
|
| 73 |
+
}
|
| 74 |
+
protected function _getCustomerId()
|
| 75 |
+
{
|
| 76 |
+
if(Mage::getSingleton('customer/session')->isLoggedIn()) {
|
| 77 |
+
$customerData = Mage::getSingleton('customer/session')->getCustomer();
|
| 78 |
+
return $customerData->getId();
|
| 79 |
+
}
|
| 80 |
+
}
|
| 81 |
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
+
<config>
|
| 3 |
+
<acl>
|
| 4 |
+
<resources>
|
| 5 |
+
<admin>
|
| 6 |
+
<children>
|
| 7 |
+
<system>
|
| 8 |
+
<children>
|
| 9 |
+
<config>
|
| 10 |
+
<children>
|
| 11 |
+
<ebizmarts_autoresponder translate="title" module="ebizmarts_autoresponder">
|
| 12 |
+
<title>Ebizmarts Autoresponder</title>
|
| 13 |
+
</ebizmarts_autoresponder>
|
| 14 |
+
</children>
|
| 15 |
+
</config>
|
| 16 |
+
</children>
|
| 17 |
+
</system>
|
| 18 |
+
</children>
|
| 19 |
+
</admin>
|
| 20 |
+
</resources>
|
| 21 |
+
</acl>
|
| 22 |
+
<translate>
|
| 23 |
+
<modules>
|
| 24 |
+
<Ebizmarts_Autoresponder>
|
| 25 |
+
<files>
|
| 26 |
+
<default>Ebizmarts_Autoresponder.csv</default>
|
| 27 |
+
</files>
|
| 28 |
+
</Ebizmarts_Autoresponder>
|
| 29 |
+
</modules>
|
| 30 |
+
</translate>
|
| 31 |
+
</config>
|
|
@@ -0,0 +1,201 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<!--
|
| 3 |
+
Configuration file for Ebizmarts_Autoresponder module, touch at you entire responsibility
|
| 4 |
+
|
| 5 |
+
Author : Ebizmarts <info@ebizmarts.com>
|
| 6 |
+
Date : 4/28/13
|
| 7 |
+
Time : 11:20 AM
|
| 8 |
+
File : config.xml
|
| 9 |
+
Module : Ebizmarts_Magemonkey
|
| 10 |
+
-->
|
| 11 |
+
<config>
|
| 12 |
+
<modules>
|
| 13 |
+
<Ebizmarts_Autoresponder>
|
| 14 |
+
<version>0.1.2</version>
|
| 15 |
+
</Ebizmarts_Autoresponder>
|
| 16 |
+
</modules>
|
| 17 |
+
<global>
|
| 18 |
+
<models>
|
| 19 |
+
<ebizmarts_autoresponder>
|
| 20 |
+
<class>Ebizmarts_Autoresponder_Model</class>
|
| 21 |
+
<resourceModel>ebizmarts_autoresponder_resource</resourceModel>
|
| 22 |
+
</ebizmarts_autoresponder>
|
| 23 |
+
<ebizmarts_autoresponder_resource>
|
| 24 |
+
<class>Ebizmarts_Autoresponder_Model_Resource</class>
|
| 25 |
+
<deprecatedNode>ebizmarts_autoresponder_mysql4</deprecatedNode>
|
| 26 |
+
<entities>
|
| 27 |
+
<unsubscribe>
|
| 28 |
+
<table>ebizmarts_autoresponder_unsubscribe</table>
|
| 29 |
+
</unsubscribe>
|
| 30 |
+
</entities>
|
| 31 |
+
</ebizmarts_autoresponder_resource>
|
| 32 |
+
</models>
|
| 33 |
+
<blocks>
|
| 34 |
+
<ebizmarts_autoresponder>
|
| 35 |
+
<class>Ebizmarts_Autoresponder_Block</class>
|
| 36 |
+
</ebizmarts_autoresponder>
|
| 37 |
+
</blocks>
|
| 38 |
+
<helpers>
|
| 39 |
+
<ebizmarts_autoresponder>
|
| 40 |
+
<class>Ebizmarts_Autoresponder_Helper</class>
|
| 41 |
+
</ebizmarts_autoresponder>
|
| 42 |
+
</helpers>
|
| 43 |
+
<resources>
|
| 44 |
+
<ebizmarts_autoresponder_setup>
|
| 45 |
+
<setup>
|
| 46 |
+
<module>Ebizmarts_Autoresponder</module>
|
| 47 |
+
</setup>
|
| 48 |
+
</ebizmarts_autoresponder_setup>
|
| 49 |
+
</resources>
|
| 50 |
+
<template>
|
| 51 |
+
<email>
|
| 52 |
+
<ebizmarts_autoresponder_neworder_template translate="label" module="ebizmarts_autoresponder">
|
| 53 |
+
<label>New Order Email</label>
|
| 54 |
+
<file>ebizmarts/autoresponder/neworder.html</file>
|
| 55 |
+
<type>html</type>
|
| 56 |
+
</ebizmarts_autoresponder_neworder_template>
|
| 57 |
+
</email>
|
| 58 |
+
</template>
|
| 59 |
+
<template>
|
| 60 |
+
<email>
|
| 61 |
+
<ebizmarts_autoresponder_related_template translate="label" module="ebizmarts_autoresponder">
|
| 62 |
+
<label>Related Products Email</label>
|
| 63 |
+
<file>ebizmarts/autoresponder/relatedproducts.html</file>
|
| 64 |
+
<type>html</type>
|
| 65 |
+
</ebizmarts_autoresponder_related_template>
|
| 66 |
+
</email>
|
| 67 |
+
</template>
|
| 68 |
+
<template>
|
| 69 |
+
<email>
|
| 70 |
+
<ebizmarts_autoresponder_review_template translate="label" module="ebizmarts_autoresponder">
|
| 71 |
+
<label>Review Email</label>
|
| 72 |
+
<file>ebizmarts/autoresponder/review.html</file>
|
| 73 |
+
<type>html</type>
|
| 74 |
+
</ebizmarts_autoresponder_review_template>
|
| 75 |
+
</email>
|
| 76 |
+
</template>
|
| 77 |
+
<template>
|
| 78 |
+
<email>
|
| 79 |
+
<ebizmarts_autoresponder_birthday_template translate="label" module="ebizmarts_autoresponder">
|
| 80 |
+
<label>Customer Birthday Email</label>
|
| 81 |
+
<file>ebizmarts/autoresponder/birthday.html</file>
|
| 82 |
+
<type>html</type>
|
| 83 |
+
</ebizmarts_autoresponder_birthday_template>
|
| 84 |
+
</email>
|
| 85 |
+
</template>
|
| 86 |
+
<template>
|
| 87 |
+
<email>
|
| 88 |
+
<ebizmarts_autoresponder_registration_template translate="label" module="ebizmarts_autoresponder">
|
| 89 |
+
<label>Registration Email</label>
|
| 90 |
+
<file>ebizmarts/autoresponder/registration.html</file>
|
| 91 |
+
<type>html</type>
|
| 92 |
+
</ebizmarts_autoresponder_registration_template>
|
| 93 |
+
</email>
|
| 94 |
+
</template>
|
| 95 |
+
<template>
|
| 96 |
+
<email>
|
| 97 |
+
<ebizmarts_autoresponder_newsletter_template translate="label" module="ebizmarts_autoresponder">
|
| 98 |
+
<label>Newsletter Registration Email</label>
|
| 99 |
+
<file>ebizmarts/autoresponder/newsletter.html</file>
|
| 100 |
+
<type>html</type>
|
| 101 |
+
</ebizmarts_autoresponder_newsletter_template>
|
| 102 |
+
</email>
|
| 103 |
+
</template>
|
| 104 |
+
<template>
|
| 105 |
+
<email>
|
| 106 |
+
<ebizmarts_autoresponder_noactivity_template translate="label" module="ebizmarts_autoresponder">
|
| 107 |
+
<label>No Customer Activity Email</label>
|
| 108 |
+
<file>ebizmarts/autoresponder/noactivity.html</file>
|
| 109 |
+
<type>html</type>
|
| 110 |
+
</ebizmarts_autoresponder_noactivity_template>
|
| 111 |
+
</email>
|
| 112 |
+
</template>
|
| 113 |
+
<template>
|
| 114 |
+
<email>
|
| 115 |
+
<ebizmarts_autoresponder_wishlist_template translate="label" module="ebizmarts_autoresponder">
|
| 116 |
+
<label>Wishlist Email</label>
|
| 117 |
+
<file>ebizmarts/autoresponder/wishlist.html</file>
|
| 118 |
+
<type>html</type>
|
| 119 |
+
</ebizmarts_autoresponder_wishlist_template>
|
| 120 |
+
</email>
|
| 121 |
+
</template>
|
| 122 |
+
</global>
|
| 123 |
+
<adminhtml>
|
| 124 |
+
<events>
|
| 125 |
+
<admin_system_config_changed_section_ebizmarts_autoresponder>
|
| 126 |
+
<observers>
|
| 127 |
+
<ebizmarts_autoresponder_save_config>
|
| 128 |
+
<class>ebizmarts_autoresponder/eventObserver</class>
|
| 129 |
+
<method>saveConfig</method>
|
| 130 |
+
</ebizmarts_autoresponder_save_config>
|
| 131 |
+
</observers>
|
| 132 |
+
</admin_system_config_changed_section_ebizmarts_autoresponder>
|
| 133 |
+
</events>
|
| 134 |
+
</adminhtml>
|
| 135 |
+
<frontend>
|
| 136 |
+
<layout>
|
| 137 |
+
<updates>
|
| 138 |
+
<ebizmarts_autoresponder>
|
| 139 |
+
<file>ebizmarts/autoresponder.xml</file>
|
| 140 |
+
</ebizmarts_autoresponder>
|
| 141 |
+
</updates>
|
| 142 |
+
</layout>
|
| 143 |
+
<routers>
|
| 144 |
+
<ebizmarts_autoresponder>
|
| 145 |
+
<use>standard</use>
|
| 146 |
+
<args>
|
| 147 |
+
<module>Ebizmarts_Autoresponder</module>
|
| 148 |
+
<frontName>ebizautoresponder</frontName>
|
| 149 |
+
</args>
|
| 150 |
+
</ebizmarts_autoresponder>
|
| 151 |
+
</routers>
|
| 152 |
+
</frontend>
|
| 153 |
+
|
| 154 |
+
<crontab>
|
| 155 |
+
<jobs>
|
| 156 |
+
<ebizmarts_autoresponder>
|
| 157 |
+
<schedule>
|
| 158 |
+
<cron_expr>0 1 * * *</cron_expr>
|
| 159 |
+
</schedule>
|
| 160 |
+
<run>
|
| 161 |
+
<model>ebizmarts_autoresponder/cron::process</model>
|
| 162 |
+
</run>
|
| 163 |
+
</ebizmarts_autoresponder>
|
| 164 |
+
</jobs>
|
| 165 |
+
</crontab>
|
| 166 |
+
<default>
|
| 167 |
+
<ebizmarts_autoresponder>
|
| 168 |
+
<neworder>
|
| 169 |
+
<mandrill-tag>Autoresponder_NewOrder</mandrill-tag>
|
| 170 |
+
<subject>Thanks for your order</subject>
|
| 171 |
+
<listname>New Order List</listname>
|
| 172 |
+
</neworder>
|
| 173 |
+
<related>
|
| 174 |
+
<mandrill-tag>Autoresponder_RelatedProducts</mandrill-tag>
|
| 175 |
+
<max-related>5</max-related>
|
| 176 |
+
<subject>Products of your interest</subject>
|
| 177 |
+
<listname>Related Product List</listname>
|
| 178 |
+
</related>
|
| 179 |
+
<review>
|
| 180 |
+
<mandrill-tag>Autoresponder_Review</mandrill-tag>
|
| 181 |
+
<subject>Please review your purchased products</subject>
|
| 182 |
+
<listname>Review Product List</listname>
|
| 183 |
+
</review>
|
| 184 |
+
<birthday>
|
| 185 |
+
<mandrill-tag>Autoresponder_Birthday</mandrill-tag>
|
| 186 |
+
<subject>Happy birthday</subject>
|
| 187 |
+
<listname>Happy Birthday List</listname>
|
| 188 |
+
</birthday>
|
| 189 |
+
<noactivity>
|
| 190 |
+
<mandrill-tag>Autoresponder_NoCustomerActivity</mandrill-tag>
|
| 191 |
+
<subject>You don't have any activity</subject>
|
| 192 |
+
<listname>No Activity List</listname>
|
| 193 |
+
</noactivity>
|
| 194 |
+
<wishlist>
|
| 195 |
+
<mandrill-tag>Autoresponder_WishlistAdd</mandrill-tag>
|
| 196 |
+
<subject>Wishlist Subject</subject>
|
| 197 |
+
<listname>Wishlist List</listname>
|
| 198 |
+
</wishlist>
|
| 199 |
+
</ebizmarts_autoresponder>
|
| 200 |
+
</default>
|
| 201 |
+
</config>
|
|
@@ -0,0 +1,710 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<!--
|
| 3 |
+
Configuration file for Ebizmarts_Autoresponder module, touch at you entire responsibility
|
| 4 |
+
|
| 5 |
+
Author : Ebizmarts <info@ebizmarts.com>
|
| 6 |
+
Date : 4/28/13
|
| 7 |
+
Time : 11:20 AM
|
| 8 |
+
File : system.xml
|
| 9 |
+
Module : Ebizmarts_Magemonkey
|
| 10 |
+
-->
|
| 11 |
+
<config>
|
| 12 |
+
<sections>
|
| 13 |
+
<ebizmarts_autoresponder translate="label" module="ebizmarts_autoresponder">
|
| 14 |
+
<label><![CDATA[Autoresponder Emails]]></label>
|
| 15 |
+
<tab>monkey</tab>
|
| 16 |
+
<sort_order>400</sort_order>
|
| 17 |
+
<show_in_default>1</show_in_default>
|
| 18 |
+
<show_in_website>1</show_in_website>
|
| 19 |
+
<show_in_store>1</show_in_store>
|
| 20 |
+
<groups>
|
| 21 |
+
<hint>
|
| 22 |
+
<frontend_model>ebizmarts_autoresponder/adminhtml_system_config_fieldset_hint</frontend_model>
|
| 23 |
+
<sort_order>0</sort_order>
|
| 24 |
+
<show_in_default>1</show_in_default>
|
| 25 |
+
<show_in_website>1</show_in_website>
|
| 26 |
+
<show_in_store>1</show_in_store>
|
| 27 |
+
</hint>
|
| 28 |
+
<general translate="label comment">
|
| 29 |
+
<label>General</label>
|
| 30 |
+
<sort_order>1</sort_order>
|
| 31 |
+
<frontend_type>text</frontend_type>
|
| 32 |
+
<show_in_default>1</show_in_default>
|
| 33 |
+
<show_in_website>1</show_in_website>
|
| 34 |
+
<show_in_store>1</show_in_store>
|
| 35 |
+
<fields>
|
| 36 |
+
<active translate="label">
|
| 37 |
+
<label>Enabled</label>
|
| 38 |
+
<frontend_type>select</frontend_type>
|
| 39 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 40 |
+
<sort_order>10</sort_order>
|
| 41 |
+
<show_in_default>1</show_in_default>
|
| 42 |
+
<show_in_website>1</show_in_website>
|
| 43 |
+
<show_in_store>1</show_in_store>
|
| 44 |
+
</active>
|
| 45 |
+
<identity translate="label">
|
| 46 |
+
<label>Sender</label>
|
| 47 |
+
<frontend_type>select</frontend_type>
|
| 48 |
+
<source_model>adminhtml/system_config_source_email_identity</source_model>
|
| 49 |
+
<sort_order>20</sort_order>
|
| 50 |
+
<show_in_default>1</show_in_default>
|
| 51 |
+
<show_in_website>1</show_in_website>
|
| 52 |
+
<show_in_store>1</show_in_store>
|
| 53 |
+
<depends>
|
| 54 |
+
<active>1</active>
|
| 55 |
+
</depends>
|
| 56 |
+
</identity>
|
| 57 |
+
</fields>
|
| 58 |
+
</general>
|
| 59 |
+
<neworder translate="label comment">
|
| 60 |
+
<label>After New Order</label>
|
| 61 |
+
<sort_order>2</sort_order>
|
| 62 |
+
<frontend_type>text</frontend_type>
|
| 63 |
+
<show_in_default>1</show_in_default>
|
| 64 |
+
<show_in_website>1</show_in_website>
|
| 65 |
+
<show_in_store>1</show_in_store>
|
| 66 |
+
<fields>
|
| 67 |
+
<active translate="label">
|
| 68 |
+
<label>Enabled</label>
|
| 69 |
+
<frontend_type>select</frontend_type>
|
| 70 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 71 |
+
<sort_order>10</sort_order>
|
| 72 |
+
<show_in_default>1</show_in_default>
|
| 73 |
+
<show_in_website>1</show_in_website>
|
| 74 |
+
<show_in_store>1</show_in_store>
|
| 75 |
+
</active>
|
| 76 |
+
<days translate="label">
|
| 77 |
+
<label>Days after order</label>
|
| 78 |
+
<frontend_type>text</frontend_type>
|
| 79 |
+
<sort_order>20</sort_order>
|
| 80 |
+
<show_in_default>1</show_in_default>
|
| 81 |
+
<show_in_website>1</show_in_website>
|
| 82 |
+
<show_in_store>1</show_in_store>
|
| 83 |
+
<depends>
|
| 84 |
+
<active>1</active>
|
| 85 |
+
</depends>
|
| 86 |
+
</days>
|
| 87 |
+
<subject translate="label">
|
| 88 |
+
<label>Mail Subject</label>
|
| 89 |
+
<frontend_type>text</frontend_type>
|
| 90 |
+
<sort_order>25</sort_order>
|
| 91 |
+
<show_in_default>1</show_in_default>
|
| 92 |
+
<show_in_website>1</show_in_website>
|
| 93 |
+
<show_in_store>1</show_in_store>
|
| 94 |
+
<depends>
|
| 95 |
+
<active>1</active>
|
| 96 |
+
</depends>
|
| 97 |
+
</subject>
|
| 98 |
+
<template translate="label">
|
| 99 |
+
<label>Email Template</label>
|
| 100 |
+
<frontend_type>select</frontend_type>
|
| 101 |
+
<config_path>ebizmarts_autoresponder/neworder/template</config_path>
|
| 102 |
+
<source_model>adminhtml/system_config_source_email_template</source_model>
|
| 103 |
+
<sort_order>30</sort_order>
|
| 104 |
+
<show_in_default>1</show_in_default>
|
| 105 |
+
<show_in_website>1</show_in_website>
|
| 106 |
+
<show_in_store>1</show_in_store>
|
| 107 |
+
<depends>
|
| 108 |
+
<active>1</active>
|
| 109 |
+
</depends>
|
| 110 |
+
</template>
|
| 111 |
+
<mandrill-tag translate="label">
|
| 112 |
+
<label>Mandrill Tag</label>
|
| 113 |
+
<frontend_type>text</frontend_type>
|
| 114 |
+
<sort_order>40</sort_order>
|
| 115 |
+
<show_in_default>1</show_in_default>
|
| 116 |
+
<show_in_website>1</show_in_website>
|
| 117 |
+
<show_in_store>1</show_in_store>
|
| 118 |
+
<depends>
|
| 119 |
+
<active>1</active>
|
| 120 |
+
</depends>
|
| 121 |
+
</mandrill-tag>
|
| 122 |
+
<customer translate="label comment">
|
| 123 |
+
<label>Customer Groups</label>
|
| 124 |
+
<frontend_type>multiselect</frontend_type>
|
| 125 |
+
<source_model>ebizmarts_autoresponder/system_config_customergroup</source_model>
|
| 126 |
+
<sort_order>50</sort_order>
|
| 127 |
+
<show_in_default>1</show_in_default>
|
| 128 |
+
<show_in_website>1</show_in_website>
|
| 129 |
+
<show_in_store>1</show_in_store>
|
| 130 |
+
<can_be_empty>0</can_be_empty>
|
| 131 |
+
<comment><![CDATA[]]></comment>
|
| 132 |
+
<depends>
|
| 133 |
+
<active>1</active>
|
| 134 |
+
</depends>
|
| 135 |
+
</customer>
|
| 136 |
+
</fields>
|
| 137 |
+
</neworder>
|
| 138 |
+
<related translate="label comment">
|
| 139 |
+
<label>Related Products</label>
|
| 140 |
+
<sort_order>3</sort_order>
|
| 141 |
+
<frontend_type>text</frontend_type>
|
| 142 |
+
<show_in_default>1</show_in_default>
|
| 143 |
+
<show_in_website>1</show_in_website>
|
| 144 |
+
<show_in_store>1</show_in_store>
|
| 145 |
+
<fields>
|
| 146 |
+
<active translate="label">
|
| 147 |
+
<label>Enabled</label>
|
| 148 |
+
<frontend_type>select</frontend_type>
|
| 149 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 150 |
+
<sort_order>10</sort_order>
|
| 151 |
+
<show_in_default>1</show_in_default>
|
| 152 |
+
<show_in_website>1</show_in_website>
|
| 153 |
+
<show_in_store>1</show_in_store>
|
| 154 |
+
</active>
|
| 155 |
+
<days translate="label">
|
| 156 |
+
<label>Days after order</label>
|
| 157 |
+
<frontend_type>text</frontend_type>
|
| 158 |
+
<sort_order>20</sort_order>
|
| 159 |
+
<show_in_default>1</show_in_default>
|
| 160 |
+
<show_in_website>1</show_in_website>
|
| 161 |
+
<show_in_store>1</show_in_store>
|
| 162 |
+
<depends>
|
| 163 |
+
<active>1</active>
|
| 164 |
+
</depends>
|
| 165 |
+
</days>
|
| 166 |
+
<template translate="label">
|
| 167 |
+
<label>Email Template</label>
|
| 168 |
+
<frontend_type>select</frontend_type>
|
| 169 |
+
<config_path>ebizmarts_autoresponder/related/template</config_path>
|
| 170 |
+
<source_model>adminhtml/system_config_source_email_template</source_model>
|
| 171 |
+
<sort_order>30</sort_order>
|
| 172 |
+
<show_in_default>1</show_in_default>
|
| 173 |
+
<show_in_website>1</show_in_website>
|
| 174 |
+
<show_in_store>1</show_in_store>
|
| 175 |
+
<depends>
|
| 176 |
+
<active>1</active>
|
| 177 |
+
</depends>
|
| 178 |
+
</template>
|
| 179 |
+
<subject translate="label comment">
|
| 180 |
+
<label>Email Subject</label>
|
| 181 |
+
<frontend_type>text</frontend_type>
|
| 182 |
+
<sort_order>35</sort_order>
|
| 183 |
+
<show_in_default>1</show_in_default>
|
| 184 |
+
<show_in_website>1</show_in_website>
|
| 185 |
+
<show_in_store>1</show_in_store>
|
| 186 |
+
<can_be_empty>0</can_be_empty>
|
| 187 |
+
<comment><![CDATA[The subject for the related email]]></comment>
|
| 188 |
+
<depends>
|
| 189 |
+
<active>1</active>
|
| 190 |
+
</depends>
|
| 191 |
+
</subject>
|
| 192 |
+
<mandrill-tag translate="label">
|
| 193 |
+
<label>Mandrill Tag</label>
|
| 194 |
+
<frontend_type>text</frontend_type>
|
| 195 |
+
<sort_order>40</sort_order>
|
| 196 |
+
<show_in_default>1</show_in_default>
|
| 197 |
+
<show_in_website>1</show_in_website>
|
| 198 |
+
<show_in_store>1</show_in_store>
|
| 199 |
+
<depends>
|
| 200 |
+
<active>1</active>
|
| 201 |
+
</depends>
|
| 202 |
+
</mandrill-tag>
|
| 203 |
+
<customer translate="label comment">
|
| 204 |
+
<label>Customer Groups</label>
|
| 205 |
+
<frontend_type>multiselect</frontend_type>
|
| 206 |
+
<source_model>ebizmarts_autoresponder/system_config_customergroup</source_model>
|
| 207 |
+
<sort_order>50</sort_order>
|
| 208 |
+
<show_in_default>1</show_in_default>
|
| 209 |
+
<show_in_website>1</show_in_website>
|
| 210 |
+
<show_in_store>1</show_in_store>
|
| 211 |
+
<can_be_empty>0</can_be_empty>
|
| 212 |
+
<comment><![CDATA[]]></comment>
|
| 213 |
+
<depends>
|
| 214 |
+
<active>1</active>
|
| 215 |
+
</depends>
|
| 216 |
+
</customer>
|
| 217 |
+
<max-related translate="label">
|
| 218 |
+
<label>Max related products</label>
|
| 219 |
+
<frontend_type>text</frontend_type>
|
| 220 |
+
<sort_order>60</sort_order>
|
| 221 |
+
<show_in_default>1</show_in_default>
|
| 222 |
+
<show_in_website>1</show_in_website>
|
| 223 |
+
<show_in_store>1</show_in_store>
|
| 224 |
+
<comment>Max related product, 0 means no max</comment>
|
| 225 |
+
<depends>
|
| 226 |
+
<active>1</active>
|
| 227 |
+
</depends>
|
| 228 |
+
</max-related>
|
| 229 |
+
</fields>
|
| 230 |
+
</related>
|
| 231 |
+
<review translate="label comment">
|
| 232 |
+
<label>Product Review</label>
|
| 233 |
+
<sort_order>4</sort_order>
|
| 234 |
+
<frontend_type>text</frontend_type>
|
| 235 |
+
<show_in_default>1</show_in_default>
|
| 236 |
+
<show_in_website>1</show_in_website>
|
| 237 |
+
<show_in_store>1</show_in_store>
|
| 238 |
+
<fields>
|
| 239 |
+
<hint>
|
| 240 |
+
<frontend_model>ebizmarts_autoresponder/adminhtml_system_config_review_fieldset_hint</frontend_model>
|
| 241 |
+
<sort_order>0</sort_order>
|
| 242 |
+
<show_in_default>1</show_in_default>
|
| 243 |
+
<show_in_website>1</show_in_website>
|
| 244 |
+
<show_in_store>1</show_in_store>
|
| 245 |
+
</hint>
|
| 246 |
+
<active translate="label">
|
| 247 |
+
<label>Enabled</label>
|
| 248 |
+
<frontend_type>select</frontend_type>
|
| 249 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 250 |
+
<sort_order>10</sort_order>
|
| 251 |
+
<show_in_default>1</show_in_default>
|
| 252 |
+
<show_in_website>1</show_in_website>
|
| 253 |
+
<show_in_store>1</show_in_store>
|
| 254 |
+
</active>
|
| 255 |
+
<days translate="label">
|
| 256 |
+
<label>Days after a order</label>
|
| 257 |
+
<frontend_type>text</frontend_type>
|
| 258 |
+
<sort_order>20</sort_order>
|
| 259 |
+
<show_in_default>1</show_in_default>
|
| 260 |
+
<show_in_website>1</show_in_website>
|
| 261 |
+
<show_in_store>1</show_in_store>
|
| 262 |
+
<depends>
|
| 263 |
+
<active>1</active>
|
| 264 |
+
</depends>
|
| 265 |
+
</days>
|
| 266 |
+
<template translate="label">
|
| 267 |
+
<label>Email Template</label>
|
| 268 |
+
<frontend_type>select</frontend_type>
|
| 269 |
+
<config_path>ebizmarts_autoresponder/review/template</config_path>
|
| 270 |
+
<source_model>adminhtml/system_config_source_email_template</source_model>
|
| 271 |
+
<sort_order>30</sort_order>
|
| 272 |
+
<show_in_default>1</show_in_default>
|
| 273 |
+
<show_in_website>1</show_in_website>
|
| 274 |
+
<show_in_store>1</show_in_store>
|
| 275 |
+
<depends>
|
| 276 |
+
<active>1</active>
|
| 277 |
+
</depends>
|
| 278 |
+
</template>
|
| 279 |
+
<subject translate="label comment">
|
| 280 |
+
<label>Email Subject</label>
|
| 281 |
+
<frontend_type>text</frontend_type>
|
| 282 |
+
<sort_order>35</sort_order>
|
| 283 |
+
<show_in_default>1</show_in_default>
|
| 284 |
+
<show_in_website>1</show_in_website>
|
| 285 |
+
<show_in_store>1</show_in_store>
|
| 286 |
+
<can_be_empty>0</can_be_empty>
|
| 287 |
+
<comment><![CDATA[The subject for the review email]]></comment>
|
| 288 |
+
<depends>
|
| 289 |
+
<active>1</active>
|
| 290 |
+
</depends>
|
| 291 |
+
</subject>
|
| 292 |
+
<mandrill-tag translate="label">
|
| 293 |
+
<label>Mandrill Tag</label>
|
| 294 |
+
<frontend_type>text</frontend_type>
|
| 295 |
+
<sort_order>40</sort_order>
|
| 296 |
+
<show_in_default>1</show_in_default>
|
| 297 |
+
<show_in_website>1</show_in_website>
|
| 298 |
+
<show_in_store>1</show_in_store>
|
| 299 |
+
<depends>
|
| 300 |
+
<active>1</active>
|
| 301 |
+
</depends>
|
| 302 |
+
</mandrill-tag>
|
| 303 |
+
<customer translate="label comment">
|
| 304 |
+
<label>Customer Groups</label>
|
| 305 |
+
<frontend_type>multiselect</frontend_type>
|
| 306 |
+
<source_model>ebizmarts_autoresponder/system_config_customergroup</source_model>
|
| 307 |
+
<sort_order>50</sort_order>
|
| 308 |
+
<show_in_default>1</show_in_default>
|
| 309 |
+
<show_in_website>1</show_in_website>
|
| 310 |
+
<show_in_store>1</show_in_store>
|
| 311 |
+
<can_be_empty>0</can_be_empty>
|
| 312 |
+
<comment><![CDATA[]]></comment>
|
| 313 |
+
<depends>
|
| 314 |
+
<active>1</active>
|
| 315 |
+
</depends>
|
| 316 |
+
</customer>
|
| 317 |
+
</fields>
|
| 318 |
+
</review>
|
| 319 |
+
<birthday translate="label comment">
|
| 320 |
+
<label>Before Customer Birthday</label>
|
| 321 |
+
<sort_order>12</sort_order>
|
| 322 |
+
<frontend_type>text</frontend_type>
|
| 323 |
+
<show_in_default>1</show_in_default>
|
| 324 |
+
<show_in_website>1</show_in_website>
|
| 325 |
+
<show_in_store>1</show_in_store>
|
| 326 |
+
<fields>
|
| 327 |
+
<hint>
|
| 328 |
+
<frontend_model>ebizmarts_autoresponder/adminhtml_system_config_birthday_fieldset_hint</frontend_model>
|
| 329 |
+
<sort_order>0</sort_order>
|
| 330 |
+
<show_in_default>1</show_in_default>
|
| 331 |
+
<show_in_website>1</show_in_website>
|
| 332 |
+
<show_in_store>1</show_in_store>
|
| 333 |
+
</hint>
|
| 334 |
+
<active translate="label">
|
| 335 |
+
<label>Enabled</label>
|
| 336 |
+
<frontend_type>select</frontend_type>
|
| 337 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 338 |
+
<sort_order>10</sort_order>
|
| 339 |
+
<show_in_default>1</show_in_default>
|
| 340 |
+
<show_in_website>1</show_in_website>
|
| 341 |
+
<show_in_store>1</show_in_store>
|
| 342 |
+
</active>
|
| 343 |
+
<days translate="label">
|
| 344 |
+
<label>Days before birthday</label>
|
| 345 |
+
<frontend_type>text</frontend_type>
|
| 346 |
+
<sort_order>20</sort_order>
|
| 347 |
+
<show_in_default>1</show_in_default>
|
| 348 |
+
<show_in_website>1</show_in_website>
|
| 349 |
+
<show_in_store>1</show_in_store>
|
| 350 |
+
<depends>
|
| 351 |
+
<active>1</active>
|
| 352 |
+
</depends>
|
| 353 |
+
</days>
|
| 354 |
+
<template translate="label">
|
| 355 |
+
<label>Email Template</label>
|
| 356 |
+
<frontend_type>select</frontend_type>
|
| 357 |
+
<config_path>ebizmarts_autoresponder/birthday/template</config_path>
|
| 358 |
+
<source_model>adminhtml/system_config_source_email_template</source_model>
|
| 359 |
+
<sort_order>30</sort_order>
|
| 360 |
+
<show_in_default>1</show_in_default>
|
| 361 |
+
<show_in_website>1</show_in_website>
|
| 362 |
+
<show_in_store>1</show_in_store>
|
| 363 |
+
<depends>
|
| 364 |
+
<active>1</active>
|
| 365 |
+
</depends>
|
| 366 |
+
</template>
|
| 367 |
+
<subject translate="label comment">
|
| 368 |
+
<label>Email Subject</label>
|
| 369 |
+
<frontend_type>text</frontend_type>
|
| 370 |
+
<sort_order>35</sort_order>
|
| 371 |
+
<show_in_default>1</show_in_default>
|
| 372 |
+
<show_in_website>1</show_in_website>
|
| 373 |
+
<show_in_store>1</show_in_store>
|
| 374 |
+
<can_be_empty>0</can_be_empty>
|
| 375 |
+
<comment><![CDATA[The subject for the bithday's email]]></comment>
|
| 376 |
+
<depends>
|
| 377 |
+
<active>1</active>
|
| 378 |
+
</depends>
|
| 379 |
+
</subject>
|
| 380 |
+
<mandrill-tag translate="label">
|
| 381 |
+
<label>Mandrill Tag</label>
|
| 382 |
+
<frontend_type>text</frontend_type>
|
| 383 |
+
<sort_order>40</sort_order>
|
| 384 |
+
<show_in_default>1</show_in_default>
|
| 385 |
+
<show_in_website>1</show_in_website>
|
| 386 |
+
<show_in_store>1</show_in_store>
|
| 387 |
+
<depends>
|
| 388 |
+
<active>1</active>
|
| 389 |
+
</depends>
|
| 390 |
+
</mandrill-tag>
|
| 391 |
+
<customer translate="label comment">
|
| 392 |
+
<label>Customer Groups</label>
|
| 393 |
+
<frontend_type>multiselect</frontend_type>
|
| 394 |
+
<source_model>ebizmarts_autoresponder/system_config_customergroup</source_model>
|
| 395 |
+
<sort_order>50</sort_order>
|
| 396 |
+
<show_in_default>1</show_in_default>
|
| 397 |
+
<show_in_website>1</show_in_website>
|
| 398 |
+
<show_in_store>1</show_in_store>
|
| 399 |
+
<can_be_empty>0</can_be_empty>
|
| 400 |
+
<comment><![CDATA[]]></comment>
|
| 401 |
+
<depends>
|
| 402 |
+
<active>1</active>
|
| 403 |
+
</depends>
|
| 404 |
+
</customer>
|
| 405 |
+
<coupon translate="label">
|
| 406 |
+
<label>Create Coupon?</label>
|
| 407 |
+
<frontend_type>select</frontend_type>
|
| 408 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 409 |
+
<sort_order>100</sort_order>
|
| 410 |
+
<show_in_default>1</show_in_default>
|
| 411 |
+
<show_in_website>1</show_in_website>
|
| 412 |
+
<show_in_store>1</show_in_store>
|
| 413 |
+
<depends>
|
| 414 |
+
<active>1</active>
|
| 415 |
+
</depends>
|
| 416 |
+
</coupon>
|
| 417 |
+
<customer_coupon translate="label comment">
|
| 418 |
+
<label>Customer Groups for coupon</label>
|
| 419 |
+
<frontend_type>multiselect</frontend_type>
|
| 420 |
+
<source_model>ebizmarts_autoresponder/system_config_customergroup</source_model>
|
| 421 |
+
<sort_order>110</sort_order>
|
| 422 |
+
<show_in_default>1</show_in_default>
|
| 423 |
+
<show_in_website>1</show_in_website>
|
| 424 |
+
<show_in_store>1</show_in_store>
|
| 425 |
+
<can_be_empty>0</can_be_empty>
|
| 426 |
+
<comment><![CDATA[]]></comment>
|
| 427 |
+
<depends>
|
| 428 |
+
<active>1</active>
|
| 429 |
+
<coupon>1</coupon>
|
| 430 |
+
</depends>
|
| 431 |
+
</customer_coupon>
|
| 432 |
+
<automatic translate="label">
|
| 433 |
+
<label>Option</label>
|
| 434 |
+
<frontend_type>select</frontend_type>
|
| 435 |
+
<source_model>ebizmarts_autoresponder/system_config_automatic</source_model>
|
| 436 |
+
<sort_order>115</sort_order>
|
| 437 |
+
<show_in_default>1</show_in_default>
|
| 438 |
+
<show_in_website>1</show_in_website>
|
| 439 |
+
<show_in_store>1</show_in_store>
|
| 440 |
+
<depends>
|
| 441 |
+
<active>1</active>
|
| 442 |
+
<coupon>1</coupon>
|
| 443 |
+
</depends>
|
| 444 |
+
</automatic>
|
| 445 |
+
<coupon_code>
|
| 446 |
+
<label>Coupon Code</label>
|
| 447 |
+
<frontend_type>text</frontend_type>
|
| 448 |
+
<sort_order>120</sort_order>
|
| 449 |
+
<show_in_default>1</show_in_default>
|
| 450 |
+
<show_in_website>1</show_in_website>
|
| 451 |
+
<show_in_store>1</show_in_store>
|
| 452 |
+
<can_be_empty>0</can_be_empty>
|
| 453 |
+
<comment><![CDATA[The code of an existing coupon]]></comment>
|
| 454 |
+
<depends>
|
| 455 |
+
<active>1</active>
|
| 456 |
+
<coupon>1</coupon>
|
| 457 |
+
<automatic>1</automatic>
|
| 458 |
+
</depends>
|
| 459 |
+
</coupon_code>
|
| 460 |
+
<expire>
|
| 461 |
+
<label>Expire on</label>
|
| 462 |
+
<frontend_type>text</frontend_type>
|
| 463 |
+
<sort_order>120</sort_order>
|
| 464 |
+
<show_in_default>1</show_in_default>
|
| 465 |
+
<show_in_website>1</show_in_website>
|
| 466 |
+
<show_in_store>1</show_in_store>
|
| 467 |
+
<can_be_empty>0</can_be_empty>
|
| 468 |
+
<comment><![CDATA[The coupon expiration in days]]></comment>
|
| 469 |
+
<depends>
|
| 470 |
+
<active>1</active>
|
| 471 |
+
<coupon>1</coupon>
|
| 472 |
+
<automatic>2</automatic>
|
| 473 |
+
</depends>
|
| 474 |
+
</expire>
|
| 475 |
+
<length>
|
| 476 |
+
<label>Coupon length</label>
|
| 477 |
+
<frontend_type>text</frontend_type>
|
| 478 |
+
<sort_order>130</sort_order>
|
| 479 |
+
<show_in_default>1</show_in_default>
|
| 480 |
+
<show_in_website>1</show_in_website>
|
| 481 |
+
<show_in_store>1</show_in_store>
|
| 482 |
+
<can_be_empty>0</can_be_empty>
|
| 483 |
+
<depends>
|
| 484 |
+
<active>1</active>
|
| 485 |
+
<coupon>1</coupon>
|
| 486 |
+
<automatic>2</automatic>
|
| 487 |
+
</depends>
|
| 488 |
+
</length>
|
| 489 |
+
<discounttype>
|
| 490 |
+
<label>Discount type</label>
|
| 491 |
+
<frontend_type>select</frontend_type>
|
| 492 |
+
<source_model>ebizmarts_autoresponder/system_config_discounttype</source_model>
|
| 493 |
+
<sort_order>140</sort_order>
|
| 494 |
+
<show_in_default>1</show_in_default>
|
| 495 |
+
<show_in_website>1</show_in_website>
|
| 496 |
+
<show_in_store>1</show_in_store>
|
| 497 |
+
<can_be_empty>0</can_be_empty>
|
| 498 |
+
<comment><![CDATA[Select percentage or fixed discount]]></comment>
|
| 499 |
+
<depends>
|
| 500 |
+
<active>1</active>
|
| 501 |
+
<coupon>1</coupon>
|
| 502 |
+
<automatic>2</automatic>
|
| 503 |
+
</depends>
|
| 504 |
+
</discounttype>
|
| 505 |
+
<discount>
|
| 506 |
+
<label>Discount amount</label>
|
| 507 |
+
<frontend_type>text</frontend_type>
|
| 508 |
+
<sort_order>150</sort_order>
|
| 509 |
+
<show_in_default>1</show_in_default>
|
| 510 |
+
<show_in_website>1</show_in_website>
|
| 511 |
+
<show_in_store>1</show_in_store>
|
| 512 |
+
<can_be_empty>0</can_be_empty>
|
| 513 |
+
<comment><![CDATA[Amount]]></comment>
|
| 514 |
+
<depends>
|
| 515 |
+
<active>1</active>
|
| 516 |
+
<coupon>1</coupon>
|
| 517 |
+
<automatic>2</automatic>
|
| 518 |
+
</depends>
|
| 519 |
+
</discount>
|
| 520 |
+
<couponlabel>
|
| 521 |
+
<label>Label for coupon</label>
|
| 522 |
+
<frontend_type>text</frontend_type>
|
| 523 |
+
<sort_order>160</sort_order>
|
| 524 |
+
<show_in_default>1</show_in_default>
|
| 525 |
+
<show_in_website>1</show_in_website>
|
| 526 |
+
<show_in_store>1</show_in_store>
|
| 527 |
+
<can_be_empty>0</can_be_empty>
|
| 528 |
+
<comment><![CDATA[]]></comment>
|
| 529 |
+
<depends>
|
| 530 |
+
<active>1</active>
|
| 531 |
+
<coupon>1</coupon>
|
| 532 |
+
<automatic>2</automatic>
|
| 533 |
+
</depends>
|
| 534 |
+
</couponlabel>
|
| 535 |
+
</fields>
|
| 536 |
+
</birthday>
|
| 537 |
+
<noactivity translate="label comment">
|
| 538 |
+
<label>No Customer Activity</label>
|
| 539 |
+
<sort_order>15</sort_order>
|
| 540 |
+
<frontend_type>text</frontend_type>
|
| 541 |
+
<show_in_default>1</show_in_default>
|
| 542 |
+
<show_in_website>1</show_in_website>
|
| 543 |
+
<show_in_store>1</show_in_store>
|
| 544 |
+
<fields>
|
| 545 |
+
<active translate="label">
|
| 546 |
+
<label>Enabled</label>
|
| 547 |
+
<frontend_type>select</frontend_type>
|
| 548 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 549 |
+
<sort_order>10</sort_order>
|
| 550 |
+
<show_in_default>1</show_in_default>
|
| 551 |
+
<show_in_website>1</show_in_website>
|
| 552 |
+
<show_in_store>1</show_in_store>
|
| 553 |
+
</active>
|
| 554 |
+
<days translate="label">
|
| 555 |
+
<label>Days with no activity</label>
|
| 556 |
+
<frontend_type>text</frontend_type>
|
| 557 |
+
<sort_order>20</sort_order>
|
| 558 |
+
<show_in_default>1</show_in_default>
|
| 559 |
+
<show_in_website>1</show_in_website>
|
| 560 |
+
<show_in_store>1</show_in_store>
|
| 561 |
+
<depends>
|
| 562 |
+
<active>1</active>
|
| 563 |
+
</depends>
|
| 564 |
+
</days>
|
| 565 |
+
<template translate="label">
|
| 566 |
+
<label>Email Template</label>
|
| 567 |
+
<frontend_type>select</frontend_type>
|
| 568 |
+
<config_path>ebizmarts_autoresponder/noactivity/template</config_path>
|
| 569 |
+
<source_model>adminhtml/system_config_source_email_template</source_model>
|
| 570 |
+
<sort_order>30</sort_order>
|
| 571 |
+
<show_in_default>1</show_in_default>
|
| 572 |
+
<show_in_website>1</show_in_website>
|
| 573 |
+
<show_in_store>1</show_in_store>
|
| 574 |
+
<depends>
|
| 575 |
+
<active>1</active>
|
| 576 |
+
</depends>
|
| 577 |
+
</template>
|
| 578 |
+
<subject translate="label comment">
|
| 579 |
+
<label>Email Subject</label>
|
| 580 |
+
<frontend_type>text</frontend_type>
|
| 581 |
+
<sort_order>35</sort_order>
|
| 582 |
+
<show_in_default>1</show_in_default>
|
| 583 |
+
<show_in_website>1</show_in_website>
|
| 584 |
+
<show_in_store>1</show_in_store>
|
| 585 |
+
<can_be_empty>0</can_be_empty>
|
| 586 |
+
<comment><![CDATA[The subject for the No Activity email]]></comment>
|
| 587 |
+
<depends>
|
| 588 |
+
<active>1</active>
|
| 589 |
+
</depends>
|
| 590 |
+
</subject>
|
| 591 |
+
<mandrill-tag translate="label">
|
| 592 |
+
<label>Mandrill Tag</label>
|
| 593 |
+
<frontend_type>text</frontend_type>
|
| 594 |
+
<sort_order>40</sort_order>
|
| 595 |
+
<show_in_default>1</show_in_default>
|
| 596 |
+
<show_in_website>1</show_in_website>
|
| 597 |
+
<show_in_store>1</show_in_store>
|
| 598 |
+
<depends>
|
| 599 |
+
<active>1</active>
|
| 600 |
+
</depends>
|
| 601 |
+
</mandrill-tag>
|
| 602 |
+
<customer translate="label comment">
|
| 603 |
+
<label>Customer Groups</label>
|
| 604 |
+
<frontend_type>multiselect</frontend_type>
|
| 605 |
+
<source_model>ebizmarts_autoresponder/system_config_customergroup</source_model>
|
| 606 |
+
<sort_order>50</sort_order>
|
| 607 |
+
<show_in_default>1</show_in_default>
|
| 608 |
+
<show_in_website>1</show_in_website>
|
| 609 |
+
<show_in_store>1</show_in_store>
|
| 610 |
+
<can_be_empty>0</can_be_empty>
|
| 611 |
+
<comment><![CDATA[]]></comment>
|
| 612 |
+
<depends>
|
| 613 |
+
<active>1</active>
|
| 614 |
+
</depends>
|
| 615 |
+
</customer>
|
| 616 |
+
</fields>
|
| 617 |
+
</noactivity>
|
| 618 |
+
<wishlist translate="label comment">
|
| 619 |
+
<label>After Wishlist Add</label>
|
| 620 |
+
<sort_order>16</sort_order>
|
| 621 |
+
<frontend_type>text</frontend_type>
|
| 622 |
+
<show_in_default>1</show_in_default>
|
| 623 |
+
<show_in_website>1</show_in_website>
|
| 624 |
+
<show_in_store>1</show_in_store>
|
| 625 |
+
<fields>
|
| 626 |
+
<hint>
|
| 627 |
+
<frontend_model>ebizmarts_autoresponder/adminhtml_system_config_wishlist_fieldset_hint
|
| 628 |
+
</frontend_model>
|
| 629 |
+
<sort_order>0</sort_order>
|
| 630 |
+
<show_in_default>1</show_in_default>
|
| 631 |
+
<show_in_website>1</show_in_website>
|
| 632 |
+
<show_in_store>1</show_in_store>
|
| 633 |
+
</hint>
|
| 634 |
+
<active translate="label">
|
| 635 |
+
<label>Enabled</label>
|
| 636 |
+
<frontend_type>select</frontend_type>
|
| 637 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 638 |
+
<sort_order>10</sort_order>
|
| 639 |
+
<show_in_default>1</show_in_default>
|
| 640 |
+
<show_in_website>1</show_in_website>
|
| 641 |
+
<show_in_store>1</show_in_store>
|
| 642 |
+
</active>
|
| 643 |
+
<days translate="label">
|
| 644 |
+
<label>Days after wishlist add</label>
|
| 645 |
+
<frontend_type>text</frontend_type>
|
| 646 |
+
<sort_order>20</sort_order>
|
| 647 |
+
<show_in_default>1</show_in_default>
|
| 648 |
+
<show_in_website>1</show_in_website>
|
| 649 |
+
<show_in_store>1</show_in_store>
|
| 650 |
+
<depends>
|
| 651 |
+
<active>1</active>
|
| 652 |
+
</depends>
|
| 653 |
+
</days>
|
| 654 |
+
<template translate="label">
|
| 655 |
+
<label>Email Template</label>
|
| 656 |
+
<frontend_type>select</frontend_type>
|
| 657 |
+
<config_path>ebizmarts_autoresponder/wishlist/template</config_path>
|
| 658 |
+
<source_model>adminhtml/system_config_source_email_template</source_model>
|
| 659 |
+
<sort_order>30</sort_order>
|
| 660 |
+
<show_in_default>1</show_in_default>
|
| 661 |
+
<show_in_website>1</show_in_website>
|
| 662 |
+
<show_in_store>1</show_in_store>
|
| 663 |
+
<depends>
|
| 664 |
+
<active>1</active>
|
| 665 |
+
</depends>
|
| 666 |
+
</template>
|
| 667 |
+
<subject translate="label comment">
|
| 668 |
+
<label>Email Subject</label>
|
| 669 |
+
<frontend_type>text</frontend_type>
|
| 670 |
+
<sort_order>35</sort_order>
|
| 671 |
+
<show_in_default>1</show_in_default>
|
| 672 |
+
<show_in_website>1</show_in_website>
|
| 673 |
+
<show_in_store>1</show_in_store>
|
| 674 |
+
<can_be_empty>0</can_be_empty>
|
| 675 |
+
<comment><![CDATA[The subject for the wishlist email]]></comment>
|
| 676 |
+
<depends>
|
| 677 |
+
<active>1</active>
|
| 678 |
+
</depends>
|
| 679 |
+
</subject>
|
| 680 |
+
<mandrill-tag translate="label">
|
| 681 |
+
<label>Mandrill Tag</label>
|
| 682 |
+
<frontend_type>text</frontend_type>
|
| 683 |
+
<sort_order>40</sort_order>
|
| 684 |
+
<show_in_default>1</show_in_default>
|
| 685 |
+
<show_in_website>1</show_in_website>
|
| 686 |
+
<show_in_store>1</show_in_store>
|
| 687 |
+
<depends>
|
| 688 |
+
<active>1</active>
|
| 689 |
+
</depends>
|
| 690 |
+
</mandrill-tag>
|
| 691 |
+
<customer translate="label comment">
|
| 692 |
+
<label>Customer Groups</label>
|
| 693 |
+
<frontend_type>multiselect</frontend_type>
|
| 694 |
+
<source_model>ebizmarts_autoresponder/system_config_customergroup</source_model>
|
| 695 |
+
<sort_order>50</sort_order>
|
| 696 |
+
<show_in_default>1</show_in_default>
|
| 697 |
+
<show_in_website>1</show_in_website>
|
| 698 |
+
<show_in_store>1</show_in_store>
|
| 699 |
+
<can_be_empty>0</can_be_empty>
|
| 700 |
+
<comment><![CDATA[]]></comment>
|
| 701 |
+
<depends>
|
| 702 |
+
<active>1</active>
|
| 703 |
+
</depends>
|
| 704 |
+
</customer>
|
| 705 |
+
</fields>
|
| 706 |
+
</wishlist>
|
| 707 |
+
</groups>
|
| 708 |
+
</ebizmarts_autoresponder>
|
| 709 |
+
</sections>
|
| 710 |
+
</config>
|
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Author : Ebizmarts <info@ebizmarts.com>
|
| 4 |
+
* Date : 4/28/13
|
| 5 |
+
* Time : 11:20 AM
|
| 6 |
+
* File : ${FILE_NAME}
|
| 7 |
+
* Module : ${PROJECT_NAME}
|
| 8 |
+
*/
|
| 9 |
+
/* @var $installer Mage_Core_Model_Resource_Setup */
|
| 10 |
+
$installer = $this;
|
| 11 |
+
|
| 12 |
+
$installer->startSetup();
|
| 13 |
+
|
| 14 |
+
$installer->run("
|
| 15 |
+
|
| 16 |
+
CREATE TABLE IF NOT EXISTS `{$this->getTable('ebizmarts_autoresponder_unsubscribe')}` (
|
| 17 |
+
`id` int(10) unsigned NOT NULL auto_increment,
|
| 18 |
+
`email` varchar(255),
|
| 19 |
+
`list` varchar(255),
|
| 20 |
+
`store_id` smallint(5),
|
| 21 |
+
`unsubscribed_at` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
|
| 22 |
+
PRIMARY KEY (`id`)
|
| 23 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
| 24 |
+
|
| 25 |
+
");
|
| 26 |
+
|
| 27 |
+
$installer->endSetup();
|
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Bulksync export form container
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_MageMonkey
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_MageMonkey_Block_Adminhtml_Bulksync_Export extends Mage_Adminhtml_Block_Widget_Form_Container
|
| 11 |
+
{
|
| 12 |
+
|
| 13 |
+
public function __construct()
|
| 14 |
+
{
|
| 15 |
+
$this->_controller = 'adminhtml_bulksync';
|
| 16 |
+
$this->_blockGroup = 'monkey';
|
| 17 |
+
$this->_mode = 'export';
|
| 18 |
+
|
| 19 |
+
parent::__construct();
|
| 20 |
+
|
| 21 |
+
$this->_updateButton('save', 'label', Mage::helper('monkey')->__('All set!'));
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
public function getHeaderText()
|
| 25 |
+
{
|
| 26 |
+
return Mage::helper('monkey')->__('New Export');
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Bulksync export form, lets you schedule jobs to be processed by Magento's cron
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_MageMonkey
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_MageMonkey_Block_Adminhtml_Bulksync_Export_Form extends Mage_Adminhtml_Block_Widget_Form
|
| 11 |
+
{
|
| 12 |
+
|
| 13 |
+
/**
|
| 14 |
+
* Prepare form before rendering HTML
|
| 15 |
+
*
|
| 16 |
+
* @return Mage_Adminhtml_Block_Widget_Form
|
| 17 |
+
*/
|
| 18 |
+
protected function _prepareForm()
|
| 19 |
+
{
|
| 20 |
+
$form = new Varien_Data_Form(array(
|
| 21 |
+
'id' => 'edit_form',
|
| 22 |
+
'action' => $this->getUrl('*/*/save'),
|
| 23 |
+
'method' => 'post'
|
| 24 |
+
));
|
| 25 |
+
|
| 26 |
+
$fieldset = $form->addFieldset('export_settings', array(
|
| 27 |
+
'legend' => Mage::helper('monkey')->__('Export Configuration')
|
| 28 |
+
));
|
| 29 |
+
|
| 30 |
+
$dataSource = Mage::getSingleton('monkey/system_config_source_bulksyncDatasource')->toOptionArray();
|
| 31 |
+
$fieldset->addField('data_source_entity', 'select', array(
|
| 32 |
+
'label' => Mage::helper('monkey')->__('Data Source'),
|
| 33 |
+
'title' => Mage::helper('monkey')->__('Data Source'),
|
| 34 |
+
'name' => 'data_source_entity',
|
| 35 |
+
'values' => $dataSource,
|
| 36 |
+
'class' => 'required-entry',
|
| 37 |
+
'required' => true,
|
| 38 |
+
));
|
| 39 |
+
|
| 40 |
+
$lists = Mage::getSingleton('monkey/system_config_source_list')->toOptionArray();
|
| 41 |
+
$fieldset->addField('list', 'multiselect', array(
|
| 42 |
+
'label' => Mage::helper('monkey')->__('Choose Lists'),
|
| 43 |
+
'title' => Mage::helper('monkey')->__('Choose Lists'),
|
| 44 |
+
'name' => 'list',
|
| 45 |
+
'values' => $lists,
|
| 46 |
+
'class' => 'required-entry',
|
| 47 |
+
'required' => true,
|
| 48 |
+
));
|
| 49 |
+
|
| 50 |
+
$storeSwitcher = $fieldset->addField('store_id', 'select', array(
|
| 51 |
+
'name' => 'store_id',
|
| 52 |
+
'label' => Mage::helper('monkey')->__('Store'),
|
| 53 |
+
'title' => Mage::helper('monkey')->__('Store'),
|
| 54 |
+
'required' => true,
|
| 55 |
+
'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true),
|
| 56 |
+
));
|
| 57 |
+
|
| 58 |
+
$fieldset->addField('direction', 'hidden', array(
|
| 59 |
+
'name' => 'direction',
|
| 60 |
+
'value' => 'export',
|
| 61 |
+
));
|
| 62 |
+
|
| 63 |
+
$form->setUseContainer(true);
|
| 64 |
+
$this->setForm($form);
|
| 65 |
+
|
| 66 |
+
$this->setChild('form_after', Mage::getModel('core/layout')->createBlock('monkey/adminhtml_bulksync_queueExport', 'exportqueue'));
|
| 67 |
+
|
| 68 |
+
return parent::_prepareForm();
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Bulksync import form container
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_MageMonkey
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_MageMonkey_Block_Adminhtml_Bulksync_Import extends Mage_Adminhtml_Block_Widget_Form_Container
|
| 11 |
+
{
|
| 12 |
+
|
| 13 |
+
public function __construct()
|
| 14 |
+
{
|
| 15 |
+
$this->_controller = 'adminhtml_bulksync';
|
| 16 |
+
$this->_blockGroup = 'monkey';
|
| 17 |
+
$this->_mode = 'import';
|
| 18 |
+
|
| 19 |
+
parent::__construct();
|
| 20 |
+
|
| 21 |
+
$this->_updateButton('save', 'label', Mage::helper('monkey')->__('All set!'));
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
public function getHeaderText()
|
| 25 |
+
{
|
| 26 |
+
return Mage::helper('monkey')->__('New Import');
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Bulksync import form, lets you schedule jobs to be processed by Magento's cron
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_MageMonkey
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_MageMonkey_Block_Adminhtml_Bulksync_Import_Form extends Mage_Adminhtml_Block_Widget_Form
|
| 11 |
+
{
|
| 12 |
+
|
| 13 |
+
/**
|
| 14 |
+
* Prepare form before rendering HTML
|
| 15 |
+
*
|
| 16 |
+
* @return Mage_Adminhtml_Block_Widget_Form
|
| 17 |
+
*/
|
| 18 |
+
protected function _prepareForm()
|
| 19 |
+
{
|
| 20 |
+
$form = new Varien_Data_Form(array(
|
| 21 |
+
'id' => 'edit_form',
|
| 22 |
+
'action' => $this->getUrl('*/*/save'),
|
| 23 |
+
'method' => 'post'
|
| 24 |
+
));
|
| 25 |
+
|
| 26 |
+
$fieldset = $form->addFieldset('import_settings', array(
|
| 27 |
+
'legend' => Mage::helper('monkey')->__('Import Configuration')
|
| 28 |
+
));
|
| 29 |
+
|
| 30 |
+
$lists = Mage::getSingleton('monkey/system_config_source_list')->toOptionArray();
|
| 31 |
+
$fieldset->addField('list', 'multiselect', array(
|
| 32 |
+
'label' => Mage::helper('monkey')->__('Choose Lists'),
|
| 33 |
+
'title' => Mage::helper('monkey')->__('Choose Lists'),
|
| 34 |
+
'name' => 'list',
|
| 35 |
+
'values' => $lists,
|
| 36 |
+
'class' => 'required-entry',
|
| 37 |
+
'required' => true,
|
| 38 |
+
));
|
| 39 |
+
|
| 40 |
+
$statuses = Mage::getSingleton('monkey/system_config_source_status')->toOptionArray();
|
| 41 |
+
$fieldset->addField('import_types', 'multiselect', array(
|
| 42 |
+
'label' => Mage::helper('monkey')->__('Statuses to import'),
|
| 43 |
+
'title' => Mage::helper('monkey')->__('Statuses to import'),
|
| 44 |
+
'name' => 'import_types',
|
| 45 |
+
'values' => $statuses,
|
| 46 |
+
'class' => 'required-entry',
|
| 47 |
+
'required' => true,
|
| 48 |
+
));
|
| 49 |
+
|
| 50 |
+
$fieldset->addField('create_customers', 'checkbox', array(
|
| 51 |
+
'label' => Mage::helper('monkey')->__('Create customer accounts'),
|
| 52 |
+
'title' => Mage::helper('monkey')->__('Create customer accounts'),
|
| 53 |
+
'name' => 'create_customers',
|
| 54 |
+
'value' => '1'
|
| 55 |
+
));
|
| 56 |
+
|
| 57 |
+
$fieldset->addField('since', 'date', array(
|
| 58 |
+
'label' => Mage::helper('monkey')->__('Retrieve data since'),
|
| 59 |
+
'title' => Mage::helper('monkey')->__('Retrieve data since'),
|
| 60 |
+
'name' => 'since',
|
| 61 |
+
'image' => $this->getSkinUrl('images/grid-cal.gif'),
|
| 62 |
+
'format' => Varien_Date::DATE_INTERNAL_FORMAT
|
| 63 |
+
));
|
| 64 |
+
|
| 65 |
+
$fieldset->addField('direction', 'hidden', array(
|
| 66 |
+
'name' => 'direction',
|
| 67 |
+
'value' => 'import',
|
| 68 |
+
));
|
| 69 |
+
|
| 70 |
+
//Set default FORM values
|
| 71 |
+
$formValues = array(
|
| 72 |
+
'import_types' => array('subscribed')
|
| 73 |
+
);
|
| 74 |
+
$form->addValues($formValues);
|
| 75 |
+
|
| 76 |
+
$form->setUseContainer(true);
|
| 77 |
+
$this->setForm($form);
|
| 78 |
+
|
| 79 |
+
$this->setChild('form_after', Mage::getModel('core/layout')->createBlock('monkey/adminhtml_bulksync_queueImport', 'importqueue'));
|
| 80 |
+
|
| 81 |
+
return parent::_prepareForm();
|
| 82 |
+
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class Ebizmarts_MageMonkey_Block_Adminhtml_Bulksync_Queue extends Mage_Adminhtml_Block_Widget_Grid_Container
|
| 4 |
+
{
|
| 5 |
+
|
| 6 |
+
public function __construct()
|
| 7 |
+
{
|
| 8 |
+
$this->_controller = 'adminhtml_bulksync_queue';
|
| 9 |
+
$this->_blockGroup = 'monkey';
|
| 10 |
+
$this->_headerText = Mage::helper('monkey')->__('Jobs Queue');
|
| 11 |
+
|
| 12 |
+
parent::__construct();
|
| 13 |
+
|
| 14 |
+
$this->_removeButton('add');
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
/**
|
| 18 |
+
* Check whether it is single store mode
|
| 19 |
+
*
|
| 20 |
+
* @return bool
|
| 21 |
+
*/
|
| 22 |
+
public function isSingleStoreMode()
|
| 23 |
+
{
|
| 24 |
+
if (!Mage::app()->isSingleStoreMode()) {
|
| 25 |
+
return false;
|
| 26 |
+
}
|
| 27 |
+
return true;
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class Ebizmarts_MageMonkey_Block_Adminhtml_Bulksync_Queue_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
| 4 |
+
{
|
| 5 |
+
|
| 6 |
+
public function __construct()
|
| 7 |
+
{
|
| 8 |
+
parent::__construct();
|
| 9 |
+
$this->setId('bulksync_jobs_queue');
|
| 10 |
+
$this->setUseAjax(true);
|
| 11 |
+
$this->setDefaultSort('id');
|
| 12 |
+
$this->setDefaultDir('DESC');
|
| 13 |
+
$this->setSaveParametersInSession(false);
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
protected function _prepareCollection()
|
| 17 |
+
{
|
| 18 |
+
$collection = Mage::getModel('monkey/bulksyncExport')
|
| 19 |
+
->getCollection();
|
| 20 |
+
|
| 21 |
+
$this->setCollection($collection);
|
| 22 |
+
return parent::_prepareCollection();
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
protected function _prepareColumns()
|
| 26 |
+
{
|
| 27 |
+
|
| 28 |
+
$this->addColumn('id', array(
|
| 29 |
+
'header'=> Mage::helper('monkey')->__('ID'),
|
| 30 |
+
'width' => '80px',
|
| 31 |
+
'index' => 'id',
|
| 32 |
+
'type' => 'number'
|
| 33 |
+
));
|
| 34 |
+
|
| 35 |
+
$this->addColumn('status', array(
|
| 36 |
+
'header'=> Mage::helper('monkey')->__('Status'),
|
| 37 |
+
'width' => '80px',
|
| 38 |
+
'index' => 'status',
|
| 39 |
+
));
|
| 40 |
+
|
| 41 |
+
$this->addColumn('updated_at', array(
|
| 42 |
+
'header'=> Mage::helper('monkey')->__('Date Sent'),
|
| 43 |
+
'width' => '80px',
|
| 44 |
+
'index' => 'updated_at',
|
| 45 |
+
'type' => 'datetime'
|
| 46 |
+
));
|
| 47 |
+
|
| 48 |
+
$this->addColumn('created_at', array(
|
| 49 |
+
'header'=> Mage::helper('monkey')->__('Date Sent'),
|
| 50 |
+
'width' => '80px',
|
| 51 |
+
'index' => 'created_at',
|
| 52 |
+
'type' => 'datetime'
|
| 53 |
+
));
|
| 54 |
+
|
| 55 |
+
return parent::_prepareColumns();
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
public function getRowUrl($row)
|
| 59 |
+
{
|
| 60 |
+
return $this->getUrl('adminhtml/sales_order/view', array('order_id' => $row->getOrderId()));
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
public function getGridUrl()
|
| 64 |
+
{
|
| 65 |
+
return $this->getUrl('*/*/grid', array('_current' => true));
|
| 66 |
+
}
|
| 67 |
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Bulksync export grid container
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_MageMonkey
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_MageMonkey_Block_Adminhtml_Bulksync_QueueExport extends Mage_Adminhtml_Block_Widget_Grid_Container
|
| 11 |
+
{
|
| 12 |
+
|
| 13 |
+
public function __construct()
|
| 14 |
+
{
|
| 15 |
+
$this->_controller = 'adminhtml_bulksync_queue';
|
| 16 |
+
$this->_blockGroup = 'monkey';
|
| 17 |
+
$this->_headerText = Mage::helper('monkey')->__('Export Queue');
|
| 18 |
+
|
| 19 |
+
parent::__construct();
|
| 20 |
+
|
| 21 |
+
$this->_removeButton('add');
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
protected function _prepareLayout()
|
| 25 |
+
{
|
| 26 |
+
$this->setChild( 'grid',
|
| 27 |
+
$this->getLayout()->createBlock( $this->_blockGroup.'/' . $this->_controller . 'Export_grid',
|
| 28 |
+
$this->_controller . '.grid')->setSaveParametersInSession(true) );
|
| 29 |
+
return Mage_Adminhtml_Block_Widget_Container::_prepareLayout();
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
/**
|
| 33 |
+
* Check whether it is single store mode
|
| 34 |
+
*
|
| 35 |
+
* @return bool
|
| 36 |
+
*/
|
| 37 |
+
public function isSingleStoreMode()
|
| 38 |
+
{
|
| 39 |
+
if (!Mage::app()->isSingleStoreMode()) {
|
| 40 |
+
return false;
|
| 41 |
+
}
|
| 42 |
+
return true;
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Bulksync export grid, shows all jobs, scheduled, completed, running, etc.
|
| 5 |
+
* You can also perform additional operations such as Delete and Reset job status
|
| 6 |
+
*
|
| 7 |
+
* @category Ebizmarts
|
| 8 |
+
* @package Ebizmarts_MageMonkey
|
| 9 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 10 |
+
*/
|
| 11 |
+
class Ebizmarts_MageMonkey_Block_Adminhtml_Bulksync_QueueExport_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
| 12 |
+
{
|
| 13 |
+
|
| 14 |
+
public function __construct()
|
| 15 |
+
{
|
| 16 |
+
parent::__construct();
|
| 17 |
+
$this->setId('bulksync_exportjobs_queue');
|
| 18 |
+
$this->setUseAjax(TRUE);
|
| 19 |
+
$this->setDefaultSort('created_at');
|
| 20 |
+
$this->setDefaultDir('asc');
|
| 21 |
+
$this->setSaveParametersInSession(TRUE);
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
protected function _prepareCollection()
|
| 25 |
+
{
|
| 26 |
+
$collection = Mage::getModel('monkey/bulksyncExport')
|
| 27 |
+
->getCollection();
|
| 28 |
+
|
| 29 |
+
$this->setCollection($collection);
|
| 30 |
+
return parent::_prepareCollection();
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
protected function _prepareColumns()
|
| 34 |
+
{
|
| 35 |
+
$this->addColumn('id', array(
|
| 36 |
+
'header'=> Mage::helper('monkey')->__('ID'),
|
| 37 |
+
'index' => 'id',
|
| 38 |
+
'type' => 'number'
|
| 39 |
+
));
|
| 40 |
+
|
| 41 |
+
$this->addColumn('data_source_entity', array(
|
| 42 |
+
'header'=> Mage::helper('monkey')->__('Entity'),
|
| 43 |
+
'index' => 'data_source_entity',
|
| 44 |
+
'filter' => false,
|
| 45 |
+
'sortable' => false,
|
| 46 |
+
));
|
| 47 |
+
|
| 48 |
+
$this->addColumn('status', array(
|
| 49 |
+
'header'=> Mage::helper('monkey')->__('Status'),
|
| 50 |
+
'index' => 'status',
|
| 51 |
+
'type' => 'options',
|
| 52 |
+
'options' => Mage::getModel('monkey/system_config_source_bulksyncStatus')->toOption()
|
| 53 |
+
));
|
| 54 |
+
|
| 55 |
+
$this->addColumn('progress', array(
|
| 56 |
+
'header'=> Mage::helper('monkey')->__('Progress'),
|
| 57 |
+
'index' => 'progress',
|
| 58 |
+
'filter' => false,
|
| 59 |
+
'sortable' => false,
|
| 60 |
+
'renderer' => 'Ebizmarts_MageMonkey_Block_Adminhtml_Renderer_Progress'
|
| 61 |
+
));
|
| 62 |
+
|
| 63 |
+
$this->addColumn('lists', array(
|
| 64 |
+
'header'=> Mage::helper('monkey')->__('Lists'),
|
| 65 |
+
'index' => 'lists',
|
| 66 |
+
'filter' => false,
|
| 67 |
+
'sortable' => false,
|
| 68 |
+
'renderer' => 'Ebizmarts_MageMonkey_Block_Adminhtml_Renderer_Lists'
|
| 69 |
+
));
|
| 70 |
+
|
| 71 |
+
$this->addColumn('started_at', array(
|
| 72 |
+
'header'=> Mage::helper('monkey')->__('Started At'),
|
| 73 |
+
'index' => 'started_at',
|
| 74 |
+
'type' => 'datetime'
|
| 75 |
+
));
|
| 76 |
+
|
| 77 |
+
$this->addColumn('updated_at', array(
|
| 78 |
+
'header'=> Mage::helper('monkey')->__('Updated At'),
|
| 79 |
+
'index' => 'updated_at',
|
| 80 |
+
'type' => 'datetime'
|
| 81 |
+
));
|
| 82 |
+
|
| 83 |
+
$this->addColumn('created_at', array(
|
| 84 |
+
'header'=> Mage::helper('monkey')->__('Created At'),
|
| 85 |
+
'index' => 'created_at',
|
| 86 |
+
'type' => 'datetime'
|
| 87 |
+
));
|
| 88 |
+
|
| 89 |
+
$views = Mage::getModel('core/store')->getCollection()->toOptionHash();
|
| 90 |
+
$views[0] = Mage::helper('monkey')->__('All store views');
|
| 91 |
+
|
| 92 |
+
$this->addColumn('store_id',
|
| 93 |
+
array(
|
| 94 |
+
'header'=> Mage::helper('monkey')->__('Store'),
|
| 95 |
+
'width' => '100px',
|
| 96 |
+
'sortable' => false,
|
| 97 |
+
'filter' => false,
|
| 98 |
+
'index' => 'store_id',
|
| 99 |
+
'type' => 'options',
|
| 100 |
+
'options' => $views,
|
| 101 |
+
));
|
| 102 |
+
|
| 103 |
+
$this->addColumn('action',
|
| 104 |
+
array(
|
| 105 |
+
'header' => Mage::helper('monkey')->__('Action'),
|
| 106 |
+
'width' => '60px',
|
| 107 |
+
'type' => 'action',
|
| 108 |
+
'getter' => 'getId',
|
| 109 |
+
'actions' => array(
|
| 110 |
+
array(
|
| 111 |
+
'caption' => Mage::helper('monkey')->__('Delete'),
|
| 112 |
+
'url' => array('base' => '*/*/delete', 'params' => array('entity'=>'Export')),
|
| 113 |
+
'field' => 'job_id',
|
| 114 |
+
'confirm' => Mage::helper('monkey')->__('Are you sure?')
|
| 115 |
+
),
|
| 116 |
+
array(
|
| 117 |
+
'caption' => Mage::helper('monkey')->__('Reset Status'),
|
| 118 |
+
'url' => array('base' => '*/*/reset', 'params' => array('entity'=>'Export')),
|
| 119 |
+
'field' => 'job_id',
|
| 120 |
+
'confirm' => Mage::helper('monkey')->__('Are you sure you want to reset status to IDLE?')
|
| 121 |
+
),
|
| 122 |
+
),
|
| 123 |
+
'filter' => false,
|
| 124 |
+
'sortable' => false,
|
| 125 |
+
'is_system' => true,
|
| 126 |
+
));
|
| 127 |
+
|
| 128 |
+
return parent::_prepareColumns();
|
| 129 |
+
}
|
| 130 |
+
|
| 131 |
+
public function getRowUrl($row)
|
| 132 |
+
{
|
| 133 |
+
return FALSE;
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
public function getGridUrl()
|
| 137 |
+
{
|
| 138 |
+
return $this->getUrl('*/*/exportgrid', array('_current' => true));
|
| 139 |
+
}
|
| 140 |
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Bulksync import grid container
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_MageMonkey
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_MageMonkey_Block_Adminhtml_Bulksync_QueueImport extends Mage_Adminhtml_Block_Widget_Grid_Container
|
| 11 |
+
{
|
| 12 |
+
|
| 13 |
+
public function __construct()
|
| 14 |
+
{
|
| 15 |
+
$this->_controller = 'adminhtml_bulksync_queue';
|
| 16 |
+
$this->_blockGroup = 'monkey';
|
| 17 |
+
$this->_headerText = Mage::helper('monkey')->__('Import Queue');
|
| 18 |
+
|
| 19 |
+
parent::__construct();
|
| 20 |
+
|
| 21 |
+
$this->_removeButton('add');
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
protected function _prepareLayout()
|
| 25 |
+
{
|
| 26 |
+
$this->setChild( 'grid',
|
| 27 |
+
$this->getLayout()->createBlock( $this->_blockGroup.'/' . $this->_controller . 'Import_grid',
|
| 28 |
+
$this->_controller . '.grid')->setSaveParametersInSession(true) );
|
| 29 |
+
return Mage_Adminhtml_Block_Widget_Container::_prepareLayout();
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
/**
|
| 33 |
+
* Check whether it is single store mode
|
| 34 |
+
*
|
| 35 |
+
* @return bool
|
| 36 |
+
*/
|
| 37 |
+
public function isSingleStoreMode()
|
| 38 |
+
{
|
| 39 |
+
if (!Mage::app()->isSingleStoreMode()) {
|
| 40 |
+
return false;
|
| 41 |
+
}
|
| 42 |
+
return true;
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
}
|
|
@@ -0,0 +1,144 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Bulksync import grid, shows all jobs, scheduled, completed, running, etc.
|
| 5 |
+
* You can also perform additional operations such as Delete and Reset job status
|
| 6 |
+
*
|
| 7 |
+
* @category Ebizmarts
|
| 8 |
+
* @package Ebizmarts_MageMonkey
|
| 9 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 10 |
+
*/
|
| 11 |
+
class Ebizmarts_MageMonkey_Block_Adminhtml_Bulksync_QueueImport_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
| 12 |
+
{
|
| 13 |
+
|
| 14 |
+
public function __construct()
|
| 15 |
+
{
|
| 16 |
+
parent::__construct();
|
| 17 |
+
$this->setId('bulksync_importjobs_queue');
|
| 18 |
+
$this->setUseAjax(TRUE);
|
| 19 |
+
$this->setDefaultSort('created_at');
|
| 20 |
+
$this->setDefaultDir('asc');
|
| 21 |
+
$this->setSaveParametersInSession(TRUE);
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
protected function _prepareCollection()
|
| 25 |
+
{
|
| 26 |
+
$collection = Mage::getModel('monkey/bulksyncImport')
|
| 27 |
+
->getCollection();
|
| 28 |
+
|
| 29 |
+
$this->setCollection($collection);
|
| 30 |
+
|
| 31 |
+
return parent::_prepareCollection();
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
protected function _prepareColumns()
|
| 35 |
+
{
|
| 36 |
+
$this->addColumn('id', array(
|
| 37 |
+
'header'=> Mage::helper('monkey')->__('ID'),
|
| 38 |
+
'index' => 'id',
|
| 39 |
+
'type' => 'number'
|
| 40 |
+
));
|
| 41 |
+
|
| 42 |
+
$this->addColumn('status', array(
|
| 43 |
+
'header'=> Mage::helper('monkey')->__('Status'),
|
| 44 |
+
'index' => 'status',
|
| 45 |
+
'type' => 'options',
|
| 46 |
+
'options' => Mage::getModel('monkey/system_config_source_bulksyncStatus')->toOption()
|
| 47 |
+
));
|
| 48 |
+
|
| 49 |
+
$this->addColumn('progress', array(
|
| 50 |
+
'header'=> Mage::helper('monkey')->__('Progress'),
|
| 51 |
+
'index' => 'progress',
|
| 52 |
+
'filter' => false,
|
| 53 |
+
'sortable' => false,
|
| 54 |
+
'renderer' => 'Ebizmarts_MageMonkey_Block_Adminhtml_Renderer_Progress'
|
| 55 |
+
));
|
| 56 |
+
|
| 57 |
+
$this->addColumn('import_types', array(
|
| 58 |
+
'header'=> Mage::helper('monkey')->__('Import'),
|
| 59 |
+
'index' => 'import_types',
|
| 60 |
+
'filter' => false,
|
| 61 |
+
'sortable' => false,
|
| 62 |
+
'renderer' => 'Ebizmarts_MageMonkey_Block_Adminhtml_Renderer_Importypes'
|
| 63 |
+
));
|
| 64 |
+
|
| 65 |
+
$this->addColumn('lists', array(
|
| 66 |
+
'header'=> Mage::helper('monkey')->__('Lists'),
|
| 67 |
+
'index' => 'lists',
|
| 68 |
+
'filter' => false,
|
| 69 |
+
'sortable' => false,
|
| 70 |
+
'renderer' => 'Ebizmarts_MageMonkey_Block_Adminhtml_Renderer_Lists'
|
| 71 |
+
));
|
| 72 |
+
|
| 73 |
+
$this->addColumn('create_customer', array(
|
| 74 |
+
'header'=> Mage::helper('monkey')->__('Create Customer'),
|
| 75 |
+
'index' => 'create_customer',
|
| 76 |
+
'filter' => false,
|
| 77 |
+
'sortable' => false,
|
| 78 |
+
'renderer' => 'Ebizmarts_MageMonkey_Block_Adminhtml_Renderer_Yesno'
|
| 79 |
+
));
|
| 80 |
+
|
| 81 |
+
$this->addColumn('since', array(
|
| 82 |
+
'header'=> Mage::helper('monkey')->__('Retrieve Since'),
|
| 83 |
+
'index' => 'since',
|
| 84 |
+
'renderer' => 'Ebizmarts_MageMonkey_Block_Adminhtml_Renderer_Date',
|
| 85 |
+
'filter' => false,
|
| 86 |
+
'sortable' => false,
|
| 87 |
+
));
|
| 88 |
+
|
| 89 |
+
$this->addColumn('started_at', array(
|
| 90 |
+
'header'=> Mage::helper('monkey')->__('Started At'),
|
| 91 |
+
'index' => 'started_at',
|
| 92 |
+
'type' => 'datetime'
|
| 93 |
+
));
|
| 94 |
+
|
| 95 |
+
$this->addColumn('updated_at', array(
|
| 96 |
+
'header'=> Mage::helper('monkey')->__('Updated At'),
|
| 97 |
+
'index' => 'updated_at',
|
| 98 |
+
'type' => 'datetime'
|
| 99 |
+
));
|
| 100 |
+
|
| 101 |
+
$this->addColumn('created_at', array(
|
| 102 |
+
'header'=> Mage::helper('monkey')->__('Created At'),
|
| 103 |
+
'index' => 'created_at',
|
| 104 |
+
'type' => 'datetime'
|
| 105 |
+
));
|
| 106 |
+
|
| 107 |
+
$this->addColumn('action',
|
| 108 |
+
array(
|
| 109 |
+
'header' => Mage::helper('monkey')->__('Action'),
|
| 110 |
+
'width' => '60px',
|
| 111 |
+
'type' => 'action',
|
| 112 |
+
'getter' => 'getId',
|
| 113 |
+
'actions' => array(
|
| 114 |
+
array(
|
| 115 |
+
'caption' => Mage::helper('monkey')->__('Delete'),
|
| 116 |
+
'url' => array('base' => '*/*/delete', 'params' => array('entity'=>'Import')),
|
| 117 |
+
'field' => 'job_id',
|
| 118 |
+
'confirm' => Mage::helper('monkey')->__('Are you sure?')
|
| 119 |
+
),
|
| 120 |
+
array(
|
| 121 |
+
'caption' => Mage::helper('monkey')->__('Reset Status'),
|
| 122 |
+
'url' => array('base' => '*/*/reset', 'params' => array('entity'=>'Import')),
|
| 123 |
+
'field' => 'job_id',
|
| 124 |
+
'confirm' => Mage::helper('monkey')->__('Are you sure you want to reset status to IDLE?')
|
| 125 |
+
),
|
| 126 |
+
),
|
| 127 |
+
'filter' => false,
|
| 128 |
+
'sortable' => false,
|
| 129 |
+
'is_system' => true,
|
| 130 |
+
));
|
| 131 |
+
|
| 132 |
+
return parent::_prepareColumns();
|
| 133 |
+
}
|
| 134 |
+
|
| 135 |
+
public function getRowUrl($row)
|
| 136 |
+
{
|
| 137 |
+
return FALSE;
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
+
public function getGridUrl()
|
| 141 |
+
{
|
| 142 |
+
return $this->getUrl('*/*/importgrid', array('_current' => true));
|
| 143 |
+
}
|
| 144 |
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Customer activiy information block retrieved from MailChimp to show under Customer
|
| 5 |
+
* Edit section
|
| 6 |
+
*
|
| 7 |
+
* @category Ebizmarts
|
| 8 |
+
* @package Ebizmarts_MageMonkey
|
| 9 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 10 |
+
*/
|
| 11 |
+
class Ebizmarts_MageMonkey_Block_Adminhtml_Customer_Edit_Tab_Memberactivity
|
| 12 |
+
extends Ebizmarts_MageMonkey_Block_Adminhtml_Memberactivity_Grid
|
| 13 |
+
implements Mage_Adminhtml_Block_Widget_Tab_Interface
|
| 14 |
+
{
|
| 15 |
+
|
| 16 |
+
/**
|
| 17 |
+
* Columns, that should be removed from grid
|
| 18 |
+
*
|
| 19 |
+
* @var array
|
| 20 |
+
*/
|
| 21 |
+
protected $_columnsToRemove = array('visitor_session_id', 'protocol', 'customer_id');
|
| 22 |
+
|
| 23 |
+
public function __construct()
|
| 24 |
+
{
|
| 25 |
+
parent::__construct();
|
| 26 |
+
$this->setFilterVisibility(FALSE);
|
| 27 |
+
$this->setSaveParametersInSession(FALSE);
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
/**
|
| 31 |
+
* Defines after which tab, this tab should be rendered
|
| 32 |
+
*
|
| 33 |
+
* @return string
|
| 34 |
+
*/
|
| 35 |
+
public function getAfter()
|
| 36 |
+
{
|
| 37 |
+
return 'orders';
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
/**
|
| 41 |
+
* Return Tab label
|
| 42 |
+
*
|
| 43 |
+
* @return string
|
| 44 |
+
*/
|
| 45 |
+
public function getTabLabel()
|
| 46 |
+
{
|
| 47 |
+
return $this->__('MailChimp List Member Activity');
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
/**
|
| 51 |
+
* Return Tab title
|
| 52 |
+
*
|
| 53 |
+
* @return string
|
| 54 |
+
*/
|
| 55 |
+
public function getTabTitle()
|
| 56 |
+
{
|
| 57 |
+
return $this->__('MailChimp List Member Activity');
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
/**
|
| 61 |
+
* Can show tab in tabs
|
| 62 |
+
*
|
| 63 |
+
* @return boolean
|
| 64 |
+
*/
|
| 65 |
+
public function canShowTab()
|
| 66 |
+
{
|
| 67 |
+
$customer = Mage::registry('current_customer');
|
| 68 |
+
return (bool)$customer->getId();
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
/**
|
| 72 |
+
* Tab is hidden
|
| 73 |
+
*
|
| 74 |
+
* @return boolean
|
| 75 |
+
*/
|
| 76 |
+
public function isHidden()
|
| 77 |
+
{
|
| 78 |
+
//TODO: Hide if MageMonkey is disabled
|
| 79 |
+
return false;
|
| 80 |
+
}
|
| 81 |
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Ecommerce360 sent orders Grid container
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_MageMonkey
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_MageMonkey_Block_Adminhtml_Ecommerce extends Mage_Adminhtml_Block_Widget_Grid_Container
|
| 11 |
+
{
|
| 12 |
+
|
| 13 |
+
public function __construct()
|
| 14 |
+
{
|
| 15 |
+
$this->_blockGroup = 'monkey';
|
| 16 |
+
$this->_controller = 'adminhtml_ecommerce';
|
| 17 |
+
$this->_headerText = Mage::helper('monkey')->__('Ecommerce360 Sent Orders');
|
| 18 |
+
|
| 19 |
+
parent::__construct();
|
| 20 |
+
|
| 21 |
+
$this->_removeButton('add');
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
/**
|
| 25 |
+
* Check whether it is single store mode
|
| 26 |
+
*
|
| 27 |
+
* @return bool
|
| 28 |
+
*/
|
| 29 |
+
public function isSingleStoreMode()
|
| 30 |
+
{
|
| 31 |
+
if (!Mage::app()->isSingleStoreMode()) {
|
| 32 |
+
return false;
|
| 33 |
+
}
|
| 34 |
+
return true;
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Ecommerce360 sent orders Grid
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_MageMonkey
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_MageMonkey_Block_Adminhtml_Ecommerce_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
| 11 |
+
{
|
| 12 |
+
|
| 13 |
+
public function __construct()
|
| 14 |
+
{
|
| 15 |
+
parent::__construct();
|
| 16 |
+
$this->setId('ecommerce360_sent_grid');
|
| 17 |
+
$this->setUseAjax(true);
|
| 18 |
+
$this->setDefaultSort('id');
|
| 19 |
+
$this->setDefaultDir('DESC');
|
| 20 |
+
$this->setSaveParametersInSession(false);
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
protected function _prepareCollection()
|
| 24 |
+
{
|
| 25 |
+
$collection = Mage::getModel('monkey/ecommerce')
|
| 26 |
+
->getCollection();
|
| 27 |
+
|
| 28 |
+
$this->setCollection($collection);
|
| 29 |
+
|
| 30 |
+
return parent::_prepareCollection();
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
protected function _prepareColumns()
|
| 34 |
+
{
|
| 35 |
+
$this->addColumn('id', array(
|
| 36 |
+
'header'=> Mage::helper('monkey')->__('ID'),
|
| 37 |
+
'width' => '80px',
|
| 38 |
+
'index' => 'id',
|
| 39 |
+
'type' => 'number'
|
| 40 |
+
));
|
| 41 |
+
|
| 42 |
+
$this->addColumn('order_increment_id', array(
|
| 43 |
+
'header'=> Mage::helper('monkey')->__('Order #'),
|
| 44 |
+
'width' => '80px',
|
| 45 |
+
'index' => 'order_increment_id',
|
| 46 |
+
));
|
| 47 |
+
|
| 48 |
+
$this->addColumn('mc_campaign_id', array(
|
| 49 |
+
'header'=> Mage::helper('monkey')->__('Campaign #'),
|
| 50 |
+
'width' => '80px',
|
| 51 |
+
'index' => 'mc_campaign_id'
|
| 52 |
+
));
|
| 53 |
+
|
| 54 |
+
$this->addColumn('mc_email_id', array(
|
| 55 |
+
'header'=> Mage::helper('monkey')->__('Email #'),
|
| 56 |
+
'width' => '80px',
|
| 57 |
+
'index' => 'mc_email_id'
|
| 58 |
+
));
|
| 59 |
+
|
| 60 |
+
$this->addColumn('created_at', array(
|
| 61 |
+
'header'=> Mage::helper('monkey')->__('Date Sent'),
|
| 62 |
+
'width' => '80px',
|
| 63 |
+
'index' => 'created_at',
|
| 64 |
+
'type' => 'datetime'
|
| 65 |
+
));
|
| 66 |
+
|
| 67 |
+
return parent::_prepareColumns();
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
public function getRowUrl($row)
|
| 71 |
+
{
|
| 72 |
+
return $this->getUrl('adminhtml/sales_order/view', array('order_id' => $row->getOrderId()));
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
public function getGridUrl()
|
| 76 |
+
{
|
| 77 |
+
return $this->getUrl('*/*/grid', array('_current' => true));
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
protected function _prepareMassaction()
|
| 81 |
+
{
|
| 82 |
+
$this->setMassactionIdField('order_id');
|
| 83 |
+
$this->getMassactionBlock()->setFormFieldName('orders');
|
| 84 |
+
$this->getMassactionBlock()->addItem('delete', array(
|
| 85 |
+
'label'=> Mage::helper('monkey')->__('Delete'),
|
| 86 |
+
'url' => $this->getUrl('*/*/massDelete', array('' => '')),
|
| 87 |
+
'confirm' => Mage::helper('tax')->__('Are you sure?')
|
| 88 |
+
));
|
| 89 |
+
return $this;
|
| 90 |
+
}
|
| 91 |
+
|
| 92 |
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Ecommerce360 ALL orders from api sent
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_MageMonkey
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_MageMonkey_Block_Adminhtml_Ecommerceapi extends Mage_Adminhtml_Block_Widget_Grid_Container
|
| 11 |
+
{
|
| 12 |
+
|
| 13 |
+
public function __construct()
|
| 14 |
+
{
|
| 15 |
+
$this->_blockGroup = 'monkey';
|
| 16 |
+
$this->_controller = 'adminhtml_ecommerceapi';
|
| 17 |
+
$this->_headerText = Mage::helper('monkey')->__('Ecommerce360 API Orders');
|
| 18 |
+
|
| 19 |
+
parent::__construct();
|
| 20 |
+
|
| 21 |
+
$this->_removeButton('add');
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
/**
|
| 25 |
+
* Check whether it is single store mode
|
| 26 |
+
*
|
| 27 |
+
* @return bool
|
| 28 |
+
*/
|
| 29 |
+
public function isSingleStoreMode()
|
| 30 |
+
{
|
| 31 |
+
if (!Mage::app()->isSingleStoreMode()) {
|
| 32 |
+
return false;
|
| 33 |
+
}
|
| 34 |
+
return true;
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Ecommerce360 API sent orders
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_MageMonkey
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_MageMonkey_Block_Adminhtml_Ecommerceapi_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
| 11 |
+
{
|
| 12 |
+
|
| 13 |
+
public function __construct()
|
| 14 |
+
{
|
| 15 |
+
parent::__construct();
|
| 16 |
+
$this->setId('ecommerce360_sent_grid');
|
| 17 |
+
$this->setUseAjax(true);
|
| 18 |
+
$this->setDefaultSort('id');
|
| 19 |
+
$this->setDefaultDir('DESC');
|
| 20 |
+
$this->setSaveParametersInSession(false);
|
| 21 |
+
|
| 22 |
+
$this->_pagerVisibility = false;
|
| 23 |
+
$this->_filterVisibility = false;
|
| 24 |
+
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
protected function _prepareCollection()
|
| 28 |
+
{
|
| 29 |
+
$orders = array();
|
| 30 |
+
|
| 31 |
+
foreach(Mage::app()->getStores() as $storeId => $store){
|
| 32 |
+
$api = Mage::getModel('monkey/api', array('store' => $storeId));
|
| 33 |
+
$result = $api->ecommOrders(0, 500);
|
| 34 |
+
$orders += $result['data'];
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
$collection = Mage::getModel('monkey/custom_collection', array($orders));
|
| 38 |
+
|
| 39 |
+
$this->setCollection($collection);
|
| 40 |
+
|
| 41 |
+
return parent::_prepareCollection();
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
protected function _prepareColumns()
|
| 45 |
+
{
|
| 46 |
+
$this->addColumn('store_id', array(
|
| 47 |
+
'header'=> Mage::helper('monkey')->__('Store ID'),
|
| 48 |
+
'index' => 'store_id',
|
| 49 |
+
));
|
| 50 |
+
$this->addColumn('store_name', array(
|
| 51 |
+
'header'=> Mage::helper('monkey')->__('Store Name'),
|
| 52 |
+
'index' => 'store_name',
|
| 53 |
+
));
|
| 54 |
+
$this->addColumn('order_id', array(
|
| 55 |
+
'header'=> Mage::helper('monkey')->__('Order #'),
|
| 56 |
+
'index' => 'order_id',
|
| 57 |
+
));
|
| 58 |
+
$this->addColumn('email', array(
|
| 59 |
+
'header'=> Mage::helper('monkey')->__('Email'),
|
| 60 |
+
'index' => 'email',
|
| 61 |
+
));
|
| 62 |
+
$this->addColumn('order_total', array(
|
| 63 |
+
'header'=> Mage::helper('monkey')->__('Order Total'),
|
| 64 |
+
'index' => 'order_total',
|
| 65 |
+
));
|
| 66 |
+
$this->addColumn('tax_total', array(
|
| 67 |
+
'header'=> Mage::helper('monkey')->__('Tax Total'),
|
| 68 |
+
'index' => 'tax_total',
|
| 69 |
+
));
|
| 70 |
+
$this->addColumn('ship_total', array(
|
| 71 |
+
'header'=> Mage::helper('monkey')->__('Ship Total'),
|
| 72 |
+
'index' => 'ship_total',
|
| 73 |
+
));
|
| 74 |
+
$this->addColumn('order_date', array(
|
| 75 |
+
'header'=> Mage::helper('monkey')->__('Order Date'),
|
| 76 |
+
'index' => 'order_date',
|
| 77 |
+
));
|
| 78 |
+
$this->addColumn('items', array(
|
| 79 |
+
'header'=> Mage::helper('monkey')->__('Items'),
|
| 80 |
+
'index' => 'items',
|
| 81 |
+
'renderer' => 'monkey/adminhtml_ecommerceapi_renderer_items'
|
| 82 |
+
));
|
| 83 |
+
|
| 84 |
+
return parent::_prepareColumns();
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
public function getRowUrl($row)
|
| 88 |
+
{
|
| 89 |
+
return FALSE;
|
| 90 |
+
}
|
| 91 |
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Ecommerce360 API sent orders
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_MageMonkey
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_MageMonkey_Block_Adminhtml_Ecommerceapi_Renderer_Items extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
| 11 |
+
{
|
| 12 |
+
|
| 13 |
+
public function render(Varien_Object $row)
|
| 14 |
+
{
|
| 15 |
+
$lines = $row->getLines();
|
| 16 |
+
|
| 17 |
+
$skus = array();
|
| 18 |
+
foreach($lines as $item){
|
| 19 |
+
$skus []= $item['product_sku'] . ' [' . $item['qty'] . ']';
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
return implode(', ', $skus);
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Member activity data grid
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_MageMonkey
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_MageMonkey_Block_Adminhtml_Memberactivity_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
| 11 |
+
{
|
| 12 |
+
|
| 13 |
+
public function __construct()
|
| 14 |
+
{
|
| 15 |
+
parent::__construct();
|
| 16 |
+
$this->setId('token_grid');
|
| 17 |
+
$this->setDefaultSort('id');
|
| 18 |
+
$this->setDefaultDir('DESC');
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
protected function _prepareCollection()
|
| 22 |
+
{
|
| 23 |
+
$customer = Mage::registry('current_customer');
|
| 24 |
+
$email = $customer->getEmail();
|
| 25 |
+
|
| 26 |
+
$api = Mage::getSingleton('monkey/api', array('apikey' => Mage::helper('monkey')->getApiKey($customer->getStore())));
|
| 27 |
+
$activity = array();
|
| 28 |
+
$lists = $api->listsForEmail($email);
|
| 29 |
+
|
| 30 |
+
$activityData = array();
|
| 31 |
+
if(is_array($lists)){
|
| 32 |
+
foreach($lists as $list){
|
| 33 |
+
$activity []= $api->listMemberActivity($list, $email);
|
| 34 |
+
}
|
| 35 |
+
if(!empty($activity)){
|
| 36 |
+
foreach($activity as $act){
|
| 37 |
+
|
| 38 |
+
if(empty($act['data'][0])){
|
| 39 |
+
continue;
|
| 40 |
+
}
|
| 41 |
+
$activityData []= $act['data'];
|
| 42 |
+
}
|
| 43 |
+
}
|
| 44 |
+
}
|
| 45 |
+
if(empty($activityData)){
|
| 46 |
+
$activityData[] = array('action' => '', 'timestamp' => '', 'url' => '', 'bounce_type' => '', 'campaign_id' => '');
|
| 47 |
+
}
|
| 48 |
+
if (!is_array(current($activityData))) {
|
| 49 |
+
$activityData = array();
|
| 50 |
+
} else {
|
| 51 |
+
$activityData = current($activityData);
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
$collection = Mage::getModel('monkey/custom_collection', $activityData);
|
| 55 |
+
$this->setCollection($collection);
|
| 56 |
+
return parent::_prepareCollection();
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
protected function _prepareColumns()
|
| 60 |
+
{
|
| 61 |
+
|
| 62 |
+
$this->addColumn('action', array(
|
| 63 |
+
'header'=> Mage::helper('monkey')->__('Action'),
|
| 64 |
+
'index' => 'action',
|
| 65 |
+
'sortable' => false
|
| 66 |
+
));
|
| 67 |
+
$this->addColumn('url', array(
|
| 68 |
+
'header'=> Mage::helper('monkey')->__('Url'),
|
| 69 |
+
'index' => 'url',
|
| 70 |
+
'sortable' => false
|
| 71 |
+
));
|
| 72 |
+
$this->addColumn('bounce_type', array(
|
| 73 |
+
'header'=> Mage::helper('monkey')->__('Bounce Type'),
|
| 74 |
+
'index' => 'bounce_type',
|
| 75 |
+
'sortable' => false
|
| 76 |
+
));
|
| 77 |
+
$this->addColumn('campaign_id', array(
|
| 78 |
+
'header'=> Mage::helper('monkey')->__('Campaign ID'),
|
| 79 |
+
'index' => 'campaign_id',
|
| 80 |
+
'sortable' => false
|
| 81 |
+
));
|
| 82 |
+
$this->addColumn('timestamp', array(
|
| 83 |
+
'header'=> Mage::helper('monkey')->__('Timestamp'),
|
| 84 |
+
'index' => 'timestamp',
|
| 85 |
+
'sortable' => false
|
| 86 |
+
));
|
| 87 |
+
|
| 88 |
+
return parent::_prepareColumns();
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
public function getRowUrl($row)
|
| 92 |
+
{
|
| 93 |
+
return false;
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Grid column renderer for Date
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_MageMonkey
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_MageMonkey_Block_Adminhtml_Renderer_Date extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
| 11 |
+
{
|
| 12 |
+
/**
|
| 13 |
+
* Renders grid column
|
| 14 |
+
*
|
| 15 |
+
* @param Varien_Object $row
|
| 16 |
+
* @return string
|
| 17 |
+
*/
|
| 18 |
+
public function render(Varien_Object $row)
|
| 19 |
+
{
|
| 20 |
+
$value = $this->_getValue($row);
|
| 21 |
+
|
| 22 |
+
return ($value ? str_replace('00:00:00', '', $value) : '');
|
| 23 |
+
}
|
| 24 |
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Grid column renderer for bulk import types data
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_MageMonkey
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_MageMonkey_Block_Adminhtml_Renderer_Importypes extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
| 11 |
+
{
|
| 12 |
+
/**
|
| 13 |
+
* Renders grid column
|
| 14 |
+
*
|
| 15 |
+
* @param Varien_Object $row
|
| 16 |
+
* @return string
|
| 17 |
+
*/
|
| 18 |
+
public function render(Varien_Object $row)
|
| 19 |
+
{
|
| 20 |
+
$value = $this->_getValue($row);
|
| 21 |
+
|
| 22 |
+
return implode(', ', $row->statuses());
|
| 23 |
+
}
|
| 24 |
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Grid column renderer for lists
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_MageMonkey
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_MageMonkey_Block_Adminhtml_Renderer_Lists extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
| 11 |
+
{
|
| 12 |
+
/**
|
| 13 |
+
* Renders grid column
|
| 14 |
+
*
|
| 15 |
+
* @param Varien_Object $row
|
| 16 |
+
* @return string
|
| 17 |
+
*/
|
| 18 |
+
public function render(Varien_Object $row)
|
| 19 |
+
{
|
| 20 |
+
$value = $this->_getValue($row);
|
| 21 |
+
|
| 22 |
+
$lists = Mage::getSingleton('monkey/api')
|
| 23 |
+
->lists(array('list_id' => implode(', ', $row->lists())));
|
| 24 |
+
|
| 25 |
+
$listsNames = array();
|
| 26 |
+
|
| 27 |
+
if(is_array($lists)){
|
| 28 |
+
foreach($lists['data'] as $list){
|
| 29 |
+
$listsNames []= $list['name'];
|
| 30 |
+
}
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
return implode(', ', $listsNames);
|
| 34 |
+
}
|
| 35 |
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Grid column renderer for bulksync job progress
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_MageMonkey
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_MageMonkey_Block_Adminhtml_Renderer_Progress extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
| 11 |
+
{
|
| 12 |
+
/**
|
| 13 |
+
* Renders grid column
|
| 14 |
+
* @param Varien_Object $row
|
| 15 |
+
* @return string
|
| 16 |
+
*/
|
| 17 |
+
public function render(Varien_Object $row)
|
| 18 |
+
{
|
| 19 |
+
return $this->helper('monkey')->progressbar($row->getData('processed_count'), $row->getData('total_count'));
|
| 20 |
+
}
|
| 21 |
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Grid column renderer for YesNo based on TINYINT sql data type
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_MageMonkey
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_MageMonkey_Block_Adminhtml_Renderer_Yesno extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
| 11 |
+
{
|
| 12 |
+
/**
|
| 13 |
+
* Renders grid column
|
| 14 |
+
*
|
| 15 |
+
* @param Varien_Object $row
|
| 16 |
+
* @return string
|
| 17 |
+
*/
|
| 18 |
+
public function render(Varien_Object $row)
|
| 19 |
+
{
|
| 20 |
+
$value = $this->_getValue($row);
|
| 21 |
+
|
| 22 |
+
return ($value == 1 ? Mage::helper('monkey')->__('Yes') : Mage::helper('monkey')->__('No'));
|
| 23 |
+
}
|
| 24 |
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Account details renderer for configuration settings
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_MageMonkey
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_MageMonkey_Block_Adminhtml_System_Config_Account
|
| 11 |
+
extends Mage_Adminhtml_Block_System_Config_Form_Field
|
| 12 |
+
{
|
| 13 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
| 14 |
+
{
|
| 15 |
+
$values = $element->getValues();
|
| 16 |
+
|
| 17 |
+
$html = '<ul class="checkboxes">';
|
| 18 |
+
|
| 19 |
+
foreach($values as $dat){
|
| 20 |
+
$html .= "<li>{$dat['label']}</li>";
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
$html .= '</ul>';
|
| 24 |
+
|
| 25 |
+
return $html;
|
| 26 |
+
}
|
| 27 |
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Renderer for SagePay banner in System Configuration
|
| 5 |
+
* @author Ebizmart Team <info@ebizmarts.com>
|
| 6 |
+
*/
|
| 7 |
+
class Ebizmarts_MageMonkey_Block_Adminhtml_System_Config_Fieldset_Hint
|
| 8 |
+
extends Mage_Adminhtml_Block_Abstract
|
| 9 |
+
implements Varien_Data_Form_Element_Renderer_Interface
|
| 10 |
+
{
|
| 11 |
+
protected $_template = 'magemonkey/system/config/fieldset/hint.phtml';
|
| 12 |
+
|
| 13 |
+
/**
|
| 14 |
+
* Render fieldset html
|
| 15 |
+
*
|
| 16 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
| 17 |
+
* @return string
|
| 18 |
+
*/
|
| 19 |
+
public function render(Varien_Data_Form_Element_Abstract $element)
|
| 20 |
+
{
|
| 21 |
+
return $this->toHtml();
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
public function getMageMonkeyVersion()
|
| 25 |
+
{
|
| 26 |
+
return (string) Mage::getConfig()->getNode('modules/Ebizmarts_MageMonkey/version');
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
public function getPxParams() {
|
| 30 |
+
|
| 31 |
+
$v = (string)Mage::getConfig()->getNode('modules/Ebizmarts_MageMonkey/version');
|
| 32 |
+
$ext = "MageMonkey;{$v}";
|
| 33 |
+
|
| 34 |
+
$modulesArray = (array)Mage::getConfig()->getNode('modules')->children();
|
| 35 |
+
$aux = (array_key_exists('Enterprise_Enterprise', $modulesArray))? 'EE' : 'CE' ;
|
| 36 |
+
$mageVersion = Mage::getVersion();
|
| 37 |
+
$mage = "Magento {$aux};{$mageVersion}";
|
| 38 |
+
|
| 39 |
+
$hash = md5($ext . '_' . $mage . '_' . $ext);
|
| 40 |
+
|
| 41 |
+
return "ext=$ext&mage={$mage}&ctrl={$hash}";
|
| 42 |
+
|
| 43 |
+
}
|
| 44 |
+
}
|
| 45 |
+
|
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* System configuration form field renderer for mapping MergeVars fields with Magento
|
| 5 |
+
* attributes.
|
| 6 |
+
*
|
| 7 |
+
* @category Ebizmarts
|
| 8 |
+
* @package Ebizmarts_MageMonkey
|
| 9 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 10 |
+
*/
|
| 11 |
+
class Ebizmarts_MageMonkey_Block_Adminhtml_System_Config_Form_Field_Mapfields extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
|
| 12 |
+
{
|
| 13 |
+
|
| 14 |
+
public function __construct()
|
| 15 |
+
{
|
| 16 |
+
$this->addColumn('magento', array(
|
| 17 |
+
'label' => Mage::helper('monkey')->__('Customer'),
|
| 18 |
+
'style' => 'width:120px',
|
| 19 |
+
));
|
| 20 |
+
$this->addColumn('mailchimp', array(
|
| 21 |
+
'label' => Mage::helper('monkey')->__('MailChimp'),
|
| 22 |
+
'style' => 'width:120px',
|
| 23 |
+
));
|
| 24 |
+
$this->_addAfter = false;
|
| 25 |
+
$this->_addButtonLabel = Mage::helper('monkey')->__('Add field');
|
| 26 |
+
parent::__construct();
|
| 27 |
+
}
|
| 28 |
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Custom renderer for Oauth2 authorization wizard popup
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_MageMonkey
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_MageMonkey_Block_Adminhtml_System_Config_OauthWizard extends Mage_Adminhtml_Block_System_Config_Form_Field {
|
| 11 |
+
|
| 12 |
+
/**
|
| 13 |
+
* Set template to itself
|
| 14 |
+
*/
|
| 15 |
+
protected function _prepareLayout() {
|
| 16 |
+
parent::_prepareLayout();
|
| 17 |
+
if (!$this->getTemplate()) {
|
| 18 |
+
$this->setTemplate('magemonkey/system/config/oauth_wizard.phtml');
|
| 19 |
+
}
|
| 20 |
+
return $this;
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
/**
|
| 24 |
+
* Unset some non-related element parameters
|
| 25 |
+
*
|
| 26 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
| 27 |
+
* @return string
|
| 28 |
+
*/
|
| 29 |
+
public function render(Varien_Data_Form_Element_Abstract $element) {
|
| 30 |
+
$element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue();
|
| 31 |
+
return parent::render($element);
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
/**
|
| 35 |
+
* Get the button and scripts contents
|
| 36 |
+
*
|
| 37 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
| 38 |
+
* @return string
|
| 39 |
+
*/
|
| 40 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
|
| 41 |
+
$originalData = $element->getOriginalData();
|
| 42 |
+
|
| 43 |
+
$label = $originalData['button_label'];
|
| 44 |
+
|
| 45 |
+
//Check if api key works
|
| 46 |
+
$ping = Mage::getModel('monkey/api');
|
| 47 |
+
$ping->ping();
|
| 48 |
+
if(!$ping->errorCode){
|
| 49 |
+
$label = "Change API credentials";
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
$this->addData(array(
|
| 53 |
+
'button_label' => $this->helper('monkey')->__($label),
|
| 54 |
+
'button_url' => $this->helper('monkey/oauth2')->authorizeRequestUrl(),
|
| 55 |
+
'html_id' => $element->getHtmlId(),
|
| 56 |
+
));
|
| 57 |
+
return $this->_toHtml();
|
| 58 |
+
}
|
| 59 |
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Transactional email Mandrill grid container
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_MageMonkey
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_MageMonkey_Block_Adminhtml_Transactionalemail_Mandrill extends Mage_Adminhtml_Block_Widget_Grid_Container
|
| 11 |
+
{
|
| 12 |
+
|
| 13 |
+
public function __construct()
|
| 14 |
+
{
|
| 15 |
+
$this->_controller = 'adminhtml_transactionalemail_mandrill';
|
| 16 |
+
$this->_blockGroup = 'monkey';
|
| 17 |
+
$this->_headerText = Mage::helper('monkey')->__('Verified Email Addresses');
|
| 18 |
+
|
| 19 |
+
parent::__construct();
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
public function getGridHtml()
|
| 23 |
+
{
|
| 24 |
+
return $this->getChildHtml('store_switcher') . $this->getChildHtml('grid');
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
public function getCreateUrl()
|
| 28 |
+
{
|
| 29 |
+
return $this->getUrl('*/*/new', array('service' => 'mandrill', 'store' => $this->getRequest()->getParam('store', 0)));
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Transactional email Mandrill grid
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_MageMonkey
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_MageMonkey_Block_Adminhtml_Transactionalemail_Mandrill_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
| 11 |
+
{
|
| 12 |
+
|
| 13 |
+
public function __construct()
|
| 14 |
+
{
|
| 15 |
+
parent::__construct();
|
| 16 |
+
$this->setId('mandrill_valid_emails');
|
| 17 |
+
$this->setUseAjax(false);
|
| 18 |
+
$this->setSaveParametersInSession(false);
|
| 19 |
+
$this->setPagerVisibility(false);
|
| 20 |
+
$this->setFilterVisibility(false);
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
protected function _prepareCollection()
|
| 24 |
+
{
|
| 25 |
+
$apiKey = Mage::helper('monkey')->getMandrillApiKey(0);
|
| 26 |
+
$mail = Ebizmarts_MageMonkey_Model_TransactionalEmail_Adapter::factory('mandrill')
|
| 27 |
+
->setApiKey($apiKey);
|
| 28 |
+
$emails = $mail->usersSenders();
|
| 29 |
+
|
| 30 |
+
if($emails !== FALSE){
|
| 31 |
+
$_emails = array();
|
| 32 |
+
foreach($emails as $email){
|
| 33 |
+
$_emails []= array(
|
| 34 |
+
'email' => $email->address,
|
| 35 |
+
'created_at' => $email->created_at,
|
| 36 |
+
'enabled' => ($email->is_enabled === TRUE ? Mage::helper('monkey')->__('Yes') : Mage::helper('monkey')->__('No')),
|
| 37 |
+
);
|
| 38 |
+
}
|
| 39 |
+
$collection = Mage::getModel('monkey/custom_collection', array($_emails));
|
| 40 |
+
}else{
|
| 41 |
+
$collection = Mage::getModel('monkey/custom_collection', array(array()));
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
$this->setCollection($collection);
|
| 45 |
+
return parent::_prepareCollection();
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
protected function _prepareColumns()
|
| 49 |
+
{
|
| 50 |
+
$this->addColumn('email', array(
|
| 51 |
+
'header'=> Mage::helper('monkey')->__('Email Address'),
|
| 52 |
+
'index' => 'email',
|
| 53 |
+
'filter' => false,
|
| 54 |
+
'sortable' => false
|
| 55 |
+
));
|
| 56 |
+
$this->addColumn('enabled', array(
|
| 57 |
+
'header'=> Mage::helper('monkey')->__('Enabled'),
|
| 58 |
+
'index' => 'enabled',
|
| 59 |
+
'filter' => false,
|
| 60 |
+
'sortable' => false
|
| 61 |
+
));
|
| 62 |
+
$this->addColumn('created_at', array(
|
| 63 |
+
'header'=> Mage::helper('monkey')->__('Created At'),
|
| 64 |
+
'index' => 'created_at',
|
| 65 |
+
'filter' => false,
|
| 66 |
+
'sortable' => false
|
| 67 |
+
));
|
| 68 |
+
|
| 69 |
+
$this->addColumn('action',
|
| 70 |
+
array(
|
| 71 |
+
'header' => Mage::helper('monkey')->__('Action'),
|
| 72 |
+
'width' => '50px',
|
| 73 |
+
'type' => 'action',
|
| 74 |
+
'getter' => 'getEmail',
|
| 75 |
+
'actions' => array(
|
| 76 |
+
array(
|
| 77 |
+
'caption' => Mage::helper('monkey')->__('Disable'),
|
| 78 |
+
'confirm' => Mage::helper('monkey')->__('This action takes immediate effect, so use it with care.'),
|
| 79 |
+
'url' => array(
|
| 80 |
+
'base' => '*/*/mandrillDisable',
|
| 81 |
+
'params' => array('store' => $this->getRequest()->getParam('store')),
|
| 82 |
+
),
|
| 83 |
+
'field' => 'email'
|
| 84 |
+
)
|
| 85 |
+
),
|
| 86 |
+
'filter' => false,
|
| 87 |
+
'sortable' => false,
|
| 88 |
+
));
|
| 89 |
+
|
| 90 |
+
return parent::_prepareColumns();
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
+
public function getRowUrl($row)
|
| 94 |
+
{
|
| 95 |
+
return false;
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
public function getGridUrl()
|
| 99 |
+
{
|
| 100 |
+
return $this->getUrl('*/*/grid', array('_current' => true));
|
| 101 |
+
}
|
| 102 |
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Add valid email to Transactional email service
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_MageMonkey
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_MageMonkey_Block_Adminhtml_Transactionalemail_Newemail extends Mage_Adminhtml_Block_Widget_Form_Container
|
| 11 |
+
{
|
| 12 |
+
|
| 13 |
+
public function __construct()
|
| 14 |
+
{
|
| 15 |
+
$this->_controller = 'adminhtml_transactionalemail';
|
| 16 |
+
$this->_blockGroup = 'monkey';
|
| 17 |
+
$this->_mode = 'newemail';
|
| 18 |
+
|
| 19 |
+
parent::__construct();
|
| 20 |
+
|
| 21 |
+
$this->_updateButton('save', 'label', Mage::helper('monkey')->__('Add'));
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
public function getHeaderText()
|
| 25 |
+
{
|
| 26 |
+
return Mage::helper('monkey')->__('Add valid email address');
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Add new email to Transactional Email service FORM
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_MageMonkey
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_MageMonkey_Block_Adminhtml_Transactionalemail_Newemail_Form extends Mage_Adminhtml_Block_Widget_Form
|
| 11 |
+
{
|
| 12 |
+
|
| 13 |
+
/**
|
| 14 |
+
* Prepare form before rendering HTML
|
| 15 |
+
*
|
| 16 |
+
* @return Mage_Adminhtml_Block_Widget_Form
|
| 17 |
+
*/
|
| 18 |
+
protected function _prepareForm()
|
| 19 |
+
{
|
| 20 |
+
$form = new Varien_Data_Form(array(
|
| 21 |
+
'id' => 'edit_form',
|
| 22 |
+
'action' => $this->getUrl('*/*/validateEmail'),
|
| 23 |
+
'method' => 'post'
|
| 24 |
+
));
|
| 25 |
+
|
| 26 |
+
$fieldset = $form->addFieldset('newemail_data', array(
|
| 27 |
+
'legend' => Mage::helper('monkey')->__('New email')
|
| 28 |
+
));
|
| 29 |
+
|
| 30 |
+
$fieldset->addField('email_address', 'text', array(
|
| 31 |
+
'label' => Mage::helper('monkey')->__('Email address'),
|
| 32 |
+
'title' => Mage::helper('monkey')->__('Email address'),
|
| 33 |
+
'name' => 'email_address',
|
| 34 |
+
'class' => 'validate-email',
|
| 35 |
+
'required' => true,
|
| 36 |
+
));
|
| 37 |
+
|
| 38 |
+
$fieldset->addField('service', 'hidden', array(
|
| 39 |
+
'name' => 'service',
|
| 40 |
+
'value' => $this->getRequest()->getParam('service'),
|
| 41 |
+
));
|
| 42 |
+
$fieldset->addField('store', 'hidden', array(
|
| 43 |
+
'name' => 'store',
|
| 44 |
+
'value' => $this->getRequest()->getParam('store', 0),
|
| 45 |
+
));
|
| 46 |
+
|
| 47 |
+
$form->setUseContainer(true);
|
| 48 |
+
$this->setForm($form);
|
| 49 |
+
|
| 50 |
+
return parent::_prepareForm();
|
| 51 |
+
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Transactional email STS grid container
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_MageMonkey
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_MageMonkey_Block_Adminhtml_Transactionalemail_Sts extends Mage_Adminhtml_Block_Widget_Grid_Container
|
| 11 |
+
{
|
| 12 |
+
|
| 13 |
+
public function __construct()
|
| 14 |
+
{
|
| 15 |
+
$this->_controller = 'adminhtml_transactionalemail_sts';
|
| 16 |
+
$this->_blockGroup = 'monkey';
|
| 17 |
+
$this->_headerText = Mage::helper('monkey')->__('Verified Email Addresses');
|
| 18 |
+
|
| 19 |
+
parent::__construct();
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
public function getGridHtml()
|
| 23 |
+
{
|
| 24 |
+
return $this->getChildHtml('store_switcher') . $this->getChildHtml('grid');
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
public function getCreateUrl()
|
| 28 |
+
{
|
| 29 |
+
return $this->getUrl('*/*/new', array('service' => 'sts', 'store' => $this->getRequest()->getParam('store', 0)));
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Transactional email STS grid
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_MageMonkey
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_MageMonkey_Block_Adminhtml_Transactionalemail_Sts_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
| 11 |
+
{
|
| 12 |
+
|
| 13 |
+
public function __construct()
|
| 14 |
+
{
|
| 15 |
+
parent::__construct();
|
| 16 |
+
$this->setId('sts_valid_emails');
|
| 17 |
+
$this->setUseAjax(false);
|
| 18 |
+
$this->setSaveParametersInSession(false);
|
| 19 |
+
$this->setPagerVisibility(false);
|
| 20 |
+
$this->setFilterVisibility(false);
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
protected function _prepareCollection()
|
| 24 |
+
{
|
| 25 |
+
$apiKey = Mage::helper('monkey')->getApiKey(0);
|
| 26 |
+
$mail = Ebizmarts_MageMonkey_Model_TransactionalEmail_Adapter::factory('sts')
|
| 27 |
+
->setApiKey($apiKey);
|
| 28 |
+
$emails = $mail->listVerifiedEmailAddresses();
|
| 29 |
+
|
| 30 |
+
if($emails !== FALSE){
|
| 31 |
+
$_emails = array();
|
| 32 |
+
foreach($emails->email_addresses as $email){
|
| 33 |
+
$_emails []= array('email' => $email);
|
| 34 |
+
}
|
| 35 |
+
$collection = Mage::getModel('monkey/custom_collection', array($_emails));
|
| 36 |
+
}else{
|
| 37 |
+
$collection = Mage::getModel('monkey/custom_collection', array(array()));
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
$this->setCollection($collection);
|
| 41 |
+
return parent::_prepareCollection();
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
protected function _prepareColumns()
|
| 45 |
+
{
|
| 46 |
+
$this->addColumn('email', array(
|
| 47 |
+
'header'=> Mage::helper('monkey')->__('Email Address'),
|
| 48 |
+
'index' => 'email',
|
| 49 |
+
'filter' => false,
|
| 50 |
+
'sortable' => false
|
| 51 |
+
));
|
| 52 |
+
|
| 53 |
+
$this->addColumn('action',
|
| 54 |
+
array(
|
| 55 |
+
'header' => Mage::helper('monkey')->__('Action'),
|
| 56 |
+
'width' => '50px',
|
| 57 |
+
'type' => 'action',
|
| 58 |
+
'getter' => 'getEmail',
|
| 59 |
+
'actions' => array(
|
| 60 |
+
array(
|
| 61 |
+
'caption' => Mage::helper('monkey')->__('Delete'),
|
| 62 |
+
'confirm' => Mage::helper('monkey')->__('This action takes immediate effect, so use it with care.'),
|
| 63 |
+
'url' => array(
|
| 64 |
+
'base' => '*/*/stsDelete',
|
| 65 |
+
'params' => array('store' => $this->getRequest()->getParam('store')),
|
| 66 |
+
),
|
| 67 |
+
'field' => 'email'
|
| 68 |
+
)
|
| 69 |
+
),
|
| 70 |
+
'filter' => false,
|
| 71 |
+
'sortable' => false,
|
| 72 |
+
));
|
| 73 |
+
|
| 74 |
+
return parent::_prepareColumns();
|
| 75 |
+
}
|
| 76 |
+
|
| 77 |
+
public function getRowUrl($row)
|
| 78 |
+
{
|
| 79 |
+
return false;
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
public function getGridUrl()
|
| 83 |
+
{
|
| 84 |
+
return $this->getUrl('*/*/grid', array('_current' => true));
|
| 85 |
+
}
|
| 86 |
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Checkout subscribe checkbox block renderer
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_MageMonkey
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_MageMonkey_Block_Checkout_Subscribe extends Ebizmarts_MageMonkey_Block_Lists
|
| 11 |
+
{
|
| 12 |
+
|
| 13 |
+
/**
|
| 14 |
+
* Render block HTML
|
| 15 |
+
*
|
| 16 |
+
* @return string
|
| 17 |
+
*/
|
| 18 |
+
protected function _toHtml()
|
| 19 |
+
{
|
| 20 |
+
$alreadySubscribed = Mage::getModel('newsletter/subscriber')
|
| 21 |
+
->loadByEmail($this->getQuote()->getCustomerEmail())
|
| 22 |
+
->isSubscribed();
|
| 23 |
+
/**
|
| 24 |
+
* If you don't want to show the lists in the checkout when the user it's already subscribed.
|
| 25 |
+
* Replace the code below for the condition below
|
| 26 |
+
*
|
| 27 |
+
* if ( !$this->helper('monkey')->canCheckoutSubscribe() OR $alreadySubscribed ) {
|
| 28 |
+
*
|
| 29 |
+
*
|
| 30 |
+
* **/
|
| 31 |
+
|
| 32 |
+
if ( !$this->helper('monkey')->canCheckoutSubscribe() ) {
|
| 33 |
+
return '';
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
return parent::_toHtml();
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
/**
|
| 40 |
+
* Retrieve current quote object from session
|
| 41 |
+
*
|
| 42 |
+
* @return Mage_Sales_Model_Quote
|
| 43 |
+
*/
|
| 44 |
+
public function getQuote()
|
| 45 |
+
{
|
| 46 |
+
return Mage::getSingleton('checkout/session')
|
| 47 |
+
->getQuote();
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
/**
|
| 51 |
+
* Retrieve from config the status of the checkbox
|
| 52 |
+
*
|
| 53 |
+
* @see Ebizmarts_MageMonkey_Model_System_Config_Source_Checkoutsubscribe
|
| 54 |
+
* @return integer Config value possible values are 0,1,2,3
|
| 55 |
+
*/
|
| 56 |
+
public function checkStatus()
|
| 57 |
+
{
|
| 58 |
+
return (int)$this->helper('monkey')->config('checkout_subscribe');
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Newsletter subscription block for MyAccount
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_MageMonkey
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_MageMonkey_Block_Customer_Account_Lists extends Ebizmarts_MageMonkey_Block_Lists
|
| 11 |
+
{
|
| 12 |
+
|
| 13 |
+
}
|
|
@@ -0,0 +1,367 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Signup standalone block to be used on different places
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_MageMonkey
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_MageMonkey_Block_Lists extends Mage_Core_Block_Template
|
| 11 |
+
{
|
| 12 |
+
|
| 13 |
+
protected $_lists = array();
|
| 14 |
+
protected $_info = array();
|
| 15 |
+
protected $_myLists = array();
|
| 16 |
+
protected $_generalList = array();
|
| 17 |
+
protected $_form;
|
| 18 |
+
protected $_api;
|
| 19 |
+
|
| 20 |
+
/**
|
| 21 |
+
* Get API instance (singleton)
|
| 22 |
+
*
|
| 23 |
+
* @return Ebizmarts_MageMonkey_Model_Api
|
| 24 |
+
*/
|
| 25 |
+
public function getApi()
|
| 26 |
+
{
|
| 27 |
+
if(is_null($this->_api)){
|
| 28 |
+
$this->_api = Mage::getSingleton('monkey/api');
|
| 29 |
+
}
|
| 30 |
+
return $this->_api;
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
public function getSaveUrl()
|
| 34 |
+
{
|
| 35 |
+
return $this->getUrl('monkey/signup/saveadditional');
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
/**
|
| 39 |
+
* Check if GENERAL list can be shown on ALL LISTS template
|
| 40 |
+
*
|
| 41 |
+
* @return bool
|
| 42 |
+
*/
|
| 43 |
+
public function getShowGeneral()
|
| 44 |
+
{
|
| 45 |
+
$action = $this->getRequest()->getActionName();
|
| 46 |
+
$controller = $this->getRequest()->getControllerName();
|
| 47 |
+
|
| 48 |
+
return (bool)!($action == 'savePayment' && $controller == 'onepage');
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
public function notInMyAccount()
|
| 52 |
+
{
|
| 53 |
+
$action = $this->getRequest()->getActionName();
|
| 54 |
+
$controller = $this->getRequest()->getControllerName();
|
| 55 |
+
$module = $this->getRequest()->getModuleName();
|
| 56 |
+
|
| 57 |
+
return (bool)!($action == 'index' && $controller == 'customer_account' && $module == 'monkey');
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
/**
|
| 61 |
+
* Show form items or not if customer is logged in and / or is on register page
|
| 62 |
+
*
|
| 63 |
+
* @return bool
|
| 64 |
+
*/
|
| 65 |
+
public function getCanShowButton()
|
| 66 |
+
{
|
| 67 |
+
$ary = array(
|
| 68 |
+
'/customer/account/create/',
|
| 69 |
+
'/checkout/onepage/savePayment/',
|
| 70 |
+
'/onestepcheckout/',
|
| 71 |
+
);
|
| 72 |
+
$requestString = $this->getRequest()->getRequestString();
|
| 73 |
+
|
| 74 |
+
return !in_array($requestString, $ary);
|
| 75 |
+
}
|
| 76 |
+
|
| 77 |
+
/**
|
| 78 |
+
* Get default list data from MC
|
| 79 |
+
*
|
| 80 |
+
* @return array
|
| 81 |
+
*/
|
| 82 |
+
public function getGeneralList()
|
| 83 |
+
{
|
| 84 |
+
$list = $this->helper('monkey')->config('list');
|
| 85 |
+
|
| 86 |
+
if($list){
|
| 87 |
+
if(empty($this->_generalList)){
|
| 88 |
+
|
| 89 |
+
$api = $this->getApi();
|
| 90 |
+
$listData = $api->lists(array('list_id' => $list));
|
| 91 |
+
|
| 92 |
+
if(empty($this->_myLists)){
|
| 93 |
+
$this->_myLists = $api->listsForEmail($this->_getEmail());
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
if($listData['total'] > 0){
|
| 97 |
+
$showRealName = $this->helper('monkey')->config('showreallistname');
|
| 98 |
+
if($showRealName) {
|
| 99 |
+
$listName = $listData['data'][0]['name'];
|
| 100 |
+
}else{
|
| 101 |
+
$listName = $this->__('General Subscription');
|
| 102 |
+
}
|
| 103 |
+
$this->_generalList = array(
|
| 104 |
+
'id' => $listData['data'][0]['id'],
|
| 105 |
+
'name' => $listName,
|
| 106 |
+
'interest_groupings' => $this->helper('monkey')->filterShowGroupings($api->listInterestGroupings($listData['data'][0]['id'])),
|
| 107 |
+
);
|
| 108 |
+
}
|
| 109 |
+
}
|
| 110 |
+
}
|
| 111 |
+
|
| 112 |
+
return $this->_generalList;
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
/**
|
| 116 |
+
* Get additional lists data from MC
|
| 117 |
+
*
|
| 118 |
+
* @return array
|
| 119 |
+
*/
|
| 120 |
+
public function getLists()
|
| 121 |
+
{
|
| 122 |
+
$additionalLists = $this->helper('monkey')->config('additional_lists');
|
| 123 |
+
|
| 124 |
+
if($additionalLists){
|
| 125 |
+
|
| 126 |
+
if(empty($this->_lists)){
|
| 127 |
+
$api = $this->getApi();
|
| 128 |
+
|
| 129 |
+
if(empty($this->_myLists)){
|
| 130 |
+
$this->_myLists = $api->listsForEmail($this->_getEmail());
|
| 131 |
+
}
|
| 132 |
+
|
| 133 |
+
$lists = $api->lists(array('list_id' => $additionalLists));
|
| 134 |
+
|
| 135 |
+
if($lists['total'] > 0){
|
| 136 |
+
foreach($lists['data'] as $list){
|
| 137 |
+
$this->_lists []= array(
|
| 138 |
+
'id' => $list['id'],
|
| 139 |
+
'name' => $list['name'],
|
| 140 |
+
'interest_groupings' => $this->helper('monkey')->filterShowGroupings($api->listInterestGroupings($list['id'])),
|
| 141 |
+
);
|
| 142 |
+
|
| 143 |
+
}
|
| 144 |
+
}
|
| 145 |
+
}
|
| 146 |
+
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
return $this->_lists;
|
| 150 |
+
}
|
| 151 |
+
|
| 152 |
+
/**
|
| 153 |
+
* Getter for class property
|
| 154 |
+
*
|
| 155 |
+
* @return array
|
| 156 |
+
*/
|
| 157 |
+
public function getSubscribedLists()
|
| 158 |
+
{
|
| 159 |
+
if(!is_array($this->_myLists)){
|
| 160 |
+
return array();
|
| 161 |
+
}
|
| 162 |
+
return $this->_myLists;
|
| 163 |
+
}
|
| 164 |
+
|
| 165 |
+
/**
|
| 166 |
+
* Utility to generate HTML name for element
|
| 167 |
+
* @param string $list
|
| 168 |
+
* @param string $group
|
| 169 |
+
* @param bool $multiple
|
| 170 |
+
* @return string
|
| 171 |
+
*/
|
| 172 |
+
protected function _htmlGroupName($list, $group = NULL, $multiple = FALSE)
|
| 173 |
+
{
|
| 174 |
+
$htmlName = "list[{$list['id']}]";
|
| 175 |
+
|
| 176 |
+
if(!is_null($group)){
|
| 177 |
+
$htmlName .= "[{$group['id']}]";
|
| 178 |
+
}
|
| 179 |
+
|
| 180 |
+
if(TRUE === $multiple){
|
| 181 |
+
$htmlName .= '[]';
|
| 182 |
+
}
|
| 183 |
+
|
| 184 |
+
return $htmlName;
|
| 185 |
+
}
|
| 186 |
+
|
| 187 |
+
/**
|
| 188 |
+
* Form getter/instantiation
|
| 189 |
+
*
|
| 190 |
+
* @return Varien_Data_Form
|
| 191 |
+
*/
|
| 192 |
+
public function getForm()
|
| 193 |
+
{
|
| 194 |
+
if ($this->_form instanceof Varien_Data_Form) {
|
| 195 |
+
return $this->_form;
|
| 196 |
+
}
|
| 197 |
+
$form = new Varien_Data_Form();
|
| 198 |
+
return $form;
|
| 199 |
+
}
|
| 200 |
+
|
| 201 |
+
/**
|
| 202 |
+
* Get MC member information for an specific list
|
| 203 |
+
*
|
| 204 |
+
* @param string $listId ID of list in MC
|
| 205 |
+
* @return array Member info on list
|
| 206 |
+
*/
|
| 207 |
+
protected function _memberInfo($listId)
|
| 208 |
+
{
|
| 209 |
+
if( FALSE === array_key_exists($listId, $this->_info) ){
|
| 210 |
+
$this->_info[$listId] = $this->getApi()->listMemberInfo($listId, $this->_getEmail());
|
| 211 |
+
}
|
| 212 |
+
|
| 213 |
+
return $this->_info[$listId];
|
| 214 |
+
}
|
| 215 |
+
|
| 216 |
+
/**
|
| 217 |
+
* Render interest grouping with its groups
|
| 218 |
+
*
|
| 219 |
+
* @param array $group Group data from MC
|
| 220 |
+
* @param array $list List data from MC
|
| 221 |
+
* @return string HTML code
|
| 222 |
+
*/
|
| 223 |
+
public function renderGroup($group, $list)
|
| 224 |
+
{
|
| 225 |
+
|
| 226 |
+
$fieldType = $group['form_field'];
|
| 227 |
+
|
| 228 |
+
if($this->_getEmail()){
|
| 229 |
+
$memberInfo = $this->_memberInfo($list['id']);
|
| 230 |
+
} else {
|
| 231 |
+
$memberInfo['success'] = 0;
|
| 232 |
+
}
|
| 233 |
+
|
| 234 |
+
$myGroups = array();
|
| 235 |
+
if($memberInfo['success'] == 1){
|
| 236 |
+
$groupings = $memberInfo['data'][0]['merges']['GROUPINGS'];
|
| 237 |
+
|
| 238 |
+
foreach($groupings as $_group){
|
| 239 |
+
if(!empty($_group['groups'])){
|
| 240 |
+
|
| 241 |
+
if($fieldType == 'checkboxes'){
|
| 242 |
+
$myGroups[$_group['id']] = explode(', ', $_group['groups']);
|
| 243 |
+
}elseif($fieldType == 'radio'){
|
| 244 |
+
$myGroups[$_group['id']] = array($_group['groups']);
|
| 245 |
+
}else{
|
| 246 |
+
$myGroups[$_group['id']] = $_group['groups'];
|
| 247 |
+
}
|
| 248 |
+
|
| 249 |
+
}
|
| 250 |
+
}
|
| 251 |
+
}
|
| 252 |
+
|
| 253 |
+
switch ($fieldType) {
|
| 254 |
+
case 'radio':
|
| 255 |
+
$class = 'Varien_Data_Form_Element_Radios';
|
| 256 |
+
break;
|
| 257 |
+
case 'checkboxes':
|
| 258 |
+
$class = 'Varien_Data_Form_Element_Checkboxes';
|
| 259 |
+
break;
|
| 260 |
+
case 'dropdown':
|
| 261 |
+
$class = 'Varien_Data_Form_Element_Select';
|
| 262 |
+
break;
|
| 263 |
+
case 'hidden':
|
| 264 |
+
$class = 'Varien_Data_Form_Element_Hidden';
|
| 265 |
+
break;
|
| 266 |
+
default:
|
| 267 |
+
$class = 'Varien_Data_Form_Element_Text';
|
| 268 |
+
break;
|
| 269 |
+
}
|
| 270 |
+
|
| 271 |
+
$object = new $class;
|
| 272 |
+
$object->setForm($this->getForm());
|
| 273 |
+
|
| 274 |
+
//Check/select values
|
| 275 |
+
if(isset($myGroups[$group['id']])){
|
| 276 |
+
$object->setValue($myGroups[$group['id']]);
|
| 277 |
+
}else{
|
| 278 |
+
$object->setValue(array());
|
| 279 |
+
}
|
| 280 |
+
|
| 281 |
+
if($fieldType == 'checkboxes' || $fieldType == 'dropdown'){
|
| 282 |
+
|
| 283 |
+
$options = array();
|
| 284 |
+
|
| 285 |
+
if($fieldType == 'dropdown'){
|
| 286 |
+
$options[''] = '';
|
| 287 |
+
}
|
| 288 |
+
|
| 289 |
+
foreach($group['groups'] as $g){
|
| 290 |
+
$options [$g['name']] = $g['name'];
|
| 291 |
+
}
|
| 292 |
+
|
| 293 |
+
if(method_exists('Varien_Data_Form_Element_Checkboxes', 'addElementValues')){
|
| 294 |
+
$object->addElementValues($options);
|
| 295 |
+
}else{
|
| 296 |
+
$object->setValues($options);
|
| 297 |
+
}
|
| 298 |
+
|
| 299 |
+
$object->setName( $this->_htmlGroupName($list, $group, ($fieldType == 'checkboxes' ? TRUE : FALSE)) );
|
| 300 |
+
$object->setHtmlId('interest-group');
|
| 301 |
+
|
| 302 |
+
$html = $object->getElementHtml();
|
| 303 |
+
|
| 304 |
+
}elseif($fieldType == 'radio' || $fieldType == 'hidden'){
|
| 305 |
+
|
| 306 |
+
$options = array();
|
| 307 |
+
foreach($group['groups'] as $g){
|
| 308 |
+
$options [] = new Varien_Object(array('value' => $g['name'], 'label' => $g['name']));
|
| 309 |
+
}
|
| 310 |
+
|
| 311 |
+
$object->setName($this->_htmlGroupName($list, $group));
|
| 312 |
+
$object->setHtmlId('interest-group');
|
| 313 |
+
|
| 314 |
+
if(method_exists('Varien_Data_Form_Element_Checkboxes', 'addElementValues')){
|
| 315 |
+
$object->addElementValues($options);
|
| 316 |
+
}else{
|
| 317 |
+
$object->setValues($options);
|
| 318 |
+
}
|
| 319 |
+
|
| 320 |
+
$html = $object->getElementHtml();
|
| 321 |
+
}
|
| 322 |
+
|
| 323 |
+
if($fieldType != 'checkboxes'){
|
| 324 |
+
$html = "<div class=\"groups-list\">{$html}</div>";
|
| 325 |
+
}
|
| 326 |
+
|
| 327 |
+
return $html;
|
| 328 |
+
|
| 329 |
+
}
|
| 330 |
+
|
| 331 |
+
/**
|
| 332 |
+
* Retrieve email from Customer object in session
|
| 333 |
+
*
|
| 334 |
+
* @return string Email address
|
| 335 |
+
*/
|
| 336 |
+
protected function _getEmail()
|
| 337 |
+
{
|
| 338 |
+
return $this->helper('customer')->getCustomer()->getEmail();
|
| 339 |
+
}
|
| 340 |
+
|
| 341 |
+
/**
|
| 342 |
+
* Return HTML code for list <label> with checkbox, checked if subscribed, otherwise not
|
| 343 |
+
*
|
| 344 |
+
* @param array $list List data from MC
|
| 345 |
+
* @return string HTML code
|
| 346 |
+
*/
|
| 347 |
+
public function listLabel($list)
|
| 348 |
+
{
|
| 349 |
+
$myLists = $this->getSubscribedLists();
|
| 350 |
+
|
| 351 |
+
$checkbox = new Varien_Data_Form_Element_Checkbox;
|
| 352 |
+
$checkbox->setForm($this->getForm());
|
| 353 |
+
$checkbox->setHtmlId('list-' . $list['id']);
|
| 354 |
+
$checkbox->setChecked((bool)(is_array($myLists) && in_array($list['id'], $myLists)));
|
| 355 |
+
$checkbox->setTitle( ($checkbox->getChecked() ? $this->__('Click to unsubscribe from this list.') : $this->__('Click to subscribe to this list.')) );
|
| 356 |
+
$checkbox->setLabel($list['name']);
|
| 357 |
+
|
| 358 |
+
$hname = $this->_htmlGroupName($list);
|
| 359 |
+
$checkbox->setName($hname . '[subscribed]');
|
| 360 |
+
|
| 361 |
+
$checkbox->setValue($list['id']);
|
| 362 |
+
$checkbox->setClass('monkey-list-subscriber');
|
| 363 |
+
|
| 364 |
+
|
| 365 |
+
return $checkbox->getLabelHtml() . $checkbox->getElementHtml();
|
| 366 |
+
}
|
| 367 |
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Signup standalone block to be used on different places
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_MageMonkey
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_MageMonkey_Block_Signup extends Ebizmarts_MageMonkey_Block_Lists
|
| 11 |
+
{
|
| 12 |
+
|
| 13 |
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Cache helper
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_MageMonkey
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_MageMonkey_Helper_Cache extends Mage_Core_Helper_Abstract
|
| 11 |
+
{
|
| 12 |
+
|
| 13 |
+
/**
|
| 14 |
+
* Cacheable API commands
|
| 15 |
+
*
|
| 16 |
+
* @var array
|
| 17 |
+
* @access protected
|
| 18 |
+
*/
|
| 19 |
+
protected $_cacheableCommands = array(
|
| 20 |
+
'getAccountDetails',
|
| 21 |
+
'listInterestGroupings',
|
| 22 |
+
'listMemberActivity',
|
| 23 |
+
'listMemberInfo',
|
| 24 |
+
'listMergeVars',
|
| 25 |
+
'lists',
|
| 26 |
+
'listsForEmail'
|
| 27 |
+
);
|
| 28 |
+
|
| 29 |
+
/**
|
| 30 |
+
* Cache tags unique param ID
|
| 31 |
+
*
|
| 32 |
+
* @var array
|
| 33 |
+
* @access protected
|
| 34 |
+
*/
|
| 35 |
+
protected $_cacheTagId = array(
|
| 36 |
+
'listMemberInfo' => array('id', 'email_address'),
|
| 37 |
+
'listMemberActivity' => array('id', 'email_address'),
|
| 38 |
+
'listsForEmail' => array( 'email_address'),
|
| 39 |
+
);
|
| 40 |
+
|
| 41 |
+
/**
|
| 42 |
+
* Clear cache callbacks
|
| 43 |
+
*
|
| 44 |
+
* @var array
|
| 45 |
+
* @access protected
|
| 46 |
+
*/
|
| 47 |
+
protected $_cacheClearCallbacks = array(
|
| 48 |
+
'listUnsubscribe' => array('listMemberInfo', 'listMembers', 'listMemberActivity', 'listsForEmail', 'lists'),
|
| 49 |
+
'listSubscribe' => array('listMemberInfo', 'listMembers', 'listMemberActivity', 'listsForEmail', 'lists'),
|
| 50 |
+
'listUpdateMember' => array('listMemberInfo', 'listMembers', 'listMemberActivity', 'listsForEmail', 'lists'),
|
| 51 |
+
);
|
| 52 |
+
|
| 53 |
+
/**
|
| 54 |
+
* Retrieve cache key to save data in cache storage
|
| 55 |
+
*
|
| 56 |
+
* @param string $command
|
| 57 |
+
* @param string $args
|
| 58 |
+
* @param string OPTIONAL $apiKey
|
| 59 |
+
* @return string
|
| 60 |
+
*/
|
| 61 |
+
public function cacheKey($command, $args, $apiKey = null) {
|
| 62 |
+
|
| 63 |
+
if (FALSE === in_array($command, $this->_cacheableCommands)) {
|
| 64 |
+
return FALSE;
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
if (is_null($args)) {
|
| 68 |
+
$args = array();
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
return md5($command . serialize($args) . $apiKey);
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
/**
|
| 75 |
+
* Clear data from Cache
|
| 76 |
+
*
|
| 77 |
+
* @param string $command
|
| 78 |
+
* @param object $object Request object
|
| 79 |
+
* @return Ebizmarts_MageMonkey_Helper_Cache
|
| 80 |
+
*/
|
| 81 |
+
public function clearCache($command, $object) {
|
| 82 |
+
if (FALSE === array_key_exists($command, $this->_cacheClearCallbacks)) {
|
| 83 |
+
return FALSE;
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
foreach ($this->_cacheClearCallbacks[$command] as $cmd) {
|
| 87 |
+
Mage::app()->cleanCache($this->cacheTagForCommand($cmd, $object));
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
return $this;
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
+
/**
|
| 94 |
+
* Return cache TAG for given command
|
| 95 |
+
*
|
| 96 |
+
* @param string $command
|
| 97 |
+
* @param object $object Request object
|
| 98 |
+
* @return array
|
| 99 |
+
*/
|
| 100 |
+
public function cacheTagForCommand($command, $object) {
|
| 101 |
+
$tag = $command;
|
| 102 |
+
|
| 103 |
+
if (isset($this->_cacheTagId[$command])) {
|
| 104 |
+
foreach ($this->_cacheTagId[$command] as $param) {
|
| 105 |
+
$tag .= $object->requestParams[$param];
|
| 106 |
+
}
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
$tag = array(strtoupper($tag));
|
| 110 |
+
|
| 111 |
+
return $tag;
|
| 112 |
+
}
|
| 113 |
+
|
| 114 |
+
}
|
|
@@ -0,0 +1,854 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Mage Monkey default helper
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_MageMonkey
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_MageMonkey_Helper_Data extends Mage_Core_Helper_Abstract
|
| 11 |
+
{
|
| 12 |
+
|
| 13 |
+
/**
|
| 14 |
+
* Utility to check if admin is logged in
|
| 15 |
+
*
|
| 16 |
+
* @return bool
|
| 17 |
+
*/
|
| 18 |
+
public function isAdmin()
|
| 19 |
+
{
|
| 20 |
+
return Mage::getSingleton('admin/session')->isLoggedIn();
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
/**
|
| 24 |
+
* Check if Magento is EE
|
| 25 |
+
*
|
| 26 |
+
* @return bool
|
| 27 |
+
*/
|
| 28 |
+
public function isEnterprise()
|
| 29 |
+
{
|
| 30 |
+
return is_object(Mage::getConfig()->getNode('global/models/enterprise_enterprise'));
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
/**
|
| 34 |
+
* Return Webhooks security key for given store
|
| 35 |
+
*
|
| 36 |
+
* @param mixed $store Store object, or Id, or code
|
| 37 |
+
* @param string $listId Optional listid to retrieve store code from it
|
| 38 |
+
* @return string
|
| 39 |
+
*/
|
| 40 |
+
public function getWebhooksKey($store, $listId = null)
|
| 41 |
+
{
|
| 42 |
+
if( !is_null($listId) ){
|
| 43 |
+
$store = $this->getStoreByList($listId, TRUE);
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
$crypt = md5((string)Mage::getConfig()->getNode('global/crypt/key'));
|
| 47 |
+
$key = substr($crypt, 0, (strlen($crypt)/2));
|
| 48 |
+
|
| 49 |
+
return ($key . $store);
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
public function filterShowGroupings($interestGroupings)
|
| 53 |
+
{
|
| 54 |
+
if(is_array($interestGroupings)){
|
| 55 |
+
|
| 56 |
+
$customGroupings = (array) Mage::getConfig()->getNode('default/monkey/custom_groupings');
|
| 57 |
+
foreach($interestGroupings as $key => $group){
|
| 58 |
+
|
| 59 |
+
if(TRUE === in_array($group['name'], $customGroupings)){
|
| 60 |
+
unset($interestGroupings[$key]);
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
}
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
return $interestGroupings;
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
/**
|
| 70 |
+
* Check if CustomerGroup grouping already exists on MC
|
| 71 |
+
*
|
| 72 |
+
* @param array $groupings
|
| 73 |
+
* @return bool
|
| 74 |
+
*/
|
| 75 |
+
public function customerGroupGroupingExists($interestGroupings)
|
| 76 |
+
{
|
| 77 |
+
$exists = FALSE;
|
| 78 |
+
if(is_array($interestGroupings)){
|
| 79 |
+
foreach($interestGroupings as $group){
|
| 80 |
+
if($group['name'] == $this->getCustomerGroupingName()){
|
| 81 |
+
$exists = TRUE;
|
| 82 |
+
break;
|
| 83 |
+
}
|
| 84 |
+
}
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
return $exists;
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
/**
|
| 91 |
+
* Return customer groping name to be used when creating a grouping to store
|
| 92 |
+
* Magento customer groups
|
| 93 |
+
*
|
| 94 |
+
* @return string
|
| 95 |
+
*/
|
| 96 |
+
public function getCustomerGroupingName()
|
| 97 |
+
{
|
| 98 |
+
return (string)Mage::getConfig()->getNode('default/monkey/custom_groupings/customer_grouping_name');
|
| 99 |
+
}
|
| 100 |
+
|
| 101 |
+
/**
|
| 102 |
+
* Get module User-Agent to use on API requests
|
| 103 |
+
*
|
| 104 |
+
* @return string
|
| 105 |
+
*/
|
| 106 |
+
public function getUserAgent()
|
| 107 |
+
{
|
| 108 |
+
$modules = Mage::getConfig()->getNode('modules')->children();
|
| 109 |
+
$modulesArray = (array)$modules;
|
| 110 |
+
|
| 111 |
+
$aux = (array_key_exists('Enterprise_Enterprise',$modulesArray))? 'EE' : 'CE' ;
|
| 112 |
+
$v = (string)Mage::getConfig()->getNode('modules/Ebizmarts_MageMonkey/version');
|
| 113 |
+
$version = strpos(Mage::getVersion(),'-')? substr(Mage::getVersion(),0,strpos(Mage::getVersion(),'-')) : Mage::getVersion();
|
| 114 |
+
return (string)'MageMonkey'.$v.'/Mage'.$aux.$version;
|
| 115 |
+
}
|
| 116 |
+
|
| 117 |
+
/**
|
| 118 |
+
* Return Mandrill API key
|
| 119 |
+
*
|
| 120 |
+
* @param string $store
|
| 121 |
+
* @return string Api Key
|
| 122 |
+
*/
|
| 123 |
+
public function getMandrillApiKey($store = null)
|
| 124 |
+
{
|
| 125 |
+
if(is_null($store)){
|
| 126 |
+
$key = $this->config('mandrill_apikey');
|
| 127 |
+
}else{
|
| 128 |
+
$curstore = Mage::app()->getStore();
|
| 129 |
+
Mage::app()->setCurrentStore($store);
|
| 130 |
+
$key = $this->config('mandrill_apikey', $store);
|
| 131 |
+
Mage::app()->setCurrentStore($curstore);
|
| 132 |
+
}
|
| 133 |
+
|
| 134 |
+
return $key;
|
| 135 |
+
}
|
| 136 |
+
|
| 137 |
+
/**
|
| 138 |
+
* Return MC API key for given store, if none is given
|
| 139 |
+
* default key is returned
|
| 140 |
+
*
|
| 141 |
+
* @param string $store
|
| 142 |
+
* @return string Api Key
|
| 143 |
+
*/
|
| 144 |
+
public function getApiKey($store = null)
|
| 145 |
+
{
|
| 146 |
+
if(is_null($store)){
|
| 147 |
+
$key = $this->config('apikey');
|
| 148 |
+
}else{
|
| 149 |
+
$curstore = Mage::app()->getStore();
|
| 150 |
+
Mage::app()->setCurrentStore($store);
|
| 151 |
+
$key = $this->config('apikey', $store);
|
| 152 |
+
Mage::app()->setCurrentStore($curstore);
|
| 153 |
+
}
|
| 154 |
+
|
| 155 |
+
return $key;
|
| 156 |
+
}
|
| 157 |
+
|
| 158 |
+
/**
|
| 159 |
+
* Logging facility
|
| 160 |
+
*
|
| 161 |
+
* @param mixed $data Message to save to file
|
| 162 |
+
* @param string $filename log filename, default is <Monkey.log>
|
| 163 |
+
* @return Mage_Core_Model_Log_Adapter
|
| 164 |
+
*/
|
| 165 |
+
public function log($data, $filename = 'Monkey.log')
|
| 166 |
+
{
|
| 167 |
+
if($this->config('enable_log') != 0) {
|
| 168 |
+
return Mage::getModel('core/log_adapter', $filename)->log($data);
|
| 169 |
+
}
|
| 170 |
+
}
|
| 171 |
+
|
| 172 |
+
/**
|
| 173 |
+
* Get module configuration value
|
| 174 |
+
*
|
| 175 |
+
* @param string $value
|
| 176 |
+
* @param string $store
|
| 177 |
+
* @return mixed Configuration setting
|
| 178 |
+
*/
|
| 179 |
+
public function config($value, $store = null)
|
| 180 |
+
{
|
| 181 |
+
$store = is_null($store) ? Mage::app()->getStore() : $store;
|
| 182 |
+
|
| 183 |
+
$configscope = Mage::app()->getRequest()->getParam('store');
|
| 184 |
+
if( $configscope && ($configscope !== 'undefined') ){
|
| 185 |
+
$store = $configscope;
|
| 186 |
+
}
|
| 187 |
+
|
| 188 |
+
return Mage::getStoreConfig("monkey/general/$value", $store);
|
| 189 |
+
}
|
| 190 |
+
|
| 191 |
+
/**
|
| 192 |
+
* Check if config setting <checkout_subscribe> is enabled
|
| 193 |
+
*
|
| 194 |
+
* @return bool
|
| 195 |
+
*/
|
| 196 |
+
public function canCheckoutSubscribe()
|
| 197 |
+
{
|
| 198 |
+
return $this->config('checkout_subscribe');
|
| 199 |
+
}
|
| 200 |
+
|
| 201 |
+
/**
|
| 202 |
+
* Check if an email is subscribed on MailChimp
|
| 203 |
+
*
|
| 204 |
+
* @param string $email
|
| 205 |
+
* @param string $listId
|
| 206 |
+
* @return bool
|
| 207 |
+
*/
|
| 208 |
+
public function subscribedToList($email, $listId = null)
|
| 209 |
+
{
|
| 210 |
+
$on = FALSE;
|
| 211 |
+
|
| 212 |
+
if($email){
|
| 213 |
+
$member = Mage::getSingleton('monkey/api')
|
| 214 |
+
->listMemberInfo($listId, $email);
|
| 215 |
+
|
| 216 |
+
if(!is_string($member) && $member['success'] && ($member['data'][0]['status'] == 'subscribed' || $member['data'][0]['status'] == 'pending')){
|
| 217 |
+
$on = TRUE;
|
| 218 |
+
}
|
| 219 |
+
}
|
| 220 |
+
|
| 221 |
+
return $on;
|
| 222 |
+
}
|
| 223 |
+
|
| 224 |
+
/**
|
| 225 |
+
* Check if Ecommerce360 integration is enabled
|
| 226 |
+
*
|
| 227 |
+
* @return bool
|
| 228 |
+
*/
|
| 229 |
+
public function ecommerce360Active()
|
| 230 |
+
{
|
| 231 |
+
return (bool)($this->config('ecommerce360') != 0);
|
| 232 |
+
}
|
| 233 |
+
|
| 234 |
+
/**
|
| 235 |
+
* Check if Transactional Email via MC is enabled
|
| 236 |
+
*
|
| 237 |
+
* @return bool
|
| 238 |
+
*/
|
| 239 |
+
public function useTransactionalService()
|
| 240 |
+
{
|
| 241 |
+
return Mage::getStoreConfigFlag("monkey/general/transactional_emails");
|
| 242 |
+
}
|
| 243 |
+
|
| 244 |
+
/**
|
| 245 |
+
* Check if Ebizmarts_MageMonkey module is enabled
|
| 246 |
+
*
|
| 247 |
+
* @return bool
|
| 248 |
+
*/
|
| 249 |
+
public function canMonkey()
|
| 250 |
+
{
|
| 251 |
+
return (bool)((int)$this->config('active') !== 0);
|
| 252 |
+
}
|
| 253 |
+
|
| 254 |
+
/**
|
| 255 |
+
* Get default MC listId for given storeId
|
| 256 |
+
*
|
| 257 |
+
* @param string $store
|
| 258 |
+
* @return string $list
|
| 259 |
+
*/
|
| 260 |
+
public function getDefaultList($store)
|
| 261 |
+
{
|
| 262 |
+
$curstore = Mage::app()->getStore();
|
| 263 |
+
Mage::app()->setCurrentStore($store);
|
| 264 |
+
$list = $this->config('list', $store);
|
| 265 |
+
Mage::app()->setCurrentStore($curstore);
|
| 266 |
+
return $list;
|
| 267 |
+
}
|
| 268 |
+
|
| 269 |
+
/**
|
| 270 |
+
* Get additional Lists by storeId
|
| 271 |
+
*
|
| 272 |
+
* @param string $store
|
| 273 |
+
* @return string $list
|
| 274 |
+
*/
|
| 275 |
+
public function getAdditionalList($store)
|
| 276 |
+
{
|
| 277 |
+
$curstore = Mage::app()->getStore();
|
| 278 |
+
Mage::app()->setCurrentStore($store);
|
| 279 |
+
$list = $this->config('additional_lists', $store);
|
| 280 |
+
Mage::app()->setCurrentStore($curstore);
|
| 281 |
+
return $list;
|
| 282 |
+
}
|
| 283 |
+
|
| 284 |
+
/**
|
| 285 |
+
* Get which store is associated to given $mcListId
|
| 286 |
+
*
|
| 287 |
+
* @param string $mcListId
|
| 288 |
+
* @param bool $includeDefault Include <default> store or not on result
|
| 289 |
+
* @return string $store
|
| 290 |
+
*/
|
| 291 |
+
public function getStoreByList($mcListId, $includeDefault = FALSE)
|
| 292 |
+
{
|
| 293 |
+
$list = Mage::getModel('core/config_data')->getCollection()
|
| 294 |
+
->addValueFilter($mcListId)->getFirstItem();
|
| 295 |
+
|
| 296 |
+
$store = null;
|
| 297 |
+
if($list->getId()){
|
| 298 |
+
|
| 299 |
+
//$isDefault = (bool)($list->getScope() == 'default');
|
| 300 |
+
$isDefault = (bool)($list->getScope() == Mage::app()->getDefaultStoreView()->getCode());
|
| 301 |
+
if(!$isDefault && !$includeDefault){
|
| 302 |
+
$store = (string)Mage::app()->getStore($list->getScopeId())->getCode();
|
| 303 |
+
}else{
|
| 304 |
+
$store = $list->getScope();
|
| 305 |
+
}
|
| 306 |
+
|
| 307 |
+
}
|
| 308 |
+
|
| 309 |
+
return $store;
|
| 310 |
+
}
|
| 311 |
+
|
| 312 |
+
/**
|
| 313 |
+
* Check if current request is a Webhooks request
|
| 314 |
+
*
|
| 315 |
+
* @return bool
|
| 316 |
+
*/
|
| 317 |
+
public function isWebhookRequest()
|
| 318 |
+
{
|
| 319 |
+
$rq = Mage::app()->getRequest();
|
| 320 |
+
$monkeyRequest = (string)'monkeywebhookindex';
|
| 321 |
+
$thisRequest = (string)($rq->getRequestedRouteName() . $rq->getRequestedControllerName() . $rq->getRequestedActionName());
|
| 322 |
+
|
| 323 |
+
return (bool)($monkeyRequest === $thisRequest);
|
| 324 |
+
}
|
| 325 |
+
|
| 326 |
+
/**
|
| 327 |
+
* Get config setting <map_fields>
|
| 328 |
+
*
|
| 329 |
+
* @return array|FALSE
|
| 330 |
+
*/
|
| 331 |
+
public function getMergeMaps($storeId)
|
| 332 |
+
{
|
| 333 |
+
return unserialize( $this->config('map_fields', $storeId) );
|
| 334 |
+
}
|
| 335 |
+
|
| 336 |
+
/**
|
| 337 |
+
* Get progress bar HTML code
|
| 338 |
+
*
|
| 339 |
+
* @param integer $complete Processed qty so far
|
| 340 |
+
* @param integer $total Total qty to process
|
| 341 |
+
* @return string
|
| 342 |
+
*/
|
| 343 |
+
public function progressbar($complete, $total)
|
| 344 |
+
{
|
| 345 |
+
if($total == 0){
|
| 346 |
+
return;
|
| 347 |
+
}
|
| 348 |
+
$percentage = round(($complete * 100) / $total, 0);
|
| 349 |
+
|
| 350 |
+
$barStyle = '';
|
| 351 |
+
if($percentage > 0){
|
| 352 |
+
$barStyle = " style=\"width: $percentage%\"";
|
| 353 |
+
}
|
| 354 |
+
|
| 355 |
+
$html = "<div id=\"bar-progress-bar\" class=\"bar-all-rounded\">\n";
|
| 356 |
+
$html .= "<div id=\"bar-progress-bar-percentage\" class=\"bar-all-rounded\"$barStyle>";
|
| 357 |
+
$html .= "$percentage% ($complete of $total)";
|
| 358 |
+
//<progress value="75" max="100">3/4 complete</progress>
|
| 359 |
+
//if ($percentage > 5) {$html .= "$percentage% ($complete of $total)";} else {$html .= "<div class=\"bar-spacer\"> </div>";}
|
| 360 |
+
$html .= "</div></div>";
|
| 361 |
+
|
| 362 |
+
return $html;
|
| 363 |
+
}
|
| 364 |
+
|
| 365 |
+
/**
|
| 366 |
+
* Return Merge Fields mapped to Magento attributes
|
| 367 |
+
*
|
| 368 |
+
* @param object $customer
|
| 369 |
+
* @param bool $includeEmail
|
| 370 |
+
* @param integer $websiteId
|
| 371 |
+
* @return array
|
| 372 |
+
*/
|
| 373 |
+
public function getMergeVars($customer, $includeEmail = FALSE, $websiteId = NULL)
|
| 374 |
+
{
|
| 375 |
+
$merge_vars = array();
|
| 376 |
+
$maps = $this->getMergeMaps($customer->getStoreId());
|
| 377 |
+
|
| 378 |
+
if(!$maps){
|
| 379 |
+
return;
|
| 380 |
+
}
|
| 381 |
+
|
| 382 |
+
$request = Mage::app()->getRequest();
|
| 383 |
+
|
| 384 |
+
//Add Customer data to Subscriber if is Newsletter_Subscriber is Customer
|
| 385 |
+
if(!$customer->getDefaultShipping() && $customer->getEntityId()){
|
| 386 |
+
$customer->addData(Mage::getModel('customer/customer')->load($customer->getEntityId())
|
| 387 |
+
->setStoreId($customer->getStoreId())
|
| 388 |
+
->toArray());
|
| 389 |
+
} elseif($customer->getCustomerId()){
|
| 390 |
+
$customer->addData(Mage::getModel('customer/customer')->load($customer->getCustomerId())
|
| 391 |
+
->setStoreId($customer->getStoreId())
|
| 392 |
+
->toArray());
|
| 393 |
+
}
|
| 394 |
+
|
| 395 |
+
foreach($maps as $map){
|
| 396 |
+
|
| 397 |
+
$customAtt = $map['magento'];
|
| 398 |
+
$chimpTag = $map['mailchimp'];
|
| 399 |
+
|
| 400 |
+
if($chimpTag && $customAtt){
|
| 401 |
+
|
| 402 |
+
$key = strtoupper($chimpTag);
|
| 403 |
+
|
| 404 |
+
switch ($customAtt) {
|
| 405 |
+
case 'gender':
|
| 406 |
+
$val = (int)$customer->getData(strtolower($customAtt));
|
| 407 |
+
if($val == 1){
|
| 408 |
+
$merge_vars[$key] = 'Male';
|
| 409 |
+
}elseif($val == 2){
|
| 410 |
+
$merge_vars[$key] = 'Female';
|
| 411 |
+
}
|
| 412 |
+
break;
|
| 413 |
+
case 'dob':
|
| 414 |
+
$dob = (string)$customer->getData(strtolower($customAtt));
|
| 415 |
+
if($dob){
|
| 416 |
+
$merge_vars[$key] = (substr($dob, 5, 2) . '/' . substr($dob, 8, 2));
|
| 417 |
+
}
|
| 418 |
+
break;
|
| 419 |
+
case 'billing_address':
|
| 420 |
+
case 'shipping_address':
|
| 421 |
+
|
| 422 |
+
$addr = explode('_', $customAtt);
|
| 423 |
+
$address = $customer->{'getPrimary'.ucfirst($addr[0]).'Address'}();
|
| 424 |
+
if(!$address){
|
| 425 |
+
if($customer->{'getDefault' .ucfirst($addr[0])}()) {
|
| 426 |
+
$address = Mage::getModel('customer/address')->load($customer->{'getDefault' .ucfirst($addr[0])}());
|
| 427 |
+
}
|
| 428 |
+
}
|
| 429 |
+
if($address){
|
| 430 |
+
$merge_vars[$key] = array(
|
| 431 |
+
'addr1' => $address->getStreet(1),
|
| 432 |
+
'addr2' => $address->getStreet(2),
|
| 433 |
+
'city' => $address->getCity(),
|
| 434 |
+
'state' => (!$address->getRegion() ? $address->getCity() : $address->getRegion()),
|
| 435 |
+
'zip' => $address->getPostcode(),
|
| 436 |
+
'country' => $address->getCountryId()
|
| 437 |
+
);
|
| 438 |
+
$telephone = $address->getTelephone();
|
| 439 |
+
if($telephone){
|
| 440 |
+
$merge_vars['TELEPHONE'] = $telephone;
|
| 441 |
+
}
|
| 442 |
+
$company = $address->getCompany();
|
| 443 |
+
if($company){
|
| 444 |
+
$merge_vars['COMPANY'] = $company;
|
| 445 |
+
}
|
| 446 |
+
}
|
| 447 |
+
|
| 448 |
+
break;
|
| 449 |
+
case 'date_of_purchase':
|
| 450 |
+
|
| 451 |
+
$last_order = Mage::getResourceModel('sales/order_collection')
|
| 452 |
+
->addFieldToFilter('customer_email', $customer->getEmail())
|
| 453 |
+
->addFieldToFilter('state', array('in' => Mage::getSingleton('sales/order_config')->getVisibleOnFrontStates()))
|
| 454 |
+
->setOrder('created_at', 'desc')
|
| 455 |
+
->getFirstItem();
|
| 456 |
+
if ( $last_order->getId() ){
|
| 457 |
+
$merge_vars[$key] = Mage::helper('core')->formatDate($last_order->getCreatedAt());
|
| 458 |
+
}
|
| 459 |
+
|
| 460 |
+
break;
|
| 461 |
+
case 'ee_customer_balance':
|
| 462 |
+
|
| 463 |
+
$merge_vars[$key] = '';
|
| 464 |
+
|
| 465 |
+
if($this->isEnterprise() && $customer->getId()){
|
| 466 |
+
|
| 467 |
+
$_customer = Mage::getModel('customer/customer')->load($customer->getId());
|
| 468 |
+
if($_customer->getId()){
|
| 469 |
+
if (Mage::app()->getStore()->isAdmin()) {
|
| 470 |
+
$websiteId = is_null($websiteId) ? Mage::app()->getStore()->getWebsiteId() : $websiteId;
|
| 471 |
+
}
|
| 472 |
+
|
| 473 |
+
$balance = Mage::getModel('enterprise_customerbalance/balance')
|
| 474 |
+
->setWebsiteId($websiteId)
|
| 475 |
+
->setCustomerId($_customer->getId())
|
| 476 |
+
->loadByCustomer();
|
| 477 |
+
|
| 478 |
+
$merge_vars[$key] = $balance->getAmount();
|
| 479 |
+
}
|
| 480 |
+
|
| 481 |
+
}
|
| 482 |
+
|
| 483 |
+
break;
|
| 484 |
+
case 'group_id':
|
| 485 |
+
$group_id = (int)$customer->getData(strtolower($customAtt));
|
| 486 |
+
$customerGroup = Mage::helper('customer')->getGroups()->toOptionHash();
|
| 487 |
+
if($group_id == 0){
|
| 488 |
+
$merge_vars[$key] = 'NOT LOGGED IN';
|
| 489 |
+
}else{
|
| 490 |
+
$merge_vars[$key] = $customerGroup[$group_id];
|
| 491 |
+
}
|
| 492 |
+
break;
|
| 493 |
+
default:
|
| 494 |
+
|
| 495 |
+
if( ($value = (string)$customer->getData(strtolower($customAtt)))
|
| 496 |
+
OR ($value = (string)$request->getPost(strtolower($customAtt))) ){
|
| 497 |
+
$merge_vars[$key] = $value;
|
| 498 |
+
}
|
| 499 |
+
|
| 500 |
+
break;
|
| 501 |
+
}
|
| 502 |
+
|
| 503 |
+
}
|
| 504 |
+
}
|
| 505 |
+
|
| 506 |
+
//GUEST
|
| 507 |
+
if( !$customer->getId() && (!$request->getPost('firstname') || !$request->getPost('lastname'))){
|
| 508 |
+
$guestFirstName = $this->config('guest_name', $customer->getStoreId());
|
| 509 |
+
$guestLastName = $this->config('guest_lastname', $customer->getStoreId());
|
| 510 |
+
|
| 511 |
+
if($guestFirstName){
|
| 512 |
+
$merge_vars['FNAME'] = $guestFirstName;
|
| 513 |
+
}
|
| 514 |
+
if($guestLastName){
|
| 515 |
+
$merge_vars['LNAME'] = $guestLastName;
|
| 516 |
+
}
|
| 517 |
+
}
|
| 518 |
+
//GUEST
|
| 519 |
+
|
| 520 |
+
if($includeEmail){
|
| 521 |
+
$merge_vars['EMAIL'] = $customer->getEmail();
|
| 522 |
+
}
|
| 523 |
+
|
| 524 |
+
$groups = $customer->getListGroups();
|
| 525 |
+
$groupings = array();
|
| 526 |
+
|
| 527 |
+
if(is_array($groups) && count($groups)){
|
| 528 |
+
foreach($groups as $groupId => $grupoptions){
|
| 529 |
+
$groupings[] = array(
|
| 530 |
+
'id' => $groupId,
|
| 531 |
+
'groups' => (is_array($grupoptions) ? implode(', ', $grupoptions) : $grupoptions)
|
| 532 |
+
);
|
| 533 |
+
}
|
| 534 |
+
}
|
| 535 |
+
|
| 536 |
+
$merge_vars['GROUPINGS'] = $groupings;
|
| 537 |
+
|
| 538 |
+
//magemonkey_mergevars_after
|
| 539 |
+
$blank = new Varien_Object;
|
| 540 |
+
Mage::dispatchEvent('magemonkey_mergevars_after',
|
| 541 |
+
array('vars' => $merge_vars, 'customer' => $customer, 'newvars' => $blank));
|
| 542 |
+
if($blank->hasData()){
|
| 543 |
+
$merge_vars = array_merge($merge_vars, $blank->toArray());
|
| 544 |
+
}
|
| 545 |
+
//magemonkey_mergevars_after
|
| 546 |
+
|
| 547 |
+
return $merge_vars;
|
| 548 |
+
}
|
| 549 |
+
|
| 550 |
+
/**
|
| 551 |
+
* Register on Magento's registry GUEST customer data for MergeVars for on checkout subscribe
|
| 552 |
+
*
|
| 553 |
+
* @param Mage_Sales_Model_Order $order
|
| 554 |
+
* @return void
|
| 555 |
+
*/
|
| 556 |
+
public function registerGuestCustomer($order)
|
| 557 |
+
{
|
| 558 |
+
|
| 559 |
+
if( Mage::registry('mc_guest_customer') ){
|
| 560 |
+
return;
|
| 561 |
+
}
|
| 562 |
+
|
| 563 |
+
$customer = new Varien_Object;
|
| 564 |
+
|
| 565 |
+
$customer->setId('guest' . time());
|
| 566 |
+
$customer->setEmail($order->getBillingAddress()->getEmail());
|
| 567 |
+
$customer->setStoreId($order->getStoreId());
|
| 568 |
+
$customer->setFirstname($order->getBillingAddress()->getFirstname());
|
| 569 |
+
$customer->setLastname($order->getBillingAddress()->getLastname());
|
| 570 |
+
$customer->setPrimaryBillingAddress($order->getBillingAddress());
|
| 571 |
+
$customer->setPrimaryShippingAddress($order->getShippingAddress());
|
| 572 |
+
|
| 573 |
+
Mage::register('mc_guest_customer', $customer, TRUE);
|
| 574 |
+
|
| 575 |
+
}
|
| 576 |
+
|
| 577 |
+
|
| 578 |
+
/**
|
| 579 |
+
* Create a Magento's customer account for given data
|
| 580 |
+
*
|
| 581 |
+
* @param array $accountData
|
| 582 |
+
* @param integer $websiteId ID of website to associate customer to
|
| 583 |
+
* @return Mage_Customer_Model_Customer
|
| 584 |
+
*/
|
| 585 |
+
public function createCustomerAccount($accountData, $websiteId)
|
| 586 |
+
{
|
| 587 |
+
$customer = Mage::getModel('customer/customer')->setWebsiteId($websiteId);
|
| 588 |
+
|
| 589 |
+
if(!isset($accountData['firstname']) OR empty($accountData['firstname'])){
|
| 590 |
+
$accountData['firstname'] = $this->__('Store');
|
| 591 |
+
}
|
| 592 |
+
if(!isset($accountData['lastname']) OR empty($accountData['lastname'])){
|
| 593 |
+
$accountData['lastname'] = $this->__('Guest');
|
| 594 |
+
}
|
| 595 |
+
|
| 596 |
+
$customerForm = Mage::getModel('customer/form');
|
| 597 |
+
$customerForm->setFormCode('customer_account_create')
|
| 598 |
+
->setEntity($customer)
|
| 599 |
+
->initDefaultValues();
|
| 600 |
+
// emulate request
|
| 601 |
+
$request = $customerForm->prepareRequest($accountData);
|
| 602 |
+
$customerData = $customerForm->extractData($request);
|
| 603 |
+
$customerForm->restoreData($customerData);
|
| 604 |
+
|
| 605 |
+
$customerErrors = $customerForm->validateData($customerData);
|
| 606 |
+
|
| 607 |
+
if($customerErrors){
|
| 608 |
+
$customerForm->compactData($customerData);
|
| 609 |
+
|
| 610 |
+
$pwd = $customer->generatePassword(8);
|
| 611 |
+
$customer->setPassword($pwd);
|
| 612 |
+
$customer->setConfirmation($pwd);
|
| 613 |
+
|
| 614 |
+
|
| 615 |
+
/**
|
| 616 |
+
* Handle Address related Data
|
| 617 |
+
*/
|
| 618 |
+
$billing = $shipping = null;
|
| 619 |
+
if(isset($accountData['billing_address']) && !empty($accountData['billing_address'])){
|
| 620 |
+
$this->_McAddressToMage($accountData, 'billing', $customer);
|
| 621 |
+
}
|
| 622 |
+
if(isset($accountData['shipping_address']) && !empty($accountData['shipping_address'])){
|
| 623 |
+
$this->_McAddressToMage($accountData, 'shipping', $customer);
|
| 624 |
+
}
|
| 625 |
+
/**
|
| 626 |
+
* Handle Address related Data
|
| 627 |
+
*/
|
| 628 |
+
|
| 629 |
+
$customerErrors = $customer->validate();
|
| 630 |
+
if (is_array($customerErrors) && count($customerErrors)) {
|
| 631 |
+
|
| 632 |
+
//TODO: Do something with errors.
|
| 633 |
+
|
| 634 |
+
}else{
|
| 635 |
+
$customer->save();
|
| 636 |
+
|
| 637 |
+
if ( $customer->isConfirmationRequired() ){
|
| 638 |
+
$customer->sendNewAccountEmail('confirmation');
|
| 639 |
+
}
|
| 640 |
+
|
| 641 |
+
}
|
| 642 |
+
}
|
| 643 |
+
|
| 644 |
+
return $customer;
|
| 645 |
+
}
|
| 646 |
+
|
| 647 |
+
/**
|
| 648 |
+
* Parse MailChimp <address> MergeField type to Magento's address object
|
| 649 |
+
*
|
| 650 |
+
* @param array $data MC address data
|
| 651 |
+
* @param string $type billing or shipping
|
| 652 |
+
* @param Mage_Customer_Model_Customer $customer
|
| 653 |
+
* @return array Empty if noy errors, or a list of errors in an Array
|
| 654 |
+
*/
|
| 655 |
+
protected function _McAddressToMage(array $data, $type, $customer)
|
| 656 |
+
{
|
| 657 |
+
$addressData = $data["{$type}_address"];
|
| 658 |
+
$address = explode(str_repeat(chr(32), 2), $addressData);
|
| 659 |
+
list($addr1, $addr2, $city, $state, $zip, $country) = $address;
|
| 660 |
+
|
| 661 |
+
$region = Mage::getModel('directory/region')->loadByName($state, $country);
|
| 662 |
+
|
| 663 |
+
$mgAddress = array(
|
| 664 |
+
'firstname' => $data['firstname'],
|
| 665 |
+
'lastname' => $data['lastname'],
|
| 666 |
+
'street' => array($addr1, $addr2),
|
| 667 |
+
'city' => $city,
|
| 668 |
+
'country_id' => $country,
|
| 669 |
+
'region' => $state,
|
| 670 |
+
'region_id' => (!is_null($region->getId()) ? $region->getId() : null),
|
| 671 |
+
'postcode' => $zip,
|
| 672 |
+
'telephone' => 'not_provided',
|
| 673 |
+
);
|
| 674 |
+
|
| 675 |
+
/* @var $address Mage_Customer_Model_Address */
|
| 676 |
+
$address = Mage::getModel('customer/address');
|
| 677 |
+
/* @var $addressForm Mage_Customer_Model_Form */
|
| 678 |
+
$addressForm = Mage::getModel('customer/form');
|
| 679 |
+
$addressForm->setFormCode('customer_register_address')
|
| 680 |
+
->setEntity($address);
|
| 681 |
+
|
| 682 |
+
$addrrequest = $addressForm->prepareRequest($mgAddress);
|
| 683 |
+
$addressData = $addressForm->extractData($addrrequest);
|
| 684 |
+
$addressErrors = $addressForm->validateData($addressData);
|
| 685 |
+
|
| 686 |
+
$errors = array();
|
| 687 |
+
if ($addressErrors === true) {
|
| 688 |
+
$address->setId(null)
|
| 689 |
+
->setData("is_default_{$type}", TRUE);
|
| 690 |
+
$addressForm->compactData($addressData);
|
| 691 |
+
$customer->addAddress($address);
|
| 692 |
+
|
| 693 |
+
$addressErrors = $address->validate();
|
| 694 |
+
if (is_array($addressErrors)) {
|
| 695 |
+
$errors = array_merge($errors, $addressErrors);
|
| 696 |
+
}
|
| 697 |
+
} else {
|
| 698 |
+
$errors = array_merge($errors, $addressErrors);
|
| 699 |
+
}
|
| 700 |
+
|
| 701 |
+
return $errors;
|
| 702 |
+
}
|
| 703 |
+
|
| 704 |
+
/**
|
| 705 |
+
* Handle additional lists subscription on form posts like Customer Create Account
|
| 706 |
+
*
|
| 707 |
+
* @param Mage_Customer_Model_Customer $customer
|
| 708 |
+
*/
|
| 709 |
+
public function additionalListsSubscription($customer = null, $post = null)
|
| 710 |
+
{
|
| 711 |
+
$request = Mage::app()->getRequest();
|
| 712 |
+
|
| 713 |
+
if( !$request->isPost() && is_null($post) ){
|
| 714 |
+
return false;
|
| 715 |
+
}
|
| 716 |
+
|
| 717 |
+
$allowedPost = array('/customer/account/createpost/');
|
| 718 |
+
$requestString = $request->getRequestString();
|
| 719 |
+
|
| 720 |
+
if( in_array($requestString, $allowedPost) OR !is_null($post) ){
|
| 721 |
+
if(!is_null($post)){
|
| 722 |
+
$request = $post;
|
| 723 |
+
}
|
| 724 |
+
$this->handlePost($request, $customer->getEmail());
|
| 725 |
+
}
|
| 726 |
+
|
| 727 |
+
}
|
| 728 |
+
|
| 729 |
+
/**
|
| 730 |
+
* Handle subscription posts, (additional lists)
|
| 731 |
+
*
|
| 732 |
+
* @param Mage_Core_Controller_Request_Http $request
|
| 733 |
+
* @param string $guestEmail
|
| 734 |
+
* @return void
|
| 735 |
+
*/
|
| 736 |
+
public function handlePost($request, $guestEmail)
|
| 737 |
+
{
|
| 738 |
+
//<state> param is an html serialized field containing the default form state
|
| 739 |
+
//before submission, we need to parse it as a request in order to save it to $odata and process it
|
| 740 |
+
parse_str($request->getPost('state'), $odata);
|
| 741 |
+
$isConfirmNeed = FALSE;
|
| 742 |
+
$curlists = (TRUE === array_key_exists('list', $odata)) ? $odata['list'] : array();
|
| 743 |
+
$lists = $request->getPost('list', array());
|
| 744 |
+
|
| 745 |
+
$defaultList = $this->getDefaultList(Mage::app()->getStore());
|
| 746 |
+
|
| 747 |
+
$api = Mage::getSingleton('monkey/api');
|
| 748 |
+
$loggedIn = Mage::helper('customer')->isLoggedIn();
|
| 749 |
+
if($loggedIn){
|
| 750 |
+
$customer = Mage::helper('customer')->getCustomer();
|
| 751 |
+
}else{
|
| 752 |
+
$customer = Mage::registry('mc_guest_customer');
|
| 753 |
+
}
|
| 754 |
+
$email = $guestEmail ? $guestEmail : $customer->getEmail();
|
| 755 |
+
|
| 756 |
+
if( !empty($curlists) ){
|
| 757 |
+
|
| 758 |
+
//Handle Unsubscribe and groups update actions
|
| 759 |
+
foreach($curlists as $listId => $list){
|
| 760 |
+
|
| 761 |
+
if(FALSE === array_key_exists($listId, $lists)){
|
| 762 |
+
|
| 763 |
+
//Unsubscribe Email
|
| 764 |
+
if($defaultList == $listId){
|
| 765 |
+
|
| 766 |
+
$item = Mage::getModel('monkey/monkey')->loadByEmail($email);
|
| 767 |
+
if(!$item->getId()){
|
| 768 |
+
$item = Mage::getModel('newsletter/subscriber')
|
| 769 |
+
->loadByEmail($email);
|
| 770 |
+
}
|
| 771 |
+
if($item->getSubscriberEmail()){
|
| 772 |
+
$item->unsubscribe();
|
| 773 |
+
}
|
| 774 |
+
|
| 775 |
+
//Unsubscribe Email
|
| 776 |
+
$api->listUnsubscribe($listId, $email);
|
| 777 |
+
}
|
| 778 |
+
|
| 779 |
+
}else{
|
| 780 |
+
|
| 781 |
+
$groupings = $lists[$listId];
|
| 782 |
+
unset($groupings['subscribed']);
|
| 783 |
+
$customerLists = $api->listMemberInfo($listId,$email);
|
| 784 |
+
$customerLists = isset($customerLists['data'][0]['merges']['GROUPINGS']) ?$customerLists['data'][0]['merges']['GROUPINGS'] :array();
|
| 785 |
+
|
| 786 |
+
foreach ($customerLists as $clkey => $cl)
|
| 787 |
+
{
|
| 788 |
+
if (!isset($groupings[$cl['id']]))
|
| 789 |
+
{
|
| 790 |
+
$groupings[$cl['id']][] = '';
|
| 791 |
+
}
|
| 792 |
+
}
|
| 793 |
+
|
| 794 |
+
$customer->setMcListId($listId);
|
| 795 |
+
$customer->setListGroups($groupings);
|
| 796 |
+
$mergeVars = Mage::helper('monkey')->getMergeVars($customer);
|
| 797 |
+
|
| 798 |
+
//Handle groups update
|
| 799 |
+
$api->listUpdateMember($listId, $email, $mergeVars);
|
| 800 |
+
|
| 801 |
+
}
|
| 802 |
+
|
| 803 |
+
}
|
| 804 |
+
|
| 805 |
+
}
|
| 806 |
+
|
| 807 |
+
//Subscribe to new lists
|
| 808 |
+
if(is_array($lists) && is_array($curlists)){
|
| 809 |
+
$subscribe = array_diff_key($lists, $curlists);
|
| 810 |
+
if( !empty($subscribe) ){
|
| 811 |
+
|
| 812 |
+
foreach($subscribe as $listId => $slist){
|
| 813 |
+
|
| 814 |
+
if(!isset($slist['subscribed'])){
|
| 815 |
+
continue;
|
| 816 |
+
}
|
| 817 |
+
|
| 818 |
+
$groupings = $lists[$listId];
|
| 819 |
+
unset($groupings['subscribed']);
|
| 820 |
+
if( !Mage::helper('monkey')->isAdmin() && (Mage::getStoreConfig(Mage_Newsletter_Model_Subscriber::XML_PATH_CONFIRMATION_FLAG, Mage::app()->getStore()->getId()) == 1) ) {
|
| 821 |
+
$isConfirmNeed = TRUE;
|
| 822 |
+
}
|
| 823 |
+
if($defaultList == $listId){
|
| 824 |
+
$subscriber = Mage::getModel('newsletter/subscriber');
|
| 825 |
+
$subscriber->setListGroups($groupings);
|
| 826 |
+
$subscriber->setMcListId($listId);
|
| 827 |
+
$subscriber->setMcStoreId(Mage::app()->getStore()->getId());
|
| 828 |
+
$subscriber->setImportMode(TRUE);
|
| 829 |
+
$subscriber->subscribe($email);
|
| 830 |
+
//Just for registering the groups in the checkout page
|
| 831 |
+
$customer->setListGroups($groupings);
|
| 832 |
+
$mergeVars = Mage::helper('monkey')->getMergeVars($customer);
|
| 833 |
+
if(!is_null($request->getPost('magemonkey_subscribe'))){
|
| 834 |
+
$isOnList = Mage::helper('monkey')->subscribedToList($email, $listId);
|
| 835 |
+
if(!$isOnList){
|
| 836 |
+
$api->listSubscribe($listId, $email, $mergeVars, 'html', $isConfirmNeed);
|
| 837 |
+
} else {
|
| 838 |
+
$api->listUpdateMember($listId, $email, $mergeVars);
|
| 839 |
+
}
|
| 840 |
+
}
|
| 841 |
+
}else{
|
| 842 |
+
$customer->setListGroups($groupings);
|
| 843 |
+
$customer->setMcListId($listId);
|
| 844 |
+
$mergeVars = Mage::helper('monkey')->getMergeVars($customer);
|
| 845 |
+
$api->listSubscribe($listId, $email, $mergeVars, 'html', $isConfirmNeed);
|
| 846 |
+
|
| 847 |
+
}
|
| 848 |
+
|
| 849 |
+
}
|
| 850 |
+
|
| 851 |
+
}
|
| 852 |
+
}
|
| 853 |
+
}
|
| 854 |
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Export API helper
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_MageMonkey
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_MageMonkey_Helper_Export extends Mage_Core_Helper_Abstract
|
| 11 |
+
{
|
| 12 |
+
/**
|
| 13 |
+
* Parse members data
|
| 14 |
+
*
|
| 15 |
+
* @param string $response JSON encoded
|
| 16 |
+
* @param array $listMergeVars MergeFields for this list from MC
|
| 17 |
+
* @param string $store
|
| 18 |
+
* @return array
|
| 19 |
+
*/
|
| 20 |
+
public function parseMembers($response, $listMergeVars, $store)
|
| 21 |
+
{
|
| 22 |
+
|
| 23 |
+
$storeId = Mage::app()->getStore($store)->getId();
|
| 24 |
+
|
| 25 |
+
//Explode response, one record per line
|
| 26 |
+
$response = explode("\n", $response);
|
| 27 |
+
|
| 28 |
+
//My Merge Vars
|
| 29 |
+
$mergeMaps = Mage::helper('monkey')->getMergeMaps($storeId);
|
| 30 |
+
|
| 31 |
+
//Get Header (MergeVars)
|
| 32 |
+
$header = json_decode(array_shift($response));
|
| 33 |
+
|
| 34 |
+
//Add var to maps, not included on config
|
| 35 |
+
array_unshift($mergeMaps, array('magento' => 'email', 'mailchimp' => 'EMAIL'));
|
| 36 |
+
|
| 37 |
+
$canMerge = array();
|
| 38 |
+
foreach($header as $mergePos => $mergeLabel){
|
| 39 |
+
foreach($listMergeVars as $var){
|
| 40 |
+
if( strcmp($mergeLabel, $var['name']) === 0 ){
|
| 41 |
+
|
| 42 |
+
foreach($mergeMaps as $map){
|
| 43 |
+
if(strcmp($var['tag'], $map['mailchimp']) === 0){
|
| 44 |
+
$canMerge [$mergePos]= $map['magento'];
|
| 45 |
+
}
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
}
|
| 49 |
+
}
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
$membersData = array();
|
| 53 |
+
|
| 54 |
+
foreach($response as $member){
|
| 55 |
+
if (trim($member) != ''){
|
| 56 |
+
$membersData []= array_combine($canMerge, array_intersect_key(json_decode($member), $canMerge));
|
| 57 |
+
}
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
return $membersData;
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Oauth2 helper
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_MageMonkey
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_MageMonkey_Helper_Oauth2 extends Mage_Core_Helper_Abstract {
|
| 11 |
+
|
| 12 |
+
protected $_authorizeUri = "https://login.mailchimp.com/oauth2/authorize";
|
| 13 |
+
protected $_accessTokenUri = "https://login.mailchimp.com/oauth2/token";
|
| 14 |
+
protected $_redirectUri = "http://ebizmarts.com/magento/mailchimp/oauth2/complete.php";
|
| 15 |
+
protected $_clientId = 213915096176;
|
| 16 |
+
|
| 17 |
+
public function authorizeRequestUrl() {
|
| 18 |
+
|
| 19 |
+
$url = $this->_authorizeUri;
|
| 20 |
+
$redirectUri = urlencode($this->_redirectUri);
|
| 21 |
+
|
| 22 |
+
return "{$url}?redirect_uri={$redirectUri}&response_type=code&client_id={$this->_clientId}";
|
| 23 |
+
}
|
| 24 |
+
}
|
|
@@ -0,0 +1,176 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* MailChimp API Magento wrapper
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_MageMonkey
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_MageMonkey_Model_Api {
|
| 11 |
+
|
| 12 |
+
/**
|
| 13 |
+
* Api instance
|
| 14 |
+
*
|
| 15 |
+
* @var Ebizmarts_MageMonkey_Model_MCAPI|Ebizmarts_MageMonkey_Model_MCEXPORTAPI
|
| 16 |
+
* @access protected
|
| 17 |
+
*/
|
| 18 |
+
protected $_mcapi = null;
|
| 19 |
+
|
| 20 |
+
/**
|
| 21 |
+
* Api host
|
| 22 |
+
*
|
| 23 |
+
* @var string
|
| 24 |
+
* @access protected
|
| 25 |
+
*/
|
| 26 |
+
protected $_apihost = null;
|
| 27 |
+
|
| 28 |
+
/**
|
| 29 |
+
* Cache Helper instance
|
| 30 |
+
*
|
| 31 |
+
* @var Ebizmarts_MageMonkey_Helper_Cache
|
| 32 |
+
* @access protected
|
| 33 |
+
*/
|
| 34 |
+
protected $_cacheHelper = null;
|
| 35 |
+
|
| 36 |
+
/**
|
| 37 |
+
* MC API error code if any
|
| 38 |
+
*
|
| 39 |
+
* @var integer
|
| 40 |
+
* @access public
|
| 41 |
+
*/
|
| 42 |
+
public $errorCode = null;
|
| 43 |
+
|
| 44 |
+
/**
|
| 45 |
+
* MC API error message if any
|
| 46 |
+
*
|
| 47 |
+
* @var string
|
| 48 |
+
* @access public
|
| 49 |
+
*/
|
| 50 |
+
public $errorMessage = null;
|
| 51 |
+
|
| 52 |
+
/**
|
| 53 |
+
* Initialize API
|
| 54 |
+
*
|
| 55 |
+
* @param array $args
|
| 56 |
+
* @return void
|
| 57 |
+
*/
|
| 58 |
+
public function __construct($args) {
|
| 59 |
+
$storeId = isset($args['store']) ? $args['store'] : null;
|
| 60 |
+
$apikey = (!isset($args['apikey']) ? Mage::helper('monkey')->getApiKey($storeId) : $args['apikey']);
|
| 61 |
+
|
| 62 |
+
if (isset($args['_export_'])) {
|
| 63 |
+
$this->_mcapi = new Ebizmarts_MageMonkey_Model_MCEXPORTAPI($apikey);
|
| 64 |
+
} else {
|
| 65 |
+
$this->_mcapi = new Ebizmarts_MageMonkey_Model_MCAPI($apikey);
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
$this->_cacheHelper = Mage::helper('monkey/cache');
|
| 69 |
+
|
| 70 |
+
//Create actual API URL using API key, borrowed from MCAPI.php
|
| 71 |
+
$dc = "us1";
|
| 72 |
+
if (strstr($this->_mcapi->api_key, "-")) {
|
| 73 |
+
list($key, $dc) = explode("-", $this->_mcapi->api_key, 2);
|
| 74 |
+
if (!$dc)
|
| 75 |
+
$dc = "us1";
|
| 76 |
+
}
|
| 77 |
+
$this->_apihost = $dc . "." . $this->_mcapi->apiUrl["host"];
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
/**
|
| 81 |
+
* Magic __call method
|
| 82 |
+
*
|
| 83 |
+
* @link http://www.php.net/manual/en/language.oop5.overloading.php#language.oop5.overloading.methods
|
| 84 |
+
* @param string $method
|
| 85 |
+
* @param array $args
|
| 86 |
+
* @return mixed
|
| 87 |
+
*/
|
| 88 |
+
public function __call($method, $args = null) {
|
| 89 |
+
$this->errorCode = null;
|
| 90 |
+
$this->errorMessage = null;
|
| 91 |
+
|
| 92 |
+
return $this->call($method, $args);
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
/**
|
| 96 |
+
* Perform API call, also can be used "directly"
|
| 97 |
+
*
|
| 98 |
+
* @param string $command Command to be performed
|
| 99 |
+
* @param array $args OPTIONAL call parameters
|
| 100 |
+
* @return mixed
|
| 101 |
+
*/
|
| 102 |
+
public function call($command, $args) {
|
| 103 |
+
try {
|
| 104 |
+
|
| 105 |
+
$cacheKey = $this->_cacheHelper->cacheKey($command, $args, $this->_mcapi->api_key);
|
| 106 |
+
|
| 107 |
+
$this->_logApiCall($this->_apihost);
|
| 108 |
+
$this->_logApiCall($this->_mcapi->api_key);
|
| 109 |
+
$this->_logApiCall($command);
|
| 110 |
+
$this->_logApiCall($args);
|
| 111 |
+
|
| 112 |
+
//If there is NO cache key it means that we cannot cache methods data
|
| 113 |
+
if ($cacheKey) {
|
| 114 |
+
$cache = Mage::getModel('monkey/cache');
|
| 115 |
+
$cacheData = $cache->loadCacheData($cacheKey);
|
| 116 |
+
|
| 117 |
+
if ($cacheData) {
|
| 118 |
+
|
| 119 |
+
$result = unserialize($cacheData);
|
| 120 |
+
|
| 121 |
+
$this->_logApiCall('------ START Data from Cache for `' . $command . '` ------');
|
| 122 |
+
$this->_logApiCall($result);
|
| 123 |
+
$this->_logApiCall('------ FINISH Data from Cache for `' . $command . '` ------');
|
| 124 |
+
|
| 125 |
+
return $result;
|
| 126 |
+
}
|
| 127 |
+
}
|
| 128 |
+
|
| 129 |
+
if ($args) {
|
| 130 |
+
$result = call_user_func_array(array($this->_mcapi, $command), $args);
|
| 131 |
+
} else {
|
| 132 |
+
$result = $this->_mcapi->{$command}();
|
| 133 |
+
}
|
| 134 |
+
|
| 135 |
+
$this->_logApiCall($result);
|
| 136 |
+
|
| 137 |
+
if ($this->_mcapi->errorMessage) {
|
| 138 |
+
$this->_logApiCall("Error: {$this->_mcapi->errorMessage}, code {$this->_mcapi->errorCode}");
|
| 139 |
+
|
| 140 |
+
$this->errorCode = $this->_mcapi->errorCode;
|
| 141 |
+
$this->errorMessage = $this->_mcapi->errorMessage;
|
| 142 |
+
|
| 143 |
+
//Clear associated cache for this call, for example clear cache for listsForEmail when executing listUnsubscribe
|
| 144 |
+
$this->_cacheHelper->clearCache($command, $this->_mcapi);
|
| 145 |
+
|
| 146 |
+
return (string) $this->_mcapi->errorMessage;
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
if ($cacheKey) {
|
| 150 |
+
$cache->saveCacheData(serialize($result), $cacheKey, $this->_cacheHelper->cacheTagForCommand($command, $this->_mcapi));
|
| 151 |
+
}
|
| 152 |
+
|
| 153 |
+
//Clear associated cache for this call, for example clear cache for listsForEmail when executing listUnsubscribe
|
| 154 |
+
$this->_cacheHelper->clearCache($command, $this->_mcapi);
|
| 155 |
+
|
| 156 |
+
return $result;
|
| 157 |
+
} catch (Exception $ex) {
|
| 158 |
+
|
| 159 |
+
Mage::logException($ex);
|
| 160 |
+
|
| 161 |
+
return $ex->getMessage();
|
| 162 |
+
}
|
| 163 |
+
return FALSE;
|
| 164 |
+
}
|
| 165 |
+
|
| 166 |
+
/**
|
| 167 |
+
* Log message on <MageMonkey_ApiCall.log> file
|
| 168 |
+
*
|
| 169 |
+
* @param mixed $data
|
| 170 |
+
* @return void
|
| 171 |
+
*/
|
| 172 |
+
protected function _logApiCall($data) {
|
| 173 |
+
Mage::helper('monkey')->log($data, 'MageMonkey_ApiCall.log');
|
| 174 |
+
}
|
| 175 |
+
|
| 176 |
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Apidebug db accessor
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_MageMonkey
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_MageMonkey_Model_Apidebug extends Mage_Core_Model_Abstract
|
| 11 |
+
{
|
| 12 |
+
|
| 13 |
+
/**
|
| 14 |
+
* Initialize
|
| 15 |
+
*
|
| 16 |
+
* @return void
|
| 17 |
+
*/
|
| 18 |
+
public function _construct()
|
| 19 |
+
{
|
| 20 |
+
parent::_construct();
|
| 21 |
+
$this->_init('monkey/apidebug');
|
| 22 |
+
}
|
| 23 |
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
/**
|
| 5 |
+
* Bulksync export data access model
|
| 6 |
+
*
|
| 7 |
+
* @category Ebizmarts
|
| 8 |
+
* @package Ebizmarts_MageMonkey
|
| 9 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 10 |
+
*/
|
| 11 |
+
class Ebizmarts_MageMonkey_Model_BulksyncExport extends Mage_Core_Model_Abstract
|
| 12 |
+
{
|
| 13 |
+
|
| 14 |
+
/**
|
| 15 |
+
* Initialize
|
| 16 |
+
*
|
| 17 |
+
*/
|
| 18 |
+
public function _construct()
|
| 19 |
+
{
|
| 20 |
+
parent::_construct();
|
| 21 |
+
$this->_init('monkey/bulksync_export');
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
/**
|
| 25 |
+
* Return array of lists
|
| 26 |
+
*
|
| 27 |
+
* @return bool|array
|
| 28 |
+
*/
|
| 29 |
+
public function lists()
|
| 30 |
+
{
|
| 31 |
+
return unserialize($this->getLists());
|
| 32 |
+
}
|
| 33 |
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Bulksync import data access model
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_MageMonkey
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_MageMonkey_Model_BulksyncImport extends Mage_Core_Model_Abstract
|
| 11 |
+
{
|
| 12 |
+
|
| 13 |
+
/**
|
| 14 |
+
* Initialize
|
| 15 |
+
*
|
| 16 |
+
*/
|
| 17 |
+
public function _construct()
|
| 18 |
+
{
|
| 19 |
+
parent::_construct();
|
| 20 |
+
$this->_init('monkey/bulksync_import');
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
/**
|
| 24 |
+
* Return array of lists
|
| 25 |
+
*
|
| 26 |
+
* @return bool|array
|
| 27 |
+
*/
|
| 28 |
+
public function lists()
|
| 29 |
+
{
|
| 30 |
+
return unserialize($this->getLists());
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
/**
|
| 34 |
+
* Return array of statuses
|
| 35 |
+
*
|
| 36 |
+
* @return bool|array
|
| 37 |
+
*/
|
| 38 |
+
public function statuses()
|
| 39 |
+
{
|
| 40 |
+
return unserialize($this->getImportTypes());
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Module's cache model
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_MageMonkey
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_MageMonkey_Model_Cache {
|
| 11 |
+
|
| 12 |
+
/**
|
| 13 |
+
* @var bool Store if cache type is enabled
|
| 14 |
+
*/
|
| 15 |
+
protected $_isEnabled;
|
| 16 |
+
|
| 17 |
+
/**
|
| 18 |
+
* @var array Store cache tags
|
| 19 |
+
*/
|
| 20 |
+
protected $_cacheTags = array(self::CACHE_TAG);
|
| 21 |
+
|
| 22 |
+
/**
|
| 23 |
+
* @var int|null Cache lifetime in seconds or NULL for infinite lifetime
|
| 24 |
+
*/
|
| 25 |
+
protected $_cacheLifetime = NULL;
|
| 26 |
+
|
| 27 |
+
/**
|
| 28 |
+
* @const CACHE_TAG General cache tag
|
| 29 |
+
*/
|
| 30 |
+
const CACHE_TAG = 'MONKEY_GENERAL_CACHE_TAG';
|
| 31 |
+
|
| 32 |
+
/**
|
| 33 |
+
* @const CACHE_ID Cache ID
|
| 34 |
+
*/
|
| 35 |
+
const CACHE_ID = 'monkey';
|
| 36 |
+
|
| 37 |
+
/**
|
| 38 |
+
* Class constructor
|
| 39 |
+
*/
|
| 40 |
+
public function __construct() {
|
| 41 |
+
$this->_isEnabled = Mage::app()->useCache(self::CACHE_ID);
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
/**
|
| 45 |
+
* Check if <monkey> cache is enabled
|
| 46 |
+
*
|
| 47 |
+
* @return bool
|
| 48 |
+
*/
|
| 49 |
+
public function isCacheEnabled() {
|
| 50 |
+
return (bool) $this->_isEnabled;
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
/**
|
| 54 |
+
* Return cache tags
|
| 55 |
+
*
|
| 56 |
+
* @return array Cache tags
|
| 57 |
+
*/
|
| 58 |
+
public function getCacheTags() {
|
| 59 |
+
return $this->_cacheTags;
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
/**
|
| 63 |
+
* Return cache lifetime
|
| 64 |
+
*
|
| 65 |
+
* @return null|int
|
| 66 |
+
*/
|
| 67 |
+
public function getCacheLifetime() {
|
| 68 |
+
return $this->_cacheLifetime;
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
/**
|
| 72 |
+
* Save data to cache
|
| 73 |
+
*
|
| 74 |
+
* @param string $data Data to be cached
|
| 75 |
+
* @param string $cacheId
|
| 76 |
+
* @return Ebizmarts_MageMonkey_Model_Cache
|
| 77 |
+
*/
|
| 78 |
+
public function saveCacheData($data, $cacheId, $tags = array()) {
|
| 79 |
+
if (!$this->isCacheEnabled()) {
|
| 80 |
+
return $this;
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
$cacheTags = (!empty($tags)) ? array_merge($this->getCacheTags(), $tags) : $this->getCacheTags();
|
| 84 |
+
|
| 85 |
+
Mage::app()->saveCache($data, $cacheId, $cacheTags, $this->getCacheLifetime());
|
| 86 |
+
|
| 87 |
+
return $this;
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
/**
|
| 91 |
+
* Retrieve data from Cache
|
| 92 |
+
*
|
| 93 |
+
* @param string $cacheId Cache ID
|
| 94 |
+
* @return mixed Cache data
|
| 95 |
+
*/
|
| 96 |
+
public function loadCacheData($cacheId) {
|
| 97 |
+
if (!$this->isCacheEnabled()) {
|
| 98 |
+
return FALSE;
|
| 99 |
+
}
|
| 100 |
+
|
| 101 |
+
return Mage::app()->loadCache($cacheId);
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
/**
|
| 105 |
+
* Remove data from Cache
|
| 106 |
+
*
|
| 107 |
+
* @param string $cacheId Cache ID
|
| 108 |
+
* @return Ebizmarts_MageMonkey_Model_Cache
|
| 109 |
+
*/
|
| 110 |
+
public function removeCacheData($cacheId) {
|
| 111 |
+
if (!$this->isCacheEnabled()) {
|
| 112 |
+
return FALSE;
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
Mage::app()->removeCache($cacheId);
|
| 116 |
+
|
| 117 |
+
return $this;
|
| 118 |
+
}
|
| 119 |
+
|
| 120 |
+
/**
|
| 121 |
+
* Clean <monkey> cache
|
| 122 |
+
*
|
| 123 |
+
* @return Ebizmarts_MageMonkey_Model_Cache
|
| 124 |
+
*/
|
| 125 |
+
public function cleanCache() {
|
| 126 |
+
Mage::app()->cleanCache(self::CACHE_TAG);
|
| 127 |
+
return $this;
|
| 128 |
+
}
|
| 129 |
+
|
| 130 |
+
/**
|
| 131 |
+
* Invalidate <monkey> cache
|
| 132 |
+
*
|
| 133 |
+
* @return Ebizmarts_MageMonkey_Model_Cache
|
| 134 |
+
*/
|
| 135 |
+
public function invalidateCache() {
|
| 136 |
+
Mage::app()->getCacheInstance()->invalidateType(self::CACHE_ID);
|
| 137 |
+
return $this;
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
+
}
|
|
@@ -0,0 +1,423 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* CRON jobs processor
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_MageMonkey
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_MageMonkey_Model_Cron
|
| 11 |
+
{
|
| 12 |
+
/**
|
| 13 |
+
* Limit var for SQL queries
|
| 14 |
+
*
|
| 15 |
+
* @var integer
|
| 16 |
+
* @access protected
|
| 17 |
+
*/
|
| 18 |
+
protected $_limit = 1000;
|
| 19 |
+
|
| 20 |
+
/**
|
| 21 |
+
* Current Magento store
|
| 22 |
+
*
|
| 23 |
+
* @var Mage_Core_Model_Store
|
| 24 |
+
* @access protected
|
| 25 |
+
*/
|
| 26 |
+
protected $_store;
|
| 27 |
+
|
| 28 |
+
/**
|
| 29 |
+
* Process scheduled IMPORT tasks
|
| 30 |
+
*
|
| 31 |
+
* @return void
|
| 32 |
+
*/
|
| 33 |
+
public function processImportJobs()
|
| 34 |
+
{
|
| 35 |
+
$job = $this->_getJob('Import');
|
| 36 |
+
if(is_null($job)){
|
| 37 |
+
return $this;
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
//Update total count on first run
|
| 41 |
+
$setcount = FALSE;
|
| 42 |
+
if(!$job->getTotalCount()){
|
| 43 |
+
$setcount = TRUE;
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
if(!$job->getStartedAt()){
|
| 47 |
+
$job->setStartedAt(Mage::getModel('core/date')->gmtDate())->save();
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
foreach($job->lists() as $listId){
|
| 51 |
+
|
| 52 |
+
$toImport = array();
|
| 53 |
+
|
| 54 |
+
$store = $this->_helper()->getStoreByList($listId);
|
| 55 |
+
$websiteId = Mage::app()->getStore($store)->getWebsiteId();
|
| 56 |
+
$this->_store = Mage::app()->getStore($store);
|
| 57 |
+
|
| 58 |
+
$exportapi = Mage::getModel('monkey/api', array('store' => $store, '_export_' => TRUE));
|
| 59 |
+
$api = Mage::getModel('monkey/api', array('store' => $store));
|
| 60 |
+
|
| 61 |
+
$mergevars = $api->listMergeVars($listId);
|
| 62 |
+
|
| 63 |
+
foreach($job->statuses() as $status){
|
| 64 |
+
|
| 65 |
+
$members = $exportapi->listExport($listId, $status, NULL, $job->getSince());
|
| 66 |
+
|
| 67 |
+
if(is_null($exportapi->errorCode) && $members){
|
| 68 |
+
if( !isset($toImport[$status]) ){
|
| 69 |
+
$toImport [$status] = array();
|
| 70 |
+
}
|
| 71 |
+
$mdata = $this->_helper('export')->parseMembers($members, $mergevars, $store);
|
| 72 |
+
|
| 73 |
+
$toImport[$status] = array_merge($toImport[$status], $mdata);
|
| 74 |
+
|
| 75 |
+
if($setcount === TRUE){
|
| 76 |
+
$job->setTotalCount( (count($toImport[$status])+(int)$job->getTotalCount()) )->save();
|
| 77 |
+
}
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
if( count($toImport) > 0 ){
|
| 83 |
+
|
| 84 |
+
$job->setStatus('running')
|
| 85 |
+
->save();
|
| 86 |
+
|
| 87 |
+
foreach($toImport as $type => $emails){
|
| 88 |
+
|
| 89 |
+
foreach($emails as $data){
|
| 90 |
+
|
| 91 |
+
//Run: subscribed, unsubscribed, cleaned or updated method
|
| 92 |
+
$this->{$type}($data, $websiteId, (bool)$job->getCreateCustomer());
|
| 93 |
+
|
| 94 |
+
$job->setProcessedCount( ((int)$job->getProcessedCount() + 1) )
|
| 95 |
+
->save();
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
$job->setStatus('finished')
|
| 101 |
+
->save();
|
| 102 |
+
|
| 103 |
+
}
|
| 104 |
+
|
| 105 |
+
}
|
| 106 |
+
}
|
| 107 |
+
|
| 108 |
+
/**
|
| 109 |
+
* Return subscriber object with basic attribues
|
| 110 |
+
*
|
| 111 |
+
* @param string $email
|
| 112 |
+
* @param string $status OPTIONAL
|
| 113 |
+
* @return Mage_Newsletter_Model_Subscriber
|
| 114 |
+
*/
|
| 115 |
+
protected function _getSubscriberObject($email, $status = Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED)
|
| 116 |
+
{
|
| 117 |
+
$subscriber = Mage::getModel('newsletter/subscriber')->loadByEmail($email);
|
| 118 |
+
$subscriber->setImportMode(TRUE)->setBulksync(TRUE);
|
| 119 |
+
|
| 120 |
+
if(!$subscriber->getId()){
|
| 121 |
+
$subscriber->setStoreId($this->_store->getId())
|
| 122 |
+
->setSubscriberConfirmCode(Mage::getModel('newsletter/subscriber')->randomSequence())
|
| 123 |
+
->setEmail($email);
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
+
$subscriber->setStatus($status);
|
| 127 |
+
|
| 128 |
+
return $subscriber;
|
| 129 |
+
}
|
| 130 |
+
|
| 131 |
+
/**
|
| 132 |
+
* Process <subscribed> data list when importing members
|
| 133 |
+
*
|
| 134 |
+
* @param array $member
|
| 135 |
+
* @param integer $websiteId OPTIONAL
|
| 136 |
+
* @param bool $createCustomer
|
| 137 |
+
* @return void
|
| 138 |
+
*/
|
| 139 |
+
protected function subscribed($member, $websiteId = null, $createCustomer = FALSE)
|
| 140 |
+
{
|
| 141 |
+
|
| 142 |
+
$subscriber = $this->_getSubscriberObject($member['email']);
|
| 143 |
+
if( $createCustomer ){
|
| 144 |
+
$alreadyExist = false;
|
| 145 |
+
$websites = Mage::getModel('core/website')->getCollection()->getData();
|
| 146 |
+
foreach($websites as $website){
|
| 147 |
+
$customer = Mage::getModel('customer/customer')->setWebsiteId($website['website_id'])
|
| 148 |
+
->loadByEmail($member['email']);
|
| 149 |
+
if($customer->getId()){
|
| 150 |
+
$alreadyExist = true;
|
| 151 |
+
}
|
| 152 |
+
}
|
| 153 |
+
|
| 154 |
+
if($alreadyExist == false){
|
| 155 |
+
//Create customer if not exists, and subscribe
|
| 156 |
+
$customer = $this->_helper()->createCustomerAccount($member, $websiteId);
|
| 157 |
+
}
|
| 158 |
+
$subscriber
|
| 159 |
+
->setCustomerId($customer->getId())
|
| 160 |
+
->save();
|
| 161 |
+
}else{
|
| 162 |
+
//Just subscribe email
|
| 163 |
+
$subscriber->save();
|
| 164 |
+
}
|
| 165 |
+
|
| 166 |
+
}
|
| 167 |
+
|
| 168 |
+
/**
|
| 169 |
+
* Process <updated> data list when importing members
|
| 170 |
+
*
|
| 171 |
+
* @param array $member
|
| 172 |
+
* @param integer $websiteId OPTIONAL
|
| 173 |
+
* @param bool $createCustomer
|
| 174 |
+
* @return void
|
| 175 |
+
*/
|
| 176 |
+
protected function updated($member, $websiteId = null, $createCustomer = FALSE)
|
| 177 |
+
{
|
| 178 |
+
//TODO
|
| 179 |
+
}
|
| 180 |
+
|
| 181 |
+
/**
|
| 182 |
+
* Process <unsubscribed> data list when importing members
|
| 183 |
+
*
|
| 184 |
+
* @param array $member
|
| 185 |
+
* @param integer $websiteId OPTIONAL
|
| 186 |
+
* @param bool $createCustomer
|
| 187 |
+
* @return void
|
| 188 |
+
*/
|
| 189 |
+
protected function unsubscribed($member, $websiteId = null, $createCustomer = FALSE)
|
| 190 |
+
{
|
| 191 |
+
$this->_getSubscriberObject($member['email'], Mage_Newsletter_Model_Subscriber::STATUS_UNSUBSCRIBED)
|
| 192 |
+
->save();
|
| 193 |
+
}
|
| 194 |
+
|
| 195 |
+
/**
|
| 196 |
+
* Process <cleaned> data list when importing members
|
| 197 |
+
*
|
| 198 |
+
* @param array $member
|
| 199 |
+
* @param integer $websiteId OPTIONAL
|
| 200 |
+
* @param bool $createCustomer
|
| 201 |
+
* @return void
|
| 202 |
+
*/
|
| 203 |
+
protected function cleaned($member, $websiteId = null, $createCustomer = FALSE)
|
| 204 |
+
{
|
| 205 |
+
return $this->unsubscribed($member, $websiteId, $createCustomer);
|
| 206 |
+
}
|
| 207 |
+
|
| 208 |
+
|
| 209 |
+
|
| 210 |
+
/**
|
| 211 |
+
* Process EXPORT tasks
|
| 212 |
+
*
|
| 213 |
+
* @return Ebizmarts_MageMonkey_Model_Cron
|
| 214 |
+
*/
|
| 215 |
+
public function processExportJobs()
|
| 216 |
+
{
|
| 217 |
+
$this->_limit = (int)Mage::getStoreConfig("monkey/general/cron_export");
|
| 218 |
+
$job = $this->_getJob('Export');
|
| 219 |
+
if(is_null($job)){
|
| 220 |
+
return $this;
|
| 221 |
+
}
|
| 222 |
+
|
| 223 |
+
$collection = $this->_getEntityModel($job->getDataSourceEntity());
|
| 224 |
+
|
| 225 |
+
if(!$job->getStartedAt()){
|
| 226 |
+
$job->setStartedAt(Mage::getModel('core/date')->gmtDate())->save();
|
| 227 |
+
}
|
| 228 |
+
|
| 229 |
+
$collection->setPageSize($this->_limit);
|
| 230 |
+
|
| 231 |
+
//Condition for chunk batch
|
| 232 |
+
if($job->getLastProcessedId()){
|
| 233 |
+
$collection->addFieldToFilter($this->_getId($job->getDataSourceEntity()), array('gt' => (int)$job->getLastProcessedId()));
|
| 234 |
+
}
|
| 235 |
+
|
| 236 |
+
//Filter by STORE
|
| 237 |
+
$jobStoreId = (int)$job->getStoreId();
|
| 238 |
+
if($jobStoreId){
|
| 239 |
+
$collection->addFieldToFilter('store_id', $jobStoreId);
|
| 240 |
+
}
|
| 241 |
+
|
| 242 |
+
if($job->getDataSourceEntity() == 'newsletter_subscriber'):
|
| 243 |
+
$collection->addFieldToFilter('subscriber_status', Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED);
|
| 244 |
+
endif;
|
| 245 |
+
|
| 246 |
+
$collection->load();
|
| 247 |
+
|
| 248 |
+
//Update total count on first run
|
| 249 |
+
if(!$job->getTotalCount()){
|
| 250 |
+
$allRows = $collection->getSize();
|
| 251 |
+
$job->setTotalCount($allRows)->save();
|
| 252 |
+
}
|
| 253 |
+
|
| 254 |
+
$batch = array();
|
| 255 |
+
|
| 256 |
+
foreach($job->lists() as $listId){
|
| 257 |
+
$store = $this->_helper()->getStoreByList($listId);
|
| 258 |
+
$api = Mage::getSingleton('monkey/api', array('store' => $store));
|
| 259 |
+
|
| 260 |
+
$processedCount = 0;
|
| 261 |
+
foreach($collection as $item){
|
| 262 |
+
$processedCount += 1;
|
| 263 |
+
$batch []= $this->_helper()->getMergeVars($item, TRUE);
|
| 264 |
+
}
|
| 265 |
+
if(count($batch) > 0){
|
| 266 |
+
|
| 267 |
+
$job->setStatus('chunk_running')
|
| 268 |
+
->setUpdatedAt($this->_dbDate())
|
| 269 |
+
->save();
|
| 270 |
+
|
| 271 |
+
$vals = $api->listBatchSubscribe($listId, $batch, FALSE, TRUE, FALSE);
|
| 272 |
+
|
| 273 |
+
if ( is_null($api->errorCode) ){
|
| 274 |
+
|
| 275 |
+
$lastId = $collection->getLastItem()->getId();
|
| 276 |
+
$job->setLastProcessedId($lastId);
|
| 277 |
+
$job->setProcessedCount( ( $processedCount+$job->getProcessedCount() ));
|
| 278 |
+
|
| 279 |
+
/*if( $processedCount < $this->_limit ){
|
| 280 |
+
$job->setStatus('finished');
|
| 281 |
+
}*/
|
| 282 |
+
|
| 283 |
+
$job
|
| 284 |
+
->setUpdatedAt($this->_dbDate())
|
| 285 |
+
->save();
|
| 286 |
+
|
| 287 |
+
} else {
|
| 288 |
+
|
| 289 |
+
//TODO: Do something to handle errors
|
| 290 |
+
|
| 291 |
+
/*echo "Batch Subscribe failed!\n";
|
| 292 |
+
echo "code:".$api->errorCode."\n";
|
| 293 |
+
echo "msg :".$api->errorMessage."\n";
|
| 294 |
+
die;*/
|
| 295 |
+
/*echo "added: ".$vals['add_count']."\n";
|
| 296 |
+
echo "updated: ".$vals['update_count']."\n";
|
| 297 |
+
echo "errors: ".$vals['error_count']."\n";
|
| 298 |
+
foreach($vals['errors'] as $val){
|
| 299 |
+
echo $val['email_address']. " failed\n";
|
| 300 |
+
echo "code:".$val['code']."\n";
|
| 301 |
+
echo "msg :".$val['message']."\n";
|
| 302 |
+
}
|
| 303 |
+
die;*/
|
| 304 |
+
|
| 305 |
+
}
|
| 306 |
+
|
| 307 |
+
}else{
|
| 308 |
+
$job
|
| 309 |
+
->setStatus('finished')
|
| 310 |
+
->setUpdatedAt($this->_dbDate())
|
| 311 |
+
->save();
|
| 312 |
+
}
|
| 313 |
+
|
| 314 |
+
}
|
| 315 |
+
|
| 316 |
+
return $this;
|
| 317 |
+
}
|
| 318 |
+
|
| 319 |
+
/**
|
| 320 |
+
* Get collection object for given entity type
|
| 321 |
+
*
|
| 322 |
+
* @todo Add default Billing and Shipping address data
|
| 323 |
+
* @param string $type
|
| 324 |
+
* @return Mage_Newsletter_Model_Mysql4_Subscriber_Collection|Mage_Customer_Model_Entity_Customer_Collection
|
| 325 |
+
*/
|
| 326 |
+
protected function _getEntityModel($type)
|
| 327 |
+
{
|
| 328 |
+
$model = null;
|
| 329 |
+
|
| 330 |
+
switch ($type) {
|
| 331 |
+
case 'newsletter_subscriber':
|
| 332 |
+
$model = Mage::getResourceSingleton('newsletter/subscriber_collection')
|
| 333 |
+
//->showCustomerInfo(true)
|
| 334 |
+
->addSubscriberTypeField()
|
| 335 |
+
->showStoreInfo();
|
| 336 |
+
break;
|
| 337 |
+
case 'customer':
|
| 338 |
+
|
| 339 |
+
$model = Mage::getResourceModel('customer/customer_collection')
|
| 340 |
+
->addNameToSelect()
|
| 341 |
+
->addAttributeToSelect('gender')
|
| 342 |
+
->addAttributeToSelect('dob');
|
| 343 |
+
break;
|
| 344 |
+
}
|
| 345 |
+
|
| 346 |
+
return $model;
|
| 347 |
+
}
|
| 348 |
+
|
| 349 |
+
/**
|
| 350 |
+
* Return ID field name for given entity type
|
| 351 |
+
*
|
| 352 |
+
* @param string $type
|
| 353 |
+
* @return string
|
| 354 |
+
*/
|
| 355 |
+
protected function _getId($type)
|
| 356 |
+
{
|
| 357 |
+
$idFieldName = null;
|
| 358 |
+
|
| 359 |
+
switch ($type) {
|
| 360 |
+
case 'newsletter_subscriber':
|
| 361 |
+
$idFieldName = 'subscriber_id';
|
| 362 |
+
break;
|
| 363 |
+
default:
|
| 364 |
+
$idFieldName = 'entity_id';
|
| 365 |
+
}
|
| 366 |
+
|
| 367 |
+
return $idFieldName;
|
| 368 |
+
}
|
| 369 |
+
|
| 370 |
+
/**
|
| 371 |
+
* Get HELPER instance
|
| 372 |
+
*
|
| 373 |
+
* @param string $which
|
| 374 |
+
* @return object
|
| 375 |
+
*/
|
| 376 |
+
protected function _helper($which = 'data')
|
| 377 |
+
{
|
| 378 |
+
return Mage::helper('monkey/'.$which);
|
| 379 |
+
}
|
| 380 |
+
|
| 381 |
+
/**
|
| 382 |
+
* Return GMT date
|
| 383 |
+
*
|
| 384 |
+
* @return string
|
| 385 |
+
*/
|
| 386 |
+
protected function _dbDate()
|
| 387 |
+
{
|
| 388 |
+
return Mage::getModel('core/date')->gmtDate();
|
| 389 |
+
}
|
| 390 |
+
|
| 391 |
+
/**
|
| 392 |
+
* Get first job to process in queue
|
| 393 |
+
*
|
| 394 |
+
* @param string $entity
|
| 395 |
+
* @return null|Ebizmarts_MageMonkey_Model_BulksyncExport|Ebizmarts_MageMonkey_Model_BulksyncImport
|
| 396 |
+
*/
|
| 397 |
+
protected function _getJob($entity)
|
| 398 |
+
{
|
| 399 |
+
$job = Mage::getModel("monkey/bulksync{$entity}")
|
| 400 |
+
->getCollection()
|
| 401 |
+
->addFieldToFilter('status', array('IN' => array('idle', 'chunk_running') ))
|
| 402 |
+
->addOrder('created_at', 'asc')
|
| 403 |
+
->load();
|
| 404 |
+
if(!$job->getFirstItem()->getId()){
|
| 405 |
+
return null;
|
| 406 |
+
}
|
| 407 |
+
|
| 408 |
+
return $job->getFirstItem();
|
| 409 |
+
}
|
| 410 |
+
|
| 411 |
+
/** Send order to MailChimp Automatically by Order Status
|
| 412 |
+
*
|
| 413 |
+
*
|
| 414 |
+
*
|
| 415 |
+
*/
|
| 416 |
+
public function processAutoExportJobs()
|
| 417 |
+
{
|
| 418 |
+
if (Mage::helper('monkey')->config('ecommerce360') == 3 && Mage::getModel('monkey/ecommerce360')->isActive()){
|
| 419 |
+
Mage::getModel('monkey/ecommerce360')->autoExportJobs();
|
| 420 |
+
}
|
| 421 |
+
}
|
| 422 |
+
|
| 423 |
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
/**
|
| 5 |
+
* Custom collection class for nondb data
|
| 6 |
+
*
|
| 7 |
+
* @category Ebizmarts
|
| 8 |
+
* @package Ebizmarts_MageMonkey
|
| 9 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 10 |
+
*/
|
| 11 |
+
class Ebizmarts_MageMonkey_Model_Custom_Collection
|
| 12 |
+
extends Varien_Data_Collection
|
| 13 |
+
{
|
| 14 |
+
|
| 15 |
+
/**
|
| 16 |
+
* Contains generic data to load on load() method
|
| 17 |
+
*
|
| 18 |
+
* @var mixed
|
| 19 |
+
*/
|
| 20 |
+
protected $_toload = NULL;
|
| 21 |
+
|
| 22 |
+
/**
|
| 23 |
+
* Initialize data to be loaded afterwards
|
| 24 |
+
*
|
| 25 |
+
* @param array $data
|
| 26 |
+
* @return Varien_Data_Collection
|
| 27 |
+
*/
|
| 28 |
+
public function __construct(array $data)
|
| 29 |
+
{
|
| 30 |
+
$data = current($data);
|
| 31 |
+
|
| 32 |
+
if( empty($data) ){
|
| 33 |
+
return parent::__construct();
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
$this->_toload = $data;
|
| 37 |
+
|
| 38 |
+
return parent::__construct();
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
/**
|
| 42 |
+
* Load data into object
|
| 43 |
+
*
|
| 44 |
+
* @param bool $printQuery
|
| 45 |
+
* @param bool $logQuery
|
| 46 |
+
* @return Ebizmarts_MageMonkey_Model_Custom_Collection
|
| 47 |
+
*/
|
| 48 |
+
public function load($printQuery = false, $logQuery = false)
|
| 49 |
+
{
|
| 50 |
+
if($this->isLoaded() || is_null($this->_toload)){
|
| 51 |
+
return $this;
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
foreach ($this->_toload as $row) {
|
| 55 |
+
$item = new Varien_Object;
|
| 56 |
+
$item->addData($row);
|
| 57 |
+
$this->addItem($item);
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
$this->_setIsLoaded();
|
| 61 |
+
|
| 62 |
+
return $this;
|
| 63 |
+
}
|
| 64 |
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Ecommerce360 db access model
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_MageMonkey
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_MageMonkey_Model_Ecommerce extends Mage_Core_Model_Abstract
|
| 11 |
+
{
|
| 12 |
+
/**
|
| 13 |
+
* Initialize model
|
| 14 |
+
*
|
| 15 |
+
* @return void
|
| 16 |
+
*/
|
| 17 |
+
public function _construct()
|
| 18 |
+
{
|
| 19 |
+
parent::_construct();
|
| 20 |
+
$this->_init('monkey/ecommerce');
|
| 21 |
+
}
|
| 22 |
+
}
|
|
@@ -0,0 +1,316 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Ecommerce360 main model
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_MageMonkey
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_MageMonkey_Model_Ecommerce360
|
| 11 |
+
{
|
| 12 |
+
|
| 13 |
+
/**
|
| 14 |
+
* Order information to send to MC
|
| 15 |
+
*
|
| 16 |
+
* @var array
|
| 17 |
+
* @access protected
|
| 18 |
+
*/
|
| 19 |
+
protected $_info = array();
|
| 20 |
+
|
| 21 |
+
/**
|
| 22 |
+
* @var integer
|
| 23 |
+
* @access protected
|
| 24 |
+
*/
|
| 25 |
+
protected $_auxPrice = 0;
|
| 26 |
+
|
| 27 |
+
/**
|
| 28 |
+
* Current order
|
| 29 |
+
*
|
| 30 |
+
* @var Mage_Sales_Model_Order
|
| 31 |
+
* @access protected
|
| 32 |
+
*/
|
| 33 |
+
protected $_order;
|
| 34 |
+
|
| 35 |
+
/**
|
| 36 |
+
* Skip products list
|
| 37 |
+
*
|
| 38 |
+
* @var array
|
| 39 |
+
* @access protected
|
| 40 |
+
*/
|
| 41 |
+
protected $_productsToSkip = array(Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE, Mage_Catalog_Model_Product_Type::TYPE_BUNDLE);
|
| 42 |
+
|
| 43 |
+
/**
|
| 44 |
+
* Retrieve Cookie Object
|
| 45 |
+
*
|
| 46 |
+
* @return Mage_Core_Model_Cookie
|
| 47 |
+
*/
|
| 48 |
+
public function getCookie()
|
| 49 |
+
{
|
| 50 |
+
return Mage::app()->getCookie();
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
/**
|
| 54 |
+
* Check if Ecommerce360 integration is enabled per configuration settings
|
| 55 |
+
*
|
| 56 |
+
* @return bool
|
| 57 |
+
*/
|
| 58 |
+
public function isActive()
|
| 59 |
+
{
|
| 60 |
+
return Mage::helper('monkey')->ecommerce360Active();
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
/**
|
| 64 |
+
* Add cookie to customer's session
|
| 65 |
+
*
|
| 66 |
+
* @param Varien_Event_Observer $observer
|
| 67 |
+
* @return Varien_Event_Observer
|
| 68 |
+
*/
|
| 69 |
+
public function saveCookie(Varien_Event_Observer $observer)
|
| 70 |
+
{
|
| 71 |
+
if( $this->isActive() ){
|
| 72 |
+
$request = Mage::app()->getRequest();
|
| 73 |
+
|
| 74 |
+
$thirty_days = time()+60*60*24*30;
|
| 75 |
+
if ( $request->getParam('mc_cid') ){
|
| 76 |
+
$this->getCookie()->set('magemonkey_campaign_id', $request->getParam('mc_cid'), $thirty_days);
|
| 77 |
+
}
|
| 78 |
+
if ( $request->getParam('mc_eid') ){
|
| 79 |
+
$this->getCookie()->set('magemonkey_email_id', $request->getParam('mc_eid'), $thirty_days);
|
| 80 |
+
}
|
| 81 |
+
}
|
| 82 |
+
return $observer;
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
/**
|
| 86 |
+
* Process data and send order to MC
|
| 87 |
+
*
|
| 88 |
+
* @param Varien_Event_Observer $observer
|
| 89 |
+
* @return Varien_Event_Observer
|
| 90 |
+
*/
|
| 91 |
+
public function run(Varien_Event_Observer $observer)
|
| 92 |
+
{
|
| 93 |
+
$order = $observer->getEvent()->getOrder();
|
| 94 |
+
if ( ( ($this->_getCampaignCookie() &&
|
| 95 |
+
$this->_getEmailCookie()) || Mage::helper('monkey')->config('ecommerce360') == 2 ) &&
|
| 96 |
+
$this->isActive() ){
|
| 97 |
+
$this->logSale($order);
|
| 98 |
+
}
|
| 99 |
+
return $observer;
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
/**
|
| 103 |
+
* Send order to MailChimp
|
| 104 |
+
*
|
| 105 |
+
* @param Mage_Sales_Model_Order $order
|
| 106 |
+
* @return bool|array
|
| 107 |
+
*/
|
| 108 |
+
public function logSale($order)
|
| 109 |
+
{
|
| 110 |
+
|
| 111 |
+
$this->_order = $order;
|
| 112 |
+
$api = Mage::getSingleton('monkey/api', array('store' => $this->_order->getStoreId()));
|
| 113 |
+
if(!$api){
|
| 114 |
+
return false;
|
| 115 |
+
}
|
| 116 |
+
|
| 117 |
+
$subtotal = $this->_order->getSubtotal();
|
| 118 |
+
$discount = (float)$this->_order->getDiscountAmount();
|
| 119 |
+
if ($discount != 0) {
|
| 120 |
+
$subtotal = $subtotal + ($discount);
|
| 121 |
+
}
|
| 122 |
+
|
| 123 |
+
$this->_info = array(
|
| 124 |
+
'id' => $this->_order->getIncrementId(),
|
| 125 |
+
'total' => $subtotal,
|
| 126 |
+
'shipping' => $this->_order->getShippingAmount(),
|
| 127 |
+
'tax' => $this->_order->getTaxAmount(),
|
| 128 |
+
'store_id' => $this->_order->getStoreId(),
|
| 129 |
+
'store_name' => $this->_order->getStoreName(),
|
| 130 |
+
'plugin_id' => 1215,
|
| 131 |
+
'items' => array()
|
| 132 |
+
);
|
| 133 |
+
|
| 134 |
+
$emailCookie = $this->_getEmailCookie();
|
| 135 |
+
$campaignCookie = $this->_getCampaignCookie();
|
| 136 |
+
|
| 137 |
+
$this->setItemstoSend();
|
| 138 |
+
|
| 139 |
+
if($emailCookie && $campaignCookie){
|
| 140 |
+
$this->_info ['email_id']= $emailCookie;
|
| 141 |
+
$this->_info ['campaign_id']= $campaignCookie;
|
| 142 |
+
|
| 143 |
+
//Send order to MailChimp
|
| 144 |
+
$rs = $api->campaignEcommOrderAdd($this->_info);
|
| 145 |
+
}else{
|
| 146 |
+
$this->_info ['email']= $this->_order->getCustomerEmail();
|
| 147 |
+
$rs = $api->ecommOrderAdd($this->_info);
|
| 148 |
+
}
|
| 149 |
+
|
| 150 |
+
if ( $rs === TRUE ){
|
| 151 |
+
$this->_logCall();
|
| 152 |
+
return true;
|
| 153 |
+
}else{
|
| 154 |
+
return $rs;
|
| 155 |
+
}
|
| 156 |
+
|
| 157 |
+
}
|
| 158 |
+
|
| 159 |
+
/**
|
| 160 |
+
* Process order items to send to MailChimp
|
| 161 |
+
*
|
| 162 |
+
* @access private
|
| 163 |
+
* @return Ebizmarts_MageMonkey_Model_Ecommerce360
|
| 164 |
+
*/
|
| 165 |
+
private function setItemstoSend()
|
| 166 |
+
{
|
| 167 |
+
foreach ($this->_order->getAllItems() as $item){
|
| 168 |
+
$mcitem = array();
|
| 169 |
+
$product = Mage::getSingleton('catalog/product')->load($item->getProductId());
|
| 170 |
+
|
| 171 |
+
if(in_array($product->getTypeId(), $this->_productsToSkip) && $product->getPriceType() == 0){
|
| 172 |
+
if($product->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE){
|
| 173 |
+
$this->_auxPrice = $item->getPrice();
|
| 174 |
+
}
|
| 175 |
+
continue;
|
| 176 |
+
}
|
| 177 |
+
|
| 178 |
+
$mcitem['product_id'] = $product->getEntityId();
|
| 179 |
+
$mcitem['sku'] = $product->getSku();
|
| 180 |
+
$mcitem['product_name'] = $product->getName();
|
| 181 |
+
|
| 182 |
+
$names = array();
|
| 183 |
+
$cat_ids = $product->getCategoryIds();
|
| 184 |
+
|
| 185 |
+
if (is_array($cat_ids) && count($cat_ids)>0){
|
| 186 |
+
$category = Mage::getModel('catalog/category')->load($cat_ids[0]);
|
| 187 |
+
$mcitem['category_id'] = $cat_ids[0];
|
| 188 |
+
$names[] = $category->getName();
|
| 189 |
+
while ($category->getParentId() && $category->getParentId()!=1){
|
| 190 |
+
$category = Mage::getModel('catalog/category')->load($category->getParentId());
|
| 191 |
+
$names[] = $category->getName();
|
| 192 |
+
}
|
| 193 |
+
}
|
| 194 |
+
if(!isset($mcitem['category_id'])) {
|
| 195 |
+
$mcitem['category_id'] = 0;
|
| 196 |
+
}
|
| 197 |
+
$mcitem['category_name'] = (count($names))? implode(" - ",array_reverse($names)) : 'None';
|
| 198 |
+
$mcitem['qty'] = $item->getQtyOrdered();
|
| 199 |
+
$mcitem['cost'] = ($this->_auxPrice > 0)? $this->_auxPrice : $item->getPrice();
|
| 200 |
+
$this->_info['items'][] = $mcitem;
|
| 201 |
+
$this->_auxPrice = 0;
|
| 202 |
+
}
|
| 203 |
+
|
| 204 |
+
return $this;
|
| 205 |
+
}
|
| 206 |
+
|
| 207 |
+
/**
|
| 208 |
+
* Get cookie <magemonkey_email_id> from customer's session
|
| 209 |
+
*
|
| 210 |
+
* @return string|null
|
| 211 |
+
*/
|
| 212 |
+
protected function _getEmailCookie()
|
| 213 |
+
{
|
| 214 |
+
return $this->getCookie()->get('magemonkey_email_id');
|
| 215 |
+
}
|
| 216 |
+
|
| 217 |
+
/**
|
| 218 |
+
* Get cookie <magemonkey_campaign_id> from customer's session
|
| 219 |
+
*
|
| 220 |
+
* @return string|null
|
| 221 |
+
*/
|
| 222 |
+
protected function _getCampaignCookie()
|
| 223 |
+
{
|
| 224 |
+
return $this->getCookie()->get('magemonkey_campaign_id');
|
| 225 |
+
}
|
| 226 |
+
|
| 227 |
+
/**
|
| 228 |
+
* Save Api Call on db
|
| 229 |
+
*
|
| 230 |
+
* @return Ebizmarts_MageMonkey_Model_Ecommerce
|
| 231 |
+
*/
|
| 232 |
+
protected function _logCall()
|
| 233 |
+
{
|
| 234 |
+
return Mage::getModel('monkey/ecommerce')
|
| 235 |
+
->setOrderIncrementId($this->_order->getIncrementId())
|
| 236 |
+
->setOrderId($this->_order->getId())
|
| 237 |
+
->setMcCampaignId($this->_getCampaignCookie())
|
| 238 |
+
->setMcEmailId($this->_getEmailCookie())
|
| 239 |
+
->setCreatedAt( Mage::getModel('core/date')->gmtDate() )
|
| 240 |
+
->save();
|
| 241 |
+
}
|
| 242 |
+
|
| 243 |
+
/** Send order to MailChimp Automatically by Order Status
|
| 244 |
+
*
|
| 245 |
+
*
|
| 246 |
+
*/
|
| 247 |
+
public function autoExportJobs(){
|
| 248 |
+
$allow_sent = false;
|
| 249 |
+
$orderIds[] = '0';
|
| 250 |
+
$ecommerceOrders = Mage::getModel('monkey/ecommerce')
|
| 251 |
+
->getCollection()->getData();
|
| 252 |
+
if($ecommerceOrders) {
|
| 253 |
+
foreach($ecommerceOrders as $ecommerceOrder){
|
| 254 |
+
$orderIds[] = $ecommerceOrder['order_id'];
|
| 255 |
+
}
|
| 256 |
+
}
|
| 257 |
+
$orders = Mage::getResourceModel('sales/order_collection');
|
| 258 |
+
//Get ALL orders which has not been sent to MailChimp
|
| 259 |
+
$orders->getSelect()->where('main_table.entity_id NOT IN(?)', $orderIds);
|
| 260 |
+
//Get status options selected in the Configuration
|
| 261 |
+
$states = explode(',', Mage::helper('monkey')->config('order_status'));
|
| 262 |
+
foreach($orders as $order){
|
| 263 |
+
foreach($states as $state){
|
| 264 |
+
if($order->getStatus() == $state || $state == 'all_status'){
|
| 265 |
+
$allow_sent = true;
|
| 266 |
+
}
|
| 267 |
+
}
|
| 268 |
+
|
| 269 |
+
if($allow_sent == true){
|
| 270 |
+
$this->_order = $order;
|
| 271 |
+
$api = Mage::getSingleton('monkey/api', array('store' => $this->_order->getStoreId()));
|
| 272 |
+
if(!$api){
|
| 273 |
+
return false;
|
| 274 |
+
}
|
| 275 |
+
|
| 276 |
+
$subtotal = $this->_order->getSubtotal();
|
| 277 |
+
$discount = (float)$this->_order->getDiscountAmount();
|
| 278 |
+
if ($discount != 0) {
|
| 279 |
+
$subtotal = $subtotal + ($discount);
|
| 280 |
+
}
|
| 281 |
+
|
| 282 |
+
$this->_info = array(
|
| 283 |
+
'id' => $this->_order->getIncrementId(),
|
| 284 |
+
'total' => $subtotal,
|
| 285 |
+
'shipping' => $this->_order->getShippingAmount(),
|
| 286 |
+
'tax' => $this->_order->getTaxAmount(),
|
| 287 |
+
'store_id' => $this->_order->getStoreId(),
|
| 288 |
+
'store_name' => $this->_order->getStoreName(),
|
| 289 |
+
'plugin_id' => 1215,
|
| 290 |
+
'items' => array()
|
| 291 |
+
);
|
| 292 |
+
|
| 293 |
+
$email = $this->_order->getCustomerEmail();
|
| 294 |
+
$campaign = $this->_order->getEbizmartsMagemonkeyCampaignId();
|
| 295 |
+
$this->setItemstoSend();
|
| 296 |
+
|
| 297 |
+
if($email && $campaign){
|
| 298 |
+
$this->_info ['email_id']= $email;
|
| 299 |
+
$this->_info ['campaign_id']= $campaign;
|
| 300 |
+
|
| 301 |
+
//Send order to MailChimp
|
| 302 |
+
$rs = $api->campaignEcommOrderAdd($this->_info);
|
| 303 |
+
}else{
|
| 304 |
+
$this->_info ['email']= $email;
|
| 305 |
+
$rs = $api->ecommOrderAdd($this->_info);
|
| 306 |
+
}
|
| 307 |
+
$allow_sent = false;
|
| 308 |
+
if ( $rs === TRUE ){
|
| 309 |
+
$this->_logCall();
|
| 310 |
+
}
|
| 311 |
+
}
|
| 312 |
+
|
| 313 |
+
}
|
| 314 |
+
}
|
| 315 |
+
|
| 316 |
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Mage_Core_Model_Email_Template rewrite class
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_MageMonkey
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_MageMonkey_Model_Email_Template extends Mage_Core_Model_Email_Template
|
| 11 |
+
{
|
| 12 |
+
|
| 13 |
+
/**
|
| 14 |
+
* Send mail to recipient
|
| 15 |
+
*
|
| 16 |
+
* @param array|string $email E-mail(s)
|
| 17 |
+
* @param array|string|null $name receiver name(s)
|
| 18 |
+
* @param array $variables template variables
|
| 19 |
+
* @return boolean
|
| 20 |
+
**/
|
| 21 |
+
public function send($email, $name = null, array $variables = array())
|
| 22 |
+
{
|
| 23 |
+
|
| 24 |
+
//Check if should use MC Transactional Email Service
|
| 25 |
+
if(FALSE === Mage::helper('monkey')->useTransactionalService()){
|
| 26 |
+
return parent::send($email, $name, $variables);
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
if (!$this->isValidForSend()) {
|
| 30 |
+
Mage::logException(new Exception('This letter cannot be sent.')); // translation is intentionally omitted
|
| 31 |
+
return false;
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
$emails = array_values((array)$email);
|
| 35 |
+
$names = is_array($name) ? $name : (array)$name;
|
| 36 |
+
$names = array_values($names);
|
| 37 |
+
foreach ($emails as $key => $email) {
|
| 38 |
+
if (!isset($names[$key])) {
|
| 39 |
+
$names[$key] = substr($email, 0, strpos($email, '@'));
|
| 40 |
+
}
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
$variables['email'] = reset($emails);
|
| 44 |
+
$variables['name'] = reset($names);
|
| 45 |
+
|
| 46 |
+
ini_set('SMTP', Mage::getStoreConfig('system/smtp/host'));
|
| 47 |
+
ini_set('smtp_port', Mage::getStoreConfig('system/smtp/port'));
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
$service = Mage::helper('monkey')->config('transactional_emails');
|
| 51 |
+
$apiKey = Mage::helper('monkey')->getApiKey($this->getDesignConfig()->getStore());
|
| 52 |
+
if('mandrill' == $service){
|
| 53 |
+
$apiKey = Mage::helper('monkey')->getMandrillApiKey($this->getDesignConfig()->getStore());
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
$mail = Ebizmarts_MageMonkey_Model_TransactionalEmail_Adapter::factory($service);
|
| 57 |
+
$mail->setApiKey($apiKey);
|
| 58 |
+
|
| 59 |
+
$this->setUseAbsoluteLinks(true);
|
| 60 |
+
$text = $this->getProcessedTemplate($variables, true);
|
| 61 |
+
|
| 62 |
+
try {
|
| 63 |
+
|
| 64 |
+
$message = array (
|
| 65 |
+
'html' => $text,
|
| 66 |
+
'text' => $text,
|
| 67 |
+
'subject' => ('=?utf-8?B?' . base64_encode($this->getProcessedTemplateSubject($variables)) . '?='),
|
| 68 |
+
'from_name' => $this->getSenderName(),
|
| 69 |
+
'from_email' => $this->getSenderEmail(),
|
| 70 |
+
'to_email' => $emails,
|
| 71 |
+
'to_name' => $names
|
| 72 |
+
);
|
| 73 |
+
|
| 74 |
+
$sent = $mail->sendEmail($message);
|
| 75 |
+
if($mail->errorCode){
|
| 76 |
+
return false;
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
}catch (Exception $e) {
|
| 80 |
+
Mage::logException($e);
|
| 81 |
+
return false;
|
| 82 |
+
}
|
| 83 |
+
|
| 84 |
+
return true;
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Feed updates model
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_MageMonkey
|
| 8 |
+
* @author Ebizmarts <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_MageMonkey_Model_Feed_Updates {
|
| 11 |
+
|
| 12 |
+
private $_key = 'monkey';
|
| 13 |
+
private $_resources = array('Ebizmarts_MageMonkey', 'Ebizmarts_Global');
|
| 14 |
+
|
| 15 |
+
/**
|
| 16 |
+
* Retrieve feed data as XML element
|
| 17 |
+
*
|
| 18 |
+
* @return SimpleXMLElement
|
| 19 |
+
*/
|
| 20 |
+
public function getFeedData($uri) {
|
| 21 |
+
$curl = new Varien_Http_Adapter_Curl;
|
| 22 |
+
$curl->setConfig(array(
|
| 23 |
+
'timeout' => 30
|
| 24 |
+
));
|
| 25 |
+
$curl->write(Zend_Http_Client::GET, $uri, '1.0');
|
| 26 |
+
$data = $curl->read();
|
| 27 |
+
if ($data === false) {
|
| 28 |
+
return false;
|
| 29 |
+
}
|
| 30 |
+
$data = preg_split('/^\r?$/m', $data, 2);
|
| 31 |
+
$data = trim($data[1]);
|
| 32 |
+
$curl->close();
|
| 33 |
+
|
| 34 |
+
try {
|
| 35 |
+
$xml = new SimpleXMLElement($data);
|
| 36 |
+
} catch (Exception $e) {
|
| 37 |
+
Mage::logException($e);
|
| 38 |
+
return false;
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
return $xml;
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
public function getConfig($key) {
|
| 45 |
+
return Mage::getStoreConfig($this->_key . '/notifications/' . $key);
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
/**
|
| 49 |
+
* Retrieve DB date from RSS date
|
| 50 |
+
*
|
| 51 |
+
* @param string $rssDate
|
| 52 |
+
* @return string YYYY-MM-DD YY:HH:SS
|
| 53 |
+
*/
|
| 54 |
+
public function getDate($rssDate) {
|
| 55 |
+
return gmdate('Y-m-d H:i:s', strtotime($rssDate));
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
/**
|
| 59 |
+
* Retrieve feed url
|
| 60 |
+
*
|
| 61 |
+
* @return string
|
| 62 |
+
*/
|
| 63 |
+
public function getFeedUrl() {
|
| 64 |
+
return $this->getConfig('updates_url');
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
public function getLastUpdate($resource) {
|
| 68 |
+
return Mage::app()->loadCache($this->_key . $resource . '_updates_feed_lastcheck');
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
/**
|
| 73 |
+
* Checks feed
|
| 74 |
+
* @return
|
| 75 |
+
*/
|
| 76 |
+
public function check() {
|
| 77 |
+
|
| 78 |
+
if (!Mage::getSingleton('admin/session')->isLoggedIn()) {
|
| 79 |
+
return $this;
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
foreach($this->_resources as $resource) {
|
| 83 |
+
|
| 84 |
+
if(((int)$this->getConfig('check_frequency')) + $this->getLastUpdate($resource) < time()) {
|
| 85 |
+
$this->_getUpdates($resource);
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
}
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
protected function _getUpdates($resource) {
|
| 92 |
+
$feedData = array();
|
| 93 |
+
|
| 94 |
+
try {
|
| 95 |
+
|
| 96 |
+
$node = $this->getFeedData($this->getFeedUrl() . "{$resource}.xml");
|
| 97 |
+
|
| 98 |
+
if (!$node) {
|
| 99 |
+
Mage::app()->saveCache(time(), $this->_key . $resource . '_updates_feed_lastcheck');
|
| 100 |
+
return false;
|
| 101 |
+
}
|
| 102 |
+
|
| 103 |
+
foreach ($node->xpath('items/item') as $item) {
|
| 104 |
+
|
| 105 |
+
$feedData[] = array(
|
| 106 |
+
'severity' => (string) $item->severity,
|
| 107 |
+
'date_added' => (string) $item->created_at,
|
| 108 |
+
'title' => (string) $item->title,
|
| 109 |
+
'description' => (string) $item->description,
|
| 110 |
+
'url' => (string) $item->url,
|
| 111 |
+
);
|
| 112 |
+
}
|
| 113 |
+
|
| 114 |
+
if (count($feedData)) {
|
| 115 |
+
Mage::getModel('adminnotification/inbox')->parse($feedData);
|
| 116 |
+
}
|
| 117 |
+
|
| 118 |
+
Mage::app()->saveCache(time(), $this->_key . $resource . '_updates_feed_lastcheck');
|
| 119 |
+
|
| 120 |
+
return true;
|
| 121 |
+
} catch (Exception $e) {
|
| 122 |
+
Mage::logException($e);
|
| 123 |
+
return false;
|
| 124 |
+
}
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
}
|
|
@@ -0,0 +1,2499 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* MailChimp API wrapper
|
| 5 |
+
*
|
| 6 |
+
*/
|
| 7 |
+
class Ebizmarts_MageMonkey_Model_MCAPI
|
| 8 |
+
{
|
| 9 |
+
var $version = "1.3";
|
| 10 |
+
var $errorMessage;
|
| 11 |
+
var $errorCode;
|
| 12 |
+
|
| 13 |
+
/**
|
| 14 |
+
* Cache the information on the API location on the server
|
| 15 |
+
*/
|
| 16 |
+
var $apiUrl;
|
| 17 |
+
|
| 18 |
+
/**
|
| 19 |
+
* Default to a 300 second timeout on server calls
|
| 20 |
+
*/
|
| 21 |
+
var $timeout = 300;
|
| 22 |
+
|
| 23 |
+
/**
|
| 24 |
+
* Default to a 8K chunk size
|
| 25 |
+
*/
|
| 26 |
+
var $chunkSize = 8192;
|
| 27 |
+
|
| 28 |
+
/**
|
| 29 |
+
* Cache the user api_key so we only have to log in once per client instantiation
|
| 30 |
+
*/
|
| 31 |
+
var $api_key;
|
| 32 |
+
|
| 33 |
+
/**
|
| 34 |
+
* Use Secure connection or not
|
| 35 |
+
*
|
| 36 |
+
* @var bool
|
| 37 |
+
*/
|
| 38 |
+
var $secure = false;
|
| 39 |
+
|
| 40 |
+
/**
|
| 41 |
+
* @var array Request params storage
|
| 42 |
+
*/
|
| 43 |
+
public $requestParams = array();
|
| 44 |
+
|
| 45 |
+
/**
|
| 46 |
+
* Connect to the MailChimp API for a given list.
|
| 47 |
+
*
|
| 48 |
+
* @param string $apikey Your MailChimp apikey
|
| 49 |
+
* @param string $secure Whether or not this should use a secure connection
|
| 50 |
+
*/
|
| 51 |
+
function __construct($apikey, $secure=false) {
|
| 52 |
+
$this->secure = $secure;
|
| 53 |
+
$this->apiUrl = parse_url("http://api.mailchimp.com/" . $this->version . "/?output=php");
|
| 54 |
+
$this->api_key = $apikey;
|
| 55 |
+
}
|
| 56 |
+
function setTimeout($seconds){
|
| 57 |
+
if (is_int($seconds)){
|
| 58 |
+
$this->timeout = $seconds;
|
| 59 |
+
return true;
|
| 60 |
+
}
|
| 61 |
+
}
|
| 62 |
+
function getTimeout(){
|
| 63 |
+
return $this->timeout;
|
| 64 |
+
}
|
| 65 |
+
function useSecure($val){
|
| 66 |
+
if ($val===true){
|
| 67 |
+
$this->secure = true;
|
| 68 |
+
} else {
|
| 69 |
+
$this->secure = false;
|
| 70 |
+
}
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
/**
|
| 74 |
+
* Unschedule a campaign that is scheduled to be sent in the future
|
| 75 |
+
*
|
| 76 |
+
* @section Campaign Related
|
| 77 |
+
* @example mcapi_campaignUnschedule.php
|
| 78 |
+
* @example xml-rpc_campaignUnschedule.php
|
| 79 |
+
*
|
| 80 |
+
* @param string $cid the id of the campaign to unschedule
|
| 81 |
+
* @return boolean true on success
|
| 82 |
+
*/
|
| 83 |
+
function campaignUnschedule($cid) {
|
| 84 |
+
$params = array();
|
| 85 |
+
$params["cid"] = $cid;
|
| 86 |
+
return $this->callServer("campaignUnschedule", $params);
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
/**
|
| 90 |
+
* Schedule a campaign to be sent in the future
|
| 91 |
+
*
|
| 92 |
+
* @section Campaign Related
|
| 93 |
+
* @example mcapi_campaignSchedule.php
|
| 94 |
+
* @example xml-rpc_campaignSchedule.php
|
| 95 |
+
*
|
| 96 |
+
* @param string $cid the id of the campaign to schedule
|
| 97 |
+
* @param string $schedule_time the time to schedule the campaign. For A/B Split "schedule" campaigns, the time for Group A - in YYYY-MM-DD HH:II:SS format in <strong>GMT</strong>
|
| 98 |
+
* @param string $schedule_time_b optional -the time to schedule Group B of an A/B Split "schedule" campaign - in YYYY-MM-DD HH:II:SS format in <strong>GMT</strong>
|
| 99 |
+
* @return boolean true on success
|
| 100 |
+
*/
|
| 101 |
+
function campaignSchedule($cid, $schedule_time, $schedule_time_b=NULL) {
|
| 102 |
+
$params = array();
|
| 103 |
+
$params["cid"] = $cid;
|
| 104 |
+
$params["schedule_time"] = $schedule_time;
|
| 105 |
+
$params["schedule_time_b"] = $schedule_time_b;
|
| 106 |
+
return $this->callServer("campaignSchedule", $params);
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
/**
|
| 110 |
+
* Resume sending an AutoResponder or RSS campaign
|
| 111 |
+
*
|
| 112 |
+
* @section Campaign Related
|
| 113 |
+
*
|
| 114 |
+
* @param string $cid the id of the campaign to pause
|
| 115 |
+
* @return boolean true on success
|
| 116 |
+
*/
|
| 117 |
+
function campaignResume($cid) {
|
| 118 |
+
$params = array();
|
| 119 |
+
$params["cid"] = $cid;
|
| 120 |
+
return $this->callServer("campaignResume", $params);
|
| 121 |
+
}
|
| 122 |
+
|
| 123 |
+
/**
|
| 124 |
+
* Pause an AutoResponder orRSS campaign from sending
|
| 125 |
+
*
|
| 126 |
+
* @section Campaign Related
|
| 127 |
+
*
|
| 128 |
+
* @param string $cid the id of the campaign to pause
|
| 129 |
+
* @return boolean true on success
|
| 130 |
+
*/
|
| 131 |
+
function campaignPause($cid) {
|
| 132 |
+
$params = array();
|
| 133 |
+
$params["cid"] = $cid;
|
| 134 |
+
return $this->callServer("campaignPause", $params);
|
| 135 |
+
}
|
| 136 |
+
|
| 137 |
+
/**
|
| 138 |
+
* Send a given campaign immediately. For RSS campaigns, this will "start" them.
|
| 139 |
+
*
|
| 140 |
+
* @section Campaign Related
|
| 141 |
+
*
|
| 142 |
+
* @example mcapi_campaignSendNow.php
|
| 143 |
+
* @example xml-rpc_campaignSendNow.php
|
| 144 |
+
*
|
| 145 |
+
* @param string $cid the id of the campaign to send
|
| 146 |
+
* @return boolean true on success
|
| 147 |
+
*/
|
| 148 |
+
function campaignSendNow($cid) {
|
| 149 |
+
$params = array();
|
| 150 |
+
$params["cid"] = $cid;
|
| 151 |
+
return $this->callServer("campaignSendNow", $params);
|
| 152 |
+
}
|
| 153 |
+
|
| 154 |
+
/**
|
| 155 |
+
* Send a test of this campaign to the provided email address
|
| 156 |
+
*
|
| 157 |
+
* @section Campaign Related
|
| 158 |
+
*
|
| 159 |
+
* @example mcapi_campaignSendTest.php
|
| 160 |
+
* @example xml-rpc_campaignSendTest.php
|
| 161 |
+
*
|
| 162 |
+
* @param string $cid the id of the campaign to test
|
| 163 |
+
* @param array $test_emails an array of email address to receive the test message
|
| 164 |
+
* @param string $send_type optional by default (null) both formats are sent - "html" or "text" send just that format
|
| 165 |
+
* @return boolean true on success
|
| 166 |
+
*/
|
| 167 |
+
function campaignSendTest($cid, $test_emails=array (
|
| 168 |
+
), $send_type=NULL) {
|
| 169 |
+
$params = array();
|
| 170 |
+
$params["cid"] = $cid;
|
| 171 |
+
$params["test_emails"] = $test_emails;
|
| 172 |
+
$params["send_type"] = $send_type;
|
| 173 |
+
return $this->callServer("campaignSendTest", $params);
|
| 174 |
+
}
|
| 175 |
+
|
| 176 |
+
/**
|
| 177 |
+
* Allows one to test their segmentation rules before creating a campaign using them
|
| 178 |
+
*
|
| 179 |
+
* @section Campaign Related
|
| 180 |
+
* @example mcapi_campaignSegmentTest.php
|
| 181 |
+
* @example xml-rpc_campaignSegmentTest.php
|
| 182 |
+
*
|
| 183 |
+
* @param string $list_id the list to test segmentation on - get lists using lists()
|
| 184 |
+
* @param array $options with 2 keys:
|
| 185 |
+
string "match" controls whether to use AND or OR when applying your options - expects "<strong>any</strong>" (for OR) or "<strong>all</strong>" (for AND)
|
| 186 |
+
array "conditions" - up to 10 different criteria to apply while segmenting. Each criteria row must contain 3 keys - "<strong>field</strong>", "<strong>op</strong>", and "<strong>value</strong>" - and possibly a fourth, "<strong>extra</strong>", based on these definitions:
|
| 187 |
+
|
| 188 |
+
Field = "<strong>date</strong>" : Select based on signup date
|
| 189 |
+
Valid Op(eration): <strong>eq</strong> (is) / <strong>gt</strong> (after) / <strong>lt</strong> (before)
|
| 190 |
+
Valid Values:
|
| 191 |
+
string last_campaign_sent uses the date of the last campaign sent
|
| 192 |
+
string campaign_id - uses the send date of the campaign that carriers the Id submitted - see campaigns()
|
| 193 |
+
string YYYY-MM-DD - any date in the form of YYYY-MM-DD - <em>note:</em> anything that appears to start with YYYY will be treated as a date
|
| 194 |
+
|
| 195 |
+
Field = "<strong>interests-X</strong>": where X is the Grouping Id from listInterestGroupings()
|
| 196 |
+
Valid Op(erations): <strong>one</strong> / <strong>none</strong> / <strong>all</strong>
|
| 197 |
+
Valid Values: a comma delimited of interest groups for the list - see listInterestGroupings()
|
| 198 |
+
|
| 199 |
+
Field = "<strong>aim</strong>"
|
| 200 |
+
Valid Op(erations): <strong>open</strong> / <strong>noopen</strong> / <strong>click</strong> / <strong>noclick</strong>
|
| 201 |
+
Valid Values: "<strong>any</strong>" or a valid AIM-enabled Campaign that has been sent
|
| 202 |
+
|
| 203 |
+
Field = "<strong>rating</strong>" : allows matching based on list member ratings
|
| 204 |
+
Valid Op(erations): <strong>eq</strong> (=) / <strong>ne</strong> (!=) / <strong>gt</strong> (>) / <strong>lt</strong> (<)
|
| 205 |
+
Valid Values: a number between 0 and 5
|
| 206 |
+
|
| 207 |
+
Field = "<strong>ecomm_prod</strong>" or "<strong>ecomm_prod</strong>": allows matching product and category names from purchases
|
| 208 |
+
Valid Op(erations):
|
| 209 |
+
<strong>eq</strong> (=) / <strong>ne</strong> (!=) / <strong>gt</strong> (>) / <strong>lt</strong> (<) / <strong>like</strong> (like '%blah%') / <strong>nlike</strong> (not like '%blah%') / <strong>starts</strong> (like 'blah%') / <strong>ends</strong> (like '%blah')
|
| 210 |
+
Valid Values: any string
|
| 211 |
+
|
| 212 |
+
Field = "<strong>ecomm_spent_one</strong>" or "<strong>ecomm_spent_all</strong>" : allows matching purchase amounts on a single order or all orders
|
| 213 |
+
Valid Op(erations): <strong>gt</strong> (>) / <strong>lt</strong> (<)
|
| 214 |
+
Valid Values: a number
|
| 215 |
+
|
| 216 |
+
Field = "<strong>ecomm_date</strong>" : allow matching based on order dates
|
| 217 |
+
Valid Op(eration): <strong>eq</strong> (is) / <strong>gt</strong> (after) / <strong>lt</strong> (before)
|
| 218 |
+
Valid Values:
|
| 219 |
+
string YYYY-MM-DD - any date in the form of YYYY-MM-DD
|
| 220 |
+
|
| 221 |
+
Field = "<strong>social_gender</strong>" : allows matching against the gender acquired from SocialPro
|
| 222 |
+
Valid Op(eration): <strong>eq</strong> (is) / <strong>ne</strong> (is not)
|
| 223 |
+
Valid Values: male, female
|
| 224 |
+
|
| 225 |
+
Field = "<strong>social_age</strong>" : allows matching against the age acquired from SocialPro
|
| 226 |
+
Valid Op(erations): <strong>eq</strong> (=) / <strong>ne</strong> (!=) / <strong>gt</strong> (>) / <strong>lt</strong> (<)
|
| 227 |
+
Valid Values: any number
|
| 228 |
+
|
| 229 |
+
Field = "<strong>social_influence</strong>" : allows matching against the influence acquired from SocialPro
|
| 230 |
+
Valid Op(erations): <strong>eq</strong> (=) / <strong>ne</strong> (!=) / <strong>gt</strong> (>) / <strong>lt</strong> (<)
|
| 231 |
+
Valid Values: a number between 0 and 5
|
| 232 |
+
|
| 233 |
+
Field = "<strong>social_network</strong>" :
|
| 234 |
+
Valid Op(erations): <strong>member</strong> (is a member of) / <strong>notmember</strong> (is not a member of)
|
| 235 |
+
Valid Values: twitter, facebook, myspace, linkedin, flickr
|
| 236 |
+
|
| 237 |
+
Field = "<strong>static_segment</strong>" :
|
| 238 |
+
Valid Op(eration): <strong>eq</strong> (is in) / <strong>ne</strong> (is not in)
|
| 239 |
+
Valid Values: an int - get from listStaticSegments()
|
| 240 |
+
|
| 241 |
+
Field = An <strong>Address</strong> Merge Var. Use <strong>Merge0-Merge30</strong> or the <strong>Custom Tag</strong> you've setup for your merge field - see listMergeVars(). Note, Address fields can still be used with the default operations below - this section is broken out solely to highlight the differences in using the geolocation routines.
|
| 242 |
+
Valid Op(erations): <strong>geoin</strong>
|
| 243 |
+
Valid Values: The number of miles an address should be within
|
| 244 |
+
Extra Value: The Zip Code to be used as the center point
|
| 245 |
+
|
| 246 |
+
Default Field = A Merge Var. Use <strong>Merge0-Merge30</strong> or the <strong>Custom Tag</strong> you've setup for your merge field - see listMergeVars()
|
| 247 |
+
Valid Op(erations):
|
| 248 |
+
<strong>eq</strong> (=) / <strong>ne</strong> (!=) / <strong>gt</strong> (>) / <strong>lt</strong> (<) / <strong>like</strong> (like '%blah%') / <strong>nlike</strong> (not like '%blah%') / <strong>starts</strong> (like 'blah%') / <strong>ends</strong> (like '%blah')
|
| 249 |
+
Valid Values: any string
|
| 250 |
+
* @return int total The total number of subscribers matching your segmentation options
|
| 251 |
+
*/
|
| 252 |
+
function campaignSegmentTest($list_id, $options) {
|
| 253 |
+
$params = array();
|
| 254 |
+
$params["list_id"] = $list_id;
|
| 255 |
+
$params["options"] = $options;
|
| 256 |
+
return $this->callServer("campaignSegmentTest", $params);
|
| 257 |
+
}
|
| 258 |
+
|
| 259 |
+
/**
|
| 260 |
+
* Create a new draft campaign to send. You <strong>can not</strong> have more than 32,000 campaigns in your account.
|
| 261 |
+
*
|
| 262 |
+
* @section Campaign Related
|
| 263 |
+
* @example mcapi_campaignCreate.php
|
| 264 |
+
* @example xml-rpc_campaignCreate.php
|
| 265 |
+
* @example xml-rpc_campaignCreateABSplit.php
|
| 266 |
+
* @example xml-rpc_campaignCreateRss.php
|
| 267 |
+
*
|
| 268 |
+
* @param string $type the Campaign Type to create - one of "regular", "plaintext", "absplit", "rss", "trans", "auto"
|
| 269 |
+
* @param array $options a hash of the standard options for this campaign :
|
| 270 |
+
string list_id the list to send this campaign to- get lists using lists()
|
| 271 |
+
string subject the subject line for your campaign message
|
| 272 |
+
string from_email the From: email address for your campaign message
|
| 273 |
+
string from_name the From: name for your campaign message (not an email address)
|
| 274 |
+
string to_name the To: name recipients will see (not email address)
|
| 275 |
+
int template_id optional - use this user-created template to generate the HTML content of the campaign (takes precendence over other template options)
|
| 276 |
+
int gallery_template_id optional - use a template from the public gallery to generate the HTML content of the campaign (takes precendence over base template options)
|
| 277 |
+
int base_template_id optional - use this a base/start-from-scratch template to generate the HTML content of the campaign
|
| 278 |
+
int folder_id optional - automatically file the new campaign in the folder_id passed. Get using folders() - note that Campaigns and Autoresponders have separate folder setupsn
|
| 279 |
+
array tracking optional - set which recipient actions will be tracked, as a struct of boolean values with the following keys: "opens", "html_clicks", and "text_clicks". By default, opens and HTML clicks will be tracked. Click tracking can not be disabled for Free accounts.
|
| 280 |
+
string title optional - an internal name to use for this campaign. By default, the campaign subject will be used.
|
| 281 |
+
boolean authenticate optional - set to true to enable SenderID, DomainKeys, and DKIM authentication, defaults to false.
|
| 282 |
+
array analytics optional - if provided, use a struct with "service type" as a key and the "service tag" as a value. For Google, this should be "google"=>"your_google_analytics_key_here". Note that only "google" is currently supported - a Google Analytics tags will be added to all links in the campaign with this string attached. Others may be added in the future
|
| 283 |
+
boolean auto_footer optional Whether or not we should auto-generate the footer for your content. Mostly useful for content from URLs or Imports
|
| 284 |
+
boolean inline_css optional Whether or not css should be automatically inlined when this campaign is sent, defaults to false.
|
| 285 |
+
boolean generate_text optional Whether of not to auto-generate your Text content from the HTML content. Note that this will be ignored if the Text part of the content passed is not empty, defaults to false.
|
| 286 |
+
boolean auto_tweet optional If set, this campaign will be auto-tweeted when it is sent - defaults to false. Note that if a Twitter account isn't linked, this will be silently ignored.
|
| 287 |
+
boolean timewarp optional If set, this campaign must be scheduled 24 hours in advance of sending - default to false. Only valid for "regular" campaigns and "absplit" campaigns that split on schedule_time.
|
| 288 |
+
boolean ecomm360 optional If set, our <a href="http://www.mailchimp.com/blog/ecommerce-tracking-plugin/" target="_blank">Ecommerce360 tracking</a> will be enabled for links in the campaign
|
| 289 |
+
|
| 290 |
+
* @param array $content the content for this campaign - use a struct with the following keys:
|
| 291 |
+
string html for pasted HTML content
|
| 292 |
+
string text for the plain-text version
|
| 293 |
+
string url to have us pull in content from a URL. Note, this will override any other content options - for lists with Email Format options, you'll need to turn on generate_text as well
|
| 294 |
+
string archive to send a Base64 encoded archive file for us to import all media from. Note, this will override any other content options - for lists with Email Format options, you'll need to turn on generate_text as well
|
| 295 |
+
string archive_type optional - only necessary for the "archive" option. Supported formats are: zip, tar.gz, tar.bz2, tar, tgz, tbz . If not included, we will default to zip
|
| 296 |
+
|
| 297 |
+
If you chose a template instead of pasting in your HTML content, then use "html_" followed by the template sections as keys - for example, use a key of "html_MAIN" to fill in the "MAIN" section of a template. Supported template sections include: "html_HEADER", "html_MAIN", "html_SIDECOLUMN", and "html_FOOTER"
|
| 298 |
+
* @param array $segment_opts optional - if you wish to do Segmentation with this campaign this array should contain: see campaignSegmentTest(). It's suggested that you test your options against campaignSegmentTest(). Also, "trans" campaigns <strong>do not</strong> support segmentation.
|
| 299 |
+
* @param array $type_opts optional -
|
| 300 |
+
For RSS Campaigns this, array should contain:
|
| 301 |
+
string url the URL to pull RSS content from - it will be verified and must exist
|
| 302 |
+
string schedule optional one of "daily", "weekly", "monthly" - defaults to "daily"
|
| 303 |
+
string schedule_hour optional an hour between 0 and 24 - default to 4 (4am <em>local time</em>) - applies to all schedule types
|
| 304 |
+
string schedule_weekday optional for "weekly" only, a number specifying the day of the week to send: 0 (Sunday) - 6 (Saturday) - defaults to 1 (Monday)
|
| 305 |
+
string schedule_monthday optional for "monthly" only, a number specifying the day of the month to send (1 - 28) or "last" for the last day of a given month. Defaults to the 1st day of the month
|
| 306 |
+
|
| 307 |
+
For A/B Split campaigns, this array should contain:
|
| 308 |
+
string split_test The values to segment based on. Currently, one of: "subject", "from_name", "schedule". NOTE, for "schedule", you will need to call campaignSchedule() separately!
|
| 309 |
+
string pick_winner How the winner will be picked, one of: "opens" (by the open_rate), "clicks" (by the click rate), "manual" (you pick manually)
|
| 310 |
+
int wait_units optional the default time unit to wait before auto-selecting a winner - use "3600" for hours, "86400" for days. Defaults to 86400.
|
| 311 |
+
int wait_time optional the number of units to wait before auto-selecting a winner - defaults to 1, so if not set, a winner will be selected after 1 Day.
|
| 312 |
+
int split_size optional this is a percentage of what size the Campaign's List plus any segmentation options results in. "schedule" type forces 50%, all others default to 10%
|
| 313 |
+
string from_name_a optional sort of, required when split_test is "from_name"
|
| 314 |
+
string from_name_b optional sort of, required when split_test is "from_name"
|
| 315 |
+
string from_email_a optional sort of, required when split_test is "from_name"
|
| 316 |
+
string from_email_b optional sort of, required when split_test is "from_name"
|
| 317 |
+
string subject_a optional sort of, required when split_test is "subject"
|
| 318 |
+
string subject_b optional sort of, required when split_test is "subject"
|
| 319 |
+
|
| 320 |
+
For AutoResponder campaigns, this array should contain:
|
| 321 |
+
string offset-units one of "day", "week", "month", "year" - required
|
| 322 |
+
string offset-time optional, sort of - the number of units must be a number greater than 0 for signup based autoresponders
|
| 323 |
+
string offset-dir either "before" or "after"
|
| 324 |
+
string event optional "signup" (default) to base this on double-optin signup, "date" or "annual" to base this on merge field in the list
|
| 325 |
+
string event-datemerge optional sort of, this is required if the event is "date" or "annual"
|
| 326 |
+
|
| 327 |
+
*
|
| 328 |
+
* @return string the ID for the created campaign
|
| 329 |
+
*/
|
| 330 |
+
function campaignCreate($type, $options, $content, $segment_opts=NULL, $type_opts=NULL) {
|
| 331 |
+
$params = array();
|
| 332 |
+
$params["type"] = $type;
|
| 333 |
+
$params["options"] = $options;
|
| 334 |
+
$params["content"] = $content;
|
| 335 |
+
$params["segment_opts"] = $segment_opts;
|
| 336 |
+
$params["type_opts"] = $type_opts;
|
| 337 |
+
return $this->callServer("campaignCreate", $params);
|
| 338 |
+
}
|
| 339 |
+
|
| 340 |
+
/** Update just about any setting for a campaign that has <em>not</em> been sent. See campaignCreate() for details.
|
| 341 |
+
*
|
| 342 |
+
*
|
| 343 |
+
* Caveats:<br/><ul>
|
| 344 |
+
* <li>If you set list_id, all segmentation options will be deleted and must be re-added.</li>
|
| 345 |
+
* <li>If you set template_id, you need to follow that up by setting it's 'content'</li>
|
| 346 |
+
* <li>If you set segment_opts, you should have tested your options against campaignSegmentTest() as campaignUpdate() will not allow you to set a segment that includes no members.</li></ul>
|
| 347 |
+
* @section Campaign Related
|
| 348 |
+
*
|
| 349 |
+
* @example mcapi_campaignUpdate.php
|
| 350 |
+
* @example mcapi_campaignUpdateAB.php
|
| 351 |
+
* @example xml-rpc_campaignUpdate.php
|
| 352 |
+
* @example xml-rpc_campaignUpdateAB.php
|
| 353 |
+
*
|
| 354 |
+
* @param string $cid the Campaign Id to update
|
| 355 |
+
* @param string $name the parameter name ( see campaignCreate() ). For items in the <strong>options</strong> array, this will be that parameter's name (subject, from_email, etc.). Additional parameters will be that option name (content, segment_opts). "type_opts" will be the name of the type - rss, auto, trans, etc.
|
| 356 |
+
* @param mixed $value an appropriate value for the parameter ( see campaignCreate() ). For items in the <strong>options</strong> array, this will be that parameter's value. For additional parameters, this is the same value passed to them.
|
| 357 |
+
* @return boolean true if the update succeeds, otherwise an error will be thrown
|
| 358 |
+
*/
|
| 359 |
+
function campaignUpdate($cid, $name, $value) {
|
| 360 |
+
$params = array();
|
| 361 |
+
$params["cid"] = $cid;
|
| 362 |
+
$params["name"] = $name;
|
| 363 |
+
$params["value"] = $value;
|
| 364 |
+
return $this->callServer("campaignUpdate", $params);
|
| 365 |
+
}
|
| 366 |
+
|
| 367 |
+
/** Replicate a campaign.
|
| 368 |
+
*
|
| 369 |
+
* @section Campaign Related
|
| 370 |
+
*
|
| 371 |
+
* @example mcapi_campaignReplicate.php
|
| 372 |
+
*
|
| 373 |
+
* @param string $cid the Campaign Id to replicate
|
| 374 |
+
* @return string the id of the replicated Campaign created, otherwise an error will be thrown
|
| 375 |
+
*/
|
| 376 |
+
function campaignReplicate($cid) {
|
| 377 |
+
$params = array();
|
| 378 |
+
$params["cid"] = $cid;
|
| 379 |
+
return $this->callServer("campaignReplicate", $params);
|
| 380 |
+
}
|
| 381 |
+
|
| 382 |
+
/** Delete a campaign. Seriously, "poof, gone!" - be careful!
|
| 383 |
+
*
|
| 384 |
+
* @section Campaign Related
|
| 385 |
+
*
|
| 386 |
+
* @example mcapi_campaignDelete.php
|
| 387 |
+
*
|
| 388 |
+
* @param string $cid the Campaign Id to delete
|
| 389 |
+
* @return boolean true if the delete succeeds, otherwise an error will be thrown
|
| 390 |
+
*/
|
| 391 |
+
function campaignDelete($cid) {
|
| 392 |
+
$params = array();
|
| 393 |
+
$params["cid"] = $cid;
|
| 394 |
+
return $this->callServer("campaignDelete", $params);
|
| 395 |
+
}
|
| 396 |
+
|
| 397 |
+
/**
|
| 398 |
+
* Get the list of campaigns and their details matching the specified filters
|
| 399 |
+
*
|
| 400 |
+
* @section Campaign Related
|
| 401 |
+
* @example mcapi_campaigns.php
|
| 402 |
+
* @example xml-rpc_campaigns.php
|
| 403 |
+
*
|
| 404 |
+
* @param array $filters a hash of filters to apply to this query - all are optional:
|
| 405 |
+
string campaign_id optional - return a single campaign using a know campaign_id
|
| 406 |
+
string list_id optional - the list to send this campaign to- get lists using lists(). Accepts multiples separated by commas when not using exact matching.
|
| 407 |
+
int folder_id optional - only show campaigns from this folder id - get folders using campaignFolders(). Accepts multiples separated by commas when not using exact matching.
|
| 408 |
+
int template_id optional - only show campaigns using this template id - get templates using templates(). Accepts multiples separated by commas when not using exact matching.
|
| 409 |
+
string status optional - return campaigns of a specific status - one of "sent", "save", "paused", "schedule", "sending". Accepts multiples separated by commas when not using exact matching.
|
| 410 |
+
string type optional - return campaigns of a specific type - one of "regular", "plaintext", "absplit", "rss", "trans", "auto". Accepts multiples separated by commas when not using exact matching.
|
| 411 |
+
string from_name optional - only show campaigns that have this "From Name"
|
| 412 |
+
string from_email optional - only show campaigns that have this "Reply-to Email"
|
| 413 |
+
string title optional - only show campaigns that have this title
|
| 414 |
+
string subject optional - only show campaigns that have this subject
|
| 415 |
+
string sendtime_start optional - only show campaigns that have been sent since this date/time (in GMT) - format is YYYY-MM-DD HH:mm:ss (24hr)
|
| 416 |
+
string sendtime_end optional - only show campaigns that have been sent before this date/time (in GMT) - format is YYYY-MM-DD HH:mm:ss (24hr)
|
| 417 |
+
boolean exact optional - flag for whether to filter on exact values when filtering, or search within content for filter values - defaults to true. Using this disables the use of any filters that accept multiples.
|
| 418 |
+
* @param int $start optional - control paging of campaigns, start results at this campaign #, defaults to 1st page of data (page 0)
|
| 419 |
+
* @param int $limit optional - control paging of campaigns, number of campaigns to return with each call, defaults to 25 (max=1000)
|
| 420 |
+
* @return array an array containing a count of all matching campaigns and the specific ones for the current page (see Returned Fields for description)
|
| 421 |
+
* @returnf int total the total number of campaigns matching the filters passed in
|
| 422 |
+
* @returnf array data the data for each campaign being returned
|
| 423 |
+
string id Campaign Id (used for all other campaign functions)
|
| 424 |
+
int web_id The Campaign id used in our web app, allows you to create a link directly to it
|
| 425 |
+
string list_id The List used for this campaign
|
| 426 |
+
int folder_id The Folder this campaign is in
|
| 427 |
+
int template_id The Template this campaign uses
|
| 428 |
+
string content_type How the campaign's content is put together - one of 'template', 'html', 'url'
|
| 429 |
+
string title Title of the campaign
|
| 430 |
+
string type The type of campaign this is (regular,plaintext,absplit,rss,inspection,trans,auto)
|
| 431 |
+
string create_time Creation time for the campaign
|
| 432 |
+
string send_time Send time for the campaign - also the scheduled time for scheduled campaigns.
|
| 433 |
+
int emails_sent Number of emails email was sent to
|
| 434 |
+
string status Status of the given campaign (save,paused,schedule,sending,sent)
|
| 435 |
+
string from_name From name of the given campaign
|
| 436 |
+
string from_email Reply-to email of the given campaign
|
| 437 |
+
string subject Subject of the given campaign
|
| 438 |
+
string to_name Custom "To:" email string using merge variables
|
| 439 |
+
string archive_url Archive link for the given campaign
|
| 440 |
+
boolean inline_css Whether or not the campaign content's css was auto-inlined
|
| 441 |
+
string analytics Either "google" if enabled or "N" if disabled
|
| 442 |
+
string analytics_tag The name/tag the campaign's links were tagged with if analytics were enabled.
|
| 443 |
+
boolean authenticate Whether or not the campaign was authenticated
|
| 444 |
+
boolean ecomm360 Whether or not ecomm360 tracking was appended to links
|
| 445 |
+
boolean auto_tweet Whether or not the campaign was auto tweeted after sending
|
| 446 |
+
string auto_fb_post A comma delimited list of Facebook Profile/Page Ids the campaign was posted to after sending. If not used, blank.
|
| 447 |
+
boolean auto_footer Whether or not the auto_footer was manually turned on
|
| 448 |
+
boolean timewarp Whether or not the campaign used Timewarp
|
| 449 |
+
boolean timewarp_schedule The time, in GMT, that the Timewarp campaign is being sent. For A/B Split campaigns, this is blank and is instead in their schedule_a and schedule_b in the type_opts array
|
| 450 |
+
array tracking containing "text_clicks", "html_clicks", and "opens" as boolean values representing whether or not they were enabled
|
| 451 |
+
string segment_text a string marked-up with HTML explaining the segment used for the campaign in plain English
|
| 452 |
+
array segment_opts the segment used for the campaign - can be passed to campaignSegmentTest() or campaignCreate()
|
| 453 |
+
array type_opts the type-specific options for the campaign - can be passed to campaignCreate()
|
| 454 |
+
*/
|
| 455 |
+
function campaigns($filters=array (
|
| 456 |
+
), $start=0, $limit=25) {
|
| 457 |
+
$params = array();
|
| 458 |
+
$params["filters"] = $filters;
|
| 459 |
+
$params["start"] = $start;
|
| 460 |
+
$params["limit"] = $limit;
|
| 461 |
+
return $this->callServer("campaigns", $params);
|
| 462 |
+
}
|
| 463 |
+
|
| 464 |
+
/**
|
| 465 |
+
* Given a list and a campaign, get all the relevant campaign statistics (opens, bounces, clicks, etc.)
|
| 466 |
+
*
|
| 467 |
+
* @section Campaign Stats
|
| 468 |
+
*
|
| 469 |
+
* @example mcapi_campaignStats.php
|
| 470 |
+
* @example xml-rpc_campaignStats.php
|
| 471 |
+
*
|
| 472 |
+
* @param string $cid the campaign id to pull stats for (can be gathered using campaigns())
|
| 473 |
+
* @return array struct of the statistics for this campaign
|
| 474 |
+
* @returnf int syntax_errors Number of email addresses in campaign that had syntactical errors.
|
| 475 |
+
* @returnf int hard_bounces Number of email addresses in campaign that hard bounced.
|
| 476 |
+
* @returnf int soft_bounces Number of email addresses in campaign that soft bounced.
|
| 477 |
+
* @returnf int unsubscribes Number of email addresses in campaign that unsubscribed.
|
| 478 |
+
* @returnf int abuse_reports Number of email addresses in campaign that reported campaign for abuse.
|
| 479 |
+
* @returnf int forwards Number of times email was forwarded to a friend.
|
| 480 |
+
* @returnf int forwards_opens Number of times a forwarded email was opened.
|
| 481 |
+
* @returnf int opens Number of times the campaign was opened.
|
| 482 |
+
* @returnf date last_open Date of the last time the email was opened.
|
| 483 |
+
* @returnf int unique_opens Number of people who opened the campaign.
|
| 484 |
+
* @returnf int clicks Number of times a link in the campaign was clicked.
|
| 485 |
+
* @returnf int unique_clicks Number of unique recipient/click pairs for the campaign.
|
| 486 |
+
* @returnf date last_click Date of the last time a link in the email was clicked.
|
| 487 |
+
* @returnf int users_who_clicked Number of unique recipients who clicked on a link in the campaign.
|
| 488 |
+
* @returnf int emails_sent Number of email addresses campaign was sent to.
|
| 489 |
+
* @returnf array absplit If this was an absplit campaign, stats for the A and B groups will be returned
|
| 490 |
+
int bounces_a bounces for the A group
|
| 491 |
+
int bounces_b bounces for the B group
|
| 492 |
+
int forwards_a forwards for the A group
|
| 493 |
+
int forwards_b forwards for the B group
|
| 494 |
+
int abuse_reports_a abuse reports for the A group
|
| 495 |
+
int abuse_reports_b abuse reports for the B group
|
| 496 |
+
int unsubs_a unsubs for the A group
|
| 497 |
+
int unsubs_b unsubs for the B group
|
| 498 |
+
int recipients_click_a clicks for the A group
|
| 499 |
+
int recipients_click_b clicks for the B group
|
| 500 |
+
int forwards_opens_a opened forwards for the A group
|
| 501 |
+
int forwards_opens_b opened forwards for the A group
|
| 502 |
+
* @returnf array timewarp If this campaign was a Timewarp campaign, an array of stats from each timezone for it, with the GMT offset as they key. Each timezone will contain:
|
| 503 |
+
int opens opens for this timezone
|
| 504 |
+
string last_open the date/time of the last open for this timezone
|
| 505 |
+
int unique_opens the unique opens for this timezone
|
| 506 |
+
int clicks the total clicks for this timezone
|
| 507 |
+
string last_click the date/time of the last click for this timezone
|
| 508 |
+
int unique_opens the unique clicks for this timezone
|
| 509 |
+
int bounces the total bounces for this timezone
|
| 510 |
+
int total the total number of members sent to in this timezone
|
| 511 |
+
int sent the total number of members delivered to in this timezone
|
| 512 |
+
*/
|
| 513 |
+
function campaignStats($cid) {
|
| 514 |
+
$params = array();
|
| 515 |
+
$params["cid"] = $cid;
|
| 516 |
+
return $this->callServer("campaignStats", $params);
|
| 517 |
+
}
|
| 518 |
+
|
| 519 |
+
/**
|
| 520 |
+
* Get an array of the urls being tracked, and their click counts for a given campaign
|
| 521 |
+
*
|
| 522 |
+
* @section Campaign Stats
|
| 523 |
+
*
|
| 524 |
+
* @example mcapi_campaignClickStats.php
|
| 525 |
+
* @example xml-rpc_campaignClickStats.php
|
| 526 |
+
*
|
| 527 |
+
* @param string $cid the campaign id to pull stats for (can be gathered using campaigns())
|
| 528 |
+
* @return struct urls will be keys and contain their associated statistics:
|
| 529 |
+
* @returnf int clicks Number of times the specific link was clicked
|
| 530 |
+
* @returnf int unique Number of unique people who clicked on the specific link
|
| 531 |
+
*/
|
| 532 |
+
function campaignClickStats($cid) {
|
| 533 |
+
$params = array();
|
| 534 |
+
$params["cid"] = $cid;
|
| 535 |
+
return $this->callServer("campaignClickStats", $params);
|
| 536 |
+
}
|
| 537 |
+
|
| 538 |
+
/**
|
| 539 |
+
* Get the top 5 performing email domains for this campaign. Users want more than 5 should use campaign campaignEmailStatsAIM()
|
| 540 |
+
* or campaignEmailStatsAIMAll() and generate any additional stats they require.
|
| 541 |
+
*
|
| 542 |
+
* @section Campaign Stats
|
| 543 |
+
*
|
| 544 |
+
* @example mcapi_campaignEmailDomainPerformance.php
|
| 545 |
+
*
|
| 546 |
+
* @param string $cid the campaign id to pull email domain performance for (can be gathered using campaigns())
|
| 547 |
+
* @return array domains email domains and their associated stats
|
| 548 |
+
* @returnf string domain Domain name or special "Other" to roll-up stats past 5 domains
|
| 549 |
+
* @returnf int total_sent Total Email across all domains - this will be the same in every row
|
| 550 |
+
* @returnf int emails Number of emails sent to this domain
|
| 551 |
+
* @returnf int bounces Number of bounces
|
| 552 |
+
* @returnf int opens Number of opens
|
| 553 |
+
* @returnf int clicks Number of clicks
|
| 554 |
+
* @returnf int unsubs Number of unsubs
|
| 555 |
+
* @returnf int delivered Number of deliveries
|
| 556 |
+
* @returnf int emails_pct Percentage of emails that went to this domain (whole number)
|
| 557 |
+
* @returnf int bounces_pct Percentage of bounces from this domain (whole number)
|
| 558 |
+
* @returnf int opens_pct Percentage of opens from this domain (whole number)
|
| 559 |
+
* @returnf int clicks_pct Percentage of clicks from this domain (whole number)
|
| 560 |
+
* @returnf int unsubs_pct Percentage of unsubs from this domain (whole number)
|
| 561 |
+
*/
|
| 562 |
+
function campaignEmailDomainPerformance($cid) {
|
| 563 |
+
$params = array();
|
| 564 |
+
$params["cid"] = $cid;
|
| 565 |
+
return $this->callServer("campaignEmailDomainPerformance", $params);
|
| 566 |
+
}
|
| 567 |
+
|
| 568 |
+
/**
|
| 569 |
+
* Get all email addresses the campaign was successfully sent to (ie, no bounces)
|
| 570 |
+
*
|
| 571 |
+
* @section Campaign Stats
|
| 572 |
+
*
|
| 573 |
+
* @param string $cid the campaign id to pull members for (can be gathered using campaigns())
|
| 574 |
+
* @param string $status optional the status to pull - one of 'sent', 'hard' (bounce), or 'soft' (bounce). By default, all records are returned
|
| 575 |
+
* @param int $start optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)
|
| 576 |
+
* @param int $limit optional for large data sets, the number of results to return - defaults to 1000, upper limit set at 15000
|
| 577 |
+
* @return array a total of all matching emails and the specific emails for this page
|
| 578 |
+
* @returnf int total the total number of members for the campaign and status
|
| 579 |
+
* @returnf array data the full campaign member records
|
| 580 |
+
string email the email address sent to
|
| 581 |
+
string status the status of the send - one of 'sent', 'hard', 'soft'
|
| 582 |
+
string absplit_group if this was an absplit campaign, one of 'a','b', or 'winner'
|
| 583 |
+
string tz_group if this was an timewarp campaign the timezone GMT offset the member was included in
|
| 584 |
+
*/
|
| 585 |
+
function campaignMembers($cid, $status=NULL, $start=0, $limit=1000) {
|
| 586 |
+
$params = array();
|
| 587 |
+
$params["cid"] = $cid;
|
| 588 |
+
$params["status"] = $status;
|
| 589 |
+
$params["start"] = $start;
|
| 590 |
+
$params["limit"] = $limit;
|
| 591 |
+
return $this->callServer("campaignMembers", $params);
|
| 592 |
+
}
|
| 593 |
+
|
| 594 |
+
/**
|
| 595 |
+
* <strong>DEPRECATED</strong> Get all email addresses with Hard Bounces for a given campaign
|
| 596 |
+
*
|
| 597 |
+
* @deprecated See campaignMembers() for a replacement
|
| 598 |
+
*
|
| 599 |
+
* @section Campaign Stats
|
| 600 |
+
*
|
| 601 |
+
* @param string $cid the campaign id to pull bounces for (can be gathered using campaigns())
|
| 602 |
+
* @param int $start optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)
|
| 603 |
+
* @param int $limit optional for large data sets, the number of results to return - defaults to 1000, upper limit set at 15000
|
| 604 |
+
* @return array a total of all hard bounced emails and the specific emails for this page
|
| 605 |
+
* @returnf int total the total number of hard bounces for the campaign
|
| 606 |
+
* @returnf array data the full email addresses that bounced
|
| 607 |
+
string email the email address that bounced
|
| 608 |
+
*/
|
| 609 |
+
function campaignHardBounces($cid, $start=0, $limit=1000) {
|
| 610 |
+
$params = array();
|
| 611 |
+
$params["cid"] = $cid;
|
| 612 |
+
$params["start"] = $start;
|
| 613 |
+
$params["limit"] = $limit;
|
| 614 |
+
return $this->callServer("campaignHardBounces", $params);
|
| 615 |
+
}
|
| 616 |
+
|
| 617 |
+
/**
|
| 618 |
+
* <strong>DEPRECATED</strong> Get all email addresses with Soft Bounces for a given campaign
|
| 619 |
+
*
|
| 620 |
+
* @deprecated See campaignMembers() for a replacement
|
| 621 |
+
*
|
| 622 |
+
* @section Campaign Stats
|
| 623 |
+
*
|
| 624 |
+
* @param string $cid the campaign id to pull bounces for (can be gathered using campaigns())
|
| 625 |
+
* @param int $start optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)
|
| 626 |
+
* @param int $limit optional for large data sets, the number of results to return - defaults to 1000, upper limit set at 15000
|
| 627 |
+
* @return array a total of all soft bounced emails and the specific emails for this page
|
| 628 |
+
* @returnf int total the total number of soft bounces for the campaign
|
| 629 |
+
* @returnf array data the full email addresses that bounced
|
| 630 |
+
string email the email address that bounced
|
| 631 |
+
*/
|
| 632 |
+
function campaignSoftBounces($cid, $start=0, $limit=1000) {
|
| 633 |
+
$params = array();
|
| 634 |
+
$params["cid"] = $cid;
|
| 635 |
+
$params["start"] = $start;
|
| 636 |
+
$params["limit"] = $limit;
|
| 637 |
+
return $this->callServer("campaignSoftBounces", $params);
|
| 638 |
+
}
|
| 639 |
+
|
| 640 |
+
/**
|
| 641 |
+
* Get all unsubscribed email addresses for a given campaign
|
| 642 |
+
*
|
| 643 |
+
* @section Campaign Stats
|
| 644 |
+
*
|
| 645 |
+
* @param string $cid the campaign id to pull bounces for (can be gathered using campaigns())
|
| 646 |
+
* @param int $start optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)
|
| 647 |
+
* @param int $limit optional for large data sets, the number of results to return - defaults to 1000, upper limit set at 15000
|
| 648 |
+
* @return array email addresses that unsubscribed from this campaign along with reasons, if given
|
| 649 |
+
* @return array a total of all unsubscribed emails and the specific emails for this page
|
| 650 |
+
* @returnf int total the total number of unsubscribes for the campaign
|
| 651 |
+
* @returnf array data the full email addresses that unsubscribed
|
| 652 |
+
string email the email address that unsubscribed
|
| 653 |
+
string reason For unsubscribes only - the reason collected for the unsubscribe. If populated, one of 'NORMAL','NOSIGNUP','INAPPROPRIATE','SPAM','OTHER'
|
| 654 |
+
string reason_text For unsubscribes only - if the reason is OTHER, the text entered.
|
| 655 |
+
*/
|
| 656 |
+
function campaignUnsubscribes($cid, $start=0, $limit=1000) {
|
| 657 |
+
$params = array();
|
| 658 |
+
$params["cid"] = $cid;
|
| 659 |
+
$params["start"] = $start;
|
| 660 |
+
$params["limit"] = $limit;
|
| 661 |
+
return $this->callServer("campaignUnsubscribes", $params);
|
| 662 |
+
}
|
| 663 |
+
|
| 664 |
+
/**
|
| 665 |
+
* Get all email addresses that complained about a given campaign
|
| 666 |
+
*
|
| 667 |
+
* @section Campaign Stats
|
| 668 |
+
*
|
| 669 |
+
* @example mcapi_campaignAbuseReports.php
|
| 670 |
+
*
|
| 671 |
+
* @param string $cid the campaign id to pull abuse reports for (can be gathered using campaigns())
|
| 672 |
+
* @param int $start optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)
|
| 673 |
+
* @param int $limit optional for large data sets, the number of results to return - defaults to 500, upper limit set at 1000
|
| 674 |
+
* @param string $since optional pull only messages since this time - use YYYY-MM-DD HH:II:SS format in <strong>GMT</strong>
|
| 675 |
+
* @return array reports the abuse reports for this campaign
|
| 676 |
+
* @returnf string date date/time the abuse report was received and processed
|
| 677 |
+
* @returnf string email the email address that reported abuse
|
| 678 |
+
* @returnf string type an internal type generally specifying the orginating mail provider - may not be useful outside of filling report views
|
| 679 |
+
*/
|
| 680 |
+
function campaignAbuseReports($cid, $since=NULL, $start=0, $limit=500) {
|
| 681 |
+
$params = array();
|
| 682 |
+
$params["cid"] = $cid;
|
| 683 |
+
$params["since"] = $since;
|
| 684 |
+
$params["start"] = $start;
|
| 685 |
+
$params["limit"] = $limit;
|
| 686 |
+
return $this->callServer("campaignAbuseReports", $params);
|
| 687 |
+
}
|
| 688 |
+
|
| 689 |
+
/**
|
| 690 |
+
* Retrieve the text presented in our app for how a campaign performed and any advice we may have for you - best
|
| 691 |
+
* suited for display in customized reports pages. Note: some messages will contain HTML - clean tags as necessary
|
| 692 |
+
*
|
| 693 |
+
* @section Campaign Stats
|
| 694 |
+
*
|
| 695 |
+
* @example mcapi_campaignAdvice.php
|
| 696 |
+
*
|
| 697 |
+
* @param string $cid the campaign id to pull advice text for (can be gathered using campaigns())
|
| 698 |
+
* @return array advice on the campaign's performance
|
| 699 |
+
* @returnf msg the advice message
|
| 700 |
+
* @returnf type the "type" of the message. one of: negative, positive, or neutral
|
| 701 |
+
*/
|
| 702 |
+
function campaignAdvice($cid) {
|
| 703 |
+
$params = array();
|
| 704 |
+
$params["cid"] = $cid;
|
| 705 |
+
return $this->callServer("campaignAdvice", $params);
|
| 706 |
+
}
|
| 707 |
+
|
| 708 |
+
/**
|
| 709 |
+
* Retrieve the Google Analytics data we've collected for this campaign. Note, requires Google Analytics Add-on to be installed and configured.
|
| 710 |
+
*
|
| 711 |
+
* @section Campaign Stats
|
| 712 |
+
*
|
| 713 |
+
* @example mcapi_campaignAnalytics.php
|
| 714 |
+
*
|
| 715 |
+
* @param string $cid the campaign id to pull bounces for (can be gathered using campaigns())
|
| 716 |
+
* @return array analytics we've collected for the passed campaign.
|
| 717 |
+
* @returnf int visits number of visits
|
| 718 |
+
* @returnf int pages number of page views
|
| 719 |
+
* @returnf int new_visits new visits recorded
|
| 720 |
+
* @returnf int bounces vistors who "bounced" from your site
|
| 721 |
+
* @returnf double time_on_site the total time visitors spent on your sites
|
| 722 |
+
* @returnf int goal_conversions number of goals converted
|
| 723 |
+
* @returnf double goal_value value of conversion in dollars
|
| 724 |
+
* @returnf double revenue revenue generated by campaign
|
| 725 |
+
* @returnf int transactions number of transactions tracked
|
| 726 |
+
* @returnf int ecomm_conversions number Ecommerce transactions tracked
|
| 727 |
+
* @returnf array goals an array containing goal names and number of conversions
|
| 728 |
+
*/
|
| 729 |
+
function campaignAnalytics($cid) {
|
| 730 |
+
$params = array();
|
| 731 |
+
$params["cid"] = $cid;
|
| 732 |
+
return $this->callServer("campaignAnalytics", $params);
|
| 733 |
+
}
|
| 734 |
+
|
| 735 |
+
/**
|
| 736 |
+
* Retrieve the countries and number of opens tracked for each. Email address are not returned.
|
| 737 |
+
*
|
| 738 |
+
* @section Campaign Stats
|
| 739 |
+
*
|
| 740 |
+
*
|
| 741 |
+
* @param string $cid the campaign id to pull bounces for (can be gathered using campaigns())
|
| 742 |
+
* @return array countries an array of countries where opens occurred
|
| 743 |
+
* @returnf string code The ISO3166 2 digit country code
|
| 744 |
+
* @returnf string name A version of the country name, if we have it
|
| 745 |
+
* @returnf int opens The total number of opens that occurred in the country
|
| 746 |
+
* @returnf bool region_detail Whether or not a subsequent call to campaignGeoOpensByCountry() will return anything
|
| 747 |
+
*/
|
| 748 |
+
function campaignGeoOpens($cid) {
|
| 749 |
+
$params = array();
|
| 750 |
+
$params["cid"] = $cid;
|
| 751 |
+
return $this->callServer("campaignGeoOpens", $params);
|
| 752 |
+
}
|
| 753 |
+
|
| 754 |
+
/**
|
| 755 |
+
* Retrieve the regions and number of opens tracked for a certain country. Email address are not returned.
|
| 756 |
+
*
|
| 757 |
+
* @section Campaign Stats
|
| 758 |
+
*
|
| 759 |
+
*
|
| 760 |
+
* @param string $cid the campaign id to pull bounces for (can be gathered using campaigns())
|
| 761 |
+
* @param string $code An ISO3166 2 digit country code
|
| 762 |
+
* @return array regions an array of regions within the provided country where opens occurred.
|
| 763 |
+
* @returnf string code An internal code for the region. When this is blank, it indicates we know the country, but not the region
|
| 764 |
+
* @returnf string name The name of the region, if we have one. For blank "code" values, this will be "Rest of Country"
|
| 765 |
+
* @returnf int opens The total number of opens that occurred in the country
|
| 766 |
+
*/
|
| 767 |
+
function campaignGeoOpensForCountry($cid, $code) {
|
| 768 |
+
$params = array();
|
| 769 |
+
$params["cid"] = $cid;
|
| 770 |
+
$params["code"] = $code;
|
| 771 |
+
return $this->callServer("campaignGeoOpensForCountry", $params);
|
| 772 |
+
}
|
| 773 |
+
|
| 774 |
+
/**
|
| 775 |
+
* Retrieve the tracked eepurl mentions on Twitter
|
| 776 |
+
*
|
| 777 |
+
* @section Campaign Stats
|
| 778 |
+
*
|
| 779 |
+
*
|
| 780 |
+
* @param string $cid the campaign id to pull bounces for (can be gathered using campaigns())
|
| 781 |
+
* @return array stats an array containing tweets, retweets, clicks, and referrer related to using the campaign's eepurl
|
| 782 |
+
* @returnf array twitter various Twitter related stats
|
| 783 |
+
int tweets Total number of tweets seen
|
| 784 |
+
string first_tweet date and time of the first tweet seen
|
| 785 |
+
string last_tweet date and time of the last tweet seen
|
| 786 |
+
int retweets Total number of retweets seen
|
| 787 |
+
string first_retweet date and time of the first retweet seen
|
| 788 |
+
string last_retweet date and time of the last retweet seen
|
| 789 |
+
array statuses an array of statuses recorded inclduing the status, screen_name, status_id, and datetime fields plus an is_retweet flag
|
| 790 |
+
* @returnf array clicks stats related to click-throughs on the eepurl
|
| 791 |
+
int clicks Total number of clicks seen
|
| 792 |
+
string first_click date and time of the first click seen
|
| 793 |
+
string last_click date and time of the first click seen
|
| 794 |
+
array locations an array of geographic locations including country, region, and total clicks
|
| 795 |
+
* @returnf array referrers an array of arrays, each containing
|
| 796 |
+
string referrer the referrer, truncated to 100 bytes
|
| 797 |
+
int clicks Total number of clicks seen from this referrer
|
| 798 |
+
string first_click date and time of the first click seen from this referrer
|
| 799 |
+
string last_click date and time of the first click seen from this referrer
|
| 800 |
+
*/
|
| 801 |
+
function campaignEepUrlStats($cid) {
|
| 802 |
+
$params = array();
|
| 803 |
+
$params["cid"] = $cid;
|
| 804 |
+
return $this->callServer("campaignEepUrlStats", $params);
|
| 805 |
+
}
|
| 806 |
+
|
| 807 |
+
/**
|
| 808 |
+
* Retrieve the most recent full bounce message for a specific email address on the given campaign.
|
| 809 |
+
* Messages over 30 days old are subject to being removed
|
| 810 |
+
*
|
| 811 |
+
*
|
| 812 |
+
* @section Campaign Stats
|
| 813 |
+
*
|
| 814 |
+
* @param string $cid the campaign id to pull bounces for (can be gathered using campaigns())
|
| 815 |
+
* @param string $email the email address or unique id of the member to pull a bounce message for.
|
| 816 |
+
* @return array the full bounce message for this email+campaign along with some extra data.
|
| 817 |
+
* @returnf string date date/time the bounce was received and processed
|
| 818 |
+
* @returnf string email the email address that bounced
|
| 819 |
+
* @returnf string message the entire bounce message received
|
| 820 |
+
*/
|
| 821 |
+
function campaignBounceMessage($cid, $email) {
|
| 822 |
+
$params = array();
|
| 823 |
+
$params["cid"] = $cid;
|
| 824 |
+
$params["email"] = $email;
|
| 825 |
+
return $this->callServer("campaignBounceMessage", $params);
|
| 826 |
+
}
|
| 827 |
+
|
| 828 |
+
/**
|
| 829 |
+
* Retrieve the full bounce messages for the given campaign. Note that this can return very large amounts
|
| 830 |
+
* of data depending on how large the campaign was and how much cruft the bounce provider returned. Also,
|
| 831 |
+
* message over 30 days old are subject to being removed
|
| 832 |
+
*
|
| 833 |
+
* @section Campaign Stats
|
| 834 |
+
*
|
| 835 |
+
* @example mcapi_campaignBounceMessages.php
|
| 836 |
+
*
|
| 837 |
+
* @param string $cid the campaign id to pull bounces for (can be gathered using campaigns())
|
| 838 |
+
* @param int $start optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)
|
| 839 |
+
* @param int $limit optional for large data sets, the number of results to return - defaults to 25, upper limit set at 50
|
| 840 |
+
* @param string $since optional pull only messages since this time - use YYYY-MM-DD format in <strong>GMT</strong> (we only store the date, not the time)
|
| 841 |
+
* @return array bounces the full bounce messages for this campaign
|
| 842 |
+
* @returnf int total that total number of bounce messages for the campaign
|
| 843 |
+
* @returnf array data an array containing the data for this page
|
| 844 |
+
string date date/time the bounce was received and processed
|
| 845 |
+
string email the email address that bounced
|
| 846 |
+
string message the entire bounce message received
|
| 847 |
+
*/
|
| 848 |
+
function campaignBounceMessages($cid, $start=0, $limit=25, $since=NULL) {
|
| 849 |
+
$params = array();
|
| 850 |
+
$params["cid"] = $cid;
|
| 851 |
+
$params["start"] = $start;
|
| 852 |
+
$params["limit"] = $limit;
|
| 853 |
+
$params["since"] = $since;
|
| 854 |
+
return $this->callServer("campaignBounceMessages", $params);
|
| 855 |
+
}
|
| 856 |
+
|
| 857 |
+
/**
|
| 858 |
+
* Retrieve the Ecommerce Orders tracked by campaignEcommOrderAdd()
|
| 859 |
+
*
|
| 860 |
+
* @section Campaign Stats
|
| 861 |
+
*
|
| 862 |
+
* @param string $cid the campaign id to pull bounces for (can be gathered using campaigns())
|
| 863 |
+
* @param int $start optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)
|
| 864 |
+
* @param int $limit optional for large data sets, the number of results to return - defaults to 100, upper limit set at 500
|
| 865 |
+
* @param string $since optional pull only messages since this time - use YYYY-MM-DD HH:II:SS format in <strong>GMT</strong>
|
| 866 |
+
* @return array the total matching orders and the specific orders for the requested page
|
| 867 |
+
* @returnf int total the total matching orders
|
| 868 |
+
* @returnf array data the actual data for each order being returned
|
| 869 |
+
string store_id the store id generated by the plugin used to uniquely identify a store
|
| 870 |
+
string store_name the store name collected by the plugin - often the domain name
|
| 871 |
+
string order_id the internal order id the store tracked this order by
|
| 872 |
+
string email the email address that received this campaign and is associated with this order
|
| 873 |
+
double order_total the order total
|
| 874 |
+
double tax_total the total tax for the order (if collected)
|
| 875 |
+
double ship_total the shipping total for the order (if collected)
|
| 876 |
+
string order_date the date the order was tracked - from the store if possible, otherwise the GMT time we recieved it
|
| 877 |
+
array lines containing detail of the order - product, category, quantity, item cost
|
| 878 |
+
*/
|
| 879 |
+
function campaignEcommOrders($cid, $start=0, $limit=100, $since=NULL) {
|
| 880 |
+
$params = array();
|
| 881 |
+
$params["cid"] = $cid;
|
| 882 |
+
$params["start"] = $start;
|
| 883 |
+
$params["limit"] = $limit;
|
| 884 |
+
$params["since"] = $since;
|
| 885 |
+
return $this->callServer("campaignEcommOrders", $params);
|
| 886 |
+
}
|
| 887 |
+
|
| 888 |
+
/**
|
| 889 |
+
* Get the URL to a customized <a href="http://eepurl.com/gKmL" target="_blank">VIP Report</a> for the specified campaign and optionally send an email to someone with links to it. Note subsequent calls will overwrite anything already set for the same campign (eg, the password)
|
| 890 |
+
*
|
| 891 |
+
* @section Campaign Related
|
| 892 |
+
*
|
| 893 |
+
* @param string $cid the campaign id to share a report for (can be gathered using campaigns())
|
| 894 |
+
* @param array $opts optional various parameters which can be used to configure the shared report
|
| 895 |
+
string header_type optional - "text" or "image', defaults to "text'
|
| 896 |
+
string header_data optional - if "header_type" is text, the text to display. if "header_type" is "image" a valid URL to an image file. Note that images will be resized to be no more than 500x150. Defaults to the Accounts Company Name.
|
| 897 |
+
boolean secure optional - whether to require a password for the shared report. defaults to "true"
|
| 898 |
+
string password optional - if secure is true and a password is not included, we will generate one. It is always returned.
|
| 899 |
+
string to_email optional - optional, email address to share the report with - no value means an email will not be sent
|
| 900 |
+
array theme optional - an array containing either 3 or 6 character color code values for: "bg_color", "header_color", "current_tab", "current_tab_text", "normal_tab", "normal_tab_text", "hover_tab", "hover_tab_text"
|
| 901 |
+
string css_url optional - a link to an external CSS file to be included after our default CSS (http://vip-reports.net/css/vip.css) <strong>only if</strong> loaded via the "secure_url" - max 255 bytes
|
| 902 |
+
* @return struct Struct containing details for the shared report
|
| 903 |
+
* @returnf string title The Title of the Campaign being shared
|
| 904 |
+
* @returnf string url The URL to the shared report
|
| 905 |
+
* @returnf string secure_url The URL to the shared report, including the password (good for loading in an IFRAME). For non-secure reports, this will not be returned
|
| 906 |
+
* @returnf string password If secured, the password for the report, otherwise this field will not be returned
|
| 907 |
+
*/
|
| 908 |
+
function campaignShareReport($cid, $opts=array (
|
| 909 |
+
)) {
|
| 910 |
+
$params = array();
|
| 911 |
+
$params["cid"] = $cid;
|
| 912 |
+
$params["opts"] = $opts;
|
| 913 |
+
return $this->callServer("campaignShareReport", $params);
|
| 914 |
+
}
|
| 915 |
+
|
| 916 |
+
/**
|
| 917 |
+
* Get the content (both html and text) for a campaign either as it would appear in the campaign archive or as the raw, original content
|
| 918 |
+
*
|
| 919 |
+
* @section Campaign Related
|
| 920 |
+
*
|
| 921 |
+
* @param string $cid the campaign id to get content for (can be gathered using campaigns())
|
| 922 |
+
* @param bool $for_archive optional controls whether we return the Archive version (true) or the Raw version (false), defaults to true
|
| 923 |
+
* @return struct Struct containing all content for the campaign (see Returned Fields for details
|
| 924 |
+
* @returnf string html The HTML content used for the campgain with merge tags intact
|
| 925 |
+
* @returnf string text The Text content used for the campgain with merge tags intact
|
| 926 |
+
*/
|
| 927 |
+
function campaignContent($cid, $for_archive=true) {
|
| 928 |
+
$params = array();
|
| 929 |
+
$params["cid"] = $cid;
|
| 930 |
+
$params["for_archive"] = $for_archive;
|
| 931 |
+
return $this->callServer("campaignContent", $params);
|
| 932 |
+
}
|
| 933 |
+
|
| 934 |
+
/**
|
| 935 |
+
* Get the HTML template content sections for a campaign. Note that this <strong>will</strong> return very jagged, non-standard results based on the template
|
| 936 |
+
* a campaign is using. You only want to use this if you want to allow editing template sections in your applicaton.
|
| 937 |
+
*
|
| 938 |
+
* @section Campaign Related
|
| 939 |
+
*
|
| 940 |
+
* @param string $cid the campaign id to get content for (can be gathered using campaigns())
|
| 941 |
+
* @return array array containing all content section for the campaign -
|
| 942 |
+
*/
|
| 943 |
+
function campaignTemplateContent($cid) {
|
| 944 |
+
$params = array();
|
| 945 |
+
$params["cid"] = $cid;
|
| 946 |
+
return $this->callServer("campaignTemplateContent", $params);
|
| 947 |
+
}
|
| 948 |
+
|
| 949 |
+
/**
|
| 950 |
+
* Retrieve the list of email addresses that opened a given campaign with how many times they opened - note: this AIM function is free and does
|
| 951 |
+
* not actually require the AIM module to be installed
|
| 952 |
+
*
|
| 953 |
+
* @section Campaign Report Data
|
| 954 |
+
*
|
| 955 |
+
* @param string $cid the campaign id to get opens for (can be gathered using campaigns())
|
| 956 |
+
* @param int $start optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)
|
| 957 |
+
* @param int $limit optional for large data sets, the number of results to return - defaults to 1000, upper limit set at 15000
|
| 958 |
+
* @return array array containing the total records matched and the specific records for this page
|
| 959 |
+
* @returnf int total the total number of records matched
|
| 960 |
+
* @returnf array data the actual opens data, including:
|
| 961 |
+
string email Email address that opened the campaign
|
| 962 |
+
int open_count Total number of times the campaign was opened by this email address
|
| 963 |
+
*/
|
| 964 |
+
function campaignOpenedAIM($cid, $start=0, $limit=1000) {
|
| 965 |
+
$params = array();
|
| 966 |
+
$params["cid"] = $cid;
|
| 967 |
+
$params["start"] = $start;
|
| 968 |
+
$params["limit"] = $limit;
|
| 969 |
+
return $this->callServer("campaignOpenedAIM", $params);
|
| 970 |
+
}
|
| 971 |
+
|
| 972 |
+
/**
|
| 973 |
+
* Retrieve the list of email addresses that did not open a given campaign
|
| 974 |
+
*
|
| 975 |
+
* @section Campaign Report Data
|
| 976 |
+
*
|
| 977 |
+
* @param string $cid the campaign id to get no opens for (can be gathered using campaigns())
|
| 978 |
+
* @param int $start optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)
|
| 979 |
+
* @param int $limit optional for large data sets, the number of results to return - defaults to 1000, upper limit set at 15000
|
| 980 |
+
* @return array array containing the total records matched and the specific records for this page
|
| 981 |
+
* @returnf int total the total number of records matched
|
| 982 |
+
* @returnf array data the email addresses that did not open the campaign
|
| 983 |
+
string email Email address that opened the campaign
|
| 984 |
+
*/
|
| 985 |
+
function campaignNotOpenedAIM($cid, $start=0, $limit=1000) {
|
| 986 |
+
$params = array();
|
| 987 |
+
$params["cid"] = $cid;
|
| 988 |
+
$params["start"] = $start;
|
| 989 |
+
$params["limit"] = $limit;
|
| 990 |
+
return $this->callServer("campaignNotOpenedAIM", $params);
|
| 991 |
+
}
|
| 992 |
+
|
| 993 |
+
/**
|
| 994 |
+
* Return the list of email addresses that clicked on a given url, and how many times they clicked
|
| 995 |
+
*
|
| 996 |
+
* @section Campaign Report Data
|
| 997 |
+
*
|
| 998 |
+
* @param string $cid the campaign id to get click stats for (can be gathered using campaigns())
|
| 999 |
+
* @param string $url the URL of the link that was clicked on
|
| 1000 |
+
* @param int $start optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)
|
| 1001 |
+
* @param int $limit optional for large data sets, the number of results to return - defaults to 1000, upper limit set at 15000
|
| 1002 |
+
* @return array array containing the total records matched and the specific records for this page
|
| 1003 |
+
* @returnf int total the total number of records matched
|
| 1004 |
+
* @returnf array data the email addresses that did not open the campaign
|
| 1005 |
+
string email Email address that opened the campaign
|
| 1006 |
+
int clicks Total number of times the URL was clicked on by this email address
|
| 1007 |
+
*/
|
| 1008 |
+
function campaignClickDetailAIM($cid, $url, $start=0, $limit=1000) {
|
| 1009 |
+
$params = array();
|
| 1010 |
+
$params["cid"] = $cid;
|
| 1011 |
+
$params["url"] = $url;
|
| 1012 |
+
$params["start"] = $start;
|
| 1013 |
+
$params["limit"] = $limit;
|
| 1014 |
+
return $this->callServer("campaignClickDetailAIM", $params);
|
| 1015 |
+
}
|
| 1016 |
+
|
| 1017 |
+
/**
|
| 1018 |
+
* Given a campaign and email address, return the entire click and open history with timestamps, ordered by time
|
| 1019 |
+
*
|
| 1020 |
+
* @section Campaign Report Data
|
| 1021 |
+
*
|
| 1022 |
+
* @param string $cid the campaign id to get stats for (can be gathered using campaigns())
|
| 1023 |
+
* @param array $email_address an array of up to 50 email addresses to check OR the email "id" returned from listMemberInfo, Webhooks, and Campaigns. For backwards compatibility, if a string is passed, it will be treated as an array with a single element (will not work with XML-RPC).
|
| 1024 |
+
* @return array an array with the keys listed in Returned Fields below
|
| 1025 |
+
* @returnf int success the number of email address records found
|
| 1026 |
+
* @returnf int error the number of email address records which could not be found
|
| 1027 |
+
* @returnf array data arrays containing the actions (opens and clicks) that the email took, with timestamps
|
| 1028 |
+
string action The action taken (open or click)
|
| 1029 |
+
string timestamp Time the action occurred
|
| 1030 |
+
string url For clicks, the URL that was clicked
|
| 1031 |
+
*/
|
| 1032 |
+
function campaignEmailStatsAIM($cid, $email_address) {
|
| 1033 |
+
$params = array();
|
| 1034 |
+
$params["cid"] = $cid;
|
| 1035 |
+
$params["email_address"] = $email_address;
|
| 1036 |
+
return $this->callServer("campaignEmailStatsAIM", $params);
|
| 1037 |
+
}
|
| 1038 |
+
|
| 1039 |
+
/**
|
| 1040 |
+
* Given a campaign and correct paging limits, return the entire click and open history with timestamps, ordered by time,
|
| 1041 |
+
* for every user a campaign was delivered to.
|
| 1042 |
+
*
|
| 1043 |
+
* @section Campaign Report Data
|
| 1044 |
+
* @example mcapi_campaignEmailStatsAIMAll.php
|
| 1045 |
+
*
|
| 1046 |
+
* @param string $cid the campaign id to get stats for (can be gathered using campaigns())
|
| 1047 |
+
* @param int $start optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)
|
| 1048 |
+
* @param int $limit optional for large data sets, the number of results to return - defaults to 100, upper limit set at 1000
|
| 1049 |
+
* @return array Array containing a total record count and data including the actions (opens and clicks) for each email, with timestamps
|
| 1050 |
+
* @returnf int total the total number of records
|
| 1051 |
+
* @returnf array data each record with their details:
|
| 1052 |
+
string action The action taken (open or click)
|
| 1053 |
+
string timestamp Time the action occurred
|
| 1054 |
+
string url For clicks, the URL that was clicked
|
| 1055 |
+
*/
|
| 1056 |
+
function campaignEmailStatsAIMAll($cid, $start=0, $limit=100) {
|
| 1057 |
+
$params = array();
|
| 1058 |
+
$params["cid"] = $cid;
|
| 1059 |
+
$params["start"] = $start;
|
| 1060 |
+
$params["limit"] = $limit;
|
| 1061 |
+
return $this->callServer("campaignEmailStatsAIMAll", $params);
|
| 1062 |
+
}
|
| 1063 |
+
|
| 1064 |
+
/**
|
| 1065 |
+
* Attach Ecommerce Order Information to a Campaign. This will generall be used by ecommerce package plugins
|
| 1066 |
+
* <a href="/plugins/ecomm360.phtml">that we provide</a> or by 3rd part system developers.
|
| 1067 |
+
* @section Campaign Related
|
| 1068 |
+
*
|
| 1069 |
+
* @param array $order an array of information pertaining to the order that has completed. Use the following keys:
|
| 1070 |
+
string id the Order Id
|
| 1071 |
+
string campaign_id the Campaign Id to track this order with (see the "mc_cid" query string variable a campaign passes)
|
| 1072 |
+
string email_id the Email Id of the subscriber we should attach this order to (see the "mc_eid" query string variable a campaign passes)
|
| 1073 |
+
double total The Order Total (ie, the full amount the customer ends up paying)
|
| 1074 |
+
string order_date optional the date of the order - if this is not provided, we will default the date to now
|
| 1075 |
+
double shipping optional the total paid for Shipping Fees
|
| 1076 |
+
double tax optional the total tax paid
|
| 1077 |
+
string store_id a unique id for the store sending the order in (20 bytes max)
|
| 1078 |
+
string store_name optional a "nice" name for the store - typically the base web address (ie, "store.mailchimp.com"). We will automatically update this if it changes (based on store_id)
|
| 1079 |
+
string plugin_id the MailChimp assigned Plugin Id. Get yours by <a href="/register.php">registering here</a>
|
| 1080 |
+
array items the individual line items for an order using these keys:
|
| 1081 |
+
<div style="padding-left:30px"><table><tr><td colspan=*>
|
| 1082 |
+
int line_num optional the line number of the item on the order. We will generate these if they are not passed
|
| 1083 |
+
int product_id the store's internal Id for the product. Lines that do no contain this will be skipped
|
| 1084 |
+
string product_name the product name for the product_id associated with this item. We will auto update these as they change (based on product_id)
|
| 1085 |
+
int category_id the store's internal Id for the (main) category associated with this product. Our testing has found this to be a "best guess" scenario
|
| 1086 |
+
string category_name the category name for the category_id this product is in. Our testing has found this to be a "best guess" scenario. Our plugins walk the category heirarchy up and send "Root - SubCat1 - SubCat4", etc.
|
| 1087 |
+
double qty the quantity of the item ordered
|
| 1088 |
+
double cost the cost of a single item (ie, not the extended cost of the line)
|
| 1089 |
+
</td></tr></table></div>
|
| 1090 |
+
* @return bool true if the data is saved, otherwise an error is thrown.
|
| 1091 |
+
*/
|
| 1092 |
+
function campaignEcommOrderAdd($order) {
|
| 1093 |
+
$params = array();
|
| 1094 |
+
$params["order"] = $order;
|
| 1095 |
+
return $this->callServer("campaignEcommOrderAdd", $params);
|
| 1096 |
+
}
|
| 1097 |
+
|
| 1098 |
+
/**
|
| 1099 |
+
* Retrieve all of the lists defined for your user account
|
| 1100 |
+
*
|
| 1101 |
+
* @section List Related
|
| 1102 |
+
* @example mcapi_lists.php
|
| 1103 |
+
* @example xml-rpc_lists.php
|
| 1104 |
+
*
|
| 1105 |
+
* @param array $filters a hash of filters to apply to this query - all are optional:
|
| 1106 |
+
string list_id optional - return a single list using a known list_id. Accepts multiples separated by commas when not using exact matching
|
| 1107 |
+
string list_name optional - only lists that match this name
|
| 1108 |
+
string from_name optional - only lists that have a default from name matching this
|
| 1109 |
+
string from_email optional - only lists that have a default from email matching this
|
| 1110 |
+
string from_subject optional - only lists that have a default from email matching this
|
| 1111 |
+
string created_before optional - only show lists that were created before this date/time (in GMT) - format is YYYY-MM-DD HH:mm:ss (24hr)
|
| 1112 |
+
string created_after optional - only show lists that were created since this date/time (in GMT) - format is YYYY-MM-DD HH:mm:ss (24hr)
|
| 1113 |
+
boolean exact optional - flag for whether to filter on exact values when filtering, or search within content for filter values - defaults to true
|
| 1114 |
+
* @param int $start optional - control paging of lists, start results at this list #, defaults to 1st page of data (page 0)
|
| 1115 |
+
* @param int $limit optional - control paging of lists, number of lists to return with each call, defaults to 25 (max=100)
|
| 1116 |
+
* @return array an array with keys listed in Returned Fields below
|
| 1117 |
+
* @returnf int total the total number of lists which matched the provided filters
|
| 1118 |
+
* @returnf array data the lists which matched the provided filters, including the following for
|
| 1119 |
+
string id The list id for this list. This will be used for all other list management functions.
|
| 1120 |
+
int web_id The list id used in our web app, allows you to create a link directly to it
|
| 1121 |
+
string name The name of the list.
|
| 1122 |
+
string date_created The date that this list was created.
|
| 1123 |
+
boolean email_type_option Whether or not the List supports multiple formats for emails or just HTML
|
| 1124 |
+
boolean use_awesomebar Whether or not campaigns for this list use the Awesome Bar in archives by default
|
| 1125 |
+
string default_from_name Default From Name for campaigns using this list
|
| 1126 |
+
string default_from_email Default From Email for campaigns using this list
|
| 1127 |
+
string default_subject Default Subject Line for campaigns using this list
|
| 1128 |
+
string default_language Default Language for this list's forms
|
| 1129 |
+
int list_rating An auto-generated activity score for the list (0 - 5)
|
| 1130 |
+
array stats various stats and counts for the list
|
| 1131 |
+
int member_count The number of active members in the given list.
|
| 1132 |
+
int unsubscribe_count The number of members who have unsubscribed from the given list.
|
| 1133 |
+
int cleaned_count The number of members cleaned from the given list.
|
| 1134 |
+
int member_count_since_send The number of active members in the given list since the last campaign was sent
|
| 1135 |
+
int unsubscribe_count_since_send The number of members who have unsubscribed from the given list since the last campaign was sent
|
| 1136 |
+
int cleaned_count_since_send The number of members cleaned from the given list since the last campaign was sent
|
| 1137 |
+
int campaign_count The number of campaigns in any status that use this list
|
| 1138 |
+
int grouping_count The number of Interest Groupings for this list
|
| 1139 |
+
int group_count The number of Interest Groups (regardless of grouping) for this list
|
| 1140 |
+
int merge_var_count The number of merge vars for this list (not including the required EMAIL one)
|
| 1141 |
+
int avg_sub_rate the average number of subscribe per month for the list (empty value if we haven't calculated this yet)
|
| 1142 |
+
int avg_unsub_rate the average number of unsubscribe per month for the list (empty value if we haven't calculated this yet)
|
| 1143 |
+
int target_sub_rate the target subscription rate for the list to keep it growing (empty value if we haven't calculated this yet)
|
| 1144 |
+
int open_rate the average open rate per campaign for the list (empty value if we haven't calculated this yet)
|
| 1145 |
+
int click_rate the average click rate per campaign for the list (empty value if we haven't calculated this yet)
|
| 1146 |
+
array modules Any list specific modules installed for this list (example is SocialPro)
|
| 1147 |
+
*/
|
| 1148 |
+
function lists($filters=array (
|
| 1149 |
+
), $start=0, $limit=25) {
|
| 1150 |
+
$params = array();
|
| 1151 |
+
$params["filters"] = $filters;
|
| 1152 |
+
$params["start"] = $start;
|
| 1153 |
+
$params["limit"] = $limit;
|
| 1154 |
+
return $this->callServer("lists", $params);
|
| 1155 |
+
}
|
| 1156 |
+
|
| 1157 |
+
/**
|
| 1158 |
+
* Get the list of merge tags for a given list, including their name, tag, and required setting
|
| 1159 |
+
*
|
| 1160 |
+
* @section List Related
|
| 1161 |
+
* @example xml-rpc_listMergeVars.php
|
| 1162 |
+
*
|
| 1163 |
+
* @param string $id the list id to connect to. Get by calling lists()
|
| 1164 |
+
* @return array list of merge tags for the list
|
| 1165 |
+
* @returnf string name Name of the merge field
|
| 1166 |
+
* @returnf bool req Denotes whether the field is required (true) or not (false)
|
| 1167 |
+
* @returnf string field_type The "data type" of this merge var. One of: email, text, number, radio, dropdown, date, address, phone, url, imageurl
|
| 1168 |
+
* @returnf bool public Whether or not this field is visible to list subscribers
|
| 1169 |
+
* @returnf bool show Whether the list owner has this field displayed on their list dashboard
|
| 1170 |
+
* @returnf string order The order the list owner has set this field to display in
|
| 1171 |
+
* @returnf string default The default value the list owner has set for this field
|
| 1172 |
+
* @returnf string size The width of the field to be used
|
| 1173 |
+
* @returnf string tag The merge tag that's used for forms and listSubscribe() and listUpdateMember()
|
| 1174 |
+
* @returnf array choices For radio and dropdown field types, an array of the options available
|
| 1175 |
+
*/
|
| 1176 |
+
function listMergeVars($id) {
|
| 1177 |
+
$params = array();
|
| 1178 |
+
$params["id"] = $id;
|
| 1179 |
+
return $this->callServer("listMergeVars", $params);
|
| 1180 |
+
}
|
| 1181 |
+
|
| 1182 |
+
/**
|
| 1183 |
+
* Add a new merge tag to a given list
|
| 1184 |
+
*
|
| 1185 |
+
* @section List Related
|
| 1186 |
+
* @example xml-rpc_listMergeVarAdd.php
|
| 1187 |
+
*
|
| 1188 |
+
* @param string $id the list id to connect to. Get by calling lists()
|
| 1189 |
+
* @param string $tag The merge tag to add, e.g. FNAME
|
| 1190 |
+
* @param string $name The long description of the tag being added, used for user displays
|
| 1191 |
+
* @param array $options optional Various options for this merge var. <em>note:</em> for historical purposes this can also take a "boolean"
|
| 1192 |
+
string field_type optional one of: text, number, radio, dropdown, date, address, phone, url, imageurl - defaults to text
|
| 1193 |
+
boolean req optional indicates whether the field is required - defaults to false
|
| 1194 |
+
boolean public optional indicates whether the field is displayed in public - defaults to true
|
| 1195 |
+
boolean show optional indicates whether the field is displayed in the app's list member view - defaults to true
|
| 1196 |
+
string default_value optional the default value for the field. See listSubscribe() for formatting info. Defaults to blank
|
| 1197 |
+
array choices optional kind of - an array of strings to use as the choices for radio and dropdown type fields
|
| 1198 |
+
|
| 1199 |
+
* @return bool true if the request succeeds, otherwise an error will be thrown
|
| 1200 |
+
*/
|
| 1201 |
+
function listMergeVarAdd($id, $tag, $name, $options=array (
|
| 1202 |
+
)) {
|
| 1203 |
+
$params = array();
|
| 1204 |
+
$params["id"] = $id;
|
| 1205 |
+
$params["tag"] = $tag;
|
| 1206 |
+
$params["name"] = $name;
|
| 1207 |
+
$params["options"] = $options;
|
| 1208 |
+
return $this->callServer("listMergeVarAdd", $params);
|
| 1209 |
+
}
|
| 1210 |
+
|
| 1211 |
+
/**
|
| 1212 |
+
* Update most parameters for a merge tag on a given list. You cannot currently change the merge type
|
| 1213 |
+
*
|
| 1214 |
+
* @section List Related
|
| 1215 |
+
*
|
| 1216 |
+
* @param string $id the list id to connect to. Get by calling lists()
|
| 1217 |
+
* @param string $tag The merge tag to update
|
| 1218 |
+
* @param array $options The options to change for a merge var. See listMergeVarAdd() for valid options
|
| 1219 |
+
* @return bool true if the request succeeds, otherwise an error will be thrown
|
| 1220 |
+
*/
|
| 1221 |
+
function listMergeVarUpdate($id, $tag, $options) {
|
| 1222 |
+
$params = array();
|
| 1223 |
+
$params["id"] = $id;
|
| 1224 |
+
$params["tag"] = $tag;
|
| 1225 |
+
$params["options"] = $options;
|
| 1226 |
+
return $this->callServer("listMergeVarUpdate", $params);
|
| 1227 |
+
}
|
| 1228 |
+
|
| 1229 |
+
/**
|
| 1230 |
+
* Delete a merge tag from a given list and all its members. Seriously - the data is removed from all members as well!
|
| 1231 |
+
* Note that on large lists this method may seem a bit slower than calls you typically make.
|
| 1232 |
+
*
|
| 1233 |
+
* @section List Related
|
| 1234 |
+
* @example xml-rpc_listMergeVarDel.php
|
| 1235 |
+
*
|
| 1236 |
+
* @param string $id the list id to connect to. Get by calling lists()
|
| 1237 |
+
* @param string $tag The merge tag to delete
|
| 1238 |
+
* @return bool true if the request succeeds, otherwise an error will be thrown
|
| 1239 |
+
*/
|
| 1240 |
+
function listMergeVarDel($id, $tag) {
|
| 1241 |
+
$params = array();
|
| 1242 |
+
$params["id"] = $id;
|
| 1243 |
+
$params["tag"] = $tag;
|
| 1244 |
+
return $this->callServer("listMergeVarDel", $params);
|
| 1245 |
+
}
|
| 1246 |
+
|
| 1247 |
+
/**
|
| 1248 |
+
* Get the list of interest groupings for a given list, including the label, form information, and included groups for each
|
| 1249 |
+
*
|
| 1250 |
+
* @section List Related
|
| 1251 |
+
* @example xml-rpc_listInterestGroupings.php
|
| 1252 |
+
*
|
| 1253 |
+
* @param string $id the list id to connect to. Get by calling lists()
|
| 1254 |
+
* @return struct list of interest groups for the list
|
| 1255 |
+
* @returnf string id The id for the Grouping
|
| 1256 |
+
* @returnf string name Name for the Interest groups
|
| 1257 |
+
* @returnf string form_field Gives the type of interest group: checkbox,radio,select
|
| 1258 |
+
* @returnf array groups Array of the grouping options including the "bit" value, "name", "display_order", and number of "subscribers" with the option selected.
|
| 1259 |
+
*/
|
| 1260 |
+
function listInterestGroupings($id) {
|
| 1261 |
+
$params = array();
|
| 1262 |
+
$params["id"] = $id;
|
| 1263 |
+
return $this->callServer("listInterestGroupings", $params);
|
| 1264 |
+
}
|
| 1265 |
+
|
| 1266 |
+
/** Add a single Interest Group - if interest groups for the List are not yet enabled, adding the first
|
| 1267 |
+
* group will automatically turn them on.
|
| 1268 |
+
*
|
| 1269 |
+
* @section List Related
|
| 1270 |
+
* @example xml-rpc_listInterestGroupAdd.php
|
| 1271 |
+
*
|
| 1272 |
+
* @param string $id the list id to connect to. Get by calling lists()
|
| 1273 |
+
* @param string $group_name the interest group to add - group names must be unique within a grouping
|
| 1274 |
+
* @param int optional $grouping_id The grouping to add the new group to - get using listInterestGrouping() . If not supplied, the first grouping on the list is used.
|
| 1275 |
+
* @return bool true if the request succeeds, otherwise an error will be thrown
|
| 1276 |
+
*/
|
| 1277 |
+
function listInterestGroupAdd($id, $group_name, $grouping_id=NULL) {
|
| 1278 |
+
$params = array();
|
| 1279 |
+
$params["id"] = $id;
|
| 1280 |
+
$params["group_name"] = $group_name;
|
| 1281 |
+
$params["grouping_id"] = $grouping_id;
|
| 1282 |
+
return $this->callServer("listInterestGroupAdd", $params);
|
| 1283 |
+
}
|
| 1284 |
+
|
| 1285 |
+
/** Delete a single Interest Group - if the last group for a list is deleted, this will also turn groups for the list off.
|
| 1286 |
+
*
|
| 1287 |
+
* @section List Related
|
| 1288 |
+
* @example xml-rpc_listInterestGroupDel.php
|
| 1289 |
+
*
|
| 1290 |
+
* @param string $id the list id to connect to. Get by calling lists()
|
| 1291 |
+
* @param string $group_name the interest group to delete
|
| 1292 |
+
* @param int $grouping_id The grouping to delete the group from - get using listInterestGrouping() . If not supplied, the first grouping on the list is used.
|
| 1293 |
+
* @return bool true if the request succeeds, otherwise an error will be thrown
|
| 1294 |
+
*/
|
| 1295 |
+
function listInterestGroupDel($id, $group_name, $grouping_id=NULL) {
|
| 1296 |
+
$params = array();
|
| 1297 |
+
$params["id"] = $id;
|
| 1298 |
+
$params["group_name"] = $group_name;
|
| 1299 |
+
$params["grouping_id"] = $grouping_id;
|
| 1300 |
+
return $this->callServer("listInterestGroupDel", $params);
|
| 1301 |
+
}
|
| 1302 |
+
|
| 1303 |
+
/** Change the name of an Interest Group
|
| 1304 |
+
*
|
| 1305 |
+
* @section List Related
|
| 1306 |
+
*
|
| 1307 |
+
* @param string $id the list id to connect to. Get by calling lists()
|
| 1308 |
+
* @param string $old_name the interest group name to be changed
|
| 1309 |
+
* @param string $new_name the new interest group name to be set
|
| 1310 |
+
* @param int optional $grouping_id The grouping to delete the group from - get using listInterestGrouping() . If not supplied, the first grouping on the list is used.
|
| 1311 |
+
* @return bool true if the request succeeds, otherwise an error will be thrown
|
| 1312 |
+
*/
|
| 1313 |
+
function listInterestGroupUpdate($id, $old_name, $new_name, $grouping_id=NULL) {
|
| 1314 |
+
$params = array();
|
| 1315 |
+
$params["id"] = $id;
|
| 1316 |
+
$params["old_name"] = $old_name;
|
| 1317 |
+
$params["new_name"] = $new_name;
|
| 1318 |
+
$params["grouping_id"] = $grouping_id;
|
| 1319 |
+
return $this->callServer("listInterestGroupUpdate", $params);
|
| 1320 |
+
}
|
| 1321 |
+
|
| 1322 |
+
/** Add a new Interest Grouping - if interest groups for the List are not yet enabled, adding the first
|
| 1323 |
+
* grouping will automatically turn them on.
|
| 1324 |
+
*
|
| 1325 |
+
* @section List Related
|
| 1326 |
+
* @example xml-rpc_listInterestGroupingAdd.php
|
| 1327 |
+
*
|
| 1328 |
+
* @param string $id the list id to connect to. Get by calling lists()
|
| 1329 |
+
* @param string $name the interest grouping to add - grouping names must be unique
|
| 1330 |
+
* @param string $type The type of the grouping to add - one of "checkboxes", "hidden", "dropdown", "radio"
|
| 1331 |
+
* @param array $groups The lists of initial group names to be added - at least 1 is required and the names must be unique within a grouping. If the number takes you over the 60 group limit, an error will be thrown.
|
| 1332 |
+
* @return int the new grouping id if the request succeeds, otherwise an error will be thrown
|
| 1333 |
+
*/
|
| 1334 |
+
function listInterestGroupingAdd($id, $name, $type, $groups) {
|
| 1335 |
+
$params = array();
|
| 1336 |
+
$params["id"] = $id;
|
| 1337 |
+
$params["name"] = $name;
|
| 1338 |
+
$params["type"] = $type;
|
| 1339 |
+
$params["groups"] = $groups;
|
| 1340 |
+
return $this->callServer("listInterestGroupingAdd", $params);
|
| 1341 |
+
}
|
| 1342 |
+
|
| 1343 |
+
/** Update an existing Interest Grouping
|
| 1344 |
+
*
|
| 1345 |
+
* @section List Related
|
| 1346 |
+
* @example xml-rpc_listInterestGroupingUpdate.php
|
| 1347 |
+
*
|
| 1348 |
+
* @param int $grouping_id the interest grouping id - get from listInterestGroupings()
|
| 1349 |
+
* @param string $name The name of the field to update - either "name" or "type". Groups with in the grouping should be manipulated using the standard listInterestGroup* methods
|
| 1350 |
+
* @param string $value The new value of the field. Grouping names must be unique - only "hidden" and "checkboxes" grouping types can be converted between each other.
|
| 1351 |
+
* @return bool true if the request succeeds, otherwise an error will be thrown
|
| 1352 |
+
*/
|
| 1353 |
+
function listInterestGroupingUpdate($grouping_id, $name, $value) {
|
| 1354 |
+
$params = array();
|
| 1355 |
+
$params["grouping_id"] = $grouping_id;
|
| 1356 |
+
$params["name"] = $name;
|
| 1357 |
+
$params["value"] = $value;
|
| 1358 |
+
return $this->callServer("listInterestGroupingUpdate", $params);
|
| 1359 |
+
}
|
| 1360 |
+
|
| 1361 |
+
/** Delete an existing Interest Grouping - this will permanently delete all contained interest groups and will remove those selections from all list members
|
| 1362 |
+
*
|
| 1363 |
+
* @section List Related
|
| 1364 |
+
* @example xml-rpc_listInterestGroupingDel.php
|
| 1365 |
+
*
|
| 1366 |
+
* @param int $grouping_id the interest grouping id - get from listInterestGroupings()
|
| 1367 |
+
* @return bool true if the request succeeds, otherwise an error will be thrown
|
| 1368 |
+
*/
|
| 1369 |
+
function listInterestGroupingDel($grouping_id) {
|
| 1370 |
+
$params = array();
|
| 1371 |
+
$params["grouping_id"] = $grouping_id;
|
| 1372 |
+
return $this->callServer("listInterestGroupingDel", $params);
|
| 1373 |
+
}
|
| 1374 |
+
|
| 1375 |
+
/** Return the Webhooks configured for the given list
|
| 1376 |
+
*
|
| 1377 |
+
* @section List Related
|
| 1378 |
+
*
|
| 1379 |
+
* @param string $id the list id to connect to. Get by calling lists()
|
| 1380 |
+
* @return array list of webhooks
|
| 1381 |
+
* @returnf string url the URL for this Webhook
|
| 1382 |
+
* @returnf array actions the possible actions and whether they are enabled
|
| 1383 |
+
* @returnf array sources the possible sources and whether they are enabled
|
| 1384 |
+
*/
|
| 1385 |
+
function listWebhooks($id) {
|
| 1386 |
+
$params = array();
|
| 1387 |
+
$params["id"] = $id;
|
| 1388 |
+
return $this->callServer("listWebhooks", $params);
|
| 1389 |
+
}
|
| 1390 |
+
|
| 1391 |
+
/** Add a new Webhook URL for the given list
|
| 1392 |
+
*
|
| 1393 |
+
* @section List Related
|
| 1394 |
+
*
|
| 1395 |
+
* @param string $id the list id to connect to. Get by calling lists()
|
| 1396 |
+
* @param string $url a valid URL for the Webhook - it will be validated. note that a url may only exist on a list once.
|
| 1397 |
+
* @param array $actions optional a hash of actions to fire this Webhook for
|
| 1398 |
+
boolean subscribe optional as subscribes occur, defaults to true
|
| 1399 |
+
boolean unsubscribe optional as subscribes occur, defaults to true
|
| 1400 |
+
boolean profile optional as profile updates occur, defaults to true
|
| 1401 |
+
boolean cleaned optional as emails are cleaned from the list, defaults to true
|
| 1402 |
+
boolean upemail optional when subscribers change their email address, defaults to true
|
| 1403 |
+
* @param array $sources optional a hash of sources to fire this Webhook for
|
| 1404 |
+
boolean user optional user/subscriber initiated actions, defaults to true
|
| 1405 |
+
boolean admin optional admin actions in our web app, defaults to true
|
| 1406 |
+
boolean api optional actions that happen via API calls, defaults to false
|
| 1407 |
+
* @return bool true if the call succeeds, otherwise an exception will be thrown
|
| 1408 |
+
*/
|
| 1409 |
+
function listWebhookAdd($id, $url, $actions=array (
|
| 1410 |
+
), $sources=array (
|
| 1411 |
+
)) {
|
| 1412 |
+
$params = array();
|
| 1413 |
+
$params["id"] = $id;
|
| 1414 |
+
$params["url"] = $url;
|
| 1415 |
+
$params["actions"] = $actions;
|
| 1416 |
+
$params["sources"] = $sources;
|
| 1417 |
+
return $this->callServer("listWebhookAdd", $params);
|
| 1418 |
+
}
|
| 1419 |
+
|
| 1420 |
+
/** Delete an existing Webhook URL from a given list
|
| 1421 |
+
*
|
| 1422 |
+
* @section List Related
|
| 1423 |
+
*
|
| 1424 |
+
* @param string $id the list id to connect to. Get by calling lists()
|
| 1425 |
+
* @param string $url the URL of a Webhook on this list
|
| 1426 |
+
* @return boolean true if the call succeeds, otherwise an exception will be thrown
|
| 1427 |
+
*/
|
| 1428 |
+
function listWebhookDel($id, $url) {
|
| 1429 |
+
$params = array();
|
| 1430 |
+
$params["id"] = $id;
|
| 1431 |
+
$params["url"] = $url;
|
| 1432 |
+
return $this->callServer("listWebhookDel", $params);
|
| 1433 |
+
}
|
| 1434 |
+
|
| 1435 |
+
/** Retrieve all of the Static Segments for a list.
|
| 1436 |
+
*
|
| 1437 |
+
* @section List Related
|
| 1438 |
+
*
|
| 1439 |
+
* @param string $id the list id to connect to. Get by calling lists()
|
| 1440 |
+
* @return array an array of parameters for each static segment
|
| 1441 |
+
* @returnf int id the id of the segment
|
| 1442 |
+
* @returnf string name the name for the segment
|
| 1443 |
+
* @returnf int member_count the total number of members currently in a segment
|
| 1444 |
+
* @returnf date created_date the date/time the segment was created
|
| 1445 |
+
* @returnf date last_update the date/time the segment was last updated (add or del)
|
| 1446 |
+
* @returnf date last_reset the date/time the segment was last reset (ie had all members cleared from it)
|
| 1447 |
+
*/
|
| 1448 |
+
function listStaticSegments($id) {
|
| 1449 |
+
$params = array();
|
| 1450 |
+
$params["id"] = $id;
|
| 1451 |
+
return $this->callServer("listStaticSegments", $params);
|
| 1452 |
+
}
|
| 1453 |
+
|
| 1454 |
+
/** Save a segment against a list for later use. There is no limit to the number of segments which can be saved. Static Segments <strong>are not</strong> tied
|
| 1455 |
+
* to any merge data, interest groups, etc. They essentially allow you to configure an unlimited number of custom segments which will have standard performance.
|
| 1456 |
+
* When using proper segments, Static Segments are one of the available options for segmentation just as if you used a merge var (and they can be used with other segmentation
|
| 1457 |
+
* options), though performance may degrade at that point.
|
| 1458 |
+
*
|
| 1459 |
+
* @section List Related
|
| 1460 |
+
*
|
| 1461 |
+
* @param string $id the list id to connect to. Get by calling lists()
|
| 1462 |
+
* @param string $name a unique name per list for the segment - 50 byte maximum length, anything longer will throw an error
|
| 1463 |
+
* @return int the id of the new segment, otherwise an error will be thrown.
|
| 1464 |
+
*/
|
| 1465 |
+
function listStaticSegmentAdd($id, $name) {
|
| 1466 |
+
$params = array();
|
| 1467 |
+
$params["id"] = $id;
|
| 1468 |
+
$params["name"] = $name;
|
| 1469 |
+
return $this->callServer("listStaticSegmentAdd", $params);
|
| 1470 |
+
}
|
| 1471 |
+
|
| 1472 |
+
/** Resets a static segment - removes <strong>all</strong> members from the static segment. Note: does not actually affect list member data
|
| 1473 |
+
*
|
| 1474 |
+
* @section List Related
|
| 1475 |
+
*
|
| 1476 |
+
* @param string $id the list id to connect to. Get by calling lists()
|
| 1477 |
+
* @param int $seg_id the id of the static segment to reset - get from listStaticSegments()
|
| 1478 |
+
* @return bool true if it worked, otherwise an error is thrown.
|
| 1479 |
+
*/
|
| 1480 |
+
function listStaticSegmentReset($id, $seg_id) {
|
| 1481 |
+
$params = array();
|
| 1482 |
+
$params["id"] = $id;
|
| 1483 |
+
$params["seg_id"] = $seg_id;
|
| 1484 |
+
return $this->callServer("listStaticSegmentReset", $params);
|
| 1485 |
+
}
|
| 1486 |
+
|
| 1487 |
+
/** Delete a static segment. Note that this will, of course, remove any member affiliations with the segment
|
| 1488 |
+
*
|
| 1489 |
+
* @section List Related
|
| 1490 |
+
*
|
| 1491 |
+
* @param string $id the list id to connect to. Get by calling lists()
|
| 1492 |
+
* @param int $seg_id the id of the static segment to delete - get from listStaticSegments()
|
| 1493 |
+
* @return bool true if it worked, otherwise an error is thrown.
|
| 1494 |
+
*/
|
| 1495 |
+
function listStaticSegmentDel($id, $seg_id) {
|
| 1496 |
+
$params = array();
|
| 1497 |
+
$params["id"] = $id;
|
| 1498 |
+
$params["seg_id"] = $seg_id;
|
| 1499 |
+
return $this->callServer("listStaticSegmentDel", $params);
|
| 1500 |
+
}
|
| 1501 |
+
|
| 1502 |
+
/** Add list members to a static segment. It is suggested that you limit batch size to no more than 10,000 addresses per call. Email addresses must exist on the list
|
| 1503 |
+
* in order to be included - this <strong>will not</strong> subscribe them to the list!
|
| 1504 |
+
*
|
| 1505 |
+
* @section List Related
|
| 1506 |
+
*
|
| 1507 |
+
* @param string $id the list id to connect to. Get by calling lists()
|
| 1508 |
+
* @param int $seg_id the id of the static segment to modify - get from listStaticSegments()
|
| 1509 |
+
* @param array $batch an array of email addresses and/or unique_ids to add to the segment
|
| 1510 |
+
* @return array an array with the results of the operation
|
| 1511 |
+
* @returnf int success the total number of successful updates (will include members already in the segment)
|
| 1512 |
+
* @returnf array errors the email address, an error code, and a message explaining why they couldn't be added
|
| 1513 |
+
*/
|
| 1514 |
+
function listStaticSegmentMembersAdd($id, $seg_id, $batch) {
|
| 1515 |
+
$params = array();
|
| 1516 |
+
$params["id"] = $id;
|
| 1517 |
+
$params["seg_id"] = $seg_id;
|
| 1518 |
+
$params["batch"] = $batch;
|
| 1519 |
+
return $this->callServer("listStaticSegmentMembersAdd", $params);
|
| 1520 |
+
}
|
| 1521 |
+
|
| 1522 |
+
/** Remove list members from a static segment. It is suggested that you limit batch size to no more than 10,000 addresses per call. Email addresses must exist on the list
|
| 1523 |
+
* in order to be removed - this <strong>will not</strong> unsubscribe them from the list!
|
| 1524 |
+
*
|
| 1525 |
+
* @section List Related
|
| 1526 |
+
*
|
| 1527 |
+
* @param string $id the list id to connect to. Get by calling lists()
|
| 1528 |
+
* @param int $seg_id the id of the static segment to delete - get from listStaticSegments()
|
| 1529 |
+
* @param array $batch an array of email addresses and/or unique_ids to remove from the segment
|
| 1530 |
+
* @return array an array with the results of the operation
|
| 1531 |
+
* @returnf int success the total number of succesful removals
|
| 1532 |
+
* @returnf array errors the email address, an error code, and a message explaining why they couldn't be removed
|
| 1533 |
+
*/
|
| 1534 |
+
function listStaticSegmentMembersDel($id, $seg_id, $batch) {
|
| 1535 |
+
$params = array();
|
| 1536 |
+
$params["id"] = $id;
|
| 1537 |
+
$params["seg_id"] = $seg_id;
|
| 1538 |
+
$params["batch"] = $batch;
|
| 1539 |
+
return $this->callServer("listStaticSegmentMembersDel", $params);
|
| 1540 |
+
}
|
| 1541 |
+
|
| 1542 |
+
/**
|
| 1543 |
+
* Subscribe the provided email to a list. By default this sends a confirmation email - you will not see new members until the link contained in it is clicked!
|
| 1544 |
+
*
|
| 1545 |
+
* @section List Related
|
| 1546 |
+
*
|
| 1547 |
+
* @example mcapi_listSubscribe.php
|
| 1548 |
+
* @example json_listSubscribe.php
|
| 1549 |
+
* @example xml-rpc_listSubscribe.php
|
| 1550 |
+
*
|
| 1551 |
+
* @param string $id the list id to connect to. Get by calling lists()
|
| 1552 |
+
* @param string $email_address the email address to subscribe
|
| 1553 |
+
* @param array $merge_vars optional merges for the email (FNAME, LNAME, etc.) (see examples below for handling "blank" arrays). Note that a merge field can only hold up to 255 bytes. Also, there are a few "special" keys:
|
| 1554 |
+
string EMAIL set this to change the email address. This is only respected on calls using update_existing or when passed to listUpdateMember()
|
| 1555 |
+
array GROUPINGS Set Interest Groups by Grouping. Each element in this array should be an array containing the "groups" parameter which contains a comma delimited list of Interest Groups to add. Commas in Interest Group names should be escaped with a backslash. ie, "," => "\," and either an "id" or "name" parameter to specify the Grouping - get from listInterestGroupings()
|
| 1556 |
+
string OPTINIP Set the Opt-in IP fields. <em>Abusing this may cause your account to be suspended.</em> We do validate this and it must not be a private IP address.
|
| 1557 |
+
array MC_LOCATION Set the members geographic location. By default if this merge field exists, we'll update using the optin_ip if it exists. If the array contains LATITUDE and LONGITUDE keys, they will be used. NOTE - this will slow down each subscribe call a bit, especially for lat/lng pairs in sparsely populated areas. Currently our automated background processes can and will overwrite this based on opens and clicks.
|
| 1558 |
+
|
| 1559 |
+
<strong>Handling Field Data Types</strong> - most fields you can just pass a string and all is well. For some, though, that is not the case...
|
| 1560 |
+
Field values should be formatted as follows:
|
| 1561 |
+
string address For the string version of an Address, the fields should be delimited by <strong>2</strong> spaces. Address 2 can be skipped. The Country should be a 2 character ISO-3166-1 code and will default to your default country if not set
|
| 1562 |
+
array address For the array version of an Address, the requirements for Address 2 and Country are the same as with the string version. Then simply pass us an array with the keys <strong>addr1</strong>, <strong>addr2</strong>, <strong>city</strong>, <strong>state</strong>, <strong>zip</strong>, <strong>country</strong> and appropriate values for each
|
| 1563 |
+
|
| 1564 |
+
string date use YYYY-MM-DD to be safe. Generally, though, anything strtotime() understands we'll understand - <a href="http://us2.php.net/strtotime" target="_blank">http://us2.php.net/strtotime</a>
|
| 1565 |
+
string dropdown can be a normal string - we <em>will</em> validate that the value is a valid option
|
| 1566 |
+
string image must be a valid, existing url. we <em>will</em> check its existence
|
| 1567 |
+
string multi_choice can be a normal string - we <em>will</em> validate that the value is a valid option
|
| 1568 |
+
double number pass in a valid number - anything else will turn in to zero (0). Note, this will be rounded to 2 decimal places
|
| 1569 |
+
string phone If your account has the US Phone numbers option set, this <em>must</em> be in the form of NPA-NXX-LINE (404-555-1212). If not, we assume an International number and will simply set the field with what ever number is passed in.
|
| 1570 |
+
string website This is a standard string, but we <em>will</em> verify that it looks like a valid URL
|
| 1571 |
+
|
| 1572 |
+
* @param string $email_type optional email type preference for the email (html, text, or mobile defaults to html)
|
| 1573 |
+
* @param bool $double_optin optional flag to control whether a double opt-in confirmation message is sent, defaults to true. <em>Abusing this may cause your account to be suspended.</em>
|
| 1574 |
+
* @param bool $update_existing optional flag to control whether a existing subscribers should be updated instead of throwing and error, defaults to false
|
| 1575 |
+
* @param bool $replace_interests optional flag to determine whether we replace the interest groups with the groups provided, or we add the provided groups to the member's interest groups (optional, defaults to true)
|
| 1576 |
+
* @param bool $send_welcome optional if your double_optin is false and this is true, we will send your lists Welcome Email if this subscribe succeeds - this will *not* fire if we end up updating an existing subscriber. If double_optin is true, this has no effect. defaults to false.
|
| 1577 |
+
* @return boolean true on success, false on failure. When using MCAPI.class.php, the value can be tested and error messages pulled from the MCAPI object (see below)
|
| 1578 |
+
*/
|
| 1579 |
+
function listSubscribe($id, $email_address, $merge_vars=NULL, $email_type='html', $double_optin=true, $update_existing=false, $replace_interests=true, $send_welcome=false) {
|
| 1580 |
+
$params = array();
|
| 1581 |
+
$params["id"] = $id;
|
| 1582 |
+
$params["email_address"] = $email_address;
|
| 1583 |
+
$params["merge_vars"] = $merge_vars;
|
| 1584 |
+
$params["email_type"] = $email_type;
|
| 1585 |
+
$params["double_optin"] = $double_optin;
|
| 1586 |
+
$params["update_existing"] = $update_existing;
|
| 1587 |
+
$params["replace_interests"] = $replace_interests;
|
| 1588 |
+
$params["send_welcome"] = $send_welcome;
|
| 1589 |
+
return $this->callServer("listSubscribe", $params);
|
| 1590 |
+
}
|
| 1591 |
+
|
| 1592 |
+
/**
|
| 1593 |
+
* Unsubscribe the given email address from the list
|
| 1594 |
+
*
|
| 1595 |
+
* @section List Related
|
| 1596 |
+
* @example mcapi_listUnsubscribe.php
|
| 1597 |
+
* @example xml-rpc_listUnsubscribe.php
|
| 1598 |
+
*
|
| 1599 |
+
* @param string $id the list id to connect to. Get by calling lists()
|
| 1600 |
+
* @param string $email_address the email address to unsubscribe OR the email "id" returned from listMemberInfo, Webhooks, and Campaigns
|
| 1601 |
+
* @param boolean $delete_member flag to completely delete the member from your list instead of just unsubscribing, default to false
|
| 1602 |
+
* @param boolean $send_goodbye flag to send the goodbye email to the email address, defaults to true
|
| 1603 |
+
* @param boolean $send_notify flag to send the unsubscribe notification email to the address defined in the list email notification settings, defaults to true
|
| 1604 |
+
* @return boolean true on success, false on failure. When using MCAPI.class.php, the value can be tested and error messages pulled from the MCAPI object (see below)
|
| 1605 |
+
*/
|
| 1606 |
+
function listUnsubscribe($id, $email_address, $delete_member=false, $send_goodbye=true, $send_notify=true) {
|
| 1607 |
+
$params = array();
|
| 1608 |
+
$params["id"] = $id;
|
| 1609 |
+
$params["email_address"] = $email_address;
|
| 1610 |
+
$params["delete_member"] = $delete_member;
|
| 1611 |
+
$params["send_goodbye"] = $send_goodbye;
|
| 1612 |
+
$params["send_notify"] = $send_notify;
|
| 1613 |
+
return $this->callServer("listUnsubscribe", $params);
|
| 1614 |
+
}
|
| 1615 |
+
|
| 1616 |
+
/**
|
| 1617 |
+
* Edit the email address, merge fields, and interest groups for a list member. If you are doing a batch update on lots of users,
|
| 1618 |
+
* consider using listBatchSubscribe() with the update_existing and possible replace_interests parameter.
|
| 1619 |
+
*
|
| 1620 |
+
* @section List Related
|
| 1621 |
+
* @example mcapi_listUpdateMember.php
|
| 1622 |
+
*
|
| 1623 |
+
* @param string $id the list id to connect to. Get by calling lists()
|
| 1624 |
+
* @param string $email_address the current email address of the member to update OR the "id" for the member returned from listMemberInfo, Webhooks, and Campaigns
|
| 1625 |
+
* @param array $merge_vars array of new field values to update the member with. See merge_vars in listSubscribe() for details.
|
| 1626 |
+
* @param string $email_type change the email type preference for the member ("html", "text", or "mobile"). Leave blank to keep the existing preference (optional)
|
| 1627 |
+
* @param boolean $replace_interests flag to determine whether we replace the interest groups with the updated groups provided, or we add the provided groups to the member's interest groups (optional, defaults to true)
|
| 1628 |
+
* @return boolean true on success, false on failure. When using MCAPI.class.php, the value can be tested and error messages pulled from the MCAPI object
|
| 1629 |
+
*/
|
| 1630 |
+
function listUpdateMember($id, $email_address, $merge_vars, $email_type='', $replace_interests=true) {
|
| 1631 |
+
$params = array();
|
| 1632 |
+
$params["id"] = $id;
|
| 1633 |
+
$params["email_address"] = $email_address;
|
| 1634 |
+
$params["merge_vars"] = $merge_vars;
|
| 1635 |
+
$params["email_type"] = $email_type;
|
| 1636 |
+
$params["replace_interests"] = $replace_interests;
|
| 1637 |
+
return $this->callServer("listUpdateMember", $params);
|
| 1638 |
+
}
|
| 1639 |
+
|
| 1640 |
+
/**
|
| 1641 |
+
* Subscribe a batch of email addresses to a list at once. If you are using a serialized version of the API, we strongly suggest that you
|
| 1642 |
+
* only run this method as a POST request, and <em>not</em> a GET request. Maximum batch sizes vary based on the amount of data in each record,
|
| 1643 |
+
* though you should cap them at 5k - 10k records, depending on your experience. These calls are also long, so be sure you increase your timeout values.
|
| 1644 |
+
*
|
| 1645 |
+
* @section List Related
|
| 1646 |
+
*
|
| 1647 |
+
* @example mcapi_listBatchSubscribe.php
|
| 1648 |
+
* @example xml-rpc_listBatchSubscribe.php
|
| 1649 |
+
*
|
| 1650 |
+
* @param string $id the list id to connect to. Get by calling lists()
|
| 1651 |
+
* @param array $batch an array of structs for each address to import with two special keys: "EMAIL" for the email address, and "EMAIL_TYPE" for the email type option (html, text, or mobile)
|
| 1652 |
+
* @param boolean $double_optin flag to control whether to send an opt-in confirmation email - defaults to true
|
| 1653 |
+
* @param boolean $update_existing flag to control whether to update members that are already subscribed to the list or to return an error, defaults to false (return error)
|
| 1654 |
+
* @param boolean $replace_interests flag to determine whether we replace the interest groups with the updated groups provided, or we add the provided groups to the member's interest groups (optional, defaults to true)
|
| 1655 |
+
* @return struct Array of result counts and any errors that occurred
|
| 1656 |
+
* @returnf int add_count Number of email addresses that were succesfully added
|
| 1657 |
+
* @returnf int update_count Number of email addresses that were succesfully updated
|
| 1658 |
+
* @returnf int error_count Number of email addresses that failed during addition/updating
|
| 1659 |
+
* @returnf array errors Array of error arrays, each containing:
|
| 1660 |
+
string code the error code
|
| 1661 |
+
string message the full error message
|
| 1662 |
+
string email the email address being processed
|
| 1663 |
+
*/
|
| 1664 |
+
function listBatchSubscribe($id, $batch, $double_optin=true, $update_existing=false, $replace_interests=true) {
|
| 1665 |
+
$params = array();
|
| 1666 |
+
$params["id"] = $id;
|
| 1667 |
+
$params["batch"] = $batch;
|
| 1668 |
+
$params["double_optin"] = $double_optin;
|
| 1669 |
+
$params["update_existing"] = $update_existing;
|
| 1670 |
+
$params["replace_interests"] = $replace_interests;
|
| 1671 |
+
return $this->callServer("listBatchSubscribe", $params);
|
| 1672 |
+
}
|
| 1673 |
+
|
| 1674 |
+
/**
|
| 1675 |
+
* Unsubscribe a batch of email addresses to a list
|
| 1676 |
+
*
|
| 1677 |
+
* @section List Related
|
| 1678 |
+
* @example mcapi_listBatchUnsubscribe.php
|
| 1679 |
+
*
|
| 1680 |
+
* @param string $id the list id to connect to. Get by calling lists()
|
| 1681 |
+
* @param array $emails array of email addresses to unsubscribe
|
| 1682 |
+
* @param boolean $delete_member flag to completely delete the member from your list instead of just unsubscribing, default to false
|
| 1683 |
+
* @param boolean $send_goodbye flag to send the goodbye email to the email addresses, defaults to true
|
| 1684 |
+
* @param boolean $send_notify flag to send the unsubscribe notification email to the address defined in the list email notification settings, defaults to false
|
| 1685 |
+
* @return struct Array of result counts and any errors that occurred
|
| 1686 |
+
* @returnf int success_count Number of email addresses that were succesfully added/updated
|
| 1687 |
+
* @returnf int error_count Number of email addresses that failed during addition/updating
|
| 1688 |
+
* @returnf array errors Array of error structs. Each error struct will contain "code", "message", and "email"
|
| 1689 |
+
*/
|
| 1690 |
+
function listBatchUnsubscribe($id, $emails, $delete_member=false, $send_goodbye=true, $send_notify=false) {
|
| 1691 |
+
$params = array();
|
| 1692 |
+
$params["id"] = $id;
|
| 1693 |
+
$params["emails"] = $emails;
|
| 1694 |
+
$params["delete_member"] = $delete_member;
|
| 1695 |
+
$params["send_goodbye"] = $send_goodbye;
|
| 1696 |
+
$params["send_notify"] = $send_notify;
|
| 1697 |
+
return $this->callServer("listBatchUnsubscribe", $params);
|
| 1698 |
+
}
|
| 1699 |
+
|
| 1700 |
+
/**
|
| 1701 |
+
* Get all of the list members for a list that are of a particular status. Are you trying to get a dump including lots of merge
|
| 1702 |
+
* data or specific members of a list? If so, checkout the <a href="/api/export">Export API</a>
|
| 1703 |
+
*
|
| 1704 |
+
* @section List Related
|
| 1705 |
+
* @example mcapi_listMembers.php
|
| 1706 |
+
*
|
| 1707 |
+
* @param string $id the list id to connect to. Get by calling lists()
|
| 1708 |
+
* @param string $status the status to get members for - one of(subscribed, unsubscribed, <a target="_blank" href="http://eepurl.com/dwk1">cleaned</a>, updated), defaults to subscribed
|
| 1709 |
+
* @param string $since optional pull all members whose status (subscribed/unsubscribed/cleaned) has changed or whose profile (updated) has changed since this date/time (in GMT) - format is YYYY-MM-DD HH:mm:ss (24hr)
|
| 1710 |
+
* @param int $start optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)
|
| 1711 |
+
* @param int $limit optional for large data sets, the number of results to return - defaults to 100, upper limit set at 15000
|
| 1712 |
+
* @return array Array of a the total records match and matching list member data for this page (see Returned Fields for details)
|
| 1713 |
+
* @returnf int total the total matching records
|
| 1714 |
+
* @returnf array data the data for each member, including:
|
| 1715 |
+
string email Member email address
|
| 1716 |
+
date timestamp timestamp of their associated status date (subscribed, unsubscribed, cleaned, or updated) in GMT
|
| 1717 |
+
string reason For unsubscribes only - the reason collected for the unsubscribe. If populated, one of 'NORMAL','NOSIGNUP','INAPPROPRIATE','SPAM','OTHER'
|
| 1718 |
+
string reason_text For unsubscribes only - if the reason is OTHER, the text entered.
|
| 1719 |
+
*/
|
| 1720 |
+
function listMembers($id, $status='subscribed', $since=NULL, $start=0, $limit=100) {
|
| 1721 |
+
$params = array();
|
| 1722 |
+
$params["id"] = $id;
|
| 1723 |
+
$params["status"] = $status;
|
| 1724 |
+
$params["since"] = $since;
|
| 1725 |
+
$params["start"] = $start;
|
| 1726 |
+
$params["limit"] = $limit;
|
| 1727 |
+
return $this->callServer("listMembers", $params);
|
| 1728 |
+
}
|
| 1729 |
+
|
| 1730 |
+
/**
|
| 1731 |
+
* Get all the information for particular members of a list
|
| 1732 |
+
*
|
| 1733 |
+
* @section List Related
|
| 1734 |
+
* @example mcapi_listMemberInfo.php
|
| 1735 |
+
* @example xml-rpc_listMemberInfo.php
|
| 1736 |
+
*
|
| 1737 |
+
* @param string $id the list id to connect to. Get by calling lists()
|
| 1738 |
+
* @param array $email_address an array of up to 50 email addresses to get information for OR the "id"(s) for the member returned from listMembers, Webhooks, and Campaigns. For backwards compatibility, if a string is passed, it will be treated as an array with a single element (will not work with XML-RPC).
|
| 1739 |
+
* @return array array of list members with their info in an array (see Returned Fields for details)
|
| 1740 |
+
* @returnf int success the number of subscribers successfully found on the list
|
| 1741 |
+
* @returnf int errors the number of subscribers who were not found on the list
|
| 1742 |
+
* @returnf array data an array of arrays where each one has member info:
|
| 1743 |
+
string id The unique id for this email address on an account
|
| 1744 |
+
string email The email address associated with this record
|
| 1745 |
+
string email_type The type of emails this customer asked to get: html, text, or mobile
|
| 1746 |
+
array merges An associative array of all the merge tags and the data for those tags for this email address. <em>Note</em>: Interest Groups are returned as comma delimited strings - if a group name contains a comma, it will be escaped with a backslash. ie, "," => "\,". Groupings will be returned with their "id" and "name" as well as a "groups" field formatted just like Interest Groups
|
| 1747 |
+
string status The subscription status for this email address, either pending, subscribed, unsubscribed, or cleaned
|
| 1748 |
+
string ip_opt IP Address this address opted in from.
|
| 1749 |
+
string ip_signup IP Address this address signed up from.
|
| 1750 |
+
int member_rating the rating of the subscriber. This will be 1 - 5 as described <a href="http://eepurl.com/f-2P" target="_blank">here</a>
|
| 1751 |
+
string campaign_id If the user is unsubscribed and they unsubscribed from a specific campaign, that campaign_id will be listed, otherwise this is not returned.
|
| 1752 |
+
array lists An associative array of the other lists this member belongs to - the key is the list id and the value is their status in that list.
|
| 1753 |
+
date timestamp The time this email address was added to the list
|
| 1754 |
+
date info_changed The last time this record was changed. If the record is old enough, this may be blank.
|
| 1755 |
+
int web_id The Member id used in our web app, allows you to create a link directly to it
|
| 1756 |
+
array clients the various clients we've tracked the address as using - each included array includes client 'name' and 'icon_url'
|
| 1757 |
+
array static_segments the 'id', 'name', and date 'added' for any static segment this member is in
|
| 1758 |
+
*/
|
| 1759 |
+
function listMemberInfo($id, $email_address) {
|
| 1760 |
+
$params = array();
|
| 1761 |
+
$params["id"] = $id;
|
| 1762 |
+
$params["email_address"] = $email_address;
|
| 1763 |
+
return $this->callServer("listMemberInfo", $params);
|
| 1764 |
+
}
|
| 1765 |
+
|
| 1766 |
+
/**
|
| 1767 |
+
* Get the most recent 100 activities for particular list members (open, click, bounce, unsub, abuse, sent to)
|
| 1768 |
+
*
|
| 1769 |
+
* @section List Related
|
| 1770 |
+
* @example mcapi_listMemberInfo.php
|
| 1771 |
+
* @example xml-rpc_listMemberInfo.php
|
| 1772 |
+
*
|
| 1773 |
+
* @param string $id the list id to connect to. Get by calling lists()
|
| 1774 |
+
* @param array $email_address an array of up to 50 email addresses to get information for OR the "id"(s) for the member returned from listMembers, Webhooks, and Campaigns.
|
| 1775 |
+
* @return array array of data and success/error counts
|
| 1776 |
+
* @returnf int success the number of subscribers successfully found on the list
|
| 1777 |
+
* @returnf int errors the number of subscribers who were not found on the list
|
| 1778 |
+
* @returnf array data an array of arrays where each activity record has:
|
| 1779 |
+
string action The action name, one of: open, click, bounce, unsub, abuse, sent
|
| 1780 |
+
string timestamp The date/time of the action
|
| 1781 |
+
string url For click actions, the url clicked, otherwise this is empty
|
| 1782 |
+
string bounce_type For bounce actions, the bounce type, otherwise this is empty
|
| 1783 |
+
string campaign_id The campaign id the action was related to, if it exists - otherwise empty (ie, direct unsub from list)
|
| 1784 |
+
*/
|
| 1785 |
+
function listMemberActivity($id, $email_address) {
|
| 1786 |
+
$params = array();
|
| 1787 |
+
$params["id"] = $id;
|
| 1788 |
+
$params["email_address"] = $email_address;
|
| 1789 |
+
return $this->callServer("listMemberActivity", $params);
|
| 1790 |
+
}
|
| 1791 |
+
|
| 1792 |
+
/**
|
| 1793 |
+
* Get all email addresses that complained about a given campaign
|
| 1794 |
+
*
|
| 1795 |
+
* @section List Related
|
| 1796 |
+
*
|
| 1797 |
+
* @example mcapi_listAbuseReports.php
|
| 1798 |
+
*
|
| 1799 |
+
* @param string $id the list id to pull abuse reports for (can be gathered using lists())
|
| 1800 |
+
* @param int $start optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)
|
| 1801 |
+
* @param int $limit optional for large data sets, the number of results to return - defaults to 500, upper limit set at 1000
|
| 1802 |
+
* @param string $since optional pull only messages since this time - use YYYY-MM-DD HH:II:SS format in <strong>GMT</strong>
|
| 1803 |
+
* @return array the total of all reports and the specific reports reports this page
|
| 1804 |
+
* @returnf int total the total number of matching abuse reports
|
| 1805 |
+
* @returnf array data the actual data for each reports, including:
|
| 1806 |
+
string date date/time the abuse report was received and processed
|
| 1807 |
+
string email the email address that reported abuse
|
| 1808 |
+
string campaign_id the unique id for the campaign that report was made against
|
| 1809 |
+
string type an internal type generally specifying the orginating mail provider - may not be useful outside of filling report views
|
| 1810 |
+
*/
|
| 1811 |
+
function listAbuseReports($id, $start=0, $limit=500, $since=NULL) {
|
| 1812 |
+
$params = array();
|
| 1813 |
+
$params["id"] = $id;
|
| 1814 |
+
$params["start"] = $start;
|
| 1815 |
+
$params["limit"] = $limit;
|
| 1816 |
+
$params["since"] = $since;
|
| 1817 |
+
return $this->callServer("listAbuseReports", $params);
|
| 1818 |
+
}
|
| 1819 |
+
|
| 1820 |
+
/**
|
| 1821 |
+
* Access the Growth History by Month for a given list.
|
| 1822 |
+
*
|
| 1823 |
+
* @section List Related
|
| 1824 |
+
*
|
| 1825 |
+
* @example mcapi_listGrowthHistory.php
|
| 1826 |
+
*
|
| 1827 |
+
* @param string $id the list id to connect to. Get by calling lists()
|
| 1828 |
+
* @return array array of months and growth
|
| 1829 |
+
* @returnf string month The Year and Month in question using YYYY-MM format
|
| 1830 |
+
* @returnf int existing number of existing subscribers to start the month
|
| 1831 |
+
* @returnf int imports number of subscribers imported during the month
|
| 1832 |
+
* @returnf int optins number of subscribers who opted-in during the month
|
| 1833 |
+
*/
|
| 1834 |
+
function listGrowthHistory($id) {
|
| 1835 |
+
$params = array();
|
| 1836 |
+
$params["id"] = $id;
|
| 1837 |
+
return $this->callServer("listGrowthHistory", $params);
|
| 1838 |
+
}
|
| 1839 |
+
|
| 1840 |
+
/**
|
| 1841 |
+
* Access up to the previous 180 days of daily detailed aggregated activity stats for a given list
|
| 1842 |
+
*
|
| 1843 |
+
* @section List Related
|
| 1844 |
+
*
|
| 1845 |
+
*
|
| 1846 |
+
* @param string $id the list id to connect to. Get by calling lists()
|
| 1847 |
+
* @return array array of array of daily values, each containing:
|
| 1848 |
+
* @returnf string day The day in YYYY-MM-DD
|
| 1849 |
+
* @returnf int emails_sent number of emails sent to the list
|
| 1850 |
+
* @returnf int unique_opens number of unique opens for the list
|
| 1851 |
+
* @returnf int recipient_clicks number of clicks for the list
|
| 1852 |
+
* @returnf int hard_bounce number of hard bounces for the list
|
| 1853 |
+
* @returnf int soft_bounce number of soft bounces for the list
|
| 1854 |
+
* @returnf int abuse_reports number of abuse reports for the list
|
| 1855 |
+
* @returnf int subs number of double optin subscribes for the list
|
| 1856 |
+
* @returnf int unsubs number of manual unsubscribes for the list
|
| 1857 |
+
* @returnf int other_adds number of non-double optin subscribes for the list (manual, API, or import)
|
| 1858 |
+
* @returnf int other_removes number of non-manual unsubscribes for the list (deletions, empties, soft-bounce removals)
|
| 1859 |
+
*/
|
| 1860 |
+
function listActivity($id) {
|
| 1861 |
+
$params = array();
|
| 1862 |
+
$params["id"] = $id;
|
| 1863 |
+
return $this->callServer("listActivity", $params);
|
| 1864 |
+
}
|
| 1865 |
+
|
| 1866 |
+
/**
|
| 1867 |
+
* Retrieve the locations (countries) that the list's subscribers have been tagged to based on geocoding their IP address
|
| 1868 |
+
*
|
| 1869 |
+
* @section List Related
|
| 1870 |
+
*
|
| 1871 |
+
* @param string $id the list id to connect to. Get by calling lists()
|
| 1872 |
+
* @return array array of locations
|
| 1873 |
+
* @returnf string country the country name
|
| 1874 |
+
* @returnf string cc the 2 digit country code
|
| 1875 |
+
* @returnf double percent the percent of subscribers in the country
|
| 1876 |
+
* @returnf double total the total number of subscribers in the country
|
| 1877 |
+
*/
|
| 1878 |
+
function listLocations($id) {
|
| 1879 |
+
$params = array();
|
| 1880 |
+
$params["id"] = $id;
|
| 1881 |
+
return $this->callServer("listLocations", $params);
|
| 1882 |
+
}
|
| 1883 |
+
|
| 1884 |
+
/**
|
| 1885 |
+
* Retrieve the clients that the list's subscribers have been tagged as being used based on user agents seen. Made possible by <a href="http://user-agent-string.info" target="_blank">user-agent-string.info</a>
|
| 1886 |
+
*
|
| 1887 |
+
* @section List Related
|
| 1888 |
+
*
|
| 1889 |
+
* @param string $id the list id to connect to. Get by calling lists()
|
| 1890 |
+
* @return array the desktop and mobile user agents in use on the list
|
| 1891 |
+
* @returnf array desktop desktop user agents and percentages
|
| 1892 |
+
double penetration the percent of desktop clients in use
|
| 1893 |
+
array clients a record containing the 'client', an 'icon' image url, the 'percent' using the client, and the total 'members' represented
|
| 1894 |
+
* @returnf array mobile mobile user agents and percentages
|
| 1895 |
+
double penetration the percent of mobile clients in use
|
| 1896 |
+
array clients a record containing the 'client', an 'icon' image url, the 'percent' using the client, and the total 'members' represented
|
| 1897 |
+
*/
|
| 1898 |
+
function listClients($id) {
|
| 1899 |
+
$params = array();
|
| 1900 |
+
$params["id"] = $id;
|
| 1901 |
+
return $this->callServer("listClients", $params);
|
| 1902 |
+
}
|
| 1903 |
+
|
| 1904 |
+
/**
|
| 1905 |
+
* Retrieve various templates available in the system, allowing some thing similar to our template gallery to be created.
|
| 1906 |
+
*
|
| 1907 |
+
* @section Template Related
|
| 1908 |
+
* @example mcapi_templates.php
|
| 1909 |
+
* @example xml-rpc_templates.php
|
| 1910 |
+
*
|
| 1911 |
+
* @param array $types optional the types of templates to return
|
| 1912 |
+
boolean user Customer template for this user account. Defaults to true.
|
| 1913 |
+
boolean gallery Templates from our Gallery. Note that some templates that require extra configuration are withheld. (eg, the Etsy template). Defaults to false.
|
| 1914 |
+
boolean base Our "start from scratch" extremely basic templates
|
| 1915 |
+
* @param string $category optional for Gallery templates only, limit to a specific template category
|
| 1916 |
+
* @param array $inactives optional options to control how inactive templates are returned, if at all
|
| 1917 |
+
boolean include user templates are not deleted, only set inactive. defaults to false.
|
| 1918 |
+
boolean only only include inactive templates. defaults to false.
|
| 1919 |
+
* @return array An array of structs, one for each template (see Returned Fields for details)
|
| 1920 |
+
* @returnf int id Id of the template
|
| 1921 |
+
* @returnf string name Name of the template
|
| 1922 |
+
* @returnf string layout Layout of the template - "basic", "left_column", "right_column", or "postcard"
|
| 1923 |
+
* @returnf string preview_image If we've generated it, the url of the preview image for the template. We do out best to keep these up to date, but Preview image urls are not guaranteed to be available
|
| 1924 |
+
* @returnf string date_created The date/time the template was created
|
| 1925 |
+
* @returnf bool edit_source Whether or not you are able to edit the source of a template.
|
| 1926 |
+
*/
|
| 1927 |
+
function templates($types=array (
|
| 1928 |
+
), $category=NULL, $inactives=array (
|
| 1929 |
+
)) {
|
| 1930 |
+
$params = array();
|
| 1931 |
+
$params["types"] = $types;
|
| 1932 |
+
$params["category"] = $category;
|
| 1933 |
+
$params["inactives"] = $inactives;
|
| 1934 |
+
return $this->callServer("templates", $params);
|
| 1935 |
+
}
|
| 1936 |
+
|
| 1937 |
+
/**
|
| 1938 |
+
* Pull details for a specific template to help support editing
|
| 1939 |
+
*
|
| 1940 |
+
* @section Template Related
|
| 1941 |
+
*
|
| 1942 |
+
* @param int $tid the template id - get from templates()
|
| 1943 |
+
* @param string $type the template type to load - one of 'user', 'gallery', 'base'
|
| 1944 |
+
* @return array an array of info to be used when editing
|
| 1945 |
+
* @returnf array default_content the default content broken down into the named editable sections for the template
|
| 1946 |
+
* @returnf array sections the valid editable section names
|
| 1947 |
+
* @returnf string source the full source of the template as if you exported it via our template editor
|
| 1948 |
+
* @returnf string preview similar to the source, but the rendered version of the source from our popup preview
|
| 1949 |
+
*/
|
| 1950 |
+
function templateInfo($tid, $type='user') {
|
| 1951 |
+
$params = array();
|
| 1952 |
+
$params["tid"] = $tid;
|
| 1953 |
+
$params["type"] = $type;
|
| 1954 |
+
return $this->callServer("templateInfo", $params);
|
| 1955 |
+
}
|
| 1956 |
+
|
| 1957 |
+
/**
|
| 1958 |
+
* Create a new user template, <strong>NOT</strong> campaign content. These templates can then be applied while creating campaigns.
|
| 1959 |
+
*
|
| 1960 |
+
* @section Template Related
|
| 1961 |
+
* @example mcapi_create_template.php
|
| 1962 |
+
* @example xml-rpc_create_template.php
|
| 1963 |
+
*
|
| 1964 |
+
* @param string $name the name for the template - names must be unique and a max of 50 bytes
|
| 1965 |
+
* @param string $html a string specifying the entire template to be created. This is <strong>NOT</strong> campaign content. They are intended to utilize our <a href="http://www.mailchimp.com/resources/email-template-language/" target="_blank">template language</a>.
|
| 1966 |
+
* @return int the new template id, otherwise an error is thrown.
|
| 1967 |
+
*/
|
| 1968 |
+
function templateAdd($name, $html) {
|
| 1969 |
+
$params = array();
|
| 1970 |
+
$params["name"] = $name;
|
| 1971 |
+
$params["html"] = $html;
|
| 1972 |
+
return $this->callServer("templateAdd", $params);
|
| 1973 |
+
}
|
| 1974 |
+
|
| 1975 |
+
/**
|
| 1976 |
+
* Replace the content of a user template, <strong>NOT</strong> campaign content.
|
| 1977 |
+
*
|
| 1978 |
+
* @section Template Related
|
| 1979 |
+
*
|
| 1980 |
+
* @param int $id the id of the user template to update
|
| 1981 |
+
* @param array $values the values to updates - while both are optional, at least one should be provided. Both can be updated at the same time.
|
| 1982 |
+
string name optional the name for the template - names must be unique and a max of 50 bytes
|
| 1983 |
+
string html optional a string specifying the entire template to be created. This is <strong>NOT</strong> campaign content. They are intended to utilize our <a href="http://www.mailchimp.com/resources/email-template-language/" target="_blank">template language</a>.
|
| 1984 |
+
|
| 1985 |
+
* @return boolean true if the template was updated, otherwise an error will be thrown
|
| 1986 |
+
*/
|
| 1987 |
+
function templateUpdate($id, $values) {
|
| 1988 |
+
$params = array();
|
| 1989 |
+
$params["id"] = $id;
|
| 1990 |
+
$params["values"] = $values;
|
| 1991 |
+
return $this->callServer("templateUpdate", $params);
|
| 1992 |
+
}
|
| 1993 |
+
|
| 1994 |
+
/**
|
| 1995 |
+
* Delete (deactivate) a user template
|
| 1996 |
+
*
|
| 1997 |
+
* @section Template Related
|
| 1998 |
+
*
|
| 1999 |
+
* @param int $id the id of the user template to delete
|
| 2000 |
+
* @return boolean true if the template was deleted, otherwise an error will be thrown
|
| 2001 |
+
*/
|
| 2002 |
+
function templateDel($id) {
|
| 2003 |
+
$params = array();
|
| 2004 |
+
$params["id"] = $id;
|
| 2005 |
+
return $this->callServer("templateDel", $params);
|
| 2006 |
+
}
|
| 2007 |
+
|
| 2008 |
+
/**
|
| 2009 |
+
* Undelete (reactivate) a user template
|
| 2010 |
+
*
|
| 2011 |
+
* @section Template Related
|
| 2012 |
+
*
|
| 2013 |
+
* @param int $id the id of the user template to reactivate
|
| 2014 |
+
* @return boolean true if the template was deleted, otherwise an error will be thrown
|
| 2015 |
+
*/
|
| 2016 |
+
function templateUndel($id) {
|
| 2017 |
+
$params = array();
|
| 2018 |
+
$params["id"] = $id;
|
| 2019 |
+
return $this->callServer("templateUndel", $params);
|
| 2020 |
+
}
|
| 2021 |
+
|
| 2022 |
+
/**
|
| 2023 |
+
* Retrieve lots of account information including payments made, plan info, some account stats, installed modules,
|
| 2024 |
+
* contact info, and more. No private information like Credit Card numbers is available.
|
| 2025 |
+
*
|
| 2026 |
+
* @section Helper
|
| 2027 |
+
*
|
| 2028 |
+
* @return array containing the details for the account tied to this API Key
|
| 2029 |
+
* @returnf string username The Account username
|
| 2030 |
+
* @returnf string user_id The Account user unique id (for building some links)
|
| 2031 |
+
* @returnf bool is_trial Whether the Account is in Trial mode (can only send campaigns to less than 100 emails)
|
| 2032 |
+
* @returnf string timezone The timezone for the Account - default is "US/Eastern"
|
| 2033 |
+
* @returnf string plan_type Plan Type - "monthly", "payasyougo", or "free"
|
| 2034 |
+
* @returnf int plan_low <em>only for Monthly plans</em> - the lower tier for list size
|
| 2035 |
+
* @returnf int plan_high <em>only for Monthly plans</em> - the upper tier for list size
|
| 2036 |
+
* @returnf string plan_start_date <em>only for Monthly plans</em> - the start date for a monthly plan
|
| 2037 |
+
* @returnf int emails_left <em>only for Free and Pay-as-you-go plans</em> emails credits left for the account
|
| 2038 |
+
* @returnf bool pending_monthly Whether the account is finishing Pay As You Go credits before switching to a Monthly plan
|
| 2039 |
+
* @returnf string first_payment date of first payment
|
| 2040 |
+
* @returnf string last_payment date of most recent payment
|
| 2041 |
+
* @returnf int times_logged_in total number of times the account has been logged into via the web
|
| 2042 |
+
* @returnf string last_login date/time of last login via the web
|
| 2043 |
+
* @returnf string affiliate_link Monkey Rewards link for our Affiliate program
|
| 2044 |
+
* @returnf array contact Contact details for the account
|
| 2045 |
+
string fname First Name
|
| 2046 |
+
string lname Last Name
|
| 2047 |
+
string email Email Address
|
| 2048 |
+
string company Company Name
|
| 2049 |
+
string address1 Address Line 1
|
| 2050 |
+
string address2 Address Line 2
|
| 2051 |
+
string city City
|
| 2052 |
+
string state State or Province
|
| 2053 |
+
string zip Zip or Postal Code
|
| 2054 |
+
string country Country name
|
| 2055 |
+
string url Website URL
|
| 2056 |
+
string phone Phone number
|
| 2057 |
+
string fax Fax number
|
| 2058 |
+
* @returnf array modules Addons installed in the account
|
| 2059 |
+
string name The module name
|
| 2060 |
+
string added The date the module was added
|
| 2061 |
+
* @returnf array orders Order details for the account
|
| 2062 |
+
int order_id The order id
|
| 2063 |
+
string type The order type - either "monthly" or "credits"
|
| 2064 |
+
double amount The order amount
|
| 2065 |
+
string date The order date
|
| 2066 |
+
double credits_used The total credits used
|
| 2067 |
+
* @returnf array rewards Rewards details for the account including credits & inspections earned, number of referals, referal details, and rewards used
|
| 2068 |
+
int referrals_this_month the total number of referrals this month
|
| 2069 |
+
string notify_on whether or not we notify the user when rewards are earned
|
| 2070 |
+
string notify_email the email address address used for rewards notifications
|
| 2071 |
+
array credits Email credits earned "this_month", "total_earned", and "remaining"
|
| 2072 |
+
array inspections Inbox Inspections earned "this_month", "total_earned", and "remaining"
|
| 2073 |
+
array referrals All referrals, including "name", "email", "signup_date", and "type"
|
| 2074 |
+
array applied Applied rewards, including "value", "date", "order_id", and "order_desc"
|
| 2075 |
+
*/
|
| 2076 |
+
function getAccountDetails() {
|
| 2077 |
+
$params = array();
|
| 2078 |
+
return $this->callServer("getAccountDetails", $params);
|
| 2079 |
+
}
|
| 2080 |
+
|
| 2081 |
+
/**
|
| 2082 |
+
* Have HTML content auto-converted to a text-only format. You can send: plain HTML, an array of Template content, an existing Campaign Id, or an existing Template Id. Note that this will <b>not</b> save anything to or update any of your lists, campaigns, or templates.
|
| 2083 |
+
*
|
| 2084 |
+
* @section Helper
|
| 2085 |
+
* @example xml-rpc_generateText.php
|
| 2086 |
+
*
|
| 2087 |
+
* @param string $type The type of content to parse. Must be one of: "html", "template", "url", "cid" (Campaign Id), or "tid" (Template Id)
|
| 2088 |
+
* @param mixed $content The content to use. For "html" expects a single string value, "template" expects an array like you send to campaignCreate, "url" expects a valid & public URL to pull from, "cid" expects a valid Campaign Id, and "tid" expects a valid Template Id on your account.
|
| 2089 |
+
* @return string the content pass in converted to text.
|
| 2090 |
+
*/
|
| 2091 |
+
function generateText($type, $content) {
|
| 2092 |
+
$params = array();
|
| 2093 |
+
$params["type"] = $type;
|
| 2094 |
+
$params["content"] = $content;
|
| 2095 |
+
return $this->callServer("generateText", $params);
|
| 2096 |
+
}
|
| 2097 |
+
|
| 2098 |
+
/**
|
| 2099 |
+
* Send your HTML content to have the CSS inlined and optionally remove the original styles.
|
| 2100 |
+
*
|
| 2101 |
+
* @section Helper
|
| 2102 |
+
* @example xml-rpc_inlineCss.php
|
| 2103 |
+
*
|
| 2104 |
+
* @param string $html Your HTML content
|
| 2105 |
+
* @param bool $strip_css optional Whether you want the CSS <style> tags stripped from the returned document. Defaults to false.
|
| 2106 |
+
* @return string Your HTML content with all CSS inlined, just like if we sent it.
|
| 2107 |
+
*/
|
| 2108 |
+
function inlineCss($html, $strip_css=false) {
|
| 2109 |
+
$params = array();
|
| 2110 |
+
$params["html"] = $html;
|
| 2111 |
+
$params["strip_css"] = $strip_css;
|
| 2112 |
+
return $this->callServer("inlineCss", $params);
|
| 2113 |
+
}
|
| 2114 |
+
|
| 2115 |
+
/**
|
| 2116 |
+
* List all the folders for a user account
|
| 2117 |
+
*
|
| 2118 |
+
* @section Folder Related
|
| 2119 |
+
* @example mcapi_folders.php
|
| 2120 |
+
* @example xml-rpc_folders.php
|
| 2121 |
+
*
|
| 2122 |
+
* @param string $type optional the type of folders to return - either "campaign" or "autoresponder". Defaults to "campaign"
|
| 2123 |
+
* @return array Array of folder structs (see Returned Fields for details)
|
| 2124 |
+
* @returnf int folder_id Folder Id for the given folder, this can be used in the campaigns() function to filter on.
|
| 2125 |
+
* @returnf string name Name of the given folder
|
| 2126 |
+
* @returnf string date_created The date/time the folder was created
|
| 2127 |
+
* @returnf string type The type of the folders being returned, just to make sure you know.
|
| 2128 |
+
*/
|
| 2129 |
+
function folders($type='campaign') {
|
| 2130 |
+
$params = array();
|
| 2131 |
+
$params["type"] = $type;
|
| 2132 |
+
return $this->callServer("folders", $params);
|
| 2133 |
+
}
|
| 2134 |
+
|
| 2135 |
+
/**
|
| 2136 |
+
* Add a new folder to file campaigns or autoresponders in
|
| 2137 |
+
*
|
| 2138 |
+
* @section Folder Related
|
| 2139 |
+
* @example mcapi_folderAdd.php
|
| 2140 |
+
* @example xml-rpc_folderAdd.php
|
| 2141 |
+
*
|
| 2142 |
+
* @param string $name a unique name for a folder (max 100 bytes)
|
| 2143 |
+
* @param string $type optional the type of folder to create - either "campaign" or "autoresponder". Defaults to "campaign"
|
| 2144 |
+
* @return int the folder_id of the newly created folder.
|
| 2145 |
+
*/
|
| 2146 |
+
function folderAdd($name, $type='campaign') {
|
| 2147 |
+
$params = array();
|
| 2148 |
+
$params["name"] = $name;
|
| 2149 |
+
$params["type"] = $type;
|
| 2150 |
+
return $this->callServer("folderAdd", $params);
|
| 2151 |
+
}
|
| 2152 |
+
|
| 2153 |
+
/**
|
| 2154 |
+
* Update the name of a folder for campaigns or autoresponders
|
| 2155 |
+
*
|
| 2156 |
+
* @section Folder Related
|
| 2157 |
+
*
|
| 2158 |
+
* @param int $fid the folder id to update - retrieve from folders()
|
| 2159 |
+
* @param string $name a new, unique name for the folder (max 100 bytes)
|
| 2160 |
+
* @param string $type optional the type of folder to create - either "campaign" or "autoresponder". Defaults to "campaign"
|
| 2161 |
+
* @return bool true if the update worked, otherwise an exception is thrown
|
| 2162 |
+
*/
|
| 2163 |
+
function folderUpdate($fid, $name, $type='campaign') {
|
| 2164 |
+
$params = array();
|
| 2165 |
+
$params["fid"] = $fid;
|
| 2166 |
+
$params["name"] = $name;
|
| 2167 |
+
$params["type"] = $type;
|
| 2168 |
+
return $this->callServer("folderUpdate", $params);
|
| 2169 |
+
}
|
| 2170 |
+
|
| 2171 |
+
/**
|
| 2172 |
+
* Delete a campaign or autoresponder folder. Note that this will simply make campaigns in the folder appear unfiled, they are not removed.
|
| 2173 |
+
*
|
| 2174 |
+
* @section Folder Related
|
| 2175 |
+
*
|
| 2176 |
+
* @param int $fid the folder id to update - retrieve from folders()
|
| 2177 |
+
* @param string $type optional the type of folder to create - either "campaign" or "autoresponder". Defaults to "campaign"
|
| 2178 |
+
* @return bool true if the delete worked, otherwise an exception is thrown
|
| 2179 |
+
*/
|
| 2180 |
+
function folderDel($fid, $type='campaign') {
|
| 2181 |
+
$params = array();
|
| 2182 |
+
$params["fid"] = $fid;
|
| 2183 |
+
$params["type"] = $type;
|
| 2184 |
+
return $this->callServer("folderDel", $params);
|
| 2185 |
+
}
|
| 2186 |
+
|
| 2187 |
+
/**
|
| 2188 |
+
* Retrieve the Ecommerce Orders for an account
|
| 2189 |
+
*
|
| 2190 |
+
* @section Ecommerce
|
| 2191 |
+
*
|
| 2192 |
+
* @param int $start optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)
|
| 2193 |
+
* @param int $limit optional for large data sets, the number of results to return - defaults to 100, upper limit set at 500
|
| 2194 |
+
* @param string $since optional pull only messages since this time - use YYYY-MM-DD HH:II:SS format in <strong>GMT</strong>
|
| 2195 |
+
* @return array the total matching orders and the specific orders for the requested page
|
| 2196 |
+
* @returnf int total the total matching orders
|
| 2197 |
+
* @returnf array data the actual data for each order being returned
|
| 2198 |
+
string store_id the store id generated by the plugin used to uniquely identify a store
|
| 2199 |
+
string store_name the store name collected by the plugin - often the domain name
|
| 2200 |
+
string order_id the internal order id the store tracked this order by
|
| 2201 |
+
string email the email address that received this campaign and is associated with this order
|
| 2202 |
+
double order_total the order total
|
| 2203 |
+
double tax_total the total tax for the order (if collected)
|
| 2204 |
+
double ship_total the shipping total for the order (if collected)
|
| 2205 |
+
string order_date the date the order was tracked - from the store if possible, otherwise the GMT time we recieved it
|
| 2206 |
+
array lines containing detail of the order - product, category, quantity, item cost
|
| 2207 |
+
*/
|
| 2208 |
+
function ecommOrders($start=0, $limit=100, $since=NULL) {
|
| 2209 |
+
$params = array();
|
| 2210 |
+
$params["start"] = $start;
|
| 2211 |
+
$params["limit"] = $limit;
|
| 2212 |
+
$params["since"] = $since;
|
| 2213 |
+
return $this->callServer("ecommOrders", $params);
|
| 2214 |
+
}
|
| 2215 |
+
|
| 2216 |
+
/**
|
| 2217 |
+
* Import Ecommerce Order Information to be used for Segmentation. This will generally be used by ecommerce package plugins
|
| 2218 |
+
* <a href="/plugins/ecomm360.phtml">that we provide</a> or by 3rd part system developers.
|
| 2219 |
+
* @section Ecommerce
|
| 2220 |
+
*
|
| 2221 |
+
* @param array $order an array of information pertaining to the order that has completed. Use the following keys:
|
| 2222 |
+
string id the Order Id
|
| 2223 |
+
string email_id optional (kind of) the Email Id of the subscriber we should attach this order to (see the "mc_eid" query string variable a campaign passes) - either this or <strong>email</strong> is required. If both are provided, email_id takes precedence
|
| 2224 |
+
string email optional (kind of) the Email Address we should attach this order to - either this or <strong>email_id</strong> is required. If both are provided, email_id takes precedence
|
| 2225 |
+
double total The Order Total (ie, the full amount the customer ends up paying)
|
| 2226 |
+
string order_date optional the date of the order - if this is not provided, we will default the date to now
|
| 2227 |
+
double shipping optional the total paid for Shipping Fees
|
| 2228 |
+
double tax optional the total tax paid
|
| 2229 |
+
string store_id a unique id for the store sending the order in (20 bytes max)
|
| 2230 |
+
string store_name optional a "nice" name for the store - typically the base web address (ie, "store.mailchimp.com"). We will automatically update this if it changes (based on store_id)
|
| 2231 |
+
string plugin_id the MailChimp assigned Plugin Id. Get yours by <a href="/api/register.php">registering here</a>
|
| 2232 |
+
string campaign_id optional the Campaign Id to track this order with (see the "mc_cid" query string variable a campaign passes)
|
| 2233 |
+
array items the individual line items for an order using these keys:
|
| 2234 |
+
<div style="padding-left:30px"><table><tr><td colspan=*>
|
| 2235 |
+
int line_num optional the line number of the item on the order. We will generate these if they are not passed
|
| 2236 |
+
int product_id the store's internal Id for the product. Lines that do no contain this will be skipped
|
| 2237 |
+
string product_name the product name for the product_id associated with this item. We will auto update these as they change (based on product_id)
|
| 2238 |
+
int category_id the store's internal Id for the (main) category associated with this product. Our testing has found this to be a "best guess" scenario
|
| 2239 |
+
string category_name the category name for the category_id this product is in. Our testing has found this to be a "best guess" scenario. Our plugins walk the category heirarchy up and send "Root - SubCat1 - SubCat4", etc.
|
| 2240 |
+
double qty the quantity of the item ordered
|
| 2241 |
+
double cost the cost of a single item (ie, not the extended cost of the line)
|
| 2242 |
+
</td></tr></table></div>
|
| 2243 |
+
* @return bool true if the data is saved, otherwise an error is thrown.
|
| 2244 |
+
*/
|
| 2245 |
+
function ecommOrderAdd($order) {
|
| 2246 |
+
$params = array();
|
| 2247 |
+
$params["order"] = $order;
|
| 2248 |
+
return $this->callServer("ecommOrderAdd", $params);
|
| 2249 |
+
}
|
| 2250 |
+
|
| 2251 |
+
/**
|
| 2252 |
+
* Delete Ecommerce Order Information used for segmentation. This will generally be used by ecommerce package plugins
|
| 2253 |
+
* <a href="/plugins/ecomm360.phtml">that we provide</a> or by 3rd part system developers.
|
| 2254 |
+
* @section Ecommerce
|
| 2255 |
+
*
|
| 2256 |
+
* @param string $store_id the store id the order belongs to
|
| 2257 |
+
* @param string $order_id the order id (generated by the store) to delete
|
| 2258 |
+
* @return bool true if an order is deleted, otherwise an error is thrown.
|
| 2259 |
+
*/
|
| 2260 |
+
function ecommOrderDel($store_id, $order_id) {
|
| 2261 |
+
$params = array();
|
| 2262 |
+
$params["store_id"] = $store_id;
|
| 2263 |
+
$params["order_id"] = $order_id;
|
| 2264 |
+
return $this->callServer("ecommOrderDel", $params);
|
| 2265 |
+
}
|
| 2266 |
+
|
| 2267 |
+
/**
|
| 2268 |
+
* Retrieve all List Ids a member is subscribed to.
|
| 2269 |
+
*
|
| 2270 |
+
* @section Helper
|
| 2271 |
+
*
|
| 2272 |
+
* @param string $email_address the email address to check OR the email "id" returned from listMemberInfo, Webhooks, and Campaigns
|
| 2273 |
+
* @return array An array of list_ids the member is subscribed to.
|
| 2274 |
+
*/
|
| 2275 |
+
function listsForEmail($email_address) {
|
| 2276 |
+
$params = array();
|
| 2277 |
+
$params["email_address"] = $email_address;
|
| 2278 |
+
return $this->callServer("listsForEmail", $params);
|
| 2279 |
+
}
|
| 2280 |
+
|
| 2281 |
+
/**
|
| 2282 |
+
* Retrieve all Campaigns Ids a member was sent
|
| 2283 |
+
*
|
| 2284 |
+
* @section Helper
|
| 2285 |
+
*
|
| 2286 |
+
* @param string $email_address the email address to unsubscribe OR the email "id" returned from listMemberInfo, Webhooks, and Campaigns
|
| 2287 |
+
* @return array An array of campaign_ids the member received
|
| 2288 |
+
*/
|
| 2289 |
+
function campaignsForEmail($email_address) {
|
| 2290 |
+
$params = array();
|
| 2291 |
+
$params["email_address"] = $email_address;
|
| 2292 |
+
return $this->callServer("campaignsForEmail", $params);
|
| 2293 |
+
}
|
| 2294 |
+
|
| 2295 |
+
/**
|
| 2296 |
+
* Return the current Chimp Chatter messages for an account.
|
| 2297 |
+
*
|
| 2298 |
+
* @section Helper
|
| 2299 |
+
*
|
| 2300 |
+
* @return array An array of chatter messages and properties
|
| 2301 |
+
* @returnf string message The chatter message
|
| 2302 |
+
* @returnf string type The type of the message - one of lists:new-subscriber, lists:unsubscribes, lists:profile-updates, campaigns:facebook-likes, campaigns:facebook-comments, campaigns:forward-to-friend, lists:imports, or campaigns:inbox-inspections
|
| 2303 |
+
* @returnf string url a url into the web app that the message could link to
|
| 2304 |
+
* @returnf string list_id the list_id a message relates to, if applicable
|
| 2305 |
+
* @returnf string campaign_id the list_id a message relates to, if applicable
|
| 2306 |
+
* @returnf string update_time The date/time the message was last updated
|
| 2307 |
+
*/
|
| 2308 |
+
function chimpChatter() {
|
| 2309 |
+
$params = array();
|
| 2310 |
+
return $this->callServer("chimpChatter", $params);
|
| 2311 |
+
}
|
| 2312 |
+
|
| 2313 |
+
/**
|
| 2314 |
+
* Retrieve a list of all MailChimp API Keys for this User
|
| 2315 |
+
*
|
| 2316 |
+
* @section Security Related
|
| 2317 |
+
* @example xml-rpc_apikeyAdd.php
|
| 2318 |
+
* @example mcapi_apikeyAdd.php
|
| 2319 |
+
*
|
| 2320 |
+
* @param string $username Your MailChimp user name
|
| 2321 |
+
* @param string $password Your MailChimp password
|
| 2322 |
+
* @param boolean $expired optional - whether or not to include expired keys, defaults to false
|
| 2323 |
+
* @return array an array of API keys including:
|
| 2324 |
+
* @returnf string apikey The api key that can be used
|
| 2325 |
+
* @returnf string created_at The date the key was created
|
| 2326 |
+
* @returnf string expired_at The date the key was expired
|
| 2327 |
+
*/
|
| 2328 |
+
function apikeys($username, $password, $expired=false) {
|
| 2329 |
+
$params = array();
|
| 2330 |
+
$params["username"] = $username;
|
| 2331 |
+
$params["password"] = $password;
|
| 2332 |
+
$params["expired"] = $expired;
|
| 2333 |
+
return $this->callServer("apikeys", $params);
|
| 2334 |
+
}
|
| 2335 |
+
|
| 2336 |
+
/**
|
| 2337 |
+
* Add an API Key to your account. We will generate a new key for you and return it.
|
| 2338 |
+
*
|
| 2339 |
+
* @section Security Related
|
| 2340 |
+
* @example xml-rpc_apikeyAdd.php
|
| 2341 |
+
*
|
| 2342 |
+
* @param string $username Your MailChimp user name
|
| 2343 |
+
* @param string $password Your MailChimp password
|
| 2344 |
+
* @return string a new API Key that can be immediately used.
|
| 2345 |
+
*/
|
| 2346 |
+
function apikeyAdd($username, $password) {
|
| 2347 |
+
$params = array();
|
| 2348 |
+
$params["username"] = $username;
|
| 2349 |
+
$params["password"] = $password;
|
| 2350 |
+
return $this->callServer("apikeyAdd", $params);
|
| 2351 |
+
}
|
| 2352 |
+
|
| 2353 |
+
/**
|
| 2354 |
+
* Expire a Specific API Key. Note that if you expire all of your keys, just visit <a href="http://admin.mailchimp.com/account/api" target="_blank">your API dashboard</a>
|
| 2355 |
+
* to create a new one. If you are trying to shut off access to your account for an old developer, change your
|
| 2356 |
+
* MailChimp password, then expire all of the keys they had access to. Note that this takes effect immediately, so make
|
| 2357 |
+
* sure you replace the keys in any working application before expiring them! Consider yourself warned...
|
| 2358 |
+
*
|
| 2359 |
+
* @section Security Related
|
| 2360 |
+
* @example mcapi_apikeyExpire.php
|
| 2361 |
+
* @example xml-rpc_apikeyExpire.php
|
| 2362 |
+
*
|
| 2363 |
+
* @param string $username Your MailChimp user name
|
| 2364 |
+
* @param string $password Your MailChimp password
|
| 2365 |
+
* @return boolean true if it worked, otherwise an error is thrown.
|
| 2366 |
+
*/
|
| 2367 |
+
function apikeyExpire($username, $password) {
|
| 2368 |
+
$params = array();
|
| 2369 |
+
$params["username"] = $username;
|
| 2370 |
+
$params["password"] = $password;
|
| 2371 |
+
return $this->callServer("apikeyExpire", $params);
|
| 2372 |
+
}
|
| 2373 |
+
|
| 2374 |
+
/**
|
| 2375 |
+
* "Ping" the MailChimp API - a simple method you can call that will return a constant value as long as everything is good. Note
|
| 2376 |
+
* than unlike most all of our methods, we don't throw an Exception if we are having issues. You will simply receive a different
|
| 2377 |
+
* string back that will explain our view on what is going on.
|
| 2378 |
+
*
|
| 2379 |
+
* @section Helper
|
| 2380 |
+
* @example xml-rpc_ping.php
|
| 2381 |
+
*
|
| 2382 |
+
* @return string returns "Everything's Chimpy!" if everything is chimpy, otherwise returns an error message
|
| 2383 |
+
*/
|
| 2384 |
+
function ping() {
|
| 2385 |
+
$params = array();
|
| 2386 |
+
return $this->callServer("ping", $params);
|
| 2387 |
+
}
|
| 2388 |
+
|
| 2389 |
+
/**
|
| 2390 |
+
* Internal function - proxy method for certain XML-RPC calls | DO NOT CALL
|
| 2391 |
+
* @param mixed Method to call, with any parameters to pass along
|
| 2392 |
+
* @return mixed the result of the call
|
| 2393 |
+
*/
|
| 2394 |
+
function callMethod() {
|
| 2395 |
+
$params = array();
|
| 2396 |
+
return $this->callServer("callMethod", $params);
|
| 2397 |
+
}
|
| 2398 |
+
|
| 2399 |
+
/**
|
| 2400 |
+
* Actually connect to the server and call the requested methods, parsing the result
|
| 2401 |
+
* You should never have to call this function manually
|
| 2402 |
+
*/
|
| 2403 |
+
function callServer($method, $params) {
|
| 2404 |
+
|
| 2405 |
+
$this->requestParams = $params;
|
| 2406 |
+
|
| 2407 |
+
$dc = "us1";
|
| 2408 |
+
if (strstr($this->api_key,"-")){
|
| 2409 |
+
list($key, $dc) = explode("-",$this->api_key,2);
|
| 2410 |
+
if (!$dc) $dc = "us1";
|
| 2411 |
+
}
|
| 2412 |
+
$host = $dc.".".$this->apiUrl["host"];
|
| 2413 |
+
$params["apikey"] = $this->api_key;
|
| 2414 |
+
|
| 2415 |
+
$this->errorMessage = "";
|
| 2416 |
+
$this->errorCode = "";
|
| 2417 |
+
$sep_changed = false;
|
| 2418 |
+
//sigh, apparently some distribs change this to & by default
|
| 2419 |
+
if (ini_get("arg_separator.output")!="&"){
|
| 2420 |
+
$sep_changed = true;
|
| 2421 |
+
$orig_sep = ini_get("arg_separator.output");
|
| 2422 |
+
ini_set("arg_separator.output", "&");
|
| 2423 |
+
}
|
| 2424 |
+
$post_vars = http_build_query($params);
|
| 2425 |
+
if ($sep_changed){
|
| 2426 |
+
ini_set("arg_separator.output", $orig_sep);
|
| 2427 |
+
}
|
| 2428 |
+
|
| 2429 |
+
$payload = "POST " . $this->apiUrl["path"] . "?" . $this->apiUrl["query"] . "&method=" . $method . " HTTP/1.0\r\n";
|
| 2430 |
+
$payload .= "Host: " . $host . "\r\n";
|
| 2431 |
+
//$payload .= "User-Agent: MCAPI/" . $this->version ."\r\n";
|
| 2432 |
+
$payload .= "User-Agent: " . Mage::helper('monkey')->getUserAgent() ."\r\n";
|
| 2433 |
+
$payload .= "Content-type: application/x-www-form-urlencoded\r\n";
|
| 2434 |
+
$payload .= "Content-length: " . strlen($post_vars) . "\r\n";
|
| 2435 |
+
$payload .= "Connection: close \r\n\r\n";
|
| 2436 |
+
$payload .= $post_vars;
|
| 2437 |
+
|
| 2438 |
+
ob_start();
|
| 2439 |
+
if ($this->secure){
|
| 2440 |
+
$sock = fsockopen("ssl://".$host, 443, $errno, $errstr, 30);
|
| 2441 |
+
} else {
|
| 2442 |
+
$sock = fsockopen($host, 80, $errno, $errstr, 30);
|
| 2443 |
+
}
|
| 2444 |
+
if(!$sock) {
|
| 2445 |
+
$this->errorMessage = "Could not connect (ERR $errno: $errstr)";
|
| 2446 |
+
$this->errorCode = "-99";
|
| 2447 |
+
ob_end_clean();
|
| 2448 |
+
return false;
|
| 2449 |
+
}
|
| 2450 |
+
|
| 2451 |
+
$response = "";
|
| 2452 |
+
fwrite($sock, $payload);
|
| 2453 |
+
stream_set_timeout($sock, $this->timeout);
|
| 2454 |
+
$info = stream_get_meta_data($sock);
|
| 2455 |
+
while ((!feof($sock)) && (!$info["timed_out"])) {
|
| 2456 |
+
$response .= fread($sock, $this->chunkSize);
|
| 2457 |
+
$info = stream_get_meta_data($sock);
|
| 2458 |
+
}
|
| 2459 |
+
fclose($sock);
|
| 2460 |
+
ob_end_clean();
|
| 2461 |
+
if ($info["timed_out"]) {
|
| 2462 |
+
$this->errorMessage = "Could not read response (timed out)";
|
| 2463 |
+
$this->errorCode = -98;
|
| 2464 |
+
return false;
|
| 2465 |
+
}
|
| 2466 |
+
|
| 2467 |
+
list($headers, $response) = explode("\r\n\r\n", $response, 2);
|
| 2468 |
+
$headers = explode("\r\n", $headers);
|
| 2469 |
+
$errored = false;
|
| 2470 |
+
foreach($headers as $h){
|
| 2471 |
+
if (substr($h,0,26)==="X-MailChimp-API-Error-Code"){
|
| 2472 |
+
$errored = true;
|
| 2473 |
+
$error_code = trim(substr($h,27));
|
| 2474 |
+
break;
|
| 2475 |
+
}
|
| 2476 |
+
}
|
| 2477 |
+
|
| 2478 |
+
if(ini_get("magic_quotes_runtime")) $response = stripslashes($response);
|
| 2479 |
+
|
| 2480 |
+
$serial = unserialize($response);
|
| 2481 |
+
if($response && $serial === false) {
|
| 2482 |
+
$response = array("error" => "Bad Response. Got This: " . $response, "code" => "-99");
|
| 2483 |
+
} else {
|
| 2484 |
+
$response = $serial;
|
| 2485 |
+
}
|
| 2486 |
+
if($errored && is_array($response) && isset($response["error"])) {
|
| 2487 |
+
$this->errorMessage = $response["error"];
|
| 2488 |
+
$this->errorCode = $response["code"];
|
| 2489 |
+
return false;
|
| 2490 |
+
} elseif($errored){
|
| 2491 |
+
$this->errorMessage = "No error message was found";
|
| 2492 |
+
$this->errorCode = $error_code;
|
| 2493 |
+
return false;
|
| 2494 |
+
}
|
| 2495 |
+
|
| 2496 |
+
return $response;
|
| 2497 |
+
}
|
| 2498 |
+
|
| 2499 |
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* MailChimp EXPORT API wrapper
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_MageMonkey
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_MageMonkey_Model_MCEXPORTAPI extends Ebizmarts_MageMonkey_Model_MCAPI
|
| 11 |
+
{
|
| 12 |
+
var $version = "1.0";
|
| 13 |
+
|
| 14 |
+
/**
|
| 15 |
+
* Connect to the MailChimp API for a given list.
|
| 16 |
+
*
|
| 17 |
+
* @param string $apikey Your MailChimp apikey
|
| 18 |
+
* @param string $secure Whether or not this should use a secure connection
|
| 19 |
+
*/
|
| 20 |
+
function __construct($apikey, $secure=false) {
|
| 21 |
+
$this->secure = $secure;
|
| 22 |
+
$this->apiUrl = parse_url("http://api.mailchimp.com/export/" . $this->version . "/");
|
| 23 |
+
$this->api_key = $apikey;
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
/**
|
| 27 |
+
* @link http://apidocs.mailchimp.com/export/1.0/list.func.php
|
| 28 |
+
*/
|
| 29 |
+
public function listExport($id, $status = 'subscribed', $segment = NULL, $since = NULL)
|
| 30 |
+
{
|
| 31 |
+
$params = array();
|
| 32 |
+
$params["id"] = $id;
|
| 33 |
+
$params["status"] = $status;
|
| 34 |
+
|
| 35 |
+
if($segment) $params["segment"] = $segment;
|
| 36 |
+
if($since) $params["since"] = $since;
|
| 37 |
+
|
| 38 |
+
return $this->callServer("list", $params);
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
/**
|
| 42 |
+
* Actually connect to the server and call the requested methods, parsing the result
|
| 43 |
+
* You should never have to call this function manually
|
| 44 |
+
*/
|
| 45 |
+
function callServer($method, $params) {
|
| 46 |
+
$dc = "us1";
|
| 47 |
+
if (strstr($this->api_key,"-")){
|
| 48 |
+
list($key, $dc) = explode("-",$this->api_key, 2);
|
| 49 |
+
if (!$dc) $dc = "us1";
|
| 50 |
+
}
|
| 51 |
+
$host = $dc.".".$this->apiUrl["host"];
|
| 52 |
+
$params["apikey"] = $this->api_key;
|
| 53 |
+
|
| 54 |
+
$this->errorMessage = "";
|
| 55 |
+
$this->errorCode = "";
|
| 56 |
+
$sep_changed = false;
|
| 57 |
+
//sigh, apparently some distribs change this to & by default
|
| 58 |
+
if (ini_get("arg_separator.output")!="&"){
|
| 59 |
+
$sep_changed = true;
|
| 60 |
+
$orig_sep = ini_get("arg_separator.output");
|
| 61 |
+
ini_set("arg_separator.output", "&");
|
| 62 |
+
}
|
| 63 |
+
$post_vars = http_build_query($params);
|
| 64 |
+
if ($sep_changed){
|
| 65 |
+
ini_set("arg_separator.output", $orig_sep);
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
$payload = "GET " . $this->apiUrl["path"] . $method . "/?" . $post_vars . " HTTP/1.0\r\n";
|
| 69 |
+
$payload .= "Host: " . $host . "\r\n";
|
| 70 |
+
$payload .= "User-Agent: " . Mage::helper('monkey')->getUserAgent() ."\r\n";
|
| 71 |
+
$payload .= "Connection: close \r\n\r\n";
|
| 72 |
+
|
| 73 |
+
ob_start();
|
| 74 |
+
if ($this->secure){
|
| 75 |
+
$sock = fsockopen("ssl://".$host, 443, $errno, $errstr, 30);
|
| 76 |
+
} else {
|
| 77 |
+
$sock = fsockopen($host, 80, $errno, $errstr, 30);
|
| 78 |
+
}
|
| 79 |
+
if(!$sock) {
|
| 80 |
+
$this->errorMessage = "Could not connect (ERR $errno: $errstr)";
|
| 81 |
+
$this->errorCode = "-99";
|
| 82 |
+
ob_end_clean();
|
| 83 |
+
return false;
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
$response = "";
|
| 87 |
+
fwrite($sock, $payload);
|
| 88 |
+
stream_set_timeout($sock, $this->timeout);
|
| 89 |
+
$info = stream_get_meta_data($sock);
|
| 90 |
+
while ((!feof($sock)) && (!$info["timed_out"])) {
|
| 91 |
+
$response .= fread($sock, $this->chunkSize);
|
| 92 |
+
$info = stream_get_meta_data($sock);
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
fclose($sock);
|
| 96 |
+
ob_end_clean();
|
| 97 |
+
if ($info["timed_out"]) {
|
| 98 |
+
$this->errorMessage = "Could not read response (timed out)";
|
| 99 |
+
$this->errorCode = -98;
|
| 100 |
+
return false;
|
| 101 |
+
}
|
| 102 |
+
|
| 103 |
+
list($headers, $response) = explode("\r\n\r\n", $response, 2);
|
| 104 |
+
$headers = explode("\r\n", $headers);
|
| 105 |
+
$errored = false;
|
| 106 |
+
foreach($headers as $h){
|
| 107 |
+
if (substr($h,0,26)==="X-MailChimp-API-Error-Code"){
|
| 108 |
+
$errored = true;
|
| 109 |
+
$error_code = trim(substr($h,27));
|
| 110 |
+
break;
|
| 111 |
+
}
|
| 112 |
+
}
|
| 113 |
+
|
| 114 |
+
if(ini_get("magic_quotes_runtime")) $response = stripslashes($response);
|
| 115 |
+
|
| 116 |
+
if($errored && is_array($response) && isset($response["error"])) {
|
| 117 |
+
$this->errorMessage = $response["error"];
|
| 118 |
+
$this->errorCode = $response["code"];
|
| 119 |
+
return false;
|
| 120 |
+
} elseif($errored){
|
| 121 |
+
$this->errorMessage = "No error message was found";
|
| 122 |
+
$this->errorCode = $error_code;
|
| 123 |
+
return false;
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
+
return $response;
|
| 127 |
+
}
|
| 128 |
+
|
| 129 |
+
}
|
|
@@ -0,0 +1,227 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Module's main multi-purpose model
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_MageMonkey
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_MageMonkey_Model_Monkey {
|
| 11 |
+
/**
|
| 12 |
+
* Webhooks request url path
|
| 13 |
+
*
|
| 14 |
+
* @const string
|
| 15 |
+
*/
|
| 16 |
+
|
| 17 |
+
const WEBHOOKS_PATH = 'monkey/webhook/index/';
|
| 18 |
+
|
| 19 |
+
/**
|
| 20 |
+
* Process Webhook request
|
| 21 |
+
*
|
| 22 |
+
* @param array $data
|
| 23 |
+
* @return void
|
| 24 |
+
*/
|
| 25 |
+
public function processWebhookData(array $data) {
|
| 26 |
+
$listId = $data['data']['list_id']; //According to the docs, the events are always related to a list_id
|
| 27 |
+
$store = Mage::helper('monkey')->getStoreByList($listId);
|
| 28 |
+
|
| 29 |
+
if (!is_null($store)) {
|
| 30 |
+
$curstore = Mage::app()->getStore();
|
| 31 |
+
Mage::app()->setCurrentStore($store);
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
//Object for cache clean
|
| 35 |
+
$object = new stdClass();
|
| 36 |
+
$object->requestParams = array();
|
| 37 |
+
$object->requestParams['id'] = $listId;
|
| 38 |
+
|
| 39 |
+
if( isset($data['data']['email']) ){
|
| 40 |
+
$object->requestParams['email_address'] = $data['data']['email'];
|
| 41 |
+
}
|
| 42 |
+
$cacheHelper = Mage::helper('monkey/cache');
|
| 43 |
+
|
| 44 |
+
switch ($data['type']) {
|
| 45 |
+
case 'subscribe':
|
| 46 |
+
$this->_subscribe($data);
|
| 47 |
+
$cacheHelper->clearCache('listSubscribe', $object);
|
| 48 |
+
break;
|
| 49 |
+
case 'unsubscribe':
|
| 50 |
+
$this->_unsubscribe($data);
|
| 51 |
+
$cacheHelper->clearCache('listUnsubscribe', $object);
|
| 52 |
+
break;
|
| 53 |
+
case 'cleaned':
|
| 54 |
+
$this->_clean($data);
|
| 55 |
+
$cacheHelper->clearCache('listUnsubscribe', $object);
|
| 56 |
+
break;
|
| 57 |
+
case 'campaign':
|
| 58 |
+
$this->_campaign($data);
|
| 59 |
+
break;
|
| 60 |
+
//case 'profile': Cuando se actualiza email en MC como merchant, te manda un upmail y un profile (no siempre en el mismo órden)
|
| 61 |
+
case 'upemail':
|
| 62 |
+
$this->_updateEmail($data);
|
| 63 |
+
$cacheHelper->clearCache('listUpdateMember', $object);
|
| 64 |
+
break;
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
if (!is_null($store)) {
|
| 68 |
+
Mage::app()->setCurrentStore($curstore);
|
| 69 |
+
}
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
/**
|
| 73 |
+
* Update customer email <upemail>
|
| 74 |
+
*
|
| 75 |
+
* @param array $data
|
| 76 |
+
* @return void
|
| 77 |
+
*/
|
| 78 |
+
protected function _updateEmail(array $data) {
|
| 79 |
+
|
| 80 |
+
$old = $data['data']['old_email'];
|
| 81 |
+
$new = $data['data']['new_email'];
|
| 82 |
+
|
| 83 |
+
$oldSubscriber = $this->loadByEmail($old);
|
| 84 |
+
$newSubscriber = $this->loadByEmail($new);
|
| 85 |
+
|
| 86 |
+
if (!$newSubscriber->getId() && $oldSubscriber->getId()) {
|
| 87 |
+
$oldSubscriber->setSubscriberEmail($new)
|
| 88 |
+
->save();
|
| 89 |
+
} elseif (!$newSubscriber->getId() && !$oldSubscriber->getId()) {
|
| 90 |
+
|
| 91 |
+
Mage::getModel('newsletter/subscriber')
|
| 92 |
+
->setImportMode(TRUE)
|
| 93 |
+
->setStoreId(Mage::app()->getStore()->getId())
|
| 94 |
+
->subscribe($new);
|
| 95 |
+
}
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
/**
|
| 99 |
+
* Add "Cleaned Emails" notification to Adminnotification Inbox <cleaned>
|
| 100 |
+
*
|
| 101 |
+
* @param array $data
|
| 102 |
+
* @return void
|
| 103 |
+
*/
|
| 104 |
+
protected function _clean(array $data) {
|
| 105 |
+
$text = Mage::helper('monkey')->__('MailChimp Cleaned Emails: %s %s at %s reason: %s', $data['data']['email'], $data['type'], $data['fired_at'], $data['data']['reason']);
|
| 106 |
+
|
| 107 |
+
$this->_getInbox()
|
| 108 |
+
->setTitle($text)
|
| 109 |
+
->setDescription($text)
|
| 110 |
+
->save();
|
| 111 |
+
|
| 112 |
+
//Delete subscriber from Magento
|
| 113 |
+
$s = $this->loadByEmail($data['data']['email']);
|
| 114 |
+
|
| 115 |
+
if ($s->getId()) {
|
| 116 |
+
try {
|
| 117 |
+
$s->delete();
|
| 118 |
+
} catch (Exception $e) {
|
| 119 |
+
Mage::logException($e);
|
| 120 |
+
}
|
| 121 |
+
}
|
| 122 |
+
}
|
| 123 |
+
|
| 124 |
+
/**
|
| 125 |
+
* Add "Campaign Sending Status" notification to Adminnotification Inbox <campaign>
|
| 126 |
+
*
|
| 127 |
+
* @param array $data
|
| 128 |
+
* @return void
|
| 129 |
+
*/
|
| 130 |
+
protected function _campaign(array $data) {
|
| 131 |
+
$text = Mage::helper('monkey')->__('MailChimp Campaign Send: %s %s at %s', $data['data']['subject'], $data['data']['status'], $data['fired_at']);
|
| 132 |
+
|
| 133 |
+
$this->_getInbox()
|
| 134 |
+
->setTitle($text)
|
| 135 |
+
->setDescription($text)
|
| 136 |
+
->save();
|
| 137 |
+
}
|
| 138 |
+
|
| 139 |
+
/**
|
| 140 |
+
* Subscribe email to Magento list, store aware
|
| 141 |
+
*
|
| 142 |
+
* @param array $data
|
| 143 |
+
* @return void
|
| 144 |
+
*/
|
| 145 |
+
protected function _subscribe(array $data) {
|
| 146 |
+
try {
|
| 147 |
+
|
| 148 |
+
//TODO: El método subscribe de Subscriber (Magento) hace un load by email
|
| 149 |
+
// entonces si existe en un store, lo acutaliza y lo cambia de store, no lo agrega a otra store
|
| 150 |
+
//VALIDAR si es lo que se requiere
|
| 151 |
+
|
| 152 |
+
$subscriber = Mage::getModel('newsletter/subscriber')
|
| 153 |
+
->loadByEmail($data['data']['email']);
|
| 154 |
+
if ($subscriber->getId()) {
|
| 155 |
+
$subscriber->setStatus(Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED)
|
| 156 |
+
->save();
|
| 157 |
+
} else {
|
| 158 |
+
Mage::getModel('newsletter/subscriber')->setImportMode(TRUE)
|
| 159 |
+
->subscribe($data['data']['email']);
|
| 160 |
+
}
|
| 161 |
+
} catch (Exception $e) {
|
| 162 |
+
Mage::logException($e);
|
| 163 |
+
}
|
| 164 |
+
}
|
| 165 |
+
|
| 166 |
+
/**
|
| 167 |
+
* Unsubscribe or delete email from Magento list, store aware
|
| 168 |
+
*
|
| 169 |
+
* @param array $data
|
| 170 |
+
* @return void
|
| 171 |
+
*/
|
| 172 |
+
protected function _unsubscribe(array $data) {
|
| 173 |
+
$subscriber = $this->loadByEmail($data['data']['email']);
|
| 174 |
+
|
| 175 |
+
if(!$subscriber->getId()){
|
| 176 |
+
$subscriber = Mage::getModel('newsletter/subscriber')
|
| 177 |
+
->loadByEmail($data['data']['email']);
|
| 178 |
+
}
|
| 179 |
+
|
| 180 |
+
if($subscriber->getId()){
|
| 181 |
+
try {
|
| 182 |
+
|
| 183 |
+
switch ($data['data']['action']) {
|
| 184 |
+
case 'delete' :
|
| 185 |
+
//if config setting "Webhooks Delete action" is set as "Delete customer account"
|
| 186 |
+
if(Mage::getStoreConfig("monkey/general/webhook_delete") == 1){
|
| 187 |
+
$subscriber->delete();
|
| 188 |
+
}else{
|
| 189 |
+
$subscriber->setImportMode(TRUE)->unsubscribe();
|
| 190 |
+
}
|
| 191 |
+
break;
|
| 192 |
+
case 'unsub':
|
| 193 |
+
$subscriber->setImportMode(TRUE)->unsubscribe();
|
| 194 |
+
break;
|
| 195 |
+
}
|
| 196 |
+
} catch (Exception $e) {
|
| 197 |
+
Mage::logException($e);
|
| 198 |
+
}
|
| 199 |
+
}
|
| 200 |
+
}
|
| 201 |
+
|
| 202 |
+
/**
|
| 203 |
+
* Return Inbox model instance
|
| 204 |
+
*
|
| 205 |
+
* @return Mage_AdminNotification_Model_Inbox
|
| 206 |
+
*/
|
| 207 |
+
protected function _getInbox() {
|
| 208 |
+
return Mage::getModel('adminnotification/inbox')
|
| 209 |
+
->setSeverity(4)//Notice
|
| 210 |
+
->setDateAdded(Mage::getModel('core/date')->gmtDate());
|
| 211 |
+
}
|
| 212 |
+
|
| 213 |
+
/**
|
| 214 |
+
* Load newsletter_subscriber by email
|
| 215 |
+
*
|
| 216 |
+
* @param string $email
|
| 217 |
+
* @return Mage_Newsletter_Model_Subscriber
|
| 218 |
+
*/
|
| 219 |
+
public function loadByEmail($email) {
|
| 220 |
+
return Mage::getModel('newsletter/subscriber')
|
| 221 |
+
->getCollection()
|
| 222 |
+
->addFieldToFilter('subscriber_email', $email)
|
| 223 |
+
->addFieldToFilter('store_id', Mage::app()->getStore()->getId())
|
| 224 |
+
->getFirstItem();
|
| 225 |
+
}
|
| 226 |
+
|
| 227 |
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Apidebug Mysql4 model
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_MageMonkey
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_MageMonkey_Model_Mysql4_Apidebug extends Mage_Core_Model_Mysql4_Abstract
|
| 11 |
+
{
|
| 12 |
+
|
| 13 |
+
/**
|
| 14 |
+
* Initialize
|
| 15 |
+
*
|
| 16 |
+
* @return void
|
| 17 |
+
*/
|
| 18 |
+
public function _construct()
|
| 19 |
+
{
|
| 20 |
+
$this->_init('monkey/apidebug', 'debug_id');
|
| 21 |
+
}
|
| 22 |
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Apidebug collection model
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_MageMonkey
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_MageMonkey_Model_Mysql4_Apidebug_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
| 11 |
+
{
|
| 12 |
+
|
| 13 |
+
/**
|
| 14 |
+
* Set resource type
|
| 15 |
+
*
|
| 16 |
+
* @return void
|
| 17 |
+
*/
|
| 18 |
+
public function _construct()
|
| 19 |
+
{
|
| 20 |
+
parent::_construct();
|
| 21 |
+
$this->_init('monkey/apidebug');
|
| 22 |
+
}
|
| 23 |
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Mysql4 Bulksync Export model
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_MageMonkey
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_MageMonkey_Model_Mysql4_Bulksync_Export extends Mage_Core_Model_Mysql4_Abstract
|
| 11 |
+
{
|
| 12 |
+
|
| 13 |
+
/**
|
| 14 |
+
* Initialize model
|
| 15 |
+
*
|
| 16 |
+
* @return void
|
| 17 |
+
*/
|
| 18 |
+
public function _construct()
|
| 19 |
+
{
|
| 20 |
+
$this->_init('monkey/bulksync_export', 'id');
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
/**
|
| 24 |
+
* Before save callback, set <created_at> and <updated_at> values
|
| 25 |
+
*
|
| 26 |
+
* @param Mage_Core_Model_Abstract $object
|
| 27 |
+
* @return void
|
| 28 |
+
*/
|
| 29 |
+
protected function _beforeSave(Mage_Core_Model_Abstract $object)
|
| 30 |
+
{
|
| 31 |
+
if (!$object->getCreatedAt()) {
|
| 32 |
+
$object->setCreatedAt($this->formatDate(time()));
|
| 33 |
+
}
|
| 34 |
+
$object->setUpdatedAt($this->formatDate(time()));
|
| 35 |
+
parent::_beforeSave($object);
|
| 36 |
+
}
|
| 37 |
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Bulksync Export collection
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_MageMonkey
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_MageMonkey_Model_Mysql4_Bulksync_Export_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
| 11 |
+
{
|
| 12 |
+
|
| 13 |
+
/**
|
| 14 |
+
* Initialize
|
| 15 |
+
*
|
| 16 |
+
* @return void
|
| 17 |
+
*/
|
| 18 |
+
public function _construct()
|
| 19 |
+
{
|
| 20 |
+
parent::_construct();
|
| 21 |
+
$this->_init('monkey/bulksync_export');
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
/**
|
| 25 |
+
* Override parent method
|
| 26 |
+
*
|
| 27 |
+
* @see Varien_Data_Collection
|
| 28 |
+
* @param string $className
|
| 29 |
+
* @return Ebizmarts_MageMonkey_Model_Mysql4_Bulksync_Export_Collection
|
| 30 |
+
*/
|
| 31 |
+
function setItemObjectClass($className)
|
| 32 |
+
{
|
| 33 |
+
$this->_itemObjectClass = 'Ebizmarts_MageMonkey_Model_BulksyncExport';
|
| 34 |
+
return $this;
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Mysql4 Bulksync Import model
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_MageMonkey
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_MageMonkey_Model_Mysql4_Bulksync_Import extends Mage_Core_Model_Mysql4_Abstract
|
| 11 |
+
{
|
| 12 |
+
|
| 13 |
+
/**
|
| 14 |
+
* Initialize model
|
| 15 |
+
*
|
| 16 |
+
* @return void
|
| 17 |
+
*/
|
| 18 |
+
public function _construct()
|
| 19 |
+
{
|
| 20 |
+
$this->_init('monkey/bulksync_import', 'id');
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
/**
|
| 24 |
+
* Before save callback, set <created_at> and <updated_at> values
|
| 25 |
+
*
|
| 26 |
+
* @param Mage_Core_Model_Abstract $object
|
| 27 |
+
* @return void
|
| 28 |
+
*/
|
| 29 |
+
protected function _beforeSave(Mage_Core_Model_Abstract $object)
|
| 30 |
+
{
|
| 31 |
+
if (!$object->getCreatedAt()) {
|
| 32 |
+
$object->setCreatedAt($this->formatDate(time()));
|
| 33 |
+
}
|
| 34 |
+
$object->setUpdatedAt($this->formatDate(time()));
|
| 35 |
+
parent::_beforeSave($object);
|
| 36 |
+
}
|
| 37 |
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Bulksync Import collection
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_MageMonkey
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_MageMonkey_Model_Mysql4_Bulksync_Import_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
| 11 |
+
{
|
| 12 |
+
|
| 13 |
+
/**
|
| 14 |
+
* Initialize
|
| 15 |
+
*
|
| 16 |
+
* @return void
|
| 17 |
+
*/
|
| 18 |
+
public function _construct()
|
| 19 |
+
{
|
| 20 |
+
parent::_construct();
|
| 21 |
+
$this->_init('monkey/bulksync_import');
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
/**
|
| 25 |
+
* Override parent method
|
| 26 |
+
*
|
| 27 |
+
* @see Varien_Data_Collection
|
| 28 |
+
* @param string $className
|
| 29 |
+
* @return Ebizmarts_MageMonkey_Model_Mysql4_Bulksync_Export_Collection
|
| 30 |
+
*/
|
| 31 |
+
function setItemObjectClass($className)
|
| 32 |
+
{
|
| 33 |
+
$this->_itemObjectClass = 'Ebizmarts_MageMonkey_Model_BulksyncImport';
|
| 34 |
+
return $this;
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Ecommerce360 Mysql4 model
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_MageMonkey
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_MageMonkey_Model_Mysql4_Ecommerce extends Mage_Core_Model_Mysql4_Abstract
|
| 11 |
+
{
|
| 12 |
+
|
| 13 |
+
/**
|
| 14 |
+
* Initialize
|
| 15 |
+
*
|
| 16 |
+
* @return void
|
| 17 |
+
*/
|
| 18 |
+
public function _construct()
|
| 19 |
+
{
|
| 20 |
+
$this->_init('monkey/ecommerce', 'id');
|
| 21 |
+
}
|
| 22 |
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Ecommerce360 collection model
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_MageMonkey
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_MageMonkey_Model_Mysql4_Ecommerce_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
| 11 |
+
{
|
| 12 |
+
|
| 13 |
+
/**
|
| 14 |
+
* Initialize
|
| 15 |
+
*
|
| 16 |
+
* @return void
|
| 17 |
+
*/
|
| 18 |
+
public function _construct()
|
| 19 |
+
{
|
| 20 |
+
parent::_construct();
|
| 21 |
+
$this->_init('monkey/ecommerce');
|
| 22 |
+
}
|
| 23 |
+
}
|
|
@@ -0,0 +1,500 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Events Observer model
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_MageMonkey
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_MageMonkey_Model_Observer
|
| 11 |
+
{
|
| 12 |
+
/**
|
| 13 |
+
* Handle Subscriber object saving process
|
| 14 |
+
*
|
| 15 |
+
* @param Varien_Event_Observer $observer
|
| 16 |
+
* @return void|Varien_Event_Observer
|
| 17 |
+
*/
|
| 18 |
+
public function handleSubscriber(Varien_Event_Observer $observer)
|
| 19 |
+
{
|
| 20 |
+
if(!Mage::helper('monkey')->canMonkey()){
|
| 21 |
+
return $observer;
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
if( TRUE === Mage::helper('monkey')->isWebhookRequest()){
|
| 25 |
+
return $observer;
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
$subscriber = $observer->getEvent()->getSubscriber();
|
| 29 |
+
|
| 30 |
+
if( $subscriber->getBulksync() ){
|
| 31 |
+
return $observer;
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
if(Mage::getSingleton('core/session')->getMonkeyCheckout(TRUE)){
|
| 35 |
+
return $observer;
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
$email = $subscriber->getSubscriberEmail();
|
| 39 |
+
if($subscriber->getMcStoreId()){
|
| 40 |
+
$listId = Mage::helper('monkey')->getDefaultList($subscriber->getMcStoreId());
|
| 41 |
+
}
|
| 42 |
+
elseif($subscriber->getStoreId()){
|
| 43 |
+
$listId = Mage::helper('monkey')->getDefaultList($subscriber->getStoreId());
|
| 44 |
+
}
|
| 45 |
+
else{
|
| 46 |
+
$listId = Mage::helper('monkey')->getDefaultList(Mage::app()->getStore()->getId());
|
| 47 |
+
}
|
| 48 |
+
$subscriber->setImportMode(TRUE);
|
| 49 |
+
$isConfirmNeed = FALSE;
|
| 50 |
+
if( !Mage::helper('monkey')->isAdmin() &&
|
| 51 |
+
(Mage::getStoreConfig(Mage_Newsletter_Model_Subscriber::XML_PATH_CONFIRMATION_FLAG, $subscriber->getStoreId()) == 1) ){
|
| 52 |
+
$isConfirmNeed = TRUE;
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
if($isConfirmNeed){
|
| 56 |
+
$subscriber->setStatus(Mage_Newsletter_Model_Subscriber::STATUS_UNCONFIRMED);
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
//Check if customer is not yet subscribed on MailChimp
|
| 60 |
+
$isOnMailChimp = Mage::helper('monkey')->subscribedToList($email, $listId);
|
| 61 |
+
|
| 62 |
+
//Flag only is TRUE when changing to SUBSCRIBE
|
| 63 |
+
if( TRUE === $subscriber->getIsStatusChanged() ){
|
| 64 |
+
|
| 65 |
+
if($isOnMailChimp == 1){
|
| 66 |
+
return $observer;
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
if($isConfirmNeed){
|
| 70 |
+
$subscriber->setStatus(Mage_Newsletter_Model_Subscriber::STATUS_UNCONFIRMED);
|
| 71 |
+
Mage::getSingleton('core/session')->addSuccess(Mage::helper('monkey')->__('Confirmation request has been sent.'));
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
Mage::getSingleton('monkey/api')->listSubscribe($listId, $email, $this->_mergeVars($subscriber), 'html', $isConfirmNeed);
|
| 75 |
+
|
| 76 |
+
}
|
| 77 |
+
// This code unsubscribe users if it's on MailChimp and the status it's unconfirmed
|
| 78 |
+
/*else{
|
| 79 |
+
if(($isOnMailChimp == 1) && ($subscriber->getStatus() == Mage_Newsletter_Model_Subscriber::STATUS_UNSUBSCRIBED)){
|
| 80 |
+
$rs = Mage::getSingleton('monkey/api')
|
| 81 |
+
->listUnsubscribe($listId, $email);
|
| 82 |
+
if($rs !== TRUE){
|
| 83 |
+
Mage::throwException($rs);
|
| 84 |
+
}
|
| 85 |
+
}
|
| 86 |
+
}*/
|
| 87 |
+
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
/**
|
| 91 |
+
* Handle Subscriber deletion from Magento, unsubcribes email from MailChimp
|
| 92 |
+
* and sends the delete_member flag so the subscriber gets deleted.
|
| 93 |
+
*
|
| 94 |
+
* @param Varien_Event_Observer $observer
|
| 95 |
+
* @return void|Varien_Event_Observer
|
| 96 |
+
*/
|
| 97 |
+
public function handleSubscriberDeletion(Varien_Event_Observer $observer)
|
| 98 |
+
{
|
| 99 |
+
if(!Mage::helper('monkey')->canMonkey()){
|
| 100 |
+
return;
|
| 101 |
+
}
|
| 102 |
+
|
| 103 |
+
if( TRUE === Mage::helper('monkey')->isWebhookRequest()){
|
| 104 |
+
return $observer;
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
$subscriber = $observer->getEvent()->getSubscriber();
|
| 108 |
+
$subscriber->setImportMode(TRUE);
|
| 109 |
+
|
| 110 |
+
if( $subscriber->getBulksync() ){
|
| 111 |
+
return $observer;
|
| 112 |
+
}
|
| 113 |
+
|
| 114 |
+
$listId = Mage::helper('monkey')->getDefaultList($subscriber->getStoreId());
|
| 115 |
+
|
| 116 |
+
Mage::getSingleton('monkey/api', array('store' => $subscriber->getStoreId()))
|
| 117 |
+
->listUnsubscribe($listId, $subscriber->getSubscriberEmail(), TRUE);
|
| 118 |
+
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
+
/**
|
| 122 |
+
* Check for conflicts with rewrite on Core/Email_Template
|
| 123 |
+
*
|
| 124 |
+
* @param Varien_Event_Observer $observer
|
| 125 |
+
* @return void|Varien_Event_Observer
|
| 126 |
+
*/
|
| 127 |
+
public function loadConfig(Varien_Event_Observer $observer)
|
| 128 |
+
{
|
| 129 |
+
$action = $observer->getEvent()->getControllerAction();
|
| 130 |
+
|
| 131 |
+
//Do nothing for data saving actions
|
| 132 |
+
if ($action->getRequest()->isPost() || $action->getRequest()->getQuery('isAjax')) {
|
| 133 |
+
return $observer;
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
if('monkey' !== $action->getRequest()->getParam('section')){
|
| 137 |
+
return $observer;
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
+
return $observer;
|
| 141 |
+
}
|
| 142 |
+
|
| 143 |
+
/**
|
| 144 |
+
* Handle save of System -> Configuration, section <monkey>
|
| 145 |
+
*
|
| 146 |
+
* @param Varien_Event_Observer $observer
|
| 147 |
+
* @return void|Varien_Event_Observer
|
| 148 |
+
*/
|
| 149 |
+
public function saveConfig(Varien_Event_Observer $observer)
|
| 150 |
+
{
|
| 151 |
+
|
| 152 |
+
$scope = is_null($observer->getEvent()->getStore()) ? Mage::app()->getDefaultStoreView()->getCode(): $observer->getEvent()->getStore();
|
| 153 |
+
$post = Mage::app()->getRequest()->getPost();
|
| 154 |
+
$request = Mage::app()->getRequest();
|
| 155 |
+
|
| 156 |
+
if( !isset($post['groups']) ){
|
| 157 |
+
return $observer;
|
| 158 |
+
}
|
| 159 |
+
//Check if the api key exist
|
| 160 |
+
if(isset($post['groups']['general']['fields']['apikey']['value'])){
|
| 161 |
+
$apiKey = $post['groups']['general']['fields']['apikey']['value'];
|
| 162 |
+
}else{
|
| 163 |
+
//this case it's when we save the configuration for a particular store
|
| 164 |
+
if((string)$post['groups']['general']['fields']['apikey']['inherit'] == 1){
|
| 165 |
+
$apiKey = Mage::helper('monkey')->getApiKey();
|
| 166 |
+
}
|
| 167 |
+
}
|
| 168 |
+
|
| 169 |
+
if(!$apiKey){
|
| 170 |
+
return $observer;
|
| 171 |
+
}
|
| 172 |
+
|
| 173 |
+
$selectedLists = array();
|
| 174 |
+
if(isset($post['groups']['general']['fields']['list']['value']))
|
| 175 |
+
{
|
| 176 |
+
$selectedLists []= $post['groups']['general']['fields']['list']['value'];
|
| 177 |
+
}
|
| 178 |
+
else
|
| 179 |
+
{
|
| 180 |
+
if((string)$post['groups']['general']['fields']['list']['inherit'] == 1)
|
| 181 |
+
{
|
| 182 |
+
$selectedLists []= Mage::helper('monkey')->getDefaultList(Mage::app()->getStore()->getId());
|
| 183 |
+
}
|
| 184 |
+
|
| 185 |
+
}
|
| 186 |
+
|
| 187 |
+
if(!$selectedLists)
|
| 188 |
+
{
|
| 189 |
+
$message = Mage::helper('monkey')->__('There is no List selected please save the configuration again');
|
| 190 |
+
Mage::getSingleton('adminhtml/session')->addWarning($message);
|
| 191 |
+
}
|
| 192 |
+
|
| 193 |
+
if(isset($post['groups']['general']['fields']['additional_lists']['value']))
|
| 194 |
+
{
|
| 195 |
+
$additionalLists = $post['groups']['general']['fields']['additional_lists']['value'];
|
| 196 |
+
}
|
| 197 |
+
else
|
| 198 |
+
{
|
| 199 |
+
if((string)$post['groups']['general']['fields']['additional_lists']['inherit'] == 1)
|
| 200 |
+
{
|
| 201 |
+
$additionalLists = Mage::helper('monkey')->getAdditionalList(Mage::app()->getStore()->getId());
|
| 202 |
+
}
|
| 203 |
+
}
|
| 204 |
+
|
| 205 |
+
if(is_array($additionalLists)){
|
| 206 |
+
foreach($additionalLists as $additional) {
|
| 207 |
+
if($additional == $selectedLists[0]) {
|
| 208 |
+
$message = Mage::helper('monkey')->__('Be Careful! You have choosen the same list for "General Subscription" and "Additional Lists". Please change this values and save the configuration again');
|
| 209 |
+
Mage::getSingleton('adminhtml/session')->addWarning($message);
|
| 210 |
+
}
|
| 211 |
+
}
|
| 212 |
+
$selectedLists = array_merge($selectedLists, $additionalLists);
|
| 213 |
+
}
|
| 214 |
+
|
| 215 |
+
$webhooksKey = Mage::helper('monkey')->getWebhooksKey($scope);
|
| 216 |
+
|
| 217 |
+
//Generating Webhooks URL
|
| 218 |
+
$hookUrl = '';
|
| 219 |
+
try{
|
| 220 |
+
switch ($scope) {
|
| 221 |
+
case 'default':
|
| 222 |
+
$store = Mage::app()->getDefaultStoreView()->getCode();
|
| 223 |
+
break;
|
| 224 |
+
default:
|
| 225 |
+
$store = $scope;
|
| 226 |
+
break;
|
| 227 |
+
}
|
| 228 |
+
$hookUrl = Mage::getModel('core/url')->setStore($store)->getUrl(Ebizmarts_MageMonkey_Model_Monkey::WEBHOOKS_PATH, array('wkey' => $webhooksKey));
|
| 229 |
+
}catch(Exception $e){
|
| 230 |
+
$hookUrl = Mage::getModel('core/url')->getUrl(Ebizmarts_MageMonkey_Model_Monkey::WEBHOOKS_PATH, array('wkey' => $webhooksKey));
|
| 231 |
+
}
|
| 232 |
+
|
| 233 |
+
if(FALSE != strstr($hookUrl, '?', true)){
|
| 234 |
+
$hookUrl = strstr($hookUrl, '?', true);
|
| 235 |
+
}
|
| 236 |
+
|
| 237 |
+
$api = Mage::getSingleton('monkey/api', array('apikey' => $apiKey));
|
| 238 |
+
|
| 239 |
+
//Validate API KEY
|
| 240 |
+
$api->ping();
|
| 241 |
+
if($api->errorCode){
|
| 242 |
+
Mage::getSingleton('adminhtml/session')->addError($api->errorMessage);
|
| 243 |
+
return $observer;
|
| 244 |
+
}
|
| 245 |
+
|
| 246 |
+
$lists = $api->lists();
|
| 247 |
+
|
| 248 |
+
foreach($lists['data'] as $list){
|
| 249 |
+
|
| 250 |
+
if(in_array($list['id'], $selectedLists)){
|
| 251 |
+
|
| 252 |
+
/**
|
| 253 |
+
* Customer Group - Interest Grouping
|
| 254 |
+
*/
|
| 255 |
+
$magentoGroups = Mage::helper('customer')->getGroups()->toOptionHash();
|
| 256 |
+
array_push($magentoGroups, "NOT LOGGED IN");
|
| 257 |
+
$customerGroup = array('field_type' => 'dropdown', 'choices' => $magentoGroups);
|
| 258 |
+
$mergeVars = $api->listMergeVars($list['id']);
|
| 259 |
+
$mergeExist = false;
|
| 260 |
+
foreach($mergeVars as $vars) {
|
| 261 |
+
if($vars['tag'] == 'CGROUP'){
|
| 262 |
+
$mergeExist = true;
|
| 263 |
+
if($magentoGroups === $vars['choices']){
|
| 264 |
+
$update = false;
|
| 265 |
+
}else{
|
| 266 |
+
$update = true;
|
| 267 |
+
}
|
| 268 |
+
}
|
| 269 |
+
}
|
| 270 |
+
if($mergeExist){
|
| 271 |
+
if($update){
|
| 272 |
+
$newValue = array('choices' => $magentoGroups);
|
| 273 |
+
$api->listMergeVarUpdate($list['id'], 'CGROUP', $newValue);
|
| 274 |
+
}
|
| 275 |
+
}else{
|
| 276 |
+
$api->listMergeVarAdd($list['id'], 'CGROUP', 'Customer Groups', $customerGroup);
|
| 277 |
+
}
|
| 278 |
+
/**
|
| 279 |
+
* Customer Group - Interest Grouping
|
| 280 |
+
*/
|
| 281 |
+
|
| 282 |
+
/**
|
| 283 |
+
* Adding Webhooks
|
| 284 |
+
*/
|
| 285 |
+
$api->listWebhookAdd($list['id'], $hookUrl);
|
| 286 |
+
|
| 287 |
+
//If webhook was not added, add a message on Admin panel
|
| 288 |
+
if($api->errorCode && Mage::helper('monkey')->isAdmin()){
|
| 289 |
+
|
| 290 |
+
//Don't show an error if webhook already in, otherwise, show error message and code
|
| 291 |
+
if($api->errorMessage !== "Setting up multiple WebHooks for one URL is not allowed."){
|
| 292 |
+
$message = Mage::helper('monkey')->__('Could not add Webhook "%s" for list "%s", error code %s, %s', $hookUrl, $list['name'], $api->errorCode, $api->errorMessage);
|
| 293 |
+
Mage::getSingleton('adminhtml/session')->addError($message);
|
| 294 |
+
}
|
| 295 |
+
|
| 296 |
+
}
|
| 297 |
+
/**
|
| 298 |
+
* Adding Webhooks
|
| 299 |
+
*/
|
| 300 |
+
}
|
| 301 |
+
|
| 302 |
+
}
|
| 303 |
+
|
| 304 |
+
}
|
| 305 |
+
|
| 306 |
+
/**
|
| 307 |
+
* Update customer after_save event observer
|
| 308 |
+
*
|
| 309 |
+
* @param Varien_Event_Observer $observer
|
| 310 |
+
* @return void|Varien_Event_Observer
|
| 311 |
+
*/
|
| 312 |
+
public function updateCustomer(Varien_Event_Observer $observer)
|
| 313 |
+
{
|
| 314 |
+
$post = Mage::app()->getRequest()->getPost();
|
| 315 |
+
if(!Mage::helper('monkey')->canMonkey()){
|
| 316 |
+
return;
|
| 317 |
+
}
|
| 318 |
+
|
| 319 |
+
$customer = $observer->getEvent()->getCustomer();
|
| 320 |
+
|
| 321 |
+
//Handle additional lists subscription on Customer Create Account
|
| 322 |
+
Mage::helper('monkey')->additionalListsSubscription($customer);
|
| 323 |
+
|
| 324 |
+
$oldEmail = $customer->getOrigData('email');
|
| 325 |
+
if(!$oldEmail){
|
| 326 |
+
return $observer;
|
| 327 |
+
}
|
| 328 |
+
|
| 329 |
+
$mergeVars = $this->_mergeVars($customer, TRUE);
|
| 330 |
+
$api = Mage::getSingleton('monkey/api', array('store' => $customer->getStoreId()));
|
| 331 |
+
$lists = $api->listsForEmail($oldEmail);
|
| 332 |
+
if(is_array($lists)){
|
| 333 |
+
foreach($lists as $listId){
|
| 334 |
+
$api->listUpdateMember($listId, $oldEmail, $mergeVars);
|
| 335 |
+
}
|
| 336 |
+
}
|
| 337 |
+
$request = Mage::app()->getRequest();
|
| 338 |
+
//Unsubscribe when update customer from admin
|
| 339 |
+
if (!isset($post['subscription']) && $request->getActionName() == 'save' && $request->getControllerName() == 'customer' && $request->getModuleName() == (string)Mage::getConfig()->getNode('admin/routers/adminhtml/args/frontName')) {
|
| 340 |
+
$subscriber = Mage::getModel('newsletter/subscriber')
|
| 341 |
+
->loadByEmail($customer->getEmail());
|
| 342 |
+
$subscriber->setImportMode(TRUE)->unsubscribe();
|
| 343 |
+
}
|
| 344 |
+
|
| 345 |
+
return $observer;
|
| 346 |
+
}
|
| 347 |
+
|
| 348 |
+
/**
|
| 349 |
+
* Add flag on session to tell the module if on success page should subscribe customer
|
| 350 |
+
*
|
| 351 |
+
* @param Varien_Event_Observer $observer
|
| 352 |
+
* @return void
|
| 353 |
+
*/
|
| 354 |
+
public function registerCheckoutSubscribe(Varien_Event_Observer $observer)
|
| 355 |
+
{
|
| 356 |
+
if(!Mage::helper('monkey')->canMonkey()){
|
| 357 |
+
return;
|
| 358 |
+
}
|
| 359 |
+
|
| 360 |
+
if(Mage::app()->getRequest()->isPost()){
|
| 361 |
+
$subscribe = Mage::app()->getRequest()->getPost('magemonkey_subscribe');
|
| 362 |
+
|
| 363 |
+
Mage::getSingleton('core/session')->setMonkeyPost( serialize(Mage::app()->getRequest()->getPost()) );
|
| 364 |
+
|
| 365 |
+
if(!is_null($subscribe)){
|
| 366 |
+
Mage::getSingleton('core/session')->setMonkeyCheckout($subscribe);
|
| 367 |
+
}
|
| 368 |
+
}
|
| 369 |
+
}
|
| 370 |
+
|
| 371 |
+
/**
|
| 372 |
+
* Subscribe customer to Newsletter if flag on session is present
|
| 373 |
+
*
|
| 374 |
+
* @param Varien_Event_Observer $observer
|
| 375 |
+
* @return void
|
| 376 |
+
*/
|
| 377 |
+
public function registerCheckoutSuccess(Varien_Event_Observer $observer)
|
| 378 |
+
{
|
| 379 |
+
if(!Mage::helper('monkey')->canMonkey()){
|
| 380 |
+
return;
|
| 381 |
+
}
|
| 382 |
+
|
| 383 |
+
$orderId = (int)current($observer->getEvent()->getOrderIds());
|
| 384 |
+
$order = null;
|
| 385 |
+
if($orderId){
|
| 386 |
+
$order = Mage::getModel('sales/order')->load($orderId);
|
| 387 |
+
}
|
| 388 |
+
|
| 389 |
+
if(is_object($order) && $order->getId()){
|
| 390 |
+
//Set Campaign Id if exist
|
| 391 |
+
$campaign_id = Mage::getModel('monkey/ecommerce360')->getCookie()->get('magemonkey_campaign_id');
|
| 392 |
+
if($campaign_id){
|
| 393 |
+
$order->setEbizmartsMagemonkeyCampaignId($campaign_id);
|
| 394 |
+
}
|
| 395 |
+
$sessionFlag = Mage::getSingleton('core/session')->getMonkeyCheckout();
|
| 396 |
+
$forceSubscription = Mage::helper('monkey')->canCheckoutSubscribe();
|
| 397 |
+
if($sessionFlag || $forceSubscription == 3){
|
| 398 |
+
//Guest Checkout
|
| 399 |
+
if( (int)$order->getCustomerGroupId() === Mage_Customer_Model_Group::NOT_LOGGED_IN_ID ){
|
| 400 |
+
Mage::helper('monkey')->registerGuestCustomer($order);
|
| 401 |
+
}
|
| 402 |
+
|
| 403 |
+
try{
|
| 404 |
+
$subscriber = Mage::getModel('newsletter/subscriber')
|
| 405 |
+
->setImportMode(TRUE)
|
| 406 |
+
->subscribe($order->getCustomerEmail());
|
| 407 |
+
}catch(Exception $e){
|
| 408 |
+
Mage::logException($e);
|
| 409 |
+
}
|
| 410 |
+
|
| 411 |
+
}
|
| 412 |
+
|
| 413 |
+
//Multiple lists on checkout
|
| 414 |
+
$monkeyPost = Mage::getSingleton('core/session')->getMonkeyPost(TRUE);
|
| 415 |
+
if($monkeyPost){
|
| 416 |
+
|
| 417 |
+
$post = unserialize($monkeyPost);
|
| 418 |
+
$request = new Varien_Object(array('post' => $post));
|
| 419 |
+
$customer = new Varien_Object(array('email' => $order->getCustomerEmail()));
|
| 420 |
+
|
| 421 |
+
//Handle additional lists subscription on Customer Create Account
|
| 422 |
+
Mage::helper('monkey')->additionalListsSubscription($customer, $request);
|
| 423 |
+
}
|
| 424 |
+
|
| 425 |
+
}
|
| 426 |
+
|
| 427 |
+
}
|
| 428 |
+
|
| 429 |
+
/**
|
| 430 |
+
* Get Mergevars
|
| 431 |
+
*
|
| 432 |
+
* @param null|Mage_Customer_Model_Customer $object
|
| 433 |
+
* @param bool $includeEmail
|
| 434 |
+
* @return array
|
| 435 |
+
*/
|
| 436 |
+
protected function _mergeVars($object = NULL, $includeEmail = FALSE)
|
| 437 |
+
{
|
| 438 |
+
//Initialize as GUEST customer
|
| 439 |
+
$customer = new Varien_Object;
|
| 440 |
+
|
| 441 |
+
$regCustomer = Mage::registry('current_customer');
|
| 442 |
+
$guestCustomer = Mage::registry('mc_guest_customer');
|
| 443 |
+
|
| 444 |
+
if( Mage::helper('customer')->isLoggedIn() ){
|
| 445 |
+
$customer = Mage::helper('customer')->getCustomer();
|
| 446 |
+
}elseif($regCustomer){
|
| 447 |
+
$customer = $regCustomer;
|
| 448 |
+
}elseif($guestCustomer){
|
| 449 |
+
$customer = $guestCustomer;
|
| 450 |
+
}else{
|
| 451 |
+
if(is_null($object)){
|
| 452 |
+
$customer->setEmail($object->getSubscriberEmail())
|
| 453 |
+
->setStoreId($object->getStoreId());
|
| 454 |
+
}else{
|
| 455 |
+
$customer = $object;
|
| 456 |
+
}
|
| 457 |
+
|
| 458 |
+
}
|
| 459 |
+
|
| 460 |
+
if(is_object($object)){
|
| 461 |
+
if($object->getListGroups()){
|
| 462 |
+
$customer->setListGroups($object->getListGroups());
|
| 463 |
+
}
|
| 464 |
+
|
| 465 |
+
if($object->getMcListId()){
|
| 466 |
+
$customer->setMcListId($object->getMcListId());
|
| 467 |
+
}
|
| 468 |
+
}
|
| 469 |
+
|
| 470 |
+
$mergeVars = Mage::helper('monkey')->getMergeVars($customer, $includeEmail);
|
| 471 |
+
|
| 472 |
+
return $mergeVars;
|
| 473 |
+
}
|
| 474 |
+
|
| 475 |
+
/** Add mass action option to Sales -> Order grid in admin panel to send orders to MC (Ecommerce360)
|
| 476 |
+
*
|
| 477 |
+
* @param Varien_Event_Observer $observer
|
| 478 |
+
* @return void
|
| 479 |
+
*/
|
| 480 |
+
public function massActionOption($observer)
|
| 481 |
+
{
|
| 482 |
+
if(!Mage::helper('monkey')->canMonkey()){
|
| 483 |
+
return;
|
| 484 |
+
}
|
| 485 |
+
$block = $observer->getEvent()->getBlock();
|
| 486 |
+
|
| 487 |
+
if($block instanceof Mage_Adminhtml_Block_Widget_Grid_Massaction || $block instanceof Enterprise_SalesArchive_Block_Adminhtml_Sales_Order_Grid_Massaction) {
|
| 488 |
+
|
| 489 |
+
if($block->getRequest()->getControllerName() == 'sales_order') {
|
| 490 |
+
|
| 491 |
+
$block->addItem('magemonkey_ecommerce360', array(
|
| 492 |
+
'label'=> Mage::helper('monkey')->__('Send to MailChimp'),
|
| 493 |
+
'url' => Mage::app()->getStore()->getUrl('monkey/adminhtml_ecommerce/masssend', Mage::app()->getStore()->isCurrentlySecure() ? array('_secure'=>true) : array()),
|
| 494 |
+
));
|
| 495 |
+
|
| 496 |
+
}
|
| 497 |
+
}
|
| 498 |
+
}
|
| 499 |
+
|
| 500 |
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* MC source class for account data
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_MageMonkey
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_MageMonkey_Model_System_Config_Source_Account
|
| 11 |
+
{
|
| 12 |
+
|
| 13 |
+
/**
|
| 14 |
+
* Account details storage
|
| 15 |
+
*
|
| 16 |
+
* @access protected
|
| 17 |
+
* @var bool|array
|
| 18 |
+
*/
|
| 19 |
+
protected $_account_details = FALSE;
|
| 20 |
+
|
| 21 |
+
/**
|
| 22 |
+
* Set AccountDetails on class property if not already set
|
| 23 |
+
*
|
| 24 |
+
* @return void
|
| 25 |
+
*/
|
| 26 |
+
public function __construct()
|
| 27 |
+
{
|
| 28 |
+
if (!$this->_account_details) {
|
| 29 |
+
$this->_account_details = Mage::getSingleton('monkey/api')
|
| 30 |
+
->getAccountDetails();
|
| 31 |
+
}
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
/**
|
| 35 |
+
* Return data if API key is entered
|
| 36 |
+
*
|
| 37 |
+
* @return array
|
| 38 |
+
*/
|
| 39 |
+
public function toOptionArray()
|
| 40 |
+
{
|
| 41 |
+
if(is_array($this->_account_details)){
|
| 42 |
+
return array(
|
| 43 |
+
array('value' => 0, 'label' => Mage::helper('monkey')->__('Username:') . ' ' . $this->_account_details['username']),
|
| 44 |
+
array('value' => 1, 'label' => Mage::helper('monkey')->__('Plan type:') . ' ' . $this->_account_details['plan_type']),
|
| 45 |
+
array('value' => 2, 'label' => Mage::helper('monkey')->__('Is in trial mode?:') . ' ' . ($this->_account_details['is_trial'] ? Mage::helper('monkey')->__('Yes') : Mage::helper('monkey')->__('No')))
|
| 46 |
+
);
|
| 47 |
+
}else{
|
| 48 |
+
return array(array('value' => '', 'label' => Mage::helper('monkey')->__('--- Enter your API KEY first ---')));
|
| 49 |
+
}
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Source model for bulksync data source (export)
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_MageMonkey
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_MageMonkey_Model_System_Config_Source_BulksyncDatasource
|
| 11 |
+
{
|
| 12 |
+
|
| 13 |
+
/**
|
| 14 |
+
* Options getter
|
| 15 |
+
*
|
| 16 |
+
* @return array
|
| 17 |
+
*/
|
| 18 |
+
public function toOptionArray()
|
| 19 |
+
{
|
| 20 |
+
return array(
|
| 21 |
+
array('value' => 'customer', 'label' => Mage::helper('monkey')->__('Subscribe Magento customers to MailChimp')),
|
| 22 |
+
array('value' => 'newsletter_subscriber', 'label' => Mage::helper('monkey')->__('Send Magento Newsletter subscribers to MailChimp')),
|
| 23 |
+
);
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Bulksync status list source
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_MageMonkey
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_MageMonkey_Model_System_Config_Source_BulksyncStatus
|
| 11 |
+
{
|
| 12 |
+
|
| 13 |
+
/**
|
| 14 |
+
* Options getter
|
| 15 |
+
*
|
| 16 |
+
* @return array
|
| 17 |
+
*/
|
| 18 |
+
public function toOptionArray()
|
| 19 |
+
{
|
| 20 |
+
return array(
|
| 21 |
+
array('value' => 'idle', 'label' => Mage::helper('monkey')->__('IDLE')),
|
| 22 |
+
array('value' => 'running', 'label' => Mage::helper('monkey')->__('Running Now')),
|
| 23 |
+
array('value' => 'chunk_running', 'label' => Mage::helper('monkey')->__('Running')),
|
| 24 |
+
array('value' => 'finished', 'label' => Mage::helper('monkey')->__('Completed')),
|
| 25 |
+
);
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
/**
|
| 29 |
+
* Another way of returning data
|
| 30 |
+
*
|
| 31 |
+
* @return array
|
| 32 |
+
*/
|
| 33 |
+
public function toOption()
|
| 34 |
+
{
|
| 35 |
+
$options = $this->toOptionArray();
|
| 36 |
+
|
| 37 |
+
$ary = array();
|
| 38 |
+
|
| 39 |
+
foreach($options as $option){
|
| 40 |
+
$ary[$option['value']] = $option['label'];
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
return $ary;
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
/**
|
| 5 |
+
* Checkout subscribe available status options source
|
| 6 |
+
*
|
| 7 |
+
* @category Ebizmarts
|
| 8 |
+
* @package Ebizmarts_MageMonkey
|
| 9 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 10 |
+
*/
|
| 11 |
+
class Ebizmarts_MageMonkey_Model_System_Config_Source_Checkoutsubscribe
|
| 12 |
+
{
|
| 13 |
+
/**
|
| 14 |
+
* Options getter
|
| 15 |
+
*
|
| 16 |
+
* @return array
|
| 17 |
+
*/
|
| 18 |
+
public function toOptionArray()
|
| 19 |
+
{
|
| 20 |
+
return array(
|
| 21 |
+
array('value' => 1, 'label' => Mage::helper('monkey')->__('Enabled - Checked by default')),
|
| 22 |
+
array('value' => 2, 'label' => Mage::helper('monkey')->__('Enabled - Not Checked by default')),
|
| 23 |
+
array('value' => 3, 'label' => Mage::helper('monkey')->__('Enabled - Force subscription')),
|
| 24 |
+
array('value' => 0, 'label' => Mage::helper('monkey')->__('-- Disabled --'))
|
| 25 |
+
);
|
| 26 |
+
}
|
| 27 |
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
/**
|
| 5 |
+
* Cron Process available count limits options source
|
| 6 |
+
*
|
| 7 |
+
* @category Ebizmarts
|
| 8 |
+
* @package Ebizmarts_MageMonkey
|
| 9 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 10 |
+
*/
|
| 11 |
+
class Ebizmarts_MageMonkey_Model_System_Config_Source_CronProcessLimit
|
| 12 |
+
{
|
| 13 |
+
/**
|
| 14 |
+
* Options getter
|
| 15 |
+
*
|
| 16 |
+
* @return array
|
| 17 |
+
*/
|
| 18 |
+
public function toOptionArray()
|
| 19 |
+
{
|
| 20 |
+
return array(
|
| 21 |
+
array('value' => 100, 'label' => Mage::helper('monkey')->__('100')),
|
| 22 |
+
array('value' => 200, 'label' => Mage::helper('monkey')->__('200')),
|
| 23 |
+
array('value' => 500, 'label' => Mage::helper('monkey')->__('500')),
|
| 24 |
+
array('value' => 1000, 'label' => Mage::helper('monkey')->__('1000')),
|
| 25 |
+
array('value' => 5000, 'label' => Mage::helper('monkey')->__('5000')),
|
| 26 |
+
array('value' => 10000, 'label' => Mage::helper('monkey')->__('10000')),
|
| 27 |
+
array('value' => 20000, 'label' => Mage::helper('monkey')->__('20000'))
|
| 28 |
+
);
|
| 29 |
+
}
|
| 30 |
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Ecommerce360 export orders config source options list
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_MageMonkey
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_MageMonkey_Model_System_Config_Source_Ecommerce360
|
| 11 |
+
{
|
| 12 |
+
/**
|
| 13 |
+
* Options getter
|
| 14 |
+
*
|
| 15 |
+
* @return array
|
| 16 |
+
*/
|
| 17 |
+
public function toOptionArray()
|
| 18 |
+
{
|
| 19 |
+
return array(
|
| 20 |
+
array('value' => 1, 'label' => Mage::helper('monkey')->__('Referred Orders')),
|
| 21 |
+
array('value' => 2, 'label' => Mage::helper('monkey')->__('All Orders')),
|
| 22 |
+
array('value' => 3, 'label' => Mage::helper('monkey')->__('By Cron depending on the Orders Status')),
|
| 23 |
+
array('value' => 0, 'label' => Mage::helper('monkey')->__('-- Disabled --'))
|
| 24 |
+
);
|
| 25 |
+
}
|
| 26 |
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* MailChimp lists source file
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_MageMonkey
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_MageMonkey_Model_System_Config_Source_List
|
| 11 |
+
{
|
| 12 |
+
|
| 13 |
+
/**
|
| 14 |
+
* Lists for API key will be stored here
|
| 15 |
+
*
|
| 16 |
+
* @access protected
|
| 17 |
+
* @var array Email lists for given API key
|
| 18 |
+
*/
|
| 19 |
+
protected $_lists = null;
|
| 20 |
+
|
| 21 |
+
/**
|
| 22 |
+
* Load lists and store on class property
|
| 23 |
+
*
|
| 24 |
+
* @return void
|
| 25 |
+
*/
|
| 26 |
+
public function __construct()
|
| 27 |
+
{
|
| 28 |
+
if( is_null($this->_lists) ){
|
| 29 |
+
$this->_lists = Mage::getSingleton('monkey/api')
|
| 30 |
+
->lists();
|
| 31 |
+
}
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
/**
|
| 35 |
+
* Options getter
|
| 36 |
+
*
|
| 37 |
+
* @return array
|
| 38 |
+
*/
|
| 39 |
+
public function toOptionArray()
|
| 40 |
+
{
|
| 41 |
+
$lists = array();
|
| 42 |
+
|
| 43 |
+
if(is_array($this->_lists)){
|
| 44 |
+
|
| 45 |
+
foreach($this->_lists['data'] as $list){
|
| 46 |
+
$lists []= array('value' => $list['id'], 'label' => $list['name'] . ' (' . $list['stats']['member_count'] . ' ' . Mage::helper('monkey')->__('members') . ')');
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
}else{
|
| 50 |
+
$lists []= array('value' => '', 'label' => Mage::helper('monkey')->__('--- No data ---'));
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
return $lists;
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Subscriber status config source options model
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_MageMonkey
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_MageMonkey_Model_System_Config_Source_OrderStatus
|
| 11 |
+
{
|
| 12 |
+
|
| 13 |
+
/**
|
| 14 |
+
* Options getter
|
| 15 |
+
*
|
| 16 |
+
* @return array
|
| 17 |
+
*/
|
| 18 |
+
public function toOptionArray()
|
| 19 |
+
{
|
| 20 |
+
$status = Mage::GetResourceModel('sales/order_status_collection')->toOptionArray();
|
| 21 |
+
$allStateOptions = array('value' => 'all_status', 'label' => Mage::helper('monkey')->__('All Status'));
|
| 22 |
+
array_unshift($status, $allStateOptions);
|
| 23 |
+
return $status;
|
| 24 |
+
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Subscriber status config source options model
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_MageMonkey
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_MageMonkey_Model_System_Config_Source_Status
|
| 11 |
+
{
|
| 12 |
+
|
| 13 |
+
/**
|
| 14 |
+
* Options getter
|
| 15 |
+
*
|
| 16 |
+
* @return array
|
| 17 |
+
*/
|
| 18 |
+
public function toOptionArray()
|
| 19 |
+
{
|
| 20 |
+
return array(
|
| 21 |
+
array('value' => 'subscribed', 'label' => Mage::helper('monkey')->__('Subscribed')),
|
| 22 |
+
array('value' => 'unsubscribed', 'label' => Mage::helper('monkey')->__('Unsubscribed')),
|
| 23 |
+
array('value' => 'cleaned', 'label' => Mage::helper('monkey')->__('Cleaned')),
|
| 24 |
+
array('value' => 'updated', 'label' => Mage::helper('monkey')->__('Updated')),
|
| 25 |
+
);
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Transactional emails data source
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_MageMonkey
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_MageMonkey_Model_System_Config_Source_TransactionalEmails
|
| 11 |
+
{
|
| 12 |
+
|
| 13 |
+
/**
|
| 14 |
+
* Return available options
|
| 15 |
+
*
|
| 16 |
+
* @return array
|
| 17 |
+
*/
|
| 18 |
+
public function toOptionArray()
|
| 19 |
+
{
|
| 20 |
+
return array(
|
| 21 |
+
array('value' => 'false', 'label' => Mage::helper('monkey')->__('Disabled')),
|
| 22 |
+
array('value' => 'sts', 'label' => Mage::helper('monkey')->__('STS')),
|
| 23 |
+
array('value' => 'mandrill', 'label' => Mage::helper('monkey')->__('Mandrill'))
|
| 24 |
+
);
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
/**
|
| 5 |
+
* Webhook delete available status options source
|
| 6 |
+
*
|
| 7 |
+
* @category Ebizmarts
|
| 8 |
+
* @package Ebizmarts_MageMonkey
|
| 9 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 10 |
+
*/
|
| 11 |
+
class Ebizmarts_MageMonkey_Model_System_Config_Source_WebhookDelete
|
| 12 |
+
{
|
| 13 |
+
/**
|
| 14 |
+
* Options getter
|
| 15 |
+
*
|
| 16 |
+
* @return array
|
| 17 |
+
*/
|
| 18 |
+
public function toOptionArray()
|
| 19 |
+
{
|
| 20 |
+
return array(
|
| 21 |
+
array('value' => 0, 'label' => Mage::helper('monkey')->__('Unsuscribe customers')),
|
| 22 |
+
array('value' => 1, 'label' => Mage::helper('monkey')->__('Delete customer account'))
|
| 23 |
+
);
|
| 24 |
+
}
|
| 25 |
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Transactional Email Adapter
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_MageMonkey
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_MageMonkey_Model_TransactionalEmail_Adapter
|
| 11 |
+
{
|
| 12 |
+
const ADAPTER_STS = 'sts';
|
| 13 |
+
const ADAPTER_MANDRILL = 'mandrill';
|
| 14 |
+
|
| 15 |
+
public static function factory($adapter)
|
| 16 |
+
{
|
| 17 |
+
switch($adapter) {
|
| 18 |
+
case self::ADAPTER_STS:
|
| 19 |
+
return new Ebizmarts_MageMonkey_Model_TransactionalEmail_STS();
|
| 20 |
+
break;
|
| 21 |
+
case self::ADAPTER_MANDRILL:
|
| 22 |
+
return new Ebizmarts_MageMonkey_Model_TransactionalEmail_MANDRILL();
|
| 23 |
+
break;
|
| 24 |
+
default:
|
| 25 |
+
throw new Exception('Invalid Transactional Email service selected.');
|
| 26 |
+
break;
|
| 27 |
+
}
|
| 28 |
+
}
|
| 29 |
+
}
|
|
@@ -0,0 +1,354 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* MailChimp MANDRILL API wrapper
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_MageMonkey
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_MageMonkey_Model_TransactionalEmail_MANDRILL
|
| 11 |
+
{
|
| 12 |
+
|
| 13 |
+
/**
|
| 14 |
+
* API version number
|
| 15 |
+
*
|
| 16 |
+
* @var string
|
| 17 |
+
*/
|
| 18 |
+
public $version = '1.0';
|
| 19 |
+
|
| 20 |
+
/**
|
| 21 |
+
* Error Message storage
|
| 22 |
+
*
|
| 23 |
+
* @var string
|
| 24 |
+
*/
|
| 25 |
+
public $errorMessage;
|
| 26 |
+
|
| 27 |
+
/**
|
| 28 |
+
* Error Code storage
|
| 29 |
+
*
|
| 30 |
+
* @var integer
|
| 31 |
+
*/
|
| 32 |
+
public $errorCode;
|
| 33 |
+
|
| 34 |
+
/**
|
| 35 |
+
* Cache the user api_key so we only have to log in once per client instantiation
|
| 36 |
+
*
|
| 37 |
+
* @var string MailChimp API key
|
| 38 |
+
*/
|
| 39 |
+
public $api_key;
|
| 40 |
+
|
| 41 |
+
/**
|
| 42 |
+
* STS API URL
|
| 43 |
+
*
|
| 44 |
+
* @var string
|
| 45 |
+
*/
|
| 46 |
+
public $apiUrl;
|
| 47 |
+
|
| 48 |
+
/**
|
| 49 |
+
* Request output format
|
| 50 |
+
*
|
| 51 |
+
* @var string
|
| 52 |
+
*/
|
| 53 |
+
protected $_output = 'json';
|
| 54 |
+
|
| 55 |
+
/**
|
| 56 |
+
* Setup data
|
| 57 |
+
*
|
| 58 |
+
* @param string $apikey Your MailChimp apikey
|
| 59 |
+
* @param string $secure Whether or not this should use a secure connection
|
| 60 |
+
*/
|
| 61 |
+
function __construct($apikey = null)
|
| 62 |
+
{
|
| 63 |
+
if($apikey){
|
| 64 |
+
$this->setApiKey($apikey);
|
| 65 |
+
}
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
/**
|
| 69 |
+
* Api key setter
|
| 70 |
+
*
|
| 71 |
+
* @param string $key API Key
|
| 72 |
+
* @return Ebizmarts_MageMonkey_Model_TransactionalEmail_MANDRILL
|
| 73 |
+
*/
|
| 74 |
+
public function setApiKey($key)
|
| 75 |
+
{
|
| 76 |
+
$this->api_key = $key;
|
| 77 |
+
|
| 78 |
+
$this->apiUrl = "http://mandrillapp.com/api/{$this->version}/";
|
| 79 |
+
|
| 80 |
+
return $this;
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
/**
|
| 84 |
+
* ===== Users 유 Calls =====
|
| 85 |
+
*/
|
| 86 |
+
|
| 87 |
+
/**
|
| 88 |
+
* Validate an API key and respond to a ping
|
| 89 |
+
*
|
| 90 |
+
*/
|
| 91 |
+
public function usersPing()
|
| 92 |
+
{
|
| 93 |
+
return $this->_callServer("users/ping");
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
/**
|
| 97 |
+
* Return the information about the API-connected user
|
| 98 |
+
*
|
| 99 |
+
*/
|
| 100 |
+
public function usersInfo()
|
| 101 |
+
{
|
| 102 |
+
return $this->_callServer("users/info");
|
| 103 |
+
}
|
| 104 |
+
|
| 105 |
+
/**
|
| 106 |
+
* Return the senders that have tried to use this account, both verified and unverified
|
| 107 |
+
*
|
| 108 |
+
*/
|
| 109 |
+
public function usersSenders()
|
| 110 |
+
{
|
| 111 |
+
return $this->_callServer("users/senders");
|
| 112 |
+
}
|
| 113 |
+
|
| 114 |
+
/**
|
| 115 |
+
* Disable a sender from being able to send
|
| 116 |
+
*
|
| 117 |
+
* @param string $email
|
| 118 |
+
*/
|
| 119 |
+
public function usersDisableSender($email)
|
| 120 |
+
{
|
| 121 |
+
$params = array();
|
| 122 |
+
$params["email"] = $email;
|
| 123 |
+
|
| 124 |
+
return $this->_callServer("users/disable-sender", $params);
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
/**
|
| 128 |
+
* Send an email to the given address to verify that it is an accepted sender for your Mandrill account.
|
| 129 |
+
*
|
| 130 |
+
* @param string $email
|
| 131 |
+
*/
|
| 132 |
+
public function usersVerifySender($email)
|
| 133 |
+
{
|
| 134 |
+
$params = array();
|
| 135 |
+
$params["email"] = $email;
|
| 136 |
+
|
| 137 |
+
return $this->_callServer("users/verify-sender", $params);
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
+
public function verifyEmailAddress($email)
|
| 141 |
+
{
|
| 142 |
+
return $this->usersVerifySender($email);
|
| 143 |
+
}
|
| 144 |
+
|
| 145 |
+
/**
|
| 146 |
+
*
|
| 147 |
+
* ===== Users 유 Calls =====
|
| 148 |
+
*/
|
| 149 |
+
|
| 150 |
+
|
| 151 |
+
/**
|
| 152 |
+
* ===== Messages ✐ Calls =====
|
| 153 |
+
*/
|
| 154 |
+
|
| 155 |
+
/**
|
| 156 |
+
* Send a new transactional message through Mandrill
|
| 157 |
+
*
|
| 158 |
+
* @param array $message The message data with the following keys:
|
| 159 |
+
* string html the full HTML content to be sent
|
| 160 |
+
* string text optional full text content to be sent
|
| 161 |
+
* string subject the message subject
|
| 162 |
+
* string from_email the sender email address. If this address has not been verified, the message will be queued and not sent until it is verified
|
| 163 |
+
* string from_name optional from name to be used
|
| 164 |
+
* array to an array of email addresses to use as recipients. Each item in the array should be a struct with two keys - email: the email address of the recipient, and name: the optional display name to use for the recipient
|
| 165 |
+
* struct headers optional extra headers to add to the message (currently only Reply-To and X-* headers are allowed)
|
| 166 |
+
* boolean track_opens whether or not to turn on open tracking for the message
|
| 167 |
+
* boolean track_clicks whether or not to turn on click tracking for the message
|
| 168 |
+
* array tags an array of string to tag the message with. Stats are accumulated using tags, though we only store the first 100 we see, so this should not be unique or change frequently. Tags should be 50 characters or less. Any tags starting with an understore are reserved for internal use and will cause errors.
|
| 169 |
+
*/
|
| 170 |
+
public function messagesSend($message)
|
| 171 |
+
{
|
| 172 |
+
|
| 173 |
+
$to = array();
|
| 174 |
+
|
| 175 |
+
foreach($message['to_email'] as $pos => $email){
|
| 176 |
+
$to []= array(
|
| 177 |
+
'email' => $email,
|
| 178 |
+
'name' => $message['to_name'][$pos]
|
| 179 |
+
);
|
| 180 |
+
}
|
| 181 |
+
|
| 182 |
+
$message['to'] = $to;
|
| 183 |
+
unset($message['to_email'], $message['to_name']);
|
| 184 |
+
|
| 185 |
+
$params = array();
|
| 186 |
+
$params["message"] = $message;
|
| 187 |
+
|
| 188 |
+
return $this->_callServer("messages/send", $params);
|
| 189 |
+
}
|
| 190 |
+
|
| 191 |
+
public function sendEmail($message)
|
| 192 |
+
{
|
| 193 |
+
return $this->messagesSend($message);
|
| 194 |
+
}
|
| 195 |
+
|
| 196 |
+
/**
|
| 197 |
+
* ===== Messages ✐ Calls =====
|
| 198 |
+
*/
|
| 199 |
+
|
| 200 |
+
|
| 201 |
+
/**
|
| 202 |
+
* ===== Tags ✰ Calls =====
|
| 203 |
+
*/
|
| 204 |
+
|
| 205 |
+
/**
|
| 206 |
+
* Return all of the user-defined tag information
|
| 207 |
+
*
|
| 208 |
+
*/
|
| 209 |
+
public function tagsList()
|
| 210 |
+
{
|
| 211 |
+
return $this->_callServer("tags/list");
|
| 212 |
+
}
|
| 213 |
+
|
| 214 |
+
/**
|
| 215 |
+
* Return the recent history (hourly stats for the last 30 days) for a tag
|
| 216 |
+
*
|
| 217 |
+
* @param string $tag
|
| 218 |
+
*/
|
| 219 |
+
public function tagsTimeSeries($tag)
|
| 220 |
+
{
|
| 221 |
+
$params = array();
|
| 222 |
+
$params["tag"] = $tag;
|
| 223 |
+
|
| 224 |
+
return $this->_callServer("tags/time-series", $params);
|
| 225 |
+
}
|
| 226 |
+
|
| 227 |
+
/**
|
| 228 |
+
* Return the recent history (hourly stats for the last 30 days) for all tags
|
| 229 |
+
*
|
| 230 |
+
*/
|
| 231 |
+
public function tagsAllTimeSeries()
|
| 232 |
+
{
|
| 233 |
+
return $this->_callServer("tags/all-time-series");
|
| 234 |
+
}
|
| 235 |
+
|
| 236 |
+
/**
|
| 237 |
+
* ===== Tags ✰ Calls =====
|
| 238 |
+
*/
|
| 239 |
+
|
| 240 |
+
|
| 241 |
+
/**
|
| 242 |
+
* ===== Urls ≎ Calls =====
|
| 243 |
+
*/
|
| 244 |
+
|
| 245 |
+
/**
|
| 246 |
+
* Get the 100 most clicked URLs
|
| 247 |
+
*
|
| 248 |
+
*/
|
| 249 |
+
public function urlsList()
|
| 250 |
+
{
|
| 251 |
+
return $this->_callServer("urls/list");
|
| 252 |
+
}
|
| 253 |
+
|
| 254 |
+
/**
|
| 255 |
+
* Return the 100 most clicked URLs that match the search query given
|
| 256 |
+
*
|
| 257 |
+
* @param string $query
|
| 258 |
+
*/
|
| 259 |
+
public function urlsSearch($query)
|
| 260 |
+
{
|
| 261 |
+
$params = array();
|
| 262 |
+
$params["q"] = $query;
|
| 263 |
+
|
| 264 |
+
return $this->_callServer("urls/search", $params);
|
| 265 |
+
}
|
| 266 |
+
|
| 267 |
+
/**
|
| 268 |
+
* Return the recent history (hourly stats for the last 30 days) for a url
|
| 269 |
+
*
|
| 270 |
+
* @param string $url
|
| 271 |
+
*/
|
| 272 |
+
public function urlsTimeSeries($url)
|
| 273 |
+
{
|
| 274 |
+
$params = array();
|
| 275 |
+
$params["url"] = $url;
|
| 276 |
+
|
| 277 |
+
return $this->_callServer("urls/time-series", $params);
|
| 278 |
+
}
|
| 279 |
+
|
| 280 |
+
/**
|
| 281 |
+
* ===== Urls ≎ Calls =====
|
| 282 |
+
*/
|
| 283 |
+
|
| 284 |
+
|
| 285 |
+
/**
|
| 286 |
+
* Actually connect to the server and call the requested methods, parsing the result
|
| 287 |
+
*
|
| 288 |
+
* @param string $method
|
| 289 |
+
* @param array OPTIONAL $params
|
| 290 |
+
* @return object|false
|
| 291 |
+
*/
|
| 292 |
+
protected function _callServer($method, $params = array())
|
| 293 |
+
{
|
| 294 |
+
|
| 295 |
+
$this->errorMessage = null;
|
| 296 |
+
$this->errorCode = null;
|
| 297 |
+
|
| 298 |
+
$params['key'] = $this->api_key;
|
| 299 |
+
|
| 300 |
+
$url = $this->apiUrl . $method . '.' . $this->_output;
|
| 301 |
+
|
| 302 |
+
Mage::helper('monkey')->log($url, 'MageMonkey_ApiCall.log');
|
| 303 |
+
Mage::helper('monkey')->log($params, 'MageMonkey_ApiCall.log');
|
| 304 |
+
|
| 305 |
+
$curlSession = curl_init();
|
| 306 |
+
|
| 307 |
+
curl_setopt($curlSession, CURLOPT_USERAGENT, Mage::helper('monkey')->getUserAgent());
|
| 308 |
+
curl_setopt($curlSession, CURLOPT_URL, $url);
|
| 309 |
+
curl_setopt($curlSession, CURLOPT_HEADER, 0);
|
| 310 |
+
curl_setopt($curlSession, CURLOPT_POST, TRUE);
|
| 311 |
+
curl_setopt($curlSession, CURLOPT_POSTFIELDS, http_build_query($params));
|
| 312 |
+
curl_setopt($curlSession, CURLOPT_RETURNTRANSFER, TRUE);
|
| 313 |
+
//curl_setopt($curlSession, CURLOPT_SSL_VERIFYPEER, FALSE);
|
| 314 |
+
//curl_setopt($curlSession, CURLOPT_SSL_VERIFYHOST, 1);
|
| 315 |
+
|
| 316 |
+
$result = curl_exec($curlSession);
|
| 317 |
+
if(!$result){
|
| 318 |
+
|
| 319 |
+
$errstr = curl_error($curlSession);
|
| 320 |
+
$errno = curl_errno($curlSession);
|
| 321 |
+
|
| 322 |
+
$this->errorMessage = "Could not connect (ERR $errno: $errstr)";
|
| 323 |
+
$this->errorCode = "-99";
|
| 324 |
+
return false;
|
| 325 |
+
}
|
| 326 |
+
|
| 327 |
+
// Check that a connection was made
|
| 328 |
+
if (curl_error($curlSession)) {
|
| 329 |
+
$this->errorMessage = curl_error($curlSession);
|
| 330 |
+
$this->errorCode = "-99";
|
| 331 |
+
return false;
|
| 332 |
+
}
|
| 333 |
+
|
| 334 |
+
$httpCode = curl_getinfo($curlSession, CURLINFO_HTTP_CODE);
|
| 335 |
+
|
| 336 |
+
curl_close($curlSession);
|
| 337 |
+
|
| 338 |
+
$resultObject = json_decode($result);
|
| 339 |
+
|
| 340 |
+
Mage::helper('monkey')->log($resultObject, 'MageMonkey_ApiCall.log');
|
| 341 |
+
|
| 342 |
+
//You can consider any non-200 HTTP response code an error
|
| 343 |
+
//the returned data will contain more detailed information
|
| 344 |
+
if($httpCode != 200){
|
| 345 |
+
$this->errorMessage = $resultObject->message;
|
| 346 |
+
$this->errorCode = "-99";
|
| 347 |
+
return false;
|
| 348 |
+
}
|
| 349 |
+
|
| 350 |
+
return $resultObject;
|
| 351 |
+
|
| 352 |
+
}
|
| 353 |
+
|
| 354 |
+
}
|
|
@@ -0,0 +1,242 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* MailChimp STS (Amazon Simple Email Service) API wrapper
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_MageMonkey
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_MageMonkey_Model_TransactionalEmail_STS
|
| 11 |
+
{
|
| 12 |
+
/**
|
| 13 |
+
* API version number
|
| 14 |
+
*
|
| 15 |
+
* @var string
|
| 16 |
+
*/
|
| 17 |
+
public $version = '1.0';
|
| 18 |
+
|
| 19 |
+
/**
|
| 20 |
+
* Error Message storage
|
| 21 |
+
*
|
| 22 |
+
* @var string
|
| 23 |
+
*/
|
| 24 |
+
public $errorMessage;
|
| 25 |
+
|
| 26 |
+
/**
|
| 27 |
+
* Error Code storage
|
| 28 |
+
*
|
| 29 |
+
* @var integer
|
| 30 |
+
*/
|
| 31 |
+
public $errorCode;
|
| 32 |
+
|
| 33 |
+
/**
|
| 34 |
+
* Cache the user api_key so we only have to log in once per client instantiation
|
| 35 |
+
*
|
| 36 |
+
* @var string MailChimp API key
|
| 37 |
+
*/
|
| 38 |
+
public $api_key;
|
| 39 |
+
|
| 40 |
+
/**
|
| 41 |
+
* Use Secure connection or not
|
| 42 |
+
*
|
| 43 |
+
* @var bool
|
| 44 |
+
*/
|
| 45 |
+
public $secure = false;
|
| 46 |
+
|
| 47 |
+
/**
|
| 48 |
+
* STS API URL
|
| 49 |
+
*
|
| 50 |
+
* @var string
|
| 51 |
+
*/
|
| 52 |
+
public $apiUrl;
|
| 53 |
+
|
| 54 |
+
/**
|
| 55 |
+
* Setup data
|
| 56 |
+
*
|
| 57 |
+
* @param string $apikey Your MailChimp apikey
|
| 58 |
+
* @param string $secure Whether or not this should use a secure connection
|
| 59 |
+
*/
|
| 60 |
+
function __construct($apikey = null, $secure = false)
|
| 61 |
+
{
|
| 62 |
+
$this->secure = $secure;
|
| 63 |
+
|
| 64 |
+
if($apikey){
|
| 65 |
+
$this->setApiKey($apikey);
|
| 66 |
+
}
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
/**
|
| 70 |
+
* Api key setter
|
| 71 |
+
*
|
| 72 |
+
* @param string $key API Key
|
| 73 |
+
* @return Ebizmarts_MageMonkey_Model_TransactionalEmail_STS
|
| 74 |
+
*/
|
| 75 |
+
public function setApiKey($key)
|
| 76 |
+
{
|
| 77 |
+
$this->api_key = $key;
|
| 78 |
+
|
| 79 |
+
$dc = "us1";
|
| 80 |
+
if (strstr($this->api_key, "-")){
|
| 81 |
+
list($key, $dc) = explode("-", $this->api_key, 2);
|
| 82 |
+
if (!$dc){
|
| 83 |
+
$dc = "us1";
|
| 84 |
+
}
|
| 85 |
+
}
|
| 86 |
+
$this->apiUrl = "http://{$dc}.sts.mailchimp.com/{$this->version}/";
|
| 87 |
+
|
| 88 |
+
return $this;
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
/**
|
| 92 |
+
* Composes an email message based on input data, and then immediately queues the message for sending.
|
| 93 |
+
* We manage requeuing for you, so if a message gets rejected for a queueing issue, you've completely blown out your Amazon sending limits.
|
| 94 |
+
* You are encourage to always make this call with a POST request.
|
| 95 |
+
*
|
| 96 |
+
* <Important: If you have not yet requested production access to Amazon SES, then you will only be able to send email to and from verified email addresses.>
|
| 97 |
+
*
|
| 98 |
+
*
|
| 99 |
+
* @param array $message The message data with the following keys:
|
| 100 |
+
* string html the full HTML content to be sent
|
| 101 |
+
* string text optional - the full Text content to be sent
|
| 102 |
+
* string subject the message subject
|
| 103 |
+
* string from_name the from name to be used
|
| 104 |
+
* string from_email a verified email address from ListVerifiedEmailAddresses
|
| 105 |
+
* array reply_to option the email address(es) that should be set as reply-to email addresses.
|
| 106 |
+
* array to_email an array containing up to 50 email addresses to receive this email
|
| 107 |
+
* array to_name optional - an array of To names to be used. Theses will be processed in order with to_email, so every to_email should have a to_name, even if it is blank.
|
| 108 |
+
* array cc_email optional - an array containing up to 50 email addresses to receive this email as CC recipients
|
| 109 |
+
* array cc_name optional - an array of CC names to be used. Theses will be processed in order with to_email, so every to_email should have a to_name, even if it is blank.
|
| 110 |
+
* array bcc_email optional - an array containing up to 50 email addresses to receive this email as BCC recipients
|
| 111 |
+
* array bcc_name optional - an array of BCC names to be used. Theses will be processed in order with to_email, so every to_email should have a to_name, even if it is blank.
|
| 112 |
+
* bool autogen_html optional - if an html section is not passed in, generate it from the text. For historical reasons, this defaults to true.
|
| 113 |
+
* @param bool $track_opens whether or not to turn on MailChimp-specific opens tracking
|
| 114 |
+
* @param bool $track_clicks whether or not to turn on MailChimp-specific click tracking
|
| 115 |
+
* @param array $tags an array of strings to tag the message with. Stats can be accumulated using tags, though we only store the first 100 we see, so this should not be unique or change frequently. Tags should be 50 characters or less - any starting with an underscore are reserved and will cause errors.
|
| 116 |
+
* @return JSON object containing the "status" as either "sent" or "queued" along with extra info on what happened.
|
| 117 |
+
*/
|
| 118 |
+
public function sendEmail($message, $track_opens = FALSE, $track_clicks = FALSE, $tags = array())
|
| 119 |
+
{
|
| 120 |
+
|
| 121 |
+
$params = array();
|
| 122 |
+
$params["message"] = $message;
|
| 123 |
+
$params["track_opens"] = $track_opens;
|
| 124 |
+
$params["track_clicks"] = $track_clicks;
|
| 125 |
+
$params["tags"] = $tags;
|
| 126 |
+
|
| 127 |
+
return $this->_callServer("SendEmail", $params);
|
| 128 |
+
|
| 129 |
+
}
|
| 130 |
+
|
| 131 |
+
/**
|
| 132 |
+
* Returns a list containing all of the email addresses that have been verified.
|
| 133 |
+
*
|
| 134 |
+
* @return array
|
| 135 |
+
*/
|
| 136 |
+
public function listVerifiedEmailAddresses()
|
| 137 |
+
{
|
| 138 |
+
return $this->_callServer("ListVerifiedEmailAddresses");
|
| 139 |
+
}
|
| 140 |
+
|
| 141 |
+
/**
|
| 142 |
+
* Verifies an email address.
|
| 143 |
+
* This action causes a confirmation email message to be sent to the specified address.
|
| 144 |
+
*
|
| 145 |
+
* @param string $email Email address to be verified
|
| 146 |
+
* @return array
|
| 147 |
+
*/
|
| 148 |
+
public function verifyEmailAddress($email)
|
| 149 |
+
{
|
| 150 |
+
$params = array();
|
| 151 |
+
$params["email"] = $email;
|
| 152 |
+
|
| 153 |
+
return $this->_callServer("VerifyEmailAddress", $params);
|
| 154 |
+
}
|
| 155 |
+
|
| 156 |
+
/**
|
| 157 |
+
* Deletes a verified email address.
|
| 158 |
+
* This action takes immediate effect, so use it with care.
|
| 159 |
+
*
|
| 160 |
+
* @param string $email Email address to be deleted
|
| 161 |
+
* @return array
|
| 162 |
+
*/
|
| 163 |
+
public function deleteVerifiedEmailAddress($email)
|
| 164 |
+
{
|
| 165 |
+
$params = array();
|
| 166 |
+
$params["email"] = $email;
|
| 167 |
+
|
| 168 |
+
return $this->_callServer("DeleteVerifiedEmailAddress", $params);
|
| 169 |
+
}
|
| 170 |
+
|
| 171 |
+
/**
|
| 172 |
+
* Actually connect to the server and call the requested methods, parsing the result
|
| 173 |
+
*
|
| 174 |
+
* @param string $method
|
| 175 |
+
* @param array OPTIONAL $params
|
| 176 |
+
* @return object|false
|
| 177 |
+
*/
|
| 178 |
+
protected function _callServer($method, $params = array())
|
| 179 |
+
{
|
| 180 |
+
|
| 181 |
+
$this->errorMessage = null;
|
| 182 |
+
$this->errorCode = null;
|
| 183 |
+
|
| 184 |
+
$params['apikey'] = $this->api_key;
|
| 185 |
+
|
| 186 |
+
$url = $this->apiUrl . $method;
|
| 187 |
+
|
| 188 |
+
Mage::helper('monkey')->log($url, 'MageMonkey_ApiCall.log');
|
| 189 |
+
Mage::helper('monkey')->log($params, 'MageMonkey_ApiCall.log');
|
| 190 |
+
|
| 191 |
+
$curlSession = curl_init();
|
| 192 |
+
|
| 193 |
+
curl_setopt($curlSession, CURLOPT_USERAGENT, Mage::helper('monkey')->getUserAgent());
|
| 194 |
+
curl_setopt($curlSession, CURLOPT_URL, $url);
|
| 195 |
+
curl_setopt($curlSession, CURLOPT_HEADER, 0);
|
| 196 |
+
curl_setopt($curlSession, CURLOPT_POST, TRUE);
|
| 197 |
+
curl_setopt($curlSession, CURLOPT_POSTFIELDS, http_build_query($params));
|
| 198 |
+
curl_setopt($curlSession, CURLOPT_RETURNTRANSFER, TRUE);
|
| 199 |
+
|
| 200 |
+
if (TRUE === $this->secure){
|
| 201 |
+
//TODO
|
| 202 |
+
//curl_setopt($curlSession, CURLOPT_SSL_VERIFYPEER, TRUE);
|
| 203 |
+
//curl_setopt($curlSession, CURLOPT_SSL_VERIFYHOST, TRUE);
|
| 204 |
+
}
|
| 205 |
+
|
| 206 |
+
$result = curl_exec($curlSession);
|
| 207 |
+
if(!$result){
|
| 208 |
+
|
| 209 |
+
$errstr = curl_error($curlSession);
|
| 210 |
+
$errno = curl_errno($curlSession);
|
| 211 |
+
|
| 212 |
+
$this->errorMessage = "Could not connect (ERR $errno: $errstr)";
|
| 213 |
+
$this->errorCode = "-99";
|
| 214 |
+
return false;
|
| 215 |
+
}
|
| 216 |
+
|
| 217 |
+
// Check that a connection was made
|
| 218 |
+
if (curl_error($curlSession)) {
|
| 219 |
+
$this->errorMessage = curl_error($curlSession);
|
| 220 |
+
$this->errorCode = "-99";
|
| 221 |
+
return false;
|
| 222 |
+
}
|
| 223 |
+
|
| 224 |
+
$httpCode = curl_getinfo($curlSession, CURLINFO_HTTP_CODE);
|
| 225 |
+
|
| 226 |
+
curl_close($curlSession);
|
| 227 |
+
|
| 228 |
+
$resultObject = json_decode($result);
|
| 229 |
+
|
| 230 |
+
Mage::helper('monkey')->log($resultObject, 'MageMonkey_ApiCall.log');
|
| 231 |
+
|
| 232 |
+
if($httpCode != 200){
|
| 233 |
+
$this->errorMessage = $resultObject->message;
|
| 234 |
+
$this->errorCode = "-99";
|
| 235 |
+
return false;
|
| 236 |
+
}
|
| 237 |
+
|
| 238 |
+
return $resultObject;
|
| 239 |
+
|
| 240 |
+
}
|
| 241 |
+
|
| 242 |
+
}
|
|
@@ -0,0 +1,207 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Bulksync controller to schedule and manage jobs
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_MageMonkey
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_MageMonkey_Adminhtml_BulksyncController extends Mage_Adminhtml_Controller_Action
|
| 11 |
+
{
|
| 12 |
+
|
| 13 |
+
protected $_defredirect = 'monkey/adminhtml_ecommerce/';
|
| 14 |
+
|
| 15 |
+
/**
|
| 16 |
+
* Initialize action
|
| 17 |
+
*
|
| 18 |
+
* @return Mage_Adminhtml_Controller_Action
|
| 19 |
+
*/
|
| 20 |
+
protected function _initAction()
|
| 21 |
+
{
|
| 22 |
+
$this->_title($this->__('Newsletter'))
|
| 23 |
+
->_title($this->__('MailChimp'));
|
| 24 |
+
|
| 25 |
+
$this->loadLayout();
|
| 26 |
+
$this->_setActiveMenu('newsletter/magemonkey');
|
| 27 |
+
return $this;
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
/**
|
| 31 |
+
* Magento to MailChimp
|
| 32 |
+
*/
|
| 33 |
+
public function exportAction()
|
| 34 |
+
{
|
| 35 |
+
$this->_initAction();
|
| 36 |
+
$this->_title($this->__('Export'));
|
| 37 |
+
$this->renderLayout();
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
/**
|
| 41 |
+
* MailChimp to Magento
|
| 42 |
+
*/
|
| 43 |
+
public function importAction()
|
| 44 |
+
{
|
| 45 |
+
$this->_initAction();
|
| 46 |
+
$this->_title($this->__('Import'));
|
| 47 |
+
$this->renderLayout();
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
public function queueAction()
|
| 51 |
+
{
|
| 52 |
+
$this->_initAction();
|
| 53 |
+
$this->_title($this->__('Job Queue'));
|
| 54 |
+
$this->renderLayout();
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
/**
|
| 58 |
+
* Just the import grid for AJAX calls
|
| 59 |
+
*/
|
| 60 |
+
public function importgridAction()
|
| 61 |
+
{
|
| 62 |
+
$this->loadLayout();
|
| 63 |
+
$this->getResponse()->setBody(
|
| 64 |
+
$this->getLayout()->createBlock('monkey/adminhtml_bulksync_queueImport_grid')->toHtml()
|
| 65 |
+
);
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
/**
|
| 69 |
+
* Just the export grid for AJAX calls
|
| 70 |
+
*/
|
| 71 |
+
public function exportgridAction()
|
| 72 |
+
{
|
| 73 |
+
$this->loadLayout();
|
| 74 |
+
$this->getResponse()->setBody(
|
| 75 |
+
$this->getLayout()->createBlock('monkey/adminhtml_bulksync_queueExport_grid')->toHtml()
|
| 76 |
+
);
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
/**
|
| 80 |
+
* Initialize job based on job_id url param
|
| 81 |
+
*
|
| 82 |
+
* @return Ebizmarts_MageMonkey_Model_BulksyncExport|Ebizmarts_MageMonkey_Model_BulksyncImport
|
| 83 |
+
*/
|
| 84 |
+
protected function _initJob()
|
| 85 |
+
{
|
| 86 |
+
$id = $this->getRequest()->getParam('job_id');
|
| 87 |
+
$entity = $this->getRequest()->getParam('entity');
|
| 88 |
+
$job = Mage::getModel("monkey/bulksync{$entity}")->load($id);
|
| 89 |
+
|
| 90 |
+
if (!$job->getId()) {
|
| 91 |
+
$this->_getSession()->addError($this->__('This job no longer exists.'));
|
| 92 |
+
$this->_redirect($this->_defredirect);
|
| 93 |
+
$this->setFlag('', self::FLAG_NO_DISPATCH, true);
|
| 94 |
+
return false;
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
return $job;
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
/**
|
| 101 |
+
* Delete a job from current schedule
|
| 102 |
+
*
|
| 103 |
+
* @return void
|
| 104 |
+
*/
|
| 105 |
+
public function deleteAction()
|
| 106 |
+
{
|
| 107 |
+
if ($job = $this->_initJob()) {
|
| 108 |
+
|
| 109 |
+
try {
|
| 110 |
+
$job->delete();
|
| 111 |
+
$this->_getSession()->addSuccess(
|
| 112 |
+
$this->__('The job has been deleted.')
|
| 113 |
+
);
|
| 114 |
+
}
|
| 115 |
+
catch (Mage_Core_Exception $e) {
|
| 116 |
+
$this->_getSession()->addError($e->getMessage());
|
| 117 |
+
}
|
| 118 |
+
catch (Exception $e) {
|
| 119 |
+
$this->_getSession()->addError($this->__('The job has not been deleted.'));
|
| 120 |
+
Mage::logException($e);
|
| 121 |
+
}
|
| 122 |
+
$this->_redirectReferer($this->_defredirect);
|
| 123 |
+
|
| 124 |
+
}
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
/**
|
| 128 |
+
* Reset job status to IDLE
|
| 129 |
+
*
|
| 130 |
+
* @return void
|
| 131 |
+
*/
|
| 132 |
+
public function resetAction()
|
| 133 |
+
{
|
| 134 |
+
if ($job = $this->_initJob()) {
|
| 135 |
+
|
| 136 |
+
try {
|
| 137 |
+
|
| 138 |
+
$job->setStatus('idle')
|
| 139 |
+
->setProcessedCount(0)
|
| 140 |
+
->setLastProcessedId(0)
|
| 141 |
+
->save();
|
| 142 |
+
|
| 143 |
+
$this->_getSession()->addSuccess(
|
| 144 |
+
$this->__('The job has been updated.')
|
| 145 |
+
);
|
| 146 |
+
}
|
| 147 |
+
catch (Mage_Core_Exception $e) {
|
| 148 |
+
$this->_getSession()->addError($e->getMessage());
|
| 149 |
+
}
|
| 150 |
+
catch (Exception $e) {
|
| 151 |
+
$this->_getSession()->addError($this->__('The job has not been updated.'));
|
| 152 |
+
Mage::logException($e);
|
| 153 |
+
}
|
| 154 |
+
$this->_redirectReferer($this->_defredirect);
|
| 155 |
+
|
| 156 |
+
}
|
| 157 |
+
}
|
| 158 |
+
|
| 159 |
+
/**
|
| 160 |
+
* Schedule a job on database
|
| 161 |
+
*
|
| 162 |
+
* @return void
|
| 163 |
+
*/
|
| 164 |
+
public function saveAction()
|
| 165 |
+
{
|
| 166 |
+
$request = $this->getRequest();
|
| 167 |
+
|
| 168 |
+
if( !$request->isPost() ){
|
| 169 |
+
$this->_redirect('adminhtml/dashboard');
|
| 170 |
+
return;
|
| 171 |
+
}
|
| 172 |
+
|
| 173 |
+
$job = new Varien_Object;
|
| 174 |
+
if($request->getPost('direction') == 'import'){
|
| 175 |
+
|
| 176 |
+
$job = Mage::getModel('monkey/bulksyncImport')
|
| 177 |
+
->setStatus('idle')
|
| 178 |
+
->setLists(serialize($request->getPost('list')))
|
| 179 |
+
->setImportTypes(serialize($request->getPost('import_types')))
|
| 180 |
+
->setCreateCustomer((int)$request->getPost('create_customers'));
|
| 181 |
+
|
| 182 |
+
if($request->getPost('since')){
|
| 183 |
+
$job->setSince($request->getPost('since') . ' 00:00:00');
|
| 184 |
+
}
|
| 185 |
+
|
| 186 |
+
$job->save();
|
| 187 |
+
|
| 188 |
+
}elseif($request->getPost('direction') == 'export'){
|
| 189 |
+
|
| 190 |
+
$job = Mage::getModel('monkey/bulksyncExport')
|
| 191 |
+
->setStatus('idle')
|
| 192 |
+
->setStoreId((int)$request->getPost('store_id'))
|
| 193 |
+
->setLists(serialize($request->getPost('list')))
|
| 194 |
+
->setDataSourceEntity($request->getPost('data_source_entity'))
|
| 195 |
+
->save();
|
| 196 |
+
}
|
| 197 |
+
|
| 198 |
+
if( $job->getId() ){
|
| 199 |
+
$this->_getSession()->addSuccess($this->__('Job #%s was sucessfully scheduled.', $job->getId()));
|
| 200 |
+
}else{
|
| 201 |
+
$this->_getSession()->addError($this->__('Could not schedule job.'));
|
| 202 |
+
}
|
| 203 |
+
|
| 204 |
+
$this->_redirectReferer($this->_defredirect);
|
| 205 |
+
}
|
| 206 |
+
|
| 207 |
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Ecommerce360 controller, perform mass actions and show grid
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_MageMonkey
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_MageMonkey_Adminhtml_EcommerceController extends Mage_Adminhtml_Controller_Action
|
| 11 |
+
{
|
| 12 |
+
|
| 13 |
+
/**
|
| 14 |
+
* Display already sent orders
|
| 15 |
+
*/
|
| 16 |
+
public function indexAction()
|
| 17 |
+
{
|
| 18 |
+
$this->_title($this->__('Newsletter'))
|
| 19 |
+
->_title($this->__('MailChimp'));
|
| 20 |
+
|
| 21 |
+
$this->loadLayout();
|
| 22 |
+
$this->_setActiveMenu('newsletter/magemonkey');
|
| 23 |
+
$this->renderLayout();
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
/**
|
| 27 |
+
* Just the grid contents for AJAX requests
|
| 28 |
+
*/
|
| 29 |
+
public function gridAction()
|
| 30 |
+
{
|
| 31 |
+
$this->loadLayout();
|
| 32 |
+
$this->getResponse()->setBody(
|
| 33 |
+
$this->getLayout()->createBlock('monkey/adminhtml_ecommerce_grid')->toHtml()
|
| 34 |
+
);
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
/**
|
| 38 |
+
* Display already sent ALL orders from API
|
| 39 |
+
*/
|
| 40 |
+
public function apiordersAction()
|
| 41 |
+
{
|
| 42 |
+
$this->_title($this->__('Newsletter'))
|
| 43 |
+
->_title($this->__('MailChimp'));
|
| 44 |
+
|
| 45 |
+
$this->loadLayout();
|
| 46 |
+
$this->_setActiveMenu('newsletter/magemonkey');
|
| 47 |
+
$this->renderLayout();
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
/**
|
| 51 |
+
* Mass action send order to mailchimp
|
| 52 |
+
*/
|
| 53 |
+
public function masssendAction()
|
| 54 |
+
{
|
| 55 |
+
$orderIds = $this->getRequest()->getPost('order_ids', array());
|
| 56 |
+
$sent = 0;
|
| 57 |
+
$notSent = 0;
|
| 58 |
+
|
| 59 |
+
foreach ($orderIds as $orderId) {
|
| 60 |
+
$order = Mage::getModel('sales/order')->load($orderId);
|
| 61 |
+
|
| 62 |
+
$result = Mage::getModel('monkey/ecommerce360')->logSale($order);
|
| 63 |
+
|
| 64 |
+
if ($result === TRUE) {
|
| 65 |
+
$sent++;
|
| 66 |
+
} else {
|
| 67 |
+
$this->_getSession()->addError($this->__('Error on order #%s, - %s -', $order->getIncrementId(), $result));
|
| 68 |
+
$notSent++;
|
| 69 |
+
}
|
| 70 |
+
}
|
| 71 |
+
if ($notSent) {
|
| 72 |
+
if ($sent) {
|
| 73 |
+
$this->_getSession()->addError($this->__('%s order(s) were not sent.', $notSent));
|
| 74 |
+
} else {
|
| 75 |
+
$this->_getSession()->addError($this->__('No order(s) were sent successfully.'));
|
| 76 |
+
}
|
| 77 |
+
}
|
| 78 |
+
if ($sent) {
|
| 79 |
+
$this->_getSession()->addSuccess($this->__('%s order(s) have been sent successfully.', $sent));
|
| 80 |
+
}
|
| 81 |
+
$this->_redirect('adminhtml/sales_order/index');
|
| 82 |
+
}
|
| 83 |
+
|
| 84 |
+
/**
|
| 85 |
+
* Mass action remove order from ecommerce 360 grid
|
| 86 |
+
*/
|
| 87 |
+
public function massDeleteAction()
|
| 88 |
+
{
|
| 89 |
+
$orderIds = $this->getRequest()->getParam('orders');
|
| 90 |
+
if(!is_array($orderIds)) {
|
| 91 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('tax')->__('Please select Order(s).'));
|
| 92 |
+
} else {
|
| 93 |
+
try {
|
| 94 |
+
$ecommerce = Mage::getModel('monkey/ecommerce');
|
| 95 |
+
foreach ($orderIds as $orderId) {
|
| 96 |
+
$ecommerce->load($orderId)->delete();
|
| 97 |
+
}
|
| 98 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
| 99 |
+
Mage::helper('monkey')->__(
|
| 100 |
+
'Total of %d record(s) were deleted.', count($orderIds)
|
| 101 |
+
)
|
| 102 |
+
);
|
| 103 |
+
} catch (Exception $e) {
|
| 104 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
| 105 |
+
}
|
| 106 |
+
}
|
| 107 |
+
$this->_redirect('*/*/index');
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Transactional Email Service manager controller
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_MageMonkey
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_MageMonkey_Adminhtml_TransactionalemailController extends Mage_Adminhtml_Controller_Action
|
| 11 |
+
{
|
| 12 |
+
|
| 13 |
+
/**
|
| 14 |
+
* Initialize action
|
| 15 |
+
*
|
| 16 |
+
* @return Mage_Adminhtml_Controller_Action
|
| 17 |
+
*/
|
| 18 |
+
protected function _initAction()
|
| 19 |
+
{
|
| 20 |
+
$this->_title($this->__('Newsletter'))
|
| 21 |
+
->_title($this->__('MailChimp'));
|
| 22 |
+
|
| 23 |
+
$this->loadLayout();
|
| 24 |
+
$this->_setActiveMenu('newsletter/magemonkey');
|
| 25 |
+
return $this;
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
/**
|
| 29 |
+
* Mandrill verified emails grid
|
| 30 |
+
*/
|
| 31 |
+
public function mandrillAction()
|
| 32 |
+
{
|
| 33 |
+
$this->_initAction();
|
| 34 |
+
$this->_title($this->__('Mandrill'));
|
| 35 |
+
$this->renderLayout();
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
/**
|
| 39 |
+
* STS verified emails grid
|
| 40 |
+
*/
|
| 41 |
+
public function stsAction()
|
| 42 |
+
{
|
| 43 |
+
$this->_initAction();
|
| 44 |
+
$this->_title($this->__('Amazon Simple Email Service'));
|
| 45 |
+
$this->renderLayout();
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
/**
|
| 49 |
+
* Delete valid email address from Amazon SES
|
| 50 |
+
*/
|
| 51 |
+
public function newAction()
|
| 52 |
+
{
|
| 53 |
+
$this->_initAction();
|
| 54 |
+
$this->_title($this->__('Validate Email'));
|
| 55 |
+
$this->renderLayout();
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
public function validateEmailAction()
|
| 59 |
+
{
|
| 60 |
+
$service = $this->getRequest()->getPost('service', 'sts');
|
| 61 |
+
|
| 62 |
+
if($this->getRequest()->isPost() && $service){
|
| 63 |
+
|
| 64 |
+
$store = $this->getRequest()->getPost('store');
|
| 65 |
+
|
| 66 |
+
$apiKey = Mage::helper('monkey')->getApiKey($store);
|
| 67 |
+
if($service == 'mandrill'){
|
| 68 |
+
$apiKey = Mage::helper('monkey')->getMandrillApiKey($store);
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
$mail = Ebizmarts_MageMonkey_Model_TransactionalEmail_Adapter::factory($service)
|
| 72 |
+
->setApiKey($apiKey);
|
| 73 |
+
|
| 74 |
+
$mail->verifyEmailAddress($this->getRequest()->getPost('email_address'));
|
| 75 |
+
if($mail->errorCode){
|
| 76 |
+
$this->_getSession()->addError($this->__($mail->errorMessage));
|
| 77 |
+
}else{
|
| 78 |
+
$this->_getSession()->addSuccess($this->__('Email address verified.'));
|
| 79 |
+
}
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
$this->_redirect('monkey/adminhtml_transactionalemail/' . $service);
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
/**
|
| 86 |
+
* Delete valid email address from Mandrill
|
| 87 |
+
*/
|
| 88 |
+
public function mandrillDisableAction()
|
| 89 |
+
{
|
| 90 |
+
$email = $this->getRequest()->getParam('email');
|
| 91 |
+
$store = $this->getRequest()->getParam('store', 0);
|
| 92 |
+
|
| 93 |
+
if($email){
|
| 94 |
+
$apiKey = Mage::helper('monkey')->getMandrillApiKey($store);
|
| 95 |
+
$mail = Ebizmarts_MageMonkey_Model_TransactionalEmail_Adapter::factory('mandrill')
|
| 96 |
+
->setApiKey($apiKey);
|
| 97 |
+
|
| 98 |
+
$mail->usersDisableSender($email);
|
| 99 |
+
if($mail->errorCode){
|
| 100 |
+
$this->_getSession()->addError($this->__($mail->errorMessage));
|
| 101 |
+
}else{
|
| 102 |
+
$this->_getSession()->addSuccess($this->__('Email address was disabled.'));
|
| 103 |
+
}
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
+
$this->_redirect('monkey/adminhtml_transactionalemail/mandrill');
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
/**
|
| 110 |
+
* Delete valid email address from Amazon SES
|
| 111 |
+
*/
|
| 112 |
+
public function stsDeleteAction()
|
| 113 |
+
{
|
| 114 |
+
$email = $this->getRequest()->getParam('email');
|
| 115 |
+
$store = $this->getRequest()->getParam('store', 0);
|
| 116 |
+
|
| 117 |
+
if($email){
|
| 118 |
+
$apiKey = Mage::helper('monkey')->getApiKey($store);
|
| 119 |
+
$mail = Ebizmarts_MageMonkey_Model_TransactionalEmail_Adapter::factory('sts')
|
| 120 |
+
->setApiKey($apiKey);
|
| 121 |
+
|
| 122 |
+
$mail->deleteVerifiedEmailAddress($email);
|
| 123 |
+
if($mail->errorCode){
|
| 124 |
+
$this->_getSession()->addError($this->__($mail->errorMessage));
|
| 125 |
+
}else{
|
| 126 |
+
$this->_getSession()->addSuccess($this->__('Email address deleted.'));
|
| 127 |
+
}
|
| 128 |
+
}
|
| 129 |
+
|
| 130 |
+
$this->_redirect('monkey/adminhtml_transactionalemail/sts');
|
| 131 |
+
}
|
| 132 |
+
|
| 133 |
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* MailChimp Customer Account controller
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_MageMonkey
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_MageMonkey_Customer_AccountController extends Mage_Core_Controller_Front_Action
|
| 11 |
+
{
|
| 12 |
+
|
| 13 |
+
/**
|
| 14 |
+
* Action predispatch
|
| 15 |
+
*
|
| 16 |
+
* Check customer authentication for some actions
|
| 17 |
+
*/
|
| 18 |
+
public function preDispatch()
|
| 19 |
+
{
|
| 20 |
+
parent::preDispatch();
|
| 21 |
+
|
| 22 |
+
if (!$this->getRequest()->isDispatched()) {
|
| 23 |
+
return;
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
if (!$this->_getCustomerSession()->authenticate($this)) {
|
| 27 |
+
$this->setFlag('', 'no-dispatch', true);
|
| 28 |
+
}
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
/**
|
| 32 |
+
* Retrieve customer session model object
|
| 33 |
+
*
|
| 34 |
+
* @return Mage_Customer_Model_Session
|
| 35 |
+
*/
|
| 36 |
+
protected function _getCustomerSession()
|
| 37 |
+
{
|
| 38 |
+
return Mage::getSingleton('customer/session');
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
/**
|
| 42 |
+
* Display data
|
| 43 |
+
*/
|
| 44 |
+
public function indexAction()
|
| 45 |
+
{
|
| 46 |
+
$this->loadLayout();
|
| 47 |
+
$this->_initLayoutMessages('customer/session');
|
| 48 |
+
|
| 49 |
+
$this->getLayout()->getBlock('head')->setTitle($this->__('Newsletter Subscription'));
|
| 50 |
+
$this->renderLayout();
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class Ebizmarts_MageMonkey_SignupController extends Mage_Core_Controller_Front_Action
|
| 4 |
+
{
|
| 5 |
+
|
| 6 |
+
/**
|
| 7 |
+
* Perform saving operation, update grouping and subscribe/unsubscribe operations
|
| 8 |
+
*/
|
| 9 |
+
public function saveadditionalAction()
|
| 10 |
+
{
|
| 11 |
+
if($this->getRequest()->isPost()){
|
| 12 |
+
|
| 13 |
+
$loggedIn = Mage::helper('customer')->isLoggedIn();
|
| 14 |
+
$guestEmail = $this->getRequest()->getPost('monkey_email');
|
| 15 |
+
|
| 16 |
+
if(!$loggedIn && !Zend_Validate::is($guestEmail, 'EmailAddress')){
|
| 17 |
+
Mage::getSingleton('core/session')
|
| 18 |
+
->addError($this->__('Please specify a valid email address.'));
|
| 19 |
+
$this->_redirect($this->_getRedirectPath());
|
| 20 |
+
return;
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
Mage::helper('monkey')->handlePost($this->getRequest(), $guestEmail);
|
| 24 |
+
|
| 25 |
+
if(!$loggedIn){
|
| 26 |
+
Mage::getSingleton('core/session')
|
| 27 |
+
->addSuccess($this->__('Thanks for your subscription!'));
|
| 28 |
+
}
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
$this->_redirect($this->_getRedirectPath());
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
protected function _getRedirectPath()
|
| 35 |
+
{
|
| 36 |
+
$path = '/';
|
| 37 |
+
|
| 38 |
+
if(Mage::helper('customer')->isLoggedIn()){
|
| 39 |
+
$path = 'monkey/customer_account/index';
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
return $path;
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* MailChimp webhooks controller
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_MageMonkey
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_MageMonkey_WebhookController extends Mage_Core_Controller_Front_Action
|
| 11 |
+
{
|
| 12 |
+
|
| 13 |
+
/**
|
| 14 |
+
* Entry point for all webhook operations
|
| 15 |
+
*/
|
| 16 |
+
public function indexAction()
|
| 17 |
+
{
|
| 18 |
+
|
| 19 |
+
$requestKey = $this->getRequest()->getParam('wkey');
|
| 20 |
+
|
| 21 |
+
//Checking if "wkey" para is present on request, we cannot check for !isPost()
|
| 22 |
+
//because Mailchimp pings the URL (GET request) to validate webhook
|
| 23 |
+
if( !$requestKey ){
|
| 24 |
+
$this->getResponse()
|
| 25 |
+
->setHeader('HTTP/1.1', '403 Forbidden')
|
| 26 |
+
->sendResponse();
|
| 27 |
+
return $this;
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
Mage::helper('monkey')->log( print_r($this->getRequest()->getPost(), true) );
|
| 31 |
+
|
| 32 |
+
Mage::app()->setCurrentStore(Mage::app()->getDefaultStoreView());
|
| 33 |
+
|
| 34 |
+
$data = $this->getRequest()->getPost('data');
|
| 35 |
+
$myKey = Mage::helper('monkey')->getWebhooksKey(null, $data['list_id']);
|
| 36 |
+
|
| 37 |
+
//Validate "wkey" GET parameter
|
| 38 |
+
if ($this->getRequest()->getPost('type')) {
|
| 39 |
+
Mage::getModel('monkey/monkey')->processWebhookData($this->getRequest()->getPost());
|
| 40 |
+
} else {
|
| 41 |
+
Mage::helper('monkey')->log($this->__('WebHook Key invalid! Key Request: %s. My Key: %s', $requestKey, $myKey));
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<menu>
|
| 4 |
+
<newsletter>
|
| 5 |
+
<children>
|
| 6 |
+
<magemonkey translate="title" module="monkey">
|
| 7 |
+
<title>MailChimp</title>
|
| 8 |
+
<children>
|
| 9 |
+
<ecommerce translate="title" module="monkey">
|
| 10 |
+
<title>Ecommerce 360 Orders</title>
|
| 11 |
+
<children>
|
| 12 |
+
<commerce translate="title" module="monkey">
|
| 13 |
+
<title>Magento sent orders</title>
|
| 14 |
+
<action>adminhtml/ecommerce</action>
|
| 15 |
+
</commerce>
|
| 16 |
+
<apicommerce translate="title" module="monkey">
|
| 17 |
+
<title>ALL orders from API</title>
|
| 18 |
+
<action>adminhtml/ecommerce/apiorders</action>
|
| 19 |
+
</apicommerce>
|
| 20 |
+
</children>
|
| 21 |
+
</ecommerce>
|
| 22 |
+
<bulksync translate="title" module="monkey">
|
| 23 |
+
<title>Bulk Sync</title>
|
| 24 |
+
<children>
|
| 25 |
+
<mage_to_mc translate="title" module="monkey">
|
| 26 |
+
<title>Export</title>
|
| 27 |
+
<action>adminhtml/bulksync/export</action>
|
| 28 |
+
</mage_to_mc>
|
| 29 |
+
<mc_to_mage translate="title" module="monkey">
|
| 30 |
+
<title>Import</title>
|
| 31 |
+
<action>adminhtml/bulksync/import</action>
|
| 32 |
+
</mc_to_mage>
|
| 33 |
+
</children>
|
| 34 |
+
</bulksync>
|
| 35 |
+
</children>
|
| 36 |
+
</magemonkey>
|
| 37 |
+
</children>
|
| 38 |
+
</newsletter>
|
| 39 |
+
</menu>
|
| 40 |
+
<acl>
|
| 41 |
+
<resources>
|
| 42 |
+
<admin>
|
| 43 |
+
<children>
|
| 44 |
+
<newsletter>
|
| 45 |
+
<children>
|
| 46 |
+
<magemonkey translate="title" module="monkey">
|
| 47 |
+
<title>MailChimp</title>
|
| 48 |
+
</magemonkey>
|
| 49 |
+
</children>
|
| 50 |
+
</newsletter>
|
| 51 |
+
<system>
|
| 52 |
+
<children>
|
| 53 |
+
<config>
|
| 54 |
+
<children>
|
| 55 |
+
<monkey translate="title" module="monkey">
|
| 56 |
+
<title>MailChimp Configuration</title>
|
| 57 |
+
</monkey>
|
| 58 |
+
</children>
|
| 59 |
+
</config>
|
| 60 |
+
</children>
|
| 61 |
+
</system>
|
| 62 |
+
</children>
|
| 63 |
+
</admin>
|
| 64 |
+
</resources>
|
| 65 |
+
</acl>
|
| 66 |
+
</config>
|
|
@@ -0,0 +1,253 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<Ebizmarts_MageMonkey>
|
| 5 |
+
<version>1.1.16</version>
|
| 6 |
+
</Ebizmarts_MageMonkey>
|
| 7 |
+
</modules>
|
| 8 |
+
<global>
|
| 9 |
+
<events>
|
| 10 |
+
<newsletter_subscriber_save_before>
|
| 11 |
+
<observers>
|
| 12 |
+
<monkey_subscribe_observer>
|
| 13 |
+
<class>monkey/observer</class>
|
| 14 |
+
<method>handleSubscriber</method>
|
| 15 |
+
</monkey_subscribe_observer>
|
| 16 |
+
</observers>
|
| 17 |
+
</newsletter_subscriber_save_before>
|
| 18 |
+
<newsletter_subscriber_delete_after>
|
| 19 |
+
<observers>
|
| 20 |
+
<monkey_subscribe_delete_observer>
|
| 21 |
+
<class>monkey/observer</class>
|
| 22 |
+
<method>handleSubscriberDeletion</method>
|
| 23 |
+
</monkey_subscribe_delete_observer>
|
| 24 |
+
</observers>
|
| 25 |
+
</newsletter_subscriber_delete_after>
|
| 26 |
+
<customer_save_after>
|
| 27 |
+
<observers>
|
| 28 |
+
<monkey_update_customer>
|
| 29 |
+
<class>monkey/observer</class>
|
| 30 |
+
<method>updateCustomer</method>
|
| 31 |
+
</monkey_update_customer>
|
| 32 |
+
</observers>
|
| 33 |
+
</customer_save_after>
|
| 34 |
+
</events>
|
| 35 |
+
<models>
|
| 36 |
+
<monkey>
|
| 37 |
+
<class>Ebizmarts_MageMonkey_Model</class>
|
| 38 |
+
<resourceModel>monkey_mysql4</resourceModel>
|
| 39 |
+
</monkey>
|
| 40 |
+
<monkey_mysql4>
|
| 41 |
+
<class>Ebizmarts_MageMonkey_Model_Mysql4</class>
|
| 42 |
+
<entities>
|
| 43 |
+
<apidebug><table>magemonkey_api_debug</table></apidebug>
|
| 44 |
+
<ecommerce><table>magemonkey_ecommerce360</table></ecommerce>
|
| 45 |
+
<bulksync_export><table>magemonkey_bulksync_export</table></bulksync_export>
|
| 46 |
+
<bulksync_import><table>magemonkey_bulksync_import</table></bulksync_import>
|
| 47 |
+
</entities>
|
| 48 |
+
</monkey_mysql4>
|
| 49 |
+
</models>
|
| 50 |
+
<resources>
|
| 51 |
+
<monkey_setup>
|
| 52 |
+
<setup>
|
| 53 |
+
<module>Ebizmarts_MageMonkey</module>
|
| 54 |
+
</setup>
|
| 55 |
+
<connection>
|
| 56 |
+
<use>core_setup</use>
|
| 57 |
+
</connection>
|
| 58 |
+
</monkey_setup>
|
| 59 |
+
<monkey_write>
|
| 60 |
+
<connection>
|
| 61 |
+
<use>core_write</use>
|
| 62 |
+
</connection>
|
| 63 |
+
</monkey_write>
|
| 64 |
+
<monkey_read>
|
| 65 |
+
<connection>
|
| 66 |
+
<use>core_read</use>
|
| 67 |
+
</connection>
|
| 68 |
+
</monkey_read>
|
| 69 |
+
</resources>
|
| 70 |
+
<blocks>
|
| 71 |
+
<monkey>
|
| 72 |
+
<class>Ebizmarts_MageMonkey_Block</class>
|
| 73 |
+
</monkey>
|
| 74 |
+
</blocks>
|
| 75 |
+
<helpers>
|
| 76 |
+
<monkey>
|
| 77 |
+
<class>Ebizmarts_MageMonkey_Helper</class>
|
| 78 |
+
</monkey>
|
| 79 |
+
</helpers>
|
| 80 |
+
</global>
|
| 81 |
+
<frontend>
|
| 82 |
+
<translate>
|
| 83 |
+
<modules>
|
| 84 |
+
<Ebizmarts_MageMonkey>
|
| 85 |
+
<files>
|
| 86 |
+
<default>Ebizmarts_MageMonkey.csv</default>
|
| 87 |
+
</files>
|
| 88 |
+
</Ebizmarts_MageMonkey>
|
| 89 |
+
</modules>
|
| 90 |
+
</translate>
|
| 91 |
+
<routers>
|
| 92 |
+
<monkey>
|
| 93 |
+
<use>standard</use>
|
| 94 |
+
<args>
|
| 95 |
+
<module>Ebizmarts_MageMonkey</module>
|
| 96 |
+
<frontName>monkey</frontName>
|
| 97 |
+
</args>
|
| 98 |
+
</monkey>
|
| 99 |
+
</routers>
|
| 100 |
+
<layout>
|
| 101 |
+
<updates>
|
| 102 |
+
<magemonkey>
|
| 103 |
+
<file>magemonkey.xml</file>
|
| 104 |
+
</magemonkey>
|
| 105 |
+
</updates>
|
| 106 |
+
</layout>
|
| 107 |
+
<events>
|
| 108 |
+
<controller_action_predispatch_onestepcheckout_index_index>
|
| 109 |
+
<observers>
|
| 110 |
+
<monkey_subscribe_checkout>
|
| 111 |
+
<class>monkey/observer</class>
|
| 112 |
+
<method>registerCheckoutSubscribe</method>
|
| 113 |
+
</monkey_subscribe_checkout>
|
| 114 |
+
</observers>
|
| 115 |
+
</controller_action_predispatch_onestepcheckout_index_index>
|
| 116 |
+
<controller_action_postdispatch_checkout_onepage_saveOrder>
|
| 117 |
+
<observers>
|
| 118 |
+
<monkey_subscribe_checkout>
|
| 119 |
+
<class>monkey/observer</class>
|
| 120 |
+
<method>registerCheckoutSubscribe</method>
|
| 121 |
+
</monkey_subscribe_checkout>
|
| 122 |
+
</observers>
|
| 123 |
+
</controller_action_postdispatch_checkout_onepage_saveOrder>
|
| 124 |
+
<checkout_onepage_controller_success_action>
|
| 125 |
+
<observers>
|
| 126 |
+
<monkey_subscribe_checkoutsuccess>
|
| 127 |
+
<class>monkey/observer</class>
|
| 128 |
+
<method>registerCheckoutSuccess</method>
|
| 129 |
+
</monkey_subscribe_checkoutsuccess>
|
| 130 |
+
</observers>
|
| 131 |
+
</checkout_onepage_controller_success_action>
|
| 132 |
+
<controller_action_postdispatch>
|
| 133 |
+
<observers>
|
| 134 |
+
<monkey_ecomm_tracking_cookie>
|
| 135 |
+
<class>monkey/ecommerce360</class>
|
| 136 |
+
<method>saveCookie</method>
|
| 137 |
+
</monkey_ecomm_tracking_cookie>
|
| 138 |
+
</observers>
|
| 139 |
+
</controller_action_postdispatch>
|
| 140 |
+
<sales_order_place_after>
|
| 141 |
+
<observers>
|
| 142 |
+
<monkey_ecomm_tracking_sendorder>
|
| 143 |
+
<class>monkey/ecommerce360</class>
|
| 144 |
+
<method>run</method>
|
| 145 |
+
</monkey_ecomm_tracking_sendorder>
|
| 146 |
+
</observers>
|
| 147 |
+
</sales_order_place_after>
|
| 148 |
+
</events>
|
| 149 |
+
</frontend>
|
| 150 |
+
<admin>
|
| 151 |
+
<routers>
|
| 152 |
+
<adminhtml>
|
| 153 |
+
<args>
|
| 154 |
+
<modules>
|
| 155 |
+
<monkey before="Mage_Adminhtml">Ebizmarts_MageMonkey_Adminhtml</monkey>
|
| 156 |
+
</modules>
|
| 157 |
+
</args>
|
| 158 |
+
</adminhtml>
|
| 159 |
+
</routers>
|
| 160 |
+
</admin>
|
| 161 |
+
<adminhtml>
|
| 162 |
+
<layout>
|
| 163 |
+
<updates>
|
| 164 |
+
<magemonkey>
|
| 165 |
+
<file>magemonkey.xml</file>
|
| 166 |
+
</magemonkey>
|
| 167 |
+
</updates>
|
| 168 |
+
</layout>
|
| 169 |
+
<translate>
|
| 170 |
+
<modules>
|
| 171 |
+
<Ebizmarts_MageMonkey>
|
| 172 |
+
<files>
|
| 173 |
+
<default>Ebizmarts_MageMonkey.csv</default>
|
| 174 |
+
</files>
|
| 175 |
+
</Ebizmarts_MageMonkey>
|
| 176 |
+
</modules>
|
| 177 |
+
</translate>
|
| 178 |
+
<events>
|
| 179 |
+
<controller_action_predispatch_adminhtml_dashboard_index>
|
| 180 |
+
<observers>
|
| 181 |
+
<monkey_up>
|
| 182 |
+
<type>model</type>
|
| 183 |
+
<class>monkey/feed_updates</class>
|
| 184 |
+
<method>check</method>
|
| 185 |
+
</monkey_up>
|
| 186 |
+
</observers>
|
| 187 |
+
</controller_action_predispatch_adminhtml_dashboard_index>
|
| 188 |
+
<core_block_abstract_prepare_layout_before>
|
| 189 |
+
<observers>
|
| 190 |
+
<monkey_order_addmassbutton>
|
| 191 |
+
<class>monkey/observer</class>
|
| 192 |
+
<method>massActionOption</method>
|
| 193 |
+
</monkey_order_addmassbutton>
|
| 194 |
+
</observers>
|
| 195 |
+
</core_block_abstract_prepare_layout_before>
|
| 196 |
+
<admin_system_config_changed_section_monkey>
|
| 197 |
+
<observers>
|
| 198 |
+
<monkey_save_config>
|
| 199 |
+
<class>monkey/observer</class>
|
| 200 |
+
<method>saveConfig</method>
|
| 201 |
+
</monkey_save_config>
|
| 202 |
+
</observers>
|
| 203 |
+
</admin_system_config_changed_section_monkey>
|
| 204 |
+
<controller_action_predispatch_adminhtml_system_config_edit>
|
| 205 |
+
<observers>
|
| 206 |
+
<monkey_load_config>
|
| 207 |
+
<class>monkey/observer</class>
|
| 208 |
+
<method>loadConfig</method>
|
| 209 |
+
</monkey_load_config>
|
| 210 |
+
</observers>
|
| 211 |
+
</controller_action_predispatch_adminhtml_system_config_edit>
|
| 212 |
+
</events>
|
| 213 |
+
</adminhtml>
|
| 214 |
+
<default>
|
| 215 |
+
<monkey>
|
| 216 |
+
<custom_groupings>
|
| 217 |
+
<segment_grouping_name><![CDATA[MAGE_CUSTOMER_SEGMENTS]]></segment_grouping_name>
|
| 218 |
+
</custom_groupings>
|
| 219 |
+
<general>
|
| 220 |
+
<active>0</active>
|
| 221 |
+
<double_optin>System->Configuration->Customers->Newsletter->Subscription Options->Need to Confirm</double_optin>
|
| 222 |
+
<ecommerce360>0</ecommerce360>
|
| 223 |
+
<showreallistname>0</showreallistname>
|
| 224 |
+
<checkout_subscribe>0</checkout_subscribe>
|
| 225 |
+
<transactional_emails>false</transactional_emails>
|
| 226 |
+
<map_fields><![CDATA[a:14:{i:0;a:2:{s:7:"magento";s:9:"firstname";s:9:"mailchimp";s:5:"FNAME";}i:1;a:2:{s:7:"magento";s:8:"lastname";s:9:"mailchimp";s:5:"LNAME";}i:2;a:2:{s:7:"magento";s:3:"dob";s:9:"mailchimp";s:3:"DOB";}i:3;a:2:{s:7:"magento";s:6:"prefix";s:9:"mailchimp";s:7:"PRENAME";}i:4;a:2:{s:7:"magento";s:15:"billing_address";s:9:"mailchimp";s:7:"BILLING";}i:5;a:2:{s:7:"magento";s:16:"shipping_address";s:9:"mailchimp";s:8:"SHIPPING";}i:6;a:2:{s:7:"magento";s:6:"gender";s:9:"mailchimp";s:6:"GENDER";}i:7;a:2:{s:7:"magento";s:8:"store_id";s:9:"mailchimp";s:7:"STOREID";}i:8;a:2:{s:7:"magento";s:10:"website_id";s:9:"mailchimp";s:7:"WEBSITE";}i:9;a:2:{s:7:"magento";s:16:"date_of_purchase";s:9:"mailchimp";s:3:"DOP";}i:10;a:2:{s:7:"magento";s:19:"ee_customer_balance";s:9:"mailchimp";s:9:"STORECRED";}i:11;a:2:{s:7:"magento";s:8:"group_id";s:9:"mailchimp";s:6:"CGROUP";}i:12;a:2:{s:7:"magento";s:9:"telephone";s:9:"mailchimp";s:9:"TELEPHONE";}i:13;a:2:{s:7:"magento";s:7:"company";s:9:"mailchimp";s:7:"COMPANY";}}]]></map_fields>
|
| 227 |
+
<cron_export>1000</cron_export>
|
| 228 |
+
<order_status>all_status</order_status>
|
| 229 |
+
<enable_log>1</enable_log>
|
| 230 |
+
</general>
|
| 231 |
+
<notifications>
|
| 232 |
+
<updates_url><![CDATA[http://store.ebizmarts.com/media/feeds/]]></updates_url>
|
| 233 |
+
<check_frequency>86400</check_frequency>
|
| 234 |
+
</notifications>
|
| 235 |
+
</monkey>
|
| 236 |
+
</default>
|
| 237 |
+
<crontab>
|
| 238 |
+
<jobs>
|
| 239 |
+
<magemonkey_bulksync_export_subscribers>
|
| 240 |
+
<schedule><cron_expr>0 * * * *</cron_expr></schedule>
|
| 241 |
+
<run><model>monkey/cron::processExportJobs</model></run>
|
| 242 |
+
</magemonkey_bulksync_export_subscribers>
|
| 243 |
+
<magemonkey_bulksync_import_subscribers>
|
| 244 |
+
<schedule><cron_expr>0 * * * *</cron_expr></schedule>
|
| 245 |
+
<run><model>monkey/cron::processImportJobs</model></run>
|
| 246 |
+
</magemonkey_bulksync_import_subscribers>
|
| 247 |
+
<magemonkey_autoexport_subscribers>
|
| 248 |
+
<schedule><cron_expr>0 * * * *</cron_expr></schedule>
|
| 249 |
+
<run><model>monkey/cron::processAutoExportJobs</model></run>
|
| 250 |
+
</magemonkey_autoexport_subscribers>
|
| 251 |
+
</jobs>
|
| 252 |
+
</crontab>
|
| 253 |
+
</config>
|
|
@@ -0,0 +1,222 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<tabs>
|
| 4 |
+
<monkey translate="label" module="monkey">
|
| 5 |
+
<label><![CDATA[MageMonkey]]></label>
|
| 6 |
+
<sort_order>400</sort_order>
|
| 7 |
+
</monkey>
|
| 8 |
+
</tabs>
|
| 9 |
+
<sections>
|
| 10 |
+
<monkey translate="label" module="monkey">
|
| 11 |
+
<class>monkey-section</class>
|
| 12 |
+
<label>Mailchimp Configuration</label>
|
| 13 |
+
<header_css>mailchimp-header</header_css>
|
| 14 |
+
<tab>monkey</tab>
|
| 15 |
+
<sort_order>100</sort_order>
|
| 16 |
+
<show_in_default>1</show_in_default>
|
| 17 |
+
<show_in_website>1</show_in_website>
|
| 18 |
+
<show_in_store>1</show_in_store>
|
| 19 |
+
<groups>
|
| 20 |
+
<hint>
|
| 21 |
+
<frontend_model>monkey/adminhtml_system_config_fieldset_hint</frontend_model>
|
| 22 |
+
<sort_order>0</sort_order>
|
| 23 |
+
<show_in_default>1</show_in_default>
|
| 24 |
+
<show_in_website>1</show_in_website>
|
| 25 |
+
<show_in_store>1</show_in_store>
|
| 26 |
+
</hint>
|
| 27 |
+
<general translate="label comment">
|
| 28 |
+
<comment><![CDATA[<a href="http://mailchimp.com/signup/?pid=ebizmart&source=website" target="_blank">Get a free MailChimp account now</a>]]>
|
| 29 |
+
</comment>
|
| 30 |
+
<label>MageMonkey - MailChimp integration by ebizmarts</label>
|
| 31 |
+
<frontend_type>text</frontend_type>
|
| 32 |
+
<show_in_default>1</show_in_default>
|
| 33 |
+
<show_in_website>1</show_in_website>
|
| 34 |
+
<show_in_store>1</show_in_store>
|
| 35 |
+
<sort_order>1</sort_order>
|
| 36 |
+
<fields>
|
| 37 |
+
<active translate="label">
|
| 38 |
+
<label>Enabled</label>
|
| 39 |
+
<frontend_type>select</frontend_type>
|
| 40 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 41 |
+
<sort_order>10</sort_order>
|
| 42 |
+
<show_in_default>1</show_in_default>
|
| 43 |
+
<show_in_website>1</show_in_website>
|
| 44 |
+
<show_in_store>1</show_in_store>
|
| 45 |
+
</active>
|
| 46 |
+
<apikey translate="label comment">
|
| 47 |
+
<label>API Key</label>
|
| 48 |
+
<frontend_type>text</frontend_type>
|
| 49 |
+
<sort_order>20</sort_order>
|
| 50 |
+
<show_in_default>1</show_in_default>
|
| 51 |
+
<show_in_website>0</show_in_website>
|
| 52 |
+
<show_in_store>1</show_in_store>
|
| 53 |
+
<comment><![CDATA[Please click the button below to get your API key.]]></comment>
|
| 54 |
+
</apikey>
|
| 55 |
+
<oauth_wizard translate="button_label">
|
| 56 |
+
<label></label>
|
| 57 |
+
<button_label>Get API credentials</button_label>
|
| 58 |
+
<frontend_model>monkey/adminhtml_system_config_oauthWizard</frontend_model>
|
| 59 |
+
<sort_order>22</sort_order>
|
| 60 |
+
<show_in_default>1</show_in_default>
|
| 61 |
+
<show_in_website>0</show_in_website>
|
| 62 |
+
<show_in_store>1</show_in_store>
|
| 63 |
+
</oauth_wizard>
|
| 64 |
+
<account_details translate="label comment">
|
| 65 |
+
<label>Account details</label>
|
| 66 |
+
<frontend_model>monkey/adminhtml_system_config_account</frontend_model>
|
| 67 |
+
<source_model>monkey/system_config_source_account</source_model>
|
| 68 |
+
<sort_order>25</sort_order>
|
| 69 |
+
<show_in_default>1</show_in_default>
|
| 70 |
+
<show_in_website>0</show_in_website>
|
| 71 |
+
<show_in_store>1</show_in_store>
|
| 72 |
+
</account_details>
|
| 73 |
+
<list translate="label comment">
|
| 74 |
+
<label>General Subscription</label>
|
| 75 |
+
<frontend_type>select</frontend_type>
|
| 76 |
+
<source_model>monkey/system_config_source_list</source_model>
|
| 77 |
+
<sort_order>30</sort_order>
|
| 78 |
+
<show_in_default>1</show_in_default>
|
| 79 |
+
<show_in_website>0</show_in_website>
|
| 80 |
+
<show_in_store>1</show_in_store>
|
| 81 |
+
<can_be_empty>1</can_be_empty>
|
| 82 |
+
<comment>Synchronize Magento's General Subscription List with this MailChimp list</comment>
|
| 83 |
+
</list>
|
| 84 |
+
<showreallistname translate="label comment">
|
| 85 |
+
<label>Show Original List Name</label>
|
| 86 |
+
<frontend_type>select</frontend_type>
|
| 87 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 88 |
+
<sort_order>35</sort_order>
|
| 89 |
+
<show_in_default>1</show_in_default>
|
| 90 |
+
<show_in_website>0</show_in_website>
|
| 91 |
+
<show_in_store>1</show_in_store>
|
| 92 |
+
<can_be_empty>1</can_be_empty>
|
| 93 |
+
<comment><![CDATA[Show original name as it's configured in MailChimp or display <i>General Subscription</i> name for this list.]]></comment>
|
| 94 |
+
</showreallistname>
|
| 95 |
+
<additional_lists translate="label comment">
|
| 96 |
+
<label>Additional Lists</label>
|
| 97 |
+
<frontend_type>multiselect</frontend_type>
|
| 98 |
+
<source_model>monkey/system_config_source_list</source_model>
|
| 99 |
+
<sort_order>40</sort_order>
|
| 100 |
+
<show_in_default>1</show_in_default>
|
| 101 |
+
<show_in_website>0</show_in_website>
|
| 102 |
+
<show_in_store>1</show_in_store>
|
| 103 |
+
<can_be_empty>1</can_be_empty>
|
| 104 |
+
<comment>All selected lists will be available to customers as additionals lists</comment>
|
| 105 |
+
</additional_lists>
|
| 106 |
+
<double_optin translate="label comment">
|
| 107 |
+
<label>Double opt-in</label>
|
| 108 |
+
<frontend_type>label</frontend_type>
|
| 109 |
+
<sort_order>50</sort_order>
|
| 110 |
+
<show_in_default>1</show_in_default>
|
| 111 |
+
<show_in_website>0</show_in_website>
|
| 112 |
+
<show_in_store>1</show_in_store>
|
| 113 |
+
<comment><![CDATA[<b>IMPORTANT</b>: Should be set to <b>Yes</b>. Abusing this may cause your account to be suspended.<br/><a target='_blank' href='http://kb.mailchimp.com/article/how-does-confirmed-optin-or-double-optin-work/'>How does double opt-in work?</a>]]></comment>
|
| 114 |
+
</double_optin>
|
| 115 |
+
<ecommerce360 translate="label comment">
|
| 116 |
+
<label>Enable Ecommerce360 for</label>
|
| 117 |
+
<frontend_type>select</frontend_type>
|
| 118 |
+
<source_model>monkey/system_config_source_ecommerce360</source_model>
|
| 119 |
+
<sort_order>60</sort_order>
|
| 120 |
+
<show_in_default>1</show_in_default>
|
| 121 |
+
<show_in_website>1</show_in_website>
|
| 122 |
+
<show_in_store>1</show_in_store>
|
| 123 |
+
<can_be_empty>1</can_be_empty>
|
| 124 |
+
<comment><![CDATA[Send new orders to MailChimp using Ecommerce360.<br/><a target='_blank' href='http://kb.mailchimp.com/article/how-do-i-turn-on-ecommerce360-tracking-on-my-campaigns/'>How do I turn on Ecommerce360 tracking on my campaigns?</a><br/><a target='_blank' href='http://kb.mailchimp.com/article/how-to-segment-your-list-based-on-your-customers-purchase-activity'>How to segment your list based on your customers purchase activity</a>]]></comment>
|
| 125 |
+
</ecommerce360>
|
| 126 |
+
<order_status translate="label comment">
|
| 127 |
+
<label>Order Status</label>
|
| 128 |
+
<frontend_type>multiselect</frontend_type>
|
| 129 |
+
<source_model>adminhtml/system_config_source_order_status</source_model>
|
| 130 |
+
<sort_order>65</sort_order>
|
| 131 |
+
<show_in_default>1</show_in_default>
|
| 132 |
+
<show_in_website>0</show_in_website>
|
| 133 |
+
<show_in_store>1</show_in_store>
|
| 134 |
+
<comment><![CDATA[<b>IMPORTANT</b>: By default this function run every one hour. If you want to edit this value visit our <a target='_blank' href='http://wiki.ebizmarts.com/installation/configuration/faq#TOC-How-I-set-up-the-Magento-cron-'>wiki</a>]]></comment>
|
| 135 |
+
<depends>
|
| 136 |
+
<ecommerce360>3</ecommerce360>
|
| 137 |
+
</depends>
|
| 138 |
+
</order_status>
|
| 139 |
+
<map_fields translate="label comment">
|
| 140 |
+
<label>Customer Fields Mapping</label>
|
| 141 |
+
<frontend_model>monkey/adminhtml_system_config_form_field_mapfields</frontend_model>
|
| 142 |
+
<backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
|
| 143 |
+
<sort_order>70</sort_order>
|
| 144 |
+
<show_in_default>1</show_in_default>
|
| 145 |
+
<show_in_website>0</show_in_website>
|
| 146 |
+
<show_in_store>1</show_in_store>
|
| 147 |
+
<comment><![CDATA[<a target="_blank" href="http://kb.mailchimp.com/article/all-the-merge-tags-cheatsheet">All The Merge Tags (Cheatsheet)</a>]]></comment>
|
| 148 |
+
</map_fields>
|
| 149 |
+
<guest_name translate="label comment">
|
| 150 |
+
<label>First Name for Guests subscribers</label>
|
| 151 |
+
<frontend_type>text</frontend_type>
|
| 152 |
+
<sort_order>80</sort_order>
|
| 153 |
+
<show_in_default>1</show_in_default>
|
| 154 |
+
<show_in_website>0</show_in_website>
|
| 155 |
+
<show_in_store>1</show_in_store>
|
| 156 |
+
<comment>This value will be sent as FNAME to MailChimp</comment>
|
| 157 |
+
</guest_name>
|
| 158 |
+
<guest_lastname translate="label comment">
|
| 159 |
+
<label>Last Name for Guests subscribers</label>
|
| 160 |
+
<frontend_type>text</frontend_type>
|
| 161 |
+
<sort_order>90</sort_order>
|
| 162 |
+
<show_in_default>1</show_in_default>
|
| 163 |
+
<show_in_website>0</show_in_website>
|
| 164 |
+
<show_in_store>1</show_in_store>
|
| 165 |
+
<comment>This value will be sent as LNAME to MailChimp</comment>
|
| 166 |
+
</guest_lastname>
|
| 167 |
+
<checkout_subscribe translate="label comment">
|
| 168 |
+
<label>Subscribe On Checkout</label>
|
| 169 |
+
<frontend_type>select</frontend_type>
|
| 170 |
+
<source_model>monkey/system_config_source_checkoutsubscribe</source_model>
|
| 171 |
+
<sort_order>100</sort_order>
|
| 172 |
+
<show_in_default>1</show_in_default>
|
| 173 |
+
<show_in_website>0</show_in_website>
|
| 174 |
+
<show_in_store>1</show_in_store>
|
| 175 |
+
<comment>Show Newsletter Subscribe checkbox in the last Checkout Step (Order Review)</comment>
|
| 176 |
+
</checkout_subscribe>
|
| 177 |
+
<cron_import translate="label comment">
|
| 178 |
+
<label>Limit of Customers to Import</label>
|
| 179 |
+
<frontend_type>select</frontend_type>
|
| 180 |
+
<source_model>monkey/system_config_source_cronProcessLimit</source_model>
|
| 181 |
+
<sort_order>121</sort_order>
|
| 182 |
+
<show_in_default>1</show_in_default>
|
| 183 |
+
<show_in_website>0</show_in_website>
|
| 184 |
+
<show_in_store>1</show_in_store>
|
| 185 |
+
<comment></comment>
|
| 186 |
+
</cron_import>
|
| 187 |
+
<cron_export translate="label comment">
|
| 188 |
+
<label>Limit of Customers to Export</label>
|
| 189 |
+
<frontend_type>select</frontend_type>
|
| 190 |
+
<source_model>monkey/system_config_source_cronProcessLimit</source_model>
|
| 191 |
+
<sort_order>122</sort_order>
|
| 192 |
+
<show_in_default>1</show_in_default>
|
| 193 |
+
<show_in_website>0</show_in_website>
|
| 194 |
+
<show_in_store>1</show_in_store>
|
| 195 |
+
<comment></comment>
|
| 196 |
+
</cron_export>
|
| 197 |
+
<webhook_delete translate="label comment">
|
| 198 |
+
<label>Webhooks Delete action</label>
|
| 199 |
+
<frontend_type>select</frontend_type>
|
| 200 |
+
<source_model>monkey/system_config_source_webhookDelete</source_model>
|
| 201 |
+
<sort_order>123</sort_order>
|
| 202 |
+
<show_in_default>1</show_in_default>
|
| 203 |
+
<show_in_website>0</show_in_website>
|
| 204 |
+
<show_in_store>1</show_in_store>
|
| 205 |
+
<comment></comment>
|
| 206 |
+
</webhook_delete>
|
| 207 |
+
<enable_log translate="label comment">
|
| 208 |
+
<label>Enable Log</label>
|
| 209 |
+
<frontend_type>select</frontend_type>
|
| 210 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 211 |
+
<sort_order>124</sort_order>
|
| 212 |
+
<show_in_default>1</show_in_default>
|
| 213 |
+
<show_in_website>0</show_in_website>
|
| 214 |
+
<show_in_store>1</show_in_store>
|
| 215 |
+
<comment>File is {{base_dir}}/var/log/MageMonkey_ApiCall.log</comment>
|
| 216 |
+
</enable_log>
|
| 217 |
+
</fields>
|
| 218 |
+
</general>
|
| 219 |
+
</groups>
|
| 220 |
+
</monkey>
|
| 221 |
+
</sections>
|
| 222 |
+
</config>
|
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
$installer = $this;
|
| 4 |
+
|
| 5 |
+
$installer->startSetup();
|
| 6 |
+
|
| 7 |
+
$installer->run("
|
| 8 |
+
|
| 9 |
+
CREATE TABLE IF NOT EXISTS `{$this->getTable('magemonkey_api_debug')}` (
|
| 10 |
+
`debug_id` int(10) unsigned NOT NULL auto_increment,
|
| 11 |
+
`debug_at` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
|
| 12 |
+
`request_body` text,
|
| 13 |
+
`response_body` text,
|
| 14 |
+
PRIMARY KEY (`debug_id`),
|
| 15 |
+
KEY `debug_at` (`debug_at`)
|
| 16 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
| 17 |
+
|
| 18 |
+
");
|
| 19 |
+
|
| 20 |
+
$installer->endSetup();
|
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
$installer = $this;
|
| 4 |
+
|
| 5 |
+
$installer->startSetup();
|
| 6 |
+
|
| 7 |
+
$installer->run("
|
| 8 |
+
|
| 9 |
+
CREATE TABLE IF NOT EXISTS `{$this->getTable('magemonkey_ecommerce360')}` (
|
| 10 |
+
`id` int(10) unsigned NOT NULL auto_increment,
|
| 11 |
+
`order_id` int(10) unsigned NOT NULL,
|
| 12 |
+
`order_increment_id` varchar(50) NOT NULL default '',
|
| 13 |
+
`mc_campaign_id` varchar(255) NOT NULL default '',
|
| 14 |
+
`mc_email_id` varchar(255) NOT NULL default '',
|
| 15 |
+
`created_at` DATETIME NOT NULL ,
|
| 16 |
+
PRIMARY KEY (`id`),
|
| 17 |
+
KEY `order_increment_id` (`order_increment_id`)
|
| 18 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
| 19 |
+
|
| 20 |
+
");
|
| 21 |
+
|
| 22 |
+
$installer->endSetup();
|
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
$installer = $this;
|
| 4 |
+
|
| 5 |
+
$installer->startSetup();
|
| 6 |
+
|
| 7 |
+
$installer->run("
|
| 8 |
+
|
| 9 |
+
CREATE TABLE IF NOT EXISTS `{$this->getTable('magemonkey_bulksync_export')}` (
|
| 10 |
+
`id` INT(10) unsigned NOT NULL auto_increment,
|
| 11 |
+
`lists` TEXT NOT NULL,
|
| 12 |
+
`processed_count` INT(10) unsigned NOT NULL,
|
| 13 |
+
`last_processed_id` INT(10) unsigned NOT NULL,
|
| 14 |
+
`status` ENUM('idle', 'running', 'chunk_running', 'finished') NOT NULL,
|
| 15 |
+
`data_source_entity` ENUM('newsletter_subscriber', 'customer') NOT NULL,
|
| 16 |
+
`updated_at` DATETIME NOT NULL ,
|
| 17 |
+
`created_at` DATETIME NOT NULL ,
|
| 18 |
+
PRIMARY KEY (`id`),
|
| 19 |
+
KEY `status` (`status`)
|
| 20 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
| 21 |
+
|
| 22 |
+
");
|
| 23 |
+
|
| 24 |
+
$installer->endSetup();
|
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
$installer = $this;
|
| 4 |
+
|
| 5 |
+
$installer->startSetup();
|
| 6 |
+
|
| 7 |
+
$installer->run("
|
| 8 |
+
|
| 9 |
+
CREATE TABLE IF NOT EXISTS `{$this->getTable('magemonkey_bulksync_import')}` (
|
| 10 |
+
`id` INT(10) unsigned NOT NULL auto_increment,
|
| 11 |
+
`lists` TEXT NOT NULL,
|
| 12 |
+
`import_types` TEXT NOT NULL,
|
| 13 |
+
`status` ENUM('idle', 'running', 'chunk_running', 'finished') NOT NULL,
|
| 14 |
+
`create_customer` TINYINT(1) unsigned NOT NULL,
|
| 15 |
+
`last_processed_id` INT(10) unsigned NOT NULL,
|
| 16 |
+
`processed_count` INT(10) unsigned NOT NULL,
|
| 17 |
+
`updated_at` DATETIME NOT NULL ,
|
| 18 |
+
`created_at` DATETIME NOT NULL ,
|
| 19 |
+
PRIMARY KEY (`id`),
|
| 20 |
+
KEY `status` (`status`)
|
| 21 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
| 22 |
+
|
| 23 |
+
");
|
| 24 |
+
|
| 25 |
+
$installer->endSetup();
|
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
$installer = $this;
|
| 4 |
+
|
| 5 |
+
$installer->getConnection()->addColumn(
|
| 6 |
+
$installer->getTable('magemonkey_bulksync_import'), 'since', 'DATETIME'
|
| 7 |
+
);
|
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
$installer = $this;
|
| 4 |
+
|
| 5 |
+
$installer->getConnection()->addColumn(
|
| 6 |
+
$installer->getTable('magemonkey_bulksync_import'), 'total_count', 'INT(10) unsigned NOT NULL'
|
| 7 |
+
);
|
| 8 |
+
$installer->getConnection()->addColumn(
|
| 9 |
+
$installer->getTable('magemonkey_bulksync_export'), 'total_count', 'INT(10) unsigned NOT NULL'
|
| 10 |
+
);
|
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
$installer = $this;
|
| 4 |
+
|
| 5 |
+
$installer->getConnection()->addColumn(
|
| 6 |
+
$installer->getTable('magemonkey_bulksync_import'), 'started_at', 'DATETIME'
|
| 7 |
+
);
|
| 8 |
+
$installer->getConnection()->addColumn(
|
| 9 |
+
$installer->getTable('magemonkey_bulksync_export'), 'started_at', 'DATETIME'
|
| 10 |
+
);
|
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
$installer = $this;
|
| 4 |
+
|
| 5 |
+
$installer->getConnection()->addColumn(
|
| 6 |
+
$installer->getTable('magemonkey_bulksync_export'), 'store_id', 'SMALLINT(5) unsigned NULL'
|
| 7 |
+
);
|
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
$installer = $this;
|
| 4 |
+
|
| 5 |
+
$installer->getConnection()->addColumn(
|
| 6 |
+
$installer->getTable('sales_flat_order'), 'ebizmarts_magemonkey_campaign_id', 'varchar(10)'
|
| 7 |
+
);
|
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class Ebizmarts_Mandrill_Block_Adminhtml_System_Config_Fieldset_Hint
|
| 4 |
+
extends Mage_Adminhtml_Block_Abstract
|
| 5 |
+
implements Varien_Data_Form_Element_Renderer_Interface {
|
| 6 |
+
|
| 7 |
+
protected $_template = 'mandrill/system/config/fieldset/hint.phtml';
|
| 8 |
+
|
| 9 |
+
/**
|
| 10 |
+
* Render fieldset html
|
| 11 |
+
*
|
| 12 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
| 13 |
+
* @return string
|
| 14 |
+
*/
|
| 15 |
+
public function render(Varien_Data_Form_Element_Abstract $element) {
|
| 16 |
+
return $this->toHtml();
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
public function getMandrillVersion() {
|
| 20 |
+
return (string)Mage::getConfig()->getNode('modules/Ebizmarts_Mandrill/version');
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
public function getPxParams() {
|
| 24 |
+
|
| 25 |
+
$v = $this->getMandrillVersion();
|
| 26 |
+
$ext = "Mandrill;{$v}";
|
| 27 |
+
|
| 28 |
+
$modulesArray = (array)Mage::getConfig()->getNode('modules')->children();
|
| 29 |
+
$aux = (array_key_exists('Enterprise_Enterprise', $modulesArray))? 'EE' : 'CE' ;
|
| 30 |
+
$mageVersion = Mage::getVersion();
|
| 31 |
+
$mage = "Magento {$aux};{$mageVersion}";
|
| 32 |
+
|
| 33 |
+
$hash = md5($ext . '_' . $mage . '_' . $ext);
|
| 34 |
+
|
| 35 |
+
return "ext=$ext&mage={$mage}&ctrl={$hash}";
|
| 36 |
+
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Account details renderer for configuration settings
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_Mandrill
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_Mandrill_Block_Adminhtml_System_Config_Userinfo
|
| 11 |
+
extends Mage_Adminhtml_Block_System_Config_Form_Field {
|
| 12 |
+
|
| 13 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
|
| 14 |
+
$values = $element->getValues();
|
| 15 |
+
|
| 16 |
+
$html = '<ul class="checkboxes">';
|
| 17 |
+
|
| 18 |
+
foreach($values as $dat){
|
| 19 |
+
$html .= "<li>{$dat['label']}</li>";
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
$html .= '</ul>';
|
| 23 |
+
|
| 24 |
+
return $html;
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Transactional email Mandrill grid container
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_Mandrill
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_Mandrill_Block_Adminhtml_Users_Senders extends Mage_Adminhtml_Block_Widget_Grid_Container
|
| 11 |
+
{
|
| 12 |
+
|
| 13 |
+
public function __construct()
|
| 14 |
+
{
|
| 15 |
+
$this->_controller = 'adminhtml_users_senders';
|
| 16 |
+
$this->_blockGroup = 'mandrill';
|
| 17 |
+
$this->_headerText = Mage::helper('mandrill')->__('Verified Email Addresses (%s)', "the senders that have tried to use this account, both verified and unverified.");
|
| 18 |
+
|
| 19 |
+
parent::__construct();
|
| 20 |
+
|
| 21 |
+
$this->removeButton('add');
|
| 22 |
+
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
public function getGridHtml()
|
| 26 |
+
{
|
| 27 |
+
return $this->getChildHtml('store_switcher') . $this->getChildHtml('grid');
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
public function getCreateUrl()
|
| 31 |
+
{
|
| 32 |
+
return $this->getUrl('*/*/new', array('store' => $this->getRequest()->getParam('store', 0)));
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Transactional email Mandrill grid
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_Mandrill
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_Mandrill_Block_Adminhtml_Users_Senders_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
| 11 |
+
{
|
| 12 |
+
|
| 13 |
+
public function __construct()
|
| 14 |
+
{
|
| 15 |
+
parent::__construct();
|
| 16 |
+
$this->setId('mandrill_valid_emails');
|
| 17 |
+
$this->setUseAjax(false);
|
| 18 |
+
$this->setSaveParametersInSession(false);
|
| 19 |
+
$this->setPagerVisibility(false);
|
| 20 |
+
$this->setFilterVisibility(false);
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
protected function _prepareCollection()
|
| 24 |
+
{
|
| 25 |
+
$helper = Mage::helper('mandrill');
|
| 26 |
+
$mail = $helper->api()->setApiKey($helper->getApiKey());
|
| 27 |
+
$emails = $mail->usersSenders();
|
| 28 |
+
|
| 29 |
+
if($emails !== FALSE){
|
| 30 |
+
$_emails = array();
|
| 31 |
+
foreach($emails as $email){
|
| 32 |
+
|
| 33 |
+
$email = new Varien_Object((array)$email);
|
| 34 |
+
$_emails []= array(
|
| 35 |
+
'email' => $email->getAddress(),
|
| 36 |
+
'sent' => $email->getSent(),
|
| 37 |
+
'rejects' => $email->getRejects(),
|
| 38 |
+
'complaints' => $email->getComplaints(),
|
| 39 |
+
'unsubs' => $email->getUnsubs(),
|
| 40 |
+
'opens' => $email->getUniqueOpens(),
|
| 41 |
+
'clicks' => $email->getUniqueClicks(),
|
| 42 |
+
'hard_bounces' => $email->getHardBounces(),
|
| 43 |
+
'soft_bounces' => $email->getSoftBounces(),
|
| 44 |
+
'created_at' => $email->getCreatedAt(),
|
| 45 |
+
);
|
| 46 |
+
}
|
| 47 |
+
$collection = Mage::getModel('mandrill/customcollection', array($_emails));
|
| 48 |
+
}else{
|
| 49 |
+
$collection = Mage::getModel('mandrill/customcollection', array(array()));
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
$this->setCollection($collection);
|
| 53 |
+
return parent::_prepareCollection();
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
protected function _prepareColumns()
|
| 57 |
+
{
|
| 58 |
+
$this->addColumn('email', array(
|
| 59 |
+
'header'=> Mage::helper('mandrill')->__('Email Address'),
|
| 60 |
+
'index' => 'email',
|
| 61 |
+
'filter' => false,
|
| 62 |
+
'sortable' => false
|
| 63 |
+
));
|
| 64 |
+
$this->addColumn('sent', array(
|
| 65 |
+
'header'=> Mage::helper('mandrill')->__('# of messages sent'),
|
| 66 |
+
'index' => 'sent',
|
| 67 |
+
'filter' => false,
|
| 68 |
+
'sortable' => false
|
| 69 |
+
));
|
| 70 |
+
$this->addColumn('rejects', array(
|
| 71 |
+
'header'=> Mage::helper('mandrill')->__('# of rejected messages'),
|
| 72 |
+
'index' => 'rejects',
|
| 73 |
+
'filter' => false,
|
| 74 |
+
'sortable' => false
|
| 75 |
+
));
|
| 76 |
+
$this->addColumn('complaints', array(
|
| 77 |
+
'header'=> Mage::helper('mandrill')->__('# of spam complaints'),
|
| 78 |
+
'index' => 'complaints',
|
| 79 |
+
'filter' => false,
|
| 80 |
+
'sortable' => false
|
| 81 |
+
));
|
| 82 |
+
$this->addColumn('unsubs', array(
|
| 83 |
+
'header'=> Mage::helper('mandrill')->__('# of unsubscribe requests'),
|
| 84 |
+
'index' => 'unsubs',
|
| 85 |
+
'filter' => false,
|
| 86 |
+
'sortable' => false
|
| 87 |
+
));
|
| 88 |
+
$this->addColumn('opens', array(
|
| 89 |
+
'header'=> Mage::helper('mandrill')->__('# of unique opens'),
|
| 90 |
+
'index' => 'opens',
|
| 91 |
+
'filter' => false,
|
| 92 |
+
'sortable' => false
|
| 93 |
+
));
|
| 94 |
+
$this->addColumn('clicks', array(
|
| 95 |
+
'header'=> Mage::helper('mandrill')->__('# of times unique tracked URLs have been clicked'),
|
| 96 |
+
'index' => 'clicks',
|
| 97 |
+
'filter' => false,
|
| 98 |
+
'sortable' => false
|
| 99 |
+
));
|
| 100 |
+
$this->addColumn('hard_bounces', array(
|
| 101 |
+
'header'=> Mage::helper('mandrill')->__('# of hard bounces'),
|
| 102 |
+
'index' => 'hard_bounces',
|
| 103 |
+
'filter' => false,
|
| 104 |
+
'sortable' => false
|
| 105 |
+
));
|
| 106 |
+
$this->addColumn('soft_bounces', array(
|
| 107 |
+
'header'=> Mage::helper('mandrill')->__('# of soft bounces'),
|
| 108 |
+
'index' => 'soft_bounces',
|
| 109 |
+
'filter' => false,
|
| 110 |
+
'sortable' => false
|
| 111 |
+
));
|
| 112 |
+
$this->addColumn('created_at', array(
|
| 113 |
+
'header'=> Mage::helper('mandrill')->__('Created At'),
|
| 114 |
+
'index' => 'created_at',
|
| 115 |
+
'filter' => false,
|
| 116 |
+
'sortable' => false
|
| 117 |
+
));
|
| 118 |
+
|
| 119 |
+
return parent::_prepareColumns();
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
public function getRowUrl($row)
|
| 123 |
+
{
|
| 124 |
+
return false;
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
public function getGridUrl()
|
| 128 |
+
{
|
| 129 |
+
return $this->getUrl('*/*/grid', array('_current' => true));
|
| 130 |
+
}
|
| 131 |
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Main module helper
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_Mandrill
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_Mandrill_Helper_Data extends Mage_Core_Helper_Abstract {
|
| 11 |
+
|
| 12 |
+
private $_configPath = 'mandrill/general/';
|
| 13 |
+
|
| 14 |
+
/**
|
| 15 |
+
* Check if Mandrill is enabled
|
| 16 |
+
*
|
| 17 |
+
* @return bool
|
| 18 |
+
*/
|
| 19 |
+
public function useTransactionalService() {
|
| 20 |
+
$active = Mage::getStoreConfigFlag($this->_configPath . "active");
|
| 21 |
+
$key = $this->getApiKey();
|
| 22 |
+
|
| 23 |
+
return ($active && (strlen($key)));
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
public function api() {
|
| 27 |
+
return new Mandrill_API();
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
/**
|
| 31 |
+
* Retrieves Mandrill API KEY from Magento's configuration
|
| 32 |
+
*
|
| 33 |
+
* @return string
|
| 34 |
+
*/
|
| 35 |
+
public function getApiKey($store = null) {
|
| 36 |
+
return Mage::getStoreConfig($this->_configPath . "apikey",$store);
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
/**
|
| 40 |
+
* Get module User-Agent to use on API requests
|
| 41 |
+
*
|
| 42 |
+
* @return string
|
| 43 |
+
*/
|
| 44 |
+
public function getUserAgent() {
|
| 45 |
+
$modules = Mage::getConfig()->getNode('modules')->children();
|
| 46 |
+
$modulesArray = (array)$modules;
|
| 47 |
+
|
| 48 |
+
$aux = (array_key_exists('Enterprise_Enterprise',$modulesArray))? 'EE' : 'CE' ;
|
| 49 |
+
$v = (string)Mage::getConfig()->getNode('modules/Ebizmarts_Mandrill/version');
|
| 50 |
+
$version = strpos(Mage::getVersion(),'-')? substr(Mage::getVersion(),0,strpos(Mage::getVersion(),'-')) : Mage::getVersion();
|
| 51 |
+
return (string)'Ebizmarts_Mandrill'.$v.'/Mage'.$aux.$version;
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
/**
|
| 55 |
+
* Logging facility
|
| 56 |
+
*
|
| 57 |
+
* @param mixed $data Message to save to file
|
| 58 |
+
* @param string $filename log filename, default is <Monkey.log>
|
| 59 |
+
* @return Mage_Core_Model_Log_Adapter
|
| 60 |
+
*/
|
| 61 |
+
public function log($data, $filename = 'Ebizmarts_Mandrill.log') {
|
| 62 |
+
//return Mage::getModel('core/log_adapter', $filename)->log($data);
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
/**
|
| 5 |
+
* Custom collection class for nondb data
|
| 6 |
+
*
|
| 7 |
+
* @category Ebizmarts
|
| 8 |
+
* @package Ebizmarts_Mandrill
|
| 9 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 10 |
+
*/
|
| 11 |
+
class Ebizmarts_Mandrill_Model_Customcollection extends Varien_Data_Collection {
|
| 12 |
+
|
| 13 |
+
/**
|
| 14 |
+
* Contains generic data to load on load() method
|
| 15 |
+
*
|
| 16 |
+
* @var mixed
|
| 17 |
+
*/
|
| 18 |
+
protected $_toload = NULL;
|
| 19 |
+
|
| 20 |
+
/**
|
| 21 |
+
* Initialize data to be loaded afterwards
|
| 22 |
+
*
|
| 23 |
+
* @param array $data
|
| 24 |
+
* @return Varien_Data_Collection
|
| 25 |
+
*/
|
| 26 |
+
public function __construct(array $data) {
|
| 27 |
+
$data = current($data);
|
| 28 |
+
|
| 29 |
+
if( empty($data) ){
|
| 30 |
+
return parent::__construct();
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
$this->_toload = $data;
|
| 34 |
+
|
| 35 |
+
return parent::__construct();
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
/**
|
| 39 |
+
* Load data into object
|
| 40 |
+
*
|
| 41 |
+
* @param bool $printQuery
|
| 42 |
+
* @param bool $logQuery
|
| 43 |
+
* @return Ebizmarts_MageMonkey_Model_Custom_Collection
|
| 44 |
+
*/
|
| 45 |
+
public function load($printQuery = false, $logQuery = false) {
|
| 46 |
+
if($this->isLoaded() || is_null($this->_toload)){
|
| 47 |
+
return $this;
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
foreach ($this->_toload as $row) {
|
| 51 |
+
$item = new Varien_Object;
|
| 52 |
+
$item->addData($row);
|
| 53 |
+
$this->addItem($item);
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
$this->_setIsLoaded();
|
| 57 |
+
|
| 58 |
+
return $this;
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
}
|
|
@@ -0,0 +1,175 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Mage_Core_Model_Email_Template rewrite class
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_Mandrill
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_Mandrill_Model_Email_Template extends Mage_Core_Model_Email_Template {
|
| 11 |
+
|
| 12 |
+
protected $_mandrill = null;
|
| 13 |
+
protected $replyTo = null;
|
| 14 |
+
protected $_bcc = array();
|
| 15 |
+
|
| 16 |
+
public function getMail() {
|
| 17 |
+
|
| 18 |
+
//Check if should use Mandrill Transactional Email Service
|
| 19 |
+
if(FALSE === Mage::helper('mandrill')->useTransactionalService()){
|
| 20 |
+
return parent::getMail();
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
if(is_null($this->_mandrill)){
|
| 24 |
+
$this->_mandrill = Mage::helper('mandrill')->api();
|
| 25 |
+
$this->_mandrill->setApiKey(Mage::helper('mandrill')->getApiKey());
|
| 26 |
+
}
|
| 27 |
+
return $this->_mandrill;
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
/**
|
| 31 |
+
* Add BCC emails to list to send.
|
| 32 |
+
*
|
| 33 |
+
* @return Ebizmarts_Mandrill_Model_Email_Template
|
| 34 |
+
*/
|
| 35 |
+
public function addBcc($bcc) {
|
| 36 |
+
$helper = Mage::helper('mandrill');
|
| 37 |
+
if(FALSE === $helper->useTransactionalService()){
|
| 38 |
+
return parent::addBcc($bcc);
|
| 39 |
+
}
|
| 40 |
+
if (is_array($bcc)) {
|
| 41 |
+
foreach ($bcc as $email) {
|
| 42 |
+
$this->_bcc[] = $email;
|
| 43 |
+
}
|
| 44 |
+
}
|
| 45 |
+
elseif ($bcc) {
|
| 46 |
+
$this->_bcc[] = $bcc;
|
| 47 |
+
}
|
| 48 |
+
return $this;
|
| 49 |
+
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
/**
|
| 53 |
+
* Send mail to recipient
|
| 54 |
+
*
|
| 55 |
+
* @param array|string $email E-mail(s)
|
| 56 |
+
* @param array|string|null $name receiver name(s)
|
| 57 |
+
* @param array $variables template variables
|
| 58 |
+
* @return boolean
|
| 59 |
+
**/
|
| 60 |
+
public function send($email, $name = null, array $variables = array()) {
|
| 61 |
+
|
| 62 |
+
$helper = Mage::helper('mandrill');
|
| 63 |
+
|
| 64 |
+
//Check if should use Mandrill Transactional Email Service
|
| 65 |
+
if(FALSE === $helper->useTransactionalService()){
|
| 66 |
+
return parent::send($email, $name, $variables);
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
if (!$this->isValidForSend()) {
|
| 70 |
+
Mage::logException(new Exception('This letter cannot be sent.')); // translation is intentionally omitted
|
| 71 |
+
return false;
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
$emails = array_values((array)$email);
|
| 75 |
+
|
| 76 |
+
if(count($this->_bcc) > 0){
|
| 77 |
+
$bccEmail = $this->_bcc[0];
|
| 78 |
+
}else{
|
| 79 |
+
$bccEmail = '';
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
$names = is_array($name) ? $name : (array)$name;
|
| 83 |
+
$names = array_values($names);
|
| 84 |
+
foreach ($emails as $key => $email) {
|
| 85 |
+
if (!isset($names[$key])) {
|
| 86 |
+
$names[$key] = substr($email, 0, strpos($email, '@'));
|
| 87 |
+
}
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
$variables['email'] = reset($emails);
|
| 91 |
+
$variables['name'] = reset($names);
|
| 92 |
+
|
| 93 |
+
$mail = $this->getMail();
|
| 94 |
+
|
| 95 |
+
$this->setUseAbsoluteLinks(true);
|
| 96 |
+
$text = $this->getProcessedTemplate($variables, true);
|
| 97 |
+
|
| 98 |
+
try {
|
| 99 |
+
|
| 100 |
+
$message = array (
|
| 101 |
+
'subject' => $this->getProcessedTemplateSubject($variables),
|
| 102 |
+
'from_name' => $this->getSenderName(),
|
| 103 |
+
'from_email' => $this->getSenderEmail(),
|
| 104 |
+
'to_email' => $emails,
|
| 105 |
+
'to_name' => $names,
|
| 106 |
+
'bcc_address' => $bccEmail,
|
| 107 |
+
'headers' => array('Reply-To' => $this->replyTo)
|
| 108 |
+
);
|
| 109 |
+
|
| 110 |
+
if($this->isPlain()) {
|
| 111 |
+
$message['text'] = $text;
|
| 112 |
+
} else {
|
| 113 |
+
$message['html'] = $text;
|
| 114 |
+
}
|
| 115 |
+
if(isset($variables['tags']) && count($variables['tags'])) {
|
| 116 |
+
$message ['tags'] = $variables['tags'];
|
| 117 |
+
}
|
| 118 |
+
else {
|
| 119 |
+
$templateId = (string)$this->getId();
|
| 120 |
+
$templates = parent::getDefaultTemplates();
|
| 121 |
+
if (isset($templates[$templateId])) {
|
| 122 |
+
$message ['tags'] = array(substr($templates[$templateId]['label'], 0, 50));
|
| 123 |
+
} else {
|
| 124 |
+
if($this->getTemplateCode()){
|
| 125 |
+
$message ['tags'] = array(substr($this->getTemplateCode(), 0, 50));
|
| 126 |
+
} else {
|
| 127 |
+
$message ['tags'] = array(substr($templateId, 0, 50));
|
| 128 |
+
}
|
| 129 |
+
}
|
| 130 |
+
}
|
| 131 |
+
|
| 132 |
+
$sent = $mail->sendEmail($message);
|
| 133 |
+
if($mail->errorCode){
|
| 134 |
+
return false;
|
| 135 |
+
}
|
| 136 |
+
|
| 137 |
+
}catch (Exception $e) {
|
| 138 |
+
Mage::logException($e);
|
| 139 |
+
return false;
|
| 140 |
+
}
|
| 141 |
+
|
| 142 |
+
return true;
|
| 143 |
+
}
|
| 144 |
+
|
| 145 |
+
public function setReplyTo($email) {
|
| 146 |
+
if(FALSE === Mage::helper('mandrill')->useTransactionalService()) {
|
| 147 |
+
return parent::setReplyTo($email);
|
| 148 |
+
}
|
| 149 |
+
|
| 150 |
+
$this->replyTo = $email;
|
| 151 |
+
return $this;
|
| 152 |
+
}
|
| 153 |
+
|
| 154 |
+
public function createAttachment($body,
|
| 155 |
+
$mimeType = Zend_Mime::TYPE_OCTETSTREAM,
|
| 156 |
+
$disposition = Zend_Mime::DISPOSITION_ATTACHMENT,
|
| 157 |
+
$encoding = Zend_Mime::ENCODING_BASE64,
|
| 158 |
+
$filename = null)
|
| 159 |
+
{
|
| 160 |
+
|
| 161 |
+
}
|
| 162 |
+
public function addAttachment(Zend_Mime_Part $att)
|
| 163 |
+
{
|
| 164 |
+
|
| 165 |
+
}
|
| 166 |
+
|
| 167 |
+
public function addTo($email, $name = null)
|
| 168 |
+
{
|
| 169 |
+
if(FALSE === Mage::helper('mandrill')->useTransactionalService()) {
|
| 170 |
+
array_push($this->_bcc, $email);
|
| 171 |
+
return $this;
|
| 172 |
+
}
|
| 173 |
+
}
|
| 174 |
+
|
| 175 |
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Mandrill source for User Info
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_Mandrill
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_Mandrill_Model_System_Config_Source_Userinfo
|
| 11 |
+
{
|
| 12 |
+
|
| 13 |
+
/**
|
| 14 |
+
* Account details storage
|
| 15 |
+
*
|
| 16 |
+
* @access protected
|
| 17 |
+
* @var bool|array
|
| 18 |
+
*/
|
| 19 |
+
protected $_account_details;
|
| 20 |
+
|
| 21 |
+
/**
|
| 22 |
+
* Set AccountDetails on class attribute if not already set
|
| 23 |
+
*
|
| 24 |
+
* @return void
|
| 25 |
+
*/
|
| 26 |
+
public function __construct()
|
| 27 |
+
{
|
| 28 |
+
if (!$this->_account_details) {
|
| 29 |
+
$helper = Mage::helper('mandrill');
|
| 30 |
+
$this->_account_details = $helper->api()
|
| 31 |
+
->setApiKey($helper->getApiKey())
|
| 32 |
+
->usersInfo();
|
| 33 |
+
}
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
/**
|
| 37 |
+
* Return data if API key is entered
|
| 38 |
+
*
|
| 39 |
+
* @return array
|
| 40 |
+
*/
|
| 41 |
+
public function toOptionArray()
|
| 42 |
+
{
|
| 43 |
+
$helper = Mage::helper('mandrill');
|
| 44 |
+
if(is_object($this->_account_details)){
|
| 45 |
+
|
| 46 |
+
$this->_account_details = (array)$this->_account_details;
|
| 47 |
+
|
| 48 |
+
return array(
|
| 49 |
+
array('value' => 0, 'label' => $helper->__("<strong>Username</strong>: %s %s", $this->_account_details["username"], "<small>used for SMTP authentication</small>")),
|
| 50 |
+
|
| 51 |
+
array('value' => 1, 'label' => $helper->__('<strong>Reputation</strong>: %s %s', $this->_account_details['reputation'], "<small>scale from 0 to 100, with 75 generally being a \"good\" reputation</small>")),
|
| 52 |
+
|
| 53 |
+
array('value' => 2, 'label' => $helper->__('<strong>Hourly Quota</strong>: %s %s', $this->_account_details['hourly_quota'], "<small>the maximum number of emails Mandrill will deliver for this user each hour. Any emails beyond that will be accepted and queued for later delivery. Users with higher reputations will have higher hourly quotas</small>")),
|
| 54 |
+
|
| 55 |
+
array('value' => 3, 'label' => $helper->__('<strong>Backlog</strong>: %s %s', $this->_account_details['backlog'], "<small>the number of emails that are queued for delivery due to exceeding your monthly or hourly quotas</small>"))
|
| 56 |
+
);
|
| 57 |
+
}else{
|
| 58 |
+
return array(array('value' => '', 'label' => $helper->__('--- Enter your API KEY first ---')));
|
| 59 |
+
}
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Transactional Email Service manager controller
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_Mandrill
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Ebizmarts_Mandrill_Adminhtml_Mandrill_UsersController extends Mage_Adminhtml_Controller_Action {
|
| 11 |
+
|
| 12 |
+
/**
|
| 13 |
+
* Initialize action
|
| 14 |
+
*
|
| 15 |
+
* @return Mage_Adminhtml_Controller_Action
|
| 16 |
+
*/
|
| 17 |
+
protected function _initAction() {
|
| 18 |
+
$this->_title($this->__('Mandrill'));
|
| 19 |
+
|
| 20 |
+
$this->loadLayout();
|
| 21 |
+
$this->_setActiveMenu('newsletter/magemonkey');
|
| 22 |
+
return $this;
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
/**
|
| 26 |
+
* Mandrill verified emails grid
|
| 27 |
+
*/
|
| 28 |
+
public function sendersAction() {
|
| 29 |
+
$this->_initAction();
|
| 30 |
+
$this->_title($this->__('Verified Senders'));
|
| 31 |
+
$this->renderLayout();
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<menu>
|
| 4 |
+
<system>
|
| 5 |
+
<children>
|
| 6 |
+
<email_template>
|
| 7 |
+
<children>
|
| 8 |
+
<mandrill translate="title" module="mandrill">
|
| 9 |
+
<title>Mandrill</title>
|
| 10 |
+
<children>
|
| 11 |
+
<users_senders translate="title" module="mandrill">
|
| 12 |
+
<title>Senders</title>
|
| 13 |
+
<action>adminhtml/mandrill_users/senders</action>
|
| 14 |
+
</users_senders>
|
| 15 |
+
</children>
|
| 16 |
+
</mandrill>
|
| 17 |
+
</children>
|
| 18 |
+
</email_template>
|
| 19 |
+
</children>
|
| 20 |
+
</system>
|
| 21 |
+
</menu>
|
| 22 |
+
<acl>
|
| 23 |
+
<resources>
|
| 24 |
+
<admin>
|
| 25 |
+
<children>
|
| 26 |
+
<system>
|
| 27 |
+
<children>
|
| 28 |
+
<config>
|
| 29 |
+
<children>
|
| 30 |
+
<mandrill translate="title" module="monkey">
|
| 31 |
+
<title>Mandrill Configuration</title>
|
| 32 |
+
</mandrill>
|
| 33 |
+
</children>
|
| 34 |
+
</config>
|
| 35 |
+
</children>
|
| 36 |
+
</system>
|
| 37 |
+
</children>
|
| 38 |
+
</admin>
|
| 39 |
+
</resources>
|
| 40 |
+
</acl>
|
| 41 |
+
</config>
|
|
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<Ebizmarts_Mandrill>
|
| 5 |
+
<version>1.0.8</version>
|
| 6 |
+
</Ebizmarts_Mandrill>
|
| 7 |
+
</modules>
|
| 8 |
+
<global>
|
| 9 |
+
<models>
|
| 10 |
+
<mandrill>
|
| 11 |
+
<class>Ebizmarts_Mandrill_Model</class>
|
| 12 |
+
</mandrill>
|
| 13 |
+
<core>
|
| 14 |
+
<rewrite>
|
| 15 |
+
<email_template>Ebizmarts_Mandrill_Model_Email_Template</email_template>
|
| 16 |
+
</rewrite>
|
| 17 |
+
</core>
|
| 18 |
+
</models>
|
| 19 |
+
<blocks>
|
| 20 |
+
<mandrill>
|
| 21 |
+
<class>Ebizmarts_Mandrill_Block</class>
|
| 22 |
+
</mandrill>
|
| 23 |
+
</blocks>
|
| 24 |
+
<helpers>
|
| 25 |
+
<mandrill>
|
| 26 |
+
<class>Ebizmarts_Mandrill_Helper</class>
|
| 27 |
+
</mandrill>
|
| 28 |
+
</helpers>
|
| 29 |
+
</global>
|
| 30 |
+
<frontend>
|
| 31 |
+
<translate>
|
| 32 |
+
<modules>
|
| 33 |
+
<Ebizmarts_Mandrill>
|
| 34 |
+
<files>
|
| 35 |
+
<default>Ebizmarts_Mandrill.csv</default>
|
| 36 |
+
</files>
|
| 37 |
+
</Ebizmarts_Mandrill>
|
| 38 |
+
</modules>
|
| 39 |
+
</translate>
|
| 40 |
+
</frontend>
|
| 41 |
+
<admin>
|
| 42 |
+
<routers>
|
| 43 |
+
<adminhtml>
|
| 44 |
+
<args>
|
| 45 |
+
<modules>
|
| 46 |
+
<mandrill before="Mage_Adminhtml">Ebizmarts_Mandrill_Adminhtml</mandrill>
|
| 47 |
+
</modules>
|
| 48 |
+
</args>
|
| 49 |
+
</adminhtml>
|
| 50 |
+
</routers>
|
| 51 |
+
</admin>
|
| 52 |
+
<adminhtml>
|
| 53 |
+
<layout>
|
| 54 |
+
<updates>
|
| 55 |
+
<mandrill>
|
| 56 |
+
<file>mandrill.xml</file>
|
| 57 |
+
</mandrill>
|
| 58 |
+
</updates>
|
| 59 |
+
</layout>
|
| 60 |
+
<translate>
|
| 61 |
+
<modules>
|
| 62 |
+
<Ebizmarts_Mandrill>
|
| 63 |
+
<files>
|
| 64 |
+
<default>Ebizmarts_Mandrill.csv</default>
|
| 65 |
+
</files>
|
| 66 |
+
</Ebizmarts_Mandrill>
|
| 67 |
+
</modules>
|
| 68 |
+
</translate>
|
| 69 |
+
<events>
|
| 70 |
+
<admin_system_config_changed_section_mandrill>
|
| 71 |
+
<observers>
|
| 72 |
+
<mandrill_save_config>
|
| 73 |
+
<class>ebizmarts_autoresponder/eventObserver</class>
|
| 74 |
+
<method>saveConfig</method>
|
| 75 |
+
</mandrill_save_config>
|
| 76 |
+
</observers>
|
| 77 |
+
</admin_system_config_changed_section_mandrill>
|
| 78 |
+
</events>
|
| 79 |
+
</adminhtml>
|
| 80 |
+
<default>
|
| 81 |
+
<mandrill>
|
| 82 |
+
<general>
|
| 83 |
+
<active>0</active>
|
| 84 |
+
</general>
|
| 85 |
+
</mandrill>
|
| 86 |
+
</default>
|
| 87 |
+
</config>
|
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<sections>
|
| 4 |
+
<mandrill translate="label" module="mandrill">
|
| 5 |
+
<label><![CDATA[Mandrill]]></label>
|
| 6 |
+
<class>mandrill-section separator-top</class>
|
| 7 |
+
<header_css>mandrill-header</header_css>
|
| 8 |
+
<tab>monkey</tab>
|
| 9 |
+
<sort_order>200</sort_order>
|
| 10 |
+
<show_in_default>1</show_in_default>
|
| 11 |
+
<show_in_website>1</show_in_website>
|
| 12 |
+
<show_in_store>1</show_in_store>
|
| 13 |
+
<groups>
|
| 14 |
+
<hint>
|
| 15 |
+
<frontend_model>mandrill/adminhtml_system_config_fieldset_hint</frontend_model>
|
| 16 |
+
<sort_order>0</sort_order>
|
| 17 |
+
<show_in_default>1</show_in_default>
|
| 18 |
+
<show_in_website>1</show_in_website>
|
| 19 |
+
<show_in_store>1</show_in_store>
|
| 20 |
+
</hint>
|
| 21 |
+
<general translate="label comment">
|
| 22 |
+
<comment><![CDATA[<a href="http://mandrill.com/signup/?pid=ebizmart&source=website" target="_blank">Get a free Mandrill account now</a>]]></comment>
|
| 23 |
+
<label><![CDATA[Mandrill, SMARTER EMAIL FOR APPS integration by ebizmarts]]></label>
|
| 24 |
+
<sort_order>10</sort_order>
|
| 25 |
+
<frontend_type>text</frontend_type>
|
| 26 |
+
<show_in_default>1</show_in_default>
|
| 27 |
+
<show_in_website>1</show_in_website>
|
| 28 |
+
<show_in_store>1</show_in_store>
|
| 29 |
+
<fields>
|
| 30 |
+
<active translate="label">
|
| 31 |
+
<label>Enabled</label>
|
| 32 |
+
<frontend_type>select</frontend_type>
|
| 33 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 34 |
+
<sort_order>10</sort_order>
|
| 35 |
+
<show_in_default>1</show_in_default>
|
| 36 |
+
<show_in_website>1</show_in_website>
|
| 37 |
+
<show_in_store>1</show_in_store>
|
| 38 |
+
</active>
|
| 39 |
+
<apikey translate="label comment">
|
| 40 |
+
<label>API Key</label>
|
| 41 |
+
<frontend_type>text</frontend_type>
|
| 42 |
+
<sort_order>20</sort_order>
|
| 43 |
+
<show_in_default>1</show_in_default>
|
| 44 |
+
<show_in_website>1</show_in_website>
|
| 45 |
+
<show_in_store>1</show_in_store>
|
| 46 |
+
<comment><![CDATA[Your API Key]]></comment>
|
| 47 |
+
</apikey>
|
| 48 |
+
<user_info translate="label comment">
|
| 49 |
+
<label>Account Info</label>
|
| 50 |
+
<frontend_model>mandrill/adminhtml_system_config_userinfo</frontend_model>
|
| 51 |
+
<source_model>mandrill/system_config_source_userinfo</source_model>
|
| 52 |
+
<sort_order>30</sort_order>
|
| 53 |
+
<show_in_default>1</show_in_default>
|
| 54 |
+
<show_in_website>1</show_in_website>
|
| 55 |
+
<show_in_store>1</show_in_store>
|
| 56 |
+
<comment><![CDATA[]]></comment>
|
| 57 |
+
</user_info>
|
| 58 |
+
</fields>
|
| 59 |
+
</general>
|
| 60 |
+
</groups>
|
| 61 |
+
</mandrill>
|
| 62 |
+
</sections>
|
| 63 |
+
</config>
|
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<layout>
|
| 3 |
+
<adminhtml_abandonedorder_grid>
|
| 4 |
+
<update handle="formkey"/>
|
| 5 |
+
<block type="ebizmarts_abandonedcart/adminhtml_abandonedorder_grid" name="ebizmarts_abandonedcart_abandonedorder.grid" output="toHtml"></block>
|
| 6 |
+
</adminhtml_abandonedorder_grid>
|
| 7 |
+
<adminhtml_abandonedmails_grid>
|
| 8 |
+
<update handle="formkey"/>
|
| 9 |
+
<block type="ebizmarts_abandonedcart/adminhtml_abandonedmails_grid" name="ebizmarts_abandonedcart_abandonedmails.grid" output="toHtml"></block>
|
| 10 |
+
</adminhtml_abandonedmails_grid>
|
| 11 |
+
<adminhtml_abandonedorder_index>
|
| 12 |
+
<reference name="content">
|
| 13 |
+
<block type="ebizmarts_abandonedcart/adminhtml_abandonedorder" name="ebizmarts_abandonedcart_abandonedorder.grid.container"></block>
|
| 14 |
+
</reference>
|
| 15 |
+
</adminhtml_abandonedorder_index>
|
| 16 |
+
<adminhtml_abandonedmails_index>
|
| 17 |
+
<reference name="content">
|
| 18 |
+
<block type="ebizmarts_abandonedcart/adminhtml_abandonedmails" name="ebizmarts_abandonedcart_abandonedmails.grid.container"></block>
|
| 19 |
+
</reference>
|
| 20 |
+
</adminhtml_abandonedmails_index>
|
| 21 |
+
<adminhtml_abandonedorder_dashboard>
|
| 22 |
+
<reference name="head">
|
| 23 |
+
<action method="addCss"><stylesheet>abandonedcart/abandonedcart.css</stylesheet></action>
|
| 24 |
+
</reference>
|
| 25 |
+
<reference name="content">
|
| 26 |
+
<block type="ebizmarts_abandonedcart/adminhtml_dashboard" name="ebizmarts_abandonedcart_abandonedorder.dashboard">
|
| 27 |
+
<block type="adminhtml/store_switcher" name="store_switcher" as="store_switcher" template="store/switcher.phtml">
|
| 28 |
+
<action method="setUseConfirm"><params>0</params></action>
|
| 29 |
+
</block>
|
| 30 |
+
</block>
|
| 31 |
+
</reference>
|
| 32 |
+
</adminhtml_abandonedorder_dashboard>
|
| 33 |
+
</layout>
|
|
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<layout>
|
| 3 |
+
|
| 4 |
+
<adminhtml_ecommerce_apiorders>
|
| 5 |
+
<reference name="content">
|
| 6 |
+
<block type="monkey/adminhtml_ecommerceapi" name="ecommerceapi.list" />
|
| 7 |
+
</reference>
|
| 8 |
+
</adminhtml_ecommerce_apiorders>
|
| 9 |
+
|
| 10 |
+
<adminhtml_ecommerce_index>
|
| 11 |
+
<reference name="content">
|
| 12 |
+
<block type="monkey/adminhtml_ecommerce" name="ecommerce.log.list" />
|
| 13 |
+
</reference>
|
| 14 |
+
</adminhtml_ecommerce_index>
|
| 15 |
+
|
| 16 |
+
<adminhtml_transactionalemail_mandrill>
|
| 17 |
+
<reference name="content">
|
| 18 |
+
<block type="monkey/adminhtml_transactionalemail_mandrill" name="mc_transactionalemail_mandrill">
|
| 19 |
+
<block type="adminhtml/store_switcher" name="store_switcher" as="store_switcher">
|
| 20 |
+
<action method="setUseConfirm"><params>0</params></action>
|
| 21 |
+
</block>
|
| 22 |
+
</block>
|
| 23 |
+
</reference>
|
| 24 |
+
</adminhtml_transactionalemail_mandrill>
|
| 25 |
+
<adminhtml_transactionalemail_sts>
|
| 26 |
+
<reference name="content">
|
| 27 |
+
<block type="monkey/adminhtml_transactionalemail_sts" name="mc_transactionalemail_sts">
|
| 28 |
+
<block type="adminhtml/store_switcher" name="store_switcher" as="store_switcher">
|
| 29 |
+
<action method="setUseConfirm"><params>0</params></action>
|
| 30 |
+
</block>
|
| 31 |
+
</block>
|
| 32 |
+
</reference>
|
| 33 |
+
</adminhtml_transactionalemail_sts>
|
| 34 |
+
<adminhtml_transactionalemail_new>
|
| 35 |
+
<reference name="content">
|
| 36 |
+
<block type="monkey/adminhtml_transactionalemail_newemail" name="mc_transemail_add" />
|
| 37 |
+
</reference>
|
| 38 |
+
</adminhtml_transactionalemail_new>
|
| 39 |
+
|
| 40 |
+
<adminhtml_bulksync_export>
|
| 41 |
+
<reference name="head">
|
| 42 |
+
<action method="addCss"><stylesheet>magemonkey/magemonkey.css</stylesheet></action>
|
| 43 |
+
</reference>
|
| 44 |
+
<reference name="content">
|
| 45 |
+
<block type="monkey/adminhtml_bulksync_export" name="mc_bulksyc_export" />
|
| 46 |
+
</reference>
|
| 47 |
+
</adminhtml_bulksync_export>
|
| 48 |
+
<adminhtml_bulksync_import>
|
| 49 |
+
<reference name="head">
|
| 50 |
+
<action method="addCss"><stylesheet>magemonkey/magemonkey.css</stylesheet></action>
|
| 51 |
+
</reference>
|
| 52 |
+
<reference name="content">
|
| 53 |
+
<block type="monkey/adminhtml_bulksync_import" name="mc_bulksyc_import" />
|
| 54 |
+
</reference>
|
| 55 |
+
</adminhtml_bulksync_import>
|
| 56 |
+
<adminhtml_bulksync_queue>
|
| 57 |
+
<reference name="content">
|
| 58 |
+
<block type="monkey/adminhtml_bulksync_queue" name="mc_bulksyc_queue" />
|
| 59 |
+
</reference>
|
| 60 |
+
</adminhtml_bulksync_queue>
|
| 61 |
+
|
| 62 |
+
<adminhtml_system_config_edit>
|
| 63 |
+
<reference name="head">
|
| 64 |
+
<action method="addCss"><stylesheet>magemonkey/magemonkey.css</stylesheet></action>
|
| 65 |
+
<action method="addItem"><type>skin_js</type><name>magemonkey/magemonkey.js</name></action>
|
| 66 |
+
</reference>
|
| 67 |
+
</adminhtml_system_config_edit>
|
| 68 |
+
|
| 69 |
+
<magemonkey_adminhtml_ctemplate_edit>
|
| 70 |
+
<reference name="head">
|
| 71 |
+
<action method="addCss"><stylesheet>magemonkey/magemonkey.css</stylesheet></action>
|
| 72 |
+
<action method="addItem"><type>skin_js</type><name>magemonkey/magemonkey.js</name></action>
|
| 73 |
+
</reference>
|
| 74 |
+
</magemonkey_adminhtml_ctemplate_edit>
|
| 75 |
+
|
| 76 |
+
<magemonkey_adminhtml_ctemplate_new>
|
| 77 |
+
<reference name="head">
|
| 78 |
+
<action method="addCss"><stylesheet>magemonkey/magemonkey.css</stylesheet></action>
|
| 79 |
+
<action method="addItem"><type>skin_js</type><name>magemonkey/magemonkey.js</name></action>
|
| 80 |
+
</reference>
|
| 81 |
+
</magemonkey_adminhtml_ctemplate_new>
|
| 82 |
+
|
| 83 |
+
<adminhtml_customer_edit>
|
| 84 |
+
<reference name="customer_edit_tabs">
|
| 85 |
+
<action method="addTab">
|
| 86 |
+
<name>customer_edit_tab_monkey_memberactivity</name>
|
| 87 |
+
<block>monkey/adminhtml_customer_edit_tab_memberactivity</block>
|
| 88 |
+
</action>
|
| 89 |
+
</reference>
|
| 90 |
+
</adminhtml_customer_edit>
|
| 91 |
+
|
| 92 |
+
</layout>
|
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<layout>
|
| 3 |
+
<adminhtml_system_config_edit>
|
| 4 |
+
<reference name="head">
|
| 5 |
+
<action method="addCss"><stylesheet>mandrill/mandrill.css</stylesheet></action>
|
| 6 |
+
</reference>
|
| 7 |
+
</adminhtml_system_config_edit>
|
| 8 |
+
|
| 9 |
+
<adminhtml_mandrill_users_senders>
|
| 10 |
+
<reference name="content">
|
| 11 |
+
<block type="mandrill/adminhtml_users_senders" name="mc_transactionalemail_mandrill">
|
| 12 |
+
<block type="adminhtml/store_switcher" name="store_switcher" as="store_switcher">
|
| 13 |
+
<action method="setUseConfirm"><params>0</params></action>
|
| 14 |
+
</block>
|
| 15 |
+
</block>
|
| 16 |
+
</reference>
|
| 17 |
+
</adminhtml_mandrill_users_senders>
|
| 18 |
+
</layout>
|
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<script type="text/javascript">
|
| 2 |
+
//<![CDATA[
|
| 3 |
+
function changeDiagramsPeriod(periodObj) {
|
| 4 |
+
periodParam = periodObj.value ? 'period/' + periodObj.value + '/' : '';
|
| 5 |
+
ajaxBlockUrl = '<?php echo $this->getUrl('*/*/ajaxBlock', array('_current' => true, 'block' => 'totals', 'period' => '')) ?>' + periodParam;
|
| 6 |
+
new Ajax.Request(ajaxBlockUrl, {
|
| 7 |
+
parameters: {isAjax: 'true', form_key: FORM_KEY},
|
| 8 |
+
onSuccess: function(transport) {
|
| 9 |
+
tabContentElementId = 'dashboard_diagram_totals';
|
| 10 |
+
try {
|
| 11 |
+
if (transport.responseText.isJSON()) {
|
| 12 |
+
var response = transport.responseText.evalJSON()
|
| 13 |
+
if (response.error) {
|
| 14 |
+
alert(response.message);
|
| 15 |
+
}
|
| 16 |
+
if(response.ajaxExpired && response.ajaxRedirect) {
|
| 17 |
+
setLocation(response.ajaxRedirect);
|
| 18 |
+
}
|
| 19 |
+
} else {
|
| 20 |
+
$(tabContentElementId).replace(transport.responseText);
|
| 21 |
+
}
|
| 22 |
+
}
|
| 23 |
+
catch (e) {
|
| 24 |
+
$(tabContentElementId).replace(transport.responseText);
|
| 25 |
+
}
|
| 26 |
+
}
|
| 27 |
+
});
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
function toggleCal(id) {
|
| 31 |
+
$('dashboard_'+id+'_cal_div').toggle();
|
| 32 |
+
$('dashboard_'+id+'_range_div').toggle();
|
| 33 |
+
}
|
| 34 |
+
//]]>
|
| 35 |
+
</script>
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
<div class="content-header">
|
| 40 |
+
<table cellspacing="0">
|
| 41 |
+
<tr>
|
| 42 |
+
<td style="width:50%;"><h3>Abandoned Cart Dashboard (Ebizmarts)</h3></td>
|
| 43 |
+
</tr>
|
| 44 |
+
</table>
|
| 45 |
+
</div>
|
| 46 |
+
|
| 47 |
+
<div class="dashboard-container">
|
| 48 |
+
<?php echo $this->getChildHtml('store_switcher') ?>
|
| 49 |
+
<table cellspacing='25' width='100%'>
|
| 50 |
+
<tr>
|
| 51 |
+
<td>
|
| 52 |
+
<?php echo $this->getChildHtml('sales') ?>
|
| 53 |
+
</td>
|
| 54 |
+
<td>
|
| 55 |
+
<div class="entry-edit" style="border: 1px solid #ccc;">
|
| 56 |
+
<div style="margin: 20px;">
|
| 57 |
+
<p class="switcher a-right" style="padding: 5px 10px;">
|
| 58 |
+
Select a range:
|
| 59 |
+
<select name="period" id="order__period" onchange="changeDiagramsPeriod(this);">
|
| 60 |
+
<?php foreach ($this->helper('ebizmarts_abandonedcart')->getDatePeriods() as $_value=>$_label): ?>
|
| 61 |
+
<?php if(in_array($_value, array('custom'))) continue; ?>
|
| 62 |
+
<option value="<?php echo $_value ?>" <?php if($this->getRequest()->getParam('period')==$_value): ?> selected="selected"<?php endif; ?>><?php echo $_label ?></option>
|
| 63 |
+
<?php endforeach; ?>
|
| 64 |
+
</select></p><br/>
|
| 65 |
+
</p>
|
| 66 |
+
<?php echo $this->getChildHtml('totals') ?>
|
| 67 |
+
</div>
|
| 68 |
+
</div>
|
| 69 |
+
</td>
|
| 70 |
+
</tr>
|
| 71 |
+
</table>
|
| 72 |
+
</div>
|
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php if( sizeof($this->getTotals()) > 0 ): ?>
|
| 2 |
+
<?php foreach( $this->getTotals() as $_total ): ?>
|
| 3 |
+
<div class="entry-edit">
|
| 4 |
+
<div class="entry-edit-head"><h4><?php echo $_total['label'] ?></h4></div>
|
| 5 |
+
<fieldset class="a-center bold">
|
| 6 |
+
<span class="nowrap" style="font-size:18px;"><?php echo $_total['value'] ?><span style="font-size:14px; color:#686868;"><?php echo $_total['decimals'] ?></span></span>
|
| 7 |
+
</fieldset>
|
| 8 |
+
</div>
|
| 9 |
+
<?php endforeach; ?>
|
| 10 |
+
<?php endif; ?>
|
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php if( sizeof($this->getTotals()) > 0 ): ?>
|
| 2 |
+
<?php
|
| 3 |
+
$last = '';
|
| 4 |
+
$total = array();
|
| 5 |
+
foreach($this->getTotals() as $_total):
|
| 6 |
+
$words = explode(' ',$_total['label']);
|
| 7 |
+
$total[$words[0]][] = $_total;
|
| 8 |
+
endforeach;
|
| 9 |
+
?>
|
| 10 |
+
<div class="box" id="dashboard_diagram_totals">
|
| 11 |
+
<?php foreach( $total as $label => $_auxtotal ): ?>
|
| 12 |
+
<div class="entry-edit">
|
| 13 |
+
<div class="entry-edit-head"><h4><?php echo $label ?></h4></div>
|
| 14 |
+
<table cellspacing="0" width="100%">
|
| 15 |
+
<tr>
|
| 16 |
+
<?php foreach( $_auxtotal as $_total ): ?>
|
| 17 |
+
<td class="a-center bold">
|
| 18 |
+
<span><?php echo $_total['label'] ?></span><br />
|
| 19 |
+
<span class="nowrap" style="font-size:18px; color:#EA7601;"><?php echo $_total['value'] ?><span style="font-size:14px; color:#DE8946;"><?php echo $_total['decimals'] ?></span></span>
|
| 20 |
+
</td>
|
| 21 |
+
<?php endforeach; ?>
|
| 22 |
+
</tr>
|
| 23 |
+
</table>
|
| 24 |
+
</div>
|
| 25 |
+
<?php endforeach; ?>
|
| 26 |
+
<?php if(!Mage::helper('core')->isModuleEnabled('Ebizmarts_Mandrill')): ?>
|
| 27 |
+
<div class="warning-msg">
|
| 28 |
+
You may obtain more statistics if you install <a class="action-link" href="http://www.magentocommerce.com/magento-connect/mage-monkey-mailchimp-integration-4865.html" target="_blank">Ebizmarts_Magemonkey</a>
|
| 29 |
+
extension and configure <a class="action-link-holder" href="http://mandrill.com/signup/?pid=ebizmart&source=website" target="_blank">Mandrill</a> is free
|
| 30 |
+
</div>
|
| 31 |
+
<?php else: ?>
|
| 32 |
+
<?php if(Mage::getConfig()->getNode()->modules->Ebizmarts_Mandrill->version < '1.0.5'): ?>
|
| 33 |
+
<div class="warning-msg">
|
| 34 |
+
You may obtain more statistics if you upgrade your <a class="action-link" href="http://www.magentocommerce.com/magento-connect/mage-monkey-mailchimp-integration-4865.html" target="_blank">Ebizmarts_Magemonkey</a>
|
| 35 |
+
extension to 1.0.5 or up and configure <a class="action-link-holder" href="http://mandrill.com/signup/?pid=ebizmart&source=website" target="_blank">Mandrill</a> is free
|
| 36 |
+
</div>
|
| 37 |
+
<?php else: ?>
|
| 38 |
+
<?php if(!Mage::helper('mandrill')->useTransactionalService()): ?>
|
| 39 |
+
<div class="warning-msg">
|
| 40 |
+
You may obtain more statistics if enable and configure <a class="action-link-holder" href="<?php echo Mage::helper("adminhtml")->getUrl("adminhtml/system_config/edit/section/mandrill"); ?>" >Mandrill</a> extension
|
| 41 |
+
</div>
|
| 42 |
+
<?php endif; ?>
|
| 43 |
+
<?php endif; ?>
|
| 44 |
+
<?php endif; ?>
|
| 45 |
+
</div>
|
| 46 |
+
<?php endif; ?>
|
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<div style="background:#EAF0EE;border:1px solid #CCCCCC;margin-bottom:10px;padding:11px 0 0 10px;">
|
| 2 |
+
<h4>
|
| 3 |
+
<img src="http://ebizmarts.com/extension-logo.php?<?php echo $this->getPxParams(); ?>" /><br>
|
| 4 |
+
<?php echo Mage::helper('ebizmarts_abandonedcart')->__('<strong style="color:#EA7601;">Ebizmarts Abandoned Cart v%s</strong> <br>Need help? See our <a href="http://wiki.ebizmarts.com/abandoned-carts/" target="_blank">Wiki</a> or browse our <a href="http://ebizmarts.com/forums/view/1" target="_blank">support forums</a> Got feedback? <a href="mailto:info@ebizmarts.com?Subject=Support Abandoned Cart Version %s">Email us</a>', $this->getVersion(),$this->getVersion())?>
|
| 5 |
+
</h4>
|
| 6 |
+
</div>
|
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php if(!Mage::getStoreConfig('customer/address/dob_show')) : ?>
|
| 2 |
+
<div class="box error-msg" style="padding-left:30px;">
|
| 3 |
+
You must activate Show Date of Birth in System->Configuration->Customer Configuration->Name and Address Options to use this facility
|
| 4 |
+
</div>
|
| 5 |
+
<?php endif; ?>
|
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<div style="background:#EAF0EE;border:1px solid #CCCCCC;margin-bottom:10px;padding:11px 0 0 10px;">
|
| 2 |
+
<h4>
|
| 3 |
+
<img src="http://ebizmarts.com/extension-logo.php?<?php echo $this->getPxParams(); ?>" /><br>
|
| 4 |
+
<?php echo Mage::helper('ebizmarts_autoresponder')->__('<strong style="color:#EA7601;">Ebizmarts Autoresponder v%s</strong> <br>Need help? See our <a href="http://wiki.ebizmarts.com/configuration" target="_blank">Wiki</a> or browse our <a href="http://ebizmarts.com/forums/view/1" target="_blank">support forums</a> Got feedback? <a href="mailto:info@ebizmarts.com?Subject=Support Autoresponder Version %s">Email us</a>', $this->getVersion(),$this->getVersion())?>
|
| 5 |
+
|
| 6 |
+
<?php if(!Mage::helper('mandrill')->useTransactionalService()): ?>
|
| 7 |
+
<div class="box error-msg" style="padding-left: 30px;">
|
| 8 |
+
You must setup <a class="action-link-holder" href="<?php echo Mage::helper("adminhtml")->getUrl("adminhtml/system_config/edit/section/mandrill"); ?>" >Mandrill</a> extension to use this extension
|
| 9 |
+
</div>
|
| 10 |
+
<?php endif; ?>
|
| 11 |
+
</h4>
|
| 12 |
+
</div>
|
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php if(Mage::getStoreConfig('advanced/modules_disable_output/Mage_Review')) : ?>
|
| 2 |
+
<div class="box error-msg" style="padding-left:30px;">
|
| 3 |
+
You must activate the output of the module Mage_Review on System->Configuration->Advanced->Advanced->Disable Module output to use this feature
|
| 4 |
+
</div>
|
| 5 |
+
<?php endif; ?>
|
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php if(Mage::getStoreConfig('advanced/modules_disable_output/Mage_Wishlist')) : ?>
|
| 2 |
+
<div class="box error-msg" style="padding-left:30px;">
|
| 3 |
+
You must activate the output of the module Mage_Wishlist on System->Configuration->Advanced->Advanced->Disable Module output to use this feature
|
| 4 |
+
</div>
|
| 5 |
+
<?php endif; ?>
|
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* @see Ebizmarts_MageMonkey_Block_Adminhtml_System_Config_Fieldset_Hint
|
| 4 |
+
*/
|
| 5 |
+
?>
|
| 6 |
+
<div class="magemonkey-notice">
|
| 7 |
+
<img src="http://ebizmarts.com/extension-logo.php?<?php echo $this->getPxParams(); ?>" />
|
| 8 |
+
<h4>
|
| 9 |
+
<?php echo Mage::helper('monkey')->__('<strong style="color:#EA7601;">MageMonkey v%s by</strong> <a target="_blank" href="http://ebizmarts.com"><strong>ebizmarts</strong></a>', $this->getMageMonkeyVersion())?>
|
| 10 |
+
<br>
|
| 11 |
+
<?php echo Mage::helper('monkey')->__('Need help? See our <a href="http://wiki.ebizmarts.com/installation" target="_blank">Wiki</a> or browse our <a href="http://ebizmarts.com/forums/view/1" target="_blank">support forums</a> Got feedback? <a href="mailto:info@ebizmarts.com?Subject=MageMonkey Version %s">Email us</a>', $this->getMageMonkeyVersion())?>
|
| 12 |
+
</h4>
|
| 13 |
+
</div>
|
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* @see Ebizmarts_MageMonkey_Block_Adminhtml_System_Config_OauthWizard
|
| 4 |
+
*/
|
| 5 |
+
?>
|
| 6 |
+
<table>
|
| 7 |
+
<tr>
|
| 8 |
+
<td>
|
| 9 |
+
<button style="" onclick="javascript:window.open('<?php echo $this->getButtonUrl()?>', 'apiwizard','toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, ,left=100, top=100, width=500, height=700'); return false;" class="scalable" type="button" id="<?php echo $this->getHtmlId() ?>">
|
| 10 |
+
<span><?php echo $this->escapeHtml($this->getButtonLabel()); ?></span>
|
| 11 |
+
</button>
|
| 12 |
+
</td>
|
| 13 |
+
</tr>
|
| 14 |
+
</table>
|
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<div class="mandrill-notice">
|
| 2 |
+
<img src="http://ebizmarts.com/extension-logo.php?<?php echo $this->getPxParams(); ?>" />
|
| 3 |
+
<h4>
|
| 4 |
+
<?php echo $this->__('<strong style="color:#EA7601;">Mandrill v%s by</strong> <a target="_blank" href="http://ebizmarts.com"><strong>ebizmarts</strong></a>', $this->getMandrillVersion())?>
|
| 5 |
+
<br>
|
| 6 |
+
<?php echo $this->__('Need help? See our <a href="http://wiki.ebizmarts.com/installation" target="_blank">Wiki</a> or browse our <a href="http://ebizmarts.com/forums/view/1" target="_blank">support forums</a> Got feedback? <a href="mailto:info@ebizmarts.com?Subject=MageMonkey Version %s">Email us</a>', $this->getMandrillVersion())?>
|
| 7 |
+
</h4>
|
| 8 |
+
</div>
|
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
|
| 3 |
+
<layout version="0.1.0">
|
| 4 |
+
<ebizmarts_abandonedcart_email_order_items>
|
| 5 |
+
<block type="ebizmarts_abandonedcart/email_order_items" name="items" template="ebizmarts/abandonedcart/email/order/items.phtml">
|
| 6 |
+
<action method="addItemRender"><type>default</type><block>ebizmarts_abandonedcart/email_order_items_order_default</block><template>ebizmarts/abandonedcart/email/order/items/order/default.phtml</template></action>
|
| 7 |
+
<action method="addItemRender"><type>grouped</type><block>ebizmarts_abandonedcart/email_order_items_order_grouped</block><template>ebizmarts/abandonedcart/email/order/items/order/default.phtml</template></action>
|
| 8 |
+
</block>
|
| 9 |
+
<block type="core/text_list" name="additional.product.info" />
|
| 10 |
+
</ebizmarts_abandonedcart_email_order_items>
|
| 11 |
+
</layout>
|
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
+
<layout version="0.1.0">
|
| 3 |
+
<ebizmarts_autoresponder_autoresponder_unsubscribe>
|
| 4 |
+
<reference name="root">
|
| 5 |
+
<action method="setTemplate"><template>page/2columns-right.phtml</template></action>
|
| 6 |
+
</reference>
|
| 7 |
+
<reference name="content">
|
| 8 |
+
<block type="ebizmarts_autoresponder/unsubscribe" name="ebizmarts_autoresponder_unsubscribe" template="ebizmarts/autoresponder/unsubscribe.phtml"/>
|
| 9 |
+
</reference>
|
| 10 |
+
</ebizmarts_autoresponder_autoresponder_unsubscribe>
|
| 11 |
+
|
| 12 |
+
<ebizmarts_autoresponder_autoresponder_index translate="label">
|
| 13 |
+
<label>Customer My Account Autoresponder lists</label>
|
| 14 |
+
<update handle="customer_account"/>
|
| 15 |
+
<reference name="my.account.wrapper">
|
| 16 |
+
<block type="ebizmarts_autoresponder/customer_account_list" name="autoresponderlists" template="ebizmarts/autoresponder/customer/list.phtml" />
|
| 17 |
+
<block type="customer/account_dashboard" name="customer.account.link.back" template="customer/account/link/back.phtml"/>
|
| 18 |
+
</reference>
|
| 19 |
+
</ebizmarts_autoresponder_autoresponder_index>
|
| 20 |
+
|
| 21 |
+
<customer_account>
|
| 22 |
+
<reference name="customer_account_navigation">
|
| 23 |
+
<action method="addLink" ifconfig="ebizmarts_autoresponder/general/active" translate="label" module="ebizmarts_autoresponder">
|
| 24 |
+
<name>autoresponderlists</name>
|
| 25 |
+
<path>ebizautoresponder/autoresponder/index</path>
|
| 26 |
+
<label>Autoresponder lists</label>
|
| 27 |
+
</action>
|
| 28 |
+
</reference>
|
| 29 |
+
</customer_account>
|
| 30 |
+
</layout>
|
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
|
| 3 |
+
<layout version="0.1.0">
|
| 4 |
+
|
| 5 |
+
<!-- Monkey Multiple Signup EXAMPLE Layout directive on how you can include template
|
| 6 |
+
<default>
|
| 7 |
+
<reference name="footer">
|
| 8 |
+
<block type="monkey/signup" name="left.monkeysignup" template="magemonkey/lists.phtml"/>
|
| 9 |
+
</reference>
|
| 10 |
+
</default>
|
| 11 |
+
EXAMPLE Layout directive on how you can include template Monkey Multiple Signup -->
|
| 12 |
+
|
| 13 |
+
<!-- Checkout -->
|
| 14 |
+
<checkout_onepage_review>
|
| 15 |
+
<reference name="checkout.onepage.review.info.items.after">
|
| 16 |
+
<block type="monkey/checkout_subscribe" name="magemonkey.subscribe" template="magemonkey/checkout/subscribe.phtml">
|
| 17 |
+
<block type="monkey/signup" name="left.monkeysignup" template="magemonkey/lists.phtml" />
|
| 18 |
+
</block>
|
| 19 |
+
</reference>
|
| 20 |
+
</checkout_onepage_review>
|
| 21 |
+
<!-- Checkout -->
|
| 22 |
+
|
| 23 |
+
<!-- Customer -->
|
| 24 |
+
<customer_account>
|
| 25 |
+
<reference name="head">
|
| 26 |
+
<action method="addItem"><type>skin_js</type><name>magemonkey/monkey.js</name><params/></action>
|
| 27 |
+
</reference>
|
| 28 |
+
<reference name="customer_account_navigation">
|
| 29 |
+
<action method="addLink" ifconfig="monkey/general/active" translate="label" module="monkey">
|
| 30 |
+
<name>mailchimp</name>
|
| 31 |
+
<path>monkey/customer_account/index</path>
|
| 32 |
+
<label>Newsletter Subscriptions</label>
|
| 33 |
+
</action>
|
| 34 |
+
</reference>
|
| 35 |
+
</customer_account>
|
| 36 |
+
|
| 37 |
+
<monkey_customer_account_index>
|
| 38 |
+
<label>Customer My Account Mage Monkey</label>
|
| 39 |
+
<update handle="customer_account"/>
|
| 40 |
+
<reference name="head">
|
| 41 |
+
<action method="addCss"><stylesheet>magemonkey/magemonkey.css</stylesheet></action>
|
| 42 |
+
</reference>
|
| 43 |
+
<reference name="my.account.wrapper">
|
| 44 |
+
<block type="monkey/customer_account_lists" name="magemonkey_additionallists" template="magemonkey/lists.phtml" />
|
| 45 |
+
<block type="customer/account_dashboard" name="customer.account.link.back" template="customer/account/link/back.phtml"/>
|
| 46 |
+
</reference>
|
| 47 |
+
</monkey_customer_account_index>
|
| 48 |
+
<!-- Customer -->
|
| 49 |
+
|
| 50 |
+
</layout>
|
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
$lists = $this->getLists();
|
| 3 |
+
?>
|
| 4 |
+
<div>
|
| 5 |
+
<div class="page-title">
|
| 6 |
+
<h1><?php echo $this->__('Autoresponders Subscription'); ?></h1>
|
| 7 |
+
</div>
|
| 8 |
+
<form action="<?php echo $this->getSaveUrl(); ?>" name="autoresponder_list" id="autoresponder_list" method="post">
|
| 9 |
+
<div class="fieldset">
|
| 10 |
+
<ul>
|
| 11 |
+
<?php foreach($lists as $key => $list): ?>
|
| 12 |
+
<li class="listdata">
|
| 13 |
+
<input type="checkbox" name="<?php echo $key;?>" id="<?php echo $key;?>" value="1" <?php if($list['checked']=='checked') { echo 'checked="checked"';}?>/>
|
| 14 |
+
<label for="<?php echo $key;?>"><?php echo $list['listname']; ?></label>
|
| 15 |
+
</li>
|
| 16 |
+
|
| 17 |
+
<?php endforeach; ?>
|
| 18 |
+
</ul>
|
| 19 |
+
<div class="buttons-set">
|
| 20 |
+
<button type="submit" title="<?php echo $this->__('Save') ?>" class="button"><span><span><?php echo $this->__('Save') ?></span></span></button>
|
| 21 |
+
</div>
|
| 22 |
+
</div>
|
| 23 |
+
</form>
|
| 24 |
+
</div>
|
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php $products = $this->getProducts(); ?>
|
| 2 |
+
<table cellspacing="0" cellpadding="0" border="0" width="650" style="border:1px solid #EAEAEA;">
|
| 3 |
+
<?php foreach($products as $product): ?>
|
| 4 |
+
<tr>
|
| 5 |
+
<td valign="top" align="left" style="padding:3px 9px"><a href="<?php echo $product->getProductUrl(); ?>" alt="<?php echo $product->getName(); ?>" target="_blank"><img src="<?php echo $product->getThumbnailUrl();?>" alt="<?php echo $product->getName(); ?>"/></a></td>
|
| 6 |
+
<td valign="top" align="left" style="padding:3px 9px"><p><?php echo $product->getName(); ?></p><?php echo $product->getShortDescription(); ?></td>
|
| 7 |
+
</tr>
|
| 8 |
+
<?php endforeach; ?>
|
| 9 |
+
</table>
|
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php $products = $this->getProducts(); ?>
|
| 2 |
+
<table cellspacing="0" cellpadding="0" border="0" width="650" style="border:1px solid #EAEAEA;">
|
| 3 |
+
<?php foreach($products as $product): ?>
|
| 4 |
+
<tr>
|
| 5 |
+
<td valign="top" align="left" style="padding:3px 9px"><a href="<?php echo Mage::getUrl('review/product/list', array('id'=> $product->getId()));; ?>" alt="<?php echo $product->getName(); ?>" target="_blank"><img src="<?php echo $product->getThumbnailUrl();?>" alt="<?php echo $product->getName(); ?>"/></a></td>
|
| 6 |
+
<td valign="top" align="left" style="padding:3px 9px"><p><h2><a href="<?php echo Mage::getUrl('review/product/list', array('id'=> $product->getId())); ?>"> Rate <?php echo $product->getName(); ?></a></h2></p><?php echo $product->getShortDescription(); ?></td>
|
| 7 |
+
</tr>
|
| 8 |
+
<?php endforeach; ?>
|
| 9 |
+
</table>
|
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<div class="page-title">
|
| 2 |
+
<h1><?php echo $this->__('You successfully removed from list.') ?></h1>
|
| 3 |
+
</div>
|
| 4 |
+
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
|
| 5 |
+
<h2 class="sub-title"><?php echo $this->__('Thank you') ?></h2>
|
| 6 |
+
<div class="buttons-set">
|
| 7 |
+
<button type="button" class="button" title="<?php echo $this->__('Continue Shopping') ?>" onclick="window.location='<?php echo $this->getUrl() ?>'"><span><span><?php echo $this->__('Continue Shopping') ?></span></span></button>
|
| 8 |
+
</div>
|
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php $products = $this->getProducts(); ?>
|
| 2 |
+
<table cellspacing="0" cellpadding="0" border="0" width="650" style="border:1px solid #EAEAEA;">
|
| 3 |
+
<?php foreach($products as $product): ?>
|
| 4 |
+
<tr>
|
| 5 |
+
<td valign="top" align="left" style="padding:3px 9px"><a href="<?php echo $product->getProductUrl(); ?>" alt="<?php echo $product->getName(); ?>" target="_blank"><img src="<?php echo $product->getThumbnailUrl();?>" alt="<?php echo $product->getName(); ?>"/></a></td>
|
| 6 |
+
<td valign="top" align="left" style="padding:3px 9px"><p><h2><a href="<?php echo $product->getProductUrl(); ?>"> <?php echo $product->getName(); ?></a></h2></p><?php echo $product->getShortDescription(); ?></td>
|
| 7 |
+
</tr>
|
| 8 |
+
<?php endforeach; ?>
|
| 9 |
+
</table>
|
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php $_quote = $this->getQuote() ?>
|
| 2 |
+
<table cellspacing="0" cellpadding="0" border="0" width="650" style="border:1px solid #EAEAEA;">
|
| 3 |
+
<thead>
|
| 4 |
+
<tr>
|
| 5 |
+
<th align="left" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px"><?php echo $this->__('Item') ?></th>
|
| 6 |
+
<th align="left" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px"><?php echo $this->__('Sku') ?></th>
|
| 7 |
+
<th align="center" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px"><?php echo $this->__('Qty') ?></th>
|
| 8 |
+
<th align="right" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px"><?php echo $this->__('Subtotal') ?></th>
|
| 9 |
+
</tr>
|
| 10 |
+
</thead>
|
| 11 |
+
<?php if (is_object($_quote)) :?>
|
| 12 |
+
<?php $i=0; foreach ($_quote->getAllItems() as $_item):?>
|
| 13 |
+
<?php if($_item->getParentItemId()) continue; else $i++; ?>
|
| 14 |
+
<?php if($_item->getProductType() == 'configurable' || $_item->getProductType() == 'bundle') :
|
| 15 |
+
$finalResult = array();
|
| 16 |
+
$result = array();
|
| 17 |
+
$options = $_item->getProduct()->getTypeInstance(true)->getOrderOptions($_item->getProduct());
|
| 18 |
+
// Check for options
|
| 19 |
+
if ($options) {
|
| 20 |
+
if (isset($options['options'])) {
|
| 21 |
+
$result = array_merge($result, $options['options']);
|
| 22 |
+
}
|
| 23 |
+
if (isset($options['additional_options'])) {
|
| 24 |
+
$result = array_merge($result, $options['additional_options']);
|
| 25 |
+
}
|
| 26 |
+
if (!empty($options['attributes_info'])) {
|
| 27 |
+
$result = array_merge($options['attributes_info'], $result);
|
| 28 |
+
}
|
| 29 |
+
if(isset($options['bundle_options'])) {
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
$bundled_product = new Mage_Catalog_Model_Product();
|
| 33 |
+
$bundled_product->load($_item->getProduct()->getId());
|
| 34 |
+
$selectionCollection = $bundled_product->getTypeInstance(true)->getSelectionsCollection(
|
| 35 |
+
$bundled_product->getTypeInstance(true)->getOptionsIds($bundled_product), $bundled_product
|
| 36 |
+
);
|
| 37 |
+
|
| 38 |
+
$bundled_items = array();
|
| 39 |
+
$label = '';
|
| 40 |
+
$qty = '';
|
| 41 |
+
foreach($selectionCollection as $option)
|
| 42 |
+
{
|
| 43 |
+
foreach($options['bundle_options'] as $bundle){
|
| 44 |
+
if($bundle['value'][0]['title'] == $option->getName()){
|
| 45 |
+
$label = $bundle['label'];
|
| 46 |
+
$qty = $bundle['value'][0]['qty'];
|
| 47 |
+
$aux_options[] = array('label' => $label, 'value' => $qty .' x '. $option->getName() .' '. Mage::helper('checkout')->formatPrice($option->getPrice()), 'sku' => $option->getSku());
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
}
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
$result = array_merge($result, $aux_options);
|
| 54 |
+
}
|
| 55 |
+
}
|
| 56 |
+
$options = array_merge($finalResult, $result);
|
| 57 |
+
endif; ?>
|
| 58 |
+
<tbody<?php echo $i%2 ? ' bgcolor="#F6F6F6"' : '' ?>>
|
| 59 |
+
<tr>
|
| 60 |
+
<?php echo '<td valign="top" align="left" style="padding:3px 9px">'. $_item['name'] .'</td>'; ?>
|
| 61 |
+
<?php echo '<td valign="top" align="left" style="padding:3px 9px">'. $_item['sku'] .'</td>'; ?>
|
| 62 |
+
<?php echo '<td valign="top" align="center" style="padding:3px 9px">'. $_item['qty'] .'</td>'; ?>
|
| 63 |
+
<?php echo '<td valign="top" align="right" style="padding:3px 9px">' . $this->getTax($_item) .'</td>'; ?>
|
| 64 |
+
<?php if(isset($options) && is_array($options)) : foreach($options as $option) : echo '<tr><td valign="top" align="left" style="padding:3px 9px" colspan="4"><strong><em>'.$option['label'].'</em></strong></td></tr>'.'<tr><td valign="top" align="left" style="padding:3px 19px">'.$option['value'].'</td>'; if(isset($option['sku'])) : echo '<td style="padding:3px 9px">' . $option['sku'] . '</td><td></td><td></td>'; else: echo '<td></td><td></td><td></td>'; endif; endforeach; $options = null; endif; '</tr>' ?>
|
| 65 |
+
</tr>
|
| 66 |
+
</tbody>
|
| 67 |
+
<?php endforeach; ?>
|
| 68 |
+
<?php endif;?>
|
| 69 |
+
</table>
|
|
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php $_item = $this->getItem() ?>
|
| 2 |
+
<?php $_quote = $this->getItem()->getQuote() ?>
|
| 3 |
+
<tr>
|
| 4 |
+
<td align="left" valign="top" style="font-size:11px; padding:3px 9px; border-bottom:1px dotted #CCCCCC;">
|
| 5 |
+
<strong style="font-size:11px;"><?php echo $this->htmlEscape($_item->getName()) ?></strong>
|
| 6 |
+
<?php if ($this->getItemOptions()): ?>
|
| 7 |
+
<dl style="margin:0; padding:0;">
|
| 8 |
+
<?php foreach ($this->getItemOptions() as $option): ?>
|
| 9 |
+
<dt><strong><em><?php echo $option['label'] ?></em></strong></dt>
|
| 10 |
+
<dd style="margin:0; padding:0 0 0 9px;">
|
| 11 |
+
<?php echo nl2br($this->escapeHtml($option['value'])) ?>
|
| 12 |
+
</dd>
|
| 13 |
+
<?php endforeach; ?>
|
| 14 |
+
</dl>
|
| 15 |
+
<?php endif; ?>
|
| 16 |
+
<?php $addInfoBlock = $this->getProductAdditionalInformationBlock(); ?>
|
| 17 |
+
<?php if ($addInfoBlock) :?>
|
| 18 |
+
<?php echo $addInfoBlock->setItem($_item)->toHtml(); ?>
|
| 19 |
+
<?php endif; ?>
|
| 20 |
+
<?php echo $this->escapeHtml($_item->getDescription()) ?>
|
| 21 |
+
</td>
|
| 22 |
+
<td align="left" valign="top" style="font-size:11px; padding:3px 9px; border-bottom:1px dotted #CCCCCC;"><?php echo $this->htmlEscape($this->getSku($_item)) ?></td>
|
| 23 |
+
<td align="center" valign="top" style="font-size:11px; padding:3px 9px; border-bottom:1px dotted #CCCCCC;"><?php echo $_item->getQtyOrdered()*1 ?></td>
|
| 24 |
+
<td align="right" valign="top" style="font-size:11px; padding:3px 9px; border-bottom:1px dotted #CCCCCC;">
|
| 25 |
+
<?php if ($this->helper('tax')->displaySalesPriceExclTax($_quote->getStoreId()) || $this->helper('tax')->displaySalesBothPrices($_quote->getStore())): ?>
|
| 26 |
+
<?php if ($this->helper('tax')->displaySalesBothPrices($_quote->getStoreId())): ?>
|
| 27 |
+
<span class="label"><?php echo Mage::helper('tax')->__('Excl. Tax'); ?>:</span>
|
| 28 |
+
<?php endif; ?>
|
| 29 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'email', $_quote->getStore())): ?>
|
| 30 |
+
<?php echo Mage::app()->getLocale()->currency($_quote->getQuoteCurrencyCode())->toCurrency($_item->getRowTotal()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?>
|
| 31 |
+
<?php //echo $_quote->formatPrice($_item->getRowTotal()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?>
|
| 32 |
+
<?php else: ?>
|
| 33 |
+
<?php echo Mage::app()->getLocale()->currency($_quote->getQuoteCurrencyCode())->toCurrency($_item->getRowTotal()) ?>
|
| 34 |
+
<?php endif; ?>
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
<?php if (Mage::helper('weee')->getApplied($_item)): ?>
|
| 38 |
+
<br />
|
| 39 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'email', $_quote->getStore())): ?>
|
| 40 |
+
<small>
|
| 41 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
| 42 |
+
<span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::app()->getLocale()->currency($_quote->getQuoteCurrencyCode())->toCurrency($tax['row_amount'],true,true); ?></span><br />
|
| 43 |
+
<?php endforeach; ?>
|
| 44 |
+
</small>
|
| 45 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'email', $_quote->getStoreId())): ?>
|
| 46 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
| 47 |
+
<span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo Mage::app()->getLocale()->currency($_quote->getQuoteCurrencyCode())->toCurrency($tax['row_amount_incl_tax'],true,true); ?></small></span><br />
|
| 48 |
+
<?php endforeach; ?>
|
| 49 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'email', $_quote->getStoreId())): ?>
|
| 50 |
+
<small>
|
| 51 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
| 52 |
+
<span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::app()->getLocale()->currency($_quote->getQuoteCurrencyCode())->toCurrency($tax['row_amount_incl_tax'],true,true); ?></span><br />
|
| 53 |
+
<?php endforeach; ?>
|
| 54 |
+
</small>
|
| 55 |
+
<?php endif; ?>
|
| 56 |
+
|
| 57 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'email', $_quote->getStore())): ?>
|
| 58 |
+
<br />
|
| 59 |
+
<span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>:<br /> <?php echo Mage::app()->getLocale()->currency($_quote->getQuoteCurrencyCode())->toCurrency($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?></span>
|
| 60 |
+
<?php endif; ?>
|
| 61 |
+
<?php endif; ?>
|
| 62 |
+
<?php endif; ?>
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
<?php if ($this->helper('tax')->displaySalesPriceInclTax($_quote->getStoreId()) || $this->helper('tax')->displaySalesBothPrices($_quote->getStoreId())): ?>
|
| 66 |
+
<?php if ($this->helper('tax')->displaySalesBothPrices($_quote->getStoreId())): ?>
|
| 67 |
+
<br /><span class="label"><?php echo Mage::helper('tax')->__('Incl. Tax'); ?>:</span>
|
| 68 |
+
<?php endif; ?>
|
| 69 |
+
<?php $_incl = $this->helper('checkout')->getSubtotalInclTax($_item); ?>
|
| 70 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'email', $_quote->getStoreId())): ?>
|
| 71 |
+
<?php echo Mage::app()->getLocale()->currency($_quote->getQuoteCurrencyCode())->toCurrency($_incl+$_item->getWeeeTaxAppliedRowAmount()); ?>
|
| 72 |
+
<?php else: ?>
|
| 73 |
+
<?php echo Mage::app()->getLocale()->currency($_quote->getQuoteCurrencyCode())->toCurrency($_incl-$_item->getWeeeTaxRowDisposition()) ?>
|
| 74 |
+
<?php endif; ?>
|
| 75 |
+
<?php if (Mage::helper('weee')->getApplied($_item)): ?>
|
| 76 |
+
<br />
|
| 77 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'email', $_quote->getStore())): ?>
|
| 78 |
+
<small>
|
| 79 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
| 80 |
+
<span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::app()->getLocale()->currency($_quote->getQuoteCurrencyCode())->toCurrency($tax['row_amount'],true,true); ?></span><br />
|
| 81 |
+
<?php endforeach; ?>
|
| 82 |
+
</small>
|
| 83 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'email', $_quote->getStoreId())): ?>
|
| 84 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
| 85 |
+
<span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo Mage::app()->getLocale()->currency($_quote->getQuoteCurrencyCode())->toCurrency($tax['row_amount_incl_tax'],true,true); ?></small></span><br />
|
| 86 |
+
<?php endforeach; ?>
|
| 87 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'email', $_quote->getStoreId())): ?>
|
| 88 |
+
<small>
|
| 89 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
| 90 |
+
<span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::app()->getLocale()->currency($_quote->getQuoteCurrencyCode())->toCurrency($tax['row_amount_incl_tax'],true,true); ?></span><br />
|
| 91 |
+
<?php endforeach; ?>
|
| 92 |
+
</small>
|
| 93 |
+
<?php endif; ?>
|
| 94 |
+
|
| 95 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'email', $_quote->getStoreId())): ?>
|
| 96 |
+
<span class="nobr"><?php echo Mage::helper('weee')->__('Total incl. tax'); ?>:<br /> <?php echo Mage::app()->getLocale()->currency($_quote->getQuoteCurrencyCode())->toCurrency($_incl+$_item->getWeeeTaxAppliedRowAmount()); ?></span>
|
| 97 |
+
<?php endif; ?>
|
| 98 |
+
<?php endif; ?>
|
| 99 |
+
<?php endif; ?>
|
| 100 |
+
</td>
|
| 101 |
+
</tr>
|
| 102 |
+
<?php if ($_item->getGiftMessageId() && $_giftMessage = $this->helper('giftmessage/message')->getGiftMessage($_item->getGiftMessageId())): ?>
|
| 103 |
+
<tr>
|
| 104 |
+
<td colspan="4" style=" border-bottom:2px solid #CCCCCC; padding:3px 9px;">
|
| 105 |
+
<strong style="color:#444444; font-size:11px;"><?php echo $this->__('Gift Message') ?></strong>
|
| 106 |
+
<?php echo $this->__('From:'); ?> <?php echo $this->htmlEscape($_giftMessage->getSender()) ?><br />
|
| 107 |
+
<?php echo $this->__('To:'); ?> <?php echo $this->htmlEscape($_giftMessage->getRecipient()) ?><br />
|
| 108 |
+
<strong><?php echo $this->__('Message:'); ?></strong><br /><?php echo $this->htmlEscape($_giftMessage->getMessage()) ?>
|
| 109 |
+
</td>
|
| 110 |
+
</tr>
|
| 111 |
+
<?php endif; ?>
|
|
@@ -0,0 +1,176 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
$lists = $this->getLists();
|
| 3 |
+
$check = $this->checkStatus();
|
| 4 |
+
$myLists = $this->getSubscribedLists();
|
| 5 |
+
$generalList = $this->getGeneralList();
|
| 6 |
+
$auto = (($check === 1) OR ($check === 3));
|
| 7 |
+
?>
|
| 8 |
+
<script type="text/javascript">
|
| 9 |
+
addSubscribeToPost = function (element){
|
| 10 |
+
|
| 11 |
+
if( $('magemonkey-subscribe') ){
|
| 12 |
+
$('magemonkey-subscribe').remove();
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
if(element.checked){
|
| 16 |
+
var inputer = new Element('input', { name: "magemonkey_subscribe", id: "magemonkey-subscribe", value: "1", type: "hidden" });
|
| 17 |
+
var listValue = new Element('input', { name: element.readAttribute('name'), id: "subscribe", value: element.getValue(), type: "hidden" });
|
| 18 |
+
try{
|
| 19 |
+
Element.insert(Form.findFirstElement(payment.form), inputer);
|
| 20 |
+
Element.insert(Form.findFirstElement(payment.form), listValue);
|
| 21 |
+
}catch(notelem){
|
| 22 |
+
$("co-payment-form").insert(inputer);
|
| 23 |
+
$("co-payment-form").insert(listValue);
|
| 24 |
+
}
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
}
|
| 28 |
+
addGroupToPost = function (element){
|
| 29 |
+
if(element.checked){
|
| 30 |
+
try{
|
| 31 |
+
var group = new Element('input', { name: element.readAttribute('name'), id: element.readAttribute('id'), value: element.getValue(), checked:true, type: "checkbox" });
|
| 32 |
+
Element.insert(Form.findFirstElement(payment.form), group);
|
| 33 |
+
}catch(notelem){
|
| 34 |
+
$("co-payment-form").insert(group);
|
| 35 |
+
}
|
| 36 |
+
}
|
| 37 |
+
}
|
| 38 |
+
addElementToPost = function (element){
|
| 39 |
+
|
| 40 |
+
var formInputId = element.readAttribute('id') + '-serialize';
|
| 41 |
+
|
| 42 |
+
if($(formInputId)){
|
| 43 |
+
$(formInputId).remove();
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
var inp = new Element('input', { name: element.readAttribute('name'), id: formInputId, value: element.getValue(), type: "hidden" });
|
| 47 |
+
|
| 48 |
+
Element.insert( Form.findFirstElement(payment.form), inp);
|
| 49 |
+
|
| 50 |
+
}
|
| 51 |
+
</script>
|
| 52 |
+
<div class="buttons-set"<?php if($check === 3): ?> style="display:none;"<?php endif;?>>
|
| 53 |
+
<!-- General Subscription -->
|
| 54 |
+
<div class="page-title">
|
| 55 |
+
<h1><?php echo $this->__('Newsletter Subscription'); ?></h1>
|
| 56 |
+
</div>
|
| 57 |
+
<?php echo $this->getBlockHtml('formkey'); ?>
|
| 58 |
+
<ul class="monkey-additional-lists">
|
| 59 |
+
<li class="listdata"><?php echo $generalList['name']; ?>
|
| 60 |
+
<input<?php if($auto): ?> checked="checked"<?php endif;?> type="checkbox" onchange="addSubscribeToPost(this);" name="list[<?php echo $generalList['id'] ?>][subscribed]" id="magemonkey-trigger" value="<?php echo $generalList['id']; ?>" title="<?php echo $generalList['name']; ?>" class="monkey-list-subscriber" />
|
| 61 |
+
<?php if(is_array($generalList['interest_groupings'])): ?>
|
| 62 |
+
<div id="interest_groupings_<?php echo $generalList['id']; ?>" class="interest-groupings">
|
| 63 |
+
<?php foreach($generalList['interest_groupings'] as $group): ?>
|
| 64 |
+
<?php if($group['name'] != 'MAGE_CUSTOMER_GROUPS'): ?>
|
| 65 |
+
<div class="grouping">
|
| 66 |
+
<strong><?php echo $group['name']; ?></strong>
|
| 67 |
+
<?php echo $this->renderGroup($group, $generalList); ?>
|
| 68 |
+
</div>
|
| 69 |
+
<?php endif; ?>
|
| 70 |
+
<?php endforeach; ?>
|
| 71 |
+
</div>
|
| 72 |
+
|
| 73 |
+
<?php endif; ?>
|
| 74 |
+
</li>
|
| 75 |
+
</ul>
|
| 76 |
+
<!-- General Subscription -->
|
| 77 |
+
|
| 78 |
+
<!-- Additional Lists -->
|
| 79 |
+
<div class="monkey-multisubscribe">
|
| 80 |
+
<ul class="monkey-additional-lists">
|
| 81 |
+
<?php
|
| 82 |
+
foreach($lists as $list):
|
| 83 |
+
|
| 84 |
+
if($this->notInMyAccount() && in_array($list['id'], $myLists)){
|
| 85 |
+
continue;
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
$igroups = $list['interest_groupings'];
|
| 89 |
+
?>
|
| 90 |
+
<li class="listdata"><?php echo $this->listLabel($list); ?>
|
| 91 |
+
<?php if(is_array($igroups)): ?>
|
| 92 |
+
<div id="interest_groupings_<?php echo $list['id']; ?>" class="interest-groupings">
|
| 93 |
+
<?php foreach($igroups as $group): ?>
|
| 94 |
+
<?php if($group['name'] != 'MAGE_CUSTOMER_GROUPS'): ?>
|
| 95 |
+
<div class="grouping">
|
| 96 |
+
<strong><?php echo $group['name']; ?></strong>
|
| 97 |
+
<?php echo $this->renderGroup($group, $list); ?>
|
| 98 |
+
</div>
|
| 99 |
+
<?php endif; ?>
|
| 100 |
+
<?php endforeach; ?>
|
| 101 |
+
</div>
|
| 102 |
+
|
| 103 |
+
<?php endif; ?>
|
| 104 |
+
</li>
|
| 105 |
+
<?php endforeach; ?>
|
| 106 |
+
</ul>
|
| 107 |
+
</div>
|
| 108 |
+
<!-- Additional Lists -->
|
| 109 |
+
</div>
|
| 110 |
+
<?php
|
| 111 |
+
//Check if there's additional list selected, if not Dont show this section
|
| 112 |
+
if(count($lists) > 0):
|
| 113 |
+
//echo $this->getChildHtml('left.monkeysignup');
|
| 114 |
+
endif;
|
| 115 |
+
?>
|
| 116 |
+
|
| 117 |
+
<script type="text/javascript">
|
| 118 |
+
//Handle newsletter subscribe/unsubscribe checkbox events
|
| 119 |
+
$$('input.monkey-list-subscriber').each(function(chk){
|
| 120 |
+
|
| 121 |
+
if( !chk.checked ){
|
| 122 |
+
var groupings = $('interest_groupings_'+chk.value);
|
| 123 |
+
if(groupings){
|
| 124 |
+
groupings.select('select', 'input').invoke('writeAttribute', 'disabled', 'disabled');
|
| 125 |
+
}
|
| 126 |
+
}
|
| 127 |
+
|
| 128 |
+
chk.observe('change', function(){
|
| 129 |
+
|
| 130 |
+
var groupings = $('interest_groupings_'+this.value);
|
| 131 |
+
if(groupings){
|
| 132 |
+
var elements = groupings.select('select', 'input');
|
| 133 |
+
if(this.checked){
|
| 134 |
+
elements.invoke('removeAttribute', 'disabled');
|
| 135 |
+
}else{
|
| 136 |
+
elements.invoke('writeAttribute', 'disabled', 'disabled');
|
| 137 |
+
}
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
+
});
|
| 141 |
+
});
|
| 142 |
+
|
| 143 |
+
addSubscribeToPost($('magemonkey-trigger'));
|
| 144 |
+
|
| 145 |
+
if( $$('div#checkout-step-review div.monkey-multisubscribe').length ){
|
| 146 |
+
|
| 147 |
+
var event = 'change';
|
| 148 |
+
|
| 149 |
+
//Radio||Checkbox
|
| 150 |
+
$$('div#checkout-step-review div.monkey-multisubscribe input').each(function(input){
|
| 151 |
+
|
| 152 |
+
if(input.readAttribute('type') == 'radio'){
|
| 153 |
+
event = 'click';
|
| 154 |
+
}
|
| 155 |
+
|
| 156 |
+
input.observe(event, function(){
|
| 157 |
+
addElementToPost(this);
|
| 158 |
+
});
|
| 159 |
+
});
|
| 160 |
+
|
| 161 |
+
$$('div#checkout-step-review div.monkey-multisubscribe select').each(function(ddl){
|
| 162 |
+
ddl.observe(event, function(){
|
| 163 |
+
addElementToPost(this);
|
| 164 |
+
});
|
| 165 |
+
});
|
| 166 |
+
|
| 167 |
+
}
|
| 168 |
+
//Handle newsletter subscribe/unsubscribe checkbox events
|
| 169 |
+
$$('.interest-groupings input').each(function(group){
|
| 170 |
+
group.observe('change', function(){
|
| 171 |
+
if(group.checked){
|
| 172 |
+
addGroupToPost(group);
|
| 173 |
+
}
|
| 174 |
+
});
|
| 175 |
+
});
|
| 176 |
+
</script>
|
|
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
$lists = $this->getLists();
|
| 4 |
+
$myLists = $this->getSubscribedLists();
|
| 5 |
+
$generalList = $this->getGeneralList();
|
| 6 |
+
|
| 7 |
+
?>
|
| 8 |
+
<div class="page-title">
|
| 9 |
+
<h1><?php echo $this->__('Newsletter Subscription'); ?></h1>
|
| 10 |
+
</div>
|
| 11 |
+
<form action="<?php echo $this->getUrl('monkey/customer_account/saveadditional'); ?>" name="mailchimp_additional" id="mailchimp-additional" method="post">
|
| 12 |
+
<div class="fieldset">
|
| 13 |
+
<?php echo $this->getBlockHtml('formkey'); ?>
|
| 14 |
+
<ul class="monkey-additional-lists">
|
| 15 |
+
|
| 16 |
+
<!-- General Subscription -->
|
| 17 |
+
<li class="listdata"><?php echo $this->listLabel($generalList); ?>
|
| 18 |
+
<?php if(is_array($generalList['interest_groupings'])): ?>
|
| 19 |
+
<div id="interest_groupings_<?php echo $generalList['id']; ?>" class="interest-groupings">
|
| 20 |
+
<?php foreach($generalList['interest_groupings'] as $group): ?>
|
| 21 |
+
<div class="grouping">
|
| 22 |
+
<strong><?php echo $group['name']; ?></strong>
|
| 23 |
+
<?php echo $this->renderGroup($group, $generalList); ?>
|
| 24 |
+
</div>
|
| 25 |
+
<?php endforeach; ?>
|
| 26 |
+
</div>
|
| 27 |
+
|
| 28 |
+
<?php endif; ?>
|
| 29 |
+
</li>
|
| 30 |
+
<!-- General Subscription -->
|
| 31 |
+
|
| 32 |
+
<!-- Additional Lists -->
|
| 33 |
+
<?php
|
| 34 |
+
foreach($lists as $list):
|
| 35 |
+
$igroups = $list['interest_groupings'];
|
| 36 |
+
?>
|
| 37 |
+
|
| 38 |
+
<li class="listdata"><?php echo $this->listLabel($list); ?>
|
| 39 |
+
<?php if(is_array($igroups)): ?>
|
| 40 |
+
<div id="interest_groupings_<?php echo $list['id']; ?>" class="interest-groupings">
|
| 41 |
+
<?php foreach($igroups as $group): ?>
|
| 42 |
+
<div class="grouping">
|
| 43 |
+
<strong><?php echo $group['name']; ?></strong>
|
| 44 |
+
<?php echo $this->renderGroup($group, $list); ?>
|
| 45 |
+
</div>
|
| 46 |
+
<?php endforeach; ?>
|
| 47 |
+
</div>
|
| 48 |
+
|
| 49 |
+
<?php endif; ?>
|
| 50 |
+
</li>
|
| 51 |
+
|
| 52 |
+
<?php endforeach; ?>
|
| 53 |
+
<!-- Additional Lists -->
|
| 54 |
+
|
| 55 |
+
</ul>
|
| 56 |
+
</div>
|
| 57 |
+
<input type="hidden" name="state" value="" id="form-state" />
|
| 58 |
+
<div class="buttons-set">
|
| 59 |
+
<button type="submit" title="<?php echo $this->__('Save') ?>" class="button"><span><span><?php echo $this->__('Save') ?></span></span></button>
|
| 60 |
+
</div>
|
| 61 |
+
</form>
|
| 62 |
+
<script type="text/javascript">
|
| 63 |
+
document.observe("dom:loaded", function() {
|
| 64 |
+
|
| 65 |
+
removeManageNewsletter();
|
| 66 |
+
|
| 67 |
+
//Handle newsletter subscribe/unsubscribe checkbox events
|
| 68 |
+
$$('input.monkey-list-subscriber').each(function(chk){
|
| 69 |
+
|
| 70 |
+
if( !chk.checked ){
|
| 71 |
+
var groupings = $('interest_groupings_'+chk.value);
|
| 72 |
+
if(groupings){
|
| 73 |
+
groupings.select('select', 'input').invoke('writeAttribute', 'disabled', 'disabled');
|
| 74 |
+
}
|
| 75 |
+
}
|
| 76 |
+
|
| 77 |
+
chk.observe('change', function(){
|
| 78 |
+
|
| 79 |
+
var groupings = $('interest_groupings_'+this.value);
|
| 80 |
+
if(groupings){
|
| 81 |
+
var elements = groupings.select('select', 'input');
|
| 82 |
+
if(this.checked){
|
| 83 |
+
elements.invoke('removeAttribute', 'disabled');
|
| 84 |
+
}else{
|
| 85 |
+
elements.invoke('writeAttribute', 'disabled', 'disabled');
|
| 86 |
+
}
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
});
|
| 90 |
+
});
|
| 91 |
+
|
| 92 |
+
//Load viewstate on hidden field for later process
|
| 93 |
+
$('form-state').writeAttribute('value', $('mailchimp-additional').serialize());
|
| 94 |
+
|
| 95 |
+
});
|
| 96 |
+
</script>
|
|
@@ -0,0 +1,121 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
$lists = $this->getLists();
|
| 4 |
+
$myLists = $this->getSubscribedLists();
|
| 5 |
+
$generalList = $this->getGeneralList();
|
| 6 |
+
$canShowButton = $this->getCanShowButton();
|
| 7 |
+
|
| 8 |
+
?>
|
| 9 |
+
<div class="monkey-multisubscribe">
|
| 10 |
+
<div class="page-title">
|
| 11 |
+
<h1><?php echo $this->__('Newsletter Subscription'); ?></h1>
|
| 12 |
+
</div>
|
| 13 |
+
<?php if($canShowButton): ?><form action="<?php echo $this->getSaveUrl(); ?>" name="mailchimp_additional" id="mailchimp-additional" method="post"><?php endif; ?>
|
| 14 |
+
<div class="fieldset">
|
| 15 |
+
<?php echo $this->getBlockHtml('formkey'); ?>
|
| 16 |
+
<ul class="monkey-additional-lists">
|
| 17 |
+
|
| 18 |
+
<?php if($this->getShowGeneral()): ?>
|
| 19 |
+
<!-- General Subscription -->
|
| 20 |
+
<li class="listdata"><?php echo $this->listLabel($generalList); ?>
|
| 21 |
+
<?php if(is_array($generalList['interest_groupings'])): ?>
|
| 22 |
+
|
| 23 |
+
<div id="interest_groupings_<?php echo $generalList['id']; ?>" class="interest-groupings">
|
| 24 |
+
<?php foreach($generalList['interest_groupings'] as $group): ?>
|
| 25 |
+
<?php if($group['name'] != 'MAGE_CUSTOMER_GROUPS'): ?>
|
| 26 |
+
<div class="grouping">
|
| 27 |
+
<strong><?php echo $group['name']; ?></strong>
|
| 28 |
+
<?php echo $this->renderGroup($group, $generalList); ?>
|
| 29 |
+
</div>
|
| 30 |
+
<?php endif; ?>
|
| 31 |
+
<?php endforeach; ?>
|
| 32 |
+
</div>
|
| 33 |
+
|
| 34 |
+
<?php endif; ?>
|
| 35 |
+
</li>
|
| 36 |
+
<!-- General Subscription -->
|
| 37 |
+
<?php endif; ?>
|
| 38 |
+
|
| 39 |
+
<!-- Additional Lists -->
|
| 40 |
+
<?php
|
| 41 |
+
foreach($lists as $list):
|
| 42 |
+
|
| 43 |
+
if($this->notInMyAccount() && in_array($list['id'], $myLists)){
|
| 44 |
+
continue;
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
$igroups = $list['interest_groupings'];
|
| 48 |
+
?>
|
| 49 |
+
|
| 50 |
+
<li class="listdata"><?php echo $this->listLabel($list); ?>
|
| 51 |
+
<?php if(is_array($igroups)): ?>
|
| 52 |
+
<div id="interest_groupings_<?php echo $list['id']; ?>" class="interest-groupings">
|
| 53 |
+
<?php foreach($igroups as $group): ?>
|
| 54 |
+
<?php if($group['name'] != 'MAGE_CUSTOMER_GROUPS'): ?>
|
| 55 |
+
<div class="grouping">
|
| 56 |
+
<strong><?php echo $group['name']; ?></strong>
|
| 57 |
+
<?php echo $this->renderGroup($group, $list); ?>
|
| 58 |
+
</div>
|
| 59 |
+
<?php endif; ?>
|
| 60 |
+
<?php endforeach; ?>
|
| 61 |
+
</div>
|
| 62 |
+
|
| 63 |
+
<?php endif; ?>
|
| 64 |
+
</li>
|
| 65 |
+
|
| 66 |
+
<?php endforeach; ?>
|
| 67 |
+
<!-- Additional Lists -->
|
| 68 |
+
|
| 69 |
+
</ul>
|
| 70 |
+
|
| 71 |
+
<?php if(!$this->helper('customer')->isLoggedIn() && $canShowButton):
|
| 72 |
+
$emailTile = $this->__('Enter your email address');
|
| 73 |
+
?>
|
| 74 |
+
<input onclick="this.value=='<?php echo $emailTile; ?>'?this.value='':''" onblur="this.value==''?this.value='<?php echo $emailTile; ?>':''" type="text" name="monkey_email" id="monkey-email" value="<?php echo $emailTile; ?>" />
|
| 75 |
+
<?php endif; ?>
|
| 76 |
+
</div>
|
| 77 |
+
|
| 78 |
+
<input type="hidden" name="state" value="" id="form-state" />
|
| 79 |
+
|
| 80 |
+
<?php if($canShowButton): ?>
|
| 81 |
+
<div class="buttons-set">
|
| 82 |
+
<button type="submit" title="<?php echo $this->__('Save') ?>" class="button"><span><span><?php echo $this->__('Save') ?></span></span></button>
|
| 83 |
+
</div>
|
| 84 |
+
<?php endif; ?>
|
| 85 |
+
<?php if($canShowButton): ?></form><?php endif; ?>
|
| 86 |
+
</div>
|
| 87 |
+
<script type="text/javascript">
|
| 88 |
+
document.observe("dom:loaded", function() {
|
| 89 |
+
|
| 90 |
+
removeManageNewsletter();
|
| 91 |
+
|
| 92 |
+
//Handle newsletter subscribe/unsubscribe checkbox events
|
| 93 |
+
$$('input.monkey-list-subscriber').each(function(chk){
|
| 94 |
+
|
| 95 |
+
if( !chk.checked ){
|
| 96 |
+
var groupings = $('interest_groupings_'+chk.value);
|
| 97 |
+
if(groupings){
|
| 98 |
+
groupings.select('select', 'input').invoke('writeAttribute', 'disabled', 'disabled');
|
| 99 |
+
}
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
chk.observe('change', function(){
|
| 103 |
+
|
| 104 |
+
var groupings = $('interest_groupings_'+this.value);
|
| 105 |
+
if(groupings){
|
| 106 |
+
var elements = groupings.select('select', 'input');
|
| 107 |
+
if(this.checked){
|
| 108 |
+
elements.invoke('removeAttribute', 'disabled');
|
| 109 |
+
}else{
|
| 110 |
+
elements.invoke('writeAttribute', 'disabled', 'disabled');
|
| 111 |
+
}
|
| 112 |
+
}
|
| 113 |
+
|
| 114 |
+
});
|
| 115 |
+
});
|
| 116 |
+
|
| 117 |
+
//Load viewstate on hidden field for later process
|
| 118 |
+
$('form-state').writeAttribute('value', $('mailchimp-additional').serialize());
|
| 119 |
+
|
| 120 |
+
});
|
| 121 |
+
</script>
|
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<Ebizmarts_AbandonedCart>
|
| 5 |
+
<active>true</active>
|
| 6 |
+
<codePool>community</codePool>
|
| 7 |
+
</Ebizmarts_AbandonedCart>
|
| 8 |
+
</modules>
|
| 9 |
+
</config>
|
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<Ebizmarts_Autoresponder>
|
| 5 |
+
<active>true</active>
|
| 6 |
+
<codePool>community</codePool>
|
| 7 |
+
</Ebizmarts_Autoresponder>
|
| 8 |
+
</modules>
|
| 9 |
+
</config>
|
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<Ebizmarts_MageMonkey>
|
| 5 |
+
<active>true</active>
|
| 6 |
+
<codePool>community</codePool>
|
| 7 |
+
<depends>
|
| 8 |
+
<Mage_Newsletter />
|
| 9 |
+
</depends>
|
| 10 |
+
</Ebizmarts_MageMonkey>
|
| 11 |
+
</modules>
|
| 12 |
+
</config>
|
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<Ebizmarts_Mandrill>
|
| 5 |
+
<active>true</active>
|
| 6 |
+
<codePool>community</codePool>
|
| 7 |
+
<depends>
|
| 8 |
+
<Mage_Core />
|
| 9 |
+
</depends>
|
| 10 |
+
</Ebizmarts_Mandrill>
|
| 11 |
+
</modules>
|
| 12 |
+
</config>
|
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
;Config settings
|
| 2 |
+
"Enabled","Enabled"
|
| 3 |
+
"Sender","Sender"
|
| 4 |
+
"Email Template","Email Template"
|
| 5 |
+
"Email Template With Coupon","Email Template With Coupon"
|
| 6 |
+
"Send email after","Send email after"
|
| 7 |
+
"Max number of email to send","Max number of email to send"
|
| 8 |
+
"Create Coupon?","Create Coupon?"
|
| 9 |
+
"On email number?","On email number?"
|
| 10 |
+
"Expire on","Expire on"
|
| 11 |
+
"Coupon length","Coupon length"
|
| 12 |
+
"Discount type","Discount type"
|
| 13 |
+
"Discount amount","Discount amount"
|
| 14 |
+
"Label for coupon","Label for coupon"
|
| 15 |
+
"Days","Days"
|
| 16 |
+
"Max","Max",
|
| 17 |
+
"The coupon will be created on the email number","The coupon will be created on the email number"
|
| 18 |
+
"The coupon expiration in days","The coupon expiration in days"
|
| 19 |
+
"Select percentage or fixed discount","Select percentage or fixed discount"
|
| 20 |
+
;Config values
|
| 21 |
+
"Fixed amount","Fixed amount"
|
| 22 |
+
"Percentage","Percentage"
|
| 23 |
+
|
| 24 |
+
;Dashboard
|
| 25 |
+
"Lifetime Generate Revenue","Lifetime Generate Revenue"
|
| 26 |
+
"Average Orders","Average Orders"
|
| 27 |
+
"Generated","Generated"
|
| 28 |
+
"Generated Revenue","Generated Revenue"
|
| 29 |
+
"Generated Tax","Generated Tax"
|
| 30 |
+
"Generated Shipping","Generated Shipping"
|
| 31 |
+
"Generated Orders","Generated Orders"
|
| 32 |
+
"Generated Conv. Rate","Generated Conv. Rate"
|
| 33 |
+
"Emails","Emails"
|
| 34 |
+
"Emails Sent","Emails Sent"
|
| 35 |
+
"Emails Received","Emails Received"
|
| 36 |
+
"Emails Opened","Emails Opened"
|
| 37 |
+
"Emails Clicked","Emails Clicked"
|
| 38 |
+
"Abandoned Cart Dashboard (Ebizmarts)","Abandoned Cart Dashboard (Ebizmarts)"
|
| 39 |
+
"You may obtain more statistics if enable and configure","You may obtain more statistics if enable and configure"
|
| 40 |
+
"extension","extension"
|
| 41 |
+
|
| 42 |
+
;Menus
|
| 43 |
+
"Abandoned Cart Dashboard","Abandoned Cart Dashboard"
|
| 44 |
+
"Abandoned Cart Orders","Abandoned Cart Orders"
|
| 45 |
+
"Ebizmarts Abandoned Cart","Ebizmarts Abandoned Cart"
|
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
;Config settings
|
| 2 |
+
"MageMonkey - MailChimp integration by ebizmarts", "MageMonkey - MailChimp integration by ebizmarts"
|
| 3 |
+
"Get a free MailChimp account now","Get a free MailChimp account now"
|
| 4 |
+
"Enabled","Enabled"
|
| 5 |
+
"API Key","API Key"
|
| 6 |
+
"General Subscription","General Subscription"
|
| 7 |
+
"Your MailChimp API Key.<br/><a target ='_blank' href ='http://kb.mailchimp.com/article/where-can-i-find-my-api-key/'>Where can I find my API Key?</a>","Your MailChimp API Key.<br/><a target ='_blank' href ='http://kb.mailchimp.com/article/where-can-i-find-my-api-key/'>Where can I find my API Key?</a>"
|
| 8 |
+
"Trial mode: Whether the Account is in Trial mode (can only send campaigns to less than 100 emails).<br/><a target='_blank' href='http://mailchimp.com/pricing/'>More about MailChimp plans.</a>", "Trial mode: Whether the Account is in Trial mode (can only send campaigns to less than 100 emails).<br/><a target='_blank' href='http://mailchimp.com/pricing/'>More about MailChimp plans.</a>"
|
| 9 |
+
"Synchronize Magento's General Subscription List with this MailChimp list","Synchronize Magento's General Subscription List with this MailChimp list"
|
| 10 |
+
"All selected lists will be available to customers as additionals lists","All selected lists will be available to customers as additionals lists"
|
| 11 |
+
"Additional Lists","Additional Lists"
|
| 12 |
+
"Double opt-in","Double opt-in"
|
| 13 |
+
"<b>IMPORTANT</b>: Should be set to <b>Yes</b>. Abusing this may cause your account to be suspended.<br/><a target='_blank' href='http://kb.mailchimp.com/article/how-does-confirmed-optin-or-double-optin-work/'>How does double opt-in work?</a>","<b>IMPORTANT</b>: Should be set to <b>Yes</b>. Abusing this may cause your account to be suspended.<br/><a target='_blank' href='http://kb.mailchimp.com/article/how-does-confirmed-optin-or-double-optin-work/'>How does double opt-in work?</a>"
|
| 14 |
+
"Enable Ecommerce360 for", "Enable Ecommerce360 for"
|
| 15 |
+
"Send new orders to MailChimp using Ecommerce360.<br/><a target='_blank' href='http://kb.mailchimp.com/article/how-do-i-turn-on-ecommerce360-tracking-on-my-campaigns/'>How do I turn on Ecommerce360 tracking on my campaigns?</a>", "Send new orders to MailChimp using Ecommerce360.<br/><a target='_blank' href='http://kb.mailchimp.com/article/how-do-i-turn-on-ecommerce360-tracking-on-my-campaigns/'>How do I turn on Ecommerce360 tracking on my campaigns?</a>"
|
| 16 |
+
"Customer Fields Mapping", "Customer Fields Mapping"
|
| 17 |
+
"<a target=\"_blank\" href=\"http://kb.mailchimp.com/article/all-the-merge-tags-cheatsheet\">All The Merge Tags (Cheatsheet)</a>","<a target=\"_blank\" href=\"http://kb.mailchimp.com/article/all-the-merge-tags-cheatsheet\">All The Merge Tags (Cheatsheet)</a>"
|
| 18 |
+
"First Name for Guests subscribers", "First Name for Guests subscribers"
|
| 19 |
+
"This value will be sent as FNAME to MailChimp", "This value will be sent as FNAME to MailChimp"
|
| 20 |
+
"Last Name for Guests subscribers", "Last Name for Guests subscribers"
|
| 21 |
+
"This value will be sent as LNAME to MailChimp", "This value will be sent as LNAME to MailChimp"
|
| 22 |
+
|
| 23 |
+
;Notification messages
|
| 24 |
+
"MailChimp Cleaned Emails: %s %s at %s reason: %s","MailChimp Cleaned Emails: %s %s at %s reason: %s"
|
| 25 |
+
"MailChimp Campaign Send: %s %s at %s","MailChimp Campaign Send: %s %s at %s"
|
| 26 |
+
"Confirmation request has been sent.","Confirmation request has been sent."
|
| 27 |
+
|
| 28 |
+
;Additional translations
|
| 29 |
+
"members", "members"
|
| 30 |
+
"Customer", "Customer"
|
| 31 |
+
"MailChimp", "MailChimp"
|
| 32 |
+
"Add field", "Add field"
|
| 33 |
+
"Username:", "Username:"
|
| 34 |
+
"Plan type:", "Plan type:"
|
| 35 |
+
"Is in trial mode?:", "Is in trial mode?:"
|
| 36 |
+
"Enabled - Checked by default", "Enabled - Checked by default"
|
| 37 |
+
"Enabled - Not Checked by default", "Enabled - Not Checked by default"
|
| 38 |
+
"Enabled - Force subscription", "Enabled - Force subscription"
|
| 39 |
+
"-- Disabled --", "-- Disabled --"
|
| 40 |
+
"Could not add Webhook "%s" for list "%s", error code %s, %s","Could not add Webhook "%s" for list "%s", error code %s, %s"
|
| 41 |
+
"There is no List selected please save the configuration again","There is no List selected please save the configuration again"
|
|
@@ -0,0 +1 @@
|
|
|
|
| 1 |
+
"Mandrill","Mandrill"
|
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
|
| 2 |
+
<div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
|
| 3 |
+
<table cellspacing="0" cellpadding="0" border="0" width="100%">
|
| 4 |
+
<tr>
|
| 5 |
+
<td align="center" valign="top" style="padding:20px 0 20px 0">
|
| 6 |
+
<table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
|
| 7 |
+
<!-- [ header starts here] -->
|
| 8 |
+
<tr>
|
| 9 |
+
<td valign="top"><a href="{{store url=""}}"><img src="{{skin url="images/logo_email.gif" _area='frontend'}}" alt="{{var store.getFrontendName()}}" style="margin-bottom:10px;" border="0"/></a></td>
|
| 10 |
+
</tr>
|
| 11 |
+
<!-- [ middle starts here] -->
|
| 12 |
+
<tr>
|
| 13 |
+
<td valign="top">
|
| 14 |
+
<h1 style="font-size:22px; font-weight:normal; line-height:22px; margin:0 0 11px 0;"">Hello, {{htmlescape var=$name}}</h1>
|
| 15 |
+
<p style="font-size:12px; line-height:16px; margin:0;">
|
| 16 |
+
|
| 17 |
+
On behalf of {{var store.getFrontendName()}}, we wish a happy birthday.
|
| 18 |
+
{{depend couponcode}}
|
| 19 |
+
<br>We have the pleasure of giving a coupon with code <b>{{var couponcode}}</b>
|
| 20 |
+
{{/depend}}
|
| 21 |
+
{{depend discount}}
|
| 22 |
+
and obtain a discount of {{var discount}} only until {{var todate}}
|
| 23 |
+
{{/depend}}
|
| 24 |
+
</p>
|
| 25 |
+
</tr>
|
| 26 |
+
<tr>
|
| 27 |
+
<td bgcolor="#EAEAEA" align="center" style="background:#EAEAEA; text-align:center;"><center><p style="font-size:12px; margin:0;">Thank you, <strong>{{var store.getFrontendName()}}</strong></p></center></td>
|
| 28 |
+
</tr>
|
| 29 |
+
<tr>
|
| 30 |
+
<td>You can unsubscribe from this email clicking <a href="{{var url}}" style="color:#1E7EC8;">here</a>.</td>
|
| 31 |
+
</tr>
|
| 32 |
+
</table>
|
| 33 |
+
</td>
|
| 34 |
+
</tr>
|
| 35 |
+
</table>
|
| 36 |
+
</div>
|
| 37 |
+
</body>
|
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
|
| 2 |
+
<div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
|
| 3 |
+
<table cellspacing="0" cellpadding="0" border="0" width="100%">
|
| 4 |
+
<tr>
|
| 5 |
+
<td align="center" valign="top" style="padding:20px 0 20px 0">
|
| 6 |
+
<table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
|
| 7 |
+
<!-- [ header starts here] -->
|
| 8 |
+
<tr>
|
| 9 |
+
<td valign="top"><a href="{{store url=""}}"><img src="{{skin url="images/logo_email.gif" _area='frontend'}}" alt="{{var store.getFrontendName()}}" style="margin-bottom:10px;" border="0"/></a></td>
|
| 10 |
+
</tr>
|
| 11 |
+
<!-- [ middle starts here] -->
|
| 12 |
+
<tr>
|
| 13 |
+
<td valign="top">
|
| 14 |
+
<h1 style="font-size:22px; font-weight:normal; line-height:22px; margin:0 0 11px 0;"">Hello, {{htmlescape var=$name}}</h1>
|
| 15 |
+
<p style="font-size:12px; line-height:16px; margin:0;">
|
| 16 |
+
|
| 17 |
+
On behalf of {{var store.getFrontendName()}}, I'd like to personally thank you for your business.
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
<br>If you have any questions about your order please contact us at <a href="mailto:{{config path='trans_email/ident_support/email'}}" style="color:#1E7EC8;">{{config path='trans_email/ident_support/email'}}</a> or call us at <span class="nobr">{{config path='general/store_information/phone'}}</span> Monday - Friday, 8am - 5pm PST.
|
| 21 |
+
|
| 22 |
+
Thanks again,
|
| 23 |
+
</p>
|
| 24 |
+
</tr>
|
| 25 |
+
<tr>
|
| 26 |
+
<td bgcolor="#EAEAEA" align="center" style="background:#EAEAEA; text-align:center;"><center><p style="font-size:12px; margin:0;">Thank you, <strong>{{var store.getFrontendName()}}</strong></p></center></td>
|
| 27 |
+
</tr>
|
| 28 |
+
<tr>
|
| 29 |
+
<td>You can unsubscribe from this email clicking <a href="{{var url}}" style="color:#1E7EC8;">here</a>.</td>
|
| 30 |
+
</tr>
|
| 31 |
+
</table>
|
| 32 |
+
</td>
|
| 33 |
+
</tr>
|
| 34 |
+
</table>
|
| 35 |
+
</div>
|
| 36 |
+
</body>
|
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
|
| 2 |
+
<div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
|
| 3 |
+
<table cellspacing="0" cellpadding="0" border="0" width="100%">
|
| 4 |
+
<tr>
|
| 5 |
+
<td align="center" valign="top" style="padding:20px 0 20px 0">
|
| 6 |
+
<table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
|
| 7 |
+
<!-- [ header starts here] -->
|
| 8 |
+
<tr>
|
| 9 |
+
<td valign="top"><a href="{{store url=""}}"><img src="{{skin url="images/logo_email.gif" _area='frontend'}}" alt="{{var store.getFrontendName()}}" style="margin-bottom:10px;" border="0"/></a></td>
|
| 10 |
+
</tr>
|
| 11 |
+
<!-- [ middle starts here] -->
|
| 12 |
+
<tr>
|
| 13 |
+
<td valign="top">
|
| 14 |
+
<h1 style="font-size:22px; font-weight:normal; line-height:22px; margin:0 0 11px 0;"">Hello, {{htmlescape var=$name}}</h1>
|
| 15 |
+
<p style="font-size:12px; line-height:16px; margin:0;">
|
| 16 |
+
Our system detect you have no activity since {{var lastlogin}}
|
| 17 |
+
We have a lot of opportunities for you
|
| 18 |
+
|
| 19 |
+
<br>If you have any questions please contact us at <a href="mailto:{{config path='trans_email/ident_support/email'}}" style="color:#1E7EC8;">{{config path='trans_email/ident_support/email'}}</a> or call us at <span class="nobr">{{config path='general/store_information/phone'}}</span> Monday - Friday, 8am - 5pm PST.
|
| 20 |
+
</p>
|
| 21 |
+
</tr>
|
| 22 |
+
<tr>
|
| 23 |
+
<td bgcolor="#EAEAEA" align="center" style="background:#EAEAEA; text-align:center;"><center><p style="font-size:12px; margin:0;">Thank you, <strong>{{var store.getFrontendName()}}</strong></p></center></td>
|
| 24 |
+
</tr>
|
| 25 |
+
<tr>
|
| 26 |
+
<td>You can unsubscribe from this email clicking <a href="{{var url}}" style="color:#1E7EC8;">here</a>.</td>
|
| 27 |
+
</tr>
|
| 28 |
+
</table>
|
| 29 |
+
</td>
|
| 30 |
+
</tr>
|
| 31 |
+
</table>
|
| 32 |
+
</div>
|
| 33 |
+
</body>
|
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
|
| 2 |
+
<div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
|
| 3 |
+
<table cellspacing="0" cellpadding="0" border="0" width="100%">
|
| 4 |
+
<tr>
|
| 5 |
+
<td align="center" valign="top" style="padding:20px 0 20px 0">
|
| 6 |
+
<table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
|
| 7 |
+
<!-- [ header starts here] -->
|
| 8 |
+
<tr>
|
| 9 |
+
<td valign="top"><a href="{{store url=""}}"><img src="{{skin url="images/logo_email.gif" _area='frontend'}}" alt="{{var store.getFrontendName()}}" style="margin-bottom:10px;" border="0"/></a></td>
|
| 10 |
+
</tr>
|
| 11 |
+
<!-- [ middle starts here] -->
|
| 12 |
+
<tr>
|
| 13 |
+
<td valign="top">
|
| 14 |
+
<h1 style="font-size:22px; font-weight:normal; line-height:22px; margin:0 0 11px 0;">Hello, {{htmlescape var=$name}}</h1>
|
| 15 |
+
<p style="font-size:12px; line-height:16px; margin:0;">
|
| 16 |
+
You may like to know about the following products
|
| 17 |
+
</p>
|
| 18 |
+
</td>
|
| 19 |
+
</tr>
|
| 20 |
+
<tr>
|
| 21 |
+
<td>
|
| 22 |
+
{{block type='ebizmarts_autoresponder/email_related_items' area='frontend' template='ebizmarts/autoresponder/related/items.phtml' products=$related}}
|
| 23 |
+
</td>
|
| 24 |
+
</tr>
|
| 25 |
+
<tr>
|
| 26 |
+
<td bgcolor="#EAEAEA" align="center" style="background:#EAEAEA; text-align:center;"><center><p style="font-size:12px; margin:0;">Thank you, <strong>{{var store.getFrontendName()}}</strong></p></center></td>
|
| 27 |
+
</tr>
|
| 28 |
+
<tr>
|
| 29 |
+
<td>You can unsubscribe from this email clicking <a href="{{var url}}" style="color:#1E7EC8;">here</a>.</td>
|
| 30 |
+
</tr>
|
| 31 |
+
</table>
|
| 32 |
+
</td>
|
| 33 |
+
</tr>
|
| 34 |
+
</table>
|
| 35 |
+
</div>
|
| 36 |
+
</body>
|
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
|
| 2 |
+
<div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
|
| 3 |
+
<table cellspacing="0" cellpadding="0" border="0" width="100%">
|
| 4 |
+
<tr>
|
| 5 |
+
<td align="center" valign="top" style="padding:20px 0 20px 0">
|
| 6 |
+
<table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
|
| 7 |
+
<!-- [ header starts here] -->
|
| 8 |
+
<tr>
|
| 9 |
+
<td valign="top"><a href="{{store url=""}}"><img src="{{skin url="images/logo_email.gif" _area='frontend'}}" alt="{{var store.getFrontendName()}}" style="margin-bottom:10px;" border="0"/></a></td>
|
| 10 |
+
</tr>
|
| 11 |
+
<!-- [ middle starts here] -->
|
| 12 |
+
<tr>
|
| 13 |
+
<td valign="top">
|
| 14 |
+
<h1 style="font-size:22px; font-weight:normal; line-height:22px; margin:0 0 11px 0;">Hello, {{htmlescape var=$name}}</h1>
|
| 15 |
+
<p style="font-size:12px; line-height:16px; margin:0;">
|
| 16 |
+
We appreciate you taking the time to review your purchased products with order {{var ordernum}} and look forward to doing business again with your very soon
|
| 17 |
+
</p>
|
| 18 |
+
</td>
|
| 19 |
+
</tr>
|
| 20 |
+
<tr>
|
| 21 |
+
<td>
|
| 22 |
+
{{block type='ebizmarts_autoresponder/email_review_items' area='frontend' template='ebizmarts/autoresponder/review/items.phtml' products=$products}}
|
| 23 |
+
</td>
|
| 24 |
+
</tr>
|
| 25 |
+
<tr>
|
| 26 |
+
<td bgcolor="#EAEAEA" align="center" style="background:#EAEAEA; text-align:center;"><center><p style="font-size:12px; margin:0;">Thank you, <strong>{{var store.getFrontendName()}}</strong></p></center></td>
|
| 27 |
+
</tr>
|
| 28 |
+
<tr>
|
| 29 |
+
<td>You can unsubscribe from this email clicking <a href="{{var url}}" style="color:#1E7EC8;">here</a>.</td>
|
| 30 |
+
</tr>
|
| 31 |
+
|
| 32 |
+
</table>
|
| 33 |
+
</td>
|
| 34 |
+
</tr>
|
| 35 |
+
</table>
|
| 36 |
+
</div>
|
| 37 |
+
</body>
|
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
|
| 2 |
+
<div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
|
| 3 |
+
<table cellspacing="0" cellpadding="0" border="0" width="100%">
|
| 4 |
+
<tr>
|
| 5 |
+
<td align="center" valign="top" style="padding:20px 0 20px 0">
|
| 6 |
+
<table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
|
| 7 |
+
<!-- [ header starts here] -->
|
| 8 |
+
<tr>
|
| 9 |
+
<td valign="top"><a href="{{store url=""}}"><img src="{{skin url="images/logo_email.gif" _area='frontend'}}" alt="{{var store.getFrontendName()}}" style="margin-bottom:10px;" border="0"/></a></td>
|
| 10 |
+
</tr>
|
| 11 |
+
<!-- [ middle starts here] -->
|
| 12 |
+
<tr>
|
| 13 |
+
<td valign="top">
|
| 14 |
+
<h1 style="font-size:22px; font-weight:normal; line-height:22px; margin:0 0 11px 0;"">Hello, {{htmlescape var=$name}}</h1>
|
| 15 |
+
<p style="font-size:12px; line-height:16px; margin:0;">
|
| 16 |
+
Thanks for adding new products to your wishlist.
|
| 17 |
+
<tr>
|
| 18 |
+
<td>
|
| 19 |
+
{{block type='ebizmarts_autoresponder/email_wishlist_items' area='frontend' template='ebizmarts/autoresponder/wishlist/items.phtml' products=$products}}
|
| 20 |
+
</td>
|
| 21 |
+
</tr>
|
| 22 |
+
|
| 23 |
+
<br>If you have any questions please contact us at <a href="mailto:{{config path='trans_email/ident_support/email'}}" style="color:#1E7EC8;">{{config path='trans_email/ident_support/email'}}</a> or call us at <span class="nobr">{{config path='general/store_information/phone'}}</span> Monday - Friday, 8am - 5pm PST.
|
| 24 |
+
</p>
|
| 25 |
+
</tr>
|
| 26 |
+
<tr>
|
| 27 |
+
<td bgcolor="#EAEAEA" align="center" style="background:#EAEAEA; text-align:center;"><center><p style="font-size:12px; margin:0;">Thank you, <strong>{{var store.getFrontendName()}}</strong></p></center></td>
|
| 28 |
+
</tr>
|
| 29 |
+
<tr>
|
| 30 |
+
<td>You can unsubscribe from this email clicking <a href="{{var url}}" style="color:#1E7EC8;">here</a>.</td>
|
| 31 |
+
</tr>
|
| 32 |
+
</table>
|
| 33 |
+
</td>
|
| 34 |
+
</tr>
|
| 35 |
+
</table>
|
| 36 |
+
</div>
|
| 37 |
+
</body>
|
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
|
| 2 |
+
<div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
|
| 3 |
+
<table cellspacing="0" cellpadding="0" border="0" width="100%">
|
| 4 |
+
<tr>
|
| 5 |
+
<td align="center" valign="top" style="padding:20px 0 20px 0">
|
| 6 |
+
<table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
|
| 7 |
+
<!-- [ header starts here] -->
|
| 8 |
+
<tr>
|
| 9 |
+
<td valign="top"><a href="{{store url=""}}"><img src="{{skin url="images/logo_email.gif" _area='frontend'}}" alt="{{var store.getFrontendName()}}" style="margin-bottom:10px;" border="0"/></a></td>
|
| 10 |
+
</tr>
|
| 11 |
+
<!-- [ middle starts here] -->
|
| 12 |
+
<tr>
|
| 13 |
+
<td valign="top">
|
| 14 |
+
<h1 style="font-size:22px; font-weight:normal; line-height:22px; margin:0 0 11px 0;"">Hello, {{htmlescape var=$name}}</h1>
|
| 15 |
+
<p style="font-size:12px; line-height:16px; margin:0;">
|
| 16 |
+
You have an abandoned cart at {{var store.getFrontendName()}}.
|
| 17 |
+
You can access your cart <a href="{{var url}}" style="color:#1E7EC8;">here</a>.
|
| 18 |
+
{{depend couponcode}}
|
| 19 |
+
<br>You can use this coupon code <b>{{var couponcode}}</b>
|
| 20 |
+
{{/depend}}
|
| 21 |
+
{{depend discount}}
|
| 22 |
+
and obtain a discount of {{var discount}} only until {{var todate}}
|
| 23 |
+
{{/depend}}
|
| 24 |
+
<br>If you have any questions about your order please contact us at <a href="mailto:{{config path='trans_email/ident_support/email'}}" style="color:#1E7EC8;">{{config path='trans_email/ident_support/email'}}</a> or call us at <span class="nobr">{{config path='general/store_information/phone'}}</span> Monday - Friday, 8am - 5pm PST.
|
| 25 |
+
</p>
|
| 26 |
+
</tr>
|
| 27 |
+
<tr>
|
| 28 |
+
<td>
|
| 29 |
+
{{block type='ebizmarts_abandonedcart/email_order_items' area='frontend' template='ebizmarts_abandonedcart/email/order/items.phtml' quote=$quote}}
|
| 30 |
+
</td>
|
| 31 |
+
</tr>
|
| 32 |
+
<tr>
|
| 33 |
+
<td bgcolor="#EAEAEA" align="center" style="background:#EAEAEA; text-align:center;"><center><p style="font-size:12px; margin:0;">Thank you, <strong>{{var store.getFrontendName()}}</strong></p></center></td>
|
| 34 |
+
</tr>
|
| 35 |
+
<tr>
|
| 36 |
+
<td>You can unsubscribe from this email clicking <a href="{{var unsubscribeurl}}" style="color:#1E7EC8;">here</a>.</td>
|
| 37 |
+
</tr>
|
| 38 |
+
</table>
|
| 39 |
+
</td>
|
| 40 |
+
</tr>
|
| 41 |
+
</table>
|
| 42 |
+
</div>
|
| 43 |
+
</body>
|
|
@@ -0,0 +1,367 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* MailChimp MANDRILL API wrapper
|
| 5 |
+
*
|
| 6 |
+
* @category Ebizmarts
|
| 7 |
+
* @package Ebizmarts_Mandrill
|
| 8 |
+
* @author Ebizmarts Team <info@ebizmarts.com>
|
| 9 |
+
*/
|
| 10 |
+
class Mandrill_API {
|
| 11 |
+
|
| 12 |
+
/**
|
| 13 |
+
* API version number
|
| 14 |
+
*
|
| 15 |
+
* @var string
|
| 16 |
+
*/
|
| 17 |
+
public $version = '1.0';
|
| 18 |
+
|
| 19 |
+
/**
|
| 20 |
+
* Error Message storage
|
| 21 |
+
*
|
| 22 |
+
* @var string
|
| 23 |
+
*/
|
| 24 |
+
public $errorMessage;
|
| 25 |
+
|
| 26 |
+
/**
|
| 27 |
+
* Error Code storage
|
| 28 |
+
*
|
| 29 |
+
* @var integer
|
| 30 |
+
*/
|
| 31 |
+
public $errorCode;
|
| 32 |
+
|
| 33 |
+
/**
|
| 34 |
+
* Cache the user api_key so we only have to log in once per client instantiation
|
| 35 |
+
*
|
| 36 |
+
* @var string MailChimp API key
|
| 37 |
+
*/
|
| 38 |
+
public $api_key;
|
| 39 |
+
|
| 40 |
+
/**
|
| 41 |
+
* STS API URL
|
| 42 |
+
*
|
| 43 |
+
* @var string
|
| 44 |
+
*/
|
| 45 |
+
public $apiUrl;
|
| 46 |
+
|
| 47 |
+
/**
|
| 48 |
+
* Request output format
|
| 49 |
+
*
|
| 50 |
+
* @var string
|
| 51 |
+
*/
|
| 52 |
+
protected $_output = 'json';
|
| 53 |
+
|
| 54 |
+
protected $_attachments = array();
|
| 55 |
+
|
| 56 |
+
/**
|
| 57 |
+
* Setup data
|
| 58 |
+
*
|
| 59 |
+
* @param string $apikey Your MailChimp apikey
|
| 60 |
+
* @param string $secure Whether or not this should use a secure connection
|
| 61 |
+
*/
|
| 62 |
+
function __construct($apikey = null) {
|
| 63 |
+
if($apikey){
|
| 64 |
+
$this->setApiKey($apikey);
|
| 65 |
+
}
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
/**
|
| 69 |
+
* Api key setter
|
| 70 |
+
*
|
| 71 |
+
* @param string $key API Key
|
| 72 |
+
* @return Ebizmarts_MageMonkey_Model_TransactionalEmail_MANDRILL
|
| 73 |
+
*/
|
| 74 |
+
public function setApiKey($key) {
|
| 75 |
+
$this->api_key = $key;
|
| 76 |
+
|
| 77 |
+
$this->apiUrl = "http://mandrillapp.com/api/{$this->version}/";
|
| 78 |
+
|
| 79 |
+
return $this;
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
/**
|
| 83 |
+
* ===== Users 유 Calls =====
|
| 84 |
+
*/
|
| 85 |
+
|
| 86 |
+
/**
|
| 87 |
+
* Validate an API key and respond to a ping
|
| 88 |
+
*
|
| 89 |
+
*/
|
| 90 |
+
public function usersPing() {
|
| 91 |
+
return $this->_callServer("users/ping");
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
/**
|
| 95 |
+
* Return the information about the API-connected user
|
| 96 |
+
*
|
| 97 |
+
*/
|
| 98 |
+
public function usersInfo() {
|
| 99 |
+
return $this->_callServer("users/info");
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
/**
|
| 103 |
+
* Return the senders that have tried to use this account, both verified and unverified
|
| 104 |
+
*
|
| 105 |
+
*/
|
| 106 |
+
public function usersSenders() {
|
| 107 |
+
return $this->_callServer("users/senders");
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
/**
|
| 111 |
+
* Disable a sender from being able to send
|
| 112 |
+
*
|
| 113 |
+
* @param string $email
|
| 114 |
+
*/
|
| 115 |
+
public function usersDisableSender($email) {
|
| 116 |
+
$params = array();
|
| 117 |
+
$params["email"] = $email;
|
| 118 |
+
|
| 119 |
+
return $this->_callServer("users/disable-sender", $params);
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
/**
|
| 123 |
+
* Send an email to the given address to verify that it is an accepted sender for your Mandrill account.
|
| 124 |
+
*
|
| 125 |
+
* @param string $email
|
| 126 |
+
*/
|
| 127 |
+
public function usersVerifySender($email) {
|
| 128 |
+
$params = array();
|
| 129 |
+
$params["email"] = $email;
|
| 130 |
+
|
| 131 |
+
return $this->_callServer("users/verify-sender", $params);
|
| 132 |
+
}
|
| 133 |
+
|
| 134 |
+
public function verifyEmailAddress($email) {
|
| 135 |
+
return $this->usersVerifySender($email);
|
| 136 |
+
}
|
| 137 |
+
|
| 138 |
+
/**
|
| 139 |
+
*
|
| 140 |
+
* ===== Users 유 Calls =====
|
| 141 |
+
*/
|
| 142 |
+
|
| 143 |
+
|
| 144 |
+
/**
|
| 145 |
+
* ===== Messages ✐ Calls =====
|
| 146 |
+
*/
|
| 147 |
+
|
| 148 |
+
/**
|
| 149 |
+
* Send a new transactional message through Mandrill
|
| 150 |
+
*
|
| 151 |
+
* @param array $message The message data with the following keys:
|
| 152 |
+
* string html the full HTML content to be sent
|
| 153 |
+
* string text optional full text content to be sent
|
| 154 |
+
* string subject the message subject
|
| 155 |
+
* string from_email the sender email address. If this address has not been verified, the message will be queued and not sent until it is verified
|
| 156 |
+
* string from_name optional from name to be used
|
| 157 |
+
* array to an array of email addresses to use as recipients. Each item in the array should be a struct with two keys - email: the email address of the recipient, and name: the optional display name to use for the recipient
|
| 158 |
+
* struct headers optional extra headers to add to the message (currently only Reply-To and X-* headers are allowed)
|
| 159 |
+
* boolean track_opens whether or not to turn on open tracking for the message
|
| 160 |
+
* boolean track_clicks whether or not to turn on click tracking for the message
|
| 161 |
+
* array tags an array of string to tag the message with. Stats are accumulated using tags, though we only store the first 100 we see, so this should not be unique or change frequently. Tags should be 50 characters or less. Any tags starting with an understore are reserved for internal use and will cause errors.
|
| 162 |
+
*/
|
| 163 |
+
public function messagesSend($message) {
|
| 164 |
+
$to = array();
|
| 165 |
+
|
| 166 |
+
foreach($message['to_email'] as $pos => $email){
|
| 167 |
+
$to []= array(
|
| 168 |
+
'email' => $email,
|
| 169 |
+
'name' => $message['to_name'][$pos]
|
| 170 |
+
);
|
| 171 |
+
}
|
| 172 |
+
if(count($this->_attachments)) {
|
| 173 |
+
$message['attachments'] = $this->_attachments;
|
| 174 |
+
}
|
| 175 |
+
$message['to'] = $to;
|
| 176 |
+
unset($message['to_email'], $message['to_name']);
|
| 177 |
+
|
| 178 |
+
$params = array();
|
| 179 |
+
$params["message"] = $message;
|
| 180 |
+
|
| 181 |
+
return $this->_callServer("messages/send", $params);
|
| 182 |
+
}
|
| 183 |
+
|
| 184 |
+
public function sendEmail($message) {
|
| 185 |
+
return $this->messagesSend($message);
|
| 186 |
+
}
|
| 187 |
+
|
| 188 |
+
/**
|
| 189 |
+
* ===== Messages ✐ Calls =====
|
| 190 |
+
*/
|
| 191 |
+
|
| 192 |
+
|
| 193 |
+
/**
|
| 194 |
+
* ===== Tags ✰ Calls =====
|
| 195 |
+
*/
|
| 196 |
+
|
| 197 |
+
/**
|
| 198 |
+
* Return all of the user-defined tag information
|
| 199 |
+
*
|
| 200 |
+
*/
|
| 201 |
+
public function tagsList() {
|
| 202 |
+
return $this->_callServer("tags/list");
|
| 203 |
+
}
|
| 204 |
+
|
| 205 |
+
/**
|
| 206 |
+
* Return the recent history (hourly stats for the last 30 days) for a tag
|
| 207 |
+
*
|
| 208 |
+
* @param string $tag
|
| 209 |
+
*/
|
| 210 |
+
public function tagsTimeSeries($tag) {
|
| 211 |
+
$params = array();
|
| 212 |
+
$params["tag"] = $tag;
|
| 213 |
+
|
| 214 |
+
return $this->_callServer("tags/time-series", $params);
|
| 215 |
+
}
|
| 216 |
+
|
| 217 |
+
/**
|
| 218 |
+
* Return the recent history (hourly stats for the last 30 days) for all tags
|
| 219 |
+
*
|
| 220 |
+
*/
|
| 221 |
+
public function tagsAllTimeSeries() {
|
| 222 |
+
return $this->_callServer("tags/all-time-series");
|
| 223 |
+
}
|
| 224 |
+
|
| 225 |
+
/**
|
| 226 |
+
* ===== Tags ✰ Calls =====
|
| 227 |
+
*/
|
| 228 |
+
|
| 229 |
+
|
| 230 |
+
/**
|
| 231 |
+
* ===== Urls ≎ Calls =====
|
| 232 |
+
*/
|
| 233 |
+
|
| 234 |
+
/**
|
| 235 |
+
* Get the 100 most clicked URLs
|
| 236 |
+
*
|
| 237 |
+
*/
|
| 238 |
+
public function urlsList() {
|
| 239 |
+
return $this->_callServer("urls/list");
|
| 240 |
+
}
|
| 241 |
+
|
| 242 |
+
/**
|
| 243 |
+
* Return the 100 most clicked URLs that match the search query given
|
| 244 |
+
*
|
| 245 |
+
* @param string $query
|
| 246 |
+
*/
|
| 247 |
+
public function urlsSearch($query) {
|
| 248 |
+
$params = array();
|
| 249 |
+
$params["q"] = $query;
|
| 250 |
+
|
| 251 |
+
return $this->_callServer("urls/search", $params);
|
| 252 |
+
}
|
| 253 |
+
|
| 254 |
+
/**
|
| 255 |
+
* Return the recent history (hourly stats for the last 30 days) for a url
|
| 256 |
+
*
|
| 257 |
+
* @param string $url
|
| 258 |
+
*/
|
| 259 |
+
public function urlsTimeSeries($url) {
|
| 260 |
+
$params = array();
|
| 261 |
+
$params["url"] = $url;
|
| 262 |
+
|
| 263 |
+
return $this->_callServer("urls/time-series", $params);
|
| 264 |
+
}
|
| 265 |
+
|
| 266 |
+
/**
|
| 267 |
+
* ===== Urls ≎ Calls =====
|
| 268 |
+
*/
|
| 269 |
+
|
| 270 |
+
|
| 271 |
+
/**
|
| 272 |
+
* Actually connect to the server and call the requested methods, parsing the result
|
| 273 |
+
*
|
| 274 |
+
* @param string $method
|
| 275 |
+
* @param array OPTIONAL $params
|
| 276 |
+
* @return object|false
|
| 277 |
+
*/
|
| 278 |
+
protected function _callServer($method, $params = array()) {
|
| 279 |
+
|
| 280 |
+
$this->errorMessage = null;
|
| 281 |
+
$this->errorCode = null;
|
| 282 |
+
|
| 283 |
+
$params['key'] = $this->api_key;
|
| 284 |
+
|
| 285 |
+
$url = $this->apiUrl . $method . '.' . $this->_output;
|
| 286 |
+
|
| 287 |
+
Mage::helper('mandrill')->log($url, 'MageMonkey_ApiCall.log');
|
| 288 |
+
Mage::helper('mandrill')->log($params, 'MageMonkey_ApiCall.log');
|
| 289 |
+
|
| 290 |
+
$curlSession = curl_init();
|
| 291 |
+
|
| 292 |
+
curl_setopt($curlSession, CURLOPT_USERAGENT, Mage::helper('mandrill')->getUserAgent());
|
| 293 |
+
curl_setopt($curlSession, CURLOPT_URL, $url);
|
| 294 |
+
curl_setopt($curlSession, CURLOPT_HEADER, 0);
|
| 295 |
+
curl_setopt($curlSession, CURLOPT_POST, TRUE);
|
| 296 |
+
curl_setopt($curlSession, CURLOPT_POSTFIELDS, http_build_query($params));
|
| 297 |
+
curl_setopt($curlSession, CURLOPT_RETURNTRANSFER, TRUE);
|
| 298 |
+
//curl_setopt($curlSession, CURLOPT_SSL_VERIFYPEER, FALSE);
|
| 299 |
+
//curl_setopt($curlSession, CURLOPT_SSL_VERIFYHOST, 1);
|
| 300 |
+
|
| 301 |
+
$result = curl_exec($curlSession);
|
| 302 |
+
if(!$result){
|
| 303 |
+
|
| 304 |
+
$errstr = curl_error($curlSession);
|
| 305 |
+
$errno = curl_errno($curlSession);
|
| 306 |
+
|
| 307 |
+
$this->errorMessage = "Could not connect (ERR $errno: $errstr)";
|
| 308 |
+
$this->errorCode = "-99";
|
| 309 |
+
return false;
|
| 310 |
+
}
|
| 311 |
+
|
| 312 |
+
// Check that a connection was made
|
| 313 |
+
if (curl_error($curlSession)) {
|
| 314 |
+
$this->errorMessage = curl_error($curlSession);
|
| 315 |
+
$this->errorCode = "-99";
|
| 316 |
+
return false;
|
| 317 |
+
}
|
| 318 |
+
|
| 319 |
+
$httpCode = curl_getinfo($curlSession, CURLINFO_HTTP_CODE);
|
| 320 |
+
|
| 321 |
+
curl_close($curlSession);
|
| 322 |
+
|
| 323 |
+
$resultObject = json_decode($result);
|
| 324 |
+
|
| 325 |
+
Mage::helper('mandrill')->log($resultObject, 'MageMonkey_ApiCall.log');
|
| 326 |
+
|
| 327 |
+
//You can consider any non-200 HTTP response code an error
|
| 328 |
+
//the returned data will contain more detailed information
|
| 329 |
+
if($httpCode != 200){
|
| 330 |
+
$this->errorMessage = $resultObject->message;
|
| 331 |
+
$this->errorCode = "-99";
|
| 332 |
+
return false;
|
| 333 |
+
}
|
| 334 |
+
|
| 335 |
+
return $resultObject;
|
| 336 |
+
|
| 337 |
+
}
|
| 338 |
+
|
| 339 |
+
public function tagsInfo($tag) {
|
| 340 |
+
$params = array();
|
| 341 |
+
$params["tag"] = $tag;
|
| 342 |
+
|
| 343 |
+
return $this->_callServer("tags/info", $params);
|
| 344 |
+
}
|
| 345 |
+
public function createAttachment($body,
|
| 346 |
+
$mimeType = Zend_Mime::TYPE_OCTETSTREAM,
|
| 347 |
+
$disposition = Zend_Mime::DISPOSITION_ATTACHMENT,
|
| 348 |
+
$encoding = Zend_Mime::ENCODING_BASE64,
|
| 349 |
+
$filename = null)
|
| 350 |
+
{
|
| 351 |
+
$att = array();
|
| 352 |
+
$att['type'] = $mimeType;
|
| 353 |
+
$att['name'] = $filename;
|
| 354 |
+
$att['content'] = base64_encode($body);
|
| 355 |
+
$this->_attachments[] = $att;
|
| 356 |
+
return $att;
|
| 357 |
+
}
|
| 358 |
+
public function addAttachment(Zend_Mime_Part $attachment)
|
| 359 |
+
{
|
| 360 |
+
$att = array();
|
| 361 |
+
$att['type'] = $attachment->type;
|
| 362 |
+
$att['name'] = $attachment->filename;
|
| 363 |
+
$this->_attachments[] = $att;
|
| 364 |
+
|
| 365 |
+
return $this;
|
| 366 |
+
}
|
| 367 |
+
}
|
|
@@ -0,0 +1,191 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<package>
|
| 3 |
+
<name>Ebizmarts_MageMonkey</name>
|
| 4 |
+
<version>1.1.16</version>
|
| 5 |
+
<stability>stable</stability>
|
| 6 |
+
<license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
| 7 |
+
<channel>community</channel>
|
| 8 |
+
<extends/>
|
| 9 |
+
<summary>MailChimp integration for Magento by Ebizmarts</summary>
|
| 10 |
+
<description>Full MailChimp integration, automatic webhooks, multiple lists, interest groups</description>
|
| 11 |
+
<notes>-- version 1.1.16 stable
|
| 12 |
+
- fix for abandoned cart when a logged customer abandon an order and make this order as guess
|
| 13 |
+
- introduce autologin feature for abandoned carts
|
| 14 |
+

|
| 15 |
+
-- version 1.1.15 stable
|
| 16 |
+
- fix for abandoned cart cron configuration
|
| 17 |
+

|
| 18 |
+
-- version 1.1.14 stable
|
| 19 |
+
- Add grid for sent email (autoresponder and abandoned carts)
|
| 20 |
+
- Minor fix for mandrill tags
|
| 21 |
+

|
| 22 |
+
-- version 1.1.13 stable
|
| 23 |
+
- Fix for mandrill tags
|
| 24 |
+
- Fix for autoresponders admin configuration
|
| 25 |
+

|
| 26 |
+
-- version 1.1.12 stable
|
| 27 |
+
- Fix for autoresponders
|
| 28 |
+

|
| 29 |
+
-- version 1.1.11 stable
|
| 30 |
+
- fix for abandoned carts
|
| 31 |
+
-- fix for multistore templates
|
| 32 |
+
- first release of autoresponders
|
| 33 |
+

|
| 34 |
+

|
| 35 |
+
-- version 1.1.10 stable
|
| 36 |
+
- fix for abandondedcart dashboard
|
| 37 |
+

|
| 38 |
+
-- version 1.1.9 stable
|
| 39 |
+
- Fix for mandrill tags
|
| 40 |
+

|
| 41 |
+
-- version 1.1.8 stable
|
| 42 |
+
- Fix render group errors when user it's guest
|
| 43 |
+
- Improve merge var to get address fields
|
| 44 |
+
- Fix Bulk Sync import functionality when we create new customers in case doesn't exist
|
| 45 |
+
- Fix dashboard in abandoned cart
|
| 46 |
+
- Fix database definition in abandoned cart
|
| 47 |
+
- Add logs in abandoned cart settings
|
| 48 |
+
- Fix for tags in abandoned carts mandrill
|
| 49 |
+
- Add subject email to the admin in abandoned cart
|
| 50 |
+

|
| 51 |
+
-- version 1.17 stable
|
| 52 |
+
- Add customer groups to abandoned cart
|
| 53 |
+
- Fix abandoned cart orders grid
|
| 54 |
+
- Fix for unsuscribe
|
| 55 |
+

|
| 56 |
+
-- version 1.1.6 stable
|
| 57 |
+
- Improve Abandoned Cart template (add tax, skus in configurable/bundle products)
|
| 58 |
+
- Add option to send abandoned cart emails By Days/Hours
|
| 59 |
+
- Add new Ecommerce360 option to send orders to MailChimp (By Cron depending on the Orders Status)
|
| 60 |
+
- Fix Wrong Store Name display error on BulkSync exports
|
| 61 |
+
- Posibility to Delete Ecommerce360 Orders in Magento (Not in MailChimp)
|
| 62 |
+
- Improve data Sync between Magento -> MailChimp (add telephone and company) Send Billing and Shipping address on Exports
|
| 63 |
+
- Show interest groups on Checkout in case has enable the subscribe on checkout
|
| 64 |
+
- Add createAtachment and addTo in the Emails functionality
|
| 65 |
+

|
| 66 |
+
-- version 1.1.5 stable
|
| 67 |
+
- Fix for abandoned cart, enable to put a specific coupon created on magento
|
| 68 |
+

|
| 69 |
+
-- version 1.1.4 stable
|
| 70 |
+
- Fix for abandoned cart multi store management
|
| 71 |
+
- Fix for abandoned cart not send email for a quote who has an order posterior from the same customer
|
| 72 |
+

|
| 73 |
+
-- version 1.1.3 stable
|
| 74 |
+
- Support for mandrill attachments
|
| 75 |
+

|
| 76 |
+
-- version 1.1.2 stable
|
| 77 |
+
- Fix for abandoned cart, coupon qty > 1 for the same product
|
| 78 |
+
- Fix for abandoned cart, customer name in email
|
| 79 |
+
- Fix for abandoned cart, cart content in email
|
| 80 |
+
- Fix for database with prefix
|
| 81 |
+

|
| 82 |
+
-- version 1.1.1 stable
|
| 83 |
+
- Adding configuration field to Start Date for abandoned carts
|
| 84 |
+
- Add abandonedflag to sales_flat_order
|
| 85 |
+
- Change for magento 1.4.2 and 1.5.*
|
| 86 |
+

|
| 87 |
+
-- version 1.1.0 stable
|
| 88 |
+

|
| 89 |
+
- Adding abandoned order manager (beta)
|
| 90 |
+

|
| 91 |
+
-- version 1.0.22 stable
|
| 92 |
+

|
| 93 |
+
- Adding Oauth2 support to connect MageMonkey with MailChimp
|
| 94 |
+
- Fallback on setReplyTo in Mandrill when transactional email is not enabled
|
| 95 |
+
- addBcc Fix on Mandrill
|
| 96 |
+

|
| 97 |
+
-- version 1.0.21 stable
|
| 98 |
+

|
| 99 |
+
- Fix duplicated confirmation email notifications
|
| 100 |
+
- Add success message when customer register from the "My Account" section
|
| 101 |
+
- Add mass action option to Sales -> Order grid in admin panel to send orders to MC
|
| 102 |
+
- Fix Mandrill_API::addTo() and Mandrill_API::replyTo() issues in the Mandrill module
|
| 103 |
+
- Add version information in the configuration for the Mandrill module
|
| 104 |
+

|
| 105 |
+
-- version 1.0.19 stable
|
| 106 |
+

|
| 107 |
+
- Fix automatic unsubscribe issue when users create orders from backend
|
| 108 |
+
- Adding BCC support for Mandrill Emails
|
| 109 |
+
- Remove enconding from subject for Mandrill Emails
|
| 110 |
+
- Add tags in emails sent from Mandrill
|
| 111 |
+

|
| 112 |
+
-- version 1.0.18 stable
|
| 113 |
+

|
| 114 |
+
Independence between MageMonkey and Mandrill modules
|
| 115 |
+

|
| 116 |
+
-- version 1.0.17 stable
|
| 117 |
+

|
| 118 |
+
-Fix "unsubscribe" when place an order 
|
| 119 |
+

|
| 120 |
+
-- version 1.0.16 stable
|
| 121 |
+

|
| 122 |
+
- Fix progress bar on export function 
|
| 123 |
+
- Add option in admin for limit of customers per round for export and import and delete customers in Magento when are removed in MailChimp
|
| 124 |
+
- Fix unsubscribe on edit customer from the admin panel
|
| 125 |
+
- Add version in the config
|
| 126 |
+
- Fix "Fatal error: Cannot use string offset as an array"
|
| 127 |
+

|
| 128 |
+
-- version 1.0.15 stable
|
| 129 |
+

|
| 130 |
+
- fix rendering of additional lists html elements
|
| 131 |
+
- Fix force subscription on checkout when use a payment method wich redirects to a payment page like PayPal Express Checkout.
|
| 132 |
+

|
| 133 |
+
-- version 1.0.14 stable
|
| 134 |
+
Fix Export functionality, only customers with status "subscribed" are exported now.
|
| 135 |
+
Increase the limit of customers for exports from 200 to 1000 per hour
|
| 136 |
+
Fix bug in unsubscribe customers.
|
| 137 |
+
Send email confirmation in double opt-in is not used.
|
| 138 |
+
Improve the save configuration proccess, add warnings, remove blank messages, improve the auto save webhooks in MailChimp.
|
| 139 |
+
Fix force subscription on checkout when use a payment method wich redirects to a payment page like PayPal Express Checkout.
|
| 140 |
+
Add new help links in the configuration ("What's MailChimp my IP Key?" and "How to segment your list based on your customers purchase activity").
|
| 141 |
+
Don't display additional lists newsletter block on checkout when there are no additional lists selected
|
| 142 |
+

|
| 143 |
+
-- version 1.0.13 stable
|
| 144 |
+
Fixing bug on admin urls when store code is used, more bugs fixed.
|
| 145 |
+

|
| 146 |
+
-- version 1.0.12 stable
|
| 147 |
+
Fixing bug on renderer for old magentos
|
| 148 |
+

|
| 149 |
+
-- version 1.0.11 stable
|
| 150 |
+
Adding export jobs per store id
|
| 151 |
+

|
| 152 |
+
-- version 1.0.10 stable
|
| 153 |
+
Fixing Ebizmarts_MageMonkey_Block_Adminhtml_Renderer_Lists bug
|
| 154 |
+
Fixing bug on MyAccount when subscribing, unsubscribing
|
| 155 |
+
Fix for bug on account creation, automatically subscribing
|
| 156 |
+
Ecommerce360 total with discount
|
| 157 |
+
Fixing but on order saving issue when customer is subscribed on MailChimp
|
| 158 |
+
Fixing error on cart page when compilation is ON
|
| 159 |
+

|
| 160 |
+
-- version 1.0.9 stable
|
| 161 |
+
Bug fix on webhooks url when Rewrites are not enabled
|
| 162 |
+

|
| 163 |
+
-- version 1.0.8 stable
|
| 164 |
+
Bug fix on checkout subscribe issues and EE customer credit balance issue fix (Customer is not set or does not exist.)
|
| 165 |
+

|
| 166 |
+
-- version 1.0.7 stable
|
| 167 |
+
Bug fix on TinyMCE inserting image, workaround for Magento passing a store parameter with undefined value.
|
| 168 |
+

|
| 169 |
+
-- version 1.0.6 stable
|
| 170 |
+
Fix bug when on hardcoded default store code. Additional Lists. 
|
| 171 |
+

|
| 172 |
+
-- version 1.0.4 stable
|
| 173 |
+
Fix bug when checking newsletter box when registering. Adding customer groups as Interest Grouping
|
| 174 |
+

|
| 175 |
+
-- version 1.0.2 beta
|
| 176 |
+
Fixing bug on bulk export for customers, gets stuck on 200
|
| 177 |
+

|
| 178 |
+
-- version 1.0.1 beta
|
| 179 |
+
Bug fixing when deleting a subscriber
|
| 180 |
+

|
| 181 |
+
-- version 1.0.0 beta
|
| 182 |
+
Including STS
|
| 183 |
+

|
| 184 |
+
First public release 0.0.9, January 2012</notes>
|
| 185 |
+
<authors><author><name>Ebizmarts Development Team</name><user>auto-converted</user><email>info@ebizmarts.com</email></author></authors>
|
| 186 |
+
<date>2013-07-31</date>
|
| 187 |
+
<time>13:42:55</time>
|
| 188 |
+
<contents><target name="magecommunity"><dir name="Ebizmarts"><dir name="MageMonkey"><dir name="Block"><dir name="Adminhtml"><dir name="Bulksync"><dir name="Export"><file name="Form.php" hash="494b043f37b3e50b64ebcdf839404bcd"/></dir><dir name="Import"><file name="Form.php" hash="876d2d4779f6cab94efcf875e9f91124"/></dir><dir name="Queue"><file name="Grid.php" hash="390dd759c2817044c44a0871819517b1"/></dir><dir name="QueueExport"><file name="Grid.php" hash="9f813bb7c6cc57a4dc2c4b40dbd0de0c"/></dir><dir name="QueueImport"><file name="Grid.php" hash="75363f7b616236e0d0b61625cb47b034"/></dir><file name="Export.php" hash="839406dcc6fdc21eafcc2a4482c409d9"/><file name="Import.php" hash="ffd9954540eb34e843924bf883ad96a9"/><file name="Queue.php" hash="cb98b0a44474e0c73f8e2deadfe040d5"/><file name="QueueExport.php" hash="c265f7173b88cdccf86c95d7189a8b7a"/><file name="QueueImport.php" hash="1ab842ed0d21fdcef5c1a03395036754"/></dir><dir name="Customer"><dir name="Edit"><dir name="Tab"><file name="Memberactivity.php" hash="b36206aff7545c2daeaecae13c09ccc0"/></dir></dir></dir><dir name="Ecommerce"><file name="Grid.php" hash="d5a96878c984ea0b83c3eaca3c5112f3"/></dir><dir name="Ecommerceapi"><dir name="Renderer"><file name="Items.php" hash="e1d1f0fa96a0fc43e4cf13de1e919fbf"/></dir><file name="Grid.php" hash="4082405d6e7d83b1b08fcaf56c5b2ffd"/></dir><dir name="Memberactivity"><file name="Grid.php" hash="35efc93f57716c24970fb404d0c085b6"/></dir><dir name="Renderer"><file name="Date.php" hash="d49c78b64451be697c8618b8d0359594"/><file name="Importypes.php" hash="c701400787cf5030c9443985ff71d641"/><file name="Lists.php" hash="941bc98f92c814efe2889b978ed478f8"/><file name="Progress.php" hash="a0a1c6e7820779f9816bc2573c498480"/><file name="Yesno.php" hash="dfa6a63276fc013759f1624bf5b4b011"/></dir><dir name="System"><dir name="Config"><dir name="Fieldset"><file name="Hint.php" hash="45539bad8e3b4fa643d018c26b965493"/></dir><dir name="Form"><dir name="Field"><file name="Mapfields.php" hash="2a842a1af2cf5c77811e2278af24c8ad"/></dir></dir><file name="Account.php" hash="da002554cad88eb8a2c88db03911ecbe"/><file name="OauthWizard.php" hash="5e7284770d5a5861a9c208b0bb1af400"/></dir></dir><dir name="Transactionalemail"><dir name="Mandrill"><file name="Grid.php" hash="9bdba2256861d7b2b956eebdf5f74810"/></dir><dir name="Newemail"><file name="Form.php" hash="2dc7e08b4ac6db0a8feaeb8edcac298b"/></dir><dir name="Sts"><file name="Grid.php" hash="f676f809fb853345f2cb4024c8439b18"/></dir><file name="Mandrill.php" hash="2b61e9227eacf5cf9f63c2a6636a122a"/><file name="Newemail.php" hash="ff60f1428e93cd85ff433b8c8991914c"/><file name="Sts.php" hash="3e11110c89e687a76e0b5eb16382cbf3"/></dir><file name="Ecommerce.php" hash="23466d320d6cf639262ea45295ca7fad"/><file name="Ecommerceapi.php" hash="2362186beb28cea702c720ddaca6ff59"/></dir><dir name="Checkout"><file name="Subscribe.php" hash="5e998c988af48b0b2288351a46d242cb"/></dir><dir name="Customer"><dir name="Account"><file name="Lists.php" hash="10e67b8fb610eeb26f53f9975a0777e0"/></dir></dir><file name="Lists.php" hash="30c23403376a9ba62303917b81bf53a4"/><file name="Signup.php" hash="381f59bcb8076de6e4cc4a58ec1749de"/></dir><dir name="Helper"><file name="Cache.php" hash="461d2b77aff5eb4bad80a52b65978f0d"/><file name="Data.php" hash="61e53724532e92f3a41ef7c4cc54662e"/><file name="Export.php" hash="bb36cff9864f8d53570200b371d84148"/><file name="Oauth2.php" hash="96e747768b4a0f2197ca1dda34e718cd"/></dir><dir name="Model"><dir name="Custom"><file name="Collection.php" hash="0ef74aaaac158aea31f90f6968ad651d"/></dir><dir name="Email"><file name="Template.php" hash="15e22e333d3ea8ed4cca2a5d8ecbfd0f"/></dir><dir name="Feed"><file name="Updates.php" hash="4ea3720b6e409ad396803a8203528e0a"/></dir><dir name="Mysql4"><dir name="Apidebug"><file name="Collection.php" hash="bda066b79c0d02744517bdedcecc0f63"/></dir><dir name="Bulksync"><dir name="Export"><file name="Collection.php" hash="8867a8e938fdbe6ea2727d5a47394a88"/></dir><dir name="Import"><file name="Collection.php" hash="2cb299ac506584ac4ab7baa61523fe55"/></dir><file name="Export.php" hash="257ebb74a4098a5c871e333139f46030"/><file name="Import.php" hash="8a69917cdcc660f0c907f5047301064e"/></dir><dir name="Ecommerce"><file name="Collection.php" hash="249fc8232239f7b6caeb3637ab3563dc"/></dir><file name="Apidebug.php" hash="97ca435168f87996cc6ec28c8416f6a5"/><file name="Ecommerce.php" hash="aab9408ea22072c8f64b253d53a2b0c5"/></dir><dir name="System"><dir name="Config"><dir name="Source"><file name="Account.php" hash="cfe2a819e278a6316dada4f1e8a5f0b8"/><file name="BulksyncDatasource.php" hash="0e60006bd0f9d621efed121a51764942"/><file name="BulksyncStatus.php" hash="0d8aec39d675d1f1e182ebf9e6521036"/><file name="Checkoutsubscribe.php" hash="1354dc01bc7f2ae34345a6a326f441b0"/><file name="CronProcessLimit.php" hash="d5ea4bcf96d89161746bf668f3c08caa"/><file name="Ecommerce360.php" hash="9d52d037f9c1e1354454bbc4e6d4862d"/><file name="List.php" hash="b7e3facaa5ee55753c065bae06f7d490"/><file name="OrderStatus.php" hash="fcffa29f07dbd3193a161430d70ae7d2"/><file name="Status.php" hash="dfb9f8702682ec6b7493e56bf995d40f"/><file name="TransactionalEmails.php" hash="8268078df511548abbc2dfa2730eb466"/><file name="WebhookDelete.php" hash="31a3456d1917da0d36fc1602aad90dab"/></dir></dir></dir><dir name="TransactionalEmail"><file name="Adapter.php" hash="48c9343c6a83f76dbf9ca5f111631f4a"/><file name="MANDRILL.php" hash="e9c9ade76a71d4feb9f78636ab9dbc4b"/><file name="STS.php" hash="3475e766d22ad464559b4e5b5a9cf03d"/></dir><file name="Api.php" hash="ff4937f6725ac342db5e9cb32827b233"/><file name="Apidebug.php" hash="c12fdbbcc042b5c00105fa27927da2f2"/><file name="BulksyncExport.php" hash="4ac2dffdfdbeb613ec662ff3cea3de45"/><file name="BulksyncImport.php" hash="2584cba71ec74d00304fb0c17258a3c6"/><file name="Cache.php" hash="8cd79a8368972846ce4197d9c7f975cc"/><file name="Cron.php" hash="229d10cd3e799b3ed1c44c8ecf1715ca"/><file name="Ecommerce.php" hash="ac3cda4fa10edce879e4c685ac405db1"/><file name="Ecommerce360.php" hash="b85e399ba0ed54a7fc1bd310faad5aa8"/><file name="MCAPI.php" hash="e0069816d5254a6d865412e0ce7246bc"/><file name="MCEXPORTAPI.php" hash="a559121e56448f22c58470635fb5f9ff"/><file name="Monkey.php" hash="eb5fe1633c912ac24992125329807dd2"/><file name="Observer.php" hash="9fe3120b2ebf9a4bb7f5a61b49700fe1"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="BulksyncController.php" hash="d1be92d5ba05fd106bfe0e1f9ddcf622"/><file name="EcommerceController.php" hash="6c4d1285022e2b03f08b27cfb57b7578"/><file name="TransactionalemailController.php" hash="1af1861fa74ddc0e917c8ea7f66c4843"/></dir><dir name="Customer"><file name="AccountController.php" hash="62b34054aa3b72a18570cf1b7fde48d1"/></dir><file name="SignupController.php" hash="e4d83eec491e96aada17e248c84a33fe"/><file name="WebhookController.php" hash="525f7e7657ab0353783eaa341fb2a714"/></dir><dir name="etc"><file name="adminhtml.xml" hash="95fef632f0e0eda69d6717d7231749bd"/><file name="config.xml" hash="d768872b2b4c770d9583f27d2aae169f"/><file name="system.xml" hash="cef6a7882f43aa04c7e47c34847c273f"/></dir><dir name="sql"><dir name="monkey_setup"><file name="mysql4-install-0.0.1.php" hash="4df34769f4d5a8ceca90fd582500e3a9"/><file name="mysql4-upgrade-0.0.1-0.0.2.php" hash="d81147dab407bc55c59cddb5a764c53e"/><file name="mysql4-upgrade-0.0.2-0.0.3.php" hash="ce1925ff2ab03aa9fd6cbe43283ea37d"/><file name="mysql4-upgrade-0.0.3-0.0.4.php" hash="7f1e38bcf030e6346a9fd8321f1a4362"/><file name="mysql4-upgrade-0.0.4-0.0.5.php" hash="bbe6b895320effca77cc2c23431f043f"/><file name="mysql4-upgrade-0.0.5-0.0.6.php" hash="98b72d9ef4ec8078c09a1f641fc35a39"/><file name="mysql4-upgrade-0.0.6-0.0.7.php" hash="ea15755fc072e7c82b78063589360779"/><file name="mysql4-upgrade-1.0.10-1.0.11.php" hash="b2ec497921eb2bd9a97a318554fd980b"/><file name="mysql4-upgrade-1.1.5-1.1.6.php" hash="14750274ece5816d6c1ab490f7d610ab"/></dir></dir></dir><dir name="Mandrill"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Fieldset"><file name="Hint.php" hash="e74ee5dac57de8157c1b22499fc3cc17"/></dir><file name="Userinfo.php" hash="5f4bb5e8b314ecd2662eb428a89eb6ab"/></dir></dir><dir name="Users"><dir name="Senders"><file name="Grid.php" hash="b6edb098f54daad0ccc046e37407f56f"/></dir><file name="Senders.php" hash="65406b23588d5ac1681c2767676f8634"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="9e9664511acf4d9a5895da88a4587568"/></dir><dir name="Model"><dir name="Email"><file name="Template.php" hash="91a60f843bc3da655940189adb66748f"/></dir><dir name="System"><dir name="Config"><dir name="Source"><file name="Userinfo.php" hash="b7ebed36a640a389cad61faddd62d30f"/></dir></dir></dir><file name="Customcollection.php" hash="6cf600e84ff59c89be519171c0df22e3"/></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Mandrill"><file name="UsersController.php" hash="e7f1cb19d1bb424a873797844768bbbf"/></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="af71f4a3a16c40e2b6862061ddad0a19"/><file name="config.xml" hash="255447d64089fd25db41fde836171f00"/><file name="system.xml" hash="1196617c7e63720eefcb76b06181c8c6"/></dir></dir><dir name="AbandonedCart"><dir name="Block"><dir name="Adminhtml"><dir name="Abandonedmails"><file name="Grid.php" hash="ab7e9c98b2e81084b699f0671c3e4cde"/></dir><dir name="Abandonedorder"><file name="Grid.php" hash="5ce2c2ce64f31770de9366e48c0a1574"/></dir><dir name="Dashboard"><file name="Sales.php" hash="16abf05ddd0c40a2c5ddbd3d41ea0d33"/><file name="Totals.php" hash="d85af3df9878c5fa263060a36e4c26b2"/></dir><dir name="System"><dir name="Config"><dir name="Fieldset"><file name="Hint.php" hash="4c885ae5c0bc9dfe81f1230277d254d9"/></dir><file name="Date.php" hash="3d6d093a0a8b78323940dcb7c3af503c"/></dir></dir><file name="Abandonedmails.php" hash="481f6ad7621a0ad22e6cc4ca5b134f4f"/><file name="Abandonedorder.php" hash="432ab1613ce56bf05d588220981c55f2"/><file name="Dashboard.php" hash="3b21c7594c0b197e184e6c3a4981324d"/></dir><dir name="Email"><dir name="Order"><file name="Items.php" hash="8df49873c836d2fa3ef270730ddc32e6"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="7f1d1e8c82f761c40102f521bd8e83a3"/></dir><dir name="Model"><dir name="Resource"><dir name="Mailssent"><file name="Collection.php" hash="e6c0f3aebc086a50661e8b1851698d04"/></dir><dir name="Order"><file name="Collection.php" hash="3be7739b6078e1886993a8126c75efd6"/></dir><file name="Mailssent.php" hash="680224fabede906f58f70afe3873203b"/></dir><dir name="System"><dir name="Config"><file name="Automatic.php" hash="04110625fa0be42905ccd21be919b46b"/><file name="Customergroup.php" hash="394ebe1114d7a08fb9a4d6f4b5b3d9df"/><file name="Discounttype.php" hash="6f647fbfc3a7ecff05bb0c7ad85a0272"/><file name="Unit.php" hash="d22875d2d2e5206e243031bba727cbe3"/></dir></dir><file name="Config.php" hash="3ba173a3008c69fb03472b386c30a8fa"/><file name="Cron.php" hash="0057fad95bebac981a8174f7ce63f863"/><file name="Mailssent.php" hash="bd816e03345495f6becc5a14b84c9ce1"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="AbandonedmailsController.php" hash="960493d95b9dcc22a492eb26a54b5ff6"/><file name="AbandonedorderController.php" hash="9fcb3223357dfb9281a689232b28c6e0"/></dir><file name="AbandonedController.php" hash="300e8bd9346eb4a92170083f3aaa2ef4"/></dir><dir name="etc"><file name="adminhtml.xml" hash="c2a82d9e46d715f3d10a5ae40f457c89"/><file name="config.xml" hash="687fcd32aff2ba323ee6387300d4cb75"/><file name="system.xml" hash="30ffc1e6e1c1ed75ed5573fae67d43cf"/></dir><dir name="sql"><dir name="ebizmarts_abandonedcart_setup"><file name="mysql4-install-0.1.0.php" hash="0e1a8c0391654c480773b78a50db5a83"/><file name="mysql4-upgrade-0.1.12-0.1.13.php" hash="4835436b744f8cbff61a66c2e345976f"/><file name="mysql4-upgrade-0.1.18-0.1.19.php" hash="e51b332cb70c81ee472b586fda4e8a7e"/><file name="mysql4-upgrade-0.1.2-0.1.3.php" hash="2e87d09a5008ac2f2432a25e08474c87"/><file name="mysql4-upgrade-0.1.6-0.1.7.php" hash="60daa0d70a1af929a39d6e20ee52ee9c"/></dir></dir></dir><dir name="Autoresponder"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Birthday"><dir name="Fieldset"><file name="Hint.php" hash="9ad466f965604828a2467ccc54d151b8"/></dir></dir><dir name="Fieldset"><file name="Hint.php" hash="349238311cdf09fc7637cdb294526f61"/></dir><dir name="Review"><dir name="Fieldset"><file name="Hint.php" hash="53d9fabcf8fd265df6b1344d9417bfce"/></dir></dir><dir name="Wishlist"><dir name="Fieldset"><file name="Hint.php" hash="8d3023646bf0bb4a0f3bd7dc7409c88f"/></dir></dir></dir></dir></dir><dir name="Customer"><dir name="Account"><file name="List.php" hash="88f17bfd4caaee22084db1f586932906"/></dir></dir><dir name="Email"><dir name="Related"><file name="Items.php" hash="fb3a41724e89de1a8dfaf2faa3e4f74d"/></dir><dir name="Review"><file name="Items.php" hash="9b80bad72b7f3ecc415a44c0ac96cf93"/></dir><dir name="Wishlist"><file name="Items.php" hash="12bd1d249aac41ba862fb501fc062be1"/></dir></dir><file name="Unsubscribe.php" hash="f67ee7f28b010a87b378a07629c92ac6"/></dir><dir name="Helper"><file name="Data.php" hash="cff844f2ef576bf51770b4d7afeb3f02"/></dir><dir name="Model"><dir name="Resource"><dir name="Unsubscribe"><file name="Collection.php" hash="e6179ce956137d9af5521f10af34f5cf"/></dir><file name="Unsubscribe.php" hash="2e0ea91653872a32f8276e4f4c403d0f"/></dir><dir name="System"><dir name="Config"><file name="Automatic.php" hash="1996bb3baf00288e313cc034ef5c0195"/><file name="Customergroup.php" hash="0756189e811c962ca77df0154289273f"/><file name="Discounttype.php" hash="225a09b80efedb8a37a6b799d2405129"/></dir></dir><file name="Config.php" hash="b679068c8de5c8d77781489c642852fa"/><file name="Cron.php" hash="d70ff66d42053be43ace49179efd72f6"/><file name="EventObserver.php" hash="24cfeed1b43a189a6e7dbb9628628b81"/><file name="Unsubscribe.php" hash="ca9037bc1037e27e9c66d6eca9d7c0c2"/></dir><dir name="controllers"><file name="AutoresponderController.php" hash="37cf188e259cb0a53fbee219bd4bd765"/></dir><dir name="etc"><file name="adminhtml.xml" hash="59a240f12b496566f1a2b1de5f053e96"/><file name="config.xml" hash="73a124a78158e847b1fb493ceea299e6"/><file name="system.xml" hash="8194b9abae4b3d38680cc3e0c15cdf4d"/></dir><dir name="sql"><dir name="ebizmarts_autoresponder_setup"><file name="mysql4-install-0.1.0.php" hash="791af0eec35753144d506294bb4c03ad"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="ebizmarts"><file name="abandonedcart.xml" hash="72945454a4d24ef8d1718bf177272ffe"/><file name="autoresponder.xml" hash="da07b7aef14ea79e8e08993b50311cc5"/></dir><file name="magemonkey.xml" hash="f86c4a1e77468bf497bbc31f00d379c9"/></dir><dir name="template"><dir name="magemonkey"><dir name="checkout"><file name="subscribe.phtml" hash="ef3abc11470c016626a7470e29908a14"/></dir><dir name="customer"><dir name="account"><file name="lists.phtml" hash="9a81bc227a165994ac08ea615e5d8c3e"/></dir></dir><file name="lists.phtml" hash="f56a99e2b7337325de495b7b72c13634"/></dir><dir name="ebizmarts_abandonedcart"><dir name="email"><dir name="order"><dir name="items"><dir name="order"><file name="default.phtml" hash="5ff74635419e7ffb4d3660c306ad6590"/></dir></dir><file name="items.phtml" hash="cd81265b83dc2df835301b5fafb70f8f"/></dir></dir></dir><dir name="ebizmarts"><dir name="autoresponder"><dir name="customer"><file name="list.phtml" hash="be9cd36a644a39e3569c9ae0ded2087d"/></dir><dir name="related"><file name="items.phtml" hash="c0bd5d0624f882a9fefaca5e41bf5ee7"/></dir><dir name="review"><file name="items.phtml" hash="5aa108208a1f6ce3d0edac4662bcee64"/></dir><dir name="wishlist"><file name="items.phtml" hash="9a1cd60c87c038696821ed6c1e5879f9"/></dir><file name="unsubscribe.phtml" hash="2635dae225a8a4536d58a87c4de9054d"/></dir></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="ebizmarts"><file name="abandonedcart.xml" hash="56b2ca552b73a976207cd33afbcfb299"/></dir><file name="magemonkey.xml" hash="613e5cd38048dedadb96434b9c3cc704"/><file name="mandrill.xml" hash="a79308bc32db35d45b151c01041be72d"/></dir><dir name="template"><dir name="magemonkey"><dir name="system"><dir name="config"><dir name="fieldset"><file name="hint.phtml" hash="f4bbe778592be65a6b452002dfc84c24"/></dir><file name="oauth_wizard.phtml" hash="226d42be1f41838bb80da0e2c3567d71"/></dir></dir></dir><dir name="mandrill"><dir name="system"><dir name="config"><dir name="fieldset"><file name="hint.phtml" hash="d4025820e90c8e20bc8c6664984a78a1"/></dir></dir></dir></dir><dir name="ebizmarts"><dir name="abandonedcart"><dir name="dashboard"><file name="index.phtml" hash="180d73784745e0c1d5b37b0d435a2cc0"/><file name="salebar.phtml" hash="50a0c2645e2f651da9ba72fd875986cb"/><file name="totalbar.phtml" hash="2652c0ab80efd0acceaf827964fe24c3"/></dir><dir name="system"><dir name="config"><dir name="fieldset"><file name="hint.phtml" hash="35a3d03a123df87a60b720678d387636"/></dir></dir></dir></dir><dir name="autoresponder"><dir name="system"><dir name="config"><dir name="birthday"><dir name="fieldset"><file name="hint.phtml" hash="577162540f6f45b822d7784463c31456"/></dir></dir><dir name="fieldset"><file name="hint.phtml" hash="4dc3f6561861ae893eda757221ca8027"/></dir><dir name="review"><dir name="fieldset"><file name="hint.phtml" hash="a3e506441b757f5372337fa59de1d64f"/></dir></dir><dir name="wishlist"><dir name="fieldset"><file name="hint.phtml" hash="8f4427235da3afa30d271745f040c767"/></dir></dir></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Ebizmarts_MageMonkey.xml" hash="9a4b1c469b4652442c7a5f945dd12cac"/><file name="Ebizmarts_Mandrill.xml" hash="c80aa6f98ccc3890303bb4c278f8ad95"/><file name="Ebizmarts_AbandonedCart.xml" hash="48c4cfe8246d5a995e2836c43ab38d74"/><file name="Ebizmarts_Autoresponder.xml" hash="97302f94f5893147db18c4034d135256"/></dir></target><target name="magelocale"><dir name="en_US"><dir name="template"><dir name="email"><dir name="sales"><file name="abandoned_cart.html" hash="98e069b6316232dc155408326162c3aa"/></dir><dir name="ebizmarts"><dir name="autoresponder"><file name="birthday.html" hash="80c07ab41e13f953bac72f6164a8e9b1"/><file name="neworder.html" hash="c5f7af81d02baa3b4c851f327640c9d0"/><file name="noactivity.html" hash="9dfb99e8cea787a37e552c1e7ecdc961"/><file name="relatedproducts.html" hash="68a2b450dfeff78b4aefd77c1b6000b3"/><file name="review.html" hash="daf05d3208d1897426d6dbdcea280ce8"/><file name="wishlist.html" hash="f8dc86167dd0df3100f8821b8db77285"/></dir></dir></dir></dir><file name="Ebizmarts_MageMonkey.csv" hash="181e91ed91dfea5fe7dab66af5719af8"/><file name="Ebizmarts_Mandrill.csv" hash="3dac3af57664fd34f5eda8abf4098ee0"/><file name="Ebizmarts_AbandonedCart.csv" hash="29ee25f32946e687917cf542aaa66941"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="magemonkey"><file name="magemonkey.css" hash="d4eac40764271596a3edc30d1014887f"/><file name="monkey.js" hash="d7d2e3f137d97202214fe29551695739"/></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="mandrill"><file name="mandrill-tab.png" hash="d7eaf9deef355e4b8b55a96070b90ffe"/><file name="mandrill.css" hash="9ae16c108e7077daee12fcd81e267e66"/></dir><dir name="magemonkey"><file name="magemonkey.css" hash="c89300bb9c69634d562bc9acbb12c1a5"/><file name="magemonkey.js" hash="e40717a83ef300776cc79ad9f8191005"/><file name="mailchimp-connected-ebizmarts-title.png" hash="c6bcb1aa606ecd3b0a9753bb48ddeb58"/><file name="mailchimp-ico.png" hash="14978ec398cede4060bc9b00365bb6c5"/><file name="mailchimp-section-background.png" hash="d4536261c6a3534fbb855428c0cca62c"/><file name="mailchimp-tab.png" hash="61972b4e063364071e81d8c9e10d8feb"/></dir></dir></dir></dir></target><target name="mage"><dir name="lib"><dir name="Mandrill"><file name="API.php" hash="a3cfc2fbc1f2a309512a6f2fc415124c"/></dir></dir></target></contents>
|
| 189 |
+
<compatible/>
|
| 190 |
+
<dependencies/>
|
| 191 |
+
</package>
|
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
ul.tabs a.monkey-section:hover { background-color:#D8E6E6; background-image:url(../images/tabs_link_over_bg.gif); }
|
| 2 |
+
ul.tabs a.monkey-section {border-bottom: 1px; border-bottom-style: dotted;text-indent:-9999px;}
|
| 3 |
+
ul.tabs a.monkey-section:hover { border-bottom: 1px; border-bottom-style: dotted;text-indent:-9999px;}
|
| 4 |
+
ul.tabs a.monkey-section span,
|
| 5 |
+
ul.tabs a.monkey-section:hover span { background:url(mailchimp-tab.png) no-repeat 20px 0; overflow:hidden; padding-left:20px;; width:120px; height:22px;}
|
| 6 |
+
ul.tabs a.monkey-section.active, ul.tabs a.monkey-section.active:hover { background:white; border-bottom-color: #8BA5A5;}
|
| 7 |
+
h3.mailchimp-header { background:url(mailchimp-tab.png) no-repeat 0 0; height: 22px; overflow:hidden; padding-left:20px;; width:120px; text-indent:-9999px; }
|
| 8 |
+
fieldset#monkey_general p.note a {background:url(mailchimp-ico.png) no-repeat left top; padding-left:18px; padding-bottom: 4px;}
|
| 9 |
+
.mailchimp-nowarp {white-space:nowrap;}
|
| 10 |
+
button.add span span, button.cancel span span, button.delete span span {background-image: none; padding-left: 0;}
|
| 11 |
+
tr#row_monkey_general_account_details ul{padding:5px;color:#444;background-color: #fdfdfd;border:1px solid #ccc;}
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
/**
|
| 15 |
+
* Progress Bar
|
| 16 |
+
*/
|
| 17 |
+
.bar-all-rounded {
|
| 18 |
+
-webkit-border-radius: 2px;
|
| 19 |
+
-moz-border-radius: 2px;
|
| 20 |
+
border-radius: 2px;
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
.bar-spacer {
|
| 24 |
+
display: block;
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
#bar-progress-bar {
|
| 28 |
+
width: 100px;
|
| 29 |
+
margin: 0 auto;
|
| 30 |
+
background: #CCC;
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
#bar-progress-bar-percentage {
|
| 34 |
+
background: #3063A5;
|
| 35 |
+
padding: 2px 0px;
|
| 36 |
+
color: #FFF;
|
| 37 |
+
font-weight: bold;
|
| 38 |
+
text-align: center;
|
| 39 |
+
}
|
| 40 |
+
/**
|
| 41 |
+
* Progress Bar
|
| 42 |
+
*/
|
| 43 |
+
|
| 44 |
+
div.magemonkey-notice{
|
| 45 |
+
background:#EAF0EE;
|
| 46 |
+
border:1px solid #CCCCCC;
|
| 47 |
+
margin-bottom:10px;
|
| 48 |
+
padding:11px 0 0 10px;
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
.mailchimp-image{
|
| 52 |
+
margin:0 0 4px 10px;
|
| 53 |
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
var transactionalEmailOptionsHandler = function(evt){
|
| 2 |
+
var sl = Event.element(evt);
|
| 3 |
+
|
| 4 |
+
var row = $('row_monkey_general_mandrill_apikey');
|
| 5 |
+
var element = $('monkey_general_mandrill_apikey');
|
| 6 |
+
|
| 7 |
+
if(sl.getValue().toString() === 'mandrill'){
|
| 8 |
+
row.show();
|
| 9 |
+
element.disabled = false;
|
| 10 |
+
}else{
|
| 11 |
+
row.hide();
|
| 12 |
+
element.disabled = true;
|
| 13 |
+
}
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
document.observe("dom:loaded", function() {
|
| 17 |
+
|
| 18 |
+
if($('monkey_general_transactional_emails')){
|
| 19 |
+
if($('monkey_general_transactional_emails').getValue().toString() != 'mandrill'){
|
| 20 |
+
$('row_monkey_general_mandrill_apikey').hide();
|
| 21 |
+
$('monkey_general_mandrill_apikey').disabled = true;
|
| 22 |
+
}
|
| 23 |
+
Element.observe('monkey_general_transactional_emails', 'change', transactionalEmailOptionsHandler);
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
});
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
ul.tabs a.mandrill-section:hover { background-color:#D8E6E6; background-image:url(images/tabs_link_over_bg.gif); }
|
| 2 |
+
ul.tabs a.mandrill-section {border-bottom: 1px; border-bottom-style: dotted;}
|
| 3 |
+
ul.tabs a.mandrill-section:hover {border-bottom: 1px; border-bottom-style: dotted;}
|
| 4 |
+
ul.tabs a.mandrill-section span,
|
| 5 |
+
ul.tabs a.mandrill-section:hover span { background:url(mandrill-tab.png) no-repeat 20px 0; overflow:hidden; padding:0; padding-left:45px; width:120px; height:22px;}
|
| 6 |
+
ul.tabs a.mandrill-section.active, ul.tabs a.mandrill-section.active:hover {background-color: white;border-bottom-color: #8BA5A5;}
|
| 7 |
+
|
| 8 |
+
small { font-size: 9px; }
|
| 9 |
+
|
| 10 |
+
div.mandrill-notice {
|
| 11 |
+
background: none repeat scroll 0 0 #EAF0EE;
|
| 12 |
+
border: 1px solid #CCCCCC;
|
| 13 |
+
margin-bottom: 10px;
|
| 14 |
+
padding: 11px 0 0 10px;
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
h3.mandrill-header {
|
| 18 |
+
background: url("mandrill-tab.png") no-repeat scroll 0 0 transparent;
|
| 19 |
+
height: 22px;
|
| 20 |
+
overflow: hidden;
|
| 21 |
+
padding: 0;
|
| 22 |
+
text-indent: -9999px;
|
| 23 |
+
width: 120px;
|
| 24 |
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
div.interest-groupings{
|
| 2 |
+
margin-left:20px;
|
| 3 |
+
}
|
| 4 |
+
div.interest-groupings div.grouping{
|
| 5 |
+
margin-top:4px;
|
| 6 |
+
}
|
| 7 |
+
div.interest-groupings div.grouping ul.checkboxes li{
|
| 8 |
+
display:inline;
|
| 9 |
+
margin-left:20px;
|
| 10 |
+
}
|
| 11 |
+
div.interest-groupings div.grouping div.groups-list input, div.interest-groupings div.grouping div.groups-list select {
|
| 12 |
+
margin-left:20px;
|
| 13 |
+
}
|
| 14 |
+
div.interest-groupings div.grouping div.groups-list select {
|
| 15 |
+
width:150px;
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
ul.monkey-additional-lists li.listdata {
|
| 19 |
+
margin-bottom:15px;
|
| 20 |
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
removeManageNewsletter = function(){
|
| 2 |
+
var newsletter = $$('div.block-content ul li a[href*="newsletter/manage"]');
|
| 3 |
+
if(newsletter.length){
|
| 4 |
+
newsletter.first().up().remove();
|
| 5 |
+
}
|
| 6 |
+
}
|
| 7 |
+
|
| 8 |
+
document.observe("dom:loaded", function() {
|
| 9 |
+
|
| 10 |
+
var monkeyEnabled = $$('div.block-content ul li a[href*="monkey/customer_account/index"]');
|
| 11 |
+
|
| 12 |
+
if(monkeyEnabled.length){
|
| 13 |
+
removeManageNewsletter();
|
| 14 |
+
|
| 15 |
+
//If in Dashboard, change "edit" link for "Newsletters"
|
| 16 |
+
var editLink = $$('div.my-account a[href*="newsletter/manage"]');
|
| 17 |
+
if(editLink.length){
|
| 18 |
+
editLink.first().writeAttribute('href', monkeyEnabled.first().readAttribute('href'));
|
| 19 |
+
}
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
});
|
