Version Notes
Transactional Emails, Custom Customer Attributes, Reports & More
This release includes some great new functionality as well as including a number of fixes.
##IMPORTANT## Dynamic content URL's have been changed so will need updating within your dotMailer account to ensure they continue working correctly. ##IMPORTANT##
Release Highlights:
+ Transactional Emails: Replace the standard emails Magento currently sends to your customers and guests with beautifully created campaigns from dotMailer. Emails include new account, new order, dispatch, cancel and refund emails. **A dotMailer child account is required to enable this functionality**
+ Custom Customer Attributes: Sync your custom created customer attributes to dotMailer
+ Dynamic Content Styling: Apply custom CSS to all dynamic content pages e.g. font size, colour and type.
+ Reporting: Now within the Newsletter section in Magento you can view the import status of contacts and orders, as well as the sending status of transactional and lost basket emails.
Release Info
Developer | Calin Diacon |
Extension | dotmailermagento |
Version | 3.0.3 |
Comparing to | |
See all releases |
Code changes from version 1.5.1 to 3.0.3
- app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/Campaign.php +18 -0
- app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/Campaign/Edit.php +39 -0
- app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/Campaign/Edit/Form.php +54 -0
- app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/Campaign/Grid.php +164 -0
- app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/Column/Renderer/Imported.php +16 -0
- app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/Column/Renderer/Status.php +18 -0
- app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/Column/Renderer/Sync.php +16 -0
- app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/Config/Customdatafields.php +112 -0
- app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/Config/Select.php +14 -0
- app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/Contact.php +18 -0
- app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/Contact/Edit.php +36 -0
- app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/Contact/Edit/Form.php +26 -0
- app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/Contact/Grid.php +207 -0
- app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/Dashboard.php +41 -0
- app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/Dashboard/Content.php +11 -0
- app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/Order.php +15 -0
- app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/Order/Grid.php +95 -0
- app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/Sales/Order/Creditmemo/View.php +196 -0
- app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Advanced/Deletecontactids.php +22 -0
- app/code/{local/Dotdigitalgroup/Email/Block/Debug/Countcontacts.php → community/Dotdigitalgroup/Email/Block/Adminhtml/System/Advanced/Reimportorders.php} +7 -6
- app/code/{local/Dotdigitalgroup/Email/Block/Debug/Initialsync.php → community/Dotdigitalgroup/Email/Block/Adminhtml/System/Advanced/Reimportsubscribers.php} +9 -7
- app/code/{local/Dotdigitalgroup/Email/Block/Debug/Deletecontacts.php → community/Dotdigitalgroup/Email/Block/Adminhtml/System/Advanced/Setupdatafields.php} +7 -5
- app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Advanced/Suppressedcontacts.php +23 -0
- app/code/{local/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Password.php → community/Dotdigitalgroup/Email/Block/Adminhtml/System/Ajaxvalidate.php} +1 -1
- app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Automation/Connect.php +44 -0
- app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Addressbook.php +38 -0
- app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Datafield.php +40 -0
- app/code/{local → community}/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Validator.php +11 -11
- app/code/{local → community}/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Waitingfield.php +26 -6
- app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Wrapper.php +59 -0
- app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Dynamic/Addressbookbutton.php +22 -0
- app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Dynamic/Bestsellers.php +25 -0
- app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Dynamic/Couponinfo.php +27 -0
- app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Dynamic/Creditmemonew.php +28 -0
- app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Dynamic/Crosssell.php +26 -0
- app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Dynamic/Datafieldbutton.php +21 -0
- app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Dynamic/Gridlist.php +106 -0
- app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Dynamic/Lostbasket.php +25 -0
- app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Dynamic/Mostviewed.php +24 -0
- app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Dynamic/Productpush.php +24 -0
- app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Dynamic/Recentlyviewed.php +24 -0
- app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Dynamic/Related.php +26 -0
- app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Dynamic/Upsell.php +24 -0
- app/code/{local/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Wrapper.php → community/Dotdigitalgroup/Email/Block/Adminhtml/System/Emailapivalidate.php} +8 -6
- app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Sms/Smsmessagefour.php +24 -0
- app/code/{local/Dotdigitalgroup/Email/Block/Adminhtml/System/Config → community/Dotdigitalgroup/Email/Block/Adminhtml/System/Sms}/Smsmessageone.php +13 -8
- app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Sms/Smsmessagethree.php +26 -0
- app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Sms/Smsmessagetwo.php +25 -0
- app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Url/Creditmemoupdate.php +32 -0
- app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Url/Creditmemoupdateguest.php +30 -0
- app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Url/Customerconfirmation.php +36 -0
- app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Url/Customerconfirmed.php +36 -0
- app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Url/Customernew.php +36 -0
- app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Url/Invoiceupdate.php +33 -0
- app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Url/Invoiceupdateguest.php +33 -0
- app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Url/Newcreditmemo.php +36 -0
- app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Url/Newcreditmemoguest.php +35 -0
- app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Url/Newinvoice.php +34 -0
- app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Url/Newinvoiceguest.php +34 -0
- app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Url/Neworder.php +33 -0
- app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Url/Neworderguest.php +32 -0
- app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Url/Newshipment.php +34 -0
- app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Url/Newshipmentguest.php +33 -0
- app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Url/Orderupdate.php +31 -0
- app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Url/Orderupdateguest.php +31 -0
- app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Url/Shipmentupdate.php +33 -0
- app/code/community/Dotdigitalgroup/Email/Block/Adminhtml/System/Url/Shipmentupdateguest.php +32 -0
- app/code/{local → community}/Dotdigitalgroup/Email/Block/Basket.php +23 -8
- app/code/{local → community}/Dotdigitalgroup/Email/Block/Coupon.php +12 -11
- app/code/community/Dotdigitalgroup/Email/Block/Customer.php +96 -0
- app/code/community/Dotdigitalgroup/Email/Block/Order.php +41 -0
- app/code/community/Dotdigitalgroup/Email/Block/Order/Creditmemo.php +48 -0
- app/code/community/Dotdigitalgroup/Email/Block/Order/Invoice.php +39 -0
- app/code/community/Dotdigitalgroup/Email/Block/Order/Shipping.php +48 -0
- app/code/community/Dotdigitalgroup/Email/Block/Products.php +65 -0
- app/code/community/Dotdigitalgroup/Email/Block/Recommended/Bestsellers.php +70 -0
- app/code/community/Dotdigitalgroup/Email/Block/Recommended/Mostviewed.php +65 -0
- app/code/community/Dotdigitalgroup/Email/Block/Recommended/Products.php +140 -0
- app/code/community/Dotdigitalgroup/Email/Block/Recommended/Push.php +66 -0
- app/code/community/Dotdigitalgroup/Email/Block/Recommended/Recentlyviewed.php +73 -0
- app/code/community/Dotdigitalgroup/Email/Helper/Config.php +81 -0
- app/code/community/Dotdigitalgroup/Email/Helper/Data.php +238 -0
- app/code/{local → community}/Dotdigitalgroup/Email/Helper/File.php +43 -29
- app/code/community/Dotdigitalgroup/Email/Helper/Recommended.php +178 -0
- app/code/community/Dotdigitalgroup/Email/Helper/Transactional.php +156 -0
- app/code/community/Dotdigitalgroup/Email/Model/Abstract/Rest.php +435 -0
- app/code/community/Dotdigitalgroup/Email/Model/Adminhtml/Observer.php +93 -0
- app/code/community/Dotdigitalgroup/Email/Model/Adminhtml/Source/Addressbooks.php +44 -0
- app/code/{local/Dotdigitalgroup/Email/Model/System/Config/Source/Orderlimit.php → community/Dotdigitalgroup/Email/Model/Adminhtml/Source/Advanced/Transdata.php} +1 -1
- app/code/community/Dotdigitalgroup/Email/Model/Adminhtml/Source/Campaigns.php +43 -0
- app/code/community/Dotdigitalgroup/Email/Model/Adminhtml/Source/Contact/Imported.php +17 -0
- app/code/community/Dotdigitalgroup/Email/Model/Adminhtml/Source/Customer/Attributes/Select.php +34 -0
- app/code/community/Dotdigitalgroup/Email/Model/Adminhtml/Source/Datafields.php +45 -0
- app/code/community/Dotdigitalgroup/Email/Model/Adminhtml/Source/Datamapping/Datafieldtype.php +22 -0
- app/code/{local/Dotdigitalgroup/Email/Model/System/Config/Source → community/Dotdigitalgroup/Email/Model/Adminhtml/Source/Dynamic}/Displaytype.php +7 -2
- app/code/{local/Dotdigitalgroup/Email/Model/System/Config/Source → community/Dotdigitalgroup/Email/Model/Adminhtml/Source/Dynamic}/Gridview.php +6 -1
- app/code/community/Dotdigitalgroup/Email/Model/Adminhtml/Source/Lostbaskets/Interval.php +38 -0
- app/code/{local/Dotdigitalgroup/Email/Model/System/Config/Source/Lostbasket.php → community/Dotdigitalgroup/Email/Model/Adminhtml/Source/Lostbaskets/Intervalminute.php} +1 -1
- app/code/community/Dotdigitalgroup/Email/Model/Adminhtml/Source/Transactional/Campaigns.php +44 -0
- app/code/community/Dotdigitalgroup/Email/Model/Apiconnector/Client.php +691 -0
- app/code/community/Dotdigitalgroup/Email/Model/Apiconnector/Contact.php +362 -0
- app/code/community/Dotdigitalgroup/Email/Model/Apiconnector/Customer.php +501 -0
- app/code/community/Dotdigitalgroup/Email/Model/Apiconnector/Test.php +78 -0
- app/code/community/Dotdigitalgroup/Email/Model/Campaign.php +232 -0
- app/code/{local → community}/Dotdigitalgroup/Email/Model/Connector/Account.php +10 -8
- app/code/community/Dotdigitalgroup/Email/Model/Connector/Campaign.php +100 -0
- app/code/community/Dotdigitalgroup/Email/Model/Connector/Datafield.php +308 -0
- app/code/community/Dotdigitalgroup/Email/Model/Connector/Order.php +194 -0
- app/code/community/Dotdigitalgroup/Email/Model/Contact.php +169 -0
- app/code/community/Dotdigitalgroup/Email/Model/Cron.php +69 -0
- app/code/community/Dotdigitalgroup/Email/Model/Customer/Guest.php +55 -0
- app/code/community/Dotdigitalgroup/Email/Model/Customer/Observer.php +93 -0
- app/code/community/Dotdigitalgroup/Email/Model/Customer/Wishlist.php +94 -0
- app/code/{local → community}/Dotdigitalgroup/Email/Model/Customer/Wishlist/Item.php +24 -11
- app/code/community/Dotdigitalgroup/Email/Model/Email/Template.php +27 -0
- app/code/community/Dotdigitalgroup/Email/Model/Email/Template/Mailer.php +146 -0
- app/code/community/Dotdigitalgroup/Email/Model/Newsletter/Observer.php +70 -0
- app/code/community/Dotdigitalgroup/Email/Model/Newsletter/Subscriber.php +142 -0
- app/code/community/Dotdigitalgroup/Email/Model/Order.php +80 -0
- app/code/community/Dotdigitalgroup/Email/Model/Resource/Campaign.php +13 -0
- app/code/community/Dotdigitalgroup/Email/Model/Resource/Campaign/Collection.php +13 -0
- app/code/community/Dotdigitalgroup/Email/Model/Resource/Contact.php +14 -0
- app/code/community/Dotdigitalgroup/Email/Model/Resource/Contact/Collection.php +25 -0
- app/code/community/Dotdigitalgroup/Email/Model/Resource/Order.php +12 -0
- app/code/community/Dotdigitalgroup/Email/Model/Resource/Order/Collection.php +18 -0
- app/code/community/Dotdigitalgroup/Email/Model/Resource/Setup.php +26 -0
- app/code/community/Dotdigitalgroup/Email/Model/Sales/Observer.php +141 -0
- app/code/community/Dotdigitalgroup/Email/Model/Sales/Order.php +140 -0
- app/code/community/Dotdigitalgroup/Email/Model/Sales/Quote.php +173 -0
- app/code/community/Dotdigitalgroup/Email/Model/Sms/Campaign.php +112 -0
- app/code/community/Dotdigitalgroup/Email/controllers/Adminhtml/ConnectorController.php +158 -0
- app/code/community/Dotdigitalgroup/Email/controllers/Adminhtml/Email/AutomationController.php +109 -0
- app/code/community/Dotdigitalgroup/Email/controllers/Adminhtml/Email/CampaignController.php +218 -0
- app/code/community/Dotdigitalgroup/Email/controllers/Adminhtml/Email/ContactController.php +192 -0
- app/code/community/Dotdigitalgroup/Email/controllers/Adminhtml/Email/DashboardController.php +21 -0
- app/code/community/Dotdigitalgroup/Email/controllers/Adminhtml/Email/OrderController.php +26 -0
- app/code/community/Dotdigitalgroup/Email/controllers/CreditmemoController.php +91 -0
- app/code/community/Dotdigitalgroup/Email/controllers/CustomerController.php +38 -0
- app/code/community/Dotdigitalgroup/Email/controllers/EmailController.php +81 -0
- app/code/community/Dotdigitalgroup/Email/controllers/InvoiceController.php +71 -0
- app/code/community/Dotdigitalgroup/Email/controllers/OrderController.php +70 -0
- app/code/community/Dotdigitalgroup/Email/controllers/ProductsController.php +71 -0
- app/code/community/Dotdigitalgroup/Email/controllers/ReportController.php +63 -0
- app/code/community/Dotdigitalgroup/Email/controllers/ShippingController.php +79 -0
- app/code/community/Dotdigitalgroup/Email/etc/adminhtml.xml +145 -0
- app/code/community/Dotdigitalgroup/Email/etc/config.xml +457 -0
- app/code/{local → community}/Dotdigitalgroup/Email/etc/system.xml +1028 -590
- app/code/{local/Dotdigitalgroup/Email/sql/connector_setup → community/Dotdigitalgroup/Email/sql/email_connector_setup}/mysql4-install-0.1.0.php +4 -11
- app/code/community/Dotdigitalgroup/Email/sql/email_connector_setup/mysql4-install-3.0.0.php +287 -0
- app/code/{local/Dotdigitalgroup/Email/sql/connector_setup → community/Dotdigitalgroup/Email/sql/email_connector_setup}/mysql4-upgrade-1.1.1-1.1.2.php +0 -0
- app/code/community/Dotdigitalgroup/Email/sql/email_connector_setup/mysql4-upgrade-1.1.2-1.5.0.php +8 -0
- app/code/community/Dotdigitalgroup/Email/sql/email_connector_setup/mysql4-upgrade-1.5.0-2.0.0.php +75 -0
- app/code/community/Dotdigitalgroup/Email/sql/email_connector_setup/mysql4-upgrade-2.0.0-2.0.1.php +9 -0
- app/code/community/Dotdigitalgroup/Email/sql/email_connector_setup/mysql4-upgrade-2.0.1-2.0.2.php +52 -0
- app/code/community/Dotdigitalgroup/Email/sql/email_connector_setup/mysql4-upgrade-2.0.3-2.0.4.php +28 -0
- app/code/community/Dotdigitalgroup/Email/sql/email_connector_setup/mysql4-upgrade-2.0.4-2.0.5.php +9 -0
- app/code/community/Dotdigitalgroup/Email/sql/email_connector_setup/mysql4-upgrade-2.0.5-2.0.6.php +103 -0
- app/code/community/Dotdigitalgroup/Email/sql/email_connector_setup/mysql4-upgrade-3.0.1-3.0.2.php +18 -0
- app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Bestsellers.php +0 -18
- app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Gridlist.php +0 -104
- app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Insertvariable.php +0 -13
- app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Messagedefault.php +0 -46
- app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Smsmessagefour.php +0 -23
- app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Smsmessagethree.php +0 -23
- app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Smsmessagetwo.php +0 -23
- app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Couponinfo.php +0 -18
- app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Crosssell.php +0 -20
- app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Lostbasket.php +0 -19
- app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Mostviewed.php +0 -18
- app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Productpush.php +0 -19
- app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Recentlyviewed.php +0 -20
- app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Related.php +0 -19
- app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Upsell.php +0 -19
- app/code/local/Dotdigitalgroup/Email/Block/Debug/Forcecustomersync.php +0 -21
- app/code/local/Dotdigitalgroup/Email/Block/Debug/Forcelostbasketsync.php +0 -21
- app/code/local/Dotdigitalgroup/Email/Block/Debug/Forcesuppressedsync.php +0 -21
- app/code/local/Dotdigitalgroup/Email/Block/Debug/Rescuenow.php +0 -21
- app/code/local/Dotdigitalgroup/Email/Block/Debug/Testcredentials.php +0 -21
- app/code/local/Dotdigitalgroup/Email/Block/Debug/Transactionalsync.php +0 -20
- app/code/local/Dotdigitalgroup/Email/Block/Products.php +0 -53
- app/code/local/Dotdigitalgroup/Email/Helper/Api/DotNetExample.php +0 -182
- app/code/local/Dotdigitalgroup/Email/Helper/Api/Restrequest.php +0 -298
- app/code/local/Dotdigitalgroup/Email/Helper/Data.php +0 -96
- app/code/local/Dotdigitalgroup/Email/Helper/Recommended.php +0 -191
- app/code/local/Dotdigitalgroup/Email/Model/Account/Test.php +0 -40
- app/code/local/Dotdigitalgroup/Email/Model/Api/Rest.php +0 -729
- app/code/local/Dotdigitalgroup/Email/Model/Connector/Customer.php +0 -286
- app/code/local/Dotdigitalgroup/Email/Model/Connector/Order.php +0 -118
- app/code/local/Dotdigitalgroup/Email/Model/Connector/Quote.php +0 -75
- app/code/local/Dotdigitalgroup/Email/Model/Connector/Wishlist.php +0 -86
- app/code/local/Dotdigitalgroup/Email/Model/Cron.php +0 -58
- app/code/local/Dotdigitalgroup/Email/Model/Customer/Customer.php +0 -480
- app/code/local/Dotdigitalgroup/Email/Model/Customer/Suppressed.php +0 -85
- app/code/local/Dotdigitalgroup/Email/Model/Dynamic/Product/Mapper.php +0 -90
- app/code/local/Dotdigitalgroup/Email/Model/Dynamic/Recommended.php +0 -228
- app/code/local/Dotdigitalgroup/Email/Model/Newsletter/Subscriber.php +0 -19
- app/code/local/Dotdigitalgroup/Email/Model/Observer.php +0 -189
- app/code/local/Dotdigitalgroup/Email/Model/Order.php +0 -33
- app/code/local/Dotdigitalgroup/Email/Model/Sales/Order.php +0 -96
- app/code/local/Dotdigitalgroup/Email/Model/Sales/Quote.php +0 -289
- app/code/local/Dotdigitalgroup/Email/Model/Sales/Sms.php +0 -70
- app/code/local/Dotdigitalgroup/Email/Model/System/Config/Backend/Syncschedule/Customer.php +0 -50
- app/code/local/Dotdigitalgroup/Email/Model/System/Config/Backend/Syncschedule/Suppressed.php +0 -54
- app/code/local/Dotdigitalgroup/Email/Model/System/Config/Source/Activebasket.php +0 -12
- app/code/local/Dotdigitalgroup/Email/Model/System/Config/Source/Addressbooks.php +0 -30
- app/code/local/Dotdigitalgroup/Email/Model/System/Config/Source/Campaigns.php +0 -30
- app/code/local/Dotdigitalgroup/Email/Model/System/Config/Source/Datafields.php +0 -35
- app/code/local/Dotdigitalgroup/Email/Model/System/Config/Source/Displayifnot.php +0 -12
- app/code/local/Dotdigitalgroup/Email/Model/System/Config/Source/Orderstatus.php +0 -16
- app/code/local/Dotdigitalgroup/Email/Model/System/Config/Source/Sendcampain.php +0 -30
- app/code/local/Dotdigitalgroup/Email/Model/System/Config/Source/Syncfrequency.php +0 -40
- app/code/local/Dotdigitalgroup/Email/Model/System/Config/Source/Timeperiod.php +0 -13
- app/code/local/Dotdigitalgroup/Email/Test/Model/Product.php +0 -18
- app/code/local/Dotdigitalgroup/Email/controllers/Adminhtml/DebugController.php +0 -125
- app/code/local/Dotdigitalgroup/Email/controllers/EmailController.php +0 -133
- app/code/local/Dotdigitalgroup/Email/etc/adminhtml.xml +0 -43
- app/code/local/Dotdigitalgroup/Email/etc/config.xml +0 -289
- app/code/local/Varien/Data/Collection.php +0 -818
- app/design/adminhtml/default/default/layout/connector/email.xml +78 -0
- app/design/adminhtml/default/default/template/connector/dashboard/accountbar.phtml +10 -0
- app/design/adminhtml/default/default/template/connector/dashboard/content.phtml +8 -0
- app/design/adminhtml/default/default/template/connector/dashboard/switcher.phtml +24 -0
- app/design/adminhtml/default/default/template/connector/grid.phtml +16 -0
- app/design/adminhtml/default/default/template/connector/system/config/createdatafield.phtml +17 -0
- app/design/frontend/base/default/layout/connector.xml +4 -12
- app/design/frontend/base/default/template/connector/basket.phtml +1 -1
- app/design/frontend/base/default/template/connector/creditmemo/items.phtml +140 -0
- app/design/frontend/base/default/template/connector/creditmemo/new.phtml +77 -0
- app/design/frontend/base/default/template/connector/creditmemo/newguest.phtml +78 -0
- app/design/frontend/base/default/template/connector/creditmemo/update.phtml +31 -0
- app/design/frontend/base/default/template/connector/creditmemo/updateguest.phtml +31 -0
- app/design/frontend/base/default/template/connector/customer.phtml +30 -0
- app/design/frontend/base/default/template/connector/invoice/new.phtml +86 -0
- app/design/frontend/base/default/template/connector/invoice/newguest.phtml +79 -0
- app/design/frontend/base/default/template/connector/invoice/update.phtml +33 -0
- app/design/frontend/base/default/template/connector/invoice/updateguest.phtml +33 -0
- app/design/frontend/base/default/template/connector/order/items.phtml +138 -0
- app/design/frontend/base/default/template/connector/order/new.phtml +78 -0
- app/design/frontend/base/default/template/connector/order/newguest.phtml +80 -0
- app/design/frontend/base/default/template/connector/order/update.phtml +32 -0
- app/design/frontend/base/default/template/connector/order/updateguest.phtml +33 -0
- app/design/frontend/base/default/template/connector/product/list.phtml +32 -0
- app/design/frontend/base/default/template/connector/{price.phtml → product/price.phtml} +0 -0
- app/design/frontend/base/default/template/connector/roi_code.phtml +11 -15
- app/design/frontend/base/default/template/connector/shipping/new.phtml +78 -0
- app/design/frontend/base/default/template/connector/shipping/newguest.phtml +79 -0
- app/design/frontend/base/default/template/connector/shipping/update.phtml +32 -0
- app/design/frontend/base/default/template/connector/shipping/updateguest.phtml +32 -0
- app/design/frontend/base/default/template/connector/tracking_code.phtml +11 -2
- app/design/frontend/base/default/template/page/blank.phtml +14 -1
- app/design/frontend/base/default/template/page/connector/products.phtml +0 -37
- app/etc/modules/Dotdigitalgroup_Email.xml +1 -1
- app/locale/en_US/Dotdigitalgroup_Email.csv +165 -0
- package.xml +19 -5
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_Campaign extends Mage_Adminhtml_Block_Widget_Grid_Container
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Set the template.
|
7 |
+
*/
|
8 |
+
public function __construct()
|
9 |
+
{
|
10 |
+
$this->_controller = 'adminhtml_campaign';
|
11 |
+
$this->_blockGroup = 'email_connector';
|
12 |
+
parent::__construct();
|
13 |
+
$this->_headerText = Mage::helper('connector')->__('Campaigns');
|
14 |
+
$this->_removeButton('add');
|
15 |
+
|
16 |
+
$this->setTemplate('connector/grid.phtml');
|
17 |
+
}
|
18 |
+
}
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_Campaign_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Construct.
|
7 |
+
*/
|
8 |
+
public function __construct()
|
9 |
+
{
|
10 |
+
parent::__construct();
|
11 |
+
$this->_blockGroup = 'email_connector';
|
12 |
+
$this->_controller = 'adminhtml_campaign';
|
13 |
+
$this->_mode = 'edit';
|
14 |
+
$this->_updateButton('save', 'label', Mage::helper('connector')->__('Save Campaign'));
|
15 |
+
$this->_updateButton('delete', 'label', Mage::helper('connector')->__('Delete Campaign'));
|
16 |
+
$this->_addButton('saveandcontinue', array(
|
17 |
+
'label' => Mage::helper('connector')->__('Save And Continue Edit'),
|
18 |
+
'onclick' => 'saveAndContinueEdit()',
|
19 |
+
'class' => 'save',
|
20 |
+
), -100);
|
21 |
+
$this->_formScripts[] = "
|
22 |
+
function saveAndContinueEdit(){
|
23 |
+
editForm.submit($('edit_form').action+'back/edit/');
|
24 |
+
}";
|
25 |
+
}
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Header text for the campaign.
|
29 |
+
* @return string
|
30 |
+
*/
|
31 |
+
public function getHeaderText()
|
32 |
+
{
|
33 |
+
if ( Mage::registry('email_campaign') && Mage::registry('email_campaign')->getId() ) {
|
34 |
+
return Mage::helper('connector')->__("Edit Campaign '%s'", $this->htmlEscape(Mage::registry('email_campaign')->getContact()));
|
35 |
+
} else {
|
36 |
+
return Mage::helper('connector')->__('Add Contact');
|
37 |
+
}
|
38 |
+
}
|
39 |
+
}
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_Campaign_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Init class
|
7 |
+
*/
|
8 |
+
public function __construct()
|
9 |
+
{
|
10 |
+
parent::__construct();
|
11 |
+
|
12 |
+
$this->setId('id');
|
13 |
+
$this->setTitle($this->__('Campaign Information'));
|
14 |
+
}
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Setup form fields for inserts/updates
|
18 |
+
*
|
19 |
+
* return Mage_Adminhtml_Block_Widget_Form
|
20 |
+
*/
|
21 |
+
protected function _prepareForm()
|
22 |
+
{
|
23 |
+
$model = Mage::registry('email_campaign');
|
24 |
+
|
25 |
+
$form = new Varien_Data_Form(array(
|
26 |
+
'id' => 'edit_form',
|
27 |
+
'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
|
28 |
+
'method' => 'post')
|
29 |
+
);
|
30 |
+
|
31 |
+
$fieldset = $form->addFieldset('base_fieldset', array(
|
32 |
+
'legend' => Mage::helper('connector')->__('Campaign Information')
|
33 |
+
));
|
34 |
+
|
35 |
+
if ($model->getId()) {
|
36 |
+
$fieldset->addField('id', 'hidden', array(
|
37 |
+
'name' => 'id',
|
38 |
+
));
|
39 |
+
}
|
40 |
+
|
41 |
+
$fieldset->addField('name', 'text', array(
|
42 |
+
'name' => 'name',
|
43 |
+
'label' => Mage::helper('connector')->__('Name'),
|
44 |
+
'title' => Mage::helper('connector')->__('Name'),
|
45 |
+
'required' => true,
|
46 |
+
));
|
47 |
+
|
48 |
+
$form->setValues($model->getData());
|
49 |
+
$form->setUseContainer(true);
|
50 |
+
$this->setForm($form);
|
51 |
+
|
52 |
+
return parent::_prepareForm();
|
53 |
+
}
|
54 |
+
}
|
@@ -0,0 +1,164 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_Campaign_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
4 |
+
{
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
parent::__construct();
|
8 |
+
$this->setId('id');
|
9 |
+
$this->setDefaultSort('entity_id');
|
10 |
+
$this->setDefaultDir('ASC');
|
11 |
+
$this->setSaveParametersInSession(true);
|
12 |
+
$this->setUseAjax(true);
|
13 |
+
}
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Prepare grid collection object.
|
17 |
+
* @return Mage_Adminhtml_Block_Widget_Grid
|
18 |
+
*/
|
19 |
+
protected function _prepareCollection()
|
20 |
+
{
|
21 |
+
$collection = Mage::getModel('email_connector/campaign')->getCollection();
|
22 |
+
$this->setCollection($collection);
|
23 |
+
$this->setDefaultSort('updated_at');
|
24 |
+
$this->setDefaultDir('DESC');
|
25 |
+
return parent::_prepareCollection();
|
26 |
+
}
|
27 |
+
|
28 |
+
protected function _prepareColumns()
|
29 |
+
{
|
30 |
+
$this->addColumn('id', array(
|
31 |
+
'header' => Mage::helper('connector')->__('Campaign ID'),
|
32 |
+
'width' => '20px',
|
33 |
+
'index' => 'id',
|
34 |
+
'type' => 'number',
|
35 |
+
'truncate' => 50,
|
36 |
+
'escape' => true,
|
37 |
+
))->addColumn('email', array(
|
38 |
+
'header' => Mage::helper('connector')->__('Email'),
|
39 |
+
'align' => 'left',
|
40 |
+
'width' => '50px',
|
41 |
+
'index' => 'email',
|
42 |
+
'type' => 'text',
|
43 |
+
'escape' => true
|
44 |
+
))->addColumn('is_sent', array(
|
45 |
+
'header' => Mage::helper('connector')->__('Is Sent'),
|
46 |
+
'align' => 'center',
|
47 |
+
'width' => '20px',
|
48 |
+
'index' => 'is_sent',
|
49 |
+
'escape' => true,
|
50 |
+
'type' => 'options',
|
51 |
+
'renderer' => 'email_connector/adminhtml_column_renderer_imported',
|
52 |
+
'options' => array(
|
53 |
+
'1' => 'Is Send',
|
54 |
+
'null' => 'Not Send'
|
55 |
+
),
|
56 |
+
'filter_condition_callback' => array($this, 'filterCallbackContact')
|
57 |
+
))->addColumn('order_increment_id', array(
|
58 |
+
'header' => Mage::helper('connector')->__('Increment ID'),
|
59 |
+
'align' => 'left',
|
60 |
+
'width' => '50px',
|
61 |
+
'index' => 'order_increment_id',
|
62 |
+
'type' => 'number',
|
63 |
+
'escape' => true
|
64 |
+
))->addColumn('message', array(
|
65 |
+
'header' => Mage::helper('connector')->__('Message'),
|
66 |
+
'align' => 'left',
|
67 |
+
'width' => '300px',
|
68 |
+
'index' => 'message',
|
69 |
+
'type' => 'text',
|
70 |
+
'escape' => true
|
71 |
+
))->addColumn('event_name', array(
|
72 |
+
'header' => Mage::helper('connector')->__('Event Name'),
|
73 |
+
'align' => 'left',
|
74 |
+
'index' => 'event_name',
|
75 |
+
'width' => '100px',
|
76 |
+
'type' => 'string',
|
77 |
+
'escape' => true,
|
78 |
+
))->addColumn('created_at', array(
|
79 |
+
'header' => Mage::helper('connector')->__('Created At'),
|
80 |
+
'align' => 'center',
|
81 |
+
'width' => '100px',
|
82 |
+
'index' => 'created_at',
|
83 |
+
'type' => 'datetime',
|
84 |
+
'escape' => true
|
85 |
+
))->addColumn('sent_at', array(
|
86 |
+
'header' => Mage::helper('connector')->__('Sent At'),
|
87 |
+
'align' => 'center',
|
88 |
+
'width' => '100px',
|
89 |
+
'index' => 'sent_at',
|
90 |
+
'type' => 'datetime',
|
91 |
+
'escape' => true
|
92 |
+
));
|
93 |
+
if (!Mage::app()->isSingleStoreMode()) {
|
94 |
+
$this->addColumn('website_id', array(
|
95 |
+
'header' => Mage::helper('customer')->__('Website'),
|
96 |
+
'align' => 'center',
|
97 |
+
'width' => '80px',
|
98 |
+
'type' => 'options',
|
99 |
+
'options' => Mage::getSingleton('adminhtml/system_store')->getWebsiteOptionHash(true),
|
100 |
+
'index' => 'website_id',
|
101 |
+
));
|
102 |
+
}
|
103 |
+
|
104 |
+
$this->addExportType('*/*/exportCsv', Mage::helper('connector')->__('CSV'));
|
105 |
+
return parent::_prepareColumns();
|
106 |
+
}
|
107 |
+
|
108 |
+
/**
|
109 |
+
* Get the store selected.
|
110 |
+
* @return Mage_Core_Model_Store
|
111 |
+
* @throws Exception
|
112 |
+
*/
|
113 |
+
protected function _getStore()
|
114 |
+
{
|
115 |
+
$storeId = (int) $this->getRequest()->getParam('store', 0);
|
116 |
+
return Mage::app()->getStore($storeId);
|
117 |
+
}
|
118 |
+
|
119 |
+
|
120 |
+
/**
|
121 |
+
* @return $this|Mage_Adminhtml_Block_Widget_Grid
|
122 |
+
*/
|
123 |
+
protected function _prepareMassaction()
|
124 |
+
{
|
125 |
+
$this->setMassactionIdField('id');
|
126 |
+
$this->getMassactionBlock()->setFormFieldName('campaign');
|
127 |
+
$this->getMassactionBlock()->addItem('delete', array (
|
128 |
+
'label'=> Mage::helper('connector')->__('Delete'),
|
129 |
+
'url' => $this->getUrl('*/*/massDelete'),
|
130 |
+
'confirm' => Mage::helper('connector')->__('Are you sure?')
|
131 |
+
)
|
132 |
+
);
|
133 |
+
|
134 |
+
$this->getMassactionBlock()->addItem('resend', array('label'=>Mage::helper('connector')->__('Resend'),'url'=>$this->getUrl('*/*/massResend')));
|
135 |
+
return $this;
|
136 |
+
}
|
137 |
+
|
138 |
+
/**
|
139 |
+
* Grid selected url.
|
140 |
+
* @return string
|
141 |
+
*/
|
142 |
+
public function getGridUrl()
|
143 |
+
{
|
144 |
+
return $this->getUrl('*/*/grid', array('_current'=>true));
|
145 |
+
}
|
146 |
+
/**
|
147 |
+
* Custom callback action for the campaign.
|
148 |
+
*
|
149 |
+
* @param $collection
|
150 |
+
* @param $column
|
151 |
+
*/
|
152 |
+
public function filterCallbackContact($collection, $column)
|
153 |
+
{
|
154 |
+
$field = $column->getFilterIndex() ? $column->getFilterIndex() : $column->getIndex();
|
155 |
+
$value = $column->getFilter()->getValue();
|
156 |
+
|
157 |
+
if ($value == 'null') {
|
158 |
+
$collection->addFieldToFilter($field, array('null' => true) );
|
159 |
+
} else {
|
160 |
+
$collection->addFieldToFilter($field, array('notnull' => true));
|
161 |
+
}
|
162 |
+
}
|
163 |
+
|
164 |
+
}
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_Column_Renderer_Imported extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Render grid columns.
|
7 |
+
* @param Varien_Object $row
|
8 |
+
*
|
9 |
+
* @return string
|
10 |
+
*/
|
11 |
+
public function render(Varien_Object $row)
|
12 |
+
{
|
13 |
+
return '<img style="padding-top:2px" '.(($this->_getValue($row)=='1' || $this->_getValue($row)==true) ? 'src="'.$this->getSkinUrl('images/success_msg_icon.gif').'" alt="YES" ' : 'src="'.
|
14 |
+
$this->getSkinUrl('images/error_msg_icon.gif').'" alt="NO" ').'>';
|
15 |
+
}
|
16 |
+
}
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_Column_Renderer_Status extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Render the grid columns.
|
7 |
+
*
|
8 |
+
* @param Varien_Object $row
|
9 |
+
* @return string
|
10 |
+
*/
|
11 |
+
public function render(Varien_Object $row)
|
12 |
+
{
|
13 |
+
if($this->getValue($row) == '1')
|
14 |
+
return 'Subscribed';
|
15 |
+
return 'Unsubscribed';
|
16 |
+
}
|
17 |
+
|
18 |
+
}
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_Column_Renderer_Sync extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Render the grid columns.
|
7 |
+
*
|
8 |
+
* @param Varien_Object $row
|
9 |
+
* @return string
|
10 |
+
*/
|
11 |
+
public function render(Varien_Object $row)
|
12 |
+
{
|
13 |
+
return '<button title="Connect" type="button" style=""><span><span><span>Sync Now</span></span></span></button>';
|
14 |
+
}
|
15 |
+
|
16 |
+
}
|
@@ -0,0 +1,112 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_Config_Customdatafields extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Customer attribute
|
7 |
+
*
|
8 |
+
*/
|
9 |
+
protected $_getAttributeRenderer;
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Datafields
|
13 |
+
*/
|
14 |
+
protected $_getDatafieldRenderer;
|
15 |
+
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Construct.
|
19 |
+
*/
|
20 |
+
public function __construct()
|
21 |
+
{
|
22 |
+
$this->_addAfter = false;
|
23 |
+
$this->_addButtonLabel = Mage::helper('adminhtml')->__('Add New Attribute');
|
24 |
+
parent::__construct();
|
25 |
+
|
26 |
+
}
|
27 |
+
|
28 |
+
protected function _prepareToRender()
|
29 |
+
{
|
30 |
+
$this->_getDatafieldRenderer = null;
|
31 |
+
$this->_getAttributeRenderer = null;
|
32 |
+
$this->addColumn('attribute',
|
33 |
+
array(
|
34 |
+
'label' => Mage::helper('adminhtml')->__('Attribute'),
|
35 |
+
'style' => 'width:120px',
|
36 |
+
)
|
37 |
+
);
|
38 |
+
$this->addColumn('datafield', array(
|
39 |
+
'label' => Mage::helper('adminhtml')->__('DataField'),
|
40 |
+
'style' => 'width:120px',
|
41 |
+
)
|
42 |
+
);
|
43 |
+
}
|
44 |
+
|
45 |
+
protected function _renderCellTemplate($columnName)
|
46 |
+
{
|
47 |
+
$inputName = $this->getElement()->getName() . '[#{_id}][' . $columnName . ']';
|
48 |
+
if ($columnName=="attribute") {
|
49 |
+
return $this->_getAttributeRenderer()
|
50 |
+
->setName($inputName)
|
51 |
+
->setTitle($columnName)
|
52 |
+
->setExtraParams('style="width:160px"')
|
53 |
+
->setOptions(
|
54 |
+
$this->getElement()->getValues()
|
55 |
+
)
|
56 |
+
->toHtml();
|
57 |
+
} elseif ($columnName == "datafield") {
|
58 |
+
return $this->_getDatafieldRenderer()
|
59 |
+
->setName($inputName)
|
60 |
+
->setTitle($columnName)
|
61 |
+
->setExtraParams('style="width:160px"')
|
62 |
+
->setOptions(Mage::getModel('email_connector/adminhtml_source_datafields')->toOptionArray())
|
63 |
+
->toHtml();
|
64 |
+
}
|
65 |
+
return parent::_renderCellTemplate($columnName);
|
66 |
+
}
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Assign extra parameters to row
|
70 |
+
*
|
71 |
+
* @param Varien_Object $row
|
72 |
+
*/
|
73 |
+
protected function _prepareArrayRow(Varien_Object $row)
|
74 |
+
{
|
75 |
+
|
76 |
+
$row->setData(
|
77 |
+
'option_extra_attr_' . $this->_getAttributeRenderer()->calcOptionHash($row->getData('attribute')),
|
78 |
+
'selected="selected"'
|
79 |
+
);
|
80 |
+
|
81 |
+
$row->setData(
|
82 |
+
'option_extra_attr_' . $this->_getDatafieldRenderer()->calcOptionHash($row->getData('datafield')),
|
83 |
+
'selected="selected"'
|
84 |
+
);
|
85 |
+
}
|
86 |
+
protected function _getAttributeRenderer()
|
87 |
+
{
|
88 |
+
if (!$this->_getAttributeRenderer) {
|
89 |
+
$this->_getAttributeRenderer = $this->getLayout()
|
90 |
+
->createBlock('email_connector/adminhtml_config_select')
|
91 |
+
->setIsRenderToJsTemplate(true);
|
92 |
+
}
|
93 |
+
return $this->_getAttributeRenderer;
|
94 |
+
}
|
95 |
+
|
96 |
+
protected function _getDatafieldRenderer()
|
97 |
+
{
|
98 |
+
if (!$this->_getDatafieldRenderer) {
|
99 |
+
$this->_getDatafieldRenderer = $this->getLayout()
|
100 |
+
->createBlock('email_connector/adminhtml_config_select')
|
101 |
+
->setIsRenderToJsTemplate(true);
|
102 |
+
}
|
103 |
+
return $this->_getDatafieldRenderer;
|
104 |
+
}
|
105 |
+
|
106 |
+
public function _toHtml()
|
107 |
+
{
|
108 |
+
return '<input type="hidden" id="'.$this->getElement()->getHtmlId().'"/>'.parent::_toHtml();
|
109 |
+
|
110 |
+
}
|
111 |
+
|
112 |
+
}
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_Config_Select extends Mage_Core_Block_Html_Select
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Return output in one line
|
7 |
+
*
|
8 |
+
* @return string
|
9 |
+
*/
|
10 |
+
public function _toHtml()
|
11 |
+
{
|
12 |
+
return trim(preg_replace('/\s+/', ' ',parent::_toHtml()));
|
13 |
+
}
|
14 |
+
}
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_Contact extends Mage_Adminhtml_Block_Widget_Grid_Container
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Set the template.
|
7 |
+
*/
|
8 |
+
public function __construct()
|
9 |
+
{
|
10 |
+
$this->_controller = 'adminhtml_contact';
|
11 |
+
$this->_blockGroup = 'email_connector';
|
12 |
+
parent::__construct();
|
13 |
+
$this->_headerText = Mage::helper('connector')->__('Contacts');
|
14 |
+
$this->_removeButton('add');
|
15 |
+
|
16 |
+
$this->setTemplate('connector/grid.phtml');
|
17 |
+
}
|
18 |
+
}
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_Contact_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
|
4 |
+
{
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
parent::__construct();
|
8 |
+
$this->_blockGroup = 'email_connector';
|
9 |
+
$this->_controller = 'adminhtml_contact';
|
10 |
+
$this->_updateButton('save', 'label', Mage::helper('connector')->__('Save Contact'));
|
11 |
+
$this->_updateButton('delete', 'label', Mage::helper('connector')->__('Delete Contact'));
|
12 |
+
$this->_addButton('saveandcontinue', array(
|
13 |
+
'label' => Mage::helper('connector')->__('Save And Continue Edit'),
|
14 |
+
'onclick' => 'saveAndContinueEdit()',
|
15 |
+
'class' => 'save',
|
16 |
+
), -100);
|
17 |
+
$this->_formScripts[] = "
|
18 |
+
function saveAndContinueEdit(){
|
19 |
+
editForm.submit($('edit_form').action+'back/edit/');
|
20 |
+
}
|
21 |
+
";
|
22 |
+
}
|
23 |
+
|
24 |
+
/**
|
25 |
+
* HEader text.
|
26 |
+
* @return string
|
27 |
+
*/
|
28 |
+
public function getHeaderText()
|
29 |
+
{
|
30 |
+
if ( Mage::registry('contact_data') && Mage::registry('contact_data')->getId() ) {
|
31 |
+
return Mage::helper('connnector')->__("Edit Contact '%s'", $this->htmlEscape(Mage::registry('contact_data')->getContact()));
|
32 |
+
} else {
|
33 |
+
return Mage::helper('connector')->__('Add Contact');
|
34 |
+
}
|
35 |
+
}
|
36 |
+
}
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_Contact_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
|
4 |
+
{
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Contact Form.
|
8 |
+
* @return Mage_Adminhtml_Block_Widget_Form
|
9 |
+
* @throws Exception
|
10 |
+
*/
|
11 |
+
protected function _prepareForm()
|
12 |
+
{
|
13 |
+
$form = new Varien_Data_Form(array(
|
14 |
+
'id' => 'edit_form',
|
15 |
+
'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'), 'store' => $this->getRequest()->getParam('store'))),
|
16 |
+
'method' => 'post',
|
17 |
+
'enctype' => 'multipart/form-data'
|
18 |
+
)
|
19 |
+
);
|
20 |
+
$form->setUseContainer(true);
|
21 |
+
|
22 |
+
$this->setForm($form);
|
23 |
+
return parent::_prepareForm();
|
24 |
+
}
|
25 |
+
|
26 |
+
}
|
@@ -0,0 +1,207 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_Contact_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
4 |
+
{
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
parent::__construct();
|
8 |
+
$this->setId('email_contact_id');
|
9 |
+
$this->setDefaultSort('entity_id');
|
10 |
+
$this->setDefaultDir('ASC');
|
11 |
+
$this->setSaveParametersInSession(true);
|
12 |
+
$this->setUseAjax(true);
|
13 |
+
}
|
14 |
+
|
15 |
+
protected function _prepareCollection()
|
16 |
+
{
|
17 |
+
$collection = Mage::getModel('email_connector/contact')->getCollection();
|
18 |
+
$this->setCollection($collection);
|
19 |
+
$this->setDefaultSort('updated_at');
|
20 |
+
$this->setDefaultDir('DESC');
|
21 |
+
return parent::_prepareCollection();
|
22 |
+
}
|
23 |
+
|
24 |
+
protected function _prepareColumns()
|
25 |
+
{
|
26 |
+
$this->addColumn('email_contact_id', array(
|
27 |
+
'header' => Mage::helper('connector')->__('Email Contact ID'),
|
28 |
+
'width' => '20px',
|
29 |
+
'index' => 'email_contact_id',
|
30 |
+
'type' => 'number',
|
31 |
+
'escape' => true,
|
32 |
+
))->addColumn('email', array(
|
33 |
+
'header' => Mage::helper('connector')->__('Email'),
|
34 |
+
'align' => 'left',
|
35 |
+
'width' => '50px',
|
36 |
+
'index' => 'email',
|
37 |
+
'type' => 'text',
|
38 |
+
'escape' => true
|
39 |
+
))->addColumn('is_guest', array(
|
40 |
+
'header' => Mage::helper('connector')->__('Is Guest'),
|
41 |
+
'align' => 'right',
|
42 |
+
'width' => '50px',
|
43 |
+
'index' => 'is_guest',
|
44 |
+
'type' => 'options',
|
45 |
+
'options' => array(
|
46 |
+
'1' => 'Guest',
|
47 |
+
'null' => 'Not Guest'
|
48 |
+
),
|
49 |
+
'escape' => true,
|
50 |
+
'filter_condition_callback' => array($this, 'filterCallbackContact')
|
51 |
+
))->addColumn('customer_id', array(
|
52 |
+
'header' => Mage::helper('connector')->__('Customer ID'),
|
53 |
+
'align' => 'left',
|
54 |
+
'width' => '20px',
|
55 |
+
'index' => 'customer_id',
|
56 |
+
'type' => 'number',
|
57 |
+
'escape' => true
|
58 |
+
))->addColumn('is_subscriber', array(
|
59 |
+
'header' => Mage::helper('connector')->__('Is Subscriber'),
|
60 |
+
'width' => '50px',
|
61 |
+
'align' => 'right',
|
62 |
+
'index' => 'is_subscriber',
|
63 |
+
'type' => 'options',
|
64 |
+
'options' => array(
|
65 |
+
'1' => 'Subscriber',
|
66 |
+
'null' => 'Not Subscriber'
|
67 |
+
),
|
68 |
+
'filter_condition_callback' => array($this, 'filterCallbackContact'),
|
69 |
+
'escape' => true,
|
70 |
+
))->addColumn('subscriber_status', array(
|
71 |
+
'header' => Mage::helper('connector')->__('Subscriber Status'),
|
72 |
+
'align' => 'center',
|
73 |
+
'width' => '50px',
|
74 |
+
'index' => 'subscriber_status',
|
75 |
+
'type' => 'options',
|
76 |
+
'options' => array(
|
77 |
+
'1' => 'Subscribed',
|
78 |
+
'2' => 'Not Active',
|
79 |
+
'3' => 'Unsubscribed',
|
80 |
+
'4' => 'Unconfirmed'
|
81 |
+
),
|
82 |
+
'escape' => true,
|
83 |
+
))->addColumn('email_imported', array(
|
84 |
+
'header' => Mage::helper('connector')->__('Email Imported'),
|
85 |
+
'width' => '20px',
|
86 |
+
'align' => 'center',
|
87 |
+
'index' => 'email_imported',
|
88 |
+
'escape' => true,
|
89 |
+
'type' => 'options',
|
90 |
+
'options' => Mage::getModel('email_connector/adminhtml_source_contact_imported')->getOptions(),
|
91 |
+
'renderer' => 'email_connector/adminhtml_column_renderer_imported',
|
92 |
+
'filter_condition_callback' => array($this, 'filterCallbackContact')
|
93 |
+
))->addColumn('subscriber_imported', array(
|
94 |
+
'header' => Mage::helper('connector')->__('Subscriber Imported'),
|
95 |
+
'width' => '20px',
|
96 |
+
'align' => 'center',
|
97 |
+
'index' => 'subscriber_imported',
|
98 |
+
'type' => 'options',
|
99 |
+
'escape' => true,
|
100 |
+
'renderer' => 'email_connector/adminhtml_column_renderer_imported',
|
101 |
+
'options' => Mage::getModel('email_connector/adminhtml_source_contact_imported')->getOptions(),
|
102 |
+
'filter_condition_callback' => array($this, 'filterCallbackContact')
|
103 |
+
))->addColumn('suppressed', array(
|
104 |
+
'header' => Mage::helper('connector')->__('Suppressed'),
|
105 |
+
'align' => 'right',
|
106 |
+
'width' => '50px',
|
107 |
+
'index' => 'suppressed',
|
108 |
+
'escape' => true,
|
109 |
+
'type' => 'options',
|
110 |
+
'options' => array(
|
111 |
+
'1' => 'Suppressed',
|
112 |
+
'null' => 'Not Suppressed'
|
113 |
+
),
|
114 |
+
'filter_condition_callback' => array($this, 'filterCallbackContact')
|
115 |
+
));
|
116 |
+
if (!Mage::app()->isSingleStoreMode()) {
|
117 |
+
$this->addColumn('website_id', array(
|
118 |
+
'header' => Mage::helper('customer')->__('Website'),
|
119 |
+
'align' => 'center',
|
120 |
+
'width' => '80px',
|
121 |
+
'type' => 'options',
|
122 |
+
'options' => Mage::getSingleton('adminhtml/system_store')->getWebsiteOptionHash(true),
|
123 |
+
'index' => 'website_id',
|
124 |
+
));
|
125 |
+
}
|
126 |
+
|
127 |
+
$this->addColumn('sync', array(
|
128 |
+
'header' => Mage::helper('connector')->__('Sync Contact'),
|
129 |
+
'align' => 'center',
|
130 |
+
'width' => '80px',
|
131 |
+
'renderer' => 'email_connector/adminhtml_column_renderer_sync'
|
132 |
+
|
133 |
+
));
|
134 |
+
|
135 |
+
$this->addExportType('*/*/exportCsv', Mage::helper('connector')->__('CSV'));
|
136 |
+
return parent::_prepareColumns();
|
137 |
+
}
|
138 |
+
|
139 |
+
/**
|
140 |
+
* Get the store.
|
141 |
+
*
|
142 |
+
* @return Mage_Core_Model_Store
|
143 |
+
* @throws Exception
|
144 |
+
*/
|
145 |
+
protected function _getStore()
|
146 |
+
{
|
147 |
+
$storeId = (int) $this->getRequest()->getParam('store', 0);
|
148 |
+
return Mage::app()->getStore($storeId);
|
149 |
+
}
|
150 |
+
|
151 |
+
/**
|
152 |
+
* Prepare the grid massaction.
|
153 |
+
* @return $this|Mage_Adminhtml_Block_Widget_Grid
|
154 |
+
*/
|
155 |
+
protected function _prepareMassaction()
|
156 |
+
{
|
157 |
+
$this->setMassactionIdField('email_contact_id');
|
158 |
+
$this->getMassactionBlock()->setFormFieldName('contact');
|
159 |
+
$this->getMassactionBlock()->addItem('delete', array(
|
160 |
+
'label'=> Mage::helper('connector')->__('Delete'),
|
161 |
+
'url' => $this->getUrl('*/*/massDelete'),
|
162 |
+
'confirm' => Mage::helper('connector')->__('Are you sure?')));
|
163 |
+
$this->getMassactionBlock()->addItem('resend', array(
|
164 |
+
'label' => Mage::helper('connector')->__('Resend'),
|
165 |
+
'url' => $this->getUrl('*/*/massResend'),
|
166 |
+
|
167 |
+
));
|
168 |
+
return $this;
|
169 |
+
}
|
170 |
+
|
171 |
+
/**
|
172 |
+
* Custom callback action for the subscribers/contacts.
|
173 |
+
* @param $collection
|
174 |
+
* @param $column
|
175 |
+
*/
|
176 |
+
public function filterCallbackContact($collection, $column)
|
177 |
+
{
|
178 |
+
$field = $column->getFilterIndex() ? $column->getFilterIndex() : $column->getIndex();
|
179 |
+
$value = $column->getFilter()->getValue();
|
180 |
+
|
181 |
+
if ($value == 'null')
|
182 |
+
$collection->addFieldToFilter($field, array('null' => true));
|
183 |
+
else
|
184 |
+
$collection->addFieldToFilter($field, array('notnull' => true));
|
185 |
+
}
|
186 |
+
|
187 |
+
/**
|
188 |
+
* Edit the row.
|
189 |
+
* @param $row
|
190 |
+
*
|
191 |
+
* @return string
|
192 |
+
*/
|
193 |
+
public function getRowUrl($row)
|
194 |
+
{
|
195 |
+
return $this->getUrl('*/*/edit', array('id' => $row->getEmailContactId()));
|
196 |
+
}
|
197 |
+
|
198 |
+
/**
|
199 |
+
* Grid url.
|
200 |
+
* @return string
|
201 |
+
*/
|
202 |
+
public function getGridUrl()
|
203 |
+
{
|
204 |
+
return $this->getUrl('*/*/grid', array('_current'=>true));
|
205 |
+
}
|
206 |
+
|
207 |
+
}
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_Dashboard extends Mage_Adminhtml_Block_Dashboard_Bar
|
4 |
+
|
5 |
+
{
|
6 |
+
/**
|
7 |
+
* Set the template.
|
8 |
+
*/
|
9 |
+
public function __construct()
|
10 |
+
{
|
11 |
+
parent::_construct();
|
12 |
+
|
13 |
+
$this->setTemplate('connector/dashboard/accountbar.phtml');
|
14 |
+
}
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Prepare the layout.
|
18 |
+
*
|
19 |
+
* @return Mage_Core_Block_Abstract|void
|
20 |
+
* @throws Exception
|
21 |
+
*/
|
22 |
+
protected function _prepareLayout()
|
23 |
+
{
|
24 |
+
$website = 0;
|
25 |
+
if ($store = $this->getRequest()->getParam('store')) {
|
26 |
+
$website = Mage::app()->getStore($store)->getWebsite();
|
27 |
+
} elseif ($this->getRequest()->getParam('website')) {
|
28 |
+
$website = $this->getRequest()->getParam('website');
|
29 |
+
}
|
30 |
+
$apiUsername = Mage::helper('connector')->getApiUsername($website);
|
31 |
+
$apiPassword = Mage::helper('connector')->getApiPassword($website);
|
32 |
+
$data = Mage::getModel('email_connector/apiconnector_client')
|
33 |
+
->setApiUsername($apiUsername)
|
34 |
+
->setApiPassword($apiPassword)
|
35 |
+
->getAccountInfo();
|
36 |
+
foreach ($data->properties as $one) {
|
37 |
+
$this->addTotal($this->__($one->name), $one->value, true);
|
38 |
+
}
|
39 |
+
}
|
40 |
+
|
41 |
+
}
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_Dashboard_Content extends Mage_Adminhtml_Block_Widget_Container
|
4 |
+
{
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->_headerText = Mage::helper('connector')->__('Account Managment.');
|
9 |
+
|
10 |
+
}
|
11 |
+
}
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_Order extends Mage_Adminhtml_Block_Widget_Grid_Container
|
4 |
+
{
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
parent::__construct();
|
8 |
+
|
9 |
+
$this->_blockGroup = 'email_connector';
|
10 |
+
$this->_controller = 'adminhtml_order';
|
11 |
+
$this->_headerText = Mage::helper('connector')->__('Email Order(s)');
|
12 |
+
|
13 |
+
$this->_removeButton('add');
|
14 |
+
}
|
15 |
+
}
|
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_Order_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
4 |
+
{
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
parent::__construct();
|
8 |
+
|
9 |
+
// Set some defaults for our grid
|
10 |
+
$this->setDefaultSort('email_order_id');
|
11 |
+
$this->setId('email_order_id');
|
12 |
+
$this->setDefaultDir('asc');
|
13 |
+
}
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Collection class;
|
17 |
+
* @return string
|
18 |
+
*/
|
19 |
+
protected function _getCollectionClass()
|
20 |
+
{
|
21 |
+
// This is the model we are using for the grid
|
22 |
+
return 'email_connector/order_collection';
|
23 |
+
}
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Prepare the grid collection.
|
27 |
+
* @return Mage_Adminhtml_Block_Widget_Grid
|
28 |
+
*/
|
29 |
+
protected function _prepareCollection()
|
30 |
+
{
|
31 |
+
// Get and set our collection for the grid
|
32 |
+
$collection = Mage::getResourceModel($this->_getCollectionClass());
|
33 |
+
$this->setCollection($collection);
|
34 |
+
return parent::_prepareCollection();
|
35 |
+
}
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Prepare the grid collumns.
|
39 |
+
* @return $this
|
40 |
+
* @throws Exception
|
41 |
+
*/
|
42 |
+
protected function _prepareColumns()
|
43 |
+
{
|
44 |
+
$this->addColumn('order_id', array(
|
45 |
+
'header' => Mage::helper('connector')->__('Order ID'),
|
46 |
+
'align' => 'left',
|
47 |
+
'width' => '50px',
|
48 |
+
'index' => 'order_id',
|
49 |
+
'type' => 'number',
|
50 |
+
'escape' => true
|
51 |
+
))->addColumn('store_id', array(
|
52 |
+
'header' => Mage::helper('connector')->__('Store ID'),
|
53 |
+
'width' => '50px',
|
54 |
+
'index' => 'store_id',
|
55 |
+
'type' => 'number',
|
56 |
+
'escape' => true,
|
57 |
+
))->addColumn('email_imported', array(
|
58 |
+
'header' => Mage::helper('connector')->__('Email Imported'),
|
59 |
+
'align' => 'center',
|
60 |
+
'width' => '50px',
|
61 |
+
'index' => 'email_imported',
|
62 |
+
'type' => 'options',
|
63 |
+
'escape' => true,
|
64 |
+
'renderer' => 'email_connector/adminhtml_column_renderer_imported',
|
65 |
+
'options' => Mage::getModel('email_connector/adminhtml_source_contact_imported')->getOptions(),
|
66 |
+
'filter_condition_callback' => array($this, 'filterCallbackContact')
|
67 |
+
))->addColumn('updated_at', array(
|
68 |
+
'header' => Mage::helper('connector')->__('Updated At'),
|
69 |
+
'width' => '50px',
|
70 |
+
'align' => 'center',
|
71 |
+
'index' => 'updated_at',
|
72 |
+
'type' => 'datetime',
|
73 |
+
'escape' => true,
|
74 |
+
));
|
75 |
+
|
76 |
+
return parent::_prepareColumns();
|
77 |
+
}
|
78 |
+
|
79 |
+
/**
|
80 |
+
* Callback action for the imported subscribers/contacts.
|
81 |
+
*
|
82 |
+
* @param $collection
|
83 |
+
* @param $column
|
84 |
+
*/
|
85 |
+
public function filterCallbackContact($collection, $column)
|
86 |
+
{
|
87 |
+
$field = $column->getFilterIndex() ? $column->getFilterIndex() : $column->getIndex();
|
88 |
+
$value = $column->getFilter()->getValue();
|
89 |
+
if ($value == 'null') {
|
90 |
+
$collection->addFieldToFilter($field, array('null' => true));
|
91 |
+
} else {
|
92 |
+
$collection->addFieldToFilter($field, array('notnull' => true));
|
93 |
+
}
|
94 |
+
}
|
95 |
+
}
|
@@ -0,0 +1,196 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_Sales_Order_Creditmemo_View extends Mage_Adminhtml_Block_Widget_Form_Container
|
3 |
+
{
|
4 |
+
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
$this->_objectId = 'creditmemo_id';
|
8 |
+
$this->_controller = 'sales_order_creditmemo';
|
9 |
+
$this->_mode = 'view';
|
10 |
+
|
11 |
+
parent::__construct();
|
12 |
+
|
13 |
+
$this->_removeButton('save');
|
14 |
+
$this->_removeButton('reset');
|
15 |
+
$this->_removeButton('delete');
|
16 |
+
|
17 |
+
if ($this->getCreditmemo()->canCancel()) {
|
18 |
+
$this->_addButton('cancel', array(
|
19 |
+
'label' => Mage::helper('sales')->__('Cancel'),
|
20 |
+
'class' => 'delete',
|
21 |
+
'onclick' => 'setLocation(\''.$this->getCancelUrl().'\')'
|
22 |
+
)
|
23 |
+
);
|
24 |
+
}
|
25 |
+
|
26 |
+
if ($this->_isAllowedAction('emails')) {
|
27 |
+
$this->addButton('send_notification', array(
|
28 |
+
'label' => Mage::helper('sales')->__('Send Email'),
|
29 |
+
'onclick' => 'confirmSetLocation(\''
|
30 |
+
. Mage::helper('sales')->__('Are you sure you want to send Creditmemo email to customer?')
|
31 |
+
. '\', \'' . $this->getEmailUrl() . '\')'
|
32 |
+
));
|
33 |
+
}
|
34 |
+
|
35 |
+
if ($this->getCreditmemo()->canRefund()) {
|
36 |
+
$this->_addButton('refund', array(
|
37 |
+
'label' => Mage::helper('sales')->__('Refund'),
|
38 |
+
'class' => 'save',
|
39 |
+
'onclick' => 'setLocation(\''.$this->getRefundUrl().'\')'
|
40 |
+
)
|
41 |
+
);
|
42 |
+
}
|
43 |
+
|
44 |
+
if ($this->getCreditmemo()->canVoid()) {
|
45 |
+
$this->_addButton('void', array(
|
46 |
+
'label' => Mage::helper('sales')->__('Void'),
|
47 |
+
'class' => 'save',
|
48 |
+
'onclick' => 'setLocation(\''.$this->getVoidUrl().'\')'
|
49 |
+
)
|
50 |
+
);
|
51 |
+
}
|
52 |
+
|
53 |
+
if ($this->getCreditmemo()->getId()) {
|
54 |
+
$this->_addButton('print', array(
|
55 |
+
'label' => Mage::helper('sales')->__('Print'),
|
56 |
+
'class' => 'save',
|
57 |
+
'onclick' => 'setLocation(\''.$this->getPrintUrl().'\')'
|
58 |
+
)
|
59 |
+
);
|
60 |
+
}
|
61 |
+
}
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Retrieve creditmemo model instance
|
65 |
+
*
|
66 |
+
* @return Mage_Sales_Model_Order_Creditmemo
|
67 |
+
*/
|
68 |
+
public function getCreditmemo()
|
69 |
+
{
|
70 |
+
return Mage::registry('current_creditmemo');
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Retrieve text for header
|
75 |
+
*
|
76 |
+
* @return string
|
77 |
+
*/
|
78 |
+
public function getHeaderText()
|
79 |
+
{
|
80 |
+
if ($this->getCreditmemo()->getEmailSent()) {
|
81 |
+
$emailSent = Mage::helper('sales')->__('the credit memo email was sent');
|
82 |
+
}
|
83 |
+
else {
|
84 |
+
$emailSent = Mage::helper('sales')->__('the credit memo email is not sent');
|
85 |
+
}
|
86 |
+
return Mage::helper('sales')->__('Credit Memo #%1$s | %3$s | %2$s (%4$s)', $this->getCreditmemo()->getIncrementId(), $this->formatDate($this->getCreditmemo()->getCreatedAtDate(), 'medium', true), $this->getCreditmemo()->getStateName(), $emailSent);
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Retrieve back url
|
91 |
+
*
|
92 |
+
* @return string
|
93 |
+
*/
|
94 |
+
public function getBackUrl()
|
95 |
+
{
|
96 |
+
return $this->getUrl(
|
97 |
+
'*/sales_order/view',
|
98 |
+
array(
|
99 |
+
'order_id' => $this->getCreditmemo()->getOrderId(),
|
100 |
+
'active_tab'=> 'order_creditmemos'
|
101 |
+
));
|
102 |
+
}
|
103 |
+
|
104 |
+
/**
|
105 |
+
* Retrieve capture url
|
106 |
+
*
|
107 |
+
* @return string
|
108 |
+
*/
|
109 |
+
public function getCaptureUrl()
|
110 |
+
{
|
111 |
+
return $this->getUrl('*/*/capture', array('creditmemo_id'=>$this->getCreditmemo()->getId()));
|
112 |
+
}
|
113 |
+
|
114 |
+
/**
|
115 |
+
* Retrieve void url
|
116 |
+
*
|
117 |
+
* @return string
|
118 |
+
*/
|
119 |
+
public function getVoidUrl()
|
120 |
+
{
|
121 |
+
return $this->getUrl('*/*/void', array('creditmemo_id'=>$this->getCreditmemo()->getId()));
|
122 |
+
}
|
123 |
+
|
124 |
+
/**
|
125 |
+
* Retrieve cancel url
|
126 |
+
*
|
127 |
+
* @return string
|
128 |
+
*/
|
129 |
+
public function getCancelUrl()
|
130 |
+
{
|
131 |
+
return $this->getUrl('*/*/cancel', array('creditmemo_id'=>$this->getCreditmemo()->getId()));
|
132 |
+
}
|
133 |
+
|
134 |
+
/**
|
135 |
+
* Retrieve email url
|
136 |
+
*
|
137 |
+
* @return string
|
138 |
+
*/
|
139 |
+
public function getEmailUrl()
|
140 |
+
{
|
141 |
+
return $this->getUrl('*/*/email', array(
|
142 |
+
'creditmemo_id' => $this->getCreditmemo()->getId(),
|
143 |
+
'order_id' => $this->getCreditmemo()->getOrderId()
|
144 |
+
));
|
145 |
+
}
|
146 |
+
|
147 |
+
/**
|
148 |
+
* Retrieve print url
|
149 |
+
*
|
150 |
+
* @return string
|
151 |
+
*/
|
152 |
+
public function getPrintUrl()
|
153 |
+
{
|
154 |
+
return $this->getUrl('*/*/print', array(
|
155 |
+
'creditmemo_id' => $this->getCreditmemo()->getId()
|
156 |
+
));
|
157 |
+
}
|
158 |
+
|
159 |
+
/**
|
160 |
+
* Update 'back' button url.
|
161 |
+
*
|
162 |
+
* @param $flag
|
163 |
+
*
|
164 |
+
* @return $this|Mage_Adminhtml_Block_Widget_Container
|
165 |
+
*/
|
166 |
+
public function updateBackButtonUrl($flag)
|
167 |
+
{
|
168 |
+
if ($flag) {
|
169 |
+
if ($this->getCreditmemo()->getBackUrl()) {
|
170 |
+
return $this->_updateButton(
|
171 |
+
'back',
|
172 |
+
'onclick',
|
173 |
+
'setLocation(\'' . $this->getCreditmemo()->getBackUrl() . '\')'
|
174 |
+
);
|
175 |
+
}
|
176 |
+
|
177 |
+
return $this->_updateButton(
|
178 |
+
'back',
|
179 |
+
'onclick',
|
180 |
+
'setLocation(\'' . $this->getUrl('*/sales_creditmemo/') . '\')'
|
181 |
+
);
|
182 |
+
}
|
183 |
+
return $this;
|
184 |
+
}
|
185 |
+
|
186 |
+
/**
|
187 |
+
* Check whether action is allowed
|
188 |
+
*
|
189 |
+
* @param string $action
|
190 |
+
* @return bool
|
191 |
+
*/
|
192 |
+
public function _isAllowedAction($action)
|
193 |
+
{
|
194 |
+
return Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/' . $action);
|
195 |
+
}
|
196 |
+
}
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_System_Advanced_Deletecontactids extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
|
6 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
7 |
+
{
|
8 |
+
$this->setElement($element);
|
9 |
+
return $this->_getAddRowButtonHtml($this->__("Run Now"));
|
10 |
+
}
|
11 |
+
|
12 |
+
protected function _getAddRowButtonHtml($title)
|
13 |
+
{
|
14 |
+
$url = Mage::helper('adminhtml')->getUrl("*/connector/deletecontactids");
|
15 |
+
|
16 |
+
return $this->getLayout()->createBlock('adminhtml/widget_button')
|
17 |
+
->setType('button')
|
18 |
+
->setLabel($this->__($title))
|
19 |
+
->setOnClick("window.location.href='" . $url . "'")
|
20 |
+
->toHtml();
|
21 |
+
}
|
22 |
+
}
|
@@ -1,15 +1,16 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
class Dotdigitalgroup_Email_Block_Debug_Countcontacts extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
{
|
5 |
|
6 |
-
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
|
|
7 |
$this->setElement($element);
|
8 |
-
return $this->_getAddRowButtonHtml($this->__(
|
9 |
}
|
10 |
|
11 |
-
protected function _getAddRowButtonHtml($title)
|
12 |
-
|
|
|
13 |
|
14 |
return $this->getLayout()->createBlock('adminhtml/widget_button')
|
15 |
->setType('button')
|
1 |
<?php
|
2 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_System_Advanced_Reimportorders extends Mage_Adminhtml_Block_System_Config_Form_Field
|
|
|
3 |
{
|
4 |
|
5 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
6 |
+
{
|
7 |
$this->setElement($element);
|
8 |
+
return $this->_getAddRowButtonHtml($this->__("Run Now"));
|
9 |
}
|
10 |
|
11 |
+
protected function _getAddRowButtonHtml($title)
|
12 |
+
{
|
13 |
+
$url = $this->getUrl("*/connector/resetorders");
|
14 |
|
15 |
return $this->getLayout()->createBlock('adminhtml/widget_button')
|
16 |
->setType('button')
|
@@ -1,14 +1,16 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
class Dotdigitalgroup_Email_Block_Debug_Initialsync extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
{
|
5 |
-
|
|
|
|
|
6 |
$this->setElement($element);
|
7 |
-
return $this->_getAddRowButtonHtml($this->__(
|
8 |
}
|
9 |
|
10 |
-
protected function _getAddRowButtonHtml($title)
|
11 |
-
|
|
|
12 |
|
13 |
return $this->getLayout()->createBlock('adminhtml/widget_button')
|
14 |
->setType('button')
|
@@ -17,4 +19,4 @@ class Dotdigitalgroup_Email_Block_Debug_Initialsync extends Mage_Adminhtml_Block
|
|
17 |
->toHtml();
|
18 |
}
|
19 |
|
20 |
-
}
|
1 |
<?php
|
2 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_System_Advanced_Reimportsubscribers extends Mage_Adminhtml_Block_System_Config_Form_Field
|
|
|
3 |
{
|
4 |
+
|
5 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
6 |
+
{
|
7 |
$this->setElement($element);
|
8 |
+
return $this->_getAddRowButtonHtml($this->__("Run Now"));
|
9 |
}
|
10 |
|
11 |
+
protected function _getAddRowButtonHtml($title)
|
12 |
+
{
|
13 |
+
$url = $this->getUrl("*/connector/reimoprtsubscribers");
|
14 |
|
15 |
return $this->getLayout()->createBlock('adminhtml/widget_button')
|
16 |
->setType('button')
|
19 |
->toHtml();
|
20 |
}
|
21 |
|
22 |
+
}
|
@@ -1,15 +1,17 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
class
|
4 |
{
|
5 |
|
6 |
-
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
|
|
7 |
$this->setElement($element);
|
8 |
-
return $this->_getAddRowButtonHtml($this->__("
|
9 |
}
|
10 |
|
11 |
-
protected function _getAddRowButtonHtml($title)
|
12 |
-
|
|
|
13 |
|
14 |
return $this->getLayout()->createBlock('adminhtml/widget_button')
|
15 |
->setType('button')
|
1 |
<?php
|
2 |
|
3 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_System_Advanced_Setupdatafields extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
{
|
5 |
|
6 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
7 |
+
{
|
8 |
$this->setElement($element);
|
9 |
+
return $this->_getAddRowButtonHtml($this->__("Run Now"));
|
10 |
}
|
11 |
|
12 |
+
protected function _getAddRowButtonHtml($title)
|
13 |
+
{
|
14 |
+
$url = $this->getUrl("*/connector/setupdatafields");
|
15 |
|
16 |
return $this->getLayout()->createBlock('adminhtml/widget_button')
|
17 |
->setType('button')
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_System_Advanced_Suppressedcontacts extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
|
6 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
7 |
+
{
|
8 |
+
$this->setElement($element);
|
9 |
+
return $this->_getAddRowButtonHtml($this->__('Run Now'));
|
10 |
+
}
|
11 |
+
|
12 |
+
protected function _getAddRowButtonHtml($title)
|
13 |
+
{
|
14 |
+
$url = $this->getUrl("*/connector/suppresscontacts");
|
15 |
+
|
16 |
+
return $this->getLayout()->createBlock('adminhtml/widget_button')
|
17 |
+
->setType('button')
|
18 |
+
->setLabel($this->__($title))
|
19 |
+
->setOnClick("window.location.href='" . $url . "'")
|
20 |
+
->toHtml();
|
21 |
+
}
|
22 |
+
|
23 |
+
}
|
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
class
|
4 |
{
|
5 |
public function _getElementHtml(Varien_Data_Form_Element_Abstract$element){
|
6 |
|
1 |
<?php
|
2 |
|
3 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_System_Ajaxvalidate extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
{
|
5 |
public function _getElementHtml(Varien_Data_Form_Element_Abstract$element){
|
6 |
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_System_Automation_Connect extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
6 |
+
{
|
7 |
+
$this->setElement($element);
|
8 |
+
return $this->_getAddRowButtonHtml();
|
9 |
+
}
|
10 |
+
|
11 |
+
protected function _getAddRowButtonHtml()
|
12 |
+
{
|
13 |
+
$url = Mage::helper('connector')->getAuthoriseUrl();
|
14 |
+
$ssl = $this->_checkForSecureUrl();
|
15 |
+
$disabled = false;
|
16 |
+
if (!$ssl) {
|
17 |
+
$disabled = true;
|
18 |
+
Mage::getSingleton('adminhtml/session')->addNotice('Cannot Use the Authorization For Non SSL Server!');
|
19 |
+
|
20 |
+
}
|
21 |
+
|
22 |
+
$adminUser = Mage::getSingleton('admin/session')->getUser();
|
23 |
+
$refreshToken = $adminUser->getRefreshToken();
|
24 |
+
$title = ($refreshToken)? $this->__('Disconnect') : $this->__('Connect');
|
25 |
+
$url = ($refreshToken)? $this->getUrl('*/email_automation/disconnect') : $url;
|
26 |
+
|
27 |
+
return $this->getLayout()->createBlock('adminhtml/widget_button')
|
28 |
+
->setType('button')
|
29 |
+
->setLabel($this->__($title))
|
30 |
+
->setDisabled($disabled)
|
31 |
+
->setOnClick("window.location.href='" . $url . "'")
|
32 |
+
->toHtml();
|
33 |
+
}
|
34 |
+
|
35 |
+
private function _checkForSecureUrl()
|
36 |
+
{
|
37 |
+
$baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB, true);
|
38 |
+
if (!preg_match('/https/',$baseUrl)) {
|
39 |
+
Mage::helper('connector')->log('Not an ssl');
|
40 |
+
return false;
|
41 |
+
}
|
42 |
+
return $this;
|
43 |
+
}
|
44 |
+
}
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_System_Config_Addressbook extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Ajax Create the addressbooks.
|
8 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
9 |
+
*
|
10 |
+
* @return string
|
11 |
+
*/
|
12 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
13 |
+
{
|
14 |
+
$url = Mage::helper('adminhtml')->getUrl('*/connector/createnewaddressbook');
|
15 |
+
$website = Mage::app()->getRequest()->getParam('website', 0);
|
16 |
+
|
17 |
+
$element->setData('after_element_html',
|
18 |
+
"<script>
|
19 |
+
function createAddressbook(form, element) {
|
20 |
+
var name = $('connector_sync_settings_dynamic_addressbook_addressbook_name').value;
|
21 |
+
var reloadurl = '{$url}';
|
22 |
+
if(name){
|
23 |
+
new Ajax.Request(reloadurl, {
|
24 |
+
method: 'post',
|
25 |
+
parameters: {'name' : name, 'website': '$website'},
|
26 |
+
onComplete: function(transport) {
|
27 |
+
window.location.reload();
|
28 |
+
}
|
29 |
+
});
|
30 |
+
}
|
31 |
+
return false;
|
32 |
+
}
|
33 |
+
</script>"
|
34 |
+
);
|
35 |
+
|
36 |
+
return parent::_getElementHtml($element);
|
37 |
+
}
|
38 |
+
}
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_System_Config_Datafield extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Ajax Create the datafields.
|
8 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
9 |
+
*
|
10 |
+
* @return string
|
11 |
+
*/
|
12 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
13 |
+
{
|
14 |
+
$url = Mage::helper('adminhtml')->getUrl('*/connector/createnewdatafield');
|
15 |
+
$website = Mage::app()->getRequest()->getParam('website', 0);
|
16 |
+
|
17 |
+
$element->setData('after_element_html',
|
18 |
+
"<script>
|
19 |
+
function createDatafield(form, element) {
|
20 |
+
var datafield_name = $('connector_data_mapping_dynamic_datafield_datafield_name').value;
|
21 |
+
var datafield_type = $('connector_data_mapping_dynamic_datafield_datafield_type').value;
|
22 |
+
var reloadurl = '{$url}';
|
23 |
+
|
24 |
+
if(datafield_name && datafield_type){
|
25 |
+
new Ajax.Request(reloadurl, {
|
26 |
+
method: 'post',
|
27 |
+
parameters: {'name' : datafield_name, 'type' : datafield_type, 'website': '$website'},
|
28 |
+
onComplete: function(transport) {
|
29 |
+
window.location.reload();
|
30 |
+
}
|
31 |
+
});
|
32 |
+
}
|
33 |
+
return false;
|
34 |
+
}
|
35 |
+
</script>"
|
36 |
+
);
|
37 |
+
|
38 |
+
return parent::_getElementHtml($element);
|
39 |
+
}
|
40 |
+
}
|
@@ -4,9 +4,14 @@
|
|
4 |
class Dotdigitalgroup_Email_Block_Adminhtml_System_Config_Validator extends Mage_Adminhtml_Block_System_Config_Form_Field
|
5 |
{
|
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
8 |
{
|
9 |
-
|
10 |
// Get the default HTML for this option
|
11 |
$html = parent::_getElementHtml($element);
|
12 |
|
@@ -16,8 +21,8 @@ class Dotdigitalgroup_Email_Block_Adminhtml_System_Config_Validator extends Mage
|
|
16 |
|
17 |
$html .=$jquery;
|
18 |
|
19 |
-
$javaScript =
|
20 |
-
<script type=\"text/javascript\">
|
21 |
|
22 |
jQuery.noConflict();
|
23 |
|
@@ -25,10 +30,11 @@ class Dotdigitalgroup_Email_Block_Adminhtml_System_Config_Validator extends Mage
|
|
25 |
// Handler for .ready() called.
|
26 |
|
27 |
// Hide our validation block
|
28 |
-
jQuery('#
|
29 |
|
30 |
// Add listener for changing select box
|
31 |
-
|
|
|
32 |
|
33 |
var currentSelection = jQuery(this).val();
|
34 |
var currentDropdownId = jQuery(this).attr('id');
|
@@ -54,16 +60,10 @@ class Dotdigitalgroup_Email_Block_Adminhtml_System_Config_Validator extends Mage
|
|
54 |
break;
|
55 |
break;
|
56 |
}
|
57 |
-
|
58 |
}
|
59 |
-
|
60 |
});
|
61 |
-
|
62 |
});
|
63 |
-
|
64 |
});
|
65 |
-
|
66 |
-
|
67 |
</script>";
|
68 |
|
69 |
$html .= $javaScript;
|
4 |
class Dotdigitalgroup_Email_Block_Adminhtml_System_Config_Validator extends Mage_Adminhtml_Block_System_Config_Form_Field
|
5 |
{
|
6 |
|
7 |
+
/**
|
8 |
+
* Ajax Validate the duplicate selection.
|
9 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
10 |
+
*
|
11 |
+
* @return string
|
12 |
+
*/
|
13 |
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
14 |
{
|
|
|
15 |
// Get the default HTML for this option
|
16 |
$html = parent::_getElementHtml($element);
|
17 |
|
21 |
|
22 |
$html .=$jquery;
|
23 |
|
24 |
+
$javaScript =
|
25 |
+
"<script type=\"text/javascript\">
|
26 |
|
27 |
jQuery.noConflict();
|
28 |
|
30 |
// Handler for .ready() called.
|
31 |
|
32 |
// Hide our validation block
|
33 |
+
jQuery('#row_connector_data_mapping_customer_data_validator').hide();
|
34 |
|
35 |
// Add listener for changing select box
|
36 |
+
|
37 |
+
jQuery('#connector_data_mapping_customer_data select').on('change', function() {
|
38 |
|
39 |
var currentSelection = jQuery(this).val();
|
40 |
var currentDropdownId = jQuery(this).attr('id');
|
60 |
break;
|
61 |
break;
|
62 |
}
|
|
|
63 |
}
|
|
|
64 |
});
|
|
|
65 |
});
|
|
|
66 |
});
|
|
|
|
|
67 |
</script>";
|
68 |
|
69 |
$html .= $javaScript;
|
@@ -2,12 +2,32 @@
|
|
2 |
|
3 |
class Dotdigitalgroup_Email_Block_Adminhtml_System_Config_Waitingfield extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
7 |
{
|
8 |
// Get the default HTML for this option
|
9 |
$html = parent::_getElementHtml($element);
|
10 |
|
|
|
11 |
$html .= sprintf('<div id="loadingmask" style="position: fixed;">
|
12 |
<div class="loader" id="loading-mask-loader">
|
13 |
<img src="%sskin/adminhtml/default/default/images/ajax-loader-tr.gif" alt="%s"/>%s', preg_replace('/index.php\//', '', $this->getBaseUrl()), $this->__('Loading...'), $this->__('Loading...'))
|
@@ -15,20 +35,20 @@ class Dotdigitalgroup_Email_Block_Adminhtml_System_Config_Waitingfield extends M
|
|
15 |
|
16 |
$jQuery = '<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" ></script>';
|
17 |
|
18 |
-
$jQuery .=
|
19 |
-
<script type="text/javascript">
|
20 |
jQuery.noConflict();
|
21 |
jQuery(document).ready(function() {
|
22 |
//hide the load image field
|
23 |
-
jQuery("#
|
|
|
24 |
var loadingmask = jQuery("#loadingmask");
|
25 |
loadingmask.hide();
|
26 |
loadingmask.css({top : "50\%", left: "50\%"})
|
27 |
-
|
28 |
jQuery("button").click(function(){
|
29 |
-
|
30 |
jQuery("body").css({"background-color": "black", "opacity": "0.4"});
|
31 |
-
|
|
|
32 |
loadingmask.show();
|
33 |
loadingmask.css({"display": "block", "opacity" : "1"});
|
34 |
})
|
2 |
|
3 |
class Dotdigitalgroup_Email_Block_Adminhtml_System_Config_Waitingfield extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
{
|
5 |
+
/**
|
6 |
+
* Unscope the website level.
|
7 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
8 |
+
*
|
9 |
+
* @return string
|
10 |
+
*/
|
11 |
+
public function render(Varien_Data_Form_Element_Abstract $element)
|
12 |
+
{
|
13 |
+
|
14 |
+
$element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue();
|
15 |
+
return parent::render($element);
|
16 |
+
|
17 |
+
}
|
18 |
|
19 |
+
/**
|
20 |
+
* Loading background on save.
|
21 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
22 |
+
*
|
23 |
+
* @return string
|
24 |
+
*/
|
25 |
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
26 |
{
|
27 |
// Get the default HTML for this option
|
28 |
$html = parent::_getElementHtml($element);
|
29 |
|
30 |
+
|
31 |
$html .= sprintf('<div id="loadingmask" style="position: fixed;">
|
32 |
<div class="loader" id="loading-mask-loader">
|
33 |
<img src="%sskin/adminhtml/default/default/images/ajax-loader-tr.gif" alt="%s"/>%s', preg_replace('/index.php\//', '', $this->getBaseUrl()), $this->__('Loading...'), $this->__('Loading...'))
|
35 |
|
36 |
$jQuery = '<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" ></script>';
|
37 |
|
38 |
+
$jQuery .=
|
39 |
+
'<script type="text/javascript">
|
40 |
jQuery.noConflict();
|
41 |
jQuery(document).ready(function() {
|
42 |
//hide the load image field
|
43 |
+
jQuery("#row_connector_api_credentials_api_credentials_validator").hide();
|
44 |
+
jQuery("#row_connector_sync_settings_sync_customer_schedule_validator").hide();
|
45 |
var loadingmask = jQuery("#loadingmask");
|
46 |
loadingmask.hide();
|
47 |
loadingmask.css({top : "50\%", left: "50\%"})
|
|
|
48 |
jQuery("button").click(function(){
|
|
|
49 |
jQuery("body").css({"background-color": "black", "opacity": "0.4"});
|
50 |
+
jQuery("#row_connector_api_settings_api_credentials_validator").show();
|
51 |
+
jQuery("#row_connector_sync_settings_sync_customer_schedule_validator").show();
|
52 |
loadingmask.show();
|
53 |
loadingmask.css({"display": "block", "opacity" : "1"});
|
54 |
})
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_System_Config_Wrapper extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Ajax Validate the api credentials.
|
8 |
+
*
|
9 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
10 |
+
*
|
11 |
+
* @return string
|
12 |
+
*/
|
13 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
14 |
+
{
|
15 |
+
$element->setData('onchange', "apiValidation(this.form, this);");
|
16 |
+
|
17 |
+
$url = Mage::helper('adminhtml')->getUrl('*/connector/ajaxvalidation');
|
18 |
+
|
19 |
+
$element->setData('after_element_html', "
|
20 |
+
<script>
|
21 |
+
document.observe('dom:loaded', function(){
|
22 |
+
apiValidation();
|
23 |
+
});
|
24 |
+
function apiValidation(form, element) {
|
25 |
+
var api_username = $('connector_api_credentials_api_username');
|
26 |
+
var api_password = $('connector_api_credentials_api_password');
|
27 |
+
var reloadurl = '{$url}';
|
28 |
+
|
29 |
+
if(api_username.value && api_password.value){
|
30 |
+
new Ajax.Request(reloadurl, {
|
31 |
+
method: 'post',
|
32 |
+
parameters: {'api_username' : api_username.value, 'api_password' : api_password.value},
|
33 |
+
onComplete: function(transport) {
|
34 |
+
Element.hide('loadingmask');
|
35 |
+
if(transport.responseText == '\"Credentials Valid.\"'){
|
36 |
+
api_username.setStyle({
|
37 |
+
fontWeight: 'bold',
|
38 |
+
color: 'green' ,
|
39 |
+
background: 'transparent url(\"" . $this->getSkinUrl('images/success_msg_icon.gif') . "\") no-repeat right center'
|
40 |
+
})
|
41 |
+
}else{
|
42 |
+
api_username.setStyle({
|
43 |
+
fontWeight: 'bold',
|
44 |
+
color: 'red',
|
45 |
+
background: 'transparent url(\"" . $this->getSkinUrl('images/error_msg_icon.gif') . "\") no-repeat right center'
|
46 |
+
});
|
47 |
+
}
|
48 |
+
}
|
49 |
+
});
|
50 |
+
}
|
51 |
+
return false;
|
52 |
+
}
|
53 |
+
</script>
|
54 |
+
");
|
55 |
+
|
56 |
+
return parent::_getElementHtml($element);
|
57 |
+
|
58 |
+
}
|
59 |
+
}
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_System_Dynamic_Addressbookbutton extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
|
6 |
+
protected function _getAddRowButtonHtml($title)
|
7 |
+
{
|
8 |
+
return $this->getLayout()->createBlock('adminhtml/widget_button')
|
9 |
+
->setType('button')
|
10 |
+
->setLabel($this->__($title))
|
11 |
+
->setOnClick("createAddressbook(this.form, this);")
|
12 |
+
->toHtml();
|
13 |
+
}
|
14 |
+
|
15 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
16 |
+
{
|
17 |
+
$this->setElement($element);
|
18 |
+
$originalData = $element->getOriginalData();
|
19 |
+
|
20 |
+
return $this->_getAddRowButtonHtml($this->__($originalData['button_label']));
|
21 |
+
}
|
22 |
+
}
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_System_Dynamic_Bestsellers extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
/** label */
|
6 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
7 |
+
{
|
8 |
+
$baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
|
9 |
+
$website = Mage::app()->getRequest()->getParam('website', false);
|
10 |
+
|
11 |
+
if ($website) {
|
12 |
+
$website = Mage::app()->getWebsite($website);
|
13 |
+
$baseUrl = $website->getConfig('web/secure/base_url');
|
14 |
+
}
|
15 |
+
$passcode = Mage::helper('connector')->getPasscode();
|
16 |
+
|
17 |
+
if(!strlen($passcode)) $passcode = '[PLEASE SET UP A PASSCODE]';
|
18 |
+
|
19 |
+
$text = sprintf('%sconnector/report/bestsellers/code/%s', $baseUrl, $passcode);
|
20 |
+
$element->setData('value', $text);
|
21 |
+
$element->setData('disabled', 'disabled');
|
22 |
+
|
23 |
+
return parent::_getElementHtml($element);
|
24 |
+
}
|
25 |
+
}
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_System_Dynamic_Couponinfo extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
/** label */
|
6 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
7 |
+
{
|
8 |
+
$baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
|
9 |
+
$website = Mage::app()->getRequest()->getParam('website', false);
|
10 |
+
|
11 |
+
if ($website) {
|
12 |
+
$website = Mage::app()->getWebsite($website);
|
13 |
+
$baseUrl = $website->getConfig('web/secure/base_url');
|
14 |
+
}
|
15 |
+
|
16 |
+
|
17 |
+
$code = Mage::helper('connector')->getPasscode();
|
18 |
+
if(!strlen($code))
|
19 |
+
$code = '[PLEASE SET UP A PASSCODE]';
|
20 |
+
$text = $baseUrl . 'connector/email/coupon/id/[INSERT ID HERE]/code/'. $code;
|
21 |
+
|
22 |
+
$element->setData('value', $text);
|
23 |
+
$element->setData('disabled', 'disabled');
|
24 |
+
return parent::_getElementHtml($element);
|
25 |
+
}
|
26 |
+
|
27 |
+
}
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_System_Dynamic_Creditmemonew extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
6 |
+
{
|
7 |
+
|
8 |
+
$baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
|
9 |
+
$website = Mage::app()->getRequest()->getParam('website', false);
|
10 |
+
|
11 |
+
if ($website) {
|
12 |
+
$website = Mage::app()->getWebsite($website);
|
13 |
+
$baseUrl = $website->getConfig('web/secure/base_url');
|
14 |
+
}
|
15 |
+
$helper = Mage::helper('connector');
|
16 |
+
$code = $helper->getPasscode();
|
17 |
+
$orderId = $helper->getMappedOrderId();
|
18 |
+
|
19 |
+
if(!strlen($code))
|
20 |
+
$code = '[PLEASE SET UP A PASSCODE]';
|
21 |
+
$text = sprintf('%s/connector/creditmemo/new/code/%s/id/@%s@', $baseUrl, $code, $orderId);
|
22 |
+
|
23 |
+
$element->setData('value', $text);
|
24 |
+
|
25 |
+
return parent::_getElementHtml($element);
|
26 |
+
}
|
27 |
+
|
28 |
+
}
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_System_Dynamic_Crosssell extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
6 |
+
{
|
7 |
+
$baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
|
8 |
+
$website = Mage::app()->getRequest()->getParam('website', false);
|
9 |
+
|
10 |
+
if ($website) {
|
11 |
+
$website = Mage::app()->getWebsite($website);
|
12 |
+
$baseUrl = $website->getConfig('web/secure/base_url');
|
13 |
+
}
|
14 |
+
$passcode = Mage::helper('connector')->getPasscode();
|
15 |
+
$lastOrderId = Mage::helper('connector')->getLastOrderId();
|
16 |
+
|
17 |
+
if(!strlen($passcode)) $passcode = '[PLEASE SET UP A PASSCODE]';
|
18 |
+
if(!$lastOrderId) $lastOrderId = '[PLEASE MAP THE LAST ORDER ID]';
|
19 |
+
|
20 |
+
|
21 |
+
$text = sprintf('%sconnector/products/crosssell/code/%s/order_id/@%s@', $baseUrl, $passcode, $lastOrderId);
|
22 |
+
$element->setData('value', $text);
|
23 |
+
|
24 |
+
return parent::_getElementHtml($element);
|
25 |
+
}
|
26 |
+
}
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_System_Dynamic_Datafieldbutton extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
protected function _getAddRowButtonHtml($title)
|
6 |
+
{
|
7 |
+
return $this->getLayout()->createBlock('adminhtml/widget_button')
|
8 |
+
->setType('button')
|
9 |
+
->setLabel($this->__($title))
|
10 |
+
->setOnClick("createDatafield(this.form, this);")
|
11 |
+
->toHtml();
|
12 |
+
}
|
13 |
+
|
14 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
15 |
+
{
|
16 |
+
$this->setElement($element);
|
17 |
+
$originalData = $element->getOriginalData();
|
18 |
+
|
19 |
+
return $this->_getAddRowButtonHtml($this->__($originalData['button_label']));
|
20 |
+
}
|
21 |
+
}
|
@@ -0,0 +1,106 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_System_Dynamic_Gridlist extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Dynamic contaent dysplay type.
|
7 |
+
*
|
8 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
9 |
+
*
|
10 |
+
* @return string
|
11 |
+
*/
|
12 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
13 |
+
{
|
14 |
+
// Get the default HTML for this option
|
15 |
+
$html = parent::_getElementHtml($element);
|
16 |
+
|
17 |
+
|
18 |
+
$jQuery = '<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" ></script>';
|
19 |
+
|
20 |
+
$jQuery .=
|
21 |
+
'<script type="text/javascript">
|
22 |
+
jQuery.noConflict();
|
23 |
+
jQuery(document).ready(function() {
|
24 |
+
var gridOptions = {
|
25 |
+
"4" : "4",
|
26 |
+
"8" : "8",
|
27 |
+
"12" : "12",
|
28 |
+
"16" : "16",
|
29 |
+
"20" : "20",
|
30 |
+
"24" : "24",
|
31 |
+
"28" : "28",
|
32 |
+
"32" : "32"
|
33 |
+
|
34 |
+
};
|
35 |
+
var listOptions = {
|
36 |
+
"2" : "2",
|
37 |
+
"4" : "4",
|
38 |
+
"6" : "6",
|
39 |
+
"8" : "8"
|
40 |
+
}
|
41 |
+
|
42 |
+
jQuery("#connector_dynamic_content_products_related_display_type").change(function(){
|
43 |
+
var display_type = jQuery(this).closest("tr").next().find("select");
|
44 |
+
var display_mode = jQuery(this).val();
|
45 |
+
changeOptions(display_type, display_mode);
|
46 |
+
});
|
47 |
+
|
48 |
+
jQuery("#connector_dynamic_content_products_upsell_display_type").change(function(){
|
49 |
+
var display_type = jQuery(this).closest("tr").next().find("select");
|
50 |
+
var display_mode = jQuery(this).val();
|
51 |
+
changeOptions(display_type, display_mode);
|
52 |
+
|
53 |
+
});
|
54 |
+
jQuery("#connector_dynamic_content_products_crosssell_display_type").change(function(){
|
55 |
+
var display_type = jQuery(this).closest("tr").next().find("select");
|
56 |
+
var display_mode = jQuery(this).val();
|
57 |
+
changeOptions(display_type, display_mode);
|
58 |
+
});
|
59 |
+
jQuery("#connector_dynamic_content_products_bestsellers_display_type").change(function(){
|
60 |
+
var display_type = jQuery(this).closest("tr").next().find("select");
|
61 |
+
var display_mode = jQuery(this).val();
|
62 |
+
changeOptions(display_type, display_mode);
|
63 |
+
});
|
64 |
+
jQuery("#connector_dynamic_content_products_most_viewed_display_type").change(function(){
|
65 |
+
var display_type = jQuery(this).closest("tr").next().find("select");
|
66 |
+
var display_mode = jQuery(this).val();
|
67 |
+
changeOptions(display_type, display_mode);
|
68 |
+
});
|
69 |
+
jQuery("#connector_dynamic_content_products_recently_viewed_display_type").change(function(){
|
70 |
+
var display_type = jQuery(this).closest("tr").next().find("select");
|
71 |
+
var display_mode = jQuery(this).val();
|
72 |
+
changeOptions(display_type, display_mode);
|
73 |
+
});
|
74 |
+
jQuery("#connector_dynamic_content_manual_product_search_display_type").change(function(){
|
75 |
+
var display_type = jQuery(this).closest("tr").next().find("select");
|
76 |
+
var display_mode = jQuery(this).val();
|
77 |
+
changeOptions(display_type, display_mode);
|
78 |
+
});
|
79 |
+
function changeOptions(display_type, display_mode){
|
80 |
+
if(display_mode == "list"){
|
81 |
+
display_type.empty();
|
82 |
+
|
83 |
+
jQuery.each(listOptions, function(key, value) {
|
84 |
+
display_type.append(jQuery("<option></option>")
|
85 |
+
.attr("value", value).text(key));
|
86 |
+
});
|
87 |
+
|
88 |
+
}
|
89 |
+
if(display_mode == "grid"){
|
90 |
+
display_type.empty();
|
91 |
+
jQuery.each(gridOptions, function(key, value) {
|
92 |
+
display_type.append(jQuery("<option></option>")
|
93 |
+
.attr("value", value).text(key));
|
94 |
+
});
|
95 |
+
}
|
96 |
+
}
|
97 |
+
});
|
98 |
+
</script>';
|
99 |
+
|
100 |
+
$html .= $jQuery;
|
101 |
+
|
102 |
+
return $html;
|
103 |
+
}
|
104 |
+
|
105 |
+
|
106 |
+
}
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_System_Dynamic_Lostbasket extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
|
6 |
+
/** label */
|
7 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
8 |
+
{
|
9 |
+
$baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
|
10 |
+
$website = Mage::app()->getRequest()->getParam('website', false);
|
11 |
+
|
12 |
+
if ($website) {
|
13 |
+
$website = Mage::app()->getWebsite($website);
|
14 |
+
$baseUrl = $website->getConfig('web/secure/base_url');
|
15 |
+
}
|
16 |
+
$code = Mage::helper('connector')->getPasscode();
|
17 |
+
if(!strlen($code))
|
18 |
+
$code = '[PLEASE SET UP A PASSCODE]';
|
19 |
+
$text = $baseUrl . 'connector/email/basket/email/@EMAIL@/code/'. $code;
|
20 |
+
|
21 |
+
$element->setData('value', $text);
|
22 |
+
return parent::_getElementHtml($element);
|
23 |
+
}
|
24 |
+
|
25 |
+
}
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_System_Dynamic_Mostviewed extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
/** label */
|
6 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
7 |
+
{
|
8 |
+
$baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
|
9 |
+
$website = Mage::app()->getRequest()->getParam('website', false);
|
10 |
+
|
11 |
+
if ($website) {
|
12 |
+
$website = Mage::app()->getWebsite($website);
|
13 |
+
$baseUrl = $website->getConfig('web/secure/base_url');
|
14 |
+
}
|
15 |
+
$passcode = Mage::helper('connector')->getPasscode();
|
16 |
+
|
17 |
+
if(!strlen($passcode)) $passcode = '[PLEASE SET UP A PASSCODE]';
|
18 |
+
|
19 |
+
$text = sprintf('%sconnector/report/mostviewed/code/%s', $baseUrl, $passcode);
|
20 |
+
$element->setData('value', $text);
|
21 |
+
|
22 |
+
return parent::_getElementHtml($element);
|
23 |
+
}
|
24 |
+
}
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_System_Dynamic_Productpush extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
/** label */
|
6 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
7 |
+
{
|
8 |
+
$baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
|
9 |
+
$website = Mage::app()->getRequest()->getParam('website', false);
|
10 |
+
|
11 |
+
if ($website) {
|
12 |
+
$website = Mage::app()->getWebsite($website);
|
13 |
+
$baseUrl = $website->getConfig('web/secure/base_url');
|
14 |
+
}
|
15 |
+
$passcode = Mage::helper('connector')->getPasscode();
|
16 |
+
|
17 |
+
if(!strlen($passcode)) $passcode = '[PLEASE SET UP A PASSCODE]';
|
18 |
+
|
19 |
+
$text = sprintf('%sconnector/products/push/code/%s', $baseUrl, $passcode);
|
20 |
+
$element->setData('value', $text);
|
21 |
+
|
22 |
+
return parent::_getElementHtml($element);
|
23 |
+
}
|
24 |
+
}
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_System_Dynamic_Recentlyviewed extends Mage_Adminhtml_Block_System_Config_Form_Field
|
3 |
+
{
|
4 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
5 |
+
{
|
6 |
+
$baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
|
7 |
+
$website = Mage::app()->getRequest()->getParam('website', false);
|
8 |
+
|
9 |
+
if ($website) {
|
10 |
+
$website = Mage::app()->getWebsite($website);
|
11 |
+
$baseUrl = $website->getConfig('web/secure/base_url');
|
12 |
+
}
|
13 |
+
$passcode = Mage::helper('connector')->getPasscode();
|
14 |
+
$customerId = Mage::helper('connector')->getMappedCustomerId();
|
15 |
+
|
16 |
+
if(!strlen($passcode)) $passcode = '[PLEASE SET UP A PASSCODE]';
|
17 |
+
if(!$customerId) $customerId = '[PLEASE MAP THE CUSTOMER ID]';
|
18 |
+
$text = sprintf('%sconnector/report/recentlyviewed/code/%s/customer_id/@%s@', $baseUrl, $passcode, $customerId);
|
19 |
+
$element->setData('value', $text);
|
20 |
+
|
21 |
+
return parent::_getElementHtml($element);
|
22 |
+
|
23 |
+
}
|
24 |
+
}
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_System_Dynamic_Related extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
6 |
+
{
|
7 |
+
$baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
|
8 |
+
$website = Mage::app()->getRequest()->getParam('website', false);
|
9 |
+
|
10 |
+
if ($website) {
|
11 |
+
$website = Mage::app()->getWebsite($website);
|
12 |
+
$baseUrl = $website->getConfig('web/secure/base_url');
|
13 |
+
}
|
14 |
+
$passcode = Mage::helper('connector')->getPasscode();
|
15 |
+
$lastOrderId = Mage::helper('connector')->getLastOrderId();
|
16 |
+
|
17 |
+
if(!strlen($passcode)) $passcode = '[PLEASE SET UP A PASSCODE]';
|
18 |
+
if(!$lastOrderId) $lastOrderId = '[PLEASE MAP THE LAST ORDER ID]';
|
19 |
+
|
20 |
+
$text = sprintf('%sconnector/products/related/code/%s/order_id/@%s@', $baseUrl, $passcode, $lastOrderId);
|
21 |
+
$element->setData('value', $text);
|
22 |
+
|
23 |
+
return parent::_getElementHtml($element);
|
24 |
+
|
25 |
+
}
|
26 |
+
}
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_System_Dynamic_Upsell extends Mage_Adminhtml_Block_System_Config_Form_Field
|
3 |
+
{
|
4 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
5 |
+
{
|
6 |
+
$baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
|
7 |
+
$website = Mage::app()->getRequest()->getParam('website', false);
|
8 |
+
|
9 |
+
if ($website) {
|
10 |
+
$website = Mage::app()->getWebsite($website);
|
11 |
+
$baseUrl = $website->getConfig('web/secure/base_url');
|
12 |
+
}
|
13 |
+
$passcode = Mage::helper('connector')->getPasscode();
|
14 |
+
$lastOrderid = Mage::helper('connector')->getLastOrderId();
|
15 |
+
|
16 |
+
if(!strlen($passcode)) $passcode = '[PLEASE SET UP A PASSCODE]';
|
17 |
+
if(!$lastOrderid) $lastOrderid = '[PLEASE MAP THE LAST ORDER ID]';
|
18 |
+
|
19 |
+
$text = sprintf('%sconnector/products/upsell/code/%s/order_id/@%s@', $baseUrl, $passcode, $lastOrderid);
|
20 |
+
$element->setData('value', $text);
|
21 |
+
|
22 |
+
return parent::_getElementHtml($element);
|
23 |
+
}
|
24 |
+
}
|
@@ -1,12 +1,14 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
class
|
4 |
{
|
5 |
|
6 |
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
7 |
{
|
8 |
$element->setData('onchange', "apiValidation(this.form, this);");
|
9 |
|
|
|
|
|
10 |
$element->setData('after_element_html', "
|
11 |
<script>
|
12 |
document.observe('dom:loaded', function(){
|
@@ -14,17 +16,17 @@ class Dotdigitalgroup_Email_Block_Adminhtml_System_Config_Wrapper extends Mage_A
|
|
14 |
|
15 |
});
|
16 |
function apiValidation(form, element) {
|
17 |
-
var api_user = $('
|
18 |
-
var api_password = $('
|
19 |
|
20 |
-
var reloadurl = '{$
|
21 |
|
22 |
new Ajax.Request(reloadurl, {
|
23 |
method: 'post',
|
24 |
-
parameters: {'
|
25 |
onComplete: function(transport) {
|
26 |
Element.hide('loadingmask');
|
27 |
-
if(transport.responseText == '\"Valid
|
28 |
api_user.setStyle({
|
29 |
fontWeight: 'bold',
|
30 |
color: 'green' ,
|
1 |
<?php
|
2 |
|
3 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_System_Emailapivalidate extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
{
|
5 |
|
6 |
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
7 |
{
|
8 |
$element->setData('onchange', "apiValidation(this.form, this);");
|
9 |
|
10 |
+
$url = Mage::helper('adminhtml')->getUrl('*/connector/ajaxvalidation');
|
11 |
+
|
12 |
$element->setData('after_element_html', "
|
13 |
<script>
|
14 |
document.observe('dom:loaded', function(){
|
16 |
|
17 |
});
|
18 |
function apiValidation(form, element) {
|
19 |
+
var api_user = $('connector_transactional_emails_credentials_api_username');
|
20 |
+
var api_password = $('connector_transactional_emails_credentials_api_password');
|
21 |
|
22 |
+
var reloadurl = '{$url}';
|
23 |
|
24 |
new Ajax.Request(reloadurl, {
|
25 |
method: 'post',
|
26 |
+
parameters: {'api_username' : api_user.value, 'api_password' : api_password.value},
|
27 |
onComplete: function(transport) {
|
28 |
Element.hide('loadingmask');
|
29 |
+
if(transport.responseText == '\"Credentials Valid.\"'){
|
30 |
api_user.setStyle({
|
31 |
fontWeight: 'bold',
|
32 |
color: 'green' ,
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_System_Sms_Smsmessagefour extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
const DEFAULT_TEXT = 'Default SMS Text';
|
6 |
+
|
7 |
+
/**
|
8 |
+
* SMS insert links.
|
9 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
10 |
+
*
|
11 |
+
* @return string
|
12 |
+
*/
|
13 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract$element)
|
14 |
+
{
|
15 |
+
$element->setData('placeholder', self::DEFAULT_TEXT);
|
16 |
+
$element->setData('after_element_html',
|
17 |
+
"<a href='#' onclick=\"injectText('connector_sms_sms_four_message', '{{var order_number}}');return false;\">Insert Order Number</a>
|
18 |
+
<a href='#' onclick=\"injectText('connector_sms_sms_four_message', '{{var customer_name}}');return false;\">Insert Customer Name</a>"
|
19 |
+
);
|
20 |
+
return parent::_getElementHtml($element);
|
21 |
+
}
|
22 |
+
|
23 |
+
|
24 |
+
}
|
@@ -1,18 +1,23 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
class
|
4 |
{
|
5 |
const DEFAULT_TEXT = 'Default SMS Text';
|
6 |
|
7 |
-
|
8 |
-
|
9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
$element->setData('placeholder', self::DEFAULT_TEXT);
|
|
|
11 |
|
12 |
-
|
13 |
-
|
14 |
-
<a href='#' onclick=\"injectText('sms_section_sms_message_one_message', '{{var order_number}}');return false;\">Insert Order Number</a>
|
15 |
-
<a href='#' onclick=\"injectText('sms_section_sms_message_one_message', '{{var customer_name}}');return false;\">Insert Customer Name</a>
|
16 |
|
17 |
<script type='text/javascript'>
|
18 |
function injectText(element,value){
|
1 |
<?php
|
2 |
|
3 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_System_Sms_Smsmessageone extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
{
|
5 |
const DEFAULT_TEXT = 'Default SMS Text';
|
6 |
|
7 |
+
/**
|
8 |
+
* SMS insert links.
|
9 |
+
*
|
10 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
11 |
+
*
|
12 |
+
* @return string
|
13 |
+
*/
|
14 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract$element)
|
15 |
+
{
|
16 |
$element->setData('placeholder', self::DEFAULT_TEXT);
|
17 |
+
$element->setData('after_element_html',
|
18 |
|
19 |
+
"<a href='#' onclick=\"injectText('connector_sms_sms_one_message', '{{var order_number}}');return false;\">Insert Order Number</a>
|
20 |
+
<a href='#' onclick=\"injectText('connector_sms_sms_one_message', '{{var customer_name}}');return false;\">Insert Customer Name</a>
|
|
|
|
|
21 |
|
22 |
<script type='text/javascript'>
|
23 |
function injectText(element,value){
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_System_Sms_Smsmessagethree extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
const DEFAULT_TEXT = 'Default SMS Text';
|
6 |
+
|
7 |
+
/**
|
8 |
+
* SMS insert links.
|
9 |
+
*
|
10 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
11 |
+
*
|
12 |
+
* @return string
|
13 |
+
*/
|
14 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract$element)
|
15 |
+
{
|
16 |
+
$element->setData('placeholder', self::DEFAULT_TEXT);
|
17 |
+
$element->setData('after_element_html',
|
18 |
+
|
19 |
+
"<a href='#' onclick=\"injectText('connector_sms_sms_three_message', '{{var order_number}}');return false;\">Insert Order Number</a>
|
20 |
+
<a href='#' onclick=\"injectText('connector_sms_sms_three_message', '{{var customer_name}}');return false;\">Insert Customer Name</a>"
|
21 |
+
);
|
22 |
+
return parent::_getElementHtml($element);
|
23 |
+
}
|
24 |
+
|
25 |
+
|
26 |
+
}
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_System_Sms_Smsmessagetwo extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
const DEFAULT_TEXT = 'Default SMS Text';
|
6 |
+
|
7 |
+
/**
|
8 |
+
* SMS insert links.
|
9 |
+
*
|
10 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
11 |
+
*
|
12 |
+
* @return string
|
13 |
+
*/
|
14 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract$element)
|
15 |
+
{
|
16 |
+
$element->setData('placeholder', self::DEFAULT_TEXT);
|
17 |
+
$element->setData('after_element_html',
|
18 |
+
"<a href='#' onclick=\"injectText('connector_sms_sms_two_message', '{{var order_number}}');return false;\">Insert Order Number</a>
|
19 |
+
<a href='#' onclick=\"injectText('connector_sms_sms_two_message', '{{var customer_name}}');return false;\">Insert Customer Name</a>"
|
20 |
+
);
|
21 |
+
return parent::_getElementHtml($element);
|
22 |
+
}
|
23 |
+
|
24 |
+
|
25 |
+
}
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_System_Url_Creditmemoupdate extends Mage_Adminhtml_Block_System_Config_Form_Field
|
3 |
+
{
|
4 |
+
/**
|
5 |
+
* Generate the urls.
|
6 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
7 |
+
*
|
8 |
+
* @return string
|
9 |
+
* @throws Mage_Core_Exception
|
10 |
+
*/
|
11 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
12 |
+
{
|
13 |
+
$baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
|
14 |
+
$website = Mage::app()->getRequest()->getParam('website', false);
|
15 |
+
|
16 |
+
if ($website) {
|
17 |
+
$website = Mage::app()->getWebsite($website);
|
18 |
+
$baseUrl = $website->getConfig('web/secure/base_url');
|
19 |
+
}
|
20 |
+
$helper = Mage::helper('connector');
|
21 |
+
$passcode = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_DYNAMIC_CONTENT_PASSCODE, $website);
|
22 |
+
$orderId = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_MAPPING_LAST_ORDER_ID, $website);
|
23 |
+
|
24 |
+
if(!strlen($passcode)) $passcode = '[PLEASE SET UP A PASSCODE]';
|
25 |
+
|
26 |
+
$text = sprintf('%sconnector/creditmemo/update/code/%s/order_id/@%s@', $baseUrl, $passcode, $orderId);
|
27 |
+
|
28 |
+
$element->setData('value', $text);
|
29 |
+
|
30 |
+
return parent::_getElementHtml($element);
|
31 |
+
}
|
32 |
+
}
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_System_Url_Creditmemoupdateguest extends Mage_Adminhtml_Block_System_Config_Form_Field
|
3 |
+
{
|
4 |
+
/**
|
5 |
+
* Generate the urls.
|
6 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
7 |
+
*
|
8 |
+
* @return string
|
9 |
+
* @throws Mage_Core_Exception
|
10 |
+
*/
|
11 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
12 |
+
{
|
13 |
+
$baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
|
14 |
+
$website = Mage::app()->getRequest()->getParam('website', false);
|
15 |
+
|
16 |
+
if ($website) {
|
17 |
+
$website = Mage::app()->getWebsite($website);
|
18 |
+
$baseUrl = $website->getConfig('web/secure/base_url');
|
19 |
+
}
|
20 |
+
$helper = Mage::helper('connector');
|
21 |
+
$passcode = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_DYNAMIC_CONTENT_PASSCODE, $website);
|
22 |
+
$orderId = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_MAPPING_LAST_ORDER_ID, $website);
|
23 |
+
if(!strlen($passcode)) $passcode = '[PLEASE SET UP A PASSCODE]';
|
24 |
+
|
25 |
+
$text = sprintf('%sconnector/creditmemo/updateguest/code/%s/order_id/@%s@', $baseUrl, $passcode, $orderId);
|
26 |
+
$element->setData('value', $text);
|
27 |
+
|
28 |
+
return parent::_getElementHtml($element);
|
29 |
+
}
|
30 |
+
}
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_System_Url_Customerconfirmation extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Generate the urls.
|
8 |
+
*
|
9 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
10 |
+
*
|
11 |
+
* @return string
|
12 |
+
* @throws Mage_Core_Exception
|
13 |
+
*/
|
14 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
15 |
+
{
|
16 |
+
$baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
|
17 |
+
$website = Mage::app()->getRequest()->getParam('website', false);
|
18 |
+
|
19 |
+
if ($website) {
|
20 |
+
$website = Mage::app()->getWebsite($website);
|
21 |
+
$baseUrl = $website->getConfig('web/secure/base_url');
|
22 |
+
}
|
23 |
+
$helper = Mage::helper('connector');
|
24 |
+
$passcode = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_DYNAMIC_CONTENT_PASSCODE, $website);
|
25 |
+
$customerId = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_MAPPING_CUSTOMER_ID, $website);
|
26 |
+
|
27 |
+
if(!strlen($passcode)) $passcode = '[PLEASE SET UP A PASSCODE]';
|
28 |
+
|
29 |
+
$text = sprintf('%sconnector/customer/confirmation/code/%s/customer_id/@%s@', $baseUrl, $passcode, $customerId);
|
30 |
+
$element->setData('value', $text);
|
31 |
+
|
32 |
+
return parent::_getElementHtml($element);
|
33 |
+
}
|
34 |
+
|
35 |
+
|
36 |
+
}
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_System_Url_Customerconfirmed extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Generate the urls.
|
8 |
+
*
|
9 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
10 |
+
*
|
11 |
+
* @return string
|
12 |
+
* @throws Mage_Core_Exception
|
13 |
+
*/
|
14 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
15 |
+
{
|
16 |
+
$baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
|
17 |
+
$website = Mage::app()->getRequest()->getParam('website', false);
|
18 |
+
|
19 |
+
if ($website) {
|
20 |
+
$website = Mage::app()->getWebsite($website);
|
21 |
+
$baseUrl = $website->getConfig('web/secure/base_url');
|
22 |
+
}
|
23 |
+
$helper = Mage::helper('connector');
|
24 |
+
$passcode = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_DYNAMIC_CONTENT_PASSCODE, $website);
|
25 |
+
$customerId = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_MAPPING_CUSTOMER_ID, $website);
|
26 |
+
|
27 |
+
if(!strlen($passcode)) $passcode = '[PLEASE SET UP A PASSCODE]';
|
28 |
+
|
29 |
+
$text = sprintf('%sconnector/customer/confirmed/code/%s/customer_id/@%s@', $baseUrl, $passcode, $customerId);
|
30 |
+
$element->setData('value', $text);
|
31 |
+
|
32 |
+
return parent::_getElementHtml($element);
|
33 |
+
}
|
34 |
+
|
35 |
+
|
36 |
+
}
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_System_Url_Customernew extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Generate the urls.
|
8 |
+
*
|
9 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
10 |
+
*
|
11 |
+
* @return string
|
12 |
+
* @throws Mage_Core_Exception
|
13 |
+
*/
|
14 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
15 |
+
{
|
16 |
+
$baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
|
17 |
+
$website = Mage::app()->getRequest()->getParam('website', false);
|
18 |
+
|
19 |
+
if ($website) {
|
20 |
+
$website = Mage::app()->getWebsite($website);
|
21 |
+
$baseUrl = $website->getConfig('web/secure/base_url');
|
22 |
+
}
|
23 |
+
$helper = Mage::helper('connector');
|
24 |
+
$passcode = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_DYNAMIC_CONTENT_PASSCODE, $website);
|
25 |
+
$customerId = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_MAPPING_CUSTOMER_ID, $website);
|
26 |
+
|
27 |
+
if(!strlen($passcode)) $passcode = '[PLEASE SET UP A PASSCODE]';
|
28 |
+
|
29 |
+
$text = sprintf('%sconnector/customer/new/code/%s/customer_id/@%s@', $baseUrl, $passcode, $customerId);
|
30 |
+
$element->setData('value', $text);
|
31 |
+
|
32 |
+
return parent::_getElementHtml($element);
|
33 |
+
}
|
34 |
+
|
35 |
+
|
36 |
+
}
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_System_Url_Invoiceupdate extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Generate the urls.
|
7 |
+
*
|
8 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
9 |
+
*
|
10 |
+
* @return string
|
11 |
+
* @throws Mage_Core_Exception
|
12 |
+
*/
|
13 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
14 |
+
{
|
15 |
+
$baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
|
16 |
+
$website = Mage::app()->getRequest()->getParam('website', false);
|
17 |
+
|
18 |
+
if ($website) {
|
19 |
+
$website = Mage::app()->getWebsite($website);
|
20 |
+
$baseUrl = $website->getConfig('web/secure/base_url');
|
21 |
+
}
|
22 |
+
$helper = Mage::helper('connector');
|
23 |
+
$passcode = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_DYNAMIC_CONTENT_PASSCODE, $website);
|
24 |
+
$orderId = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_MAPPING_LAST_ORDER_ID, $website);
|
25 |
+
|
26 |
+
if(!strlen($passcode)) $passcode = '[PLEASE SET UP A PASSCODE]';
|
27 |
+
|
28 |
+
$text = sprintf('%sconnector/invoice/update/code/%s/order_id/@%s@', $baseUrl, $passcode, $orderId);
|
29 |
+
$element->setData('value', $text);
|
30 |
+
|
31 |
+
return parent::_getElementHtml($element);
|
32 |
+
}
|
33 |
+
}
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_System_Url_Invoiceupdateguest extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Generate the urls.
|
7 |
+
*
|
8 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
9 |
+
*
|
10 |
+
* @return string
|
11 |
+
* @throws Mage_Core_Exception
|
12 |
+
*/
|
13 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
14 |
+
{
|
15 |
+
$baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
|
16 |
+
$website = Mage::app()->getRequest()->getParam('website', false);
|
17 |
+
|
18 |
+
if ($website) {
|
19 |
+
$website = Mage::app()->getWebsite($website);
|
20 |
+
$baseUrl = $website->getConfig('web/secure/base_url');
|
21 |
+
}
|
22 |
+
$helper = Mage::helper('connector');
|
23 |
+
$passcode = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_DYNAMIC_CONTENT_PASSCODE, $website);
|
24 |
+
$orderId = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_MAPPING_LAST_ORDER_ID, $website);
|
25 |
+
|
26 |
+
if(!strlen($passcode)) $passcode = '[PLEASE SET UP A PASSCODE]';
|
27 |
+
|
28 |
+
$text = sprintf('%sconnector/invoice/updateguest/code/%s/order_id/@%s@', $baseUrl, $passcode, $orderId);
|
29 |
+
$element->setData('value', $text);
|
30 |
+
|
31 |
+
return parent::_getElementHtml($element);
|
32 |
+
}
|
33 |
+
}
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_System_Url_Newcreditmemo extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Generate the urls.
|
7 |
+
*
|
8 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
9 |
+
*
|
10 |
+
* @return string
|
11 |
+
* @throws Mage_Core_Exception
|
12 |
+
*/
|
13 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
14 |
+
{
|
15 |
+
|
16 |
+
$baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
|
17 |
+
$website = Mage::app()->getRequest()->getParam('website', false);
|
18 |
+
|
19 |
+
if ($website) {
|
20 |
+
$website = Mage::app()->getWebsite($website);
|
21 |
+
$baseUrl = $website->getConfig('web/secure/base_url');
|
22 |
+
}
|
23 |
+
$helper = Mage::helper('connector');
|
24 |
+
$passcode = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_DYNAMIC_CONTENT_PASSCODE, $website);
|
25 |
+
$orderId = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_MAPPING_LAST_ORDER_ID, $website);
|
26 |
+
|
27 |
+
|
28 |
+
if(!strlen($passcode)) $passcode = '[PLEASE SET UP A PASSCODE]';
|
29 |
+
|
30 |
+
$text = sprintf('%sconnector/creditmemo/new/code/%s/order_id/@%s@', $baseUrl, $passcode, $orderId);
|
31 |
+
$element->setData('value', $text);
|
32 |
+
|
33 |
+
return parent::_getElementHtml($element);
|
34 |
+
}
|
35 |
+
|
36 |
+
}
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_System_Url_Newcreditmemoguest extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Generate the urls.
|
7 |
+
*
|
8 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
9 |
+
*
|
10 |
+
* @return string
|
11 |
+
* @throws Mage_Core_Exception
|
12 |
+
*/
|
13 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
14 |
+
{
|
15 |
+
$baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
|
16 |
+
$website = Mage::app()->getRequest()->getParam('website', false);
|
17 |
+
|
18 |
+
if ($website) {
|
19 |
+
$website = Mage::app()->getWebsite($website);
|
20 |
+
$baseUrl = $website->getConfig('web/secure/base_url');
|
21 |
+
}
|
22 |
+
$helper = Mage::helper('connector');
|
23 |
+
$passcode = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_DYNAMIC_CONTENT_PASSCODE, $website);
|
24 |
+
$orderId = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_MAPPING_LAST_ORDER_ID, $website);
|
25 |
+
|
26 |
+
|
27 |
+
if(!strlen($passcode)) $passcode = '[PLEASE SET UP A PASSCODE]';
|
28 |
+
|
29 |
+
$text = sprintf('%sconnector/creditmemo/newguest/code/%s/order_id/@%s@', $baseUrl, $passcode, $orderId);
|
30 |
+
$element->setData('value', $text);
|
31 |
+
|
32 |
+
return parent::_getElementHtml($element);
|
33 |
+
}
|
34 |
+
|
35 |
+
}
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_System_Url_Newinvoice extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Generate the urls.
|
7 |
+
*
|
8 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
9 |
+
*
|
10 |
+
* @return string
|
11 |
+
* @throws Mage_Core_Exception
|
12 |
+
*/
|
13 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
14 |
+
{
|
15 |
+
$baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
|
16 |
+
$website = Mage::app()->getRequest()->getParam('website', false);
|
17 |
+
|
18 |
+
if ($website) {
|
19 |
+
$website = Mage::app()->getWebsite($website);
|
20 |
+
$baseUrl = $website->getConfig('web/secure/base_url');
|
21 |
+
}
|
22 |
+
$helper = Mage::helper('connector');
|
23 |
+
$passcode = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_DYNAMIC_CONTENT_PASSCODE, $website);
|
24 |
+
$orderId = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_MAPPING_LAST_ORDER_ID, $website);
|
25 |
+
|
26 |
+
|
27 |
+
if(!strlen($passcode)) $passcode = '[PLEASE SET UP A PASSCODE]';
|
28 |
+
|
29 |
+
$text = sprintf('%sconnector/invoice/new/code/%s/order_id/@%s@', $baseUrl, $passcode, $orderId);
|
30 |
+
$element->setData('value', $text);
|
31 |
+
|
32 |
+
return parent::_getElementHtml($element);
|
33 |
+
}
|
34 |
+
}
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_System_Url_Newinvoiceguest extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Generate the urls.
|
7 |
+
*
|
8 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
9 |
+
*
|
10 |
+
* @return string
|
11 |
+
* @throws Mage_Core_Exception
|
12 |
+
*/
|
13 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
14 |
+
{
|
15 |
+
$baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
|
16 |
+
$website = Mage::app()->getRequest()->getParam('website', false);
|
17 |
+
|
18 |
+
if ($website) {
|
19 |
+
$website = Mage::app()->getWebsite($website);
|
20 |
+
$baseUrl = $website->getConfig('web/secure/base_url');
|
21 |
+
}
|
22 |
+
$helper = Mage::helper('connector');
|
23 |
+
$passcode = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_DYNAMIC_CONTENT_PASSCODE, $website);
|
24 |
+
$orderId = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_MAPPING_LAST_ORDER_ID, $website);
|
25 |
+
|
26 |
+
|
27 |
+
if(!strlen($passcode)) $passcode = '[PLEASE SET UP A PASSCODE]';
|
28 |
+
|
29 |
+
$text = sprintf('%sconnector/invoice/newguest/code/%s/order_id/@%s@', $baseUrl, $passcode, $orderId);
|
30 |
+
$element->setData('value', $text);
|
31 |
+
|
32 |
+
return parent::_getElementHtml($element);
|
33 |
+
}
|
34 |
+
}
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_System_Url_Neworder extends Mage_Adminhtml_Block_System_Config_Form_Field
|
3 |
+
{
|
4 |
+
/**
|
5 |
+
* Generate the urls.
|
6 |
+
*
|
7 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
8 |
+
*
|
9 |
+
* @return string
|
10 |
+
* @throws Mage_Core_Exception
|
11 |
+
*/
|
12 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
13 |
+
{
|
14 |
+
$baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
|
15 |
+
$website = Mage::app()->getRequest()->getParam('website', false);
|
16 |
+
|
17 |
+
if ($website) {
|
18 |
+
$website = Mage::app()->getWebsite($website);
|
19 |
+
$baseUrl = $website->getConfig('web/secure/base_url');
|
20 |
+
}
|
21 |
+
$helper = Mage::helper('connector');
|
22 |
+
$passcode = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_DYNAMIC_CONTENT_PASSCODE, $website);
|
23 |
+
$orderId = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_MAPPING_LAST_ORDER_ID, $website);
|
24 |
+
|
25 |
+
|
26 |
+
if(!strlen($passcode)) $passcode = '[PLEASE SET UP A PASSCODE]';
|
27 |
+
|
28 |
+
$text = sprintf('%sconnector/order/new/code/%s/order_id/@%s@', $baseUrl, $passcode, $orderId);
|
29 |
+
$element->setData('value', $text);
|
30 |
+
|
31 |
+
return parent::_getElementHtml($element);
|
32 |
+
}
|
33 |
+
}
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_System_Url_Neworderguest extends Mage_Adminhtml_Block_System_Config_Form_Field
|
3 |
+
{
|
4 |
+
/**
|
5 |
+
* Generate the urls.
|
6 |
+
*
|
7 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
8 |
+
*
|
9 |
+
* @return string
|
10 |
+
* @throws Mage_Core_Exception
|
11 |
+
*/
|
12 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
13 |
+
{
|
14 |
+
$baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
|
15 |
+
$website = Mage::app()->getRequest()->getParam('website', false);
|
16 |
+
|
17 |
+
if ($website) {
|
18 |
+
$website = Mage::app()->getWebsite($website);
|
19 |
+
$baseUrl = $website->getConfig('web/secure/base_url');
|
20 |
+
}
|
21 |
+
$helper = Mage::helper('connector');
|
22 |
+
$passcode = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_DYNAMIC_CONTENT_PASSCODE, $website);
|
23 |
+
$orderId = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_MAPPING_LAST_ORDER_ID, $website);
|
24 |
+
|
25 |
+
if(!strlen($passcode)) $passcode = '[PLEASE SET UP A PASSCODE]';
|
26 |
+
|
27 |
+
$text = sprintf('%sconnector/order/newguest/code/%s/order_id/@%s@', $baseUrl, $passcode, $orderId);
|
28 |
+
$element->setData('value', $text);
|
29 |
+
|
30 |
+
return parent::_getElementHtml($element);
|
31 |
+
}
|
32 |
+
}
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_System_Url_Newshipment extends Mage_Adminhtml_Block_System_Config_Form_Field
|
3 |
+
{
|
4 |
+
/**
|
5 |
+
* Generate the urls.
|
6 |
+
*
|
7 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
8 |
+
*
|
9 |
+
* @return string
|
10 |
+
* @throws Mage_Core_Exception
|
11 |
+
*/
|
12 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
13 |
+
{
|
14 |
+
$baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
|
15 |
+
$website = Mage::app()->getRequest()->getParam('website', false);
|
16 |
+
|
17 |
+
if ($website) {
|
18 |
+
$website = Mage::app()->getWebsite($website);
|
19 |
+
$baseUrl = $website->getConfig('web/secure/base_url');
|
20 |
+
}
|
21 |
+
$helper = Mage::helper('connector');
|
22 |
+
$passcode = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_DYNAMIC_CONTENT_PASSCODE, $website);
|
23 |
+
$orderId = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_MAPPING_LAST_ORDER_ID, $website);
|
24 |
+
|
25 |
+
if(!strlen($passcode)) $passcode = '[PLEASE SET UP A PASSCODE]';
|
26 |
+
|
27 |
+
$text = sprintf('%sconnector/shipping/new/code/%s/order_id/@%s@', $baseUrl, $passcode, $orderId);
|
28 |
+
|
29 |
+
|
30 |
+
$element->setData('value', $text);
|
31 |
+
|
32 |
+
return parent::_getElementHtml($element);
|
33 |
+
}
|
34 |
+
}
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_System_Url_Newshipmentguest extends Mage_Adminhtml_Block_System_Config_Form_Field
|
3 |
+
{
|
4 |
+
/**
|
5 |
+
* Generate the urls.
|
6 |
+
*
|
7 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
8 |
+
*
|
9 |
+
* @return string
|
10 |
+
* @throws Mage_Core_Exception
|
11 |
+
*/
|
12 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
13 |
+
{
|
14 |
+
$baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
|
15 |
+
$website = Mage::app()->getRequest()->getParam('website', false);
|
16 |
+
|
17 |
+
if ($website) {
|
18 |
+
$website = Mage::app()->getWebsite($website);
|
19 |
+
$baseUrl = $website->getConfig('web/secure/base_url');
|
20 |
+
}
|
21 |
+
$helper = Mage::helper('connector');
|
22 |
+
$passcode = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_DYNAMIC_CONTENT_PASSCODE, $website);
|
23 |
+
$orderId = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_MAPPING_LAST_ORDER_ID, $website);
|
24 |
+
|
25 |
+
if(!strlen($passcode)) $passcode = '[PLEASE SET UP A PASSCODE]';
|
26 |
+
|
27 |
+
$text = sprintf('%sconnector/shipping/newguest/code/%s/order_id/@%s@', $baseUrl, $passcode, $orderId);
|
28 |
+
|
29 |
+
$element->setData('value', $text);
|
30 |
+
|
31 |
+
return parent::_getElementHtml($element);
|
32 |
+
}
|
33 |
+
}
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_System_Url_Orderupdate extends Mage_Adminhtml_Block_System_Config_Form_Field
|
3 |
+
{
|
4 |
+
/**
|
5 |
+
* Generate the urls.
|
6 |
+
*
|
7 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
8 |
+
*
|
9 |
+
* @return string
|
10 |
+
* @throws Mage_Core_Exception
|
11 |
+
*/
|
12 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
13 |
+
{
|
14 |
+
$baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
|
15 |
+
$website = Mage::app()->getRequest()->getParam('website', false);
|
16 |
+
|
17 |
+
if ($website) {
|
18 |
+
$website = Mage::app()->getWebsite($website);
|
19 |
+
$baseUrl = $website->getConfig('web/secure/base_url');
|
20 |
+
}
|
21 |
+
$helper = Mage::helper('connector');
|
22 |
+
$passcode = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_DYNAMIC_CONTENT_PASSCODE, $website);
|
23 |
+
$orderId = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_MAPPING_LAST_ORDER_ID, $website);
|
24 |
+
|
25 |
+
if(!strlen($passcode)) $passcode = '[PLEASE SET UP A PASSCODE]';
|
26 |
+
$text = sprintf('%sconnector/order/update/code/%s/order_id/@%s@', $baseUrl, $passcode, $orderId);
|
27 |
+
$element->setData('value', $text);
|
28 |
+
|
29 |
+
return parent::_getElementHtml($element);
|
30 |
+
}
|
31 |
+
}
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_System_Url_Orderupdateguest extends Mage_Adminhtml_Block_System_Config_Form_Field
|
3 |
+
{
|
4 |
+
/**
|
5 |
+
* Generate the urls.
|
6 |
+
*
|
7 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
8 |
+
*
|
9 |
+
* @return string
|
10 |
+
* @throws Mage_Core_Exception
|
11 |
+
*/
|
12 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
13 |
+
{
|
14 |
+
$baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
|
15 |
+
$website = Mage::app()->getRequest()->getParam('website', false);
|
16 |
+
|
17 |
+
if ($website) {
|
18 |
+
$website = Mage::app()->getWebsite($website);
|
19 |
+
$baseUrl = $website->getConfig('web/secure/base_url');
|
20 |
+
}
|
21 |
+
$helper = Mage::helper('connector');
|
22 |
+
$passcode = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_DYNAMIC_CONTENT_PASSCODE, $website);
|
23 |
+
$orderId = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_MAPPING_LAST_ORDER_ID, $website);
|
24 |
+
|
25 |
+
if(!strlen($passcode)) $passcode = '[PLEASE SET UP A PASSCODE]';
|
26 |
+
$text = sprintf('%sconnector/order/updateguest/code/%s/order_id/@%s@', $baseUrl, $passcode, $orderId);
|
27 |
+
$element->setData('value', $text);
|
28 |
+
|
29 |
+
return parent::_getElementHtml($element);
|
30 |
+
}
|
31 |
+
}
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_System_Url_Shipmentupdate extends Mage_Adminhtml_Block_System_Config_Form_Field
|
3 |
+
{
|
4 |
+
/**
|
5 |
+
* Generate the urls.
|
6 |
+
*
|
7 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
8 |
+
*
|
9 |
+
* @return string
|
10 |
+
* @throws Mage_Core_Exception
|
11 |
+
*/
|
12 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
13 |
+
{
|
14 |
+
$baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
|
15 |
+
$website = Mage::app()->getRequest()->getParam('website', false);
|
16 |
+
|
17 |
+
if ($website) {
|
18 |
+
$website = Mage::app()->getWebsite($website);
|
19 |
+
$baseUrl = $website->getConfig('web/secure/base_url');
|
20 |
+
}
|
21 |
+
$helper = Mage::helper('connector');
|
22 |
+
$passcode = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_DYNAMIC_CONTENT_PASSCODE, $website);
|
23 |
+
$orderId = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_MAPPING_LAST_ORDER_ID, $website);
|
24 |
+
|
25 |
+
if(!strlen($passcode)) $passcode = '[PLEASE SET UP A PASSCODE]';
|
26 |
+
|
27 |
+
$text = sprintf('%sconnector/shipping/update/code/%s/order_id/@%s@', $baseUrl, $passcode, $orderId);
|
28 |
+
|
29 |
+
$element->setData('value', $text);
|
30 |
+
|
31 |
+
return parent::_getElementHtml($element);
|
32 |
+
}
|
33 |
+
}
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_System_Url_Shipmentupdateguest extends Mage_Adminhtml_Block_System_Config_Form_Field
|
3 |
+
{
|
4 |
+
/**
|
5 |
+
* Generate the urls.
|
6 |
+
*
|
7 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
8 |
+
*
|
9 |
+
* @return string
|
10 |
+
* @throws Mage_Core_Exception
|
11 |
+
*/
|
12 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
13 |
+
{
|
14 |
+
$baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
|
15 |
+
$website = Mage::app()->getRequest()->getParam('website', false);
|
16 |
+
|
17 |
+
if ($website) {
|
18 |
+
$website = Mage::app()->getWebsite($website);
|
19 |
+
$baseUrl = $website->getConfig('web/secure/base_url');
|
20 |
+
}
|
21 |
+
$helper = Mage::helper('connector');
|
22 |
+
$passcode = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_DYNAMIC_CONTENT_PASSCODE, $website);
|
23 |
+
$orderId = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_MAPPING_LAST_ORDER_ID, $website);
|
24 |
+
|
25 |
+
if(!strlen($passcode)) $passcode = '[PLEASE SET UP A PASSCODE]';
|
26 |
+
|
27 |
+
$text = sprintf('%sconnector/shipping/updateguest/code/%s/order_id/@%s@', $baseUrl, $passcode, $orderId);
|
28 |
+
$element->setData('value', $text);
|
29 |
+
|
30 |
+
return parent::_getElementHtml($element);
|
31 |
+
}
|
32 |
+
}
|
@@ -4,11 +4,18 @@ class Dotdigitalgroup_Email_Block_Basket extends Mage_Core_Block_Template
|
|
4 |
{
|
5 |
protected $_quote;
|
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
public function getBasketItems()
|
8 |
{
|
9 |
$params = $this->getRequest()->getParams();
|
10 |
|
11 |
-
if(!isset($params['email']) && !isset($params['code']))
|
12 |
exit();
|
13 |
Mage::helper('connector')->auth($params['code']);
|
14 |
|
@@ -17,24 +24,32 @@ class Dotdigitalgroup_Email_Block_Basket extends Mage_Core_Block_Template
|
|
17 |
$customer = Mage::getModel('customer/customer');
|
18 |
$customer->setWebsiteId(Mage::app()->getWebsite()->getId())->loadByEmail($email);
|
19 |
|
|
|
|
|
|
|
|
|
20 |
//last active guest basket
|
21 |
$quoteModel = Mage::getResourceModel('sales/quote_collection')
|
22 |
-
->addFieldToFilter('is_active',1)
|
23 |
->addFieldToFilter('items_count', array('gt' => 0))
|
24 |
->addFieldToFilter('customer_email', $email)
|
25 |
-
->setOrder('updated_at'
|
26 |
-
->setPageSize(1)
|
27 |
-
;
|
28 |
|
29 |
$quoteModel = $quoteModel->getFirstItem();
|
30 |
$this->_quote = $quoteModel;
|
31 |
|
32 |
-
$
|
33 |
-
Mage::app()->setCurrentStore($
|
34 |
|
35 |
-
return $quoteModel->getAllItems()
|
36 |
}
|
37 |
|
|
|
|
|
|
|
|
|
|
|
38 |
public function getGrandTotal()
|
39 |
{
|
40 |
return $this->_quote->getGrandTotal();
|
4 |
{
|
5 |
protected $_quote;
|
6 |
|
7 |
+
/**
|
8 |
+
* Basket itmes.
|
9 |
+
*
|
10 |
+
* @return mixed
|
11 |
+
* @throws Exception
|
12 |
+
* @throws Mage_Core_Exception
|
13 |
+
*/
|
14 |
public function getBasketItems()
|
15 |
{
|
16 |
$params = $this->getRequest()->getParams();
|
17 |
|
18 |
+
if (!isset($params['email']) && !isset($params['code']))
|
19 |
exit();
|
20 |
Mage::helper('connector')->auth($params['code']);
|
21 |
|
24 |
$customer = Mage::getModel('customer/customer');
|
25 |
$customer->setWebsiteId(Mage::app()->getWebsite()->getId())->loadByEmail($email);
|
26 |
|
27 |
+
if (! $customer->getId()) {
|
28 |
+
Mage::helper('connector')->log('Lost basket : customer not found : ' . $email);
|
29 |
+
exit();
|
30 |
+
}
|
31 |
//last active guest basket
|
32 |
$quoteModel = Mage::getResourceModel('sales/quote_collection')
|
33 |
+
->addFieldToFilter('is_active', 1)
|
34 |
->addFieldToFilter('items_count', array('gt' => 0))
|
35 |
->addFieldToFilter('customer_email', $email)
|
36 |
+
->setOrder('updated_at', 'DESC')
|
37 |
+
->setPageSize(1);
|
|
|
38 |
|
39 |
$quoteModel = $quoteModel->getFirstItem();
|
40 |
$this->_quote = $quoteModel;
|
41 |
|
42 |
+
$storeId = $quoteModel->getStoreId();
|
43 |
+
Mage::app()->setCurrentStore($storeId);
|
44 |
|
45 |
+
return $quoteModel->getAllItems();
|
46 |
}
|
47 |
|
48 |
+
/**
|
49 |
+
* Grand total.
|
50 |
+
*
|
51 |
+
* @return mixed
|
52 |
+
*/
|
53 |
public function getGrandTotal()
|
54 |
{
|
55 |
return $this->_quote->getGrandTotal();
|
@@ -2,10 +2,15 @@
|
|
2 |
|
3 |
class Dotdigitalgroup_Email_Block_Coupon extends Mage_Core_Block_Template
|
4 |
{
|
|
|
|
|
|
|
|
|
|
|
5 |
public function generateCoupon()
|
6 |
{
|
7 |
$params = $this->getRequest()->getParams();
|
8 |
-
if(!isset($params['id']) || !isset($params['code']))
|
9 |
exit();
|
10 |
//coupon rule id
|
11 |
$couponCodeId = $params['id'];
|
@@ -14,27 +19,23 @@ class Dotdigitalgroup_Email_Block_Coupon extends Mage_Core_Block_Template
|
|
14 |
//authenticate
|
15 |
Mage::helper('connector')->auth($authCode);
|
16 |
|
17 |
-
if($couponCodeId){
|
18 |
|
19 |
$rule = Mage::getModel('salesrule/rule')->load($couponCodeId);
|
20 |
$generator = Mage::getModel('salesrule/coupon_massgenerator');
|
21 |
-
|
22 |
$generator->setFormat( Mage_SalesRule_Helper_Coupon::COUPON_FORMAT_ALPHANUMERIC );
|
23 |
$generator->setRuleId($couponCodeId);
|
24 |
$generator->setUsesPerCoupon(1);
|
25 |
-
$generator->setDash(
|
26 |
-
$generator->setLength(
|
27 |
-
$generator->setPrefix(
|
28 |
-
$generator->setSuffix(
|
29 |
-
|
30 |
//set the generation settings
|
31 |
$rule->setCouponCodeGenerator($generator);
|
32 |
-
$rule->setCouponType(
|
33 |
-
|
34 |
//generate the coupon
|
35 |
$coupon = $rule->acquireCoupon();
|
36 |
$couponCode = $coupon->getCode();
|
37 |
-
|
38 |
//save the type of coupon
|
39 |
$couponModel = Mage::getModel('salesrule/coupon')->loadByCode($couponCode);
|
40 |
$couponModel->setType(Mage_SalesRule_Model_Rule::COUPON_TYPE_NO_COUPON);
|
2 |
|
3 |
class Dotdigitalgroup_Email_Block_Coupon extends Mage_Core_Block_Template
|
4 |
{
|
5 |
+
/**
|
6 |
+
* Generates the coupon code based on the code id.
|
7 |
+
* @return bool
|
8 |
+
* @throws Exception
|
9 |
+
*/
|
10 |
public function generateCoupon()
|
11 |
{
|
12 |
$params = $this->getRequest()->getParams();
|
13 |
+
if (!isset($params['id']) || !isset($params['code']))
|
14 |
exit();
|
15 |
//coupon rule id
|
16 |
$couponCodeId = $params['id'];
|
19 |
//authenticate
|
20 |
Mage::helper('connector')->auth($authCode);
|
21 |
|
22 |
+
if ($couponCodeId) {
|
23 |
|
24 |
$rule = Mage::getModel('salesrule/rule')->load($couponCodeId);
|
25 |
$generator = Mage::getModel('salesrule/coupon_massgenerator');
|
|
|
26 |
$generator->setFormat( Mage_SalesRule_Helper_Coupon::COUPON_FORMAT_ALPHANUMERIC );
|
27 |
$generator->setRuleId($couponCodeId);
|
28 |
$generator->setUsesPerCoupon(1);
|
29 |
+
$generator->setDash(3);
|
30 |
+
$generator->setLength(9);
|
31 |
+
$generator->setPrefix('');
|
32 |
+
$generator->setSuffix('');
|
|
|
33 |
//set the generation settings
|
34 |
$rule->setCouponCodeGenerator($generator);
|
35 |
+
$rule->setCouponType(Mage_SalesRule_Model_Rule::COUPON_TYPE_AUTO);
|
|
|
36 |
//generate the coupon
|
37 |
$coupon = $rule->acquireCoupon();
|
38 |
$couponCode = $coupon->getCode();
|
|
|
39 |
//save the type of coupon
|
40 |
$couponModel = Mage::getModel('salesrule/coupon')->loadByCode($couponCode);
|
41 |
$couponModel->setType(Mage_SalesRule_Model_Rule::COUPON_TYPE_NO_COUPON);
|
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Customer extends Mage_Core_Block_Template
|
4 |
+
{
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Prepare layout, set template.
|
8 |
+
*
|
9 |
+
* @return Mage_Core_Block_Abstract|void
|
10 |
+
*/
|
11 |
+
protected function _prepareLayout()
|
12 |
+
{
|
13 |
+
if ($root = $this->getLayout()->getBlock('root')) {
|
14 |
+
$root->setTemplate('page/blank.phtml');
|
15 |
+
}
|
16 |
+
}
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Recommended dynamic products.
|
20 |
+
*
|
21 |
+
* @return array
|
22 |
+
* @throws Exception
|
23 |
+
*/
|
24 |
+
public function getRecommendedProducts()
|
25 |
+
{
|
26 |
+
$customerId = $this->getRequest()->getParam('customer_id', false);
|
27 |
+
$mode = $this->getRequest()->getParam('mode', false);
|
28 |
+
if ($mode && $customerId) {
|
29 |
+
$customerModel = Mage::getModel('customer/customer')->load($customerId);
|
30 |
+
Mage::app()->setCurrentStore($customerModel->getStoreId());
|
31 |
+
if ($customerModel->getId()) {
|
32 |
+
//order products
|
33 |
+
$dynamicReport = Mage::getModel('email_connector/dynamic_report');
|
34 |
+
$dynamicReport->setMode($mode)
|
35 |
+
->setCustomer($customerModel);
|
36 |
+
} else {
|
37 |
+
Mage::helper('connector')->log('ERROR Dynamic content : Customer not found '. $customerId);
|
38 |
+
return array();
|
39 |
+
}
|
40 |
+
} else {
|
41 |
+
//load the reports from dynamic
|
42 |
+
$dynamicReport = Mage::getModel('email_connector/dynamic_report');
|
43 |
+
$dynamicReport->setMode($mode);
|
44 |
+
}
|
45 |
+
$productsToDisplay = $dynamicReport->getProducts();
|
46 |
+
|
47 |
+
return $productsToDisplay;
|
48 |
+
}
|
49 |
+
|
50 |
+
public function getCustomer()
|
51 |
+
{
|
52 |
+
$message = new Varien_Object();
|
53 |
+
$customerId = Mage::app()->getRequest()->getParam('customer_id', false);
|
54 |
+
if ($customerId) {
|
55 |
+
$customerModel = Mage::getModel('customer/customer')->load($customerId);
|
56 |
+
if (! $customerModel->getId()) {
|
57 |
+
Mage::helper('connector')->log('Error: New customer, no custoemr found : ' . $customerId);
|
58 |
+
return $message->setError('No customer found : ' . $customerId);
|
59 |
+
}
|
60 |
+
return $customerModel;
|
61 |
+
|
62 |
+
} else {
|
63 |
+
return $message->setError('No customer id in param request : ' . $customerId);
|
64 |
+
}
|
65 |
+
}
|
66 |
+
|
67 |
+
/**
|
68 |
+
* Display type mode.
|
69 |
+
* @return mixed|string
|
70 |
+
*/
|
71 |
+
public function getDisplayType()
|
72 |
+
{
|
73 |
+
return Mage::helper('connector/recommended')->getDisplayType();
|
74 |
+
}
|
75 |
+
|
76 |
+
/**
|
77 |
+
* @return Mage_Core_Model_Store
|
78 |
+
*/
|
79 |
+
public function getStore()
|
80 |
+
{
|
81 |
+
$customerId = Mage::app()->getRequest()->getParam('customer_id', false);
|
82 |
+
return Mage::app()->getStore(Mage::getModel('customer/customer')->load($customerId)->getStoreId());
|
83 |
+
}
|
84 |
+
|
85 |
+
public function getConfirmation()
|
86 |
+
{
|
87 |
+
$customerId = Mage::app()->getRequest()->getParam('customer_id', false);
|
88 |
+
$customerModel = Mage::getModel('customer/customer')->load($customerId);
|
89 |
+
|
90 |
+
if ($confirmation = $customerModel->getConfirmation()) {
|
91 |
+
return $confirmation;
|
92 |
+
}
|
93 |
+
Mage::helper('connector')->log('Customer already confirmed the account');
|
94 |
+
}
|
95 |
+
|
96 |
+
}
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Order extends Mage_Core_Block_Template
|
4 |
+
{
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Prepare layout, set template and title.
|
8 |
+
*
|
9 |
+
* @return Mage_Core_Block_Abstract|void
|
10 |
+
*/
|
11 |
+
protected function _prepareLayout()
|
12 |
+
{
|
13 |
+
if ($root = $this->getLayout()->getBlock('root')) {
|
14 |
+
$root->setTemplate('page/blank.phtml');
|
15 |
+
}
|
16 |
+
if ($headBlock = $this->getLayout()->getBlock('head')) {
|
17 |
+
$headBlock->setTitle($this->__('Order # %s', $this->getOrder()->getRealOrderId()));
|
18 |
+
}
|
19 |
+
}
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Current Order.
|
23 |
+
*
|
24 |
+
* @return Mage_Core_Model_Abstract|mixed
|
25 |
+
*/
|
26 |
+
public function getOrder()
|
27 |
+
{
|
28 |
+
$orderId = Mage::registry('order_id');
|
29 |
+
$order = Mage::registry('current_order');
|
30 |
+
if (! $orderId) {
|
31 |
+
$orderId = Mage::app()->getRequest()->getParam('order_id');
|
32 |
+
Mage::register('order_id', $orderId);
|
33 |
+
}
|
34 |
+
if (! $order) {
|
35 |
+
$order = Mage::getModel('sales/order')->load($orderId);
|
36 |
+
Mage::register('current_order', $order);
|
37 |
+
}
|
38 |
+
|
39 |
+
return $order;
|
40 |
+
}
|
41 |
+
}
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Dotdigitalgroup_Email_Block_Order_Creditmemo extends Mage_Sales_Block_Order_Creditmemo_Items
|
3 |
+
{
|
4 |
+
/**
|
5 |
+
* Prepare layout.
|
6 |
+
*
|
7 |
+
* @return Mage_Core_Block_Abstract|void
|
8 |
+
*/
|
9 |
+
protected function _prepareLayout()
|
10 |
+
{
|
11 |
+
if ($root = $this->getLayout()->getBlock('root')) {
|
12 |
+
$root->setTemplate('page/blank.phtml');
|
13 |
+
}
|
14 |
+
}
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Get current Order.
|
18 |
+
* @return Mage_Core_Model_Abstract|Mage_Sales_Model_Order|mixed
|
19 |
+
*/
|
20 |
+
public function getOrder()
|
21 |
+
{
|
22 |
+
$orderId = Mage::registry('order_id');
|
23 |
+
$order = Mage::registry('current_order');
|
24 |
+
if (! $orderId) {
|
25 |
+
$orderId = Mage::app()->getRequest()->getParam('order_id');
|
26 |
+
Mage::register('order_id', $orderId);
|
27 |
+
}
|
28 |
+
if (! $order) {
|
29 |
+
$order = Mage::getModel('sales/order')->load($orderId);
|
30 |
+
Mage::register('current_order', $order);
|
31 |
+
}
|
32 |
+
if (! $order->hasCreditmemos()) {
|
33 |
+
Mage::helper('connector')->log('TE - no creditmemo for order : '. $orderId);
|
34 |
+
exit;
|
35 |
+
}
|
36 |
+
|
37 |
+
return $order;
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Order items.
|
42 |
+
* @return mixed
|
43 |
+
*/
|
44 |
+
public function getCreditmemoItems()
|
45 |
+
{
|
46 |
+
return Mage::registry('current_order')->getItemsCollection();
|
47 |
+
}
|
48 |
+
}
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Dotdigitalgroup_Email_Block_Order_Invoice extends Mage_Sales_Block_Order_Invoice_Items
|
3 |
+
{
|
4 |
+
/**
|
5 |
+
* Prepare layout.
|
6 |
+
* @return Mage_Core_Block_Abstract|void
|
7 |
+
*/
|
8 |
+
protected function _prepareLayout()
|
9 |
+
{
|
10 |
+
if ($root = $this->getLayout()->getBlock('root')) {
|
11 |
+
$root->setTemplate('page/blank.phtml');
|
12 |
+
}
|
13 |
+
}
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Get current order.
|
17 |
+
* @return Mage_Core_Model_Abstract|Mage_Sales_Model_Order|mixed
|
18 |
+
*/
|
19 |
+
public function getOrder()
|
20 |
+
{
|
21 |
+
$orderId = Mage::registry('order_id');
|
22 |
+
$order = Mage::registry('current_order');
|
23 |
+
if (! $orderId) {
|
24 |
+
$orderId = Mage::app()->getRequest()->getParam('order_id');
|
25 |
+
Mage::register('order_id', $orderId);
|
26 |
+
}
|
27 |
+
if (! $order) {
|
28 |
+
$order = Mage::getModel('sales/order')->load($orderId);
|
29 |
+
Mage::register('current_order', $order);
|
30 |
+
}
|
31 |
+
if (! $order->hasInvoices()) {
|
32 |
+
Mage::helper('connector')->log('TE - no invoice for order : '. $orderId);
|
33 |
+
exit;
|
34 |
+
}
|
35 |
+
|
36 |
+
return $order;
|
37 |
+
}
|
38 |
+
|
39 |
+
}
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Dotdigitalgroup_Email_Block_Order_Shipping extends Mage_Sales_Block_Order_Creditmemo_Items
|
3 |
+
{
|
4 |
+
/**
|
5 |
+
* Prepare layout.
|
6 |
+
* @return Mage_Core_Block_Abstract|void
|
7 |
+
*/
|
8 |
+
protected function _prepareLayout()
|
9 |
+
{
|
10 |
+
if ($root = $this->getLayout()->getBlock('root')) {
|
11 |
+
$root->setTemplate('page/blank.phtml');
|
12 |
+
}
|
13 |
+
}
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Get current order.
|
17 |
+
* @return Mage_Core_Model_Abstract|Mage_Sales_Model_Order|mixed
|
18 |
+
*/
|
19 |
+
public function getOrder()
|
20 |
+
{
|
21 |
+
$orderId = Mage::registry('order_id');
|
22 |
+
$order = Mage::registry('current_order');
|
23 |
+
if (! $orderId) {
|
24 |
+
$orderId = Mage::app()->getRequest()->getParam('order_id');
|
25 |
+
Mage::register('order_id', $orderId);
|
26 |
+
}
|
27 |
+
if (! $order) {
|
28 |
+
$order = Mage::getModel('sales/order')->load($orderId);
|
29 |
+
Mage::register('current_order', $order);
|
30 |
+
}
|
31 |
+
if (! $order->hasShipments()) {
|
32 |
+
Mage::helper('connector')->log('TE - no shipments for order : '. $orderId);
|
33 |
+
exit;
|
34 |
+
}
|
35 |
+
|
36 |
+
return $order;
|
37 |
+
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Order shipments.
|
42 |
+
* @return mixed
|
43 |
+
*/
|
44 |
+
public function getShipment()
|
45 |
+
{
|
46 |
+
return $shipment = Mage::registry('current_order')->getShipmentsCollection()->getFirstItem();
|
47 |
+
}
|
48 |
+
}
|
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Products extends Mage_Core_Block_Template
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Prepare layout, set template.
|
7 |
+
*
|
8 |
+
* @return Mage_Core_Block_Abstract|void
|
9 |
+
*/
|
10 |
+
protected function _prepareLayout()
|
11 |
+
{
|
12 |
+
if ($root = $this->getLayout()->getBlock('root')) {
|
13 |
+
$root->setTemplate('page/blank.phtml');
|
14 |
+
}
|
15 |
+
}
|
16 |
+
|
17 |
+
/**
|
18 |
+
* get the products to display for table
|
19 |
+
*/
|
20 |
+
public function getRecommendedProducts()
|
21 |
+
{
|
22 |
+
$productsToDisplay = array();
|
23 |
+
$orderId = $this->getRequest()->getParam('order', false);
|
24 |
+
$mode = $this->getRequest()->getParam('mode', false);
|
25 |
+
if ($orderId && $mode) {
|
26 |
+
$orderModel = Mage::getModel('sales/order')->load($orderId);
|
27 |
+
if ($orderModel->getId()) {
|
28 |
+
Mage::app()->setCurrentStore($orderModel->getStoreId());
|
29 |
+
//order products
|
30 |
+
$productRecommended = Mage::getModel('email_connector/dynamic_recommended', $orderModel);
|
31 |
+
$productRecommended->setMode($mode);
|
32 |
+
|
33 |
+
//get the order items recommendations
|
34 |
+
$productsToDisplay = $productRecommended->getProducts();
|
35 |
+
}
|
36 |
+
}
|
37 |
+
|
38 |
+
return $productsToDisplay;
|
39 |
+
}
|
40 |
+
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Price html block.
|
44 |
+
*
|
45 |
+
* @param $product
|
46 |
+
*
|
47 |
+
* @return string
|
48 |
+
*/
|
49 |
+
public function getPriceHtml($product)
|
50 |
+
{
|
51 |
+
$this->setTemplate('connector/price.phtml');
|
52 |
+
$this->setProduct($product);
|
53 |
+
return $this->toHtml();
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Display type mode.
|
58 |
+
* @return mixed|string
|
59 |
+
*/
|
60 |
+
public function getDisplayType()
|
61 |
+
{
|
62 |
+
return Mage::helper('connector/recommended')->getDisplayType();
|
63 |
+
|
64 |
+
}
|
65 |
+
}
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Recommended_Bestsellers extends Mage_Core_Block_Template
|
4 |
+
{
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Prepare layout.
|
8 |
+
* @return Mage_Core_Block_Abstract|void
|
9 |
+
*/
|
10 |
+
protected function _prepareLayout()
|
11 |
+
{
|
12 |
+
if ($root = $this->getLayout()->getBlock('root')) {
|
13 |
+
$root->setTemplate('page/blank.phtml');
|
14 |
+
}
|
15 |
+
}
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Get product collection.
|
19 |
+
* @return array
|
20 |
+
* @throws Exception
|
21 |
+
*/
|
22 |
+
public function getLoadedProductCollection()
|
23 |
+
{
|
24 |
+
$productsToDisplay = array();
|
25 |
+
$mode = $this->getRequest()->getActionName();
|
26 |
+
$limit = Mage::helper('connector/recommended')->getDisplayLimitByMode($mode);
|
27 |
+
$from = Mage::helper('connector/recommended')->getTimeFromConfig($mode);
|
28 |
+
$to = Zend_Date::now()->toString(Zend_Date::ISO_8601);
|
29 |
+
|
30 |
+
$productCollection = Mage::getResourceModel('reports/product_collection')
|
31 |
+
->addOrderedQty($from, $to)
|
32 |
+
->addAttributeToSelect('*')
|
33 |
+
->addAttributeToSelect(array('name', 'price', 'small_image'))
|
34 |
+
->setPageSize($limit)
|
35 |
+
->setOrder('ordered_qty', 'desc');
|
36 |
+
foreach ($productCollection as $_product) {
|
37 |
+
$productId = $_product->getId();
|
38 |
+
$product = Mage::getModel('catalog/product')->load($productId);
|
39 |
+
if ($product->isSalable())
|
40 |
+
$productsToDisplay[] = $product;
|
41 |
+
}
|
42 |
+
|
43 |
+
return $productsToDisplay;
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Display type mode.
|
48 |
+
*
|
49 |
+
* @return mixed|string
|
50 |
+
*/
|
51 |
+
public function getMode()
|
52 |
+
{
|
53 |
+
return Mage::helper('connector/recommended')->getDisplayType();
|
54 |
+
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Price html.
|
59 |
+
* @param $product
|
60 |
+
*
|
61 |
+
* @return string
|
62 |
+
*/
|
63 |
+
public function getPriceHtml($product)
|
64 |
+
{
|
65 |
+
$this->setTemplate('connector/product/price.phtml');
|
66 |
+
$this->setProduct($product);
|
67 |
+
return $this->toHtml();
|
68 |
+
}
|
69 |
+
|
70 |
+
}
|
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Recommended_Mostviewed extends Mage_Core_Block_Template
|
4 |
+
{
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Prepare layout.
|
8 |
+
* @return Mage_Core_Block_Abstract|void
|
9 |
+
*/
|
10 |
+
protected function _prepareLayout()
|
11 |
+
{
|
12 |
+
if ($root = $this->getLayout()->getBlock('root')) {
|
13 |
+
$root->setTemplate('page/blank.phtml');
|
14 |
+
}
|
15 |
+
}
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Get product collection.
|
19 |
+
* @return array
|
20 |
+
* @throws Exception
|
21 |
+
*/
|
22 |
+
public function getLoadedProductCollection()
|
23 |
+
{
|
24 |
+
$productsToDisplay = array();
|
25 |
+
$mode = $this->getRequest()->getActionName();
|
26 |
+
$limit = Mage::helper('connector/recommended')->getDisplayLimitByMode($mode);
|
27 |
+
$from = Mage::helper('connector/recommended')->getTimeFromConfig($mode);
|
28 |
+
$to = Zend_Date::now()->toString(Zend_Date::ISO_8601);
|
29 |
+
|
30 |
+
$productCollection = Mage::getResourceModel('reports/product_collection')
|
31 |
+
->addViewsCount($from, $to)
|
32 |
+
->setPageSize($limit);
|
33 |
+
|
34 |
+
foreach ($productCollection as $_product) {
|
35 |
+
$productId = $_product->getId();
|
36 |
+
$product = Mage::getModel('catalog/product')->load($productId);
|
37 |
+
if($product->isSalable())
|
38 |
+
$productsToDisplay[] = $product;
|
39 |
+
}
|
40 |
+
|
41 |
+
return $productsToDisplay;
|
42 |
+
}
|
43 |
+
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Display mode type.
|
47 |
+
* @return mixed|string
|
48 |
+
*/
|
49 |
+
public function getMode()
|
50 |
+
{
|
51 |
+
return Mage::helper('connector/recommended')->getDisplayType();
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* @param $product
|
56 |
+
*
|
57 |
+
* @return string
|
58 |
+
*/
|
59 |
+
public function getPriceHtml($product)
|
60 |
+
{
|
61 |
+
$this->setTemplate('connector/product/price.phtml');
|
62 |
+
$this->setProduct($product);
|
63 |
+
return $this->toHtml();
|
64 |
+
}
|
65 |
+
}
|
@@ -0,0 +1,140 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Recommended_Products extends Mage_Core_Block_Template
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Prepare layout, set the template.
|
7 |
+
* @return Mage_Core_Block_Abstract|void
|
8 |
+
*/
|
9 |
+
protected function _prepareLayout()
|
10 |
+
{
|
11 |
+
if ($root = $this->getLayout()->getBlock('root')) {
|
12 |
+
$root->setTemplate('page/blank.phtml');
|
13 |
+
}
|
14 |
+
}
|
15 |
+
|
16 |
+
/**
|
17 |
+
* get the products to display for table
|
18 |
+
*/
|
19 |
+
public function getLoadedProductCollection()
|
20 |
+
{
|
21 |
+
$productsToDisplay = array();
|
22 |
+
$orderId = $this->getRequest()->getParam('order_id');
|
23 |
+
$mode = $this->getRequest()->getActionName();
|
24 |
+
$orderModel = Mage::getModel('sales/order')->load($orderId);
|
25 |
+
|
26 |
+
if ($orderModel->getId()) {
|
27 |
+
$limit = Mage::helper('connector/recommended')->getDisplayLimitByMode($mode);
|
28 |
+
$orderItems = $orderModel->getAllItems();
|
29 |
+
if (count($orderItems) > $limit) {
|
30 |
+
$maxPerChild = 1;
|
31 |
+
} else {
|
32 |
+
$maxPerChild = number_format($limit / count($orderItems));
|
33 |
+
}
|
34 |
+
|
35 |
+
Mage::helper('connector')->log('DYNAMIC PRODUCTS : limit ' . $limit . ' products : ' . count($orderItems) . ', max per child : '. $maxPerChild);
|
36 |
+
|
37 |
+
foreach ($orderItems as $item) {
|
38 |
+
$productId = $item->getProductId();
|
39 |
+
/** @var Mage_Catalog_Model_Product $productModel */
|
40 |
+
$productModel = Mage::getModel('catalog/product')->load($productId);
|
41 |
+
if ($productModel->getId()) {
|
42 |
+
$recommendedProducts = $this->_getRecommendedProduct($productModel, $mode);
|
43 |
+
$i = 0;
|
44 |
+
foreach ($recommendedProducts as $product) {
|
45 |
+
$product = Mage::getModel('catalog/product')->load($product->getId());
|
46 |
+
if (count($productsToDisplay) < $limit) {
|
47 |
+
if ($i <= $maxPerChild && $product->isSaleable() && !$product->getParentId()) {
|
48 |
+
$productsToDisplay[$product->getId()] = $product;
|
49 |
+
$i++;
|
50 |
+
}
|
51 |
+
}
|
52 |
+
}
|
53 |
+
}
|
54 |
+
if (count($productsToDisplay) == $limit) {
|
55 |
+
break;
|
56 |
+
}
|
57 |
+
|
58 |
+
}
|
59 |
+
|
60 |
+
//fill up the table with fallback products
|
61 |
+
if (count($productsToDisplay) < $limit) {
|
62 |
+
$fallbackIds = Mage::helper('connector/recommended')->getFallbackIds();
|
63 |
+
foreach ($fallbackIds as $productId) {
|
64 |
+
$product = Mage::getModel('catalog/product')->load($productId);
|
65 |
+
if($product->isSaleable())
|
66 |
+
$productsToDisplay[$product->getId()] = $product;
|
67 |
+
//stop the limit was reached
|
68 |
+
if (count($productsToDisplay) == $limit) {
|
69 |
+
break;
|
70 |
+
}
|
71 |
+
}
|
72 |
+
}
|
73 |
+
}
|
74 |
+
|
75 |
+
Mage::helper('connector')->log('loaded product to display ' . count($productsToDisplay));
|
76 |
+
return $productsToDisplay;
|
77 |
+
}
|
78 |
+
|
79 |
+
/**
|
80 |
+
* Product related items.
|
81 |
+
*
|
82 |
+
* @param Mage_Catalog_Model_Product $productModel
|
83 |
+
* @param $mode
|
84 |
+
*
|
85 |
+
* @return array
|
86 |
+
*/
|
87 |
+
private function _getRecommendedProduct(Mage_Catalog_Model_Product $productModel, $mode)
|
88 |
+
{
|
89 |
+
//array of products to display
|
90 |
+
$products = array();
|
91 |
+
switch($mode){
|
92 |
+
case 'related':
|
93 |
+
$products = $productModel->getRelatedProducts();
|
94 |
+
break;
|
95 |
+
case 'upsell':
|
96 |
+
$products = $productModel->getUpSellProducts();
|
97 |
+
break;
|
98 |
+
case 'crosssell':
|
99 |
+
$products = $productModel->getCrossSellProducts();
|
100 |
+
break;
|
101 |
+
|
102 |
+
}
|
103 |
+
|
104 |
+
return $products;
|
105 |
+
}
|
106 |
+
|
107 |
+
/**
|
108 |
+
* Diplay mode type.
|
109 |
+
*
|
110 |
+
* @return mixed|string
|
111 |
+
*/
|
112 |
+
public function getMode()
|
113 |
+
{
|
114 |
+
return Mage::helper('connector/recommended')->getDisplayType();
|
115 |
+
|
116 |
+
}
|
117 |
+
|
118 |
+
/**
|
119 |
+
* Number of the colums.
|
120 |
+
* @return int|mixed
|
121 |
+
* @throws Exception
|
122 |
+
*/
|
123 |
+
public function getColumnCount()
|
124 |
+
{
|
125 |
+
return Mage::helper('connector/recommended')->getDisplayLimitByMode($this->getRequest()->getActionName());
|
126 |
+
}
|
127 |
+
|
128 |
+
/**
|
129 |
+
* Price html.
|
130 |
+
* @param $product
|
131 |
+
*
|
132 |
+
* @return string
|
133 |
+
*/
|
134 |
+
public function getPriceHtml($product)
|
135 |
+
{
|
136 |
+
$this->setTemplate('connector/product/price.phtml');
|
137 |
+
$this->setProduct($product);
|
138 |
+
return $this->toHtml();
|
139 |
+
}
|
140 |
+
}
|
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Recommended_Push extends Mage_Core_Block_Template
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Prepare layout, set template.
|
7 |
+
* @return Mage_Core_Block_Abstract|void
|
8 |
+
*/
|
9 |
+
protected function _prepareLayout()
|
10 |
+
{
|
11 |
+
if ($root = $this->getLayout()->getBlock('root')) {
|
12 |
+
$root->setTemplate('page/blank.phtml');
|
13 |
+
}
|
14 |
+
}
|
15 |
+
|
16 |
+
/**
|
17 |
+
* get the products to display for table
|
18 |
+
*/
|
19 |
+
public function getLoadedProductCollection()
|
20 |
+
{
|
21 |
+
$productsToDisplay = array();
|
22 |
+
$mode = $this->getRequest()->getActionName();
|
23 |
+
$limit = Mage::helper('connector/recommended')->getDisplayLimitByMode($mode);
|
24 |
+
|
25 |
+
$productIds = Mage::helper('connector/recommended')->getProductPushIds();
|
26 |
+
|
27 |
+
$productCollection = Mage::getResourceModel('catalog/product_collection')
|
28 |
+
->addAttributeToFilter('entity_id', array('in' => $productIds))
|
29 |
+
->setPageSize($limit)
|
30 |
+
;
|
31 |
+
foreach ($productCollection as $_product) {
|
32 |
+
$productId = $_product->getId();
|
33 |
+
$product = Mage::getModel('catalog/product')->load($productId);
|
34 |
+
if($product->isSaleable())
|
35 |
+
$productsToDisplay[] = $product;
|
36 |
+
|
37 |
+
}
|
38 |
+
|
39 |
+
return $productsToDisplay;
|
40 |
+
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Display type mode.
|
45 |
+
*
|
46 |
+
* @return mixed|string
|
47 |
+
*/
|
48 |
+
public function getMode()
|
49 |
+
{
|
50 |
+
return Mage::helper('connector/recommended')->getDisplayType();
|
51 |
+
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Price html.
|
56 |
+
* @param $product
|
57 |
+
*
|
58 |
+
* @return string
|
59 |
+
*/
|
60 |
+
public function getPriceHtml($product)
|
61 |
+
{
|
62 |
+
$this->setTemplate('connector/product/price.phtml');
|
63 |
+
$this->setProduct($product);
|
64 |
+
return $this->toHtml();
|
65 |
+
}
|
66 |
+
}
|
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Recommended_Recentlyviewed extends Mage_Core_Block_Template
|
4 |
+
{
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Prepare layout, set template.
|
8 |
+
* @return Mage_Core_Block_Abstract|void
|
9 |
+
*/
|
10 |
+
protected function _prepareLayout()
|
11 |
+
{
|
12 |
+
if ($root = $this->getLayout()->getBlock('root')) {
|
13 |
+
$root->setTemplate('page/blank.phtml');
|
14 |
+
}
|
15 |
+
}
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Products collection.
|
19 |
+
*
|
20 |
+
* @return array
|
21 |
+
* @throws Exception
|
22 |
+
*/
|
23 |
+
public function getLoadedProductCollection()
|
24 |
+
{
|
25 |
+
$productsToDisplay = array();
|
26 |
+
$mode = $this->getRequest()->getActionName();
|
27 |
+
$customerId = $this->getRequest()->getParam('customer_id');
|
28 |
+
$limit = Mage::helper('connector/recommended')->getDisplayLimitByMode($mode);
|
29 |
+
//login customer to receive the recent products
|
30 |
+
$session = Mage::getSingleton('customer/session');
|
31 |
+
$isLoggedIn = $session->loginById($customerId);
|
32 |
+
/** @var Mage_Reports_Block_Product_Viewed $collection */
|
33 |
+
$collection = Mage::getSingleton('Mage_Reports_Block_Product_Viewed');
|
34 |
+
$items = $collection->getItemsCollection()
|
35 |
+
->setPageSize($limit);
|
36 |
+
Mage::helper('connector')->log('Recentlyviewed customer : ' . $customerId . ', mode ' . $mode . ', limit : ' . $limit .
|
37 |
+
', items found : ' . count($items) . ', is customer logged in : ' . $isLoggedIn . ', products :' . count($productsToDisplay));
|
38 |
+
foreach ($items as $product) {
|
39 |
+
$product = Mage::getModel('catalog/product')->load($product->getId());
|
40 |
+
if($product->isSalable())
|
41 |
+
$productsToDisplay[$product->getId()] = $product;
|
42 |
+
|
43 |
+
}
|
44 |
+
$session->logout();
|
45 |
+
|
46 |
+
return $productsToDisplay;
|
47 |
+
}
|
48 |
+
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Display mode type.
|
52 |
+
*
|
53 |
+
* @return mixed|string
|
54 |
+
*/
|
55 |
+
public function getMode()
|
56 |
+
{
|
57 |
+
return Mage::helper('connector/recommended')->getDisplayType();
|
58 |
+
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Price html.
|
63 |
+
* @param $product
|
64 |
+
*
|
65 |
+
* @return string
|
66 |
+
*/
|
67 |
+
public function getPriceHtml($product)
|
68 |
+
{
|
69 |
+
$this->setTemplate('connector/product/price.phtml');
|
70 |
+
$this->setProduct($product);
|
71 |
+
return $this->toHtml();
|
72 |
+
}
|
73 |
+
}
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Helper_Config
|
4 |
+
{
|
5 |
+
|
6 |
+
/**
|
7 |
+
* API SECTION.
|
8 |
+
*/
|
9 |
+
//API settings
|
10 |
+
const XML_PATH_CONNECTOR_API_ENABLED = 'connector_api_credentials/api/enabled';
|
11 |
+
const XML_PATH_CONNECTOR_API_USERNAME = 'connector_api_credentials/api/username';
|
12 |
+
const XML_PATH_CONNECTOR_API_PASSWORD = 'connector_api_credentials/api/password';
|
13 |
+
const XML_PATH_CONNECTOR_CLIENT_ID = 'connector_api_credentials/oauth/client_id';
|
14 |
+
const XML_PATH_CONNECTOR_CLIENT_SECRET_ID = 'connector_api_credentials/oauth/client_key';
|
15 |
+
|
16 |
+
/**
|
17 |
+
* SMS SECTION.
|
18 |
+
*/
|
19 |
+
//enabled
|
20 |
+
const XML_PATH_CONNECTOR_SMS_ENABLED_1 = 'connector_sms/sms_one/enabled';
|
21 |
+
const XML_PATH_CONNECTOR_SMS_ENABLED_2 = 'connector_sms/sms_two/enabled';
|
22 |
+
const XML_PATH_CONNECTOR_SMS_ENABLED_3 = 'connector_sms/sms_three/enabled';
|
23 |
+
const XML_PATH_CONNECTOR_SMS_ENABLED_4 = 'connector_sms/sms_four/enabled';
|
24 |
+
//status
|
25 |
+
const XML_PATH_CONNECTOR_SMS_STATUS_1 = 'connector_sms/sms_one/status';
|
26 |
+
const XML_PATH_CONNECTOR_SMS_STATUS_2 = 'connector_sms/sms_two/status';
|
27 |
+
const XML_PATH_CONNECTOR_SMS_STATUS_3 = 'connector_sms/sms_three/status';
|
28 |
+
const XML_PATH_CONNECTOR_SMS_STATUS_4 = 'connector_sms/sms_four/status';
|
29 |
+
//message
|
30 |
+
const XML_PATH_CONNECTOR_SMS_MESSAGE_1 = 'connector_sms/sms_one/message';
|
31 |
+
const XML_PATH_CONNECTOR_SMS_MESSAGE_2 = 'connector_sms/sms_two/message';
|
32 |
+
const XML_PATH_CONNECTOR_SMS_MESSAGE_3 = 'connector_sms/sms_three/message';
|
33 |
+
const XML_PATH_CONNECTOR_SMS_MESSAGE_4 = 'connector_sms/sms_four/message';
|
34 |
+
|
35 |
+
/**
|
36 |
+
* SYNC SECTION.
|
37 |
+
*/
|
38 |
+
|
39 |
+
const XML_PATH_CONNECTOR_SYNC_CONTACT_ENABLED = 'connector_sync_settings/sync/contact_enabled';
|
40 |
+
const XML_PATH_CONNECTOR_SYNC_SUBSCRIBER_ENABLED = 'connector_sync_settings/sync/subscriber_enabled';
|
41 |
+
const XML_PATH_CONNECTOR_SYNC_ORDER_ENABLED = 'connector_sync_settings/sync/order_enabled';
|
42 |
+
const XML_PATH_CONNECTOR_SYNC_WISHLIST_ENABLED = 'connector_sync_settings/sync/wishlist_enabled';
|
43 |
+
|
44 |
+
const XML_PATH_CONNECTOR_CUSTOMERS_ADDRESS_BOOK_ID = 'connector_sync_settings/address_book/customers';
|
45 |
+
const XML_PATH_CONNECTOR_SUBSCRIBERS_ADDRESS_BOOK_ID = 'connector_sync_settings/address_book/subscribers';
|
46 |
+
const XML_PATH_CONNECTOR_GUEST_ADDRESS_BOOK_ID = 'connector_sync_settings/address_book/guests';
|
47 |
+
// Mapping
|
48 |
+
const XML_PATH_CONNECTOR_MAPPING_LAST_ORDER_ID = 'connector_data_mapping/customer_data/last_order_id';
|
49 |
+
const XML_PATH_CONNECTOR_MAPPING_CUSTOMER_ID = 'connector_data_mapping/customer_data/customer_id';
|
50 |
+
const XML_PATH_CONNECTOR_MAPPING_CUSTOM_DATAFIELDS = 'connector_data_mapping/customer_data/custom_attributes';
|
51 |
+
const XML_PATH_CONNECTOR_MAPPING_CUSTOMER_STORENAME = 'connector_data_mapping/customer_data/store_name';
|
52 |
+
const XML_PATH_CONNECTOR_MAPPING_CUSTOMER_TOTALREFUND = 'connector_data_mapping/customer_data/total_refund';
|
53 |
+
// Dynamic
|
54 |
+
const XML_PATH_CONNECTOR_DYNAMIC_CONTENT_PASSCODE = 'connector_dynamic_content/external_dynamic_content_urls/passcode';
|
55 |
+
|
56 |
+
/**
|
57 |
+
* ADVANCED SECTION.
|
58 |
+
*/
|
59 |
+
const XML_PATH_CONNECTOR_ADVANCED_DEBUG_ENABLED = 'connector_advanced_settings/admin/debug_enabled';
|
60 |
+
const XML_PATH_CONNECTOR_SYNC_LIMIT = 'connector_advanced_settings/admin/batch_size';
|
61 |
+
const XML_PATH_CONNECTOR_RESOURCE_ALLOCATION = 'connector_advanced_settings/admin/memory_limit';
|
62 |
+
const XML_PATH_CONNECTOR_TRANSACTIONAL_DATA_SYNC_LIMIT = 'connector_advanced_settings/sync_limits/orders';
|
63 |
+
const XML_PATH_CONNECTOR_TRANSACTIONAL_STYLING = 'connector_advanced_settings/admin/inline_styling';
|
64 |
+
const XML_PATH_CONNECTOR_RECOMMENDED_STYLING = 'connector_advanced_settings/admin/recommended_inline';
|
65 |
+
|
66 |
+
/**
|
67 |
+
* ROI SECTION.
|
68 |
+
*/
|
69 |
+
const XML_PATH_CONNECTOR_ROI_TRACKING_ENABLED = 'connector_roi_tracking/roi_tracking/enabled';
|
70 |
+
const XML_PATH_CONNECTOR_PAGE_TRACKING_ENABLED = 'connector_roi_tracking/page_tracking/enabled';
|
71 |
+
|
72 |
+
/**
|
73 |
+
* OAUTH
|
74 |
+
*/
|
75 |
+
|
76 |
+
const API_CONNECTOR_URL_AUTHORISE = 'https://my.dotmailer.com/OAuth2/authorise.aspx?';
|
77 |
+
const API_CONNECTOR_URL_TOKEN = 'https://my.dotmailer.com/OAuth2/Tokens.ashx';
|
78 |
+
const API_CONNECTOR_URL_LOG_USER = 'https://my.dotmailer.com/?oauthtoken=';
|
79 |
+
|
80 |
+
|
81 |
+
}
|
@@ -0,0 +1,238 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Helper_Data extends Mage_Core_Helper_Abstract
|
4 |
+
{
|
5 |
+
|
6 |
+
public function isEnabled($website = 0)
|
7 |
+
{
|
8 |
+
$website = Mage::app()->getWebsite($website);
|
9 |
+
return (bool)$website->getConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_API_ENABLED);
|
10 |
+
}
|
11 |
+
|
12 |
+
/**
|
13 |
+
* @param int/object $website
|
14 |
+
* @return mixed
|
15 |
+
*/
|
16 |
+
public function getApiUsername($website = 0)
|
17 |
+
{
|
18 |
+
$website = Mage::app()->getWebsite($website);
|
19 |
+
|
20 |
+
return $website->getConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_API_USERNAME);
|
21 |
+
}
|
22 |
+
|
23 |
+
public function getApiPassword($website = 0)
|
24 |
+
{
|
25 |
+
$website = Mage::app()->getWebsite($website);
|
26 |
+
|
27 |
+
return $website->getConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_API_PASSWORD);
|
28 |
+
}
|
29 |
+
|
30 |
+
public function auth($authRequest)
|
31 |
+
{
|
32 |
+
if ($authRequest != Mage::getStoreConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_DYNAMIC_CONTENT_PASSCODE)) {
|
33 |
+
$this->log('Authenication failed : ' . $authRequest);
|
34 |
+
exit();
|
35 |
+
}
|
36 |
+
return true;
|
37 |
+
}
|
38 |
+
|
39 |
+
public function getMappedCustomerId()
|
40 |
+
{
|
41 |
+
return Mage::getStoreConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_MAPPING_CUSTOMER_ID);
|
42 |
+
}
|
43 |
+
|
44 |
+
public function getMappedOrderId()
|
45 |
+
{
|
46 |
+
return Mage::getStoreConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_MAPPING_LAST_ORDER_ID);
|
47 |
+
}
|
48 |
+
|
49 |
+
public function getPasscode()
|
50 |
+
{
|
51 |
+
return Mage::getStoreConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_DYNAMIC_CONTENT_PASSCODE);
|
52 |
+
}
|
53 |
+
|
54 |
+
public function getLastOrderId()
|
55 |
+
{
|
56 |
+
return Mage::getStoreConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_MAPPING_LAST_ORDER_ID);
|
57 |
+
|
58 |
+
}
|
59 |
+
|
60 |
+
public function log($data, $level = Zend_Log::DEBUG, $filename = 'api.log')
|
61 |
+
{
|
62 |
+
if ($this->getDebugEnabled()) {
|
63 |
+
$filename = 'connector_' . $filename;
|
64 |
+
|
65 |
+
Mage::log($data, $level, $filename, $force = true);
|
66 |
+
}
|
67 |
+
}
|
68 |
+
|
69 |
+
public function getDebugEnabled()
|
70 |
+
{
|
71 |
+
return (bool) Mage::getStoreConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_ADVANCED_DEBUG_ENABLED);
|
72 |
+
}
|
73 |
+
|
74 |
+
public function getConnectorVersion()
|
75 |
+
{
|
76 |
+
$modules = (array) Mage::getConfig()->getNode('modules')->children();
|
77 |
+
if (isset($modules['Dotdigitalgroup_Email'])) {
|
78 |
+
$moduleName = $modules['Dotdigitalgroup_Email'];
|
79 |
+
return $moduleName->version;
|
80 |
+
}
|
81 |
+
return '';
|
82 |
+
}
|
83 |
+
|
84 |
+
|
85 |
+
public function getPageTrackingEnabled()
|
86 |
+
{
|
87 |
+
return (bool)Mage::getStoreConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_PAGE_TRACKING_ENABLED);
|
88 |
+
}
|
89 |
+
|
90 |
+
public function getRoiTrackingEnabled()
|
91 |
+
{
|
92 |
+
return (bool)Mage::getStoreConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_ROI_TRACKING_ENABLED);
|
93 |
+
}
|
94 |
+
|
95 |
+
public function getResourceAllocationEnabled()
|
96 |
+
{
|
97 |
+
return (bool)Mage::getStoreConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_RESOURCE_ALLOCATION);
|
98 |
+
}
|
99 |
+
|
100 |
+
public function getMappedStoreName($website)
|
101 |
+
{
|
102 |
+
$mapped = $website->getConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_MAPPING_CUSTOMER_STORENAME);
|
103 |
+
$storeName = ($mapped)? $mapped : '';
|
104 |
+
return $storeName;
|
105 |
+
}
|
106 |
+
|
107 |
+
/**
|
108 |
+
* Get the contact id for the custoemer based on website id.
|
109 |
+
* @param $email
|
110 |
+
* @param $websiteId
|
111 |
+
* @return string contact_id
|
112 |
+
*/
|
113 |
+
public function getContactId($email, $websiteId)
|
114 |
+
{
|
115 |
+
$client = $this->getWebsiteApiClient($websiteId);
|
116 |
+
$response = $client->postContacts($email);
|
117 |
+
return $response->id;
|
118 |
+
}
|
119 |
+
|
120 |
+
public function getCustomerAddressBook($website)
|
121 |
+
{
|
122 |
+
$website = Mage::app()->getWebsite($website);
|
123 |
+
return $website->getConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_CUSTOMERS_ADDRESS_BOOK_ID);
|
124 |
+
}
|
125 |
+
|
126 |
+
public function getSubscriberAddressBook($website)
|
127 |
+
{
|
128 |
+
$website = Mage::app()->getWebsite($website);
|
129 |
+
return $website->getConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_SUBSCRIBERS_ADDRESS_BOOK_ID);
|
130 |
+
}
|
131 |
+
|
132 |
+
public function getGuestAddressBook($website)
|
133 |
+
{
|
134 |
+
$website = Mage::app()->getWebsite($website);
|
135 |
+
return $website->getConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_GUEST_ADDRESS_BOOK_ID);
|
136 |
+
}
|
137 |
+
|
138 |
+
/**
|
139 |
+
* @return $this
|
140 |
+
*/
|
141 |
+
public function allowResourceFullExecution()
|
142 |
+
{
|
143 |
+
if ($this->getResourceAllocationEnabled()) {
|
144 |
+
|
145 |
+
/* it may be needed to set maximum execution time of the script to longer,
|
146 |
+
* like 60 minutes than usual */
|
147 |
+
set_time_limit(7200);
|
148 |
+
|
149 |
+
/* and memory to 512 megabytes */
|
150 |
+
ini_set('memory_limit', '512M');
|
151 |
+
}
|
152 |
+
return $this;
|
153 |
+
}
|
154 |
+
public function convert($size)
|
155 |
+
{
|
156 |
+
$unit=array('b','kb','mb','gb','tb','pb');
|
157 |
+
return @round($size/pow(1024,($i=floor(log($size,1024)))),2).' '.$unit[$i];
|
158 |
+
}
|
159 |
+
|
160 |
+
/**
|
161 |
+
* @return string
|
162 |
+
*/
|
163 |
+
public function getStringWebsiteApiAccounts()
|
164 |
+
{
|
165 |
+
$accounts = array();
|
166 |
+
foreach (Mage::app()->getWebsites() as $website) {
|
167 |
+
$websiteId = $website->getId();
|
168 |
+
$apiUsername = $this->getApiUsername($website);
|
169 |
+
$accounts[$apiUsername] = $apiUsername . ', websiteId: ' . $websiteId . ' name ' . $website->getName();
|
170 |
+
}
|
171 |
+
return implode('</br>', $accounts);
|
172 |
+
}
|
173 |
+
|
174 |
+
public function getCustomAttributes($website = 0)
|
175 |
+
{
|
176 |
+
$website = Mage::app()->getWebsite($website);
|
177 |
+
return unserialize($website->getConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_MAPPING_CUSTOM_DATAFIELDS));
|
178 |
+
}
|
179 |
+
|
180 |
+
/**
|
181 |
+
* @param $path
|
182 |
+
* @param null|string|bool|int|Mage_Core_Model_Website $websiteId
|
183 |
+
* @return mixed
|
184 |
+
*/
|
185 |
+
public function getWebsiteConfig($path, $websiteId = 0)
|
186 |
+
{
|
187 |
+
$website = Mage::app()->getWebsite($websiteId);
|
188 |
+
return $website->getConfig($path);
|
189 |
+
}
|
190 |
+
|
191 |
+
/**
|
192 |
+
* Api client by website.
|
193 |
+
* @param int $website
|
194 |
+
* @return Dotdigitalgroup_Email_Model_Apiconnector_Client
|
195 |
+
*/
|
196 |
+
public function getWebsiteApiClient($website = 0)
|
197 |
+
{
|
198 |
+
$client = Mage::getModel('email_connector/apiconnector_client');
|
199 |
+
$client->setApiUsername($this->getApiUsername($website))
|
200 |
+
->setApiPassword($this->getApiPassword($website));
|
201 |
+
|
202 |
+
return $client;
|
203 |
+
}
|
204 |
+
|
205 |
+
/**
|
206 |
+
* Retrieve authorisation code.
|
207 |
+
*/
|
208 |
+
public function getCode()
|
209 |
+
{
|
210 |
+
$adminUser = Mage::getSingleton('admin/session')->getUser();
|
211 |
+
$code = $adminUser->getEmailCode();
|
212 |
+
|
213 |
+
return $code;
|
214 |
+
}
|
215 |
+
|
216 |
+
/**
|
217 |
+
* Autorisation url.
|
218 |
+
* @return string
|
219 |
+
*/
|
220 |
+
public function getAuthoriseUrl()
|
221 |
+
{
|
222 |
+
$clientId = Mage::getStoreConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_CLIENT_ID);
|
223 |
+
$baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB, true);
|
224 |
+
$callback = $baseUrl . 'connector/email/callback';
|
225 |
+
$adminUser = Mage::getSingleton('admin/session')->getUser();
|
226 |
+
|
227 |
+
$params = array(
|
228 |
+
'redirect_uri' => $callback,
|
229 |
+
'scope' => 'Account',
|
230 |
+
'state' => $adminUser->getId(),
|
231 |
+
'response_type' => 'code'
|
232 |
+
);
|
233 |
+
$url = Dotdigitalgroup_Email_Helper_Config::API_CONNECTOR_URL_AUTHORISE . http_build_query($params) . '&client_id=' . $clientId;
|
234 |
+
Mage::helper('connector')->log('Authorization code url : '. $url);
|
235 |
+
|
236 |
+
return $url;
|
237 |
+
}
|
238 |
+
}
|
@@ -1,7 +1,5 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
empty helper to keep admin from breaking
|
4 |
-
*/
|
5 |
class Dotdigitalgroup_Email_Helper_File extends Dotdigitalgroup_Email_Helper_Data
|
6 |
{
|
7 |
|
@@ -15,8 +13,8 @@ class Dotdigitalgroup_Email_Helper_File extends Dotdigitalgroup_Email_Helper_Dat
|
|
15 |
private $delimiter; // set in _construct
|
16 |
private $enclosure; // set in _construct
|
17 |
|
18 |
-
public function __construct()
|
19 |
-
|
20 |
$this->_output_folder = Mage::getBaseDir('var') . DS . 'export' . DS . 'email';
|
21 |
$this->_output_archive_folder = $this->_output_folder . DS . 'archive';
|
22 |
|
@@ -25,34 +23,37 @@ class Dotdigitalgroup_Email_Helper_File extends Dotdigitalgroup_Email_Helper_Dat
|
|
25 |
} // end
|
26 |
|
27 |
|
28 |
-
public function getOutputFolder()
|
|
|
29 |
$this->pathExists($this->_output_folder);
|
30 |
return $this->_output_folder;
|
31 |
} // end
|
32 |
|
33 |
-
public function getArchiveFolder()
|
|
|
34 |
$this->pathExists($this->_output_archive_folder);
|
35 |
return $this->_output_archive_folder;
|
36 |
} // end
|
37 |
|
38 |
/* Return the full filepath */
|
39 |
-
public function getFilePath($filename)
|
|
|
40 |
return $this->getOutputFolder() . DS . $filename;
|
41 |
}
|
42 |
|
43 |
-
public function archiveCSV($filename)
|
44 |
-
|
45 |
$this->moveFile($this->getOutputFolder(), $this->getArchiveFolder(), $filename);
|
46 |
}
|
47 |
|
48 |
/**
|
49 |
* Moves the output file from one folder to the next
|
50 |
-
*
|
51 |
-
* @param
|
52 |
-
* @param
|
53 |
*/
|
54 |
-
public function moveFile($source_folder, $dest_folder, $filename )
|
55 |
-
|
56 |
// generate the full file paths
|
57 |
$source_filepath = $source_folder . DS . $filename;
|
58 |
$dest_filepath = $dest_folder . DS . $filename;
|
@@ -68,15 +69,15 @@ class Dotdigitalgroup_Email_Helper_File extends Dotdigitalgroup_Email_Helper_Dat
|
|
68 |
* @param $filepath
|
69 |
* @param $csv
|
70 |
*/
|
71 |
-
public function outputForceQuotesCSV($filepath, $csv)
|
72 |
-
|
73 |
$fqCsv = $this->arrayToCsv($csv,chr(9),'"',true,false);
|
74 |
// Open for writing only; place the file pointer at the end of the file. If the file does not exist, attempt to create it.
|
75 |
$fp = fopen($filepath, "a");
|
76 |
|
77 |
// for some reason passing the preset delimiter/enclosure variables results in error
|
78 |
-
|
79 |
-
{
|
80 |
Mage::throwException('Problem writing CSV file');
|
81 |
}
|
82 |
fclose($fp);
|
@@ -89,14 +90,14 @@ class Dotdigitalgroup_Email_Helper_File extends Dotdigitalgroup_Email_Helper_Dat
|
|
89 |
* @param $filepath
|
90 |
* @param $csv
|
91 |
*/
|
92 |
-
public function outputCSV($filepath, $csv)
|
93 |
-
|
94 |
// Open for writing only; place the file pointer at the end of the file. If the file does not exist, attempt to create it.
|
95 |
$handle = fopen($filepath, "a");
|
96 |
|
97 |
// for some reason passing the preset delimiter/enclosure variables results in error
|
98 |
-
|
99 |
-
{
|
100 |
Mage::throwException('Problem writing CSV file');
|
101 |
}
|
102 |
|
@@ -109,8 +110,9 @@ class Dotdigitalgroup_Email_Helper_File extends Dotdigitalgroup_Email_Helper_Dat
|
|
109 |
* If the path does not exist then create it
|
110 |
* @param string $path
|
111 |
*/
|
112 |
-
public function pathExists($path)
|
113 |
-
|
|
|
114 |
mkdir($path, 0777, true);
|
115 |
} // end
|
116 |
|
@@ -119,7 +121,8 @@ class Dotdigitalgroup_Email_Helper_File extends Dotdigitalgroup_Email_Helper_Dat
|
|
119 |
} // end
|
120 |
|
121 |
|
122 |
-
protected function arrayToCsv( array &$fields, $delimiter, $enclosure, $encloseAll = false, $nullToMysqlNull = false )
|
|
|
123 |
$delimiter_esc = preg_quote($delimiter, '/');
|
124 |
$enclosure_esc = preg_quote($enclosure, '/');
|
125 |
|
@@ -131,10 +134,9 @@ class Dotdigitalgroup_Email_Helper_File extends Dotdigitalgroup_Email_Helper_Dat
|
|
131 |
}
|
132 |
|
133 |
// Enclose fields containing $delimiter, $enclosure or whitespace
|
134 |
-
if (
|
135 |
$output[] = $enclosure . str_replace($enclosure, $enclosure . $enclosure, $field) . $enclosure;
|
136 |
-
}
|
137 |
-
else {
|
138 |
$output[] = $field;
|
139 |
}
|
140 |
}
|
@@ -156,4 +158,16 @@ class Dotdigitalgroup_Email_Helper_File extends Dotdigitalgroup_Email_Helper_Dat
|
|
156 |
}
|
157 |
|
158 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
159 |
}
|
1 |
<?php
|
2 |
+
|
|
|
|
|
3 |
class Dotdigitalgroup_Email_Helper_File extends Dotdigitalgroup_Email_Helper_Data
|
4 |
{
|
5 |
|
13 |
private $delimiter; // set in _construct
|
14 |
private $enclosure; // set in _construct
|
15 |
|
16 |
+
public function __construct()
|
17 |
+
{
|
18 |
$this->_output_folder = Mage::getBaseDir('var') . DS . 'export' . DS . 'email';
|
19 |
$this->_output_archive_folder = $this->_output_folder . DS . 'archive';
|
20 |
|
23 |
} // end
|
24 |
|
25 |
|
26 |
+
public function getOutputFolder()
|
27 |
+
{
|
28 |
$this->pathExists($this->_output_folder);
|
29 |
return $this->_output_folder;
|
30 |
} // end
|
31 |
|
32 |
+
public function getArchiveFolder()
|
33 |
+
{
|
34 |
$this->pathExists($this->_output_archive_folder);
|
35 |
return $this->_output_archive_folder;
|
36 |
} // end
|
37 |
|
38 |
/* Return the full filepath */
|
39 |
+
public function getFilePath($filename)
|
40 |
+
{
|
41 |
return $this->getOutputFolder() . DS . $filename;
|
42 |
}
|
43 |
|
44 |
+
public function archiveCSV($filename)
|
45 |
+
{
|
46 |
$this->moveFile($this->getOutputFolder(), $this->getArchiveFolder(), $filename);
|
47 |
}
|
48 |
|
49 |
/**
|
50 |
* Moves the output file from one folder to the next
|
51 |
+
* @param $source_folder
|
52 |
+
* @param $dest_folder
|
53 |
+
* @param $filename
|
54 |
*/
|
55 |
+
public function moveFile($source_folder, $dest_folder, $filename )
|
56 |
+
{
|
57 |
// generate the full file paths
|
58 |
$source_filepath = $source_folder . DS . $filename;
|
59 |
$dest_filepath = $dest_folder . DS . $filename;
|
69 |
* @param $filepath
|
70 |
* @param $csv
|
71 |
*/
|
72 |
+
public function outputForceQuotesCSV($filepath, $csv)
|
73 |
+
{
|
74 |
$fqCsv = $this->arrayToCsv($csv,chr(9),'"',true,false);
|
75 |
// Open for writing only; place the file pointer at the end of the file. If the file does not exist, attempt to create it.
|
76 |
$fp = fopen($filepath, "a");
|
77 |
|
78 |
// for some reason passing the preset delimiter/enclosure variables results in error
|
79 |
+
// $this->delimiter $this->enclosure
|
80 |
+
if (fwrite($fp, $fqCsv) == 0 ) {
|
81 |
Mage::throwException('Problem writing CSV file');
|
82 |
}
|
83 |
fclose($fp);
|
90 |
* @param $filepath
|
91 |
* @param $csv
|
92 |
*/
|
93 |
+
public function outputCSV($filepath, $csv)
|
94 |
+
{
|
95 |
// Open for writing only; place the file pointer at the end of the file. If the file does not exist, attempt to create it.
|
96 |
$handle = fopen($filepath, "a");
|
97 |
|
98 |
// for some reason passing the preset delimiter/enclosure variables results in error
|
99 |
+
//$this->delimiter $this->enclosure
|
100 |
+
if (fputcsv($handle, $csv, ',', '"') == 0 ) {
|
101 |
Mage::throwException('Problem writing CSV file');
|
102 |
}
|
103 |
|
110 |
* If the path does not exist then create it
|
111 |
* @param string $path
|
112 |
*/
|
113 |
+
public function pathExists($path)
|
114 |
+
{
|
115 |
+
if (!is_dir($path)) {
|
116 |
mkdir($path, 0777, true);
|
117 |
} // end
|
118 |
|
121 |
} // end
|
122 |
|
123 |
|
124 |
+
protected function arrayToCsv( array &$fields, $delimiter, $enclosure, $encloseAll = false, $nullToMysqlNull = false )
|
125 |
+
{
|
126 |
$delimiter_esc = preg_quote($delimiter, '/');
|
127 |
$enclosure_esc = preg_quote($enclosure, '/');
|
128 |
|
134 |
}
|
135 |
|
136 |
// Enclose fields containing $delimiter, $enclosure or whitespace
|
137 |
+
if ($encloseAll || preg_match( "/(?:${delimiter_esc}|${enclosure_esc}|\s)/", $field )) {
|
138 |
$output[] = $enclosure . str_replace($enclosure, $enclosure . $enclosure, $field) . $enclosure;
|
139 |
+
} else {
|
|
|
140 |
$output[] = $field;
|
141 |
}
|
142 |
}
|
158 |
}
|
159 |
|
160 |
|
161 |
+
public function getWebsiteCustomerMappingDatafields($website)
|
162 |
+
{
|
163 |
+
$store = $website->getDefaultStore();
|
164 |
+
$mappedData = Mage::getStoreConfig('connector_data_mapping/customer_data', $store);
|
165 |
+
unset($mappedData['custom_attributes']);
|
166 |
+
foreach ($mappedData as $key => $value) {
|
167 |
+
if (! $value)
|
168 |
+
unset($mappedData[$key]);
|
169 |
+
}
|
170 |
+
|
171 |
+
return $mappedData;
|
172 |
+
}
|
173 |
}
|
@@ -0,0 +1,178 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Helper_Recommended extends Mage_Core_Helper_Abstract
|
4 |
+
{
|
5 |
+
const XML_PATH_RELATED_PRODUCTS_TYPE = 'connector_dynamic_content/products/related_display_type';
|
6 |
+
const XML_PATH_UPSELL_PRODUCTS_TYPE = 'connector_dynamic_content/products/upsell_display_type';
|
7 |
+
const XML_PATH_CROSSSELL_PRODUCTS_TYPE = 'connector_dynamic_content/products/crosssell_display_type';
|
8 |
+
const XML_PATH_BESTSELLER_PRODUCT_TYPE = 'connector_dynamic_content/products/bestsellers_display_type';
|
9 |
+
const XML_PATH_MOSTVIEWED_PRODUCT_TYPE = 'connector_dynamic_content/products/most_viewed_display_type';
|
10 |
+
const XML_PATH_RECENTLYVIEWED_PRODUCT_TYPE = 'connector_dynamic_content/products/recently_viewed_display_type';
|
11 |
+
const XML_PATH_PRODUCTPUSH_TYPE = 'connector_dynamic_content/manual_product_search/display_type';
|
12 |
+
|
13 |
+
|
14 |
+
const XML_PATH_RELATED_PRODUCTS_ITEMS = 'connector_dynamic_content/products/related_items_to_display';
|
15 |
+
const XML_PATH_UPSELL_PRODUCTS_ITEMS = 'connector_dynamic_content/products/upsell_items_to_display';
|
16 |
+
const XML_PATH_CROSSSELL_PRODUCTS_ITEMS = 'connector_dynamic_content/products/crosssell_items_to_display';
|
17 |
+
const XML_PATH_BESTSELLER_PRODUCT_ITEMS = 'connector_dynamic_content/products/bestsellers_items_to_display';
|
18 |
+
const XML_PATH_MOSTVIEWED_PRODUCT_ITEMS = 'connector_dynamic_content/products/most_viewed_items_to_display';
|
19 |
+
const XML_PATH_RECENTLYVIEWED_PRODUCT_ITEMS = 'connector_dynamic_content/products/recently_viewed_items_to_display';
|
20 |
+
|
21 |
+
const XML_PATH_PRODUCTPUSH_DISPLAY_ITEMS = 'connector_dynamic_content/manual_product_search/items_to_display';
|
22 |
+
const XML_PATH_BESTSELLER_TIME_PERIOD = 'connector_dynamic_content/products/best_time_period';
|
23 |
+
const XML_PATH_MOSTVIEWED_TIME_PERIOD = 'connector_dynamic_content/products/most_viewed_time_period';
|
24 |
+
const XML_PATH_PRODUCTPUSH_ITEMS = 'connector_dynamic_content/manual_product_search/products_push_items';
|
25 |
+
const XML_PATH_FALLBACK_PRODUCTS_ITEMS = 'connector_dynamic_content/fallback_products/product_list';
|
26 |
+
|
27 |
+
public $periods = array('week', 'month', 'year');
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Dispay type
|
31 |
+
* @return mixed|string grid:list
|
32 |
+
*/
|
33 |
+
public function getDisplayType()
|
34 |
+
{
|
35 |
+
$mode = Mage::app()->getRequest()->getActionName();
|
36 |
+
$type = '';
|
37 |
+
|
38 |
+
switch($mode){
|
39 |
+
case 'related':
|
40 |
+
$type = $this->getRelatedProductsType();
|
41 |
+
break;
|
42 |
+
case 'upsell':
|
43 |
+
$type = $this->getUpsellProductsType();
|
44 |
+
break;
|
45 |
+
case 'crosssell':
|
46 |
+
$type = $this->getCrosssellProductsType();
|
47 |
+
break;
|
48 |
+
case 'bestsellers':
|
49 |
+
$type = $this->getBestSellerProductsType();
|
50 |
+
break;
|
51 |
+
case 'mostviewed':
|
52 |
+
$type = $this->getMostViewedProductsType();
|
53 |
+
break;
|
54 |
+
case 'recentlyviewed':
|
55 |
+
$type = $this->getRecentlyviewedProductsType();
|
56 |
+
break;
|
57 |
+
case 'push':
|
58 |
+
$type = $this->getProductpushProductsType();
|
59 |
+
}
|
60 |
+
|
61 |
+
return $type;
|
62 |
+
}
|
63 |
+
|
64 |
+
public function getRelatedProductsType()
|
65 |
+
{
|
66 |
+
return Mage::getStoreConfig(self::XML_PATH_RELATED_PRODUCTS_TYPE);
|
67 |
+
}
|
68 |
+
|
69 |
+
public function getUpsellProductsType()
|
70 |
+
{
|
71 |
+
return Mage::getStoreConfig(self::XML_PATH_UPSELL_PRODUCTS_TYPE);
|
72 |
+
|
73 |
+
}
|
74 |
+
|
75 |
+
public function getCrosssellProductsType()
|
76 |
+
{
|
77 |
+
return Mage::getStoreConfig(self::XML_PATH_CROSSSELL_PRODUCTS_TYPE);
|
78 |
+
}
|
79 |
+
|
80 |
+
public function getBestSellerProductsType()
|
81 |
+
{
|
82 |
+
return Mage::getStoreConfig(self::XML_PATH_BESTSELLER_PRODUCT_TYPE);
|
83 |
+
}
|
84 |
+
|
85 |
+
public function getMostViewedProductsType()
|
86 |
+
{
|
87 |
+
return Mage::getStoreConfig(self::XML_PATH_MOSTVIEWED_PRODUCT_TYPE);
|
88 |
+
}
|
89 |
+
|
90 |
+
public function getRecentlyviewedProductsType()
|
91 |
+
{
|
92 |
+
return Mage::getStoreConfig(self::XML_PATH_RECENTLYVIEWED_PRODUCT_TYPE);
|
93 |
+
}
|
94 |
+
|
95 |
+
public function getProductpushProductsType()
|
96 |
+
{
|
97 |
+
return Mage::getStoreConfig(self::XML_PATH_PRODUCTPUSH_TYPE);
|
98 |
+
}
|
99 |
+
|
100 |
+
|
101 |
+
/**
|
102 |
+
* Limit of products displayed.
|
103 |
+
* @param $mode
|
104 |
+
* @return int|mixed
|
105 |
+
*/
|
106 |
+
public function getDisplayLimitByMode($mode)
|
107 |
+
{
|
108 |
+
$result = 0;
|
109 |
+
if ($mode) {
|
110 |
+
switch($mode){
|
111 |
+
case 'related':
|
112 |
+
$result = Mage::getStoreConfig(self::XML_PATH_RELATED_PRODUCTS_ITEMS);
|
113 |
+
break;
|
114 |
+
case 'upsell':
|
115 |
+
$result = Mage::getStoreConfig(self::XML_PATH_UPSELL_PRODUCTS_ITEMS);
|
116 |
+
break;
|
117 |
+
case 'crosssell':
|
118 |
+
$result = Mage::getStoreConfig(self::XML_PATH_CROSSSELL_PRODUCTS_ITEMS);
|
119 |
+
break;
|
120 |
+
case 'bestsellers':
|
121 |
+
$result = Mage::getStoreConfig(self::XML_PATH_BESTSELLER_PRODUCT_ITEMS);
|
122 |
+
break;
|
123 |
+
case 'mostviewed':
|
124 |
+
$result = Mage::getStoreConfig(self::XML_PATH_MOSTVIEWED_PRODUCT_ITEMS);
|
125 |
+
break;
|
126 |
+
case 'recentlyviewed':
|
127 |
+
$result = Mage::getStoreConfig(self::XML_PATH_RECENTLYVIEWED_PRODUCT_ITEMS);
|
128 |
+
break;
|
129 |
+
case 'push':
|
130 |
+
$result = Mage::getStoreConfig(self::XML_PATH_PRODUCTPUSH_DISPLAY_ITEMS);
|
131 |
+
}
|
132 |
+
}
|
133 |
+
|
134 |
+
return $result;
|
135 |
+
}
|
136 |
+
|
137 |
+
public function getFallbackIds()
|
138 |
+
{
|
139 |
+
$fallbackIds = Mage::getStoreConfig(self::XML_PATH_FALLBACK_PRODUCTS_ITEMS);
|
140 |
+
if ($fallbackIds)
|
141 |
+
return explode(',', Mage::getStoreConfig(self::XML_PATH_FALLBACK_PRODUCTS_ITEMS));
|
142 |
+
return array();
|
143 |
+
}
|
144 |
+
|
145 |
+
public function getTimeFromConfig($config)
|
146 |
+
{
|
147 |
+
$now = new Zend_Date();
|
148 |
+
$period = '';
|
149 |
+
if ($config == 'mostviewed')
|
150 |
+
$period = Mage::getStoreConfig(self::XML_PATH_MOSTVIEWED_TIME_PERIOD);
|
151 |
+
elseif($config == 'bestsellers')
|
152 |
+
$period = Mage::getStoreConfig(self::XML_PATH_BESTSELLER_TIME_PERIOD);
|
153 |
+
elseif($config == 'recentlyviewed')
|
154 |
+
$period = Mage::getStoreConfig(self::XML_PATH_MOSTVIEWED_TIME_PERIOD);
|
155 |
+
|
156 |
+
if ($period == 'week') {
|
157 |
+
$sub = Zend_Date::WEEK;
|
158 |
+
} elseif ($period == 'month') {
|
159 |
+
$sub = Zend_Date::MONTH;
|
160 |
+
} elseif ($period == 'year') {
|
161 |
+
$sub = Zend_Date::YEAR;
|
162 |
+
}
|
163 |
+
|
164 |
+
if (isset($sub)) {
|
165 |
+
$period = $now->sub(1, $sub);
|
166 |
+
|
167 |
+
return $period->tostring(Zend_Date::ISO_8601);
|
168 |
+
}
|
169 |
+
}
|
170 |
+
|
171 |
+
public function getProductPushIds()
|
172 |
+
{
|
173 |
+
$productIds = Mage::getStoreConfig(self::XML_PATH_PRODUCTPUSH_ITEMS);
|
174 |
+
|
175 |
+
return explode(',', $productIds);
|
176 |
+
}
|
177 |
+
|
178 |
+
}
|
@@ -0,0 +1,156 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Helper_Transactional extends Mage_Core_Helper_Abstract
|
4 |
+
{
|
5 |
+
const XML_PATH_TRANSACTIONAL_API_ENABLED = 'connector_transactional_emails/credentials/enabled';
|
6 |
+
const XML_PATH_TRANSACTIONAL_API_USERNAME = 'connector_transactional_emails/credentials/api_username';
|
7 |
+
const XML_PATH_TRANSACTIONAL_API_PASSWORD = 'connector_transactional_emails/credentials/api_password';
|
8 |
+
const XML_PATH_TRANSACTIONAL_MAPPING = 'connector_transactional_emails/email_mapping/';
|
9 |
+
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Get the api enabled.
|
13 |
+
*
|
14 |
+
* @return mixed
|
15 |
+
*/
|
16 |
+
public function isEnabled()
|
17 |
+
{
|
18 |
+
return Mage::getStoreConfig(self::XML_PATH_TRANSACTIONAL_API_ENABLED);
|
19 |
+
}
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Get api username.
|
23 |
+
*
|
24 |
+
* @param int $website
|
25 |
+
*
|
26 |
+
* @return mixed
|
27 |
+
* @throws Mage_Core_Exception
|
28 |
+
*/
|
29 |
+
public function getApiUsername($website = 0)
|
30 |
+
{
|
31 |
+
$website = Mage::app()->getWebsite($website);
|
32 |
+
|
33 |
+
return $website->getConfig(self::XML_PATH_TRANSACTIONAL_API_USERNAME);
|
34 |
+
}
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Get api password.
|
38 |
+
*
|
39 |
+
* @param int $website
|
40 |
+
*
|
41 |
+
* @return mixed
|
42 |
+
* @throws Mage_Core_Exception
|
43 |
+
*/
|
44 |
+
public function getApiPassword($website = 0)
|
45 |
+
{
|
46 |
+
$website = Mage::app()->getWebsite($website);
|
47 |
+
|
48 |
+
return $website->getConfig(self::XML_PATH_TRANSACTIONAL_API_PASSWORD);
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Website by name.
|
53 |
+
* @param $websiteName
|
54 |
+
*
|
55 |
+
* @return Varien_Object
|
56 |
+
*/
|
57 |
+
public function getWebsiteByName($websiteName)
|
58 |
+
{
|
59 |
+
$website = Mage::getModel('core/website')->getCollection()
|
60 |
+
->addFieldToFilter('code', $websiteName)->getFirstItem();
|
61 |
+
|
62 |
+
return $website;
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Check if the template is mapped
|
67 |
+
* @param $templateId
|
68 |
+
* @return bool
|
69 |
+
*/
|
70 |
+
public function isMapped($templateId)
|
71 |
+
{
|
72 |
+
$path = self::XML_PATH_TRANSACTIONAL_MAPPING . $templateId;
|
73 |
+
|
74 |
+
return Mage::getStoreConfig($path);
|
75 |
+
}
|
76 |
+
|
77 |
+
/**
|
78 |
+
* transactional mapped campaign id
|
79 |
+
* @param $templateId
|
80 |
+
* @param int $storeId
|
81 |
+
* @return mixed
|
82 |
+
*/
|
83 |
+
public function getTransactionalCampaignId($templateId, $storeId = 0)
|
84 |
+
{
|
85 |
+
$path = self::XML_PATH_TRANSACTIONAL_MAPPING . $templateId;
|
86 |
+
|
87 |
+
return Mage::getStoreConfig($path, $storeId);
|
88 |
+
}
|
89 |
+
|
90 |
+
/**
|
91 |
+
* Get the contact id for the custoemer based on website id.
|
92 |
+
* @param $email
|
93 |
+
* @param $websiteId
|
94 |
+
* @return string contact_id
|
95 |
+
*/
|
96 |
+
public function getContactId($email, $websiteId)
|
97 |
+
{
|
98 |
+
$client = $this->getWebsiteApiClient($websiteId);
|
99 |
+
$response = $client->postContacts($email);
|
100 |
+
if (isset($response->message))
|
101 |
+
return $response->message;
|
102 |
+
return $response->id;
|
103 |
+
}
|
104 |
+
|
105 |
+
/**
|
106 |
+
* Update contact default datafields.
|
107 |
+
*
|
108 |
+
* @param $contacData
|
109 |
+
*/
|
110 |
+
public function updateContactData($contacData)
|
111 |
+
{
|
112 |
+
$client = $this->getWebsiteApiClient($contacData->getWebsite());
|
113 |
+
$email = $contacData->getCustomerEmail();
|
114 |
+
/**
|
115 |
+
* Transactional account data default datafields.
|
116 |
+
*/
|
117 |
+
$data = array(
|
118 |
+
array(
|
119 |
+
'Key' => 'LAST_ORDER_ID',
|
120 |
+
'Value' => $contacData->getOrderId()),
|
121 |
+
array(
|
122 |
+
'Key' => 'CUSTOMER_ID',
|
123 |
+
'Value' => $contacData->getCustomerId()),
|
124 |
+
array(
|
125 |
+
'Key' => 'ORDER_INCREMENT_ID',
|
126 |
+
'Value' => $contacData->getOrderIncrementId()),
|
127 |
+
array(
|
128 |
+
'Key' => 'WEBSITE_NAME',
|
129 |
+
'Value' => $contacData->getWebsiteName()),
|
130 |
+
array(
|
131 |
+
'Key' => 'STORE_NAME',
|
132 |
+
'Value' => $contacData->getStoreName()),
|
133 |
+
array(
|
134 |
+
'Key' => 'LAST_ORDER_DATE',
|
135 |
+
'Value' => $contacData->getOrderDate())
|
136 |
+
);
|
137 |
+
$client->updateContactDatafieldsByEmail($email, $data);
|
138 |
+
}
|
139 |
+
|
140 |
+
/**
|
141 |
+
* Api client by website.
|
142 |
+
* @param int $website
|
143 |
+
* @return Dotdigitalgroup_Email_Model_Apiconnector_Client
|
144 |
+
*/
|
145 |
+
public function getWebsiteApiClient($website = 0)
|
146 |
+
{
|
147 |
+
$client = Mage::getModel('email_connector/apiconnector_client');
|
148 |
+
$website = Mage::app()->getWebsite($website);
|
149 |
+
if ($website) {
|
150 |
+
$client->setApiUsername($this->getApiUsername($website))
|
151 |
+
->setApiPassword($this->getApiPassword($website));
|
152 |
+
}
|
153 |
+
return $client;
|
154 |
+
}
|
155 |
+
|
156 |
+
}
|
@@ -0,0 +1,435 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
abstract class Dotdigitalgroup_Email_Model_Abstract_Rest
|
4 |
+
{
|
5 |
+
protected $url;
|
6 |
+
protected $verb;
|
7 |
+
protected $requestBody;
|
8 |
+
protected $requestLength;
|
9 |
+
protected $_apiUsername;
|
10 |
+
protected $_apiPassword;
|
11 |
+
protected $acceptType;
|
12 |
+
protected $responseBody;
|
13 |
+
protected $responseInfo;
|
14 |
+
|
15 |
+
public function __construct($website = 0) // ($url = null, $verb = 'GET', $requestBody = null)
|
16 |
+
{
|
17 |
+
$this->url = null; //$url;
|
18 |
+
$this->verb = 'GET'; //$verb;
|
19 |
+
$this->requestBody = null; //$requestBody;
|
20 |
+
$this->requestLength = 0;
|
21 |
+
$this->_apiUsername = (string)Mage::helper('connector')->getApiUsername($website);
|
22 |
+
$this->_apiPassword = (string)Mage::helper('connector')->getApiPassword($website);
|
23 |
+
$this->acceptType = 'application/json';
|
24 |
+
$this->responseBody = null;
|
25 |
+
$this->responseInfo = null;
|
26 |
+
|
27 |
+
if ($this->requestBody !== null) {
|
28 |
+
$this->buildPostBody();
|
29 |
+
}
|
30 |
+
}
|
31 |
+
|
32 |
+
private function prettyPrint($json)
|
33 |
+
{
|
34 |
+
$result = '';
|
35 |
+
$level = 0;
|
36 |
+
$prev_char = '';
|
37 |
+
$in_quotes = false;
|
38 |
+
$ends_line_level = NULL;
|
39 |
+
$json_length = strlen( $json );
|
40 |
+
|
41 |
+
for ($i = 0; $i < $json_length; $i++) {
|
42 |
+
$char = $json[$i];
|
43 |
+
$new_line_level = NULL;
|
44 |
+
$post = "";
|
45 |
+
if ($ends_line_level !== NULL) {
|
46 |
+
$new_line_level = $ends_line_level;
|
47 |
+
$ends_line_level = NULL;
|
48 |
+
}
|
49 |
+
if ($char === '"' && $prev_char != '\\') {
|
50 |
+
$in_quotes = !$in_quotes;
|
51 |
+
} elseif (! $in_quotes) {
|
52 |
+
switch ($char) {
|
53 |
+
case '}': case ']':
|
54 |
+
$level--;
|
55 |
+
$ends_line_level = NULL;
|
56 |
+
$new_line_level = $level;
|
57 |
+
break;
|
58 |
+
|
59 |
+
case '{': case '[':
|
60 |
+
$level++;
|
61 |
+
case ',':
|
62 |
+
$ends_line_level = $level;
|
63 |
+
break;
|
64 |
+
|
65 |
+
case ':':
|
66 |
+
$post = " ";
|
67 |
+
break;
|
68 |
+
|
69 |
+
case " ": case "\t": case "\n": case "\r":
|
70 |
+
$char = "";
|
71 |
+
$ends_line_level = $new_line_level;
|
72 |
+
$new_line_level = NULL;
|
73 |
+
break;
|
74 |
+
}
|
75 |
+
}
|
76 |
+
if ($new_line_level !== NULL) {
|
77 |
+
$result .= "\n".str_repeat( "\t", $new_line_level );
|
78 |
+
}
|
79 |
+
$result .= $char.$post;
|
80 |
+
$prev_char = $char;
|
81 |
+
}
|
82 |
+
|
83 |
+
return $result;
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
* returns the object as JSON.
|
88 |
+
*
|
89 |
+
* @param bool $pretty
|
90 |
+
*
|
91 |
+
* @return string
|
92 |
+
*/
|
93 |
+
public function toJSON($pretty=false)
|
94 |
+
{
|
95 |
+
|
96 |
+
if (!$pretty) {
|
97 |
+
return json_encode($this->expose());
|
98 |
+
} else {
|
99 |
+
return $this->prettyPrint(json_encode($this->expose()));
|
100 |
+
}
|
101 |
+
}
|
102 |
+
|
103 |
+
/**
|
104 |
+
* exposes the class as an array of objects
|
105 |
+
* @return array
|
106 |
+
*/
|
107 |
+
public function expose()
|
108 |
+
{
|
109 |
+
|
110 |
+
return get_object_vars($this);
|
111 |
+
|
112 |
+
}
|
113 |
+
|
114 |
+
|
115 |
+
/**
|
116 |
+
* Reset the client.
|
117 |
+
*
|
118 |
+
* @return $this
|
119 |
+
*/
|
120 |
+
public function flush ()
|
121 |
+
{
|
122 |
+
$this->_apiUsername = '';
|
123 |
+
$this->_apiPassword = '';
|
124 |
+
$this->requestBody = null;
|
125 |
+
$this->requestLength = 0;
|
126 |
+
$this->verb = 'GET';
|
127 |
+
$this->responseBody = null;
|
128 |
+
$this->responseInfo = null;
|
129 |
+
return $this;
|
130 |
+
}
|
131 |
+
|
132 |
+
/**
|
133 |
+
* Execute the curl request.
|
134 |
+
*
|
135 |
+
* @return null
|
136 |
+
* @throws Exception
|
137 |
+
*/
|
138 |
+
public function execute()
|
139 |
+
{
|
140 |
+
$ch = curl_init();
|
141 |
+
$this->setAuth($ch);
|
142 |
+
try
|
143 |
+
{
|
144 |
+
switch (strtoupper($this->verb))
|
145 |
+
{
|
146 |
+
case 'GET':
|
147 |
+
$this->executeGet($ch);
|
148 |
+
break;
|
149 |
+
case 'POST':
|
150 |
+
$this->executePost($ch);
|
151 |
+
break;
|
152 |
+
case 'PUT':
|
153 |
+
$this->executePut($ch);
|
154 |
+
break;
|
155 |
+
case 'DELETE':
|
156 |
+
$this->executeDelete($ch);
|
157 |
+
break;
|
158 |
+
default:
|
159 |
+
throw new InvalidArgumentException('Current verb (' . $this->verb . ') is an invalid REST verb.');
|
160 |
+
}
|
161 |
+
}catch (InvalidArgumentException $e){
|
162 |
+
curl_close($ch);
|
163 |
+
throw $e;
|
164 |
+
}catch (Exception $e){
|
165 |
+
curl_close($ch);
|
166 |
+
throw $e;
|
167 |
+
}
|
168 |
+
|
169 |
+
return $this->responseBody;
|
170 |
+
}
|
171 |
+
|
172 |
+
/**
|
173 |
+
* Post data.
|
174 |
+
*
|
175 |
+
* @param null $data
|
176 |
+
*
|
177 |
+
* @return $this
|
178 |
+
*/
|
179 |
+
public function buildPostBody($data = null)
|
180 |
+
{
|
181 |
+
$this->requestBody = json_encode($data);
|
182 |
+
return $this;
|
183 |
+
}
|
184 |
+
|
185 |
+
/**
|
186 |
+
* Execute curl get request.
|
187 |
+
*
|
188 |
+
* @param $ch
|
189 |
+
*/
|
190 |
+
protected function executeGet($ch)
|
191 |
+
{
|
192 |
+
$this->doExecute($ch);
|
193 |
+
}
|
194 |
+
|
195 |
+
/**
|
196 |
+
* Execute post request.
|
197 |
+
*
|
198 |
+
* @param $ch
|
199 |
+
*/
|
200 |
+
protected function executePost($ch)
|
201 |
+
{
|
202 |
+
if (!is_string($this->requestBody)) {
|
203 |
+
$this->buildPostBody();
|
204 |
+
}
|
205 |
+
|
206 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $this->requestBody);
|
207 |
+
curl_setopt($ch, CURLOPT_POST, true);
|
208 |
+
|
209 |
+
$this->doExecute($ch);
|
210 |
+
}
|
211 |
+
|
212 |
+
/**
|
213 |
+
* Post from the file.
|
214 |
+
*
|
215 |
+
* @param $filename
|
216 |
+
*/
|
217 |
+
protected function buildPostBodyFromFile($filename)
|
218 |
+
{
|
219 |
+
$this->requestBody = array (
|
220 |
+
'file' => '@'.$filename
|
221 |
+
);
|
222 |
+
}
|
223 |
+
|
224 |
+
/**
|
225 |
+
* Execute put.
|
226 |
+
*
|
227 |
+
* @param $ch
|
228 |
+
*/
|
229 |
+
protected function executePut($ch)
|
230 |
+
{
|
231 |
+
if (!is_string($this->requestBody)) {
|
232 |
+
$this->buildPostBody();
|
233 |
+
}
|
234 |
+
|
235 |
+
$this->requestLength = strlen($this->requestBody);
|
236 |
+
|
237 |
+
$fh = fopen('php://memory', 'rw');
|
238 |
+
fwrite($fh, $this->requestBody);
|
239 |
+
rewind($fh);
|
240 |
+
|
241 |
+
curl_setopt($ch, CURLOPT_INFILE, $fh);
|
242 |
+
curl_setopt($ch, CURLOPT_INFILESIZE, $this->requestLength);
|
243 |
+
curl_setopt($ch, CURLOPT_PUT, true);
|
244 |
+
|
245 |
+
$this->doExecute($ch);
|
246 |
+
|
247 |
+
fclose($fh);
|
248 |
+
}
|
249 |
+
|
250 |
+
/**
|
251 |
+
* Ececute delete.
|
252 |
+
*
|
253 |
+
* @param $ch
|
254 |
+
*/
|
255 |
+
protected function executeDelete($ch)
|
256 |
+
{
|
257 |
+
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
|
258 |
+
|
259 |
+
$this->doExecute($ch);
|
260 |
+
}
|
261 |
+
|
262 |
+
/**
|
263 |
+
* Execute request.
|
264 |
+
*
|
265 |
+
* @param $ch
|
266 |
+
*/
|
267 |
+
protected function doExecute(&$ch)
|
268 |
+
{
|
269 |
+
$this->setCurlOpts($ch);
|
270 |
+
$this->responseBody = json_decode(curl_exec($ch));
|
271 |
+
$this->responseInfo = curl_getinfo($ch);
|
272 |
+
|
273 |
+
curl_close($ch);
|
274 |
+
}
|
275 |
+
|
276 |
+
/**
|
277 |
+
* curl options.
|
278 |
+
*
|
279 |
+
* @param $ch
|
280 |
+
*/
|
281 |
+
protected function setCurlOpts(&$ch)
|
282 |
+
{
|
283 |
+
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
|
284 |
+
curl_setopt($ch, CURLOPT_URL, $this->url);
|
285 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
286 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
|
287 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
|
288 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, array ('Accept: ' . $this->acceptType ,'Content-Type: application/json'));
|
289 |
+
}
|
290 |
+
|
291 |
+
/**
|
292 |
+
* basic auth.
|
293 |
+
*
|
294 |
+
* @param $ch
|
295 |
+
*/
|
296 |
+
protected function setAuth(&$ch)
|
297 |
+
{
|
298 |
+
if ($this->_apiUsername !== null && $this->_apiPassword !== null)
|
299 |
+
{
|
300 |
+
curl_setopt($ch, CURLAUTH_BASIC, CURLAUTH_DIGEST);
|
301 |
+
curl_setopt($ch, CURLOPT_USERPWD, $this->_apiUsername . ':' . $this->_apiPassword);
|
302 |
+
}
|
303 |
+
}
|
304 |
+
|
305 |
+
/**
|
306 |
+
* Get accept type.
|
307 |
+
*
|
308 |
+
* @return string
|
309 |
+
*/
|
310 |
+
public function getAcceptType()
|
311 |
+
{
|
312 |
+
return $this->acceptType;
|
313 |
+
}
|
314 |
+
|
315 |
+
/**
|
316 |
+
* set accept type.
|
317 |
+
*
|
318 |
+
* @param $acceptType
|
319 |
+
*/
|
320 |
+
public function setAcceptType($acceptType)
|
321 |
+
{
|
322 |
+
$this->acceptType = $acceptType;
|
323 |
+
}
|
324 |
+
|
325 |
+
|
326 |
+
/**
|
327 |
+
* get api username.
|
328 |
+
*
|
329 |
+
* @return string
|
330 |
+
*/
|
331 |
+
public function getApiUsername()
|
332 |
+
{
|
333 |
+
return $this->_apiUsername;
|
334 |
+
}
|
335 |
+
|
336 |
+
/**
|
337 |
+
* set api username.
|
338 |
+
*
|
339 |
+
* @param $apiUsername
|
340 |
+
*
|
341 |
+
* @return $this
|
342 |
+
*/
|
343 |
+
public function setApiUsername($apiUsername)
|
344 |
+
{
|
345 |
+
$this->_apiUsername = $apiUsername;
|
346 |
+
return $this;
|
347 |
+
}
|
348 |
+
/**
|
349 |
+
* Get api password.
|
350 |
+
*
|
351 |
+
* @return string
|
352 |
+
*/
|
353 |
+
public function getApiPassword()
|
354 |
+
{
|
355 |
+
return $this->_apiPassword;
|
356 |
+
}
|
357 |
+
|
358 |
+
/**
|
359 |
+
* set api password.
|
360 |
+
* @param $apiPassword
|
361 |
+
*
|
362 |
+
* @return $this
|
363 |
+
*/
|
364 |
+
public function setApiPassword($apiPassword)
|
365 |
+
{
|
366 |
+
$this->_apiPassword = $apiPassword;
|
367 |
+
return $this;
|
368 |
+
}
|
369 |
+
|
370 |
+
/**
|
371 |
+
* get response body.
|
372 |
+
*
|
373 |
+
* @return string/object
|
374 |
+
*/
|
375 |
+
public function getResponseBody()
|
376 |
+
{
|
377 |
+
return $this->responseBody;
|
378 |
+
}
|
379 |
+
|
380 |
+
/**
|
381 |
+
* get response info.
|
382 |
+
*
|
383 |
+
* @return null
|
384 |
+
*/
|
385 |
+
public function getResponseInfo()
|
386 |
+
{
|
387 |
+
return $this->responseInfo;
|
388 |
+
}
|
389 |
+
|
390 |
+
/**
|
391 |
+
* get url.
|
392 |
+
*
|
393 |
+
* @return string
|
394 |
+
*/
|
395 |
+
public function getUrl()
|
396 |
+
{
|
397 |
+
return $this->url;
|
398 |
+
}
|
399 |
+
|
400 |
+
/**
|
401 |
+
* set url.
|
402 |
+
*
|
403 |
+
* @param $url
|
404 |
+
*
|
405 |
+
* @return $this
|
406 |
+
*/
|
407 |
+
public function setUrl($url)
|
408 |
+
{
|
409 |
+
$this->url = $url;
|
410 |
+
return $this;
|
411 |
+
}
|
412 |
+
|
413 |
+
/**
|
414 |
+
* get the verb.
|
415 |
+
*
|
416 |
+
* @return string
|
417 |
+
*/
|
418 |
+
public function getVerb ()
|
419 |
+
{
|
420 |
+
return $this->verb;
|
421 |
+
}
|
422 |
+
|
423 |
+
/**
|
424 |
+
* set the verb.
|
425 |
+
*
|
426 |
+
* @param $verb
|
427 |
+
*
|
428 |
+
* @return $this
|
429 |
+
*/
|
430 |
+
public function setVerb ($verb)
|
431 |
+
{
|
432 |
+
$this->verb = $verb;
|
433 |
+
return $this;
|
434 |
+
}
|
435 |
+
}
|
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Model_Adminhtml_Observer
|
4 |
+
{
|
5 |
+
|
6 |
+
/**
|
7 |
+
* API Sync and Data Mapping.
|
8 |
+
* Reset contacts for reimport.
|
9 |
+
* @return $this
|
10 |
+
*/
|
11 |
+
public function actionConfigResetContacts()
|
12 |
+
{
|
13 |
+
$contactModel = Mage::getModel('email_connector/contact');
|
14 |
+
$numImported = $contactModel->getNumberOfImportedContacs();
|
15 |
+
$updated = $contactModel->resetAllContacts();
|
16 |
+
Mage::helper('connector')->log('-- Imported contacts: ' . $numImported . ' reseted : ' . $updated . '--');
|
17 |
+
|
18 |
+
return $this;
|
19 |
+
}
|
20 |
+
|
21 |
+
/**
|
22 |
+
* API Transactional Section.
|
23 |
+
* Default data fields for transactional account.
|
24 |
+
* @return $this
|
25 |
+
*/
|
26 |
+
public function actionConfigTransactional()
|
27 |
+
{
|
28 |
+
$client = Mage::getModel('email_connector/apiconnector_client');
|
29 |
+
$username = Mage::helper('connector/transactional')->getApiUsername();
|
30 |
+
$password = Mage::helper('connector/transactional')->getApiPassword();
|
31 |
+
$client->setApiUsername($username)->setApiPassword($password);
|
32 |
+
$dataFields = Mage::getModel('email_connector/connector_datafield')->getTransactionalDefaultDatafields();
|
33 |
+
|
34 |
+
foreach ($dataFields as $field) {
|
35 |
+
//create the datafields
|
36 |
+
$client->postDataFields($field);
|
37 |
+
}
|
38 |
+
return $this;
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* API Credentials.
|
43 |
+
* Installation and validation confirmation.
|
44 |
+
* @return $this
|
45 |
+
*/
|
46 |
+
public function actionConfigSaveApi()
|
47 |
+
{
|
48 |
+
$groups = Mage::app()->getRequest()->getPost('groups');
|
49 |
+
if (isset($groups['api']['fields']['username']['inherit']) || isset($groups['api']['fields']['password']['inherit']))
|
50 |
+
return $this;
|
51 |
+
|
52 |
+
$apiUsername = isset($groups['api']['fields']['username']['value'])? $groups['api']['fields']['username']['value'] : false;
|
53 |
+
$apiPassword = isset($groups['api']['fields']['password']['value'])? $groups['api']['fields']['password']['value'] : false;
|
54 |
+
//skip if the inherit option is selected
|
55 |
+
if ($apiUsername && $apiPassword) {
|
56 |
+
Mage::helper('connector')->log('----VALIDATING ACCOUNT---');
|
57 |
+
$testModel = Mage::getModel('email_connector/apiconnector_test');
|
58 |
+
$isValid = $testModel->validate($apiUsername, $apiPassword);
|
59 |
+
if ($isValid) {
|
60 |
+
/**
|
61 |
+
* Create account contact datafields
|
62 |
+
*/
|
63 |
+
$client = Mage::getModel('email_connector/apiconnector_client');
|
64 |
+
$client->setApiUsername($apiUsername)
|
65 |
+
->setApiPassword($apiPassword);
|
66 |
+
$datafields = Mage::getModel('email_connector/connector_datafield')->getDefaultDataFields();
|
67 |
+
foreach ($datafields as $datafield) {
|
68 |
+
$client->postDataFields($datafield);
|
69 |
+
}
|
70 |
+
/**
|
71 |
+
* Send install info
|
72 |
+
*/
|
73 |
+
$testModel->sendInstallConfirmation();
|
74 |
+
} else {
|
75 |
+
/**
|
76 |
+
* Disable invalid Api credentials
|
77 |
+
*/
|
78 |
+
$scopeId = 0;
|
79 |
+
if ($website = Mage::app()->getRequest()->getParam('website')) {
|
80 |
+
$scope = 'websites';
|
81 |
+
$scopeId = Mage::app()->getWebsite($website)->getId();
|
82 |
+
} else {
|
83 |
+
$scope = "default";
|
84 |
+
}
|
85 |
+
$config = Mage::getConfig();
|
86 |
+
$config->saveConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_API_ENABLED, 0, $scope, $scopeId);
|
87 |
+
$config->cleanCache();
|
88 |
+
}
|
89 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('connector')->__('API Credentials Valid.'));
|
90 |
+
}
|
91 |
+
return $this;
|
92 |
+
}
|
93 |
+
}
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Model_Adminhtml_Source_Addressbooks
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Returns the address books options.
|
7 |
+
*
|
8 |
+
* @return array
|
9 |
+
*/
|
10 |
+
public function toOptionArray()
|
11 |
+
{
|
12 |
+
$fields = array();
|
13 |
+
|
14 |
+
$website = Mage::app()->getRequest()->getParam('website');
|
15 |
+
$client = Mage::getModel('email_connector/apiconnector_client');
|
16 |
+
|
17 |
+
$client->setApiUsername(Mage::helper('connector')->getApiUsername($website));
|
18 |
+
$client->setApiPassword(Mage::helper('connector')->getApiPassword($website));
|
19 |
+
|
20 |
+
// Add a "Do Not Map" Option
|
21 |
+
$fields[] = array('value' => 0, 'label' => Mage::helper('connector')->__('-- Please Select --'));
|
22 |
+
$savedAddressBooks = Mage::registry('addressbooks');
|
23 |
+
if ($savedAddressBooks) {
|
24 |
+
$addressBooks = $savedAddressBooks;
|
25 |
+
} else {
|
26 |
+
// api all address books
|
27 |
+
$addressBooks = $client->getAddressBooks();
|
28 |
+
Mage::register('addressbooks', $addressBooks);
|
29 |
+
}
|
30 |
+
|
31 |
+
if (isset($addressBooks->message)) {
|
32 |
+
$fields[] = array('value' => 0, 'label' => Mage::helper('connector')->__('-- Please Select --'));
|
33 |
+
}
|
34 |
+
|
35 |
+
//set up fields with book id and label
|
36 |
+
foreach ($addressBooks as $book) {
|
37 |
+
if(isset($book->id))
|
38 |
+
$fields[] = array('value' => $book->id, 'label' => $book->name);
|
39 |
+
}
|
40 |
+
|
41 |
+
return $fields;
|
42 |
+
}
|
43 |
+
|
44 |
+
}
|
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
class
|
4 |
{
|
5 |
/**
|
6 |
* @return array
|
1 |
<?php
|
2 |
|
3 |
+
class Dotdigitalgroup_Email_Model_Adminhtml_Source_Advanced_Transdata
|
4 |
{
|
5 |
/**
|
6 |
* @return array
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Model_Adminhtml_Source_Campaigns
|
4 |
+
{
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Returns the campaigns options.
|
8 |
+
*
|
9 |
+
* @return array
|
10 |
+
* @throws Mage_Core_Exception
|
11 |
+
*/
|
12 |
+
public function toOptionArray()
|
13 |
+
{
|
14 |
+
$fields = array();
|
15 |
+
$websiteName = Mage::app()->getRequest()->getParam('website', false);
|
16 |
+
//admin
|
17 |
+
$website = 0;
|
18 |
+
if ($websiteName) {
|
19 |
+
$website = Mage::app()->getWebsite($websiteName);
|
20 |
+
}
|
21 |
+
$client = Mage::helper('connector')->getWebsiteApiClient($website);
|
22 |
+
|
23 |
+
|
24 |
+
$savedCampaigns = Mage::registry('savedcampigns');
|
25 |
+
|
26 |
+
if ($savedCampaigns) {
|
27 |
+
$campaigns = $savedCampaigns;
|
28 |
+
} else {
|
29 |
+
$campaigns = $client->getCampaigns();
|
30 |
+
Mage::register('savedcampigns', $campaigns);
|
31 |
+
}
|
32 |
+
|
33 |
+
$fields[] = array('value' => '0', 'label' => Mage::helper('connector')->__('-- Please Select --'));
|
34 |
+
|
35 |
+
foreach ($campaigns as $one) {
|
36 |
+
if(isset($one->id))
|
37 |
+
$fields[] = array('value' => $one->id, 'label' => Mage::helper('connector')->__($one->name));
|
38 |
+
}
|
39 |
+
|
40 |
+
return $fields;
|
41 |
+
}
|
42 |
+
|
43 |
+
}
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Model_Adminhtml_Source_Contact_Imported
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Contact imported options.
|
7 |
+
*
|
8 |
+
* @return array
|
9 |
+
*/
|
10 |
+
public function getOptions()
|
11 |
+
{
|
12 |
+
return array(
|
13 |
+
'1' => Mage::helper('connector')->__('Imported'),
|
14 |
+
'null' => Mage::helper('connector')->__('Not Imported'),
|
15 |
+
);
|
16 |
+
}
|
17 |
+
}
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Model_Adminhtml_Source_Customer_Attributes_Select
|
4 |
+
{
|
5 |
+
|
6 |
+
/**
|
7 |
+
* customer custom attributes.
|
8 |
+
*
|
9 |
+
* @return array
|
10 |
+
*/
|
11 |
+
public function toOptionArray()
|
12 |
+
{
|
13 |
+
|
14 |
+
$options = array();
|
15 |
+
//exclude attributes from mapping
|
16 |
+
$excluded =
|
17 |
+
array('created_at', 'created_in', 'dob', 'dotmailer_contact_id', 'email', 'firstname', 'lastname', 'gender',
|
18 |
+
'group_id', 'password_hash', 'prefix', 'rp_token', 'rp_token_create_at', 'website_id');
|
19 |
+
$attributes = Mage::getModel('customer/customer')->getAttributes();
|
20 |
+
|
21 |
+
foreach ($attributes as $attribute) {
|
22 |
+
if ($attribute->getFrontendLabel()) {
|
23 |
+
$code = $attribute->getAttributeCode();
|
24 |
+
if(!in_array($code, $excluded))
|
25 |
+
$options[] = array(
|
26 |
+
'value' => $attribute->getAttributeCode(),
|
27 |
+
'label' => $attribute->getFrontendLabel()
|
28 |
+
);
|
29 |
+
}
|
30 |
+
}
|
31 |
+
|
32 |
+
return $options;
|
33 |
+
}
|
34 |
+
}
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Model_Adminhtml_Source_Datafields
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Returns the account's datafields.
|
7 |
+
* @return array
|
8 |
+
*/
|
9 |
+
public function toOptionArray()
|
10 |
+
{
|
11 |
+
$fields = array();
|
12 |
+
$helper = Mage::helper('connector');
|
13 |
+
|
14 |
+
$website = Mage::app()->getRequest()->getParam('website', 0);
|
15 |
+
$client = $helper->getWebsiteApiClient($website);
|
16 |
+
|
17 |
+
/**
|
18 |
+
* api get all datafields
|
19 |
+
*/
|
20 |
+
$savedDatafields = Mage::registry('datafields');
|
21 |
+
if ($savedDatafields) {
|
22 |
+
$datafields = $savedDatafields;
|
23 |
+
} else {
|
24 |
+
$datafields = $client->getDataFields();
|
25 |
+
Mage::register('datafields', $datafields);
|
26 |
+
}
|
27 |
+
|
28 |
+
// Add a "Do Not Map" Option
|
29 |
+
$fields[] = array('value' => 0, 'label' => Mage::helper('connector')->__('-- Please Select --'));
|
30 |
+
|
31 |
+
if (isset($datafields->message)) {
|
32 |
+
$fields[] = array('value' => 0, 'label' => $datafields->message);
|
33 |
+
}
|
34 |
+
|
35 |
+
|
36 |
+
foreach ($datafields as $datafield) {
|
37 |
+
if(isset($datafield->name))
|
38 |
+
$fields[] = array('value' => $datafield->name, 'label' => $datafield->name);
|
39 |
+
}
|
40 |
+
|
41 |
+
return $fields;
|
42 |
+
}
|
43 |
+
|
44 |
+
|
45 |
+
}
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Model_Adminhtml_Source_Datamapping_Datafieldtype
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Datafield model type.
|
7 |
+
* Data mapping.
|
8 |
+
* @return array
|
9 |
+
*/
|
10 |
+
public function toOptionArray()
|
11 |
+
{
|
12 |
+
$dataType = array(
|
13 |
+
array('value' => 'String','label' => Mage::helper('connector')->__('String')),
|
14 |
+
array('value' => 'Numeric', 'label' => Mage::helper('connector')->__('Numeric')),
|
15 |
+
array('value' => 'Date', 'label' => Mage::helper('connector')->__('Date')),
|
16 |
+
array('value' => 'Boolean', 'label' => Mage::helper('connector')->__('Boolean'))
|
17 |
+
);
|
18 |
+
|
19 |
+
return $dataType;
|
20 |
+
}
|
21 |
+
|
22 |
+
}
|
@@ -1,8 +1,13 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
class
|
4 |
{
|
5 |
-
|
|
|
|
|
|
|
|
|
|
|
6 |
{
|
7 |
return array(
|
8 |
array('value' => 'grid', 'label' => Mage::helper('connector')->__('Grid')),
|
1 |
<?php
|
2 |
|
3 |
+
class Dotdigitalgroup_Email_Model_Adminhtml_Source_Dynamic_Displaytype
|
4 |
{
|
5 |
+
/**
|
6 |
+
* Display type mode.
|
7 |
+
*
|
8 |
+
* @return array
|
9 |
+
*/
|
10 |
+
public function toOptionArray()
|
11 |
{
|
12 |
return array(
|
13 |
array('value' => 'grid', 'label' => Mage::helper('connector')->__('Grid')),
|
@@ -1,7 +1,12 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
class
|
4 |
{
|
|
|
|
|
|
|
|
|
|
|
5 |
public function toOptionArray()
|
6 |
{
|
7 |
return array(
|
1 |
<?php
|
2 |
|
3 |
+
class Dotdigitalgroup_Email_Model_Adminhtml_Source_Dynamic_Gridview
|
4 |
{
|
5 |
+
/**
|
6 |
+
* grid display options.
|
7 |
+
*
|
8 |
+
* @return array
|
9 |
+
*/
|
10 |
public function toOptionArray()
|
11 |
{
|
12 |
return array(
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Model_Adminhtml_Source_Lostbaskets_Interval
|
4 |
+
{
|
5 |
+
|
6 |
+
/**
|
7 |
+
* available times
|
8 |
+
* @var array
|
9 |
+
*/
|
10 |
+
protected $_times = array(1,2,3,4,5,6,12,24,36,48,60,72,84,96,108,120);
|
11 |
+
|
12 |
+
|
13 |
+
/**
|
14 |
+
* send to campain options hours
|
15 |
+
* @return array
|
16 |
+
*/
|
17 |
+
public function toOptionArray()
|
18 |
+
{
|
19 |
+
$result = $row = array();
|
20 |
+
$i = 0;
|
21 |
+
foreach ($this->_times as $one) {
|
22 |
+
|
23 |
+
if ($i == 0)
|
24 |
+
$row = array(
|
25 |
+
'value' => $one,
|
26 |
+
'label' => Mage::helper('connector')->__($one . ' Hour')
|
27 |
+
);
|
28 |
+
else
|
29 |
+
$row = array(
|
30 |
+
'value' => $one,
|
31 |
+
'label' => Mage::helper('connector')->__($one . ' Hours')
|
32 |
+
);
|
33 |
+
$result[] = $row;
|
34 |
+
}
|
35 |
+
|
36 |
+
return $result;
|
37 |
+
}
|
38 |
+
}
|
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
class
|
4 |
{
|
5 |
/**
|
6 |
* lost basket hour options
|
1 |
<?php
|
2 |
|
3 |
+
class Dotdigitalgroup_Email_Model_Adminhtml_Source_Lostbaskets_Intervalminute
|
4 |
{
|
5 |
/**
|
6 |
* lost basket hour options
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Model_Adminhtml_Source_Transactional_Campaigns
|
4 |
+
{
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Returns the account's datafields.
|
8 |
+
*
|
9 |
+
* @return array
|
10 |
+
* @throws Mage_Core_Exception
|
11 |
+
*/
|
12 |
+
public function toOptionArray()
|
13 |
+
{
|
14 |
+
$fields = array();
|
15 |
+
$client = Mage::getModel('email_connector/apiconnector_client');
|
16 |
+
|
17 |
+
$websiteName = Mage::app()->getRequest()->getParam('website', false);
|
18 |
+
if ($websiteName) {
|
19 |
+
$website = Mage::app()->getWebsite($websiteName);
|
20 |
+
} else {
|
21 |
+
$website = 0;
|
22 |
+
}
|
23 |
+
$client->setApiUsername(Mage::helper('connector/transactional')->getApiUsername($website));
|
24 |
+
$client->setApiPassword(Mage::helper('connector/transactional')->getApiPassword($website));
|
25 |
+
|
26 |
+
$savedCampaigns = Mage::registry('savedcampigns');
|
27 |
+
|
28 |
+
if ($savedCampaigns) {
|
29 |
+
$campaigns = $savedCampaigns;
|
30 |
+
} else {
|
31 |
+
$campaigns = $client->getCampaigns();
|
32 |
+
Mage::register('savedcampigns', $campaigns);
|
33 |
+
}
|
34 |
+
|
35 |
+
$fields[] = array('value' => '0', 'label' => Mage::helper('connector')->__('-- Use system default --'));
|
36 |
+
foreach ($campaigns as $one) {
|
37 |
+
if(isset($one->id))
|
38 |
+
$fields[] = array('value' => $one->id, 'label' => Mage::helper('connector')->__($one->name));
|
39 |
+
}
|
40 |
+
|
41 |
+
return $fields;
|
42 |
+
}
|
43 |
+
|
44 |
+
}
|
@@ -0,0 +1,691 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Model_Apiconnector_Client extends Dotdigitalgroup_Email_Model_Abstract_Rest
|
4 |
+
{
|
5 |
+
const APICONNECTOR_VERSION = 'V2';
|
6 |
+
|
7 |
+
const REST_WAIT_UPLOAD_TIME = 5;
|
8 |
+
//rest api data
|
9 |
+
const REST_ACCOUNT_INFO = 'https://apiconnector.com/v2/account-info';
|
10 |
+
const REST_CONTACTS = 'https://apiconnector.com/v2/contacts/';
|
11 |
+
const REST_CONTACTS_IMPORT = 'https://apiconnector.com/v2/contacts/import/';
|
12 |
+
const REST_ADDRESS_BOOKS = 'https://apiconnector.com/v2/address-books/';
|
13 |
+
const REST_DATA_FILEDS = 'https://apiconnector.com/v2/data-fields';
|
14 |
+
const REST_TRANSACTIONAL_DATA_IMPORT = 'https://apiconnector.com/v2/contacts/transactional-data/import/';
|
15 |
+
const REST_TRANSACTIONAL_DATA = 'https://apiconnector.com/v2/contacts/transactional-data/';
|
16 |
+
const REST_CAMPAIGN_SEND = 'https://apiconnector.com/v2/campaigns/send';
|
17 |
+
const REST_CONTACTS_SUPPRESSED_SINCE = 'https://apiconnector.com/v2/contacts/suppressed-since/';
|
18 |
+
const REST_DATA_FIELDS_CAMPAIGNS = 'https://apiconnector.com/v2/campaigns';
|
19 |
+
const REST_SMS_MESSAGE_SEND_TO = 'https://apiconnector.com/v2/sms-messages/send-to/';
|
20 |
+
const REST_CONTACTS_RESUBSCRIBE = 'https://apiconnector.com/v2/contacts/resubscribe';
|
21 |
+
//rest error responces
|
22 |
+
const REST_CONTACT_NOT_FOUND = 'Error: ERROR_CONTACT_NOT_FOUND';
|
23 |
+
const REST_SEND_MULTI_TRANSACTIONAL_DATA = 'Error: ERROR_FEATURENOTACTIVE';
|
24 |
+
const REST_STATUS_IMPORT_REPORT_NOT_FOUND = 'Import is not processed yet or completed with error. ERROR_IMPORT_REPORT_NOT_FOUND';
|
25 |
+
const REST_STATUS_REPORT_NOTFINISHED = 'NotFinished';
|
26 |
+
const REST_TRANSACTIONAL_DATA_NOT_EXISTS = 'Error: ERROR_TRANSACTIONAL_DATA_DOES_NOT_EXIST';
|
27 |
+
const REST_API_USAGE_EXCEEDED = 'Your account has generated excess API activity and is being temporarily capped. Please contact support. ERROR_APIUSAGE_EXCEEDED';
|
28 |
+
const REST_API_EMAIL_NOT_VALID = 'Email is not a valid email address. ERROR_PARAMETER_INVALID';
|
29 |
+
const REST_API_DATAFILEDS_EXISTS = 'Field already exists. ERROR_NON_UNIQUE_DATAFIELD';
|
30 |
+
|
31 |
+
protected $_customers_file_slug = 'customer_sync';
|
32 |
+
protected $_subscribers_file_slug = 'subscriber_sync';
|
33 |
+
protected $_api_helper;
|
34 |
+
protected $_subscribers_address_book_id;
|
35 |
+
protected $_customers_address_book_id;
|
36 |
+
protected $_filename;
|
37 |
+
protected $_subscribers_filename;
|
38 |
+
protected $_customers_filename;
|
39 |
+
protected $_limit = 10;
|
40 |
+
protected $_address_book_id;
|
41 |
+
public $fileHelper; /** @var Dotdigitalgroup_Email_Helper_File */
|
42 |
+
public $result = array('error' => false, 'message' => '');
|
43 |
+
|
44 |
+
|
45 |
+
/**
|
46 |
+
* constructor.
|
47 |
+
*/
|
48 |
+
public function __construct()
|
49 |
+
{
|
50 |
+
parent::__construct();
|
51 |
+
}
|
52 |
+
|
53 |
+
/**
|
54 |
+
* @param $apiUsername
|
55 |
+
* @param $apiPassword
|
56 |
+
* @return bool|mixed
|
57 |
+
*/
|
58 |
+
public function validate($apiUsername, $apiPassword)
|
59 |
+
{
|
60 |
+
if ($apiUsername && $apiPassword) {
|
61 |
+
$this->setApiUsername($apiUsername)
|
62 |
+
->setApiPassword($apiPassword);
|
63 |
+
$accountInfo = $this->getAccountInfo();
|
64 |
+
if (isset($accountInfo->message)) {
|
65 |
+
Mage::getSingleton('adminhtml/session')->addError($accountInfo->message);
|
66 |
+
Mage::helper('connector')->log('VALIDATION ERROR : ' . $accountInfo->message);
|
67 |
+
return false;
|
68 |
+
}
|
69 |
+
return $accountInfo;
|
70 |
+
}
|
71 |
+
return false;
|
72 |
+
}
|
73 |
+
/**
|
74 |
+
* Gets a contact by ID. Unsubscribed or suppressed contacts will not be retrieved.
|
75 |
+
* @param $id
|
76 |
+
* @return null
|
77 |
+
*/
|
78 |
+
public function getContactById($id)
|
79 |
+
{
|
80 |
+
$url = self::REST_CONTACTS . $id;
|
81 |
+
|
82 |
+
$this->setUrl($url)
|
83 |
+
->setVerb('GET');
|
84 |
+
$response = $this->execute();
|
85 |
+
if(isset($response->message))
|
86 |
+
Mage::helper('connector')->log('GET CONTACT INFO ID ' . $url . ', ' . $response->message);
|
87 |
+
|
88 |
+
return $response;
|
89 |
+
}
|
90 |
+
|
91 |
+
/**
|
92 |
+
* * Bulk creates, or bulk updates, contacts. Import format can either be CSV or Excel.
|
93 |
+
* Must include one column called "Email". Any other columns will attempt to map to your custom data fields.
|
94 |
+
* The ID of returned object can be used to query import progress.
|
95 |
+
* @param $filename
|
96 |
+
* @param $addressBookId
|
97 |
+
* @return mixed
|
98 |
+
*/
|
99 |
+
public function postAddressBookContactsImport($filename, $addressBookId)
|
100 |
+
{
|
101 |
+
$url = "https://apiconnector.com/v2/address-books/{$addressBookId}/contacts/import";
|
102 |
+
$helper = Mage::helper('connector');
|
103 |
+
|
104 |
+
$ch = curl_init($url);
|
105 |
+
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
|
106 |
+
curl_setopt($ch, CURLOPT_USERPWD, $this->getApiUsername() . ':' . $this->getApiPassword());
|
107 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, array (
|
108 |
+
'file' => '@'.Mage::helper('connector/file')->getFilePath($filename)
|
109 |
+
));
|
110 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
111 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
112 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
113 |
+
'Content-Type: multipart/form-data')
|
114 |
+
);
|
115 |
+
|
116 |
+
// send contacts to address book
|
117 |
+
$result = curl_exec($ch);
|
118 |
+
$result = json_decode($result);
|
119 |
+
if (isset($result->message)) {
|
120 |
+
$helper->log('POST ADDRESS BOOK ' . $addressBookId . ', CONTACT IMPORT : ' . ' filename ' . $filename . ' Username ' . $this->getApiUsername() . $result->message);
|
121 |
+
Mage::helper('connector')->log($result);
|
122 |
+
}
|
123 |
+
|
124 |
+
return $result;
|
125 |
+
}
|
126 |
+
|
127 |
+
/**
|
128 |
+
* Adds a contact to a given address book.
|
129 |
+
* @param $addressBookId
|
130 |
+
* @param $apiContact
|
131 |
+
* @return mixed|null
|
132 |
+
*/
|
133 |
+
public function postAddressBookContacts($addressBookId, $apiContact)
|
134 |
+
{
|
135 |
+
$url = self::REST_ADDRESS_BOOKS . $addressBookId . '/contacts';
|
136 |
+
$this->setUrl($url)
|
137 |
+
->setVerb("POST")
|
138 |
+
->buildPostBody($apiContact);
|
139 |
+
|
140 |
+
$response = $this->execute();
|
141 |
+
if (isset($response->message)) {
|
142 |
+
Mage::helper('connector')->log('POST ADDRESS BOOK CONTACTS ' . $url . ', ' . $response->message);
|
143 |
+
Mage::helper('connector')->log($apiContact->email);
|
144 |
+
}
|
145 |
+
|
146 |
+
return $response;
|
147 |
+
}
|
148 |
+
|
149 |
+
/**
|
150 |
+
* Deletes all contacts from a given address book.
|
151 |
+
* @param $addressBookId
|
152 |
+
* @param $contactId
|
153 |
+
* @return null
|
154 |
+
*/
|
155 |
+
public function deleteAddressBookContact($addressBookId, $contactId)
|
156 |
+
{
|
157 |
+
$url = self::REST_ADDRESS_BOOKS . $addressBookId . '/contacts/' . $contactId;
|
158 |
+
$this->setUrl($url)
|
159 |
+
->setVerb('DELETE');
|
160 |
+
$response = $this->execute();
|
161 |
+
if (isset($response->message))
|
162 |
+
Mage::helper('connector')->log('DELETE ADDRESS BOOK CONTACT ' . $url . ', ' . $response->message);
|
163 |
+
|
164 |
+
return $response;
|
165 |
+
}
|
166 |
+
|
167 |
+
/**
|
168 |
+
* Gets a report with statistics about what was successfully imported, and what was unable to be imported.
|
169 |
+
* @param $importId
|
170 |
+
* @return mixed
|
171 |
+
*/
|
172 |
+
public function getContactsImportReport($importId)
|
173 |
+
{
|
174 |
+
$url = self::REST_CONTACTS_IMPORT . $importId . "/report";
|
175 |
+
$this->setUrl($url)
|
176 |
+
->setVerb('GET');
|
177 |
+
$response = $this->execute();
|
178 |
+
if (isset($response->message))
|
179 |
+
Mage::helper('connector')->log('GET CONTACTS IMPORT REPORT . ' . $url . ' message : ' . $response->message);
|
180 |
+
return $response;
|
181 |
+
}
|
182 |
+
|
183 |
+
/**
|
184 |
+
* Gets a contact by email address.
|
185 |
+
* @param $email
|
186 |
+
* @return mixed
|
187 |
+
*/
|
188 |
+
public function getContactByEmail($email)
|
189 |
+
{
|
190 |
+
$url = self::REST_CONTACTS . $email;
|
191 |
+
$this->setUrl($url)
|
192 |
+
->setVerb('GET');
|
193 |
+
|
194 |
+
$response = $this->execute();
|
195 |
+
if (isset($response->message))
|
196 |
+
Mage::helper('connector')->log('GET CONTACT BY EMAIL : ' . $email . ' ' . $response->message);
|
197 |
+
|
198 |
+
return $response;
|
199 |
+
}
|
200 |
+
|
201 |
+
/**
|
202 |
+
* Get all address books
|
203 |
+
* @return null
|
204 |
+
*/
|
205 |
+
public function getAddressBooks()
|
206 |
+
{
|
207 |
+
$url = self::REST_ADDRESS_BOOKS;
|
208 |
+
$this->setUrl($url)
|
209 |
+
->setVerb("GET");
|
210 |
+
|
211 |
+
$response = $this->execute();
|
212 |
+
if (isset($response->message))
|
213 |
+
Mage::helper('connector')->log('GET ALL ADDRESS BOOKS : ' . $url . ', ' . $response->message);
|
214 |
+
return $response;
|
215 |
+
}
|
216 |
+
|
217 |
+
/**
|
218 |
+
* Creates an address book.
|
219 |
+
* @param $name
|
220 |
+
* @return null
|
221 |
+
*/
|
222 |
+
public function PostAddressBooks($name)
|
223 |
+
{
|
224 |
+
$data = array(
|
225 |
+
'Name' => $name,
|
226 |
+
'Visibility' => 'Public'
|
227 |
+
);
|
228 |
+
$url = self::REST_ADDRESS_BOOKS;
|
229 |
+
$this->setUrl($url)
|
230 |
+
->setVerb('POST')
|
231 |
+
->buildPostBody($data);
|
232 |
+
|
233 |
+
$response = $this->execute();
|
234 |
+
|
235 |
+
if (isset($response->message)) {
|
236 |
+
Mage::helper('connector')->log('POSTADDRESSBOOK ' . $url);
|
237 |
+
Mage::helper('connector')->log($response->message);
|
238 |
+
}
|
239 |
+
return $response;
|
240 |
+
}
|
241 |
+
|
242 |
+
/**
|
243 |
+
* Get list of all campaigns
|
244 |
+
* @return mixed
|
245 |
+
*/
|
246 |
+
public function getCampaigns()
|
247 |
+
{
|
248 |
+
$url = self::REST_DATA_FIELDS_CAMPAIGNS;
|
249 |
+
$this->setUrl($url)
|
250 |
+
->setVerb('GET');
|
251 |
+
|
252 |
+
$response = $this->execute();
|
253 |
+
|
254 |
+
if (isset($response->message))
|
255 |
+
Mage::helper('connector')->log('GET CAMPAINGS ' . $response->message . ' api user : ' . $this->getApiUsername());
|
256 |
+
|
257 |
+
return $response;
|
258 |
+
}
|
259 |
+
|
260 |
+
/**
|
261 |
+
* Creates a data field within the account.
|
262 |
+
* @param $data string/array
|
263 |
+
* @param string $type string, numeric, date, boolean
|
264 |
+
* @param string $visibility public, private
|
265 |
+
* @param bool $defaultValue
|
266 |
+
* @return mixed
|
267 |
+
*/
|
268 |
+
public function postDataFields($data, $type = 'String', $visibility = 'public', $defaultValue = false)
|
269 |
+
{
|
270 |
+
$url = self::REST_DATA_FILEDS;
|
271 |
+
if($type == 'numeric' && !$defaultValue)
|
272 |
+
$defaultValue = 0;
|
273 |
+
if (is_string($data)) {
|
274 |
+
$data = array(
|
275 |
+
'Name' => $data,
|
276 |
+
'Type' => $type,
|
277 |
+
'Visibility' => $visibility
|
278 |
+
);
|
279 |
+
if($defaultValue)
|
280 |
+
$data['DefaultValue'] = $defaultValue;
|
281 |
+
}
|
282 |
+
$this->setUrl($url)
|
283 |
+
->buildPostBody($data)
|
284 |
+
->setVerb('POST');
|
285 |
+
|
286 |
+
$response = $this->execute();
|
287 |
+
|
288 |
+
if (isset($response->message)) {
|
289 |
+
Mage::helper('connector')->log('POST CREATE DATAFIELDS ' . $response->message);
|
290 |
+
Mage::helper('connector')->log($data);
|
291 |
+
}
|
292 |
+
|
293 |
+
return $response;
|
294 |
+
}
|
295 |
+
|
296 |
+
public function deleteDataField($name)
|
297 |
+
{
|
298 |
+
$url = self::REST_DATA_FILEDS . '/' . $name;
|
299 |
+
$request = Mage::helper('connector/api_restrequest');
|
300 |
+
$request->setUrl($url)
|
301 |
+
->setVerb('DELETE');
|
302 |
+
|
303 |
+
$response = $request->execute();
|
304 |
+
if(isset($response->message))
|
305 |
+
Mage::helper('connector')->log('DELETE DATA FIELD :' . $name . ' ' . $response->message);
|
306 |
+
return $request->execute();
|
307 |
+
}
|
308 |
+
|
309 |
+
/**
|
310 |
+
* Lists the data fields within the account.
|
311 |
+
* @return mixed
|
312 |
+
*/
|
313 |
+
public function getDataFields()
|
314 |
+
{
|
315 |
+
$url = self::REST_DATA_FILEDS;
|
316 |
+
$this->setUrl($url)
|
317 |
+
->setVerb('GET');
|
318 |
+
|
319 |
+
$response = $this->execute();
|
320 |
+
if (isset($response->message))
|
321 |
+
Mage::helper('connector')->log('GET ALL DATAFIELDS ' . $response->message);
|
322 |
+
|
323 |
+
return $response;
|
324 |
+
}
|
325 |
+
|
326 |
+
/**
|
327 |
+
* Updates a contact.
|
328 |
+
* @param $contactId
|
329 |
+
* @param $data
|
330 |
+
* @return object
|
331 |
+
*/
|
332 |
+
public function updateContact($contactId, $data)
|
333 |
+
{
|
334 |
+
$url = self::REST_CONTACTS . $contactId;
|
335 |
+
$this->setUrl($url)
|
336 |
+
->setVerb('PUT')
|
337 |
+
->buildPostBody($data);
|
338 |
+
|
339 |
+
$response = $this->execute();
|
340 |
+
if(isset($response->message)){
|
341 |
+
Mage::helper('connector')->log('ERROR : UPDATE SINGLE CONTACT : ' . $url . ' message : ' . $response->message);
|
342 |
+
Mage::helper('connector')->log($data);
|
343 |
+
}
|
344 |
+
|
345 |
+
return $response;
|
346 |
+
}
|
347 |
+
|
348 |
+
/**
|
349 |
+
* Deletes a contact.
|
350 |
+
* @param $contactId
|
351 |
+
* @return null
|
352 |
+
*/
|
353 |
+
public function DeleteContact($contactId)
|
354 |
+
{
|
355 |
+
$url = self::REST_CONTACTS . $contactId;
|
356 |
+
$this->setUrl($url)
|
357 |
+
->setVerb('DELETE');
|
358 |
+
|
359 |
+
$response = $this->execute();
|
360 |
+
|
361 |
+
if (isset($response->message)) {
|
362 |
+
Mage::helper('connector')->log('DELETE CONTACT : ' . $url . ', ' . $response->message);
|
363 |
+
}
|
364 |
+
return $response;
|
365 |
+
}
|
366 |
+
|
367 |
+
public function updateContactDatafieldsByEmail($email, $dataFields)
|
368 |
+
{
|
369 |
+
$contactId = $this->postContacts($email)->id;
|
370 |
+
$data = array(
|
371 |
+
'Email' => $email,
|
372 |
+
'EmailType' => 'Html');
|
373 |
+
$data['DataFields'] = $dataFields;
|
374 |
+
$url = self::REST_CONTACTS . $contactId;
|
375 |
+
$this->setUrl($url)
|
376 |
+
->setVerb('PUT')
|
377 |
+
->buildPostBody($data);
|
378 |
+
$response = $this->execute();
|
379 |
+
if (isset($response->message)) {
|
380 |
+
Mage::helper('connector')->log('ERROR: UPDATE CONTACT DATAFIELD ' . $url . ' message : ' . $response->message);
|
381 |
+
Mage::helper('connector')->log($data);
|
382 |
+
}
|
383 |
+
|
384 |
+
return $response;
|
385 |
+
}
|
386 |
+
|
387 |
+
/**
|
388 |
+
* Sends a specified campaign to one or more address books, segments or contacts at a specified time.
|
389 |
+
* Leave the address book array empty to send to All Contacts.
|
390 |
+
* @param $campaignId
|
391 |
+
* @param $contacts
|
392 |
+
* @return mixed
|
393 |
+
*/
|
394 |
+
public function postCampaignsSend($campaignId, $contacts)
|
395 |
+
{
|
396 |
+
$helper = Mage::helper('connector');
|
397 |
+
$data = array(
|
398 |
+
'username' => $this->getApiUsername(),
|
399 |
+
'password' => $this->getApiPassword(),
|
400 |
+
"campaignId" => $campaignId,
|
401 |
+
"ContactIds" => $contacts
|
402 |
+
);
|
403 |
+
$this->setUrl(self::REST_CAMPAIGN_SEND)
|
404 |
+
->setVerb('POST')
|
405 |
+
->buildPostBody($data);
|
406 |
+
|
407 |
+
$response = $this->execute();
|
408 |
+
if (isset($response->message)) {
|
409 |
+
$helper->log('SENDING CAMPAIGN ' . $response->message);
|
410 |
+
$helper->log($data);
|
411 |
+
}
|
412 |
+
|
413 |
+
return $response;
|
414 |
+
}
|
415 |
+
|
416 |
+
/**
|
417 |
+
* Creates a contact.
|
418 |
+
* @param $email
|
419 |
+
* @return mixed
|
420 |
+
*/
|
421 |
+
public function postContacts($email)
|
422 |
+
{
|
423 |
+
$url = self::REST_CONTACTS;
|
424 |
+
$data = array(
|
425 |
+
'Email' => $email,
|
426 |
+
'EmailType' => 'Html',
|
427 |
+
);
|
428 |
+
$this->setUrl($url)
|
429 |
+
->setVerb('POST')
|
430 |
+
->buildPostBody($data);
|
431 |
+
|
432 |
+
$response = $this->execute();
|
433 |
+
if (isset($response->message)) {
|
434 |
+
Mage::helper('connector')->log('CREATE A NEW CONTACT : ' . $email . ' , url ' . $url . ', ' . $response->message);
|
435 |
+
}
|
436 |
+
|
437 |
+
return $response;
|
438 |
+
}
|
439 |
+
|
440 |
+
/**
|
441 |
+
* @param $testEmail
|
442 |
+
* @param $contactId
|
443 |
+
* @param $campaignId
|
444 |
+
*/
|
445 |
+
public function sendIntallInfo($testEmail, $contactId, $campaignId)
|
446 |
+
{
|
447 |
+
$helper = Mage::helper('connector');
|
448 |
+
$productSize= Mage::getModel('catalog/product')->getCollection()->getSize();
|
449 |
+
$customerSize = Mage::getModel('customer/customer')->getCollection()->getSize();
|
450 |
+
|
451 |
+
$data = array(
|
452 |
+
'Email' => $testEmail,
|
453 |
+
'EmailType' => 'Html',
|
454 |
+
'DataFields' => array(
|
455 |
+
array(
|
456 |
+
'Key' => 'INSTALLCUSTOMERS',
|
457 |
+
'Value' => (string)$customerSize),
|
458 |
+
array(
|
459 |
+
'Key' => 'INSTALLPRODUCTS',
|
460 |
+
'Value' => (string)$productSize),
|
461 |
+
array(
|
462 |
+
'Key' => 'INSTALLURL',
|
463 |
+
'Value' => Mage::getBaseUrl('web')),
|
464 |
+
array(
|
465 |
+
'Key' => 'INSTALLAPI',
|
466 |
+
'Value' => Mage::helper('connector')->getStringWebsiteApiAccounts()),
|
467 |
+
array(
|
468 |
+
'Key' => 'PHPMEMORY',
|
469 |
+
'Value' => ini_get('memory_limit') . ', Version = ' . $helper->getConnectorVersion()
|
470 |
+
)
|
471 |
+
)
|
472 |
+
);
|
473 |
+
$helper->log('SENDING INSTALL INFO DATA...', Zend_Log::INFO, 'api.log');
|
474 |
+
$helper->log($data);
|
475 |
+
/**
|
476 |
+
* Update data fields for a contact
|
477 |
+
*/
|
478 |
+
$this->updateContact($contactId, $data);
|
479 |
+
/**
|
480 |
+
* Send Install info campaign
|
481 |
+
*/
|
482 |
+
$this->postCampaignsSend($campaignId, array($contactId));
|
483 |
+
|
484 |
+
return;
|
485 |
+
}
|
486 |
+
|
487 |
+
|
488 |
+
/**
|
489 |
+
* Gets a list of suppressed contacts after a given date along with the reason for suppression.
|
490 |
+
* @param $dateString
|
491 |
+
* @param $select
|
492 |
+
* @param $skip
|
493 |
+
* @return object
|
494 |
+
*/
|
495 |
+
public function getContactsSuppressedSinceDate($dateString, $select = 1000, $skip = 0)
|
496 |
+
{
|
497 |
+
$url = self::REST_CONTACTS_SUPPRESSED_SINCE . $dateString . '?select=' . $select . '&skip=' . $skip;
|
498 |
+
|
499 |
+
$this->setUrl($url)
|
500 |
+
->setVerb("GET");
|
501 |
+
|
502 |
+
$response = $this->execute();
|
503 |
+
if (isset($response->message))
|
504 |
+
Mage::helper('connector')->log('GET CONTACTS SUPPRESSED SINSE : ' . $dateString . ' select ' . $select . ' skip : ' . $skip . ' response : ' . $response->message);
|
505 |
+
|
506 |
+
return $response;
|
507 |
+
}
|
508 |
+
|
509 |
+
/**
|
510 |
+
* Adds multiple pieces of transactional data to contacts asynchronously, returning an identifier that can be used to check for import progress.
|
511 |
+
* @param $collectionName
|
512 |
+
* @param $transactionalData
|
513 |
+
* @return object
|
514 |
+
*/
|
515 |
+
public function postContactsTransactionalDataImport($transactionalData, $collectionName = 'Orders')
|
516 |
+
{
|
517 |
+
$orders = array();
|
518 |
+
foreach ($transactionalData as $one) {
|
519 |
+
if (isset($one->email)) {
|
520 |
+
$orders[] = array(
|
521 |
+
'Key' => $one->id,
|
522 |
+
'ContactIdentifier' => $one->email,
|
523 |
+
'Json' => json_encode($one->expose())
|
524 |
+
);
|
525 |
+
}
|
526 |
+
}
|
527 |
+
$url = self::REST_TRANSACTIONAL_DATA_IMPORT . $collectionName;
|
528 |
+
$this->setURl($url)
|
529 |
+
->setVerb('POST')
|
530 |
+
->buildPostBody($orders);
|
531 |
+
|
532 |
+
$result = $this->execute();
|
533 |
+
|
534 |
+
if (isset($result->message)) {
|
535 |
+
Mage::helper('connector')->log(' SEND MULTI TRANSACTIONAL DATA ' . $result->message);
|
536 |
+
}
|
537 |
+
|
538 |
+
return $result;
|
539 |
+
}
|
540 |
+
|
541 |
+
/**
|
542 |
+
* Adds a single piece of transactional data to a contact.
|
543 |
+
*
|
544 |
+
* @param $data
|
545 |
+
* @param string $name
|
546 |
+
* @return null
|
547 |
+
*/
|
548 |
+
public function postContactsTransactionalData($data, $name = 'Orders')
|
549 |
+
{
|
550 |
+
$getData = $this->getContactsTransactionalDataByKey($name, $data->id);
|
551 |
+
if(isset($getData->message) && $getData->message == self::REST_TRANSACTIONAL_DATA_NOT_EXISTS){
|
552 |
+
$url = self::REST_TRANSACTIONAL_DATA . $name;
|
553 |
+
}else{
|
554 |
+
$url = self::REST_TRANSACTIONAL_DATA . $name . '/' . $getData->key ;
|
555 |
+
}
|
556 |
+
$apiData = array(
|
557 |
+
'Key' => $data->id,
|
558 |
+
'ContactIdentifier' => $data->connector_id,
|
559 |
+
'Json' => json_encode($data->expose())
|
560 |
+
);
|
561 |
+
|
562 |
+
$this->setUrl($url)
|
563 |
+
->setVerb('POST')
|
564 |
+
->buildPostBody($apiData);
|
565 |
+
$response = $this->execute();
|
566 |
+
if(isset($response->message)){
|
567 |
+
Mage::helper('connector')->log('POST CONTACTS TRANSACTIONAL DATA ' . $response->message);
|
568 |
+
Mage::helper('connector')->log($apiData);
|
569 |
+
}
|
570 |
+
|
571 |
+
return $response;
|
572 |
+
}
|
573 |
+
|
574 |
+
/**
|
575 |
+
* Gets a piece of transactional data by key.
|
576 |
+
* @param $name
|
577 |
+
* @param $key
|
578 |
+
* @return null
|
579 |
+
*/
|
580 |
+
public function getContactsTransactionalDataByKey($name, $key)
|
581 |
+
{
|
582 |
+
$url = self::REST_TRANSACTIONAL_DATA . $name . '/' . $key;
|
583 |
+
$this->setUrl($url)
|
584 |
+
->setVerb('GET');
|
585 |
+
$response = $this->execute();
|
586 |
+
if (isset($response->message))
|
587 |
+
Mage::helper('connector')->log('GET CONTACTS TRANSACTIONAL DATA name: ' . $name . ' key: ' . $key . ' ' . $response->message);
|
588 |
+
|
589 |
+
return $response;
|
590 |
+
}
|
591 |
+
|
592 |
+
/**
|
593 |
+
* Deletes all transactional data for a contact.
|
594 |
+
* @param $email
|
595 |
+
* @param string $collectionName
|
596 |
+
* @return object
|
597 |
+
*/
|
598 |
+
public function deleteContactTransactionalData($email, $collectionName = 'Orders')
|
599 |
+
{
|
600 |
+
$url = 'https://apiconnector.com/v2/contacts/' . $email . '/transactional-data/' . $collectionName ;
|
601 |
+
$this->setUrl($url)
|
602 |
+
->setVerb('DELETE');
|
603 |
+
$response = $this->execute();
|
604 |
+
if (isset($response->message))
|
605 |
+
Mage::helper('connector')->log('DELETE CONTACT TRANSACTIONAL DATA : ' . $url . ' ' . $response->message);
|
606 |
+
|
607 |
+
return $response;
|
608 |
+
}
|
609 |
+
|
610 |
+
/**
|
611 |
+
* Gets a summary of information about the current status of the account.
|
612 |
+
* @return mixed
|
613 |
+
*/
|
614 |
+
public function getAccountInfo()
|
615 |
+
{
|
616 |
+
$url = self::REST_ACCOUNT_INFO;
|
617 |
+
$this->setUrl($url)
|
618 |
+
->setVerb('GET');
|
619 |
+
$response = $this->execute();
|
620 |
+
|
621 |
+
if (isset($response->message)) {
|
622 |
+
Mage::helper('connector')->log('GET ACCOUNT INFO for api user : ' . $this->getApiUsername() . ' ' . $response->message);
|
623 |
+
}
|
624 |
+
|
625 |
+
return $response;
|
626 |
+
}
|
627 |
+
|
628 |
+
/**
|
629 |
+
* Send a single SMS message.
|
630 |
+
* @param $telephoneNumber
|
631 |
+
* @param $message
|
632 |
+
* @return object
|
633 |
+
*/
|
634 |
+
public function postSmsMessagesSendTo($telephoneNumber, $message)
|
635 |
+
{
|
636 |
+
$data = array('Message' => $message);
|
637 |
+
$url = self::REST_SMS_MESSAGE_SEND_TO . $telephoneNumber;
|
638 |
+
$this->setUrl($url)
|
639 |
+
->setVerb('POST')
|
640 |
+
->buildPostBody($data);
|
641 |
+
$response = $this->execute();
|
642 |
+
if (isset($response->message))
|
643 |
+
Mage::helper('connector')->log('POST SMS MESSAGE SEND to ' . $telephoneNumber . ' message: ' . $message . ' error: ' . $response->message);
|
644 |
+
|
645 |
+
return $response;
|
646 |
+
}
|
647 |
+
|
648 |
+
|
649 |
+
/**
|
650 |
+
* Deletes multiple contacts from an address book
|
651 |
+
* @param $addressBookId
|
652 |
+
* @param $contactIds
|
653 |
+
* @return object
|
654 |
+
*/
|
655 |
+
public function deleteAddressBookContactsInbulk($addressBookId, $contactIds)
|
656 |
+
{
|
657 |
+
$url = 'https://apiconnector.com/v2/address-books/' . $addressBookId . '/contacts/inbulk';
|
658 |
+
$data = array('ContactIds' => array($contactIds[0]));
|
659 |
+
$this->setUrl($url)
|
660 |
+
->setVerb('DELETE')
|
661 |
+
->buildPostBody($data);
|
662 |
+
|
663 |
+
$result = $this->execute();
|
664 |
+
if (isset($result->message)) {
|
665 |
+
Mage::helper('connector')->log('DELETE BULK ADDRESS BOOK CONTACTS ' . $result->message . ' address book ' . $addressBookId);
|
666 |
+
}
|
667 |
+
return $result;
|
668 |
+
}
|
669 |
+
|
670 |
+
/**
|
671 |
+
* Resubscribes a previously unsubscribed contact.
|
672 |
+
*
|
673 |
+
* @param $apiContact
|
674 |
+
*/
|
675 |
+
public function PostContactsResubscribe($apiContact)
|
676 |
+
{
|
677 |
+
$url = self::REST_CONTACTS_RESUBSCRIBE;
|
678 |
+
$data = array(
|
679 |
+
'UnsubscribedContact' => $apiContact
|
680 |
+
);
|
681 |
+
$this->setUrl($url)
|
682 |
+
->setVerb("POST")
|
683 |
+
->buildPostBody($data);
|
684 |
+
|
685 |
+
$response = $this->execute();
|
686 |
+
if (isset($response->message)) {
|
687 |
+
Mage::helper('connector')->log('Resubscribe : ' . $url . ', message :' . $response->message);
|
688 |
+
Mage::helper('connector')->log($data);
|
689 |
+
}
|
690 |
+
}
|
691 |
+
}
|
@@ -0,0 +1,362 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Model_Apiconnector_Contact
|
4 |
+
{
|
5 |
+
private $_start;
|
6 |
+
private $_countCustomers;
|
7 |
+
private $_wishlists;
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Contact sync.
|
11 |
+
*
|
12 |
+
* @return array
|
13 |
+
*/
|
14 |
+
public function sync()
|
15 |
+
{
|
16 |
+
$result = array('error' => false, 'message' => "Done.");
|
17 |
+
/** @var Dotdigitalgroup_Email_Helper_Data $helper */
|
18 |
+
$helper = Mage::helper('connector');
|
19 |
+
$helper->log('---------- Start customer sync ----------');
|
20 |
+
$this->_start = microtime(true);
|
21 |
+
//resourse allocation
|
22 |
+
$helper->allowResourceFullExecution();
|
23 |
+
foreach (Mage::app()->getWebsites(true) as $website) {
|
24 |
+
$enabled = Mage::helper('connector')->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_API_ENABLED, $website);
|
25 |
+
$sync = Mage::helper('connector')->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_SYNC_CONTACT_ENABLED, $website);
|
26 |
+
if ($enabled && $sync)
|
27 |
+
$this->exportCustomersForWebsite($website);
|
28 |
+
}
|
29 |
+
$helper->log('Total time for sync : ' . gmdate("H:i:s", microtime(true) - $this->_start));
|
30 |
+
|
31 |
+
return $result;
|
32 |
+
}
|
33 |
+
|
34 |
+
public function exportCustomersForWebsite(Mage_Core_Model_Website $website){
|
35 |
+
$updated = 0;
|
36 |
+
$customers = $headers = $allMappedHash = array();
|
37 |
+
$helper = Mage::helper('connector');
|
38 |
+
$pageSize = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_SYNC_LIMIT, $website);
|
39 |
+
//skip if the mapping field is missing
|
40 |
+
if(!$helper->getCustomerAddressBook($website))
|
41 |
+
return;
|
42 |
+
//reset wishlists
|
43 |
+
$this->_wishlists = array();
|
44 |
+
$fileHelper = Mage::helper('connector/file');
|
45 |
+
$contactModel = Mage::getModel('email_connector/contact');
|
46 |
+
$client = Mage::helper('connector')->getWebsiteApiClient($website);
|
47 |
+
$contacts = $contactModel->getContactsToImportForWebsite($website->getId(), $pageSize);
|
48 |
+
|
49 |
+
// no contacts for this webiste
|
50 |
+
if (!count($contacts))
|
51 |
+
return;
|
52 |
+
//create customer filename
|
53 |
+
$customersFile = strtolower($website->getCode() . '_customers_' . date('d_m_Y_Hi') . '.csv');
|
54 |
+
$helper->log('Customers file : ' . $customersFile);
|
55 |
+
|
56 |
+
//get customer ids
|
57 |
+
$customerIds = array();
|
58 |
+
foreach ($contacts as $contact) {
|
59 |
+
$customerIds[] = $contact->getCustomerId();
|
60 |
+
}
|
61 |
+
//customer collection
|
62 |
+
$customerCollection = $this->getCollection($customerIds);
|
63 |
+
|
64 |
+
/**
|
65 |
+
* HEADERS.
|
66 |
+
*/
|
67 |
+
$mappedHash = $fileHelper->getWebsiteCustomerMappingDatafields($website);
|
68 |
+
$headers = $mappedHash;
|
69 |
+
//custom customer attributes
|
70 |
+
$customAttributes = $helper->getCustomAttributes($website);
|
71 |
+
foreach ($customAttributes as $data) {
|
72 |
+
$headers[] = $data['datafield'];
|
73 |
+
$allMappedHash[$data['attribute']] = $data['datafield'];
|
74 |
+
}
|
75 |
+
$headers[] = 'Email';
|
76 |
+
$headers[] = 'EmailType';
|
77 |
+
$fileHelper->outputCSV($fileHelper->getFilePath($customersFile), $headers);
|
78 |
+
/**
|
79 |
+
* END HEADERS.
|
80 |
+
*/
|
81 |
+
|
82 |
+
|
83 |
+
foreach ($customerCollection as $customer) {
|
84 |
+
$contactModel = Mage::getModel('email_connector/contact')->loadByCustomerId($customer->getId());
|
85 |
+
//skip contacts without customer id
|
86 |
+
if(!$contactModel->getId())
|
87 |
+
continue;
|
88 |
+
/**
|
89 |
+
* DATA.
|
90 |
+
*/
|
91 |
+
$connectorCustomer = Mage::getModel('email_connector/apiconnector_customer', $mappedHash);
|
92 |
+
$connectorCustomer->setCustomerData($customer);
|
93 |
+
//count number of customers
|
94 |
+
$customers[] = $connectorCustomer;
|
95 |
+
foreach ($customAttributes as $data) {
|
96 |
+
$attribute = $data['attribute'];
|
97 |
+
$value = $customer->getData($attribute);
|
98 |
+
$connectorCustomer->setData($value);
|
99 |
+
}
|
100 |
+
//contact email and email type
|
101 |
+
$connectorCustomer->setData($customer->getEmail());
|
102 |
+
$connectorCustomer->setData('Html');
|
103 |
+
// save csv file data for customers
|
104 |
+
$fileHelper->outputCSV($fileHelper->getFilePath($customersFile), $connectorCustomer->toCSVArray());
|
105 |
+
|
106 |
+
/**
|
107 |
+
* END DATA.
|
108 |
+
*/
|
109 |
+
|
110 |
+
//mark the contact as imported
|
111 |
+
$contactModel->setEmailImported(Dotdigitalgroup_Email_Model_Contact::EMAIL_CONTACT_IMPORTED);
|
112 |
+
$subscriber = Mage::getModel('newsletter/subscriber')->loadByEmail($customer->getEmail());
|
113 |
+
if ($subscriber->isSubscribed()) {
|
114 |
+
$contactModel->setIsSubscriber(1)
|
115 |
+
->setSubscriberStatus($subscriber->getSubscriberStatus());
|
116 |
+
}
|
117 |
+
|
118 |
+
$contactModel->save();
|
119 |
+
|
120 |
+
//Send wishlist as transactional data
|
121 |
+
if ($helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_SYNC_WISHLIST_ENABLED, $website)) {
|
122 |
+
$this->_setCustomerWishList($customer, $website);
|
123 |
+
}
|
124 |
+
$updated++;
|
125 |
+
}
|
126 |
+
//send wishlist as transactional data
|
127 |
+
if (isset($this->_wishlists[$website->getId()])) {
|
128 |
+
//send wishlists as transactional data
|
129 |
+
$websiteWishlists = $this->_wishlists[$website->getId()];
|
130 |
+
//remove wishlists one by one
|
131 |
+
foreach ($websiteWishlists as $wishlist) {
|
132 |
+
$email = $wishlist->email;
|
133 |
+
$client->deleteContactTransactionalData($email, 'Wishlist');
|
134 |
+
}
|
135 |
+
//import wishlists in bulk
|
136 |
+
$client->postContactsTransactionalDataImport($websiteWishlists, 'Wishlist');
|
137 |
+
}
|
138 |
+
|
139 |
+
$helper->log('Website : ' . $website->getName() . ', customers = ' . count($customers));
|
140 |
+
$helper->log('---------------------------- execution time :' . gmdate("H:i:s", microtime(true) - $this->_start));
|
141 |
+
|
142 |
+
if (file_exists($fileHelper->getFilePath($customersFile))) {
|
143 |
+
//import contacts
|
144 |
+
if ($updated > 0)
|
145 |
+
$client->postAddressBookContactsImport($customersFile, $helper->getCustomerAddressBook($website));
|
146 |
+
//archive file on success
|
147 |
+
$fileHelper->archiveCSV($customersFile);
|
148 |
+
}
|
149 |
+
$this->_countCustomers += $updated;
|
150 |
+
return;
|
151 |
+
}
|
152 |
+
|
153 |
+
/**
|
154 |
+
* @param $customer
|
155 |
+
* @param $website
|
156 |
+
*/
|
157 |
+
private function _setCustomerWishList($customer, $website){
|
158 |
+
$website = Mage::app()->getWebsite($website);
|
159 |
+
$customerId = $customer->getId();
|
160 |
+
$wishlist = Mage::getModel('wishlist/wishlist')->loadByCustomer($customerId);
|
161 |
+
/** @var $connectorWishlist */
|
162 |
+
$connectorWishlist = Mage::getModel('email_connector/customer_wishlist', $customer);
|
163 |
+
$connectorWishlist->setId($wishlist->getId());
|
164 |
+
$wishListItemCollection = $wishlist->getItemCollection();
|
165 |
+
if (count($wishListItemCollection)) {
|
166 |
+
foreach ($wishListItemCollection as $item) {
|
167 |
+
/* @var $product Mage_Catalog_Model_Product */
|
168 |
+
$product = $item->getProduct();
|
169 |
+
$wishlistItem = Mage::getModel('email_connector/customer_wishlist_item', $product)
|
170 |
+
->setQty($item->getQty())
|
171 |
+
->setPrice($product);
|
172 |
+
//store for wishlists
|
173 |
+
$connectorWishlist->setItem($wishlistItem);
|
174 |
+
}
|
175 |
+
//set wishlists for later use
|
176 |
+
$this->_wishlists[$website->getId()][] = $connectorWishlist;
|
177 |
+
}
|
178 |
+
}
|
179 |
+
|
180 |
+
/**
|
181 |
+
* Sync a single contact.
|
182 |
+
*
|
183 |
+
* @param null $contactId
|
184 |
+
*
|
185 |
+
* @return mixed
|
186 |
+
* @throws Mage_Core_Exception
|
187 |
+
*/
|
188 |
+
public function syncContact($contactId = null)
|
189 |
+
{
|
190 |
+
if ($contactId)
|
191 |
+
$contact = Mage::getModel('email_connector/contact')->load($contactId);
|
192 |
+
else {
|
193 |
+
$contact = Mage::registry('current_contact');
|
194 |
+
}
|
195 |
+
if (! $contact->getId()) {
|
196 |
+
Mage::getSingleton('adminhtml/session')->addError('No contact found!');
|
197 |
+
return false;
|
198 |
+
}
|
199 |
+
|
200 |
+
$websiteId = $contact->getWebsiteId();
|
201 |
+
$website = Mage::app()->getWebsite($websiteId);
|
202 |
+
$updated = 0;
|
203 |
+
$customers = $headers = $allMappedHash = array();
|
204 |
+
$helper = Mage::helper('connector');
|
205 |
+
$helper->log('---------- Start single customer sync ----------');
|
206 |
+
//skip if the mapping field is missing
|
207 |
+
if(!$helper->getCustomerAddressBook($website))
|
208 |
+
return false;
|
209 |
+
//reset wishlists
|
210 |
+
$this->_wishlists = array();
|
211 |
+
$fileHelper = Mage::helper('connector/file');
|
212 |
+
|
213 |
+
$customerId = $contact->getCustomerId();
|
214 |
+
if (!$customerId) {
|
215 |
+
Mage::getSingleton('adminhtml/session')->addError('Cannot manually sync guests!');
|
216 |
+
return false;
|
217 |
+
}
|
218 |
+
$client = Mage::helper('connector')->getWebsiteApiClient($website);
|
219 |
+
|
220 |
+
//create customer filename
|
221 |
+
$customersFile = strtolower($website->getCode() . '_customers_' . date('d_m_Y_Hi') . '.csv');
|
222 |
+
$helper->log('Customers file : ' . $customersFile);
|
223 |
+
|
224 |
+
/**
|
225 |
+
* HEADERS.
|
226 |
+
*/
|
227 |
+
$mappedHash = $fileHelper->getWebsiteCustomerMappingDatafields($website);
|
228 |
+
$headers = $mappedHash;
|
229 |
+
//custom customer attributes
|
230 |
+
$customAttributes = $helper->getCustomAttributes($website);
|
231 |
+
foreach ($customAttributes as $data) {
|
232 |
+
$headers[] = $data['datafield'];
|
233 |
+
$allMappedHash[$data['attribute']] = $data['datafield'];
|
234 |
+
}
|
235 |
+
$headers[] = 'Email';
|
236 |
+
$headers[] = 'EmailType';
|
237 |
+
$fileHelper->outputCSV($fileHelper->getFilePath($customersFile), $headers);
|
238 |
+
/**
|
239 |
+
* END HEADERS.
|
240 |
+
*/
|
241 |
+
$customerCollection = $this->getCollection(array($customerId));
|
242 |
+
|
243 |
+
foreach ($customerCollection as $customer) {
|
244 |
+
$contactModel = Mage::getModel('email_connector/contact')->loadByCustomerId($customer->getId());
|
245 |
+
//skip contacts without customer id
|
246 |
+
if (!$contactModel->getId())
|
247 |
+
continue;
|
248 |
+
/**
|
249 |
+
* DATA.
|
250 |
+
*/
|
251 |
+
$connectorCustomer = Mage::getModel('email_connector/apiconnector_customer', $mappedHash);
|
252 |
+
$connectorCustomer->setCustomerData($customer);
|
253 |
+
//count number of customers
|
254 |
+
$customers[] = $connectorCustomer;
|
255 |
+
foreach ($customAttributes as $data) {
|
256 |
+
$attribute = $data['attribute'];
|
257 |
+
$value = $customer->getData($attribute);
|
258 |
+
$connectorCustomer->setData($value);
|
259 |
+
}
|
260 |
+
//contact email and email type
|
261 |
+
$connectorCustomer->setData($customer->getEmail());
|
262 |
+
$connectorCustomer->setData('Html');
|
263 |
+
// save csv file data for customers
|
264 |
+
$fileHelper->outputCSV($fileHelper->getFilePath($customersFile), $connectorCustomer->toCSVArray());
|
265 |
+
|
266 |
+
/**
|
267 |
+
* END DATA.
|
268 |
+
*/
|
269 |
+
|
270 |
+
//mark the contact as imported
|
271 |
+
$contactModel->setEmailImported(Dotdigitalgroup_Email_Model_Contact::EMAIL_CONTACT_IMPORTED);
|
272 |
+
$subscriber = Mage::getModel('newsletter/subscriber')->loadByEmail($customer->getEmail());
|
273 |
+
if ($subscriber->isSubscribed()) {
|
274 |
+
$contactModel->setIsSubscriber(1)
|
275 |
+
->setSubscriberStatus($subscriber->getSubscriberStatus());
|
276 |
+
}
|
277 |
+
|
278 |
+
$contactModel->save();
|
279 |
+
|
280 |
+
//Send wishlist as transactional data
|
281 |
+
if ($helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_SYNC_WISHLIST_ENABLED, $website)) {
|
282 |
+
$this->_setCustomerWishList($customer, $website);
|
283 |
+
}
|
284 |
+
$updated++;
|
285 |
+
}
|
286 |
+
//send wishlist as transactional data
|
287 |
+
if (isset($this->_wishlists[$website->getId()])) {
|
288 |
+
//send wishlists as transactional data
|
289 |
+
$websiteWishlists = $this->_wishlists[$website->getId()];
|
290 |
+
//remove wishlists one by one
|
291 |
+
foreach ($websiteWishlists as $wishlist) {
|
292 |
+
$email = $wishlist->email;
|
293 |
+
$client->deleteContactTransactionalData($email, 'Wishlist');
|
294 |
+
}
|
295 |
+
//import wishlists in bulk
|
296 |
+
$client->postContactsTransactionalDataImport($websiteWishlists, 'Wishlist');
|
297 |
+
}
|
298 |
+
|
299 |
+
if (file_exists($fileHelper->getFilePath($customersFile))) {
|
300 |
+
//import contacts
|
301 |
+
if ($updated > 0)
|
302 |
+
$client->postAddressBookContactsImport($customersFile, $helper->getCustomerAddressBook($website));
|
303 |
+
//archive file on success
|
304 |
+
$fileHelper->archiveCSV($customersFile);
|
305 |
+
}
|
306 |
+
return $contact->getEmail();
|
307 |
+
}
|
308 |
+
|
309 |
+
|
310 |
+
/**
|
311 |
+
* get customer collection
|
312 |
+
* @param $customerIds
|
313 |
+
* @return Mage_Eav_Model_Entity_Collection_Abstract
|
314 |
+
* @throws Mage_Core_Exception
|
315 |
+
*/
|
316 |
+
public function getCollection($customerIds)
|
317 |
+
{
|
318 |
+
$customerCollection = Mage::getResourceModel('customer/customer_collection')
|
319 |
+
->addNameToSelect()
|
320 |
+
->addAttributeToSelect('*')
|
321 |
+
->joinAttribute('billing_street', 'customer_address/street', 'default_billing', null, 'left')
|
322 |
+
->joinAttribute('billing_city', 'customer_address/city', 'default_billing', null, 'left')
|
323 |
+
->joinAttribute('billing_country_code', 'customer_address/country_id', 'default_billing', null, 'left')
|
324 |
+
->joinAttribute('billing_postcode', 'customer_address/postcode', 'default_billing', null, 'left')
|
325 |
+
->joinAttribute('billing_telephone', 'customer_address/telephone', 'default_billing', null, 'left')
|
326 |
+
->joinAttribute('billing_region', 'customer_address/region', 'default_billing', null, 'left')
|
327 |
+
->joinAttribute('shipping_street', 'customer_address/street', 'default_shipping', null, 'left')
|
328 |
+
->joinAttribute('shipping_city', 'customer_address/city', 'default_shipping', null, 'left')
|
329 |
+
->joinAttribute('shipping_country_code','customer_address/country_id', 'default_shipping', null, 'left')
|
330 |
+
->joinAttribute('shipping_postcode', 'customer_address/postcode', 'default_shipping', null, 'left')
|
331 |
+
->joinAttribute('shipping_telephone', 'customer_address/telephone', 'default_shipping', null, 'left')
|
332 |
+
->joinAttribute('shipping_region', 'customer_address/region', 'default_shipping', null, 'left')
|
333 |
+
->addAttributeToFilter('entity_id', array('in' => $customerIds));
|
334 |
+
$customer_log = Mage::getSingleton('core/resource')->getTableName('log_customer');
|
335 |
+
$sales_flat_order_grid = Mage::getSingleton('core/resource')->getTableName('sales_flat_order_grid');
|
336 |
+
|
337 |
+
// get the last login date from the log_customer table
|
338 |
+
$customerCollection->getSelect()->columns(
|
339 |
+
array('last_logged_date' => new Zend_Db_Expr ("(SELECT login_at FROM $customer_log WHERE customer_id =e.entity_id ORDER BY log_id DESC LIMIT 1)")));
|
340 |
+
|
341 |
+
// customer order information
|
342 |
+
$alias = 'subselect';
|
343 |
+
$subselect = Mage::getModel('Varien_Db_Select', Mage::getSingleton('core/resource')->getConnection('core_read'))
|
344 |
+
->from($sales_flat_order_grid, array(
|
345 |
+
'customer_id as s_customer_id',
|
346 |
+
'sum(grand_total) as total_spend',
|
347 |
+
'count(*) as number_of_orders',
|
348 |
+
'avg(grand_total) as average_order_value',
|
349 |
+
)
|
350 |
+
)->group('customer_id')
|
351 |
+
;
|
352 |
+
$customerCollection->getSelect()->columns(array(
|
353 |
+
'last_order_date' => new Zend_Db_Expr("(SELECT created_at FROM $sales_flat_order_grid WHERE customer_id =e.entity_id ORDER BY created_at DESC LIMIT 1)"),
|
354 |
+
'last_order_id' => new Zend_Db_Expr("(SELECT entity_id FROM $sales_flat_order_grid WHERE customer_id =e.entity_id ORDER BY created_at DESC LIMIT 1)")
|
355 |
+
)
|
356 |
+
);
|
357 |
+
$customerCollection->getSelect()
|
358 |
+
->joinLeft(array($alias => $subselect), "{$alias}.s_customer_id = e.entity_id");
|
359 |
+
|
360 |
+
return $customerCollection;
|
361 |
+
}
|
362 |
+
}
|
@@ -0,0 +1,501 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Model_Apiconnector_Customer
|
4 |
+
{
|
5 |
+
|
6 |
+
public $customer;
|
7 |
+
public $customerData ;
|
8 |
+
|
9 |
+
protected $_mapping_hash;
|
10 |
+
|
11 |
+
|
12 |
+
/**
|
13 |
+
* constructor, mapping hash to map.
|
14 |
+
*
|
15 |
+
* @param $mappingHash
|
16 |
+
*/
|
17 |
+
public function __construct( $mappingHash)
|
18 |
+
{
|
19 |
+
$this->setMappigHash($mappingHash);
|
20 |
+
}
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Set key value data.
|
24 |
+
*
|
25 |
+
* @param $data
|
26 |
+
*/
|
27 |
+
public function setData($data)
|
28 |
+
{
|
29 |
+
$this->customerData[] = $data;
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Set customer data.
|
34 |
+
*
|
35 |
+
* @param Mage_Customer_Model_Customer $customer
|
36 |
+
*/
|
37 |
+
public function setCustomerData(Mage_Customer_Model_Customer $customer)
|
38 |
+
{
|
39 |
+
$this->customer = $customer;
|
40 |
+
|
41 |
+
foreach ($this->getMappingHash() as $key => $field) {
|
42 |
+
|
43 |
+
/**
|
44 |
+
* call user function based on the attribute mapped.
|
45 |
+
*/
|
46 |
+
$function = 'get';
|
47 |
+
$exploded = explode('_', $key);
|
48 |
+
foreach ($exploded as $one) {
|
49 |
+
$function .= ucfirst($one);
|
50 |
+
}
|
51 |
+
try{
|
52 |
+
$value = call_user_func(array('self', $function));
|
53 |
+
$this->customerData[$key] = $value;
|
54 |
+
}catch (Exception $e){
|
55 |
+
Mage::logException($e);
|
56 |
+
}
|
57 |
+
}
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* get customer id.
|
62 |
+
*
|
63 |
+
* @return mixed
|
64 |
+
*/
|
65 |
+
public function getCustomerId()
|
66 |
+
{
|
67 |
+
return $this->customer->getId();
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* get first name.
|
72 |
+
*
|
73 |
+
* @return mixed
|
74 |
+
*/
|
75 |
+
public function getFirstname(){
|
76 |
+
return $this->customer->getFirstname();
|
77 |
+
}
|
78 |
+
|
79 |
+
/**
|
80 |
+
* get last name.
|
81 |
+
*
|
82 |
+
* @return mixed
|
83 |
+
*/
|
84 |
+
public function getLastname()
|
85 |
+
{
|
86 |
+
return $this->customer->getLastname();
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* get date of birth.
|
91 |
+
*
|
92 |
+
* @return mixed
|
93 |
+
*/
|
94 |
+
public function getDob()
|
95 |
+
{
|
96 |
+
return $this->customer->getDob();
|
97 |
+
}
|
98 |
+
|
99 |
+
/**
|
100 |
+
* get customer gender.
|
101 |
+
*
|
102 |
+
* @return bool|string
|
103 |
+
*/
|
104 |
+
public function getGender(){
|
105 |
+
return $this->_getCustomerGender();
|
106 |
+
}
|
107 |
+
|
108 |
+
/**
|
109 |
+
* get customer prefix.
|
110 |
+
*
|
111 |
+
* @return mixed
|
112 |
+
*/
|
113 |
+
public function getPrefix()
|
114 |
+
{
|
115 |
+
return $this->customer->getPrefix();
|
116 |
+
}
|
117 |
+
|
118 |
+
/**
|
119 |
+
* get customer suffix.
|
120 |
+
*
|
121 |
+
* @return mixed
|
122 |
+
*/
|
123 |
+
public function getSuffix()
|
124 |
+
{
|
125 |
+
return $this->customer->getSuffix();
|
126 |
+
}
|
127 |
+
|
128 |
+
/**
|
129 |
+
* get website name.
|
130 |
+
*
|
131 |
+
* @return string
|
132 |
+
*/
|
133 |
+
public function getWebsiteName()
|
134 |
+
{
|
135 |
+
return $this->_getWebsiteName();
|
136 |
+
}
|
137 |
+
|
138 |
+
/**
|
139 |
+
* get store name.
|
140 |
+
*
|
141 |
+
* @return null|string
|
142 |
+
*/
|
143 |
+
public function getStoreName()
|
144 |
+
{
|
145 |
+
return $this->_getStoreName();
|
146 |
+
}
|
147 |
+
|
148 |
+
/**
|
149 |
+
* get customer created at date.
|
150 |
+
*
|
151 |
+
* @return mixed
|
152 |
+
*/
|
153 |
+
public function getCreatedAt()
|
154 |
+
{
|
155 |
+
return $this->customer->getCreatedAt();
|
156 |
+
}
|
157 |
+
|
158 |
+
/**
|
159 |
+
* get customer last logged in date.
|
160 |
+
*
|
161 |
+
* @return mixed
|
162 |
+
*/
|
163 |
+
public function getLastLoggedDate()
|
164 |
+
{
|
165 |
+
return $this->customer->getLastLoggedDate();
|
166 |
+
}
|
167 |
+
|
168 |
+
/**
|
169 |
+
* get cutomer group.
|
170 |
+
*
|
171 |
+
* @return string
|
172 |
+
*/
|
173 |
+
public function getCustomerGroup()
|
174 |
+
{
|
175 |
+
return $this->_getCustomerGroup();
|
176 |
+
}
|
177 |
+
|
178 |
+
/**
|
179 |
+
* get billing address line 1.
|
180 |
+
*
|
181 |
+
* @return string
|
182 |
+
*/
|
183 |
+
public function getBillingAddress1()
|
184 |
+
{
|
185 |
+
return $this->_getStreet($this->customer->getBillingStreet(), 1);
|
186 |
+
}
|
187 |
+
|
188 |
+
/**
|
189 |
+
* get billing address line 2.
|
190 |
+
*
|
191 |
+
* @return string
|
192 |
+
*/
|
193 |
+
public function getBillingAddress2()
|
194 |
+
{
|
195 |
+
return $this->_getStreet($this->customer->getBillingStreet(), 2);
|
196 |
+
}
|
197 |
+
|
198 |
+
/**
|
199 |
+
* get billing city.
|
200 |
+
*
|
201 |
+
* @return mixed
|
202 |
+
*/
|
203 |
+
public function getBillingCity()
|
204 |
+
{
|
205 |
+
return $this->customer->getBillingCity();
|
206 |
+
}
|
207 |
+
|
208 |
+
/**
|
209 |
+
* get billing country.
|
210 |
+
*
|
211 |
+
* @return mixed
|
212 |
+
*/
|
213 |
+
public function getBillingCountry()
|
214 |
+
{
|
215 |
+
return $this->customer->getBillingCountryCode();
|
216 |
+
}
|
217 |
+
|
218 |
+
/**
|
219 |
+
* get billing state.
|
220 |
+
*
|
221 |
+
* @return mixed
|
222 |
+
*/
|
223 |
+
public function getBillingState()
|
224 |
+
{
|
225 |
+
return $this->customer->getBillingRegion();
|
226 |
+
}
|
227 |
+
|
228 |
+
/**
|
229 |
+
* get billing postcode.
|
230 |
+
*
|
231 |
+
* @return mixed
|
232 |
+
*/
|
233 |
+
public function getBillingPostcode()
|
234 |
+
{
|
235 |
+
return $this->customer->getBillingPostcode();
|
236 |
+
}
|
237 |
+
|
238 |
+
/**
|
239 |
+
* get billing phone.
|
240 |
+
*
|
241 |
+
* @return mixed
|
242 |
+
*/
|
243 |
+
public function getBillingTelephone()
|
244 |
+
{
|
245 |
+
return $this->customer->getBillingTelephone();
|
246 |
+
}
|
247 |
+
|
248 |
+
/**
|
249 |
+
* get delivery address line 1.
|
250 |
+
*
|
251 |
+
* @return string
|
252 |
+
*/
|
253 |
+
public function getDeliveryAddress1()
|
254 |
+
{
|
255 |
+
return $this->_getStreet($this->customer->getShippingStreet(), 1);
|
256 |
+
}
|
257 |
+
|
258 |
+
/**
|
259 |
+
* get delivery addrss line 2.
|
260 |
+
*
|
261 |
+
* @return string
|
262 |
+
*/
|
263 |
+
public function getDeliveryAddress2()
|
264 |
+
{
|
265 |
+
return $this->_getStreet($this->customer->getShippingStreet(), 2);
|
266 |
+
}
|
267 |
+
|
268 |
+
/**
|
269 |
+
* get delivery city.
|
270 |
+
*
|
271 |
+
* @return mixed
|
272 |
+
*/
|
273 |
+
public function getDeliveryCity()
|
274 |
+
{
|
275 |
+
return $this->customer->getShippingCity();
|
276 |
+
}
|
277 |
+
|
278 |
+
/**
|
279 |
+
* get delivery country.
|
280 |
+
*
|
281 |
+
* @return mixed
|
282 |
+
*/
|
283 |
+
public function getDeliveryCountry(){
|
284 |
+
return $this->customer->getShippingCountryCode();
|
285 |
+
}
|
286 |
+
|
287 |
+
/**
|
288 |
+
* get delivery state.
|
289 |
+
*
|
290 |
+
* @return mixed
|
291 |
+
*/
|
292 |
+
public function getDeliveryState()
|
293 |
+
{
|
294 |
+
return $this->customer->getShippingRegion();
|
295 |
+
}
|
296 |
+
|
297 |
+
/**
|
298 |
+
* get delivery postcode.
|
299 |
+
*
|
300 |
+
* @return mixed
|
301 |
+
*/
|
302 |
+
public function getDeliveryPostcode()
|
303 |
+
{
|
304 |
+
return $this->customer->getShippingPostcode();
|
305 |
+
}
|
306 |
+
|
307 |
+
/**
|
308 |
+
* get delivery phone.
|
309 |
+
*
|
310 |
+
* @return mixed
|
311 |
+
*/
|
312 |
+
public function getDeliveryTelephone(){
|
313 |
+
return $this->customer->getShippingTelephone();
|
314 |
+
}
|
315 |
+
|
316 |
+
/**
|
317 |
+
* get numbser of orders.
|
318 |
+
*
|
319 |
+
* @return mixed
|
320 |
+
*/
|
321 |
+
public function getNumberOfOrders()
|
322 |
+
{
|
323 |
+
return $this->customer->getNumberOfOrders();
|
324 |
+
}
|
325 |
+
|
326 |
+
/**
|
327 |
+
* get average order value.
|
328 |
+
*
|
329 |
+
* @return mixed
|
330 |
+
*/
|
331 |
+
public function getAverageOrderValue()
|
332 |
+
{
|
333 |
+
return $this->customer->getAverageOrderValue();
|
334 |
+
}
|
335 |
+
|
336 |
+
/**
|
337 |
+
* get total spend.
|
338 |
+
*
|
339 |
+
* @return mixed
|
340 |
+
*/
|
341 |
+
public function getTotalSpend()
|
342 |
+
{
|
343 |
+
return $this->customer->getTotalSpend();
|
344 |
+
}
|
345 |
+
|
346 |
+
/**
|
347 |
+
* get last order date.
|
348 |
+
*
|
349 |
+
* @return mixed
|
350 |
+
*/
|
351 |
+
public function getLastOrderDate()
|
352 |
+
{
|
353 |
+
return $this->customer->getLastOrderDate();
|
354 |
+
}
|
355 |
+
|
356 |
+
/**
|
357 |
+
* get last order date.
|
358 |
+
*
|
359 |
+
* @return mixed
|
360 |
+
*/
|
361 |
+
public function getLastOrderId()
|
362 |
+
{
|
363 |
+
return $this->customer->getLastOrderId();
|
364 |
+
}
|
365 |
+
|
366 |
+
/**
|
367 |
+
* get cutomer id.
|
368 |
+
*
|
369 |
+
* @return mixed
|
370 |
+
*/
|
371 |
+
public function getId()
|
372 |
+
{
|
373 |
+
return $this->customer->getId();
|
374 |
+
}
|
375 |
+
|
376 |
+
/**
|
377 |
+
* get customer title.
|
378 |
+
*
|
379 |
+
* @return mixed
|
380 |
+
*/
|
381 |
+
public function getTitle()
|
382 |
+
{
|
383 |
+
return $this->customer->getPrefix();
|
384 |
+
}
|
385 |
+
|
386 |
+
/**
|
387 |
+
* get total refund value.
|
388 |
+
*
|
389 |
+
* @return float|int
|
390 |
+
*/
|
391 |
+
public function getTotalRefund()
|
392 |
+
{
|
393 |
+
$orders = Mage::getResourceModel('sales/order_collection')
|
394 |
+
->addAttributeToFilter('customer_id', $this->customer->getId())
|
395 |
+
;
|
396 |
+
$totalRefunded = 0;
|
397 |
+
foreach ($orders as $order) {
|
398 |
+
$refunded = $order->getTotalRefunded();
|
399 |
+
$totalRefunded += $refunded;
|
400 |
+
}
|
401 |
+
|
402 |
+
return $totalRefunded;
|
403 |
+
}
|
404 |
+
|
405 |
+
/**
|
406 |
+
* export to CSV.
|
407 |
+
*
|
408 |
+
* @return mixed
|
409 |
+
*/
|
410 |
+
public function toCSVArray()
|
411 |
+
{
|
412 |
+
$result = $this->customerData;
|
413 |
+
return $result;
|
414 |
+
}
|
415 |
+
|
416 |
+
/**
|
417 |
+
* customer gender.
|
418 |
+
*
|
419 |
+
* @return bool|string
|
420 |
+
* @throws Mage_Core_Exception
|
421 |
+
*/
|
422 |
+
private function _getCustomerGender()
|
423 |
+
{
|
424 |
+
$genderId = $this->customer->getGender();
|
425 |
+
if (is_numeric($genderId)) {
|
426 |
+
$gender = Mage::getResourceModel('customer/customer')
|
427 |
+
->getAttribute('gender')
|
428 |
+
->getSource()
|
429 |
+
->getOptionText($genderId)
|
430 |
+
;
|
431 |
+
return $gender;
|
432 |
+
}
|
433 |
+
|
434 |
+
return '';
|
435 |
+
}
|
436 |
+
|
437 |
+
private function _getStreet($street, $line){
|
438 |
+
$street = explode("\n", $street);
|
439 |
+
if(isset($street[$line - 1]))
|
440 |
+
return $street[$line - 1];
|
441 |
+
return '';
|
442 |
+
}
|
443 |
+
|
444 |
+
private function _getWebsiteName(){
|
445 |
+
$websiteId = $this->customer->getWebsiteId();
|
446 |
+
$website = Mage::app()->getWebsite($websiteId);
|
447 |
+
if($website)
|
448 |
+
return $website->getName();
|
449 |
+
|
450 |
+
return '';
|
451 |
+
}
|
452 |
+
|
453 |
+
private function _getStoreName()
|
454 |
+
{
|
455 |
+
$storeId = $this->customer->getStoreId();
|
456 |
+
$store = Mage::app()->getStore($storeId);
|
457 |
+
if($store)
|
458 |
+
return $store->getName();
|
459 |
+
|
460 |
+
return '';
|
461 |
+
}
|
462 |
+
|
463 |
+
/**
|
464 |
+
* @param mixed $mapping_hash
|
465 |
+
*/
|
466 |
+
public function setMappingHash($mapping_hash)
|
467 |
+
{
|
468 |
+
$this->_mapping_hash = $mapping_hash;
|
469 |
+
}
|
470 |
+
|
471 |
+
/**
|
472 |
+
* @return mixed
|
473 |
+
*/
|
474 |
+
public function getMappingHash()
|
475 |
+
{
|
476 |
+
return $this->_mapping_hash;
|
477 |
+
}
|
478 |
+
|
479 |
+
private function _getCustomerGroup(){
|
480 |
+
$groupId = $this->customer->getGroupId();
|
481 |
+
$group = Mage::getModel('customer/group')->load($groupId);
|
482 |
+
if($group){
|
483 |
+
return $group->getCode();
|
484 |
+
}
|
485 |
+
return '';
|
486 |
+
}
|
487 |
+
|
488 |
+
/**
|
489 |
+
* mapping hash value.
|
490 |
+
*
|
491 |
+
* @param $value
|
492 |
+
*
|
493 |
+
* @return $this
|
494 |
+
*/
|
495 |
+
public function setMappigHash($value)
|
496 |
+
{
|
497 |
+
$this->_mapping_hash = $value;
|
498 |
+
return $this;
|
499 |
+
}
|
500 |
+
|
501 |
+
}
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Model_Apiconnector_Test extends Dotdigitalgroup_Email_Model_Apiconnector_Client
|
4 |
+
{
|
5 |
+
const TEST_API_USERNAME = 'apiuser-8e3b8f244ec9@apiconnector.com';
|
6 |
+
const TEST_API_PASSWORD = 'Magento2013';
|
7 |
+
const TEST_API_CAMPAIGN = '2643928';
|
8 |
+
const TEST_CONTACT_ID = '13';
|
9 |
+
const TEST_CONTACT_EMAIL = 'ben.staveley@dotmailer.co.uk';
|
10 |
+
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Validate apiuser on save.
|
14 |
+
*
|
15 |
+
* @param $apiUsername
|
16 |
+
* @param $apiPassword
|
17 |
+
*
|
18 |
+
* @return bool|mixed
|
19 |
+
*/
|
20 |
+
public function validate($apiUsername, $apiPassword)
|
21 |
+
{
|
22 |
+
if ($apiUsername && $apiPassword) {
|
23 |
+
$this->setApiUsername($apiUsername)
|
24 |
+
->setApiPassword($apiPassword);
|
25 |
+
|
26 |
+
$accountInfo = $this->getAccountInfo();
|
27 |
+
if (isset($accountInfo->message)) {
|
28 |
+
Mage::getSingleton('adminhtml/session')->addError($accountInfo->message);
|
29 |
+
Mage::helper('connector')->log('VALIDATION ERROR : ' . $accountInfo->message);
|
30 |
+
return false;
|
31 |
+
}
|
32 |
+
return $accountInfo;
|
33 |
+
}
|
34 |
+
return false;
|
35 |
+
}
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Ajax validate api user.
|
39 |
+
*
|
40 |
+
* @param $apiUsername
|
41 |
+
* @param $apiPassword
|
42 |
+
*
|
43 |
+
* @return bool|string
|
44 |
+
*/
|
45 |
+
public function ajaxvalidate($apiUsername, $apiPassword)
|
46 |
+
{
|
47 |
+
if ($apiUsername && $apiPassword) {
|
48 |
+
$message = 'Credentials Valid.';
|
49 |
+
$this->setApiUsername($apiUsername)
|
50 |
+
->setApiPassword($apiPassword);
|
51 |
+
$response = $this->getAccountInfo();
|
52 |
+
if (isset($response->message)) {
|
53 |
+
$message = 'API Username And API Password Do Not Match!';
|
54 |
+
Mage::helper('connector')->log($message);
|
55 |
+
}
|
56 |
+
return $message;
|
57 |
+
}
|
58 |
+
return false;
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Confirm the installation.
|
63 |
+
*/
|
64 |
+
public function sendInstallConfirmation()
|
65 |
+
{
|
66 |
+
// set test credentials
|
67 |
+
$this->setApiUsername(self::TEST_API_USERNAME)
|
68 |
+
->setApiPassword(self::TEST_API_PASSWORD);
|
69 |
+
$testEmail = self::TEST_CONTACT_EMAIL;
|
70 |
+
$contactId = self::TEST_CONTACT_ID;
|
71 |
+
$campaignId = self::TEST_API_CAMPAIGN;
|
72 |
+
|
73 |
+
/**
|
74 |
+
* send initial info
|
75 |
+
*/
|
76 |
+
$this->sendIntallInfo($testEmail, $contactId, $campaignId);
|
77 |
+
}
|
78 |
+
}
|
@@ -0,0 +1,232 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Model_Campaign extends Mage_Core_Model_Abstract
|
4 |
+
{
|
5 |
+
//xml path configuration
|
6 |
+
const XML_PATH_LOSTBASKET_1_ENABLED = 'connector_lost_baskets/customers/enabled_1';
|
7 |
+
const XML_PATH_LOSTBASKET_2_ENABLED = 'connector_lost_baskets/customers/enabled_2';
|
8 |
+
const XML_PATH_LOSTBASKET_3_ENABLED = 'connector_lost_baskets/customers/enabled_3';
|
9 |
+
|
10 |
+
const XML_PATH_LOSTBASKET_1_INTERVAL = 'connector_lost_baskets/customers/send_after_1';
|
11 |
+
const XML_PATH_LOSTBASKET_2_INTERVAL = 'connector_lost_baskets/customers/send_after_2';
|
12 |
+
const XML_PATH_LOSTBASKET_3_INTERVAL = 'connector_lost_baskets/customers/send_after_3';
|
13 |
+
|
14 |
+
const XML_PATH_TRIGGER_1_CAMPAIGN = 'connector_lost_baskets/customers/campaign_1';
|
15 |
+
const XML_PATH_TRIGGER_2_CAMPAIGN = 'connector_lost_baskets/customers/campaign_2';
|
16 |
+
const XML_PATH_TRIGGER_3_CAMPAIGN = 'connector_lost_baskets/customers/campaign_3';
|
17 |
+
|
18 |
+
const XML_PATH_GUEST_LOSTBASKET_1_ENABLED = 'connector_lost_baskets/guests/enabled_1';
|
19 |
+
const XML_PATH_GUEST_LOSTBASKET_2_ENABLED = 'connector_lost_baskets/guests/enabled_2';
|
20 |
+
const XML_PATH_GUEST_LOSTBASKET_3_ENABLED = 'connector_lost_baskets/guests/enabled_3';
|
21 |
+
|
22 |
+
const XML_PATH_GUEST_LOSTBASKET_1_INTERVAL = 'connector_lost_baskets/guests/send_after_1';
|
23 |
+
const XML_PATH_GUEST_LOSTBASKET_2_INTERVAL = 'connector_lost_baskets/guests/send_after_2';
|
24 |
+
const XML_PATH_GUEST_LOSTBASKET_3_INTERVAL = 'connector_lost_baskets/guests/send_after_3';
|
25 |
+
|
26 |
+
const XML_PATH_GUEST_LOSTBASKET_1_CAMPAIGN = 'connector_lost_baskets/guests/campaign_1';
|
27 |
+
const XML_PATH_GUEST_LOSTBASKET_2_CAMPAIGN = 'connector_lost_baskets/guests/campaign_2';
|
28 |
+
const XML_PATH_GUEST_LOSTBASKET_3_CAMPAIGN = 'connector_lost_baskets/guests/campaign_3';
|
29 |
+
|
30 |
+
|
31 |
+
//error messages
|
32 |
+
const SEND_EMAIL_CONTACT_ID_MISSING = 'Error : missing contact id - will try later to send ';
|
33 |
+
|
34 |
+
/**
|
35 |
+
* @var object
|
36 |
+
*/
|
37 |
+
public $transactionalClient;
|
38 |
+
|
39 |
+
/**
|
40 |
+
* constructor
|
41 |
+
*/
|
42 |
+
public function _construct()
|
43 |
+
{
|
44 |
+
parent::_construct();
|
45 |
+
$this->_init('email_connector/campaign');
|
46 |
+
|
47 |
+
$this->transactionalClient = Mage::helper('connector/transactional')->getWebsiteApiClient();
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* @return $this|Mage_Core_Model_Abstract
|
52 |
+
*/
|
53 |
+
protected function _beforeSave()
|
54 |
+
{
|
55 |
+
parent::_beforeSave();
|
56 |
+
$now = Mage::getSingleton('core/date')->gmtDate();
|
57 |
+
if ($this->isObjectNew()) {
|
58 |
+
$this->setCreatedAt($now);
|
59 |
+
}
|
60 |
+
$this->setUpdatedAt($now);
|
61 |
+
return $this;
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* @param $quoteId
|
66 |
+
* @param $storeId
|
67 |
+
* @return mixed
|
68 |
+
*/
|
69 |
+
public function loadByQuoteId($quoteId, $storeId)
|
70 |
+
{
|
71 |
+
$collection = $this->getCollection()
|
72 |
+
->addFieldToFilter('quote_id', $quoteId)
|
73 |
+
->addFieldToFilter('store_id', $storeId);
|
74 |
+
|
75 |
+
if ($collection->count()) {
|
76 |
+
return $collection->getFirstItem();
|
77 |
+
} else {
|
78 |
+
$this->setQuoteId($quoteId)
|
79 |
+
->setStoreId($storeId);
|
80 |
+
}
|
81 |
+
|
82 |
+
return $this;
|
83 |
+
}
|
84 |
+
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Sending the campaigns.
|
88 |
+
*/
|
89 |
+
public function sendCampaigns()
|
90 |
+
{
|
91 |
+
//grab the emails not send
|
92 |
+
$emailsToSend = $this->_getEmailCampaigns();
|
93 |
+
foreach ($emailsToSend as $campaign) {
|
94 |
+
$email = $campaign->getEmail();
|
95 |
+
$storeId = $campaign->getStoreId();
|
96 |
+
$store = Mage::app()->getStore($storeId);
|
97 |
+
$websiteId = $store->getWebsiteId();
|
98 |
+
$storeName = $store->getName();
|
99 |
+
$websiteName = $store->getWebsite()->getName();
|
100 |
+
$campaignId = $campaign->getCampaignId();
|
101 |
+
if (!$campaignId) {
|
102 |
+
$campaign->setMessage('Missing campaign id: ' . $campaignId)
|
103 |
+
->setIsSent(1)
|
104 |
+
->save();
|
105 |
+
continue;
|
106 |
+
} elseif (!$email) {
|
107 |
+
$campaign->setMessage('Missing email : ' . $email)
|
108 |
+
->setIsSent(1)
|
109 |
+
->save();
|
110 |
+
}
|
111 |
+
try{
|
112 |
+
if ($campaign->getEventName() == 'Lost Basket') {
|
113 |
+
$client = Mage::helper('connector')->getWebsiteApiClient($websiteId);
|
114 |
+
$contactId = Mage::helper('connector')->getContactId($campaign->getEmail(), $websiteId);
|
115 |
+
Mage::helper('connector')->log($contactId);
|
116 |
+
$response = $client->postCampaignsSend($campaignId, array($contactId));
|
117 |
+
if (isset($response->message)) {
|
118 |
+
//update the failed to send email message
|
119 |
+
$campaign->setMessage($response->message)->setIsSent(1)->save();
|
120 |
+
}
|
121 |
+
$now = Mage::getSingleton('core/date')->gmtDate();
|
122 |
+
//record suscces
|
123 |
+
$campaign->setIsSent(1)
|
124 |
+
->setMessage(NULL)
|
125 |
+
->setSentAt($now)
|
126 |
+
->save();
|
127 |
+
|
128 |
+
continue;
|
129 |
+
} elseif ($campaign->getEventName() == 'New Customer Account') {
|
130 |
+
|
131 |
+
$contactId = Mage::helper('connector/transactional')->getContactId($campaign->getEmail(), $websiteId);
|
132 |
+
$customerId = $campaign->getCustomerId();
|
133 |
+
$customer = Mage::getModel('customer/customer')->load($customerId);
|
134 |
+
$firstname = $customer->getFirstname();
|
135 |
+
$lastname = $customer->getLastname();
|
136 |
+
$data = array(
|
137 |
+
array(
|
138 |
+
'Key' => 'STORE_NAME',
|
139 |
+
'Value' => $storeName),
|
140 |
+
array(
|
141 |
+
'Key' => 'WEBSITE_NAME',
|
142 |
+
'Value' => $websiteName),
|
143 |
+
array(
|
144 |
+
'Key' => 'FIRSTNAME',
|
145 |
+
'Value' => $firstname),
|
146 |
+
array(
|
147 |
+
'Key' => 'LASTNAME',
|
148 |
+
'Value' => $lastname),
|
149 |
+
array(
|
150 |
+
'Key' => 'CUSTOMER_ID',
|
151 |
+
'Value' => $customerId)
|
152 |
+
);
|
153 |
+
$this->transactionalClient->updateContactDatafieldsByEmail($email, $data);
|
154 |
+
$response = $this->transactionalClient->postCampaignsSend($campaignId, array($contactId));
|
155 |
+
if (isset($response->message)) {
|
156 |
+
//update the failed to send email message
|
157 |
+
$campaign->setMessage($response->message)->setIsSent(1)->save();
|
158 |
+
} else {
|
159 |
+
$now = Mage::getSingleton('core/date')->gmtDate();
|
160 |
+
//record suscces
|
161 |
+
$campaign->setIsSent(1)
|
162 |
+
->setMessage(NULL)
|
163 |
+
->setSentAt($now)
|
164 |
+
->save();
|
165 |
+
}
|
166 |
+
} else {
|
167 |
+
// transactional
|
168 |
+
$orderModel = Mage::getModel("sales/order")->loadByIncrementId($campaign->getOrderIncrementId());
|
169 |
+
$contactId = Mage::helper('connector/transactional')->getContactId($campaign->getEmail(), $websiteId);
|
170 |
+
if (is_numeric($contactId)) {
|
171 |
+
if ($orderModel->getCustomerId()) {
|
172 |
+
$firstname = $orderModel->getCustomerFirstname();
|
173 |
+
$lastname = $orderModel->getCustomerLastname();
|
174 |
+
} else {
|
175 |
+
$billing = $orderModel->getBillingAddress();
|
176 |
+
$firstname = $billing->getFirstname();
|
177 |
+
$lastname = $billing->getLastname();
|
178 |
+
}
|
179 |
+
$data = array(
|
180 |
+
array(
|
181 |
+
'Key' => 'STORE_NAME',
|
182 |
+
'Value' => $storeName),
|
183 |
+
array(
|
184 |
+
'Key' => 'WEBSITE_NAME',
|
185 |
+
'Value' => $websiteName),
|
186 |
+
array(
|
187 |
+
'Key' => 'FIRSTNAME',
|
188 |
+
'Value' => $firstname),
|
189 |
+
array(
|
190 |
+
'Key' => 'LASTNAME',
|
191 |
+
'Value' => $lastname),
|
192 |
+
array(
|
193 |
+
'Key' => 'LAST_ORDER_ID',
|
194 |
+
'Value' => $orderModel->getId())
|
195 |
+
);
|
196 |
+
$this->transactionalClient->updateContactDatafieldsByEmail($email, $data);
|
197 |
+
}
|
198 |
+
$response = $this->transactionalClient->postCampaignsSend($campaignId, array($contactId));
|
199 |
+
if (isset($response->message)) {
|
200 |
+
//update the failed to send email message
|
201 |
+
$campaign->setMessage($response->message)->save();
|
202 |
+
} else {
|
203 |
+
$now = Mage::getSingleton('core/date')->gmtDate();
|
204 |
+
//record suscces
|
205 |
+
$campaign->setIsSent(1)
|
206 |
+
->setMessage(NULL)
|
207 |
+
->setSentAt($now)
|
208 |
+
->save();
|
209 |
+
}
|
210 |
+
}
|
211 |
+
|
212 |
+
}catch(Exception $e){
|
213 |
+
Mage::logException($e);
|
214 |
+
}
|
215 |
+
}
|
216 |
+
return;
|
217 |
+
}
|
218 |
+
|
219 |
+
/**
|
220 |
+
* @return mixed
|
221 |
+
*/
|
222 |
+
private function _getEmailCampaigns()
|
223 |
+
{
|
224 |
+
$emailCollection = $this->getCollection();
|
225 |
+
$emailCollection->addFieldToFilter('is_sent', array('null' => true))
|
226 |
+
->addFieldToFilter('campaign_id', array('notnull' => true));
|
227 |
+
$emailCollection->getSelect()->order('campaign_id');
|
228 |
+
|
229 |
+
return $emailCollection;
|
230 |
+
}
|
231 |
+
|
232 |
+
}
|
@@ -16,11 +16,13 @@ class Dotdigitalgroup_Email_Model_Connector_Account
|
|
16 |
private $_orders = array();
|
17 |
|
18 |
/**
|
19 |
-
* @param
|
|
|
20 |
*/
|
21 |
public function setApiPassword($api_password)
|
22 |
{
|
23 |
$this->_api_password = $api_password;
|
|
|
24 |
}
|
25 |
|
26 |
/**
|
@@ -32,11 +34,13 @@ class Dotdigitalgroup_Email_Model_Connector_Account
|
|
32 |
}
|
33 |
|
34 |
/**
|
35 |
-
* @param
|
|
|
36 |
*/
|
37 |
public function setApiUsername($api_username)
|
38 |
{
|
39 |
$this->_api_username = $api_username;
|
|
|
40 |
}
|
41 |
|
42 |
/**
|
@@ -68,12 +72,11 @@ class Dotdigitalgroup_Email_Model_Connector_Account
|
|
68 |
*/
|
69 |
public function setContacts($contacts)
|
70 |
{
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
$this->_contacts[] = $contacts;
|
76 |
-
|
77 |
}
|
78 |
|
79 |
/**
|
@@ -214,5 +217,4 @@ class Dotdigitalgroup_Email_Model_Connector_Account
|
|
214 |
return $this->_websites;
|
215 |
}
|
216 |
|
217 |
-
|
218 |
}
|
16 |
private $_orders = array();
|
17 |
|
18 |
/**
|
19 |
+
* @param $api_password
|
20 |
+
* @return $this
|
21 |
*/
|
22 |
public function setApiPassword($api_password)
|
23 |
{
|
24 |
$this->_api_password = $api_password;
|
25 |
+
return $this;
|
26 |
}
|
27 |
|
28 |
/**
|
34 |
}
|
35 |
|
36 |
/**
|
37 |
+
* @param $api_username
|
38 |
+
* @return $this
|
39 |
*/
|
40 |
public function setApiUsername($api_username)
|
41 |
{
|
42 |
$this->_api_username = $api_username;
|
43 |
+
return $this;
|
44 |
}
|
45 |
|
46 |
/**
|
72 |
*/
|
73 |
public function setContacts($contacts)
|
74 |
{
|
75 |
+
if (!empty($this->_contacts)) {
|
76 |
+
$this->_contacts += $contacts;
|
77 |
+
} else {
|
|
|
78 |
$this->_contacts[] = $contacts;
|
79 |
+
}
|
80 |
}
|
81 |
|
82 |
/**
|
217 |
return $this->_websites;
|
218 |
}
|
219 |
|
|
|
220 |
}
|
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Model_Connector_Campaign
|
4 |
+
{
|
5 |
+
|
6 |
+
public $id;
|
7 |
+
public $contacts = array();
|
8 |
+
public $emails = array();
|
9 |
+
public $emailSendId = array();
|
10 |
+
private $_storeId;
|
11 |
+
|
12 |
+
/**
|
13 |
+
* @param mixed $storeId
|
14 |
+
*/
|
15 |
+
public function setStoreId($storeId)
|
16 |
+
{
|
17 |
+
$this->_storeId = $storeId;
|
18 |
+
}
|
19 |
+
|
20 |
+
/**
|
21 |
+
* @return mixed
|
22 |
+
*/
|
23 |
+
public function getStoreId()
|
24 |
+
{
|
25 |
+
return $this->_storeId;
|
26 |
+
}
|
27 |
+
|
28 |
+
/**
|
29 |
+
* @param $emailSendId
|
30 |
+
* @return $this
|
31 |
+
*/
|
32 |
+
public function setEmailSendId($emailSendId)
|
33 |
+
{
|
34 |
+
$this->emailSendId[] = $emailSendId;
|
35 |
+
return $this;
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* @return array
|
40 |
+
*/
|
41 |
+
public function getEmailSendId()
|
42 |
+
{
|
43 |
+
return $this->emailSendId;
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* @param $contact
|
48 |
+
* @return $this
|
49 |
+
*/
|
50 |
+
public function setContactId($contact)
|
51 |
+
{
|
52 |
+
$this->contacts[] = $contact;
|
53 |
+
return $this;
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* @return array
|
58 |
+
*/
|
59 |
+
public function getContacts()
|
60 |
+
{
|
61 |
+
return $this->contacts;
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* @param $emails
|
66 |
+
* @return $this
|
67 |
+
*/
|
68 |
+
public function setEmails($emails)
|
69 |
+
{
|
70 |
+
$this->emails = $emails;
|
71 |
+
return $this;
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* @return array
|
76 |
+
*/
|
77 |
+
public function getEmails()
|
78 |
+
{
|
79 |
+
return $this->emails;
|
80 |
+
}
|
81 |
+
|
82 |
+
/**
|
83 |
+
* @param $id
|
84 |
+
* @return $this
|
85 |
+
*/
|
86 |
+
public function setId($id)
|
87 |
+
{
|
88 |
+
$this->id = $id;
|
89 |
+
return $this;
|
90 |
+
}
|
91 |
+
|
92 |
+
/**
|
93 |
+
* @return mixed
|
94 |
+
*/
|
95 |
+
public function getId()
|
96 |
+
{
|
97 |
+
return $this->id;
|
98 |
+
}
|
99 |
+
|
100 |
+
}
|
@@ -0,0 +1,308 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Model_Connector_Datafield
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* @var string
|
7 |
+
*/
|
8 |
+
public $name;
|
9 |
+
/**
|
10 |
+
* @var string
|
11 |
+
*/
|
12 |
+
public $type;
|
13 |
+
/**
|
14 |
+
* @var string
|
15 |
+
*/
|
16 |
+
public $visibility;
|
17 |
+
/**
|
18 |
+
* @var string
|
19 |
+
*/
|
20 |
+
public $defaultValue;
|
21 |
+
/**
|
22 |
+
* Contact datafields.
|
23 |
+
* @var array
|
24 |
+
*/
|
25 |
+
public $datafields = array();
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Default datafields
|
29 |
+
* @return array
|
30 |
+
*/
|
31 |
+
protected $_defaultDataFields = array(
|
32 |
+
array(
|
33 |
+
'name' => 'CUSTOMER_ID',
|
34 |
+
'type' => 'string',
|
35 |
+
'visibility' => 'private',
|
36 |
+
),array(
|
37 |
+
'name' => 'LAST_ORDER_ID',
|
38 |
+
'type' => 'numeric',
|
39 |
+
'visibility' => 'private',
|
40 |
+
),array(
|
41 |
+
'name' => 'ORDER_INCREMENT_ID',
|
42 |
+
'type' => 'numeric',
|
43 |
+
'visibility' => 'private',
|
44 |
+
)
|
45 |
+
);
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Contact default datafields.
|
49 |
+
*
|
50 |
+
* @var array
|
51 |
+
*/
|
52 |
+
private $_contactDatafields = array(
|
53 |
+
'customer_id' => array(
|
54 |
+
'name' => 'CUSTOMER_ID',
|
55 |
+
'type' => 'numeric',
|
56 |
+
'visibility' => 'public',
|
57 |
+
),
|
58 |
+
'firstname' => array(
|
59 |
+
'name' => 'FIRSTNAME',
|
60 |
+
'type' => 'string'
|
61 |
+
),
|
62 |
+
'lastname' => array(
|
63 |
+
'name' => 'LASTNAME',
|
64 |
+
'type' => 'string'
|
65 |
+
),
|
66 |
+
'gender' => array(
|
67 |
+
'name' => 'GENDER',
|
68 |
+
'type' => 'string'
|
69 |
+
),
|
70 |
+
'dob' => array(
|
71 |
+
'name' => 'DOB',
|
72 |
+
'type' => 'date',
|
73 |
+
'visibility' => 'public',
|
74 |
+
),
|
75 |
+
'title' => array(
|
76 |
+
'name' => 'TITLE',
|
77 |
+
'type' => 'string',
|
78 |
+
'visibility' => 'public',
|
79 |
+
),
|
80 |
+
'website_name' => array(
|
81 |
+
'name' => 'WEBSITE_NAME',
|
82 |
+
'type' => 'string',
|
83 |
+
'visibility' => 'public',
|
84 |
+
),
|
85 |
+
'store_name' => array(
|
86 |
+
'name' => 'STORE_NAME',
|
87 |
+
'type' => 'string',
|
88 |
+
'visibility' => 'public',
|
89 |
+
),
|
90 |
+
'created_at' => array(
|
91 |
+
'name' => 'ACCOUNT_CREATED_DATE',
|
92 |
+
'type' => 'date',
|
93 |
+
'visibility' => 'public'
|
94 |
+
),
|
95 |
+
'last_logged_date' => array(
|
96 |
+
'name' => 'LAST_LOGGEDIN_DATE',
|
97 |
+
'type' => 'date',
|
98 |
+
'visibility' => 'public'
|
99 |
+
),
|
100 |
+
'customer_group' => array(
|
101 |
+
'name' => 'CUSTOMER_GROUP',
|
102 |
+
'type' => 'string',
|
103 |
+
'visibility' => 'public',
|
104 |
+
),
|
105 |
+
'billing_address_1' => array(
|
106 |
+
'name' => 'BILLING_ADDRESS_1',
|
107 |
+
'type' => 'string',
|
108 |
+
'visibility' => 'private',
|
109 |
+
'defaultValue' => ''
|
110 |
+
),
|
111 |
+
'billing_address_2' => array(
|
112 |
+
'name' => 'BILLING_ADDRESS_2',
|
113 |
+
'type' => 'string',
|
114 |
+
'visibility' => 'public',
|
115 |
+
),
|
116 |
+
'billing_state' => array(
|
117 |
+
'name' => 'BILLING_STATE',
|
118 |
+
'type' => 'string',
|
119 |
+
'visibility' => 'public'
|
120 |
+
),
|
121 |
+
'billing_city' => array(
|
122 |
+
'name' => 'BILLING_CITY',
|
123 |
+
'type' => 'string',
|
124 |
+
'visibility' => 'public',
|
125 |
+
),
|
126 |
+
'billing_country' => array(
|
127 |
+
'name' => 'BILLING_COUNTRY',
|
128 |
+
'type' => 'string',
|
129 |
+
'visibility' => 'public',
|
130 |
+
),
|
131 |
+
'billing_postcode' => array(
|
132 |
+
'name' => 'BILLING_POSTCODE',
|
133 |
+
'type' => 'string',
|
134 |
+
'visibility' => 'public',
|
135 |
+
),
|
136 |
+
'billing_telephone' => array(
|
137 |
+
'name' => 'BILLING_TELEPHONE',
|
138 |
+
'type' => 'string',
|
139 |
+
'visibility' => 'public',
|
140 |
+
),
|
141 |
+
'delivery_address_1' => array(
|
142 |
+
'name' => 'DELIVERY_ADDRESS_1',
|
143 |
+
'type' => 'string',
|
144 |
+
'visibility' => 'public',
|
145 |
+
),
|
146 |
+
'delivery_address_2' => array(
|
147 |
+
'name' => 'DELIVERY_ADDRESS_2',
|
148 |
+
'type' => 'string',
|
149 |
+
'visibility' => 'public',
|
150 |
+
),
|
151 |
+
'delivery_state' => array(
|
152 |
+
'name' => 'DELIVERY_STATE',
|
153 |
+
'type' => 'string',
|
154 |
+
'visibility' => 'public'
|
155 |
+
),
|
156 |
+
'delivery_city' => array(
|
157 |
+
'name' => 'DELIVERY_CITY',
|
158 |
+
'type' => 'string',
|
159 |
+
'visibility' => 'public',
|
160 |
+
),
|
161 |
+
'delivery_country' => array(
|
162 |
+
'name' => 'DELIVERY_COUNTRY',
|
163 |
+
'type' => 'string',
|
164 |
+
'visibility' => 'public',
|
165 |
+
),
|
166 |
+
'delivery_postcode' => array(
|
167 |
+
'name' => 'DELIVERY_POSTCODE',
|
168 |
+
'type' => 'string',
|
169 |
+
'visibility' => 'public',
|
170 |
+
),
|
171 |
+
'delivery_telephone' => array(
|
172 |
+
'name' => 'DELIVERY_TELEPHONE',
|
173 |
+
'type' => 'string',
|
174 |
+
'visibility' => 'public',
|
175 |
+
),
|
176 |
+
'number_of_orders' => array(
|
177 |
+
'name' => 'NUMBER_OF_ORDERS',
|
178 |
+
'type' => 'numeric',
|
179 |
+
'visibility' => 'public',
|
180 |
+
),
|
181 |
+
'total_spend' => array(
|
182 |
+
'name' => 'TOTAL_SPEND',
|
183 |
+
'type' => 'numeric',
|
184 |
+
'visibility' => 'public',
|
185 |
+
),
|
186 |
+
'average_order_value' => array(
|
187 |
+
'name' => 'AVERAGE_ORDER_VALUE',
|
188 |
+
'type' => 'numeric',
|
189 |
+
'visibility' => 'public',
|
190 |
+
),
|
191 |
+
'last_order_date' => array(
|
192 |
+
'name' => 'LAST_ORDER_DATE',
|
193 |
+
'type' => 'date',
|
194 |
+
'visibility' => 'public',
|
195 |
+
),
|
196 |
+
'last_order_id' => array(
|
197 |
+
'name' => 'LAST_ORDER_ID',
|
198 |
+
'type' => 'numeric',
|
199 |
+
'visibility' => 'private',
|
200 |
+
)
|
201 |
+
);
|
202 |
+
|
203 |
+
/**
|
204 |
+
* transactional data default datafields.
|
205 |
+
*
|
206 |
+
* @var array
|
207 |
+
*/
|
208 |
+
private $_transactionalDefaultDatafields = array(
|
209 |
+
array(
|
210 |
+
'name' => 'CUSTOMER_ID',
|
211 |
+
'type' => 'string',
|
212 |
+
'visibility' => 'private',
|
213 |
+
),array(
|
214 |
+
'name' => 'LAST_ORDER_ID',
|
215 |
+
'type' => 'numeric',
|
216 |
+
'visibility' => 'private',
|
217 |
+
),array(
|
218 |
+
'name' => 'ORDER_INCREMENT_ID',
|
219 |
+
'type' => 'numeric',
|
220 |
+
'visibility' => 'private',
|
221 |
+
),
|
222 |
+
array(
|
223 |
+
'name' => 'WEBSITE_NAME',
|
224 |
+
'type' => 'string',
|
225 |
+
'visibility' => 'private',
|
226 |
+
),
|
227 |
+
array(
|
228 |
+
'name' => 'STORE_NAME',
|
229 |
+
'type' => 'string',
|
230 |
+
'visibility' => 'private',
|
231 |
+
),
|
232 |
+
array(
|
233 |
+
'name' => 'LAST_ORDER_DATE',
|
234 |
+
'type' => 'date',
|
235 |
+
'visibility' => 'private',
|
236 |
+
)
|
237 |
+
);
|
238 |
+
|
239 |
+
/**
|
240 |
+
* @param array $contactDatafields
|
241 |
+
*/
|
242 |
+
public function setContactDatafields($contactDatafields)
|
243 |
+
{
|
244 |
+
$this->_contactDatafields = $contactDatafields;
|
245 |
+
}
|
246 |
+
|
247 |
+
/**
|
248 |
+
* @return array
|
249 |
+
*/
|
250 |
+
public function getContactDatafields()
|
251 |
+
{
|
252 |
+
return $this->_contactDatafields;
|
253 |
+
}
|
254 |
+
|
255 |
+
/**
|
256 |
+
* @param array $transactionalDefaultDatafields
|
257 |
+
*/
|
258 |
+
public function setTransactionalDefaultDatafields($transactionalDefaultDatafields)
|
259 |
+
{
|
260 |
+
$this->_transactionalDefaultDatafields = $transactionalDefaultDatafields;
|
261 |
+
}
|
262 |
+
|
263 |
+
/**
|
264 |
+
* @return array
|
265 |
+
*/
|
266 |
+
public function getTransactionalDefaultDatafields()
|
267 |
+
{
|
268 |
+
return $this->_transactionalDefaultDatafields;
|
269 |
+
}
|
270 |
+
|
271 |
+
/**
|
272 |
+
* @param mixed $defaultDataFields
|
273 |
+
*/
|
274 |
+
public function setDefaultDataFields($defaultDataFields)
|
275 |
+
{
|
276 |
+
$this->_defaultDataFields = $defaultDataFields;
|
277 |
+
}
|
278 |
+
|
279 |
+
/**
|
280 |
+
* @return mixed
|
281 |
+
*/
|
282 |
+
public function getDefaultDataFields()
|
283 |
+
{
|
284 |
+
return $this->_defaultDataFields;
|
285 |
+
}
|
286 |
+
|
287 |
+
/**
|
288 |
+
* set a single datafield.
|
289 |
+
*
|
290 |
+
* @param $name
|
291 |
+
* @param $value
|
292 |
+
* @param string $type
|
293 |
+
* @param string $visibility
|
294 |
+
*
|
295 |
+
* @return array
|
296 |
+
*/
|
297 |
+
public function setDatafield($name, $value, $type = 'string', $visibility = 'public')
|
298 |
+
{
|
299 |
+
$this->datafields[] = array(
|
300 |
+
'name' => $name,
|
301 |
+
'value' => $value,
|
302 |
+
'type' => $type,
|
303 |
+
'visibility' => $visibility
|
304 |
+
);
|
305 |
+
return $this->datafields;
|
306 |
+
}
|
307 |
+
|
308 |
+
}
|
@@ -0,0 +1,194 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Model_Connector_Order
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Order Increment ID
|
7 |
+
* @var string
|
8 |
+
*/
|
9 |
+
public $id;
|
10 |
+
/**
|
11 |
+
* Email
|
12 |
+
* @var string
|
13 |
+
*/
|
14 |
+
public $email;
|
15 |
+
/**
|
16 |
+
* @var int
|
17 |
+
*/
|
18 |
+
public $quote_id;
|
19 |
+
/**
|
20 |
+
* @var string
|
21 |
+
*/
|
22 |
+
public $store_name;
|
23 |
+
/**
|
24 |
+
* @var string
|
25 |
+
*/
|
26 |
+
public $purchase_date;
|
27 |
+
/**
|
28 |
+
* @var string
|
29 |
+
*/
|
30 |
+
public $delivery_address;
|
31 |
+
/**
|
32 |
+
* @var string
|
33 |
+
*/
|
34 |
+
public $billing_address;
|
35 |
+
/**
|
36 |
+
* @var array
|
37 |
+
*/
|
38 |
+
public $products = array();
|
39 |
+
/**
|
40 |
+
* @var float
|
41 |
+
*/
|
42 |
+
public $order_subtotal;
|
43 |
+
/**
|
44 |
+
* @var float
|
45 |
+
*/
|
46 |
+
public $discount_ammount;
|
47 |
+
/**
|
48 |
+
* @var float
|
49 |
+
*/
|
50 |
+
public $order_total;
|
51 |
+
/**
|
52 |
+
* @var array
|
53 |
+
*/
|
54 |
+
public $categories;
|
55 |
+
/**
|
56 |
+
* Payment name
|
57 |
+
* @var string
|
58 |
+
*/
|
59 |
+
public $payment;
|
60 |
+
/**
|
61 |
+
* @var string
|
62 |
+
*/
|
63 |
+
public $delivery_method;
|
64 |
+
/**
|
65 |
+
* @var float
|
66 |
+
*/
|
67 |
+
public $delivery_total;
|
68 |
+
/**
|
69 |
+
* @var string
|
70 |
+
*/
|
71 |
+
public $currency;
|
72 |
+
|
73 |
+
|
74 |
+
public $couponCode;
|
75 |
+
|
76 |
+
/**
|
77 |
+
* set the order information
|
78 |
+
* @param Mage_Sales_Model_Order $orderData
|
79 |
+
*/
|
80 |
+
public function __construct(Mage_Sales_Model_Order $orderData)
|
81 |
+
{
|
82 |
+
$customerModel = Mage::getModel('customer/customer');
|
83 |
+
$customerModel->load($orderData->getCustomerId());
|
84 |
+
|
85 |
+
$this->id = $orderData->getIncrementId();
|
86 |
+
$this->quote_id = $orderData->getQuoteId();
|
87 |
+
$this->email = $orderData->getCustomerEmail();
|
88 |
+
$this->store_name = $orderData->getStoreName();
|
89 |
+
$created_at = new Zend_Date($orderData->getCreatedAt(), Zend_Date::ISO_8601);
|
90 |
+
$this->purchase_date = $created_at->toString(Zend_Date::ISO_8601);
|
91 |
+
$this->delivery_method = $orderData->getShippingDescription();
|
92 |
+
$this->delivery_total = $orderData->getShippingAmount();
|
93 |
+
$this->currency = $orderData->getStoreCurrencyCode();
|
94 |
+
$this->payment = $orderData->getPayment()->getMethodInstance()->getTitle();
|
95 |
+
$this->couponCode = $orderData->getCouponCode();
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Billing address.
|
99 |
+
*/
|
100 |
+
if ($orderData->getBillingAddress()) {
|
101 |
+
$billingData = $orderData->getBillingAddress()->getData();
|
102 |
+
$this->billing_address = array(
|
103 |
+
'billing_address_1' => $this->_getStreet($billingData['street'], 1),
|
104 |
+
'billing_address_2' => $this->_getStreet($billingData['street'], 2),
|
105 |
+
'billing_city' => $billingData['city'],
|
106 |
+
'billing_region' => $billingData['region'],
|
107 |
+
'billing_country' => $billingData['country_id'],
|
108 |
+
'billing_postcode' => $billingData['postcode'],
|
109 |
+
);
|
110 |
+
}
|
111 |
+
/**
|
112 |
+
* Shipping address.
|
113 |
+
*/
|
114 |
+
if ($orderData->getShippingAddress()) {
|
115 |
+
$shippingData = $orderData->getShippingAddress()->getData();
|
116 |
+
|
117 |
+
$this->delivery_address = array(
|
118 |
+
'delivery_address_1' => $this->_getStreet($shippingData['street'], 1),
|
119 |
+
'delivery_address_2' => $this->_getStreet($shippingData['street'], 2),
|
120 |
+
'delivery_city' => $shippingData['city'],
|
121 |
+
'delivery_region' => $shippingData['region'],
|
122 |
+
'delivery_country' => $shippingData['country_id'],
|
123 |
+
'delivery_postcode' => $shippingData['postcode']
|
124 |
+
);
|
125 |
+
}
|
126 |
+
|
127 |
+
/**
|
128 |
+
* Order items.
|
129 |
+
*/
|
130 |
+
foreach ($orderData->getAllItems() as $productItem) {
|
131 |
+
$product = $productItem->getProduct();
|
132 |
+
if ($product) {
|
133 |
+
// category names
|
134 |
+
$categoryCollection = $product->getCategoryCollection()
|
135 |
+
->addAttributeToSelect('name');
|
136 |
+
|
137 |
+
foreach ($categoryCollection as $cat) {
|
138 |
+
$categories = array();
|
139 |
+
$categories[] = $cat->getName();
|
140 |
+
$this->categories[]['Name'] = substr(implode(', ', $categories), 0, 244);
|
141 |
+
}
|
142 |
+
}
|
143 |
+
|
144 |
+
$attributeSetModel = Mage::getModel("eav/entity_attribute_set");
|
145 |
+
$attributeSetModel->load($product->getAttributeSetId());
|
146 |
+
$attributeSetName = $attributeSetModel->getAttributeSetName();
|
147 |
+
$this->products[] = array(
|
148 |
+
'name' => $productItem->getName(),
|
149 |
+
'sku' => $productItem->getSku(),
|
150 |
+
'qty' => (int)number_format($productItem->getData('qty_ordered'), 2),
|
151 |
+
'price' => (float)number_format($productItem->getPrice(), 2),
|
152 |
+
'attribute-set' => $attributeSetName
|
153 |
+
);
|
154 |
+
}
|
155 |
+
|
156 |
+
$this->order_subtotal = (float)number_format($orderData->getData('subtotal'), 2);
|
157 |
+
$this->discount_ammount = (float)number_format($orderData->getData('discount_amount'), 2);
|
158 |
+
$orderTotal = abs($orderData->getData('grand_total') - $orderData->getTotalRefunded());
|
159 |
+
$this->order_total = (float)number_format($orderTotal, 2);
|
160 |
+
|
161 |
+
return true;
|
162 |
+
}
|
163 |
+
/**
|
164 |
+
* get the street name by line number
|
165 |
+
* @param $street
|
166 |
+
* @param $line
|
167 |
+
* @return string
|
168 |
+
*/
|
169 |
+
private function _getStreet($street, $line)
|
170 |
+
{
|
171 |
+
$street = explode("\n", $street);
|
172 |
+
if ($line == 1) {
|
173 |
+
return $street[0];
|
174 |
+
}
|
175 |
+
if (isset($street[$line -1])) {
|
176 |
+
|
177 |
+
return $street[$line - 1];
|
178 |
+
} else {
|
179 |
+
|
180 |
+
return '';
|
181 |
+
}
|
182 |
+
}
|
183 |
+
|
184 |
+
/**
|
185 |
+
* exposes the class as an array of objects.
|
186 |
+
* @return array
|
187 |
+
*/
|
188 |
+
public function expose()
|
189 |
+
{
|
190 |
+
return get_object_vars($this);
|
191 |
+
|
192 |
+
}
|
193 |
+
|
194 |
+
}
|
@@ -0,0 +1,169 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Model_Contact extends Mage_Core_Model_Abstract
|
4 |
+
{
|
5 |
+
|
6 |
+
const EMAIL_CONTACT_IMPORTED = 1;
|
7 |
+
const EMAIL_CONTACT_NOT_IMPORTED = null;
|
8 |
+
const EMAIL_SUBSCRIBER_NOT_IMPORTED = null;
|
9 |
+
/**
|
10 |
+
* constructor
|
11 |
+
*/
|
12 |
+
public function _construct()
|
13 |
+
{
|
14 |
+
parent::_construct();
|
15 |
+
$this->_init('email_connector/contact');
|
16 |
+
}
|
17 |
+
|
18 |
+
|
19 |
+
/**
|
20 |
+
* @return $this|Mage_Core_Model_Abstract
|
21 |
+
*/
|
22 |
+
protected function _beforeSave()
|
23 |
+
{
|
24 |
+
parent::_beforeSave();
|
25 |
+
$now = Mage::getSingleton('core/date')->gmtDate();
|
26 |
+
if ($this->isObjectNew()) {
|
27 |
+
$this->setCreatedAt($now);
|
28 |
+
}
|
29 |
+
return $this;
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Reset the imported contacts
|
34 |
+
* @return int
|
35 |
+
*/
|
36 |
+
public function resetAllContacts()
|
37 |
+
{
|
38 |
+
|
39 |
+
/** @var $coreResource Mage_Core_Model_Resource */
|
40 |
+
$coreResource = Mage::getSingleton('core/resource');
|
41 |
+
|
42 |
+
/** @var $conn Varien_Db_Adapter_Pdo_Mysql */
|
43 |
+
$conn = $coreResource->getConnection('core_write');
|
44 |
+
|
45 |
+
try{
|
46 |
+
$num = $conn->update($coreResource->getTableName('email_connector/contact'),
|
47 |
+
array('email_imported' => new Zend_Db_Expr('null')),
|
48 |
+
$conn->quoteInto('email_imported is ?', new Zend_Db_Expr('not null'))
|
49 |
+
);
|
50 |
+
}catch (Exception $e){
|
51 |
+
Mage::logException($e);
|
52 |
+
}
|
53 |
+
/**
|
54 |
+
* Reset subscribers.
|
55 |
+
*/
|
56 |
+
$this->resetSubscribers();
|
57 |
+
|
58 |
+
return $num;
|
59 |
+
}
|
60 |
+
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Load contact by customer id
|
64 |
+
* @param $customerId
|
65 |
+
* @return mixed
|
66 |
+
*/
|
67 |
+
public function loadByCustomerId($customerId)
|
68 |
+
{
|
69 |
+
$collection = $this->getCollection()
|
70 |
+
->addFieldToFilter('customer_id', $customerId);
|
71 |
+
if($collection->count())
|
72 |
+
return $collection->getFirstItem();
|
73 |
+
return $this;
|
74 |
+
|
75 |
+
}
|
76 |
+
|
77 |
+
public function getContactsToImportForWebsite($websiteId, $pageSize = 100)
|
78 |
+
{
|
79 |
+
$collection = $this->getCollection()
|
80 |
+
->addFieldToFilter('website_id', $websiteId)
|
81 |
+
->addFieldToFilter('email_imported', array('null' => true))
|
82 |
+
->addFieldToFilter('customer_id', array('notnull' => true));
|
83 |
+
|
84 |
+
$collection->getSelect()->limit($pageSize);
|
85 |
+
|
86 |
+
return $collection;
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Get missing contacts.
|
91 |
+
* @param $websiteId
|
92 |
+
* @param int $pageSize
|
93 |
+
* @return mixed
|
94 |
+
*/
|
95 |
+
public function getMissingContacts($websiteId, $pageSize = 100)
|
96 |
+
{
|
97 |
+
$collection = $this->getCollection()
|
98 |
+
->addFieldToFilter('contact_id', array('null' => true))
|
99 |
+
->addFieldToFilter('suppressed', null)
|
100 |
+
->addFieldToFilter('website_id', $websiteId);
|
101 |
+
|
102 |
+
$collection->getSelect()->limit($pageSize);
|
103 |
+
|
104 |
+
return $collection->load();
|
105 |
+
}
|
106 |
+
|
107 |
+
/**
|
108 |
+
* Load Contact by Email.
|
109 |
+
* @param $email
|
110 |
+
* @param $websiteId
|
111 |
+
* @return $this
|
112 |
+
*/
|
113 |
+
public function loadByCustomerEmail($email, $websiteId)
|
114 |
+
{
|
115 |
+
$collection = $this->getCollection()
|
116 |
+
->addFieldToFilter('email', $email)
|
117 |
+
->addFieldToFilter('website_id', $websiteId);
|
118 |
+
if ($collection->count()) {
|
119 |
+
return $collection->getFirstItem();
|
120 |
+
} else {
|
121 |
+
$this->setEmail($email)
|
122 |
+
->setWebsiteId($websiteId);
|
123 |
+
}
|
124 |
+
return $this;
|
125 |
+
}
|
126 |
+
|
127 |
+
public function getSubscribersToImport($website, $limit = 1000)
|
128 |
+
{
|
129 |
+
$storeIds = $website->getStoreIds();
|
130 |
+
$collection = $this->getCollection()
|
131 |
+
->addFieldToFilter('is_subscriber', array('notnull' => true))
|
132 |
+
->addFieldToFilter('subscriber_imported', array('null' => true))
|
133 |
+
->addFieldToFilter('store_id', array('in' => $storeIds));
|
134 |
+
|
135 |
+
$collection->getSelect()->limit($limit);
|
136 |
+
|
137 |
+
return $collection;
|
138 |
+
}
|
139 |
+
|
140 |
+
public function getGuests($website)
|
141 |
+
{
|
142 |
+
$guestCollection = $this->getCollection()
|
143 |
+
->addFieldToFilter('is_guest', array('notnull' => true))
|
144 |
+
->addFieldToFilter('email_imported', self::EMAIL_CONTACT_NOT_IMPORTED)
|
145 |
+
->addFieldToFilter('website_id', $website->getId());
|
146 |
+
|
147 |
+
return $guestCollection->load();
|
148 |
+
}
|
149 |
+
|
150 |
+
public function getNumberOfImportedContacs()
|
151 |
+
{
|
152 |
+
|
153 |
+
$collection = $this->getCollection()
|
154 |
+
->addFieldToFilter('email_imported', array('notnull' => true));
|
155 |
+
|
156 |
+
return $collection->getSize();
|
157 |
+
}
|
158 |
+
|
159 |
+
public function resetSubscribers()
|
160 |
+
{
|
161 |
+
$collection = $this->getCollection()
|
162 |
+
->addFieldToFilter('is_subscriber', array('notnull' => true))
|
163 |
+
->addFieldToFilter('subscriber_imported', array('notnull' => true));
|
164 |
+
foreach ($collection as $contact) {
|
165 |
+
$contact->setSubscriberImported(null)->save();
|
166 |
+
}
|
167 |
+
return $collection->count();
|
168 |
+
}
|
169 |
+
}
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Model_Cron
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* CRON FOR CONTACTS SYNC
|
7 |
+
*/
|
8 |
+
public function contactSync()
|
9 |
+
{
|
10 |
+
// send customers
|
11 |
+
Mage::getModel('email_connector/apiconnector_contact')->sync();
|
12 |
+
}
|
13 |
+
|
14 |
+
/**
|
15 |
+
* CRON FOR LOST BASKET
|
16 |
+
*/
|
17 |
+
public function lostBaskets()
|
18 |
+
{
|
19 |
+
// send lost basket
|
20 |
+
Mage::getModel('email_connector/sales_quote')->proccessLostBaskets();
|
21 |
+
|
22 |
+
}
|
23 |
+
|
24 |
+
/**
|
25 |
+
* CRON FOR ORDER TRANSACTIONAL DATA
|
26 |
+
*/
|
27 |
+
public function orderSync()
|
28 |
+
{
|
29 |
+
// send order
|
30 |
+
Mage::getModel('email_connector/sales_order')->sync();
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* CRON FOR SUBSCRIBERS AND GUEST CONTACTS
|
35 |
+
*/
|
36 |
+
public function subscribersAndGuestSync()
|
37 |
+
{
|
38 |
+
//sync subscribers
|
39 |
+
Mage::getModel('email_connector/newsletter_subscriber')
|
40 |
+
->sync()
|
41 |
+
->unsubscribe();
|
42 |
+
//sync guests
|
43 |
+
Mage::getModel('email_connector/customer_guest')->sync();
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* CRON FOR EMAILS SENDING
|
48 |
+
*/
|
49 |
+
public function sendMappedEmails()
|
50 |
+
{
|
51 |
+
Mage::getModel('email_connector/campaign')->sendCampaigns();
|
52 |
+
|
53 |
+
return $this;
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* CLEAN ARHIVED FOLDERS
|
58 |
+
*/
|
59 |
+
|
60 |
+
public function cleaning()
|
61 |
+
{
|
62 |
+
$helper = Mage::helper('connector/file');
|
63 |
+
$archivedFolder = $helper->getArchiveFolder();
|
64 |
+
$result = $helper->deleteDir($archivedFolder);
|
65 |
+
$helper->log('Cleaning cronjob result : ' . $result);
|
66 |
+
return $result;
|
67 |
+
}
|
68 |
+
|
69 |
+
}
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Model_Customer_Guest
|
4 |
+
{
|
5 |
+
protected $_countGuests = 0;
|
6 |
+
protected $_start;
|
7 |
+
|
8 |
+
/**
|
9 |
+
* GUEST SYNC.
|
10 |
+
*/
|
11 |
+
public function sync()
|
12 |
+
{
|
13 |
+
/** @var Dotdigitalgroup_Email_Helper_Data $helper */
|
14 |
+
$helper = Mage::helper('connector');
|
15 |
+
$helper->log('----------- Start guest sync ----------');
|
16 |
+
$this->_start = microtime(true);
|
17 |
+
foreach(Mage::app()->getWebsites() as $website)
|
18 |
+
$this->exportGuestPerWebsite($website);
|
19 |
+
$helper->log('---- End Guest total time for guest sync : ' . gmdate("H:i:s", microtime(true) - $this->_start));
|
20 |
+
return;
|
21 |
+
}
|
22 |
+
|
23 |
+
public function exportGuestPerWebsite(Mage_Core_Model_Website $website)
|
24 |
+
{
|
25 |
+
$helper = Mage::helper('connector');
|
26 |
+
$fileHelper = Mage::helper('connector/file');
|
27 |
+
$guests = Mage::getModel('email_connector/contact')->getGuests($website);
|
28 |
+
if ($guests->getSize()) {
|
29 |
+
$client = Mage::helper('connector')->getWebsiteApiClient($website);
|
30 |
+
$guestFilename = strtolower($website->getCode() . '_guest_' . date('d_m_Y_Hi') . '.csv');
|
31 |
+
$helper->log('Guest file: ' . $guestFilename);
|
32 |
+
$storeName = $helper->getMappedStoreName($website);
|
33 |
+
$fileHelper->outputCSV($fileHelper->getFilePath($guestFilename), array('Email', 'emailType', $storeName));
|
34 |
+
foreach ($guests as $guest) {
|
35 |
+
$email = $guest->getEmail();
|
36 |
+
try{
|
37 |
+
$guest->setEmailImported(Dotdigitalgroup_Email_Model_Contact::EMAIL_CONTACT_IMPORTED)
|
38 |
+
->save();
|
39 |
+
$storeName = $website->getName();
|
40 |
+
// save data for guests
|
41 |
+
$fileHelper->outputCSV($fileHelper->getFilePath($guestFilename), array($email, 'Html', $storeName));
|
42 |
+
$this->_countGuests++;
|
43 |
+
}catch (Exception $e){
|
44 |
+
Mage::logException($e);
|
45 |
+
}
|
46 |
+
}
|
47 |
+
if ($this->_countGuests) {
|
48 |
+
//Add to guest address book
|
49 |
+
$client->postAddressBookContactsImport($guestFilename, $helper->getGuestAddressBook($website));
|
50 |
+
}
|
51 |
+
//arhive guest file
|
52 |
+
$fileHelper->archiveCSV($guestFilename);
|
53 |
+
}
|
54 |
+
}
|
55 |
+
}
|
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Model_Customer_Observer
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Create new contact or update info, also check for email change
|
7 |
+
* event: customer_save_before
|
8 |
+
* @param Varien_Event_Observer $observer
|
9 |
+
* @return $this
|
10 |
+
*/
|
11 |
+
public function handleCustomerSaveBefore(Varien_Event_Observer $observer)
|
12 |
+
{
|
13 |
+
$customer = $observer->getEvent()->getCustomer();
|
14 |
+
$email = $customer->getEmail();
|
15 |
+
$websiteId = $customer->getWebsiteId();
|
16 |
+
$customerId = $customer->getEntityId();
|
17 |
+
$isSubscribed = $customer->getIsSubscribed();
|
18 |
+
try{
|
19 |
+
$emailBefore = Mage::getModel('customer/customer')->load($customer->getId())->getEmail();
|
20 |
+
$contactModel = Mage::getModel('email_connector/contact')->loadByCustomerEmail($emailBefore, $websiteId);
|
21 |
+
//email change detection
|
22 |
+
if ($email != $emailBefore) {
|
23 |
+
Mage::helper('connector')->log('email change detected : ' . $email . ', after : ' . $emailBefore . ', website id : ' . $websiteId);
|
24 |
+
$enabled = Mage::helper('connector')->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_API_ENABLED, $websiteId);
|
25 |
+
|
26 |
+
if ($enabled) {
|
27 |
+
$client = Mage::helper('connector')->getWebsiteApiClient($websiteId);
|
28 |
+
$subscribersAddressBook = Mage::helper('connector')->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_SUBSCRIBERS_ADDRESS_BOOK_ID, $websiteId);
|
29 |
+
$response = $client->postContacts($emailBefore);
|
30 |
+
//check for matching email
|
31 |
+
if (isset($response->id)) {
|
32 |
+
if ($email != $response->email) {
|
33 |
+
$data = array(
|
34 |
+
'Email' => $email,
|
35 |
+
'EmailType' => 'Html'
|
36 |
+
);
|
37 |
+
//update the contact with same id - different email
|
38 |
+
$client->updateContact($response->id, $data);
|
39 |
+
|
40 |
+
}
|
41 |
+
if (!$isSubscribed && $response->status == 'Subscribed') {
|
42 |
+
$client->deleteAddressBookContact($subscribersAddressBook, $response->id);
|
43 |
+
}
|
44 |
+
} elseif (isset($response->message)) {
|
45 |
+
Mage::helper('connector')->log('Email change error : ' . $response->message);
|
46 |
+
}
|
47 |
+
}
|
48 |
+
$contactModel->setEmail($email);
|
49 |
+
}
|
50 |
+
|
51 |
+
$contactModel->setEmailImported(Dotdigitalgroup_Email_Model_Contact::EMAIL_CONTACT_NOT_IMPORTED)
|
52 |
+
->setCustomerId($customerId)
|
53 |
+
->save();
|
54 |
+
}catch(Exception $e){
|
55 |
+
Mage::logException($e);
|
56 |
+
}
|
57 |
+
|
58 |
+
return $this;
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Remove the contact on customer delete.
|
63 |
+
*
|
64 |
+
* @param Varien_Event_Observer $observer
|
65 |
+
*
|
66 |
+
* @return $this
|
67 |
+
*/
|
68 |
+
public function handleCustomerDeleteAfter(Varien_Event_Observer $observer)
|
69 |
+
{
|
70 |
+
$customer = $observer->getEvent()->getCustomer();
|
71 |
+
$email = $customer->getEmail();
|
72 |
+
$websiteId = $customer->getWebsiteId();
|
73 |
+
/**
|
74 |
+
* Remove contact.
|
75 |
+
*/
|
76 |
+
try{
|
77 |
+
$contactModel = Mage::getModel('email_connector/contact')->loadByCustomerEmail($email, $websiteId);
|
78 |
+
if ($contactModel->getId()) {
|
79 |
+
//remove contact
|
80 |
+
$contactModel->delete();
|
81 |
+
}
|
82 |
+
//remove from account
|
83 |
+
$client = Mage::helper('connector')->getWebsiteApiClient($websiteId);
|
84 |
+
$apiContact = $client->postContacts($email);
|
85 |
+
if(! isset($apiContact->message) && isset($apiContact->id))
|
86 |
+
$client->DeleteContact($apiContact->id);
|
87 |
+
|
88 |
+
}catch (Exception $e){
|
89 |
+
Mage::logException($e);
|
90 |
+
}
|
91 |
+
return $this;
|
92 |
+
}
|
93 |
+
}
|
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Model_Customer_Wishlist
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* @var int
|
7 |
+
*/
|
8 |
+
public $id;
|
9 |
+
/**
|
10 |
+
* @var int
|
11 |
+
*/
|
12 |
+
public $customer_id;
|
13 |
+
/**
|
14 |
+
* @var string
|
15 |
+
*/
|
16 |
+
public $email;
|
17 |
+
|
18 |
+
/**
|
19 |
+
* wishlist items.
|
20 |
+
* @var array
|
21 |
+
*/
|
22 |
+
public $items = array();
|
23 |
+
|
24 |
+
/**
|
25 |
+
* @var float
|
26 |
+
*/
|
27 |
+
protected $total_wishlist_value;
|
28 |
+
|
29 |
+
/**
|
30 |
+
* constructor.
|
31 |
+
*
|
32 |
+
* @param Mage_Customer_Model_Customer $customer
|
33 |
+
*/
|
34 |
+
public function __construct(Mage_Customer_Model_Customer $customer)
|
35 |
+
{
|
36 |
+
|
37 |
+
$this->setCustomerId($customer->getId());
|
38 |
+
$this->email = $customer->getEmail();
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* @param mixed $customer_id
|
43 |
+
*/
|
44 |
+
public function setCustomerId($customer_id)
|
45 |
+
{
|
46 |
+
$this->customer_id = $customer_id;
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* @return mixed
|
51 |
+
*/
|
52 |
+
public function getCustomerId()
|
53 |
+
{
|
54 |
+
return $this->customer_id;
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* @param $id
|
59 |
+
* @return $this
|
60 |
+
*/
|
61 |
+
public function setId($id)
|
62 |
+
{
|
63 |
+
$this->id = $id;
|
64 |
+
return $this;
|
65 |
+
}
|
66 |
+
|
67 |
+
/**
|
68 |
+
* @return mixed
|
69 |
+
*/
|
70 |
+
public function getId()
|
71 |
+
{
|
72 |
+
return $this->id;
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* set wishlist item.
|
77 |
+
*
|
78 |
+
* @param $item
|
79 |
+
*/
|
80 |
+
public function setItem($item)
|
81 |
+
{
|
82 |
+
$this->items[] = $item->expose();
|
83 |
+
|
84 |
+
$this->total_wishlist_value += $item->getTotalValueOfProduct();
|
85 |
+
}
|
86 |
+
|
87 |
+
/**
|
88 |
+
* @return array
|
89 |
+
*/
|
90 |
+
public function expose()
|
91 |
+
{
|
92 |
+
return get_object_vars($this);
|
93 |
+
}
|
94 |
+
}
|
@@ -8,18 +8,26 @@ class Dotdigitalgroup_Email_Model_Customer_Wishlist_Item
|
|
8 |
protected $qty;
|
9 |
protected $total_value_of_product;
|
10 |
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
{
|
13 |
$this->setSku($product->getSku());
|
14 |
$this->setName($product->getName());
|
15 |
}
|
16 |
|
17 |
/**
|
18 |
-
* @param
|
|
|
19 |
*/
|
20 |
public function setName($name)
|
21 |
{
|
22 |
$this->name = $name;
|
|
|
23 |
}
|
24 |
|
25 |
/**
|
@@ -31,11 +39,13 @@ class Dotdigitalgroup_Email_Model_Customer_Wishlist_Item
|
|
31 |
}
|
32 |
|
33 |
/**
|
34 |
-
* @param
|
|
|
35 |
*/
|
36 |
public function setQty($qty)
|
37 |
{
|
38 |
$this->qty = (int)$qty;
|
|
|
39 |
}
|
40 |
|
41 |
/**
|
@@ -55,7 +65,8 @@ class Dotdigitalgroup_Email_Model_Customer_Wishlist_Item
|
|
55 |
}
|
56 |
|
57 |
/**
|
58 |
-
* @param
|
|
|
59 |
*/
|
60 |
public function setPrice($product)
|
61 |
{
|
@@ -63,6 +74,7 @@ class Dotdigitalgroup_Email_Model_Customer_Wishlist_Item
|
|
63 |
$total = $this->price * $this->qty;
|
64 |
|
65 |
$this->total_value_of_product = number_format($total, 2);
|
|
|
66 |
}
|
67 |
|
68 |
/**
|
@@ -74,11 +86,13 @@ class Dotdigitalgroup_Email_Model_Customer_Wishlist_Item
|
|
74 |
}
|
75 |
|
76 |
/**
|
77 |
-
* @param
|
|
|
78 |
*/
|
79 |
public function setSku($sku)
|
80 |
{
|
81 |
$this->sku = $sku;
|
|
|
82 |
}
|
83 |
|
84 |
/**
|
@@ -88,13 +102,12 @@ class Dotdigitalgroup_Email_Model_Customer_Wishlist_Item
|
|
88 |
{
|
89 |
return $this->sku;
|
90 |
}
|
91 |
-
public function expose() {
|
92 |
|
|
|
|
|
|
|
|
|
|
|
93 |
return get_object_vars($this);
|
94 |
-
|
95 |
}
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
}
|
8 |
protected $qty;
|
9 |
protected $total_value_of_product;
|
10 |
|
11 |
+
|
12 |
+
/**
|
13 |
+
* construnctor.
|
14 |
+
*
|
15 |
+
* @param $product
|
16 |
+
*/
|
17 |
+
public function __construct($product)
|
18 |
{
|
19 |
$this->setSku($product->getSku());
|
20 |
$this->setName($product->getName());
|
21 |
}
|
22 |
|
23 |
/**
|
24 |
+
* @param $name
|
25 |
+
* @return $this
|
26 |
*/
|
27 |
public function setName($name)
|
28 |
{
|
29 |
$this->name = $name;
|
30 |
+
return $this;
|
31 |
}
|
32 |
|
33 |
/**
|
39 |
}
|
40 |
|
41 |
/**
|
42 |
+
* @param $qty
|
43 |
+
* @return $this
|
44 |
*/
|
45 |
public function setQty($qty)
|
46 |
{
|
47 |
$this->qty = (int)$qty;
|
48 |
+
return $this;
|
49 |
}
|
50 |
|
51 |
/**
|
65 |
}
|
66 |
|
67 |
/**
|
68 |
+
* @param $product
|
69 |
+
* @return $this
|
70 |
*/
|
71 |
public function setPrice($product)
|
72 |
{
|
74 |
$total = $this->price * $this->qty;
|
75 |
|
76 |
$this->total_value_of_product = number_format($total, 2);
|
77 |
+
return $this;
|
78 |
}
|
79 |
|
80 |
/**
|
86 |
}
|
87 |
|
88 |
/**
|
89 |
+
* @param $sku
|
90 |
+
* @return $this
|
91 |
*/
|
92 |
public function setSku($sku)
|
93 |
{
|
94 |
$this->sku = $sku;
|
95 |
+
return $this;
|
96 |
}
|
97 |
|
98 |
/**
|
102 |
{
|
103 |
return $this->sku;
|
104 |
}
|
|
|
105 |
|
106 |
+
/**
|
107 |
+
* @return array
|
108 |
+
*/
|
109 |
+
public function expose()
|
110 |
+
{
|
111 |
return get_object_vars($this);
|
|
|
112 |
}
|
|
|
|
|
|
|
|
|
113 |
}
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Model_Email_Template extends Mage_Core_Model_Email_Template
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Send transactional email to recipient
|
7 |
+
*
|
8 |
+
* @see Mage_Core_Model_Email_Template::sendTransactional()
|
9 |
+
* @param string $templateId
|
10 |
+
* @param string|array $sender sneder information, can be declared as part of config path
|
11 |
+
* @param string $email recipient email
|
12 |
+
* @param string $name recipient name
|
13 |
+
* @param array $vars varianles which can be used in template
|
14 |
+
* @param int|null $storeId
|
15 |
+
* @return Mage_Core_Model_Email_Template
|
16 |
+
*/
|
17 |
+
public function sendTransactional($templateId, $sender, $email, $name, $vars=array(), $storeId=null)
|
18 |
+
{
|
19 |
+
if (!Mage::helper('connector/transactional')->isMapped($templateId)) {
|
20 |
+
return parent::sendTransactional($templateId, $sender, $email, $name, $vars, $storeId);
|
21 |
+
} else {
|
22 |
+
$this->setSentSuccess(true);
|
23 |
+
return $this;
|
24 |
+
}
|
25 |
+
}
|
26 |
+
|
27 |
+
}
|
@@ -0,0 +1,146 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Model_Email_Template_Mailer extends Mage_Core_Model_Email_Template_Mailer
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Registred sales emails that can be mapped as transactional emails.
|
7 |
+
*
|
8 |
+
* @var array
|
9 |
+
*/
|
10 |
+
private $_registered = array(
|
11 |
+
'sales_email_order_template' => 'New Order',
|
12 |
+
'sales_email_order_guest_template' => 'New Order Guest',
|
13 |
+
'sales_email_order_comment_template' => 'Order Update',
|
14 |
+
'sales_email_order_comment_guest_template' => 'Order Update for Guest',
|
15 |
+
'sales_email_invoice_template' => 'New Invoice',
|
16 |
+
'sales_email_invoice_guest_template' => 'New Invoice for Guest',
|
17 |
+
'sales_email_invoice_comment_template' => 'Invoice Update',
|
18 |
+
'sales_email_invoice_comment_guest_template' => 'Invoice Update for Guest',
|
19 |
+
'sales_email_creditmemo_template' => 'New Credit Memo',
|
20 |
+
'sales_email_creditmemo_guest_template' => 'New Credit Memo for Guest',
|
21 |
+
'sales_email_creditmemo_comment_template' => 'Credit Memo Update',
|
22 |
+
'sales_email_creditmemo_comment_guest_template' => 'Credit Memo Update for Guest',
|
23 |
+
'sales_email_shipment_template' => 'New Shipment',
|
24 |
+
'sales_email_shipment_guest_template' => 'New Shipment for Guest',
|
25 |
+
'sales_email_shipment_comment_template' => 'Shipment Update',
|
26 |
+
'sales_email_shipment_comment_guest_template' => 'Shipment Update for Guest',
|
27 |
+
);
|
28 |
+
/**
|
29 |
+
* customer emails that can be mapped as transactional emails.
|
30 |
+
*
|
31 |
+
* @var array
|
32 |
+
*/
|
33 |
+
private $_registeredCustomer = array(
|
34 |
+
'customer_create_account_email_template' => 'New Customer Account'
|
35 |
+
);
|
36 |
+
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Send transactional emails.
|
40 |
+
*
|
41 |
+
* @return $this|Mage_Core_Model_Email_Template_Mailer
|
42 |
+
*/
|
43 |
+
public function send()
|
44 |
+
{
|
45 |
+
Mage::helper('connector')->log('template id : ' . $this->getTemplateId());
|
46 |
+
$templateParams = $this->getTemplateParams();
|
47 |
+
|
48 |
+
$transEnabled = Mage::getStoreConfig(Dotdigitalgroup_Email_Helper_Transactional::XML_PATH_TRANSACTIONAL_API_ENABLED);
|
49 |
+
//Disable the emails if the transactional data is mapped
|
50 |
+
if (Mage::helper('connector/transactional')->isMapped($this->getTemplateId()) && $transEnabled) {
|
51 |
+
if (array_key_exists($this->getTemplateId(), $this->_registered)) {
|
52 |
+
$this->_registerOrderCampaign($templateParams);
|
53 |
+
return $this;
|
54 |
+
|
55 |
+
}
|
56 |
+
if (array_key_exists($this->getTemplateId(), $this->_registeredCustomer)) {
|
57 |
+
$this->_registerCustomer($templateParams);
|
58 |
+
return $this;
|
59 |
+
}
|
60 |
+
Mage::helper('connector')->log('not matching registeredd templates');
|
61 |
+
}
|
62 |
+
|
63 |
+
Mage::helper('connector')->log('NOT MAPPED : ' . $this->getTemplateId() . ', enabled : ' . $transEnabled);
|
64 |
+
|
65 |
+
$emailTemplate = Mage::getModel('core/email_template');
|
66 |
+
// Send all emails from corresponding list
|
67 |
+
while (!empty($this->_emailInfos)) {
|
68 |
+
$emailInfo = array_pop($this->_emailInfos);
|
69 |
+
// Handle "Bcc" recepients of the current email
|
70 |
+
$emailTemplate->addBcc($emailInfo->getBccEmails());
|
71 |
+
// Set required design parameters and delegate email sending to Mage_Core_Model_Email_Template
|
72 |
+
$emailTemplate->setDesignConfig(array('area' => 'frontend', 'store' => $this->getStoreId()))
|
73 |
+
->sendTransactional(
|
74 |
+
$this->getTemplateId(),
|
75 |
+
$this->getSender(),
|
76 |
+
$emailInfo->getToEmails(),
|
77 |
+
$emailInfo->getToNames(),
|
78 |
+
$this->getTemplateParams(),
|
79 |
+
$this->getStoreId()
|
80 |
+
);
|
81 |
+
}
|
82 |
+
return $this;
|
83 |
+
}
|
84 |
+
|
85 |
+
|
86 |
+
/**
|
87 |
+
* register sales order campaign.
|
88 |
+
*
|
89 |
+
* @param $data
|
90 |
+
*/
|
91 |
+
protected function _registerOrderCampaign($data)
|
92 |
+
{
|
93 |
+
$order = $data['order'];
|
94 |
+
$storeId = $order->getStoreId();
|
95 |
+
$campaignId = Mage::helper('connector/transactional')->getTransactionalCampaignId($this->getTemplateId(), $storeId);
|
96 |
+
if ($campaignId) {
|
97 |
+
Mage::helper('connector')->log('-- Sales Order :' . $campaignId);
|
98 |
+
try{
|
99 |
+
$now = Mage::getSingleton('core/date')->gmtDate();
|
100 |
+
//save email for sending
|
101 |
+
$emailCampaign = Mage::getModel('email_connector/campaign');
|
102 |
+
$emailCampaign->setOrderIncrementId($order->getRealOrderId())
|
103 |
+
->setQuoteId($order->getQuoteId())
|
104 |
+
->setEmail($order->getCustomerEmail())
|
105 |
+
->setCustomerId($order->getCustomerId())
|
106 |
+
->setStoreId($storeId)
|
107 |
+
->setCampaignId($campaignId)
|
108 |
+
->setEventName($this->_registered[$this->getTemplateId()])
|
109 |
+
->setCreatedAt($now)
|
110 |
+
;
|
111 |
+
$emailCampaign->save();
|
112 |
+
}catch (Exception $e){
|
113 |
+
Mage::logException($e);
|
114 |
+
}
|
115 |
+
}
|
116 |
+
}
|
117 |
+
|
118 |
+
/**
|
119 |
+
* register customer campaign.
|
120 |
+
*
|
121 |
+
* @param $data
|
122 |
+
*/
|
123 |
+
protected function _registerCustomer($data){
|
124 |
+
$customer = $data['customer'];
|
125 |
+
$storeId = $customer->getStoreId();
|
126 |
+
$campaignId = Mage::helper('connector/transactional')->getTransactionalCampaignId($this->getTemplateId(), $storeId);
|
127 |
+
if ($campaignId) {
|
128 |
+
Mage::helper('connector')->log('-- Customer campaign: ' . $campaignId);
|
129 |
+
try{
|
130 |
+
$now = Mage::getSingleton('core/date')->gmtDate();
|
131 |
+
//save email for sending
|
132 |
+
$emailCampaign = Mage::getModel('email_connector/campaign');
|
133 |
+
$emailCampaign->setEmail($customer->getEmail())
|
134 |
+
->setCustomerId($customer->getId())
|
135 |
+
->setStoreId($customer->getStoreId())
|
136 |
+
->setCampaignId($campaignId)
|
137 |
+
->setEventName($this->_registeredCustomer[$this->getTemplateId()])
|
138 |
+
->setCreatedAt($now);
|
139 |
+
$emailCampaign->save();
|
140 |
+
}catch (Exception $e) {
|
141 |
+
Mage::logException($e);
|
142 |
+
}
|
143 |
+
}
|
144 |
+
}
|
145 |
+
|
146 |
+
}
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Model_Newsletter_Observer
|
4 |
+
{
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Newslleter subsciber event.
|
8 |
+
*
|
9 |
+
* @param Varien_Event_Observer $observer
|
10 |
+
*
|
11 |
+
* @return $this
|
12 |
+
*/
|
13 |
+
public function handleNewsletterSubscriberSave(Varien_Event_Observer $observer)
|
14 |
+
{
|
15 |
+
$subscriber = $observer->getEvent()->getSubscriber();
|
16 |
+
$storeId = $subscriber->getStoreId();
|
17 |
+
$email = $subscriber->getEmail();
|
18 |
+
$subscriberStatus = $subscriber->getSubscriberStatus();
|
19 |
+
$contactId = '';
|
20 |
+
$helper = Mage::helper('connector');
|
21 |
+
$websiteId = Mage::app()->getStore($subscriber->getStoreId())->getWebsiteId();
|
22 |
+
$contactEmail = Mage::getModel('email_connector/contact')->loadByCustomerEmail($email, $websiteId);
|
23 |
+
try{
|
24 |
+
/**
|
25 |
+
* Subscribe a contact
|
26 |
+
*/
|
27 |
+
if ($subscriberStatus == Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED) {
|
28 |
+
$contactEmail->setSubscriberStatus($subscriberStatus)
|
29 |
+
->setIsSubscriber(1);
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Resubscribe suppressed contacts.
|
33 |
+
*/
|
34 |
+
$client = Mage::helper('connector')->getWebsiteApiClient($websiteId);
|
35 |
+
$apiContact = $client->getContactByEmail($email);
|
36 |
+
if (isset($apiContact->status) && $apiContact->status == 'Suppressed') {
|
37 |
+
$client->PostContactsResubscribe($apiContact);
|
38 |
+
}
|
39 |
+
$client->PostContactsResubscribe($apiContact);
|
40 |
+
$contactEmail->setSuppressed(null);
|
41 |
+
} else {
|
42 |
+
/**
|
43 |
+
* Unsubscribe contact
|
44 |
+
*/
|
45 |
+
$client = Mage::helper('connector')->getWebsiteApiClient($websiteId);
|
46 |
+
if (!$contactEmail->getContactId()) {
|
47 |
+
//if contact id is not set get the contact_id
|
48 |
+
$result = $client->postContacts($email);
|
49 |
+
$contactId = $result->id;
|
50 |
+
} else {
|
51 |
+
$contactId = $contactEmail->getContactId();
|
52 |
+
}
|
53 |
+
if (is_numeric($contactId)) {
|
54 |
+
$client->deleteAddressBookContact($helper->getSubscriberAddressBook($websiteId), $contactId);
|
55 |
+
} else {
|
56 |
+
Mage::helper('connector')->log('CONTACT ID IS EMPTY : ' . $contactId . ' email : ' . $email);
|
57 |
+
}
|
58 |
+
$contactEmail->setIsSubscriber(null);
|
59 |
+
}
|
60 |
+
|
61 |
+
$contactEmail->setStoreId($storeId)
|
62 |
+
->setContactId($contactId)
|
63 |
+
->save();
|
64 |
+
|
65 |
+
}catch(Exception $e){
|
66 |
+
Mage::logException($e);
|
67 |
+
}
|
68 |
+
return $this;
|
69 |
+
}
|
70 |
+
}
|
@@ -0,0 +1,142 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Model_Newsletter_Subscriber
|
4 |
+
{
|
5 |
+
const STATUS_SUBSCRIBED = 1;
|
6 |
+
const STATUS_NOT_ACTIVE = 2;
|
7 |
+
const STATUS_UNSUBSCRIBED = 3;
|
8 |
+
const STATUS_UNCONFIRMED = 4;
|
9 |
+
|
10 |
+
protected $_start;
|
11 |
+
|
12 |
+
/**
|
13 |
+
* SUBSCRIBER SYNC.
|
14 |
+
* @return $this
|
15 |
+
*/
|
16 |
+
public function sync()
|
17 |
+
{
|
18 |
+
/** @var Dotdigitalgroup_Email_Helper_Data $helper */
|
19 |
+
$helper = Mage::helper('connector');
|
20 |
+
$helper->log('---------------------- Start subscriber sync -------------------');
|
21 |
+
$this->_start = microtime(true);
|
22 |
+
|
23 |
+
foreach (Mage::app()->getWebsites(true) as $website) {
|
24 |
+
if (Mage::helper('connector')->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_SYNC_SUBSCRIBER_ENABLED, $website))
|
25 |
+
$this->exportSubscribersPerWebsite($website);
|
26 |
+
}
|
27 |
+
|
28 |
+
return $this;
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Export subscriber per website.
|
33 |
+
*
|
34 |
+
* @param $website
|
35 |
+
*/
|
36 |
+
public function exportSubscribersPerWebsite($website)
|
37 |
+
{
|
38 |
+
$updated = 0;
|
39 |
+
$helper = Mage::helper('connector');
|
40 |
+
$fileHelper = Mage::helper('connector/file');
|
41 |
+
$limit = $helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_SYNC_LIMIT, $website);
|
42 |
+
$subscribers = Mage::getModel('email_connector/contact')->getSubscribersToImport($website, $limit);
|
43 |
+
if (count($subscribers)) {
|
44 |
+
$client = Mage::helper('connector')->getWebsiteApiClient($website);
|
45 |
+
$subscribersFilename = strtolower($website->getCode() . '_subscribers_' . date('d_m_Y_Hi') . '.csv');
|
46 |
+
//get mapped storename
|
47 |
+
$subscriberStorename = $helper->getMappedStoreName($website);
|
48 |
+
//file headers
|
49 |
+
$fileHelper->outputCSV($fileHelper->getFilePath($subscribersFilename), array('Email', 'emailType', $subscriberStorename));
|
50 |
+
foreach ($subscribers as $subscriber) {
|
51 |
+
try{
|
52 |
+
$email = $subscriber->getEmail();
|
53 |
+
$subscriber->setSubscriberImported(1)->save();
|
54 |
+
$subscriber = Mage::getModel('newsletter/subscriber')->loadByEmail($email);
|
55 |
+
$storeName = Mage::app()->getStore($subscriber->getStoreId())->getName();
|
56 |
+
// save data for subscribers
|
57 |
+
$fileHelper->outputCSV($fileHelper->getFilePath($subscribersFilename), array($email, 'Html', $storeName));
|
58 |
+
$updated++;
|
59 |
+
}catch (Exception $e){
|
60 |
+
Mage::logException($e);
|
61 |
+
}
|
62 |
+
}
|
63 |
+
$helper->log('Subscriber filename: ' . $subscribersFilename);
|
64 |
+
//Add to subscriber address book
|
65 |
+
$client->postAddressBookContactsImport($subscribersFilename, $helper->getSubscriberAddressBook($website));
|
66 |
+
$fileHelper->archiveCSV($subscribersFilename);
|
67 |
+
}
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Unsubscribe suppressed contacts.
|
72 |
+
* @param bool $force set 10years old
|
73 |
+
* @return mixed
|
74 |
+
*/
|
75 |
+
public function unsubscribe($force = false)
|
76 |
+
{
|
77 |
+
$result['customers'] = 0;
|
78 |
+
$limit = 5;
|
79 |
+
$max_to_select = 1000;
|
80 |
+
$date = Zend_Date::now()->subHour(1);
|
81 |
+
$helper = Mage::helper('connector');
|
82 |
+
// force sync all customers
|
83 |
+
if($force)
|
84 |
+
$date = $date->subYear(10);
|
85 |
+
// datetime format string
|
86 |
+
$dateString = $date->toString(Zend_Date::W3C);
|
87 |
+
|
88 |
+
/**
|
89 |
+
* 1. Sync all suppressed for each store
|
90 |
+
*/
|
91 |
+
foreach (Mage::app()->getWebsites(true) as $website) {
|
92 |
+
if (! Mage::helper('connector')->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_API_ENABLED, $website))
|
93 |
+
continue;
|
94 |
+
$contacts = array();
|
95 |
+
$skip = $i = 0;
|
96 |
+
$client = Mage::helper('connector')->getWebsiteApiClient($website);
|
97 |
+
//there is a maximum of request we need to loop to get more suppressed contacts
|
98 |
+
for ($i=0; $i<= $limit;$i++) {
|
99 |
+
$apiContacts = $client->getContactsSuppressedSinceDate($dateString, $max_to_select , $skip);
|
100 |
+
// skip no more contacts
|
101 |
+
if(empty($apiContacts))
|
102 |
+
break;
|
103 |
+
$contacts = array_merge($contacts, $apiContacts);
|
104 |
+
$skip += 1000;
|
105 |
+
}
|
106 |
+
$subscriberBookId = $helper->getSubscriberAddressBook($website);
|
107 |
+
// suppressed contacts to unsubscibe
|
108 |
+
foreach ($contacts as $apiContact) {
|
109 |
+
if (isset($apiContact->suppressedContact)) {
|
110 |
+
$suppressedContact = $apiContact->suppressedContact;
|
111 |
+
$email = $suppressedContact->email;
|
112 |
+
$contactId = $suppressedContact->id;
|
113 |
+
try{
|
114 |
+
/**
|
115 |
+
* 2. Unsubscribe customer.
|
116 |
+
*/
|
117 |
+
$subscriber = Mage::getModel('newsletter/subscriber')->loadByEmail($email);
|
118 |
+
if ($subscriber->getStatus() == Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED) {
|
119 |
+
$subscriber->setStatus(Mage_Newsletter_Model_Subscriber::STATUS_UNSUBSCRIBED);
|
120 |
+
$subscriber->save();
|
121 |
+
// remove from subscriber address-book
|
122 |
+
$client->deleteAddressBookContact($subscriberBookId, $contactId);
|
123 |
+
}
|
124 |
+
//mark contact as suppressed and unsubscribe
|
125 |
+
$contactCollection = Mage::getModel('email_connector/contact')->getCollection()
|
126 |
+
->addFieldToFilter('email', $email)
|
127 |
+
->addFieldToFilter('website_id', $website->getId());
|
128 |
+
//unsubscribe from the email contact table.
|
129 |
+
foreach ($contactCollection as $contact) {
|
130 |
+
$contact->setIsSubscriber(null)
|
131 |
+
->setSuppressed(1)->save();
|
132 |
+
}
|
133 |
+
}catch (Exception $e){
|
134 |
+
Mage::logException($e);
|
135 |
+
}
|
136 |
+
}
|
137 |
+
}
|
138 |
+
}
|
139 |
+
|
140 |
+
return $result;
|
141 |
+
}
|
142 |
+
}
|
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Model_Order extends Mage_Core_Model_Abstract
|
4 |
+
{
|
5 |
+
const EMAIL_ORDER_NOT_IMPORTED = null;
|
6 |
+
/**
|
7 |
+
* constructor
|
8 |
+
*/
|
9 |
+
public function _construct()
|
10 |
+
{
|
11 |
+
parent::_construct();
|
12 |
+
$this->_init('email_connector/order');
|
13 |
+
}
|
14 |
+
|
15 |
+
/**
|
16 |
+
* @return $this|Mage_Core_Model_Abstract
|
17 |
+
*/
|
18 |
+
protected function _beforeSave()
|
19 |
+
{
|
20 |
+
parent::_beforeSave();
|
21 |
+
$now = Mage::getSingleton('core/date')->gmtDate();
|
22 |
+
if ($this->isObjectNew()) {
|
23 |
+
$this->setCreatedAt($now);
|
24 |
+
}
|
25 |
+
return $this;
|
26 |
+
}
|
27 |
+
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Load the email order by quote id.
|
31 |
+
* @param $orderId
|
32 |
+
* @param $quoteId
|
33 |
+
* @return $this|Varien_Object
|
34 |
+
*/
|
35 |
+
public function loadByOrderId($orderId, $quoteId)
|
36 |
+
{
|
37 |
+
$collection = $this->getCollection()
|
38 |
+
->addFieldToFilter('order_id', $orderId)
|
39 |
+
->addFieldToFilter('quote_id', $quoteId);
|
40 |
+
if ($collection->count()) {
|
41 |
+
return $collection->getFirstItem();
|
42 |
+
} else {
|
43 |
+
$this->setOrderId($orderId)
|
44 |
+
->setQuoteId($quoteId);
|
45 |
+
}
|
46 |
+
return $this;
|
47 |
+
}
|
48 |
+
|
49 |
+
|
50 |
+
public function getEmailOrderRow($orderId, $quoteId, $storeId)
|
51 |
+
{
|
52 |
+
|
53 |
+
$collection = $this->getCollection()
|
54 |
+
->addFieldToFilter('order_id', $orderId)
|
55 |
+
->addFieldToFilter('quote_id', $quoteId)
|
56 |
+
->addFieldToFilter('store_id', $storeId);
|
57 |
+
|
58 |
+
if ($collection->count()) {
|
59 |
+
return $collection->getFirstItem();
|
60 |
+
} else {
|
61 |
+
$now = Mage::getSingleton('core/date')->gmtDate();
|
62 |
+
|
63 |
+
$this->setOrderId($orderId)
|
64 |
+
->setQuoteId($quoteId)
|
65 |
+
->setStoreId($storeId)
|
66 |
+
->setCreatedAt($now);
|
67 |
+
}
|
68 |
+
return $this;
|
69 |
+
|
70 |
+
}
|
71 |
+
public function getOrdersToImport($storeIds, $limit)
|
72 |
+
{
|
73 |
+
$collection = $this->getCollection()
|
74 |
+
->addFieldToFilter('email_imported', array('null' => true))
|
75 |
+
->addFieldToFilter('store_id', array('in' => $storeIds));
|
76 |
+
|
77 |
+
$collection->getSelect()->limit($limit);
|
78 |
+
return $collection->load();
|
79 |
+
}
|
80 |
+
}
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Model_Resource_Campaign extends Mage_Core_Model_Resource_Db_Abstract
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* constructor.
|
7 |
+
*/
|
8 |
+
protected function _construct()
|
9 |
+
{
|
10 |
+
$this->_init('email_connector/campaign', 'id');
|
11 |
+
|
12 |
+
}
|
13 |
+
}
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Model_Resource_Campaign_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* constructor.
|
7 |
+
*/
|
8 |
+
public function _construct()
|
9 |
+
{
|
10 |
+
parent::_construct();
|
11 |
+
$this->_init('email_connector/campaign');
|
12 |
+
}
|
13 |
+
}
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Model_Resource_Contact extends Mage_Core_Model_Mysql4_Abstract
|
4 |
+
{
|
5 |
+
|
6 |
+
/**
|
7 |
+
* constructor.
|
8 |
+
*/
|
9 |
+
protected function _construct()
|
10 |
+
{
|
11 |
+
$this->_init('email_connector/contact', 'email_contact_id');
|
12 |
+
|
13 |
+
}
|
14 |
+
}
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Model_Resource_Contact_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* constructor.
|
7 |
+
*/
|
8 |
+
protected function _construct()
|
9 |
+
{
|
10 |
+
parent::_construct();
|
11 |
+
$this->_init('email_connector/contact');
|
12 |
+
}
|
13 |
+
|
14 |
+
|
15 |
+
/**
|
16 |
+
* @param $website
|
17 |
+
* @return $this
|
18 |
+
*/
|
19 |
+
public function addWebsiteFilter($website)
|
20 |
+
{
|
21 |
+
$this->addFilter('website_id', $website);
|
22 |
+
return $this;
|
23 |
+
}
|
24 |
+
|
25 |
+
}
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Model_Resource_Order extends Mage_Core_Model_Resource_Db_Abstract
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* cosntructor.
|
7 |
+
*/
|
8 |
+
protected function _construct()
|
9 |
+
{
|
10 |
+
$this->_init('email_connector/order', 'email_order_id');
|
11 |
+
}
|
12 |
+
}
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Model_Resource_Order_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
|
4 |
+
{
|
5 |
+
|
6 |
+
/**
|
7 |
+
* constructor.
|
8 |
+
*/
|
9 |
+
public function _construct()
|
10 |
+
{
|
11 |
+
parent::_construct();
|
12 |
+
$this->_init('email_connector/order');
|
13 |
+
}
|
14 |
+
|
15 |
+
|
16 |
+
|
17 |
+
|
18 |
+
}
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Model_Resource_Setup extends Mage_Eav_Model_Entity_Setup
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* This method returns true if the attribute exists.
|
7 |
+
*
|
8 |
+
* @param string|int $entityTypeId
|
9 |
+
* @param string|int $attributeId
|
10 |
+
* @return bool
|
11 |
+
*/
|
12 |
+
public function attributeExists($entityTypeId, $attributeId)
|
13 |
+
{
|
14 |
+
try
|
15 |
+
{
|
16 |
+
$entityTypeId = $this->getEntityTypeId($entityTypeId);
|
17 |
+
$attributeId = $this->getAttributeId($entityTypeId, $attributeId);
|
18 |
+
return !empty($attributeId);
|
19 |
+
}
|
20 |
+
catch(Exception $e)
|
21 |
+
{
|
22 |
+
return FALSE;
|
23 |
+
}
|
24 |
+
}
|
25 |
+
|
26 |
+
}
|
@@ -0,0 +1,141 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Model_Sales_Observer
|
4 |
+
{
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Register the order status.
|
8 |
+
* @param $observer
|
9 |
+
* @return $this
|
10 |
+
*/
|
11 |
+
public function handleSalesOrderSaveBefore($observer)
|
12 |
+
{
|
13 |
+
$order = $observer->getEvent()->getOrder();
|
14 |
+
// the reloaded status
|
15 |
+
$reloaded = Mage::getModel('sales/order')->load($order->getId());
|
16 |
+
Mage::register('sales_order_status_before', $reloaded->getStatus());
|
17 |
+
return $this;
|
18 |
+
}
|
19 |
+
/**
|
20 |
+
* save/reset the order as transactional data.
|
21 |
+
*
|
22 |
+
* @param Varien_Event_Observer $observer
|
23 |
+
* @return $this
|
24 |
+
*/
|
25 |
+
public function handleSalesOrderSaveAfter(Varien_Event_Observer $observer)
|
26 |
+
{
|
27 |
+
try{
|
28 |
+
$order = $observer->getEvent()->getOrder();
|
29 |
+
$status = $order->getStatus();
|
30 |
+
$storeId = $order->getStoreId();
|
31 |
+
$emailOrder = Mage::getModel('email_connector/order')->loadByOrderId($order->getEntityId(), $order->getQuoteId());
|
32 |
+
//reimport email order
|
33 |
+
$emailOrder->setUpdatedAt($order->getUpdatedAt())
|
34 |
+
->setEmailImported(null)
|
35 |
+
->setStoreId($storeId)
|
36 |
+
->save();
|
37 |
+
// check for order status change
|
38 |
+
$statusBefore = Mage::registry('sales_order_status_before');
|
39 |
+
Mage::helper('connector')->log('Order status : '. $status . ', before : '. $statusBefore);
|
40 |
+
if ( $status!= $statusBefore) {
|
41 |
+
$smsCampaign = Mage::getModel('email_connector/sms_campaign', $order);
|
42 |
+
$smsCampaign->setStatus($status);
|
43 |
+
$smsCampaign->sendSms();
|
44 |
+
}
|
45 |
+
//admin oder when editing the first one is canceled
|
46 |
+
Mage::unregister('sales_order_status_before');
|
47 |
+
}catch(Exception $e){
|
48 |
+
Mage::logException($e);
|
49 |
+
}
|
50 |
+
return $this;
|
51 |
+
}
|
52 |
+
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Create new order event.
|
56 |
+
* @param Varien_Event_Observer $observer
|
57 |
+
*
|
58 |
+
* @return $this
|
59 |
+
* @throws Mage_Core_Exception
|
60 |
+
*/
|
61 |
+
public function handleSalesOrderPlaceAfter(Varien_Event_Observer $observer)
|
62 |
+
{
|
63 |
+
$data = new Varien_Object();
|
64 |
+
$order = $observer->getEvent()->getOrder();
|
65 |
+
$website = Mage::app()->getWebsite($order->getWebsiteId());
|
66 |
+
$websiteName = $website->getName();
|
67 |
+
if (Mage::helper('connector')->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Transactional::XML_PATH_TRANSACTIONAL_API_ENABLED, $website)) {
|
68 |
+
$storeName = Mage::app()->getStore($order->getStoreId())->getName();
|
69 |
+
$data->setCustomerId($order->getCustomerId())
|
70 |
+
->setCustomerEmail($order->getCustomerEmail())
|
71 |
+
->setOrderId($order->getId())
|
72 |
+
->setOrderIncrementId($order->getIncrementId())
|
73 |
+
->setWebsiteName($websiteName)
|
74 |
+
->setStoreName($storeName)
|
75 |
+
->setWebsite($website)
|
76 |
+
->setOrderDate($order->getCreatedAt());
|
77 |
+
|
78 |
+
Mage::helper('connector/transactional')->updateContactData($data);
|
79 |
+
}
|
80 |
+
|
81 |
+
return $this;
|
82 |
+
}
|
83 |
+
|
84 |
+
/**
|
85 |
+
* Sales order refund event.
|
86 |
+
*
|
87 |
+
* @param Varien_Event_Observer $observer
|
88 |
+
*
|
89 |
+
* @return $this
|
90 |
+
*/
|
91 |
+
public function handleSalesOrderRefund(Varien_Event_Observer $observer)
|
92 |
+
{
|
93 |
+
Mage::helper('connector')->log('observer sales order refund');
|
94 |
+
$creditmemo = $observer->getEvent()->getCreditmemo();
|
95 |
+
$storeId = $creditmemo->getStoreId();
|
96 |
+
$order = $creditmemo->getOrder();
|
97 |
+
$orderId = $order->getEntityId();
|
98 |
+
$quoteId = $order->getQuoteId();
|
99 |
+
|
100 |
+
try{
|
101 |
+
/**
|
102 |
+
* Reimport transactional data.
|
103 |
+
*/
|
104 |
+
$emailOrder = Mage::getModel('email_connector/order')->loadByOrderId($orderId, $quoteId, $storeId);
|
105 |
+
if (!$emailOrder->getId()) {
|
106 |
+
Mage::helper('connector')->log('ERROR Creditmemmo Order not found :' . $orderId . ', quote id : ' . $quoteId . ', store id ' . $storeId);
|
107 |
+
return $this;
|
108 |
+
}
|
109 |
+
$emailOrder->setEmailImported(Dotdigitalgroup_Email_Model_Contact::EMAIL_CONTACT_NOT_IMPORTED)->save();
|
110 |
+
}catch (Exception $e){
|
111 |
+
Mage::logException($e);
|
112 |
+
}
|
113 |
+
|
114 |
+
return $this;
|
115 |
+
}
|
116 |
+
|
117 |
+
/**
|
118 |
+
* Sales cancel order event, remove transactional data.
|
119 |
+
*
|
120 |
+
* @param Varien_Event_Observer $observer
|
121 |
+
*
|
122 |
+
* @return $this
|
123 |
+
*/
|
124 |
+
public function hangleSalesOrderCancel(Varien_Event_Observer $observer)
|
125 |
+
{
|
126 |
+
$order = $observer->getEvent()->getOrder();
|
127 |
+
$storeId = $order->getStoreId();
|
128 |
+
$websiteId = Mage::app()->getStore($storeId)->getWebsiteId();
|
129 |
+
$customerEmail = $order->getCustomerEmail();
|
130 |
+
$helper = Mage::helper('connector');
|
131 |
+
if ($helper->isEnabled($websiteId)) {
|
132 |
+
$client = Mage::getModel('email_connector/apiconnector_client');
|
133 |
+
$client->setApiUsername($helper->getApiUsername($websiteId));
|
134 |
+
$client->setApiPassword($helper->getApiPassword($websiteId));
|
135 |
+
// delete the order transactional data
|
136 |
+
$client->deleteContactTransactionalData($customerEmail, 'Orders');
|
137 |
+
}
|
138 |
+
|
139 |
+
return $this;
|
140 |
+
}
|
141 |
+
}
|
@@ -0,0 +1,140 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Model_Sales_Order
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* @var array
|
7 |
+
*/
|
8 |
+
protected $accounts = array();
|
9 |
+
/**
|
10 |
+
* @var string
|
11 |
+
*/
|
12 |
+
private $_apiUsername;
|
13 |
+
/**
|
14 |
+
* @var string
|
15 |
+
*/
|
16 |
+
private $_apiPassword;
|
17 |
+
|
18 |
+
/**
|
19 |
+
* initial sync the transactional data
|
20 |
+
* @return array
|
21 |
+
*/
|
22 |
+
public function sync()
|
23 |
+
{
|
24 |
+
$client = Mage::getModel('email_connector/apiconnector_client');
|
25 |
+
// Initialise a return hash containing results of our sync attempt
|
26 |
+
$this->_searchAccounts();
|
27 |
+
|
28 |
+
foreach ($this->accounts as $account) {
|
29 |
+
$orders = $account->getOrders();
|
30 |
+
if (count($orders)) {
|
31 |
+
$client->setApiUsername($account->getApiUsername())
|
32 |
+
->setApiPassword($account->getApiPassword());
|
33 |
+
Mage::helper('connector')->log('--------- Order sync ----------');
|
34 |
+
$client->postContactsTransactionalDataImport($orders, 'Orders');
|
35 |
+
Mage::helper('connector')->log('----------end order sync----------');
|
36 |
+
}
|
37 |
+
unset($this->accounts[$account->getApiUsername()]);
|
38 |
+
}
|
39 |
+
return $this;
|
40 |
+
}
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Search the configuration data per website
|
44 |
+
*/
|
45 |
+
private function _searchAccounts()
|
46 |
+
{
|
47 |
+
$helper = Mage::helper('connector');
|
48 |
+
foreach (Mage::app()->getWebsites(true) as $website) {
|
49 |
+
if ($helper->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_SYNC_ORDER_ENABLED, $website)) {
|
50 |
+
$this->_apiUsername = $helper->getApiUsername($website);
|
51 |
+
$this->_apiPassword = $helper->getApiPassword($website);
|
52 |
+
// limit for orders included to sync
|
53 |
+
$limit = Mage::helper('connector')->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_TRANSACTIONAL_DATA_SYNC_LIMIT, $website);
|
54 |
+
if (!isset($this->accounts[$this->_apiUsername])) {
|
55 |
+
$account = Mage::getModel('email_connector/connector_account')
|
56 |
+
->setApiUsername($this->_apiUsername)
|
57 |
+
->setApiPassword($this->_apiPassword);
|
58 |
+
$this->accounts[$this->_apiUsername] = $account;
|
59 |
+
}
|
60 |
+
$this->accounts[$this->_apiUsername]->setOrders($this->getConnectorOrders($website, $limit));
|
61 |
+
}
|
62 |
+
}
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* get all order to import.
|
67 |
+
* @param $website
|
68 |
+
* @param int $limit
|
69 |
+
* @return array
|
70 |
+
*/
|
71 |
+
public function getConnectorOrders($website, $limit = 100)
|
72 |
+
{
|
73 |
+
$orders = $customers = array();
|
74 |
+
$storeIds = $website->getStoreIds();
|
75 |
+
$orderModel = Mage::getModel('email_connector/order');
|
76 |
+
if(empty($storeIds))
|
77 |
+
return;
|
78 |
+
$orderCollection = $orderModel->getOrdersToImport($storeIds, $limit);
|
79 |
+
foreach ($orderCollection as $order) {
|
80 |
+
try {
|
81 |
+
$salesOrder = Mage::getModel('sales/order')->load($order->getOrderId());
|
82 |
+
$storeId = $order->getStoreId();
|
83 |
+
$websiteId = Mage::app()->getStore($storeId)->getWebsiteId();
|
84 |
+
/**
|
85 |
+
* Add guest to contacts table.
|
86 |
+
*/
|
87 |
+
if ($salesOrder->getCustomerIsGuest()) {
|
88 |
+
$this->_createGuestContact($salesOrder->getCustomerEmail(), $websiteId, $storeId);
|
89 |
+
}
|
90 |
+
if ($salesOrder->getId()) {
|
91 |
+
$connectorOrder = Mage::getModel('email_connector/connector_order', $salesOrder);
|
92 |
+
$orders[] = $connectorOrder;
|
93 |
+
}
|
94 |
+
$order->setEmailImported(Dotdigitalgroup_Email_Model_Contact::EMAIL_CONTACT_IMPORTED)
|
95 |
+
->save();
|
96 |
+
}catch(Exception $e){
|
97 |
+
Mage::logException($e);
|
98 |
+
}
|
99 |
+
}
|
100 |
+
return $orders;
|
101 |
+
}
|
102 |
+
|
103 |
+
/**
|
104 |
+
* Create a guest contact.
|
105 |
+
* @param $email
|
106 |
+
* @param $websiteId
|
107 |
+
* @param $storeId
|
108 |
+
*
|
109 |
+
* @return bool
|
110 |
+
*/
|
111 |
+
private function _createGuestContact($email, $websiteId, $storeId){
|
112 |
+
try{
|
113 |
+
$client = Mage::helper('connector')->getWebsiteApiClient($websiteId);
|
114 |
+
$contactApi = $client->getContactByEmail($email);
|
115 |
+
if (isset($contactApi->message) && $contactApi->message == Dotdigitalgroup_Email_Model_Apiconnector_Client::REST_CONTACT_NOT_FOUND) {
|
116 |
+
//create a new contact.
|
117 |
+
$contactApi = $client->postContacts($email);
|
118 |
+
} elseif (isset($contactApi->message)) {
|
119 |
+
return false;
|
120 |
+
}
|
121 |
+
// Add guest to address book
|
122 |
+
$response = $client->postAddressBookContacts(Mage::helper('connector')->getGuestAddressBook($websiteId), $contactApi);
|
123 |
+
$contactModel = Mage::getModel('email_connector/contact')->loadByCustomerEmail($email, $websiteId);
|
124 |
+
$contactModel->setIsGuest(1)
|
125 |
+
->setStoreId($storeId)
|
126 |
+
->setContactId($contactApi->id)
|
127 |
+
->setEmailImported(1);
|
128 |
+
|
129 |
+
if (isset($response->message) && $response->message == 'Contact is suppressed. ERROR_CONTACT_SUPPRESSED')
|
130 |
+
$contactModel->setSuppressed(1);
|
131 |
+
|
132 |
+
$contactModel->save();
|
133 |
+
Mage::helper('connector')->log('-- guest found : ' . $email . ' website : ' . $websiteId . ' ,store : ' . $storeId);
|
134 |
+
}catch(Exception $e){
|
135 |
+
Mage::logException($e);
|
136 |
+
}
|
137 |
+
|
138 |
+
return true;
|
139 |
+
}
|
140 |
+
}
|
@@ -0,0 +1,173 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Model_Sales_Quote
|
4 |
+
{
|
5 |
+
//customer
|
6 |
+
const XML_PATH_LOSTBASKET_CUSTOMER_ENABLED_1 = 'connector_lost_baskets/customers/enabled_1';
|
7 |
+
const XML_PATH_LOSTBASKET_CUSTOMER_ENABLED_2 = 'connector_lost_baskets/customers/enabled_2';
|
8 |
+
const XML_PATH_LOSTBASKET_CUSTOMER_ENABLED_3 = 'connector_lost_baskets/customers/enabled_3';
|
9 |
+
const XML_PATH_LOSTBASKET_CUSTOMER_INTERVAL_1 = 'connector_lost_baskets/customers/send_after_1';
|
10 |
+
const XML_PATH_LOSTBASKET_CUSTOMER_INTERVAL_2 = 'connector_lost_baskets/customers/send_after_2';
|
11 |
+
const XML_PATH_LOSTBASKET_CUSTOMER_INTERVAL_3 = 'connector_lost_baskets/customers/send_after_3';
|
12 |
+
const XML_PATH_LOSTBASKET_CUSTOMER_CAMPAIGN_1 = 'connector_lost_baskets/customers/campaign_1';
|
13 |
+
const XML_PATH_LOSTBASKET_CUSTOMER_CAMPAIGN_2 = 'connector_lost_baskets/customers/campaign_2';
|
14 |
+
const XML_PATH_LOSTBASKET_CUSTOMER_CAMPAIGN_3 = 'connector_lost_baskets/customers/campaign_3';
|
15 |
+
|
16 |
+
//guest
|
17 |
+
const XML_PATH_LOSTBASKET_GUEST_ENABLED_1 = 'connector_lost_baskets/guests/enabled_1';
|
18 |
+
const XML_PATH_LOSTBASKET_GUEST_ENABLED_2 = 'connector_lost_baskets/guests/enabled_2';
|
19 |
+
const XML_PATH_LOSTBASKET_GUEST_ENABLED_3 = 'connector_lost_baskets/guests/enabled_3';
|
20 |
+
const XML_PATH_LOSTBASKET_GUEST_INTERVAL_1 = 'connector_lost_baskets/guests/send_after_1';
|
21 |
+
const XML_PATH_LOSTBASKET_GUEST_INTERVAL_2 = 'connector_lost_baskets/guests/send_after_2';
|
22 |
+
const XML_PATH_LOSTBASKET_GUEST_INTERVAL_3 = 'connector_lost_baskets/guests/send_after_3';
|
23 |
+
const XML_PATH_LOSTBASKET_GUEST_CAMPAIGN_1 = 'connector_lost_baskets/guests/campaign_1';
|
24 |
+
const XML_PATH_LOSTBASKET_GUEST_CAMPAIGN_2 = 'connector_lost_baskets/guests/campaign_2';
|
25 |
+
const XML_PATH_LOSTBASKET_GUEST_CAMPAIGN_3 = 'connector_lost_baskets/guests/campaign_3';
|
26 |
+
|
27 |
+
|
28 |
+
/**
|
29 |
+
* number of lost baskets available.
|
30 |
+
* @var array
|
31 |
+
*/
|
32 |
+
public $lostBasketCustomers = array(1, 2, 3);
|
33 |
+
/**
|
34 |
+
* number of guest lost baskets available.
|
35 |
+
* @var array
|
36 |
+
*/
|
37 |
+
public $lostBasketGuests = array(1, 2, 3);
|
38 |
+
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Proccess lost baskets.
|
42 |
+
*/
|
43 |
+
public function proccessLostBaskets()
|
44 |
+
{
|
45 |
+
/**
|
46 |
+
* Save lost baskets to be send in Send table.
|
47 |
+
*/
|
48 |
+
foreach (Mage::app()->getStores() as $store) {
|
49 |
+
$storeId = $store->getId();
|
50 |
+
$sendModel = Mage::getModel('email_connector/campaign');
|
51 |
+
/**
|
52 |
+
* Customers campaings
|
53 |
+
*/
|
54 |
+
foreach ($this->lostBasketCustomers as $num) {
|
55 |
+
if ($this->_getLostBasketCustomerEnabled($num, $storeId)) {
|
56 |
+
|
57 |
+
if ($num == 1)
|
58 |
+
$from = Zend_Date::now()->subMinute($this->_getLostBasketCustomerInterval($num, $storeId));
|
59 |
+
else
|
60 |
+
$from = Zend_Date::now()->subHour($this->_getLostBasketCustomerInterval($num, $storeId));
|
61 |
+
$to = clone($from);
|
62 |
+
$from->sub('5', Zend_Date::MINUTE);
|
63 |
+
$quoteCollection = $this->_getStoreQuotes($from->toString('YYYY-MM-dd HH:mm'), $to->toString('YYYY-MM-dd HH:mm'), $guest = false, $storeId);
|
64 |
+
if ($quoteCollection->getSize())
|
65 |
+
Mage::helper('connector')->log('Customer lost baskets : ' . $num . ', from : ' . $from->toString('YYYY-MM-dd HH:mm') . ':' . $to->toString('YYYY-MM-dd HH:mm'));
|
66 |
+
$campaignId = $this->_getLostBasketCustomerCampaignId($num, $storeId);
|
67 |
+
foreach ($quoteCollection as $quote) {
|
68 |
+
//save lost basket for sending
|
69 |
+
$sendModel->loadByQuoteId($quote->getId(), $storeId)
|
70 |
+
->setEmail($quote->getCustomerEmail())
|
71 |
+
->setCustomerId($quote->getCustomerId())
|
72 |
+
->setEventName('Lost Basket')
|
73 |
+
->setCampaignId($campaignId)
|
74 |
+
->setStoreId($storeId)
|
75 |
+
->setIsSent(null)->save();
|
76 |
+
}
|
77 |
+
}
|
78 |
+
|
79 |
+
}
|
80 |
+
/**
|
81 |
+
* Guests campaigns
|
82 |
+
*/
|
83 |
+
foreach ($this->lostBasketGuests as $num) {
|
84 |
+
if ($this->_getLostBasketGuestEnabled($num, $storeId)) {
|
85 |
+
if ($num == 1)
|
86 |
+
$from = Zend_Date::now()->subMinute($this->_getLostBasketGuestIterval($num, $storeId));
|
87 |
+
else
|
88 |
+
$from = Zend_Date::now()->subHour($this->_getLostBasketGuestIterval($num, $storeId));
|
89 |
+
$to = clone($from);
|
90 |
+
$from->sub('5', Zend_Date::MINUTE);
|
91 |
+
$quoteCollection = $this->_getStoreQuotes($from->toString('YYYY-MM-dd HH:mm'), $to->toString('YYYY-MM-dd HH:mm'), $guest = true, $storeId);
|
92 |
+
if ($quoteCollection->getSize())
|
93 |
+
Mage::helper('connector')->log('Guest lost baskets : ' . $num . ', from : ' . $from->toString('YYYY-MM-dd HH:mm') . ':' . $to->toString('YYYY-MM-dd HH:mm'));
|
94 |
+
$guestCampaignId = $this->_getLostBasketGuestCampaignId($num, $storeId);
|
95 |
+
foreach ($quoteCollection as $quote) {
|
96 |
+
//save lost basket for sending
|
97 |
+
$sendModel->loadByQuoteId($quote->getId(), $storeId)
|
98 |
+
->setEmail($quote->getCustomerEmail())
|
99 |
+
->setEventName('Lost Basket')
|
100 |
+
->setCheckoutMethod('Guest')
|
101 |
+
->setCampaignId($guestCampaignId)
|
102 |
+
->setStoreId($storeId)
|
103 |
+
->setIsSent(null)->save();
|
104 |
+
}
|
105 |
+
}
|
106 |
+
}
|
107 |
+
|
108 |
+
}
|
109 |
+
}
|
110 |
+
|
111 |
+
private function _getLostBasketCustomerCampaignId($num, $storeId)
|
112 |
+
{
|
113 |
+
$store = Mage::app()->getStore($storeId);
|
114 |
+
return $store->getConfig(constant('self::XML_PATH_LOSTBASKET_CUSTOMER_CAMPAIGN_' . $num));
|
115 |
+
}
|
116 |
+
private function _getLostBasketGuestCampaignId($num, $storeId)
|
117 |
+
{
|
118 |
+
$store = Mage::app()->getStore($storeId);
|
119 |
+
return $store->getConfig(constant('self::XML_PATH_LOSTBASKET_GUEST_CAMPAIGN_'. $num));
|
120 |
+
}
|
121 |
+
|
122 |
+
private function _getLostBasketCustomerInterval($num, $storeId)
|
123 |
+
{
|
124 |
+
$store = Mage::app()->getstore($storeId);
|
125 |
+
return $store->getConfig(constant('self::XML_PATH_LOSTBASKET_CUSTOMER_INTERVAL_' . $num));
|
126 |
+
}
|
127 |
+
|
128 |
+
private function _getLostBasketGuestIterval($num, $storeId)
|
129 |
+
{
|
130 |
+
$store = Mage::app()->getStore($storeId);
|
131 |
+
return $store->getConfig(constant('self::XML_PATH_LOSTBASKET_GUEST_INTERVAL_' . $num));
|
132 |
+
}
|
133 |
+
|
134 |
+
protected function _getLostBasketCustomerEnabled($num, $storeId)
|
135 |
+
{
|
136 |
+
$store = Mage::app()->getStore($storeId);
|
137 |
+
$enabled = $store->getConfig(constant('self::XML_PATH_LOSTBASKET_CUSTOMER_ENABLED_' . $num));
|
138 |
+
return $enabled;
|
139 |
+
|
140 |
+
}
|
141 |
+
|
142 |
+
protected function _getLostBasketGuestEnabled($num, $storeId)
|
143 |
+
{
|
144 |
+
$store = Mage::app()->getStore($storeId);
|
145 |
+
return $store->getConfig(constant('self::XML_PATH_LOSTBASKET_GUEST_ENABLED_' . $num));
|
146 |
+
}
|
147 |
+
|
148 |
+
/**
|
149 |
+
* @param string $from
|
150 |
+
* @param string $to
|
151 |
+
* @param bool $guest
|
152 |
+
* @param int $storeId
|
153 |
+
* @return Mage_Eav_Model_Entity_Collection_Abstract
|
154 |
+
*/
|
155 |
+
private function _getStoreQuotes($from = null, $to = null, $guest = false, $storeId = 0)
|
156 |
+
{
|
157 |
+
|
158 |
+
$updated = array(
|
159 |
+
'from' => $from,
|
160 |
+
'to' => $to,
|
161 |
+
'date' => true);
|
162 |
+
|
163 |
+
$salesCollection = Mage::getResourceModel('sales/quote_collection')
|
164 |
+
->addFieldToFilter('is_active', 1)
|
165 |
+
->addFieldToFilter('items_count', array('gt' => 0))
|
166 |
+
->addFieldToFilter('customer_email', array('neq' => ''))
|
167 |
+
->addFieldToFilter('store_id', $storeId)
|
168 |
+
->addFieldToFilter('updated_at', $updated);
|
169 |
+
if ($guest)
|
170 |
+
$salesCollection->addFieldToFilter('checkout_method' , Mage_Checkout_Model_Type_Onepage::METHOD_GUEST);
|
171 |
+
return $salesCollection;
|
172 |
+
}
|
173 |
+
}
|
@@ -0,0 +1,112 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Model_Sms_Campaign
|
4 |
+
{
|
5 |
+
const UK_TELEPHONE_PATTERN = '/^(\+44\s?7\d{3}|\(?07\d{3}\)?)\s?\d{3}\s?\d{3}$/';
|
6 |
+
|
7 |
+
/**
|
8 |
+
* @var int
|
9 |
+
*/
|
10 |
+
private $_storeId;
|
11 |
+
/**
|
12 |
+
* @var string
|
13 |
+
*/
|
14 |
+
private $_status;
|
15 |
+
/**
|
16 |
+
* @var string
|
17 |
+
*/
|
18 |
+
private $_customerFirstName;
|
19 |
+
/**
|
20 |
+
* @var string
|
21 |
+
*/
|
22 |
+
private $_customerTelephone;
|
23 |
+
|
24 |
+
/**
|
25 |
+
* @var int
|
26 |
+
*/
|
27 |
+
private $_incrementId;
|
28 |
+
|
29 |
+
/**
|
30 |
+
* @var array
|
31 |
+
*/
|
32 |
+
private $_allsms = array(1, 2, 3, 4);
|
33 |
+
/**
|
34 |
+
* filter for the variables
|
35 |
+
* @var array
|
36 |
+
*/
|
37 |
+
private $_vars = array('/customer_name/', '/order_number/', '/{{var /', '/}}/');
|
38 |
+
|
39 |
+
|
40 |
+
/**
|
41 |
+
* constructor.
|
42 |
+
*
|
43 |
+
* @param $order
|
44 |
+
*/
|
45 |
+
public function __construct($order)
|
46 |
+
{
|
47 |
+
$this->_storeId = $order->getStoreId();
|
48 |
+
Mage::app()->setCurrentStore($this->_storeId);
|
49 |
+
$billingAddress = $order->getBillingAddress();
|
50 |
+
$this->_customerTelephone = $billingAddress->getTelephone();
|
51 |
+
$this->_customerFirstName = $order->getCustomerFirstname();
|
52 |
+
$this->_incrementId = $order->getIncrementId();
|
53 |
+
}
|
54 |
+
/**
|
55 |
+
* @return mixed
|
56 |
+
*/
|
57 |
+
public function getStatus()
|
58 |
+
{
|
59 |
+
return $this->_status;
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* @param mixed $status
|
64 |
+
*/
|
65 |
+
public function setStatus($status)
|
66 |
+
{
|
67 |
+
$this->_status = $status;
|
68 |
+
}
|
69 |
+
|
70 |
+
public function sendSms()
|
71 |
+
{
|
72 |
+
$website = Mage::app()->getStore($this->_storeId)->getWebsite();
|
73 |
+
$client = Mage::helper('connector')->getWebsiteApiClient($website);
|
74 |
+
//all available sms in config
|
75 |
+
foreach ($this->_allsms as $num) {
|
76 |
+
$enabled = (bool)Mage::getStoreConfig(constant('Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_SMS_ENABLED_' . $num));
|
77 |
+
if ($enabled) {
|
78 |
+
$status = Mage::getStoreConfig(constant('Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_SMS_STATUS_' . $num));
|
79 |
+
$message = $this->_processMessage(Mage::getStoreConfig(constant('Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_SMS_MESSAGE_' . $num)));
|
80 |
+
$match = preg_match(self::UK_TELEPHONE_PATTERN, $this->_customerTelephone);
|
81 |
+
if ($match != false) {
|
82 |
+
$codePhone = preg_replace('/\A(0){1}+/', '+44', $this->_customerTelephone);
|
83 |
+
//status and telephone valid
|
84 |
+
if ($this->_status == $status) {
|
85 |
+
Mage::helper('connector')->log('sending sms message with status : ' . $status . ' and ' . $codePhone);
|
86 |
+
$client->postSmsMessagesSendTo($codePhone, $message);
|
87 |
+
}
|
88 |
+
} else {
|
89 |
+
Mage::helper('connector')->log('SMS: phone not valid for UK : ' . $this->_customerTelephone);
|
90 |
+
}
|
91 |
+
}
|
92 |
+
}
|
93 |
+
}
|
94 |
+
|
95 |
+
/**
|
96 |
+
* @param $message
|
97 |
+
* @return mixed
|
98 |
+
*/
|
99 |
+
protected function _processMessage($message)
|
100 |
+
{
|
101 |
+
$replacemant = array();
|
102 |
+
if (preg_match('/{{var/', $message)) {
|
103 |
+
$replacemant[] = $this->_customerFirstName;
|
104 |
+
$replacemant[] = $this->_incrementId;
|
105 |
+
$replacemant[] = '';
|
106 |
+
$replacemant[] = '';
|
107 |
+
$message = preg_replace($this->_vars, $replacemant, $message);
|
108 |
+
}
|
109 |
+
return substr($message, 0, 160);
|
110 |
+
}
|
111 |
+
|
112 |
+
}
|
@@ -0,0 +1,158 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Adminhtml_ConnectorController extends Mage_Adminhtml_Controller_Action
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* AutoCreate and map datafields.
|
7 |
+
*/
|
8 |
+
public function setupdatafieldsAction()
|
9 |
+
{
|
10 |
+
$result = array('errors' => false, 'message' => '');
|
11 |
+
$apiModel = Mage::getModel('email_connector/apiconnector_client');
|
12 |
+
$redirectUrl = Mage::helper('adminhtml')->getUrl('adminhtml/system_config/edit', array('section' => 'connector_data_mapping'));
|
13 |
+
|
14 |
+
// get all possible datatifileds
|
15 |
+
$datafields = Mage::getModel('email_connector/connector_datafield')->getContactDatafields();
|
16 |
+
foreach ($datafields as $key => $datafield) {
|
17 |
+
$response = $apiModel->postDataFields($datafield);
|
18 |
+
|
19 |
+
//ignore existing datafields message
|
20 |
+
if (isset($response->message) && $response->message != Dotdigitalgroup_Email_Model_Apiconnector_Client::REST_API_DATAFILEDS_EXISTS) {
|
21 |
+
$result['errors'] = true;
|
22 |
+
$result['message'] .= ' Datafield ' . $datafield['name'] . ' - '. $response->message . '</br>';
|
23 |
+
} else {
|
24 |
+
$website = $this->getRequest()->getParam('website', false);
|
25 |
+
if ($website) {
|
26 |
+
$scope = 'website';
|
27 |
+
$scopeId = Mage::app()->getWebsite($website)->getId();
|
28 |
+
} else {
|
29 |
+
$scope = 'default';
|
30 |
+
$scopeId = '0';
|
31 |
+
}
|
32 |
+
/**
|
33 |
+
* map the succesful created datafield
|
34 |
+
*/
|
35 |
+
$config = new Mage_Core_Model_Config();
|
36 |
+
$config->saveConfig('connector_data_mapping/customer_data/' . $key, strtoupper($datafield['name']), $scope, $scopeId);
|
37 |
+
Mage::helper('connector')->log('successfully connected : ' . $datafield['name']);
|
38 |
+
}
|
39 |
+
}
|
40 |
+
if ($result['errors']) {
|
41 |
+
Mage::getSingleton('adminhtml/session')->addNotice($result['message']);
|
42 |
+
} else {
|
43 |
+
Mage::getConfig()->cleanCache();
|
44 |
+
Mage::getSingleton('adminhtml/session')->addSuccess('All Datafields Created And Mapped.');
|
45 |
+
}
|
46 |
+
|
47 |
+
$this->_redirectUrl($redirectUrl);
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Reset order for reimport.
|
52 |
+
*/
|
53 |
+
public function resetordersAction()
|
54 |
+
{
|
55 |
+
/** @var $coreResource Mage_Core_Model_Resource */
|
56 |
+
$coreResource = Mage::getSingleton('core/resource');
|
57 |
+
|
58 |
+
/** @var $conn Varien_Db_Adapter_Pdo_Mysql */
|
59 |
+
$conn = $coreResource->getConnection('core_write');
|
60 |
+
try{
|
61 |
+
$num = $conn->update($coreResource->getTableName('email_connector/order'),
|
62 |
+
array('email_imported' => new Zend_Db_Expr('null')),
|
63 |
+
$conn->quoteInto('email_imported is ?', new Zend_Db_Expr('not null'))
|
64 |
+
);
|
65 |
+
}catch (Exception $e){
|
66 |
+
Mage::logException($e);
|
67 |
+
}
|
68 |
+
Mage::helper('connector')->log('-- Reset Orders for reimport : ' . $num);
|
69 |
+
Mage::getSingleton('adminhtml/session')->addSuccess('Done.');
|
70 |
+
$this->_redirectReferer();
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Refresh suppressed contacts.
|
75 |
+
*/
|
76 |
+
public function suppresscontactsAction()
|
77 |
+
{
|
78 |
+
Mage::getModel('email_connector/newsletter_subscriber')
|
79 |
+
->unsubscribe(true);
|
80 |
+
Mage::getSingleton('adminhtml/session')->addSuccess('Done.');
|
81 |
+
$this->_redirectReferer();
|
82 |
+
|
83 |
+
}
|
84 |
+
/**
|
85 |
+
* Remove contact id's.
|
86 |
+
*/
|
87 |
+
public function deletecontactidsAction()
|
88 |
+
{
|
89 |
+
/** @var $coreResource Mage_Core_Model_Resource */
|
90 |
+
$coreResource = Mage::getSingleton('core/resource');
|
91 |
+
|
92 |
+
/** @var $conn Varien_Db_Adapter_Pdo_Mysql */
|
93 |
+
$conn = $coreResource->getConnection('core_write');
|
94 |
+
try{
|
95 |
+
$num = $conn->update($coreResource->getTableName('email_connector/contact'),
|
96 |
+
array('contact_id' => new Zend_Db_Expr('null')),
|
97 |
+
$conn->quoteInto('contact_id is ?', new Zend_Db_Expr('not null'))
|
98 |
+
);
|
99 |
+
}catch (Exception $e){
|
100 |
+
Mage::logException($e);
|
101 |
+
}
|
102 |
+
Mage::getSingleton('adminhtml/session')->addSuccess('Number Of Contacts Id Removed: '. $num);
|
103 |
+
$this->_redirectReferer();
|
104 |
+
}
|
105 |
+
public function ajaxvalidationAction()
|
106 |
+
{
|
107 |
+
$params = $this->getRequest()->getParams();
|
108 |
+
$apiUsername = $params['api_username'];
|
109 |
+
$apiPassword = $params['api_password'];
|
110 |
+
$message = Mage::getModel('email_connector/apiconnector_test')->ajaxvalidate($apiUsername, $apiPassword);
|
111 |
+
|
112 |
+
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($message));
|
113 |
+
}
|
114 |
+
|
115 |
+
public function createnewdatafieldAction()
|
116 |
+
{
|
117 |
+
$params = $this->getRequest()->getParams();
|
118 |
+
$website = $this->getRequest()->getParam('website', 0);
|
119 |
+
$client = Mage::helper('connector')->getWebsiteApiClient($website);
|
120 |
+
if (strlen($params['name'])) {
|
121 |
+
$response = $client->postDataFields($params['name'], $params['type']);
|
122 |
+
if (isset($response->message)) {
|
123 |
+
Mage::getSingleton('adminhtml/session')->addError($response->message);
|
124 |
+
Mage::helper('connector')->log($response->message);
|
125 |
+
} else {
|
126 |
+
Mage::getSingleton('adminhtml/session')->addSuccess('Datafield created : ' . $params['name']);
|
127 |
+
}
|
128 |
+
} else {
|
129 |
+
Mage::getSingleton('adminhtml/session')->addError('Datafield cannot be empty.');
|
130 |
+
}
|
131 |
+
}
|
132 |
+
|
133 |
+
public function createnewaddressbookAction()
|
134 |
+
{
|
135 |
+
$addressBookName = $this->getRequest()->getParam('name');
|
136 |
+
$website = $this->getRequest()->getParam('website', 0);
|
137 |
+
$client = Mage::helper('connector')->getWebsiteApiClient($website);
|
138 |
+
if (strlen($addressBookName)) {
|
139 |
+
$response = $client->PostAddressBooks($addressBookName);
|
140 |
+
if(isset($response->message))
|
141 |
+
Mage::getSingleton('adminhtml/session')->addError($response->message);
|
142 |
+
else
|
143 |
+
Mage::getSingleton('adminhtml/session')->addSuccess('Address book : '. $addressBookName . ' created.');
|
144 |
+
}
|
145 |
+
|
146 |
+
}
|
147 |
+
|
148 |
+
public function reimoprtsubscribersAction()
|
149 |
+
{
|
150 |
+
$updated = Mage::getModel('email_connector/contact')->resetSubscribers();
|
151 |
+
if ($updated) {
|
152 |
+
Mage::getSingleton('adminhtml/session')->addSuccess('Subscribers updated : ' . $updated);
|
153 |
+
} else {
|
154 |
+
Mage::getSingleton('adminhtml/session')->addNotice('No subscribers imported!');
|
155 |
+
}
|
156 |
+
$this->_redirectReferer();
|
157 |
+
}
|
158 |
+
}
|
@@ -0,0 +1,109 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Adminhtml_Email_AutomationController extends Mage_Adminhtml_Controller_Action
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Main page for automation studio. Must be authinticated.
|
7 |
+
*/
|
8 |
+
public function indexAction()
|
9 |
+
{
|
10 |
+
|
11 |
+
$this->_title($this->__('Automation Studio'));
|
12 |
+
$this->loadLayout();
|
13 |
+
$this->_setActiveMenu('email_connector');
|
14 |
+
|
15 |
+
// authorize or create token.
|
16 |
+
$token = $this->generatetokenAction();
|
17 |
+
$loginuserUrl = Dotdigitalgroup_Email_Helper_Config::API_CONNECTOR_URL_LOG_USER . $token;
|
18 |
+
|
19 |
+
$block = $this->getLayout()
|
20 |
+
->createBlock('core/text', 'connector_iframe')
|
21 |
+
->setText(
|
22 |
+
"<iframe src=" . $loginuserUrl . " width=100% height=1400 frameborder='0' scrolling='no' style='margin:0;padding: 0;display:block;'></iframe>"
|
23 |
+
);
|
24 |
+
|
25 |
+
$this->_addContent($block);
|
26 |
+
$this->renderLayout();
|
27 |
+
}
|
28 |
+
|
29 |
+
protected function _isAllowed()
|
30 |
+
{
|
31 |
+
return Mage::getSingleton('admin/session')->isAllowed('email_connector/automation_studio');
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Generate new token and connect from the admin.
|
36 |
+
*
|
37 |
+
* POST httpsː//my.dotmailer.com/OAuth2/Tokens.ashx HTTP/1.1
|
38 |
+
* Content-Type: application/x-www-form-urlencoded
|
39 |
+
* client_id=QVNY867m2DQozogTJfUmqA%253D%253D&
|
40 |
+
* redirect_uri=https%3a%2f%2flocalhost%3a10999%2fcallback.aspx
|
41 |
+
* &client_secret=SndpTndiSlhRawAAAAAAAA%253D%253D
|
42 |
+
* &grant_type=authorization_code
|
43 |
+
*/
|
44 |
+
public function generatetokenAction()
|
45 |
+
{
|
46 |
+
//check for secure url
|
47 |
+
$adminUser = Mage::getSingleton('admin/session')->getUser();
|
48 |
+
$refreshToken = Mage::getSingleton('admin/user')->load($adminUser->getId())->getRefreshToken();
|
49 |
+
|
50 |
+
if ($refreshToken) {
|
51 |
+
$code = Mage::helper('connector')->getCode();
|
52 |
+
$params = 'client_id=' . Mage::getStoreConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_CLIENT_ID) .
|
53 |
+
'&client_secret=' . Mage::getStoreConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_CLIENT_SECRET_ID) .
|
54 |
+
'&refresh_token=' . $refreshToken .
|
55 |
+
'&grant_type=refresh_token';
|
56 |
+
|
57 |
+
$url = Dotdigitalgroup_Email_Helper_Config::API_CONNECTOR_URL_TOKEN;
|
58 |
+
Mage::helper('connector')->log('token url : ' . $url . ' code : ' . $code);
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Refresh Token request.
|
62 |
+
*/
|
63 |
+
$ch = curl_init();
|
64 |
+
curl_setopt($ch, CURLOPT_URL, $url);
|
65 |
+
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
|
66 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
67 |
+
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
|
68 |
+
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
|
69 |
+
curl_setopt($ch, CURLOPT_POST, count($params));
|
70 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
|
71 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded'));
|
72 |
+
|
73 |
+
$response = json_decode(curl_exec($ch));
|
74 |
+
|
75 |
+
if (isset($response->error)) {
|
76 |
+
Mage::helper('connector')->log("Token Error Num`ber:" . curl_errno($ch) . "Error String:" . curl_error($ch));
|
77 |
+
}
|
78 |
+
curl_close($ch);
|
79 |
+
|
80 |
+
$token = $response->access_token;
|
81 |
+
return $token;
|
82 |
+
|
83 |
+
} else {
|
84 |
+
Mage::getSingleton('adminhtml/session')->addNotice('Please Connect To Access The Page.');
|
85 |
+
}
|
86 |
+
|
87 |
+
$this->_redirect('*/system_config/edit', array('section' => 'connector_api_credentials'));
|
88 |
+
}
|
89 |
+
|
90 |
+
/**
|
91 |
+
* Disconnect and remote the refresh token.
|
92 |
+
*/
|
93 |
+
public function disconnectAction()
|
94 |
+
{
|
95 |
+
try {
|
96 |
+
$adminUser = Mage::getSingleton('admin/session')->getUser();
|
97 |
+
|
98 |
+
if ($adminUser->getRefreshToken()) {
|
99 |
+
$adminUser->setRefreshToken()->save();
|
100 |
+
}
|
101 |
+
Mage::getSingleton('adminhtml/session')->addSuccess('Successfully disconnected');
|
102 |
+
}catch (Exception $e){
|
103 |
+
Mage::logException($e);
|
104 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
105 |
+
}
|
106 |
+
|
107 |
+
$this->_redirectReferer('*/*/*');
|
108 |
+
}
|
109 |
+
}
|
@@ -0,0 +1,218 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Adminhtml_Email_CampaignController extends Mage_Adminhtml_Controller_Action
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* constructor - set the used module name
|
7 |
+
*/
|
8 |
+
protected function _construct()
|
9 |
+
{
|
10 |
+
$this->setUsedModuleName('Dotdigitalgroup_Email');
|
11 |
+
}
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Email campaigns.
|
15 |
+
*/
|
16 |
+
public function indexAction()
|
17 |
+
{
|
18 |
+
$this->_title($this->__('Email'))
|
19 |
+
->_title($this->__('Manage Campaigns'));
|
20 |
+
$this->loadLayout();
|
21 |
+
$this->_setActiveMenu('email_connector');
|
22 |
+
$this->renderLayout();
|
23 |
+
}
|
24 |
+
|
25 |
+
/**
|
26 |
+
* New campaings.
|
27 |
+
*/
|
28 |
+
public function newAction()
|
29 |
+
{
|
30 |
+
// We just forward the new action to a blank edit form
|
31 |
+
$this->_forward('edit');
|
32 |
+
}
|
33 |
+
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Edit campign.
|
37 |
+
*/
|
38 |
+
public function editAction()
|
39 |
+
{
|
40 |
+
$contactId = (int) $this->getRequest()->getParam('id');
|
41 |
+
$contact = $this->_initAction();
|
42 |
+
if ($contactId && !$contact->getId()) {
|
43 |
+
$this->_getSession()->addError(Mage::helper('connector')->__('This campaign no longer exists.'));
|
44 |
+
$this->_redirect('*/*/');
|
45 |
+
return;
|
46 |
+
}
|
47 |
+
if ($data = Mage::getSingleton('adminhtml/session')->getCampaignData(true)) {
|
48 |
+
$contact->setData($data);
|
49 |
+
}
|
50 |
+
Mage::dispatchEvent('email_campaign_controller_edit_action', array('contact' => $contact));
|
51 |
+
$this->loadLayout();
|
52 |
+
if ($contact->getId()) {
|
53 |
+
if (!Mage::app()->isSingleStoreMode() && ($switchBlock = $this->getLayout()->getBlock('store_switcher'))) {
|
54 |
+
$switchBlock->setDefaultStoreName(Mage::helper('connector')->__('Default Values'))
|
55 |
+
->setSwitchUrl($this->getUrl('*/*/*', array('_current'=>true, 'active_tab'=>null, 'tab' => null, 'store'=>null)));
|
56 |
+
}
|
57 |
+
} else {
|
58 |
+
$this->getLayout()->getBlock('left')->unsetChild('store_switcher');
|
59 |
+
}
|
60 |
+
$this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
|
61 |
+
$this->renderLayout();
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Save campaign.
|
66 |
+
*/
|
67 |
+
public function saveAction()
|
68 |
+
{
|
69 |
+
$storeId = $this->getRequest()->getParam('store');
|
70 |
+
$redirectBack = $this->getRequest()->getParam('back', false);
|
71 |
+
$contactId = $this->getRequest()->getParam('id');
|
72 |
+
$data = $this->getRequest()->getPost();
|
73 |
+
if ($data) {
|
74 |
+
$campaign = $this->_initAction();
|
75 |
+
|
76 |
+
$campaignData = $this->getRequest()->getPost('campaign', array());
|
77 |
+
$campaign->addData($campaignData);
|
78 |
+
|
79 |
+
try {
|
80 |
+
$campaign->save();
|
81 |
+
$this->_getSession()->addSuccess(Mage::helper('connector')->__('Campaign was saved.'));
|
82 |
+
}catch (Mage_Core_Exception $e) {
|
83 |
+
Mage::logException($e);
|
84 |
+
$this->_getSession()->addError($e->getMessage())
|
85 |
+
->setContactData($campaignData);
|
86 |
+
$redirectBack = true;
|
87 |
+
}catch (Exception $e){
|
88 |
+
Mage::logException($e);
|
89 |
+
$this->_getSession()->addError(Mage::helper('connector')->__('Error saving campaign'))
|
90 |
+
->setContactData($campaignData);
|
91 |
+
$redirectBack = true;
|
92 |
+
}
|
93 |
+
}
|
94 |
+
if ($redirectBack) {
|
95 |
+
$this->_redirect('*/*/edit', array(
|
96 |
+
'id' => $contactId,
|
97 |
+
'_current'=>true
|
98 |
+
));
|
99 |
+
} else {
|
100 |
+
$this->_redirect('*/*/', array('store'=>$storeId));
|
101 |
+
}
|
102 |
+
}
|
103 |
+
|
104 |
+
/**
|
105 |
+
* Delete campaign.
|
106 |
+
*/
|
107 |
+
public function deleteAction()
|
108 |
+
{
|
109 |
+
if ($id = $this->getRequest()->getParam('id')) {
|
110 |
+
$campaign = Mage::getModel('email_connector/campaign')->load($id);
|
111 |
+
try {
|
112 |
+
$campaign->delete();
|
113 |
+
$this->_getSession()->addSuccess(Mage::helper('connector')->__('The campaign has been deleted.'));
|
114 |
+
}
|
115 |
+
catch (Exception $e) {
|
116 |
+
$this->_getSession()->addError($e->getMessage());
|
117 |
+
}
|
118 |
+
}
|
119 |
+
$this->getResponse()->setRedirect($this->getUrl('*/*/', array('store'=>$this->getRequest()->getParam('store'))));
|
120 |
+
}
|
121 |
+
|
122 |
+
/**
|
123 |
+
* Delete mass campaigns.
|
124 |
+
*/
|
125 |
+
public function massDeleteAction()
|
126 |
+
{
|
127 |
+
$campaignIds = $this->getRequest()->getParam('campaign');
|
128 |
+
if (!is_array($campaignIds)) {
|
129 |
+
$this->_getSession()->addError($this->__('Please select campaigns.'));
|
130 |
+
} else {
|
131 |
+
try {
|
132 |
+
foreach ($campaignIds as $campaignId) {
|
133 |
+
$campaign = Mage::getSingleton('email_connector/campaign')->load($campaignId);
|
134 |
+
Mage::dispatchEvent('connector_controller_campaign_delete', array('campaign' => $campaign));
|
135 |
+
$campaign->delete();
|
136 |
+
}
|
137 |
+
$this->_getSession()->addSuccess(
|
138 |
+
Mage::helper('connector')->__('Total of %d record(s) have been deleted.', count($campaignIds))
|
139 |
+
);
|
140 |
+
} catch (Exception $e) {
|
141 |
+
$this->_getSession()->addError($e->getMessage());
|
142 |
+
}
|
143 |
+
}
|
144 |
+
$this->_redirect('*/*/index');
|
145 |
+
}
|
146 |
+
|
147 |
+
/**
|
148 |
+
* Mass mark for resend campaings.
|
149 |
+
*/
|
150 |
+
public function massResendAction()
|
151 |
+
{
|
152 |
+
$campaignIds = $this->getRequest()->getParam('campaign');
|
153 |
+
if (!is_array($campaignIds)) {
|
154 |
+
$this->_getSession()->addError($this->__('Please select campaigns.'));
|
155 |
+
} else {
|
156 |
+
try {
|
157 |
+
foreach ($campaignIds as $campaignId) {
|
158 |
+
$campaign = Mage::getSingleton('email_connector/campaign')->load($campaignId);
|
159 |
+
Mage::dispatchEvent('connector_controller_campaign_delete', array('campaign' => $campaign));
|
160 |
+
$campaign->setIsSent(null)->save();
|
161 |
+
}
|
162 |
+
$this->_getSession()->addSuccess(
|
163 |
+
Mage::helper('connector')->__('Total of %d record(s) have resend .', count($campaignIds))
|
164 |
+
);
|
165 |
+
} catch (Exception $e) {
|
166 |
+
$this->_getSession()->addError($e->getMessage());
|
167 |
+
}
|
168 |
+
}
|
169 |
+
$this->_redirect('*/*/index');
|
170 |
+
}
|
171 |
+
|
172 |
+
|
173 |
+
/**
|
174 |
+
* main page.
|
175 |
+
*/
|
176 |
+
public function gridAction()
|
177 |
+
{
|
178 |
+
$this->loadLayout();
|
179 |
+
$this->renderLayout();
|
180 |
+
}
|
181 |
+
|
182 |
+
/**
|
183 |
+
* manage the campaigns.
|
184 |
+
*
|
185 |
+
* @return Dotdigitalgroup_Email_Model_Campaign
|
186 |
+
*/
|
187 |
+
protected function _initAction()
|
188 |
+
{
|
189 |
+
$this->_title($this->__('Newsletter'))
|
190 |
+
->_title($this->__('Manage Campaigns'));
|
191 |
+
|
192 |
+
$campaignId = (int) $this->getRequest()->getParam('id');
|
193 |
+
$campaign = Mage::getModel('email_connector/campaign');
|
194 |
+
|
195 |
+
if ($campaignId) {
|
196 |
+
$campaign->load($campaignId);
|
197 |
+
}
|
198 |
+
Mage::register('email_campaign', $campaign);
|
199 |
+
return $campaign;
|
200 |
+
}
|
201 |
+
|
202 |
+
/**
|
203 |
+
* Export campaigns to CSV file.
|
204 |
+
*/
|
205 |
+
public function exportCsvAction()
|
206 |
+
{
|
207 |
+
$fileName = 'campaign.csv';
|
208 |
+
$content = $this->getLayout()->createBlock('email_connector/adminhtml_campaign_grid')
|
209 |
+
->getCsvFile();
|
210 |
+
$this->_prepareDownloadResponse($fileName, $content);
|
211 |
+
}
|
212 |
+
|
213 |
+
protected function _isAllowed()
|
214 |
+
{
|
215 |
+
return Mage::getSingleton('admin/session')->isAllowed('newsletter/email_connetor/email_connector_campaign');
|
216 |
+
}
|
217 |
+
|
218 |
+
}
|
@@ -0,0 +1,192 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Adminhtml_Email_ContactController extends Mage_Adminhtml_Controller_Action
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* constructor - set the used module name
|
7 |
+
*/
|
8 |
+
protected function _construct(){
|
9 |
+
$this->setUsedModuleName('Dotdigitalgroup_Email');
|
10 |
+
}
|
11 |
+
|
12 |
+
/**
|
13 |
+
* main page.
|
14 |
+
*/
|
15 |
+
public function indexAction()
|
16 |
+
{
|
17 |
+
$this->_title($this->__('Email'))
|
18 |
+
->_title($this->__('Manage Contacts'));
|
19 |
+
$this->loadLayout();
|
20 |
+
$this->_setActiveMenu('email_connector');
|
21 |
+
$this->renderLayout();
|
22 |
+
}
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Edit contact.
|
26 |
+
*/
|
27 |
+
public function editAction()
|
28 |
+
{
|
29 |
+
$contactId = (int) $this->getRequest()->getParam('id');
|
30 |
+
$contact = $this->_initAction();
|
31 |
+
if ($contactId && !$contact->getId()) {
|
32 |
+
$this->_getSession()->addError(Mage::helper('connector')->__('This contact no longer exists.'));
|
33 |
+
$this->_redirect('*/*/');
|
34 |
+
return;
|
35 |
+
}
|
36 |
+
$contactEmail = Mage::getModel('email_connector/apiconnector_contact')->syncContact();
|
37 |
+
if ($contactEmail)
|
38 |
+
Mage::getSingleton('adminhtml/session')->addSuccess('Successfully synced : ' . $contactEmail);
|
39 |
+
|
40 |
+
Mage::dispatchEvent('email_contact_controller_edit_action', array('contact' => $contact));
|
41 |
+
|
42 |
+
$this->_redirect('*/*');
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Save contact.
|
47 |
+
*/
|
48 |
+
public function saveAction(){
|
49 |
+
$storeId = $this->getRequest()->getParam('store');
|
50 |
+
$redirectBack = $this->getRequest()->getParam('back', false);
|
51 |
+
$contactId = $this->getRequest()->getParam('id');
|
52 |
+
|
53 |
+
$data = $this->getRequest()->getPost();
|
54 |
+
if ($data) {
|
55 |
+
$contact = $this->_initAction();
|
56 |
+
|
57 |
+
$contactData = $this->getRequest()->getPost('contact', array());
|
58 |
+
$contact->addData($contactData);
|
59 |
+
|
60 |
+
try {
|
61 |
+
$contact->save();
|
62 |
+
$contactId = $contact->getId();
|
63 |
+
$this->_getSession()->addSuccess(Mage::helper('connector')->__('Contact was saved.'));
|
64 |
+
}catch (Mage_Core_Exception $e) {
|
65 |
+
Mage::logException($e);
|
66 |
+
$this->_getSession()->addError($e->getMessage())
|
67 |
+
->setContactData($contactData);
|
68 |
+
$redirectBack = true;
|
69 |
+
}catch (Exception $e){
|
70 |
+
Mage::logException($e);
|
71 |
+
$this->_getSession()->addError(Mage::helper('connector')->__('Error saving contact'))
|
72 |
+
->setContactData($contactData);
|
73 |
+
$redirectBack = true;
|
74 |
+
}
|
75 |
+
}
|
76 |
+
if ($redirectBack) {
|
77 |
+
$this->_redirect('*/*/edit', array(
|
78 |
+
'id' => $contactId,
|
79 |
+
'_current'=>true
|
80 |
+
));
|
81 |
+
} else {
|
82 |
+
$this->_redirect('*/*/', array('store'=>$storeId));
|
83 |
+
}
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Delete a contact.
|
88 |
+
*/
|
89 |
+
public function deleteAction()
|
90 |
+
{
|
91 |
+
if ($id = $this->getRequest()->getParam('id')) {
|
92 |
+
$contact = Mage::getModel('email_connector/contact')->load($id);
|
93 |
+
try {
|
94 |
+
$contact->delete();
|
95 |
+
$this->_getSession()->addSuccess(Mage::helper('connector')->__('The contact has been deleted.'));
|
96 |
+
}
|
97 |
+
catch (Exception $e) {
|
98 |
+
$this->_getSession()->addError($e->getMessage());
|
99 |
+
}
|
100 |
+
}
|
101 |
+
$this->getResponse()->setRedirect($this->getUrl('*/*/', array('store'=>$this->getRequest()->getParam('store'))));
|
102 |
+
}
|
103 |
+
|
104 |
+
/**
|
105 |
+
* Mass delete contacts.
|
106 |
+
*/
|
107 |
+
public function massDeleteAction()
|
108 |
+
{
|
109 |
+
$contactIds = $this->getRequest()->getParam('contact');
|
110 |
+
if (!is_array($contactIds)) {
|
111 |
+
$this->_getSession()->addError($this->__('Please select contacts.'));
|
112 |
+
}else {
|
113 |
+
try {
|
114 |
+
foreach ($contactIds as $contactId) {
|
115 |
+
$contact = Mage::getSingleton('email_connector/contact')->load($contactId);
|
116 |
+
Mage::dispatchEvent('connector_controller_affiliate_delete', array('contact' => $contact));
|
117 |
+
$contact->delete();
|
118 |
+
}
|
119 |
+
$this->_getSession()->addSuccess(
|
120 |
+
Mage::helper('connector')->__('Total of %d record(s) have been deleted.', count($contactIds))
|
121 |
+
);
|
122 |
+
} catch (Exception $e) {
|
123 |
+
$this->_getSession()->addError($e->getMessage());
|
124 |
+
}
|
125 |
+
}
|
126 |
+
$this->_redirect('*/*/index');
|
127 |
+
}
|
128 |
+
|
129 |
+
/**
|
130 |
+
* Mark a contact to be resend.
|
131 |
+
*/
|
132 |
+
public function massResendAction()
|
133 |
+
{
|
134 |
+
$contactIds = $this->getRequest()->getParam('contact');
|
135 |
+
|
136 |
+
if (!is_array($contactIds)) {
|
137 |
+
$this->_getSession()->addError($this->__('Please select contacts.'));
|
138 |
+
}else {
|
139 |
+
try {
|
140 |
+
foreach ($contactIds as $contactId) {
|
141 |
+
$contact = Mage::getSingleton('email_connector/contact')->load($contactId);
|
142 |
+
$contact->setEmailImported(null)->save();
|
143 |
+
}
|
144 |
+
$this->_getSession()->addSuccess(
|
145 |
+
Mage::helper('connector')->__('Total of %d record(s) set for resend.', count($contactIds))
|
146 |
+
);
|
147 |
+
} catch (Exception $e) {
|
148 |
+
$this->_getSession()->addError($e->getMessage());
|
149 |
+
}
|
150 |
+
}
|
151 |
+
$this->_redirect('*/*/index');
|
152 |
+
}
|
153 |
+
|
154 |
+
|
155 |
+
/**
|
156 |
+
* main grid.
|
157 |
+
*/
|
158 |
+
public function gridAction(){
|
159 |
+
$this->loadLayout();
|
160 |
+
$this->renderLayout();
|
161 |
+
}
|
162 |
+
|
163 |
+
protected function _initAction()
|
164 |
+
{
|
165 |
+
$this->_title($this->__('Newsletter'))
|
166 |
+
->_title($this->__('Manage Contacts'));
|
167 |
+
|
168 |
+
$contactId = (int) $this->getRequest()->getParam('id');
|
169 |
+
$contact = Mage::getModel('email_connector/contact')
|
170 |
+
->setStoreId($this->getRequest()->getParam('store', 0));
|
171 |
+
|
172 |
+
if ($contactId) {
|
173 |
+
$contact->load($contactId);
|
174 |
+
}
|
175 |
+
Mage::register('current_contact', $contact);
|
176 |
+
return $contact;
|
177 |
+
}
|
178 |
+
|
179 |
+
public function exportCsvAction()
|
180 |
+
{
|
181 |
+
$fileName = 'contacts.csv';
|
182 |
+
$content = $this->getLayout()->createBlock('email_connector/adminhtml_contact_grid')
|
183 |
+
->getCsvFile();
|
184 |
+
$this->_prepareDownloadResponse($fileName, $content);
|
185 |
+
}
|
186 |
+
|
187 |
+
protected function _isAllowed()
|
188 |
+
{
|
189 |
+
return Mage::getSingleton('admin/session')->isAllowed('newsletter/email_connector/email_connector_contact');
|
190 |
+
}
|
191 |
+
|
192 |
+
}
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Adminhtml_Email_DashboardController extends Mage_Adminhtml_Controller_Action
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* main page.
|
7 |
+
*/
|
8 |
+
public function indexAction()
|
9 |
+
{
|
10 |
+
$this->_title($this->__('Dashboard'));
|
11 |
+
|
12 |
+
$this->loadLayout();
|
13 |
+
$this->_setActiveMenu('email_connector');
|
14 |
+
$this->_addContent($this->getLayout()->createBlock('email_connector/adminhtml_dashboard'));
|
15 |
+
$this->renderLayout();
|
16 |
+
}
|
17 |
+
protected function _isAllowed()
|
18 |
+
{
|
19 |
+
return Mage::getSingleton('admin/session')->isAllowed('newsletter/email_connector/email_connector_dashboard');
|
20 |
+
}
|
21 |
+
}
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Adminhtml_Email_OrderController extends Mage_Adminhtml_Controller_Action
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* main page.
|
7 |
+
*/
|
8 |
+
public function indexAction()
|
9 |
+
{
|
10 |
+
$this->loadLayout();
|
11 |
+
$this->_setActiveMenu('email_connector');
|
12 |
+
$this->_addContent($this->getLayout()->createBlock('email_connector/adminhtml_order'));
|
13 |
+
$this->getLayout()->getBlock('head')->setTitle('Connector Orders');
|
14 |
+
$this->renderLayout();
|
15 |
+
}
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Check currently called action by permissions for current user
|
19 |
+
*
|
20 |
+
* @return bool
|
21 |
+
*/
|
22 |
+
protected function _isAllowed()
|
23 |
+
{
|
24 |
+
return Mage::getSingleton('admin/session')->isAllowed('newsletter/email_connector/email_connector_order');
|
25 |
+
}
|
26 |
+
}
|
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_CreditmemoController extends Mage_Core_Controller_Front_Action
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* predispatch
|
7 |
+
*
|
8 |
+
* @return Mage_Core_Controller_Front_Action|void
|
9 |
+
*/
|
10 |
+
public function preDispatch()
|
11 |
+
{
|
12 |
+
Mage::helper('connector')->auth($this->getRequest()->getParam('code'));
|
13 |
+
$orderId = $this->getRequest()->getParam('order_id', false);
|
14 |
+
if ($orderId) {
|
15 |
+
$order = Mage::getModel('sales/order')->load($orderId);
|
16 |
+
if ($order->getId()) {
|
17 |
+
Mage::app()->setCurrentStore($order->getStoreId());
|
18 |
+
} else {
|
19 |
+
Mage::helper('connector')->log('TE : order not found: ' . $orderId);
|
20 |
+
exit;
|
21 |
+
}
|
22 |
+
} else {
|
23 |
+
Mage::helper('connector')->log('TE : order_id missing :' . $orderId);
|
24 |
+
exit;
|
25 |
+
}
|
26 |
+
parent::preDispatch();
|
27 |
+
}
|
28 |
+
|
29 |
+
/**
|
30 |
+
* New creditmemo.
|
31 |
+
*/
|
32 |
+
public function newAction()
|
33 |
+
{
|
34 |
+
$this->loadLayout();
|
35 |
+
$newOrder = $this->getLayout()->createBlock('email_connector/order_creditmemo', 'connector_creditmemo_new', array(
|
36 |
+
'template' => 'connector/creditmemo/new.phtml'
|
37 |
+
));
|
38 |
+
$this->getLayout()->getBlock('content')->append($newOrder);
|
39 |
+
$items = $this->getLayout()->createBlock('email_connector/order_creditmemo', 'connector_creditmemo_items', array(
|
40 |
+
'template' => 'connector/creditmemo/items.phtml'
|
41 |
+
));
|
42 |
+
$this->getLayout()->getBlock('connector_creditmemo_new')->append($items);
|
43 |
+
$this->renderLayout();
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* New guest action.
|
48 |
+
*/
|
49 |
+
public function newguestAction()
|
50 |
+
{
|
51 |
+
$this->loadLayout();
|
52 |
+
$invoice = $this->getLayout()->createBlock('email_connector/order_invoice', 'connector_creditmemo_guest', array(
|
53 |
+
'template' => 'connector/creditmemo/newguest.phtml'
|
54 |
+
));
|
55 |
+
$this->getLayout()->getBlock('content')->append($invoice);
|
56 |
+
$items = $this->getLayout()->createBlock('email_connector/order_creditmemo', 'connector_creditmemo_items', array(
|
57 |
+
'template' => 'connector/creditmemo/items.phtml'
|
58 |
+
));
|
59 |
+
$this->getLayout()->getBlock('connector_creditmemo_guest')->append($items);
|
60 |
+
|
61 |
+
$this->renderLayout();
|
62 |
+
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* update creditmemo.
|
67 |
+
*/
|
68 |
+
public function updateAction()
|
69 |
+
{
|
70 |
+
$this->loadLayout();
|
71 |
+
$newOrder = $this->getLayout()->createBlock('email_connector/order_creditmemo', 'connector_creditmemo_update', array(
|
72 |
+
'template' => 'connector/creditmemo/update.phtml'
|
73 |
+
));
|
74 |
+
$this->getLayout()->getBlock('content')->append($newOrder);
|
75 |
+
|
76 |
+
$this->renderLayout();
|
77 |
+
}
|
78 |
+
|
79 |
+
/**
|
80 |
+
* update guest.
|
81 |
+
*/
|
82 |
+
public function updateguestAction()
|
83 |
+
{
|
84 |
+
$this->loadLayout();
|
85 |
+
$newOrder = $this->getLayout()->createBlock('email_connector/order_creditmemo', 'connector_creditmemo_update_guest', array(
|
86 |
+
'template' => 'connector/creditmemo/updateguest.phtml'
|
87 |
+
));
|
88 |
+
$this->getLayout()->getBlock('content')->append($newOrder);
|
89 |
+
$this->renderLayout();
|
90 |
+
}
|
91 |
+
}
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_CustomerController extends Mage_Core_Controller_Front_Action
|
4 |
+
{
|
5 |
+
public function preDispatch()
|
6 |
+
{
|
7 |
+
Mage::helper('connector')->auth($this->getRequest()->getParam('code'));
|
8 |
+
parent::preDispatch();
|
9 |
+
}
|
10 |
+
public function newAction()
|
11 |
+
{
|
12 |
+
$this->loadLayout();
|
13 |
+
$newCustomer = $this->getLayout()->createBlock('email_connector/customer', 'connector_customer', array(
|
14 |
+
'template' => 'connector/customer/new.phtml'
|
15 |
+
));
|
16 |
+
$this->getLayout()->getBlock('content')->append($newCustomer);
|
17 |
+
$this->renderLayout();
|
18 |
+
}
|
19 |
+
|
20 |
+
public function confirmationAction()
|
21 |
+
{
|
22 |
+
$this->loadLayout();
|
23 |
+
$newCustomer = $this->getLayout()->createBlock('email_connector/customer', 'connector_customer_confirmation', array(
|
24 |
+
'template' => 'connector/customer/confirmation.phtml'
|
25 |
+
));
|
26 |
+
$this->getLayout()->getBlock('content')->append($newCustomer);
|
27 |
+
$this->renderLayout();
|
28 |
+
}
|
29 |
+
public function confirmedAction()
|
30 |
+
{
|
31 |
+
$this->loadLayout();
|
32 |
+
$newCustomer = $this->getLayout()->createBlock('email_connector/customer', 'connector_customer_confirmed', array(
|
33 |
+
'template' => 'connector/customer/confirmed.phtml'
|
34 |
+
));
|
35 |
+
$this->getLayout()->getBlock('content')->append($newCustomer);
|
36 |
+
$this->renderLayout();
|
37 |
+
}
|
38 |
+
}
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_EmailController extends Mage_Core_Controller_Front_Action
|
4 |
+
{
|
5 |
+
public function indexAction()
|
6 |
+
{
|
7 |
+
//Get current layout state
|
8 |
+
$this->loadLayout();
|
9 |
+
$this->renderLayout();
|
10 |
+
}
|
11 |
+
|
12 |
+
public function couponAction()
|
13 |
+
{
|
14 |
+
$this->loadLayout();
|
15 |
+
$this->renderLayout();
|
16 |
+
}
|
17 |
+
public function basketAction()
|
18 |
+
{
|
19 |
+
Mage::helper('connector')->auth($this->getRequest()->getParam('code'));
|
20 |
+
$this->loadLayout();
|
21 |
+
if ($root = $this->getLayout()->getBlock('root')) {
|
22 |
+
$root->setTemplate('page/blank.phtml');
|
23 |
+
}
|
24 |
+
$basket = $this->getLayout()->createBlock('email_connector/basket', 'connector_basket', array(
|
25 |
+
'template' => 'connector/basket.phtml'
|
26 |
+
));
|
27 |
+
$this->getLayout()->getBlock('content')->append($basket);
|
28 |
+
$this->renderLayout();
|
29 |
+
}
|
30 |
+
|
31 |
+
public function logAction()
|
32 |
+
{
|
33 |
+
//file name param
|
34 |
+
$file = $this->getRequest()->getParam('file');
|
35 |
+
$fileName = $file . '.log';
|
36 |
+
$filePath = Mage::getBaseDir('log') . DIRECTORY_SEPARATOR . $fileName;
|
37 |
+
|
38 |
+
$this->_prepareDownloadResponse($fileName, array(
|
39 |
+
'type' => 'filename',
|
40 |
+
'value' => $filePath
|
41 |
+
));
|
42 |
+
exit();
|
43 |
+
}
|
44 |
+
|
45 |
+
public function callbackAction()
|
46 |
+
{
|
47 |
+
$code = $this->getRequest()->getParam('code', false);
|
48 |
+
$userId = $this->getRequest()->getParam('state');
|
49 |
+
$adminUser = Mage::getModel('admin/user')->load($userId);
|
50 |
+
$baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB, true);
|
51 |
+
$callback = $baseUrl . 'connector/email/callback';
|
52 |
+
|
53 |
+
if ($code) {
|
54 |
+
$data = 'client_id=' . Mage::getStoreConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_CLIENT_ID) .
|
55 |
+
'&client_secret=' . Mage::getStoreConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_CLIENT_SECRET_ID) .
|
56 |
+
'&redirect_uri=' . $callback .
|
57 |
+
'&grant_type=authorization_code' .
|
58 |
+
'&code=' . $code;
|
59 |
+
|
60 |
+
|
61 |
+
$url = Dotdigitalgroup_Email_Helper_Config::API_CONNECTOR_URL_TOKEN;
|
62 |
+
$ch = curl_init();
|
63 |
+
curl_setopt($ch, CURLOPT_URL, $url);
|
64 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
65 |
+
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
|
66 |
+
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
|
67 |
+
curl_setopt($ch, CURLOPT_POST, count($data));
|
68 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
|
69 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, array ('Content-Type: application/x-www-form-urlencoded'));
|
70 |
+
|
71 |
+
|
72 |
+
$response = json_decode(curl_exec($ch));
|
73 |
+
if ($response === false) {
|
74 |
+
Mage::helper('connector')->log("Error Number: " . curl_errno($ch));
|
75 |
+
}
|
76 |
+
|
77 |
+
$adminUser->setRefreshToken($response->refresh_token)->save();
|
78 |
+
}
|
79 |
+
$this->_redirectReferer(Mage::helper('adminhtml')->getUrl('adminhtml/email_automation/index'));
|
80 |
+
}
|
81 |
+
}
|
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_InvoiceController extends Mage_Core_Controller_Front_Action
|
4 |
+
{
|
5 |
+
public function preDispatch()
|
6 |
+
{
|
7 |
+
Mage::helper('connector')->auth($this->getRequest()->getParam('code'));
|
8 |
+
$orderId = $this->getRequest()->getParam('order_id', false);
|
9 |
+
if ($orderId) {
|
10 |
+
$order = Mage::getModel('sales/order')->load($orderId);
|
11 |
+
if ($order->getId()) {
|
12 |
+
Mage::app()->setCurrentStore($order->getStoreId());
|
13 |
+
} else {
|
14 |
+
Mage::helper('connector')->log('TE : order not found: ' . $orderId);
|
15 |
+
exit;
|
16 |
+
}
|
17 |
+
} else {
|
18 |
+
Mage::helper('connector')->log('TE : order_id missing :' . $orderId);
|
19 |
+
exit;
|
20 |
+
}
|
21 |
+
parent::preDispatch();
|
22 |
+
}
|
23 |
+
public function newAction()
|
24 |
+
{
|
25 |
+
$this->loadLayout();
|
26 |
+
$newOrder = $this->getLayout()->createBlock('email_connector/order_invoice', 'connector_invoice_new', array(
|
27 |
+
'template' => 'connector/invoice/new.phtml'
|
28 |
+
));
|
29 |
+
$this->getLayout()->getBlock('content')->append($newOrder);
|
30 |
+
$items = $this->getLayout()->createBlock('email_connector/order_invoice', 'connector_order_items', array(
|
31 |
+
'template' => 'connector/order/items.phtml'
|
32 |
+
));
|
33 |
+
$this->getLayout()->getBlock('connector_invoice_new')->append($items);
|
34 |
+
$this->renderLayout();
|
35 |
+
}
|
36 |
+
|
37 |
+
public function newguestAction()
|
38 |
+
{
|
39 |
+
$this->loadLayout();
|
40 |
+
$invoice = $this->getLayout()->createBlock('email_connector/order_invoice', 'connector_invoiceguest_new', array(
|
41 |
+
'template' => 'connector/invoice/newguest.phtml'
|
42 |
+
));
|
43 |
+
$this->getLayout()->getBlock('content')->append($invoice);
|
44 |
+
$items = $this->getLayout()->createBlock('email_connector/order_invoice', 'connector_order_items', array(
|
45 |
+
'template' => 'connector/order/items.phtml'
|
46 |
+
));
|
47 |
+
$this->getLayout()->getBlock('connector_invoiceguest_new')->append($items);
|
48 |
+
|
49 |
+
$this->renderLayout();
|
50 |
+
|
51 |
+
}
|
52 |
+
public function updateAction()
|
53 |
+
{
|
54 |
+
$this->loadLayout();
|
55 |
+
$invoice = $this->getLayout()->createBlock('email_connector/order_invoice', 'connector_invoice_update', array(
|
56 |
+
'template' => 'connector/invoice/update.phtml'
|
57 |
+
));
|
58 |
+
$this->getLayout()->getBlock('content')->append($invoice);
|
59 |
+
$this->renderLayout();
|
60 |
+
}
|
61 |
+
public function updateguestAction()
|
62 |
+
{
|
63 |
+
$this->loadLayout();
|
64 |
+
$invoice = $this->getLayout()->createBlock('email_connector/order_invoice', 'connector_invoice_updateguest', array(
|
65 |
+
'template' => 'connector/invoice/updateguest.phtml'
|
66 |
+
));
|
67 |
+
$this->getLayout()->getBlock('content')->append($invoice);
|
68 |
+
$this->renderLayout();
|
69 |
+
}
|
70 |
+
|
71 |
+
}
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_OrderController extends Mage_Core_Controller_Front_Action
|
4 |
+
{
|
5 |
+
public function preDispatch()
|
6 |
+
{
|
7 |
+
Mage::helper('connector')->auth($this->getRequest()->getParam('code'));
|
8 |
+
$orderId = $this->getRequest()->getParam('order_id', false);
|
9 |
+
if ($orderId) {
|
10 |
+
$order = Mage::getModel('sales/order')->load($orderId);
|
11 |
+
if ($order->getId()) {
|
12 |
+
Mage::app()->setCurrentStore($order->getStoreId());
|
13 |
+
} else {
|
14 |
+
Mage::helper('connector')->log('TE : order not found: ' . $orderId);
|
15 |
+
exit;
|
16 |
+
}
|
17 |
+
} else {
|
18 |
+
Mage::helper('connector')->log('TE : order_id missing :' . $orderId);
|
19 |
+
exit;
|
20 |
+
}
|
21 |
+
parent::preDispatch();
|
22 |
+
}
|
23 |
+
public function newAction()
|
24 |
+
{
|
25 |
+
$this->loadLayout();
|
26 |
+
$newOrder = $this->getLayout()->createBlock('email_connector/order', 'connector_order', array(
|
27 |
+
'template' => 'connector/order/new.phtml'
|
28 |
+
));
|
29 |
+
$this->getLayout()->getBlock('content')->append($newOrder);
|
30 |
+
$items = $this->getLayout()->createBlock('email_connector/order', 'connector_order_items', array(
|
31 |
+
'template' => 'connector/order/items.phtml'
|
32 |
+
));
|
33 |
+
$this->getLayout()->getBlock('connector_order')->append($items);
|
34 |
+
$this->renderLayout();
|
35 |
+
}
|
36 |
+
|
37 |
+
public function newguestAction()
|
38 |
+
{
|
39 |
+
$this->loadLayout();
|
40 |
+
$newOrder = $this->getLayout()->createBlock('email_connector/order', 'connector_order_guest', array(
|
41 |
+
'template' => 'connector/order/newguest.phtml'
|
42 |
+
));
|
43 |
+
$this->getLayout()->getBlock('content')->append($newOrder);
|
44 |
+
$items = $this->getLayout()->createBlock('email_connector/order', 'connector_order_items', array(
|
45 |
+
'template' => 'connector/order/items.phtml'
|
46 |
+
));
|
47 |
+
$this->getLayout()->getBlock('connector_order_guest')->append($items);
|
48 |
+
$this->renderLayout();
|
49 |
+
|
50 |
+
}
|
51 |
+
public function updateAction()
|
52 |
+
{
|
53 |
+
$this->loadLayout();
|
54 |
+
$newOrder = $this->getLayout()->createBlock('email_connector/order', 'connector_order_update', array(
|
55 |
+
'template' => 'connector/order/update.phtml'
|
56 |
+
));
|
57 |
+
$this->getLayout()->getBlock('content')->append($newOrder);
|
58 |
+
$this->renderLayout();
|
59 |
+
}
|
60 |
+
public function updateguestAction()
|
61 |
+
{
|
62 |
+
$this->loadLayout();
|
63 |
+
$newOrder = $this->getLayout()->createBlock('email_connector/order', 'connector_order_update_guest', array(
|
64 |
+
'template' => 'connector/order/updateguest.phtml'
|
65 |
+
));
|
66 |
+
$this->getLayout()->getBlock('content')->append($newOrder);
|
67 |
+
$this->renderLayout();
|
68 |
+
}
|
69 |
+
|
70 |
+
}
|
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_ProductsController extends Mage_Core_Controller_Front_Action
|
4 |
+
{
|
5 |
+
public function preDispatch()
|
6 |
+
{
|
7 |
+
Mage::helper('connector')->auth($this->getRequest()->getParam('code'));
|
8 |
+
if ($this->getRequest()->getActionName() != 'push') {
|
9 |
+
$orderId = $this->getRequest()->getParam('order_id', false);
|
10 |
+
if ($orderId) {
|
11 |
+
$order = Mage::getModel('sales/order')->load($orderId);
|
12 |
+
if ($order->getId()) {
|
13 |
+
Mage::app()->setCurrentStore($order->getStoreId());
|
14 |
+
} else {
|
15 |
+
Mage::helper('connector')->log('Dynamic : order not found: ' . $orderId);
|
16 |
+
exit;
|
17 |
+
}
|
18 |
+
} else {
|
19 |
+
Mage::helper('connector')->log('Dynamic : order_id missing :' . $orderId);
|
20 |
+
exit;
|
21 |
+
}
|
22 |
+
}
|
23 |
+
|
24 |
+
parent::preDispatch();
|
25 |
+
}
|
26 |
+
public function relatedAction()
|
27 |
+
{
|
28 |
+
$this->loadLayout();
|
29 |
+
$products = $this->getLayout()->createBlock('email_connector/recommended_products', 'connector_recommended', array(
|
30 |
+
'template' => 'connector/product/list.phtml'
|
31 |
+
));
|
32 |
+
$this->getLayout()->getBlock('content')->append($products);
|
33 |
+
|
34 |
+
$this->renderLayout();
|
35 |
+
|
36 |
+
}
|
37 |
+
public function crosssellAction()
|
38 |
+
{
|
39 |
+
$this->loadLayout();
|
40 |
+
$products = $this->getLayout()->createBlock('email_connector/recommended_products', 'connector_recommended', array(
|
41 |
+
'template' => 'connector/product/list.phtml'
|
42 |
+
));
|
43 |
+
$this->getLayout()->getBlock('content')->append($products);
|
44 |
+
|
45 |
+
$this->renderLayout();
|
46 |
+
}
|
47 |
+
|
48 |
+
public function upsellAction()
|
49 |
+
{
|
50 |
+
$this->loadLayout();
|
51 |
+
$products = $this->getLayout()->createBlock('email_connector/recommended_products', 'connector_recommended', array(
|
52 |
+
'template' => 'connector/product/list.phtml'
|
53 |
+
));
|
54 |
+
$this->getLayout()->getBlock('content')->append($products);
|
55 |
+
|
56 |
+
$this->renderLayout();
|
57 |
+
}
|
58 |
+
|
59 |
+
|
60 |
+
public function pushAction()
|
61 |
+
{
|
62 |
+
$this->loadLayout();
|
63 |
+
$products = $this->getLayout()->createBlock('email_connector/recommended_push', 'connector_product', array(
|
64 |
+
'template' => 'connector/product/list.phtml'
|
65 |
+
));
|
66 |
+
$this->getLayout()->getBlock('content')->append($products);
|
67 |
+
$this->renderLayout();
|
68 |
+
}
|
69 |
+
|
70 |
+
|
71 |
+
}
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_ReportController extends Mage_Core_Controller_Front_Action
|
4 |
+
{
|
5 |
+
public function preDispatch()
|
6 |
+
{
|
7 |
+
Mage::helper('connector')->auth($this->getRequest()->getParam('code'));
|
8 |
+
|
9 |
+
|
10 |
+
parent::preDispatch();
|
11 |
+
}
|
12 |
+
|
13 |
+
public function bestsellersAction()
|
14 |
+
{
|
15 |
+
$this->loadLayout();
|
16 |
+
$products = $this->getLayout()->createBlock('email_connector/recommended_bestsellers', 'connector_customer', array(
|
17 |
+
'template' => 'connector/product/list.phtml'
|
18 |
+
));
|
19 |
+
$this->getLayout()->getBlock('content')->append($products);
|
20 |
+
$this->renderLayout();
|
21 |
+
|
22 |
+
}
|
23 |
+
|
24 |
+
public function mostviewedAction()
|
25 |
+
{
|
26 |
+
$this->loadLayout();
|
27 |
+
$products = $this->getLayout()->createBlock('email_connector/recommended_mostviewed', 'connector_customer', array(
|
28 |
+
'template' => 'connector/product/list.phtml'
|
29 |
+
));
|
30 |
+
$this->getLayout()->getBlock('content')->append($products);
|
31 |
+
$this->renderLayout();
|
32 |
+
|
33 |
+
}
|
34 |
+
|
35 |
+
public function recentlyviewedAction()
|
36 |
+
{
|
37 |
+
$customerId = $this->getRequest()->getParam('customer_id');
|
38 |
+
if (!$customerId) {
|
39 |
+
Mage::helper('connector')->log('Recentlyviewed : no customer id : ' . $customerId);
|
40 |
+
exit;
|
41 |
+
}
|
42 |
+
|
43 |
+
$this->loadLayout();
|
44 |
+
$products = $this->getLayout()->createBlock('email_connector/recommended_recentlyviewed', 'connector_customer', array(
|
45 |
+
'template' => 'connector/product/list.phtml'
|
46 |
+
));
|
47 |
+
$this->getLayout()->getBlock('content')->append($products);
|
48 |
+
$this->renderLayout();
|
49 |
+
}
|
50 |
+
|
51 |
+
public function customerAction()
|
52 |
+
{
|
53 |
+
$this->loadLayout();
|
54 |
+
$products = $this->getLayout()->createBlock('email_connector/customer', 'connector_customer', array(
|
55 |
+
'template' => 'connector/products.phtml'
|
56 |
+
));
|
57 |
+
$this->getLayout()->getBlock('content')->append($products);
|
58 |
+
$this->renderLayout();
|
59 |
+
}
|
60 |
+
|
61 |
+
|
62 |
+
|
63 |
+
}
|
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_ShippingController extends Mage_Core_Controller_Front_Action
|
4 |
+
{
|
5 |
+
public function preDispatch()
|
6 |
+
{
|
7 |
+
Mage::helper('connector')->auth($this->getRequest()->getParam('code'));
|
8 |
+
$orderId = $this->getRequest()->getParam('order_id', false);
|
9 |
+
if ($orderId) {
|
10 |
+
$order = Mage::getModel('sales/order')->load($orderId);
|
11 |
+
if ($order->getId()) {
|
12 |
+
Mage::app()->setCurrentStore($order->getStoreId());
|
13 |
+
} else {
|
14 |
+
Mage::helper('connector')->log('TE : order not found: ' . $orderId);
|
15 |
+
exit;
|
16 |
+
}
|
17 |
+
} else {
|
18 |
+
Mage::helper('connector')->log('TE : order_id missing :' . $orderId);
|
19 |
+
exit;
|
20 |
+
}
|
21 |
+
parent::preDispatch();
|
22 |
+
}
|
23 |
+
public function newAction()
|
24 |
+
{
|
25 |
+
$this->loadLayout();
|
26 |
+
$newOrder = $this->getLayout()->createBlock('email_connector/order_shipping', 'connector_shipping_new', array(
|
27 |
+
'template' => 'connector/shipping/new.phtml'
|
28 |
+
));
|
29 |
+
$this->getLayout()->getBlock('content')->append($newOrder);
|
30 |
+
$items = $this->getLayout()->createBlock('email_connector/order', 'connector_shipping_items', array(
|
31 |
+
'template' => 'connector/order/items.phtml'
|
32 |
+
));
|
33 |
+
$this->getLayout()->getBlock('connector_shipping_new')->append($items);
|
34 |
+
$items = $this->getLayout()->createBlock('email_connector/order_shipping', 'connector_shipping_track', array(
|
35 |
+
'template' => 'email/order/shipment/track.phtml'
|
36 |
+
));
|
37 |
+
$this->getLayout()->getBlock('connector_shipping_new')->append($items);
|
38 |
+
$this->renderLayout();
|
39 |
+
}
|
40 |
+
|
41 |
+
public function newguestAction()
|
42 |
+
{
|
43 |
+
$this->loadLayout();
|
44 |
+
$newOrder = $this->getLayout()->createBlock('email_connector/order_shipping', 'connector_shipping_newguest', array(
|
45 |
+
'template' => 'connector/shipping/newguest.phtml'
|
46 |
+
));
|
47 |
+
$this->getLayout()->getBlock('content')->append($newOrder);
|
48 |
+
$items = $this->getLayout()->createBlock('email_connector/order', 'connector_shipping_items', array(
|
49 |
+
'template' => 'connector/order/items.phtml'
|
50 |
+
));
|
51 |
+
$this->getLayout()->getBlock('connector_shipping_newguest')->append($items);
|
52 |
+
$items = $this->getLayout()->createBlock('email_connector/order_shipping', 'connector_shipping_track', array(
|
53 |
+
'template' => 'email/order/shipment/track.phtml'
|
54 |
+
));
|
55 |
+
$this->getLayout()->getBlock('connector_shipping_newguest')->append($items);
|
56 |
+
$this->renderLayout();
|
57 |
+
|
58 |
+
}
|
59 |
+
|
60 |
+
public function updateAction()
|
61 |
+
{
|
62 |
+
$this->loadLayout();
|
63 |
+
$newOrder = $this->getLayout()->createBlock('email_connector/order_shipping', 'connector_shipping_update', array(
|
64 |
+
'template' => 'connector/shipping/update.phtml'
|
65 |
+
));
|
66 |
+
$this->getLayout()->getBlock('content')->append($newOrder);
|
67 |
+
$this->renderLayout();
|
68 |
+
}
|
69 |
+
|
70 |
+
public function updateguestAction()
|
71 |
+
{
|
72 |
+
$this->loadLayout();
|
73 |
+
$newOrder = $this->getLayout()->createBlock('email_connector/order_shipping', 'connector_shipping_updateguest', array(
|
74 |
+
'template' => 'connector/shipping/updateguest.phtml'
|
75 |
+
));
|
76 |
+
$this->getLayout()->getBlock('content')->append($newOrder);
|
77 |
+
$this->renderLayout();
|
78 |
+
}
|
79 |
+
}
|
@@ -0,0 +1,145 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<menu>
|
4 |
+
<email_connector translate="title">
|
5 |
+
<title>Marketing Automation</title>
|
6 |
+
<sort_order>70</sort_order>
|
7 |
+
<children>
|
8 |
+
<email_connector_dashboard translate="title">
|
9 |
+
<title>Dashboard</title>
|
10 |
+
<sort_order>10</sort_order>
|
11 |
+
<action>adminhtml/email_dashboard</action>
|
12 |
+
</email_connector_dashboard>
|
13 |
+
<automation_studio translate="title">
|
14 |
+
<title>Automation Studio</title>
|
15 |
+
<sort_order>20</sort_order>
|
16 |
+
<action>adminhtml/email_automation</action>
|
17 |
+
</automation_studio>
|
18 |
+
<reports translate="title">
|
19 |
+
<title>Reports</title>
|
20 |
+
<sort_order>30</sort_order>
|
21 |
+
<children>
|
22 |
+
<email_connector_order translate="title">
|
23 |
+
<title>Orders Sync</title>
|
24 |
+
<sort_order>20</sort_order>
|
25 |
+
<action>adminhtml/email_order</action>
|
26 |
+
</email_connector_order>
|
27 |
+
<email_connector_campaign translate="title">
|
28 |
+
<title>Email Send Status</title>
|
29 |
+
<sort_order>30</sort_order>
|
30 |
+
<action>adminhtml/email_campaign</action>
|
31 |
+
</email_connector_campaign>
|
32 |
+
<email_connector_contact translate="title">
|
33 |
+
<title>Contact Sync</title>
|
34 |
+
<sort_order>10</sort_order>
|
35 |
+
<action>adminhtml/email_contact</action>
|
36 |
+
</email_connector_contact>
|
37 |
+
</children>
|
38 |
+
</reports>
|
39 |
+
<email_configuration translate="title">
|
40 |
+
<title>Configuration</title>
|
41 |
+
<sort_order>40</sort_order>
|
42 |
+
<children>
|
43 |
+
<api_credentials translate="title">
|
44 |
+
<title>Api Credentials</title>
|
45 |
+
<sort_order>10</sort_order>
|
46 |
+
<action>adminhtml/system_config/edit/section/connector_api_credentials</action>
|
47 |
+
</api_credentials>
|
48 |
+
<data_mapping translate="title">
|
49 |
+
<title>Data Mapping</title>
|
50 |
+
<sort_order>20</sort_order>
|
51 |
+
<action>adminhtml/system_config/edit/section/connector_data_mapping</action>
|
52 |
+
</data_mapping>
|
53 |
+
<sync_settings translate="title">
|
54 |
+
<title>Sync Settings</title>
|
55 |
+
<sort_order>30</sort_order>
|
56 |
+
<action>adminhtml/system_config/edit/section/connector_sync_settings</action>
|
57 |
+
</sync_settings>
|
58 |
+
</children>
|
59 |
+
</email_configuration>
|
60 |
+
</children>
|
61 |
+
</email_connector>
|
62 |
+
</menu>
|
63 |
+
<acl>
|
64 |
+
<resources>
|
65 |
+
<admin>
|
66 |
+
<children>
|
67 |
+
<email_connector>
|
68 |
+
<title>Email Connector</title>
|
69 |
+
<children>
|
70 |
+
<email_connector_dashboard translate="title">
|
71 |
+
<title>Dashboard</title>
|
72 |
+
</email_connector_dashboard>
|
73 |
+
<automation_studio translate="title">
|
74 |
+
<title>Automation Studio</title>
|
75 |
+
</automation_studio>
|
76 |
+
<reports>
|
77 |
+
<title>Reports</title>
|
78 |
+
<children>
|
79 |
+
<email_connector_order translate="title">
|
80 |
+
<title>Email Connector Orders</title>
|
81 |
+
</email_connector_order>
|
82 |
+
<email_connector_campaign translate="title">
|
83 |
+
<title>Email Connector Campaigns</title>
|
84 |
+
</email_connector_campaign>
|
85 |
+
<email_connector_contact translate="title">
|
86 |
+
<title>Email Connector Contacts</title>
|
87 |
+
</email_connector_contact>
|
88 |
+
</children>
|
89 |
+
</reports>
|
90 |
+
<email_configuration translate="title">
|
91 |
+
<title>Email Configuration</title>
|
92 |
+
<children>
|
93 |
+
<api_credentials translate="title">
|
94 |
+
<title>Api Credentials</title>
|
95 |
+
</api_credentials>
|
96 |
+
<data_mapping translate="title">
|
97 |
+
<title>Data Mapping</title>
|
98 |
+
</data_mapping>
|
99 |
+
<sync_settings translate="title">
|
100 |
+
<title>Sync Settings</title>
|
101 |
+
</sync_settings>
|
102 |
+
</children>
|
103 |
+
</email_configuration>
|
104 |
+
</children>
|
105 |
+
</email_connector>
|
106 |
+
<system>
|
107 |
+
<children>
|
108 |
+
<config>
|
109 |
+
<children>
|
110 |
+
<connector_api_credentials translate="title">
|
111 |
+
<title><![CDATA[Email API Credentials]]></title>
|
112 |
+
</connector_api_credentials>
|
113 |
+
<connector_sync_settings translate="title">
|
114 |
+
<title><![CDATA[Email Sync Settings]]></title>
|
115 |
+
</connector_sync_settings>
|
116 |
+
<connector_data_mapping translate="title">
|
117 |
+
<title><![CDATA[Email Data Field Mapping]]></title>
|
118 |
+
</connector_data_mapping>
|
119 |
+
<connector_roi_tracking translate="title">
|
120 |
+
<title><![CDATA[Email ROI & Tracking]]></title>
|
121 |
+
</connector_roi_tracking>
|
122 |
+
<connector_lost_baskets translate="title">
|
123 |
+
<title><![CDATA[Email Lost Baskets]]></title>
|
124 |
+
</connector_lost_baskets>
|
125 |
+
<connector_sms translate="title">
|
126 |
+
<title><![CDATA[Email SMS Section]]></title>
|
127 |
+
</connector_sms>
|
128 |
+
<connector_dynamic_content translate="title">
|
129 |
+
<title><![CDATA[Email Dynamic Content]]></title>
|
130 |
+
</connector_dynamic_content>
|
131 |
+
<connector_transactional_emails translate="title">
|
132 |
+
<title><![CDATA[Email Transactional Email]]></title>
|
133 |
+
</connector_transactional_emails>
|
134 |
+
<connector_advanced_settings translate="title">
|
135 |
+
<title><![CDATA[Email Advanced Settings]]></title>
|
136 |
+
</connector_advanced_settings>
|
137 |
+
</children>
|
138 |
+
</config>
|
139 |
+
</children>
|
140 |
+
</system>
|
141 |
+
</children>
|
142 |
+
</admin>
|
143 |
+
</resources>
|
144 |
+
</acl>
|
145 |
+
</config>
|
@@ -0,0 +1,457 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Dotdigitalgroup_Email>
|
5 |
+
<version>3.0.3</version>
|
6 |
+
</Dotdigitalgroup_Email>
|
7 |
+
</modules>
|
8 |
+
<frontend>
|
9 |
+
<routers>
|
10 |
+
<connector>
|
11 |
+
<use>standard</use>
|
12 |
+
<args>
|
13 |
+
<module>Dotdigitalgroup_Email</module>
|
14 |
+
<frontName>connector</frontName>
|
15 |
+
</args>
|
16 |
+
</connector>
|
17 |
+
</routers>
|
18 |
+
<layout>
|
19 |
+
<updates>
|
20 |
+
<connector>
|
21 |
+
<file>connector.xml</file>
|
22 |
+
</connector>
|
23 |
+
</updates>
|
24 |
+
</layout>
|
25 |
+
</frontend>
|
26 |
+
<global>
|
27 |
+
<resources>
|
28 |
+
<email_connector_setup>
|
29 |
+
<setup>
|
30 |
+
<module>Dotdigitalgroup_Email</module>
|
31 |
+
<class>Dotdigitalgroup_Email_Model_Resource_Setup</class>
|
32 |
+
</setup>
|
33 |
+
</email_connector_setup>
|
34 |
+
</resources>
|
35 |
+
<models>
|
36 |
+
<email_connector>
|
37 |
+
<class>Dotdigitalgroup_Email_Model</class>
|
38 |
+
<resourceModel>email_connector_resource</resourceModel>
|
39 |
+
</email_connector>
|
40 |
+
<email_connector_resource>
|
41 |
+
<class>Dotdigitalgroup_Email_Model_Resource</class>
|
42 |
+
<entities>
|
43 |
+
<order>
|
44 |
+
<table>email_order</table>
|
45 |
+
</order>
|
46 |
+
<contact>
|
47 |
+
<table>email_contact</table>
|
48 |
+
</contact>
|
49 |
+
<campaign>
|
50 |
+
<table>email_campaign</table>
|
51 |
+
</campaign>
|
52 |
+
</entities>
|
53 |
+
</email_connector_resource>
|
54 |
+
<core>
|
55 |
+
<rewrite>
|
56 |
+
<email_template>Dotdigitalgroup_Email_Model_Email_Template</email_template>
|
57 |
+
<email_template_mailer>Dotdigitalgroup_Email_Model_Email_Template_Mailer</email_template_mailer>
|
58 |
+
</rewrite>
|
59 |
+
</core>
|
60 |
+
</models>
|
61 |
+
<helpers>
|
62 |
+
<connector>
|
63 |
+
<class>Dotdigitalgroup_Email_Helper</class>
|
64 |
+
</connector>
|
65 |
+
</helpers>
|
66 |
+
<blocks>
|
67 |
+
<email_connector>
|
68 |
+
<class>Dotdigitalgroup_Email_Block</class>
|
69 |
+
</email_connector>
|
70 |
+
</blocks>
|
71 |
+
<events>
|
72 |
+
<admin_system_config_changed_section_connector_api_credentials>
|
73 |
+
<observers>
|
74 |
+
<connector_api_save>
|
75 |
+
<class>Dotdigitalgroup_Email_Model_Adminhtml_Observer</class>
|
76 |
+
<method>actionConfigSaveApi</method>
|
77 |
+
</connector_api_save>
|
78 |
+
</observers>
|
79 |
+
</admin_system_config_changed_section_connector_api_credentials>
|
80 |
+
<admin_system_config_changed_section_connector_transactional_emails>
|
81 |
+
<observers>
|
82 |
+
<connector_transactional_api>
|
83 |
+
<class>Dotdigitalgroup_Email_Model_Adminhtml_Observer</class>
|
84 |
+
<method>actionConfigTransactional</method>
|
85 |
+
</connector_transactional_api>
|
86 |
+
</observers>
|
87 |
+
</admin_system_config_changed_section_connector_transactional_emails>
|
88 |
+
<admin_system_config_changed_section_connector_sync_settings>
|
89 |
+
<observers>
|
90 |
+
<connector_sync_reset>
|
91 |
+
<class>Dotdigitalgroup_Email_Model_Adminhtml_Observer</class>
|
92 |
+
<method>actionConfigResetContacts</method>
|
93 |
+
</connector_sync_reset>
|
94 |
+
</observers>
|
95 |
+
</admin_system_config_changed_section_connector_sync_settings>
|
96 |
+
<admin_system_config_changed_section_connector_data_mapping>
|
97 |
+
<observers>
|
98 |
+
<connector_data_mapping_reset>
|
99 |
+
<class>Dotdigitalgroup_Email_Model_Adminhtml_Observer</class>
|
100 |
+
<method>actionConfigResetContacts</method>
|
101 |
+
</connector_data_mapping_reset>
|
102 |
+
</observers>
|
103 |
+
</admin_system_config_changed_section_connector_data_mapping>
|
104 |
+
<customer_save_after>
|
105 |
+
<observers>
|
106 |
+
<connector_customer_save_after>
|
107 |
+
<class>Dotdigitalgroup_Email_Model_Customer_Observer</class>
|
108 |
+
<method>handleCustomerSaveBefore</method>
|
109 |
+
</connector_customer_save_after>
|
110 |
+
</observers>
|
111 |
+
</customer_save_after>
|
112 |
+
<newsletter_subscriber_save_before>
|
113 |
+
<observers>
|
114 |
+
<connector_newsletter_subscriber_save_after>
|
115 |
+
<class>Dotdigitalgroup_Email_Model_Newsletter_Observer</class>
|
116 |
+
<method>handleNewsletterSubscriberSave</method>
|
117 |
+
</connector_newsletter_subscriber_save_after>
|
118 |
+
</observers>
|
119 |
+
</newsletter_subscriber_save_before>
|
120 |
+
<sales_order_place_after>
|
121 |
+
<observers>
|
122 |
+
<connector_record_sale>
|
123 |
+
<type>singleton</type>
|
124 |
+
<class>Dotdigitalgroup_Email_Model_Sales_Observer</class>
|
125 |
+
<method>handleSalesOrderPlaceAfter</method>
|
126 |
+
</connector_record_sale>
|
127 |
+
</observers>
|
128 |
+
</sales_order_place_after>
|
129 |
+
<sales_order_save_before>
|
130 |
+
<observers>
|
131 |
+
<connector_sales_save_before>
|
132 |
+
<class>Dotdigitalgroup_Email_Model_Sales_Observer</class>
|
133 |
+
<method>handleSalesOrderSaveBefore</method>
|
134 |
+
</connector_sales_save_before>
|
135 |
+
</observers>
|
136 |
+
</sales_order_save_before>
|
137 |
+
<sales_order_save_after>
|
138 |
+
<observers>
|
139 |
+
<connector_checkout_type_onepage_save_order_after>
|
140 |
+
<class>Dotdigitalgroup_Email_Model_Sales_Observer</class>
|
141 |
+
<method>handleSalesOrderSaveAfter</method>
|
142 |
+
</connector_checkout_type_onepage_save_order_after>
|
143 |
+
</observers>
|
144 |
+
</sales_order_save_after>
|
145 |
+
<sales_order_creditmemo_save_after>
|
146 |
+
<observers>
|
147 |
+
<connector_sales_order_payment_refund>
|
148 |
+
<class>Dotdigitalgroup_Email_Model_Sales_Observer</class>
|
149 |
+
<method>handleSalesOrderRefund</method>
|
150 |
+
</connector_sales_order_payment_refund>
|
151 |
+
</observers>
|
152 |
+
</sales_order_creditmemo_save_after>
|
153 |
+
<order_cancel_after>
|
154 |
+
<observers>
|
155 |
+
<connector_sales_order_cancel>
|
156 |
+
<class>Dotdigitalgroup_Email_Model_Sales_Observer</class>
|
157 |
+
<method>hangleSalesOrderCancel</method>
|
158 |
+
</connector_sales_order_cancel>
|
159 |
+
</observers>
|
160 |
+
</order_cancel_after>
|
161 |
+
</events>
|
162 |
+
</global>
|
163 |
+
<adminhtml>
|
164 |
+
<layout>
|
165 |
+
<updates>
|
166 |
+
<connector_email>
|
167 |
+
<file>connector/email.xml</file>
|
168 |
+
</connector_email>
|
169 |
+
</updates>
|
170 |
+
</layout>
|
171 |
+
<translate>
|
172 |
+
<modules>
|
173 |
+
<Dotdigitalgroup_Email>
|
174 |
+
<files>
|
175 |
+
<default>Dotdigitalgroup_Email.csv</default>
|
176 |
+
</files>
|
177 |
+
</Dotdigitalgroup_Email>
|
178 |
+
</modules>
|
179 |
+
</translate>
|
180 |
+
</adminhtml>
|
181 |
+
<admin>
|
182 |
+
<routers>
|
183 |
+
<adminhtml>
|
184 |
+
<args>
|
185 |
+
<modules>
|
186 |
+
<Dotdigitalgroup_Email before="Mage_Adminhtml">Dotdigitalgroup_Email_Adminhtml</Dotdigitalgroup_Email>
|
187 |
+
</modules>
|
188 |
+
</args>
|
189 |
+
</adminhtml>
|
190 |
+
</routers>
|
191 |
+
</admin>
|
192 |
+
<crontab>
|
193 |
+
<jobs>
|
194 |
+
<connector_email_customer_sync>
|
195 |
+
<run><model>email_connector/cron::contactSync</model></run>
|
196 |
+
<schedule>
|
197 |
+
<cron_expr>*/15 * * * *</cron_expr>
|
198 |
+
</schedule>
|
199 |
+
</connector_email_customer_sync>
|
200 |
+
<connector_email_subscriber_and_guest_sync>
|
201 |
+
<run><model>email_connector/cron::subscribersAndGuestSync</model></run>
|
202 |
+
<schedule>
|
203 |
+
<cron_expr>*/15 * * * *</cron_expr>
|
204 |
+
</schedule>
|
205 |
+
</connector_email_subscriber_and_guest_sync>
|
206 |
+
<connector_email_lostbaskets>
|
207 |
+
<run><model>email_connector/cron::lostBaskets</model></run>
|
208 |
+
<schedule>
|
209 |
+
<cron_expr>*/5 * * * *</cron_expr>
|
210 |
+
</schedule>
|
211 |
+
</connector_email_lostbaskets>
|
212 |
+
<connector_email_campaign>
|
213 |
+
<run>
|
214 |
+
<model>email_connector/cron::sendMappedEmails</model>
|
215 |
+
</run>
|
216 |
+
<schedule>
|
217 |
+
<cron_expr>02,07,12,17,22,27,32,37,42,47,52,57 * * * *</cron_expr>
|
218 |
+
</schedule>
|
219 |
+
</connector_email_campaign>
|
220 |
+
<connector_email_order_sync>
|
221 |
+
<run><model>email_connector/cron::orderSync</model></run>
|
222 |
+
<schedule>
|
223 |
+
<cron_expr>*/15 * * * *</cron_expr>
|
224 |
+
</schedule>
|
225 |
+
</connector_email_order_sync>
|
226 |
+
<connector_email_cleaner>
|
227 |
+
<run><model>email_connector/cron::cleaning</model></run>
|
228 |
+
<schedule>
|
229 |
+
<cron_expr>0 0 1 * * </cron_expr>
|
230 |
+
</schedule>
|
231 |
+
</connector_email_cleaner>
|
232 |
+
</jobs>
|
233 |
+
</crontab>
|
234 |
+
<default>
|
235 |
+
<connector_api_credentials>
|
236 |
+
<api>
|
237 |
+
<enabled>0</enabled>
|
238 |
+
<username></username>
|
239 |
+
<password></password>
|
240 |
+
</api>
|
241 |
+
</connector_api_credentials>
|
242 |
+
<connector_sync_settings>
|
243 |
+
<address_book>
|
244 |
+
<customers></customers>
|
245 |
+
<subscribers></subscribers>
|
246 |
+
<guests></guests>
|
247 |
+
</address_book>
|
248 |
+
<sync>
|
249 |
+
<contact_enabled>0</contact_enabled>
|
250 |
+
<subscriber_enabled>0</subscriber_enabled>
|
251 |
+
<order_enabled>0</order_enabled>
|
252 |
+
<wishlist_enabled>0</wishlist_enabled>
|
253 |
+
</sync>
|
254 |
+
<dynamic_addressbook>
|
255 |
+
<addressbook_name></addressbook_name>
|
256 |
+
</dynamic_addressbook>
|
257 |
+
</connector_sync_settings>
|
258 |
+
<connector_data_mapping>
|
259 |
+
<customer_data>
|
260 |
+
<customer_id></customer_id>
|
261 |
+
<firstname></firstname>
|
262 |
+
<lastname></lastname>
|
263 |
+
<dob></dob>
|
264 |
+
<gender></gender>
|
265 |
+
<website_name></website_name>
|
266 |
+
<store_name></store_name>
|
267 |
+
<created_at></created_at>
|
268 |
+
<last_logged_date></last_logged_date>
|
269 |
+
<customer_group></customer_group>
|
270 |
+
<billing_address_1></billing_address_1>
|
271 |
+
<billing_address_2></billing_address_2>
|
272 |
+
<billing_city></billing_city>
|
273 |
+
<billing_state></billing_state>
|
274 |
+
<billing_country></billing_country>
|
275 |
+
<billing_postcode></billing_postcode>
|
276 |
+
<billing_telephone></billing_telephone>
|
277 |
+
<delivery_address_1></delivery_address_1>
|
278 |
+
<delivery_address_2></delivery_address_2>
|
279 |
+
<delivery_city></delivery_city>
|
280 |
+
<delivery_state></delivery_state>
|
281 |
+
<delivery_country></delivery_country>
|
282 |
+
<delivery_postcode></delivery_postcode>
|
283 |
+
<delivery_telephone></delivery_telephone>
|
284 |
+
<number_of_orders></number_of_orders>
|
285 |
+
<average_order_value></average_order_value>
|
286 |
+
<total_spend></total_spend>
|
287 |
+
<last_order_date></last_order_date>
|
288 |
+
<last_order_id></last_order_id>
|
289 |
+
<custom_attributes></custom_attributes>
|
290 |
+
<validator></validator>
|
291 |
+
</customer_data>
|
292 |
+
<dynamic_datafield>
|
293 |
+
<datafield_name></datafield_name>
|
294 |
+
<datafield_type></datafield_type>
|
295 |
+
</dynamic_datafield>
|
296 |
+
</connector_data_mapping>
|
297 |
+
<connector_roi_tracking>
|
298 |
+
<page_tracking>
|
299 |
+
<enabled>0</enabled>
|
300 |
+
</page_tracking>
|
301 |
+
<roi_tracking>
|
302 |
+
<enabled>0</enabled>
|
303 |
+
</roi_tracking>
|
304 |
+
</connector_roi_tracking>
|
305 |
+
<connector_lost_baskets>
|
306 |
+
<customers>
|
307 |
+
<enabled_1>0</enabled_1>
|
308 |
+
<send_after_1></send_after_1>
|
309 |
+
<campaign_1></campaign_1>
|
310 |
+
<enabled_2>0</enabled_2>
|
311 |
+
<send_after_2></send_after_2>
|
312 |
+
<campaign_2></campaign_2>
|
313 |
+
<enabled_3>0</enabled_3>
|
314 |
+
<send_after_3></send_after_3>
|
315 |
+
<campaign_3></campaign_3>
|
316 |
+
</customers>
|
317 |
+
<guests>
|
318 |
+
<enabled_1>0</enabled_1>
|
319 |
+
<send_after_1></send_after_1>
|
320 |
+
<campaign_1></campaign_1>
|
321 |
+
<enabled_2>0</enabled_2>
|
322 |
+
<send_after_2></send_after_2>
|
323 |
+
<campaign_2></campaign_2>
|
324 |
+
<enabled_3>0</enabled_3>
|
325 |
+
<send_after_3></send_after_3>
|
326 |
+
<campaign_3></campaign_3>
|
327 |
+
</guests>
|
328 |
+
</connector_lost_baskets>
|
329 |
+
<connector_sms>
|
330 |
+
<sms_one>
|
331 |
+
<enabled>0</enabled>
|
332 |
+
<status></status>
|
333 |
+
<message></message>
|
334 |
+
</sms_one>
|
335 |
+
<sms_two>
|
336 |
+
<enabled>0</enabled>
|
337 |
+
<status></status>
|
338 |
+
<message></message>
|
339 |
+
</sms_two>
|
340 |
+
<sms_three>
|
341 |
+
<enabled>0</enabled>
|
342 |
+
<status></status>
|
343 |
+
<message></message>
|
344 |
+
</sms_three>
|
345 |
+
<sms_four>
|
346 |
+
<enabled>0</enabled>
|
347 |
+
<status></status>
|
348 |
+
<message></message>
|
349 |
+
</sms_four>
|
350 |
+
</connector_sms>
|
351 |
+
<connector_dynamic_content>
|
352 |
+
<products>
|
353 |
+
<related_display_type>list</related_display_type>
|
354 |
+
<related_items_to_display>2</related_items_to_display>
|
355 |
+
<upsell_display_type>list</upsell_display_type>
|
356 |
+
<upsell_items_to_display>2</upsell_items_to_display>
|
357 |
+
<crosssell_display_type>list</crosssell_display_type>
|
358 |
+
<crosssell_items_to_display>2</crosssell_items_to_display>
|
359 |
+
<bestsellers_display_type>list</bestsellers_display_type>
|
360 |
+
<bestsellers_items_to_display>2</bestsellers_items_to_display>
|
361 |
+
<bestsellers_time_period></bestsellers_time_period>
|
362 |
+
<most_viewed_display_type>list</most_viewed_display_type>
|
363 |
+
<most_viewed_items_to_display>2</most_viewed_items_to_display>
|
364 |
+
<most_viewed_time_period></most_viewed_time_period>
|
365 |
+
<recently_viewed_display_type>list</recently_viewed_display_type>
|
366 |
+
<recently_viewed_items_to_display>2</recently_viewed_items_to_display>
|
367 |
+
</products>
|
368 |
+
<external_dynamic_content_urls>
|
369 |
+
<passcode>secret</passcode>
|
370 |
+
<lost_basket_url></lost_basket_url>
|
371 |
+
<coupon_code_url></coupon_code_url>
|
372 |
+
<dynamic_content_url></dynamic_content_url>
|
373 |
+
<related_products_url></related_products_url>
|
374 |
+
<upsell_products_url></upsell_products_url>
|
375 |
+
<crosssell_products_url></crosssell_products_url>
|
376 |
+
<best_sellers_url></best_sellers_url>
|
377 |
+
<most_viewed_url></most_viewed_url>
|
378 |
+
<product_push_url></product_push_url>
|
379 |
+
<recently_viewed_url></recently_viewed_url>
|
380 |
+
<new_order_url></new_order_url>
|
381 |
+
<new_order_guest_url></new_order_guest_url>
|
382 |
+
<order_update_url></order_update_url>
|
383 |
+
<order_update_guest_url></order_update_guest_url>
|
384 |
+
<new_invoice_url></new_invoice_url>
|
385 |
+
<new_invoice_guest_url></new_invoice_guest_url>
|
386 |
+
<invoice_update_url></invoice_update_url>
|
387 |
+
<invoice_update_guest_url></invoice_update_guest_url>
|
388 |
+
<new_creditmemo_url></new_creditmemo_url>
|
389 |
+
<new_creditmemo_guest_url></new_creditmemo_guest_url>
|
390 |
+
<creditmemo_update_url></creditmemo_update_url>
|
391 |
+
<creditmemo_update_guest_url></creditmemo_update_guest_url>
|
392 |
+
<new_shipment_url></new_shipment_url>
|
393 |
+
<new_shipment_guest_url></new_shipment_guest_url>
|
394 |
+
<shipment_update_url></shipment_update_url>
|
395 |
+
<shipment_update_guest_url></shipment_update_guest_url>
|
396 |
+
</external_dynamic_content_urls>
|
397 |
+
<manual_product_search>
|
398 |
+
<display_type>list</display_type>
|
399 |
+
<items_to_display>2</items_to_display>
|
400 |
+
<products_push_items></products_push_items>
|
401 |
+
</manual_product_search>
|
402 |
+
<fallback_products>
|
403 |
+
<product_list></product_list>
|
404 |
+
</fallback_products>
|
405 |
+
</connector_dynamic_content>
|
406 |
+
<connector_transactional_emails>
|
407 |
+
<credentials>
|
408 |
+
<enabled>0</enabled>
|
409 |
+
<api_username></api_username>
|
410 |
+
<api_password></api_password>
|
411 |
+
</credentials>
|
412 |
+
<email_mapping>
|
413 |
+
<sales_email_order_template></sales_email_order_template>
|
414 |
+
<sales_email_order_guest_template></sales_email_order_guest_template>
|
415 |
+
<sales_email_order_comment_template></sales_email_order_comment_template>
|
416 |
+
<sales_email_order_comment_guest_template></sales_email_order_comment_guest_template>
|
417 |
+
<sales_email_invoice_template></sales_email_invoice_template>
|
418 |
+
<sales_email_invoice_guest_template></sales_email_invoice_guest_template>
|
419 |
+
<sales_email_invoice_comment_template></sales_email_invoice_comment_template>
|
420 |
+
<sales_email_invoice_comment_guest_template></sales_email_invoice_comment_guest_template>
|
421 |
+
<sales_email_creditmemo_template></sales_email_creditmemo_template>
|
422 |
+
<sales_email_creditmemo_guest_template></sales_email_creditmemo_guest_template>
|
423 |
+
<sales_email_creditmemo_comment_template></sales_email_creditmemo_comment_template>
|
424 |
+
<sales_email_creditmemo_comment_guest_template></sales_email_creditmemo_comment_guest_template>
|
425 |
+
<sales_email_shipment_template></sales_email_shipment_template>
|
426 |
+
<sales_email_shipment_guest_template></sales_email_shipment_guest_template>
|
427 |
+
<sales_email_shipment_comment_template></sales_email_shipment_comment_template>
|
428 |
+
<sales_email_shipment_comment_guest_template></sales_email_shipment_comment_guest_template>
|
429 |
+
<customer_create_account_email_template></customer_create_account_email_template>
|
430 |
+
</email_mapping>
|
431 |
+
</connector_transactional_emails>
|
432 |
+
<connector_advanced_settings>
|
433 |
+
<sync_limits>
|
434 |
+
<orders>500</orders>
|
435 |
+
</sync_limits>
|
436 |
+
<admin>
|
437 |
+
<setup_data_fields></setup_data_fields>
|
438 |
+
<delete_contact></delete_contact>
|
439 |
+
<reimport_orders></reimport_orders>
|
440 |
+
<reimport_subscribers></reimport_subscribers>
|
441 |
+
<suppressed_contacts></suppressed_contacts>
|
442 |
+
<memory_limit>0</memory_limit>
|
443 |
+
<batch_size>10000</batch_size>
|
444 |
+
<debug_enabled></debug_enabled>
|
445 |
+
<inline_styling><![CDATA[table{font-family: arial, geneva, sans-serif; font-size:12px;}]]></inline_styling>
|
446 |
+
<recommended_inline><![CDATA[table{font-family: arial, geneva, sans-serif; font-size:12px;}]]></recommended_inline>
|
447 |
+
</admin>
|
448 |
+
</connector_advanced_settings>
|
449 |
+
</default>
|
450 |
+
<phpunit>
|
451 |
+
<suite>
|
452 |
+
<modules>
|
453 |
+
<Dotdigitalgroup_Email />
|
454 |
+
</modules>
|
455 |
+
</suite>
|
456 |
+
</phpunit>
|
457 |
+
</config>
|
@@ -1,13 +1,13 @@
|
|
1 |
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
<config>
|
3 |
<tabs>
|
4 |
-
<connector translate="label">
|
5 |
<label>EMAIL</label>
|
6 |
<sort_order>1000</sort_order>
|
7 |
</connector>
|
8 |
</tabs>
|
9 |
<sections>
|
10 |
-
<
|
11 |
<label><![CDATA[API Credentials]]></label>
|
12 |
<tab>connector</tab>
|
13 |
<frontend_type>text</frontend_type>
|
@@ -16,8 +16,8 @@
|
|
16 |
<show_in_website>1</show_in_website>
|
17 |
<show_in_store>0</show_in_store>
|
18 |
<groups>
|
19 |
-
<
|
20 |
-
<label>
|
21 |
<frontend_type>text</frontend_type>
|
22 |
<sort_order>10</sort_order>
|
23 |
<show_in_default>1</show_in_default>
|
@@ -25,38 +25,38 @@
|
|
25 |
<show_in_store>0</show_in_store>
|
26 |
<expanded>1</expanded>
|
27 |
<fields>
|
28 |
-
<
|
29 |
-
<label>
|
30 |
-
<frontend_type>
|
31 |
-
<
|
32 |
<sort_order>10</sort_order>
|
33 |
<show_in_default>1</show_in_default>
|
34 |
<show_in_website>1</show_in_website>
|
35 |
<show_in_store>0</show_in_store>
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
<
|
40 |
-
<
|
41 |
-
<frontend_model>connector/adminhtml_system_config_password</frontend_model>
|
42 |
<sort_order>20</sort_order>
|
43 |
<show_in_default>1</show_in_default>
|
44 |
<show_in_website>1</show_in_website>
|
45 |
<show_in_store>0</show_in_store>
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
<
|
|
|
|
|
50 |
<sort_order>30</sort_order>
|
51 |
<show_in_default>1</show_in_default>
|
52 |
<show_in_website>1</show_in_website>
|
53 |
<show_in_store>0</show_in_store>
|
54 |
-
<
|
55 |
-
</
|
56 |
<validator>
|
57 |
-
<label></label>
|
58 |
<frontend_type>hidden</frontend_type>
|
59 |
-
<frontend_model>
|
60 |
<sort_order>50</sort_order>
|
61 |
<show_in_default>1</show_in_default>
|
62 |
<show_in_website>1</show_in_website>
|
@@ -64,13 +64,44 @@
|
|
64 |
<can_be_empty>1</can_be_empty>
|
65 |
</validator>
|
66 |
</fields>
|
67 |
-
</
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
</groups>
|
69 |
-
</
|
70 |
-
<connector_sync_settings translate="label">
|
71 |
-
<!-- you can put anything inbetween the CDATA tags (including image tags) -->
|
72 |
<label><![CDATA[Sync Settings]]></label>
|
73 |
-
<!-- this relates to the value in tab -->
|
74 |
<tab>connector</tab>
|
75 |
<frontend_type>text</frontend_type>
|
76 |
<sort_order>3000</sort_order>
|
@@ -78,69 +109,45 @@
|
|
78 |
<show_in_website>1</show_in_website>
|
79 |
<show_in_store>0</show_in_store>
|
80 |
<groups>
|
81 |
-
<
|
82 |
-
<label>
|
83 |
-
<frontend_type>text</frontend_type>
|
84 |
<sort_order>10</sort_order>
|
85 |
<show_in_default>1</show_in_default>
|
86 |
<show_in_website>1</show_in_website>
|
87 |
<show_in_store>0</show_in_store>
|
88 |
<expanded>1</expanded>
|
89 |
<fields>
|
90 |
-
<
|
91 |
-
<label>
|
92 |
<frontend_type>select</frontend_type>
|
93 |
-
<source_model>
|
94 |
<sort_order>10</sort_order>
|
95 |
<show_in_default>1</show_in_default>
|
96 |
<show_in_website>1</show_in_website>
|
97 |
<show_in_store>0</show_in_store>
|
98 |
-
</
|
99 |
-
<
|
100 |
-
<label>
|
101 |
-
<frontend_type>
|
102 |
-
<
|
103 |
<sort_order>20</sort_order>
|
104 |
<show_in_default>1</show_in_default>
|
105 |
-
<show_in_website>
|
106 |
<show_in_store>0</show_in_store>
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
<label>Frequency</label>
|
111 |
<frontend_type>select</frontend_type>
|
112 |
-
<source_model>
|
113 |
-
<backend_model>connector/system_config_backend_syncschedule_customer</backend_model>
|
114 |
<sort_order>30</sort_order>
|
115 |
<show_in_default>1</show_in_default>
|
116 |
-
<show_in_website>
|
117 |
-
<show_in_store>0</show_in_store>
|
118 |
-
<comment>Note: For Weekly and Monthly frequency, the day of the week/month will be today</comment>
|
119 |
-
<depends><enabled>1</enabled></depends>
|
120 |
-
</frequency>
|
121 |
-
<force_sync translate="label">
|
122 |
-
<label></label>
|
123 |
-
<frontend_model>connector/debug_forcecustomersync</frontend_model>
|
124 |
-
<sort_order>50</sort_order>
|
125 |
-
<show_in_default>1</show_in_default>
|
126 |
-
<show_in_website>0</show_in_website>
|
127 |
-
<show_in_store>0</show_in_store>
|
128 |
-
<comment>Use this button force the data synchronization to run now</comment>
|
129 |
-
</force_sync>
|
130 |
-
<validator>
|
131 |
-
<label></label>
|
132 |
-
<frontend_type>hidden</frontend_type>
|
133 |
-
<frontend_model>connector/adminhtml_system_config_waitingfield</frontend_model>
|
134 |
-
<sort_order>60</sort_order>
|
135 |
-
<show_in_default>1</show_in_default>
|
136 |
-
<show_in_website>0</show_in_website>
|
137 |
<show_in_store>0</show_in_store>
|
138 |
-
|
139 |
-
</validator>
|
140 |
</fields>
|
141 |
-
</
|
142 |
-
<
|
143 |
-
<label>
|
144 |
<frontend_type>text</frontend_type>
|
145 |
<sort_order>20</sort_order>
|
146 |
<show_in_default>1</show_in_default>
|
@@ -148,95 +155,115 @@
|
|
148 |
<show_in_store>0</show_in_store>
|
149 |
<expanded>1</expanded>
|
150 |
<fields>
|
151 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
152 |
<label>Enabled</label>
|
153 |
<frontend_type>select</frontend_type>
|
154 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
155 |
-
<sort_order>
|
156 |
<show_in_default>1</show_in_default>
|
157 |
<show_in_website>1</show_in_website>
|
158 |
<show_in_store>0</show_in_store>
|
159 |
-
</
|
160 |
-
<
|
161 |
-
<label>
|
162 |
-
<
|
163 |
-
<
|
164 |
-
<sort_order>3</sort_order>
|
165 |
<show_in_default>1</show_in_default>
|
166 |
-
<show_in_website>
|
167 |
<show_in_store>0</show_in_store>
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
<label>Frequency</label>
|
172 |
<frontend_type>select</frontend_type>
|
173 |
-
<source_model>
|
174 |
-
<
|
175 |
-
<sort_order>4</sort_order>
|
176 |
-
<show_in_default>1</show_in_default>
|
177 |
-
<show_in_website>0</show_in_website>
|
178 |
-
<show_in_store>0</show_in_store>
|
179 |
-
<comment>Note: For Weekly and Monthly frequency, the day of the week/month will be today</comment>
|
180 |
-
<depends><enabled>1</enabled></depends>
|
181 |
-
</frequency>
|
182 |
-
<force_sync translate="label">
|
183 |
-
<label></label>
|
184 |
-
<frontend_model>connector/debug_forcesuppressedsync</frontend_model>
|
185 |
-
<sort_order>20</sort_order>
|
186 |
<show_in_default>1</show_in_default>
|
187 |
-
<show_in_website>
|
188 |
<show_in_store>0</show_in_store>
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
</sync_suppressed_schedule>
|
193 |
-
<transactional_data translate="label">
|
194 |
-
<label><![CDATA[ Transactional data settings]]></label>
|
195 |
-
<frontend_type>text</frontend_type>
|
196 |
-
<sort_order>30</sort_order>
|
197 |
-
<show_in_default>1</show_in_default>
|
198 |
-
<show_in_website>1</show_in_website>
|
199 |
-
<show_in_store>0</show_in_store>
|
200 |
-
<fields>
|
201 |
-
<order_info_title translate="label">
|
202 |
-
<label>Order/Basket Information</label>
|
203 |
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
204 |
-
<sort_order>
|
205 |
<show_in_default>1</show_in_default>
|
206 |
<show_in_website>1</show_in_website>
|
207 |
<show_in_store>0</show_in_store>
|
208 |
-
</
|
209 |
-
<order_enabled translate="label">
|
210 |
<label>Enabled</label>
|
211 |
<frontend_type>select</frontend_type>
|
212 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
213 |
-
<sort_order>
|
214 |
<show_in_default>1</show_in_default>
|
215 |
<show_in_website>1</show_in_website>
|
216 |
<show_in_store>0</show_in_store>
|
217 |
</order_enabled>
|
218 |
-
<
|
219 |
-
<label>
|
220 |
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
221 |
-
<sort_order>
|
222 |
<show_in_default>1</show_in_default>
|
223 |
<show_in_website>1</show_in_website>
|
224 |
<show_in_store>0</show_in_store>
|
225 |
-
</
|
226 |
-
<wishlist_enabled translate="label">
|
227 |
<label>Enabled</label>
|
228 |
<frontend_type>select</frontend_type>
|
229 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
230 |
-
<sort_order>
|
231 |
<show_in_default>1</show_in_default>
|
232 |
<show_in_website>1</show_in_website>
|
233 |
<show_in_store>0</show_in_store>
|
234 |
</wishlist_enabled>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
235 |
</fields>
|
236 |
-
</
|
237 |
</groups>
|
238 |
</connector_sync_settings>
|
239 |
-
<
|
240 |
<label><![CDATA[Data Mapping]]></label>
|
241 |
<tab>connector</tab>
|
242 |
<frontend_type>text</frontend_type>
|
@@ -245,16 +272,17 @@
|
|
245 |
<show_in_website>1</show_in_website>
|
246 |
<show_in_store>0</show_in_store>
|
247 |
<groups>
|
248 |
-
<customer_data>
|
249 |
-
<label>Data
|
250 |
<frontend_type>text</frontend_type>
|
251 |
<sort_order>20</sort_order>
|
252 |
<show_in_default>1</show_in_default>
|
253 |
<show_in_website>1</show_in_website>
|
254 |
<show_in_store>0</show_in_store>
|
255 |
<expanded>1</expanded>
|
|
|
256 |
<fields>
|
257 |
-
<customer_title translate="label">
|
258 |
<label>Customer Information</label>
|
259 |
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
260 |
<sort_order>10</sort_order>
|
@@ -262,283 +290,326 @@
|
|
262 |
<show_in_website>1</show_in_website>
|
263 |
<show_in_store>0</show_in_store>
|
264 |
</customer_title>
|
265 |
-
|
266 |
-
|
267 |
-
<label>Customer ID</label>
|
268 |
<frontend_type>select</frontend_type>
|
269 |
-
<source_model>
|
270 |
<sort_order>20</sort_order>
|
271 |
<show_in_default>1</show_in_default>
|
272 |
<show_in_website>1</show_in_website>
|
273 |
<show_in_store>0</show_in_store>
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
<label>Title</label>
|
278 |
<frontend_type>select</frontend_type>
|
279 |
-
<source_model>
|
280 |
<sort_order>30</sort_order>
|
281 |
<show_in_default>1</show_in_default>
|
282 |
<show_in_website>1</show_in_website>
|
283 |
<show_in_store>0</show_in_store>
|
284 |
-
</
|
285 |
-
|
286 |
-
<firstname>
|
287 |
<label>First Name</label>
|
288 |
<frontend_type>select</frontend_type>
|
289 |
-
<source_model>
|
290 |
<sort_order>40</sort_order>
|
291 |
<show_in_default>1</show_in_default>
|
292 |
<show_in_website>1</show_in_website>
|
293 |
<show_in_store>0</show_in_store>
|
294 |
</firstname>
|
295 |
-
<lastname>
|
296 |
<label>Last Name</label>
|
297 |
<frontend_type>select</frontend_type>
|
298 |
-
<source_model>
|
299 |
<sort_order>50</sort_order>
|
300 |
<show_in_default>1</show_in_default>
|
301 |
<show_in_website>1</show_in_website>
|
302 |
<show_in_store>0</show_in_store>
|
303 |
</lastname>
|
304 |
-
<dob>
|
305 |
<label>D.O.B.</label>
|
306 |
<frontend_type>select</frontend_type>
|
307 |
-
<source_model>
|
308 |
<sort_order>60</sort_order>
|
309 |
<show_in_default>1</show_in_default>
|
310 |
<show_in_website>1</show_in_website>
|
311 |
<show_in_store>0</show_in_store>
|
312 |
</dob>
|
313 |
-
<gender>
|
314 |
<label>Gender</label>
|
315 |
<frontend_type>select</frontend_type>
|
316 |
-
<source_model>
|
317 |
<sort_order>70</sort_order>
|
318 |
<show_in_default>1</show_in_default>
|
319 |
<show_in_website>1</show_in_website>
|
320 |
<show_in_store>0</show_in_store>
|
321 |
</gender>
|
322 |
-
<
|
323 |
<label>Website Created On</label>
|
324 |
<frontend_type>select</frontend_type>
|
325 |
-
<source_model>
|
326 |
<sort_order>80</sort_order>
|
327 |
<show_in_default>1</show_in_default>
|
328 |
<show_in_website>1</show_in_website>
|
329 |
<show_in_store>0</show_in_store>
|
330 |
-
</
|
331 |
-
<
|
332 |
<label>Store Created On</label>
|
333 |
<frontend_type>select</frontend_type>
|
334 |
-
<source_model>
|
335 |
<sort_order>90</sort_order>
|
336 |
<show_in_default>1</show_in_default>
|
337 |
<show_in_website>1</show_in_website>
|
338 |
<show_in_store>0</show_in_store>
|
339 |
-
</
|
340 |
-
<
|
341 |
<label>Account Created Date</label>
|
342 |
<frontend_type>select</frontend_type>
|
343 |
-
<source_model>
|
344 |
<sort_order>100</sort_order>
|
345 |
<show_in_default>1</show_in_default>
|
346 |
<show_in_website>1</show_in_website>
|
347 |
<show_in_store>0</show_in_store>
|
348 |
-
</
|
349 |
-
<
|
350 |
<label>Last Logged In Date</label>
|
351 |
<frontend_type>select</frontend_type>
|
352 |
-
<source_model>
|
353 |
<sort_order>110</sort_order>
|
354 |
<show_in_default>1</show_in_default>
|
355 |
<show_in_website>1</show_in_website>
|
356 |
<show_in_store>0</show_in_store>
|
357 |
-
</
|
358 |
-
<customer_group>
|
359 |
<label>Customer Group</label>
|
360 |
<frontend_type>select</frontend_type>
|
361 |
-
<source_model>
|
362 |
<sort_order>120</sort_order>
|
363 |
<show_in_default>1</show_in_default>
|
364 |
<show_in_website>1</show_in_website>
|
365 |
<show_in_store>0</show_in_store>
|
366 |
</customer_group>
|
367 |
-
<address_title translate="label">
|
368 |
-
<label>Address
|
369 |
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
370 |
<sort_order>130</sort_order>
|
371 |
<show_in_default>1</show_in_default>
|
372 |
<show_in_website>1</show_in_website>
|
373 |
<show_in_store>0</show_in_store>
|
374 |
</address_title>
|
375 |
-
<billing_address_1>
|
376 |
<label>Billing Address Line 1</label>
|
377 |
<frontend_type>select</frontend_type>
|
378 |
-
<source_model>
|
379 |
<sort_order>140</sort_order>
|
380 |
<show_in_default>1</show_in_default>
|
381 |
<show_in_website>1</show_in_website>
|
382 |
<show_in_store>0</show_in_store>
|
383 |
</billing_address_1>
|
384 |
-
<billing_address_2>
|
385 |
<label>Billing Address Line 2</label>
|
386 |
<frontend_type>select</frontend_type>
|
387 |
-
<source_model>
|
388 |
<sort_order>150</sort_order>
|
389 |
<show_in_default>1</show_in_default>
|
390 |
<show_in_website>1</show_in_website>
|
391 |
<show_in_store>0</show_in_store>
|
392 |
</billing_address_2>
|
393 |
-
<billing_city>
|
394 |
<label>Billing City</label>
|
395 |
<frontend_type>select</frontend_type>
|
396 |
-
<source_model>
|
397 |
<sort_order>160</sort_order>
|
398 |
<show_in_default>1</show_in_default>
|
399 |
<show_in_website>1</show_in_website>
|
400 |
<show_in_store>0</show_in_store>
|
401 |
</billing_city>
|
402 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
403 |
<label>Billing Country</label>
|
404 |
<frontend_type>select</frontend_type>
|
405 |
-
<source_model>
|
406 |
<sort_order>170</sort_order>
|
407 |
<show_in_default>1</show_in_default>
|
408 |
<show_in_website>1</show_in_website>
|
409 |
<show_in_store>0</show_in_store>
|
410 |
</billing_country>
|
411 |
-
<billing_postcode>
|
412 |
<label>Billing Zip/Postcode</label>
|
413 |
<frontend_type>select</frontend_type>
|
414 |
-
<source_model>
|
415 |
<sort_order>180</sort_order>
|
416 |
<show_in_default>1</show_in_default>
|
417 |
<show_in_website>1</show_in_website>
|
418 |
<show_in_store>0</show_in_store>
|
419 |
</billing_postcode>
|
420 |
-
<billing_telephone>
|
421 |
<label>Billing Telephone</label>
|
422 |
<frontend_type>select</frontend_type>
|
423 |
-
<source_model>
|
424 |
<sort_order>190</sort_order>
|
425 |
<show_in_default>1</show_in_default>
|
426 |
<show_in_website>1</show_in_website>
|
427 |
<show_in_store>0</show_in_store>
|
428 |
</billing_telephone>
|
429 |
-
<delivery_address_1>
|
430 |
<label>Delivery Address Line 1</label>
|
431 |
<frontend_type>select</frontend_type>
|
432 |
-
<source_model>
|
433 |
<sort_order>200</sort_order>
|
434 |
<show_in_default>1</show_in_default>
|
435 |
<show_in_website>1</show_in_website>
|
436 |
<show_in_store>0</show_in_store>
|
437 |
</delivery_address_1>
|
438 |
-
<delivery_address_2>
|
439 |
<label>Delivery Address Line 2</label>
|
440 |
<frontend_type>select</frontend_type>
|
441 |
-
<source_model>
|
442 |
<sort_order>210</sort_order>
|
443 |
<show_in_default>1</show_in_default>
|
444 |
<show_in_website>1</show_in_website>
|
445 |
<show_in_store>0</show_in_store>
|
446 |
</delivery_address_2>
|
447 |
-
<delivery_city>
|
448 |
<label>Delivery City</label>
|
449 |
<frontend_type>select</frontend_type>
|
450 |
-
<source_model>
|
451 |
<sort_order>220</sort_order>
|
452 |
<show_in_default>1</show_in_default>
|
453 |
<show_in_website>1</show_in_website>
|
454 |
<show_in_store>0</show_in_store>
|
455 |
</delivery_city>
|
456 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
457 |
<label>Delivery Country</label>
|
458 |
<frontend_type>select</frontend_type>
|
459 |
-
<source_model>
|
460 |
<sort_order>230</sort_order>
|
461 |
<show_in_default>1</show_in_default>
|
462 |
<show_in_website>1</show_in_website>
|
463 |
<show_in_store>0</show_in_store>
|
464 |
</delivery_country>
|
465 |
-
<delivery_postcode>
|
466 |
<label>Delivery Zip/Postcode</label>
|
467 |
<frontend_type>select</frontend_type>
|
468 |
-
<source_model>
|
469 |
<sort_order>240</sort_order>
|
470 |
<show_in_default>1</show_in_default>
|
471 |
<show_in_website>1</show_in_website>
|
472 |
<show_in_store>0</show_in_store>
|
473 |
</delivery_postcode>
|
474 |
-
<delivery_telephone>
|
475 |
<label>Delivery Telephone</label>
|
476 |
<frontend_type>select</frontend_type>
|
477 |
-
<source_model>
|
478 |
<sort_order>250</sort_order>
|
479 |
<show_in_default>1</show_in_default>
|
480 |
<show_in_website>1</show_in_website>
|
481 |
<show_in_store>0</show_in_store>
|
482 |
</delivery_telephone>
|
483 |
-
<sales_title translate="label">
|
484 |
-
<label>Sales
|
485 |
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
486 |
<sort_order>260</sort_order>
|
487 |
<show_in_default>1</show_in_default>
|
488 |
<show_in_website>1</show_in_website>
|
489 |
<show_in_store>0</show_in_store>
|
490 |
</sales_title>
|
491 |
-
<
|
492 |
<label>Total Number of Orders</label>
|
493 |
<frontend_type>select</frontend_type>
|
494 |
-
<source_model>
|
495 |
<sort_order>270</sort_order>
|
496 |
<show_in_default>1</show_in_default>
|
497 |
<show_in_website>1</show_in_website>
|
498 |
<show_in_store>0</show_in_store>
|
499 |
-
</
|
500 |
-
<average_order_value>
|
501 |
<label>Average Order Value</label>
|
502 |
<frontend_type>select</frontend_type>
|
503 |
-
<source_model>
|
504 |
<sort_order>280</sort_order>
|
505 |
<show_in_default>1</show_in_default>
|
506 |
<show_in_website>1</show_in_website>
|
507 |
<show_in_store>0</show_in_store>
|
508 |
</average_order_value>
|
509 |
-
<total_spend>
|
510 |
<label>Total Spend</label>
|
511 |
<frontend_type>select</frontend_type>
|
512 |
-
<source_model>
|
513 |
<sort_order>290</sort_order>
|
514 |
<show_in_default>1</show_in_default>
|
515 |
<show_in_website>1</show_in_website>
|
516 |
<show_in_store>0</show_in_store>
|
517 |
</total_spend>
|
518 |
-
<
|
519 |
<label>Last Purchase Date</label>
|
520 |
<frontend_type>select</frontend_type>
|
521 |
-
<source_model>
|
522 |
<sort_order>300</sort_order>
|
523 |
<show_in_default>1</show_in_default>
|
524 |
<show_in_website>1</show_in_website>
|
525 |
<show_in_store>0</show_in_store>
|
526 |
-
</
|
527 |
-
<
|
528 |
-
<label>Last Order
|
529 |
<frontend_type>select</frontend_type>
|
530 |
-
<source_model>
|
531 |
<sort_order>310</sort_order>
|
532 |
<show_in_default>1</show_in_default>
|
533 |
<show_in_website>1</show_in_website>
|
534 |
<show_in_store>0</show_in_store>
|
535 |
-
</
|
536 |
-
<
|
537 |
-
<label>
|
538 |
<frontend_type>select</frontend_type>
|
539 |
-
<source_model>
|
540 |
-
<
|
|
|
|
|
541 |
<sort_order>320</sort_order>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
542 |
<show_in_default>1</show_in_default>
|
543 |
<show_in_website>1</show_in_website>
|
544 |
<show_in_store>0</show_in_store>
|
@@ -547,46 +618,46 @@
|
|
547 |
</validator>
|
548 |
</fields>
|
549 |
</customer_data>
|
550 |
-
<
|
551 |
-
<label>
|
552 |
-
<sort_order>
|
553 |
<show_in_default>1</show_in_default>
|
554 |
<show_in_website>1</show_in_website>
|
555 |
<show_in_store>0</show_in_store>
|
556 |
-
<expanded>1</expanded>
|
557 |
<fields>
|
558 |
-
<
|
559 |
-
<label>
|
560 |
-
<frontend_type>
|
561 |
-
<
|
562 |
<sort_order>10</sort_order>
|
563 |
<show_in_default>1</show_in_default>
|
564 |
<show_in_website>1</show_in_website>
|
565 |
<show_in_store>0</show_in_store>
|
566 |
-
</
|
567 |
-
<
|
568 |
-
<label>
|
569 |
<frontend_type>select</frontend_type>
|
570 |
-
<source_model>
|
571 |
<sort_order>20</sort_order>
|
572 |
<show_in_default>1</show_in_default>
|
573 |
<show_in_website>1</show_in_website>
|
574 |
<show_in_store>0</show_in_store>
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
<
|
579 |
-
<
|
|
|
580 |
<sort_order>30</sort_order>
|
581 |
<show_in_default>1</show_in_default>
|
582 |
<show_in_website>1</show_in_website>
|
583 |
<show_in_store>0</show_in_store>
|
584 |
-
</
|
585 |
</fields>
|
586 |
-
</
|
587 |
</groups>
|
588 |
-
</
|
589 |
-
<
|
590 |
<label><![CDATA[ROI & Tracking]]></label>
|
591 |
<tab>connector</tab>
|
592 |
<frontend_type>text</frontend_type>
|
@@ -595,7 +666,7 @@
|
|
595 |
<show_in_website>1</show_in_website>
|
596 |
<show_in_store>0</show_in_store>
|
597 |
<groups>
|
598 |
-
<page_tracking>
|
599 |
<label>Page Tracking</label>
|
600 |
<frontend_type>text</frontend_type>
|
601 |
<sort_order>10</sort_order>
|
@@ -604,7 +675,7 @@
|
|
604 |
<show_in_store>0</show_in_store>
|
605 |
<expanded>1</expanded>
|
606 |
<fields>
|
607 |
-
<enabled translate="label">
|
608 |
<label>Enabled</label>
|
609 |
<frontend_type>select</frontend_type>
|
610 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
@@ -615,7 +686,7 @@
|
|
615 |
</enabled>
|
616 |
</fields>
|
617 |
</page_tracking>
|
618 |
-
<roi_tracking>
|
619 |
<label>ROI Tracking</label>
|
620 |
<frontend_type>text</frontend_type>
|
621 |
<sort_order>20</sort_order>
|
@@ -624,7 +695,7 @@
|
|
624 |
<show_in_store>0</show_in_store>
|
625 |
<expanded>1</expanded>
|
626 |
<fields>
|
627 |
-
<enabled translate="label">
|
628 |
<label>Enabled</label>
|
629 |
<frontend_type>select</frontend_type>
|
630 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
@@ -636,36 +707,17 @@
|
|
636 |
</fields>
|
637 |
</roi_tracking>
|
638 |
</groups>
|
639 |
-
</
|
640 |
-
<
|
641 |
<label><![CDATA[Lost Baskets]]></label>
|
642 |
<tab>connector</tab>
|
643 |
<frontend_type>text</frontend_type>
|
644 |
<sort_order>6000</sort_order>
|
645 |
<show_in_default>1</show_in_default>
|
646 |
<show_in_website>1</show_in_website>
|
647 |
-
<show_in_store>
|
648 |
<groups>
|
649 |
-
<
|
650 |
-
<label>Lost Baskets Settings</label>
|
651 |
-
<frontend_type>text</frontend_type>
|
652 |
-
<sort_order>100</sort_order>
|
653 |
-
<show_in_default>0</show_in_default>
|
654 |
-
<show_in_website>0</show_in_website>
|
655 |
-
<show_in_store>0</show_in_store>
|
656 |
-
<fields>
|
657 |
-
<active translate="label">
|
658 |
-
<label>Consider Order complete for lost baskets</label>
|
659 |
-
<frontend_type>select</frontend_type>
|
660 |
-
<source_model>connector/system_config_source_activebasket</source_model>
|
661 |
-
<sort_order>10</sort_order>
|
662 |
-
<show_in_default>1</show_in_default>
|
663 |
-
<show_in_website>1</show_in_website>
|
664 |
-
<show_in_store>0</show_in_store>
|
665 |
-
</active>
|
666 |
-
</fields>
|
667 |
-
</active>
|
668 |
-
<customers>
|
669 |
<label>Customers</label>
|
670 |
<frontend_type>text</frontend_type>
|
671 |
<sort_order>10</sort_order>
|
@@ -674,109 +726,106 @@
|
|
674 |
<show_in_store>1</show_in_store>
|
675 |
<expanded>1</expanded>
|
676 |
<fields>
|
677 |
-
<heading_1 translate="label">
|
678 |
-
<label>Lost
|
679 |
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
680 |
<sort_order>10</sort_order>
|
681 |
<show_in_default>1</show_in_default>
|
682 |
<show_in_website>1</show_in_website>
|
683 |
<show_in_store>1</show_in_store>
|
684 |
</heading_1>
|
685 |
-
<enabled_1 translate="label">
|
686 |
<label>Enabled/Disabled</label>
|
687 |
<frontend_type>select</frontend_type>
|
688 |
-
<config_path>lostbaskets/customers/enabled_1</config_path>
|
689 |
<source_model>adminhtml/system_config_source_enabledisable</source_model>
|
690 |
<sort_order>20</sort_order>
|
691 |
<show_in_default>1</show_in_default>
|
692 |
<show_in_website>1</show_in_website>
|
693 |
<show_in_store>1</show_in_store>
|
694 |
</enabled_1>
|
695 |
-
<send_after_1>
|
696 |
-
<label>Send
|
697 |
<frontend_type>select</frontend_type>
|
698 |
-
<source_model>
|
699 |
<sort_order>30</sort_order>
|
700 |
<show_in_default>1</show_in_default>
|
701 |
<show_in_website>1</show_in_website>
|
702 |
<show_in_store>1</show_in_store>
|
703 |
</send_after_1>
|
704 |
-
<campaign_1>
|
705 |
<label>Campaign To Send</label>
|
706 |
<frontend_type>select</frontend_type>
|
707 |
-
<source_model>
|
708 |
<sort_order>40</sort_order>
|
709 |
<show_in_default>1</show_in_default>
|
710 |
<show_in_website>1</show_in_website>
|
711 |
<show_in_store>1</show_in_store>
|
712 |
</campaign_1>
|
713 |
-
<heading_2 translate="label">
|
714 |
-
<label>Lost
|
715 |
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
716 |
<sort_order>50</sort_order>
|
717 |
<show_in_default>1</show_in_default>
|
718 |
<show_in_website>1</show_in_website>
|
719 |
<show_in_store>1</show_in_store>
|
720 |
</heading_2>
|
721 |
-
<enabled_2 translate="label">
|
722 |
<label>Enabled/Disabled</label>
|
723 |
<frontend_type>select</frontend_type>
|
724 |
-
<config_path>lostbaskets/customers/enabled_2</config_path>
|
725 |
<source_model>adminhtml/system_config_source_enabledisable</source_model>
|
726 |
<sort_order>60</sort_order>
|
727 |
<show_in_default>1</show_in_default>
|
728 |
<show_in_website>1</show_in_website>
|
729 |
<show_in_store>1</show_in_store>
|
730 |
</enabled_2>
|
731 |
-
<send_after_2>
|
732 |
-
<label>Send
|
733 |
<frontend_type>select</frontend_type>
|
734 |
-
<source_model>
|
735 |
<sort_order>70</sort_order>
|
736 |
<show_in_default>1</show_in_default>
|
737 |
<show_in_website>1</show_in_website>
|
738 |
<show_in_store>1</show_in_store>
|
739 |
</send_after_2>
|
740 |
-
<campaign_2>
|
741 |
-
<label>Campaign
|
742 |
<frontend_type>select</frontend_type>
|
743 |
-
<source_model>
|
744 |
<sort_order>80</sort_order>
|
745 |
<show_in_default>1</show_in_default>
|
746 |
<show_in_website>1</show_in_website>
|
747 |
<show_in_store>1</show_in_store>
|
748 |
</campaign_2>
|
749 |
-
<heading_3 translate="label">
|
750 |
-
<label>Lost
|
751 |
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
752 |
<sort_order>90</sort_order>
|
753 |
<show_in_default>1</show_in_default>
|
754 |
<show_in_website>1</show_in_website>
|
755 |
<show_in_store>1</show_in_store>
|
756 |
</heading_3>
|
757 |
-
<enabled_3 translate="label">
|
758 |
<label>Enabled/Disabled</label>
|
759 |
<frontend_type>select</frontend_type>
|
760 |
-
<config_path>lostbaskets/customers/enabled_3</config_path>
|
761 |
<source_model>adminhtml/system_config_source_enabledisable</source_model>
|
762 |
<sort_order>100</sort_order>
|
763 |
<show_in_default>1</show_in_default>
|
764 |
<show_in_website>1</show_in_website>
|
765 |
<show_in_store>1</show_in_store>
|
766 |
</enabled_3>
|
767 |
-
<send_after_3>
|
768 |
-
<label>Send
|
769 |
<frontend_type>select</frontend_type>
|
770 |
-
<source_model>
|
771 |
<sort_order>110</sort_order>
|
772 |
<show_in_default>1</show_in_default>
|
773 |
<show_in_website>1</show_in_website>
|
774 |
<show_in_store>1</show_in_store>
|
775 |
</send_after_3>
|
776 |
-
<campaign_3>
|
777 |
-
<label>Campaign
|
778 |
<frontend_type>select</frontend_type>
|
779 |
-
<source_model>
|
780 |
<sort_order>120</sort_order>
|
781 |
<show_in_default>1</show_in_default>
|
782 |
<show_in_website>1</show_in_website>
|
@@ -784,157 +833,124 @@
|
|
784 |
</campaign_3>
|
785 |
</fields>
|
786 |
</customers>
|
787 |
-
<guests>
|
788 |
<label>Guests</label>
|
789 |
<frontend_type>text</frontend_type>
|
790 |
<sort_order>20</sort_order>
|
791 |
<show_in_default>1</show_in_default>
|
792 |
<show_in_website>1</show_in_website>
|
793 |
-
<show_in_store>
|
794 |
<fields>
|
795 |
-
<heading_1 translate="label">
|
796 |
-
<label>Lost
|
797 |
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
798 |
<sort_order>10</sort_order>
|
799 |
<show_in_default>1</show_in_default>
|
800 |
<show_in_website>1</show_in_website>
|
801 |
-
<show_in_store>
|
802 |
</heading_1>
|
803 |
-
<enabled_1 translate="label">
|
804 |
<label>Enabled/Disabled</label>
|
805 |
<frontend_type>select</frontend_type>
|
806 |
-
<config_path>lostbaskets/guests/enabled_1</config_path>
|
807 |
<source_model>adminhtml/system_config_source_enabledisable</source_model>
|
808 |
<sort_order>20</sort_order>
|
809 |
<show_in_default>1</show_in_default>
|
810 |
<show_in_website>1</show_in_website>
|
811 |
-
<show_in_store>
|
812 |
</enabled_1>
|
813 |
-
<send_after_1>
|
814 |
-
<label>Send
|
815 |
<frontend_type>select</frontend_type>
|
816 |
-
<source_model>
|
817 |
<sort_order>30</sort_order>
|
818 |
<show_in_default>1</show_in_default>
|
819 |
<show_in_website>1</show_in_website>
|
820 |
-
<show_in_store>
|
821 |
</send_after_1>
|
822 |
-
<campaign_1>
|
823 |
<label>Campaign To Send</label>
|
824 |
<frontend_type>select</frontend_type>
|
825 |
-
<source_model>
|
826 |
<sort_order>40</sort_order>
|
827 |
<show_in_default>1</show_in_default>
|
828 |
<show_in_website>1</show_in_website>
|
829 |
-
<show_in_store>
|
830 |
</campaign_1>
|
831 |
-
|
832 |
-
|
833 |
-
<label>Lost basket 2</label>
|
834 |
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
835 |
<sort_order>50</sort_order>
|
836 |
<show_in_default>1</show_in_default>
|
837 |
<show_in_website>1</show_in_website>
|
838 |
-
<show_in_store>
|
839 |
</heading_2>
|
840 |
-
<enabled_2 translate="label">
|
841 |
<label>Enabled/Disabled</label>
|
842 |
<frontend_type>select</frontend_type>
|
843 |
-
<config_path>lostbaskets/guests/enabled_2</config_path>
|
844 |
<source_model>adminhtml/system_config_source_enabledisable</source_model>
|
845 |
<sort_order>60</sort_order>
|
846 |
<show_in_default>1</show_in_default>
|
847 |
<show_in_website>1</show_in_website>
|
848 |
-
<show_in_store>
|
849 |
</enabled_2>
|
850 |
-
<send_after_2>
|
851 |
-
<label>Send
|
852 |
<frontend_type>select</frontend_type>
|
853 |
-
<source_model>
|
854 |
<sort_order>70</sort_order>
|
855 |
<show_in_default>1</show_in_default>
|
856 |
<show_in_website>1</show_in_website>
|
857 |
-
<show_in_store>
|
858 |
</send_after_2>
|
859 |
-
<campaign_2>
|
860 |
-
<label>Campaign
|
861 |
<frontend_type>select</frontend_type>
|
862 |
-
<source_model>
|
863 |
<sort_order>80</sort_order>
|
864 |
<show_in_default>1</show_in_default>
|
865 |
<show_in_website>1</show_in_website>
|
866 |
-
<show_in_store>
|
867 |
</campaign_2>
|
868 |
-
|
869 |
-
|
870 |
-
<label>Lost basket 3 </label>
|
871 |
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
872 |
<sort_order>90</sort_order>
|
873 |
<show_in_default>1</show_in_default>
|
874 |
<show_in_website>1</show_in_website>
|
875 |
-
<show_in_store>
|
876 |
</heading_3>
|
877 |
-
<enabled_3 translate="label">
|
878 |
<label>Enabled/Disabled</label>
|
879 |
<frontend_type>select</frontend_type>
|
880 |
-
<config_path>lostbaskets/guests/enabled_3</config_path>
|
881 |
<source_model>adminhtml/system_config_source_enabledisable</source_model>
|
882 |
<sort_order>100</sort_order>
|
883 |
<show_in_default>1</show_in_default>
|
884 |
<show_in_website>1</show_in_website>
|
885 |
-
<show_in_store>
|
886 |
</enabled_3>
|
887 |
-
<send_after_3>
|
888 |
-
<label>Send
|
889 |
<frontend_type>select</frontend_type>
|
890 |
-
<source_model>
|
891 |
<sort_order>110</sort_order>
|
892 |
<show_in_default>1</show_in_default>
|
893 |
<show_in_website>1</show_in_website>
|
894 |
-
<show_in_store>
|
895 |
</send_after_3>
|
896 |
-
<campaign_3>
|
897 |
-
<label>Campaign
|
898 |
<frontend_type>select</frontend_type>
|
899 |
-
<source_model>
|
900 |
<sort_order>120</sort_order>
|
901 |
<show_in_default>1</show_in_default>
|
902 |
<show_in_website>1</show_in_website>
|
903 |
-
<show_in_store>
|
904 |
</campaign_3>
|
905 |
</fields>
|
906 |
</guests>
|
907 |
-
<test>
|
908 |
-
<label>Test</label>
|
909 |
-
<frontend_type>text</frontend_type>
|
910 |
-
<sort_order>30</sort_order>
|
911 |
-
<show_in_default>1</show_in_default>
|
912 |
-
<show_in_website>1</show_in_website>
|
913 |
-
<show_in_store>1</show_in_store>
|
914 |
-
<fields>
|
915 |
-
<email translate="label">
|
916 |
-
<label>Test Email</label>
|
917 |
-
<frontend_type>text</frontend_type>
|
918 |
-
<sort_order>10</sort_order>
|
919 |
-
<show_in_default>1</show_in_default>
|
920 |
-
<show_in_website>1</show_in_website>
|
921 |
-
<show_in_store>0</show_in_store>
|
922 |
-
<comment>Enter the email for customer to test lost basket, with the first lost basket campaign.</comment>
|
923 |
-
</email>
|
924 |
-
<force_test translate="label">
|
925 |
-
<label></label>
|
926 |
-
<frontend_model>connector/debug_forcelostbasketsync</frontend_model>
|
927 |
-
<sort_order>50</sort_order>
|
928 |
-
<show_in_default>1</show_in_default>
|
929 |
-
<show_in_website>0</show_in_website>
|
930 |
-
<show_in_store>0</show_in_store>
|
931 |
-
<comment>Use this button force the data synchronization to run now</comment>
|
932 |
-
</force_test>
|
933 |
-
</fields>
|
934 |
-
</test>
|
935 |
</groups>
|
936 |
-
</
|
937 |
-
<
|
938 |
<label><![CDATA[SMS]]></label>
|
939 |
<tab>connector</tab>
|
940 |
<frontend_type>text</frontend_type>
|
@@ -943,7 +959,7 @@
|
|
943 |
<show_in_website>1</show_in_website>
|
944 |
<show_in_store>1</show_in_store>
|
945 |
<groups>
|
946 |
-
<
|
947 |
<label>SMS Message 1</label>
|
948 |
<frontend_type>text</frontend_type>
|
949 |
<sort_order>10</sort_order>
|
@@ -951,7 +967,7 @@
|
|
951 |
<show_in_website>1</show_in_website>
|
952 |
<show_in_store>1</show_in_store>
|
953 |
<fields>
|
954 |
-
<enabled translate="label">
|
955 |
<label>Enabled</label>
|
956 |
<frontend_type>select</frontend_type>
|
957 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
@@ -960,29 +976,28 @@
|
|
960 |
<show_in_website>1</show_in_website>
|
961 |
<show_in_store>1</show_in_store>
|
962 |
</enabled>
|
963 |
-
<
|
964 |
<label>Order Status</label>
|
965 |
<sort_order>20</sort_order>
|
966 |
<frontend_type>select</frontend_type>
|
967 |
-
<source_model>
|
968 |
<show_in_default>1</show_in_default>
|
969 |
<show_in_website>1</show_in_website>
|
970 |
<show_in_store>1</show_in_store>
|
971 |
-
</
|
972 |
-
<message translate="label">
|
973 |
<label>Message</label>
|
974 |
<frontend_type>textarea</frontend_type>
|
975 |
-
<frontend_model>
|
976 |
<sort_order>30</sort_order>
|
977 |
<show_in_default>1</show_in_default>
|
978 |
<show_in_website>1</show_in_website>
|
979 |
<show_in_store>1</show_in_store>
|
980 |
-
<validate>validate-length maximum-length-
|
981 |
</message>
|
982 |
</fields>
|
983 |
-
|
984 |
-
|
985 |
-
<sms_message_two translate="label">
|
986 |
<label>SMS Message 2</label>
|
987 |
<frontend_type>text</frontend_type>
|
988 |
<sort_order>20</sort_order>
|
@@ -990,7 +1005,7 @@
|
|
990 |
<show_in_website>1</show_in_website>
|
991 |
<show_in_store>1</show_in_store>
|
992 |
<fields>
|
993 |
-
<enabled translate="label">
|
994 |
<label>Enabled</label>
|
995 |
<frontend_type>select</frontend_type>
|
996 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
@@ -999,29 +1014,28 @@
|
|
999 |
<show_in_website>1</show_in_website>
|
1000 |
<show_in_store>1</show_in_store>
|
1001 |
</enabled>
|
1002 |
-
<
|
1003 |
<label>Order Status</label>
|
1004 |
<sort_order>20</sort_order>
|
1005 |
<frontend_type>select</frontend_type>
|
1006 |
-
<source_model>
|
1007 |
<show_in_default>1</show_in_default>
|
1008 |
<show_in_website>1</show_in_website>
|
1009 |
<show_in_store>1</show_in_store>
|
1010 |
-
</
|
1011 |
-
<message translate="label">
|
1012 |
<label>Message</label>
|
1013 |
<frontend_type>textarea</frontend_type>
|
1014 |
-
<frontend_model>
|
1015 |
<sort_order>30</sort_order>
|
1016 |
<show_in_default>1</show_in_default>
|
1017 |
<show_in_website>1</show_in_website>
|
1018 |
<show_in_store>1</show_in_store>
|
1019 |
-
<validate>validate-length maximum-length-
|
1020 |
</message>
|
1021 |
</fields>
|
1022 |
-
|
1023 |
-
|
1024 |
-
<sms_message_three translate="label">
|
1025 |
<label>SMS Message 3</label>
|
1026 |
<frontend_type>text</frontend_type>
|
1027 |
<sort_order>30</sort_order>
|
@@ -1029,7 +1043,7 @@
|
|
1029 |
<show_in_website>1</show_in_website>
|
1030 |
<show_in_store>1</show_in_store>
|
1031 |
<fields>
|
1032 |
-
<enabled translate="label">
|
1033 |
<label>Enabled</label>
|
1034 |
<frontend_type>select</frontend_type>
|
1035 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
@@ -1038,28 +1052,28 @@
|
|
1038 |
<show_in_website>1</show_in_website>
|
1039 |
<show_in_store>1</show_in_store>
|
1040 |
</enabled>
|
1041 |
-
<
|
1042 |
<label>Order Status</label>
|
1043 |
<sort_order>20</sort_order>
|
1044 |
<frontend_type>select</frontend_type>
|
1045 |
-
<source_model>
|
1046 |
<show_in_default>1</show_in_default>
|
1047 |
<show_in_website>1</show_in_website>
|
1048 |
<show_in_store>1</show_in_store>
|
1049 |
-
</
|
1050 |
-
<message translate="label">
|
1051 |
<label>Message</label>
|
1052 |
<frontend_type>textarea</frontend_type>
|
1053 |
-
<frontend_model>
|
1054 |
<sort_order>30</sort_order>
|
1055 |
<show_in_default>1</show_in_default>
|
1056 |
<show_in_website>1</show_in_website>
|
1057 |
<show_in_store>1</show_in_store>
|
1058 |
-
<validate>validate-length maximum-length-
|
1059 |
</message>
|
1060 |
</fields>
|
1061 |
-
</
|
1062 |
-
<
|
1063 |
<label>SMS Message 4</label>
|
1064 |
<frontend_type>text</frontend_type>
|
1065 |
<sort_order>40</sort_order>
|
@@ -1067,7 +1081,7 @@
|
|
1067 |
<show_in_website>1</show_in_website>
|
1068 |
<show_in_store>1</show_in_store>
|
1069 |
<fields>
|
1070 |
-
<enabled translate="label">
|
1071 |
<label>Enabled</label>
|
1072 |
<frontend_type>select</frontend_type>
|
1073 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
@@ -1076,31 +1090,30 @@
|
|
1076 |
<show_in_website>1</show_in_website>
|
1077 |
<show_in_store>1</show_in_store>
|
1078 |
</enabled>
|
1079 |
-
<
|
1080 |
<label>Order Status</label>
|
1081 |
<sort_order>20</sort_order>
|
1082 |
<frontend_type>select</frontend_type>
|
1083 |
-
<source_model>
|
1084 |
<show_in_default>1</show_in_default>
|
1085 |
<show_in_website>1</show_in_website>
|
1086 |
<show_in_store>1</show_in_store>
|
1087 |
-
</
|
1088 |
-
<message translate="label">
|
1089 |
<label>Message</label>
|
1090 |
<frontend_type>textarea</frontend_type>
|
1091 |
-
<frontend_model>
|
1092 |
<sort_order>30</sort_order>
|
1093 |
<show_in_default>1</show_in_default>
|
1094 |
<show_in_website>1</show_in_website>
|
1095 |
<show_in_store>1</show_in_store>
|
1096 |
-
<validate>validate-length maximum-length-
|
1097 |
</message>
|
1098 |
</fields>
|
1099 |
-
|
1100 |
-
</sms_message_four>
|
1101 |
</groups>
|
1102 |
-
</
|
1103 |
-
<
|
1104 |
<label><![CDATA[Dynamic Content]]></label>
|
1105 |
<tab>connector</tab>
|
1106 |
<frontend_type>text</frontend_type>
|
@@ -1109,16 +1122,15 @@
|
|
1109 |
<show_in_website>1</show_in_website>
|
1110 |
<show_in_store>0</show_in_store>
|
1111 |
<groups>
|
1112 |
-
<products translate="label">
|
1113 |
<label>Dynamic Products</label>
|
1114 |
<frontend_type>text</frontend_type>
|
1115 |
-
<sort_order>
|
1116 |
<show_in_default>1</show_in_default>
|
1117 |
<show_in_website>1</show_in_website>
|
1118 |
<show_in_store>0</show_in_store>
|
1119 |
-
<expanded>1</expanded>
|
1120 |
<fields>
|
1121 |
-
<related translate="label">
|
1122 |
<label>Related Products</label>
|
1123 |
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
1124 |
<sort_order>10</sort_order>
|
@@ -1126,26 +1138,25 @@
|
|
1126 |
<show_in_website>1</show_in_website>
|
1127 |
<show_in_store>0</show_in_store>
|
1128 |
</related>
|
1129 |
-
<related_display_type translate="label">
|
1130 |
<label>Display Type</label>
|
1131 |
<frontend_type>select</frontend_type>
|
1132 |
-
<source_model>
|
1133 |
<sort_order>20</sort_order>
|
1134 |
<show_in_default>1</show_in_default>
|
1135 |
<show_in_website>1</show_in_website>
|
1136 |
<show_in_store>0</show_in_store>
|
1137 |
</related_display_type>
|
1138 |
-
<related_items_to_display translate="label">
|
1139 |
<label>Items To Display</label>
|
1140 |
<frontend_type>select</frontend_type>
|
1141 |
-
<source_model>
|
1142 |
<sort_order>30</sort_order>
|
1143 |
<show_in_website>1</show_in_website>
|
1144 |
<show_in_default>1</show_in_default>
|
1145 |
<show_in_store>0</show_in_store>
|
1146 |
</related_items_to_display>
|
1147 |
-
|
1148 |
-
<upsell translate="label">
|
1149 |
<label>Up Sell Products</label>
|
1150 |
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
1151 |
<sort_order>40</sort_order>
|
@@ -1153,26 +1164,25 @@
|
|
1153 |
<show_in_website>1</show_in_website>
|
1154 |
<show_in_store>0</show_in_store>
|
1155 |
</upsell>
|
1156 |
-
<upsell_display_type translate="label">
|
1157 |
<label>Display Type</label>
|
1158 |
<frontend_type>select</frontend_type>
|
1159 |
-
<source_model>
|
1160 |
<sort_order>50</sort_order>
|
1161 |
<show_in_default>1</show_in_default>
|
1162 |
<show_in_website>1</show_in_website>
|
1163 |
<show_in_store>0</show_in_store>
|
1164 |
</upsell_display_type>
|
1165 |
-
<upsell_items_to_display translate="label">
|
1166 |
<label>Items To Display</label>
|
1167 |
<frontend_type>select</frontend_type>
|
1168 |
-
<source_model>
|
1169 |
<sort_order>60</sort_order>
|
1170 |
<show_in_website>1</show_in_website>
|
1171 |
<show_in_default>1</show_in_default>
|
1172 |
<show_in_store>0</show_in_store>
|
1173 |
</upsell_items_to_display>
|
1174 |
-
|
1175 |
-
<crosssell translate="label">
|
1176 |
<label>Cross Sell Products</label>
|
1177 |
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
1178 |
<sort_order>70</sort_order>
|
@@ -1180,62 +1190,60 @@
|
|
1180 |
<show_in_website>1</show_in_website>
|
1181 |
<show_in_store>0</show_in_store>
|
1182 |
</crosssell>
|
1183 |
-
<crosssell_display_type translate="label">
|
1184 |
<label>Display Type</label>
|
1185 |
<frontend_type>select</frontend_type>
|
1186 |
-
<source_model>
|
1187 |
<sort_order>80</sort_order>
|
1188 |
<show_in_default>1</show_in_default>
|
1189 |
<show_in_website>1</show_in_website>
|
1190 |
<show_in_store>0</show_in_store>
|
1191 |
</crosssell_display_type>
|
1192 |
-
<crosssell_items_to_display translate="label">
|
1193 |
<label>Items To Display</label>
|
1194 |
<frontend_type>select</frontend_type>
|
1195 |
-
<source_model>
|
1196 |
<sort_order>90</sort_order>
|
1197 |
<show_in_website>1</show_in_website>
|
1198 |
<show_in_default>1</show_in_default>
|
1199 |
<show_in_store>0</show_in_store>
|
1200 |
</crosssell_items_to_display>
|
1201 |
-
|
1202 |
-
<best translate="label">
|
1203 |
<label>Best Sellers</label>
|
1204 |
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
1205 |
<sort_order>100</sort_order>
|
1206 |
<show_in_default>1</show_in_default>
|
1207 |
<show_in_website>1</show_in_website>
|
1208 |
<show_in_store>0</show_in_store>
|
1209 |
-
</
|
1210 |
-
<
|
1211 |
<label>Display Type</label>
|
1212 |
<frontend_type>select</frontend_type>
|
1213 |
-
<source_model>
|
1214 |
<sort_order>110</sort_order>
|
1215 |
<show_in_default>1</show_in_default>
|
1216 |
<show_in_website>1</show_in_website>
|
1217 |
<show_in_store>0</show_in_store>
|
1218 |
-
</
|
1219 |
-
<
|
1220 |
<label>Items To Display</label>
|
1221 |
<frontend_type>select</frontend_type>
|
1222 |
-
<source_model>
|
1223 |
<sort_order>120</sort_order>
|
1224 |
<show_in_website>1</show_in_website>
|
1225 |
<show_in_default>1</show_in_default>
|
1226 |
<show_in_store>0</show_in_store>
|
1227 |
-
</
|
1228 |
-
<
|
1229 |
<label>Time Period</label>
|
1230 |
<frontend_type>select</frontend_type>
|
1231 |
-
<source_model>
|
1232 |
<sort_order>130</sort_order>
|
1233 |
<show_in_default>1</show_in_default>
|
1234 |
<show_in_website>1</show_in_website>
|
1235 |
<show_in_store>0</show_in_store>
|
1236 |
-
</
|
1237 |
-
|
1238 |
-
<most_viewed translate="label">
|
1239 |
<label>Most Viewed</label>
|
1240 |
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
1241 |
<sort_order>140</sort_order>
|
@@ -1243,35 +1251,34 @@
|
|
1243 |
<show_in_website>1</show_in_website>
|
1244 |
<show_in_store>0</show_in_store>
|
1245 |
</most_viewed>
|
1246 |
-
<most_viewed_display_type translate="label">
|
1247 |
<label>Display Type</label>
|
1248 |
<frontend_type>select</frontend_type>
|
1249 |
-
<source_model>
|
1250 |
<sort_order>150</sort_order>
|
1251 |
<show_in_default>1</show_in_default>
|
1252 |
<show_in_website>1</show_in_website>
|
1253 |
<show_in_store>0</show_in_store>
|
1254 |
</most_viewed_display_type>
|
1255 |
-
<most_viewed_items_to_display translate="label">
|
1256 |
<label>Items To Display</label>
|
1257 |
<frontend_type>select</frontend_type>
|
1258 |
-
<source_model>
|
1259 |
<sort_order>160</sort_order>
|
1260 |
<show_in_website>1</show_in_website>
|
1261 |
<show_in_default>1</show_in_default>
|
1262 |
<show_in_store>0</show_in_store>
|
1263 |
</most_viewed_items_to_display>
|
1264 |
-
<most_viewed_time_period translate="label">
|
1265 |
<label>Time Period</label>
|
1266 |
<frontend_type>select</frontend_type>
|
1267 |
-
<source_model>
|
1268 |
<sort_order>170</sort_order>
|
1269 |
<show_in_default>1</show_in_default>
|
1270 |
<show_in_website>1</show_in_website>
|
1271 |
<show_in_store>0</show_in_store>
|
1272 |
</most_viewed_time_period>
|
1273 |
-
|
1274 |
-
<recently_viewed translate="label">
|
1275 |
<label>Recently Viewed</label>
|
1276 |
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
1277 |
<sort_order>180</sort_order>
|
@@ -1279,29 +1286,27 @@
|
|
1279 |
<show_in_website>1</show_in_website>
|
1280 |
<show_in_store>0</show_in_store>
|
1281 |
</recently_viewed>
|
1282 |
-
<recently_viewed_display_type translate="label">
|
1283 |
<label>Display Type</label>
|
1284 |
<frontend_type>select</frontend_type>
|
1285 |
-
<source_model>
|
1286 |
<sort_order>190</sort_order>
|
1287 |
<show_in_default>1</show_in_default>
|
1288 |
<show_in_website>1</show_in_website>
|
1289 |
<show_in_store>0</show_in_store>
|
1290 |
</recently_viewed_display_type>
|
1291 |
-
<recently_viewed_items_to_display translate="label">
|
1292 |
<label>items To Display</label>
|
1293 |
<frontend_type>select</frontend_type>
|
1294 |
-
<source_model>
|
1295 |
<sort_order>200</sort_order>
|
1296 |
<show_in_default>1</show_in_default>
|
1297 |
<show_in_website>1</show_in_website>
|
1298 |
<show_in_store>0</show_in_store>
|
1299 |
</recently_viewed_items_to_display>
|
1300 |
-
|
1301 |
<validator>
|
1302 |
-
<label></label>
|
1303 |
<frontend_type>hidden</frontend_type>
|
1304 |
-
<frontend_model>
|
1305 |
<sort_order>210</sort_order>
|
1306 |
<show_in_default>1</show_in_default>
|
1307 |
<show_in_website>1</show_in_website>
|
@@ -1309,52 +1314,327 @@
|
|
1309 |
<can_be_empty>1</can_be_empty>
|
1310 |
</validator>
|
1311 |
</fields>
|
1312 |
-
|
1313 |
</products>
|
1314 |
-
<
|
1315 |
-
<label
|
1316 |
<frontend_type>text</frontend_type>
|
1317 |
-
<sort_order>
|
1318 |
<show_in_default>1</show_in_default>
|
1319 |
<show_in_website>1</show_in_website>
|
1320 |
<show_in_store>0</show_in_store>
|
1321 |
-
<expanded>1</expanded>
|
1322 |
<fields>
|
1323 |
-
<
|
1324 |
-
<label>
|
1325 |
-
<
|
1326 |
<sort_order>10</sort_order>
|
1327 |
<show_in_default>1</show_in_default>
|
1328 |
<show_in_website>1</show_in_website>
|
1329 |
<show_in_store>0</show_in_store>
|
1330 |
-
|
1331 |
-
|
1332 |
-
|
1333 |
-
<
|
1334 |
-
<
|
1335 |
-
<sort_order>
|
1336 |
<show_in_default>1</show_in_default>
|
1337 |
<show_in_website>1</show_in_website>
|
1338 |
<show_in_store>0</show_in_store>
|
1339 |
-
</
|
1340 |
-
<
|
1341 |
-
<label>
|
1342 |
-
<frontend_type>
|
1343 |
-
<
|
1344 |
-
<sort_order>
|
1345 |
-
<show_in_website>1</show_in_website>
|
1346 |
-
<show_in_default>1</show_in_default>
|
1347 |
-
<show_in_store>0</show_in_store>
|
1348 |
-
</items_to_display>
|
1349 |
-
<products_push translate="label">
|
1350 |
-
<label>Products</label>
|
1351 |
-
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
1352 |
-
<sort_order>80</sort_order>
|
1353 |
<show_in_default>1</show_in_default>
|
1354 |
<show_in_website>1</show_in_website>
|
1355 |
<show_in_store>0</show_in_store>
|
1356 |
-
</
|
1357 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1358 |
<label>Products</label>
|
1359 |
<frontend_type>text</frontend_type>
|
1360 |
<sort_order>90</sort_order>
|
@@ -1365,15 +1645,15 @@
|
|
1365 |
</products_push_items>
|
1366 |
</fields>
|
1367 |
</manual_product_search>
|
1368 |
-
<fallback_products translate="label">
|
1369 |
<label>Fallback Products</label>
|
1370 |
<frontend_type>text</frontend_type>
|
1371 |
-
<sort_order>
|
1372 |
<show_in_default>1</show_in_default>
|
1373 |
<show_in_website>1</show_in_website>
|
1374 |
<show_in_store>0</show_in_store>
|
1375 |
<fields>
|
1376 |
-
<product_list translate="label">
|
1377 |
<label>Products</label>
|
1378 |
<frontend_type>text</frontend_type>
|
1379 |
<sort_order>10</sort_order>
|
@@ -1385,223 +1665,381 @@
|
|
1385 |
</fields>
|
1386 |
</fallback_products>
|
1387 |
</groups>
|
1388 |
-
</
|
1389 |
-
<
|
1390 |
-
<label
|
1391 |
<tab>connector</tab>
|
1392 |
<frontend_type>text</frontend_type>
|
1393 |
-
<sort_order>9000</sort_order>
|
1394 |
<show_in_default>1</show_in_default>
|
1395 |
<show_in_website>1</show_in_website>
|
1396 |
-
<show_in_store>
|
|
|
1397 |
<groups>
|
1398 |
-
<
|
1399 |
-
<label>
|
1400 |
<frontend_type>text</frontend_type>
|
1401 |
-
<sort_order>
|
1402 |
<show_in_default>1</show_in_default>
|
1403 |
<show_in_website>1</show_in_website>
|
1404 |
<show_in_store>0</show_in_store>
|
|
|
1405 |
<fields>
|
1406 |
-
<
|
1407 |
-
<label>
|
1408 |
<frontend_type>select</frontend_type>
|
1409 |
-
<source_model>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1410 |
<sort_order>40</sort_order>
|
1411 |
<show_in_default>1</show_in_default>
|
1412 |
<show_in_website>1</show_in_website>
|
1413 |
<show_in_store>0</show_in_store>
|
1414 |
-
|
|
|
1415 |
</fields>
|
1416 |
-
</
|
1417 |
-
<
|
1418 |
-
<label
|
1419 |
<frontend_type>text</frontend_type>
|
1420 |
-
<sort_order>
|
1421 |
<show_in_default>1</show_in_default>
|
1422 |
<show_in_website>1</show_in_website>
|
1423 |
-
<show_in_store>
|
|
|
1424 |
<fields>
|
1425 |
-
|
1426 |
-
|
1427 |
-
<
|
|
|
1428 |
<sort_order>10</sort_order>
|
1429 |
<show_in_default>1</show_in_default>
|
1430 |
<show_in_website>1</show_in_website>
|
1431 |
<show_in_store>0</show_in_store>
|
1432 |
-
|
1433 |
-
|
1434 |
-
|
1435 |
-
<label>Lost Baskets</label>
|
1436 |
-
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
1437 |
<sort_order>20</sort_order>
|
|
|
|
|
1438 |
<show_in_default>1</show_in_default>
|
1439 |
<show_in_website>1</show_in_website>
|
1440 |
<show_in_store>0</show_in_store>
|
1441 |
-
</
|
1442 |
-
|
1443 |
-
|
1444 |
-
<label>Baskets Content URL</label>
|
1445 |
-
<frontend_type>label</frontend_type>
|
1446 |
-
<frontend_model>connector/adminhtml_system_lostbasket</frontend_model>
|
1447 |
<sort_order>30</sort_order>
|
|
|
|
|
1448 |
<show_in_default>1</show_in_default>
|
1449 |
<show_in_website>1</show_in_website>
|
1450 |
<show_in_store>0</show_in_store>
|
1451 |
-
</
|
1452 |
-
<
|
1453 |
-
<label>
|
1454 |
-
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
1455 |
<sort_order>40</sort_order>
|
1456 |
-
<
|
|
|
1457 |
<show_in_default>1</show_in_default>
|
|
|
1458 |
<show_in_store>0</show_in_store>
|
1459 |
-
</
|
1460 |
-
<
|
1461 |
-
<label>
|
1462 |
-
<frontend_type>label</frontend_type>
|
1463 |
-
<frontend_model>connector/adminhtml_system_couponinfo</frontend_model>
|
1464 |
<sort_order>50</sort_order>
|
|
|
|
|
1465 |
<show_in_default>1</show_in_default>
|
1466 |
<show_in_website>1</show_in_website>
|
1467 |
<show_in_store>0</show_in_store>
|
1468 |
-
</
|
1469 |
-
|
1470 |
-
|
1471 |
-
<label>Dynamic Content</label>
|
1472 |
-
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
1473 |
<sort_order>60</sort_order>
|
|
|
|
|
1474 |
<show_in_default>1</show_in_default>
|
1475 |
<show_in_website>1</show_in_website>
|
1476 |
<show_in_store>0</show_in_store>
|
1477 |
-
</
|
1478 |
-
<
|
1479 |
-
<label>
|
1480 |
-
<frontend_type>label</frontend_type>
|
1481 |
-
<frontend_model>connector/adminhtml_system_related</frontend_model>
|
1482 |
<sort_order>70</sort_order>
|
|
|
|
|
1483 |
<show_in_default>1</show_in_default>
|
1484 |
<show_in_website>1</show_in_website>
|
1485 |
<show_in_store>0</show_in_store>
|
1486 |
-
</
|
1487 |
-
<
|
1488 |
-
<label>
|
1489 |
-
<frontend_type>label</frontend_type>
|
1490 |
-
<frontend_model>connector/adminhtml_system_upsell</frontend_model>
|
1491 |
<sort_order>80</sort_order>
|
|
|
|
|
1492 |
<show_in_default>1</show_in_default>
|
1493 |
<show_in_website>1</show_in_website>
|
1494 |
<show_in_store>0</show_in_store>
|
1495 |
-
</
|
1496 |
-
<
|
1497 |
-
<label>
|
1498 |
-
<frontend_type>label</frontend_type>
|
1499 |
-
<frontend_model>connector/adminhtml_system_crosssell</frontend_model>
|
1500 |
<sort_order>90</sort_order>
|
|
|
|
|
1501 |
<show_in_default>1</show_in_default>
|
1502 |
<show_in_website>1</show_in_website>
|
1503 |
<show_in_store>0</show_in_store>
|
1504 |
-
</
|
1505 |
-
|
1506 |
-
|
1507 |
-
<label>Best Sellers URL</label>
|
1508 |
-
<frontend_type>label</frontend_type>
|
1509 |
-
<frontend_model>connector/adminhtml_system_bestsellers</frontend_model>
|
1510 |
<sort_order>100</sort_order>
|
|
|
|
|
1511 |
<show_in_default>1</show_in_default>
|
1512 |
<show_in_website>1</show_in_website>
|
1513 |
<show_in_store>0</show_in_store>
|
1514 |
-
</
|
1515 |
-
<
|
1516 |
-
<label>
|
1517 |
-
<frontend_type>label</frontend_type>
|
1518 |
-
<frontend_model>connector/adminhtml_system_mostviewed</frontend_model>
|
1519 |
<sort_order>110</sort_order>
|
|
|
|
|
1520 |
<show_in_default>1</show_in_default>
|
1521 |
<show_in_website>1</show_in_website>
|
1522 |
<show_in_store>0</show_in_store>
|
1523 |
-
</
|
1524 |
-
<
|
1525 |
-
<label>
|
1526 |
-
<frontend_type>label</frontend_type>
|
1527 |
-
<frontend_model>connector/adminhtml_system_productpush</frontend_model>
|
1528 |
<sort_order>120</sort_order>
|
|
|
|
|
1529 |
<show_in_default>1</show_in_default>
|
1530 |
<show_in_website>1</show_in_website>
|
1531 |
<show_in_store>0</show_in_store>
|
1532 |
-
</
|
1533 |
-
<
|
1534 |
-
<label>
|
1535 |
-
<frontend_type>label</frontend_type>
|
1536 |
-
<frontend_model>connector/adminhtml_system_recentlyviewed</frontend_model>
|
1537 |
<sort_order>130</sort_order>
|
|
|
|
|
1538 |
<show_in_default>1</show_in_default>
|
1539 |
<show_in_website>1</show_in_website>
|
1540 |
<show_in_store>0</show_in_store>
|
1541 |
-
</
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1542 |
</fields>
|
1543 |
-
</
|
1544 |
-
<admin translate="label">
|
1545 |
<label>Admin</label>
|
1546 |
<frontend_type>text</frontend_type>
|
1547 |
<sort_order>30</sort_order>
|
1548 |
<show_in_default>1</show_in_default>
|
1549 |
-
<
|
1550 |
<show_in_store>0</show_in_store>
|
|
|
|
|
1551 |
<fields>
|
1552 |
-
<
|
1553 |
-
<label>
|
1554 |
-
<frontend_model>
|
1555 |
<sort_order>10</sort_order>
|
1556 |
<show_in_default>1</show_in_default>
|
1557 |
<show_in_website>1</show_in_website>
|
1558 |
<show_in_store>0</show_in_store>
|
1559 |
-
|
1560 |
-
|
1561 |
-
|
1562 |
-
<
|
|
|
1563 |
<sort_order>20</sort_order>
|
1564 |
<show_in_default>1</show_in_default>
|
1565 |
<show_in_website>1</show_in_website>
|
1566 |
<show_in_store>0</show_in_store>
|
1567 |
-
|
1568 |
-
|
1569 |
-
|
1570 |
-
<
|
|
|
1571 |
<sort_order>30</sort_order>
|
1572 |
<show_in_default>1</show_in_default>
|
1573 |
<show_in_website>1</show_in_website>
|
1574 |
<show_in_store>0</show_in_store>
|
1575 |
-
|
1576 |
-
|
1577 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1578 |
<frontend_type>select</frontend_type>
|
1579 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
|
|
1580 |
<show_in_default>1</show_in_default>
|
1581 |
<show_in_website>0</show_in_website>
|
1582 |
<show_in_store>0</show_in_store>
|
1583 |
-
<sort_order>40</sort_order>
|
1584 |
<comment>Set to NO to use system default memory.</comment>
|
1585 |
</memory_limit>
|
1586 |
-
<batch_size translate="label">
|
1587 |
<label>Customer Sync Batch Size</label>
|
1588 |
<frontend_type>text</frontend_type>
|
1589 |
<show_in_default>1</show_in_default>
|
1590 |
<show_in_website>1</show_in_website>
|
1591 |
<show_in_store>0</show_in_store>
|
1592 |
-
<sort_order>
|
1593 |
-
<comment>Set the limit size for customers loaded
|
1594 |
</batch_size>
|
1595 |
-
<
|
1596 |
<label>Debug Mode</label>
|
1597 |
<frontend_type>select</frontend_type>
|
1598 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
1599 |
-
<sort_order>
|
1600 |
<show_in_default>1</show_in_default>
|
1601 |
<show_in_website>1</show_in_website>
|
1602 |
-
<show_in_store>
|
1603 |
-
|
1604 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1605 |
</fields>
|
1606 |
</admin>
|
1607 |
</groups>
|
1 |
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
<config>
|
3 |
<tabs>
|
4 |
+
<connector translate="label" module="connector">
|
5 |
<label>EMAIL</label>
|
6 |
<sort_order>1000</sort_order>
|
7 |
</connector>
|
8 |
</tabs>
|
9 |
<sections>
|
10 |
+
<connector_api_credentials translate="label" module="connector">
|
11 |
<label><![CDATA[API Credentials]]></label>
|
12 |
<tab>connector</tab>
|
13 |
<frontend_type>text</frontend_type>
|
16 |
<show_in_website>1</show_in_website>
|
17 |
<show_in_store>0</show_in_store>
|
18 |
<groups>
|
19 |
+
<api translate="label" module="connector">
|
20 |
+
<label>Settings</label>
|
21 |
<frontend_type>text</frontend_type>
|
22 |
<sort_order>10</sort_order>
|
23 |
<show_in_default>1</show_in_default>
|
25 |
<show_in_store>0</show_in_store>
|
26 |
<expanded>1</expanded>
|
27 |
<fields>
|
28 |
+
<enabled translate="label" module="connector">
|
29 |
+
<label>Enabled</label>
|
30 |
+
<frontend_type>select</frontend_type>
|
31 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
32 |
<sort_order>10</sort_order>
|
33 |
<show_in_default>1</show_in_default>
|
34 |
<show_in_website>1</show_in_website>
|
35 |
<show_in_store>0</show_in_store>
|
36 |
+
</enabled>
|
37 |
+
<username translate="label" module="connector">
|
38 |
+
<label>API Username</label>
|
39 |
+
<frontend_type>text</frontend_type>
|
40 |
+
<frontend_model>email_connector/adminhtml_system_config_wrapper</frontend_model>
|
|
|
41 |
<sort_order>20</sort_order>
|
42 |
<show_in_default>1</show_in_default>
|
43 |
<show_in_website>1</show_in_website>
|
44 |
<show_in_store>0</show_in_store>
|
45 |
+
<depends><enabled>1</enabled></depends>
|
46 |
+
</username>
|
47 |
+
<password translate="label" module="connector">
|
48 |
+
<label>API Password</label>
|
49 |
+
<frontend_type>password</frontend_type>
|
50 |
+
<frontend_model>email_connector/adminhtml_system_ajaxvalidate</frontend_model>
|
51 |
<sort_order>30</sort_order>
|
52 |
<show_in_default>1</show_in_default>
|
53 |
<show_in_website>1</show_in_website>
|
54 |
<show_in_store>0</show_in_store>
|
55 |
+
<depends><enabled>1</enabled></depends>
|
56 |
+
</password>
|
57 |
<validator>
|
|
|
58 |
<frontend_type>hidden</frontend_type>
|
59 |
+
<frontend_model>email_connector/adminhtml_system_config_waitingfield</frontend_model>
|
60 |
<sort_order>50</sort_order>
|
61 |
<show_in_default>1</show_in_default>
|
62 |
<show_in_website>1</show_in_website>
|
64 |
<can_be_empty>1</can_be_empty>
|
65 |
</validator>
|
66 |
</fields>
|
67 |
+
</api>
|
68 |
+
<oauth translate="label" module="connector">
|
69 |
+
<label>OAUTH Credentials</label>
|
70 |
+
<sort_order>20</sort_order>
|
71 |
+
<show_in_default>1</show_in_default>
|
72 |
+
<show_in_website>1</show_in_website>
|
73 |
+
<show_in_store>0</show_in_store>
|
74 |
+
<fields>
|
75 |
+
<client_id translate="label" module="connector">
|
76 |
+
<label>Client ID</label>
|
77 |
+
<frontend_type>text</frontend_type>
|
78 |
+
<sort_order>10</sort_order>
|
79 |
+
<show_in_default>1</show_in_default>
|
80 |
+
<show_in_website>1</show_in_website>
|
81 |
+
<show_in_store>0</show_in_store>
|
82 |
+
</client_id>
|
83 |
+
<client_key translate="label" module="connector">
|
84 |
+
<label>Client Secret Key</label>
|
85 |
+
<frontend_type>text</frontend_type>
|
86 |
+
<sort_order>20</sort_order>
|
87 |
+
<show_in_default>1</show_in_default>
|
88 |
+
<show_in_website>1</show_in_website>
|
89 |
+
<show_in_store>0</show_in_store>
|
90 |
+
</client_key>
|
91 |
+
<test_connect translate="label" module="connector">
|
92 |
+
<label>Connection</label>
|
93 |
+
<frontend_model>email_connector/adminhtml_system_automation_connect</frontend_model>
|
94 |
+
<sort_order>30</sort_order>
|
95 |
+
<show_in_default>1</show_in_default>
|
96 |
+
<show_in_website>1</show_in_website>
|
97 |
+
<comment>Please Save Client ID and Secret Key Before Test. Generate/Refresh New Token.</comment>
|
98 |
+
</test_connect>
|
99 |
+
</fields>
|
100 |
+
</oauth>
|
101 |
</groups>
|
102 |
+
</connector_api_credentials>
|
103 |
+
<connector_sync_settings translate="label" module="connector">
|
|
|
104 |
<label><![CDATA[Sync Settings]]></label>
|
|
|
105 |
<tab>connector</tab>
|
106 |
<frontend_type>text</frontend_type>
|
107 |
<sort_order>3000</sort_order>
|
109 |
<show_in_website>1</show_in_website>
|
110 |
<show_in_store>0</show_in_store>
|
111 |
<groups>
|
112 |
+
<address_book translate="label" module="connector">
|
113 |
+
<label>Address Book Mapping</label>
|
|
|
114 |
<sort_order>10</sort_order>
|
115 |
<show_in_default>1</show_in_default>
|
116 |
<show_in_website>1</show_in_website>
|
117 |
<show_in_store>0</show_in_store>
|
118 |
<expanded>1</expanded>
|
119 |
<fields>
|
120 |
+
<customers translate="label" module="connector">
|
121 |
+
<label>Add Customers To</label>
|
122 |
<frontend_type>select</frontend_type>
|
123 |
+
<source_model>email_connector/adminhtml_source_addressbooks</source_model>
|
124 |
<sort_order>10</sort_order>
|
125 |
<show_in_default>1</show_in_default>
|
126 |
<show_in_website>1</show_in_website>
|
127 |
<show_in_store>0</show_in_store>
|
128 |
+
</customers>
|
129 |
+
<subscribers translate="label" module="connector">
|
130 |
+
<label>Add Subscribers To</label>
|
131 |
+
<frontend_type>select</frontend_type>
|
132 |
+
<source_model>email_connector/adminhtml_source_addressbooks</source_model>
|
133 |
<sort_order>20</sort_order>
|
134 |
<show_in_default>1</show_in_default>
|
135 |
+
<show_in_website>1</show_in_website>
|
136 |
<show_in_store>0</show_in_store>
|
137 |
+
</subscribers>
|
138 |
+
<guests translate="label" module="connector">
|
139 |
+
<label>Add Guests To</label>
|
|
|
140 |
<frontend_type>select</frontend_type>
|
141 |
+
<source_model>email_connector/adminhtml_source_addressbooks</source_model>
|
|
|
142 |
<sort_order>30</sort_order>
|
143 |
<show_in_default>1</show_in_default>
|
144 |
+
<show_in_website>1</show_in_website>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
145 |
<show_in_store>0</show_in_store>
|
146 |
+
</guests>
|
|
|
147 |
</fields>
|
148 |
+
</address_book>
|
149 |
+
<sync translate="label" module="connector">
|
150 |
+
<label>Sync</label>
|
151 |
<frontend_type>text</frontend_type>
|
152 |
<sort_order>20</sort_order>
|
153 |
<show_in_default>1</show_in_default>
|
155 |
<show_in_store>0</show_in_store>
|
156 |
<expanded>1</expanded>
|
157 |
<fields>
|
158 |
+
<contact_title translate="label" module="connector">
|
159 |
+
<label>Contact Sync</label>
|
160 |
+
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
161 |
+
<sort_order>10</sort_order>
|
162 |
+
<show_in_default>1</show_in_default>
|
163 |
+
<show_in_website>1</show_in_website>
|
164 |
+
<show_in_store>0</show_in_store>
|
165 |
+
</contact_title>
|
166 |
+
<contact_enabled translate="label" module="connector">
|
167 |
<label>Enabled</label>
|
168 |
<frontend_type>select</frontend_type>
|
169 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
170 |
+
<sort_order>20</sort_order>
|
171 |
<show_in_default>1</show_in_default>
|
172 |
<show_in_website>1</show_in_website>
|
173 |
<show_in_store>0</show_in_store>
|
174 |
+
</contact_enabled>
|
175 |
+
<subscriber_title translate="label" module="connector">
|
176 |
+
<label>Subscriber Sync</label>
|
177 |
+
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
178 |
+
<sort_order>50</sort_order>
|
|
|
179 |
<show_in_default>1</show_in_default>
|
180 |
+
<show_in_website>1</show_in_website>
|
181 |
<show_in_store>0</show_in_store>
|
182 |
+
</subscriber_title>
|
183 |
+
<subscriber_enabled translate="label" module="connector">
|
184 |
+
<label>Enabled</label>
|
|
|
185 |
<frontend_type>select</frontend_type>
|
186 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
187 |
+
<sort_order>60</sort_order>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
188 |
<show_in_default>1</show_in_default>
|
189 |
+
<show_in_website>1</show_in_website>
|
190 |
<show_in_store>0</show_in_store>
|
191 |
+
</subscriber_enabled>
|
192 |
+
<order_title translate="label" module="connector">
|
193 |
+
<label>Order Sync</label>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
194 |
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
195 |
+
<sort_order>70</sort_order>
|
196 |
<show_in_default>1</show_in_default>
|
197 |
<show_in_website>1</show_in_website>
|
198 |
<show_in_store>0</show_in_store>
|
199 |
+
</order_title>
|
200 |
+
<order_enabled translate="label" module="connector">
|
201 |
<label>Enabled</label>
|
202 |
<frontend_type>select</frontend_type>
|
203 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
204 |
+
<sort_order>80</sort_order>
|
205 |
<show_in_default>1</show_in_default>
|
206 |
<show_in_website>1</show_in_website>
|
207 |
<show_in_store>0</show_in_store>
|
208 |
</order_enabled>
|
209 |
+
<wishlist_title translate="label" module="connector">
|
210 |
+
<label>Wishlist Sync</label>
|
211 |
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
212 |
+
<sort_order>90</sort_order>
|
213 |
<show_in_default>1</show_in_default>
|
214 |
<show_in_website>1</show_in_website>
|
215 |
<show_in_store>0</show_in_store>
|
216 |
+
</wishlist_title>
|
217 |
+
<wishlist_enabled translate="label" module="connector">
|
218 |
<label>Enabled</label>
|
219 |
<frontend_type>select</frontend_type>
|
220 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
221 |
+
<sort_order>100</sort_order>
|
222 |
<show_in_default>1</show_in_default>
|
223 |
<show_in_website>1</show_in_website>
|
224 |
<show_in_store>0</show_in_store>
|
225 |
</wishlist_enabled>
|
226 |
+
<validator>
|
227 |
+
<frontend_type>hidden</frontend_type>
|
228 |
+
<frontend_model>email_connector/adminhtml_system_config_waitingfield</frontend_model>
|
229 |
+
<sort_order>110</sort_order>
|
230 |
+
<show_in_default>1</show_in_default>
|
231 |
+
<show_in_website>1</show_in_website>
|
232 |
+
<show_in_store>0</show_in_store>
|
233 |
+
<can_be_empty>1</can_be_empty>
|
234 |
+
</validator>
|
235 |
+
</fields>
|
236 |
+
</sync>
|
237 |
+
<dynamic_addressbook translate="label" module="connector">
|
238 |
+
<label>Create Address Book</label>
|
239 |
+
<sort_order>30</sort_order>
|
240 |
+
<show_in_default>1</show_in_default>
|
241 |
+
<show_in_website>1</show_in_website>
|
242 |
+
<show_in_store>0</show_in_store>
|
243 |
+
<fields>
|
244 |
+
<addressbook_name translate="label" module="connector">
|
245 |
+
<label>Address Book Name</label>
|
246 |
+
<frontend_type>text</frontend_type>
|
247 |
+
<frontend_model>email_connector/adminhtml_system_config_addressbook</frontend_model>
|
248 |
+
<sort_order>10</sort_order>
|
249 |
+
<show_in_default>1</show_in_default>
|
250 |
+
<show_in_website>1</show_in_website>
|
251 |
+
<show_in_store>0</show_in_store>
|
252 |
+
</addressbook_name>
|
253 |
+
<addresbook_button translate="label button_label" module="connector">
|
254 |
+
<label />
|
255 |
+
<button_label>Create New Address Book</button_label>
|
256 |
+
<frontend_model>email_connector/adminhtml_system_dynamic_addressbookbutton</frontend_model>
|
257 |
+
<sort_order>30</sort_order>
|
258 |
+
<show_in_default>1</show_in_default>
|
259 |
+
<show_in_website>1</show_in_website>
|
260 |
+
<show_in_store>0</show_in_store>
|
261 |
+
</addresbook_button>
|
262 |
</fields>
|
263 |
+
</dynamic_addressbook>
|
264 |
</groups>
|
265 |
</connector_sync_settings>
|
266 |
+
<connector_data_mapping translate="label" module="connector">
|
267 |
<label><![CDATA[Data Mapping]]></label>
|
268 |
<tab>connector</tab>
|
269 |
<frontend_type>text</frontend_type>
|
272 |
<show_in_website>1</show_in_website>
|
273 |
<show_in_store>0</show_in_store>
|
274 |
<groups>
|
275 |
+
<customer_data translate="label" module="connector">
|
276 |
+
<label>Data Fields Mapping</label>
|
277 |
<frontend_type>text</frontend_type>
|
278 |
<sort_order>20</sort_order>
|
279 |
<show_in_default>1</show_in_default>
|
280 |
<show_in_website>1</show_in_website>
|
281 |
<show_in_store>0</show_in_store>
|
282 |
<expanded>1</expanded>
|
283 |
+
<comment><![CDATA[<p class="notice">AUTOMAP AVAILABLE IN ADVANCED SECTION TO MAP ALL DATAFIELDS.</p>]]></comment>
|
284 |
<fields>
|
285 |
+
<customer_title translate="label" module="connector">
|
286 |
<label>Customer Information</label>
|
287 |
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
288 |
<sort_order>10</sort_order>
|
290 |
<show_in_website>1</show_in_website>
|
291 |
<show_in_store>0</show_in_store>
|
292 |
</customer_title>
|
293 |
+
<title translate="label" module="connector">
|
294 |
+
<label>Title</label>
|
|
|
295 |
<frontend_type>select</frontend_type>
|
296 |
+
<source_model>email_connector/adminhtml_source_datafields</source_model>
|
297 |
<sort_order>20</sort_order>
|
298 |
<show_in_default>1</show_in_default>
|
299 |
<show_in_website>1</show_in_website>
|
300 |
<show_in_store>0</show_in_store>
|
301 |
+
</title>
|
302 |
+
<customer_id translate="label" module="connector">
|
303 |
+
<label>Customer ID</label>
|
|
|
304 |
<frontend_type>select</frontend_type>
|
305 |
+
<source_model>email_connector/adminhtml_source_datafields</source_model>
|
306 |
<sort_order>30</sort_order>
|
307 |
<show_in_default>1</show_in_default>
|
308 |
<show_in_website>1</show_in_website>
|
309 |
<show_in_store>0</show_in_store>
|
310 |
+
</customer_id>
|
311 |
+
<firstname translate="label" module="connector">
|
|
|
312 |
<label>First Name</label>
|
313 |
<frontend_type>select</frontend_type>
|
314 |
+
<source_model>email_connector/adminhtml_source_datafields</source_model>
|
315 |
<sort_order>40</sort_order>
|
316 |
<show_in_default>1</show_in_default>
|
317 |
<show_in_website>1</show_in_website>
|
318 |
<show_in_store>0</show_in_store>
|
319 |
</firstname>
|
320 |
+
<lastname translate="label" module="connector">
|
321 |
<label>Last Name</label>
|
322 |
<frontend_type>select</frontend_type>
|
323 |
+
<source_model>email_connector/adminhtml_source_datafields</source_model>
|
324 |
<sort_order>50</sort_order>
|
325 |
<show_in_default>1</show_in_default>
|
326 |
<show_in_website>1</show_in_website>
|
327 |
<show_in_store>0</show_in_store>
|
328 |
</lastname>
|
329 |
+
<dob translate="label" module="connector">
|
330 |
<label>D.O.B.</label>
|
331 |
<frontend_type>select</frontend_type>
|
332 |
+
<source_model>email_connector/adminhtml_source_datafields</source_model>
|
333 |
<sort_order>60</sort_order>
|
334 |
<show_in_default>1</show_in_default>
|
335 |
<show_in_website>1</show_in_website>
|
336 |
<show_in_store>0</show_in_store>
|
337 |
</dob>
|
338 |
+
<gender translate="label" module="connector">
|
339 |
<label>Gender</label>
|
340 |
<frontend_type>select</frontend_type>
|
341 |
+
<source_model>email_connector/adminhtml_source_datafields</source_model>
|
342 |
<sort_order>70</sort_order>
|
343 |
<show_in_default>1</show_in_default>
|
344 |
<show_in_website>1</show_in_website>
|
345 |
<show_in_store>0</show_in_store>
|
346 |
</gender>
|
347 |
+
<website_name translate="label" module="connector">
|
348 |
<label>Website Created On</label>
|
349 |
<frontend_type>select</frontend_type>
|
350 |
+
<source_model>email_connector/adminhtml_source_datafields</source_model>
|
351 |
<sort_order>80</sort_order>
|
352 |
<show_in_default>1</show_in_default>
|
353 |
<show_in_website>1</show_in_website>
|
354 |
<show_in_store>0</show_in_store>
|
355 |
+
</website_name>
|
356 |
+
<store_name translate="label" module="connector">
|
357 |
<label>Store Created On</label>
|
358 |
<frontend_type>select</frontend_type>
|
359 |
+
<source_model>email_connector/adminhtml_source_datafields</source_model>
|
360 |
<sort_order>90</sort_order>
|
361 |
<show_in_default>1</show_in_default>
|
362 |
<show_in_website>1</show_in_website>
|
363 |
<show_in_store>0</show_in_store>
|
364 |
+
</store_name>
|
365 |
+
<created_at translate="label" module="connector">
|
366 |
<label>Account Created Date</label>
|
367 |
<frontend_type>select</frontend_type>
|
368 |
+
<source_model>email_connector/adminhtml_source_datafields</source_model>
|
369 |
<sort_order>100</sort_order>
|
370 |
<show_in_default>1</show_in_default>
|
371 |
<show_in_website>1</show_in_website>
|
372 |
<show_in_store>0</show_in_store>
|
373 |
+
</created_at>
|
374 |
+
<last_logged_date translate="label" module="connector">
|
375 |
<label>Last Logged In Date</label>
|
376 |
<frontend_type>select</frontend_type>
|
377 |
+
<source_model>email_connector/adminhtml_source_datafields</source_model>
|
378 |
<sort_order>110</sort_order>
|
379 |
<show_in_default>1</show_in_default>
|
380 |
<show_in_website>1</show_in_website>
|
381 |
<show_in_store>0</show_in_store>
|
382 |
+
</last_logged_date>
|
383 |
+
<customer_group translate="label" module="connector">
|
384 |
<label>Customer Group</label>
|
385 |
<frontend_type>select</frontend_type>
|
386 |
+
<source_model>email_connector/adminhtml_source_datafields</source_model>
|
387 |
<sort_order>120</sort_order>
|
388 |
<show_in_default>1</show_in_default>
|
389 |
<show_in_website>1</show_in_website>
|
390 |
<show_in_store>0</show_in_store>
|
391 |
</customer_group>
|
392 |
+
<address_title translate="label" module="connector">
|
393 |
+
<label>Address</label>
|
394 |
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
395 |
<sort_order>130</sort_order>
|
396 |
<show_in_default>1</show_in_default>
|
397 |
<show_in_website>1</show_in_website>
|
398 |
<show_in_store>0</show_in_store>
|
399 |
</address_title>
|
400 |
+
<billing_address_1 translate="label" module="connector">
|
401 |
<label>Billing Address Line 1</label>
|
402 |
<frontend_type>select</frontend_type>
|
403 |
+
<source_model>email_connector/adminhtml_source_datafields</source_model>
|
404 |
<sort_order>140</sort_order>
|
405 |
<show_in_default>1</show_in_default>
|
406 |
<show_in_website>1</show_in_website>
|
407 |
<show_in_store>0</show_in_store>
|
408 |
</billing_address_1>
|
409 |
+
<billing_address_2 translate="label" module="connector">
|
410 |
<label>Billing Address Line 2</label>
|
411 |
<frontend_type>select</frontend_type>
|
412 |
+
<source_model>email_connector/adminhtml_source_datafields</source_model>
|
413 |
<sort_order>150</sort_order>
|
414 |
<show_in_default>1</show_in_default>
|
415 |
<show_in_website>1</show_in_website>
|
416 |
<show_in_store>0</show_in_store>
|
417 |
</billing_address_2>
|
418 |
+
<billing_city translate="label" module="connector">
|
419 |
<label>Billing City</label>
|
420 |
<frontend_type>select</frontend_type>
|
421 |
+
<source_model>email_connector/adminhtml_source_datafields</source_model>
|
422 |
<sort_order>160</sort_order>
|
423 |
<show_in_default>1</show_in_default>
|
424 |
<show_in_website>1</show_in_website>
|
425 |
<show_in_store>0</show_in_store>
|
426 |
</billing_city>
|
427 |
+
<billing_state translate="label" module="connector">
|
428 |
+
<label>Billing State/Region</label>
|
429 |
+
<frontend_type>select</frontend_type>
|
430 |
+
<source_model>email_connector/adminhtml_source_datafields</source_model>
|
431 |
+
<sort_order>155</sort_order>
|
432 |
+
<show_in_default>1</show_in_default>
|
433 |
+
<show_in_website>1</show_in_website>
|
434 |
+
<show_in_store>0</show_in_store>
|
435 |
+
</billing_state>
|
436 |
+
<billing_country translate="label" module="connector">
|
437 |
<label>Billing Country</label>
|
438 |
<frontend_type>select</frontend_type>
|
439 |
+
<source_model>email_connector/adminhtml_source_datafields</source_model>
|
440 |
<sort_order>170</sort_order>
|
441 |
<show_in_default>1</show_in_default>
|
442 |
<show_in_website>1</show_in_website>
|
443 |
<show_in_store>0</show_in_store>
|
444 |
</billing_country>
|
445 |
+
<billing_postcode translate="label" module="connector">
|
446 |
<label>Billing Zip/Postcode</label>
|
447 |
<frontend_type>select</frontend_type>
|
448 |
+
<source_model>email_connector/adminhtml_source_datafields</source_model>
|
449 |
<sort_order>180</sort_order>
|
450 |
<show_in_default>1</show_in_default>
|
451 |
<show_in_website>1</show_in_website>
|
452 |
<show_in_store>0</show_in_store>
|
453 |
</billing_postcode>
|
454 |
+
<billing_telephone translate="label" module="connector">
|
455 |
<label>Billing Telephone</label>
|
456 |
<frontend_type>select</frontend_type>
|
457 |
+
<source_model>email_connector/adminhtml_source_datafields</source_model>
|
458 |
<sort_order>190</sort_order>
|
459 |
<show_in_default>1</show_in_default>
|
460 |
<show_in_website>1</show_in_website>
|
461 |
<show_in_store>0</show_in_store>
|
462 |
</billing_telephone>
|
463 |
+
<delivery_address_1 translate="label" module="connector">
|
464 |
<label>Delivery Address Line 1</label>
|
465 |
<frontend_type>select</frontend_type>
|
466 |
+
<source_model>email_connector/adminhtml_source_datafields</source_model>
|
467 |
<sort_order>200</sort_order>
|
468 |
<show_in_default>1</show_in_default>
|
469 |
<show_in_website>1</show_in_website>
|
470 |
<show_in_store>0</show_in_store>
|
471 |
</delivery_address_1>
|
472 |
+
<delivery_address_2 translate="label" module="connector">
|
473 |
<label>Delivery Address Line 2</label>
|
474 |
<frontend_type>select</frontend_type>
|
475 |
+
<source_model>email_connector/adminhtml_source_datafields</source_model>
|
476 |
<sort_order>210</sort_order>
|
477 |
<show_in_default>1</show_in_default>
|
478 |
<show_in_website>1</show_in_website>
|
479 |
<show_in_store>0</show_in_store>
|
480 |
</delivery_address_2>
|
481 |
+
<delivery_city translate="label" module="connector">
|
482 |
<label>Delivery City</label>
|
483 |
<frontend_type>select</frontend_type>
|
484 |
+
<source_model>email_connector/adminhtml_source_datafields</source_model>
|
485 |
<sort_order>220</sort_order>
|
486 |
<show_in_default>1</show_in_default>
|
487 |
<show_in_website>1</show_in_website>
|
488 |
<show_in_store>0</show_in_store>
|
489 |
</delivery_city>
|
490 |
+
<delivery_state translate="label" module="connector">
|
491 |
+
<label>Delivery State/Region</label>
|
492 |
+
<frontend_type>select</frontend_type>
|
493 |
+
<source_model>email_connector/adminhtml_source_datafields</source_model>
|
494 |
+
<sort_order>215</sort_order>
|
495 |
+
<show_in_default>1</show_in_default>
|
496 |
+
<show_in_website>1</show_in_website>
|
497 |
+
<show_in_store>0</show_in_store>
|
498 |
+
</delivery_state>
|
499 |
+
<delivery_country translate="label" module="connector">
|
500 |
<label>Delivery Country</label>
|
501 |
<frontend_type>select</frontend_type>
|
502 |
+
<source_model>email_connector/adminhtml_source_datafields</source_model>
|
503 |
<sort_order>230</sort_order>
|
504 |
<show_in_default>1</show_in_default>
|
505 |
<show_in_website>1</show_in_website>
|
506 |
<show_in_store>0</show_in_store>
|
507 |
</delivery_country>
|
508 |
+
<delivery_postcode translate="label" module="connector">
|
509 |
<label>Delivery Zip/Postcode</label>
|
510 |
<frontend_type>select</frontend_type>
|
511 |
+
<source_model>email_connector/adminhtml_source_datafields</source_model>
|
512 |
<sort_order>240</sort_order>
|
513 |
<show_in_default>1</show_in_default>
|
514 |
<show_in_website>1</show_in_website>
|
515 |
<show_in_store>0</show_in_store>
|
516 |
</delivery_postcode>
|
517 |
+
<delivery_telephone translate="label" module="connector">
|
518 |
<label>Delivery Telephone</label>
|
519 |
<frontend_type>select</frontend_type>
|
520 |
+
<source_model>email_connector/adminhtml_source_datafields</source_model>
|
521 |
<sort_order>250</sort_order>
|
522 |
<show_in_default>1</show_in_default>
|
523 |
<show_in_website>1</show_in_website>
|
524 |
<show_in_store>0</show_in_store>
|
525 |
</delivery_telephone>
|
526 |
+
<sales_title translate="label" module="connector">
|
527 |
+
<label>Sales</label>
|
528 |
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
529 |
<sort_order>260</sort_order>
|
530 |
<show_in_default>1</show_in_default>
|
531 |
<show_in_website>1</show_in_website>
|
532 |
<show_in_store>0</show_in_store>
|
533 |
</sales_title>
|
534 |
+
<number_of_orders translate="label" module="connector">
|
535 |
<label>Total Number of Orders</label>
|
536 |
<frontend_type>select</frontend_type>
|
537 |
+
<source_model>email_connector/adminhtml_source_datafields</source_model>
|
538 |
<sort_order>270</sort_order>
|
539 |
<show_in_default>1</show_in_default>
|
540 |
<show_in_website>1</show_in_website>
|
541 |
<show_in_store>0</show_in_store>
|
542 |
+
</number_of_orders>
|
543 |
+
<average_order_value translate="label" module="connector">
|
544 |
<label>Average Order Value</label>
|
545 |
<frontend_type>select</frontend_type>
|
546 |
+
<source_model>email_connector/adminhtml_source_datafields</source_model>
|
547 |
<sort_order>280</sort_order>
|
548 |
<show_in_default>1</show_in_default>
|
549 |
<show_in_website>1</show_in_website>
|
550 |
<show_in_store>0</show_in_store>
|
551 |
</average_order_value>
|
552 |
+
<total_spend translate="label" module="connector">
|
553 |
<label>Total Spend</label>
|
554 |
<frontend_type>select</frontend_type>
|
555 |
+
<source_model>email_connector/adminhtml_source_datafields</source_model>
|
556 |
<sort_order>290</sort_order>
|
557 |
<show_in_default>1</show_in_default>
|
558 |
<show_in_website>1</show_in_website>
|
559 |
<show_in_store>0</show_in_store>
|
560 |
</total_spend>
|
561 |
+
<last_order_date translate="label" module="connector">
|
562 |
<label>Last Purchase Date</label>
|
563 |
<frontend_type>select</frontend_type>
|
564 |
+
<source_model>email_connector/adminhtml_source_datafields</source_model>
|
565 |
<sort_order>300</sort_order>
|
566 |
<show_in_default>1</show_in_default>
|
567 |
<show_in_website>1</show_in_website>
|
568 |
<show_in_store>0</show_in_store>
|
569 |
+
</last_order_date>
|
570 |
+
<last_order_id translate="label" module="connector">
|
571 |
+
<label>Last Order ID</label>
|
572 |
<frontend_type>select</frontend_type>
|
573 |
+
<source_model>email_connector/adminhtml_source_datafields</source_model>
|
574 |
<sort_order>310</sort_order>
|
575 |
<show_in_default>1</show_in_default>
|
576 |
<show_in_website>1</show_in_website>
|
577 |
<show_in_store>0</show_in_store>
|
578 |
+
</last_order_id>
|
579 |
+
<total_refund translate="label">
|
580 |
+
<label>Include Total Refund</label>
|
581 |
<frontend_type>select</frontend_type>
|
582 |
+
<source_model>email_connector/adminhtml_source_datafields</source_model>
|
583 |
+
<show_in_default>1</show_in_default>
|
584 |
+
<show_in_website>1</show_in_website>
|
585 |
+
<show_in_store>0</show_in_store>
|
586 |
<sort_order>320</sort_order>
|
587 |
+
<comment>Include total refunded ammount for customer sync.</comment>
|
588 |
+
</total_refund>
|
589 |
+
<custom_title translate="label" module="connector">
|
590 |
+
<label>Custom Attributes</label>
|
591 |
+
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
592 |
+
<sort_order>330</sort_order>
|
593 |
+
<show_in_default>1</show_in_default>
|
594 |
+
<show_in_website>1</show_in_website>
|
595 |
+
<show_in_store>0</show_in_store>
|
596 |
+
</custom_title>
|
597 |
+
<custom_attributes translate="label" module="connector">
|
598 |
+
<label>Customer</label>
|
599 |
+
<frontend_model>email_connector/adminhtml_config_customdatafields</frontend_model>
|
600 |
+
<backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
|
601 |
+
<source_model>email_connector/adminhtml_source_customer_attributes_select</source_model>
|
602 |
+
<sort_order>340</sort_order>
|
603 |
+
<show_in_default>1</show_in_default>
|
604 |
+
<show_in_website>1</show_in_website>
|
605 |
+
<show_in_store>0</show_in_store>
|
606 |
+
</custom_attributes>
|
607 |
+
<validator translate="label" module="connector">
|
608 |
+
<label>Validation Block</label>
|
609 |
+
<frontend_type>select</frontend_type>
|
610 |
+
<source_model>email_connector/adminhtml_source_datafields</source_model>
|
611 |
+
<frontend_model>email_connector/adminhtml_system_config_validator</frontend_model>
|
612 |
+
<sort_order>920</sort_order>
|
613 |
<show_in_default>1</show_in_default>
|
614 |
<show_in_website>1</show_in_website>
|
615 |
<show_in_store>0</show_in_store>
|
618 |
</validator>
|
619 |
</fields>
|
620 |
</customer_data>
|
621 |
+
<dynamic_datafield translate="label" module="connector">
|
622 |
+
<label>Create Data Field</label>
|
623 |
+
<sort_order>30</sort_order>
|
624 |
<show_in_default>1</show_in_default>
|
625 |
<show_in_website>1</show_in_website>
|
626 |
<show_in_store>0</show_in_store>
|
|
|
627 |
<fields>
|
628 |
+
<datafield_name module="connector">
|
629 |
+
<label>Data Field Name</label>
|
630 |
+
<frontend_type>text</frontend_type>
|
631 |
+
<frontend_model>email_connector/adminhtml_system_config_datafield</frontend_model>
|
632 |
<sort_order>10</sort_order>
|
633 |
<show_in_default>1</show_in_default>
|
634 |
<show_in_website>1</show_in_website>
|
635 |
<show_in_store>0</show_in_store>
|
636 |
+
</datafield_name>
|
637 |
+
<datafield_type translate="label" module="connector">
|
638 |
+
<label>Data Field Type</label>
|
639 |
<frontend_type>select</frontend_type>
|
640 |
+
<source_model>email_connector/adminhtml_source_datamapping_datafieldtype</source_model>
|
641 |
<sort_order>20</sort_order>
|
642 |
<show_in_default>1</show_in_default>
|
643 |
<show_in_website>1</show_in_website>
|
644 |
<show_in_store>0</show_in_store>
|
645 |
+
<expended>1</expended>
|
646 |
+
</datafield_type>
|
647 |
+
<datafield_button translate="label button_label" module="connector">
|
648 |
+
<label />
|
649 |
+
<button_label>Create New Data Field</button_label>
|
650 |
+
<frontend_model>email_connector/adminhtml_system_dynamic_datafieldbutton</frontend_model>
|
651 |
<sort_order>30</sort_order>
|
652 |
<show_in_default>1</show_in_default>
|
653 |
<show_in_website>1</show_in_website>
|
654 |
<show_in_store>0</show_in_store>
|
655 |
+
</datafield_button>
|
656 |
</fields>
|
657 |
+
</dynamic_datafield>
|
658 |
</groups>
|
659 |
+
</connector_data_mapping>
|
660 |
+
<connector_roi_tracking translate="label" module="connector">
|
661 |
<label><![CDATA[ROI & Tracking]]></label>
|
662 |
<tab>connector</tab>
|
663 |
<frontend_type>text</frontend_type>
|
666 |
<show_in_website>1</show_in_website>
|
667 |
<show_in_store>0</show_in_store>
|
668 |
<groups>
|
669 |
+
<page_tracking translate="label" module="connector">
|
670 |
<label>Page Tracking</label>
|
671 |
<frontend_type>text</frontend_type>
|
672 |
<sort_order>10</sort_order>
|
675 |
<show_in_store>0</show_in_store>
|
676 |
<expanded>1</expanded>
|
677 |
<fields>
|
678 |
+
<enabled translate="label" module="connector">
|
679 |
<label>Enabled</label>
|
680 |
<frontend_type>select</frontend_type>
|
681 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
686 |
</enabled>
|
687 |
</fields>
|
688 |
</page_tracking>
|
689 |
+
<roi_tracking translate="label" module="connector">
|
690 |
<label>ROI Tracking</label>
|
691 |
<frontend_type>text</frontend_type>
|
692 |
<sort_order>20</sort_order>
|
695 |
<show_in_store>0</show_in_store>
|
696 |
<expanded>1</expanded>
|
697 |
<fields>
|
698 |
+
<enabled translate="label" module="connector">
|
699 |
<label>Enabled</label>
|
700 |
<frontend_type>select</frontend_type>
|
701 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
707 |
</fields>
|
708 |
</roi_tracking>
|
709 |
</groups>
|
710 |
+
</connector_roi_tracking>
|
711 |
+
<connector_lost_baskets translate="label" module="connector">
|
712 |
<label><![CDATA[Lost Baskets]]></label>
|
713 |
<tab>connector</tab>
|
714 |
<frontend_type>text</frontend_type>
|
715 |
<sort_order>6000</sort_order>
|
716 |
<show_in_default>1</show_in_default>
|
717 |
<show_in_website>1</show_in_website>
|
718 |
+
<show_in_store>0</show_in_store>
|
719 |
<groups>
|
720 |
+
<customers translate="label" module="connector">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
721 |
<label>Customers</label>
|
722 |
<frontend_type>text</frontend_type>
|
723 |
<sort_order>10</sort_order>
|
726 |
<show_in_store>1</show_in_store>
|
727 |
<expanded>1</expanded>
|
728 |
<fields>
|
729 |
+
<heading_1 translate="label" module="connector">
|
730 |
+
<label>Lost Basket 1</label>
|
731 |
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
732 |
<sort_order>10</sort_order>
|
733 |
<show_in_default>1</show_in_default>
|
734 |
<show_in_website>1</show_in_website>
|
735 |
<show_in_store>1</show_in_store>
|
736 |
</heading_1>
|
737 |
+
<enabled_1 translate="label" module="connector">
|
738 |
<label>Enabled/Disabled</label>
|
739 |
<frontend_type>select</frontend_type>
|
|
|
740 |
<source_model>adminhtml/system_config_source_enabledisable</source_model>
|
741 |
<sort_order>20</sort_order>
|
742 |
<show_in_default>1</show_in_default>
|
743 |
<show_in_website>1</show_in_website>
|
744 |
<show_in_store>1</show_in_store>
|
745 |
</enabled_1>
|
746 |
+
<send_after_1 translate="label" module="connector">
|
747 |
+
<label>Send After (min)</label>
|
748 |
<frontend_type>select</frontend_type>
|
749 |
+
<source_model>email_connector/adminhtml_source_lostbaskets_intervalminute</source_model>
|
750 |
<sort_order>30</sort_order>
|
751 |
<show_in_default>1</show_in_default>
|
752 |
<show_in_website>1</show_in_website>
|
753 |
<show_in_store>1</show_in_store>
|
754 |
</send_after_1>
|
755 |
+
<campaign_1 translate="label" module="connector">
|
756 |
<label>Campaign To Send</label>
|
757 |
<frontend_type>select</frontend_type>
|
758 |
+
<source_model>email_connector/adminhtml_source_campaigns</source_model>
|
759 |
<sort_order>40</sort_order>
|
760 |
<show_in_default>1</show_in_default>
|
761 |
<show_in_website>1</show_in_website>
|
762 |
<show_in_store>1</show_in_store>
|
763 |
</campaign_1>
|
764 |
+
<heading_2 translate="label" module="connector">
|
765 |
+
<label>Lost Basket 2</label>
|
766 |
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
767 |
<sort_order>50</sort_order>
|
768 |
<show_in_default>1</show_in_default>
|
769 |
<show_in_website>1</show_in_website>
|
770 |
<show_in_store>1</show_in_store>
|
771 |
</heading_2>
|
772 |
+
<enabled_2 translate="label" module="connector">
|
773 |
<label>Enabled/Disabled</label>
|
774 |
<frontend_type>select</frontend_type>
|
|
|
775 |
<source_model>adminhtml/system_config_source_enabledisable</source_model>
|
776 |
<sort_order>60</sort_order>
|
777 |
<show_in_default>1</show_in_default>
|
778 |
<show_in_website>1</show_in_website>
|
779 |
<show_in_store>1</show_in_store>
|
780 |
</enabled_2>
|
781 |
+
<send_after_2 translate="label" module="connector">
|
782 |
+
<label>Send After (hrs)</label>
|
783 |
<frontend_type>select</frontend_type>
|
784 |
+
<source_model>email_connector/adminhtml_source_lostbaskets_interval</source_model>
|
785 |
<sort_order>70</sort_order>
|
786 |
<show_in_default>1</show_in_default>
|
787 |
<show_in_website>1</show_in_website>
|
788 |
<show_in_store>1</show_in_store>
|
789 |
</send_after_2>
|
790 |
+
<campaign_2 translate="label" module="connector">
|
791 |
+
<label>Campaign To Send</label>
|
792 |
<frontend_type>select</frontend_type>
|
793 |
+
<source_model>email_connector/adminhtml_source_campaigns</source_model>
|
794 |
<sort_order>80</sort_order>
|
795 |
<show_in_default>1</show_in_default>
|
796 |
<show_in_website>1</show_in_website>
|
797 |
<show_in_store>1</show_in_store>
|
798 |
</campaign_2>
|
799 |
+
<heading_3 translate="label" module="connector">
|
800 |
+
<label>Lost Basket 3</label>
|
801 |
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
802 |
<sort_order>90</sort_order>
|
803 |
<show_in_default>1</show_in_default>
|
804 |
<show_in_website>1</show_in_website>
|
805 |
<show_in_store>1</show_in_store>
|
806 |
</heading_3>
|
807 |
+
<enabled_3 translate="label" module="connector">
|
808 |
<label>Enabled/Disabled</label>
|
809 |
<frontend_type>select</frontend_type>
|
|
|
810 |
<source_model>adminhtml/system_config_source_enabledisable</source_model>
|
811 |
<sort_order>100</sort_order>
|
812 |
<show_in_default>1</show_in_default>
|
813 |
<show_in_website>1</show_in_website>
|
814 |
<show_in_store>1</show_in_store>
|
815 |
</enabled_3>
|
816 |
+
<send_after_3 translate="label" module="connector">
|
817 |
+
<label>Send After (hrs)</label>
|
818 |
<frontend_type>select</frontend_type>
|
819 |
+
<source_model>email_connector/adminhtml_source_lostbaskets_interval</source_model>
|
820 |
<sort_order>110</sort_order>
|
821 |
<show_in_default>1</show_in_default>
|
822 |
<show_in_website>1</show_in_website>
|
823 |
<show_in_store>1</show_in_store>
|
824 |
</send_after_3>
|
825 |
+
<campaign_3 translate="label" module="connector">
|
826 |
+
<label>Campaign To Send</label>
|
827 |
<frontend_type>select</frontend_type>
|
828 |
+
<source_model>email_connector/adminhtml_source_campaigns</source_model>
|
829 |
<sort_order>120</sort_order>
|
830 |
<show_in_default>1</show_in_default>
|
831 |
<show_in_website>1</show_in_website>
|
833 |
</campaign_3>
|
834 |
</fields>
|
835 |
</customers>
|
836 |
+
<guests translate="label" module="connector">
|
837 |
<label>Guests</label>
|
838 |
<frontend_type>text</frontend_type>
|
839 |
<sort_order>20</sort_order>
|
840 |
<show_in_default>1</show_in_default>
|
841 |
<show_in_website>1</show_in_website>
|
842 |
+
<show_in_store>0</show_in_store>
|
843 |
<fields>
|
844 |
+
<heading_1 translate="label" module="connector">
|
845 |
+
<label>Lost Basket 1</label>
|
846 |
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
847 |
<sort_order>10</sort_order>
|
848 |
<show_in_default>1</show_in_default>
|
849 |
<show_in_website>1</show_in_website>
|
850 |
+
<show_in_store>0</show_in_store>
|
851 |
</heading_1>
|
852 |
+
<enabled_1 translate="label" module="connector">
|
853 |
<label>Enabled/Disabled</label>
|
854 |
<frontend_type>select</frontend_type>
|
|
|
855 |
<source_model>adminhtml/system_config_source_enabledisable</source_model>
|
856 |
<sort_order>20</sort_order>
|
857 |
<show_in_default>1</show_in_default>
|
858 |
<show_in_website>1</show_in_website>
|
859 |
+
<show_in_store>0</show_in_store>
|
860 |
</enabled_1>
|
861 |
+
<send_after_1 translate="label" module="connector">
|
862 |
+
<label>Send After (min)</label>
|
863 |
<frontend_type>select</frontend_type>
|
864 |
+
<source_model>email_connector/adminhtml_source_lostbaskets_intervalminute</source_model>
|
865 |
<sort_order>30</sort_order>
|
866 |
<show_in_default>1</show_in_default>
|
867 |
<show_in_website>1</show_in_website>
|
868 |
+
<show_in_store>0</show_in_store>
|
869 |
</send_after_1>
|
870 |
+
<campaign_1 translate="label" module="connector">
|
871 |
<label>Campaign To Send</label>
|
872 |
<frontend_type>select</frontend_type>
|
873 |
+
<source_model>email_connector/adminhtml_source_campaigns</source_model>
|
874 |
<sort_order>40</sort_order>
|
875 |
<show_in_default>1</show_in_default>
|
876 |
<show_in_website>1</show_in_website>
|
877 |
+
<show_in_store>0</show_in_store>
|
878 |
</campaign_1>
|
879 |
+
<heading_2 translate="label" module="connector">
|
880 |
+
<label>Lost Basket 2</label>
|
|
|
881 |
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
882 |
<sort_order>50</sort_order>
|
883 |
<show_in_default>1</show_in_default>
|
884 |
<show_in_website>1</show_in_website>
|
885 |
+
<show_in_store>0</show_in_store>
|
886 |
</heading_2>
|
887 |
+
<enabled_2 translate="label" module="connector">
|
888 |
<label>Enabled/Disabled</label>
|
889 |
<frontend_type>select</frontend_type>
|
|
|
890 |
<source_model>adminhtml/system_config_source_enabledisable</source_model>
|
891 |
<sort_order>60</sort_order>
|
892 |
<show_in_default>1</show_in_default>
|
893 |
<show_in_website>1</show_in_website>
|
894 |
+
<show_in_store>0</show_in_store>
|
895 |
</enabled_2>
|
896 |
+
<send_after_2 translate="label" module="connector">
|
897 |
+
<label>Send After (hrs)</label>
|
898 |
<frontend_type>select</frontend_type>
|
899 |
+
<source_model>email_connector/adminhtml_source_lostbaskets_interval</source_model>
|
900 |
<sort_order>70</sort_order>
|
901 |
<show_in_default>1</show_in_default>
|
902 |
<show_in_website>1</show_in_website>
|
903 |
+
<show_in_store>0</show_in_store>
|
904 |
</send_after_2>
|
905 |
+
<campaign_2 translate="label" module="connector">
|
906 |
+
<label>Campaign To Send</label>
|
907 |
<frontend_type>select</frontend_type>
|
908 |
+
<source_model>email_connector/adminhtml_source_campaigns</source_model>
|
909 |
<sort_order>80</sort_order>
|
910 |
<show_in_default>1</show_in_default>
|
911 |
<show_in_website>1</show_in_website>
|
912 |
+
<show_in_store>0</show_in_store>
|
913 |
</campaign_2>
|
914 |
+
<heading_3 translate="label" module="connector">
|
915 |
+
<label>Lost Basket 3</label>
|
|
|
916 |
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
917 |
<sort_order>90</sort_order>
|
918 |
<show_in_default>1</show_in_default>
|
919 |
<show_in_website>1</show_in_website>
|
920 |
+
<show_in_store>0</show_in_store>
|
921 |
</heading_3>
|
922 |
+
<enabled_3 translate="label" module="connector">
|
923 |
<label>Enabled/Disabled</label>
|
924 |
<frontend_type>select</frontend_type>
|
|
|
925 |
<source_model>adminhtml/system_config_source_enabledisable</source_model>
|
926 |
<sort_order>100</sort_order>
|
927 |
<show_in_default>1</show_in_default>
|
928 |
<show_in_website>1</show_in_website>
|
929 |
+
<show_in_store>0</show_in_store>
|
930 |
</enabled_3>
|
931 |
+
<send_after_3 translate="label" module="connector">
|
932 |
+
<label>Send After (hrs)</label>
|
933 |
<frontend_type>select</frontend_type>
|
934 |
+
<source_model>email_connector/adminhtml_source_lostbaskets_interval</source_model>
|
935 |
<sort_order>110</sort_order>
|
936 |
<show_in_default>1</show_in_default>
|
937 |
<show_in_website>1</show_in_website>
|
938 |
+
<show_in_store>0</show_in_store>
|
939 |
</send_after_3>
|
940 |
+
<campaign_3 translate="label" module="connector">
|
941 |
+
<label>Campaign To Send</label>
|
942 |
<frontend_type>select</frontend_type>
|
943 |
+
<source_model>email_connector/adminhtml_source_campaigns</source_model>
|
944 |
<sort_order>120</sort_order>
|
945 |
<show_in_default>1</show_in_default>
|
946 |
<show_in_website>1</show_in_website>
|
947 |
+
<show_in_store>0</show_in_store>
|
948 |
</campaign_3>
|
949 |
</fields>
|
950 |
</guests>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
951 |
</groups>
|
952 |
+
</connector_lost_baskets>
|
953 |
+
<connector_sms translate="label" module="connector">
|
954 |
<label><![CDATA[SMS]]></label>
|
955 |
<tab>connector</tab>
|
956 |
<frontend_type>text</frontend_type>
|
959 |
<show_in_website>1</show_in_website>
|
960 |
<show_in_store>1</show_in_store>
|
961 |
<groups>
|
962 |
+
<sms_one translate="label" module="connector">
|
963 |
<label>SMS Message 1</label>
|
964 |
<frontend_type>text</frontend_type>
|
965 |
<sort_order>10</sort_order>
|
967 |
<show_in_website>1</show_in_website>
|
968 |
<show_in_store>1</show_in_store>
|
969 |
<fields>
|
970 |
+
<enabled translate="label" module="connector">
|
971 |
<label>Enabled</label>
|
972 |
<frontend_type>select</frontend_type>
|
973 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
976 |
<show_in_website>1</show_in_website>
|
977 |
<show_in_store>1</show_in_store>
|
978 |
</enabled>
|
979 |
+
<status translate="label" module="connector">
|
980 |
<label>Order Status</label>
|
981 |
<sort_order>20</sort_order>
|
982 |
<frontend_type>select</frontend_type>
|
983 |
+
<source_model>adminhtml/system_config_source_order_status</source_model>
|
984 |
<show_in_default>1</show_in_default>
|
985 |
<show_in_website>1</show_in_website>
|
986 |
<show_in_store>1</show_in_store>
|
987 |
+
</status>
|
988 |
+
<message translate="label" module="connector">
|
989 |
<label>Message</label>
|
990 |
<frontend_type>textarea</frontend_type>
|
991 |
+
<frontend_model>email_connector/adminhtml_system_sms_smsmessageone</frontend_model>
|
992 |
<sort_order>30</sort_order>
|
993 |
<show_in_default>1</show_in_default>
|
994 |
<show_in_website>1</show_in_website>
|
995 |
<show_in_store>1</show_in_store>
|
996 |
+
<validate>validate-length maximum-length-160</validate>
|
997 |
</message>
|
998 |
</fields>
|
999 |
+
</sms_one>
|
1000 |
+
<sms_two translate="label" module="connector">
|
|
|
1001 |
<label>SMS Message 2</label>
|
1002 |
<frontend_type>text</frontend_type>
|
1003 |
<sort_order>20</sort_order>
|
1005 |
<show_in_website>1</show_in_website>
|
1006 |
<show_in_store>1</show_in_store>
|
1007 |
<fields>
|
1008 |
+
<enabled translate="label" module="connector">
|
1009 |
<label>Enabled</label>
|
1010 |
<frontend_type>select</frontend_type>
|
1011 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
1014 |
<show_in_website>1</show_in_website>
|
1015 |
<show_in_store>1</show_in_store>
|
1016 |
</enabled>
|
1017 |
+
<status translate="label" module="connector">
|
1018 |
<label>Order Status</label>
|
1019 |
<sort_order>20</sort_order>
|
1020 |
<frontend_type>select</frontend_type>
|
1021 |
+
<source_model>adminhtml/system_config_source_order_status</source_model>
|
1022 |
<show_in_default>1</show_in_default>
|
1023 |
<show_in_website>1</show_in_website>
|
1024 |
<show_in_store>1</show_in_store>
|
1025 |
+
</status>
|
1026 |
+
<message translate="label" module="connector">
|
1027 |
<label>Message</label>
|
1028 |
<frontend_type>textarea</frontend_type>
|
1029 |
+
<frontend_model>email_connector/adminhtml_system_sms_smsmessagetwo</frontend_model>
|
1030 |
<sort_order>30</sort_order>
|
1031 |
<show_in_default>1</show_in_default>
|
1032 |
<show_in_website>1</show_in_website>
|
1033 |
<show_in_store>1</show_in_store>
|
1034 |
+
<validate>validate-length maximum-length-160</validate>
|
1035 |
</message>
|
1036 |
</fields>
|
1037 |
+
</sms_two>
|
1038 |
+
<sms_three translate="label" module="connector">
|
|
|
1039 |
<label>SMS Message 3</label>
|
1040 |
<frontend_type>text</frontend_type>
|
1041 |
<sort_order>30</sort_order>
|
1043 |
<show_in_website>1</show_in_website>
|
1044 |
<show_in_store>1</show_in_store>
|
1045 |
<fields>
|
1046 |
+
<enabled translate="label" module="connector">
|
1047 |
<label>Enabled</label>
|
1048 |
<frontend_type>select</frontend_type>
|
1049 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
1052 |
<show_in_website>1</show_in_website>
|
1053 |
<show_in_store>1</show_in_store>
|
1054 |
</enabled>
|
1055 |
+
<status translate="label" module="connector">
|
1056 |
<label>Order Status</label>
|
1057 |
<sort_order>20</sort_order>
|
1058 |
<frontend_type>select</frontend_type>
|
1059 |
+
<source_model>adminhtml/system_config_source_order_status</source_model>
|
1060 |
<show_in_default>1</show_in_default>
|
1061 |
<show_in_website>1</show_in_website>
|
1062 |
<show_in_store>1</show_in_store>
|
1063 |
+
</status>
|
1064 |
+
<message translate="label" module="connector">
|
1065 |
<label>Message</label>
|
1066 |
<frontend_type>textarea</frontend_type>
|
1067 |
+
<frontend_model>email_connector/adminhtml_system_sms_smsmessagethree</frontend_model>
|
1068 |
<sort_order>30</sort_order>
|
1069 |
<show_in_default>1</show_in_default>
|
1070 |
<show_in_website>1</show_in_website>
|
1071 |
<show_in_store>1</show_in_store>
|
1072 |
+
<validate>validate-length maximum-length-160</validate>
|
1073 |
</message>
|
1074 |
</fields>
|
1075 |
+
</sms_three>
|
1076 |
+
<sms_four translate="label" module="connector">
|
1077 |
<label>SMS Message 4</label>
|
1078 |
<frontend_type>text</frontend_type>
|
1079 |
<sort_order>40</sort_order>
|
1081 |
<show_in_website>1</show_in_website>
|
1082 |
<show_in_store>1</show_in_store>
|
1083 |
<fields>
|
1084 |
+
<enabled translate="label" module="connector">
|
1085 |
<label>Enabled</label>
|
1086 |
<frontend_type>select</frontend_type>
|
1087 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
1090 |
<show_in_website>1</show_in_website>
|
1091 |
<show_in_store>1</show_in_store>
|
1092 |
</enabled>
|
1093 |
+
<status translate="label" module="connector">
|
1094 |
<label>Order Status</label>
|
1095 |
<sort_order>20</sort_order>
|
1096 |
<frontend_type>select</frontend_type>
|
1097 |
+
<source_model>adminhtml/system_config_source_order_status</source_model>
|
1098 |
<show_in_default>1</show_in_default>
|
1099 |
<show_in_website>1</show_in_website>
|
1100 |
<show_in_store>1</show_in_store>
|
1101 |
+
</status>
|
1102 |
+
<message translate="label" module="connector">
|
1103 |
<label>Message</label>
|
1104 |
<frontend_type>textarea</frontend_type>
|
1105 |
+
<frontend_model>email_connector/adminhtml_system_sms_smsmessagefour</frontend_model>
|
1106 |
<sort_order>30</sort_order>
|
1107 |
<show_in_default>1</show_in_default>
|
1108 |
<show_in_website>1</show_in_website>
|
1109 |
<show_in_store>1</show_in_store>
|
1110 |
+
<validate>validate-length maximum-length-160</validate>
|
1111 |
</message>
|
1112 |
</fields>
|
1113 |
+
</sms_four>
|
|
|
1114 |
</groups>
|
1115 |
+
</connector_sms>
|
1116 |
+
<connector_dynamic_content translate="label" module="connector">
|
1117 |
<label><![CDATA[Dynamic Content]]></label>
|
1118 |
<tab>connector</tab>
|
1119 |
<frontend_type>text</frontend_type>
|
1122 |
<show_in_website>1</show_in_website>
|
1123 |
<show_in_store>0</show_in_store>
|
1124 |
<groups>
|
1125 |
+
<products translate="label" module="connector">
|
1126 |
<label>Dynamic Products</label>
|
1127 |
<frontend_type>text</frontend_type>
|
1128 |
+
<sort_order>20</sort_order>
|
1129 |
<show_in_default>1</show_in_default>
|
1130 |
<show_in_website>1</show_in_website>
|
1131 |
<show_in_store>0</show_in_store>
|
|
|
1132 |
<fields>
|
1133 |
+
<related translate="label" module="connector">
|
1134 |
<label>Related Products</label>
|
1135 |
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
1136 |
<sort_order>10</sort_order>
|
1138 |
<show_in_website>1</show_in_website>
|
1139 |
<show_in_store>0</show_in_store>
|
1140 |
</related>
|
1141 |
+
<related_display_type translate="label" module="connector">
|
1142 |
<label>Display Type</label>
|
1143 |
<frontend_type>select</frontend_type>
|
1144 |
+
<source_model>email_connector/adminhtml_source_dynamic_displaytype</source_model>
|
1145 |
<sort_order>20</sort_order>
|
1146 |
<show_in_default>1</show_in_default>
|
1147 |
<show_in_website>1</show_in_website>
|
1148 |
<show_in_store>0</show_in_store>
|
1149 |
</related_display_type>
|
1150 |
+
<related_items_to_display translate="label" module="connector">
|
1151 |
<label>Items To Display</label>
|
1152 |
<frontend_type>select</frontend_type>
|
1153 |
+
<source_model>email_connector/adminhtml_source_dynamic_gridview</source_model>
|
1154 |
<sort_order>30</sort_order>
|
1155 |
<show_in_website>1</show_in_website>
|
1156 |
<show_in_default>1</show_in_default>
|
1157 |
<show_in_store>0</show_in_store>
|
1158 |
</related_items_to_display>
|
1159 |
+
<upsell translate="label" module="connector">
|
|
|
1160 |
<label>Up Sell Products</label>
|
1161 |
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
1162 |
<sort_order>40</sort_order>
|
1164 |
<show_in_website>1</show_in_website>
|
1165 |
<show_in_store>0</show_in_store>
|
1166 |
</upsell>
|
1167 |
+
<upsell_display_type translate="label" module="connector">
|
1168 |
<label>Display Type</label>
|
1169 |
<frontend_type>select</frontend_type>
|
1170 |
+
<source_model>email_connector/adminhtml_source_dynamic_displaytype</source_model>
|
1171 |
<sort_order>50</sort_order>
|
1172 |
<show_in_default>1</show_in_default>
|
1173 |
<show_in_website>1</show_in_website>
|
1174 |
<show_in_store>0</show_in_store>
|
1175 |
</upsell_display_type>
|
1176 |
+
<upsell_items_to_display translate="label" module="connector">
|
1177 |
<label>Items To Display</label>
|
1178 |
<frontend_type>select</frontend_type>
|
1179 |
+
<source_model>email_connector/adminhtml_source_dynamic_gridview</source_model>
|
1180 |
<sort_order>60</sort_order>
|
1181 |
<show_in_website>1</show_in_website>
|
1182 |
<show_in_default>1</show_in_default>
|
1183 |
<show_in_store>0</show_in_store>
|
1184 |
</upsell_items_to_display>
|
1185 |
+
<crosssell translate="label" module="connector">
|
|
|
1186 |
<label>Cross Sell Products</label>
|
1187 |
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
1188 |
<sort_order>70</sort_order>
|
1190 |
<show_in_website>1</show_in_website>
|
1191 |
<show_in_store>0</show_in_store>
|
1192 |
</crosssell>
|
1193 |
+
<crosssell_display_type translate="label" module="connector">
|
1194 |
<label>Display Type</label>
|
1195 |
<frontend_type>select</frontend_type>
|
1196 |
+
<source_model>email_connector/adminhtml_source_dynamic_displaytype</source_model>
|
1197 |
<sort_order>80</sort_order>
|
1198 |
<show_in_default>1</show_in_default>
|
1199 |
<show_in_website>1</show_in_website>
|
1200 |
<show_in_store>0</show_in_store>
|
1201 |
</crosssell_display_type>
|
1202 |
+
<crosssell_items_to_display translate="label" module="connector">
|
1203 |
<label>Items To Display</label>
|
1204 |
<frontend_type>select</frontend_type>
|
1205 |
+
<source_model>email_connector/adminhtml_source_dynamic_gridview</source_model>
|
1206 |
<sort_order>90</sort_order>
|
1207 |
<show_in_website>1</show_in_website>
|
1208 |
<show_in_default>1</show_in_default>
|
1209 |
<show_in_store>0</show_in_store>
|
1210 |
</crosssell_items_to_display>
|
1211 |
+
<bestsellers translate="label" module="connector">
|
|
|
1212 |
<label>Best Sellers</label>
|
1213 |
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
1214 |
<sort_order>100</sort_order>
|
1215 |
<show_in_default>1</show_in_default>
|
1216 |
<show_in_website>1</show_in_website>
|
1217 |
<show_in_store>0</show_in_store>
|
1218 |
+
</bestsellers>
|
1219 |
+
<bestsellers_display_type translate="label" module="connector">
|
1220 |
<label>Display Type</label>
|
1221 |
<frontend_type>select</frontend_type>
|
1222 |
+
<source_model>email_connector/adminhtml_source_dynamic_displaytype</source_model>
|
1223 |
<sort_order>110</sort_order>
|
1224 |
<show_in_default>1</show_in_default>
|
1225 |
<show_in_website>1</show_in_website>
|
1226 |
<show_in_store>0</show_in_store>
|
1227 |
+
</bestsellers_display_type>
|
1228 |
+
<bestsellers_items_to_display translate="label" module="connector">
|
1229 |
<label>Items To Display</label>
|
1230 |
<frontend_type>select</frontend_type>
|
1231 |
+
<source_model>email_connector/adminhtml_source_dynamic_gridview</source_model>
|
1232 |
<sort_order>120</sort_order>
|
1233 |
<show_in_website>1</show_in_website>
|
1234 |
<show_in_default>1</show_in_default>
|
1235 |
<show_in_store>0</show_in_store>
|
1236 |
+
</bestsellers_items_to_display>
|
1237 |
+
<bestsellers_time_period translate="label" module="connector">
|
1238 |
<label>Time Period</label>
|
1239 |
<frontend_type>select</frontend_type>
|
1240 |
+
<source_model>adminhtml/system_config_source_cron_frequency</source_model>
|
1241 |
<sort_order>130</sort_order>
|
1242 |
<show_in_default>1</show_in_default>
|
1243 |
<show_in_website>1</show_in_website>
|
1244 |
<show_in_store>0</show_in_store>
|
1245 |
+
</bestsellers_time_period>
|
1246 |
+
<most_viewed translate="label" module="connector">
|
|
|
1247 |
<label>Most Viewed</label>
|
1248 |
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
1249 |
<sort_order>140</sort_order>
|
1251 |
<show_in_website>1</show_in_website>
|
1252 |
<show_in_store>0</show_in_store>
|
1253 |
</most_viewed>
|
1254 |
+
<most_viewed_display_type translate="label" module="connector">
|
1255 |
<label>Display Type</label>
|
1256 |
<frontend_type>select</frontend_type>
|
1257 |
+
<source_model>email_connector/adminhtml_source_dynamic_displaytype</source_model>
|
1258 |
<sort_order>150</sort_order>
|
1259 |
<show_in_default>1</show_in_default>
|
1260 |
<show_in_website>1</show_in_website>
|
1261 |
<show_in_store>0</show_in_store>
|
1262 |
</most_viewed_display_type>
|
1263 |
+
<most_viewed_items_to_display translate="label" module="connector">
|
1264 |
<label>Items To Display</label>
|
1265 |
<frontend_type>select</frontend_type>
|
1266 |
+
<source_model>email_connector/adminhtml_source_dynamic_gridview</source_model>
|
1267 |
<sort_order>160</sort_order>
|
1268 |
<show_in_website>1</show_in_website>
|
1269 |
<show_in_default>1</show_in_default>
|
1270 |
<show_in_store>0</show_in_store>
|
1271 |
</most_viewed_items_to_display>
|
1272 |
+
<most_viewed_time_period translate="label" module="connector">
|
1273 |
<label>Time Period</label>
|
1274 |
<frontend_type>select</frontend_type>
|
1275 |
+
<source_model>adminhtml/system_config_source_cron_frequency</source_model>
|
1276 |
<sort_order>170</sort_order>
|
1277 |
<show_in_default>1</show_in_default>
|
1278 |
<show_in_website>1</show_in_website>
|
1279 |
<show_in_store>0</show_in_store>
|
1280 |
</most_viewed_time_period>
|
1281 |
+
<recently_viewed translate="label" module="connector">
|
|
|
1282 |
<label>Recently Viewed</label>
|
1283 |
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
1284 |
<sort_order>180</sort_order>
|
1286 |
<show_in_website>1</show_in_website>
|
1287 |
<show_in_store>0</show_in_store>
|
1288 |
</recently_viewed>
|
1289 |
+
<recently_viewed_display_type translate="label" module="connector">
|
1290 |
<label>Display Type</label>
|
1291 |
<frontend_type>select</frontend_type>
|
1292 |
+
<source_model>email_connector/adminhtml_source_dynamic_displaytype</source_model>
|
1293 |
<sort_order>190</sort_order>
|
1294 |
<show_in_default>1</show_in_default>
|
1295 |
<show_in_website>1</show_in_website>
|
1296 |
<show_in_store>0</show_in_store>
|
1297 |
</recently_viewed_display_type>
|
1298 |
+
<recently_viewed_items_to_display translate="label" module="connector">
|
1299 |
<label>items To Display</label>
|
1300 |
<frontend_type>select</frontend_type>
|
1301 |
+
<source_model>email_connector/adminhtml_source_dynamic_gridview</source_model>
|
1302 |
<sort_order>200</sort_order>
|
1303 |
<show_in_default>1</show_in_default>
|
1304 |
<show_in_website>1</show_in_website>
|
1305 |
<show_in_store>0</show_in_store>
|
1306 |
</recently_viewed_items_to_display>
|
|
|
1307 |
<validator>
|
|
|
1308 |
<frontend_type>hidden</frontend_type>
|
1309 |
+
<frontend_model>email_connector/adminhtml_system_dynamic_gridlist</frontend_model>
|
1310 |
<sort_order>210</sort_order>
|
1311 |
<show_in_default>1</show_in_default>
|
1312 |
<show_in_website>1</show_in_website>
|
1314 |
<can_be_empty>1</can_be_empty>
|
1315 |
</validator>
|
1316 |
</fields>
|
|
|
1317 |
</products>
|
1318 |
+
<external_dynamic_content_urls translate="label" module="connector">
|
1319 |
+
<label><![CDATA[External Dynamic Content URL's]]></label>
|
1320 |
<frontend_type>text</frontend_type>
|
1321 |
+
<sort_order>10</sort_order>
|
1322 |
<show_in_default>1</show_in_default>
|
1323 |
<show_in_website>1</show_in_website>
|
1324 |
<show_in_store>0</show_in_store>
|
|
|
1325 |
<fields>
|
1326 |
+
<passcode translate="label comment" module="connector">
|
1327 |
+
<label>Passcode</label>
|
1328 |
+
<frontend_type>text</frontend_type>
|
1329 |
<sort_order>10</sort_order>
|
1330 |
<show_in_default>1</show_in_default>
|
1331 |
<show_in_website>1</show_in_website>
|
1332 |
<show_in_store>0</show_in_store>
|
1333 |
+
<comment><![CDATA[Recommended: Set a passcode so that basket contents and coupon codes can only be viewed if the following passcode is sent with the request.]]></comment>
|
1334 |
+
</passcode>
|
1335 |
+
<lost_basket_title translate="label" module="connector">
|
1336 |
+
<label>Lost Baskets</label>
|
1337 |
+
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
1338 |
+
<sort_order>20</sort_order>
|
1339 |
<show_in_default>1</show_in_default>
|
1340 |
<show_in_website>1</show_in_website>
|
1341 |
<show_in_store>0</show_in_store>
|
1342 |
+
</lost_basket_title>
|
1343 |
+
<lost_basket_url translate="label" module="connector">
|
1344 |
+
<label>Baskets Content URL</label>
|
1345 |
+
<frontend_type>label</frontend_type>
|
1346 |
+
<frontend_model>email_connector/adminhtml_system_dynamic_lostbasket</frontend_model>
|
1347 |
+
<sort_order>30</sort_order>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1348 |
<show_in_default>1</show_in_default>
|
1349 |
<show_in_website>1</show_in_website>
|
1350 |
<show_in_store>0</show_in_store>
|
1351 |
+
</lost_basket_url>
|
1352 |
+
<coupon_code_title title="label" module="connector">
|
1353 |
+
<label>Coupon Codes</label>
|
1354 |
+
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
1355 |
+
<sort_order>40</sort_order>
|
1356 |
+
<show_in_website>1</show_in_website>
|
1357 |
+
<show_in_default>1</show_in_default>
|
1358 |
+
<show_in_store>0</show_in_store>
|
1359 |
+
</coupon_code_title>
|
1360 |
+
<coupon_code_url translate="label" module="connector">
|
1361 |
+
<label>Coupon Codes URL</label>
|
1362 |
+
<frontend_type>label</frontend_type>
|
1363 |
+
<frontend_model>email_connector/adminhtml_system_dynamic_couponinfo</frontend_model>
|
1364 |
+
<sort_order>50</sort_order>
|
1365 |
+
<show_in_default>1</show_in_default>
|
1366 |
+
<show_in_website>1</show_in_website>
|
1367 |
+
<show_in_store>0</show_in_store>
|
1368 |
+
</coupon_code_url>
|
1369 |
+
<dynamic_content_url translate="label" module="connector">
|
1370 |
+
<label>Product Recommendation</label>
|
1371 |
+
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
1372 |
+
<sort_order>60</sort_order>
|
1373 |
+
<show_in_default>1</show_in_default>
|
1374 |
+
<show_in_website>1</show_in_website>
|
1375 |
+
<show_in_store>0</show_in_store>
|
1376 |
+
</dynamic_content_url>
|
1377 |
+
<related_products_url translate="label" module="connector">
|
1378 |
+
<label>Related Products URL</label>
|
1379 |
+
<frontend_type>label</frontend_type>
|
1380 |
+
<frontend_model>email_connector/adminhtml_system_dynamic_related</frontend_model>
|
1381 |
+
<sort_order>70</sort_order>
|
1382 |
+
<show_in_default>1</show_in_default>
|
1383 |
+
<show_in_website>1</show_in_website>
|
1384 |
+
<show_in_store>0</show_in_store>
|
1385 |
+
</related_products_url>
|
1386 |
+
<upsell_products_url translate="label" module="connector">
|
1387 |
+
<label>Up-Sell Products URL</label>
|
1388 |
+
<frontend_type>label</frontend_type>
|
1389 |
+
<frontend_model>email_connector/adminhtml_system_dynamic_upsell</frontend_model>
|
1390 |
+
<sort_order>80</sort_order>
|
1391 |
+
<show_in_default>1</show_in_default>
|
1392 |
+
<show_in_website>1</show_in_website>
|
1393 |
+
<show_in_store>0</show_in_store>
|
1394 |
+
</upsell_products_url>
|
1395 |
+
<crosssell_products_url translate="label" module="connector">
|
1396 |
+
<label>Cross-Sell Products URL</label>
|
1397 |
+
<frontend_type>label</frontend_type>
|
1398 |
+
<frontend_model>email_connector/adminhtml_system_dynamic_crosssell</frontend_model>
|
1399 |
+
<sort_order>90</sort_order>
|
1400 |
+
<show_in_default>1</show_in_default>
|
1401 |
+
<show_in_website>1</show_in_website>
|
1402 |
+
<show_in_store>0</show_in_store>
|
1403 |
+
</crosssell_products_url>
|
1404 |
+
<best_sellers_url translate="label" module="connector">
|
1405 |
+
<label>Best Sellers URL</label>
|
1406 |
+
<frontend_type>label</frontend_type>
|
1407 |
+
<frontend_model>email_connector/adminhtml_system_dynamic_bestsellers</frontend_model>
|
1408 |
+
<sort_order>100</sort_order>
|
1409 |
+
<show_in_default>1</show_in_default>
|
1410 |
+
<show_in_website>1</show_in_website>
|
1411 |
+
<show_in_store>0</show_in_store>
|
1412 |
+
</best_sellers_url>
|
1413 |
+
<most_viewed_url translate="label" module="connector">
|
1414 |
+
<label>Most Viewed URL</label>
|
1415 |
+
<frontend_type>label</frontend_type>
|
1416 |
+
<frontend_model>email_connector/adminhtml_system_dynamic_mostviewed</frontend_model>
|
1417 |
+
<sort_order>110</sort_order>
|
1418 |
+
<show_in_default>1</show_in_default>
|
1419 |
+
<show_in_website>1</show_in_website>
|
1420 |
+
<show_in_store>0</show_in_store>
|
1421 |
+
</most_viewed_url>
|
1422 |
+
<product_push_url translate="label" module="connector">
|
1423 |
+
<label>Product Push URL</label>
|
1424 |
+
<frontend_type>label</frontend_type>
|
1425 |
+
<frontend_model>email_connector/adminhtml_system_dynamic_productpush</frontend_model>
|
1426 |
+
<sort_order>130</sort_order>
|
1427 |
+
<show_in_default>1</show_in_default>
|
1428 |
+
<show_in_website>1</show_in_website>
|
1429 |
+
<show_in_store>0</show_in_store>
|
1430 |
+
</product_push_url>
|
1431 |
+
<recently_viewed_url translate="label" module="connector">
|
1432 |
+
<label>Recently Viewed</label>
|
1433 |
+
<frontend_type>label</frontend_type>
|
1434 |
+
<frontend_model>email_connector/adminhtml_system_dynamic_recentlyviewed</frontend_model>
|
1435 |
+
<sort_order>120</sort_order>
|
1436 |
+
<show_in_default>1</show_in_default>
|
1437 |
+
<show_in_website>1</show_in_website>
|
1438 |
+
<show_in_store>0</show_in_store>
|
1439 |
+
</recently_viewed_url>
|
1440 |
+
<transactional_email_heading translate="label" module="connector">
|
1441 |
+
<label>Transactional Emails</label>
|
1442 |
+
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
1443 |
+
<sort_order>140</sort_order>
|
1444 |
+
<show_in_default>1</show_in_default>
|
1445 |
+
<show_in_website>1</show_in_website>
|
1446 |
+
<show_in_store>0</show_in_store>
|
1447 |
+
</transactional_email_heading>
|
1448 |
+
<new_order_url translate="label" module="connector">
|
1449 |
+
<label>New Order</label>
|
1450 |
+
<frontend_type>label</frontend_type>
|
1451 |
+
<frontend_model>email_connector/adminhtml_system_url_neworder</frontend_model>
|
1452 |
+
<sort_order>150</sort_order>
|
1453 |
+
<show_in_default>1</show_in_default>
|
1454 |
+
<show_in_website>1</show_in_website>
|
1455 |
+
<show_in_store>0</show_in_store>
|
1456 |
+
</new_order_url>
|
1457 |
+
<new_order_guest_url translate="label" module="connector">
|
1458 |
+
<label>New Order for Guest</label>
|
1459 |
+
<frontend_type>label</frontend_type>
|
1460 |
+
<frontend_model>email_connector/adminhtml_system_url_neworderguest</frontend_model>
|
1461 |
+
<sort_order>160</sort_order>
|
1462 |
+
<show_in_default>1</show_in_default>
|
1463 |
+
<show_in_website>1</show_in_website>
|
1464 |
+
<show_in_store>0</show_in_store>
|
1465 |
+
</new_order_guest_url>
|
1466 |
+
<order_update_url translate="label" module="connector">
|
1467 |
+
<label>Order Update</label>
|
1468 |
+
<frontend_type>label</frontend_type>
|
1469 |
+
<frontend_model>email_connector/adminhtml_system_url_orderupdate</frontend_model>
|
1470 |
+
<sort_order>170</sort_order>
|
1471 |
+
<show_in_default>1</show_in_default>
|
1472 |
+
<show_in_website>1</show_in_website>
|
1473 |
+
<show_in_store>0</show_in_store>
|
1474 |
+
</order_update_url>
|
1475 |
+
<order_update_guest_url translate="label" module="connector">
|
1476 |
+
<label>Order Update for Guest</label>
|
1477 |
+
<frontend_type>label</frontend_type>
|
1478 |
+
<frontend_model>email_connector/adminhtml_system_url_orderupdateguest</frontend_model>
|
1479 |
+
<sort_order>180</sort_order>
|
1480 |
+
<show_in_default>1</show_in_default>
|
1481 |
+
<show_in_website>1</show_in_website>
|
1482 |
+
<show_in_store>0</show_in_store>
|
1483 |
+
</order_update_guest_url>
|
1484 |
+
<new_invoice_url translate="label" module="connector">
|
1485 |
+
<label>New Invoice</label>
|
1486 |
+
<frontend_type>label</frontend_type>
|
1487 |
+
<frontend_model>email_connector/adminhtml_system_url_newinvoice</frontend_model>
|
1488 |
+
<sort_order>190</sort_order>
|
1489 |
+
<show_in_default>1</show_in_default>
|
1490 |
+
<show_in_website>1</show_in_website>
|
1491 |
+
<show_in_store>0</show_in_store>
|
1492 |
+
</new_invoice_url>
|
1493 |
+
<new_invoice_guest_url translate="label" module="connector">
|
1494 |
+
<label>New Invoice for Guest</label>
|
1495 |
+
<frontend_type>label</frontend_type>
|
1496 |
+
<frontend_model>email_connector/adminhtml_system_url_newinvoiceguest</frontend_model>
|
1497 |
+
<sort_order>200</sort_order>
|
1498 |
+
<show_in_default>1</show_in_default>
|
1499 |
+
<show_in_website>1</show_in_website>
|
1500 |
+
<show_in_store>0</show_in_store>
|
1501 |
+
</new_invoice_guest_url>
|
1502 |
+
<invoice_update_url translate="label" module="connector">
|
1503 |
+
<label>Invoice Update</label>
|
1504 |
+
<frontend_type>label</frontend_type>
|
1505 |
+
<frontend_model>email_connector/adminhtml_system_url_invoiceupdate</frontend_model>
|
1506 |
+
<sort_order>210</sort_order>
|
1507 |
+
<show_in_default>1</show_in_default>
|
1508 |
+
<show_in_website>1</show_in_website>
|
1509 |
+
<show_in_store>0</show_in_store>
|
1510 |
+
</invoice_update_url>
|
1511 |
+
<invoice_update_guest_url translate="label" module="connector">
|
1512 |
+
<label>Invoice Update for Guest</label>
|
1513 |
+
<frontend_type>label</frontend_type>
|
1514 |
+
<frontend_model>email_connector/adminhtml_system_url_invoiceupdateguest</frontend_model>
|
1515 |
+
<sort_order>220</sort_order>
|
1516 |
+
<show_in_default>1</show_in_default>
|
1517 |
+
<show_in_website>1</show_in_website>
|
1518 |
+
<show_in_store>0</show_in_store>
|
1519 |
+
</invoice_update_guest_url>
|
1520 |
+
<new_creditmemo_url translate="label" module="connector">
|
1521 |
+
<label>New Credit Memo</label>
|
1522 |
+
<frontend_type>label</frontend_type>
|
1523 |
+
<frontend_model>email_connector/adminhtml_system_url_newcreditmemo</frontend_model>
|
1524 |
+
<sort_order>230</sort_order>
|
1525 |
+
<show_in_default>1</show_in_default>
|
1526 |
+
<show_in_website>1</show_in_website>
|
1527 |
+
<show_in_store>0</show_in_store>
|
1528 |
+
</new_creditmemo_url>
|
1529 |
+
<new_creditmemo_guest_url translate="label" module="connector">
|
1530 |
+
<label>New Credit Memo Guest</label>
|
1531 |
+
<frontend_type>label</frontend_type>
|
1532 |
+
<frontend_model>email_connector/adminhtml_system_url_newcreditmemoguest</frontend_model>
|
1533 |
+
<sort_order>240</sort_order>
|
1534 |
+
<show_in_default>1</show_in_default>
|
1535 |
+
<show_in_website>1</show_in_website>
|
1536 |
+
<show_in_store>0</show_in_store>
|
1537 |
+
</new_creditmemo_guest_url>
|
1538 |
+
<creditmemo_update_url translate="label" module="connector">
|
1539 |
+
<label>Credit Memo Update</label>
|
1540 |
+
<frontend_type>label</frontend_type>
|
1541 |
+
<frontend_model>email_connector/adminhtml_system_url_creditmemoupdate</frontend_model>
|
1542 |
+
<sort_order>250</sort_order>
|
1543 |
+
<show_in_default>1</show_in_default>
|
1544 |
+
<show_in_website>1</show_in_website>
|
1545 |
+
<show_in_store>0</show_in_store>
|
1546 |
+
</creditmemo_update_url>
|
1547 |
+
<creditmemo_update_guest_url translate="label" module="connector">
|
1548 |
+
<label>Credit Memo Update for Guest</label>
|
1549 |
+
<frontend_type>label</frontend_type>
|
1550 |
+
<frontend_model>email_connector/adminhtml_system_url_creditmemoupdateguest</frontend_model>
|
1551 |
+
<sort_order>260</sort_order>
|
1552 |
+
<show_in_default>1</show_in_default>
|
1553 |
+
<show_in_website>1</show_in_website>
|
1554 |
+
<show_in_store>0</show_in_store>
|
1555 |
+
</creditmemo_update_guest_url>
|
1556 |
+
<new_shipment_url translate="label" module="connector">
|
1557 |
+
<label>New Shipment</label>
|
1558 |
+
<frontend_type>label</frontend_type>
|
1559 |
+
<frontend_model>email_connector/adminhtml_system_url_newshipment</frontend_model>
|
1560 |
+
<sort_order>270</sort_order>
|
1561 |
+
<show_in_default>1</show_in_default>
|
1562 |
+
<show_in_website>1</show_in_website>
|
1563 |
+
<show_in_store>0</show_in_store>
|
1564 |
+
</new_shipment_url>
|
1565 |
+
<new_shipment_guest_url translate="label" module="connector">
|
1566 |
+
<label>New Shipment for Guest</label>
|
1567 |
+
<frontend_type>label</frontend_type>
|
1568 |
+
<frontend_model>email_connector/adminhtml_system_url_newshipmentguest</frontend_model>
|
1569 |
+
<sort_order>280</sort_order>
|
1570 |
+
<show_in_default>1</show_in_default>
|
1571 |
+
<show_in_website>1</show_in_website>
|
1572 |
+
<show_in_store>0</show_in_store>
|
1573 |
+
</new_shipment_guest_url>
|
1574 |
+
<shipment_update_url translate="label" module="connector">
|
1575 |
+
<label>Shipment Update</label>
|
1576 |
+
<frontend_type>label</frontend_type>
|
1577 |
+
<frontend_model>email_connector/adminhtml_system_url_shipmentupdate</frontend_model>
|
1578 |
+
<sort_order>290</sort_order>
|
1579 |
+
<show_in_default>1</show_in_default>
|
1580 |
+
<show_in_website>1</show_in_website>
|
1581 |
+
<show_in_store>0</show_in_store>
|
1582 |
+
</shipment_update_url>
|
1583 |
+
<shipment_update_guest_url translate="label" module="connector">
|
1584 |
+
<label>Shipment Update for Guest</label>
|
1585 |
+
<frontend_type>label</frontend_type>
|
1586 |
+
<frontend_model>email_connector/adminhtml_system_url_shipmentupdateguest</frontend_model>
|
1587 |
+
<sort_order>300</sort_order>
|
1588 |
+
<show_in_default>1</show_in_default>
|
1589 |
+
<show_in_website>1</show_in_website>
|
1590 |
+
<show_in_store>0</show_in_store>
|
1591 |
+
</shipment_update_guest_url>
|
1592 |
+
</fields>
|
1593 |
+
</external_dynamic_content_urls>
|
1594 |
+
<manual_product_search translate="label" module="connector">
|
1595 |
+
<label>Manual Product Push</label>
|
1596 |
+
<frontend_type>text</frontend_type>
|
1597 |
+
<sort_order>30</sort_order>
|
1598 |
+
<show_in_default>1</show_in_default>
|
1599 |
+
<show_in_website>1</show_in_website>
|
1600 |
+
<show_in_store>0</show_in_store>
|
1601 |
+
<expanded>1</expanded>
|
1602 |
+
<fields>
|
1603 |
+
<settings_title tranlate="label" module="connector">
|
1604 |
+
<label>Settings</label>
|
1605 |
+
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
1606 |
+
<sort_order>10</sort_order>
|
1607 |
+
<show_in_default>1</show_in_default>
|
1608 |
+
<show_in_website>1</show_in_website>
|
1609 |
+
<show_in_store>0</show_in_store>
|
1610 |
+
</settings_title>
|
1611 |
+
<display_type translate="label" module="connector">
|
1612 |
+
<label>Display Type</label>
|
1613 |
+
<frontend_type>select</frontend_type>
|
1614 |
+
<source_model>email_connector/adminhtml_source_dynamic_displaytype</source_model>
|
1615 |
+
<sort_order>50</sort_order>
|
1616 |
+
<show_in_default>1</show_in_default>
|
1617 |
+
<show_in_website>1</show_in_website>
|
1618 |
+
<show_in_store>0</show_in_store>
|
1619 |
+
</display_type>
|
1620 |
+
<items_to_display translate="label" module="connector">
|
1621 |
+
<label>Items To Display</label>
|
1622 |
+
<frontend_type>select</frontend_type>
|
1623 |
+
<source_model>email_connector/adminhtml_source_dynamic_gridview</source_model>
|
1624 |
+
<sort_order>60</sort_order>
|
1625 |
+
<show_in_website>1</show_in_website>
|
1626 |
+
<show_in_default>1</show_in_default>
|
1627 |
+
<show_in_store>0</show_in_store>
|
1628 |
+
</items_to_display>
|
1629 |
+
<products_push_title translate="label" module="connector">
|
1630 |
+
<label>Products</label>
|
1631 |
+
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
1632 |
+
<sort_order>80</sort_order>
|
1633 |
+
<show_in_default>1</show_in_default>
|
1634 |
+
<show_in_website>1</show_in_website>
|
1635 |
+
<show_in_store>0</show_in_store>
|
1636 |
+
</products_push_title>
|
1637 |
+
<products_push_items translate="label comment" module="connector">
|
1638 |
<label>Products</label>
|
1639 |
<frontend_type>text</frontend_type>
|
1640 |
<sort_order>90</sort_order>
|
1645 |
</products_push_items>
|
1646 |
</fields>
|
1647 |
</manual_product_search>
|
1648 |
+
<fallback_products translate="label" module="connector">
|
1649 |
<label>Fallback Products</label>
|
1650 |
<frontend_type>text</frontend_type>
|
1651 |
+
<sort_order>40</sort_order>
|
1652 |
<show_in_default>1</show_in_default>
|
1653 |
<show_in_website>1</show_in_website>
|
1654 |
<show_in_store>0</show_in_store>
|
1655 |
<fields>
|
1656 |
+
<product_list translate="label comment" module="connector">
|
1657 |
<label>Products</label>
|
1658 |
<frontend_type>text</frontend_type>
|
1659 |
<sort_order>10</sort_order>
|
1665 |
</fields>
|
1666 |
</fallback_products>
|
1667 |
</groups>
|
1668 |
+
</connector_dynamic_content>
|
1669 |
+
<connector_transactional_emails translate="label" module="connector">
|
1670 |
+
<label>Transactional Emails</label>
|
1671 |
<tab>connector</tab>
|
1672 |
<frontend_type>text</frontend_type>
|
|
|
1673 |
<show_in_default>1</show_in_default>
|
1674 |
<show_in_website>1</show_in_website>
|
1675 |
+
<show_in_store>0</show_in_store>
|
1676 |
+
<sort_order>9000</sort_order>
|
1677 |
<groups>
|
1678 |
+
<credentials translate="label" module="connector">
|
1679 |
+
<label>API</label>
|
1680 |
<frontend_type>text</frontend_type>
|
1681 |
+
<sort_order>100</sort_order>
|
1682 |
<show_in_default>1</show_in_default>
|
1683 |
<show_in_website>1</show_in_website>
|
1684 |
<show_in_store>0</show_in_store>
|
1685 |
+
<expanded>1</expanded>
|
1686 |
<fields>
|
1687 |
+
<enabled translate="label" module="connector">
|
1688 |
+
<label>Enabled</label>
|
1689 |
<frontend_type>select</frontend_type>
|
1690 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
1691 |
+
<sort_order>10</sort_order>
|
1692 |
+
<show_in_default>1</show_in_default>
|
1693 |
+
<show_in_website>1</show_in_website>
|
1694 |
+
<show_in_store>0</show_in_store>
|
1695 |
+
</enabled>
|
1696 |
+
<api_username translate="label" module="connector">
|
1697 |
+
<label>API Username</label>
|
1698 |
+
<frontend_type>text</frontend_type>
|
1699 |
+
<frontend_model>email_connector/adminhtml_system_config_wrapper</frontend_model>
|
1700 |
+
<sort_order>10</sort_order>
|
1701 |
+
<show_in_default>1</show_in_default>
|
1702 |
+
<show_in_website>1</show_in_website>
|
1703 |
+
<show_in_store>0</show_in_store>
|
1704 |
+
<depends>
|
1705 |
+
<enabled>1</enabled>
|
1706 |
+
</depends>
|
1707 |
+
</api_username>
|
1708 |
+
<api_password translate="label" module="connector">
|
1709 |
+
<label>API Password</label>
|
1710 |
+
<frontend_type>password</frontend_type>
|
1711 |
+
<frontend_model>email_connector/adminhtml_system_emailapivalidate</frontend_model>
|
1712 |
+
<sort_order>20</sort_order>
|
1713 |
+
<show_in_default>1</show_in_default>
|
1714 |
+
<show_in_website>1</show_in_website>
|
1715 |
+
<show_in_store>0</show_in_store>
|
1716 |
+
<depends>
|
1717 |
+
<enabled>1</enabled>
|
1718 |
+
</depends>
|
1719 |
+
</api_password>
|
1720 |
+
<validator>
|
1721 |
+
<frontend_type>hidden</frontend_type>
|
1722 |
+
<frontend_model>email_connector/adminhtml_system_config_waitingfield</frontend_model>
|
1723 |
<sort_order>40</sort_order>
|
1724 |
<show_in_default>1</show_in_default>
|
1725 |
<show_in_website>1</show_in_website>
|
1726 |
<show_in_store>0</show_in_store>
|
1727 |
+
<can_be_empty>1</can_be_empty>
|
1728 |
+
</validator>
|
1729 |
</fields>
|
1730 |
+
</credentials>
|
1731 |
+
<email_mapping translate="label" module="connector">
|
1732 |
+
<label>Email Mapping</label>
|
1733 |
<frontend_type>text</frontend_type>
|
1734 |
+
<sort_order>200</sort_order>
|
1735 |
<show_in_default>1</show_in_default>
|
1736 |
<show_in_website>1</show_in_website>
|
1737 |
+
<show_in_store>1</show_in_store>
|
1738 |
+
<expanded>1</expanded>
|
1739 |
<fields>
|
1740 |
+
<!--DO NOT CHANGE THE NAMING AS THIS ARE EVENT TRIGGERED-->
|
1741 |
+
<order_title translate="label" module="connector">
|
1742 |
+
<label>Order</label>
|
1743 |
+
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
1744 |
<sort_order>10</sort_order>
|
1745 |
<show_in_default>1</show_in_default>
|
1746 |
<show_in_website>1</show_in_website>
|
1747 |
<show_in_store>0</show_in_store>
|
1748 |
+
</order_title>
|
1749 |
+
<sales_email_order_template translate="label" module="connector">
|
1750 |
+
<label>New Order</label>
|
|
|
|
|
1751 |
<sort_order>20</sort_order>
|
1752 |
+
<frontend_type>select</frontend_type>
|
1753 |
+
<source_model>email_connector/adminhtml_source_transactional_campaigns</source_model>
|
1754 |
<show_in_default>1</show_in_default>
|
1755 |
<show_in_website>1</show_in_website>
|
1756 |
<show_in_store>0</show_in_store>
|
1757 |
+
</sales_email_order_template>
|
1758 |
+
<sales_email_order_guest_template translate="label" model="connector">
|
1759 |
+
<label>New Order for Guest</label>
|
|
|
|
|
|
|
1760 |
<sort_order>30</sort_order>
|
1761 |
+
<frontend_type>select</frontend_type>
|
1762 |
+
<source_model>email_connector/adminhtml_source_transactional_campaigns</source_model>
|
1763 |
<show_in_default>1</show_in_default>
|
1764 |
<show_in_website>1</show_in_website>
|
1765 |
<show_in_store>0</show_in_store>
|
1766 |
+
</sales_email_order_guest_template>
|
1767 |
+
<sales_email_order_comment_template translate="label" model="connector">
|
1768 |
+
<label>Order Update</label>
|
|
|
1769 |
<sort_order>40</sort_order>
|
1770 |
+
<frontend_type>select</frontend_type>
|
1771 |
+
<source_model>email_connector/adminhtml_source_transactional_campaigns</source_model>
|
1772 |
<show_in_default>1</show_in_default>
|
1773 |
+
<show_in_website>1</show_in_website>
|
1774 |
<show_in_store>0</show_in_store>
|
1775 |
+
</sales_email_order_comment_template>
|
1776 |
+
<sales_email_order_comment_guest_template translate="label" model="connector">
|
1777 |
+
<label>Order Update for Guest</label>
|
|
|
|
|
1778 |
<sort_order>50</sort_order>
|
1779 |
+
<frontend_type>select</frontend_type>
|
1780 |
+
<source_model>email_connector/adminhtml_source_transactional_campaigns</source_model>
|
1781 |
<show_in_default>1</show_in_default>
|
1782 |
<show_in_website>1</show_in_website>
|
1783 |
<show_in_store>0</show_in_store>
|
1784 |
+
</sales_email_order_comment_guest_template>
|
1785 |
+
<sales_email_invoice_template translate="label" model="connector">
|
1786 |
+
<label>New Invoice</label>
|
|
|
|
|
1787 |
<sort_order>60</sort_order>
|
1788 |
+
<frontend_type>select</frontend_type>
|
1789 |
+
<source_model>email_connector/adminhtml_source_transactional_campaigns</source_model>
|
1790 |
<show_in_default>1</show_in_default>
|
1791 |
<show_in_website>1</show_in_website>
|
1792 |
<show_in_store>0</show_in_store>
|
1793 |
+
</sales_email_invoice_template>
|
1794 |
+
<sales_email_invoice_guest_template translate="label" model="connector">
|
1795 |
+
<label>New Invoice for Guest</label>
|
|
|
|
|
1796 |
<sort_order>70</sort_order>
|
1797 |
+
<frontend_type>select</frontend_type>
|
1798 |
+
<source_model>email_connector/adminhtml_source_transactional_campaigns</source_model>
|
1799 |
<show_in_default>1</show_in_default>
|
1800 |
<show_in_website>1</show_in_website>
|
1801 |
<show_in_store>0</show_in_store>
|
1802 |
+
</sales_email_invoice_guest_template>
|
1803 |
+
<sales_email_invoice_comment_template translate="label" model="connector">
|
1804 |
+
<label>Invoice Update</label>
|
|
|
|
|
1805 |
<sort_order>80</sort_order>
|
1806 |
+
<frontend_type>select</frontend_type>
|
1807 |
+
<source_model>email_connector/adminhtml_source_transactional_campaigns</source_model>
|
1808 |
<show_in_default>1</show_in_default>
|
1809 |
<show_in_website>1</show_in_website>
|
1810 |
<show_in_store>0</show_in_store>
|
1811 |
+
</sales_email_invoice_comment_template>
|
1812 |
+
<sales_email_invoice_comment_guest_template translate="label" module="connector">
|
1813 |
+
<label>Invoice Update for Guest</label>
|
|
|
|
|
1814 |
<sort_order>90</sort_order>
|
1815 |
+
<frontend_type>select</frontend_type>
|
1816 |
+
<source_model>email_connector/adminhtml_source_transactional_campaigns</source_model>
|
1817 |
<show_in_default>1</show_in_default>
|
1818 |
<show_in_website>1</show_in_website>
|
1819 |
<show_in_store>0</show_in_store>
|
1820 |
+
</sales_email_invoice_comment_guest_template>
|
1821 |
+
<sales_email_creditmemo_template>
|
1822 |
+
<label>New Credit Memo</label>
|
|
|
|
|
|
|
1823 |
<sort_order>100</sort_order>
|
1824 |
+
<frontend_type>select</frontend_type>
|
1825 |
+
<source_model>email_connector/adminhtml_source_transactional_campaigns</source_model>
|
1826 |
<show_in_default>1</show_in_default>
|
1827 |
<show_in_website>1</show_in_website>
|
1828 |
<show_in_store>0</show_in_store>
|
1829 |
+
</sales_email_creditmemo_template>
|
1830 |
+
<sales_email_creditmemo_guest_template>
|
1831 |
+
<label>New Credit Memo Guest</label>
|
|
|
|
|
1832 |
<sort_order>110</sort_order>
|
1833 |
+
<frontend_type>select</frontend_type>
|
1834 |
+
<source_model>email_connector/adminhtml_source_transactional_campaigns</source_model>
|
1835 |
<show_in_default>1</show_in_default>
|
1836 |
<show_in_website>1</show_in_website>
|
1837 |
<show_in_store>0</show_in_store>
|
1838 |
+
</sales_email_creditmemo_guest_template>
|
1839 |
+
<sales_email_creditmemo_comment_template translate="label" module="connector">
|
1840 |
+
<label>Credit Memo Update</label>
|
|
|
|
|
1841 |
<sort_order>120</sort_order>
|
1842 |
+
<frontend_type>select</frontend_type>
|
1843 |
+
<source_model>email_connector/adminhtml_source_transactional_campaigns</source_model>
|
1844 |
<show_in_default>1</show_in_default>
|
1845 |
<show_in_website>1</show_in_website>
|
1846 |
<show_in_store>0</show_in_store>
|
1847 |
+
</sales_email_creditmemo_comment_template>
|
1848 |
+
<sales_email_creditmemo_comment_guest_template translate="label" module="connector">
|
1849 |
+
<label>Credit Memo Update for Guest</label>
|
|
|
|
|
1850 |
<sort_order>130</sort_order>
|
1851 |
+
<frontend_type>select</frontend_type>
|
1852 |
+
<source_model>email_connector/adminhtml_source_transactional_campaigns</source_model>
|
1853 |
<show_in_default>1</show_in_default>
|
1854 |
<show_in_website>1</show_in_website>
|
1855 |
<show_in_store>0</show_in_store>
|
1856 |
+
</sales_email_creditmemo_comment_guest_template>
|
1857 |
+
<sales_email_shipment_template translate="label" module="connector">
|
1858 |
+
<label>New Shipment</label>
|
1859 |
+
<sort_order>140</sort_order>
|
1860 |
+
<frontend_type>select</frontend_type>
|
1861 |
+
<source_model>email_connector/adminhtml_source_transactional_campaigns</source_model>
|
1862 |
+
<show_in_default>1</show_in_default>
|
1863 |
+
<show_in_website>1</show_in_website>
|
1864 |
+
<show_in_store>0</show_in_store>
|
1865 |
+
</sales_email_shipment_template>
|
1866 |
+
<sales_email_shipment_guest_template translate="label" module="connector">
|
1867 |
+
<label>New Shipment for Guest</label>
|
1868 |
+
<sort_order>150</sort_order>
|
1869 |
+
<frontend_type>select</frontend_type>
|
1870 |
+
<source_model>email_connector/adminhtml_source_transactional_campaigns</source_model>
|
1871 |
+
<show_in_default>1</show_in_default>
|
1872 |
+
<show_in_website>1</show_in_website>
|
1873 |
+
<show_in_store>0</show_in_store>
|
1874 |
+
</sales_email_shipment_guest_template>
|
1875 |
+
<sales_email_shipment_comment_template translate="label" module="connector">
|
1876 |
+
<label>Shipment Update</label>
|
1877 |
+
<sort_order>160</sort_order>
|
1878 |
+
<frontend_type>select</frontend_type>
|
1879 |
+
<source_model>email_connector/adminhtml_source_transactional_campaigns</source_model>
|
1880 |
+
<show_in_default>1</show_in_default>
|
1881 |
+
<show_in_website>1</show_in_website>
|
1882 |
+
<show_in_store>0</show_in_store>
|
1883 |
+
</sales_email_shipment_comment_template>
|
1884 |
+
<sales_email_shipment_comment_guest_template translate="label" module="connector">
|
1885 |
+
<label>Shipment Update for Guest</label>
|
1886 |
+
<sort_order>170</sort_order>
|
1887 |
+
<frontend_type>select</frontend_type>
|
1888 |
+
<source_model>email_connector/adminhtml_source_transactional_campaigns</source_model>
|
1889 |
+
<show_in_default>1</show_in_default>
|
1890 |
+
<show_in_website>1</show_in_website>
|
1891 |
+
<show_in_store>0</show_in_store>
|
1892 |
+
</sales_email_shipment_comment_guest_template>
|
1893 |
+
<customer_emails_heading translate="label" module="connector">
|
1894 |
+
<label>Customer</label>
|
1895 |
+
<sort_order>180</sort_order>
|
1896 |
+
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
1897 |
+
<show_in_default>1</show_in_default>
|
1898 |
+
<show_in_website>1</show_in_website>
|
1899 |
+
<show_in_store>0</show_in_store>
|
1900 |
+
</customer_emails_heading>
|
1901 |
+
<customer_create_account_email_template translate="label" module="connector">
|
1902 |
+
<label>New Account</label>
|
1903 |
+
<sort_order>190</sort_order>
|
1904 |
+
<frontend_type>select</frontend_type>
|
1905 |
+
<source_model>email_connector/adminhtml_source_transactional_campaigns</source_model>
|
1906 |
+
<show_in_default>1</show_in_default>
|
1907 |
+
<show_in_website>1</show_in_website>
|
1908 |
+
<show_in_store>0</show_in_store>
|
1909 |
+
</customer_create_account_email_template>
|
1910 |
+
</fields>
|
1911 |
+
</email_mapping>
|
1912 |
+
</groups>
|
1913 |
+
</connector_transactional_emails>
|
1914 |
+
<connector_advanced_settings translate="label" module="connector">
|
1915 |
+
<label><![CDATA[Advanced Settings]]></label>
|
1916 |
+
<tab>connector</tab>
|
1917 |
+
<frontend_type>text</frontend_type>
|
1918 |
+
<sort_order>10000</sort_order>
|
1919 |
+
<show_in_default>1</show_in_default>
|
1920 |
+
<show_in_website>1</show_in_website>
|
1921 |
+
<show_in_store>0</show_in_store>
|
1922 |
+
<groups>
|
1923 |
+
<sync_limits translate="label" module="connector">
|
1924 |
+
<label>Transactional Data Sync Limit</label>
|
1925 |
+
<frontend_type>text</frontend_type>
|
1926 |
+
<sort_order>10</sort_order>
|
1927 |
+
<show_in_default>1</show_in_default>
|
1928 |
+
<show_in_website>1</show_in_website>
|
1929 |
+
<show_in_store>0</show_in_store>
|
1930 |
+
<fields>
|
1931 |
+
<orders translate="label" module="connector">
|
1932 |
+
<label>Transactional Data Import Limit Size</label>
|
1933 |
+
<frontend_type>select</frontend_type>
|
1934 |
+
<source_model>email_connector/adminhtml_source_advanced_transdata</source_model>
|
1935 |
+
<sort_order>40</sort_order>
|
1936 |
+
<show_in_default>1</show_in_default>
|
1937 |
+
<show_in_website>1</show_in_website>
|
1938 |
+
<show_in_store>0</show_in_store>
|
1939 |
+
</orders>
|
1940 |
</fields>
|
1941 |
+
</sync_limits>
|
1942 |
+
<admin translate="label comment" module="connector">
|
1943 |
<label>Admin</label>
|
1944 |
<frontend_type>text</frontend_type>
|
1945 |
<sort_order>30</sort_order>
|
1946 |
<show_in_default>1</show_in_default>
|
1947 |
+
<show_in_website>1</show_in_website>
|
1948 |
<show_in_store>0</show_in_store>
|
1949 |
+
<comment><![CDATA[<p class="notice">ADVANCED</p>]]>
|
1950 |
+
</comment>
|
1951 |
<fields>
|
1952 |
+
<setup_data_fields translate="label comment" module="connector">
|
1953 |
+
<label>Automap Data Fields</label>
|
1954 |
+
<frontend_model>email_connector/adminhtml_system_advanced_setupdatafields</frontend_model>
|
1955 |
<sort_order>10</sort_order>
|
1956 |
<show_in_default>1</show_in_default>
|
1957 |
<show_in_website>1</show_in_website>
|
1958 |
<show_in_store>0</show_in_store>
|
1959 |
+
<comment><![CDATA[Create Datafields In Connector And Map Them. Including Customer, Address And Sales Information.]]></comment>
|
1960 |
+
</setup_data_fields>
|
1961 |
+
<delete_contact translate="label" module="connector">
|
1962 |
+
<label><![CDATA[Delete All Contact ID'S]]></label>
|
1963 |
+
<frontend_model>email_connector/adminhtml_system_advanced_deletecontactids</frontend_model>
|
1964 |
<sort_order>20</sort_order>
|
1965 |
<show_in_default>1</show_in_default>
|
1966 |
<show_in_website>1</show_in_website>
|
1967 |
<show_in_store>0</show_in_store>
|
1968 |
+
<comment><![CDATA[Remove the contact id's. When using different API username account from initial setup please click here to remove all.]]></comment>
|
1969 |
+
</delete_contact>
|
1970 |
+
<reimport_orders module="connector" translate="label">
|
1971 |
+
<label>Refresh Transactional Data</label>
|
1972 |
+
<frontend_model>email_connector/adminhtml_system_advanced_reimportorders</frontend_model>
|
1973 |
<sort_order>30</sort_order>
|
1974 |
<show_in_default>1</show_in_default>
|
1975 |
<show_in_website>1</show_in_website>
|
1976 |
<show_in_store>0</show_in_store>
|
1977 |
+
<comment><![CDATA[Refresh Order Transactional Data That Was Already Imported.]]></comment>
|
1978 |
+
</reimport_orders>
|
1979 |
+
<reimport_subscribers module="connector" translate="label">
|
1980 |
+
<label>Refresh Subscribers</label>
|
1981 |
+
<frontend_model>email_connector/adminhtml_system_advanced_reimportsubscribers</frontend_model>
|
1982 |
+
<sort_order>40</sort_order>
|
1983 |
+
<show_in_default>1</show_in_default>
|
1984 |
+
<show_in_website>1</show_in_website>
|
1985 |
+
<show_in_store>0</show_in_store>
|
1986 |
+
<comment><![CDATA[All Subscribers Will Be Marked For Import.]]></comment>
|
1987 |
+
</reimport_subscribers>
|
1988 |
+
<suppressed_contacts module="connector" translate="label">
|
1989 |
+
<label>Refresh Supressed Contacts</label>
|
1990 |
+
<frontend_model>email_connector/adminhtml_system_advanced_suppressedcontacts</frontend_model>
|
1991 |
+
<sort_order>40</sort_order>
|
1992 |
+
<show_in_default>1</show_in_default>
|
1993 |
+
<show_in_website>1</show_in_website>
|
1994 |
+
<show_in_store>0</show_in_store>
|
1995 |
+
<comment>Refresh Historically Suppressed contacts for 10years period.</comment>
|
1996 |
+
</suppressed_contacts>
|
1997 |
+
<memory_limit translate="label comment" module="connector">
|
1998 |
+
<label>Customer Sync Memory Default</label>
|
1999 |
<frontend_type>select</frontend_type>
|
2000 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
2001 |
+
<sort_order>50</sort_order>
|
2002 |
<show_in_default>1</show_in_default>
|
2003 |
<show_in_website>0</show_in_website>
|
2004 |
<show_in_store>0</show_in_store>
|
|
|
2005 |
<comment>Set to NO to use system default memory.</comment>
|
2006 |
</memory_limit>
|
2007 |
+
<batch_size translate="label comment" module="connector">
|
2008 |
<label>Customer Sync Batch Size</label>
|
2009 |
<frontend_type>text</frontend_type>
|
2010 |
<show_in_default>1</show_in_default>
|
2011 |
<show_in_website>1</show_in_website>
|
2012 |
<show_in_store>0</show_in_store>
|
2013 |
+
<sort_order>60</sort_order>
|
2014 |
+
<comment>Set the limit size for customers loaded for every sync.</comment>
|
2015 |
</batch_size>
|
2016 |
+
<debug_enabled translate="label comment" module="connector">
|
2017 |
<label>Debug Mode</label>
|
2018 |
<frontend_type>select</frontend_type>
|
2019 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
2020 |
+
<sort_order>70</sort_order>
|
2021 |
<show_in_default>1</show_in_default>
|
2022 |
<show_in_website>1</show_in_website>
|
2023 |
+
<show_in_store>0</show_in_store>
|
2024 |
+
</debug_enabled>
|
2025 |
+
<inline_styling translate="label comment" module="connector">
|
2026 |
+
<label>Transactional Emails Styling</label>
|
2027 |
+
<frontend_type>textarea</frontend_type>
|
2028 |
+
<sort_order>90</sort_order>
|
2029 |
+
<show_in_default>1</show_in_default>
|
2030 |
+
<show_in_website>1</show_in_website>
|
2031 |
+
<show_in_store>0</show_in_store>
|
2032 |
+
<comment>Styling entered here will apply to all dynamic content areas pulled from Magento for transactional emails.</comment>
|
2033 |
+
</inline_styling>
|
2034 |
+
<recommended_inline translate="label" module="connector">
|
2035 |
+
<label>Dynamic Content Styling</label>
|
2036 |
+
<frontend_type>textarea</frontend_type>
|
2037 |
+
<sort_order>100</sort_order>
|
2038 |
+
<show_in_default>1</show_in_default>
|
2039 |
+
<show_in_website>1</show_in_website>
|
2040 |
+
<show_in_store>0</show_in_store>
|
2041 |
+
<comment><![CDATA[Styling entered here will apply to all dynamic content areas pulled from Magento. Classes References Used : 'product-name', 'product-price', 'product-url']]></comment>
|
2042 |
+
</recommended_inline>
|
2043 |
</fields>
|
2044 |
</admin>
|
2045 |
</groups>
|
@@ -1,12 +1,4 @@
|
|
1 |
<?php
|
2 |
-
/**
|
3 |
-
* mag17.
|
4 |
-
*
|
5 |
-
* User: chrisroseuk
|
6 |
-
* Date: 30/04/2013
|
7 |
-
* Time: 14:17
|
8 |
-
*
|
9 |
-
*/
|
10 |
|
11 |
$installer = $this;
|
12 |
$installer->startSetup();
|
@@ -24,6 +16,7 @@ $setup->addAttribute('customer', 'dotmailer_contact_id', array(
|
|
24 |
'visible' => 1,
|
25 |
'required' => 0,
|
26 |
'user_defined' => 0,
|
|
|
27 |
));
|
28 |
|
29 |
$setup->addAttributeToGroup(
|
@@ -42,9 +35,9 @@ $adminData = array();
|
|
42 |
$adminData[] = array(
|
43 |
'severity' => 4,
|
44 |
'date_added' => gmdate('Y-m-d H:i:s', time()),
|
45 |
-
'title' => 'Email Connector
|
46 |
-
'description' => 'Connector
|
47 |
-
'url' => ''
|
48 |
);
|
49 |
|
50 |
Mage::getModel('adminnotification/inbox')->parse($adminData);
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
$installer = $this;
|
4 |
$installer->startSetup();
|
16 |
'visible' => 1,
|
17 |
'required' => 0,
|
18 |
'user_defined' => 0,
|
19 |
+
''
|
20 |
));
|
21 |
|
22 |
$setup->addAttributeToGroup(
|
35 |
$adminData[] = array(
|
36 |
'severity' => 4,
|
37 |
'date_added' => gmdate('Y-m-d H:i:s', time()),
|
38 |
+
'title' => 'Email Connector Was Installed. Please Enter Your API Credentials & Ensure Cron Jobs Are Running On Your Site (Find Out More)',
|
39 |
+
'description' => 'Email Connector Was Installed. Please Enter Your API Credentials & Ensure Cron Jobs Are Running On Your Site.',
|
40 |
+
'url' => 'http://www.magentocommerce.com/wiki/1_-_installation_and_configuration/how_to_setup_a_cron_job'
|
41 |
);
|
42 |
|
43 |
Mage::getModel('adminnotification/inbox')->parse($adminData);
|
@@ -0,0 +1,287 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/** @var Mage_Eav_Model_Entity_Setup $installer */
|
4 |
+
|
5 |
+
$installer = $this;
|
6 |
+
|
7 |
+
$installer->startSetup();
|
8 |
+
|
9 |
+
/**
|
10 |
+
* create Contact table.
|
11 |
+
*/
|
12 |
+
$contactTable = $installer->getTable('email_connector/contact');
|
13 |
+
|
14 |
+
if ($installer->getConnection()->isTableExists($contactTable)) {
|
15 |
+
$installer->getConnection()->dropTable($contactTable);
|
16 |
+
}
|
17 |
+
|
18 |
+
$table = $installer->getConnection()->newTable($contactTable);
|
19 |
+
$table->addColumn('email_contact_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
20 |
+
'primary' => true,
|
21 |
+
'identity' => true,
|
22 |
+
'unsigned' => true,
|
23 |
+
'nullable' => false
|
24 |
+
), 'Primary Key')
|
25 |
+
->addColumn('is_guest', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array(
|
26 |
+
'unsigned' => true,
|
27 |
+
'nullable' => true,
|
28 |
+
), 'Is Guest')
|
29 |
+
->addColumn('contact_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
30 |
+
'unsigned' => true,
|
31 |
+
'nullable' => true,
|
32 |
+
), 'Connector Contact ID')
|
33 |
+
->addColumn('customer_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
34 |
+
'unsigned' => true,
|
35 |
+
'nullable' => false,
|
36 |
+
), 'Customer ID')
|
37 |
+
->addColumn('website_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
38 |
+
'unsigned' => true,
|
39 |
+
'nullable' => false,
|
40 |
+
'default' => '0'
|
41 |
+
), 'Website ID')
|
42 |
+
->addColumn('store_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
43 |
+
'unsigned' => true,
|
44 |
+
'nullable' => false,
|
45 |
+
'default' => '0'
|
46 |
+
), 'Store ID')
|
47 |
+
->addColumn('email', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
|
48 |
+
'nullable' => false,
|
49 |
+
'default' => ''
|
50 |
+
), 'Customer Email')
|
51 |
+
->addColumn('is_subscriber', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array(
|
52 |
+
'unsigned' => true,
|
53 |
+
'nullable' => true,
|
54 |
+
), 'Is Subscriber')
|
55 |
+
->addColumn('subscriber_status', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array(
|
56 |
+
'unsigned' => true,
|
57 |
+
'nullable' => true,
|
58 |
+
), 'Subscriber status')
|
59 |
+
->addColumn('email_imported', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array(
|
60 |
+
'unsigned' => true,
|
61 |
+
'nullable' => true,
|
62 |
+
), 'Is Imported')
|
63 |
+
->addColumn('subscriber_imported', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array(
|
64 |
+
'unsigned' => true,
|
65 |
+
'nullable' => true,
|
66 |
+
), 'Subscriber Imported')
|
67 |
+
->addColumn('suppressed', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array(
|
68 |
+
'unsigned' => true,
|
69 |
+
'nullable' => true,
|
70 |
+
), 'Is Suppressed')
|
71 |
+
->addIndex($this->getIdxName($contactTable, array('email_contact_id')),
|
72 |
+
array('email_contact_id'))
|
73 |
+
->addIndex($this->getIdxName($contactTable, array('is_guest')),
|
74 |
+
array('is_guest'))
|
75 |
+
->addIndex($this->getIdxName($contactTable, array('customer_id')),
|
76 |
+
array('customer_id'))
|
77 |
+
->addIndex($this->getIdxName($contactTable, array('website_id')),
|
78 |
+
array('website_id'))
|
79 |
+
->addIndex($this->getIdxName($contactTable, array('is_subscriber')),
|
80 |
+
array('is_subscriber'))
|
81 |
+
->addIndex($this->getIdxName($contactTable, array('subscriber_status')),
|
82 |
+
array('subscriber_status'))
|
83 |
+
->addIndex($this->getIdxName($contactTable, array('email_imported')),
|
84 |
+
array('email_imported'))
|
85 |
+
->addIndex($this->getIdxName($contactTable, array('subscriber_imported')),
|
86 |
+
array('subscriber_imported'))
|
87 |
+
->addIndex($this->getIdxName($contactTable, array('suppressed')),
|
88 |
+
array('suppressed'))
|
89 |
+
|
90 |
+
->addForeignKey(
|
91 |
+
$installer->getFkName($contactTable, 'website_id', 'core/website', 'website_id'),
|
92 |
+
'website_id', $installer->getTable('core/website'), 'website_id',
|
93 |
+
Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE)
|
94 |
+
->setComment('Connector Contacts');
|
95 |
+
$installer->getConnection()->createTable($table);
|
96 |
+
|
97 |
+
|
98 |
+
/**
|
99 |
+
* Order table
|
100 |
+
*/
|
101 |
+
$orderTable = $installer->getTable('email_connector/order');
|
102 |
+
|
103 |
+
if ($installer->getConnection()->isTableExists($orderTable)) {
|
104 |
+
$installer->getConnection()->dropTable($orderTable);
|
105 |
+
}
|
106 |
+
|
107 |
+
$table = $installer->getConnection()->newTable($orderTable);
|
108 |
+
$table->addColumn('email_order_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
109 |
+
'primary' => true,
|
110 |
+
'identity' => true,
|
111 |
+
'unsigned' => true,
|
112 |
+
'nullable' => false
|
113 |
+
), 'Primary Key')
|
114 |
+
->addColumn('order_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
115 |
+
'unsigned' => true,
|
116 |
+
'nullable' => false,
|
117 |
+
), 'Order ID')
|
118 |
+
->addColumn('quote_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
119 |
+
'unsigned' => true,
|
120 |
+
'nullable' => false,
|
121 |
+
), 'Sales Quote ID')
|
122 |
+
->addColumn('store_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
123 |
+
'unsigned' => true,
|
124 |
+
'nullable' => false,
|
125 |
+
'default' => '0'
|
126 |
+
), 'Store ID')
|
127 |
+
->addColumn('email_imported', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array(
|
128 |
+
'unsigned' => true,
|
129 |
+
'nullable' => true,
|
130 |
+
), 'Is Order Imported')
|
131 |
+
->addColumn('created_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
|
132 |
+
), 'Creation Time')
|
133 |
+
->addColumn('updated_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
|
134 |
+
), 'Update Time')
|
135 |
+
->addIndex($this->getIdxName($orderTable, array('store_id')),
|
136 |
+
array('store_id'))
|
137 |
+
->addIndex($this->getIdxName($orderTable, array('quote_id')),
|
138 |
+
array('quote_id'))
|
139 |
+
|
140 |
+
->addForeignKey(
|
141 |
+
$installer->getFkName($orderTable, 'store_id', 'core/store', 'store_id'),
|
142 |
+
'store_id', $installer->getTable('core/store'), 'store_id',
|
143 |
+
Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE)
|
144 |
+
->setComment('Transactional Orders Data');
|
145 |
+
$installer->getConnection()->createTable($table);
|
146 |
+
|
147 |
+
|
148 |
+
/**
|
149 |
+
* Campaign table.
|
150 |
+
*/
|
151 |
+
$campaignTable = $installer->getTable('email_connector/campaign');
|
152 |
+
|
153 |
+
if ($installer->getConnection()->isTableExists($campaignTable)) {
|
154 |
+
$installer->getConnection()->dropTable($campaignTable);
|
155 |
+
}
|
156 |
+
|
157 |
+
$table = $installer->getConnection()->newTable($campaignTable);
|
158 |
+
$table->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
159 |
+
'primary' => true,
|
160 |
+
'identity' => true,
|
161 |
+
'unsigned' => true,
|
162 |
+
'nullable' => false
|
163 |
+
), 'Primary Key')
|
164 |
+
->addColumn('campaign_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
165 |
+
'unsigned' => true,
|
166 |
+
'nullable' => false,
|
167 |
+
), 'Campaign ID')
|
168 |
+
->addColumn('email', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
|
169 |
+
'nullable' => false,
|
170 |
+
'default' => ''
|
171 |
+
), 'Contact Email')
|
172 |
+
->addColumn('customer_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
173 |
+
'unsigned' => true,
|
174 |
+
'nullable' => false,
|
175 |
+
), 'Customer ID')
|
176 |
+
->addColumn('is_sent', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array(
|
177 |
+
'unsigned' => true,
|
178 |
+
'nullable' => true,
|
179 |
+
), 'Is Sent')
|
180 |
+
->addColumn('sent_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
|
181 |
+
), 'Send Date')
|
182 |
+
->addColumn('order_increment_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
183 |
+
'unsigned' => true,
|
184 |
+
'nullable' => false,
|
185 |
+
), 'Order Increment ID')
|
186 |
+
->addColumn('quote_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
187 |
+
'unsigned' => true,
|
188 |
+
'nullable' => false,
|
189 |
+
), 'Sales Quote ID')
|
190 |
+
->addColumn('message', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
|
191 |
+
'nullable' => false,
|
192 |
+
'default' => ''
|
193 |
+
), 'Errror Message')
|
194 |
+
->addColumn('checkout_method', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
|
195 |
+
'nullable' => false,
|
196 |
+
'default' => ''
|
197 |
+
), 'Checkout Method Used')
|
198 |
+
->addColumn('store_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
199 |
+
'unsigned' => true,
|
200 |
+
'nullable' => false,
|
201 |
+
'default' => '0'
|
202 |
+
), 'Store ID')
|
203 |
+
->addColumn('event_name', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
|
204 |
+
'nullable' => false,
|
205 |
+
'default' => ''
|
206 |
+
), 'Event Name')
|
207 |
+
->addColumn('created_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
|
208 |
+
), 'Creation Time')
|
209 |
+
->addColumn('updated_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
|
210 |
+
), 'Update Time')
|
211 |
+
|
212 |
+
->addIndex($this->getIdxName($campaignTable, array('store_id')),
|
213 |
+
array('store_id'))
|
214 |
+
->addIndex($this->getIdxName($campaignTable, array('campaign_id')),
|
215 |
+
array('campaign_id'))
|
216 |
+
->addIndex($this->getIdxName($campaignTable, array('email')),
|
217 |
+
array('email'))
|
218 |
+
->addIndex($this->getIdxName($campaignTable, array('is_sent')),
|
219 |
+
array('is_sent'))
|
220 |
+
->addForeignKey(
|
221 |
+
$installer->getFkName($campaignTable, 'store_id', 'core/store', 'store_id'),
|
222 |
+
'store_id', $installer->getTable('core/store'), 'store_id',
|
223 |
+
Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE)
|
224 |
+
->setComment('Connector Campaigns');
|
225 |
+
$installer->getConnection()->createTable($table);
|
226 |
+
|
227 |
+
/**
|
228 |
+
* Admin notification message
|
229 |
+
*/
|
230 |
+
|
231 |
+
$adminData = array();
|
232 |
+
$adminData[] = array(
|
233 |
+
'severity' => 4,
|
234 |
+
'date_added' => gmdate('Y-m-d H:i:s', time()),
|
235 |
+
'title' => 'Email Connector Was Installed. Please Enter Your API Credentials & Ensure Cron Jobs Are Running On Your Site (Find Out More)',
|
236 |
+
'description' => 'Email Connector Was Installed. Please Enter Your API Credentials & Ensure Cron Jobs Are Running On Your Site.',
|
237 |
+
'url' => 'http://www.magentocommerce.com/wiki/1_-_installation_and_configuration/how_to_setup_a_cron_job'
|
238 |
+
);
|
239 |
+
|
240 |
+
Mage::getModel('adminnotification/inbox')->parse($adminData);
|
241 |
+
|
242 |
+
/**
|
243 |
+
* Populate tables
|
244 |
+
*/
|
245 |
+
|
246 |
+
//customers populate
|
247 |
+
$select = $installer->getConnection()->select()
|
248 |
+
->from(
|
249 |
+
array('customer' => $this->getTable('customer_entity')),
|
250 |
+
array('customer_id' => 'entity_id','email','website_id','store_id')
|
251 |
+
);
|
252 |
+
|
253 |
+
$insertArray = array('customer_id','email','website_id','store_id');
|
254 |
+
$sqlQuery = $select->insertFromSelect($contactTable, $insertArray, false);
|
255 |
+
$installer->getConnection()->query($sqlQuery);
|
256 |
+
|
257 |
+
// subscribers that are not customers
|
258 |
+
$select = $installer->getConnection()->select()
|
259 |
+
->from(
|
260 |
+
array('subscriber' => $this->getTable('newsletter_subscriber')),
|
261 |
+
array(
|
262 |
+
'email' => 'subscriber_email',
|
263 |
+
'col2' => new Zend_Db_Expr('1'),
|
264 |
+
'col3' => new Zend_Db_Expr('1'),
|
265 |
+
'store_id'
|
266 |
+
)
|
267 |
+
)
|
268 |
+
->where('customer_id =?', 0 )
|
269 |
+
->where('subscriber_status =?', 1);
|
270 |
+
$insertArray = array('email','is_subscriber','subscriber_status','store_id');
|
271 |
+
$sqlQuery = $select->insertFromSelect($contactTable, $insertArray, false);
|
272 |
+
$installer->getConnection()->query($sqlQuery);
|
273 |
+
|
274 |
+
//Insert and populate email order the table
|
275 |
+
$select = $installer->getConnection()->select()
|
276 |
+
->from(
|
277 |
+
$this->getTable('sales/order'),
|
278 |
+
array('order_id' => 'entity_id', 'quote_id', 'store_id', 'created_at', 'updated_at')
|
279 |
+
);
|
280 |
+
$insertArray =
|
281 |
+
array('order_id', 'quote_id', 'store_id', 'created_at', 'updated_at');
|
282 |
+
|
283 |
+
$sqlQuery = $select->insertFromSelect($orderTable, $insertArray, false);
|
284 |
+
$installer->getConnection()->query($sqlQuery);
|
285 |
+
|
286 |
+
|
287 |
+
$installer->endSetup();
|
File without changes
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
|
5 |
+
$installer->startSetup();
|
6 |
+
|
7 |
+
|
8 |
+
$installer->endSetup();
|
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
$installer = $this;
|
5 |
+
|
6 |
+
$installer->startSetup();
|
7 |
+
|
8 |
+
try{
|
9 |
+
|
10 |
+
$installer->run(
|
11 |
+
"DROP TABLE IF EXISTS {$this->getTable('email_order')};
|
12 |
+
CREATE TABLE `{$this->getTable('email_order')}` (
|
13 |
+
`email_order_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
14 |
+
`order_id` int(15) unsigned DEFAULT NULL,
|
15 |
+
`quote_id` int(15) unsigned DEFAULT NULL,
|
16 |
+
`store_id` smallint(5) unsigned DEFAULT NULL,
|
17 |
+
`email_imported` tinyint(1) DEFAULT NULL,
|
18 |
+
`created_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
19 |
+
`updated_at` datetime DEFAULT NULL,
|
20 |
+
PRIMARY KEY (`email_order_id`),
|
21 |
+
KEY `IDX_EMAIL_STORE_ID` (`store_id`),
|
22 |
+
KEY `IDX_EMAIL_QUOTE_ID` (`quote_id`),
|
23 |
+
CONSTRAINT `FK_EMAIL_STORE_ID_CORE_STORE_STORE_ID` FOREIGN KEY (`store_id`) REFERENCES `{$this->getTable('core_store')}` (`store_id`) ON DELETE SET NULL ON UPDATE CASCADE
|
24 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;"
|
25 |
+
);
|
26 |
+
|
27 |
+
|
28 |
+
//Insert and populate email order the table
|
29 |
+
$installer->run(
|
30 |
+
"INSERT IGNORE INTO `{$this->getTable('email_order')}` (`order_id`, `quote_id`, `store_id`, `created_at`, `updated_at`)
|
31 |
+
SELECT `entity_id`, `quote_id`, `store_id`, `created_at`, `updated_at`
|
32 |
+
FROM `{$this->getTable('sales/order')}`;"
|
33 |
+
);
|
34 |
+
|
35 |
+
|
36 |
+
$installer->run(
|
37 |
+
"DROP TABLE IF EXISTS {$this->getTable('email_contact')};
|
38 |
+
CREATE TABLE `{$this->getTable('email_contact')}` (
|
39 |
+
`email_contact_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
40 |
+
`is_guest` smallint(1) DEFAULT NULL,
|
41 |
+
`contact_id` int(15) unsigned DEFAULT NULL,
|
42 |
+
`customer_id` int(10) unsigned DEFAULT NULL,
|
43 |
+
`website_id` smallint(5) unsigned DEFAULT NULL COMMENT 'Website Id',
|
44 |
+
`email` varchar(255) DEFAULT NULL,
|
45 |
+
`is_subscriber` tinyint(1)unsigned DEFAULT NULL,
|
46 |
+
`subscriber_status` int(10) unsigned DEFAULT '0',
|
47 |
+
`email_id` smallint(5) unsigned DEFAULT NULL,
|
48 |
+
`email_imported` tinyint(1) unsigned DEFAULT NULL,
|
49 |
+
`suppressed` smallint(1) DEFAULT NULL,
|
50 |
+
PRIMARY KEY (`email_contact_id`),
|
51 |
+
KEY `IDX_EMAIL_CONTACT_WEBSITE_ID` (`website_id`),
|
52 |
+
CONSTRAINT `FK_EMAIL_CONTACT_WEBSITE_ID_CORE_WEBSITE_WEBSITE_ID` FOREIGN KEY (`website_id`) REFERENCES `core_website` (`website_id`) ON DELETE SET NULL ON UPDATE CASCADE
|
53 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Email Contact Sync';"
|
54 |
+
);
|
55 |
+
|
56 |
+
|
57 |
+
//Insert and populate email contact table
|
58 |
+
$installer->run(
|
59 |
+
"INSERT IGNORE INTO `{$this->getTable('email_contact')}` (`customer_id`, `email`, `website_id`)
|
60 |
+
SELECT `entity_id`, `email`, `website_id`
|
61 |
+
FROM `{$this->getTable('customer_entity')}`;"
|
62 |
+
);
|
63 |
+
|
64 |
+
//Remove Order Attribute For Imported Data
|
65 |
+
$installer->removeAttribute('order', 'dotmailer_order_imported');
|
66 |
+
$installer->removeAttribute('customer', 'dotmailer_contact_id');
|
67 |
+
|
68 |
+
|
69 |
+
}catch (Exception $e){
|
70 |
+
|
71 |
+
Mage::log($e->getMessage());
|
72 |
+
|
73 |
+
}
|
74 |
+
|
75 |
+
$installer->endSetup();
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
$installer = $this;
|
5 |
+
|
6 |
+
$installer->startSetup();
|
7 |
+
|
8 |
+
|
9 |
+
$installer->endSetup();
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
|
5 |
+
$installer->startSetup();
|
6 |
+
|
7 |
+
|
8 |
+
$installer->run(
|
9 |
+
"DROP TABLE IF EXISTS {$this->getTable('email_contact')};
|
10 |
+
CREATE TABLE `{$this->getTable('email_contact')}` (
|
11 |
+
`email_contact_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
12 |
+
`is_guest` smallint(1) DEFAULT NULL,
|
13 |
+
`contact_id` int(15) unsigned DEFAULT NULL,
|
14 |
+
`customer_id` int(10) unsigned DEFAULT NULL,
|
15 |
+
`website_id` smallint(5) unsigned DEFAULT NULL COMMENT 'Website Id',
|
16 |
+
`email` varchar(255) DEFAULT NULL,
|
17 |
+
`is_subscriber` tinyint(1) unsigned DEFAULT NULL,
|
18 |
+
`subscriber_status` int(10) unsigned DEFAULT '0',
|
19 |
+
`subscriber_imported` tinyint(1) unsigned DEFAULT NULL,
|
20 |
+
`email_imported` tinyint(1) unsigned DEFAULT NULL,
|
21 |
+
`suppressed` smallint(1) DEFAULT NULL,
|
22 |
+
PRIMARY KEY (`email_contact_id`),
|
23 |
+
KEY `IDX_EMAIL_CONTACT_ID` (`email_contact_id`),
|
24 |
+
KEY `IDX_EMAIL_CONTACT_IS_GUEST` (`is_guest`),
|
25 |
+
KEY `IDX_EMAIL_CONTACT_CUSTOMER_ID` (`customer_id`),
|
26 |
+
KEY `IDX_EMAIL_CONTACT_WEBSITE_ID` (`website_id`),
|
27 |
+
KEY `IDX_EMAIL_CONTACT_IS_SUBSCRIBER` (`is_subscriber`),
|
28 |
+
KEY `IDX_EMAIL_CONTACT_SUBSCRIBER_STATUS` (`subscriber_status`),
|
29 |
+
KEY `IDX_EMAIL_CONTACT_SUBSCRIBER_IMPORTED` (`subscriber_imported`),
|
30 |
+
KEY `IDX_EMAIL_CONTACT_EMAIL_IMPORTED` (`email_imported`),
|
31 |
+
KEY `IDX_EMAIL_CONTACT_suppressed` (`suppressed`),
|
32 |
+
UNIQUE KEY `IDX_EMAIL_CONTACT_EMAIL` (`email`),
|
33 |
+
CONSTRAINT `FK_EMAIL_CONTACT_WEBSITE_ID_CORE_WEBSITE_WEBSITE_ID` FOREIGN KEY (`website_id`) REFERENCES `core_website` (`website_id`) ON DELETE SET NULL ON UPDATE CASCADE
|
34 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Email Contacts';"
|
35 |
+
);
|
36 |
+
|
37 |
+
|
38 |
+
//Insert and populate email contact table
|
39 |
+
$installer->run(
|
40 |
+
"INSERT IGNORE INTO `{$this->getTable('email_contact')}` (`customer_id`, `email`, `website_id`)
|
41 |
+
SELECT `entity_id`, `email`, `website_id`
|
42 |
+
FROM `{$this->getTable('customer_entity')}`;"
|
43 |
+
);
|
44 |
+
|
45 |
+
//Subscribers that are not customers
|
46 |
+
$installer->run("
|
47 |
+
INSERT IGNORE INTO {$this->getTable('email_contact')} (`email`, `is_subscriber`, `subscriber_status`)
|
48 |
+
SELECT `subscriber_email`, '1' as col2, '1' as col3 FROM `{$this->getTable('newsletter/subscriber')}` WHERE `customer_id` = 0 AND `subscriber_status` = 1;
|
49 |
+
");
|
50 |
+
|
51 |
+
|
52 |
+
$installer->endSetup();
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
|
5 |
+
|
6 |
+
$installer->startSetup();
|
7 |
+
|
8 |
+
|
9 |
+
$installer->run("
|
10 |
+
ALTER TABLE `{$this->getTable('email_contact')}`
|
11 |
+
|
12 |
+
DROP FOREIGN KEY `FK_EMAIL_CONTACT_WEBSITE_ID_CORE_WEBSITE_WEBSITE_ID`,
|
13 |
+
CHANGE COLUMN `website_id` `website_id` smallint(5) unsigned DEFAULT '0' AFTER `customer_id`;
|
14 |
+
");
|
15 |
+
|
16 |
+
$installer->run("
|
17 |
+
UPDATE `{$this->getTable('email_contact')}` SET `website_id` = '0'
|
18 |
+
WHERE `website_id` IS NULL;
|
19 |
+
");
|
20 |
+
|
21 |
+
$installer->run("
|
22 |
+
ALTER TABLE `{$this->getTable('email_contact')}`
|
23 |
+
ADD CONSTRAINT `FK_EMAIL_CONTACT_WEBSITE_ID_CORE_WEBSITE_WEBSITE_ID` FOREIGN KEY (`website_id`) REFERENCES `{$installer->getTable('core_website')}` (`website_id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
24 |
+
|
25 |
+
");
|
26 |
+
|
27 |
+
|
28 |
+
$installer->endSetup();
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
|
5 |
+
|
6 |
+
$installer->startSetup();
|
7 |
+
|
8 |
+
|
9 |
+
$installer->endSetup();
|
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
$installer = $this;
|
5 |
+
|
6 |
+
$installer->startSetup();
|
7 |
+
/**
|
8 |
+
* Campaign table.
|
9 |
+
*/
|
10 |
+
$campaignTable = $installer->getTable('email_connector/campaign');
|
11 |
+
|
12 |
+
if ($installer->getConnection()->isTableExists($campaignTable)) {
|
13 |
+
$installer->getConnection()->dropTable($campaignTable);
|
14 |
+
}
|
15 |
+
|
16 |
+
$table = $installer->getConnection()->newTable($campaignTable);
|
17 |
+
$table->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
18 |
+
'primary' => true,
|
19 |
+
'identity' => true,
|
20 |
+
'unsigned' => true,
|
21 |
+
'nullable' => false
|
22 |
+
), 'Primary Key')
|
23 |
+
->addColumn('campaign_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
24 |
+
'unsigned' => true,
|
25 |
+
'nullable' => false,
|
26 |
+
), 'Campaign ID')
|
27 |
+
->addColumn('email', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
|
28 |
+
'nullable' => false,
|
29 |
+
'default' => ''
|
30 |
+
), 'Contact Email')
|
31 |
+
->addColumn('customer_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
32 |
+
'unsigned' => true,
|
33 |
+
'nullable' => false,
|
34 |
+
), 'Customer ID')
|
35 |
+
->addColumn('is_sent', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array(
|
36 |
+
'unsigned' => true,
|
37 |
+
'nullable' => true,
|
38 |
+
), 'Is Sent')
|
39 |
+
->addColumn('sent_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
|
40 |
+
), 'Send Date')
|
41 |
+
->addColumn('order_increment_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
42 |
+
'unsigned' => true,
|
43 |
+
'nullable' => false,
|
44 |
+
), 'Order Increment ID')
|
45 |
+
->addColumn('quote_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
46 |
+
'unsigned' => true,
|
47 |
+
'nullable' => false,
|
48 |
+
), 'Sales Quote ID')
|
49 |
+
->addColumn('message', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
|
50 |
+
'nullable' => false,
|
51 |
+
'default' => ''
|
52 |
+
), 'Errror Message')
|
53 |
+
->addColumn('checkout_method', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
|
54 |
+
'nullable' => false,
|
55 |
+
'default' => ''
|
56 |
+
), 'Checkout Method Used')
|
57 |
+
->addColumn('store_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
58 |
+
'unsigned' => true,
|
59 |
+
'nullable' => false,
|
60 |
+
'default' => '0'
|
61 |
+
), 'Store ID')
|
62 |
+
->addColumn('event_name', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
|
63 |
+
'nullable' => false,
|
64 |
+
'default' => ''
|
65 |
+
), 'Event Name')
|
66 |
+
->addColumn('created_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
|
67 |
+
), 'Creation Time')
|
68 |
+
->addColumn('updated_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
|
69 |
+
), 'Update Time')
|
70 |
+
|
71 |
+
->addIndex($this->getIdxName($campaignTable, array('store_id')),
|
72 |
+
array('store_id'))
|
73 |
+
->addIndex($this->getIdxName($campaignTable, array('campaign_id')),
|
74 |
+
array('campaign_id'))
|
75 |
+
->addIndex($this->getIdxName($campaignTable, array('email')),
|
76 |
+
array('email'))
|
77 |
+
->addIndex($this->getIdxName($campaignTable, array('is_sent')),
|
78 |
+
array('is_sent'))
|
79 |
+
->addForeignKey(
|
80 |
+
$installer->getFkName($campaignTable, 'store_id', 'core/store', 'store_id'),
|
81 |
+
'store_id', $installer->getTable('core/store'), 'store_id',
|
82 |
+
Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE)
|
83 |
+
->setComment('Connector Campaigns');
|
84 |
+
$installer->getConnection()->createTable($table);
|
85 |
+
|
86 |
+
/**
|
87 |
+
* remove contact column
|
88 |
+
*/
|
89 |
+
$installer->getConnection()->dropColumn($installer->getTable('email_connector/contact'), 'subscriber_imported');
|
90 |
+
|
91 |
+
/*
|
92 |
+
* Cleaning
|
93 |
+
*/
|
94 |
+
$entityTypeId = $installer->getEntityTypeId('customer');
|
95 |
+
if ($installer->attributeExists($entityTypeId, 'dotmailer_contact_id'))
|
96 |
+
$installer->removeAttribute($entityTypeId, 'dotmailer_contact_id');
|
97 |
+
|
98 |
+
$entityTypeId = $installer->getEntityTypeId('order');
|
99 |
+
if($installer->attributeExists($entityTypeId, 'dotmailer_order_imported'))
|
100 |
+
$installer->removeAttribute($entityTypeId, 'dotmailer_order_imported');
|
101 |
+
|
102 |
+
|
103 |
+
$installer->endSetup();
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
|
5 |
+
|
6 |
+
$installer->startSetup();
|
7 |
+
|
8 |
+
$admin = $this->getTable('admin/user');
|
9 |
+
|
10 |
+
$installer->getConnection()->addColumn($installer->getTable('admin/user'), 'refresh_token', array(
|
11 |
+
'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
|
12 |
+
'length' => 256,
|
13 |
+
'nullable' => true,
|
14 |
+
'default' => null,
|
15 |
+
'comment' => 'Email connector refresh token'
|
16 |
+
));
|
17 |
+
|
18 |
+
$installer->endSetup();
|
@@ -1,18 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Dotdigitalgroup_Email_Block_Adminhtml_System_Bestsellers extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
-
{
|
5 |
-
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
6 |
-
{
|
7 |
-
$baseUr = preg_replace('/index.php\//', '', Mage::getBaseUrl());
|
8 |
-
$code = Mage::helper('connector')->getPasscode();
|
9 |
-
$order = Mage::helper('connector')->getLastOrderNo();
|
10 |
-
if(!strlen($code)) $code = '[PLEASE SET UP A PASSCODE]';
|
11 |
-
if(!$order) $order = '[PLEASE MAP THE LAST ORDER NO]';
|
12 |
-
$text = $baseUr . 'connector/email/products/order/@' . $order . '@/code/' . $code . '/mode/bestsellers';
|
13 |
-
$element->setData('value', $text);
|
14 |
-
$element->setData('disabled', 'disabled');
|
15 |
-
return parent::_getElementHtml($element);
|
16 |
-
|
17 |
-
}
|
18 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,104 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Dotdigitalgroup_Email_Block_Adminhtml_System_Config_Gridlist extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
-
{
|
5 |
-
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
6 |
-
{
|
7 |
-
// Get the default HTML for this option
|
8 |
-
$html = parent::_getElementHtml($element);
|
9 |
-
|
10 |
-
|
11 |
-
$jQuery = '<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" ></script>';
|
12 |
-
|
13 |
-
$jQuery .='
|
14 |
-
<script type="text/javascript">
|
15 |
-
jQuery.noConflict();
|
16 |
-
jQuery(document).ready(function() {
|
17 |
-
var gridOptions = {
|
18 |
-
"4" : "4",
|
19 |
-
"8" : "8",
|
20 |
-
"12" : "12",
|
21 |
-
"16" : "16",
|
22 |
-
"20" : "20",
|
23 |
-
"24" : "24",
|
24 |
-
"28" : "28",
|
25 |
-
"32" : "32"
|
26 |
-
|
27 |
-
};
|
28 |
-
var listOptions = {
|
29 |
-
"2" : "2",
|
30 |
-
"4" : "4",
|
31 |
-
"6" : "6",
|
32 |
-
"8" : "8"
|
33 |
-
}
|
34 |
-
|
35 |
-
jQuery("#dynamic_content_products_related_display_type").change(function(){
|
36 |
-
|
37 |
-
var display_type = jQuery(this).closest("tr").next().find("select");
|
38 |
-
var display_mode = jQuery(this).val();
|
39 |
-
changeOptions(display_type, display_mode);
|
40 |
-
|
41 |
-
|
42 |
-
});
|
43 |
-
|
44 |
-
jQuery("#dynamic_content_products_upsell_display_type").change(function(){
|
45 |
-
var display_type = jQuery(this).closest("tr").next().find("select");
|
46 |
-
var display_mode = jQuery(this).val();
|
47 |
-
changeOptions(display_type, display_mode);
|
48 |
-
|
49 |
-
});
|
50 |
-
jQuery("#dynamic_content_products_crosssell_display_type").change(function(){
|
51 |
-
var display_type = jQuery(this).closest("tr").next().find("select");
|
52 |
-
var display_mode = jQuery(this).val();
|
53 |
-
changeOptions(display_type, display_mode);
|
54 |
-
});
|
55 |
-
jQuery("#dynamic_content_products_best_display_type").change(function(){
|
56 |
-
var display_type = jQuery(this).closest("tr").next().find("select");
|
57 |
-
var display_mode = jQuery(this).val();
|
58 |
-
changeOptions(display_type, display_mode);
|
59 |
-
});
|
60 |
-
jQuery("#dynamic_content_products_most_viewed_display_type").change(function(){
|
61 |
-
var display_type = jQuery(this).closest("tr").next().find("select");
|
62 |
-
var display_mode = jQuery(this).val();
|
63 |
-
changeOptions(display_type, display_mode);
|
64 |
-
});
|
65 |
-
jQuery("#dynamic_content_manual_product_search_display_type").change(function(){
|
66 |
-
var display_type = jQuery(this).closest("tr").next().find("select");
|
67 |
-
var display_mode = jQuery(this).val();
|
68 |
-
changeOptions(display_type, display_mode);
|
69 |
-
});
|
70 |
-
jQuery("#dynamic_content_products_recently_viewed_display_type").change(function(){
|
71 |
-
var display_type = jQuery(this).closest("tr").next().find("select");
|
72 |
-
var display_mode = jQuery(this).val();
|
73 |
-
changeOptions(display_type, display_mode);
|
74 |
-
});
|
75 |
-
|
76 |
-
function changeOptions(display_type, display_mode){
|
77 |
-
if(display_mode == "list"){
|
78 |
-
display_type.empty();
|
79 |
-
|
80 |
-
jQuery.each(listOptions, function(key, value) {
|
81 |
-
display_type.append(jQuery("<option></option>")
|
82 |
-
.attr("value", value).text(key));
|
83 |
-
});
|
84 |
-
|
85 |
-
}
|
86 |
-
if(display_mode == "grid"){
|
87 |
-
display_type.empty();
|
88 |
-
jQuery.each(gridOptions, function(key, value) {
|
89 |
-
display_type.append(jQuery("<option></option>")
|
90 |
-
.attr("value", value).text(key));
|
91 |
-
});
|
92 |
-
}
|
93 |
-
}
|
94 |
-
|
95 |
-
});
|
96 |
-
</script>';
|
97 |
-
|
98 |
-
$html .= $jQuery;
|
99 |
-
|
100 |
-
return $html;
|
101 |
-
}
|
102 |
-
|
103 |
-
|
104 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,13 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Dotdigitalgroup_Email_Block_Adminhtml_System_Config_Insertvariable extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
-
{
|
5 |
-
public function _getElementHtml($element){
|
6 |
-
|
7 |
-
$element->setData('onclick', 'templateControl.openVariableChooser();return false;');
|
8 |
-
|
9 |
-
|
10 |
-
return parent::_getElementHtml($element);
|
11 |
-
}
|
12 |
-
|
13 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,46 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Dotdigitalgroup_Email_Block_Adminhtml_System_Config_Messagedefault extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
-
{
|
5 |
-
const DEFAULT_TEXT = 'Default SMS Text';
|
6 |
-
|
7 |
-
protected function _getElementHtml(Varien_Data_Form_Element_Abstract$element){
|
8 |
-
|
9 |
-
|
10 |
-
$element->setData('placeholder', self::DEFAULT_TEXT);
|
11 |
-
|
12 |
-
$element->setData('after_element_html', "
|
13 |
-
|
14 |
-
<a href='#' onclick=\"injectText('sms_section_sms_message_one_message', '{{var order_number}}');return false;\">Insert Order Number</a>
|
15 |
-
<a href='#' onclick=\"injectText('sms_section_sms_message_one_message', '{{var customer_name}}');return false;\">Insert Customer Name</a>
|
16 |
-
|
17 |
-
<script type='text/javascript'>
|
18 |
-
|
19 |
-
function addText(text){
|
20 |
-
$('sms_section_sms_message_one_message').value += text;
|
21 |
-
}
|
22 |
-
|
23 |
-
function injectText(element,value){
|
24 |
-
var element_dom=document.getElementById(element);
|
25 |
-
if(document.selection){
|
26 |
-
element_dom.focus();
|
27 |
-
sel=document.selection.createRange();
|
28 |
-
sel.text=value;
|
29 |
-
return;
|
30 |
-
}if(element_dom.selectionStart||element_dom.selectionStart=='0'){
|
31 |
-
var t_start=element_dom.selectionStart;
|
32 |
-
var t_end=element_dom.selectionEnd;
|
33 |
-
var val_start=element_dom.value.substring(0,t_start);
|
34 |
-
var val_end=element_dom.value.substring(t_end,element_dom.value.length);
|
35 |
-
element_dom.value=val_start+value+val_end;
|
36 |
-
}else{
|
37 |
-
element_dom.value+=value;
|
38 |
-
}
|
39 |
-
}
|
40 |
-
</script>
|
41 |
-
");
|
42 |
-
return parent::_getElementHtml($element);
|
43 |
-
}
|
44 |
-
|
45 |
-
|
46 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,23 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Dotdigitalgroup_Email_Block_Adminhtml_System_Config_Smsmessagefour extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
-
{
|
5 |
-
const DEFAULT_TEXT = 'Default SMS Text';
|
6 |
-
|
7 |
-
protected function _getElementHtml(Varien_Data_Form_Element_Abstract$element){
|
8 |
-
|
9 |
-
|
10 |
-
$element->setData('placeholder', self::DEFAULT_TEXT);
|
11 |
-
|
12 |
-
$element->setData('after_element_html', "
|
13 |
-
|
14 |
-
<a href='#' onclick=\"injectText('sms_section_sms_message_four_message', '{{var order_number}}');return false;\">Insert Order Number</a>
|
15 |
-
<a href='#' onclick=\"injectText('sms_section_sms_message_four_message', '{{var customer_name}}');return false;\">Insert Customer Name</a>
|
16 |
-
|
17 |
-
|
18 |
-
");
|
19 |
-
return parent::_getElementHtml($element);
|
20 |
-
}
|
21 |
-
|
22 |
-
|
23 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,23 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Dotdigitalgroup_Email_Block_Adminhtml_System_Config_Smsmessagethree extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
-
{
|
5 |
-
const DEFAULT_TEXT = 'Default SMS Text';
|
6 |
-
|
7 |
-
protected function _getElementHtml(Varien_Data_Form_Element_Abstract$element){
|
8 |
-
|
9 |
-
|
10 |
-
$element->setData('placeholder', self::DEFAULT_TEXT);
|
11 |
-
|
12 |
-
$element->setData('after_element_html', "
|
13 |
-
|
14 |
-
<a href='#' onclick=\"injectText('sms_section_sms_message_three_message', '{{var order_number}}');return false;\">Insert Order Number</a>
|
15 |
-
<a href='#' onclick=\"injectText('sms_section_sms_message_three_message', '{{var customer_name}}');return false;\">Insert Customer Name</a>
|
16 |
-
|
17 |
-
|
18 |
-
");
|
19 |
-
return parent::_getElementHtml($element);
|
20 |
-
}
|
21 |
-
|
22 |
-
|
23 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,23 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Dotdigitalgroup_Email_Block_Adminhtml_System_Config_Smsmessagetwo extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
-
{
|
5 |
-
const DEFAULT_TEXT = 'Default SMS Text';
|
6 |
-
|
7 |
-
protected function _getElementHtml(Varien_Data_Form_Element_Abstract$element){
|
8 |
-
|
9 |
-
|
10 |
-
$element->setData('placeholder', self::DEFAULT_TEXT);
|
11 |
-
|
12 |
-
$element->setData('after_element_html', "
|
13 |
-
|
14 |
-
<a href='#' onclick=\"injectText('sms_section_sms_message_two_message', '{{var order_number}}');return false;\">Insert Order Number</a>
|
15 |
-
<a href='#' onclick=\"injectText('sms_section_sms_message_two_message', '{{var customer_name}}');return false;\">Insert Customer Name</a>
|
16 |
-
|
17 |
-
|
18 |
-
");
|
19 |
-
return parent::_getElementHtml($element);
|
20 |
-
}
|
21 |
-
|
22 |
-
|
23 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,18 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Dotdigitalgroup_Email_Block_Adminhtml_System_Couponinfo extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
-
{
|
5 |
-
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
6 |
-
{
|
7 |
-
$baseUr = preg_replace('/index.php\//', '', Mage::getBaseUrl());
|
8 |
-
$code = Mage::helper('connector')->getPasscode();
|
9 |
-
if(!strlen($code))
|
10 |
-
$code = '[PLEASE SET UP A PASSCODE]';
|
11 |
-
$text = $baseUr . 'connector/email/coupon/id/[INSERT ID HERE]/code/'. $code;
|
12 |
-
|
13 |
-
$element->setData('value', $text);
|
14 |
-
$element->setData('disabled', 'disabled');
|
15 |
-
return parent::_getElementHtml($element);
|
16 |
-
}
|
17 |
-
|
18 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,20 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Dotdigitalgroup_Email_Block_Adminhtml_System_Crosssell extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
-
{
|
5 |
-
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
6 |
-
{
|
7 |
-
$baseUr = preg_replace('/index.php\//', '', Mage::getBaseUrl());
|
8 |
-
$helper = Mage::helper('connector');
|
9 |
-
$code = $helper->getPasscode();
|
10 |
-
$order = $helper->getLastOrderNo();
|
11 |
-
|
12 |
-
if(!strlen($code) && !strlen($order)) $code = '[PLEASE SET UP A PASSCODE]';
|
13 |
-
if(!$order) $order = '[PLEASE MAP THE LAST ORDER NO]';
|
14 |
-
|
15 |
-
$text = $baseUr . 'connector/email/products/order/@' . $order . '@/code/' . $code . '/mode/crosssell';
|
16 |
-
$element->setData('value', $text);
|
17 |
-
$element->setData('disabled', 'disabled');
|
18 |
-
return parent::_getElementHtml($element);
|
19 |
-
}
|
20 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,19 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Dotdigitalgroup_Email_Block_Adminhtml_System_Lostbasket extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
-
{
|
5 |
-
|
6 |
-
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
7 |
-
{
|
8 |
-
$baseUr = preg_replace('/index.php\//', '', Mage::getBaseUrl());
|
9 |
-
$code = Mage::helper('connector')->getPasscode();
|
10 |
-
if(!strlen($code))
|
11 |
-
$code = '[PLEASE SET UP A PASSCODE]';
|
12 |
-
$text = $baseUr . 'connector/email/basket/email/@EMAIL@/code/'. $code;
|
13 |
-
|
14 |
-
$element->setData('value', $text);
|
15 |
-
$element->setData('disabled', 'disabled');
|
16 |
-
return parent::_getElementHtml($element);
|
17 |
-
}
|
18 |
-
|
19 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,18 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Dotdigitalgroup_Email_Block_Adminhtml_System_Mostviewed extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
-
{
|
5 |
-
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
6 |
-
{
|
7 |
-
$baseUr = preg_replace('/index.php\//', '', Mage::getBaseUrl());
|
8 |
-
$code = Mage::helper('connector')->getPasscode();
|
9 |
-
$order = Mage::helper('connector')->getLastOrderNo();
|
10 |
-
if(!strlen($code)) $code = '[PLEASE SET UP A PASSCODE]';
|
11 |
-
if(!$order) $order = '[PLEASE MAP THE LAST ORDER NO]';
|
12 |
-
$text = $baseUr . 'connector/email/products/order/@' . $order . '@/code/' . $code . '/mode/mostviewed';
|
13 |
-
$element->setData('value', $text);
|
14 |
-
$element->setData('disabled', 'disabled');
|
15 |
-
return parent::_getElementHtml($element);
|
16 |
-
|
17 |
-
}
|
18 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,19 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Dotdigitalgroup_Email_Block_Adminhtml_System_Productpush extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
-
{
|
5 |
-
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
6 |
-
{
|
7 |
-
$baseUr = preg_replace('/index.php\//', '', Mage::getBaseUrl());
|
8 |
-
$helper = Mage::helper('connector');
|
9 |
-
$code = $helper->getPasscode();
|
10 |
-
$order = $helper->getLastOrderNo();
|
11 |
-
if(!strlen($code)) $code = '[PLEASE SET UP A PASSCODE]';
|
12 |
-
if(!$order) $order = '[PLEASE MAP THE LAST ORDER NO]';
|
13 |
-
$text = $baseUr . 'connector/email/products/order/@' . $order . '@/code/' . $code . '/mode/productpush';
|
14 |
-
$element->setData('value', $text);
|
15 |
-
$element->setData('disabled', 'disabled');
|
16 |
-
return parent::_getElementHtml($element);
|
17 |
-
|
18 |
-
}
|
19 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,20 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class Dotdigitalgroup_Email_Block_Adminhtml_System_Recentlyviewed extends Mage_Adminhtml_Block_System_Config_Form_Field
|
3 |
-
{
|
4 |
-
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
5 |
-
{
|
6 |
-
$baseUr = preg_replace('/index.php\//', '', Mage::getBaseUrl());
|
7 |
-
$helper = Mage::helper('connector');
|
8 |
-
$code = $helper->getPasscode();
|
9 |
-
|
10 |
-
$customerId = $helper->getMappedCustomerId();
|
11 |
-
|
12 |
-
if(!strlen($code)) $code = '[PLEASE SET UP A PASSCODE]';
|
13 |
-
if(!$customerId) $customerId = '[PLEASE MAP THE CUSTOMER ID]';
|
14 |
-
$text = $baseUr . 'connector/email/products/customer/@' . $customerId . '@/code/' . $code . '/mode/recentlyviewed';
|
15 |
-
$element->setData('value', $text);
|
16 |
-
$element->setData('disabled', 'disabled');
|
17 |
-
return parent::_getElementHtml($element);
|
18 |
-
|
19 |
-
}
|
20 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,19 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Dotdigitalgroup_Email_Block_Adminhtml_System_Related extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
-
{
|
5 |
-
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
6 |
-
{
|
7 |
-
$baseUr = preg_replace('/index.php\//', '', Mage::getBaseUrl());
|
8 |
-
$helper = Mage::helper('connector');
|
9 |
-
$code = $helper->getPasscode();
|
10 |
-
$order = $helper->getLastOrderNo();
|
11 |
-
if(!strlen($code)) $code = '[PLEASE SET UP A PASSCODE]';
|
12 |
-
if(!$order) $order = '[PLEASE MAP THE LAST ORDER NO]';
|
13 |
-
$text = $baseUr . 'connector/email/products/order/@' . $order . '@/code/' . $code . '/mode/related';
|
14 |
-
$element->setData('value', $text);
|
15 |
-
|
16 |
-
return parent::_getElementHtml($element);
|
17 |
-
|
18 |
-
}
|
19 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,19 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class Dotdigitalgroup_Email_Block_Adminhtml_System_Upsell extends Mage_Adminhtml_Block_System_Config_Form_Field
|
3 |
-
{
|
4 |
-
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
5 |
-
{
|
6 |
-
$baseUr = preg_replace('/index.php\//', '', Mage::getBaseUrl());
|
7 |
-
$helper = Mage::helper('connector');
|
8 |
-
$code = $helper->getPasscode();
|
9 |
-
$order = $helper->getLastOrderNo();
|
10 |
-
|
11 |
-
if(!strlen($code)) $code = '[PLEASE SET UP A PASSCODE]';
|
12 |
-
if(!$order) $order = '[PLEASE MAP THE LAST ORDER NO]';
|
13 |
-
|
14 |
-
$text = $baseUr . 'connector/email/products/order/@' . $order . '@/code/' . $code . '/mode/upsell';
|
15 |
-
$element->setData('value', $text);
|
16 |
-
|
17 |
-
return parent::_getElementHtml($element);
|
18 |
-
}
|
19 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,21 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Dotdigitalgroup_Email_Block_Debug_Forcecustomersync extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
-
{
|
5 |
-
|
6 |
-
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
|
7 |
-
$this->setElement($element);
|
8 |
-
return $this->_getAddRowButtonHtml($this->__('Sync Customer Data Now'));
|
9 |
-
}
|
10 |
-
|
11 |
-
protected function _getAddRowButtonHtml($title) {
|
12 |
-
$url = Mage::helper('adminhtml')->getUrl("connector/debug/forcecustomersync");
|
13 |
-
|
14 |
-
return $this->getLayout()->createBlock('adminhtml/widget_button')
|
15 |
-
->setType('button')
|
16 |
-
->setLabel($this->__($title))
|
17 |
-
->setOnClick("window.location.href='" . $url . "'")
|
18 |
-
->toHtml();
|
19 |
-
}
|
20 |
-
|
21 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,21 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Dotdigitalgroup_Email_Block_Debug_Forcelostbasketsync extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
-
{
|
5 |
-
|
6 |
-
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
|
7 |
-
$this->setElement($element);
|
8 |
-
return $this->_getAddRowButtonHtml($this->__('Sync Lost Baskets Now'));
|
9 |
-
}
|
10 |
-
|
11 |
-
protected function _getAddRowButtonHtml($title) {
|
12 |
-
$url = Mage::helper('adminhtml')->getUrl("connector/debug/forcelostbasketsync");
|
13 |
-
|
14 |
-
return $this->getLayout()->createBlock('adminhtml/widget_button')
|
15 |
-
->setType('button')
|
16 |
-
->setLabel($this->__($title))
|
17 |
-
->setOnClick("window.location.href='" . $url . "'")
|
18 |
-
->toHtml();
|
19 |
-
}
|
20 |
-
|
21 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,21 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Dotdigitalgroup_Email_Block_Debug_Forcesuppressedsync extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
-
{
|
5 |
-
|
6 |
-
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
|
7 |
-
$this->setElement($element);
|
8 |
-
return $this->_getAddRowButtonHtml($this->__('Sync Suppressed Data Now'));
|
9 |
-
}
|
10 |
-
|
11 |
-
protected function _getAddRowButtonHtml($title) {
|
12 |
-
$url = Mage::helper('adminhtml')->getUrl("connector/debug/forcesuppressed");
|
13 |
-
|
14 |
-
return $this->getLayout()->createBlock('adminhtml/widget_button')
|
15 |
-
->setType('button')
|
16 |
-
->setLabel($this->__($title))
|
17 |
-
->setOnClick("window.location.href='" . $url . "'")
|
18 |
-
->toHtml();
|
19 |
-
}
|
20 |
-
|
21 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,21 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Dotdigitalgroup_Email_Block_Debug_Rescuenow extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
-
{
|
5 |
-
|
6 |
-
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
|
7 |
-
$this->setElement($element);
|
8 |
-
return $this->_getAddRowButtonHtml($this->__('Send Lost Basket Campaigns Now'));
|
9 |
-
}
|
10 |
-
|
11 |
-
protected function _getAddRowButtonHtml($title) {
|
12 |
-
$url = Mage::helper('adminhtml')->getUrl("connector/debug/rescuenow");
|
13 |
-
|
14 |
-
return $this->getLayout()->createBlock('adminhtml/widget_button')
|
15 |
-
->setType('button')
|
16 |
-
->setLabel($this->__($title))
|
17 |
-
->setOnClick("window.location.href='" . $url . "'")
|
18 |
-
->toHtml();
|
19 |
-
}
|
20 |
-
|
21 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,21 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Dotdigitalgroup_Email_Block_Debug_Testcredentials extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
-
{
|
5 |
-
|
6 |
-
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
|
7 |
-
$this->setElement($element);
|
8 |
-
return $this->_getAddRowButtonHtml($this->__('Test Credentials'));
|
9 |
-
}
|
10 |
-
|
11 |
-
protected function _getAddRowButtonHtml($title) {
|
12 |
-
$url = Mage::helper('adminhtml')->getUrl("connector/debug/testcredentials");
|
13 |
-
|
14 |
-
return $this->getLayout()->createBlock('adminhtml/widget_button')
|
15 |
-
->setType('button')
|
16 |
-
->setLabel($this->__($title))
|
17 |
-
->setOnClick("window.location.href='" . $url . "'")
|
18 |
-
->toHtml();
|
19 |
-
}
|
20 |
-
|
21 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,20 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Dotdigitalgroup_Email_Block_Debug_Transactionalsync extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
-
{
|
5 |
-
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
|
6 |
-
$this->setElement($element);
|
7 |
-
return $this->_getAddRowButtonHtml($this->__('Run Baskets/Orders Synchronization'));
|
8 |
-
}
|
9 |
-
|
10 |
-
protected function _getAddRowButtonHtml($title) {
|
11 |
-
$url = Mage::helper('adminhtml')->getUrl("connector/debug/transactionalSync");
|
12 |
-
|
13 |
-
return $this->getLayout()->createBlock('adminhtml/widget_button')
|
14 |
-
->setType('button')
|
15 |
-
->setLabel($this->__($title))
|
16 |
-
->setOnClick("window.location.href='" . $url . "'")
|
17 |
-
->toHtml();
|
18 |
-
}
|
19 |
-
|
20 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,53 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Dotdigitalgroup_Email_Block_Products extends Mage_Core_Block_Template
|
4 |
-
{
|
5 |
-
/**
|
6 |
-
* get the products to display for table
|
7 |
-
*/
|
8 |
-
public function getRecommendedProducts()
|
9 |
-
{
|
10 |
-
//get all params
|
11 |
-
$params = $this->getRequest()->getParams();
|
12 |
-
$productsToDisplay = array();
|
13 |
-
|
14 |
-
if(isset($params['customer'])){
|
15 |
-
$productRecommended = new Dotdigitalgroup_Email_Model_Dynamic_Recommended();
|
16 |
-
$productsToDisplay = $productRecommended->getProducts();
|
17 |
-
$orderId = false;
|
18 |
-
|
19 |
-
}else{
|
20 |
-
|
21 |
-
$orderId = $params['order'];
|
22 |
-
}
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
if($orderId){
|
27 |
-
$orderModel = Mage::getModel('sales/order')->load($orderId);
|
28 |
-
if($orderModel->getId()){
|
29 |
-
//order products
|
30 |
-
$productRecommended = new Dotdigitalgroup_Email_Model_Dynamic_Recommended($orderModel);
|
31 |
-
|
32 |
-
//get the order items recommendations
|
33 |
-
$productsToDisplay = $productRecommended->getProducts();
|
34 |
-
}
|
35 |
-
}
|
36 |
-
|
37 |
-
return $productsToDisplay;
|
38 |
-
}
|
39 |
-
|
40 |
-
|
41 |
-
public function getPriceHtml($product)
|
42 |
-
{
|
43 |
-
$this->setTemplate('connector/price.phtml');
|
44 |
-
$this->setProduct($product);
|
45 |
-
return $this->toHtml();
|
46 |
-
}
|
47 |
-
|
48 |
-
public function getMode()
|
49 |
-
{
|
50 |
-
return Mage::helper('connector/recommended')->getMode();
|
51 |
-
|
52 |
-
}
|
53 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,182 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* mag17.
|
4 |
-
*
|
5 |
-
* User: chrisroseuk
|
6 |
-
* Date: 19/04/2013
|
7 |
-
* Time: 17:10
|
8 |
-
*
|
9 |
-
*/
|
10 |
-
|
11 |
-
/*
|
12 |
-
*
|
13 |
-
* using System;
|
14 |
-
using System.Collections.Generic;
|
15 |
-
using System.IO;
|
16 |
-
using System.Net;
|
17 |
-
using System.Text;
|
18 |
-
using System.Threading;
|
19 |
-
using Newtonsoft.Json;
|
20 |
-
|
21 |
-
namespace Email.ImportContacts
|
22 |
-
{
|
23 |
-
class Program
|
24 |
-
{
|
25 |
-
private const string UserName = "";
|
26 |
-
private const string Password = "";
|
27 |
-
private const int AddressBookId = 1188372; //Your address book here
|
28 |
-
|
29 |
-
static void Main(string[] args)
|
30 |
-
{
|
31 |
-
AppDomain.CurrentDomain.UnhandledException += PrintUnhandledException;
|
32 |
-
|
33 |
-
ApiContactImport contactImport = ImportContactsFromFile();
|
34 |
-
ApiContactImport contactImportResult = WaitUntilImportFinishes(contactImport);
|
35 |
-
PrintContactImport(contactImportResult);
|
36 |
-
|
37 |
-
Dictionary<String, String> contactImportReport = GetContactImportReport(contactImportResult.Id);
|
38 |
-
PrintContactImportReport(contactImportReport);
|
39 |
-
|
40 |
-
String csvReport = GetContactImportFaults(contactImportResult.Id);
|
41 |
-
PrintCsvReport(csvReport);
|
42 |
-
}
|
43 |
-
|
44 |
-
private static String GetContactImportFaults(Guid importId)
|
45 |
-
{
|
46 |
-
string url = String.Format("https://apiconnector.com/v2/contacts/import/{0}/report-faults", importId);
|
47 |
-
HttpWebRequest request = CreateRequest(url);
|
48 |
-
String result = ReadResultAsString(request);
|
49 |
-
return result;
|
50 |
-
}
|
51 |
-
|
52 |
-
private static void PrintCsvReport(string csvReport)
|
53 |
-
{
|
54 |
-
Console.WriteLine();
|
55 |
-
Console.WriteLine(csvReport);
|
56 |
-
}
|
57 |
-
|
58 |
-
private static Dictionary<string, string> GetContactImportReport(Guid importId)
|
59 |
-
{
|
60 |
-
string url = String.Format("https://apiconnector.com/v2/contacts/import/{0}/report", importId);
|
61 |
-
HttpWebRequest request = CreateRequest(url);
|
62 |
-
Dictionary<string, string> result = ReadResult<Dictionary<string, string>>(request);
|
63 |
-
return result;
|
64 |
-
}
|
65 |
-
|
66 |
-
private static ApiContactImport WaitUntilImportFinishes(ApiContactImport importResult)
|
67 |
-
{
|
68 |
-
ApiContactImport result = importResult;
|
69 |
-
|
70 |
-
while (result.Status == ApiContactImportStatuses.NotFinished)
|
71 |
-
{
|
72 |
-
Thread.Sleep(TimeSpan.FromSeconds(10));
|
73 |
-
|
74 |
-
HttpWebRequest request = CreateRequest("https://apiconnector.com/v2/contacts/import/" + importResult.Id);
|
75 |
-
result = ReadResult<ApiContactImport>(request);
|
76 |
-
}
|
77 |
-
|
78 |
-
return result;
|
79 |
-
}
|
80 |
-
|
81 |
-
private static ApiContactImport ImportContactsFromFile()
|
82 |
-
{
|
83 |
-
string url = String.Format("https://apiconnector.com/v2/address-books/{0}/contacts/import", AddressBookId);
|
84 |
-
HttpWebRequest request = CreateRequest(url);
|
85 |
-
request.Method = "POST";
|
86 |
-
|
87 |
-
AddContactsToRequest(request);
|
88 |
-
|
89 |
-
ApiContactImport result = ReadResult<ApiContactImport>(request);
|
90 |
-
return result;
|
91 |
-
}
|
92 |
-
|
93 |
-
private static void AddContactsToRequest(HttpWebRequest request)
|
94 |
-
{
|
95 |
-
String boundary = Guid.NewGuid().ToString("N");
|
96 |
-
request.ContentType = String.Format(@"multipart/form-data; boundary=""{0}""", boundary);
|
97 |
-
|
98 |
-
using (BinaryWriter writer = new BinaryWriter(request.GetRequestStream()))
|
99 |
-
{
|
100 |
-
writer.Write(Encoding.UTF8.GetBytes("\r\n--" + boundary + "\r\n"));
|
101 |
-
|
102 |
-
const string headerTemplate = "Content-Disposition: form-data; name=\"{0}\"; filename=\"{1}\"\r\n\r\n";
|
103 |
-
string header = string.Format(headerTemplate, "Contacts", "Contacts.csv");
|
104 |
-
|
105 |
-
byte[] headerbytes = Encoding.UTF8.GetBytes(header);
|
106 |
-
writer.Write(headerbytes);
|
107 |
-
|
108 |
-
byte[] contacts = File.ReadAllBytes("Contacts.csv");
|
109 |
-
writer.Write(contacts);
|
110 |
-
|
111 |
-
writer.Write(Encoding.UTF8.GetBytes("\r\n--" + boundary + "--\r\n"));
|
112 |
-
}
|
113 |
-
}
|
114 |
-
|
115 |
-
private static HttpWebRequest CreateRequest(string url)
|
116 |
-
{
|
117 |
-
HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;
|
118 |
-
String base64 = Convert.ToBase64String(Encoding.UTF8.GetBytes(UserName + ":" + Password));
|
119 |
-
request.Headers.Add("Authorization", "Basic " + base64);
|
120 |
-
|
121 |
-
return request;
|
122 |
-
}
|
123 |
-
|
124 |
-
private static void PrintContactImport(ApiContactImport importResult)
|
125 |
-
{
|
126 |
-
Console.WriteLine("Import Id = {0}", importResult.Id);
|
127 |
-
Console.WriteLine("Import Status = {0}", importResult.Status);
|
128 |
-
}
|
129 |
-
|
130 |
-
private static void PrintContactImportReport(Dictionary<String, String> contactImportReport)
|
131 |
-
{
|
132 |
-
Console.WriteLine();
|
133 |
-
foreach (KeyValuePair<string, string> pair in contactImportReport)
|
134 |
-
{
|
135 |
-
Console.WriteLine("{0,-20} = {1}", pair.Key, pair.Value);
|
136 |
-
}
|
137 |
-
}
|
138 |
-
|
139 |
-
private static String ReadResultAsString(WebRequest request)
|
140 |
-
{
|
141 |
-
String result;
|
142 |
-
|
143 |
-
using (WebResponse response = request.GetResponse())
|
144 |
-
{
|
145 |
-
using (StreamReader reader = new StreamReader(response.GetResponseStream()))
|
146 |
-
{
|
147 |
-
result = reader.ReadToEnd();
|
148 |
-
}
|
149 |
-
}
|
150 |
-
|
151 |
-
return result;
|
152 |
-
}
|
153 |
-
|
154 |
-
private static TResult ReadResult<TResult>(WebRequest request)
|
155 |
-
{
|
156 |
-
TResult result;
|
157 |
-
|
158 |
-
using (WebResponse response = request.GetResponse())
|
159 |
-
{
|
160 |
-
using (StreamReader reader = new StreamReader(response.GetResponseStream()))
|
161 |
-
{
|
162 |
-
JsonSerializer serializer = new JsonSerializer();
|
163 |
-
using (JsonTextReader jsonReader = new JsonTextReader(reader))
|
164 |
-
{
|
165 |
-
result = serializer.Deserialize<TResult>(jsonReader);
|
166 |
-
}
|
167 |
-
}
|
168 |
-
}
|
169 |
-
|
170 |
-
return result;
|
171 |
-
}
|
172 |
-
|
173 |
-
private static void PrintUnhandledException(object sender, UnhandledExceptionEventArgs e)
|
174 |
-
{
|
175 |
-
Console.WriteLine(e.ExceptionObject);
|
176 |
-
}
|
177 |
-
}
|
178 |
-
}
|
179 |
-
*
|
180 |
-
*
|
181 |
-
*
|
182 |
-
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,298 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Dotdigitalgroup_Email_Helper_Api_Restrequest extends Dotdigitalgroup_Email_Helper_Data
|
4 |
-
{
|
5 |
-
protected $url;
|
6 |
-
protected $verb;
|
7 |
-
protected $requestBody;
|
8 |
-
protected $requestLength;
|
9 |
-
protected $username;
|
10 |
-
protected $password;
|
11 |
-
protected $acceptType;
|
12 |
-
protected $responseBody;
|
13 |
-
protected $responseInfo;
|
14 |
-
|
15 |
-
public function __construct() // ($url = null, $verb = 'GET', $requestBody = null)
|
16 |
-
{
|
17 |
-
$this->url = null; //$url;
|
18 |
-
$this->verb = null; //$verb;
|
19 |
-
$this->requestBody = null; //$requestBody;
|
20 |
-
$this->requestLength = 0;
|
21 |
-
$this->username = Mage::getStoreConfig('connector_api_settings/api_credentials/username');
|
22 |
-
$this->password = Mage::getStoreConfig('connector_api_settings/api_credentials/password');
|
23 |
-
$this->acceptType = 'application/json';
|
24 |
-
$this->responseBody = null;
|
25 |
-
$this->responseInfo = null;
|
26 |
-
|
27 |
-
if ($this->requestBody !== null)
|
28 |
-
{
|
29 |
-
$this->buildPostBody();
|
30 |
-
}
|
31 |
-
|
32 |
-
//parent::__construct();
|
33 |
-
}
|
34 |
-
|
35 |
-
private function prettyPrint( $json )
|
36 |
-
{
|
37 |
-
$result = '';
|
38 |
-
$level = 0;
|
39 |
-
$prev_char = '';
|
40 |
-
$in_quotes = false;
|
41 |
-
$ends_line_level = NULL;
|
42 |
-
$json_length = strlen( $json );
|
43 |
-
|
44 |
-
for( $i = 0; $i < $json_length; $i++ ) {
|
45 |
-
$char = $json[$i];
|
46 |
-
$new_line_level = NULL;
|
47 |
-
$post = "";
|
48 |
-
if( $ends_line_level !== NULL ) {
|
49 |
-
$new_line_level = $ends_line_level;
|
50 |
-
$ends_line_level = NULL;
|
51 |
-
}
|
52 |
-
if( $char === '"' && $prev_char != '\\' ) {
|
53 |
-
$in_quotes = !$in_quotes;
|
54 |
-
} else if( ! $in_quotes ) {
|
55 |
-
switch( $char ) {
|
56 |
-
case '}': case ']':
|
57 |
-
$level--;
|
58 |
-
$ends_line_level = NULL;
|
59 |
-
$new_line_level = $level;
|
60 |
-
break;
|
61 |
-
|
62 |
-
case '{': case '[':
|
63 |
-
$level++;
|
64 |
-
case ',':
|
65 |
-
$ends_line_level = $level;
|
66 |
-
break;
|
67 |
-
|
68 |
-
case ':':
|
69 |
-
$post = " ";
|
70 |
-
break;
|
71 |
-
|
72 |
-
case " ": case "\t": case "\n": case "\r":
|
73 |
-
$char = "";
|
74 |
-
$ends_line_level = $new_line_level;
|
75 |
-
$new_line_level = NULL;
|
76 |
-
break;
|
77 |
-
}
|
78 |
-
}
|
79 |
-
if( $new_line_level !== NULL ) {
|
80 |
-
$result .= "\n".str_repeat( "\t", $new_line_level );
|
81 |
-
}
|
82 |
-
$result .= $char.$post;
|
83 |
-
$prev_char = $char;
|
84 |
-
}
|
85 |
-
|
86 |
-
return $result;
|
87 |
-
}
|
88 |
-
|
89 |
-
// returns the object as JSON
|
90 |
-
public function toJSON($pretty=false){
|
91 |
-
|
92 |
-
if (!$pretty) {
|
93 |
-
return json_encode($this->expose());
|
94 |
-
}
|
95 |
-
else {
|
96 |
-
return $this->prettyPrint(json_encode($this->expose()));
|
97 |
-
}
|
98 |
-
}
|
99 |
-
|
100 |
-
// exposes the class as an array of objects
|
101 |
-
public function expose() {
|
102 |
-
|
103 |
-
return get_object_vars($this);
|
104 |
-
|
105 |
-
}
|
106 |
-
|
107 |
-
|
108 |
-
public function flush ()
|
109 |
-
{
|
110 |
-
$this->requestBody = null;
|
111 |
-
$this->requestLength = 0;
|
112 |
-
$this->verb = 'GET';
|
113 |
-
$this->responseBody = null;
|
114 |
-
$this->responseInfo = null;
|
115 |
-
}
|
116 |
-
|
117 |
-
public function execute ()
|
118 |
-
{
|
119 |
-
$ch = curl_init();
|
120 |
-
$this->setAuth($ch);
|
121 |
-
|
122 |
-
try
|
123 |
-
{
|
124 |
-
switch (strtoupper($this->verb))
|
125 |
-
{
|
126 |
-
case 'GET':
|
127 |
-
$this->executeGet($ch);
|
128 |
-
break;
|
129 |
-
case 'POST':
|
130 |
-
$this->executePost($ch);
|
131 |
-
break;
|
132 |
-
case 'PUT':
|
133 |
-
$this->executePut($ch);
|
134 |
-
break;
|
135 |
-
case 'DELETE':
|
136 |
-
$this->executeDelete($ch);
|
137 |
-
break;
|
138 |
-
default:
|
139 |
-
throw new InvalidArgumentException('Current verb (' . $this->verb . ') is an invalid REST verb.');
|
140 |
-
}
|
141 |
-
}
|
142 |
-
catch (InvalidArgumentException $e)
|
143 |
-
{
|
144 |
-
curl_close($ch);
|
145 |
-
throw $e;
|
146 |
-
}
|
147 |
-
catch (Exception $e)
|
148 |
-
{
|
149 |
-
curl_close($ch);
|
150 |
-
throw $e;
|
151 |
-
}
|
152 |
-
|
153 |
-
}
|
154 |
-
|
155 |
-
public function buildPostBody($data = null)
|
156 |
-
{
|
157 |
-
$data = ($data !== null)? $data : $this->requestBody;
|
158 |
-
|
159 |
-
if (!is_array($data)){
|
160 |
-
throw new InvalidArgumentException('Invalid data input for postBody. Array expected');
|
161 |
-
}
|
162 |
-
|
163 |
-
$data = http_build_query($data, '', '&');
|
164 |
-
$this->requestBody = $data;
|
165 |
-
}
|
166 |
-
|
167 |
-
protected function executeGet ($ch)
|
168 |
-
{
|
169 |
-
$this->doExecute($ch);
|
170 |
-
}
|
171 |
-
|
172 |
-
protected function executePost ($ch)
|
173 |
-
{
|
174 |
-
if (!is_string($this->requestBody))
|
175 |
-
{
|
176 |
-
$this->buildPostBody();
|
177 |
-
}
|
178 |
-
|
179 |
-
curl_setopt($ch, CURLOPT_POSTFIELDS, $this->requestBody);
|
180 |
-
curl_setopt($ch, CURLOPT_POST, 1);
|
181 |
-
|
182 |
-
$this->doExecute($ch);
|
183 |
-
}
|
184 |
-
|
185 |
-
protected function executePut($ch)
|
186 |
-
{
|
187 |
-
if (!is_string($this->requestBody)){
|
188 |
-
$this->buildPostBody();
|
189 |
-
}
|
190 |
-
|
191 |
-
$this->requestLength = strlen($this->requestBody);
|
192 |
-
|
193 |
-
$fh = fopen('php://memory', 'rw');
|
194 |
-
fwrite($fh, $this->requestBody);
|
195 |
-
rewind($fh);
|
196 |
-
|
197 |
-
curl_setopt($ch, CURLOPT_INFILE, $fh);
|
198 |
-
curl_setopt($ch, CURLOPT_INFILESIZE, $this->requestLength);
|
199 |
-
curl_setopt($ch, CURLOPT_PUT, true);
|
200 |
-
|
201 |
-
$this->doExecute($ch);
|
202 |
-
|
203 |
-
fclose($fh);
|
204 |
-
}
|
205 |
-
|
206 |
-
protected function executeDelete ($ch)
|
207 |
-
{
|
208 |
-
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
|
209 |
-
|
210 |
-
$this->doExecute($ch);
|
211 |
-
}
|
212 |
-
|
213 |
-
protected function doExecute (&$curlHandle)
|
214 |
-
{
|
215 |
-
$this->setCurlOpts($curlHandle);
|
216 |
-
$this->responseBody = curl_exec($curlHandle);
|
217 |
-
$this->responseInfo = curl_getinfo($curlHandle);
|
218 |
-
|
219 |
-
curl_close($curlHandle);
|
220 |
-
}
|
221 |
-
|
222 |
-
protected function setCurlOpts (&$curlHandle)
|
223 |
-
{
|
224 |
-
curl_setopt($curlHandle, CURLOPT_TIMEOUT, 10);
|
225 |
-
curl_setopt($curlHandle, CURLOPT_URL, $this->url);
|
226 |
-
curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, true);
|
227 |
-
curl_setopt($curlHandle, CURLOPT_HTTPHEADER, array ('Accept: ' . $this->acceptType ,'Content-Type: application/json'));
|
228 |
-
}
|
229 |
-
|
230 |
-
protected function setAuth (&$curlHandle)
|
231 |
-
{
|
232 |
-
if ($this->username !== null && $this->password !== null)
|
233 |
-
{
|
234 |
-
curl_setopt($curlHandle, CURLAUTH_BASIC, CURLAUTH_DIGEST);
|
235 |
-
curl_setopt($curlHandle, CURLOPT_USERPWD, $this->username . ':' . $this->password);
|
236 |
-
}
|
237 |
-
}
|
238 |
-
|
239 |
-
public function getAcceptType ()
|
240 |
-
{
|
241 |
-
return $this->acceptType;
|
242 |
-
}
|
243 |
-
|
244 |
-
public function setAcceptType ($acceptType)
|
245 |
-
{
|
246 |
-
$this->acceptType = $acceptType;
|
247 |
-
}
|
248 |
-
|
249 |
-
public function getPassword ()
|
250 |
-
{
|
251 |
-
return $this->password;
|
252 |
-
}
|
253 |
-
|
254 |
-
public function setPassword ($password)
|
255 |
-
{
|
256 |
-
$this->password = $password;
|
257 |
-
}
|
258 |
-
|
259 |
-
public function getResponseBody ()
|
260 |
-
{
|
261 |
-
return $this->responseBody;
|
262 |
-
}
|
263 |
-
|
264 |
-
public function getResponseInfo ()
|
265 |
-
{
|
266 |
-
return $this->responseInfo;
|
267 |
-
}
|
268 |
-
|
269 |
-
public function getUrl ()
|
270 |
-
{
|
271 |
-
return $this->url;
|
272 |
-
}
|
273 |
-
|
274 |
-
public function setUrl ($url)
|
275 |
-
{
|
276 |
-
$this->url = $url;
|
277 |
-
}
|
278 |
-
|
279 |
-
public function getUsername ()
|
280 |
-
{
|
281 |
-
return $this->username;
|
282 |
-
}
|
283 |
-
|
284 |
-
public function setUsername ($username)
|
285 |
-
{
|
286 |
-
$this->username = $username;
|
287 |
-
}
|
288 |
-
|
289 |
-
public function getVerb ()
|
290 |
-
{
|
291 |
-
return $this->verb;
|
292 |
-
}
|
293 |
-
|
294 |
-
public function setVerb ($verb)
|
295 |
-
{
|
296 |
-
$this->verb = $verb;
|
297 |
-
}
|
298 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,96 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
* empty helper to keep admin from breaking
|
4 |
-
*/
|
5 |
-
class Dotdigitalgroup_Email_Helper_Data extends Mage_Core_Helper_Abstract
|
6 |
-
{
|
7 |
-
const XML_PATH_PASSCODE = 'connector_advanced_settings/external/passcode';
|
8 |
-
const XML_PATH_LAST_ORDER_NO = 'connector_data_field_settings/customer_data/last_order_no';
|
9 |
-
const XML_PATH_MAPPING_CUSTOMER_ID = 'connector_data_field_settings/customer_data/customer_id';
|
10 |
-
const XML_PATH_ENABLED_LOGS = 'connector_advanced_settings/admin/debug';
|
11 |
-
|
12 |
-
|
13 |
-
/**
|
14 |
-
* return the time scheldule for the cronjob
|
15 |
-
* @param $code
|
16 |
-
* @return mixed
|
17 |
-
*/
|
18 |
-
public function getSchelduledAtCronjob($code)
|
19 |
-
{
|
20 |
-
/* @var $collection Mage_Cron_Model_Resource_Schedule_Collection */
|
21 |
-
$collection = Mage::getModel('cron/schedule')->getCollection();
|
22 |
-
$collection->addFieldToFilter('job_code', $code)
|
23 |
-
->addFieldToFilter('status', Mage_Cron_Model_Schedule::STATUS_PENDING)
|
24 |
-
->addOrder('scheduled_at', Varien_Data_Collection_Db::SORT_ORDER_DESC)
|
25 |
-
->getSelect()->limit(1);
|
26 |
-
$schedule = $collection->getFirstItem();
|
27 |
-
|
28 |
-
$scheduleAt = $schedule->getData('scheduled_at');
|
29 |
-
|
30 |
-
return $scheduleAt;
|
31 |
-
}
|
32 |
-
|
33 |
-
public function auth($authRequest)
|
34 |
-
{
|
35 |
-
if($authRequest == Mage::getStoreConfig(self::XML_PATH_PASSCODE)){
|
36 |
-
return true;
|
37 |
-
}
|
38 |
-
|
39 |
-
if($this->isEnabledLogs())
|
40 |
-
$this->log('authenication failed : ' . $authRequest , null, 'auth.log');
|
41 |
-
exit();
|
42 |
-
}
|
43 |
-
|
44 |
-
public function getMappedCustomerId()
|
45 |
-
{
|
46 |
-
return Mage::getStoreConfig(self::XML_PATH_MAPPING_CUSTOMER_ID);
|
47 |
-
}
|
48 |
-
|
49 |
-
public function getPasscode()
|
50 |
-
{
|
51 |
-
return Mage::getStoreConfig(self::XML_PATH_PASSCODE);
|
52 |
-
}
|
53 |
-
|
54 |
-
public function getLastOrderNo()
|
55 |
-
{
|
56 |
-
return Mage::getStoreConfig(self::XML_PATH_LAST_ORDER_NO);
|
57 |
-
|
58 |
-
}
|
59 |
-
|
60 |
-
public function log($data, $level = Zend_Log::DEBUG, $filename = 'api.log')
|
61 |
-
{
|
62 |
-
if($this->isEnabledLogs()){
|
63 |
-
$filename = 'connector_' . $filename;
|
64 |
-
|
65 |
-
Mage::log($data, $level, $filename, $force = true);
|
66 |
-
}
|
67 |
-
}
|
68 |
-
|
69 |
-
public function isEnabledLogs()
|
70 |
-
{
|
71 |
-
return (bool) Mage::getStoreConfig(self::XML_PATH_ENABLED_LOGS);
|
72 |
-
}
|
73 |
-
|
74 |
-
public function isOrderTransactionalEnabled()
|
75 |
-
{
|
76 |
-
return (bool) Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Sales_Order::XML_PATH_TRANSACTIONAL_DATA_ENABLED);
|
77 |
-
}
|
78 |
-
|
79 |
-
public function isCustomerSyncEnabled()
|
80 |
-
{
|
81 |
-
return (bool) Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CUSTOMER_SYNC_ENABLE);
|
82 |
-
}
|
83 |
-
|
84 |
-
public function getConnectorVersion()
|
85 |
-
{
|
86 |
-
|
87 |
-
$modules = (array) Mage::getConfig()->getNode('modules')->children();
|
88 |
-
|
89 |
-
if(isset($modules['Dotdigitalgroup_Email'])){
|
90 |
-
|
91 |
-
$moduleName = $modules['Dotdigitalgroup_Email'];
|
92 |
-
return $moduleName->version;
|
93 |
-
}
|
94 |
-
return '';
|
95 |
-
}
|
96 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,191 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Dotdigitalgroup_Email_Helper_Recommended extends Mage_Core_Helper_Abstract
|
4 |
-
{
|
5 |
-
const XML_PATH_RELATED_PRODUCTS_TYPE = 'dynamic_content/products/related_display_type';
|
6 |
-
const XML_PATH_UPSELL_PRODUCTS_TYPE = 'dynamic_content/products/upsell_display_type';
|
7 |
-
const XML_PATH_CROSSSELL_PRODUCTS_TYPE = 'dynamic_content/products/crosssell_display_type';
|
8 |
-
const XML_PATH_BESTSELLER_PRODUCT_TYPE = 'dynamic_content/products/best_display_type';
|
9 |
-
const XML_PATH_MOSTVIEWED_PRODUCT_TYPE = 'dynamic_content/products/most_viewed_display_type';
|
10 |
-
const XML_PATH_RECENTLYVIEWED_PRODUCT_TYPE = 'dynamic_content/products/recently_viewed_display_type';
|
11 |
-
const XML_PATH_PRODUCTPUSH_TYPE = 'dynamic_content/manual_product_search/display_type';
|
12 |
-
|
13 |
-
|
14 |
-
const XML_PATH_RELATED_PRODUCTS_ITEMS = 'dynamic_content/products/related_items_to_display';
|
15 |
-
const XML_PATH_UPSELL_PRODUCTS_ITEMS = 'dynamic_content/products/upsell_items_to_display';
|
16 |
-
const XML_PATH_CROSSSELL_PRODUCTS_ITEMS = 'dynamic_content/products/crosssell_items_to_display';
|
17 |
-
const XML_PATH_BESTSELLER_PRODUCT_ITEMS = 'dynamic_content/products/best_items_to_display';
|
18 |
-
const XML_PATH_MOSTVIEWED_PRODUCT_ITEMS = 'dynamic_content/products/most_viewed_items_to_display';
|
19 |
-
const XML_PATH_RECENTLYVIEWED_PRODUCT_ITEMS = 'dynamic_content/products/recently_viewed_items_to_display';
|
20 |
-
const XML_PATH_PRODUCTPUSH_DISPLAY_ITEMS = 'dynamic_content/manual_product_search/items_to_display';
|
21 |
-
|
22 |
-
|
23 |
-
const XML_PATH_BESTSELLER_TIME_PERIOD = 'dynamic_content/products/best_time_period';
|
24 |
-
const XML_PATH_MOSTVIEWED_TIME_PERIOD = 'dynamic_content/products/most_viewed_time_period';
|
25 |
-
|
26 |
-
const XML_PATH_FALLBACK_PRODUCTS_ITEMS = 'dynamic_content/fallback_products/product_list';
|
27 |
-
|
28 |
-
const XML_PATH_PRODUCTPUSH_ITEMS = 'dynamic_content/manual_product_search/products_push_list';
|
29 |
-
|
30 |
-
public $periods = array('week', 'month', 'year');
|
31 |
-
|
32 |
-
|
33 |
-
/**
|
34 |
-
* product recommendation type
|
35 |
-
* @var string
|
36 |
-
*/
|
37 |
-
|
38 |
-
|
39 |
-
/**
|
40 |
-
* Dispay mode
|
41 |
-
* @return mixed|string grid:list
|
42 |
-
*/
|
43 |
-
public function getMode()
|
44 |
-
{
|
45 |
-
$mode = Mage::app()->getRequest()->getParam('mode');
|
46 |
-
$type = '';
|
47 |
-
if($mode){
|
48 |
-
switch($mode){
|
49 |
-
case 'related':
|
50 |
-
$type = $this->getRelatedProductsType();
|
51 |
-
break;
|
52 |
-
case 'upsell':
|
53 |
-
$type = $this->getUpsellProductsType();
|
54 |
-
break;
|
55 |
-
case 'crosssell':
|
56 |
-
$type = $this->getCrosssellProductsType();
|
57 |
-
break;
|
58 |
-
case 'bestsellers':
|
59 |
-
$type = $this->getBestSellerProductsType();
|
60 |
-
break;
|
61 |
-
case 'mostviewed':
|
62 |
-
$type = $this->getMostViewedProductsType();
|
63 |
-
break;
|
64 |
-
case 'recentlyviewed':
|
65 |
-
$type = $this->getRecentlyviewedProductsType();
|
66 |
-
break;
|
67 |
-
case 'productpush':
|
68 |
-
$type = $this->getProductpushProductsType();
|
69 |
-
}
|
70 |
-
}
|
71 |
-
|
72 |
-
return $type;
|
73 |
-
}
|
74 |
-
|
75 |
-
public function getRelatedProductsType($storeId = 0)
|
76 |
-
{
|
77 |
-
return Mage::getStoreConfig(self::XML_PATH_RELATED_PRODUCTS_TYPE, $storeId);
|
78 |
-
}
|
79 |
-
|
80 |
-
public function getUpsellProductsType($storeId = 0)
|
81 |
-
{
|
82 |
-
return Mage::getStoreConfig(self::XML_PATH_UPSELL_PRODUCTS_TYPE, $storeId);
|
83 |
-
|
84 |
-
}
|
85 |
-
|
86 |
-
public function getCrosssellProductsType($storeId = 0)
|
87 |
-
{
|
88 |
-
return Mage::getStoreConfig(self::XML_PATH_CROSSSELL_PRODUCTS_TYPE, $storeId);
|
89 |
-
}
|
90 |
-
|
91 |
-
public function getBestSellerProductsType($storeId = 0)
|
92 |
-
{
|
93 |
-
return Mage::getStoreConfig(self::XML_PATH_BESTSELLER_PRODUCT_TYPE, $storeId);
|
94 |
-
}
|
95 |
-
|
96 |
-
public function getMostViewedProductsType($storeId = 0)
|
97 |
-
{
|
98 |
-
return Mage::getStoreConfig(self::XML_PATH_MOSTVIEWED_PRODUCT_TYPE, $storeId);
|
99 |
-
}
|
100 |
-
|
101 |
-
public function getRecentlyviewedProductsType($storeId = 0)
|
102 |
-
{
|
103 |
-
return Mage::getStoreConfig(self::XML_PATH_RECENTLYVIEWED_PRODUCT_TYPE, $storeId);
|
104 |
-
}
|
105 |
-
|
106 |
-
public function getProductpushProductsType($storeId = 0)
|
107 |
-
{
|
108 |
-
return Mage::getStoreConfig(self::XML_PATH_PRODUCTPUSH_TYPE, $storeId);
|
109 |
-
}
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
/**
|
114 |
-
* Limit of products displayed
|
115 |
-
* @return int|mixed
|
116 |
-
*/
|
117 |
-
public function getLimit()
|
118 |
-
{
|
119 |
-
$mode = Mage::registry('mode');
|
120 |
-
$limit = 0;
|
121 |
-
if($mode){
|
122 |
-
switch($mode){
|
123 |
-
case 'related':
|
124 |
-
$limit = Mage::getStoreConfig(self::XML_PATH_RELATED_PRODUCTS_ITEMS);
|
125 |
-
break;
|
126 |
-
case 'upsell':
|
127 |
-
$limit = Mage::getStoreConfig(self::XML_PATH_UPSELL_PRODUCTS_ITEMS);
|
128 |
-
break;
|
129 |
-
case 'crosssell':
|
130 |
-
$limit = Mage::getStoreConfig(self::XML_PATH_CROSSSELL_PRODUCTS_ITEMS);
|
131 |
-
break;
|
132 |
-
case 'bestsellers':
|
133 |
-
$limit = Mage::getStoreConfig(self::XML_PATH_BESTSELLER_PRODUCT_ITEMS);
|
134 |
-
break;
|
135 |
-
case 'mostviewed':
|
136 |
-
$limit = Mage::getStoreConfig(self::XML_PATH_MOSTVIEWED_PRODUCT_ITEMS);
|
137 |
-
break;
|
138 |
-
case 'recentlyviewed':
|
139 |
-
$limit = Mage::getStoreConfig(self::XML_PATH_RECENTLYVIEWED_PRODUCT_ITEMS);
|
140 |
-
break;
|
141 |
-
case 'productpush':
|
142 |
-
$limit = Mage::getStoreConfig(self::XML_PATH_PRODUCTPUSH_DISPLAY_ITEMS);
|
143 |
-
}
|
144 |
-
}
|
145 |
-
|
146 |
-
return $limit;
|
147 |
-
}
|
148 |
-
|
149 |
-
public function getFallbackIds(){
|
150 |
-
$fallbackIds = Mage::getStoreConfig(self::XML_PATH_FALLBACK_PRODUCTS_ITEMS);
|
151 |
-
if($fallbackIds)
|
152 |
-
return explode(',', Mage::getStoreConfig(self::XML_PATH_FALLBACK_PRODUCTS_ITEMS));
|
153 |
-
return array();
|
154 |
-
}
|
155 |
-
|
156 |
-
public function getTimeFromConfig($config)
|
157 |
-
{
|
158 |
-
$now = new Zend_Date();
|
159 |
-
$period = '';
|
160 |
-
if($config == 'mostviewed')
|
161 |
-
$period = Mage::getStoreConfig(self::XML_PATH_MOSTVIEWED_TIME_PERIOD);
|
162 |
-
elseif($config == 'bestsellers')
|
163 |
-
$period = Mage::getStoreConfig(self::XML_PATH_BESTSELLER_TIME_PERIOD);
|
164 |
-
elseif($config == 'recentlyviewed')
|
165 |
-
$period = Mage::getStoreConfig(self::XML_PATH_MOSTVIEWED_TIME_PERIOD);
|
166 |
-
|
167 |
-
if($period == 'week'){
|
168 |
-
$sub = Zend_Date::WEEK;
|
169 |
-
}elseif($period == 'month'){
|
170 |
-
$sub = Zend_Date::MONTH;
|
171 |
-
}elseif($period == 'year'){
|
172 |
-
$sub = Zend_Date::YEAR;
|
173 |
-
}
|
174 |
-
|
175 |
-
if(isset($sub)){
|
176 |
-
$period = $now->sub(1, $sub);
|
177 |
-
|
178 |
-
return $period->tostring(Zend_Date::ISO_8601);
|
179 |
-
}
|
180 |
-
}
|
181 |
-
|
182 |
-
public function getProductPushIds($storeId = 0)
|
183 |
-
{
|
184 |
-
$productIds = Mage::getStoreConfig(self::XML_PATH_PRODUCTPUSH_ITEMS, $storeId);
|
185 |
-
|
186 |
-
return explode(',', $productIds);
|
187 |
-
|
188 |
-
}
|
189 |
-
|
190 |
-
|
191 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,40 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Dotdigitalgroup_Email_Model_Account_Test extends Dotdigitalgroup_Email_Model_Api_Rest
|
4 |
-
{
|
5 |
-
const TEST_API_USERNAME = 'apiuser-2c692ba1bbd2@apiconnector.com';
|
6 |
-
const TEST_API_PASSWORD = 'Magento2013';
|
7 |
-
const TEST_API_CAMPAIGN = '2643928';
|
8 |
-
const TEST_CONTACT_ID = '13';
|
9 |
-
const TEST_CONTACT_EMAIL = 'ben.staveley@dotmailer.co.uk';
|
10 |
-
|
11 |
-
public function test($api_user = null, $api_password = null)
|
12 |
-
{
|
13 |
-
if($api_user && $api_password){
|
14 |
-
$this->_api_user = $api_user;
|
15 |
-
$this->_api_password = $api_password;
|
16 |
-
}
|
17 |
-
$response = array('errors' => 0, 'message' => '');
|
18 |
-
$result = $this->testAccount();
|
19 |
-
if(!$result){
|
20 |
-
$response['errors'] = true;
|
21 |
-
$response['message'] = 'Invalid API Credentials.';
|
22 |
-
}
|
23 |
-
$this->sendInstallConfirmation();
|
24 |
-
|
25 |
-
return $response;
|
26 |
-
}
|
27 |
-
|
28 |
-
public function sendInstallConfirmation()
|
29 |
-
{
|
30 |
-
$this->_api_user = self::TEST_API_USERNAME;
|
31 |
-
$this->_api_password = self::TEST_API_PASSWORD;
|
32 |
-
$testEmail = self::TEST_CONTACT_EMAIL;
|
33 |
-
$contactId = self::TEST_CONTACT_ID;
|
34 |
-
$campaignId = self::TEST_API_CAMPAIGN;
|
35 |
-
|
36 |
-
// send initial info
|
37 |
-
$this->sendIntallInfo($testEmail, $contactId, $campaignId);
|
38 |
-
|
39 |
-
}
|
40 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,729 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Dotdigitalgroup_Email_Model_Api_Rest extends Mage_Core_Model_Abstract
|
4 |
-
{
|
5 |
-
const REST_WAIT_UPLOAD_TIME = 5;
|
6 |
-
//rest api data
|
7 |
-
const REST_ACCOUNT_INFO = 'https://apiconnector.com/v2/account-info';
|
8 |
-
const REST_CONTACTS = 'https://apiconnector.com/v2/contacts/';
|
9 |
-
const REST_CONTACTS_IMPORT = 'https://apiconnector.com/v2/contacts/import/';
|
10 |
-
const REST_ADDRESS_BOOKS = 'https://apiconnector.com/v2/address-books';
|
11 |
-
const REST_DATA_FILEDS = 'https://apiconnector.com/v2/data-fields';
|
12 |
-
const REST_TRANSACTIONAL_DATA_IMPORT = 'https://apiconnector.com/v2/contacts/transactional-data/import/';
|
13 |
-
const REST_SINGLE_TRANSACTIONAL_DATA_IMPORT = 'https://apiconnector.com/v2/contacts/transactional-data/';
|
14 |
-
const REST_CAMPAIGN_SEND = 'https://apiconnector.com/v2/campaigns/send';
|
15 |
-
const REST_CONTACTS_SUPPRESSED_SINCE = 'https://apiconnector.com/v2/contacts/suppressed-since/';
|
16 |
-
const REST_DATA_FIELDS_CAMPAIGNS = 'https://apiconnector.com/v2/campaigns';
|
17 |
-
const REST_SMS_MESSAGE_SEND_TO = 'https://apiconnector.com/v2/sms-messages/send-to/';
|
18 |
-
//rest error responces
|
19 |
-
const REST_CONTACT_NOT_FOUND = 'Error: ERROR_CONTACT_NOT_FOUND';
|
20 |
-
const REST_STATUS_IMPORT_REPORT_NOT_FOUND = 'Import is not processed yet or completed with error. ERROR_IMPORT_REPORT_NOT_FOUND';
|
21 |
-
const REST_STATUS_REPORT_NOTFINISHED = 'NotFinished';
|
22 |
-
const REST_TRANSACTIONAL_DATA_NOT_EXISTS = 'Error: ERROR_TRANSACTIONAL_DATA_DOES_NOT_EXIST';
|
23 |
-
const REST_API_USAGE_EXCEEDED = 'Your account has generated excess API activity and is being temporarily capped. Please contact support. ERROR_APIUSAGE_EXCEEDED';
|
24 |
-
|
25 |
-
protected $_api_user;
|
26 |
-
protected $_api_password;
|
27 |
-
protected $_customers_file_slug = 'customer_sync';
|
28 |
-
protected $_subscribers_file_slug = 'subscriber_sync';
|
29 |
-
protected $_api_helper;
|
30 |
-
protected $_subscribers_address_book_id;
|
31 |
-
protected $_customers_address_book_id;
|
32 |
-
protected $_filename;
|
33 |
-
protected $_subscribers_filename;
|
34 |
-
protected $_customers_filename;
|
35 |
-
protected $_limit = 10;
|
36 |
-
protected $_address_book_id;
|
37 |
-
public $fileHelper; /** @var Dotdigitalgroup_Email_Helper_File */
|
38 |
-
protected $_helper;
|
39 |
-
public $result = array('error' => false, 'message' => '');
|
40 |
-
protected $_log_filename = 'api.log';
|
41 |
-
|
42 |
-
public function __construct()
|
43 |
-
{
|
44 |
-
// connect to default
|
45 |
-
$this->_api_user = Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CONNECTOR_API_USERNAME);
|
46 |
-
$this->_api_password = Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CONNECTOR_API_PASSWORD);
|
47 |
-
$this->_helper = Mage::helper('connector');
|
48 |
-
}
|
49 |
-
|
50 |
-
/**
|
51 |
-
* Deletes all contacts from a given address book.
|
52 |
-
* @param $addressBooks
|
53 |
-
* @return mixed
|
54 |
-
*/
|
55 |
-
protected function deleteAddressBookContacts($addressBooks) {
|
56 |
-
|
57 |
-
foreach ($addressBooks as $addressBookId) {
|
58 |
-
|
59 |
-
// skip if contact Id is null otherwise the API will delete ALL contacts from the address book!!!
|
60 |
-
if ($addressBookId==null) continue;
|
61 |
-
$ch = curl_init("https://apiconnector.com/v2/address-books/{$addressBookId}/contacts/");
|
62 |
-
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
|
63 |
-
curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
|
64 |
-
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
65 |
-
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
66 |
-
|
67 |
-
// delete the contact from the address book
|
68 |
-
$result = curl_exec($ch);
|
69 |
-
$result = json_decode($result);
|
70 |
-
}
|
71 |
-
}
|
72 |
-
|
73 |
-
|
74 |
-
/**
|
75 |
-
* Bulk creates, or bulk updates, contacts. Import format can either be CSV or Excel.
|
76 |
-
* Must include one column called "Email". Any other columns will attempt to map to your custom data fields.
|
77 |
-
* The ID of returned object can be used to query import progress.
|
78 |
-
* @param $filename
|
79 |
-
* @param $addressBookId
|
80 |
-
* @return mixed
|
81 |
-
*/
|
82 |
-
protected function postAddressBookContactsImport($filename, $addressBookId)
|
83 |
-
{
|
84 |
-
// ...the API request
|
85 |
-
$uploadUrl = "https://apiconnector.com/v2/address-books/{$addressBookId}/contacts/import";
|
86 |
-
$ch = curl_init($uploadUrl);
|
87 |
-
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
|
88 |
-
curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
|
89 |
-
curl_setopt($ch, CURLOPT_POSTFIELDS, array (
|
90 |
-
'file' => '@'.$this->fileHelper->getFilePath($filename)
|
91 |
-
));
|
92 |
-
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
93 |
-
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
94 |
-
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
95 |
-
'Content-Type: multipart/form-data')
|
96 |
-
);
|
97 |
-
// send contacts to address book
|
98 |
-
$result = curl_exec($ch);
|
99 |
-
$result = json_decode($result);
|
100 |
-
|
101 |
-
return $result;
|
102 |
-
}
|
103 |
-
|
104 |
-
/**
|
105 |
-
* Adds a contact to a given address book.
|
106 |
-
* @param $addressBookId
|
107 |
-
* @param $contactAPI
|
108 |
-
* @return mixed
|
109 |
-
*/
|
110 |
-
public function postAddressBookContacts($addressBookId, $contactAPI)
|
111 |
-
{
|
112 |
-
$data_string = json_encode($contactAPI);
|
113 |
-
$url = self::REST_ADDRESS_BOOKS . '/' . $addressBookId . '/contacts';
|
114 |
-
$ch = curl_init($url);
|
115 |
-
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
|
116 |
-
curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
|
117 |
-
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
|
118 |
-
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
119 |
-
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
120 |
-
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
121 |
-
'Content-Type: application/json',
|
122 |
-
'Content-Length: ' . strlen($data_string))
|
123 |
-
);
|
124 |
-
|
125 |
-
// send campaign
|
126 |
-
$result = curl_exec($ch);
|
127 |
-
$result = json_decode($result);
|
128 |
-
|
129 |
-
return $result;
|
130 |
-
}
|
131 |
-
|
132 |
-
/**
|
133 |
-
* Deletes all contacts from a given address book.
|
134 |
-
* @param $addressBookId
|
135 |
-
* @param $contactId
|
136 |
-
*/
|
137 |
-
public function deleteAddressBookContact($addressBookId, $contactId)
|
138 |
-
{
|
139 |
-
$url = self::REST_ADDRESS_BOOKS . '/' . $addressBookId . '/contacts/' . $contactId;
|
140 |
-
$ch = curl_init($url);
|
141 |
-
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
|
142 |
-
curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
|
143 |
-
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
144 |
-
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
145 |
-
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
146 |
-
'Content-Type: application/json'
|
147 |
-
));
|
148 |
-
$result = curl_exec($ch);
|
149 |
-
}
|
150 |
-
|
151 |
-
/**
|
152 |
-
* Gets a report with statistics about what was successfully imported, and what was unable to be imported.
|
153 |
-
* @param $importId
|
154 |
-
* @return mixed
|
155 |
-
*/
|
156 |
-
public function getContactsImportReport($importId)
|
157 |
-
{
|
158 |
-
$reportUrl = self::REST_CONTACTS_IMPORT . "{$importId}/report";
|
159 |
-
$ch = curl_init($reportUrl);
|
160 |
-
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
|
161 |
-
curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
|
162 |
-
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
163 |
-
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
164 |
-
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
165 |
-
'Content-Type: application/json')
|
166 |
-
);
|
167 |
-
// get the report
|
168 |
-
$result = curl_exec($ch);
|
169 |
-
$result = json_decode($result);
|
170 |
-
return $result;
|
171 |
-
}
|
172 |
-
|
173 |
-
public function getContacts($skip = 0, $limit = 1000)
|
174 |
-
{
|
175 |
-
$allContactsUrl = self::REST_CONTACTS . '?select=' . $limit . '&skip=' . $skip;
|
176 |
-
$ch = curl_init($allContactsUrl);
|
177 |
-
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
|
178 |
-
curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
|
179 |
-
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
180 |
-
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
181 |
-
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
182 |
-
'Content-Type: application/json'
|
183 |
-
));
|
184 |
-
$data = curl_exec($ch);
|
185 |
-
$result = json_decode($data);
|
186 |
-
|
187 |
-
return $result;
|
188 |
-
}
|
189 |
-
|
190 |
-
public function getContactByEmail($email)
|
191 |
-
{
|
192 |
-
$contactInfoUrl = self::REST_CONTACTS . $email;
|
193 |
-
$ch = curl_init($contactInfoUrl);
|
194 |
-
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
|
195 |
-
curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
|
196 |
-
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
197 |
-
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
198 |
-
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
199 |
-
'Content-Type: application/json'
|
200 |
-
));
|
201 |
-
|
202 |
-
$data = curl_exec($ch);
|
203 |
-
$result = json_decode($data);
|
204 |
-
|
205 |
-
return $result;
|
206 |
-
}
|
207 |
-
public function getContactById($contactId)
|
208 |
-
{
|
209 |
-
$contactInfoUrl = self::REST_CONTACTS . $contactId;
|
210 |
-
$ch = curl_init($contactInfoUrl);
|
211 |
-
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
|
212 |
-
curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
|
213 |
-
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
214 |
-
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
215 |
-
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
216 |
-
'Content-Type: application/json'
|
217 |
-
));
|
218 |
-
|
219 |
-
$data = curl_exec($ch);
|
220 |
-
$result = json_decode($data);
|
221 |
-
|
222 |
-
return $result;
|
223 |
-
}
|
224 |
-
|
225 |
-
/**
|
226 |
-
* Creates an address book.
|
227 |
-
* @return mixed
|
228 |
-
*/
|
229 |
-
public function postAddressBooks()
|
230 |
-
{
|
231 |
-
$contactInfoUrl = self::REST_ADDRESS_BOOKS;
|
232 |
-
$ch = curl_init($contactInfoUrl);
|
233 |
-
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
|
234 |
-
curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
|
235 |
-
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
236 |
-
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
237 |
-
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
238 |
-
'Content-Type: application/json'
|
239 |
-
));
|
240 |
-
$data = curl_exec($ch);
|
241 |
-
$result = json_decode($data);
|
242 |
-
return $result;
|
243 |
-
}
|
244 |
-
|
245 |
-
/**
|
246 |
-
* Creates a campaign.
|
247 |
-
* @return mixed
|
248 |
-
*/
|
249 |
-
protected function postCampaigns(){
|
250 |
-
$contactInfoUrl = self::REST_DATA_FIELDS_CAMPAIGNS;
|
251 |
-
$ch = curl_init($contactInfoUrl);
|
252 |
-
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
|
253 |
-
curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
|
254 |
-
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
255 |
-
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
256 |
-
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
257 |
-
'Content-Type: application/json'
|
258 |
-
));
|
259 |
-
$data = curl_exec($ch);
|
260 |
-
$result = json_decode($data);
|
261 |
-
return $result;
|
262 |
-
}
|
263 |
-
|
264 |
-
/**
|
265 |
-
* Creates a data field within the account.
|
266 |
-
* @return mixed
|
267 |
-
*/
|
268 |
-
protected function postDataFields() {
|
269 |
-
$contactInfoUrl = self::REST_DATA_FILEDS;
|
270 |
-
$ch_contact = curl_init($contactInfoUrl);
|
271 |
-
curl_setopt($ch_contact, CURLOPT_CUSTOMREQUEST, 'GET');
|
272 |
-
curl_setopt($ch_contact, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
|
273 |
-
curl_setopt($ch_contact, CURLOPT_RETURNTRANSFER, true);
|
274 |
-
curl_setopt($ch_contact, CURLOPT_SSL_VERIFYPEER, false);
|
275 |
-
curl_setopt($ch_contact, CURLOPT_HTTPHEADER, array(
|
276 |
-
'Content-Type: application/json'
|
277 |
-
));
|
278 |
-
$data = curl_exec($ch_contact);
|
279 |
-
$result = json_decode($data);
|
280 |
-
return $result;
|
281 |
-
}
|
282 |
-
|
283 |
-
/**
|
284 |
-
* Bulk creates, or bulk updates, contacts. Import format can either be CSV or Excel.
|
285 |
-
* Must include one column called "Email". Any other columns will attempt to map to your custom data fields.
|
286 |
-
* The ID of returned object can be used to query import progress.
|
287 |
-
* @param bool $waitFinished
|
288 |
-
* @return mixed
|
289 |
-
*/
|
290 |
-
private function postContactsImport($waitFinished = false){
|
291 |
-
$importUrl = self::REST_CONTACTS_IMPORT;
|
292 |
-
$ch = curl_init($importUrl);
|
293 |
-
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
|
294 |
-
curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
|
295 |
-
curl_setopt($ch, CURLOPT_POSTFIELDS, array (
|
296 |
-
'file' => '@'.$this->getFilePath($this->_filename)
|
297 |
-
));
|
298 |
-
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
299 |
-
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
300 |
-
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
301 |
-
'Content-Type: multipart/form-data')
|
302 |
-
);
|
303 |
-
$result = curl_exec($ch);
|
304 |
-
$result = json_decode($result);
|
305 |
-
|
306 |
-
if($waitFinished)
|
307 |
-
$this->waitFinishedImport($result->id);
|
308 |
-
return $result;
|
309 |
-
}
|
310 |
-
public function updateContact($contactId, $data)
|
311 |
-
{
|
312 |
-
$data_string = json_encode($data);
|
313 |
-
$contactInfoUrl = self::REST_CONTACTS . $contactId;
|
314 |
-
$ch = curl_init($contactInfoUrl);
|
315 |
-
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
|
316 |
-
curl_setopt($ch, CURLOPT_POST, true);
|
317 |
-
curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
|
318 |
-
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
|
319 |
-
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
320 |
-
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
321 |
-
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
322 |
-
'Content-Type: application/json',
|
323 |
-
'Content-Length: ' . strlen($data_string))
|
324 |
-
);
|
325 |
-
$data = curl_exec($ch);
|
326 |
-
$result = json_decode($data);
|
327 |
-
return $result;
|
328 |
-
}
|
329 |
-
|
330 |
-
/**
|
331 |
-
* Send connector campaings
|
332 |
-
* @param $campaignId
|
333 |
-
* @param $contacts
|
334 |
-
* @return mixed
|
335 |
-
*/
|
336 |
-
public function sendCampaign($campaignId, $contacts)
|
337 |
-
{
|
338 |
-
$data = array(
|
339 |
-
'username' => $this->_api_user,
|
340 |
-
'password' => $this->_api_password,
|
341 |
-
"campaignId" => $campaignId,
|
342 |
-
"ContactIds" => $contacts
|
343 |
-
);
|
344 |
-
|
345 |
-
$this->_helper->log($data, null, $this->_log_filename);
|
346 |
-
$data_string = json_encode($data);
|
347 |
-
$campaignUrl = self::REST_CAMPAIGN_SEND;
|
348 |
-
$ch = curl_init($campaignUrl);
|
349 |
-
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
|
350 |
-
curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
|
351 |
-
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
|
352 |
-
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
353 |
-
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
354 |
-
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
355 |
-
'Content-Type: application/json',
|
356 |
-
'Content-Length: ' . strlen($data_string))
|
357 |
-
);
|
358 |
-
|
359 |
-
// send campaign
|
360 |
-
$result = curl_exec($ch);
|
361 |
-
$result = json_decode($result);
|
362 |
-
$this->_helper->log($result, null, $this->_log_filename);
|
363 |
-
|
364 |
-
return $result;
|
365 |
-
}
|
366 |
-
private function waitFinishedImport($importId){
|
367 |
-
|
368 |
-
do{
|
369 |
-
// wait until do the report status call
|
370 |
-
sleep(self::REST_WAIT_UPLOAD_TIME);
|
371 |
-
// ...the API request
|
372 |
-
// Create a GET request
|
373 |
-
|
374 |
-
$reportUrl = self::REST_CONTACTS_IMPORT . "{$importId}/report";
|
375 |
-
$ch = curl_init($reportUrl);
|
376 |
-
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
|
377 |
-
curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
|
378 |
-
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
379 |
-
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
380 |
-
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
381 |
-
'Content-Type: application/json')
|
382 |
-
);
|
383 |
-
|
384 |
-
// get the report
|
385 |
-
$result = curl_exec($ch);
|
386 |
-
$result = json_decode($result);
|
387 |
-
|
388 |
-
}while(isset($result->message) && $result->message == self::REST_STATUS_REPORT_NOTFINISHED);
|
389 |
-
|
390 |
-
}
|
391 |
-
|
392 |
-
/**
|
393 |
-
* create new connector contact
|
394 |
-
* @param $email
|
395 |
-
* @return mixed
|
396 |
-
*/
|
397 |
-
public function createNewContact($email)
|
398 |
-
{
|
399 |
-
$data = array(
|
400 |
-
'Email' => $email,
|
401 |
-
'EmailType' => 'Html'
|
402 |
-
);
|
403 |
-
$data_string = json_encode($data);
|
404 |
-
$ch = curl_init(self::REST_CONTACTS);
|
405 |
-
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
|
406 |
-
curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
|
407 |
-
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
|
408 |
-
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
409 |
-
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
410 |
-
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
411 |
-
'Content-Type: application/json',
|
412 |
-
'Content-Length: ' . strlen($data_string))
|
413 |
-
);
|
414 |
-
$result = curl_exec($ch);
|
415 |
-
$result = json_decode($result);
|
416 |
-
|
417 |
-
return $result;
|
418 |
-
}
|
419 |
-
|
420 |
-
public function sendIntallInfo($testEmail, $contactId, $campaignId)
|
421 |
-
{
|
422 |
-
$numProducts = Mage::getModel('catalog/product')->getCollection()->getSize();
|
423 |
-
$numCustomers = Mage::getModel('customer/customer')->getCollection()->getSize();
|
424 |
-
|
425 |
-
$data = array(
|
426 |
-
'Email' => $testEmail,
|
427 |
-
'EmailType' => 'Html',
|
428 |
-
'DataFields' => array(
|
429 |
-
array(
|
430 |
-
'Key' => 'INSTALLCUSTOMERS',
|
431 |
-
'Value' => (string)$numCustomers),
|
432 |
-
array(
|
433 |
-
'Key' => 'INSTALLPRODUCTS',
|
434 |
-
'Value' => (string)$numProducts),
|
435 |
-
array(
|
436 |
-
'Key' => 'INSTALLURL',
|
437 |
-
'Value' => Mage::getBaseUrl()),
|
438 |
-
array(
|
439 |
-
'Key' => 'INSTALLAPI',
|
440 |
-
'Value' => implode(',' , $this->getWebsiteAccounts())),
|
441 |
-
array(
|
442 |
-
'Key' => 'PHPMEMORY',
|
443 |
-
'Value' => ini_get('memory_limit') . ', V=' . Mage::helper('connector')->getConnectorVersion()
|
444 |
-
)
|
445 |
-
)
|
446 |
-
);
|
447 |
-
|
448 |
-
$this->updateContact($contactId, $data);
|
449 |
-
$this->sendCampaign($campaignId, array($contactId));
|
450 |
-
|
451 |
-
return ;
|
452 |
-
}
|
453 |
-
private function getWebsiteAccounts()
|
454 |
-
{
|
455 |
-
$accounts = array();
|
456 |
-
$websites = Mage::app()->getWebsites();
|
457 |
-
foreach ($websites as $website) {
|
458 |
-
$websiteId = $website->getWebsiteId();
|
459 |
-
$websiteModel = Mage::app()->getWebsite($websiteId);
|
460 |
-
$apiUsername = $websiteModel->getConfig('connector_api_settings/api_credentials/username');
|
461 |
-
if(! in_array($apiUsername, $accounts))
|
462 |
-
$accounts[] = $apiUsername;
|
463 |
-
}
|
464 |
-
return $accounts;
|
465 |
-
}
|
466 |
-
|
467 |
-
protected function getSuppressedSince($dateString)
|
468 |
-
{
|
469 |
-
$suppressedUrl = self::REST_CONTACTS_SUPPRESSED_SINCE . $dateString;
|
470 |
-
$ch = curl_init($suppressedUrl);
|
471 |
-
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
|
472 |
-
curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
|
473 |
-
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
474 |
-
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
475 |
-
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
476 |
-
'Content-Type: application/json'
|
477 |
-
));
|
478 |
-
|
479 |
-
// get the list of suppressed contacts
|
480 |
-
$data = curl_exec($ch);
|
481 |
-
$data = json_decode($data);
|
482 |
-
|
483 |
-
return $data;
|
484 |
-
|
485 |
-
}
|
486 |
-
public function sendMultiTransactionalData($ordersData, $collectionName = 'Order')
|
487 |
-
{
|
488 |
-
$orders = array();
|
489 |
-
foreach ($ordersData as $order) {
|
490 |
-
if(isset($order->connector_id)){
|
491 |
-
$orders[] = array(
|
492 |
-
'Key' => $order->id,
|
493 |
-
'ContactIdentifier' => $order->connector_id,
|
494 |
-
'Json' => json_encode($order->expose())
|
495 |
-
);
|
496 |
-
}
|
497 |
-
}
|
498 |
-
|
499 |
-
$data_string = json_encode($orders);
|
500 |
-
$transactionalUrl = self::REST_TRANSACTIONAL_DATA_IMPORT . $collectionName;
|
501 |
-
|
502 |
-
$ch = curl_init($transactionalUrl);
|
503 |
-
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
|
504 |
-
curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
|
505 |
-
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
|
506 |
-
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
507 |
-
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
508 |
-
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
509 |
-
'Content-Type: application/json',
|
510 |
-
'Content-Length: ' . strlen($data_string))
|
511 |
-
);
|
512 |
-
|
513 |
-
// send contacts to connector
|
514 |
-
$result = curl_exec($ch);
|
515 |
-
$result = json_decode($result);
|
516 |
-
|
517 |
-
return $result;
|
518 |
-
}
|
519 |
-
protected function sendTransactionalData($quoteData, $collectionName = 'Basket')
|
520 |
-
{
|
521 |
-
// check if the transactional data is already set
|
522 |
-
$transactionalUrl = self::REST_SINGLE_TRANSACTIONAL_DATA_IMPORT . $collectionName . '/' . $quoteData->id ;
|
523 |
-
$ch = curl_init($transactionalUrl);
|
524 |
-
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
|
525 |
-
curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
|
526 |
-
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
527 |
-
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
528 |
-
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
529 |
-
'Content-Type: application/json'
|
530 |
-
));
|
531 |
-
$result = curl_exec($ch);
|
532 |
-
$result = json_decode($result);
|
533 |
-
|
534 |
-
if(isset($result->message) && $result->message == self::REST_TRANSACTIONAL_DATA_NOT_EXISTS)
|
535 |
-
$transactionalUrl = self::REST_SINGLE_TRANSACTIONAL_DATA_IMPORT . $collectionName ;
|
536 |
-
else
|
537 |
-
$transactionalUrl = self::REST_SINGLE_TRANSACTIONAL_DATA_IMPORT . $collectionName . '/' . $result->key ;
|
538 |
-
|
539 |
-
|
540 |
-
$data = array(
|
541 |
-
'Key' => $quoteData->id,
|
542 |
-
'ContactIdentifier' => $quoteData->connector_id,
|
543 |
-
'Json' => json_encode($quoteData->expose())
|
544 |
-
);
|
545 |
-
|
546 |
-
|
547 |
-
$data_string = json_encode($data);
|
548 |
-
|
549 |
-
$ch = curl_init($transactionalUrl);
|
550 |
-
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
|
551 |
-
curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
|
552 |
-
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
|
553 |
-
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
554 |
-
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
555 |
-
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
556 |
-
'Content-Type: application/json',
|
557 |
-
'Content-Length: ' . strlen($data_string))
|
558 |
-
);
|
559 |
-
|
560 |
-
// send contacts to connector
|
561 |
-
$result = curl_exec($ch);
|
562 |
-
$result = json_decode($result);
|
563 |
-
|
564 |
-
return $result;
|
565 |
-
}
|
566 |
-
|
567 |
-
public function sendOrderTransactionalData($order, $collectionName = 'Order', $key = '')
|
568 |
-
{
|
569 |
-
$data = array(
|
570 |
-
'Key' => $order->id,
|
571 |
-
'ContactIdentifier' => $order->connector_id,
|
572 |
-
'Json' => json_encode($order->expose())
|
573 |
-
);
|
574 |
-
|
575 |
-
|
576 |
-
$data_string = json_encode($data);
|
577 |
-
|
578 |
-
$transactionalUrl = self::REST_SINGLE_TRANSACTIONAL_DATA_IMPORT . $collectionName . '/' . $key;
|
579 |
-
|
580 |
-
$ch = curl_init($transactionalUrl);
|
581 |
-
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
|
582 |
-
curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
|
583 |
-
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
|
584 |
-
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
585 |
-
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
586 |
-
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
587 |
-
'Content-Type: application/json',
|
588 |
-
'Content-Length: ' . strlen($data_string))
|
589 |
-
);
|
590 |
-
|
591 |
-
// send contacts to connector
|
592 |
-
$result = curl_exec($ch);
|
593 |
-
$result = json_decode($result);
|
594 |
-
|
595 |
-
if(! isset($result->message)){
|
596 |
-
$this->removeTransactionalData($order->connector_id, 'Basket');
|
597 |
-
}
|
598 |
-
|
599 |
-
return $result;
|
600 |
-
}
|
601 |
-
public function deleteContactsTransactionalData($collectionName = 'Order', $key = '')
|
602 |
-
{
|
603 |
-
|
604 |
-
$transactionalUrl = self::REST_SINGLE_TRANSACTIONAL_DATA_IMPORT . $collectionName . '/' . $key;
|
605 |
-
|
606 |
-
$ch = curl_init($transactionalUrl);
|
607 |
-
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
|
608 |
-
curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
|
609 |
-
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
610 |
-
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
611 |
-
|
612 |
-
// send contacts to connector
|
613 |
-
$result = curl_exec($ch);
|
614 |
-
$result = json_decode($result);
|
615 |
-
|
616 |
-
|
617 |
-
return $result;
|
618 |
-
}
|
619 |
-
|
620 |
-
public function removeTransactionalData($contactId, $collectionName)
|
621 |
-
{
|
622 |
-
$transactionalUrl = 'https://apiconnector.com/v2/contacts/' . $contactId . '/transactional-data/' . $collectionName ;
|
623 |
-
$ch = curl_init($transactionalUrl);
|
624 |
-
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
|
625 |
-
curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
|
626 |
-
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
627 |
-
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
628 |
-
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
629 |
-
'Content-Type: application/json'
|
630 |
-
));
|
631 |
-
$result = curl_exec($ch);
|
632 |
-
|
633 |
-
}
|
634 |
-
|
635 |
-
public function testAccount()
|
636 |
-
{
|
637 |
-
$url = self::REST_ACCOUNT_INFO;
|
638 |
-
$ch = curl_init($url);
|
639 |
-
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
|
640 |
-
curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
|
641 |
-
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
642 |
-
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
643 |
-
$result = curl_exec($ch);
|
644 |
-
$result = json_decode($result);
|
645 |
-
if(isset($result->message)){
|
646 |
-
return false;
|
647 |
-
}
|
648 |
-
|
649 |
-
return true;
|
650 |
-
}
|
651 |
-
|
652 |
-
public function getAddressBookContacts($bookId, $skip = 0)
|
653 |
-
{
|
654 |
-
/**
|
655 |
-
* https://apiconnector.com/v2/address-books/{addressBookId}/contacts?withFullData={withFullData}&select={select}&skip={skip}
|
656 |
-
*/
|
657 |
-
$url = self::REST_ADDRESS_BOOKS . '/' . $bookId . '/contacts' . '?skip=' . $skip;
|
658 |
-
|
659 |
-
$ch = curl_init($url);
|
660 |
-
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
|
661 |
-
curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
|
662 |
-
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
663 |
-
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
664 |
-
$result = curl_exec($ch);
|
665 |
-
$result = json_decode($result);
|
666 |
-
return $result;
|
667 |
-
|
668 |
-
}
|
669 |
-
|
670 |
-
/**
|
671 |
-
* Send a single SMS message.
|
672 |
-
* @param $number
|
673 |
-
* @param $message
|
674 |
-
* @return mixed
|
675 |
-
*/
|
676 |
-
public function postSmsMessagesSendTo($telephoneNumber, $message)
|
677 |
-
{
|
678 |
-
$data = array('Message' => $message);
|
679 |
-
$data_string = json_encode($data);
|
680 |
-
$ch = curl_init(self::REST_SMS_MESSAGE_SEND_TO . $telephoneNumber);
|
681 |
-
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
|
682 |
-
curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
|
683 |
-
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
|
684 |
-
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
685 |
-
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
686 |
-
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
687 |
-
'Content-Type: application/json',
|
688 |
-
'Content-Length: ' . strlen($data_string))
|
689 |
-
);
|
690 |
-
$result = curl_exec($ch);
|
691 |
-
$result = json_decode($result);
|
692 |
-
return $result;
|
693 |
-
}
|
694 |
-
|
695 |
-
public function postContactsTransactionalDataImport($collectionName, $data = array())
|
696 |
-
{
|
697 |
-
$import = array();
|
698 |
-
|
699 |
-
foreach ($data as $one) {
|
700 |
-
|
701 |
-
$import[] = array(
|
702 |
-
'Key' => $one->getId(),
|
703 |
-
'ContactIdentifier' => $one->getCustomerId(),
|
704 |
-
'Json' => json_encode($one->expose())
|
705 |
-
);
|
706 |
-
}
|
707 |
-
|
708 |
-
$data_string = json_encode($import);
|
709 |
-
|
710 |
-
$transactionalUrl = self::REST_TRANSACTIONAL_DATA_IMPORT . $collectionName;
|
711 |
-
|
712 |
-
$ch = curl_init($transactionalUrl);
|
713 |
-
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
|
714 |
-
curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
|
715 |
-
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
|
716 |
-
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
717 |
-
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
718 |
-
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
719 |
-
'Content-Type: application/json',
|
720 |
-
'Content-Length: ' . strlen($data_string))
|
721 |
-
);
|
722 |
-
|
723 |
-
// send contacts to connector
|
724 |
-
$result = curl_exec($ch);
|
725 |
-
$result = json_decode($result);
|
726 |
-
|
727 |
-
return $result;
|
728 |
-
}
|
729 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,286 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Dotdigitalgroup_Email_Model_Connector_Customer{
|
4 |
-
|
5 |
-
// Unique identifier for Dotmail: Email
|
6 |
-
private $_email;
|
7 |
-
|
8 |
-
// Customer Info Data
|
9 |
-
private $_firstname;
|
10 |
-
private $_lastname;
|
11 |
-
private $_dob;
|
12 |
-
private $_gender;
|
13 |
-
private $_title;
|
14 |
-
private $_website_created_on;
|
15 |
-
private $_store_created_on;
|
16 |
-
private $_account_created;
|
17 |
-
private $_last_logged_in;
|
18 |
-
private $_customer_group;
|
19 |
-
// Customer Address Data
|
20 |
-
private $_billing_address_1;
|
21 |
-
private $_billing_address_2;
|
22 |
-
private $_billing_city;
|
23 |
-
private $_billing_country;
|
24 |
-
private $_billing_postcode;
|
25 |
-
private $_billing_telephone;
|
26 |
-
private $_delivery_address_1;
|
27 |
-
private $_delivery_address_2;
|
28 |
-
private $_delivery_city;
|
29 |
-
private $_delivery_country;
|
30 |
-
private $_delivery_postcode;
|
31 |
-
private $_delivery_telephone;
|
32 |
-
// Customer Sales Data
|
33 |
-
private $_total_orders;
|
34 |
-
private $_average_order_value;
|
35 |
-
private $_total_spend;
|
36 |
-
private $_last_order;
|
37 |
-
private $_last_order_no;
|
38 |
-
// Newletter subscriber?
|
39 |
-
private $_is_subscribed_to_newsletter;
|
40 |
-
private $_dotmailer_contact_id;
|
41 |
-
private $_customer_id;
|
42 |
-
|
43 |
-
/**
|
44 |
-
'firstname',
|
45 |
-
'lastname',
|
46 |
-
'dob',
|
47 |
-
'gender',
|
48 |
-
'title',
|
49 |
-
'website_created_on',
|
50 |
-
'store_created_on',
|
51 |
-
'account_created',
|
52 |
-
'last_logged_in',
|
53 |
-
'customer_group',
|
54 |
-
'billing_address_1',
|
55 |
-
'billing_address_2',
|
56 |
-
'billing_city',
|
57 |
-
'billing_country',
|
58 |
-
'billing_postcode',
|
59 |
-
'billing_telephone',
|
60 |
-
'delivery_address_1',
|
61 |
-
'delivery_address_2',
|
62 |
-
'delivery_city',
|
63 |
-
'delivery_country',
|
64 |
-
'delivery_postcode',
|
65 |
-
'delivery_telephone',
|
66 |
-
'total_orders',
|
67 |
-
'average_order_value',
|
68 |
-
'total_spend',
|
69 |
-
'last_order',
|
70 |
-
'last_order_no'
|
71 |
-
*
|
72 |
-
*/
|
73 |
-
|
74 |
-
public function getEmail()
|
75 |
-
{
|
76 |
-
return $this->_email;
|
77 |
-
}
|
78 |
-
|
79 |
-
|
80 |
-
public function setDotmailerContactId($dotmailer_contact_id)
|
81 |
-
{
|
82 |
-
$this->_dotmailer_contact_id = $dotmailer_contact_id;
|
83 |
-
}
|
84 |
-
|
85 |
-
public function getDotmailerContactId()
|
86 |
-
{
|
87 |
-
return $this->_dotmailer_contact_id;
|
88 |
-
}
|
89 |
-
|
90 |
-
public function isSubscribed()
|
91 |
-
{
|
92 |
-
return $this->_is_subscribed_to_newsletter;
|
93 |
-
}
|
94 |
-
|
95 |
-
private $_mapping_hash;
|
96 |
-
|
97 |
-
|
98 |
-
// class constructor - takes
|
99 |
-
public function __construct(Mage_Customer_Model_Customer $customer, $mapping_hash){
|
100 |
-
|
101 |
-
$this->_mapping_hash = $mapping_hash;
|
102 |
-
|
103 |
-
// map each attribute from the $customer parameter (collection item) to the corresponding scoped variable in this class
|
104 |
-
$this->id = $customer->getId();
|
105 |
-
$this->_email = $customer->getEmail();
|
106 |
-
$this->_firstname = $customer->getFirstname();
|
107 |
-
$this->_lastname = $customer->getLastname();
|
108 |
-
$this->_dob = $customer->getDob();
|
109 |
-
$this->_gender = $this->getCustomerGender($customer->getGender());
|
110 |
-
$this->_title = $customer->getPrefix();
|
111 |
-
|
112 |
-
$this->_website_created_on = $this->getWebsiteName($customer->getWebsiteId());
|
113 |
-
$this->_store_created_on = $this->getStoreName($customer->getStoreId());
|
114 |
-
$this->_account_created = $customer->getCreatedAt();
|
115 |
-
$this->_last_logged_in = $customer->getLastLoggedIn();
|
116 |
-
$this->_customer_group = $this->getCustomerGroup($customer->getGroupId());
|
117 |
-
$this->_billing_address_1 = $this->getStreet($customer->getBillingStreet(), 1);
|
118 |
-
$this->_billing_address_2 = $this->getStreet($customer->getBillingStreet(), 2);
|
119 |
-
|
120 |
-
$this->_billing_city = $customer->getBillingCity();
|
121 |
-
$this->_billing_country = $customer->getBillingCountryCode();
|
122 |
-
$this->_billing_postcode = $customer->getBillingPostcode();
|
123 |
-
$this->_billing_telephone = $customer->getBillingTelephone();
|
124 |
-
|
125 |
-
$this->_delivery_address_1 = $this->getStreet($customer->getShippingStreet(), 1);
|
126 |
-
$this->_delivery_address_2 = $this->getStreet($customer->getShippingStreet(), 2);
|
127 |
-
|
128 |
-
$this->_delivery_city = $customer->getShippingCity();
|
129 |
-
$this->_delivery_country = $customer->getShippingCountryCode();
|
130 |
-
$this->_delivery_postcode = $customer->getShippingPostcode();
|
131 |
-
$this->_delivery_telephone = $customer->getShippingTelephone();
|
132 |
-
|
133 |
-
$this->_total_orders = $customer->getTotalOrders();
|
134 |
-
$this->_average_order_value = $customer->getAverageOrderValue();
|
135 |
-
$this->_total_spend = $customer->getTotalSpend();
|
136 |
-
|
137 |
-
$lastOrder = new Zend_Date($customer->getLastPurchase());
|
138 |
-
//$this->_last_order = $lastOrder->toString(Zend_Date::ISO_8601);
|
139 |
-
$this->_last_order = $customer->getLastPurchase();
|
140 |
-
$this->_last_order_no = $customer->getLastOrderNo();
|
141 |
-
|
142 |
-
$this->_is_subscribed_to_newsletter = ($customer->getSubscriberStatus() == Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED)? true : false;
|
143 |
-
$this->_dotmailer_contact_id = $customer->getDotmailerContactId();
|
144 |
-
$this->_customer_id = $customer->getId();
|
145 |
-
}
|
146 |
-
|
147 |
-
public function toCSVArray() {
|
148 |
-
|
149 |
-
// no iterating, just create an array()
|
150 |
-
|
151 |
-
$result = array();
|
152 |
-
|
153 |
-
// Email is the only required field in the CSV upload
|
154 |
-
$result[] = $this->_email;
|
155 |
-
|
156 |
-
if ($this->_mapping_hash[0]!="0") $result[] = $this->_firstname;
|
157 |
-
if ($this->_mapping_hash[1]!="0") $result[] = $this->_lastname;
|
158 |
-
if ($this->_mapping_hash[2]!="0") $result[] = $this->_dob;
|
159 |
-
if ($this->_mapping_hash[3]!="0") $result[] = $this->_gender;
|
160 |
-
if ($this->_mapping_hash[4]!="0") $result[] = $this->_title;
|
161 |
-
|
162 |
-
if ($this->_mapping_hash[5]!="0") $result[] = $this->_website_created_on;
|
163 |
-
if ($this->_mapping_hash[6]!="0") $result[] = $this->_store_created_on;
|
164 |
-
if ($this->_mapping_hash[7]!="0") $result[] = $this->_account_created;
|
165 |
-
if ($this->_mapping_hash[8]!="0") $result[] = $this->_last_logged_in;
|
166 |
-
if ($this->_mapping_hash[9]!="0") $result[] = $this->_customer_group;
|
167 |
-
|
168 |
-
if ($this->_mapping_hash[10]!="0") $result[] = $this->_billing_address_1;
|
169 |
-
if ($this->_mapping_hash[11]!="0") $result[] = $this->_billing_address_2;
|
170 |
-
if ($this->_mapping_hash[12]!="0") $result[] = $this->_billing_city;
|
171 |
-
if ($this->_mapping_hash[13]!="0") $result[] = $this->_billing_country;
|
172 |
-
if ($this->_mapping_hash[14]!="0") $result[] = $this->_billing_postcode;
|
173 |
-
if ($this->_mapping_hash[15]!="0") $result[] = $this->_billing_telephone;
|
174 |
-
|
175 |
-
if ($this->_mapping_hash[16]!="0") $result[] = $this->_delivery_address_1;
|
176 |
-
if ($this->_mapping_hash[17]!="0") $result[] = $this->_delivery_address_2;
|
177 |
-
if ($this->_mapping_hash[18]!="0") $result[] = $this->_delivery_city;
|
178 |
-
if ($this->_mapping_hash[19]!="0") $result[] = $this->_delivery_country;
|
179 |
-
if ($this->_mapping_hash[20]!="0") $result[] = $this->_delivery_postcode;
|
180 |
-
if ($this->_mapping_hash[21]!="0") $result[] = $this->_delivery_telephone;
|
181 |
-
|
182 |
-
if ($this->_mapping_hash[22]!="0") $result[] = $this->_total_orders;
|
183 |
-
if ($this->_mapping_hash[23]!="0") $result[] = $this->_average_order_value;
|
184 |
-
if ($this->_mapping_hash[24]!="0") $result[] = $this->_total_spend;
|
185 |
-
if ($this->_mapping_hash[25]!="0") $result[] = $this->_last_order;
|
186 |
-
if ($this->_mapping_hash[26]!="0") $result[] = $this->_last_order_no;
|
187 |
-
if ($this->_mapping_hash[27]!="0") $result[] = $this->_customer_id;
|
188 |
-
|
189 |
-
$result[] = 'Html';
|
190 |
-
|
191 |
-
return $result;
|
192 |
-
|
193 |
-
}
|
194 |
-
|
195 |
-
// returns the object as JSON
|
196 |
-
public function toJSON(){
|
197 |
-
|
198 |
-
return json_encode($this->expose());
|
199 |
-
|
200 |
-
}
|
201 |
-
|
202 |
-
// exposes the class as an array of objects
|
203 |
-
public function expose() {
|
204 |
-
|
205 |
-
return get_object_vars($this);
|
206 |
-
|
207 |
-
}
|
208 |
-
|
209 |
-
/**
|
210 |
-
* return the gender text label
|
211 |
-
* @param $genderId customer option id
|
212 |
-
* @return string
|
213 |
-
*/
|
214 |
-
public function getCustomerGender($genderId)
|
215 |
-
{
|
216 |
-
if(is_numeric($genderId)){
|
217 |
-
$gender = Mage::getResourceModel('customer/customer')
|
218 |
-
->getAttribute('gender')
|
219 |
-
->getSource()
|
220 |
-
->getOptionText($genderId)
|
221 |
-
;
|
222 |
-
return $gender;
|
223 |
-
}
|
224 |
-
|
225 |
-
return '';
|
226 |
-
}
|
227 |
-
|
228 |
-
/**
|
229 |
-
* get the street name by line number
|
230 |
-
* @param $street
|
231 |
-
* @param $line
|
232 |
-
* @return string
|
233 |
-
*/
|
234 |
-
public function getStreet($street, $line)
|
235 |
-
{
|
236 |
-
$street = explode("\n", $street);
|
237 |
-
if($line == 1){
|
238 |
-
return $street[0];
|
239 |
-
}
|
240 |
-
if(isset($street[$line -1])){
|
241 |
-
|
242 |
-
return $street[$line - 1];
|
243 |
-
}else{
|
244 |
-
|
245 |
-
return '';
|
246 |
-
}
|
247 |
-
}
|
248 |
-
|
249 |
-
/**
|
250 |
-
* get website name
|
251 |
-
* @param $websiteId
|
252 |
-
* @return null|string
|
253 |
-
*/
|
254 |
-
public function getWebsiteName($websiteId)
|
255 |
-
{
|
256 |
-
$website = Mage::app()->getWebsite($websiteId);
|
257 |
-
if($website)
|
258 |
-
return $website->getName();
|
259 |
-
|
260 |
-
return '';
|
261 |
-
}
|
262 |
-
|
263 |
-
public function getStoreName($storeId)
|
264 |
-
{
|
265 |
-
$store = Mage::app()->getStore($storeId);
|
266 |
-
if($store)
|
267 |
-
return $store->getName();
|
268 |
-
|
269 |
-
return '';
|
270 |
-
}
|
271 |
-
|
272 |
-
/**
|
273 |
-
* get the group name
|
274 |
-
* @param $groupId
|
275 |
-
* @return string
|
276 |
-
*/
|
277 |
-
public function getCustomerGroup($groupId)
|
278 |
-
{
|
279 |
-
$group = Mage::getModel('customer/group')->load($groupId);
|
280 |
-
if($group){
|
281 |
-
return $group->getCode();
|
282 |
-
}
|
283 |
-
return '';
|
284 |
-
}
|
285 |
-
|
286 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,118 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Dotdigitalgroup_Email_Model_Connector_Order
|
4 |
-
{
|
5 |
-
public $id;
|
6 |
-
public $connector_id;
|
7 |
-
public $customer_id;
|
8 |
-
protected $store_name;
|
9 |
-
protected $purchase_date;
|
10 |
-
protected $delivery_address;
|
11 |
-
protected $billing_address;
|
12 |
-
protected $products = array();
|
13 |
-
protected $order_subtotal;
|
14 |
-
protected $discount_ammount;
|
15 |
-
protected $order_total;
|
16 |
-
public $quote_id;
|
17 |
-
|
18 |
-
/**
|
19 |
-
* set the order information
|
20 |
-
* @param Mage_Sales_Model_Order $orderData
|
21 |
-
*/
|
22 |
-
public function __construct(Mage_Sales_Model_Order $orderData)
|
23 |
-
{
|
24 |
-
$this->id = $orderData->getIncrementId();
|
25 |
-
$this->store_name = $orderData->getStoreName();
|
26 |
-
|
27 |
-
$created_at = new Zend_Date($orderData->getCreatedAt(), Zend_Date::ISO_8601);
|
28 |
-
$this->purchase_date = $created_at->toString(Zend_Date::ISO_8601);
|
29 |
-
$this->customer_id = $orderData->getCustomerId();
|
30 |
-
|
31 |
-
$customerModel = Mage::getModel('customer/customer')->load($this->customer_id);
|
32 |
-
if(!$customerModel->getDotmailerContactId()){
|
33 |
-
Mage::helper('connector')->log('dotmailer id not found : ' . $customerModel->getDotmailerContactId() . ' ' . $this->customer_id . ' ' . $this->id);
|
34 |
-
}
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
$this->connector_id = $customerModel->getDotmailerContactId();
|
39 |
-
$this->quote_id = $orderData->getQuoteId();
|
40 |
-
|
41 |
-
/**
|
42 |
-
* billing and shipping address
|
43 |
-
*/
|
44 |
-
$deliveryData = $orderData->getShippingAddress()->getData();
|
45 |
-
$this->delivery_address = array(
|
46 |
-
'delivery_address_1' => $this->getStreet($deliveryData['street'], 1),
|
47 |
-
'delivery_address_2' => $this->getStreet($deliveryData['street'], 2),
|
48 |
-
'delivery_city' => $deliveryData['city'],
|
49 |
-
'delivery_country' => $deliveryData['country_id'],
|
50 |
-
'delivery_postcode' => $deliveryData['postcode']
|
51 |
-
);
|
52 |
-
$billingData = $orderData->getBillingAddress()->getData();
|
53 |
-
$this->billing_address = array(
|
54 |
-
'billing_address_1' => $this->getStreet($billingData['street'], 1),
|
55 |
-
'billing_address_2' => $this->getStreet($billingData['street'], 2),
|
56 |
-
'billing_city' => $billingData['city'],
|
57 |
-
'billing_country' => $billingData['country_id'],
|
58 |
-
'billing_postcode' => $billingData['postcode'],
|
59 |
-
);
|
60 |
-
//order products information
|
61 |
-
$products = $orderData->getAllItems();
|
62 |
-
$categories = array();
|
63 |
-
foreach ($products as $productItem) {
|
64 |
-
// product model
|
65 |
-
$product = $productItem->getProduct();
|
66 |
-
if($product){
|
67 |
-
// category names
|
68 |
-
$categoryCollection = $product->getCategoryCollection()
|
69 |
-
->addAttributeToSelect('name');
|
70 |
-
|
71 |
-
foreach ($categoryCollection as $cat) {
|
72 |
-
$categories[] = $cat->getName();
|
73 |
-
}
|
74 |
-
$categoryNames = implode(',', $categories);
|
75 |
-
}
|
76 |
-
|
77 |
-
$this->products[] = array(
|
78 |
-
'name' => $productItem->getName(),
|
79 |
-
'sku' => $productItem->getSku(),
|
80 |
-
'category' => $categoryNames,
|
81 |
-
'qty' => (int)number_format($productItem->getData('qty_ordered'), 2),
|
82 |
-
'price' => (float)number_format($productItem->getPrice(), 2),
|
83 |
-
);
|
84 |
-
}
|
85 |
-
$this->order_subtotal = (float)number_format($orderData->getData('subtotal'), 2);
|
86 |
-
$this->discount_ammount = (float)number_format($orderData->getData('discount_amount'), 2);
|
87 |
-
$orderTotal = abs($orderData->getData('grand_total') - $orderData->getTotalRefunded());
|
88 |
-
$this->order_total = (float)number_format($orderTotal, 2);
|
89 |
-
|
90 |
-
}
|
91 |
-
/**
|
92 |
-
* get the street name by line number
|
93 |
-
* @param $street
|
94 |
-
* @param $line
|
95 |
-
* @return string
|
96 |
-
*/
|
97 |
-
private function getStreet($street, $line)
|
98 |
-
{
|
99 |
-
$street = explode("\n", $street);
|
100 |
-
if($line == 1){
|
101 |
-
return $street[0];
|
102 |
-
}
|
103 |
-
if(isset($street[$line -1])){
|
104 |
-
|
105 |
-
return $street[$line - 1];
|
106 |
-
}else{
|
107 |
-
|
108 |
-
return '';
|
109 |
-
}
|
110 |
-
}
|
111 |
-
// exposes the class as an array of objects
|
112 |
-
public function expose() {
|
113 |
-
|
114 |
-
return get_object_vars($this);
|
115 |
-
|
116 |
-
}
|
117 |
-
|
118 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,75 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Dotdigitalgroup_Email_Model_Connector_Quote
|
4 |
-
{
|
5 |
-
|
6 |
-
public $id;
|
7 |
-
public $connector_id;
|
8 |
-
public $customer_id;
|
9 |
-
protected $store_name;
|
10 |
-
protected $create_date;
|
11 |
-
protected $update_date;
|
12 |
-
protected $delivery_address;
|
13 |
-
protected $billing_address;
|
14 |
-
protected $products = array();
|
15 |
-
protected $order_subtotal;
|
16 |
-
protected $order_total;
|
17 |
-
|
18 |
-
/**
|
19 |
-
* set the quote information
|
20 |
-
* @param Mage_Sales_Model_Quote $quote
|
21 |
-
*/
|
22 |
-
public function __construct(Mage_Sales_Model_Quote $quote)
|
23 |
-
{
|
24 |
-
$this->id = $quote->getId();
|
25 |
-
$this->customer_id = $quote->getCustomerId();
|
26 |
-
$customerModel = Mage::getModel('customer/customer')->load($this->customer_id);
|
27 |
-
$this->connector_id = $customerModel->getData('dotmailer_contact_id');
|
28 |
-
|
29 |
-
$this->store_name = $this->getStoreName($quote->getStoreId());
|
30 |
-
$this->order_subtotal = (float)number_format($quote->getSubtotal(), 2);
|
31 |
-
$this->order_total = (float)number_format($quote->getGrandTotal(), 2);
|
32 |
-
|
33 |
-
$created_at = new Zend_Date($quote->getCreatedAt(), Zend_Date::ISO_8601);
|
34 |
-
$updated_at = new Zend_Date($quote->getUpdatedAt(), Zend_Date::ISO_8601);
|
35 |
-
$this->create_date = $created_at->toString(Zend_Date::ISO_8601);
|
36 |
-
$this->update_date = $updated_at->toString(Zend_Date::ISO_8601);
|
37 |
-
|
38 |
-
$items = $quote->getAllVisibleItems();
|
39 |
-
foreach ($items as $product) {
|
40 |
-
$this->products[] = array(
|
41 |
-
'name' => $product->getName(),
|
42 |
-
'sku' => $product->getSku(),
|
43 |
-
'category' => $this->getCategory($product),
|
44 |
-
'qty' => (float)number_format($product->getQty(), 2),
|
45 |
-
'price' => (float)number_format($product->getPrice(), 2)
|
46 |
-
);
|
47 |
-
}
|
48 |
-
}
|
49 |
-
private function getStoreName($storeId)
|
50 |
-
{
|
51 |
-
$storeModel = Mage::getModel('core/store')->load($storeId);
|
52 |
-
return $storeModel->getName();
|
53 |
-
}
|
54 |
-
private function getCategory($product)
|
55 |
-
{
|
56 |
-
$product = Mage::getModel('catalog/product')->load($product->getProductId());
|
57 |
-
$categories = $product->getCategoryCollection()
|
58 |
-
->addAttributeToSelect('name');
|
59 |
-
$categoryNames = array();
|
60 |
-
foreach ($categories as $cat) {
|
61 |
-
$categoryNames[] = $cat->getName();
|
62 |
-
}
|
63 |
-
|
64 |
-
$categoryNames = implode(',', $categoryNames);
|
65 |
-
return $categoryNames;
|
66 |
-
|
67 |
-
}
|
68 |
-
// exposes the class as an array of objects
|
69 |
-
public function expose() {
|
70 |
-
|
71 |
-
return get_object_vars($this);
|
72 |
-
|
73 |
-
}
|
74 |
-
|
75 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,86 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Dotdigitalgroup_Email_Model_Connector_Wishlist
|
4 |
-
{
|
5 |
-
protected $id;
|
6 |
-
protected $customer_id;
|
7 |
-
protected $connector_id;
|
8 |
-
|
9 |
-
public $name;
|
10 |
-
|
11 |
-
public $items = array();
|
12 |
-
|
13 |
-
protected $total_wishlist_value;
|
14 |
-
|
15 |
-
public function __construct($customer){
|
16 |
-
|
17 |
-
$this->setConnectorId($customer->getDotmailerContactId());
|
18 |
-
$this->setCustomerId($customer->id);
|
19 |
-
}
|
20 |
-
|
21 |
-
/**
|
22 |
-
* @param mixed $connector_id
|
23 |
-
*/
|
24 |
-
public function setConnectorId($connector_id)
|
25 |
-
{
|
26 |
-
$this->connector_id = $connector_id;
|
27 |
-
}
|
28 |
-
|
29 |
-
/**
|
30 |
-
* @return mixed
|
31 |
-
*/
|
32 |
-
public function getConnectorId()
|
33 |
-
{
|
34 |
-
return $this->connector_id;
|
35 |
-
}
|
36 |
-
|
37 |
-
|
38 |
-
/**
|
39 |
-
* @param mixed $customer_id
|
40 |
-
*/
|
41 |
-
public function setCustomerId($customer_id)
|
42 |
-
{
|
43 |
-
$this->customer_id = $customer_id;
|
44 |
-
}
|
45 |
-
|
46 |
-
|
47 |
-
/**
|
48 |
-
* @return mixed
|
49 |
-
*/
|
50 |
-
public function getCustomerId()
|
51 |
-
{
|
52 |
-
return $this->customer_id;
|
53 |
-
}
|
54 |
-
|
55 |
-
/**
|
56 |
-
* @param mixed $id
|
57 |
-
*/
|
58 |
-
public function setId($id)
|
59 |
-
{
|
60 |
-
$this->id = $id;
|
61 |
-
}
|
62 |
-
|
63 |
-
/**
|
64 |
-
* @return mixed
|
65 |
-
*/
|
66 |
-
public function getId()
|
67 |
-
{
|
68 |
-
return $this->id;
|
69 |
-
}
|
70 |
-
|
71 |
-
public function setItem($item)
|
72 |
-
{
|
73 |
-
$this->items[] = $item->expose();
|
74 |
-
|
75 |
-
$this->total_wishlist_value += $item->getTotalValueOfProduct();
|
76 |
-
}
|
77 |
-
|
78 |
-
public function expose() {
|
79 |
-
|
80 |
-
return get_object_vars($this);
|
81 |
-
|
82 |
-
}
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,58 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class Dotdigitalgroup_Email_Model_Cron
|
3 |
-
{
|
4 |
-
/**
|
5 |
-
* CRON FOR CUSTOMER SYNC
|
6 |
-
*/
|
7 |
-
public function customersync()
|
8 |
-
{
|
9 |
-
if(Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CUSTOMER_SYNC_ENABLE))
|
10 |
-
Mage::getModel('connector/customer_customer')->sync();
|
11 |
-
return;
|
12 |
-
}
|
13 |
-
|
14 |
-
/**
|
15 |
-
* CRON FOR LOST BASKET
|
16 |
-
*/
|
17 |
-
public function lostbasketssync()
|
18 |
-
{
|
19 |
-
//look for lost baskets
|
20 |
-
Mage::getModel('connector/sales_quote')->proccessCampaigns();
|
21 |
-
$helper = Mage::helper('connector');
|
22 |
-
if($helper->isOrderTransactionalEnabled()){
|
23 |
-
//send transactional data and mark as imported
|
24 |
-
Mage::getModel('connector/sales_order')->sync();
|
25 |
-
}
|
26 |
-
if($helper->isCustomerSyncEnabled()){
|
27 |
-
//check for customer that have no connector id
|
28 |
-
$numUpdated = Mage::getModel('connector/customer_customer')->syncContacts();
|
29 |
-
Mage::helper('connector')->log('SYNC CONTACTS : '. $numUpdated);
|
30 |
-
}
|
31 |
-
}
|
32 |
-
|
33 |
-
/**
|
34 |
-
* CRON FOR SUPRESSED CONTACTS
|
35 |
-
*/
|
36 |
-
public function suppressedsync()
|
37 |
-
{
|
38 |
-
if(Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CUSTOMER_SUPPRESSED_ENABLE)){
|
39 |
-
//check suppressed contacts from connector
|
40 |
-
Mage::getModel('connector/customer_suppressed')->unsubscribe();
|
41 |
-
}
|
42 |
-
|
43 |
-
}
|
44 |
-
|
45 |
-
/**
|
46 |
-
* CLEAN ARHIVED FOLDERS
|
47 |
-
*/
|
48 |
-
|
49 |
-
public function cleaning()
|
50 |
-
{
|
51 |
-
$helper = Mage::helper('connector/file');
|
52 |
-
$archivedFolder = $helper->getArchiveFolder();
|
53 |
-
$result = $helper->deleteDir($archivedFolder);
|
54 |
-
Mage::helper('connector')->log('Cleaning cronjob result : ' . $result, null, 'api.log');
|
55 |
-
return $result;
|
56 |
-
}
|
57 |
-
|
58 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,480 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Dotdigitalgroup_Email_Model_Customer_Customer extends Dotdigitalgroup_Email_Model_Api_Rest
|
4 |
-
{
|
5 |
-
// xml configuration
|
6 |
-
const XML_PATH_CONNECTOR_API_USERNAME = 'connector_api_settings/api_credentials/username';
|
7 |
-
const XML_PATH_CONNECTOR_API_PASSWORD = 'connector_api_settings/api_credentials/password';
|
8 |
-
const XML_PATH_CUSTOMER_SYNC_ENABLE = 'connector_sync_settings/sync_customer_schedule/enabled';
|
9 |
-
const XML_PATH_CUSTOMER_SYNC_LIMIT = 'connector_advanced_settings/sync_limits/contact';
|
10 |
-
const XML_PATH_CUSTOMER_SUPPRESSED_ENABLE = 'connector_sync_settings/sync_suppressed_schedule/enabled';
|
11 |
-
const XML_PATH_CUSTOMERS_ADDRESS_BOOK_ID = 'connector_data_field_settings/address_book/customers';
|
12 |
-
const XML_PATH_CUSTOMERS_SUPPRESSED_INTERVAL = 'connector_sync_settings/sync_suppressed_schedule/frequency';
|
13 |
-
const XML_PATH_GUEST_ADDRESS_BOOK_ID = 'connector_data_field_settings/address_book/guest';
|
14 |
-
const XML_PATH_CUSTOMER_WISHLIST_ENABLED = 'connector_sync_settings/transactional_data/wishlist_enabled';
|
15 |
-
|
16 |
-
const FORCE_CUSTOMERS_YEARS = '10';
|
17 |
-
|
18 |
-
protected $_customers_address_book_id;
|
19 |
-
protected $_customers = array();
|
20 |
-
protected $_mapping_hash;
|
21 |
-
protected $_website; // website model
|
22 |
-
private $countSubscribers = 0;
|
23 |
-
private $countCustomers = 0;
|
24 |
-
|
25 |
-
protected $accounts = array();// api accounts
|
26 |
-
protected $wishlists = array();// wishlists
|
27 |
-
protected $_proccessing;
|
28 |
-
protected $_websiteId;
|
29 |
-
public $apiLimit = 450;
|
30 |
-
|
31 |
-
public function sync()
|
32 |
-
{
|
33 |
-
/** @var Dotdigitalgroup_Email_Helper_Data $helper */
|
34 |
-
$helper = Mage::helper('connector');
|
35 |
-
$helper->log('Start customer sync..', null, $this->_log_filename);
|
36 |
-
$result = array('error' => false, 'message' => "Done.");
|
37 |
-
|
38 |
-
// check for default settings to use memory limit
|
39 |
-
if(Mage::getStoreConfig('connector_advanced_settings/admin/memory_limit'))
|
40 |
-
$this->allowResourceFullExecution();
|
41 |
-
|
42 |
-
// get all websites
|
43 |
-
foreach(Mage::app()->getWebsites() as $website){
|
44 |
-
|
45 |
-
// skip any actions if sync disabled
|
46 |
-
if(! $website->getConfig(self::XML_PATH_CUSTOMER_SYNC_ENABLE))
|
47 |
-
continue;
|
48 |
-
//API credentials
|
49 |
-
$this->_api_user = $website->getConfig(self::XML_PATH_CONNECTOR_API_USERNAME);
|
50 |
-
$this->_api_password = $website->getConfig(self::XML_PATH_CONNECTOR_API_PASSWORD);
|
51 |
-
|
52 |
-
if(strlen($this->_api_user) > 10 && strlen($this->_api_password)){
|
53 |
-
|
54 |
-
$result = $this->exportCustomersForWebsite($website);
|
55 |
-
if($website->getConfig(self::XML_PATH_CUSTOMER_WISHLIST_ENABLED)){
|
56 |
-
$this->exportWishlistsForWebsite($website);
|
57 |
-
}
|
58 |
-
}else{
|
59 |
-
$result['error'] = true;
|
60 |
-
$message = 'The Credentials For Website :' . $website->getCode() . ' is not set!';
|
61 |
-
$result['message'] = $message;
|
62 |
-
$helper->log($message, null, $this->_log_filename);
|
63 |
-
}
|
64 |
-
}
|
65 |
-
//set result check
|
66 |
-
if($this->countCustomers != 0){
|
67 |
-
|
68 |
-
$message = 'Total Exported : ' . $this->countCustomers . ' Customers, ' . $this->countSubscribers . ' Subscribers.';
|
69 |
-
|
70 |
-
$result['message'] = $message;
|
71 |
-
$helper->log($message, null, $this->_log_filename);
|
72 |
-
}else{
|
73 |
-
$result['error'] = true;
|
74 |
-
$message = 'Check the logs for more information, the number of updated customers is : 0.';
|
75 |
-
$result['message'] = $message;
|
76 |
-
}
|
77 |
-
|
78 |
-
$helper->log('Customer sync end!', null, $this->_log_filename);
|
79 |
-
return $result;
|
80 |
-
}
|
81 |
-
|
82 |
-
/**
|
83 |
-
* Get the customer for the website
|
84 |
-
* @param bool $websiteId
|
85 |
-
* @return mixed
|
86 |
-
*/
|
87 |
-
public function getContactsCustomers($websiteId = false)
|
88 |
-
{
|
89 |
-
/** @var Mage_Customer_Model_Customer $customerCollection */
|
90 |
-
$customerCollection = Mage::getModel('customer/customer')->getCollection()
|
91 |
-
->addAttributeToSelect('dotmailer_contact_id')
|
92 |
-
->addAttributeToFilter('dotmailer_contact_id', array('notnull' => true), 'left')
|
93 |
-
;
|
94 |
-
if($websiteId !== false)
|
95 |
-
$customerCollection->addAttributeToFilter('website_id', $websiteId);
|
96 |
-
|
97 |
-
return $customerCollection;
|
98 |
-
}
|
99 |
-
|
100 |
-
private function countNumOfContacts($contacts)
|
101 |
-
{
|
102 |
-
$total = 0;
|
103 |
-
// Get contacts number with contact id
|
104 |
-
foreach ($contacts as $contact) {
|
105 |
-
if($contact->getDotmailerContactId())
|
106 |
-
$total++;
|
107 |
-
}
|
108 |
-
unset($contacts);
|
109 |
-
return $total;
|
110 |
-
}
|
111 |
-
|
112 |
-
public function syncContacts()
|
113 |
-
{
|
114 |
-
$updated = 0;
|
115 |
-
/**
|
116 |
-
* Customers at website level
|
117 |
-
*/
|
118 |
-
foreach (Mage::app()->getWebsites(true) as $website) {
|
119 |
-
$websiteId = $website->getId();
|
120 |
-
$missingContacts = $this->getMissingContacts($websiteId, $this->apiLimit);
|
121 |
-
Mage::helper('connector')->log('API LIMIT : ' . $this->apiLimit, null, 'api.log');
|
122 |
-
Mage::helper('connector')->log($missingContacts->count(), null, 'api.log');
|
123 |
-
if(count($missingContacts) == 0)
|
124 |
-
continue;
|
125 |
-
//save customer and trigger the obsever
|
126 |
-
foreach($missingContacts as $customer){
|
127 |
-
try{
|
128 |
-
$customer->save();
|
129 |
-
$updated++;
|
130 |
-
//limit the number of updated contacts
|
131 |
-
if($this->apiLimit == $updated){
|
132 |
-
return $updated;
|
133 |
-
}
|
134 |
-
}catch (Exception $e){
|
135 |
-
Mage::logException($e);
|
136 |
-
}
|
137 |
-
}
|
138 |
-
}
|
139 |
-
return $updated;
|
140 |
-
}
|
141 |
-
public function getMissingContacts($websiteId = null, $limit = 200)
|
142 |
-
{
|
143 |
-
$customerCollection = Mage::getModel('customer/customer')->getCollection()
|
144 |
-
->addAttributeToSelect('dotmailer_contact_id')
|
145 |
-
->addAttributeToFilter('dotmailer_contact_id', array('null' => true), 'left')
|
146 |
-
->setPageSize($limit)
|
147 |
-
;
|
148 |
-
if($websiteId !== null)
|
149 |
-
$customerCollection->addAttributeToFilter('website_id', $websiteId);
|
150 |
-
|
151 |
-
return $customerCollection;
|
152 |
-
}
|
153 |
-
public function getTotalNumberCustomers()
|
154 |
-
{
|
155 |
-
$customers = Mage::getModel('customer/customer')->getCollection();
|
156 |
-
$totalCustomers = $customers->getSize();
|
157 |
-
|
158 |
-
return $totalCustomers;
|
159 |
-
}
|
160 |
-
|
161 |
-
public function countSkipContacts($contacts = false, $websiteId)
|
162 |
-
{
|
163 |
-
if($contacts)
|
164 |
-
$numContactIds = $this->countNumOfContacts($contacts);
|
165 |
-
else
|
166 |
-
$numContactIds = count($this->getContactsCustomers($websiteId));
|
167 |
-
|
168 |
-
|
169 |
-
return $numContactIds;
|
170 |
-
}
|
171 |
-
|
172 |
-
/**
|
173 |
-
* @param Mage_Core_Model_Website $website
|
174 |
-
* @return $this
|
175 |
-
*/
|
176 |
-
public function exportCustomersForWebsite(Mage_Core_Model_Website $website)
|
177 |
-
{
|
178 |
-
$websiteCode = $website->getCode();
|
179 |
-
$websiteId = $website->getId();
|
180 |
-
$customer_filename = $websiteCode . '_' . $this->_customers_file_slug . '_' . date('d-M-Y_hms') . '.csv';
|
181 |
-
$subscriber_filename = $websiteCode . '_' . $this->_subscribers_file_slug . '_' . date('d-M-Y_hms') . '.csv';
|
182 |
-
$helper = Mage::helper('connector');
|
183 |
-
|
184 |
-
$helper->log('customer filename : ' . $customer_filename . ', subscriber filename : ' . $subscriber_filename, null, $this->_log_filename);
|
185 |
-
|
186 |
-
$pageNum = 1;
|
187 |
-
$pageSize = $website->getConfig('connector_advanced_settings/admin/batch_size');
|
188 |
-
if($pageSize == '') $pageSize = 5000;
|
189 |
-
$this->fileHelper = Mage::helper('connector/file');
|
190 |
-
|
191 |
-
do{
|
192 |
-
$time_start = microtime(true);
|
193 |
-
|
194 |
-
$currentBatch = $this->getCustomersToExport($pageSize, $pageNum, $this->getMappingHash($website), $website->getId());
|
195 |
-
$condition = count($currentBatch);
|
196 |
-
//write the csv headers
|
197 |
-
if($pageNum == 1 && count($currentBatch)){
|
198 |
-
$this->fileHelper->outputCSV($this->fileHelper->getFilePath($customer_filename), $this->getCsvHeaderArray($website));
|
199 |
-
$this->fileHelper->outputCSV($this->fileHelper->getFilePath($subscriber_filename), array('Email', 'emailType'));
|
200 |
-
}
|
201 |
-
foreach ($currentBatch as $customer) {
|
202 |
-
|
203 |
-
/**
|
204 |
-
* Send wishlist as transactional data
|
205 |
-
*/
|
206 |
-
if($website->getConfig(self::XML_PATH_CUSTOMER_WISHLIST_ENABLED)){
|
207 |
-
$this->setWishlists($customer, $website);
|
208 |
-
}
|
209 |
-
// check if customer is subscribed
|
210 |
-
if($customer->isSubscribed()){
|
211 |
-
// save data for subscribers
|
212 |
-
$this->fileHelper->outputCSV($this->fileHelper->getFilePath($subscriber_filename), array($customer->getEmail(), 'Html'));
|
213 |
-
$this->countSubscribers++;
|
214 |
-
}
|
215 |
-
|
216 |
-
// save data for csutomers
|
217 |
-
$this->fileHelper->outputCSV($this->fileHelper->getFilePath($customer_filename), $customer->toCSVArray());
|
218 |
-
$this->countCustomers++;
|
219 |
-
}
|
220 |
-
$time_end = microtime(true);
|
221 |
-
$time_in_seconds = $time_end - $time_start;
|
222 |
-
|
223 |
-
$helper->log('-----------------------------------------------execution time :' . gmdate("H:i:s", $time_in_seconds), null, $this->_log_filename);
|
224 |
-
$pageNum++;
|
225 |
-
unset($currentBatch);
|
226 |
-
|
227 |
-
}while( $condition == $pageSize );
|
228 |
-
|
229 |
-
$storeIds = Mage::getModel('core/website')->load($websiteId)
|
230 |
-
->getStoreIds();
|
231 |
-
$subscriberModel = new Dotdigitalgroup_Email_Model_Newsletter_Subscriber();
|
232 |
-
$subscribersNotCustomers = $subscriberModel->getSubscribersNotCustomers($storeIds);
|
233 |
-
|
234 |
-
foreach ($subscribersNotCustomers as $one) {
|
235 |
-
$this->fileHelper->outputCSV($this->fileHelper->getFilePath($subscriber_filename), array($one->getSubscriberEmail()));
|
236 |
-
$this->countSubscribers++;
|
237 |
-
}
|
238 |
-
|
239 |
-
/**
|
240 |
-
* Save customers and subscribers to address books
|
241 |
-
*/
|
242 |
-
$this->postAddressBookContactsImport($customer_filename, $website->getConfig(self::XML_PATH_CUSTOMERS_ADDRESS_BOOK_ID));
|
243 |
-
$this->postAddressBookContactsImport($subscriber_filename, $website->getConfig(Dotdigitalgroup_Email_Model_Newsletter_Subscriber::XML_PATH_SUBSCRIBERS_ADDRESS_BOOK_ID));
|
244 |
-
|
245 |
-
//If successful, archive the CSV file and Log something in the Magento Log - success/failure
|
246 |
-
if(file_exists($this->fileHelper->getFilePath($customer_filename)) && file_exists($this->fileHelper->getFilePath($subscriber_filename))){
|
247 |
-
$this->fileHelper->archiveCSV($customer_filename);
|
248 |
-
$this->fileHelper->archiveCSV($subscriber_filename);
|
249 |
-
}
|
250 |
-
return $this;
|
251 |
-
|
252 |
-
}
|
253 |
-
|
254 |
-
private function exportWishlistsForWebsite(Mage_Core_Model_Website $website){
|
255 |
-
|
256 |
-
$this->_api_user = $website->getConfig(self::XML_PATH_CONNECTOR_API_USERNAME);
|
257 |
-
$this->_api_password = $website->getConfig(self::XML_PATH_CONNECTOR_API_PASSWORD);
|
258 |
-
//wishlists for the website key
|
259 |
-
if(isset($this->wishlists[$website->getId()])){
|
260 |
-
|
261 |
-
//send wishlists as transactional data
|
262 |
-
$wishlists = $this->wishlists[$website->getId()];
|
263 |
-
|
264 |
-
$this->postContactsTransactionalDataImport($collectionName = 'Wishlist', $wishlists);
|
265 |
-
}
|
266 |
-
}
|
267 |
-
|
268 |
-
public function getCustomersToExport($pageSize = 0, $pageNum = 1, $mappingHash, $websiteId)
|
269 |
-
{
|
270 |
-
// the filtering and aggregation of all the customer data here
|
271 |
-
$customers = array();
|
272 |
-
$helper = Mage::helper('connector');
|
273 |
-
|
274 |
-
$customerCollection = Mage::getModel('customer/customer')->getCollection()
|
275 |
-
->addAttributeToSelect('email')
|
276 |
-
->addAttributeToSelect('firstname')
|
277 |
-
->addAttributeToSelect('lastname')
|
278 |
-
->addAttributeToSelect('dob')
|
279 |
-
->addAttributeToSelect('gender')
|
280 |
-
->addAttributeToSelect('prefix')
|
281 |
-
->addAttributeToSelect('website_id')
|
282 |
-
->addAttributeToSelect('store_id')
|
283 |
-
->addAttributeToSelect('created_at')
|
284 |
-
->addAttributeToSelect('last_logged_in')
|
285 |
-
->addAttributeToSelect('group_id')
|
286 |
-
->addAttributeToSelect('dob')
|
287 |
-
->addAttributeToSelect('dotmailer_contact_id')
|
288 |
-
|
289 |
-
->addAttributeToFilter('website_id', $websiteId)
|
290 |
-
|
291 |
-
->joinAttribute('billing_street', 'customer_address/street', 'default_billing', null, 'left')
|
292 |
-
->joinAttribute('billing_city', 'customer_address/city', 'default_billing', null, 'left')
|
293 |
-
->joinAttribute('billing_country_code', 'customer_address/country_id', 'default_billing', null, 'left')
|
294 |
-
->joinAttribute('billing_postcode', 'customer_address/postcode', 'default_billing', null, 'left')
|
295 |
-
->joinAttribute('billing_telephone', 'customer_address/telephone', 'default_billing', null, 'left')
|
296 |
-
->joinAttribute('billing_region', 'customer_address/region', 'default_billing', null, 'left')
|
297 |
-
->joinAttribute('shipping_street', 'customer_address/street', 'default_shipping', null, 'left')
|
298 |
-
->joinAttribute('shipping_city', 'customer_address/city', 'default_shipping', null, 'left')
|
299 |
-
->joinAttribute('shipping_country_code', 'customer_address/country_id', 'default_shipping', null, 'left')
|
300 |
-
->joinAttribute('shipping_postcode', 'customer_address/postcode', 'default_shipping', null, 'left')
|
301 |
-
->joinAttribute('shipping_telephone', 'customer_address/telephone', 'default_shipping', null, 'left')
|
302 |
-
->joinAttribute('shipping_region', 'customer_address/region', 'default_shipping', null, 'left')
|
303 |
-
->joinTable('newsletter/subscriber','subscriber_email=email',array('subscriber_status' => 'subscriber_status'), null, 'left')
|
304 |
-
|
305 |
-
;
|
306 |
-
if( $pageSize ){
|
307 |
-
$customerCollection->setPage($pageNum, $pageSize);
|
308 |
-
}
|
309 |
-
|
310 |
-
$customer_log = Mage::getSingleton('core/resource')->getTableName('log_customer');
|
311 |
-
$sales_flat_order_grid = Mage::getSingleton('core/resource')->getTableName('sales_flat_order_grid');
|
312 |
-
$sales_flat_order = Mage::getSingleton('core/resource')->getTableName('sales_flat_order');
|
313 |
-
|
314 |
-
// get the last login from the log_customer table
|
315 |
-
$customerCollection->getSelect()->columns(array('last_logged_in' => new Zend_Db_Expr ("(SELECT login_at
|
316 |
-
FROM $customer_log
|
317 |
-
WHERE customer_id =e.entity_id
|
318 |
-
ORDER BY log_id DESC
|
319 |
-
LIMIT 1)")));
|
320 |
-
|
321 |
-
// customer order information
|
322 |
-
$alias = 'subselect';
|
323 |
-
$subselect = Mage::getModel('Varien_Db_Select',
|
324 |
-
Mage::getSingleton('core/resource')->getConnection('core_read')
|
325 |
-
)->from($sales_flat_order_grid, array(
|
326 |
-
'customer_id as s_customer_id',
|
327 |
-
'sum(grand_total) as total_spend',
|
328 |
-
'count(*) as total_orders',
|
329 |
-
'avg(grand_total) as average_order_value',
|
330 |
-
)
|
331 |
-
)->group('customer_id')
|
332 |
-
;
|
333 |
-
$customerCollection->getSelect()->columns(array(
|
334 |
-
'last_purchase' => new Zend_Db_Expr("(SELECT created_at
|
335 |
-
FROM $sales_flat_order
|
336 |
-
WHERE customer_id =e.entity_id
|
337 |
-
ORDER BY created_at DESC
|
338 |
-
LIMIT 1)"),
|
339 |
-
'last_order_no' => new Zend_Db_Expr("(SELECT entity_id
|
340 |
-
FROM $sales_flat_order
|
341 |
-
WHERE customer_id =e.entity_id
|
342 |
-
ORDER BY created_at DESC
|
343 |
-
LIMIT 1)")
|
344 |
-
));
|
345 |
-
|
346 |
-
$customerCollection->getSelect()
|
347 |
-
->joinLeft(array($alias => $subselect),
|
348 |
-
"{$alias}.s_customer_id = e.entity_id");
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
$time = microtime(true);
|
353 |
-
// create a customer object for each item in our collection
|
354 |
-
foreach ($customerCollection as $item) {
|
355 |
-
|
356 |
-
$customers[] = new Dotdigitalgroup_Email_Model_Connector_Customer($item, $mappingHash);
|
357 |
-
}
|
358 |
-
|
359 |
-
unset($customerCollection);
|
360 |
-
$end_time = microtime(true);
|
361 |
-
$end = $end_time - $time;
|
362 |
-
|
363 |
-
|
364 |
-
$helper->log($pageSize . ': page' . $pageNum . ' for website: ' . $websiteId, null, $this->_log_filename);
|
365 |
-
$helper->log('created dotmailer customers from collection: ' . gmdate("H:i:s", $end), null, $this->_log_filename);
|
366 |
-
|
367 |
-
return $customers;
|
368 |
-
}
|
369 |
-
|
370 |
-
protected function allowResourceFullExecution() {
|
371 |
-
|
372 |
-
/* it may be needed to set maximum execution time of the script to longer,
|
373 |
-
* like 60 minutes than usual */
|
374 |
-
set_time_limit ( 7200 );
|
375 |
-
|
376 |
-
/* and memory to 512 megabytes */
|
377 |
-
ini_set ( 'memory_limit', '512M' );
|
378 |
-
|
379 |
-
return $this;
|
380 |
-
}
|
381 |
-
function convert($size)
|
382 |
-
{
|
383 |
-
$unit=array('b','kb','mb','gb','tb','pb');
|
384 |
-
return @round($size/pow(1024,($i=floor(log($size,1024)))),2).' '.$unit[$i];
|
385 |
-
}
|
386 |
-
|
387 |
-
/**
|
388 |
-
* Create an array of columns we have chosen to map in our System->Config
|
389 |
-
* @param Mage_Core_Model_Website $website
|
390 |
-
* @return array
|
391 |
-
*/
|
392 |
-
public function getCsvHeaderArray(Mage_Core_Model_Website $website) {
|
393 |
-
|
394 |
-
$result = array();
|
395 |
-
|
396 |
-
$result[] = 'Email';
|
397 |
-
|
398 |
-
foreach ($this->getMappingHash($website) as $header) {
|
399 |
-
if ($header != "0") $result[] = $header;
|
400 |
-
}
|
401 |
-
$result[] = 'emailType';
|
402 |
-
|
403 |
-
return $result;
|
404 |
-
}
|
405 |
-
|
406 |
-
/**
|
407 |
-
* Gets the datafield mapping hash from the system config
|
408 |
-
* @param Mage_Core_Model_Website $website
|
409 |
-
* @return array
|
410 |
-
*/
|
411 |
-
protected function getMappingHash(Mage_Core_Model_Website $website){
|
412 |
-
|
413 |
-
|
414 |
-
$customer_fields = array(
|
415 |
-
'customer_data/firstname',
|
416 |
-
'customer_data/lastname',
|
417 |
-
'customer_data/dob',
|
418 |
-
'customer_data/gender',
|
419 |
-
'customer_data/title',
|
420 |
-
'customer_data/website_created_on',
|
421 |
-
'customer_data/store_created_on',
|
422 |
-
'customer_data/account_created',
|
423 |
-
'customer_data/last_logged_in',
|
424 |
-
'customer_data/customer_group',
|
425 |
-
'customer_data/billing_address_1',
|
426 |
-
'customer_data/billing_address_2',
|
427 |
-
'customer_data/billing_city',
|
428 |
-
'customer_data/billing_country',
|
429 |
-
'customer_data/billing_postcode',
|
430 |
-
'customer_data/billing_telephone',
|
431 |
-
'customer_data/delivery_address_1',
|
432 |
-
'customer_data/delivery_address_2',
|
433 |
-
'customer_data/delivery_city',
|
434 |
-
'customer_data/delivery_country',
|
435 |
-
'customer_data/delivery_postcode',
|
436 |
-
'customer_data/delivery_telephone',
|
437 |
-
'customer_data/total_orders',
|
438 |
-
'customer_data/average_order_value',
|
439 |
-
'customer_data/total_spend',
|
440 |
-
'customer_data/last_order',
|
441 |
-
'customer_data/last_order_no',
|
442 |
-
'customer_data/customer_id'
|
443 |
-
);
|
444 |
-
|
445 |
-
$result = array();
|
446 |
-
|
447 |
-
foreach ($customer_fields as $field) {
|
448 |
-
|
449 |
-
$result[] = $website->getConfig('connector_data_field_settings/' . $field);
|
450 |
-
|
451 |
-
}
|
452 |
-
return $result;
|
453 |
-
}
|
454 |
-
|
455 |
-
public function setWishlists($customer, $website)
|
456 |
-
{
|
457 |
-
$customerId = $customer->id;
|
458 |
-
$wishList = Mage::getModel('wishlist/wishlist')->loadByCustomer($customerId);
|
459 |
-
|
460 |
-
/** @var $connectorWishlist */
|
461 |
-
$connectorWishlist = new Dotdigitalgroup_Email_Model_Connector_Wishlist($customer);
|
462 |
-
$connectorWishlist->setId($wishList->getId());
|
463 |
-
|
464 |
-
$wishListItemCollection = $wishList->getItemCollection();
|
465 |
-
|
466 |
-
if (count($wishListItemCollection)) {
|
467 |
-
foreach ($wishListItemCollection as $item) {
|
468 |
-
/* @var $product Mage_Catalog_Model_Product */
|
469 |
-
$product = $item->getProduct();
|
470 |
-
$connectorItem = new Dotdigitalgroup_Email_Model_Customer_Wishlist_Item($product);
|
471 |
-
$connectorItem->setQty($item->getQty());
|
472 |
-
$connectorItem->setPrice($product);
|
473 |
-
$connectorWishlist->setItem($connectorItem);//store for wishlists
|
474 |
-
}
|
475 |
-
//set wishlists for later use
|
476 |
-
$this->wishlists[$website->getId()][] = $connectorWishlist;
|
477 |
-
}
|
478 |
-
}
|
479 |
-
|
480 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,85 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Dotdigitalgroup_Email_Model_Customer_Suppressed extends Dotdigitalgroup_Email_Model_Api_Rest
|
4 |
-
{
|
5 |
-
|
6 |
-
private $suppressedContacts = array();
|
7 |
-
|
8 |
-
public function unsubscribe($force = false)
|
9 |
-
{
|
10 |
-
// result of sync
|
11 |
-
$result = array('errors' => false, 'message' => '', 'customers');
|
12 |
-
$result['customers'] = 0;
|
13 |
-
$date = new Zend_Date();
|
14 |
-
|
15 |
-
/**
|
16 |
-
* 1. calculate from frequency
|
17 |
-
*/
|
18 |
-
if(! $force){
|
19 |
-
$frequency = Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CUSTOMERS_SUPPRESSED_INTERVAL);
|
20 |
-
// get the frequency of sinse date
|
21 |
-
switch($frequency){
|
22 |
-
case('H'):
|
23 |
-
$date = $date->subHour(1);
|
24 |
-
break;
|
25 |
-
case('D'):
|
26 |
-
$date = $date->subDay(1);
|
27 |
-
break;
|
28 |
-
case('W'):
|
29 |
-
$date = $date->subWeek(1);
|
30 |
-
break;
|
31 |
-
case('M'):
|
32 |
-
$date = $date->subMonth(1);
|
33 |
-
break;
|
34 |
-
}
|
35 |
-
}else{
|
36 |
-
|
37 |
-
// force sync all customers
|
38 |
-
$date = $date->subYear(Dotdigitalgroup_Email_Model_Customer_Customer::FORCE_CUSTOMERS_YEARS);
|
39 |
-
}
|
40 |
-
|
41 |
-
// datetime format string
|
42 |
-
$dateString = $date->toString(Zend_Date::W3C);
|
43 |
-
/**
|
44 |
-
* Sync all suppressed for each store
|
45 |
-
*/
|
46 |
-
foreach (Mage::app()->getWebsites(true) as $website) {
|
47 |
-
$this->_api_user = $website->getConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CONNECTOR_API_USERNAME);
|
48 |
-
$this->_api_password = $website->getConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CONNECTOR_API_PASSWORD);
|
49 |
-
$contacts = $this->getSuppressedSince($dateString);
|
50 |
-
if(! empty($contacts)){
|
51 |
-
foreach ($contacts as $suppressed){
|
52 |
-
$contactEmail = false;
|
53 |
-
if(isset($suppressed->suppressedContact)){
|
54 |
-
|
55 |
-
$contactEmail = $suppressed->suppressedContact->email;
|
56 |
-
$contactId = $suppressed->suppressedContact->id;
|
57 |
-
}
|
58 |
-
|
59 |
-
if($contactEmail){
|
60 |
-
try{
|
61 |
-
/**
|
62 |
-
* 3. Unsubscribe customer
|
63 |
-
*/
|
64 |
-
$newsletterModel = Mage::getModel('newsletter/subscriber')->loadByEmail($contactEmail);
|
65 |
-
if($newsletterModel->getStatus() == Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED){
|
66 |
-
$unsubscribe = $newsletterModel->setStatus(Mage_Newsletter_Model_Subscriber::STATUS_UNSUBSCRIBED);
|
67 |
-
$unsubscribe->save();
|
68 |
-
// remove from subscriber address-book
|
69 |
-
$this->deleteAddressBookContact($website->getConfig(Dotdigitalgroup_Email_Model_Newsletter_Subscriber::XML_PATH_SUBSCRIBERS_ADDRESS_BOOK_ID), $contactId);
|
70 |
-
$this->suppressedContacts[$newsletterModel->getSubscriberEmail()] = $newsletterModel->getSubscriberEmail();
|
71 |
-
}
|
72 |
-
}catch (Exception $e){
|
73 |
-
$result['errors'] = true;
|
74 |
-
$result['message'] = 'Error Saving Customer!';
|
75 |
-
}
|
76 |
-
}
|
77 |
-
}
|
78 |
-
}
|
79 |
-
}
|
80 |
-
$result['customers'] = count($this->suppressedContacts);
|
81 |
-
|
82 |
-
return $result;
|
83 |
-
}
|
84 |
-
|
85 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,90 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Dotdigitalgroup_Email_Model_Dynamic_Product_Mapper extends Mage_Core_Model_Abstract
|
4 |
-
{
|
5 |
-
protected $_max_per_child;
|
6 |
-
|
7 |
-
protected $_num_order_items;
|
8 |
-
|
9 |
-
protected $_helper;
|
10 |
-
|
11 |
-
public $_products = array();
|
12 |
-
|
13 |
-
public $filename = 'mapper.log';
|
14 |
-
|
15 |
-
public function __construct($num_order_items)
|
16 |
-
{
|
17 |
-
$this->_helper = Mage::helper('connector');
|
18 |
-
$items_to_display = Mage::helper('connector/recommended')->getLimit();
|
19 |
-
if($num_order_items < $items_to_display)
|
20 |
-
$this->_max_per_child = number_format($items_to_display / $num_order_items);
|
21 |
-
$this->_helper->log('max items per child : ' . $this->_max_per_child . ', items to display : ' . $items_to_display . ', number of order items : ' . $num_order_items, null, $this->filename);
|
22 |
-
|
23 |
-
}
|
24 |
-
|
25 |
-
/**
|
26 |
-
* Set the products with parent limit
|
27 |
-
* @param $products
|
28 |
-
*/
|
29 |
-
public function setProducts($products)
|
30 |
-
{
|
31 |
-
$count = 0;
|
32 |
-
foreach ($products as $product) {
|
33 |
-
if($count < $this->_max_per_child)
|
34 |
-
$this->setProduct($product);
|
35 |
-
$count++;
|
36 |
-
}
|
37 |
-
|
38 |
-
}
|
39 |
-
public function setProduct(Mage_Catalog_Model_Product $product)
|
40 |
-
{
|
41 |
-
$productId = $product->getEntityId();
|
42 |
-
|
43 |
-
if(!isset($this->_products[$productId])){
|
44 |
-
$this->_products[$productId] = $product;
|
45 |
-
return true;
|
46 |
-
}
|
47 |
-
return false;
|
48 |
-
}
|
49 |
-
|
50 |
-
public function countProducts()
|
51 |
-
{
|
52 |
-
return count($this->_products);
|
53 |
-
}
|
54 |
-
|
55 |
-
public function getProducts()
|
56 |
-
{
|
57 |
-
return $this->_products;
|
58 |
-
}
|
59 |
-
|
60 |
-
public function getFallbackProducts($limit)
|
61 |
-
{
|
62 |
-
$count = 0;
|
63 |
-
$fallbackIds = Mage::helper('connector/recommended')->getFallbackIds();
|
64 |
-
$this->_helper->log('fallback products from helper : '. count($fallbackIds), null, $this->filename);
|
65 |
-
|
66 |
-
if(!empty($fallbackIds)){
|
67 |
-
foreach ($fallbackIds as $id) {
|
68 |
-
/** @var Mage_Catalog_Model_Product $product */
|
69 |
-
$product = Mage::getModel('catalog/product')->load($id);
|
70 |
-
|
71 |
-
if($product->getEntityId()){
|
72 |
-
|
73 |
-
$result = $this->setProduct($product);
|
74 |
-
if($result)
|
75 |
-
$count++;
|
76 |
-
|
77 |
-
}
|
78 |
-
|
79 |
-
$this->_helper->log('result for products ' . $this->countProducts() . ', count : ' . $count . ', limit : ' . $limit, null, $this->filename);
|
80 |
-
|
81 |
-
if($count == $limit){
|
82 |
-
|
83 |
-
break;
|
84 |
-
}
|
85 |
-
}
|
86 |
-
}
|
87 |
-
|
88 |
-
return;
|
89 |
-
}
|
90 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,228 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Dotdigitalgroup_Email_Model_Dynamic_Recommended extends Dotdigitalgroup_Email_Model_Dynamic_Product_Mapper
|
4 |
-
{
|
5 |
-
protected $_result_limit;
|
6 |
-
|
7 |
-
protected $_storeId;//order store id
|
8 |
-
|
9 |
-
protected $_order_items = 0;//order product items
|
10 |
-
|
11 |
-
protected $_num_order_items;//number of items from order
|
12 |
-
|
13 |
-
protected $_productMapper;
|
14 |
-
|
15 |
-
protected $_is_log_enabled;
|
16 |
-
|
17 |
-
protected $_helper;
|
18 |
-
|
19 |
-
/**
|
20 |
-
* @param $orderModel
|
21 |
-
*/
|
22 |
-
public function __construct(Mage_Sales_Model_Order $orderModel = null)
|
23 |
-
{
|
24 |
-
if($orderModel){
|
25 |
-
$this->_storeId = $orderModel->getStoreId();
|
26 |
-
$this->_order_items = $orderModel->getAllItems();
|
27 |
-
}
|
28 |
-
$this->_num_order_items = count($this->_order_items);
|
29 |
-
$this->_productMapper = new Dotdigitalgroup_Email_Model_Dynamic_Product_Mapper($this->_num_order_items);
|
30 |
-
$this->_helper = Mage::helper('connector/recommended');
|
31 |
-
$this->_result_limit = $this->_helper->getLimit();
|
32 |
-
}
|
33 |
-
|
34 |
-
/**
|
35 |
-
* Get the recommended products
|
36 |
-
* @return array
|
37 |
-
*/
|
38 |
-
public function getProducts()
|
39 |
-
{
|
40 |
-
$mode = Mage::registry('mode');
|
41 |
-
if($mode == 'related' || $mode == 'upsell' || $mode == 'crosssell'){
|
42 |
-
|
43 |
-
//set the order items
|
44 |
-
$this->setOrderItems();
|
45 |
-
}else{
|
46 |
-
//set products directly without looking for order items
|
47 |
-
$this->setRecommendedProduct();
|
48 |
-
}
|
49 |
-
|
50 |
-
return $this->_productMapper->getProducts();
|
51 |
-
}
|
52 |
-
|
53 |
-
public function setOrderItems()
|
54 |
-
{
|
55 |
-
foreach ($this->_order_items as $item) {
|
56 |
-
$productId = $item->getProductId();
|
57 |
-
/** @var Mage_Catalog_Model_Product $product */
|
58 |
-
$product = Mage::getModel('catalog/product')->load($productId);//make sure the product is loaded
|
59 |
-
|
60 |
-
$this->setRecommendedProduct($product);
|
61 |
-
}
|
62 |
-
|
63 |
-
if($this->_productMapper->countProducts() < $this->_result_limit){
|
64 |
-
$limit = $this->_result_limit - $this->_productMapper->countProducts();
|
65 |
-
$this->_productMapper->getFallbackProducts($limit);
|
66 |
-
}
|
67 |
-
|
68 |
-
return $this->_productMapper->getProducts();
|
69 |
-
}
|
70 |
-
|
71 |
-
public function setRecommendedProduct(Mage_Catalog_Model_Product $productModel = null)
|
72 |
-
{
|
73 |
-
//array of products to display
|
74 |
-
$products = array();
|
75 |
-
|
76 |
-
$mode = Mage::registry('mode');
|
77 |
-
switch($mode){
|
78 |
-
case 'related':
|
79 |
-
$products = $productModel->getRelatedProducts();
|
80 |
-
break;
|
81 |
-
case 'upsell':
|
82 |
-
$products = $productModel->getUpSellProducts();
|
83 |
-
break;
|
84 |
-
case 'crosssell':
|
85 |
-
$products = $productModel->getCrossSellProducts();
|
86 |
-
break;
|
87 |
-
case 'bestsellers':
|
88 |
-
$products = $this->getBestSellersProducts();
|
89 |
-
break;
|
90 |
-
case 'mostviewed':
|
91 |
-
$products = $this->getMostViewedProducts();
|
92 |
-
break;
|
93 |
-
case 'recentlyviewed':
|
94 |
-
$products = $this->getRecentlyViewedProducts();
|
95 |
-
break;
|
96 |
-
case 'productpush':
|
97 |
-
$products = $this->getPushProducts();
|
98 |
-
break;
|
99 |
-
}
|
100 |
-
if($mode == 'related' || $mode == 'upsell' || $mode == 'crosssell'){
|
101 |
-
|
102 |
-
$this->_productMapper->setProducts($products, $this->_result_limit);
|
103 |
-
}
|
104 |
-
|
105 |
-
|
106 |
-
Mage::helper('connector')->log('number of all recommended products : ' . $this->_productMapper->countProducts() . ', max : ' . $this->_result_limit, null, $this->filename);
|
107 |
-
|
108 |
-
}
|
109 |
-
public function getNumberOfOrderItems()
|
110 |
-
{
|
111 |
-
return $this->_order_items;
|
112 |
-
}
|
113 |
-
|
114 |
-
/**
|
115 |
-
* Best Selling products
|
116 |
-
* @return array
|
117 |
-
*/
|
118 |
-
public function getBestSellersProducts()
|
119 |
-
{
|
120 |
-
$limit = $this->_helper->getLimit();
|
121 |
-
$from = $this->_helper->getTimeFromConfig($config = 'bestsellers');
|
122 |
-
$to = new Zend_Date();
|
123 |
-
$to = $to->toString(Zend_Date::ISO_8601);
|
124 |
-
|
125 |
-
$productCollection = Mage::getResourceModel('reports/product_collection')
|
126 |
-
->addOrderedQty($from, $to)
|
127 |
-
->addAttributeToSelect('*')
|
128 |
-
->addAttributeToSelect(array('name', 'price', 'small_image')) //edit to suit tastes
|
129 |
-
->setOrder('ordered_qty', 'desc') //best sellers on top
|
130 |
-
->setPageSize($limit);
|
131 |
-
|
132 |
-
$productCollection->addAttributeToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED);
|
133 |
-
$productCollection->addAttributeToFilter('visibility', Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH);
|
134 |
-
|
135 |
-
foreach ($productCollection as $_product) {
|
136 |
-
$this->_productMapper->setProduct($_product);
|
137 |
-
}
|
138 |
-
|
139 |
-
return array();
|
140 |
-
}
|
141 |
-
|
142 |
-
/**
|
143 |
-
* Most viwed products
|
144 |
-
* @return array
|
145 |
-
*/
|
146 |
-
public function getMostViewedProducts()
|
147 |
-
{
|
148 |
-
$limit = $this->_helper->getLimit();
|
149 |
-
$from = $this->_helper->getTimeFromConfig($config = 'mostviewed');
|
150 |
-
|
151 |
-
$to = new Zend_Date();
|
152 |
-
$to = $to->toString(Zend_Date::ISO_8601);
|
153 |
-
$productCollection = Mage::getResourceModel('reports/product_collection')
|
154 |
-
->addViewsCount()
|
155 |
-
->addViewsCount($from, $to)
|
156 |
-
->setPageSize($limit);
|
157 |
-
|
158 |
-
$productCollection->addAttributeToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED);
|
159 |
-
$productCollection->addAttributeToFilter('visibility', Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH);
|
160 |
-
|
161 |
-
foreach ($productCollection as $_product) {
|
162 |
-
$this->_productMapper->setProduct($_product);
|
163 |
-
}
|
164 |
-
|
165 |
-
|
166 |
-
return $this->_productMapper->getProducts();
|
167 |
-
}
|
168 |
-
|
169 |
-
/**
|
170 |
-
* Recently viewed products
|
171 |
-
* @return $this
|
172 |
-
*/
|
173 |
-
public function getRecentlyViewedProducts()
|
174 |
-
{
|
175 |
-
$customerId = Mage::registry('customer');
|
176 |
-
$helper = Mage::helper('connector');
|
177 |
-
$helper->log('recentlyviewed customer : ' . $customerId, null, $this->filename);
|
178 |
-
if($customerId){
|
179 |
-
|
180 |
-
$limit = $this->_helper->getLimit();
|
181 |
-
|
182 |
-
//login customer to receive the recent products
|
183 |
-
$session = Mage::getSingleton('customer/session');
|
184 |
-
$session->loginById($customerId);
|
185 |
-
|
186 |
-
/** @var Mage_Reports_Block_Product_Viewed $collection */
|
187 |
-
$collection = Mage::getSingleton('Mage_Reports_Block_Product_Viewed');
|
188 |
-
$items = $collection->getItemsCollection()
|
189 |
-
->setPageSize($limit)
|
190 |
-
;
|
191 |
-
|
192 |
-
|
193 |
-
foreach ($items as $product) {
|
194 |
-
$this->_productMapper->setProduct($product);
|
195 |
-
}
|
196 |
-
|
197 |
-
|
198 |
-
return $this->_productMapper->getProducts();
|
199 |
-
}else{
|
200 |
-
|
201 |
-
$helper->log('Get recently viewd products, customer id not found : ' . $customerId, null, $this->filename);
|
202 |
-
}
|
203 |
-
|
204 |
-
return null;
|
205 |
-
}
|
206 |
-
|
207 |
-
public function getPushProducts()
|
208 |
-
{
|
209 |
-
$productIds = $this->_helper->getProductPushIds();
|
210 |
-
|
211 |
-
Mage::helper('connector')->log('proudcts push ids : ' . implode(',', $productIds), null, $this->filename);
|
212 |
-
|
213 |
-
|
214 |
-
$productCollection = Mage::getModel('catalog/product')->getCollection()
|
215 |
-
->addAttributeToFilter('entity_id', array('in' => $productIds))
|
216 |
-
->setPageSize(Mage::helper('connector/recommended')->getLimit())
|
217 |
-
;
|
218 |
-
|
219 |
-
foreach ($productCollection as $_product) {
|
220 |
-
$this->_productMapper->setProduct($_product);
|
221 |
-
|
222 |
-
}
|
223 |
-
|
224 |
-
return $this->_productMapper->getProducts();
|
225 |
-
}
|
226 |
-
|
227 |
-
|
228 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,19 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Dotdigitalgroup_Email_Model_Newsletter_Subscriber extends Mage_Core_Helper_Abstract
|
4 |
-
{
|
5 |
-
const XML_PATH_SUBSCRIBERS_ADDRESS_BOOK_ID = 'connector_data_field_settings/address_book/subscribers';
|
6 |
-
|
7 |
-
// select subscribers that are not registred as customers
|
8 |
-
public function getSubscribersNotCustomers($storeIds = array())
|
9 |
-
{
|
10 |
-
$newsletterCollection = Mage::getModel('newsletter/subscriber')->getCollection()
|
11 |
-
->addFieldToFilter('main_table.customer_id', array('eq' => 0))
|
12 |
-
->addFieldToFilter('subscriber_status', array('eq' => Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED))
|
13 |
-
->addStoreFilter($storeIds)
|
14 |
-
;
|
15 |
-
|
16 |
-
return $newsletterCollection;
|
17 |
-
}
|
18 |
-
|
19 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,189 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Dotdigitalgroup_Email_Model_Observer extends Dotdigitalgroup_Email_Model_Api_Rest
|
4 |
-
{
|
5 |
-
/**
|
6 |
-
* Create new contact or update info also check for email change
|
7 |
-
* event: customer_save_before
|
8 |
-
* @param Varien_Event_Observer $observer
|
9 |
-
* @return $this
|
10 |
-
*/
|
11 |
-
public function handleCustomerSaveBefore(Varien_Event_Observer $observer)
|
12 |
-
{
|
13 |
-
// skip update customer for first time sync
|
14 |
-
if(! Mage::registry('first_time_sync')){
|
15 |
-
|
16 |
-
/* @var $customer Mage_Customer_Model_Customer */
|
17 |
-
$customer = $observer->getEvent()->getCustomer();
|
18 |
-
$email = $customer->getEmail();
|
19 |
-
$websiteId = $customer->getWebsiteId();
|
20 |
-
$subscribed = $customer->getIsSubscribed();
|
21 |
-
|
22 |
-
$this->_api_user = Mage::app()->getWebsite($websiteId)->getConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CONNECTOR_API_USERNAME);
|
23 |
-
$this->_api_password = Mage::app()->getWebsite($websiteId)->getConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CONNECTOR_API_PASSWORD);
|
24 |
-
$subscribersAddressBook = Mage::app()->getWebsite($websiteId)->getConfig(Dotdigitalgroup_Email_Model_Newsletter_Subscriber::XML_PATH_SUBSCRIBERS_ADDRESS_BOOK_ID);
|
25 |
-
|
26 |
-
if($customer->getData('dotmailer_contact_id')){
|
27 |
-
$dotmailerId = $customer->getData('dotmailer_contact_id');
|
28 |
-
//get contact infrmation by id
|
29 |
-
$response = $this->getContactById($dotmailerId);
|
30 |
-
|
31 |
-
//check for matching email
|
32 |
-
if(isset($response->email)){
|
33 |
-
if($email != $response->email){
|
34 |
-
$data = array(
|
35 |
-
'Email' => $email,
|
36 |
-
'EmailType' => 'Html'
|
37 |
-
);
|
38 |
-
//update the contact with same id - different email
|
39 |
-
$this->updateContact($dotmailerId, $data);
|
40 |
-
}
|
41 |
-
|
42 |
-
if(!$subscribed && $response->status == 'Subscribed'){
|
43 |
-
$this->deleteAddressBookContact($subscribersAddressBook, $response->id);
|
44 |
-
}
|
45 |
-
}
|
46 |
-
}else{
|
47 |
-
//get contact info by email
|
48 |
-
$response = $this->getContactByEmail($email);
|
49 |
-
//create new contact and add to address books
|
50 |
-
if(isset($response->message) && $response->message == Dotdigitalgroup_Email_Model_Api_Rest::REST_CONTACT_NOT_FOUND){
|
51 |
-
$contactApi = $this->createNewContact($email);
|
52 |
-
$this->postAddressBookContacts(Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CUSTOMERS_ADDRESS_BOOK_ID), $contactApi);
|
53 |
-
|
54 |
-
if($subscribed){
|
55 |
-
$this->postAddressBookContacts($subscribersAddressBook, $contactApi);
|
56 |
-
}
|
57 |
-
}
|
58 |
-
}
|
59 |
-
|
60 |
-
if(isset($response->id))
|
61 |
-
$customer->setData('dotmailer_contact_id', $response->id);//set the id from contact info
|
62 |
-
}
|
63 |
-
return $this;
|
64 |
-
}
|
65 |
-
/**
|
66 |
-
* event: sales_order_save_after
|
67 |
-
* @param Varien_Event_Observer $observer
|
68 |
-
* @return $this
|
69 |
-
*/
|
70 |
-
public function handleSalesOrderSaveAfter(Varien_Event_Observer $observer)
|
71 |
-
{
|
72 |
-
$order = $observer->getEvent()->getOrder();
|
73 |
-
$storeId = $order->getStoreId();
|
74 |
-
$customerId = $order->getCustomerId();
|
75 |
-
|
76 |
-
$customerModel = Mage::getModel('customer/customer')->load($customerId);
|
77 |
-
|
78 |
-
|
79 |
-
if(!$customerModel->getData('dotmailer_contact_id'))
|
80 |
-
$customerModel->save();
|
81 |
-
|
82 |
-
$this->_api_user = Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CONNECTOR_API_USERNAME, $storeId);
|
83 |
-
$this->_api_password = Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CONNECTOR_API_PASSWORD, $storeId);
|
84 |
-
$is_enabled = Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Sales_Order::XML_PATH_TRANSACTIONAL_DATA_ENABLED, $storeId);
|
85 |
-
|
86 |
-
// store scope enabled
|
87 |
-
if($is_enabled){
|
88 |
-
$dotmailer = new Dotdigitalgroup_Email_Model_Connector_Order($order);
|
89 |
-
$this->sendOrderTransactionalData($dotmailer, 'Order');
|
90 |
-
}
|
91 |
-
|
92 |
-
|
93 |
-
return $this;
|
94 |
-
}
|
95 |
-
|
96 |
-
/**
|
97 |
-
* event: quote_save_after
|
98 |
-
* @param Varien_Event_Observer $observer
|
99 |
-
* @return $this
|
100 |
-
*/
|
101 |
-
public function handleSalesQuoteSaveAfter(Varien_Event_Observer $observer)
|
102 |
-
{
|
103 |
-
$quote = $observer->getQuote();
|
104 |
-
$customerIsNotGuest = $quote->getCustomerId();
|
105 |
-
$storeId = $quote->getStoreId();
|
106 |
-
|
107 |
-
$this->_api_user = Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CONNECTOR_API_USERNAME, $storeId);
|
108 |
-
$this->_api_password = Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CONNECTOR_API_PASSWORD, $storeId);
|
109 |
-
$is_enabled = Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Sales_Order::XML_PATH_TRANSACTIONAL_DATA_ENABLED, $storeId);
|
110 |
-
|
111 |
-
// save quotes that are active
|
112 |
-
if($customerIsNotGuest && $is_enabled && $quote->getIsActive()){
|
113 |
-
$dotmailer = new Dotdigitalgroup_Email_Model_Connector_Quote($quote);
|
114 |
-
$this->sendTransactionalData($dotmailer, 'Basket');
|
115 |
-
}
|
116 |
-
|
117 |
-
return $this;
|
118 |
-
}
|
119 |
-
|
120 |
-
public function handleSalesOrderStatusChange(Varien_Event_Observer $observer)
|
121 |
-
{
|
122 |
-
$order = $observer->getEvent()->getOrder();
|
123 |
-
$status = $order->getStatus();
|
124 |
-
|
125 |
-
/**
|
126 |
-
* SMS functinality
|
127 |
-
*/
|
128 |
-
$smsStatusOne = Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Sales_Sms::XML_PATH_SMS_MESSAGE_ONE_STATUS);
|
129 |
-
$smsStatusTwo = Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Sales_Sms::XML_PATH_SMS_MESSAGE_TWO_STATUS);
|
130 |
-
$smsStatusThree = Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Sales_Sms::XML_PATH_SMS_MESSAGE_THREE_STATUS);
|
131 |
-
$smsStatusFour = Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Sales_Sms::XML_PATH_SMS_MESSAGE_FOUR_STATUS);
|
132 |
-
$smsModel = new Dotdigitalgroup_Email_Model_Sales_Sms();
|
133 |
-
|
134 |
-
switch($status){
|
135 |
-
case $smsStatusOne:
|
136 |
-
$smsModel->sendMessage($order, 'ONE');
|
137 |
-
break;
|
138 |
-
case $smsStatusTwo:
|
139 |
-
$smsModel->sendMessage($order, 'TWO');
|
140 |
-
break;
|
141 |
-
case $smsStatusThree:
|
142 |
-
$smsModel->sendMessage($order, 'THREE');
|
143 |
-
break;
|
144 |
-
case $smsStatusFour:
|
145 |
-
$smsModel->sendMessage($order, 'FOUR');
|
146 |
-
break;
|
147 |
-
}
|
148 |
-
|
149 |
-
return $this;
|
150 |
-
}
|
151 |
-
|
152 |
-
public function handleSalesOrderRefund(Varien_Event_Observer $observer)
|
153 |
-
{
|
154 |
-
$creditmemo = $observer->getEvent()->getCreditmemo();
|
155 |
-
$storeId = $creditmemo->getStoreId();
|
156 |
-
|
157 |
-
$this->_api_user = Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CONNECTOR_API_USERNAME, $storeId);
|
158 |
-
$this->_api_password = Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CONNECTOR_API_PASSWORD, $storeId);
|
159 |
-
$is_enabled = Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Sales_Order::XML_PATH_TRANSACTIONAL_DATA_ENABLED, $storeId);
|
160 |
-
$order = $creditmemo->getOrder();
|
161 |
-
|
162 |
-
// store scope enabled
|
163 |
-
if($is_enabled){
|
164 |
-
$connectorOrder = new Dotdigitalgroup_Email_Model_Connector_Order($order);
|
165 |
-
$result = $this->sendOrderTransactionalData($connectorOrder, 'Order', $order->getIncrementId());
|
166 |
-
$this->_helper->log($result, null, $this->_log_filename);
|
167 |
-
|
168 |
-
}
|
169 |
-
|
170 |
-
return $this;
|
171 |
-
}
|
172 |
-
public function hangleSalesOrderCancel(Varien_Event_Observer $observer)
|
173 |
-
{
|
174 |
-
$order = $observer->getEvent()->getOrder();
|
175 |
-
$storeId = $order->getStoreId();
|
176 |
-
$key = $order->getIncrementId();
|
177 |
-
|
178 |
-
$this->_api_user = Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CONNECTOR_API_USERNAME, $storeId);
|
179 |
-
$this->_api_password = Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CONNECTOR_API_PASSWORD, $storeId);
|
180 |
-
$is_enabled = Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Sales_Order::XML_PATH_TRANSACTIONAL_DATA_ENABLED, $storeId);
|
181 |
-
|
182 |
-
if($is_enabled)
|
183 |
-
$this->deleteContactsTransactionalData('Order', $key);
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
return $this;
|
188 |
-
}
|
189 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,33 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Dotdigitalgroup_Email_Model_Order extends Mage_Sales_Model_Order
|
4 |
-
{
|
5 |
-
protected function _setState($state, $status = false, $comment = '', $isCustomerNotified = null, $shouldProtectState = false)
|
6 |
-
{
|
7 |
-
// dispatch an event before we attempt to do anything
|
8 |
-
Mage::dispatchEvent('sales_order_status_before', array('order' => $this, 'state' => $state, 'status' => $status, 'comment' => $comment, 'isCustomerNotified' => $isCustomerNotified, 'shouldProtectState' => $shouldProtectState));
|
9 |
-
|
10 |
-
// attempt to set the specified state
|
11 |
-
if ($shouldProtectState) {
|
12 |
-
if ($this->isStateProtected($state)) {
|
13 |
-
Mage::throwException(Mage::helper('sales')->__('The Order State "%s" must not be set manually.', $state));
|
14 |
-
}
|
15 |
-
}
|
16 |
-
$this->setData('state', $state);
|
17 |
-
|
18 |
-
// add status history
|
19 |
-
if ($status) {
|
20 |
-
if ($status === true) {
|
21 |
-
$status = $this->getConfig()->getStateDefaultStatus($state);
|
22 |
-
}
|
23 |
-
$this->setStatus($status);
|
24 |
-
$history = $this->addStatusHistoryComment($comment, false); // no sense to set $status again
|
25 |
-
$history->setIsCustomerNotified($isCustomerNotified); // for backwards compatibility
|
26 |
-
}
|
27 |
-
|
28 |
-
// dispatch an event after status has changed
|
29 |
-
Mage::dispatchEvent('sales_order_status_after', array('order' => $this, 'state' => $state, 'status' => $status, 'comment' => $comment, 'isCustomerNotified' => $isCustomerNotified, 'shouldProtectState' => $shouldProtectState));
|
30 |
-
|
31 |
-
return $this;
|
32 |
-
}
|
33 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,96 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Dotdigitalgroup_Email_Model_Sales_Order extends Dotdigitalgroup_Email_Model_Api_Rest
|
4 |
-
{
|
5 |
-
const XML_PATH_TRANSACTIONAL_DATA_ENABLED = 'connector_sync_settings/transactional_data/order_enabled';
|
6 |
-
const XML_PATH_TRANSACTIONAL_DATA_SYNC_LIMIT = 'connector_advanced_settings/sync_limits/orders';
|
7 |
-
|
8 |
-
protected $accounts = array();
|
9 |
-
|
10 |
-
/**
|
11 |
-
* initial sync the transactional data
|
12 |
-
* @return array
|
13 |
-
*/
|
14 |
-
public function sync()
|
15 |
-
{
|
16 |
-
// Initialise a return hash containing results of our sync attempt
|
17 |
-
$this->_searchAccounts();
|
18 |
-
|
19 |
-
foreach ($this->accounts as $account){
|
20 |
-
if(count($account->getOrders())){
|
21 |
-
$this->sendMultiTransactionalData($account->getOrders(), 'Order');
|
22 |
-
|
23 |
-
}
|
24 |
-
|
25 |
-
unset($this->accounts[$account->getApiUsername()]);
|
26 |
-
}
|
27 |
-
return $this;
|
28 |
-
}
|
29 |
-
|
30 |
-
/**
|
31 |
-
*Search the configuration data per website
|
32 |
-
*/
|
33 |
-
private function _searchAccounts()
|
34 |
-
{
|
35 |
-
foreach (Mage::app()->getWebsites() as $website){
|
36 |
-
$enabled = $website->getConfig(self::XML_PATH_TRANSACTIONAL_DATA_ENABLED);
|
37 |
-
|
38 |
-
if(!$enabled)
|
39 |
-
continue;
|
40 |
-
|
41 |
-
$this->_api_user = $website->getConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CONNECTOR_API_USERNAME);
|
42 |
-
$limit = $website->getConfig(self::XML_PATH_TRANSACTIONAL_DATA_SYNC_LIMIT);
|
43 |
-
|
44 |
-
if(!isset($this->accounts[$this->_api_user])){
|
45 |
-
$account = new Dotdigitalgroup_Email_Model_Connector_Account();
|
46 |
-
$account->setApiUsername($this->_api_user);
|
47 |
-
$account->setApiPassword($this->_api_password);
|
48 |
-
$this->accounts[$this->_api_user] = $account;
|
49 |
-
}
|
50 |
-
$this->accounts[$this->_api_user]->setOrders($this->getConnectorOrders($limit));
|
51 |
-
}
|
52 |
-
}
|
53 |
-
|
54 |
-
/**
|
55 |
-
* get all connector orders data
|
56 |
-
* @param $limit
|
57 |
-
* @return array
|
58 |
-
*/
|
59 |
-
public function getConnectorOrders($limit = 100)
|
60 |
-
{
|
61 |
-
$orders = $customers = array();
|
62 |
-
$orderCollection = Mage::getModel('sales/order')->getCollection()
|
63 |
-
->addAttributeToFilter('dotmailer_order_imported', array('null' => true), 'left')
|
64 |
-
->setPageSize($limit);
|
65 |
-
|
66 |
-
$this->_helper->log('GET CONNECTOR ORDERS ' . $orderCollection->count() . ' limit ' . $limit, null, $this->_log_filename);
|
67 |
-
|
68 |
-
//mark as imported for customers with contact id
|
69 |
-
foreach ($orderCollection as $order) {
|
70 |
-
try {
|
71 |
-
$customerEmail = $order->getCustomerEmail();
|
72 |
-
$storeId = $order->getStoreId();
|
73 |
-
$this->setStoreId(Mage::app()->getStore(true)->getId());
|
74 |
-
$websiteId = Mage::getModel('core/store')->load($storeId)->getWebsiteId();
|
75 |
-
|
76 |
-
$customerModel = Mage::getModel('customer/customer')->setWebsiteId($websiteId)
|
77 |
-
->loadByEmail($customerEmail);
|
78 |
-
|
79 |
-
if($customerModel){
|
80 |
-
$contactId = $customerModel->getData('dotmailer_contact_id');
|
81 |
-
if($contactId){
|
82 |
-
$orders[] = new Dotdigitalgroup_Email_Model_Connector_Order($order);
|
83 |
-
$order->setData('dotmailer_order_imported', 1);
|
84 |
-
$order->save();
|
85 |
-
}
|
86 |
-
}
|
87 |
-
}catch(Exception $e){
|
88 |
-
|
89 |
-
|
90 |
-
$this->_helper->log($order->getIncrementId(), null, $this->_log_filename);
|
91 |
-
$this->_helper->log($e->getMessage(), null, $this->_log_filename);
|
92 |
-
}
|
93 |
-
}
|
94 |
-
return $orders;
|
95 |
-
}
|
96 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,289 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Dotdigitalgroup_Email_Model_Sales_Quote extends Dotdigitalgroup_Email_Model_Api_Rest
|
4 |
-
{
|
5 |
-
//xml path configuration
|
6 |
-
const XML_PATH_LOSTBASKET_1_ENABLED = 'lostbaskets/customers/enabled_1';
|
7 |
-
const XML_PATH_LOSTBASKET_2_ENABLED = 'lostbaskets/customers/enabled_2';
|
8 |
-
const XML_PATH_LOSTBASKET_3_ENABLED = 'lostbaskets/customers/enabled_3';
|
9 |
-
|
10 |
-
const XML_PATH_LOSTBASKET_1_INTERVAL = 'lost_basket_settings/customers/send_after_1';
|
11 |
-
const XML_PATH_LOSTBASKET_2_INTERVAL = 'lost_basket_settings/customers/send_after_2';
|
12 |
-
const XML_PATH_LOSTBASKET_3_INTERVAL = 'lost_basket_settings/customers/send_after_3';
|
13 |
-
|
14 |
-
const XML_PATH_TRIGGER_1_CAMPAIGN = 'lost_basket_settings/customers/campaign_1';
|
15 |
-
const XML_PATH_TRIGGER_2_CAMPAIGN = 'lost_basket_settings/customers/campaign_2';
|
16 |
-
const XML_PATH_TRIGGER_3_CAMPAIGN = 'lost_basket_settings/customers/campaign_3';
|
17 |
-
|
18 |
-
const XML_PATH_GUEST_LOSTBASKET_1_ENABLED = 'lostbaskets/guests/enabled_1';
|
19 |
-
const XML_PATH_GUEST_LOSTBASKET_2_ENABLED = 'lostbaskets/guests/enabled_2';
|
20 |
-
const XML_PATH_GUEST_LOSTBASKET_3_ENABLED = 'lostbaskets/guests/enabled_3';
|
21 |
-
|
22 |
-
const XML_PATH_GUEST_LOSTBASKET_1_INTERVAL = 'lost_basket_settings/guests/send_after_1';
|
23 |
-
const XML_PATH_GUEST_LOSTBASKET_2_INTERVAL = 'lost_basket_settings/guests/send_after_2';
|
24 |
-
const XML_PATH_GUEST_LOSTBASKET_3_INTERVAL = 'lost_basket_settings/guests/send_after_3';
|
25 |
-
|
26 |
-
const XML_PATH_GUEST_LOSTBASKET_1_CAMPAIGN = 'lost_basket_settings/guests/campaign_1';
|
27 |
-
const XML_PATH_GUEST_LOSTBASKET_2_CAMPAIGN = 'lost_basket_settings/guests/campaign_2';
|
28 |
-
const XML_PATH_GUEST_LOSTBASKET_3_CAMPAIGN = 'lost_basket_settings/guests/campaign_3';
|
29 |
-
|
30 |
-
const XML_PATH_TEST_LOSTBASKET_EMAIL = 'lost_basket_settings/test/email';
|
31 |
-
|
32 |
-
|
33 |
-
/**
|
34 |
-
* send the lost baskets to campains
|
35 |
-
* @return array
|
36 |
-
*/
|
37 |
-
public function proccessCampaigns()
|
38 |
-
{
|
39 |
-
foreach (Mage::app()->getStores(true) as $store){
|
40 |
-
|
41 |
-
//skip any action if all lost basket campaings are disabled
|
42 |
-
if(!$store->getConfig(self::XML_PATH_LOSTBASKET_1_ENABLED) && !$store->getConfig(self::XML_PATH_LOSTBASKET_2_ENABLED) &&
|
43 |
-
!$store->getConfig(self::XML_PATH_LOSTBASKET_3_ENABLED) && !$store->getConfig(self::XML_PATH_GUEST_LOSTBASKET_1_ENABLED) &&
|
44 |
-
!$store->getconfig(self::XML_PATH_GUEST_LOSTBASKET_2_ENABLED) && !$store->getConfig(self::XML_PATH_GUEST_LOSTBASKET_3_ENABLED)
|
45 |
-
)continue;
|
46 |
-
|
47 |
-
// set credentials for every store
|
48 |
-
$storeId = $store->getId();
|
49 |
-
$this->_api_user = $store->getConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CONNECTOR_API_USERNAME);
|
50 |
-
$this->_api_password = $store->getConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CONNECTOR_API_PASSWORD);
|
51 |
-
|
52 |
-
/**
|
53 |
-
* Customers campaings
|
54 |
-
*/
|
55 |
-
|
56 |
-
//first campign
|
57 |
-
if($store->getConfig(self::XML_PATH_LOSTBASKET_1_ENABLED)){
|
58 |
-
|
59 |
-
$contacts = array();
|
60 |
-
$from = Zend_Date::now()->subMinute($store->getConfig(self::XML_PATH_LOSTBASKET_1_INTERVAL));
|
61 |
-
$to = clone($from);
|
62 |
-
$from->sub('5', Zend_Date::MINUTE);
|
63 |
-
// lost baskets
|
64 |
-
$quoteCollection = $this->_getStoreQuotes($storeId, $from->toString('YYYY-MM-dd HH:mm:ss'), $to->toString('YYYY-MM-dd HH:mm:ss'));
|
65 |
-
if(count($quoteCollection)){
|
66 |
-
|
67 |
-
// get collection contacts id
|
68 |
-
foreach ($quoteCollection as $quote) {
|
69 |
-
$customerId = $quote->getCustomerId();
|
70 |
-
$dotmailerContactId = $this->_getContactIdByCustomerId($customerId);
|
71 |
-
|
72 |
-
if($dotmailerContactId)
|
73 |
-
$contacts[] = $dotmailerContactId;
|
74 |
-
}
|
75 |
-
//check for empty contacts to avoid mass emails
|
76 |
-
if(!empty($contacts))
|
77 |
-
$this->sendCampaign($store->getConfig(self::XML_PATH_TRIGGER_1_CAMPAIGN), $contacts);
|
78 |
-
}
|
79 |
-
}
|
80 |
-
|
81 |
-
//second campaign
|
82 |
-
if($store->getConfig(self::XML_PATH_LOSTBASKET_2_ENABLED)){
|
83 |
-
$contacts = array();
|
84 |
-
$from = Zend_Date::now()->subHour($store->getConfig(self::XML_PATH_LOSTBASKET_2_INTERVAL));
|
85 |
-
$to = clone($from);
|
86 |
-
$from->sub('5', Zend_Date::MINUTE);
|
87 |
-
// lost baskets
|
88 |
-
$quoteCollection = $this->_getStoreQuotes($storeId, $from->toString('YYYY-MM-dd HH:mm:ss'), $to->toString('YYYY-MM-dd HH:mm:ss'));
|
89 |
-
if(count($quoteCollection)){
|
90 |
-
// get collection contacts id
|
91 |
-
foreach ($quoteCollection as $quote) {
|
92 |
-
$customerId = $quote->getCustomerId();
|
93 |
-
$dotmailerContactId = $this->_getContactIdByCustomerId($customerId);
|
94 |
-
if($dotmailerContactId)
|
95 |
-
$contacts[] = $dotmailerContactId;
|
96 |
-
}
|
97 |
-
if(!empty($contacts))
|
98 |
-
$this->sendCampaign($store->getConfig(self::XML_PATH_TRIGGER_2_CAMPAIGN), $contacts);
|
99 |
-
}
|
100 |
-
}
|
101 |
-
|
102 |
-
//third campign
|
103 |
-
if($store->getConfig(self::XML_PATH_LOSTBASKET_3_ENABLED)){
|
104 |
-
$contacts = array();
|
105 |
-
$from = Zend_Date::now()->subHour($store->getConfig(self::XML_PATH_LOSTBASKET_3_INTERVAL));
|
106 |
-
$to = clone($from);
|
107 |
-
$from->sub('5', Zend_Date::MINUTE);
|
108 |
-
// lost baskets
|
109 |
-
$quoteCollection = $this->_getStoreQuotes($storeId, $from->toString('YYYY-MM-dd HH:mm:ss'), $to->toString('YYYY-MM-dd HH:mm:ss'));
|
110 |
-
if(count($quoteCollection)){
|
111 |
-
// get collection contacts id
|
112 |
-
foreach ($quoteCollection as $quote) {
|
113 |
-
$customerId = $quote->getCustomerId();
|
114 |
-
$dotmailerContactId = $this->_getContactIdByCustomerId($customerId);
|
115 |
-
if($dotmailerContactId)
|
116 |
-
$contacts[] = $dotmailerContactId;
|
117 |
-
}
|
118 |
-
if(!empty($contacts))
|
119 |
-
$this->sendCampaign($store->getConfig(self::XML_PATH_TRIGGER_3_CAMPAIGN), $contacts);
|
120 |
-
}
|
121 |
-
}
|
122 |
-
/**
|
123 |
-
* Guests campaings
|
124 |
-
*/
|
125 |
-
//first guest campaign
|
126 |
-
if($store->getConfig(self::XML_PATH_GUEST_LOSTBASKET_1_ENABLED))
|
127 |
-
{
|
128 |
-
$contacts = array();
|
129 |
-
$from = Zend_Date::now()->subMinute($store->getConfig(self::XML_PATH_GUEST_LOSTBASKET_1_INTERVAL));
|
130 |
-
$to = clone($from);
|
131 |
-
$from->sub('5', Zend_Date::MINUTE);
|
132 |
-
$quoteCollection = $this->_getStoreQuotes($storeId, $from->toString('YYYY-MM-dd HH:mm:ss'), $to->toString('YYYY-MM-dd HH:mm:ss'), true);
|
133 |
-
if(count($quoteCollection)){
|
134 |
-
// get collection contacts id
|
135 |
-
foreach ($quoteCollection as $quote) {
|
136 |
-
$email = $quote->getCustomerEmail();
|
137 |
-
//check if the customer exists
|
138 |
-
$response = $this->getContactByEmail($email);
|
139 |
-
|
140 |
-
if(isset($response->message) && $response->message == self::REST_CONTACT_NOT_FOUND){
|
141 |
-
//create new contact before sending campaign
|
142 |
-
$contactAPI = $this->createNewContact($email);
|
143 |
-
if(!isset($contactAPI->message))
|
144 |
-
$response = $this->postAddressBookContacts($store->getConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_GUEST_ADDRESS_BOOK_ID), $contactAPI);
|
145 |
-
}
|
146 |
-
$contacts[] = $response->id;
|
147 |
-
}
|
148 |
-
if(!empty($contacts))
|
149 |
-
$this->sendCampaign($store->getConfig(self::XML_PATH_GUEST_LOSTBASKET_1_CAMPAIGN), $contacts);
|
150 |
-
}
|
151 |
-
}
|
152 |
-
// second guest campaign
|
153 |
-
if($store->getConfig(self::XML_PATH_GUEST_LOSTBASKET_2_ENABLED))
|
154 |
-
{
|
155 |
-
$contacts = array();
|
156 |
-
$from = Zend_Date::now()->subHour($store->getConfig(self::XML_PATH_GUEST_LOSTBASKET_2_INTERVAL));
|
157 |
-
$to = clone($from);
|
158 |
-
$from->sub('5', Zend_Date::MINUTE);
|
159 |
-
// lost baskets
|
160 |
-
$quoteCollection = $this->_getStoreQuotes($storeId, $from->toString('YYYY-MM-dd HH:mm:ss'), $to->toString('YYYY-MM-dd HH:mm:ss'), true);
|
161 |
-
if(count($quoteCollection)){
|
162 |
-
// get collection contacts id
|
163 |
-
foreach ($quoteCollection as $quote) {
|
164 |
-
$email = $quote->getCustomerEmail();
|
165 |
-
//check if the customer exists
|
166 |
-
$response = $this->getContactByEmail($email);
|
167 |
-
if(isset($response->message) && $response->message == self::REST_CONTACT_NOT_FOUND){
|
168 |
-
//create new contact before sending campaign
|
169 |
-
$contactAPI = $this->createNewContact($email);
|
170 |
-
if(!isset($contactAPI->message))
|
171 |
-
$this->postAddressBookContacts($store->getConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_GUEST_ADDRESS_BOOK_ID), $contactAPI);
|
172 |
-
}
|
173 |
-
$contacts[] = $response->id;
|
174 |
-
}
|
175 |
-
if(!empty($contacts))
|
176 |
-
$this->sendCampaign($store->getConfig(self::XML_PATH_GUEST_LOSTBASKET_2_CAMPAIGN), $contacts);
|
177 |
-
}
|
178 |
-
}
|
179 |
-
//third guest campaign
|
180 |
-
if($store->getConfig(self::XML_PATH_GUEST_LOSTBASKET_3_ENABLED)){
|
181 |
-
$contacts = array();
|
182 |
-
$from = Zend_Date::now()->subHour($store->getConfig(self::XML_PATH_GUEST_LOSTBASKET_3_INTERVAL));
|
183 |
-
$to = clone($from);
|
184 |
-
$from->sub('5', Zend_Date::MINUTE);
|
185 |
-
|
186 |
-
// lost baskets
|
187 |
-
$quoteCollection = $this->_getStoreQuotes($storeId, $from->toString('YYYY-MM-dd HH:mm:ss'), $to->toString('YYYY-MM-dd HH:mm:ss'), true);
|
188 |
-
if(count($quoteCollection)){
|
189 |
-
// get collection contacts id
|
190 |
-
foreach ($quoteCollection as $quote) {
|
191 |
-
$email = $quote->getCustomerEmail();
|
192 |
-
//check if the customer exists
|
193 |
-
$response = $this->getContactByEmail($email);
|
194 |
-
|
195 |
-
if(isset($response->message) && $response->message == self::REST_CONTACT_NOT_FOUND){
|
196 |
-
//create new contact before sending campaign
|
197 |
-
$contactAPI = $this->createNewContact($email);
|
198 |
-
if(!isset($contactAPI->message))
|
199 |
-
$this->postAddressBookContacts($store->getConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_GUEST_ADDRESS_BOOK_ID), $contactAPI);
|
200 |
-
}
|
201 |
-
$contacts[] = $response->id;
|
202 |
-
}
|
203 |
-
if(!empty($contacts))
|
204 |
-
$this->sendCampaign($store->getConfig(self::XML_PATH_GUEST_LOSTBASKET_3_CAMPAIGN), $contacts);
|
205 |
-
}
|
206 |
-
}
|
207 |
-
}
|
208 |
-
return;
|
209 |
-
}
|
210 |
-
|
211 |
-
/**
|
212 |
-
* @param $storeId
|
213 |
-
* @param null $from
|
214 |
-
* @param null $to
|
215 |
-
* @param bool $guest
|
216 |
-
* @return Varien_Data_Collection_Db
|
217 |
-
*/
|
218 |
-
private function _getStoreQuotes($storeId, $from = null, $to = null, $guest = false){
|
219 |
-
|
220 |
-
$salesCollection = Mage::getResourceModel('sales/quote_collection')
|
221 |
-
->addFieldToFilter('is_active',1)
|
222 |
-
->addFieldToFilter('items_count', array('gt' => 0))
|
223 |
-
->addFieldToFilter('customer_email', array('neq' => ''))
|
224 |
-
->addFieldToFilter('store_id', $storeId)
|
225 |
-
->addFieldToFilter('updated_at',array(
|
226 |
-
'from' => $from,
|
227 |
-
'to' => $to,
|
228 |
-
'date' => true)
|
229 |
-
);
|
230 |
-
if($guest)
|
231 |
-
$salesCollection->addFieldToFilter('checkout_method' , Mage_Checkout_Model_Type_Onepage::METHOD_GUEST);
|
232 |
-
|
233 |
-
return $salesCollection->load();
|
234 |
-
}
|
235 |
-
|
236 |
-
private function _getContactIdByCustomerId($customerId)
|
237 |
-
{
|
238 |
-
$customerModel = Mage::getModel('customer/customer')->load($customerId);
|
239 |
-
|
240 |
-
if($customerModel){
|
241 |
-
return $customerModel->getData('dotmailer_contact_id');
|
242 |
-
}
|
243 |
-
return false;
|
244 |
-
|
245 |
-
}
|
246 |
-
public function forceProccess()
|
247 |
-
{
|
248 |
-
$result = array('errors' => false, 'message' => '');
|
249 |
-
$contacts = array();
|
250 |
-
$customerEmail = Mage::getStoreConfig(self::XML_PATH_TEST_LOSTBASKET_EMAIL);
|
251 |
-
|
252 |
-
|
253 |
-
$salesCollection = Mage::getResourceModel('sales/quote_collection')
|
254 |
-
->addFieldToFilter('is_active',1)
|
255 |
-
->addFieldToFilter('items_count', array('gt' => 0))
|
256 |
-
->addFieldToFilter('customer_id', array('neq' => ''))
|
257 |
-
->addFieldToFilter('customer_email', $customerEmail)
|
258 |
-
|
259 |
-
//->addFieldToFilter('store_id', $storeId)
|
260 |
-
;
|
261 |
-
$salesCollection->getSelect()->order("updated_at desc");
|
262 |
-
|
263 |
-
|
264 |
-
$quote = $salesCollection->getFirstItem();
|
265 |
-
|
266 |
-
if($quote){
|
267 |
-
|
268 |
-
$contactId = $this->_getContactIdByCustomerId($quote->getCustomerId());
|
269 |
-
|
270 |
-
if($contactId)
|
271 |
-
$contacts[] = $contactId;
|
272 |
-
|
273 |
-
if(!empty($contacts)){
|
274 |
-
|
275 |
-
$responce = $this->sendCampaign(Mage::getStoreConfig(self::XML_PATH_TRIGGER_1_CAMPAIGN), $contacts);
|
276 |
-
if(isset($responce->message)){
|
277 |
-
$result['errors'] = true;
|
278 |
-
$result['message'] = $responce->message;
|
279 |
-
}else{
|
280 |
-
|
281 |
-
$result['message'] = 'First Test Campaign Sent ';
|
282 |
-
}
|
283 |
-
}
|
284 |
-
}
|
285 |
-
return $result;
|
286 |
-
|
287 |
-
}
|
288 |
-
|
289 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,70 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Dotdigitalgroup_Email_Model_Sales_Sms extends Dotdigitalgroup_Email_Model_Api_Rest
|
4 |
-
{
|
5 |
-
const XML_PATH_SMS_MESSAGE_ONE_STATUS = 'sms_section/sms_message_one/order_status';
|
6 |
-
const XML_PATH_SMS_MESSAGE_TWO_STATUS = 'sms_section/sms_message_two/order_status';
|
7 |
-
const XML_PATH_SMS_MESSAGE_THREE_STATUS = 'sms_section/sms_message_three/order_status';
|
8 |
-
const XML_PATH_SMS_MESSAGE_FOUR_STATUS = 'sms_section/sms_message_four/order_status';
|
9 |
-
|
10 |
-
const XML_PATH_SMS_MESSAGE_ONE = 'sms_section/sms_message_one/message';
|
11 |
-
const XML_PATH_SMS_MESSAGE_TWO = 'sms_section/sms_message_two/message';
|
12 |
-
const XML_PATH_SMS_MESSAGE_THREE = 'sms_section/sms_message_three/message';
|
13 |
-
const XML_PATH_SMS_MESSAGE_FOUR = 'sms_section/sms_message_four/message';
|
14 |
-
|
15 |
-
public $_available = array('/customer_name/', '/order_number/', '/{{var /', '/}}/');
|
16 |
-
|
17 |
-
public function sendMessage($order, $number)
|
18 |
-
{
|
19 |
-
$storeId = $order->getStoreId();
|
20 |
-
$billing = $order->getBillingAddress();
|
21 |
-
$customerTelephone = $billing->getTelephone();
|
22 |
-
|
23 |
-
$message = Mage::getStoreConfig(constant('self::XML_PATH_SMS_MESSAGE_' . $number), $storeId);
|
24 |
-
|
25 |
-
$message = $this->_processVariables($order, $message);
|
26 |
-
|
27 |
-
|
28 |
-
$pattern = "/^(\+44\s?7\d{3}|\(?07\d{3}\)?)\s?\d{3}\s?\d{3}$/";
|
29 |
-
|
30 |
-
$match = preg_match($pattern, $customerTelephone);
|
31 |
-
$this->_helper->log('sms number to send : ' . $customerTelephone, null, $this->_log_filename);
|
32 |
-
|
33 |
-
if ($match != false) {
|
34 |
-
$telephoneNumber = preg_replace('/\A(0){1}+/', '+44', $customerTelephone);
|
35 |
-
Mage::helper('connector')->log($telephoneNumber, null, 'api.log');
|
36 |
-
$this->postSmsMessagesSendTo($telephoneNumber, $message);
|
37 |
-
} else {
|
38 |
-
|
39 |
-
$this->_helper->log('telephone number not valid ' . $customerTelephone, null, $this->_log_filename);
|
40 |
-
}
|
41 |
-
}
|
42 |
-
|
43 |
-
/**
|
44 |
-
* @param $order
|
45 |
-
* @param $message
|
46 |
-
* @return mixed
|
47 |
-
*/
|
48 |
-
protected function _processVariables($order, $message)
|
49 |
-
{
|
50 |
-
$helper = Mage::helper('connector');
|
51 |
-
if(preg_match('/{{var/', $message)){
|
52 |
-
|
53 |
-
$firstname = $order->getCustomerFirstname();
|
54 |
-
|
55 |
-
$replacemant = array();
|
56 |
-
$replacemant[] = $firstname;
|
57 |
-
$replacemant[] = $order->getIncrementId();
|
58 |
-
$replacemant[] = '';
|
59 |
-
$replacemant[] = '';
|
60 |
-
|
61 |
-
$message = preg_replace($this->_available, $replacemant, $message);
|
62 |
-
|
63 |
-
$helper->log($message, null, $this->_log_filename);
|
64 |
-
|
65 |
-
}
|
66 |
-
|
67 |
-
return $message;
|
68 |
-
}
|
69 |
-
|
70 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,50 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Dotdigitalgroup_Email_Model_System_Config_Backend_Syncschedule_Customer extends Mage_Core_Model_Config_Data
|
4 |
-
{
|
5 |
-
const CRON_STRING_PATH = 'connector_sync_settings/sync_customer_schedule/cronschedule';
|
6 |
-
|
7 |
-
/**
|
8 |
-
* Cron settings after save
|
9 |
-
*
|
10 |
-
*
|
11 |
-
*/
|
12 |
-
protected function _afterSave()
|
13 |
-
{
|
14 |
-
|
15 |
-
$enabled = $this->getData('groups/sync_customer_schedule/fields/enabled/value');
|
16 |
-
$time = $this->getData('groups/sync_customer_schedule/fields/time/value');
|
17 |
-
$frequency = $this->getData('groups/sync_customer_schedule/fields/frequency/value');
|
18 |
-
|
19 |
-
$frequencyHourly = Dotdigitalgroup_Email_Model_System_Config_Source_Syncfrequency::CRON_HOURLY;
|
20 |
-
$frequencyDaily = Dotdigitalgroup_Email_Model_System_Config_Source_Syncfrequency::CRON_DAILY;
|
21 |
-
$frequencyWeekly = Dotdigitalgroup_Email_Model_System_Config_Source_Syncfrequency::CRON_WEEKLY;
|
22 |
-
$frequencyMonthly = Dotdigitalgroup_Email_Model_System_Config_Source_Syncfrequency::CRON_MONTHLY;
|
23 |
-
|
24 |
-
if ($enabled) {
|
25 |
-
$cronDayOfWeek = date('N');
|
26 |
-
$cronExprArray = array(
|
27 |
-
($frequency == $frequencyHourly) ? intval($time[1]) : '*', # Minute
|
28 |
-
($frequency == $frequencyDaily) ? intval($time[0]) : '*', # Hour
|
29 |
-
($frequency == $frequencyMonthly) ? '1' : '*', # Day of the Month
|
30 |
-
'*', # Month of the Year
|
31 |
-
($frequency == $frequencyWeekly) ? $cronDayOfWeek : '*', # Day of the Week
|
32 |
-
);
|
33 |
-
$cronExprString = join(' ', $cronExprArray);
|
34 |
-
}
|
35 |
-
else {
|
36 |
-
$cronExprString = '';
|
37 |
-
}
|
38 |
-
|
39 |
-
try {
|
40 |
-
// store config $cronExprString
|
41 |
-
Mage::getModel('core/config_data')
|
42 |
-
->load(self::CRON_STRING_PATH, 'path')
|
43 |
-
->setValue($cronExprString)
|
44 |
-
->setPath(self::CRON_STRING_PATH)
|
45 |
-
->save();
|
46 |
-
}catch (Exception $e) {
|
47 |
-
Mage::throwException('Unable to save the cron expression.');
|
48 |
-
}
|
49 |
-
}
|
50 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,54 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Dotdigitalgroup_Email_Model_System_Config_Backend_Syncschedule_Suppressed extends Mage_Core_Model_Config_Data
|
4 |
-
{
|
5 |
-
const CRON_STRING_PATH = 'connector_sync_settings/sync_suppressed_schedule/cronschedulesupp';
|
6 |
-
|
7 |
-
/**
|
8 |
-
* Cron settings after save
|
9 |
-
*
|
10 |
-
*
|
11 |
-
*/
|
12 |
-
protected function _afterSave()
|
13 |
-
{
|
14 |
-
|
15 |
-
$enabled = $this->getData('groups/sync_suppressed_schedule/fields/enabled/value');
|
16 |
-
$time = $this->getData('groups/sync_suppressed_schedule/fields/time/value');
|
17 |
-
$frequency = $this->getData('groups/sync_suppressed_schedule/fields/frequency/value');
|
18 |
-
|
19 |
-
$frequencyHourly = Dotdigitalgroup_Email_Model_System_Config_Source_Syncfrequency::CRON_HOURLY;
|
20 |
-
$frequencyDaily = Dotdigitalgroup_Email_Model_System_Config_Source_Syncfrequency::CRON_DAILY;
|
21 |
-
$frequencyWeekly = Dotdigitalgroup_Email_Model_System_Config_Source_Syncfrequency::CRON_WEEKLY;
|
22 |
-
$frequencyMonthly = Dotdigitalgroup_Email_Model_System_Config_Source_Syncfrequency::CRON_MONTHLY;
|
23 |
-
|
24 |
-
if ($enabled) {
|
25 |
-
$cronDayOfWeek = date('N');
|
26 |
-
$cronExprArray = array(
|
27 |
-
($frequency == $frequencyHourly) ? intval($time[1]) : '*', # Minute
|
28 |
-
($frequency == $frequencyDaily) ? intval($time[0]) : '*', # Hour
|
29 |
-
($frequency == $frequencyMonthly) ? '1' : '*', # Day of the Month
|
30 |
-
'*', # Month of the Year
|
31 |
-
($frequency == $frequencyWeekly) ? $cronDayOfWeek : '*', # Day of the Week
|
32 |
-
);
|
33 |
-
$cronExprString = join(' ', $cronExprArray);
|
34 |
-
}
|
35 |
-
else {
|
36 |
-
$cronExprString = '';
|
37 |
-
}
|
38 |
-
|
39 |
-
try {
|
40 |
-
// store config $cronExprString
|
41 |
-
|
42 |
-
|
43 |
-
Mage::getModel('core/config_data')
|
44 |
-
->load(self::CRON_STRING_PATH, 'path')
|
45 |
-
->setValue($cronExprString)
|
46 |
-
->setPath(self::CRON_STRING_PATH)
|
47 |
-
->save();
|
48 |
-
|
49 |
-
}
|
50 |
-
catch (Exception $e) {
|
51 |
-
Mage::throwException('Unable to save the cron expression.');
|
52 |
-
}
|
53 |
-
}
|
54 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,12 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Dotdigitalgroup_Email_Model_System_Config_Source_Activebasket
|
4 |
-
{
|
5 |
-
function toOptionArray()
|
6 |
-
{
|
7 |
-
return array(
|
8 |
-
array('value' => '0', 'label' => Mage::helper('connector')->__('Success Page')),
|
9 |
-
array('value' => '1', 'label' => Mage::helper('connector')->__('Complete Order'))
|
10 |
-
);
|
11 |
-
}
|
12 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,30 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Dotdigitalgroup_Email_Model_System_Config_Source_Addressbooks extends Dotdigitalgroup_Email_Model_Api_Rest
|
4 |
-
{
|
5 |
-
// Returns the account's datafields
|
6 |
-
public function toOptionArray()
|
7 |
-
{
|
8 |
-
$fields = array();
|
9 |
-
//load the configuration for website select in admin
|
10 |
-
$websiteName = Mage::app()->getRequest()->getParam('website');
|
11 |
-
if(! empty($websiteName)){
|
12 |
-
$websites = Mage::getModel('core/website')->getCollection()
|
13 |
-
->addFieldToFilter('code', $websiteName);
|
14 |
-
$website = $websites->getFirstItem();
|
15 |
-
$this->_api_user = $website->getConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CONNECTOR_API_USERNAME);
|
16 |
-
$this->_api_password = $website->getConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CONNECTOR_API_PASSWORD);
|
17 |
-
}
|
18 |
-
$addressBooks = $this->postAddressBooks();
|
19 |
-
|
20 |
-
//set up fields with book id and label
|
21 |
-
foreach ($addressBooks as $book){
|
22 |
-
|
23 |
-
if(isset($book->id))
|
24 |
-
$fields[] = array('value' => $book->id, 'label' => $book->name);
|
25 |
-
}
|
26 |
-
|
27 |
-
return $fields;
|
28 |
-
}
|
29 |
-
|
30 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,30 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Date: 15/04/2013
|
4 |
-
* Time: 13:46
|
5 |
-
*/
|
6 |
-
class Dotdigitalgroup_Email_Model_System_Config_Source_Campaigns extends Dotdigitalgroup_Email_Model_Api_Rest
|
7 |
-
{
|
8 |
-
|
9 |
-
// Returns the account's datafields
|
10 |
-
public function toOptionArray()
|
11 |
-
{
|
12 |
-
$fields = array();
|
13 |
-
$websiteName = Mage::app()->getRequest()->getParam('website');
|
14 |
-
if(! empty($websiteName)){
|
15 |
-
$websites = Mage::getModel('core/website')->getCollection()
|
16 |
-
->addFieldToFilter('code', $websiteName);
|
17 |
-
$website = $websites->getFirstItem();
|
18 |
-
$this->_api_user = $website->getConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CONNECTOR_API_USERNAME);
|
19 |
-
$this->_api_password = $website->getConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CONNECTOR_API_PASSWORD);
|
20 |
-
}
|
21 |
-
$campaigns = $this->postCampaigns();
|
22 |
-
foreach ($campaigns as $one){
|
23 |
-
if(isset($one->id))
|
24 |
-
$fields[] = array('value' => $one->id, 'label' => $one->name);
|
25 |
-
}
|
26 |
-
|
27 |
-
return $fields;
|
28 |
-
}
|
29 |
-
|
30 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,35 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Date: 15/04/2013
|
4 |
-
* Time: 13:46
|
5 |
-
*/
|
6 |
-
class Dotdigitalgroup_Email_Model_System_Config_Source_Datafields extends Dotdigitalgroup_Email_Model_Api_Rest
|
7 |
-
{
|
8 |
-
|
9 |
-
// Returns the account's datafields
|
10 |
-
public function toOptionArray()
|
11 |
-
{
|
12 |
-
$fields = array();
|
13 |
-
//load the configuration for website select in admin
|
14 |
-
$websiteName = Mage::app()->getRequest()->getParam('website');
|
15 |
-
if(! empty($websiteName)){
|
16 |
-
$websites = Mage::getModel('core/website')->getCollection()
|
17 |
-
->addFieldToFilter('code', $websiteName);
|
18 |
-
$website = $websites->getFirstItem();
|
19 |
-
$this->_api_user = $website->getConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CONNECTOR_API_USERNAME);
|
20 |
-
$this->_api_password = $website->getConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CONNECTOR_API_PASSWORD);
|
21 |
-
}
|
22 |
-
|
23 |
-
// Add a "Do Not Map" Option
|
24 |
-
$fields[] = array('value' => 0, 'label' => 'Do Not Map');
|
25 |
-
|
26 |
-
$datafileds = $this->postDataFields();
|
27 |
-
foreach ($datafileds as $datafield) {
|
28 |
-
if(isset($datafield->name))
|
29 |
-
$fields[] = array('value' => $datafield->name, 'label' => $datafield->name);
|
30 |
-
}
|
31 |
-
|
32 |
-
return $fields;
|
33 |
-
}
|
34 |
-
|
35 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,12 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Dotdigitalgroup_Email_Model_System_Config_Source_Displayifnot
|
4 |
-
{
|
5 |
-
public function toOptionArray()
|
6 |
-
{
|
7 |
-
return array(
|
8 |
-
array('value' => 'best-sellers', 'label' => Mage::helper('connector')->__('Best Sellers')),
|
9 |
-
array('value' => 'most-viewed', 'label' => Mage::helper('connector')->__('Most Viewed'))
|
10 |
-
);
|
11 |
-
}
|
12 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,16 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Dotdigitalgroup_Email_Model_System_Config_Source_Orderstatus
|
4 |
-
{
|
5 |
-
public function toOptionArray(){
|
6 |
-
|
7 |
-
$statusCollection = Mage::getModel('sales/order_status')->getCollection();
|
8 |
-
$statuses = array();
|
9 |
-
|
10 |
-
foreach ($statusCollection as $one) {
|
11 |
-
$statuses[] = array('value' => $one->getStatus(), 'label' => Mage::helper('connector')->__($one->getLabel()));
|
12 |
-
}
|
13 |
-
|
14 |
-
return $statuses;
|
15 |
-
}
|
16 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,30 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Dotdigitalgroup_Email_Model_System_Config_Source_SendCampain
|
4 |
-
{
|
5 |
-
/**
|
6 |
-
* send to campain options hours
|
7 |
-
* @return array
|
8 |
-
*/
|
9 |
-
public function toOptionArray()
|
10 |
-
{
|
11 |
-
return array(
|
12 |
-
array('value'=>1 , 'label'=>Mage::helper('adminhtml')->__('1 Hour')),
|
13 |
-
array('value'=>2 , 'label'=>Mage::helper('adminhtml')->__('2 Hours')),
|
14 |
-
array('value'=>3 , 'label'=>Mage::helper('adminhtml')->__('3 Hours')),
|
15 |
-
array('value'=>4 , 'label'=>Mage::helper('adminhtml')->__('4 Hours')),
|
16 |
-
array('value'=>5 , 'label'=>Mage::helper('adminhtml')->__('5 Hours')),
|
17 |
-
array('value'=>6 , 'label'=>Mage::helper('adminhtml')->__('6 Hours')),
|
18 |
-
array('value'=>12 , 'label'=>Mage::helper('adminhtml')->__('12 Hours')),
|
19 |
-
array('value'=>36 , 'label'=>Mage::helper('adminhtml')->__('36 Hours')),
|
20 |
-
array('value'=>48 , 'label'=>Mage::helper('adminhtml')->__('48 Hours')),
|
21 |
-
array('value'=>60 , 'label'=>Mage::helper('adminhtml')->__('60 Hours')),
|
22 |
-
array('value'=>72 , 'label'=>Mage::helper('adminhtml')->__('72 Hours')),
|
23 |
-
array('value'=>84 , 'label'=>Mage::helper('adminhtml')->__('84 Hours')),
|
24 |
-
array('value'=>96 , 'label'=>Mage::helper('adminhtml')->__('96 Hours')),
|
25 |
-
array('value'=>108 , 'label'=>Mage::helper('adminhtml')->__('108 Hours')),
|
26 |
-
array('value'=>120 , 'label'=>Mage::helper('adminhtml')->__('120 Hours')),
|
27 |
-
);
|
28 |
-
|
29 |
-
}
|
30 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,40 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Dotdigitalgroup_Email_Model_System_Config_Source_Syncfrequency
|
4 |
-
{
|
5 |
-
|
6 |
-
protected static $_options;
|
7 |
-
|
8 |
-
const CRON_HOURLY = 'H';
|
9 |
-
const CRON_DAILY = 'D';
|
10 |
-
const CRON_WEEKLY = 'W';
|
11 |
-
const CRON_MONTHLY = 'M';
|
12 |
-
|
13 |
-
public function toOptionArray()
|
14 |
-
{
|
15 |
-
if (!self::$_options) {
|
16 |
-
self::$_options = array(
|
17 |
-
array(
|
18 |
-
'label' => Mage::helper('cron')->__('Hourly'),
|
19 |
-
'value' => self::CRON_HOURLY,
|
20 |
-
),
|
21 |
-
array(
|
22 |
-
'label' => Mage::helper('cron')->__('Daily'),
|
23 |
-
'value' => self::CRON_DAILY,
|
24 |
-
),
|
25 |
-
array(
|
26 |
-
'label' => Mage::helper('cron')->__('Weekly'),
|
27 |
-
'value' => self::CRON_WEEKLY,
|
28 |
-
),
|
29 |
-
array(
|
30 |
-
'label' => Mage::helper('cron')->__('Monthly'),
|
31 |
-
'value' => self::CRON_MONTHLY,
|
32 |
-
),
|
33 |
-
);
|
34 |
-
}
|
35 |
-
return self::$_options;
|
36 |
-
}
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,13 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Dotdigitalgroup_Email_Model_System_Config_Source_Timeperiod
|
4 |
-
{
|
5 |
-
public function toOptionArray()
|
6 |
-
{
|
7 |
-
return array(
|
8 |
-
array('value' => 'week', 'label' => Mage::helper('connector')->__('Week')),
|
9 |
-
array('value' => 'month', 'label' => Mage::helper('connector')->__('Month')),
|
10 |
-
array('value' => 'year', 'label' => Mage::helper('connector')->__('Year'))
|
11 |
-
);
|
12 |
-
}
|
13 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,18 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class Dotdigitalgroup_Email_Test_Model_Product extends EcomDev_PHPUnit_Test_Case
|
3 |
-
{
|
4 |
-
|
5 |
-
public function testIfTheAnswerToTheUniverseIs42()
|
6 |
-
{
|
7 |
-
|
8 |
-
$productModel = Mage::getModel('catalog/product')->load(39);
|
9 |
-
|
10 |
-
|
11 |
-
$price = $productModel->getPrice();
|
12 |
-
|
13 |
-
$this->assertEquals('20', $price);
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
}
|
18 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,125 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Dotdigitalgroup_Email_Adminhtml_DebugController extends Mage_Adminhtml_Controller_Action
|
4 |
-
{
|
5 |
-
|
6 |
-
public function forcecustomersyncAction()
|
7 |
-
{
|
8 |
-
$result = Mage::getModel('connector/customer_customer')->sync();
|
9 |
-
|
10 |
-
if ($result['error']) {
|
11 |
-
Mage::getSingleton('adminhtml/session')->addError($result['message']);
|
12 |
-
}else {
|
13 |
-
Mage::getSingleton('adminhtml/session')->addSuccess($result['message']);
|
14 |
-
}
|
15 |
-
$this->_redirectReferer();
|
16 |
-
}
|
17 |
-
|
18 |
-
public function forcelostbasketsyncAction()
|
19 |
-
{
|
20 |
-
|
21 |
-
$result = Mage::getModel('connector/sales_quote')->forceProccess();
|
22 |
-
|
23 |
-
if ($result['errors'])
|
24 |
-
Mage::getSingleton('adminhtml/session')->addError($result['message']);
|
25 |
-
else
|
26 |
-
Mage::getSingleton('adminhtml/session')->addSuccess($result['message']);
|
27 |
-
|
28 |
-
$this->_redirectReferer();
|
29 |
-
}
|
30 |
-
|
31 |
-
public function forcesuppressedAction()
|
32 |
-
{
|
33 |
-
// forse sync
|
34 |
-
$result = Mage::getModel('connector/customer_suppressed')->unsubscribe(true);
|
35 |
-
|
36 |
-
if($result['errors']){
|
37 |
-
Mage::getSingleton('adminhtml/session')->addError($result['message']);
|
38 |
-
}else{
|
39 |
-
|
40 |
-
if($result['customers'] > 0)
|
41 |
-
Mage::getSingleton('adminhtml/session')->addSuccess('Customers Unsubscribed : ' . $result['customers']);
|
42 |
-
else
|
43 |
-
Mage::getSingleton('adminhtml/session')->addSuccess('Done.');
|
44 |
-
}
|
45 |
-
|
46 |
-
$this->_redirectReferer();
|
47 |
-
}
|
48 |
-
|
49 |
-
public function testCredentialsAction()
|
50 |
-
{
|
51 |
-
/**
|
52 |
-
* Test account API
|
53 |
-
*/
|
54 |
-
$testResult = Mage::getModel('connector/account_test')->test();
|
55 |
-
|
56 |
-
if($testResult['errors']){
|
57 |
-
Mage::getSingleton('adminhtml/session')->addError($testResult['message']);
|
58 |
-
}else{
|
59 |
-
Mage::getSingleton('adminhtml/session')->addSuccess('API Credentials Valid.');
|
60 |
-
}
|
61 |
-
$this->_redirectReferer();
|
62 |
-
}
|
63 |
-
public function transactionalSyncAction()
|
64 |
-
{
|
65 |
-
|
66 |
-
Mage::register('force_transactional', true);
|
67 |
-
$initialSync = Mage::getModel('connector/sales_order')->sync();
|
68 |
-
|
69 |
-
if ($initialSync['errors'])
|
70 |
-
Mage::getSingleton('adminhtml/session')->addError($initialSync['message']);
|
71 |
-
else
|
72 |
-
Mage::getSingleton('adminhtml/session')->addSuccess($initialSync['message']);
|
73 |
-
|
74 |
-
$this->_redirectReferer();
|
75 |
-
}
|
76 |
-
public function deletecontactsidAction()
|
77 |
-
{
|
78 |
-
Mage::register('first_time_sync', true);
|
79 |
-
$customerModel = new Dotdigitalgroup_Email_Model_Customer_Customer();
|
80 |
-
$customers = $customerModel->getContactsCustomers();
|
81 |
-
$numUpdated = 0;
|
82 |
-
if($customers->getSize()){
|
83 |
-
foreach ($customers as $one){
|
84 |
-
try{
|
85 |
-
$customer = Mage::getModel('customer/customer')->load($one->getId());
|
86 |
-
$customer->setData('dotmailer_contact_id', null);
|
87 |
-
$customer->save();
|
88 |
-
}catch(Exception $e){
|
89 |
-
Mage::helper('connector')->log($e->getMessage(), null, 'api.log');
|
90 |
-
}
|
91 |
-
$numUpdated++;
|
92 |
-
}
|
93 |
-
}
|
94 |
-
Mage::unregister('first_time_sync');
|
95 |
-
if($numUpdated);
|
96 |
-
Mage::getModel('adminhtml/session')->addSuccess('Number Of Contacts Id Removed :'. $numUpdated);
|
97 |
-
$this->_redirectReferer();
|
98 |
-
}
|
99 |
-
|
100 |
-
public function countcontactsAction()
|
101 |
-
{
|
102 |
-
$customer = new Dotdigitalgroup_Email_Model_Customer_Customer();
|
103 |
-
$contacts = $customer->getContactsCustomers();
|
104 |
-
$total = $customer->getTotalNumberCustomers();
|
105 |
-
$numMissing = $contacts->getSize();
|
106 |
-
|
107 |
-
Mage::getModel('adminhtml/session')->addSuccess('Customers No: ' . $total . ', With Contact Id No: ' . $numMissing);
|
108 |
-
$this->_redirectReferer();
|
109 |
-
}
|
110 |
-
|
111 |
-
public function ajaxvalidationAction()
|
112 |
-
{
|
113 |
-
$result = 'Validation failed!';
|
114 |
-
$api_user = $this->getRequest()->getParam('api_user');
|
115 |
-
$api_password = $this->getRequest()->getParam('api_password');
|
116 |
-
$testResult = Mage::getModel('connector/account_test')->test($api_user, $api_password);
|
117 |
-
if($testResult['errors'] == false){
|
118 |
-
$result = 'Valid';
|
119 |
-
}
|
120 |
-
|
121 |
-
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
|
122 |
-
}
|
123 |
-
|
124 |
-
|
125 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,133 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Dotdigitalgroup_Email_EmailController extends Mage_Core_Controller_Front_Action
|
4 |
-
{
|
5 |
-
public function indexAction()
|
6 |
-
{
|
7 |
-
//Get current layout state
|
8 |
-
$this->loadLayout();
|
9 |
-
|
10 |
-
$this->renderLayout();
|
11 |
-
}
|
12 |
-
|
13 |
-
|
14 |
-
/**
|
15 |
-
* Params
|
16 |
-
* code - security check
|
17 |
-
* order - order id
|
18 |
-
* products type :
|
19 |
-
* 1.related
|
20 |
-
* 2.upsell
|
21 |
-
* 3.cross sell
|
22 |
-
* 4.best sellers
|
23 |
-
* 5.most viewed
|
24 |
-
* 6.recently viewed
|
25 |
-
*
|
26 |
-
*/
|
27 |
-
public function productsAction()
|
28 |
-
{
|
29 |
-
//get all params
|
30 |
-
$params = $this->getRequest()->getParams();
|
31 |
-
|
32 |
-
if(!isset($params['code']) || !isset($params['mode'])){
|
33 |
-
|
34 |
-
exit();
|
35 |
-
}
|
36 |
-
//authenticate before proceed
|
37 |
-
Mage::helper('connector')->auth($params['code']);
|
38 |
-
Mage::register('mode', $params['mode']);
|
39 |
-
if(isset($params['customer']))
|
40 |
-
Mage::register('customer', $params['customer']);
|
41 |
-
$this->loadLayout();
|
42 |
-
$this->renderLayout();
|
43 |
-
|
44 |
-
}
|
45 |
-
|
46 |
-
public function couponAction()
|
47 |
-
{
|
48 |
-
$this->loadLayout();
|
49 |
-
$this->renderLayout();
|
50 |
-
}
|
51 |
-
public function basketAction()
|
52 |
-
{
|
53 |
-
$this->loadLayout();
|
54 |
-
$this->renderLayout();
|
55 |
-
}
|
56 |
-
|
57 |
-
public function logAction()
|
58 |
-
{
|
59 |
-
//@todo allow from these Ips
|
60 |
-
$allowedIps = array(
|
61 |
-
|
62 |
-
);
|
63 |
-
|
64 |
-
//file name param
|
65 |
-
$file = $this->getRequest()->getParam('file');
|
66 |
-
$fileName = $file . '.log';
|
67 |
-
$filePath = Mage::getBaseDir('log') . DIRECTORY_SEPARATOR . $fileName;
|
68 |
-
|
69 |
-
$this->_prepareDownloadResponse($fileName, array(
|
70 |
-
'type' => 'filename',
|
71 |
-
'value' => $filePath
|
72 |
-
));
|
73 |
-
exit();
|
74 |
-
|
75 |
-
}
|
76 |
-
|
77 |
-
public function resetimportedorderdataAction()
|
78 |
-
{
|
79 |
-
$orderCollection = Mage::getResourceModel('sales/order_collection');
|
80 |
-
foreach ($orderCollection as $one) {
|
81 |
-
|
82 |
-
try{
|
83 |
-
|
84 |
-
$one->setData('dotmailer_order_imported', null);
|
85 |
-
$one->save();
|
86 |
-
}catch(Exception $e){
|
87 |
-
Mage::logException($e);
|
88 |
-
}
|
89 |
-
}
|
90 |
-
|
91 |
-
}
|
92 |
-
|
93 |
-
public function saveMissingIdCustomerAction()
|
94 |
-
{
|
95 |
-
$customer = Mage::getModel('connector/customer_customer')->getMissingContacts();
|
96 |
-
$helper = Mage::helper('connector');
|
97 |
-
$helper->log('number of miss ids : ' . count($customer));
|
98 |
-
foreach ($customer as $one) {
|
99 |
-
try{
|
100 |
-
$helper->log($one->getEmail());
|
101 |
-
$one->save();
|
102 |
-
}catch(Exception $e){
|
103 |
-
$helper->log($e->getMessage());
|
104 |
-
|
105 |
-
}
|
106 |
-
|
107 |
-
}
|
108 |
-
|
109 |
-
}
|
110 |
-
|
111 |
-
public function importAllTransactionalDataAction()
|
112 |
-
{
|
113 |
-
$orderCollection = Mage::getModel('sales/order')->getCollection();
|
114 |
-
$helper = Mage::helper('connector');
|
115 |
-
$helper->log('import all transactional data : ' . $orderCollection->getSize());
|
116 |
-
foreach($orderCollection as $one){
|
117 |
-
|
118 |
-
$order = Mage::getModel('connector/connector_order', $one);
|
119 |
-
if($order->connector_id)
|
120 |
-
$orders[] = $order;
|
121 |
-
}
|
122 |
-
$helper->log('orders created : ' . count($orders));
|
123 |
-
$rest = Mage::getModel('connector/api_rest');
|
124 |
-
|
125 |
-
try{
|
126 |
-
$result = $rest->sendMultiTransactionalData($orders, 'Order');
|
127 |
-
$helper->log($result);
|
128 |
-
}catch(Exception $e){
|
129 |
-
$helper->log($e->getMessage());
|
130 |
-
}
|
131 |
-
|
132 |
-
}
|
133 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,43 +0,0 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<config>
|
3 |
-
<acl>
|
4 |
-
<resources>
|
5 |
-
<admin>
|
6 |
-
<children>
|
7 |
-
<system>
|
8 |
-
<children>
|
9 |
-
<config>
|
10 |
-
<children>
|
11 |
-
<connector_api_settings translate="title">
|
12 |
-
<title><![CDATA[API Credentials]]></title>
|
13 |
-
</connector_api_settings>
|
14 |
-
<connector_sync_settings translate="title">
|
15 |
-
<title><![CDATA[Sync Settings]]></title>
|
16 |
-
</connector_sync_settings>
|
17 |
-
<connector_data_field_settings translate="title">
|
18 |
-
<title><![CDATA[Data Field Mapping]]></title>
|
19 |
-
</connector_data_field_settings>
|
20 |
-
<connector_roi_page_tracking_settings translate="title">
|
21 |
-
<title><![CDATA[ROI & Tracking]]></title>
|
22 |
-
</connector_roi_page_tracking_settings>
|
23 |
-
<lost_basket_settings translate="title">
|
24 |
-
<title><![CDATA[Lost Baskets]]></title>
|
25 |
-
</lost_basket_settings>
|
26 |
-
<sms_section translate="title">
|
27 |
-
<title><![CDATA[SMS Section]]></title>
|
28 |
-
</sms_section>
|
29 |
-
<dynamic_content translate="label">
|
30 |
-
<title><![CDATA[Dynamic Content]]></title>
|
31 |
-
</dynamic_content>
|
32 |
-
<connector_advanced_settings translate="title">
|
33 |
-
<title><![CDATA[Advanced Settings]]></title>
|
34 |
-
</connector_advanced_settings>
|
35 |
-
</children>
|
36 |
-
</config>
|
37 |
-
</children>
|
38 |
-
</system>
|
39 |
-
</children>
|
40 |
-
</admin>
|
41 |
-
</resources>
|
42 |
-
</acl>
|
43 |
-
</config>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,289 +0,0 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<config>
|
3 |
-
|
4 |
-
<modules>
|
5 |
-
<Dotdigitalgroup_Email>
|
6 |
-
<version>1.5.1</version>
|
7 |
-
</Dotdigitalgroup_Email>
|
8 |
-
</modules>
|
9 |
-
<frontend>
|
10 |
-
<routers>
|
11 |
-
<connector>
|
12 |
-
<use>standard</use>
|
13 |
-
<args>
|
14 |
-
<module>Dotdigitalgroup_Email</module>
|
15 |
-
<frontName>connector</frontName>
|
16 |
-
</args>
|
17 |
-
</connector>
|
18 |
-
</routers>
|
19 |
-
<layout>
|
20 |
-
<updates>
|
21 |
-
<connector>
|
22 |
-
<file>connector.xml</file>
|
23 |
-
</connector>
|
24 |
-
</updates>
|
25 |
-
</layout>
|
26 |
-
</frontend>
|
27 |
-
<global>
|
28 |
-
<models>
|
29 |
-
<connector>
|
30 |
-
<class>Dotdigitalgroup_Email_Model</class>
|
31 |
-
</connector>
|
32 |
-
<sales>
|
33 |
-
<rewrite>
|
34 |
-
<order>Dotdigitalgroup_Email_Model_Order</order>
|
35 |
-
</rewrite>
|
36 |
-
</sales>
|
37 |
-
</models>
|
38 |
-
<helpers>
|
39 |
-
<connector>
|
40 |
-
<class>Dotdigitalgroup_Email_Helper</class>
|
41 |
-
</connector>
|
42 |
-
</helpers>
|
43 |
-
<blocks>
|
44 |
-
<connector>
|
45 |
-
<class>Dotdigitalgroup_Email_Block</class>
|
46 |
-
</connector>
|
47 |
-
</blocks>
|
48 |
-
|
49 |
-
<resources>
|
50 |
-
<connector_setup>
|
51 |
-
<setup>
|
52 |
-
<module>Dotdigitalgroup_Email</module>
|
53 |
-
<class>Mage_Sales_Model_Mysql4_Setup</class>
|
54 |
-
</setup>
|
55 |
-
<connection>
|
56 |
-
<use>core_setup</use>
|
57 |
-
</connection>
|
58 |
-
</connector_setup>
|
59 |
-
<customer_write>
|
60 |
-
<connection>
|
61 |
-
<use>core_write</use>
|
62 |
-
</connection>
|
63 |
-
</customer_write>
|
64 |
-
<customer_read>
|
65 |
-
<connection>
|
66 |
-
<use>core_read</use>
|
67 |
-
</connection>
|
68 |
-
</customer_read>
|
69 |
-
</resources>
|
70 |
-
<events>
|
71 |
-
<customer_save_before>
|
72 |
-
<observers>
|
73 |
-
<contactid>
|
74 |
-
<class>Dotdigitalgroup_Email_Model_Observer</class>
|
75 |
-
<method>handleCustomerSaveBefore</method>
|
76 |
-
</contactid>
|
77 |
-
</observers>
|
78 |
-
</customer_save_before>
|
79 |
-
<sales_order_save_after>
|
80 |
-
<observers>
|
81 |
-
<connector_checkout_type_onepage_save_order_after>
|
82 |
-
<class>Dotdigitalgroup_Email_Model_Observer</class>
|
83 |
-
<method>handleSalesOrderSaveAfter</method>
|
84 |
-
</connector_checkout_type_onepage_save_order_after>
|
85 |
-
</observers>
|
86 |
-
</sales_order_save_after>
|
87 |
-
<sales_quote_save_after>
|
88 |
-
<observers>
|
89 |
-
<connector_quote_save_after>
|
90 |
-
<type>singleton</type>
|
91 |
-
<class>Dotdigitalgroup_Email_Model_Observer</class>
|
92 |
-
<method>handleSalesQuoteSaveAfter</method>
|
93 |
-
</connector_quote_save_after>
|
94 |
-
</observers>
|
95 |
-
</sales_quote_save_after>
|
96 |
-
<sales_order_creditmemo_save_after>
|
97 |
-
<observers>
|
98 |
-
<connector_sales_order_payment_refund>
|
99 |
-
<class>Dotdigitalgroup_Email_Model_Observer</class>
|
100 |
-
<method>handleSalesOrderRefund</method>
|
101 |
-
</connector_sales_order_payment_refund>
|
102 |
-
</observers>
|
103 |
-
</sales_order_creditmemo_save_after>
|
104 |
-
<order_cancel_after>
|
105 |
-
<observers>
|
106 |
-
<connector_sales_order_cancel>
|
107 |
-
<class>Dotdigitalgroup_Email_Model_Observer</class>
|
108 |
-
<method>hangleSalesOrderCancel</method>
|
109 |
-
</connector_sales_order_cancel>
|
110 |
-
</observers>
|
111 |
-
</order_cancel_after>
|
112 |
-
|
113 |
-
<sales_order_status_after>
|
114 |
-
<observers>
|
115 |
-
<connector_sales_order_status_change>
|
116 |
-
<class>Dotdigitalgroup_Email_Model_Observer</class>
|
117 |
-
<method>handleSalesOrderStatusChange</method>
|
118 |
-
</connector_sales_order_status_change>
|
119 |
-
</observers>
|
120 |
-
</sales_order_status_after>
|
121 |
-
</events>
|
122 |
-
</global>
|
123 |
-
|
124 |
-
<adminhtml>
|
125 |
-
<layout>
|
126 |
-
<updates>
|
127 |
-
<connector>
|
128 |
-
<file>connector.xml</file>
|
129 |
-
</connector>
|
130 |
-
</updates>
|
131 |
-
</layout>
|
132 |
-
</adminhtml>
|
133 |
-
|
134 |
-
|
135 |
-
<admin>
|
136 |
-
<routers>
|
137 |
-
<connector>
|
138 |
-
<use>admin</use>
|
139 |
-
<args>
|
140 |
-
<modules>
|
141 |
-
<connector before="Mage_Adminhtml">Dotdigitalgroup_Email_Adminhtml</connector>
|
142 |
-
</modules>
|
143 |
-
<module>Dotdigitalgroup_Email_Adminhtml</module>
|
144 |
-
<frontName>connector</frontName>
|
145 |
-
</args>
|
146 |
-
</connector>
|
147 |
-
</routers>
|
148 |
-
</admin>
|
149 |
-
|
150 |
-
<crontab>
|
151 |
-
<jobs>
|
152 |
-
<dotdigitalgroup_email_customer_sync>
|
153 |
-
<run><model>connector/cron::customersync</model></run>
|
154 |
-
<schedule>
|
155 |
-
<config_path>connector_sync_settings/sync_customer_schedule/cronschedule</config_path>
|
156 |
-
</schedule>
|
157 |
-
</dotdigitalgroup_email_customer_sync>
|
158 |
-
<dotdigitalgroup_email_lostbaskets_sync>
|
159 |
-
<run><model>connector/cron::lostbasketssync</model></run>
|
160 |
-
<schedule>
|
161 |
-
<cron_expr>*/5 * * * *</cron_expr>
|
162 |
-
</schedule>
|
163 |
-
</dotdigitalgroup_email_lostbaskets_sync>
|
164 |
-
<dotdigitalgroup_email_suppressed_sync>
|
165 |
-
<run><model>connector/cron::suppressedsync</model></run>
|
166 |
-
<schedule>
|
167 |
-
<config_path>connector_sync_settings/sync_suppressed_schedule/cronschedulesupp</config_path>
|
168 |
-
</schedule>
|
169 |
-
</dotdigitalgroup_email_suppressed_sync>
|
170 |
-
<dotdigitalgroup_email_cleaner>
|
171 |
-
<run><model>connector/cron::cleaning</model></run>
|
172 |
-
<schedule>
|
173 |
-
<cron_expr>0 0 1 * * </cron_expr>
|
174 |
-
</schedule>
|
175 |
-
</dotdigitalgroup_email_cleaner>
|
176 |
-
</jobs>
|
177 |
-
</crontab>
|
178 |
-
<default>
|
179 |
-
<connector_api_settings>
|
180 |
-
<api_credentials>
|
181 |
-
<username></username>
|
182 |
-
<password></password>
|
183 |
-
</api_credentials>
|
184 |
-
</connector_api_settings>
|
185 |
-
<connector_sync_settings>
|
186 |
-
<sync_customer_schedule>
|
187 |
-
<enabled>0</enabled>
|
188 |
-
<cronschedule></cronschedule>
|
189 |
-
</sync_customer_schedule>
|
190 |
-
<sync_suppressed_schedule>
|
191 |
-
<enabled>0</enabled>
|
192 |
-
<cronschedulesupp></cronschedulesupp>
|
193 |
-
</sync_suppressed_schedule>
|
194 |
-
<transactional_data>
|
195 |
-
<enabled>0</enabled>
|
196 |
-
</transactional_data>
|
197 |
-
</connector_sync_settings>
|
198 |
-
<connector_data_field_settings>
|
199 |
-
<customer_data>
|
200 |
-
<firstname></firstname>
|
201 |
-
<lastname></lastname>
|
202 |
-
<dob></dob>
|
203 |
-
<gender></gender>
|
204 |
-
<website_created_on></website_created_on>
|
205 |
-
<store_created_on></store_created_on>
|
206 |
-
<account_created></account_created>
|
207 |
-
<last_logged_in></last_logged_in>
|
208 |
-
<customer_group></customer_group>
|
209 |
-
</customer_data>
|
210 |
-
<customer_address>
|
211 |
-
<billing_address_1></billing_address_1>
|
212 |
-
<billing_address_2></billing_address_2>
|
213 |
-
<billing_city></billing_city>
|
214 |
-
<billing_country></billing_country>
|
215 |
-
<billing_postcode></billing_postcode>
|
216 |
-
<billing_telephone></billing_telephone>
|
217 |
-
<delivery_address_1></delivery_address_1>
|
218 |
-
<delivery_address_2></delivery_address_2>
|
219 |
-
<delivery_city></delivery_city>
|
220 |
-
<delivery_country></delivery_country>
|
221 |
-
<delivery_postcode></delivery_postcode>
|
222 |
-
<delivery_telephone></delivery_telephone>
|
223 |
-
</customer_address>
|
224 |
-
<customer_sales>
|
225 |
-
<total_orders></total_orders>
|
226 |
-
<average_order_value></average_order_value>
|
227 |
-
<total_spend></total_spend>
|
228 |
-
</customer_sales>
|
229 |
-
</connector_data_field_settings>
|
230 |
-
|
231 |
-
<connector_roi_page_tracking_settings>
|
232 |
-
<page_tracking>
|
233 |
-
<enabled></enabled>
|
234 |
-
</page_tracking>
|
235 |
-
<roi_tracking>
|
236 |
-
<enabled></enabled>
|
237 |
-
</roi_tracking>
|
238 |
-
</connector_roi_page_tracking_settings>
|
239 |
-
<connector_newsletter_subscription_settings>
|
240 |
-
<customers_subscription_management>
|
241 |
-
<default></default>
|
242 |
-
</customers_subscription_management>
|
243 |
-
<subscribers_subscription_management>
|
244 |
-
<default></default>
|
245 |
-
</subscribers_subscription_management>
|
246 |
-
</connector_newsletter_subscription_settings>
|
247 |
-
<lost_basket_settings>
|
248 |
-
<customers>
|
249 |
-
<enabled_1></enabled_1>
|
250 |
-
<send_after_1></send_after_1>
|
251 |
-
<campaign_1></campaign_1>
|
252 |
-
<enabled_2></enabled_2>
|
253 |
-
<send_after_2></send_after_2>
|
254 |
-
<campaign_2></campaign_2>
|
255 |
-
<enabled_3></enabled_3>
|
256 |
-
<send_after_3></send_after_3>
|
257 |
-
<campaign_3></campaign_3>
|
258 |
-
</customers>
|
259 |
-
<guests>
|
260 |
-
<enabled_1></enabled_1>
|
261 |
-
<send_after_1></send_after_1>
|
262 |
-
<campaign_1></campaign_1>
|
263 |
-
<enabled_2></enabled_2>
|
264 |
-
<send_after_2></send_after_2>
|
265 |
-
<campaign_2></campaign_2>
|
266 |
-
<enabled_3></enabled_3>
|
267 |
-
<send_after_3></send_after_3>
|
268 |
-
<campaign_3></campaign_3>
|
269 |
-
</guests>
|
270 |
-
</lost_basket_settings>
|
271 |
-
<connector_advanced_settings>
|
272 |
-
<sync_limits>
|
273 |
-
<contact>500</contact>
|
274 |
-
<orders>500</orders>
|
275 |
-
</sync_limits>
|
276 |
-
<admin>
|
277 |
-
<memory_limit></memory_limit>
|
278 |
-
<batch_size>5000</batch_size>
|
279 |
-
</admin>
|
280 |
-
</connector_advanced_settings>
|
281 |
-
</default>
|
282 |
-
<phpunit>
|
283 |
-
<suite>
|
284 |
-
<modules>
|
285 |
-
<Dotdigitalgroup_Email />
|
286 |
-
</modules>
|
287 |
-
</suite>
|
288 |
-
</phpunit>
|
289 |
-
</config>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,818 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Magento
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
-
* that is bundled with this package in the file LICENSE.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/osl-3.0.php
|
11 |
-
* If you did not receive a copy of the license and are unable to
|
12 |
-
* obtain it through the world-wide-web, please send an email
|
13 |
-
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
-
*
|
15 |
-
* DISCLAIMER
|
16 |
-
*
|
17 |
-
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
-
* versions in the future. If you wish to customize Magento for your
|
19 |
-
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
-
*
|
21 |
-
* @category Varien
|
22 |
-
* @package Varien_Data
|
23 |
-
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
24 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
-
*/
|
26 |
-
|
27 |
-
/**
|
28 |
-
* Data collection
|
29 |
-
*
|
30 |
-
* @category Varien
|
31 |
-
* @package Varien_Data
|
32 |
-
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
-
*/
|
34 |
-
class Varien_Data_Collection implements IteratorAggregate, Countable
|
35 |
-
{
|
36 |
-
const SORT_ORDER_ASC = 'ASC';
|
37 |
-
const SORT_ORDER_DESC = 'DESC';
|
38 |
-
|
39 |
-
/**
|
40 |
-
* Collection items
|
41 |
-
*
|
42 |
-
* @var array
|
43 |
-
*/
|
44 |
-
protected $_items = array();
|
45 |
-
|
46 |
-
/**
|
47 |
-
* Item object class name
|
48 |
-
*
|
49 |
-
* @var string
|
50 |
-
*/
|
51 |
-
protected $_itemObjectClass = 'Varien_Object';
|
52 |
-
|
53 |
-
/**
|
54 |
-
* Order configuration
|
55 |
-
*
|
56 |
-
* @var array
|
57 |
-
*/
|
58 |
-
protected $_orders = array();
|
59 |
-
|
60 |
-
/**
|
61 |
-
* Filters configuration
|
62 |
-
*
|
63 |
-
* @var array
|
64 |
-
*/
|
65 |
-
protected $_filters = array();
|
66 |
-
|
67 |
-
/**
|
68 |
-
* Filter rendered flag
|
69 |
-
*
|
70 |
-
* @var bool
|
71 |
-
*/
|
72 |
-
protected $_isFiltersRendered = false;
|
73 |
-
|
74 |
-
/**
|
75 |
-
* Current page number for items pager
|
76 |
-
*
|
77 |
-
* @var int
|
78 |
-
*/
|
79 |
-
protected $_curPage = 1;
|
80 |
-
|
81 |
-
/**
|
82 |
-
* Pager page size
|
83 |
-
*
|
84 |
-
* if page size is false, then we works with all items
|
85 |
-
*
|
86 |
-
* @var int | false
|
87 |
-
*/
|
88 |
-
protected $_pageSize = false;
|
89 |
-
|
90 |
-
/**
|
91 |
-
* Total items number
|
92 |
-
*
|
93 |
-
* @var int
|
94 |
-
*/
|
95 |
-
protected $_totalRecords;
|
96 |
-
|
97 |
-
/**
|
98 |
-
* Loading state flag
|
99 |
-
*
|
100 |
-
* @var bool
|
101 |
-
*/
|
102 |
-
protected $_isCollectionLoaded;
|
103 |
-
|
104 |
-
protected $_cacheKey;
|
105 |
-
|
106 |
-
protected $_cacheTags = array();
|
107 |
-
|
108 |
-
protected $_cacheLifetime = 86400;
|
109 |
-
|
110 |
-
/**
|
111 |
-
* Additional collection flags
|
112 |
-
*
|
113 |
-
* @var array
|
114 |
-
*/
|
115 |
-
protected $_flags = array();
|
116 |
-
|
117 |
-
public function __construct()
|
118 |
-
{
|
119 |
-
|
120 |
-
}
|
121 |
-
|
122 |
-
/**
|
123 |
-
* Add collection filter
|
124 |
-
*
|
125 |
-
* @param string $field
|
126 |
-
* @param string $value
|
127 |
-
* @param string $type and|or|string
|
128 |
-
*/
|
129 |
-
public function addFilter($field, $value, $type = 'and')
|
130 |
-
{
|
131 |
-
$filter = new Varien_Object(); // implements ArrayAccess
|
132 |
-
$filter['field'] = $field;
|
133 |
-
$filter['value'] = $value;
|
134 |
-
$filter['type'] = strtolower($type);
|
135 |
-
|
136 |
-
$this->_filters[] = $filter;
|
137 |
-
$this->_isFiltersRendered = false;
|
138 |
-
return $this;
|
139 |
-
}
|
140 |
-
|
141 |
-
/**
|
142 |
-
* Search for a filter by specified field
|
143 |
-
*
|
144 |
-
* Multiple filters can be matched if an array is specified:
|
145 |
-
* - 'foo' -- get the first filter with field name 'foo'
|
146 |
-
* - array('foo') -- get all filters with field name 'foo'
|
147 |
-
* - array('foo', 'bar') -- get all filters with field name 'foo' or 'bar'
|
148 |
-
* - array() -- get all filters
|
149 |
-
*
|
150 |
-
* @param string|array $field
|
151 |
-
* @return Varien_Object|array|null
|
152 |
-
*/
|
153 |
-
public function getFilter($field)
|
154 |
-
{
|
155 |
-
if (is_array($field)) {
|
156 |
-
// empty array: get all filters
|
157 |
-
if (empty($field)) {
|
158 |
-
return $this->_filters;
|
159 |
-
}
|
160 |
-
// non-empty array: collect all filters that match specified field names
|
161 |
-
$result = array();
|
162 |
-
foreach ($this->_filters as $filter) {
|
163 |
-
if (in_array($filter['field'], $field)) {
|
164 |
-
$result[] = $filter;
|
165 |
-
}
|
166 |
-
}
|
167 |
-
return $result;
|
168 |
-
}
|
169 |
-
|
170 |
-
// get a first filter by specified name
|
171 |
-
foreach ($this->_filters as $filter) {
|
172 |
-
if ($filter['field'] === $field) {
|
173 |
-
return $filter;
|
174 |
-
}
|
175 |
-
}
|
176 |
-
}
|
177 |
-
|
178 |
-
/**
|
179 |
-
* Retrieve collection loading status
|
180 |
-
*
|
181 |
-
* @return bool
|
182 |
-
*/
|
183 |
-
public function isLoaded()
|
184 |
-
{
|
185 |
-
return $this->_isCollectionLoaded;
|
186 |
-
}
|
187 |
-
|
188 |
-
/**
|
189 |
-
* Set collection loading status flag
|
190 |
-
*
|
191 |
-
* @param unknown_type $flag
|
192 |
-
* @return unknown
|
193 |
-
*/
|
194 |
-
protected function _setIsLoaded($flag = true)
|
195 |
-
{
|
196 |
-
$this->_isCollectionLoaded = $flag;
|
197 |
-
return $this;
|
198 |
-
}
|
199 |
-
|
200 |
-
/**
|
201 |
-
* Get current collection page
|
202 |
-
*
|
203 |
-
* @param int $displacement
|
204 |
-
* @return int
|
205 |
-
*/
|
206 |
-
public function getCurPage($displacement = 0)
|
207 |
-
{
|
208 |
-
if ($this->_curPage + $displacement < 1) {
|
209 |
-
return 1;
|
210 |
-
}
|
211 |
-
elseif ($this->_curPage + $displacement > $this->getLastPageNumber()) {
|
212 |
-
return $this->getLastPageNumber();
|
213 |
-
} else {
|
214 |
-
return $this->_curPage + $displacement;
|
215 |
-
}
|
216 |
-
}
|
217 |
-
|
218 |
-
/**
|
219 |
-
* Retrieve collection last page number
|
220 |
-
*
|
221 |
-
* @return int
|
222 |
-
*/
|
223 |
-
public function getLastPageNumber()
|
224 |
-
{
|
225 |
-
$collectionSize = (int) $this->getSize();
|
226 |
-
if (0 === $collectionSize) {
|
227 |
-
return 1;
|
228 |
-
}
|
229 |
-
elseif($this->_pageSize) {
|
230 |
-
return ceil($collectionSize/$this->_pageSize);
|
231 |
-
}
|
232 |
-
else{
|
233 |
-
return 1;
|
234 |
-
}
|
235 |
-
}
|
236 |
-
|
237 |
-
/**
|
238 |
-
* Retrieve collection page size
|
239 |
-
*
|
240 |
-
* @return int
|
241 |
-
*/
|
242 |
-
public function getPageSize()
|
243 |
-
{
|
244 |
-
return $this->_pageSize;
|
245 |
-
}
|
246 |
-
|
247 |
-
/**
|
248 |
-
* Retrieve collection all items count
|
249 |
-
*
|
250 |
-
* @return int
|
251 |
-
*/
|
252 |
-
public function getSize()
|
253 |
-
{
|
254 |
-
$this->load();
|
255 |
-
if (is_null($this->_totalRecords)) {
|
256 |
-
$this->_totalRecords = count($this->getItems());
|
257 |
-
}
|
258 |
-
return intval($this->_totalRecords);
|
259 |
-
}
|
260 |
-
|
261 |
-
/**
|
262 |
-
* Retrieve collection first item
|
263 |
-
*
|
264 |
-
* @return Varien_Object
|
265 |
-
*/
|
266 |
-
public function getFirstItem()
|
267 |
-
{
|
268 |
-
$this->load();
|
269 |
-
|
270 |
-
if (count($this->_items)) {
|
271 |
-
reset($this->_items);
|
272 |
-
return current($this->_items);
|
273 |
-
}
|
274 |
-
|
275 |
-
return new $this->_itemObjectClass();
|
276 |
-
}
|
277 |
-
|
278 |
-
/**
|
279 |
-
* Retrieve collection last item
|
280 |
-
*
|
281 |
-
* @return Varien_Object
|
282 |
-
*/
|
283 |
-
public function getLastItem()
|
284 |
-
{
|
285 |
-
$this->load();
|
286 |
-
|
287 |
-
if (count($this->_items)) {
|
288 |
-
return end($this->_items);
|
289 |
-
}
|
290 |
-
|
291 |
-
return new $this->_itemObjectClass();
|
292 |
-
}
|
293 |
-
|
294 |
-
/**
|
295 |
-
* Retrieve collection items
|
296 |
-
*
|
297 |
-
* @return array
|
298 |
-
*/
|
299 |
-
public function getItems()
|
300 |
-
{
|
301 |
-
$this->load();
|
302 |
-
return $this->_items;
|
303 |
-
}
|
304 |
-
|
305 |
-
/**
|
306 |
-
* Retrieve field values from all items
|
307 |
-
*
|
308 |
-
* @param string $colName
|
309 |
-
* @return array
|
310 |
-
*/
|
311 |
-
public function getColumnValues($colName)
|
312 |
-
{
|
313 |
-
$this->load();
|
314 |
-
|
315 |
-
$col = array();
|
316 |
-
foreach ($this->getItems() as $item) {
|
317 |
-
$col[] = $item->getData($colName);
|
318 |
-
}
|
319 |
-
return $col;
|
320 |
-
}
|
321 |
-
|
322 |
-
/**
|
323 |
-
* Search all items by field value
|
324 |
-
*
|
325 |
-
* @param string $column
|
326 |
-
* @param mixed $value
|
327 |
-
* @return array
|
328 |
-
*/
|
329 |
-
public function getItemsByColumnValue($column, $value)
|
330 |
-
{
|
331 |
-
$this->load();
|
332 |
-
|
333 |
-
$res = array();
|
334 |
-
foreach ($this as $item) {
|
335 |
-
if ($item->getData($column)==$value) {
|
336 |
-
$res[] = $item;
|
337 |
-
}
|
338 |
-
}
|
339 |
-
return $res;
|
340 |
-
}
|
341 |
-
|
342 |
-
/**
|
343 |
-
* Search first item by field value
|
344 |
-
*
|
345 |
-
* @param string $column
|
346 |
-
* @param mixed $value
|
347 |
-
* @return Varien_Object || null
|
348 |
-
*/
|
349 |
-
public function getItemByColumnValue($column, $value)
|
350 |
-
{
|
351 |
-
$this->load();
|
352 |
-
|
353 |
-
foreach ($this as $item) {
|
354 |
-
if ($item->getData($column)==$value) {
|
355 |
-
return $item;
|
356 |
-
}
|
357 |
-
}
|
358 |
-
return null;
|
359 |
-
}
|
360 |
-
|
361 |
-
/**
|
362 |
-
* Adding item to item array
|
363 |
-
*
|
364 |
-
* @param Varien_Object $item
|
365 |
-
* @return Varien_Data_Collection
|
366 |
-
*/
|
367 |
-
public function addItem(Varien_Object $item)
|
368 |
-
{
|
369 |
-
$itemId = $this->_getItemId($item);
|
370 |
-
|
371 |
-
if (!is_null($itemId)) {
|
372 |
-
if (isset($this->_items[$itemId])) {
|
373 |
-
//throw new Exception('Item ('.get_class($item).') with the same id "'.$item->getId().'" already exist');
|
374 |
-
}
|
375 |
-
$this->_items[$itemId] = $item;
|
376 |
-
} else {
|
377 |
-
$this->_addItem($item);
|
378 |
-
}
|
379 |
-
return $this;
|
380 |
-
}
|
381 |
-
|
382 |
-
/**
|
383 |
-
* Add item that has no id to collection
|
384 |
-
*
|
385 |
-
* @param Varien_Object $item
|
386 |
-
* @return Varien_Data_Collection
|
387 |
-
*/
|
388 |
-
protected function _addItem($item)
|
389 |
-
{
|
390 |
-
$this->_items[] = $item;
|
391 |
-
return $this;
|
392 |
-
}
|
393 |
-
|
394 |
-
/**
|
395 |
-
* Retrieve item id
|
396 |
-
*
|
397 |
-
* @param Varien_Object $item
|
398 |
-
* @return mixed
|
399 |
-
*/
|
400 |
-
protected function _getItemId(Varien_Object $item)
|
401 |
-
{
|
402 |
-
return $item->getId();
|
403 |
-
}
|
404 |
-
|
405 |
-
/**
|
406 |
-
* Retrieve ids of all tems
|
407 |
-
*
|
408 |
-
* @return array
|
409 |
-
*/
|
410 |
-
public function getAllIds()
|
411 |
-
{
|
412 |
-
$ids = array();
|
413 |
-
foreach ($this->getItems() as $item) {
|
414 |
-
$ids[] = $this->_getItemId($item);
|
415 |
-
}
|
416 |
-
return $ids;
|
417 |
-
}
|
418 |
-
|
419 |
-
/**
|
420 |
-
* Remove item from collection by item key
|
421 |
-
*
|
422 |
-
* @param mixed $key
|
423 |
-
* @return Varien_Data_Collection
|
424 |
-
*/
|
425 |
-
public function removeItemByKey($key)
|
426 |
-
{
|
427 |
-
if (isset($this->_items[$key])) {
|
428 |
-
unset($this->_items[$key]);
|
429 |
-
}
|
430 |
-
return $this;
|
431 |
-
}
|
432 |
-
|
433 |
-
/**
|
434 |
-
* Clear collection
|
435 |
-
*
|
436 |
-
* @return Varien_Data_Collection
|
437 |
-
*/
|
438 |
-
public function clear()
|
439 |
-
{
|
440 |
-
$this->_setIsLoaded(false);
|
441 |
-
$this->_items = array();
|
442 |
-
return $this;
|
443 |
-
}
|
444 |
-
|
445 |
-
/**
|
446 |
-
* Walk through the collection and run model method or external callback
|
447 |
-
* with optional arguments
|
448 |
-
*
|
449 |
-
* Returns array with results of callback for each item
|
450 |
-
*
|
451 |
-
* @param string $method
|
452 |
-
* @param array $args
|
453 |
-
* @return array
|
454 |
-
*/
|
455 |
-
public function walk($callback, array $args=array())
|
456 |
-
{
|
457 |
-
$results = array();
|
458 |
-
$useItemCallback = is_string($callback) && strpos($callback, '::')===false;
|
459 |
-
foreach ($this->getItems() as $id=>$item) {
|
460 |
-
if ($useItemCallback) {
|
461 |
-
$cb = array($item, $callback);
|
462 |
-
} else {
|
463 |
-
$cb = $callback;
|
464 |
-
array_unshift($args, $item);
|
465 |
-
}
|
466 |
-
$results[$id] = call_user_func_array($cb, $args);
|
467 |
-
}
|
468 |
-
return $results;
|
469 |
-
}
|
470 |
-
|
471 |
-
public function each($obj_method, $args=array())
|
472 |
-
{
|
473 |
-
foreach ($args->_items as $k => $item) {
|
474 |
-
$args->_items[$k] = call_user_func($obj_method, $item);
|
475 |
-
}
|
476 |
-
}
|
477 |
-
|
478 |
-
/**
|
479 |
-
* Setting data for all collection items
|
480 |
-
*
|
481 |
-
* @param mixed $key
|
482 |
-
* @param mixed $value
|
483 |
-
* @return Varien_Data_Collection
|
484 |
-
*/
|
485 |
-
public function setDataToAll($key, $value=null)
|
486 |
-
{
|
487 |
-
if (is_array($key)) {
|
488 |
-
foreach ($key as $k=>$v) {
|
489 |
-
$this->setDataToAll($k, $v);
|
490 |
-
}
|
491 |
-
return $this;
|
492 |
-
}
|
493 |
-
foreach ($this->getItems() as $item) {
|
494 |
-
$item->setData($key, $value);
|
495 |
-
}
|
496 |
-
return $this;
|
497 |
-
}
|
498 |
-
|
499 |
-
/**
|
500 |
-
* Set current page
|
501 |
-
*
|
502 |
-
* @param int $page
|
503 |
-
* @return Varien_Data_Collection
|
504 |
-
*/
|
505 |
-
public function setCurPage($page)
|
506 |
-
{
|
507 |
-
$this->_curPage = $page;
|
508 |
-
return $this;
|
509 |
-
}
|
510 |
-
|
511 |
-
/**
|
512 |
-
* Set collection page size
|
513 |
-
*
|
514 |
-
* @param int $size
|
515 |
-
* @return Varien_Data_Collection
|
516 |
-
*/
|
517 |
-
public function setPageSize($size)
|
518 |
-
{
|
519 |
-
$this->_pageSize = $size;
|
520 |
-
return $this;
|
521 |
-
}
|
522 |
-
|
523 |
-
/**
|
524 |
-
* Set select order
|
525 |
-
*
|
526 |
-
* @param string $field
|
527 |
-
* @param string $direction
|
528 |
-
* @return Varien_Data_Collection
|
529 |
-
*/
|
530 |
-
public function setOrder($field, $direction = self::SORT_ORDER_DESC)
|
531 |
-
{
|
532 |
-
$this->_orders[$field] = $direction;
|
533 |
-
return $this;
|
534 |
-
}
|
535 |
-
|
536 |
-
/**
|
537 |
-
* Set collection item class name
|
538 |
-
*
|
539 |
-
* @param string $className
|
540 |
-
* @return Varien_Data_Collection
|
541 |
-
*/
|
542 |
-
function setItemObjectClass($className)
|
543 |
-
{
|
544 |
-
$className = Mage::getConfig()->getModelClassName($className);
|
545 |
-
/**
|
546 |
-
* is_subclass_of($className, 'Varien_Object') - Segmentation fault in php 5.2.3
|
547 |
-
*/
|
548 |
-
/*if (!is_subclass_of($className, 'Varien_Object')) {
|
549 |
-
throw new Exception($className.' does not extends from Varien_Object');
|
550 |
-
}*/
|
551 |
-
$this->_itemObjectClass = $className;
|
552 |
-
return $this;
|
553 |
-
}
|
554 |
-
|
555 |
-
/**
|
556 |
-
* Retrieve collection empty item
|
557 |
-
*
|
558 |
-
* @return Varien_Object
|
559 |
-
*/
|
560 |
-
public function getNewEmptyItem()
|
561 |
-
{
|
562 |
-
return new $this->_itemObjectClass();
|
563 |
-
}
|
564 |
-
|
565 |
-
/**
|
566 |
-
* Render sql select conditions
|
567 |
-
*
|
568 |
-
* @return Varien_Data_Collection
|
569 |
-
*/
|
570 |
-
protected function _renderFilters()
|
571 |
-
{
|
572 |
-
return $this;
|
573 |
-
}
|
574 |
-
|
575 |
-
/**
|
576 |
-
* Render sql select orders
|
577 |
-
*
|
578 |
-
* @return Varien_Data_Collection
|
579 |
-
*/
|
580 |
-
protected function _renderOrders()
|
581 |
-
{
|
582 |
-
return $this;
|
583 |
-
}
|
584 |
-
|
585 |
-
/**
|
586 |
-
* Render sql select limit
|
587 |
-
*
|
588 |
-
* @return Varien_Data_Collection
|
589 |
-
*/
|
590 |
-
protected function _renderLimit()
|
591 |
-
{
|
592 |
-
return $this;
|
593 |
-
}
|
594 |
-
|
595 |
-
/**
|
596 |
-
* Set select distinct
|
597 |
-
*
|
598 |
-
* @param bool $flag
|
599 |
-
*/
|
600 |
-
public function distinct($flag)
|
601 |
-
{
|
602 |
-
return $this;
|
603 |
-
}
|
604 |
-
|
605 |
-
/**
|
606 |
-
* Load data
|
607 |
-
*
|
608 |
-
* @return Varien_Data_Collection
|
609 |
-
*/
|
610 |
-
public function loadData($printQuery = false, $logQuery = false)
|
611 |
-
{
|
612 |
-
return $this;
|
613 |
-
}
|
614 |
-
|
615 |
-
/**
|
616 |
-
* Load data
|
617 |
-
*
|
618 |
-
* @return Varien_Data_Collection
|
619 |
-
*/
|
620 |
-
public function load($printQuery = false, $logQuery = false)
|
621 |
-
{
|
622 |
-
return $this->loadData($printQuery, $logQuery);
|
623 |
-
}
|
624 |
-
|
625 |
-
/**
|
626 |
-
* Convert collection to XML
|
627 |
-
*
|
628 |
-
* @return string
|
629 |
-
*/
|
630 |
-
public function toXml()
|
631 |
-
{
|
632 |
-
$xml = '<?xml version="1.0" encoding="UTF-8"?>
|
633 |
-
<collection>
|
634 |
-
<totalRecords>'.$this->_totalRecords.'</totalRecords>
|
635 |
-
<items>';
|
636 |
-
|
637 |
-
foreach ($this as $item) {
|
638 |
-
$xml.=$item->toXml();
|
639 |
-
}
|
640 |
-
$xml.= '</items>
|
641 |
-
</collection>';
|
642 |
-
return $xml;
|
643 |
-
}
|
644 |
-
|
645 |
-
/**
|
646 |
-
* Convert collection to array
|
647 |
-
*
|
648 |
-
* @return array
|
649 |
-
*/
|
650 |
-
public function toArray($arrRequiredFields = array())
|
651 |
-
{
|
652 |
-
$arrItems = array();
|
653 |
-
$arrItems['totalRecords'] = $this->getSize();
|
654 |
-
|
655 |
-
$arrItems['items'] = array();
|
656 |
-
foreach ($this as $item) {
|
657 |
-
$arrItems['items'][] = $item->toArray($arrRequiredFields);
|
658 |
-
}
|
659 |
-
return $arrItems;
|
660 |
-
}
|
661 |
-
|
662 |
-
/**
|
663 |
-
* Convert items array to array for select options
|
664 |
-
*
|
665 |
-
* return items array
|
666 |
-
* array(
|
667 |
-
* $index => array(
|
668 |
-
* 'value' => mixed
|
669 |
-
* 'label' => mixed
|
670 |
-
* )
|
671 |
-
* )
|
672 |
-
*
|
673 |
-
* @param string $valueField
|
674 |
-
* @param string $labelField
|
675 |
-
* @return array
|
676 |
-
*/
|
677 |
-
protected function _toOptionArray($valueField='id', $labelField='name', $additional=array())
|
678 |
-
{
|
679 |
-
$res = array();
|
680 |
-
$additional['value'] = $valueField;
|
681 |
-
$additional['label'] = $labelField;
|
682 |
-
|
683 |
-
foreach ($this as $item) {
|
684 |
-
foreach ($additional as $code => $field) {
|
685 |
-
$data[$code] = $item->getData($field);
|
686 |
-
}
|
687 |
-
$res[] = $data;
|
688 |
-
}
|
689 |
-
return $res;
|
690 |
-
}
|
691 |
-
|
692 |
-
public function toOptionArray()
|
693 |
-
{
|
694 |
-
return $this->_toOptionArray();
|
695 |
-
}
|
696 |
-
|
697 |
-
public function toOptionHash()
|
698 |
-
{
|
699 |
-
return $this->_toOptionHash();
|
700 |
-
}
|
701 |
-
|
702 |
-
/**
|
703 |
-
* Convert items array to hash for select options
|
704 |
-
*
|
705 |
-
* return items hash
|
706 |
-
* array($value => $label)
|
707 |
-
*
|
708 |
-
* @param string $valueField
|
709 |
-
* @param string $labelField
|
710 |
-
* @return array
|
711 |
-
*/
|
712 |
-
protected function _toOptionHash($valueField='id', $labelField='name')
|
713 |
-
{
|
714 |
-
$res = array();
|
715 |
-
foreach ($this as $item) {
|
716 |
-
$res[$item->getData($valueField)] = $item->getData($labelField);
|
717 |
-
}
|
718 |
-
return $res;
|
719 |
-
}
|
720 |
-
|
721 |
-
/**
|
722 |
-
* Retrieve item by id
|
723 |
-
*
|
724 |
-
* @param mixed $idValue
|
725 |
-
* @return Varien_Object
|
726 |
-
*/
|
727 |
-
public function getItemById($idValue)
|
728 |
-
{
|
729 |
-
$this->load();
|
730 |
-
if (isset($this->_items[$idValue])) {
|
731 |
-
return $this->_items[$idValue];
|
732 |
-
}
|
733 |
-
return null;
|
734 |
-
}
|
735 |
-
|
736 |
-
/**
|
737 |
-
* Implementation of IteratorAggregate::getIterator()
|
738 |
-
*/
|
739 |
-
public function getIterator()
|
740 |
-
{
|
741 |
-
$this->load();
|
742 |
-
return new ArrayIterator($this->_items);
|
743 |
-
}
|
744 |
-
|
745 |
-
/**
|
746 |
-
* Retireve count of collection loaded items
|
747 |
-
*
|
748 |
-
* @return int
|
749 |
-
*/
|
750 |
-
public function count()
|
751 |
-
{
|
752 |
-
$this->load();
|
753 |
-
|
754 |
-
return count($this->_items);
|
755 |
-
}
|
756 |
-
|
757 |
-
public function setCacheKey($key)
|
758 |
-
{
|
759 |
-
$this->_cacheKey = $key;
|
760 |
-
return $this;
|
761 |
-
}
|
762 |
-
|
763 |
-
public function getCacheKey()
|
764 |
-
{
|
765 |
-
return $this->_cacheKey;
|
766 |
-
}
|
767 |
-
|
768 |
-
public function setCacheTags($tags)
|
769 |
-
{
|
770 |
-
$this->_cacheTags = $tags;
|
771 |
-
return $this;
|
772 |
-
}
|
773 |
-
|
774 |
-
public function getCacheTags()
|
775 |
-
{
|
776 |
-
return $this->_cacheTags;
|
777 |
-
}
|
778 |
-
|
779 |
-
public function getCacheLifetime()
|
780 |
-
{
|
781 |
-
return $this->_cacheLifetime;
|
782 |
-
}
|
783 |
-
|
784 |
-
/**
|
785 |
-
* Retrieve Flag
|
786 |
-
*
|
787 |
-
* @param string $flag
|
788 |
-
* @return mixed
|
789 |
-
*/
|
790 |
-
public function getFlag($flag)
|
791 |
-
{
|
792 |
-
return isset($this->_flags[$flag]) ? $this->_flags[$flag] : null;
|
793 |
-
}
|
794 |
-
|
795 |
-
/**
|
796 |
-
* Set Flag
|
797 |
-
*
|
798 |
-
* @param string $flag
|
799 |
-
* @param mixed $value
|
800 |
-
* @return Varien_Data_Collection
|
801 |
-
*/
|
802 |
-
public function setFlag($flag, $value = null)
|
803 |
-
{
|
804 |
-
$this->_flags[$flag] = $value;
|
805 |
-
return $this;
|
806 |
-
}
|
807 |
-
|
808 |
-
/**
|
809 |
-
* Has Flag
|
810 |
-
*
|
811 |
-
* @param string $flag
|
812 |
-
* @return bool
|
813 |
-
*/
|
814 |
-
public function hasFlag($flag)
|
815 |
-
{
|
816 |
-
return array_key_exists($flag, $this->_flags);
|
817 |
-
}
|
818 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<adminhtml_email_dashboard_index>
|
4 |
+
<reference name="left">
|
5 |
+
<block type="adminhtml/system_config_switcher" name="store_switcher" as="store_switcher"
|
6 |
+
template="connector/dashboard/switcher.phtml">
|
7 |
+
<action method="setUseConfirm">
|
8 |
+
<params>0</params>
|
9 |
+
</action>
|
10 |
+
</block>
|
11 |
+
</reference>
|
12 |
+
<reference name="content">
|
13 |
+
<block type="email_connector/adminhtml_dashboard_content" template="connector/dashboard/content.phtml">
|
14 |
+
</block>
|
15 |
+
</reference>
|
16 |
+
</adminhtml_email_dashboard_index>
|
17 |
+
<adminhtml_email_contact_index>
|
18 |
+
<reference name="menu">
|
19 |
+
<action method="setActive">
|
20 |
+
<menupath>email_contact/email_connector_contact</menupath>
|
21 |
+
</action>
|
22 |
+
</reference>
|
23 |
+
<reference name="content">
|
24 |
+
<block type="email_connector/adminhtml_contact" name="email_contact">
|
25 |
+
<block type="adminhtml/store_switcher" name="store_switcher" as="store_switcher">
|
26 |
+
<action method="setUseConfirm"><params>0</params></action>
|
27 |
+
</block>
|
28 |
+
</block>
|
29 |
+
</reference>
|
30 |
+
</adminhtml_email_contact_index>
|
31 |
+
<adminhtml_email_contact_grid>
|
32 |
+
<block type="core/text_list" name="root" output="toHtml">
|
33 |
+
<block type="email_connector/adminhtml_contact_grid" name="contact_grid"/>
|
34 |
+
</block>
|
35 |
+
</adminhtml_email_contact_grid>
|
36 |
+
<adminhtml_email_contact_edit>
|
37 |
+
<reference name="menu">
|
38 |
+
<action method="setActive">
|
39 |
+
<menupath>email_contact</menupath>
|
40 |
+
</action>
|
41 |
+
</reference>
|
42 |
+
<reference name="content">
|
43 |
+
<block type="email_connector/adminhtml_contact_edit" name="email_contact_edit">
|
44 |
+
</block>
|
45 |
+
</reference>
|
46 |
+
</adminhtml_email_contact_edit>
|
47 |
+
<adminhtml_email_campaign_index>
|
48 |
+
<reference name="menu">
|
49 |
+
<action method="setActive">
|
50 |
+
<menupath>email_contact/email_connector_campaign</menupath>
|
51 |
+
</action>
|
52 |
+
</reference>
|
53 |
+
<reference name="content">
|
54 |
+
<block type="email_connector/adminhtml_campaign" name="email_campaign">
|
55 |
+
<block type="adminhtml/store_switcher" name="store_switcher" as="store_switcher">
|
56 |
+
<action method="setUseConfirm"><params>0</params></action>
|
57 |
+
</block>
|
58 |
+
</block>
|
59 |
+
</reference>
|
60 |
+
</adminhtml_email_campaign_index>
|
61 |
+
<adminhtml_email_campaign_grid>
|
62 |
+
<block type="core/text_list" name="root" output="toHtml">
|
63 |
+
<block type="email_connector/adminhtml_campaign_grid" name="campaign_grid"/>
|
64 |
+
</block>
|
65 |
+
</adminhtml_email_campaign_grid>
|
66 |
+
<adminhtml_email_campaign_edit>
|
67 |
+
<reference name="menu">
|
68 |
+
<action method="setActive">
|
69 |
+
<menupath>email_contact/email_conector_campaign</menupath>
|
70 |
+
</action>
|
71 |
+
</reference>
|
72 |
+
<reference name="content">
|
73 |
+
<block type="email_connector/adminhtml_campaign_edit" name="email_campaign_edit">
|
74 |
+
</block>
|
75 |
+
</reference>
|
76 |
+
</adminhtml_email_campaign_edit>
|
77 |
+
|
78 |
+
</config>
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php if( sizeof($this->getTotals()) > 0 ): ?>
|
2 |
+
<?php foreach( $this->getTotals() as $_total ): ?>
|
3 |
+
<div class="entry-edit" style="width: 400px">
|
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;color:#EA7601;"><?php echo $_total['value'] ?><span style="font-size:14px; color:#686868;"><?php echo $_total['decimals'] ?></span></span>
|
7 |
+
</fieldset>
|
8 |
+
</div>
|
9 |
+
<?php endforeach; ?>
|
10 |
+
<?php endif; ?>
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="content-header">
|
2 |
+
<table cellspacing="0">
|
3 |
+
<tr>
|
4 |
+
<td style="<?php echo $this->getHeaderWidth() ?>"><?php echo $this->getHeaderHtml() ?></td>
|
5 |
+
<td class="form-buttons"><?php echo $this->getButtonsHtml() ?></td>
|
6 |
+
</tr>
|
7 |
+
</table>
|
8 |
+
</div>
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="switcher">
|
2 |
+
<label for="store_switcher"><?php echo $this->__('Current Website') ?></label>
|
3 |
+
<?php echo $this->getHintHtml() ?>
|
4 |
+
<select id="store_switcher" class="system-config-store-switcher" onchange="location.href=this.options[this.selectedIndex].getAttribute('url')">
|
5 |
+
<?php foreach ($this->getStoreSelectOptions() as $_value => $_option): ?>
|
6 |
+
<?php if (isset($_option['is_group'])): ?>
|
7 |
+
<?php if ($_option['is_close']): ?>
|
8 |
+
</optgroup>
|
9 |
+
<?php else: ?>
|
10 |
+
<optgroup label="<?php echo $this->escapeHtml($_option['label']) ?>" style="<?php echo $_option['style'] ?>">
|
11 |
+
<?php endif; ?>
|
12 |
+
<?php continue ?>
|
13 |
+
<?php endif; ?>
|
14 |
+
<option value="<?php echo $this->escapeHtml($_value) ?>" url="<?php echo $_option['url'] ?>" <?php echo $_option['selected'] ? 'selected="selected"' : '' ?> style="<?php echo $_option['style'] ?>">
|
15 |
+
<?php echo $this->escapeHtml($_option['label']) ?>
|
16 |
+
</option>
|
17 |
+
<?php endforeach ?>
|
18 |
+
</select>
|
19 |
+
<?php if (Mage::getSingleton('admin/session')->isAllowed('system/store')): ?>
|
20 |
+
<p style="margin:10px 0 0;">
|
21 |
+
<a href="<?php echo $this->getUrl('*/system_store') ?>"><?php echo $this->__('Manage Stores') ?></a>
|
22 |
+
</p>
|
23 |
+
<?php endif; ?>
|
24 |
+
</div>
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="content-header">
|
2 |
+
<table cellspacing="0">
|
3 |
+
<tr>
|
4 |
+
<td style="width:50%;"><h3 class="icon-head <?php echo $this->getHeadClass();?>"><?php echo $this->getHeaderText(); ?></h3></td>
|
5 |
+
<td class="a-right">
|
6 |
+
<?php echo $this->getButtonsHtml() ?>
|
7 |
+
</td>
|
8 |
+
</tr>
|
9 |
+
</table>
|
10 |
+
</div>
|
11 |
+
<?php if ( !Mage::app()->isSingleStoreMode() ): ?>
|
12 |
+
<?php echo $this->getChildHtml('store_switcher');?>
|
13 |
+
<?php endif;?>
|
14 |
+
<div>
|
15 |
+
<?php echo $this->getGridHtml() ?>
|
16 |
+
</div>
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
<form action="<?php echo $this->getFormUrl(); ?>" id="connector_create_datafield" method="post">
|
3 |
+
<?php // echo $this->getBlockHtml('formkey')?>
|
4 |
+
<?php echo $this->getButtonHtml(); ?>
|
5 |
+
</form>
|
6 |
+
|
7 |
+
|
8 |
+
<form action="<?php echo $this->getPreviewUrl() ?>" method="post" id="emv_template_preview_form" target="_blank" >
|
9 |
+
<?php echo $this->getBlockHtml('formkey')?>
|
10 |
+
<div class="no-display">
|
11 |
+
<input type="hidden" id="preview_mage_template_id" name="mage_template_id" value="" />
|
12 |
+
<input type="hidden" id="preview_emv_send_mail_mode_id" name="emv_send_mail_mode_id" value="" />
|
13 |
+
<input type="hidden" id="preview_emv_template_id" name="emv_template_id" value="" />
|
14 |
+
<input type="hidden" id="preview_emv_account_id" name="emv_account_id" value="" />
|
15 |
+
<div id="preview-attribute-value"></div>
|
16 |
+
</div>
|
17 |
+
</form>
|
@@ -10,28 +10,20 @@
|
|
10 |
<block type="checkout/onepage_success" name="checkout.roi" as="connector.roi" template="connector/roi_code.phtml"/>
|
11 |
</reference>
|
12 |
</checkout_onepage_success>
|
13 |
-
<connector_email_products>
|
14 |
-
<reference name="root">
|
15 |
-
<action method="setTemplate"><template>page/blank.phtml</template></action>
|
16 |
-
</reference>
|
17 |
-
<reference name="content">
|
18 |
-
<block type="connector/products" name="email.products" as="email.products" template="page/connector/products.phtml"/>
|
19 |
-
</reference>
|
20 |
-
</connector_email_products>
|
21 |
<connector_email_coupon>
|
22 |
<reference name="root">
|
23 |
<action method="setTemplate"><template>page/blank.phtml</template></action>
|
24 |
</reference>
|
25 |
<reference name="content">
|
26 |
-
<block type="
|
27 |
</reference>
|
28 |
</connector_email_coupon>
|
29 |
-
<
|
30 |
<reference name="root">
|
31 |
<action method="setTemplate"><template>page/blank.phtml</template></action>
|
32 |
</reference>
|
33 |
<reference name="content">
|
34 |
-
<block type="
|
35 |
</reference>
|
36 |
-
</
|
37 |
</layout>
|
10 |
<block type="checkout/onepage_success" name="checkout.roi" as="connector.roi" template="connector/roi_code.phtml"/>
|
11 |
</reference>
|
12 |
</checkout_onepage_success>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
<connector_email_coupon>
|
14 |
<reference name="root">
|
15 |
<action method="setTemplate"><template>page/blank.phtml</template></action>
|
16 |
</reference>
|
17 |
<reference name="content">
|
18 |
+
<block type="email_connector/coupon" name="email.coupon" as="email.coupon" template="connector/coupon.phtml"/>
|
19 |
</reference>
|
20 |
</connector_email_coupon>
|
21 |
+
<connector_order_update>
|
22 |
<reference name="root">
|
23 |
<action method="setTemplate"><template>page/blank.phtml</template></action>
|
24 |
</reference>
|
25 |
<reference name="content">
|
26 |
+
<block type="email_connector/order_update" name="connector.order.update" as="connector.order.update" template="connector/sales/order/update.phtml"/>
|
27 |
</reference>
|
28 |
+
</connector_order_update>
|
29 |
</layout>
|
@@ -39,7 +39,7 @@ $helper = Mage::helper('core');
|
|
39 |
?>
|
40 |
<tr>
|
41 |
<td style="padding: 1px; border-bottom: 1px solid #cbd3d4; border-right: 1px solid #cbd3d4;">
|
42 |
-
<img alt="" src="<?php echo $img;?>" width="85" align="
|
43 |
</td>
|
44 |
<td style="padding: 1px; border-bottom: 1px solid #cbd3d4; border-right: 1px solid #cbd3d4;">Product Name : <a href="<?php echo $productUrl;?>"><?php echo $name . '</a></br>'. $inStock;?></td>
|
45 |
<td style="padding: 1px; border-bottom: 1px solid #cbd3d4; border-right: 1px solid #cbd3d4;"><?php echo (int)$one->getQty();?></td>
|
39 |
?>
|
40 |
<tr>
|
41 |
<td style="padding: 1px; border-bottom: 1px solid #cbd3d4; border-right: 1px solid #cbd3d4;">
|
42 |
+
<img alt="" src="<?php echo $img;?>" width="85" align="middle" border="0" height="85">
|
43 |
</td>
|
44 |
<td style="padding: 1px; border-bottom: 1px solid #cbd3d4; border-right: 1px solid #cbd3d4;">Product Name : <a href="<?php echo $productUrl;?>"><?php echo $name . '</a></br>'. $inStock;?></td>
|
45 |
<td style="padding: 1px; border-bottom: 1px solid #cbd3d4; border-right: 1px solid #cbd3d4;"><?php echo (int)$one->getQty();?></td>
|
@@ -0,0 +1,140 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php $_order = $this->getOrder();
|
2 |
+
$creditmemoItems = $this->getCreditmemoItems();
|
3 |
+
?>
|
4 |
+
<table cellspacing="0" cellpadding="0" border="0" width="650">
|
5 |
+
<thead>
|
6 |
+
<tr>
|
7 |
+
<th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Item</th>
|
8 |
+
<th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">SKU</th>
|
9 |
+
<th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Qty</th>
|
10 |
+
<th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Subtotal</th>
|
11 |
+
</tr>
|
12 |
+
</thead>
|
13 |
+
<tbody>
|
14 |
+
|
15 |
+
|
16 |
+
<?php $i=0; foreach ($creditmemoItems as $_item): $i++ ?>
|
17 |
+
<?php
|
18 |
+
if($_item->getParentItemId()) continue;?>
|
19 |
+
<tr <?php echo $i%2?'bgcolor="#eeeded"':'' ?>>
|
20 |
+
<td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;" width="70%"><?php echo $_item->getName() ?></td>
|
21 |
+
<td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;"><?php echo $_item->getSku();?></td>
|
22 |
+
<td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;"><?php echo sprintf('%s', $_item->getQtyOrdered()) ?></td>
|
23 |
+
<td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
|
24 |
+
<?php if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
|
25 |
+
<?php if ($this->helper('tax')->displayCartBothPrices()): ?>
|
26 |
+
<span class="label"><?php echo $this->__('Excl. Tax'); ?>:</span>
|
27 |
+
<?php endif; ?>
|
28 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'email', $_order->getStore())): ?>
|
29 |
+
<?php echo $_order->formatPrice($_item->getRowTotal()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?>
|
30 |
+
<?php else: ?>
|
31 |
+
<?php echo $_order->formatPrice($_item->getRowTotal()) ?>
|
32 |
+
<?php endif; ?>
|
33 |
+
|
34 |
+
<?php if (Mage::helper('weee')->getApplied($_item)): ?>
|
35 |
+
<br />
|
36 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'email', $_order->getStore())): ?>
|
37 |
+
<small>
|
38 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
39 |
+
<span class="nobr"><?php echo $tax['title']; ?>: <?php echo $_order->formatPrice($tax['row_amount'],true,true); ?></span><br />
|
40 |
+
<?php endforeach; ?>
|
41 |
+
</small>
|
42 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'email', $_order->getStore())): ?>
|
43 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
44 |
+
<span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo $_order->formatPrice($tax['row_amount_incl_tax'],true,true); ?></small></span><br />
|
45 |
+
<?php endforeach; ?>
|
46 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'email', $_order->getStore())): ?>
|
47 |
+
<small>
|
48 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
49 |
+
<span class="nobr"><?php echo $tax['title']; ?>: <?php echo $_order->formatPrice($tax['row_amount_incl_tax'],true,true); ?></span><br />
|
50 |
+
<?php endforeach; ?>
|
51 |
+
</small>
|
52 |
+
<?php endif; ?>
|
53 |
+
|
54 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'email', $_order->getStore())): ?>
|
55 |
+
<br />
|
56 |
+
<span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>:<br /> <?php echo $_order->formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?></span>
|
57 |
+
<?php endif; ?>
|
58 |
+
<?php endif; ?>
|
59 |
+
<?php endif; ?>
|
60 |
+
|
61 |
+
|
62 |
+
<?php if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
|
63 |
+
<?php if ($this->helper('tax')->displayCartBothPrices()): ?>
|
64 |
+
<br /><span class="label"><?php echo $this->__('Incl. Tax'); ?>:</span>
|
65 |
+
<?php endif; ?>
|
66 |
+
<?php $_incl = $this->helper('checkout')->getSubtotalInclTax($_item); ?>
|
67 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'email', $_order->getStore())): ?>
|
68 |
+
<?php echo $_order->formatPrice($_incl+$_item->getWeeeTaxAppliedRowAmount()); ?>
|
69 |
+
<?php else: ?>
|
70 |
+
<?php echo $_order->formatPrice($_incl-$_item->getWeeeTaxRowDisposition()) ?>
|
71 |
+
<?php endif; ?>
|
72 |
+
<?php if (Mage::helper('weee')->getApplied($_item)): ?>
|
73 |
+
<br />
|
74 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'email', $_order->getStore())): ?>
|
75 |
+
<small>
|
76 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
77 |
+
<span class="nobr"><?php echo $tax['title']; ?>: <?php echo $_order->formatPrice($tax['row_amount'],true,true); ?></span><br />
|
78 |
+
<?php endforeach; ?>
|
79 |
+
</small>
|
80 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'email', $_order->getStore())): ?>
|
81 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
82 |
+
<span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo $_order->formatPrice($tax['row_amount_incl_tax'],true,true); ?></small></span><br />
|
83 |
+
<?php endforeach; ?>
|
84 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'email', $_order->getStore())): ?>
|
85 |
+
<small>
|
86 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
87 |
+
<span class="nobr"><?php echo $tax['title']; ?>: <?php echo $_order->formatPrice($tax['row_amount_incl_tax'],true,true); ?></span><br />
|
88 |
+
<?php endforeach; ?>
|
89 |
+
</small>
|
90 |
+
<?php endif; ?>
|
91 |
+
|
92 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'email', $_order->getStore())): ?>
|
93 |
+
<span class="nobr"><?php echo Mage::helper('weee')->__('Total incl. tax'); ?>:<br /> <?php echo $_order->formatPrice($_incl+$_item->getWeeeTaxAppliedRowAmount()); ?></span>
|
94 |
+
<?php endif; ?>
|
95 |
+
<?php endif; ?>
|
96 |
+
<?php endif; ?>
|
97 |
+
</td>
|
98 |
+
</tr>
|
99 |
+
<?php endforeach ?>
|
100 |
+
|
101 |
+
</tbody>
|
102 |
+
<tfoot>
|
103 |
+
|
104 |
+
<tr>
|
105 |
+
<td></td>
|
106 |
+
<td colspan="2" align="right" style="padding:3px 9px"><?php echo Mage::helper('sales')->__('Subtotal') ?></td>
|
107 |
+
<td align="right" style="padding:3px 9px"><?php echo $_order->formatPrice($_order->getSubtotal()) ?></td>
|
108 |
+
</tr>
|
109 |
+
<?php
|
110 |
+
|
111 |
+
if ($_order->getDiscountAmount() > 0): ?>
|
112 |
+
<tr>
|
113 |
+
<td></td>
|
114 |
+
<td colspan="2" align="right" style="padding:3px 9px"><?php echo Mage::helper('sales')->__('Discount') ?></td>
|
115 |
+
<td align="right" style="padding:3px 9px"><?php echo $_order->formatPrice($_order->getDiscountAmount()) ?></td>
|
116 |
+
</tr>
|
117 |
+
<?php endif; ?>
|
118 |
+
<?php if ($_order->getShippingAmount() > 0): ?>
|
119 |
+
<tr>
|
120 |
+
<td></td>
|
121 |
+
<td colspan="2" align="right" style="padding:3px 9px"><?php echo Mage::helper('sales')->__('Shipping Amount') ?></td>
|
122 |
+
<td align="right" style="padding:3px 9px"><?php echo $_order->formatPrice($_order->getShippingAmount()) ?></td>
|
123 |
+
</tr>
|
124 |
+
<?php endif; ?>
|
125 |
+
<?php if ($_order->getTaxAmount() > 0): ?>
|
126 |
+
<tr>
|
127 |
+
<td></td>
|
128 |
+
<td colspan="2" align="right" style="padding:3px 9px"><?php echo Mage::helper('sales')->__('Tax Amount') ?></td>
|
129 |
+
<td align="right" style="padding:3px 9px"><?php echo $_order->formatPrice($_order->getTaxAmount()) ?></td>
|
130 |
+
</tr>
|
131 |
+
<?php endif; ?>
|
132 |
+
<tr>
|
133 |
+
<td></td>
|
134 |
+
<td colspan="2" align="right" style="padding:3px 9px"><strong><?php echo Mage::helper('sales')->__('Grand Total') ?></strong></td>
|
135 |
+
<td align="right" style="padding:6px 9px"><strong><?php echo $_order->formatPrice($_order->getGrandTotal()) ?></strong></td>
|
136 |
+
</tr>
|
137 |
+
</tfoot>
|
138 |
+
</table>
|
139 |
+
|
140 |
+
|
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php $order = $this->getOrder();
|
2 |
+
$creditmemo = $order->getCreditmemosCollection()->getFirstItem();
|
3 |
+
$paymentBlock = Mage::helper('payment')->getInfoBlock($order->getPayment());
|
4 |
+
?>
|
5 |
+
<style>
|
6 |
+
<?php echo Mage::getStoreConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_TRANSACTIONAL_STYLING);?>
|
7 |
+
</style>
|
8 |
+
<body style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
|
9 |
+
<div style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
|
10 |
+
<table cellspacing="0" cellpadding="0" border="0" width="100%">
|
11 |
+
<tr>
|
12 |
+
<td align="center" valign="top" style="padding:20px 0 20px 0">
|
13 |
+
<!-- [ header starts here] -->
|
14 |
+
<table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
|
15 |
+
<!-- [ middle starts here] -->
|
16 |
+
<tr>
|
17 |
+
<td>
|
18 |
+
<h2 style="font-size:18px; font-weight:normal; margin:0;">Your Credit Memo #<?php echo $creditmemo->getIncrementId();?> for Order #<?php echo $order->getIncrementId();?></h2>
|
19 |
+
</td>
|
20 |
+
</tr>
|
21 |
+
<tr>
|
22 |
+
<td>
|
23 |
+
<table cellspacing="0" cellpadding="0" border="0" width="650">
|
24 |
+
<thead>
|
25 |
+
<tr>
|
26 |
+
<th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Billing Information:</th>
|
27 |
+
<th width="10"></th>
|
28 |
+
<th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Payment Method:</th>
|
29 |
+
</tr>
|
30 |
+
</thead>
|
31 |
+
<tbody>
|
32 |
+
<tr>
|
33 |
+
<td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
|
34 |
+
<?php echo $order->getBillingAddress()->format('html');?>
|
35 |
+
</td>
|
36 |
+
<td> </td>
|
37 |
+
<td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
|
38 |
+
<?php echo $paymentBlock->toHtml();?>
|
39 |
+
</td>
|
40 |
+
</tr>
|
41 |
+
</tbody>
|
42 |
+
</table>
|
43 |
+
<br/>
|
44 |
+
<?php if($order->getIsNotVirtual()):?>
|
45 |
+
<table cellspacing="0" cellpadding="0" border="0" width="650">
|
46 |
+
<thead>
|
47 |
+
<tr>
|
48 |
+
<th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Shipping Information:</th>
|
49 |
+
<th width="10"></th>
|
50 |
+
<th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Shipping Method:</th>
|
51 |
+
</tr>
|
52 |
+
</thead>
|
53 |
+
<tbody>
|
54 |
+
<tr>
|
55 |
+
<td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
|
56 |
+
<?php echo $order->getShippingAddress()->format('html');?>
|
57 |
+
|
58 |
+
</td>
|
59 |
+
<td> </td>
|
60 |
+
<td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
|
61 |
+
<?php echo $order->getShippingDescription();?>
|
62 |
+
|
63 |
+
</td>
|
64 |
+
</tr>
|
65 |
+
</tbody>
|
66 |
+
</table>
|
67 |
+
<br/>
|
68 |
+
<?php endif;?>
|
69 |
+
<?php echo $this->getChildHtml('connector_creditmemo_items');?>
|
70 |
+
</td>
|
71 |
+
</tr>
|
72 |
+
</table>
|
73 |
+
</td>
|
74 |
+
</tr>
|
75 |
+
</table>
|
76 |
+
</div>
|
77 |
+
</body>
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php $order = $this->getOrder();
|
2 |
+
$creditmemo = $order->getCreditmemosCollection()->getFirstItem();
|
3 |
+
$billing = $order->getBillingAddress();
|
4 |
+
$paymentBlock = Mage::helper('payment')->getInfoBlock($order->getPayment());
|
5 |
+
?>
|
6 |
+
<style>
|
7 |
+
<?php echo Mage::getStoreConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_TRANSACTIONAL_STYLING);?>
|
8 |
+
</style>
|
9 |
+
<body style=" font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
|
10 |
+
<div style=" font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
|
11 |
+
<table cellspacing="0" cellpadding="0" border="0" width="100%">
|
12 |
+
<tr>
|
13 |
+
<td align="center" valign="top" style="padding:20px 0 20px 0">
|
14 |
+
<!-- [ header starts here] -->
|
15 |
+
<table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
|
16 |
+
<!-- [ middle starts here] -->
|
17 |
+
<tr>
|
18 |
+
<td>
|
19 |
+
<h2 style="font-size:18px; font-weight:normal; margin:0;">Your Credit Memo #<?php echo $creditmemo->getIncrementId();?> for Order #<?php echo $order->getIncrementId();?></h2>
|
20 |
+
</td>
|
21 |
+
</tr>
|
22 |
+
<tr>
|
23 |
+
<td>
|
24 |
+
<table cellspacing="0" cellpadding="0" border="0" width="650">
|
25 |
+
<thead>
|
26 |
+
<tr>
|
27 |
+
<th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Billing Information:</th>
|
28 |
+
<th width="10"></th>
|
29 |
+
<th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Payment Method:</th>
|
30 |
+
</tr>
|
31 |
+
</thead>
|
32 |
+
<tbody>
|
33 |
+
<tr>
|
34 |
+
<td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
|
35 |
+
<?php echo $order->getBillingAddress()->format('html');?>
|
36 |
+
</td>
|
37 |
+
<td> </td>
|
38 |
+
<td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
|
39 |
+
<?php echo $paymentBlock->toHtml();?>
|
40 |
+
</td>
|
41 |
+
</tr>
|
42 |
+
</tbody>
|
43 |
+
</table>
|
44 |
+
<br/>
|
45 |
+
<?php if($order->getIsNotVirtual()):?>
|
46 |
+
<table cellspacing="0" cellpadding="0" border="0" width="650">
|
47 |
+
<thead>
|
48 |
+
<tr>
|
49 |
+
<th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Shipping Information:</th>
|
50 |
+
<th width="10"></th>
|
51 |
+
<th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Shipping Method:</th>
|
52 |
+
</tr>
|
53 |
+
</thead>
|
54 |
+
<tbody>
|
55 |
+
<tr>
|
56 |
+
<td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
|
57 |
+
<?php echo $order->getShippingAddress()->format('html');?>
|
58 |
+
|
59 |
+
</td>
|
60 |
+
<td> </td>
|
61 |
+
<td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
|
62 |
+
<?php echo $order->getShippingDescription();?>
|
63 |
+
|
64 |
+
</td>
|
65 |
+
</tr>
|
66 |
+
</tbody>
|
67 |
+
</table>
|
68 |
+
<br/>
|
69 |
+
<?php endif;?>
|
70 |
+
<?php echo $this->getChildHtml('connector_creditmemo_items');?>
|
71 |
+
</td>
|
72 |
+
</tr>
|
73 |
+
</table>
|
74 |
+
</td>
|
75 |
+
</tr>
|
76 |
+
</table>
|
77 |
+
</div>
|
78 |
+
</body>
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php $order = $this->getOrder();
|
2 |
+
$creditmemo = $order->getCreditmemosCollection()->getFirstItem();
|
3 |
+
$comment = $creditmemo->getCommentsCollection()->getFirstItem()->getComment();
|
4 |
+
?>
|
5 |
+
<style>
|
6 |
+
<?php echo Mage::getStoreConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_TRANSACTIONAL_STYLING);?>
|
7 |
+
</style>
|
8 |
+
<body style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
|
9 |
+
<div style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
|
10 |
+
<table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%">
|
11 |
+
<tr>
|
12 |
+
<td align="center" valign="top" style="padding:20px 0 20px 0">
|
13 |
+
<!-- [ header starts here] -->
|
14 |
+
<table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
|
15 |
+
<!-- [ middle starts here] -->
|
16 |
+
<tr>
|
17 |
+
<td valign="top">
|
18 |
+
<p style="font-size:12px; line-height:16px; margin:0 0 10px 0;">
|
19 |
+
Your order # <?php echo $order->getIncrementId();?> has been <br/>
|
20 |
+
<strong><?php echo $order->getStatusLabel();?></strong>.
|
21 |
+
</p>
|
22 |
+
<p style="font-size:12px; line-height:16px; margin:0 0 10px 0;">You can check the status of your order by <a href="<?php echo $this->getBaseUrl();?>customer/account/" style="color:#1E7EC8;">logging into your account</a>.</p>
|
23 |
+
<p style="font-size:12px; line-height:16px; margin:0 0 10px 0;"><?php echo $comment;?></p>
|
24 |
+
</td>
|
25 |
+
</tr>
|
26 |
+
</table>
|
27 |
+
</td>
|
28 |
+
</tr>
|
29 |
+
</table>
|
30 |
+
</div>
|
31 |
+
</body>
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php $order = $this->getOrder();
|
2 |
+
$creditmemo = $order->getCreditmemosCollection()->getFirstItem();
|
3 |
+
$billing = $order->getBillingAddress();
|
4 |
+
$comment = $creditmemo->getCommentsCollection()->getFirstItem()->getComment();
|
5 |
+
?>
|
6 |
+
<style>
|
7 |
+
<?php echo Mage::getStoreConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_TRANSACTIONAL_STYLING);?>
|
8 |
+
</style>
|
9 |
+
<body style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
|
10 |
+
<div style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
|
11 |
+
<table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%">
|
12 |
+
<tr>
|
13 |
+
<td align="center" valign="top" style="padding:20px 0 20px 0">
|
14 |
+
<!-- [ header starts here] -->
|
15 |
+
<table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
|
16 |
+
<!-- [ middle starts here] -->
|
17 |
+
<tr>
|
18 |
+
<td valign="top">
|
19 |
+
<p style="font-size:12px; line-height:16px; margin:0 0 10px 0;">
|
20 |
+
Your order # <?php echo $order->getIncrementId();?> has been <br/>
|
21 |
+
<strong><?php echo $order->getStatusLabel();?></strong>.
|
22 |
+
</p>
|
23 |
+
<p style="font-size:12px; line-height:16px; margin:0 0 10px 0;"><?php echo $comment;?></p>
|
24 |
+
</td>
|
25 |
+
</tr>
|
26 |
+
</table>
|
27 |
+
</td>
|
28 |
+
</tr>
|
29 |
+
</table>
|
30 |
+
</div>
|
31 |
+
</body>
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$products = $this->getRecommendedProducts();
|
3 |
+
$displayType = $this->getDisplayType();
|
4 |
+
$i = 0;
|
5 |
+
foreach ($products as $key => $_product) :?>
|
6 |
+
<?php if($i == 0):?>
|
7 |
+
<table border="0" bordercolor="#FFCC00" width="147" cellpadding="0" cellspacing="0" style='font-family:arial; border-collapse: collapse; font-size:12;'><tr>
|
8 |
+
<?php endif;?>
|
9 |
+
<?php
|
10 |
+
//LIST MODE
|
11 |
+
if($displayType == 'list'){
|
12 |
+
echo '</tr><tr>';
|
13 |
+
}?>
|
14 |
+
|
15 |
+
<td style="vertical-align: text-top; padding-right: 2px;">
|
16 |
+
|
17 |
+
<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(135); ?>" width="140" height="135" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" align="middle" /></a>
|
18 |
+
|
19 |
+
<div align="center"><b><?php echo substr($_product->getName(), 0, 40);?></b></div>
|
20 |
+
|
21 |
+
<div align="center"><?php echo $this->getPriceHtml($_product, true);?></div>
|
22 |
+
<div align="center"><a href="<?php echo $_product->getProductUrl();?>">View Now</a></div>
|
23 |
+
</td>
|
24 |
+
|
25 |
+
<?php if($i++ % 4 ==3 && $displayType == 'grid') echo '</tr><tr>'?>
|
26 |
+
|
27 |
+
<?php endforeach;?>
|
28 |
+
<?php if( $i > 0) echo '</table>';
|
29 |
+
|
30 |
+
|
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$order = $this->getOrder();
|
3 |
+
$invoice = $order->getInvoiceCollection()->getLastItem();
|
4 |
+
$paymentBlock = Mage::helper('payment')->getInfoBlock($order->getPayment());
|
5 |
+
?>
|
6 |
+
<style>
|
7 |
+
<?php echo Mage::getStoreConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_TRANSACTIONAL_STYLING);?>
|
8 |
+
</style>
|
9 |
+
<body style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
|
10 |
+
<div style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
|
11 |
+
<table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%">
|
12 |
+
<tr>
|
13 |
+
<td align="center" valign="top" style="padding:20px 0 20px 0">
|
14 |
+
<!-- [ header starts here] -->
|
15 |
+
<table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
|
16 |
+
<!-- [ middle starts here] -->
|
17 |
+
<tr>
|
18 |
+
<td valign="top">
|
19 |
+
<p style="font-size:12px; line-height:16px; margin:0;">
|
20 |
+
You can check the status of your order by <a href="<?php echo $this->getBaseUrl();?>customer/account/" style="color:#1E7EC8;">logging into your account</a>.
|
21 |
+
</p>
|
22 |
+
</td>
|
23 |
+
</tr>
|
24 |
+
<tr>
|
25 |
+
<td>
|
26 |
+
<h2 style="font-size:18px; font-weight:normal; margin:0;">Your Invoice #<?php echo $invoice->getIncrementId();?> for Order #<?php echo $order->getIncrementId();?></h2>
|
27 |
+
</td>
|
28 |
+
</tr>
|
29 |
+
<tr>
|
30 |
+
<td>
|
31 |
+
<table cellspacing="0" cellpadding="0" border="0" width="650">
|
32 |
+
<thead>
|
33 |
+
<tr>
|
34 |
+
<th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Billing Information:</th>
|
35 |
+
<th width="10"></th>
|
36 |
+
<th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Payment Method:</th>
|
37 |
+
</tr>
|
38 |
+
</thead>
|
39 |
+
<tbody>
|
40 |
+
<tr>
|
41 |
+
<td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
|
42 |
+
<?php echo $order->getBillingAddress()->format('html');?>
|
43 |
+
</td>
|
44 |
+
<td> </td>
|
45 |
+
<td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
|
46 |
+
<?php echo $paymentBlock->toHtml();?>
|
47 |
+
</td>
|
48 |
+
</tr>
|
49 |
+
</tbody>
|
50 |
+
</table>
|
51 |
+
<br/>
|
52 |
+
<?php if ($order->getIsNotVirtual()):?>
|
53 |
+
<table cellspacing="0" cellpadding="0" border="0" width="100%">
|
54 |
+
<thead>
|
55 |
+
<tr>
|
56 |
+
<th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Shipping Information:</th>
|
57 |
+
<th width="10"></th>
|
58 |
+
<th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Shipping Method:</th>
|
59 |
+
</tr>
|
60 |
+
</thead>
|
61 |
+
<tbody>
|
62 |
+
<tr>
|
63 |
+
<td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
|
64 |
+
<?php echo $order->getShippingAddress()->format('html');?>
|
65 |
+
|
66 |
+
</td>
|
67 |
+
<td> </td>
|
68 |
+
<td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
|
69 |
+
<?php echo $order->getShippingDescription();?>
|
70 |
+
</td>
|
71 |
+
</tr>
|
72 |
+
</tbody>
|
73 |
+
</table>
|
74 |
+
<br/>
|
75 |
+
<?php endif;?>
|
76 |
+
<?php echo $this->getChildHtml('connector_order_items');?>
|
77 |
+
</td>
|
78 |
+
</tr>
|
79 |
+
<tr>
|
80 |
+
</tr>
|
81 |
+
</table>
|
82 |
+
</td>
|
83 |
+
</tr>
|
84 |
+
</table>
|
85 |
+
</div>
|
86 |
+
</body>
|
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$order = $this->getOrder();
|
3 |
+
$invoice = $order->getInvoiceCollection()->getLastItem();
|
4 |
+
$billing = $order->getBillingAddress();
|
5 |
+
$paymentBlock = Mage::helper('payment')->getInfoBlock($order->getPayment());
|
6 |
+
?>
|
7 |
+
<style>
|
8 |
+
<?php echo Mage::getStoreConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_TRANSACTIONAL_STYLING);?>
|
9 |
+
</style>
|
10 |
+
<body style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
|
11 |
+
<div style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
|
12 |
+
<table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%">
|
13 |
+
<tr>
|
14 |
+
<td align="center" valign="top" style="padding:20px 0 20px 0">
|
15 |
+
<!-- [ header starts here] -->
|
16 |
+
<table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
|
17 |
+
<!-- [ middle starts here] -->
|
18 |
+
<tr>
|
19 |
+
<td>
|
20 |
+
<h2 style="font-size:18px; font-weight:normal; margin:0;">Your Invoice #<?php echo $invoice->getIncrementId();?> for Order #<?php echo $order->getIncrementId();?></h2>
|
21 |
+
</td>
|
22 |
+
</tr>
|
23 |
+
<tr>
|
24 |
+
<td>
|
25 |
+
<table cellspacing="0" cellpadding="0" border="0" width="650">
|
26 |
+
<thead>
|
27 |
+
<tr>
|
28 |
+
<th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Billing Information:</th>
|
29 |
+
<th width="10"></th>
|
30 |
+
<th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Payment Method:</th>
|
31 |
+
</tr>
|
32 |
+
</thead>
|
33 |
+
<tbody>
|
34 |
+
<tr>
|
35 |
+
<td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
|
36 |
+
<?php echo $billing->format('html');?>
|
37 |
+
</td>
|
38 |
+
<td> </td>
|
39 |
+
<td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
|
40 |
+
<?php echo $paymentBlock->toHtml();?>
|
41 |
+
</td>
|
42 |
+
</tr>
|
43 |
+
</tbody>
|
44 |
+
</table>
|
45 |
+
<br/>
|
46 |
+
<?php if($order->getIsNotVirtual()):?>
|
47 |
+
<table cellspacing="0" cellpadding="0" border="0" width="650">
|
48 |
+
<thead>
|
49 |
+
<tr>
|
50 |
+
<th align="left" width="650" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Shipping Information:</th>
|
51 |
+
<th width="10"></th>
|
52 |
+
<th align="left" width="650" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Shipping Method:</th>
|
53 |
+
</tr>
|
54 |
+
</thead>
|
55 |
+
<tbody>
|
56 |
+
<tr>
|
57 |
+
<td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
|
58 |
+
<?php echo $order->getShippingAddress()->format('html');?>
|
59 |
+
|
60 |
+
</td>
|
61 |
+
<td> </td>
|
62 |
+
<td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
|
63 |
+
<?php echo $order->getShippingDescription();?>
|
64 |
+
|
65 |
+
</td>
|
66 |
+
</tr>
|
67 |
+
</tbody>
|
68 |
+
</table>
|
69 |
+
<br/>
|
70 |
+
<?php endif;?>
|
71 |
+
<?php echo $this->getChildHtml('connector_order_items');?>
|
72 |
+
</td>
|
73 |
+
</tr>
|
74 |
+
</table>
|
75 |
+
</td>
|
76 |
+
</tr>
|
77 |
+
</table>
|
78 |
+
</div>
|
79 |
+
</body>
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php $order = $this->getOrder();
|
2 |
+
$invoice = $order->getInvoiceCollection()->getLastItem();
|
3 |
+
$comment = $invoice->getCommentsCollection()->getFirstItem()->getComment();
|
4 |
+
$billing = $order->getBillingAddress();
|
5 |
+
$paymentBlock = Mage::helper('payment')->getInfoBlock($order->getPayment());
|
6 |
+
?>
|
7 |
+
<style>
|
8 |
+
<?php echo Mage::getStoreConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_TRANSACTIONAL_STYLING);?>
|
9 |
+
</style>
|
10 |
+
<body style=" font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
|
11 |
+
<div style=" font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
|
12 |
+
<table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%">
|
13 |
+
<tr>
|
14 |
+
<td align="center" valign="top" style="padding:20px 0 20px 0">
|
15 |
+
<!-- [ header starts here] -->
|
16 |
+
<table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
|
17 |
+
<!-- [ middle starts here] -->
|
18 |
+
<tr>
|
19 |
+
<td valign="top">
|
20 |
+
<p style="font-size:12px; line-height:16px; margin:0 0 10px 0;">
|
21 |
+
Your order # <?php echo $order->getIncrementId();?> has been <br/>
|
22 |
+
<strong><?php echo $order->getStatusLabel();?></strong>.
|
23 |
+
</p>
|
24 |
+
<p style="font-size:12px; line-height:16px; margin:0 0 10px 0;">You can check the status of your order by <a href="<?php echo $this->getBaseUrl();?>customer/account/"}}" style="color:#1E7EC8;">logging into your account</a>.</p>
|
25 |
+
<p style="font-size:12px; line-height:16px; margin:0 0 10px 0;"><?php echo $comment;?></p>
|
26 |
+
</td>
|
27 |
+
</tr>
|
28 |
+
</table>
|
29 |
+
</td>
|
30 |
+
</tr>
|
31 |
+
</table>
|
32 |
+
</div>
|
33 |
+
</body>
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$order = $this->getOrder();
|
3 |
+
$invoice = $order->getInvoiceCollection()->getLastItem();
|
4 |
+
$comment = $invoice->getCommentsCollection()->getFirstItem()->getComment();
|
5 |
+
$billing = $order->getBillingAddress();
|
6 |
+
$paymentBlock = Mage::helper('payment')->getInfoBlock($order->getPayment());
|
7 |
+
?>
|
8 |
+
<style>
|
9 |
+
<?php echo Mage::getStoreConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_TRANSACTIONAL_STYLING);?>
|
10 |
+
</style>
|
11 |
+
<body style=" font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
|
12 |
+
<div style=" font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
|
13 |
+
<table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%">
|
14 |
+
<tr>
|
15 |
+
<td align="center" valign="top" style="padding:20px 0 20px 0">
|
16 |
+
<!-- [ header starts here] -->
|
17 |
+
<table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
|
18 |
+
<!-- [ middle starts here] -->
|
19 |
+
<tr>
|
20 |
+
<td valign="top">
|
21 |
+
<p style="font-size:12px; line-height:16px; margin:0 0 10px 0;">
|
22 |
+
Your order # <?php echo $order->getIncrementId();?> has been <br/>
|
23 |
+
<strong><?php echo $order->getStatusLabel();?></strong>.
|
24 |
+
</p>
|
25 |
+
<p style="font-size:12px; line-height:16px; margin:0 0 10px 0;"><?php echo $comment;?></p>
|
26 |
+
</td>
|
27 |
+
</tr>
|
28 |
+
</table>
|
29 |
+
</td>
|
30 |
+
</tr>
|
31 |
+
</table>
|
32 |
+
</div>
|
33 |
+
</body>
|
@@ -0,0 +1,138 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php $_order = $this->getOrder() ?>
|
2 |
+
<table cellspacing="0" cellpadding="0" border="0" width="650">
|
3 |
+
<thead>
|
4 |
+
<tr>
|
5 |
+
<th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Item</th>
|
6 |
+
<th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">SKU</th>
|
7 |
+
<th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Qty</th>
|
8 |
+
<th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Subtotal</th>
|
9 |
+
</tr>
|
10 |
+
</thead>
|
11 |
+
<tbody>
|
12 |
+
|
13 |
+
|
14 |
+
<?php $i=0; foreach ($_order->getAllItems() as $_item): $i++ ?>
|
15 |
+
<?php
|
16 |
+
if($_item->getParentItemId()) continue;?>
|
17 |
+
<tr <?php echo $i%2?'bgcolor="#eeeded"':'' ?>>
|
18 |
+
<td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;" width="70%"><?php echo $_item->getName() ?></td>
|
19 |
+
<td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;"><?php echo $_item->getSku();?></td>
|
20 |
+
<td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;"><?php echo sprintf('%s', $_item->getQtyOrdered()) ?></td>
|
21 |
+
<td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
|
22 |
+
<?php if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
|
23 |
+
<?php if ($this->helper('tax')->displayCartBothPrices()): ?>
|
24 |
+
<span class="label"><?php echo $this->__('Excl. Tax'); ?>:</span>
|
25 |
+
<?php endif; ?>
|
26 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'email', $_order->getStore())): ?>
|
27 |
+
<?php echo $_order->formatPrice($_item->getRowTotal()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?>
|
28 |
+
<?php else: ?>
|
29 |
+
<?php echo $_order->formatPrice($_item->getRowTotal()) ?>
|
30 |
+
<?php endif; ?>
|
31 |
+
|
32 |
+
<?php if (Mage::helper('weee')->getApplied($_item)): ?>
|
33 |
+
<br />
|
34 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'email', $_order->getStore())): ?>
|
35 |
+
<small>
|
36 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
37 |
+
<span class="nobr"><?php echo $tax['title']; ?>: <?php echo $_order->formatPrice($tax['row_amount'],true,true); ?></span><br />
|
38 |
+
<?php endforeach; ?>
|
39 |
+
</small>
|
40 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'email', $_order->getStore())): ?>
|
41 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
42 |
+
<span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo $_order->formatPrice($tax['row_amount_incl_tax'],true,true); ?></small></span><br />
|
43 |
+
<?php endforeach; ?>
|
44 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'email', $_order->getStore())): ?>
|
45 |
+
<small>
|
46 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
47 |
+
<span class="nobr"><?php echo $tax['title']; ?>: <?php echo $_order->formatPrice($tax['row_amount_incl_tax'],true,true); ?></span><br />
|
48 |
+
<?php endforeach; ?>
|
49 |
+
</small>
|
50 |
+
<?php endif; ?>
|
51 |
+
|
52 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'email', $_order->getStore())): ?>
|
53 |
+
<br />
|
54 |
+
<span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>:<br /> <?php echo $_order->formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?></span>
|
55 |
+
<?php endif; ?>
|
56 |
+
<?php endif; ?>
|
57 |
+
<?php endif; ?>
|
58 |
+
|
59 |
+
|
60 |
+
<?php if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
|
61 |
+
<?php if ($this->helper('tax')->displayCartBothPrices()): ?>
|
62 |
+
<br /><span class="label"><?php echo $this->__('Incl. Tax'); ?>:</span>
|
63 |
+
<?php endif; ?>
|
64 |
+
<?php $_incl = $this->helper('checkout')->getSubtotalInclTax($_item); ?>
|
65 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'email', $_order->getStore())): ?>
|
66 |
+
<?php echo $_order->formatPrice($_incl+$_item->getWeeeTaxAppliedRowAmount()); ?>
|
67 |
+
<?php else: ?>
|
68 |
+
<?php echo $_order->formatPrice($_incl-$_item->getWeeeTaxRowDisposition()) ?>
|
69 |
+
<?php endif; ?>
|
70 |
+
<?php if (Mage::helper('weee')->getApplied($_item)): ?>
|
71 |
+
<br />
|
72 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'email', $_order->getStore())): ?>
|
73 |
+
<small>
|
74 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
75 |
+
<span class="nobr"><?php echo $tax['title']; ?>: <?php echo $_order->formatPrice($tax['row_amount'],true,true); ?></span><br />
|
76 |
+
<?php endforeach; ?>
|
77 |
+
</small>
|
78 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'email', $_order->getStore())): ?>
|
79 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
80 |
+
<span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo $_order->formatPrice($tax['row_amount_incl_tax'],true,true); ?></small></span><br />
|
81 |
+
<?php endforeach; ?>
|
82 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'email', $_order->getStore())): ?>
|
83 |
+
<small>
|
84 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
85 |
+
<span class="nobr"><?php echo $tax['title']; ?>: <?php echo $_order->formatPrice($tax['row_amount_incl_tax'],true,true); ?></span><br />
|
86 |
+
<?php endforeach; ?>
|
87 |
+
</small>
|
88 |
+
<?php endif; ?>
|
89 |
+
|
90 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'email', $_order->getStore())): ?>
|
91 |
+
<span class="nobr"><?php echo Mage::helper('weee')->__('Total incl. tax'); ?>:<br /> <?php echo $_order->formatPrice($_incl+$_item->getWeeeTaxAppliedRowAmount()); ?></span>
|
92 |
+
<?php endif; ?>
|
93 |
+
<?php endif; ?>
|
94 |
+
<?php endif; ?>
|
95 |
+
</td>
|
96 |
+
</tr>
|
97 |
+
<?php endforeach ?>
|
98 |
+
|
99 |
+
</tbody>
|
100 |
+
<tfoot>
|
101 |
+
|
102 |
+
<tr>
|
103 |
+
<td></td>
|
104 |
+
<td colspan="2" align="right" style="padding:3px 9px"><?php echo Mage::helper('sales')->__('Subtotal') ?></td>
|
105 |
+
<td align="right" style="padding:3px 9px"><?php echo $_order->formatPrice($_order->getSubtotal()) ?></td>
|
106 |
+
</tr>
|
107 |
+
<?php
|
108 |
+
|
109 |
+
if ($_order->getDiscountAmount() > 0): ?>
|
110 |
+
<tr>
|
111 |
+
<td></td>
|
112 |
+
<td colspan="2" align="right" style="padding:3px 9px"><?php echo Mage::helper('sales')->__('Discount') ?></td>
|
113 |
+
<td align="right" style="padding:3px 9px"><?php echo $_order->formatPrice($_order->getDiscountAmount()) ?></td>
|
114 |
+
</tr>
|
115 |
+
<?php endif; ?>
|
116 |
+
<?php if ($_order->getShippingAmount() > 0): ?>
|
117 |
+
<tr>
|
118 |
+
<td></td>
|
119 |
+
<td colspan="2" align="right" style="padding:3px 9px"><?php echo Mage::helper('sales')->__('Shipping Amount') ?></td>
|
120 |
+
<td align="right" style="padding:3px 9px"><?php echo $_order->formatPrice($_order->getShippingAmount()) ?></td>
|
121 |
+
</tr>
|
122 |
+
<?php endif; ?>
|
123 |
+
<?php if ($_order->getTaxAmount() > 0): ?>
|
124 |
+
<tr>
|
125 |
+
<td></td>
|
126 |
+
<td colspan="2" align="right" style="padding:3px 9px"><?php echo Mage::helper('sales')->__('Tax Amount') ?></td>
|
127 |
+
<td align="right" style="padding:3px 9px"><?php echo $_order->formatPrice($_order->getTaxAmount()) ?></td>
|
128 |
+
</tr>
|
129 |
+
<?php endif; ?>
|
130 |
+
<tr>
|
131 |
+
<td></td>
|
132 |
+
<td colspan="2" align="right" style="padding:3px 9px"><strong><?php echo Mage::helper('sales')->__('Grand Total') ?></strong></td>
|
133 |
+
<td align="right" style="padding:6px 9px"><strong><?php echo $_order->formatPrice($_order->getGrandTotal()) ?></strong></td>
|
134 |
+
</tr>
|
135 |
+
</tfoot>
|
136 |
+
</table>
|
137 |
+
|
138 |
+
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$order = $this->getOrder();
|
3 |
+
$storeId = Mage::app()->getStore()->getId();
|
4 |
+
$paymentBlock = Mage::helper('payment')->getInfoBlock($order->getPayment());
|
5 |
+
$paymentBlock->getMethod()->setStore($storeId);
|
6 |
+
?>
|
7 |
+
<style>
|
8 |
+
<?php echo Mage::getStoreConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_TRANSACTIONAL_STYLING);?>
|
9 |
+
</style>
|
10 |
+
<body style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
|
11 |
+
<div style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
|
12 |
+
<table cellspacing="0" cellpadding="0" border="0" width="100%">
|
13 |
+
<tr>
|
14 |
+
<td align="center" valign="top" style="padding:20px 0 20px 0">
|
15 |
+
<table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
|
16 |
+
<tr>
|
17 |
+
<td>
|
18 |
+
<h2 style="font-size:18px; font-weight:normal; margin:0;">Your Order #<?php echo $order->getIncrementId();?> <small>(placed on <?php echo $order->getCreatedAtFormated('long');?>)</small></h2>
|
19 |
+
</td>
|
20 |
+
</tr>
|
21 |
+
<tr>
|
22 |
+
<td>
|
23 |
+
<table cellspacing="0" cellpadding="0" border="0" width="650">
|
24 |
+
<thead>
|
25 |
+
<tr>
|
26 |
+
<th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Billing Information:</th>
|
27 |
+
<th width="10"></th>
|
28 |
+
<th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Payment Method:</th>
|
29 |
+
</tr>
|
30 |
+
</thead>
|
31 |
+
<tbody>
|
32 |
+
<tr>
|
33 |
+
<td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
|
34 |
+
<?php echo $order->getBillingAddress()->format('html');?>
|
35 |
+
</td>
|
36 |
+
<td> </td>
|
37 |
+
<td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
|
38 |
+
<?php echo $paymentBlock->toHtml();?>
|
39 |
+
</td>
|
40 |
+
</tr>
|
41 |
+
</tbody>
|
42 |
+
</table>
|
43 |
+
<br/>
|
44 |
+
<?php if($order->getIsNotVirtual()):?>
|
45 |
+
<table cellspacing="0" cellpadding="0" border="0" width="650">
|
46 |
+
<thead>
|
47 |
+
<tr>
|
48 |
+
<th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Shipping Information:</th>
|
49 |
+
<th width="10"></th>
|
50 |
+
<th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Shipping Method:</th>
|
51 |
+
</tr>
|
52 |
+
</thead>
|
53 |
+
<tbody>
|
54 |
+
<tr>
|
55 |
+
<td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
|
56 |
+
<?php echo $order->getShippingAddress()->format('html');?>
|
57 |
+
|
58 |
+
</td>
|
59 |
+
<td> </td>
|
60 |
+
<td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
|
61 |
+
<?php echo $order->getShippingDescription();?>
|
62 |
+
|
63 |
+
</td>
|
64 |
+
</tr>
|
65 |
+
</tbody>
|
66 |
+
</table>
|
67 |
+
<br/>
|
68 |
+
<?php endif;?>
|
69 |
+
<?php echo $this->getChildHtml('connector_order_items');?>
|
70 |
+
<p style="font-size:12px; margin:0 0 10px 0"><?php echo $order->getEmailCustomerNote();?></p>
|
71 |
+
</td>
|
72 |
+
</tr>
|
73 |
+
</table>
|
74 |
+
</td>
|
75 |
+
</tr>
|
76 |
+
</table>
|
77 |
+
</div>
|
78 |
+
</body>
|
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$order = $this->getOrder();
|
3 |
+
$storeId = Mage::app()->getStore()->getId();
|
4 |
+
$paymentBlock = Mage::helper('payment')->getInfoBlock($order->getPayment());
|
5 |
+
$paymentBlock->getMethod()->setStore($storeId);
|
6 |
+
?>
|
7 |
+
<style>
|
8 |
+
<?php echo Mage::getStoreConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_TRANSACTIONAL_STYLING);?>
|
9 |
+
</style>
|
10 |
+
<body style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
|
11 |
+
<div style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
|
12 |
+
<table cellspacing="0" cellpadding="0" border="0" width="100%">
|
13 |
+
<tr>
|
14 |
+
<td align="center" valign="top" style="padding:20px 0 20px 0">
|
15 |
+
<!-- [ header starts here] -->
|
16 |
+
<table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
|
17 |
+
<!-- [ middle starts here] -->
|
18 |
+
<tr>
|
19 |
+
<td>
|
20 |
+
<h2 style="font-size:18px; font-weight:normal; margin:0;">Your Order #<?php echo $order->getIncrementId();?> <small>(placed on <?php echo $order->getCreatedAtFormated('long');?>)</small></h2>
|
21 |
+
</td>
|
22 |
+
</tr>
|
23 |
+
<tr>
|
24 |
+
<td>
|
25 |
+
<table cellspacing="0" cellpadding="0" border="0" width="650">
|
26 |
+
<thead>
|
27 |
+
<tr>
|
28 |
+
<th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Billing Information:</th>
|
29 |
+
<th width="10"></th>
|
30 |
+
<th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Payment Method:</th>
|
31 |
+
</tr>
|
32 |
+
</thead>
|
33 |
+
<tbody>
|
34 |
+
<tr>
|
35 |
+
<td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
|
36 |
+
<?php echo $order->getBillingAddress()->format('html');?>
|
37 |
+
</td>
|
38 |
+
<td> </td>
|
39 |
+
<td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
|
40 |
+
<?php echo $paymentBlock->toHtml();?>
|
41 |
+
</td>
|
42 |
+
</tr>
|
43 |
+
</tbody>
|
44 |
+
</table>
|
45 |
+
<br/>
|
46 |
+
<?php if($order->getIsNotVirtual()):?>
|
47 |
+
<table cellspacing="0" cellpadding="0" border="0" width="100%">
|
48 |
+
<thead>
|
49 |
+
<tr>
|
50 |
+
<th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Shipping Information:</th>
|
51 |
+
<th width="10"></th>
|
52 |
+
<th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Shipping Method:</th>
|
53 |
+
</tr>
|
54 |
+
</thead>
|
55 |
+
<tbody>
|
56 |
+
<tr>
|
57 |
+
<td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
|
58 |
+
<?php echo $order->getShippingAddress()->format('html');?>
|
59 |
+
|
60 |
+
</td>
|
61 |
+
<td> </td>
|
62 |
+
<td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
|
63 |
+
<?php echo $order->getShippingDescription();?>
|
64 |
+
|
65 |
+
</td>
|
66 |
+
</tr>
|
67 |
+
</tbody>
|
68 |
+
</table>
|
69 |
+
<br/>
|
70 |
+
<?php endif;?>
|
71 |
+
<?php echo $this->getChildHtml('connector_order_items');?>
|
72 |
+
<p style="font-size:12px; margin:0 10px 10px 0"><?php echo $order->getEmailCustomerNote();?></p>
|
73 |
+
</td>
|
74 |
+
</tr>
|
75 |
+
</table>
|
76 |
+
</td>
|
77 |
+
</tr>
|
78 |
+
</table>
|
79 |
+
</div>
|
80 |
+
</body>
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$order = $this->getOrder();
|
3 |
+
$allstatues = $order->getAllStatusHistory();
|
4 |
+
$comment = (isset($allstatues[0]))? $allstatues[0]->getComment() : '';
|
5 |
+
?>
|
6 |
+
<style>
|
7 |
+
<?php echo Mage::getStoreConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_TRANSACTIONAL_STYLING);?>
|
8 |
+
</style>
|
9 |
+
<body style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
|
10 |
+
<div style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
|
11 |
+
<table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%">
|
12 |
+
<tr>
|
13 |
+
<td align="center" valign="top" style="padding:20px 0 20px 0">
|
14 |
+
<!-- [ header starts here] -->
|
15 |
+
<table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
|
16 |
+
<!-- [ middle starts here] -->
|
17 |
+
<tr>
|
18 |
+
<td valign="top">
|
19 |
+
<p style="font-size:12px; line-height:16px; margin:0 0 10px 0;">
|
20 |
+
Your order # <?php echo $order->getIncrementId();?> has been <br/>
|
21 |
+
<strong><?php echo $order->getStatusLabel();?></strong>.
|
22 |
+
</p>
|
23 |
+
<p style="font-size:12px; line-height:16px; margin:0 0 10px 0;">You can check the status of your order by <a href="<?php echo $this->getBaseUrl();?>customer/account/" style="color:#1E7EC8;">logging into your account</a>.</p>
|
24 |
+
<p style="font-size:12px; line-height:16px; margin:0 0 10px 0;"><?php echo $comment;?></p>
|
25 |
+
</td>
|
26 |
+
</tr>
|
27 |
+
</table>
|
28 |
+
</td>
|
29 |
+
</tr>
|
30 |
+
</table>
|
31 |
+
</div>
|
32 |
+
</body>
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$order = $this->getOrder();
|
3 |
+
$allstatues = $order->getAllStatusHistory();
|
4 |
+
$billing = $order->getBillingAddress();
|
5 |
+
$billingName = ($billing)? $billing->getName() : '';
|
6 |
+
$comment = (isset($allstatues[0]))? $allstatues[0]->getComment() : '';
|
7 |
+
?>
|
8 |
+
<style>
|
9 |
+
<?php echo Mage::getStoreConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_TRANSACTIONAL_STYLING);?>
|
10 |
+
</style>
|
11 |
+
<body style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
|
12 |
+
<div style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
|
13 |
+
<table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%">
|
14 |
+
<tr>
|
15 |
+
<td align="center" valign="top" style="padding:20px 0 20px 0">
|
16 |
+
<!-- [ header starts here] -->
|
17 |
+
<table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
|
18 |
+
<!-- [ middle starts here] -->
|
19 |
+
<tr>
|
20 |
+
<td valign="top">
|
21 |
+
<p style="font-size:12px; line-height:16px; margin:0 0 10px 0;">
|
22 |
+
Your order # <?php echo $order->getIncrementId();?> has been <br/>
|
23 |
+
<strong><?php echo $order->getStatusLabel();?></strong>.
|
24 |
+
</p>
|
25 |
+
<p style="font-size:12px; line-height:16px; margin:0 0 10px 0;"><?php echo $comment;?></p>
|
26 |
+
</td>
|
27 |
+
</tr>
|
28 |
+
</table>
|
29 |
+
</td>
|
30 |
+
</tr>
|
31 |
+
</table>
|
32 |
+
</div>
|
33 |
+
</body>
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$products = $this->getLoadedProductCollection();
|
3 |
+
$mode = $this->getMode();
|
4 |
+
$i = 0;
|
5 |
+
foreach ($products as $key => $_product) :?>
|
6 |
+
<?php if($i == 0):?>
|
7 |
+
<style>
|
8 |
+
<?php echo Mage::getStoreConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_RECOMMENDED_STYLING);?>
|
9 |
+
</style>
|
10 |
+
|
11 |
+
<table border="0" width="147" cellpadding="0" cellspacing="0" style='font-family:arial; border-collapse: collapse; font-size:12;'><tr>
|
12 |
+
<?php endif;?>
|
13 |
+
<?php
|
14 |
+
//LIST MODE
|
15 |
+
if($mode == 'list'){
|
16 |
+
echo '</tr><tr>';
|
17 |
+
}?>
|
18 |
+
|
19 |
+
<td style="vertical-align: text-top; padding-right: 2px;">
|
20 |
+
|
21 |
+
<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(135); ?>" width="140" height="135" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" align="middle" /></a>
|
22 |
+
|
23 |
+
<div class="product-name" align="center"><b><?php echo substr($_product->getName(), 0, 40);?></b></div>
|
24 |
+
<div class="product-price" align="center"><?php echo $this->getPriceHtml($_product, true) ?></div>
|
25 |
+
<div class="proudct-url" align="center"><a href="<?php echo $_product->getProductUrl();?>">View Now</a></div>
|
26 |
+
</td>
|
27 |
+
|
28 |
+
<?php if($i++ % 4 ==3 && $mode == 'grid') echo '</tr><tr>'?>
|
29 |
+
|
30 |
+
<?php endforeach;?>
|
31 |
+
<?php if( $i > 0) echo '</table>';
|
32 |
+
|
File without changes
|
@@ -1,23 +1,19 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
if(Mage::getStoreConfig('connector_roi_page_tracking_settings/roi_tracking/enabled')):?>
|
4 |
-
|
5 |
-
<?php
|
6 |
$order = Mage::getModel('sales/order')->loadByIncrementId($this->getOrderId());
|
7 |
$orderId = $this->getOrderId();
|
8 |
$items = $order->getAllItems();
|
9 |
$total = number_format($order->getBaseGrandTotal(), 2);
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
<?php foreach ($items as $item):?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
-
<?php if($item->getParentItemId() != null)
|
16 |
-
continue;?>
|
17 |
-
_dmTrack("product", <?php echo $item->getName()?>;
|
18 |
|
19 |
-
<?php endforeach;?>
|
20 |
-
_dmTrack("CheckOutAmount", <?php echo $total;?>);
|
21 |
-
</script>
|
22 |
|
23 |
-
<?php endif;?>
|
1 |
+
<?php if(Mage::helper('connector')->getRoiTrackingEnabled()):
|
|
|
|
|
|
|
|
|
2 |
$order = Mage::getModel('sales/order')->loadByIncrementId($this->getOrderId());
|
3 |
$orderId = $this->getOrderId();
|
4 |
$items = $order->getAllItems();
|
5 |
$total = number_format($order->getBaseGrandTotal(), 2);
|
6 |
+
?>
|
7 |
+
<script type="text/javascript">
|
8 |
+
document.observe('dom:loaded', function() {
|
9 |
<?php foreach ($items as $item):?>
|
10 |
+
<?php if($item->getParentItemId() != null) continue;?>
|
11 |
+
_dmTrack("product", "<?php echo str_replace('"', ' ', $item->getName())?>");
|
12 |
+
<?php endforeach;?>
|
13 |
+
_dmTrack("CheckOutAmount", "<?php echo $total;?>");
|
14 |
+
});
|
15 |
+
</script>
|
16 |
+
<?php endif;?>
|
17 |
|
|
|
|
|
|
|
18 |
|
|
|
|
|
|
|
19 |
|
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php $order = $this->getOrder();
|
2 |
+
$shipping = $order->getShipmentsCollection()->getFirstItem();
|
3 |
+
$comment = $shipping->getCommentsCollection()->getFirstItem()->getComment();
|
4 |
+
$paymentBlock = Mage::helper('payment')->getInfoBlock($order->getPayment());
|
5 |
+
?>
|
6 |
+
<style>
|
7 |
+
<?php echo Mage::getStoreConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_TRANSACTIONAL_STYLING);?>
|
8 |
+
</style>
|
9 |
+
<body style=" font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
|
10 |
+
<div style=" font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
|
11 |
+
<table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%">
|
12 |
+
<tr>
|
13 |
+
<td align="center" valign="top" style="padding:20px 0 20px 0">
|
14 |
+
<!-- [ header starts here] -->
|
15 |
+
<table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
|
16 |
+
<!-- [ middle starts here] -->
|
17 |
+
<tr>
|
18 |
+
<td>
|
19 |
+
<h2 style="font-size:18px; font-weight:normal; margin:0;">Your Shipment #<?php echo $shipping->getIncrementId();?> for Order #<?php echo $order->getIncrementId();?></h2>
|
20 |
+
</td>
|
21 |
+
</tr>
|
22 |
+
<tr>
|
23 |
+
<td>
|
24 |
+
<table cellspacing="0" cellpadding="0" border="0" width="650">
|
25 |
+
<thead>
|
26 |
+
<tr>
|
27 |
+
<th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Billing Information:</th>
|
28 |
+
<th width="10"></th>
|
29 |
+
<th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Payment Method:</th>
|
30 |
+
</tr>
|
31 |
+
</thead>
|
32 |
+
<tbody>
|
33 |
+
<tr>
|
34 |
+
<td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
|
35 |
+
<?php echo $order->getBillingAddress()->format('html');?>
|
36 |
+
</td>
|
37 |
+
<td> </td>
|
38 |
+
<td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
|
39 |
+
<?php echo $paymentBlock->toHtml();?>
|
40 |
+
</td>
|
41 |
+
</tr>
|
42 |
+
</tbody>
|
43 |
+
</table>
|
44 |
+
<br/>
|
45 |
+
<table cellspacing="0" cellpadding="0" border="0" width="100%">
|
46 |
+
<thead>
|
47 |
+
<tr>
|
48 |
+
<th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Shipping Information:</th>
|
49 |
+
<th width="10"></th>
|
50 |
+
<th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Shipping Method:</th>
|
51 |
+
</tr>
|
52 |
+
</thead>
|
53 |
+
<tbody>
|
54 |
+
<tr>
|
55 |
+
<td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
|
56 |
+
<?php echo $order->getShippingAddress()->format('html');?>
|
57 |
+
|
58 |
+
</td>
|
59 |
+
<td> </td>
|
60 |
+
<td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
|
61 |
+
<?php echo $order->getShippingDescription();?>
|
62 |
+
|
63 |
+
</td>
|
64 |
+
</tr>
|
65 |
+
</tbody>
|
66 |
+
</table>
|
67 |
+
<br/>
|
68 |
+
<?php echo $this->getChildHtml('connector_shipping_items');?>
|
69 |
+
<?php echo $this->getChildHtml('connector_shipping_track');?>
|
70 |
+
<p style="font-size:12px; margin:0 10px 10px 0"><?php echo $comment;?></p>
|
71 |
+
</td>
|
72 |
+
</tr>
|
73 |
+
</table>
|
74 |
+
</td>
|
75 |
+
</tr>
|
76 |
+
</table>
|
77 |
+
</div>
|
78 |
+
</body>
|
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php $order = $this->getOrder();
|
2 |
+
$billing = $order->getBillingAddress();
|
3 |
+
$shipping = $order->getShipmentsCollection()->getFirstItem();
|
4 |
+
$comment = $shipping->getCommentsCollection()->getFirstItem()->getComment();
|
5 |
+
$paymentBlock = Mage::helper('payment')->getInfoBlock($order->getPayment());
|
6 |
+
?>
|
7 |
+
<style>
|
8 |
+
<?php echo Mage::getStoreConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_TRANSACTIONAL_STYLING);?>
|
9 |
+
</style>
|
10 |
+
<body style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
|
11 |
+
<div style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
|
12 |
+
<table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%">
|
13 |
+
<tr>
|
14 |
+
<td align="center" valign="top" style="padding:20px 0 20px 0">
|
15 |
+
<!-- [ header starts here] -->
|
16 |
+
<table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
|
17 |
+
<!-- [ middle starts here] -->
|
18 |
+
<tr>
|
19 |
+
<td>
|
20 |
+
<h2 style="font-size:18px; font-weight:normal; margin:0;">Your Shipment #<?php echo $shipping->getIncrementId();?> for Order #<?php echo $order->getIncrementId();?></h2>
|
21 |
+
</td>
|
22 |
+
</tr>
|
23 |
+
<tr>
|
24 |
+
<td>
|
25 |
+
<table cellspacing="0" cellpadding="0" border="0" width="650">
|
26 |
+
<thead>
|
27 |
+
<tr>
|
28 |
+
<th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Billing Information:</th>
|
29 |
+
<th width="10"></th>
|
30 |
+
<th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Payment Method:</th>
|
31 |
+
</tr>
|
32 |
+
</thead>
|
33 |
+
<tbody>
|
34 |
+
<tr>
|
35 |
+
<td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
|
36 |
+
<?php echo $order->getBillingAddress()->format('html');?>
|
37 |
+
</td>
|
38 |
+
<td> </td>
|
39 |
+
<td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
|
40 |
+
<?php echo $paymentBlock->toHtml();?>
|
41 |
+
</td>
|
42 |
+
</tr>
|
43 |
+
</tbody>
|
44 |
+
</table>
|
45 |
+
<br/>
|
46 |
+
<table cellspacing="0" cellpadding="0" border="0" width="100%">
|
47 |
+
<thead>
|
48 |
+
<tr>
|
49 |
+
<th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Shipping Information:</th>
|
50 |
+
<th width="10"></th>
|
51 |
+
<th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Shipping Method:</th>
|
52 |
+
</tr>
|
53 |
+
</thead>
|
54 |
+
<tbody>
|
55 |
+
<tr>
|
56 |
+
<td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
|
57 |
+
<?php echo $order->getShippingAddress()->format('html');?>
|
58 |
+
|
59 |
+
</td>
|
60 |
+
<td> </td>
|
61 |
+
<td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
|
62 |
+
<?php echo $order->getShippingDescription();?>
|
63 |
+
|
64 |
+
</td>
|
65 |
+
</tr>
|
66 |
+
</tbody>
|
67 |
+
</table>
|
68 |
+
<br/>
|
69 |
+
<?php echo $this->getChildHtml('connector_shipping_items');?>
|
70 |
+
<?php echo $this->getChildHtml('connector_shpping_track');?>
|
71 |
+
<p style="font-size:12px; margin:0 10px 10px 0"><?php echo $comment;?></p>
|
72 |
+
</td>
|
73 |
+
</tr>
|
74 |
+
</table>
|
75 |
+
</td>
|
76 |
+
</tr>
|
77 |
+
</table>
|
78 |
+
</div>
|
79 |
+
</body>
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php $order = $this->getOrder();
|
2 |
+
$shipping = $order->getShipmentsCollection()->getFirstItem();
|
3 |
+
$comment = $shipping->getCommentsCollection()->getFirstItem()->getComment();
|
4 |
+
$paymentBlock = Mage::helper('payment')->getInfoBlock($order->getPayment());
|
5 |
+
?>
|
6 |
+
<style>
|
7 |
+
<?php echo Mage::getStoreConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_TRANSACTIONAL_STYLING);?>
|
8 |
+
</style>
|
9 |
+
<body style=" font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
|
10 |
+
<div style=" font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
|
11 |
+
<table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%">
|
12 |
+
<tr>
|
13 |
+
<td align="center" valign="top" style="padding:20px 0 20px 0">
|
14 |
+
<!-- [ header starts here] -->
|
15 |
+
<table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
|
16 |
+
<!-- [ middle starts here] -->
|
17 |
+
<tr>
|
18 |
+
<td valign="top">
|
19 |
+
<p style="font-size:12px; line-height:16px; margin:0 0 10px 0;">
|
20 |
+
Your order # <?php echo $order->getIncrementId();?> has been <br/>
|
21 |
+
<strong><?php echo $order->getStatusLabel();?></strong>.
|
22 |
+
</p>
|
23 |
+
<p style="font-size:12px; line-height:16px; margin:0 0 10px 0;">You can check the status of your order by <a href="<?php echo $this->getBaseUrl();?>customer/account/" style="color:#1E7EC8;">logging into your account</a>.</p>
|
24 |
+
<p style="font-size:12px; line-height:16px; margin:0 0 10px 0;"><?php echo $comment;?></p>
|
25 |
+
</td>
|
26 |
+
</tr>
|
27 |
+
</table>
|
28 |
+
</td>
|
29 |
+
</tr>
|
30 |
+
</table>
|
31 |
+
</div>
|
32 |
+
</body>
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php $order = $this->getOrder();
|
2 |
+
$billing = $order->getBillingAddress();
|
3 |
+
$shipping = $order->getShipmentsCollection()->getFirstItem();
|
4 |
+
$comment = $shipping->getCommentsCollection()->getFirstItem()->getComment();
|
5 |
+
$paymentBlock = Mage::helper('payment')->getInfoBlock($order->getPayment());
|
6 |
+
?>
|
7 |
+
<style>
|
8 |
+
<?php echo Mage::getStoreConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_TRANSACTIONAL_STYLING);?>
|
9 |
+
</style>
|
10 |
+
<body style=" font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
|
11 |
+
<div style=" font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
|
12 |
+
<table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%">
|
13 |
+
<tr>
|
14 |
+
<td align="center" valign="top" style="padding:20px 0 20px 0">
|
15 |
+
<!-- [ header starts here] -->
|
16 |
+
<table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
|
17 |
+
<!-- [ middle starts here] -->
|
18 |
+
<tr>
|
19 |
+
<td valign="top">
|
20 |
+
<p style="font-size:12px; line-height:16px; margin:0 0 10px 0;">
|
21 |
+
Your order # <?php echo $order->getIncrementId();?> has been <br/>
|
22 |
+
<strong><?php echo $order->getStatusLabel();?></strong>.
|
23 |
+
</p>
|
24 |
+
<p style="font-size:12px; line-height:16px; margin:0 0 10px 0;"><?php echo $comment;?></p>
|
25 |
+
</td>
|
26 |
+
</tr>
|
27 |
+
</table>
|
28 |
+
</td>
|
29 |
+
</tr>
|
30 |
+
</table>
|
31 |
+
</div>
|
32 |
+
</body>
|
@@ -1,4 +1,13 @@
|
|
1 |
<?php
|
2 |
-
if(Mage::
|
3 |
-
<script
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
<?php endif;?>
|
1 |
<?php
|
2 |
+
if(Mage::helper('connector')->getPageTrackingEnabled()) :?>
|
3 |
+
<script type="text/javascript">
|
4 |
+
(function(){
|
5 |
+
var connector = document.createElement('script');
|
6 |
+
connector.type = 'text/javascript';
|
7 |
+
connector.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 't.trackedlink.net/_dmpt.js';
|
8 |
+
var s = document.getElementsByTagName('script')[0];
|
9 |
+
s.parentNode.insertBefore(connector, s);
|
10 |
+
})();
|
11 |
+
</script>
|
12 |
+
|
13 |
<?php endif;?>
|
@@ -1 +1,14 @@
|
|
1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
2 |
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->getLang() ?>" lang="<?php echo $this->getLang() ?>">
|
3 |
+
<head>
|
4 |
+
</head>
|
5 |
+
<body>
|
6 |
+
<div class="main-container col1-layout">
|
7 |
+
<div class="main">
|
8 |
+
<div class="col-main">
|
9 |
+
<?php echo $this->getChildHtml('content') ?>
|
10 |
+
</div>
|
11 |
+
</div>
|
12 |
+
</div>
|
13 |
+
</body>
|
14 |
+
</html>
|
@@ -1,37 +0,0 @@
|
|
1 |
-
<?php $productCollection = $this->getRecommendedProducts();?>
|
2 |
-
|
3 |
-
|
4 |
-
<?php
|
5 |
-
$listMode = $this->getMode();
|
6 |
-
|
7 |
-
?>
|
8 |
-
|
9 |
-
<?php $i = 0;foreach ($productCollection as $key => $_product) :?>
|
10 |
-
<?php $_product = Mage::getModel('catalog/product')->load($_product->getEntityId());?>
|
11 |
-
<?php if($i == 0):?>
|
12 |
-
<table border="0" bordercolor="#FFCC00" width="147" cellpadding="0" cellspacing="0" style='font-family:arial; border-collapse: collapse; font-size:12;'><tr>
|
13 |
-
<?php endif;?>
|
14 |
-
<?php
|
15 |
-
//LIST MODE
|
16 |
-
if($listMode == 'list'){
|
17 |
-
echo '</tr><tr>';
|
18 |
-
}?>
|
19 |
-
|
20 |
-
<td style="vertical-align: text-top; padding-right: 2px;">
|
21 |
-
|
22 |
-
|
23 |
-
<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(135); ?>" width="140" height="135" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" align="middle" /></a>
|
24 |
-
|
25 |
-
<div align="center"><b><?php echo substr($_product->getName(), 0, 40);?></b></div>
|
26 |
-
|
27 |
-
<div align="center"><?php echo $this->getPriceHtml($_product, true);?></div>
|
28 |
-
<div align="center"><a href="<?php echo $_product->getProductUrl();?>">View Now</a></div>
|
29 |
-
</td>
|
30 |
-
|
31 |
-
<?php if($i++ % 4 ==3 && $listMode == 'grid') echo '</tr><tr>'?>
|
32 |
-
|
33 |
-
<?php endforeach;?>
|
34 |
-
|
35 |
-
</table>
|
36 |
-
|
37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -3,7 +3,7 @@
|
|
3 |
<modules>
|
4 |
<Dotdigitalgroup_Email>
|
5 |
<active>true</active>
|
6 |
-
<codePool>
|
7 |
</Dotdigitalgroup_Email>
|
8 |
</modules>
|
9 |
</config>
|
3 |
<modules>
|
4 |
<Dotdigitalgroup_Email>
|
5 |
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
</Dotdigitalgroup_Email>
|
8 |
</modules>
|
9 |
</config>
|
@@ -0,0 +1,165 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"EMAIL","EMAIL"
|
2 |
+
"API Credentials","API Credentials"
|
3 |
+
"Settings","Settings"
|
4 |
+
"Enabled", "Enabled"
|
5 |
+
"API Username","API Username"
|
6 |
+
"API Password","API Password"
|
7 |
+
"Sync Settings", "Sync Settings"
|
8 |
+
"Address Book Mapping", "Address Book Mapping"
|
9 |
+
"Add Customers To", "Add Customers To"
|
10 |
+
"Add Subscribers To", "Add Subscribers To"
|
11 |
+
"Add Guests To", "Add Guests To"
|
12 |
+
"Sync", "Sync"
|
13 |
+
"Contact Sync", "Contact Sync"
|
14 |
+
"Subscriber Sync", "Subscriber Sync"
|
15 |
+
"Order Sync", "Order Sync"
|
16 |
+
"Wishlist Sync", "Wishlist Sync"
|
17 |
+
"Create Address Book", "Create Address Book"
|
18 |
+
"Address Book Name", "Address Book Name"Data Mapping
|
19 |
+
"Create New Address Book", "Create New Address Book"
|
20 |
+
"Data Mapping","Data Mapping"
|
21 |
+
"Data Fields Mapping", "Data Fields Mapping"
|
22 |
+
"Customer Information","Customer Information"
|
23 |
+
"Title","Title"
|
24 |
+
"Customer ID", "Customer ID"
|
25 |
+
"First Name", "First Name"
|
26 |
+
"Last Name","Last Name"
|
27 |
+
"D.O.B.", "D.O.B."
|
28 |
+
"Gender","Gender"
|
29 |
+
"Website Created On","Website Created On"
|
30 |
+
"Store Created On","Store Created On"
|
31 |
+
"Account Created Date","Account Created Date"
|
32 |
+
"Last Logged In Date","Last Logged In Date"
|
33 |
+
"Customer Group","Customer Group"
|
34 |
+
"Address", "Address"
|
35 |
+
"Billing Address Line 1","Billing Address Line 1"
|
36 |
+
"Billing Address Line 2","Billing Address Line 2"
|
37 |
+
"Billing City","Billing City"
|
38 |
+
"Billing State/Region","Billing State/Region"
|
39 |
+
"Billing Country","Billing Country"
|
40 |
+
"Billing Zip/Postcode","Billing Zip/Postcode"
|
41 |
+
"Billing Telephone","Billing Telephone"
|
42 |
+
"Delivery Address Line 1","Delivery Address Line 1"
|
43 |
+
"Delivery Address Line 2","Delivery Address Line 2"
|
44 |
+
"Delivery City","Delivery City"
|
45 |
+
"Delivery State/Region","Delivery State/Region"
|
46 |
+
"Delivery Country","Delivery Country"
|
47 |
+
"Delivery Zip/Postcode","Delivery Zip/Postcode"
|
48 |
+
"Delivery Telephone","Delivery Telephone"
|
49 |
+
"Sales", "Sales"
|
50 |
+
"Total Number of Orders","Total Number of Orders"
|
51 |
+
"Average Order Value","Average Order Value"
|
52 |
+
"Total Spend","Total Spend"
|
53 |
+
"Last Purchase Date","Last Purchase Date"
|
54 |
+
"Last Order ID","Last Order ID"
|
55 |
+
"Customer", "Customer"
|
56 |
+
"Create Data Field", "Create Data Field"
|
57 |
+
"Validation Block", "Validation Block"
|
58 |
+
"Create Data Field", "Create Data Field"
|
59 |
+
"Data Field Name", "Data Field Name"
|
60 |
+
"Data Field Type", "Data Field Type"
|
61 |
+
"Create New Data Field", "Create New Data Field"
|
62 |
+
"ROI & Tracking","ROI & Tracking"
|
63 |
+
"Page Tracking","Page Tracking"
|
64 |
+
"ROI Tracking","ROI Tracking"
|
65 |
+
"Lost Baskets","Lost Baskets"
|
66 |
+
"Lost Basket 1","Lost Basket 1"
|
67 |
+
"Enabled/Disabled","Enabled/Disabled"
|
68 |
+
"Send After (min)","Send After (min)"
|
69 |
+
"Campaign To Send","Campaign To Send"
|
70 |
+
"Lost Basket 2","Lost Basket 2"
|
71 |
+
"Send After (hrs)","Send After (hrs)"
|
72 |
+
"Lost Basket 3","Lost Basket 3"
|
73 |
+
"Send After (hrs)","Send After (hrs)"
|
74 |
+
"Customers","Customers"
|
75 |
+
"Guests","Guests"
|
76 |
+
"SMS","SMS"
|
77 |
+
"SMS Message 1","SMS Message 1"
|
78 |
+
"Order Status","Order Status"Dynamic Content
|
79 |
+
"Message","Message"
|
80 |
+
"SMS Message 2","SMS Message 2"
|
81 |
+
"SMS Message 3","SMS Message 3"
|
82 |
+
"SMS Message 4","SMS Message 4"
|
83 |
+
"Sync Settings","Sync Settings"
|
84 |
+
"Customer Data and Subscribers Sync Schedule","Customer Data and Subscribers Sync Schedule"
|
85 |
+
"Start Time","Start Time"
|
86 |
+
"Frequency","Frequency"
|
87 |
+
"Suppressed Data Sync Schedule","Suppressed Data Sync Schedule"
|
88 |
+
"Use this button force the suppressed data synchronization to run now","Use this button force the suppressed data synchronization to run now"
|
89 |
+
"Transactional data settings","Transactional data settings"
|
90 |
+
"Order/Basket Information","Order/Basket Information"
|
91 |
+
"Wish List Information","Wish List Information"
|
92 |
+
"Data Field Mapping","Data Field Mapping"
|
93 |
+
"Address Information","Address Information"
|
94 |
+
"Validation Block","Validation Block"
|
95 |
+
"Address Book Mapping","Address Book Mapping"
|
96 |
+
"Add Customers To","Add Customers To"
|
97 |
+
"Add Subscribers To","Add Subscribers To"
|
98 |
+
"Add Guests To","Add Guests To"
|
99 |
+
"Dynamic Content","Dynamic Content"
|
100 |
+
"Related Products","Related Products"
|
101 |
+
"Display Type","Display Type"
|
102 |
+
"Items To Display","Items To Display"
|
103 |
+
"Up Sell Products","Up Sell Products"
|
104 |
+
"Cross Sell Products","Cross Sell Products"
|
105 |
+
"Best Sellers","Best Sellers"
|
106 |
+
"Time Period","Time Period"
|
107 |
+
"Most Viewed","Most Viewed"
|
108 |
+
"Recently Viewed","Recently Viewed"
|
109 |
+
"Manual Product Push","Manual Product Push"
|
110 |
+
"External Dynamic Content URL s", "External Dynamic Content URL s"
|
111 |
+
"Passcode","Passcode"
|
112 |
+
"Recommended: Set a passcode so that basket contents and coupon codes can only be viewed if the following passcode is sent with the request.","Recommended: Set a passcode so that basket contents and coupon codes can only be viewed if the following passcode is sent with the request."
|
113 |
+
"Baskets Content URL","Baskets Content URL"
|
114 |
+
"Coupon Codes","Coupon Codes"
|
115 |
+
"Coupon Codes URL","Coupon Codes URL"
|
116 |
+
"Product Recommendation", "Product Recommendation"
|
117 |
+
"Related Products URL","Related Products URL"
|
118 |
+
"Up-Sell Products URL","Up-Sell Products URL"
|
119 |
+
"Cross-Sell Products URL","Cross-Sell Products URL"
|
120 |
+
"Best Sellers URL","Best Sellers URL"
|
121 |
+
"Most Viewed URL","Most Viewed URL"
|
122 |
+
"Product Push URL","Product Push URL"
|
123 |
+
"Transactional Emails","Transactional Emails"
|
124 |
+
"New Order","New Order"
|
125 |
+
"New Order for Guest", "New Order for Guest"
|
126 |
+
"Order Update", "Order Update"
|
127 |
+
"Order Update for Guest", "Order Update for Guest"
|
128 |
+
"New Invoice", "New Invoice"
|
129 |
+
"New Invoice for Guest", "New Invoice for Guest"
|
130 |
+
"Invoice Update", "Invoice Update"
|
131 |
+
"Invoice Update for Guest", "Invoice Update for Guest"
|
132 |
+
"New Credit Memo", "New Credit Memo"
|
133 |
+
"New Credit Memo Guest", "New Credit Memo Guest"
|
134 |
+
"Credit Memo Update", "Credit Memo Update"
|
135 |
+
"Credit Memo Update for Guest", "Credit Memo Update for Guest"
|
136 |
+
"New Shipment", "New Shipment"
|
137 |
+
"New Shipment for Guest", "New Shipment for Guest"
|
138 |
+
"Shipment Update", "Shipment Update"
|
139 |
+
"Shipment Update for Guest", "Shipment Update for Guest"
|
140 |
+
"Manual Product Push", "Manual Product Push"
|
141 |
+
"Fallback Products", "Fallback Products"
|
142 |
+
"API", "API"
|
143 |
+
"Email Mapping", "Email Mapping"
|
144 |
+
"Advanced Settings","Advanced Settings"
|
145 |
+
"Transactional Sync Limit","Transactional Sync Limit"
|
146 |
+
"Transactional Data Import Limit Size", "Transactional Data Import Limit Size"
|
147 |
+
"ADVANCED", "ADVANCED"
|
148 |
+
"Automap Data Fields", "Automap Data Fields"
|
149 |
+
"Delete All Contact ID's","Delete All Contact ID's"
|
150 |
+
"Refresh Transactional Data", "Refresh Transactional Data"
|
151 |
+
"Refresh Subscribers", "Refresh Subscribers"
|
152 |
+
"Refresh Supressed Contacts", "Refresh Supressed Contacts"
|
153 |
+
"Customer Sync Memory Default", "Customer Sync Memory Default"
|
154 |
+
"Customer Sync Batch Size", "Customer Sync Batch Size"
|
155 |
+
"Debug Mode", "Debug Mode"
|
156 |
+
"Transactional Emails Styling", "Transactional Emails Styling"
|
157 |
+
"Styling entered here will apply to all dynamic content areas pulled from Magento for transactional emails.", "Styling entered here will apply to all dynamic content areas pulled from Magento for transactional emails."
|
158 |
+
"Dynamic Content Styling", "Dynamic Content Styling"
|
159 |
+
"Email Orders", "Email Orders"
|
160 |
+
"Dashboard", "Dashboard"
|
161 |
+
"Email Connector Orders", "Email Connector Orders"
|
162 |
+
"Email Campaigns", "Email Campaigns"
|
163 |
+
"Email Contacts", "Email Contacts"
|
164 |
+
|
165 |
+
|
@@ -1,18 +1,32 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>dotmailermagento</name>
|
4 |
-
<version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Integrate your ecommerce with dotMailer's powerful triggered email marketing and convert more visits to sales.</summary>
|
10 |
<description>Connector Integration for Magento, allows to manage and synchronise customer data and lost baskets.</description>
|
11 |
-
<notes>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
<authors><author><name>Calin Diacon</name><user>cdiacon</user><email>cdiacon@gmail.com</email></author></authors>
|
13 |
-
<date>
|
14 |
-
<time>
|
15 |
-
<contents><target name="magelocal"><dir name="Dotdigitalgroup"><dir name="Email"><dir name="Block"><dir name="Adminhtml"><dir name="System"><file name="Bestsellers.php" hash="3712d5b267bcb960ab61ea4c2f7780fd"/><dir name="Config"><file name="Gridlist.php" hash="4022c4af28efa8b521eae76da8781417"/><file name="Insertvariable.php" hash="16efa5b30d69f1a87ba73a39c30d526b"/><file name="Messagedefault.php" hash="316850603c3aba812e34955f4e6ea1ad"/><file name="Password.php" hash="3065946d4e092e6fe0d31cbb4b52edee"/><file name="Smsmessagefour.php" hash="6764248cd2dd0a1df8f8546ef581cefd"/><file name="Smsmessageone.php" hash="f99c4598125f337f5d02003e381466b0"/><file name="Smsmessagethree.php" hash="5deb67df50db7c640c7d8438cad05df6"/><file name="Smsmessagetwo.php" hash="ef33d2f8c780dba2fa71e3723192ed74"/><file name="Validator.php" hash="03288ddcb5cbf3234231d8af8f7723ff"/><file name="Waitingfield.php" hash="fb25e0d81a2067a2d8f6cabff4277f84"/><file name="Wrapper.php" hash="cf5319d175c585354c2d9ebfe30d41e6"/></dir><file name="Couponinfo.php" hash="ede44a34e922becad72a5b3c1c0fc633"/><file name="Crosssell.php" hash="e2f2f5436d3ea902cd40a03795d5e456"/><file name="Lostbasket.php" hash="923a64cb4759f3c1a6bac37437612a7c"/><file name="Mostviewed.php" hash="e6ecfc239e55d4f3781ae8d6e7da15ce"/><file name="Productpush.php" hash="9c243d149366577f47383935892f58d5"/><file name="Recentlyviewed.php" hash="2351cd33be3f670809a72774989b149a"/><file name="Related.php" hash="69a352f8d5c2b397f19cf2a3f1eac9d7"/><file name="Upsell.php" hash="20e8adb20d3bb7e31dfce13e616cd195"/></dir></dir><file name="Basket.php" hash="850034be56ab609ca8345781520148ae"/><file name="Coupon.php" hash="6aaec59401eb7a4602dcb29db9d8c03d"/><dir name="Debug"><file name="Countcontacts.php" hash="59d8d74a82aac88d3cb0f4ed9ffecfef"/><file name="Deletecontacts.php" hash="f2b3f787467ff337331e554117e48408"/><file name="Forcecustomersync.php" hash="d5738efb228c7ba430bf2156941b93a7"/><file name="Forcelostbasketsync.php" hash="f12e28f29b7e1c56edf6464b5af7ead4"/><file name="Forcesuppressedsync.php" hash="cfda0355fae3284853259f3f292dd742"/><file name="Initialsync.php" hash="118b2c178a22fa3cd2301d4d9bbec5f2"/><file name="Rescuenow.php" hash="f20a18a3fe2803c7d71924ec04bc4f50"/><file name="Testcredentials.php" hash="660ca7d025c51974bec5307518649506"/><file name="Transactionalsync.php" hash="7cce60182af6603fa0a082bf02752be8"/></dir><file name="Products.php" hash="091bd0a56391c7fc1b94e96e11ea636c"/></dir><dir name="Helper"><dir name="Api"><file name="DotNetExample.php" hash="cdefe297bf38b6c49ec0acdf9f43264a"/><file name="Restrequest.php" hash="dbd90bdcc12a90bcc875e6c88842e8be"/></dir><file name="Data.php" hash="042d65513fc63e89ff8093e5cb932ec1"/><file name="File.php" hash="7b13d5ce553d5c0442694a9ad2d46016"/><file name="Recommended.php" hash="e14f6657e3243816e8f7d4aae214499e"/></dir><dir name="Model"><dir name="Account"><file name="Test.php" hash="71095642bfae08183962007d59ef028c"/></dir><dir name="Api"><file name="Rest.php" hash="c91400b9e9d21cef977b95479752ad90"/></dir><dir name="Connector"><file name="Account.php" hash="b232ee04f222c3e61a6e6494d13a11b4"/><file name="Customer.php" hash="1f201b107ced31b9bad9b9884f8c4a28"/><file name="Order.php" hash="4baaed26cb6efb7de3dfdf8550acc6fe"/><file name="Quote.php" hash="74cb4c28351223c213889d00552712a7"/><file name="Wishlist.php" hash="7f02a04debb6d6a8971d5e696142b1c7"/></dir><file name="Cron.php" hash="23942f32f5cfeae44479fec3e4ca0294"/><dir name="Customer"><file name="Customer.php" hash="4b853783ed303a61dd5808f0fc368c3a"/><file name="Suppressed.php" hash="639382b91fe82328548429c5d7d48a7e"/><dir name="Wishlist"><file name="Item.php" hash="7087ac6edf465a88a5dd96af483459d9"/></dir></dir><dir name="Dynamic"><dir name="Product"><file name="Mapper.php" hash="63451cbd3d11523ba6d60f71a88d10f6"/></dir><file name="Recommended.php" hash="6588de609b5bc87ed1a51b25f7243858"/></dir><dir name="Newsletter"><file name="Subscriber.php" hash="aa06389101532308e6aa14da6cef2c99"/></dir><file name="Observer.php" hash="b3106c169860a62263e3aa92230f9f16"/><file name="Order.php" hash="df951471328bb27f35babb337e527851"/><dir name="Sales"><file name="Order.php" hash="2cb28b4a209825331ea01d6b45576d08"/><file name="Quote.php" hash="c97137d259868f7a44aaaa95e2130674"/><file name="Sms.php" hash="ea05d7b33f140fd308a60215fa5f7baa"/></dir><dir name="System"><dir name="Config"><dir name="Backend"><dir name="Syncschedule"><file name="Customer.php" hash="d421b5ac07c5bb71051edfda1cc4dcdb"/><file name="Suppressed.php" hash="6eb9b26bbac6c6ce86a7981a20f604ad"/></dir></dir><dir name="Source"><file name="Activebasket.php" hash="1ec34cf0f073f40c36f1918d4f38cbb0"/><file name="Addressbooks.php" hash="e482c8e6d64520eed38110005b6f44ea"/><file name="Campaigns.php" hash="221e817a4796d3754b6230f8e71a91e5"/><file name="Datafields.php" hash="e8d219b3170bf5e416bdf479874f0304"/><file name="Displayifnot.php" hash="175ec822880b9c21bdde7697e90da2d8"/><file name="Displaytype.php" hash="6025a5b7b08908819ec20263b0715b8b"/><file name="Gridview.php" hash="6c9a24e47167cabaa9c749670372e4ed"/><file name="Lostbasket.php" hash="02c5254bd7aeab58253f38e6ee401ee7"/><file name="Orderlimit.php" hash="db8cc03eb2259ce07900b5d2a45eedbc"/><file name="Orderstatus.php" hash="62446aebcb422acce53641412c0fd98f"/><file name="Sendcampain.php" hash="207c467eb35319e26437be126716fc72"/><file name="Syncfrequency.php" hash="19181d66a5688d6da78da9b8b0c639b0"/><file name="Timeperiod.php" hash="6f3d5907f6e6bdff3a6e0fae196fa78c"/></dir></dir></dir></dir><dir name="Test"><dir name="Model"><file name="Product.php" hash="590f024e6ae4a33044897004e81d5a33"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="DebugController.php" hash="0b58c42b842da871181f19ca97d69a13"/></dir><file name="EmailController.php" hash="af67b1470e5f33767d2fbf80c8d2725f"/></dir><dir name="etc"><file name="adminhtml.xml" hash="5f8fdbfa276d01622117b1a5a7ac4bf4"/><file name="config.xml" hash="10fd0f57b91292c12737b83b9244240c"/><file name="system.xml" hash="2ff93941b9d0336a602bbe410a377282"/></dir><dir name="sql"><dir name="connector_setup"><file name="mysql4-install-0.1.0.php" hash="c33e49225f3974f784f8b7b12f609102"/><file name="mysql4-upgrade-1.1.1-1.1.2.php" hash="7fae25a8ae47fe0ba692076ac04237a4"/></dir></dir></dir></dir><dir name="Varien"><dir name="Data"><file name="Collection.php" hash="a925107e95454d0e6609138b00f972aa"/></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="connector.xml" hash="d86fe05590ffbcbd4fe671da9cdb2979"/></dir><dir name="template"><dir name="connector"><file name="basket.phtml" hash="2dadd9e056a5a0267fb5a84e8d711fce"/><file name="coupon.phtml" hash="0e39fce43a6b3c4b45130996f1de90ff"/><file name="price.phtml" hash="3600de0d5573415628823b3d1f397cca"/><file name="roi_code.phtml" hash="72b38638e7105a4375cf22d662d67fab"/><file name="tracking_code.phtml" hash="4dcec68640a76074eced63d054a701eb"/></dir><dir name="page"><dir name="connector"><file name="products.phtml" hash="3c8bf292c14da73cd513498978323724"/></dir><file name="blank.phtml" hash="7bf34446254428a5c42740731127b435"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Dotdigitalgroup_Email.xml" hash="9b9b2dbb1f62fe025fe35da89171b658"/></dir></target></contents>
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>1.5.2</min><max>6.0.0</max></php><extension><name>curl</name><min>7.15.1</min><max>7.30.0</max></extension></required></dependencies>
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>dotmailermagento</name>
|
4 |
+
<version>3.0.3</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Integrate your ecommerce with dotMailer's powerful triggered email marketing and convert more visits to sales.</summary>
|
10 |
<description>Connector Integration for Magento, allows to manage and synchronise customer data and lost baskets.</description>
|
11 |
+
<notes>Transactional Emails, Custom Customer Attributes, Reports & More
|
12 |
+

|
13 |
+
This release includes some great new functionality as well as including a number of fixes. 
|
14 |
+

|
15 |
+
##IMPORTANT## Dynamic content URL's have been changed so will need updating within your dotMailer account to ensure they continue working correctly. ##IMPORTANT##
|
16 |
+

|
17 |
+
Release Highlights:
|
18 |
+

|
19 |
+
+ Transactional Emails: Replace the standard emails Magento currently sends to your customers and guests with beautifully created campaigns from dotMailer. Emails include new account, new order, dispatch, cancel and refund emails. **A dotMailer child account is required to enable this functionality**
|
20 |
+

|
21 |
+
+ Custom Customer Attributes: Sync your custom created customer attributes to dotMailer 
|
22 |
+

|
23 |
+
+ Dynamic Content Styling: Apply custom CSS to all dynamic content pages e.g. font size, colour and type.
|
24 |
+

|
25 |
+
+ Reporting: Now within the Newsletter section in Magento you can view the import status of contacts and orders, as well as the sending status of transactional and lost basket emails.</notes>
|
26 |
<authors><author><name>Calin Diacon</name><user>cdiacon</user><email>cdiacon@gmail.com</email></author></authors>
|
27 |
+
<date>2014-05-20</date>
|
28 |
+
<time>13:47:51</time>
|
29 |
+
<contents><target name="magecommunity"><dir name="Dotdigitalgroup"><dir name="Email"><dir name="Block"><dir name="Adminhtml"><dir name="Campaign"><dir name="Edit"><file name="Form.php" hash="cb6727ee8da34a45a919e5a1b1dafd71"/></dir><file name="Edit.php" hash="ea00b45a1b8c03e005c4e3c19928388b"/><file name="Grid.php" hash="d9995e055538c8d48460d7a16733a6fb"/></dir><file name="Campaign.php" hash="12c41a7a4d00248bb608c5d332ab2e4d"/><dir name="Column"><dir name="Renderer"><file name="Imported.php" hash="894d7ead94e40d20cabb082346830c35"/><file name="Status.php" hash="42180e34e981f2998c35697bf049c786"/><file name="Sync.php" hash="253fb9fbfc1c450e1ae8332b466896da"/></dir></dir><dir name="Config"><file name="Customdatafields.php" hash="325df1d7800c9dc526dd3ed0e4ba16b3"/><file name="Select.php" hash="b92091e08d7e24032be9b8aea033b81d"/></dir><dir name="Contact"><dir name="Edit"><file name="Form.php" hash="1d0f6eba1f3a59c38ccfc01b3d5eb447"/></dir><file name="Edit.php" hash="a3164fd5e1475a1f597d35f3e354a9c1"/><file name="Grid.php" hash="8289f633884baa40cee5822195be0935"/></dir><file name="Contact.php" hash="e41ec66bed61febcc29ab7a5fff8ac76"/><dir name="Dashboard"><file name="Content.php" hash="4c0fab042df22c79f9a0a0a82e4e374a"/></dir><file name="Dashboard.php" hash="6c975168f1a08bbcce79e3bd0ecc929e"/><dir name="Order"><file name="Grid.php" hash="7c67594f4276d5c8855157fbfba6b73a"/></dir><file name="Order.php" hash="68801d274beac26cc46bf3e423a3eae3"/><dir name="Sales"><dir name="Order"><dir name="Creditmemo"><file name="View.php" hash="ab9cfcc946e03f8b8fdf33d606222427"/></dir></dir></dir><dir name="System"><dir name="Advanced"><file name="Deletecontactids.php" hash="293320187b8ec5514ff69e027a808321"/><file name="Reimportorders.php" hash="d29f38c149d2fbfb6b8589491b050247"/><file name="Reimportsubscribers.php" hash="43b98ca37accc978ba8e9bd087b9a2c7"/><file name="Setupdatafields.php" hash="f3406708f27cf7252cb45422769f068c"/><file name="Suppressedcontacts.php" hash="d3de67d63549dd70254b46d13be6c13f"/></dir><file name="Ajaxvalidate.php" hash="2647705ecfcd6c1cd39489febd38b490"/><dir name="Automation"><file name="Connect.php" hash="13bfbd9a31e23e5d027fa3477f3e84ba"/></dir><dir name="Config"><file name="Addressbook.php" hash="6b567df5d80206980110fa1643b2afaf"/><file name="Datafield.php" hash="0948fe4a41d670f1f789dcb32a51f46d"/><file name="Validator.php" hash="6b4b6bfef131a16bd664e56f3a5e4eb3"/><file name="Waitingfield.php" hash="94b08f975511f5f21a9d7c6a68a4f6bc"/><file name="Wrapper.php" hash="817c3fbebbdf04da1d7e70bb0748475a"/></dir><dir name="Dynamic"><file name="Addressbookbutton.php" hash="744ca8346bf67fb7c7b96f92ad67e993"/><file name="Bestsellers.php" hash="4944eb7fdc54fc3755ffee85df35a75b"/><file name="Couponinfo.php" hash="bac5bd3d203a5fb3733c56273f36b4a0"/><file name="Creditmemonew.php" hash="69f8deb352c83e27b31a5be26f1c0d0f"/><file name="Crosssell.php" hash="eb09063882bf484e70e76c332adb1658"/><file name="Datafieldbutton.php" hash="369eec55df4d51ce367abb9c81402976"/><file name="Gridlist.php" hash="9329c6aa0ab3118b8f03af66761f038d"/><file name="Lostbasket.php" hash="baf7d19c324111be2bcb3c45d2266565"/><file name="Mostviewed.php" hash="49333b1f04256e3a4c82c6d057799d23"/><file name="Productpush.php" hash="8d67f3aa992d2697a96c9ec5d03ba3b4"/><file name="Recentlyviewed.php" hash="95988327553061c048133e96066844e6"/><file name="Related.php" hash="1d34a2443b5a722fce8f098c3d8f4d51"/><file name="Upsell.php" hash="82327c5bbb8fc0e305ad07b3ac989a17"/></dir><file name="Emailapivalidate.php" hash="6a7926b4e5360d3d14f644083627d725"/><dir name="Sms"><file name="Smsmessagefour.php" hash="8161a17bf68354db297a6d7eac192f91"/><file name="Smsmessageone.php" hash="d8219a305d9cd6890bf79b14be6bf9ec"/><file name="Smsmessagethree.php" hash="7d815bd44a4a383804c8dd65fb8a6b4c"/><file name="Smsmessagetwo.php" hash="6e122e407c50976a7ecd833058924a60"/></dir><dir name="Url"><file name="Creditmemoupdate.php" hash="8f6f5d302174050ede98df2e4007d981"/><file name="Creditmemoupdateguest.php" hash="20da8d74fcb6d68322f7292e0351edf7"/><file name="Customerconfirmation.php" hash="7293e71bbf8427dd4991daf6201dad15"/><file name="Customerconfirmed.php" hash="1c6cb13e6bbd97f469cacbe395e5e534"/><file name="Customernew.php" hash="c61fd3813fba91b4ba4ee3b6911e662f"/><file name="Invoiceupdate.php" hash="047e7202a63f5f8c7d9d7fcc01789dc9"/><file name="Invoiceupdateguest.php" hash="68b415a0a0163317fdf46eb979574996"/><file name="Newcreditmemo.php" hash="0f87238d184022220dad5dac49034de6"/><file name="Newcreditmemoguest.php" hash="faffe5af7771487e6b2a6a2d4098fbe1"/><file name="Newinvoice.php" hash="e0c6b3e59d6c34b0b93979fcc5a68385"/><file name="Newinvoiceguest.php" hash="81bd3651f0a7811c3fdaceb784aaa39a"/><file name="Neworder.php" hash="02e6829a0bc2368ccec5efb70a55385c"/><file name="Neworderguest.php" hash="937974004e210753b6d32c3e33a58612"/><file name="Newshipment.php" hash="c44225c3459b9d06928d4b5c3c8580c1"/><file name="Newshipmentguest.php" hash="14857342d0b7ed2d978b1d4bfe83a69a"/><file name="Orderupdate.php" hash="555305a69d49f0966128940e65183f51"/><file name="Orderupdateguest.php" hash="f96b9d658ccfefb7fad2c49224983599"/><file name="Shipmentupdate.php" hash="208244a77d67c783d0225e4c561a0880"/><file name="Shipmentupdateguest.php" hash="f473010098d9282cfee659ec37c355c9"/></dir></dir></dir><file name="Basket.php" hash="5464aead3d2c52cf02f7166abe3fc4e2"/><file name="Coupon.php" hash="e66fdb41d2b10af1973be58afdbec576"/><file name="Customer.php" hash="7b4380d05e581013b8ca7b6af3538b3a"/><dir name="Order"><file name="Creditmemo.php" hash="fc2f515076ac594e6381a509d9aa0f98"/><file name="Invoice.php" hash="1393bbc5fe10e1cc683cc5cab395a6e2"/><file name="Shipping.php" hash="a9a0b23a371a66ae0c6f753c19914ce7"/></dir><file name="Order.php" hash="5663032d302f4ce1b2426c2c510907a3"/><file name="Products.php" hash="d77b6f543a46be4f31b6445dac721e59"/><dir name="Recommended"><file name="Bestsellers.php" hash="261de553be7793cf9a4910eb6c7769a9"/><file name="Mostviewed.php" hash="ef8cb2142f064060461c2a1590fdc8f6"/><file name="Products.php" hash="4247729c54149a318ad21639a84195a0"/><file name="Push.php" hash="4fd68711fc571135e3a44af5da18f795"/><file name="Recentlyviewed.php" hash="17dfb21f06d8b9fec54e658ce1d50186"/></dir></dir><dir name="Helper"><file name="Config.php" hash="7dd8597dd45c48fd881db56f9bc579a3"/><file name="Data.php" hash="325d0798a97f665b6266973cd61ca664"/><file name="File.php" hash="761a39b86aa8476cee4b49beb47f38da"/><file name="Recommended.php" hash="67245b0d77ad70b5e7d1e5a87b8de321"/><file name="Transactional.php" hash="3fb6796f651734560bd3805990fe4ca4"/></dir><dir name="Model"><dir name="Abstract"><file name="Rest.php" hash="8f8d5b5421758388f4d7dec3565c934e"/></dir><dir name="Adminhtml"><file name="Observer.php" hash="7ebea0854c236756d33221f1a988823c"/><dir name="Source"><file name="Addressbooks.php" hash="e59fd02c730c2d317fb1407b6ec539ec"/><dir name="Advanced"><file name="Transdata.php" hash="5c670a26d641c4b7e73bbaff48af3dd6"/></dir><file name="Campaigns.php" hash="b80d263d8727c7e156063ec27ddded29"/><dir name="Contact"><file name="Imported.php" hash="e9b5446d35211c9c2bcadec603e8bee5"/></dir><dir name="Customer"><dir name="Attributes"><file name="Select.php" hash="2aae83760f525b9afd13a19d261b0a16"/></dir></dir><file name="Datafields.php" hash="fdff3dfc5caabc8d6179b19f9dd780d4"/><dir name="Datamapping"><file name="Datafieldtype.php" hash="642abde2d39cd2b289e4b6d67aa1a5c2"/></dir><dir name="Dynamic"><file name="Displaytype.php" hash="d5267e9b1a64bd5f42460f9cf1cfd1cf"/><file name="Gridview.php" hash="5f033792839adf57fb37b277dc662237"/></dir><dir name="Lostbaskets"><file name="Interval.php" hash="4ca624102855e0a5425a845505808c05"/><file name="Intervalminute.php" hash="ad895a4ab04e792de13901a85cb75abb"/></dir><dir name="Transactional"><file name="Campaigns.php" hash="8c59dae14fcd9e270172ad500ad85fd0"/></dir></dir></dir><dir name="Apiconnector"><file name="Client.php" hash="fdb7e5c94eaa3aa0c007dd650bcec240"/><file name="Contact.php" hash="42c41f1da248d50fc4ded18368a5ff9a"/><file name="Customer.php" hash="b428c0888b936080b727b26ef5a0e784"/><file name="Test.php" hash="a1fcb51bc5846d50c2b90ed73b8dd221"/></dir><file name="Campaign.php" hash="05d783b10946fc0ef99253b03b6c7387"/><dir name="Connector"><file name="Account.php" hash="c95d7d88fa42d2bed852f3b8ec4d3c33"/><file name="Campaign.php" hash="e221755bbbe55bcbd2bff9b260d645b1"/><file name="Datafield.php" hash="c312a122b7c3ea974807663db27c192b"/><file name="Order.php" hash="033782e25686b4c960784e4adc1a9c7b"/></dir><file name="Contact.php" hash="687d0a8a8e7a2d85dcf66b8ef5203c52"/><file name="Cron.php" hash="17fdbec9127d0a60598acec8f3f39ac8"/><dir name="Customer"><file name="Guest.php" hash="e7d697132a5ce8853a4acc91b6642d80"/><file name="Observer.php" hash="cf71e1a3aa4287cd5b53594e72226898"/><dir name="Wishlist"><file name="Item.php" hash="529aaa77458e472f623c39fba562d798"/></dir><file name="Wishlist.php" hash="06035bbe16ea92ce9fad2308ca97eda7"/></dir><dir name="Email"><dir name="Template"><file name="Mailer.php" hash="d5da6c553b4eb13633373e0785ffe7a4"/></dir><file name="Template.php" hash="51eeb527869674d045bc9bddfb148030"/></dir><dir name="Newsletter"><file name="Observer.php" hash="a4cfc7973dcd1719b701a50dddf4117f"/><file name="Subscriber.php" hash="a9aa8ffe01deeca94f928b46fc992155"/></dir><file name="Order.php" hash="7aec7c2a3053df85c793795196f2c772"/><dir name="Resource"><dir name="Campaign"><file name="Collection.php" hash="b215048b45b4bd1713d9205c8ed38034"/></dir><file name="Campaign.php" hash="c032f2c8a1840d584881febced7c9e24"/><dir name="Contact"><file name="Collection.php" hash="2269fd4bbc3cd47905ed679ff4433cc5"/></dir><file name="Contact.php" hash="bef4367609eb8bd414e857bc473d0199"/><dir name="Order"><file name="Collection.php" hash="53921ec74c81f19fef53e836f826301d"/></dir><file name="Order.php" hash="44443900470f7e0d45170e17558d71dc"/><file name="Setup.php" hash="442dda9eabbd1fb6e88e7d2baaa2a28c"/></dir><dir name="Sales"><file name="Observer.php" hash="a1c36bfdbd35a50240c2950dcbb99a8f"/><file name="Order.php" hash="a31b7d2d51d6a59c8fdc0734cca438f6"/><file name="Quote.php" hash="7357f8dfdd0b95fd9b9c528b1849588e"/></dir><dir name="Sms"><file name="Campaign.php" hash="f0cec33c439034dbff53c0737f0d5f4a"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="ConnectorController.php" hash="8ab77b675fd4b54acfa721c7de9454a3"/><dir name="Email"><file name="AutomationController.php" hash="df7013dab09442ff39defb37602125bd"/><file name="CampaignController.php" hash="7706e298ce46e77567263b46b57958a9"/><file name="ContactController.php" hash="a197c4f81b01e169d03de0be3ae13ebe"/><file name="DashboardController.php" hash="838062d5418b222236d7e26b15073c75"/><file name="OrderController.php" hash="ccf62d6ff54433db335694138af6c2bc"/></dir></dir><file name="CreditmemoController.php" hash="cac68808e6c517978adede211c4f02f3"/><file name="CustomerController.php" hash="2c598f0f23264946a398ba50a83525f9"/><file name="EmailController.php" hash="1f9a3ce4abe9c4d9cd038a3e52eafeab"/><file name="InvoiceController.php" hash="b787d295b3680fdaa674647cc09a0cc5"/><file name="OrderController.php" hash="aadc8cac4d612024bba5511878fa8fc0"/><file name="ProductsController.php" hash="059d5c8886931e731aa31545e217c76b"/><file name="ReportController.php" hash="3249038253df3bc3bffaadacfe6130d0"/><file name="ShippingController.php" hash="41fec07e2d72baf66f9f48cda8de5a75"/></dir><dir name="etc"><file name="adminhtml.xml" hash="f22c21e8b32cceb906476b5be3c9da33"/><file name="config.xml" hash="230edb979059ddc028f9ac5b96793020"/><file name="system.xml" hash="a8e194f945fe3d528a4c448a9f259881"/></dir><dir name="sql"><dir name="email_connector_setup"><file name="mysql4-install-0.1.0.php" hash="bb1b5e52152e2f111d852c1649b7d1d9"/><file name="mysql4-install-3.0.0.php" hash="385a2d7427baf260360dbb3a53c92eb8"/><file name="mysql4-upgrade-1.1.1-1.1.2.php" hash="7fae25a8ae47fe0ba692076ac04237a4"/><file name="mysql4-upgrade-1.1.2-1.5.0.php" hash="34ac896f6e681c56d8d2dd6bf411215e"/><file name="mysql4-upgrade-1.5.0-2.0.0.php" hash="75020a02255ea63e9bc4599d85ab4e2f"/><file name="mysql4-upgrade-2.0.0-2.0.1.php" hash="2f71a10d19eddd97c9eba9af840e4f09"/><file name="mysql4-upgrade-2.0.1-2.0.2.php" hash="6b7af944ebc76328d16223cdb245c568"/><file name="mysql4-upgrade-2.0.3-2.0.4.php" hash="d71788287371f0f5416f81e03245d281"/><file name="mysql4-upgrade-2.0.4-2.0.5.php" hash="f2080852fd1e0512da9bf1074767a9b3"/><file name="mysql4-upgrade-2.0.5-2.0.6.php" hash="438ea31fe7b8ed88160ae8c231ec9ccc"/><file name="mysql4-upgrade-3.0.1-3.0.2.php" hash="7c53b291487987ae73929acea576bc51"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="connector"><file name="basket.phtml" hash="f09ad8c5084114f7756c6f325674bd02"/><file name="coupon.phtml" hash="0e39fce43a6b3c4b45130996f1de90ff"/><dir><dir name="creditmemo"><file name="items.phtml" hash="e911de4e7f2717698e4041c7046ed5a5"/><file name="new.phtml" hash="5589a265ebc3b0ffab4285215808138c"/><file name="newguest.phtml" hash="b3099cea7baf66070d2063dbb27d2053"/><file name="update.phtml" hash="440f6fc8e4bfbbe8e0a8319d93c7bdbb"/><file name="updateguest.phtml" hash="48645cffd4bc7529621b8b2506185e3a"/></dir><dir name="invoice"><file name="new.phtml" hash="1192c608d82df66d646d99d310313a62"/><file name="newguest.phtml" hash="df98e57abe15e091e9270e403ccf727d"/><file name="update.phtml" hash="687e00b25885f032b8e3e4ab1e5a781b"/><file name="updateguest.phtml" hash="3d8328e8a9acbf8cf524a5bcdfa24947"/></dir><dir name="order"><file name="items.phtml" hash="9d149cbb8fe1e4c2736c6d77323abfc0"/><file name="new.phtml" hash="af976c073e42e371fb8ff0a99fa93b16"/><file name="newguest.phtml" hash="e5d85683a8c471dd00da1c8b72baa1fb"/><file name="update.phtml" hash="41111f0d68a5e8a231201c0475b442e8"/><file name="updateguest.phtml" hash="ee4cef5f27e8018ef6cf553ccffe8ff7"/></dir><dir name="product"><file name="list.phtml" hash="2009ad2820e112121a38396d898a2368"/><file name="price.phtml" hash="3600de0d5573415628823b3d1f397cca"/></dir><dir name="shipping"><file name="new.phtml" hash="20d0ff879f62695b9f7dca28fa0b581e"/><file name="newguest.phtml" hash="30dcf6965428f51e62cff18df22b4078"/><file name="update.phtml" hash="0935d641ab711f58c93f3b889ed72a75"/><file name="updateguest.phtml" hash="a087f227d6ece5acbed9a86ca438eef8"/></dir></dir><file name="customer.phtml" hash="c3b19b1e5b573260d07950ceb8cbd7a5"/><file name="roi_code.phtml" hash="f6653803fb7d6a6de9e8ed7a93c7c286"/><file name="tracking_code.phtml" hash="1d1e37deacdfec841fe1f9dd7a88864e"/></dir><dir name="page"><file name="blank.phtml" hash="7a10ef1534ebe3b449cf051799e5a066"/></dir></dir><dir name="layout"><file name="connector.xml" hash="0a988b43214bf4ba65f4e448bb4ffa1b"/></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="connector"><dir><dir name="dashboard"><file name="accountbar.phtml" hash="fc130aeddfcb28c7edb6d53fd586cf5f"/><file name="content.phtml" hash="25120cbe22253e3580ed483f75163092"/><file name="switcher.phtml" hash="533b49243f54ceff40e280f8035e1cf8"/></dir><dir name="system"><dir name="config"><file name="createdatafield.phtml" hash="a1a571fa0957d7fadf346d1b89c5a0b0"/></dir></dir></dir><file name="grid.phtml" hash="5a77ad901db663f865fa51fcf1ba81d0"/></dir></dir><dir name="layout"><dir name="connector"><file name="email.xml" hash="3464ceddd2a775592e633647df6c8a3a"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Dotdigitalgroup_Email.xml" hash="8745c0b2eae08783b6203a613acdbcb8"/></dir></target><target name="magelocale"><dir name="en_US"><file name="Dotdigitalgroup_Email.csv" hash="67022e746e28d74b86509b70f336db4f"/></dir></target></contents>
|
30 |
<compatible/>
|
31 |
<dependencies><required><php><min>1.5.2</min><max>6.0.0</max></php><extension><name>curl</name><min>7.15.1</min><max>7.30.0</max></extension></required></dependencies>
|
32 |
</package>
|