Version Notes
Initial Release
Download this release
Release Info
Developer | Michael A. Smith |
Extension | eBay_Enterprise_Display_Extension |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- app/code/community/EbayEnterprise/Display/Block/Adminhtml/System/Config/Form/Field/Feedurl.php +24 -0
- app/code/community/EbayEnterprise/Display/Block/Beacon.php +172 -0
- app/code/community/EbayEnterprise/Display/Helper/Config.php +87 -0
- app/code/community/EbayEnterprise/Display/Helper/Data.php +43 -0
- app/code/community/EbayEnterprise/Display/Model/Adminhtml/System/Config/Backend/Feedurl.php +21 -0
- app/code/community/EbayEnterprise/Display/Model/Adminhtml/System/Config/Backend/Siteidchecksum.php +63 -0
- app/code/community/EbayEnterprise/Display/Model/Email.php +75 -0
- app/code/community/EbayEnterprise/Display/Model/Error/Exception.php +4 -0
- app/code/community/EbayEnterprise/Display/Model/Products.php +129 -0
- app/code/community/EbayEnterprise/Display/controllers/IndexController.php +51 -0
- app/code/community/EbayEnterprise/Display/etc/adminhtml.xml +23 -0
- app/code/community/EbayEnterprise/Display/etc/config.xml +108 -0
- app/code/community/EbayEnterprise/Display/etc/system.xml +74 -0
- app/code/community/EbayEnterprise/Display/sql/eemsdisplay_setup/install-1.0.0.0.php +4 -0
- app/design/frontend/base/default/layout/eems_display.xml +39 -0
- app/design/frontend/base/default/template/eems_display/beacon.phtml +16 -0
- app/etc/modules/EbayEnterprise_Display.xml +9 -0
- app/locale/en_US/template/email/eemsdisplay_installed.html +9 -0
- package.xml +43 -0
app/code/community/EbayEnterprise/Display/Block/Adminhtml/System/Config/Form/Field/Feedurl.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This class is block (but is specified as a 'frontend_model' it the config.xml)
|
4 |
+
* which effectively overrides lib/Varien/Data/Form/Element/Textarea.php so that we
|
5 |
+
* can special case what we wish to display.
|
6 |
+
*
|
7 |
+
* Consult Varien_Data_Form_Element_Abstract for other methods available in the '$element'
|
8 |
+
*/
|
9 |
+
class EbayEnterprise_Display_Block_Adminhtml_System_Config_Form_Field_Feedurl
|
10 |
+
extends Mage_Adminhtml_Block_System_Config_Form_Field
|
11 |
+
{
|
12 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
13 |
+
{
|
14 |
+
$element->addClass('link');
|
15 |
+
$id = $element->getHtmlId();
|
16 |
+
|
17 |
+
// If there's an inherited checkbox; hide it. This is a read-only property, and the checkbox is superfluous
|
18 |
+
$inheritedCheckbox = $id . '_inherit';
|
19 |
+
$hideCheckboxJs = 'if ($("' . $inheritedCheckbox . '") != undefined ){$("' . $inheritedCheckbox . '").hide();}';
|
20 |
+
$html = sprintf('<a id="%s" name="%s" onClick="return false;" href="#">%s</a>', $id, $element->getName(), $element->getEscapedValue());
|
21 |
+
$html .= Mage::helper('core/js')->getScript('document.observe("dom:loaded", function() {' . $hideCheckboxJs . '});');
|
22 |
+
return $html;
|
23 |
+
}
|
24 |
+
}
|
app/code/community/EbayEnterprise/Display/Block/Beacon.php
ADDED
@@ -0,0 +1,172 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class EbayEnterprise_Display_Block_Beacon extends Mage_Core_Block_Template
|
3 |
+
{
|
4 |
+
protected $_order; // The order
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Get the last order.
|
8 |
+
* @return Mage_Sales_Model_Order
|
9 |
+
*/
|
10 |
+
protected function _getOrder()
|
11 |
+
{
|
12 |
+
if (!($this->_order instanceof Mage_Sales_Model_Order)) {
|
13 |
+
$orderId = Mage::getSingleton('checkout/session')->getLastOrderId();
|
14 |
+
if ($orderId) {
|
15 |
+
$this->_order = Mage::getModel('sales/order')->load($orderId);
|
16 |
+
}
|
17 |
+
}
|
18 |
+
return $this->_order;
|
19 |
+
}
|
20 |
+
/**
|
21 |
+
* Get the current customer quote
|
22 |
+
* @return Mage_Sales_Model_Quote
|
23 |
+
*/
|
24 |
+
protected function _getQuote()
|
25 |
+
{
|
26 |
+
if (!($this->_quote instanceof Mage_Sales_Model_Quote)) {
|
27 |
+
$this->_quote = Mage::getSingleton('checkout/session')->getQuote();
|
28 |
+
}
|
29 |
+
return $this->_quote;
|
30 |
+
}
|
31 |
+
/**
|
32 |
+
* Load a Quote object from an Order object
|
33 |
+
* @param Mage_Sales_Model_Order $order
|
34 |
+
* @return Mage_Sales_Model_Quote
|
35 |
+
*/
|
36 |
+
protected function _getQuoteFromOrder($order)
|
37 |
+
{
|
38 |
+
if (!($this->_quote instanceof Mage_Sales_Model_Quote)) {
|
39 |
+
$this->_quote = Mage::getModel('sales/quote')->load($order->getQuoteId());
|
40 |
+
}
|
41 |
+
return $this->_quote;
|
42 |
+
}
|
43 |
+
/**
|
44 |
+
* Get the current request scheme
|
45 |
+
* @return string
|
46 |
+
*/
|
47 |
+
protected function _getRequestScheme()
|
48 |
+
{
|
49 |
+
return Mage::app()->getRequest()->getScheme();
|
50 |
+
}
|
51 |
+
/**
|
52 |
+
* Determine which type of page the user is on
|
53 |
+
* default, home, product, checkout thanks
|
54 |
+
*
|
55 |
+
* @return string
|
56 |
+
*/
|
57 |
+
public function getPageType()
|
58 |
+
{
|
59 |
+
if ($this->hasData('page_type')) {
|
60 |
+
return $this->getData('page_type');
|
61 |
+
} else {
|
62 |
+
return 'default';
|
63 |
+
}
|
64 |
+
}
|
65 |
+
/**
|
66 |
+
* Get Fetchback beacon params based on the page type
|
67 |
+
*/
|
68 |
+
protected function _getParamsByPageType()
|
69 |
+
{
|
70 |
+
$pageType = $this->getPageType();
|
71 |
+
switch ($pageType) {
|
72 |
+
case 'product':
|
73 |
+
return $this->_getProductParams();
|
74 |
+
case 'cart':
|
75 |
+
return $this->_getCartParams();
|
76 |
+
case 'checkout_success':
|
77 |
+
return $this->_getCheckoutSuccessParams();
|
78 |
+
default:
|
79 |
+
return $this->_getDefaultParams();
|
80 |
+
}
|
81 |
+
}
|
82 |
+
/**
|
83 |
+
* Default params for beacon on all pages
|
84 |
+
*/
|
85 |
+
protected function _getDefaultParams()
|
86 |
+
{
|
87 |
+
return array(
|
88 |
+
'cat' => '',
|
89 |
+
'sid' => $this->helper('eems_display/config')->getSiteId(Mage::app()->getStore()->getId()),
|
90 |
+
'name' => 'landing',
|
91 |
+
);
|
92 |
+
}
|
93 |
+
/**
|
94 |
+
* Get the params for product page
|
95 |
+
* @return array
|
96 |
+
*/
|
97 |
+
protected function _getProductParams()
|
98 |
+
{
|
99 |
+
$currentProductId = (int) $this->getRequest()->getParam('id');
|
100 |
+
$mageProduct = Mage::getModel('catalog/product')->load($currentProductId);
|
101 |
+
return array_merge($this->_getDefaultParams(), array(
|
102 |
+
'name' => 'landing',
|
103 |
+
'browse_products' => $mageProduct->getSku(),
|
104 |
+
));
|
105 |
+
}
|
106 |
+
/**
|
107 |
+
* Get the params for cart page
|
108 |
+
* @return array
|
109 |
+
*/
|
110 |
+
protected function _getCartParams()
|
111 |
+
{
|
112 |
+
$quote = $this->_getQuote();
|
113 |
+
$params = $this->_getDefaultParams();
|
114 |
+
if ($quote instanceof Mage_Sales_Model_Quote) {
|
115 |
+
$cartedProducts = array_reduce($quote->getAllVisibleItems(), array($this, '_pidListFromCollection'));
|
116 |
+
$params = array_merge($params, array(
|
117 |
+
'abandon_products' => $cartedProducts,
|
118 |
+
));
|
119 |
+
}
|
120 |
+
return $params;
|
121 |
+
}
|
122 |
+
/**
|
123 |
+
* Get the params for checkout thanks page
|
124 |
+
* @return array
|
125 |
+
*/
|
126 |
+
protected function _getCheckoutSuccessParams()
|
127 |
+
{
|
128 |
+
$params = $this->_getDefaultParams();
|
129 |
+
$order = $this->_getOrder();
|
130 |
+
if ($order instanceof Mage_Sales_Model_Order) {
|
131 |
+
$quote = $this->_getQuoteFromOrder($order);
|
132 |
+
$orderTotal = $quote->getSubtotalWithDiscount();
|
133 |
+
$purchasedProducts = array_reduce($order->getAllVisibleItems(), array($this, '_pidListFromCollection'));
|
134 |
+
$params = array_merge($params, array(
|
135 |
+
'name' => 'success',
|
136 |
+
'purchase_products' => $purchasedProducts,
|
137 |
+
'crv' => $orderTotal,
|
138 |
+
'oid' => $order->getIncrementId(),
|
139 |
+
));
|
140 |
+
}
|
141 |
+
return $params;
|
142 |
+
}
|
143 |
+
/**
|
144 |
+
* array_reduce callback to get comma separated list of product ids
|
145 |
+
* @param string $result
|
146 |
+
* @param Mage_Sales_Model_Quote_Item|Mage_Sales_Model_Order_Item $item
|
147 |
+
* @return string
|
148 |
+
*/
|
149 |
+
protected function _pidListFromCollection($result, $item)
|
150 |
+
{
|
151 |
+
$productId = $item->getSku();
|
152 |
+
$result .= (empty($result) ? '' : ',') . $productId;
|
153 |
+
return $result;
|
154 |
+
}
|
155 |
+
/**
|
156 |
+
* Get the beacon url.
|
157 |
+
* @return String
|
158 |
+
*/
|
159 |
+
public function getBeaconUrl()
|
160 |
+
{
|
161 |
+
$params = $this->_getParamsByPageType();
|
162 |
+
$url = $this->_getRequestScheme() . '://pixel.fetchback.com/serve/fb/pdj?' . http_build_query($params);
|
163 |
+
return $url;
|
164 |
+
}
|
165 |
+
/**
|
166 |
+
* Whether or not to display the beacon.
|
167 |
+
*/
|
168 |
+
public function showBeacon()
|
169 |
+
{
|
170 |
+
return Mage::helper('eems_display/config')->getIsEnabled(Mage::app()->getStore()->getId());
|
171 |
+
}
|
172 |
+
}
|
app/code/community/EbayEnterprise/Display/Helper/Config.php
ADDED
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @codeCoverageIgnore
|
4 |
+
*/
|
5 |
+
class EbayEnterprise_Display_Helper_Config extends Mage_Core_Helper_Abstract
|
6 |
+
{
|
7 |
+
const EEMS_DISPLAY_ENABLED_PATH = 'marketing_solutions/eems_display/enabled';
|
8 |
+
const EEMS_DISPLAY_FEED_FILE_PATH = 'marketing_solutions/eems_display/feed/file_path';
|
9 |
+
const EEMS_DISPLAY_FEED_IMAGE_HEIGHT_PATH = 'marketing_solutions/eems_display/feed/image/height';
|
10 |
+
const EEMS_DISPLAY_FEED_IMAGE_WIDTH_PATH = 'marketing_solutions/eems_display/feed/image/width';
|
11 |
+
const EEMS_DISPLAY_FEED_IMAGE_KEEP_ASPECT_RATIO_PATH = 'marketing_solutions/eems_display/feed/image/keep_aspect_ratio';
|
12 |
+
const EEMS_DISPLAY_PRODUCT_FEED_FRONTNAME_PATH = 'frontend/routers/eems_display/args/frontName';
|
13 |
+
const EEMS_DISPLAY_SITE_ID_PATH = 'marketing_solutions/eems_display/site_id';
|
14 |
+
const EEMS_DISPLAY_SITE_ID_CHECKSUM_PATH = 'marketing_solutions/eems_display/site_id_checksum';
|
15 |
+
/**
|
16 |
+
* Get whether or not this extension is enabled.
|
17 |
+
* @return boolean
|
18 |
+
*/
|
19 |
+
public function getIsEnabled($storeId)
|
20 |
+
{
|
21 |
+
$siteIsEnabled = Mage::getStoreConfigFlag(self::EEMS_DISPLAY_ENABLED_PATH, $storeId);
|
22 |
+
list(, $siteId) = Mage::helper('eems_display')->splitSiteIdChecksumField(
|
23 |
+
Mage::getStoreConfig(self::EEMS_DISPLAY_SITE_ID_CHECKSUM_PATH, $storeId)
|
24 |
+
);
|
25 |
+
return $siteIsEnabled && $this->getSiteId($storeId) === $siteId;
|
26 |
+
}
|
27 |
+
/**
|
28 |
+
* Get the SiteId from admin configuration.
|
29 |
+
* @return string
|
30 |
+
*/
|
31 |
+
public function getSiteId($storeId)
|
32 |
+
{
|
33 |
+
return Mage::getStoreConfig(self::EEMS_DISPLAY_SITE_ID_PATH, $storeId);
|
34 |
+
}
|
35 |
+
/**
|
36 |
+
* The Feed File path, files are created here and served from here. Path is created if it
|
37 |
+
* does not exist. Throws error if we can't create it, or we can't write it.
|
38 |
+
* @throws EbayEnterprise_Display_Model_Error_Exception
|
39 |
+
* @return type
|
40 |
+
*/
|
41 |
+
public function getFeedFilePath()
|
42 |
+
{
|
43 |
+
$path = Mage::getBaseDir('var') . DS . Mage::getStoreConfig(self::EEMS_DISPLAY_FEED_FILE_PATH);
|
44 |
+
if (!file_exists($path) && !@mkdir($path, 0700, true)) { // Recursively create full feed file path
|
45 |
+
throw new EbayEnterprise_Display_Model_Error_Exception('Cannot create specified path: ' . $path);
|
46 |
+
}
|
47 |
+
if (!is_dir($path)) {
|
48 |
+
throw new EbayEnterprise_Display_Model_Error_Exception('Specified path is not a directory: ' . $path);
|
49 |
+
}
|
50 |
+
if (!is_writable($path)) {
|
51 |
+
throw new EbayEnterprise_Display_Model_Error_Exception('Specified path is not writeable: ' . $path);
|
52 |
+
}
|
53 |
+
return $path;
|
54 |
+
}
|
55 |
+
/**
|
56 |
+
* Gets the frontName of the router for the Display feed controller
|
57 |
+
* @return string
|
58 |
+
*/
|
59 |
+
public function getProductFeedFrontName()
|
60 |
+
{
|
61 |
+
return Mage::getConfig()->getNode(self::EEMS_DISPLAY_PRODUCT_FEED_FRONTNAME_PATH);
|
62 |
+
}
|
63 |
+
/**
|
64 |
+
* Gets the height configuration for feed images
|
65 |
+
* @return int
|
66 |
+
*/
|
67 |
+
public function getFeedImageHeight($storeId)
|
68 |
+
{
|
69 |
+
return (int) Mage::getStoreConfig(self::EEMS_DISPLAY_FEED_IMAGE_HEIGHT_PATH, $storeId);
|
70 |
+
}
|
71 |
+
/**
|
72 |
+
* Get the width configuration for feed images
|
73 |
+
* @return int
|
74 |
+
*/
|
75 |
+
public function getFeedImageWidth($storeId)
|
76 |
+
{
|
77 |
+
return (int) Mage::getStoreConfig(self::EEMS_DISPLAY_FEED_IMAGE_WIDTH_PATH, $storeId);
|
78 |
+
}
|
79 |
+
/**
|
80 |
+
* Get the flag whether to keep aspect ratio
|
81 |
+
* @return boolean
|
82 |
+
*/
|
83 |
+
public function getFeedImageKeepAspectRatio($storeId)
|
84 |
+
{
|
85 |
+
return (bool) Mage::getStoreConfig(self::EEMS_DISPLAY_FEED_IMAGE_KEEP_ASPECT_RATIO_PATH, $storeId);
|
86 |
+
}
|
87 |
+
}
|
app/code/community/EbayEnterprise/Display/Helper/Data.php
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class EbayEnterprise_Display_Helper_Data extends Mage_Core_Helper_Abstract
|
3 |
+
{
|
4 |
+
const EEMS_DISPLAY_PRODUCT_FEED_ROUTE = '/index/retrieve?id=';
|
5 |
+
/**
|
6 |
+
* Gets the fully formed URL of the Product feed for this storeId.
|
7 |
+
* @return string uri for feed for this store
|
8 |
+
*/
|
9 |
+
public function getProductFeedUrl($storeId)
|
10 |
+
{
|
11 |
+
return Mage::app()->getStore($storeId)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK) .
|
12 |
+
Mage::helper('eems_display/config')->getProductFeedFrontName() . self::EEMS_DISPLAY_PRODUCT_FEED_ROUTE . $storeId;
|
13 |
+
}
|
14 |
+
/**
|
15 |
+
* Find the closest default store id for the current admin scope.
|
16 |
+
* @return string
|
17 |
+
*/
|
18 |
+
public function getStoreIdForCurrentAdminScope()
|
19 |
+
{
|
20 |
+
$storeCode = Mage::app()->getRequest()->getParam('store');
|
21 |
+
if (!empty($storeCode)) {
|
22 |
+
return Mage::getModel('core/store')->load($storeCode)->getId();
|
23 |
+
}
|
24 |
+
$websiteCode = Mage::app()->getRequest()->getParam('website');
|
25 |
+
if (empty($websiteCode)) {
|
26 |
+
return Mage::app()->getDefaultStoreView()->getId();
|
27 |
+
}
|
28 |
+
$websiteId = Mage::getModel('core/website')->load($websiteCode)->getId();
|
29 |
+
return Mage::app()->getWebsite($websiteId)->getDefaultStore()->getId();
|
30 |
+
}
|
31 |
+
/**
|
32 |
+
* Split site id checksum field.
|
33 |
+
* Element 0 holds the hash, Element 1 holds the original site id used to generate it.
|
34 |
+
*/
|
35 |
+
public function splitSiteIdChecksumField($field)
|
36 |
+
{
|
37 |
+
$sep = EbayEnterprise_Display_Model_Adminhtml_System_Config_Backend_Siteidchecksum::FIELD_SEP;
|
38 |
+
if (strpos($field, $sep) === false) {
|
39 |
+
return array('','');
|
40 |
+
}
|
41 |
+
return preg_split("/$sep/", $field);
|
42 |
+
}
|
43 |
+
}
|
app/code/community/EbayEnterprise/Display/Model/Adminhtml/System/Config/Backend/Feedurl.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class EbayEnterprise_Display_Model_Adminhtml_System_Config_Backend_Feedurl
|
3 |
+
extends Mage_Core_Model_Config_Data
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Take the current configuration view and append the Display Feed frontName
|
7 |
+
* to present a complete route
|
8 |
+
*/
|
9 |
+
protected function _afterLoad()
|
10 |
+
{
|
11 |
+
parent::_afterLoad();
|
12 |
+
$storeId = Mage::helper('eems_display')->getStoreIdForCurrentAdminScope();
|
13 |
+
$siteId = Mage::helper('eems_display/config')->getSiteId($storeId);
|
14 |
+
if (empty($siteId)) {
|
15 |
+
$this->setValue('');
|
16 |
+
} else {
|
17 |
+
$this->setValue(Mage::helper('eems_display')->getProductFeedUrl($storeId));
|
18 |
+
}
|
19 |
+
return $this;
|
20 |
+
}
|
21 |
+
}
|
app/code/community/EbayEnterprise/Display/Model/Adminhtml/System/Config/Backend/Siteidchecksum.php
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* A class that checks that the entered md5 Site Id Checksum mathes the one we generate.
|
4 |
+
*/
|
5 |
+
class EbayEnterprise_Display_Model_Adminhtml_System_Config_Backend_Siteidchecksum
|
6 |
+
extends Mage_Core_Model_Config_Data
|
7 |
+
{
|
8 |
+
const SESSION_KEY = 'adminhtml/session';
|
9 |
+
const CONTACT_INFO = 'Contact dl-ebayent-displaysupport@ebay.com, or call (888) 343-6411 ext. 4 to obtain your Site Id and Site Id Checksum';
|
10 |
+
const FIELD_SEP = ':';
|
11 |
+
/**
|
12 |
+
* Send only the Checksum part of the Site Id Checksum Field.
|
13 |
+
* @return self
|
14 |
+
*/
|
15 |
+
protected function _afterLoad()
|
16 |
+
{
|
17 |
+
parent::_afterLoad();
|
18 |
+
list($justTheHash,) = Mage::helper('eems_display')->splitSiteIdChecksumField($this->getOldValue());
|
19 |
+
$this->setValue($justTheHash);
|
20 |
+
return $this;
|
21 |
+
}
|
22 |
+
/**
|
23 |
+
* Checks to see if we have a new and valid Site Id Checksum Entered
|
24 |
+
* @return self
|
25 |
+
*/
|
26 |
+
protected function _beforeSave()
|
27 |
+
{
|
28 |
+
$helper = Mage::helper('eems_display'); // We need this helper several times herein
|
29 |
+
|
30 |
+
$newChecksum = $this->getValue();
|
31 |
+
list($oldHash,$oldSiteId) = $helper->splitSiteIdChecksumField($this->getOldValue());
|
32 |
+
if (empty($newChecksum) && empty($oldHash)) {
|
33 |
+
// If both old and new checksums are still empty, prompt with some help info.
|
34 |
+
$this->_dataSaveAllowed = false;
|
35 |
+
Mage::getSingleton($this::SESSION_KEY)
|
36 |
+
->addWarning('Please note that tracking is not enabled. Site Id Checksum is empty. ' . self::CONTACT_INFO);
|
37 |
+
return $this;
|
38 |
+
}
|
39 |
+
$storeId = $helper->getStoreIdForCurrentAdminScope();
|
40 |
+
$formFields = $this->getFieldsetData();
|
41 |
+
$newSiteId = $formFields['site_id'];
|
42 |
+
|
43 |
+
// Not allowed to change the Checksum unless we previously had a hash and we are changing the Site Id
|
44 |
+
if (!empty($oldHash) && $oldSiteId === $newSiteId) {
|
45 |
+
$this->_dataSaveAllowed = false;
|
46 |
+
return $this;
|
47 |
+
}
|
48 |
+
// Check that the value provided in newCheckSum matches what we calculate for ourHash.
|
49 |
+
$url = parse_url($helper->getProductFeedUrl($storeId), PHP_URL_HOST);
|
50 |
+
$ourHash = md5($newSiteId . $url);
|
51 |
+
if ($ourHash === $newChecksum) {
|
52 |
+
// Upon success, we save the hash and the newSiteId. In the frontend at runtime,
|
53 |
+
// we just have make sure that the siteId matches the runtime siteId
|
54 |
+
$this->setValue($newChecksum . self::FIELD_SEP . $newSiteId);
|
55 |
+
parent::_beforeSave();
|
56 |
+
} else {
|
57 |
+
$this->setValue(self::FIELD_SEP);
|
58 |
+
Mage::getSingleton($this::SESSION_KEY)
|
59 |
+
->addError('Failed to validate the Site Id. ' . self::CONTACT_INFO);
|
60 |
+
}
|
61 |
+
return $this;
|
62 |
+
}
|
63 |
+
}
|
app/code/community/EbayEnterprise/Display/Model/Email.php
ADDED
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @codeCoverageIgnore
|
4 |
+
*/
|
5 |
+
class EbayEnterprise_Display_Model_Email extends Mage_Core_Model_Email
|
6 |
+
{
|
7 |
+
const EMAIL_TEMPLATE = 'eems_display_installed';
|
8 |
+
const EMAIL_SENT_PATH = 'marketing_solutions/eems_dislpay/install_email/sent';
|
9 |
+
const SEND_TO_EMAIL_PATH = 'marketing_solutions/eems_display/install_email/email';
|
10 |
+
const SEND_TO_NAME_PATH = 'marketing_solutions/eems_display/install_email/name';
|
11 |
+
/**
|
12 |
+
* Send notification of installation to self::SEND_TO_EMAIL.
|
13 |
+
* @return void
|
14 |
+
*/
|
15 |
+
public function sendInstalledNotification()
|
16 |
+
{
|
17 |
+
$sent = Mage::getStoreConfig(self::EMAIL_SENT_PATH);
|
18 |
+
if ($sent) {
|
19 |
+
return;
|
20 |
+
}
|
21 |
+
Mage::getModel('core/email_template')
|
22 |
+
->loadDefault(
|
23 |
+
self::EMAIL_TEMPLATE
|
24 |
+
)
|
25 |
+
->setSenderEmail(
|
26 |
+
Mage::getStoreConfig('trans_email/ident_general/email')
|
27 |
+
)
|
28 |
+
->setSenderName(
|
29 |
+
Mage::getStoreConfig('trans_email/ident_general/name')
|
30 |
+
)
|
31 |
+
->send(
|
32 |
+
Mage::getStoreConfig(self::SEND_TO_EMAIL_PATH),
|
33 |
+
Mage::getStoreConfig(self::SEND_TO_NAME_PATH),
|
34 |
+
// The array of variables made available to the template:
|
35 |
+
array(
|
36 |
+
'productFeedUrls' => implode(', ', $this->_getProductFeedUrls())
|
37 |
+
)
|
38 |
+
);
|
39 |
+
$this->_markEmailSent();
|
40 |
+
return;
|
41 |
+
}
|
42 |
+
/**
|
43 |
+
* Gather a list of all potential product feed URLs. Since we're doing this upon installation,
|
44 |
+
* we don't know what they'll (eventually) configure.
|
45 |
+
* @return array
|
46 |
+
*/
|
47 |
+
protected function _getProductFeedUrls()
|
48 |
+
{
|
49 |
+
$productFeedUrls = array();
|
50 |
+
foreach (Mage::app()->getWebsites() as $website) {
|
51 |
+
foreach ($website->getGroups() as $storeGroup) {
|
52 |
+
foreach($storeGroup->getStores() as $store) {
|
53 |
+
$productFeedUrls[] = Mage::helper('eems_display')->getProductFeedUrl($store->getId());
|
54 |
+
}
|
55 |
+
}
|
56 |
+
}
|
57 |
+
return $productFeedUrls;
|
58 |
+
}
|
59 |
+
/**
|
60 |
+
* Mark the configuration that the email has been sent
|
61 |
+
* @return void
|
62 |
+
*/
|
63 |
+
protected function _markEmailSent()
|
64 |
+
{
|
65 |
+
$config = Mage::getModel('core/config_data');
|
66 |
+
$config->addData(array(
|
67 |
+
'path' => self::EMAIL_SENT_PATH,
|
68 |
+
'value' => 1,
|
69 |
+
'scope' => 'default',
|
70 |
+
'scope_id' => 0,
|
71 |
+
));
|
72 |
+
$config->save();
|
73 |
+
return;
|
74 |
+
}
|
75 |
+
}
|
app/code/community/EbayEnterprise/Display/Model/Error/Exception.php
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class EbayEnterprise_Display_Model_Error_Exception extends Mage_Core_Exception
|
3 |
+
{
|
4 |
+
}
|
app/code/community/EbayEnterprise/Display/Model/Products.php
ADDED
@@ -0,0 +1,129 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class EbayEnterprise_Display_Model_Products extends Mage_Core_Model_Abstract
|
3 |
+
{
|
4 |
+
const CSV_FIELD_DELIMITER = ',';
|
5 |
+
const CSV_FIELD_ENCLOSURE = '"';
|
6 |
+
/**
|
7 |
+
* Export product feeds. Get every store from every store group for every website.
|
8 |
+
*/
|
9 |
+
public function export()
|
10 |
+
{
|
11 |
+
// Email won't send if it's previously been sent. And I'm doing
|
12 |
+
// The installation notification here because it seemed as good a place
|
13 |
+
// as any, and seemed likely that we'd have something configured by now.
|
14 |
+
Mage::getModel('eems_display/email')->sendInstalledNotification();
|
15 |
+
foreach (Mage::app()->getWebsites() as $website) {
|
16 |
+
foreach ($website->getGroups() as $storeGroup) {
|
17 |
+
$this->_processStores($storeGroup->getStores());
|
18 |
+
}
|
19 |
+
}
|
20 |
+
}
|
21 |
+
/**
|
22 |
+
* Puts an array of data into a file pointed to by fileHandle
|
23 |
+
* @param $outputFileName (full path)
|
24 |
+
* @param $dataRows
|
25 |
+
* @return self
|
26 |
+
*/
|
27 |
+
protected function _createCsvFile($outputFileName, $dataRows)
|
28 |
+
{
|
29 |
+
$fh = fopen($outputFileName, 'w');
|
30 |
+
if ($fh === false) {
|
31 |
+
Mage::log('Cannot open file for writing: ' . $outputFileName);
|
32 |
+
} else {
|
33 |
+
foreach ($dataRows as $row) {
|
34 |
+
fputcsv( $fh, $row, self::CSV_FIELD_DELIMITER, self::CSV_FIELD_ENCLOSURE);
|
35 |
+
}
|
36 |
+
fclose($fh);
|
37 |
+
}
|
38 |
+
return $this;
|
39 |
+
}
|
40 |
+
/**
|
41 |
+
* Processes output files for one Store Group. Each store that has a
|
42 |
+
* non-empty SiteId and is enabled gets a feed output. File name
|
43 |
+
* is StoreId.csv and it's placed in the configured feed file path.
|
44 |
+
*/
|
45 |
+
protected function _processStores($stores)
|
46 |
+
{
|
47 |
+
$helper = Mage::helper('eems_display/config');
|
48 |
+
$dirName = $helper->getFeedFilePath();
|
49 |
+
foreach ($stores as $store) {
|
50 |
+
$storeId = $store->getId();
|
51 |
+
$siteId = $helper->getSiteId($storeId);
|
52 |
+
if (empty($siteId) || !$helper->getIsEnabled($storeId)) {
|
53 |
+
continue;
|
54 |
+
}
|
55 |
+
$outputFileName = $dirName . DS . $storeId . '.csv';
|
56 |
+
$rows = array_merge(
|
57 |
+
array($this->_getProductDataHeader()),
|
58 |
+
$this->_getProductData($storeId)
|
59 |
+
);
|
60 |
+
$this->_createCsvFile($outputFileName, $rows);
|
61 |
+
}
|
62 |
+
return $this;
|
63 |
+
}
|
64 |
+
/**
|
65 |
+
* Get the product collection for this store.
|
66 |
+
* @return object (collection of Mage_Sales_Model_Order)
|
67 |
+
*/
|
68 |
+
protected function _getProductCollection($storeId=null)
|
69 |
+
{
|
70 |
+
return Mage::getModel('catalog/product')
|
71 |
+
->getCollection()
|
72 |
+
->addStoreFilter($storeId);
|
73 |
+
}
|
74 |
+
/**
|
75 |
+
* Return an array of header row values.
|
76 |
+
* @return array
|
77 |
+
*/
|
78 |
+
protected function _getProductDataHeader()
|
79 |
+
{
|
80 |
+
return array('Id', 'Name', 'Description', 'Price', 'Image URL', 'Page URL');
|
81 |
+
}
|
82 |
+
/**
|
83 |
+
* Gets the product image URL, ensuring that it gets resized
|
84 |
+
* @return image url, or blank if we can't get if figured out
|
85 |
+
*/
|
86 |
+
protected function _getResizedImage($product, $storeId)
|
87 |
+
{
|
88 |
+
$helper = Mage::helper('eems_display/config');
|
89 |
+
try {
|
90 |
+
// Image implementation doesn't save the resize filed unless it's coerced into
|
91 |
+
// a string. Its (php) magic '__toString()' method is what actually resizes and saves
|
92 |
+
$imageUrl = (string) Mage::helper('catalog/image')
|
93 |
+
->init($product, 'image')
|
94 |
+
->keepAspectRatio(
|
95 |
+
$helper->getFeedImageKeepAspectRatio($storeId)
|
96 |
+
)
|
97 |
+
->resize(
|
98 |
+
$helper->getFeedImageWidth($storeId),
|
99 |
+
$helper->getFeedImageHeight($storeId)
|
100 |
+
);
|
101 |
+
} catch (Exception $e) {
|
102 |
+
$imageUrl = '';
|
103 |
+
Mage::log('Error sizing Image URL for ' . $product->getSku(), $e->getMessage());
|
104 |
+
}
|
105 |
+
return $imageUrl;
|
106 |
+
}
|
107 |
+
/**
|
108 |
+
* Compile the product data for Fetchback into
|
109 |
+
* an array that can be put into a CSV.
|
110 |
+
* @return array
|
111 |
+
*/
|
112 |
+
protected function _getProductData($storeId)
|
113 |
+
{
|
114 |
+
$data = array();
|
115 |
+
$products = $this->_getProductCollection($storeId);
|
116 |
+
foreach($products as $collectedProduct) {
|
117 |
+
$product = Mage::getModel('catalog/product')->setStoreId($storeId)->load($collectedProduct->getId());
|
118 |
+
$data[] = array(
|
119 |
+
$product->getSku(),
|
120 |
+
$product->getName(),
|
121 |
+
$product->getShortDescription(),
|
122 |
+
$product->getPrice(),
|
123 |
+
$this->_getResizedImage($product, $storeId),
|
124 |
+
$product->getProductUrl(),
|
125 |
+
);
|
126 |
+
}
|
127 |
+
return $data;
|
128 |
+
}
|
129 |
+
}
|
app/code/community/EbayEnterprise/Display/controllers/IndexController.php
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* There is no index action for this controller. You must use 'retrieve?id=' to retrieve
|
4 |
+
* an existing feed. If we decide later we want to create feeds upon request via this
|
5 |
+
* controller, just add another action.
|
6 |
+
*/
|
7 |
+
class EbayEnterprise_Display_IndexController extends Mage_Core_Controller_Front_Action
|
8 |
+
{
|
9 |
+
/**
|
10 |
+
* Provides a feed for the given store parameter
|
11 |
+
*/
|
12 |
+
public function retrieveAction()
|
13 |
+
{
|
14 |
+
$helper = Mage::helper('eems_display/config');
|
15 |
+
$storeId = Mage::app()->getRequest()->getParam('id');
|
16 |
+
$store = Mage::getModel('core/store')->load($storeId);
|
17 |
+
if (!$store->getId() || !$helper->getIsEnabled($storeId) || !$helper->getSiteId($storeId)) {
|
18 |
+
// Store is invalid, or not enabled for EEMS Display, or there's no SiteId here.
|
19 |
+
$this->_sendNotFound();
|
20 |
+
return;
|
21 |
+
}
|
22 |
+
$fileName = Mage::helper('eems_display/config')->getFeedFilePath() . DS . $storeId . '.csv';
|
23 |
+
if (!file_exists($fileName)) {
|
24 |
+
// File not here, can't send it
|
25 |
+
$this->_sendNotFound();
|
26 |
+
return;
|
27 |
+
}
|
28 |
+
$contents = file_get_contents($fileName);
|
29 |
+
$this->_sendContents($contents);
|
30 |
+
}
|
31 |
+
/**
|
32 |
+
* Sends an http response with the given contents
|
33 |
+
* @param type $contents
|
34 |
+
*/
|
35 |
+
protected function _sendContents($contents)
|
36 |
+
{
|
37 |
+
$this->getResponse()
|
38 |
+
->setHeader('Content-Type', 'text/csv')
|
39 |
+
->appendBody($contents)
|
40 |
+
->sendResponse();
|
41 |
+
}
|
42 |
+
/**
|
43 |
+
* Send not found.
|
44 |
+
*/
|
45 |
+
protected function _sendNotFound()
|
46 |
+
{
|
47 |
+
$this->getResponse()
|
48 |
+
->setRawHeader('HTTP/1.1, 404')
|
49 |
+
->sendResponse();
|
50 |
+
}
|
51 |
+
}
|
app/code/community/EbayEnterprise/Display/etc/adminhtml.xml
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<acl>
|
4 |
+
<resources>
|
5 |
+
<admin>
|
6 |
+
<children>
|
7 |
+
<system>
|
8 |
+
<children>
|
9 |
+
<config>
|
10 |
+
<children>
|
11 |
+
<marketing_solutions translate="title">
|
12 |
+
<title>Marketing Solutions</title>
|
13 |
+
<sort_order>20</sort_order>
|
14 |
+
</marketing_solutions>
|
15 |
+
</children>
|
16 |
+
</config>
|
17 |
+
</children>
|
18 |
+
</system>
|
19 |
+
</children>
|
20 |
+
</admin>
|
21 |
+
</resources>
|
22 |
+
</acl>
|
23 |
+
</config>
|
app/code/community/EbayEnterprise/Display/etc/config.xml
ADDED
@@ -0,0 +1,108 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<EbayEnterprise_Display>
|
5 |
+
<version>1.0.0.0</version>
|
6 |
+
</EbayEnterprise_Display>
|
7 |
+
</modules>
|
8 |
+
<default>
|
9 |
+
<marketing_solutions>
|
10 |
+
<eems_display>
|
11 |
+
<!-- These are values you can change in the admin interface: -->
|
12 |
+
<!-- Disabled by default: -->
|
13 |
+
<enabled>0</enabled>
|
14 |
+
<!-- Site Id provided by EEMS Display -->
|
15 |
+
<site_id />
|
16 |
+
<!-- Feed values you cannot change in the admin interface: -->
|
17 |
+
<feed>
|
18 |
+
<!-- Path is relative to Mage::getBase('var'); -->
|
19 |
+
<file_path>eems_display</file_path>
|
20 |
+
<image>
|
21 |
+
<!-- As per spec, 150x150: -->
|
22 |
+
<height>150</height>
|
23 |
+
<width>150</width>
|
24 |
+
<!-- 1 = do not distort, 150x150 is a constraint: -->
|
25 |
+
<keep_aspect_ratio>1</keep_aspect_ratio>
|
26 |
+
</image>
|
27 |
+
</feed>
|
28 |
+
<!-- Installation Email -->
|
29 |
+
<install_email>
|
30 |
+
<name>dl-ebayent-displaysupport@ebay.com</name>
|
31 |
+
<email>dl-ebayent-displaysupport@ebay.com</email>
|
32 |
+
</install_email>
|
33 |
+
</eems_display>
|
34 |
+
</marketing_solutions>
|
35 |
+
</default>
|
36 |
+
<global>
|
37 |
+
<template>
|
38 |
+
<email>
|
39 |
+
<eems_display_installed module="eems_display">
|
40 |
+
<file>eemsdisplay_installed.html</file>
|
41 |
+
<type>html</type>
|
42 |
+
</eems_display_installed>
|
43 |
+
</email>
|
44 |
+
</template>
|
45 |
+
<blocks>
|
46 |
+
<eems_display>
|
47 |
+
<class>EbayEnterprise_Display_Block</class>
|
48 |
+
</eems_display>
|
49 |
+
</blocks>
|
50 |
+
<helpers>
|
51 |
+
<eems_display>
|
52 |
+
<class>EbayEnterprise_Display_Helper</class>
|
53 |
+
</eems_display>
|
54 |
+
</helpers>
|
55 |
+
<models>
|
56 |
+
<eems_display>
|
57 |
+
<class>EbayEnterprise_Display_Model</class>
|
58 |
+
</eems_display>
|
59 |
+
</models>
|
60 |
+
<resources>
|
61 |
+
<eemsdisplay_setup>
|
62 |
+
<setup>
|
63 |
+
<module>EbayEnterprise_Display</module>
|
64 |
+
</setup>
|
65 |
+
</eemsdisplay_setup>
|
66 |
+
</resources>
|
67 |
+
</global>
|
68 |
+
<frontend>
|
69 |
+
<layout>
|
70 |
+
<updates>
|
71 |
+
<eems_display>
|
72 |
+
<file>eems_display.xml</file>
|
73 |
+
</eems_display>
|
74 |
+
</updates>
|
75 |
+
</layout>
|
76 |
+
<routers>
|
77 |
+
<eems_display>
|
78 |
+
<use>standard</use>
|
79 |
+
<args>
|
80 |
+
<module>EbayEnterprise_Display</module>
|
81 |
+
<!--
|
82 |
+
The frontName isn't particularly important.
|
83 |
+
The Product Feed Url displayed for the End User to provide
|
84 |
+
to EEMS Display comes here to figure it out.
|
85 |
+
This is the only place you need to specify it.
|
86 |
+
-->
|
87 |
+
<frontName>eems-dpf</frontName>
|
88 |
+
</args>
|
89 |
+
</eems_display>
|
90 |
+
</routers>
|
91 |
+
</frontend>
|
92 |
+
<crontab>
|
93 |
+
<jobs>
|
94 |
+
<eems_display_products_feed>
|
95 |
+
<schedule><cron_expr>0 */3 * * *</cron_expr>
|
96 |
+
</schedule>
|
97 |
+
<run><model>eems_display/products::export</model></run>
|
98 |
+
</eems_display_products_feed>
|
99 |
+
</jobs>
|
100 |
+
</crontab>
|
101 |
+
<phpunit>
|
102 |
+
<suite>
|
103 |
+
<modules>
|
104 |
+
<EbayEnterprise_Display/>
|
105 |
+
</modules>
|
106 |
+
</suite>
|
107 |
+
</phpunit>
|
108 |
+
</config>
|
app/code/community/EbayEnterprise/Display/etc/system.xml
ADDED
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="utf-8"?>
|
2 |
+
<config>
|
3 |
+
<tabs>
|
4 |
+
<ebayenterprise translate="label" module="eems_display">
|
5 |
+
<label>eBay Enterprise</label>
|
6 |
+
<sort_order>550</sort_order>
|
7 |
+
</ebayenterprise>
|
8 |
+
</tabs>
|
9 |
+
<sections>
|
10 |
+
<marketing_solutions translate="label" module="eems_display">
|
11 |
+
<class>separator-top</class>
|
12 |
+
<label>Marketing Solutions</label>
|
13 |
+
<tab>ebayenterprise</tab>
|
14 |
+
<frontend_type>text</frontend_type>
|
15 |
+
<sort_order>550</sort_order>
|
16 |
+
<show_in_default>1</show_in_default>
|
17 |
+
<show_in_website>1</show_in_website>
|
18 |
+
<show_in_store>1</show_in_store>
|
19 |
+
<groups>
|
20 |
+
<eems_display translate="label">
|
21 |
+
<label>Display</label>
|
22 |
+
<frontend_type>text</frontend_type>
|
23 |
+
<sort_order>400</sort_order>
|
24 |
+
<show_in_default>1</show_in_default>
|
25 |
+
<show_in_website>1</show_in_website>
|
26 |
+
<show_in_store>1</show_in_store>
|
27 |
+
<fields>
|
28 |
+
<enabled translate="label">
|
29 |
+
<label>Enable Display Tracking</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>1</show_in_store>
|
36 |
+
</enabled>
|
37 |
+
<site_id translate="label">
|
38 |
+
<label>Site Id</label>
|
39 |
+
<comment><![CDATA[Contact <a href="email:dl-ebayent-displaysupport@ebay.com">dl-ebayent-displaysupport@ebay.com</a>, or call (888) 343-6411 ext. 4 to obtain your Site Id and Site ID Checksum]]></comment>
|
40 |
+
<validate>validate-digits</validate>
|
41 |
+
<frontend_type>text</frontend_type>
|
42 |
+
<sort_order>200</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 |
+
</site_id>
|
47 |
+
<site_id_checksum translate="label">
|
48 |
+
<label>Site Id Checksum</label>
|
49 |
+
<validate>validate-alphanum</validate>
|
50 |
+
<frontend_type>text</frontend_type>
|
51 |
+
<backend_model>eems_display/adminhtml_system_config_backend_siteidchecksum</backend_model>
|
52 |
+
<sort_order>300</sort_order>
|
53 |
+
<show_in_default>1</show_in_default>
|
54 |
+
<show_in_website>1</show_in_website>
|
55 |
+
<show_in_store>0</show_in_store>
|
56 |
+
<depends><enabled>1</enabled></depends>
|
57 |
+
</site_id_checksum>
|
58 |
+
<product_feed_url translate="label">
|
59 |
+
<label>Product Feed URL</label>
|
60 |
+
<comment><![CDATA[Provide this link to eBay Enterprise Display to enable up-to-date product information]]></comment>
|
61 |
+
<frontend_model>eems_display/adminhtml_system_config_form_field_feedurl</frontend_model>
|
62 |
+
<backend_model>eems_display/adminhtml_system_config_backend_feedurl</backend_model>
|
63 |
+
<sort_order>400</sort_order>
|
64 |
+
<show_in_default>1</show_in_default>
|
65 |
+
<show_in_website>1</show_in_website>
|
66 |
+
<show_in_store>1</show_in_store>
|
67 |
+
<depends><enabled>1</enabled></depends>
|
68 |
+
</product_feed_url>
|
69 |
+
</fields>
|
70 |
+
</eems_display>
|
71 |
+
</groups>
|
72 |
+
</marketing_solutions>
|
73 |
+
</sections>
|
74 |
+
</config>
|
app/code/community/EbayEnterprise/Display/sql/eemsdisplay_setup/install-1.0.0.0.php
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$this->startSetup();
|
3 |
+
Mage::log(sprintf('[ %s ] Installing EEMS Display 1.0.0.0', get_class($this)), Zend_Log::INFO);
|
4 |
+
$this->endSetup();
|
app/design/frontend/base/default/layout/eems_display.xml
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
|
4 |
+
<default translate="label">
|
5 |
+
<label>Default Layout</label>
|
6 |
+
<update handle="eems_display_beacon"/>
|
7 |
+
</default>
|
8 |
+
|
9 |
+
<catalog_product_view>
|
10 |
+
<reference name="eems_display.beacon">
|
11 |
+
<action method="setPageType"><type>product</type></action>
|
12 |
+
</reference>
|
13 |
+
</catalog_product_view>
|
14 |
+
|
15 |
+
<checkout_cart_index>
|
16 |
+
<reference name="eems_display.beacon">
|
17 |
+
<action method="setPageType"><type>cart</type></action>
|
18 |
+
</reference>
|
19 |
+
</checkout_cart_index>
|
20 |
+
|
21 |
+
<checkout_onepage_success>
|
22 |
+
<reference name="eems_display.beacon">
|
23 |
+
<action method="setPageType"><type>checkout_success</type></action>
|
24 |
+
</reference>
|
25 |
+
</checkout_onepage_success>
|
26 |
+
|
27 |
+
<checkout_multishipping_success>
|
28 |
+
<reference name="eems_display.beacon">
|
29 |
+
<action method="setPageType"><type>checkout_success</type></action>
|
30 |
+
</reference>
|
31 |
+
</checkout_multishipping_success>
|
32 |
+
|
33 |
+
<eems_display_beacon translate="label">
|
34 |
+
<reference name="before_body_end">
|
35 |
+
<block type="eems_display/beacon" name="eems_display.beacon" template="eems_display/beacon.phtml"/>
|
36 |
+
</reference>
|
37 |
+
</eems_display_beacon>
|
38 |
+
|
39 |
+
</layout>
|
app/design/frontend/base/default/template/eems_display/beacon.phtml
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php if ($this->showBeacon()):?>
|
2 |
+
<script>
|
3 |
+
(function (d,i) {
|
4 |
+
i=d.createElement('iframe');
|
5 |
+
i.width=i.height=1;
|
6 |
+
i.frameBorder=i.marginheight=i.marginwidth=0;
|
7 |
+
i.scrolling='no';
|
8 |
+
i.frameBorder=0;
|
9 |
+
i.src="<?php echo $this->getBeaconUrl()?>";
|
10 |
+
d.body.appendChild(i);
|
11 |
+
}(document));
|
12 |
+
</script>
|
13 |
+
<noscript>
|
14 |
+
<iframe src='<?php echo $this->getBeaconUrl() ?>' scrolling='no' width='1' height='1' marginheight='0' marginwidth='0' frameborder='0'></iframe>
|
15 |
+
</noscript>
|
16 |
+
<?php endif?>
|
app/etc/modules/EbayEnterprise_Display.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<EbayEnterprise_Display>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
</EbayEnterprise_Display>
|
8 |
+
</modules>
|
9 |
+
</config>
|
app/locale/en_US/template/email/eemsdisplay_installed.html
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!--@subject EEMS Display Extension Installed @-->
|
2 |
+
<!--@var "productFeedsUrls" comma separate list of potential Product Feed URLs @-->
|
3 |
+
Hello EEMS Display,
|
4 |
+
|
5 |
+
The EEMS Display Extension was installed.
|
6 |
+
|
7 |
+
At the time of installation, the following URLs were candidates for inclusion in EEMS Display:
|
8 |
+
|
9 |
+
{{var productFeedUrls}}
|
package.xml
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>eBay_Enterprise_Display_Extension</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf">eBay Enterprise Magento Extensions End User License Agreement</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Implements tracking on your site & creates product feed for eBay Enterprise Display & Product Retargeting ads.</summary>
|
10 |
+
<description><p>The eBay Enterprise Display Extension gives you access to the eBay Enterprise Display team, enabling you to run highly-targeted display and retargeting ad campaigns with significantly decreased implementation time.</p>
|
11 |
+
<p>First, simply download the extension and contact the eBay Enterprise Display team to receive your unique Site Id. The Id enables the extension, which automatically deploys a full pixel suite across your website. These pixels help track conversions, impressions, page views, and much more. Your Id will also automatically submit your product data feed to eBay Enterprise, so we can begin targeting users with dynamic product ads.</p>
|
12 |
+
<h3>Why eBay Enterprise Display?</h3>
|
13 |
+
<p>As a marketer, you know the importance of accurately tracking website activity to increase conversions and awareness—not to mention leveraging consumer behavior to deliver the right products to the right prospects. At times this can seem like a bit of a juggling act, but eBay Enterprise Display provides a multitude of ways to drive qualified buyers to your website, where you can convert those visits into sales transactions. Simply put, with this Extension, we make it easier for you to vastly improve your website marketing initiatives.</p>
|
14 |
+
<ul>
|
15 |
+
<li><strong>Social Media Targeting Ready</strong>- Targeted display ads on Facebook to reach website and shopping cart abandoners.</li>
|
16 |
+
<li><strong>Mobile/Tablet Targeting Ready</strong>—Targeted display ads on any tablet, mobile, or iOS device to reach website and shopping cart abandoners.</li>
|
17 |
+
<li><strong>Desktop/Laptop Targeting Ready</strong>—Targeted ads on desktops and laptops targeting shopping cart and website abandoners.</li>
|
18 |
+
<li><strong>Intelligent Ad Creatives</strong>—Automated product feeds enable us to customize ads to a website-abandoner’s last-viewed item or by items left in shopping cart.</li>
|
19 |
+
<li><strong>New Customer Acquisition</strong>—With your permission, we can implement our proprietary eBay Inc. look-alike targeting technology to identify potential buyers of your products or services.</li>
|
20 |
+
</ul>
|
21 |
+
<p>The eBay Enterprise Display dashboard makes it easy for you to generate reports, view display advertising activity, and analyze the pixel-generated data collected from your site.</p>
|
22 |
+
<p>Have questions? Contact our eBay Enterprise Display representatives. They’ll help you optimize your media buys—and ensure that your campaign reaches as many qualified prospects as possible.</p>
|
23 |
+

|
24 |
+
<h3>Get Started:</h3>
|
25 |
+
<ol>
|
26 |
+
<li>Download the extension onto your Magento dashboard.</li>
|
27 |
+
<li>Contact eBay Enterprise Display to get your unique Site Id.</li>
|
28 |
+
<li>Return to the Magento extension configuration page to input your Site Id and security token.</li>
|
29 |
+
<li>Select “enable extension.”</li>
|
30 |
+
<li>Finalize campaign strategy with a qualified eBay Enterprise account executive.</li>
|
31 |
+
<li>Go live, and start reaping the benefits.</li>
|
32 |
+
</ol>
|
33 |
+
<h3>Contact Us:</h3>
|
34 |
+
<strong>Email</strong>–<a href="mailto:DL-eBayEnt-displaysupport@ebay.com">DL-eBayEnt-displaysupport@ebay.com</a><br />
|
35 |
+
Phone–888.343.6411 (option 4 for eBay Enterprise Display support)</description>
|
36 |
+
<notes>Initial Release</notes>
|
37 |
+
<authors><author><name>Michael A. Smith</name><user>kojiro</user><email>msmith3@ebay.com</email></author><author><name>Scott van Brug</name><user>scottvanbrug</user><email>svanbrug@ebay.com</email></author><author><name>Michael West</name><user>MikeWest</user><email>micwest@ebay.com</email></author><author><name>Michael Phang</name><user>mphang6432</user><email>mphang@ebay.com</email></author><author><name>Adam Hobson</name><user>adhobson</user><email>adhobson@ebay.com</email></author><author><name>Reginald Gabriel</name><user>rgabriel</user><email>rgabriel@ebay.com</email></author></authors>
|
38 |
+
<date>2014-05-09</date>
|
39 |
+
<time>19:05:47</time>
|
40 |
+
<contents><target name="magecommunity"><dir name="EbayEnterprise"><dir name="Display"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Feedurl.php" hash="82241e7e509b9c27dc734c8728e501f5"/></dir></dir></dir></dir></dir><file name="Beacon.php" hash="b272092167ffa1f7f08be5b3715b7968"/></dir><dir name="Helper"><file name="Config.php" hash="f831ae412417e253a57f37d6d3423e50"/><file name="Data.php" hash="3a5312fe107714d34267c72ce2910f40"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Backend"><file name="Feedurl.php" hash="aa1810a7c67e0b35e732ff5155f81a6b"/><file name="Siteidchecksum.php" hash="76635b1309e542d23d213466a2f7bed0"/></dir></dir></dir></dir><file name="Email.php" hash="2252c80035c9515650cd49e2c52e3645"/><dir name="Error"><file name="Exception.php" hash="65df9f687c4746431f9316baca3b5495"/></dir><file name="Products.php" hash="63129b2a0bd7f790ffbd96473c7d2c31"/></dir><dir name="controllers"><file name="IndexController.php" hash="197cb073d339eb76e6dbcf2167107a93"/></dir><dir name="etc"><file name="adminhtml.xml" hash="e1208b50586829c2e6c6536dd062ef0c"/><file name="config.xml" hash="5c8237485eb9c7c77fea466e26f41bd9"/><file name="system.xml" hash="55731b868ba01e966120cd53235b4407"/></dir><dir name="sql"><dir name="eemsdisplay_setup"><file name="install-1.0.0.0.php" hash="a9c02c7e94cdad9965ffa62571276ba2"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="eems_display"><file name="beacon.phtml" hash="4937e1a21b75f436b6a013fdcea59be9"/></dir></dir><dir name="layout"><file name="eems_display.xml" hash="7f823afa4c46cc316e198d5ff80eaa6b"/></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><dir name="template"><dir name="email"><file name="eemsdisplay_installed.html" hash="609fa6fc13a7a3f444bd0c256e207e7f"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="EbayEnterprise_Display.xml" hash="ae74ae5088d96d6300c544a031d4c0c6"/></dir></target></contents>
|
41 |
+
<compatible/>
|
42 |
+
<dependencies><required><php><min>5.3.0</min><max>5.3.99</max></php></required></dependencies>
|
43 |
+
</package>
|