Version Notes
1.1.31
--------
Updated Sweet Monkey to stop sending automated emails.
Fixed subscription error on admin
Added Sweet Monkey to modman
Removed parentheses as suggested on prototype documentation.
Download this release
Release Info
Developer | Magento Core Team |
Extension | Ebizmarts_MageMonkey |
Version | 1.1.31 |
Comparing to | |
See all releases |
Code changes from version 1.1.30 to 1.1.31
- app/code/community/Ebizmarts/AbandonedCart/Block/Adminhtml/Abandonedmails.php +0 -1
- app/code/community/Ebizmarts/AbandonedCart/Block/Adminhtml/Abandonedmails/Grid.php +4 -4
- app/code/community/Ebizmarts/AbandonedCart/Block/Adminhtml/Abandonedorder.php +0 -1
- app/code/community/Ebizmarts/AbandonedCart/Block/Adminhtml/Abandonedorder/Grid.php +12 -13
- app/code/community/Ebizmarts/AbandonedCart/Block/Adminhtml/Dashboard.php +4 -3
- app/code/community/Ebizmarts/AbandonedCart/Block/Adminhtml/Dashboard/Sales.php +3 -4
- app/code/community/Ebizmarts/AbandonedCart/Block/Adminhtml/Dashboard/Totals.php +46 -49
- app/code/community/Ebizmarts/AbandonedCart/Block/Adminhtml/System/Config/Date.php +0 -1
- app/code/community/Ebizmarts/AbandonedCart/Block/Adminhtml/System/Config/Fieldset/Hint.php +4 -4
- app/code/community/Ebizmarts/AbandonedCart/Block/Email/Order/Items.php +9 -10
- app/code/community/Ebizmarts/AbandonedCart/Block/Popup/Emailcatcher.php +18 -10
- app/code/community/Ebizmarts/AbandonedCart/Helper/Data.php +49 -46
- app/code/community/Ebizmarts/AbandonedCart/Model/Abtesting.php +2 -2
- app/code/community/Ebizmarts/AbandonedCart/Model/Config.php +72 -73
- app/code/community/Ebizmarts/AbandonedCart/Model/Cron.php +94 -100
- app/code/community/Ebizmarts/AbandonedCart/Model/EventObserver.php +17 -19
- app/code/community/Ebizmarts/AbandonedCart/Model/Mailssent.php +2 -2
- app/code/community/Ebizmarts/AbandonedCart/Model/Popup.php +2 -2
- app/code/community/Ebizmarts/AbandonedCart/Model/Resource/Abtesting.php +1 -2
- app/code/community/Ebizmarts/AbandonedCart/Model/Resource/Abtesting/Collection.php +0 -1
- app/code/community/Ebizmarts/AbandonedCart/Model/Resource/Mailssent.php +1 -2
- app/code/community/Ebizmarts/AbandonedCart/Model/Resource/Mailssent/Collection.php +0 -1
- app/code/community/Ebizmarts/AbandonedCart/Model/Resource/Order/Collection.php +17 -22
- app/code/community/Ebizmarts/AbandonedCart/Model/Resource/Popup.php +1 -2
- app/code/community/Ebizmarts/AbandonedCart/Model/Resource/Popup/Collection.php +0 -1
- app/code/community/Ebizmarts/AbandonedCart/Model/System/Config/Automatic.php +2 -3
- app/code/community/Ebizmarts/AbandonedCart/Model/System/Config/Cmspage.php +1 -2
- app/code/community/Ebizmarts/AbandonedCart/Model/System/Config/Customergroup.php +0 -1
- app/code/community/Ebizmarts/AbandonedCart/Model/System/Config/Discounttype.php +3 -3
- app/code/community/Ebizmarts/AbandonedCart/Model/System/Config/Maxemails.php +2 -2
- app/code/community/Ebizmarts/AbandonedCart/Model/System/Config/Unit.php +2 -3
- app/code/community/Ebizmarts/AbandonedCart/Model/System/Config/Yesnovariation.php +4 -5
- app/code/community/Ebizmarts/AbandonedCart/controllers/AbandonedController.php +14 -20
- app/code/community/Ebizmarts/AbandonedCart/controllers/Adminhtml/AbandonedmailsController.php +5 -6
- app/code/community/Ebizmarts/AbandonedCart/controllers/Adminhtml/AbandonedorderController.php +13 -14
- app/code/community/Ebizmarts/AbandonedCart/etc/config.xml +12 -5
- app/code/community/Ebizmarts/AbandonedCart/etc/system.xml +19 -9
- app/code/community/Ebizmarts/Autoresponder/Block/Adminhtml/System/Config/Backtostock/Fieldset/Hint.php +0 -1
- app/code/community/Ebizmarts/Autoresponder/Block/Adminhtml/System/Config/Birthday/Fieldset/Hint.php +0 -1
- app/code/community/Ebizmarts/Autoresponder/Block/Adminhtml/System/Config/Fieldset/Hint.php +4 -4
- app/code/community/Ebizmarts/Autoresponder/Block/Adminhtml/System/Config/Review/Fieldset/Hint.php +0 -1
- app/code/community/Ebizmarts/Autoresponder/Block/Adminhtml/System/Config/Wishlist/Fieldset/Hint.php +0 -1
- app/code/community/Ebizmarts/Autoresponder/Block/Backtostock/Notice.php +2 -3
- app/code/community/Ebizmarts/Autoresponder/Block/Customer/Account/List.php +1 -1
- app/code/community/Ebizmarts/Autoresponder/Block/Email/Backtostock/Item.php +1 -2
- app/code/community/Ebizmarts/Autoresponder/Block/Email/Related/Items.php +1 -2
- app/code/community/Ebizmarts/Autoresponder/Block/Email/Review/Items.php +1 -2
- app/code/community/Ebizmarts/Autoresponder/Block/Email/Wishlist/Items.php +0 -1
- app/code/community/Ebizmarts/Autoresponder/Block/Review/Form.php +0 -1
- app/code/community/Ebizmarts/Autoresponder/Block/Unsubscribe.php +2 -2
- app/code/community/Ebizmarts/Autoresponder/Helper/Data.php +61 -57
- app/code/community/Ebizmarts/Autoresponder/Model/Backtostock.php +2 -2
- app/code/community/Ebizmarts/Autoresponder/Model/Backtostockalert.php +2 -2
- app/code/community/Ebizmarts/Autoresponder/Model/Config.php +100 -101
- app/code/community/Ebizmarts/Autoresponder/Model/Cron.php +328 -327
- app/code/community/Ebizmarts/Autoresponder/Model/EventObserver.php +85 -91
- app/code/community/Ebizmarts/Autoresponder/Model/Resource/Backtostock.php +1 -2
- app/code/community/Ebizmarts/Autoresponder/Model/Resource/Backtostock/Collection.php +0 -1
- app/code/community/Ebizmarts/Autoresponder/Model/Resource/Backtostockalert.php +1 -2
- app/code/community/Ebizmarts/Autoresponder/Model/Resource/Backtostockalert/Collection.php +0 -1
- app/code/community/Ebizmarts/Autoresponder/Model/Resource/Review.php +7 -6
- app/code/community/Ebizmarts/Autoresponder/Model/Resource/Review/Collection.php +0 -1
- app/code/community/Ebizmarts/Autoresponder/Model/Resource/Unsubscribe.php +1 -2
- app/code/community/Ebizmarts/Autoresponder/Model/Resource/Unsubscribe/Collection.php +0 -1
- app/code/community/Ebizmarts/Autoresponder/Model/Resource/Visited.php +9 -8
- app/code/community/Ebizmarts/Autoresponder/Model/Resource/Visited/Collection.php +0 -1
- app/code/community/Ebizmarts/Autoresponder/Model/Review.php +6 -4
- app/code/community/Ebizmarts/Autoresponder/Model/System/Config/Automatic.php +2 -3
- app/code/community/Ebizmarts/Autoresponder/Model/System/Config/Couponcounter.php +2 -3
- app/code/community/Ebizmarts/Autoresponder/Model/System/Config/Customergroup.php +0 -1
- app/code/community/Ebizmarts/Autoresponder/Model/System/Config/Discounttype.php +2 -3
- app/code/community/Ebizmarts/Autoresponder/Model/System/Config/Generaltype.php +4 -4
- app/code/community/Ebizmarts/Autoresponder/Model/System/Config/Hours.php +2 -2
- app/code/community/Ebizmarts/Autoresponder/Model/System/Config/Newordertrigger.php +3 -4
- app/code/community/Ebizmarts/Autoresponder/Model/System/Config/Time.php +8 -8
- app/code/community/Ebizmarts/Autoresponder/Model/Unsubscribe.php +2 -2
- app/code/community/Ebizmarts/Autoresponder/Model/Visited.php +6 -4
- app/code/community/Ebizmarts/Autoresponder/controllers/AutoresponderController.php +39 -36
- app/code/community/Ebizmarts/Autoresponder/controllers/BacktostockController.php +7 -11
- app/code/community/Ebizmarts/Autoresponder/etc/config.xml +1 -1
- app/code/community/Ebizmarts/Autoresponder/etc/system.xml +18 -8
- app/code/community/Ebizmarts/Autoresponder/sql/ebizmarts_autoresponder_setup/mysql4-install-0.1.0.php +1 -1
- app/code/community/Ebizmarts/Autoresponder/sql/ebizmarts_autoresponder_setup/mysql4-upgrade-0.1.3-0.1.4.php +18 -18
- app/code/community/Ebizmarts/Autoresponder/sql/ebizmarts_autoresponder_setup/mysql4-upgrade-0.1.4-0.1.5.php +12 -12
- app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Bulksync/Export.php +2 -3
- app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Bulksync/Export/Form.php +22 -23
- app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Bulksync/Import.php +2 -3
- app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Bulksync/Import/Form.php +32 -33
- app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Bulksync/Queue.php +1 -2
- app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Bulksync/Queue/Grid.php +7 -8
- app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Bulksync/QueueExport.php +4 -5
- app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Bulksync/QueueExport/Grid.php +32 -33
- app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Bulksync/QueueImport.php +4 -5
- app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Bulksync/QueueImport/Grid.php +27 -28
- app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Customer/Edit/Tab/Memberactivity.php +1 -2
- app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Ecommerce.php +2 -3
- app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Ecommerce/Grid.php +15 -16
- app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Ecommerceapi.php +2 -3
- app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Ecommerceapi/Grid.php +10 -11
- app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Ecommerceapi/Renderer/Items.php +2 -3
- app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Memberactivity/Grid.php +33 -34
- app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Renderer/Date.php +1 -2
- app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Renderer/Importypes.php +1 -2
- app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Renderer/Lists.php +9 -10
- app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Renderer/Progress.php +0 -1
- app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Renderer/Yesno.php +1 -2
- app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/System/Config/Account.php +6 -7
- app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/System/Config/Date.php +1 -0
- app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/System/Config/Fieldset/Hint.php +19 -19
- app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/System/Config/Form/Field/Mapfields.php +0 -1
- app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/System/Config/OauthWizard.php +15 -12
- app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/System/Config/ResetLocalEcommerce.php +5 -4
- app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/System/Config/ResetRemoteEcommerce.php +5 -4
- app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Transactionalemail/Mandrill.php +0 -1
- app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Transactionalemail/Mandrill/Grid.php +29 -30
- app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Transactionalemail/Newemail.php +2 -3
- app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Transactionalemail/Newemail/Form.php +13 -14
- app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Transactionalemail/Sts.php +0 -1
- app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Transactionalemail/Sts/Grid.php +23 -24
- app/code/community/Ebizmarts/MageMonkey/Block/Checkout/Subscribe.php +2 -3
- app/code/community/Ebizmarts/MageMonkey/Block/Customer/Account/Lists.php +0 -1
- app/code/community/Ebizmarts/MageMonkey/Block/Lists.php +327 -325
- app/code/community/Ebizmarts/MageMonkey/Block/Signup.php +0 -1
- app/code/community/Ebizmarts/MageMonkey/Helper/Cache.php +21 -19
- app/code/community/Ebizmarts/MageMonkey/Helper/Data.php +723 -725
- app/code/community/Ebizmarts/MageMonkey/Helper/Export.php +38 -39
- app/code/community/Ebizmarts/MageMonkey/Helper/Oauth2.php +12 -11
- app/code/community/Ebizmarts/MageMonkey/Model/Api.php +11 -7
- app/code/community/Ebizmarts/MageMonkey/Model/Asyncorders.php +2 -1
- app/code/community/Ebizmarts/MageMonkey/Model/Asyncsubscribers.php +2 -1
- app/code/community/Ebizmarts/MageMonkey/Model/BulksyncExport.php +10 -11
- app/code/community/Ebizmarts/MageMonkey/Model/BulksyncImport.php +16 -17
- app/code/community/Ebizmarts/MageMonkey/Model/Cache.php +24 -15
- app/code/community/Ebizmarts/MageMonkey/Model/Config.php +29 -30
- app/code/community/Ebizmarts/MageMonkey/Model/Cron.php +391 -389
- app/code/community/Ebizmarts/MageMonkey/Model/Custom/Collection.php +36 -37
- app/code/community/Ebizmarts/MageMonkey/Model/Ecommerce.php +5 -6
- app/code/community/Ebizmarts/MageMonkey/Model/Ecommerce360.php +207 -207
- app/code/community/Ebizmarts/MageMonkey/Model/Email/Template.php +24 -25
- app/code/community/Ebizmarts/MageMonkey/Model/Feed/Updates.php +33 -26
- app/code/community/Ebizmarts/MageMonkey/Model/MCAPI.php +691 -603
- app/code/community/Ebizmarts/MageMonkey/Model/MCEXPORTAPI.php +33 -32
- app/code/community/Ebizmarts/MageMonkey/Model/Monkey.php +60 -50
- app/code/community/Ebizmarts/MageMonkey/Model/Mysql4/Apidebug.php +5 -6
- app/code/community/Ebizmarts/MageMonkey/Model/Mysql4/Apidebug/Collection.php +5 -6
- app/code/community/Ebizmarts/MageMonkey/Model/Mysql4/Asyncorders.php +1 -0
- app/code/community/Ebizmarts/MageMonkey/Model/Mysql4/Asyncorders/Collection.php +1 -0
- app/code/community/Ebizmarts/MageMonkey/Model/Mysql4/Asyncsubscribers.php +1 -0
- app/code/community/Ebizmarts/MageMonkey/Model/Mysql4/Asyncsubscribers/Collection.php +2 -1
- app/code/community/Ebizmarts/MageMonkey/Model/Mysql4/Bulksync/Export.php +11 -12
- app/code/community/Ebizmarts/MageMonkey/Model/Mysql4/Bulksync/Export/Collection.php +12 -13
- app/code/community/Ebizmarts/MageMonkey/Model/Mysql4/Bulksync/Import.php +11 -12
- app/code/community/Ebizmarts/MageMonkey/Model/Mysql4/Bulksync/Import/Collection.php +12 -13
- app/code/community/Ebizmarts/MageMonkey/Model/Mysql4/Ecommerce.php +5 -6
- app/code/community/Ebizmarts/MageMonkey/Model/Mysql4/Ecommerce/Collection.php +5 -6
- app/code/community/Ebizmarts/MageMonkey/Model/Observer.php +354 -361
- app/code/community/Ebizmarts/MageMonkey/Model/Subscriber.php +7 -10
- app/code/community/Ebizmarts/MageMonkey/Model/System/Config/Source/Account.php +19 -20
- app/code/community/Ebizmarts/MageMonkey/Model/System/Config/Source/Attributes.php +24 -25
- app/code/community/Ebizmarts/MageMonkey/Model/System/Config/Source/BulksyncDatasource.php +1 -2
- app/code/community/Ebizmarts/MageMonkey/Model/System/Config/Source/BulksyncStatus.php +12 -13
- app/code/community/Ebizmarts/MageMonkey/Model/System/Config/Source/Checkoutsubscribe.php +0 -1
- app/code/community/Ebizmarts/MageMonkey/Model/System/Config/Source/CronProcessLimit.php +0 -1
- app/code/community/Ebizmarts/MageMonkey/Model/System/Config/Source/CustomerGroup.php +18 -17
- app/code/community/Ebizmarts/MageMonkey/Model/System/Config/Source/Ecommerce360.php +1 -2
- app/code/community/Ebizmarts/MageMonkey/Model/System/Config/Source/List.php +29 -30
- app/code/community/Ebizmarts/MageMonkey/Model/System/Config/Source/OrderProcessLimit.php +1 -1
- app/code/community/Ebizmarts/MageMonkey/Model/System/Config/Source/OrderStatus.php +4 -5
- app/code/community/Ebizmarts/MageMonkey/Model/System/Config/Source/Status.php +1 -2
- app/code/community/Ebizmarts/MageMonkey/Model/System/Config/Source/TransactionalEmails.php +10 -11
- app/code/community/Ebizmarts/MageMonkey/Model/System/Config/Source/WebhookDelete.php +0 -1
- app/code/community/Ebizmarts/MageMonkey/Model/TransactionalEmail/Adapter.php +2 -3
- app/code/community/Ebizmarts/MageMonkey/Model/TransactionalEmail/MANDRILL.php +246 -247
- app/code/community/Ebizmarts/MageMonkey/Model/TransactionalEmail/STS.php +153 -154
- app/code/community/Ebizmarts/MageMonkey/controllers/Adminhtml/BulksyncController.php +114 -119
- app/code/community/Ebizmarts/MageMonkey/controllers/Adminhtml/ConfigController.php +16 -18
- app/code/community/Ebizmarts/MageMonkey/controllers/Adminhtml/EcommerceController.php +73 -85
- app/code/community/Ebizmarts/MageMonkey/controllers/Adminhtml/TransactionalemailController.php +91 -92
- app/code/community/Ebizmarts/MageMonkey/controllers/Customer/AccountController.php +6 -7
- app/code/community/Ebizmarts/MageMonkey/controllers/SignupController.php +26 -27
- app/code/community/Ebizmarts/MageMonkey/controllers/WebhookController.php +35 -37
- app/code/community/Ebizmarts/MageMonkey/etc/adminhtml.xml +50 -50
- app/code/community/Ebizmarts/MageMonkey/etc/config.xml +135 -93
- app/code/community/Ebizmarts/MageMonkey/etc/system.xml +37 -25
- app/code/community/Ebizmarts/Mandrill/Block/Adminhtml/System/Config/Fieldset/Hint.php +18 -15
- app/code/community/Ebizmarts/Mandrill/Block/Adminhtml/System/Config/Userinfo.php +11 -10
- app/code/community/Ebizmarts/Mandrill/Block/Adminhtml/Templates/Templates.php +13 -12
- app/code/community/Ebizmarts/Mandrill/Block/Adminhtml/Templates/Templates/Grid.php +90 -89
- app/code/community/Ebizmarts/Mandrill/Block/Adminhtml/Users/Senders.php +0 -1
- app/code/community/Ebizmarts/Mandrill/Block/Adminhtml/Users/Senders/Grid.php +17 -18
- app/code/community/Ebizmarts/Mandrill/Helper/Data.php +48 -45
- app/code/community/Ebizmarts/Mandrill/Model/Customcollection.php +43 -41
- app/code/community/Ebizmarts/Mandrill/Model/Email/Template.php +38 -42
- app/code/community/Ebizmarts/Mandrill/Model/System/Config.php +4 -3
- app/code/community/Ebizmarts/Mandrill/Model/System/Config/Source/Userinfo.php +11 -11
- app/code/community/Ebizmarts/Mandrill/controllers/Adminhtml/Mandrill/UsersController.php +13 -11
- app/code/community/Ebizmarts/Mandrill/etc/system.xml +2 -1
- app/code/community/Ebizmarts/SweetMonkey/Block/Adminhtml/System/Config/Autovars.php +12 -8
- app/code/community/Ebizmarts/SweetMonkey/Block/Adminhtml/System/Config/Fieldset/Hint.php +21 -17
- app/code/community/Ebizmarts/SweetMonkey/Block/Adminhtml/System/Config/Form/Field/Mapfields.php +7 -5
- app/code/community/Ebizmarts/SweetMonkey/Helper/Data.php +21 -17
- app/code/community/Ebizmarts/SweetMonkey/Model/Cron.php +20 -75
- app/code/community/Ebizmarts/SweetMonkey/Model/Observer.php +58 -32
- app/code/community/Ebizmarts/SweetMonkey/controllers/Adminhtml/MageMonkeyController.php +8 -6
- app/code/community/Ebizmarts/SweetMonkey/etc/adminhtml.xml +19 -19
- app/code/community/Ebizmarts/SweetMonkey/etc/config.xml +59 -66
- app/code/community/Ebizmarts/SweetMonkey/etc/system.xml +2 -1
- app/design/adminhtml/default/default/layout/ebizmarts/abandonedcart.xml +20 -10
- app/design/adminhtml/default/default/layout/ebizmarts/mandrill.xml +6 -2
- app/design/adminhtml/default/default/layout/magemonkey.xml +59 -36
- app/design/adminhtml/default/default/template/ebizmarts/abandonedcart/dashboard/index.phtml +10 -9
- app/design/adminhtml/default/default/template/ebizmarts/abandonedcart/dashboard/salebar.phtml +9 -8
- app/design/adminhtml/default/default/template/ebizmarts/abandonedcart/dashboard/totalbar.phtml +49 -37
- app/design/adminhtml/default/default/template/ebizmarts/abandonedcart/system/config/fieldset/hint.phtml +6 -4
- app/design/adminhtml/default/default/template/ebizmarts/autoresponder/system/config/backtostock/fieldset/hint.phtml +5 -3
- app/design/adminhtml/default/default/template/ebizmarts/autoresponder/system/config/birthday/fieldset/hint.phtml +3 -2
- app/design/adminhtml/default/default/template/ebizmarts/autoresponder/system/config/fieldset/hint.phtml +6 -4
- app/design/adminhtml/default/default/template/ebizmarts/autoresponder/system/config/review/fieldset/hint.phtml +3 -2
- app/design/adminhtml/default/default/template/ebizmarts/autoresponder/system/config/wishlist/fieldset/hint.phtml +3 -2
- app/design/adminhtml/default/default/template/ebizmarts/mandrill/system/config/fieldset/hint.phtml +3 -3
- app/design/adminhtml/default/default/template/magemonkey/system/config/fieldset/hint.phtml +3 -3
- app/design/adminhtml/default/default/template/magemonkey/system/config/oauth_wizard.phtml +3 -1
- app/design/adminhtml/default/default/template/magemonkey/system/config/resetlocal360.phtml +13 -14
- app/design/adminhtml/default/default/template/magemonkey/system/config/resetremote360.phtml +3 -3
- app/design/adminhtml/default/default/template/sweetmonkey/system/config/autovars.phtml +55 -50
- app/design/adminhtml/default/default/template/sweetmonkey/system/config/fieldset/hint.phtml +2 -2
- app/design/frontend/base/default/layout/ebizmarts/abandonedcart.xml +29 -9
- app/design/frontend/base/default/layout/ebizmarts/autoresponder.xml +28 -12
- app/design/frontend/base/default/layout/magemonkey.xml +45 -34
- app/design/frontend/base/default/template/ebizmarts/autoresponder/backtostock/catalog/product/form.phtml +17 -10
- app/design/frontend/base/default/template/ebizmarts/autoresponder/backtostock/catalog/product/notice.phtml +6 -5
- app/design/frontend/base/default/template/ebizmarts/autoresponder/backtostock/item.phtml +30 -25
- app/design/frontend/base/default/template/ebizmarts/autoresponder/customer/list.phtml +12 -8
- app/design/frontend/base/default/template/ebizmarts/autoresponder/related/items.phtml +24 -19
- app/design/frontend/base/default/template/ebizmarts/autoresponder/review/items.phtml +25 -19
- app/design/frontend/base/default/template/ebizmarts/autoresponder/unsubscribe.phtml +3 -1
- app/design/frontend/base/default/template/ebizmarts/autoresponder/wishlist/items.phtml +13 -6
- app/design/frontend/base/default/template/ebizmarts_abandonedcart/email/order/items.phtml +58 -54
- app/design/frontend/base/default/template/ebizmarts_abandonedcart/email/order/items/order/default.phtml +85 -67
- app/design/frontend/base/default/template/ebizmarts_abandonedcart/popup/emailcatcher.phtml +99 -93
- app/design/frontend/base/default/template/magemonkey/checkout/subscribe.phtml +120 -75
app/code/community/Ebizmarts/AbandonedCart/Block/Adminhtml/Abandonedmails.php
CHANGED
@@ -7,7 +7,6 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_AbandonedCart_Block_Adminhtml_Abandonedmails extends Mage_Adminhtml_Block_Widget_Grid_Container
|
12 |
{
|
13 |
public function __construct()
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_AbandonedCart_Block_Adminhtml_Abandonedmails extends Mage_Adminhtml_Block_Widget_Grid_Container
|
11 |
{
|
12 |
public function __construct()
|
app/code/community/Ebizmarts/AbandonedCart/Block/Adminhtml/Abandonedmails/Grid.php
CHANGED
@@ -7,7 +7,6 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_AbandonedCart_Block_Adminhtml_Abandonedmails_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
12 |
{
|
13 |
public function __construct()
|
@@ -32,6 +31,7 @@ class Ebizmarts_AbandonedCart_Block_Adminhtml_Abandonedmails_Grid extends Mage_A
|
|
32 |
$this->setCollection($collection);
|
33 |
return parent::_prepareCollection();
|
34 |
}
|
|
|
35 |
protected function _prepareColumns()
|
36 |
{
|
37 |
|
@@ -88,13 +88,13 @@ class Ebizmarts_AbandonedCart_Block_Adminhtml_Abandonedmails_Grid extends Mage_A
|
|
88 |
|
89 |
public function getGridUrl()
|
90 |
{
|
91 |
-
return $this->getUrl('*/*/grid', array('_current'=>true));
|
92 |
}
|
93 |
|
94 |
protected function getMailTypeOptions()
|
95 |
{
|
96 |
-
return array('abandoned cart'=>'abandoned cart','happy birthday'=>'happy birthday','new order'=>'new order', 'related products'=>'related products',
|
97 |
-
'product review'=>'product review', 'no activity'=>'no activity', 'wishlist'=>'wishlist', 'review coupon' => 'review coupon'
|
98 |
}
|
99 |
|
100 |
}
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_AbandonedCart_Block_Adminhtml_Abandonedmails_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
11 |
{
|
12 |
public function __construct()
|
31 |
$this->setCollection($collection);
|
32 |
return parent::_prepareCollection();
|
33 |
}
|
34 |
+
|
35 |
protected function _prepareColumns()
|
36 |
{
|
37 |
|
88 |
|
89 |
public function getGridUrl()
|
90 |
{
|
91 |
+
return $this->getUrl('*/*/grid', array('_current' => true));
|
92 |
}
|
93 |
|
94 |
protected function getMailTypeOptions()
|
95 |
{
|
96 |
+
return array('abandoned cart' => 'abandoned cart', 'happy birthday' => 'happy birthday', 'new order' => 'new order', 'related products' => 'related products',
|
97 |
+
'product review' => 'product review', 'no activity' => 'no activity', 'wishlist' => 'wishlist', 'review coupon' => 'review coupon', 'back to stock' => 'back to stock');
|
98 |
}
|
99 |
|
100 |
}
|
app/code/community/Ebizmarts/AbandonedCart/Block/Adminhtml/Abandonedorder.php
CHANGED
@@ -7,7 +7,6 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_AbandonedCart_Block_Adminhtml_Abandonedorder extends Mage_Adminhtml_Block_Widget_Grid_Container
|
12 |
{
|
13 |
public function __construct()
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_AbandonedCart_Block_Adminhtml_Abandonedorder extends Mage_Adminhtml_Block_Widget_Grid_Container
|
11 |
{
|
12 |
public function __construct()
|
app/code/community/Ebizmarts/AbandonedCart/Block/Adminhtml/Abandonedorder/Grid.php
CHANGED
@@ -7,7 +7,6 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_AbandonedCart_Block_Adminhtml_Abandonedorder_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
12 |
{
|
13 |
/**
|
@@ -41,8 +40,8 @@ class Ebizmarts_AbandonedCart_Block_Adminhtml_Abandonedorder_Grid extends Mage_A
|
|
41 |
$collection = Mage::getResourceModel($this->_getCollectionClass());
|
42 |
$this->setCollection($collection);
|
43 |
$sales_flat_order_table = Mage::getSingleton('core/resource')->getTableName('sales_flat_order');
|
44 |
-
$collection->getSelect()->join($sales_flat_order_table
|
45 |
-
$collection->addFieldToFilter($sales_flat_order_table.'.ebizmarts_abandonedcart_flag',array('eq' => 1));
|
46 |
return parent::_prepareCollection();
|
47 |
}
|
48 |
|
@@ -53,19 +52,19 @@ class Ebizmarts_AbandonedCart_Block_Adminhtml_Abandonedorder_Grid extends Mage_A
|
|
53 |
{
|
54 |
|
55 |
$this->addColumn('real_order_id', array(
|
56 |
-
'header'=> Mage::helper('sales')->__('Order #'),
|
57 |
'width' => '80px',
|
58 |
-
'type'
|
59 |
'index' => 'increment_id',
|
60 |
));
|
61 |
|
62 |
if (!Mage::app()->isSingleStoreMode()) {
|
63 |
$this->addColumn('store_id', array(
|
64 |
-
'header'
|
65 |
-
'index'
|
66 |
'filter_index' => 'main_table.store_id',
|
67 |
-
'type'
|
68 |
-
'store_view'=> true,
|
69 |
'display_deleted' => true,
|
70 |
));
|
71 |
}
|
@@ -91,21 +90,21 @@ class Ebizmarts_AbandonedCart_Block_Adminhtml_Abandonedorder_Grid extends Mage_A
|
|
91 |
$this->addColumn('base_grand_total', array(
|
92 |
'header' => Mage::helper('sales')->__('G.T. (Base)'),
|
93 |
'index' => 'base_grand_total',
|
94 |
-
'type'
|
95 |
'currency' => 'base_currency_code',
|
96 |
));
|
97 |
|
98 |
$this->addColumn('grand_total', array(
|
99 |
'header' => Mage::helper('sales')->__('G.T. (Purchased)'),
|
100 |
'index' => 'grand_total',
|
101 |
-
'type'
|
102 |
'currency' => 'order_currency_code',
|
103 |
));
|
104 |
|
105 |
$this->addColumn('status', array(
|
106 |
'header' => Mage::helper('sales')->__('Status'),
|
107 |
'index' => 'main_table.status',
|
108 |
-
'type'
|
109 |
'width' => '70px',
|
110 |
'options' => Mage::getSingleton('sales/order_config')->getStatuses(),
|
111 |
));
|
@@ -146,6 +145,6 @@ class Ebizmarts_AbandonedCart_Block_Adminhtml_Abandonedorder_Grid extends Mage_A
|
|
146 |
*/
|
147 |
public function getGridUrl()
|
148 |
{
|
149 |
-
return $this->getUrl('*/*/grid', array('_current'=>true));
|
150 |
}
|
151 |
}
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_AbandonedCart_Block_Adminhtml_Abandonedorder_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
11 |
{
|
12 |
/**
|
40 |
$collection = Mage::getResourceModel($this->_getCollectionClass());
|
41 |
$this->setCollection($collection);
|
42 |
$sales_flat_order_table = Mage::getSingleton('core/resource')->getTableName('sales_flat_order');
|
43 |
+
$collection->getSelect()->join($sales_flat_order_table, 'main_table.increment_id = ' . $sales_flat_order_table . '.increment_id', 'ebizmarts_abandonedcart_flag');
|
44 |
+
$collection->addFieldToFilter($sales_flat_order_table . '.ebizmarts_abandonedcart_flag', array('eq' => 1));
|
45 |
return parent::_prepareCollection();
|
46 |
}
|
47 |
|
52 |
{
|
53 |
|
54 |
$this->addColumn('real_order_id', array(
|
55 |
+
'header' => Mage::helper('sales')->__('Order #'),
|
56 |
'width' => '80px',
|
57 |
+
'type' => 'text',
|
58 |
'index' => 'increment_id',
|
59 |
));
|
60 |
|
61 |
if (!Mage::app()->isSingleStoreMode()) {
|
62 |
$this->addColumn('store_id', array(
|
63 |
+
'header' => Mage::helper('sales')->__('Purchased From (Store)'),
|
64 |
+
'index' => 'store_id',
|
65 |
'filter_index' => 'main_table.store_id',
|
66 |
+
'type' => 'store',
|
67 |
+
'store_view' => true,
|
68 |
'display_deleted' => true,
|
69 |
));
|
70 |
}
|
90 |
$this->addColumn('base_grand_total', array(
|
91 |
'header' => Mage::helper('sales')->__('G.T. (Base)'),
|
92 |
'index' => 'base_grand_total',
|
93 |
+
'type' => 'currency',
|
94 |
'currency' => 'base_currency_code',
|
95 |
));
|
96 |
|
97 |
$this->addColumn('grand_total', array(
|
98 |
'header' => Mage::helper('sales')->__('G.T. (Purchased)'),
|
99 |
'index' => 'grand_total',
|
100 |
+
'type' => 'currency',
|
101 |
'currency' => 'order_currency_code',
|
102 |
));
|
103 |
|
104 |
$this->addColumn('status', array(
|
105 |
'header' => Mage::helper('sales')->__('Status'),
|
106 |
'index' => 'main_table.status',
|
107 |
+
'type' => 'options',
|
108 |
'width' => '70px',
|
109 |
'options' => Mage::getSingleton('sales/order_config')->getStatuses(),
|
110 |
));
|
145 |
*/
|
146 |
public function getGridUrl()
|
147 |
{
|
148 |
+
return $this->getUrl('*/*/grid', array('_current' => true));
|
149 |
}
|
150 |
}
|
app/code/community/Ebizmarts/AbandonedCart/Block/Adminhtml/Dashboard.php
CHANGED
@@ -7,7 +7,6 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_AbandonedCart_Block_Adminhtml_Dashboard extends Mage_Adminhtml_Block_Template
|
12 |
{
|
13 |
public function __construct()
|
@@ -17,7 +16,8 @@ class Ebizmarts_AbandonedCart_Block_Adminhtml_Dashboard extends Mage_Adminhtml_B
|
|
17 |
$this->setTemplate('ebizmarts/abandonedcart/dashboard/index.phtml');
|
18 |
|
19 |
}
|
20 |
-
|
|
|
21 |
{
|
22 |
$this->setChild('sales',
|
23 |
$this->getLayout()->createBlock('ebizmarts_abandonedcart/adminhtml_dashboard_sales')
|
@@ -28,9 +28,10 @@ class Ebizmarts_AbandonedCart_Block_Adminhtml_Dashboard extends Mage_Adminhtml_B
|
|
28 |
|
29 |
|
30 |
}
|
|
|
31 |
public function ajaxBlockAction()
|
32 |
{
|
33 |
-
$output
|
34 |
$blockTab = $this->getRequest()->getParam('block');
|
35 |
if (in_array($blockTab, array('totals'))) {
|
36 |
$output = $this->getLayout()->createBlock('ebizmarts_abandonedcart/adminhtml_dashboard_' . $blockTab)->toHtml();
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_AbandonedCart_Block_Adminhtml_Dashboard extends Mage_Adminhtml_Block_Template
|
11 |
{
|
12 |
public function __construct()
|
16 |
$this->setTemplate('ebizmarts/abandonedcart/dashboard/index.phtml');
|
17 |
|
18 |
}
|
19 |
+
|
20 |
+
protected function _prepareLayout()
|
21 |
{
|
22 |
$this->setChild('sales',
|
23 |
$this->getLayout()->createBlock('ebizmarts_abandonedcart/adminhtml_dashboard_sales')
|
28 |
|
29 |
|
30 |
}
|
31 |
+
|
32 |
public function ajaxBlockAction()
|
33 |
{
|
34 |
+
$output = '';
|
35 |
$blockTab = $this->getRequest()->getParam('block');
|
36 |
if (in_array($blockTab, array('totals'))) {
|
37 |
$output = $this->getLayout()->createBlock('ebizmarts_abandonedcart/adminhtml_dashboard_' . $blockTab)->toHtml();
|
app/code/community/Ebizmarts/AbandonedCart/Block/Adminhtml/Dashboard/Sales.php
CHANGED
@@ -7,7 +7,6 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_AbandonedCart_Block_Adminhtml_Dashboard_Sales extends Mage_Adminhtml_Block_Dashboard_Bar
|
12 |
{
|
13 |
/**
|
@@ -34,15 +33,15 @@ class Ebizmarts_AbandonedCart_Block_Adminhtml_Dashboard_Sales extends Mage_Admin
|
|
34 |
$collection = Mage::getResourceModel('ebizmarts_abandonedcart/order_collection')
|
35 |
->calculateSales($isFilter);
|
36 |
// $collection->getSelect()->join('sales_flat_quote' , 'main_table.increment_id = sales_flat_quote.reserved_order_id', 'ebizmarts_abandonedcart_flag');
|
37 |
-
$collection->addFieldToFilter('main_table.ebizmarts_abandonedcart_flag',array('eq' => 1));
|
38 |
|
39 |
|
40 |
if ($this->getRequest()->getParam('store')) {
|
41 |
$collection->addFieldToFilter('main_table.store_id', $this->getRequest()->getParam('store'));
|
42 |
-
} else if ($this->getRequest()->getParam('website')){
|
43 |
$storeIds = Mage::app()->getWebsite($this->getRequest()->getParam('website'))->getStoreIds();
|
44 |
$collection->addFieldToFilter('main_table.store_id', array('in' => $storeIds));
|
45 |
-
} else if ($this->getRequest()->getParam('group')){
|
46 |
$storeIds = Mage::app()->getGroup($this->getRequest()->getParam('group'))->getStoreIds();
|
47 |
$collection->addFieldToFilter('main_table.store_id', array('in' => $storeIds));
|
48 |
}
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_AbandonedCart_Block_Adminhtml_Dashboard_Sales extends Mage_Adminhtml_Block_Dashboard_Bar
|
11 |
{
|
12 |
/**
|
33 |
$collection = Mage::getResourceModel('ebizmarts_abandonedcart/order_collection')
|
34 |
->calculateSales($isFilter);
|
35 |
// $collection->getSelect()->join('sales_flat_quote' , 'main_table.increment_id = sales_flat_quote.reserved_order_id', 'ebizmarts_abandonedcart_flag');
|
36 |
+
$collection->addFieldToFilter('main_table.ebizmarts_abandonedcart_flag', array('eq' => 1));
|
37 |
|
38 |
|
39 |
if ($this->getRequest()->getParam('store')) {
|
40 |
$collection->addFieldToFilter('main_table.store_id', $this->getRequest()->getParam('store'));
|
41 |
+
} else if ($this->getRequest()->getParam('website')) {
|
42 |
$storeIds = Mage::app()->getWebsite($this->getRequest()->getParam('website'))->getStoreIds();
|
43 |
$collection->addFieldToFilter('main_table.store_id', array('in' => $storeIds));
|
44 |
+
} else if ($this->getRequest()->getParam('group')) {
|
45 |
$storeIds = Mage::app()->getGroup($this->getRequest()->getParam('group'))->getStoreIds();
|
46 |
$collection->addFieldToFilter('main_table.store_id', array('in' => $storeIds));
|
47 |
}
|
app/code/community/Ebizmarts/AbandonedCart/Block/Adminhtml/Dashboard/Totals.php
CHANGED
@@ -7,7 +7,6 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_AbandonedCart_Block_Adminhtml_Dashboard_Totals extends Mage_Adminhtml_Block_Dashboard_Bar
|
12 |
{
|
13 |
/**
|
@@ -31,19 +30,18 @@ class Ebizmarts_AbandonedCart_Block_Adminhtml_Dashboard_Totals extends Mage_Admi
|
|
31 |
$period = $this->getRequest()->getParam('period', '24h');
|
32 |
|
33 |
$collection = Mage::getResourceModel('ebizmarts_abandonedcart/order_collection')
|
34 |
-
|
35 |
-
|
36 |
// $collection->getSelect()->join('sales_flat_quote' , 'main_table.increment_id = sales_flat_quote.reserved_order_id', 'ebizmarts_abandonedcart_flag');
|
37 |
-
$collection->addFieldToFilter('main_table.ebizmarts_abandonedcart_flag',array('eq' => 1));
|
38 |
-
|
39 |
|
40 |
|
41 |
if ($this->getRequest()->getParam('store')) {
|
42 |
$collection->addFieldToFilter('main_table.store_id', $this->getRequest()->getParam('store'));
|
43 |
-
} else if ($this->getRequest()->getParam('website')){
|
44 |
$storeIds = Mage::app()->getWebsite($this->getRequest()->getParam('website'))->getStoreIds();
|
45 |
$collection->addFieldToFilter('main_table.store_id', array('in' => $storeIds));
|
46 |
-
} else if ($this->getRequest()->getParam('group')){
|
47 |
$storeIds = Mage::app()->getGroup($this->getRequest()->getParam('group'))->getStoreIds();
|
48 |
$collection->addFieldToFilter('main_table.store_id', array('in' => $storeIds));
|
49 |
} elseif (!$collection->isLive()) {
|
@@ -62,10 +60,10 @@ class Ebizmarts_AbandonedCart_Block_Adminhtml_Dashboard_Totals extends Mage_Admi
|
|
62 |
->calculateTotals($isFilter);
|
63 |
if ($this->getRequest()->getParam('store')) {
|
64 |
$collection2->addFieldToFilter('store_id', $this->getRequest()->getParam('store'));
|
65 |
-
} else if ($this->getRequest()->getParam('website')){
|
66 |
$storeIds = Mage::app()->getWebsite($this->getRequest()->getParam('website'))->getStoreIds();
|
67 |
$collection2->addFieldToFilter('store_id', array('in' => $storeIds));
|
68 |
-
} else if ($this->getRequest()->getParam('group')){
|
69 |
$storeIds = Mage::app()->getGroup($this->getRequest()->getParam('group'))->getStoreIds();
|
70 |
$collection2->addFieldToFilter('store_id', array('in' => $storeIds));
|
71 |
} elseif (!$collection2->isLive()) {
|
@@ -79,30 +77,30 @@ class Ebizmarts_AbandonedCart_Block_Adminhtml_Dashboard_Totals extends Mage_Admi
|
|
79 |
$totals2 = $collection2->getFirstItem();
|
80 |
|
81 |
// add totals for generated orders
|
82 |
-
if($totals2->getQuantity()) {
|
83 |
-
$convrate = (string)($totals->getQuantity()*100
|
84 |
-
$convrate = round($convrate*100)/100;
|
85 |
-
}
|
86 |
-
else {
|
87 |
$convrate = 0;
|
88 |
}
|
89 |
-
$this->addTotal($this->__('Generated Revenue')
|
90 |
$this->addTotal($this->__('Generated Tax'), $totals->getTax());
|
91 |
$this->addTotal($this->__('Generated Shipping'), $totals->getShipping());
|
92 |
-
$this->addTotal($this->__('Generated Orders')
|
93 |
-
$this->addTotal($this->__('Generated Conv. Rate')
|
94 |
// get Mandrill statistics
|
95 |
-
if(Mage::helper('core')->isModuleEnabled('Ebizmarts_Mandrill')
|
96 |
&& (version_compare(Mage::getConfig()->getNode()->modules->Ebizmarts_Mandrill->version, '1.0.4', '>'))
|
97 |
-
&& Mage::helper('ebizmarts_mandrill')->useTransactionalService()
|
98 |
-
|
99 |
-
|
|
|
100 |
$stores = Mage::app()->getStores();
|
101 |
$__particular = $particular;
|
102 |
-
foreach($stores as $__store => $val) {
|
103 |
$storeid = Mage::app()->getStore($__store)->getId();
|
104 |
-
$aux = $this->__getMandrillStatistics($period
|
105 |
-
if($aux && !isset($aux['status'])) {
|
106 |
$__particular['sent'] += $aux['sent'];
|
107 |
$__particular['soft_bounces'] += $aux['soft_bounces'];
|
108 |
$__particular['hard_bounces'] += $aux['hard_bounces'];
|
@@ -111,15 +109,14 @@ class Ebizmarts_AbandonedCart_Block_Adminhtml_Dashboard_Totals extends Mage_Admi
|
|
111 |
}
|
112 |
}
|
113 |
$particular = $__particular;
|
114 |
-
}
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
$particular = $this->__getMandrillStatistics($period,$this->getRequest()->getParam('store'));
|
119 |
}
|
120 |
}
|
121 |
// add totals for emails
|
122 |
-
if($particular) {
|
123 |
|
124 |
$_sent = $particular['sent'];
|
125 |
$_hard_bounces = $particular['hard_bounces'];
|
@@ -129,35 +126,35 @@ class Ebizmarts_AbandonedCart_Block_Adminhtml_Dashboard_Totals extends Mage_Admi
|
|
129 |
|
130 |
//Emails Sent and Received
|
131 |
$aux = $_sent - $_hard_bounces; // - $particular['soft_bounces'];
|
132 |
-
if($aux > 0) {
|
133 |
-
$aux2 = $aux/ $_sent*100;
|
134 |
-
}else{
|
135 |
$aux2 = 0;
|
136 |
}
|
137 |
$received = sprintf('%d (%2.2f%%)', $aux, $aux2);
|
138 |
|
139 |
-
$this->addTotal($this->__('Emails Sent'), $_sent,true);
|
140 |
-
$this->addTotal($this->__('Emails Received'), $received,true);
|
141 |
|
142 |
//Emails Opened
|
143 |
-
if($_unique_opens > 0) {
|
144 |
-
$emailsOpened = $_unique_opens / $_sent*100;
|
145 |
-
}else{
|
146 |
$emailsOpened = 0;
|
147 |
}
|
148 |
|
149 |
$opens = sprintf('%d (%2.2f%%)', $_unique_opens, $emailsOpened);
|
150 |
-
$this->addTotal($this->__('Emails Opened')
|
151 |
|
152 |
//Emails Clicked
|
153 |
-
if($_unique_clicks > 0){
|
154 |
-
$emailsClicked = $_unique_clicks / $_unique_opens*100;
|
155 |
-
}else{
|
156 |
$emailsClicked = 0;
|
157 |
}
|
158 |
|
159 |
$clicks = sprintf('%d (%2.2f%%)', $_unique_clicks, $emailsClicked);
|
160 |
-
$this->addTotal($this->__('Emails Clicked'), $clicks,true);
|
161 |
}
|
162 |
}
|
163 |
}
|
@@ -167,16 +164,16 @@ class Ebizmarts_AbandonedCart_Block_Adminhtml_Dashboard_Totals extends Mage_Admi
|
|
167 |
* @param $store
|
168 |
* @return array|bool
|
169 |
*/
|
170 |
-
private function __getMandrillStatistics($period
|
171 |
{
|
172 |
-
$api = new Mandrill_Message(Mage::getStoreConfig(Ebizmarts_Mandrill_Model_System_Config::APIKEY
|
173 |
-
$mandrillTag = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::MANDRILL_TAG, $store)."_$store";
|
174 |
$tags = $api->tags->info($mandrillTag);
|
175 |
-
if(!$tags) {
|
176 |
return false;
|
177 |
}
|
178 |
$general = (array)$tags;
|
179 |
-
switch($period) {
|
180 |
case '24h':
|
181 |
$index = 'today';
|
182 |
break;
|
@@ -197,7 +194,7 @@ class Ebizmarts_AbandonedCart_Block_Adminhtml_Dashboard_Totals extends Mage_Admi
|
|
197 |
return $general;
|
198 |
|
199 |
}
|
200 |
-
if(!isset($general['stats'])){
|
201 |
return false;
|
202 |
}
|
203 |
$stats = (array)$general['stats'];
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_AbandonedCart_Block_Adminhtml_Dashboard_Totals extends Mage_Adminhtml_Block_Dashboard_Bar
|
11 |
{
|
12 |
/**
|
30 |
$period = $this->getRequest()->getParam('period', '24h');
|
31 |
|
32 |
$collection = Mage::getResourceModel('ebizmarts_abandonedcart/order_collection')
|
33 |
+
->addCreateAtPeriodFilter($period)
|
34 |
+
->calculateTotals($isFilter);
|
35 |
// $collection->getSelect()->join('sales_flat_quote' , 'main_table.increment_id = sales_flat_quote.reserved_order_id', 'ebizmarts_abandonedcart_flag');
|
36 |
+
$collection->addFieldToFilter('main_table.ebizmarts_abandonedcart_flag', array('eq' => 1));
|
|
|
37 |
|
38 |
|
39 |
if ($this->getRequest()->getParam('store')) {
|
40 |
$collection->addFieldToFilter('main_table.store_id', $this->getRequest()->getParam('store'));
|
41 |
+
} else if ($this->getRequest()->getParam('website')) {
|
42 |
$storeIds = Mage::app()->getWebsite($this->getRequest()->getParam('website'))->getStoreIds();
|
43 |
$collection->addFieldToFilter('main_table.store_id', array('in' => $storeIds));
|
44 |
+
} else if ($this->getRequest()->getParam('group')) {
|
45 |
$storeIds = Mage::app()->getGroup($this->getRequest()->getParam('group'))->getStoreIds();
|
46 |
$collection->addFieldToFilter('main_table.store_id', array('in' => $storeIds));
|
47 |
} elseif (!$collection->isLive()) {
|
60 |
->calculateTotals($isFilter);
|
61 |
if ($this->getRequest()->getParam('store')) {
|
62 |
$collection2->addFieldToFilter('store_id', $this->getRequest()->getParam('store'));
|
63 |
+
} else if ($this->getRequest()->getParam('website')) {
|
64 |
$storeIds = Mage::app()->getWebsite($this->getRequest()->getParam('website'))->getStoreIds();
|
65 |
$collection2->addFieldToFilter('store_id', array('in' => $storeIds));
|
66 |
+
} else if ($this->getRequest()->getParam('group')) {
|
67 |
$storeIds = Mage::app()->getGroup($this->getRequest()->getParam('group'))->getStoreIds();
|
68 |
$collection2->addFieldToFilter('store_id', array('in' => $storeIds));
|
69 |
} elseif (!$collection2->isLive()) {
|
77 |
$totals2 = $collection2->getFirstItem();
|
78 |
|
79 |
// add totals for generated orders
|
80 |
+
if ($totals2->getQuantity()) {
|
81 |
+
$convrate = (string)($totals->getQuantity() * 100 / $totals2->getQuantity());
|
82 |
+
$convrate = round($convrate * 100) / 100;
|
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 |
&& (version_compare(Mage::getConfig()->getNode()->modules->Ebizmarts_Mandrill->version, '1.0.4', '>'))
|
94 |
+
&& Mage::helper('ebizmarts_mandrill')->useTransactionalService()
|
95 |
+
) {
|
96 |
+
$particular = array('sent' => 0, 'soft_bounces' => 0, 'hard_bounces' => 0, 'unique_opens' => 0, 'unique_clicks' => 0);
|
97 |
+
if (!$isFilter) {
|
98 |
$stores = Mage::app()->getStores();
|
99 |
$__particular = $particular;
|
100 |
+
foreach ($stores as $__store => $val) {
|
101 |
$storeid = Mage::app()->getStore($__store)->getId();
|
102 |
+
$aux = $this->__getMandrillStatistics($period, $storeid);
|
103 |
+
if ($aux && !isset($aux['status'])) {
|
104 |
$__particular['sent'] += $aux['sent'];
|
105 |
$__particular['soft_bounces'] += $aux['soft_bounces'];
|
106 |
$__particular['hard_bounces'] += $aux['hard_bounces'];
|
109 |
}
|
110 |
}
|
111 |
$particular = $__particular;
|
112 |
+
} else {
|
113 |
+
$data = $this->__getMandrillStatistics($period, $this->getRequest()->getParam('store'));
|
114 |
+
if (!isset($data['status'])) {
|
115 |
+
$particular = $this->__getMandrillStatistics($period, $this->getRequest()->getParam('store'));
|
|
|
116 |
}
|
117 |
}
|
118 |
// add totals for emails
|
119 |
+
if ($particular) {
|
120 |
|
121 |
$_sent = $particular['sent'];
|
122 |
$_hard_bounces = $particular['hard_bounces'];
|
126 |
|
127 |
//Emails Sent and Received
|
128 |
$aux = $_sent - $_hard_bounces; // - $particular['soft_bounces'];
|
129 |
+
if ($aux > 0) {
|
130 |
+
$aux2 = $aux / $_sent * 100;
|
131 |
+
} else {
|
132 |
$aux2 = 0;
|
133 |
}
|
134 |
$received = sprintf('%d (%2.2f%%)', $aux, $aux2);
|
135 |
|
136 |
+
$this->addTotal($this->__('Emails Sent'), $_sent, true);
|
137 |
+
$this->addTotal($this->__('Emails Received'), $received, true);
|
138 |
|
139 |
//Emails Opened
|
140 |
+
if ($_unique_opens > 0) {
|
141 |
+
$emailsOpened = $_unique_opens / $_sent * 100;
|
142 |
+
} else {
|
143 |
$emailsOpened = 0;
|
144 |
}
|
145 |
|
146 |
$opens = sprintf('%d (%2.2f%%)', $_unique_opens, $emailsOpened);
|
147 |
+
$this->addTotal($this->__('Emails Opened'), $opens, true);
|
148 |
|
149 |
//Emails Clicked
|
150 |
+
if ($_unique_clicks > 0) {
|
151 |
+
$emailsClicked = $_unique_clicks / $_unique_opens * 100;
|
152 |
+
} else {
|
153 |
$emailsClicked = 0;
|
154 |
}
|
155 |
|
156 |
$clicks = sprintf('%d (%2.2f%%)', $_unique_clicks, $emailsClicked);
|
157 |
+
$this->addTotal($this->__('Emails Clicked'), $clicks, true);
|
158 |
}
|
159 |
}
|
160 |
}
|
164 |
* @param $store
|
165 |
* @return array|bool
|
166 |
*/
|
167 |
+
private function __getMandrillStatistics($period, $store)
|
168 |
{
|
169 |
+
$api = new Mandrill_Message(Mage::getStoreConfig(Ebizmarts_Mandrill_Model_System_Config::APIKEY, $store));
|
170 |
+
$mandrillTag = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::MANDRILL_TAG, $store) . "_$store";
|
171 |
$tags = $api->tags->info($mandrillTag);
|
172 |
+
if (!$tags) {
|
173 |
return false;
|
174 |
}
|
175 |
$general = (array)$tags;
|
176 |
+
switch ($period) {
|
177 |
case '24h':
|
178 |
$index = 'today';
|
179 |
break;
|
194 |
return $general;
|
195 |
|
196 |
}
|
197 |
+
if (!isset($general['stats'])) {
|
198 |
return false;
|
199 |
}
|
200 |
$stats = (array)$general['stats'];
|
app/code/community/Ebizmarts/AbandonedCart/Block/Adminhtml/System/Config/Date.php
CHANGED
@@ -7,7 +7,6 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_AbandonedCart_Block_Adminhtml_System_Config_Date extends Mage_Adminhtml_Block_System_Config_Form_Field
|
12 |
{
|
13 |
public function render(Varien_Data_Form_Element_Abstract $element)
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_AbandonedCart_Block_Adminhtml_System_Config_Date extends Mage_Adminhtml_Block_System_Config_Form_Field
|
11 |
{
|
12 |
public function render(Varien_Data_Form_Element_Abstract $element)
|
app/code/community/Ebizmarts/AbandonedCart/Block/Adminhtml/System/Config/Fieldset/Hint.php
CHANGED
@@ -7,7 +7,6 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_AbandonedCart_Block_Adminhtml_System_Config_Fieldset_Hint
|
12 |
extends Mage_Adminhtml_Block_Abstract
|
13 |
implements Varien_Data_Form_Element_Renderer_Interface
|
@@ -28,18 +27,19 @@ class Ebizmarts_AbandonedCart_Block_Adminhtml_System_Config_Fieldset_Hint
|
|
28 |
*/
|
29 |
public function getVersion()
|
30 |
{
|
31 |
-
return (string)
|
32 |
}
|
33 |
|
34 |
/**
|
35 |
* @return string
|
36 |
*/
|
37 |
-
public function getPxParams()
|
|
|
38 |
$v = (string)Mage::getConfig()->getNode('modules/Ebizmarts_AbandonedCart/version');
|
39 |
$ext = "Abandoned Cart;{$v}";
|
40 |
|
41 |
$modulesArray = (array)Mage::getConfig()->getNode('modules')->children();
|
42 |
-
$aux = (array_key_exists('Enterprise_Enterprise', $modulesArray))? 'EE' : 'CE'
|
43 |
$mageVersion = Mage::getVersion();
|
44 |
$mage = "Magento {$aux};{$mageVersion}";
|
45 |
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_AbandonedCart_Block_Adminhtml_System_Config_Fieldset_Hint
|
11 |
extends Mage_Adminhtml_Block_Abstract
|
12 |
implements Varien_Data_Form_Element_Renderer_Interface
|
27 |
*/
|
28 |
public function getVersion()
|
29 |
{
|
30 |
+
return (string)Mage::getConfig()->getNode('modules/Ebizmarts_AbandonedCart/version');
|
31 |
}
|
32 |
|
33 |
/**
|
34 |
* @return string
|
35 |
*/
|
36 |
+
public function getPxParams()
|
37 |
+
{
|
38 |
$v = (string)Mage::getConfig()->getNode('modules/Ebizmarts_AbandonedCart/version');
|
39 |
$ext = "Abandoned Cart;{$v}";
|
40 |
|
41 |
$modulesArray = (array)Mage::getConfig()->getNode('modules')->children();
|
42 |
+
$aux = (array_key_exists('Enterprise_Enterprise', $modulesArray)) ? 'EE' : 'CE';
|
43 |
$mageVersion = Mage::getVersion();
|
44 |
$mage = "Magento {$aux};{$mageVersion}";
|
45 |
|
app/code/community/Ebizmarts/AbandonedCart/Block/Email/Order/Items.php
CHANGED
@@ -7,7 +7,6 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_AbandonedCart_Block_Email_Order_Items extends Mage_Sales_Block_Items_Abstract
|
12 |
{
|
13 |
public function _construct()
|
@@ -17,21 +16,21 @@ class Ebizmarts_AbandonedCart_Block_Email_Order_Items extends Mage_Sales_Block_I
|
|
17 |
|
18 |
public function getTax($_item)
|
19 |
{
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
}
|
29 |
|
30 |
public function getImage($_item)
|
31 |
{
|
32 |
$product = Mage::getModel('catalog/product')
|
33 |
->load($_item->getProductId());
|
34 |
-
if($product->getImage()=="no_selection"
|
35 |
$conf = Mage::getModel('catalog/product_type_configurable')->setProduct($product);
|
36 |
$simple_collection = $conf->getUsedProductCollection()->addAttributeToSelect('*')->addFilterByRequiredOptions();
|
37 |
foreach ($simple_collection as $simple_product) {
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_AbandonedCart_Block_Email_Order_Items extends Mage_Sales_Block_Items_Abstract
|
11 |
{
|
12 |
public function _construct()
|
16 |
|
17 |
public function getTax($_item)
|
18 |
{
|
19 |
+
if (Mage::helper('tax')->displayCartPriceInclTax()) {
|
20 |
+
$subtotal = Mage::helper('tax')->__('Incl. Tax') . ' : ' . Mage::helper('checkout')->formatPrice($_item['row_total_incl_tax']);
|
21 |
+
} elseif (Mage::helper('tax')->displayCartBothPrices()) {
|
22 |
+
$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']);
|
23 |
+
} else {
|
24 |
+
$subtotal = Mage::helper('tax')->__('Excl. Tax') . ' : ' . Mage::helper('checkout')->formatPrice($_item['row_total']);
|
25 |
+
}
|
26 |
+
return $subtotal;
|
27 |
}
|
28 |
|
29 |
public function getImage($_item)
|
30 |
{
|
31 |
$product = Mage::getModel('catalog/product')
|
32 |
->load($_item->getProductId());
|
33 |
+
if ($product->getImage() == "no_selection" && $product->getTypeId() == "configurable") {
|
34 |
$conf = Mage::getModel('catalog/product_type_configurable')->setProduct($product);
|
35 |
$simple_collection = $conf->getUsedProductCollection()->addAttributeToSelect('*')->addFilterByRequiredOptions();
|
36 |
foreach ($simple_collection as $simple_product) {
|
app/code/community/Ebizmarts/AbandonedCart/Block/Popup/Emailcatcher.php
CHANGED
@@ -1,45 +1,53 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* Created by PhpStorm.
|
4 |
* User: santisp
|
5 |
* Date: 23/10/14
|
6 |
* Time: 02:28 PM
|
7 |
*/
|
8 |
-
class Ebizmarts_AbandonedCart_Block_Popup_Emailcatcher extends Mage_Core_Block_Template
|
|
|
9 |
|
10 |
-
protected function _canCancel()
|
|
|
11 |
$storeId = Mage::app()->getStore()->getId();
|
12 |
return Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::ENABLE_POPUP, $storeId) && Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::POPUP_CAN_CANCEL, $storeId);
|
13 |
}
|
14 |
|
15 |
-
protected function _popupHeading()
|
|
|
16 |
$storeId = Mage::app()->getStore()->getId();
|
17 |
return Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::POPUP_HEADING, $storeId);
|
18 |
}
|
19 |
|
20 |
-
protected function _popupMessage()
|
|
|
21 |
$storeId = Mage::app()->getStore()->getId();
|
22 |
return Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::POPUP_TEXT, $storeId);
|
23 |
}
|
24 |
|
25 |
-
protected function _modalSubscribe()
|
|
|
26 |
$storeId = Mage::app()->getStore()->getId();
|
27 |
return Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::POPUP_SUBSCRIPTION, $storeId);
|
28 |
}
|
29 |
|
30 |
-
protected function _createCoupon($email)
|
|
|
31 |
$storeId = Mage::app()->getStore()->getId();
|
32 |
-
if(Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::POPUP_CREATE_COUPON, $storeId)){
|
33 |
$collection = Mage::getModel('ebizmarts_abandonedcart/popup')->getCollection()
|
34 |
-
->addFieldToFilter('email', array('eq'
|
35 |
-
if(!count($collection)) {
|
36 |
$addEmail = Mage::getModel('ebizmarts_abandonedcart/popup');
|
37 |
$addEmail->setEmail($email)->save();
|
38 |
}
|
39 |
}
|
40 |
}
|
41 |
|
42 |
-
protected function _getStoreId()
|
|
|
43 |
return Mage::app()->getStore()->getId();
|
44 |
}
|
45 |
}
|
1 |
<?php
|
2 |
+
|
3 |
/**
|
4 |
* Created by PhpStorm.
|
5 |
* User: santisp
|
6 |
* Date: 23/10/14
|
7 |
* Time: 02:28 PM
|
8 |
*/
|
9 |
+
class Ebizmarts_AbandonedCart_Block_Popup_Emailcatcher extends Mage_Core_Block_Template
|
10 |
+
{
|
11 |
|
12 |
+
protected function _canCancel()
|
13 |
+
{
|
14 |
$storeId = Mage::app()->getStore()->getId();
|
15 |
return Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::ENABLE_POPUP, $storeId) && Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::POPUP_CAN_CANCEL, $storeId);
|
16 |
}
|
17 |
|
18 |
+
protected function _popupHeading()
|
19 |
+
{
|
20 |
$storeId = Mage::app()->getStore()->getId();
|
21 |
return Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::POPUP_HEADING, $storeId);
|
22 |
}
|
23 |
|
24 |
+
protected function _popupMessage()
|
25 |
+
{
|
26 |
$storeId = Mage::app()->getStore()->getId();
|
27 |
return Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::POPUP_TEXT, $storeId);
|
28 |
}
|
29 |
|
30 |
+
protected function _modalSubscribe()
|
31 |
+
{
|
32 |
$storeId = Mage::app()->getStore()->getId();
|
33 |
return Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::POPUP_SUBSCRIPTION, $storeId);
|
34 |
}
|
35 |
|
36 |
+
protected function _createCoupon($email)
|
37 |
+
{
|
38 |
$storeId = Mage::app()->getStore()->getId();
|
39 |
+
if (Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::POPUP_CREATE_COUPON, $storeId)) {
|
40 |
$collection = Mage::getModel('ebizmarts_abandonedcart/popup')->getCollection()
|
41 |
+
->addFieldToFilter('email', array('eq' => $email));
|
42 |
+
if (!count($collection)) {
|
43 |
$addEmail = Mage::getModel('ebizmarts_abandonedcart/popup');
|
44 |
$addEmail->setEmail($email)->save();
|
45 |
}
|
46 |
}
|
47 |
}
|
48 |
|
49 |
+
protected function _getStoreId()
|
50 |
+
{
|
51 |
return Mage::app()->getStore()->getId();
|
52 |
}
|
53 |
}
|
app/code/community/Ebizmarts/AbandonedCart/Helper/Data.php
CHANGED
@@ -7,15 +7,15 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
-
|
12 |
|
13 |
/**
|
14 |
* @return string
|
15 |
*/
|
16 |
public function getVersion()
|
17 |
{
|
18 |
-
return (string)
|
19 |
}
|
20 |
|
21 |
|
@@ -26,26 +26,28 @@ class Ebizmarts_AbandonedCart_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
26 |
{
|
27 |
return array(
|
28 |
'24h' => $this->__('Last 24 Hours'),
|
29 |
-
'7d'
|
30 |
-
'30d'
|
31 |
-
'60d'
|
32 |
-
'90d'
|
33 |
'lifetime' => $this->__('Lifetime'),
|
34 |
);
|
35 |
}
|
|
|
36 |
public function log($message, $filename = 'Ebizmarts_AbandonedCart.log')
|
37 |
{
|
38 |
-
if(Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::LOG)) {
|
39 |
Mage::log($message, null, $filename);
|
40 |
}
|
41 |
}
|
42 |
-
|
|
|
43 |
{
|
44 |
-
if($couponCode!='') {
|
45 |
$coupon = Mage::getModel('salesrule/coupon')->load($couponCode, 'code');
|
46 |
$rule = Mage::getModel('salesrule/rule')->load($coupon->getRuleId());
|
47 |
$couponAmount = $rule->getDiscountAmount();
|
48 |
-
switch($rule->getSimpleAction()) {
|
49 |
case 'cart_fixed':
|
50 |
$couponType = 1;
|
51 |
break;
|
@@ -53,69 +55,70 @@ class Ebizmarts_AbandonedCart_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
53 |
$couponType = 2;
|
54 |
break;
|
55 |
}
|
56 |
-
}
|
57 |
-
else {
|
58 |
$couponType = 0;
|
59 |
$couponAmount = 0;
|
60 |
}
|
61 |
$sent = Mage::getModel('ebizmarts_abandonedcart/mailssent');
|
62 |
$sent->setMailType($mailType)
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
}
|
72 |
|
73 |
-
public function getTBTPoints($customerId)
|
74 |
{
|
75 |
|
76 |
-
|
|
|
77 |
|
78 |
-
|
79 |
-
|
80 |
|
81 |
-
|
82 |
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
|
88 |
-
|
89 |
|
90 |
-
|
91 |
-
|
92 |
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
$spent = $this->_formatDateMerge($transfer->getEffectiveStart());
|
97 |
}
|
98 |
|
99 |
-
|
100 |
break;
|
101 |
-
|
102 |
|
|
|
103 |
}
|
104 |
-
}
|
105 |
|
106 |
-
|
107 |
$tbtVars['ptsearn'] = $earn;
|
108 |
}
|
109 |
-
|
110 |
$tbtVars['ptsspent'] = $spent;
|
111 |
}
|
112 |
|
113 |
-
|
114 |
-
|
115 |
->getExpiryDate($tbtCustomer);
|
116 |
-
|
117 |
$tbtVars['ptsexp'] = $val;
|
118 |
}
|
119 |
-
|
120 |
-
|
|
|
121 |
}
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
+
class Ebizmarts_AbandonedCart_Helper_Data extends Mage_Core_Helper_Abstract
|
11 |
+
{
|
12 |
|
13 |
/**
|
14 |
* @return string
|
15 |
*/
|
16 |
public function getVersion()
|
17 |
{
|
18 |
+
return (string)Mage::getConfig()->getNode('modules/Ebizmarts_AbandonedCart/version');
|
19 |
}
|
20 |
|
21 |
|
26 |
{
|
27 |
return array(
|
28 |
'24h' => $this->__('Last 24 Hours'),
|
29 |
+
'7d' => $this->__('Last 7 Days'),
|
30 |
+
'30d' => $this->__('Last 30 Days'),
|
31 |
+
'60d' => $this->__('Last 60 Days'),
|
32 |
+
'90d' => $this->__('Last 90 Days'),
|
33 |
'lifetime' => $this->__('Lifetime'),
|
34 |
);
|
35 |
}
|
36 |
+
|
37 |
public function log($message, $filename = 'Ebizmarts_AbandonedCart.log')
|
38 |
{
|
39 |
+
if (Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::LOG)) {
|
40 |
Mage::log($message, null, $filename);
|
41 |
}
|
42 |
}
|
43 |
+
|
44 |
+
public function saveMail($mailType, $mail, $name, $couponCode, $storeId)
|
45 |
{
|
46 |
+
if ($couponCode != '') {
|
47 |
$coupon = Mage::getModel('salesrule/coupon')->load($couponCode, 'code');
|
48 |
$rule = Mage::getModel('salesrule/rule')->load($coupon->getRuleId());
|
49 |
$couponAmount = $rule->getDiscountAmount();
|
50 |
+
switch ($rule->getSimpleAction()) {
|
51 |
case 'cart_fixed':
|
52 |
$couponType = 1;
|
53 |
break;
|
55 |
$couponType = 2;
|
56 |
break;
|
57 |
}
|
58 |
+
} else {
|
|
|
59 |
$couponType = 0;
|
60 |
$couponAmount = 0;
|
61 |
}
|
62 |
$sent = Mage::getModel('ebizmarts_abandonedcart/mailssent');
|
63 |
$sent->setMailType($mailType)
|
64 |
+
->setStoreId($storeId)
|
65 |
+
->setCustomerEmail($mail)
|
66 |
+
->setCustomerName($name)
|
67 |
+
->setCouponNumber($couponCode)
|
68 |
+
->setCouponType($couponType)
|
69 |
+
->setCouponAmount($couponAmount)
|
70 |
+
->setSentAt(Mage::getModel('core/date')->gmtDate())
|
71 |
+
->save();
|
72 |
}
|
73 |
|
74 |
+
public function getTBTPoints($customerId, $storeId)
|
75 |
{
|
76 |
|
77 |
+
if (Mage::getStoreConfig('sweetmonkey/general/active', $storeId)) {
|
78 |
+
$tbtCustomer = Mage::getModel('rewards/customer')->load($customerId);
|
79 |
|
80 |
+
//Point balance
|
81 |
+
$tbtVars['pts'] = $tbtCustomer->getPointsSummary();
|
82 |
|
83 |
+
$tbtVars['points'] = $tbtCustomer->getUsablePointsBalance(1);
|
84 |
|
85 |
+
//Earn and Spent points
|
86 |
+
$lastTransfers = $tbtCustomer->getTransfers()
|
87 |
+
->selectOnlyActive()
|
88 |
+
->addOrder('last_update_ts', Varien_Data_Collection::SORT_ORDER_DESC);
|
89 |
|
90 |
+
$spent = $earn = null;
|
91 |
|
92 |
+
if ($lastTransfers->getSize()) {
|
93 |
+
foreach ($lastTransfers as $transfer) {
|
94 |
|
95 |
+
if (is_null($earn) && $transfer->getQuantity() > 0) {
|
96 |
+
$earn = $this->_formatDateMerge($transfer->getEffectiveStart());
|
97 |
+
} else if (is_null($spent) && $transfer->getQuantity() < 0) {
|
98 |
$spent = $this->_formatDateMerge($transfer->getEffectiveStart());
|
99 |
}
|
100 |
|
101 |
+
if (!is_null($spent) && !is_null($earn)) {
|
102 |
break;
|
103 |
+
}
|
104 |
|
105 |
+
}
|
106 |
}
|
|
|
107 |
|
108 |
+
if ($earn) {
|
109 |
$tbtVars['ptsearn'] = $earn;
|
110 |
}
|
111 |
+
if ($spent) {
|
112 |
$tbtVars['ptsspent'] = $spent;
|
113 |
}
|
114 |
|
115 |
+
//Expiration Points
|
116 |
+
$val = Mage::getSingleton('rewards/expiry')
|
117 |
->getExpiryDate($tbtCustomer);
|
118 |
+
if ($val) {
|
119 |
$tbtVars['ptsexp'] = $val;
|
120 |
}
|
121 |
+
return $tbtVars;
|
122 |
+
}
|
123 |
+
}
|
124 |
}
|
app/code/community/Ebizmarts/AbandonedCart/Model/Abtesting.php
CHANGED
@@ -7,10 +7,10 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_AbandonedCart_Model_Abtesting extends Mage_Core_Model_Abstract
|
12 |
{
|
13 |
-
public function _construct()
|
|
|
14 |
$this->_init('ebizmarts_abandonedcart/abtesting');
|
15 |
}
|
16 |
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_AbandonedCart_Model_Abtesting extends Mage_Core_Model_Abstract
|
11 |
{
|
12 |
+
public function _construct()
|
13 |
+
{
|
14 |
$this->_init('ebizmarts_abandonedcart/abtesting');
|
15 |
}
|
16 |
|
app/code/community/Ebizmarts/AbandonedCart/Model/Config.php
CHANGED
@@ -7,85 +7,84 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_AbandonedCart_Model_Config
|
12 |
{
|
13 |
-
const ACTIVE
|
14 |
-
const FIRST_EMAIL_TEMPLATE_XML_PATH
|
15 |
-
const SECOND_EMAIL_TEMPLATE_XML_PATH
|
16 |
-
const THIRD_EMAIL_TEMPLATE_XML_PATH
|
17 |
-
const FOURTH_EMAIL_TEMPLATE_XML_PATH
|
18 |
-
const FIFTH_EMAIL_TEMPLATE_XML_PATH
|
19 |
-
const MANDRILL_TAG
|
20 |
-
const EMAIL_TEMPLATE_XML_PATH_W_COUPON
|
21 |
-
const DAYS_1
|
22 |
-
const DAYS_2
|
23 |
-
const DAYS_3
|
24 |
-
const DAYS_4
|
25 |
-
const DAYS_5
|
26 |
-
const UNIT
|
27 |
-
const SENDER
|
28 |
-
const MAXTIMES
|
29 |
-
const MAXTIMES_NUM
|
30 |
-
const CUSTOMER_GROUPS
|
31 |
-
const FIRST_SUBJECT
|
32 |
-
const SECOND_SUBJECT
|
33 |
-
const THIRD_SUBJECT
|
34 |
-
const FOURTH_SUBJECT
|
35 |
-
const FIFTH_SUBJECT
|
36 |
-
const LOG
|
37 |
-
const AUTOLOGIN
|
38 |
-
const ABANDONED_TAGS
|
39 |
-
const IN_DAYS
|
40 |
-
const IN_HOURS
|
41 |
-
const PAGE
|
42 |
|
43 |
-
const AB_TESTING_ACTIVE
|
44 |
-
const AB_TESTING_MANDRILL_SUFFIX
|
45 |
-
const AB_TESTING_FIRST_EMAIL
|
46 |
-
const AB_TESTING_SECOND_EMAIL
|
47 |
-
const AB_TESTING_THIRD_EMAIL
|
48 |
-
const AB_TESTING_FOURTH_EMAIL
|
49 |
-
const AB_TESTING_FIFTH_EMAIL
|
50 |
-
const AB_TESTING_EMAIL_TEMPLATE
|
51 |
-
const AB_TESTING_FIRST_SUBJECT
|
52 |
-
const AB_TESTING_SECOND_SUBJECT
|
53 |
-
const AB_TESTING_THIRD_SUBJECT
|
54 |
-
const AB_TESTING_FOURTH_SUBJECT
|
55 |
-
const AB_TESTING_FIFTH_SUBJECT
|
56 |
-
const AB_TESTING_COUPON_SENDON
|
57 |
|
58 |
|
59 |
-
const COUPON_DAYS
|
60 |
-
const SEND_COUPON
|
61 |
-
const FIRST_DATE
|
62 |
-
const COUPON_AMOUNT
|
63 |
-
const COUPON_AUTOMATIC
|
64 |
-
const COUPON_CODE
|
65 |
-
const COUPON_EXPIRE
|
66 |
-
const COUPON_TYPE
|
67 |
-
const COUPON_LENGTH
|
68 |
-
const COUPON_LABEL
|
69 |
|
70 |
|
71 |
-
const ENABLE_POPUP
|
72 |
-
const POPUP_HEADING
|
73 |
-
const POPUP_TEXT
|
74 |
-
const POPUP_WIDTH
|
75 |
-
const POPUP_SUBSCRIPTION
|
76 |
-
const POPUP_CAN_CANCEL
|
77 |
-
const POPUP_COOKIE_TIME
|
78 |
-
const POPUP_INSIST
|
79 |
-
const POPUP_CREATE_COUPON
|
80 |
-
const POPUP_COUPON_MANDRILL_TAG
|
81 |
-
const POPUP_COUPON_MAIL_SUBJECT
|
82 |
-
const POPUP_COUPON_TEMPLATE_XML_PATH
|
83 |
-
const POPUP_COUPON_AUTOMATIC
|
84 |
-
const POPUP_COUPON_CODE
|
85 |
-
const POPUP_COUPON_EXPIRE
|
86 |
-
const POPUP_COUPON_LENGTH
|
87 |
-
const POPUP_COUPON_DISCOUNTTYPE
|
88 |
-
const POPUP_COUPON_DISCOUNT
|
89 |
-
const POPUP_COUPON_LABEL
|
90 |
|
91 |
}
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_AbandonedCart_Model_Config
|
11 |
{
|
12 |
+
const ACTIVE = "ebizmarts_abandonedcart/general/active";
|
13 |
+
const FIRST_EMAIL_TEMPLATE_XML_PATH = 'ebizmarts_abandonedcart/general/template1';
|
14 |
+
const SECOND_EMAIL_TEMPLATE_XML_PATH = 'ebizmarts_abandonedcart/general/template2';
|
15 |
+
const THIRD_EMAIL_TEMPLATE_XML_PATH = 'ebizmarts_abandonedcart/general/template3';
|
16 |
+
const FOURTH_EMAIL_TEMPLATE_XML_PATH = 'ebizmarts_abandonedcart/general/template4';
|
17 |
+
const FIFTH_EMAIL_TEMPLATE_XML_PATH = 'ebizmarts_abandonedcart/general/template5';
|
18 |
+
const MANDRILL_TAG = 'ebizmarts_abandonedcart/general/mandrill-tag';
|
19 |
+
const EMAIL_TEMPLATE_XML_PATH_W_COUPON = 'ebizmarts_abandonedcart/general/coupon_template';
|
20 |
+
const DAYS_1 = "ebizmarts_abandonedcart/general/days1";
|
21 |
+
const DAYS_2 = "ebizmarts_abandonedcart/general/days2";
|
22 |
+
const DAYS_3 = "ebizmarts_abandonedcart/general/days3";
|
23 |
+
const DAYS_4 = "ebizmarts_abandonedcart/general/days4";
|
24 |
+
const DAYS_5 = "ebizmarts_abandonedcart/general/days5";
|
25 |
+
const UNIT = "ebizmarts_abandonedcart/general/unit";
|
26 |
+
const SENDER = "ebizmarts_abandonedcart/general/identity";
|
27 |
+
const MAXTIMES = "ebizmarts_abandonedcart/general/max";
|
28 |
+
const MAXTIMES_NUM = 5;
|
29 |
+
const CUSTOMER_GROUPS = "ebizmarts_abandonedcart/general/customer";
|
30 |
+
const FIRST_SUBJECT = "ebizmarts_abandonedcart/general/subject1";
|
31 |
+
const SECOND_SUBJECT = "ebizmarts_abandonedcart/general/subject2";
|
32 |
+
const THIRD_SUBJECT = "ebizmarts_abandonedcart/general/subject3";
|
33 |
+
const FOURTH_SUBJECT = "ebizmarts_abandonedcart/general/subject4";
|
34 |
+
const FIFTH_SUBJECT = "ebizmarts_abandonedcart/general/subject5";
|
35 |
+
const LOG = "ebizmarts_abandonedcart/general/log";
|
36 |
+
const AUTOLOGIN = "ebizmarts_abandonedcart/general/autologin";
|
37 |
+
const ABANDONED_TAGS = 'global/ebizmarts_abandonedcart/mandrill-tag';
|
38 |
+
const IN_DAYS = 0;
|
39 |
+
const IN_HOURS = 1;
|
40 |
+
const PAGE = 'ebizmarts_abandonedcart/general/page';
|
41 |
|
42 |
+
const AB_TESTING_ACTIVE = 'ebizmarts_abandonedcart/A_Btesting/active';
|
43 |
+
const AB_TESTING_MANDRILL_SUFFIX = 'ebizmarts_abandonedcart/A_Btesting/mandrill_suffix';
|
44 |
+
const AB_TESTING_FIRST_EMAIL = 'ebizmarts_abandonedcart/A_Btesting/template1';
|
45 |
+
const AB_TESTING_SECOND_EMAIL = 'ebizmarts_abandonedcart/A_Btesting/template2';
|
46 |
+
const AB_TESTING_THIRD_EMAIL = 'ebizmarts_abandonedcart/A_Btesting/template3';
|
47 |
+
const AB_TESTING_FOURTH_EMAIL = 'ebizmarts_abandonedcart/A_Btesting/template4';
|
48 |
+
const AB_TESTING_FIFTH_EMAIL = 'ebizmarts_abandonedcart/A_Btesting/template5';
|
49 |
+
const AB_TESTING_EMAIL_TEMPLATE = 'ebizmarts_abandonedcart/A_Btesting/coupon_template';
|
50 |
+
const AB_TESTING_FIRST_SUBJECT = "ebizmarts_abandonedcart/A_Btesting/subject1";
|
51 |
+
const AB_TESTING_SECOND_SUBJECT = "ebizmarts_abandonedcart/A_Btesting/subject2";
|
52 |
+
const AB_TESTING_THIRD_SUBJECT = "ebizmarts_abandonedcart/A_Btesting/subject3";
|
53 |
+
const AB_TESTING_FOURTH_SUBJECT = "ebizmarts_abandonedcart/A_Btesting/subject4";
|
54 |
+
const AB_TESTING_FIFTH_SUBJECT = "ebizmarts_abandonedcart/A_Btesting/subject5";
|
55 |
+
const AB_TESTING_COUPON_SENDON = "ebizmarts_abandonedcart/A_Btesting/A_Btesting_sendon";
|
56 |
|
57 |
|
58 |
+
const COUPON_DAYS = "ebizmarts_abandonedcart/coupon/sendon";
|
59 |
+
const SEND_COUPON = "ebizmarts_abandonedcart/coupon/create";
|
60 |
+
const FIRST_DATE = "ebizmarts_abandonedcart/general/firstdate";
|
61 |
+
const COUPON_AMOUNT = "ebizmarts_abandonedcart/coupon/discount";
|
62 |
+
const COUPON_AUTOMATIC = "ebizmarts_abandonedcart/coupon/automatic";
|
63 |
+
const COUPON_CODE = "ebizmarts_abandonedcart/coupon/couponcode";
|
64 |
+
const COUPON_EXPIRE = "ebizmarts_abandonedcart/coupon/expire";
|
65 |
+
const COUPON_TYPE = "ebizmarts_abandonedcart/coupon/discounttype";
|
66 |
+
const COUPON_LENGTH = "ebizmarts_abandonedcart/coupon/length";
|
67 |
+
const COUPON_LABEL = "ebizmarts_abandonedcart/coupon/couponlabel";
|
68 |
|
69 |
|
70 |
+
const ENABLE_POPUP = 'ebizmarts_abandonedcart/emailcatcher/popup_general';
|
71 |
+
const POPUP_HEADING = 'ebizmarts_abandonedcart/emailcatcher/popup_heading';
|
72 |
+
const POPUP_TEXT = 'ebizmarts_abandonedcart/emailcatcher/popup_text';
|
73 |
+
const POPUP_WIDTH = 'ebizmarts_abandonedcart/emailcatcher/popup_width';
|
74 |
+
const POPUP_SUBSCRIPTION = 'ebizmarts_abandonedcart/emailcatcher/popup_subscription';
|
75 |
+
const POPUP_CAN_CANCEL = 'ebizmarts_abandonedcart/emailcatcher/popup_cancel';
|
76 |
+
const POPUP_COOKIE_TIME = 'ebizmarts_abandonedcart/emailcatcher/popup_cookie_time';
|
77 |
+
const POPUP_INSIST = 'ebizmarts_abandonedcart/emailcatcher/popup_insist';
|
78 |
+
const POPUP_CREATE_COUPON = 'ebizmarts_abandonedcart/emailcatcher/popup_coupon';
|
79 |
+
const POPUP_COUPON_MANDRILL_TAG = 'ebizmarts_abandonedcart/emailcatcher/popup_coupon_mandrill_tag';
|
80 |
+
const POPUP_COUPON_MAIL_SUBJECT = 'ebizmarts_abandonedcart/emailcatcher/popup_coupon_mail_subject';
|
81 |
+
const POPUP_COUPON_TEMPLATE_XML_PATH = 'ebizmarts_abandonedcart/emailcatcher/popup_coupon_template';
|
82 |
+
const POPUP_COUPON_AUTOMATIC = 'ebizmarts_abandonedcart/emailcatcher/popup_automatic';
|
83 |
+
const POPUP_COUPON_CODE = 'ebizmarts_abandonedcart/emailcatcher/popup_coupon_code';
|
84 |
+
const POPUP_COUPON_EXPIRE = 'ebizmarts_abandonedcart/emailcatcher/popup_expire';
|
85 |
+
const POPUP_COUPON_LENGTH = 'ebizmarts_abandonedcart/emailcatcher/popup_length';
|
86 |
+
const POPUP_COUPON_DISCOUNTTYPE = 'ebizmarts_abandonedcart/emailcatcher/popup_discounttype';
|
87 |
+
const POPUP_COUPON_DISCOUNT = 'ebizmarts_abandonedcart/emailcatcher/popup_discount';
|
88 |
+
const POPUP_COUPON_LABEL = 'ebizmarts_abandonedcart/emailcatcher/popup_couponlabel';
|
89 |
|
90 |
}
|
app/code/community/Ebizmarts/AbandonedCart/Model/Cron.php
CHANGED
@@ -7,7 +7,6 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_AbandonedCart_Model_Cron
|
12 |
{
|
13 |
// const EMAIL_TEMPLATE_XML_PATH = 'ebizmarts_abandonedcart/general/template';
|
@@ -19,21 +18,21 @@ class Ebizmarts_AbandonedCart_Model_Cron
|
|
19 |
public function abandoned()
|
20 |
{
|
21 |
$allStores = Mage::app()->getStores();
|
22 |
-
foreach($allStores as $storeid => $val)
|
23 |
-
|
24 |
-
if(Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::ACTIVE,$storeid)) {
|
25 |
$this->_proccess($storeid);
|
26 |
}
|
27 |
-
if(Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::ENABLE_POPUP, $storeid) && Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::POPUP_CREATE_COUPON, $storeid)){
|
28 |
$this->_sendPopupCoupon($storeid);
|
29 |
}
|
30 |
}
|
31 |
}
|
32 |
|
33 |
-
public function cleanAbandonedCartExpiredCoupons()
|
|
|
34 |
$allStores = Mage::app()->getStores();
|
35 |
-
foreach($allStores as $storeid => $val){
|
36 |
-
if(Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::ACTIVE
|
37 |
$this->_cleanCoupons($storeid);
|
38 |
}
|
39 |
}
|
@@ -45,15 +44,15 @@ class Ebizmarts_AbandonedCart_Model_Cron
|
|
45 |
protected function _proccess($storeId)
|
46 |
{
|
47 |
//Mage::app()->setCurrentStore($storeId);
|
48 |
-
Mage::unregister('_singleton/core/design_package'
|
49 |
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
|
50 |
-
Mage::getSingleton('core/design_package'
|
51 |
|
52 |
$abTesting = false;
|
53 |
$item = Mage::getModel('ebizmarts_abandonedcart/abtesting')->getCollection()
|
54 |
-
->addFieldToFilter('store_id', array('eq'
|
55 |
->getFirstItem();
|
56 |
-
if($item) {
|
57 |
$status = $item->getCurrentStatus();
|
58 |
if (Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::AB_TESTING_ACTIVE, $storeId) && $status == 1) {
|
59 |
$abTesting = true;
|
@@ -69,17 +68,17 @@ class Ebizmarts_AbandonedCart_Model_Cron
|
|
69 |
3 => Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::DAYS_4, $storeId),
|
70 |
4 => Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::DAYS_5, $storeId)
|
71 |
);
|
72 |
-
$maxtimes = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::MAXTIMES, $storeId)+1;
|
73 |
$sendcoupon = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::SEND_COUPON, $storeId);
|
74 |
$firstdate = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::FIRST_DATE, $storeId);
|
75 |
$unit = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::UNIT, $storeId);
|
76 |
-
$customergroups = explode(",",Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::CUSTOMER_GROUPS, $storeId));
|
77 |
$mandrillTag = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::MANDRILL_TAG, $storeId) . "_$storeId";
|
78 |
|
79 |
-
if($abTesting) {
|
80 |
-
$mandrillTag .= '_'
|
81 |
$sendcoupondays = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::AB_TESTING_COUPON_SENDON, $storeId);
|
82 |
-
}else{
|
83 |
$sendcoupondays = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::COUPON_DAYS, $storeId);
|
84 |
}
|
85 |
|
@@ -91,22 +90,22 @@ class Ebizmarts_AbandonedCart_Model_Cron
|
|
91 |
$couponlabel = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::COUPON_LABEL, $storeId);
|
92 |
|
93 |
// iterates one time for each mail number
|
94 |
-
for($run=0
|
95 |
-
if(!$days[$run]){
|
96 |
return;
|
97 |
}
|
98 |
|
99 |
// subtract days from latest run to get difference from the actual abandon date of the cart
|
100 |
$diff = $days[$run];
|
101 |
-
if($run == 1 && $unit == Ebizmarts_AbandonedCart_Model_Config::IN_HOURS){
|
102 |
-
$diff -= $days[0]/24;
|
103 |
-
}elseif($run != 0){
|
104 |
-
$diff -= $days[$run-1];
|
105 |
}
|
106 |
|
107 |
// set the top date of the carts to get
|
108 |
$expr = sprintf('DATE_SUB(%s, %s)', $adapter->quote(now()), $this->_getIntervalUnitSql($diff, 'DAY'));
|
109 |
-
if($run == 0 && $unit == Ebizmarts_AbandonedCart_Model_Config::IN_HOURS) {
|
110 |
$expr = sprintf('DATE_SUB(%s, %s)', $adapter->quote(now()), $this->_getIntervalUnitSql($diff, 'HOUR'));
|
111 |
}
|
112 |
$from = new Zend_Db_Expr($expr);
|
@@ -114,28 +113,27 @@ class Ebizmarts_AbandonedCart_Model_Cron
|
|
114 |
// get collection of abandoned carts with cart_counter == $run
|
115 |
$collection = Mage::getResourceModel('reports/quote_collection');
|
116 |
$collection->addFieldToFilter('items_count', array('neq' => '0'))
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
|
122 |
-
$collection->addFieldToFilter('main_table.converted_at', array(array('null'=>true)
|
123 |
-
|
124 |
-
|
125 |
|
126 |
$collection->addFieldToFilter('main_table.customer_email', array('neq' => ''));
|
127 |
-
if(count($customergroups)) {
|
128 |
$collection->addFieldToFilter('main_table.customer_group_id', array('in' => $customergroups));
|
129 |
}
|
130 |
|
131 |
// for each cart of the current run
|
132 |
-
foreach($collection as $quote) {
|
133 |
foreach ($quote->getAllVisibleItems() as $item) {
|
134 |
$removeFromQuote = false;
|
135 |
$product = Mage::getModel('catalog/product')->setStoreId($storeId)->load($item->getProductId());
|
136 |
-
if (!$product || $product->getStatus() == Mage_Catalog_Model_Product_Status::STATUS_DISABLED)
|
137 |
-
|
138 |
-
Mage::log('AbandonedCart; ' . $product->getSku() .' is no longer present or enabled; remove from quote ' . $quote->getId() . ' for email',null,'Ebizmarts_AbandonedCart.log');
|
139 |
$removeFromQuote = true;
|
140 |
}
|
141 |
|
@@ -172,15 +170,14 @@ class Ebizmarts_AbandonedCart_Model_Cron
|
|
172 |
if (
|
173 |
(
|
174 |
is_object($stock) && ($stock->getManageStock() ||
|
175 |
-
|
176 |
)
|
177 |
-
&& $stockQty < $item->getQty()
|
178 |
-
{
|
179 |
-
Mage::log('AbandonedCart; ' . $product->getSku() .' is no longer in stock; remove from quote ' . $quote->getId() . ' for email',null,'Ebizmarts_AbandonedCart.log');
|
180 |
$removeFromQuote = true;
|
181 |
}
|
182 |
-
if ($removeFromQuote)
|
183 |
-
{
|
184 |
$quote->removeItem($item->getId());
|
185 |
}
|
186 |
}
|
@@ -203,22 +200,22 @@ class Ebizmarts_AbandonedCart_Model_Cron
|
|
203 |
//
|
204 |
//$url = Mage::getBaseUrl('web').'ebizmarts_abandonedcart/abandoned/loadquote?id='.$quote->getEntityId();
|
205 |
//srand((double)microtime()*1000000);
|
206 |
-
$token = md5(rand(0,9999999));
|
207 |
-
if($abTesting){
|
208 |
$url = Mage::getModel('core/url')->setStore($storeId)->getUrl('', array('_nosid' => true)) . 'ebizmarts_abandonedcart/abandoned/loadquote?id=' . $quote->getEntityId() . '&token=' . $token . '&' . $suffix;
|
209 |
-
}else {
|
210 |
$url = Mage::getModel('core/url')->setStore($storeId)->getUrl('', array('_nosid' => true)) . 'ebizmarts_abandonedcart/abandoned/loadquote?id=' . $quote->getEntityId() . '&token=' . $token;
|
211 |
}
|
212 |
|
213 |
-
$data = array('AbandonedURL'
|
214 |
|
215 |
// send email
|
216 |
-
$senderid =
|
217 |
-
$sender = array('name'=>Mage::getStoreConfig("trans_email/ident_$senderid/name"
|
218 |
|
219 |
$email = $quote->getCustomerEmail();
|
220 |
|
221 |
-
if(Mage::helper('ebizmarts_autoresponder')->isSubscribed($email,'abandonedcart'
|
222 |
$name = $quote->getCustomerFirstname() . ' ' . $quote->getCustomerLastname();
|
223 |
$quote2 = Mage::getModel('sales/quote')->loadByIdWithoutStore($quote->getId());
|
224 |
$unsubscribeUrl = Mage::getModel('core/url')->setStore($storeId)->getUrl() . 'ebizautoresponder/autoresponder/unsubscribe?list=abandonedcart&email=' . $email . '&store=' . $storeId;
|
@@ -241,12 +238,12 @@ class Ebizmarts_AbandonedCart_Model_Cron
|
|
241 |
// create a new coupon
|
242 |
if (Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::COUPON_AUTOMATIC) == 2) {
|
243 |
list($couponcode, $discount, $toDate) = $this->_createNewCoupon($storeId, $email, $couponamount, $couponexpiredays, $coupontype, $couponlength, $couponlabel);
|
244 |
-
$url .= '&coupon='
|
245 |
$vars = array('quote' => $quote, 'url' => $url, 'couponcode' => $couponcode, 'discount' => $discount,
|
246 |
'todate' => $toDate, 'name' => $name, 'tags' => array($mandrillTag), 'unsubscribeurl' => $unsubscribeUrl);
|
247 |
} else {
|
248 |
$couponcode = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::COUPON_CODE);
|
249 |
-
$url .= '&coupon='
|
250 |
$vars = array('quote' => $quote, 'url' => $url, 'couponcode' => $couponcode, 'name' => $name, 'tags' => array($mandrillTag), 'unsubscribeurl' => $unsubscribeUrl);
|
251 |
}
|
252 |
} else {
|
@@ -258,8 +255,8 @@ class Ebizmarts_AbandonedCart_Model_Cron
|
|
258 |
$customer = Mage::getModel('customer/customer')
|
259 |
->setStore(Mage::app()->getStore($storeId))
|
260 |
->loadByEmail($email);
|
261 |
-
if($customer->getId()) {
|
262 |
-
$tbtPoints = Mage::helper('ebizmarts_abandonedcart')->getTBTPoints($customer->getId());
|
263 |
foreach ($tbtPoints as $key => $field) {
|
264 |
if ($key == 'points') {
|
265 |
if ($field >= Mage::getStoreConfig('sweetmonkey/general/email_points', $storeId)) {
|
@@ -279,7 +276,7 @@ class Ebizmarts_AbandonedCart_Model_Cron
|
|
279 |
$quote2->setEbizmartsAbandonedcartToken($token);
|
280 |
$quote2->save();
|
281 |
|
282 |
-
if(Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::AB_TESTING_ACTIVE, $storeId)) {
|
283 |
$counterCollection = Mage::getModel('ebizmarts_abandonedcart/abtesting')->getCollection()
|
284 |
->addFieldToFilter('store_id', array('eq' => $storeId));
|
285 |
$counter = $counterCollection->getFirstItem();
|
@@ -310,14 +307,11 @@ class Ebizmarts_AbandonedCart_Model_Cron
|
|
310 |
$couponlabel = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::POPUP_COUPON_LABEL, $storeId);
|
311 |
|
312 |
$collection = Mage::getModel('ebizmarts_abandonedcart/popup')->getCollection()
|
313 |
-
->addFieldToFilter('email', array('neq'=>''))
|
314 |
-
->addFieldToFilter('processed', array('eq'=>0));
|
315 |
|
316 |
-
foreach($collection as $item) {
|
317 |
$email = $item->getEmail();
|
318 |
-
$customer = Mage::getModel('customer/customer')
|
319 |
-
->setStore(Mage::app()->getStore($storeId))
|
320 |
-
->loadByEmail($email);
|
321 |
$emailArr = explode('@', $email);
|
322 |
$pseudoName = $emailArr[0];
|
323 |
if (Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::POPUP_COUPON_AUTOMATIC, $storeId) == 2) {
|
@@ -327,10 +321,6 @@ class Ebizmarts_AbandonedCart_Model_Cron
|
|
327 |
$couponcode = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::POPUP_COUPON_CODE);
|
328 |
$vars = array('couponcode' => $couponcode, 'name' => $pseudoName, 'tags' => array($tags));
|
329 |
}
|
330 |
-
$tbtPoints = Mage::helper('ebizmarts_abandonedcart')->getTBTPoints($customer->getId());
|
331 |
-
if($tbtPoints){
|
332 |
-
$vars['sweetMonkey'] = $tbtPoints;
|
333 |
-
}
|
334 |
$translate = Mage::getSingleton('core/translate');
|
335 |
$mail = Mage::getModel('core/email_template')->setTemplateSubject($mailSubject)->sendTransactional($templateId, $sender, $email, $pseudoName, $vars, $storeId);
|
336 |
$item->setProcessed(1)->save();
|
@@ -347,7 +337,7 @@ class Ebizmarts_AbandonedCart_Model_Cron
|
|
347 |
protected function _createNewCoupon($store, $email, $couponamount, $couponexpiredays, $coupontype, $couponlength, $couponlabel)
|
348 |
{
|
349 |
$collection = Mage::getModel('salesrule/rule')->getCollection()
|
350 |
-
->addFieldToFilter('name', array('like'=>'Abandoned coupon ' . $email));
|
351 |
if (!count($collection)) {
|
352 |
|
353 |
$websiteid = Mage::getModel('core/store')->load($store)->getWebsiteId();
|
@@ -395,12 +385,12 @@ class Ebizmarts_AbandonedCart_Model_Cron
|
|
395 |
$coupon_rule->setCouponCode($uniqueId);
|
396 |
$coupon_rule->save();
|
397 |
return array($uniqueId, $discount, $toDate);
|
398 |
-
}else{
|
399 |
$coupon = $collection->getFirstItem();
|
400 |
if ($coupon->getSimpleAction() == 'cart_fixed') {
|
401 |
-
$discount = Mage::app()->getStore($store)->getCurrentCurrencyCode() . ($coupon->getDiscountAmount()+0);
|
402 |
-
} else{
|
403 |
-
$discount = $coupon->getDiscountAmount()+0;
|
404 |
}
|
405 |
return array($coupon->getCode(), $discount, $coupon->getToDate());
|
406 |
}
|
@@ -423,12 +413,13 @@ class Ebizmarts_AbandonedCart_Model_Cron
|
|
423 |
{
|
424 |
return '0000-00-00 00:00:00';
|
425 |
}
|
426 |
-
|
|
|
427 |
{
|
428 |
$collection = Mage::getModel('ebizmarts_autoresponder/unsubscribe')->getCollection();
|
429 |
-
$collection->addFieldtoFilter('main_table.email',array('eq'
|
430 |
-
->addFieldtoFilter('main_table.list',array('eq'
|
431 |
-
->addFieldtoFilter('main_table.store_id',array('eq'
|
432 |
return $collection->getSize() == 0;
|
433 |
}
|
434 |
|
@@ -437,42 +428,43 @@ class Ebizmarts_AbandonedCart_Model_Cron
|
|
437 |
* @param $store
|
438 |
* @return mixed|null
|
439 |
*/
|
440 |
-
protected function _getMailSubject($currentCount, $abTesting = false, $store)
|
|
|
441 |
|
442 |
$ret = NULL;
|
443 |
-
switch($currentCount){
|
444 |
case 0:
|
445 |
-
if($abTesting) {
|
446 |
$ret = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::AB_TESTING_FIRST_SUBJECT, $store);
|
447 |
-
}else{
|
448 |
$ret = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::FIRST_SUBJECT, $store);
|
449 |
}
|
450 |
break;
|
451 |
case 1:
|
452 |
-
if($abTesting) {
|
453 |
$ret = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::AB_TESTING_SECOND_SUBJECT, $store);
|
454 |
-
}else{
|
455 |
$ret = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::SECOND_SUBJECT, $store);
|
456 |
}
|
457 |
break;
|
458 |
case 2:
|
459 |
-
if($abTesting) {
|
460 |
$ret = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::AB_TESTING_THIRD_SUBJECT, $store);
|
461 |
-
}else{
|
462 |
$ret = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::THIRD_SUBJECT, $store);
|
463 |
}
|
464 |
break;
|
465 |
case 3:
|
466 |
-
if($abTesting) {
|
467 |
$ret = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::AB_TESTING_FOURTH_SUBJECT, $store);
|
468 |
-
}else{
|
469 |
$ret = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::FOURTH_SUBJECT, $store);
|
470 |
}
|
471 |
break;
|
472 |
case 4:
|
473 |
-
if($abTesting) {
|
474 |
$ret = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::AB_TESTING_FIFTH_SUBJECT, $store);
|
475 |
-
}else{
|
476 |
$ret = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::FIFTH_SUBJECT, $store);
|
477 |
}
|
478 |
break;
|
@@ -485,42 +477,43 @@ class Ebizmarts_AbandonedCart_Model_Cron
|
|
485 |
* @param $currentCount
|
486 |
* @return mixed
|
487 |
*/
|
488 |
-
protected function _getTemplateId($currentCount, $abTesting=false, $store)
|
|
|
489 |
|
490 |
$ret = NULL;
|
491 |
-
switch($currentCount){
|
492 |
case 0:
|
493 |
-
if($abTesting) {
|
494 |
$ret = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::AB_TESTING_FIRST_EMAIL, $store);
|
495 |
-
}else{
|
496 |
$ret = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::FIRST_EMAIL_TEMPLATE_XML_PATH, $store);
|
497 |
}
|
498 |
break;
|
499 |
case 1:
|
500 |
-
if($abTesting) {
|
501 |
$ret = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::AB_TESTING_SECOND_EMAIL, $store);
|
502 |
-
}else{
|
503 |
$ret = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::SECOND_EMAIL_TEMPLATE_XML_PATH, $store);
|
504 |
}
|
505 |
break;
|
506 |
case 2:
|
507 |
-
if($abTesting) {
|
508 |
$ret = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::AB_TESTING_THIRD_EMAIL, $store);
|
509 |
-
}else{
|
510 |
$ret = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::THIRD_EMAIL_TEMPLATE_XML_PATH, $store);
|
511 |
}
|
512 |
break;
|
513 |
case 3:
|
514 |
-
if($abTesting) {
|
515 |
$ret = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::AB_TESTING_FOURTH_EMAIL, $store);
|
516 |
-
}else{
|
517 |
$ret = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::FOURTH_EMAIL_TEMPLATE_XML_PATH, $store);
|
518 |
}
|
519 |
break;
|
520 |
case 4:
|
521 |
-
if($abTesting) {
|
522 |
$ret = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::AB_TESTING_FIFTH_EMAIL, $store);
|
523 |
-
}else{
|
524 |
$ret = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::FIFTH_EMAIL_TEMPLATE_XML_PATH, $store);
|
525 |
}
|
526 |
break;
|
@@ -529,11 +522,12 @@ class Ebizmarts_AbandonedCart_Model_Cron
|
|
529 |
|
530 |
}
|
531 |
|
532 |
-
protected function _cleanCoupons($store)
|
|
|
533 |
$today = date('Y-m-d');
|
534 |
$collection = Mage::getModel('salesrule/rule')->getCollection()
|
535 |
-
->addFieldToFilter('name', array('like'=>'Abandoned coupon%'))
|
536 |
-
->addFieldToFilter('to_date', array('lt'=> $today));
|
537 |
|
538 |
foreach ($collection as $toDelete) {
|
539 |
$toDelete->delete();
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_AbandonedCart_Model_Cron
|
11 |
{
|
12 |
// const EMAIL_TEMPLATE_XML_PATH = 'ebizmarts_abandonedcart/general/template';
|
18 |
public function abandoned()
|
19 |
{
|
20 |
$allStores = Mage::app()->getStores();
|
21 |
+
foreach ($allStores as $storeid => $val) {
|
22 |
+
if (Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::ACTIVE, $storeid)) {
|
|
|
23 |
$this->_proccess($storeid);
|
24 |
}
|
25 |
+
if (Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::ENABLE_POPUP, $storeid) && Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::POPUP_CREATE_COUPON, $storeid)) {
|
26 |
$this->_sendPopupCoupon($storeid);
|
27 |
}
|
28 |
}
|
29 |
}
|
30 |
|
31 |
+
public function cleanAbandonedCartExpiredCoupons()
|
32 |
+
{
|
33 |
$allStores = Mage::app()->getStores();
|
34 |
+
foreach ($allStores as $storeid => $val) {
|
35 |
+
if (Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::ACTIVE, $storeid)) {
|
36 |
$this->_cleanCoupons($storeid);
|
37 |
}
|
38 |
}
|
44 |
protected function _proccess($storeId)
|
45 |
{
|
46 |
//Mage::app()->setCurrentStore($storeId);
|
47 |
+
Mage::unregister('_singleton/core/design_package');
|
48 |
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
|
49 |
+
Mage::getSingleton('core/design_package')->setStore($storeId);
|
50 |
|
51 |
$abTesting = false;
|
52 |
$item = Mage::getModel('ebizmarts_abandonedcart/abtesting')->getCollection()
|
53 |
+
->addFieldToFilter('store_id', array('eq' => $storeId))
|
54 |
->getFirstItem();
|
55 |
+
if ($item) {
|
56 |
$status = $item->getCurrentStatus();
|
57 |
if (Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::AB_TESTING_ACTIVE, $storeId) && $status == 1) {
|
58 |
$abTesting = true;
|
68 |
3 => Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::DAYS_4, $storeId),
|
69 |
4 => Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::DAYS_5, $storeId)
|
70 |
);
|
71 |
+
$maxtimes = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::MAXTIMES, $storeId) + 1;
|
72 |
$sendcoupon = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::SEND_COUPON, $storeId);
|
73 |
$firstdate = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::FIRST_DATE, $storeId);
|
74 |
$unit = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::UNIT, $storeId);
|
75 |
+
$customergroups = explode(",", Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::CUSTOMER_GROUPS, $storeId));
|
76 |
$mandrillTag = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::MANDRILL_TAG, $storeId) . "_$storeId";
|
77 |
|
78 |
+
if ($abTesting) {
|
79 |
+
$mandrillTag .= '_' . $suffix;
|
80 |
$sendcoupondays = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::AB_TESTING_COUPON_SENDON, $storeId);
|
81 |
+
} else {
|
82 |
$sendcoupondays = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::COUPON_DAYS, $storeId);
|
83 |
}
|
84 |
|
90 |
$couponlabel = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::COUPON_LABEL, $storeId);
|
91 |
|
92 |
// iterates one time for each mail number
|
93 |
+
for ($run = 0; $run < $maxtimes; $run++) {
|
94 |
+
if (!$days[$run]) {
|
95 |
return;
|
96 |
}
|
97 |
|
98 |
// subtract days from latest run to get difference from the actual abandon date of the cart
|
99 |
$diff = $days[$run];
|
100 |
+
if ($run == 1 && $unit == Ebizmarts_AbandonedCart_Model_Config::IN_HOURS) {
|
101 |
+
$diff -= $days[0] / 24;
|
102 |
+
} elseif ($run != 0) {
|
103 |
+
$diff -= $days[$run - 1];
|
104 |
}
|
105 |
|
106 |
// set the top date of the carts to get
|
107 |
$expr = sprintf('DATE_SUB(%s, %s)', $adapter->quote(now()), $this->_getIntervalUnitSql($diff, 'DAY'));
|
108 |
+
if ($run == 0 && $unit == Ebizmarts_AbandonedCart_Model_Config::IN_HOURS) {
|
109 |
$expr = sprintf('DATE_SUB(%s, %s)', $adapter->quote(now()), $this->_getIntervalUnitSql($diff, 'HOUR'));
|
110 |
}
|
111 |
$from = new Zend_Db_Expr($expr);
|
113 |
// get collection of abandoned carts with cart_counter == $run
|
114 |
$collection = Mage::getResourceModel('reports/quote_collection');
|
115 |
$collection->addFieldToFilter('items_count', array('neq' => '0'))
|
116 |
+
->addFieldToFilter('main_table.is_active', '1')
|
117 |
+
->addFieldToFilter('main_table.store_id', array('eq' => $storeId))
|
118 |
+
->addSubtotal($storeId)
|
119 |
+
->setOrder('updated_at');
|
120 |
|
121 |
+
$collection->addFieldToFilter('main_table.converted_at', array(array('null' => true), $this->_getSuggestedZeroDate()))
|
122 |
+
->addFieldToFilter('main_table.updated_at', array('to' => $from, 'from' => $firstdate))
|
123 |
+
->addFieldToFilter('main_table.ebizmarts_abandonedcart_counter', array('eq' => $run));
|
124 |
|
125 |
$collection->addFieldToFilter('main_table.customer_email', array('neq' => ''));
|
126 |
+
if (count($customergroups)) {
|
127 |
$collection->addFieldToFilter('main_table.customer_group_id', array('in' => $customergroups));
|
128 |
}
|
129 |
|
130 |
// for each cart of the current run
|
131 |
+
foreach ($collection as $quote) {
|
132 |
foreach ($quote->getAllVisibleItems() as $item) {
|
133 |
$removeFromQuote = false;
|
134 |
$product = Mage::getModel('catalog/product')->setStoreId($storeId)->load($item->getProductId());
|
135 |
+
if (!$product || $product->getStatus() == Mage_Catalog_Model_Product_Status::STATUS_DISABLED) {
|
136 |
+
Mage::log('AbandonedCart; ' . $product->getSku() . ' is no longer present or enabled; remove from quote ' . $quote->getId() . ' for email', null, 'Ebizmarts_AbandonedCart.log');
|
|
|
137 |
$removeFromQuote = true;
|
138 |
}
|
139 |
|
170 |
if (
|
171 |
(
|
172 |
is_object($stock) && ($stock->getManageStock() ||
|
173 |
+
($stock->getUseConfigManageStock() && Mage::getStoreConfig('cataloginventory/item_options/manage_stock', $quote->getStoreId())))
|
174 |
)
|
175 |
+
&& $stockQty < $item->getQty()
|
176 |
+
) {
|
177 |
+
Mage::log('AbandonedCart; ' . $product->getSku() . ' is no longer in stock; remove from quote ' . $quote->getId() . ' for email', null, 'Ebizmarts_AbandonedCart.log');
|
178 |
$removeFromQuote = true;
|
179 |
}
|
180 |
+
if ($removeFromQuote) {
|
|
|
181 |
$quote->removeItem($item->getId());
|
182 |
}
|
183 |
}
|
200 |
//
|
201 |
//$url = Mage::getBaseUrl('web').'ebizmarts_abandonedcart/abandoned/loadquote?id='.$quote->getEntityId();
|
202 |
//srand((double)microtime()*1000000);
|
203 |
+
$token = md5(rand(0, 9999999));
|
204 |
+
if ($abTesting) {
|
205 |
$url = Mage::getModel('core/url')->setStore($storeId)->getUrl('', array('_nosid' => true)) . 'ebizmarts_abandonedcart/abandoned/loadquote?id=' . $quote->getEntityId() . '&token=' . $token . '&' . $suffix;
|
206 |
+
} else {
|
207 |
$url = Mage::getModel('core/url')->setStore($storeId)->getUrl('', array('_nosid' => true)) . 'ebizmarts_abandonedcart/abandoned/loadquote?id=' . $quote->getEntityId() . '&token=' . $token;
|
208 |
}
|
209 |
|
210 |
+
$data = array('AbandonedURL' => $url, 'AbandonedDate' => $quote->getUpdatedAt());
|
211 |
|
212 |
// send email
|
213 |
+
$senderid = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::SENDER, $storeId);
|
214 |
+
$sender = array('name' => Mage::getStoreConfig("trans_email/ident_$senderid/name", $storeId), 'email' => Mage::getStoreConfig("trans_email/ident_$senderid/email", $storeId));
|
215 |
|
216 |
$email = $quote->getCustomerEmail();
|
217 |
|
218 |
+
if (Mage::helper('ebizmarts_autoresponder')->isSubscribed($email, 'abandonedcart', $storeId)) {
|
219 |
$name = $quote->getCustomerFirstname() . ' ' . $quote->getCustomerLastname();
|
220 |
$quote2 = Mage::getModel('sales/quote')->loadByIdWithoutStore($quote->getId());
|
221 |
$unsubscribeUrl = Mage::getModel('core/url')->setStore($storeId)->getUrl() . 'ebizautoresponder/autoresponder/unsubscribe?list=abandonedcart&email=' . $email . '&store=' . $storeId;
|
238 |
// create a new coupon
|
239 |
if (Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::COUPON_AUTOMATIC) == 2) {
|
240 |
list($couponcode, $discount, $toDate) = $this->_createNewCoupon($storeId, $email, $couponamount, $couponexpiredays, $coupontype, $couponlength, $couponlabel);
|
241 |
+
$url .= '&coupon=' . $couponcode;
|
242 |
$vars = array('quote' => $quote, 'url' => $url, 'couponcode' => $couponcode, 'discount' => $discount,
|
243 |
'todate' => $toDate, 'name' => $name, 'tags' => array($mandrillTag), 'unsubscribeurl' => $unsubscribeUrl);
|
244 |
} else {
|
245 |
$couponcode = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::COUPON_CODE);
|
246 |
+
$url .= '&coupon=' . $couponcode;
|
247 |
$vars = array('quote' => $quote, 'url' => $url, 'couponcode' => $couponcode, 'name' => $name, 'tags' => array($mandrillTag), 'unsubscribeurl' => $unsubscribeUrl);
|
248 |
}
|
249 |
} else {
|
255 |
$customer = Mage::getModel('customer/customer')
|
256 |
->setStore(Mage::app()->getStore($storeId))
|
257 |
->loadByEmail($email);
|
258 |
+
if ($customer->getId()) {
|
259 |
+
$tbtPoints = Mage::helper('ebizmarts_abandonedcart')->getTBTPoints($customer->getId(), $storeId);
|
260 |
foreach ($tbtPoints as $key => $field) {
|
261 |
if ($key == 'points') {
|
262 |
if ($field >= Mage::getStoreConfig('sweetmonkey/general/email_points', $storeId)) {
|
276 |
$quote2->setEbizmartsAbandonedcartToken($token);
|
277 |
$quote2->save();
|
278 |
|
279 |
+
if (Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::AB_TESTING_ACTIVE, $storeId)) {
|
280 |
$counterCollection = Mage::getModel('ebizmarts_abandonedcart/abtesting')->getCollection()
|
281 |
->addFieldToFilter('store_id', array('eq' => $storeId));
|
282 |
$counter = $counterCollection->getFirstItem();
|
307 |
$couponlabel = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::POPUP_COUPON_LABEL, $storeId);
|
308 |
|
309 |
$collection = Mage::getModel('ebizmarts_abandonedcart/popup')->getCollection()
|
310 |
+
->addFieldToFilter('email', array('neq' => ''))
|
311 |
+
->addFieldToFilter('processed', array('eq' => 0));
|
312 |
|
313 |
+
foreach ($collection as $item) {
|
314 |
$email = $item->getEmail();
|
|
|
|
|
|
|
315 |
$emailArr = explode('@', $email);
|
316 |
$pseudoName = $emailArr[0];
|
317 |
if (Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::POPUP_COUPON_AUTOMATIC, $storeId) == 2) {
|
321 |
$couponcode = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::POPUP_COUPON_CODE);
|
322 |
$vars = array('couponcode' => $couponcode, 'name' => $pseudoName, 'tags' => array($tags));
|
323 |
}
|
|
|
|
|
|
|
|
|
324 |
$translate = Mage::getSingleton('core/translate');
|
325 |
$mail = Mage::getModel('core/email_template')->setTemplateSubject($mailSubject)->sendTransactional($templateId, $sender, $email, $pseudoName, $vars, $storeId);
|
326 |
$item->setProcessed(1)->save();
|
337 |
protected function _createNewCoupon($store, $email, $couponamount, $couponexpiredays, $coupontype, $couponlength, $couponlabel)
|
338 |
{
|
339 |
$collection = Mage::getModel('salesrule/rule')->getCollection()
|
340 |
+
->addFieldToFilter('name', array('like' => 'Abandoned coupon ' . $email));
|
341 |
if (!count($collection)) {
|
342 |
|
343 |
$websiteid = Mage::getModel('core/store')->load($store)->getWebsiteId();
|
385 |
$coupon_rule->setCouponCode($uniqueId);
|
386 |
$coupon_rule->save();
|
387 |
return array($uniqueId, $discount, $toDate);
|
388 |
+
} else {
|
389 |
$coupon = $collection->getFirstItem();
|
390 |
if ($coupon->getSimpleAction() == 'cart_fixed') {
|
391 |
+
$discount = Mage::app()->getStore($store)->getCurrentCurrencyCode() . ($coupon->getDiscountAmount() + 0);
|
392 |
+
} else {
|
393 |
+
$discount = $coupon->getDiscountAmount() + 0;
|
394 |
}
|
395 |
return array($coupon->getCode(), $discount, $coupon->getToDate());
|
396 |
}
|
413 |
{
|
414 |
return '0000-00-00 00:00:00';
|
415 |
}
|
416 |
+
|
417 |
+
protected function _isSubscribed($email, $list, $storeId)
|
418 |
{
|
419 |
$collection = Mage::getModel('ebizmarts_autoresponder/unsubscribe')->getCollection();
|
420 |
+
$collection->addFieldtoFilter('main_table.email', array('eq' => $email))
|
421 |
+
->addFieldtoFilter('main_table.list', array('eq' => $list))
|
422 |
+
->addFieldtoFilter('main_table.store_id', array('eq' => $storeId));
|
423 |
return $collection->getSize() == 0;
|
424 |
}
|
425 |
|
428 |
* @param $store
|
429 |
* @return mixed|null
|
430 |
*/
|
431 |
+
protected function _getMailSubject($currentCount, $abTesting = false, $store)
|
432 |
+
{
|
433 |
|
434 |
$ret = NULL;
|
435 |
+
switch ($currentCount) {
|
436 |
case 0:
|
437 |
+
if ($abTesting) {
|
438 |
$ret = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::AB_TESTING_FIRST_SUBJECT, $store);
|
439 |
+
} else {
|
440 |
$ret = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::FIRST_SUBJECT, $store);
|
441 |
}
|
442 |
break;
|
443 |
case 1:
|
444 |
+
if ($abTesting) {
|
445 |
$ret = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::AB_TESTING_SECOND_SUBJECT, $store);
|
446 |
+
} else {
|
447 |
$ret = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::SECOND_SUBJECT, $store);
|
448 |
}
|
449 |
break;
|
450 |
case 2:
|
451 |
+
if ($abTesting) {
|
452 |
$ret = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::AB_TESTING_THIRD_SUBJECT, $store);
|
453 |
+
} else {
|
454 |
$ret = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::THIRD_SUBJECT, $store);
|
455 |
}
|
456 |
break;
|
457 |
case 3:
|
458 |
+
if ($abTesting) {
|
459 |
$ret = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::AB_TESTING_FOURTH_SUBJECT, $store);
|
460 |
+
} else {
|
461 |
$ret = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::FOURTH_SUBJECT, $store);
|
462 |
}
|
463 |
break;
|
464 |
case 4:
|
465 |
+
if ($abTesting) {
|
466 |
$ret = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::AB_TESTING_FIFTH_SUBJECT, $store);
|
467 |
+
} else {
|
468 |
$ret = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::FIFTH_SUBJECT, $store);
|
469 |
}
|
470 |
break;
|
477 |
* @param $currentCount
|
478 |
* @return mixed
|
479 |
*/
|
480 |
+
protected function _getTemplateId($currentCount, $abTesting = false, $store)
|
481 |
+
{
|
482 |
|
483 |
$ret = NULL;
|
484 |
+
switch ($currentCount) {
|
485 |
case 0:
|
486 |
+
if ($abTesting) {
|
487 |
$ret = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::AB_TESTING_FIRST_EMAIL, $store);
|
488 |
+
} else {
|
489 |
$ret = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::FIRST_EMAIL_TEMPLATE_XML_PATH, $store);
|
490 |
}
|
491 |
break;
|
492 |
case 1:
|
493 |
+
if ($abTesting) {
|
494 |
$ret = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::AB_TESTING_SECOND_EMAIL, $store);
|
495 |
+
} else {
|
496 |
$ret = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::SECOND_EMAIL_TEMPLATE_XML_PATH, $store);
|
497 |
}
|
498 |
break;
|
499 |
case 2:
|
500 |
+
if ($abTesting) {
|
501 |
$ret = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::AB_TESTING_THIRD_EMAIL, $store);
|
502 |
+
} else {
|
503 |
$ret = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::THIRD_EMAIL_TEMPLATE_XML_PATH, $store);
|
504 |
}
|
505 |
break;
|
506 |
case 3:
|
507 |
+
if ($abTesting) {
|
508 |
$ret = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::AB_TESTING_FOURTH_EMAIL, $store);
|
509 |
+
} else {
|
510 |
$ret = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::FOURTH_EMAIL_TEMPLATE_XML_PATH, $store);
|
511 |
}
|
512 |
break;
|
513 |
case 4:
|
514 |
+
if ($abTesting) {
|
515 |
$ret = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::AB_TESTING_FIFTH_EMAIL, $store);
|
516 |
+
} else {
|
517 |
$ret = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::FIFTH_EMAIL_TEMPLATE_XML_PATH, $store);
|
518 |
}
|
519 |
break;
|
522 |
|
523 |
}
|
524 |
|
525 |
+
protected function _cleanCoupons($store)
|
526 |
+
{
|
527 |
$today = date('Y-m-d');
|
528 |
$collection = Mage::getModel('salesrule/rule')->getCollection()
|
529 |
+
->addFieldToFilter('name', array('like' => 'Abandoned coupon%'))
|
530 |
+
->addFieldToFilter('to_date', array('lt' => $today));
|
531 |
|
532 |
foreach ($collection as $toDelete) {
|
533 |
$toDelete->delete();
|
app/code/community/Ebizmarts/AbandonedCart/Model/EventObserver.php
CHANGED
@@ -7,40 +7,37 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_AbandonedCart_Model_EventObserver
|
12 |
{
|
13 |
public function saveConfig(Varien_Event_Observer $observer)
|
14 |
{
|
15 |
-
if(Mage::app()->getRequest()->getParam('store')) {
|
16 |
$scope = 'store';
|
17 |
-
}
|
18 |
-
elseif(Mage::app()->getRequest()->getParam('website')) {
|
19 |
$scope = 'website';
|
20 |
-
}
|
21 |
-
else {
|
22 |
$scope = 'default';
|
23 |
}
|
24 |
|
25 |
$cleanCache = false;
|
26 |
-
$store = is_null($observer->getEvent()->getStore()) ? Mage::app()->getDefaultStoreView()->getCode(): $observer->getEvent()->getStore();
|
27 |
-
if(!Mage::helper('ebizmarts_mandrill')->useTransactionalService()) {
|
28 |
-
$config =
|
29 |
-
$config->saveConfig(Ebizmarts_AbandonedCart_Model_Config::ACTIVE,false
|
30 |
-
$config->saveConfig(Ebizmarts_AbandonedCart_Model_Config::ENABLE_POPUP,false
|
31 |
$cleanCache = true;
|
32 |
}
|
33 |
|
34 |
-
if(Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::SEND_COUPON, $store)){
|
35 |
$couponActive = '-';
|
36 |
-
}else{
|
37 |
$couponActive = '';
|
38 |
}
|
39 |
|
40 |
-
if(Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::AB_TESTING_ACTIVE, $store)) {
|
41 |
$stores = Mage::app()->getStores();
|
42 |
|
43 |
-
foreach($stores as $_store) {
|
44 |
$storeId = Mage::app()->getStore($_store)->getId();
|
45 |
$collection = Mage::getModel('ebizmarts_abandonedcart/abtesting')->getCollection()
|
46 |
->addFieldToFilter('store_id', array('eq' => $storeId));
|
@@ -67,20 +64,21 @@ class Ebizmarts_AbandonedCart_Model_EventObserver
|
|
67 |
}
|
68 |
}
|
69 |
|
70 |
-
if($cleanCache){
|
71 |
Mage::getConfig()->cleanCache();
|
72 |
}
|
73 |
|
74 |
}
|
75 |
|
76 |
-
public function loadCustomer(Varien_Event_Observer $observer)
|
|
|
77 |
$quote = $observer->getEvent()->getQuote();
|
78 |
-
if(!Mage::getSingleton('customer/session')->isLoggedIn() && Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::ENABLE_POPUP, $quote->getStoreId())) {
|
79 |
$action = Mage::app()->getRequest()->getActionName();
|
80 |
$onCheckout = ($action == 'saveOrder' || $action == 'savePayment' || $action == 'saveShippingMethod' || $action == 'saveBilling');
|
81 |
if (isset($_COOKIE['email']) && $_COOKIE['email'] != 'none' && !$onCheckout) {
|
82 |
$email = str_replace(' ', '+', $_COOKIE['email']);
|
83 |
-
if($quote->getCustomerEmail() != $email){
|
84 |
$quote->setCustomerEmail($email)
|
85 |
->save();
|
86 |
}
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_AbandonedCart_Model_EventObserver
|
11 |
{
|
12 |
public function saveConfig(Varien_Event_Observer $observer)
|
13 |
{
|
14 |
+
if (Mage::app()->getRequest()->getParam('store')) {
|
15 |
$scope = 'store';
|
16 |
+
} elseif (Mage::app()->getRequest()->getParam('website')) {
|
|
|
17 |
$scope = 'website';
|
18 |
+
} else {
|
|
|
19 |
$scope = 'default';
|
20 |
}
|
21 |
|
22 |
$cleanCache = false;
|
23 |
+
$store = is_null($observer->getEvent()->getStore()) ? Mage::app()->getDefaultStoreView()->getCode() : $observer->getEvent()->getStore();
|
24 |
+
if (!Mage::helper('ebizmarts_mandrill')->useTransactionalService()) {
|
25 |
+
$config = new Mage_Core_Model_Config();
|
26 |
+
$config->saveConfig(Ebizmarts_AbandonedCart_Model_Config::ACTIVE, false, $scope, $store);
|
27 |
+
$config->saveConfig(Ebizmarts_AbandonedCart_Model_Config::ENABLE_POPUP, false, $scope, $store);
|
28 |
$cleanCache = true;
|
29 |
}
|
30 |
|
31 |
+
if (Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::SEND_COUPON, $store)) {
|
32 |
$couponActive = '-';
|
33 |
+
} else {
|
34 |
$couponActive = '';
|
35 |
}
|
36 |
|
37 |
+
if (Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::AB_TESTING_ACTIVE, $store)) {
|
38 |
$stores = Mage::app()->getStores();
|
39 |
|
40 |
+
foreach ($stores as $_store) {
|
41 |
$storeId = Mage::app()->getStore($_store)->getId();
|
42 |
$collection = Mage::getModel('ebizmarts_abandonedcart/abtesting')->getCollection()
|
43 |
->addFieldToFilter('store_id', array('eq' => $storeId));
|
64 |
}
|
65 |
}
|
66 |
|
67 |
+
if ($cleanCache) {
|
68 |
Mage::getConfig()->cleanCache();
|
69 |
}
|
70 |
|
71 |
}
|
72 |
|
73 |
+
public function loadCustomer(Varien_Event_Observer $observer)
|
74 |
+
{
|
75 |
$quote = $observer->getEvent()->getQuote();
|
76 |
+
if (!Mage::getSingleton('customer/session')->isLoggedIn() && Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::ENABLE_POPUP, $quote->getStoreId())) {
|
77 |
$action = Mage::app()->getRequest()->getActionName();
|
78 |
$onCheckout = ($action == 'saveOrder' || $action == 'savePayment' || $action == 'saveShippingMethod' || $action == 'saveBilling');
|
79 |
if (isset($_COOKIE['email']) && $_COOKIE['email'] != 'none' && !$onCheckout) {
|
80 |
$email = str_replace(' ', '+', $_COOKIE['email']);
|
81 |
+
if ($quote->getCustomerEmail() != $email) {
|
82 |
$quote->setCustomerEmail($email)
|
83 |
->save();
|
84 |
}
|
app/code/community/Ebizmarts/AbandonedCart/Model/Mailssent.php
CHANGED
@@ -7,10 +7,10 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_AbandonedCart_Model_Mailssent extends Mage_Core_Model_Abstract
|
12 |
{
|
13 |
-
public function _construct()
|
|
|
14 |
$this->_init('ebizmarts_abandonedcart/mailssent');
|
15 |
}
|
16 |
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_AbandonedCart_Model_Mailssent extends Mage_Core_Model_Abstract
|
11 |
{
|
12 |
+
public function _construct()
|
13 |
+
{
|
14 |
$this->_init('ebizmarts_abandonedcart/mailssent');
|
15 |
}
|
16 |
|
app/code/community/Ebizmarts/AbandonedCart/Model/Popup.php
CHANGED
@@ -7,10 +7,10 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_AbandonedCart_Model_Popup extends Mage_Core_Model_Abstract
|
12 |
{
|
13 |
-
public function _construct()
|
|
|
14 |
$this->_init('ebizmarts_abandonedcart/popup');
|
15 |
}
|
16 |
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_AbandonedCart_Model_Popup extends Mage_Core_Model_Abstract
|
11 |
{
|
12 |
+
public function _construct()
|
13 |
+
{
|
14 |
$this->_init('ebizmarts_abandonedcart/popup');
|
15 |
}
|
16 |
|
app/code/community/Ebizmarts/AbandonedCart/Model/Resource/Abtesting.php
CHANGED
@@ -7,12 +7,11 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_AbandonedCart_Model_Resource_Abtesting extends Mage_Core_Model_Mysql4_Abstract
|
12 |
{
|
13 |
public function _construct()
|
14 |
{
|
15 |
-
$this->_init('ebizmarts_abandonedcart/abtesting','id');
|
16 |
}
|
17 |
|
18 |
}
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_AbandonedCart_Model_Resource_Abtesting extends Mage_Core_Model_Mysql4_Abstract
|
11 |
{
|
12 |
public function _construct()
|
13 |
{
|
14 |
+
$this->_init('ebizmarts_abandonedcart/abtesting', 'id');
|
15 |
}
|
16 |
|
17 |
}
|
app/code/community/Ebizmarts/AbandonedCart/Model/Resource/Abtesting/Collection.php
CHANGED
@@ -7,7 +7,6 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_AbandonedCart_Model_Resource_Abtesting_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
12 |
{
|
13 |
protected function _construct()
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_AbandonedCart_Model_Resource_Abtesting_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
11 |
{
|
12 |
protected function _construct()
|
app/code/community/Ebizmarts/AbandonedCart/Model/Resource/Mailssent.php
CHANGED
@@ -7,12 +7,11 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_AbandonedCart_Model_Resource_Mailssent extends Mage_Core_Model_Mysql4_Abstract
|
12 |
{
|
13 |
public function _construct()
|
14 |
{
|
15 |
-
$this->_init('ebizmarts_abandonedcart/mailssent','id');
|
16 |
}
|
17 |
|
18 |
}
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_AbandonedCart_Model_Resource_Mailssent extends Mage_Core_Model_Mysql4_Abstract
|
11 |
{
|
12 |
public function _construct()
|
13 |
{
|
14 |
+
$this->_init('ebizmarts_abandonedcart/mailssent', 'id');
|
15 |
}
|
16 |
|
17 |
}
|
app/code/community/Ebizmarts/AbandonedCart/Model/Resource/Mailssent/Collection.php
CHANGED
@@ -7,7 +7,6 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_AbandonedCart_Model_Resource_Mailssent_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
12 |
{
|
13 |
protected function _construct()
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_AbandonedCart_Model_Resource_Mailssent_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
11 |
{
|
12 |
protected function _construct()
|
app/code/community/Ebizmarts/AbandonedCart/Model/Resource/Order/Collection.php
CHANGED
@@ -7,7 +7,6 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_AbandonedCart_Model_Resource_Order_Collection extends Mage_Reports_Model_Mysql4_Order_Collection
|
12 |
{
|
13 |
public function isLive()
|
@@ -32,8 +31,8 @@ class Ebizmarts_AbandonedCart_Model_Resource_Order_Collection extends Mage_Repor
|
|
32 |
}
|
33 |
|
34 |
$this->addFieldToFilter($fieldToFilter, array(
|
35 |
-
'from'
|
36 |
-
'to'
|
37 |
));
|
38 |
|
39 |
return $this;
|
@@ -53,7 +52,7 @@ class Ebizmarts_AbandonedCart_Model_Resource_Order_Collection extends Mage_Repor
|
|
53 |
}
|
54 |
$adapter = $this->getConnection();
|
55 |
|
56 |
-
if (Mage::getStoreConfig('sales/dashboard/use_aggregated_data')==8) {
|
57 |
$this->setMainTable('sales/order_aggregated_created');
|
58 |
$this->removeAllFieldsFromSelect();
|
59 |
$averageExpr = $adapter->getCheckSql(
|
@@ -62,7 +61,7 @@ class Ebizmarts_AbandonedCart_Model_Resource_Order_Collection extends Mage_Repor
|
|
62 |
0);
|
63 |
$this->getSelect()->columns(array(
|
64 |
'lifetime' => 'SUM(main_table.total_revenue_amount)',
|
65 |
-
'average'
|
66 |
));
|
67 |
|
68 |
if (!$isFilter) {
|
@@ -74,12 +73,11 @@ class Ebizmarts_AbandonedCart_Model_Resource_Order_Collection extends Mage_Repor
|
|
74 |
} else {
|
75 |
$this->setMainTable('sales/order');
|
76 |
$this->removeAllFieldsFromSelect();
|
77 |
-
if(version_compare(Mage::getVersion(), '1.6.0.0')==1) {
|
78 |
$expr = 'IFNULL(main_table.base_subtotal, 0) - IFNULL(main_table.base_subtotal_refunded, 0)'
|
79 |
. ' - IFNULL(main_table.base_subtotal_canceled, 0) - ABS(IFNULL(main_table.base_discount_amount, 0))'
|
80 |
. ' + IFNULL(main_table.base_discount_refunded, 0)';
|
81 |
-
}
|
82 |
-
else if(version_compare(Mage::getVersion(), '1.6.0.0', '<')) {
|
83 |
$expr = sprintf('%s - %s - %s - (%s - %s - %s)',
|
84 |
"IFNULL('main_table.base_total_invoiced', 0)",
|
85 |
"IFNULL('main_table.base_tax_invoiced', 0)",
|
@@ -88,8 +86,7 @@ class Ebizmarts_AbandonedCart_Model_Resource_Order_Collection extends Mage_Repor
|
|
88 |
"IFNULL('main_table.base_tax_refunded', 0)",
|
89 |
"IFNULL('main_table.base_shipping_refunded', 0)"
|
90 |
);
|
91 |
-
}
|
92 |
-
else {
|
93 |
$expr = sprintf('%s - %s - %s - (%s - %s - %s)',
|
94 |
$adapter->getIfNullSql('main_table.base_total_invoiced', 0),
|
95 |
$adapter->getIfNullSql('main_table.base_tax_invoiced', 0),
|
@@ -106,14 +103,14 @@ class Ebizmarts_AbandonedCart_Model_Resource_Order_Collection extends Mage_Repor
|
|
106 |
|
107 |
$this->getSelect()
|
108 |
->columns(array(
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
->where('main_table.status NOT IN(?)', $statuses)
|
113 |
->where('main_table.state NOT IN(?)', array(
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
}
|
118 |
return $this;
|
119 |
}
|
@@ -127,7 +124,7 @@ class Ebizmarts_AbandonedCart_Model_Resource_Order_Collection extends Mage_Repor
|
|
127 |
*/
|
128 |
public function getDateRange($range, $customStart, $customEnd, $returnObjects = false)
|
129 |
{
|
130 |
-
$dateEnd
|
131 |
$dateStart = clone $dateEnd;
|
132 |
|
133 |
// go to the end of a day
|
@@ -139,8 +136,7 @@ class Ebizmarts_AbandonedCart_Model_Resource_Order_Collection extends Mage_Repor
|
|
139 |
$dateStart->setMinute(0);
|
140 |
$dateStart->setSecond(0);
|
141 |
|
142 |
-
switch ($range)
|
143 |
-
{
|
144 |
case '24h':
|
145 |
$dateEnd = Mage::app()->getLocale()->date();
|
146 |
$dateEnd->addHour(1);
|
@@ -177,7 +173,7 @@ class Ebizmarts_AbandonedCart_Model_Resource_Order_Collection extends Mage_Repor
|
|
177 |
break;
|
178 |
case 'custom':
|
179 |
$dateStart = $customStart ? $customStart : $dateEnd;
|
180 |
-
$dateEnd
|
181 |
break;
|
182 |
|
183 |
case '1y':
|
@@ -190,8 +186,7 @@ class Ebizmarts_AbandonedCart_Model_Resource_Order_Collection extends Mage_Repor
|
|
190 |
$dateStart->setDay($startDay);
|
191 |
if ($range == '2y') {
|
192 |
$dateStart->subYear(1);
|
193 |
-
}
|
194 |
-
elseif($range == 'lifetime') {
|
195 |
$dateStart->subYear(1000);
|
196 |
}
|
197 |
break;
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_AbandonedCart_Model_Resource_Order_Collection extends Mage_Reports_Model_Mysql4_Order_Collection
|
11 |
{
|
12 |
public function isLive()
|
31 |
}
|
32 |
|
33 |
$this->addFieldToFilter($fieldToFilter, array(
|
34 |
+
'from' => $from->toString(Varien_Date::DATETIME_INTERNAL_FORMAT),
|
35 |
+
'to' => $to->toString(Varien_Date::DATETIME_INTERNAL_FORMAT)
|
36 |
));
|
37 |
|
38 |
return $this;
|
52 |
}
|
53 |
$adapter = $this->getConnection();
|
54 |
|
55 |
+
if (Mage::getStoreConfig('sales/dashboard/use_aggregated_data') == 8) {
|
56 |
$this->setMainTable('sales/order_aggregated_created');
|
57 |
$this->removeAllFieldsFromSelect();
|
58 |
$averageExpr = $adapter->getCheckSql(
|
61 |
0);
|
62 |
$this->getSelect()->columns(array(
|
63 |
'lifetime' => 'SUM(main_table.total_revenue_amount)',
|
64 |
+
'average' => $averageExpr
|
65 |
));
|
66 |
|
67 |
if (!$isFilter) {
|
73 |
} else {
|
74 |
$this->setMainTable('sales/order');
|
75 |
$this->removeAllFieldsFromSelect();
|
76 |
+
if (version_compare(Mage::getVersion(), '1.6.0.0') == 1) {
|
77 |
$expr = 'IFNULL(main_table.base_subtotal, 0) - IFNULL(main_table.base_subtotal_refunded, 0)'
|
78 |
. ' - IFNULL(main_table.base_subtotal_canceled, 0) - ABS(IFNULL(main_table.base_discount_amount, 0))'
|
79 |
. ' + IFNULL(main_table.base_discount_refunded, 0)';
|
80 |
+
} else if (version_compare(Mage::getVersion(), '1.6.0.0', '<')) {
|
|
|
81 |
$expr = sprintf('%s - %s - %s - (%s - %s - %s)',
|
82 |
"IFNULL('main_table.base_total_invoiced', 0)",
|
83 |
"IFNULL('main_table.base_tax_invoiced', 0)",
|
86 |
"IFNULL('main_table.base_tax_refunded', 0)",
|
87 |
"IFNULL('main_table.base_shipping_refunded', 0)"
|
88 |
);
|
89 |
+
} else {
|
|
|
90 |
$expr = sprintf('%s - %s - %s - (%s - %s - %s)',
|
91 |
$adapter->getIfNullSql('main_table.base_total_invoiced', 0),
|
92 |
$adapter->getIfNullSql('main_table.base_tax_invoiced', 0),
|
103 |
|
104 |
$this->getSelect()
|
105 |
->columns(array(
|
106 |
+
'lifetime' => "SUM({$expr})",
|
107 |
+
'average' => "AVG({$expr})"
|
108 |
+
))
|
109 |
->where('main_table.status NOT IN(?)', $statuses)
|
110 |
->where('main_table.state NOT IN(?)', array(
|
111 |
+
Mage_Sales_Model_Order::STATE_NEW,
|
112 |
+
Mage_Sales_Model_Order::STATE_PENDING_PAYMENT)
|
113 |
+
);
|
114 |
}
|
115 |
return $this;
|
116 |
}
|
124 |
*/
|
125 |
public function getDateRange($range, $customStart, $customEnd, $returnObjects = false)
|
126 |
{
|
127 |
+
$dateEnd = Mage::app()->getLocale()->date();
|
128 |
$dateStart = clone $dateEnd;
|
129 |
|
130 |
// go to the end of a day
|
136 |
$dateStart->setMinute(0);
|
137 |
$dateStart->setSecond(0);
|
138 |
|
139 |
+
switch ($range) {
|
|
|
140 |
case '24h':
|
141 |
$dateEnd = Mage::app()->getLocale()->date();
|
142 |
$dateEnd->addHour(1);
|
173 |
break;
|
174 |
case 'custom':
|
175 |
$dateStart = $customStart ? $customStart : $dateEnd;
|
176 |
+
$dateEnd = $customEnd ? $customEnd : $dateEnd;
|
177 |
break;
|
178 |
|
179 |
case '1y':
|
186 |
$dateStart->setDay($startDay);
|
187 |
if ($range == '2y') {
|
188 |
$dateStart->subYear(1);
|
189 |
+
} elseif ($range == 'lifetime') {
|
|
|
190 |
$dateStart->subYear(1000);
|
191 |
}
|
192 |
break;
|
app/code/community/Ebizmarts/AbandonedCart/Model/Resource/Popup.php
CHANGED
@@ -7,12 +7,11 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_AbandonedCart_Model_Resource_Popup extends Mage_Core_Model_Mysql4_Abstract
|
12 |
{
|
13 |
public function _construct()
|
14 |
{
|
15 |
-
$this->_init('ebizmarts_abandonedcart/popup','id');
|
16 |
}
|
17 |
|
18 |
}
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_AbandonedCart_Model_Resource_Popup extends Mage_Core_Model_Mysql4_Abstract
|
11 |
{
|
12 |
public function _construct()
|
13 |
{
|
14 |
+
$this->_init('ebizmarts_abandonedcart/popup', 'id');
|
15 |
}
|
16 |
|
17 |
}
|
app/code/community/Ebizmarts/AbandonedCart/Model/Resource/Popup/Collection.php
CHANGED
@@ -7,7 +7,6 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_AbandonedCart_Model_Resource_Popup_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
12 |
{
|
13 |
protected function _construct()
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_AbandonedCart_Model_Resource_Popup_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
11 |
{
|
12 |
protected function _construct()
|
app/code/community/Ebizmarts/AbandonedCart/Model/System/Config/Automatic.php
CHANGED
@@ -7,7 +7,6 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_AbandonedCart_Model_System_Config_Automatic
|
12 |
{
|
13 |
/**
|
@@ -16,8 +15,8 @@ class Ebizmarts_AbandonedCart_Model_System_Config_Automatic
|
|
16 |
public function toOptionArray()
|
17 |
{
|
18 |
$options = array(
|
19 |
-
array('value'=> 1, 'label' => Mage::helper('ebizmarts_abandonedcart')->__('Specific')),
|
20 |
-
array('value'=> 2, 'label' => Mage::helper('ebizmarts_abandonedcart')->__('Automatic'))
|
21 |
);
|
22 |
return $options;
|
23 |
}
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_AbandonedCart_Model_System_Config_Automatic
|
11 |
{
|
12 |
/**
|
15 |
public function toOptionArray()
|
16 |
{
|
17 |
$options = array(
|
18 |
+
array('value' => 1, 'label' => Mage::helper('ebizmarts_abandonedcart')->__('Specific')),
|
19 |
+
array('value' => 2, 'label' => Mage::helper('ebizmarts_abandonedcart')->__('Automatic'))
|
20 |
);
|
21 |
return $options;
|
22 |
}
|
app/code/community/Ebizmarts/AbandonedCart/Model/System/Config/Cmspage.php
CHANGED
@@ -7,14 +7,13 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_AbandonedCart_Model_System_Config_Cmspage
|
12 |
{
|
13 |
|
14 |
public function toOptionArray()
|
15 |
{
|
16 |
$collection = Mage::getModel('cms/page')->getCollection()->addOrder('title', 'asc');
|
17 |
-
return array('checkout/cart'=> "Shopping Cart (default page)") + $collection->toOptionIdArray();
|
18 |
}
|
19 |
|
20 |
}
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_AbandonedCart_Model_System_Config_Cmspage
|
11 |
{
|
12 |
|
13 |
public function toOptionArray()
|
14 |
{
|
15 |
$collection = Mage::getModel('cms/page')->getCollection()->addOrder('title', 'asc');
|
16 |
+
return array('checkout/cart' => "Shopping Cart (default page)") + $collection->toOptionIdArray();
|
17 |
}
|
18 |
|
19 |
}
|
app/code/community/Ebizmarts/AbandonedCart/Model/System/Config/Customergroup.php
CHANGED
@@ -7,7 +7,6 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_AbandonedCart_Model_System_Config_Customergroup
|
12 |
{
|
13 |
protected $_options;
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_AbandonedCart_Model_System_Config_Customergroup
|
11 |
{
|
12 |
protected $_options;
|
app/code/community/Ebizmarts/AbandonedCart/Model/System/Config/Discounttype.php
CHANGED
@@ -7,7 +7,6 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_AbandonedCart_Model_System_Config_Discounttype
|
12 |
{
|
13 |
/**
|
@@ -16,11 +15,12 @@ class Ebizmarts_AbandonedCart_Model_System_Config_Discounttype
|
|
16 |
public function toOptionArray()
|
17 |
{
|
18 |
$options = array(
|
19 |
-
|
20 |
-
|
21 |
);
|
22 |
return $options;
|
23 |
}
|
|
|
24 |
public function options()
|
25 |
{
|
26 |
$options[1] = Mage::helper('ebizmarts_abandonedcart')->__('Fixed amount');
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_AbandonedCart_Model_System_Config_Discounttype
|
11 |
{
|
12 |
/**
|
15 |
public function toOptionArray()
|
16 |
{
|
17 |
$options = array(
|
18 |
+
array('value' => 1, 'label' => Mage::helper('ebizmarts_abandonedcart')->__('Fixed amount')),
|
19 |
+
array('value' => 2, 'label' => Mage::helper('ebizmarts_abandonedcart')->__('Percentage'))
|
20 |
);
|
21 |
return $options;
|
22 |
}
|
23 |
+
|
24 |
public function options()
|
25 |
{
|
26 |
$options[1] = Mage::helper('ebizmarts_abandonedcart')->__('Fixed amount');
|
app/code/community/Ebizmarts/AbandonedCart/Model/System/Config/Maxemails.php
CHANGED
@@ -5,8 +5,8 @@ class Ebizmarts_AbandonedCart_Model_System_Config_Maxemails
|
|
5 |
public function toOptionArray()
|
6 |
{
|
7 |
$options = array();
|
8 |
-
for($i = 0; $i < Ebizmarts_AbandonedCart_Model_Config::MAXTIMES_NUM; $i++){
|
9 |
-
$options[]=array('value'=> $i, 'label' => $i+1);
|
10 |
}
|
11 |
return $options;
|
12 |
}
|
5 |
public function toOptionArray()
|
6 |
{
|
7 |
$options = array();
|
8 |
+
for ($i = 0; $i < Ebizmarts_AbandonedCart_Model_Config::MAXTIMES_NUM; $i++) {
|
9 |
+
$options[] = array('value' => $i, 'label' => $i + 1);
|
10 |
}
|
11 |
return $options;
|
12 |
}
|
app/code/community/Ebizmarts/AbandonedCart/Model/System/Config/Unit.php
CHANGED
@@ -7,14 +7,13 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_AbandonedCart_Model_System_Config_Unit
|
12 |
{
|
13 |
public function toOptionArray()
|
14 |
{
|
15 |
$options = array(
|
16 |
-
array('value'=> Ebizmarts_AbandonedCart_Model_Config::IN_DAYS, 'label' => Mage::helper('ebizmarts_abandonedcart')->__('Days')),
|
17 |
-
array('value'=> Ebizmarts_AbandonedCart_Model_Config::IN_HOURS, 'label' => Mage::helper('ebizmarts_abandonedcart')->__('Hours'))
|
18 |
);
|
19 |
return $options;
|
20 |
}
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_AbandonedCart_Model_System_Config_Unit
|
11 |
{
|
12 |
public function toOptionArray()
|
13 |
{
|
14 |
$options = array(
|
15 |
+
array('value' => Ebizmarts_AbandonedCart_Model_Config::IN_DAYS, 'label' => Mage::helper('ebizmarts_abandonedcart')->__('Days')),
|
16 |
+
array('value' => Ebizmarts_AbandonedCart_Model_Config::IN_HOURS, 'label' => Mage::helper('ebizmarts_abandonedcart')->__('Hours'))
|
17 |
);
|
18 |
return $options;
|
19 |
}
|
app/code/community/Ebizmarts/AbandonedCart/Model/System/Config/Yesnovariation.php
CHANGED
@@ -7,21 +7,20 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_AbandonedCart_Model_System_Config_Yesnovariation
|
12 |
{
|
13 |
public function toOptionArray()
|
14 |
{
|
15 |
$code = Mage::getSingleton('adminhtml/config_data')->getStore();
|
16 |
$storeId = Mage::getModel('core/store')->load($code)->getId();
|
17 |
-
if(Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::SEND_COUPON, $storeId)){
|
18 |
$active = -Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::MAXTIMES, $storeId);
|
19 |
-
}else{
|
20 |
$active = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::MAXTIMES, $storeId);
|
21 |
}
|
22 |
$options = array(
|
23 |
-
array('value'=> 0, 'label' => Mage::helper('ebizmarts_abandonedcart')->__('No')),
|
24 |
-
array('value'=> $active, 'label' => Mage::helper('ebizmarts_abandonedcart')->__('Yes'))
|
25 |
);
|
26 |
return $options;
|
27 |
}
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_AbandonedCart_Model_System_Config_Yesnovariation
|
11 |
{
|
12 |
public function toOptionArray()
|
13 |
{
|
14 |
$code = Mage::getSingleton('adminhtml/config_data')->getStore();
|
15 |
$storeId = Mage::getModel('core/store')->load($code)->getId();
|
16 |
+
if (Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::SEND_COUPON, $storeId)) {
|
17 |
$active = -Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::MAXTIMES, $storeId);
|
18 |
+
} else {
|
19 |
$active = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::MAXTIMES, $storeId);
|
20 |
}
|
21 |
$options = array(
|
22 |
+
array('value' => 0, 'label' => Mage::helper('ebizmarts_abandonedcart')->__('No')),
|
23 |
+
array('value' => $active, 'label' => Mage::helper('ebizmarts_abandonedcart')->__('Yes'))
|
24 |
);
|
25 |
return $options;
|
26 |
}
|
app/code/community/Ebizmarts/AbandonedCart/controllers/AbandonedController.php
CHANGED
@@ -8,7 +8,7 @@
|
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
|
11 |
-
require_once Mage::getModuleDir('controllers','Mage_Checkout').DS.'CartController.php';
|
12 |
|
13 |
class Ebizmarts_AbandonedCart_AbandonedController extends Mage_Checkout_CartController
|
14 |
{
|
@@ -18,43 +18,37 @@ class Ebizmarts_AbandonedCart_AbandonedController extends Mage_Checkout_CartCont
|
|
18 |
public function loadquoteAction()
|
19 |
{
|
20 |
$params = $this->getRequest()->getParams();
|
21 |
-
if(isset($params['id']))
|
22 |
-
{
|
23 |
//restore the quote
|
24 |
// Mage::log($params['id']);
|
25 |
|
26 |
$quote = Mage::getModel('sales/quote')->load($params['id']);
|
27 |
-
$url = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::PAGE
|
28 |
-
if(isset($params['coupon'])){
|
29 |
$quote->setCouponCode($params['coupon']);
|
30 |
$quote->save();
|
31 |
}
|
32 |
-
if((!isset($params['token']) || (isset($params['token'])
|
33 |
Mage::getSingleton('customer/session')->addNotice("Your token cart is incorrect");
|
34 |
$this->_redirect($url);
|
35 |
-
}
|
36 |
-
|
37 |
-
$url = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::PAGE,$quote->getStoreId());
|
38 |
$quote->setEbizmartsAbandonedcartFlag(1);
|
39 |
$quote->save();
|
40 |
-
if(!$quote->getCustomerId()) {
|
41 |
$this->_getSession()->setQuoteId($quote->getId());
|
42 |
$this->_redirect($url);
|
43 |
-
}
|
44 |
-
|
45 |
-
if(Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::AUTOLOGIN,$quote->getStoreId())) {
|
46 |
$customer = Mage::getModel('customer/customer')->load($quote->getCustomerId());
|
47 |
-
if($customer->getId())
|
48 |
-
{
|
49 |
Mage::getSingleton('customer/session')->setCustomerAsLoggedIn($customer);
|
50 |
}
|
51 |
$this->_redirect($url);
|
52 |
-
}
|
53 |
-
|
54 |
-
if(Mage::helper('customer')->isLoggedIn()) {
|
55 |
$this->_redirect($url);
|
56 |
-
}
|
57 |
-
else {
|
58 |
Mage::getSingleton('customer/session')->addNotice("Login to complete your order");
|
59 |
$this->_redirect('customer/account');
|
60 |
}
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
|
11 |
+
require_once Mage::getModuleDir('controllers', 'Mage_Checkout') . DS . 'CartController.php';
|
12 |
|
13 |
class Ebizmarts_AbandonedCart_AbandonedController extends Mage_Checkout_CartController
|
14 |
{
|
18 |
public function loadquoteAction()
|
19 |
{
|
20 |
$params = $this->getRequest()->getParams();
|
21 |
+
if (isset($params['id'])) {
|
|
|
22 |
//restore the quote
|
23 |
// Mage::log($params['id']);
|
24 |
|
25 |
$quote = Mage::getModel('sales/quote')->load($params['id']);
|
26 |
+
$url = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::PAGE, $quote->getStoreId());
|
27 |
+
if (isset($params['coupon'])) {
|
28 |
$quote->setCouponCode($params['coupon']);
|
29 |
$quote->save();
|
30 |
}
|
31 |
+
if ((!isset($params['token']) || (isset($params['token']) && $params['token'] != $quote->getEbizmartsAbandonedcartToken())) && Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::AUTOLOGIN, $quote->getStoreId())) {
|
32 |
Mage::getSingleton('customer/session')->addNotice("Your token cart is incorrect");
|
33 |
$this->_redirect($url);
|
34 |
+
} else {
|
35 |
+
$url = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::PAGE, $quote->getStoreId());
|
|
|
36 |
$quote->setEbizmartsAbandonedcartFlag(1);
|
37 |
$quote->save();
|
38 |
+
if (!$quote->getCustomerId()) {
|
39 |
$this->_getSession()->setQuoteId($quote->getId());
|
40 |
$this->_redirect($url);
|
41 |
+
} else {
|
42 |
+
if (Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::AUTOLOGIN, $quote->getStoreId())) {
|
|
|
43 |
$customer = Mage::getModel('customer/customer')->load($quote->getCustomerId());
|
44 |
+
if ($customer->getId()) {
|
|
|
45 |
Mage::getSingleton('customer/session')->setCustomerAsLoggedIn($customer);
|
46 |
}
|
47 |
$this->_redirect($url);
|
48 |
+
} else {
|
49 |
+
if (Mage::helper('customer')->isLoggedIn()) {
|
|
|
50 |
$this->_redirect($url);
|
51 |
+
} else {
|
|
|
52 |
Mage::getSingleton('customer/session')->addNotice("Login to complete your order");
|
53 |
$this->_redirect('customer/account');
|
54 |
}
|
app/code/community/Ebizmarts/AbandonedCart/controllers/Adminhtml/AbandonedmailsController.php
CHANGED
@@ -7,8 +7,7 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
-
class Ebizmarts_AbandonedCart_Adminhtml_AbandonedmailsController extends Mage_Adminhtml_Controller_Action
|
12 |
{
|
13 |
/**
|
14 |
*
|
@@ -40,8 +39,8 @@ class Ebizmarts_AbandonedCart_Adminhtml_AbandonedmailsController extends Mage_A
|
|
40 |
*/
|
41 |
public function exportCsvAction()
|
42 |
{
|
43 |
-
$fileName
|
44 |
-
$grid
|
45 |
$this->_prepareDownloadResponse($fileName, $grid->getCsvFile());
|
46 |
}
|
47 |
|
@@ -50,8 +49,8 @@ class Ebizmarts_AbandonedCart_Adminhtml_AbandonedmailsController extends Mage_A
|
|
50 |
*/
|
51 |
public function exportExcelAction()
|
52 |
{
|
53 |
-
$fileName
|
54 |
-
$grid
|
55 |
$this->_prepareDownloadResponse($fileName, $grid->getExcelFile($fileName));
|
56 |
}
|
57 |
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
+
class Ebizmarts_AbandonedCart_Adminhtml_AbandonedmailsController extends Mage_Adminhtml_Controller_Action
|
|
|
11 |
{
|
12 |
/**
|
13 |
*
|
39 |
*/
|
40 |
public function exportCsvAction()
|
41 |
{
|
42 |
+
$fileName = 'orders.csv';
|
43 |
+
$grid = $this->getLayout()->createBlock('ebizmarts_abandonedcart/adminhtml_abandonedmails_grid');
|
44 |
$this->_prepareDownloadResponse($fileName, $grid->getCsvFile());
|
45 |
}
|
46 |
|
49 |
*/
|
50 |
public function exportExcelAction()
|
51 |
{
|
52 |
+
$fileName = 'orders.xml';
|
53 |
+
$grid = $this->getLayout()->createBlock('ebizmarts_abandonedcart/adminhtml_abandonedmails_grid');
|
54 |
$this->_prepareDownloadResponse($fileName, $grid->getExcelFile($fileName));
|
55 |
}
|
56 |
|
app/code/community/Ebizmarts/AbandonedCart/controllers/Adminhtml/AbandonedorderController.php
CHANGED
@@ -7,7 +7,6 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_AbandonedCart_Adminhtml_AbandonedorderController extends Mage_Adminhtml_Controller_Action
|
12 |
{
|
13 |
/**
|
@@ -26,7 +25,7 @@ class Ebizmarts_AbandonedCart_Adminhtml_AbandonedorderController extends Mage_Ad
|
|
26 |
protected function _initAction()
|
27 |
{
|
28 |
$this->loadLayout()
|
29 |
-
|
30 |
->_setActiveMenu('sales/ebizmarts_abandonedcart')
|
31 |
->_title($this->__('Sales'))->_title($this->__('Abandoned'))
|
32 |
->_addBreadcrumb($this->__('Sales'), $this->__('Sales'))
|
@@ -40,8 +39,8 @@ class Ebizmarts_AbandonedCart_Adminhtml_AbandonedorderController extends Mage_Ad
|
|
40 |
*/
|
41 |
public function exportCsvAction()
|
42 |
{
|
43 |
-
$fileName
|
44 |
-
$grid
|
45 |
$this->_prepareDownloadResponse($fileName, $grid->getCsvFile());
|
46 |
}
|
47 |
|
@@ -50,8 +49,8 @@ class Ebizmarts_AbandonedCart_Adminhtml_AbandonedorderController extends Mage_Ad
|
|
50 |
*/
|
51 |
public function exportExcelAction()
|
52 |
{
|
53 |
-
$fileName
|
54 |
-
$grid
|
55 |
$this->_prepareDownloadResponse($fileName, $grid->getExcelFile($fileName));
|
56 |
}
|
57 |
|
@@ -71,12 +70,12 @@ class Ebizmarts_AbandonedCart_Adminhtml_AbandonedorderController extends Mage_Ad
|
|
71 |
{
|
72 |
// $this->_initAction()
|
73 |
// ->renderLayout();
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
|
81 |
}
|
82 |
|
@@ -85,9 +84,9 @@ class Ebizmarts_AbandonedCart_Adminhtml_AbandonedorderController extends Mage_Ad
|
|
85 |
*/
|
86 |
public function ajaxBlockAction()
|
87 |
{
|
88 |
-
$output
|
89 |
$blockTab = $this->getRequest()->getParam('block');
|
90 |
-
if ($blockTab =='totals') {
|
91 |
$output = $this->getLayout()->createBlock('ebizmarts_abandonedcart/adminhtml_dashboard_' . $blockTab)->toHtml();
|
92 |
}
|
93 |
$this->getResponse()->setBody($output);
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_AbandonedCart_Adminhtml_AbandonedorderController extends Mage_Adminhtml_Controller_Action
|
11 |
{
|
12 |
/**
|
25 |
protected function _initAction()
|
26 |
{
|
27 |
$this->loadLayout()
|
28 |
+
// Make the active menu match the menu config nodes (without 'children' inbetween)
|
29 |
->_setActiveMenu('sales/ebizmarts_abandonedcart')
|
30 |
->_title($this->__('Sales'))->_title($this->__('Abandoned'))
|
31 |
->_addBreadcrumb($this->__('Sales'), $this->__('Sales'))
|
39 |
*/
|
40 |
public function exportCsvAction()
|
41 |
{
|
42 |
+
$fileName = 'orders.csv';
|
43 |
+
$grid = $this->getLayout()->createBlock('ebizmarts_abandonedcart/adminhtml_abandonedorder_grid');
|
44 |
$this->_prepareDownloadResponse($fileName, $grid->getCsvFile());
|
45 |
}
|
46 |
|
49 |
*/
|
50 |
public function exportExcelAction()
|
51 |
{
|
52 |
+
$fileName = 'orders.xml';
|
53 |
+
$grid = $this->getLayout()->createBlock('ebizmarts_abandonedcart/adminhtml_abandonedorder_grid');
|
54 |
$this->_prepareDownloadResponse($fileName, $grid->getExcelFile($fileName));
|
55 |
}
|
56 |
|
70 |
{
|
71 |
// $this->_initAction()
|
72 |
// ->renderLayout();
|
73 |
+
$this->loadLayout()
|
74 |
+
->_setActiveMenu('dashboard/ebizmarts_abandonedcart')
|
75 |
+
->_title($this->__('Dashboard'))->_title($this->__('Abandoned'))
|
76 |
+
->_addBreadcrumb($this->__('Dashboard'), $this->__('Dashboard'))
|
77 |
+
->_addBreadcrumb($this->__('abandonedorder'), $this->__('Abandoned'))
|
78 |
+
->renderLayout();
|
79 |
|
80 |
}
|
81 |
|
84 |
*/
|
85 |
public function ajaxBlockAction()
|
86 |
{
|
87 |
+
$output = '';
|
88 |
$blockTab = $this->getRequest()->getParam('block');
|
89 |
+
if ($blockTab == 'totals') {
|
90 |
$output = $this->getLayout()->createBlock('ebizmarts_abandonedcart/adminhtml_dashboard_' . $blockTab)->toHtml();
|
91 |
}
|
92 |
$this->getResponse()->setBody($output);
|
app/code/community/Ebizmarts/AbandonedCart/etc/config.xml
CHANGED
@@ -141,7 +141,8 @@
|
|
141 |
<adminhtml>
|
142 |
<args>
|
143 |
<modules>
|
144 |
-
<Ebizmarts_Abandonedcart before="Mage_Adminhtml">Ebizmarts_AbandonedCart_Adminhtml
|
|
|
145 |
</modules>
|
146 |
</args>
|
147 |
</adminhtml>
|
@@ -214,8 +215,12 @@
|
|
214 |
</run>
|
215 |
</ebizmarts_abandoned_cart>
|
216 |
<ebizmarts_abandoned_cart_clean_expiredcoupons>
|
217 |
-
<schedule
|
218 |
-
|
|
|
|
|
|
|
|
|
219 |
</ebizmarts_abandoned_cart_clean_expiredcoupons>
|
220 |
</jobs>
|
221 |
</crontab>
|
@@ -238,8 +243,10 @@
|
|
238 |
<emailcatcher>
|
239 |
<popup_cancel>1</popup_cancel>
|
240 |
<popup_subscription>1</popup_subscription>
|
241 |
-
<popup_heading>
|
242 |
-
<popup_text>
|
|
|
|
|
243 |
<popup_width>410</popup_width>
|
244 |
<popup_cookie_time>1</popup_cookie_time>
|
245 |
<popup_insist>1</popup_insist>
|
141 |
<adminhtml>
|
142 |
<args>
|
143 |
<modules>
|
144 |
+
<Ebizmarts_Abandonedcart before="Mage_Adminhtml">Ebizmarts_AbandonedCart_Adminhtml
|
145 |
+
</Ebizmarts_Abandonedcart>
|
146 |
</modules>
|
147 |
</args>
|
148 |
</adminhtml>
|
215 |
</run>
|
216 |
</ebizmarts_abandoned_cart>
|
217 |
<ebizmarts_abandoned_cart_clean_expiredcoupons>
|
218 |
+
<schedule>
|
219 |
+
<cron_expr>0 0 1 * *</cron_expr>
|
220 |
+
</schedule>
|
221 |
+
<run>
|
222 |
+
<model>ebizmarts_abandonedcart/cron::cleanAbandonedCartExpiredCoupons</model>
|
223 |
+
</run>
|
224 |
</ebizmarts_abandoned_cart_clean_expiredcoupons>
|
225 |
</jobs>
|
226 |
</crontab>
|
243 |
<emailcatcher>
|
244 |
<popup_cancel>1</popup_cancel>
|
245 |
<popup_subscription>1</popup_subscription>
|
246 |
+
<popup_heading>Welcome to our store!</popup_heading>
|
247 |
+
<popup_text>Please enter your email address to get the most of our store and improve your shopping
|
248 |
+
experience.
|
249 |
+
</popup_text>
|
250 |
<popup_width>410</popup_width>
|
251 |
<popup_cookie_time>1</popup_cookie_time>
|
252 |
<popup_insist>1</popup_insist>
|
app/code/community/Ebizmarts/AbandonedCart/etc/system.xml
CHANGED
@@ -185,7 +185,7 @@
|
|
185 |
<comment><![CDATA[The subject for the second email abandoned cart]]></comment>
|
186 |
<depends>
|
187 |
<max separator=",">1,2,3,4</max>
|
188 |
-
|
189 |
</depends>
|
190 |
</subject2>
|
191 |
<template2 translate="label">
|
@@ -210,7 +210,8 @@
|
|
210 |
<show_in_website>1</show_in_website>
|
211 |
<show_in_store>1</show_in_store>
|
212 |
<can_be_empty>0</can_be_empty>
|
213 |
-
<comment
|
|
|
214 |
<depends>
|
215 |
<max separator=",">1,2,3,4</max>
|
216 |
<active>1</active>
|
@@ -252,7 +253,8 @@
|
|
252 |
<show_in_website>1</show_in_website>
|
253 |
<show_in_store>1</show_in_store>
|
254 |
<can_be_empty>0</can_be_empty>
|
255 |
-
<comment
|
|
|
256 |
<depends>
|
257 |
<max separator=",">2,3,4</max>
|
258 |
<active>1</active>
|
@@ -294,7 +296,8 @@
|
|
294 |
<show_in_website>1</show_in_website>
|
295 |
<show_in_store>1</show_in_store>
|
296 |
<can_be_empty>0</can_be_empty>
|
297 |
-
<comment
|
|
|
298 |
<depends>
|
299 |
<max separator=",">3,4</max>
|
300 |
<active>1</active>
|
@@ -336,7 +339,8 @@
|
|
336 |
<show_in_website>1</show_in_website>
|
337 |
<show_in_store>1</show_in_store>
|
338 |
<can_be_empty>0</can_be_empty>
|
339 |
-
<comment
|
|
|
340 |
<depends>
|
341 |
<max separator=",">4</max>
|
342 |
<active>1</active>
|
@@ -478,6 +482,7 @@
|
|
478 |
<show_in_website>1</show_in_website>
|
479 |
<show_in_store>1</show_in_store>
|
480 |
<can_be_empty>0</can_be_empty>
|
|
|
481 |
<depends>
|
482 |
<create>1</create>
|
483 |
<automatic>2</automatic>
|
@@ -665,7 +670,8 @@
|
|
665 |
<show_in_website>1</show_in_website>
|
666 |
<show_in_store>1</show_in_store>
|
667 |
<can_be_empty>0</can_be_empty>
|
668 |
-
<comment
|
|
|
669 |
<depends>
|
670 |
<active separator=",">-0,-1,-2,-3,-4</active>
|
671 |
</depends>
|
@@ -688,7 +694,8 @@
|
|
688 |
<show_in_default>1</show_in_default>
|
689 |
<show_in_website>1</show_in_website>
|
690 |
<show_in_store>1</show_in_store>
|
691 |
-
<comment
|
|
|
692 |
</popup_general>
|
693 |
<popup_heading translate="label comment">
|
694 |
<label>Popup Heading</label>
|
@@ -737,7 +744,8 @@
|
|
737 |
<show_in_default>1</show_in_default>
|
738 |
<show_in_website>1</show_in_website>
|
739 |
<show_in_store>1</show_in_store>
|
740 |
-
<comment
|
|
|
741 |
<depends>
|
742 |
<popup_general>1</popup_general>
|
743 |
</depends>
|
@@ -775,7 +783,8 @@
|
|
775 |
<show_in_default>1</show_in_default>
|
776 |
<show_in_website>1</show_in_website>
|
777 |
<show_in_store>1</show_in_store>
|
778 |
-
<comment
|
|
|
779 |
<depends>
|
780 |
<popup_general>1</popup_general>
|
781 |
<popup_cancel>1</popup_cancel>
|
@@ -901,6 +910,7 @@
|
|
901 |
<show_in_website>1</show_in_website>
|
902 |
<show_in_store>1</show_in_store>
|
903 |
<can_be_empty>0</can_be_empty>
|
|
|
904 |
<depends>
|
905 |
<popup_coupon>1</popup_coupon>
|
906 |
<popup_automatic>2</popup_automatic>
|
185 |
<comment><![CDATA[The subject for the second email abandoned cart]]></comment>
|
186 |
<depends>
|
187 |
<max separator=",">1,2,3,4</max>
|
188 |
+
<active>1</active>
|
189 |
</depends>
|
190 |
</subject2>
|
191 |
<template2 translate="label">
|
210 |
<show_in_website>1</show_in_website>
|
211 |
<show_in_store>1</show_in_store>
|
212 |
<can_be_empty>0</can_be_empty>
|
213 |
+
<comment>
|
214 |
+
<![CDATA[This value is in days and is set since the moment cart was abandoned.]]></comment>
|
215 |
<depends>
|
216 |
<max separator=",">1,2,3,4</max>
|
217 |
<active>1</active>
|
253 |
<show_in_website>1</show_in_website>
|
254 |
<show_in_store>1</show_in_store>
|
255 |
<can_be_empty>0</can_be_empty>
|
256 |
+
<comment>
|
257 |
+
<![CDATA[This value is in days and is set since the moment cart was abandoned.]]></comment>
|
258 |
<depends>
|
259 |
<max separator=",">2,3,4</max>
|
260 |
<active>1</active>
|
296 |
<show_in_website>1</show_in_website>
|
297 |
<show_in_store>1</show_in_store>
|
298 |
<can_be_empty>0</can_be_empty>
|
299 |
+
<comment>
|
300 |
+
<![CDATA[This value is in days and is set since the moment cart was abandoned.]]></comment>
|
301 |
<depends>
|
302 |
<max separator=",">3,4</max>
|
303 |
<active>1</active>
|
339 |
<show_in_website>1</show_in_website>
|
340 |
<show_in_store>1</show_in_store>
|
341 |
<can_be_empty>0</can_be_empty>
|
342 |
+
<comment>
|
343 |
+
<![CDATA[This value is in days and is set since the moment cart was abandoned.]]></comment>
|
344 |
<depends>
|
345 |
<max separator=",">4</max>
|
346 |
<active>1</active>
|
482 |
<show_in_website>1</show_in_website>
|
483 |
<show_in_store>1</show_in_store>
|
484 |
<can_be_empty>0</can_be_empty>
|
485 |
+
<comment><![CDATA[Amount]]></comment>
|
486 |
<depends>
|
487 |
<create>1</create>
|
488 |
<automatic>2</automatic>
|
670 |
<show_in_website>1</show_in_website>
|
671 |
<show_in_store>1</show_in_store>
|
672 |
<can_be_empty>0</can_be_empty>
|
673 |
+
<comment>
|
674 |
+
<![CDATA[The coupon will be created on testing email for Abandoned Cart number]]></comment>
|
675 |
<depends>
|
676 |
<active separator=",">-0,-1,-2,-3,-4</active>
|
677 |
</depends>
|
694 |
<show_in_default>1</show_in_default>
|
695 |
<show_in_website>1</show_in_website>
|
696 |
<show_in_store>1</show_in_store>
|
697 |
+
<comment>
|
698 |
+
<![CDATA[Create popup when customer access the site for the first time to catch email to use later on Abandoned Cart mailing.]]></comment>
|
699 |
</popup_general>
|
700 |
<popup_heading translate="label comment">
|
701 |
<label>Popup Heading</label>
|
744 |
<show_in_default>1</show_in_default>
|
745 |
<show_in_website>1</show_in_website>
|
746 |
<show_in_store>1</show_in_store>
|
747 |
+
<comment>
|
748 |
+
<![CDATA[When email confirmed on popup subscribe customer to newsletter.]]></comment>
|
749 |
<depends>
|
750 |
<popup_general>1</popup_general>
|
751 |
</depends>
|
783 |
<show_in_default>1</show_in_default>
|
784 |
<show_in_website>1</show_in_website>
|
785 |
<show_in_store>1</show_in_store>
|
786 |
+
<comment>
|
787 |
+
<![CDATA[If customer doesn't confirm popup, it will be shown this many times each time the customer reload the page.]]></comment>
|
788 |
<depends>
|
789 |
<popup_general>1</popup_general>
|
790 |
<popup_cancel>1</popup_cancel>
|
910 |
<show_in_website>1</show_in_website>
|
911 |
<show_in_store>1</show_in_store>
|
912 |
<can_be_empty>0</can_be_empty>
|
913 |
+
<comment><![CDATA[Amount]]></comment>
|
914 |
<depends>
|
915 |
<popup_coupon>1</popup_coupon>
|
916 |
<popup_automatic>2</popup_automatic>
|
app/code/community/Ebizmarts/Autoresponder/Block/Adminhtml/System/Config/Backtostock/Fieldset/Hint.php
CHANGED
@@ -7,7 +7,6 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_Autoresponder_Block_Adminhtml_System_Config_Backtostock_Fieldset_Hint
|
12 |
extends Mage_Adminhtml_Block_Abstract
|
13 |
implements Varien_Data_Form_Element_Renderer_Interface
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_Autoresponder_Block_Adminhtml_System_Config_Backtostock_Fieldset_Hint
|
11 |
extends Mage_Adminhtml_Block_Abstract
|
12 |
implements Varien_Data_Form_Element_Renderer_Interface
|
app/code/community/Ebizmarts/Autoresponder/Block/Adminhtml/System/Config/Birthday/Fieldset/Hint.php
CHANGED
@@ -7,7 +7,6 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_Autoresponder_Block_Adminhtml_System_Config_Birthday_Fieldset_Hint
|
12 |
extends Mage_Adminhtml_Block_Abstract
|
13 |
implements Varien_Data_Form_Element_Renderer_Interface
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_Autoresponder_Block_Adminhtml_System_Config_Birthday_Fieldset_Hint
|
11 |
extends Mage_Adminhtml_Block_Abstract
|
12 |
implements Varien_Data_Form_Element_Renderer_Interface
|
app/code/community/Ebizmarts/Autoresponder/Block/Adminhtml/System/Config/Fieldset/Hint.php
CHANGED
@@ -7,7 +7,6 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_Autoresponder_Block_Adminhtml_System_Config_Fieldset_Hint
|
12 |
extends Mage_Adminhtml_Block_Abstract
|
13 |
implements Varien_Data_Form_Element_Renderer_Interface
|
@@ -28,18 +27,19 @@ class Ebizmarts_Autoresponder_Block_Adminhtml_System_Config_Fieldset_Hint
|
|
28 |
*/
|
29 |
public function getVersion()
|
30 |
{
|
31 |
-
return (string)
|
32 |
}
|
33 |
|
34 |
/**
|
35 |
* @return string
|
36 |
*/
|
37 |
-
public function getPxParams()
|
|
|
38 |
$v = (string)Mage::getConfig()->getNode('modules/Ebizmarts_Autoresponder/version');
|
39 |
$ext = "Abandoned Cart;{$v}";
|
40 |
|
41 |
$modulesArray = (array)Mage::getConfig()->getNode('modules')->children();
|
42 |
-
$aux = (array_key_exists('Enterprise_Enterprise', $modulesArray))? 'EE' : 'CE'
|
43 |
$mageVersion = Mage::getVersion();
|
44 |
$mage = "Magento {$aux};{$mageVersion}";
|
45 |
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_Autoresponder_Block_Adminhtml_System_Config_Fieldset_Hint
|
11 |
extends Mage_Adminhtml_Block_Abstract
|
12 |
implements Varien_Data_Form_Element_Renderer_Interface
|
27 |
*/
|
28 |
public function getVersion()
|
29 |
{
|
30 |
+
return (string)Mage::getConfig()->getNode('modules/Ebizmarts_Autoresponder/version');
|
31 |
}
|
32 |
|
33 |
/**
|
34 |
* @return string
|
35 |
*/
|
36 |
+
public function getPxParams()
|
37 |
+
{
|
38 |
$v = (string)Mage::getConfig()->getNode('modules/Ebizmarts_Autoresponder/version');
|
39 |
$ext = "Abandoned Cart;{$v}";
|
40 |
|
41 |
$modulesArray = (array)Mage::getConfig()->getNode('modules')->children();
|
42 |
+
$aux = (array_key_exists('Enterprise_Enterprise', $modulesArray)) ? 'EE' : 'CE';
|
43 |
$mageVersion = Mage::getVersion();
|
44 |
$mage = "Magento {$aux};{$mageVersion}";
|
45 |
|
app/code/community/Ebizmarts/Autoresponder/Block/Adminhtml/System/Config/Review/Fieldset/Hint.php
CHANGED
@@ -7,7 +7,6 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_Autoresponder_Block_Adminhtml_System_Config_Review_Fieldset_Hint
|
12 |
extends Mage_Adminhtml_Block_Abstract
|
13 |
implements Varien_Data_Form_Element_Renderer_Interface
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_Autoresponder_Block_Adminhtml_System_Config_Review_Fieldset_Hint
|
11 |
extends Mage_Adminhtml_Block_Abstract
|
12 |
implements Varien_Data_Form_Element_Renderer_Interface
|
app/code/community/Ebizmarts/Autoresponder/Block/Adminhtml/System/Config/Wishlist/Fieldset/Hint.php
CHANGED
@@ -7,7 +7,6 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_Autoresponder_Block_Adminhtml_System_Config_Wishlist_Fieldset_Hint
|
12 |
extends Mage_Adminhtml_Block_Abstract
|
13 |
implements Varien_Data_Form_Element_Renderer_Interface
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_Autoresponder_Block_Adminhtml_System_Config_Wishlist_Fieldset_Hint
|
11 |
extends Mage_Adminhtml_Block_Abstract
|
12 |
implements Varien_Data_Form_Element_Renderer_Interface
|
app/code/community/Ebizmarts/Autoresponder/Block/Backtostock/Notice.php
CHANGED
@@ -7,7 +7,6 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_Autoresponder_Block_Backtostock_Notice extends Mage_Core_Block_Template
|
12 |
{
|
13 |
public function __construct()
|
@@ -26,11 +25,11 @@ class Ebizmarts_Autoresponder_Block_Backtostock_Notice extends Mage_Core_Block_T
|
|
26 |
{
|
27 |
$email = false;
|
28 |
|
29 |
-
if(!$this->isLoggedIn()) {
|
30 |
return $email;
|
31 |
}
|
32 |
|
33 |
-
if(Mage::helper('customer')->getCurrentCustomer()) {
|
34 |
$email = Mage::helper('customer')->getCurrentCustomer()->getEmail();
|
35 |
}
|
36 |
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_Autoresponder_Block_Backtostock_Notice extends Mage_Core_Block_Template
|
11 |
{
|
12 |
public function __construct()
|
25 |
{
|
26 |
$email = false;
|
27 |
|
28 |
+
if (!$this->isLoggedIn()) {
|
29 |
return $email;
|
30 |
}
|
31 |
|
32 |
+
if (Mage::helper('customer')->getCurrentCustomer()) {
|
33 |
$email = Mage::helper('customer')->getCurrentCustomer()->getEmail();
|
34 |
}
|
35 |
|
app/code/community/Ebizmarts/Autoresponder/Block/Customer/Account/List.php
CHANGED
@@ -7,13 +7,13 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_Autoresponder_Block_Customer_Account_List extends Mage_Core_Block_Template
|
12 |
{
|
13 |
public function getLists()
|
14 |
{
|
15 |
return Mage::helper('ebizmarts_autoresponder')->getLists();
|
16 |
}
|
|
|
17 |
public function getSaveUrl()
|
18 |
{
|
19 |
return $this->getUrl('ebizautoresponder/autoresponder/savelist');
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_Autoresponder_Block_Customer_Account_List extends Mage_Core_Block_Template
|
11 |
{
|
12 |
public function getLists()
|
13 |
{
|
14 |
return Mage::helper('ebizmarts_autoresponder')->getLists();
|
15 |
}
|
16 |
+
|
17 |
public function getSaveUrl()
|
18 |
{
|
19 |
return $this->getUrl('ebizautoresponder/autoresponder/savelist');
|
app/code/community/Ebizmarts/Autoresponder/Block/Email/Backtostock/Item.php
CHANGED
@@ -7,8 +7,7 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
-
class Ebizmarts_Autoresponder_Block_Email_Backtostock_Item extends Mage_Sales_Block_Items_Abstract
|
12 |
{
|
13 |
public function _construct()
|
14 |
{
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
+
class Ebizmarts_Autoresponder_Block_Email_Backtostock_Item extends Mage_Sales_Block_Items_Abstract
|
|
|
11 |
{
|
12 |
public function _construct()
|
13 |
{
|
app/code/community/Ebizmarts/Autoresponder/Block/Email/Related/Items.php
CHANGED
@@ -7,8 +7,7 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
-
class Ebizmarts_Autoresponder_Block_Email_Related_Items extends Mage_Sales_Block_Items_Abstract
|
12 |
{
|
13 |
public function _construct()
|
14 |
{
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
+
class Ebizmarts_Autoresponder_Block_Email_Related_Items extends Mage_Sales_Block_Items_Abstract
|
|
|
11 |
{
|
12 |
public function _construct()
|
13 |
{
|
app/code/community/Ebizmarts/Autoresponder/Block/Email/Review/Items.php
CHANGED
@@ -7,8 +7,7 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
-
class Ebizmarts_Autoresponder_Block_Email_Review_Items extends Mage_Sales_Block_Items_Abstract
|
12 |
{
|
13 |
public function _construct()
|
14 |
{
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
+
class Ebizmarts_Autoresponder_Block_Email_Review_Items extends Mage_Sales_Block_Items_Abstract
|
|
|
11 |
{
|
12 |
public function _construct()
|
13 |
{
|
app/code/community/Ebizmarts/Autoresponder/Block/Email/Wishlist/Items.php
CHANGED
@@ -6,7 +6,6 @@
|
|
6 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
7 |
* @license http://opensource.org/licenses/osl-3.0.php
|
8 |
*/
|
9 |
-
|
10 |
class Ebizmarts_Autoresponder_Block_Email_Wishlist_Items extends Mage_Sales_Block_Items_Abstract
|
11 |
{
|
12 |
public function _construct()
|
6 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
7 |
* @license http://opensource.org/licenses/osl-3.0.php
|
8 |
*/
|
|
|
9 |
class Ebizmarts_Autoresponder_Block_Email_Wishlist_Items extends Mage_Sales_Block_Items_Abstract
|
10 |
{
|
11 |
public function _construct()
|
app/code/community/Ebizmarts/Autoresponder/Block/Review/Form.php
CHANGED
@@ -7,7 +7,6 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_Autoresponder_Block_Review_Form extends Mage_Review_Block_Form
|
12 |
{
|
13 |
public function getAction()
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_Autoresponder_Block_Review_Form extends Mage_Review_Block_Form
|
11 |
{
|
12 |
public function getAction()
|
app/code/community/Ebizmarts/Autoresponder/Block/Unsubscribe.php
CHANGED
@@ -7,10 +7,10 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_Autoresponder_Block_Unsubscribe extends Mage_Core_Block_Template
|
12 |
{
|
13 |
-
public function _construct()
|
|
|
14 |
parent::_construct();
|
15 |
$this->setTemplate('ebizmarts/autoresponder/unsubscribe.phtml');
|
16 |
}
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_Autoresponder_Block_Unsubscribe extends Mage_Core_Block_Template
|
11 |
{
|
12 |
+
public function _construct()
|
13 |
+
{
|
14 |
parent::_construct();
|
15 |
$this->setTemplate('ebizmarts/autoresponder/unsubscribe.phtml');
|
16 |
}
|
app/code/community/Ebizmarts/Autoresponder/Helper/Data.php
CHANGED
@@ -7,8 +7,8 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
-
|
12 |
|
13 |
/**
|
14 |
* Get module configuration value
|
@@ -22,7 +22,7 @@ class Ebizmarts_Autoresponder_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
22 |
$store = is_null($store) ? Mage::app()->getStore() : $store;
|
23 |
|
24 |
$configscope = Mage::app()->getRequest()->getParam('store');
|
25 |
-
if(
|
26 |
$store = $configscope;
|
27 |
}
|
28 |
|
@@ -38,7 +38,7 @@ class Ebizmarts_Autoresponder_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
38 |
*/
|
39 |
public function log($data, $filename = 'Ebizmarts_Autoresponder.log')
|
40 |
{
|
41 |
-
if($this->config('general/enable_log') != 0) {
|
42 |
return Mage::getModel('core/log_adapter', $filename)->log($data);
|
43 |
}
|
44 |
}
|
@@ -48,20 +48,19 @@ class Ebizmarts_Autoresponder_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
48 |
$types = array();
|
49 |
$storeId = Mage::app()->getStore()->getStoreId();
|
50 |
$lists = Mage::getConfig()->getNode('default/ebizmarts_autoresponder')->asArray();
|
51 |
-
$lists['abandonedcart'] = array('listname'=>
|
52 |
-
foreach ($lists as $key
|
53 |
-
if(isset($data['listname'])) {
|
54 |
-
if(Mage::getStoreConfig("ebizmarts_autoresponder/$key/active"
|
55 |
$types[$key]['listname'] = (string)$data['listname'];
|
56 |
$collection = Mage::getModel('ebizmarts_autoresponder/unsubscribe')->getCollection();
|
57 |
$email = $this->_getEmail();
|
58 |
-
$collection->addFieldToFilter('main_table.email',array('eq'
|
59 |
-
->addFieldToFilter('main_table.list',array('eq'
|
60 |
-
->addFieldToFilter('main_table.store_id',array('eq'
|
61 |
-
if($collection->getSize() > 0) {
|
62 |
$types[$key]['checked'] = "";
|
63 |
-
}
|
64 |
-
else {
|
65 |
$types[$key]['checked'] = "checked";
|
66 |
}
|
67 |
}
|
@@ -69,6 +68,7 @@ class Ebizmarts_Autoresponder_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
69 |
}
|
70 |
return $types;
|
71 |
}
|
|
|
72 |
protected function _getEmail()
|
73 |
{
|
74 |
return Mage::helper('customer')->getCustomer()->getEmail();
|
@@ -82,12 +82,13 @@ class Ebizmarts_Autoresponder_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
82 |
return $allowGuests;
|
83 |
}
|
84 |
|
85 |
-
public function getCanShowJs()
|
|
|
86 |
$storeId = Mage::app()->getStore()->getStoreId();
|
87 |
-
if(Mage::getStoreConfig('ebizmarts_autoresponder/general/active', $storeId) && Mage::getStoreConfig('ebizmarts_autoresponder/visitedproducts/active', $storeId)) {
|
88 |
-
if(Mage::getStoreConfig('web/url/use_store', $storeId)){
|
89 |
return 'ebizmarts/autoresponders/visitedproductsstorecodes.js';
|
90 |
-
}else{
|
91 |
return 'ebizmarts/autoresponders/visitedproducts.js';
|
92 |
}
|
93 |
|
@@ -95,71 +96,74 @@ class Ebizmarts_Autoresponder_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
95 |
|
96 |
}
|
97 |
|
98 |
-
public function isSetTime($setTime)
|
|
|
99 |
$now = date('H');
|
100 |
-
if($now == $setTime){
|
101 |
return true;
|
102 |
}
|
103 |
$this->log('Time set on Autoresponder configuration is different than the current time.');
|
104 |
return false;
|
105 |
}
|
106 |
|
107 |
-
public function isSubscribed($email
|
108 |
{
|
109 |
$collection = Mage::getModel('ebizmarts_autoresponder/unsubscribe')->getCollection();
|
110 |
-
$collection->addFieldtoFilter('main_table.email',array('eq'
|
111 |
-
->addFieldtoFilter('main_table.list',array('eq'
|
112 |
-
->addFieldtoFilter('main_table.store_id',array('eq'
|
113 |
return $collection->getSize() == 0;
|
114 |
}
|
115 |
|
116 |
-
public function getTBTPoints($customerId)
|
117 |
{
|
118 |
|
119 |
-
|
|
|
120 |
|
121 |
-
|
122 |
-
|
123 |
|
124 |
-
|
125 |
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
|
131 |
-
|
132 |
|
133 |
-
|
134 |
-
|
135 |
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
|
|
|
146 |
}
|
147 |
-
}
|
148 |
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
|
|
|
|
161 |
}
|
162 |
-
return $tbtVars;
|
163 |
}
|
164 |
|
165 |
}
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
+
class Ebizmarts_Autoresponder_Helper_Data extends Mage_Core_Helper_Abstract
|
11 |
+
{
|
12 |
|
13 |
/**
|
14 |
* Get module configuration value
|
22 |
$store = is_null($store) ? Mage::app()->getStore() : $store;
|
23 |
|
24 |
$configscope = Mage::app()->getRequest()->getParam('store');
|
25 |
+
if ($configscope && ($configscope !== 'undefined')) {
|
26 |
$store = $configscope;
|
27 |
}
|
28 |
|
38 |
*/
|
39 |
public function log($data, $filename = 'Ebizmarts_Autoresponder.log')
|
40 |
{
|
41 |
+
if ($this->config('general/enable_log') != 0) {
|
42 |
return Mage::getModel('core/log_adapter', $filename)->log($data);
|
43 |
}
|
44 |
}
|
48 |
$types = array();
|
49 |
$storeId = Mage::app()->getStore()->getStoreId();
|
50 |
$lists = Mage::getConfig()->getNode('default/ebizmarts_autoresponder')->asArray();
|
51 |
+
$lists['abandonedcart'] = array('listname' => Mage::helper('ebizmarts_abandonedcart')->__('Abandoned Carts List'));
|
52 |
+
foreach ($lists as $key => $data) {
|
53 |
+
if (isset($data['listname'])) {
|
54 |
+
if (Mage::getStoreConfig("ebizmarts_autoresponder/$key/active", $storeId) || ($key == 'abandonedcart' && Mage::getStoreConfig("ebizmarts_abandonedcart/general/active", $storeId))) {
|
55 |
$types[$key]['listname'] = (string)$data['listname'];
|
56 |
$collection = Mage::getModel('ebizmarts_autoresponder/unsubscribe')->getCollection();
|
57 |
$email = $this->_getEmail();
|
58 |
+
$collection->addFieldToFilter('main_table.email', array('eq' => $email))
|
59 |
+
->addFieldToFilter('main_table.list', array('eq' => $key))
|
60 |
+
->addFieldToFilter('main_table.store_id', array('eq' => $storeId));
|
61 |
+
if ($collection->getSize() > 0) {
|
62 |
$types[$key]['checked'] = "";
|
63 |
+
} else {
|
|
|
64 |
$types[$key]['checked'] = "checked";
|
65 |
}
|
66 |
}
|
68 |
}
|
69 |
return $types;
|
70 |
}
|
71 |
+
|
72 |
protected function _getEmail()
|
73 |
{
|
74 |
return Mage::helper('customer')->getCustomer()->getEmail();
|
82 |
return $allowGuests;
|
83 |
}
|
84 |
|
85 |
+
public function getCanShowJs()
|
86 |
+
{
|
87 |
$storeId = Mage::app()->getStore()->getStoreId();
|
88 |
+
if (Mage::getStoreConfig('ebizmarts_autoresponder/general/active', $storeId) && Mage::getStoreConfig('ebizmarts_autoresponder/visitedproducts/active', $storeId)) {
|
89 |
+
if (Mage::getStoreConfig('web/url/use_store', $storeId)) {
|
90 |
return 'ebizmarts/autoresponders/visitedproductsstorecodes.js';
|
91 |
+
} else {
|
92 |
return 'ebizmarts/autoresponders/visitedproducts.js';
|
93 |
}
|
94 |
|
96 |
|
97 |
}
|
98 |
|
99 |
+
public function isSetTime($setTime)
|
100 |
+
{
|
101 |
$now = date('H');
|
102 |
+
if ($now == $setTime) {
|
103 |
return true;
|
104 |
}
|
105 |
$this->log('Time set on Autoresponder configuration is different than the current time.');
|
106 |
return false;
|
107 |
}
|
108 |
|
109 |
+
public function isSubscribed($email, $list, $storeId)
|
110 |
{
|
111 |
$collection = Mage::getModel('ebizmarts_autoresponder/unsubscribe')->getCollection();
|
112 |
+
$collection->addFieldtoFilter('main_table.email', array('eq' => $email))
|
113 |
+
->addFieldtoFilter('main_table.list', array('eq' => $list))
|
114 |
+
->addFieldtoFilter('main_table.store_id', array('eq' => $storeId));
|
115 |
return $collection->getSize() == 0;
|
116 |
}
|
117 |
|
118 |
+
public function getTBTPoints($customerId, $storeId)
|
119 |
{
|
120 |
|
121 |
+
if (Mage::getStoreConfig('sweetmonkey/general/active', $storeId)) {
|
122 |
+
$tbtCustomer = Mage::getModel('rewards/customer')->load($customerId);
|
123 |
|
124 |
+
//Point balance
|
125 |
+
$tbtVars['pts'] = $tbtCustomer->getPointsSummary();
|
126 |
|
127 |
+
$tbtVars['points'] = $tbtCustomer->getUsablePointsBalance(1);
|
128 |
|
129 |
+
//Earn and Spent points
|
130 |
+
$lastTransfers = $tbtCustomer->getTransfers()
|
131 |
+
->selectOnlyActive()
|
132 |
+
->addOrder('last_update_ts', Varien_Data_Collection::SORT_ORDER_DESC);
|
133 |
|
134 |
+
$spent = $earn = null;
|
135 |
|
136 |
+
if ($lastTransfers->getSize()) {
|
137 |
+
foreach ($lastTransfers as $transfer) {
|
138 |
|
139 |
+
if (is_null($earn) && $transfer->getQuantity() > 0) {
|
140 |
+
$earn = $this->_formatDateMerge($transfer->getEffectiveStart());
|
141 |
+
} else if (is_null($spent) && $transfer->getQuantity() < 0) {
|
142 |
+
$spent = $this->_formatDateMerge($transfer->getEffectiveStart());
|
143 |
+
}
|
144 |
|
145 |
+
if (!is_null($spent) && !is_null($earn)) {
|
146 |
+
break;
|
147 |
+
}
|
148 |
|
149 |
+
}
|
150 |
}
|
|
|
151 |
|
152 |
+
if ($earn) {
|
153 |
+
$tbtVars['ptsearn'] = $earn;
|
154 |
+
}
|
155 |
+
if ($spent) {
|
156 |
+
$tbtVars['ptsspent'] = $spent;
|
157 |
+
}
|
158 |
|
159 |
+
//Expiration Points
|
160 |
+
$val = Mage::getSingleton('rewards/expiry')
|
161 |
+
->getExpiryDate($tbtCustomer);
|
162 |
+
if ($val) {
|
163 |
+
$tbtVars['ptsexp'] = $val;
|
164 |
+
}
|
165 |
+
return $tbtVars;
|
166 |
}
|
|
|
167 |
}
|
168 |
|
169 |
}
|
app/code/community/Ebizmarts/Autoresponder/Model/Backtostock.php
CHANGED
@@ -7,10 +7,10 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_Autoresponder_Model_Backtostock extends Mage_Core_Model_Abstract
|
12 |
{
|
13 |
-
public function _construct()
|
|
|
14 |
$this->_init('ebizmarts_autoresponder/backtostock');
|
15 |
}
|
16 |
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_Autoresponder_Model_Backtostock extends Mage_Core_Model_Abstract
|
11 |
{
|
12 |
+
public function _construct()
|
13 |
+
{
|
14 |
$this->_init('ebizmarts_autoresponder/backtostock');
|
15 |
}
|
16 |
|
app/code/community/Ebizmarts/Autoresponder/Model/Backtostockalert.php
CHANGED
@@ -7,10 +7,10 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_Autoresponder_Model_Backtostockalert extends Mage_Core_Model_Abstract
|
12 |
{
|
13 |
-
public function _construct()
|
|
|
14 |
$this->_init('ebizmarts_autoresponder/backtostockalert');
|
15 |
}
|
16 |
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_Autoresponder_Model_Backtostockalert extends Mage_Core_Model_Abstract
|
11 |
{
|
12 |
+
public function _construct()
|
13 |
+
{
|
14 |
$this->_init('ebizmarts_autoresponder/backtostockalert');
|
15 |
}
|
16 |
|
app/code/community/Ebizmarts/Autoresponder/Model/Config.php
CHANGED
@@ -7,117 +7,116 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_Autoresponder_Model_Config
|
12 |
{
|
13 |
-
const GENERAL_ACTIVE
|
14 |
-
const GENERAL_SENDER
|
15 |
|
16 |
-
const NEWORDER_ACTIVE
|
17 |
-
const NEWORDER_DAYS
|
18 |
-
const NEWORDER_CUSTOMER_GROUPS
|
19 |
-
const NEWORDER_TRIGGER
|
20 |
-
const NEWORDER_ORDER_STATUS
|
21 |
-
const NEWORDER_TEMPLATE
|
22 |
-
const NEWORDER_MANDRILL_TAG
|
23 |
-
const NEWORDER_SUBJECT
|
24 |
-
const NEWORDER_CRON_TIME
|
25 |
|
26 |
-
const RELATED_ACTIVE
|
27 |
-
const RELATED_DAYS
|
28 |
-
const RELATED_CUSTOMER_GROUPS
|
29 |
-
const RELATED_TEMPLATE
|
30 |
-
const RELATED_MANDRILL_TAG
|
31 |
-
const RELATED_SUBJECT
|
32 |
-
const RELATED_MAX
|
33 |
-
const RELATED_STATUS
|
34 |
-
const RELATED_CRON_TIME
|
35 |
|
36 |
-
const REVIEW_ACTIVE
|
37 |
-
const REVIEW_DAYS
|
38 |
-
const REVIEW_CUSTOMER_GROUPS
|
39 |
-
const REVIEW_TEMPLATE
|
40 |
-
const REVIEW_MANDRILL_TAG
|
41 |
-
const REVIEW_SUBJECT
|
42 |
-
const REVIEW_STATUS
|
43 |
-
const REVIEW_HAS_COUPON
|
44 |
-
const REVIEW_COUPON_CUSTOMER_GROUP
|
45 |
-
const REVIEW_COUPON_AUTOMATIC
|
46 |
-
const REVIEW_COUPON_CODE
|
47 |
-
const REVIEW_COUPON_EXPIRE
|
48 |
-
const REVIEW_COUPON_LENGTH
|
49 |
-
const REVIEW_COUPON_DISCOUNT_TYPE
|
50 |
-
const REVIEW_COUPON_DISCOUNT
|
51 |
-
const REVIEW_COUPON_LABEL
|
52 |
-
const REVIEW_COUPON_COUNTER
|
53 |
-
const REVIEW_COUPON_GENERAL_QUANTITY
|
54 |
-
const REVIEW_COUPON_GENERAL_TYPE
|
55 |
-
const REVIEW_COUPON_SPECIFIC_QUANTITY
|
56 |
-
const REVIEW_COUPON_ORDER_COUNTER
|
57 |
-
const REVIEW_COUPON_ORDER_ALMOST
|
58 |
-
const REVIEW_COUPON_ORDER_MAX
|
59 |
-
const REVIEW_COUPON_MANDRILL_TAG
|
60 |
-
const REVIEW_COUPON_SUBJECT
|
61 |
-
const REVIEW_COUPON_EMAIL
|
62 |
-
const REVIEW_CRON_TIME
|
63 |
|
64 |
-
const BIRTHDAY_ACTIVE
|
65 |
-
const BIRTHDAY_DAYS
|
66 |
-
const BIRTHDAY_CUSTOMER_GROUPS
|
67 |
-
const BIRTHDAY_TEMPLATE
|
68 |
-
const BIRTHDAY_SUBJECT
|
69 |
-
const BIRTHDAY_MANDRILL_TAG
|
70 |
-
const BIRTHDAY_COUPON
|
71 |
-
const BIRTHDAY_CUSTOMER_COUPON
|
72 |
-
const BIRTHDAY_AUTOMATIC
|
73 |
-
const BIRTHDAY_COUPON_CODE
|
74 |
-
const BIRTHDAY_EXPIRE
|
75 |
-
const BIRTHDAY_LENGTH
|
76 |
-
const BIRTHDAY_DISCOUNT_TYPE
|
77 |
-
const BIRTHDAY_DISCOUNT
|
78 |
-
const BIRTHDAY_COUPON_LABEL
|
79 |
-
const BIRTHDAY_CRON_TIME
|
80 |
|
81 |
|
82 |
-
const NOACTIVITY_ACTIVE
|
83 |
-
const NOACTIVITY_DAYS
|
84 |
-
const NOACTIVITY_CUSTOMER_GROUPS
|
85 |
-
const NOACTIVITY_TEMPLATE
|
86 |
-
const NOACTIVITY_MANDRILL_TAG
|
87 |
-
const NOACTIVITY_SUBJECT
|
88 |
-
const NOACTIVITY_CRON_TIME
|
89 |
|
90 |
-
const WISHLIST_ACTIVE
|
91 |
-
const WISHLIST_DAYS
|
92 |
-
const WISHLIST_CUSTOMER_GROUPS
|
93 |
-
const WISHLIST_TEMPLATE
|
94 |
-
const WISHLIST_MANDRILL_TAG
|
95 |
-
const WISHLIST_SUBJECT
|
96 |
-
const WISHLIST_CRON_TIME
|
97 |
|
98 |
-
const VISITED_ACTIVE
|
99 |
-
const VISITED_DAYS
|
100 |
-
const VISITED_TEMPLATE
|
101 |
-
const VISITED_MANDRILL_TAG
|
102 |
-
const VISITED_SUBJECT
|
103 |
-
const VISITED_CUSTOMER_GROUPS
|
104 |
-
const VISITED_TIME
|
105 |
-
const VISITED_MAX
|
106 |
-
const VISITED_CRON_TIME
|
107 |
|
108 |
-
const BACKTOSTOCK_ACTIVE
|
109 |
-
const BACKTOSTOCK_TEMPLATE
|
110 |
-
const BACKTOSTOCK_SUBJECT
|
111 |
-
const BACKTOSTOCK_MANDRILL_TAG
|
112 |
-
const BACKTOSTOCK_ALLOW_GUESTS
|
113 |
-
const BACKTOSTOCK_MAIL_TYPE_NAME
|
114 |
-
const BACKTOSTOCK_CRON_TIME
|
115 |
|
116 |
-
const COUPON_AUTOMATIC
|
117 |
-
const COUPON_MANUAL
|
118 |
-
const COUPON_GENERAL
|
119 |
-
const COUPON_PER_ORDER
|
120 |
-
const TYPE_EACH
|
121 |
-
const TYPE_ONCE
|
122 |
-
const TYPE_SPECIFIC
|
123 |
}
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_Autoresponder_Model_Config
|
11 |
{
|
12 |
+
const GENERAL_ACTIVE = 'ebizmarts_autoresponder/general/active';
|
13 |
+
const GENERAL_SENDER = 'ebizmarts_autoresponder/general/identity';
|
14 |
|
15 |
+
const NEWORDER_ACTIVE = 'ebizmarts_autoresponder/neworder/active';
|
16 |
+
const NEWORDER_DAYS = 'ebizmarts_autoresponder/neworder/days';
|
17 |
+
const NEWORDER_CUSTOMER_GROUPS = 'ebizmarts_autoresponder/neworder/customer';
|
18 |
+
const NEWORDER_TRIGGER = 'ebizmarts_autoresponder/neworder/trigger';
|
19 |
+
const NEWORDER_ORDER_STATUS = 'ebizmarts_autoresponder/neworder/order_status';
|
20 |
+
const NEWORDER_TEMPLATE = 'ebizmarts_autoresponder/neworder/template';
|
21 |
+
const NEWORDER_MANDRILL_TAG = 'ebizmarts_autoresponder/neworder/mandrill-tag';
|
22 |
+
const NEWORDER_SUBJECT = 'ebizmarts_autoresponder/neworder/subject';
|
23 |
+
const NEWORDER_CRON_TIME = 'ebizmarts_autoresponder/neworder/cron-time';
|
24 |
|
25 |
+
const RELATED_ACTIVE = 'ebizmarts_autoresponder/related/active';
|
26 |
+
const RELATED_DAYS = 'ebizmarts_autoresponder/related/days';
|
27 |
+
const RELATED_CUSTOMER_GROUPS = 'ebizmarts_autoresponder/related/customer';
|
28 |
+
const RELATED_TEMPLATE = 'ebizmarts_autoresponder/related/template';
|
29 |
+
const RELATED_MANDRILL_TAG = 'ebizmarts_autoresponder/related/mandrill-tag';
|
30 |
+
const RELATED_SUBJECT = 'ebizmarts_autoresponder/related/subject';
|
31 |
+
const RELATED_MAX = 'ebizmarts_autoresponder/related/max-related';
|
32 |
+
const RELATED_STATUS = 'ebizmarts_autoresponder/related/status';
|
33 |
+
const RELATED_CRON_TIME = 'ebizmarts_autoresponder/related/cron-time';
|
34 |
|
35 |
+
const REVIEW_ACTIVE = 'ebizmarts_autoresponder/review/active';
|
36 |
+
const REVIEW_DAYS = 'ebizmarts_autoresponder/review/days';
|
37 |
+
const REVIEW_CUSTOMER_GROUPS = 'ebizmarts_autoresponder/review/customer';
|
38 |
+
const REVIEW_TEMPLATE = 'ebizmarts_autoresponder/review/template';
|
39 |
+
const REVIEW_MANDRILL_TAG = 'ebizmarts_autoresponder/review/mandrill-tag';
|
40 |
+
const REVIEW_SUBJECT = 'ebizmarts_autoresponder/review/subject';
|
41 |
+
const REVIEW_STATUS = 'ebizmarts_autoresponder/review/status';
|
42 |
+
const REVIEW_HAS_COUPON = 'ebizmarts_autoresponder/review/coupon';
|
43 |
+
const REVIEW_COUPON_CUSTOMER_GROUP = 'ebizmarts_autoresponder/review/customer_coupon';
|
44 |
+
const REVIEW_COUPON_AUTOMATIC = 'ebizmarts_autoresponder/review/automatic';
|
45 |
+
const REVIEW_COUPON_CODE = 'ebizmarts_autoresponder/review/coupon_code';
|
46 |
+
const REVIEW_COUPON_EXPIRE = 'ebizmarts_autoresponder/review/expire';
|
47 |
+
const REVIEW_COUPON_LENGTH = 'ebizmarts_autoresponder/review/length';
|
48 |
+
const REVIEW_COUPON_DISCOUNT_TYPE = 'ebizmarts_autoresponder/review/discounttype';
|
49 |
+
const REVIEW_COUPON_DISCOUNT = 'ebizmarts_autoresponder/review/discount';
|
50 |
+
const REVIEW_COUPON_LABEL = 'ebizmarts_autoresponder/review/couponlabel';
|
51 |
+
const REVIEW_COUPON_COUNTER = 'ebizmarts_autoresponder/review/coupon_counter';
|
52 |
+
const REVIEW_COUPON_GENERAL_QUANTITY = 'ebizmarts_autoresponder/review/coupon_general_quantity';
|
53 |
+
const REVIEW_COUPON_GENERAL_TYPE = 'ebizmarts_autoresponder/review/coupon_general_type';
|
54 |
+
const REVIEW_COUPON_SPECIFIC_QUANTITY = 'ebizmarts_autoresponder/review/coupon_specific_quantity';
|
55 |
+
const REVIEW_COUPON_ORDER_COUNTER = 'ebizmarts_autoresponder/review/coupon_order_counter';
|
56 |
+
const REVIEW_COUPON_ORDER_ALMOST = 'ebizmarts_autoresponder/review/coupon_order_almost';
|
57 |
+
const REVIEW_COUPON_ORDER_MAX = 'ebizmarts_autoresponder/review/coupon_order_max';
|
58 |
+
const REVIEW_COUPON_MANDRILL_TAG = 'ebizmarts_autoresponder/review/coupon_mandrill_tag';
|
59 |
+
const REVIEW_COUPON_SUBJECT = 'ebizmarts_autoresponder/review/coupon_mail_subject';
|
60 |
+
const REVIEW_COUPON_EMAIL = 'ebizmarts_autoresponder/review/coupon_template';
|
61 |
+
const REVIEW_CRON_TIME = 'ebizmarts_autoresponder/review/cron-time';
|
62 |
|
63 |
+
const BIRTHDAY_ACTIVE = 'ebizmarts_autoresponder/birthday/active';
|
64 |
+
const BIRTHDAY_DAYS = 'ebizmarts_autoresponder/birthday/days';
|
65 |
+
const BIRTHDAY_CUSTOMER_GROUPS = 'ebizmarts_autoresponder/birthday/customer';
|
66 |
+
const BIRTHDAY_TEMPLATE = 'ebizmarts_autoresponder/birthday/template';
|
67 |
+
const BIRTHDAY_SUBJECT = 'ebizmarts_autoresponder/birthday/subject';
|
68 |
+
const BIRTHDAY_MANDRILL_TAG = 'ebizmarts_autoresponder/birthday/mandrill-tag';
|
69 |
+
const BIRTHDAY_COUPON = 'ebizmarts_autoresponder/birthday/coupon';
|
70 |
+
const BIRTHDAY_CUSTOMER_COUPON = 'ebizmarts_autoresponder/birthday/customer_coupon';
|
71 |
+
const BIRTHDAY_AUTOMATIC = 'ebizmarts_autoresponder/birthday/automatic';
|
72 |
+
const BIRTHDAY_COUPON_CODE = 'ebizmarts_autoresponder/birthday/coupon_code';
|
73 |
+
const BIRTHDAY_EXPIRE = 'ebizmarts_autoresponder/birthday/expire';
|
74 |
+
const BIRTHDAY_LENGTH = 'ebizmarts_autoresponder/birthday/length';
|
75 |
+
const BIRTHDAY_DISCOUNT_TYPE = 'ebizmarts_autoresponder/birthday/discounttype';
|
76 |
+
const BIRTHDAY_DISCOUNT = 'ebizmarts_autoresponder/birthday/discount';
|
77 |
+
const BIRTHDAY_COUPON_LABEL = 'ebizmarts_autoresponder/birthday/couponlabel';
|
78 |
+
const BIRTHDAY_CRON_TIME = 'ebizmarts_autoresponder/birthday/cron-time';
|
79 |
|
80 |
|
81 |
+
const NOACTIVITY_ACTIVE = 'ebizmarts_autoresponder/noactivity/active';
|
82 |
+
const NOACTIVITY_DAYS = 'ebizmarts_autoresponder/noactivity/days';
|
83 |
+
const NOACTIVITY_CUSTOMER_GROUPS = 'ebizmarts_autoresponder/noactivity/customer';
|
84 |
+
const NOACTIVITY_TEMPLATE = 'ebizmarts_autoresponder/noactivity/template';
|
85 |
+
const NOACTIVITY_MANDRILL_TAG = 'ebizmarts_autoresponder/noactivity/mandrill-tag';
|
86 |
+
const NOACTIVITY_SUBJECT = 'ebizmarts_autoresponder/noactivity/subject';
|
87 |
+
const NOACTIVITY_CRON_TIME = 'ebizmarts_autoresponder/noactivity/cron-time';
|
88 |
|
89 |
+
const WISHLIST_ACTIVE = 'ebizmarts_autoresponder/wishlist/active';
|
90 |
+
const WISHLIST_DAYS = 'ebizmarts_autoresponder/wishlist/days';
|
91 |
+
const WISHLIST_CUSTOMER_GROUPS = 'ebizmarts_autoresponder/wishlist/customer';
|
92 |
+
const WISHLIST_TEMPLATE = 'ebizmarts_autoresponder/wishlist/template';
|
93 |
+
const WISHLIST_MANDRILL_TAG = 'ebizmarts_autoresponder/wishlist/mandrill-tag';
|
94 |
+
const WISHLIST_SUBJECT = 'ebizmarts_autoresponder/wishlist/subject';
|
95 |
+
const WISHLIST_CRON_TIME = 'ebizmarts_autoresponder/wishlist/cron-time';
|
96 |
|
97 |
+
const VISITED_ACTIVE = 'ebizmarts_autoresponder/visitedproducts/active';
|
98 |
+
const VISITED_DAYS = 'ebizmarts_autoresponder/visitedproducts/days';
|
99 |
+
const VISITED_TEMPLATE = 'ebizmarts_autoresponder/visitedproducts/template';
|
100 |
+
const VISITED_MANDRILL_TAG = 'ebizmarts_autoresponder/visitedproducts/mandrill_tag';
|
101 |
+
const VISITED_SUBJECT = 'ebizmarts_autoresponder/visitedproducts/subject';
|
102 |
+
const VISITED_CUSTOMER_GROUPS = 'ebizmarts_autoresponder/visitedproducts/customer';
|
103 |
+
const VISITED_TIME = 'ebizmarts_autoresponder/visitedproducts/time';
|
104 |
+
const VISITED_MAX = 'ebizmarts_autoresponder/visitedproducts/max_visited';
|
105 |
+
const VISITED_CRON_TIME = 'ebizmarts_autoresponder/visitedproducts/cron-time';
|
106 |
|
107 |
+
const BACKTOSTOCK_ACTIVE = 'ebizmarts_autoresponder/backtostock/active';
|
108 |
+
const BACKTOSTOCK_TEMPLATE = 'ebizmarts_autoresponder/backtostock/template';
|
109 |
+
const BACKTOSTOCK_SUBJECT = 'ebizmarts_autoresponder/backtostock/subject';
|
110 |
+
const BACKTOSTOCK_MANDRILL_TAG = 'ebizmarts_autoresponder/backtostock/mandrill_tag';
|
111 |
+
const BACKTOSTOCK_ALLOW_GUESTS = 'ebizmarts_autoresponder/backtostock/allow_guests';
|
112 |
+
const BACKTOSTOCK_MAIL_TYPE_NAME = 'back to stock';
|
113 |
+
const BACKTOSTOCK_CRON_TIME = 'ebizmarts_autoresponder/backtostock/cron-time';
|
114 |
|
115 |
+
const COUPON_AUTOMATIC = 2;
|
116 |
+
const COUPON_MANUAL = 1;
|
117 |
+
const COUPON_GENERAL = 2;
|
118 |
+
const COUPON_PER_ORDER = 1;
|
119 |
+
const TYPE_EACH = 1;
|
120 |
+
const TYPE_ONCE = 2;
|
121 |
+
const TYPE_SPECIFIC = 3;
|
122 |
}
|
app/code/community/Ebizmarts/Autoresponder/Model/Cron.php
CHANGED
@@ -7,7 +7,6 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_Autoresponder_Model_Cron
|
12 |
{
|
13 |
/**
|
@@ -16,9 +15,8 @@ class Ebizmarts_Autoresponder_Model_Cron
|
|
16 |
public function autoresponder()
|
17 |
{
|
18 |
$allStores = Mage::app()->getStores();
|
19 |
-
foreach($allStores as $storeId => $val)
|
20 |
-
|
21 |
-
if(Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::GENERAL_ACTIVE,$storeId)) {
|
22 |
$this->_processStore($storeId);
|
23 |
}
|
24 |
}
|
@@ -30,73 +28,74 @@ class Ebizmarts_Autoresponder_Model_Cron
|
|
30 |
protected function _processStore($storeId)
|
31 |
{
|
32 |
//Mage::app()->setCurrentStore($storeId);
|
33 |
-
Mage::unregister('_singleton/core/design_package'
|
34 |
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
|
35 |
-
Mage::getSingleton('core/design_package'
|
36 |
|
37 |
-
if(Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::NEWORDER_ACTIVE
|
38 |
$this->_processNewOrders($storeId);
|
39 |
}
|
40 |
-
if(Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::RELATED_ACTIVE
|
41 |
$this->_processRelated($storeId);
|
42 |
}
|
43 |
-
if(Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::REVIEW_ACTIVE
|
44 |
$this->_processReview($storeId);
|
45 |
}
|
46 |
-
if(Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::BIRTHDAY_ACTIVE
|
47 |
$this->_processBirthday($storeId);
|
48 |
}
|
49 |
-
if(Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::NOACTIVITY_ACTIVE
|
50 |
$this->_processNoActivity($storeId);
|
51 |
}
|
52 |
-
if(Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::WISHLIST_ACTIVE
|
53 |
$this->_processWishlist($storeId);
|
54 |
}
|
55 |
-
if(Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::VISITED_ACTIVE
|
56 |
$this->_processVisited($storeId);
|
57 |
}
|
58 |
-
if(Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::BACKTOSTOCK_ACTIVE
|
59 |
$this->_processBackToStock($storeId);
|
60 |
}
|
61 |
$this->_cleanAutoresponderExpiredCoupons();
|
62 |
}
|
|
|
63 |
protected function _processNewOrders($storeId)
|
64 |
{
|
65 |
-
$customerGroups = explode(",",Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::NEWORDER_CUSTOMER_GROUPS, $storeId));
|
66 |
-
$days
|
67 |
-
$tags
|
68 |
-
$adapter
|
69 |
-
$mailSubject
|
70 |
-
$senderId
|
71 |
-
$sender
|
72 |
-
$templateId
|
73 |
|
74 |
$expr = sprintf('DATE_SUB(%s, %s)', $adapter->quote(now()), $this->_getIntervalUnitSql($days, 'DAY'));
|
75 |
$from = new Zend_Db_Expr($expr);
|
76 |
-
$expr = sprintf('DATE_SUB(%s, %s)', $adapter->quote(now()), $this->_getIntervalUnitSql($days-1, 'DAY'));
|
77 |
$to = new Zend_Db_Expr($expr);
|
78 |
$collection = Mage::getResourceModel('sales/order_collection');
|
79 |
-
$collection->addFieldToFilter('main_table.store_id',array('eq'
|
80 |
-
|
81 |
-
if(Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::NEWORDER_TRIGGER, $storeId) == 2){
|
82 |
$collection->addFieldToFilter('main_table.status', array('eq' => strtolower(Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::NEWORDER_ORDER_STATUS, $storeId))));
|
83 |
}
|
84 |
-
if(count($customerGroups)) {
|
85 |
-
$collection->addFieldToFilter('main_table.customer_group_id',array('in'=> $customerGroups));
|
86 |
}
|
87 |
-
foreach($collection as $order) {
|
88 |
$translate = Mage::getSingleton('core/translate');
|
89 |
$email = $order->getCustomerEmail();
|
90 |
-
if(Mage::helper('ebizmarts_autoresponder')->isSubscribed($email,'neworder'
|
91 |
-
$name = $order->getCustomerFirstname().' '
|
92 |
-
$url = Mage::getModel('core/url')->setStore($storeId)->getUrl().'ebizautoresponder/autoresponder/unsubscribe?list=neworder&email='
|
93 |
-
$vars = array('tags'=>array($tags),'url'
|
94 |
|
95 |
$customer = Mage::getModel('customer/customer')
|
96 |
->setStore(Mage::app()->getStore($storeId))
|
97 |
->loadByEmail($email);
|
98 |
-
if($customer->getId()) {
|
99 |
-
$tbtPoints = Mage::helper('ebizmarts_autoresponder')->getTBTPoints($customer->getId());
|
100 |
foreach ($tbtPoints as $key => $field) {
|
101 |
if ($key == 'points') {
|
102 |
if ($field >= Mage::getStoreConfig('sweetmonkey/general/email_points', $storeId)) {
|
@@ -108,55 +107,55 @@ class Ebizmarts_Autoresponder_Model_Cron
|
|
108 |
}
|
109 |
}
|
110 |
|
111 |
-
$mail = Mage::getModel('core/email_template')->setTemplateSubject($mailSubject)->sendTransactional($templateId
|
112 |
$translate->setTranslateInLine(true);
|
113 |
-
Mage::helper('ebizmarts_abandonedcart')->saveMail('new order'
|
114 |
}
|
115 |
}
|
116 |
}
|
|
|
117 |
protected function _processBirthday($storeId)
|
118 |
{
|
119 |
-
$days
|
120 |
-
$customerGroups = explode(",",Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::BIRTHDAY_CUSTOMER_GROUPS, $storeId));
|
121 |
-
$senderId
|
122 |
-
$sender
|
123 |
-
$templateId
|
124 |
-
$mailSubject
|
125 |
-
$tags
|
126 |
-
$sendCoupon
|
127 |
-
$customerGroupsCoupon = explode(",",Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::BIRTHDAY_CUSTOMER_COUPON, $storeId));
|
128 |
-
|
129 |
-
|
130 |
-
$collection
|
131 |
-
$date2 = date("Y-m-d H:i:s",strtotime(" + $days days"));
|
132 |
-
$month = date("m",strtotime($date2));
|
133 |
-
$day = date("d",strtotime($date2));
|
134 |
$moreselect = "MONTH(at_dob.value) = $month AND DAY(at_dob.value) = $day";
|
135 |
|
136 |
|
137 |
-
$collection->addAttributeToFilter('dob',array('neq'=>'null'))
|
138 |
-
|
139 |
-
if(count($customerGroups)) {
|
140 |
-
$collection->addFieldToFilter('group_id',array('in'
|
141 |
}
|
142 |
$collection->getSelect()->where($moreselect);
|
143 |
-
foreach($collection as $customer) {
|
144 |
$translate = Mage::getSingleton('core/translate');
|
145 |
$cust = Mage::getModel('customer/customer')->load($customer->getEntityId());
|
146 |
$email = $cust->getEmail();
|
147 |
-
$name = $cust->getFirstname().' '
|
148 |
-
if(Mage::helper('ebizmarts_autoresponder')->isSubscribed($email,'birthday'
|
149 |
$vars = array();
|
150 |
-
$url = Mage::getModel('core/url')->setStore($storeId)->getUrl().'ebizautoresponder/autoresponder/unsubscribe?list=birthday&email='
|
151 |
$couponcode = '';
|
152 |
-
if($sendCoupon && in_array($customer->getGroupId()
|
153 |
-
if(Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::BIRTHDAY_AUTOMATIC
|
154 |
-
list($couponcode
|
155 |
-
$vars = array('couponcode'
|
156 |
-
}
|
157 |
-
else {
|
158 |
$couponcode = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::BIRTHDAY_COUPON_CODE);
|
159 |
-
$vars = array('couponcode'
|
160 |
}
|
161 |
|
162 |
}
|
@@ -164,8 +163,8 @@ class Ebizmarts_Autoresponder_Model_Cron
|
|
164 |
$customer = Mage::getModel('customer/customer')
|
165 |
->setStore(Mage::app()->getStore($storeId))
|
166 |
->loadByEmail($email);
|
167 |
-
if($customer->getId()) {
|
168 |
-
$tbtPoints = Mage::helper('ebizmarts_autoresponder')->getTBTPoints($customer->getId());
|
169 |
foreach ($tbtPoints as $key => $field) {
|
170 |
if ($key == 'points') {
|
171 |
if ($field >= Mage::getStoreConfig('sweetmonkey/general/email_points', $storeId)) {
|
@@ -177,57 +176,58 @@ class Ebizmarts_Autoresponder_Model_Cron
|
|
177 |
}
|
178 |
}
|
179 |
|
180 |
-
$mail = Mage::getModel('core/email_template')->setTemplateSubject($mailSubject)->sendTransactional($templateId
|
181 |
$translate->setTranslateInLine(true);
|
182 |
-
Mage::helper('ebizmarts_abandonedcart')->saveMail('happy birthday'
|
183 |
}
|
184 |
}
|
185 |
|
186 |
}
|
|
|
187 |
protected function _processNoActivity($storeId)
|
188 |
{
|
189 |
-
$days
|
190 |
-
$customerGroups = explode(",",Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::NOACTIVITY_CUSTOMER_GROUPS, $storeId));
|
191 |
-
$senderId
|
192 |
-
$sender
|
193 |
-
$templateId
|
194 |
-
$mailSubject
|
195 |
-
$tags
|
196 |
|
197 |
-
$collection
|
198 |
|
199 |
|
200 |
-
if(count($customerGroups)) {
|
201 |
-
$collection->addFieldToFilter('group_id',array('in'
|
202 |
}
|
203 |
-
$collection->addFieldToFilter('store_id',array('eq'
|
204 |
|
205 |
-
foreach($collection as $customer) {
|
206 |
$customerId = $customer->getEntityId();
|
207 |
// get the orders for this customer for this store
|
208 |
$orderCollection = Mage::getModel('sales/order')->getCollection();
|
209 |
-
$orderCollection->addFieldToFilter('customer_id',array('eq'
|
210 |
-
|
211 |
-
if($orderCollection->getSize()>0) { // if the customer has any order for this store
|
212 |
$logCustomer = Mage::getModel('log/customer')->loadByCustomer($customer);
|
213 |
$lastVisited = $logCustomer->getLoginAt();
|
214 |
-
$limitup = date("Y-m-d H:i:s",strtotime(" - $days days"));
|
215 |
-
$daysAux = $days +1;
|
216 |
-
$limitdown = date("Y-m-d H:i:s",strtotime(" - $daysAux days"));
|
217 |
-
if($limitup
|
218 |
$translate = Mage::getSingleton('core/translate');
|
219 |
$cust = Mage::getModel('customer/customer')->load($customerId);
|
220 |
$email = $cust->getEmail();
|
221 |
-
$name = $cust->getFirstname().' '
|
222 |
-
if(Mage::helper('ebizmarts_autoresponder')->isSubscribed($email,'noactivity'
|
223 |
-
$url = Mage::getModel('core/url')->setStore($storeId)->getUrl().'ebizautoresponder/autoresponder/unsubscribe?list=noactivity&email='
|
224 |
-
$vars = array('name' => $name,'tags'=>array($tags),'lastlogin'
|
225 |
|
226 |
$customer = Mage::getModel('customer/customer')
|
227 |
->setStore(Mage::app()->getStore($storeId))
|
228 |
->loadByEmail($email);
|
229 |
-
if($customer->getId()) {
|
230 |
-
$tbtPoints = Mage::helper('ebizmarts_autoresponder')->getTBTPoints($customer->getId());
|
231 |
foreach ($tbtPoints as $key => $field) {
|
232 |
if ($key == 'points') {
|
233 |
if ($field >= Mage::getStoreConfig('sweetmonkey/general/email_points', $storeId)) {
|
@@ -239,69 +239,70 @@ class Ebizmarts_Autoresponder_Model_Cron
|
|
239 |
}
|
240 |
}
|
241 |
|
242 |
-
$mail = Mage::getModel('core/email_template')->setTemplateSubject($mailSubject)->sendTransactional($templateId
|
243 |
$translate->setTranslateInLine(true);
|
244 |
-
Mage::helper('ebizmarts_abandonedcart')->saveMail('no activity'
|
245 |
}
|
246 |
}
|
247 |
}
|
248 |
}
|
249 |
|
250 |
}
|
|
|
251 |
protected function _processRelated($storeId)
|
252 |
{
|
253 |
-
$customerGroups = explode(",",Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::RELATED_CUSTOMER_GROUPS, $storeId));
|
254 |
-
$days
|
255 |
-
$tags
|
256 |
-
$adapter
|
257 |
-
$mailSubject
|
258 |
-
$senderId
|
259 |
-
$sender
|
260 |
-
$templateId
|
261 |
-
$maxRelated
|
262 |
-
$status
|
263 |
|
264 |
$expr = sprintf('DATE_SUB(%s, %s)', $adapter->quote(now()), $this->_getIntervalUnitSql($days, 'DAY'));
|
265 |
$from = new Zend_Db_Expr($expr);
|
266 |
-
$expr = sprintf('DATE_SUB(%s, %s)', $adapter->quote(now()), $this->_getIntervalUnitSql($days-1, 'DAY'));
|
267 |
$to = new Zend_Db_Expr($expr);
|
268 |
$collection = Mage::getResourceModel('sales/order_collection');
|
269 |
-
$collection->addFieldToFilter('main_table.store_id',array('eq'
|
270 |
-
->addFieldToFilter('main_table.created_at',array('from'
|
271 |
-
->addFieldToFilter('main_table.status',array('eq'
|
272 |
|
273 |
-
if(count($customerGroups)) {
|
274 |
-
$collection->addFieldToFilter('main_table.customer_group_id',array('in'=> $customerGroups));
|
275 |
}
|
276 |
-
foreach($collection as $order) {
|
277 |
$counter = 0;
|
278 |
$allRelated = array();
|
279 |
-
foreach($order->getAllItems() as $itemId => $item) {
|
280 |
-
if($maxRelated && $maxRelated < $counter) {
|
281 |
break;
|
282 |
}
|
283 |
$product = Mage::getModel('catalog/product')->load($item->getProductId());
|
284 |
-
foreach($product->getRelatedLinkCollection() as $related) {
|
285 |
-
if($maxRelated && $maxRelated < $counter) {
|
286 |
break;
|
287 |
}
|
288 |
$relatedProduct = Mage::getModel('catalog/product')->load($related->getLinkedProductId());
|
289 |
$allRelated[$counter++] = $relatedProduct;
|
290 |
}
|
291 |
}
|
292 |
-
if($counter > 0) {
|
293 |
$translate = Mage::getSingleton('core/translate');
|
294 |
$email = $order->getCustomerEmail();
|
295 |
-
if(Mage::helper('ebizmarts_autoresponder')->isSubscribed($email,'related'
|
296 |
-
$name = $order->getCustomerFirstname().' '
|
297 |
-
$url = Mage::getModel('core/url')->setStore($storeId)->getUrl().'ebizautoresponder/autoresponder/unsubscribe?list=related&email='
|
298 |
-
$vars = array('name' => $name,'tags'=>array($tags),'related'
|
299 |
|
300 |
$customer = Mage::getModel('customer/customer')
|
301 |
->setStore(Mage::app()->getStore($storeId))
|
302 |
->loadByEmail($email);
|
303 |
-
if($customer->getId()) {
|
304 |
-
$tbtPoints = Mage::helper('ebizmarts_autoresponder')->getTBTPoints($customer->getId());
|
305 |
foreach ($tbtPoints as $key => $field) {
|
306 |
if ($key == 'points') {
|
307 |
if ($field >= Mage::getStoreConfig('sweetmonkey/general/email_points', $storeId)) {
|
@@ -313,78 +314,78 @@ class Ebizmarts_Autoresponder_Model_Cron
|
|
313 |
}
|
314 |
}
|
315 |
|
316 |
-
$mail = Mage::getModel('core/email_template')->setTemplateSubject($mailSubject)->sendTransactional($templateId
|
317 |
$translate->setTranslateInLine(true);
|
318 |
-
Mage::helper('ebizmarts_abandonedcart')->saveMail('related products'
|
319 |
}
|
320 |
}
|
321 |
}
|
322 |
|
323 |
}
|
|
|
324 |
protected function _processReview($storeId)
|
325 |
{
|
326 |
-
$customerGroups = explode(",",Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::REVIEW_CUSTOMER_GROUPS, $storeId));
|
327 |
-
$days
|
328 |
-
$tags
|
329 |
-
$adapter
|
330 |
-
$mailSubject
|
331 |
-
$senderId
|
332 |
-
$sender
|
333 |
-
$templateId
|
334 |
-
$status
|
335 |
|
336 |
$expr = sprintf('DATE_SUB(%s, %s)', $adapter->quote(now()), $this->_getIntervalUnitSql($days, 'DAY'));
|
337 |
$from = new Zend_Db_Expr($expr);
|
338 |
-
$expr = sprintf('DATE_SUB(%s, %s)', $adapter->quote(now()), $this->_getIntervalUnitSql($days-1, 'DAY'));
|
339 |
$to = new Zend_Db_Expr($expr);
|
340 |
$collection = Mage::getResourceModel('sales/order_collection');
|
341 |
-
$collection->addFieldToFilter('main_table.store_id',array('eq'
|
342 |
// ->addFieldToFilter('main_table.created_at',array('from'=>$from,'to'=>$to))
|
343 |
-
->addFieldToFilter('main_table.updated_at',array('from'
|
344 |
-
->addFieldToFilter('main_table.status',array('eq'
|
345 |
// Mage::log((string)$collection->getSelect());
|
346 |
-
if(count($customerGroups)) {
|
347 |
-
$collection->addFieldToFilter('main_table.customer_group_id',array('in'=> $customerGroups));
|
348 |
}
|
349 |
-
foreach($collection as $order) {
|
350 |
$translate = Mage::getSingleton('core/translate');
|
351 |
$email = $order->getCustomerEmail();
|
352 |
-
if(Mage::helper('ebizmarts_autoresponder')->isSubscribed($email,'review'
|
353 |
-
if(Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::REVIEW_HAS_COUPON
|
354 |
-
srand((double)microtime()*1000000);
|
355 |
-
$token = md5(rand(0,9999999));
|
356 |
$review = Mage::getModel('ebizmarts_autoresponder/review');
|
357 |
$review->setCustomerId($order->getCustomerId())
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
}
|
365 |
-
$name = $order->getCustomerFirstname().' '
|
366 |
$products = array();
|
367 |
-
foreach($order->getAllItems() as $item) {
|
368 |
$product = Mage::getModel('catalog/product')->load($item->getProductId());
|
369 |
-
if($product->isConfigurable()) {
|
370 |
continue;
|
371 |
}
|
372 |
$products[] = $product;
|
373 |
}
|
374 |
$orderNum = $order->getIncrementId();
|
375 |
-
$url = Mage::getModel('core/url')->setStore($storeId)->getUrl().'ebizautoresponder/autoresponder/unsubscribe?list=review&email='
|
376 |
-
if(Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::REVIEW_HAS_COUPON
|
377 |
-
$vars = array('name' => $name,'tags'=>array($tags),'products'
|
378 |
-
}
|
379 |
-
|
380 |
-
$vars = array('name' => $name,'tags'=>array($tags),'products'=>$products,'ordernum'=>$orderNum,'url'=>$url);
|
381 |
}
|
382 |
|
383 |
$customer = Mage::getModel('customer/customer')
|
384 |
->setStore(Mage::app()->getStore($storeId))
|
385 |
->loadByEmail($email);
|
386 |
-
if($customer->getId()) {
|
387 |
-
$tbtPoints = Mage::helper('ebizmarts_autoresponder')->getTBTPoints($customer->getId());
|
388 |
foreach ($tbtPoints as $key => $field) {
|
389 |
if ($key == 'points') {
|
390 |
if ($field >= Mage::getStoreConfig('sweetmonkey/general/email_points', $storeId)) {
|
@@ -396,51 +397,52 @@ class Ebizmarts_Autoresponder_Model_Cron
|
|
396 |
}
|
397 |
}
|
398 |
|
399 |
-
$mail = Mage::getModel('core/email_template')->setTemplateSubject($mailSubject)->sendTransactional($templateId
|
400 |
$translate->setTranslateInLine(true);
|
401 |
-
Mage::helper('ebizmarts_abandonedcart')->saveMail('product review'
|
402 |
}
|
403 |
}
|
404 |
|
405 |
}
|
|
|
406 |
protected function _processWishlist($storeId)
|
407 |
{
|
408 |
-
$customerGroups = explode(",",Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::WISHLIST_CUSTOMER_GROUPS, $storeId));
|
409 |
-
$days
|
410 |
-
$tags
|
411 |
-
$adapter
|
412 |
-
$mailSubject
|
413 |
-
$senderId
|
414 |
-
$sender
|
415 |
-
$templateId
|
416 |
|
417 |
$expr = sprintf('DATE_SUB(%s, %s)', $adapter->quote(now()), $this->_getIntervalUnitSql($days, 'DAY'));
|
418 |
$from = new Zend_Db_Expr($expr);
|
419 |
-
$expr = sprintf('DATE_SUB(%s, %s)', $adapter->quote(now()), $this->_getIntervalUnitSql($days-1, 'DAY'));
|
420 |
$to = new Zend_Db_Expr($expr);
|
421 |
|
422 |
$collection = Mage::getModel('wishlist/item')->getCollection();
|
423 |
-
$collection->addFieldToFilter('main_table.added_at',array('from'
|
424 |
-
|
425 |
-
|
426 |
$wishlist_ant = -1;
|
427 |
$wishlistId = $collection->getFirstItem()->getWishlistId();
|
428 |
$products = array();
|
429 |
-
foreach($collection as $item) {
|
430 |
-
if($wishlistId != $wishlist_ant) {
|
431 |
-
if($wishlist_ant != -1 && count($products) > 0) {
|
432 |
-
$translate
|
433 |
-
$email
|
434 |
-
if(Mage::helper('ebizmarts_autoresponder')->isSubscribed($email,'wishlist'
|
435 |
-
$name
|
436 |
-
$url
|
437 |
-
$vars
|
438 |
|
439 |
$customer = Mage::getModel('customer/customer')
|
440 |
->setStore(Mage::app()->getStore($storeId))
|
441 |
->loadByEmail($email);
|
442 |
-
if($customer->getId()) {
|
443 |
-
$tbtPoints = Mage::helper('ebizmarts_autoresponder')->getTBTPoints($customer->getId());
|
444 |
foreach ($tbtPoints as $key => $field) {
|
445 |
if ($key == 'points') {
|
446 |
if ($field >= Mage::getStoreConfig('sweetmonkey/general/email_points', $storeId)) {
|
@@ -452,35 +454,35 @@ class Ebizmarts_Autoresponder_Model_Cron
|
|
452 |
}
|
453 |
}
|
454 |
|
455 |
-
$mail
|
456 |
$translate->setTranslateInLine(true);
|
457 |
-
Mage::helper('ebizmarts_abandonedcart')->saveMail('wishlist'
|
458 |
}
|
459 |
|
460 |
}
|
461 |
-
$wishlist_ant
|
462 |
-
$wishlistId
|
463 |
-
$wishlist
|
464 |
-
$customer
|
465 |
-
$products
|
466 |
}
|
467 |
-
if(in_array($customer->getGroupId()
|
468 |
-
$products[]
|
469 |
}
|
470 |
}
|
471 |
-
if(count($products)) {
|
472 |
-
$translate
|
473 |
-
$email
|
474 |
-
if(Mage::helper('ebizmarts_autoresponder')->isSubscribed($email,'wishlist'
|
475 |
-
$name
|
476 |
-
$url
|
477 |
-
$vars
|
478 |
|
479 |
$customer = Mage::getModel('customer/customer')
|
480 |
->setStore(Mage::app()->getStore($storeId))
|
481 |
->loadByEmail($email);
|
482 |
-
if($customer->getId()) {
|
483 |
-
$tbtPoints = Mage::helper('ebizmarts_autoresponder')->getTBTPoints($customer->getId());
|
484 |
foreach ($tbtPoints as $key => $field) {
|
485 |
if ($key == 'points') {
|
486 |
if ($field >= Mage::getStoreConfig('sweetmonkey/general/email_points', $storeId)) {
|
@@ -492,53 +494,54 @@ class Ebizmarts_Autoresponder_Model_Cron
|
|
492 |
}
|
493 |
}
|
494 |
|
495 |
-
$mail
|
496 |
$translate->setTranslateInLine(true);
|
497 |
-
Mage::helper('ebizmarts_abandonedcart')->saveMail('wishlist'
|
498 |
}
|
499 |
}
|
500 |
|
501 |
}
|
|
|
502 |
protected function _processVisited($storeId)
|
503 |
{
|
504 |
-
$customerGroups = explode(",",Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::VISITED_CUSTOMER_GROUPS, $storeId));
|
505 |
-
$days
|
506 |
-
$tags
|
507 |
-
$mailSubject
|
508 |
-
$senderId
|
509 |
-
$sender
|
510 |
-
$templateId
|
511 |
-
$adapter
|
512 |
-
$max
|
513 |
|
514 |
$expr = sprintf('DATE_SUB(%s, %s)', $adapter->quote(now()), $this->_getIntervalUnitSql($days, 'DAY'));
|
515 |
$from = new Zend_Db_Expr($expr);
|
516 |
-
$expr = sprintf('DATE_SUB(%s, %s)', $adapter->quote(now()), $this->_getIntervalUnitSql($days-1, 'DAY'));
|
517 |
$to = new Zend_Db_Expr($expr);
|
518 |
|
519 |
$collection = Mage::getModel('ebizmarts_autoresponder/visited')->getCollection();
|
520 |
$collection
|
521 |
-
->addFieldToFilter('main_table.visited_at',array('from'
|
522 |
-
->addFieldToFilter('main_table.store_id',array('eq'
|
523 |
$collection->getSelect()->order('main_table.customer_id asc')->order('main_table.visited_at desc');
|
524 |
|
525 |
$customerIdPrev = 0;
|
526 |
$products = array();
|
527 |
-
foreach($collection as $item) {
|
528 |
-
if($customerIdPrev
|
529 |
-
if($customerIdPrev != 0 && count($products) > 0) {
|
530 |
-
$email
|
531 |
-
if(Mage::helper('ebizmarts_autoresponder')->isSubscribed($email,'visitedproducts'
|
532 |
-
$translate
|
533 |
-
$name
|
534 |
-
$url
|
535 |
-
$vars
|
536 |
|
537 |
$customer = Mage::getModel('customer/customer')
|
538 |
->setStore(Mage::app()->getStore($storeId))
|
539 |
->loadByEmail($email);
|
540 |
-
if($customer->getId()) {
|
541 |
-
$tbtPoints = Mage::helper('ebizmarts_autoresponder')->getTBTPoints($customer->getId());
|
542 |
foreach ($tbtPoints as $key => $field) {
|
543 |
if ($key == 'points') {
|
544 |
if ($field >= Mage::getStoreConfig('sweetmonkey/general/email_points', $storeId)) {
|
@@ -550,19 +553,19 @@ class Ebizmarts_Autoresponder_Model_Cron
|
|
550 |
}
|
551 |
}
|
552 |
|
553 |
-
$mail
|
554 |
$translate->setTranslateInLine(true);
|
555 |
-
Mage::helper('ebizmarts_abandonedcart')->saveMail('visitedproducts'
|
556 |
}
|
557 |
}
|
558 |
-
$products
|
559 |
-
if($item->getCustomerId()){
|
560 |
$customer = Mage::getModel('customer/customer')->load($item->getCustomerId());
|
561 |
$customerIdPrev = $item->getCustomerId();
|
562 |
}
|
563 |
|
564 |
}
|
565 |
-
if(count($products) > $max && $max != 0 || ($customer && !in_array($customer->getGroupId()
|
566 |
continue;
|
567 |
}
|
568 |
// $itemscollection = Mage::getModel('sales/order_item')->getCollection();
|
@@ -580,32 +583,32 @@ class Ebizmarts_Autoresponder_Model_Cron
|
|
580 |
// $products[]= Mage::getModel('catalog/product')->load($item->getProductId());
|
581 |
// }
|
582 |
$itemscollection = Mage::getModel('sales/quote')->getCollection();
|
583 |
-
if($item->getCustomerId()) {
|
584 |
$itemscollection->addFieldToFilter('main_table.customer_id', array('eq' => $item->getCustomerId()));
|
585 |
-
}else{
|
586 |
$itemscollection->addFieldToFilter('main_table.customer_email', array('eq' => $item->getCustomerEmail()));
|
587 |
}
|
588 |
-
$itemscollection->addFieldToFilter('main_table.created_at',array('from'
|
589 |
-
->addFieldToFilter('main_table.is_active', array('eq'=>0));
|
590 |
-
if(count($itemscollection) == 0){
|
591 |
-
$products[]= Mage::getModel('catalog/product')->load($item->getProductId());
|
592 |
-
}else{
|
593 |
continue;
|
594 |
}
|
595 |
|
596 |
-
if(!$item->getCustomerId()){
|
597 |
//add customer by email placed on Abandoned Cart Popup
|
598 |
-
$translate
|
599 |
$email = $item->getCustomerEmail();
|
600 |
$name = 'customer';
|
601 |
-
$url
|
602 |
-
$vars
|
603 |
|
604 |
$customer = Mage::getModel('customer/customer')
|
605 |
->setStore(Mage::app()->getStore($storeId))
|
606 |
->loadByEmail($email);
|
607 |
-
if($customer->getId()) {
|
608 |
-
$tbtPoints = Mage::helper('ebizmarts_autoresponder')->getTBTPoints($customer->getId());
|
609 |
foreach ($tbtPoints as $key => $field) {
|
610 |
if ($key == 'points') {
|
611 |
if ($field >= Mage::getStoreConfig('sweetmonkey/general/email_points', $storeId)) {
|
@@ -617,12 +620,12 @@ class Ebizmarts_Autoresponder_Model_Cron
|
|
617 |
}
|
618 |
}
|
619 |
|
620 |
-
$mail
|
621 |
$translate->setTranslateInLine(true);
|
622 |
-
Mage::helper('ebizmarts_abandonedcart')->saveMail('visitedproducts'
|
623 |
}
|
624 |
}
|
625 |
-
if(count($products)) {
|
626 |
if ($item->getCustomerId()) {
|
627 |
$email = $customer->getEmail();
|
628 |
if (Mage::helper('ebizmarts_autoresponder')->isSubscribed($email, 'visitedproducts', $storeId)) {
|
@@ -634,8 +637,8 @@ class Ebizmarts_Autoresponder_Model_Cron
|
|
634 |
$customer = Mage::getModel('customer/customer')
|
635 |
->setStore(Mage::app()->getStore($storeId))
|
636 |
->loadByEmail($email);
|
637 |
-
if($customer->getId()) {
|
638 |
-
$tbtPoints = Mage::helper('ebizmarts_autoresponder')->getTBTPoints($customer->getId());
|
639 |
foreach ($tbtPoints as $key => $field) {
|
640 |
if ($key == 'points') {
|
641 |
if ($field >= Mage::getStoreConfig('sweetmonkey/general/email_points', $storeId)) {
|
@@ -653,17 +656,17 @@ class Ebizmarts_Autoresponder_Model_Cron
|
|
653 |
}
|
654 |
} else {
|
655 |
//add customer by email placed on Abandoned Cart Popup
|
656 |
-
$translate
|
657 |
$email = $item->getCustomerEmail();
|
658 |
$name = 'customer';
|
659 |
-
$url
|
660 |
-
$vars
|
661 |
|
662 |
$customer = Mage::getModel('customer/customer')
|
663 |
->setStore(Mage::app()->getStore($storeId))
|
664 |
->loadByEmail($email);
|
665 |
-
if($customer->getId()) {
|
666 |
-
$tbtPoints = Mage::helper('ebizmarts_autoresponder')->getTBTPoints($customer->getId());
|
667 |
foreach ($tbtPoints as $key => $field) {
|
668 |
if ($key == 'points') {
|
669 |
if ($field >= Mage::getStoreConfig('sweetmonkey/general/email_points', $storeId)) {
|
@@ -675,9 +678,9 @@ class Ebizmarts_Autoresponder_Model_Cron
|
|
675 |
}
|
676 |
}
|
677 |
|
678 |
-
$mail
|
679 |
$translate->setTranslateInLine(true);
|
680 |
-
Mage::helper('ebizmarts_abandonedcart')->saveMail('visitedproducts'
|
681 |
}
|
682 |
}
|
683 |
|
@@ -690,28 +693,28 @@ class Ebizmarts_Autoresponder_Model_Cron
|
|
690 |
public function _processBackToStock($storeId)
|
691 |
{
|
692 |
// $customerGroups = explode(",",Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::BACKTOSTOCK_ACTIVE, $storeId));
|
693 |
-
$tags
|
694 |
-
$mailSubject
|
695 |
-
$senderId
|
696 |
-
$sender
|
697 |
-
$templateId
|
698 |
-
$mailType
|
699 |
|
700 |
$errorMessage = false;
|
701 |
|
702 |
-
if(!$sender) {
|
703 |
$errorMessage = Mage::helper('ebizmarts_autoresponder')->__('ERROR - Back to Stock Notification: No sender is specified. Check System/Configuration/MageMonkey/Autoresponders/General');
|
704 |
}
|
705 |
|
706 |
-
if(!$storeId) {
|
707 |
$errorMessage = Mage::helper('ebizmarts_autoresponder')->__('ERROR - Back to Stock Notification: No Store ID is configured');
|
708 |
}
|
709 |
|
710 |
-
if(!$templateId) {
|
711 |
$errorMessage = Mage::helper('ebizmarts_autoresponder')->__('ERROR - Back to Stock Notification: No templateId. Check System/Configuration/MageMonkey/Autoresponders/Back to Stock/Email Template');
|
712 |
}
|
713 |
|
714 |
-
if($errorMessage) {
|
715 |
Mage::helper('ebizmarts_autoresponder')->log($errorMessage);
|
716 |
Mage::throwException($errorMessage);
|
717 |
return;
|
@@ -723,44 +726,43 @@ class Ebizmarts_Autoresponder_Model_Cron
|
|
723 |
$alert = Mage::getModel('ebizmarts_autoresponder/backtostockalert');
|
724 |
$alert
|
725 |
->getCollection()
|
726 |
-
->addFieldToFilter('is_active', array('eq'=>1))
|
727 |
-
;
|
728 |
|
729 |
-
if(count($alert) > 0) {
|
730 |
|
731 |
// Loop through all products that came back to stock
|
732 |
-
foreach($alert->getCollection() as $productStockAlert) {
|
733 |
|
734 |
// We'll validate if this products came back or not.
|
735 |
-
if($productStockAlert->getProductId()) {
|
736 |
$inventory = Mage::getModel('cataloginventory/stock_item');
|
737 |
$_product = Mage::getModel('catalog/product')->load($productStockAlert->getProductId());
|
738 |
|
739 |
// Check if Product is loaded
|
740 |
-
if(!$_product->getId()) {
|
741 |
-
Mage::helper('ebizmarts_autoresponder')->log('ERROR - Cannot load product ID '. $productStockAlert->getProductId() .'. Existing alert and subscribers will now be disabled.');
|
742 |
$this->disableStockAlertsForProduct($productStockAlert->getProductId());
|
743 |
continue;
|
744 |
}
|
745 |
|
746 |
// Retrieve stock data for Product
|
747 |
-
$_stock = $inventory->loadByProduct(
|
748 |
|
749 |
-
if(!$_stock->getData()) {
|
750 |
Mage::helper('ebizmarts_autoresponder')->log('Cannot load Product ID ' . $productStockAlert->getProductId() . ' stock info. Check if product still exists.');
|
751 |
continue;
|
752 |
}
|
753 |
|
754 |
//@TODO check if this next two validations can be replaced with isSaleable()
|
755 |
// Validate if Product has Stock
|
756 |
-
if(!$_stock->getData('is_in_stock') || $_stock->getData('qty') == 0) {
|
757 |
-
Mage::helper('ebizmarts_autoresponder')->log('SKIPPED - Product ID '. $_product->getId() .' is not in stock yet.');
|
758 |
continue;
|
759 |
}
|
760 |
|
761 |
// Validate if Product is Enabled
|
762 |
-
if($_product->getStatus() != Mage_Catalog_Model_Product_Status::STATUS_ENABLED) {
|
763 |
-
Mage::helper('ebizmarts_autoresponder')->log('SKIPPED - Product ID '. $_product->getId() .' is not enabled (status = disabled).');
|
764 |
continue;
|
765 |
}
|
766 |
|
@@ -775,33 +777,32 @@ class Ebizmarts_Autoresponder_Model_Cron
|
|
775 |
$collection = Mage::getModel('ebizmarts_autoresponder/backtostock')->getCollection();
|
776 |
$collection
|
777 |
->addFieldToFilter('is_active', array('eq' => 1))
|
778 |
-
->addFieldToFilter('alert_id', array('eq' => $productStockAlert->getAlertId()))
|
779 |
-
;
|
780 |
|
781 |
-
if(count($collection) > 0) {
|
782 |
|
783 |
// Loop through all subscribers that signed in to receive an email
|
784 |
// when this product become available again
|
785 |
-
foreach($collection as $subscriber) {
|
786 |
$_email = $subscriber->getEmail();
|
787 |
|
788 |
-
if($_email) {
|
789 |
-
$translate
|
790 |
|
791 |
$customer = Mage::getModel('customer/customer');
|
792 |
$customer->setStore(Mage::app()->getStore($storeId));
|
793 |
$customer->loadByEmail($_email);
|
794 |
|
795 |
-
$name
|
796 |
|
797 |
-
$url
|
798 |
-
$vars
|
799 |
|
800 |
$customer = Mage::getModel('customer/customer')
|
801 |
->setStore(Mage::app()->getStore($storeId))
|
802 |
->loadByEmail($_email);
|
803 |
-
if($customer->getId()) {
|
804 |
-
$tbtPoints = Mage::helper('ebizmarts_autoresponder')->getTBTPoints($customer->getId());
|
805 |
foreach ($tbtPoints as $key => $field) {
|
806 |
if ($key == 'points') {
|
807 |
if ($field >= Mage::getStoreConfig('sweetmonkey/general/email_points', $storeId)) {
|
@@ -813,7 +814,7 @@ class Ebizmarts_Autoresponder_Model_Cron
|
|
813 |
}
|
814 |
}
|
815 |
|
816 |
-
$mail
|
817 |
|
818 |
$translate->setTranslateInLine(true);
|
819 |
Mage::helper('ebizmarts_abandonedcart')->saveMail($mailType, $_email, $name, "", $storeId);
|
@@ -849,7 +850,7 @@ class Ebizmarts_Autoresponder_Model_Cron
|
|
849 |
*/
|
850 |
private function disableStockAlertsForProduct($product_id)
|
851 |
{
|
852 |
-
if(!$product_id) {
|
853 |
return false;
|
854 |
}
|
855 |
|
@@ -857,14 +858,14 @@ class Ebizmarts_Autoresponder_Model_Cron
|
|
857 |
$stockAlert->addFieldToFilter('is_active', array('eq' => 1));
|
858 |
$stockAlert->addFieldToFilter('product_id', array('eq' => $product_id));
|
859 |
|
860 |
-
if($stockAlert->getSize() > 0) {
|
861 |
-
foreach($stockAlert as $alert) {
|
862 |
$alert_id = $alert->getAlertId();
|
863 |
|
864 |
$subscribers = Mage::getModel('ebizmarts_autoresponder/backtostock')->getCollection();
|
865 |
-
$subscribers->addFieldToFilter('alert_id', array('eq'=> $alert_id));
|
866 |
|
867 |
-
foreach($subscribers as $subscriber) {
|
868 |
$subscriber->setIsActive(0);
|
869 |
$subscriber->save();
|
870 |
}
|
@@ -889,9 +890,9 @@ class Ebizmarts_Autoresponder_Model_Cron
|
|
889 |
|
890 |
Mage::helper('ebizmarts_autoresponder')->log('MageMonkey Autoresponder BackToStock Cleanup - started');
|
891 |
|
892 |
-
if($stockAlert->count() > 0) {
|
893 |
Mage::helper('ebizmarts_autoresponder')->log('Cleaning out ' . $stockAlert->count() . ' backtostockalert.');
|
894 |
-
foreach($stockAlert as $alert) {
|
895 |
$alert->delete();
|
896 |
}
|
897 |
}
|
@@ -901,10 +902,10 @@ class Ebizmarts_Autoresponder_Model_Cron
|
|
901 |
$backToStock = Mage::getModel('ebizmarts_autoresponder/backtostock')->getCollection();
|
902 |
$backToStock->addFieldToFilter('is_active', array('eq' => 0));
|
903 |
|
904 |
-
if($backToStock->count() > 0) {
|
905 |
|
906 |
Mage::helper('ebizmarts_autoresponder')->log('Cleaning out ' . $backToStock->count() . ' backtostock.');
|
907 |
-
foreach($backToStock as $subscriber) {
|
908 |
$subscriber->delete();
|
909 |
}
|
910 |
|
@@ -917,32 +918,31 @@ class Ebizmarts_Autoresponder_Model_Cron
|
|
917 |
}
|
918 |
|
919 |
|
920 |
-
protected function _createNewCoupon($store
|
921 |
{
|
922 |
$collection = Mage::getModel('salesrule/rule')->getCollection()
|
923 |
-
->addFieldToFilter('name', array('like'=>'Birthday coupon ' . $email));
|
924 |
if (!count($collection)) {
|
925 |
$couponamount = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::BIRTHDAY_DISCOUNT, $store);
|
926 |
$couponexpiredays = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::BIRTHDAY_EXPIRE, $store);
|
927 |
$coupontype = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::BIRTHDAY_DISCOUNT_TYPE, $store);
|
928 |
$couponlength = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::BIRTHDAY_LENGTH, $store);
|
929 |
$couponlabel = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::BIRTHDAY_COUPON_LABEL, $store);
|
930 |
-
$websiteid =
|
931 |
|
932 |
$fromDate = date("Y-m-d");
|
933 |
-
$toDate = date('Y-m-d', strtotime($fromDate. " + $couponexpiredays day"));
|
934 |
-
if($coupontype == 1) {
|
935 |
$action = 'cart_fixed';
|
936 |
-
$discount = Mage::app()->getStore($store)->getCurrentCurrencyCode()."$couponamount";
|
937 |
-
}
|
938 |
-
elseif($coupontype == 2) {
|
939 |
$action = 'by_percent';
|
940 |
$discount = "$couponamount%";
|
941 |
}
|
942 |
$customer_group = new Mage_Customer_Model_Group();
|
943 |
-
$allGroups
|
944 |
$groups = array();
|
945 |
-
foreach($allGroups as $groupid
|
946 |
$groups[] = $groupid;
|
947 |
}
|
948 |
$coupon_rule = Mage::getModel('salesrule/rule');
|
@@ -971,13 +971,13 @@ class Ebizmarts_Autoresponder_Model_Cron
|
|
971 |
$uniqueId = Mage::getSingleton('salesrule/coupon_codegenerator', array('length' => $couponlength))->generateCode();
|
972 |
$coupon_rule->setCouponCode($uniqueId);
|
973 |
$coupon_rule->save();
|
974 |
-
return array($uniqueId
|
975 |
-
}else{
|
976 |
$coupon = $collection->getFirstItem();
|
977 |
if ($coupon->getSimpleAction() == 'cart_fixed') {
|
978 |
-
$discount = Mage::app()->getStore($store)->getCurrentCurrencyCode() . ($coupon->getDiscountAmount()+0);
|
979 |
-
} else{
|
980 |
-
$discount = $coupon->getDiscountAmount()+0;
|
981 |
}
|
982 |
return array($coupon->getCode(), $discount, $coupon->getToDate());
|
983 |
}
|
@@ -988,14 +988,15 @@ class Ebizmarts_Autoresponder_Model_Cron
|
|
988 |
return sprintf('INTERVAL %d %s', $interval, $unit);
|
989 |
}
|
990 |
|
991 |
-
protected function _cleanAutoresponderExpiredCoupons()
|
|
|
992 |
$today = date('Y-m-d');
|
993 |
-
$reviewCouponFilter = array('like'=>'Review coupon%');
|
994 |
-
$birthdayCouponFilter = array('like'=>'Birthday coupon%');
|
995 |
|
996 |
$collection = Mage::getModel('salesrule/rule')->getCollection()
|
997 |
-
->addFieldToFilter('name', array($reviewCouponFilter
|
998 |
-
->addFieldToFilter('to_date', array('lt'=> $today));
|
999 |
|
1000 |
foreach ($collection as $toDelete) {
|
1001 |
$toDelete->delete();
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_Autoresponder_Model_Cron
|
11 |
{
|
12 |
/**
|
15 |
public function autoresponder()
|
16 |
{
|
17 |
$allStores = Mage::app()->getStores();
|
18 |
+
foreach ($allStores as $storeId => $val) {
|
19 |
+
if (Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::GENERAL_ACTIVE, $storeId)) {
|
|
|
20 |
$this->_processStore($storeId);
|
21 |
}
|
22 |
}
|
28 |
protected function _processStore($storeId)
|
29 |
{
|
30 |
//Mage::app()->setCurrentStore($storeId);
|
31 |
+
Mage::unregister('_singleton/core/design_package');
|
32 |
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
|
33 |
+
Mage::getSingleton('core/design_package')->setStore($storeId);
|
34 |
|
35 |
+
if (Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::NEWORDER_ACTIVE, $storeId) && Mage::helper('ebizmarts_autoresponder')->isSetTime(Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::NEWORDER_CRON_TIME, $storeId))) {
|
36 |
$this->_processNewOrders($storeId);
|
37 |
}
|
38 |
+
if (Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::RELATED_ACTIVE, $storeId) && Mage::helper('ebizmarts_autoresponder')->isSetTime(Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::RELATED_CRON_TIME, $storeId))) {
|
39 |
$this->_processRelated($storeId);
|
40 |
}
|
41 |
+
if (Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::REVIEW_ACTIVE, $storeId) && Mage::helper('ebizmarts_autoresponder')->isSetTime(Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::REVIEW_CRON_TIME, $storeId))) {
|
42 |
$this->_processReview($storeId);
|
43 |
}
|
44 |
+
if (Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::BIRTHDAY_ACTIVE, $storeId) && Mage::helper('ebizmarts_autoresponder')->isSetTime(Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::BIRTHDAY_CRON_TIME, $storeId))) {
|
45 |
$this->_processBirthday($storeId);
|
46 |
}
|
47 |
+
if (Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::NOACTIVITY_ACTIVE, $storeId) && Mage::helper('ebizmarts_autoresponder')->isSetTime(Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::NOACTIVITY_CRON_TIME, $storeId))) {
|
48 |
$this->_processNoActivity($storeId);
|
49 |
}
|
50 |
+
if (Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::WISHLIST_ACTIVE, $storeId) && Mage::helper('ebizmarts_autoresponder')->isSetTime(Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::WISHLIST_CRON_TIME, $storeId))) {
|
51 |
$this->_processWishlist($storeId);
|
52 |
}
|
53 |
+
if (Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::VISITED_ACTIVE, $storeId) && Mage::helper('ebizmarts_autoresponder')->isSetTime(Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::VISITED_CRON_TIME, $storeId))) {
|
54 |
$this->_processVisited($storeId);
|
55 |
}
|
56 |
+
if (Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::BACKTOSTOCK_ACTIVE, $storeId) && Mage::helper('ebizmarts_autoresponder')->isSetTime(Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::BACKTOSTOCK_CRON_TIME, $storeId))) {
|
57 |
$this->_processBackToStock($storeId);
|
58 |
}
|
59 |
$this->_cleanAutoresponderExpiredCoupons();
|
60 |
}
|
61 |
+
|
62 |
protected function _processNewOrders($storeId)
|
63 |
{
|
64 |
+
$customerGroups = explode(",", Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::NEWORDER_CUSTOMER_GROUPS, $storeId));
|
65 |
+
$days = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::NEWORDER_DAYS, $storeId);
|
66 |
+
$tags = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::NEWORDER_MANDRILL_TAG, $storeId) . "_$storeId";
|
67 |
+
$adapter = Mage::getSingleton('core/resource')->getConnection('sales_read');
|
68 |
+
$mailSubject = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::NEWORDER_SUBJECT, $storeId);
|
69 |
+
$senderId = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::GENERAL_SENDER, $storeId);
|
70 |
+
$sender = array('name' => Mage::getStoreConfig("trans_email/ident_$senderId/name", $storeId), 'email' => Mage::getStoreConfig("trans_email/ident_$senderId/email", $storeId));
|
71 |
+
$templateId = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::NEWORDER_TEMPLATE, $storeId);
|
72 |
|
73 |
$expr = sprintf('DATE_SUB(%s, %s)', $adapter->quote(now()), $this->_getIntervalUnitSql($days, 'DAY'));
|
74 |
$from = new Zend_Db_Expr($expr);
|
75 |
+
$expr = sprintf('DATE_SUB(%s, %s)', $adapter->quote(now()), $this->_getIntervalUnitSql($days - 1, 'DAY'));
|
76 |
$to = new Zend_Db_Expr($expr);
|
77 |
$collection = Mage::getResourceModel('sales/order_collection');
|
78 |
+
$collection->addFieldToFilter('main_table.store_id', array('eq' => $storeId))
|
79 |
+
->addFieldToFilter('main_table.created_at', array('from' => $from, 'to' => $to));
|
80 |
+
if (Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::NEWORDER_TRIGGER, $storeId) == 2) {
|
81 |
$collection->addFieldToFilter('main_table.status', array('eq' => strtolower(Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::NEWORDER_ORDER_STATUS, $storeId))));
|
82 |
}
|
83 |
+
if (count($customerGroups)) {
|
84 |
+
$collection->addFieldToFilter('main_table.customer_group_id', array('in' => $customerGroups));
|
85 |
}
|
86 |
+
foreach ($collection as $order) {
|
87 |
$translate = Mage::getSingleton('core/translate');
|
88 |
$email = $order->getCustomerEmail();
|
89 |
+
if (Mage::helper('ebizmarts_autoresponder')->isSubscribed($email, 'neworder', $storeId)) {
|
90 |
+
$name = $order->getCustomerFirstname() . ' ' . $order->getCustomerLastname();
|
91 |
+
$url = Mage::getModel('core/url')->setStore($storeId)->getUrl() . 'ebizautoresponder/autoresponder/unsubscribe?list=neworder&email=' . $email . '&store=' . $storeId;
|
92 |
+
$vars = array('tags' => array($tags), 'url' => $url);
|
93 |
|
94 |
$customer = Mage::getModel('customer/customer')
|
95 |
->setStore(Mage::app()->getStore($storeId))
|
96 |
->loadByEmail($email);
|
97 |
+
if ($customer->getId()) {
|
98 |
+
$tbtPoints = Mage::helper('ebizmarts_autoresponder')->getTBTPoints($customer->getId(), $storeId);
|
99 |
foreach ($tbtPoints as $key => $field) {
|
100 |
if ($key == 'points') {
|
101 |
if ($field >= Mage::getStoreConfig('sweetmonkey/general/email_points', $storeId)) {
|
107 |
}
|
108 |
}
|
109 |
|
110 |
+
$mail = Mage::getModel('core/email_template')->setTemplateSubject($mailSubject)->sendTransactional($templateId, $sender, $email, $name, $vars, $storeId);
|
111 |
$translate->setTranslateInLine(true);
|
112 |
+
Mage::helper('ebizmarts_abandonedcart')->saveMail('new order', $email, $name, "", $storeId);
|
113 |
}
|
114 |
}
|
115 |
}
|
116 |
+
|
117 |
protected function _processBirthday($storeId)
|
118 |
{
|
119 |
+
$days = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::BIRTHDAY_DAYS, $storeId);
|
120 |
+
$customerGroups = explode(",", Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::BIRTHDAY_CUSTOMER_GROUPS, $storeId));
|
121 |
+
$senderId = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::GENERAL_SENDER, $storeId);
|
122 |
+
$sender = array('name' => Mage::getStoreConfig("trans_email/ident_$senderId/name", $storeId), 'email' => Mage::getStoreConfig("trans_email/ident_$senderId/email", $storeId));
|
123 |
+
$templateId = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::BIRTHDAY_TEMPLATE, $storeId);
|
124 |
+
$mailSubject = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::BIRTHDAY_SUBJECT, $storeId);
|
125 |
+
$tags = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::BIRTHDAY_MANDRILL_TAG, $storeId) . "_$storeId";
|
126 |
+
$sendCoupon = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::BIRTHDAY_COUPON, $storeId);
|
127 |
+
$customerGroupsCoupon = explode(",", Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::BIRTHDAY_CUSTOMER_COUPON, $storeId));
|
128 |
+
|
129 |
+
|
130 |
+
$collection = Mage::getModel('customer/customer')->getCollection();
|
131 |
+
$date2 = date("Y-m-d H:i:s", strtotime(" + $days days"));
|
132 |
+
$month = date("m", strtotime($date2));
|
133 |
+
$day = date("d", strtotime($date2));
|
134 |
$moreselect = "MONTH(at_dob.value) = $month AND DAY(at_dob.value) = $day";
|
135 |
|
136 |
|
137 |
+
$collection->addAttributeToFilter('dob', array('neq' => 'null'))
|
138 |
+
->addFieldToFilter('store_id', array('eq' => $storeId));
|
139 |
+
if (count($customerGroups)) {
|
140 |
+
$collection->addFieldToFilter('group_id', array('in' => $customerGroups));
|
141 |
}
|
142 |
$collection->getSelect()->where($moreselect);
|
143 |
+
foreach ($collection as $customer) {
|
144 |
$translate = Mage::getSingleton('core/translate');
|
145 |
$cust = Mage::getModel('customer/customer')->load($customer->getEntityId());
|
146 |
$email = $cust->getEmail();
|
147 |
+
$name = $cust->getFirstname() . ' ' . $cust->getLastname();
|
148 |
+
if (Mage::helper('ebizmarts_autoresponder')->isSubscribed($email, 'birthday', $storeId)) {
|
149 |
$vars = array();
|
150 |
+
$url = Mage::getModel('core/url')->setStore($storeId)->getUrl() . 'ebizautoresponder/autoresponder/unsubscribe?list=birthday&email=' . $email . '&store=' . $storeId;
|
151 |
$couponcode = '';
|
152 |
+
if ($sendCoupon && in_array($customer->getGroupId(), $customerGroupsCoupon)) {
|
153 |
+
if (Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::BIRTHDAY_AUTOMATIC, $storeId) == Ebizmarts_Autoresponder_Model_Config::COUPON_AUTOMATIC) {
|
154 |
+
list($couponcode, $discount, $toDate) = $this->_createNewCoupon($storeId, $email);
|
155 |
+
$vars = array('couponcode' => $couponcode, 'discount' => $discount, 'todate' => $toDate, 'name' => $name, 'tags' => array($tags), 'url' => $url);
|
156 |
+
} else {
|
|
|
157 |
$couponcode = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::BIRTHDAY_COUPON_CODE);
|
158 |
+
$vars = array('couponcode' => $couponcode, 'name' => $name, 'tags' => array($tags), 'url' => $url);
|
159 |
}
|
160 |
|
161 |
}
|
163 |
$customer = Mage::getModel('customer/customer')
|
164 |
->setStore(Mage::app()->getStore($storeId))
|
165 |
->loadByEmail($email);
|
166 |
+
if ($customer->getId()) {
|
167 |
+
$tbtPoints = Mage::helper('ebizmarts_autoresponder')->getTBTPoints($customer->getId(), $storeId);
|
168 |
foreach ($tbtPoints as $key => $field) {
|
169 |
if ($key == 'points') {
|
170 |
if ($field >= Mage::getStoreConfig('sweetmonkey/general/email_points', $storeId)) {
|
176 |
}
|
177 |
}
|
178 |
|
179 |
+
$mail = Mage::getModel('core/email_template')->setTemplateSubject($mailSubject)->sendTransactional($templateId, $sender, $email, $name, $vars, $storeId);
|
180 |
$translate->setTranslateInLine(true);
|
181 |
+
Mage::helper('ebizmarts_abandonedcart')->saveMail('happy birthday', $email, $name, $couponcode, $storeId);
|
182 |
}
|
183 |
}
|
184 |
|
185 |
}
|
186 |
+
|
187 |
protected function _processNoActivity($storeId)
|
188 |
{
|
189 |
+
$days = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::NOACTIVITY_DAYS, $storeId);
|
190 |
+
$customerGroups = explode(",", Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::NOACTIVITY_CUSTOMER_GROUPS, $storeId));
|
191 |
+
$senderId = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::GENERAL_SENDER, $storeId);
|
192 |
+
$sender = array('name' => Mage::getStoreConfig("trans_email/ident_$senderId/name", $storeId), 'email' => Mage::getStoreConfig("trans_email/ident_$senderId/email", $storeId));
|
193 |
+
$templateId = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::NOACTIVITY_TEMPLATE, $storeId);
|
194 |
+
$mailSubject = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::NOACTIVITY_SUBJECT, $storeId);
|
195 |
+
$tags = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::NOACTIVITY_MANDRILL_TAG, $storeId) . "_$storeId";
|
196 |
|
197 |
+
$collection = Mage::getModel('customer/customer')->getCollection();
|
198 |
|
199 |
|
200 |
+
if (count($customerGroups)) {
|
201 |
+
$collection->addFieldToFilter('group_id', array('in' => $customerGroups));
|
202 |
}
|
203 |
+
$collection->addFieldToFilter('store_id', array('eq' => $storeId));
|
204 |
|
205 |
+
foreach ($collection as $customer) {
|
206 |
$customerId = $customer->getEntityId();
|
207 |
// get the orders for this customer for this store
|
208 |
$orderCollection = Mage::getModel('sales/order')->getCollection();
|
209 |
+
$orderCollection->addFieldToFilter('customer_id', array('eq' => $customerId))
|
210 |
+
->addFieldToFilter('store_id', array('eq' => $storeId));
|
211 |
+
if ($orderCollection->getSize() > 0) { // if the customer has any order for this store
|
212 |
$logCustomer = Mage::getModel('log/customer')->loadByCustomer($customer);
|
213 |
$lastVisited = $logCustomer->getLoginAt();
|
214 |
+
$limitup = date("Y-m-d H:i:s", strtotime(" - $days days"));
|
215 |
+
$daysAux = $days + 1;
|
216 |
+
$limitdown = date("Y-m-d H:i:s", strtotime(" - $daysAux days"));
|
217 |
+
if ($limitup > $lastVisited && $limitdown < $lastVisited) {
|
218 |
$translate = Mage::getSingleton('core/translate');
|
219 |
$cust = Mage::getModel('customer/customer')->load($customerId);
|
220 |
$email = $cust->getEmail();
|
221 |
+
$name = $cust->getFirstname() . ' ' . $cust->getLastname();
|
222 |
+
if (Mage::helper('ebizmarts_autoresponder')->isSubscribed($email, 'noactivity', $storeId)) {
|
223 |
+
$url = Mage::getModel('core/url')->setStore($storeId)->getUrl() . 'ebizautoresponder/autoresponder/unsubscribe?list=noactivity&email=' . $email . '&store=' . $storeId;
|
224 |
+
$vars = array('name' => $name, 'tags' => array($tags), 'lastlogin' => $lastVisited, 'url' => $url);
|
225 |
|
226 |
$customer = Mage::getModel('customer/customer')
|
227 |
->setStore(Mage::app()->getStore($storeId))
|
228 |
->loadByEmail($email);
|
229 |
+
if ($customer->getId()) {
|
230 |
+
$tbtPoints = Mage::helper('ebizmarts_autoresponder')->getTBTPoints($customer->getId(), $storeId);
|
231 |
foreach ($tbtPoints as $key => $field) {
|
232 |
if ($key == 'points') {
|
233 |
if ($field >= Mage::getStoreConfig('sweetmonkey/general/email_points', $storeId)) {
|
239 |
}
|
240 |
}
|
241 |
|
242 |
+
$mail = Mage::getModel('core/email_template')->setTemplateSubject($mailSubject)->sendTransactional($templateId, $sender, $email, $name, $vars, $storeId);
|
243 |
$translate->setTranslateInLine(true);
|
244 |
+
Mage::helper('ebizmarts_abandonedcart')->saveMail('no activity', $email, $name, "", $storeId);
|
245 |
}
|
246 |
}
|
247 |
}
|
248 |
}
|
249 |
|
250 |
}
|
251 |
+
|
252 |
protected function _processRelated($storeId)
|
253 |
{
|
254 |
+
$customerGroups = explode(",", Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::RELATED_CUSTOMER_GROUPS, $storeId));
|
255 |
+
$days = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::RELATED_DAYS, $storeId);
|
256 |
+
$tags = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::RELATED_MANDRILL_TAG, $storeId) . "_$storeId";
|
257 |
+
$adapter = Mage::getSingleton('core/resource')->getConnection('sales_read');
|
258 |
+
$mailSubject = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::RELATED_SUBJECT, $storeId);
|
259 |
+
$senderId = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::GENERAL_SENDER, $storeId);
|
260 |
+
$sender = array('name' => Mage::getStoreConfig("trans_email/ident_$senderId/name", $storeId), 'email' => Mage::getStoreConfig("trans_email/ident_$senderId/email", $storeId));
|
261 |
+
$templateId = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::RELATED_TEMPLATE, $storeId);
|
262 |
+
$maxRelated = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::RELATED_MAX, $storeId);
|
263 |
+
$status = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::RELATED_STATUS, $storeId);
|
264 |
|
265 |
$expr = sprintf('DATE_SUB(%s, %s)', $adapter->quote(now()), $this->_getIntervalUnitSql($days, 'DAY'));
|
266 |
$from = new Zend_Db_Expr($expr);
|
267 |
+
$expr = sprintf('DATE_SUB(%s, %s)', $adapter->quote(now()), $this->_getIntervalUnitSql($days - 1, 'DAY'));
|
268 |
$to = new Zend_Db_Expr($expr);
|
269 |
$collection = Mage::getResourceModel('sales/order_collection');
|
270 |
+
$collection->addFieldToFilter('main_table.store_id', array('eq' => $storeId))
|
271 |
+
->addFieldToFilter('main_table.created_at', array('from' => $from, 'to' => $to))
|
272 |
+
->addFieldToFilter('main_table.status', array('eq' => $status));
|
273 |
|
274 |
+
if (count($customerGroups)) {
|
275 |
+
$collection->addFieldToFilter('main_table.customer_group_id', array('in' => $customerGroups));
|
276 |
}
|
277 |
+
foreach ($collection as $order) {
|
278 |
$counter = 0;
|
279 |
$allRelated = array();
|
280 |
+
foreach ($order->getAllItems() as $itemId => $item) {
|
281 |
+
if ($maxRelated && $maxRelated < $counter) {
|
282 |
break;
|
283 |
}
|
284 |
$product = Mage::getModel('catalog/product')->load($item->getProductId());
|
285 |
+
foreach ($product->getRelatedLinkCollection() as $related) {
|
286 |
+
if ($maxRelated && $maxRelated < $counter) {
|
287 |
break;
|
288 |
}
|
289 |
$relatedProduct = Mage::getModel('catalog/product')->load($related->getLinkedProductId());
|
290 |
$allRelated[$counter++] = $relatedProduct;
|
291 |
}
|
292 |
}
|
293 |
+
if ($counter > 0) {
|
294 |
$translate = Mage::getSingleton('core/translate');
|
295 |
$email = $order->getCustomerEmail();
|
296 |
+
if (Mage::helper('ebizmarts_autoresponder')->isSubscribed($email, 'related', $storeId)) {
|
297 |
+
$name = $order->getCustomerFirstname() . ' ' . $order->getCustomerLastname();
|
298 |
+
$url = Mage::getModel('core/url')->setStore($storeId)->getUrl() . 'ebizautoresponder/autoresponder/unsubscribe?list=related&email=' . $email . '&store=' . $storeId;
|
299 |
+
$vars = array('name' => $name, 'tags' => array($tags), 'related' => $allRelated, 'url' => $url);
|
300 |
|
301 |
$customer = Mage::getModel('customer/customer')
|
302 |
->setStore(Mage::app()->getStore($storeId))
|
303 |
->loadByEmail($email);
|
304 |
+
if ($customer->getId()) {
|
305 |
+
$tbtPoints = Mage::helper('ebizmarts_autoresponder')->getTBTPoints($customer->getId(), $storeId);
|
306 |
foreach ($tbtPoints as $key => $field) {
|
307 |
if ($key == 'points') {
|
308 |
if ($field >= Mage::getStoreConfig('sweetmonkey/general/email_points', $storeId)) {
|
314 |
}
|
315 |
}
|
316 |
|
317 |
+
$mail = Mage::getModel('core/email_template')->setTemplateSubject($mailSubject)->sendTransactional($templateId, $sender, $email, $name, $vars, $storeId);
|
318 |
$translate->setTranslateInLine(true);
|
319 |
+
Mage::helper('ebizmarts_abandonedcart')->saveMail('related products', $email, $name, "", $storeId);
|
320 |
}
|
321 |
}
|
322 |
}
|
323 |
|
324 |
}
|
325 |
+
|
326 |
protected function _processReview($storeId)
|
327 |
{
|
328 |
+
$customerGroups = explode(",", Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::REVIEW_CUSTOMER_GROUPS, $storeId));
|
329 |
+
$days = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::REVIEW_DAYS, $storeId);
|
330 |
+
$tags = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::REVIEW_MANDRILL_TAG, $storeId) . "_$storeId";
|
331 |
+
$adapter = Mage::getSingleton('core/resource')->getConnection('sales_read');
|
332 |
+
$mailSubject = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::REVIEW_SUBJECT, $storeId);
|
333 |
+
$senderId = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::GENERAL_SENDER, $storeId);
|
334 |
+
$sender = array('name' => Mage::getStoreConfig("trans_email/ident_$senderId/name", $storeId), 'email' => Mage::getStoreConfig("trans_email/ident_$senderId/email", $storeId));
|
335 |
+
$templateId = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::REVIEW_TEMPLATE, $storeId);
|
336 |
+
$status = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::REVIEW_STATUS, $storeId);
|
337 |
|
338 |
$expr = sprintf('DATE_SUB(%s, %s)', $adapter->quote(now()), $this->_getIntervalUnitSql($days, 'DAY'));
|
339 |
$from = new Zend_Db_Expr($expr);
|
340 |
+
$expr = sprintf('DATE_SUB(%s, %s)', $adapter->quote(now()), $this->_getIntervalUnitSql($days - 1, 'DAY'));
|
341 |
$to = new Zend_Db_Expr($expr);
|
342 |
$collection = Mage::getResourceModel('sales/order_collection');
|
343 |
+
$collection->addFieldToFilter('main_table.store_id', array('eq' => $storeId))
|
344 |
// ->addFieldToFilter('main_table.created_at',array('from'=>$from,'to'=>$to))
|
345 |
+
->addFieldToFilter('main_table.updated_at', array('from' => $from, 'to' => $to))
|
346 |
+
->addFieldToFilter('main_table.status', array('eq' => $status));
|
347 |
// Mage::log((string)$collection->getSelect());
|
348 |
+
if (count($customerGroups)) {
|
349 |
+
$collection->addFieldToFilter('main_table.customer_group_id', array('in' => $customerGroups));
|
350 |
}
|
351 |
+
foreach ($collection as $order) {
|
352 |
$translate = Mage::getSingleton('core/translate');
|
353 |
$email = $order->getCustomerEmail();
|
354 |
+
if (Mage::helper('ebizmarts_autoresponder')->isSubscribed($email, 'review', $storeId)) {
|
355 |
+
if (Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::REVIEW_HAS_COUPON, $storeId)) {
|
356 |
+
srand((double)microtime() * 1000000);
|
357 |
+
$token = md5(rand(0, 9999999));
|
358 |
$review = Mage::getModel('ebizmarts_autoresponder/review');
|
359 |
$review->setCustomerId($order->getCustomerId())
|
360 |
+
->setStoreId($storeId)
|
361 |
+
->setItems($order->getTotalItemCount())
|
362 |
+
->setCounter(0)
|
363 |
+
->setToken($token)
|
364 |
+
->setOrderId($order->getIncrementId())
|
365 |
+
->save();
|
366 |
}
|
367 |
+
$name = $order->getCustomerFirstname() . ' ' . $order->getCustomerLastname();
|
368 |
$products = array();
|
369 |
+
foreach ($order->getAllItems() as $item) {
|
370 |
$product = Mage::getModel('catalog/product')->load($item->getProductId());
|
371 |
+
if ($product->isConfigurable()) {
|
372 |
continue;
|
373 |
}
|
374 |
$products[] = $product;
|
375 |
}
|
376 |
$orderNum = $order->getIncrementId();
|
377 |
+
$url = Mage::getModel('core/url')->setStore($storeId)->getUrl() . 'ebizautoresponder/autoresponder/unsubscribe?list=review&email=' . $email . '&store=' . $storeId;
|
378 |
+
if (Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::REVIEW_HAS_COUPON, $storeId)) {
|
379 |
+
$vars = array('name' => $name, 'tags' => array($tags), 'products' => $products, 'ordernum' => $orderNum, 'url' => $url, 'token' => $token);
|
380 |
+
} else {
|
381 |
+
$vars = array('name' => $name, 'tags' => array($tags), 'products' => $products, 'ordernum' => $orderNum, 'url' => $url);
|
|
|
382 |
}
|
383 |
|
384 |
$customer = Mage::getModel('customer/customer')
|
385 |
->setStore(Mage::app()->getStore($storeId))
|
386 |
->loadByEmail($email);
|
387 |
+
if ($customer->getId()) {
|
388 |
+
$tbtPoints = Mage::helper('ebizmarts_autoresponder')->getTBTPoints($customer->getId(), $storeId);
|
389 |
foreach ($tbtPoints as $key => $field) {
|
390 |
if ($key == 'points') {
|
391 |
if ($field >= Mage::getStoreConfig('sweetmonkey/general/email_points', $storeId)) {
|
397 |
}
|
398 |
}
|
399 |
|
400 |
+
$mail = Mage::getModel('core/email_template')->setTemplateSubject($mailSubject)->sendTransactional($templateId, $sender, $email, $name, $vars, $storeId);
|
401 |
$translate->setTranslateInLine(true);
|
402 |
+
Mage::helper('ebizmarts_abandonedcart')->saveMail('product review', $email, $name, "", $storeId);
|
403 |
}
|
404 |
}
|
405 |
|
406 |
}
|
407 |
+
|
408 |
protected function _processWishlist($storeId)
|
409 |
{
|
410 |
+
$customerGroups = explode(",", Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::WISHLIST_CUSTOMER_GROUPS, $storeId));
|
411 |
+
$days = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::WISHLIST_DAYS, $storeId);
|
412 |
+
$tags = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::WISHLIST_MANDRILL_TAG, $storeId) . "_$storeId";
|
413 |
+
$adapter = Mage::getSingleton('core/resource')->getConnection('sales_read');
|
414 |
+
$mailSubject = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::WISHLIST_SUBJECT, $storeId);
|
415 |
+
$senderId = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::GENERAL_SENDER, $storeId);
|
416 |
+
$sender = array('name' => Mage::getStoreConfig("trans_email/ident_$senderId/name", $storeId), 'email' => Mage::getStoreConfig("trans_email/ident_$senderId/email", $storeId));
|
417 |
+
$templateId = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::WISHLIST_TEMPLATE, $storeId);
|
418 |
|
419 |
$expr = sprintf('DATE_SUB(%s, %s)', $adapter->quote(now()), $this->_getIntervalUnitSql($days, 'DAY'));
|
420 |
$from = new Zend_Db_Expr($expr);
|
421 |
+
$expr = sprintf('DATE_SUB(%s, %s)', $adapter->quote(now()), $this->_getIntervalUnitSql($days - 1, 'DAY'));
|
422 |
$to = new Zend_Db_Expr($expr);
|
423 |
|
424 |
$collection = Mage::getModel('wishlist/item')->getCollection();
|
425 |
+
$collection->addFieldToFilter('main_table.added_at', array('from' => $from, 'to' => $to))
|
426 |
+
->addFieldToFilter('main_table.store_id', array('eq' => $storeId))
|
427 |
+
->setOrder('main_table.wishlist_id');
|
428 |
$wishlist_ant = -1;
|
429 |
$wishlistId = $collection->getFirstItem()->getWishlistId();
|
430 |
$products = array();
|
431 |
+
foreach ($collection as $item) {
|
432 |
+
if ($wishlistId != $wishlist_ant) {
|
433 |
+
if ($wishlist_ant != -1 && count($products) > 0) {
|
434 |
+
$translate = Mage::getSingleton('core/translate');
|
435 |
+
$email = $customer->getEmail();
|
436 |
+
if (Mage::helper('ebizmarts_autoresponder')->isSubscribed($email, 'wishlist', $storeId)) {
|
437 |
+
$name = $customer->getFirstname() . ' ' . $customer->getLastname();
|
438 |
+
$url = Mage::getModel('core/url')->setStore($storeId)->getUrl() . 'ebizautoresponder/autoresponder/unsubscribe?list=wishlist&email=' . $email . '&store=' . $storeId;
|
439 |
+
$vars = array('name' => $name, 'tags' => array($tags), 'products' => $products, 'url' => $url);
|
440 |
|
441 |
$customer = Mage::getModel('customer/customer')
|
442 |
->setStore(Mage::app()->getStore($storeId))
|
443 |
->loadByEmail($email);
|
444 |
+
if ($customer->getId()) {
|
445 |
+
$tbtPoints = Mage::helper('ebizmarts_autoresponder')->getTBTPoints($customer->getId(), $storeId);
|
446 |
foreach ($tbtPoints as $key => $field) {
|
447 |
if ($key == 'points') {
|
448 |
if ($field >= Mage::getStoreConfig('sweetmonkey/general/email_points', $storeId)) {
|
454 |
}
|
455 |
}
|
456 |
|
457 |
+
$mail = Mage::getModel('core/email_template')->setTemplateSubject($mailSubject)->sendTransactional($templateId, $sender, $email, $name, $vars, $storeId);
|
458 |
$translate->setTranslateInLine(true);
|
459 |
+
Mage::helper('ebizmarts_abandonedcart')->saveMail('wishlist', $email, $name, "", $storeId);
|
460 |
}
|
461 |
|
462 |
}
|
463 |
+
$wishlist_ant = $wishlistId;
|
464 |
+
$wishlistId = $item->getWishlistId();
|
465 |
+
$wishlist = Mage::getModel('wishlist/wishlist')->load($wishlistId);
|
466 |
+
$customer = Mage::getModel('customer/customer')->load($wishlist->getCustomerId());
|
467 |
+
$products = array();
|
468 |
}
|
469 |
+
if (in_array($customer->getGroupId(), $customerGroups)) {
|
470 |
+
$products[] = Mage::getModel('catalog/product')->load($item->getProductId());
|
471 |
}
|
472 |
}
|
473 |
+
if (count($products)) {
|
474 |
+
$translate = Mage::getSingleton('core/translate');
|
475 |
+
$email = $customer->getEmail();
|
476 |
+
if (Mage::helper('ebizmarts_autoresponder')->isSubscribed($email, 'wishlist', $storeId)) {
|
477 |
+
$name = $customer->getFirstname() . ' ' . $customer->getLastname();
|
478 |
+
$url = Mage::getModel('core/url')->setStore($storeId)->getUrl() . 'ebizautoresponder/autoresponder/unsubscribe?list=wishlist&email=' . $email . '&store=' . $storeId;
|
479 |
+
$vars = array('name' => $name, 'tags' => array($tags), 'products' => $products, 'url' => $url);
|
480 |
|
481 |
$customer = Mage::getModel('customer/customer')
|
482 |
->setStore(Mage::app()->getStore($storeId))
|
483 |
->loadByEmail($email);
|
484 |
+
if ($customer->getId()) {
|
485 |
+
$tbtPoints = Mage::helper('ebizmarts_autoresponder')->getTBTPoints($customer->getId(), $storeId);
|
486 |
foreach ($tbtPoints as $key => $field) {
|
487 |
if ($key == 'points') {
|
488 |
if ($field >= Mage::getStoreConfig('sweetmonkey/general/email_points', $storeId)) {
|
494 |
}
|
495 |
}
|
496 |
|
497 |
+
$mail = Mage::getModel('core/email_template')->setTemplateSubject($mailSubject)->sendTransactional($templateId, $sender, $email, $name, $vars, $storeId);
|
498 |
$translate->setTranslateInLine(true);
|
499 |
+
Mage::helper('ebizmarts_abandonedcart')->saveMail('wishlist', $email, $name, "", $storeId);
|
500 |
}
|
501 |
}
|
502 |
|
503 |
}
|
504 |
+
|
505 |
protected function _processVisited($storeId)
|
506 |
{
|
507 |
+
$customerGroups = explode(",", Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::VISITED_CUSTOMER_GROUPS, $storeId));
|
508 |
+
$days = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::VISITED_DAYS, $storeId);
|
509 |
+
$tags = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::VISITED_MANDRILL_TAG, $storeId) . "_$storeId";
|
510 |
+
$mailSubject = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::VISITED_SUBJECT, $storeId);
|
511 |
+
$senderId = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::GENERAL_SENDER, $storeId);
|
512 |
+
$sender = array('name' => Mage::getStoreConfig("trans_email/ident_$senderId/name", $storeId), 'email' => Mage::getStoreConfig("trans_email/ident_$senderId/email", $storeId));
|
513 |
+
$templateId = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::VISITED_TEMPLATE, $storeId);
|
514 |
+
$adapter = Mage::getSingleton('core/resource')->getConnection('sales_read');
|
515 |
+
$max = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::VISITED_MAX, $storeId);
|
516 |
|
517 |
$expr = sprintf('DATE_SUB(%s, %s)', $adapter->quote(now()), $this->_getIntervalUnitSql($days, 'DAY'));
|
518 |
$from = new Zend_Db_Expr($expr);
|
519 |
+
$expr = sprintf('DATE_SUB(%s, %s)', $adapter->quote(now()), $this->_getIntervalUnitSql($days - 1, 'DAY'));
|
520 |
$to = new Zend_Db_Expr($expr);
|
521 |
|
522 |
$collection = Mage::getModel('ebizmarts_autoresponder/visited')->getCollection();
|
523 |
$collection
|
524 |
+
->addFieldToFilter('main_table.visited_at', array('from' => $from, 'to' => $to))
|
525 |
+
->addFieldToFilter('main_table.store_id', array('eq' => $storeId));
|
526 |
$collection->getSelect()->order('main_table.customer_id asc')->order('main_table.visited_at desc');
|
527 |
|
528 |
$customerIdPrev = 0;
|
529 |
$products = array();
|
530 |
+
foreach ($collection as $item) {
|
531 |
+
if ($customerIdPrev != $item->getCustomerId()) {
|
532 |
+
if ($customerIdPrev != 0 && count($products) > 0) {
|
533 |
+
$email = $customer->getEmail();
|
534 |
+
if (Mage::helper('ebizmarts_autoresponder')->isSubscribed($email, 'visitedproducts', $storeId)) {
|
535 |
+
$translate = Mage::getSingleton('core/translate');
|
536 |
+
$name = $customer->getFirstname() . ' ' . $customer->getLastname();
|
537 |
+
$url = Mage::getModel('core/url')->setStore($storeId)->getUrl() . 'ebizautoresponder/autoresponder/unsubscribe?list=visitedproducts&email=' . $email . '&store=' . $storeId;
|
538 |
+
$vars = array('name' => $name, 'tags' => array($tags), 'products' => $products, 'url' => $url);
|
539 |
|
540 |
$customer = Mage::getModel('customer/customer')
|
541 |
->setStore(Mage::app()->getStore($storeId))
|
542 |
->loadByEmail($email);
|
543 |
+
if ($customer->getId()) {
|
544 |
+
$tbtPoints = Mage::helper('ebizmarts_autoresponder')->getTBTPoints($customer->getId(), $storeId);
|
545 |
foreach ($tbtPoints as $key => $field) {
|
546 |
if ($key == 'points') {
|
547 |
if ($field >= Mage::getStoreConfig('sweetmonkey/general/email_points', $storeId)) {
|
553 |
}
|
554 |
}
|
555 |
|
556 |
+
$mail = Mage::getModel('core/email_template')->setTemplateSubject($mailSubject)->sendTransactional($templateId, $sender, $email, $name, $vars, $storeId);
|
557 |
$translate->setTranslateInLine(true);
|
558 |
+
Mage::helper('ebizmarts_abandonedcart')->saveMail('visitedproducts', $email, $name, "", $storeId);
|
559 |
}
|
560 |
}
|
561 |
+
$products = array();
|
562 |
+
if ($item->getCustomerId()) {
|
563 |
$customer = Mage::getModel('customer/customer')->load($item->getCustomerId());
|
564 |
$customerIdPrev = $item->getCustomerId();
|
565 |
}
|
566 |
|
567 |
}
|
568 |
+
if (count($products) > $max && $max != 0 || ($customer && !in_array($customer->getGroupId(), $customerGroups))) {
|
569 |
continue;
|
570 |
}
|
571 |
// $itemscollection = Mage::getModel('sales/order_item')->getCollection();
|
583 |
// $products[]= Mage::getModel('catalog/product')->load($item->getProductId());
|
584 |
// }
|
585 |
$itemscollection = Mage::getModel('sales/quote')->getCollection();
|
586 |
+
if ($item->getCustomerId()) {
|
587 |
$itemscollection->addFieldToFilter('main_table.customer_id', array('eq' => $item->getCustomerId()));
|
588 |
+
} else {
|
589 |
$itemscollection->addFieldToFilter('main_table.customer_email', array('eq' => $item->getCustomerEmail()));
|
590 |
}
|
591 |
+
$itemscollection->addFieldToFilter('main_table.created_at', array('from' => $from))
|
592 |
+
->addFieldToFilter('main_table.is_active', array('eq' => 0));
|
593 |
+
if (count($itemscollection) == 0) {
|
594 |
+
$products[] = Mage::getModel('catalog/product')->load($item->getProductId());
|
595 |
+
} else {
|
596 |
continue;
|
597 |
}
|
598 |
|
599 |
+
if (!$item->getCustomerId()) {
|
600 |
//add customer by email placed on Abandoned Cart Popup
|
601 |
+
$translate = Mage::getSingleton('core/translate');
|
602 |
$email = $item->getCustomerEmail();
|
603 |
$name = 'customer';
|
604 |
+
$url = Mage::getModel('core/url')->setStore($storeId)->getUrl() . 'ebizautoresponder/autoresponder/unsubscribe?list=visitedproducts&email=' . $email . '&store=' . $storeId;
|
605 |
+
$vars = array('name' => $name, 'tags' => array($tags), 'products' => $products, 'url' => $url);
|
606 |
|
607 |
$customer = Mage::getModel('customer/customer')
|
608 |
->setStore(Mage::app()->getStore($storeId))
|
609 |
->loadByEmail($email);
|
610 |
+
if ($customer->getId()) {
|
611 |
+
$tbtPoints = Mage::helper('ebizmarts_autoresponder')->getTBTPoints($customer->getId(), $storeId);
|
612 |
foreach ($tbtPoints as $key => $field) {
|
613 |
if ($key == 'points') {
|
614 |
if ($field >= Mage::getStoreConfig('sweetmonkey/general/email_points', $storeId)) {
|
620 |
}
|
621 |
}
|
622 |
|
623 |
+
$mail = Mage::getModel('core/email_template')->setTemplateSubject($mailSubject)->sendTransactional($templateId, $sender, $email, $name, $vars, $storeId);
|
624 |
$translate->setTranslateInLine(true);
|
625 |
+
Mage::helper('ebizmarts_abandonedcart')->saveMail('visitedproducts', $email, $name, "", $storeId);
|
626 |
}
|
627 |
}
|
628 |
+
if (count($products)) {
|
629 |
if ($item->getCustomerId()) {
|
630 |
$email = $customer->getEmail();
|
631 |
if (Mage::helper('ebizmarts_autoresponder')->isSubscribed($email, 'visitedproducts', $storeId)) {
|
637 |
$customer = Mage::getModel('customer/customer')
|
638 |
->setStore(Mage::app()->getStore($storeId))
|
639 |
->loadByEmail($email);
|
640 |
+
if ($customer->getId()) {
|
641 |
+
$tbtPoints = Mage::helper('ebizmarts_autoresponder')->getTBTPoints($customer->getId(), $storeId);
|
642 |
foreach ($tbtPoints as $key => $field) {
|
643 |
if ($key == 'points') {
|
644 |
if ($field >= Mage::getStoreConfig('sweetmonkey/general/email_points', $storeId)) {
|
656 |
}
|
657 |
} else {
|
658 |
//add customer by email placed on Abandoned Cart Popup
|
659 |
+
$translate = Mage::getSingleton('core/translate');
|
660 |
$email = $item->getCustomerEmail();
|
661 |
$name = 'customer';
|
662 |
+
$url = Mage::getModel('core/url')->setStore($storeId)->getUrl() . 'ebizautoresponder/autoresponder/unsubscribe?list=visitedproducts&email=' . $email . '&store=' . $storeId;
|
663 |
+
$vars = array('name' => $name, 'tags' => array($tags), 'products' => $products, 'url' => $url);
|
664 |
|
665 |
$customer = Mage::getModel('customer/customer')
|
666 |
->setStore(Mage::app()->getStore($storeId))
|
667 |
->loadByEmail($email);
|
668 |
+
if ($customer->getId()) {
|
669 |
+
$tbtPoints = Mage::helper('ebizmarts_autoresponder')->getTBTPoints($customer->getId(), $storeId);
|
670 |
foreach ($tbtPoints as $key => $field) {
|
671 |
if ($key == 'points') {
|
672 |
if ($field >= Mage::getStoreConfig('sweetmonkey/general/email_points', $storeId)) {
|
678 |
}
|
679 |
}
|
680 |
|
681 |
+
$mail = Mage::getModel('core/email_template')->setTemplateSubject($mailSubject)->sendTransactional($templateId, $sender, $email, $name, $vars, $storeId);
|
682 |
$translate->setTranslateInLine(true);
|
683 |
+
Mage::helper('ebizmarts_abandonedcart')->saveMail('visitedproducts', $email, $name, "", $storeId);
|
684 |
}
|
685 |
}
|
686 |
|
693 |
public function _processBackToStock($storeId)
|
694 |
{
|
695 |
// $customerGroups = explode(",",Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::BACKTOSTOCK_ACTIVE, $storeId));
|
696 |
+
$tags = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::BACKTOSTOCK_MANDRILL_TAG, $storeId) . "_$storeId";
|
697 |
+
$mailSubject = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::BACKTOSTOCK_SUBJECT, $storeId);
|
698 |
+
$senderId = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::GENERAL_SENDER, $storeId);
|
699 |
+
$sender = array('name' => Mage::getStoreConfig("trans_email/ident_$senderId/name", $storeId), 'email' => Mage::getStoreConfig("trans_email/ident_$senderId/email", $storeId));
|
700 |
+
$templateId = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::BACKTOSTOCK_TEMPLATE, $storeId);
|
701 |
+
$mailType = Ebizmarts_Autoresponder_Model_Config::BACKTOSTOCK_MAIL_TYPE_NAME;
|
702 |
|
703 |
$errorMessage = false;
|
704 |
|
705 |
+
if (!$sender) {
|
706 |
$errorMessage = Mage::helper('ebizmarts_autoresponder')->__('ERROR - Back to Stock Notification: No sender is specified. Check System/Configuration/MageMonkey/Autoresponders/General');
|
707 |
}
|
708 |
|
709 |
+
if (!$storeId) {
|
710 |
$errorMessage = Mage::helper('ebizmarts_autoresponder')->__('ERROR - Back to Stock Notification: No Store ID is configured');
|
711 |
}
|
712 |
|
713 |
+
if (!$templateId) {
|
714 |
$errorMessage = Mage::helper('ebizmarts_autoresponder')->__('ERROR - Back to Stock Notification: No templateId. Check System/Configuration/MageMonkey/Autoresponders/Back to Stock/Email Template');
|
715 |
}
|
716 |
|
717 |
+
if ($errorMessage) {
|
718 |
Mage::helper('ebizmarts_autoresponder')->log($errorMessage);
|
719 |
Mage::throwException($errorMessage);
|
720 |
return;
|
726 |
$alert = Mage::getModel('ebizmarts_autoresponder/backtostockalert');
|
727 |
$alert
|
728 |
->getCollection()
|
729 |
+
->addFieldToFilter('is_active', array('eq' => 1));
|
|
|
730 |
|
731 |
+
if (count($alert) > 0) {
|
732 |
|
733 |
// Loop through all products that came back to stock
|
734 |
+
foreach ($alert->getCollection() as $productStockAlert) {
|
735 |
|
736 |
// We'll validate if this products came back or not.
|
737 |
+
if ($productStockAlert->getProductId()) {
|
738 |
$inventory = Mage::getModel('cataloginventory/stock_item');
|
739 |
$_product = Mage::getModel('catalog/product')->load($productStockAlert->getProductId());
|
740 |
|
741 |
// Check if Product is loaded
|
742 |
+
if (!$_product->getId()) {
|
743 |
+
Mage::helper('ebizmarts_autoresponder')->log('ERROR - Cannot load product ID ' . $productStockAlert->getProductId() . '. Existing alert and subscribers will now be disabled.');
|
744 |
$this->disableStockAlertsForProduct($productStockAlert->getProductId());
|
745 |
continue;
|
746 |
}
|
747 |
|
748 |
// Retrieve stock data for Product
|
749 |
+
$_stock = $inventory->loadByProduct($_product->getId());
|
750 |
|
751 |
+
if (!$_stock->getData()) {
|
752 |
Mage::helper('ebizmarts_autoresponder')->log('Cannot load Product ID ' . $productStockAlert->getProductId() . ' stock info. Check if product still exists.');
|
753 |
continue;
|
754 |
}
|
755 |
|
756 |
//@TODO check if this next two validations can be replaced with isSaleable()
|
757 |
// Validate if Product has Stock
|
758 |
+
if (!$_stock->getData('is_in_stock') || $_stock->getData('qty') == 0) {
|
759 |
+
Mage::helper('ebizmarts_autoresponder')->log('SKIPPED - Product ID ' . $_product->getId() . ' is not in stock yet.');
|
760 |
continue;
|
761 |
}
|
762 |
|
763 |
// Validate if Product is Enabled
|
764 |
+
if ($_product->getStatus() != Mage_Catalog_Model_Product_Status::STATUS_ENABLED) {
|
765 |
+
Mage::helper('ebizmarts_autoresponder')->log('SKIPPED - Product ID ' . $_product->getId() . ' is not enabled (status = disabled).');
|
766 |
continue;
|
767 |
}
|
768 |
|
777 |
$collection = Mage::getModel('ebizmarts_autoresponder/backtostock')->getCollection();
|
778 |
$collection
|
779 |
->addFieldToFilter('is_active', array('eq' => 1))
|
780 |
+
->addFieldToFilter('alert_id', array('eq' => $productStockAlert->getAlertId()));
|
|
|
781 |
|
782 |
+
if (count($collection) > 0) {
|
783 |
|
784 |
// Loop through all subscribers that signed in to receive an email
|
785 |
// when this product become available again
|
786 |
+
foreach ($collection as $subscriber) {
|
787 |
$_email = $subscriber->getEmail();
|
788 |
|
789 |
+
if ($_email) {
|
790 |
+
$translate = Mage::getSingleton('core/translate');
|
791 |
|
792 |
$customer = Mage::getModel('customer/customer');
|
793 |
$customer->setStore(Mage::app()->getStore($storeId));
|
794 |
$customer->loadByEmail($_email);
|
795 |
|
796 |
+
$name = $customer->getFirstname() ? $customer->getFirstname() . ' ' . $customer->getLastname() : '';
|
797 |
|
798 |
+
$url = Mage::getModel('core/url')->setStore($storeId)->getUrl() . 'ebizautoresponder/autoresponder/unsubscribe?list=backtostock&email=' . $_email . '&store=' . $storeId;
|
799 |
+
$vars = array('name' => $name, 'tags' => array($tags), 'product' => $_product, 'url' => $url);
|
800 |
|
801 |
$customer = Mage::getModel('customer/customer')
|
802 |
->setStore(Mage::app()->getStore($storeId))
|
803 |
->loadByEmail($_email);
|
804 |
+
if ($customer->getId()) {
|
805 |
+
$tbtPoints = Mage::helper('ebizmarts_autoresponder')->getTBTPoints($customer->getId(), $storeId);
|
806 |
foreach ($tbtPoints as $key => $field) {
|
807 |
if ($key == 'points') {
|
808 |
if ($field >= Mage::getStoreConfig('sweetmonkey/general/email_points', $storeId)) {
|
814 |
}
|
815 |
}
|
816 |
|
817 |
+
$mail = Mage::getModel('core/email_template')->setTemplateSubject($mailSubject)->sendTransactional($templateId, $sender, $_email, $name, $vars, $storeId);
|
818 |
|
819 |
$translate->setTranslateInLine(true);
|
820 |
Mage::helper('ebizmarts_abandonedcart')->saveMail($mailType, $_email, $name, "", $storeId);
|
850 |
*/
|
851 |
private function disableStockAlertsForProduct($product_id)
|
852 |
{
|
853 |
+
if (!$product_id) {
|
854 |
return false;
|
855 |
}
|
856 |
|
858 |
$stockAlert->addFieldToFilter('is_active', array('eq' => 1));
|
859 |
$stockAlert->addFieldToFilter('product_id', array('eq' => $product_id));
|
860 |
|
861 |
+
if ($stockAlert->getSize() > 0) {
|
862 |
+
foreach ($stockAlert as $alert) {
|
863 |
$alert_id = $alert->getAlertId();
|
864 |
|
865 |
$subscribers = Mage::getModel('ebizmarts_autoresponder/backtostock')->getCollection();
|
866 |
+
$subscribers->addFieldToFilter('alert_id', array('eq' => $alert_id));
|
867 |
|
868 |
+
foreach ($subscribers as $subscriber) {
|
869 |
$subscriber->setIsActive(0);
|
870 |
$subscriber->save();
|
871 |
}
|
890 |
|
891 |
Mage::helper('ebizmarts_autoresponder')->log('MageMonkey Autoresponder BackToStock Cleanup - started');
|
892 |
|
893 |
+
if ($stockAlert->count() > 0) {
|
894 |
Mage::helper('ebizmarts_autoresponder')->log('Cleaning out ' . $stockAlert->count() . ' backtostockalert.');
|
895 |
+
foreach ($stockAlert as $alert) {
|
896 |
$alert->delete();
|
897 |
}
|
898 |
}
|
902 |
$backToStock = Mage::getModel('ebizmarts_autoresponder/backtostock')->getCollection();
|
903 |
$backToStock->addFieldToFilter('is_active', array('eq' => 0));
|
904 |
|
905 |
+
if ($backToStock->count() > 0) {
|
906 |
|
907 |
Mage::helper('ebizmarts_autoresponder')->log('Cleaning out ' . $backToStock->count() . ' backtostock.');
|
908 |
+
foreach ($backToStock as $subscriber) {
|
909 |
$subscriber->delete();
|
910 |
}
|
911 |
|
918 |
}
|
919 |
|
920 |
|
921 |
+
protected function _createNewCoupon($store, $email)
|
922 |
{
|
923 |
$collection = Mage::getModel('salesrule/rule')->getCollection()
|
924 |
+
->addFieldToFilter('name', array('like' => 'Birthday coupon ' . $email));
|
925 |
if (!count($collection)) {
|
926 |
$couponamount = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::BIRTHDAY_DISCOUNT, $store);
|
927 |
$couponexpiredays = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::BIRTHDAY_EXPIRE, $store);
|
928 |
$coupontype = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::BIRTHDAY_DISCOUNT_TYPE, $store);
|
929 |
$couponlength = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::BIRTHDAY_LENGTH, $store);
|
930 |
$couponlabel = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::BIRTHDAY_COUPON_LABEL, $store);
|
931 |
+
$websiteid = Mage::getModel('core/store')->load($store)->getWebsiteId();
|
932 |
|
933 |
$fromDate = date("Y-m-d");
|
934 |
+
$toDate = date('Y-m-d', strtotime($fromDate . " + $couponexpiredays day"));
|
935 |
+
if ($coupontype == 1) {
|
936 |
$action = 'cart_fixed';
|
937 |
+
$discount = Mage::app()->getStore($store)->getCurrentCurrencyCode() . "$couponamount";
|
938 |
+
} elseif ($coupontype == 2) {
|
|
|
939 |
$action = 'by_percent';
|
940 |
$discount = "$couponamount%";
|
941 |
}
|
942 |
$customer_group = new Mage_Customer_Model_Group();
|
943 |
+
$allGroups = $customer_group->getCollection()->toOptionHash();
|
944 |
$groups = array();
|
945 |
+
foreach ($allGroups as $groupid => $name) {
|
946 |
$groups[] = $groupid;
|
947 |
}
|
948 |
$coupon_rule = Mage::getModel('salesrule/rule');
|
971 |
$uniqueId = Mage::getSingleton('salesrule/coupon_codegenerator', array('length' => $couponlength))->generateCode();
|
972 |
$coupon_rule->setCouponCode($uniqueId);
|
973 |
$coupon_rule->save();
|
974 |
+
return array($uniqueId, $discount, $toDate);
|
975 |
+
} else {
|
976 |
$coupon = $collection->getFirstItem();
|
977 |
if ($coupon->getSimpleAction() == 'cart_fixed') {
|
978 |
+
$discount = Mage::app()->getStore($store)->getCurrentCurrencyCode() . ($coupon->getDiscountAmount() + 0);
|
979 |
+
} else {
|
980 |
+
$discount = $coupon->getDiscountAmount() + 0;
|
981 |
}
|
982 |
return array($coupon->getCode(), $discount, $coupon->getToDate());
|
983 |
}
|
988 |
return sprintf('INTERVAL %d %s', $interval, $unit);
|
989 |
}
|
990 |
|
991 |
+
protected function _cleanAutoresponderExpiredCoupons()
|
992 |
+
{
|
993 |
$today = date('Y-m-d');
|
994 |
+
$reviewCouponFilter = array('like' => 'Review coupon%');
|
995 |
+
$birthdayCouponFilter = array('like' => 'Birthday coupon%');
|
996 |
|
997 |
$collection = Mage::getModel('salesrule/rule')->getCollection()
|
998 |
+
->addFieldToFilter('name', array($reviewCouponFilter, $birthdayCouponFilter))
|
999 |
+
->addFieldToFilter('to_date', array('lt' => $today));
|
1000 |
|
1001 |
foreach ($collection as $toDelete) {
|
1002 |
$toDelete->delete();
|
app/code/community/Ebizmarts/Autoresponder/Model/EventObserver.php
CHANGED
@@ -7,7 +7,6 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_Autoresponder_Model_EventObserver
|
12 |
{
|
13 |
/**
|
@@ -15,87 +14,86 @@ class Ebizmarts_Autoresponder_Model_EventObserver
|
|
15 |
*/
|
16 |
public function saveConfig(Varien_Event_Observer $o)
|
17 |
{
|
18 |
-
if(Mage::app()->getRequest()->getParam('store')) {
|
19 |
$scope = 'store';
|
20 |
-
}
|
21 |
-
elseif(Mage::app()->getRequest()->getParam('website')) {
|
22 |
$scope = 'website';
|
23 |
-
}
|
24 |
-
else {
|
25 |
$scope = "default";
|
26 |
}
|
27 |
-
$store
|
28 |
-
if(!Mage::helper('ebizmarts_mandrill')->useTransactionalService()) {
|
29 |
-
$config =
|
30 |
-
$config->saveConfig(Ebizmarts_Autoresponder_Model_Config::GENERAL_ACTIVE,false
|
31 |
Mage::getConfig()->cleanCache();
|
32 |
}
|
33 |
-
if(!Mage::helper('ebizmarts_mandrill')->useTransactionalService()) {
|
34 |
-
$config =
|
35 |
-
$config->saveConfig(Ebizmarts_AbandonedCart_Model_Config::ACTIVE,false
|
36 |
-
$config->saveConfig(Ebizmarts_AbandonedCart_Model_Config::ENABLE_POPUP,false
|
37 |
Mage::getConfig()->cleanCache();
|
38 |
}
|
39 |
-
if(!Mage::getStoreConfig('customer/address/dob_show')) {
|
40 |
-
$config =
|
41 |
-
$config->saveConfig(Ebizmarts_Autoresponder_Model_Config::BIRTHDAY_ACTIVE,false
|
42 |
Mage::getConfig()->cleanCache();
|
43 |
}
|
44 |
-
if(!Mage::getStoreConfig('customer/address/dob_show'
|
45 |
-
$config =
|
46 |
-
$config->saveConfig(Ebizmarts_Autoresponder_Model_Config::BIRTHDAY_ACTIVE,false
|
47 |
Mage::getConfig()->cleanCache();
|
48 |
}
|
49 |
-
if(Mage::getStoreConfig('advanced/modules_disable_output/Mage_Wishlist'
|
50 |
-
$config =
|
51 |
-
$config->saveConfig(Ebizmarts_Autoresponder_Model_Config::WISHLIST_ACTIVE,false
|
52 |
Mage::getConfig()->cleanCache();
|
53 |
}
|
54 |
-
if(Mage::getStoreConfig('advanced/modules_disable_output/Mage_Review'
|
55 |
-
$config =
|
56 |
-
$config->saveConfig(Ebizmarts_Autoresponder_Model_Config::REVIEW_ACTIVE,false
|
57 |
Mage::getConfig()->cleanCache();
|
58 |
}
|
59 |
}
|
|
|
60 |
public function actionAfter(Varien_Event_Observer $o)
|
61 |
{
|
62 |
-
if($o->getEvent()->getControllerAction()->getFullActionName() == 'review_product_post') {
|
63 |
Mage::dispatchEvent("review_product_post_after", array('request' => $o->getControllerAction()->getRequest()));
|
64 |
}
|
65 |
return $o;
|
66 |
}
|
|
|
67 |
public function reviewProductPostAfter(Varien_Event_Observer $o)
|
68 |
{
|
69 |
$params = Mage::app()->getRequest()->getParams();
|
70 |
$storeId = Mage::app()->getStore()->getId();
|
71 |
-
$customerGroupsCoupon = explode(",",Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::REVIEW_COUPON_CUSTOMER_GROUP, $storeId));
|
72 |
-
$templateId
|
73 |
-
$mailSubject
|
74 |
-
$tags
|
75 |
-
$senderId
|
76 |
-
$sender
|
77 |
|
78 |
-
if(isset($params['token'])) {
|
79 |
$token = $params['token'];
|
80 |
$reviewData = Mage::getModel('ebizmarts_autoresponder/review')->loadByToken($token);
|
81 |
-
if($this->_generateReviewCoupon($reviewData)) {
|
82 |
//generate coupon
|
83 |
$customer = Mage::getModel('customer/customer')->load($reviewData->getCustomerId());
|
84 |
$email = $customer->getEmail();
|
85 |
-
$name = $customer->getFirstname().' '
|
86 |
-
if(in_array($customer->getGroupId()
|
87 |
-
if(Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::REVIEW_COUPON_AUTOMATIC
|
88 |
-
list($couponcode
|
89 |
-
$vars = array('couponcode'
|
90 |
-
}
|
91 |
-
else {
|
92 |
$couponcode = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::REVIEW_COUPON_CODE);
|
93 |
-
$vars = array('couponcode'
|
94 |
}
|
95 |
$translate = Mage::getSingleton('core/translate');
|
96 |
-
$mail = Mage::getModel('core/email_template')->setTemplateSubject($mailSubject)->sendTransactional($templateId
|
97 |
$translate->setTranslateInLine(true);
|
98 |
-
Mage::helper('ebizmarts_abandonedcart')->saveMail('review coupon'
|
99 |
}
|
100 |
}
|
101 |
}
|
@@ -105,38 +103,38 @@ class Ebizmarts_Autoresponder_Model_EventObserver
|
|
105 |
protected function _generateReviewCoupon($reviewData)
|
106 |
{
|
107 |
$store = Mage::app()->getStore()->getId();
|
108 |
-
if(!Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::REVIEW_HAS_COUPON
|
109 |
return false;
|
110 |
}
|
111 |
$rc = false;
|
112 |
// check if is a registered customer if not, return false
|
113 |
-
if(!$reviewData->getCustomerId()) {
|
114 |
return false;
|
115 |
}
|
116 |
// if the customer is registered the counter is in the customer account, so load the customer
|
117 |
$customer = Mage::getModel('customer/customer')->load($reviewData->getCustomerId());
|
118 |
$couponTotal = $customer->getEbizmartsReviewsCouponTotal();
|
119 |
-
switch(Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::REVIEW_COUPON_COUNTER
|
120 |
case Ebizmarts_Autoresponder_Model_Config::COUPON_GENERAL:
|
121 |
// update the counter
|
122 |
$counter = $customer->getEbizmartsReviewsCntrTotal();
|
123 |
$counter++;
|
124 |
$customer->setEbizmartsReviewsCntrTotal($counter)->save();
|
125 |
// check if coupon must be generated
|
126 |
-
$generalQuantity = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::REVIEW_COUPON_GENERAL_QUANTITY
|
127 |
-
switch(Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::REVIEW_COUPON_GENERAL_TYPE)) {
|
128 |
case Ebizmarts_Autoresponder_Model_Config::TYPE_EACH:
|
129 |
-
if($counter
|
130 |
$rc = true;
|
131 |
}
|
132 |
break;
|
133 |
case Ebizmarts_Autoresponder_Model_Config::TYPE_ONCE:
|
134 |
-
if($counter
|
135 |
$rc = true;
|
136 |
}
|
137 |
break;
|
138 |
case Ebizmarts_Autoresponder_Model_Config::TYPE_SPECIFIC:
|
139 |
-
if($counter
|
140 |
$rc = true;
|
141 |
}
|
142 |
break;
|
@@ -147,58 +145,53 @@ class Ebizmarts_Autoresponder_Model_EventObserver
|
|
147 |
$counter = $reviewData->getCounter();
|
148 |
$counter++;
|
149 |
$reviewData->setCounter($counter)->save();
|
150 |
-
if(Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::REVIEW_COUPON_ORDER_MAX) != 0 && $couponTotal >= Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::REVIEW_COUPON_ORDER_MAX)) {
|
151 |
$rc = false;
|
152 |
-
}
|
153 |
-
|
154 |
-
|
155 |
-
if($counter == $reviewData->getItems()) {
|
156 |
$rc = true;
|
157 |
-
}
|
158 |
-
else {
|
159 |
$rc = false;
|
160 |
}
|
161 |
-
}
|
162 |
-
|
163 |
-
if($reviewData->getItems() >= Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::REVIEW_COUPON_ORDER_ALMOST,$store)) {
|
164 |
$rc = true;
|
165 |
-
}
|
166 |
-
else {
|
167 |
$rc = false;
|
168 |
}
|
169 |
}
|
170 |
}
|
171 |
break;
|
172 |
}
|
173 |
-
if($rc) { // increase the count of coupons in the customer
|
174 |
-
$customer->setEbizmartsReviewsCouponTotal($couponTotal+1)->save();
|
175 |
}
|
176 |
return $rc;
|
177 |
}
|
178 |
|
179 |
-
protected function _createNewCoupon($store
|
180 |
{
|
181 |
$couponamount = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::REVIEW_COUPON_DISCOUNT, $store);
|
182 |
$couponexpiredays = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::REVIEW_COUPON_EXPIRE, $store);
|
183 |
$coupontype = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::REVIEW_COUPON_DISCOUNT_TYPE, $store);
|
184 |
$couponlength = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::REVIEW_COUPON_LENGTH, $store);
|
185 |
$couponlabel = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::REVIEW_COUPON_LABEL, $store);
|
186 |
-
$websiteid =
|
187 |
|
188 |
$fromDate = date("Y-m-d");
|
189 |
-
$toDate = date('Y-m-d', strtotime($fromDate. " + $couponexpiredays day"));
|
190 |
-
if($coupontype == 1) {
|
191 |
$action = 'cart_fixed';
|
192 |
-
$discount = Mage::app()->getStore($store)->getCurrentCurrencyCode()."$couponamount";
|
193 |
-
}
|
194 |
-
elseif($coupontype == 2) {
|
195 |
$action = 'by_percent';
|
196 |
$discount = "$couponamount%";
|
197 |
}
|
198 |
$customer_group = new Mage_Customer_Model_Group();
|
199 |
-
$allGroups
|
200 |
$groups = array();
|
201 |
-
foreach($allGroups as $groupid
|
202 |
$groups[] = $groupid;
|
203 |
}
|
204 |
$coupon_rule = Mage::getModel('salesrule/rule');
|
@@ -227,10 +220,11 @@ class Ebizmarts_Autoresponder_Model_EventObserver
|
|
227 |
$uniqueId = Mage::getSingleton('salesrule/coupon_codegenerator', array('length' => $couponlength))->generateCode();
|
228 |
$coupon_rule->setCouponCode($uniqueId);
|
229 |
$coupon_rule->save();
|
230 |
-
return array($uniqueId
|
231 |
}
|
232 |
|
233 |
-
public function orderSaved(Varien_Event_Observer $observer)
|
|
|
234 |
$storeId = $observer->getEvent()->getOrder()->getStoreId();
|
235 |
|
236 |
$original_data = $observer->getEvent()->getData('data_object')->getOrigData();
|
@@ -238,24 +232,24 @@ class Ebizmarts_Autoresponder_Model_EventObserver
|
|
238 |
|
239 |
$order = $observer->getEvent()->getOrder();
|
240 |
|
241 |
-
if (isset($new_data['status']) && isset($original_data['status']) !== $new_data['status'] && $new_data['status'] == Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::NEWORDER_ORDER_STATUS, $storeId)) {
|
242 |
-
if(Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::NEWORDER_ACTIVE, $storeId) && Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::NEWORDER_TRIGGER, $storeId) == 1){
|
243 |
-
$tags
|
244 |
-
$mailSubject
|
245 |
-
$senderId
|
246 |
-
$sender
|
247 |
-
$templateId
|
248 |
|
249 |
//Send email
|
250 |
$translate = Mage::getSingleton('core/translate');
|
251 |
$email = $order->getCustomerEmail();
|
252 |
-
if(Mage::helper('ebizmarts_autoresponder')->isSubscribed($email,'neworder'
|
253 |
-
$name = $order->getCustomerFirstname().' '
|
254 |
-
$url = Mage::getModel('core/url')->setStore($storeId)->getUrl().'ebizautoresponder/autoresponder/unsubscribe?list=neworder&email='
|
255 |
-
$vars = array('tags'=>array($tags),'url'
|
256 |
-
$mail = Mage::getModel('core/email_template')->setTemplateSubject($mailSubject)->sendTransactional($templateId
|
257 |
$translate->setTranslateInLine(true);
|
258 |
-
Mage::helper('ebizmarts_abandonedcart')->saveMail('new order'
|
259 |
}
|
260 |
}
|
261 |
}
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_Autoresponder_Model_EventObserver
|
11 |
{
|
12 |
/**
|
14 |
*/
|
15 |
public function saveConfig(Varien_Event_Observer $o)
|
16 |
{
|
17 |
+
if (Mage::app()->getRequest()->getParam('store')) {
|
18 |
$scope = 'store';
|
19 |
+
} elseif (Mage::app()->getRequest()->getParam('website')) {
|
|
|
20 |
$scope = 'website';
|
21 |
+
} else {
|
|
|
22 |
$scope = "default";
|
23 |
}
|
24 |
+
$store = is_null($o->getEvent()->getStore()) ? Mage::app()->getDefaultStoreView()->getCode() : $o->getEvent()->getStore();
|
25 |
+
if (!Mage::helper('ebizmarts_mandrill')->useTransactionalService()) {
|
26 |
+
$config = new Mage_Core_Model_Config();
|
27 |
+
$config->saveConfig(Ebizmarts_Autoresponder_Model_Config::GENERAL_ACTIVE, false, $scope, $store);
|
28 |
Mage::getConfig()->cleanCache();
|
29 |
}
|
30 |
+
if (!Mage::helper('ebizmarts_mandrill')->useTransactionalService()) {
|
31 |
+
$config = new Mage_Core_Model_Config();
|
32 |
+
$config->saveConfig(Ebizmarts_AbandonedCart_Model_Config::ACTIVE, false, $scope, $store);
|
33 |
+
$config->saveConfig(Ebizmarts_AbandonedCart_Model_Config::ENABLE_POPUP, false, $scope, $store);
|
34 |
Mage::getConfig()->cleanCache();
|
35 |
}
|
36 |
+
if (!Mage::getStoreConfig('customer/address/dob_show')) {
|
37 |
+
$config = new Mage_Core_Model_Config();
|
38 |
+
$config->saveConfig(Ebizmarts_Autoresponder_Model_Config::BIRTHDAY_ACTIVE, false, $scope, $store);
|
39 |
Mage::getConfig()->cleanCache();
|
40 |
}
|
41 |
+
if (!Mage::getStoreConfig('customer/address/dob_show', $store)) {
|
42 |
+
$config = new Mage_Core_Model_Config();
|
43 |
+
$config->saveConfig(Ebizmarts_Autoresponder_Model_Config::BIRTHDAY_ACTIVE, false, $scope, $store);
|
44 |
Mage::getConfig()->cleanCache();
|
45 |
}
|
46 |
+
if (Mage::getStoreConfig('advanced/modules_disable_output/Mage_Wishlist', $store)) {
|
47 |
+
$config = new Mage_Core_Model_Config();
|
48 |
+
$config->saveConfig(Ebizmarts_Autoresponder_Model_Config::WISHLIST_ACTIVE, false, $scope, $store);
|
49 |
Mage::getConfig()->cleanCache();
|
50 |
}
|
51 |
+
if (Mage::getStoreConfig('advanced/modules_disable_output/Mage_Review', $store)) {
|
52 |
+
$config = new Mage_Core_Model_Config();
|
53 |
+
$config->saveConfig(Ebizmarts_Autoresponder_Model_Config::REVIEW_ACTIVE, false, $scope, $store);
|
54 |
Mage::getConfig()->cleanCache();
|
55 |
}
|
56 |
}
|
57 |
+
|
58 |
public function actionAfter(Varien_Event_Observer $o)
|
59 |
{
|
60 |
+
if ($o->getEvent()->getControllerAction()->getFullActionName() == 'review_product_post') {
|
61 |
Mage::dispatchEvent("review_product_post_after", array('request' => $o->getControllerAction()->getRequest()));
|
62 |
}
|
63 |
return $o;
|
64 |
}
|
65 |
+
|
66 |
public function reviewProductPostAfter(Varien_Event_Observer $o)
|
67 |
{
|
68 |
$params = Mage::app()->getRequest()->getParams();
|
69 |
$storeId = Mage::app()->getStore()->getId();
|
70 |
+
$customerGroupsCoupon = explode(",", Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::REVIEW_COUPON_CUSTOMER_GROUP, $storeId));
|
71 |
+
$templateId = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::REVIEW_COUPON_EMAIL, $storeId);
|
72 |
+
$mailSubject = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::REVIEW_COUPON_SUBJECT, $storeId);
|
73 |
+
$tags = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::REVIEW_COUPON_MANDRILL_TAG, $storeId) . "_$storeId";
|
74 |
+
$senderId = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::GENERAL_SENDER, $storeId);
|
75 |
+
$sender = array('name' => Mage::getStoreConfig("trans_email/ident_$senderId/name", $storeId), 'email' => Mage::getStoreConfig("trans_email/ident_$senderId/email", $storeId));
|
76 |
|
77 |
+
if (isset($params['token'])) {
|
78 |
$token = $params['token'];
|
79 |
$reviewData = Mage::getModel('ebizmarts_autoresponder/review')->loadByToken($token);
|
80 |
+
if ($this->_generateReviewCoupon($reviewData)) {
|
81 |
//generate coupon
|
82 |
$customer = Mage::getModel('customer/customer')->load($reviewData->getCustomerId());
|
83 |
$email = $customer->getEmail();
|
84 |
+
$name = $customer->getFirstname() . ' ' . $customer->getLastname();
|
85 |
+
if (in_array($customer->getGroupId(), $customerGroupsCoupon)) {
|
86 |
+
if (Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::REVIEW_COUPON_AUTOMATIC, $storeId) == Ebizmarts_Autoresponder_Model_Config::COUPON_AUTOMATIC) {
|
87 |
+
list($couponcode, $discount, $toDate) = $this->_createNewCoupon($storeId, $email);
|
88 |
+
$vars = array('couponcode' => $couponcode, 'discount' => $discount, 'todate' => $toDate, 'name' => $name, 'tags' => array($tags));
|
89 |
+
} else {
|
|
|
90 |
$couponcode = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::REVIEW_COUPON_CODE);
|
91 |
+
$vars = array('couponcode' => $couponcode, 'name' => $name, 'tags' => array($tags));
|
92 |
}
|
93 |
$translate = Mage::getSingleton('core/translate');
|
94 |
+
$mail = Mage::getModel('core/email_template')->setTemplateSubject($mailSubject)->sendTransactional($templateId, $sender, $email, $name, $vars, $storeId);
|
95 |
$translate->setTranslateInLine(true);
|
96 |
+
Mage::helper('ebizmarts_abandonedcart')->saveMail('review coupon', $email, $name, $couponcode, $storeId);
|
97 |
}
|
98 |
}
|
99 |
}
|
103 |
protected function _generateReviewCoupon($reviewData)
|
104 |
{
|
105 |
$store = Mage::app()->getStore()->getId();
|
106 |
+
if (!Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::REVIEW_HAS_COUPON, $store)) {
|
107 |
return false;
|
108 |
}
|
109 |
$rc = false;
|
110 |
// check if is a registered customer if not, return false
|
111 |
+
if (!$reviewData->getCustomerId()) {
|
112 |
return false;
|
113 |
}
|
114 |
// if the customer is registered the counter is in the customer account, so load the customer
|
115 |
$customer = Mage::getModel('customer/customer')->load($reviewData->getCustomerId());
|
116 |
$couponTotal = $customer->getEbizmartsReviewsCouponTotal();
|
117 |
+
switch (Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::REVIEW_COUPON_COUNTER, $store)) {
|
118 |
case Ebizmarts_Autoresponder_Model_Config::COUPON_GENERAL:
|
119 |
// update the counter
|
120 |
$counter = $customer->getEbizmartsReviewsCntrTotal();
|
121 |
$counter++;
|
122 |
$customer->setEbizmartsReviewsCntrTotal($counter)->save();
|
123 |
// check if coupon must be generated
|
124 |
+
$generalQuantity = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::REVIEW_COUPON_GENERAL_QUANTITY, $store);
|
125 |
+
switch (Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::REVIEW_COUPON_GENERAL_TYPE)) {
|
126 |
case Ebizmarts_Autoresponder_Model_Config::TYPE_EACH:
|
127 |
+
if ($counter && $counter % $generalQuantity) {
|
128 |
$rc = true;
|
129 |
}
|
130 |
break;
|
131 |
case Ebizmarts_Autoresponder_Model_Config::TYPE_ONCE:
|
132 |
+
if ($counter == $generalQuantity) {
|
133 |
$rc = true;
|
134 |
}
|
135 |
break;
|
136 |
case Ebizmarts_Autoresponder_Model_Config::TYPE_SPECIFIC:
|
137 |
+
if ($counter && $counter % $generalQuantity && $customer->getEbizmartsReviewsCouponTotal() <= Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::REVIEW_COUPON_SPECIFIC_QUANTITY)) {
|
138 |
$rc = true;
|
139 |
}
|
140 |
break;
|
145 |
$counter = $reviewData->getCounter();
|
146 |
$counter++;
|
147 |
$reviewData->setCounter($counter)->save();
|
148 |
+
if (Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::REVIEW_COUPON_ORDER_MAX) != 0 && $couponTotal >= Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::REVIEW_COUPON_ORDER_MAX)) {
|
149 |
$rc = false;
|
150 |
+
} else {
|
151 |
+
if (Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::REVIEW_COUPON_ORDER_COUNTER, $store) == 0) {
|
152 |
+
if ($counter == $reviewData->getItems()) {
|
|
|
153 |
$rc = true;
|
154 |
+
} else {
|
|
|
155 |
$rc = false;
|
156 |
}
|
157 |
+
} elseif (Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::REVIEW_COUPON_ORDER_COUNTER, $store) == $counter) {
|
158 |
+
if ($reviewData->getItems() >= Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::REVIEW_COUPON_ORDER_ALMOST, $store)) {
|
|
|
159 |
$rc = true;
|
160 |
+
} else {
|
|
|
161 |
$rc = false;
|
162 |
}
|
163 |
}
|
164 |
}
|
165 |
break;
|
166 |
}
|
167 |
+
if ($rc) { // increase the count of coupons in the customer
|
168 |
+
$customer->setEbizmartsReviewsCouponTotal($couponTotal + 1)->save();
|
169 |
}
|
170 |
return $rc;
|
171 |
}
|
172 |
|
173 |
+
protected function _createNewCoupon($store, $email)
|
174 |
{
|
175 |
$couponamount = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::REVIEW_COUPON_DISCOUNT, $store);
|
176 |
$couponexpiredays = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::REVIEW_COUPON_EXPIRE, $store);
|
177 |
$coupontype = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::REVIEW_COUPON_DISCOUNT_TYPE, $store);
|
178 |
$couponlength = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::REVIEW_COUPON_LENGTH, $store);
|
179 |
$couponlabel = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::REVIEW_COUPON_LABEL, $store);
|
180 |
+
$websiteid = Mage::getModel('core/store')->load($store)->getWebsiteId();
|
181 |
|
182 |
$fromDate = date("Y-m-d");
|
183 |
+
$toDate = date('Y-m-d', strtotime($fromDate . " + $couponexpiredays day"));
|
184 |
+
if ($coupontype == 1) {
|
185 |
$action = 'cart_fixed';
|
186 |
+
$discount = Mage::app()->getStore($store)->getCurrentCurrencyCode() . "$couponamount";
|
187 |
+
} elseif ($coupontype == 2) {
|
|
|
188 |
$action = 'by_percent';
|
189 |
$discount = "$couponamount%";
|
190 |
}
|
191 |
$customer_group = new Mage_Customer_Model_Group();
|
192 |
+
$allGroups = $customer_group->getCollection()->toOptionHash();
|
193 |
$groups = array();
|
194 |
+
foreach ($allGroups as $groupid => $name) {
|
195 |
$groups[] = $groupid;
|
196 |
}
|
197 |
$coupon_rule = Mage::getModel('salesrule/rule');
|
220 |
$uniqueId = Mage::getSingleton('salesrule/coupon_codegenerator', array('length' => $couponlength))->generateCode();
|
221 |
$coupon_rule->setCouponCode($uniqueId);
|
222 |
$coupon_rule->save();
|
223 |
+
return array($uniqueId, $discount, $toDate);
|
224 |
}
|
225 |
|
226 |
+
public function orderSaved(Varien_Event_Observer $observer)
|
227 |
+
{
|
228 |
$storeId = $observer->getEvent()->getOrder()->getStoreId();
|
229 |
|
230 |
$original_data = $observer->getEvent()->getData('data_object')->getOrigData();
|
232 |
|
233 |
$order = $observer->getEvent()->getOrder();
|
234 |
|
235 |
+
if (isset($new_data['status']) && isset($original_data['status']) && $original_data['status'] !== $new_data['status'] && $new_data['status'] == Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::NEWORDER_ORDER_STATUS, $storeId)) {
|
236 |
+
if (Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::NEWORDER_ACTIVE, $storeId) && Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::NEWORDER_TRIGGER, $storeId) == 1) {
|
237 |
+
$tags = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::NEWORDER_MANDRILL_TAG, $storeId) . "_$storeId";
|
238 |
+
$mailSubject = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::NEWORDER_SUBJECT, $storeId);
|
239 |
+
$senderId = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::GENERAL_SENDER, $storeId);
|
240 |
+
$sender = array('name' => Mage::getStoreConfig("trans_email/ident_$senderId/name", $storeId), 'email' => Mage::getStoreConfig("trans_email/ident_$senderId/email", $storeId));
|
241 |
+
$templateId = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::NEWORDER_TEMPLATE, $storeId);
|
242 |
|
243 |
//Send email
|
244 |
$translate = Mage::getSingleton('core/translate');
|
245 |
$email = $order->getCustomerEmail();
|
246 |
+
if (Mage::helper('ebizmarts_autoresponder')->isSubscribed($email, 'neworder', $storeId)) {
|
247 |
+
$name = $order->getCustomerFirstname() . ' ' . $order->getCustomerLastname();
|
248 |
+
$url = Mage::getModel('core/url')->setStore($storeId)->getUrl() . 'ebizautoresponder/autoresponder/unsubscribe?list=neworder&email=' . $email . '&store=' . $storeId;
|
249 |
+
$vars = array('tags' => array($tags), 'url' => $url);
|
250 |
+
$mail = Mage::getModel('core/email_template')->setTemplateSubject($mailSubject)->sendTransactional($templateId, $sender, $email, $name, $vars, $storeId);
|
251 |
$translate->setTranslateInLine(true);
|
252 |
+
Mage::helper('ebizmarts_abandonedcart')->saveMail('new order', $email, $name, "", $storeId);
|
253 |
}
|
254 |
}
|
255 |
}
|
app/code/community/Ebizmarts/Autoresponder/Model/Resource/Backtostock.php
CHANGED
@@ -7,12 +7,11 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_Autoresponder_Model_Resource_Backtostock extends Mage_Core_Model_Mysql4_Abstract
|
12 |
{
|
13 |
public function _construct()
|
14 |
{
|
15 |
-
$this->_init('ebizmarts_autoresponder/backtostock','backtostock_id');
|
16 |
}
|
17 |
|
18 |
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_Autoresponder_Model_Resource_Backtostock extends Mage_Core_Model_Mysql4_Abstract
|
11 |
{
|
12 |
public function _construct()
|
13 |
{
|
14 |
+
$this->_init('ebizmarts_autoresponder/backtostock', 'backtostock_id');
|
15 |
}
|
16 |
|
17 |
|
app/code/community/Ebizmarts/Autoresponder/Model/Resource/Backtostock/Collection.php
CHANGED
@@ -7,7 +7,6 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_Autoresponder_Model_Resource_Backtostock_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
12 |
{
|
13 |
protected function _construct()
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_Autoresponder_Model_Resource_Backtostock_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
11 |
{
|
12 |
protected function _construct()
|
app/code/community/Ebizmarts/Autoresponder/Model/Resource/Backtostockalert.php
CHANGED
@@ -7,12 +7,11 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_Autoresponder_Model_Resource_Backtostockalert extends Mage_Core_Model_Mysql4_Abstract
|
12 |
{
|
13 |
public function _construct()
|
14 |
{
|
15 |
-
$this->_init('ebizmarts_autoresponder/backtostockalert','alert_id');
|
16 |
}
|
17 |
|
18 |
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_Autoresponder_Model_Resource_Backtostockalert extends Mage_Core_Model_Mysql4_Abstract
|
11 |
{
|
12 |
public function _construct()
|
13 |
{
|
14 |
+
$this->_init('ebizmarts_autoresponder/backtostockalert', 'alert_id');
|
15 |
}
|
16 |
|
17 |
|
app/code/community/Ebizmarts/Autoresponder/Model/Resource/Backtostockalert/Collection.php
CHANGED
@@ -7,7 +7,6 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_Autoresponder_Model_Resource_Backtostockalert_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
12 |
{
|
13 |
protected function _construct()
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_Autoresponder_Model_Resource_Backtostockalert_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
11 |
{
|
12 |
protected function _construct()
|
app/code/community/Ebizmarts/Autoresponder/Model/Resource/Review.php
CHANGED
@@ -7,20 +7,21 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_Autoresponder_Model_Resource_Review extends Mage_Core_Model_Mysql4_Abstract
|
12 |
{
|
13 |
public function _construct()
|
14 |
{
|
15 |
-
$this->_init('ebizmarts_autoresponder/review','id');
|
16 |
}
|
17 |
-
|
|
|
|
|
18 |
$select = $this->_getReadAdapter()->select()
|
19 |
->from($this->getMainTable())
|
20 |
-
->where($this->getMainTable().'.'.'token =?'
|
21 |
$token_id = $this->_getReadAdapter()->fetchOne($select);
|
22 |
-
if($token_id) {
|
23 |
-
$this->load($obj
|
24 |
}
|
25 |
return $this;
|
26 |
}
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_Autoresponder_Model_Resource_Review extends Mage_Core_Model_Mysql4_Abstract
|
11 |
{
|
12 |
public function _construct()
|
13 |
{
|
14 |
+
$this->_init('ebizmarts_autoresponder/review', 'id');
|
15 |
}
|
16 |
+
|
17 |
+
public function loadByToken(Ebizmarts_Autoresponder_Model_Review $obj, $token)
|
18 |
+
{
|
19 |
$select = $this->_getReadAdapter()->select()
|
20 |
->from($this->getMainTable())
|
21 |
+
->where($this->getMainTable() . '.' . 'token =?', $token);
|
22 |
$token_id = $this->_getReadAdapter()->fetchOne($select);
|
23 |
+
if ($token_id) {
|
24 |
+
$this->load($obj, $token_id);
|
25 |
}
|
26 |
return $this;
|
27 |
}
|
app/code/community/Ebizmarts/Autoresponder/Model/Resource/Review/Collection.php
CHANGED
@@ -7,7 +7,6 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_Autoresponder_Model_Resource_Review_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
12 |
{
|
13 |
protected function _construct()
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_Autoresponder_Model_Resource_Review_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
11 |
{
|
12 |
protected function _construct()
|
app/code/community/Ebizmarts/Autoresponder/Model/Resource/Unsubscribe.php
CHANGED
@@ -7,12 +7,11 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_Autoresponder_Model_Resource_Unsubscribe extends Mage_Core_Model_Mysql4_Abstract
|
12 |
{
|
13 |
public function _construct()
|
14 |
{
|
15 |
-
$this->_init('ebizmarts_autoresponder/unsubscribe','id');
|
16 |
}
|
17 |
|
18 |
}
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_Autoresponder_Model_Resource_Unsubscribe extends Mage_Core_Model_Mysql4_Abstract
|
11 |
{
|
12 |
public function _construct()
|
13 |
{
|
14 |
+
$this->_init('ebizmarts_autoresponder/unsubscribe', 'id');
|
15 |
}
|
16 |
|
17 |
}
|
app/code/community/Ebizmarts/Autoresponder/Model/Resource/Unsubscribe/Collection.php
CHANGED
@@ -7,7 +7,6 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_Autoresponder_Model_Resource_Unsubscribe_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
12 |
{
|
13 |
protected function _construct()
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_Autoresponder_Model_Resource_Unsubscribe_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
11 |
{
|
12 |
protected function _construct()
|
app/code/community/Ebizmarts/Autoresponder/Model/Resource/Visited.php
CHANGED
@@ -7,22 +7,23 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_Autoresponder_Model_Resource_Visited extends Mage_Core_Model_Mysql4_Abstract
|
12 |
{
|
13 |
public function _construct()
|
14 |
{
|
15 |
-
$this->_init('ebizmarts_autoresponder/visited','id');
|
16 |
}
|
17 |
-
|
|
|
|
|
18 |
$select = $this->_getReadAdapter()->select()
|
19 |
->from($this->getMainTable())
|
20 |
-
->where($this->getMainTable().'.'.'customer_id =?'
|
21 |
-
->where($this->getMainTable().'.'.'product_id =?'
|
22 |
-
->where($this->getMainTable().'.'.'store_id =?'
|
23 |
$visited_id = $this->_getReadAdapter()->fetchOne($select);
|
24 |
-
if($visited_id) {
|
25 |
-
$this->load($obj
|
26 |
}
|
27 |
return $this;
|
28 |
}
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_Autoresponder_Model_Resource_Visited extends Mage_Core_Model_Mysql4_Abstract
|
11 |
{
|
12 |
public function _construct()
|
13 |
{
|
14 |
+
$this->_init('ebizmarts_autoresponder/visited', 'id');
|
15 |
}
|
16 |
+
|
17 |
+
public function loadByCustomerProduct(Ebizmarts_Autoresponder_Model_Visited $obj, $customerId, $productId, $storeId)
|
18 |
+
{
|
19 |
$select = $this->_getReadAdapter()->select()
|
20 |
->from($this->getMainTable())
|
21 |
+
->where($this->getMainTable() . '.' . 'customer_id =?', $customerId)
|
22 |
+
->where($this->getMainTable() . '.' . 'product_id =?', $productId)
|
23 |
+
->where($this->getMainTable() . '.' . 'store_id =?', $storeId);
|
24 |
$visited_id = $this->_getReadAdapter()->fetchOne($select);
|
25 |
+
if ($visited_id) {
|
26 |
+
$this->load($obj, $visited_id);
|
27 |
}
|
28 |
return $this;
|
29 |
}
|
app/code/community/Ebizmarts/Autoresponder/Model/Resource/Visited/Collection.php
CHANGED
@@ -7,7 +7,6 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_Autoresponder_Model_Resource_Visited_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
12 |
{
|
13 |
protected function _construct()
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_Autoresponder_Model_Resource_Visited_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
11 |
{
|
12 |
protected function _construct()
|
app/code/community/Ebizmarts/Autoresponder/Model/Review.php
CHANGED
@@ -7,14 +7,16 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_Autoresponder_Model_Review extends Mage_Core_Model_Abstract
|
12 |
{
|
13 |
-
public function _construct()
|
|
|
14 |
$this->_init('ebizmarts_autoresponder/review');
|
15 |
}
|
16 |
-
|
17 |
-
|
|
|
|
|
18 |
return $this;
|
19 |
}
|
20 |
}
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_Autoresponder_Model_Review extends Mage_Core_Model_Abstract
|
11 |
{
|
12 |
+
public function _construct()
|
13 |
+
{
|
14 |
$this->_init('ebizmarts_autoresponder/review');
|
15 |
}
|
16 |
+
|
17 |
+
public function loadByToken($token)
|
18 |
+
{
|
19 |
+
$this->_getResource()->loadByToken($this, $token);
|
20 |
return $this;
|
21 |
}
|
22 |
}
|
app/code/community/Ebizmarts/Autoresponder/Model/System/Config/Automatic.php
CHANGED
@@ -7,7 +7,6 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_Autoresponder_Model_System_Config_Automatic
|
12 |
{
|
13 |
/**
|
@@ -16,8 +15,8 @@ class Ebizmarts_Autoresponder_Model_System_Config_Automatic
|
|
16 |
public function toOptionArray()
|
17 |
{
|
18 |
$options = array(
|
19 |
-
array('value'=> 1, 'label' => Mage::helper('ebizmarts_autoresponder')->__('Specific')),
|
20 |
-
array('value'=> 2, 'label' => Mage::helper('ebizmarts_autoresponder')->__('Automatic'))
|
21 |
);
|
22 |
return $options;
|
23 |
}
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_Autoresponder_Model_System_Config_Automatic
|
11 |
{
|
12 |
/**
|
15 |
public function toOptionArray()
|
16 |
{
|
17 |
$options = array(
|
18 |
+
array('value' => 1, 'label' => Mage::helper('ebizmarts_autoresponder')->__('Specific')),
|
19 |
+
array('value' => 2, 'label' => Mage::helper('ebizmarts_autoresponder')->__('Automatic'))
|
20 |
);
|
21 |
return $options;
|
22 |
}
|
app/code/community/Ebizmarts/Autoresponder/Model/System/Config/Couponcounter.php
CHANGED
@@ -7,14 +7,13 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_Autoresponder_Model_System_Config_Couponcounter
|
12 |
{
|
13 |
public function toOptionArray()
|
14 |
{
|
15 |
$options = array(
|
16 |
-
array('value'=> Ebizmarts_Autoresponder_Model_Config::COUPON_PER_ORDER, 'label' => Mage::helper('ebizmarts_abandonedcart')->__('Per Order')),
|
17 |
-
array('value'=> Ebizmarts_Autoresponder_Model_Config::COUPON_GENERAL, 'label' => Mage::helper('ebizmarts_abandonedcart')->__('General'))
|
18 |
);
|
19 |
return $options;
|
20 |
}
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_Autoresponder_Model_System_Config_Couponcounter
|
11 |
{
|
12 |
public function toOptionArray()
|
13 |
{
|
14 |
$options = array(
|
15 |
+
array('value' => Ebizmarts_Autoresponder_Model_Config::COUPON_PER_ORDER, 'label' => Mage::helper('ebizmarts_abandonedcart')->__('Per Order')),
|
16 |
+
array('value' => Ebizmarts_Autoresponder_Model_Config::COUPON_GENERAL, 'label' => Mage::helper('ebizmarts_abandonedcart')->__('General'))
|
17 |
);
|
18 |
return $options;
|
19 |
}
|
app/code/community/Ebizmarts/Autoresponder/Model/System/Config/Customergroup.php
CHANGED
@@ -7,7 +7,6 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_Autoresponder_Model_System_Config_Customergroup
|
12 |
{
|
13 |
protected $_options;
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_Autoresponder_Model_System_Config_Customergroup
|
11 |
{
|
12 |
protected $_options;
|
app/code/community/Ebizmarts/Autoresponder/Model/System/Config/Discounttype.php
CHANGED
@@ -7,7 +7,6 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_Autoresponder_Model_System_Config_Discounttype
|
12 |
{
|
13 |
/**
|
@@ -16,8 +15,8 @@ class Ebizmarts_Autoresponder_Model_System_Config_Discounttype
|
|
16 |
public function toOptionArray()
|
17 |
{
|
18 |
$options = array(
|
19 |
-
array('value'=> 1, 'label' => Mage::helper('ebizmarts_abandonedcart')->__('Fixed amount')),
|
20 |
-
array('value'=> 2, 'label' => Mage::helper('ebizmarts_abandonedcart')->__('Percentage'))
|
21 |
);
|
22 |
return $options;
|
23 |
}
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_Autoresponder_Model_System_Config_Discounttype
|
11 |
{
|
12 |
/**
|
15 |
public function toOptionArray()
|
16 |
{
|
17 |
$options = array(
|
18 |
+
array('value' => 1, 'label' => Mage::helper('ebizmarts_abandonedcart')->__('Fixed amount')),
|
19 |
+
array('value' => 2, 'label' => Mage::helper('ebizmarts_abandonedcart')->__('Percentage'))
|
20 |
);
|
21 |
return $options;
|
22 |
}
|
app/code/community/Ebizmarts/Autoresponder/Model/System/Config/Generaltype.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
*
|
4 |
* @category Ebizmarts
|
@@ -6,15 +7,14 @@
|
|
6 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
7 |
* @license http://opensource.org/licenses/osl-3.0.php
|
8 |
*/
|
9 |
-
|
10 |
class Ebizmarts_Autoresponder_Model_System_Config_Generaltype
|
11 |
{
|
12 |
public function toOptionArray()
|
13 |
{
|
14 |
$options = array(
|
15 |
-
array('value'=> Ebizmarts_Autoresponder_Model_Config::TYPE_EACH, 'label' => Mage::helper('ebizmarts_abandonedcart')->__('Each')),
|
16 |
-
array('value'=> Ebizmarts_Autoresponder_Model_Config::TYPE_ONCE, 'label' => Mage::helper('ebizmarts_abandonedcart')->__('Only once')),
|
17 |
-
array('value'=> Ebizmarts_Autoresponder_Model_Config::TYPE_SPECIFIC, 'label' => Mage::helper('ebizmarts_abandonedcart')->__('Specific'))
|
18 |
);
|
19 |
return $options;
|
20 |
}
|
1 |
<?php
|
2 |
+
|
3 |
/**
|
4 |
*
|
5 |
* @category Ebizmarts
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_Autoresponder_Model_System_Config_Generaltype
|
11 |
{
|
12 |
public function toOptionArray()
|
13 |
{
|
14 |
$options = array(
|
15 |
+
array('value' => Ebizmarts_Autoresponder_Model_Config::TYPE_EACH, 'label' => Mage::helper('ebizmarts_abandonedcart')->__('Each')),
|
16 |
+
array('value' => Ebizmarts_Autoresponder_Model_Config::TYPE_ONCE, 'label' => Mage::helper('ebizmarts_abandonedcart')->__('Only once')),
|
17 |
+
array('value' => Ebizmarts_Autoresponder_Model_Config::TYPE_SPECIFIC, 'label' => Mage::helper('ebizmarts_abandonedcart')->__('Specific'))
|
18 |
);
|
19 |
return $options;
|
20 |
}
|
app/code/community/Ebizmarts/Autoresponder/Model/System/Config/Hours.php
CHANGED
@@ -5,8 +5,8 @@ class Ebizmarts_Autoresponder_Model_System_Config_Hours
|
|
5 |
public function toOptionArray()
|
6 |
{
|
7 |
$options = array();
|
8 |
-
for($i = 0; $i < 24; $i++){
|
9 |
-
$options[]=array('value'=> $i, 'label' => $i);
|
10 |
}
|
11 |
return $options;
|
12 |
}
|
5 |
public function toOptionArray()
|
6 |
{
|
7 |
$options = array();
|
8 |
+
for ($i = 0; $i < 24; $i++) {
|
9 |
+
$options[] = array('value' => $i, 'label' => $i);
|
10 |
}
|
11 |
return $options;
|
12 |
}
|
app/code/community/Ebizmarts/Autoresponder/Model/System/Config/Newordertrigger.php
CHANGED
@@ -7,7 +7,6 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_Autoresponder_Model_System_Config_Newordertrigger
|
12 |
{
|
13 |
protected $_options;
|
@@ -15,9 +14,9 @@ class Ebizmarts_Autoresponder_Model_System_Config_Newordertrigger
|
|
15 |
public function toOptionArray()
|
16 |
{
|
17 |
$this->_options = array(
|
18 |
-
array('value'=> 0, 'label' => 'Days after order'),
|
19 |
-
array('value'=> 1, 'label' => 'Order status'),
|
20 |
-
array('value'=> 2, 'label' => 'Days after order status changed to')
|
21 |
);
|
22 |
return $this->_options;
|
23 |
}
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_Autoresponder_Model_System_Config_Newordertrigger
|
11 |
{
|
12 |
protected $_options;
|
14 |
public function toOptionArray()
|
15 |
{
|
16 |
$this->_options = array(
|
17 |
+
array('value' => 0, 'label' => 'Days after order'),
|
18 |
+
array('value' => 1, 'label' => 'Order status'),
|
19 |
+
array('value' => 2, 'label' => 'Days after order status changed to')
|
20 |
);
|
21 |
return $this->_options;
|
22 |
}
|
app/code/community/Ebizmarts/Autoresponder/Model/System/Config/Time.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
*
|
4 |
* @category Ebizmarts
|
@@ -6,7 +7,6 @@
|
|
6 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
7 |
* @license http://opensource.org/licenses/osl-3.0.php
|
8 |
*/
|
9 |
-
|
10 |
class Ebizmarts_Autoresponder_Model_System_Config_Time
|
11 |
{
|
12 |
/**
|
@@ -15,13 +15,13 @@ class Ebizmarts_Autoresponder_Model_System_Config_Time
|
|
15 |
public function toOptionArray()
|
16 |
{
|
17 |
$options = array(
|
18 |
-
array('value'=> 0, 'label' => Mage::helper('ebizmarts_autoresponder')->__('Immediate')),
|
19 |
-
array('value'=> 2, 'label' => Mage::helper('ebizmarts_autoresponder')->__('2 seconds')),
|
20 |
-
array('value'=> 5, 'label' => Mage::helper('ebizmarts_autoresponder')->__('5 seconds')),
|
21 |
-
array('value'=> 10, 'label' => Mage::helper('ebizmarts_autoresponder')->__('10 seconds')),
|
22 |
-
array('value'=> 20, 'label' => Mage::helper('ebizmarts_autoresponder')->__('20 seconds')),
|
23 |
-
array('value'=> 30, 'label' => Mage::helper('ebizmarts_autoresponder')->__('30 seconds')),
|
24 |
-
array('value'=> 60, 'label' => Mage::helper('ebizmarts_autoresponder')->__('1 minute')),
|
25 |
);
|
26 |
return $options;
|
27 |
}
|
1 |
<?php
|
2 |
+
|
3 |
/**
|
4 |
*
|
5 |
* @category Ebizmarts
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_Autoresponder_Model_System_Config_Time
|
11 |
{
|
12 |
/**
|
15 |
public function toOptionArray()
|
16 |
{
|
17 |
$options = array(
|
18 |
+
array('value' => 0, 'label' => Mage::helper('ebizmarts_autoresponder')->__('Immediate')),
|
19 |
+
array('value' => 2, 'label' => Mage::helper('ebizmarts_autoresponder')->__('2 seconds')),
|
20 |
+
array('value' => 5, 'label' => Mage::helper('ebizmarts_autoresponder')->__('5 seconds')),
|
21 |
+
array('value' => 10, 'label' => Mage::helper('ebizmarts_autoresponder')->__('10 seconds')),
|
22 |
+
array('value' => 20, 'label' => Mage::helper('ebizmarts_autoresponder')->__('20 seconds')),
|
23 |
+
array('value' => 30, 'label' => Mage::helper('ebizmarts_autoresponder')->__('30 seconds')),
|
24 |
+
array('value' => 60, 'label' => Mage::helper('ebizmarts_autoresponder')->__('1 minute')),
|
25 |
);
|
26 |
return $options;
|
27 |
}
|
app/code/community/Ebizmarts/Autoresponder/Model/Unsubscribe.php
CHANGED
@@ -7,10 +7,10 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_Autoresponder_Model_Unsubscribe extends Mage_Core_Model_Abstract
|
12 |
{
|
13 |
-
public function _construct()
|
|
|
14 |
$this->_init('ebizmarts_autoresponder/unsubscribe');
|
15 |
}
|
16 |
}
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_Autoresponder_Model_Unsubscribe extends Mage_Core_Model_Abstract
|
11 |
{
|
12 |
+
public function _construct()
|
13 |
+
{
|
14 |
$this->_init('ebizmarts_autoresponder/unsubscribe');
|
15 |
}
|
16 |
}
|
app/code/community/Ebizmarts/Autoresponder/Model/Visited.php
CHANGED
@@ -7,14 +7,16 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_Autoresponder_Model_Visited extends Mage_Core_Model_Abstract
|
12 |
{
|
13 |
-
public function _construct()
|
|
|
14 |
$this->_init('ebizmarts_autoresponder/visited');
|
15 |
}
|
16 |
-
|
17 |
-
|
|
|
|
|
18 |
return $this;
|
19 |
}
|
20 |
}
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_Autoresponder_Model_Visited extends Mage_Core_Model_Abstract
|
11 |
{
|
12 |
+
public function _construct()
|
13 |
+
{
|
14 |
$this->_init('ebizmarts_autoresponder/visited');
|
15 |
}
|
16 |
+
|
17 |
+
public function loadByCustomerProduct($customerId, $productId, $storeId)
|
18 |
+
{
|
19 |
+
$this->_getResource()->loadByCustomerProduct($this, $customerId, $productId, $storeId);
|
20 |
return $this;
|
21 |
}
|
22 |
}
|
app/code/community/Ebizmarts/Autoresponder/controllers/AutoresponderController.php
CHANGED
@@ -7,12 +7,11 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_Autoresponder_AutoresponderController extends Mage_Core_Controller_Front_Action
|
12 |
{
|
13 |
public function indexAction()
|
14 |
{
|
15 |
-
if(!Mage::helper('customer')->isLoggedIn()) {
|
16 |
$this->_redirect('/');
|
17 |
}
|
18 |
$this->loadLayout();
|
@@ -23,27 +22,30 @@ class Ebizmarts_Autoresponder_AutoresponderController extends Mage_Core_Controll
|
|
23 |
|
24 |
|
25 |
}
|
26 |
-
|
|
|
|
|
27 |
$params = $this->getRequest()->getParams();
|
28 |
-
if(isset($params['email'])&&isset($params['list'])
|
29 |
$collection = Mage::getModel('ebizmarts_autoresponder/unsubscribe')->getCollection();
|
30 |
-
$collection->addFieldToFilter('main_table.email',array('eq'
|
31 |
-
|
32 |
-
|
33 |
-
if($collection->getSize() == 0) {
|
34 |
$unsubscribe = Mage::getModel('ebizmarts_autoresponder/unsubscribe');
|
35 |
$unsubscribe->setEmail($params['email'])
|
36 |
-
|
37 |
-
|
38 |
$unsubscribe->save();
|
39 |
}
|
40 |
}
|
41 |
$this->loadLayout();
|
42 |
$this->renderLayout();
|
43 |
}
|
|
|
44 |
public function savelistAction()
|
45 |
{
|
46 |
-
if(!Mage::helper('customer')->isLoggedIn()) {
|
47 |
$this->_redirect('/');
|
48 |
}
|
49 |
$params = $this->getRequest()->getParams();
|
@@ -51,19 +53,18 @@ class Ebizmarts_Autoresponder_AutoresponderController extends Mage_Core_Controll
|
|
51 |
$email = Mage::helper('customer')->getCustomer()->getEmail();
|
52 |
$storeId = Mage::app()->getStore()->getStoreId();
|
53 |
|
54 |
-
foreach($lists as $key => $list) {
|
55 |
$collection = Mage::getModel('ebizmarts_autoresponder/unsubscribe')->getCollection();
|
56 |
-
$collection->addFieldToFilter('main_table.email',array('eq'
|
57 |
-
|
58 |
-
|
59 |
-
if(array_key_exists($key
|
60 |
$collection->getFirstItem()->delete();
|
61 |
-
}
|
62 |
-
else if(!array_key_exists($key,$params)&&$collection->getSize() == 0){
|
63 |
$unsubscribe = Mage::getModel('ebizmarts_autoresponder/unsubscribe');
|
64 |
$unsubscribe->setEmail($email)
|
65 |
-
|
66 |
-
|
67 |
Mage::log($unsubscribe);
|
68 |
$unsubscribe->save();
|
69 |
}
|
@@ -73,26 +74,27 @@ class Ebizmarts_Autoresponder_AutoresponderController extends Mage_Core_Controll
|
|
73 |
|
74 |
$this->_redirect('ebizautoresponder/autoresponder');
|
75 |
}
|
|
|
76 |
protected function _getCustomerId()
|
77 |
{
|
78 |
-
if(Mage::getSingleton('customer/session')->isLoggedIn()) {
|
79 |
$customerData = Mage::getSingleton('customer/session')->getCustomer();
|
80 |
return $customerData->getId();
|
81 |
}
|
82 |
}
|
|
|
83 |
public function getVisitedProductsConfigAction()
|
84 |
{
|
85 |
$params = $this->getRequest()->getParams();
|
86 |
$storeId = Mage::app()->getStore()->getStoreId();
|
87 |
-
if(isset($params['product_id'])) {
|
88 |
$product = Mage::getModel('catalog/product')->load($params['product_id']);
|
89 |
$collection = Mage::getModel('catalog/product')->getCollection()
|
90 |
->addFieldToFilter('entity_id', $params['product_id']);
|
91 |
$mark = $product->getEbizmartsMarkVisited();
|
92 |
-
if($mark == 1) {
|
93 |
-
$resp['time'] = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::VISITED_TIME
|
94 |
-
}
|
95 |
-
else {
|
96 |
$resp['time'] = -1;
|
97 |
}
|
98 |
}
|
@@ -101,32 +103,33 @@ class Ebizmarts_Autoresponder_AutoresponderController extends Mage_Core_Controll
|
|
101 |
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($resp));
|
102 |
return;
|
103 |
}
|
|
|
104 |
public function markVisitedProductsAction()
|
105 |
{
|
106 |
$params = $this->getRequest()->getParams();
|
107 |
-
if(!isset($params['product_id'])) {
|
108 |
return;
|
109 |
}
|
110 |
-
if(!Mage::getSingleton('customer/session')->isLoggedIn()){
|
111 |
if (isset($_COOKIE['email']) && $_COOKIE['email'] != 'none') {
|
112 |
$email = str_replace(' ', '+', $_COOKIE['email']);
|
113 |
-
}else{
|
114 |
return;
|
115 |
}
|
116 |
-
}else{
|
117 |
$customerId = Mage::getSingleton('customer/session')->getCustomer()->getId();
|
118 |
}
|
119 |
$storeId = Mage::app()->getStore()->getStoreId();
|
120 |
-
$visited = Mage::getModel('ebizmarts_autoresponder/visited')->loadByCustomerProduct($customerId
|
121 |
-
if($email) {
|
122 |
$visited->setCustomerEmail($email);
|
123 |
-
}else{
|
124 |
$visited->setCustomerId($customerId);
|
125 |
}
|
126 |
|
127 |
$visited->setProductId($params['product_id'])
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
}
|
132 |
}
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_Autoresponder_AutoresponderController extends Mage_Core_Controller_Front_Action
|
11 |
{
|
12 |
public function indexAction()
|
13 |
{
|
14 |
+
if (!Mage::helper('customer')->isLoggedIn()) {
|
15 |
$this->_redirect('/');
|
16 |
}
|
17 |
$this->loadLayout();
|
22 |
|
23 |
|
24 |
}
|
25 |
+
|
26 |
+
public function unsubscribeAction()
|
27 |
+
{
|
28 |
$params = $this->getRequest()->getParams();
|
29 |
+
if (isset($params['email']) && isset($params['list']) && $params['store']) {
|
30 |
$collection = Mage::getModel('ebizmarts_autoresponder/unsubscribe')->getCollection();
|
31 |
+
$collection->addFieldToFilter('main_table.email', array('eq' => $params['email']))
|
32 |
+
->addFieldToFilter('main_table.list', array('eq' => $params['list']))
|
33 |
+
->addFieldToFilter('main_table.store_id', array('eq' => $params['store']));
|
34 |
+
if ($collection->getSize() == 0) {
|
35 |
$unsubscribe = Mage::getModel('ebizmarts_autoresponder/unsubscribe');
|
36 |
$unsubscribe->setEmail($params['email'])
|
37 |
+
->setList($params['list'])
|
38 |
+
->setStoreId($params['store']);
|
39 |
$unsubscribe->save();
|
40 |
}
|
41 |
}
|
42 |
$this->loadLayout();
|
43 |
$this->renderLayout();
|
44 |
}
|
45 |
+
|
46 |
public function savelistAction()
|
47 |
{
|
48 |
+
if (!Mage::helper('customer')->isLoggedIn()) {
|
49 |
$this->_redirect('/');
|
50 |
}
|
51 |
$params = $this->getRequest()->getParams();
|
53 |
$email = Mage::helper('customer')->getCustomer()->getEmail();
|
54 |
$storeId = Mage::app()->getStore()->getStoreId();
|
55 |
|
56 |
+
foreach ($lists as $key => $list) {
|
57 |
$collection = Mage::getModel('ebizmarts_autoresponder/unsubscribe')->getCollection();
|
58 |
+
$collection->addFieldToFilter('main_table.email', array('eq' => $email))
|
59 |
+
->addFieldToFilter('main_table.list', array('eq' => $key))
|
60 |
+
->addFieldToFilter('main_table.store_id', array('eq' => $storeId));
|
61 |
+
if (array_key_exists($key, $params) && $collection->getSize() > 0) { //try to remove
|
62 |
$collection->getFirstItem()->delete();
|
63 |
+
} else if (!array_key_exists($key, $params) && $collection->getSize() == 0) {
|
|
|
64 |
$unsubscribe = Mage::getModel('ebizmarts_autoresponder/unsubscribe');
|
65 |
$unsubscribe->setEmail($email)
|
66 |
+
->setList($key)
|
67 |
+
->setStoreId($storeId);
|
68 |
Mage::log($unsubscribe);
|
69 |
$unsubscribe->save();
|
70 |
}
|
74 |
|
75 |
$this->_redirect('ebizautoresponder/autoresponder');
|
76 |
}
|
77 |
+
|
78 |
protected function _getCustomerId()
|
79 |
{
|
80 |
+
if (Mage::getSingleton('customer/session')->isLoggedIn()) {
|
81 |
$customerData = Mage::getSingleton('customer/session')->getCustomer();
|
82 |
return $customerData->getId();
|
83 |
}
|
84 |
}
|
85 |
+
|
86 |
public function getVisitedProductsConfigAction()
|
87 |
{
|
88 |
$params = $this->getRequest()->getParams();
|
89 |
$storeId = Mage::app()->getStore()->getStoreId();
|
90 |
+
if (isset($params['product_id'])) {
|
91 |
$product = Mage::getModel('catalog/product')->load($params['product_id']);
|
92 |
$collection = Mage::getModel('catalog/product')->getCollection()
|
93 |
->addFieldToFilter('entity_id', $params['product_id']);
|
94 |
$mark = $product->getEbizmartsMarkVisited();
|
95 |
+
if ($mark == 1) {
|
96 |
+
$resp['time'] = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::VISITED_TIME, $storeId);
|
97 |
+
} else {
|
|
|
98 |
$resp['time'] = -1;
|
99 |
}
|
100 |
}
|
103 |
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($resp));
|
104 |
return;
|
105 |
}
|
106 |
+
|
107 |
public function markVisitedProductsAction()
|
108 |
{
|
109 |
$params = $this->getRequest()->getParams();
|
110 |
+
if (!isset($params['product_id'])) {
|
111 |
return;
|
112 |
}
|
113 |
+
if (!Mage::getSingleton('customer/session')->isLoggedIn()) {
|
114 |
if (isset($_COOKIE['email']) && $_COOKIE['email'] != 'none') {
|
115 |
$email = str_replace(' ', '+', $_COOKIE['email']);
|
116 |
+
} else {
|
117 |
return;
|
118 |
}
|
119 |
+
} else {
|
120 |
$customerId = Mage::getSingleton('customer/session')->getCustomer()->getId();
|
121 |
}
|
122 |
$storeId = Mage::app()->getStore()->getStoreId();
|
123 |
+
$visited = Mage::getModel('ebizmarts_autoresponder/visited')->loadByCustomerProduct($customerId, $params['product_id'], $storeId);
|
124 |
+
if ($email) {
|
125 |
$visited->setCustomerEmail($email);
|
126 |
+
} else {
|
127 |
$visited->setCustomerId($customerId);
|
128 |
}
|
129 |
|
130 |
$visited->setProductId($params['product_id'])
|
131 |
+
->setStoreId($storeId)
|
132 |
+
->setVisitedAt(Mage::getModel('core/date')->gmtDate())
|
133 |
+
->save();
|
134 |
}
|
135 |
}
|
app/code/community/Ebizmarts/Autoresponder/controllers/BacktostockController.php
CHANGED
@@ -7,7 +7,6 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_Autoresponder_BacktostockController extends Mage_Core_Controller_Front_Action
|
12 |
{
|
13 |
|
@@ -16,7 +15,7 @@ class Ebizmarts_Autoresponder_BacktostockController extends Mage_Core_Controller
|
|
16 |
$params = $this->getRequest()->getParams();
|
17 |
$redirect = '/';
|
18 |
|
19 |
-
if(isset($params['subscriber_email']) && isset($params['product_id'])) {
|
20 |
|
21 |
$email = $params['subscriber_email'];
|
22 |
$productId = $params['product_id'];
|
@@ -24,23 +23,21 @@ class Ebizmarts_Autoresponder_BacktostockController extends Mage_Core_Controller
|
|
24 |
|
25 |
$stockAlertCollection = Mage::getModel('ebizmarts_autoresponder/backtostockalert')->getCollection();
|
26 |
$stockAlertCollection
|
27 |
-
->addFieldToFilter('main_table.product_id', array('eq'
|
28 |
-
->addFieldToFilter('main_table.is_active', array('eq'=> 1))
|
29 |
-
;
|
30 |
|
31 |
// Check if we already have this Product ID in alert table, otherwise insert a new one
|
32 |
-
if($stockAlertCollection->getSize() == 0) {
|
33 |
$stockAlert = Mage::getModel('ebizmarts_autoresponder/backtostockalert');
|
34 |
$stockAlert
|
35 |
->setProductId($productId)
|
36 |
-
->setIsActive(1)
|
37 |
-
;
|
38 |
|
39 |
$stockAlert->save();
|
40 |
|
41 |
$alertId = $stockAlert->getAlertId();
|
42 |
|
43 |
-
Mage::helper('ebizmarts_autoresponder')->log('New Stock Alert for product #'. $productId . ' was saved.');
|
44 |
|
45 |
} else {
|
46 |
// Retrieve existing Stock Alert ID
|
@@ -51,8 +48,7 @@ class Ebizmarts_Autoresponder_BacktostockController extends Mage_Core_Controller
|
|
51 |
$backStock = Mage::getModel('ebizmarts_autoresponder/backtostock');
|
52 |
$backStock
|
53 |
->setAlertId($alertId)
|
54 |
-
->setEmail($email)
|
55 |
-
;
|
56 |
$backStock->save();
|
57 |
|
58 |
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_Autoresponder_BacktostockController extends Mage_Core_Controller_Front_Action
|
11 |
{
|
12 |
|
15 |
$params = $this->getRequest()->getParams();
|
16 |
$redirect = '/';
|
17 |
|
18 |
+
if (isset($params['subscriber_email']) && isset($params['product_id'])) {
|
19 |
|
20 |
$email = $params['subscriber_email'];
|
21 |
$productId = $params['product_id'];
|
23 |
|
24 |
$stockAlertCollection = Mage::getModel('ebizmarts_autoresponder/backtostockalert')->getCollection();
|
25 |
$stockAlertCollection
|
26 |
+
->addFieldToFilter('main_table.product_id', array('eq' => $productId))
|
27 |
+
->addFieldToFilter('main_table.is_active', array('eq' => 1));
|
|
|
28 |
|
29 |
// Check if we already have this Product ID in alert table, otherwise insert a new one
|
30 |
+
if ($stockAlertCollection->getSize() == 0) {
|
31 |
$stockAlert = Mage::getModel('ebizmarts_autoresponder/backtostockalert');
|
32 |
$stockAlert
|
33 |
->setProductId($productId)
|
34 |
+
->setIsActive(1);
|
|
|
35 |
|
36 |
$stockAlert->save();
|
37 |
|
38 |
$alertId = $stockAlert->getAlertId();
|
39 |
|
40 |
+
Mage::helper('ebizmarts_autoresponder')->log('New Stock Alert for product #' . $productId . ' was saved.');
|
41 |
|
42 |
} else {
|
43 |
// Retrieve existing Stock Alert ID
|
48 |
$backStock = Mage::getModel('ebizmarts_autoresponder/backtostock');
|
49 |
$backStock
|
50 |
->setAlertId($alertId)
|
51 |
+
->setEmail($email);
|
|
|
52 |
$backStock->save();
|
53 |
|
54 |
|
app/code/community/Ebizmarts/Autoresponder/etc/config.xml
CHANGED
@@ -10,7 +10,7 @@
|
|
10 |
<config>
|
11 |
<modules>
|
12 |
<Ebizmarts_Autoresponder>
|
13 |
-
<version>
|
14 |
</Ebizmarts_Autoresponder>
|
15 |
</modules>
|
16 |
<global>
|
10 |
<config>
|
11 |
<modules>
|
12 |
<Ebizmarts_Autoresponder>
|
13 |
+
<version>0.1.10</version>
|
14 |
</Ebizmarts_Autoresponder>
|
15 |
</modules>
|
16 |
<global>
|
app/code/community/Ebizmarts/Autoresponder/etc/system.xml
CHANGED
@@ -114,7 +114,8 @@
|
|
114 |
<show_in_default>1</show_in_default>
|
115 |
<show_in_website>0</show_in_website>
|
116 |
<show_in_store>1</show_in_store>
|
117 |
-
<comment
|
|
|
118 |
<depends>
|
119 |
<active>1</active>
|
120 |
<trigger separator=",">1,2</trigger>
|
@@ -311,7 +312,8 @@
|
|
311 |
<show_in_store>1</show_in_store>
|
312 |
<fields>
|
313 |
<hint>
|
314 |
-
<frontend_model>ebizmarts_autoresponder/adminhtml_system_config_review_fieldset_hint
|
|
|
315 |
<sort_order>0</sort_order>
|
316 |
<show_in_default>1</show_in_default>
|
317 |
<show_in_website>1</show_in_website>
|
@@ -458,7 +460,8 @@
|
|
458 |
<show_in_default>1</show_in_default>
|
459 |
<show_in_website>1</show_in_website>
|
460 |
<show_in_store>1</show_in_store>
|
461 |
-
<comment
|
|
|
462 |
<depends>
|
463 |
<active>1</active>
|
464 |
<coupon>1</coupon>
|
@@ -485,7 +488,8 @@
|
|
485 |
<show_in_default>1</show_in_default>
|
486 |
<show_in_website>1</show_in_website>
|
487 |
<show_in_store>1</show_in_store>
|
488 |
-
<comment
|
|
|
489 |
<depends>
|
490 |
<active>1</active>
|
491 |
<coupon>1</coupon>
|
@@ -513,7 +517,8 @@
|
|
513 |
<show_in_default>1</show_in_default>
|
514 |
<show_in_website>1</show_in_website>
|
515 |
<show_in_store>1</show_in_store>
|
516 |
-
<comment
|
|
|
517 |
<depends>
|
518 |
<active>1</active>
|
519 |
<coupon>1</coupon>
|
@@ -527,7 +532,8 @@
|
|
527 |
<show_in_default>1</show_in_default>
|
528 |
<show_in_website>1</show_in_website>
|
529 |
<show_in_store>1</show_in_store>
|
530 |
-
<comment
|
|
|
531 |
<depends>
|
532 |
<active>1</active>
|
533 |
<coupon>1</coupon>
|
@@ -644,6 +650,7 @@
|
|
644 |
<show_in_website>1</show_in_website>
|
645 |
<show_in_store>1</show_in_store>
|
646 |
<can_be_empty>0</can_be_empty>
|
|
|
647 |
<depends>
|
648 |
<active>1</active>
|
649 |
<coupon>1</coupon>
|
@@ -688,7 +695,8 @@
|
|
688 |
<show_in_store>1</show_in_store>
|
689 |
<fields>
|
690 |
<hint>
|
691 |
-
<frontend_model>ebizmarts_autoresponder/adminhtml_system_config_birthday_fieldset_hint
|
|
|
692 |
<sort_order>0</sort_order>
|
693 |
<show_in_default>1</show_in_default>
|
694 |
<show_in_website>1</show_in_website>
|
@@ -873,6 +881,7 @@
|
|
873 |
<show_in_website>1</show_in_website>
|
874 |
<show_in_store>1</show_in_store>
|
875 |
<can_be_empty>0</can_be_empty>
|
|
|
876 |
<depends>
|
877 |
<active>1</active>
|
878 |
<coupon>1</coupon>
|
@@ -1228,7 +1237,8 @@
|
|
1228 |
<show_in_store>1</show_in_store>
|
1229 |
<fields>
|
1230 |
<hint>
|
1231 |
-
<frontend_model>ebizmarts_autoresponder/adminhtml_system_config_backtostock_fieldset_hint
|
|
|
1232 |
<sort_order>0</sort_order>
|
1233 |
<show_in_default>1</show_in_default>
|
1234 |
<show_in_website>1</show_in_website>
|
114 |
<show_in_default>1</show_in_default>
|
115 |
<show_in_website>0</show_in_website>
|
116 |
<show_in_store>1</show_in_store>
|
117 |
+
<comment>
|
118 |
+
<![CDATA[The email will be sent when order gets to the selected status.]]></comment>
|
119 |
<depends>
|
120 |
<active>1</active>
|
121 |
<trigger separator=",">1,2</trigger>
|
312 |
<show_in_store>1</show_in_store>
|
313 |
<fields>
|
314 |
<hint>
|
315 |
+
<frontend_model>ebizmarts_autoresponder/adminhtml_system_config_review_fieldset_hint
|
316 |
+
</frontend_model>
|
317 |
<sort_order>0</sort_order>
|
318 |
<show_in_default>1</show_in_default>
|
319 |
<show_in_website>1</show_in_website>
|
460 |
<show_in_default>1</show_in_default>
|
461 |
<show_in_website>1</show_in_website>
|
462 |
<show_in_store>1</show_in_store>
|
463 |
+
<comment>
|
464 |
+
<![CDATA[How do you want to count reviews<br>Keep in mind, <em>General</em> only work for registered customers]]></comment>
|
465 |
<depends>
|
466 |
<active>1</active>
|
467 |
<coupon>1</coupon>
|
488 |
<show_in_default>1</show_in_default>
|
489 |
<show_in_website>1</show_in_website>
|
490 |
<show_in_store>1</show_in_store>
|
491 |
+
<comment>
|
492 |
+
<![CDATA[<em>Each</em>: every "Required Review qty" multiple is reached, a new coupon will be sent.<br><em>Only once</em>: a coupon is sent only the first time that "Required Review qty" is reached.<br><em>Specific</em>: same as <em>Each</em> but also defines a fixed qty of coupons to be sent.]]></comment>
|
493 |
<depends>
|
494 |
<active>1</active>
|
495 |
<coupon>1</coupon>
|
517 |
<show_in_default>1</show_in_default>
|
518 |
<show_in_website>1</show_in_website>
|
519 |
<show_in_store>1</show_in_store>
|
520 |
+
<comment>
|
521 |
+
<![CDATA[How many items needs to be reviewed per order to win a coupon (0 means all items requires a review).]]></comment>
|
522 |
<depends>
|
523 |
<active>1</active>
|
524 |
<coupon>1</coupon>
|
532 |
<show_in_default>1</show_in_default>
|
533 |
<show_in_website>1</show_in_website>
|
534 |
<show_in_store>1</show_in_store>
|
535 |
+
<comment>
|
536 |
+
<![CDATA[Order needs to have at least this quantity of items to apply for a coupon (0 means all Orders applies, no matter how many items were ordered).]]></comment>
|
537 |
<depends>
|
538 |
<active>1</active>
|
539 |
<coupon>1</coupon>
|
650 |
<show_in_website>1</show_in_website>
|
651 |
<show_in_store>1</show_in_store>
|
652 |
<can_be_empty>0</can_be_empty>
|
653 |
+
<comment><![CDATA[Amount]]></comment>
|
654 |
<depends>
|
655 |
<active>1</active>
|
656 |
<coupon>1</coupon>
|
695 |
<show_in_store>1</show_in_store>
|
696 |
<fields>
|
697 |
<hint>
|
698 |
+
<frontend_model>ebizmarts_autoresponder/adminhtml_system_config_birthday_fieldset_hint
|
699 |
+
</frontend_model>
|
700 |
<sort_order>0</sort_order>
|
701 |
<show_in_default>1</show_in_default>
|
702 |
<show_in_website>1</show_in_website>
|
881 |
<show_in_website>1</show_in_website>
|
882 |
<show_in_store>1</show_in_store>
|
883 |
<can_be_empty>0</can_be_empty>
|
884 |
+
<comment><![CDATA[Amount]]></comment>
|
885 |
<depends>
|
886 |
<active>1</active>
|
887 |
<coupon>1</coupon>
|
1237 |
<show_in_store>1</show_in_store>
|
1238 |
<fields>
|
1239 |
<hint>
|
1240 |
+
<frontend_model>ebizmarts_autoresponder/adminhtml_system_config_backtostock_fieldset_hint
|
1241 |
+
</frontend_model>
|
1242 |
<sort_order>0</sort_order>
|
1243 |
<show_in_default>1</show_in_default>
|
1244 |
<show_in_website>1</show_in_website>
|
app/code/community/Ebizmarts/Autoresponder/sql/ebizmarts_autoresponder_setup/mysql4-install-0.1.0.php
CHANGED
@@ -5,7 +5,7 @@
|
|
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 |
|
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 |
|
app/code/community/Ebizmarts/Autoresponder/sql/ebizmarts_autoresponder_setup/mysql4-upgrade-0.1.3-0.1.4.php
CHANGED
@@ -31,24 +31,24 @@ $installer->addAttribute(
|
|
31 |
Mage_Catalog_Model_Product::ENTITY,
|
32 |
'ebizmarts_mark_visited',
|
33 |
array(
|
34 |
-
'group'
|
35 |
-
'type'
|
36 |
-
'backend'
|
37 |
-
'frontend'
|
38 |
-
'label'
|
39 |
-
'input'
|
40 |
-
'source'
|
41 |
-
'global'
|
42 |
-
'required'
|
43 |
-
'user_defined'
|
44 |
-
'default'
|
45 |
-
'searchable'
|
46 |
-
'filterable'
|
47 |
-
'comparable'
|
48 |
-
'visible_on_front'
|
49 |
-
'unique'
|
50 |
-
'is_configurable'
|
51 |
-
'apply_to'
|
52 |
)
|
53 |
);
|
54 |
|
31 |
Mage_Catalog_Model_Product::ENTITY,
|
32 |
'ebizmarts_mark_visited',
|
33 |
array(
|
34 |
+
'group' => 'General',
|
35 |
+
'type' => 'int',
|
36 |
+
'backend' => '',
|
37 |
+
'frontend' => '',
|
38 |
+
'label' => 'Send Browsed Product Autoresponder',
|
39 |
+
'input' => 'select',
|
40 |
+
'source' => 'eav/entity_attribute_source_boolean',
|
41 |
+
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE,
|
42 |
+
'required' => false,
|
43 |
+
'user_defined' => true,
|
44 |
+
'default' => '0',
|
45 |
+
'searchable' => false,
|
46 |
+
'filterable' => false,
|
47 |
+
'comparable' => false,
|
48 |
+
'visible_on_front' => false,
|
49 |
+
'unique' => false,
|
50 |
+
'is_configurable' => false,
|
51 |
+
'apply_to' => implode(',', $applyTo)
|
52 |
)
|
53 |
);
|
54 |
|
app/code/community/Ebizmarts/Autoresponder/sql/ebizmarts_autoresponder_setup/mysql4-upgrade-0.1.4-0.1.5.php
CHANGED
@@ -33,24 +33,24 @@ $installer->addAttribute(
|
|
33 |
'customer',
|
34 |
'ebizmarts_reviews_cntr_total',
|
35 |
array(
|
36 |
-
'type'
|
37 |
-
'input'
|
38 |
-
'required'
|
39 |
-
'default'
|
40 |
-
'visible_on_front'
|
41 |
-
'user_defined'
|
42 |
)
|
43 |
);
|
44 |
$installer->addAttribute(
|
45 |
'customer',
|
46 |
'ebizmarts_reviews_coupon_total',
|
47 |
array(
|
48 |
-
'type'
|
49 |
-
'input'
|
50 |
-
'required'
|
51 |
-
'default'
|
52 |
-
'visible_on_front'
|
53 |
-
'user_defined'
|
54 |
)
|
55 |
);
|
56 |
|
33 |
'customer',
|
34 |
'ebizmarts_reviews_cntr_total',
|
35 |
array(
|
36 |
+
'type' => 'int',
|
37 |
+
'input' => 'hidden',
|
38 |
+
'required' => 0,
|
39 |
+
'default' => 0,
|
40 |
+
'visible_on_front' => 0,
|
41 |
+
'user_defined' => true,
|
42 |
)
|
43 |
);
|
44 |
$installer->addAttribute(
|
45 |
'customer',
|
46 |
'ebizmarts_reviews_coupon_total',
|
47 |
array(
|
48 |
+
'type' => 'int',
|
49 |
+
'input' => 'hidden',
|
50 |
+
'required' => 0,
|
51 |
+
'default' => 0,
|
52 |
+
'visible_on_front' => 0,
|
53 |
+
'user_defined' => true,
|
54 |
)
|
55 |
);
|
56 |
|
app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Bulksync/Export.php
CHANGED
@@ -8,7 +8,6 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_MageMonkey_Block_Adminhtml_Bulksync_Export extends Mage_Adminhtml_Block_Widget_Form_Container
|
13 |
{
|
14 |
|
@@ -16,7 +15,7 @@ class Ebizmarts_MageMonkey_Block_Adminhtml_Bulksync_Export extends Mage_Adminhtm
|
|
16 |
{
|
17 |
$this->_controller = 'adminhtml_bulksync';
|
18 |
$this->_blockGroup = 'monkey';
|
19 |
-
$this->_mode
|
20 |
|
21 |
parent::__construct();
|
22 |
|
@@ -25,7 +24,7 @@ class Ebizmarts_MageMonkey_Block_Adminhtml_Bulksync_Export extends Mage_Adminhtm
|
|
25 |
|
26 |
public function getHeaderText()
|
27 |
{
|
28 |
-
|
29 |
}
|
30 |
|
31 |
}
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_MageMonkey_Block_Adminhtml_Bulksync_Export extends Mage_Adminhtml_Block_Widget_Form_Container
|
12 |
{
|
13 |
|
15 |
{
|
16 |
$this->_controller = 'adminhtml_bulksync';
|
17 |
$this->_blockGroup = 'monkey';
|
18 |
+
$this->_mode = 'export';
|
19 |
|
20 |
parent::__construct();
|
21 |
|
24 |
|
25 |
public function getHeaderText()
|
26 |
{
|
27 |
+
return Mage::helper('monkey')->__('New Export');
|
28 |
}
|
29 |
|
30 |
}
|
app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Bulksync/Export/Form.php
CHANGED
@@ -8,7 +8,6 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_MageMonkey_Block_Adminhtml_Bulksync_Export_Form extends Mage_Adminhtml_Block_Widget_Form
|
13 |
{
|
14 |
|
@@ -20,46 +19,46 @@ class Ebizmarts_MageMonkey_Block_Adminhtml_Bulksync_Export_Form extends Mage_Adm
|
|
20 |
protected function _prepareForm()
|
21 |
{
|
22 |
$form = new Varien_Data_Form(array(
|
23 |
-
'id'
|
24 |
-
'action'
|
25 |
-
'method'
|
26 |
));
|
27 |
|
28 |
-
$fieldset
|
29 |
-
'legend'
|
30 |
));
|
31 |
|
32 |
-
|
33 |
$fieldset->addField('data_source_entity', 'select', array(
|
34 |
-
'label'
|
35 |
-
'title'
|
36 |
-
'name'
|
37 |
-
'values'
|
38 |
'class' => 'required-entry',
|
39 |
'required' => true,
|
40 |
));
|
41 |
|
42 |
-
|
43 |
$fieldset->addField('list', 'multiselect', array(
|
44 |
-
'label'
|
45 |
-
'title'
|
46 |
-
'name'
|
47 |
-
'values'
|
48 |
'class' => 'required-entry',
|
49 |
'required' => true,
|
50 |
));
|
51 |
|
52 |
$storeSwitcher = $fieldset->addField('store_id', 'select', array(
|
53 |
-
'name'
|
54 |
-
'label'
|
55 |
-
'title'
|
56 |
-
'required'
|
57 |
-
'values'
|
58 |
));
|
59 |
|
60 |
$fieldset->addField('direction', 'hidden', array(
|
61 |
-
'name'
|
62 |
-
'value'
|
63 |
));
|
64 |
|
65 |
$form->setUseContainer(true);
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_MageMonkey_Block_Adminhtml_Bulksync_Export_Form extends Mage_Adminhtml_Block_Widget_Form
|
12 |
{
|
13 |
|
19 |
protected function _prepareForm()
|
20 |
{
|
21 |
$form = new Varien_Data_Form(array(
|
22 |
+
'id' => 'edit_form',
|
23 |
+
'action' => $this->getUrl('*/*/save'),
|
24 |
+
'method' => 'post'
|
25 |
));
|
26 |
|
27 |
+
$fieldset = $form->addFieldset('export_settings', array(
|
28 |
+
'legend' => Mage::helper('monkey')->__('Export Configuration')
|
29 |
));
|
30 |
|
31 |
+
$dataSource = Mage::getSingleton('monkey/system_config_source_bulksyncDatasource')->toOptionArray();
|
32 |
$fieldset->addField('data_source_entity', 'select', array(
|
33 |
+
'label' => Mage::helper('monkey')->__('Data Source'),
|
34 |
+
'title' => Mage::helper('monkey')->__('Data Source'),
|
35 |
+
'name' => 'data_source_entity',
|
36 |
+
'values' => $dataSource,
|
37 |
'class' => 'required-entry',
|
38 |
'required' => true,
|
39 |
));
|
40 |
|
41 |
+
$lists = Mage::getSingleton('monkey/system_config_source_list')->toOptionArray();
|
42 |
$fieldset->addField('list', 'multiselect', array(
|
43 |
+
'label' => Mage::helper('monkey')->__('Choose Lists'),
|
44 |
+
'title' => Mage::helper('monkey')->__('Choose Lists'),
|
45 |
+
'name' => 'list',
|
46 |
+
'values' => $lists,
|
47 |
'class' => 'required-entry',
|
48 |
'required' => true,
|
49 |
));
|
50 |
|
51 |
$storeSwitcher = $fieldset->addField('store_id', 'select', array(
|
52 |
+
'name' => 'store_id',
|
53 |
+
'label' => Mage::helper('monkey')->__('Store'),
|
54 |
+
'title' => Mage::helper('monkey')->__('Store'),
|
55 |
+
'required' => true,
|
56 |
+
'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true),
|
57 |
));
|
58 |
|
59 |
$fieldset->addField('direction', 'hidden', array(
|
60 |
+
'name' => 'direction',
|
61 |
+
'value' => 'export',
|
62 |
));
|
63 |
|
64 |
$form->setUseContainer(true);
|
app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Bulksync/Import.php
CHANGED
@@ -8,7 +8,6 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_MageMonkey_Block_Adminhtml_Bulksync_Import extends Mage_Adminhtml_Block_Widget_Form_Container
|
13 |
{
|
14 |
|
@@ -16,7 +15,7 @@ class Ebizmarts_MageMonkey_Block_Adminhtml_Bulksync_Import extends Mage_Adminhtm
|
|
16 |
{
|
17 |
$this->_controller = 'adminhtml_bulksync';
|
18 |
$this->_blockGroup = 'monkey';
|
19 |
-
$this->_mode
|
20 |
|
21 |
parent::__construct();
|
22 |
|
@@ -25,7 +24,7 @@ class Ebizmarts_MageMonkey_Block_Adminhtml_Bulksync_Import extends Mage_Adminhtm
|
|
25 |
|
26 |
public function getHeaderText()
|
27 |
{
|
28 |
-
|
29 |
}
|
30 |
|
31 |
}
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_MageMonkey_Block_Adminhtml_Bulksync_Import extends Mage_Adminhtml_Block_Widget_Form_Container
|
12 |
{
|
13 |
|
15 |
{
|
16 |
$this->_controller = 'adminhtml_bulksync';
|
17 |
$this->_blockGroup = 'monkey';
|
18 |
+
$this->_mode = 'import';
|
19 |
|
20 |
parent::__construct();
|
21 |
|
24 |
|
25 |
public function getHeaderText()
|
26 |
{
|
27 |
+
return Mage::helper('monkey')->__('New Import');
|
28 |
}
|
29 |
|
30 |
}
|
app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Bulksync/Import/Form.php
CHANGED
@@ -8,7 +8,6 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_MageMonkey_Block_Adminhtml_Bulksync_Import_Form extends Mage_Adminhtml_Block_Widget_Form
|
13 |
{
|
14 |
|
@@ -20,67 +19,67 @@ class Ebizmarts_MageMonkey_Block_Adminhtml_Bulksync_Import_Form extends Mage_Adm
|
|
20 |
protected function _prepareForm()
|
21 |
{
|
22 |
$form = new Varien_Data_Form(array(
|
23 |
-
'id'
|
24 |
-
'action'
|
25 |
-
'method'
|
26 |
));
|
27 |
|
28 |
-
$fieldset
|
29 |
-
'legend'
|
30 |
));
|
31 |
|
32 |
-
|
33 |
$fieldset->addField('list', 'multiselect', array(
|
34 |
-
'label'
|
35 |
-
'title'
|
36 |
-
'name'
|
37 |
-
'values'
|
38 |
'class' => 'required-entry',
|
39 |
'required' => true,
|
40 |
));
|
41 |
|
42 |
-
|
43 |
$fieldset->addField('import_types', 'multiselect', array(
|
44 |
-
'label'
|
45 |
-
'title'
|
46 |
-
'name'
|
47 |
-
'values'
|
48 |
'class' => 'required-entry',
|
49 |
'required' => true,
|
50 |
));
|
51 |
|
52 |
$fieldset->addField('create_customers', 'checkbox', array(
|
53 |
-
'label'
|
54 |
-
'title'
|
55 |
-
'name'
|
56 |
-
'value'
|
57 |
));
|
58 |
|
59 |
$fieldset->addField('since', 'date', array(
|
60 |
-
'label'
|
61 |
-
'title'
|
62 |
-
'name'
|
63 |
-
'image'
|
64 |
-
'format'
|
65 |
));
|
66 |
|
67 |
$fieldset->addField('direction', 'hidden', array(
|
68 |
-
'name'
|
69 |
-
'value'
|
70 |
));
|
71 |
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
|
78 |
$form->setUseContainer(true);
|
79 |
$this->setForm($form);
|
80 |
|
81 |
$this->setChild('form_after', Mage::getModel('core/layout')->createBlock('monkey/adminhtml_bulksync_queueImport', 'importqueue'));
|
82 |
|
83 |
-
|
84 |
|
85 |
}
|
86 |
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_MageMonkey_Block_Adminhtml_Bulksync_Import_Form extends Mage_Adminhtml_Block_Widget_Form
|
12 |
{
|
13 |
|
19 |
protected function _prepareForm()
|
20 |
{
|
21 |
$form = new Varien_Data_Form(array(
|
22 |
+
'id' => 'edit_form',
|
23 |
+
'action' => $this->getUrl('*/*/save'),
|
24 |
+
'method' => 'post'
|
25 |
));
|
26 |
|
27 |
+
$fieldset = $form->addFieldset('import_settings', array(
|
28 |
+
'legend' => Mage::helper('monkey')->__('Import Configuration')
|
29 |
));
|
30 |
|
31 |
+
$lists = Mage::getSingleton('monkey/system_config_source_list')->toOptionArray();
|
32 |
$fieldset->addField('list', 'multiselect', array(
|
33 |
+
'label' => Mage::helper('monkey')->__('Choose Lists'),
|
34 |
+
'title' => Mage::helper('monkey')->__('Choose Lists'),
|
35 |
+
'name' => 'list',
|
36 |
+
'values' => $lists,
|
37 |
'class' => 'required-entry',
|
38 |
'required' => true,
|
39 |
));
|
40 |
|
41 |
+
$statuses = Mage::getSingleton('monkey/system_config_source_status')->toOptionArray();
|
42 |
$fieldset->addField('import_types', 'multiselect', array(
|
43 |
+
'label' => Mage::helper('monkey')->__('Statuses to import'),
|
44 |
+
'title' => Mage::helper('monkey')->__('Statuses to import'),
|
45 |
+
'name' => 'import_types',
|
46 |
+
'values' => $statuses,
|
47 |
'class' => 'required-entry',
|
48 |
'required' => true,
|
49 |
));
|
50 |
|
51 |
$fieldset->addField('create_customers', 'checkbox', array(
|
52 |
+
'label' => Mage::helper('monkey')->__('Create customer accounts'),
|
53 |
+
'title' => Mage::helper('monkey')->__('Create customer accounts'),
|
54 |
+
'name' => 'create_customers',
|
55 |
+
'value' => '1'
|
56 |
));
|
57 |
|
58 |
$fieldset->addField('since', 'date', array(
|
59 |
+
'label' => Mage::helper('monkey')->__('Retrieve data since'),
|
60 |
+
'title' => Mage::helper('monkey')->__('Retrieve data since'),
|
61 |
+
'name' => 'since',
|
62 |
+
'image' => $this->getSkinUrl('images/grid-cal.gif'),
|
63 |
+
'format' => Varien_Date::DATE_INTERNAL_FORMAT
|
64 |
));
|
65 |
|
66 |
$fieldset->addField('direction', 'hidden', array(
|
67 |
+
'name' => 'direction',
|
68 |
+
'value' => 'import',
|
69 |
));
|
70 |
|
71 |
+
//Set default FORM values
|
72 |
+
$formValues = array(
|
73 |
+
'import_types' => array('subscribed')
|
74 |
+
);
|
75 |
+
$form->addValues($formValues);
|
76 |
|
77 |
$form->setUseContainer(true);
|
78 |
$this->setForm($form);
|
79 |
|
80 |
$this->setChild('form_after', Mage::getModel('core/layout')->createBlock('monkey/adminhtml_bulksync_queueImport', 'importqueue'));
|
81 |
|
82 |
+
return parent::_prepareForm();
|
83 |
|
84 |
}
|
85 |
|
app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Bulksync/Queue.php
CHANGED
@@ -7,7 +7,6 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_MageMonkey_Block_Adminhtml_Bulksync_Queue extends Mage_Adminhtml_Block_Widget_Grid_Container
|
12 |
{
|
13 |
|
@@ -30,7 +29,7 @@ class Ebizmarts_MageMonkey_Block_Adminhtml_Bulksync_Queue extends Mage_Adminhtml
|
|
30 |
public function isSingleStoreMode()
|
31 |
{
|
32 |
if (!Mage::app()->isSingleStoreMode()) {
|
33 |
-
|
34 |
}
|
35 |
return true;
|
36 |
}
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_MageMonkey_Block_Adminhtml_Bulksync_Queue extends Mage_Adminhtml_Block_Widget_Grid_Container
|
11 |
{
|
12 |
|
29 |
public function isSingleStoreMode()
|
30 |
{
|
31 |
if (!Mage::app()->isSingleStoreMode()) {
|
32 |
+
return false;
|
33 |
}
|
34 |
return true;
|
35 |
}
|
app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Bulksync/Queue/Grid.php
CHANGED
@@ -7,7 +7,6 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_MageMonkey_Block_Adminhtml_Bulksync_Queue_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
12 |
{
|
13 |
|
@@ -24,7 +23,7 @@ class Ebizmarts_MageMonkey_Block_Adminhtml_Bulksync_Queue_Grid extends Mage_Admi
|
|
24 |
protected function _prepareCollection()
|
25 |
{
|
26 |
$collection = Mage::getModel('monkey/bulksyncExport')
|
27 |
-
|
28 |
|
29 |
$this->setCollection($collection);
|
30 |
return parent::_prepareCollection();
|
@@ -34,30 +33,30 @@ class Ebizmarts_MageMonkey_Block_Adminhtml_Bulksync_Queue_Grid extends Mage_Admi
|
|
34 |
{
|
35 |
|
36 |
$this->addColumn('id', array(
|
37 |
-
'header'=> Mage::helper('monkey')->__('ID'),
|
38 |
'width' => '80px',
|
39 |
'index' => 'id',
|
40 |
'type' => 'number'
|
41 |
));
|
42 |
|
43 |
$this->addColumn('status', array(
|
44 |
-
'header'=> Mage::helper('monkey')->__('Status'),
|
45 |
'width' => '80px',
|
46 |
'index' => 'status',
|
47 |
));
|
48 |
|
49 |
$this->addColumn('updated_at', array(
|
50 |
-
'header'=> Mage::helper('monkey')->__('Date Sent'),
|
51 |
'width' => '80px',
|
52 |
'index' => 'updated_at',
|
53 |
-
'type'
|
54 |
));
|
55 |
|
56 |
$this->addColumn('created_at', array(
|
57 |
-
'header'=> Mage::helper('monkey')->__('Date Sent'),
|
58 |
'width' => '80px',
|
59 |
'index' => 'created_at',
|
60 |
-
'type'
|
61 |
));
|
62 |
|
63 |
return parent::_prepareColumns();
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_MageMonkey_Block_Adminhtml_Bulksync_Queue_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
11 |
{
|
12 |
|
23 |
protected function _prepareCollection()
|
24 |
{
|
25 |
$collection = Mage::getModel('monkey/bulksyncExport')
|
26 |
+
->getCollection();
|
27 |
|
28 |
$this->setCollection($collection);
|
29 |
return parent::_prepareCollection();
|
33 |
{
|
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('status', array(
|
43 |
+
'header' => Mage::helper('monkey')->__('Status'),
|
44 |
'width' => '80px',
|
45 |
'index' => 'status',
|
46 |
));
|
47 |
|
48 |
$this->addColumn('updated_at', array(
|
49 |
+
'header' => Mage::helper('monkey')->__('Date Sent'),
|
50 |
'width' => '80px',
|
51 |
'index' => 'updated_at',
|
52 |
+
'type' => 'datetime'
|
53 |
));
|
54 |
|
55 |
$this->addColumn('created_at', array(
|
56 |
+
'header' => Mage::helper('monkey')->__('Date Sent'),
|
57 |
'width' => '80px',
|
58 |
'index' => 'created_at',
|
59 |
+
'type' => 'datetime'
|
60 |
));
|
61 |
|
62 |
return parent::_prepareColumns();
|
app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Bulksync/QueueExport.php
CHANGED
@@ -8,7 +8,6 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_MageMonkey_Block_Adminhtml_Bulksync_QueueExport extends Mage_Adminhtml_Block_Widget_Grid_Container
|
13 |
{
|
14 |
|
@@ -25,9 +24,9 @@ class Ebizmarts_MageMonkey_Block_Adminhtml_Bulksync_QueueExport extends Mage_Adm
|
|
25 |
|
26 |
protected function _prepareLayout()
|
27 |
{
|
28 |
-
$this->setChild(
|
29 |
-
$this->getLayout()->createBlock(
|
30 |
-
|
31 |
return Mage_Adminhtml_Block_Widget_Container::_prepareLayout();
|
32 |
}
|
33 |
|
@@ -39,7 +38,7 @@ class Ebizmarts_MageMonkey_Block_Adminhtml_Bulksync_QueueExport extends Mage_Adm
|
|
39 |
public function isSingleStoreMode()
|
40 |
{
|
41 |
if (!Mage::app()->isSingleStoreMode()) {
|
42 |
-
|
43 |
}
|
44 |
return true;
|
45 |
}
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_MageMonkey_Block_Adminhtml_Bulksync_QueueExport extends Mage_Adminhtml_Block_Widget_Grid_Container
|
12 |
{
|
13 |
|
24 |
|
25 |
protected function _prepareLayout()
|
26 |
{
|
27 |
+
$this->setChild('grid',
|
28 |
+
$this->getLayout()->createBlock($this->_blockGroup . '/' . $this->_controller . 'Export_grid',
|
29 |
+
$this->_controller . '.grid')->setSaveParametersInSession(true));
|
30 |
return Mage_Adminhtml_Block_Widget_Container::_prepareLayout();
|
31 |
}
|
32 |
|
38 |
public function isSingleStoreMode()
|
39 |
{
|
40 |
if (!Mage::app()->isSingleStoreMode()) {
|
41 |
+
return false;
|
42 |
}
|
43 |
return true;
|
44 |
}
|
app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Bulksync/QueueExport/Grid.php
CHANGED
@@ -9,7 +9,6 @@
|
|
9 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
10 |
* @license http://opensource.org/licenses/osl-3.0.php
|
11 |
*/
|
12 |
-
|
13 |
class Ebizmarts_MageMonkey_Block_Adminhtml_Bulksync_QueueExport_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
14 |
{
|
15 |
|
@@ -26,7 +25,7 @@ class Ebizmarts_MageMonkey_Block_Adminhtml_Bulksync_QueueExport_Grid extends Mag
|
|
26 |
protected function _prepareCollection()
|
27 |
{
|
28 |
$collection = Mage::getModel('monkey/bulksyncExport')
|
29 |
-
|
30 |
|
31 |
$this->setCollection($collection);
|
32 |
return parent::_prepareCollection();
|
@@ -35,27 +34,27 @@ class Ebizmarts_MageMonkey_Block_Adminhtml_Bulksync_QueueExport_Grid extends Mag
|
|
35 |
protected function _prepareColumns()
|
36 |
{
|
37 |
$this->addColumn('id', array(
|
38 |
-
'header'=> Mage::helper('monkey')->__('ID'),
|
39 |
'index' => 'id',
|
40 |
'type' => 'number'
|
41 |
));
|
42 |
|
43 |
$this->addColumn('data_source_entity', array(
|
44 |
-
'header'=> Mage::helper('monkey')->__('Entity'),
|
45 |
'index' => 'data_source_entity',
|
46 |
'filter' => false,
|
47 |
'sortable' => false,
|
48 |
));
|
49 |
|
50 |
$this->addColumn('status', array(
|
51 |
-
'header'=> Mage::helper('monkey')->__('Status'),
|
52 |
'index' => 'status',
|
53 |
-
'type'
|
54 |
'options' => Mage::getModel('monkey/system_config_source_bulksyncStatus')->toOption()
|
55 |
));
|
56 |
|
57 |
$this->addColumn('progress', array(
|
58 |
-
'header'=> Mage::helper('monkey')->__('Progress'),
|
59 |
'index' => 'progress',
|
60 |
'filter' => false,
|
61 |
'sortable' => false,
|
@@ -63,7 +62,7 @@ class Ebizmarts_MageMonkey_Block_Adminhtml_Bulksync_QueueExport_Grid extends Mag
|
|
63 |
));
|
64 |
|
65 |
$this->addColumn('lists', array(
|
66 |
-
'header'=> Mage::helper('monkey')->__('Lists'),
|
67 |
'index' => 'lists',
|
68 |
'filter' => false,
|
69 |
'sortable' => false,
|
@@ -71,21 +70,21 @@ class Ebizmarts_MageMonkey_Block_Adminhtml_Bulksync_QueueExport_Grid extends Mag
|
|
71 |
));
|
72 |
|
73 |
$this->addColumn('started_at', array(
|
74 |
-
'header'=> Mage::helper('monkey')->__('Started At'),
|
75 |
'index' => 'started_at',
|
76 |
-
'type'
|
77 |
));
|
78 |
|
79 |
$this->addColumn('updated_at', array(
|
80 |
-
'header'=> Mage::helper('monkey')->__('Updated At'),
|
81 |
'index' => 'updated_at',
|
82 |
-
'type'
|
83 |
));
|
84 |
|
85 |
$this->addColumn('created_at', array(
|
86 |
-
'header'=> Mage::helper('monkey')->__('Created At'),
|
87 |
'index' => 'created_at',
|
88 |
-
'type'
|
89 |
));
|
90 |
|
91 |
$views = Mage::getModel('core/store')->getCollection()->toOptionHash();
|
@@ -93,39 +92,39 @@ class Ebizmarts_MageMonkey_Block_Adminhtml_Bulksync_QueueExport_Grid extends Mag
|
|
93 |
|
94 |
$this->addColumn('store_id',
|
95 |
array(
|
96 |
-
'header'=> Mage::helper('monkey')->__('Store'),
|
97 |
'width' => '100px',
|
98 |
-
'sortable'
|
99 |
-
'filter'
|
100 |
-
'index'
|
101 |
-
'type'
|
102 |
-
'options'
|
103 |
-
|
104 |
|
105 |
$this->addColumn('action',
|
106 |
array(
|
107 |
-
'header'
|
108 |
-
'width'
|
109 |
-
'type'
|
110 |
-
'getter'
|
111 |
-
'actions'
|
112 |
array(
|
113 |
'caption' => Mage::helper('monkey')->__('Delete'),
|
114 |
-
'url'
|
115 |
-
'field'
|
116 |
'confirm' => Mage::helper('monkey')->__('Are you sure?')
|
117 |
),
|
118 |
array(
|
119 |
'caption' => Mage::helper('monkey')->__('Reset Status'),
|
120 |
-
'url'
|
121 |
-
'field'
|
122 |
'confirm' => Mage::helper('monkey')->__('Are you sure you want to reset status to IDLE?')
|
123 |
),
|
124 |
),
|
125 |
-
'filter'
|
126 |
-
'sortable'
|
127 |
'is_system' => true,
|
128 |
-
|
129 |
|
130 |
return parent::_prepareColumns();
|
131 |
}
|
9 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
10 |
* @license http://opensource.org/licenses/osl-3.0.php
|
11 |
*/
|
|
|
12 |
class Ebizmarts_MageMonkey_Block_Adminhtml_Bulksync_QueueExport_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
13 |
{
|
14 |
|
25 |
protected function _prepareCollection()
|
26 |
{
|
27 |
$collection = Mage::getModel('monkey/bulksyncExport')
|
28 |
+
->getCollection();
|
29 |
|
30 |
$this->setCollection($collection);
|
31 |
return parent::_prepareCollection();
|
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('data_source_entity', array(
|
43 |
+
'header' => Mage::helper('monkey')->__('Entity'),
|
44 |
'index' => 'data_source_entity',
|
45 |
'filter' => false,
|
46 |
'sortable' => false,
|
47 |
));
|
48 |
|
49 |
$this->addColumn('status', array(
|
50 |
+
'header' => Mage::helper('monkey')->__('Status'),
|
51 |
'index' => 'status',
|
52 |
+
'type' => 'options',
|
53 |
'options' => Mage::getModel('monkey/system_config_source_bulksyncStatus')->toOption()
|
54 |
));
|
55 |
|
56 |
$this->addColumn('progress', array(
|
57 |
+
'header' => Mage::helper('monkey')->__('Progress'),
|
58 |
'index' => 'progress',
|
59 |
'filter' => false,
|
60 |
'sortable' => false,
|
62 |
));
|
63 |
|
64 |
$this->addColumn('lists', array(
|
65 |
+
'header' => Mage::helper('monkey')->__('Lists'),
|
66 |
'index' => 'lists',
|
67 |
'filter' => false,
|
68 |
'sortable' => false,
|
70 |
));
|
71 |
|
72 |
$this->addColumn('started_at', array(
|
73 |
+
'header' => Mage::helper('monkey')->__('Started At'),
|
74 |
'index' => 'started_at',
|
75 |
+
'type' => 'datetime'
|
76 |
));
|
77 |
|
78 |
$this->addColumn('updated_at', array(
|
79 |
+
'header' => Mage::helper('monkey')->__('Updated At'),
|
80 |
'index' => 'updated_at',
|
81 |
+
'type' => 'datetime'
|
82 |
));
|
83 |
|
84 |
$this->addColumn('created_at', array(
|
85 |
+
'header' => Mage::helper('monkey')->__('Created At'),
|
86 |
'index' => 'created_at',
|
87 |
+
'type' => 'datetime'
|
88 |
));
|
89 |
|
90 |
$views = Mage::getModel('core/store')->getCollection()->toOptionHash();
|
92 |
|
93 |
$this->addColumn('store_id',
|
94 |
array(
|
95 |
+
'header' => Mage::helper('monkey')->__('Store'),
|
96 |
'width' => '100px',
|
97 |
+
'sortable' => false,
|
98 |
+
'filter' => false,
|
99 |
+
'index' => 'store_id',
|
100 |
+
'type' => 'options',
|
101 |
+
'options' => $views,
|
102 |
+
));
|
103 |
|
104 |
$this->addColumn('action',
|
105 |
array(
|
106 |
+
'header' => Mage::helper('monkey')->__('Action'),
|
107 |
+
'width' => '60px',
|
108 |
+
'type' => 'action',
|
109 |
+
'getter' => 'getId',
|
110 |
+
'actions' => array(
|
111 |
array(
|
112 |
'caption' => Mage::helper('monkey')->__('Delete'),
|
113 |
+
'url' => array('base' => '*/*/delete', 'params' => array('entity' => 'Export')),
|
114 |
+
'field' => 'job_id',
|
115 |
'confirm' => Mage::helper('monkey')->__('Are you sure?')
|
116 |
),
|
117 |
array(
|
118 |
'caption' => Mage::helper('monkey')->__('Reset Status'),
|
119 |
+
'url' => array('base' => '*/*/reset', 'params' => array('entity' => 'Export')),
|
120 |
+
'field' => 'job_id',
|
121 |
'confirm' => Mage::helper('monkey')->__('Are you sure you want to reset status to IDLE?')
|
122 |
),
|
123 |
),
|
124 |
+
'filter' => false,
|
125 |
+
'sortable' => false,
|
126 |
'is_system' => true,
|
127 |
+
));
|
128 |
|
129 |
return parent::_prepareColumns();
|
130 |
}
|
app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Bulksync/QueueImport.php
CHANGED
@@ -8,7 +8,6 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_MageMonkey_Block_Adminhtml_Bulksync_QueueImport extends Mage_Adminhtml_Block_Widget_Grid_Container
|
13 |
{
|
14 |
|
@@ -25,9 +24,9 @@ class Ebizmarts_MageMonkey_Block_Adminhtml_Bulksync_QueueImport extends Mage_Adm
|
|
25 |
|
26 |
protected function _prepareLayout()
|
27 |
{
|
28 |
-
$this->setChild(
|
29 |
-
$this->getLayout()->createBlock(
|
30 |
-
|
31 |
return Mage_Adminhtml_Block_Widget_Container::_prepareLayout();
|
32 |
}
|
33 |
|
@@ -39,7 +38,7 @@ class Ebizmarts_MageMonkey_Block_Adminhtml_Bulksync_QueueImport extends Mage_Adm
|
|
39 |
public function isSingleStoreMode()
|
40 |
{
|
41 |
if (!Mage::app()->isSingleStoreMode()) {
|
42 |
-
|
43 |
}
|
44 |
return true;
|
45 |
}
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_MageMonkey_Block_Adminhtml_Bulksync_QueueImport extends Mage_Adminhtml_Block_Widget_Grid_Container
|
12 |
{
|
13 |
|
24 |
|
25 |
protected function _prepareLayout()
|
26 |
{
|
27 |
+
$this->setChild('grid',
|
28 |
+
$this->getLayout()->createBlock($this->_blockGroup . '/' . $this->_controller . 'Import_grid',
|
29 |
+
$this->_controller . '.grid')->setSaveParametersInSession(true));
|
30 |
return Mage_Adminhtml_Block_Widget_Container::_prepareLayout();
|
31 |
}
|
32 |
|
38 |
public function isSingleStoreMode()
|
39 |
{
|
40 |
if (!Mage::app()->isSingleStoreMode()) {
|
41 |
+
return false;
|
42 |
}
|
43 |
return true;
|
44 |
}
|
app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Bulksync/QueueImport/Grid.php
CHANGED
@@ -9,7 +9,6 @@
|
|
9 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
10 |
* @license http://opensource.org/licenses/osl-3.0.php
|
11 |
*/
|
12 |
-
|
13 |
class Ebizmarts_MageMonkey_Block_Adminhtml_Bulksync_QueueImport_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
14 |
{
|
15 |
|
@@ -26,7 +25,7 @@ class Ebizmarts_MageMonkey_Block_Adminhtml_Bulksync_QueueImport_Grid extends Mag
|
|
26 |
protected function _prepareCollection()
|
27 |
{
|
28 |
$collection = Mage::getModel('monkey/bulksyncImport')
|
29 |
-
|
30 |
|
31 |
$this->setCollection($collection);
|
32 |
|
@@ -36,20 +35,20 @@ class Ebizmarts_MageMonkey_Block_Adminhtml_Bulksync_QueueImport_Grid extends Mag
|
|
36 |
protected function _prepareColumns()
|
37 |
{
|
38 |
$this->addColumn('id', array(
|
39 |
-
'header'=> Mage::helper('monkey')->__('ID'),
|
40 |
'index' => 'id',
|
41 |
'type' => 'number'
|
42 |
));
|
43 |
|
44 |
$this->addColumn('status', array(
|
45 |
-
'header'=> Mage::helper('monkey')->__('Status'),
|
46 |
'index' => 'status',
|
47 |
-
'type'
|
48 |
'options' => Mage::getModel('monkey/system_config_source_bulksyncStatus')->toOption()
|
49 |
));
|
50 |
|
51 |
$this->addColumn('progress', array(
|
52 |
-
'header'=> Mage::helper('monkey')->__('Progress'),
|
53 |
'index' => 'progress',
|
54 |
'filter' => false,
|
55 |
'sortable' => false,
|
@@ -57,7 +56,7 @@ class Ebizmarts_MageMonkey_Block_Adminhtml_Bulksync_QueueImport_Grid extends Mag
|
|
57 |
));
|
58 |
|
59 |
$this->addColumn('import_types', array(
|
60 |
-
'header'=> Mage::helper('monkey')->__('Import'),
|
61 |
'index' => 'import_types',
|
62 |
'filter' => false,
|
63 |
'sortable' => false,
|
@@ -65,7 +64,7 @@ class Ebizmarts_MageMonkey_Block_Adminhtml_Bulksync_QueueImport_Grid extends Mag
|
|
65 |
));
|
66 |
|
67 |
$this->addColumn('lists', array(
|
68 |
-
'header'=> Mage::helper('monkey')->__('Lists'),
|
69 |
'index' => 'lists',
|
70 |
'filter' => false,
|
71 |
'sortable' => false,
|
@@ -73,7 +72,7 @@ class Ebizmarts_MageMonkey_Block_Adminhtml_Bulksync_QueueImport_Grid extends Mag
|
|
73 |
));
|
74 |
|
75 |
$this->addColumn('create_customer', array(
|
76 |
-
'header'=> Mage::helper('monkey')->__('Create Customer'),
|
77 |
'index' => 'create_customer',
|
78 |
'filter' => false,
|
79 |
'sortable' => false,
|
@@ -81,7 +80,7 @@ class Ebizmarts_MageMonkey_Block_Adminhtml_Bulksync_QueueImport_Grid extends Mag
|
|
81 |
));
|
82 |
|
83 |
$this->addColumn('since', array(
|
84 |
-
'header'=> Mage::helper('monkey')->__('Retrieve Since'),
|
85 |
'index' => 'since',
|
86 |
'renderer' => 'Ebizmarts_MageMonkey_Block_Adminhtml_Renderer_Date',
|
87 |
'filter' => false,
|
@@ -89,47 +88,47 @@ class Ebizmarts_MageMonkey_Block_Adminhtml_Bulksync_QueueImport_Grid extends Mag
|
|
89 |
));
|
90 |
|
91 |
$this->addColumn('started_at', array(
|
92 |
-
'header'=> Mage::helper('monkey')->__('Started At'),
|
93 |
'index' => 'started_at',
|
94 |
-
'type'
|
95 |
));
|
96 |
|
97 |
$this->addColumn('updated_at', array(
|
98 |
-
'header'=> Mage::helper('monkey')->__('Updated At'),
|
99 |
'index' => 'updated_at',
|
100 |
-
'type'
|
101 |
));
|
102 |
|
103 |
$this->addColumn('created_at', array(
|
104 |
-
'header'=> Mage::helper('monkey')->__('Created At'),
|
105 |
'index' => 'created_at',
|
106 |
-
'type'
|
107 |
));
|
108 |
|
109 |
$this->addColumn('action',
|
110 |
array(
|
111 |
-
'header'
|
112 |
-
'width'
|
113 |
-
'type'
|
114 |
-
'getter'
|
115 |
-
'actions'
|
116 |
array(
|
117 |
'caption' => Mage::helper('monkey')->__('Delete'),
|
118 |
-
'url'
|
119 |
-
'field'
|
120 |
'confirm' => Mage::helper('monkey')->__('Are you sure?')
|
121 |
),
|
122 |
array(
|
123 |
'caption' => Mage::helper('monkey')->__('Reset Status'),
|
124 |
-
'url'
|
125 |
-
'field'
|
126 |
'confirm' => Mage::helper('monkey')->__('Are you sure you want to reset status to IDLE?')
|
127 |
),
|
128 |
),
|
129 |
-
'filter'
|
130 |
-
'sortable'
|
131 |
'is_system' => true,
|
132 |
-
|
133 |
|
134 |
return parent::_prepareColumns();
|
135 |
}
|
9 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
10 |
* @license http://opensource.org/licenses/osl-3.0.php
|
11 |
*/
|
|
|
12 |
class Ebizmarts_MageMonkey_Block_Adminhtml_Bulksync_QueueImport_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
13 |
{
|
14 |
|
25 |
protected function _prepareCollection()
|
26 |
{
|
27 |
$collection = Mage::getModel('monkey/bulksyncImport')
|
28 |
+
->getCollection();
|
29 |
|
30 |
$this->setCollection($collection);
|
31 |
|
35 |
protected function _prepareColumns()
|
36 |
{
|
37 |
$this->addColumn('id', array(
|
38 |
+
'header' => Mage::helper('monkey')->__('ID'),
|
39 |
'index' => 'id',
|
40 |
'type' => 'number'
|
41 |
));
|
42 |
|
43 |
$this->addColumn('status', array(
|
44 |
+
'header' => Mage::helper('monkey')->__('Status'),
|
45 |
'index' => 'status',
|
46 |
+
'type' => 'options',
|
47 |
'options' => Mage::getModel('monkey/system_config_source_bulksyncStatus')->toOption()
|
48 |
));
|
49 |
|
50 |
$this->addColumn('progress', array(
|
51 |
+
'header' => Mage::helper('monkey')->__('Progress'),
|
52 |
'index' => 'progress',
|
53 |
'filter' => false,
|
54 |
'sortable' => false,
|
56 |
));
|
57 |
|
58 |
$this->addColumn('import_types', array(
|
59 |
+
'header' => Mage::helper('monkey')->__('Import'),
|
60 |
'index' => 'import_types',
|
61 |
'filter' => false,
|
62 |
'sortable' => false,
|
64 |
));
|
65 |
|
66 |
$this->addColumn('lists', array(
|
67 |
+
'header' => Mage::helper('monkey')->__('Lists'),
|
68 |
'index' => 'lists',
|
69 |
'filter' => false,
|
70 |
'sortable' => false,
|
72 |
));
|
73 |
|
74 |
$this->addColumn('create_customer', array(
|
75 |
+
'header' => Mage::helper('monkey')->__('Create Customer'),
|
76 |
'index' => 'create_customer',
|
77 |
'filter' => false,
|
78 |
'sortable' => false,
|
80 |
));
|
81 |
|
82 |
$this->addColumn('since', array(
|
83 |
+
'header' => Mage::helper('monkey')->__('Retrieve Since'),
|
84 |
'index' => 'since',
|
85 |
'renderer' => 'Ebizmarts_MageMonkey_Block_Adminhtml_Renderer_Date',
|
86 |
'filter' => false,
|
88 |
));
|
89 |
|
90 |
$this->addColumn('started_at', array(
|
91 |
+
'header' => Mage::helper('monkey')->__('Started At'),
|
92 |
'index' => 'started_at',
|
93 |
+
'type' => 'datetime'
|
94 |
));
|
95 |
|
96 |
$this->addColumn('updated_at', array(
|
97 |
+
'header' => Mage::helper('monkey')->__('Updated At'),
|
98 |
'index' => 'updated_at',
|
99 |
+
'type' => 'datetime'
|
100 |
));
|
101 |
|
102 |
$this->addColumn('created_at', array(
|
103 |
+
'header' => Mage::helper('monkey')->__('Created At'),
|
104 |
'index' => 'created_at',
|
105 |
+
'type' => 'datetime'
|
106 |
));
|
107 |
|
108 |
$this->addColumn('action',
|
109 |
array(
|
110 |
+
'header' => Mage::helper('monkey')->__('Action'),
|
111 |
+
'width' => '60px',
|
112 |
+
'type' => 'action',
|
113 |
+
'getter' => 'getId',
|
114 |
+
'actions' => array(
|
115 |
array(
|
116 |
'caption' => Mage::helper('monkey')->__('Delete'),
|
117 |
+
'url' => array('base' => '*/*/delete', 'params' => array('entity' => 'Import')),
|
118 |
+
'field' => 'job_id',
|
119 |
'confirm' => Mage::helper('monkey')->__('Are you sure?')
|
120 |
),
|
121 |
array(
|
122 |
'caption' => Mage::helper('monkey')->__('Reset Status'),
|
123 |
+
'url' => array('base' => '*/*/reset', 'params' => array('entity' => 'Import')),
|
124 |
+
'field' => 'job_id',
|
125 |
'confirm' => Mage::helper('monkey')->__('Are you sure you want to reset status to IDLE?')
|
126 |
),
|
127 |
),
|
128 |
+
'filter' => false,
|
129 |
+
'sortable' => false,
|
130 |
'is_system' => true,
|
131 |
+
));
|
132 |
|
133 |
return parent::_prepareColumns();
|
134 |
}
|
app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Customer/Edit/Tab/Memberactivity.php
CHANGED
@@ -9,7 +9,6 @@
|
|
9 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
10 |
* @license http://opensource.org/licenses/osl-3.0.php
|
11 |
*/
|
12 |
-
|
13 |
class Ebizmarts_MageMonkey_Block_Adminhtml_Customer_Edit_Tab_Memberactivity
|
14 |
extends Ebizmarts_MageMonkey_Block_Adminhtml_Memberactivity_Grid
|
15 |
implements Mage_Adminhtml_Block_Widget_Tab_Interface
|
@@ -77,7 +76,7 @@ class Ebizmarts_MageMonkey_Block_Adminhtml_Customer_Edit_Tab_Memberactivity
|
|
77 |
*/
|
78 |
public function isHidden()
|
79 |
{
|
80 |
-
|
81 |
return false;
|
82 |
}
|
83 |
}
|
9 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
10 |
* @license http://opensource.org/licenses/osl-3.0.php
|
11 |
*/
|
|
|
12 |
class Ebizmarts_MageMonkey_Block_Adminhtml_Customer_Edit_Tab_Memberactivity
|
13 |
extends Ebizmarts_MageMonkey_Block_Adminhtml_Memberactivity_Grid
|
14 |
implements Mage_Adminhtml_Block_Widget_Tab_Interface
|
76 |
*/
|
77 |
public function isHidden()
|
78 |
{
|
79 |
+
//TODO: Hide if MageMonkey is disabled
|
80 |
return false;
|
81 |
}
|
82 |
}
|
app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Ecommerce.php
CHANGED
@@ -8,13 +8,12 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_MageMonkey_Block_Adminhtml_Ecommerce extends Mage_Adminhtml_Block_Widget_Grid_Container
|
13 |
{
|
14 |
|
15 |
public function __construct()
|
16 |
{
|
17 |
-
|
18 |
$this->_controller = 'adminhtml_ecommerce';
|
19 |
$this->_headerText = Mage::helper('monkey')->__('Ecommerce360 Sent Orders');
|
20 |
|
@@ -31,7 +30,7 @@ class Ebizmarts_MageMonkey_Block_Adminhtml_Ecommerce extends Mage_Adminhtml_Bloc
|
|
31 |
public function isSingleStoreMode()
|
32 |
{
|
33 |
if (!Mage::app()->isSingleStoreMode()) {
|
34 |
-
|
35 |
}
|
36 |
return true;
|
37 |
}
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_MageMonkey_Block_Adminhtml_Ecommerce extends Mage_Adminhtml_Block_Widget_Grid_Container
|
12 |
{
|
13 |
|
14 |
public function __construct()
|
15 |
{
|
16 |
+
$this->_blockGroup = 'monkey';
|
17 |
$this->_controller = 'adminhtml_ecommerce';
|
18 |
$this->_headerText = Mage::helper('monkey')->__('Ecommerce360 Sent Orders');
|
19 |
|
30 |
public function isSingleStoreMode()
|
31 |
{
|
32 |
if (!Mage::app()->isSingleStoreMode()) {
|
33 |
+
return false;
|
34 |
}
|
35 |
return true;
|
36 |
}
|
app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Ecommerce/Grid.php
CHANGED
@@ -8,7 +8,6 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_MageMonkey_Block_Adminhtml_Ecommerce_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
13 |
{
|
14 |
|
@@ -25,7 +24,7 @@ class Ebizmarts_MageMonkey_Block_Adminhtml_Ecommerce_Grid extends Mage_Adminhtml
|
|
25 |
protected function _prepareCollection()
|
26 |
{
|
27 |
$collection = Mage::getModel('monkey/ecommerce')
|
28 |
-
|
29 |
|
30 |
$this->setCollection($collection);
|
31 |
|
@@ -35,35 +34,35 @@ class Ebizmarts_MageMonkey_Block_Adminhtml_Ecommerce_Grid extends Mage_Adminhtml
|
|
35 |
protected function _prepareColumns()
|
36 |
{
|
37 |
$this->addColumn('id', array(
|
38 |
-
'header'=> Mage::helper('monkey')->__('ID'),
|
39 |
'width' => '80px',
|
40 |
'index' => 'id',
|
41 |
'type' => 'number'
|
42 |
));
|
43 |
|
44 |
$this->addColumn('order_increment_id', array(
|
45 |
-
'header'=> Mage::helper('monkey')->__('Order #'),
|
46 |
'width' => '80px',
|
47 |
'index' => 'order_increment_id',
|
48 |
));
|
49 |
|
50 |
$this->addColumn('mc_campaign_id', array(
|
51 |
-
'header'=> Mage::helper('monkey')->__('Campaign #'),
|
52 |
'width' => '80px',
|
53 |
'index' => 'mc_campaign_id'
|
54 |
));
|
55 |
|
56 |
$this->addColumn('mc_email_id', array(
|
57 |
-
'header'=> Mage::helper('monkey')->__('Email #'),
|
58 |
'width' => '80px',
|
59 |
'index' => 'mc_email_id'
|
60 |
));
|
61 |
|
62 |
$this->addColumn('created_at', array(
|
63 |
-
'header'=> Mage::helper('monkey')->__('Date Sent'),
|
64 |
'width' => '80px',
|
65 |
'index' => 'created_at',
|
66 |
-
'type'
|
67 |
));
|
68 |
|
69 |
return parent::_prepareColumns();
|
@@ -81,14 +80,14 @@ class Ebizmarts_MageMonkey_Block_Adminhtml_Ecommerce_Grid extends Mage_Adminhtml
|
|
81 |
|
82 |
protected function _prepareMassaction()
|
83 |
{
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
}
|
93 |
|
94 |
}
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_MageMonkey_Block_Adminhtml_Ecommerce_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
12 |
{
|
13 |
|
24 |
protected function _prepareCollection()
|
25 |
{
|
26 |
$collection = Mage::getModel('monkey/ecommerce')
|
27 |
+
->getCollection();
|
28 |
|
29 |
$this->setCollection($collection);
|
30 |
|
34 |
protected function _prepareColumns()
|
35 |
{
|
36 |
$this->addColumn('id', array(
|
37 |
+
'header' => Mage::helper('monkey')->__('ID'),
|
38 |
'width' => '80px',
|
39 |
'index' => 'id',
|
40 |
'type' => 'number'
|
41 |
));
|
42 |
|
43 |
$this->addColumn('order_increment_id', array(
|
44 |
+
'header' => Mage::helper('monkey')->__('Order #'),
|
45 |
'width' => '80px',
|
46 |
'index' => 'order_increment_id',
|
47 |
));
|
48 |
|
49 |
$this->addColumn('mc_campaign_id', array(
|
50 |
+
'header' => Mage::helper('monkey')->__('Campaign #'),
|
51 |
'width' => '80px',
|
52 |
'index' => 'mc_campaign_id'
|
53 |
));
|
54 |
|
55 |
$this->addColumn('mc_email_id', array(
|
56 |
+
'header' => Mage::helper('monkey')->__('Email #'),
|
57 |
'width' => '80px',
|
58 |
'index' => 'mc_email_id'
|
59 |
));
|
60 |
|
61 |
$this->addColumn('created_at', array(
|
62 |
+
'header' => Mage::helper('monkey')->__('Date Sent'),
|
63 |
'width' => '80px',
|
64 |
'index' => 'created_at',
|
65 |
+
'type' => 'datetime'
|
66 |
));
|
67 |
|
68 |
return parent::_prepareColumns();
|
80 |
|
81 |
protected function _prepareMassaction()
|
82 |
{
|
83 |
+
$this->setMassactionIdField('order_id');
|
84 |
+
$this->getMassactionBlock()->setFormFieldName('orders');
|
85 |
+
$this->getMassactionBlock()->addItem('delete', array(
|
86 |
+
'label' => Mage::helper('monkey')->__('Delete'),
|
87 |
+
'url' => $this->getUrl('*/*/massDelete', array('' => '')),
|
88 |
+
'confirm' => Mage::helper('tax')->__('Are you sure?')
|
89 |
+
));
|
90 |
+
return $this;
|
91 |
}
|
92 |
|
93 |
}
|
app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Ecommerceapi.php
CHANGED
@@ -8,13 +8,12 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_MageMonkey_Block_Adminhtml_Ecommerceapi extends Mage_Adminhtml_Block_Widget_Grid_Container
|
13 |
{
|
14 |
|
15 |
public function __construct()
|
16 |
{
|
17 |
-
|
18 |
$this->_controller = 'adminhtml_ecommerceapi';
|
19 |
$this->_headerText = Mage::helper('monkey')->__('Ecommerce360 API Orders');
|
20 |
|
@@ -31,7 +30,7 @@ class Ebizmarts_MageMonkey_Block_Adminhtml_Ecommerceapi extends Mage_Adminhtml_B
|
|
31 |
public function isSingleStoreMode()
|
32 |
{
|
33 |
if (!Mage::app()->isSingleStoreMode()) {
|
34 |
-
|
35 |
}
|
36 |
return true;
|
37 |
}
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_MageMonkey_Block_Adminhtml_Ecommerceapi extends Mage_Adminhtml_Block_Widget_Grid_Container
|
12 |
{
|
13 |
|
14 |
public function __construct()
|
15 |
{
|
16 |
+
$this->_blockGroup = 'monkey';
|
17 |
$this->_controller = 'adminhtml_ecommerceapi';
|
18 |
$this->_headerText = Mage::helper('monkey')->__('Ecommerce360 API Orders');
|
19 |
|
30 |
public function isSingleStoreMode()
|
31 |
{
|
32 |
if (!Mage::app()->isSingleStoreMode()) {
|
33 |
+
return false;
|
34 |
}
|
35 |
return true;
|
36 |
}
|
app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Ecommerceapi/Grid.php
CHANGED
@@ -8,7 +8,6 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_MageMonkey_Block_Adminhtml_Ecommerceapi_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
13 |
{
|
14 |
|
@@ -30,7 +29,7 @@ class Ebizmarts_MageMonkey_Block_Adminhtml_Ecommerceapi_Grid extends Mage_Adminh
|
|
30 |
{
|
31 |
$orders = array();
|
32 |
|
33 |
-
foreach(Mage::app()->getStores() as $storeId => $store){
|
34 |
$api = Mage::getModel('monkey/api', array('store' => $storeId));
|
35 |
$result = $api->ecommOrders(0, 500);
|
36 |
$orders += $result['data'];
|
@@ -46,39 +45,39 @@ class Ebizmarts_MageMonkey_Block_Adminhtml_Ecommerceapi_Grid extends Mage_Adminh
|
|
46 |
protected function _prepareColumns()
|
47 |
{
|
48 |
$this->addColumn('store_id', array(
|
49 |
-
'header'=> Mage::helper('monkey')->__('Store ID'),
|
50 |
'index' => 'store_id',
|
51 |
));
|
52 |
$this->addColumn('store_name', array(
|
53 |
-
'header'=> Mage::helper('monkey')->__('Store Name'),
|
54 |
'index' => 'store_name',
|
55 |
));
|
56 |
$this->addColumn('order_id', array(
|
57 |
-
'header'=> Mage::helper('monkey')->__('Order #'),
|
58 |
'index' => 'order_id',
|
59 |
));
|
60 |
$this->addColumn('email', array(
|
61 |
-
'header'=> Mage::helper('monkey')->__('Email'),
|
62 |
'index' => 'email',
|
63 |
));
|
64 |
$this->addColumn('order_total', array(
|
65 |
-
'header'=> Mage::helper('monkey')->__('Order Total'),
|
66 |
'index' => 'order_total',
|
67 |
));
|
68 |
$this->addColumn('tax_total', array(
|
69 |
-
'header'=> Mage::helper('monkey')->__('Tax Total'),
|
70 |
'index' => 'tax_total',
|
71 |
));
|
72 |
$this->addColumn('ship_total', array(
|
73 |
-
'header'=> Mage::helper('monkey')->__('Ship Total'),
|
74 |
'index' => 'ship_total',
|
75 |
));
|
76 |
$this->addColumn('order_date', array(
|
77 |
-
'header'=> Mage::helper('monkey')->__('Order Date'),
|
78 |
'index' => 'order_date',
|
79 |
));
|
80 |
$this->addColumn('items', array(
|
81 |
-
'header'=> Mage::helper('monkey')->__('Items'),
|
82 |
'index' => 'items',
|
83 |
'renderer' => 'monkey/adminhtml_ecommerceapi_renderer_items'
|
84 |
));
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_MageMonkey_Block_Adminhtml_Ecommerceapi_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
12 |
{
|
13 |
|
29 |
{
|
30 |
$orders = array();
|
31 |
|
32 |
+
foreach (Mage::app()->getStores() as $storeId => $store) {
|
33 |
$api = Mage::getModel('monkey/api', array('store' => $storeId));
|
34 |
$result = $api->ecommOrders(0, 500);
|
35 |
$orders += $result['data'];
|
45 |
protected function _prepareColumns()
|
46 |
{
|
47 |
$this->addColumn('store_id', array(
|
48 |
+
'header' => Mage::helper('monkey')->__('Store ID'),
|
49 |
'index' => 'store_id',
|
50 |
));
|
51 |
$this->addColumn('store_name', array(
|
52 |
+
'header' => Mage::helper('monkey')->__('Store Name'),
|
53 |
'index' => 'store_name',
|
54 |
));
|
55 |
$this->addColumn('order_id', array(
|
56 |
+
'header' => Mage::helper('monkey')->__('Order #'),
|
57 |
'index' => 'order_id',
|
58 |
));
|
59 |
$this->addColumn('email', array(
|
60 |
+
'header' => Mage::helper('monkey')->__('Email'),
|
61 |
'index' => 'email',
|
62 |
));
|
63 |
$this->addColumn('order_total', array(
|
64 |
+
'header' => Mage::helper('monkey')->__('Order Total'),
|
65 |
'index' => 'order_total',
|
66 |
));
|
67 |
$this->addColumn('tax_total', array(
|
68 |
+
'header' => Mage::helper('monkey')->__('Tax Total'),
|
69 |
'index' => 'tax_total',
|
70 |
));
|
71 |
$this->addColumn('ship_total', array(
|
72 |
+
'header' => Mage::helper('monkey')->__('Ship Total'),
|
73 |
'index' => 'ship_total',
|
74 |
));
|
75 |
$this->addColumn('order_date', array(
|
76 |
+
'header' => Mage::helper('monkey')->__('Order Date'),
|
77 |
'index' => 'order_date',
|
78 |
));
|
79 |
$this->addColumn('items', array(
|
80 |
+
'header' => Mage::helper('monkey')->__('Items'),
|
81 |
'index' => 'items',
|
82 |
'renderer' => 'monkey/adminhtml_ecommerceapi_renderer_items'
|
83 |
));
|
app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Ecommerceapi/Renderer/Items.php
CHANGED
@@ -8,7 +8,6 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_MageMonkey_Block_Adminhtml_Ecommerceapi_Renderer_Items extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
13 |
{
|
14 |
|
@@ -17,8 +16,8 @@ class Ebizmarts_MageMonkey_Block_Adminhtml_Ecommerceapi_Renderer_Items extends M
|
|
17 |
$lines = $row->getLines();
|
18 |
|
19 |
$skus = array();
|
20 |
-
foreach($lines as $item){
|
21 |
-
$skus []= $item['product_sku'] . ' [' . $item['qty'] . ']';
|
22 |
}
|
23 |
|
24 |
return implode(', ', $skus);
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_MageMonkey_Block_Adminhtml_Ecommerceapi_Renderer_Items extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
12 |
{
|
13 |
|
16 |
$lines = $row->getLines();
|
17 |
|
18 |
$skus = array();
|
19 |
+
foreach ($lines as $item) {
|
20 |
+
$skus [] = $item['product_sku'] . ' [' . $item['qty'] . ']';
|
21 |
}
|
22 |
|
23 |
return implode(', ', $skus);
|
app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Memberactivity/Grid.php
CHANGED
@@ -8,7 +8,6 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_MageMonkey_Block_Adminhtml_Memberactivity_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
13 |
{
|
14 |
|
@@ -22,38 +21,38 @@ class Ebizmarts_MageMonkey_Block_Adminhtml_Memberactivity_Grid extends Mage_Admi
|
|
22 |
|
23 |
protected function _prepareCollection()
|
24 |
{
|
25 |
-
|
26 |
-
|
27 |
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
|
56 |
-
|
57 |
$this->setCollection($collection);
|
58 |
return parent::_prepareCollection();
|
59 |
}
|
@@ -62,27 +61,27 @@ class Ebizmarts_MageMonkey_Block_Adminhtml_Memberactivity_Grid extends Mage_Admi
|
|
62 |
{
|
63 |
|
64 |
$this->addColumn('action', array(
|
65 |
-
'header'=> Mage::helper('monkey')->__('Action'),
|
66 |
'index' => 'action',
|
67 |
'sortable' => false
|
68 |
));
|
69 |
$this->addColumn('url', array(
|
70 |
-
'header'=> Mage::helper('monkey')->__('Url'),
|
71 |
'index' => 'url',
|
72 |
'sortable' => false
|
73 |
));
|
74 |
$this->addColumn('bounce_type', array(
|
75 |
-
'header'=> Mage::helper('monkey')->__('Bounce Type'),
|
76 |
'index' => 'bounce_type',
|
77 |
'sortable' => false
|
78 |
));
|
79 |
$this->addColumn('campaign_id', array(
|
80 |
-
'header'=> Mage::helper('monkey')->__('Campaign ID'),
|
81 |
'index' => 'campaign_id',
|
82 |
'sortable' => false
|
83 |
));
|
84 |
$this->addColumn('timestamp', array(
|
85 |
-
'header'=> Mage::helper('monkey')->__('Timestamp'),
|
86 |
'index' => 'timestamp',
|
87 |
'sortable' => false
|
88 |
));
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_MageMonkey_Block_Adminhtml_Memberactivity_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
12 |
{
|
13 |
|
21 |
|
22 |
protected function _prepareCollection()
|
23 |
{
|
24 |
+
$customer = Mage::registry('current_customer');
|
25 |
+
$email = $customer->getEmail();
|
26 |
|
27 |
+
$api = Mage::getSingleton('monkey/api', array('apikey' => Mage::helper('monkey')->getApiKey($customer->getStore())));
|
28 |
+
$activity = array();
|
29 |
+
$lists = $api->listsForEmail($email);
|
30 |
|
31 |
+
$activityData = array();
|
32 |
+
if (is_array($lists)) {
|
33 |
+
foreach ($lists as $list) {
|
34 |
+
$activity [] = $api->listMemberActivity($list, $email);
|
35 |
+
}
|
36 |
+
if (!empty($activity)) {
|
37 |
+
foreach ($activity as $act) {
|
38 |
|
39 |
+
if (empty($act['data'][0])) {
|
40 |
+
continue;
|
41 |
+
}
|
42 |
+
$activityData [] = $act['data'];
|
43 |
+
}
|
44 |
+
}
|
45 |
+
}
|
46 |
+
if (empty($activityData)) {
|
47 |
+
$activityData[] = array('action' => '', 'timestamp' => '', 'url' => '', 'bounce_type' => '', 'campaign_id' => '');
|
48 |
+
}
|
49 |
+
if (!is_array(current($activityData))) {
|
50 |
+
$activityData = array();
|
51 |
+
} else {
|
52 |
+
$activityData = current($activityData);
|
53 |
+
}
|
54 |
|
55 |
+
$collection = Mage::getModel('monkey/custom_collection', $activityData);
|
56 |
$this->setCollection($collection);
|
57 |
return parent::_prepareCollection();
|
58 |
}
|
61 |
{
|
62 |
|
63 |
$this->addColumn('action', array(
|
64 |
+
'header' => Mage::helper('monkey')->__('Action'),
|
65 |
'index' => 'action',
|
66 |
'sortable' => false
|
67 |
));
|
68 |
$this->addColumn('url', array(
|
69 |
+
'header' => Mage::helper('monkey')->__('Url'),
|
70 |
'index' => 'url',
|
71 |
'sortable' => false
|
72 |
));
|
73 |
$this->addColumn('bounce_type', array(
|
74 |
+
'header' => Mage::helper('monkey')->__('Bounce Type'),
|
75 |
'index' => 'bounce_type',
|
76 |
'sortable' => false
|
77 |
));
|
78 |
$this->addColumn('campaign_id', array(
|
79 |
+
'header' => Mage::helper('monkey')->__('Campaign ID'),
|
80 |
'index' => 'campaign_id',
|
81 |
'sortable' => false
|
82 |
));
|
83 |
$this->addColumn('timestamp', array(
|
84 |
+
'header' => Mage::helper('monkey')->__('Timestamp'),
|
85 |
'index' => 'timestamp',
|
86 |
'sortable' => false
|
87 |
));
|
app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Renderer/Date.php
CHANGED
@@ -8,7 +8,6 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_MageMonkey_Block_Adminhtml_Renderer_Date extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
13 |
{
|
14 |
/**
|
@@ -19,7 +18,7 @@ class Ebizmarts_MageMonkey_Block_Adminhtml_Renderer_Date extends Mage_Adminhtml_
|
|
19 |
*/
|
20 |
public function render(Varien_Object $row)
|
21 |
{
|
22 |
-
|
23 |
|
24 |
return ($value ? str_replace('00:00:00', '', $value) : '');
|
25 |
}
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_MageMonkey_Block_Adminhtml_Renderer_Date extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
12 |
{
|
13 |
/**
|
18 |
*/
|
19 |
public function render(Varien_Object $row)
|
20 |
{
|
21 |
+
$value = $this->_getValue($row);
|
22 |
|
23 |
return ($value ? str_replace('00:00:00', '', $value) : '');
|
24 |
}
|
app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Renderer/Importypes.php
CHANGED
@@ -8,7 +8,6 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_MageMonkey_Block_Adminhtml_Renderer_Importypes extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
13 |
{
|
14 |
/**
|
@@ -19,7 +18,7 @@ class Ebizmarts_MageMonkey_Block_Adminhtml_Renderer_Importypes extends Mage_Admi
|
|
19 |
*/
|
20 |
public function render(Varien_Object $row)
|
21 |
{
|
22 |
-
|
23 |
|
24 |
return implode(', ', $row->statuses());
|
25 |
}
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_MageMonkey_Block_Adminhtml_Renderer_Importypes extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
12 |
{
|
13 |
/**
|
18 |
*/
|
19 |
public function render(Varien_Object $row)
|
20 |
{
|
21 |
+
$value = $this->_getValue($row);
|
22 |
|
23 |
return implode(', ', $row->statuses());
|
24 |
}
|
app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Renderer/Lists.php
CHANGED
@@ -8,7 +8,6 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_MageMonkey_Block_Adminhtml_Renderer_Lists extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
13 |
{
|
14 |
/**
|
@@ -19,18 +18,18 @@ class Ebizmarts_MageMonkey_Block_Adminhtml_Renderer_Lists extends Mage_Adminhtml
|
|
19 |
*/
|
20 |
public function render(Varien_Object $row)
|
21 |
{
|
22 |
-
|
23 |
|
24 |
-
|
25 |
-
|
26 |
|
27 |
-
|
28 |
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
|
35 |
return implode(', ', $listsNames);
|
36 |
}
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_MageMonkey_Block_Adminhtml_Renderer_Lists extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
12 |
{
|
13 |
/**
|
18 |
*/
|
19 |
public function render(Varien_Object $row)
|
20 |
{
|
21 |
+
$value = $this->_getValue($row);
|
22 |
|
23 |
+
$lists = Mage::getSingleton('monkey/api')
|
24 |
+
->lists(array('list_id' => implode(', ', $row->lists())));
|
25 |
|
26 |
+
$listsNames = array();
|
27 |
|
28 |
+
if (is_array($lists)) {
|
29 |
+
foreach ($lists['data'] as $list) {
|
30 |
+
$listsNames [] = $list['name'];
|
31 |
+
}
|
32 |
+
}
|
33 |
|
34 |
return implode(', ', $listsNames);
|
35 |
}
|
app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Renderer/Progress.php
CHANGED
@@ -8,7 +8,6 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_MageMonkey_Block_Adminhtml_Renderer_Progress extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
13 |
{
|
14 |
/**
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_MageMonkey_Block_Adminhtml_Renderer_Progress extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
12 |
{
|
13 |
/**
|
app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Renderer/Yesno.php
CHANGED
@@ -8,7 +8,6 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_MageMonkey_Block_Adminhtml_Renderer_Yesno extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
13 |
{
|
14 |
/**
|
@@ -19,7 +18,7 @@ class Ebizmarts_MageMonkey_Block_Adminhtml_Renderer_Yesno extends Mage_Adminhtml
|
|
19 |
*/
|
20 |
public function render(Varien_Object $row)
|
21 |
{
|
22 |
-
|
23 |
|
24 |
return ($value == 1 ? Mage::helper('monkey')->__('Yes') : Mage::helper('monkey')->__('No'));
|
25 |
}
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_MageMonkey_Block_Adminhtml_Renderer_Yesno extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
12 |
{
|
13 |
/**
|
18 |
*/
|
19 |
public function render(Varien_Object $row)
|
20 |
{
|
21 |
+
$value = $this->_getValue($row);
|
22 |
|
23 |
return ($value == 1 ? Mage::helper('monkey')->__('Yes') : Mage::helper('monkey')->__('No'));
|
24 |
}
|
app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/System/Config/Account.php
CHANGED
@@ -8,21 +8,20 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_MageMonkey_Block_Adminhtml_System_Config_Account
|
13 |
extends Mage_Adminhtml_Block_System_Config_Form_Field
|
14 |
{
|
15 |
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
16 |
{
|
17 |
-
|
18 |
|
19 |
-
|
20 |
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
|
25 |
-
|
26 |
|
27 |
return $html;
|
28 |
}
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_MageMonkey_Block_Adminhtml_System_Config_Account
|
12 |
extends Mage_Adminhtml_Block_System_Config_Form_Field
|
13 |
{
|
14 |
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
15 |
{
|
16 |
+
$values = $element->getValues();
|
17 |
|
18 |
+
$html = '<ul class="checkboxes">';
|
19 |
|
20 |
+
foreach ($values as $dat) {
|
21 |
+
$html .= "<li>{$dat['label']}</li>";
|
22 |
+
}
|
23 |
|
24 |
+
$html .= '</ul>';
|
25 |
|
26 |
return $html;
|
27 |
}
|
app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/System/Config/Date.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* Author : Ebizmarts <info@ebizmarts.com>
|
4 |
* Date : 8/18/14
|
1 |
<?php
|
2 |
+
|
3 |
/**
|
4 |
* Author : Ebizmarts <info@ebizmarts.com>
|
5 |
* Date : 8/18/14
|
app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/System/Config/Fieldset/Hint.php
CHANGED
@@ -7,7 +7,6 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_MageMonkey_Block_Adminhtml_System_Config_Fieldset_Hint
|
12 |
extends Mage_Adminhtml_Block_Abstract
|
13 |
implements Varien_Data_Form_Element_Renderer_Interface
|
@@ -27,26 +26,27 @@ class Ebizmarts_MageMonkey_Block_Adminhtml_System_Config_Fieldset_Hint
|
|
27 |
|
28 |
public function getMageMonkeyVersion()
|
29 |
{
|
30 |
-
|
31 |
-
}
|
32 |
-
|
33 |
-
public function getPxParams() {
|
34 |
-
$plan = Mage::getSingleton('monkey/api')->getAccountDetails();
|
35 |
-
if(!is_array($plan)||!isset($plan['plan_type'])) {
|
36 |
-
$plan = array();
|
37 |
-
$plan['plan_type'] = '';
|
38 |
}
|
39 |
-
$v = (string)Mage::getConfig()->getNode('modules/Ebizmarts_MageMonkey/version');
|
40 |
-
$ext = "MageMonkey;{$v} ".$plan['plan_type'];
|
41 |
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
|
51 |
}
|
52 |
}
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_MageMonkey_Block_Adminhtml_System_Config_Fieldset_Hint
|
11 |
extends Mage_Adminhtml_Block_Abstract
|
12 |
implements Varien_Data_Form_Element_Renderer_Interface
|
26 |
|
27 |
public function getMageMonkeyVersion()
|
28 |
{
|
29 |
+
return (string)Mage::getConfig()->getNode('modules/Ebizmarts_MageMonkey/version');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
}
|
|
|
|
|
31 |
|
32 |
+
public function getPxParams()
|
33 |
+
{
|
34 |
+
$plan = Mage::getSingleton('monkey/api')->getAccountDetails();
|
35 |
+
if (!is_array($plan) || !isset($plan['plan_type'])) {
|
36 |
+
$plan = array();
|
37 |
+
$plan['plan_type'] = '';
|
38 |
+
}
|
39 |
+
$v = (string)Mage::getConfig()->getNode('modules/Ebizmarts_MageMonkey/version');
|
40 |
+
$ext = "MageMonkey;{$v} " . $plan['plan_type'];
|
41 |
+
|
42 |
+
$modulesArray = (array)Mage::getConfig()->getNode('modules')->children();
|
43 |
+
$aux = (array_key_exists('Enterprise_Enterprise', $modulesArray)) ? 'EE' : 'CE';
|
44 |
+
$mageVersion = Mage::getVersion();
|
45 |
+
$mage = "Magento {$aux};{$mageVersion}";
|
46 |
+
|
47 |
+
$hash = md5($ext . '_' . $mage . '_' . $ext);
|
48 |
+
|
49 |
+
return "ext=$ext&mage={$mage}&ctrl={$hash}";
|
50 |
|
51 |
}
|
52 |
}
|
app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/System/Config/Form/Field/Mapfields.php
CHANGED
@@ -9,7 +9,6 @@
|
|
9 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
10 |
* @license http://opensource.org/licenses/osl-3.0.php
|
11 |
*/
|
12 |
-
|
13 |
class Ebizmarts_MageMonkey_Block_Adminhtml_System_Config_Form_Field_Mapfields extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
|
14 |
{
|
15 |
|
9 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
10 |
* @license http://opensource.org/licenses/osl-3.0.php
|
11 |
*/
|
|
|
12 |
class Ebizmarts_MageMonkey_Block_Adminhtml_System_Config_Form_Field_Mapfields extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
|
13 |
{
|
14 |
|
app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/System/Config/OauthWizard.php
CHANGED
@@ -8,13 +8,14 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
-
|
13 |
|
14 |
/**
|
15 |
* Set template to itself
|
16 |
*/
|
17 |
-
protected function _prepareLayout()
|
|
|
18 |
parent::_prepareLayout();
|
19 |
if (!$this->getTemplate()) {
|
20 |
$this->setTemplate('magemonkey/system/config/oauth_wizard.phtml');
|
@@ -28,7 +29,8 @@ class Ebizmarts_MageMonkey_Block_Adminhtml_System_Config_OauthWizard extends Mag
|
|
28 |
* @param Varien_Data_Form_Element_Abstract $element
|
29 |
* @return string
|
30 |
*/
|
31 |
-
public function render(Varien_Data_Form_Element_Abstract $element)
|
|
|
32 |
$element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue();
|
33 |
return parent::render($element);
|
34 |
}
|
@@ -39,21 +41,22 @@ class Ebizmarts_MageMonkey_Block_Adminhtml_System_Config_OauthWizard extends Mag
|
|
39 |
* @param Varien_Data_Form_Element_Abstract $element
|
40 |
* @return string
|
41 |
*/
|
42 |
-
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
|
|
43 |
$originalData = $element->getOriginalData();
|
44 |
-
|
45 |
$label = $originalData['button_label'];
|
46 |
-
|
47 |
//Check if api key works
|
48 |
$ping = Mage::getModel('monkey/api');
|
49 |
$ping->ping();
|
50 |
-
if(!$ping->errorCode){
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
$this->addData(array(
|
55 |
'button_label' => $this->helper('monkey')->__($label),
|
56 |
-
'button_url'
|
57 |
'html_id' => $element->getHtmlId(),
|
58 |
));
|
59 |
return $this->_toHtml();
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
+
class Ebizmarts_MageMonkey_Block_Adminhtml_System_Config_OauthWizard extends Mage_Adminhtml_Block_System_Config_Form_Field
|
12 |
+
{
|
13 |
|
14 |
/**
|
15 |
* Set template to itself
|
16 |
*/
|
17 |
+
protected function _prepareLayout()
|
18 |
+
{
|
19 |
parent::_prepareLayout();
|
20 |
if (!$this->getTemplate()) {
|
21 |
$this->setTemplate('magemonkey/system/config/oauth_wizard.phtml');
|
29 |
* @param Varien_Data_Form_Element_Abstract $element
|
30 |
* @return string
|
31 |
*/
|
32 |
+
public function render(Varien_Data_Form_Element_Abstract $element)
|
33 |
+
{
|
34 |
$element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue();
|
35 |
return parent::render($element);
|
36 |
}
|
41 |
* @param Varien_Data_Form_Element_Abstract $element
|
42 |
* @return string
|
43 |
*/
|
44 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
45 |
+
{
|
46 |
$originalData = $element->getOriginalData();
|
47 |
+
|
48 |
$label = $originalData['button_label'];
|
49 |
+
|
50 |
//Check if api key works
|
51 |
$ping = Mage::getModel('monkey/api');
|
52 |
$ping->ping();
|
53 |
+
if (!$ping->errorCode) {
|
54 |
+
$label = "Change API credentials";
|
55 |
+
}
|
56 |
+
|
57 |
$this->addData(array(
|
58 |
'button_label' => $this->helper('monkey')->__($label),
|
59 |
+
'button_url' => $this->helper('monkey/oauth2')->authorizeRequestUrl(),
|
60 |
'html_id' => $element->getHtmlId(),
|
61 |
));
|
62 |
return $this->_toHtml();
|
app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/System/Config/ResetLocalEcommerce.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* Author : Ebizmarts <info@ebizmarts.com>
|
4 |
* Date : 8/18/14
|
@@ -27,7 +28,7 @@ class Ebizmarts_MageMonkey_Block_Adminhtml_System_Config_ResetLocalEcommerce ext
|
|
27 |
public function getAjaxCheckUrl()
|
28 |
{
|
29 |
$store = $this->getRequest()->getParam('store');
|
30 |
-
return Mage::helper('adminhtml')->getUrl('monkey/adminhtml_ecommerce/resetLocalEcommerce/store/'
|
31 |
}
|
32 |
|
33 |
/**
|
@@ -39,9 +40,9 @@ class Ebizmarts_MageMonkey_Block_Adminhtml_System_Config_ResetLocalEcommerce ext
|
|
39 |
{
|
40 |
$button = $this->getLayout()->createBlock('adminhtml/widget_button')
|
41 |
->setData(array(
|
42 |
-
'id'
|
43 |
-
'label'
|
44 |
-
'onclick'
|
45 |
));
|
46 |
|
47 |
return $button->toHtml();
|
1 |
<?php
|
2 |
+
|
3 |
/**
|
4 |
* Author : Ebizmarts <info@ebizmarts.com>
|
5 |
* Date : 8/18/14
|
28 |
public function getAjaxCheckUrl()
|
29 |
{
|
30 |
$store = $this->getRequest()->getParam('store');
|
31 |
+
return Mage::helper('adminhtml')->getUrl('monkey/adminhtml_ecommerce/resetLocalEcommerce/store/' . $store);
|
32 |
}
|
33 |
|
34 |
/**
|
40 |
{
|
41 |
$button = $this->getLayout()->createBlock('adminhtml/widget_button')
|
42 |
->setData(array(
|
43 |
+
'id' => 'resetecommerce_button',
|
44 |
+
'label' => $this->helper('monkey')->__('Reset Local Orders Ecommerce360'),
|
45 |
+
'onclick' => 'javascript:check(); return false;'
|
46 |
));
|
47 |
|
48 |
return $button->toHtml();
|
app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/System/Config/ResetRemoteEcommerce.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* Author : Ebizmarts <info@ebizmarts.com>
|
4 |
* Date : 8/19/14
|
@@ -27,7 +28,7 @@ class Ebizmarts_MageMonkey_Block_Adminhtml_System_Config_ResetRemoteEcommerce ex
|
|
27 |
public function getAjaxCheckUrl()
|
28 |
{
|
29 |
$store = $this->getRequest()->getParam('store');
|
30 |
-
return Mage::helper('adminhtml')->getUrl('monkey/adminhtml_ecommerce/resetRemoteEcommerce/store/'
|
31 |
}
|
32 |
|
33 |
/**
|
@@ -39,9 +40,9 @@ class Ebizmarts_MageMonkey_Block_Adminhtml_System_Config_ResetRemoteEcommerce ex
|
|
39 |
{
|
40 |
$button = $this->getLayout()->createBlock('adminhtml/widget_button')
|
41 |
->setData(array(
|
42 |
-
'id'
|
43 |
-
'label'
|
44 |
-
'onclick'
|
45 |
));
|
46 |
|
47 |
return $button->toHtml();
|
1 |
<?php
|
2 |
+
|
3 |
/**
|
4 |
* Author : Ebizmarts <info@ebizmarts.com>
|
5 |
* Date : 8/19/14
|
28 |
public function getAjaxCheckUrl()
|
29 |
{
|
30 |
$store = $this->getRequest()->getParam('store');
|
31 |
+
return Mage::helper('adminhtml')->getUrl('monkey/adminhtml_ecommerce/resetRemoteEcommerce/store/' . $store);
|
32 |
}
|
33 |
|
34 |
/**
|
40 |
{
|
41 |
$button = $this->getLayout()->createBlock('adminhtml/widget_button')
|
42 |
->setData(array(
|
43 |
+
'id' => 'resetecommerce_button',
|
44 |
+
'label' => $this->helper('monkey')->__('Reset Remote Orders Ecommerce360'),
|
45 |
+
'onclick' => 'javascript:check2(); return false;'
|
46 |
));
|
47 |
|
48 |
return $button->toHtml();
|
app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Transactionalemail/Mandrill.php
CHANGED
@@ -8,7 +8,6 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_MageMonkey_Block_Adminhtml_Transactionalemail_Mandrill extends Mage_Adminhtml_Block_Widget_Grid_Container
|
13 |
{
|
14 |
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_MageMonkey_Block_Adminhtml_Transactionalemail_Mandrill extends Mage_Adminhtml_Block_Widget_Grid_Container
|
12 |
{
|
13 |
|
app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Transactionalemail/Mandrill/Grid.php
CHANGED
@@ -8,7 +8,6 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_MageMonkey_Block_Adminhtml_Transactionalemail_Mandrill_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
13 |
{
|
14 |
|
@@ -24,24 +23,24 @@ class Ebizmarts_MageMonkey_Block_Adminhtml_Transactionalemail_Mandrill_Grid exte
|
|
24 |
|
25 |
protected function _prepareCollection()
|
26 |
{
|
27 |
-
|
28 |
$mail = Ebizmarts_MageMonkey_Model_TransactionalEmail_Adapter::factory('mandrill')
|
29 |
-
|
30 |
-
|
31 |
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
|
46 |
$this->setCollection($collection);
|
47 |
return parent::_prepareCollection();
|
@@ -50,19 +49,19 @@ class Ebizmarts_MageMonkey_Block_Adminhtml_Transactionalemail_Mandrill_Grid exte
|
|
50 |
protected function _prepareColumns()
|
51 |
{
|
52 |
$this->addColumn('email', array(
|
53 |
-
'header'=> Mage::helper('monkey')->__('Email Address'),
|
54 |
'index' => 'email',
|
55 |
'filter' => false,
|
56 |
'sortable' => false
|
57 |
));
|
58 |
$this->addColumn('enabled', array(
|
59 |
-
'header'=> Mage::helper('monkey')->__('Enabled'),
|
60 |
'index' => 'enabled',
|
61 |
'filter' => false,
|
62 |
'sortable' => false
|
63 |
));
|
64 |
$this->addColumn('created_at', array(
|
65 |
-
'header'=> Mage::helper('monkey')->__('Created At'),
|
66 |
'index' => 'created_at',
|
67 |
'filter' => false,
|
68 |
'sortable' => false
|
@@ -70,24 +69,24 @@ class Ebizmarts_MageMonkey_Block_Adminhtml_Transactionalemail_Mandrill_Grid exte
|
|
70 |
|
71 |
$this->addColumn('action',
|
72 |
array(
|
73 |
-
'header'
|
74 |
-
'width'
|
75 |
-
'type'
|
76 |
-
'getter'
|
77 |
-
'actions'
|
78 |
array(
|
79 |
'caption' => Mage::helper('monkey')->__('Disable'),
|
80 |
'confirm' => Mage::helper('monkey')->__('This action takes immediate effect, so use it with care.'),
|
81 |
-
'url'
|
82 |
'base' => '*/*/mandrillDisable',
|
83 |
'params' => array('store' => $this->getRequest()->getParam('store')),
|
84 |
),
|
85 |
-
'field'
|
86 |
)
|
87 |
),
|
88 |
-
'filter'
|
89 |
-
'sortable'
|
90 |
-
|
91 |
|
92 |
return parent::_prepareColumns();
|
93 |
}
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_MageMonkey_Block_Adminhtml_Transactionalemail_Mandrill_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
12 |
{
|
13 |
|
23 |
|
24 |
protected function _prepareCollection()
|
25 |
{
|
26 |
+
$apiKey = Mage::helper('monkey')->getMandrillApiKey(0);
|
27 |
$mail = Ebizmarts_MageMonkey_Model_TransactionalEmail_Adapter::factory('mandrill')
|
28 |
+
->setApiKey($apiKey);
|
29 |
+
$emails = $mail->usersSenders();
|
30 |
|
31 |
+
if ($emails !== FALSE) {
|
32 |
+
$_emails = array();
|
33 |
+
foreach ($emails as $email) {
|
34 |
+
$_emails [] = array(
|
35 |
+
'email' => $email->address,
|
36 |
+
'created_at' => $email->created_at,
|
37 |
+
'enabled' => ($email->is_enabled === TRUE ? Mage::helper('monkey')->__('Yes') : Mage::helper('monkey')->__('No')),
|
38 |
+
);
|
39 |
+
}
|
40 |
+
$collection = Mage::getModel('monkey/custom_collection', array($_emails));
|
41 |
+
} else {
|
42 |
+
$collection = Mage::getModel('monkey/custom_collection', array(array()));
|
43 |
+
}
|
44 |
|
45 |
$this->setCollection($collection);
|
46 |
return parent::_prepareCollection();
|
49 |
protected function _prepareColumns()
|
50 |
{
|
51 |
$this->addColumn('email', array(
|
52 |
+
'header' => Mage::helper('monkey')->__('Email Address'),
|
53 |
'index' => 'email',
|
54 |
'filter' => false,
|
55 |
'sortable' => false
|
56 |
));
|
57 |
$this->addColumn('enabled', array(
|
58 |
+
'header' => Mage::helper('monkey')->__('Enabled'),
|
59 |
'index' => 'enabled',
|
60 |
'filter' => false,
|
61 |
'sortable' => false
|
62 |
));
|
63 |
$this->addColumn('created_at', array(
|
64 |
+
'header' => Mage::helper('monkey')->__('Created At'),
|
65 |
'index' => 'created_at',
|
66 |
'filter' => false,
|
67 |
'sortable' => false
|
69 |
|
70 |
$this->addColumn('action',
|
71 |
array(
|
72 |
+
'header' => Mage::helper('monkey')->__('Action'),
|
73 |
+
'width' => '50px',
|
74 |
+
'type' => 'action',
|
75 |
+
'getter' => 'getEmail',
|
76 |
+
'actions' => array(
|
77 |
array(
|
78 |
'caption' => Mage::helper('monkey')->__('Disable'),
|
79 |
'confirm' => Mage::helper('monkey')->__('This action takes immediate effect, so use it with care.'),
|
80 |
+
'url' => array(
|
81 |
'base' => '*/*/mandrillDisable',
|
82 |
'params' => array('store' => $this->getRequest()->getParam('store')),
|
83 |
),
|
84 |
+
'field' => 'email'
|
85 |
)
|
86 |
),
|
87 |
+
'filter' => false,
|
88 |
+
'sortable' => false,
|
89 |
+
));
|
90 |
|
91 |
return parent::_prepareColumns();
|
92 |
}
|
app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Transactionalemail/Newemail.php
CHANGED
@@ -8,7 +8,6 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_MageMonkey_Block_Adminhtml_Transactionalemail_Newemail extends Mage_Adminhtml_Block_Widget_Form_Container
|
13 |
{
|
14 |
|
@@ -16,7 +15,7 @@ class Ebizmarts_MageMonkey_Block_Adminhtml_Transactionalemail_Newemail extends M
|
|
16 |
{
|
17 |
$this->_controller = 'adminhtml_transactionalemail';
|
18 |
$this->_blockGroup = 'monkey';
|
19 |
-
$this->_mode
|
20 |
|
21 |
parent::__construct();
|
22 |
|
@@ -25,7 +24,7 @@ class Ebizmarts_MageMonkey_Block_Adminhtml_Transactionalemail_Newemail extends M
|
|
25 |
|
26 |
public function getHeaderText()
|
27 |
{
|
28 |
-
|
29 |
}
|
30 |
|
31 |
}
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_MageMonkey_Block_Adminhtml_Transactionalemail_Newemail extends Mage_Adminhtml_Block_Widget_Form_Container
|
12 |
{
|
13 |
|
15 |
{
|
16 |
$this->_controller = 'adminhtml_transactionalemail';
|
17 |
$this->_blockGroup = 'monkey';
|
18 |
+
$this->_mode = 'newemail';
|
19 |
|
20 |
parent::__construct();
|
21 |
|
24 |
|
25 |
public function getHeaderText()
|
26 |
{
|
27 |
+
return Mage::helper('monkey')->__('Add valid email address');
|
28 |
}
|
29 |
|
30 |
}
|
app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Transactionalemail/Newemail/Form.php
CHANGED
@@ -8,7 +8,6 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_MageMonkey_Block_Adminhtml_Transactionalemail_Newemail_Form extends Mage_Adminhtml_Block_Widget_Form
|
13 |
{
|
14 |
|
@@ -20,36 +19,36 @@ class Ebizmarts_MageMonkey_Block_Adminhtml_Transactionalemail_Newemail_Form exte
|
|
20 |
protected function _prepareForm()
|
21 |
{
|
22 |
$form = new Varien_Data_Form(array(
|
23 |
-
'id'
|
24 |
-
'action'
|
25 |
-
'method'
|
26 |
));
|
27 |
|
28 |
-
$fieldset
|
29 |
-
'legend'
|
30 |
));
|
31 |
|
32 |
$fieldset->addField('email_address', 'text', array(
|
33 |
-
'label'
|
34 |
-
'title'
|
35 |
-
'name'
|
36 |
'class' => 'validate-email',
|
37 |
'required' => true,
|
38 |
));
|
39 |
|
40 |
$fieldset->addField('service', 'hidden', array(
|
41 |
-
'name'
|
42 |
-
'value'
|
43 |
));
|
44 |
$fieldset->addField('store', 'hidden', array(
|
45 |
-
'name'
|
46 |
-
'value'
|
47 |
));
|
48 |
|
49 |
$form->setUseContainer(true);
|
50 |
$this->setForm($form);
|
51 |
|
52 |
-
|
53 |
|
54 |
}
|
55 |
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_MageMonkey_Block_Adminhtml_Transactionalemail_Newemail_Form extends Mage_Adminhtml_Block_Widget_Form
|
12 |
{
|
13 |
|
19 |
protected function _prepareForm()
|
20 |
{
|
21 |
$form = new Varien_Data_Form(array(
|
22 |
+
'id' => 'edit_form',
|
23 |
+
'action' => $this->getUrl('*/*/validateEmail'),
|
24 |
+
'method' => 'post'
|
25 |
));
|
26 |
|
27 |
+
$fieldset = $form->addFieldset('newemail_data', array(
|
28 |
+
'legend' => Mage::helper('monkey')->__('New email')
|
29 |
));
|
30 |
|
31 |
$fieldset->addField('email_address', 'text', array(
|
32 |
+
'label' => Mage::helper('monkey')->__('Email address'),
|
33 |
+
'title' => Mage::helper('monkey')->__('Email address'),
|
34 |
+
'name' => 'email_address',
|
35 |
'class' => 'validate-email',
|
36 |
'required' => true,
|
37 |
));
|
38 |
|
39 |
$fieldset->addField('service', 'hidden', array(
|
40 |
+
'name' => 'service',
|
41 |
+
'value' => $this->getRequest()->getParam('service'),
|
42 |
));
|
43 |
$fieldset->addField('store', 'hidden', array(
|
44 |
+
'name' => 'store',
|
45 |
+
'value' => $this->getRequest()->getParam('store', 0),
|
46 |
));
|
47 |
|
48 |
$form->setUseContainer(true);
|
49 |
$this->setForm($form);
|
50 |
|
51 |
+
return parent::_prepareForm();
|
52 |
|
53 |
}
|
54 |
|
app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Transactionalemail/Sts.php
CHANGED
@@ -8,7 +8,6 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_MageMonkey_Block_Adminhtml_Transactionalemail_Sts extends Mage_Adminhtml_Block_Widget_Grid_Container
|
13 |
{
|
14 |
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_MageMonkey_Block_Adminhtml_Transactionalemail_Sts extends Mage_Adminhtml_Block_Widget_Grid_Container
|
12 |
{
|
13 |
|
app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Transactionalemail/Sts/Grid.php
CHANGED
@@ -8,7 +8,6 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_MageMonkey_Block_Adminhtml_Transactionalemail_Sts_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
13 |
{
|
14 |
|
@@ -24,20 +23,20 @@ class Ebizmarts_MageMonkey_Block_Adminhtml_Transactionalemail_Sts_Grid extends M
|
|
24 |
|
25 |
protected function _prepareCollection()
|
26 |
{
|
27 |
-
|
28 |
$mail = Ebizmarts_MageMonkey_Model_TransactionalEmail_Adapter::factory('sts')
|
29 |
-
|
30 |
-
|
31 |
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
|
42 |
$this->setCollection($collection);
|
43 |
return parent::_prepareCollection();
|
@@ -46,7 +45,7 @@ class Ebizmarts_MageMonkey_Block_Adminhtml_Transactionalemail_Sts_Grid extends M
|
|
46 |
protected function _prepareColumns()
|
47 |
{
|
48 |
$this->addColumn('email', array(
|
49 |
-
'header'=> Mage::helper('monkey')->__('Email Address'),
|
50 |
'index' => 'email',
|
51 |
'filter' => false,
|
52 |
'sortable' => false
|
@@ -54,24 +53,24 @@ class Ebizmarts_MageMonkey_Block_Adminhtml_Transactionalemail_Sts_Grid extends M
|
|
54 |
|
55 |
$this->addColumn('action',
|
56 |
array(
|
57 |
-
'header'
|
58 |
-
'width'
|
59 |
-
'type'
|
60 |
-
'getter'
|
61 |
-
'actions'
|
62 |
array(
|
63 |
'caption' => Mage::helper('monkey')->__('Delete'),
|
64 |
'confirm' => Mage::helper('monkey')->__('This action takes immediate effect, so use it with care.'),
|
65 |
-
'url'
|
66 |
'base' => '*/*/stsDelete',
|
67 |
'params' => array('store' => $this->getRequest()->getParam('store')),
|
68 |
),
|
69 |
-
'field'
|
70 |
)
|
71 |
),
|
72 |
-
'filter'
|
73 |
-
'sortable'
|
74 |
-
|
75 |
|
76 |
return parent::_prepareColumns();
|
77 |
}
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_MageMonkey_Block_Adminhtml_Transactionalemail_Sts_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
12 |
{
|
13 |
|
23 |
|
24 |
protected function _prepareCollection()
|
25 |
{
|
26 |
+
$apiKey = Mage::helper('monkey')->getApiKey(0);
|
27 |
$mail = Ebizmarts_MageMonkey_Model_TransactionalEmail_Adapter::factory('sts')
|
28 |
+
->setApiKey($apiKey);
|
29 |
+
$emails = $mail->listVerifiedEmailAddresses();
|
30 |
|
31 |
+
if ($emails !== FALSE) {
|
32 |
+
$_emails = array();
|
33 |
+
foreach ($emails->email_addresses as $email) {
|
34 |
+
$_emails [] = array('email' => $email);
|
35 |
+
}
|
36 |
+
$collection = Mage::getModel('monkey/custom_collection', array($_emails));
|
37 |
+
} else {
|
38 |
+
$collection = Mage::getModel('monkey/custom_collection', array(array()));
|
39 |
+
}
|
40 |
|
41 |
$this->setCollection($collection);
|
42 |
return parent::_prepareCollection();
|
45 |
protected function _prepareColumns()
|
46 |
{
|
47 |
$this->addColumn('email', array(
|
48 |
+
'header' => Mage::helper('monkey')->__('Email Address'),
|
49 |
'index' => 'email',
|
50 |
'filter' => false,
|
51 |
'sortable' => false
|
53 |
|
54 |
$this->addColumn('action',
|
55 |
array(
|
56 |
+
'header' => Mage::helper('monkey')->__('Action'),
|
57 |
+
'width' => '50px',
|
58 |
+
'type' => 'action',
|
59 |
+
'getter' => 'getEmail',
|
60 |
+
'actions' => array(
|
61 |
array(
|
62 |
'caption' => Mage::helper('monkey')->__('Delete'),
|
63 |
'confirm' => Mage::helper('monkey')->__('This action takes immediate effect, so use it with care.'),
|
64 |
+
'url' => array(
|
65 |
'base' => '*/*/stsDelete',
|
66 |
'params' => array('store' => $this->getRequest()->getParam('store')),
|
67 |
),
|
68 |
+
'field' => 'email'
|
69 |
)
|
70 |
),
|
71 |
+
'filter' => false,
|
72 |
+
'sortable' => false,
|
73 |
+
));
|
74 |
|
75 |
return parent::_prepareColumns();
|
76 |
}
|
app/code/community/Ebizmarts/MageMonkey/Block/Checkout/Subscribe.php
CHANGED
@@ -8,7 +8,6 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_MageMonkey_Block_Checkout_Subscribe extends Ebizmarts_MageMonkey_Block_Lists
|
13 |
{
|
14 |
protected function _construct()
|
@@ -25,8 +24,8 @@ class Ebizmarts_MageMonkey_Block_Checkout_Subscribe extends Ebizmarts_MageMonkey
|
|
25 |
|
26 |
$this->addData(array(
|
27 |
'cache_lifetime' => 60 * 60 * 4, // four hours valid
|
28 |
-
'cache_tags'
|
29 |
-
'cache_key'
|
30 |
));
|
31 |
}
|
32 |
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_MageMonkey_Block_Checkout_Subscribe extends Ebizmarts_MageMonkey_Block_Lists
|
12 |
{
|
13 |
protected function _construct()
|
24 |
|
25 |
$this->addData(array(
|
26 |
'cache_lifetime' => 60 * 60 * 4, // four hours valid
|
27 |
+
'cache_tags' => array('EbizMageMonkey_Checkout_Subscribe'),
|
28 |
+
'cache_key' => implode('_', $key),
|
29 |
));
|
30 |
}
|
31 |
|
app/code/community/Ebizmarts/MageMonkey/Block/Customer/Account/Lists.php
CHANGED
@@ -8,7 +8,6 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_MageMonkey_Block_Customer_Account_Lists extends Ebizmarts_MageMonkey_Block_Lists
|
13 |
{
|
14 |
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_MageMonkey_Block_Customer_Account_Lists extends Ebizmarts_MageMonkey_Block_Lists
|
12 |
{
|
13 |
|
app/code/community/Ebizmarts/MageMonkey/Block/Lists.php
CHANGED
@@ -8,184 +8,183 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_MageMonkey_Block_Lists extends Mage_Core_Block_Template
|
13 |
{
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
$ig = $api->listInterestGroupings($listData['data'][0]['id']);
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
|
190 |
/**
|
191 |
* Form getter/instantiation
|
@@ -201,61 +200,61 @@ class Ebizmarts_MageMonkey_Block_Lists extends Mage_Core_Block_Template
|
|
201 |
return $form;
|
202 |
}
|
203 |
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
|
230 |
$email = $this->_getEmail();
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
if($checked == 1){
|
240 |
-
foreach($group['groups'] as $g){
|
241 |
$myGroups[$group['id']][] = $g['name'];
|
242 |
}
|
243 |
-
}elseif($checked == -1) {
|
244 |
-
if($memberInfo['success'] == 1){
|
245 |
-
if(isset($memberInfo['data'][0]['merges']['GROUPINGS'])) {
|
246 |
$groupings = $memberInfo['data'][0]['merges']['GROUPINGS'];
|
247 |
}
|
248 |
$alreadyOnDb = Mage::getSingleton('monkey/asyncsubscribers')->getCollection()
|
249 |
->addFieldToFilter('lists', $list['id'])
|
250 |
->addFieldToFilter('email', $email)
|
251 |
->addFieldToFilter('processed', 0);
|
252 |
-
if(count($alreadyOnDb) > 0){
|
253 |
-
foreach($alreadyOnDb as $listToAdd) {
|
254 |
$mapFields = unserialize($listToAdd->getMapfields());
|
255 |
$groupings = $mapFields['GROUPINGS'];
|
256 |
}
|
257 |
}
|
258 |
-
if(isset($groupings)) {
|
259 |
foreach ($groupings as $_group) {
|
260 |
if (!empty($_group['groups'])) {
|
261 |
if ($fieldType == 'checkboxes') {
|
@@ -302,97 +301,97 @@ class Ebizmarts_MageMonkey_Block_Lists extends Mage_Core_Block_Template
|
|
302 |
}
|
303 |
}
|
304 |
}
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
if($this->helper('monkey')->config('list') == $list['id']){
|
345 |
-
if($this->_groupAllowed($g['name'])){
|
346 |
$options [$g['name']] = $g['name'];
|
347 |
}
|
348 |
-
}else{
|
349 |
$options [$g['name']] = $g['name'];
|
350 |
}
|
351 |
-
|
352 |
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
|
359 |
-
|
360 |
-
|
361 |
|
362 |
-
|
363 |
|
364 |
-
|
365 |
|
366 |
-
|
367 |
-
|
368 |
-
if($this->helper('monkey')->config('list') == $list['id']) {
|
369 |
if ($this->_groupAllowed($g['name'])) {
|
370 |
$options [] = new Varien_Object(array('value' => $g['name'], 'label' => $g['name']));
|
371 |
}
|
372 |
-
}else{
|
373 |
$options [] = new Varien_Object(array('value' => $g['name'], 'label' => $g['name']));
|
374 |
}
|
375 |
-
|
376 |
|
377 |
-
|
378 |
-
|
379 |
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
|
386 |
-
|
387 |
-
|
388 |
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
|
393 |
-
|
394 |
|
395 |
-
|
396 |
|
397 |
/**
|
398 |
* Return element id for group to be added to the post on checkout
|
@@ -401,10 +400,11 @@ class Ebizmarts_MageMonkey_Block_Lists extends Mage_Core_Block_Template
|
|
401 |
* @param bool $default
|
402 |
* @return null|string
|
403 |
*/
|
404 |
-
public function getGroupId($group, $default = FALSE)
|
405 |
-
|
406 |
-
|
407 |
-
|
|
|
408 |
$ret = null;
|
409 |
}
|
410 |
}
|
@@ -420,9 +420,9 @@ class Ebizmarts_MageMonkey_Block_Lists extends Mage_Core_Block_Template
|
|
420 |
protected function _groupAllowed($groupName)
|
421 |
{
|
422 |
$allowedGroups = $this->helper('monkey')->config('cutomergroup');
|
423 |
-
$allowedGroups = explode(','
|
424 |
$ret = false;
|
425 |
-
if(isset($allowedGroups)) {
|
426 |
foreach ($allowedGroups as $group) {
|
427 |
$group = explode('_', $group);
|
428 |
if (isset($group[1]) && $group[1] == $groupName) {
|
@@ -433,59 +433,61 @@ class Ebizmarts_MageMonkey_Block_Lists extends Mage_Core_Block_Template
|
|
433 |
return $ret;
|
434 |
}
|
435 |
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
|
456 |
//if is on database it gets checked
|
457 |
$alreadyOnList = Mage::getSingleton('monkey/asyncsubscribers')->getCollection()
|
458 |
->addFieldToFilter('lists', $list['id'])
|
459 |
->addFieldToFilter('email', $this->_getEmail())
|
460 |
->addFieldToFilter('processed', 0);
|
461 |
-
if(count($alreadyOnList) > 0){
|
462 |
$myLists[] = $list['id'];
|
463 |
}
|
464 |
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
|
|
|
|
|
|
471 |
|
472 |
-
|
473 |
-
|
474 |
|
475 |
-
$checkbox->setValue($list['id']);
|
476 |
-
$checkbox->setClass('monkey-list-subscriber');
|
477 |
|
|
|
|
|
478 |
|
479 |
-
return $checkbox->getLabelHtml() . $checkbox->getElementHtml();
|
480 |
-
}
|
481 |
public function getCanModify()
|
482 |
{
|
483 |
return Mage::getStoreConfig('monkey/general/changecustomergroup');
|
484 |
}
|
|
|
485 |
public function getForce()
|
486 |
{
|
487 |
$force = Mage::getStoreConfig('monkey/general/checkout_subscribe');
|
488 |
-
if($force==3
|
489 |
return true;
|
490 |
}
|
491 |
return false;
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_MageMonkey_Block_Lists extends Mage_Core_Block_Template
|
12 |
{
|
13 |
|
14 |
+
protected $_lists = array();
|
15 |
+
protected $_info = array();
|
16 |
+
protected $_myLists = array();
|
17 |
+
protected $_generalList = array();
|
18 |
+
protected $_form;
|
19 |
+
protected $_api;
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Get API instance (singleton)
|
23 |
+
*
|
24 |
+
* @return Ebizmarts_MageMonkey_Model_Api
|
25 |
+
*/
|
26 |
+
public function getApi()
|
27 |
+
{
|
28 |
+
if (is_null($this->_api)) {
|
29 |
+
$this->_api = Mage::getSingleton('monkey/api');
|
30 |
+
}
|
31 |
+
return $this->_api;
|
32 |
+
}
|
33 |
+
|
34 |
+
public function getSaveUrl()
|
35 |
+
{
|
36 |
+
return $this->getUrl('monkey/signup/saveadditional');
|
37 |
+
}
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Check if GENERAL list can be shown on ALL LISTS template
|
41 |
+
*
|
42 |
+
* @return bool
|
43 |
+
*/
|
44 |
+
public function getShowGeneral()
|
45 |
+
{
|
46 |
+
$action = $this->getRequest()->getActionName();
|
47 |
+
$controller = $this->getRequest()->getControllerName();
|
48 |
+
|
49 |
+
return (bool)!($action == 'savePayment' && $controller == 'onepage');
|
50 |
+
}
|
51 |
+
|
52 |
+
public function notInMyAccount()
|
53 |
+
{
|
54 |
+
$action = $this->getRequest()->getActionName();
|
55 |
+
$controller = $this->getRequest()->getControllerName();
|
56 |
+
$module = $this->getRequest()->getModuleName();
|
57 |
+
|
58 |
+
return (bool)!($action == 'index' && $controller == 'customer_account' && $module == 'monkey');
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Show form items or not if customer is logged in and / or is on register page
|
63 |
+
*
|
64 |
+
* @return bool
|
65 |
+
*/
|
66 |
+
public function getCanShowButton()
|
67 |
+
{
|
68 |
+
$ary = array(
|
69 |
+
'/customer/account/create/',
|
70 |
+
'/checkout/onepage/savePayment/',
|
71 |
+
'/onestepcheckout/',
|
72 |
+
);
|
73 |
+
$requestString = $this->getRequest()->getRequestString();
|
74 |
+
|
75 |
+
return !in_array($requestString, $ary);
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Get default list data from MC
|
80 |
+
*
|
81 |
+
* @return array
|
82 |
+
*/
|
83 |
+
public function getGeneralList()
|
84 |
+
{
|
85 |
+
$list = $this->helper('monkey')->config('list');
|
86 |
+
|
87 |
+
if ($list) {
|
88 |
+
if (empty($this->_generalList)) {
|
89 |
+
|
90 |
+
$api = $this->getApi();
|
91 |
+
$listData = $api->lists(array('list_id' => $list));
|
92 |
+
|
93 |
+
if (empty($this->_myLists)) {
|
94 |
+
$this->_myLists = $api->listsForEmail($this->_getEmail());
|
95 |
+
}
|
96 |
+
|
97 |
+
if ($listData['total'] > 0) {
|
98 |
+
$showRealName = $this->helper('monkey')->config('showreallistname');
|
99 |
+
if ($showRealName) {
|
100 |
+
$listName = $listData['data'][0]['name'];
|
101 |
+
} else {
|
102 |
+
$listName = $this->__('General Subscription');
|
103 |
+
}
|
104 |
$ig = $api->listInterestGroupings($listData['data'][0]['id']);
|
105 |
+
$this->_generalList = array(
|
106 |
+
'id' => $listData['data'][0]['id'],
|
107 |
+
'name' => $listName,
|
108 |
+
'interest_groupings' => $this->helper('monkey')->filterShowGroupings($ig),
|
109 |
+
);
|
110 |
+
}
|
111 |
+
}
|
112 |
+
}
|
113 |
+
|
114 |
+
return $this->_generalList;
|
115 |
+
}
|
116 |
+
|
117 |
+
/**
|
118 |
+
* Get additional lists data from MC
|
119 |
+
*
|
120 |
+
* @return array
|
121 |
+
*/
|
122 |
+
public function getLists()
|
123 |
+
{
|
124 |
+
$additionalLists = $this->helper('monkey')->config('additional_lists');
|
125 |
+
|
126 |
+
if ($additionalLists) {
|
127 |
+
|
128 |
+
if (empty($this->_lists)) {
|
129 |
+
$api = $this->getApi();
|
130 |
+
|
131 |
+
if (empty($this->_myLists)) {
|
132 |
+
$this->_myLists = $api->listsForEmail($this->_getEmail());
|
133 |
+
}
|
134 |
+
|
135 |
+
$lists = $api->lists(array('list_id' => $additionalLists));
|
136 |
+
|
137 |
+
if ($lists['total'] > 0) {
|
138 |
+
foreach ($lists['data'] as $list) {
|
139 |
+
$this->_lists [] = array(
|
140 |
+
'id' => $list['id'],
|
141 |
+
'name' => $list['name'],
|
142 |
+
'interest_groupings' => $this->helper('monkey')->filterShowGroupings($api->listInterestGroupings($list['id'])),
|
143 |
+
);
|
144 |
+
|
145 |
+
}
|
146 |
+
}
|
147 |
+
}
|
148 |
+
|
149 |
+
}
|
150 |
+
|
151 |
+
return $this->_lists;
|
152 |
+
}
|
153 |
+
|
154 |
+
/**
|
155 |
+
* Getter for class property
|
156 |
+
*
|
157 |
+
* @return array
|
158 |
+
*/
|
159 |
+
public function getSubscribedLists()
|
160 |
+
{
|
161 |
+
if (!is_array($this->_myLists)) {
|
162 |
+
return array();
|
163 |
+
}
|
164 |
+
return $this->_myLists;
|
165 |
+
}
|
166 |
+
|
167 |
+
/**
|
168 |
+
* Utility to generate HTML name for element
|
169 |
+
* @param string $list
|
170 |
+
* @param string $group
|
171 |
+
* @param bool $multiple
|
172 |
+
* @return string
|
173 |
+
*/
|
174 |
+
protected function _htmlGroupName($list, $group = NULL, $multiple = FALSE)
|
175 |
+
{
|
176 |
+
$htmlName = "list[{$list['id']}]";
|
177 |
+
|
178 |
+
if (!is_null($group)) {
|
179 |
+
$htmlName .= "[{$group['id']}]";
|
180 |
+
}
|
181 |
+
|
182 |
+
if (TRUE === $multiple) {
|
183 |
+
$htmlName .= '[]';
|
184 |
+
}
|
185 |
+
|
186 |
+
return $htmlName;
|
187 |
+
}
|
188 |
|
189 |
/**
|
190 |
* Form getter/instantiation
|
200 |
return $form;
|
201 |
}
|
202 |
|
203 |
+
/**
|
204 |
+
* Get MC member information for an specific list
|
205 |
+
*
|
206 |
+
* @param string $listId ID of list in MC
|
207 |
+
* @return array Member info on list
|
208 |
+
*/
|
209 |
+
protected function _memberInfo($listId)
|
210 |
+
{
|
211 |
+
if (FALSE === array_key_exists($listId, $this->_info)) {
|
212 |
+
$this->_info[$listId] = $this->getApi()->listMemberInfo($listId, $this->_getEmail());
|
213 |
+
}
|
214 |
+
|
215 |
+
return $this->_info[$listId];
|
216 |
+
}
|
217 |
+
|
218 |
+
/**
|
219 |
+
* Render interest grouping with its groups
|
220 |
+
*
|
221 |
+
* @param array $group Group data from MC
|
222 |
+
* @param array $list List data from MC
|
223 |
+
* @return string HTML code
|
224 |
+
*/
|
225 |
+
public function renderGroup($group, $list, $checked = -1)
|
226 |
+
{
|
227 |
+
$fieldType = $group['form_field'];
|
228 |
|
229 |
$email = $this->_getEmail();
|
230 |
+
if ($email) {
|
231 |
+
$memberInfo = $this->_memberInfo($list['id']);
|
232 |
+
} else {
|
233 |
+
$memberInfo['success'] = 0;
|
234 |
+
}
|
235 |
+
|
236 |
+
$myGroups = array();
|
237 |
+
//if checked = 1 all groups checked elseif checked == -1 registered groups checked elseif checked == 0 none checked
|
238 |
+
if ($checked == 1) {
|
239 |
+
foreach ($group['groups'] as $g) {
|
240 |
$myGroups[$group['id']][] = $g['name'];
|
241 |
}
|
242 |
+
} elseif ($checked == -1) {
|
243 |
+
if ($memberInfo['success'] == 1) {
|
244 |
+
if (isset($memberInfo['data'][0]['merges']['GROUPINGS'])) {
|
245 |
$groupings = $memberInfo['data'][0]['merges']['GROUPINGS'];
|
246 |
}
|
247 |
$alreadyOnDb = Mage::getSingleton('monkey/asyncsubscribers')->getCollection()
|
248 |
->addFieldToFilter('lists', $list['id'])
|
249 |
->addFieldToFilter('email', $email)
|
250 |
->addFieldToFilter('processed', 0);
|
251 |
+
if (count($alreadyOnDb) > 0) {
|
252 |
+
foreach ($alreadyOnDb as $listToAdd) {
|
253 |
$mapFields = unserialize($listToAdd->getMapfields());
|
254 |
$groupings = $mapFields['GROUPINGS'];
|
255 |
}
|
256 |
}
|
257 |
+
if (isset($groupings)) {
|
258 |
foreach ($groupings as $_group) {
|
259 |
if (!empty($_group['groups'])) {
|
260 |
if ($fieldType == 'checkboxes') {
|
301 |
}
|
302 |
}
|
303 |
}
|
304 |
+
}
|
305 |
+
|
306 |
+
switch ($fieldType) {
|
307 |
+
case 'radio':
|
308 |
+
$class = 'Varien_Data_Form_Element_Radios';
|
309 |
+
break;
|
310 |
+
case 'checkboxes':
|
311 |
+
$class = 'Varien_Data_Form_Element_Checkboxes';
|
312 |
+
break;
|
313 |
+
case 'dropdown':
|
314 |
+
$class = 'Varien_Data_Form_Element_Select';
|
315 |
+
break;
|
316 |
+
case 'hidden':
|
317 |
+
$class = 'Varien_Data_Form_Element_Hidden';
|
318 |
+
break;
|
319 |
+
default:
|
320 |
+
$class = 'Varien_Data_Form_Element_Text';
|
321 |
+
break;
|
322 |
+
}
|
323 |
+
|
324 |
+
$object = new $class;
|
325 |
+
$object->setForm($this->getForm());
|
326 |
+
|
327 |
+
//Check/select values
|
328 |
+
if (isset($myGroups[$group['id']]) && !$checked == 0 || $checked == 1) {
|
329 |
+
$object->setValue($myGroups[$group['id']]);
|
330 |
+
} else {
|
331 |
+
$object->setValue(array());
|
332 |
+
}
|
333 |
+
|
334 |
+
if ($fieldType == 'checkboxes' || $fieldType == 'dropdown') {
|
335 |
+
|
336 |
+
$options = array();
|
337 |
+
|
338 |
+
if ($fieldType == 'dropdown') {
|
339 |
+
$options[''] = '';
|
340 |
+
}
|
341 |
+
|
342 |
+
foreach ($group['groups'] as $g) {
|
343 |
+
if ($this->helper('monkey')->config('list') == $list['id']) {
|
344 |
+
if ($this->_groupAllowed($g['name'])) {
|
345 |
$options [$g['name']] = $g['name'];
|
346 |
}
|
347 |
+
} else {
|
348 |
$options [$g['name']] = $g['name'];
|
349 |
}
|
350 |
+
}
|
351 |
|
352 |
+
if (method_exists('Varien_Data_Form_Element_Checkboxes', 'addElementValues')) {
|
353 |
+
$object->addElementValues($options);
|
354 |
+
} else {
|
355 |
+
$object->setValues($options);
|
356 |
+
}
|
357 |
|
358 |
+
$object->setName($this->_htmlGroupName($list, $group, ($fieldType == 'checkboxes' ? TRUE : FALSE)));
|
359 |
+
$object->setHtmlId('interest-group');
|
360 |
|
361 |
+
$html = $object->getElementHtml();
|
362 |
|
363 |
+
} elseif ($fieldType == 'radio' || $fieldType == 'hidden') {
|
364 |
|
365 |
+
$options = array();
|
366 |
+
foreach ($group['groups'] as $g) {
|
367 |
+
if ($this->helper('monkey')->config('list') == $list['id']) {
|
368 |
if ($this->_groupAllowed($g['name'])) {
|
369 |
$options [] = new Varien_Object(array('value' => $g['name'], 'label' => $g['name']));
|
370 |
}
|
371 |
+
} else {
|
372 |
$options [] = new Varien_Object(array('value' => $g['name'], 'label' => $g['name']));
|
373 |
}
|
374 |
+
}
|
375 |
|
376 |
+
$object->setName($this->_htmlGroupName($list, $group));
|
377 |
+
$object->setHtmlId('interest-group');
|
378 |
|
379 |
+
if (method_exists('Varien_Data_Form_Element_Checkboxes', 'addElementValues')) {
|
380 |
+
$object->addElementValues($options);
|
381 |
+
} else {
|
382 |
+
$object->setValues($options);
|
383 |
+
}
|
384 |
|
385 |
+
$html = $object->getElementHtml();
|
386 |
+
}
|
387 |
|
388 |
+
if ($fieldType != 'checkboxes') {
|
389 |
+
$html = "<div class=\"groups-list\">{$html}</div>";
|
390 |
+
}
|
391 |
|
392 |
+
return $html;
|
393 |
|
394 |
+
}
|
395 |
|
396 |
/**
|
397 |
* Return element id for group to be added to the post on checkout
|
400 |
* @param bool $default
|
401 |
* @return null|string
|
402 |
*/
|
403 |
+
public function getGroupId($group, $default = FALSE)
|
404 |
+
{
|
405 |
+
$ret = "interest-group_" . $group['name'];
|
406 |
+
if ($default) {
|
407 |
+
if (!$this->_groupAllowed($group['name'])) {
|
408 |
$ret = null;
|
409 |
}
|
410 |
}
|
420 |
protected function _groupAllowed($groupName)
|
421 |
{
|
422 |
$allowedGroups = $this->helper('monkey')->config('cutomergroup');
|
423 |
+
$allowedGroups = explode(',', $allowedGroups);
|
424 |
$ret = false;
|
425 |
+
if (isset($allowedGroups)) {
|
426 |
foreach ($allowedGroups as $group) {
|
427 |
$group = explode('_', $group);
|
428 |
if (isset($group[1]) && $group[1] == $groupName) {
|
433 |
return $ret;
|
434 |
}
|
435 |
|
436 |
+
/**
|
437 |
+
* Retrieve email from Customer object in session
|
438 |
+
*
|
439 |
+
* @return string Email address
|
440 |
+
*/
|
441 |
+
protected function _getEmail()
|
442 |
+
{
|
443 |
+
return $this->helper('customer')->getCustomer()->getEmail();
|
444 |
+
}
|
445 |
+
|
446 |
+
/**
|
447 |
+
* Return HTML code for list <label> with checkbox, checked if subscribed, otherwise not
|
448 |
+
*
|
449 |
+
* @param array $list List data from MC
|
450 |
+
* @return string HTML code
|
451 |
+
*/
|
452 |
+
public function listLabel($list)
|
453 |
+
{
|
454 |
+
$myLists = $this->getSubscribedLists();
|
455 |
|
456 |
//if is on database it gets checked
|
457 |
$alreadyOnList = Mage::getSingleton('monkey/asyncsubscribers')->getCollection()
|
458 |
->addFieldToFilter('lists', $list['id'])
|
459 |
->addFieldToFilter('email', $this->_getEmail())
|
460 |
->addFieldToFilter('processed', 0);
|
461 |
+
if (count($alreadyOnList) > 0) {
|
462 |
$myLists[] = $list['id'];
|
463 |
}
|
464 |
|
465 |
+
$checkbox = new Varien_Data_Form_Element_Checkbox;
|
466 |
+
$checkbox->setForm($this->getForm());
|
467 |
+
$checkbox->setHtmlId('list-' . $list['id']);
|
468 |
+
$checkbox->setChecked((bool)(is_array($myLists) && in_array($list['id'], $myLists)));
|
469 |
+
$checkbox->setTitle(($checkbox->getChecked() ? $this->__('Click to unsubscribe from this list.') : $this->__('Click to subscribe to this list.')));
|
470 |
+
$checkbox->setLabel($list['name']);
|
471 |
+
|
472 |
+
$hname = $this->_htmlGroupName($list);
|
473 |
+
$checkbox->setName($hname . '[subscribed]');
|
474 |
|
475 |
+
$checkbox->setValue($list['id']);
|
476 |
+
$checkbox->setClass('monkey-list-subscriber');
|
477 |
|
|
|
|
|
478 |
|
479 |
+
return $checkbox->getLabelHtml() . $checkbox->getElementHtml();
|
480 |
+
}
|
481 |
|
|
|
|
|
482 |
public function getCanModify()
|
483 |
{
|
484 |
return Mage::getStoreConfig('monkey/general/changecustomergroup');
|
485 |
}
|
486 |
+
|
487 |
public function getForce()
|
488 |
{
|
489 |
$force = Mage::getStoreConfig('monkey/general/checkout_subscribe');
|
490 |
+
if ($force == 3 || $force == 4) {
|
491 |
return true;
|
492 |
}
|
493 |
return false;
|
app/code/community/Ebizmarts/MageMonkey/Block/Signup.php
CHANGED
@@ -8,7 +8,6 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_MageMonkey_Block_Signup extends Ebizmarts_MageMonkey_Block_Lists
|
13 |
{
|
14 |
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_MageMonkey_Block_Signup extends Ebizmarts_MageMonkey_Block_Lists
|
12 |
{
|
13 |
|
app/code/community/Ebizmarts/MageMonkey/Helper/Cache.php
CHANGED
@@ -8,7 +8,6 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_MageMonkey_Helper_Cache extends Mage_Core_Helper_Abstract
|
13 |
{
|
14 |
|
@@ -26,8 +25,8 @@ class Ebizmarts_MageMonkey_Helper_Cache extends Mage_Core_Helper_Abstract
|
|
26 |
'listMergeVars',
|
27 |
'lists',
|
28 |
'listsForEmail'
|
29 |
-
);
|
30 |
-
|
31 |
/**
|
32 |
* Cache tags unique param ID
|
33 |
*
|
@@ -37,9 +36,9 @@ class Ebizmarts_MageMonkey_Helper_Cache extends Mage_Core_Helper_Abstract
|
|
37 |
protected $_cacheTagId = array(
|
38 |
'listMemberInfo' => array('id', 'email_address'),
|
39 |
'listMemberActivity' => array('id', 'email_address'),
|
40 |
-
'listsForEmail' => array(
|
41 |
-
);
|
42 |
-
|
43 |
/**
|
44 |
* Clear cache callbacks
|
45 |
*
|
@@ -47,10 +46,10 @@ class Ebizmarts_MageMonkey_Helper_Cache extends Mage_Core_Helper_Abstract
|
|
47 |
* @access protected
|
48 |
*/
|
49 |
protected $_cacheClearCallbacks = array(
|
50 |
-
'listUnsubscribe' => array('listMemberInfo', 'listMembers', 'listMemberActivity',
|
51 |
-
'listSubscribe' => array('listMemberInfo', 'listMembers', 'listMemberActivity',
|
52 |
'listUpdateMember' => array('listMemberInfo', 'listMembers', 'listMemberActivity', 'listsForEmail', 'lists'),
|
53 |
-
);
|
54 |
|
55 |
/**
|
56 |
* Retrieve cache key to save data in cache storage
|
@@ -60,7 +59,8 @@ class Ebizmarts_MageMonkey_Helper_Cache extends Mage_Core_Helper_Abstract
|
|
60 |
* @param string OPTIONAL $apiKey
|
61 |
* @return string
|
62 |
*/
|
63 |
-
public function cacheKey($command, $args, $apiKey = null)
|
|
|
64 |
|
65 |
if (FALSE === in_array($command, $this->_cacheableCommands)) {
|
66 |
return FALSE;
|
@@ -71,8 +71,8 @@ class Ebizmarts_MageMonkey_Helper_Cache extends Mage_Core_Helper_Abstract
|
|
71 |
}
|
72 |
|
73 |
return md5($command . serialize($args) . $apiKey);
|
74 |
-
}
|
75 |
-
|
76 |
/**
|
77 |
* Clear data from Cache
|
78 |
*
|
@@ -80,7 +80,8 @@ class Ebizmarts_MageMonkey_Helper_Cache extends Mage_Core_Helper_Abstract
|
|
80 |
* @param object $object Request object
|
81 |
* @return Ebizmarts_MageMonkey_Helper_Cache
|
82 |
*/
|
83 |
-
public function clearCache($command, $object)
|
|
|
84 |
if (FALSE === array_key_exists($command, $this->_cacheClearCallbacks)) {
|
85 |
return FALSE;
|
86 |
}
|
@@ -90,16 +91,17 @@ class Ebizmarts_MageMonkey_Helper_Cache extends Mage_Core_Helper_Abstract
|
|
90 |
}
|
91 |
|
92 |
return $this;
|
93 |
-
}
|
94 |
-
|
95 |
/**
|
96 |
* Return cache TAG for given command
|
97 |
-
*
|
98 |
* @param string $command
|
99 |
* @param object $object Request object
|
100 |
* @return array
|
101 |
*/
|
102 |
-
public function cacheTagForCommand($command, $object)
|
|
|
103 |
$tag = $command;
|
104 |
|
105 |
if (isset($this->_cacheTagId[$command])) {
|
@@ -109,8 +111,8 @@ class Ebizmarts_MageMonkey_Helper_Cache extends Mage_Core_Helper_Abstract
|
|
109 |
}
|
110 |
|
111 |
$tag = array(strtoupper($tag));
|
112 |
-
|
113 |
return $tag;
|
114 |
}
|
115 |
-
|
116 |
}
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_MageMonkey_Helper_Cache extends Mage_Core_Helper_Abstract
|
12 |
{
|
13 |
|
25 |
'listMergeVars',
|
26 |
'lists',
|
27 |
'listsForEmail'
|
28 |
+
);
|
29 |
+
|
30 |
/**
|
31 |
* Cache tags unique param ID
|
32 |
*
|
36 |
protected $_cacheTagId = array(
|
37 |
'listMemberInfo' => array('id', 'email_address'),
|
38 |
'listMemberActivity' => array('id', 'email_address'),
|
39 |
+
'listsForEmail' => array('email_address'),
|
40 |
+
);
|
41 |
+
|
42 |
/**
|
43 |
* Clear cache callbacks
|
44 |
*
|
46 |
* @access protected
|
47 |
*/
|
48 |
protected $_cacheClearCallbacks = array(
|
49 |
+
'listUnsubscribe' => array('listMemberInfo', 'listMembers', 'listMemberActivity', 'listsForEmail', 'lists'),
|
50 |
+
'listSubscribe' => array('listMemberInfo', 'listMembers', 'listMemberActivity', 'listsForEmail', 'lists'),
|
51 |
'listUpdateMember' => array('listMemberInfo', 'listMembers', 'listMemberActivity', 'listsForEmail', 'lists'),
|
52 |
+
);
|
53 |
|
54 |
/**
|
55 |
* Retrieve cache key to save data in cache storage
|
59 |
* @param string OPTIONAL $apiKey
|
60 |
* @return string
|
61 |
*/
|
62 |
+
public function cacheKey($command, $args, $apiKey = null)
|
63 |
+
{
|
64 |
|
65 |
if (FALSE === in_array($command, $this->_cacheableCommands)) {
|
66 |
return FALSE;
|
71 |
}
|
72 |
|
73 |
return md5($command . serialize($args) . $apiKey);
|
74 |
+
}
|
75 |
+
|
76 |
/**
|
77 |
* Clear data from Cache
|
78 |
*
|
80 |
* @param object $object Request object
|
81 |
* @return Ebizmarts_MageMonkey_Helper_Cache
|
82 |
*/
|
83 |
+
public function clearCache($command, $object)
|
84 |
+
{
|
85 |
if (FALSE === array_key_exists($command, $this->_cacheClearCallbacks)) {
|
86 |
return FALSE;
|
87 |
}
|
91 |
}
|
92 |
|
93 |
return $this;
|
94 |
+
}
|
95 |
+
|
96 |
/**
|
97 |
* Return cache TAG for given command
|
98 |
+
*
|
99 |
* @param string $command
|
100 |
* @param object $object Request object
|
101 |
* @return array
|
102 |
*/
|
103 |
+
public function cacheTagForCommand($command, $object)
|
104 |
+
{
|
105 |
$tag = $command;
|
106 |
|
107 |
if (isset($this->_cacheTagId[$command])) {
|
111 |
}
|
112 |
|
113 |
$tag = array(strtoupper($tag));
|
114 |
+
|
115 |
return $tag;
|
116 |
}
|
117 |
+
|
118 |
}
|
app/code/community/Ebizmarts/MageMonkey/Helper/Data.php
CHANGED
@@ -8,19 +8,18 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_MageMonkey_Helper_Data extends Mage_Core_Helper_Abstract
|
13 |
{
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
|
25 |
/**
|
26 |
* Check if Magento is EE
|
@@ -33,565 +32,561 @@ class Ebizmarts_MageMonkey_Helper_Data extends Mage_Core_Helper_Abstract
|
|
33 |
}
|
34 |
|
35 |
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
|
62 |
// Prevent most cases to attach default in webhook url
|
63 |
-
if(!$store || $store == 'default') $store = '';
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
if (is_array($configscope) && isset($configscope['code'])) {
|
202 |
$store = $configscope['code'];
|
203 |
} else {
|
204 |
$store = $configscope;
|
205 |
}
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
|
241 |
return $on;
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
$storeId = Mage::app()->getStore()->getId();
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
$list = Mage::getModel('core/config_data')->getCollection()
|
315 |
-
|
316 |
|
317 |
$store = null;
|
318 |
-
if($list->getId()){
|
319 |
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
|
328 |
}
|
329 |
|
330 |
return $store;
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
$maps
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
$country = $address->getCountryId();
|
468 |
-
if($country){
|
469 |
$merge_vars['COUNTRY'] = $country;
|
470 |
}
|
471 |
-
|
472 |
|
473 |
-
|
474 |
-
|
475 |
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
->setPageSize(1)
|
481 |
-
|
482 |
-
|
483 |
$merge_vars[$key] = date('m/d/Y', strtotime($last_order->getCreatedAt()));
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
{
|
559 |
-
if (is_array($grupoptions))
|
560 |
-
{
|
561 |
$grupOptionsEscaped = array();
|
562 |
-
foreach($grupoptions as $gopt)
|
563 |
-
|
564 |
-
$gopt = str_replace(",","%C%",$gopt);
|
565 |
$grupOptionsEscaped[] = $gopt;
|
566 |
}
|
567 |
$groupings[] = array(
|
568 |
'id' => $groupId,
|
569 |
-
'groups' => str_replace('%C%','\\,',implode(', ', $grupOptionsEscaped))
|
570 |
);
|
571 |
-
}
|
572 |
-
else
|
573 |
-
{
|
574 |
$groupings[] = array(
|
575 |
'id' => $groupId,
|
576 |
-
'groups' => str_replace(',','\\,'
|
577 |
);
|
578 |
}
|
579 |
}
|
580 |
-
|
581 |
|
582 |
-
|
583 |
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
|
593 |
-
|
594 |
-
|
595 |
|
596 |
/**
|
597 |
* Get Mergevars
|
@@ -647,7 +642,7 @@ class Ebizmarts_MageMonkey_Helper_Data extends Mage_Core_Helper_Abstract
|
|
647 |
$footerSubscription = $request->getActionName() == 'new' && $request->getControllerName() == 'subscriber' && $request->getModuleName() == 'newsletter';
|
648 |
$customerSubscription = $request->getActionName() == 'saveadditional';
|
649 |
$customerCreateAccountSubscription = $request->getActionName() == 'createpost';
|
650 |
-
if($post && !$adminSubscription && !$customerSubscription && !$customerCreateAccountSubscription || Mage::getSingleton('core/session')->getIsOneStepCheckout()){
|
651 |
$defaultList = Mage::helper('monkey')->config('list');
|
652 |
//if can change customer set the groups set by customer else set the groups on MailChimp config
|
653 |
$canChangeGroups = Mage::getStoreConfig('monkey/general/changecustomergroup', $object->getStoreId());
|
@@ -660,7 +655,7 @@ class Ebizmarts_MageMonkey_Helper_Data extends Mage_Core_Helper_Abstract
|
|
660 |
}
|
661 |
}
|
662 |
$groups = NULL;
|
663 |
-
} elseif($currentList == $defaultList) {
|
664 |
$groups = Mage::getStoreConfig('monkey/general/cutomergroup', $object->getStoreId());
|
665 |
$groups = explode(",", $groups);
|
666 |
if (isset($groups[0]) && $groups[0]) {
|
@@ -669,7 +664,7 @@ class Ebizmarts_MageMonkey_Helper_Data extends Mage_Core_Helper_Abstract
|
|
669 |
$checkboxes = array();
|
670 |
foreach ($groups as $group) {
|
671 |
$item = explode("_", $group);
|
672 |
-
if($item[0]) {
|
673 |
$currentGroup = $item[0];
|
674 |
if ($currentGroup == $_prevGroup || $_prevGroup == null) {
|
675 |
$checkboxes[] = $item[1];
|
@@ -682,7 +677,7 @@ class Ebizmarts_MageMonkey_Helper_Data extends Mage_Core_Helper_Abstract
|
|
682 |
}
|
683 |
}
|
684 |
}
|
685 |
-
if($currentGroup) {
|
686 |
$subscribeGroups[] = array('id' => $currentGroup, "groups" => str_replace('%C%', '\\,', implode(', ', $checkboxes)));
|
687 |
}
|
688 |
|
@@ -702,17 +697,17 @@ class Ebizmarts_MageMonkey_Helper_Data extends Mage_Core_Helper_Abstract
|
|
702 |
} else {
|
703 |
$mergeVars[$map] = "No";
|
704 |
}
|
705 |
-
}elseif(Mage::getSingleton('core/session')->getIsOneStepCheckout()){
|
706 |
$post2 = $request->getPost();
|
707 |
-
if(isset($post['subscribe_newsletter']) || isset($post2['subscribe_newsletter'])) {
|
708 |
$mergeVars[$map] = "Yes";
|
709 |
-
}elseif(Mage::helper('monkey')->config('checkout_subscribe') > 2){
|
710 |
$mergeVars[$map] = "No";
|
711 |
}
|
712 |
-
}elseif($request->getModuleName() == 'checkout') {
|
713 |
$mergeVars[$map] = "No";
|
714 |
}
|
715 |
-
}else{
|
716 |
$map = Mage::getStoreConfig('monkey/general/markfield', $object->getStoreId());
|
717 |
$mergeVars[$map] = "Yes";
|
718 |
}
|
@@ -720,119 +715,119 @@ class Ebizmarts_MageMonkey_Helper_Data extends Mage_Core_Helper_Abstract
|
|
720 |
return $mergeVars;
|
721 |
}
|
722 |
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
-
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
|
755 |
-
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
-
|
760 |
-
|
761 |
-
|
762 |
-
|
763 |
-
|
764 |
-
|
765 |
-
|
766 |
-
|
767 |
-
|
768 |
-
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
// emulate request
|
774 |
$request = $customerForm->prepareRequest($accountData);
|
775 |
-
$customerData
|
776 |
$customerForm->restoreData($customerData);
|
777 |
|
778 |
-
|
779 |
|
780 |
-
|
781 |
$customerForm->compactData($customerData);
|
782 |
|
783 |
$pwd = $customer->generatePassword(8);
|
784 |
$customer->setPassword($pwd);
|
785 |
-
try{
|
786 |
$customer->save();
|
787 |
|
788 |
-
if (
|
789 |
$customer->sendNewAccountEmail('confirmation');
|
790 |
}
|
791 |
/**
|
792 |
* Handle Address related Data
|
793 |
*/
|
794 |
$billing = $shipping = null;
|
795 |
-
if(isset($accountData['billing_address']) && !empty($accountData['billing_address'])){
|
796 |
$this->_McAddressToMage($accountData, 'billing', $customer);
|
797 |
}
|
798 |
-
if(isset($accountData['shipping_address']) && !empty($accountData['shipping_address'])){
|
799 |
$this->_McAddressToMage($accountData, 'shipping', $customer);
|
800 |
}
|
801 |
-
}catch(Exception $ex){
|
802 |
$this->log($ex->getMessage(), 'Monkey.log');
|
803 |
}
|
804 |
-
|
805 |
-
|
806 |
-
|
807 |
-
|
808 |
-
|
809 |
-
|
810 |
-
|
811 |
-
|
812 |
-
|
813 |
-
|
814 |
-
|
815 |
-
|
816 |
-
|
817 |
-
|
818 |
-
|
819 |
-
|
820 |
-
|
821 |
-
|
822 |
-
|
823 |
-
|
824 |
-
|
825 |
-
|
826 |
-
|
827 |
-
|
828 |
-
|
829 |
-
|
830 |
-
|
831 |
-
|
832 |
-
|
833 |
-
|
834 |
-
|
835 |
-
|
836 |
|
837 |
/* @var $address Mage_Customer_Model_Address */
|
838 |
$address = Mage::getModel('customer/address');
|
@@ -841,14 +836,14 @@ class Ebizmarts_MageMonkey_Helper_Data extends Mage_Core_Helper_Abstract
|
|
841 |
$addressForm->setFormCode('customer_register_address')
|
842 |
->setEntity($address);
|
843 |
|
844 |
-
|
845 |
$addressData = $addressForm->extractData($addrrequest);
|
846 |
-
$addressErrors
|
847 |
|
848 |
$errors = array();
|
849 |
if ($addressErrors === true) {
|
850 |
$address->setId(null)
|
851 |
-
|
852 |
$addressForm->compactData($addressData);
|
853 |
$customer->addAddress($address);
|
854 |
|
@@ -860,8 +855,8 @@ class Ebizmarts_MageMonkey_Helper_Data extends Mage_Core_Helper_Abstract
|
|
860 |
$errors = array_merge($errors, $addressErrors);
|
861 |
}
|
862 |
|
863 |
-
|
864 |
-
|
865 |
|
866 |
/**
|
867 |
* handles subscription to any list on post
|
@@ -869,12 +864,10 @@ class Ebizmarts_MageMonkey_Helper_Data extends Mage_Core_Helper_Abstract
|
|
869 |
* @param $object
|
870 |
* @param $db
|
871 |
*/
|
872 |
-
public function listsSubscription($object, $db)
|
|
|
873 |
$monkeyPost = Mage::getSingleton('core/session')->getMonkeyPost();
|
874 |
$post = unserialize($monkeyPost);
|
875 |
-
if(!$post){
|
876 |
-
$post = Mage::app()->getRequest()->getPost();
|
877 |
-
}
|
878 |
$defaultList = Mage::helper('monkey')->config('list');
|
879 |
if (isset($post['magemonkey_force'])) {
|
880 |
foreach ($post['list'] as $list) {
|
@@ -887,8 +880,11 @@ class Ebizmarts_MageMonkey_Helper_Data extends Mage_Core_Helper_Abstract
|
|
887 |
$this->subscribeToList($object, $db, $listId);
|
888 |
}
|
889 |
//Subscription for One Step Checkout with force subscription
|
890 |
-
}elseif(Mage::getSingleton('core/session')->getIsOneStepCheckout() && Mage::helper('monkey')->config('checkout_subscribe') > 2 && !Mage::getSingleton('core/session')->getIsUpdateCustomer()){
|
891 |
$this->subscribeToList($object, $db, $defaultList);
|
|
|
|
|
|
|
892 |
}
|
893 |
|
894 |
}
|
@@ -900,17 +896,18 @@ class Ebizmarts_MageMonkey_Helper_Data extends Mage_Core_Helper_Abstract
|
|
900 |
* @param $db
|
901 |
* @param null $listId
|
902 |
*/
|
903 |
-
public function subscribeToList($object, $db, $listId = NULL)
|
904 |
-
|
|
|
905 |
$listId = Mage::helper('monkey')->config('list');
|
906 |
}
|
907 |
$email = $object->getEmail();
|
908 |
|
909 |
-
if($object instanceof Mage_Customer_Model_Customer){
|
910 |
$subscriber = Mage::getModel('newsletter/subscriber')
|
911 |
->setImportMode(TRUE)
|
912 |
->setSubscriberEmail($email);
|
913 |
-
}else{
|
914 |
// $customer = Mage::getSingleton('customer/customer')->load($email);
|
915 |
// if($customer->getId()){
|
916 |
// $object = $customer;
|
@@ -919,29 +916,30 @@ class Ebizmarts_MageMonkey_Helper_Data extends Mage_Core_Helper_Abstract
|
|
919 |
}
|
920 |
|
921 |
$defaultList = Mage::helper('monkey')->config('list');
|
922 |
-
if($listId == $defaultList && !Mage::getSingleton('core/session')->getIsHandleSubscriber()){
|
923 |
$subscriber->subscribe($email);
|
924 |
-
}else{
|
925 |
|
926 |
$alreadyOnList = Mage::getSingleton('monkey/asyncsubscribers')->getCollection()
|
927 |
->addFieldToFilter('lists', $listId)
|
928 |
->addFieldToFilter('email', $email)
|
929 |
->addFieldToFilter('processed', 0);
|
930 |
//if not in magemonkey_async_subscribers with processed 0 add list
|
931 |
-
if(count($alreadyOnList) == 0){
|
932 |
$isConfirmNeed = FALSE;
|
933 |
-
if(
|
934 |
-
(Mage::getStoreConfig(Mage_Newsletter_Model_Subscriber::XML_PATH_CONFIRMATION_FLAG, $object->getStoreId()) == 1
|
|
|
935 |
$isConfirmNeed = TRUE;
|
936 |
}
|
937 |
|
938 |
$isOnMailChimp = Mage::helper('monkey')->subscribedToList($email, $listId);
|
939 |
//if( TRUE === $subscriber->getIsStatusChanged() ){
|
940 |
-
if($isOnMailChimp == 1){
|
941 |
return false;
|
942 |
}
|
943 |
|
944 |
-
if($isConfirmNeed) {
|
945 |
$subscriber->setStatus(Mage_Newsletter_Model_Subscriber::STATUS_UNCONFIRMED);
|
946 |
}
|
947 |
|
@@ -962,10 +960,10 @@ class Ebizmarts_MageMonkey_Helper_Data extends Mage_Core_Helper_Abstract
|
|
962 |
* @param $isConfirmNeed
|
963 |
* @param $db
|
964 |
*/
|
965 |
-
public function _subscribe($listId, $email, $mergeVars, $isConfirmNeed, $db)
|
966 |
-
|
967 |
-
{
|
968 |
-
if($isConfirmNeed){
|
969 |
Mage::getSingleton('core/session')->addSuccess(Mage::helper('monkey')->__('Confirmation request will be sent soon.'));
|
970 |
}
|
971 |
$subs = Mage::getModel('monkey/asyncsubscribers');
|
@@ -976,8 +974,8 @@ class Ebizmarts_MageMonkey_Helper_Data extends Mage_Core_Helper_Abstract
|
|
976 |
->setProcessed(0)
|
977 |
->setCreatedAt(Mage::getModel('core/date')->gmtDate())
|
978 |
->save();
|
979 |
-
}else{
|
980 |
-
if($isConfirmNeed){
|
981 |
Mage::getSingleton('core/session')->addSuccess(Mage::helper('monkey')->__('Confirmation request has been sent.'));
|
982 |
}
|
983 |
Mage::getSingleton('monkey/api')->listSubscribe($listId, $email, $mergeVars, 'html', $isConfirmNeed, TRUE);
|
@@ -985,95 +983,93 @@ class Ebizmarts_MageMonkey_Helper_Data extends Mage_Core_Helper_Abstract
|
|
985 |
}
|
986 |
|
987 |
/**
|
988 |
-
|
989 |
-
|
990 |
-
|
991 |
-
|
992 |
-
|
993 |
-
|
994 |
-
|
995 |
-
|
996 |
-
|
997 |
-
|
998 |
-
|
999 |
-
|
1000 |
-
|
1001 |
-
|
1002 |
-
|
1003 |
-
|
1004 |
-
|
1005 |
-
|
1006 |
-
|
1007 |
-
|
1008 |
-
|
1009 |
-
|
1010 |
-
|
1011 |
-
|
1012 |
-
|
1013 |
-
|
1014 |
-
foreach($curlists as $listId => $list){
|
1015 |
-
|
1016 |
-
|
1017 |
-
|
1018 |
-
|
1019 |
-
|
1020 |
-
|
1021 |
-
|
1022 |
-
|
1023 |
-
|
1024 |
-
|
1025 |
-
|
1026 |
-
|
1027 |
-
|
1028 |
-
|
1029 |
-
|
1030 |
$alreadyOnDb = Mage::getSingleton('monkey/asyncsubscribers')->getCollection()
|
1031 |
->addFieldToFilter('lists', $listId)
|
1032 |
->addFieldToFilter('email', $email)
|
1033 |
->addFieldToFilter('processed', 0);
|
1034 |
|
1035 |
-
if(count($alreadyOnDb) > 0){
|
1036 |
foreach ($alreadyOnDb as $listToDelete) {
|
1037 |
$toDelete = Mage::getModel('monkey/asyncsubscribers')->load($listToDelete->getId());
|
1038 |
$toDelete->delete();
|
1039 |
}
|
1040 |
Mage::getSingleton('core/session')
|
1041 |
->addSuccess($this->__('You have been removed from Newsletter.'));
|
1042 |
-
}else {
|
1043 |
$api->listUnsubscribe($listId, $email);
|
1044 |
Mage::getSingleton('core/session')
|
1045 |
->addSuccess($this->__('You have been removed from Newsletter.'));
|
1046 |
}
|
1047 |
|
1048 |
-
|
1049 |
|
1050 |
-
|
1051 |
-
|
1052 |
-
|
1053 |
-
|
1054 |
|
1055 |
-
|
1056 |
-
|
1057 |
-
|
1058 |
-
|
1059 |
-
|
1060 |
-
}
|
1061 |
-
}
|
1062 |
|
1063 |
-
|
1064 |
-
|
1065 |
-
|
1066 |
|
1067 |
-
|
1068 |
-
|
1069 |
Mage::getSingleton('core/session')
|
1070 |
->addSuccess($this->__('Your profile has been updated!'));
|
1071 |
|
1072 |
-
|
1073 |
|
1074 |
-
|
1075 |
|
1076 |
-
|
1077 |
|
1078 |
//Subscribe to new lists
|
1079 |
if (is_array($lists) && is_array($curlists)) {
|
@@ -1105,21 +1101,23 @@ class Ebizmarts_MageMonkey_Helper_Data extends Mage_Core_Helper_Abstract
|
|
1105 |
}
|
1106 |
}
|
1107 |
}
|
1108 |
-
|
1109 |
|
1110 |
-
public function getThisStore()
|
|
|
1111 |
$store = Mage::app()->getStore();
|
1112 |
|
1113 |
$configscope = Mage::app()->getRequest()->getParam('store');
|
1114 |
-
if(
|
1115 |
$store = $configscope;
|
1116 |
}
|
1117 |
return $store;
|
1118 |
}
|
1119 |
|
1120 |
-
public function getCanShowCampaignJs()
|
|
|
1121 |
$storeId = Mage::app()->getStore()->getStoreId();
|
1122 |
-
if(Mage::getStoreConfig(Ebizmarts_MageMonkey_Model_Config::ECOMMERCE360_ACTIVE, $storeId) && Mage::helper('monkey')->canMonkey()) {
|
1123 |
return 'ebizmarts/magemonkey/campaignCatcher.js';
|
1124 |
}
|
1125 |
}
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_MageMonkey_Helper_Data extends Mage_Core_Helper_Abstract
|
12 |
{
|
13 |
|
14 |
+
/**
|
15 |
+
* Utility to check if admin is logged in
|
16 |
+
*
|
17 |
+
* @return bool
|
18 |
+
*/
|
19 |
+
public function isAdmin()
|
20 |
+
{
|
21 |
+
return Mage::getSingleton('admin/session')->isLoggedIn();
|
22 |
+
}
|
23 |
|
24 |
/**
|
25 |
* Check if Magento is EE
|
32 |
}
|
33 |
|
34 |
|
35 |
+
/**
|
36 |
+
* Whether Admin Notifications should be displayed or not in backend Admin
|
37 |
+
*
|
38 |
+
* @return bool
|
39 |
+
*/
|
40 |
+
public function isAdminNotificationEnabled()
|
41 |
+
{
|
42 |
+
return $this->config('adminhtml_notification');
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Return Webhooks security key for given store
|
47 |
+
*
|
48 |
+
* @param mixed $store Store object, or Id, or code
|
49 |
+
* @param string $listId Optional listid to retrieve store code from it
|
50 |
+
* @return string
|
51 |
+
*/
|
52 |
+
public function getWebhooksKey($store = null, $listId = null)
|
53 |
+
{
|
54 |
+
if (!is_null($listId)) {
|
55 |
+
$store = $this->getStoreByList($listId, TRUE);
|
56 |
+
}
|
57 |
+
|
58 |
+
$crypt = md5((string)Mage::getConfig()->getNode('global/crypt/key'));
|
59 |
+
$key = substr($crypt, 0, (strlen($crypt) / 2));
|
60 |
|
61 |
// Prevent most cases to attach default in webhook url
|
62 |
+
if (!$store || $store == 'default') $store = '';
|
63 |
+
|
64 |
+
return ($key . $store);
|
65 |
+
}
|
66 |
+
|
67 |
+
public function filterShowGroupings($interestGroupings)
|
68 |
+
{
|
69 |
+
if (is_array($interestGroupings)) {
|
70 |
+
|
71 |
+
$customGroupings = (array)Mage::getConfig()->getNode('default/monkey/custom_groupings');
|
72 |
+
foreach ($interestGroupings as $key => $group) {
|
73 |
+
|
74 |
+
if (TRUE === in_array($group['name'], $customGroupings)) {
|
75 |
+
unset($interestGroupings[$key]);
|
76 |
+
}
|
77 |
+
|
78 |
+
}
|
79 |
+
}
|
80 |
+
|
81 |
+
return $interestGroupings;
|
82 |
+
}
|
83 |
+
|
84 |
+
/**
|
85 |
+
* Check if CustomerGroup grouping already exists on MC
|
86 |
+
*
|
87 |
+
* @param array $groupings
|
88 |
+
* @return bool
|
89 |
+
*/
|
90 |
+
public function customerGroupGroupingExists($interestGroupings)
|
91 |
+
{
|
92 |
+
$exists = FALSE;
|
93 |
+
if (is_array($interestGroupings)) {
|
94 |
+
foreach ($interestGroupings as $group) {
|
95 |
+
if ($group['name'] == $this->getCustomerGroupingName()) {
|
96 |
+
$exists = TRUE;
|
97 |
+
break;
|
98 |
+
}
|
99 |
+
}
|
100 |
+
}
|
101 |
+
|
102 |
+
return $exists;
|
103 |
+
}
|
104 |
+
|
105 |
+
/**
|
106 |
+
* Return customer groping name to be used when creating a grouping to store
|
107 |
+
* Magento customer groups
|
108 |
+
*
|
109 |
+
* @return string
|
110 |
+
*/
|
111 |
+
public function getCustomerGroupingName()
|
112 |
+
{
|
113 |
+
return (string)Mage::getConfig()->getNode('default/monkey/custom_groupings/customer_grouping_name');
|
114 |
+
}
|
115 |
+
|
116 |
+
/**
|
117 |
+
* Get module User-Agent to use on API requests
|
118 |
+
*
|
119 |
+
* @return string
|
120 |
+
*/
|
121 |
+
public function getUserAgent()
|
122 |
+
{
|
123 |
+
$modules = Mage::getConfig()->getNode('modules')->children();
|
124 |
+
$modulesArray = (array)$modules;
|
125 |
+
|
126 |
+
$aux = (array_key_exists('Enterprise_Enterprise', $modulesArray)) ? 'EE' : 'CE';
|
127 |
+
$v = (string)Mage::getConfig()->getNode('modules/Ebizmarts_MageMonkey/version');
|
128 |
+
$version = strpos(Mage::getVersion(), '-') ? substr(Mage::getVersion(), 0, strpos(Mage::getVersion(), '-')) : Mage::getVersion();
|
129 |
+
return (string)'MageMonkey' . $v . '/Mage' . $aux . $version;
|
130 |
+
}
|
131 |
+
|
132 |
+
/**
|
133 |
+
* Return Mandrill API key
|
134 |
+
*
|
135 |
+
* @param string $store
|
136 |
+
* @return string Api Key
|
137 |
+
*/
|
138 |
+
public function getMandrillApiKey($store = null)
|
139 |
+
{
|
140 |
+
if (is_null($store)) {
|
141 |
+
$key = $this->config('mandrill_apikey');
|
142 |
+
} else {
|
143 |
+
$curstore = Mage::app()->getStore();
|
144 |
+
Mage::app()->setCurrentStore($store);
|
145 |
+
$key = $this->config('mandrill_apikey', $store);
|
146 |
+
Mage::app()->setCurrentStore($curstore);
|
147 |
+
}
|
148 |
+
|
149 |
+
return $key;
|
150 |
+
}
|
151 |
+
|
152 |
+
/**
|
153 |
+
* Return MC API key for given store, if none is given
|
154 |
+
* default key is returned
|
155 |
+
*
|
156 |
+
* @param string $store
|
157 |
+
* @return string Api Key
|
158 |
+
*/
|
159 |
+
public function getApiKey($store = null)
|
160 |
+
{
|
161 |
+
if (is_null($store)) {
|
162 |
+
$key = $this->config('apikey');
|
163 |
+
} else {
|
164 |
+
$curstore = Mage::app()->getStore();
|
165 |
+
Mage::app()->setCurrentStore($store);
|
166 |
+
$key = $this->config('apikey', $store);
|
167 |
+
Mage::app()->setCurrentStore($curstore);
|
168 |
+
}
|
169 |
+
|
170 |
+
return $key;
|
171 |
+
}
|
172 |
+
|
173 |
+
/**
|
174 |
+
* Logging facility
|
175 |
+
*
|
176 |
+
* @param mixed $data Message to save to file
|
177 |
+
* @param string $filename log filename, default is <Monkey.log>
|
178 |
+
* @return Mage_Core_Model_Log_Adapter
|
179 |
+
*/
|
180 |
+
public function log($data, $filename = 'Monkey.log')
|
181 |
+
{
|
182 |
+
if ($this->config('enable_log') != 0) {
|
183 |
+
return Mage::getModel('core/log_adapter', $filename)->log($data);
|
184 |
+
}
|
185 |
+
}
|
186 |
+
|
187 |
+
/**
|
188 |
+
* Get module configuration value
|
189 |
+
*
|
190 |
+
* @param string $value
|
191 |
+
* @param string $store
|
192 |
+
* @return mixed Configuration setting
|
193 |
+
*/
|
194 |
+
public function config($value, $store = null)
|
195 |
+
{
|
196 |
+
$store = is_null($store) ? Mage::app()->getStore() : $store;
|
197 |
+
|
198 |
+
$configscope = Mage::app()->getRequest()->getParam('store');
|
199 |
+
if ($configscope && ($configscope !== 'undefined') && !is_array($configscope)) {
|
200 |
if (is_array($configscope) && isset($configscope['code'])) {
|
201 |
$store = $configscope['code'];
|
202 |
} else {
|
203 |
$store = $configscope;
|
204 |
}
|
205 |
+
}
|
206 |
+
|
207 |
+
return Mage::getStoreConfig("monkey/general/$value", $store);
|
208 |
+
}
|
209 |
+
|
210 |
+
/**
|
211 |
+
* Check if config setting <checkout_subscribe> is enabled
|
212 |
+
*
|
213 |
+
* @return bool
|
214 |
+
*/
|
215 |
+
public function canCheckoutSubscribe()
|
216 |
+
{
|
217 |
+
return $this->config('checkout_subscribe');
|
218 |
+
}
|
219 |
+
|
220 |
+
/**
|
221 |
+
* Check if an email is subscribed on MailChimp
|
222 |
+
*
|
223 |
+
* @param string $email
|
224 |
+
* @param string $listId
|
225 |
+
* @return bool
|
226 |
+
*/
|
227 |
+
public function subscribedToList($email, $listId = null)
|
228 |
+
{
|
229 |
+
$on = FALSE;
|
230 |
+
|
231 |
+
if ($email) {
|
232 |
+
$member = Mage::getSingleton('monkey/api')
|
233 |
+
->listMemberInfo($listId, $email);
|
234 |
+
|
235 |
+
if (!is_string($member) && $member['success'] && ($member['data'][0]['status'] == 'subscribed' || $member['data'][0]['status'] == 'pending')) {
|
236 |
+
$on = TRUE;
|
237 |
+
}
|
238 |
+
}
|
239 |
|
240 |
return $on;
|
241 |
+
}
|
242 |
+
|
243 |
+
/**
|
244 |
+
* Check if Ecommerce360 integration is enabled
|
245 |
+
*
|
246 |
+
* @return bool
|
247 |
+
*/
|
248 |
+
public function ecommerce360Active()
|
249 |
+
{
|
250 |
$storeId = Mage::app()->getStore()->getId();
|
251 |
+
return (bool)(Mage::getStoreConfig(Ebizmarts_MageMonkey_Model_Config::ECOMMERCE360_ACTIVE, $storeId) != 0);
|
252 |
+
}
|
253 |
+
|
254 |
+
/**
|
255 |
+
* Check if Transactional Email via MC is enabled
|
256 |
+
*
|
257 |
+
* @return bool
|
258 |
+
*/
|
259 |
+
public function useTransactionalService()
|
260 |
+
{
|
261 |
+
return Mage::getStoreConfigFlag("monkey/general/transactional_emails");
|
262 |
+
}
|
263 |
+
|
264 |
+
/**
|
265 |
+
* Check if Ebizmarts_MageMonkey module is enabled
|
266 |
+
*
|
267 |
+
* @return bool
|
268 |
+
*/
|
269 |
+
public function canMonkey()
|
270 |
+
{
|
271 |
+
return (bool)((int)$this->config('active') !== 0);
|
272 |
+
}
|
273 |
+
|
274 |
+
/**
|
275 |
+
* Get default MC listId for given storeId
|
276 |
+
*
|
277 |
+
* @param string $store
|
278 |
+
* @return string $list
|
279 |
+
*/
|
280 |
+
public function getDefaultList($store)
|
281 |
+
{
|
282 |
+
$curstore = Mage::app()->getStore();
|
283 |
+
Mage::app()->setCurrentStore($store);
|
284 |
+
$list = $this->config('list', $store);
|
285 |
+
Mage::app()->setCurrentStore($curstore);
|
286 |
+
return $list;
|
287 |
+
}
|
288 |
+
|
289 |
+
/**
|
290 |
+
* Get additional Lists by storeId
|
291 |
+
*
|
292 |
+
* @param string $store
|
293 |
+
* @return string $list
|
294 |
+
*/
|
295 |
+
public function getAdditionalList($store)
|
296 |
+
{
|
297 |
+
$curstore = Mage::app()->getStore();
|
298 |
+
Mage::app()->setCurrentStore($store);
|
299 |
+
$list = $this->config('additional_lists', $store);
|
300 |
+
Mage::app()->setCurrentStore($curstore);
|
301 |
+
return $list;
|
302 |
+
}
|
303 |
+
|
304 |
+
/**
|
305 |
+
* Get which store is associated to given $mcListId
|
306 |
+
*
|
307 |
+
* @param string $mcListId
|
308 |
+
* @param bool $includeDefault Include <default> store or not on result
|
309 |
+
* @return string $store
|
310 |
+
*/
|
311 |
+
public function getStoreByList($mcListId, $includeDefault = FALSE)
|
312 |
+
{
|
313 |
$list = Mage::getModel('core/config_data')->getCollection()
|
314 |
+
->addValueFilter($mcListId)->getFirstItem();
|
315 |
|
316 |
$store = null;
|
317 |
+
if ($list->getId()) {
|
318 |
|
319 |
+
//$isDefault = (bool)($list->getScope() == 'default');
|
320 |
+
$isDefault = (bool)($list->getScope() == Mage::app()->getDefaultStoreView()->getCode());
|
321 |
+
if (!$isDefault && !$includeDefault) {
|
322 |
+
$store = (string)Mage::app()->getStore($list->getScopeId())->getCode();
|
323 |
+
} else {
|
324 |
+
$store = $list->getScope();
|
325 |
+
}
|
326 |
|
327 |
}
|
328 |
|
329 |
return $store;
|
330 |
+
}
|
331 |
+
|
332 |
+
/**
|
333 |
+
* Check if current request is a Webhooks request
|
334 |
+
*
|
335 |
+
* @return bool
|
336 |
+
*/
|
337 |
+
public function isWebhookRequest()
|
338 |
+
{
|
339 |
+
$rq = Mage::app()->getRequest();
|
340 |
+
$monkeyRequest = (string)'monkeywebhookindex';
|
341 |
+
$thisRequest = (string)($rq->getRequestedRouteName() . $rq->getRequestedControllerName() . $rq->getRequestedActionName());
|
342 |
+
|
343 |
+
return (bool)($monkeyRequest === $thisRequest);
|
344 |
+
}
|
345 |
+
|
346 |
+
/**
|
347 |
+
* Get config setting <map_fields>
|
348 |
+
*
|
349 |
+
* @return array|FALSE
|
350 |
+
*/
|
351 |
+
public function getMergeMaps($storeId)
|
352 |
+
{
|
353 |
+
return unserialize($this->config('map_fields', $storeId));
|
354 |
+
}
|
355 |
+
|
356 |
+
/**
|
357 |
+
* Get progress bar HTML code
|
358 |
+
*
|
359 |
+
* @param integer $complete Processed qty so far
|
360 |
+
* @param integer $total Total qty to process
|
361 |
+
* @return string
|
362 |
+
*/
|
363 |
+
public function progressbar($complete, $total)
|
364 |
+
{
|
365 |
+
if ($total == 0) {
|
366 |
+
return;
|
367 |
+
}
|
368 |
+
$percentage = round(($complete * 100) / $total, 0);
|
369 |
+
|
370 |
+
$barStyle = '';
|
371 |
+
if ($percentage > 0) {
|
372 |
+
$barStyle = " style=\"width: $percentage%\"";
|
373 |
+
}
|
374 |
+
|
375 |
+
$html = "<div id=\"bar-progress-bar\" class=\"bar-all-rounded\">\n";
|
376 |
+
$html .= "<div id=\"bar-progress-bar-percentage\" class=\"bar-all-rounded\"$barStyle>";
|
377 |
+
$html .= "$percentage% ($complete of $total)";
|
378 |
+
//<progress value="75" max="100">3/4 complete</progress>
|
379 |
+
//if ($percentage > 5) {$html .= "$percentage% ($complete of $total)";} else {$html .= "<div class=\"bar-spacer\"> </div>";}
|
380 |
+
$html .= "</div></div>";
|
381 |
+
|
382 |
+
return $html;
|
383 |
+
}
|
384 |
+
|
385 |
+
/**
|
386 |
+
* Return Merge Fields mapped to Magento attributes
|
387 |
+
*
|
388 |
+
* @param object $customer
|
389 |
+
* @param bool $includeEmail
|
390 |
+
* @param integer $websiteId
|
391 |
+
* @return array
|
392 |
+
*/
|
393 |
+
public function getMergeVars($customer, $includeEmail = FALSE, $websiteId = NULL)
|
394 |
+
{
|
395 |
+
$merge_vars = array();
|
396 |
+
$maps = $this->getMergeMaps($customer->getStoreId());
|
397 |
+
|
398 |
+
if (!$maps) {
|
399 |
+
return;
|
400 |
+
}
|
401 |
+
|
402 |
+
$request = Mage::app()->getRequest();
|
403 |
+
|
404 |
+
//Add Customer data to Subscriber if is Newsletter_Subscriber is Customer
|
405 |
+
if (!$customer->getDefaultShipping() && $customer->getEntityId()) {
|
406 |
+
$customer->addData(Mage::getModel('customer/customer')->load($customer->getEntityId())
|
407 |
+
->setStoreId($customer->getStoreId())
|
408 |
+
->toArray());
|
409 |
+
} elseif ($customer->getCustomerId()) {
|
410 |
+
$customer->addData(Mage::getModel('customer/customer')->load($customer->getCustomerId())
|
411 |
+
->setStoreId($customer->getStoreId())
|
412 |
+
->toArray());
|
413 |
+
}
|
414 |
+
|
415 |
+
foreach ($maps as $map) {
|
416 |
+
|
417 |
+
$customAtt = $map['magento'];
|
418 |
+
$chimpTag = $map['mailchimp'];
|
419 |
+
|
420 |
+
if ($chimpTag && $customAtt) {
|
421 |
+
|
422 |
+
$key = strtoupper($chimpTag);
|
423 |
+
|
424 |
+
switch ($customAtt) {
|
425 |
+
case 'gender':
|
426 |
+
$val = (int)$customer->getData(strtolower($customAtt));
|
427 |
+
if ($val == 1) {
|
428 |
+
$merge_vars[$key] = 'Male';
|
429 |
+
} elseif ($val == 2) {
|
430 |
+
$merge_vars[$key] = 'Female';
|
431 |
+
}
|
432 |
+
break;
|
433 |
+
case 'dob':
|
434 |
+
$dob = (string)$customer->getData(strtolower($customAtt));
|
435 |
+
if ($dob) {
|
436 |
+
$merge_vars[$key] = (substr($dob, 5, 2) . '/' . substr($dob, 8, 2));
|
437 |
+
}
|
438 |
+
break;
|
439 |
+
case 'billing_address':
|
440 |
+
case 'shipping_address':
|
441 |
+
|
442 |
+
$addr = explode('_', $customAtt);
|
443 |
+
$address = $customer->{'getPrimary' . ucfirst($addr[0]) . 'Address'}();
|
444 |
+
if (!$address) {
|
445 |
+
if ($customer->{'getDefault' . ucfirst($addr[0])}()) {
|
446 |
+
$address = Mage::getModel('customer/address')->load($customer->{'getDefault' . ucfirst($addr[0])}());
|
447 |
+
}
|
448 |
+
}
|
449 |
+
if ($address) {
|
450 |
+
$merge_vars[$key] = array(
|
451 |
+
'addr1' => $address->getStreet(1),
|
452 |
+
'addr2' => $address->getStreet(2),
|
453 |
+
'city' => $address->getCity(),
|
454 |
+
'state' => (!$address->getRegion() ? $address->getCity() : $address->getRegion()),
|
455 |
+
'zip' => $address->getPostcode(),
|
456 |
+
'country' => $address->getCountryId()
|
457 |
+
);
|
458 |
+
$telephone = $address->getTelephone();
|
459 |
+
if ($telephone) {
|
460 |
+
$merge_vars['TELEPHONE'] = $telephone;
|
461 |
+
}
|
462 |
+
$company = $address->getCompany();
|
463 |
+
if ($company) {
|
464 |
+
$merge_vars['COMPANY'] = $company;
|
465 |
+
}
|
466 |
$country = $address->getCountryId();
|
467 |
+
if ($country) {
|
468 |
$merge_vars['COUNTRY'] = $country;
|
469 |
}
|
470 |
+
}
|
471 |
|
472 |
+
break;
|
473 |
+
case 'date_of_purchase':
|
474 |
|
475 |
+
$last_order = Mage::getResourceModel('sales/order_collection')
|
476 |
+
->addFieldToFilter('customer_email', $customer->getEmail())
|
477 |
+
->addFieldToFilter('state', array('in' => Mage::getSingleton('sales/order_config')->getVisibleOnFrontStates()))
|
478 |
+
->setOrder('created_at', 'desc')
|
479 |
->setPageSize(1)
|
480 |
+
->getFirstItem();
|
481 |
+
if ($last_order->getId()) {
|
482 |
$merge_vars[$key] = date('m/d/Y', strtotime($last_order->getCreatedAt()));
|
483 |
+
}
|
484 |
+
|
485 |
+
break;
|
486 |
+
case 'ee_customer_balance':
|
487 |
+
|
488 |
+
$merge_vars[$key] = '';
|
489 |
+
|
490 |
+
if ($this->isEnterprise() && $customer->getId()) {
|
491 |
+
|
492 |
+
$_customer = Mage::getModel('customer/customer')->load($customer->getId());
|
493 |
+
if ($_customer->getId()) {
|
494 |
+
if (Mage::app()->getStore()->isAdmin()) {
|
495 |
+
$websiteId = is_null($websiteId) ? Mage::app()->getStore()->getWebsiteId() : $websiteId;
|
496 |
+
}
|
497 |
+
|
498 |
+
$balance = Mage::getModel('enterprise_customerbalance/balance')
|
499 |
+
->setWebsiteId($websiteId)
|
500 |
+
->setCustomerId($_customer->getId())
|
501 |
+
->loadByCustomer();
|
502 |
+
|
503 |
+
$merge_vars[$key] = $balance->getAmount();
|
504 |
+
}
|
505 |
+
|
506 |
+
}
|
507 |
+
|
508 |
+
break;
|
509 |
+
case 'group_id':
|
510 |
+
$group_id = (int)$customer->getData(strtolower($customAtt));
|
511 |
+
$customerGroup = Mage::helper('customer')->getGroups()->toOptionHash();
|
512 |
+
if ($group_id == 0) {
|
513 |
+
$merge_vars[$key] = 'NOT LOGGED IN';
|
514 |
+
} else {
|
515 |
+
$merge_vars[$key] = $customerGroup[$group_id];
|
516 |
+
}
|
517 |
+
break;
|
518 |
+
default:
|
519 |
+
|
520 |
+
if (($value = (string)$customer->getData(strtolower($customAtt)))
|
521 |
+
OR ($value = (string)$request->getPost(strtolower($customAtt)))
|
522 |
+
) {
|
523 |
+
$merge_vars[$key] = $value;
|
524 |
+
}
|
525 |
+
|
526 |
+
break;
|
527 |
+
}
|
528 |
+
|
529 |
+
}
|
530 |
+
}
|
531 |
+
|
532 |
+
//GUEST
|
533 |
+
if (!$customer->getId() && !$request->getPost('firstname')) {
|
534 |
+
$guestFirstName = $this->config('guest_name', $customer->getStoreId());
|
535 |
+
|
536 |
+
if ($guestFirstName) {
|
537 |
+
$merge_vars['FNAME'] = $guestFirstName;
|
538 |
+
}
|
539 |
+
}
|
540 |
+
if (!$customer->getId() && !$request->getPost('lastname')) {
|
541 |
+
$guestLastName = $this->config('guest_lastname', $customer->getStoreId());
|
542 |
+
|
543 |
+
if ($guestLastName) {
|
544 |
+
$merge_vars['LNAME'] = $guestLastName;
|
545 |
+
}
|
546 |
+
}
|
547 |
+
//GUEST
|
548 |
+
|
549 |
+
if ($includeEmail) {
|
550 |
+
$merge_vars['EMAIL'] = $customer->getEmail();
|
551 |
+
}
|
552 |
+
|
553 |
+
$groups = $customer->getListGroups();
|
554 |
+
$groupings = array();
|
555 |
+
|
556 |
+
if (is_array($groups) && count($groups)) {
|
557 |
+
foreach ($groups as $groupId => $grupoptions) {
|
558 |
+
if (is_array($grupoptions)) {
|
|
|
559 |
$grupOptionsEscaped = array();
|
560 |
+
foreach ($grupoptions as $gopt) {
|
561 |
+
$gopt = str_replace(",", "%C%", $gopt);
|
|
|
562 |
$grupOptionsEscaped[] = $gopt;
|
563 |
}
|
564 |
$groupings[] = array(
|
565 |
'id' => $groupId,
|
566 |
+
'groups' => str_replace('%C%', '\\,', implode(', ', $grupOptionsEscaped))
|
567 |
);
|
568 |
+
} else {
|
|
|
|
|
569 |
$groupings[] = array(
|
570 |
'id' => $groupId,
|
571 |
+
'groups' => str_replace(',', '\\,', $grupoptions)
|
572 |
);
|
573 |
}
|
574 |
}
|
575 |
+
}
|
576 |
|
577 |
+
$merge_vars['GROUPINGS'] = $groupings;
|
578 |
|
579 |
+
//magemonkey_mergevars_after
|
580 |
+
$blank = new Varien_Object;
|
581 |
+
Mage::dispatchEvent('magemonkey_mergevars_after',
|
582 |
+
array('vars' => $merge_vars, 'customer' => $customer, 'newvars' => $blank));
|
583 |
+
if ($blank->hasData()) {
|
584 |
+
$merge_vars = array_merge($merge_vars, $blank->toArray());
|
585 |
+
}
|
586 |
+
//magemonkey_mergevars_after
|
587 |
|
588 |
+
return $merge_vars;
|
589 |
+
}
|
590 |
|
591 |
/**
|
592 |
* Get Mergevars
|
642 |
$footerSubscription = $request->getActionName() == 'new' && $request->getControllerName() == 'subscriber' && $request->getModuleName() == 'newsletter';
|
643 |
$customerSubscription = $request->getActionName() == 'saveadditional';
|
644 |
$customerCreateAccountSubscription = $request->getActionName() == 'createpost';
|
645 |
+
if ($post && !$adminSubscription && !$customerSubscription && !$customerCreateAccountSubscription || Mage::getSingleton('core/session')->getIsOneStepCheckout()) {
|
646 |
$defaultList = Mage::helper('monkey')->config('list');
|
647 |
//if can change customer set the groups set by customer else set the groups on MailChimp config
|
648 |
$canChangeGroups = Mage::getStoreConfig('monkey/general/changecustomergroup', $object->getStoreId());
|
655 |
}
|
656 |
}
|
657 |
$groups = NULL;
|
658 |
+
} elseif ($currentList == $defaultList) {
|
659 |
$groups = Mage::getStoreConfig('monkey/general/cutomergroup', $object->getStoreId());
|
660 |
$groups = explode(",", $groups);
|
661 |
if (isset($groups[0]) && $groups[0]) {
|
664 |
$checkboxes = array();
|
665 |
foreach ($groups as $group) {
|
666 |
$item = explode("_", $group);
|
667 |
+
if ($item[0]) {
|
668 |
$currentGroup = $item[0];
|
669 |
if ($currentGroup == $_prevGroup || $_prevGroup == null) {
|
670 |
$checkboxes[] = $item[1];
|
677 |
}
|
678 |
}
|
679 |
}
|
680 |
+
if ($currentGroup) {
|
681 |
$subscribeGroups[] = array('id' => $currentGroup, "groups" => str_replace('%C%', '\\,', implode(', ', $checkboxes)));
|
682 |
}
|
683 |
|
697 |
} else {
|
698 |
$mergeVars[$map] = "No";
|
699 |
}
|
700 |
+
} elseif (Mage::getSingleton('core/session')->getIsOneStepCheckout()) {
|
701 |
$post2 = $request->getPost();
|
702 |
+
if (isset($post['subscribe_newsletter']) || isset($post2['subscribe_newsletter'])) {
|
703 |
$mergeVars[$map] = "Yes";
|
704 |
+
} elseif (Mage::helper('monkey')->config('checkout_subscribe') > 2) {
|
705 |
$mergeVars[$map] = "No";
|
706 |
}
|
707 |
+
} elseif ($request->getModuleName() == 'checkout') {
|
708 |
$mergeVars[$map] = "No";
|
709 |
}
|
710 |
+
} else {
|
711 |
$map = Mage::getStoreConfig('monkey/general/markfield', $object->getStoreId());
|
712 |
$mergeVars[$map] = "Yes";
|
713 |
}
|
715 |
return $mergeVars;
|
716 |
}
|
717 |
|
718 |
+
/**
|
719 |
+
* Register on Magento's registry GUEST customer data for MergeVars for on checkout subscribe
|
720 |
+
*
|
721 |
+
* @param Mage_Sales_Model_Order $order
|
722 |
+
* @return void
|
723 |
+
*/
|
724 |
+
public function registerGuestCustomer($order)
|
725 |
+
{
|
726 |
+
|
727 |
+
if (Mage::registry('mc_guest_customer')) {
|
728 |
+
return;
|
729 |
+
}
|
730 |
+
|
731 |
+
$customer = new Varien_Object;
|
732 |
+
|
733 |
+
$customer->setId('guest' . time());
|
734 |
+
$customer->setEmail($order->getBillingAddress()->getEmail());
|
735 |
+
$customer->setStoreId($order->getStoreId());
|
736 |
+
$customer->setFirstname($order->getBillingAddress()->getFirstname());
|
737 |
+
$customer->setLastname($order->getBillingAddress()->getLastname());
|
738 |
+
$customer->setPrimaryBillingAddress($order->getBillingAddress());
|
739 |
+
$customer->setPrimaryShippingAddress($order->getShippingAddress());
|
740 |
+
|
741 |
+
Mage::register('mc_guest_customer', $customer, TRUE);
|
742 |
+
|
743 |
+
}
|
744 |
+
|
745 |
+
|
746 |
+
/**
|
747 |
+
* Create a Magento's customer account for given data
|
748 |
+
*
|
749 |
+
* @param array $accountData
|
750 |
+
* @param integer $websiteId ID of website to associate customer to
|
751 |
+
* @return Mage_Customer_Model_Customer
|
752 |
+
*/
|
753 |
+
public function createCustomerAccount($accountData, $websiteId)
|
754 |
+
{
|
755 |
+
$customer = Mage::getModel('customer/customer')->setWebsiteId($websiteId);
|
756 |
+
|
757 |
+
if (!isset($accountData['firstname']) OR empty($accountData['firstname'])) {
|
758 |
+
$accountData['firstname'] = $this->__('Store');
|
759 |
+
}
|
760 |
+
if (!isset($accountData['lastname']) OR empty($accountData['lastname'])) {
|
761 |
+
$accountData['lastname'] = $this->__('Guest');
|
762 |
+
}
|
763 |
+
|
764 |
+
$customerForm = Mage::getModel('customer/form');
|
765 |
+
$customerForm->setFormCode('customer_account_create')
|
766 |
+
->setEntity($customer)
|
767 |
+
->initDefaultValues();
|
768 |
// emulate request
|
769 |
$request = $customerForm->prepareRequest($accountData);
|
770 |
+
$customerData = $customerForm->extractData($request);
|
771 |
$customerForm->restoreData($customerData);
|
772 |
|
773 |
+
$customerErrors = $customerForm->validateData($customerData);
|
774 |
|
775 |
+
if ($customerErrors) {
|
776 |
$customerForm->compactData($customerData);
|
777 |
|
778 |
$pwd = $customer->generatePassword(8);
|
779 |
$customer->setPassword($pwd);
|
780 |
+
try {
|
781 |
$customer->save();
|
782 |
|
783 |
+
if ($customer->isConfirmationRequired()) {
|
784 |
$customer->sendNewAccountEmail('confirmation');
|
785 |
}
|
786 |
/**
|
787 |
* Handle Address related Data
|
788 |
*/
|
789 |
$billing = $shipping = null;
|
790 |
+
if (isset($accountData['billing_address']) && !empty($accountData['billing_address'])) {
|
791 |
$this->_McAddressToMage($accountData, 'billing', $customer);
|
792 |
}
|
793 |
+
if (isset($accountData['shipping_address']) && !empty($accountData['shipping_address'])) {
|
794 |
$this->_McAddressToMage($accountData, 'shipping', $customer);
|
795 |
}
|
796 |
+
} catch (Exception $ex) {
|
797 |
$this->log($ex->getMessage(), 'Monkey.log');
|
798 |
}
|
799 |
+
}
|
800 |
+
|
801 |
+
return $customer;
|
802 |
+
}
|
803 |
+
|
804 |
+
/**
|
805 |
+
* Parse MailChimp <address> MergeField type to Magento's address object
|
806 |
+
*
|
807 |
+
* @param array $data MC address data
|
808 |
+
* @param string $type billing or shipping
|
809 |
+
* @param Mage_Customer_Model_Customer $customer
|
810 |
+
* @return array Empty if noy errors, or a list of errors in an Array
|
811 |
+
*/
|
812 |
+
protected function _McAddressToMage(array $data, $type, $customer)
|
813 |
+
{
|
814 |
+
$addressData = $data["{$type}_address"];
|
815 |
+
$address = explode(str_repeat(chr(32), 2), $addressData);
|
816 |
+
list($addr1, $addr2, $city, $state, $zip, $country) = $address;
|
817 |
+
|
818 |
+
$region = Mage::getModel('directory/region')->loadByName($state, $country);
|
819 |
+
|
820 |
+
$mgAddress = array(
|
821 |
+
'firstname' => $data['firstname'],
|
822 |
+
'lastname' => $data['lastname'],
|
823 |
+
'street' => array($addr1, $addr2),
|
824 |
+
'city' => $city,
|
825 |
+
'country_id' => $country,
|
826 |
+
'region' => $state,
|
827 |
+
'region_id' => (!is_null($region->getId()) ? $region->getId() : null),
|
828 |
+
'postcode' => $zip,
|
829 |
+
'telephone' => 'not_provided',
|
830 |
+
);
|
831 |
|
832 |
/* @var $address Mage_Customer_Model_Address */
|
833 |
$address = Mage::getModel('customer/address');
|
836 |
$addressForm->setFormCode('customer_register_address')
|
837 |
->setEntity($address);
|
838 |
|
839 |
+
$addrrequest = $addressForm->prepareRequest($mgAddress);
|
840 |
$addressData = $addressForm->extractData($addrrequest);
|
841 |
+
$addressErrors = $addressForm->validateData($addressData);
|
842 |
|
843 |
$errors = array();
|
844 |
if ($addressErrors === true) {
|
845 |
$address->setId(null)
|
846 |
+
->setData("is_default_{$type}", TRUE);
|
847 |
$addressForm->compactData($addressData);
|
848 |
$customer->addAddress($address);
|
849 |
|
855 |
$errors = array_merge($errors, $addressErrors);
|
856 |
}
|
857 |
|
858 |
+
return $errors;
|
859 |
+
}
|
860 |
|
861 |
/**
|
862 |
* handles subscription to any list on post
|
864 |
* @param $object
|
865 |
* @param $db
|
866 |
*/
|
867 |
+
public function listsSubscription($object, $db)
|
868 |
+
{
|
869 |
$monkeyPost = Mage::getSingleton('core/session')->getMonkeyPost();
|
870 |
$post = unserialize($monkeyPost);
|
|
|
|
|
|
|
871 |
$defaultList = Mage::helper('monkey')->config('list');
|
872 |
if (isset($post['magemonkey_force'])) {
|
873 |
foreach ($post['list'] as $list) {
|
880 |
$this->subscribeToList($object, $db, $listId);
|
881 |
}
|
882 |
//Subscription for One Step Checkout with force subscription
|
883 |
+
} elseif (Mage::getSingleton('core/session')->getIsOneStepCheckout() && Mage::helper('monkey')->config('checkout_subscribe') > 2 && !Mage::getSingleton('core/session')->getIsUpdateCustomer()) {
|
884 |
$this->subscribeToList($object, $db, $defaultList);
|
885 |
+
} elseif(!$post){
|
886 |
+
//subscribe customer from admin
|
887 |
+
$this->subscribeToList($object, $db, $defaultList, TRUE);
|
888 |
}
|
889 |
|
890 |
}
|
896 |
* @param $db
|
897 |
* @param null $listId
|
898 |
*/
|
899 |
+
public function subscribeToList($object, $db, $listId = NULL, $forceSubscribe = FALSE)
|
900 |
+
{
|
901 |
+
if (!$listId) {
|
902 |
$listId = Mage::helper('monkey')->config('list');
|
903 |
}
|
904 |
$email = $object->getEmail();
|
905 |
|
906 |
+
if ($object instanceof Mage_Customer_Model_Customer) {
|
907 |
$subscriber = Mage::getModel('newsletter/subscriber')
|
908 |
->setImportMode(TRUE)
|
909 |
->setSubscriberEmail($email);
|
910 |
+
} else {
|
911 |
// $customer = Mage::getSingleton('customer/customer')->load($email);
|
912 |
// if($customer->getId()){
|
913 |
// $object = $customer;
|
916 |
}
|
917 |
|
918 |
$defaultList = Mage::helper('monkey')->config('list');
|
919 |
+
if ($listId == $defaultList && !Mage::getSingleton('core/session')->getIsHandleSubscriber() && !$forceSubscribe/*from admin*/) {
|
920 |
$subscriber->subscribe($email);
|
921 |
+
} else {
|
922 |
|
923 |
$alreadyOnList = Mage::getSingleton('monkey/asyncsubscribers')->getCollection()
|
924 |
->addFieldToFilter('lists', $listId)
|
925 |
->addFieldToFilter('email', $email)
|
926 |
->addFieldToFilter('processed', 0);
|
927 |
//if not in magemonkey_async_subscribers with processed 0 add list
|
928 |
+
if (count($alreadyOnList) == 0) {
|
929 |
$isConfirmNeed = FALSE;
|
930 |
+
if (!Mage::helper('monkey')->isAdmin() &&
|
931 |
+
(Mage::getStoreConfig(Mage_Newsletter_Model_Subscriber::XML_PATH_CONFIRMATION_FLAG, $object->getStoreId()) == 1 && !$forceSubscribe)
|
932 |
+
) {
|
933 |
$isConfirmNeed = TRUE;
|
934 |
}
|
935 |
|
936 |
$isOnMailChimp = Mage::helper('monkey')->subscribedToList($email, $listId);
|
937 |
//if( TRUE === $subscriber->getIsStatusChanged() ){
|
938 |
+
if ($isOnMailChimp == 1) {
|
939 |
return false;
|
940 |
}
|
941 |
|
942 |
+
if ($isConfirmNeed) {
|
943 |
$subscriber->setStatus(Mage_Newsletter_Model_Subscriber::STATUS_UNCONFIRMED);
|
944 |
}
|
945 |
|
960 |
* @param $isConfirmNeed
|
961 |
* @param $db
|
962 |
*/
|
963 |
+
public function _subscribe($listId, $email, $mergeVars, $isConfirmNeed, $db)
|
964 |
+
{
|
965 |
+
if ($db) {
|
966 |
+
if ($isConfirmNeed) {
|
967 |
Mage::getSingleton('core/session')->addSuccess(Mage::helper('monkey')->__('Confirmation request will be sent soon.'));
|
968 |
}
|
969 |
$subs = Mage::getModel('monkey/asyncsubscribers');
|
974 |
->setProcessed(0)
|
975 |
->setCreatedAt(Mage::getModel('core/date')->gmtDate())
|
976 |
->save();
|
977 |
+
} else {
|
978 |
+
if ($isConfirmNeed) {
|
979 |
Mage::getSingleton('core/session')->addSuccess(Mage::helper('monkey')->__('Confirmation request has been sent.'));
|
980 |
}
|
981 |
Mage::getSingleton('monkey/api')->listSubscribe($listId, $email, $mergeVars, 'html', $isConfirmNeed, TRUE);
|
983 |
}
|
984 |
|
985 |
/**
|
986 |
+
* Handle subscription on customer account
|
987 |
+
*
|
988 |
+
* @param Mage_Core_Controller_Request_Http $request
|
989 |
+
* @param string $guestEmail
|
990 |
+
* @return void
|
991 |
+
*/
|
992 |
+
public function handlePost($request, $guestEmail)
|
993 |
+
{
|
994 |
+
//<state> param is an html serialized field containing the default form state
|
995 |
+
//before submission, we need to parse it as a request in order to save it to $odata and process it
|
996 |
+
parse_str($request->getPost('state'), $odata);
|
997 |
+
$curlists = (TRUE === array_key_exists('list', $odata)) ? $odata['list'] : array();
|
998 |
+
$lists = $request->getPost('list', array());
|
999 |
+
|
1000 |
+
$defaultList = $this->getDefaultList(Mage::app()->getStore());
|
1001 |
+
|
1002 |
+
$api = Mage::getSingleton('monkey/api');
|
1003 |
+
$loggedIn = Mage::helper('customer')->isLoggedIn();
|
1004 |
+
if ($loggedIn) {
|
1005 |
+
$customer = Mage::helper('customer')->getCustomer();
|
1006 |
+
} else {
|
1007 |
+
$customer = Mage::registry('mc_guest_customer');
|
1008 |
+
}
|
1009 |
+
$email = $guestEmail ? $guestEmail : $customer->getEmail();
|
1010 |
+
if (!empty($curlists)) {
|
1011 |
+
//Handle Unsubscribe and groups update actions
|
1012 |
+
foreach ($curlists as $listId => $list) {
|
1013 |
+
|
1014 |
+
if (FALSE === array_key_exists($listId, $lists)) {
|
1015 |
+
|
1016 |
+
//Unsubscribe Email
|
1017 |
+
|
1018 |
+
$item = Mage::getModel('monkey/monkey')->loadByEmail($email);
|
1019 |
+
if (!$item->getId()) {
|
1020 |
+
$item = Mage::getModel('newsletter/subscriber')
|
1021 |
+
->loadByEmail($email);
|
1022 |
+
}
|
1023 |
+
if ($item->getSubscriberEmail()) {
|
1024 |
+
$item->unsubscribe();
|
1025 |
+
}
|
1026 |
+
|
1027 |
+
//Unsubscribe Email
|
1028 |
$alreadyOnDb = Mage::getSingleton('monkey/asyncsubscribers')->getCollection()
|
1029 |
->addFieldToFilter('lists', $listId)
|
1030 |
->addFieldToFilter('email', $email)
|
1031 |
->addFieldToFilter('processed', 0);
|
1032 |
|
1033 |
+
if (count($alreadyOnDb) > 0) {
|
1034 |
foreach ($alreadyOnDb as $listToDelete) {
|
1035 |
$toDelete = Mage::getModel('monkey/asyncsubscribers')->load($listToDelete->getId());
|
1036 |
$toDelete->delete();
|
1037 |
}
|
1038 |
Mage::getSingleton('core/session')
|
1039 |
->addSuccess($this->__('You have been removed from Newsletter.'));
|
1040 |
+
} else {
|
1041 |
$api->listUnsubscribe($listId, $email);
|
1042 |
Mage::getSingleton('core/session')
|
1043 |
->addSuccess($this->__('You have been removed from Newsletter.'));
|
1044 |
}
|
1045 |
|
1046 |
+
} else {
|
1047 |
|
1048 |
+
$groupings = $lists[$listId];
|
1049 |
+
unset($groupings['subscribed']);
|
1050 |
+
$customerLists = $api->listMemberInfo($listId, $email);
|
1051 |
+
$customerLists = isset($customerLists['data'][0]['merges']['GROUPINGS']) ? $customerLists['data'][0]['merges']['GROUPINGS'] : array();
|
1052 |
|
1053 |
+
foreach ($customerLists as $clkey => $cl) {
|
1054 |
+
if (!isset($groupings[$cl['id']])) {
|
1055 |
+
$groupings[$cl['id']][] = '';
|
1056 |
+
}
|
1057 |
+
}
|
|
|
|
|
1058 |
|
1059 |
+
$customer->setMcListId($listId);
|
1060 |
+
$customer->setListGroups($groupings);
|
1061 |
+
$mergeVars = Mage::helper('monkey')->getMergeVars($customer);
|
1062 |
|
1063 |
+
//Handle groups update
|
1064 |
+
$api->listUpdateMember($listId, $email, $mergeVars);
|
1065 |
Mage::getSingleton('core/session')
|
1066 |
->addSuccess($this->__('Your profile has been updated!'));
|
1067 |
|
1068 |
+
}
|
1069 |
|
1070 |
+
}
|
1071 |
|
1072 |
+
}
|
1073 |
|
1074 |
//Subscribe to new lists
|
1075 |
if (is_array($lists) && is_array($curlists)) {
|
1101 |
}
|
1102 |
}
|
1103 |
}
|
1104 |
+
}
|
1105 |
|
1106 |
+
public function getThisStore()
|
1107 |
+
{
|
1108 |
$store = Mage::app()->getStore();
|
1109 |
|
1110 |
$configscope = Mage::app()->getRequest()->getParam('store');
|
1111 |
+
if ($configscope && ($configscope !== 'undefined')) {
|
1112 |
$store = $configscope;
|
1113 |
}
|
1114 |
return $store;
|
1115 |
}
|
1116 |
|
1117 |
+
public function getCanShowCampaignJs()
|
1118 |
+
{
|
1119 |
$storeId = Mage::app()->getStore()->getStoreId();
|
1120 |
+
if (Mage::getStoreConfig(Ebizmarts_MageMonkey_Model_Config::ECOMMERCE360_ACTIVE, $storeId) && Mage::helper('monkey')->canMonkey()) {
|
1121 |
return 'ebizmarts/magemonkey/campaignCatcher.js';
|
1122 |
}
|
1123 |
}
|
app/code/community/Ebizmarts/MageMonkey/Helper/Export.php
CHANGED
@@ -8,58 +8,57 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_MageMonkey_Helper_Export extends Mage_Core_Helper_Abstract
|
13 |
{
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
|
25 |
-
|
26 |
|
27 |
-
|
28 |
-
|
29 |
|
30 |
-
|
31 |
-
|
32 |
|
33 |
-
|
34 |
-
|
35 |
|
36 |
-
|
37 |
-
|
38 |
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
|
54 |
-
|
55 |
|
56 |
-
foreach($response as $member){
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
}
|
61 |
|
62 |
-
|
63 |
-
|
64 |
|
65 |
}
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_MageMonkey_Helper_Export extends Mage_Core_Helper_Abstract
|
12 |
{
|
13 |
+
/**
|
14 |
+
* Parse members data
|
15 |
+
*
|
16 |
+
* @param string $response JSON encoded
|
17 |
+
* @param array $listMergeVars MergeFields for this list from MC
|
18 |
+
* @param string $store
|
19 |
+
* @return array
|
20 |
+
*/
|
21 |
+
public function parseMembers($response, $listMergeVars, $store)
|
22 |
+
{
|
23 |
|
24 |
+
$storeId = Mage::app()->getStore($store)->getId();
|
25 |
|
26 |
+
//Explode response, one record per line
|
27 |
+
$response = explode("\n", $response);
|
28 |
|
29 |
+
//My Merge Vars
|
30 |
+
$mergeMaps = Mage::helper('monkey')->getMergeMaps($storeId);
|
31 |
|
32 |
+
//Get Header (MergeVars)
|
33 |
+
$header = json_decode(array_shift($response));
|
34 |
|
35 |
+
//Add var to maps, not included on config
|
36 |
+
array_unshift($mergeMaps, array('magento' => 'email', 'mailchimp' => 'EMAIL'));
|
37 |
|
38 |
+
$canMerge = array();
|
39 |
+
foreach ($header as $mergePos => $mergeLabel) {
|
40 |
+
foreach ($listMergeVars as $var) {
|
41 |
+
if (strcmp($mergeLabel, $var['name']) === 0) {
|
42 |
|
43 |
+
foreach ($mergeMaps as $map) {
|
44 |
+
if (strcmp($var['tag'], $map['mailchimp']) === 0) {
|
45 |
+
$canMerge [$mergePos] = $map['magento'];
|
46 |
+
}
|
47 |
+
}
|
48 |
|
49 |
+
}
|
50 |
+
}
|
51 |
+
}
|
52 |
|
53 |
+
$membersData = array();
|
54 |
|
55 |
+
foreach ($response as $member) {
|
56 |
+
if (trim($member) != '') {
|
57 |
+
$membersData [] = array_combine($canMerge, array_intersect_key(json_decode($member), $canMerge));
|
58 |
+
}
|
59 |
}
|
60 |
|
61 |
+
return $membersData;
|
62 |
+
}
|
63 |
|
64 |
}
|
app/code/community/Ebizmarts/MageMonkey/Helper/Oauth2.php
CHANGED
@@ -8,19 +8,20 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
|
|
11 |
|
12 |
-
|
|
|
|
|
|
|
13 |
|
14 |
-
|
15 |
-
|
16 |
-
protected $_redirectUri = "http://ebizmarts.com/magento/mailchimp/oauth2/complete.php";
|
17 |
-
protected $_clientId = 213915096176;
|
18 |
|
19 |
-
|
|
|
20 |
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
return "{$url}?redirect_uri={$redirectUri}&response_type=code&client_id={$this->_clientId}";
|
25 |
-
}
|
26 |
}
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
+
class Ebizmarts_MageMonkey_Helper_Oauth2 extends Mage_Core_Helper_Abstract
|
12 |
+
{
|
13 |
|
14 |
+
protected $_authorizeUri = "https://login.mailchimp.com/oauth2/authorize";
|
15 |
+
protected $_accessTokenUri = "https://login.mailchimp.com/oauth2/token";
|
16 |
+
protected $_redirectUri = "http://ebizmarts.com/magento/mailchimp/oauth2/complete.php";
|
17 |
+
protected $_clientId = 213915096176;
|
18 |
|
19 |
+
public function authorizeRequestUrl()
|
20 |
+
{
|
|
|
|
|
21 |
|
22 |
+
$url = $this->_authorizeUri;
|
23 |
+
$redirectUri = urlencode($this->_redirectUri);
|
24 |
|
25 |
+
return "{$url}?redirect_uri={$redirectUri}&response_type=code&client_id={$this->_clientId}";
|
26 |
+
}
|
|
|
|
|
|
|
27 |
}
|
app/code/community/Ebizmarts/MageMonkey/Model/Api.php
CHANGED
@@ -8,8 +8,8 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
-
|
13 |
|
14 |
/**
|
15 |
* Api instance
|
@@ -57,7 +57,8 @@ class Ebizmarts_MageMonkey_Model_Api {
|
|
57 |
* @param array $args
|
58 |
* @return void
|
59 |
*/
|
60 |
-
public function __construct($args)
|
|
|
61 |
$storeId = isset($args['store']) ? $args['store'] : null;
|
62 |
$apikey = (!isset($args['apikey']) ? Mage::helper('monkey')->getApiKey($storeId) : $args['apikey']);
|
63 |
|
@@ -87,7 +88,8 @@ class Ebizmarts_MageMonkey_Model_Api {
|
|
87 |
* @param array $args
|
88 |
* @return mixed
|
89 |
*/
|
90 |
-
public function __call($method, $args = null)
|
|
|
91 |
$this->errorCode = null;
|
92 |
$this->errorMessage = null;
|
93 |
|
@@ -101,7 +103,8 @@ class Ebizmarts_MageMonkey_Model_Api {
|
|
101 |
* @param array $args OPTIONAL call parameters
|
102 |
* @return mixed
|
103 |
*/
|
104 |
-
public function call($command, $args)
|
|
|
105 |
try {
|
106 |
|
107 |
$cacheKey = $this->_cacheHelper->cacheKey($command, $args, $this->_mcapi->api_key);
|
@@ -145,7 +148,7 @@ class Ebizmarts_MageMonkey_Model_Api {
|
|
145 |
//Clear associated cache for this call, for example clear cache for listsForEmail when executing listUnsubscribe
|
146 |
$this->_cacheHelper->clearCache($command, $this->_mcapi);
|
147 |
|
148 |
-
return (string)
|
149 |
}
|
150 |
|
151 |
if ($cacheKey) {
|
@@ -171,7 +174,8 @@ class Ebizmarts_MageMonkey_Model_Api {
|
|
171 |
* @param mixed $data
|
172 |
* @return void
|
173 |
*/
|
174 |
-
protected function _logApiCall($data)
|
|
|
175 |
Mage::helper('monkey')->log($data, 'MageMonkey_ApiCall.log');
|
176 |
}
|
177 |
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
+
class Ebizmarts_MageMonkey_Model_Api
|
12 |
+
{
|
13 |
|
14 |
/**
|
15 |
* Api instance
|
57 |
* @param array $args
|
58 |
* @return void
|
59 |
*/
|
60 |
+
public function __construct($args)
|
61 |
+
{
|
62 |
$storeId = isset($args['store']) ? $args['store'] : null;
|
63 |
$apikey = (!isset($args['apikey']) ? Mage::helper('monkey')->getApiKey($storeId) : $args['apikey']);
|
64 |
|
88 |
* @param array $args
|
89 |
* @return mixed
|
90 |
*/
|
91 |
+
public function __call($method, $args = null)
|
92 |
+
{
|
93 |
$this->errorCode = null;
|
94 |
$this->errorMessage = null;
|
95 |
|
103 |
* @param array $args OPTIONAL call parameters
|
104 |
* @return mixed
|
105 |
*/
|
106 |
+
public function call($command, $args)
|
107 |
+
{
|
108 |
try {
|
109 |
|
110 |
$cacheKey = $this->_cacheHelper->cacheKey($command, $args, $this->_mcapi->api_key);
|
148 |
//Clear associated cache for this call, for example clear cache for listsForEmail when executing listUnsubscribe
|
149 |
$this->_cacheHelper->clearCache($command, $this->_mcapi);
|
150 |
|
151 |
+
return (string)$this->_mcapi->errorMessage;
|
152 |
}
|
153 |
|
154 |
if ($cacheKey) {
|
174 |
* @param mixed $data
|
175 |
* @return void
|
176 |
*/
|
177 |
+
protected function _logApiCall($data)
|
178 |
+
{
|
179 |
Mage::helper('monkey')->log($data, 'MageMonkey_ApiCall.log');
|
180 |
}
|
181 |
|
app/code/community/Ebizmarts/MageMonkey/Model/Asyncorders.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* Author : Ebizmarts <info@ebizmarts.com>
|
4 |
* Date : 9/12/14
|
@@ -6,7 +7,7 @@
|
|
6 |
* File : Asyncorders.php
|
7 |
* Module : Ebizmarts_MageMonkey
|
8 |
*/
|
9 |
-
class Ebizmarts_MageMonkey_Model_Asyncorders
|
10 |
{
|
11 |
/**
|
12 |
* Initialize model
|
1 |
<?php
|
2 |
+
|
3 |
/**
|
4 |
* Author : Ebizmarts <info@ebizmarts.com>
|
5 |
* Date : 9/12/14
|
7 |
* File : Asyncorders.php
|
8 |
* Module : Ebizmarts_MageMonkey
|
9 |
*/
|
10 |
+
class Ebizmarts_MageMonkey_Model_Asyncorders extends Mage_Core_Model_Abstract
|
11 |
{
|
12 |
/**
|
13 |
* Initialize model
|
app/code/community/Ebizmarts/MageMonkey/Model/Asyncsubscribers.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* Author : Ebizmarts <info@ebizmarts.com>
|
4 |
* Date : 9/15/14
|
@@ -6,7 +7,7 @@
|
|
6 |
* File : Asyncsubscribers.php
|
7 |
* Module : Ebizmarts_MageMonkey
|
8 |
*/
|
9 |
-
class Ebizmarts_MageMonkey_Model_Asyncsubscribers
|
10 |
{
|
11 |
/**
|
12 |
* Initialize model
|
1 |
<?php
|
2 |
+
|
3 |
/**
|
4 |
* Author : Ebizmarts <info@ebizmarts.com>
|
5 |
* Date : 9/15/14
|
7 |
* File : Asyncsubscribers.php
|
8 |
* Module : Ebizmarts_MageMonkey
|
9 |
*/
|
10 |
+
class Ebizmarts_MageMonkey_Model_Asyncsubscribers extends Mage_Core_Model_Abstract
|
11 |
{
|
12 |
/**
|
13 |
* Initialize model
|
app/code/community/Ebizmarts/MageMonkey/Model/BulksyncExport.php
CHANGED
@@ -8,27 +8,26 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_MageMonkey_Model_BulksyncExport extends Mage_Core_Model_Abstract
|
13 |
{
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
public function _construct()
|
20 |
{
|
21 |
parent::_construct();
|
22 |
$this->_init('monkey/bulksync_export');
|
23 |
}
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
public function lists()
|
31 |
{
|
32 |
-
|
33 |
}
|
34 |
}
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
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 |
}
|
app/code/community/Ebizmarts/MageMonkey/Model/BulksyncImport.php
CHANGED
@@ -8,38 +8,37 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_MageMonkey_Model_BulksyncImport extends Mage_Core_Model_Abstract
|
13 |
{
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
public function _construct()
|
20 |
{
|
21 |
parent::_construct();
|
22 |
$this->_init('monkey/bulksync_import');
|
23 |
}
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
public function lists()
|
31 |
{
|
32 |
-
|
33 |
}
|
34 |
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
public function statuses()
|
41 |
{
|
42 |
-
|
43 |
}
|
44 |
|
45 |
}
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_MageMonkey_Model_BulksyncImport 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_import');
|
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 |
|
34 |
+
/**
|
35 |
+
* Return array of statuses
|
36 |
+
*
|
37 |
+
* @return bool|array
|
38 |
+
*/
|
39 |
public function statuses()
|
40 |
{
|
41 |
+
return unserialize($this->getImportTypes());
|
42 |
}
|
43 |
|
44 |
}
|
app/code/community/Ebizmarts/MageMonkey/Model/Cache.php
CHANGED
@@ -8,8 +8,8 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
-
|
13 |
|
14 |
/**
|
15 |
* @var bool Store if cache type is enabled
|
@@ -25,7 +25,7 @@ class Ebizmarts_MageMonkey_Model_Cache {
|
|
25 |
* @var int|null Cache lifetime in seconds or NULL for infinite lifetime
|
26 |
*/
|
27 |
protected $_cacheLifetime = NULL;
|
28 |
-
|
29 |
/**
|
30 |
* @const CACHE_TAG General cache tag
|
31 |
*/
|
@@ -39,7 +39,8 @@ class Ebizmarts_MageMonkey_Model_Cache {
|
|
39 |
/**
|
40 |
* Class constructor
|
41 |
*/
|
42 |
-
public function __construct()
|
|
|
43 |
$this->_isEnabled = Mage::app()->useCache(self::CACHE_ID);
|
44 |
}
|
45 |
|
@@ -48,8 +49,9 @@ class Ebizmarts_MageMonkey_Model_Cache {
|
|
48 |
*
|
49 |
* @return bool
|
50 |
*/
|
51 |
-
public function isCacheEnabled()
|
52 |
-
|
|
|
53 |
}
|
54 |
|
55 |
/**
|
@@ -57,7 +59,8 @@ class Ebizmarts_MageMonkey_Model_Cache {
|
|
57 |
*
|
58 |
* @return array Cache tags
|
59 |
*/
|
60 |
-
public function getCacheTags()
|
|
|
61 |
return $this->_cacheTags;
|
62 |
}
|
63 |
|
@@ -66,7 +69,8 @@ class Ebizmarts_MageMonkey_Model_Cache {
|
|
66 |
*
|
67 |
* @return null|int
|
68 |
*/
|
69 |
-
public function getCacheLifetime()
|
|
|
70 |
return $this->_cacheLifetime;
|
71 |
}
|
72 |
|
@@ -77,7 +81,8 @@ class Ebizmarts_MageMonkey_Model_Cache {
|
|
77 |
* @param string $cacheId
|
78 |
* @return Ebizmarts_MageMonkey_Model_Cache
|
79 |
*/
|
80 |
-
public function saveCacheData($data, $cacheId, $tags = array())
|
|
|
81 |
if (!$this->isCacheEnabled()) {
|
82 |
return $this;
|
83 |
}
|
@@ -95,7 +100,8 @@ class Ebizmarts_MageMonkey_Model_Cache {
|
|
95 |
* @param string $cacheId Cache ID
|
96 |
* @return mixed Cache data
|
97 |
*/
|
98 |
-
public function loadCacheData($cacheId)
|
|
|
99 |
if (!$this->isCacheEnabled()) {
|
100 |
return FALSE;
|
101 |
}
|
@@ -109,7 +115,8 @@ class Ebizmarts_MageMonkey_Model_Cache {
|
|
109 |
* @param string $cacheId Cache ID
|
110 |
* @return Ebizmarts_MageMonkey_Model_Cache
|
111 |
*/
|
112 |
-
public function removeCacheData($cacheId)
|
|
|
113 |
if (!$this->isCacheEnabled()) {
|
114 |
return FALSE;
|
115 |
}
|
@@ -124,7 +131,8 @@ class Ebizmarts_MageMonkey_Model_Cache {
|
|
124 |
*
|
125 |
* @return Ebizmarts_MageMonkey_Model_Cache
|
126 |
*/
|
127 |
-
public function cleanCache()
|
|
|
128 |
Mage::app()->cleanCache(self::CACHE_TAG);
|
129 |
return $this;
|
130 |
}
|
@@ -134,9 +142,10 @@ class Ebizmarts_MageMonkey_Model_Cache {
|
|
134 |
*
|
135 |
* @return Ebizmarts_MageMonkey_Model_Cache
|
136 |
*/
|
137 |
-
public function invalidateCache()
|
|
|
138 |
Mage::app()->getCacheInstance()->invalidateType(self::CACHE_ID);
|
139 |
return $this;
|
140 |
-
}
|
141 |
-
|
142 |
}
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
+
class Ebizmarts_MageMonkey_Model_Cache
|
12 |
+
{
|
13 |
|
14 |
/**
|
15 |
* @var bool Store if cache type is enabled
|
25 |
* @var int|null Cache lifetime in seconds or NULL for infinite lifetime
|
26 |
*/
|
27 |
protected $_cacheLifetime = NULL;
|
28 |
+
|
29 |
/**
|
30 |
* @const CACHE_TAG General cache tag
|
31 |
*/
|
39 |
/**
|
40 |
* Class constructor
|
41 |
*/
|
42 |
+
public function __construct()
|
43 |
+
{
|
44 |
$this->_isEnabled = Mage::app()->useCache(self::CACHE_ID);
|
45 |
}
|
46 |
|
49 |
*
|
50 |
* @return bool
|
51 |
*/
|
52 |
+
public function isCacheEnabled()
|
53 |
+
{
|
54 |
+
return (bool)$this->_isEnabled;
|
55 |
}
|
56 |
|
57 |
/**
|
59 |
*
|
60 |
* @return array Cache tags
|
61 |
*/
|
62 |
+
public function getCacheTags()
|
63 |
+
{
|
64 |
return $this->_cacheTags;
|
65 |
}
|
66 |
|
69 |
*
|
70 |
* @return null|int
|
71 |
*/
|
72 |
+
public function getCacheLifetime()
|
73 |
+
{
|
74 |
return $this->_cacheLifetime;
|
75 |
}
|
76 |
|
81 |
* @param string $cacheId
|
82 |
* @return Ebizmarts_MageMonkey_Model_Cache
|
83 |
*/
|
84 |
+
public function saveCacheData($data, $cacheId, $tags = array())
|
85 |
+
{
|
86 |
if (!$this->isCacheEnabled()) {
|
87 |
return $this;
|
88 |
}
|
100 |
* @param string $cacheId Cache ID
|
101 |
* @return mixed Cache data
|
102 |
*/
|
103 |
+
public function loadCacheData($cacheId)
|
104 |
+
{
|
105 |
if (!$this->isCacheEnabled()) {
|
106 |
return FALSE;
|
107 |
}
|
115 |
* @param string $cacheId Cache ID
|
116 |
* @return Ebizmarts_MageMonkey_Model_Cache
|
117 |
*/
|
118 |
+
public function removeCacheData($cacheId)
|
119 |
+
{
|
120 |
if (!$this->isCacheEnabled()) {
|
121 |
return FALSE;
|
122 |
}
|
131 |
*
|
132 |
* @return Ebizmarts_MageMonkey_Model_Cache
|
133 |
*/
|
134 |
+
public function cleanCache()
|
135 |
+
{
|
136 |
Mage::app()->cleanCache(self::CACHE_TAG);
|
137 |
return $this;
|
138 |
}
|
142 |
*
|
143 |
* @return Ebizmarts_MageMonkey_Model_Cache
|
144 |
*/
|
145 |
+
public function invalidateCache()
|
146 |
+
{
|
147 |
Mage::app()->getCacheInstance()->invalidateType(self::CACHE_ID);
|
148 |
return $this;
|
149 |
+
}
|
150 |
+
|
151 |
}
|
app/code/community/Ebizmarts/MageMonkey/Model/Config.php
CHANGED
@@ -7,38 +7,37 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_MageMonkey_Model_Config
|
12 |
{
|
13 |
-
const GENERAL_ACTIVE
|
14 |
-
const GENERAL_APIKEY
|
15 |
-
const GENERAL_OAUTH_WIZARD
|
16 |
-
const GENERAL_ACCOUNT_DETAILS
|
17 |
-
const GENERAL_RESET_LOCALECOMMERCE360
|
18 |
-
const GENERAL_RESET_REMOTEECOMMERCE360
|
19 |
-
const GENERAL_MAXLISTAMOUNT
|
20 |
-
const GENERAL_LIST
|
21 |
-
const GENERAL_CUTOMERGROUP
|
22 |
-
const GENERAL_CHANGECUSTOMERGROUP
|
23 |
-
const GENERAL_SHOWREALLISTNAME
|
24 |
-
const GENERAL_ADDITIONAL_LIST
|
25 |
-
const GENERAL_CONFIRMATION_EMAIL
|
26 |
-
const GENERAL_DOUBLE_OPTIN
|
27 |
-
const GENERAL_MAP_FIELDS
|
28 |
-
const GENERAL_GUEST_NAME
|
29 |
-
const GENERAL_GUEST_LASTNAME
|
30 |
-
const GENERAL_CHECKOUT_SUBSCRIBE
|
31 |
-
const GENERAL_MARKFIELD
|
32 |
-
const GENERAL_CHECKOUT_ASYNC
|
33 |
-
const GENERAL_CRON_IMPORT
|
34 |
-
const GENERAL_CRON_EXPORT
|
35 |
-
const GENERAL_WEBHOOK_DELETE
|
36 |
-
const GENERAL_ADMINHTML_NOTIFICATION
|
37 |
-
const GENERAL_ENABLE_LOG
|
38 |
|
39 |
|
40 |
-
const ECOMMERCE360_ACTIVE
|
41 |
-
const ECOMMERCE360_ORDER_STATUS
|
42 |
-
const ECOMMERCE360_ORDER_MAX
|
43 |
-
const ECOMMERCE360_ATTRIBUTES
|
44 |
}
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_MageMonkey_Model_Config
|
11 |
{
|
12 |
+
const GENERAL_ACTIVE = 'monkey/general/active';
|
13 |
+
const GENERAL_APIKEY = 'monkey/general/apikey';
|
14 |
+
const GENERAL_OAUTH_WIZARD = 'monkey/general/oauth_wizard';
|
15 |
+
const GENERAL_ACCOUNT_DETAILS = 'monkey/general/account_details';
|
16 |
+
const GENERAL_RESET_LOCALECOMMERCE360 = 'monkey/general/reset_localecommerce360';
|
17 |
+
const GENERAL_RESET_REMOTEECOMMERCE360 = 'monkey/general/reset_remoteecommerce360';
|
18 |
+
const GENERAL_MAXLISTAMOUNT = 'monkey/general/maxlistsamount';
|
19 |
+
const GENERAL_LIST = 'monkey/general/list';
|
20 |
+
const GENERAL_CUTOMERGROUP = 'monkey/general/cutomergroup';
|
21 |
+
const GENERAL_CHANGECUSTOMERGROUP = 'monkey/general/changecustomergroup';
|
22 |
+
const GENERAL_SHOWREALLISTNAME = 'monkey/general/showreallistname';
|
23 |
+
const GENERAL_ADDITIONAL_LIST = 'monkey/general/additional_lists';
|
24 |
+
const GENERAL_CONFIRMATION_EMAIL = 'monkey/general/confirmation_email';
|
25 |
+
const GENERAL_DOUBLE_OPTIN = 'monkey/general/double_optin';
|
26 |
+
const GENERAL_MAP_FIELDS = 'monkey/general/map_fields';
|
27 |
+
const GENERAL_GUEST_NAME = 'monkey/general/guest_name';
|
28 |
+
const GENERAL_GUEST_LASTNAME = 'monkey/general/guest_lastname';
|
29 |
+
const GENERAL_CHECKOUT_SUBSCRIBE = 'monkey/general/checkout_subscribe';
|
30 |
+
const GENERAL_MARKFIELD = 'monkey/general/markfield';
|
31 |
+
const GENERAL_CHECKOUT_ASYNC = 'monkey/general/checkout_async';
|
32 |
+
const GENERAL_CRON_IMPORT = 'monkey/general/cron_import';
|
33 |
+
const GENERAL_CRON_EXPORT = 'monkey/general/cron_export';
|
34 |
+
const GENERAL_WEBHOOK_DELETE = 'monkey/general/webhook_delete';
|
35 |
+
const GENERAL_ADMINHTML_NOTIFICATION = 'monkey/general/adminhtml_notification';
|
36 |
+
const GENERAL_ENABLE_LOG = 'monkey/general/enable_log';
|
37 |
|
38 |
|
39 |
+
const ECOMMERCE360_ACTIVE = 'monkey/ecommerce360/active';
|
40 |
+
const ECOMMERCE360_ORDER_STATUS = 'monkey/ecommerce360/order_status';
|
41 |
+
const ECOMMERCE360_ORDER_MAX = 'monkey/ecommerce360/order_max';
|
42 |
+
const ECOMMERCE360_ATTRIBUTES = 'monkey/ecommerce360/attributes';
|
43 |
}
|
app/code/community/Ebizmarts/MageMonkey/Model/Cron.php
CHANGED
@@ -8,212 +8,211 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_MageMonkey_Model_Cron
|
13 |
{
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
-
/**
|
23 |
-
* Current Magento store
|
24 |
-
*
|
25 |
-
* @var Mage_Core_Model_Store
|
26 |
-
* @access protected
|
27 |
-
*/
|
28 |
-
protected $_store;
|
29 |
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
{
|
37 |
-
$job = $this->_getJob('Import');
|
38 |
-
if(is_null($job)){
|
39 |
-
return $this;
|
40 |
-
}
|
41 |
-
|
42 |
-
//Update total count on first run
|
43 |
-
$setcount = FALSE;
|
44 |
-
if(!$job->getTotalCount()){
|
45 |
-
$setcount = TRUE;
|
46 |
-
}
|
47 |
-
|
48 |
-
if(!$job->getStartedAt()){
|
49 |
-
$job->setStartedAt(Mage::getModel('core/date')->gmtDate())->save();
|
50 |
-
}
|
51 |
-
|
52 |
-
foreach($job->lists() as $listId){
|
53 |
-
|
54 |
-
$toImport = array();
|
55 |
-
|
56 |
-
$store = $this->_helper()->getStoreByList($listId);
|
57 |
-
$websiteId = Mage::app()->getStore($store)->getWebsiteId();
|
58 |
-
$this->_store = Mage::app()->getStore($store);
|
59 |
-
|
60 |
-
$exportapi = Mage::getModel('monkey/api', array('store' => $store, '_export_' => TRUE));
|
61 |
-
$api = Mage::getModel('monkey/api', array('store' => $store));
|
62 |
-
|
63 |
-
$mergevars = $api->listMergeVars($listId);
|
64 |
-
|
65 |
-
foreach($job->statuses() as $status){
|
66 |
-
|
67 |
-
$members = $exportapi->listExport($listId, $status, NULL, $job->getSince());
|
68 |
-
|
69 |
-
if(is_null($exportapi->errorCode) && $members){
|
70 |
-
if( !isset($toImport[$status]) ){
|
71 |
-
$toImport [$status] = array();
|
72 |
-
}
|
73 |
-
$mdata = $this->_helper('export')->parseMembers($members, $mergevars, $store);
|
74 |
-
|
75 |
-
$toImport[$status] = array_merge($toImport[$status], $mdata);
|
76 |
-
|
77 |
-
if($setcount === TRUE){
|
78 |
-
$job->setTotalCount( (count($toImport[$status])+(int)$job->getTotalCount()) )->save();
|
79 |
-
}
|
80 |
-
}
|
81 |
-
|
82 |
-
}
|
83 |
-
|
84 |
-
if( count($toImport) > 0 ){
|
85 |
-
|
86 |
-
$job->setStatus('running')
|
87 |
-
->save();
|
88 |
-
|
89 |
-
foreach($toImport as $type => $emails){
|
90 |
-
|
91 |
-
foreach($emails as $data){
|
92 |
-
|
93 |
-
//Run: subscribed, unsubscribed, cleaned or updated method
|
94 |
-
$this->{$type}($data, $websiteId, (bool)$job->getCreateCustomer());
|
95 |
-
|
96 |
-
$job->setProcessedCount( ((int)$job->getProcessedCount() + 1) )
|
97 |
-
->save();
|
98 |
-
}
|
99 |
-
|
100 |
-
}
|
101 |
-
|
102 |
-
$job->setStatus('finished')
|
103 |
-
->save();
|
104 |
-
|
105 |
-
}
|
106 |
-
|
107 |
-
}
|
108 |
-
}
|
109 |
-
|
110 |
-
/**
|
111 |
-
* Return subscriber object with basic attribues
|
112 |
-
*
|
113 |
-
* @param string $email
|
114 |
-
* @param string $status OPTIONAL
|
115 |
-
* @return Mage_Newsletter_Model_Subscriber
|
116 |
-
*/
|
117 |
-
protected function _getSubscriberObject($email, $status = Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED)
|
118 |
-
{
|
119 |
-
$subscriber = Mage::getModel('newsletter/subscriber')->loadByEmail($email);
|
120 |
-
$subscriber->setImportMode(TRUE)->setBulksync(TRUE);
|
121 |
-
|
122 |
-
if(!$subscriber->getId()){
|
123 |
-
$subscriber->setStoreId($this->_store->getId())
|
124 |
-
->setSubscriberConfirmCode(Mage::getModel('newsletter/subscriber')->randomSequence())
|
125 |
-
->setEmail($email);
|
126 |
-
}
|
127 |
-
|
128 |
-
$subscriber->setStatus($status);
|
129 |
-
|
130 |
-
return $subscriber;
|
131 |
-
}
|
132 |
-
|
133 |
-
/**
|
134 |
-
* Process <subscribed> data list when importing members
|
135 |
-
*
|
136 |
-
* @param array $member
|
137 |
-
* @param integer $websiteId OPTIONAL
|
138 |
-
* @param bool $createCustomer
|
139 |
-
* @return void
|
140 |
-
*/
|
141 |
-
protected function subscribed($member, $websiteId = null, $createCustomer = FALSE)
|
142 |
-
{
|
143 |
-
$subscriber = $this->_getSubscriberObject($member['email']);
|
144 |
-
if( $createCustomer ){
|
145 |
-
$alreadyExist = false;
|
146 |
-
$websites = Mage::getModel('core/website')->getCollection()->getData();
|
147 |
-
foreach($websites as $website){
|
148 |
-
$customer = Mage::getModel('customer/customer')->setWebsiteId($website['website_id'])
|
149 |
-
->loadByEmail($member['email']);
|
150 |
-
if($customer->getId()){
|
151 |
-
$alreadyExist = true;
|
152 |
-
}
|
153 |
-
}
|
154 |
-
|
155 |
-
if(!$alreadyExist){
|
156 |
-
//Create customer if not exists, and subscribe
|
157 |
-
$customer = $this->_helper()->createCustomerAccount($member, $websiteId);
|
158 |
-
}
|
159 |
-
$subscriber
|
160 |
-
->setCustomerId($customer->getId())
|
161 |
-
->save();
|
162 |
-
}else{
|
163 |
-
//Just subscribe email
|
164 |
-
$subscriber->save();
|
165 |
-
}
|
166 |
-
|
167 |
-
}
|
168 |
-
|
169 |
-
/**
|
170 |
-
* Process <updated> data list when importing members
|
171 |
-
*
|
172 |
-
* @param array $member
|
173 |
-
* @param integer $websiteId OPTIONAL
|
174 |
-
* @param bool $createCustomer
|
175 |
-
* @return void
|
176 |
-
*/
|
177 |
-
protected function updated($member, $websiteId = null, $createCustomer = FALSE)
|
178 |
-
{
|
179 |
-
//TODO
|
180 |
-
}
|
181 |
-
|
182 |
-
/**
|
183 |
-
* Process <unsubscribed> data list when importing members
|
184 |
-
*
|
185 |
-
* @param array $member
|
186 |
-
* @param integer $websiteId OPTIONAL
|
187 |
-
* @param bool $createCustomer
|
188 |
-
* @return void
|
189 |
-
*/
|
190 |
-
protected function unsubscribed($member, $websiteId = null, $createCustomer = FALSE)
|
191 |
-
{
|
192 |
-
$this->_getSubscriberObject($member['email'], Mage_Newsletter_Model_Subscriber::STATUS_UNSUBSCRIBED)
|
193 |
-
->save();
|
194 |
-
}
|
195 |
-
|
196 |
-
/**
|
197 |
-
* Process <cleaned> data list when importing members
|
198 |
-
*
|
199 |
-
* @param array $member
|
200 |
-
* @param integer $websiteId OPTIONAL
|
201 |
-
* @param bool $createCustomer
|
202 |
-
* @return void
|
203 |
-
*/
|
204 |
-
protected function cleaned($member, $websiteId = null, $createCustomer = FALSE)
|
205 |
-
{
|
206 |
-
return $this->unsubscribed($member, $websiteId, $createCustomer);
|
207 |
-
}
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
/**
|
212 |
-
* Process EXPORT tasks
|
213 |
-
*
|
214 |
-
* @return Ebizmarts_MageMonkey_Model_Cron
|
215 |
-
*/
|
216 |
-
public function bulksyncExportSubscribers()
|
217 |
{
|
218 |
$this->_limit = (int)Mage::getStoreConfig("monkey/general/cron_export");
|
219 |
$job = $this->_getJob('Export');
|
@@ -243,210 +242,211 @@ class Ebizmarts_MageMonkey_Model_Cron
|
|
243 |
if ($job->getDataSourceEntity() == 'newsletter_subscriber') {
|
244 |
$collection->addFieldToFilter('subscriber_status', Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED);
|
245 |
$orderBy = 'subscriber_id';
|
246 |
-
}elseif($job->getDataSourceEntity() == 'customer'){
|
247 |
$orderBy = 'entity_id';
|
248 |
}
|
249 |
|
250 |
-
if($orderBy){
|
251 |
$collection->addOrder($orderBy, 'ASC');
|
252 |
}
|
253 |
|
254 |
-
|
255 |
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
|
262 |
-
|
263 |
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
$isOnMailChimp = Mage::helper('monkey')->subscribedToList($item->getEmail(), $listId);
|
272 |
-
if($isOnMailChimp){
|
273 |
$api->listUpdateMember($listId, $item->getEmail(), $this->_helper()->getMergeVars($item));
|
274 |
-
}else {
|
275 |
$batch [] = $this->_helper()->getMergeVars($item, TRUE);
|
276 |
}
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
$allStores = Mage::app()->getStores();
|
428 |
-
foreach($allStores as $storeId => $val) {
|
429 |
-
if (Mage::getStoreConfig(Ebizmarts_MageMonkey_Model_Config::ECOMMERCE360_ACTIVE
|
430 |
Mage::getModel('monkey/ecommerce360')->autoExportJobs($storeId);
|
431 |
}
|
432 |
}
|
433 |
}
|
|
|
434 |
public function processAutoExportOrders()
|
435 |
{
|
436 |
$allStores = Mage::app()->getStores();
|
437 |
-
foreach($allStores as $storeId => $val)
|
438 |
-
|
439 |
-
if(Mage::getStoreConfig("monkey/general/active",$storeId)) {
|
440 |
$this->_exportOrders($storeId);
|
441 |
}
|
442 |
}
|
443 |
}
|
|
|
444 |
public function sendordersAsync()
|
445 |
{
|
446 |
$collection = Mage::getModel('monkey/asyncorders')->getCollection();
|
447 |
-
$collection->addFieldToFilter('processed',array('eq'=>0));
|
448 |
$storeId = null;
|
449 |
-
foreach($collection as $item) {
|
450 |
$info = (array)unserialize($item->getInfo());
|
451 |
// $collection2 = Mage::getmodel('monkey/asyncsubscribers')->getCollection()
|
452 |
// ->addFieldToFilter('processed',array('eq'=>1))
|
@@ -493,33 +493,35 @@ class Ebizmarts_MageMonkey_Model_Cron
|
|
493 |
}
|
494 |
}
|
495 |
}
|
|
|
496 |
public function cleanordersAsync()
|
497 |
{
|
498 |
$collection = Mage::getModel('monkey/asyncorders')->getCollection();
|
499 |
-
$collection->addFieldToFilter('processed',array('eq'=>1));
|
500 |
-
foreach($collection as $item)
|
501 |
-
{
|
502 |
$item->delete();
|
503 |
}
|
504 |
}
|
|
|
505 |
public function sendSubscribersAsync()
|
506 |
{
|
507 |
$collection = Mage::getModel('monkey/asyncsubscribers')->getCollection();
|
508 |
-
$collection->addFieldToFilter('processed',array('eq'=>0))
|
509 |
->setOrder('lists', 'desc');
|
510 |
$batch = array();
|
511 |
$oldList = '';
|
512 |
$isConfirmNeed = FALSE;
|
513 |
-
foreach($collection as $item)
|
514 |
-
{
|
515 |
$newList = $item->getLists();
|
516 |
$eachIsConfirmNeed = $item->getConfirm();
|
517 |
|
518 |
-
if($oldList == ''){
|
519 |
$oldList = $newList;
|
520 |
}
|
521 |
-
if($newList != $oldList || $eachIsConfirmNeed != $isConfirmNeed){
|
522 |
-
|
|
|
|
|
523 |
$isConfirmNeed = $eachIsConfirmNeed;
|
524 |
$oldList = $newList;
|
525 |
$batch = array();
|
@@ -531,18 +533,18 @@ class Ebizmarts_MageMonkey_Model_Cron
|
|
531 |
//$email = $item->getEmail();
|
532 |
//Mage::getSingleton('monkey/api')->listSubscribe($listId, $email, $mergeVars, 'html', $isConfirmNeed);
|
533 |
$item->setProcessed(1)->save();
|
534 |
-
if($item->getId() == $collection->getLastItem()->getId()){
|
535 |
Mage::getSingleton('monkey/api')->listBatchSubscribe($oldList, $batch, $isConfirmNeed, TRUE, FALSE);
|
536 |
}
|
537 |
}
|
538 |
|
539 |
}
|
|
|
540 |
public function cleanSubscribersAsync()
|
541 |
{
|
542 |
$collection = Mage::getModel('monkey/asyncsubscribers')->getCollection();
|
543 |
-
$collection->addFieldToFilter('processed',array('eq'=>1));
|
544 |
-
foreach($collection as $item)
|
545 |
-
{
|
546 |
$item->delete();
|
547 |
}
|
548 |
}
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_MageMonkey_Model_Cron
|
12 |
{
|
13 |
+
/**
|
14 |
+
* Limit var for SQL queries
|
15 |
+
*
|
16 |
+
* @var integer
|
17 |
+
* @access protected
|
18 |
+
*/
|
19 |
+
protected $_limit = 1000;
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Current Magento store
|
23 |
+
*
|
24 |
+
* @var Mage_Core_Model_Store
|
25 |
+
* @access protected
|
26 |
+
*/
|
27 |
+
protected $_store;
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Process scheduled IMPORT tasks
|
31 |
+
*
|
32 |
+
* @return void
|
33 |
+
*/
|
34 |
+
public function bulksyncImportSubscribers()
|
35 |
+
{
|
36 |
+
$job = $this->_getJob('Import');
|
37 |
+
if (is_null($job)) {
|
38 |
+
return $this;
|
39 |
+
}
|
40 |
+
|
41 |
+
//Update total count on first run
|
42 |
+
$setcount = FALSE;
|
43 |
+
if (!$job->getTotalCount()) {
|
44 |
+
$setcount = TRUE;
|
45 |
+
}
|
46 |
+
|
47 |
+
if (!$job->getStartedAt()) {
|
48 |
+
$job->setStartedAt(Mage::getModel('core/date')->gmtDate())->save();
|
49 |
+
}
|
50 |
+
|
51 |
+
foreach ($job->lists() as $listId) {
|
52 |
+
|
53 |
+
$toImport = array();
|
54 |
+
|
55 |
+
$store = $this->_helper()->getStoreByList($listId);
|
56 |
+
$websiteId = Mage::app()->getStore($store)->getWebsiteId();
|
57 |
+
$this->_store = Mage::app()->getStore($store);
|
58 |
+
|
59 |
+
$exportapi = Mage::getModel('monkey/api', array('store' => $store, '_export_' => TRUE));
|
60 |
+
$api = Mage::getModel('monkey/api', array('store' => $store));
|
61 |
+
|
62 |
+
$mergevars = $api->listMergeVars($listId);
|
63 |
+
|
64 |
+
foreach ($job->statuses() as $status) {
|
65 |
+
|
66 |
+
$members = $exportapi->listExport($listId, $status, NULL, $job->getSince());
|
67 |
+
|
68 |
+
if (is_null($exportapi->errorCode) && $members) {
|
69 |
+
if (!isset($toImport[$status])) {
|
70 |
+
$toImport [$status] = array();
|
71 |
+
}
|
72 |
+
$mdata = $this->_helper('export')->parseMembers($members, $mergevars, $store);
|
73 |
+
|
74 |
+
$toImport[$status] = array_merge($toImport[$status], $mdata);
|
75 |
+
|
76 |
+
if ($setcount === TRUE) {
|
77 |
+
$job->setTotalCount((count($toImport[$status]) + (int)$job->getTotalCount()))->save();
|
78 |
+
}
|
79 |
+
}
|
80 |
+
|
81 |
+
}
|
82 |
+
|
83 |
+
if (count($toImport) > 0) {
|
84 |
+
|
85 |
+
$job->setStatus('running')
|
86 |
+
->save();
|
87 |
+
|
88 |
+
foreach ($toImport as $type => $emails) {
|
89 |
+
|
90 |
+
foreach ($emails as $data) {
|
91 |
+
|
92 |
+
//Run: subscribed, unsubscribed, cleaned or updated method
|
93 |
+
$this->{$type}($data, $websiteId, (bool)$job->getCreateCustomer());
|
94 |
+
|
95 |
+
$job->setProcessedCount(((int)$job->getProcessedCount() + 1))
|
96 |
+
->save();
|
97 |
+
}
|
98 |
+
|
99 |
+
}
|
100 |
+
|
101 |
+
$job->setStatus('finished')
|
102 |
+
->save();
|
103 |
+
|
104 |
+
}
|
105 |
+
|
106 |
+
}
|
107 |
+
}
|
108 |
+
|
109 |
+
/**
|
110 |
+
* Return subscriber object with basic attribues
|
111 |
+
*
|
112 |
+
* @param string $email
|
113 |
+
* @param string $status OPTIONAL
|
114 |
+
* @return Mage_Newsletter_Model_Subscriber
|
115 |
+
*/
|
116 |
+
protected function _getSubscriberObject($email, $status = Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED)
|
117 |
+
{
|
118 |
+
$subscriber = Mage::getModel('newsletter/subscriber')->loadByEmail($email);
|
119 |
+
$subscriber->setImportMode(TRUE)->setBulksync(TRUE);
|
120 |
+
|
121 |
+
if (!$subscriber->getId()) {
|
122 |
+
$subscriber->setStoreId($this->_store->getId())
|
123 |
+
->setSubscriberConfirmCode(Mage::getModel('newsletter/subscriber')->randomSequence())
|
124 |
+
->setEmail($email);
|
125 |
+
}
|
126 |
+
|
127 |
+
$subscriber->setStatus($status);
|
128 |
+
|
129 |
+
return $subscriber;
|
130 |
+
}
|
131 |
+
|
132 |
+
/**
|
133 |
+
* Process <subscribed> data list when importing members
|
134 |
+
*
|
135 |
+
* @param array $member
|
136 |
+
* @param integer $websiteId OPTIONAL
|
137 |
+
* @param bool $createCustomer
|
138 |
+
* @return void
|
139 |
+
*/
|
140 |
+
protected function subscribed($member, $websiteId = null, $createCustomer = FALSE)
|
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) {
|
155 |
+
//Create customer if not exists, and subscribe
|
156 |
+
$customer = $this->_helper()->createCustomerAccount($member, $websiteId);
|
157 |
+
}
|
158 |
+
$subscriber->setStatus(Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED)
|
159 |
+
->setCustomerId($customer->getId())
|
160 |
+
->save();
|
161 |
+
} else {
|
162 |
+
//Just subscribe email
|
163 |
+
$subscriber->setStatus(Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED)
|
164 |
+
->save();
|
165 |
+
}
|
166 |
+
|
167 |
+
}
|
168 |
+
|
169 |
+
/**
|
170 |
+
* Process <updated> data list when importing members
|
171 |
+
*
|
172 |
+
* @param array $member
|
173 |
+
* @param integer $websiteId OPTIONAL
|
174 |
+
* @param bool $createCustomer
|
175 |
+
* @return void
|
176 |
+
*/
|
177 |
+
protected function updated($member, $websiteId = null, $createCustomer = FALSE)
|
178 |
+
{
|
179 |
+
//TODO
|
180 |
+
}
|
181 |
+
|
182 |
+
/**
|
183 |
+
* Process <unsubscribed> data list when importing members
|
184 |
+
*
|
185 |
+
* @param array $member
|
186 |
+
* @param integer $websiteId OPTIONAL
|
187 |
+
* @param bool $createCustomer
|
188 |
+
* @return void
|
189 |
+
*/
|
190 |
+
protected function unsubscribed($member, $websiteId = null, $createCustomer = FALSE)
|
191 |
+
{
|
192 |
+
$this->_getSubscriberObject($member['email'], Mage_Newsletter_Model_Subscriber::STATUS_UNSUBSCRIBED)
|
193 |
+
->save();
|
194 |
+
}
|
195 |
+
|
196 |
+
/**
|
197 |
+
* Process <cleaned> data list when importing members
|
198 |
+
*
|
199 |
+
* @param array $member
|
200 |
+
* @param integer $websiteId OPTIONAL
|
201 |
+
* @param bool $createCustomer
|
202 |
+
* @return void
|
203 |
+
*/
|
204 |
+
protected function cleaned($member, $websiteId = null, $createCustomer = FALSE)
|
205 |
+
{
|
206 |
+
return $this->unsubscribed($member, $websiteId, $createCustomer);
|
207 |
+
}
|
208 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
209 |
|
210 |
+
/**
|
211 |
+
* Process EXPORT tasks
|
212 |
+
*
|
213 |
+
* @return Ebizmarts_MageMonkey_Model_Cron
|
214 |
+
*/
|
215 |
+
public function bulksyncExportSubscribers()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
216 |
{
|
217 |
$this->_limit = (int)Mage::getStoreConfig("monkey/general/cron_export");
|
218 |
$job = $this->_getJob('Export');
|
242 |
if ($job->getDataSourceEntity() == 'newsletter_subscriber') {
|
243 |
$collection->addFieldToFilter('subscriber_status', Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED);
|
244 |
$orderBy = 'subscriber_id';
|
245 |
+
} elseif ($job->getDataSourceEntity() == 'customer') {
|
246 |
$orderBy = 'entity_id';
|
247 |
}
|
248 |
|
249 |
+
if ($orderBy) {
|
250 |
$collection->addOrder($orderBy, 'ASC');
|
251 |
}
|
252 |
|
253 |
+
$collection->load();
|
254 |
|
255 |
+
//Update total count on first run
|
256 |
+
if (!$job->getTotalCount()) {
|
257 |
+
$allRows = $collection->getSize();
|
258 |
+
$job->setTotalCount($allRows)->save();
|
259 |
+
}
|
260 |
|
261 |
+
$batch = array();
|
262 |
|
263 |
+
foreach ($job->lists() as $listId) {
|
264 |
+
$store = $this->_helper()->getStoreByList($listId);
|
265 |
+
$api = Mage::getSingleton('monkey/api', array('store' => $store));
|
266 |
|
267 |
+
$processedCount = 0;
|
268 |
+
foreach ($collection as $item) {
|
269 |
+
$processedCount += 1;
|
270 |
$isOnMailChimp = Mage::helper('monkey')->subscribedToList($item->getEmail(), $listId);
|
271 |
+
if ($isOnMailChimp) {
|
272 |
$api->listUpdateMember($listId, $item->getEmail(), $this->_helper()->getMergeVars($item));
|
273 |
+
} else {
|
274 |
$batch [] = $this->_helper()->getMergeVars($item, TRUE);
|
275 |
}
|
276 |
+
}
|
277 |
+
if (count($batch) > 0) {
|
278 |
+
|
279 |
+
$job->setStatus('chunk_running')
|
280 |
+
->setUpdatedAt($this->_dbDate())
|
281 |
+
->save();
|
282 |
+
|
283 |
+
$vals = $api->listBatchSubscribe($listId, $batch, FALSE, TRUE, FALSE);
|
284 |
+
|
285 |
+
if (is_null($api->errorCode)) {
|
286 |
+
|
287 |
+
$lastId = $collection->getLastItem()->getId();
|
288 |
+
$job->setLastProcessedId($lastId);
|
289 |
+
$job->setProcessedCount(($processedCount + $job->getProcessedCount()));
|
290 |
+
|
291 |
+
$job
|
292 |
+
->setUpdatedAt($this->_dbDate())
|
293 |
+
->save();
|
294 |
+
|
295 |
+
} else {
|
296 |
+
|
297 |
+
//TODO: Do something to handle errors
|
298 |
+
|
299 |
+
/*echo "Batch Subscribe failed!\n";
|
300 |
+
echo "code:".$api->errorCode."\n";
|
301 |
+
echo "msg :".$api->errorMessage."\n";
|
302 |
+
die;*/
|
303 |
+
/*echo "added: ".$vals['add_count']."\n";
|
304 |
+
echo "updated: ".$vals['update_count']."\n";
|
305 |
+
echo "errors: ".$vals['error_count']."\n";
|
306 |
+
foreach($vals['errors'] as $val){
|
307 |
+
echo $val['email_address']. " failed\n";
|
308 |
+
echo "code:".$val['code']."\n";
|
309 |
+
echo "msg :".$val['message']."\n";
|
310 |
+
}
|
311 |
+
die;*/
|
312 |
+
|
313 |
+
}
|
314 |
+
|
315 |
+
} else {
|
316 |
+
$job
|
317 |
+
->setStatus('finished')
|
318 |
+
->setUpdatedAt($this->_dbDate())
|
319 |
+
->save();
|
320 |
+
}
|
321 |
+
|
322 |
+
}
|
323 |
+
|
324 |
+
return $this;
|
325 |
+
}
|
326 |
+
|
327 |
+
/**
|
328 |
+
* Get collection object for given entity type
|
329 |
+
*
|
330 |
+
* @todo Add default Billing and Shipping address data
|
331 |
+
* @param string $type
|
332 |
+
* @return Mage_Newsletter_Model_Mysql4_Subscriber_Collection|Mage_Customer_Model_Entity_Customer_Collection
|
333 |
+
*/
|
334 |
+
protected function _getEntityModel($type)
|
335 |
+
{
|
336 |
+
$model = null;
|
337 |
+
|
338 |
+
switch ($type) {
|
339 |
+
case 'newsletter_subscriber':
|
340 |
+
$model = Mage::getResourceSingleton('newsletter/subscriber_collection')
|
341 |
+
//->showCustomerInfo(true)
|
342 |
+
->addSubscriberTypeField()
|
343 |
+
->showStoreInfo();
|
344 |
+
break;
|
345 |
+
case 'customer':
|
346 |
+
|
347 |
+
$model = Mage::getResourceModel('customer/customer_collection')
|
348 |
+
->addNameToSelect()
|
349 |
+
->addAttributeToSelect('gender')
|
350 |
+
->addAttributeToSelect('dob');
|
351 |
+
break;
|
352 |
+
}
|
353 |
+
|
354 |
+
return $model;
|
355 |
+
}
|
356 |
+
|
357 |
+
/**
|
358 |
+
* Return ID field name for given entity type
|
359 |
+
*
|
360 |
+
* @param string $type
|
361 |
+
* @return string
|
362 |
+
*/
|
363 |
+
protected function _getId($type)
|
364 |
+
{
|
365 |
+
$idFieldName = null;
|
366 |
+
|
367 |
+
switch ($type) {
|
368 |
+
case 'newsletter_subscriber':
|
369 |
+
$idFieldName = 'subscriber_id';
|
370 |
+
break;
|
371 |
+
default:
|
372 |
+
$idFieldName = 'entity_id';
|
373 |
+
}
|
374 |
+
|
375 |
+
return $idFieldName;
|
376 |
+
}
|
377 |
+
|
378 |
+
/**
|
379 |
+
* Get HELPER instance
|
380 |
+
*
|
381 |
+
* @param string $which
|
382 |
+
* @return object
|
383 |
+
*/
|
384 |
+
protected function _helper($which = 'data')
|
385 |
+
{
|
386 |
+
return Mage::helper('monkey/' . $which);
|
387 |
+
}
|
388 |
+
|
389 |
+
/**
|
390 |
+
* Return GMT date
|
391 |
+
*
|
392 |
+
* @return string
|
393 |
+
*/
|
394 |
+
protected function _dbDate()
|
395 |
+
{
|
396 |
+
return Mage::getModel('core/date')->gmtDate();
|
397 |
+
}
|
398 |
+
|
399 |
+
/**
|
400 |
+
* Get first job to process in queue
|
401 |
+
*
|
402 |
+
* @param string $entity
|
403 |
+
* @return null|Ebizmarts_MageMonkey_Model_BulksyncExport|Ebizmarts_MageMonkey_Model_BulksyncImport
|
404 |
+
*/
|
405 |
+
protected function _getJob($entity)
|
406 |
+
{
|
407 |
+
$job = Mage::getModel("monkey/bulksync{$entity}")
|
408 |
+
->getCollection()
|
409 |
+
->addFieldToFilter('status', array('IN' => array('idle', 'chunk_running')))
|
410 |
+
->addOrder('created_at', 'asc')
|
411 |
+
->load();
|
412 |
+
if (!$job->getFirstItem()->getId()) {
|
413 |
+
return null;
|
414 |
+
}
|
415 |
+
|
416 |
+
return $job->getFirstItem();
|
417 |
+
}
|
418 |
+
|
419 |
+
/** Send order to MailChimp Automatically by Order Status
|
420 |
+
*
|
421 |
+
*
|
422 |
+
*
|
423 |
+
*/
|
424 |
+
public function autoExportSubscribers()
|
425 |
+
{
|
426 |
$allStores = Mage::app()->getStores();
|
427 |
+
foreach ($allStores as $storeId => $val) {
|
428 |
+
if (Mage::getStoreConfig(Ebizmarts_MageMonkey_Model_Config::ECOMMERCE360_ACTIVE, $storeId) == 3 && Mage::getModel('monkey/ecommerce360')->isActive()) {
|
429 |
Mage::getModel('monkey/ecommerce360')->autoExportJobs($storeId);
|
430 |
}
|
431 |
}
|
432 |
}
|
433 |
+
|
434 |
public function processAutoExportOrders()
|
435 |
{
|
436 |
$allStores = Mage::app()->getStores();
|
437 |
+
foreach ($allStores as $storeId => $val) {
|
438 |
+
if (Mage::getStoreConfig("monkey/general/active", $storeId)) {
|
|
|
439 |
$this->_exportOrders($storeId);
|
440 |
}
|
441 |
}
|
442 |
}
|
443 |
+
|
444 |
public function sendordersAsync()
|
445 |
{
|
446 |
$collection = Mage::getModel('monkey/asyncorders')->getCollection();
|
447 |
+
$collection->addFieldToFilter('processed', array('eq' => 0));
|
448 |
$storeId = null;
|
449 |
+
foreach ($collection as $item) {
|
450 |
$info = (array)unserialize($item->getInfo());
|
451 |
// $collection2 = Mage::getmodel('monkey/asyncsubscribers')->getCollection()
|
452 |
// ->addFieldToFilter('processed',array('eq'=>1))
|
493 |
}
|
494 |
}
|
495 |
}
|
496 |
+
|
497 |
public function cleanordersAsync()
|
498 |
{
|
499 |
$collection = Mage::getModel('monkey/asyncorders')->getCollection();
|
500 |
+
$collection->addFieldToFilter('processed', array('eq' => 1));
|
501 |
+
foreach ($collection as $item) {
|
|
|
502 |
$item->delete();
|
503 |
}
|
504 |
}
|
505 |
+
|
506 |
public function sendSubscribersAsync()
|
507 |
{
|
508 |
$collection = Mage::getModel('monkey/asyncsubscribers')->getCollection();
|
509 |
+
$collection->addFieldToFilter('processed', array('eq' => 0))
|
510 |
->setOrder('lists', 'desc');
|
511 |
$batch = array();
|
512 |
$oldList = '';
|
513 |
$isConfirmNeed = FALSE;
|
514 |
+
foreach ($collection as $item) {
|
|
|
515 |
$newList = $item->getLists();
|
516 |
$eachIsConfirmNeed = $item->getConfirm();
|
517 |
|
518 |
+
if ($oldList == '') {
|
519 |
$oldList = $newList;
|
520 |
}
|
521 |
+
if ($newList != $oldList || $eachIsConfirmNeed != $isConfirmNeed) {
|
522 |
+
if (count($batch) > 0) {
|
523 |
+
Mage::getSingleton('monkey/api')->listBatchSubscribe($oldList, $batch, $isConfirmNeed, TRUE, FALSE);
|
524 |
+
}
|
525 |
$isConfirmNeed = $eachIsConfirmNeed;
|
526 |
$oldList = $newList;
|
527 |
$batch = array();
|
533 |
//$email = $item->getEmail();
|
534 |
//Mage::getSingleton('monkey/api')->listSubscribe($listId, $email, $mergeVars, 'html', $isConfirmNeed);
|
535 |
$item->setProcessed(1)->save();
|
536 |
+
if ($item->getId() == $collection->getLastItem()->getId() && count($batch) > 0) {
|
537 |
Mage::getSingleton('monkey/api')->listBatchSubscribe($oldList, $batch, $isConfirmNeed, TRUE, FALSE);
|
538 |
}
|
539 |
}
|
540 |
|
541 |
}
|
542 |
+
|
543 |
public function cleanSubscribersAsync()
|
544 |
{
|
545 |
$collection = Mage::getModel('monkey/asyncsubscribers')->getCollection();
|
546 |
+
$collection->addFieldToFilter('processed', array('eq' => 1));
|
547 |
+
foreach ($collection as $item) {
|
|
|
548 |
$item->delete();
|
549 |
}
|
550 |
}
|
app/code/community/Ebizmarts/MageMonkey/Model/Custom/Collection.php
CHANGED
@@ -8,49 +8,48 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_MageMonkey_Model_Custom_Collection
|
13 |
-
|
14 |
{
|
15 |
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
|
37 |
-
|
38 |
|
39 |
-
|
40 |
-
|
41 |
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
|
55 |
foreach ($this->_toload as $row) {
|
56 |
$item = new Varien_Object;
|
@@ -60,6 +59,6 @@ class Ebizmarts_MageMonkey_Model_Custom_Collection
|
|
60 |
|
61 |
$this->_setIsLoaded();
|
62 |
|
63 |
-
|
64 |
-
|
65 |
}
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
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;
|
59 |
|
60 |
$this->_setIsLoaded();
|
61 |
|
62 |
+
return $this;
|
63 |
+
}
|
64 |
}
|
app/code/community/Ebizmarts/MageMonkey/Model/Ecommerce.php
CHANGED
@@ -8,14 +8,13 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_MageMonkey_Model_Ecommerce extends Mage_Core_Model_Abstract
|
13 |
{
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
public function _construct()
|
20 |
{
|
21 |
parent::_construct();
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_MageMonkey_Model_Ecommerce extends Mage_Core_Model_Abstract
|
12 |
{
|
13 |
+
/**
|
14 |
+
* Initialize model
|
15 |
+
*
|
16 |
+
* @return void
|
17 |
+
*/
|
18 |
public function _construct()
|
19 |
{
|
20 |
parent::_construct();
|
app/code/community/Ebizmarts/MageMonkey/Model/Ecommerce360.php
CHANGED
@@ -8,39 +8,38 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_MageMonkey_Model_Ecommerce360
|
13 |
{
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
|
45 |
/**
|
46 |
* Retrieve Cookie Object
|
@@ -52,24 +51,24 @@ class Ebizmarts_MageMonkey_Model_Ecommerce360
|
|
52 |
return Mage::app()->getCookie();
|
53 |
}
|
54 |
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
// if( $this->isActive() ){
|
74 |
// $request = Mage::app()->getRequest();
|
75 |
//
|
@@ -82,77 +81,78 @@ class Ebizmarts_MageMonkey_Model_Ecommerce360
|
|
82 |
// }
|
83 |
// }
|
84 |
return $observer;
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
$storeId = Mage::app()->getStore()->getId();
|
96 |
$order = $observer->getEvent()->getOrder();
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
|
|
125 |
$createdAtArr = str_split($this->_order->getCreatedAt(), 10);
|
126 |
$this->_info = array(
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
$rs = false;
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
if(Mage::getStoreConfig('monkey/general/checkout_async')) {
|
147 |
$collection = Mage::getModel('monkey/asyncorders')->getCollection();
|
148 |
$alreadyOnDb = false;
|
149 |
-
foreach ($collection as $order){
|
150 |
$info = unserialize($order->getInfo());
|
151 |
-
if($info['order_id'] == $this->_order->getId()){
|
152 |
$alreadyOnDb = true;
|
153 |
}
|
154 |
}
|
155 |
-
if(!$alreadyOnDb) {
|
156 |
$sync = Mage::getModel('monkey/asyncorders');
|
157 |
$this->_info['order_id'] = $this->_order->getId();
|
158 |
$sync->setInfo(serialize($this->_info))
|
@@ -160,26 +160,25 @@ class Ebizmarts_MageMonkey_Model_Ecommerce360
|
|
160 |
->setProcessed(0)
|
161 |
->save();
|
162 |
$rs = true;
|
163 |
-
}else{
|
164 |
$rs = 'Order already sent or ready to get sent soon';
|
165 |
}
|
166 |
-
}
|
167 |
-
else {
|
168 |
//Send order to MailChimp
|
169 |
-
|
170 |
}
|
171 |
-
|
172 |
$this->_info ['email'] = $this->_order->getCustomerEmail();
|
173 |
if (Mage::getStoreConfig('monkey/general/checkout_async')) {
|
174 |
$collection = Mage::getModel('monkey/asyncorders')->getCollection();
|
175 |
$alreadyOnDb = false;
|
176 |
-
foreach ($collection as $order){
|
177 |
$info = unserialize($order->getInfo());
|
178 |
-
if($info['order_id'] == $this->_order->getId()){
|
179 |
$alreadyOnDb = true;
|
180 |
}
|
181 |
}
|
182 |
-
if(!$alreadyOnDb) {
|
183 |
$sync = Mage::getModel('monkey/asyncorders');
|
184 |
$this->_info['order_id'] = $this->_order->getId();
|
185 |
$sync->setInfo(serialize($this->_info))
|
@@ -187,154 +186,155 @@ class Ebizmarts_MageMonkey_Model_Ecommerce360
|
|
187 |
->setProcessed(0)
|
188 |
->save();
|
189 |
$rs = true;
|
190 |
-
}else{
|
191 |
-
|
192 |
}
|
193 |
} else {
|
194 |
$rs = $api->ecommOrderAdd($this->_info);
|
195 |
}
|
196 |
}
|
197 |
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
|
205 |
}
|
206 |
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
private function setItemstoSend($storeId)
|
214 |
{
|
215 |
-
|
216 |
-
|
217 |
$product = Mage::getModel('catalog/product')->load($item->getProductId());
|
218 |
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
|
226 |
-
|
227 |
-
|
228 |
$mcitem['product_name'] = $product->getName();
|
229 |
$attributesToSend = explode(',', Mage::getStoreConfig(Ebizmarts_MageMonkey_Model_Config::ECOMMERCE360_ATTRIBUTES, $storeId));
|
230 |
$attributes = $product->getAttributes();
|
231 |
$productAttributes = '';
|
232 |
$pipe = false;
|
233 |
-
foreach($attributes as $attribute){
|
234 |
-
if($pipe){
|
235 |
$productAttributes .= '|';
|
236 |
}
|
237 |
-
if(in_array($attribute->getAttributeCode(), $attributesToSend) && is_string($attribute->getFrontend()->getValue($product)) && trim($attribute->getFrontend()->getValue($product)) != ''){
|
238 |
-
$productAttributes .= $attribute->getAttributeCode().':'
|
239 |
$pipe = true;
|
240 |
-
}else{
|
241 |
$pipe = false;
|
242 |
}
|
243 |
}
|
244 |
-
if($productAttributes){
|
245 |
-
$mcitem['product_name'] .= '['
|
246 |
}
|
247 |
|
248 |
$names = array();
|
249 |
$cat_ids = $product->getCategoryIds();
|
250 |
|
251 |
-
if (is_array($cat_ids) && count($cat_ids)>0){
|
252 |
$category = Mage::getModel('catalog/category')->load($cat_ids[0]);
|
253 |
$mcitem['category_id'] = $cat_ids[0];
|
254 |
$names[] = $category->getName();
|
255 |
-
while ($category->getParentId() && $category->getParentId()!=1){
|
256 |
$category = Mage::getModel('catalog/category')->load($category->getParentId());
|
257 |
$names[] = $category->getName();
|
258 |
}
|
259 |
}
|
260 |
-
if(!isset($mcitem['category_id'])) {
|
261 |
-
|
262 |
}
|
263 |
-
|
264 |
$mcitem['qty'] = $item->getQtyOrdered();
|
265 |
-
|
266 |
$this->_info['items'][] = $mcitem;
|
267 |
$this->_auxPrice = 0;
|
268 |
-
|
269 |
|
270 |
-
|
271 |
}
|
272 |
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
protected function _logCall()
|
299 |
{
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
public function autoExportJobs($storeId)
|
|
|
315 |
$allow_sent = false;
|
316 |
//Get status options selected in the Configuration
|
317 |
-
$states = explode(',', Mage::getStoreConfig(Ebizmarts_MageMonkey_Model_Config::ECOMMERCE360_ORDER_STATUS
|
318 |
$max = Mage::getStoreConfig(Ebizmarts_MageMonkey_Model_Config::ECOMMERCE360_ORDER_MAX, $storeId);
|
319 |
$count = 0;
|
320 |
-
foreach($states as $state) {
|
321 |
-
if($max == $count){
|
322 |
break;
|
323 |
}
|
324 |
$ecommerceTable = Mage::getSingleton('core/resource')->getTableName('monkey/ecommerce');
|
325 |
-
if($state != 'all_status') {
|
326 |
$orders = Mage::getResourceModel('sales/order_collection')->addFieldToFilter('main_table.store_id', array('eq' => $storeId));
|
327 |
// $orders->getSelect()->joinLeft(array('ecommerce' => Mage::getSingleton('core/resource')->getTableName('monkey/ecommerce')), 'main_table.entity_id = ecommerce.order_id', 'main_table.*')->where('ecommerce.order_id is null AND main_table.status = \'' . $state . '\'')
|
328 |
// ->limit($max - $count);
|
329 |
$orders->getSelect()->where('main_table.status = \'' . $state . '\' ' .
|
330 |
-
'AND main_table.entity_id NOT IN '.
|
331 |
"(SELECT ecommerce.order_id FROM {$ecommerceTable} AS ecommerce WHERE ecommerce.store_id = {$storeId})")
|
332 |
->limit($max - $count);
|
333 |
-
}else{
|
334 |
$orders = Mage::getResourceModel('sales/order_collection')->addFieldToFilter('main_table.store_id', array('eq' => $storeId));
|
335 |
// $orders->getSelect()->joinLeft(array('ecommerce' => Mage::getSingleton('core/resource')->getTableName('monkey/ecommerce')), 'main_table.entity_id = ecommerce.order_id', 'main_table.*')->where('ecommerce.order_id is null')
|
336 |
// ->limit($max - $count);
|
337 |
-
$orders->getSelect()->where('main_table.entity_id NOT IN '.
|
338 |
"(SELECT ecommerce.order_id FROM {$ecommerceTable} AS ecommerce WHERE ecommerce.store_id = {$storeId})")
|
339 |
->limit($max - $count);
|
340 |
}
|
@@ -344,9 +344,9 @@ class Ebizmarts_MageMonkey_Model_Ecommerce360
|
|
344 |
$this->_order = $order;
|
345 |
$ordersToSend = Mage::getModel('monkey/asyncorders')->getCollection()
|
346 |
->addFieldToFilter('processed', array('eq' => 0));
|
347 |
-
foreach($ordersToSend as $orderToSend){
|
348 |
$info = (array)unserialize($orderToSend->getInfo());
|
349 |
-
if($this->_order->getIncrementId() == $info['id']){
|
350 |
continue;
|
351 |
}
|
352 |
}
|
@@ -383,7 +383,7 @@ class Ebizmarts_MageMonkey_Model_Ecommerce360
|
|
383 |
$this->_info ['email_id'] = $email;
|
384 |
$this->_info ['campaign_id'] = $campaign;
|
385 |
|
386 |
-
if(Mage::getStoreConfig('monkey/general/checkout_async', Mage::app()->getStore()->getId())) {
|
387 |
$sync = Mage::getModel('monkey/asyncorders');
|
388 |
$this->_info['order_id'] = $this->_order->getId();
|
389 |
$sync->setInfo(serialize($this->_info))
|
@@ -397,7 +397,7 @@ class Ebizmarts_MageMonkey_Model_Ecommerce360
|
|
397 |
}
|
398 |
} else {
|
399 |
$this->_info ['email'] = $email;
|
400 |
-
if(Mage::getStoreConfig('monkey/general/checkout_async', Mage::app()->getStore()->getId())) {
|
401 |
$sync = Mage::getModel('monkey/asyncorders');
|
402 |
$this->_info['order_id'] = $this->_order->getId();
|
403 |
$sync->setInfo(serialize($this->_info))
|
@@ -416,7 +416,7 @@ class Ebizmarts_MageMonkey_Model_Ecommerce360
|
|
416 |
->setMcEmailId($this->_info ['email'])
|
417 |
->setCreatedAt($createdAtArr[0])
|
418 |
->setStoreId($this->_info['store_id']);
|
419 |
-
if(isset($this->_info['campaign_id']) && $this->_info['campaign_id']){
|
420 |
$order->setMcCampaignId($this->_info['campaign_id']);
|
421 |
}
|
422 |
$order->save();
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_MageMonkey_Model_Ecommerce360
|
12 |
{
|
13 |
|
14 |
+
/**
|
15 |
+
* Order information to send to MC
|
16 |
+
*
|
17 |
+
* @var array
|
18 |
+
* @access protected
|
19 |
+
*/
|
20 |
+
protected $_info = array();
|
21 |
+
|
22 |
+
/**
|
23 |
+
* @var integer
|
24 |
+
* @access protected
|
25 |
+
*/
|
26 |
+
protected $_auxPrice = 0;
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Current order
|
30 |
+
*
|
31 |
+
* @var Mage_Sales_Model_Order
|
32 |
+
* @access protected
|
33 |
+
*/
|
34 |
+
protected $_order;
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Skip products list
|
38 |
+
*
|
39 |
+
* @var array
|
40 |
+
* @access protected
|
41 |
+
*/
|
42 |
+
protected $_productsToSkip = array(Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE, Mage_Catalog_Model_Product_Type::TYPE_BUNDLE);
|
43 |
|
44 |
/**
|
45 |
* Retrieve Cookie Object
|
51 |
return Mage::app()->getCookie();
|
52 |
}
|
53 |
|
54 |
+
/**
|
55 |
+
* Check if Ecommerce360 integration is enabled per configuration settings
|
56 |
+
*
|
57 |
+
* @return bool
|
58 |
+
*/
|
59 |
+
public function isActive()
|
60 |
+
{
|
61 |
+
return Mage::helper('monkey')->ecommerce360Active();
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Add cookie to customer's session
|
66 |
+
*
|
67 |
+
* @param Varien_Event_Observer $observer
|
68 |
+
* @return Varien_Event_Observer
|
69 |
+
*/
|
70 |
+
public function saveCookie(Varien_Event_Observer $observer)
|
71 |
+
{
|
72 |
// if( $this->isActive() ){
|
73 |
// $request = Mage::app()->getRequest();
|
74 |
//
|
81 |
// }
|
82 |
// }
|
83 |
return $observer;
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Process data and send order to MC
|
88 |
+
*
|
89 |
+
* @param Varien_Event_Observer $observer
|
90 |
+
* @return Varien_Event_Observer
|
91 |
+
*/
|
92 |
+
public function run(Varien_Event_Observer $observer)
|
93 |
+
{
|
94 |
$storeId = Mage::app()->getStore()->getId();
|
95 |
$order = $observer->getEvent()->getOrder();
|
96 |
+
if ((($this->_getCampaignCookie() &&
|
97 |
+
$this->_getEmailCookie()) || Mage::getStoreConfig(Ebizmarts_MageMonkey_Model_Config::ECOMMERCE360_ACTIVE, $storeId) == 2) &&
|
98 |
+
$this->isActive()
|
99 |
+
) {
|
100 |
+
$this->logSale($order);
|
101 |
+
}
|
102 |
+
return $observer;
|
103 |
+
}
|
104 |
+
|
105 |
+
/**
|
106 |
+
* Send order to MailChimp
|
107 |
+
*
|
108 |
+
* @param Mage_Sales_Model_Order $order
|
109 |
+
* @return bool|array
|
110 |
+
*/
|
111 |
+
public function logSale($order)
|
112 |
+
{
|
113 |
+
|
114 |
+
$this->_order = $order;
|
115 |
+
$api = Mage::getSingleton('monkey/api', array('store' => $this->_order->getStoreId()));
|
116 |
+
if (!$api) {
|
117 |
+
return false;
|
118 |
+
}
|
119 |
+
|
120 |
+
$subtotal = $this->_order->getBaseSubtotal();
|
121 |
+
$discount = (float)$this->_order->getBaseDiscountAmount();
|
122 |
+
if ($discount != 0) {
|
123 |
+
$subtotal = $subtotal + ($discount);
|
124 |
+
}
|
125 |
$createdAtArr = str_split($this->_order->getCreatedAt(), 10);
|
126 |
$this->_info = array(
|
127 |
+
'id' => $this->_order->getIncrementId(),
|
128 |
+
'total' => $subtotal,
|
129 |
+
'shipping' => $this->_order->getBaseShippingAmount(),
|
130 |
+
'tax' => $this->_order->getBaseTaxAmount(),
|
131 |
+
'store_id' => $this->_order->getStoreId(),
|
132 |
+
'store_name' => $this->_order->getStoreName(),
|
133 |
+
'order_date' => $createdAtArr[0],
|
134 |
+
'plugin_id' => 1215,
|
135 |
+
'items' => array()
|
136 |
+
);
|
137 |
+
|
138 |
+
$emailCookie = $this->_getEmailCookie();
|
139 |
+
$campaignCookie = $this->_getCampaignCookie();
|
140 |
+
|
141 |
+
$this->setItemstoSend($this->_order->getStoreId());
|
142 |
$rs = false;
|
143 |
+
if ($emailCookie && $campaignCookie) {
|
144 |
+
$this->_info ['email_id'] = $emailCookie;
|
145 |
+
$this->_info ['campaign_id'] = $campaignCookie;
|
146 |
+
if (Mage::getStoreConfig('monkey/general/checkout_async')) {
|
147 |
$collection = Mage::getModel('monkey/asyncorders')->getCollection();
|
148 |
$alreadyOnDb = false;
|
149 |
+
foreach ($collection as $order) {
|
150 |
$info = unserialize($order->getInfo());
|
151 |
+
if ($info['order_id'] == $this->_order->getId()) {
|
152 |
$alreadyOnDb = true;
|
153 |
}
|
154 |
}
|
155 |
+
if (!$alreadyOnDb) {
|
156 |
$sync = Mage::getModel('monkey/asyncorders');
|
157 |
$this->_info['order_id'] = $this->_order->getId();
|
158 |
$sync->setInfo(serialize($this->_info))
|
160 |
->setProcessed(0)
|
161 |
->save();
|
162 |
$rs = true;
|
163 |
+
} else {
|
164 |
$rs = 'Order already sent or ready to get sent soon';
|
165 |
}
|
166 |
+
} else {
|
|
|
167 |
//Send order to MailChimp
|
168 |
+
$rs = $api->campaignEcommOrderAdd($this->_info);
|
169 |
}
|
170 |
+
} else {
|
171 |
$this->_info ['email'] = $this->_order->getCustomerEmail();
|
172 |
if (Mage::getStoreConfig('monkey/general/checkout_async')) {
|
173 |
$collection = Mage::getModel('monkey/asyncorders')->getCollection();
|
174 |
$alreadyOnDb = false;
|
175 |
+
foreach ($collection as $order) {
|
176 |
$info = unserialize($order->getInfo());
|
177 |
+
if ($info['order_id'] == $this->_order->getId()) {
|
178 |
$alreadyOnDb = true;
|
179 |
}
|
180 |
}
|
181 |
+
if (!$alreadyOnDb) {
|
182 |
$sync = Mage::getModel('monkey/asyncorders');
|
183 |
$this->_info['order_id'] = $this->_order->getId();
|
184 |
$sync->setInfo(serialize($this->_info))
|
186 |
->setProcessed(0)
|
187 |
->save();
|
188 |
$rs = true;
|
189 |
+
} else {
|
190 |
+
$rs = 'Order already sent or ready to get sent soon';
|
191 |
}
|
192 |
} else {
|
193 |
$rs = $api->ecommOrderAdd($this->_info);
|
194 |
}
|
195 |
}
|
196 |
|
197 |
+
if ($rs === TRUE) {
|
198 |
+
$this->_logCall();
|
199 |
+
return true;
|
200 |
+
} else {
|
201 |
+
return $rs;
|
202 |
+
}
|
203 |
|
204 |
}
|
205 |
|
206 |
+
/**
|
207 |
+
* Process order items to send to MailChimp
|
208 |
+
*
|
209 |
+
* @access private
|
210 |
+
* @return Ebizmarts_MageMonkey_Model_Ecommerce360
|
211 |
+
*/
|
212 |
private function setItemstoSend($storeId)
|
213 |
{
|
214 |
+
foreach ($this->_order->getAllItems() as $item) {
|
215 |
+
$mcitem = array();
|
216 |
$product = Mage::getModel('catalog/product')->load($item->getProductId());
|
217 |
|
218 |
+
if (in_array($product->getTypeId(), $this->_productsToSkip) && $product->getPriceType() == 0) {
|
219 |
+
if ($product->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE) {
|
220 |
+
$this->_auxPrice = $item->getBasePrice();
|
221 |
+
}
|
222 |
+
continue;
|
223 |
+
}
|
224 |
|
225 |
+
$mcitem['product_id'] = $product->getEntityId();
|
226 |
+
$mcitem['sku'] = $product->getSku();
|
227 |
$mcitem['product_name'] = $product->getName();
|
228 |
$attributesToSend = explode(',', Mage::getStoreConfig(Ebizmarts_MageMonkey_Model_Config::ECOMMERCE360_ATTRIBUTES, $storeId));
|
229 |
$attributes = $product->getAttributes();
|
230 |
$productAttributes = '';
|
231 |
$pipe = false;
|
232 |
+
foreach ($attributes as $attribute) {
|
233 |
+
if ($pipe) {
|
234 |
$productAttributes .= '|';
|
235 |
}
|
236 |
+
if (in_array($attribute->getAttributeCode(), $attributesToSend) && is_string($attribute->getFrontend()->getValue($product)) && trim($attribute->getFrontend()->getValue($product)) != '') {
|
237 |
+
$productAttributes .= $attribute->getAttributeCode() . ':' . $attribute->getFrontend()->getValue($product);
|
238 |
$pipe = true;
|
239 |
+
} else {
|
240 |
$pipe = false;
|
241 |
}
|
242 |
}
|
243 |
+
if ($productAttributes) {
|
244 |
+
$mcitem['product_name'] .= '[' . $productAttributes . ']';
|
245 |
}
|
246 |
|
247 |
$names = array();
|
248 |
$cat_ids = $product->getCategoryIds();
|
249 |
|
250 |
+
if (is_array($cat_ids) && count($cat_ids) > 0) {
|
251 |
$category = Mage::getModel('catalog/category')->load($cat_ids[0]);
|
252 |
$mcitem['category_id'] = $cat_ids[0];
|
253 |
$names[] = $category->getName();
|
254 |
+
while ($category->getParentId() && $category->getParentId() != 1) {
|
255 |
$category = Mage::getModel('catalog/category')->load($category->getParentId());
|
256 |
$names[] = $category->getName();
|
257 |
}
|
258 |
}
|
259 |
+
if (!isset($mcitem['category_id'])) {
|
260 |
+
$mcitem['category_id'] = 0;
|
261 |
}
|
262 |
+
$mcitem['category_name'] = (count($names)) ? implode(" - ", array_reverse($names)) : 'None';
|
263 |
$mcitem['qty'] = $item->getQtyOrdered();
|
264 |
+
$mcitem['cost'] = ($this->_auxPrice > 0) ? $this->_auxPrice : $item->getBasePrice();
|
265 |
$this->_info['items'][] = $mcitem;
|
266 |
$this->_auxPrice = 0;
|
267 |
+
}
|
268 |
|
269 |
+
return $this;
|
270 |
}
|
271 |
|
272 |
+
/**
|
273 |
+
* Get cookie <magemonkey_email_id> from customer's session
|
274 |
+
*
|
275 |
+
* @return string|null
|
276 |
+
*/
|
277 |
+
protected function _getEmailCookie()
|
278 |
+
{
|
279 |
+
return $this->getCookie()->get('magemonkey_email_id');
|
280 |
+
}
|
281 |
+
|
282 |
+
/**
|
283 |
+
* Get cookie <magemonkey_campaign_id> from customer's session
|
284 |
+
*
|
285 |
+
* @return string|null
|
286 |
+
*/
|
287 |
+
protected function _getCampaignCookie()
|
288 |
+
{
|
289 |
+
return $this->getCookie()->get('magemonkey_campaign_id');
|
290 |
+
}
|
291 |
+
|
292 |
+
/**
|
293 |
+
* Save Api Call on db
|
294 |
+
*
|
295 |
+
* @return Ebizmarts_MageMonkey_Model_Ecommerce
|
296 |
+
*/
|
297 |
protected function _logCall()
|
298 |
{
|
299 |
+
return Mage::getModel('monkey/ecommerce')
|
300 |
+
->setOrderIncrementId($this->_order->getIncrementId())
|
301 |
+
->setOrderId($this->_order->getId())
|
302 |
+
->setMcCampaignId($this->_getCampaignCookie())
|
303 |
+
->setMcEmailId($this->_getEmailCookie())
|
304 |
+
->setCreatedAt(Mage::getModel('core/date')->gmtDate())
|
305 |
+
->setStoreId($this->_order->getStoreId())
|
306 |
+
->save();
|
307 |
+
}
|
308 |
+
|
309 |
+
/** Send order to MailChimp Automatically by Order Status
|
310 |
+
*
|
311 |
+
*
|
312 |
+
*/
|
313 |
+
public function autoExportJobs($storeId)
|
314 |
+
{
|
315 |
$allow_sent = false;
|
316 |
//Get status options selected in the Configuration
|
317 |
+
$states = explode(',', Mage::getStoreConfig(Ebizmarts_MageMonkey_Model_Config::ECOMMERCE360_ORDER_STATUS, $storeId));
|
318 |
$max = Mage::getStoreConfig(Ebizmarts_MageMonkey_Model_Config::ECOMMERCE360_ORDER_MAX, $storeId);
|
319 |
$count = 0;
|
320 |
+
foreach ($states as $state) {
|
321 |
+
if ($max == $count) {
|
322 |
break;
|
323 |
}
|
324 |
$ecommerceTable = Mage::getSingleton('core/resource')->getTableName('monkey/ecommerce');
|
325 |
+
if ($state != 'all_status') {
|
326 |
$orders = Mage::getResourceModel('sales/order_collection')->addFieldToFilter('main_table.store_id', array('eq' => $storeId));
|
327 |
// $orders->getSelect()->joinLeft(array('ecommerce' => Mage::getSingleton('core/resource')->getTableName('monkey/ecommerce')), 'main_table.entity_id = ecommerce.order_id', 'main_table.*')->where('ecommerce.order_id is null AND main_table.status = \'' . $state . '\'')
|
328 |
// ->limit($max - $count);
|
329 |
$orders->getSelect()->where('main_table.status = \'' . $state . '\' ' .
|
330 |
+
'AND main_table.entity_id NOT IN ' .
|
331 |
"(SELECT ecommerce.order_id FROM {$ecommerceTable} AS ecommerce WHERE ecommerce.store_id = {$storeId})")
|
332 |
->limit($max - $count);
|
333 |
+
} else {
|
334 |
$orders = Mage::getResourceModel('sales/order_collection')->addFieldToFilter('main_table.store_id', array('eq' => $storeId));
|
335 |
// $orders->getSelect()->joinLeft(array('ecommerce' => Mage::getSingleton('core/resource')->getTableName('monkey/ecommerce')), 'main_table.entity_id = ecommerce.order_id', 'main_table.*')->where('ecommerce.order_id is null')
|
336 |
// ->limit($max - $count);
|
337 |
+
$orders->getSelect()->where('main_table.entity_id NOT IN ' .
|
338 |
"(SELECT ecommerce.order_id FROM {$ecommerceTable} AS ecommerce WHERE ecommerce.store_id = {$storeId})")
|
339 |
->limit($max - $count);
|
340 |
}
|
344 |
$this->_order = $order;
|
345 |
$ordersToSend = Mage::getModel('monkey/asyncorders')->getCollection()
|
346 |
->addFieldToFilter('processed', array('eq' => 0));
|
347 |
+
foreach ($ordersToSend as $orderToSend) {
|
348 |
$info = (array)unserialize($orderToSend->getInfo());
|
349 |
+
if ($this->_order->getIncrementId() == $info['id']) {
|
350 |
continue;
|
351 |
}
|
352 |
}
|
383 |
$this->_info ['email_id'] = $email;
|
384 |
$this->_info ['campaign_id'] = $campaign;
|
385 |
|
386 |
+
if (Mage::getStoreConfig('monkey/general/checkout_async', Mage::app()->getStore()->getId())) {
|
387 |
$sync = Mage::getModel('monkey/asyncorders');
|
388 |
$this->_info['order_id'] = $this->_order->getId();
|
389 |
$sync->setInfo(serialize($this->_info))
|
397 |
}
|
398 |
} else {
|
399 |
$this->_info ['email'] = $email;
|
400 |
+
if (Mage::getStoreConfig('monkey/general/checkout_async', Mage::app()->getStore()->getId())) {
|
401 |
$sync = Mage::getModel('monkey/asyncorders');
|
402 |
$this->_info['order_id'] = $this->_order->getId();
|
403 |
$sync->setInfo(serialize($this->_info))
|
416 |
->setMcEmailId($this->_info ['email'])
|
417 |
->setCreatedAt($createdAtArr[0])
|
418 |
->setStoreId($this->_info['store_id']);
|
419 |
+
if (isset($this->_info['campaign_id']) && $this->_info['campaign_id']) {
|
420 |
$order->setMcCampaignId($this->_info['campaign_id']);
|
421 |
}
|
422 |
$order->save();
|
app/code/community/Ebizmarts/MageMonkey/Model/Email/Template.php
CHANGED
@@ -8,23 +8,22 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_MageMonkey_Model_Email_Template extends Mage_Core_Model_Email_Template
|
13 |
{
|
14 |
|
15 |
/**
|
16 |
* Send mail to recipient
|
17 |
*
|
18 |
-
* @param array|string
|
19 |
-
* @param array|string|null
|
20 |
-
* @param array
|
21 |
* @return boolean
|
22 |
**/
|
23 |
public function send($email, $name = null, array $variables = array())
|
24 |
{
|
25 |
|
26 |
-
|
27 |
-
if(FALSE === Mage::helper('monkey')->useTransactionalService()){
|
28 |
return parent::send($email, $name, $variables);
|
29 |
}
|
30 |
|
@@ -49,13 +48,13 @@ class Ebizmarts_MageMonkey_Model_Email_Template extends Mage_Core_Model_Email_Te
|
|
49 |
ini_set('smtp_port', Mage::getStoreConfig('system/smtp/port'));
|
50 |
|
51 |
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
|
58 |
-
$mail
|
59 |
$mail->setApiKey($apiKey);
|
60 |
|
61 |
$this->setUseAbsoluteLinks(true);
|
@@ -63,22 +62,22 @@ class Ebizmarts_MageMonkey_Model_Email_Template extends Mage_Core_Model_Email_Te
|
|
63 |
|
64 |
try {
|
65 |
|
66 |
-
$message = array
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
|
76 |
$sent = $mail->sendEmail($message);
|
77 |
-
if($mail->errorCode){
|
78 |
-
|
79 |
-
|
80 |
|
81 |
-
}catch (Exception $e) {
|
82 |
Mage::logException($e);
|
83 |
return false;
|
84 |
}
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_MageMonkey_Model_Email_Template extends Mage_Core_Model_Email_Template
|
12 |
{
|
13 |
|
14 |
/**
|
15 |
* Send mail to recipient
|
16 |
*
|
17 |
+
* @param array|string $email E-mail(s)
|
18 |
+
* @param array|string|null $name receiver name(s)
|
19 |
+
* @param array $variables template variables
|
20 |
* @return boolean
|
21 |
**/
|
22 |
public function send($email, $name = null, array $variables = array())
|
23 |
{
|
24 |
|
25 |
+
//Check if should use MC Transactional Email Service
|
26 |
+
if (FALSE === Mage::helper('monkey')->useTransactionalService()) {
|
27 |
return parent::send($email, $name, $variables);
|
28 |
}
|
29 |
|
48 |
ini_set('smtp_port', Mage::getStoreConfig('system/smtp/port'));
|
49 |
|
50 |
|
51 |
+
$service = Mage::helper('monkey')->config('transactional_emails');
|
52 |
+
$apiKey = Mage::helper('monkey')->getApiKey($this->getDesignConfig()->getStore());
|
53 |
+
if ('mandrill' == $service) {
|
54 |
+
$apiKey = Mage::helper('monkey')->getMandrillApiKey($this->getDesignConfig()->getStore());
|
55 |
+
}
|
56 |
|
57 |
+
$mail = Ebizmarts_MageMonkey_Model_TransactionalEmail_Adapter::factory($service);
|
58 |
$mail->setApiKey($apiKey);
|
59 |
|
60 |
$this->setUseAbsoluteLinks(true);
|
62 |
|
63 |
try {
|
64 |
|
65 |
+
$message = array(
|
66 |
+
'html' => $text,
|
67 |
+
'text' => $text,
|
68 |
+
'subject' => ('=?utf-8?B?' . base64_encode($this->getProcessedTemplateSubject($variables)) . '?='),
|
69 |
+
'from_name' => $this->getSenderName(),
|
70 |
+
'from_email' => $this->getSenderEmail(),
|
71 |
+
'to_email' => $emails,
|
72 |
+
'to_name' => $names
|
73 |
+
);
|
74 |
|
75 |
$sent = $mail->sendEmail($message);
|
76 |
+
if ($mail->errorCode) {
|
77 |
+
return false;
|
78 |
+
}
|
79 |
|
80 |
+
} catch (Exception $e) {
|
81 |
Mage::logException($e);
|
82 |
return false;
|
83 |
}
|
app/code/community/Ebizmarts/MageMonkey/Model/Feed/Updates.php
CHANGED
@@ -8,18 +8,19 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
-
|
13 |
|
14 |
private $_key = 'monkey';
|
15 |
private $_resources = array('Ebizmarts_MageMonkey', 'Ebizmarts_Global');
|
16 |
-
|
17 |
/**
|
18 |
* Retrieve feed data as XML element
|
19 |
*
|
20 |
* @return SimpleXMLElement
|
21 |
*/
|
22 |
-
public function getFeedData($uri)
|
|
|
23 |
$curl = new Varien_Http_Adapter_Curl;
|
24 |
$curl->setConfig(array(
|
25 |
'timeout' => 30
|
@@ -43,7 +44,8 @@ class Ebizmarts_MageMonkey_Model_Feed_Updates {
|
|
43 |
return $xml;
|
44 |
}
|
45 |
|
46 |
-
public function getConfig($key)
|
|
|
47 |
return Mage::getStoreConfig($this->_key . '/notifications/' . $key);
|
48 |
}
|
49 |
|
@@ -53,20 +55,23 @@ class Ebizmarts_MageMonkey_Model_Feed_Updates {
|
|
53 |
* @param string $rssDate
|
54 |
* @return string YYYY-MM-DD YY:HH:SS
|
55 |
*/
|
56 |
-
public function getDate($rssDate)
|
|
|
57 |
return gmdate('Y-m-d H:i:s', strtotime($rssDate));
|
58 |
-
}
|
59 |
-
|
60 |
/**
|
61 |
* Retrieve feed url
|
62 |
*
|
63 |
* @return string
|
64 |
*/
|
65 |
-
public function getFeedUrl()
|
|
|
66 |
return $this->getConfig('updates_url');
|
67 |
}
|
68 |
|
69 |
-
public function getLastUpdate($resource)
|
|
|
70 |
return Mage::app()->loadCache($this->_key . $resource . '_updates_feed_lastcheck');
|
71 |
}
|
72 |
|
@@ -75,22 +80,24 @@ class Ebizmarts_MageMonkey_Model_Feed_Updates {
|
|
75 |
* Checks feed
|
76 |
* @return
|
77 |
*/
|
78 |
-
public function check()
|
|
|
79 |
|
80 |
if (!Mage::getSingleton('admin/session')->isLoggedIn()) {
|
81 |
return $this;
|
82 |
-
}
|
83 |
-
|
84 |
-
foreach($this->_resources as $resource) {
|
85 |
-
|
86 |
-
if(((int)$this->getConfig('check_frequency')) + $this->getLastUpdate($resource) < time()) {
|
87 |
$this->_getUpdates($resource);
|
88 |
}
|
89 |
-
|
90 |
}
|
91 |
}
|
92 |
|
93 |
-
protected function _getUpdates($resource)
|
|
|
94 |
$feedData = array();
|
95 |
|
96 |
try {
|
@@ -102,20 +109,20 @@ class Ebizmarts_MageMonkey_Model_Feed_Updates {
|
|
102 |
return false;
|
103 |
}
|
104 |
|
105 |
-
foreach ($node->xpath('items/item') as $item) {
|
106 |
-
|
107 |
$feedData[] = array(
|
108 |
-
'severity' => (string)
|
109 |
-
'date_added' => (string)
|
110 |
-
'title' => (string)
|
111 |
-
'description' => (string)
|
112 |
-
'url' => (string)
|
113 |
);
|
114 |
}
|
115 |
|
116 |
if (count($feedData)) {
|
117 |
$inbox = Mage::getModel('adminnotification/inbox');
|
118 |
-
if ($inbox){
|
119 |
$inbox->parse($feedData);
|
120 |
}
|
121 |
}
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
+
class Ebizmarts_MageMonkey_Model_Feed_Updates
|
12 |
+
{
|
13 |
|
14 |
private $_key = 'monkey';
|
15 |
private $_resources = array('Ebizmarts_MageMonkey', 'Ebizmarts_Global');
|
16 |
+
|
17 |
/**
|
18 |
* Retrieve feed data as XML element
|
19 |
*
|
20 |
* @return SimpleXMLElement
|
21 |
*/
|
22 |
+
public function getFeedData($uri)
|
23 |
+
{
|
24 |
$curl = new Varien_Http_Adapter_Curl;
|
25 |
$curl->setConfig(array(
|
26 |
'timeout' => 30
|
44 |
return $xml;
|
45 |
}
|
46 |
|
47 |
+
public function getConfig($key)
|
48 |
+
{
|
49 |
return Mage::getStoreConfig($this->_key . '/notifications/' . $key);
|
50 |
}
|
51 |
|
55 |
* @param string $rssDate
|
56 |
* @return string YYYY-MM-DD YY:HH:SS
|
57 |
*/
|
58 |
+
public function getDate($rssDate)
|
59 |
+
{
|
60 |
return gmdate('Y-m-d H:i:s', strtotime($rssDate));
|
61 |
+
}
|
62 |
+
|
63 |
/**
|
64 |
* Retrieve feed url
|
65 |
*
|
66 |
* @return string
|
67 |
*/
|
68 |
+
public function getFeedUrl()
|
69 |
+
{
|
70 |
return $this->getConfig('updates_url');
|
71 |
}
|
72 |
|
73 |
+
public function getLastUpdate($resource)
|
74 |
+
{
|
75 |
return Mage::app()->loadCache($this->_key . $resource . '_updates_feed_lastcheck');
|
76 |
}
|
77 |
|
80 |
* Checks feed
|
81 |
* @return
|
82 |
*/
|
83 |
+
public function check()
|
84 |
+
{
|
85 |
|
86 |
if (!Mage::getSingleton('admin/session')->isLoggedIn()) {
|
87 |
return $this;
|
88 |
+
}
|
89 |
+
|
90 |
+
foreach ($this->_resources as $resource) {
|
91 |
+
|
92 |
+
if (((int)$this->getConfig('check_frequency')) + $this->getLastUpdate($resource) < time()) {
|
93 |
$this->_getUpdates($resource);
|
94 |
}
|
95 |
+
|
96 |
}
|
97 |
}
|
98 |
|
99 |
+
protected function _getUpdates($resource)
|
100 |
+
{
|
101 |
$feedData = array();
|
102 |
|
103 |
try {
|
109 |
return false;
|
110 |
}
|
111 |
|
112 |
+
foreach ($node->xpath('items/item') as $item) {
|
113 |
+
|
114 |
$feedData[] = array(
|
115 |
+
'severity' => (string)$item->severity,
|
116 |
+
'date_added' => (string)$item->created_at,
|
117 |
+
'title' => (string)$item->title,
|
118 |
+
'description' => (string)$item->description,
|
119 |
+
'url' => (string)$item->url,
|
120 |
);
|
121 |
}
|
122 |
|
123 |
if (count($feedData)) {
|
124 |
$inbox = Mage::getModel('adminnotification/inbox');
|
125 |
+
if ($inbox) {
|
126 |
$inbox->parse($feedData);
|
127 |
}
|
128 |
}
|
app/code/community/Ebizmarts/MageMonkey/Model/MCAPI.php
CHANGED
@@ -8,7 +8,6 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_MageMonkey_Model_MCAPI
|
13 |
{
|
14 |
var $version = "1.3";
|
@@ -53,22 +52,29 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
53 |
* @param string $apikey Your MailChimp apikey
|
54 |
* @param string $secure Whether or not this should use a secure connection
|
55 |
*/
|
56 |
-
function __construct($apikey, $secure=false)
|
|
|
57 |
$this->secure = $secure;
|
58 |
$this->apiUrl = parse_url("http://api.mailchimp.com/" . $this->version . "/?output=php");
|
59 |
$this->api_key = $apikey;
|
60 |
}
|
61 |
-
|
62 |
-
|
|
|
|
|
63 |
$this->timeout = $seconds;
|
64 |
return true;
|
65 |
}
|
66 |
}
|
67 |
-
|
|
|
|
|
68 |
return $this->timeout;
|
69 |
}
|
70 |
-
|
71 |
-
|
|
|
|
|
72 |
$this->secure = true;
|
73 |
} else {
|
74 |
$this->secure = false;
|
@@ -85,7 +91,8 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
85 |
* @param string $cid the id of the campaign to unschedule
|
86 |
* @return boolean true on success
|
87 |
*/
|
88 |
-
function campaignUnschedule($cid)
|
|
|
89 |
$params = array();
|
90 |
$params["cid"] = $cid;
|
91 |
return $this->callServer("campaignUnschedule", $params);
|
@@ -103,7 +110,8 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
103 |
* @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>
|
104 |
* @return boolean true on success
|
105 |
*/
|
106 |
-
function campaignSchedule($cid, $schedule_time, $schedule_time_b=NULL)
|
|
|
107 |
$params = array();
|
108 |
$params["cid"] = $cid;
|
109 |
$params["schedule_time"] = $schedule_time;
|
@@ -119,7 +127,8 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
119 |
* @param string $cid the id of the campaign to pause
|
120 |
* @return boolean true on success
|
121 |
*/
|
122 |
-
function campaignResume($cid)
|
|
|
123 |
$params = array();
|
124 |
$params["cid"] = $cid;
|
125 |
return $this->callServer("campaignResume", $params);
|
@@ -133,7 +142,8 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
133 |
* @param string $cid the id of the campaign to pause
|
134 |
* @return boolean true on success
|
135 |
*/
|
136 |
-
function campaignPause($cid)
|
|
|
137 |
$params = array();
|
138 |
$params["cid"] = $cid;
|
139 |
return $this->callServer("campaignPause", $params);
|
@@ -150,7 +160,8 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
150 |
* @param string $cid the id of the campaign to send
|
151 |
* @return boolean true on success
|
152 |
*/
|
153 |
-
function campaignSendNow($cid)
|
|
|
154 |
$params = array();
|
155 |
$params["cid"] = $cid;
|
156 |
return $this->callServer("campaignSendNow", $params);
|
@@ -169,8 +180,8 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
169 |
* @param string $send_type optional by default (null) both formats are sent - "html" or "text" send just that format
|
170 |
* @return boolean true on success
|
171 |
*/
|
172 |
-
function campaignSendTest($cid, $test_emails=array
|
173 |
-
|
174 |
$params = array();
|
175 |
$params["cid"] = $cid;
|
176 |
$params["test_emails"] = $test_emails;
|
@@ -187,74 +198,75 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
187 |
*
|
188 |
* @param string $list_id the list to test segmentation on - get lists using lists()
|
189 |
* @param array $options with 2 keys:
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
* @return int total The total number of subscribers matching your segmentation options
|
256 |
*/
|
257 |
-
function campaignSegmentTest($list_id, $options)
|
|
|
258 |
$params = array();
|
259 |
$params["list_id"] = $list_id;
|
260 |
$params["options"] = $options;
|
@@ -272,67 +284,66 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
272 |
*
|
273 |
* @param string $type the Campaign Type to create - one of "regular", "plaintext", "absplit", "rss", "trans", "auto"
|
274 |
* @param array $options a hash of the standard options for this campaign :
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
string event-datemerge optional sort of, this is required if the event is "date" or "annual"
|
331 |
-
|
332 |
*
|
333 |
* @return string the ID for the created campaign
|
334 |
*/
|
335 |
-
function campaignCreate($type, $options, $content, $segment_opts=NULL, $type_opts=NULL)
|
|
|
336 |
$params = array();
|
337 |
$params["type"] = $type;
|
338 |
$params["options"] = $options;
|
@@ -358,10 +369,11 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
358 |
*
|
359 |
* @param string $cid the Campaign Id to update
|
360 |
* @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.
|
361 |
-
* @param mixed
|
362 |
* @return boolean true if the update succeeds, otherwise an error will be thrown
|
363 |
*/
|
364 |
-
function campaignUpdate($cid, $name, $value)
|
|
|
365 |
$params = array();
|
366 |
$params["cid"] = $cid;
|
367 |
$params["name"] = $name;
|
@@ -370,30 +382,32 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
370 |
}
|
371 |
|
372 |
/** Replicate a campaign.
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
function campaignReplicate($cid)
|
|
|
382 |
$params = array();
|
383 |
$params["cid"] = $cid;
|
384 |
return $this->callServer("campaignReplicate", $params);
|
385 |
}
|
386 |
|
387 |
/** Delete a campaign. Seriously, "poof, gone!" - be careful!
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
function campaignDelete($cid)
|
|
|
397 |
$params = array();
|
398 |
$params["cid"] = $cid;
|
399 |
return $this->callServer("campaignDelete", $params);
|
@@ -407,58 +421,58 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
407 |
* @example xml-rpc_campaigns.php
|
408 |
*
|
409 |
* @param array $filters a hash of filters to apply to this query - all are optional:
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
* @param int $start optional - control paging of campaigns, start results at this campaign #, defaults to 1st page of data (page 0)
|
424 |
* @param int $limit optional - control paging of campaigns, number of campaigns to return with each call, defaults to 25 (max=1000)
|
425 |
* @return array an array containing a count of all matching campaigns and the specific ones for the current page (see Returned Fields for description)
|
426 |
* @returnf int total the total number of campaigns matching the filters passed in
|
427 |
* @returnf array data the data for each campaign being returned
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
*/
|
460 |
-
function campaigns($filters=array
|
461 |
-
|
462 |
$params = array();
|
463 |
$params["filters"] = $filters;
|
464 |
$params["start"] = $start;
|
@@ -492,30 +506,31 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
492 |
* @returnf int users_who_clicked Number of unique recipients who clicked on a link in the campaign.
|
493 |
* @returnf int emails_sent Number of email addresses campaign was sent to.
|
494 |
* @returnf array absplit If this was an absplit campaign, stats for the A and B groups will be returned
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
* @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:
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
*/
|
518 |
-
function campaignStats($cid)
|
|
|
519 |
$params = array();
|
520 |
$params["cid"] = $cid;
|
521 |
return $this->callServer("campaignStats", $params);
|
@@ -534,7 +549,8 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
534 |
* @returnf int clicks Number of times the specific link was clicked
|
535 |
* @returnf int unique Number of unique people who clicked on the specific link
|
536 |
*/
|
537 |
-
function campaignClickStats($cid)
|
|
|
538 |
$params = array();
|
539 |
$params["cid"] = $cid;
|
540 |
return $this->callServer("campaignClickStats", $params);
|
@@ -564,7 +580,8 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
564 |
* @returnf int clicks_pct Percentage of clicks from this domain (whole number)
|
565 |
* @returnf int unsubs_pct Percentage of unsubs from this domain (whole number)
|
566 |
*/
|
567 |
-
function campaignEmailDomainPerformance($cid)
|
|
|
568 |
$params = array();
|
569 |
$params["cid"] = $cid;
|
570 |
return $this->callServer("campaignEmailDomainPerformance", $params);
|
@@ -577,17 +594,18 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
577 |
*
|
578 |
* @param string $cid the campaign id to pull members for (can be gathered using campaigns())
|
579 |
* @param string $status optional the status to pull - one of 'sent', 'hard' (bounce), or 'soft' (bounce). By default, all records are returned
|
580 |
-
* @param int
|
581 |
-
* @param int
|
582 |
* @return array a total of all matching emails and the specific emails for this page
|
583 |
* @returnf int total the total number of members for the campaign and status
|
584 |
* @returnf array data the full campaign member records
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
*/
|
590 |
-
function campaignMembers($cid, $status=NULL, $start=0, $limit=1000)
|
|
|
591 |
$params = array();
|
592 |
$params["cid"] = $cid;
|
593 |
$params["status"] = $status;
|
@@ -604,14 +622,15 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
604 |
* @section Campaign Stats
|
605 |
*
|
606 |
* @param string $cid the campaign id to pull bounces for (can be gathered using campaigns())
|
607 |
-
* @param int
|
608 |
-
* @param int
|
609 |
* @return array a total of all hard bounced emails and the specific emails for this page
|
610 |
* @returnf int total the total number of hard bounces for the campaign
|
611 |
* @returnf array data the full email addresses that bounced
|
612 |
-
|
613 |
*/
|
614 |
-
function campaignHardBounces($cid, $start=0, $limit=1000)
|
|
|
615 |
$params = array();
|
616 |
$params["cid"] = $cid;
|
617 |
$params["start"] = $start;
|
@@ -627,14 +646,15 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
627 |
* @section Campaign Stats
|
628 |
*
|
629 |
* @param string $cid the campaign id to pull bounces for (can be gathered using campaigns())
|
630 |
-
* @param int
|
631 |
-
* @param int
|
632 |
* @return array a total of all soft bounced emails and the specific emails for this page
|
633 |
* @returnf int total the total number of soft bounces for the campaign
|
634 |
* @returnf array data the full email addresses that bounced
|
635 |
-
|
636 |
*/
|
637 |
-
function campaignSoftBounces($cid, $start=0, $limit=1000)
|
|
|
638 |
$params = array();
|
639 |
$params["cid"] = $cid;
|
640 |
$params["start"] = $start;
|
@@ -648,17 +668,18 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
648 |
* @section Campaign Stats
|
649 |
*
|
650 |
* @param string $cid the campaign id to pull bounces for (can be gathered using campaigns())
|
651 |
-
* @param int
|
652 |
-
* @param int
|
653 |
* @return array email addresses that unsubscribed from this campaign along with reasons, if given
|
654 |
* @return array a total of all unsubscribed emails and the specific emails for this page
|
655 |
* @returnf int total the total number of unsubscribes for the campaign
|
656 |
* @returnf array data the full email addresses that unsubscribed
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
*/
|
661 |
-
function campaignUnsubscribes($cid, $start=0, $limit=1000)
|
|
|
662 |
$params = array();
|
663 |
$params["cid"] = $cid;
|
664 |
$params["start"] = $start;
|
@@ -682,7 +703,8 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
682 |
* @returnf string email the email address that reported abuse
|
683 |
* @returnf string type an internal type generally specifying the orginating mail provider - may not be useful outside of filling report views
|
684 |
*/
|
685 |
-
function campaignAbuseReports($cid, $since=NULL, $start=0, $limit=500)
|
|
|
686 |
$params = array();
|
687 |
$params["cid"] = $cid;
|
688 |
$params["since"] = $since;
|
@@ -704,7 +726,8 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
704 |
* @returnf msg the advice message
|
705 |
* @returnf type the "type" of the message. one of: negative, positive, or neutral
|
706 |
*/
|
707 |
-
function campaignAdvice($cid)
|
|
|
708 |
$params = array();
|
709 |
$params["cid"] = $cid;
|
710 |
return $this->callServer("campaignAdvice", $params);
|
@@ -731,7 +754,8 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
731 |
* @returnf int ecomm_conversions number Ecommerce transactions tracked
|
732 |
* @returnf array goals an array containing goal names and number of conversions
|
733 |
*/
|
734 |
-
function campaignAnalytics($cid)
|
|
|
735 |
$params = array();
|
736 |
$params["cid"] = $cid;
|
737 |
return $this->callServer("campaignAnalytics", $params);
|
@@ -750,7 +774,8 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
750 |
* @returnf int opens The total number of opens that occurred in the country
|
751 |
* @returnf bool region_detail Whether or not a subsequent call to campaignGeoOpensByCountry() will return anything
|
752 |
*/
|
753 |
-
function campaignGeoOpens($cid)
|
|
|
754 |
$params = array();
|
755 |
$params["cid"] = $cid;
|
756 |
return $this->callServer("campaignGeoOpens", $params);
|
@@ -769,7 +794,8 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
769 |
* @returnf string name The name of the region, if we have one. For blank "code" values, this will be "Rest of Country"
|
770 |
* @returnf int opens The total number of opens that occurred in the country
|
771 |
*/
|
772 |
-
function campaignGeoOpensForCountry($cid, $code)
|
|
|
773 |
$params = array();
|
774 |
$params["cid"] = $cid;
|
775 |
$params["code"] = $code;
|
@@ -785,25 +811,26 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
785 |
* @param string $cid the campaign id to pull bounces for (can be gathered using campaigns())
|
786 |
* @return array stats an array containing tweets, retweets, clicks, and referrer related to using the campaign's eepurl
|
787 |
* @returnf array twitter various Twitter related stats
|
788 |
-
|
789 |
-
|
790 |
-
|
791 |
-
|
792 |
-
|
793 |
-
|
794 |
-
|
795 |
* @returnf array clicks stats related to click-throughs on the eepurl
|
796 |
-
|
797 |
-
|
798 |
-
|
799 |
-
|
800 |
* @returnf array referrers an array of arrays, each containing
|
801 |
-
|
802 |
-
|
803 |
-
|
804 |
-
|
805 |
*/
|
806 |
-
function campaignEepUrlStats($cid)
|
|
|
807 |
$params = array();
|
808 |
$params["cid"] = $cid;
|
809 |
return $this->callServer("campaignEepUrlStats", $params);
|
@@ -823,7 +850,8 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
823 |
* @returnf string email the email address that bounced
|
824 |
* @returnf string message the entire bounce message received
|
825 |
*/
|
826 |
-
function campaignBounceMessage($cid, $email)
|
|
|
827 |
$params = array();
|
828 |
$params["cid"] = $cid;
|
829 |
$params["email"] = $email;
|
@@ -846,11 +874,12 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
846 |
* @return array bounces the full bounce messages for this campaign
|
847 |
* @returnf int total that total number of bounce messages for the campaign
|
848 |
* @returnf array data an array containing the data for this page
|
849 |
-
|
850 |
-
|
851 |
-
|
852 |
*/
|
853 |
-
function campaignBounceMessages($cid, $start=0, $limit=25, $since=NULL)
|
|
|
854 |
$params = array();
|
855 |
$params["cid"] = $cid;
|
856 |
$params["start"] = $start;
|
@@ -871,17 +900,18 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
871 |
* @return array the total matching orders and the specific orders for the requested page
|
872 |
* @returnf int total the total matching orders
|
873 |
* @returnf array data the actual data for each order being returned
|
874 |
-
|
875 |
-
|
876 |
-
|
877 |
-
|
878 |
-
|
879 |
-
|
880 |
-
|
881 |
-
|
882 |
-
|
883 |
-
*/
|
884 |
-
function campaignEcommOrders($cid, $start=0, $limit=100, $since=NULL)
|
|
|
885 |
$params = array();
|
886 |
$params["cid"] = $cid;
|
887 |
$params["start"] = $start;
|
@@ -896,22 +926,22 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
896 |
* @section Campaign Related
|
897 |
*
|
898 |
* @param string $cid the campaign id to share a report for (can be gathered using campaigns())
|
899 |
-
* @param array
|
900 |
-
|
901 |
-
|
902 |
-
|
903 |
-
|
904 |
-
|
905 |
-
|
906 |
-
|
907 |
* @return struct Struct containing details for the shared report
|
908 |
* @returnf string title The Title of the Campaign being shared
|
909 |
* @returnf string url The URL to the shared report
|
910 |
* @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
|
911 |
* @returnf string password If secured, the password for the report, otherwise this field will not be returned
|
912 |
*/
|
913 |
-
function campaignShareReport($cid, $opts=array
|
914 |
-
|
915 |
$params = array();
|
916 |
$params["cid"] = $cid;
|
917 |
$params["opts"] = $opts;
|
@@ -924,12 +954,13 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
924 |
* @section Campaign Related
|
925 |
*
|
926 |
* @param string $cid the campaign id to get content for (can be gathered using campaigns())
|
927 |
-
* @param bool
|
928 |
* @return struct Struct containing all content for the campaign (see Returned Fields for details
|
929 |
* @returnf string html The HTML content used for the campgain with merge tags intact
|
930 |
* @returnf string text The Text content used for the campgain with merge tags intact
|
931 |
*/
|
932 |
-
function campaignContent($cid, $for_archive=true)
|
|
|
933 |
$params = array();
|
934 |
$params["cid"] = $cid;
|
935 |
$params["for_archive"] = $for_archive;
|
@@ -945,7 +976,8 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
945 |
* @param string $cid the campaign id to get content for (can be gathered using campaigns())
|
946 |
* @return array array containing all content section for the campaign -
|
947 |
*/
|
948 |
-
function campaignTemplateContent($cid)
|
|
|
949 |
$params = array();
|
950 |
$params["cid"] = $cid;
|
951 |
return $this->callServer("campaignTemplateContent", $params);
|
@@ -958,15 +990,16 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
958 |
* @section Campaign Report Data
|
959 |
*
|
960 |
* @param string $cid the campaign id to get opens for (can be gathered using campaigns())
|
961 |
-
* @param int
|
962 |
-
* @param int
|
963 |
* @return array array containing the total records matched and the specific records for this page
|
964 |
* @returnf int total the total number of records matched
|
965 |
* @returnf array data the actual opens data, including:
|
966 |
-
|
967 |
-
|
968 |
*/
|
969 |
-
function campaignOpenedAIM($cid, $start=0, $limit=1000)
|
|
|
970 |
$params = array();
|
971 |
$params["cid"] = $cid;
|
972 |
$params["start"] = $start;
|
@@ -980,14 +1013,15 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
980 |
* @section Campaign Report Data
|
981 |
*
|
982 |
* @param string $cid the campaign id to get no opens for (can be gathered using campaigns())
|
983 |
-
* @param int
|
984 |
-
* @param int
|
985 |
* @return array array containing the total records matched and the specific records for this page
|
986 |
* @returnf int total the total number of records matched
|
987 |
* @returnf array data the email addresses that did not open the campaign
|
988 |
-
|
989 |
*/
|
990 |
-
function campaignNotOpenedAIM($cid, $start=0, $limit=1000)
|
|
|
991 |
$params = array();
|
992 |
$params["cid"] = $cid;
|
993 |
$params["start"] = $start;
|
@@ -1002,15 +1036,16 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
1002 |
*
|
1003 |
* @param string $cid the campaign id to get click stats for (can be gathered using campaigns())
|
1004 |
* @param string $url the URL of the link that was clicked on
|
1005 |
-
* @param int
|
1006 |
-
* @param int
|
1007 |
* @return array array containing the total records matched and the specific records for this page
|
1008 |
* @returnf int total the total number of records matched
|
1009 |
* @returnf array data the email addresses that did not open the campaign
|
1010 |
-
|
1011 |
-
|
1012 |
*/
|
1013 |
-
function campaignClickDetailAIM($cid, $url, $start=0, $limit=1000)
|
|
|
1014 |
$params = array();
|
1015 |
$params["cid"] = $cid;
|
1016 |
$params["url"] = $url;
|
@@ -1030,11 +1065,12 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
1030 |
* @returnf int success the number of email address records found
|
1031 |
* @returnf int error the number of email address records which could not be found
|
1032 |
* @returnf array data arrays containing the actions (opens and clicks) that the email took, with timestamps
|
1033 |
-
|
1034 |
-
|
1035 |
-
|
1036 |
*/
|
1037 |
-
function campaignEmailStatsAIM($cid, $email_address)
|
|
|
1038 |
$params = array();
|
1039 |
$params["cid"] = $cid;
|
1040 |
$params["email_address"] = $email_address;
|
@@ -1054,11 +1090,12 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
1054 |
* @return array Array containing a total record count and data including the actions (opens and clicks) for each email, with timestamps
|
1055 |
* @returnf int total the total number of records
|
1056 |
* @returnf array data each record with their details:
|
1057 |
-
|
1058 |
-
|
1059 |
-
|
1060 |
*/
|
1061 |
-
function campaignEmailStatsAIMAll($cid, $start=0, $limit=100)
|
|
|
1062 |
$params = array();
|
1063 |
$params["cid"] = $cid;
|
1064 |
$params["start"] = $start;
|
@@ -1072,29 +1109,30 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
1072 |
* @section Campaign Related
|
1073 |
*
|
1074 |
* @param array $order an array of information pertaining to the order that has completed. Use the following keys:
|
1075 |
-
|
1076 |
-
|
1077 |
-
|
1078 |
-
|
1079 |
-
|
1080 |
-
|
1081 |
-
|
1082 |
-
|
1083 |
-
|
1084 |
-
|
1085 |
-
|
1086 |
-
|
1087 |
-
|
1088 |
-
|
1089 |
-
|
1090 |
-
|
1091 |
-
|
1092 |
-
|
1093 |
-
|
1094 |
-
|
1095 |
* @return bool true if the data is saved, otherwise an error is thrown.
|
1096 |
*/
|
1097 |
-
function campaignEcommOrderAdd($order)
|
|
|
1098 |
$params = array();
|
1099 |
$params["order"] = $order;
|
1100 |
return $this->callServer("campaignEcommOrderAdd", $params);
|
@@ -1108,50 +1146,50 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
1108 |
* @example xml-rpc_lists.php
|
1109 |
*
|
1110 |
* @param array $filters a hash of filters to apply to this query - all are optional:
|
1111 |
-
|
1112 |
-
|
1113 |
-
|
1114 |
-
|
1115 |
-
|
1116 |
-
|
1117 |
-
|
1118 |
-
|
1119 |
* @param int $start optional - control paging of lists, start results at this list #, defaults to 1st page of data (page 0)
|
1120 |
* @param int $limit optional - control paging of lists, number of lists to return with each call, defaults to 25 (max=100)
|
1121 |
* @return array an array with keys listed in Returned Fields below
|
1122 |
* @returnf int total the total number of lists which matched the provided filters
|
1123 |
* @returnf array data the lists which matched the provided filters, including the following for
|
1124 |
-
|
1125 |
-
|
1126 |
-
|
1127 |
-
|
1128 |
-
|
1129 |
-
|
1130 |
-
|
1131 |
-
|
1132 |
-
|
1133 |
-
|
1134 |
-
|
1135 |
-
|
1136 |
-
|
1137 |
-
|
1138 |
-
|
1139 |
-
|
1140 |
-
|
1141 |
-
|
1142 |
-
|
1143 |
-
|
1144 |
-
|
1145 |
-
|
1146 |
-
|
1147 |
-
|
1148 |
-
|
1149 |
-
|
1150 |
-
|
1151 |
-
|
1152 |
-
*/
|
1153 |
-
function lists($filters=array
|
1154 |
-
|
1155 |
$params = array();
|
1156 |
$params["filters"] = $filters;
|
1157 |
$params["start"] = $start;
|
@@ -1178,7 +1216,8 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
1178 |
* @returnf string tag The merge tag that's used for forms and listSubscribe() and listUpdateMember()
|
1179 |
* @returnf array choices For radio and dropdown field types, an array of the options available
|
1180 |
*/
|
1181 |
-
function listMergeVars($id)
|
|
|
1182 |
$params = array();
|
1183 |
$params["id"] = $id;
|
1184 |
return $this->callServer("listMergeVars", $params);
|
@@ -1194,17 +1233,16 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
1194 |
* @param string $tag The merge tag to add, e.g. FNAME
|
1195 |
* @param string $name The long description of the tag being added, used for user displays
|
1196 |
* @param array $options optional Various options for this merge var. <em>note:</em> for historical purposes this can also take a "boolean"
|
1197 |
-
|
1198 |
-
|
1199 |
-
|
1200 |
-
|
1201 |
-
|
1202 |
-
|
1203 |
-
|
1204 |
* @return bool true if the request succeeds, otherwise an error will be thrown
|
1205 |
*/
|
1206 |
-
function listMergeVarAdd($id, $tag, $name, $options=array
|
1207 |
-
|
1208 |
$params = array();
|
1209 |
$params["id"] = $id;
|
1210 |
$params["tag"] = $tag;
|
@@ -1223,7 +1261,8 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
1223 |
* @param array $options The options to change for a merge var. See listMergeVarAdd() for valid options
|
1224 |
* @return bool true if the request succeeds, otherwise an error will be thrown
|
1225 |
*/
|
1226 |
-
function listMergeVarUpdate($id, $tag, $options)
|
|
|
1227 |
$params = array();
|
1228 |
$params["id"] = $id;
|
1229 |
$params["tag"] = $tag;
|
@@ -1242,7 +1281,8 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
1242 |
* @param string $tag The merge tag to delete
|
1243 |
* @return bool true if the request succeeds, otherwise an error will be thrown
|
1244 |
*/
|
1245 |
-
function listMergeVarDel($id, $tag)
|
|
|
1246 |
$params = array();
|
1247 |
$params["id"] = $id;
|
1248 |
$params["tag"] = $tag;
|
@@ -1262,7 +1302,8 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
1262 |
* @returnf string form_field Gives the type of interest group: checkbox,radio,select
|
1263 |
* @returnf array groups Array of the grouping options including the "bit" value, "name", "display_order", and number of "subscribers" with the option selected.
|
1264 |
*/
|
1265 |
-
function listInterestGroupings($id)
|
|
|
1266 |
$params = array();
|
1267 |
$params["id"] = $id;
|
1268 |
return $this->callServer("listInterestGroupings", $params);
|
@@ -1279,7 +1320,8 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
1279 |
* @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.
|
1280 |
* @return bool true if the request succeeds, otherwise an error will be thrown
|
1281 |
*/
|
1282 |
-
function listInterestGroupAdd($id, $group_name, $grouping_id=NULL)
|
|
|
1283 |
$params = array();
|
1284 |
$params["id"] = $id;
|
1285 |
$params["group_name"] = $group_name;
|
@@ -1297,7 +1339,8 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
1297 |
* @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.
|
1298 |
* @return bool true if the request succeeds, otherwise an error will be thrown
|
1299 |
*/
|
1300 |
-
function listInterestGroupDel($id, $group_name, $grouping_id=NULL)
|
|
|
1301 |
$params = array();
|
1302 |
$params["id"] = $id;
|
1303 |
$params["group_name"] = $group_name;
|
@@ -1315,7 +1358,8 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
1315 |
* @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.
|
1316 |
* @return bool true if the request succeeds, otherwise an error will be thrown
|
1317 |
*/
|
1318 |
-
function listInterestGroupUpdate($id, $old_name, $new_name, $grouping_id=NULL)
|
|
|
1319 |
$params = array();
|
1320 |
$params["id"] = $id;
|
1321 |
$params["old_name"] = $old_name;
|
@@ -1336,7 +1380,8 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
1336 |
* @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.
|
1337 |
* @return int the new grouping id if the request succeeds, otherwise an error will be thrown
|
1338 |
*/
|
1339 |
-
function listInterestGroupingAdd($id, $name, $type, $groups)
|
|
|
1340 |
$params = array();
|
1341 |
$params["id"] = $id;
|
1342 |
$params["name"] = $name;
|
@@ -1355,7 +1400,8 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
1355 |
* @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.
|
1356 |
* @return bool true if the request succeeds, otherwise an error will be thrown
|
1357 |
*/
|
1358 |
-
function listInterestGroupingUpdate($grouping_id, $name, $value)
|
|
|
1359 |
$params = array();
|
1360 |
$params["grouping_id"] = $grouping_id;
|
1361 |
$params["name"] = $name;
|
@@ -1371,7 +1417,8 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
1371 |
* @param int $grouping_id the interest grouping id - get from listInterestGroupings()
|
1372 |
* @return bool true if the request succeeds, otherwise an error will be thrown
|
1373 |
*/
|
1374 |
-
function listInterestGroupingDel($grouping_id)
|
|
|
1375 |
$params = array();
|
1376 |
$params["grouping_id"] = $grouping_id;
|
1377 |
return $this->callServer("listInterestGroupingDel", $params);
|
@@ -1387,7 +1434,8 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
1387 |
* @returnf array actions the possible actions and whether they are enabled
|
1388 |
* @returnf array sources the possible sources and whether they are enabled
|
1389 |
*/
|
1390 |
-
function listWebhooks($id)
|
|
|
1391 |
$params = array();
|
1392 |
$params["id"] = $id;
|
1393 |
return $this->callServer("listWebhooks", $params);
|
@@ -1400,20 +1448,19 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
1400 |
* @param string $id the list id to connect to. Get by calling lists()
|
1401 |
* @param string $url a valid URL for the Webhook - it will be validated. note that a url may only exist on a list once.
|
1402 |
* @param array $actions optional a hash of actions to fire this Webhook for
|
1403 |
-
|
1404 |
-
|
1405 |
-
|
1406 |
-
|
1407 |
-
|
1408 |
* @param array $sources optional a hash of sources to fire this Webhook for
|
1409 |
-
|
1410 |
-
|
1411 |
-
|
1412 |
* @return bool true if the call succeeds, otherwise an exception will be thrown
|
1413 |
*/
|
1414 |
-
function listWebhookAdd($id, $url, $actions=array (
|
1415 |
-
|
1416 |
-
)) {
|
1417 |
$params = array();
|
1418 |
$params["id"] = $id;
|
1419 |
$params["url"] = $url;
|
@@ -1430,7 +1477,8 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
1430 |
* @param string $url the URL of a Webhook on this list
|
1431 |
* @return boolean true if the call succeeds, otherwise an exception will be thrown
|
1432 |
*/
|
1433 |
-
function listWebhookDel($id, $url)
|
|
|
1434 |
$params = array();
|
1435 |
$params["id"] = $id;
|
1436 |
$params["url"] = $url;
|
@@ -1450,7 +1498,8 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
1450 |
* @returnf date last_update the date/time the segment was last updated (add or del)
|
1451 |
* @returnf date last_reset the date/time the segment was last reset (ie had all members cleared from it)
|
1452 |
*/
|
1453 |
-
function listStaticSegments($id)
|
|
|
1454 |
$params = array();
|
1455 |
$params["id"] = $id;
|
1456 |
return $this->callServer("listStaticSegments", $params);
|
@@ -1467,7 +1516,8 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
1467 |
* @param string $name a unique name per list for the segment - 50 byte maximum length, anything longer will throw an error
|
1468 |
* @return int the id of the new segment, otherwise an error will be thrown.
|
1469 |
*/
|
1470 |
-
function listStaticSegmentAdd($id, $name)
|
|
|
1471 |
$params = array();
|
1472 |
$params["id"] = $id;
|
1473 |
$params["name"] = $name;
|
@@ -1482,7 +1532,8 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
1482 |
* @param int $seg_id the id of the static segment to reset - get from listStaticSegments()
|
1483 |
* @return bool true if it worked, otherwise an error is thrown.
|
1484 |
*/
|
1485 |
-
function listStaticSegmentReset($id, $seg_id)
|
|
|
1486 |
$params = array();
|
1487 |
$params["id"] = $id;
|
1488 |
$params["seg_id"] = $seg_id;
|
@@ -1497,7 +1548,8 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
1497 |
* @param int $seg_id the id of the static segment to delete - get from listStaticSegments()
|
1498 |
* @return bool true if it worked, otherwise an error is thrown.
|
1499 |
*/
|
1500 |
-
function listStaticSegmentDel($id, $seg_id)
|
|
|
1501 |
$params = array();
|
1502 |
$params["id"] = $id;
|
1503 |
$params["seg_id"] = $seg_id;
|
@@ -1516,7 +1568,8 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
1516 |
* @returnf int success the total number of successful updates (will include members already in the segment)
|
1517 |
* @returnf array errors the email address, an error code, and a message explaining why they couldn't be added
|
1518 |
*/
|
1519 |
-
function listStaticSegmentMembersAdd($id, $seg_id, $batch)
|
|
|
1520 |
$params = array();
|
1521 |
$params["id"] = $id;
|
1522 |
$params["seg_id"] = $seg_id;
|
@@ -1536,7 +1589,8 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
1536 |
* @returnf int success the total number of succesful removals
|
1537 |
* @returnf array errors the email address, an error code, and a message explaining why they couldn't be removed
|
1538 |
*/
|
1539 |
-
function listStaticSegmentMembersDel($id, $seg_id, $batch)
|
|
|
1540 |
$params = array();
|
1541 |
$params["id"] = $id;
|
1542 |
$params["seg_id"] = $seg_id;
|
@@ -1556,24 +1610,23 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
1556 |
* @param string $id the list id to connect to. Get by calling lists()
|
1557 |
* @param string $email_address the email address to subscribe
|
1558 |
* @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:
|
1559 |
-
|
1560 |
-
|
1561 |
-
|
1562 |
-
|
1563 |
-
|
1564 |
-
|
1565 |
-
|
1566 |
-
|
1567 |
-
|
1568 |
-
|
1569 |
-
|
1570 |
-
|
1571 |
-
|
1572 |
-
|
1573 |
-
|
1574 |
-
|
1575 |
-
|
1576 |
-
|
1577 |
* @param string $email_type optional email type preference for the email (html, text, or mobile defaults to html)
|
1578 |
* @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>
|
1579 |
* @param bool $update_existing optional flag to control whether a existing subscribers should be updated instead of throwing and error, defaults to false
|
@@ -1581,7 +1634,8 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
1581 |
* @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.
|
1582 |
* @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)
|
1583 |
*/
|
1584 |
-
function listSubscribe($id, $email_address, $merge_vars=NULL, $email_type='html', $double_optin=true, $update_existing=false, $replace_interests=true, $send_welcome=false)
|
|
|
1585 |
$params = array();
|
1586 |
$params["id"] = $id;
|
1587 |
$params["email_address"] = $email_address;
|
@@ -1608,7 +1662,8 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
1608 |
* @param boolean $send_notify flag to send the unsubscribe notification email to the address defined in the list email notification settings, defaults to true
|
1609 |
* @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)
|
1610 |
*/
|
1611 |
-
function listUnsubscribe($id, $email_address, $delete_member=false, $send_goodbye=true, $send_notify=true)
|
|
|
1612 |
$params = array();
|
1613 |
$params["id"] = $id;
|
1614 |
$params["email_address"] = $email_address;
|
@@ -1632,7 +1687,8 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
1632 |
* @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)
|
1633 |
* @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
|
1634 |
*/
|
1635 |
-
function listUpdateMember($id, $email_address, $merge_vars, $email_type='', $replace_interests=true)
|
|
|
1636 |
$params = array();
|
1637 |
$params["id"] = $id;
|
1638 |
$params["email_address"] = $email_address;
|
@@ -1662,11 +1718,12 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
1662 |
* @returnf int update_count Number of email addresses that were succesfully updated
|
1663 |
* @returnf int error_count Number of email addresses that failed during addition/updating
|
1664 |
* @returnf array errors Array of error arrays, each containing:
|
1665 |
-
|
1666 |
-
|
1667 |
-
|
1668 |
*/
|
1669 |
-
function listBatchSubscribe($id, $batch, $double_optin=true, $update_existing=false, $replace_interests=true)
|
|
|
1670 |
$params = array();
|
1671 |
$params["id"] = $id;
|
1672 |
$params["batch"] = $batch;
|
@@ -1692,7 +1749,8 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
1692 |
* @returnf int error_count Number of email addresses that failed during addition/updating
|
1693 |
* @returnf array errors Array of error structs. Each error struct will contain "code", "message", and "email"
|
1694 |
*/
|
1695 |
-
function listBatchUnsubscribe($id, $emails, $delete_member=false, $send_goodbye=true, $send_notify=false)
|
|
|
1696 |
$params = array();
|
1697 |
$params["id"] = $id;
|
1698 |
$params["emails"] = $emails;
|
@@ -1717,12 +1775,13 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
1717 |
* @return array Array of a the total records match and matching list member data for this page (see Returned Fields for details)
|
1718 |
* @returnf int total the total matching records
|
1719 |
* @returnf array data the data for each member, including:
|
1720 |
-
|
1721 |
-
|
1722 |
-
|
1723 |
-
|
1724 |
*/
|
1725 |
-
function listMembers($id, $status='subscribed', $since=NULL, $start=0, $limit=100)
|
|
|
1726 |
$params = array();
|
1727 |
$params["id"] = $id;
|
1728 |
$params["status"] = $status;
|
@@ -1745,23 +1804,24 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
1745 |
* @returnf int success the number of subscribers successfully found on the list
|
1746 |
* @returnf int errors the number of subscribers who were not found on the list
|
1747 |
* @returnf array data an array of arrays where each one has member info:
|
1748 |
-
|
1749 |
-
|
1750 |
-
|
1751 |
-
|
1752 |
-
|
1753 |
-
|
1754 |
-
|
1755 |
-
|
1756 |
-
|
1757 |
-
|
1758 |
-
|
1759 |
-
|
1760 |
-
|
1761 |
-
|
1762 |
-
|
1763 |
-
*/
|
1764 |
-
function listMemberInfo($id, $email_address)
|
|
|
1765 |
$params = array();
|
1766 |
$params["id"] = $id;
|
1767 |
$params["email_address"] = $email_address;
|
@@ -1781,13 +1841,14 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
1781 |
* @returnf int success the number of subscribers successfully found on the list
|
1782 |
* @returnf int errors the number of subscribers who were not found on the list
|
1783 |
* @returnf array data an array of arrays where each activity record has:
|
1784 |
-
|
1785 |
-
|
1786 |
-
|
1787 |
-
|
1788 |
-
|
1789 |
*/
|
1790 |
-
function listMemberActivity($id, $email_address)
|
|
|
1791 |
$params = array();
|
1792 |
$params["id"] = $id;
|
1793 |
$params["email_address"] = $email_address;
|
@@ -1808,12 +1869,13 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
1808 |
* @return array the total of all reports and the specific reports reports this page
|
1809 |
* @returnf int total the total number of matching abuse reports
|
1810 |
* @returnf array data the actual data for each reports, including:
|
1811 |
-
|
1812 |
-
|
1813 |
-
|
1814 |
-
|
1815 |
*/
|
1816 |
-
function listAbuseReports($id, $start=0, $limit=500, $since=NULL)
|
|
|
1817 |
$params = array();
|
1818 |
$params["id"] = $id;
|
1819 |
$params["start"] = $start;
|
@@ -1836,7 +1898,8 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
1836 |
* @returnf int imports number of subscribers imported during the month
|
1837 |
* @returnf int optins number of subscribers who opted-in during the month
|
1838 |
*/
|
1839 |
-
function listGrowthHistory($id)
|
|
|
1840 |
$params = array();
|
1841 |
$params["id"] = $id;
|
1842 |
return $this->callServer("listGrowthHistory", $params);
|
@@ -1862,7 +1925,8 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
1862 |
* @returnf int other_adds number of non-double optin subscribes for the list (manual, API, or import)
|
1863 |
* @returnf int other_removes number of non-manual unsubscribes for the list (deletions, empties, soft-bounce removals)
|
1864 |
*/
|
1865 |
-
function listActivity($id)
|
|
|
1866 |
$params = array();
|
1867 |
$params["id"] = $id;
|
1868 |
return $this->callServer("listActivity", $params);
|
@@ -1880,7 +1944,8 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
1880 |
* @returnf double percent the percent of subscribers in the country
|
1881 |
* @returnf double total the total number of subscribers in the country
|
1882 |
*/
|
1883 |
-
function listLocations($id)
|
|
|
1884 |
$params = array();
|
1885 |
$params["id"] = $id;
|
1886 |
return $this->callServer("listLocations", $params);
|
@@ -1894,13 +1959,14 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
1894 |
* @param string $id the list id to connect to. Get by calling lists()
|
1895 |
* @return array the desktop and mobile user agents in use on the list
|
1896 |
* @returnf array desktop desktop user agents and percentages
|
1897 |
-
|
1898 |
-
|
1899 |
* @returnf array mobile mobile user agents and percentages
|
1900 |
-
|
1901 |
-
|
1902 |
*/
|
1903 |
-
function listClients($id)
|
|
|
1904 |
$params = array();
|
1905 |
$params["id"] = $id;
|
1906 |
return $this->callServer("listClients", $params);
|
@@ -1914,13 +1980,13 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
1914 |
* @example xml-rpc_templates.php
|
1915 |
*
|
1916 |
* @param array $types optional the types of templates to return
|
1917 |
-
|
1918 |
-
|
1919 |
-
|
1920 |
* @param string $category optional for Gallery templates only, limit to a specific template category
|
1921 |
* @param array $inactives optional options to control how inactive templates are returned, if at all
|
1922 |
-
|
1923 |
-
|
1924 |
* @return array An array of structs, one for each template (see Returned Fields for details)
|
1925 |
* @returnf int id Id of the template
|
1926 |
* @returnf string name Name of the template
|
@@ -1929,9 +1995,8 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
1929 |
* @returnf string date_created The date/time the template was created
|
1930 |
* @returnf bool edit_source Whether or not you are able to edit the source of a template.
|
1931 |
*/
|
1932 |
-
function templates($types=array (
|
1933 |
-
|
1934 |
-
)) {
|
1935 |
$params = array();
|
1936 |
$params["types"] = $types;
|
1937 |
$params["category"] = $category;
|
@@ -1952,7 +2017,8 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
1952 |
* @returnf string source the full source of the template as if you exported it via our template editor
|
1953 |
* @returnf string preview similar to the source, but the rendered version of the source from our popup preview
|
1954 |
*/
|
1955 |
-
function templateInfo($tid, $type='user')
|
|
|
1956 |
$params = array();
|
1957 |
$params["tid"] = $tid;
|
1958 |
$params["type"] = $type;
|
@@ -1970,7 +2036,8 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
1970 |
* @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>.
|
1971 |
* @return int the new template id, otherwise an error is thrown.
|
1972 |
*/
|
1973 |
-
function templateAdd($name, $html)
|
|
|
1974 |
$params = array();
|
1975 |
$params["name"] = $name;
|
1976 |
$params["html"] = $html;
|
@@ -1983,13 +2050,13 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
1983 |
* @section Template Related
|
1984 |
*
|
1985 |
* @param int $id the id of the user template to update
|
1986 |
-
* @param array
|
1987 |
-
|
1988 |
-
|
1989 |
-
|
1990 |
* @return boolean true if the template was updated, otherwise an error will be thrown
|
1991 |
*/
|
1992 |
-
function templateUpdate($id, $values)
|
|
|
1993 |
$params = array();
|
1994 |
$params["id"] = $id;
|
1995 |
$params["values"] = $values;
|
@@ -2004,7 +2071,8 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
2004 |
* @param int $id the id of the user template to delete
|
2005 |
* @return boolean true if the template was deleted, otherwise an error will be thrown
|
2006 |
*/
|
2007 |
-
function templateDel($id)
|
|
|
2008 |
$params = array();
|
2009 |
$params["id"] = $id;
|
2010 |
return $this->callServer("templateDel", $params);
|
@@ -2018,7 +2086,8 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
2018 |
* @param int $id the id of the user template to reactivate
|
2019 |
* @return boolean true if the template was deleted, otherwise an error will be thrown
|
2020 |
*/
|
2021 |
-
function templateUndel($id)
|
|
|
2022 |
$params = array();
|
2023 |
$params["id"] = $id;
|
2024 |
return $this->callServer("templateUndel", $params);
|
@@ -2047,38 +2116,39 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
2047 |
* @returnf string last_login date/time of last login via the web
|
2048 |
* @returnf string affiliate_link Monkey Rewards link for our Affiliate program
|
2049 |
* @returnf array contact Contact details for the account
|
2050 |
-
|
2051 |
-
|
2052 |
-
|
2053 |
-
|
2054 |
-
|
2055 |
-
|
2056 |
-
|
2057 |
-
|
2058 |
-
|
2059 |
-
|
2060 |
-
|
2061 |
-
|
2062 |
-
|
2063 |
* @returnf array modules Addons installed in the account
|
2064 |
-
|
2065 |
-
|
2066 |
* @returnf array orders Order details for the account
|
2067 |
-
|
2068 |
-
|
2069 |
-
|
2070 |
-
|
2071 |
-
|
2072 |
* @returnf array rewards Rewards details for the account including credits & inspections earned, number of referals, referal details, and rewards used
|
2073 |
-
|
2074 |
-
|
2075 |
-
|
2076 |
-
|
2077 |
-
|
2078 |
-
|
2079 |
-
|
2080 |
*/
|
2081 |
-
function getAccountDetails()
|
|
|
2082 |
$params = array();
|
2083 |
return $this->callServer("getAccountDetails", $params);
|
2084 |
}
|
@@ -2093,7 +2163,8 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
2093 |
* @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.
|
2094 |
* @return string the content pass in converted to text.
|
2095 |
*/
|
2096 |
-
function generateText($type, $content)
|
|
|
2097 |
$params = array();
|
2098 |
$params["type"] = $type;
|
2099 |
$params["content"] = $content;
|
@@ -2110,7 +2181,8 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
2110 |
* @param bool $strip_css optional Whether you want the CSS <style> tags stripped from the returned document. Defaults to false.
|
2111 |
* @return string Your HTML content with all CSS inlined, just like if we sent it.
|
2112 |
*/
|
2113 |
-
function inlineCss($html, $strip_css=false)
|
|
|
2114 |
$params = array();
|
2115 |
$params["html"] = $html;
|
2116 |
$params["strip_css"] = $strip_css;
|
@@ -2131,7 +2203,8 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
2131 |
* @returnf string date_created The date/time the folder was created
|
2132 |
* @returnf string type The type of the folders being returned, just to make sure you know.
|
2133 |
*/
|
2134 |
-
function folders($type='campaign')
|
|
|
2135 |
$params = array();
|
2136 |
$params["type"] = $type;
|
2137 |
return $this->callServer("folders", $params);
|
@@ -2148,7 +2221,8 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
2148 |
* @param string $type optional the type of folder to create - either "campaign" or "autoresponder". Defaults to "campaign"
|
2149 |
* @return int the folder_id of the newly created folder.
|
2150 |
*/
|
2151 |
-
function folderAdd($name, $type='campaign')
|
|
|
2152 |
$params = array();
|
2153 |
$params["name"] = $name;
|
2154 |
$params["type"] = $type;
|
@@ -2165,7 +2239,8 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
2165 |
* @param string $type optional the type of folder to create - either "campaign" or "autoresponder". Defaults to "campaign"
|
2166 |
* @return bool true if the update worked, otherwise an exception is thrown
|
2167 |
*/
|
2168 |
-
function folderUpdate($fid, $name, $type='campaign')
|
|
|
2169 |
$params = array();
|
2170 |
$params["fid"] = $fid;
|
2171 |
$params["name"] = $name;
|
@@ -2182,7 +2257,8 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
2182 |
* @param string $type optional the type of folder to create - either "campaign" or "autoresponder". Defaults to "campaign"
|
2183 |
* @return bool true if the delete worked, otherwise an exception is thrown
|
2184 |
*/
|
2185 |
-
function folderDel($fid, $type='campaign')
|
|
|
2186 |
$params = array();
|
2187 |
$params["fid"] = $fid;
|
2188 |
$params["type"] = $type;
|
@@ -2200,17 +2276,18 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
2200 |
* @return array the total matching orders and the specific orders for the requested page
|
2201 |
* @returnf int total the total matching orders
|
2202 |
* @returnf array data the actual data for each order being returned
|
2203 |
-
|
2204 |
-
|
2205 |
-
|
2206 |
-
|
2207 |
-
|
2208 |
-
|
2209 |
-
|
2210 |
-
|
2211 |
-
|
2212 |
-
*/
|
2213 |
-
function ecommOrders($start=0, $limit=100, $since=NULL)
|
|
|
2214 |
$params = array();
|
2215 |
$params["start"] = $start;
|
2216 |
$params["limit"] = $limit;
|
@@ -2224,30 +2301,31 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
2224 |
* @section Ecommerce
|
2225 |
*
|
2226 |
* @param array $order an array of information pertaining to the order that has completed. Use the following keys:
|
2227 |
-
|
2228 |
-
|
2229 |
-
|
2230 |
-
|
2231 |
-
|
2232 |
-
|
2233 |
-
|
2234 |
-
|
2235 |
-
|
2236 |
-
|
2237 |
-
|
2238 |
-
|
2239 |
-
|
2240 |
-
|
2241 |
-
|
2242 |
-
|
2243 |
-
|
2244 |
-
|
2245 |
-
|
2246 |
-
|
2247 |
-
|
2248 |
* @return bool true if the data is saved, otherwise an error is thrown.
|
2249 |
*/
|
2250 |
-
function ecommOrderAdd($order)
|
|
|
2251 |
$params = array();
|
2252 |
$params["order"] = $order;
|
2253 |
return $this->callServer("ecommOrderAdd", $params);
|
@@ -2262,7 +2340,8 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
2262 |
* @param string $order_id the order id (generated by the store) to delete
|
2263 |
* @return bool true if an order is deleted, otherwise an error is thrown.
|
2264 |
*/
|
2265 |
-
function ecommOrderDel($store_id, $order_id)
|
|
|
2266 |
$params = array();
|
2267 |
$params["store_id"] = $store_id;
|
2268 |
$params["order_id"] = $order_id;
|
@@ -2277,7 +2356,8 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
2277 |
* @param string $email_address the email address to check OR the email "id" returned from listMemberInfo, Webhooks, and Campaigns
|
2278 |
* @return array An array of list_ids the member is subscribed to.
|
2279 |
*/
|
2280 |
-
function listsForEmail($email_address)
|
|
|
2281 |
$params = array();
|
2282 |
$params["email_address"] = $email_address;
|
2283 |
return $this->callServer("listsForEmail", $params);
|
@@ -2291,7 +2371,8 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
2291 |
* @param string $email_address the email address to unsubscribe OR the email "id" returned from listMemberInfo, Webhooks, and Campaigns
|
2292 |
* @return array An array of campaign_ids the member received
|
2293 |
*/
|
2294 |
-
function campaignsForEmail($email_address)
|
|
|
2295 |
$params = array();
|
2296 |
$params["email_address"] = $email_address;
|
2297 |
return $this->callServer("campaignsForEmail", $params);
|
@@ -2310,7 +2391,8 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
2310 |
* @returnf string campaign_id the list_id a message relates to, if applicable
|
2311 |
* @returnf string update_time The date/time the message was last updated
|
2312 |
*/
|
2313 |
-
function chimpChatter()
|
|
|
2314 |
$params = array();
|
2315 |
return $this->callServer("chimpChatter", $params);
|
2316 |
}
|
@@ -2330,7 +2412,8 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
2330 |
* @returnf string created_at The date the key was created
|
2331 |
* @returnf string expired_at The date the key was expired
|
2332 |
*/
|
2333 |
-
function apikeys($username, $password, $expired=false)
|
|
|
2334 |
$params = array();
|
2335 |
$params["username"] = $username;
|
2336 |
$params["password"] = $password;
|
@@ -2348,7 +2431,8 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
2348 |
* @param string $password Your MailChimp password
|
2349 |
* @return string a new API Key that can be immediately used.
|
2350 |
*/
|
2351 |
-
function apikeyAdd($username, $password)
|
|
|
2352 |
$params = array();
|
2353 |
$params["username"] = $username;
|
2354 |
$params["password"] = $password;
|
@@ -2369,7 +2453,8 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
2369 |
* @param string $password Your MailChimp password
|
2370 |
* @return boolean true if it worked, otherwise an error is thrown.
|
2371 |
*/
|
2372 |
-
function apikeyExpire($username, $password)
|
|
|
2373 |
$params = array();
|
2374 |
$params["username"] = $username;
|
2375 |
$params["password"] = $password;
|
@@ -2386,7 +2471,8 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
2386 |
*
|
2387 |
* @return string returns "Everything's Chimpy!" if everything is chimpy, otherwise returns an error message
|
2388 |
*/
|
2389 |
-
function ping()
|
|
|
2390 |
$params = array();
|
2391 |
return $this->callServer("ping", $params);
|
2392 |
}
|
@@ -2396,7 +2482,8 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
2396 |
* @param mixed Method to call, with any parameters to pass along
|
2397 |
* @return mixed the result of the call
|
2398 |
*/
|
2399 |
-
function callMethod()
|
|
|
2400 |
$params = array();
|
2401 |
return $this->callServer("callMethod", $params);
|
2402 |
}
|
@@ -2405,47 +2492,48 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
2405 |
* Actually connect to the server and call the requested methods, parsing the result
|
2406 |
* You should never have to call this function manually
|
2407 |
*/
|
2408 |
-
function callServer($method, $params)
|
|
|
2409 |
|
2410 |
-
|
2411 |
|
2412 |
-
|
2413 |
-
|
2414 |
-
|
2415 |
if (!$dc) $dc = "us1";
|
2416 |
}
|
2417 |
-
$host = $dc."."
|
2418 |
-
|
2419 |
|
2420 |
$this->errorMessage = "";
|
2421 |
$this->errorCode = "";
|
2422 |
$sep_changed = false;
|
2423 |
//sigh, apparently some distribs change this to & by default
|
2424 |
-
if (ini_get("arg_separator.output")!="&"){
|
2425 |
$sep_changed = true;
|
2426 |
$orig_sep = ini_get("arg_separator.output");
|
2427 |
ini_set("arg_separator.output", "&");
|
2428 |
}
|
2429 |
$post_vars = http_build_query($params);
|
2430 |
-
if ($sep_changed){
|
2431 |
ini_set("arg_separator.output", $orig_sep);
|
2432 |
}
|
2433 |
$payload = "POST " . $this->apiUrl["path"] . "?" . $this->apiUrl["query"] . "&method=" . $method . " HTTP/1.0\r\n";
|
2434 |
$payload .= "Host: " . $host . "\r\n";
|
2435 |
//$payload .= "User-Agent: MCAPI/" . $this->version ."\r\n";
|
2436 |
-
$payload .= "User-Agent: " . Mage::helper('monkey')->getUserAgent() ."\r\n";
|
2437 |
$payload .= "Content-type: application/x-www-form-urlencoded\r\n";
|
2438 |
$payload .= "Content-length: " . strlen($post_vars) . "\r\n";
|
2439 |
$payload .= "Connection: close \r\n\r\n";
|
2440 |
$payload .= $post_vars;
|
2441 |
|
2442 |
ob_start();
|
2443 |
-
if ($this->secure){
|
2444 |
-
$sock = fsockopen("ssl://"
|
2445 |
} else {
|
2446 |
$sock = fsockopen($host, 80, $errno, $errstr, 30);
|
2447 |
}
|
2448 |
-
if(!$sock) {
|
2449 |
$this->errorMessage = "Could not connect (ERR $errno: $errstr)";
|
2450 |
$this->errorCode = "-99";
|
2451 |
ob_end_clean();
|
@@ -2472,27 +2560,27 @@ class Ebizmarts_MageMonkey_Model_MCAPI
|
|
2472 |
$headers = explode("\r\n", $headers);
|
2473 |
|
2474 |
$errored = false;
|
2475 |
-
foreach($headers as $h){
|
2476 |
-
if (substr($h,0,26)==="X-MailChimp-API-Error-Code"){
|
2477 |
$errored = true;
|
2478 |
-
$error_code = trim(substr($h,27));
|
2479 |
break;
|
2480 |
}
|
2481 |
}
|
2482 |
|
2483 |
-
if(ini_get("magic_quotes_runtime")) $response = stripslashes($response);
|
2484 |
|
2485 |
$serial = unserialize($response);
|
2486 |
-
if($response && $serial === false) {
|
2487 |
-
|
2488 |
} else {
|
2489 |
-
|
2490 |
}
|
2491 |
-
if($errored && is_array($response) && isset($response["error"])) {
|
2492 |
$this->errorMessage = $response["error"];
|
2493 |
$this->errorCode = $response["code"];
|
2494 |
return false;
|
2495 |
-
} elseif($errored){
|
2496 |
$this->errorMessage = "No error message was found";
|
2497 |
$this->errorCode = $error_code;
|
2498 |
return false;
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_MageMonkey_Model_MCAPI
|
12 |
{
|
13 |
var $version = "1.3";
|
52 |
* @param string $apikey Your MailChimp apikey
|
53 |
* @param string $secure Whether or not this should use a secure connection
|
54 |
*/
|
55 |
+
function __construct($apikey, $secure = false)
|
56 |
+
{
|
57 |
$this->secure = $secure;
|
58 |
$this->apiUrl = parse_url("http://api.mailchimp.com/" . $this->version . "/?output=php");
|
59 |
$this->api_key = $apikey;
|
60 |
}
|
61 |
+
|
62 |
+
function setTimeout($seconds)
|
63 |
+
{
|
64 |
+
if (is_int($seconds)) {
|
65 |
$this->timeout = $seconds;
|
66 |
return true;
|
67 |
}
|
68 |
}
|
69 |
+
|
70 |
+
function getTimeout()
|
71 |
+
{
|
72 |
return $this->timeout;
|
73 |
}
|
74 |
+
|
75 |
+
function useSecure($val)
|
76 |
+
{
|
77 |
+
if ($val === true) {
|
78 |
$this->secure = true;
|
79 |
} else {
|
80 |
$this->secure = false;
|
91 |
* @param string $cid the id of the campaign to unschedule
|
92 |
* @return boolean true on success
|
93 |
*/
|
94 |
+
function campaignUnschedule($cid)
|
95 |
+
{
|
96 |
$params = array();
|
97 |
$params["cid"] = $cid;
|
98 |
return $this->callServer("campaignUnschedule", $params);
|
110 |
* @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>
|
111 |
* @return boolean true on success
|
112 |
*/
|
113 |
+
function campaignSchedule($cid, $schedule_time, $schedule_time_b = NULL)
|
114 |
+
{
|
115 |
$params = array();
|
116 |
$params["cid"] = $cid;
|
117 |
$params["schedule_time"] = $schedule_time;
|
127 |
* @param string $cid the id of the campaign to pause
|
128 |
* @return boolean true on success
|
129 |
*/
|
130 |
+
function campaignResume($cid)
|
131 |
+
{
|
132 |
$params = array();
|
133 |
$params["cid"] = $cid;
|
134 |
return $this->callServer("campaignResume", $params);
|
142 |
* @param string $cid the id of the campaign to pause
|
143 |
* @return boolean true on success
|
144 |
*/
|
145 |
+
function campaignPause($cid)
|
146 |
+
{
|
147 |
$params = array();
|
148 |
$params["cid"] = $cid;
|
149 |
return $this->callServer("campaignPause", $params);
|
160 |
* @param string $cid the id of the campaign to send
|
161 |
* @return boolean true on success
|
162 |
*/
|
163 |
+
function campaignSendNow($cid)
|
164 |
+
{
|
165 |
$params = array();
|
166 |
$params["cid"] = $cid;
|
167 |
return $this->callServer("campaignSendNow", $params);
|
180 |
* @param string $send_type optional by default (null) both formats are sent - "html" or "text" send just that format
|
181 |
* @return boolean true on success
|
182 |
*/
|
183 |
+
function campaignSendTest($cid, $test_emails = array(), $send_type = NULL)
|
184 |
+
{
|
185 |
$params = array();
|
186 |
$params["cid"] = $cid;
|
187 |
$params["test_emails"] = $test_emails;
|
198 |
*
|
199 |
* @param string $list_id the list to test segmentation on - get lists using lists()
|
200 |
* @param array $options with 2 keys:
|
201 |
+
* 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)
|
202 |
+
* 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:
|
203 |
+
*
|
204 |
+
* Field = "<strong>date</strong>" : Select based on signup date
|
205 |
+
* Valid Op(eration): <strong>eq</strong> (is) / <strong>gt</strong> (after) / <strong>lt</strong> (before)
|
206 |
+
* Valid Values:
|
207 |
+
* string last_campaign_sent uses the date of the last campaign sent
|
208 |
+
* string campaign_id - uses the send date of the campaign that carriers the Id submitted - see campaigns()
|
209 |
+
* 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
|
210 |
+
*
|
211 |
+
* Field = "<strong>interests-X</strong>": where X is the Grouping Id from listInterestGroupings()
|
212 |
+
* Valid Op(erations): <strong>one</strong> / <strong>none</strong> / <strong>all</strong>
|
213 |
+
* Valid Values: a comma delimited of interest groups for the list - see listInterestGroupings()
|
214 |
+
*
|
215 |
+
* Field = "<strong>aim</strong>"
|
216 |
+
* Valid Op(erations): <strong>open</strong> / <strong>noopen</strong> / <strong>click</strong> / <strong>noclick</strong>
|
217 |
+
* Valid Values: "<strong>any</strong>" or a valid AIM-enabled Campaign that has been sent
|
218 |
+
*
|
219 |
+
* Field = "<strong>rating</strong>" : allows matching based on list member ratings
|
220 |
+
* Valid Op(erations): <strong>eq</strong> (=) / <strong>ne</strong> (!=) / <strong>gt</strong> (>) / <strong>lt</strong> (<)
|
221 |
+
* Valid Values: a number between 0 and 5
|
222 |
+
*
|
223 |
+
* Field = "<strong>ecomm_prod</strong>" or "<strong>ecomm_prod</strong>": allows matching product and category names from purchases
|
224 |
+
* Valid Op(erations):
|
225 |
+
* <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')
|
226 |
+
* Valid Values: any string
|
227 |
+
*
|
228 |
+
* Field = "<strong>ecomm_spent_one</strong>" or "<strong>ecomm_spent_all</strong>" : allows matching purchase amounts on a single order or all orders
|
229 |
+
* Valid Op(erations): <strong>gt</strong> (>) / <strong>lt</strong> (<)
|
230 |
+
* Valid Values: a number
|
231 |
+
*
|
232 |
+
* Field = "<strong>ecomm_date</strong>" : allow matching based on order dates
|
233 |
+
* Valid Op(eration): <strong>eq</strong> (is) / <strong>gt</strong> (after) / <strong>lt</strong> (before)
|
234 |
+
* Valid Values:
|
235 |
+
* string YYYY-MM-DD - any date in the form of YYYY-MM-DD
|
236 |
+
*
|
237 |
+
* Field = "<strong>social_gender</strong>" : allows matching against the gender acquired from SocialPro
|
238 |
+
* Valid Op(eration): <strong>eq</strong> (is) / <strong>ne</strong> (is not)
|
239 |
+
* Valid Values: male, female
|
240 |
+
*
|
241 |
+
* Field = "<strong>social_age</strong>" : allows matching against the age acquired from SocialPro
|
242 |
+
* Valid Op(erations): <strong>eq</strong> (=) / <strong>ne</strong> (!=) / <strong>gt</strong> (>) / <strong>lt</strong> (<)
|
243 |
+
* Valid Values: any number
|
244 |
+
*
|
245 |
+
* Field = "<strong>social_influence</strong>" : allows matching against the influence acquired from SocialPro
|
246 |
+
* Valid Op(erations): <strong>eq</strong> (=) / <strong>ne</strong> (!=) / <strong>gt</strong> (>) / <strong>lt</strong> (<)
|
247 |
+
* Valid Values: a number between 0 and 5
|
248 |
+
*
|
249 |
+
* Field = "<strong>social_network</strong>" :
|
250 |
+
* Valid Op(erations): <strong>member</strong> (is a member of) / <strong>notmember</strong> (is not a member of)
|
251 |
+
* Valid Values: twitter, facebook, myspace, linkedin, flickr
|
252 |
+
*
|
253 |
+
* Field = "<strong>static_segment</strong>" :
|
254 |
+
* Valid Op(eration): <strong>eq</strong> (is in) / <strong>ne</strong> (is not in)
|
255 |
+
* Valid Values: an int - get from listStaticSegments()
|
256 |
+
*
|
257 |
+
* 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.
|
258 |
+
* Valid Op(erations): <strong>geoin</strong>
|
259 |
+
* Valid Values: The number of miles an address should be within
|
260 |
+
* Extra Value: The Zip Code to be used as the center point
|
261 |
+
*
|
262 |
+
* 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()
|
263 |
+
* Valid Op(erations):
|
264 |
+
* <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')
|
265 |
+
* Valid Values: any string
|
266 |
* @return int total The total number of subscribers matching your segmentation options
|
267 |
*/
|
268 |
+
function campaignSegmentTest($list_id, $options)
|
269 |
+
{
|
270 |
$params = array();
|
271 |
$params["list_id"] = $list_id;
|
272 |
$params["options"] = $options;
|
284 |
*
|
285 |
* @param string $type the Campaign Type to create - one of "regular", "plaintext", "absplit", "rss", "trans", "auto"
|
286 |
* @param array $options a hash of the standard options for this campaign :
|
287 |
+
* string list_id the list to send this campaign to- get lists using lists()
|
288 |
+
* string subject the subject line for your campaign message
|
289 |
+
* string from_email the From: email address for your campaign message
|
290 |
+
* string from_name the From: name for your campaign message (not an email address)
|
291 |
+
* string to_name the To: name recipients will see (not email address)
|
292 |
+
* int template_id optional - use this user-created template to generate the HTML content of the campaign (takes precendence over other template options)
|
293 |
+
* 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)
|
294 |
+
* int base_template_id optional - use this a base/start-from-scratch template to generate the HTML content of the campaign
|
295 |
+
* 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
|
296 |
+
* 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.
|
297 |
+
* string title optional - an internal name to use for this campaign. By default, the campaign subject will be used.
|
298 |
+
* boolean authenticate optional - set to true to enable SenderID, DomainKeys, and DKIM authentication, defaults to false.
|
299 |
+
* 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
|
300 |
+
* boolean auto_footer optional Whether or not we should auto-generate the footer for your content. Mostly useful for content from URLs or Imports
|
301 |
+
* boolean inline_css optional Whether or not css should be automatically inlined when this campaign is sent, defaults to false.
|
302 |
+
* 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.
|
303 |
+
* 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.
|
304 |
+
* 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.
|
305 |
+
* 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
|
306 |
+
* @param array $content the content for this campaign - use a struct with the following keys:
|
307 |
+
* string html for pasted HTML content
|
308 |
+
* string text for the plain-text version
|
309 |
+
* 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
|
310 |
+
* 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
|
311 |
+
* 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
|
312 |
+
*
|
313 |
+
* 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"
|
314 |
+
* @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.
|
315 |
+
* @param array $type_opts optional -
|
316 |
+
* For RSS Campaigns this, array should contain:
|
317 |
+
* string url the URL to pull RSS content from - it will be verified and must exist
|
318 |
+
* string schedule optional one of "daily", "weekly", "monthly" - defaults to "daily"
|
319 |
+
* string schedule_hour optional an hour between 0 and 24 - default to 4 (4am <em>local time</em>) - applies to all schedule types
|
320 |
+
* 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)
|
321 |
+
* 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
|
322 |
+
*
|
323 |
+
* For A/B Split campaigns, this array should contain:
|
324 |
+
* 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!
|
325 |
+
* 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)
|
326 |
+
* 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.
|
327 |
+
* 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.
|
328 |
+
* 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%
|
329 |
+
* string from_name_a optional sort of, required when split_test is "from_name"
|
330 |
+
* string from_name_b optional sort of, required when split_test is "from_name"
|
331 |
+
* string from_email_a optional sort of, required when split_test is "from_name"
|
332 |
+
* string from_email_b optional sort of, required when split_test is "from_name"
|
333 |
+
* string subject_a optional sort of, required when split_test is "subject"
|
334 |
+
* string subject_b optional sort of, required when split_test is "subject"
|
335 |
+
*
|
336 |
+
* For AutoResponder campaigns, this array should contain:
|
337 |
+
* string offset-units one of "day", "week", "month", "year" - required
|
338 |
+
* string offset-time optional, sort of - the number of units must be a number greater than 0 for signup based autoresponders
|
339 |
+
* string offset-dir either "before" or "after"
|
340 |
+
* string event optional "signup" (default) to base this on double-optin signup, "date" or "annual" to base this on merge field in the list
|
341 |
+
* string event-datemerge optional sort of, this is required if the event is "date" or "annual"
|
|
|
|
|
342 |
*
|
343 |
* @return string the ID for the created campaign
|
344 |
*/
|
345 |
+
function campaignCreate($type, $options, $content, $segment_opts = NULL, $type_opts = NULL)
|
346 |
+
{
|
347 |
$params = array();
|
348 |
$params["type"] = $type;
|
349 |
$params["options"] = $options;
|
369 |
*
|
370 |
* @param string $cid the Campaign Id to update
|
371 |
* @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.
|
372 |
+
* @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.
|
373 |
* @return boolean true if the update succeeds, otherwise an error will be thrown
|
374 |
*/
|
375 |
+
function campaignUpdate($cid, $name, $value)
|
376 |
+
{
|
377 |
$params = array();
|
378 |
$params["cid"] = $cid;
|
379 |
$params["name"] = $name;
|
382 |
}
|
383 |
|
384 |
/** Replicate a campaign.
|
385 |
+
*
|
386 |
+
* @section Campaign Related
|
387 |
+
*
|
388 |
+
* @example mcapi_campaignReplicate.php
|
389 |
+
*
|
390 |
+
* @param string $cid the Campaign Id to replicate
|
391 |
+
* @return string the id of the replicated Campaign created, otherwise an error will be thrown
|
392 |
+
*/
|
393 |
+
function campaignReplicate($cid)
|
394 |
+
{
|
395 |
$params = array();
|
396 |
$params["cid"] = $cid;
|
397 |
return $this->callServer("campaignReplicate", $params);
|
398 |
}
|
399 |
|
400 |
/** Delete a campaign. Seriously, "poof, gone!" - be careful!
|
401 |
+
*
|
402 |
+
* @section Campaign Related
|
403 |
+
*
|
404 |
+
* @example mcapi_campaignDelete.php
|
405 |
+
*
|
406 |
+
* @param string $cid the Campaign Id to delete
|
407 |
+
* @return boolean true if the delete succeeds, otherwise an error will be thrown
|
408 |
+
*/
|
409 |
+
function campaignDelete($cid)
|
410 |
+
{
|
411 |
$params = array();
|
412 |
$params["cid"] = $cid;
|
413 |
return $this->callServer("campaignDelete", $params);
|
421 |
* @example xml-rpc_campaigns.php
|
422 |
*
|
423 |
* @param array $filters a hash of filters to apply to this query - all are optional:
|
424 |
+
* string campaign_id optional - return a single campaign using a know campaign_id
|
425 |
+
* 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.
|
426 |
+
* 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.
|
427 |
+
* 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.
|
428 |
+
* 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.
|
429 |
+
* 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.
|
430 |
+
* string from_name optional - only show campaigns that have this "From Name"
|
431 |
+
* string from_email optional - only show campaigns that have this "Reply-to Email"
|
432 |
+
* string title optional - only show campaigns that have this title
|
433 |
+
* string subject optional - only show campaigns that have this subject
|
434 |
+
* 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)
|
435 |
+
* 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)
|
436 |
+
* 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.
|
437 |
* @param int $start optional - control paging of campaigns, start results at this campaign #, defaults to 1st page of data (page 0)
|
438 |
* @param int $limit optional - control paging of campaigns, number of campaigns to return with each call, defaults to 25 (max=1000)
|
439 |
* @return array an array containing a count of all matching campaigns and the specific ones for the current page (see Returned Fields for description)
|
440 |
* @returnf int total the total number of campaigns matching the filters passed in
|
441 |
* @returnf array data the data for each campaign being returned
|
442 |
+
* string id Campaign Id (used for all other campaign functions)
|
443 |
+
* int web_id The Campaign id used in our web app, allows you to create a link directly to it
|
444 |
+
* string list_id The List used for this campaign
|
445 |
+
* int folder_id The Folder this campaign is in
|
446 |
+
* int template_id The Template this campaign uses
|
447 |
+
* string content_type How the campaign's content is put together - one of 'template', 'html', 'url'
|
448 |
+
* string title Title of the campaign
|
449 |
+
* string type The type of campaign this is (regular,plaintext,absplit,rss,inspection,trans,auto)
|
450 |
+
* string create_time Creation time for the campaign
|
451 |
+
* string send_time Send time for the campaign - also the scheduled time for scheduled campaigns.
|
452 |
+
* int emails_sent Number of emails email was sent to
|
453 |
+
* string status Status of the given campaign (save,paused,schedule,sending,sent)
|
454 |
+
* string from_name From name of the given campaign
|
455 |
+
* string from_email Reply-to email of the given campaign
|
456 |
+
* string subject Subject of the given campaign
|
457 |
+
* string to_name Custom "To:" email string using merge variables
|
458 |
+
* string archive_url Archive link for the given campaign
|
459 |
+
* boolean inline_css Whether or not the campaign content's css was auto-inlined
|
460 |
+
* string analytics Either "google" if enabled or "N" if disabled
|
461 |
+
* string analytics_tag The name/tag the campaign's links were tagged with if analytics were enabled.
|
462 |
+
* boolean authenticate Whether or not the campaign was authenticated
|
463 |
+
* boolean ecomm360 Whether or not ecomm360 tracking was appended to links
|
464 |
+
* boolean auto_tweet Whether or not the campaign was auto tweeted after sending
|
465 |
+
* string auto_fb_post A comma delimited list of Facebook Profile/Page Ids the campaign was posted to after sending. If not used, blank.
|
466 |
+
* boolean auto_footer Whether or not the auto_footer was manually turned on
|
467 |
+
* boolean timewarp Whether or not the campaign used Timewarp
|
468 |
+
* 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
|
469 |
+
* array tracking containing "text_clicks", "html_clicks", and "opens" as boolean values representing whether or not they were enabled
|
470 |
+
* string segment_text a string marked-up with HTML explaining the segment used for the campaign in plain English
|
471 |
+
* array segment_opts the segment used for the campaign - can be passed to campaignSegmentTest() or campaignCreate()
|
472 |
+
* array type_opts the type-specific options for the campaign - can be passed to campaignCreate()
|
473 |
+
*/
|
474 |
+
function campaigns($filters = array(), $start = 0, $limit = 25)
|
475 |
+
{
|
476 |
$params = array();
|
477 |
$params["filters"] = $filters;
|
478 |
$params["start"] = $start;
|
506 |
* @returnf int users_who_clicked Number of unique recipients who clicked on a link in the campaign.
|
507 |
* @returnf int emails_sent Number of email addresses campaign was sent to.
|
508 |
* @returnf array absplit If this was an absplit campaign, stats for the A and B groups will be returned
|
509 |
+
* int bounces_a bounces for the A group
|
510 |
+
* int bounces_b bounces for the B group
|
511 |
+
* int forwards_a forwards for the A group
|
512 |
+
* int forwards_b forwards for the B group
|
513 |
+
* int abuse_reports_a abuse reports for the A group
|
514 |
+
* int abuse_reports_b abuse reports for the B group
|
515 |
+
* int unsubs_a unsubs for the A group
|
516 |
+
* int unsubs_b unsubs for the B group
|
517 |
+
* int recipients_click_a clicks for the A group
|
518 |
+
* int recipients_click_b clicks for the B group
|
519 |
+
* int forwards_opens_a opened forwards for the A group
|
520 |
+
* int forwards_opens_b opened forwards for the A group
|
521 |
* @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:
|
522 |
+
* int opens opens for this timezone
|
523 |
+
* string last_open the date/time of the last open for this timezone
|
524 |
+
* int unique_opens the unique opens for this timezone
|
525 |
+
* int clicks the total clicks for this timezone
|
526 |
+
* string last_click the date/time of the last click for this timezone
|
527 |
+
* int unique_opens the unique clicks for this timezone
|
528 |
+
* int bounces the total bounces for this timezone
|
529 |
+
* int total the total number of members sent to in this timezone
|
530 |
+
* int sent the total number of members delivered to in this timezone
|
531 |
+
*/
|
532 |
+
function campaignStats($cid)
|
533 |
+
{
|
534 |
$params = array();
|
535 |
$params["cid"] = $cid;
|
536 |
return $this->callServer("campaignStats", $params);
|
549 |
* @returnf int clicks Number of times the specific link was clicked
|
550 |
* @returnf int unique Number of unique people who clicked on the specific link
|
551 |
*/
|
552 |
+
function campaignClickStats($cid)
|
553 |
+
{
|
554 |
$params = array();
|
555 |
$params["cid"] = $cid;
|
556 |
return $this->callServer("campaignClickStats", $params);
|
580 |
* @returnf int clicks_pct Percentage of clicks from this domain (whole number)
|
581 |
* @returnf int unsubs_pct Percentage of unsubs from this domain (whole number)
|
582 |
*/
|
583 |
+
function campaignEmailDomainPerformance($cid)
|
584 |
+
{
|
585 |
$params = array();
|
586 |
$params["cid"] = $cid;
|
587 |
return $this->callServer("campaignEmailDomainPerformance", $params);
|
594 |
*
|
595 |
* @param string $cid the campaign id to pull members for (can be gathered using campaigns())
|
596 |
* @param string $status optional the status to pull - one of 'sent', 'hard' (bounce), or 'soft' (bounce). By default, all records are returned
|
597 |
+
* @param int $start optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)
|
598 |
+
* @param int $limit optional for large data sets, the number of results to return - defaults to 1000, upper limit set at 15000
|
599 |
* @return array a total of all matching emails and the specific emails for this page
|
600 |
* @returnf int total the total number of members for the campaign and status
|
601 |
* @returnf array data the full campaign member records
|
602 |
+
* string email the email address sent to
|
603 |
+
* string status the status of the send - one of 'sent', 'hard', 'soft'
|
604 |
+
* string absplit_group if this was an absplit campaign, one of 'a','b', or 'winner'
|
605 |
+
* string tz_group if this was an timewarp campaign the timezone GMT offset the member was included in
|
606 |
*/
|
607 |
+
function campaignMembers($cid, $status = NULL, $start = 0, $limit = 1000)
|
608 |
+
{
|
609 |
$params = array();
|
610 |
$params["cid"] = $cid;
|
611 |
$params["status"] = $status;
|
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 hard bounced emails and the specific emails for this page
|
628 |
* @returnf int total the total number of hard 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 campaignHardBounces($cid, $start = 0, $limit = 1000)
|
633 |
+
{
|
634 |
$params = array();
|
635 |
$params["cid"] = $cid;
|
636 |
$params["start"] = $start;
|
646 |
* @section Campaign Stats
|
647 |
*
|
648 |
* @param string $cid the campaign id to pull bounces for (can be gathered using campaigns())
|
649 |
+
* @param int $start optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)
|
650 |
+
* @param int $limit optional for large data sets, the number of results to return - defaults to 1000, upper limit set at 15000
|
651 |
* @return array a total of all soft bounced emails and the specific emails for this page
|
652 |
* @returnf int total the total number of soft bounces for the campaign
|
653 |
* @returnf array data the full email addresses that bounced
|
654 |
+
* string email the email address that bounced
|
655 |
*/
|
656 |
+
function campaignSoftBounces($cid, $start = 0, $limit = 1000)
|
657 |
+
{
|
658 |
$params = array();
|
659 |
$params["cid"] = $cid;
|
660 |
$params["start"] = $start;
|
668 |
* @section Campaign Stats
|
669 |
*
|
670 |
* @param string $cid the campaign id to pull bounces for (can be gathered using campaigns())
|
671 |
+
* @param int $start optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)
|
672 |
+
* @param int $limit optional for large data sets, the number of results to return - defaults to 1000, upper limit set at 15000
|
673 |
* @return array email addresses that unsubscribed from this campaign along with reasons, if given
|
674 |
* @return array a total of all unsubscribed emails and the specific emails for this page
|
675 |
* @returnf int total the total number of unsubscribes for the campaign
|
676 |
* @returnf array data the full email addresses that unsubscribed
|
677 |
+
* string email the email address that unsubscribed
|
678 |
+
* string reason For unsubscribes only - the reason collected for the unsubscribe. If populated, one of 'NORMAL','NOSIGNUP','INAPPROPRIATE','SPAM','OTHER'
|
679 |
+
* string reason_text For unsubscribes only - if the reason is OTHER, the text entered.
|
680 |
*/
|
681 |
+
function campaignUnsubscribes($cid, $start = 0, $limit = 1000)
|
682 |
+
{
|
683 |
$params = array();
|
684 |
$params["cid"] = $cid;
|
685 |
$params["start"] = $start;
|
703 |
* @returnf string email the email address that reported abuse
|
704 |
* @returnf string type an internal type generally specifying the orginating mail provider - may not be useful outside of filling report views
|
705 |
*/
|
706 |
+
function campaignAbuseReports($cid, $since = NULL, $start = 0, $limit = 500)
|
707 |
+
{
|
708 |
$params = array();
|
709 |
$params["cid"] = $cid;
|
710 |
$params["since"] = $since;
|
726 |
* @returnf msg the advice message
|
727 |
* @returnf type the "type" of the message. one of: negative, positive, or neutral
|
728 |
*/
|
729 |
+
function campaignAdvice($cid)
|
730 |
+
{
|
731 |
$params = array();
|
732 |
$params["cid"] = $cid;
|
733 |
return $this->callServer("campaignAdvice", $params);
|
754 |
* @returnf int ecomm_conversions number Ecommerce transactions tracked
|
755 |
* @returnf array goals an array containing goal names and number of conversions
|
756 |
*/
|
757 |
+
function campaignAnalytics($cid)
|
758 |
+
{
|
759 |
$params = array();
|
760 |
$params["cid"] = $cid;
|
761 |
return $this->callServer("campaignAnalytics", $params);
|
774 |
* @returnf int opens The total number of opens that occurred in the country
|
775 |
* @returnf bool region_detail Whether or not a subsequent call to campaignGeoOpensByCountry() will return anything
|
776 |
*/
|
777 |
+
function campaignGeoOpens($cid)
|
778 |
+
{
|
779 |
$params = array();
|
780 |
$params["cid"] = $cid;
|
781 |
return $this->callServer("campaignGeoOpens", $params);
|
794 |
* @returnf string name The name of the region, if we have one. For blank "code" values, this will be "Rest of Country"
|
795 |
* @returnf int opens The total number of opens that occurred in the country
|
796 |
*/
|
797 |
+
function campaignGeoOpensForCountry($cid, $code)
|
798 |
+
{
|
799 |
$params = array();
|
800 |
$params["cid"] = $cid;
|
801 |
$params["code"] = $code;
|
811 |
* @param string $cid the campaign id to pull bounces for (can be gathered using campaigns())
|
812 |
* @return array stats an array containing tweets, retweets, clicks, and referrer related to using the campaign's eepurl
|
813 |
* @returnf array twitter various Twitter related stats
|
814 |
+
* int tweets Total number of tweets seen
|
815 |
+
* string first_tweet date and time of the first tweet seen
|
816 |
+
* string last_tweet date and time of the last tweet seen
|
817 |
+
* int retweets Total number of retweets seen
|
818 |
+
* string first_retweet date and time of the first retweet seen
|
819 |
+
* string last_retweet date and time of the last retweet seen
|
820 |
+
* array statuses an array of statuses recorded inclduing the status, screen_name, status_id, and datetime fields plus an is_retweet flag
|
821 |
* @returnf array clicks stats related to click-throughs on the eepurl
|
822 |
+
* int clicks Total number of clicks seen
|
823 |
+
* string first_click date and time of the first click seen
|
824 |
+
* string last_click date and time of the first click seen
|
825 |
+
* array locations an array of geographic locations including country, region, and total clicks
|
826 |
* @returnf array referrers an array of arrays, each containing
|
827 |
+
* string referrer the referrer, truncated to 100 bytes
|
828 |
+
* int clicks Total number of clicks seen from this referrer
|
829 |
+
* string first_click date and time of the first click seen from this referrer
|
830 |
+
* string last_click date and time of the first click seen from this referrer
|
831 |
*/
|
832 |
+
function campaignEepUrlStats($cid)
|
833 |
+
{
|
834 |
$params = array();
|
835 |
$params["cid"] = $cid;
|
836 |
return $this->callServer("campaignEepUrlStats", $params);
|
850 |
* @returnf string email the email address that bounced
|
851 |
* @returnf string message the entire bounce message received
|
852 |
*/
|
853 |
+
function campaignBounceMessage($cid, $email)
|
854 |
+
{
|
855 |
$params = array();
|
856 |
$params["cid"] = $cid;
|
857 |
$params["email"] = $email;
|
874 |
* @return array bounces the full bounce messages for this campaign
|
875 |
* @returnf int total that total number of bounce messages for the campaign
|
876 |
* @returnf array data an array containing the data for this page
|
877 |
+
* string date date/time the bounce was received and processed
|
878 |
+
* string email the email address that bounced
|
879 |
+
* string message the entire bounce message received
|
880 |
*/
|
881 |
+
function campaignBounceMessages($cid, $start = 0, $limit = 25, $since = NULL)
|
882 |
+
{
|
883 |
$params = array();
|
884 |
$params["cid"] = $cid;
|
885 |
$params["start"] = $start;
|
900 |
* @return array the total matching orders and the specific orders for the requested page
|
901 |
* @returnf int total the total matching orders
|
902 |
* @returnf array data the actual data for each order being returned
|
903 |
+
* string store_id the store id generated by the plugin used to uniquely identify a store
|
904 |
+
* string store_name the store name collected by the plugin - often the domain name
|
905 |
+
* string order_id the internal order id the store tracked this order by
|
906 |
+
* string email the email address that received this campaign and is associated with this order
|
907 |
+
* double order_total the order total
|
908 |
+
* double tax_total the total tax for the order (if collected)
|
909 |
+
* double ship_total the shipping total for the order (if collected)
|
910 |
+
* string order_date the date the order was tracked - from the store if possible, otherwise the GMT time we recieved it
|
911 |
+
* array lines containing detail of the order - product, category, quantity, item cost
|
912 |
+
*/
|
913 |
+
function campaignEcommOrders($cid, $start = 0, $limit = 100, $since = NULL)
|
914 |
+
{
|
915 |
$params = array();
|
916 |
$params["cid"] = $cid;
|
917 |
$params["start"] = $start;
|
926 |
* @section Campaign Related
|
927 |
*
|
928 |
* @param string $cid the campaign id to share a report for (can be gathered using campaigns())
|
929 |
+
* @param array $opts optional various parameters which can be used to configure the shared report
|
930 |
+
* string header_type optional - "text" or "image', defaults to "text'
|
931 |
+
* 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.
|
932 |
+
* boolean secure optional - whether to require a password for the shared report. defaults to "true"
|
933 |
+
* string password optional - if secure is true and a password is not included, we will generate one. It is always returned.
|
934 |
+
* string to_email optional - optional, email address to share the report with - no value means an email will not be sent
|
935 |
+
* 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"
|
936 |
+
* 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
|
937 |
* @return struct Struct containing details for the shared report
|
938 |
* @returnf string title The Title of the Campaign being shared
|
939 |
* @returnf string url The URL to the shared report
|
940 |
* @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
|
941 |
* @returnf string password If secured, the password for the report, otherwise this field will not be returned
|
942 |
*/
|
943 |
+
function campaignShareReport($cid, $opts = array())
|
944 |
+
{
|
945 |
$params = array();
|
946 |
$params["cid"] = $cid;
|
947 |
$params["opts"] = $opts;
|
954 |
* @section Campaign Related
|
955 |
*
|
956 |
* @param string $cid the campaign id to get content for (can be gathered using campaigns())
|
957 |
+
* @param bool $for_archive optional controls whether we return the Archive version (true) or the Raw version (false), defaults to true
|
958 |
* @return struct Struct containing all content for the campaign (see Returned Fields for details
|
959 |
* @returnf string html The HTML content used for the campgain with merge tags intact
|
960 |
* @returnf string text The Text content used for the campgain with merge tags intact
|
961 |
*/
|
962 |
+
function campaignContent($cid, $for_archive = true)
|
963 |
+
{
|
964 |
$params = array();
|
965 |
$params["cid"] = $cid;
|
966 |
$params["for_archive"] = $for_archive;
|
976 |
* @param string $cid the campaign id to get content for (can be gathered using campaigns())
|
977 |
* @return array array containing all content section for the campaign -
|
978 |
*/
|
979 |
+
function campaignTemplateContent($cid)
|
980 |
+
{
|
981 |
$params = array();
|
982 |
$params["cid"] = $cid;
|
983 |
return $this->callServer("campaignTemplateContent", $params);
|
990 |
* @section Campaign Report Data
|
991 |
*
|
992 |
* @param string $cid the campaign id to get opens for (can be gathered using campaigns())
|
993 |
+
* @param int $start optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)
|
994 |
+
* @param int $limit optional for large data sets, the number of results to return - defaults to 1000, upper limit set at 15000
|
995 |
* @return array array containing the total records matched and the specific records for this page
|
996 |
* @returnf int total the total number of records matched
|
997 |
* @returnf array data the actual opens data, including:
|
998 |
+
* string email Email address that opened the campaign
|
999 |
+
* int open_count Total number of times the campaign was opened by this email address
|
1000 |
*/
|
1001 |
+
function campaignOpenedAIM($cid, $start = 0, $limit = 1000)
|
1002 |
+
{
|
1003 |
$params = array();
|
1004 |
$params["cid"] = $cid;
|
1005 |
$params["start"] = $start;
|
1013 |
* @section Campaign Report Data
|
1014 |
*
|
1015 |
* @param string $cid the campaign id to get no opens for (can be gathered using campaigns())
|
1016 |
+
* @param int $start optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)
|
1017 |
+
* @param int $limit optional for large data sets, the number of results to return - defaults to 1000, upper limit set at 15000
|
1018 |
* @return array array containing the total records matched and the specific records for this page
|
1019 |
* @returnf int total the total number of records matched
|
1020 |
* @returnf array data the email addresses that did not open the campaign
|
1021 |
+
* string email Email address that opened the campaign
|
1022 |
*/
|
1023 |
+
function campaignNotOpenedAIM($cid, $start = 0, $limit = 1000)
|
1024 |
+
{
|
1025 |
$params = array();
|
1026 |
$params["cid"] = $cid;
|
1027 |
$params["start"] = $start;
|
1036 |
*
|
1037 |
* @param string $cid the campaign id to get click stats for (can be gathered using campaigns())
|
1038 |
* @param string $url the URL of the link that was clicked on
|
1039 |
+
* @param int $start optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)
|
1040 |
+
* @param int $limit optional for large data sets, the number of results to return - defaults to 1000, upper limit set at 15000
|
1041 |
* @return array array containing the total records matched and the specific records for this page
|
1042 |
* @returnf int total the total number of records matched
|
1043 |
* @returnf array data the email addresses that did not open the campaign
|
1044 |
+
* string email Email address that opened the campaign
|
1045 |
+
* int clicks Total number of times the URL was clicked on by this email address
|
1046 |
*/
|
1047 |
+
function campaignClickDetailAIM($cid, $url, $start = 0, $limit = 1000)
|
1048 |
+
{
|
1049 |
$params = array();
|
1050 |
$params["cid"] = $cid;
|
1051 |
$params["url"] = $url;
|
1065 |
* @returnf int success the number of email address records found
|
1066 |
* @returnf int error the number of email address records which could not be found
|
1067 |
* @returnf array data arrays containing the actions (opens and clicks) that the email took, with timestamps
|
1068 |
+
* string action The action taken (open or click)
|
1069 |
+
* string timestamp Time the action occurred
|
1070 |
+
* string url For clicks, the URL that was clicked
|
1071 |
*/
|
1072 |
+
function campaignEmailStatsAIM($cid, $email_address)
|
1073 |
+
{
|
1074 |
$params = array();
|
1075 |
$params["cid"] = $cid;
|
1076 |
$params["email_address"] = $email_address;
|
1090 |
* @return array Array containing a total record count and data including the actions (opens and clicks) for each email, with timestamps
|
1091 |
* @returnf int total the total number of records
|
1092 |
* @returnf array data each record with their details:
|
1093 |
+
* string action The action taken (open or click)
|
1094 |
+
* string timestamp Time the action occurred
|
1095 |
+
* string url For clicks, the URL that was clicked
|
1096 |
*/
|
1097 |
+
function campaignEmailStatsAIMAll($cid, $start = 0, $limit = 100)
|
1098 |
+
{
|
1099 |
$params = array();
|
1100 |
$params["cid"] = $cid;
|
1101 |
$params["start"] = $start;
|
1109 |
* @section Campaign Related
|
1110 |
*
|
1111 |
* @param array $order an array of information pertaining to the order that has completed. Use the following keys:
|
1112 |
+
* string id the Order Id
|
1113 |
+
* string campaign_id the Campaign Id to track this order with (see the "mc_cid" query string variable a campaign passes)
|
1114 |
+
* 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)
|
1115 |
+
* double total The Order Total (ie, the full amount the customer ends up paying)
|
1116 |
+
* string order_date optional the date of the order - if this is not provided, we will default the date to now
|
1117 |
+
* double shipping optional the total paid for Shipping Fees
|
1118 |
+
* double tax optional the total tax paid
|
1119 |
+
* string store_id a unique id for the store sending the order in (20 bytes max)
|
1120 |
+
* 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)
|
1121 |
+
* string plugin_id the MailChimp assigned Plugin Id. Get yours by <a href="/register.php">registering here</a>
|
1122 |
+
* array items the individual line items for an order using these keys:
|
1123 |
+
* <div style="padding-left:30px"><table><tr><td colspan=*>
|
1124 |
+
* int line_num optional the line number of the item on the order. We will generate these if they are not passed
|
1125 |
+
* int product_id the store's internal Id for the product. Lines that do no contain this will be skipped
|
1126 |
+
* 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)
|
1127 |
+
* 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
|
1128 |
+
* 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.
|
1129 |
+
* double qty the quantity of the item ordered
|
1130 |
+
* double cost the cost of a single item (ie, not the extended cost of the line)
|
1131 |
+
* </td></tr></table></div>
|
1132 |
* @return bool true if the data is saved, otherwise an error is thrown.
|
1133 |
*/
|
1134 |
+
function campaignEcommOrderAdd($order)
|
1135 |
+
{
|
1136 |
$params = array();
|
1137 |
$params["order"] = $order;
|
1138 |
return $this->callServer("campaignEcommOrderAdd", $params);
|
1146 |
* @example xml-rpc_lists.php
|
1147 |
*
|
1148 |
* @param array $filters a hash of filters to apply to this query - all are optional:
|
1149 |
+
* string list_id optional - return a single list using a known list_id. Accepts multiples separated by commas when not using exact matching
|
1150 |
+
* string list_name optional - only lists that match this name
|
1151 |
+
* string from_name optional - only lists that have a default from name matching this
|
1152 |
+
* string from_email optional - only lists that have a default from email matching this
|
1153 |
+
* string from_subject optional - only lists that have a default from email matching this
|
1154 |
+
* 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)
|
1155 |
+
* 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)
|
1156 |
+
* boolean exact optional - flag for whether to filter on exact values when filtering, or search within content for filter values - defaults to true
|
1157 |
* @param int $start optional - control paging of lists, start results at this list #, defaults to 1st page of data (page 0)
|
1158 |
* @param int $limit optional - control paging of lists, number of lists to return with each call, defaults to 25 (max=100)
|
1159 |
* @return array an array with keys listed in Returned Fields below
|
1160 |
* @returnf int total the total number of lists which matched the provided filters
|
1161 |
* @returnf array data the lists which matched the provided filters, including the following for
|
1162 |
+
* string id The list id for this list. This will be used for all other list management functions.
|
1163 |
+
* int web_id The list id used in our web app, allows you to create a link directly to it
|
1164 |
+
* string name The name of the list.
|
1165 |
+
* string date_created The date that this list was created.
|
1166 |
+
* boolean email_type_option Whether or not the List supports multiple formats for emails or just HTML
|
1167 |
+
* boolean use_awesomebar Whether or not campaigns for this list use the Awesome Bar in archives by default
|
1168 |
+
* string default_from_name Default From Name for campaigns using this list
|
1169 |
+
* string default_from_email Default From Email for campaigns using this list
|
1170 |
+
* string default_subject Default Subject Line for campaigns using this list
|
1171 |
+
* string default_language Default Language for this list's forms
|
1172 |
+
* int list_rating An auto-generated activity score for the list (0 - 5)
|
1173 |
+
* array stats various stats and counts for the list
|
1174 |
+
* int member_count The number of active members in the given list.
|
1175 |
+
* int unsubscribe_count The number of members who have unsubscribed from the given list.
|
1176 |
+
* int cleaned_count The number of members cleaned from the given list.
|
1177 |
+
* int member_count_since_send The number of active members in the given list since the last campaign was sent
|
1178 |
+
* int unsubscribe_count_since_send The number of members who have unsubscribed from the given list since the last campaign was sent
|
1179 |
+
* int cleaned_count_since_send The number of members cleaned from the given list since the last campaign was sent
|
1180 |
+
* int campaign_count The number of campaigns in any status that use this list
|
1181 |
+
* int grouping_count The number of Interest Groupings for this list
|
1182 |
+
* int group_count The number of Interest Groups (regardless of grouping) for this list
|
1183 |
+
* int merge_var_count The number of merge vars for this list (not including the required EMAIL one)
|
1184 |
+
* int avg_sub_rate the average number of subscribe per month for the list (empty value if we haven't calculated this yet)
|
1185 |
+
* int avg_unsub_rate the average number of unsubscribe per month for the list (empty value if we haven't calculated this yet)
|
1186 |
+
* int target_sub_rate the target subscription rate for the list to keep it growing (empty value if we haven't calculated this yet)
|
1187 |
+
* int open_rate the average open rate per campaign for the list (empty value if we haven't calculated this yet)
|
1188 |
+
* int click_rate the average click rate per campaign for the list (empty value if we haven't calculated this yet)
|
1189 |
+
* array modules Any list specific modules installed for this list (example is SocialPro)
|
1190 |
+
*/
|
1191 |
+
function lists($filters = array(), $start = 0, $limit = 25)
|
1192 |
+
{
|
1193 |
$params = array();
|
1194 |
$params["filters"] = $filters;
|
1195 |
$params["start"] = $start;
|
1216 |
* @returnf string tag The merge tag that's used for forms and listSubscribe() and listUpdateMember()
|
1217 |
* @returnf array choices For radio and dropdown field types, an array of the options available
|
1218 |
*/
|
1219 |
+
function listMergeVars($id)
|
1220 |
+
{
|
1221 |
$params = array();
|
1222 |
$params["id"] = $id;
|
1223 |
return $this->callServer("listMergeVars", $params);
|
1233 |
* @param string $tag The merge tag to add, e.g. FNAME
|
1234 |
* @param string $name The long description of the tag being added, used for user displays
|
1235 |
* @param array $options optional Various options for this merge var. <em>note:</em> for historical purposes this can also take a "boolean"
|
1236 |
+
* string field_type optional one of: text, number, radio, dropdown, date, address, phone, url, imageurl - defaults to text
|
1237 |
+
* boolean req optional indicates whether the field is required - defaults to false
|
1238 |
+
* boolean public optional indicates whether the field is displayed in public - defaults to true
|
1239 |
+
* boolean show optional indicates whether the field is displayed in the app's list member view - defaults to true
|
1240 |
+
* string default_value optional the default value for the field. See listSubscribe() for formatting info. Defaults to blank
|
1241 |
+
* array choices optional kind of - an array of strings to use as the choices for radio and dropdown type fields
|
|
|
1242 |
* @return bool true if the request succeeds, otherwise an error will be thrown
|
1243 |
*/
|
1244 |
+
function listMergeVarAdd($id, $tag, $name, $options = array())
|
1245 |
+
{
|
1246 |
$params = array();
|
1247 |
$params["id"] = $id;
|
1248 |
$params["tag"] = $tag;
|
1261 |
* @param array $options The options to change for a merge var. See listMergeVarAdd() for valid options
|
1262 |
* @return bool true if the request succeeds, otherwise an error will be thrown
|
1263 |
*/
|
1264 |
+
function listMergeVarUpdate($id, $tag, $options)
|
1265 |
+
{
|
1266 |
$params = array();
|
1267 |
$params["id"] = $id;
|
1268 |
$params["tag"] = $tag;
|
1281 |
* @param string $tag The merge tag to delete
|
1282 |
* @return bool true if the request succeeds, otherwise an error will be thrown
|
1283 |
*/
|
1284 |
+
function listMergeVarDel($id, $tag)
|
1285 |
+
{
|
1286 |
$params = array();
|
1287 |
$params["id"] = $id;
|
1288 |
$params["tag"] = $tag;
|
1302 |
* @returnf string form_field Gives the type of interest group: checkbox,radio,select
|
1303 |
* @returnf array groups Array of the grouping options including the "bit" value, "name", "display_order", and number of "subscribers" with the option selected.
|
1304 |
*/
|
1305 |
+
function listInterestGroupings($id)
|
1306 |
+
{
|
1307 |
$params = array();
|
1308 |
$params["id"] = $id;
|
1309 |
return $this->callServer("listInterestGroupings", $params);
|
1320 |
* @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.
|
1321 |
* @return bool true if the request succeeds, otherwise an error will be thrown
|
1322 |
*/
|
1323 |
+
function listInterestGroupAdd($id, $group_name, $grouping_id = NULL)
|
1324 |
+
{
|
1325 |
$params = array();
|
1326 |
$params["id"] = $id;
|
1327 |
$params["group_name"] = $group_name;
|
1339 |
* @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.
|
1340 |
* @return bool true if the request succeeds, otherwise an error will be thrown
|
1341 |
*/
|
1342 |
+
function listInterestGroupDel($id, $group_name, $grouping_id = NULL)
|
1343 |
+
{
|
1344 |
$params = array();
|
1345 |
$params["id"] = $id;
|
1346 |
$params["group_name"] = $group_name;
|
1358 |
* @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.
|
1359 |
* @return bool true if the request succeeds, otherwise an error will be thrown
|
1360 |
*/
|
1361 |
+
function listInterestGroupUpdate($id, $old_name, $new_name, $grouping_id = NULL)
|
1362 |
+
{
|
1363 |
$params = array();
|
1364 |
$params["id"] = $id;
|
1365 |
$params["old_name"] = $old_name;
|
1380 |
* @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.
|
1381 |
* @return int the new grouping id if the request succeeds, otherwise an error will be thrown
|
1382 |
*/
|
1383 |
+
function listInterestGroupingAdd($id, $name, $type, $groups)
|
1384 |
+
{
|
1385 |
$params = array();
|
1386 |
$params["id"] = $id;
|
1387 |
$params["name"] = $name;
|
1400 |
* @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.
|
1401 |
* @return bool true if the request succeeds, otherwise an error will be thrown
|
1402 |
*/
|
1403 |
+
function listInterestGroupingUpdate($grouping_id, $name, $value)
|
1404 |
+
{
|
1405 |
$params = array();
|
1406 |
$params["grouping_id"] = $grouping_id;
|
1407 |
$params["name"] = $name;
|
1417 |
* @param int $grouping_id the interest grouping id - get from listInterestGroupings()
|
1418 |
* @return bool true if the request succeeds, otherwise an error will be thrown
|
1419 |
*/
|
1420 |
+
function listInterestGroupingDel($grouping_id)
|
1421 |
+
{
|
1422 |
$params = array();
|
1423 |
$params["grouping_id"] = $grouping_id;
|
1424 |
return $this->callServer("listInterestGroupingDel", $params);
|
1434 |
* @returnf array actions the possible actions and whether they are enabled
|
1435 |
* @returnf array sources the possible sources and whether they are enabled
|
1436 |
*/
|
1437 |
+
function listWebhooks($id)
|
1438 |
+
{
|
1439 |
$params = array();
|
1440 |
$params["id"] = $id;
|
1441 |
return $this->callServer("listWebhooks", $params);
|
1448 |
* @param string $id the list id to connect to. Get by calling lists()
|
1449 |
* @param string $url a valid URL for the Webhook - it will be validated. note that a url may only exist on a list once.
|
1450 |
* @param array $actions optional a hash of actions to fire this Webhook for
|
1451 |
+
* boolean subscribe optional as subscribes occur, defaults to true
|
1452 |
+
* boolean unsubscribe optional as subscribes occur, defaults to true
|
1453 |
+
* boolean profile optional as profile updates occur, defaults to true
|
1454 |
+
* boolean cleaned optional as emails are cleaned from the list, defaults to true
|
1455 |
+
* boolean upemail optional when subscribers change their email address, defaults to true
|
1456 |
* @param array $sources optional a hash of sources to fire this Webhook for
|
1457 |
+
* boolean user optional user/subscriber initiated actions, defaults to true
|
1458 |
+
* boolean admin optional admin actions in our web app, defaults to true
|
1459 |
+
* boolean api optional actions that happen via API calls, defaults to false
|
1460 |
* @return bool true if the call succeeds, otherwise an exception will be thrown
|
1461 |
*/
|
1462 |
+
function listWebhookAdd($id, $url, $actions = array(), $sources = array())
|
1463 |
+
{
|
|
|
1464 |
$params = array();
|
1465 |
$params["id"] = $id;
|
1466 |
$params["url"] = $url;
|
1477 |
* @param string $url the URL of a Webhook on this list
|
1478 |
* @return boolean true if the call succeeds, otherwise an exception will be thrown
|
1479 |
*/
|
1480 |
+
function listWebhookDel($id, $url)
|
1481 |
+
{
|
1482 |
$params = array();
|
1483 |
$params["id"] = $id;
|
1484 |
$params["url"] = $url;
|
1498 |
* @returnf date last_update the date/time the segment was last updated (add or del)
|
1499 |
* @returnf date last_reset the date/time the segment was last reset (ie had all members cleared from it)
|
1500 |
*/
|
1501 |
+
function listStaticSegments($id)
|
1502 |
+
{
|
1503 |
$params = array();
|
1504 |
$params["id"] = $id;
|
1505 |
return $this->callServer("listStaticSegments", $params);
|
1516 |
* @param string $name a unique name per list for the segment - 50 byte maximum length, anything longer will throw an error
|
1517 |
* @return int the id of the new segment, otherwise an error will be thrown.
|
1518 |
*/
|
1519 |
+
function listStaticSegmentAdd($id, $name)
|
1520 |
+
{
|
1521 |
$params = array();
|
1522 |
$params["id"] = $id;
|
1523 |
$params["name"] = $name;
|
1532 |
* @param int $seg_id the id of the static segment to reset - get from listStaticSegments()
|
1533 |
* @return bool true if it worked, otherwise an error is thrown.
|
1534 |
*/
|
1535 |
+
function listStaticSegmentReset($id, $seg_id)
|
1536 |
+
{
|
1537 |
$params = array();
|
1538 |
$params["id"] = $id;
|
1539 |
$params["seg_id"] = $seg_id;
|
1548 |
* @param int $seg_id the id of the static segment to delete - get from listStaticSegments()
|
1549 |
* @return bool true if it worked, otherwise an error is thrown.
|
1550 |
*/
|
1551 |
+
function listStaticSegmentDel($id, $seg_id)
|
1552 |
+
{
|
1553 |
$params = array();
|
1554 |
$params["id"] = $id;
|
1555 |
$params["seg_id"] = $seg_id;
|
1568 |
* @returnf int success the total number of successful updates (will include members already in the segment)
|
1569 |
* @returnf array errors the email address, an error code, and a message explaining why they couldn't be added
|
1570 |
*/
|
1571 |
+
function listStaticSegmentMembersAdd($id, $seg_id, $batch)
|
1572 |
+
{
|
1573 |
$params = array();
|
1574 |
$params["id"] = $id;
|
1575 |
$params["seg_id"] = $seg_id;
|
1589 |
* @returnf int success the total number of succesful removals
|
1590 |
* @returnf array errors the email address, an error code, and a message explaining why they couldn't be removed
|
1591 |
*/
|
1592 |
+
function listStaticSegmentMembersDel($id, $seg_id, $batch)
|
1593 |
+
{
|
1594 |
$params = array();
|
1595 |
$params["id"] = $id;
|
1596 |
$params["seg_id"] = $seg_id;
|
1610 |
* @param string $id the list id to connect to. Get by calling lists()
|
1611 |
* @param string $email_address the email address to subscribe
|
1612 |
* @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:
|
1613 |
+
* string EMAIL set this to change the email address. This is only respected on calls using update_existing or when passed to listUpdateMember()
|
1614 |
+
* 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()
|
1615 |
+
* 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.
|
1616 |
+
* 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.
|
1617 |
+
*
|
1618 |
+
* <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...
|
1619 |
+
* Field values should be formatted as follows:
|
1620 |
+
* 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
|
1621 |
+
* 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
|
1622 |
+
*
|
1623 |
+
* 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>
|
1624 |
+
* string dropdown can be a normal string - we <em>will</em> validate that the value is a valid option
|
1625 |
+
* string image must be a valid, existing url. we <em>will</em> check its existence
|
1626 |
+
* string multi_choice can be a normal string - we <em>will</em> validate that the value is a valid option
|
1627 |
+
* double number pass in a valid number - anything else will turn in to zero (0). Note, this will be rounded to 2 decimal places
|
1628 |
+
* 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.
|
1629 |
+
* string website This is a standard string, but we <em>will</em> verify that it looks like a valid URL
|
|
|
1630 |
* @param string $email_type optional email type preference for the email (html, text, or mobile defaults to html)
|
1631 |
* @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>
|
1632 |
* @param bool $update_existing optional flag to control whether a existing subscribers should be updated instead of throwing and error, defaults to false
|
1634 |
* @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.
|
1635 |
* @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)
|
1636 |
*/
|
1637 |
+
function listSubscribe($id, $email_address, $merge_vars = NULL, $email_type = 'html', $double_optin = true, $update_existing = false, $replace_interests = true, $send_welcome = false)
|
1638 |
+
{
|
1639 |
$params = array();
|
1640 |
$params["id"] = $id;
|
1641 |
$params["email_address"] = $email_address;
|
1662 |
* @param boolean $send_notify flag to send the unsubscribe notification email to the address defined in the list email notification settings, defaults to true
|
1663 |
* @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)
|
1664 |
*/
|
1665 |
+
function listUnsubscribe($id, $email_address, $delete_member = false, $send_goodbye = true, $send_notify = true)
|
1666 |
+
{
|
1667 |
$params = array();
|
1668 |
$params["id"] = $id;
|
1669 |
$params["email_address"] = $email_address;
|
1687 |
* @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)
|
1688 |
* @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
|
1689 |
*/
|
1690 |
+
function listUpdateMember($id, $email_address, $merge_vars, $email_type = '', $replace_interests = true)
|
1691 |
+
{
|
1692 |
$params = array();
|
1693 |
$params["id"] = $id;
|
1694 |
$params["email_address"] = $email_address;
|
1718 |
* @returnf int update_count Number of email addresses that were succesfully updated
|
1719 |
* @returnf int error_count Number of email addresses that failed during addition/updating
|
1720 |
* @returnf array errors Array of error arrays, each containing:
|
1721 |
+
* string code the error code
|
1722 |
+
* string message the full error message
|
1723 |
+
* string email the email address being processed
|
1724 |
*/
|
1725 |
+
function listBatchSubscribe($id, $batch, $double_optin = true, $update_existing = false, $replace_interests = true)
|
1726 |
+
{
|
1727 |
$params = array();
|
1728 |
$params["id"] = $id;
|
1729 |
$params["batch"] = $batch;
|
1749 |
* @returnf int error_count Number of email addresses that failed during addition/updating
|
1750 |
* @returnf array errors Array of error structs. Each error struct will contain "code", "message", and "email"
|
1751 |
*/
|
1752 |
+
function listBatchUnsubscribe($id, $emails, $delete_member = false, $send_goodbye = true, $send_notify = false)
|
1753 |
+
{
|
1754 |
$params = array();
|
1755 |
$params["id"] = $id;
|
1756 |
$params["emails"] = $emails;
|
1775 |
* @return array Array of a the total records match and matching list member data for this page (see Returned Fields for details)
|
1776 |
* @returnf int total the total matching records
|
1777 |
* @returnf array data the data for each member, including:
|
1778 |
+
* string email Member email address
|
1779 |
+
* date timestamp timestamp of their associated status date (subscribed, unsubscribed, cleaned, or updated) in GMT
|
1780 |
+
* string reason For unsubscribes only - the reason collected for the unsubscribe. If populated, one of 'NORMAL','NOSIGNUP','INAPPROPRIATE','SPAM','OTHER'
|
1781 |
+
* string reason_text For unsubscribes only - if the reason is OTHER, the text entered.
|
1782 |
*/
|
1783 |
+
function listMembers($id, $status = 'subscribed', $since = NULL, $start = 0, $limit = 100)
|
1784 |
+
{
|
1785 |
$params = array();
|
1786 |
$params["id"] = $id;
|
1787 |
$params["status"] = $status;
|
1804 |
* @returnf int success the number of subscribers successfully found on the list
|
1805 |
* @returnf int errors the number of subscribers who were not found on the list
|
1806 |
* @returnf array data an array of arrays where each one has member info:
|
1807 |
+
* string id The unique id for this email address on an account
|
1808 |
+
* string email The email address associated with this record
|
1809 |
+
* string email_type The type of emails this customer asked to get: html, text, or mobile
|
1810 |
+
* 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
|
1811 |
+
* string status The subscription status for this email address, either pending, subscribed, unsubscribed, or cleaned
|
1812 |
+
* string ip_opt IP Address this address opted in from.
|
1813 |
+
* string ip_signup IP Address this address signed up from.
|
1814 |
+
* 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>
|
1815 |
+
* 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.
|
1816 |
+
* 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.
|
1817 |
+
* date timestamp The time this email address was added to the list
|
1818 |
+
* date info_changed The last time this record was changed. If the record is old enough, this may be blank.
|
1819 |
+
* int web_id The Member id used in our web app, allows you to create a link directly to it
|
1820 |
+
* array clients the various clients we've tracked the address as using - each included array includes client 'name' and 'icon_url'
|
1821 |
+
* array static_segments the 'id', 'name', and date 'added' for any static segment this member is in
|
1822 |
+
*/
|
1823 |
+
function listMemberInfo($id, $email_address)
|
1824 |
+
{
|
1825 |
$params = array();
|
1826 |
$params["id"] = $id;
|
1827 |
$params["email_address"] = $email_address;
|
1841 |
* @returnf int success the number of subscribers successfully found on the list
|
1842 |
* @returnf int errors the number of subscribers who were not found on the list
|
1843 |
* @returnf array data an array of arrays where each activity record has:
|
1844 |
+
* string action The action name, one of: open, click, bounce, unsub, abuse, sent
|
1845 |
+
* string timestamp The date/time of the action
|
1846 |
+
* string url For click actions, the url clicked, otherwise this is empty
|
1847 |
+
* string bounce_type For bounce actions, the bounce type, otherwise this is empty
|
1848 |
+
* string campaign_id The campaign id the action was related to, if it exists - otherwise empty (ie, direct unsub from list)
|
1849 |
*/
|
1850 |
+
function listMemberActivity($id, $email_address)
|
1851 |
+
{
|
1852 |
$params = array();
|
1853 |
$params["id"] = $id;
|
1854 |
$params["email_address"] = $email_address;
|
1869 |
* @return array the total of all reports and the specific reports reports this page
|
1870 |
* @returnf int total the total number of matching abuse reports
|
1871 |
* @returnf array data the actual data for each reports, including:
|
1872 |
+
* string date date/time the abuse report was received and processed
|
1873 |
+
* string email the email address that reported abuse
|
1874 |
+
* string campaign_id the unique id for the campaign that report was made against
|
1875 |
+
* string type an internal type generally specifying the orginating mail provider - may not be useful outside of filling report views
|
1876 |
*/
|
1877 |
+
function listAbuseReports($id, $start = 0, $limit = 500, $since = NULL)
|
1878 |
+
{
|
1879 |
$params = array();
|
1880 |
$params["id"] = $id;
|
1881 |
$params["start"] = $start;
|
1898 |
* @returnf int imports number of subscribers imported during the month
|
1899 |
* @returnf int optins number of subscribers who opted-in during the month
|
1900 |
*/
|
1901 |
+
function listGrowthHistory($id)
|
1902 |
+
{
|
1903 |
$params = array();
|
1904 |
$params["id"] = $id;
|
1905 |
return $this->callServer("listGrowthHistory", $params);
|
1925 |
* @returnf int other_adds number of non-double optin subscribes for the list (manual, API, or import)
|
1926 |
* @returnf int other_removes number of non-manual unsubscribes for the list (deletions, empties, soft-bounce removals)
|
1927 |
*/
|
1928 |
+
function listActivity($id)
|
1929 |
+
{
|
1930 |
$params = array();
|
1931 |
$params["id"] = $id;
|
1932 |
return $this->callServer("listActivity", $params);
|
1944 |
* @returnf double percent the percent of subscribers in the country
|
1945 |
* @returnf double total the total number of subscribers in the country
|
1946 |
*/
|
1947 |
+
function listLocations($id)
|
1948 |
+
{
|
1949 |
$params = array();
|
1950 |
$params["id"] = $id;
|
1951 |
return $this->callServer("listLocations", $params);
|
1959 |
* @param string $id the list id to connect to. Get by calling lists()
|
1960 |
* @return array the desktop and mobile user agents in use on the list
|
1961 |
* @returnf array desktop desktop user agents and percentages
|
1962 |
+
* double penetration the percent of desktop clients in use
|
1963 |
+
* array clients a record containing the 'client', an 'icon' image url, the 'percent' using the client, and the total 'members' represented
|
1964 |
* @returnf array mobile mobile user agents and percentages
|
1965 |
+
* double penetration the percent of mobile clients in use
|
1966 |
+
* array clients a record containing the 'client', an 'icon' image url, the 'percent' using the client, and the total 'members' represented
|
1967 |
*/
|
1968 |
+
function listClients($id)
|
1969 |
+
{
|
1970 |
$params = array();
|
1971 |
$params["id"] = $id;
|
1972 |
return $this->callServer("listClients", $params);
|
1980 |
* @example xml-rpc_templates.php
|
1981 |
*
|
1982 |
* @param array $types optional the types of templates to return
|
1983 |
+
* boolean user Customer template for this user account. Defaults to true.
|
1984 |
+
* boolean gallery Templates from our Gallery. Note that some templates that require extra configuration are withheld. (eg, the Etsy template). Defaults to false.
|
1985 |
+
* boolean base Our "start from scratch" extremely basic templates
|
1986 |
* @param string $category optional for Gallery templates only, limit to a specific template category
|
1987 |
* @param array $inactives optional options to control how inactive templates are returned, if at all
|
1988 |
+
* boolean include user templates are not deleted, only set inactive. defaults to false.
|
1989 |
+
* boolean only only include inactive templates. defaults to false.
|
1990 |
* @return array An array of structs, one for each template (see Returned Fields for details)
|
1991 |
* @returnf int id Id of the template
|
1992 |
* @returnf string name Name of the template
|
1995 |
* @returnf string date_created The date/time the template was created
|
1996 |
* @returnf bool edit_source Whether or not you are able to edit the source of a template.
|
1997 |
*/
|
1998 |
+
function templates($types = array(), $category = NULL, $inactives = array())
|
1999 |
+
{
|
|
|
2000 |
$params = array();
|
2001 |
$params["types"] = $types;
|
2002 |
$params["category"] = $category;
|
2017 |
* @returnf string source the full source of the template as if you exported it via our template editor
|
2018 |
* @returnf string preview similar to the source, but the rendered version of the source from our popup preview
|
2019 |
*/
|
2020 |
+
function templateInfo($tid, $type = 'user')
|
2021 |
+
{
|
2022 |
$params = array();
|
2023 |
$params["tid"] = $tid;
|
2024 |
$params["type"] = $type;
|
2036 |
* @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>.
|
2037 |
* @return int the new template id, otherwise an error is thrown.
|
2038 |
*/
|
2039 |
+
function templateAdd($name, $html)
|
2040 |
+
{
|
2041 |
$params = array();
|
2042 |
$params["name"] = $name;
|
2043 |
$params["html"] = $html;
|
2050 |
* @section Template Related
|
2051 |
*
|
2052 |
* @param int $id the id of the user template to update
|
2053 |
+
* @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.
|
2054 |
+
* string name optional the name for the template - names must be unique and a max of 50 bytes
|
2055 |
+
* 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>.
|
|
|
2056 |
* @return boolean true if the template was updated, otherwise an error will be thrown
|
2057 |
*/
|
2058 |
+
function templateUpdate($id, $values)
|
2059 |
+
{
|
2060 |
$params = array();
|
2061 |
$params["id"] = $id;
|
2062 |
$params["values"] = $values;
|
2071 |
* @param int $id the id of the user template to delete
|
2072 |
* @return boolean true if the template was deleted, otherwise an error will be thrown
|
2073 |
*/
|
2074 |
+
function templateDel($id)
|
2075 |
+
{
|
2076 |
$params = array();
|
2077 |
$params["id"] = $id;
|
2078 |
return $this->callServer("templateDel", $params);
|
2086 |
* @param int $id the id of the user template to reactivate
|
2087 |
* @return boolean true if the template was deleted, otherwise an error will be thrown
|
2088 |
*/
|
2089 |
+
function templateUndel($id)
|
2090 |
+
{
|
2091 |
$params = array();
|
2092 |
$params["id"] = $id;
|
2093 |
return $this->callServer("templateUndel", $params);
|
2116 |
* @returnf string last_login date/time of last login via the web
|
2117 |
* @returnf string affiliate_link Monkey Rewards link for our Affiliate program
|
2118 |
* @returnf array contact Contact details for the account
|
2119 |
+
* string fname First Name
|
2120 |
+
* string lname Last Name
|
2121 |
+
* string email Email Address
|
2122 |
+
* string company Company Name
|
2123 |
+
* string address1 Address Line 1
|
2124 |
+
* string address2 Address Line 2
|
2125 |
+
* string city City
|
2126 |
+
* string state State or Province
|
2127 |
+
* string zip Zip or Postal Code
|
2128 |
+
* string country Country name
|
2129 |
+
* string url Website URL
|
2130 |
+
* string phone Phone number
|
2131 |
+
* string fax Fax number
|
2132 |
* @returnf array modules Addons installed in the account
|
2133 |
+
* string name The module name
|
2134 |
+
* string added The date the module was added
|
2135 |
* @returnf array orders Order details for the account
|
2136 |
+
* int order_id The order id
|
2137 |
+
* string type The order type - either "monthly" or "credits"
|
2138 |
+
* double amount The order amount
|
2139 |
+
* string date The order date
|
2140 |
+
* double credits_used The total credits used
|
2141 |
* @returnf array rewards Rewards details for the account including credits & inspections earned, number of referals, referal details, and rewards used
|
2142 |
+
* int referrals_this_month the total number of referrals this month
|
2143 |
+
* string notify_on whether or not we notify the user when rewards are earned
|
2144 |
+
* string notify_email the email address address used for rewards notifications
|
2145 |
+
* array credits Email credits earned "this_month", "total_earned", and "remaining"
|
2146 |
+
* array inspections Inbox Inspections earned "this_month", "total_earned", and "remaining"
|
2147 |
+
* array referrals All referrals, including "name", "email", "signup_date", and "type"
|
2148 |
+
* array applied Applied rewards, including "value", "date", "order_id", and "order_desc"
|
2149 |
*/
|
2150 |
+
function getAccountDetails()
|
2151 |
+
{
|
2152 |
$params = array();
|
2153 |
return $this->callServer("getAccountDetails", $params);
|
2154 |
}
|
2163 |
* @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.
|
2164 |
* @return string the content pass in converted to text.
|
2165 |
*/
|
2166 |
+
function generateText($type, $content)
|
2167 |
+
{
|
2168 |
$params = array();
|
2169 |
$params["type"] = $type;
|
2170 |
$params["content"] = $content;
|
2181 |
* @param bool $strip_css optional Whether you want the CSS <style> tags stripped from the returned document. Defaults to false.
|
2182 |
* @return string Your HTML content with all CSS inlined, just like if we sent it.
|
2183 |
*/
|
2184 |
+
function inlineCss($html, $strip_css = false)
|
2185 |
+
{
|
2186 |
$params = array();
|
2187 |
$params["html"] = $html;
|
2188 |
$params["strip_css"] = $strip_css;
|
2203 |
* @returnf string date_created The date/time the folder was created
|
2204 |
* @returnf string type The type of the folders being returned, just to make sure you know.
|
2205 |
*/
|
2206 |
+
function folders($type = 'campaign')
|
2207 |
+
{
|
2208 |
$params = array();
|
2209 |
$params["type"] = $type;
|
2210 |
return $this->callServer("folders", $params);
|
2221 |
* @param string $type optional the type of folder to create - either "campaign" or "autoresponder". Defaults to "campaign"
|
2222 |
* @return int the folder_id of the newly created folder.
|
2223 |
*/
|
2224 |
+
function folderAdd($name, $type = 'campaign')
|
2225 |
+
{
|
2226 |
$params = array();
|
2227 |
$params["name"] = $name;
|
2228 |
$params["type"] = $type;
|
2239 |
* @param string $type optional the type of folder to create - either "campaign" or "autoresponder". Defaults to "campaign"
|
2240 |
* @return bool true if the update worked, otherwise an exception is thrown
|
2241 |
*/
|
2242 |
+
function folderUpdate($fid, $name, $type = 'campaign')
|
2243 |
+
{
|
2244 |
$params = array();
|
2245 |
$params["fid"] = $fid;
|
2246 |
$params["name"] = $name;
|
2257 |
* @param string $type optional the type of folder to create - either "campaign" or "autoresponder". Defaults to "campaign"
|
2258 |
* @return bool true if the delete worked, otherwise an exception is thrown
|
2259 |
*/
|
2260 |
+
function folderDel($fid, $type = 'campaign')
|
2261 |
+
{
|
2262 |
$params = array();
|
2263 |
$params["fid"] = $fid;
|
2264 |
$params["type"] = $type;
|
2276 |
* @return array the total matching orders and the specific orders for the requested page
|
2277 |
* @returnf int total the total matching orders
|
2278 |
* @returnf array data the actual data for each order being returned
|
2279 |
+
* string store_id the store id generated by the plugin used to uniquely identify a store
|
2280 |
+
* string store_name the store name collected by the plugin - often the domain name
|
2281 |
+
* string order_id the internal order id the store tracked this order by
|
2282 |
+
* string email the email address that received this campaign and is associated with this order
|
2283 |
+
* double order_total the order total
|
2284 |
+
* double tax_total the total tax for the order (if collected)
|
2285 |
+
* double ship_total the shipping total for the order (if collected)
|
2286 |
+
* string order_date the date the order was tracked - from the store if possible, otherwise the GMT time we recieved it
|
2287 |
+
* array lines containing detail of the order - product, category, quantity, item cost
|
2288 |
+
*/
|
2289 |
+
function ecommOrders($start = 0, $limit = 100, $since = NULL)
|
2290 |
+
{
|
2291 |
$params = array();
|
2292 |
$params["start"] = $start;
|
2293 |
$params["limit"] = $limit;
|
2301 |
* @section Ecommerce
|
2302 |
*
|
2303 |
* @param array $order an array of information pertaining to the order that has completed. Use the following keys:
|
2304 |
+
* string id the Order Id
|
2305 |
+
* 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
|
2306 |
+
* 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
|
2307 |
+
* double total The Order Total (ie, the full amount the customer ends up paying)
|
2308 |
+
* string order_date optional the date of the order - if this is not provided, we will default the date to now
|
2309 |
+
* double shipping optional the total paid for Shipping Fees
|
2310 |
+
* double tax optional the total tax paid
|
2311 |
+
* string store_id a unique id for the store sending the order in (20 bytes max)
|
2312 |
+
* 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)
|
2313 |
+
* string plugin_id the MailChimp assigned Plugin Id. Get yours by <a href="/api/register.php">registering here</a>
|
2314 |
+
* string campaign_id optional the Campaign Id to track this order with (see the "mc_cid" query string variable a campaign passes)
|
2315 |
+
* array items the individual line items for an order using these keys:
|
2316 |
+
* <div style="padding-left:30px"><table><tr><td colspan=*>
|
2317 |
+
* int line_num optional the line number of the item on the order. We will generate these if they are not passed
|
2318 |
+
* int product_id the store's internal Id for the product. Lines that do no contain this will be skipped
|
2319 |
+
* 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)
|
2320 |
+
* 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
|
2321 |
+
* 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.
|
2322 |
+
* double qty the quantity of the item ordered
|
2323 |
+
* double cost the cost of a single item (ie, not the extended cost of the line)
|
2324 |
+
* </td></tr></table></div>
|
2325 |
* @return bool true if the data is saved, otherwise an error is thrown.
|
2326 |
*/
|
2327 |
+
function ecommOrderAdd($order)
|
2328 |
+
{
|
2329 |
$params = array();
|
2330 |
$params["order"] = $order;
|
2331 |
return $this->callServer("ecommOrderAdd", $params);
|
2340 |
* @param string $order_id the order id (generated by the store) to delete
|
2341 |
* @return bool true if an order is deleted, otherwise an error is thrown.
|
2342 |
*/
|
2343 |
+
function ecommOrderDel($store_id, $order_id)
|
2344 |
+
{
|
2345 |
$params = array();
|
2346 |
$params["store_id"] = $store_id;
|
2347 |
$params["order_id"] = $order_id;
|
2356 |
* @param string $email_address the email address to check OR the email "id" returned from listMemberInfo, Webhooks, and Campaigns
|
2357 |
* @return array An array of list_ids the member is subscribed to.
|
2358 |
*/
|
2359 |
+
function listsForEmail($email_address)
|
2360 |
+
{
|
2361 |
$params = array();
|
2362 |
$params["email_address"] = $email_address;
|
2363 |
return $this->callServer("listsForEmail", $params);
|
2371 |
* @param string $email_address the email address to unsubscribe OR the email "id" returned from listMemberInfo, Webhooks, and Campaigns
|
2372 |
* @return array An array of campaign_ids the member received
|
2373 |
*/
|
2374 |
+
function campaignsForEmail($email_address)
|
2375 |
+
{
|
2376 |
$params = array();
|
2377 |
$params["email_address"] = $email_address;
|
2378 |
return $this->callServer("campaignsForEmail", $params);
|
2391 |
* @returnf string campaign_id the list_id a message relates to, if applicable
|
2392 |
* @returnf string update_time The date/time the message was last updated
|
2393 |
*/
|
2394 |
+
function chimpChatter()
|
2395 |
+
{
|
2396 |
$params = array();
|
2397 |
return $this->callServer("chimpChatter", $params);
|
2398 |
}
|
2412 |
* @returnf string created_at The date the key was created
|
2413 |
* @returnf string expired_at The date the key was expired
|
2414 |
*/
|
2415 |
+
function apikeys($username, $password, $expired = false)
|
2416 |
+
{
|
2417 |
$params = array();
|
2418 |
$params["username"] = $username;
|
2419 |
$params["password"] = $password;
|
2431 |
* @param string $password Your MailChimp password
|
2432 |
* @return string a new API Key that can be immediately used.
|
2433 |
*/
|
2434 |
+
function apikeyAdd($username, $password)
|
2435 |
+
{
|
2436 |
$params = array();
|
2437 |
$params["username"] = $username;
|
2438 |
$params["password"] = $password;
|
2453 |
* @param string $password Your MailChimp password
|
2454 |
* @return boolean true if it worked, otherwise an error is thrown.
|
2455 |
*/
|
2456 |
+
function apikeyExpire($username, $password)
|
2457 |
+
{
|
2458 |
$params = array();
|
2459 |
$params["username"] = $username;
|
2460 |
$params["password"] = $password;
|
2471 |
*
|
2472 |
* @return string returns "Everything's Chimpy!" if everything is chimpy, otherwise returns an error message
|
2473 |
*/
|
2474 |
+
function ping()
|
2475 |
+
{
|
2476 |
$params = array();
|
2477 |
return $this->callServer("ping", $params);
|
2478 |
}
|
2482 |
* @param mixed Method to call, with any parameters to pass along
|
2483 |
* @return mixed the result of the call
|
2484 |
*/
|
2485 |
+
function callMethod()
|
2486 |
+
{
|
2487 |
$params = array();
|
2488 |
return $this->callServer("callMethod", $params);
|
2489 |
}
|
2492 |
* Actually connect to the server and call the requested methods, parsing the result
|
2493 |
* You should never have to call this function manually
|
2494 |
*/
|
2495 |
+
function callServer($method, $params)
|
2496 |
+
{
|
2497 |
|
2498 |
+
$this->requestParams = $params;
|
2499 |
|
2500 |
+
$dc = "us1";
|
2501 |
+
if (strstr($this->api_key, "-")) {
|
2502 |
+
list($key, $dc) = explode("-", $this->api_key, 2);
|
2503 |
if (!$dc) $dc = "us1";
|
2504 |
}
|
2505 |
+
$host = $dc . "." . $this->apiUrl["host"];
|
2506 |
+
$params["apikey"] = $this->api_key;
|
2507 |
|
2508 |
$this->errorMessage = "";
|
2509 |
$this->errorCode = "";
|
2510 |
$sep_changed = false;
|
2511 |
//sigh, apparently some distribs change this to & by default
|
2512 |
+
if (ini_get("arg_separator.output") != "&") {
|
2513 |
$sep_changed = true;
|
2514 |
$orig_sep = ini_get("arg_separator.output");
|
2515 |
ini_set("arg_separator.output", "&");
|
2516 |
}
|
2517 |
$post_vars = http_build_query($params);
|
2518 |
+
if ($sep_changed) {
|
2519 |
ini_set("arg_separator.output", $orig_sep);
|
2520 |
}
|
2521 |
$payload = "POST " . $this->apiUrl["path"] . "?" . $this->apiUrl["query"] . "&method=" . $method . " HTTP/1.0\r\n";
|
2522 |
$payload .= "Host: " . $host . "\r\n";
|
2523 |
//$payload .= "User-Agent: MCAPI/" . $this->version ."\r\n";
|
2524 |
+
$payload .= "User-Agent: " . Mage::helper('monkey')->getUserAgent() . "\r\n";
|
2525 |
$payload .= "Content-type: application/x-www-form-urlencoded\r\n";
|
2526 |
$payload .= "Content-length: " . strlen($post_vars) . "\r\n";
|
2527 |
$payload .= "Connection: close \r\n\r\n";
|
2528 |
$payload .= $post_vars;
|
2529 |
|
2530 |
ob_start();
|
2531 |
+
if ($this->secure) {
|
2532 |
+
$sock = fsockopen("ssl://" . $host, 443, $errno, $errstr, 30);
|
2533 |
} else {
|
2534 |
$sock = fsockopen($host, 80, $errno, $errstr, 30);
|
2535 |
}
|
2536 |
+
if (!$sock) {
|
2537 |
$this->errorMessage = "Could not connect (ERR $errno: $errstr)";
|
2538 |
$this->errorCode = "-99";
|
2539 |
ob_end_clean();
|
2560 |
$headers = explode("\r\n", $headers);
|
2561 |
|
2562 |
$errored = false;
|
2563 |
+
foreach ($headers as $h) {
|
2564 |
+
if (substr($h, 0, 26) === "X-MailChimp-API-Error-Code") {
|
2565 |
$errored = true;
|
2566 |
+
$error_code = trim(substr($h, 27));
|
2567 |
break;
|
2568 |
}
|
2569 |
}
|
2570 |
|
2571 |
+
if (ini_get("magic_quotes_runtime")) $response = stripslashes($response);
|
2572 |
|
2573 |
$serial = unserialize($response);
|
2574 |
+
if ($response && $serial === false) {
|
2575 |
+
$response = array("error" => "Bad Response. Got This: " . $response, "code" => "-99");
|
2576 |
} else {
|
2577 |
+
$response = $serial;
|
2578 |
}
|
2579 |
+
if ($errored && is_array($response) && isset($response["error"])) {
|
2580 |
$this->errorMessage = $response["error"];
|
2581 |
$this->errorCode = $response["code"];
|
2582 |
return false;
|
2583 |
+
} elseif ($errored) {
|
2584 |
$this->errorMessage = "No error message was found";
|
2585 |
$this->errorCode = $error_code;
|
2586 |
return false;
|
app/code/community/Ebizmarts/MageMonkey/Model/MCEXPORTAPI.php
CHANGED
@@ -8,7 +8,6 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_MageMonkey_Model_MCEXPORTAPI extends Ebizmarts_MageMonkey_Model_MCAPI
|
13 |
{
|
14 |
var $version = "1.0";
|
@@ -19,66 +18,68 @@ class Ebizmarts_MageMonkey_Model_MCEXPORTAPI extends Ebizmarts_MageMonkey_Model_
|
|
19 |
* @param string $apikey Your MailChimp apikey
|
20 |
* @param string $secure Whether or not this should use a secure connection
|
21 |
*/
|
22 |
-
function __construct($apikey, $secure=false)
|
|
|
23 |
$this->secure = $secure;
|
24 |
$this->apiUrl = parse_url("http://api.mailchimp.com/export/" . $this->version . "/");
|
25 |
$this->api_key = $apikey;
|
26 |
}
|
27 |
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
$params["id"]
|
35 |
-
$params["status"]
|
36 |
|
37 |
-
if($segment) $params["segment"] = $segment;
|
38 |
-
if($since) $params["since"]
|
39 |
|
40 |
-
|
41 |
-
|
42 |
|
43 |
/**
|
44 |
* Actually connect to the server and call the requested methods, parsing the result
|
45 |
* You should never have to call this function manually
|
46 |
*/
|
47 |
-
function callServer($method, $params)
|
48 |
-
|
49 |
-
|
50 |
-
|
|
|
51 |
if (!$dc) $dc = "us1";
|
52 |
}
|
53 |
-
$host = $dc."."
|
54 |
-
|
55 |
|
56 |
$this->errorMessage = "";
|
57 |
$this->errorCode = "";
|
58 |
$sep_changed = false;
|
59 |
//sigh, apparently some distribs change this to & by default
|
60 |
-
if (ini_get("arg_separator.output")!="&"){
|
61 |
$sep_changed = true;
|
62 |
$orig_sep = ini_get("arg_separator.output");
|
63 |
ini_set("arg_separator.output", "&");
|
64 |
}
|
65 |
$post_vars = http_build_query($params);
|
66 |
-
if ($sep_changed){
|
67 |
ini_set("arg_separator.output", $orig_sep);
|
68 |
}
|
69 |
|
70 |
$payload = "GET " . $this->apiUrl["path"] . $method . "/?" . $post_vars . " HTTP/1.0\r\n";
|
71 |
$payload .= "Host: " . $host . "\r\n";
|
72 |
-
$payload .= "User-Agent: " . Mage::helper('monkey')->getUserAgent() ."\r\n";
|
73 |
$payload .= "Connection: close \r\n\r\n";
|
74 |
|
75 |
ob_start();
|
76 |
-
if ($this->secure){
|
77 |
-
$sock = fsockopen("ssl://"
|
78 |
} else {
|
79 |
$sock = fsockopen($host, 80, $errno, $errstr, 30);
|
80 |
}
|
81 |
-
if(!$sock) {
|
82 |
$this->errorMessage = "Could not connect (ERR $errno: $errstr)";
|
83 |
$this->errorCode = "-99";
|
84 |
ob_end_clean();
|
@@ -105,21 +106,21 @@ class Ebizmarts_MageMonkey_Model_MCEXPORTAPI extends Ebizmarts_MageMonkey_Model_
|
|
105 |
list($headers, $response) = explode("\r\n\r\n", $response, 2);
|
106 |
$headers = explode("\r\n", $headers);
|
107 |
$errored = false;
|
108 |
-
foreach($headers as $h){
|
109 |
-
if (substr($h,0,26)==="X-MailChimp-API-Error-Code"){
|
110 |
$errored = true;
|
111 |
-
$error_code = trim(substr($h,27));
|
112 |
break;
|
113 |
}
|
114 |
}
|
115 |
|
116 |
-
if(ini_get("magic_quotes_runtime")) $response = stripslashes($response);
|
117 |
|
118 |
-
if($errored && is_array($response) && isset($response["error"])) {
|
119 |
$this->errorMessage = $response["error"];
|
120 |
$this->errorCode = $response["code"];
|
121 |
return false;
|
122 |
-
} elseif($errored){
|
123 |
$this->errorMessage = "No error message was found";
|
124 |
$this->errorCode = $error_code;
|
125 |
return false;
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_MageMonkey_Model_MCEXPORTAPI extends Ebizmarts_MageMonkey_Model_MCAPI
|
12 |
{
|
13 |
var $version = "1.0";
|
18 |
* @param string $apikey Your MailChimp apikey
|
19 |
* @param string $secure Whether or not this should use a secure connection
|
20 |
*/
|
21 |
+
function __construct($apikey, $secure = false)
|
22 |
+
{
|
23 |
$this->secure = $secure;
|
24 |
$this->apiUrl = parse_url("http://api.mailchimp.com/export/" . $this->version . "/");
|
25 |
$this->api_key = $apikey;
|
26 |
}
|
27 |
|
28 |
+
/**
|
29 |
+
* @link http://apidocs.mailchimp.com/export/1.0/list.func.php
|
30 |
+
*/
|
31 |
+
public function listExport($id, $status = 'subscribed', $segment = NULL, $since = NULL)
|
32 |
+
{
|
33 |
+
$params = array();
|
34 |
+
$params["id"] = $id;
|
35 |
+
$params["status"] = $status;
|
36 |
|
37 |
+
if ($segment) $params["segment"] = $segment;
|
38 |
+
if ($since) $params["since"] = $since;
|
39 |
|
40 |
+
return $this->callServer("list", $params);
|
41 |
+
}
|
42 |
|
43 |
/**
|
44 |
* Actually connect to the server and call the requested methods, parsing the result
|
45 |
* You should never have to call this function manually
|
46 |
*/
|
47 |
+
function callServer($method, $params)
|
48 |
+
{
|
49 |
+
$dc = "us1";
|
50 |
+
if (strstr($this->api_key, "-")) {
|
51 |
+
list($key, $dc) = explode("-", $this->api_key, 2);
|
52 |
if (!$dc) $dc = "us1";
|
53 |
}
|
54 |
+
$host = $dc . "." . $this->apiUrl["host"];
|
55 |
+
$params["apikey"] = $this->api_key;
|
56 |
|
57 |
$this->errorMessage = "";
|
58 |
$this->errorCode = "";
|
59 |
$sep_changed = false;
|
60 |
//sigh, apparently some distribs change this to & by default
|
61 |
+
if (ini_get("arg_separator.output") != "&") {
|
62 |
$sep_changed = true;
|
63 |
$orig_sep = ini_get("arg_separator.output");
|
64 |
ini_set("arg_separator.output", "&");
|
65 |
}
|
66 |
$post_vars = http_build_query($params);
|
67 |
+
if ($sep_changed) {
|
68 |
ini_set("arg_separator.output", $orig_sep);
|
69 |
}
|
70 |
|
71 |
$payload = "GET " . $this->apiUrl["path"] . $method . "/?" . $post_vars . " HTTP/1.0\r\n";
|
72 |
$payload .= "Host: " . $host . "\r\n";
|
73 |
+
$payload .= "User-Agent: " . Mage::helper('monkey')->getUserAgent() . "\r\n";
|
74 |
$payload .= "Connection: close \r\n\r\n";
|
75 |
|
76 |
ob_start();
|
77 |
+
if ($this->secure) {
|
78 |
+
$sock = fsockopen("ssl://" . $host, 443, $errno, $errstr, 30);
|
79 |
} else {
|
80 |
$sock = fsockopen($host, 80, $errno, $errstr, 30);
|
81 |
}
|
82 |
+
if (!$sock) {
|
83 |
$this->errorMessage = "Could not connect (ERR $errno: $errstr)";
|
84 |
$this->errorCode = "-99";
|
85 |
ob_end_clean();
|
106 |
list($headers, $response) = explode("\r\n\r\n", $response, 2);
|
107 |
$headers = explode("\r\n", $headers);
|
108 |
$errored = false;
|
109 |
+
foreach ($headers as $h) {
|
110 |
+
if (substr($h, 0, 26) === "X-MailChimp-API-Error-Code") {
|
111 |
$errored = true;
|
112 |
+
$error_code = trim(substr($h, 27));
|
113 |
break;
|
114 |
}
|
115 |
}
|
116 |
|
117 |
+
if (ini_get("magic_quotes_runtime")) $response = stripslashes($response);
|
118 |
|
119 |
+
if ($errored && is_array($response) && isset($response["error"])) {
|
120 |
$this->errorMessage = $response["error"];
|
121 |
$this->errorCode = $response["code"];
|
122 |
return false;
|
123 |
+
} elseif ($errored) {
|
124 |
$this->errorMessage = "No error message was found";
|
125 |
$this->errorCode = $error_code;
|
126 |
return false;
|
app/code/community/Ebizmarts/MageMonkey/Model/Monkey.php
CHANGED
@@ -8,8 +8,8 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
-
|
13 |
/**
|
14 |
* Webhooks request url path
|
15 |
*
|
@@ -24,7 +24,8 @@ class Ebizmarts_MageMonkey_Model_Monkey {
|
|
24 |
* @param array $data
|
25 |
* @return void
|
26 |
*/
|
27 |
-
public function processWebhookData(array $data)
|
|
|
28 |
$listId = $data['data']['list_id']; //According to the docs, the events are always related to a list_id
|
29 |
$store = Mage::helper('monkey')->getStoreByList($listId);
|
30 |
|
@@ -38,23 +39,23 @@ class Ebizmarts_MageMonkey_Model_Monkey {
|
|
38 |
$object->requestParams = array();
|
39 |
$object->requestParams['id'] = $listId;
|
40 |
|
41 |
-
if(
|
42 |
-
$object->requestParams['email_address']
|
43 |
}
|
44 |
$cacheHelper = Mage::helper('monkey/cache');
|
45 |
|
46 |
switch ($data['type']) {
|
47 |
case 'subscribe':
|
48 |
-
|
49 |
-
|
50 |
break;
|
51 |
case 'unsubscribe':
|
52 |
$this->_unsubscribe($data);
|
53 |
-
|
54 |
break;
|
55 |
case 'cleaned':
|
56 |
$this->_clean($data);
|
57 |
-
|
58 |
break;
|
59 |
case 'campaign':
|
60 |
$this->_campaign($data);
|
@@ -62,7 +63,7 @@ class Ebizmarts_MageMonkey_Model_Monkey {
|
|
62 |
//case 'profile': Cuando se actualiza email en MC como merchant, te manda un upmail y un profile (no siempre en el mismo órden)
|
63 |
case 'upemail':
|
64 |
$this->_updateEmail($data);
|
65 |
-
|
66 |
break;
|
67 |
case 'profile':
|
68 |
$this->_profile($data);
|
@@ -80,7 +81,8 @@ class Ebizmarts_MageMonkey_Model_Monkey {
|
|
80 |
* @param array $data
|
81 |
* @return void
|
82 |
*/
|
83 |
-
protected function _updateEmail(array $data)
|
|
|
84 |
|
85 |
$old = $data['data']['old_email'];
|
86 |
$new = $data['data']['new_email'];
|
@@ -90,13 +92,13 @@ class Ebizmarts_MageMonkey_Model_Monkey {
|
|
90 |
|
91 |
if (!$newSubscriber->getId() && $oldSubscriber->getId()) {
|
92 |
$oldSubscriber->setSubscriberEmail($new)
|
93 |
-
|
94 |
} elseif (!$newSubscriber->getId() && !$oldSubscriber->getId()) {
|
95 |
|
96 |
Mage::getModel('newsletter/subscriber')
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
}
|
101 |
}
|
102 |
|
@@ -106,15 +108,16 @@ class Ebizmarts_MageMonkey_Model_Monkey {
|
|
106 |
* @param array $data
|
107 |
* @return void
|
108 |
*/
|
109 |
-
protected function _clean(array $data)
|
|
|
110 |
|
111 |
-
if(Mage::helper('monkey')->isAdminNotificationEnabled()) {
|
112 |
$text = Mage::helper('monkey')->__('MailChimp Cleaned Emails: %s %s at %s reason: %s', $data['data']['email'], $data['type'], $data['fired_at'], $data['data']['reason']);
|
113 |
|
114 |
$this->_getInbox()
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
}
|
119 |
|
120 |
//Delete subscriber from Magento
|
@@ -135,15 +138,16 @@ class Ebizmarts_MageMonkey_Model_Monkey {
|
|
135 |
* @param array $data
|
136 |
* @return void
|
137 |
*/
|
138 |
-
protected function _campaign(array $data)
|
|
|
139 |
|
140 |
-
if(Mage::helper('monkey')->isAdminNotificationEnabled()) {
|
141 |
$text = Mage::helper('monkey')->__('MailChimp Campaign Send: %s %s at %s', $data['data']['subject'], $data['data']['status'], $data['fired_at']);
|
142 |
|
143 |
$this->_getInbox()
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
}
|
148 |
|
149 |
}
|
@@ -154,7 +158,8 @@ class Ebizmarts_MageMonkey_Model_Monkey {
|
|
154 |
* @param array $data
|
155 |
* @return void
|
156 |
*/
|
157 |
-
protected function _subscribe(array $data)
|
|
|
158 |
try {
|
159 |
|
160 |
//TODO: El método subscribe de Subscriber (Magento) hace un load by email
|
@@ -162,13 +167,13 @@ class Ebizmarts_MageMonkey_Model_Monkey {
|
|
162 |
//VALIDAR si es lo que se requiere
|
163 |
|
164 |
$subscriber = Mage::getModel('newsletter/subscriber')
|
165 |
-
|
166 |
if ($subscriber->getId()) {
|
167 |
$subscriber->setStatus(Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED)
|
168 |
-
|
169 |
} else {
|
170 |
Mage::getModel('newsletter/subscriber')->setImportMode(TRUE)
|
171 |
-
|
172 |
}
|
173 |
} catch (Exception $e) {
|
174 |
Mage::logException($e);
|
@@ -181,23 +186,24 @@ class Ebizmarts_MageMonkey_Model_Monkey {
|
|
181 |
* @param array $data
|
182 |
* @return void
|
183 |
*/
|
184 |
-
protected function _unsubscribe(array $data)
|
|
|
185 |
$subscriber = $this->loadByEmail($data['data']['email']);
|
186 |
|
187 |
-
if(!$subscriber->getId()){
|
188 |
-
|
189 |
-
|
190 |
}
|
191 |
|
192 |
-
if($subscriber->getId()){
|
193 |
try {
|
194 |
|
195 |
switch ($data['data']['action']) {
|
196 |
case 'delete' :
|
197 |
//if config setting "Webhooks Delete action" is set as "Delete customer account"
|
198 |
-
if(Mage::getStoreConfig("monkey/general/webhook_delete") == 1){
|
199 |
$subscriber->delete();
|
200 |
-
}else{
|
201 |
$subscriber->setImportMode(TRUE)->unsubscribe();
|
202 |
}
|
203 |
break;
|
@@ -211,7 +217,8 @@ class Ebizmarts_MageMonkey_Model_Monkey {
|
|
211 |
}
|
212 |
}
|
213 |
|
214 |
-
protected function _profile($data)
|
|
|
215 |
|
216 |
$subscriber = $this->loadByEmail($data['email']);
|
217 |
$storeId = $subscriber->getStoreId();
|
@@ -219,9 +226,9 @@ class Ebizmarts_MageMonkey_Model_Monkey {
|
|
219 |
|
220 |
$customerCollection = Mage::getModel('customer/customer')->getCollection()
|
221 |
->addFieldToFilter('email', array('eq' => $data['email']));
|
222 |
-
if(count($customerCollection) > 0){
|
223 |
$toUpdate = $customerCollection->getFirstItem();
|
224 |
-
}else{
|
225 |
$toUpdate = $subscriber;
|
226 |
}
|
227 |
|
@@ -229,11 +236,12 @@ class Ebizmarts_MageMonkey_Model_Monkey {
|
|
229 |
|
230 |
}
|
231 |
|
232 |
-
protected function _mapFieldsToMagento($data, $toUpdate, $storeId)
|
|
|
233 |
$mapMerges = Mage::getStoreConfig(Ebizmarts_MageMonkey_Model_Config::GENERAL_MAP_FIELDS, $storeId);
|
234 |
|
235 |
-
foreach($data['merges'] as $merge){
|
236 |
-
if(in_array($merge, $mapMerges['mailchimp'])){
|
237 |
|
238 |
}
|
239 |
}
|
@@ -245,10 +253,11 @@ class Ebizmarts_MageMonkey_Model_Monkey {
|
|
245 |
*
|
246 |
* @return Mage_AdminNotification_Model_Inbox
|
247 |
*/
|
248 |
-
protected function _getInbox()
|
|
|
249 |
return Mage::getModel('adminnotification/inbox')
|
250 |
-
|
251 |
-
|
252 |
}
|
253 |
|
254 |
/**
|
@@ -257,12 +266,13 @@ class Ebizmarts_MageMonkey_Model_Monkey {
|
|
257 |
* @param string $email
|
258 |
* @return Mage_Newsletter_Model_Subscriber
|
259 |
*/
|
260 |
-
public function loadByEmail($email)
|
|
|
261 |
return Mage::getModel('newsletter/subscriber')
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
}
|
267 |
|
268 |
}
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
+
class Ebizmarts_MageMonkey_Model_Monkey
|
12 |
+
{
|
13 |
/**
|
14 |
* Webhooks request url path
|
15 |
*
|
24 |
* @param array $data
|
25 |
* @return void
|
26 |
*/
|
27 |
+
public function processWebhookData(array $data)
|
28 |
+
{
|
29 |
$listId = $data['data']['list_id']; //According to the docs, the events are always related to a list_id
|
30 |
$store = Mage::helper('monkey')->getStoreByList($listId);
|
31 |
|
39 |
$object->requestParams = array();
|
40 |
$object->requestParams['id'] = $listId;
|
41 |
|
42 |
+
if (isset($data['data']['email'])) {
|
43 |
+
$object->requestParams['email_address'] = $data['data']['email'];
|
44 |
}
|
45 |
$cacheHelper = Mage::helper('monkey/cache');
|
46 |
|
47 |
switch ($data['type']) {
|
48 |
case 'subscribe':
|
49 |
+
$this->_subscribe($data);
|
50 |
+
$cacheHelper->clearCache('listSubscribe', $object);
|
51 |
break;
|
52 |
case 'unsubscribe':
|
53 |
$this->_unsubscribe($data);
|
54 |
+
$cacheHelper->clearCache('listUnsubscribe', $object);
|
55 |
break;
|
56 |
case 'cleaned':
|
57 |
$this->_clean($data);
|
58 |
+
$cacheHelper->clearCache('listUnsubscribe', $object);
|
59 |
break;
|
60 |
case 'campaign':
|
61 |
$this->_campaign($data);
|
63 |
//case 'profile': Cuando se actualiza email en MC como merchant, te manda un upmail y un profile (no siempre en el mismo órden)
|
64 |
case 'upemail':
|
65 |
$this->_updateEmail($data);
|
66 |
+
$cacheHelper->clearCache('listUpdateMember', $object);
|
67 |
break;
|
68 |
case 'profile':
|
69 |
$this->_profile($data);
|
81 |
* @param array $data
|
82 |
* @return void
|
83 |
*/
|
84 |
+
protected function _updateEmail(array $data)
|
85 |
+
{
|
86 |
|
87 |
$old = $data['data']['old_email'];
|
88 |
$new = $data['data']['new_email'];
|
92 |
|
93 |
if (!$newSubscriber->getId() && $oldSubscriber->getId()) {
|
94 |
$oldSubscriber->setSubscriberEmail($new)
|
95 |
+
->save();
|
96 |
} elseif (!$newSubscriber->getId() && !$oldSubscriber->getId()) {
|
97 |
|
98 |
Mage::getModel('newsletter/subscriber')
|
99 |
+
->setImportMode(TRUE)
|
100 |
+
->setStoreId(Mage::app()->getStore()->getId())
|
101 |
+
->subscribe($new);
|
102 |
}
|
103 |
}
|
104 |
|
108 |
* @param array $data
|
109 |
* @return void
|
110 |
*/
|
111 |
+
protected function _clean(array $data)
|
112 |
+
{
|
113 |
|
114 |
+
if (Mage::helper('monkey')->isAdminNotificationEnabled()) {
|
115 |
$text = Mage::helper('monkey')->__('MailChimp Cleaned Emails: %s %s at %s reason: %s', $data['data']['email'], $data['type'], $data['fired_at'], $data['data']['reason']);
|
116 |
|
117 |
$this->_getInbox()
|
118 |
+
->setTitle($text)
|
119 |
+
->setDescription($text)
|
120 |
+
->save();
|
121 |
}
|
122 |
|
123 |
//Delete subscriber from Magento
|
138 |
* @param array $data
|
139 |
* @return void
|
140 |
*/
|
141 |
+
protected function _campaign(array $data)
|
142 |
+
{
|
143 |
|
144 |
+
if (Mage::helper('monkey')->isAdminNotificationEnabled()) {
|
145 |
$text = Mage::helper('monkey')->__('MailChimp Campaign Send: %s %s at %s', $data['data']['subject'], $data['data']['status'], $data['fired_at']);
|
146 |
|
147 |
$this->_getInbox()
|
148 |
+
->setTitle($text)
|
149 |
+
->setDescription($text)
|
150 |
+
->save();
|
151 |
}
|
152 |
|
153 |
}
|
158 |
* @param array $data
|
159 |
* @return void
|
160 |
*/
|
161 |
+
protected function _subscribe(array $data)
|
162 |
+
{
|
163 |
try {
|
164 |
|
165 |
//TODO: El método subscribe de Subscriber (Magento) hace un load by email
|
167 |
//VALIDAR si es lo que se requiere
|
168 |
|
169 |
$subscriber = Mage::getModel('newsletter/subscriber')
|
170 |
+
->loadByEmail($data['data']['email']);
|
171 |
if ($subscriber->getId()) {
|
172 |
$subscriber->setStatus(Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED)
|
173 |
+
->save();
|
174 |
} else {
|
175 |
Mage::getModel('newsletter/subscriber')->setImportMode(TRUE)
|
176 |
+
->subscribe($data['data']['email']);
|
177 |
}
|
178 |
} catch (Exception $e) {
|
179 |
Mage::logException($e);
|
186 |
* @param array $data
|
187 |
* @return void
|
188 |
*/
|
189 |
+
protected function _unsubscribe(array $data)
|
190 |
+
{
|
191 |
$subscriber = $this->loadByEmail($data['data']['email']);
|
192 |
|
193 |
+
if (!$subscriber->getId()) {
|
194 |
+
$subscriber = Mage::getModel('newsletter/subscriber')
|
195 |
+
->loadByEmail($data['data']['email']);
|
196 |
}
|
197 |
|
198 |
+
if ($subscriber->getId()) {
|
199 |
try {
|
200 |
|
201 |
switch ($data['data']['action']) {
|
202 |
case 'delete' :
|
203 |
//if config setting "Webhooks Delete action" is set as "Delete customer account"
|
204 |
+
if (Mage::getStoreConfig("monkey/general/webhook_delete") == 1) {
|
205 |
$subscriber->delete();
|
206 |
+
} else {
|
207 |
$subscriber->setImportMode(TRUE)->unsubscribe();
|
208 |
}
|
209 |
break;
|
217 |
}
|
218 |
}
|
219 |
|
220 |
+
protected function _profile($data)
|
221 |
+
{
|
222 |
|
223 |
$subscriber = $this->loadByEmail($data['email']);
|
224 |
$storeId = $subscriber->getStoreId();
|
226 |
|
227 |
$customerCollection = Mage::getModel('customer/customer')->getCollection()
|
228 |
->addFieldToFilter('email', array('eq' => $data['email']));
|
229 |
+
if (count($customerCollection) > 0) {
|
230 |
$toUpdate = $customerCollection->getFirstItem();
|
231 |
+
} else {
|
232 |
$toUpdate = $subscriber;
|
233 |
}
|
234 |
|
236 |
|
237 |
}
|
238 |
|
239 |
+
protected function _mapFieldsToMagento($data, $toUpdate, $storeId)
|
240 |
+
{
|
241 |
$mapMerges = Mage::getStoreConfig(Ebizmarts_MageMonkey_Model_Config::GENERAL_MAP_FIELDS, $storeId);
|
242 |
|
243 |
+
foreach ($data['merges'] as $merge) {
|
244 |
+
if (in_array($merge, $mapMerges['mailchimp'])) {
|
245 |
|
246 |
}
|
247 |
}
|
253 |
*
|
254 |
* @return Mage_AdminNotification_Model_Inbox
|
255 |
*/
|
256 |
+
protected function _getInbox()
|
257 |
+
{
|
258 |
return Mage::getModel('adminnotification/inbox')
|
259 |
+
->setSeverity(4)//Notice
|
260 |
+
->setDateAdded(Mage::getModel('core/date')->gmtDate());
|
261 |
}
|
262 |
|
263 |
/**
|
266 |
* @param string $email
|
267 |
* @return Mage_Newsletter_Model_Subscriber
|
268 |
*/
|
269 |
+
public function loadByEmail($email)
|
270 |
+
{
|
271 |
return Mage::getModel('newsletter/subscriber')
|
272 |
+
->getCollection()
|
273 |
+
->addFieldToFilter('subscriber_email', $email)
|
274 |
+
->addFieldToFilter('store_id', Mage::app()->getStore()->getId())
|
275 |
+
->getFirstItem();
|
276 |
}
|
277 |
|
278 |
}
|
app/code/community/Ebizmarts/MageMonkey/Model/Mysql4/Apidebug.php
CHANGED
@@ -8,15 +8,14 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_MageMonkey_Model_Mysql4_Apidebug extends Mage_Core_Model_Mysql4_Abstract
|
13 |
{
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
public function _construct()
|
21 |
{
|
22 |
$this->_init('monkey/apidebug', 'debug_id');
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_MageMonkey_Model_Mysql4_Apidebug extends Mage_Core_Model_Mysql4_Abstract
|
12 |
{
|
13 |
|
14 |
+
/**
|
15 |
+
* Initialize
|
16 |
+
*
|
17 |
+
* @return void
|
18 |
+
*/
|
19 |
public function _construct()
|
20 |
{
|
21 |
$this->_init('monkey/apidebug', 'debug_id');
|
app/code/community/Ebizmarts/MageMonkey/Model/Mysql4/Apidebug/Collection.php
CHANGED
@@ -8,15 +8,14 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_MageMonkey_Model_Mysql4_Apidebug_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
13 |
{
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
public function _construct()
|
21 |
{
|
22 |
parent::_construct();
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_MageMonkey_Model_Mysql4_Apidebug_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
12 |
{
|
13 |
|
14 |
+
/**
|
15 |
+
* Set resource type
|
16 |
+
*
|
17 |
+
* @return void
|
18 |
+
*/
|
19 |
public function _construct()
|
20 |
{
|
21 |
parent::_construct();
|
app/code/community/Ebizmarts/MageMonkey/Model/Mysql4/Asyncorders.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* Author : Ebizmarts <info@ebizmarts.com>
|
4 |
* Date : 9/12/14
|
1 |
<?php
|
2 |
+
|
3 |
/**
|
4 |
* Author : Ebizmarts <info@ebizmarts.com>
|
5 |
* Date : 9/12/14
|
app/code/community/Ebizmarts/MageMonkey/Model/Mysql4/Asyncorders/Collection.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* Author : Ebizmarts <info@ebizmarts.com>
|
4 |
* Date : 9/12/14
|
1 |
<?php
|
2 |
+
|
3 |
/**
|
4 |
* Author : Ebizmarts <info@ebizmarts.com>
|
5 |
* Date : 9/12/14
|
app/code/community/Ebizmarts/MageMonkey/Model/Mysql4/Asyncsubscribers.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* Author : Ebizmarts <info@ebizmarts.com>
|
4 |
* Date : 9/12/14
|
1 |
<?php
|
2 |
+
|
3 |
/**
|
4 |
* Author : Ebizmarts <info@ebizmarts.com>
|
5 |
* Date : 9/12/14
|
app/code/community/Ebizmarts/MageMonkey/Model/Mysql4/Asyncsubscribers/Collection.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* Author : Ebizmarts <info@ebizmarts.com>
|
4 |
* Date : 9/12/14
|
@@ -6,7 +7,7 @@
|
|
6 |
* File : Collection.php
|
7 |
* Module : Ebizmarts_MageMonkey
|
8 |
*/
|
9 |
-
class Ebizmarts_MageMonkey_Model_Mysql4_Asyncsubscribers_Collection
|
10 |
{
|
11 |
|
12 |
/**
|
1 |
<?php
|
2 |
+
|
3 |
/**
|
4 |
* Author : Ebizmarts <info@ebizmarts.com>
|
5 |
* Date : 9/12/14
|
7 |
* File : Collection.php
|
8 |
* Module : Ebizmarts_MageMonkey
|
9 |
*/
|
10 |
+
class Ebizmarts_MageMonkey_Model_Mysql4_Asyncsubscribers_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
11 |
{
|
12 |
|
13 |
/**
|
app/code/community/Ebizmarts/MageMonkey/Model/Mysql4/Bulksync/Export.php
CHANGED
@@ -8,26 +8,25 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_MageMonkey_Model_Mysql4_Bulksync_Export extends Mage_Core_Model_Mysql4_Abstract
|
13 |
{
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
public function _construct()
|
21 |
{
|
22 |
$this->_init('monkey/bulksync_export', 'id');
|
23 |
}
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
protected function _beforeSave(Mage_Core_Model_Abstract $object)
|
32 |
{
|
33 |
if (!$object->getCreatedAt()) {
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_MageMonkey_Model_Mysql4_Bulksync_Export extends Mage_Core_Model_Mysql4_Abstract
|
12 |
{
|
13 |
|
14 |
+
/**
|
15 |
+
* Initialize model
|
16 |
+
*
|
17 |
+
* @return void
|
18 |
+
*/
|
19 |
public function _construct()
|
20 |
{
|
21 |
$this->_init('monkey/bulksync_export', 'id');
|
22 |
}
|
23 |
|
24 |
+
/**
|
25 |
+
* Before save callback, set <created_at> and <updated_at> values
|
26 |
+
*
|
27 |
+
* @param Mage_Core_Model_Abstract $object
|
28 |
+
* @return void
|
29 |
+
*/
|
30 |
protected function _beforeSave(Mage_Core_Model_Abstract $object)
|
31 |
{
|
32 |
if (!$object->getCreatedAt()) {
|
app/code/community/Ebizmarts/MageMonkey/Model/Mysql4/Bulksync/Export/Collection.php
CHANGED
@@ -8,28 +8,27 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_MageMonkey_Model_Mysql4_Bulksync_Export_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
13 |
{
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
public function _construct()
|
21 |
{
|
22 |
parent::_construct();
|
23 |
$this->_init('monkey/bulksync_export');
|
24 |
}
|
25 |
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
function setItemObjectClass($className)
|
34 |
{
|
35 |
$this->_itemObjectClass = 'Ebizmarts_MageMonkey_Model_BulksyncExport';
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_MageMonkey_Model_Mysql4_Bulksync_Export_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
12 |
{
|
13 |
|
14 |
+
/**
|
15 |
+
* Initialize
|
16 |
+
*
|
17 |
+
* @return void
|
18 |
+
*/
|
19 |
public function _construct()
|
20 |
{
|
21 |
parent::_construct();
|
22 |
$this->_init('monkey/bulksync_export');
|
23 |
}
|
24 |
|
25 |
+
/**
|
26 |
+
* Override parent method
|
27 |
+
*
|
28 |
+
* @see Varien_Data_Collection
|
29 |
+
* @param string $className
|
30 |
+
* @return Ebizmarts_MageMonkey_Model_Mysql4_Bulksync_Export_Collection
|
31 |
+
*/
|
32 |
function setItemObjectClass($className)
|
33 |
{
|
34 |
$this->_itemObjectClass = 'Ebizmarts_MageMonkey_Model_BulksyncExport';
|
app/code/community/Ebizmarts/MageMonkey/Model/Mysql4/Bulksync/Import.php
CHANGED
@@ -8,26 +8,25 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_MageMonkey_Model_Mysql4_Bulksync_Import extends Mage_Core_Model_Mysql4_Abstract
|
13 |
{
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
public function _construct()
|
21 |
{
|
22 |
$this->_init('monkey/bulksync_import', 'id');
|
23 |
}
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
protected function _beforeSave(Mage_Core_Model_Abstract $object)
|
32 |
{
|
33 |
if (!$object->getCreatedAt()) {
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_MageMonkey_Model_Mysql4_Bulksync_Import extends Mage_Core_Model_Mysql4_Abstract
|
12 |
{
|
13 |
|
14 |
+
/**
|
15 |
+
* Initialize model
|
16 |
+
*
|
17 |
+
* @return void
|
18 |
+
*/
|
19 |
public function _construct()
|
20 |
{
|
21 |
$this->_init('monkey/bulksync_import', 'id');
|
22 |
}
|
23 |
|
24 |
+
/**
|
25 |
+
* Before save callback, set <created_at> and <updated_at> values
|
26 |
+
*
|
27 |
+
* @param Mage_Core_Model_Abstract $object
|
28 |
+
* @return void
|
29 |
+
*/
|
30 |
protected function _beforeSave(Mage_Core_Model_Abstract $object)
|
31 |
{
|
32 |
if (!$object->getCreatedAt()) {
|
app/code/community/Ebizmarts/MageMonkey/Model/Mysql4/Bulksync/Import/Collection.php
CHANGED
@@ -8,28 +8,27 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_MageMonkey_Model_Mysql4_Bulksync_Import_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
13 |
{
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
public function _construct()
|
21 |
{
|
22 |
parent::_construct();
|
23 |
$this->_init('monkey/bulksync_import');
|
24 |
}
|
25 |
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
function setItemObjectClass($className)
|
34 |
{
|
35 |
$this->_itemObjectClass = 'Ebizmarts_MageMonkey_Model_BulksyncImport';
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_MageMonkey_Model_Mysql4_Bulksync_Import_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
12 |
{
|
13 |
|
14 |
+
/**
|
15 |
+
* Initialize
|
16 |
+
*
|
17 |
+
* @return void
|
18 |
+
*/
|
19 |
public function _construct()
|
20 |
{
|
21 |
parent::_construct();
|
22 |
$this->_init('monkey/bulksync_import');
|
23 |
}
|
24 |
|
25 |
+
/**
|
26 |
+
* Override parent method
|
27 |
+
*
|
28 |
+
* @see Varien_Data_Collection
|
29 |
+
* @param string $className
|
30 |
+
* @return Ebizmarts_MageMonkey_Model_Mysql4_Bulksync_Export_Collection
|
31 |
+
*/
|
32 |
function setItemObjectClass($className)
|
33 |
{
|
34 |
$this->_itemObjectClass = 'Ebizmarts_MageMonkey_Model_BulksyncImport';
|
app/code/community/Ebizmarts/MageMonkey/Model/Mysql4/Ecommerce.php
CHANGED
@@ -8,15 +8,14 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_MageMonkey_Model_Mysql4_Ecommerce extends Mage_Core_Model_Mysql4_Abstract
|
13 |
{
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
public function _construct()
|
21 |
{
|
22 |
$this->_init('monkey/ecommerce', 'id');
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_MageMonkey_Model_Mysql4_Ecommerce extends Mage_Core_Model_Mysql4_Abstract
|
12 |
{
|
13 |
|
14 |
+
/**
|
15 |
+
* Initialize
|
16 |
+
*
|
17 |
+
* @return void
|
18 |
+
*/
|
19 |
public function _construct()
|
20 |
{
|
21 |
$this->_init('monkey/ecommerce', 'id');
|
app/code/community/Ebizmarts/MageMonkey/Model/Mysql4/Ecommerce/Collection.php
CHANGED
@@ -8,15 +8,14 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_MageMonkey_Model_Mysql4_Ecommerce_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
13 |
{
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
public function _construct()
|
21 |
{
|
22 |
parent::_construct();
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_MageMonkey_Model_Mysql4_Ecommerce_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
12 |
{
|
13 |
|
14 |
+
/**
|
15 |
+
* Initialize
|
16 |
+
*
|
17 |
+
* @return void
|
18 |
+
*/
|
19 |
public function _construct()
|
20 |
{
|
21 |
parent::_construct();
|
app/code/community/Ebizmarts/MageMonkey/Model/Observer.php
CHANGED
@@ -8,52 +8,53 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_MageMonkey_Model_Observer
|
13 |
{
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
Mage::
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
}
|
30 |
|
31 |
$subscriber = $observer->getEvent()->getSubscriber();
|
32 |
-
|
33 |
-
|
|
|
|
|
|
|
|
|
|
|
34 |
$subscriber->setStatus(Mage_Newsletter_Model_Subscriber::STATUS_UNCONFIRMED);
|
35 |
-
|
36 |
$subscriber->setStatus(Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED);
|
37 |
}
|
38 |
|
39 |
-
|
40 |
-
return $observer;
|
41 |
-
}
|
42 |
-
|
43 |
-
if(Mage::getSingleton('core/session')->getIsOneStepCheckout() && !Mage::getSingleton('core/session')->getMonkeyCheckout()){
|
44 |
return $observer;
|
45 |
}
|
46 |
|
47 |
-
|
48 |
-
|
|
|
49 |
|
|
|
50 |
Mage::getSingleton('core/session')->setIsHandleSubscriber(TRUE);
|
51 |
-
if (Mage::getSingleton('core/session')->getIsOneStepCheckout() || Mage::getSingleton('core/session')->getMonkeyCheckout()
|
52 |
$saveOnDb = Mage::helper('monkey')->config('checkout_async');
|
53 |
Mage::helper('monkey')->subscribeToList($subscriber, $saveOnDb);
|
54 |
} else {
|
55 |
$post = Mage::app()->getRequest()->getPost();
|
56 |
-
if(isset($post['magemonkey_subscribe']) && $post['magemonkey_subscribe'] ||
|
57 |
Mage::helper('monkey')->subscribeToList($subscriber, 0);
|
58 |
}
|
59 |
}
|
@@ -64,374 +65,366 @@ class Ebizmarts_MageMonkey_Model_Observer
|
|
64 |
}
|
65 |
|
66 |
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
|
84 |
-
|
85 |
-
|
86 |
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
|
91 |
-
|
92 |
|
93 |
-
|
94 |
-
|
95 |
|
96 |
-
|
97 |
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
|
108 |
//Do nothing for data saving actions
|
109 |
if ($action->getRequest()->isPost() || $action->getRequest()->getQuery('isAjax')) {
|
110 |
return $observer;
|
111 |
}
|
112 |
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
|
117 |
-
|
118 |
-
|
119 |
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
{
|
128 |
-
if(Mage::app()->getRequest()->getParam('store')) {
|
129 |
$scope = 'store';
|
130 |
-
}
|
131 |
-
elseif(Mage::app()->getRequest()->getParam('website')) {
|
132 |
$scope = 'website';
|
133 |
-
}
|
134 |
-
else {
|
135 |
$scope = 'default';
|
136 |
}
|
137 |
|
138 |
-
$store = is_null($observer->getEvent()->getStore()) ? Mage::app()->getDefaultStoreView()->getCode(): $observer->getEvent()->getStore();
|
139 |
-
|
140 |
-
|
141 |
|
142 |
-
if(!Mage::getStoreConfig(Ebizmarts_MageMonkey_Model_Config::GENERAL_ACTIVE, $store)) {
|
143 |
-
$config =
|
144 |
-
$config->saveConfig(Ebizmarts_MageMonkey_Model_Config::ECOMMERCE360_ACTIVE,false
|
145 |
Mage::getConfig()->cleanCache();
|
146 |
}
|
147 |
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
{
|
185 |
-
if((string)$post['groups']['general']['fields']['additional_lists']['inherit'] == 1)
|
186 |
-
{
|
187 |
-
$additionalLists = Mage::helper('monkey')->getAdditionalList(Mage::app()->getStore()->getId());
|
188 |
-
}
|
189 |
-
}
|
190 |
-
|
191 |
-
if(!$selectedLists[0])
|
192 |
-
{
|
193 |
$message = Mage::helper('monkey')->__('There is no List selected please save the configuration again');
|
194 |
Mage::getSingleton('adminhtml/session')->addWarning($message);
|
195 |
-
}elseif(is_array($additionalLists)){
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
}
|
202 |
-
$selectedLists = array_merge($selectedLists, $additionalLists);
|
203 |
-
}
|
204 |
-
|
205 |
-
$webhooksKey = Mage::helper('monkey')->getWebhooksKey();
|
206 |
-
|
207 |
-
//Generating Webhooks URL
|
208 |
-
$hookUrl = '';
|
209 |
-
try{
|
210 |
-
$hookUrl = Mage::getModel('core/url')->setStore($store)->getUrl(Ebizmarts_MageMonkey_Model_Monkey::WEBHOOKS_PATH, array('wkey' => $webhooksKey));
|
211 |
-
}catch(Exception $e){
|
212 |
-
$hookUrl = Mage::getModel('core/url')->getUrl(Ebizmarts_MageMonkey_Model_Monkey::WEBHOOKS_PATH, array('wkey' => $webhooksKey));
|
213 |
-
}
|
214 |
-
|
215 |
-
if(FALSE != strstr($hookUrl, '?', true)){
|
216 |
-
$hookUrl = strstr($hookUrl, '?', true);
|
217 |
-
}
|
218 |
-
|
219 |
-
$api = Mage::getSingleton('monkey/api', array('apikey' => $apiKey));
|
220 |
-
|
221 |
-
//Validate API KEY
|
222 |
-
$api->ping();
|
223 |
-
if($api->errorCode){
|
224 |
-
Mage::getSingleton('adminhtml/session')->addError($api->errorMessage);
|
225 |
-
return $observer;
|
226 |
-
}
|
227 |
-
|
228 |
-
$lists = $api->lists();
|
229 |
-
|
230 |
-
foreach($lists['data'] as $list){
|
231 |
-
|
232 |
-
if(in_array($list['id'], $selectedLists)){
|
233 |
-
|
234 |
-
/**
|
235 |
-
* Customer Group - Interest Grouping
|
236 |
-
*/
|
237 |
-
$magentoGroups = Mage::helper('customer')->getGroups()->toOptionHash();
|
238 |
-
array_push($magentoGroups, "NOT LOGGED IN");
|
239 |
-
$customerGroup = array('field_type' => 'dropdown', 'choices' => $magentoGroups);
|
240 |
-
$mergeVars = $api->listMergeVars($list['id']);
|
241 |
-
$mergeExist = false;
|
242 |
-
foreach($mergeVars as $vars) {
|
243 |
-
if($vars['tag'] == 'CGROUP'){
|
244 |
-
$mergeExist = true;
|
245 |
-
if($magentoGroups === $vars['choices']){
|
246 |
-
$update = false;
|
247 |
-
}else{
|
248 |
-
$update = true;
|
249 |
-
}
|
250 |
-
}
|
251 |
-
}
|
252 |
-
if($mergeExist){
|
253 |
-
if($update){
|
254 |
-
$newValue = array('choices' => $magentoGroups);
|
255 |
-
$api->listMergeVarUpdate($list['id'], 'CGROUP', $newValue);
|
256 |
-
}
|
257 |
-
}else{
|
258 |
-
$api->listMergeVarAdd($list['id'], 'CGROUP', 'Customer Groups', $customerGroup);
|
259 |
-
}
|
260 |
-
/**
|
261 |
-
* Customer Group - Interest Grouping
|
262 |
-
*/
|
263 |
-
|
264 |
-
/**
|
265 |
-
* Adding Webhooks
|
266 |
-
*/
|
267 |
-
$api->listWebhookAdd($list['id'], $hookUrl);
|
268 |
-
|
269 |
-
//If webhook was not added, add a message on Admin panel
|
270 |
-
if($api->errorCode && Mage::helper('monkey')->isAdmin()){
|
271 |
-
|
272 |
-
//Don't show an error if webhook already in, otherwise, show error message and code
|
273 |
-
if($api->errorMessage !== "Setting up multiple WebHooks for one URL is not allowed."){
|
274 |
-
$message = Mage::helper('monkey')->__('Could not add Webhook "%s" for list "%s", error code %s, %s', $hookUrl, $list['name'], $api->errorCode, $api->errorMessage);
|
275 |
-
Mage::getSingleton('adminhtml/session')->addError($message);
|
276 |
-
}
|
277 |
-
|
278 |
-
}
|
279 |
-
/**
|
280 |
-
* Adding Webhooks
|
281 |
-
*/
|
282 |
-
}
|
283 |
-
|
284 |
-
}
|
285 |
-
|
286 |
-
}
|
287 |
-
|
288 |
-
/**
|
289 |
-
* Update customer after_save event observer
|
290 |
-
*
|
291 |
-
* @param Varien_Event_Observer $observer
|
292 |
-
* @return void|Varien_Event_Observer
|
293 |
-
*/
|
294 |
-
public function updateCustomer(Varien_Event_Observer $observer)
|
295 |
-
{
|
296 |
-
if(!Mage::helper('monkey')->canMonkey()){
|
297 |
-
return $observer;
|
298 |
-
}
|
299 |
-
|
300 |
-
$customer = $observer->getEvent()->getCustomer();
|
301 |
-
|
302 |
-
$isConfirmNeed = FALSE;
|
303 |
-
if( !Mage::helper('monkey')->isAdmin() &&
|
304 |
-
(Mage::getStoreConfig(Mage_Newsletter_Model_Subscriber::XML_PATH_CONFIRMATION_FLAG, $customer->getStoreId()) == 1) ){
|
305 |
-
$isConfirmNeed = TRUE;
|
306 |
-
}
|
307 |
-
|
308 |
-
$oldEmail = $customer->getOrigData('email');
|
309 |
-
$email = $customer->getEmail();
|
310 |
-
if(Mage::getSingleton('core/session')->getMonkeyCheckout()) {
|
311 |
-
$saveOnDb = Mage::helper('monkey')->config('checkout_async');
|
312 |
-
}else{
|
313 |
-
$saveOnDb = 0;
|
314 |
-
}
|
315 |
-
$defaultList = Mage::helper('monkey')->config('list');
|
316 |
-
if(!$oldEmail){
|
317 |
-
$isSubscribed = Mage::getSingleton('newsletter/subscriber')->loadByEmail($email);
|
318 |
-
$monkeyPost = unserialize(Mage::getSingleton('core/session')->getMonkeyPost());
|
319 |
-
if($isSubscribed->getEmail() && !Mage::helper('monkey')->subscribedToList($email, $defaultList) || $monkeyPost){
|
320 |
-
Mage::helper('monkey')->subscribeToList($customer, $saveOnDb);
|
321 |
-
//$api->listSubscribe($defaultList, $customer->getEmail(), $mergeVars, $isConfirmNeed);
|
322 |
}
|
323 |
-
|
|
|
324 |
|
325 |
-
|
326 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
327 |
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
$
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
338 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
339 |
}
|
340 |
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
345 |
//$api->listSubscribe($defaultList, $customer->getEmail(), $mergeVars, $isConfirmNeed);
|
346 |
-
}
|
347 |
-
|
348 |
-
|
349 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
350 |
$subscriber->setImportMode(TRUE)->unsubscribe();
|
351 |
-
Mage::getSingleton('monkey/api', $customer->getStoreId())->listUnsubscribe($defaultList, $customer->getEmail());
|
352 |
-
}else{
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
|
|
|
|
|
|
357 |
}
|
358 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
359 |
}
|
360 |
-
|
361 |
-
|
362 |
-
return $observer;
|
363 |
-
}
|
364 |
-
|
365 |
-
/**
|
366 |
-
* Add flag on session to tell the module if on success page should subscribe customer
|
367 |
-
*
|
368 |
-
* @param Varien_Event_Observer $observer
|
369 |
-
* @return void
|
370 |
-
*/
|
371 |
-
public function registerCheckoutSubscribe(Varien_Event_Observer $observer)
|
372 |
-
{
|
373 |
-
if(!Mage::helper('monkey')->canMonkey()){
|
374 |
-
return $observer;
|
375 |
-
}
|
376 |
-
|
377 |
-
$oneStep = Mage::app()->getRequest()->getModuleName() == 'onestepcheckout';
|
378 |
-
|
379 |
-
if(Mage::app()->getRequest()->isPost()){
|
380 |
-
$subscribe = Mage::app()->getRequest()->getPost('magemonkey_subscribe');
|
381 |
-
$force = Mage::app()->getRequest()->getPost('magemonkey_force');
|
382 |
-
|
383 |
-
Mage::getSingleton('core/session')->setMonkeyPost( serialize(Mage::app()->getRequest()->getPost()) );
|
384 |
-
if(!is_null($subscribe)||!is_null($force)){
|
385 |
-
Mage::getSingleton('core/session')->setMonkeyCheckout(true);
|
386 |
-
}
|
387 |
-
}
|
388 |
-
if($oneStep){
|
389 |
Mage::getSingleton('core/session')->setIsOneStepCheckout(true);
|
390 |
}
|
391 |
return $observer;
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
Mage::getSingleton('core/session')->setRegisterCheckoutSuccess(TRUE);
|
403 |
-
|
404 |
Mage::getSingleton('core/session')->setMonkeyCheckout(FALSE);
|
405 |
Mage::getSingleton('core/session')->setMonkeyPost(NULL);
|
406 |
Mage::getSingleton('core/session')->setIsOneStepCheckout(FALSE);
|
407 |
-
|
408 |
-
|
409 |
|
410 |
-
|
411 |
$order = null;
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
if($sessionFlag){
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
$customer = Mage::getSingleton('customer/customer')->load($order->getCustomerId());
|
431 |
$saveOnDb = Mage::helper('monkey')->config('checkout_async');
|
432 |
$toSubscribe = $customer;
|
433 |
|
434 |
-
if(!$toSubscribe->getEmail()){
|
435 |
$toSubscribe = Mage::getModel('newsletter/subscriber')
|
436 |
->setImportMode(TRUE)
|
437 |
->setEmail($order->getCustomerEmail());
|
@@ -439,33 +432,33 @@ class Ebizmarts_MageMonkey_Model_Observer
|
|
439 |
|
440 |
Mage::helper('monkey')->listsSubscription($toSubscribe, $saveOnDb);
|
441 |
|
442 |
-
|
443 |
Mage::getSingleton('core/session')->setMonkeyCheckout(FALSE);
|
444 |
Mage::getSingleton('core/session')->setMonkeyPost(NULL);
|
445 |
Mage::getSingleton('core/session')->setIsOneStepCheckout(FALSE);
|
446 |
Mage::getSingleton('core/session')->setRegisterCheckoutSuccess(FALSE);
|
447 |
return $observer;
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
{
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
$block = $observer->getEvent()->getBlock();
|
461 |
|
462 |
-
if($block instanceof Mage_Adminhtml_Block_Widget_Grid_Massaction || $block instanceof Enterprise_SalesArchive_Block_Adminhtml_Sales_Order_Grid_Massaction) {
|
463 |
|
464 |
-
if($block->getRequest()->getControllerName() == 'sales_order') {
|
465 |
|
466 |
$block->addItem('magemonkey_ecommerce360', array(
|
467 |
-
'label'=> Mage::helper('monkey')->__('Send to MailChimp'),
|
468 |
-
'url'
|
469 |
));
|
470 |
|
471 |
}
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_MageMonkey_Model_Observer
|
12 |
{
|
13 |
+
/**
|
14 |
+
* Handle Subscriber object saving process
|
15 |
+
*
|
16 |
+
* @param Varien_Event_Observer $observer
|
17 |
+
* @return void|Varien_Event_Observer
|
18 |
+
*/
|
19 |
+
public function handleSubscriber(Varien_Event_Observer $observer)
|
20 |
+
{
|
21 |
+
if (!Mage::helper('monkey')->canMonkey()) {
|
22 |
+
return $observer;
|
23 |
+
}
|
24 |
+
|
25 |
+
if (TRUE === Mage::helper('monkey')->isWebhookRequest()) {
|
26 |
+
return $observer;
|
27 |
+
}
|
|
|
28 |
|
29 |
$subscriber = $observer->getEvent()->getSubscriber();
|
30 |
+
$defaultList = Mage::getStoreConfig(Ebizmarts_MageMonkey_Model_Config::GENERAL_LIST, $subscriber->getStoreId());
|
31 |
+
if($subscriber->getOrigData('subscriber_status') != 3 && $subscriber->getData('subscriber_status') == 3){
|
32 |
+
Mage::getSingleton('monkey/api')->listUnsubscribe($defaultList, $subscriber->getSubscriberEmail());
|
33 |
+
}
|
34 |
+
if (!Mage::helper('monkey')->isAdmin() &&
|
35 |
+
(Mage::getStoreConfig(Mage_Newsletter_Model_Subscriber::XML_PATH_CONFIRMATION_FLAG, $subscriber->getStoreId()) == 1 && Mage::helper('monkey')->subscribedToList($defaultList, $subscriber->getSubscriberEmail()))
|
36 |
+
) {
|
37 |
$subscriber->setStatus(Mage_Newsletter_Model_Subscriber::STATUS_UNCONFIRMED);
|
38 |
+
} elseif (Mage::helper('monkey')->isAdmin() && $subscriber->getOrigData('subscriber_status') == Mage_Newsletter_Model_Subscriber::STATUS_UNCONFIRMED && $subscriber->getStatus() != Mage_Newsletter_Model_Subscriber::STATUS_UNSUBSCRIBED) {
|
39 |
$subscriber->setStatus(Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED);
|
40 |
}
|
41 |
|
42 |
+
if ($subscriber->getBulksync()) {
|
|
|
|
|
|
|
|
|
43 |
return $observer;
|
44 |
}
|
45 |
|
46 |
+
if (Mage::getSingleton('core/session')->getIsOneStepCheckout() && !Mage::getSingleton('core/session')->getMonkeyCheckout()) {
|
47 |
+
return $observer;
|
48 |
+
}
|
49 |
|
50 |
+
if (TRUE === $subscriber->getIsStatusChanged()) {
|
51 |
Mage::getSingleton('core/session')->setIsHandleSubscriber(TRUE);
|
52 |
+
if (Mage::getSingleton('core/session')->getIsOneStepCheckout() || Mage::getSingleton('core/session')->getMonkeyCheckout()) {
|
53 |
$saveOnDb = Mage::helper('monkey')->config('checkout_async');
|
54 |
Mage::helper('monkey')->subscribeToList($subscriber, $saveOnDb);
|
55 |
} else {
|
56 |
$post = Mage::app()->getRequest()->getPost();
|
57 |
+
if (isset($post['magemonkey_subscribe']) && $post['magemonkey_subscribe'] || Mage::getSingleton('core/session')->getIsUpdateCustomer() || $subscriber->getStatus() == Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED || $subscriber->getStatus() == Mage_Newsletter_Model_Subscriber::STATUS_UNCONFIRMED) {
|
58 |
Mage::helper('monkey')->subscribeToList($subscriber, 0);
|
59 |
}
|
60 |
}
|
65 |
}
|
66 |
|
67 |
|
68 |
+
/**
|
69 |
+
* Handle Subscriber deletion from Magento, unsubcribes email from MailChimp
|
70 |
+
* and sends the delete_member flag so the subscriber gets deleted.
|
71 |
+
*
|
72 |
+
* @param Varien_Event_Observer $observer
|
73 |
+
* @return void|Varien_Event_Observer
|
74 |
+
*/
|
75 |
+
public function handleSubscriberDeletion(Varien_Event_Observer $observer)
|
76 |
+
{
|
77 |
+
if (!Mage::helper('monkey')->canMonkey()) {
|
78 |
+
return;
|
79 |
+
}
|
80 |
|
81 |
+
if (TRUE === Mage::helper('monkey')->isWebhookRequest()) {
|
82 |
+
return $observer;
|
83 |
+
}
|
84 |
|
85 |
+
$subscriber = $observer->getEvent()->getSubscriber();
|
86 |
+
$subscriber->setImportMode(TRUE);
|
87 |
|
88 |
+
if ($subscriber->getBulksync()) {
|
89 |
+
return $observer;
|
90 |
+
}
|
91 |
|
92 |
+
$listId = Mage::helper('monkey')->getDefaultList($subscriber->getStoreId());
|
93 |
|
94 |
+
Mage::getSingleton('monkey/api', array('store' => $subscriber->getStoreId()))
|
95 |
+
->listUnsubscribe($listId, $subscriber->getSubscriberEmail());
|
96 |
|
97 |
+
}
|
98 |
|
99 |
+
/**
|
100 |
+
* Check for conflicts with rewrite on Core/Email_Template
|
101 |
+
*
|
102 |
+
* @param Varien_Event_Observer $observer
|
103 |
+
* @return void|Varien_Event_Observer
|
104 |
+
*/
|
105 |
+
public function loadConfig(Varien_Event_Observer $observer)
|
106 |
+
{
|
107 |
+
$action = $observer->getEvent()->getControllerAction();
|
108 |
|
109 |
//Do nothing for data saving actions
|
110 |
if ($action->getRequest()->isPost() || $action->getRequest()->getQuery('isAjax')) {
|
111 |
return $observer;
|
112 |
}
|
113 |
|
114 |
+
if ('monkey' !== $action->getRequest()->getParam('section')) {
|
115 |
+
return $observer;
|
116 |
+
}
|
117 |
|
118 |
+
return $observer;
|
119 |
+
}
|
120 |
|
121 |
+
/**
|
122 |
+
* Handle save of System -> Configuration, section <monkey>
|
123 |
+
*
|
124 |
+
* @param Varien_Event_Observer $observer
|
125 |
+
* @return void|Varien_Event_Observer
|
126 |
+
*/
|
127 |
+
public function saveConfig(Varien_Event_Observer $observer)
|
128 |
{
|
129 |
+
if (Mage::app()->getRequest()->getParam('store')) {
|
130 |
$scope = 'store';
|
131 |
+
} elseif (Mage::app()->getRequest()->getParam('website')) {
|
|
|
132 |
$scope = 'website';
|
133 |
+
} else {
|
|
|
134 |
$scope = 'default';
|
135 |
}
|
136 |
|
137 |
+
$store = is_null($observer->getEvent()->getStore()) ? Mage::app()->getDefaultStoreView()->getCode() : $observer->getEvent()->getStore();
|
138 |
+
$post = Mage::app()->getRequest()->getPost();
|
139 |
+
$request = Mage::app()->getRequest();
|
140 |
|
141 |
+
if (!Mage::getStoreConfig(Ebizmarts_MageMonkey_Model_Config::GENERAL_ACTIVE, $store)) {
|
142 |
+
$config = new Mage_Core_Model_Config();
|
143 |
+
$config->saveConfig(Ebizmarts_MageMonkey_Model_Config::ECOMMERCE360_ACTIVE, false, $scope, $store);
|
144 |
Mage::getConfig()->cleanCache();
|
145 |
}
|
146 |
|
147 |
+
if (!isset($post['groups'])) {
|
148 |
+
return $observer;
|
149 |
+
}
|
150 |
+
//Check if the api key exist
|
151 |
+
if (isset($post['groups']['general']['fields']['apikey']['value'])) {
|
152 |
+
$apiKey = $post['groups']['general']['fields']['apikey']['value'];
|
153 |
+
} else {
|
154 |
+
//this case it's when we save the configuration for a particular store
|
155 |
+
if ((string)$post['groups']['general']['fields']['apikey']['inherit'] == 1) {
|
156 |
+
$apiKey = Mage::helper('monkey')->getApiKey();
|
157 |
+
}
|
158 |
+
}
|
159 |
+
|
160 |
+
if (!$apiKey) {
|
161 |
+
return $observer;
|
162 |
+
}
|
163 |
+
|
164 |
+
$selectedLists = array();
|
165 |
+
if (isset($post['groups']['general']['fields']['list']['value'])) {
|
166 |
+
$selectedLists [] = $post['groups']['general']['fields']['list']['value'];
|
167 |
+
} else {
|
168 |
+
if ((string)$post['groups']['general']['fields']['list']['inherit'] == 1) {
|
169 |
+
$selectedLists [] = Mage::helper('monkey')->getDefaultList(Mage::app()->getStore()->getId());
|
170 |
+
}
|
171 |
+
|
172 |
+
}
|
173 |
+
|
174 |
+
if (isset($post['groups']['general']['fields']['additional_lists']['value'])) {
|
175 |
+
$additionalLists = $post['groups']['general']['fields']['additional_lists']['value'];
|
176 |
+
} else {
|
177 |
+
if ((string)$post['groups']['general']['fields']['additional_lists']['inherit'] == 1) {
|
178 |
+
$additionalLists = Mage::helper('monkey')->getAdditionalList(Mage::app()->getStore()->getId());
|
179 |
+
}
|
180 |
+
}
|
181 |
+
|
182 |
+
if (!$selectedLists[0]) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
183 |
$message = Mage::helper('monkey')->__('There is no List selected please save the configuration again');
|
184 |
Mage::getSingleton('adminhtml/session')->addWarning($message);
|
185 |
+
} elseif (is_array($additionalLists)) {
|
186 |
+
foreach ($additionalLists as $additional) {
|
187 |
+
if ($additional == $selectedLists[0]) {
|
188 |
+
$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');
|
189 |
+
Mage::getSingleton('adminhtml/session')->addWarning($message);
|
190 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
191 |
}
|
192 |
+
$selectedLists = array_merge($selectedLists, $additionalLists);
|
193 |
+
}
|
194 |
|
195 |
+
$webhooksKey = Mage::helper('monkey')->getWebhooksKey();
|
196 |
|
197 |
+
//Generating Webhooks URL
|
198 |
+
$hookUrl = '';
|
199 |
+
try {
|
200 |
+
$hookUrl = Mage::getModel('core/url')->setStore($store)->getUrl(Ebizmarts_MageMonkey_Model_Monkey::WEBHOOKS_PATH, array('wkey' => $webhooksKey));
|
201 |
+
} catch (Exception $e) {
|
202 |
+
$hookUrl = Mage::getModel('core/url')->getUrl(Ebizmarts_MageMonkey_Model_Monkey::WEBHOOKS_PATH, array('wkey' => $webhooksKey));
|
203 |
+
}
|
204 |
+
|
205 |
+
if (FALSE != strstr($hookUrl, '?', true)) {
|
206 |
+
$hookUrl = strstr($hookUrl, '?', true);
|
207 |
+
}
|
208 |
|
209 |
+
$api = Mage::getSingleton('monkey/api', array('apikey' => $apiKey));
|
210 |
+
|
211 |
+
//Validate API KEY
|
212 |
+
$api->ping();
|
213 |
+
if ($api->errorCode) {
|
214 |
+
Mage::getSingleton('adminhtml/session')->addError($api->errorMessage);
|
215 |
+
return $observer;
|
216 |
+
}
|
217 |
+
|
218 |
+
$lists = $api->lists();
|
219 |
+
|
220 |
+
foreach ($lists['data'] as $list) {
|
221 |
+
|
222 |
+
if (in_array($list['id'], $selectedLists)) {
|
223 |
+
|
224 |
+
/**
|
225 |
+
* Customer Group - Interest Grouping
|
226 |
+
*/
|
227 |
+
$magentoGroups = Mage::helper('customer')->getGroups()->toOptionHash();
|
228 |
+
array_push($magentoGroups, "NOT LOGGED IN");
|
229 |
+
$customerGroup = array('field_type' => 'dropdown', 'choices' => $magentoGroups);
|
230 |
+
$mergeVars = $api->listMergeVars($list['id']);
|
231 |
+
$mergeExist = false;
|
232 |
+
foreach ($mergeVars as $vars) {
|
233 |
+
if ($vars['tag'] == 'CGROUP') {
|
234 |
+
$mergeExist = true;
|
235 |
+
if ($magentoGroups === $vars['choices']) {
|
236 |
+
$update = false;
|
237 |
+
} else {
|
238 |
+
$update = true;
|
239 |
+
}
|
240 |
+
}
|
241 |
}
|
242 |
+
if ($mergeExist) {
|
243 |
+
if ($update) {
|
244 |
+
$newValue = array('choices' => $magentoGroups);
|
245 |
+
$api->listMergeVarUpdate($list['id'], 'CGROUP', $newValue);
|
246 |
+
}
|
247 |
+
} else {
|
248 |
+
$api->listMergeVarAdd($list['id'], 'CGROUP', 'Customer Groups', $customerGroup);
|
249 |
+
}
|
250 |
+
/**
|
251 |
+
* Customer Group - Interest Grouping
|
252 |
+
*/
|
253 |
+
|
254 |
+
/**
|
255 |
+
* Adding Webhooks
|
256 |
+
*/
|
257 |
+
$api->listWebhookAdd($list['id'], $hookUrl);
|
258 |
+
|
259 |
+
//If webhook was not added, add a message on Admin panel
|
260 |
+
if ($api->errorCode && Mage::helper('monkey')->isAdmin()) {
|
261 |
+
|
262 |
+
//Don't show an error if webhook already in, otherwise, show error message and code
|
263 |
+
if ($api->errorMessage !== "Setting up multiple WebHooks for one URL is not allowed.") {
|
264 |
+
$message = Mage::helper('monkey')->__('Could not add Webhook "%s" for list "%s", error code %s, %s', $hookUrl, $list['name'], $api->errorCode, $api->errorMessage);
|
265 |
+
Mage::getSingleton('adminhtml/session')->addError($message);
|
266 |
+
}
|
267 |
+
|
268 |
+
}
|
269 |
+
/**
|
270 |
+
* Adding Webhooks
|
271 |
+
*/
|
272 |
}
|
273 |
|
274 |
+
}
|
275 |
+
|
276 |
+
}
|
277 |
+
|
278 |
+
/**
|
279 |
+
* Update customer after_save event observer
|
280 |
+
*
|
281 |
+
* @param Varien_Event_Observer $observer
|
282 |
+
* @return void|Varien_Event_Observer
|
283 |
+
*/
|
284 |
+
public function updateCustomer(Varien_Event_Observer $observer)
|
285 |
+
{
|
286 |
+
if (!Mage::helper('monkey')->canMonkey()) {
|
287 |
+
return $observer;
|
288 |
+
}
|
289 |
+
|
290 |
+
$request = Mage::app()->getRequest();
|
291 |
+
$isAdmin = $request->getActionName() == 'save' && $request->getControllerName() == 'customer' && $request->getModuleName() == (string)Mage::getConfig()->getNode('admin/routers/adminhtml/args/frontName');
|
292 |
+
$customer = $observer->getEvent()->getCustomer();
|
293 |
+
$isCheckout = $request->getModuleName() == 'checkout';
|
294 |
+
// $isConfirmNeed = FALSE;
|
295 |
+
// if (!Mage::helper('monkey')->isAdmin() &&
|
296 |
+
// (Mage::getStoreConfig(Mage_Newsletter_Model_Subscriber::XML_PATH_CONFIRMATION_FLAG, $customer->getStoreId()) == 1)
|
297 |
+
// ) {
|
298 |
+
// $isConfirmNeed = TRUE;
|
299 |
+
// }
|
300 |
+
if(!$isCheckout) {
|
301 |
+
$oldEmail = $customer->getOrigData('email');
|
302 |
+
$email = $customer->getEmail();
|
303 |
+
if (Mage::getSingleton('core/session')->getMonkeyCheckout()) {
|
304 |
+
$saveOnDb = Mage::helper('monkey')->config('checkout_async');
|
305 |
+
} else {
|
306 |
+
$saveOnDb = 0;
|
307 |
+
}
|
308 |
+
$defaultList = Mage::getStoreConfig(Ebizmarts_MageMonkey_Model_Config::GENERAL_LIST, $customer->getStoreId());
|
309 |
+
if (!$oldEmail) {
|
310 |
+
$subscriber = Mage::getSingleton('newsletter/subscriber')->loadByEmail($email);
|
311 |
+
$monkeyPost = unserialize(Mage::getSingleton('core/session')->getMonkeyPost());
|
312 |
+
if (!Mage::helper('monkey')->subscribedToList($email, $defaultList) && !$isAdmin && ($subscriber->getStatus() == Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED || $subscriber->getStatus() == Mage_Newsletter_Model_Subscriber::STATUS_UNCONFIRMED) || $monkeyPost) {
|
313 |
+
Mage::helper('monkey')->subscribeToList($customer, $saveOnDb);
|
314 |
//$api->listSubscribe($defaultList, $customer->getEmail(), $mergeVars, $isConfirmNeed);
|
315 |
+
}
|
316 |
+
} else {
|
317 |
+
|
318 |
+
|
319 |
+
Mage::getSingleton('core/session')->setIsUpdateCustomer(TRUE);
|
320 |
+
//subscribe to MailChimp newsletter
|
321 |
+
$api = Mage::getSingleton('monkey/api', array('store' => $customer->getStoreId()));
|
322 |
+
$post = Mage::app()->getRequest()->getPost();
|
323 |
+
$subscriber = Mage::getModel('newsletter/subscriber')
|
324 |
+
->loadByEmail($customer->getEmail());
|
325 |
+
if ($subscriber->getStatus() == Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED && !$isAdmin) {
|
326 |
+
Mage::helper('monkey')->listsSubscription($customer, $post, $saveOnDb);
|
327 |
+
}
|
328 |
+
$lists = $api->listsForEmail($oldEmail);
|
329 |
+
if (is_array($lists)) {
|
330 |
+
foreach ($lists as $listId) {
|
331 |
+
$mergeVars = Mage::helper('monkey')->mergeVars($customer, TRUE, $listId);
|
332 |
+
$api->listUpdateMember($listId, $oldEmail, $mergeVars, '', false);
|
333 |
+
}
|
334 |
+
}
|
335 |
+
|
336 |
+
//subscribe to MailChimp when customer subscribed from admin
|
337 |
+
//unsubscribe from Magento when customer unsubscribed from admin
|
338 |
+
if ($isAdmin) {
|
339 |
+
if ($subscriber->getStatus() == Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED && !$customer->getData('is_subscribed')) {
|
340 |
$subscriber->setImportMode(TRUE)->unsubscribe();
|
341 |
+
Mage::getSingleton('monkey/api', array('store' => $customer->getStoreId()))->listUnsubscribe($defaultList, $customer->getEmail());
|
342 |
+
} else {
|
343 |
+
if($customer->getData('is_subscribed')) {
|
344 |
+
Mage::getModel('newsletter/subscriber')
|
345 |
+
->setSubscriberEmail($customer->getEmail())
|
346 |
+
->setStoreId($customer->getStoreId())
|
347 |
+
->setImportMode(TRUE)
|
348 |
+
->subscribe($customer->getEmail());
|
349 |
+
}
|
350 |
}
|
351 |
}
|
352 |
+
Mage::getSingleton('core/session')->setIsUpdateCustomer(FALSE);
|
353 |
+
}
|
354 |
+
}
|
355 |
+
return $observer;
|
356 |
+
}
|
357 |
+
|
358 |
+
/**
|
359 |
+
* Add flag on session to tell the module if on success page should subscribe customer
|
360 |
+
*
|
361 |
+
* @param Varien_Event_Observer $observer
|
362 |
+
* @return void
|
363 |
+
*/
|
364 |
+
public function registerCheckoutSubscribe(Varien_Event_Observer $observer)
|
365 |
+
{
|
366 |
+
if (!Mage::helper('monkey')->canMonkey()) {
|
367 |
+
return $observer;
|
368 |
+
}
|
369 |
+
|
370 |
+
$oneStep = Mage::app()->getRequest()->getModuleName() == 'onestepcheckout';
|
371 |
+
|
372 |
+
if (Mage::app()->getRequest()->isPost()) {
|
373 |
+
$subscribe = Mage::app()->getRequest()->getPost('magemonkey_subscribe');
|
374 |
+
$force = Mage::app()->getRequest()->getPost('magemonkey_force');
|
375 |
+
|
376 |
+
Mage::getSingleton('core/session')->setMonkeyPost(serialize(Mage::app()->getRequest()->getPost()));
|
377 |
+
if (!is_null($subscribe) || !is_null($force)) {
|
378 |
+
Mage::getSingleton('core/session')->setMonkeyCheckout(true);
|
379 |
}
|
380 |
+
}
|
381 |
+
if ($oneStep) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
382 |
Mage::getSingleton('core/session')->setIsOneStepCheckout(true);
|
383 |
}
|
384 |
return $observer;
|
385 |
+
}
|
386 |
+
|
387 |
+
/**
|
388 |
+
* Subscribe customer to Newsletter if flag on session is present
|
389 |
+
*
|
390 |
+
* @param Varien_Event_Observer $observer
|
391 |
+
* @return void
|
392 |
+
*/
|
393 |
+
public function registerCheckoutSuccess(Varien_Event_Observer $observer)
|
394 |
+
{
|
395 |
Mage::getSingleton('core/session')->setRegisterCheckoutSuccess(TRUE);
|
396 |
+
if (!Mage::helper('monkey')->canMonkey()) {
|
397 |
Mage::getSingleton('core/session')->setMonkeyCheckout(FALSE);
|
398 |
Mage::getSingleton('core/session')->setMonkeyPost(NULL);
|
399 |
Mage::getSingleton('core/session')->setIsOneStepCheckout(FALSE);
|
400 |
+
return $observer;
|
401 |
+
}
|
402 |
|
403 |
+
$orderId = (int)current($observer->getEvent()->getOrderIds());
|
404 |
$order = null;
|
405 |
+
if ($orderId) {
|
406 |
+
$order = Mage::getModel('sales/order')->load($orderId);
|
407 |
+
}
|
408 |
+
|
409 |
+
if (is_object($order) && $order->getId()) {
|
410 |
+
//Set Campaign Id if exist
|
411 |
+
$campaign_id = Mage::getModel('monkey/ecommerce360')->getCookie()->get('magemonkey_campaign_id');
|
412 |
+
if ($campaign_id) {
|
413 |
+
$order->setEbizmartsMagemonkeyCampaignId($campaign_id);
|
414 |
+
}
|
415 |
+
|
416 |
+
$sessionFlag = Mage::getSingleton('core/session')->getMonkeyCheckout() || Mage::getSingleton('core/session')->getIsOneStepCheckout();
|
417 |
+
if ($sessionFlag) {
|
418 |
+
//Guest Checkout
|
419 |
+
if ((int)$order->getCustomerGroupId() === Mage_Customer_Model_Group::NOT_LOGGED_IN_ID) {
|
420 |
+
Mage::helper('monkey')->registerGuestCustomer($order);
|
421 |
+
}
|
422 |
+
}
|
423 |
$customer = Mage::getSingleton('customer/customer')->load($order->getCustomerId());
|
424 |
$saveOnDb = Mage::helper('monkey')->config('checkout_async');
|
425 |
$toSubscribe = $customer;
|
426 |
|
427 |
+
if (!$toSubscribe->getEmail()) {
|
428 |
$toSubscribe = Mage::getModel('newsletter/subscriber')
|
429 |
->setImportMode(TRUE)
|
430 |
->setEmail($order->getCustomerEmail());
|
432 |
|
433 |
Mage::helper('monkey')->listsSubscription($toSubscribe, $saveOnDb);
|
434 |
|
435 |
+
}
|
436 |
Mage::getSingleton('core/session')->setMonkeyCheckout(FALSE);
|
437 |
Mage::getSingleton('core/session')->setMonkeyPost(NULL);
|
438 |
Mage::getSingleton('core/session')->setIsOneStepCheckout(FALSE);
|
439 |
Mage::getSingleton('core/session')->setRegisterCheckoutSuccess(FALSE);
|
440 |
return $observer;
|
441 |
+
}
|
442 |
+
|
443 |
+
/** Add mass action option to Sales -> Order grid in admin panel to send orders to MC (Ecommerce360)
|
444 |
+
*
|
445 |
+
* @param Varien_Event_Observer $observer
|
446 |
+
* @return void
|
447 |
+
*/
|
448 |
+
public function massActionOption(Varien_Event_Observer $observer)
|
449 |
{
|
450 |
+
if (!Mage::helper('monkey')->canMonkey()) {
|
451 |
+
return $observer;
|
452 |
+
}
|
453 |
$block = $observer->getEvent()->getBlock();
|
454 |
|
455 |
+
if ($block instanceof Mage_Adminhtml_Block_Widget_Grid_Massaction || $block instanceof Enterprise_SalesArchive_Block_Adminhtml_Sales_Order_Grid_Massaction) {
|
456 |
|
457 |
+
if ($block->getRequest()->getControllerName() == 'sales_order') {
|
458 |
|
459 |
$block->addItem('magemonkey_ecommerce360', array(
|
460 |
+
'label' => Mage::helper('monkey')->__('Send to MailChimp'),
|
461 |
+
'url' => Mage::app()->getStore()->getUrl('monkey/adminhtml_ecommerce/masssend', Mage::app()->getStore()->isCurrentlySecure() ? array('_secure' => true) : array()),
|
462 |
));
|
463 |
|
464 |
}
|
app/code/community/Ebizmarts/MageMonkey/Model/Subscriber.php
CHANGED
@@ -1,19 +1,19 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* Created by PhpStorm.
|
4 |
* User: santisp
|
5 |
* Date: 25/09/14
|
6 |
* Time: 12:26 PM
|
7 |
*/
|
8 |
-
|
9 |
class Ebizmarts_MageMonkey_Model_Subscriber extends Mage_Newsletter_Model_Subscriber
|
10 |
{
|
11 |
public function sendUnsubscriptionEmail()
|
12 |
{
|
13 |
$store = Mage::helper('monkey')->getThisStore();
|
14 |
-
if(Mage::getStoreConfig(Ebizmarts_MageMonkey_Model_Config::GENERAL_ACTIVE, $store) == 1 && !Mage::getStoreConfig(Ebizmarts_MageMonkey_Model_Config::GENERAL_CONFIRMATION_EMAIL, $store)) {
|
15 |
return $this;
|
16 |
-
}else{
|
17 |
return parent::sendUnsubscriptionEmail();
|
18 |
}
|
19 |
}
|
@@ -21,9 +21,9 @@ class Ebizmarts_MageMonkey_Model_Subscriber extends Mage_Newsletter_Model_Subscr
|
|
21 |
public function sendConfirmationRequestEmail()
|
22 |
{
|
23 |
$store = Mage::helper('monkey')->getThisStore();
|
24 |
-
if(Mage::getStoreConfig(Ebizmarts_MageMonkey_Model_Config::GENERAL_ACTIVE, $store) == 1 && !Mage::getStoreConfig(Ebizmarts_MageMonkey_Model_Config::GENERAL_CONFIRMATION_EMAIL, $store)) {
|
25 |
return $this;
|
26 |
-
}else{
|
27 |
return parent::sendConfirmationRequestEmail();
|
28 |
}
|
29 |
}
|
@@ -31,12 +31,9 @@ class Ebizmarts_MageMonkey_Model_Subscriber extends Mage_Newsletter_Model_Subscr
|
|
31 |
public function sendConfirmationSuccessEmail()
|
32 |
{
|
33 |
$store = Mage::helper('monkey')->getThisStore();
|
34 |
-
Mage::
|
35 |
-
Mage::log(Mage::getStoreConfig(Ebizmarts_MageMonkey_Model_Config::GENERAL_CONFIRMATION_EMAIL, $store), null, 'santiago.log', true);
|
36 |
-
if(Mage::getStoreConfig(Ebizmarts_MageMonkey_Model_Config::GENERAL_ACTIVE, $store) == 1 && !Mage::getStoreConfig(Ebizmarts_MageMonkey_Model_Config::GENERAL_CONFIRMATION_EMAIL, $store)) {
|
37 |
return $this;
|
38 |
-
}else{
|
39 |
-
Mage::log('parent', null, 'santiago.log', true);
|
40 |
return parent::sendConfirmationSuccessEmail();
|
41 |
}
|
42 |
}
|
1 |
<?php
|
2 |
+
|
3 |
/**
|
4 |
* Created by PhpStorm.
|
5 |
* User: santisp
|
6 |
* Date: 25/09/14
|
7 |
* Time: 12:26 PM
|
8 |
*/
|
|
|
9 |
class Ebizmarts_MageMonkey_Model_Subscriber extends Mage_Newsletter_Model_Subscriber
|
10 |
{
|
11 |
public function sendUnsubscriptionEmail()
|
12 |
{
|
13 |
$store = Mage::helper('monkey')->getThisStore();
|
14 |
+
if (Mage::getStoreConfig(Ebizmarts_MageMonkey_Model_Config::GENERAL_ACTIVE, $store) == 1 && !Mage::getStoreConfig(Ebizmarts_MageMonkey_Model_Config::GENERAL_CONFIRMATION_EMAIL, $store)) {
|
15 |
return $this;
|
16 |
+
} else {
|
17 |
return parent::sendUnsubscriptionEmail();
|
18 |
}
|
19 |
}
|
21 |
public function sendConfirmationRequestEmail()
|
22 |
{
|
23 |
$store = Mage::helper('monkey')->getThisStore();
|
24 |
+
if (Mage::getStoreConfig(Ebizmarts_MageMonkey_Model_Config::GENERAL_ACTIVE, $store) == 1 && !Mage::getStoreConfig(Ebizmarts_MageMonkey_Model_Config::GENERAL_CONFIRMATION_EMAIL, $store)) {
|
25 |
return $this;
|
26 |
+
} else {
|
27 |
return parent::sendConfirmationRequestEmail();
|
28 |
}
|
29 |
}
|
31 |
public function sendConfirmationSuccessEmail()
|
32 |
{
|
33 |
$store = Mage::helper('monkey')->getThisStore();
|
34 |
+
if (Mage::getStoreConfig(Ebizmarts_MageMonkey_Model_Config::GENERAL_ACTIVE, $store) == 1 && !Mage::getStoreConfig(Ebizmarts_MageMonkey_Model_Config::GENERAL_CONFIRMATION_EMAIL, $store)) {
|
|
|
|
|
35 |
return $this;
|
36 |
+
} else {
|
|
|
37 |
return parent::sendConfirmationSuccessEmail();
|
38 |
}
|
39 |
}
|
app/code/community/Ebizmarts/MageMonkey/Model/System/Config/Source/Account.php
CHANGED
@@ -8,45 +8,44 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_MageMonkey_Model_System_Config_Source_Account
|
13 |
{
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
protected $_account_details = FALSE;
|
22 |
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
public function __construct()
|
29 |
{
|
30 |
if (!$this->_account_details) {
|
31 |
$this->_account_details = Mage::getSingleton('monkey/api')
|
32 |
-
|
33 |
}
|
34 |
}
|
35 |
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
public function toOptionArray()
|
42 |
{
|
43 |
-
if(is_array($this->_account_details)){
|
44 |
return array(
|
45 |
array('value' => 0, 'label' => Mage::helper('monkey')->__('Username:') . ' ' . $this->_account_details['username']),
|
46 |
array('value' => 1, 'label' => Mage::helper('monkey')->__('Plan type:') . ' ' . $this->_account_details['plan_type']),
|
47 |
array('value' => 2, 'label' => Mage::helper('monkey')->__('Is in trial mode?:') . ' ' . ($this->_account_details['is_trial'] ? Mage::helper('monkey')->__('Yes') : Mage::helper('monkey')->__('No')))
|
48 |
);
|
49 |
-
}else{
|
50 |
return array(array('value' => '', 'label' => Mage::helper('monkey')->__('--- Enter your API KEY first ---')));
|
51 |
}
|
52 |
}
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_MageMonkey_Model_System_Config_Source_Account
|
12 |
{
|
13 |
|
14 |
+
/**
|
15 |
+
* Account details storage
|
16 |
+
*
|
17 |
+
* @access protected
|
18 |
+
* @var bool|array
|
19 |
+
*/
|
20 |
protected $_account_details = FALSE;
|
21 |
|
22 |
+
/**
|
23 |
+
* Set AccountDetails on class property if not already set
|
24 |
+
*
|
25 |
+
* @return void
|
26 |
+
*/
|
27 |
public function __construct()
|
28 |
{
|
29 |
if (!$this->_account_details) {
|
30 |
$this->_account_details = Mage::getSingleton('monkey/api')
|
31 |
+
->getAccountDetails();
|
32 |
}
|
33 |
}
|
34 |
|
35 |
+
/**
|
36 |
+
* Return data if API key is entered
|
37 |
+
*
|
38 |
+
* @return array
|
39 |
+
*/
|
40 |
public function toOptionArray()
|
41 |
{
|
42 |
+
if (is_array($this->_account_details)) {
|
43 |
return array(
|
44 |
array('value' => 0, 'label' => Mage::helper('monkey')->__('Username:') . ' ' . $this->_account_details['username']),
|
45 |
array('value' => 1, 'label' => Mage::helper('monkey')->__('Plan type:') . ' ' . $this->_account_details['plan_type']),
|
46 |
array('value' => 2, 'label' => Mage::helper('monkey')->__('Is in trial mode?:') . ' ' . ($this->_account_details['is_trial'] ? Mage::helper('monkey')->__('Yes') : Mage::helper('monkey')->__('No')))
|
47 |
);
|
48 |
+
} else {
|
49 |
return array(array('value' => '', 'label' => Mage::helper('monkey')->__('--- Enter your API KEY first ---')));
|
50 |
}
|
51 |
}
|
app/code/community/Ebizmarts/MageMonkey/Model/System/Config/Source/Attributes.php
CHANGED
@@ -8,30 +8,29 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_MageMonkey_Model_System_Config_Source_Attributes
|
13 |
{
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
$attributes = Mage::getResourceModel('catalog/product_attribute_collection')
|
31 |
->getItems();
|
32 |
|
33 |
$this->_attributes = $attributes;
|
34 |
-
|
35 |
|
36 |
/**
|
37 |
* Options getter
|
@@ -40,17 +39,17 @@ class Ebizmarts_MageMonkey_Model_System_Config_Source_Attributes
|
|
40 |
*/
|
41 |
public function toOptionArray()
|
42 |
{
|
43 |
-
|
44 |
|
45 |
-
|
46 |
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
|
55 |
return $attributes;
|
56 |
}
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_MageMonkey_Model_System_Config_Source_Attributes
|
12 |
{
|
13 |
|
14 |
+
/**
|
15 |
+
* Lists for API key will be stored here
|
16 |
+
*
|
17 |
+
* @access protected
|
18 |
+
* @var array Email lists for given API key
|
19 |
+
*/
|
20 |
+
protected $_attributes = null;
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Load lists and store on class property
|
24 |
+
*
|
25 |
+
* @return void
|
26 |
+
*/
|
27 |
+
public function __construct()
|
28 |
+
{
|
29 |
$attributes = Mage::getResourceModel('catalog/product_attribute_collection')
|
30 |
->getItems();
|
31 |
|
32 |
$this->_attributes = $attributes;
|
33 |
+
}
|
34 |
|
35 |
/**
|
36 |
* Options getter
|
39 |
*/
|
40 |
public function toOptionArray()
|
41 |
{
|
42 |
+
$attributes = array();
|
43 |
|
44 |
+
if (is_array($this->_attributes)) {
|
45 |
|
46 |
+
foreach ($this->_attributes as $attribute) {
|
47 |
+
$attributes [] = array('value' => $attribute->getAttributecode(), 'label' => $attribute->getAttributecode());
|
48 |
+
}
|
49 |
|
50 |
+
} else {
|
51 |
+
$attributes [] = array('value' => '', 'label' => Mage::helper('monkey')->__('--- No data ---'));
|
52 |
+
}
|
53 |
|
54 |
return $attributes;
|
55 |
}
|
app/code/community/Ebizmarts/MageMonkey/Model/System/Config/Source/BulksyncDatasource.php
CHANGED
@@ -8,7 +8,6 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_MageMonkey_Model_System_Config_Source_BulksyncDatasource
|
13 |
{
|
14 |
|
@@ -20,7 +19,7 @@ class Ebizmarts_MageMonkey_Model_System_Config_Source_BulksyncDatasource
|
|
20 |
public function toOptionArray()
|
21 |
{
|
22 |
return array(
|
23 |
-
|
24 |
array('value' => 'newsletter_subscriber', 'label' => Mage::helper('monkey')->__('Send Magento Newsletter subscribers to MailChimp')),
|
25 |
);
|
26 |
}
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_MageMonkey_Model_System_Config_Source_BulksyncDatasource
|
12 |
{
|
13 |
|
19 |
public function toOptionArray()
|
20 |
{
|
21 |
return array(
|
22 |
+
array('value' => 'customer', 'label' => Mage::helper('monkey')->__('Subscribe Magento customers to MailChimp')),
|
23 |
array('value' => 'newsletter_subscriber', 'label' => Mage::helper('monkey')->__('Send Magento Newsletter subscribers to MailChimp')),
|
24 |
);
|
25 |
}
|
app/code/community/Ebizmarts/MageMonkey/Model/System/Config/Source/BulksyncStatus.php
CHANGED
@@ -8,7 +8,6 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_MageMonkey_Model_System_Config_Source_BulksyncStatus
|
13 |
{
|
14 |
|
@@ -20,29 +19,29 @@ class Ebizmarts_MageMonkey_Model_System_Config_Source_BulksyncStatus
|
|
20 |
public function toOptionArray()
|
21 |
{
|
22 |
return array(
|
23 |
-
|
24 |
array('value' => 'running', 'label' => Mage::helper('monkey')->__('Running Now')),
|
25 |
array('value' => 'chunk_running', 'label' => Mage::helper('monkey')->__('Running')),
|
26 |
array('value' => 'finished', 'label' => Mage::helper('monkey')->__('Completed')),
|
27 |
);
|
28 |
}
|
29 |
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
public function toOption()
|
36 |
{
|
37 |
-
|
38 |
|
39 |
-
|
40 |
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
|
45 |
-
|
46 |
}
|
47 |
|
48 |
}
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_MageMonkey_Model_System_Config_Source_BulksyncStatus
|
12 |
{
|
13 |
|
19 |
public function toOptionArray()
|
20 |
{
|
21 |
return array(
|
22 |
+
array('value' => 'idle', 'label' => Mage::helper('monkey')->__('IDLE')),
|
23 |
array('value' => 'running', 'label' => Mage::helper('monkey')->__('Running Now')),
|
24 |
array('value' => 'chunk_running', 'label' => Mage::helper('monkey')->__('Running')),
|
25 |
array('value' => 'finished', 'label' => Mage::helper('monkey')->__('Completed')),
|
26 |
);
|
27 |
}
|
28 |
|
29 |
+
/**
|
30 |
+
* Another way of returning data
|
31 |
+
*
|
32 |
+
* @return array
|
33 |
+
*/
|
34 |
public function toOption()
|
35 |
{
|
36 |
+
$options = $this->toOptionArray();
|
37 |
|
38 |
+
$ary = array();
|
39 |
|
40 |
+
foreach ($options as $option) {
|
41 |
+
$ary[$option['value']] = $option['label'];
|
42 |
+
}
|
43 |
|
44 |
+
return $ary;
|
45 |
}
|
46 |
|
47 |
}
|
app/code/community/Ebizmarts/MageMonkey/Model/System/Config/Source/Checkoutsubscribe.php
CHANGED
@@ -8,7 +8,6 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_MageMonkey_Model_System_Config_Source_Checkoutsubscribe
|
13 |
{
|
14 |
/**
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_MageMonkey_Model_System_Config_Source_Checkoutsubscribe
|
12 |
{
|
13 |
/**
|
app/code/community/Ebizmarts/MageMonkey/Model/System/Config/Source/CronProcessLimit.php
CHANGED
@@ -8,7 +8,6 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_MageMonkey_Model_System_Config_Source_CronProcessLimit
|
13 |
{
|
14 |
/**
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_MageMonkey_Model_System_Config_Source_CronProcessLimit
|
12 |
{
|
13 |
/**
|
app/code/community/Ebizmarts/MageMonkey/Model/System/Config/Source/CustomerGroup.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* Author : Ebizmarts <info@ebizmarts.com>
|
4 |
* Date : 8/29/14
|
@@ -8,7 +9,7 @@
|
|
8 |
*/
|
9 |
class Ebizmarts_MageMonkey_Model_System_Config_Source_CustomerGroup
|
10 |
{
|
11 |
-
protected $_group
|
12 |
|
13 |
/**
|
14 |
* Load lists and store on class property
|
@@ -18,7 +19,7 @@ class Ebizmarts_MageMonkey_Model_System_Config_Source_CustomerGroup
|
|
18 |
public function __construct()
|
19 |
{
|
20 |
$listId = Mage::helper('monkey')->config('list');
|
21 |
-
if(
|
22 |
$this->_group = Mage::getSingleton('monkey/api')
|
23 |
->listInterestGroupings($listId);
|
24 |
}
|
@@ -31,21 +32,21 @@ class Ebizmarts_MageMonkey_Model_System_Config_Source_CustomerGroup
|
|
31 |
*/
|
32 |
public function toOptionArray()
|
33 |
{
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
}
|
50 |
|
51 |
}
|
1 |
<?php
|
2 |
+
|
3 |
/**
|
4 |
* Author : Ebizmarts <info@ebizmarts.com>
|
5 |
* Date : 8/29/14
|
9 |
*/
|
10 |
class Ebizmarts_MageMonkey_Model_System_Config_Source_CustomerGroup
|
11 |
{
|
12 |
+
protected $_group = null;
|
13 |
|
14 |
/**
|
15 |
* Load lists and store on class property
|
19 |
public function __construct()
|
20 |
{
|
21 |
$listId = Mage::helper('monkey')->config('list');
|
22 |
+
if (is_null($this->_group)) {
|
23 |
$this->_group = Mage::getSingleton('monkey/api')
|
24 |
->listInterestGroupings($listId);
|
25 |
}
|
32 |
*/
|
33 |
public function toOptionArray()
|
34 |
{
|
35 |
+
$groups = array();
|
36 |
+
|
37 |
+
if(is_array($this->_group)){
|
38 |
+
foreach($this->_group as $group) {
|
39 |
+
$groups[] = array('value'=> $group['id'], 'label' => $group['name'],'style'=>'font-weight: bold;');
|
40 |
+
$prefix = $group['id'];
|
41 |
+
foreach($group['groups'] as $key=>$list){
|
42 |
+
$groups []= array('value' => $prefix.'_'.$list['name'], 'label' => $list['name'],'style'=>'padding-left:20px');
|
43 |
+
}
|
44 |
+
}
|
45 |
+
|
46 |
+
}else{
|
47 |
+
$groups []= array('value' => '', 'label' => Mage::helper('monkey')->__('--- No data ---'));
|
48 |
+
}
|
49 |
+
return $groups;
|
50 |
}
|
51 |
|
52 |
}
|
app/code/community/Ebizmarts/MageMonkey/Model/System/Config/Source/Ecommerce360.php
CHANGED
@@ -8,7 +8,6 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_MageMonkey_Model_System_Config_Source_Ecommerce360
|
13 |
{
|
14 |
/**
|
@@ -20,7 +19,7 @@ class Ebizmarts_MageMonkey_Model_System_Config_Source_Ecommerce360
|
|
20 |
{
|
21 |
return array(
|
22 |
array('value' => 1, 'label' => Mage::helper('monkey')->__('Referred Orders')),
|
23 |
-
array('value' => 2, 'label' => Mage::helper('monkey')->__('All Orders')),
|
24 |
array('value' => 3, 'label' => Mage::helper('monkey')->__('By Cron depending on the Orders Status')),
|
25 |
array('value' => 0, 'label' => Mage::helper('monkey')->__('-- Disabled --'))
|
26 |
);
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_MageMonkey_Model_System_Config_Source_Ecommerce360
|
12 |
{
|
13 |
/**
|
19 |
{
|
20 |
return array(
|
21 |
array('value' => 1, 'label' => Mage::helper('monkey')->__('Referred Orders')),
|
22 |
+
array('value' => 2, 'label' => Mage::helper('monkey')->__('All Front end Orders')),
|
23 |
array('value' => 3, 'label' => Mage::helper('monkey')->__('By Cron depending on the Orders Status')),
|
24 |
array('value' => 0, 'label' => Mage::helper('monkey')->__('-- Disabled --'))
|
25 |
);
|
app/code/community/Ebizmarts/MageMonkey/Model/System/Config/Source/List.php
CHANGED
@@ -8,34 +8,33 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_MageMonkey_Model_System_Config_Source_List
|
13 |
{
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
$max = Mage::helper('monkey')->config('maxlistsamount');
|
31 |
-
if(!is_numeric($max)){
|
32 |
$max = null;
|
33 |
}
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
|
40 |
/**
|
41 |
* Options getter
|
@@ -44,17 +43,17 @@ class Ebizmarts_MageMonkey_Model_System_Config_Source_List
|
|
44 |
*/
|
45 |
public function toOptionArray()
|
46 |
{
|
47 |
-
|
48 |
|
49 |
-
|
50 |
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
|
59 |
return $lists;
|
60 |
}
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_MageMonkey_Model_System_Config_Source_List
|
12 |
{
|
13 |
|
14 |
+
/**
|
15 |
+
* Lists for API key will be stored here
|
16 |
+
*
|
17 |
+
* @access protected
|
18 |
+
* @var array Email lists for given API key
|
19 |
+
*/
|
20 |
+
protected $_lists = null;
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Load lists and store on class property
|
24 |
+
*
|
25 |
+
* @return void
|
26 |
+
*/
|
27 |
+
public function __construct()
|
28 |
+
{
|
29 |
$max = Mage::helper('monkey')->config('maxlistsamount');
|
30 |
+
if (!is_numeric($max)) {
|
31 |
$max = null;
|
32 |
}
|
33 |
+
if (is_null($this->_lists)) {
|
34 |
+
$this->_lists = Mage::getSingleton('monkey/api')
|
35 |
+
->lists(null, null, $max);
|
36 |
+
}
|
37 |
+
}
|
38 |
|
39 |
/**
|
40 |
* Options getter
|
43 |
*/
|
44 |
public function toOptionArray()
|
45 |
{
|
46 |
+
$lists = array();
|
47 |
|
48 |
+
if (is_array($this->_lists)) {
|
49 |
|
50 |
+
foreach ($this->_lists['data'] as $list) {
|
51 |
+
$lists [] = array('value' => $list['id'], 'label' => $list['name'] . ' (' . $list['stats']['member_count'] . ' ' . Mage::helper('monkey')->__('members') . ')');
|
52 |
+
}
|
53 |
|
54 |
+
} else {
|
55 |
+
$lists [] = array('value' => '', 'label' => Mage::helper('monkey')->__('--- No data ---'));
|
56 |
+
}
|
57 |
|
58 |
return $lists;
|
59 |
}
|
app/code/community/Ebizmarts/MageMonkey/Model/System/Config/Source/OrderProcessLimit.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* Author : Ebizmarts <info@ebizmarts.com>
|
4 |
* Date : 8/18/14
|
@@ -6,7 +7,6 @@
|
|
6 |
* File : OrderProcessLimit.php
|
7 |
* Module : magemonkey
|
8 |
*/
|
9 |
-
|
10 |
class Ebizmarts_MageMonkey_Model_System_Config_Source_OrderProcessLimit
|
11 |
{
|
12 |
/**
|
1 |
<?php
|
2 |
+
|
3 |
/**
|
4 |
* Author : Ebizmarts <info@ebizmarts.com>
|
5 |
* Date : 8/18/14
|
7 |
* File : OrderProcessLimit.php
|
8 |
* Module : magemonkey
|
9 |
*/
|
|
|
10 |
class Ebizmarts_MageMonkey_Model_System_Config_Source_OrderProcessLimit
|
11 |
{
|
12 |
/**
|
app/code/community/Ebizmarts/MageMonkey/Model/System/Config/Source/OrderStatus.php
CHANGED
@@ -8,7 +8,6 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_MageMonkey_Model_System_Config_Source_OrderStatus
|
13 |
{
|
14 |
|
@@ -19,10 +18,10 @@ class Ebizmarts_MageMonkey_Model_System_Config_Source_OrderStatus
|
|
19 |
*/
|
20 |
public function toOptionArray()
|
21 |
{
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
|
27 |
}
|
28 |
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_MageMonkey_Model_System_Config_Source_OrderStatus
|
12 |
{
|
13 |
|
18 |
*/
|
19 |
public function toOptionArray()
|
20 |
{
|
21 |
+
$status = Mage::GetResourceModel('sales/order_status_collection')->toOptionArray();
|
22 |
+
$allStateOptions = array('value' => 'all_status', 'label' => Mage::helper('monkey')->__('All Status'));
|
23 |
+
array_unshift($status, $allStateOptions);
|
24 |
+
return $status;
|
25 |
|
26 |
}
|
27 |
|
app/code/community/Ebizmarts/MageMonkey/Model/System/Config/Source/Status.php
CHANGED
@@ -8,7 +8,6 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_MageMonkey_Model_System_Config_Source_Status
|
13 |
{
|
14 |
|
@@ -20,7 +19,7 @@ class Ebizmarts_MageMonkey_Model_System_Config_Source_Status
|
|
20 |
public function toOptionArray()
|
21 |
{
|
22 |
return array(
|
23 |
-
|
24 |
array('value' => 'unsubscribed', 'label' => Mage::helper('monkey')->__('Unsubscribed')),
|
25 |
array('value' => 'cleaned', 'label' => Mage::helper('monkey')->__('Cleaned')),
|
26 |
array('value' => 'updated', 'label' => Mage::helper('monkey')->__('Updated')),
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_MageMonkey_Model_System_Config_Source_Status
|
12 |
{
|
13 |
|
19 |
public function toOptionArray()
|
20 |
{
|
21 |
return array(
|
22 |
+
array('value' => 'subscribed', 'label' => Mage::helper('monkey')->__('Subscribed')),
|
23 |
array('value' => 'unsubscribed', 'label' => Mage::helper('monkey')->__('Unsubscribed')),
|
24 |
array('value' => 'cleaned', 'label' => Mage::helper('monkey')->__('Cleaned')),
|
25 |
array('value' => 'updated', 'label' => Mage::helper('monkey')->__('Updated')),
|
app/code/community/Ebizmarts/MageMonkey/Model/System/Config/Source/TransactionalEmails.php
CHANGED
@@ -8,22 +8,21 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_MageMonkey_Model_System_Config_Source_TransactionalEmails
|
13 |
{
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
public function toOptionArray()
|
21 |
{
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
}
|
28 |
|
29 |
}
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_MageMonkey_Model_System_Config_Source_TransactionalEmails
|
12 |
{
|
13 |
|
14 |
+
/**
|
15 |
+
* Return available options
|
16 |
+
*
|
17 |
+
* @return array
|
18 |
+
*/
|
19 |
public function toOptionArray()
|
20 |
{
|
21 |
+
return array(
|
22 |
+
array('value' => 'false', 'label' => Mage::helper('monkey')->__('Disabled')),
|
23 |
+
array('value' => 'sts', 'label' => Mage::helper('monkey')->__('STS')),
|
24 |
+
array('value' => 'mandrill', 'label' => Mage::helper('monkey')->__('Mandrill'))
|
25 |
+
);
|
26 |
}
|
27 |
|
28 |
}
|
app/code/community/Ebizmarts/MageMonkey/Model/System/Config/Source/WebhookDelete.php
CHANGED
@@ -8,7 +8,6 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_MageMonkey_Model_System_Config_Source_WebhookDelete
|
13 |
{
|
14 |
/**
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_MageMonkey_Model_System_Config_Source_WebhookDelete
|
12 |
{
|
13 |
/**
|
app/code/community/Ebizmarts/MageMonkey/Model/TransactionalEmail/Adapter.php
CHANGED
@@ -8,15 +8,14 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_MageMonkey_Model_TransactionalEmail_Adapter
|
13 |
{
|
14 |
-
const ADAPTER_STS
|
15 |
const ADAPTER_MANDRILL = 'mandrill';
|
16 |
|
17 |
public static function factory($adapter)
|
18 |
{
|
19 |
-
switch($adapter) {
|
20 |
case self::ADAPTER_STS:
|
21 |
return new Ebizmarts_MageMonkey_Model_TransactionalEmail_STS();
|
22 |
break;
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_MageMonkey_Model_TransactionalEmail_Adapter
|
12 |
{
|
13 |
+
const ADAPTER_STS = 'sts';
|
14 |
const ADAPTER_MANDRILL = 'mandrill';
|
15 |
|
16 |
public static function factory($adapter)
|
17 |
{
|
18 |
+
switch ($adapter) {
|
19 |
case self::ADAPTER_STS:
|
20 |
return new Ebizmarts_MageMonkey_Model_TransactionalEmail_STS();
|
21 |
break;
|
app/code/community/Ebizmarts/MageMonkey/Model/TransactionalEmail/MANDRILL.php
CHANGED
@@ -8,50 +8,49 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_MageMonkey_Model_TransactionalEmail_MANDRILL
|
13 |
{
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
public $version = '1.0';
|
21 |
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
public $errorMessage;
|
28 |
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
public $errorCode;
|
35 |
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
public $api_key;
|
42 |
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
public $apiUrl;
|
49 |
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
protected $_output = 'json';
|
56 |
|
57 |
/**
|
@@ -62,251 +61,251 @@ class Ebizmarts_MageMonkey_Model_TransactionalEmail_MANDRILL
|
|
62 |
*/
|
63 |
function __construct($apikey = null)
|
64 |
{
|
65 |
-
if($apikey){
|
66 |
-
|
67 |
-
|
68 |
}
|
69 |
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
|
80 |
$this->apiUrl = "http://mandrillapp.com/api/{$this->version}/";
|
81 |
|
82 |
return $this;
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
return $this->_callServer("users/ping");
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
return $this->_callServer("users/info");
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
return $this->_callServer("users/senders");
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
$params
|
124 |
$params["email"] = $email;
|
125 |
|
126 |
return $this->_callServer("users/disable-sender", $params);
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
$params
|
137 |
$params["email"] = $email;
|
138 |
|
139 |
return $this->_callServer("users/verify-sender", $params);
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
* string subject
|
164 |
-
|
165 |
-
* string from_name
|
166 |
-
* array to
|
167 |
-
* struct headers
|
168 |
-
* boolean track_opens
|
169 |
-
* boolean track_clicks
|
170 |
-
* array tags
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
$params
|
188 |
$params["message"] = $message;
|
189 |
|
190 |
return $this->_callServer("messages/send", $params);
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
$params
|
224 |
$params["tag"] = $tag;
|
225 |
|
226 |
-
|
227 |
-
|
228 |
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
|
242 |
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
public function urlsList()
|
252 |
{
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
public function urlsSearch($query)
|
262 |
{
|
263 |
-
$params
|
264 |
$params["q"] = $query;
|
265 |
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
$params
|
277 |
$params["url"] = $url;
|
278 |
|
279 |
-
|
280 |
-
|
281 |
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
|
286 |
|
287 |
/**
|
288 |
* Actually connect to the server and call the requested methods, parsing the result
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
*/
|
294 |
protected function _callServer($method, $params = array())
|
295 |
{
|
296 |
|
297 |
$this->errorMessage = null;
|
298 |
-
$this->errorCode
|
299 |
|
300 |
-
|
301 |
|
302 |
-
|
303 |
|
304 |
-
|
305 |
-
|
306 |
|
307 |
$curlSession = curl_init();
|
308 |
|
309 |
-
|
310 |
curl_setopt($curlSession, CURLOPT_URL, $url);
|
311 |
curl_setopt($curlSession, CURLOPT_HEADER, 0);
|
312 |
curl_setopt($curlSession, CURLOPT_POST, TRUE);
|
@@ -315,41 +314,41 @@ class Ebizmarts_MageMonkey_Model_TransactionalEmail_MANDRILL
|
|
315 |
//curl_setopt($curlSession, CURLOPT_SSL_VERIFYPEER, FALSE);
|
316 |
//curl_setopt($curlSession, CURLOPT_SSL_VERIFYHOST, 1);
|
317 |
|
318 |
-
|
319 |
-
if(!$result){
|
320 |
|
321 |
-
|
322 |
-
|
323 |
|
324 |
-
|
325 |
$this->errorCode = "-99";
|
326 |
return false;
|
327 |
-
|
328 |
|
329 |
// Check that a connection was made
|
330 |
if (curl_error($curlSession)) {
|
331 |
-
|
332 |
-
$this->errorCode
|
333 |
return false;
|
334 |
}
|
335 |
|
336 |
-
|
337 |
|
338 |
-
|
339 |
|
340 |
-
|
341 |
|
342 |
-
|
343 |
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
$this->errorCode
|
349 |
-
|
350 |
-
|
351 |
|
352 |
-
|
353 |
|
354 |
}
|
355 |
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_MageMonkey_Model_TransactionalEmail_MANDRILL
|
12 |
{
|
13 |
|
14 |
+
/**
|
15 |
+
* API version number
|
16 |
+
*
|
17 |
+
* @var string
|
18 |
+
*/
|
19 |
public $version = '1.0';
|
20 |
|
21 |
+
/**
|
22 |
+
* Error Message storage
|
23 |
+
*
|
24 |
+
* @var string
|
25 |
+
*/
|
26 |
public $errorMessage;
|
27 |
|
28 |
+
/**
|
29 |
+
* Error Code storage
|
30 |
+
*
|
31 |
+
* @var integer
|
32 |
+
*/
|
33 |
public $errorCode;
|
34 |
|
35 |
+
/**
|
36 |
+
* Cache the user api_key so we only have to log in once per client instantiation
|
37 |
+
*
|
38 |
+
* @var string MailChimp API key
|
39 |
+
*/
|
40 |
public $api_key;
|
41 |
|
42 |
+
/**
|
43 |
+
* STS API URL
|
44 |
+
*
|
45 |
+
* @var string
|
46 |
+
*/
|
47 |
public $apiUrl;
|
48 |
|
49 |
+
/**
|
50 |
+
* Request output format
|
51 |
+
*
|
52 |
+
* @var string
|
53 |
+
*/
|
54 |
protected $_output = 'json';
|
55 |
|
56 |
/**
|
61 |
*/
|
62 |
function __construct($apikey = null)
|
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_MANDRILL
|
74 |
+
*/
|
75 |
+
public function setApiKey($key)
|
76 |
+
{
|
77 |
+
$this->api_key = $key;
|
78 |
|
79 |
$this->apiUrl = "http://mandrillapp.com/api/{$this->version}/";
|
80 |
|
81 |
return $this;
|
82 |
+
}
|
83 |
+
|
84 |
+
/**
|
85 |
+
* ===== Users 유 Calls =====
|
86 |
+
*/
|
87 |
+
|
88 |
+
/**
|
89 |
+
* Validate an API key and respond to a ping
|
90 |
+
*
|
91 |
+
*/
|
92 |
+
public function usersPing()
|
93 |
+
{
|
94 |
return $this->_callServer("users/ping");
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Return the information about the API-connected user
|
99 |
+
*
|
100 |
+
*/
|
101 |
+
public function usersInfo()
|
102 |
+
{
|
103 |
return $this->_callServer("users/info");
|
104 |
+
}
|
105 |
+
|
106 |
+
/**
|
107 |
+
* Return the senders that have tried to use this account, both verified and unverified
|
108 |
+
*
|
109 |
+
*/
|
110 |
+
public function usersSenders()
|
111 |
+
{
|
112 |
return $this->_callServer("users/senders");
|
113 |
+
}
|
114 |
+
|
115 |
+
/**
|
116 |
+
* Disable a sender from being able to send
|
117 |
+
*
|
118 |
+
* @param string $email
|
119 |
+
*/
|
120 |
+
public function usersDisableSender($email)
|
121 |
+
{
|
122 |
+
$params = array();
|
123 |
$params["email"] = $email;
|
124 |
|
125 |
return $this->_callServer("users/disable-sender", $params);
|
126 |
+
}
|
127 |
+
|
128 |
+
/**
|
129 |
+
* Send an email to the given address to verify that it is an accepted sender for your Mandrill account.
|
130 |
+
*
|
131 |
+
* @param string $email
|
132 |
+
*/
|
133 |
+
public function usersVerifySender($email)
|
134 |
+
{
|
135 |
+
$params = array();
|
136 |
$params["email"] = $email;
|
137 |
|
138 |
return $this->_callServer("users/verify-sender", $params);
|
139 |
+
}
|
140 |
+
|
141 |
+
public function verifyEmailAddress($email)
|
142 |
+
{
|
143 |
+
return $this->usersVerifySender($email);
|
144 |
+
}
|
145 |
+
|
146 |
+
/**
|
147 |
+
*
|
148 |
+
* ===== Users 유 Calls =====
|
149 |
+
*/
|
150 |
+
|
151 |
+
|
152 |
+
/**
|
153 |
+
* ===== Messages ✐ Calls =====
|
154 |
+
*/
|
155 |
+
|
156 |
+
/**
|
157 |
+
* Send a new transactional message through Mandrill
|
158 |
+
*
|
159 |
+
* @param array $message The message data with the following keys:
|
160 |
+
* string html the full HTML content to be sent
|
161 |
+
* string text optional full text content to be sent
|
162 |
+
* string subject the message subject
|
163 |
+
* 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
|
164 |
+
* string from_name optional from name to be used
|
165 |
+
* 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
|
166 |
+
* struct headers optional extra headers to add to the message (currently only Reply-To and X-* headers are allowed)
|
167 |
+
* boolean track_opens whether or not to turn on open tracking for the message
|
168 |
+
* boolean track_clicks whether or not to turn on click tracking for the message
|
169 |
+
* 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.
|
170 |
+
*/
|
171 |
+
public function messagesSend($message)
|
172 |
+
{
|
173 |
+
|
174 |
+
$to = array();
|
175 |
+
|
176 |
+
foreach ($message['to_email'] as $pos => $email) {
|
177 |
+
$to [] = array(
|
178 |
+
'email' => $email,
|
179 |
+
'name' => $message['to_name'][$pos]
|
180 |
+
);
|
181 |
+
}
|
182 |
+
|
183 |
+
$message['to'] = $to;
|
184 |
+
unset($message['to_email'], $message['to_name']);
|
185 |
+
|
186 |
+
$params = array();
|
187 |
$params["message"] = $message;
|
188 |
|
189 |
return $this->_callServer("messages/send", $params);
|
190 |
+
}
|
191 |
+
|
192 |
+
public function sendEmail($message)
|
193 |
+
{
|
194 |
+
return $this->messagesSend($message);
|
195 |
+
}
|
196 |
+
|
197 |
+
/**
|
198 |
+
* ===== Messages ✐ Calls =====
|
199 |
+
*/
|
200 |
+
|
201 |
+
|
202 |
+
/**
|
203 |
+
* ===== Tags ✰ Calls =====
|
204 |
+
*/
|
205 |
+
|
206 |
+
/**
|
207 |
+
* Return all of the user-defined tag information
|
208 |
+
*
|
209 |
+
*/
|
210 |
+
public function tagsList()
|
211 |
+
{
|
212 |
+
return $this->_callServer("tags/list");
|
213 |
+
}
|
214 |
+
|
215 |
+
/**
|
216 |
+
* Return the recent history (hourly stats for the last 30 days) for a tag
|
217 |
+
*
|
218 |
+
* @param string $tag
|
219 |
+
*/
|
220 |
+
public function tagsTimeSeries($tag)
|
221 |
+
{
|
222 |
+
$params = array();
|
223 |
$params["tag"] = $tag;
|
224 |
|
225 |
+
return $this->_callServer("tags/time-series", $params);
|
226 |
+
}
|
227 |
|
228 |
+
/**
|
229 |
+
* Return the recent history (hourly stats for the last 30 days) for all tags
|
230 |
+
*
|
231 |
+
*/
|
232 |
+
public function tagsAllTimeSeries()
|
233 |
+
{
|
234 |
+
return $this->_callServer("tags/all-time-series");
|
235 |
+
}
|
236 |
|
237 |
+
/**
|
238 |
+
* ===== Tags ✰ Calls =====
|
239 |
+
*/
|
240 |
|
241 |
|
242 |
+
/**
|
243 |
+
* ===== Urls ≎ Calls =====
|
244 |
+
*/
|
245 |
|
246 |
+
/**
|
247 |
+
* Get the 100 most clicked URLs
|
248 |
+
*
|
249 |
+
*/
|
250 |
public function urlsList()
|
251 |
{
|
252 |
+
return $this->_callServer("urls/list");
|
253 |
+
}
|
254 |
+
|
255 |
+
/**
|
256 |
+
* Return the 100 most clicked URLs that match the search query given
|
257 |
+
*
|
258 |
+
* @param string $query
|
259 |
+
*/
|
260 |
public function urlsSearch($query)
|
261 |
{
|
262 |
+
$params = array();
|
263 |
$params["q"] = $query;
|
264 |
|
265 |
+
return $this->_callServer("urls/search", $params);
|
266 |
+
}
|
267 |
+
|
268 |
+
/**
|
269 |
+
* Return the recent history (hourly stats for the last 30 days) for a url
|
270 |
+
*
|
271 |
+
* @param string $url
|
272 |
+
*/
|
273 |
+
public function urlsTimeSeries($url)
|
274 |
+
{
|
275 |
+
$params = array();
|
276 |
$params["url"] = $url;
|
277 |
|
278 |
+
return $this->_callServer("urls/time-series", $params);
|
279 |
+
}
|
280 |
|
281 |
+
/**
|
282 |
+
* ===== Urls ≎ Calls =====
|
283 |
+
*/
|
284 |
|
285 |
|
286 |
/**
|
287 |
* Actually connect to the server and call the requested methods, parsing the result
|
288 |
+
*
|
289 |
+
* @param string $method
|
290 |
+
* @param array OPTIONAL $params
|
291 |
+
* @return object|false
|
292 |
*/
|
293 |
protected function _callServer($method, $params = array())
|
294 |
{
|
295 |
|
296 |
$this->errorMessage = null;
|
297 |
+
$this->errorCode = null;
|
298 |
|
299 |
+
$params['key'] = $this->api_key;
|
300 |
|
301 |
+
$url = $this->apiUrl . $method . '.' . $this->_output;
|
302 |
|
303 |
+
Mage::helper('monkey')->log($url, 'MageMonkey_ApiCall.log');
|
304 |
+
Mage::helper('monkey')->log($params, 'MageMonkey_ApiCall.log');
|
305 |
|
306 |
$curlSession = curl_init();
|
307 |
|
308 |
+
curl_setopt($curlSession, CURLOPT_USERAGENT, Mage::helper('monkey')->getUserAgent());
|
309 |
curl_setopt($curlSession, CURLOPT_URL, $url);
|
310 |
curl_setopt($curlSession, CURLOPT_HEADER, 0);
|
311 |
curl_setopt($curlSession, CURLOPT_POST, TRUE);
|
314 |
//curl_setopt($curlSession, CURLOPT_SSL_VERIFYPEER, FALSE);
|
315 |
//curl_setopt($curlSession, CURLOPT_SSL_VERIFYHOST, 1);
|
316 |
|
317 |
+
$result = curl_exec($curlSession);
|
318 |
+
if (!$result) {
|
319 |
|
320 |
+
$errstr = curl_error($curlSession);
|
321 |
+
$errno = curl_errno($curlSession);
|
322 |
|
323 |
+
$this->errorMessage = "Could not connect (ERR $errno: $errstr)";
|
324 |
$this->errorCode = "-99";
|
325 |
return false;
|
326 |
+
}
|
327 |
|
328 |
// Check that a connection was made
|
329 |
if (curl_error($curlSession)) {
|
330 |
+
$this->errorMessage = curl_error($curlSession);
|
331 |
+
$this->errorCode = "-99";
|
332 |
return false;
|
333 |
}
|
334 |
|
335 |
+
$httpCode = curl_getinfo($curlSession, CURLINFO_HTTP_CODE);
|
336 |
|
337 |
+
curl_close($curlSession);
|
338 |
|
339 |
+
$resultObject = json_decode($result);
|
340 |
|
341 |
+
Mage::helper('monkey')->log($resultObject, 'MageMonkey_ApiCall.log');
|
342 |
|
343 |
+
//You can consider any non-200 HTTP response code an error
|
344 |
+
//the returned data will contain more detailed information
|
345 |
+
if ($httpCode != 200) {
|
346 |
+
$this->errorMessage = $resultObject->message;
|
347 |
+
$this->errorCode = "-99";
|
348 |
+
return false;
|
349 |
+
}
|
350 |
|
351 |
+
return $resultObject;
|
352 |
|
353 |
}
|
354 |
|
app/code/community/Ebizmarts/MageMonkey/Model/TransactionalEmail/STS.php
CHANGED
@@ -8,49 +8,48 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_MageMonkey_Model_TransactionalEmail_STS
|
13 |
{
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
public $version = '1.0';
|
20 |
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
public $errorMessage;
|
27 |
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
public $errorCode;
|
34 |
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
public $api_key;
|
41 |
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
public $secure = false;
|
48 |
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
public $apiUrl;
|
55 |
|
56 |
/**
|
@@ -61,183 +60,183 @@ class Ebizmarts_MageMonkey_Model_TransactionalEmail_STS
|
|
61 |
*/
|
62 |
function __construct($apikey = null, $secure = false)
|
63 |
{
|
64 |
-
$this->secure
|
65 |
|
66 |
-
if($apikey){
|
67 |
-
|
68 |
-
|
69 |
}
|
70 |
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
if (!$dc){
|
85 |
-
|
86 |
-
|
87 |
}
|
88 |
$this->apiUrl = "http://{$dc}.sts.mailchimp.com/{$this->version}/";
|
89 |
|
90 |
return $this;
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
*
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
* @param array $tags
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
$params
|
124 |
-
$params["message"]
|
125 |
-
$params["track_opens"]
|
126 |
$params["track_clicks"] = $track_clicks;
|
127 |
-
$params["tags"]
|
128 |
|
129 |
return $this->_callServer("SendEmail", $params);
|
130 |
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
$params
|
153 |
$params["email"] = $email;
|
154 |
|
155 |
return $this->_callServer("VerifyEmailAddress", $params);
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
$params
|
168 |
$params["email"] = $email;
|
169 |
|
170 |
return $this->_callServer("DeleteVerifiedEmailAddress", $params);
|
171 |
-
|
172 |
|
173 |
/**
|
174 |
* Actually connect to the server and call the requested methods, parsing the result
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
*/
|
180 |
protected function _callServer($method, $params = array())
|
181 |
{
|
182 |
|
183 |
$this->errorMessage = null;
|
184 |
-
$this->errorCode
|
185 |
|
186 |
-
|
187 |
|
188 |
-
|
189 |
|
190 |
-
|
191 |
-
|
192 |
|
193 |
$curlSession = curl_init();
|
194 |
|
195 |
-
|
196 |
curl_setopt($curlSession, CURLOPT_URL, $url);
|
197 |
curl_setopt($curlSession, CURLOPT_HEADER, 0);
|
198 |
curl_setopt($curlSession, CURLOPT_POST, TRUE);
|
199 |
curl_setopt($curlSession, CURLOPT_POSTFIELDS, http_build_query($params));
|
200 |
curl_setopt($curlSession, CURLOPT_RETURNTRANSFER, TRUE);
|
201 |
|
202 |
-
if (TRUE === $this->secure){
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
}
|
207 |
|
208 |
-
|
209 |
-
if(!$result){
|
210 |
|
211 |
-
|
212 |
-
|
213 |
|
214 |
-
|
215 |
$this->errorCode = "-99";
|
216 |
return false;
|
217 |
-
|
218 |
|
219 |
// Check that a connection was made
|
220 |
if (curl_error($curlSession)) {
|
221 |
-
|
222 |
-
$this->errorCode
|
223 |
return false;
|
224 |
}
|
225 |
|
226 |
-
|
227 |
|
228 |
-
|
229 |
|
230 |
-
|
231 |
|
232 |
-
|
233 |
|
234 |
-
|
235 |
-
|
236 |
-
$this->errorCode
|
237 |
-
|
238 |
-
|
239 |
|
240 |
-
|
241 |
|
242 |
}
|
243 |
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_MageMonkey_Model_TransactionalEmail_STS
|
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 |
+
* Use Secure connection or not
|
43 |
+
*
|
44 |
+
* @var bool
|
45 |
+
*/
|
46 |
public $secure = false;
|
47 |
|
48 |
+
/**
|
49 |
+
* STS API URL
|
50 |
+
*
|
51 |
+
* @var string
|
52 |
+
*/
|
53 |
public $apiUrl;
|
54 |
|
55 |
/**
|
60 |
*/
|
61 |
function __construct($apikey = null, $secure = false)
|
62 |
{
|
63 |
+
$this->secure = $secure;
|
64 |
|
65 |
+
if ($apikey) {
|
66 |
+
$this->setApiKey($apikey);
|
67 |
+
}
|
68 |
}
|
69 |
|
70 |
+
/**
|
71 |
+
* Api key setter
|
72 |
+
*
|
73 |
+
* @param string $key API Key
|
74 |
+
* @return Ebizmarts_MageMonkey_Model_TransactionalEmail_STS
|
75 |
+
*/
|
76 |
+
public function setApiKey($key)
|
77 |
+
{
|
78 |
+
$this->api_key = $key;
|
79 |
+
|
80 |
+
$dc = "us1";
|
81 |
+
if (strstr($this->api_key, "-")) {
|
82 |
+
list($key, $dc) = explode("-", $this->api_key, 2);
|
83 |
+
if (!$dc) {
|
84 |
+
$dc = "us1";
|
85 |
+
}
|
86 |
}
|
87 |
$this->apiUrl = "http://{$dc}.sts.mailchimp.com/{$this->version}/";
|
88 |
|
89 |
return $this;
|
90 |
+
}
|
91 |
+
|
92 |
+
/**
|
93 |
+
* Composes an email message based on input data, and then immediately queues the message for sending.
|
94 |
+
* We manage requeuing for you, so if a message gets rejected for a queueing issue, you've completely blown out your Amazon sending limits.
|
95 |
+
* You are encourage to always make this call with a POST request.
|
96 |
+
*
|
97 |
+
* <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.>
|
98 |
+
*
|
99 |
+
*
|
100 |
+
* @param array $message The message data with the following keys:
|
101 |
+
* string html the full HTML content to be sent
|
102 |
+
* string text optional - the full Text content to be sent
|
103 |
+
* string subject the message subject
|
104 |
+
* string from_name the from name to be used
|
105 |
+
* string from_email a verified email address from ListVerifiedEmailAddresses
|
106 |
+
* array reply_to option the email address(es) that should be set as reply-to email addresses.
|
107 |
+
* array to_email an array containing up to 50 email addresses to receive this email
|
108 |
+
* 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.
|
109 |
+
* array cc_email optional - an array containing up to 50 email addresses to receive this email as CC recipients
|
110 |
+
* 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.
|
111 |
+
* array bcc_email optional - an array containing up to 50 email addresses to receive this email as BCC recipients
|
112 |
+
* 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.
|
113 |
+
* bool autogen_html optional - if an html section is not passed in, generate it from the text. For historical reasons, this defaults to true.
|
114 |
+
* @param bool $track_opens whether or not to turn on MailChimp-specific opens tracking
|
115 |
+
* @param bool $track_clicks whether or not to turn on MailChimp-specific click tracking
|
116 |
+
* @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.
|
117 |
+
* @return JSON object containing the "status" as either "sent" or "queued" along with extra info on what happened.
|
118 |
+
*/
|
119 |
+
public function sendEmail($message, $track_opens = FALSE, $track_clicks = FALSE, $tags = array())
|
120 |
+
{
|
121 |
+
|
122 |
+
$params = array();
|
123 |
+
$params["message"] = $message;
|
124 |
+
$params["track_opens"] = $track_opens;
|
125 |
$params["track_clicks"] = $track_clicks;
|
126 |
+
$params["tags"] = $tags;
|
127 |
|
128 |
return $this->_callServer("SendEmail", $params);
|
129 |
|
130 |
+
}
|
131 |
+
|
132 |
+
/**
|
133 |
+
* Returns a list containing all of the email addresses that have been verified.
|
134 |
+
*
|
135 |
+
* @return array
|
136 |
+
*/
|
137 |
+
public function listVerifiedEmailAddresses()
|
138 |
+
{
|
139 |
+
return $this->_callServer("ListVerifiedEmailAddresses");
|
140 |
+
}
|
141 |
+
|
142 |
+
/**
|
143 |
+
* Verifies an email address.
|
144 |
+
* This action causes a confirmation email message to be sent to the specified address.
|
145 |
+
*
|
146 |
+
* @param string $email Email address to be verified
|
147 |
+
* @return array
|
148 |
+
*/
|
149 |
+
public function verifyEmailAddress($email)
|
150 |
+
{
|
151 |
+
$params = array();
|
152 |
$params["email"] = $email;
|
153 |
|
154 |
return $this->_callServer("VerifyEmailAddress", $params);
|
155 |
+
}
|
156 |
+
|
157 |
+
/**
|
158 |
+
* Deletes a verified email address.
|
159 |
+
* This action takes immediate effect, so use it with care.
|
160 |
+
*
|
161 |
+
* @param string $email Email address to be deleted
|
162 |
+
* @return array
|
163 |
+
*/
|
164 |
+
public function deleteVerifiedEmailAddress($email)
|
165 |
+
{
|
166 |
+
$params = array();
|
167 |
$params["email"] = $email;
|
168 |
|
169 |
return $this->_callServer("DeleteVerifiedEmailAddress", $params);
|
170 |
+
}
|
171 |
|
172 |
/**
|
173 |
* Actually connect to the server and call the requested methods, parsing the result
|
174 |
+
*
|
175 |
+
* @param string $method
|
176 |
+
* @param array OPTIONAL $params
|
177 |
+
* @return object|false
|
178 |
*/
|
179 |
protected function _callServer($method, $params = array())
|
180 |
{
|
181 |
|
182 |
$this->errorMessage = null;
|
183 |
+
$this->errorCode = null;
|
184 |
|
185 |
+
$params['apikey'] = $this->api_key;
|
186 |
|
187 |
+
$url = $this->apiUrl . $method;
|
188 |
|
189 |
+
Mage::helper('monkey')->log($url, 'MageMonkey_ApiCall.log');
|
190 |
+
Mage::helper('monkey')->log($params, 'MageMonkey_ApiCall.log');
|
191 |
|
192 |
$curlSession = curl_init();
|
193 |
|
194 |
+
curl_setopt($curlSession, CURLOPT_USERAGENT, Mage::helper('monkey')->getUserAgent());
|
195 |
curl_setopt($curlSession, CURLOPT_URL, $url);
|
196 |
curl_setopt($curlSession, CURLOPT_HEADER, 0);
|
197 |
curl_setopt($curlSession, CURLOPT_POST, TRUE);
|
198 |
curl_setopt($curlSession, CURLOPT_POSTFIELDS, http_build_query($params));
|
199 |
curl_setopt($curlSession, CURLOPT_RETURNTRANSFER, TRUE);
|
200 |
|
201 |
+
if (TRUE === $this->secure) {
|
202 |
+
//TODO
|
203 |
+
//curl_setopt($curlSession, CURLOPT_SSL_VERIFYPEER, TRUE);
|
204 |
+
//curl_setopt($curlSession, CURLOPT_SSL_VERIFYHOST, TRUE);
|
205 |
}
|
206 |
|
207 |
+
$result = curl_exec($curlSession);
|
208 |
+
if (!$result) {
|
209 |
|
210 |
+
$errstr = curl_error($curlSession);
|
211 |
+
$errno = curl_errno($curlSession);
|
212 |
|
213 |
+
$this->errorMessage = "Could not connect (ERR $errno: $errstr)";
|
214 |
$this->errorCode = "-99";
|
215 |
return false;
|
216 |
+
}
|
217 |
|
218 |
// Check that a connection was made
|
219 |
if (curl_error($curlSession)) {
|
220 |
+
$this->errorMessage = curl_error($curlSession);
|
221 |
+
$this->errorCode = "-99";
|
222 |
return false;
|
223 |
}
|
224 |
|
225 |
+
$httpCode = curl_getinfo($curlSession, CURLINFO_HTTP_CODE);
|
226 |
|
227 |
+
curl_close($curlSession);
|
228 |
|
229 |
+
$resultObject = json_decode($result);
|
230 |
|
231 |
+
Mage::helper('monkey')->log($resultObject, 'MageMonkey_ApiCall.log');
|
232 |
|
233 |
+
if ($httpCode != 200) {
|
234 |
+
$this->errorMessage = $resultObject->message;
|
235 |
+
$this->errorCode = "-99";
|
236 |
+
return false;
|
237 |
+
}
|
238 |
|
239 |
+
return $resultObject;
|
240 |
|
241 |
}
|
242 |
|
app/code/community/Ebizmarts/MageMonkey/controllers/Adminhtml/BulksyncController.php
CHANGED
@@ -8,11 +8,10 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_MageMonkey_Adminhtml_BulksyncController extends Mage_Adminhtml_Controller_Action
|
13 |
{
|
14 |
|
15 |
-
|
16 |
|
17 |
/**
|
18 |
* Initialize action
|
@@ -22,70 +21,70 @@ class Ebizmarts_MageMonkey_Adminhtml_BulksyncController extends Mage_Adminhtml_C
|
|
22 |
protected function _initAction()
|
23 |
{
|
24 |
$this->_title($this->__('Newsletter'))
|
25 |
-
|
26 |
|
27 |
$this->loadLayout();
|
28 |
$this->_setActiveMenu('newsletter/magemonkey');
|
29 |
return $this;
|
30 |
}
|
31 |
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
$this->renderLayout();
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
$this->renderLayout();
|
50 |
-
|
51 |
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
$this->renderLayout();
|
57 |
-
|
58 |
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
$this->loadLayout();
|
65 |
$this->getResponse()->setBody(
|
66 |
$this->getLayout()->createBlock('monkey/adminhtml_bulksync_queueImport_grid')->toHtml()
|
67 |
);
|
68 |
-
|
69 |
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
$this->loadLayout();
|
76 |
$this->getResponse()->setBody(
|
77 |
$this->getLayout()->createBlock('monkey/adminhtml_bulksync_queueExport_grid')->toHtml()
|
78 |
);
|
79 |
-
|
80 |
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
protected function _initJob()
|
87 |
{
|
88 |
-
$id
|
89 |
$entity = $this->getRequest()->getParam('entity');
|
90 |
$job = Mage::getModel("monkey/bulksync{$entity}")->load($id);
|
91 |
|
@@ -99,13 +98,13 @@ class Ebizmarts_MageMonkey_Adminhtml_BulksyncController extends Mage_Adminhtml_C
|
|
99 |
return $job;
|
100 |
}
|
101 |
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
if ($job = $this->_initJob()) {
|
110 |
|
111 |
try {
|
@@ -113,97 +112,93 @@ class Ebizmarts_MageMonkey_Adminhtml_BulksyncController extends Mage_Adminhtml_C
|
|
113 |
$this->_getSession()->addSuccess(
|
114 |
$this->__('The job has been deleted.')
|
115 |
);
|
116 |
-
}
|
117 |
-
catch (Mage_Core_Exception $e) {
|
118 |
$this->_getSession()->addError($e->getMessage());
|
119 |
-
}
|
120 |
-
catch (Exception $e) {
|
121 |
$this->_getSession()->addError($this->__('The job has not been deleted.'));
|
122 |
Mage::logException($e);
|
123 |
}
|
124 |
$this->_redirectReferer($this->_defredirect);
|
125 |
|
126 |
}
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
if ($job = $this->_initJob()) {
|
137 |
|
138 |
try {
|
139 |
|
140 |
$job->setStatus('idle')
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
|
145 |
$this->_getSession()->addSuccess(
|
146 |
$this->__('The job has been updated.')
|
147 |
);
|
148 |
-
}
|
149 |
-
catch (Mage_Core_Exception $e) {
|
150 |
$this->_getSession()->addError($e->getMessage());
|
151 |
-
}
|
152 |
-
catch (Exception $e) {
|
153 |
$this->_getSession()->addError($this->__('The job has not been updated.'));
|
154 |
Mage::logException($e);
|
155 |
}
|
156 |
$this->_redirectReferer($this->_defredirect);
|
157 |
|
158 |
}
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
|
209 |
}
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_MageMonkey_Adminhtml_BulksyncController extends Mage_Adminhtml_Controller_Action
|
12 |
{
|
13 |
|
14 |
+
protected $_defredirect = 'monkey/adminhtml_ecommerce/';
|
15 |
|
16 |
/**
|
17 |
* Initialize action
|
21 |
protected function _initAction()
|
22 |
{
|
23 |
$this->_title($this->__('Newsletter'))
|
24 |
+
->_title($this->__('MailChimp'));
|
25 |
|
26 |
$this->loadLayout();
|
27 |
$this->_setActiveMenu('newsletter/magemonkey');
|
28 |
return $this;
|
29 |
}
|
30 |
|
31 |
+
/**
|
32 |
+
* Magento to MailChimp
|
33 |
+
*/
|
34 |
+
public function exportAction()
|
35 |
+
{
|
36 |
+
$this->_initAction();
|
37 |
+
$this->_title($this->__('Export'));
|
38 |
$this->renderLayout();
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* MailChimp to Magento
|
43 |
+
*/
|
44 |
+
public function importAction()
|
45 |
+
{
|
46 |
+
$this->_initAction();
|
47 |
+
$this->_title($this->__('Import'));
|
48 |
$this->renderLayout();
|
49 |
+
}
|
50 |
|
51 |
+
public function queueAction()
|
52 |
+
{
|
53 |
+
$this->_initAction();
|
54 |
+
$this->_title($this->__('Job Queue'));
|
55 |
$this->renderLayout();
|
56 |
+
}
|
57 |
|
58 |
+
/**
|
59 |
+
* Just the import grid for AJAX calls
|
60 |
+
*/
|
61 |
+
public function importgridAction()
|
62 |
+
{
|
63 |
$this->loadLayout();
|
64 |
$this->getResponse()->setBody(
|
65 |
$this->getLayout()->createBlock('monkey/adminhtml_bulksync_queueImport_grid')->toHtml()
|
66 |
);
|
67 |
+
}
|
68 |
|
69 |
+
/**
|
70 |
+
* Just the export grid for AJAX calls
|
71 |
+
*/
|
72 |
+
public function exportgridAction()
|
73 |
+
{
|
74 |
$this->loadLayout();
|
75 |
$this->getResponse()->setBody(
|
76 |
$this->getLayout()->createBlock('monkey/adminhtml_bulksync_queueExport_grid')->toHtml()
|
77 |
);
|
78 |
+
}
|
79 |
|
80 |
+
/**
|
81 |
+
* Initialize job based on job_id url param
|
82 |
+
*
|
83 |
+
* @return Ebizmarts_MageMonkey_Model_BulksyncExport|Ebizmarts_MageMonkey_Model_BulksyncImport
|
84 |
+
*/
|
85 |
protected function _initJob()
|
86 |
{
|
87 |
+
$id = $this->getRequest()->getParam('job_id');
|
88 |
$entity = $this->getRequest()->getParam('entity');
|
89 |
$job = Mage::getModel("monkey/bulksync{$entity}")->load($id);
|
90 |
|
98 |
return $job;
|
99 |
}
|
100 |
|
101 |
+
/**
|
102 |
+
* Delete a job from current schedule
|
103 |
+
*
|
104 |
+
* @return void
|
105 |
+
*/
|
106 |
+
public function deleteAction()
|
107 |
+
{
|
108 |
if ($job = $this->_initJob()) {
|
109 |
|
110 |
try {
|
112 |
$this->_getSession()->addSuccess(
|
113 |
$this->__('The job has been deleted.')
|
114 |
);
|
115 |
+
} catch (Mage_Core_Exception $e) {
|
|
|
116 |
$this->_getSession()->addError($e->getMessage());
|
117 |
+
} catch (Exception $e) {
|
|
|
118 |
$this->_getSession()->addError($this->__('The job has not been deleted.'));
|
119 |
Mage::logException($e);
|
120 |
}
|
121 |
$this->_redirectReferer($this->_defredirect);
|
122 |
|
123 |
}
|
124 |
+
}
|
125 |
+
|
126 |
+
/**
|
127 |
+
* Reset job status to IDLE
|
128 |
+
*
|
129 |
+
* @return void
|
130 |
+
*/
|
131 |
+
public function resetAction()
|
132 |
+
{
|
133 |
if ($job = $this->_initJob()) {
|
134 |
|
135 |
try {
|
136 |
|
137 |
$job->setStatus('idle')
|
138 |
+
->setProcessedCount(0)
|
139 |
+
->setLastProcessedId(0)
|
140 |
+
->save();
|
141 |
|
142 |
$this->_getSession()->addSuccess(
|
143 |
$this->__('The job has been updated.')
|
144 |
);
|
145 |
+
} catch (Mage_Core_Exception $e) {
|
|
|
146 |
$this->_getSession()->addError($e->getMessage());
|
147 |
+
} catch (Exception $e) {
|
|
|
148 |
$this->_getSession()->addError($this->__('The job has not been updated.'));
|
149 |
Mage::logException($e);
|
150 |
}
|
151 |
$this->_redirectReferer($this->_defredirect);
|
152 |
|
153 |
}
|
154 |
+
}
|
155 |
+
|
156 |
+
/**
|
157 |
+
* Schedule a job on database
|
158 |
+
*
|
159 |
+
* @return void
|
160 |
+
*/
|
161 |
+
public function saveAction()
|
162 |
+
{
|
163 |
+
$request = $this->getRequest();
|
164 |
+
|
165 |
+
if (!$request->isPost()) {
|
166 |
+
$this->_redirect('adminhtml/dashboard');
|
167 |
+
return;
|
168 |
+
}
|
169 |
+
|
170 |
+
$job = new Varien_Object;
|
171 |
+
if ($request->getPost('direction') == 'import') {
|
172 |
+
|
173 |
+
$job = Mage::getModel('monkey/bulksyncImport')
|
174 |
+
->setStatus('idle')
|
175 |
+
->setLists(serialize($request->getPost('list')))
|
176 |
+
->setImportTypes(serialize($request->getPost('import_types')))
|
177 |
+
->setCreateCustomer((int)$request->getPost('create_customers'));
|
178 |
+
|
179 |
+
if ($request->getPost('since')) {
|
180 |
+
$job->setSince($request->getPost('since') . ' 00:00:00');
|
181 |
+
}
|
182 |
+
|
183 |
+
$job->save();
|
184 |
+
|
185 |
+
} elseif ($request->getPost('direction') == 'export') {
|
186 |
+
|
187 |
+
$job = Mage::getModel('monkey/bulksyncExport')
|
188 |
+
->setStatus('idle')
|
189 |
+
->setStoreId((int)$request->getPost('store_id'))
|
190 |
+
->setLists(serialize($request->getPost('list')))
|
191 |
+
->setDataSourceEntity($request->getPost('data_source_entity'))
|
192 |
+
->save();
|
193 |
+
}
|
194 |
+
|
195 |
+
if ($job->getId()) {
|
196 |
+
$this->_getSession()->addSuccess($this->__('Job #%s was sucessfully scheduled.', $job->getId()));
|
197 |
+
} else {
|
198 |
+
$this->_getSession()->addError($this->__('Could not schedule job.'));
|
199 |
+
}
|
200 |
+
|
201 |
+
$this->_redirectReferer($this->_defredirect);
|
202 |
+
}
|
203 |
|
204 |
}
|
app/code/community/Ebizmarts/MageMonkey/controllers/Adminhtml/ConfigController.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* Author : Ebizmarts <info@ebizmarts.com>
|
4 |
* Date : 8/29/14
|
@@ -12,30 +13,26 @@ class Ebizmarts_MageMonkey_Adminhtml_ConfigController extends Mage_Adminhtml_Con
|
|
12 |
{
|
13 |
$params = $this->getRequest()->getParams();
|
14 |
$listId = $params['list'];
|
15 |
-
if(isset($params['store'])) {
|
16 |
$store = $params['store'];
|
17 |
$store = $this->_getStoreByCode($store);
|
18 |
$storeId = $store->getId();
|
19 |
-
}
|
20 |
-
else {
|
21 |
$storeId = null;
|
22 |
}
|
23 |
-
$originalGroups = Mage::getStoreConfig('monkey/general/cutomergroup'
|
24 |
-
$originalGroups = explode(","
|
25 |
$groups = Mage::getSingleton('monkey/api')->listInterestGroupings($listId);
|
26 |
$rc = array();
|
27 |
-
if(is_array($groups)) {
|
28 |
-
foreach($groups as $group)
|
29 |
-
|
30 |
-
$rc[] = array('value'=>$group['id'],'label'=>$group['name'],'disabled'=>1,'style'=>'font-weight: bold');
|
31 |
$prefix = $group['id'];
|
32 |
-
foreach($group['groups'] as $item)
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
else {
|
38 |
-
$rc[] = array('value'=>$prefix.'_'.$item['name'],'label'=>$item['name'],'style'=>'padding-left:20px',"selected"=>false);
|
39 |
}
|
40 |
}
|
41 |
}
|
@@ -45,12 +42,13 @@ class Ebizmarts_MageMonkey_Adminhtml_ConfigController extends Mage_Adminhtml_Con
|
|
45 |
return;
|
46 |
|
47 |
}
|
|
|
48 |
protected function _getStoreByCode($storeCode)
|
49 |
{
|
50 |
$stores = array_keys(Mage::app()->getStores());
|
51 |
-
foreach($stores as $id){
|
52 |
$store = Mage::app()->getStore($id);
|
53 |
-
if($store->getCode()
|
54 |
return $store;
|
55 |
}
|
56 |
}
|
1 |
<?php
|
2 |
+
|
3 |
/**
|
4 |
* Author : Ebizmarts <info@ebizmarts.com>
|
5 |
* Date : 8/29/14
|
13 |
{
|
14 |
$params = $this->getRequest()->getParams();
|
15 |
$listId = $params['list'];
|
16 |
+
if (isset($params['store'])) {
|
17 |
$store = $params['store'];
|
18 |
$store = $this->_getStoreByCode($store);
|
19 |
$storeId = $store->getId();
|
20 |
+
} else {
|
|
|
21 |
$storeId = null;
|
22 |
}
|
23 |
+
$originalGroups = Mage::getStoreConfig('monkey/general/cutomergroup', $storeId);
|
24 |
+
$originalGroups = explode(",", $originalGroups);
|
25 |
$groups = Mage::getSingleton('monkey/api')->listInterestGroupings($listId);
|
26 |
$rc = array();
|
27 |
+
if (is_array($groups)) {
|
28 |
+
foreach ($groups as $group) {
|
29 |
+
$rc[] = array('value' => $group['id'], 'label' => $group['name'], 'disabled' => 1, 'style' => 'font-weight: bold');
|
|
|
30 |
$prefix = $group['id'];
|
31 |
+
foreach ($group['groups'] as $item) {
|
32 |
+
if (in_array($prefix . '_' . $item['name'], $originalGroups)) {
|
33 |
+
$rc[] = array('value' => $prefix . '_' . $item['name'], 'label' => $item['name'], 'style' => 'padding-left:20px', "selected" => true);
|
34 |
+
} else {
|
35 |
+
$rc[] = array('value' => $prefix . '_' . $item['name'], 'label' => $item['name'], 'style' => 'padding-left:20px', "selected" => false);
|
|
|
|
|
36 |
}
|
37 |
}
|
38 |
}
|
42 |
return;
|
43 |
|
44 |
}
|
45 |
+
|
46 |
protected function _getStoreByCode($storeCode)
|
47 |
{
|
48 |
$stores = array_keys(Mage::app()->getStores());
|
49 |
+
foreach ($stores as $id) {
|
50 |
$store = Mage::app()->getStore($id);
|
51 |
+
if ($store->getCode() == $storeCode) {
|
52 |
return $store;
|
53 |
}
|
54 |
}
|
app/code/community/Ebizmarts/MageMonkey/controllers/Adminhtml/EcommerceController.php
CHANGED
@@ -8,55 +8,54 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_MageMonkey_Adminhtml_EcommerceController extends Mage_Adminhtml_Controller_Action
|
13 |
{
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
$this->_title($this->__('Newsletter'))
|
21 |
-
|
22 |
|
23 |
$this->loadLayout();
|
24 |
$this->_setActiveMenu('newsletter/magemonkey');
|
25 |
$this->renderLayout();
|
26 |
-
|
27 |
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
$this->loadLayout();
|
34 |
$this->getResponse()->setBody(
|
35 |
$this->getLayout()->createBlock('monkey/adminhtml_ecommerce_grid')->toHtml()
|
36 |
);
|
37 |
-
|
38 |
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
$this->_title($this->__('Newsletter'))
|
45 |
-
|
46 |
|
47 |
$this->loadLayout();
|
48 |
$this->_setActiveMenu('newsletter/magemonkey');
|
49 |
$this->renderLayout();
|
50 |
-
|
51 |
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
$orderIds = $this->getRequest()->getPost('order_ids', array());
|
58 |
-
$sent
|
59 |
-
$notSent
|
60 |
|
61 |
foreach ($orderIds as $orderId) {
|
62 |
$order = Mage::getModel('sales/order')->load($orderId);
|
@@ -66,7 +65,7 @@ class Ebizmarts_MageMonkey_Adminhtml_EcommerceController extends Mage_Adminhtml_
|
|
66 |
if ($result === TRUE) {
|
67 |
$sent++;
|
68 |
} else {
|
69 |
-
|
70 |
$notSent++;
|
71 |
}
|
72 |
}
|
@@ -81,59 +80,54 @@ class Ebizmarts_MageMonkey_Adminhtml_EcommerceController extends Mage_Adminhtml_
|
|
81 |
$this->_getSession()->addSuccess($this->__('%s order(s) have been sent successfully.', $sent));
|
82 |
}
|
83 |
$this->_redirect('adminhtml/sales_order/index');
|
84 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
|
86 |
-
/**
|
87 |
-
* Mass action remove order from ecommerce 360 grid
|
88 |
-
*/
|
89 |
-
public function massDeleteAction()
|
90 |
-
{
|
91 |
-
$orderIds = $this->getRequest()->getParam('orders');
|
92 |
-
if(!is_array($orderIds)) {
|
93 |
-
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('tax')->__('Please select Order(s).'));
|
94 |
-
} else {
|
95 |
-
try {
|
96 |
-
$ecommerce = Mage::getModel('monkey/ecommerce');
|
97 |
-
foreach ($orderIds as $orderId) {
|
98 |
-
$ecommerce->load($orderId)->delete();
|
99 |
-
}
|
100 |
-
Mage::getSingleton('adminhtml/session')->addSuccess(
|
101 |
-
Mage::helper('monkey')->__(
|
102 |
-
'Total of %d record(s) were deleted.', count($orderIds)
|
103 |
-
)
|
104 |
-
);
|
105 |
-
} catch (Exception $e) {
|
106 |
-
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
107 |
-
}
|
108 |
-
}
|
109 |
-
$this->_redirect('*/*/index');
|
110 |
-
}
|
111 |
public function resetLocalEcommerceAction()
|
112 |
{
|
113 |
$result = 1;
|
114 |
$store = $this->getRequest()->getParam('store');
|
115 |
-
if(!$store)
|
116 |
-
{
|
117 |
$collection = Mage::getModel('monkey/ecommerce')->getCollection();
|
118 |
-
}
|
119 |
-
else {
|
120 |
$allStores = Mage::app()->getStores();
|
121 |
-
foreach($allStores as $_store)
|
122 |
-
|
123 |
-
if($store==$_store->getCode())
|
124 |
break;
|
125 |
}
|
126 |
$storeId = $_store->getId();
|
127 |
$collection = Mage::getModel('monkey/ecommerce')->getCollection();
|
128 |
-
$collection->addFieldToFilter('main_table.store_id',array('eq'
|
129 |
}
|
130 |
-
foreach($collection as $item)
|
131 |
-
{
|
132 |
try {
|
133 |
$item->delete();
|
134 |
-
}
|
135 |
-
catch(exception $e)
|
136 |
-
{
|
137 |
$result = 0;
|
138 |
}
|
139 |
}
|
@@ -146,15 +140,12 @@ class Ebizmarts_MageMonkey_Adminhtml_EcommerceController extends Mage_Adminhtml_
|
|
146 |
$store = $this->getRequest()->getParam('store');
|
147 |
$storeId = null;
|
148 |
|
149 |
-
if(!$store)
|
150 |
-
{
|
151 |
$api = Mage::getSingleton('monkey/api');
|
152 |
-
}
|
153 |
-
else {
|
154 |
$allStores = Mage::app()->getStores();
|
155 |
-
foreach($allStores as $_store)
|
156 |
-
|
157 |
-
if($store==$_store->getCode())
|
158 |
break;
|
159 |
}
|
160 |
$storeId = $_store->getId();
|
@@ -162,20 +153,17 @@ class Ebizmarts_MageMonkey_Adminhtml_EcommerceController extends Mage_Adminhtml_
|
|
162 |
}
|
163 |
$start = 0;
|
164 |
$max = 500;
|
165 |
-
$orders = $api->ecommOrders($start
|
166 |
-
while($orders['total']>0)
|
167 |
-
{
|
168 |
$orders = $orders['data'];
|
169 |
-
foreach($orders as $order)
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
}
|
174 |
-
else {
|
175 |
$start++;
|
176 |
}
|
177 |
}
|
178 |
-
$orders = $api->ecommOrders($start
|
179 |
}
|
180 |
Mage::app()->getResponse()->setBody($result);
|
181 |
}
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_MageMonkey_Adminhtml_EcommerceController extends Mage_Adminhtml_Controller_Action
|
12 |
{
|
13 |
|
14 |
+
/**
|
15 |
+
* Display already sent orders
|
16 |
+
*/
|
17 |
+
public function indexAction()
|
18 |
+
{
|
19 |
$this->_title($this->__('Newsletter'))
|
20 |
+
->_title($this->__('MailChimp'));
|
21 |
|
22 |
$this->loadLayout();
|
23 |
$this->_setActiveMenu('newsletter/magemonkey');
|
24 |
$this->renderLayout();
|
25 |
+
}
|
26 |
|
27 |
+
/**
|
28 |
+
* Just the grid contents for AJAX requests
|
29 |
+
*/
|
30 |
+
public function gridAction()
|
31 |
+
{
|
32 |
$this->loadLayout();
|
33 |
$this->getResponse()->setBody(
|
34 |
$this->getLayout()->createBlock('monkey/adminhtml_ecommerce_grid')->toHtml()
|
35 |
);
|
36 |
+
}
|
37 |
|
38 |
+
/**
|
39 |
+
* Display already sent ALL orders from API
|
40 |
+
*/
|
41 |
+
public function apiordersAction()
|
42 |
+
{
|
43 |
$this->_title($this->__('Newsletter'))
|
44 |
+
->_title($this->__('MailChimp'));
|
45 |
|
46 |
$this->loadLayout();
|
47 |
$this->_setActiveMenu('newsletter/magemonkey');
|
48 |
$this->renderLayout();
|
49 |
+
}
|
50 |
|
51 |
+
/**
|
52 |
+
* Mass action send order to mailchimp
|
53 |
+
*/
|
54 |
+
public function masssendAction()
|
55 |
+
{
|
56 |
$orderIds = $this->getRequest()->getPost('order_ids', array());
|
57 |
+
$sent = 0;
|
58 |
+
$notSent = 0;
|
59 |
|
60 |
foreach ($orderIds as $orderId) {
|
61 |
$order = Mage::getModel('sales/order')->load($orderId);
|
65 |
if ($result === TRUE) {
|
66 |
$sent++;
|
67 |
} else {
|
68 |
+
$this->_getSession()->addError($this->__('Error on order #%s, - %s -', $order->getIncrementId(), $result));
|
69 |
$notSent++;
|
70 |
}
|
71 |
}
|
80 |
$this->_getSession()->addSuccess($this->__('%s order(s) have been sent successfully.', $sent));
|
81 |
}
|
82 |
$this->_redirect('adminhtml/sales_order/index');
|
83 |
+
}
|
84 |
+
|
85 |
+
/**
|
86 |
+
* Mass action remove order from ecommerce 360 grid
|
87 |
+
*/
|
88 |
+
public function massDeleteAction()
|
89 |
+
{
|
90 |
+
$orderIds = $this->getRequest()->getParam('orders');
|
91 |
+
if (!is_array($orderIds)) {
|
92 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('tax')->__('Please select Order(s).'));
|
93 |
+
} else {
|
94 |
+
try {
|
95 |
+
$ecommerce = Mage::getModel('monkey/ecommerce');
|
96 |
+
foreach ($orderIds as $orderId) {
|
97 |
+
$ecommerce->load($orderId)->delete();
|
98 |
+
}
|
99 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
100 |
+
Mage::helper('monkey')->__(
|
101 |
+
'Total of %d record(s) were deleted.', count($orderIds)
|
102 |
+
)
|
103 |
+
);
|
104 |
+
} catch (Exception $e) {
|
105 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
106 |
+
}
|
107 |
+
}
|
108 |
+
$this->_redirect('*/*/index');
|
109 |
+
}
|
110 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
public function resetLocalEcommerceAction()
|
112 |
{
|
113 |
$result = 1;
|
114 |
$store = $this->getRequest()->getParam('store');
|
115 |
+
if (!$store) {
|
|
|
116 |
$collection = Mage::getModel('monkey/ecommerce')->getCollection();
|
117 |
+
} else {
|
|
|
118 |
$allStores = Mage::app()->getStores();
|
119 |
+
foreach ($allStores as $_store) {
|
120 |
+
if ($store == $_store->getCode())
|
|
|
121 |
break;
|
122 |
}
|
123 |
$storeId = $_store->getId();
|
124 |
$collection = Mage::getModel('monkey/ecommerce')->getCollection();
|
125 |
+
$collection->addFieldToFilter('main_table.store_id', array('eq' => $storeId));
|
126 |
}
|
127 |
+
foreach ($collection as $item) {
|
|
|
128 |
try {
|
129 |
$item->delete();
|
130 |
+
} catch (exception $e) {
|
|
|
|
|
131 |
$result = 0;
|
132 |
}
|
133 |
}
|
140 |
$store = $this->getRequest()->getParam('store');
|
141 |
$storeId = null;
|
142 |
|
143 |
+
if (!$store) {
|
|
|
144 |
$api = Mage::getSingleton('monkey/api');
|
145 |
+
} else {
|
|
|
146 |
$allStores = Mage::app()->getStores();
|
147 |
+
foreach ($allStores as $_store) {
|
148 |
+
if ($store == $_store->getCode())
|
|
|
149 |
break;
|
150 |
}
|
151 |
$storeId = $_store->getId();
|
153 |
}
|
154 |
$start = 0;
|
155 |
$max = 500;
|
156 |
+
$orders = $api->ecommOrders($start, $max);
|
157 |
+
while ($orders['total'] > 0) {
|
|
|
158 |
$orders = $orders['data'];
|
159 |
+
foreach ($orders as $order) {
|
160 |
+
if ($order['store_id'] == $storeId || $storeId == null) {
|
161 |
+
$api->ecommOrderDel($order['store_id'], $order['order_id']);
|
162 |
+
} else {
|
|
|
|
|
163 |
$start++;
|
164 |
}
|
165 |
}
|
166 |
+
$orders = $api->ecommOrders($start, $max);
|
167 |
}
|
168 |
Mage::app()->getResponse()->setBody($result);
|
169 |
}
|
app/code/community/Ebizmarts/MageMonkey/controllers/Adminhtml/TransactionalemailController.php
CHANGED
@@ -8,7 +8,6 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_MageMonkey_Adminhtml_TransactionalemailController extends Mage_Adminhtml_Controller_Action
|
13 |
{
|
14 |
|
@@ -20,116 +19,116 @@ class Ebizmarts_MageMonkey_Adminhtml_TransactionalemailController extends Mage_A
|
|
20 |
protected function _initAction()
|
21 |
{
|
22 |
$this->_title($this->__('Newsletter'))
|
23 |
-
|
24 |
|
25 |
$this->loadLayout();
|
26 |
$this->_setActiveMenu('newsletter/magemonkey');
|
27 |
return $this;
|
28 |
}
|
29 |
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
$this->renderLayout();
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
$this->renderLayout();
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
$this->renderLayout();
|
58 |
-
|
59 |
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
|
64 |
-
|
65 |
|
66 |
-
|
67 |
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
|
73 |
-
|
74 |
-
|
75 |
|
76 |
$mail->verifyEmailAddress($this->getRequest()->getPost('email_address'));
|
77 |
-
if($mail->errorCode){
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
|
100 |
$mail->usersDisableSender($email);
|
101 |
-
if($mail->errorCode){
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
|
124 |
$mail->deleteVerifiedEmailAddress($email);
|
125 |
-
if($mail->errorCode){
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
|
135 |
}
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_MageMonkey_Adminhtml_TransactionalemailController extends Mage_Adminhtml_Controller_Action
|
12 |
{
|
13 |
|
19 |
protected function _initAction()
|
20 |
{
|
21 |
$this->_title($this->__('Newsletter'))
|
22 |
+
->_title($this->__('MailChimp'));
|
23 |
|
24 |
$this->loadLayout();
|
25 |
$this->_setActiveMenu('newsletter/magemonkey');
|
26 |
return $this;
|
27 |
}
|
28 |
|
29 |
+
/**
|
30 |
+
* Mandrill verified emails grid
|
31 |
+
*/
|
32 |
+
public function mandrillAction()
|
33 |
+
{
|
34 |
+
$this->_initAction();
|
35 |
+
$this->_title($this->__('Mandrill'));
|
36 |
$this->renderLayout();
|
37 |
+
}
|
38 |
+
|
39 |
+
/**
|
40 |
+
* STS verified emails grid
|
41 |
+
*/
|
42 |
+
public function stsAction()
|
43 |
+
{
|
44 |
+
$this->_initAction();
|
45 |
+
$this->_title($this->__('Amazon Simple Email Service'));
|
46 |
$this->renderLayout();
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Delete valid email address from Amazon SES
|
51 |
+
*/
|
52 |
+
public function newAction()
|
53 |
+
{
|
54 |
+
$this->_initAction();
|
55 |
+
$this->_title($this->__('Validate Email'));
|
56 |
$this->renderLayout();
|
57 |
+
}
|
58 |
|
59 |
+
public function validateEmailAction()
|
60 |
+
{
|
61 |
+
$service = $this->getRequest()->getPost('service', 'sts');
|
62 |
|
63 |
+
if ($this->getRequest()->isPost() && $service) {
|
64 |
|
65 |
+
$store = $this->getRequest()->getPost('store');
|
66 |
|
67 |
+
$apiKey = Mage::helper('monkey')->getApiKey($store);
|
68 |
+
if ($service == 'mandrill') {
|
69 |
+
$apiKey = Mage::helper('monkey')->getMandrillApiKey($store);
|
70 |
+
}
|
71 |
|
72 |
+
$mail = Ebizmarts_MageMonkey_Model_TransactionalEmail_Adapter::factory($service)
|
73 |
+
->setApiKey($apiKey);
|
74 |
|
75 |
$mail->verifyEmailAddress($this->getRequest()->getPost('email_address'));
|
76 |
+
if ($mail->errorCode) {
|
77 |
+
$this->_getSession()->addError($this->__($mail->errorMessage));
|
78 |
+
} else {
|
79 |
+
$this->_getSession()->addSuccess($this->__('Email address verified.'));
|
80 |
+
}
|
81 |
+
}
|
82 |
+
|
83 |
+
$this->_redirect('monkey/adminhtml_transactionalemail/' . $service);
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Delete valid email address from Mandrill
|
88 |
+
*/
|
89 |
+
public function mandrillDisableAction()
|
90 |
+
{
|
91 |
+
$email = $this->getRequest()->getParam('email');
|
92 |
+
$store = $this->getRequest()->getParam('store', 0);
|
93 |
+
|
94 |
+
if ($email) {
|
95 |
+
$apiKey = Mage::helper('monkey')->getMandrillApiKey($store);
|
96 |
+
$mail = Ebizmarts_MageMonkey_Model_TransactionalEmail_Adapter::factory('mandrill')
|
97 |
+
->setApiKey($apiKey);
|
98 |
|
99 |
$mail->usersDisableSender($email);
|
100 |
+
if ($mail->errorCode) {
|
101 |
+
$this->_getSession()->addError($this->__($mail->errorMessage));
|
102 |
+
} else {
|
103 |
+
$this->_getSession()->addSuccess($this->__('Email address was disabled.'));
|
104 |
+
}
|
105 |
+
}
|
106 |
+
|
107 |
+
$this->_redirect('monkey/adminhtml_transactionalemail/mandrill');
|
108 |
+
}
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Delete valid email address from Amazon SES
|
112 |
+
*/
|
113 |
+
public function stsDeleteAction()
|
114 |
+
{
|
115 |
+
$email = $this->getRequest()->getParam('email');
|
116 |
+
$store = $this->getRequest()->getParam('store', 0);
|
117 |
+
|
118 |
+
if ($email) {
|
119 |
+
$apiKey = Mage::helper('monkey')->getApiKey($store);
|
120 |
+
$mail = Ebizmarts_MageMonkey_Model_TransactionalEmail_Adapter::factory('sts')
|
121 |
+
->setApiKey($apiKey);
|
122 |
|
123 |
$mail->deleteVerifiedEmailAddress($email);
|
124 |
+
if ($mail->errorCode) {
|
125 |
+
$this->_getSession()->addError($this->__($mail->errorMessage));
|
126 |
+
} else {
|
127 |
+
$this->_getSession()->addSuccess($this->__('Email address deleted.'));
|
128 |
+
}
|
129 |
+
}
|
130 |
+
|
131 |
+
$this->_redirect('monkey/adminhtml_transactionalemail/sts');
|
132 |
+
}
|
133 |
|
134 |
}
|
app/code/community/Ebizmarts/MageMonkey/controllers/Customer/AccountController.php
CHANGED
@@ -8,7 +8,6 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_MageMonkey_Customer_AccountController extends Mage_Core_Controller_Front_Action
|
13 |
{
|
14 |
|
@@ -40,16 +39,16 @@ class Ebizmarts_MageMonkey_Customer_AccountController extends Mage_Core_Controll
|
|
40 |
return Mage::getSingleton('customer/session');
|
41 |
}
|
42 |
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
$this->loadLayout();
|
49 |
$this->_initLayoutMessages('customer/session');
|
50 |
|
51 |
$this->getLayout()->getBlock('head')->setTitle($this->__('Newsletter Subscription'));
|
52 |
$this->renderLayout();
|
53 |
-
|
54 |
|
55 |
}
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_MageMonkey_Customer_AccountController extends Mage_Core_Controller_Front_Action
|
12 |
{
|
13 |
|
39 |
return Mage::getSingleton('customer/session');
|
40 |
}
|
41 |
|
42 |
+
/**
|
43 |
+
* Display data
|
44 |
+
*/
|
45 |
+
public function indexAction()
|
46 |
+
{
|
47 |
$this->loadLayout();
|
48 |
$this->_initLayoutMessages('customer/session');
|
49 |
|
50 |
$this->getLayout()->getBlock('head')->setTitle($this->__('Newsletter Subscription'));
|
51 |
$this->renderLayout();
|
52 |
+
}
|
53 |
|
54 |
}
|
app/code/community/Ebizmarts/MageMonkey/controllers/SignupController.php
CHANGED
@@ -7,42 +7,41 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_MageMonkey_SignupController extends Mage_Core_Controller_Front_Action
|
12 |
{
|
13 |
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
|
21 |
-
|
22 |
-
|
23 |
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
|
32 |
-
|
33 |
|
34 |
-
|
35 |
-
|
36 |
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
|
45 |
-
|
46 |
-
|
47 |
|
48 |
}
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_MageMonkey_SignupController extends Mage_Core_Controller_Front_Action
|
11 |
{
|
12 |
|
13 |
+
/**
|
14 |
+
* Perform saving operation, update grouping and subscribe/unsubscribe operations
|
15 |
+
*/
|
16 |
+
public function saveadditionalAction()
|
17 |
+
{
|
18 |
+
if ($this->getRequest()->isPost()) {
|
19 |
|
20 |
+
$loggedIn = Mage::helper('customer')->isLoggedIn();
|
21 |
+
$guestEmail = $this->getRequest()->getPost('monkey_email');
|
22 |
|
23 |
+
if (!$loggedIn && !Zend_Validate::is($guestEmail, 'EmailAddress')) {
|
24 |
+
Mage::getSingleton('core/session')
|
25 |
+
->addError($this->__('Please specify a valid email address.'));
|
26 |
+
$this->_redirect($this->_getRedirectPath());
|
27 |
+
return;
|
28 |
+
}
|
29 |
+
Mage::helper('monkey')->handlePost($this->getRequest(), $guestEmail);
|
30 |
|
31 |
+
}
|
32 |
|
33 |
+
$this->_redirect($this->_getRedirectPath());
|
34 |
+
}
|
35 |
|
36 |
+
protected function _getRedirectPath()
|
37 |
+
{
|
38 |
+
$path = '/';
|
39 |
|
40 |
+
if (Mage::helper('customer')->isLoggedIn()) {
|
41 |
+
$path = 'monkey/customer_account/index';
|
42 |
+
}
|
43 |
|
44 |
+
return $path;
|
45 |
+
}
|
46 |
|
47 |
}
|
app/code/community/Ebizmarts/MageMonkey/controllers/WebhookController.php
CHANGED
@@ -8,45 +8,43 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_MageMonkey_WebhookController extends Mage_Core_Controller_Front_Action
|
13 |
{
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
}
|
51 |
|
52 |
}
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_MageMonkey_WebhookController extends Mage_Core_Controller_Front_Action
|
12 |
{
|
13 |
|
14 |
+
/**
|
15 |
+
* Entry point for all webhook operations
|
16 |
+
*/
|
17 |
+
public function indexAction()
|
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 |
+
Mage::helper('monkey')->log(print_r($this->getRequest()->getPost(), true));
|
30 |
+
|
31 |
+
Mage::app()->setCurrentStore(Mage::app()->getDefaultStoreView());
|
32 |
+
|
33 |
+
$data = $this->getRequest()->getPost('data');
|
34 |
+
$myKey = Mage::helper('monkey')->getWebhooksKey(null, $data['list_id']);
|
35 |
+
|
36 |
+
//Validate "wkey" GET parameter
|
37 |
+
if ($this->getRequest()->getPost('type')) {
|
38 |
+
Mage::getModel('monkey/monkey')->processWebhookData($this->getRequest()->getPost());
|
39 |
+
} else {
|
40 |
+
if ($myKey != $requestKey) {
|
41 |
+
Mage::helper('monkey')->log($this->__('Webhook Key invalid! Key Request: %s - My Key: %s', $requestKey, $myKey));
|
42 |
+
}
|
43 |
+
|
44 |
+
Mage::helper('monkey')->log($this->__('Webhook call ended'));
|
45 |
+
}
|
46 |
+
|
47 |
+
|
48 |
+
}
|
|
|
49 |
|
50 |
}
|
app/code/community/Ebizmarts/MageMonkey/etc/adminhtml.xml
CHANGED
@@ -6,45 +6,45 @@
|
|
6 |
<magemonkey translate="title" module="monkey">
|
7 |
<title>MailChimp</title>
|
8 |
<children>
|
9 |
-
|
10 |
-
|
11 |
<children>
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
</children>
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
</children>
|
36 |
</magemonkey>
|
37 |
</children>
|
38 |
</newsletter>
|
39 |
</menu>
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
<children>
|
49 |
<ecommerce translate="title" module="monkey">
|
50 |
<title>Ecommerce 360 Orders</title>
|
@@ -69,22 +69,22 @@
|
|
69 |
</children>
|
70 |
</bulksync>
|
71 |
</children>
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
</config>
|
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 |
<children>
|
49 |
<ecommerce translate="title" module="monkey">
|
50 |
<title>Ecommerce 360 Orders</title>
|
69 |
</children>
|
70 |
</bulksync>
|
71 |
</children>
|
72 |
+
</magemonkey>
|
73 |
+
</children>
|
74 |
+
</newsletter>
|
75 |
+
<system>
|
76 |
+
<children>
|
77 |
+
<config>
|
78 |
+
<children>
|
79 |
+
<monkey translate="title" module="monkey">
|
80 |
+
<title>MailChimp Configuration</title>
|
81 |
+
</monkey>
|
82 |
+
</children>
|
83 |
+
</config>
|
84 |
+
</children>
|
85 |
+
</system>
|
86 |
+
</children>
|
87 |
+
</admin>
|
88 |
+
</resources>
|
89 |
+
</acl>
|
90 |
</config>
|
app/code/community/Ebizmarts/MageMonkey/etc/config.xml
CHANGED
@@ -10,11 +10,11 @@
|
|
10 |
<config>
|
11 |
<modules>
|
12 |
<Ebizmarts_MageMonkey>
|
13 |
-
|
14 |
</Ebizmarts_MageMonkey>
|
15 |
</modules>
|
16 |
<global>
|
17 |
-
|
18 |
<newsletter_subscriber_save_before>
|
19 |
<observers>
|
20 |
<monkey_subscribe_observer>
|
@@ -39,7 +39,7 @@
|
|
39 |
</monkey_update_customer>
|
40 |
</observers>
|
41 |
</customer_save_after>
|
42 |
-
|
43 |
<models>
|
44 |
<monkey>
|
45 |
<class>Ebizmarts_MageMonkey_Model</class>
|
@@ -48,12 +48,24 @@
|
|
48 |
<monkey_mysql4>
|
49 |
<class>Ebizmarts_MageMonkey_Model_Mysql4</class>
|
50 |
<entities>
|
51 |
-
<apidebug
|
52 |
-
|
53 |
-
|
54 |
-
<
|
55 |
-
|
56 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
</entities>
|
58 |
</monkey_mysql4>
|
59 |
<newsletter>
|
@@ -120,67 +132,67 @@
|
|
120 |
</updates>
|
121 |
</layout>
|
122 |
<events>
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
</frontend>
|
165 |
<admin>
|
166 |
<routers>
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
</routers>
|
175 |
</admin>
|
176 |
<adminhtml>
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
<translate>
|
185 |
<modules>
|
186 |
<Ebizmarts_MageMonkey>
|
@@ -227,23 +239,25 @@
|
|
227 |
</events>
|
228 |
</adminhtml>
|
229 |
<default>
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
|
|
238 |
<maxlistsamount>25</maxlistsamount>
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
|
|
244 |
<checkout_async>1</checkout_async>
|
245 |
<markfield>HASCLICKED</markfield>
|
246 |
-
|
247 |
<ecommerce360>
|
248 |
<active>0</active>
|
249 |
<order_status>all_status</order_status>
|
@@ -252,37 +266,65 @@
|
|
252 |
<updates_url><![CDATA[http://store.ebizmarts.com/media/feeds/]]></updates_url>
|
253 |
<check_frequency>86400</check_frequency>
|
254 |
</notifications>
|
255 |
-
|
256 |
</default>
|
257 |
<crontab>
|
258 |
<jobs>
|
259 |
<magemonkey_bulksync_export_subscribers>
|
260 |
-
<schedule
|
261 |
-
|
|
|
|
|
|
|
|
|
262 |
</magemonkey_bulksync_export_subscribers>
|
263 |
<magemonkey_bulksync_import_subscribers>
|
264 |
-
<schedule
|
265 |
-
|
|
|
|
|
|
|
|
|
266 |
</magemonkey_bulksync_import_subscribers>
|
267 |
<magemonkey_autoexport_subscribers>
|
268 |
-
<schedule
|
269 |
-
|
|
|
|
|
|
|
|
|
270 |
</magemonkey_autoexport_subscribers>
|
271 |
<magemonkey_sendorders_asynch>
|
272 |
-
<schedule
|
273 |
-
|
|
|
|
|
|
|
|
|
274 |
</magemonkey_sendorders_asynch>
|
275 |
<magemonkey_cleanorders_asynch>
|
276 |
-
<schedule
|
277 |
-
|
|
|
|
|
|
|
|
|
278 |
</magemonkey_cleanorders_asynch>
|
279 |
<magemonkey_sendsubscribers_asynch>
|
280 |
-
<schedule
|
281 |
-
|
|
|
|
|
|
|
|
|
282 |
</magemonkey_sendsubscribers_asynch>
|
283 |
<magemonkey_cleansubscribers_asynch>
|
284 |
-
<schedule
|
285 |
-
|
|
|
|
|
|
|
|
|
286 |
</magemonkey_cleansubscribers_asynch>
|
287 |
</jobs>
|
288 |
</crontab>
|
10 |
<config>
|
11 |
<modules>
|
12 |
<Ebizmarts_MageMonkey>
|
13 |
+
<version>1.1.31</version>
|
14 |
</Ebizmarts_MageMonkey>
|
15 |
</modules>
|
16 |
<global>
|
17 |
+
<events>
|
18 |
<newsletter_subscriber_save_before>
|
19 |
<observers>
|
20 |
<monkey_subscribe_observer>
|
39 |
</monkey_update_customer>
|
40 |
</observers>
|
41 |
</customer_save_after>
|
42 |
+
</events>
|
43 |
<models>
|
44 |
<monkey>
|
45 |
<class>Ebizmarts_MageMonkey_Model</class>
|
48 |
<monkey_mysql4>
|
49 |
<class>Ebizmarts_MageMonkey_Model_Mysql4</class>
|
50 |
<entities>
|
51 |
+
<apidebug>
|
52 |
+
<table>magemonkey_api_debug</table>
|
53 |
+
</apidebug>
|
54 |
+
<ecommerce>
|
55 |
+
<table>magemonkey_ecommerce360</table>
|
56 |
+
</ecommerce>
|
57 |
+
<bulksync_export>
|
58 |
+
<table>magemonkey_bulksync_export</table>
|
59 |
+
</bulksync_export>
|
60 |
+
<bulksync_import>
|
61 |
+
<table>magemonkey_bulksync_import</table>
|
62 |
+
</bulksync_import>
|
63 |
+
<asyncsubscribers>
|
64 |
+
<table>magemonkey_async_subscribers</table>
|
65 |
+
</asyncsubscribers>
|
66 |
+
<asyncorders>
|
67 |
+
<table>magemonkey_async_orders</table>
|
68 |
+
</asyncorders>
|
69 |
</entities>
|
70 |
</monkey_mysql4>
|
71 |
<newsletter>
|
132 |
</updates>
|
133 |
</layout>
|
134 |
<events>
|
135 |
+
<controller_action_predispatch_onestepcheckout_index_index>
|
136 |
+
<observers>
|
137 |
+
<monkey_subscribe_checkout>
|
138 |
+
<class>monkey/observer</class>
|
139 |
+
<method>registerCheckoutSubscribe</method>
|
140 |
+
</monkey_subscribe_checkout>
|
141 |
+
</observers>
|
142 |
+
</controller_action_predispatch_onestepcheckout_index_index>
|
143 |
+
<controller_action_postdispatch_checkout_onepage_saveOrder>
|
144 |
+
<observers>
|
145 |
+
<monkey_subscribe_checkout>
|
146 |
+
<class>monkey/observer</class>
|
147 |
+
<method>registerCheckoutSubscribe</method>
|
148 |
+
</monkey_subscribe_checkout>
|
149 |
+
</observers>
|
150 |
+
</controller_action_postdispatch_checkout_onepage_saveOrder>
|
151 |
+
<checkout_onepage_controller_success_action>
|
152 |
+
<observers>
|
153 |
+
<monkey_subscribe_checkoutsuccess>
|
154 |
+
<class>monkey/observer</class>
|
155 |
+
<method>registerCheckoutSuccess</method>
|
156 |
+
</monkey_subscribe_checkoutsuccess>
|
157 |
+
</observers>
|
158 |
+
</checkout_onepage_controller_success_action>
|
159 |
+
<controller_action_postdispatch>
|
160 |
+
<observers>
|
161 |
+
<monkey_ecomm_tracking_cookie>
|
162 |
+
<class>monkey/ecommerce360</class>
|
163 |
+
<method>saveCookie</method>
|
164 |
+
</monkey_ecomm_tracking_cookie>
|
165 |
+
</observers>
|
166 |
+
</controller_action_postdispatch>
|
167 |
+
<sales_order_place_after>
|
168 |
+
<observers>
|
169 |
+
<monkey_ecomm_tracking_sendorder>
|
170 |
+
<class>monkey/ecommerce360</class>
|
171 |
+
<method>run</method>
|
172 |
+
</monkey_ecomm_tracking_sendorder>
|
173 |
+
</observers>
|
174 |
+
</sales_order_place_after>
|
175 |
+
</events>
|
176 |
</frontend>
|
177 |
<admin>
|
178 |
<routers>
|
179 |
+
<adminhtml>
|
180 |
+
<args>
|
181 |
+
<modules>
|
182 |
+
<monkey before="Mage_Adminhtml">Ebizmarts_MageMonkey_Adminhtml</monkey>
|
183 |
+
</modules>
|
184 |
+
</args>
|
185 |
+
</adminhtml>
|
186 |
</routers>
|
187 |
</admin>
|
188 |
<adminhtml>
|
189 |
+
<layout>
|
190 |
+
<updates>
|
191 |
+
<magemonkey>
|
192 |
+
<file>magemonkey.xml</file>
|
193 |
+
</magemonkey>
|
194 |
+
</updates>
|
195 |
+
</layout>
|
196 |
<translate>
|
197 |
<modules>
|
198 |
<Ebizmarts_MageMonkey>
|
239 |
</events>
|
240 |
</adminhtml>
|
241 |
<default>
|
242 |
+
<monkey>
|
243 |
+
<custom_groupings>
|
244 |
+
<segment_grouping_name><![CDATA[MAGE_CUSTOMER_SEGMENTS]]></segment_grouping_name>
|
245 |
+
</custom_groupings>
|
246 |
+
<general>
|
247 |
+
<active>0</active>
|
248 |
+
<double_optin>System->Configuration->Customers->Newsletter->Subscription Options->Need to Confirm
|
249 |
+
</double_optin>
|
250 |
+
<showreallistname>0</showreallistname>
|
251 |
<maxlistsamount>25</maxlistsamount>
|
252 |
+
<checkout_subscribe>0</checkout_subscribe>
|
253 |
+
<transactional_emails>false</transactional_emails>
|
254 |
+
<map_fields>
|
255 |
+
<![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>
|
256 |
+
<cron_export>1000</cron_export>
|
257 |
+
<enable_log>1</enable_log>
|
258 |
<checkout_async>1</checkout_async>
|
259 |
<markfield>HASCLICKED</markfield>
|
260 |
+
</general>
|
261 |
<ecommerce360>
|
262 |
<active>0</active>
|
263 |
<order_status>all_status</order_status>
|
266 |
<updates_url><![CDATA[http://store.ebizmarts.com/media/feeds/]]></updates_url>
|
267 |
<check_frequency>86400</check_frequency>
|
268 |
</notifications>
|
269 |
+
</monkey>
|
270 |
</default>
|
271 |
<crontab>
|
272 |
<jobs>
|
273 |
<magemonkey_bulksync_export_subscribers>
|
274 |
+
<schedule>
|
275 |
+
<cron_expr>0 * * * *</cron_expr>
|
276 |
+
</schedule>
|
277 |
+
<run>
|
278 |
+
<model>monkey/cron::bulksyncExportSubscribers</model>
|
279 |
+
</run>
|
280 |
</magemonkey_bulksync_export_subscribers>
|
281 |
<magemonkey_bulksync_import_subscribers>
|
282 |
+
<schedule>
|
283 |
+
<cron_expr>0 * * * *</cron_expr>
|
284 |
+
</schedule>
|
285 |
+
<run>
|
286 |
+
<model>monkey/cron::bulksyncImportSubscribers</model>
|
287 |
+
</run>
|
288 |
</magemonkey_bulksync_import_subscribers>
|
289 |
<magemonkey_autoexport_subscribers>
|
290 |
+
<schedule>
|
291 |
+
<cron_expr>0 * * * *</cron_expr>
|
292 |
+
</schedule>
|
293 |
+
<run>
|
294 |
+
<model>monkey/cron::autoExportSubscribers</model>
|
295 |
+
</run>
|
296 |
</magemonkey_autoexport_subscribers>
|
297 |
<magemonkey_sendorders_asynch>
|
298 |
+
<schedule>
|
299 |
+
<cron_expr>*/15 * * * *</cron_expr>
|
300 |
+
</schedule>
|
301 |
+
<run>
|
302 |
+
<model>monkey/cron::sendordersAsync</model>
|
303 |
+
</run>
|
304 |
</magemonkey_sendorders_asynch>
|
305 |
<magemonkey_cleanorders_asynch>
|
306 |
+
<schedule>
|
307 |
+
<cron_expr>0 0 1 * *</cron_expr>
|
308 |
+
</schedule>
|
309 |
+
<run>
|
310 |
+
<model>monkey/cron::cleanordersAsync</model>
|
311 |
+
</run>
|
312 |
</magemonkey_cleanorders_asynch>
|
313 |
<magemonkey_sendsubscribers_asynch>
|
314 |
+
<schedule>
|
315 |
+
<cron_expr>*/15 * * * *</cron_expr>
|
316 |
+
</schedule>
|
317 |
+
<run>
|
318 |
+
<model>monkey/cron::sendSubscribersAsync</model>
|
319 |
+
</run>
|
320 |
</magemonkey_sendsubscribers_asynch>
|
321 |
<magemonkey_cleansubscribers_asynch>
|
322 |
+
<schedule>
|
323 |
+
<cron_expr>0 0 1 * *</cron_expr>
|
324 |
+
</schedule>
|
325 |
+
<run>
|
326 |
+
<model>monkey/cron::cleanSubscribersAsync</model>
|
327 |
+
</run>
|
328 |
</magemonkey_cleansubscribers_asynch>
|
329 |
</jobs>
|
330 |
</crontab>
|
app/code/community/Ebizmarts/MageMonkey/etc/system.xml
CHANGED
@@ -25,15 +25,16 @@
|
|
25 |
<show_in_website>1</show_in_website>
|
26 |
<show_in_store>1</show_in_store>
|
27 |
<groups>
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
</hint>
|
35 |
<general translate="label comment">
|
36 |
-
<comment
|
|
|
37 |
</comment>
|
38 |
<label>MageMonkey - MailChimp integration by ebizmarts</label>
|
39 |
<frontend_type>text</frontend_type>
|
@@ -96,7 +97,8 @@
|
|
96 |
<show_in_default>1</show_in_default>
|
97 |
<show_in_website>0</show_in_website>
|
98 |
<show_in_store>1</show_in_store>
|
99 |
-
<comment
|
|
|
100 |
</reset_remoteecommerce360>
|
101 |
<maxlistsamount translate="label comment">
|
102 |
<label>Max amount of lists to show</label>
|
@@ -116,7 +118,8 @@
|
|
116 |
<show_in_website>0</show_in_website>
|
117 |
<show_in_store>1</show_in_store>
|
118 |
<can_be_empty>1</can_be_empty>
|
119 |
-
<comment
|
|
|
120 |
</list>
|
121 |
<cutomergroup translate="label comment">
|
122 |
<label>Subscriber Group</label>
|
@@ -147,7 +150,8 @@
|
|
147 |
<show_in_website>0</show_in_website>
|
148 |
<show_in_store>1</show_in_store>
|
149 |
<can_be_empty>1</can_be_empty>
|
150 |
-
<comment
|
|
|
151 |
</showreallistname>
|
152 |
<additional_lists translate="label comment">
|
153 |
<label>Additional Lists</label>
|
@@ -161,15 +165,16 @@
|
|
161 |
<comment>All selected lists will be available to customers as additionals lists</comment>
|
162 |
</additional_lists>
|
163 |
<confirmation_email translate="label comment">
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
|
|
173 |
</confirmation_email>
|
174 |
<double_optin translate="label comment">
|
175 |
<label>Double opt-in</label>
|
@@ -178,7 +183,8 @@
|
|
178 |
<show_in_default>1</show_in_default>
|
179 |
<show_in_website>0</show_in_website>
|
180 |
<show_in_store>1</show_in_store>
|
181 |
-
<comment
|
|
|
182 |
</double_optin>
|
183 |
<map_fields translate="label comment">
|
184 |
<label>Customer Fields Mapping</label>
|
@@ -188,7 +194,8 @@
|
|
188 |
<show_in_default>1</show_in_default>
|
189 |
<show_in_website>0</show_in_website>
|
190 |
<show_in_store>1</show_in_store>
|
191 |
-
<comment
|
|
|
192 |
</map_fields>
|
193 |
<guest_name translate="label comment">
|
194 |
<label>First Name for Guests subscribers</label>
|
@@ -216,7 +223,8 @@
|
|
216 |
<show_in_default>1</show_in_default>
|
217 |
<show_in_website>0</show_in_website>
|
218 |
<show_in_store>1</show_in_store>
|
219 |
-
<comment>Show Newsletter Subscribe checkbox in the last Checkout Step (Order Review)
|
|
|
220 |
</checkout_subscribe>
|
221 |
<markfield translate="label comment">
|
222 |
<label>Map field to mark</label>
|
@@ -308,7 +316,8 @@
|
|
308 |
<show_in_website>1</show_in_website>
|
309 |
<show_in_store>1</show_in_store>
|
310 |
<can_be_empty>1</can_be_empty>
|
311 |
-
<comment
|
|
|
312 |
</active>
|
313 |
<order_status translate="label comment">
|
314 |
<label>Order Status</label>
|
@@ -318,7 +327,8 @@
|
|
318 |
<show_in_default>1</show_in_default>
|
319 |
<show_in_website>0</show_in_website>
|
320 |
<show_in_store>1</show_in_store>
|
321 |
-
<comment
|
|
|
322 |
<depends>
|
323 |
<active>3</active>
|
324 |
</depends>
|
@@ -345,7 +355,9 @@
|
|
345 |
<show_in_website>0</show_in_website>
|
346 |
<show_in_store>1</show_in_store>
|
347 |
<can_be_empty>1</can_be_empty>
|
348 |
-
<comment>All selected attributes will be sent on the product name to MailChimp for
|
|
|
|
|
349 |
<depends>
|
350 |
<active separator=",">1,2,3</active>
|
351 |
</depends>
|
25 |
<show_in_website>1</show_in_website>
|
26 |
<show_in_store>1</show_in_store>
|
27 |
<groups>
|
28 |
+
<hint>
|
29 |
+
<frontend_model>monkey/adminhtml_system_config_fieldset_hint</frontend_model>
|
30 |
+
<sort_order>0</sort_order>
|
31 |
+
<show_in_default>1</show_in_default>
|
32 |
+
<show_in_website>1</show_in_website>
|
33 |
+
<show_in_store>1</show_in_store>
|
34 |
</hint>
|
35 |
<general translate="label comment">
|
36 |
+
<comment>
|
37 |
+
<![CDATA[<a href="http://mailchimp.com/signup/?pid=ebizmart&source=website" target="_blank">Get a free MailChimp account now</a>]]>
|
38 |
</comment>
|
39 |
<label>MageMonkey - MailChimp integration by ebizmarts</label>
|
40 |
<frontend_type>text</frontend_type>
|
97 |
<show_in_default>1</show_in_default>
|
98 |
<show_in_website>0</show_in_website>
|
99 |
<show_in_store>1</show_in_store>
|
100 |
+
<comment>
|
101 |
+
<![CDATA[Keep in mind, all your orders in Mailchimp will be removed.<br>Select carefully the correct scope]]></comment>
|
102 |
</reset_remoteecommerce360>
|
103 |
<maxlistsamount translate="label comment">
|
104 |
<label>Max amount of lists to show</label>
|
118 |
<show_in_website>0</show_in_website>
|
119 |
<show_in_store>1</show_in_store>
|
120 |
<can_be_empty>1</can_be_empty>
|
121 |
+
<comment>
|
122 |
+
<![CDATA[Synchronize Magento's General Subscription List with this MailChimp list]]></comment>
|
123 |
</list>
|
124 |
<cutomergroup translate="label comment">
|
125 |
<label>Subscriber Group</label>
|
150 |
<show_in_website>0</show_in_website>
|
151 |
<show_in_store>1</show_in_store>
|
152 |
<can_be_empty>1</can_be_empty>
|
153 |
+
<comment>
|
154 |
+
<![CDATA[Show original name as it's configured in MailChimp or display <i>General Subscription</i> name for this list.]]></comment>
|
155 |
</showreallistname>
|
156 |
<additional_lists translate="label comment">
|
157 |
<label>Additional Lists</label>
|
165 |
<comment>All selected lists will be available to customers as additionals lists</comment>
|
166 |
</additional_lists>
|
167 |
<confirmation_email translate="label comment">
|
168 |
+
<label>Use Magento's confirmation email</label>
|
169 |
+
<frontend_type>select</frontend_type>
|
170 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
171 |
+
<sort_order>45</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 |
+
<can_be_empty>1</can_be_empty>
|
176 |
+
<comment>
|
177 |
+
<![CDATA[Use Magento's confirmation email when user subscribes to Newsletter.]]></comment>
|
178 |
</confirmation_email>
|
179 |
<double_optin translate="label comment">
|
180 |
<label>Double opt-in</label>
|
183 |
<show_in_default>1</show_in_default>
|
184 |
<show_in_website>0</show_in_website>
|
185 |
<show_in_store>1</show_in_store>
|
186 |
+
<comment>
|
187 |
+
<![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>
|
188 |
</double_optin>
|
189 |
<map_fields translate="label comment">
|
190 |
<label>Customer Fields Mapping</label>
|
194 |
<show_in_default>1</show_in_default>
|
195 |
<show_in_website>0</show_in_website>
|
196 |
<show_in_store>1</show_in_store>
|
197 |
+
<comment>
|
198 |
+
<![CDATA[<a target="_blank" href="http://kb.mailchimp.com/article/all-the-merge-tags-cheatsheet">All The Merge Tags (Cheatsheet)</a>]]></comment>
|
199 |
</map_fields>
|
200 |
<guest_name translate="label comment">
|
201 |
<label>First Name for Guests subscribers</label>
|
223 |
<show_in_default>1</show_in_default>
|
224 |
<show_in_website>0</show_in_website>
|
225 |
<show_in_store>1</show_in_store>
|
226 |
+
<comment>Show Newsletter Subscribe checkbox in the last Checkout Step (Order Review)
|
227 |
+
</comment>
|
228 |
</checkout_subscribe>
|
229 |
<markfield translate="label comment">
|
230 |
<label>Map field to mark</label>
|
316 |
<show_in_website>1</show_in_website>
|
317 |
<show_in_store>1</show_in_store>
|
318 |
<can_be_empty>1</can_be_empty>
|
319 |
+
<comment>
|
320 |
+
<![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>
|
321 |
</active>
|
322 |
<order_status translate="label comment">
|
323 |
<label>Order Status</label>
|
327 |
<show_in_default>1</show_in_default>
|
328 |
<show_in_website>0</show_in_website>
|
329 |
<show_in_store>1</show_in_store>
|
330 |
+
<comment>
|
331 |
+
<![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>
|
332 |
<depends>
|
333 |
<active>3</active>
|
334 |
</depends>
|
355 |
<show_in_website>0</show_in_website>
|
356 |
<show_in_store>1</show_in_store>
|
357 |
<can_be_empty>1</can_be_empty>
|
358 |
+
<comment>All selected attributes will be sent on the product name to MailChimp for
|
359 |
+
segmentation purposes
|
360 |
+
</comment>
|
361 |
<depends>
|
362 |
<active separator=",">1,2,3</active>
|
363 |
</depends>
|
app/code/community/Ebizmarts/Mandrill/Block/Adminhtml/System/Config/Fieldset/Hint.php
CHANGED
@@ -7,10 +7,10 @@
|
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
10 |
-
|
11 |
class Ebizmarts_Mandrill_Block_Adminhtml_System_Config_Fieldset_Hint
|
12 |
extends Mage_Adminhtml_Block_Abstract
|
13 |
-
implements Varien_Data_Form_Element_Renderer_Interface
|
|
|
14 |
|
15 |
protected $_template = 'ebizmarts/mandrill/system/config/fieldset/hint.phtml';
|
16 |
|
@@ -20,27 +20,30 @@ class Ebizmarts_Mandrill_Block_Adminhtml_System_Config_Fieldset_Hint
|
|
20 |
* @param Varien_Data_Form_Element_Abstract $element
|
21 |
* @return string
|
22 |
*/
|
23 |
-
public function render(Varien_Data_Form_Element_Abstract $element)
|
|
|
24 |
return $this->toHtml();
|
25 |
}
|
26 |
|
27 |
-
|
28 |
-
|
29 |
-
|
|
|
30 |
|
31 |
-
public function getPxParams()
|
|
|
32 |
|
33 |
-
|
34 |
-
|
35 |
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
|
41 |
-
|
42 |
|
43 |
-
|
44 |
|
45 |
}
|
46 |
|
7 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php
|
9 |
*/
|
|
|
10 |
class Ebizmarts_Mandrill_Block_Adminhtml_System_Config_Fieldset_Hint
|
11 |
extends Mage_Adminhtml_Block_Abstract
|
12 |
+
implements Varien_Data_Form_Element_Renderer_Interface
|
13 |
+
{
|
14 |
|
15 |
protected $_template = 'ebizmarts/mandrill/system/config/fieldset/hint.phtml';
|
16 |
|
20 |
* @param Varien_Data_Form_Element_Abstract $element
|
21 |
* @return string
|
22 |
*/
|
23 |
+
public function render(Varien_Data_Form_Element_Abstract $element)
|
24 |
+
{
|
25 |
return $this->toHtml();
|
26 |
}
|
27 |
|
28 |
+
public function getMandrillVersion()
|
29 |
+
{
|
30 |
+
return (string)Mage::getConfig()->getNode('modules/Ebizmarts_Mandrill/version');
|
31 |
+
}
|
32 |
|
33 |
+
public function getPxParams()
|
34 |
+
{
|
35 |
|
36 |
+
$v = $this->getMandrillVersion();
|
37 |
+
$ext = "Mandrill;{$v}";
|
38 |
|
39 |
+
$modulesArray = (array)Mage::getConfig()->getNode('modules')->children();
|
40 |
+
$aux = (array_key_exists('Enterprise_Enterprise', $modulesArray)) ? 'EE' : 'CE';
|
41 |
+
$mageVersion = Mage::getVersion();
|
42 |
+
$mage = "Magento {$aux};{$mageVersion}";
|
43 |
|
44 |
+
$hash = md5($ext . '_' . $mage . '_' . $ext);
|
45 |
|
46 |
+
return "ext=$ext&mage={$mage}&ctrl={$hash}";
|
47 |
|
48 |
}
|
49 |
|
app/code/community/Ebizmarts/Mandrill/Block/Adminhtml/System/Config/Userinfo.php
CHANGED
@@ -8,22 +8,23 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_Mandrill_Block_Adminhtml_System_Config_Userinfo
|
13 |
-
extends Mage_Adminhtml_Block_System_Config_Form_Field
|
|
|
14 |
|
15 |
-
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
16 |
-
|
|
|
17 |
|
18 |
-
|
19 |
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
|
24 |
-
|
25 |
|
26 |
return $html;
|
27 |
}
|
28 |
-
|
29 |
}
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_Mandrill_Block_Adminhtml_System_Config_Userinfo
|
12 |
+
extends Mage_Adminhtml_Block_System_Config_Form_Field
|
13 |
+
{
|
14 |
|
15 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
16 |
+
{
|
17 |
+
$values = $element->getValues();
|
18 |
|
19 |
+
$html = '<ul class="checkboxes">';
|
20 |
|
21 |
+
foreach ($values as $dat) {
|
22 |
+
$html .= "<li>{$dat['label']}</li>";
|
23 |
+
}
|
24 |
|
25 |
+
$html .= '</ul>';
|
26 |
|
27 |
return $html;
|
28 |
}
|
29 |
+
|
30 |
}
|
app/code/community/Ebizmarts/Mandrill/Block/Adminhtml/Templates/Templates.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* Author : Ebizmarts <info@ebizmarts.com>
|
4 |
* Date : 8/16/14
|
@@ -10,25 +11,25 @@ class Ebizmarts_Mandrill_Block_Adminhtml_Templates_Templates extends Mage_Adminh
|
|
10 |
{
|
11 |
|
12 |
public function __construct()
|
13 |
-
{
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
|
18 |
-
|
19 |
|
20 |
// $this->removeButton('add');
|
21 |
|
22 |
-
}
|
23 |
|
24 |
public function getGridHtml()
|
25 |
-
{
|
26 |
-
|
27 |
-
}
|
28 |
|
29 |
public function getCreateUrl()
|
30 |
-
{
|
31 |
-
|
32 |
-
}
|
33 |
|
34 |
}
|
1 |
<?php
|
2 |
+
|
3 |
/**
|
4 |
* Author : Ebizmarts <info@ebizmarts.com>
|
5 |
* Date : 8/16/14
|
11 |
{
|
12 |
|
13 |
public function __construct()
|
14 |
+
{
|
15 |
+
$this->_controller = 'adminhtml_templates_templates';
|
16 |
+
$this->_blockGroup = 'ebizmarts_mandrill';
|
17 |
+
$this->_headerText = Mage::helper('ebizmarts_mandrill')->__('Mandrill Templates');
|
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 |
}
|
app/code/community/Ebizmarts/Mandrill/Block/Adminhtml/Templates/Templates/Grid.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* Author : Ebizmarts <info@ebizmarts.com>
|
4 |
* Date : 8/16/14
|
@@ -10,24 +11,24 @@ class Ebizmarts_Mandrill_Block_Adminhtml_Templates_Templates_Grid extends Mage_A
|
|
10 |
{
|
11 |
|
12 |
public function __construct()
|
13 |
-
{
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
}
|
21 |
|
22 |
protected function _prepareCollection()
|
23 |
-
{
|
24 |
// $helper = Mage::helper('ebizmarts_mandrill');
|
25 |
// $mail = $helper->api()->setApiKey($helper->getApiKey());
|
26 |
// $emails = $mail->usersSenders();
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
// $_emails = array();
|
32 |
// foreach($emails as $email){
|
33 |
//
|
@@ -45,88 +46,88 @@ class Ebizmarts_Mandrill_Block_Adminhtml_Templates_Templates_Grid extends Mage_A
|
|
45 |
// 'created_at' => $email->getCreatedAt(),
|
46 |
// );
|
47 |
// }
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
|
53 |
-
|
54 |
-
|
55 |
-
}
|
56 |
|
57 |
protected function _prepareColumns()
|
58 |
-
{
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
|
120 |
-
|
121 |
-
}
|
122 |
|
123 |
public function getRowUrl($row)
|
124 |
-
{
|
125 |
-
|
126 |
-
}
|
127 |
|
128 |
public function getGridUrl()
|
129 |
-
{
|
130 |
-
|
131 |
-
}
|
132 |
}
|
1 |
<?php
|
2 |
+
|
3 |
/**
|
4 |
* Author : Ebizmarts <info@ebizmarts.com>
|
5 |
* Date : 8/16/14
|
11 |
{
|
12 |
|
13 |
public function __construct()
|
14 |
+
{
|
15 |
+
parent::__construct();
|
16 |
+
$this->setId('mandrill_templates');
|
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('ebizmarts_mandrill');
|
26 |
// $mail = $helper->api()->setApiKey($helper->getApiKey());
|
27 |
// $emails = $mail->usersSenders();
|
28 |
+
$storeId = Mage::app()->getStore()->getId();
|
29 |
+
$api = new Mandrill_Message(Mage::getStoreConfig(Ebizmarts_Mandrill_Model_System_Config::APIKEY, $storeId));
|
30 |
+
$emails = $api->users->senders();
|
31 |
+
if ($emails !== FALSE) {
|
32 |
// $_emails = array();
|
33 |
// foreach($emails as $email){
|
34 |
//
|
46 |
// 'created_at' => $email->getCreatedAt(),
|
47 |
// );
|
48 |
// }
|
49 |
+
$collection = Mage::getModel('ebizmarts_mandrill/customcollection', array($emails));
|
50 |
+
} else {
|
51 |
+
$collection = Mage::getModel('ebizmarts_mandrill/customcollection', array(array()));
|
52 |
+
}
|
53 |
|
54 |
+
$this->setCollection($collection);
|
55 |
+
return parent::_prepareCollection();
|
56 |
+
}
|
57 |
|
58 |
protected function _prepareColumns()
|
59 |
+
{
|
60 |
+
$this->addColumn('email', array(
|
61 |
+
'header' => Mage::helper('ebizmarts_mandrill')->__('Email Address'),
|
62 |
+
'index' => 'address',
|
63 |
+
'filter' => false,
|
64 |
+
'sortable' => false
|
65 |
+
));
|
66 |
+
$this->addColumn('sent', array(
|
67 |
+
'header' => Mage::helper('ebizmarts_mandrill')->__('# of messages sent'),
|
68 |
+
'index' => 'sent',
|
69 |
+
'filter' => false,
|
70 |
+
'sortable' => false
|
71 |
+
));
|
72 |
+
$this->addColumn('rejects', array(
|
73 |
+
'header' => Mage::helper('ebizmarts_mandrill')->__('# of rejected messages'),
|
74 |
+
'index' => 'rejects',
|
75 |
+
'filter' => false,
|
76 |
+
'sortable' => false
|
77 |
+
));
|
78 |
+
$this->addColumn('complaints', array(
|
79 |
+
'header' => Mage::helper('ebizmarts_mandrill')->__('# of spam complaints'),
|
80 |
+
'index' => 'complaints',
|
81 |
+
'filter' => false,
|
82 |
+
'sortable' => false
|
83 |
+
));
|
84 |
+
$this->addColumn('unsubs', array(
|
85 |
+
'header' => Mage::helper('ebizmarts_mandrill')->__('# of unsubscribe requests'),
|
86 |
+
'index' => 'unsubs',
|
87 |
+
'filter' => false,
|
88 |
+
'sortable' => false
|
89 |
+
));
|
90 |
+
$this->addColumn('opens', array(
|
91 |
+
'header' => Mage::helper('ebizmarts_mandrill')->__('# of unique opens'),
|
92 |
+
'index' => 'opens',
|
93 |
+
'filter' => false,
|
94 |
+
'sortable' => false
|
95 |
+
));
|
96 |
+
$this->addColumn('clicks', array(
|
97 |
+
'header' => Mage::helper('ebizmarts_mandrill')->__('# of times unique tracked URLs have been clicked'),
|
98 |
+
'index' => 'clicks',
|
99 |
+
'filter' => false,
|
100 |
+
'sortable' => false
|
101 |
+
));
|
102 |
+
$this->addColumn('hard_bounces', array(
|
103 |
+
'header' => Mage::helper('ebizmarts_mandrill')->__('# of hard bounces'),
|
104 |
+
'index' => 'hard_bounces',
|
105 |
+
'filter' => false,
|
106 |
+
'sortable' => false
|
107 |
+
));
|
108 |
+
$this->addColumn('soft_bounces', array(
|
109 |
+
'header' => Mage::helper('ebizmarts_mandrill')->__('# of soft bounces'),
|
110 |
+
'index' => 'soft_bounces',
|
111 |
+
'filter' => false,
|
112 |
+
'sortable' => false
|
113 |
+
));
|
114 |
+
$this->addColumn('created_at', array(
|
115 |
+
'header' => Mage::helper('ebizmarts_mandrill')->__('Created At'),
|
116 |
+
'index' => 'created_at',
|
117 |
+
'filter' => false,
|
118 |
+
'sortable' => false
|
119 |
+
));
|
120 |
|
121 |
+
return parent::_prepareColumns();
|
122 |
+
}
|
123 |
|
124 |
public function getRowUrl($row)
|
125 |
+
{
|
126 |
+
return false;
|
127 |
+
}
|
128 |
|
129 |
public function getGridUrl()
|
130 |
+
{
|
131 |
+
return $this->getUrl('*/*/grid', array('_current' => true));
|
132 |
+
}
|
133 |
}
|
app/code/community/Ebizmarts/Mandrill/Block/Adminhtml/Users/Senders.php
CHANGED
@@ -8,7 +8,6 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_Mandrill_Block_Adminhtml_Users_Senders extends Mage_Adminhtml_Block_Widget_Grid_Container
|
13 |
{
|
14 |
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_Mandrill_Block_Adminhtml_Users_Senders extends Mage_Adminhtml_Block_Widget_Grid_Container
|
12 |
{
|
13 |
|
app/code/community/Ebizmarts/Mandrill/Block/Adminhtml/Users/Senders/Grid.php
CHANGED
@@ -8,7 +8,6 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
class Ebizmarts_Mandrill_Block_Adminhtml_Users_Senders_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
13 |
{
|
14 |
|
@@ -28,10 +27,10 @@ class Ebizmarts_Mandrill_Block_Adminhtml_Users_Senders_Grid extends Mage_Adminht
|
|
28 |
// $mail = $helper->api()->setApiKey($helper->getApiKey());
|
29 |
// $emails = $mail->usersSenders();
|
30 |
$storeId = Mage::app()->getStore()->getId();
|
31 |
-
$api
|
32 |
$emails = $api->users->senders();
|
33 |
Mage::log($emails);
|
34 |
-
|
35 |
// $_emails = array();
|
36 |
// foreach($emails as $email){
|
37 |
//
|
@@ -49,10 +48,10 @@ class Ebizmarts_Mandrill_Block_Adminhtml_Users_Senders_Grid extends Mage_Adminht
|
|
49 |
// 'created_at' => $email->getCreatedAt(),
|
50 |
// );
|
51 |
// }
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
|
57 |
$this->setCollection($collection);
|
58 |
return parent::_prepareCollection();
|
@@ -61,65 +60,65 @@ class Ebizmarts_Mandrill_Block_Adminhtml_Users_Senders_Grid extends Mage_Adminht
|
|
61 |
protected function _prepareColumns()
|
62 |
{
|
63 |
$this->addColumn('email', array(
|
64 |
-
'header'=> Mage::helper('ebizmarts_mandrill')->__('Email Address'),
|
65 |
'index' => 'address',
|
66 |
'filter' => false,
|
67 |
'sortable' => false
|
68 |
));
|
69 |
$this->addColumn('sent', array(
|
70 |
-
'header'=> Mage::helper('ebizmarts_mandrill')->__('# of messages sent'),
|
71 |
'index' => 'sent',
|
72 |
'filter' => false,
|
73 |
'sortable' => false
|
74 |
));
|
75 |
$this->addColumn('rejects', array(
|
76 |
-
'header'=> Mage::helper('ebizmarts_mandrill')->__('# of rejected messages'),
|
77 |
'index' => 'rejects',
|
78 |
'filter' => false,
|
79 |
'sortable' => false
|
80 |
));
|
81 |
$this->addColumn('complaints', array(
|
82 |
-
'header'=> Mage::helper('ebizmarts_mandrill')->__('# of spam complaints'),
|
83 |
'index' => 'complaints',
|
84 |
'filter' => false,
|
85 |
'sortable' => false
|
86 |
));
|
87 |
$this->addColumn('unsubs', array(
|
88 |
-
'header'=> Mage::helper('ebizmarts_mandrill')->__('# of unsubscribe requests'),
|
89 |
'index' => 'unsubs',
|
90 |
'filter' => false,
|
91 |
'sortable' => false
|
92 |
));
|
93 |
$this->addColumn('opens', array(
|
94 |
-
'header'=> Mage::helper('ebizmarts_mandrill')->__('# of unique opens'),
|
95 |
'index' => 'opens',
|
96 |
'filter' => false,
|
97 |
'sortable' => false
|
98 |
));
|
99 |
$this->addColumn('clicks', array(
|
100 |
-
'header'=> Mage::helper('ebizmarts_mandrill')->__('# of times unique tracked URLs have been clicked'),
|
101 |
'index' => 'clicks',
|
102 |
'filter' => false,
|
103 |
'sortable' => false
|
104 |
));
|
105 |
$this->addColumn('hard_bounces', array(
|
106 |
-
'header'=> Mage::helper('ebizmarts_mandrill')->__('# of hard bounces'),
|
107 |
'index' => 'hard_bounces',
|
108 |
'filter' => false,
|
109 |
'sortable' => false
|
110 |
));
|
111 |
$this->addColumn('soft_bounces', array(
|
112 |
-
'header'=> Mage::helper('ebizmarts_mandrill')->__('# of soft bounces'),
|
113 |
'index' => 'soft_bounces',
|
114 |
'filter' => false,
|
115 |
'sortable' => false
|
116 |
));
|
117 |
$this->addColumn('created_at', array(
|
118 |
-
'header'=> Mage::helper('ebizmarts_mandrill')->__('Created At'),
|
119 |
'index' => 'created_at',
|
120 |
'filter' => false,
|
121 |
'sortable' => false
|
122 |
-
));
|
123 |
|
124 |
return parent::_prepareColumns();
|
125 |
}
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
11 |
class Ebizmarts_Mandrill_Block_Adminhtml_Users_Senders_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
12 |
{
|
13 |
|
27 |
// $mail = $helper->api()->setApiKey($helper->getApiKey());
|
28 |
// $emails = $mail->usersSenders();
|
29 |
$storeId = Mage::app()->getStore()->getId();
|
30 |
+
$api = new Mandrill_Message(Mage::getStoreConfig(Ebizmarts_Mandrill_Model_System_Config::APIKEY, $storeId));
|
31 |
$emails = $api->users->senders();
|
32 |
Mage::log($emails);
|
33 |
+
if ($emails !== FALSE) {
|
34 |
// $_emails = array();
|
35 |
// foreach($emails as $email){
|
36 |
//
|
48 |
// 'created_at' => $email->getCreatedAt(),
|
49 |
// );
|
50 |
// }
|
51 |
+
$collection = Mage::getModel('ebizmarts_mandrill/customcollection', array($emails));
|
52 |
+
} else {
|
53 |
+
$collection = Mage::getModel('ebizmarts_mandrill/customcollection', array(array()));
|
54 |
+
}
|
55 |
|
56 |
$this->setCollection($collection);
|
57 |
return parent::_prepareCollection();
|
60 |
protected function _prepareColumns()
|
61 |
{
|
62 |
$this->addColumn('email', array(
|
63 |
+
'header' => Mage::helper('ebizmarts_mandrill')->__('Email Address'),
|
64 |
'index' => 'address',
|
65 |
'filter' => false,
|
66 |
'sortable' => false
|
67 |
));
|
68 |
$this->addColumn('sent', array(
|
69 |
+
'header' => Mage::helper('ebizmarts_mandrill')->__('# of messages sent'),
|
70 |
'index' => 'sent',
|
71 |
'filter' => false,
|
72 |
'sortable' => false
|
73 |
));
|
74 |
$this->addColumn('rejects', array(
|
75 |
+
'header' => Mage::helper('ebizmarts_mandrill')->__('# of rejected messages'),
|
76 |
'index' => 'rejects',
|
77 |
'filter' => false,
|
78 |
'sortable' => false
|
79 |
));
|
80 |
$this->addColumn('complaints', array(
|
81 |
+
'header' => Mage::helper('ebizmarts_mandrill')->__('# of spam complaints'),
|
82 |
'index' => 'complaints',
|
83 |
'filter' => false,
|
84 |
'sortable' => false
|
85 |
));
|
86 |
$this->addColumn('unsubs', array(
|
87 |
+
'header' => Mage::helper('ebizmarts_mandrill')->__('# of unsubscribe requests'),
|
88 |
'index' => 'unsubs',
|
89 |
'filter' => false,
|
90 |
'sortable' => false
|
91 |
));
|
92 |
$this->addColumn('opens', array(
|
93 |
+
'header' => Mage::helper('ebizmarts_mandrill')->__('# of unique opens'),
|
94 |
'index' => 'opens',
|
95 |
'filter' => false,
|
96 |
'sortable' => false
|
97 |
));
|
98 |
$this->addColumn('clicks', array(
|
99 |
+
'header' => Mage::helper('ebizmarts_mandrill')->__('# of times unique tracked URLs have been clicked'),
|
100 |
'index' => 'clicks',
|
101 |
'filter' => false,
|
102 |
'sortable' => false
|
103 |
));
|
104 |
$this->addColumn('hard_bounces', array(
|
105 |
+
'header' => Mage::helper('ebizmarts_mandrill')->__('# of hard bounces'),
|
106 |
'index' => 'hard_bounces',
|
107 |
'filter' => false,
|
108 |
'sortable' => false
|
109 |
));
|
110 |
$this->addColumn('soft_bounces', array(
|
111 |
+
'header' => Mage::helper('ebizmarts_mandrill')->__('# of soft bounces'),
|
112 |
'index' => 'soft_bounces',
|
113 |
'filter' => false,
|
114 |
'sortable' => false
|
115 |
));
|
116 |
$this->addColumn('created_at', array(
|
117 |
+
'header' => Mage::helper('ebizmarts_mandrill')->__('Created At'),
|
118 |
'index' => 'created_at',
|
119 |
'filter' => false,
|
120 |
'sortable' => false
|
121 |
+
));
|
122 |
|
123 |
return parent::_prepareColumns();
|
124 |
}
|
app/code/community/Ebizmarts/Mandrill/Helper/Data.php
CHANGED
@@ -8,59 +8,62 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
|
|
11 |
|
12 |
-
|
13 |
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
$key = $this->getApiKey();
|
24 |
|
25 |
-
|
26 |
-
|
27 |
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
public function getApiKey($storeId=null)
|
34 |
{
|
35 |
-
return Mage::getStoreConfig(Ebizmarts_Mandrill_Model_System_Config::APIKEY
|
36 |
}
|
37 |
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
|
|
46 |
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
|
|
65 |
|
66 |
}
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
+
class Ebizmarts_Mandrill_Helper_Data extends Mage_Core_Helper_Abstract
|
12 |
+
{
|
13 |
|
14 |
+
private $_configPath = 'mandrill/general/';
|
15 |
|
16 |
+
/**
|
17 |
+
* Check if Mandrill is enabled
|
18 |
+
*
|
19 |
+
* @return bool
|
20 |
+
*/
|
21 |
+
public function useTransactionalService()
|
22 |
+
{
|
23 |
+
$active = Mage::getStoreConfigFlag($this->_configPath . "active");
|
24 |
+
$key = $this->getApiKey();
|
|
|
25 |
|
26 |
+
return ($active && (strlen($key)));
|
27 |
+
}
|
28 |
|
29 |
+
/**
|
30 |
+
* Retrieves Mandrill API KEY from Magento's configuration
|
31 |
+
*
|
32 |
+
* @return string
|
33 |
+
*/
|
34 |
+
public function getApiKey($storeId = null)
|
35 |
{
|
36 |
+
return Mage::getStoreConfig(Ebizmarts_Mandrill_Model_System_Config::APIKEY, $storeId);
|
37 |
}
|
38 |
|
39 |
+
/**
|
40 |
+
* Get module User-Agent to use on API requests
|
41 |
+
*
|
42 |
+
* @return string
|
43 |
+
*/
|
44 |
+
public function getUserAgent()
|
45 |
+
{
|
46 |
+
$modules = Mage::getConfig()->getNode('modules')->children();
|
47 |
+
$modulesArray = (array)$modules;
|
48 |
|
49 |
+
$aux = (array_key_exists('Enterprise_Enterprise', $modulesArray)) ? 'EE' : 'CE';
|
50 |
+
$v = (string)Mage::getConfig()->getNode('modules/Ebizmarts_Mandrill/version');
|
51 |
+
$version = strpos(Mage::getVersion(), '-') ? substr(Mage::getVersion(), 0, strpos(Mage::getVersion(), '-')) : Mage::getVersion();
|
52 |
+
return (string)'Ebizmarts_Mandrill' . $v . '/Mage' . $aux . $version;
|
53 |
+
}
|
54 |
|
55 |
+
/**
|
56 |
+
* Logging facility
|
57 |
+
*
|
58 |
+
* @param mixed $data Message to save to file
|
59 |
+
* @param string $filename log filename, default is <Monkey.log>
|
60 |
+
* @return Mage_Core_Model_Log_Adapter
|
61 |
+
*/
|
62 |
+
public function log($data, $filename = 'Ebizmarts_Mandrill.log')
|
63 |
+
{
|
64 |
+
if (Mage::getStoreConfig($this->_configPath . "enable_log")) {
|
65 |
+
return Mage::getModel('core/log_adapter', $filename)->log($data);
|
66 |
+
}
|
67 |
+
}
|
68 |
|
69 |
}
|
app/code/community/Ebizmarts/Mandrill/Model/Customcollection.php
CHANGED
@@ -8,45 +8,47 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
|
|
|
|
11 |
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
|
51 |
foreach ($this->_toload as $row) {
|
52 |
$item = new Varien_Object;
|
@@ -56,7 +58,7 @@ class Ebizmarts_Mandrill_Model_Customcollection extends Varien_Data_Collection {
|
|
56 |
|
57 |
$this->_setIsLoaded();
|
58 |
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
}
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
+
class Ebizmarts_Mandrill_Model_Customcollection extends Varien_Data_Collection
|
12 |
+
{
|
13 |
|
14 |
+
/**
|
15 |
+
* Contains generic data to load on load() method
|
16 |
+
*
|
17 |
+
* @var mixed
|
18 |
+
*/
|
19 |
+
protected $_toload = NULL;
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Initialize data to be loaded afterwards
|
23 |
+
*
|
24 |
+
* @param array $data
|
25 |
+
* @return Varien_Data_Collection
|
26 |
+
*/
|
27 |
+
public function __construct(array $data)
|
28 |
+
{
|
29 |
+
$data = current($data);
|
30 |
+
|
31 |
+
if (empty($data)) {
|
32 |
+
return parent::__construct();
|
33 |
+
}
|
34 |
+
|
35 |
+
$this->_toload = $data;
|
36 |
+
|
37 |
+
return parent::__construct();
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Load data into object
|
42 |
+
*
|
43 |
+
* @param bool $printQuery
|
44 |
+
* @param bool $logQuery
|
45 |
+
* @return Ebizmarts_MageMonkey_Model_Custom_Collection
|
46 |
+
*/
|
47 |
+
public function load($printQuery = false, $logQuery = false)
|
48 |
+
{
|
49 |
+
if ($this->isLoaded() || is_null($this->_toload)) {
|
50 |
+
return $this;
|
51 |
+
}
|
52 |
|
53 |
foreach ($this->_toload as $row) {
|
54 |
$item = new Varien_Object;
|
58 |
|
59 |
$this->_setIsLoaded();
|
60 |
|
61 |
+
return $this;
|
62 |
+
}
|
63 |
+
|
64 |
}
|
app/code/community/Ebizmarts/Mandrill/Model/Email/Template.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* Author : Ebizmarts <info@ebizmarts.com>
|
4 |
* Date : 8/7/14
|
@@ -20,48 +21,46 @@ class Ebizmarts_Mandrill_Model_Email_Template extends Mage_Core_Model_Email_Temp
|
|
20 |
public function send($email, $name = null, array $variables = array())
|
21 |
{
|
22 |
$storeId = Mage::app()->getStore()->getId();
|
23 |
-
if(!Mage::getStoreConfig(Ebizmarts_Mandrill_Model_System_Config::ENABLE
|
24 |
-
|
25 |
}
|
26 |
if (!$this->isValidForSend()) {
|
27 |
Mage::logException(new Exception('This letter cannot be sent.')); // translation is intentionally omitted
|
28 |
return false;
|
29 |
}
|
30 |
-
$emails = array_values(
|
31 |
-
$names = is_array(
|
32 |
-
$names = array_values(
|
33 |
-
foreach (
|
34 |
-
if (
|
35 |
-
$names[
|
36 |
}
|
37 |
}
|
38 |
|
39 |
// Get message
|
40 |
-
$this->setUseAbsoluteLinks(
|
41 |
-
$variables['email'] = reset(
|
42 |
-
$variables['name'] = reset(
|
43 |
-
$message = $this->getProcessedTemplate(
|
44 |
|
45 |
-
$email = array(
|
46 |
|
47 |
$mail = $this->getMail();
|
48 |
|
49 |
-
for (
|
50 |
-
if (
|
51 |
$email['to'][] = array(
|
52 |
-
'email' => $emails[
|
53 |
-
'name' => $names[
|
54 |
);
|
55 |
-
}
|
56 |
-
else {
|
57 |
$email['to'][] = array(
|
58 |
-
'email' => $emails[
|
59 |
'name' => ''
|
60 |
);
|
61 |
}
|
62 |
}
|
63 |
-
foreach($mail->getBcc() as $bcc)
|
64 |
-
{
|
65 |
$email['to'][] = array(
|
66 |
'email' => $bcc,
|
67 |
'type' => 'bcc'
|
@@ -71,44 +70,42 @@ class Ebizmarts_Mandrill_Model_Email_Template extends Mage_Core_Model_Email_Temp
|
|
71 |
$email['from_name'] = $this->getSenderName();
|
72 |
$email['from_email'] = $this->getSenderEmail();
|
73 |
$email['headers'] = $mail->getHeaders();
|
74 |
-
if(isset($variables['tags']) && count($variables['tags'])) {
|
75 |
$email ['tags'] = $variables['tags'];
|
76 |
}
|
77 |
|
78 |
-
if(isset($variables['tags']) && count($variables['tags'])) {
|
79 |
$email ['tags'] = $variables['tags'];
|
80 |
-
}
|
81 |
-
else {
|
82 |
$templateId = (string)$this->getId();
|
83 |
$templates = parent::getDefaultTemplates();
|
84 |
if (isset($templates[$templateId]) && isset($templates[$templateId]['label'])) {
|
85 |
-
$email ['tags'] =
|
86 |
} else {
|
87 |
-
if($this->getTemplateCode()){
|
88 |
$email ['tags'] = array(substr($this->getTemplateCode(), 0, 50));
|
89 |
} else {
|
90 |
-
if($templateId){
|
91 |
$email ['tags'] = array(substr($templateId, 0, 50));
|
92 |
-
}else{
|
93 |
$email['tags'] = array('default_tag');
|
94 |
}
|
95 |
}
|
96 |
}
|
97 |
}
|
98 |
|
99 |
-
if($att = $mail->getAttachments()) {
|
100 |
$email['attachments'] = $att;
|
101 |
}
|
102 |
-
if(
|
103 |
$email['text'] = $message;
|
104 |
else
|
105 |
$email['html'] = $message;
|
106 |
|
107 |
try {
|
108 |
-
$result = $mail->messages->send(
|
109 |
-
}
|
110 |
-
|
111 |
-
Mage::logException( $e );
|
112 |
return false;
|
113 |
}
|
114 |
return true;
|
@@ -121,16 +118,15 @@ class Ebizmarts_Mandrill_Model_Email_Template extends Mage_Core_Model_Email_Temp
|
|
121 |
public function getMail()
|
122 |
{
|
123 |
$storeId = Mage::app()->getStore()->getId();
|
124 |
-
if(!Mage::getStoreConfig(Ebizmarts_Mandrill_Model_System_Config::ENABLE
|
125 |
return parent::getMail();
|
126 |
}
|
127 |
-
if($this->_mail) {
|
128 |
return $this->_mail;
|
129 |
-
}
|
130 |
-
else {
|
131 |
$storeId = Mage::app()->getStore()->getId();
|
132 |
-
Mage::log("store: $storeId API: ".Mage::getStoreConfig(
|
133 |
-
$this->_mail = new Mandrill_Message(Mage::getStoreConfig(
|
134 |
return $this->_mail;
|
135 |
}
|
136 |
}
|
1 |
<?php
|
2 |
+
|
3 |
/**
|
4 |
* Author : Ebizmarts <info@ebizmarts.com>
|
5 |
* Date : 8/7/14
|
21 |
public function send($email, $name = null, array $variables = array())
|
22 |
{
|
23 |
$storeId = Mage::app()->getStore()->getId();
|
24 |
+
if (!Mage::getStoreConfig(Ebizmarts_Mandrill_Model_System_Config::ENABLE, $storeId)) {
|
25 |
+
return parent::send($email, $name, $variables);
|
26 |
}
|
27 |
if (!$this->isValidForSend()) {
|
28 |
Mage::logException(new Exception('This letter cannot be sent.')); // translation is intentionally omitted
|
29 |
return false;
|
30 |
}
|
31 |
+
$emails = array_values((array)$email);
|
32 |
+
$names = is_array($name) ? $name : (array)$name;
|
33 |
+
$names = array_values($names);
|
34 |
+
foreach ($emails as $key => $email) {
|
35 |
+
if (!isset($names[$key])) {
|
36 |
+
$names[$key] = substr($email, 0, strpos($email, '@'));
|
37 |
}
|
38 |
}
|
39 |
|
40 |
// Get message
|
41 |
+
$this->setUseAbsoluteLinks(true);
|
42 |
+
$variables['email'] = reset($emails);
|
43 |
+
$variables['name'] = reset($names);
|
44 |
+
$message = $this->getProcessedTemplate($variables, true);
|
45 |
|
46 |
+
$email = array('subject' => $this->getProcessedTemplateSubject($variables), 'to' => array());
|
47 |
|
48 |
$mail = $this->getMail();
|
49 |
|
50 |
+
for ($i = 0; $i < count($emails); $i++) {
|
51 |
+
if (isset($names[$i])) {
|
52 |
$email['to'][] = array(
|
53 |
+
'email' => $emails[$i],
|
54 |
+
'name' => $names[$i]
|
55 |
);
|
56 |
+
} else {
|
|
|
57 |
$email['to'][] = array(
|
58 |
+
'email' => $emails[$i],
|
59 |
'name' => ''
|
60 |
);
|
61 |
}
|
62 |
}
|
63 |
+
foreach ($mail->getBcc() as $bcc) {
|
|
|
64 |
$email['to'][] = array(
|
65 |
'email' => $bcc,
|
66 |
'type' => 'bcc'
|
70 |
$email['from_name'] = $this->getSenderName();
|
71 |
$email['from_email'] = $this->getSenderEmail();
|
72 |
$email['headers'] = $mail->getHeaders();
|
73 |
+
if (isset($variables['tags']) && count($variables['tags'])) {
|
74 |
$email ['tags'] = $variables['tags'];
|
75 |
}
|
76 |
|
77 |
+
if (isset($variables['tags']) && count($variables['tags'])) {
|
78 |
$email ['tags'] = $variables['tags'];
|
79 |
+
} else {
|
|
|
80 |
$templateId = (string)$this->getId();
|
81 |
$templates = parent::getDefaultTemplates();
|
82 |
if (isset($templates[$templateId]) && isset($templates[$templateId]['label'])) {
|
83 |
+
$email ['tags'] = array(substr($templates[$templateId]['label'], 0, 50));
|
84 |
} else {
|
85 |
+
if ($this->getTemplateCode()) {
|
86 |
$email ['tags'] = array(substr($this->getTemplateCode(), 0, 50));
|
87 |
} else {
|
88 |
+
if ($templateId) {
|
89 |
$email ['tags'] = array(substr($templateId, 0, 50));
|
90 |
+
} else {
|
91 |
$email['tags'] = array('default_tag');
|
92 |
}
|
93 |
}
|
94 |
}
|
95 |
}
|
96 |
|
97 |
+
if ($att = $mail->getAttachments()) {
|
98 |
$email['attachments'] = $att;
|
99 |
}
|
100 |
+
if ($this->isPlain())
|
101 |
$email['text'] = $message;
|
102 |
else
|
103 |
$email['html'] = $message;
|
104 |
|
105 |
try {
|
106 |
+
$result = $mail->messages->send($email);
|
107 |
+
} catch (Exception $e) {
|
108 |
+
Mage::logException($e);
|
|
|
109 |
return false;
|
110 |
}
|
111 |
return true;
|
118 |
public function getMail()
|
119 |
{
|
120 |
$storeId = Mage::app()->getStore()->getId();
|
121 |
+
if (!Mage::getStoreConfig(Ebizmarts_Mandrill_Model_System_Config::ENABLE, $storeId)) {
|
122 |
return parent::getMail();
|
123 |
}
|
124 |
+
if ($this->_mail) {
|
125 |
return $this->_mail;
|
126 |
+
} else {
|
|
|
127 |
$storeId = Mage::app()->getStore()->getId();
|
128 |
+
Mage::helper('ebizmarts_mandrill')->log("store: $storeId API: " . Mage::getStoreConfig(Ebizmarts_Mandrill_Model_System_Config::APIKEY, $storeId));
|
129 |
+
$this->_mail = new Mandrill_Message(Mage::getStoreConfig(Ebizmarts_Mandrill_Model_System_Config::APIKEY, $storeId));
|
130 |
return $this->_mail;
|
131 |
}
|
132 |
}
|
app/code/community/Ebizmarts/Mandrill/Model/System/Config.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* Author : Ebizmarts <info@ebizmarts.com>
|
4 |
* Date : 8/6/14
|
@@ -8,7 +9,7 @@
|
|
8 |
*/
|
9 |
class Ebizmarts_Mandrill_Model_System_Config
|
10 |
{
|
11 |
-
const ENABLE
|
12 |
-
const APIKEY
|
13 |
-
const ENABLE_LOG
|
14 |
}
|
1 |
<?php
|
2 |
+
|
3 |
/**
|
4 |
* Author : Ebizmarts <info@ebizmarts.com>
|
5 |
* Date : 8/6/14
|
9 |
*/
|
10 |
class Ebizmarts_Mandrill_Model_System_Config
|
11 |
{
|
12 |
+
const ENABLE = 'mandrill/general/active';
|
13 |
+
const APIKEY = 'mandrill/general/apikey';
|
14 |
+
const ENABLE_LOG = 'mandrill/general/enable_log';
|
15 |
}
|
app/code/community/Ebizmarts/Mandrill/Model/System/Config/Source/Userinfo.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* Author : Ebizmarts <info@ebizmarts.com>
|
4 |
* Date : 8/6/14
|
@@ -25,21 +26,20 @@ class Ebizmarts_Mandrill_Model_System_Config_Source_Userinfo
|
|
25 |
public function __construct()
|
26 |
{
|
27 |
$storeId = Mage::app()->getStore()->getId();
|
28 |
-
if(Mage::app()->getRequest()->getParam('store')) {
|
29 |
$stores = Mage::app()->getStores();
|
30 |
-
foreach($stores as $store) {
|
31 |
-
if($store->getCode()==Mage::app()->getRequest()->getParam('store')) {
|
32 |
$storeId = $store->getStoreId();
|
33 |
break;
|
34 |
}
|
35 |
}
|
36 |
}
|
37 |
-
if ((!is_array($this->_account_details) || isset($this->_account_details['status'])) && Mage::getStoreConfig(
|
38 |
-
$api = new Mandrill_Message(Mage::getStoreConfig(
|
39 |
try {
|
40 |
$this->_account_details = $api->users->info();
|
41 |
-
}
|
42 |
-
catch(Exception $e) {
|
43 |
$this->_account_details = "--- Invalid API key ---";
|
44 |
}
|
45 |
}
|
@@ -53,8 +53,8 @@ class Ebizmarts_Mandrill_Model_System_Config_Source_Userinfo
|
|
53 |
public function toOptionArray()
|
54 |
{
|
55 |
$helper = Mage::helper('ebizmarts_mandrill');
|
56 |
-
if(is_array($this->_account_details)){
|
57 |
-
if(!isset($this->_account_details['status'])) {
|
58 |
return array(
|
59 |
array('value' => 0, 'label' => $helper->__("<strong>Username</strong>: %s %s", $this->_account_details["username"], "<small>used for SMTP authentication</small>")),
|
60 |
|
@@ -64,10 +64,10 @@ class Ebizmarts_Mandrill_Model_System_Config_Source_Userinfo
|
|
64 |
|
65 |
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>"))
|
66 |
);
|
67 |
-
}else{
|
68 |
return array(array('value' => '', 'label' => $helper->__('--- Invalid API KEY ---')));
|
69 |
}
|
70 |
-
}else{
|
71 |
return array(array('value' => '', 'label' => $helper->__($this->_account_details)));
|
72 |
}
|
73 |
}
|
1 |
<?php
|
2 |
+
|
3 |
/**
|
4 |
* Author : Ebizmarts <info@ebizmarts.com>
|
5 |
* Date : 8/6/14
|
26 |
public function __construct()
|
27 |
{
|
28 |
$storeId = Mage::app()->getStore()->getId();
|
29 |
+
if (Mage::app()->getRequest()->getParam('store')) {
|
30 |
$stores = Mage::app()->getStores();
|
31 |
+
foreach ($stores as $store) {
|
32 |
+
if ($store->getCode() == Mage::app()->getRequest()->getParam('store')) {
|
33 |
$storeId = $store->getStoreId();
|
34 |
break;
|
35 |
}
|
36 |
}
|
37 |
}
|
38 |
+
if ((!is_array($this->_account_details) || isset($this->_account_details['status'])) && Mage::getStoreConfig(Ebizmarts_Mandrill_Model_System_Config::APIKEY, $storeId)) {
|
39 |
+
$api = new Mandrill_Message(Mage::getStoreConfig(Ebizmarts_Mandrill_Model_System_Config::APIKEY, $storeId));
|
40 |
try {
|
41 |
$this->_account_details = $api->users->info();
|
42 |
+
} catch (Exception $e) {
|
|
|
43 |
$this->_account_details = "--- Invalid API key ---";
|
44 |
}
|
45 |
}
|
53 |
public function toOptionArray()
|
54 |
{
|
55 |
$helper = Mage::helper('ebizmarts_mandrill');
|
56 |
+
if (is_array($this->_account_details)) {
|
57 |
+
if (!isset($this->_account_details['status'])) {
|
58 |
return array(
|
59 |
array('value' => 0, 'label' => $helper->__("<strong>Username</strong>: %s %s", $this->_account_details["username"], "<small>used for SMTP authentication</small>")),
|
60 |
|
64 |
|
65 |
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>"))
|
66 |
);
|
67 |
+
} else {
|
68 |
return array(array('value' => '', 'label' => $helper->__('--- Invalid API KEY ---')));
|
69 |
}
|
70 |
+
} else {
|
71 |
return array(array('value' => '', 'label' => $helper->__($this->_account_details)));
|
72 |
}
|
73 |
}
|
app/code/community/Ebizmarts/Mandrill/controllers/Adminhtml/Mandrill/UsersController.php
CHANGED
@@ -8,29 +8,31 @@
|
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
-
|
12 |
-
|
13 |
|
14 |
/**
|
15 |
* Initialize action
|
16 |
*
|
17 |
* @return Mage_Adminhtml_Controller_Action
|
18 |
*/
|
19 |
-
protected function _initAction()
|
20 |
-
|
|
|
21 |
|
22 |
$this->loadLayout();
|
23 |
$this->_setActiveMenu('newsletter/magemonkey');
|
24 |
return $this;
|
25 |
}
|
26 |
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
|
|
33 |
$this->renderLayout();
|
34 |
-
|
35 |
|
36 |
}
|
8 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php
|
10 |
*/
|
11 |
+
class Ebizmarts_Mandrill_Adminhtml_Mandrill_UsersController extends Mage_Adminhtml_Controller_Action
|
12 |
+
{
|
13 |
|
14 |
/**
|
15 |
* Initialize action
|
16 |
*
|
17 |
* @return Mage_Adminhtml_Controller_Action
|
18 |
*/
|
19 |
+
protected function _initAction()
|
20 |
+
{
|
21 |
+
$this->_title($this->__('Mandrill'));
|
22 |
|
23 |
$this->loadLayout();
|
24 |
$this->_setActiveMenu('newsletter/magemonkey');
|
25 |
return $this;
|
26 |
}
|
27 |
|
28 |
+
/**
|
29 |
+
* Mandrill verified emails grid
|
30 |
+
*/
|
31 |
+
public function sendersAction()
|
32 |
+
{
|
33 |
+
$this->_initAction();
|
34 |
+
$this->_title($this->__('Verified Senders'));
|
35 |
$this->renderLayout();
|
36 |
+
}
|
37 |
|
38 |
}
|
app/code/community/Ebizmarts/Mandrill/etc/system.xml
CHANGED
@@ -19,7 +19,8 @@
|
|
19 |
<show_in_store>1</show_in_store>
|
20 |
</hint>
|
21 |
<general translate="label comment">
|
22 |
-
<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>
|
19 |
<show_in_store>1</show_in_store>
|
20 |
</hint>
|
21 |
<general translate="label comment">
|
22 |
+
<comment>
|
23 |
+
<![CDATA[<a href="http://mandrill.com/signup/?pid=ebizmart&source=website" target="_blank">Get a free Mandrill account now</a>]]></comment>
|
24 |
<label><![CDATA[Mandrill, SMARTER EMAIL FOR APPS integration by ebizmarts]]></label>
|
25 |
<sort_order>10</sort_order>
|
26 |
<frontend_type>text</frontend_type>
|
app/code/community/Ebizmarts/SweetMonkey/Block/Adminhtml/System/Config/Autovars.php
CHANGED
@@ -5,14 +5,16 @@
|
|
5 |
*
|
6 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
7 |
*/
|
8 |
-
class Ebizmarts_SweetMonkey_Block_Adminhtml_System_Config_Autovars extends Mage_Adminhtml_Block_System_Config_Form_Field
|
9 |
-
|
|
|
10 |
/**
|
11 |
* Set template to itself
|
12 |
-
*
|
13 |
* @return Ebizmarts_SweetMonkey_Block_Adminhtml_System_Config_Autovars
|
14 |
*/
|
15 |
-
protected function _prepareLayout()
|
|
|
16 |
parent::_prepareLayout();
|
17 |
if (!$this->getTemplate()) {
|
18 |
$this->setTemplate('sweetmonkey/system/config/autovars.phtml');
|
@@ -26,7 +28,8 @@ class Ebizmarts_SweetMonkey_Block_Adminhtml_System_Config_Autovars extends Mage_
|
|
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 |
}
|
@@ -37,11 +40,12 @@ class Ebizmarts_SweetMonkey_Block_Adminhtml_System_Config_Autovars extends Mage_
|
|
37 |
* @param Varien_Data_Form_Element_Abstract $element
|
38 |
* @return string
|
39 |
*/
|
40 |
-
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
41 |
-
|
|
|
42 |
$originalData = $element->getOriginalData();
|
43 |
$this->addData(array(
|
44 |
-
'button_label' => Mage::helper('paypal')->__($originalData['button_label']),
|
45 |
'html_id' => $element->getHtmlId(),
|
46 |
'snd_button_label' => Mage::helper('paypal')->__($originalData['snd_button_label']),
|
47 |
'snd_html_id' => 'sandbox_' . $element->getHtmlId(),
|
5 |
*
|
6 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
7 |
*/
|
8 |
+
class Ebizmarts_SweetMonkey_Block_Adminhtml_System_Config_Autovars extends Mage_Adminhtml_Block_System_Config_Form_Field
|
9 |
+
{
|
10 |
+
|
11 |
/**
|
12 |
* Set template to itself
|
13 |
+
*
|
14 |
* @return Ebizmarts_SweetMonkey_Block_Adminhtml_System_Config_Autovars
|
15 |
*/
|
16 |
+
protected function _prepareLayout()
|
17 |
+
{
|
18 |
parent::_prepareLayout();
|
19 |
if (!$this->getTemplate()) {
|
20 |
$this->setTemplate('sweetmonkey/system/config/autovars.phtml');
|
28 |
* @param Varien_Data_Form_Element_Abstract $element
|
29 |
* @return string
|
30 |
*/
|
31 |
+
public function render(Varien_Data_Form_Element_Abstract $element)
|
32 |
+
{
|
33 |
$element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue();
|
34 |
return parent::render($element);
|
35 |
}
|
40 |
* @param Varien_Data_Form_Element_Abstract $element
|
41 |
* @return string
|
42 |
*/
|
43 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
44 |
+
{
|
45 |
+
|
46 |
$originalData = $element->getOriginalData();
|
47 |
$this->addData(array(
|
48 |
+
'button_label' => Mage::helper('paypal')->__($originalData['button_label']),
|
49 |
'html_id' => $element->getHtmlId(),
|
50 |
'snd_button_label' => Mage::helper('paypal')->__($originalData['snd_button_label']),
|
51 |
'snd_html_id' => 'sandbox_' . $element->getHtmlId(),
|
app/code/community/Ebizmarts/SweetMonkey/Block/Adminhtml/System/Config/Fieldset/Hint.php
CHANGED
@@ -2,7 +2,8 @@
|
|
2 |
|
3 |
class Ebizmarts_SweetMonkey_Block_Adminhtml_System_Config_Fieldset_Hint
|
4 |
extends Mage_Adminhtml_Block_Abstract
|
5 |
-
implements Varien_Data_Form_Element_Renderer_Interface
|
|
|
6 |
|
7 |
protected $_template = 'sweetmonkey/system/config/fieldset/hint.phtml';
|
8 |
|
@@ -12,20 +13,23 @@ class Ebizmarts_SweetMonkey_Block_Adminhtml_System_Config_Fieldset_Hint
|
|
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 getSweetMonkeyVersion()
|
20 |
-
|
|
|
21 |
}
|
22 |
|
23 |
-
public function getPxParams()
|
|
|
24 |
|
25 |
-
|
26 |
|
27 |
-
|
28 |
-
|
29 |
$platform = Mage::getSingleton('rewards/platform_instance');
|
30 |
try {
|
31 |
$account = $platform->account()->get();
|
@@ -33,20 +37,20 @@ class Ebizmarts_SweetMonkey_Block_Adminhtml_System_Config_Fieldset_Hint
|
|
33 |
$sweetTooth .= "-" . $account['username'];
|
34 |
|
35 |
} catch (Exception $ex) {
|
36 |
-
|
37 |
}
|
38 |
-
|
39 |
|
40 |
-
|
41 |
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
|
47 |
-
|
48 |
|
49 |
-
|
50 |
|
51 |
}
|
52 |
|
2 |
|
3 |
class Ebizmarts_SweetMonkey_Block_Adminhtml_System_Config_Fieldset_Hint
|
4 |
extends Mage_Adminhtml_Block_Abstract
|
5 |
+
implements Varien_Data_Form_Element_Renderer_Interface
|
6 |
+
{
|
7 |
|
8 |
protected $_template = 'sweetmonkey/system/config/fieldset/hint.phtml';
|
9 |
|
13 |
* @param Varien_Data_Form_Element_Abstract $element
|
14 |
* @return string
|
15 |
*/
|
16 |
+
public function render(Varien_Data_Form_Element_Abstract $element)
|
17 |
+
{
|
18 |
return $this->toHtml();
|
19 |
}
|
20 |
|
21 |
+
public function getSweetMonkeyVersion()
|
22 |
+
{
|
23 |
+
return (string)Mage::getConfig()->getNode('modules/Ebizmarts_SweetMonkey/version');
|
24 |
}
|
25 |
|
26 |
+
public function getPxParams()
|
27 |
+
{
|
28 |
|
29 |
+
$v = $this->getSweetMonkeyVersion();
|
30 |
|
31 |
+
$sweetTooth = Mage::getStoreConfig('rewards/platform/apisubdomain');
|
32 |
+
if (Mage::getStoreConfig('rewards/platform/is_connected')) {
|
33 |
$platform = Mage::getSingleton('rewards/platform_instance');
|
34 |
try {
|
35 |
$account = $platform->account()->get();
|
37 |
$sweetTooth .= "-" . $account['username'];
|
38 |
|
39 |
} catch (Exception $ex) {
|
40 |
+
Mage::logException($ex);
|
41 |
}
|
42 |
+
}
|
43 |
|
44 |
+
$ext = "Sweet Monkey ({$sweetTooth});{$v}";
|
45 |
|
46 |
+
$modulesArray = (array)Mage::getConfig()->getNode('modules')->children();
|
47 |
+
$aux = (array_key_exists('Enterprise_Enterprise', $modulesArray)) ? 'EE' : 'CE';
|
48 |
+
$mageVersion = Mage::getVersion();
|
49 |
+
$mage = "Magento {$aux};{$mageVersion}";
|
50 |
|
51 |
+
$hash = md5($ext . '_' . $mage . '_' . $ext);
|
52 |
|
53 |
+
return "ext=$ext&mage={$mage}&ctrl={$hash}";
|
54 |
|
55 |
}
|
56 |
|
app/code/community/Ebizmarts/SweetMonkey/Block/Adminhtml/System/Config/Form/Field/Mapfields.php
CHANGED
@@ -5,14 +5,16 @@
|
|
5 |
*
|
6 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
7 |
*/
|
8 |
-
class Ebizmarts_SweetMonkey_Block_Adminhtml_System_Config_Form_Field_Mapfields extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
|
9 |
-
|
|
|
10 |
/**
|
11 |
* Set the columns name
|
12 |
-
*
|
13 |
* @return void
|
14 |
*/
|
15 |
-
public function __construct()
|
|
|
16 |
$this->addColumn('var_code', array(
|
17 |
'label' => Mage::helper('sweetmonkey')->__('Code'),
|
18 |
'style' => 'width:120px',
|
@@ -22,7 +24,7 @@ class Ebizmarts_SweetMonkey_Block_Adminhtml_System_Config_Form_Field_Mapfields e
|
|
22 |
'style' => 'width:120px',
|
23 |
));
|
24 |
$this->_addAfter = false;
|
25 |
-
|
26 |
parent::__construct();
|
27 |
}
|
28 |
}
|
5 |
*
|
6 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
7 |
*/
|
8 |
+
class Ebizmarts_SweetMonkey_Block_Adminhtml_System_Config_Form_Field_Mapfields extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
|
9 |
+
{
|
10 |
+
|
11 |
/**
|
12 |
* Set the columns name
|
13 |
+
*
|
14 |
* @return void
|
15 |
*/
|
16 |
+
public function __construct()
|
17 |
+
{
|
18 |
$this->addColumn('var_code', array(
|
19 |
'label' => Mage::helper('sweetmonkey')->__('Code'),
|
20 |
'style' => 'width:120px',
|
24 |
'style' => 'width:120px',
|
25 |
));
|
26 |
$this->_addAfter = false;
|
27 |
+
$this->_addButtonLabel = Mage::helper('sweetmonkey')->__('Add field');
|
28 |
parent::__construct();
|
29 |
}
|
30 |
}
|
app/code/community/Ebizmarts/SweetMonkey/Helper/Data.php
CHANGED
@@ -5,15 +5,17 @@
|
|
5 |
*
|
6 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
7 |
*/
|
8 |
-
class Ebizmarts_SweetMonkey_Helper_Data extends Mage_Core_Helper_Abstract
|
|
|
9 |
|
10 |
/**
|
11 |
* Check if the module is enabled in configuration
|
12 |
*
|
13 |
* @return boolean
|
14 |
*/
|
15 |
-
public function enabled()
|
16 |
-
|
|
|
17 |
}
|
18 |
|
19 |
/**
|
@@ -22,26 +24,28 @@ class Ebizmarts_SweetMonkey_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
22 |
* @param string $field
|
23 |
* @return string
|
24 |
*/
|
25 |
-
public function config($field)
|
26 |
-
|
|
|
27 |
}
|
28 |
|
29 |
-
|
|
|
30 |
|
31 |
-
|
32 |
|
33 |
-
|
34 |
-
|
35 |
|
36 |
-
|
37 |
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
|
44 |
-
|
45 |
-
|
46 |
|
47 |
}
|
5 |
*
|
6 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
7 |
*/
|
8 |
+
class Ebizmarts_SweetMonkey_Helper_Data extends Mage_Core_Helper_Abstract
|
9 |
+
{
|
10 |
|
11 |
/**
|
12 |
* Check if the module is enabled in configuration
|
13 |
*
|
14 |
* @return boolean
|
15 |
*/
|
16 |
+
public function enabled()
|
17 |
+
{
|
18 |
+
return (bool)Mage::getStoreConfigFlag('sweetmonkey/general/active');
|
19 |
}
|
20 |
|
21 |
/**
|
24 |
* @param string $field
|
25 |
* @return string
|
26 |
*/
|
27 |
+
public function config($field)
|
28 |
+
{
|
29 |
+
return Mage::getStoreConfig('sweetmonkey/general/' . $field);
|
30 |
}
|
31 |
|
32 |
+
public function pushVars($customer)
|
33 |
+
{
|
34 |
|
35 |
+
if (Mage::helper('monkey')->canMonkey() && $customer->getId()) {
|
36 |
|
37 |
+
$mergeVars = Mage::helper('monkey')->getMergeVars($customer, TRUE);
|
38 |
+
$api = Mage::getSingleton('monkey/api', array('store' => $customer->getStoreId()));
|
39 |
|
40 |
+
$lists = $api->listsForEmail($customer->getEmail());
|
41 |
|
42 |
+
if (is_array($lists)) {
|
43 |
+
foreach ($lists as $listId) {
|
44 |
+
$api->listUpdateMember($listId, $customer->getEmail(), $mergeVars);
|
45 |
+
}
|
46 |
+
}
|
47 |
|
48 |
+
}
|
49 |
+
}
|
50 |
|
51 |
}
|
app/code/community/Ebizmarts/SweetMonkey/Model/Cron.php
CHANGED
@@ -5,87 +5,32 @@
|
|
5 |
*
|
6 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
7 |
*/
|
8 |
-
class Ebizmarts_SweetMonkey_Model_Cron
|
|
|
9 |
|
10 |
-
|
11 |
-
const XML_PATH_EXPIRY_EMAIL_IDENTITY = 'sweetmonkey/general/warning/expiry_email_identity';
|
12 |
-
const XML_PATH_POINTS_EMAIL_TEMPLATE = 'sweetmonkey/general/warning/points_email_template';
|
13 |
-
const XML_PATH_POINTS_EMAIL_IDENTITY = 'sweetmonkey/general/warning/points_email_identity';
|
14 |
-
|
15 |
-
protected $_daysUntilExpiry = 3;
|
16 |
-
protected $_pointsToNotify = 500;
|
17 |
-
|
18 |
-
/**
|
19 |
-
* Send automated emails to the customers
|
20 |
-
*
|
21 |
-
* @return void
|
22 |
-
*/
|
23 |
-
public function automatedEmails() {
|
24 |
-
$this->checkAllCustomers();
|
25 |
-
}
|
26 |
-
|
27 |
-
public function checkAllCustomers() {
|
28 |
-
$customers = Mage::getModel('rewards/customer')->getCollection();
|
29 |
-
foreach ($customers as $c) {
|
30 |
-
if (!Mage::helper('rewards/expiry')->isEnabled($c->getStoreId()))
|
31 |
-
continue;
|
32 |
-
$c = Mage::getModel('rewards/customer')->load($c->getId());
|
33 |
-
|
34 |
-
/* send an automated email 3 days before a points expiration */
|
35 |
-
$days = Mage::getModel('rewards/expiry')->getDaysUntilExpiry($c);
|
36 |
-
if ($days == $this->_daysUntilExpiry) {
|
37 |
-
$points = $c->getPoints();
|
38 |
-
$vars = array(
|
39 |
-
'customer_name' => $c->getName(),
|
40 |
-
'customer_email' => $c->getEmail(),
|
41 |
-
'store_name' => $c->getStore()->getName(),
|
42 |
-
'points_transferred' => (string) $points[1],
|
43 |
-
'points_balance' => (string) $c->getPointsSummary(),
|
44 |
-
'days_left' => $days,
|
45 |
-
'days_until_expiry' => $this->_daysUntilExpiry
|
46 |
-
);
|
47 |
-
$email = Mage::getModel('core/email_template');
|
48 |
-
$email->sendTransactional(
|
49 |
-
Mage::getStoreConfig(self::XML_PATH_EXPIRY_EMAIL_TEMPLATE), Mage::getStoreConfig(self::XML_PATH_EXPIRY_EMAIL_IDENTITY), $c->getEmail(), $c->getName(), $vars
|
50 |
-
);
|
51 |
-
}
|
52 |
-
|
53 |
-
/* send an automated email if a customer has a 500 points or more */
|
54 |
-
$points = $c->getPoints();
|
55 |
-
if ($points[1] >= $this->_pointsToNotify) {
|
56 |
-
$vars = array(
|
57 |
-
'customer_name' => $c->getName(),
|
58 |
-
'customer_email' => $c->getEmail(),
|
59 |
-
'store_name' => $c->getStore()->getName(),
|
60 |
-
'points_transferred' => (string) $points[1],
|
61 |
-
'points_balance' => (string) $c->getPointsSummary(),
|
62 |
-
'days_left' => $days,
|
63 |
-
'points_to_notify' => $this->_pointsToNotify
|
64 |
-
);
|
65 |
-
$email = Mage::getModel('core/email_template');
|
66 |
-
$email->sendTransactional(
|
67 |
-
Mage::getStoreConfig(self::XML_PATH_POINTS_EMAIL_TEMPLATE), Mage::getStoreConfig(self::XML_PATH_POINTS_EMAIL_IDENTITY), $c->getEmail(), $c->getName(), $vars
|
68 |
-
);
|
69 |
-
}
|
70 |
-
}
|
71 |
-
}
|
72 |
-
|
73 |
-
/**
|
74 |
* Push customers vars to MailChimp
|
75 |
*
|
76 |
* @return void
|
77 |
*/
|
78 |
-
public function pushMergeVarsForCustomers()
|
79 |
-
|
80 |
-
$
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
}
|
86 |
-
|
87 |
-
$customer = Mage::getModel('rewards/customer')->load($c->getId());
|
88 |
-
Mage::helper('sweetmonkey')->pushVars($customer);
|
89 |
}
|
90 |
}
|
91 |
|
5 |
*
|
6 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
7 |
*/
|
8 |
+
class Ebizmarts_SweetMonkey_Model_Cron
|
9 |
+
{
|
10 |
|
11 |
+
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
* Push customers vars to MailChimp
|
13 |
*
|
14 |
* @return void
|
15 |
*/
|
16 |
+
public function pushMergeVarsForCustomers()
|
17 |
+
{
|
18 |
+
$allStores = Mage::app()->getStores();
|
19 |
+
foreach ($allStores as $storeId => $val) {
|
20 |
+
if (Mage::getStoreConfig(Mage::helper('sweetmonkey')->config('active'), $storeId)) {
|
21 |
+
|
22 |
+
$customers = Mage::getModel('rewards/customer')->getCollection()
|
23 |
+
->addFieldToFilter('store_id', array('eq' => $storeId));
|
24 |
+
|
25 |
+
foreach ($customers as $c) {
|
26 |
+
if (!Mage::helper('rewards/expiry')->isEnabled($c->getStoreId())) {
|
27 |
+
continue;
|
28 |
+
}
|
29 |
+
|
30 |
+
$customer = Mage::getModel('rewards/customer')->load($c->getId());
|
31 |
+
Mage::helper('sweetmonkey')->pushVars($customer);
|
32 |
+
}
|
33 |
}
|
|
|
|
|
|
|
34 |
}
|
35 |
}
|
36 |
|
app/code/community/Ebizmarts/SweetMonkey/Model/Observer.php
CHANGED
@@ -5,7 +5,29 @@
|
|
5 |
*
|
6 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
7 |
*/
|
8 |
-
class Ebizmarts_SweetMonkey_Model_Observer
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
/**
|
11 |
* Sende merge vars after customer logs in
|
@@ -13,7 +35,8 @@ class Ebizmarts_SweetMonkey_Model_Observer {
|
|
13 |
* @param Varien_Event_Observer $observer
|
14 |
* @return void
|
15 |
*/
|
16 |
-
public function customerLogin($observer)
|
|
|
17 |
$customer = $observer->getEvent()->getCustomer();
|
18 |
Mage::helper('sweetmonkey')->pushVars($customer);
|
19 |
return $this;
|
@@ -25,9 +48,10 @@ class Ebizmarts_SweetMonkey_Model_Observer {
|
|
25 |
* @param Varien_Event_Observer $observer
|
26 |
* @return void
|
27 |
*/
|
28 |
-
public function customerRewardSave($observer)
|
|
|
29 |
$obj = $observer->getEvent()->getObject();
|
30 |
-
if($obj instanceof TBT_Rewards_Model_Customer) {
|
31 |
Mage::helper('sweetmonkey')->pushVars($obj);
|
32 |
}
|
33 |
|
@@ -40,13 +64,14 @@ class Ebizmarts_SweetMonkey_Model_Observer {
|
|
40 |
* @param Varien_Event_Observer $observer
|
41 |
* @return void
|
42 |
*/
|
43 |
-
public function pointsEvent($observer)
|
44 |
-
|
45 |
-
|
|
|
46 |
return $this;
|
47 |
}
|
48 |
|
49 |
-
|
50 |
|
51 |
return $this;
|
52 |
}
|
@@ -57,39 +82,40 @@ class Ebizmarts_SweetMonkey_Model_Observer {
|
|
57 |
* @param Varien_Event_Observer $observer
|
58 |
* @return void
|
59 |
*/
|
60 |
-
public function attachTbtMergeVars($observer)
|
|
|
61 |
|
62 |
-
$holder
|
63 |
-
$helper
|
64 |
$customerHelper = Mage::helper('customer');
|
65 |
-
$customer
|
66 |
-
if($helper->enabled() && ($customer->getId())) {
|
67 |
|
68 |
|
69 |
$merge = unserialize($helper->config('merge_vars'));
|
70 |
|
71 |
-
if(count($merge)){
|
72 |
|
73 |
$tbtVars = array();
|
74 |
-
foreach($merge as $varTag) {
|
75 |
$tbtVars [$varTag['var_code']] = '-';
|
76 |
}
|
77 |
|
78 |
$tbtCustomer = Mage::getModel('rewards/customer')->load($customer->getId());
|
79 |
//Point balance
|
80 |
-
if(array_key_exists('PTS', $tbtVars)) {
|
81 |
$tbtVars['PTS'] = $tbtCustomer->getPointsSummary();
|
82 |
}
|
83 |
|
84 |
-
if(array_key_exists('POINTS', $tbtVars)) {
|
85 |
$tbtVars['POINTS'] = $tbtCustomer->getUsablePointsBalance(1);
|
86 |
}
|
87 |
|
88 |
//Earn and Spent points
|
89 |
-
$existEarn
|
90 |
$existSpent = array_key_exists('PTSSPENT', $tbtVars);
|
91 |
|
92 |
-
if($existEarn || $existSpent) {
|
93 |
|
94 |
$lastTransfers = $tbtCustomer->getTransfers()
|
95 |
->selectOnlyActive()
|
@@ -97,26 +123,26 @@ class Ebizmarts_SweetMonkey_Model_Observer {
|
|
97 |
|
98 |
$spent = $earn = null;
|
99 |
|
100 |
-
if($lastTransfers->getSize()) {
|
101 |
-
foreach($lastTransfers as $transfer) {
|
102 |
|
103 |
-
if(is_null($earn) && $transfer->getQuantity() > 0){
|
104 |
$earn = date_format(date_create_from_format('Y-m-d H:i:s', $transfer->getEffectiveStart()), 'Y-m-d');
|
105 |
-
}else if(is_null($spent) && $transfer->getQuantity() < 0) {
|
106 |
$spent = date_format(date_create_from_format('Y-m-d H:i:s', $transfer->getEffectiveStart()), 'Y-m-d');
|
107 |
}
|
108 |
|
109 |
-
if(!is_null($spent) && !is_null($earn)) {
|
110 |
break;
|
111 |
}
|
112 |
|
113 |
}
|
114 |
}
|
115 |
|
116 |
-
if($existEarn && $earn) {
|
117 |
$tbtVars['PTSEARN'] = $earn;
|
118 |
}
|
119 |
-
if($existSpent && $spent) {
|
120 |
$tbtVars['PTSSPENT'] = $spent;
|
121 |
}
|
122 |
|
@@ -124,18 +150,17 @@ class Ebizmarts_SweetMonkey_Model_Observer {
|
|
124 |
}
|
125 |
|
126 |
//Expiration Points
|
127 |
-
if(array_key_exists('PTSEXP', $tbtVars)) {
|
128 |
$val = Mage::getSingleton('rewards/expiry')
|
129 |
->getExpiryDate($tbtCustomer);
|
130 |
-
if($val){
|
131 |
$val = date_format(date_create_from_format('d/m/Y', $val), 'Y-m-d');
|
132 |
$tbtVars['PTSEXP'] = $val;
|
133 |
}
|
134 |
}
|
135 |
-
foreach($tbtVars as $key => $var){
|
136 |
$aux = str_replace('points', '', strtolower($var));
|
137 |
$tbtVars[$key] = str_replace('no', 0, $aux);
|
138 |
-
Mage::log('cambio '.$tbtVars[$key], null, 'santiago.log', true);
|
139 |
|
140 |
}
|
141 |
|
@@ -154,8 +179,9 @@ class Ebizmarts_SweetMonkey_Model_Observer {
|
|
154 |
* @param string Date in format YYYY-MM-DD
|
155 |
* @return string MM/DD/YYYY
|
156 |
*/
|
157 |
-
protected function _formatDateMerge($date)
|
158 |
-
|
|
|
159 |
}
|
160 |
|
161 |
}
|
5 |
*
|
6 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
7 |
*/
|
8 |
+
class Ebizmarts_SweetMonkey_Model_Observer
|
9 |
+
{
|
10 |
+
|
11 |
+
public function saveConfig($observer)
|
12 |
+
{
|
13 |
+
if (!Mage::helper('core')->isModuleEnabled('TBT_Common')) {
|
14 |
+
if (Mage::app()->getRequest()->getParam('store')) {
|
15 |
+
$scope = 'store';
|
16 |
+
} elseif (Mage::app()->getRequest()->getParam('website')) {
|
17 |
+
$scope = 'website';
|
18 |
+
} else {
|
19 |
+
$scope = 'default';
|
20 |
+
}
|
21 |
+
|
22 |
+
$store = is_null($observer->getEvent()->getStore()) ? Mage::app()->getDefaultStoreView()->getCode() : $observer->getEvent()->getStore();
|
23 |
+
$config = new Mage_Core_Model_Config();
|
24 |
+
$config->saveConfig('sweetmonkey/general/active', false, $scope, $store);
|
25 |
+
Mage::getConfig()->cleanCache();
|
26 |
+
$message = Mage::helper('sweetmonkey')->__('To activate Sweet Monkey you need to have <a href=https://www.sweettoothrewards.com/features/magento/>Sweet Tooth Rewards</a> enabled');
|
27 |
+
Mage::getSingleton('adminhtml/session')->addWarning($message);
|
28 |
+
}
|
29 |
+
return $observer;
|
30 |
+
}
|
31 |
|
32 |
/**
|
33 |
* Sende merge vars after customer logs in
|
35 |
* @param Varien_Event_Observer $observer
|
36 |
* @return void
|
37 |
*/
|
38 |
+
public function customerLogin($observer)
|
39 |
+
{
|
40 |
$customer = $observer->getEvent()->getCustomer();
|
41 |
Mage::helper('sweetmonkey')->pushVars($customer);
|
42 |
return $this;
|
48 |
* @param Varien_Event_Observer $observer
|
49 |
* @return void
|
50 |
*/
|
51 |
+
public function customerRewardSave($observer)
|
52 |
+
{
|
53 |
$obj = $observer->getEvent()->getObject();
|
54 |
+
if ($obj instanceof TBT_Rewards_Model_Customer) {
|
55 |
Mage::helper('sweetmonkey')->pushVars($obj);
|
56 |
}
|
57 |
|
64 |
* @param Varien_Event_Observer $observer
|
65 |
* @return void
|
66 |
*/
|
67 |
+
public function pointsEvent($observer)
|
68 |
+
{
|
69 |
+
$customer = $observer->getEvent()->getCustomer();
|
70 |
+
if (!$customer) {
|
71 |
return $this;
|
72 |
}
|
73 |
|
74 |
+
Mage::helper('sweetmonkey')->pushVars($customer);
|
75 |
|
76 |
return $this;
|
77 |
}
|
82 |
* @param Varien_Event_Observer $observer
|
83 |
* @return void
|
84 |
*/
|
85 |
+
public function attachTbtMergeVars($observer)
|
86 |
+
{
|
87 |
|
88 |
+
$holder = $observer->getEvent()->getNewvars();
|
89 |
+
$helper = Mage::helper('sweetmonkey');
|
90 |
$customerHelper = Mage::helper('customer');
|
91 |
+
$customer = $observer->getEvent()->getCustomer();
|
92 |
+
if ($helper->enabled() && ($customer->getId())) {
|
93 |
|
94 |
|
95 |
$merge = unserialize($helper->config('merge_vars'));
|
96 |
|
97 |
+
if (count($merge)) {
|
98 |
|
99 |
$tbtVars = array();
|
100 |
+
foreach ($merge as $varTag) {
|
101 |
$tbtVars [$varTag['var_code']] = '-';
|
102 |
}
|
103 |
|
104 |
$tbtCustomer = Mage::getModel('rewards/customer')->load($customer->getId());
|
105 |
//Point balance
|
106 |
+
if (array_key_exists('PTS', $tbtVars)) {
|
107 |
$tbtVars['PTS'] = $tbtCustomer->getPointsSummary();
|
108 |
}
|
109 |
|
110 |
+
if (array_key_exists('POINTS', $tbtVars)) {
|
111 |
$tbtVars['POINTS'] = $tbtCustomer->getUsablePointsBalance(1);
|
112 |
}
|
113 |
|
114 |
//Earn and Spent points
|
115 |
+
$existEarn = array_key_exists('PTSEARN', $tbtVars);
|
116 |
$existSpent = array_key_exists('PTSSPENT', $tbtVars);
|
117 |
|
118 |
+
if ($existEarn || $existSpent) {
|
119 |
|
120 |
$lastTransfers = $tbtCustomer->getTransfers()
|
121 |
->selectOnlyActive()
|
123 |
|
124 |
$spent = $earn = null;
|
125 |
|
126 |
+
if ($lastTransfers->getSize()) {
|
127 |
+
foreach ($lastTransfers as $transfer) {
|
128 |
|
129 |
+
if (is_null($earn) && $transfer->getQuantity() > 0) {
|
130 |
$earn = date_format(date_create_from_format('Y-m-d H:i:s', $transfer->getEffectiveStart()), 'Y-m-d');
|
131 |
+
} else if (is_null($spent) && $transfer->getQuantity() < 0) {
|
132 |
$spent = date_format(date_create_from_format('Y-m-d H:i:s', $transfer->getEffectiveStart()), 'Y-m-d');
|
133 |
}
|
134 |
|
135 |
+
if (!is_null($spent) && !is_null($earn)) {
|
136 |
break;
|
137 |
}
|
138 |
|
139 |
}
|
140 |
}
|
141 |
|
142 |
+
if ($existEarn && $earn) {
|
143 |
$tbtVars['PTSEARN'] = $earn;
|
144 |
}
|
145 |
+
if ($existSpent && $spent) {
|
146 |
$tbtVars['PTSSPENT'] = $spent;
|
147 |
}
|
148 |
|
150 |
}
|
151 |
|
152 |
//Expiration Points
|
153 |
+
if (array_key_exists('PTSEXP', $tbtVars)) {
|
154 |
$val = Mage::getSingleton('rewards/expiry')
|
155 |
->getExpiryDate($tbtCustomer);
|
156 |
+
if ($val) {
|
157 |
$val = date_format(date_create_from_format('d/m/Y', $val), 'Y-m-d');
|
158 |
$tbtVars['PTSEXP'] = $val;
|
159 |
}
|
160 |
}
|
161 |
+
foreach ($tbtVars as $key => $var) {
|
162 |
$aux = str_replace('points', '', strtolower($var));
|
163 |
$tbtVars[$key] = str_replace('no', 0, $aux);
|
|
|
164 |
|
165 |
}
|
166 |
|
179 |
* @param string Date in format YYYY-MM-DD
|
180 |
* @return string MM/DD/YYYY
|
181 |
*/
|
182 |
+
protected function _formatDateMerge($date)
|
183 |
+
{
|
184 |
+
return preg_replace("/(\d+)\D+(\d+)\D+(\d+)\D+(\d+)\D+(\d+)\D+(\d+)/", "$2/$3/$1", $date);
|
185 |
}
|
186 |
|
187 |
}
|
app/code/community/Ebizmarts/SweetMonkey/controllers/Adminhtml/MageMonkeyController.php
CHANGED
@@ -5,12 +5,14 @@
|
|
5 |
*
|
6 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
7 |
*/
|
8 |
-
class Ebizmarts_SweetMonkey_Adminhtml_MageMonkeyController extends Mage_Adminhtml_Controller_Action
|
|
|
9 |
|
10 |
/**
|
11 |
* Get merge vars for given list
|
12 |
*/
|
13 |
-
public function varsForListAction()
|
|
|
14 |
$listId = $this->getRequest()->getParam('list_id', null);
|
15 |
|
16 |
$mergeVars = array();
|
@@ -28,7 +30,8 @@ class Ebizmarts_SweetMonkey_Adminhtml_MageMonkeyController extends Mage_Adminhtm
|
|
28 |
/**
|
29 |
* Add merge vars to list
|
30 |
*/
|
31 |
-
public function varsToListAction()
|
|
|
32 |
|
33 |
$listId = $this->getRequest()->getPost('list_id', null);
|
34 |
|
@@ -43,11 +46,10 @@ class Ebizmarts_SweetMonkey_Adminhtml_MageMonkeyController extends Mage_Adminhtm
|
|
43 |
//Date for some fields, format is "MM/DD/YYYY"
|
44 |
if ($tag == 'PTSSPENT' || $tag == 'PTSEARN' || $tag == 'PTSEXP') {
|
45 |
$options ['field_type'] = 'date';
|
46 |
-
}
|
47 |
-
else {
|
48 |
|
49 |
//We add a new mergevar for INT points.
|
50 |
-
if($tag == 'PTS') {
|
51 |
$options = array('field_type' => 'number');
|
52 |
$api->listMergeVarAdd($listId, "POINTS", "Points", $options);
|
53 |
|
5 |
*
|
6 |
* @author Ebizmarts Team <info@ebizmarts.com>
|
7 |
*/
|
8 |
+
class Ebizmarts_SweetMonkey_Adminhtml_MageMonkeyController extends Mage_Adminhtml_Controller_Action
|
9 |
+
{
|
10 |
|
11 |
/**
|
12 |
* Get merge vars for given list
|
13 |
*/
|
14 |
+
public function varsForListAction()
|
15 |
+
{
|
16 |
$listId = $this->getRequest()->getParam('list_id', null);
|
17 |
|
18 |
$mergeVars = array();
|
30 |
/**
|
31 |
* Add merge vars to list
|
32 |
*/
|
33 |
+
public function varsToListAction()
|
34 |
+
{
|
35 |
|
36 |
$listId = $this->getRequest()->getPost('list_id', null);
|
37 |
|
46 |
//Date for some fields, format is "MM/DD/YYYY"
|
47 |
if ($tag == 'PTSSPENT' || $tag == 'PTSEARN' || $tag == 'PTSEXP') {
|
48 |
$options ['field_type'] = 'date';
|
49 |
+
} else {
|
|
|
50 |
|
51 |
//We add a new mergevar for INT points.
|
52 |
+
if ($tag == 'PTS') {
|
53 |
$options = array('field_type' => 'number');
|
54 |
$api->listMergeVarAdd($listId, "POINTS", "Points", $options);
|
55 |
|
app/code/community/Ebizmarts/SweetMonkey/etc/adminhtml.xml
CHANGED
@@ -1,22 +1,22 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<config>
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
</config>
|
1 |
<?xml version="1.0"?>
|
2 |
<config>
|
3 |
+
<acl>
|
4 |
+
<resources>
|
5 |
+
<admin>
|
6 |
+
<children>
|
7 |
+
<system>
|
8 |
+
<children>
|
9 |
+
<config>
|
10 |
+
<children>
|
11 |
+
<sweetmonkey translate="title" module="sweetmonkey">
|
12 |
+
<title>Sweet Monkey Configuration</title>
|
13 |
+
</sweetmonkey>
|
14 |
+
</children>
|
15 |
+
</config>
|
16 |
+
</children>
|
17 |
+
</system>
|
18 |
+
</children>
|
19 |
+
</admin>
|
20 |
+
</resources>
|
21 |
+
</acl>
|
22 |
</config>
|
app/code/community/Ebizmarts/SweetMonkey/etc/config.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Ebizmarts_SweetMonkey>
|
5 |
-
|
6 |
</Ebizmarts_SweetMonkey>
|
7 |
</modules>
|
8 |
<global>
|
@@ -22,22 +22,22 @@
|
|
22 |
</sweetmonkey>
|
23 |
</helpers>
|
24 |
<events>
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
<class>sweetmonkey/observer</class>
|
29 |
<method>pointsEvent</method>
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
<class>sweetmonkey/observer</class>
|
37 |
<method>customerRewardSave</method>
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
<magemonkey_mergevars_after>
|
42 |
<observers>
|
43 |
<sweetmonkey_merge_vars>
|
@@ -47,32 +47,19 @@
|
|
47 |
</observers>
|
48 |
</magemonkey_mergevars_after>
|
49 |
</events>
|
50 |
-
|
51 |
-
<email>
|
52 |
-
<sweetmonkey_warning_email_expiry translate="label" module="sweetmonkey">
|
53 |
-
<label>Sweet Tooth - Points Expiry in 3 Days Notice </label>
|
54 |
-
<file>sweetmonkey/expiry_notice.html</file>
|
55 |
-
<type>html</type>
|
56 |
-
</sweetmonkey_warning_email_expiry>
|
57 |
-
<sweetmonkey_warning_email_points translate="label" module="sweetmonkey">
|
58 |
-
<label>Sweet Tooth - More than 500 Points Notice </label>
|
59 |
-
<file>sweetmonkey/points_notice.html</file>
|
60 |
-
<type>html</type>
|
61 |
-
</sweetmonkey_warning_email_points>
|
62 |
-
</email>
|
63 |
-
</template>
|
64 |
</global>
|
65 |
<frontend>
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
<class>sweetmonkey/observer</class>
|
71 |
<method>customerLogin</method>
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
<translate>
|
77 |
<modules>
|
78 |
<Ebizmarts_SweetMonkey>
|
@@ -85,23 +72,23 @@
|
|
85 |
</frontend>
|
86 |
<admin>
|
87 |
<routers>
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
</routers>
|
96 |
</admin>
|
97 |
<adminhtml>
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
<translate>
|
106 |
<modules>
|
107 |
<Ebizmarts_SweetMonkey>
|
@@ -111,31 +98,37 @@
|
|
111 |
</Ebizmarts_SweetMonkey>
|
112 |
</modules>
|
113 |
</translate>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
114 |
</adminhtml>
|
115 |
<default>
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
<expiry_email_identity>general</expiry_email_identity>
|
123 |
-
<points_email_template>sweetmonkey_warning_email_points</points_email_template>
|
124 |
-
<points_email_identity>general</points_email_identity>
|
125 |
-
</warning>
|
126 |
<email_points>10</email_points>
|
127 |
</general>
|
128 |
-
|
129 |
</default>
|
130 |
<crontab>
|
131 |
<jobs>
|
132 |
-
<sweetmonkey>
|
133 |
-
<schedule><cron_expr>0 0 * * *</cron_expr></schedule>
|
134 |
-
<run><model>sweetmonkey/cron::automatedEmails</model></run>
|
135 |
-
</sweetmonkey>
|
136 |
<sweetmonkey_send_vars>
|
137 |
-
<schedule
|
138 |
-
|
|
|
|
|
|
|
|
|
139 |
</sweetmonkey_send_vars>
|
140 |
</jobs>
|
141 |
</crontab>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Ebizmarts_SweetMonkey>
|
5 |
+
<version>1.1.9</version>
|
6 |
</Ebizmarts_SweetMonkey>
|
7 |
</modules>
|
8 |
<global>
|
22 |
</sweetmonkey>
|
23 |
</helpers>
|
24 |
<events>
|
25 |
+
<rewards_points_indexer_update>
|
26 |
+
<observers>
|
27 |
+
<sweetmonkey_send_vars>
|
28 |
<class>sweetmonkey/observer</class>
|
29 |
<method>pointsEvent</method>
|
30 |
+
</sweetmonkey_send_vars>
|
31 |
+
</observers>
|
32 |
+
</rewards_points_indexer_update>
|
33 |
+
<model_save_after>
|
34 |
+
<observers>
|
35 |
+
<sweetmonkey_send_vars>
|
36 |
<class>sweetmonkey/observer</class>
|
37 |
<method>customerRewardSave</method>
|
38 |
+
</sweetmonkey_send_vars>
|
39 |
+
</observers>
|
40 |
+
</model_save_after>
|
41 |
<magemonkey_mergevars_after>
|
42 |
<observers>
|
43 |
<sweetmonkey_merge_vars>
|
47 |
</observers>
|
48 |
</magemonkey_mergevars_after>
|
49 |
</events>
|
50 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
</global>
|
52 |
<frontend>
|
53 |
+
<events>
|
54 |
+
<customer_login>
|
55 |
+
<observers>
|
56 |
+
<sweetmonkey_send_vars>
|
57 |
<class>sweetmonkey/observer</class>
|
58 |
<method>customerLogin</method>
|
59 |
+
</sweetmonkey_send_vars>
|
60 |
+
</observers>
|
61 |
+
</customer_login>
|
62 |
+
</events>
|
63 |
<translate>
|
64 |
<modules>
|
65 |
<Ebizmarts_SweetMonkey>
|
72 |
</frontend>
|
73 |
<admin>
|
74 |
<routers>
|
75 |
+
<adminhtml>
|
76 |
+
<args>
|
77 |
+
<modules>
|
78 |
+
<sweetmonkey before="Mage_Adminhtml">Ebizmarts_SweetMonkey_Adminhtml</sweetmonkey>
|
79 |
+
</modules>
|
80 |
+
</args>
|
81 |
+
</adminhtml>
|
82 |
</routers>
|
83 |
</admin>
|
84 |
<adminhtml>
|
85 |
+
<layout>
|
86 |
+
<updates>
|
87 |
+
<magemonkey>
|
88 |
+
<file>magemonkey.xml</file>
|
89 |
+
</magemonkey>
|
90 |
+
</updates>
|
91 |
+
</layout>
|
92 |
<translate>
|
93 |
<modules>
|
94 |
<Ebizmarts_SweetMonkey>
|
98 |
</Ebizmarts_SweetMonkey>
|
99 |
</modules>
|
100 |
</translate>
|
101 |
+
<events>
|
102 |
+
<admin_system_config_changed_section_sweetmonkey>
|
103 |
+
<observers>
|
104 |
+
<ebizmarts_sweetmonkey_save_config>
|
105 |
+
<class>sweetmonkey/observer</class>
|
106 |
+
<method>saveConfig</method>
|
107 |
+
</ebizmarts_sweetmonkey_save_config>
|
108 |
+
</observers>
|
109 |
+
</admin_system_config_changed_section_sweetmonkey>
|
110 |
+
</events>
|
111 |
</adminhtml>
|
112 |
<default>
|
113 |
+
<sweetmonkey>
|
114 |
+
<general>
|
115 |
+
<active>0</active>
|
116 |
+
<merge_vars>
|
117 |
+
<![CDATA[a:4:{i:0;a:2:{s:8:"var_code";s:3:"PTS";s:9:"var_label";s:13:"Point Balance";}i:1;a:2:{s:8:"var_code";s:6:"PTSEXP";s:9:"var_label";s:16:"Point Expiration";}i:2;a:2:{s:8:"var_code";s:7:"PTSEARN";s:9:"var_label";s:24:"Last time earning points";}i:3;a:2:{s:8:"var_code";s:8:"PTSSPENT";s:9:"var_label";s:25:"Last time spending points";}}]]>
|
118 |
+
</merge_vars>
|
|
|
|
|
|
|
|
|
119 |
<email_points>10</email_points>
|
120 |
</general>
|
121 |
+
</sweetmonkey>
|
122 |
</default>
|
123 |
<crontab>
|
124 |
<jobs>
|
|
|
|
|
|
|
|
|
125 |
<sweetmonkey_send_vars>
|
126 |
+
<schedule>
|
127 |
+
<cron_expr>0 1 * * *</cron_expr>
|
128 |
+
</schedule>
|
129 |
+
<run>
|
130 |
+
<model>sweetmonkey/cron::pushMergeVarsForCustomers</model>
|
131 |
+
</run>
|
132 |
</sweetmonkey_send_vars>
|
133 |
</jobs>
|
134 |
</crontab>
|
app/code/community/Ebizmarts/SweetMonkey/etc/system.xml
CHANGED
@@ -70,7 +70,8 @@
|
|
70 |
<show_in_default>1</show_in_default>
|
71 |
<show_in_website>1</show_in_website>
|
72 |
<show_in_store>1</show_in_store>
|
73 |
-
<comment
|
|
|
74 |
</email_points>
|
75 |
</fields>
|
76 |
</general>
|
70 |
<show_in_default>1</show_in_default>
|
71 |
<show_in_website>1</show_in_website>
|
72 |
<show_in_store>1</show_in_store>
|
73 |
+
<comment>
|
74 |
+
<![CDATA[If you set this to 0 it will always display the point balance.]]></comment>
|
75 |
</email_points>
|
76 |
</fields>
|
77 |
</general>
|
app/design/adminhtml/default/default/layout/ebizmarts/abandonedcart.xml
CHANGED
@@ -2,30 +2,40 @@
|
|
2 |
<layout>
|
3 |
<adminhtml_abandonedorder_grid>
|
4 |
<update handle="formkey"/>
|
5 |
-
<block type="ebizmarts_abandonedcart/adminhtml_abandonedorder_grid"
|
|
|
6 |
</adminhtml_abandonedorder_grid>
|
7 |
<adminhtml_abandonedmails_grid>
|
8 |
<update handle="formkey"/>
|
9 |
-
<block type="ebizmarts_abandonedcart/adminhtml_abandonedmails_grid"
|
|
|
10 |
</adminhtml_abandonedmails_grid>
|
11 |
<adminhtml_abandonedorder_index>
|
12 |
<reference name="content">
|
13 |
-
<block type="ebizmarts_abandonedcart/adminhtml_abandonedorder"
|
|
|
14 |
</reference>
|
15 |
</adminhtml_abandonedorder_index>
|
16 |
<adminhtml_abandonedmails_index>
|
17 |
<reference name="content">
|
18 |
-
<block type="ebizmarts_abandonedcart/adminhtml_abandonedmails"
|
|
|
19 |
</reference>
|
20 |
</adminhtml_abandonedmails_index>
|
21 |
<adminhtml_abandonedorder_dashboard>
|
22 |
-
|
23 |
-
|
24 |
-
|
|
|
|
|
25 |
<reference name="content">
|
26 |
-
<block type="ebizmarts_abandonedcart/adminhtml_dashboard"
|
27 |
-
|
28 |
-
|
|
|
|
|
|
|
|
|
29 |
</block>
|
30 |
</block>
|
31 |
</reference>
|
2 |
<layout>
|
3 |
<adminhtml_abandonedorder_grid>
|
4 |
<update handle="formkey"/>
|
5 |
+
<block type="ebizmarts_abandonedcart/adminhtml_abandonedorder_grid"
|
6 |
+
name="ebizmarts_abandonedcart_abandonedorder.grid" output="toHtml"></block>
|
7 |
</adminhtml_abandonedorder_grid>
|
8 |
<adminhtml_abandonedmails_grid>
|
9 |
<update handle="formkey"/>
|
10 |
+
<block type="ebizmarts_abandonedcart/adminhtml_abandonedmails_grid"
|
11 |
+
name="ebizmarts_abandonedcart_abandonedmails.grid" output="toHtml"></block>
|
12 |
</adminhtml_abandonedmails_grid>
|
13 |
<adminhtml_abandonedorder_index>
|
14 |
<reference name="content">
|
15 |
+
<block type="ebizmarts_abandonedcart/adminhtml_abandonedorder"
|
16 |
+
name="ebizmarts_abandonedcart_abandonedorder.grid.container"></block>
|
17 |
</reference>
|
18 |
</adminhtml_abandonedorder_index>
|
19 |
<adminhtml_abandonedmails_index>
|
20 |
<reference name="content">
|
21 |
+
<block type="ebizmarts_abandonedcart/adminhtml_abandonedmails"
|
22 |
+
name="ebizmarts_abandonedcart_abandonedmails.grid.container"></block>
|
23 |
</reference>
|
24 |
</adminhtml_abandonedmails_index>
|
25 |
<adminhtml_abandonedorder_dashboard>
|
26 |
+
<reference name="head">
|
27 |
+
<action method="addCss">
|
28 |
+
<stylesheet>abandonedcart/abandonedcart.css</stylesheet>
|
29 |
+
</action>
|
30 |
+
</reference>
|
31 |
<reference name="content">
|
32 |
+
<block type="ebizmarts_abandonedcart/adminhtml_dashboard"
|
33 |
+
name="ebizmarts_abandonedcart_abandonedorder.dashboard">
|
34 |
+
<block type="adminhtml/store_switcher" name="store_switcher" as="store_switcher"
|
35 |
+
template="store/switcher.phtml">
|
36 |
+
<action method="setUseConfirm">
|
37 |
+
<params>0</params>
|
38 |
+
</action>
|
39 |
</block>
|
40 |
</block>
|
41 |
</reference>
|
app/design/adminhtml/default/default/layout/ebizmarts/mandrill.xml
CHANGED
@@ -2,7 +2,9 @@
|
|
2 |
<layout>
|
3 |
<adminhtml_system_config_edit>
|
4 |
<reference name="head">
|
5 |
-
<action method="addCss"
|
|
|
|
|
6 |
</reference>
|
7 |
</adminhtml_system_config_edit>
|
8 |
|
@@ -10,7 +12,9 @@
|
|
10 |
<reference name="content">
|
11 |
<block type="ebizmarts_mandrill/adminhtml_users_senders" name="mc_transactionalemail_mandrill">
|
12 |
<block type="adminhtml/store_switcher" name="store_switcher" as="store_switcher">
|
13 |
-
<action method="setUseConfirm"
|
|
|
|
|
14 |
</block>
|
15 |
</block>
|
16 |
</reference>
|
2 |
<layout>
|
3 |
<adminhtml_system_config_edit>
|
4 |
<reference name="head">
|
5 |
+
<action method="addCss">
|
6 |
+
<stylesheet>ebizmarts/mandrill/mandrill.css</stylesheet>
|
7 |
+
</action>
|
8 |
</reference>
|
9 |
</adminhtml_system_config_edit>
|
10 |
|
12 |
<reference name="content">
|
13 |
<block type="ebizmarts_mandrill/adminhtml_users_senders" name="mc_transactionalemail_mandrill">
|
14 |
<block type="adminhtml/store_switcher" name="store_switcher" as="store_switcher">
|
15 |
+
<action method="setUseConfirm">
|
16 |
+
<params>0</params>
|
17 |
+
</action>
|
18 |
</block>
|
19 |
</block>
|
20 |
</reference>
|
app/design/adminhtml/default/default/layout/magemonkey.xml
CHANGED
@@ -3,13 +3,13 @@
|
|
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 |
|
@@ -17,74 +17,97 @@
|
|
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"
|
|
|
|
|
21 |
</block>
|
22 |
-
|
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"
|
|
|
|
|
30 |
</block>
|
31 |
-
|
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 |
-
|
42 |
-
|
43 |
-
|
|
|
|
|
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 |
-
|
50 |
-
|
51 |
-
|
|
|
|
|
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 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
|
|
|
|
|
|
|
|
|
|
68 |
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
|
|
|
|
|
|
|
|
|
|
75 |
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
|
|
|
|
|
|
|
|
|
|
82 |
|
83 |
<adminhtml_customer_edit>
|
84 |
<reference name="customer_edit_tabs">
|
85 |
<action method="addTab">
|
86 |
-
|
87 |
-
|
88 |
</action>
|
89 |
</reference>
|
90 |
</adminhtml_customer_edit>
|
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 |
|
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">
|
21 |
+
<params>0</params>
|
22 |
+
</action>
|
23 |
</block>
|
24 |
+
</block>
|
25 |
</reference>
|
26 |
</adminhtml_transactionalemail_mandrill>
|
27 |
<adminhtml_transactionalemail_sts>
|
28 |
<reference name="content">
|
29 |
<block type="monkey/adminhtml_transactionalemail_sts" name="mc_transactionalemail_sts">
|
30 |
<block type="adminhtml/store_switcher" name="store_switcher" as="store_switcher">
|
31 |
+
<action method="setUseConfirm">
|
32 |
+
<params>0</params>
|
33 |
+
</action>
|
34 |
</block>
|
35 |
+
</block>
|
36 |
</reference>
|
37 |
</adminhtml_transactionalemail_sts>
|
38 |
<adminhtml_transactionalemail_new>
|
39 |
<reference name="content">
|
40 |
+
<block type="monkey/adminhtml_transactionalemail_newemail" name="mc_transemail_add"/>
|
41 |
</reference>
|
42 |
</adminhtml_transactionalemail_new>
|
43 |
|
44 |
<adminhtml_bulksync_export>
|
45 |
+
<reference name="head">
|
46 |
+
<action method="addCss">
|
47 |
+
<stylesheet>magemonkey/magemonkey.css</stylesheet>
|
48 |
+
</action>
|
49 |
+
</reference>
|
50 |
<reference name="content">
|
51 |
+
<block type="monkey/adminhtml_bulksync_export" name="mc_bulksyc_export"/>
|
52 |
</reference>
|
53 |
</adminhtml_bulksync_export>
|
54 |
<adminhtml_bulksync_import>
|
55 |
+
<reference name="head">
|
56 |
+
<action method="addCss">
|
57 |
+
<stylesheet>magemonkey/magemonkey.css</stylesheet>
|
58 |
+
</action>
|
59 |
+
</reference>
|
60 |
<reference name="content">
|
61 |
+
<block type="monkey/adminhtml_bulksync_import" name="mc_bulksyc_import"/>
|
62 |
</reference>
|
63 |
</adminhtml_bulksync_import>
|
64 |
<adminhtml_bulksync_queue>
|
65 |
<reference name="content">
|
66 |
+
<block type="monkey/adminhtml_bulksync_queue" name="mc_bulksyc_queue"/>
|
67 |
</reference>
|
68 |
</adminhtml_bulksync_queue>
|
69 |
|
70 |
+
<adminhtml_system_config_edit>
|
71 |
+
<reference name="head">
|
72 |
+
<action method="addCss">
|
73 |
+
<stylesheet>magemonkey/magemonkey.css</stylesheet>
|
74 |
+
</action>
|
75 |
+
<action method="addItem">
|
76 |
+
<type>skin_js</type>
|
77 |
+
<name>magemonkey/magemonkey.js</name>
|
78 |
+
</action>
|
79 |
+
</reference>
|
80 |
+
</adminhtml_system_config_edit>
|
81 |
|
82 |
+
<magemonkey_adminhtml_ctemplate_edit>
|
83 |
+
<reference name="head">
|
84 |
+
<action method="addCss">
|
85 |
+
<stylesheet>magemonkey/magemonkey.css</stylesheet>
|
86 |
+
</action>
|
87 |
+
<action method="addItem">
|
88 |
+
<type>skin_js</type>
|
89 |
+
<name>magemonkey/magemonkey.js</name>
|
90 |
+
</action>
|
91 |
+
</reference>
|
92 |
+
</magemonkey_adminhtml_ctemplate_edit>
|
93 |
|
94 |
+
<magemonkey_adminhtml_ctemplate_new>
|
95 |
+
<reference name="head">
|
96 |
+
<action method="addCss">
|
97 |
+
<stylesheet>magemonkey/magemonkey.css</stylesheet>
|
98 |
+
</action>
|
99 |
+
<action method="addItem">
|
100 |
+
<type>skin_js</type>
|
101 |
+
<name>magemonkey/magemonkey.js</name>
|
102 |
+
</action>
|
103 |
+
</reference>
|
104 |
+
</magemonkey_adminhtml_ctemplate_new>
|
105 |
|
106 |
<adminhtml_customer_edit>
|
107 |
<reference name="customer_edit_tabs">
|
108 |
<action method="addTab">
|
109 |
+
<name>customer_edit_tab_monkey_memberactivity</name>
|
110 |
+
<block>monkey/adminhtml_customer_edit_tab_memberactivity</block>
|
111 |
</action>
|
112 |
</reference>
|
113 |
</adminhtml_customer_edit>
|
app/design/adminhtml/default/default/template/ebizmarts/abandonedcart/dashboard/index.phtml
CHANGED
@@ -5,7 +5,7 @@
|
|
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()) {
|
@@ -13,7 +13,7 @@
|
|
13 |
if (response.error) {
|
14 |
alert(response.message);
|
15 |
}
|
16 |
-
if(response.ajaxExpired && response.ajaxRedirect) {
|
17 |
setLocation(response.ajaxRedirect);
|
18 |
}
|
19 |
} else {
|
@@ -28,14 +28,13 @@
|
|
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>
|
@@ -57,11 +56,13 @@
|
|
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
|
61 |
-
|
62 |
-
|
|
|
63 |
<?php endforeach; ?>
|
64 |
-
</select></p
|
|
|
65 |
</p>
|
66 |
<?php echo $this->getChildHtml('totals') ?>
|
67 |
</div>
|
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()) {
|
13 |
if (response.error) {
|
14 |
alert(response.message);
|
15 |
}
|
16 |
+
if (response.ajaxExpired && response.ajaxRedirect) {
|
17 |
setLocation(response.ajaxRedirect);
|
18 |
}
|
19 |
} else {
|
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 |
<div class="content-header">
|
39 |
<table cellspacing="0">
|
40 |
<tr>
|
56 |
<p class="switcher a-right" style="padding: 5px 10px;">
|
57 |
Select a range:
|
58 |
<select name="period" id="order__period" onchange="changeDiagramsPeriod(this);">
|
59 |
+
<?php foreach ($this->helper('ebizmarts_abandonedcart')->getDatePeriods() as $_value => $_label): ?>
|
60 |
+
<?php if (in_array($_value, array('custom'))) continue; ?>
|
61 |
+
<option
|
62 |
+
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>
|
65 |
+
<br/>
|
66 |
</p>
|
67 |
<?php echo $this->getChildHtml('totals') ?>
|
68 |
</div>
|
app/design/adminhtml/default/default/template/ebizmarts/abandonedcart/dashboard/salebar.phtml
CHANGED
@@ -1,10 +1,11 @@
|
|
1 |
-
<?php if(
|
2 |
-
<?php foreach(
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
|
|
9 |
<?php endforeach; ?>
|
10 |
<?php endif; ?>
|
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
|
7 |
+
style="font-size:14px; color:#686868;"><?php echo $_total['decimals'] ?></span></span>
|
8 |
+
</fieldset>
|
9 |
+
</div>
|
10 |
<?php endforeach; ?>
|
11 |
<?php endif; ?>
|
app/design/adminhtml/default/default/template/ebizmarts/abandonedcart/dashboard/totalbar.phtml
CHANGED
@@ -1,46 +1,58 @@
|
|
1 |
-
<?php if(
|
2 |
-
<?php
|
3 |
$last = '';
|
4 |
$total = array();
|
5 |
-
foreach($this->getTotals() as $_total):
|
6 |
-
$words = explode(' '
|
7 |
$total[$words[0]][] = $_total;
|
8 |
endforeach;
|
9 |
-
|
10 |
-
<div class="box" id="dashboard_diagram_totals">
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
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(version_compare(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('ebizmarts_mandrill')->useTransactionalService()): ?>
|
39 |
<div class="warning-msg">
|
40 |
-
You may obtain more statistics if
|
|
|
|
|
|
|
|
|
|
|
41 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
<?php endif; ?>
|
43 |
<?php endif; ?>
|
44 |
-
|
45 |
-
</div>
|
46 |
<?php endif; ?>
|
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"
|
20 |
+
style="font-size:18px; color:#EA7601;"><?php echo $_total['value'] ?><span
|
21 |
+
style="font-size:14px; color:#DE8946;"><?php echo $_total['decimals'] ?></span></span>
|
22 |
+
</td>
|
23 |
+
<?php endforeach; ?>
|
24 |
+
</tr>
|
25 |
+
</table>
|
26 |
+
</div>
|
27 |
+
<?php endforeach; ?>
|
28 |
+
<?php if (!Mage::helper('core')->isModuleEnabled('Ebizmarts_Mandrill')): ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
<div class="warning-msg">
|
30 |
+
You may obtain more statistics if you install <a class="action-link"
|
31 |
+
href="http://www.magentocommerce.com/magento-connect/mage-monkey-mailchimp-integration-4865.html"
|
32 |
+
target="_blank">Ebizmarts_Magemonkey</a>
|
33 |
+
extension and configure <a class="action-link-holder"
|
34 |
+
href="http://mandrill.com/signup/?pid=ebizmart&source=website"
|
35 |
+
target="_blank">Mandrill</a> is free
|
36 |
</div>
|
37 |
+
<?php else: ?>
|
38 |
+
<?php if (version_compare(Mage::getConfig()->getNode()->modules->Ebizmarts_Mandrill->version, '1.0.5', '<')): ?>
|
39 |
+
<div class="warning-msg">
|
40 |
+
You may obtain more statistics if you upgrade your <a class="action-link"
|
41 |
+
href="http://www.magentocommerce.com/magento-connect/mage-monkey-mailchimp-integration-4865.html"
|
42 |
+
target="_blank">Ebizmarts_Magemonkey</a>
|
43 |
+
extension to 1.0.5 or up and configure <a class="action-link-holder"
|
44 |
+
href="http://mandrill.com/signup/?pid=ebizmart&source=website"
|
45 |
+
target="_blank">Mandrill</a> is free
|
46 |
+
</div>
|
47 |
+
<?php else: ?>
|
48 |
+
<?php if (!Mage::helper('ebizmarts_mandrill')->useTransactionalService()): ?>
|
49 |
+
<div class="warning-msg">
|
50 |
+
You may obtain more statistics if enable and configure <a class="action-link-holder"
|
51 |
+
href="<?php echo Mage::helper("adminhtml")->getUrl("adminhtml/system_config/edit/section/mandrill"); ?>">Mandrill</a>
|
52 |
+
extension
|
53 |
+
</div>
|
54 |
+
<?php endif; ?>
|
55 |
<?php endif; ?>
|
56 |
<?php endif; ?>
|
57 |
+
</div>
|
|
|
58 |
<?php endif; ?>
|
app/design/adminhtml/default/default/template/ebizmarts/abandonedcart/system/config/fieldset/hint.phtml
CHANGED
@@ -1,10 +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(); ?>"
|
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()
|
5 |
-
<?php if(!Mage::helper('ebizmarts_mandrill')->useTransactionalService()): ?>
|
6 |
<div class="box error-msg" style="padding-left: 30px;">
|
7 |
-
You must setup <a class="action-link-holder"
|
|
|
|
|
8 |
</div>
|
9 |
<?php endif; ?>
|
10 |
</h4>
|
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 |
+
<?php if (!Mage::helper('ebizmarts_mandrill')->useTransactionalService()): ?>
|
6 |
<div class="box error-msg" style="padding-left: 30px;">
|
7 |
+
You must setup <a class="action-link-holder"
|
8 |
+
href="<?php echo Mage::helper("adminhtml")->getUrl("adminhtml/system_config/edit/section/mandrill"); ?>">Mandrill</a>
|
9 |
+
extension to use this extension
|
10 |
</div>
|
11 |
<?php endif; ?>
|
12 |
</h4>
|
app/design/adminhtml/default/default/template/ebizmarts/autoresponder/system/config/backtostock/fieldset/hint.phtml
CHANGED
@@ -1,6 +1,8 @@
|
|
1 |
-
<?php if(!Mage::getStoreConfig('cataloginventory/options/show_out_of_stock')) : ?>
|
2 |
<div class="box error-msg" style="padding-left:30px;">
|
3 |
-
<a href="<?php echo Mage::helper('adminhtml')->getUrl('/system_config/edit',array('section'=>'cataloginventory')); ?>">Manage
|
4 |
-
|
|
|
|
|
5 |
</div>
|
6 |
<?php endif; ?>
|
1 |
+
<?php if (!Mage::getStoreConfig('cataloginventory/options/show_out_of_stock')) : ?>
|
2 |
<div class="box error-msg" style="padding-left:30px;">
|
3 |
+
<a href="<?php echo Mage::helper('adminhtml')->getUrl('/system_config/edit', array('section' => 'cataloginventory')); ?>">Manage
|
4 |
+
your Catalog Inventory options</a>.<br/>
|
5 |
+
You must activate "Display Out of Stock Products" in System->Configuration->Catalog->Inventory->Stock
|
6 |
+
Options->Display Out of Stock Products
|
7 |
</div>
|
8 |
<?php endif; ?>
|
app/design/adminhtml/default/default/template/ebizmarts/autoresponder/system/config/birthday/fieldset/hint.phtml
CHANGED
@@ -1,5 +1,6 @@
|
|
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
|
|
|
4 |
</div>
|
5 |
<?php endif; ?>
|
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
|
4 |
+
to use this facility
|
5 |
</div>
|
6 |
<?php endif; ?>
|
app/design/adminhtml/default/default/template/ebizmarts/autoresponder/system/config/fieldset/hint.phtml
CHANGED
@@ -1,11 +1,13 @@
|
|
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(); ?>"
|
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()
|
5 |
|
6 |
-
<?php if(!Mage::helper('ebizmarts_mandrill')->useTransactionalService()): ?>
|
7 |
<div class="box error-msg" style="padding-left: 30px;">
|
8 |
-
You must setup <a class="action-link-holder"
|
|
|
|
|
9 |
</div>
|
10 |
<?php endif; ?>
|
11 |
</h4>
|
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('ebizmarts_mandrill')->useTransactionalService()): ?>
|
7 |
<div class="box error-msg" style="padding-left: 30px;">
|
8 |
+
You must setup <a class="action-link-holder"
|
9 |
+
href="<?php echo Mage::helper("adminhtml")->getUrl("adminhtml/system_config/edit/section/mandrill"); ?>">Mandrill</a>
|
10 |
+
extension to use this extension
|
11 |
</div>
|
12 |
<?php endif; ?>
|
13 |
</h4>
|
app/design/adminhtml/default/default/template/ebizmarts/autoresponder/system/config/review/fieldset/hint.phtml
CHANGED
@@ -1,5 +1,6 @@
|
|
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
|
|
|
4 |
</div>
|
5 |
<?php endif; ?>
|
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
|
4 |
+
Module output to use this feature
|
5 |
</div>
|
6 |
<?php endif; ?>
|
app/design/adminhtml/default/default/template/ebizmarts/autoresponder/system/config/wishlist/fieldset/hint.phtml
CHANGED
@@ -1,5 +1,6 @@
|
|
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
|
|
|
4 |
</div>
|
5 |
<?php endif; ?>
|
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
|
4 |
+
Module output to use this feature
|
5 |
</div>
|
6 |
<?php endif; ?>
|
app/design/adminhtml/default/default/template/ebizmarts/mandrill/system/config/fieldset/hint.phtml
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
<div class="mandrill-notice">
|
2 |
-
<img src="https://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>
|
1 |
<div class="mandrill-notice">
|
2 |
+
<img src="https://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>
|
app/design/adminhtml/default/default/template/magemonkey/system/config/fieldset/hint.phtml
CHANGED
@@ -4,10 +4,10 @@
|
|
4 |
*/
|
5 |
?>
|
6 |
<div class="magemonkey-notice">
|
7 |
-
<img src="https://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>
|
4 |
*/
|
5 |
?>
|
6 |
<div class="magemonkey-notice">
|
7 |
+
<img src="https://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>
|
app/design/adminhtml/default/default/template/magemonkey/system/config/oauth_wizard.phtml
CHANGED
@@ -6,7 +6,9 @@
|
|
6 |
<table>
|
7 |
<tr>
|
8 |
<td>
|
9 |
-
<button style=""
|
|
|
|
|
10 |
<span><?php echo $this->escapeHtml($this->getButtonLabel()); ?></span>
|
11 |
</button>
|
12 |
</td>
|
6 |
<table>
|
7 |
<tr>
|
8 |
<td>
|
9 |
+
<button style=""
|
10 |
+
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;"
|
11 |
+
class="scalable" type="button" id="<?php echo $this->getHtmlId() ?>">
|
12 |
<span><?php echo $this->escapeHtml($this->getButtonLabel()); ?></span>
|
13 |
</button>
|
14 |
</td>
|
app/design/adminhtml/default/default/template/magemonkey/system/config/resetlocal360.phtml
CHANGED
@@ -2,10 +2,10 @@
|
|
2 |
//<![CDATA[
|
3 |
function check() {
|
4 |
new Ajax.Request('<?php echo $this->getAjaxCheckUrl() ?>', {
|
5 |
-
method:
|
6 |
-
onSuccess: function(transport){
|
7 |
|
8 |
-
if (transport.responseText == 1){
|
9 |
alert('All local orders for Ecommerce360 were deleted');
|
10 |
}
|
11 |
else {
|
@@ -16,30 +16,29 @@
|
|
16 |
}
|
17 |
function reloadGroups(evt) {
|
18 |
var $list = $('monkey_general_list').getValue();
|
19 |
-
var $url = "<?php echo Mage::helper('adminhtml')->getUrl('adminhtml/config/getGroups'); ?>"+"list/"
|
20 |
new Ajax.Request($url, {
|
21 |
method: 'get',
|
22 |
onSuccess: function (transport) {
|
23 |
$el = $('monkey_general_cutomergroup');
|
24 |
-
while($el.firstChild) {
|
25 |
$el.removeChild($el.firstChild);
|
26 |
}
|
27 |
-
if(transport.responseJSON.length==0) {
|
28 |
opt = document.createElement('option');
|
29 |
opt.text = '--- No data ---';
|
30 |
opt.value = -1;
|
31 |
$el.options.add(opt);
|
32 |
}
|
33 |
else {
|
34 |
-
transport.responseJSON.each(function(i) {
|
35 |
opt = document.createElement('option');
|
36 |
opt.text = i.label;
|
37 |
opt.value = i.value;
|
38 |
-
if(i.style) {
|
39 |
opt.style = i.style;
|
40 |
}
|
41 |
-
if(i.disabled)
|
42 |
-
{
|
43 |
opt.disabled = 1;
|
44 |
}
|
45 |
opt.selected = i.selected;
|
@@ -50,10 +49,10 @@
|
|
50 |
}
|
51 |
});
|
52 |
}
|
53 |
-
document.observe("dom:loaded", function() {
|
54 |
-
if($('monkey_general_list')) {
|
55 |
-
Element.observe('monkey_general_list','change',reloadGroups);
|
56 |
-
Element.observe(window,'load',reloadGroups);
|
57 |
}
|
58 |
});
|
59 |
//]]>
|
2 |
//<![CDATA[
|
3 |
function check() {
|
4 |
new Ajax.Request('<?php echo $this->getAjaxCheckUrl() ?>', {
|
5 |
+
method: 'get',
|
6 |
+
onSuccess: function (transport) {
|
7 |
|
8 |
+
if (transport.responseText == 1) {
|
9 |
alert('All local orders for Ecommerce360 were deleted');
|
10 |
}
|
11 |
else {
|
16 |
}
|
17 |
function reloadGroups(evt) {
|
18 |
var $list = $('monkey_general_list').getValue();
|
19 |
+
var $url = "<?php echo Mage::helper('adminhtml')->getUrl('adminhtml/config/getGroups'); ?>" + "list/" + $list;
|
20 |
new Ajax.Request($url, {
|
21 |
method: 'get',
|
22 |
onSuccess: function (transport) {
|
23 |
$el = $('monkey_general_cutomergroup');
|
24 |
+
while ($el.firstChild) {
|
25 |
$el.removeChild($el.firstChild);
|
26 |
}
|
27 |
+
if (transport.responseJSON.length == 0) {
|
28 |
opt = document.createElement('option');
|
29 |
opt.text = '--- No data ---';
|
30 |
opt.value = -1;
|
31 |
$el.options.add(opt);
|
32 |
}
|
33 |
else {
|
34 |
+
transport.responseJSON.each(function (i) {
|
35 |
opt = document.createElement('option');
|
36 |
opt.text = i.label;
|
37 |
opt.value = i.value;
|
38 |
+
if (i.style) {
|
39 |
opt.style = i.style;
|
40 |
}
|
41 |
+
if (i.disabled) {
|
|
|
42 |
opt.disabled = 1;
|
43 |
}
|
44 |
opt.selected = i.selected;
|
49 |
}
|
50 |
});
|
51 |
}
|
52 |
+
document.observe("dom:loaded", function () {
|
53 |
+
if ($('monkey_general_list')) {
|
54 |
+
Element.observe('monkey_general_list', 'change', reloadGroups);
|
55 |
+
Element.observe(window, 'load', reloadGroups);
|
56 |
}
|
57 |
});
|
58 |
//]]>
|
app/design/adminhtml/default/default/template/magemonkey/system/config/resetremote360.phtml
CHANGED
@@ -2,10 +2,10 @@
|
|
2 |
//<![CDATA[
|
3 |
function check2() {
|
4 |
new Ajax.Request('<?php echo $this->getAjaxCheckUrl() ?>', {
|
5 |
-
method:
|
6 |
-
onSuccess: function(transport){
|
7 |
|
8 |
-
if (transport.responseText == 1){
|
9 |
alert('All remote orders for Ecommerce360 were deleted')
|
10 |
}
|
11 |
else {
|
2 |
//<![CDATA[
|
3 |
function check2() {
|
4 |
new Ajax.Request('<?php echo $this->getAjaxCheckUrl() ?>', {
|
5 |
+
method: 'get',
|
6 |
+
onSuccess: function (transport) {
|
7 |
|
8 |
+
if (transport.responseText == 1) {
|
9 |
alert('All remote orders for Ecommerce360 were deleted')
|
10 |
}
|
11 |
else {
|
app/design/adminhtml/default/default/template/sweetmonkey/system/config/autovars.phtml
CHANGED
@@ -6,15 +6,17 @@
|
|
6 |
<table>
|
7 |
<tr>
|
8 |
<td>
|
9 |
-
<button onclick="createVars(); return false;" class="scalable" type="button"
|
|
|
10 |
<span><?php echo $this->escapeHtml($this->getButtonLabel()); ?></span>
|
11 |
</button>
|
12 |
</td>
|
13 |
<td>
|
14 |
-
<button onclick="showVars(); return false;" class="scalable" type="button"
|
|
|
15 |
<span><?php echo $this->escapeHtml($this->getSndButtonLabel()); ?></span>
|
16 |
</button>
|
17 |
-
</td>
|
18 |
</tr>
|
19 |
<tr>
|
20 |
<td colspan="2" id="varscontainer"> </td>
|
@@ -22,57 +24,60 @@
|
|
22 |
</table>
|
23 |
|
24 |
<script type="text/javascript">
|
25 |
-
|
26 |
showVars = function () {
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
}
|
50 |
-
|
51 |
createVars = function () {
|
52 |
-
|
53 |
-
if(!confirm("<?php echo $this->__('Are you sure?'); ?>")){
|
54 |
return;
|
55 |
}
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
for(i=0;i<varsInput.length;i+=2){
|
61 |
-
varsparams.set(varsInput[i].getValue(), varsInput[i+1].getValue());
|
62 |
-
}
|
63 |
-
|
64 |
-
new Ajax.Request('<?php echo Mage::helper('adminhtml')->getUrl('adminhtml/mageMonkey/varsToList'); ?>', {
|
65 |
-
method: 'post',
|
66 |
-
parameters: { "list_id":$('sweetmonkey_general_lists').getValue(), "merge_vars":varsparams.toQueryString() },
|
67 |
-
onComplete: function(response) {
|
68 |
-
if (200 == response.status){
|
69 |
-
showVars();
|
70 |
-
}
|
71 |
-
},
|
72 |
-
onLoading: function(){
|
73 |
-
$('varscontainer').update('...');
|
74 |
}
|
75 |
-
|
76 |
-
|
77 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
</script>
|
6 |
<table>
|
7 |
<tr>
|
8 |
<td>
|
9 |
+
<button onclick="createVars(); return false;" class="scalable" type="button"
|
10 |
+
id="<?php echo $this->getHtmlId() ?>">
|
11 |
<span><?php echo $this->escapeHtml($this->getButtonLabel()); ?></span>
|
12 |
</button>
|
13 |
</td>
|
14 |
<td>
|
15 |
+
<button onclick="showVars(); return false;" class="scalable" type="button"
|
16 |
+
id="<?php echo $this->getSndHtmlId() ?>">
|
17 |
<span><?php echo $this->escapeHtml($this->getSndButtonLabel()); ?></span>
|
18 |
</button>
|
19 |
+
</td>
|
20 |
</tr>
|
21 |
<tr>
|
22 |
<td colspan="2" id="varscontainer"> </td>
|
24 |
</table>
|
25 |
|
26 |
<script type="text/javascript">
|
27 |
+
|
28 |
showVars = function () {
|
29 |
+
|
30 |
+
var html = new Element('ul');
|
31 |
+
var myTemplate = new Template('<li>#{name} <strong>#{tag}</strong></li>');
|
32 |
+
|
33 |
+
new Ajax.Request('<?php echo Mage::helper('adminhtml')->getUrl('adminhtml/mageMonkey/varsForList'); ?>', {
|
34 |
+
parameters: {"list_id": $('sweetmonkey_general_lists').getValue()},
|
35 |
+
onComplete: function (response) {
|
36 |
+
if (200 == response.status) {
|
37 |
+
var data = response.responseText.evalJSON();
|
38 |
+
var lis = '';
|
39 |
+
data.each(function (merge_var) {
|
40 |
+
lis += myTemplate.evaluate(merge_var);
|
41 |
+
});
|
42 |
+
|
43 |
+
html.update(lis);
|
44 |
+
$('varscontainer').update(html);
|
45 |
+
}
|
46 |
+
},
|
47 |
+
onLoading: function () {
|
48 |
+
$('varscontainer').update('...');
|
49 |
+
}
|
50 |
+
});
|
51 |
}
|
52 |
+
|
53 |
createVars = function () {
|
54 |
+
|
55 |
+
if (!confirm("<?php echo $this->__('Are you sure?'); ?>")) {
|
56 |
return;
|
57 |
}
|
58 |
+
|
59 |
+
var varsparams = $H({});
|
60 |
+
|
61 |
+
var varsInput = $$('tr#row_sweetmonkey_general_merge_vars input[type=text]');
|
62 |
+
for (i = 0; i < varsInput.length; i += 2) {
|
63 |
+
varsparams.set(varsInput[i].getValue(), varsInput[i + 1].getValue());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
}
|
65 |
+
|
66 |
+
new Ajax.Request('<?php echo Mage::helper('adminhtml')->getUrl('adminhtml/mageMonkey/varsToList'); ?>', {
|
67 |
+
method: 'post',
|
68 |
+
parameters: {
|
69 |
+
"list_id": $('sweetmonkey_general_lists').getValue(),
|
70 |
+
"merge_vars": varsparams.toQueryString()
|
71 |
+
},
|
72 |
+
onComplete: function (response) {
|
73 |
+
if (200 == response.status) {
|
74 |
+
showVars();
|
75 |
+
}
|
76 |
+
},
|
77 |
+
onLoading: function () {
|
78 |
+
$('varscontainer').update('...');
|
79 |
+
}
|
80 |
+
});
|
81 |
+
}
|
82 |
+
|
83 |
</script>
|
app/design/adminhtml/default/default/template/sweetmonkey/system/config/fieldset/hint.phtml
CHANGED
@@ -4,8 +4,8 @@
|
|
4 |
*/
|
5 |
?>
|
6 |
<div class="sweetmonkey-notice">
|
7 |
-
|
8 |
<h4>
|
9 |
-
<?php echo $this->__('<strong style="color:#EA7601;">Sweet Monkey v%s by</strong> <a target="_blank" href="http://ebizmarts.com"><strong>ebizmarts</strong></a>', $this->getSweetMonkeyVersion())?>
|
10 |
</h4>
|
11 |
</div>
|
4 |
*/
|
5 |
?>
|
6 |
<div class="sweetmonkey-notice">
|
7 |
+
<img src="http://ebizmarts.com/extension-logo.php?<?php echo $this->getPxParams(); ?>"/>
|
8 |
<h4>
|
9 |
+
<?php echo $this->__('<strong style="color:#EA7601;">Sweet Monkey v%s by</strong> <a target="_blank" href="http://ebizmarts.com"><strong>ebizmarts</strong></a>', $this->getSweetMonkeyVersion()) ?>
|
10 |
</h4>
|
11 |
</div>
|
app/design/frontend/base/default/layout/ebizmarts/abandonedcart.xml
CHANGED
@@ -2,22 +2,42 @@
|
|
2 |
|
3 |
<layout version="0.1.0">
|
4 |
<ebizmarts_abandonedcart_email_order_items>
|
5 |
-
<block type="ebizmarts_abandonedcart/email_order_items" name="items"
|
6 |
-
|
7 |
-
<action method="addItemRender"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
</block>
|
9 |
-
<block type="core/text_list" name="additional.product.info"
|
10 |
</ebizmarts_abandonedcart_email_order_items>
|
11 |
|
12 |
<default>
|
13 |
<reference name="head">
|
14 |
-
<action method="addJs" ifconfig="ebizmarts_abandonedcart/emailcatcher/popup_general"
|
15 |
-
|
16 |
-
|
17 |
-
<action method="
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
</reference>
|
19 |
<reference name="content">
|
20 |
-
<block type="ebizmarts_abandonedcart/popup_emailcatcher" name="emailcatcher"
|
|
|
21 |
</reference>
|
22 |
</default>
|
23 |
</layout>
|
2 |
|
3 |
<layout version="0.1.0">
|
4 |
<ebizmarts_abandonedcart_email_order_items>
|
5 |
+
<block type="ebizmarts_abandonedcart/email_order_items" name="items"
|
6 |
+
template="ebizmarts/abandonedcart/email/order/items.phtml">
|
7 |
+
<action method="addItemRender">
|
8 |
+
<type>default</type>
|
9 |
+
<block>ebizmarts_abandonedcart/email_order_items_order_default</block>
|
10 |
+
<template>ebizmarts/abandonedcart/email/order/items/order/default.phtml</template>
|
11 |
+
</action>
|
12 |
+
<action method="addItemRender">
|
13 |
+
<type>grouped</type>
|
14 |
+
<block>ebizmarts_abandonedcart/email_order_items_order_grouped</block>
|
15 |
+
<template>ebizmarts/abandonedcart/email/order/items/order/default.phtml</template>
|
16 |
+
</action>
|
17 |
</block>
|
18 |
+
<block type="core/text_list" name="additional.product.info"/>
|
19 |
</ebizmarts_abandonedcart_email_order_items>
|
20 |
|
21 |
<default>
|
22 |
<reference name="head">
|
23 |
+
<action method="addJs" ifconfig="ebizmarts_abandonedcart/emailcatcher/popup_general">
|
24 |
+
<script>prototype/window.js</script>
|
25 |
+
</action>
|
26 |
+
<action method="addJs" ifconfig="ebizmarts_abandonedcart/emailcatcher/popup_general">
|
27 |
+
<script>scriptaculous/scriptaculous.js</script>
|
28 |
+
</action>
|
29 |
+
<action method="addItem" ifconfig="ebizmarts_abandonedcart/emailcatcher/popup_general">
|
30 |
+
<type>js_css</type>
|
31 |
+
<script>prototype/windows/themes/default.css</script>
|
32 |
+
</action>
|
33 |
+
<action method="addItem" ifconfig="ebizmarts_abandonedcart/emailcatcher/popup_general">
|
34 |
+
<type>js_css</type>
|
35 |
+
<script>ebizmarts/abandonedcart/popup.css</script>
|
36 |
+
</action>
|
37 |
</reference>
|
38 |
<reference name="content">
|
39 |
+
<block type="ebizmarts_abandonedcart/popup_emailcatcher" name="emailcatcher"
|
40 |
+
template="ebizmarts_abandonedcart/popup/emailcatcher.phtml"></block>
|
41 |
</reference>
|
42 |
</default>
|
43 |
</layout>
|
app/design/frontend/base/default/layout/ebizmarts/autoresponder.xml
CHANGED
@@ -2,10 +2,13 @@
|
|
2 |
<layout version="0.1.0">
|
3 |
<ebizmarts_autoresponder_autoresponder_unsubscribe>
|
4 |
<reference name="root">
|
5 |
-
<action method="setTemplate"
|
|
|
|
|
6 |
</reference>
|
7 |
<reference name="content">
|
8 |
-
<block type="ebizmarts_autoresponder/unsubscribe" name="ebizmarts_autoresponder_unsubscribe"
|
|
|
9 |
</reference>
|
10 |
</ebizmarts_autoresponder_autoresponder_unsubscribe>
|
11 |
|
@@ -13,14 +16,17 @@
|
|
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"
|
17 |
-
|
|
|
|
|
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"
|
|
|
24 |
<name>autoresponderlists</name>
|
25 |
<path>ebizautoresponder/autoresponder/index</path>
|
26 |
<label>Autoresponder lists</label>
|
@@ -29,7 +35,9 @@
|
|
29 |
</customer_account>
|
30 |
<catalog_product_view>
|
31 |
<reference name="head">
|
32 |
-
<action method="addJs" module="ebizmarts_autoresponder"
|
|
|
|
|
33 |
</reference>
|
34 |
</catalog_product_view>
|
35 |
<!--review_product_list>
|
@@ -48,8 +56,10 @@
|
|
48 |
|
49 |
<review_product_list>
|
50 |
<reference name="product.info.product_additional_data">
|
51 |
-
<block type="ebizmarts_autoresponder/review_form" name="product.review.form.autoresponder"
|
52 |
-
|
|
|
|
|
53 |
<label>Review Form Fields Before</label>
|
54 |
<action method="setMayBeInvisible">
|
55 |
<value>1</value>
|
@@ -61,15 +71,21 @@
|
|
61 |
</review_product_list-->
|
62 |
|
63 |
<catalog_product_view>
|
64 |
-
<block type="ebizmarts_autoresponder/backtostock_notice" name="backtostock.notice" as="backtostock_notice"
|
65 |
-
|
|
|
|
|
66 |
<reference name="content">
|
67 |
<reference name="product.info">
|
68 |
<reference name="alert.urls">
|
69 |
-
<action method="append" ifconfig="ebizmarts_autoresponder/general/active"
|
|
|
|
|
70 |
</reference>
|
71 |
</reference>
|
72 |
-
<action method="append"
|
|
|
|
|
73 |
</reference>
|
74 |
<depends>
|
75 |
<ifconfig>ebizmarts_autoresponder/backtostock/active</ifconfig>
|
2 |
<layout version="0.1.0">
|
3 |
<ebizmarts_autoresponder_autoresponder_unsubscribe>
|
4 |
<reference name="root">
|
5 |
+
<action method="setTemplate">
|
6 |
+
<template>page/2columns-right.phtml</template>
|
7 |
+
</action>
|
8 |
</reference>
|
9 |
<reference name="content">
|
10 |
+
<block type="ebizmarts_autoresponder/unsubscribe" name="ebizmarts_autoresponder_unsubscribe"
|
11 |
+
template="ebizmarts/autoresponder/unsubscribe.phtml"/>
|
12 |
</reference>
|
13 |
</ebizmarts_autoresponder_autoresponder_unsubscribe>
|
14 |
|
16 |
<label>Customer My Account Autoresponder lists</label>
|
17 |
<update handle="customer_account"/>
|
18 |
<reference name="my.account.wrapper">
|
19 |
+
<block type="ebizmarts_autoresponder/customer_account_list" name="autoresponderlists"
|
20 |
+
template="ebizmarts/autoresponder/customer/list.phtml"/>
|
21 |
+
<block type="customer/account_dashboard" name="customer.account.link.back"
|
22 |
+
template="customer/account/link/back.phtml"/>
|
23 |
</reference>
|
24 |
</ebizmarts_autoresponder_autoresponder_index>
|
25 |
|
26 |
<customer_account>
|
27 |
<reference name="customer_account_navigation">
|
28 |
+
<action method="addLink" ifconfig="ebizmarts_autoresponder/general/active" translate="label"
|
29 |
+
module="ebizmarts_autoresponder">
|
30 |
<name>autoresponderlists</name>
|
31 |
<path>ebizautoresponder/autoresponder/index</path>
|
32 |
<label>Autoresponder lists</label>
|
35 |
</customer_account>
|
36 |
<catalog_product_view>
|
37 |
<reference name="head">
|
38 |
+
<action method="addJs" module="ebizmarts_autoresponder">
|
39 |
+
<script helper="ebizmarts_autoresponder/getCanShowJs"></script>
|
40 |
+
</action>
|
41 |
</reference>
|
42 |
</catalog_product_view>
|
43 |
<!--review_product_list>
|
56 |
|
57 |
<review_product_list>
|
58 |
<reference name="product.info.product_additional_data">
|
59 |
+
<block type="ebizmarts_autoresponder/review_form" name="product.review.form.autoresponder"
|
60 |
+
as="review_form"/>
|
61 |
+
<block type="page/html_wrapper" name="product.review.form.fields.before" as="form_fields_before"
|
62 |
+
translate="label"/>
|
63 |
<label>Review Form Fields Before</label>
|
64 |
<action method="setMayBeInvisible">
|
65 |
<value>1</value>
|
71 |
</review_product_list-->
|
72 |
|
73 |
<catalog_product_view>
|
74 |
+
<block type="ebizmarts_autoresponder/backtostock_notice" name="backtostock.notice" as="backtostock_notice"
|
75 |
+
template="ebizmarts/autoresponder/backtostock/catalog/product/notice.phtml"/>
|
76 |
+
<block type="ebizmarts_autoresponder/backtostock_notice" name="backtostock.form" as="backtostock_form"
|
77 |
+
template="ebizmarts/autoresponder/backtostock/catalog/product/form.phtml"/>
|
78 |
<reference name="content">
|
79 |
<reference name="product.info">
|
80 |
<reference name="alert.urls">
|
81 |
+
<action method="append" ifconfig="ebizmarts_autoresponder/general/active">
|
82 |
+
<block>backtostock.notice</block>
|
83 |
+
</action>
|
84 |
</reference>
|
85 |
</reference>
|
86 |
+
<action method="append" ifconfig="ebizmarts_autoresponder/general/active">
|
87 |
+
<block>backtostock.form</block>
|
88 |
+
</action>
|
89 |
</reference>
|
90 |
<depends>
|
91 |
<ifconfig>ebizmarts_autoresponder/backtostock/active</ifconfig>
|
app/design/frontend/base/default/layout/magemonkey.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
<layout version="0.1.0">
|
4 |
|
5 |
-
|
6 |
<default>
|
7 |
<reference name="footer">
|
8 |
<block type="monkey/signup" name="left.monkeysignup" template="magemonkey/lists.phtml"/>
|
@@ -10,46 +10,57 @@
|
|
10 |
</default>
|
11 |
EXAMPLE Layout directive on how you can include template Monkey Multiple Signup -->
|
12 |
|
13 |
-
|
14 |
-
|
15 |
<reference name="checkout.onepage.review.info.items.after">
|
16 |
-
|
17 |
-
|
18 |
-
|
|
|
19 |
</reference>
|
20 |
-
|
21 |
-
|
22 |
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
|
|
|
|
|
|
|
|
36 |
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
|
|
|
|
|
|
|
|
49 |
|
50 |
<default>
|
51 |
<reference name="head">
|
52 |
-
<action method="addJs" module="monkey"
|
|
|
|
|
53 |
</reference>
|
54 |
</default>
|
55 |
|
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"/>
|
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"
|
17 |
+
template="magemonkey/checkout/subscribe.phtml">
|
18 |
+
<block type="monkey/signup" name="left.monkeysignup" template="magemonkey/lists.phtml"/>
|
19 |
+
</block>
|
20 |
</reference>
|
21 |
+
</checkout_onepage_review>
|
22 |
+
<!-- Checkout -->
|
23 |
|
24 |
+
<!-- Customer -->
|
25 |
+
<customer_account>
|
26 |
+
<reference name="head">
|
27 |
+
<action method="addItem">
|
28 |
+
<type>skin_js</type>
|
29 |
+
<name>magemonkey/monkey.js</name>
|
30 |
+
<params/>
|
31 |
+
</action>
|
32 |
+
</reference>
|
33 |
+
<reference name="customer_account_navigation">
|
34 |
+
<action method="addLink" ifconfig="monkey/general/active" translate="label" module="monkey">
|
35 |
+
<name>mailchimp</name>
|
36 |
+
<path>monkey/customer_account/index</path>
|
37 |
+
<label>Newsletter Subscriptions</label>
|
38 |
+
</action>
|
39 |
+
</reference>
|
40 |
+
</customer_account>
|
41 |
|
42 |
+
<monkey_customer_account_index>
|
43 |
+
<label>Customer My Account Mage Monkey</label>
|
44 |
+
<update handle="customer_account"/>
|
45 |
+
<reference name="head">
|
46 |
+
<action method="addCss">
|
47 |
+
<stylesheet>magemonkey/magemonkey.css</stylesheet>
|
48 |
+
</action>
|
49 |
+
</reference>
|
50 |
+
<reference name="my.account.wrapper">
|
51 |
+
<block type="monkey/customer_account_lists" name="magemonkey_additionallists"
|
52 |
+
template="magemonkey/lists.phtml"/>
|
53 |
+
<block type="customer/account_dashboard" name="customer.account.link.back"
|
54 |
+
template="customer/account/link/back.phtml"/>
|
55 |
+
</reference>
|
56 |
+
</monkey_customer_account_index>
|
57 |
+
<!-- Customer -->
|
58 |
|
59 |
<default>
|
60 |
<reference name="head">
|
61 |
+
<action method="addJs" module="monkey">
|
62 |
+
<script helper="monkey/getCanShowCampaignJs"></script>
|
63 |
+
</action>
|
64 |
</reference>
|
65 |
</default>
|
66 |
|
app/design/frontend/base/default/template/ebizmarts/autoresponder/backtostock/catalog/product/form.phtml
CHANGED
@@ -10,25 +10,30 @@
|
|
10 |
?>
|
11 |
|
12 |
<?php
|
13 |
-
|
14 |
-
|
15 |
?>
|
16 |
-
<?php if($_product && !$_product->getStockItem()->getIsInStock() && Mage::helper('ebizmarts_autoresponder')->config('backtostock/active')): ?>
|
17 |
|
18 |
-
<?php if(
|
19 |
|
20 |
<div class="box-collateral block-autoresponder-backtostock" style="padding: 20px 0 0;">
|
21 |
<div class="form-add">
|
22 |
-
<form id="backtostock_form" action="<?php echo $formAction?>" method="post">
|
23 |
<div>
|
24 |
<h2><?php echo $this->__('Get notified !'); ?></h2>
|
|
|
25 |
<p><?php echo $this->__('Subscribe to receive an email as soon as this product become available again!'); ?></p>
|
26 |
<ul class="form-list">
|
27 |
<li>
|
28 |
-
<label
|
|
|
|
|
29 |
<div class="input-box">
|
30 |
<?php $email = $this->isLoggedIn() ? Mage::getSingleton('customer/session')->getCustomer()->getEmail() : ''; ?>
|
31 |
-
<input type="text" class="input-text validate-email required-entry"
|
|
|
|
|
32 |
</div>
|
33 |
</li>
|
34 |
</ul>
|
@@ -37,8 +42,8 @@
|
|
37 |
<span><?php echo $this->__('Subscribe'); ?></span>
|
38 |
</span>
|
39 |
</button>
|
40 |
-
<input type="hidden" name="redirect_url" value="<?php echo $_product->getProductUrl(); ?>"
|
41 |
-
<input type="hidden" name="product_id" value="<?php echo $_product->getId(); ?>"
|
42 |
</div>
|
43 |
</form>
|
44 |
</div>
|
@@ -48,7 +53,9 @@
|
|
48 |
//<![CDATA[
|
49 |
var dataForm = new VarienForm('backtostock_form', false);
|
50 |
|
51 |
-
function btsShowForm() {
|
|
|
|
|
52 |
//]]>
|
53 |
</script>
|
54 |
|
10 |
?>
|
11 |
|
12 |
<?php
|
13 |
+
$_product = $this->getProduct();
|
14 |
+
$formAction = $this->getSubscribeUrl();
|
15 |
?>
|
16 |
+
<?php if ($_product && !$_product->getStockItem()->getIsInStock() && Mage::helper('ebizmarts_autoresponder')->config('backtostock/active')): ?>
|
17 |
|
18 |
+
<?php if ($this->isLoggedIn() || (!$this->isLoggedIn() && Mage::helper('ebizmarts_autoresponder')->isBacktoStockEnabledForGuest())): ?>
|
19 |
|
20 |
<div class="box-collateral block-autoresponder-backtostock" style="padding: 20px 0 0;">
|
21 |
<div class="form-add">
|
22 |
+
<form id="backtostock_form" action="<?php echo $formAction ?>" method="post">
|
23 |
<div>
|
24 |
<h2><?php echo $this->__('Get notified !'); ?></h2>
|
25 |
+
|
26 |
<p><?php echo $this->__('Subscribe to receive an email as soon as this product become available again!'); ?></p>
|
27 |
<ul class="form-list">
|
28 |
<li>
|
29 |
+
<label
|
30 |
+
for="subscriber_email"><?php echo $this->__('Enter your email address'); ?></label>
|
31 |
+
|
32 |
<div class="input-box">
|
33 |
<?php $email = $this->isLoggedIn() ? Mage::getSingleton('customer/session')->getCustomer()->getEmail() : ''; ?>
|
34 |
+
<input type="text" class="input-text validate-email required-entry"
|
35 |
+
name="subscriber_email" id="subscriber_email" size="35"
|
36 |
+
value="<?php echo $email; ?>"/>
|
37 |
</div>
|
38 |
</li>
|
39 |
</ul>
|
42 |
<span><?php echo $this->__('Subscribe'); ?></span>
|
43 |
</span>
|
44 |
</button>
|
45 |
+
<input type="hidden" name="redirect_url" value="<?php echo $_product->getProductUrl(); ?>"/>
|
46 |
+
<input type="hidden" name="product_id" value="<?php echo $_product->getId(); ?>"/>
|
47 |
</div>
|
48 |
</form>
|
49 |
</div>
|
53 |
//<![CDATA[
|
54 |
var dataForm = new VarienForm('backtostock_form', false);
|
55 |
|
56 |
+
function btsShowForm() {
|
57 |
+
$('backtostock_form').scrollTo();
|
58 |
+
}
|
59 |
//]]>
|
60 |
</script>
|
61 |
|
app/design/frontend/base/default/template/ebizmarts/autoresponder/backtostock/catalog/product/notice.phtml
CHANGED
@@ -10,15 +10,16 @@
|
|
10 |
?>
|
11 |
|
12 |
<?php
|
13 |
-
|
14 |
-
|
15 |
?>
|
16 |
-
<?php if($_product && (!$_product->getStockItem()->getIsInStock() || $_product->getStockItem()->getQty() == 0 && $_product->getTypeId() == "simple") && Mage::helper('ebizmarts_autoresponder')->config('backtostock/active')): ?>
|
17 |
|
18 |
-
<?php if($this->isLoggedIn() || (!$this->isLoggedIn() && Mage::helper('ebizmarts_autoresponder')->isBacktoStockEnabledForGuest())
|
19 |
<div class="box-collateral block-autoresponder-backtostock">
|
20 |
<div class="form-add">
|
21 |
-
<a href="#"
|
|
|
22 |
</div>
|
23 |
</div>
|
24 |
<?php endif; ?>
|
10 |
?>
|
11 |
|
12 |
<?php
|
13 |
+
$_product = $this->getProduct();
|
14 |
+
$formAction = $this->getSubscribeUrl();
|
15 |
?>
|
16 |
+
<?php if ($_product && (!$_product->getStockItem()->getIsInStock() || $_product->getStockItem()->getQty() == 0 && $_product->getTypeId() == "simple") && Mage::helper('ebizmarts_autoresponder')->config('backtostock/active')): ?>
|
17 |
|
18 |
+
<?php if ($this->isLoggedIn() || (!$this->isLoggedIn() && Mage::helper('ebizmarts_autoresponder')->isBacktoStockEnabledForGuest())): ?>
|
19 |
<div class="box-collateral block-autoresponder-backtostock">
|
20 |
<div class="form-add">
|
21 |
+
<a href="#"
|
22 |
+
onclick="btsShowForm(); return false;"><?php echo $this->__('Sign up to be notified when this product is back to stock'); ?></a>
|
23 |
</div>
|
24 |
</div>
|
25 |
<?php endif; ?>
|
app/design/frontend/base/default/template/ebizmarts/autoresponder/backtostock/item.phtml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php $product = $this->getProduct(); ?>
|
2 |
<table cellspacing="0" cellpadding="0" border="0" width="650" style="border:1px solid #EAEAEA;">
|
3 |
-
<?php if($product): ?>
|
4 |
-
<?php if($product->getImage()=="no_selection"
|
5 |
$conf = Mage::getModel('catalog/product_type_configurable')->setProduct($product);
|
6 |
$simple_collection = $conf->getUsedProductCollection()->addAttributeToSelect('*')->addFilterByRequiredOptions();
|
7 |
foreach ($simple_collection as $simple_product) {
|
@@ -11,32 +11,37 @@
|
|
11 |
break;
|
12 |
}
|
13 |
}
|
14 |
-
}
|
15 |
-
else {
|
16 |
$imageUrl = $product->getThumbnailUrl();
|
17 |
}
|
18 |
?>
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
<strong><a href="<?php echo $product->getProductUrl(); ?>" title="<?php echo $this->escapeHtml($product->getName()); ?>"><?php echo $this->__('Go to product\'s page now!');?></a></strong>
|
39 |
-
</td>
|
40 |
-
</tr>
|
41 |
<?php endif; ?>
|
42 |
</table>
|
1 |
<?php $product = $this->getProduct(); ?>
|
2 |
<table cellspacing="0" cellpadding="0" border="0" width="650" style="border:1px solid #EAEAEA;">
|
3 |
+
<?php if ($product): ?>
|
4 |
+
<?php if ($product->getImage() == "no_selection" && $product->getTypeId() == "configurable") {
|
5 |
$conf = Mage::getModel('catalog/product_type_configurable')->setProduct($product);
|
6 |
$simple_collection = $conf->getUsedProductCollection()->addAttributeToSelect('*')->addFilterByRequiredOptions();
|
7 |
foreach ($simple_collection as $simple_product) {
|
11 |
break;
|
12 |
}
|
13 |
}
|
14 |
+
} else {
|
|
|
15 |
$imageUrl = $product->getThumbnailUrl();
|
16 |
}
|
17 |
?>
|
18 |
+
<tr>
|
19 |
+
<?php $parentId = Mage::getModel('catalog/product_type_configurable')->getParentIdsByChild($product->getId());
|
20 |
+
if (isset($parentId[0])) {
|
21 |
+
$product = Mage::getModel('catalog/product')->load($parentId[0]);
|
22 |
+
}
|
23 |
+
?>
|
24 |
+
|
25 |
+
<td valign="top" align="left" style="padding:3px 9px">
|
26 |
+
<a href="<?php echo $product->getProductUrl(); ?>"
|
27 |
+
alt="<?php echo $this->escapeHtml($product->getName()); ?>" target="_blank">
|
28 |
+
<img src="<?php echo $imageUrl; ?>" alt="<?php echo $this->escapeHtml($product->getName()); ?>"/>
|
29 |
+
</a>
|
30 |
+
</td>
|
31 |
+
<td valign="top" align="left" style="padding:3px 9px">
|
32 |
+
<p>
|
33 |
|
34 |
+
<h2>
|
35 |
+
<a href="<?php echo $product->getProductUrl(); ?>"><?php echo $this->escapeHtml($product->getName()); ?></a>
|
36 |
+
</h2></p>
|
37 |
+
<?php echo $this->escapeHtml($product->getShortDescription()); ?>
|
38 |
+
</td>
|
39 |
+
</tr>
|
40 |
+
<tr>
|
41 |
+
<td colspan="2" align="center">
|
42 |
+
<strong><a href="<?php echo $product->getProductUrl(); ?>"
|
43 |
+
title="<?php echo $this->escapeHtml($product->getName()); ?>"><?php echo $this->__('Go to product\'s page now!'); ?></a></strong>
|
44 |
+
</td>
|
45 |
+
</tr>
|
|
|
|
|
|
|
46 |
<?php endif; ?>
|
47 |
</table>
|
app/design/frontend/base/default/template/ebizmarts/autoresponder/customer/list.phtml
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
?>
|
4 |
<div>
|
5 |
<div class="page-title">
|
@@ -8,16 +8,20 @@
|
|
8 |
<form action="<?php echo $this->getSaveUrl(); ?>" name="autoresponder_list" id="autoresponder_list" method="post">
|
9 |
<div class="fieldset">
|
10 |
<ul>
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
|
|
|
|
|
|
16 |
|
17 |
-
|
18 |
</ul>
|
19 |
<div class="buttons-set">
|
20 |
-
<button type="submit" title="<?php echo $this->__('Save') ?>" class="button"
|
|
|
21 |
</div>
|
22 |
</div>
|
23 |
</form>
|
1 |
<?php
|
2 |
+
$lists = $this->getLists();
|
3 |
?>
|
4 |
<div>
|
5 |
<div class="page-title">
|
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; ?>"
|
14 |
+
value="1" <?php if ($list['checked'] == 'checked') {
|
15 |
+
echo 'checked="checked"';
|
16 |
+
} ?>/>
|
17 |
+
<label for="<?php echo $key; ?>"><?php echo $list['listname']; ?></label>
|
18 |
+
</li>
|
19 |
|
20 |
+
<?php endforeach; ?>
|
21 |
</ul>
|
22 |
<div class="buttons-set">
|
23 |
+
<button type="submit" title="<?php echo $this->__('Save') ?>" class="button">
|
24 |
+
<span><span><?php echo $this->__('Save') ?></span></span></button>
|
25 |
</div>
|
26 |
</div>
|
27 |
</form>
|
app/design/frontend/base/default/template/ebizmarts/autoresponder/related/items.phtml
CHANGED
@@ -1,24 +1,29 @@
|
|
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 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
|
|
12 |
}
|
|
|
|
|
13 |
}
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
|
|
|
|
24 |
</table>
|
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 |
+
<?php if ($product->getImage() == "no_selection" && $product->getTypeId() == "configurable") {
|
5 |
+
$conf = Mage::getModel('catalog/product_type_configurable')->setProduct($product);
|
6 |
+
$simple_collection = $conf->getUsedProductCollection()->addAttributeToSelect('*')->addFilterByRequiredOptions();
|
7 |
+
foreach ($simple_collection as $simple_product) {
|
8 |
+
echo $simple_product->getSku() . " - " . $simple_product->getName() . " - " . Mage::helper('core')->currency($simple_product->getPrice()) . "\n";
|
9 |
+
if ($simple_product->getImage() != "no_selection") {
|
10 |
+
$imageUrl = $simple_product->getThumbnailUrl();
|
11 |
+
break;
|
12 |
+
}
|
13 |
}
|
14 |
+
} else {
|
15 |
+
$imageUrl = $product->getThumbnailUrl();
|
16 |
}
|
17 |
+
?>
|
18 |
+
<tr>
|
19 |
+
<td valign="top" align="left" style="padding:3px 9px"><a href="<?php echo $product->getProductUrl(); ?>"
|
20 |
+
alt="<?php echo $this->escapeHtml($product->getName()); ?>"
|
21 |
+
target="_blank"><img src="<?php echo $imageUrl; ?>"
|
22 |
+
alt="<?php echo $this->escapeHtml($product->getName()); ?>"/></a>
|
23 |
+
</td>
|
24 |
+
<td valign="top" align="left" style="padding:3px 9px">
|
25 |
+
<p><?php echo $this->escapeHtml($product->getName()); ?></p><?php echo $this->escapeHtml($product->getShortDescription()); ?>
|
26 |
+
</td>
|
27 |
+
</tr>
|
28 |
+
<?php endforeach; ?>
|
29 |
</table>
|
app/design/frontend/base/default/template/ebizmarts/autoresponder/review/items.phtml
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
|
4 |
?>
|
5 |
<table cellspacing="0" cellpadding="0" border="0" width="650" style="border:1px solid #EAEAEA;">
|
6 |
-
<?php foreach($products as $product): ?>
|
7 |
-
<?php if($product->getImage()=="no_selection"
|
8 |
$conf = Mage::getModel('catalog/product_type_configurable')->setProduct($product);
|
9 |
$simple_collection = $conf->getUsedProductCollection()->addAttributeToSelect('*')->addFilterByRequiredOptions();
|
10 |
foreach ($simple_collection as $simple_product) {
|
@@ -14,23 +14,29 @@
|
|
14 |
break;
|
15 |
}
|
16 |
}
|
17 |
-
}
|
18 |
-
else {
|
19 |
$imageUrl = $product->getThumbnailUrl();
|
20 |
}
|
21 |
?>
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
<td valign="top" align="left" style="padding:3px 9px"><a href="<?php echo $url; ?>"
|
33 |
-
|
34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
<?php endforeach; ?>
|
36 |
</table>
|
1 |
<?php
|
2 |
+
$products = $this->getProducts();
|
3 |
+
$token = $this->getToken();
|
4 |
?>
|
5 |
<table cellspacing="0" cellpadding="0" border="0" width="650" style="border:1px solid #EAEAEA;">
|
6 |
+
<?php foreach ($products as $product): ?>
|
7 |
+
<?php if ($product->getImage() == "no_selection" && $product->getTypeId() == "configurable") {
|
8 |
$conf = Mage::getModel('catalog/product_type_configurable')->setProduct($product);
|
9 |
$simple_collection = $conf->getUsedProductCollection()->addAttributeToSelect('*')->addFilterByRequiredOptions();
|
10 |
foreach ($simple_collection as $simple_product) {
|
14 |
break;
|
15 |
}
|
16 |
}
|
17 |
+
} else {
|
|
|
18 |
$imageUrl = $product->getThumbnailUrl();
|
19 |
}
|
20 |
?>
|
21 |
+
<tr>
|
22 |
+
<?php $parentId = Mage::getModel('catalog/product_type_configurable')->getParentIdsByChild($product->getId());
|
23 |
+
if (isset($parentId[0])) {
|
24 |
+
$product = Mage::getModel('catalog/product')->load($parentId[0]);
|
25 |
+
}
|
26 |
+
$url = Mage::getUrl('review/product/list', array('id' => $product->getId()));
|
27 |
+
if ($token) {
|
28 |
+
$url .= 'token/' . $token;
|
29 |
+
}
|
30 |
+
?>
|
31 |
+
<td valign="top" align="left" style="padding:3px 9px"><a href="<?php echo $url; ?>"
|
32 |
+
alt="<?php echo $this->escapeHtml($product->getName()); ?>"
|
33 |
+
target="_blank"><img src="<?php echo $imageUrl; ?>"
|
34 |
+
alt="<?php echo $this->escapeHtml($product->getName()); ?>"/></a>
|
35 |
+
</td>
|
36 |
+
<td valign="top" align="left" style="padding:3px 9px"><p>
|
37 |
+
|
38 |
+
<h2><a href="<?php echo $url; ?>"> Rate <?php echo $this->escapeHtml($product->getName()); ?></a>
|
39 |
+
</h2></p><?php echo $this->escapeHtml($product->getShortDescription()); ?></td>
|
40 |
+
</tr>
|
41 |
<?php endforeach; ?>
|
42 |
</table>
|
app/design/frontend/base/default/template/ebizmarts/autoresponder/unsubscribe.phtml
CHANGED
@@ -4,5 +4,7 @@
|
|
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') ?>"
|
|
|
|
|
8 |
</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') ?>"
|
8 |
+
onclick="window.location='<?php echo $this->getUrl() ?>'">
|
9 |
+
<span><span><?php echo $this->__('Continue Shopping') ?></span></span></button>
|
10 |
</div>
|
app/design/frontend/base/default/template/ebizmarts/autoresponder/wishlist/items.phtml
CHANGED
@@ -1,7 +1,7 @@
|
|
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 |
-
<?php if($product->getImage()=="no_selection"
|
5 |
$conf = Mage::getModel('catalog/product_type_configurable')->setProduct($product);
|
6 |
$simple_collection = $conf->getUsedProductCollection()->addAttributeToSelect('*')->addFilterByRequiredOptions();
|
7 |
foreach ($simple_collection as $simple_product) {
|
@@ -11,14 +11,21 @@
|
|
11 |
break;
|
12 |
}
|
13 |
}
|
14 |
-
}
|
15 |
-
else {
|
16 |
$imageUrl = $product->getThumbnailUrl();
|
17 |
}
|
18 |
?>
|
19 |
<tr>
|
20 |
-
<td valign="top" align="left" style="padding:3px 9px"><a href="<?php echo $product->getProductUrl(); ?>"
|
21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
</tr>
|
23 |
<?php endforeach; ?>
|
24 |
</table>
|
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 |
+
<?php if ($product->getImage() == "no_selection" && $product->getTypeId() == "configurable") {
|
5 |
$conf = Mage::getModel('catalog/product_type_configurable')->setProduct($product);
|
6 |
$simple_collection = $conf->getUsedProductCollection()->addAttributeToSelect('*')->addFilterByRequiredOptions();
|
7 |
foreach ($simple_collection as $simple_product) {
|
11 |
break;
|
12 |
}
|
13 |
}
|
14 |
+
} else {
|
|
|
15 |
$imageUrl = $product->getThumbnailUrl();
|
16 |
}
|
17 |
?>
|
18 |
<tr>
|
19 |
+
<td valign="top" align="left" style="padding:3px 9px"><a href="<?php echo $product->getProductUrl(); ?>"
|
20 |
+
alt="<?php echo $this->escapeHtml($product->getName()); ?>"
|
21 |
+
target="_blank"><img src="<?php echo $imageUrl; ?>"
|
22 |
+
alt="<?php echo $this->escapeHtml($product->getName()); ?>"/></a>
|
23 |
+
</td>
|
24 |
+
<td valign="top" align="left" style="padding:3px 9px"><p>
|
25 |
+
|
26 |
+
<h2>
|
27 |
+
<a href="<?php echo $product->getProductUrl(); ?>"> <?php echo $this->escapeHtml($product->getName()); ?></a>
|
28 |
+
</h2></p><?php echo $this->escapeHtml($product->getShortDescription()); ?></td>
|
29 |
</tr>
|
30 |
<?php endforeach; ?>
|
31 |
</table>
|
app/design/frontend/base/default/template/ebizmarts_abandonedcart/email/order/items.phtml
CHANGED
@@ -6,69 +6,73 @@ $_quote = $this->getQuote();
|
|
6 |
<tr>
|
7 |
<th align="left" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px"><?php echo $this->__('Item') ?></th>
|
8 |
<th align="left" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px"><?php echo $this->__('Sku') ?></th>
|
9 |
-
<th align="center" bgcolor="#EAEAEA"
|
|
|
10 |
<th align="center" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px"><?php echo $this->__('Qty') ?></th>
|
11 |
-
<th align="right" bgcolor="#EAEAEA"
|
|
|
12 |
</tr>
|
13 |
</thead>
|
14 |
-
<?php if (is_object($_quote))
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
$
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
if (
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
|
|
33 |
|
34 |
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
}
|
52 |
|
53 |
-
|
54 |
-
|
55 |
|
56 |
-
|
|
|
57 |
}
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
|
|
69 |
|
70 |
-
|
71 |
-
|
72 |
<?php endforeach; ?>
|
73 |
-
|
74 |
</table>
|
6 |
<tr>
|
7 |
<th align="left" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px"><?php echo $this->__('Item') ?></th>
|
8 |
<th align="left" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px"><?php echo $this->__('Sku') ?></th>
|
9 |
+
<th align="center" bgcolor="#EAEAEA"
|
10 |
+
style="font-size:13px; padding:3px 9px"><?php echo $this->__('Image') ?></th>
|
11 |
<th align="center" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px"><?php echo $this->__('Qty') ?></th>
|
12 |
+
<th align="right" bgcolor="#EAEAEA"
|
13 |
+
style="font-size:13px; padding:3px 9px"><?php echo $this->__('Subtotal') ?></th>
|
14 |
</tr>
|
15 |
</thead>
|
16 |
+
<?php if (is_object($_quote)) : ?>
|
17 |
+
<?php $i = 0;
|
18 |
+
foreach ($_quote->getAllItems() as $_item): ?>
|
19 |
+
<?php if ($_item->getParentItemId()) continue; else $i++; ?>
|
20 |
+
<?php if ($_item->getProductType() == 'configurable' || $_item->getProductType() == 'bundle') :
|
21 |
+
$finalResult = array();
|
22 |
+
$result = array();
|
23 |
+
$options = $_item->getProduct()->getTypeInstance(true)->getOrderOptions($_item->getProduct());
|
24 |
+
// Check for options
|
25 |
+
if ($options) {
|
26 |
+
if (isset($options['options'])) {
|
27 |
+
$result = array_merge($result, $options['options']);
|
28 |
+
}
|
29 |
+
if (isset($options['additional_options'])) {
|
30 |
+
$result = array_merge($result, $options['additional_options']);
|
31 |
+
}
|
32 |
+
if (!empty($options['attributes_info'])) {
|
33 |
+
$result = array_merge($options['attributes_info'], $result);
|
34 |
+
}
|
35 |
+
if (isset($options['bundle_options'])) {
|
36 |
|
37 |
|
38 |
+
$productId = $_item->getProduct()->getId();
|
39 |
+
$bundled_product = Mage::getModel('catalog/product')->load($productId);
|
40 |
+
$selectionCollection = $bundled_product->getTypeInstance(true)->getSelectionsCollection(
|
41 |
+
$bundled_product->getTypeInstance(true)->getOptionsIds($bundled_product), $bundled_product
|
42 |
+
);
|
43 |
|
44 |
+
$bundled_items = array();
|
45 |
+
$label = '';
|
46 |
+
$qty = '';
|
47 |
+
foreach ($selectionCollection as $option) {
|
48 |
+
foreach ($options['bundle_options'] as $bundle) {
|
49 |
+
if ($bundle['value'][0]['title'] == $option->getName()) {
|
50 |
+
$label = $bundle['label'];
|
51 |
+
$qty = $bundle['value'][0]['qty'];
|
52 |
+
$aux_options[] = array('label' => $label, 'value' => $qty . ' x ' . $option->getName() . ' ' . Mage::helper('checkout')->formatPrice($option->getPrice()), 'sku' => $option->getSku());
|
53 |
+
}
|
|
|
54 |
|
55 |
+
}
|
56 |
+
}
|
57 |
|
58 |
+
$result = array_merge($result, $aux_options);
|
59 |
+
}
|
60 |
}
|
61 |
+
$options = array_merge($finalResult, $result);
|
62 |
+
endif; ?>
|
63 |
+
<tbody<?php echo $i % 2 ? ' bgcolor="#F6F6F6"' : '' ?>>
|
64 |
+
<tr>
|
65 |
+
<?php echo '<td valign="top" align="left" style="padding:3px 9px">' . $_item['name']; ?>
|
66 |
+
<?php if (isset($options) && is_array($options)) : foreach ($options as $option) : echo '<br /><strong><em>' . $option['label'] . '</em></strong> ' . $option['value'];
|
67 |
+
if (isset($option['sku'])) : echo ' ' . $option['sku']; endif; endforeach;
|
68 |
+
$options = null; endif; ?>
|
69 |
+
<?php echo '<td valign="top" align="left" style="padding:3px 9px">' . $_item['sku'] . '</td>'; ?>
|
70 |
+
<?php echo '<td valign="top" align="left" style="padding:3px 9px"><a href="{{var url}}"><img src="' . $this->getImage($_item) . '"/></a></td>'; ?>
|
71 |
+
<?php echo '<td valign="top" align="center" style="padding:3px 9px">' . $_item['qty'] . '</td>'; ?>
|
72 |
+
<?php echo '<td valign="top" align="right" style="padding:3px 9px">' . $this->getTax($_item) . '</td>'; ?>
|
73 |
|
74 |
+
</tr>
|
75 |
+
</tbody>
|
76 |
<?php endforeach; ?>
|
77 |
+
<?php endif; ?>
|
78 |
</table>
|
app/design/frontend/base/default/template/ebizmarts_abandonedcart/email/order/items/order/default.phtml
CHANGED
@@ -4,108 +4,126 @@
|
|
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 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
<?php endif; ?>
|
16 |
<?php $addInfoBlock = $this->getProductAdditionalInformationBlock(); ?>
|
17 |
-
<?php if ($addInfoBlock)
|
18 |
-
|
19 |
<?php endif; ?>
|
20 |
<?php echo $this->escapeHtml($_item->getDescription()) ?>
|
21 |
</td>
|
22 |
-
<td align="left" valign="top"
|
23 |
-
|
|
|
|
|
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 |
-
|
27 |
-
|
28 |
<?php endif; ?>
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
<?php else: ?>
|
33 |
-
|
34 |
<?php endif; ?>
|
35 |
|
36 |
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
|
|
|
|
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 |
-
|
|
|
|
|
53 |
<?php endforeach; ?>
|
54 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
<?php endif; ?>
|
56 |
|
57 |
-
|
58 |
-
|
59 |
-
|
|
|
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 |
-
|
67 |
-
|
68 |
<?php endif; ?>
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
<?php else: ?>
|
73 |
-
|
74 |
<?php endif; ?>
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
|
|
|
|
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 |
-
|
|
|
|
|
91 |
<?php endforeach; ?>
|
92 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
<?php endif; ?>
|
94 |
|
95 |
-
|
96 |
-
|
|
|
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 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
</tr>
|
111 |
<?php endif; ?>
|
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"
|
23 |
+
style="font-size:11px; padding:3px 9px; border-bottom:1px dotted #CCCCCC;"><?php echo $this->htmlEscape($this->getSku($_item)) ?></td>
|
24 |
+
<td align="center" valign="top"
|
25 |
+
style="font-size:11px; padding:3px 9px; border-bottom:1px dotted #CCCCCC;"><?php echo $_item->getQtyOrdered() * 1 ?></td>
|
26 |
<td align="right" valign="top" style="font-size:11px; padding:3px 9px; border-bottom:1px dotted #CCCCCC;">
|
27 |
<?php if ($this->helper('tax')->displaySalesPriceExclTax($_quote->getStoreId()) || $this->helper('tax')->displaySalesBothPrices($_quote->getStore())): ?>
|
28 |
+
<?php if ($this->helper('tax')->displaySalesBothPrices($_quote->getStoreId())): ?>
|
29 |
+
<span class="label"><?php echo Mage::helper('tax')->__('Excl. Tax'); ?>:</span>
|
30 |
<?php endif; ?>
|
31 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'email', $_quote->getStore())): ?>
|
32 |
+
<?php echo Mage::app()->getLocale()->currency($_quote->getQuoteCurrencyCode())->toCurrency($_item->getRowTotal() + $_item->getWeeeTaxAppliedRowAmount() + $_item->getWeeeTaxRowDisposition()); ?>
|
33 |
+
<?php //echo $_quote->formatPrice($_item->getRowTotal()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?>
|
34 |
<?php else: ?>
|
35 |
+
<?php echo Mage::app()->getLocale()->currency($_quote->getQuoteCurrencyCode())->toCurrency($_item->getRowTotal()) ?>
|
36 |
<?php endif; ?>
|
37 |
|
38 |
|
39 |
+
<?php if (Mage::helper('weee')->getApplied($_item)): ?>
|
40 |
+
<br/>
|
41 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'email', $_quote->getStore())): ?>
|
42 |
+
<small>
|
43 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
44 |
+
<span class="nobr"><?php echo $tax['title']; ?>
|
45 |
+
: <?php echo Mage::app()->getLocale()->currency($_quote->getQuoteCurrencyCode())->toCurrency($tax['row_amount'], true, true); ?></span>
|
46 |
+
<br/>
|
47 |
+
<?php endforeach; ?>
|
48 |
+
</small>
|
49 |
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'email', $_quote->getStoreId())): ?>
|
|
|
|
|
|
|
|
|
|
|
50 |
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
51 |
+
<span class="nobr"><small><?php echo $tax['title']; ?>
|
52 |
+
: <?php echo Mage::app()->getLocale()->currency($_quote->getQuoteCurrencyCode())->toCurrency($tax['row_amount_incl_tax'], true, true); ?></small></span>
|
53 |
+
<br/>
|
54 |
<?php endforeach; ?>
|
55 |
+
<?php
|
56 |
+
elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'email', $_quote->getStoreId())): ?>
|
57 |
+
<small>
|
58 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
59 |
+
<span class="nobr"><?php echo $tax['title']; ?>
|
60 |
+
: <?php echo Mage::app()->getLocale()->currency($_quote->getQuoteCurrencyCode())->toCurrency($tax['row_amount_incl_tax'], true, true); ?></span>
|
61 |
+
<br/>
|
62 |
+
<?php endforeach; ?>
|
63 |
+
</small>
|
64 |
<?php endif; ?>
|
65 |
|
66 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'email', $_quote->getStore())): ?>
|
67 |
+
<br/>
|
68 |
+
<span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>
|
69 |
+
:<br/> <?php echo Mage::app()->getLocale()->currency($_quote->getQuoteCurrencyCode())->toCurrency($_item->getCalculationPrice() + $_item->getWeeeTaxAppliedRowAmount() + $_item->getWeeeTaxRowDisposition()); ?></span>
|
70 |
<?php endif; ?>
|
71 |
<?php endif; ?>
|
72 |
<?php endif; ?>
|
73 |
|
74 |
|
75 |
<?php if ($this->helper('tax')->displaySalesPriceInclTax($_quote->getStoreId()) || $this->helper('tax')->displaySalesBothPrices($_quote->getStoreId())): ?>
|
76 |
+
<?php if ($this->helper('tax')->displaySalesBothPrices($_quote->getStoreId())): ?>
|
77 |
+
<br/><span class="label"><?php echo Mage::helper('tax')->__('Incl. Tax'); ?>:</span>
|
78 |
<?php endif; ?>
|
79 |
+
<?php $_incl = $this->helper('checkout')->getSubtotalInclTax($_item); ?>
|
80 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'email', $_quote->getStoreId())): ?>
|
81 |
+
<?php echo Mage::app()->getLocale()->currency($_quote->getQuoteCurrencyCode())->toCurrency($_incl + $_item->getWeeeTaxAppliedRowAmount()); ?>
|
82 |
<?php else: ?>
|
83 |
+
<?php echo Mage::app()->getLocale()->currency($_quote->getQuoteCurrencyCode())->toCurrency($_incl - $_item->getWeeeTaxRowDisposition()) ?>
|
84 |
<?php endif; ?>
|
85 |
+
<?php if (Mage::helper('weee')->getApplied($_item)): ?>
|
86 |
+
<br/>
|
87 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'email', $_quote->getStore())): ?>
|
88 |
+
<small>
|
89 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
90 |
+
<span class="nobr"><?php echo $tax['title']; ?>
|
91 |
+
: <?php echo Mage::app()->getLocale()->currency($_quote->getQuoteCurrencyCode())->toCurrency($tax['row_amount'], true, true); ?></span>
|
92 |
+
<br/>
|
93 |
+
<?php endforeach; ?>
|
94 |
+
</small>
|
95 |
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'email', $_quote->getStoreId())): ?>
|
|
|
|
|
|
|
|
|
|
|
96 |
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
97 |
+
<span class="nobr"><small><?php echo $tax['title']; ?>
|
98 |
+
: <?php echo Mage::app()->getLocale()->currency($_quote->getQuoteCurrencyCode())->toCurrency($tax['row_amount_incl_tax'], true, true); ?></small></span>
|
99 |
+
<br/>
|
100 |
<?php endforeach; ?>
|
101 |
+
<?php
|
102 |
+
elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'email', $_quote->getStoreId())): ?>
|
103 |
+
<small>
|
104 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
105 |
+
<span class="nobr"><?php echo $tax['title']; ?>
|
106 |
+
: <?php echo Mage::app()->getLocale()->currency($_quote->getQuoteCurrencyCode())->toCurrency($tax['row_amount_incl_tax'], true, true); ?></span>
|
107 |
+
<br/>
|
108 |
+
<?php endforeach; ?>
|
109 |
+
</small>
|
110 |
<?php endif; ?>
|
111 |
|
112 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'email', $_quote->getStoreId())): ?>
|
113 |
+
<span class="nobr"><?php echo Mage::helper('weee')->__('Total incl. tax'); ?>
|
114 |
+
:<br/> <?php echo Mage::app()->getLocale()->currency($_quote->getQuoteCurrencyCode())->toCurrency($_incl + $_item->getWeeeTaxAppliedRowAmount()); ?></span>
|
115 |
<?php endif; ?>
|
116 |
<?php endif; ?>
|
117 |
<?php endif; ?>
|
118 |
</td>
|
119 |
</tr>
|
120 |
<?php if ($_item->getGiftMessageId() && $_giftMessage = $this->helper('giftmessage/message')->getGiftMessage($_item->getGiftMessageId())): ?>
|
121 |
+
<tr>
|
122 |
+
<td colspan="4" style=" border-bottom:2px solid #CCCCCC; padding:3px 9px;">
|
123 |
+
<strong style="color:#444444; font-size:11px;"><?php echo $this->__('Gift Message') ?></strong>
|
124 |
+
<?php echo $this->__('From:'); ?> <?php echo $this->htmlEscape($_giftMessage->getSender()) ?><br/>
|
125 |
+
<?php echo $this->__('To:'); ?> <?php echo $this->htmlEscape($_giftMessage->getRecipient()) ?><br/>
|
126 |
+
<strong><?php echo $this->__('Message:'); ?></strong><br/><?php echo $this->htmlEscape($_giftMessage->getMessage()) ?>
|
127 |
+
</td>
|
128 |
+
</tr>
|
129 |
<?php endif; ?>
|
app/design/frontend/base/default/template/ebizmarts_abandonedcart/popup/emailcatcher.phtml
CHANGED
@@ -1,130 +1,136 @@
|
|
1 |
-
<?php if(Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::ACTIVE, $this->_getStoreId()) && Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::ENABLE_POPUP, $this->_getStoreId())): ?>
|
2 |
<div id="email" style="text-align:center; display:none">
|
3 |
<p><span id='email_error_msg' class="email_error" style="display:none"> </span></p>
|
4 |
-
|
5 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
<div style="text-align:left; clear:both; margin-top:10px">
|
7 |
</div>
|
8 |
</div>
|
9 |
|
10 |
<script type="text/javascript">
|
11 |
<?php if(!Mage::getSingleton('customer/session')->isLoggedIn()): ?>
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
<?php endif; ?>
|
|
|
25 |
<?php endif; ?>
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
}
|
31 |
-
});
|
32 |
-
<?php endif; ?>
|
33 |
-
document.observe('keydown', function(evt){
|
34 |
-
if(evt.keyCode == 13) {
|
35 |
-
win.okCallback();
|
36 |
}
|
37 |
});
|
38 |
-
var cookieStored = emailCookieExists();
|
39 |
-
if (!cookieStored) {
|
40 |
-
var win = Dialog.confirm($('email').innerHTML, {
|
41 |
-
className: "popup",
|
42 |
-
id: "popupDialog",
|
43 |
-
width: <?php Print(json_decode(Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::POPUP_WIDTH, $this->_getStoreId()))); ?>,
|
44 |
-
zIndex: 2001,
|
45 |
-
okLabel: '<?php echo $this->__('Confirm') ?>',
|
46 |
-
<?php if(!$this->_canCancel()): ?>closeOnEsc: false,
|
47 |
-
<?php else: ?>
|
48 |
-
cancelLabel: '<?php echo $this->__('Close') ?>',
|
49 |
-
onCancel: function (win) {
|
50 |
-
<?php if(isset($_COOKIE['counter'])):
|
51 |
-
//check cookie counter for customer id and check actual counter
|
52 |
-
$counterId = $_COOKIE['counter'];
|
53 |
-
$counter = Mage::getModel('ebizmarts_abandonedcart/popup')->load($counterId);
|
54 |
-
//if(counter en config == counter en db){
|
55 |
-
if($counter->getCounter()+1 >= Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::POPUP_INSIST, Mage::app()->getStore()->getId())):
|
56 |
-
?>
|
57 |
-
document.cookie = 'counter=; expires=Thu, 01 Jan 1970 00:00:01 GMT';
|
58 |
-
createCookie('email=none', <?php Print(json_encode(Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::POPUP_COOKIE_TIME, $this->_getStoreId()))); ?>);
|
59 |
-
<?php else :
|
60 |
-
$counter->setCounter(($counter->getCounter()+1));
|
61 |
-
$counter->save();
|
62 |
-
endif; ?>
|
63 |
-
<?php else:
|
64 |
-
//create cookie counter in 0
|
65 |
-
if (Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::POPUP_INSIST, Mage::app()->getStore()->getId()) == 1): ?>
|
66 |
-
createCookie('email=none', <?php Print(json_encode(Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::POPUP_COOKIE_TIME, $this->_getStoreId()))); ?>);
|
67 |
-
<?php else:
|
68 |
-
$newCounter = Mage::getModel('ebizmarts_abandonedcart/popup');
|
69 |
-
$newCounter->setCounter(1)->save();
|
70 |
-
?>
|
71 |
-
createCookie('counter='+<?php Print(json_encode($newCounter->getId())); ?>, <?php Print(json_encode(Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::POPUP_COOKIE_TIME, $this->_getStoreId()))); ?>);
|
72 |
-
<?php endif; ?>
|
73 |
-
<?php endif; ?>
|
74 |
-
},
|
75 |
-
<?php endif; ?>
|
76 |
-
onOk: function (win) {
|
77 |
-
var inputField = $$('.email_input input[type=text]').first();
|
78 |
-
var email = inputField.value;
|
79 |
-
if (validateEmail(email)) {
|
80 |
-
var cookie = 'email=' + email;
|
81 |
-
createCookie(cookie, 365);
|
82 |
-
<?php if($this->_modalSubscribe()): ?>
|
83 |
-
createCookie('subscribe=true', 365);
|
84 |
-
location.reload();
|
85 |
-
<?php else: ?>
|
86 |
-
win.close();
|
87 |
-
<?php endif ?>
|
88 |
-
} else {
|
89 |
-
$('email_error_msg').innerHTML = '<?php echo $this->__('Not a valid e-mail address') ?>';
|
90 |
-
$('email_error_msg').setStyle({color: '#F00'});
|
91 |
-
$('email_error_msg').show();
|
92 |
-
Windows.focusedWindow.updateHeight();
|
93 |
-
new Effect.Shake(Windows.focusedWindow.getId());
|
94 |
-
}
|
95 |
-
}
|
96 |
-
});
|
97 |
<?php if(!$this->_canCancel()): ?>
|
98 |
$$('.cancel_button').each(function (element) {
|
99 |
element.remove();
|
100 |
});
|
101 |
<?php else: ?>
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
});
|
107 |
});
|
|
|
108 |
<?php endif; ?>
|
109 |
-
}
|
110 |
}
|
|
|
111 |
<?php endif; ?>
|
112 |
function validateEmail(email) {
|
113 |
var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
114 |
return re.test(email);
|
115 |
}
|
116 |
-
function emailCookieExists(){
|
117 |
var cookie = document.cookie;
|
118 |
var cookieArr = cookie.split(';');
|
119 |
var cookieStored = false;
|
120 |
-
for(var i=0;i<cookieArr.length;i++){
|
121 |
-
if(cookieArr[i].indexOf('email=') > -1){
|
122 |
cookieStored = true;
|
123 |
}
|
124 |
}
|
125 |
return cookieStored;
|
126 |
}
|
127 |
-
function createCookie(cookie, expirationInDays){
|
128 |
var now = new Date();
|
129 |
var expire = new Date(now.getTime() + (expirationInDays * 24 * 60) * 60000);//[(1 * 365 * 24 * 60) * 60000] == 1 year -- (Years * Days * Hours * Minutes) * 60000
|
130 |
document.cookie = cookie + '; expires=' + expire + '; path=/';
|
1 |
+
<?php if (Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::ACTIVE, $this->_getStoreId()) && Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::ENABLE_POPUP, $this->_getStoreId())): ?>
|
2 |
<div id="email" style="text-align:center; display:none">
|
3 |
<p><span id='email_error_msg' class="email_error" style="display:none"> </span></p>
|
4 |
+
|
5 |
+
<div style="clear:both; margin-bottom:10px"><h2
|
6 |
+
style="color:rgb(36,131,199)"><?php echo $this->_popupHeading(); ?></h2>
|
7 |
+
|
8 |
+
<p><?php echo $this->_popupMessage(); ?></p></div>
|
9 |
+
<p><span class="email_label" style="margin-right: 5px">Email:</span><span class="email_input"><input
|
10 |
+
type="text"/></span></p>
|
11 |
+
|
12 |
<div style="text-align:left; clear:both; margin-top:10px">
|
13 |
</div>
|
14 |
</div>
|
15 |
|
16 |
<script type="text/javascript">
|
17 |
<?php if(!Mage::getSingleton('customer/session')->isLoggedIn()): ?>
|
18 |
+
if (navigator.cookieEnabled) {
|
19 |
+
<?php if(isset($_COOKIE['email'])):
|
20 |
+
if($_COOKIE['email'] != 'none'):
|
21 |
+
$email = str_replace(' ', '+', $_COOKIE['email']);
|
22 |
+
$this->_createCoupon($email);
|
23 |
+
if(isset($_COOKIE['subscribe'])):
|
24 |
+
$subscriber = Mage::getModel('newsletter/subscriber')->loadByEmail($email);
|
25 |
+
if(!$subscriber->getId()):
|
26 |
+
Mage::getModel('newsletter/subscriber')->setImportMode(TRUE)->subscribe($email); ?>
|
27 |
+
document.cookie = 'subscribe=; expires=Thu, 01 Jan 1970 00:00:01 GMT';
|
28 |
+
location.reload();
|
29 |
+
<?php endif; ?>
|
30 |
+
<?php endif; ?>
|
31 |
+
<?php endif; ?>
|
32 |
+
<?php elseif($this->_canCancel()): ?>
|
33 |
+
document.observe('keydown', function (evt) {
|
34 |
+
if (evt.keyCode == 27) {
|
35 |
+
win.cancelCallback();
|
36 |
+
}
|
37 |
+
});
|
38 |
+
<?php endif; ?>
|
39 |
+
document.observe('keydown', function (evt) {
|
40 |
+
if (evt.keyCode == 13) {
|
41 |
+
win.okCallback();
|
42 |
+
}
|
43 |
+
});
|
44 |
+
var cookieStored = emailCookieExists();
|
45 |
+
if (!cookieStored) {
|
46 |
+
var win = Dialog.confirm($('email').innerHTML, {
|
47 |
+
className: "popup",
|
48 |
+
id: "popupDialog",
|
49 |
+
width: <?php Print(json_decode(Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::POPUP_WIDTH, $this->_getStoreId()))); ?>,
|
50 |
+
zIndex: 2001,
|
51 |
+
okLabel: '<?php echo $this->__('Confirm') ?>',
|
52 |
+
<?php if(!$this->_canCancel()): ?>closeOnEsc: false,
|
53 |
+
<?php else: ?>
|
54 |
+
cancelLabel: '<?php echo $this->__('Close') ?>',
|
55 |
+
onCancel: function (win) {
|
56 |
+
<?php if(isset($_COOKIE['counter'])):
|
57 |
+
//check cookie counter for customer id and check actual counter
|
58 |
+
$counterId = $_COOKIE['counter'];
|
59 |
+
$counter = Mage::getModel('ebizmarts_abandonedcart/popup')->load($counterId);
|
60 |
+
//if(counter en config == counter en db){
|
61 |
+
if($counter->getCounter()+1 >= Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::POPUP_INSIST, Mage::app()->getStore()->getId())):
|
62 |
+
?>
|
63 |
+
document.cookie = 'counter=; expires=Thu, 01 Jan 1970 00:00:01 GMT';
|
64 |
+
createCookie('email=none', <?php Print(json_encode(Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::POPUP_COOKIE_TIME, $this->_getStoreId()))); ?>);
|
65 |
+
<?php else :
|
66 |
+
$counter->setCounter(($counter->getCounter()+1));
|
67 |
+
$counter->save();
|
68 |
+
endif; ?>
|
69 |
+
<?php else:
|
70 |
+
//create cookie counter in 0
|
71 |
+
if (Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::POPUP_INSIST, Mage::app()->getStore()->getId()) == 1): ?>
|
72 |
+
createCookie('email=none', <?php Print(json_encode(Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::POPUP_COOKIE_TIME, $this->_getStoreId()))); ?>);
|
73 |
+
<?php else:
|
74 |
+
$newCounter = Mage::getModel('ebizmarts_abandonedcart/popup');
|
75 |
+
$newCounter->setCounter(1)->save();
|
76 |
+
?>
|
77 |
+
createCookie('counter=' +<?php Print(json_encode($newCounter->getId())); ?>, <?php Print(json_encode(Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::POPUP_COOKIE_TIME, $this->_getStoreId()))); ?>);
|
78 |
+
<?php endif; ?>
|
79 |
<?php endif; ?>
|
80 |
+
},
|
81 |
<?php endif; ?>
|
82 |
+
onOk: function (win) {
|
83 |
+
var inputField = $$('.email_input input[type=text]').first();
|
84 |
+
var email = inputField.value;
|
85 |
+
if (validateEmail(email)) {
|
86 |
+
var cookie = 'email=' + email;
|
87 |
+
createCookie(cookie, 365);
|
88 |
+
<?php if($this->_modalSubscribe()): ?>
|
89 |
+
createCookie('subscribe=true', 365);
|
90 |
+
location.reload();
|
91 |
+
<?php else: ?>
|
92 |
+
win.close();
|
93 |
+
<?php endif ?>
|
94 |
+
} else {
|
95 |
+
$('email_error_msg').innerHTML = '<?php echo $this->__('Not a valid e-mail address') ?>';
|
96 |
+
$('email_error_msg').setStyle({color: '#F00'});
|
97 |
+
$('email_error_msg').show();
|
98 |
+
Windows.focusedWindow.updateHeight();
|
99 |
+
new Effect.Shake(Windows.focusedWindow.getId());
|
100 |
}
|
|
|
|
|
|
|
|
|
|
|
101 |
}
|
102 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
<?php if(!$this->_canCancel()): ?>
|
104 |
$$('.cancel_button').each(function (element) {
|
105 |
element.remove();
|
106 |
});
|
107 |
<?php else: ?>
|
108 |
+
Event.observe(window, 'load', function () {
|
109 |
+
$('overlay_modal').observe('click', function () {
|
110 |
+
win.close();
|
111 |
+
win.cancelCallback();
|
|
|
112 |
});
|
113 |
+
});
|
114 |
<?php endif; ?>
|
|
|
115 |
}
|
116 |
+
}
|
117 |
<?php endif; ?>
|
118 |
function validateEmail(email) {
|
119 |
var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
120 |
return re.test(email);
|
121 |
}
|
122 |
+
function emailCookieExists() {
|
123 |
var cookie = document.cookie;
|
124 |
var cookieArr = cookie.split(';');
|
125 |
var cookieStored = false;
|
126 |
+
for (var i = 0; i < cookieArr.length; i++) {
|
127 |
+
if (cookieArr[i].indexOf('email=') > -1) {
|
128 |
cookieStored = true;
|
129 |
}
|
130 |
}
|
131 |
return cookieStored;
|
132 |
}
|
133 |
+
function createCookie(cookie, expirationInDays) {
|
134 |
var now = new Date();
|
135 |
var expire = new Date(now.getTime() + (expirationInDays * 24 * 60) * 60000);//[(1 * 365 * 24 * 60) * 60000] == 1 year -- (Years * Days * Hours * Minutes) * 60000
|
136 |
document.cookie = cookie + '; expires=' + expire + '; path=/';
|
app/design/frontend/base/default/template/magemonkey/checkout/subscribe.phtml
CHANGED
@@ -1,47 +1,67 @@
|
|
1 |
<?php
|
2 |
$lists = $this->getLists();
|
3 |
$check = $this->checkStatus();
|
4 |
-
$myLists
|
5 |
-
$generalList
|
6 |
-
$auto
|
7 |
$force = $this->getForce();
|
8 |
?>
|
9 |
<script type="text/javascript">
|
10 |
-
addSubscribeToPost = function (element){
|
11 |
|
12 |
//save old clicked lists and then removes element
|
13 |
var subscribeValue = '';
|
14 |
-
if($('magemonkey-subscribe')){
|
15 |
var checkedLists = $('magemonkey-subscribe').getValue();
|
16 |
-
subscribeValue = checkedLists+',';
|
17 |
$('magemonkey-subscribe').remove();
|
18 |
}
|
19 |
|
20 |
//if checked add this element else remove it
|
21 |
-
if(element.checked){
|
22 |
-
var inputer = new Element('input', {
|
23 |
-
|
24 |
-
|
25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
Element.insert(Form.findFirstElement(payment.form), inputer);
|
27 |
Element.insert(Form.findFirstElement(payment.form), listValue);
|
28 |
<?php if($force): ?>
|
29 |
Element.insert(Form.findFirstElement(payment.form), force);
|
30 |
<?php endif; ?>
|
31 |
-
}catch(notelem){
|
32 |
$("co-payment-form").insert(inputer);
|
33 |
$("co-payment-form").insert(listValue);
|
34 |
}
|
35 |
-
}else{
|
36 |
var arrCheckedLists = checkedLists.split(',');
|
37 |
var pos = arrCheckedLists.indexOf(element.readAttribute('value'));
|
38 |
-
if(pos != -1) {
|
39 |
arrCheckedLists.splice(pos, 1);
|
40 |
checkedLists = arrCheckedLists.join(',');
|
41 |
-
var inputer = new Element('input', {
|
42 |
-
|
|
|
|
|
|
|
|
|
|
|
43 |
Element.insert(Form.findFirstElement(payment.form), inputer);
|
44 |
-
}catch(notelem){
|
45 |
$("co-payment-form").insert(inputer);
|
46 |
}
|
47 |
}
|
@@ -49,35 +69,46 @@ $force = $this->getForce();
|
|
49 |
}
|
50 |
|
51 |
}
|
52 |
-
addGroupToPost = function (element){
|
53 |
|
54 |
-
if(element.checked){
|
55 |
|
56 |
-
try{
|
57 |
-
var group = new Element('input', {
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
Element.insert(Form.findFirstElement(payment.form), group);
|
59 |
-
}catch(notelem){
|
60 |
$("co-payment-form").insert(group);
|
61 |
}
|
62 |
-
}else{
|
63 |
-
if($("subscribe"+element.readAttribute('id'))){
|
64 |
-
$("subscribe"+element.readAttribute('id')).remove();
|
65 |
}
|
66 |
}
|
67 |
}
|
68 |
-
addElementToPost = function (element){
|
69 |
var formInputId = element.readAttribute('id') + '-serialize';
|
70 |
-
if($(formInputId)){
|
71 |
$(formInputId).remove();
|
72 |
}
|
73 |
|
74 |
-
var inp = new Element('input', {
|
|
|
|
|
|
|
|
|
|
|
75 |
|
76 |
-
Element.insert(
|
77 |
|
78 |
}
|
79 |
</script>
|
80 |
-
<div class="buttons-set"<?php if($check === 3): ?> style="display:none;"<?php endif
|
81 |
<!-- General Subscription -->
|
82 |
<div class="page-title">
|
83 |
<h1><?php echo $this->__('Newsletter Subscription'); ?></h1>
|
@@ -86,13 +117,20 @@ $force = $this->getForce();
|
|
86 |
<div class="monkey-multisubscribe">
|
87 |
<ul class="monkey-general-list">
|
88 |
<li class="listdata"><?php echo $generalList['name']; ?>
|
89 |
-
<input<?php if($auto): ?> checked="checked"<?php endif
|
90 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
<div id="interest_groupings_<?php echo $generalList['id']; ?>" class="interest-groupings">
|
92 |
-
<?php foreach($generalList['interest_groupings'] as $group): ?>
|
93 |
-
<?php if($group['name'] != 'MAGE_CUSTOMER_GROUPS'): ?>
|
94 |
<div class="grouping">
|
95 |
-
<?php if ($group['form_field'] != 'hidden'):
|
|
|
96 |
<?php echo $this->renderGroup($group, $generalList, $auto); ?>
|
97 |
</div>
|
98 |
<?php endif; ?>
|
@@ -107,18 +145,25 @@ $force = $this->getForce();
|
|
107 |
<!-- Additional Lists -->
|
108 |
<ul class="monkey-additional-lists">
|
109 |
<?php
|
110 |
-
foreach($lists as $list):
|
111 |
|
112 |
$igroups = $list['interest_groupings'];
|
113 |
?>
|
114 |
<li class="listdata"><?php echo $list['name']; ?>
|
115 |
-
<input<?php if($auto): ?> checked="checked"<?php endif
|
116 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
<div id="interest_groupings_<?php echo $list['id']; ?>" class="interest-groupings">
|
118 |
-
<?php foreach($igroups as $group): ?>
|
119 |
-
<?php if($group['name'] != 'MAGE_CUSTOMER_GROUPS'): ?>
|
120 |
<div class="grouping">
|
121 |
-
<?php if ($group['form_field'] != 'hidden'):
|
|
|
122 |
<?php echo $this->renderGroup($group, $list, $auto); ?>
|
123 |
</div>
|
124 |
<?php endif; ?>
|
@@ -134,23 +179,23 @@ $force = $this->getForce();
|
|
134 |
|
135 |
<script type="text/javascript">
|
136 |
//Handle newsletter subscribe/unsubscribe checkbox events
|
137 |
-
$$('input.monkey-list-subscriber').each(function(chk){
|
138 |
|
139 |
-
if(
|
140 |
-
var groupings = $('interest_groupings_'+chk.value);
|
141 |
-
if(groupings){
|
142 |
groupings.select('select', 'input').invoke('writeAttribute', 'disabled', 'disabled');
|
143 |
}
|
144 |
}
|
145 |
|
146 |
-
chk.observe('change', function(){
|
147 |
|
148 |
-
var groupings = $('interest_groupings_'+this.value);
|
149 |
-
if(groupings){
|
150 |
var elements = groupings.select('select', 'input');
|
151 |
-
if(this.checked){
|
152 |
elements.invoke('removeAttribute', 'disabled');
|
153 |
-
}else{
|
154 |
elements.invoke('writeAttribute', 'disabled', 'disabled');
|
155 |
}
|
156 |
}
|
@@ -158,66 +203,66 @@ $force = $this->getForce();
|
|
158 |
});
|
159 |
});
|
160 |
//If force subscription or checked by default set the elements as clicked
|
161 |
-
<?php if($auto):?>addSubscribeToPost($('magemonkey-trigger'));
|
162 |
<?php if($this->getCanModify() && is_array($generalList['interest_groupings'])): ?>
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
173 |
<?php endif; ?>
|
174 |
-
<?php endif; ?>
|
175 |
-
<?php if($auto):
|
176 |
-
foreach($lists as $list):
|
177 |
-
$string = "magemonkey-trigger-".$list['id'];
|
178 |
-
?>addSubscribeToPost($(<?php Print(json_encode($string)); ?>));
|
179 |
-
<?php if(is_array($list['interest_groupings'])): ?>
|
180 |
-
<?php foreach($list['interest_groupings'] as $group): ?>
|
181 |
-
<?php foreach($group['groups'] as $g): ?>
|
182 |
-
<?php $idToAdd = $this->getGroupId($g, TRUE); ?>
|
183 |
-
<?php if($idToAdd): ?>
|
184 |
-
if($(<?php Print(json_encode($idToAdd));?>)) {
|
185 |
-
addGroupToPost($(<?php Print(json_encode($idToAdd));?>));
|
186 |
-
}
|
187 |
-
|
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) or ($check === 4));
|
7 |
$force = $this->getForce();
|
8 |
?>
|
9 |
<script type="text/javascript">
|
10 |
+
addSubscribeToPost = function (element) {
|
11 |
|
12 |
//save old clicked lists and then removes element
|
13 |
var subscribeValue = '';
|
14 |
+
if ($('magemonkey-subscribe')) {
|
15 |
var checkedLists = $('magemonkey-subscribe').getValue();
|
16 |
+
subscribeValue = checkedLists + ',';
|
17 |
$('magemonkey-subscribe').remove();
|
18 |
}
|
19 |
|
20 |
//if checked add this element else remove it
|
21 |
+
if (element.checked) {
|
22 |
+
var inputer = new Element('input', {
|
23 |
+
name: "magemonkey_subscribe",
|
24 |
+
id: "magemonkey-subscribe",
|
25 |
+
value: subscribeValue + element.readAttribute('value'),
|
26 |
+
type: "hidden"
|
27 |
+
});
|
28 |
+
var listValue = new Element('input', {
|
29 |
+
name: element.readAttribute('name'),
|
30 |
+
id: "subscribe-" + element.readAttribute('value'),
|
31 |
+
value: element.readAttribute('value'),
|
32 |
+
type: "hidden"
|
33 |
+
});
|
34 |
+
var force = new Element('input', {
|
35 |
+
name: "magemonkey_force",
|
36 |
+
id: "magemonkey-force",
|
37 |
+
value: "1",
|
38 |
+
type: "hidden"
|
39 |
+
});
|
40 |
+
try {
|
41 |
Element.insert(Form.findFirstElement(payment.form), inputer);
|
42 |
Element.insert(Form.findFirstElement(payment.form), listValue);
|
43 |
<?php if($force): ?>
|
44 |
Element.insert(Form.findFirstElement(payment.form), force);
|
45 |
<?php endif; ?>
|
46 |
+
} catch (notelem) {
|
47 |
$("co-payment-form").insert(inputer);
|
48 |
$("co-payment-form").insert(listValue);
|
49 |
}
|
50 |
+
} else {
|
51 |
var arrCheckedLists = checkedLists.split(',');
|
52 |
var pos = arrCheckedLists.indexOf(element.readAttribute('value'));
|
53 |
+
if (pos != -1) {
|
54 |
arrCheckedLists.splice(pos, 1);
|
55 |
checkedLists = arrCheckedLists.join(',');
|
56 |
+
var inputer = new Element('input', {
|
57 |
+
name: "magemonkey_subscribe",
|
58 |
+
id: "magemonkey-subscribe",
|
59 |
+
value: checkedLists,
|
60 |
+
type: "hidden"
|
61 |
+
});
|
62 |
+
try {
|
63 |
Element.insert(Form.findFirstElement(payment.form), inputer);
|
64 |
+
} catch (notelem) {
|
65 |
$("co-payment-form").insert(inputer);
|
66 |
}
|
67 |
}
|
69 |
}
|
70 |
|
71 |
}
|
72 |
+
addGroupToPost = function (element) {
|
73 |
|
74 |
+
if (element.checked) {
|
75 |
|
76 |
+
try {
|
77 |
+
var group = new Element('input', {
|
78 |
+
name: element.readAttribute('name'),
|
79 |
+
id: "subscribe" + element.readAttribute('id'),
|
80 |
+
value: element.getValue(),
|
81 |
+
checked: true,
|
82 |
+
type: "checkbox"
|
83 |
+
});
|
84 |
Element.insert(Form.findFirstElement(payment.form), group);
|
85 |
+
} catch (notelem) {
|
86 |
$("co-payment-form").insert(group);
|
87 |
}
|
88 |
+
} else {
|
89 |
+
if ($("subscribe" + element.readAttribute('id'))) {
|
90 |
+
$("subscribe" + element.readAttribute('id')).remove();
|
91 |
}
|
92 |
}
|
93 |
}
|
94 |
+
addElementToPost = function (element) {
|
95 |
var formInputId = element.readAttribute('id') + '-serialize';
|
96 |
+
if ($(formInputId)) {
|
97 |
$(formInputId).remove();
|
98 |
}
|
99 |
|
100 |
+
var inp = new Element('input', {
|
101 |
+
name: element.readAttribute('name'),
|
102 |
+
id: formInputId,
|
103 |
+
value: element.getValue(),
|
104 |
+
type: "hidden"
|
105 |
+
});
|
106 |
|
107 |
+
Element.insert(Form.findFirstElement(payment.form), inp);
|
108 |
|
109 |
}
|
110 |
</script>
|
111 |
+
<div class="buttons-set"<?php if ($check === 3): ?> style="display:none;"<?php endif; ?>>
|
112 |
<!-- General Subscription -->
|
113 |
<div class="page-title">
|
114 |
<h1><?php echo $this->__('Newsletter Subscription'); ?></h1>
|
117 |
<div class="monkey-multisubscribe">
|
118 |
<ul class="monkey-general-list">
|
119 |
<li class="listdata"><?php echo $generalList['name']; ?>
|
120 |
+
<input<?php if ($auto): ?> checked="checked"<?php endif; ?> type="checkbox"
|
121 |
+
onchange="addSubscribeToPost(this);"
|
122 |
+
name="list[<?php echo $generalList['id'] ?>][subscribed]"
|
123 |
+
id="magemonkey-trigger"
|
124 |
+
value="<?php echo $generalList['id']; ?>"
|
125 |
+
title="<?php echo $generalList['name']; ?>"
|
126 |
+
class="monkey-list-subscriber"/>
|
127 |
+
<?php if (is_array($generalList['interest_groupings']) && $this->getCanModify() == 1): ?>
|
128 |
<div id="interest_groupings_<?php echo $generalList['id']; ?>" class="interest-groupings">
|
129 |
+
<?php foreach ($generalList['interest_groupings'] as $group): ?>
|
130 |
+
<?php if ($group['name'] != 'MAGE_CUSTOMER_GROUPS'): ?>
|
131 |
<div class="grouping">
|
132 |
+
<?php if ($group['form_field'] != 'hidden'): ?>
|
133 |
+
<strong><?php echo $group['name']; ?></strong><?php endif; ?>
|
134 |
<?php echo $this->renderGroup($group, $generalList, $auto); ?>
|
135 |
</div>
|
136 |
<?php endif; ?>
|
145 |
<!-- Additional Lists -->
|
146 |
<ul class="monkey-additional-lists">
|
147 |
<?php
|
148 |
+
foreach ($lists as $list):
|
149 |
|
150 |
$igroups = $list['interest_groupings'];
|
151 |
?>
|
152 |
<li class="listdata"><?php echo $list['name']; ?>
|
153 |
+
<input<?php if ($auto): ?> checked="checked"<?php endif; ?> type="checkbox"
|
154 |
+
onchange="addSubscribeToPost(this);"
|
155 |
+
name="list[<?php echo $list['id'] ?>][subscribed]"
|
156 |
+
id="magemonkey-trigger-<?php echo $list['id']; ?>"
|
157 |
+
value="<?php echo $list['id']; ?>"
|
158 |
+
title="<?php echo $list['name']; ?>"
|
159 |
+
class="monkey-list-subscriber"/>
|
160 |
+
<?php if (is_array($igroups)): ?>
|
161 |
<div id="interest_groupings_<?php echo $list['id']; ?>" class="interest-groupings">
|
162 |
+
<?php foreach ($igroups as $group): ?>
|
163 |
+
<?php if ($group['name'] != 'MAGE_CUSTOMER_GROUPS'): ?>
|
164 |
<div class="grouping">
|
165 |
+
<?php if ($group['form_field'] != 'hidden'): ?>
|
166 |
+
<strong><?php echo $group['name']; ?></strong><?php endif; ?>
|
167 |
<?php echo $this->renderGroup($group, $list, $auto); ?>
|
168 |
</div>
|
169 |
<?php endif; ?>
|
179 |
|
180 |
<script type="text/javascript">
|
181 |
//Handle newsletter subscribe/unsubscribe checkbox events
|
182 |
+
$$('input.monkey-list-subscriber').each(function (chk) {
|
183 |
|
184 |
+
if (!chk.checked) {
|
185 |
+
var groupings = $('interest_groupings_' + chk.value);
|
186 |
+
if (groupings) {
|
187 |
groupings.select('select', 'input').invoke('writeAttribute', 'disabled', 'disabled');
|
188 |
}
|
189 |
}
|
190 |
|
191 |
+
chk.observe('change', function () {
|
192 |
|
193 |
+
var groupings = $('interest_groupings_' + this.value);
|
194 |
+
if (groupings) {
|
195 |
var elements = groupings.select('select', 'input');
|
196 |
+
if (this.checked) {
|
197 |
elements.invoke('removeAttribute', 'disabled');
|
198 |
+
} else {
|
199 |
elements.invoke('writeAttribute', 'disabled', 'disabled');
|
200 |
}
|
201 |
}
|
203 |
});
|
204 |
});
|
205 |
//If force subscription or checked by default set the elements as clicked
|
206 |
+
<?php if($auto):?>addSubscribeToPost($('magemonkey-trigger'));
|
207 |
<?php if($this->getCanModify() && is_array($generalList['interest_groupings'])): ?>
|
208 |
+
<?php foreach($generalList['interest_groupings'] as $group): ?>
|
209 |
+
<?php foreach($group['groups'] as $g): ?>
|
210 |
+
<?php $idToAdd = $this->getGroupId($g, TRUE); ?>
|
211 |
+
<?php if($idToAdd): ?>
|
212 |
+
if ($(<?php Print(json_encode($idToAdd));?>)) {
|
213 |
+
addGroupToPost($(<?php Print(json_encode($idToAdd));?>));
|
214 |
+
}
|
215 |
+
<?php endif; ?>
|
216 |
+
<?php endforeach; ?>
|
217 |
+
<?php endforeach; ?>
|
218 |
+
<?php endif; ?>
|
219 |
+
<?php endif; ?>
|
220 |
+
<?php if($auto):
|
221 |
+
foreach($lists as $list):
|
222 |
+
$string = "magemonkey-trigger-".$list['id'];
|
223 |
+
?>addSubscribeToPost($(<?php Print(json_encode($string)); ?>));
|
224 |
+
<?php if(is_array($list['interest_groupings'])): ?>
|
225 |
+
<?php foreach($list['interest_groupings'] as $group): ?>
|
226 |
+
<?php foreach($group['groups'] as $g): ?>
|
227 |
+
<?php $idToAdd = $this->getGroupId($g, TRUE); ?>
|
228 |
+
<?php if($idToAdd): ?>
|
229 |
+
if ($(<?php Print(json_encode($idToAdd));?>)) {
|
230 |
+
addGroupToPost($(<?php Print(json_encode($idToAdd));?>));
|
231 |
+
}
|
232 |
<?php endif; ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|