Version Notes
First requires configuration in System > Configuration > Pixlee Account Configuration.
Download this release
Release Info
Developer | Awad Sayeed |
Extension | pixlee-for-magento |
Version | 2.0.0.3 |
Comparing to | |
See all releases |
Code changes from version 2.0.0.1 to 2.0.0.3
- app/code/community/Pixlee/Base/Block/Gallery.php +1 -5
- app/code/community/Pixlee/Base/Helper/Data.php +91 -23
- app/code/community/Pixlee/Base/Model/Observer.php +21 -12
- app/code/community/Pixlee/Base/Test/Helper/fixtures/testIsActive.yaml +1 -3
- app/code/community/Pixlee/Base/Test/Helper/fixtures/testIsInactive.yaml +1 -3
- app/code/community/Pixlee/Base/etc/config.xml +7 -7
- app/code/community/Pixlee/Base/version.txt +1 -1
- app/design/frontend/base/default/layout/pixlee/gallery.xml +7 -1
- js/pixlee/getAnalyticsCookie.js +37 -0
- lib/Pixlee/.Pixlee.php.swp +0 -0
- lib/Pixlee/Pixlee.php +7 -0
- package.xml +1 -57
app/code/community/Pixlee/Base/Block/Gallery.php
CHANGED
@@ -13,10 +13,6 @@ class Pixlee_Base_Block_Gallery extends Mage_Core_Block_Template {
|
|
13 |
return parent::_prepareLayout();
|
14 |
}
|
15 |
|
16 |
-
public function getUserId() {
|
17 |
-
return Mage::getStoreConfig('pixlee/pixlee/user_id', Mage::app()->getStore());
|
18 |
-
}
|
19 |
-
|
20 |
public function getAccountId() {
|
21 |
return Mage::getStoreConfig('pixlee/pixlee/account_id', Mage::app()->getStore());
|
22 |
}
|
@@ -36,7 +32,7 @@ class Pixlee_Base_Block_Gallery extends Mage_Core_Block_Template {
|
|
36 |
}
|
37 |
|
38 |
public function getApiKey() {
|
39 |
-
$pixleeApiKey = Mage::getStoreConfig('pixlee/pixlee/
|
40 |
return ($pixleeApiKey) ? $pixleeApiKey : self::DEFAULT_DISPLAY_OPTIONS_ID;
|
41 |
}
|
42 |
|
13 |
return parent::_prepareLayout();
|
14 |
}
|
15 |
|
|
|
|
|
|
|
|
|
16 |
public function getAccountId() {
|
17 |
return Mage::getStoreConfig('pixlee/pixlee/account_id', Mage::app()->getStore());
|
18 |
}
|
32 |
}
|
33 |
|
34 |
public function getApiKey() {
|
35 |
+
$pixleeApiKey = Mage::getStoreConfig('pixlee/pixlee/account_api_key', Mage::app()->getStore());
|
36 |
return ($pixleeApiKey) ? $pixleeApiKey : self::DEFAULT_DISPLAY_OPTIONS_ID;
|
37 |
}
|
38 |
|
app/code/community/Pixlee/Base/Helper/Data.php
CHANGED
@@ -66,9 +66,15 @@ class Pixlee_Base_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
66 |
}
|
67 |
|
68 |
public function getUnexportedProducts($useCached = true) {
|
69 |
-
//
|
70 |
-
//
|
71 |
-
//
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
$albumTable = Mage::getSingleton('core/resource')->getTableName('pixlee/product_album');
|
73 |
$collection = Mage::getModel('catalog/product')->getCollection()
|
74 |
->addAttributeToFilter('visibility', array('neq' => 1)); // Only grab products that are visible in catalog and/or search
|
@@ -125,33 +131,92 @@ class Pixlee_Base_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
125 |
// has already been called
|
126 |
public function getAggregateStock($actualProduct) {
|
127 |
Mage::log("*** In getAggregateStock");
|
128 |
-
$
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
//
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
}
|
139 |
Mage::log("Returning aggregateStock: {$aggregateStock}");
|
140 |
return $aggregateStock;
|
141 |
}
|
142 |
|
143 |
-
public function getVariantsDict($
|
144 |
$variantsDict = array();
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
|
|
|
|
|
|
|
|
154 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
155 |
}
|
156 |
return $variantsDict;
|
157 |
}
|
@@ -183,6 +248,9 @@ class Pixlee_Base_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
183 |
$albumId = $response->data->album->id;
|
184 |
} else if(isset($response->data->product->album_id)) {
|
185 |
$albumId = $response->data->product->album_id;
|
|
|
|
|
|
|
186 |
}
|
187 |
|
188 |
if($albumId) {
|
66 |
}
|
67 |
|
68 |
public function getUnexportedProducts($useCached = true) {
|
69 |
+
// NEVERMIND I'm dumb
|
70 |
+
// Tee Ming was totally justified in doing what he did. I should never have doubted Tee Ming.
|
71 |
+
// My problem is not that I need getUnexportedProducts to return a cached result, but that
|
72 |
+
// having converted to distillery, I wasn't correctly parsing out the created album ID
|
73 |
+
/*
|
74 |
+
if($this->_unexportedProducts && $useCached) {
|
75 |
+
return $this->_unexportedProducts;
|
76 |
+
}
|
77 |
+
*/
|
78 |
$albumTable = Mage::getSingleton('core/resource')->getTableName('pixlee/product_album');
|
79 |
$collection = Mage::getModel('catalog/product')->getCollection()
|
80 |
->addAttributeToFilter('visibility', array('neq' => 1)); // Only grab products that are visible in catalog and/or search
|
131 |
// has already been called
|
132 |
public function getAggregateStock($actualProduct) {
|
133 |
Mage::log("*** In getAggregateStock");
|
134 |
+
$aggregateStock = NULL;
|
135 |
+
// If after calling _extractActualProduct, there is no 'configurable' product, and only
|
136 |
+
// a 'simple' product, we won't get anything back from
|
137 |
+
// getModel('catalog/product_type_configurable')
|
138 |
+
if ($actualProduct->getTypeId() == "simple") {
|
139 |
+
// If the product's not keeping track of inventory, we'll error out when we try
|
140 |
+
// to call the getQty() function on the output of getStockItem()
|
141 |
+
if (is_null($actualProduct->getStockItem())) {
|
142 |
+
$aggregateStock = NULL;
|
143 |
+
} else {
|
144 |
+
$aggregateStock = max(0, $actualProduct->getStockItem()->getQty());
|
145 |
+
}
|
146 |
+
} else {
|
147 |
+
// 'grouped' type products have 'associated products,' which presumably
|
148 |
+
// point to simple products
|
149 |
+
if ($actualProduct->getTypeId() == "grouped") {
|
150 |
+
$childProducts = $actualProduct->getTypeInstance(true)->getAssociatedProducts($actualProduct);
|
151 |
+
// And finally, my original assumption that all 'simple' products are
|
152 |
+
// under the umbrella of some 'configurable' product
|
153 |
+
} else if ($actualProduct->getTypeId() == "configurable") {
|
154 |
+
$childProducts = Mage::getModel('catalog/product_type_configurable')->getUsedProducts(null,$actualProduct);
|
155 |
+
}
|
156 |
+
foreach ($childProducts as $child) {
|
157 |
+
// Sometimes Magento gives a negative inventory quantity
|
158 |
+
// I don't want that to affect the overall count
|
159 |
+
// TODO: There is probably a good reason why it goes negative
|
160 |
+
Mage::log("Child Name: {$child->getName()}");
|
161 |
+
Mage::log("Child SKU: {$child->getSku()}");
|
162 |
+
if (is_null($child->getStockItem())) {
|
163 |
+
Mage::log("Child product not tracking stock, setting to NULL");
|
164 |
+
} else {
|
165 |
+
Mage::log("Child Stock: {$child->getStockItem()->getQty()}");
|
166 |
+
if (is_null($aggregateStock)) {
|
167 |
+
$aggregateStock = 0;
|
168 |
+
}
|
169 |
+
$aggregateStock += max(0, $child->getStockItem()->getQty());
|
170 |
+
}
|
171 |
+
}
|
172 |
}
|
173 |
Mage::log("Returning aggregateStock: {$aggregateStock}");
|
174 |
return $aggregateStock;
|
175 |
}
|
176 |
|
177 |
+
public function getVariantsDict($actualProduct) {
|
178 |
$variantsDict = array();
|
179 |
+
|
180 |
+
// If after calling _extractActualProduct, there is no 'configurable' product, and only
|
181 |
+
// a 'simple' product, we won't get anything back from
|
182 |
+
// getModel('catalog/product_type_configurable')
|
183 |
+
if ($actualProduct->getTypeId() == "simple") {
|
184 |
+
if (is_null($actualProduct->getStockItem())) {
|
185 |
+
$variantStock = NULL;
|
186 |
+
} else {
|
187 |
+
$variantStock = max(0, $actualProduct->getStockItem()->getQty());
|
188 |
+
}
|
189 |
+
$variantsDict[$actualProduct->getId()] = array(
|
190 |
+
'variant_stock' => $variantStock,
|
191 |
+
'variant_sku' => $actualProduct->getSku(),
|
192 |
);
|
193 |
+
} else {
|
194 |
+
// 'grouped' type products have 'associated products,' which presumably
|
195 |
+
// point to simple products
|
196 |
+
if ($actualProduct->getTypeId() == "grouped") {
|
197 |
+
$childProducts = $actualProduct->getTypeInstance(true)->getAssociatedProducts($actualProduct);
|
198 |
+
// And finally, my original assumption that all 'simple' products are
|
199 |
+
// under the umbrella of some 'configurable' product
|
200 |
+
} else if ($actualProduct->getTypeId() == "configurable") {
|
201 |
+
$childProducts = Mage::getModel('catalog/product_type_configurable')->getUsedProducts(null,$actualProduct);
|
202 |
+
}
|
203 |
+
foreach ($childProducts as $child) {
|
204 |
+
// Sometimes Magento gives a negative inventory quantity
|
205 |
+
// I don't want that to affect the overall count
|
206 |
+
// TODO: There is probably a good reason why it goes negative
|
207 |
+
$variantId = $child->getId();
|
208 |
+
|
209 |
+
if (is_null($child->getStockItem())) {
|
210 |
+
$variantStock = NULL;
|
211 |
+
} else {
|
212 |
+
$variantStock = max(0, $child->getStockItem()->getQty());
|
213 |
+
}
|
214 |
+
|
215 |
+
$variantsDict[$variantId] = array(
|
216 |
+
'variant_stock' => $variantStock,
|
217 |
+
'variant_sku' => $child->getSku(),
|
218 |
+
);
|
219 |
+
}
|
220 |
}
|
221 |
return $variantsDict;
|
222 |
}
|
248 |
$albumId = $response->data->album->id;
|
249 |
} else if(isset($response->data->product->album_id)) {
|
250 |
$albumId = $response->data->product->album_id;
|
251 |
+
// Distillery returns the product album on the 'create' verb
|
252 |
+
} else if(isset($response->id)) {
|
253 |
+
$albumId = $response->id;
|
254 |
}
|
255 |
|
256 |
if($albumId) {
|
app/code/community/Pixlee/Base/Model/Observer.php
CHANGED
@@ -53,9 +53,6 @@ class Pixlee_Base_Model_Observer {
|
|
53 |
// ADD PRODUCT TO CART
|
54 |
public function addToCart(Varien_Event_Observer $observer) {
|
55 |
$product = $observer->getEvent()->getProduct();
|
56 |
-
Mage::log("BEGINNING OF PRODUCT JSON");
|
57 |
-
Mage::log($product->getJson());
|
58 |
-
Mage::log("END OF THE PRODUCT LOG");
|
59 |
$productData = $this->_extractProduct($product);
|
60 |
$payload = $this->_preparePayload($productData);
|
61 |
$this->_sendPayload('addToCart', $payload);
|
@@ -80,8 +77,6 @@ class Pixlee_Base_Model_Observer {
|
|
80 |
|
81 |
// CHECKOUT SUCCESS
|
82 |
public function checkoutSuccess(Varien_Event_Observer $observer) {
|
83 |
-
// $quote = $observer->getEvent()->getQuote();
|
84 |
-
|
85 |
$quote = new Mage_Sales_Model_Order();
|
86 |
$incrementId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
|
87 |
$quote->loadByIncrementId($incrementId);
|
@@ -91,13 +86,26 @@ class Pixlee_Base_Model_Observer {
|
|
91 |
$payload = array_merge(array('cart' => $cartData), $customerData);
|
92 |
$payload = $this->_preparePayload($payload);
|
93 |
$this->_sendPayload('checkoutSuccess', $payload);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
}
|
95 |
|
96 |
-
|
97 |
-
|
98 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
}
|
100 |
-
}
|
101 |
|
102 |
// VALIDATE CREDENTIALS
|
103 |
public function validateCredentials(Varien_Event_Observer $observer){
|
@@ -143,13 +151,12 @@ public function checkAnalyticsCookie(Varien_Event_Observer $observer) {
|
|
143 |
}
|
144 |
Mage::log("** Before building payload");
|
145 |
// Required key/value pairs not in the payload by default.
|
146 |
-
$payload['API_KEY']= Mage::getStoreConfig('pixlee/pixlee/
|
147 |
$payload['uid'] = $payload['CURRENT_PIXLEE_USER_ID'];
|
148 |
$payload['pixlee_album_photos_timestamps'] = $payload['CURRENT_PIXLEE_ALBUM_PHOTOS_TIMESTAMP'];
|
149 |
$payload['pixlee_album_photos'] = $payload['CURRENT_PIXLEE_ALBUM_PHOTOS'];
|
150 |
$payload['horizontal_page'] = $payload['HORIZONTAL_PAGE'];
|
151 |
Mage::log("** After building payload");
|
152 |
-
Mage::log("** Payload: $payload");
|
153 |
$payload['ecommerce_platform'] = 'magento_1';
|
154 |
$payload['ecommerce_platform_version'] = '2.0.0';
|
155 |
$payload['version_hash'] = $this->_getVersionHash();
|
@@ -200,7 +207,9 @@ public function checkAnalyticsCookie(Varien_Event_Observer $observer) {
|
|
200 |
$productData['quantity'] = (int) $product->getQty();
|
201 |
$product = $product->getProduct();
|
202 |
} else if(is_a($product, 'Mage_Sales_Model_Order_Item')) {
|
203 |
-
|
|
|
|
|
204 |
$product = $product->getProduct();
|
205 |
} else {
|
206 |
$productData['quantity'] = (int) $product->getQty();
|
53 |
// ADD PRODUCT TO CART
|
54 |
public function addToCart(Varien_Event_Observer $observer) {
|
55 |
$product = $observer->getEvent()->getProduct();
|
|
|
|
|
|
|
56 |
$productData = $this->_extractProduct($product);
|
57 |
$payload = $this->_preparePayload($productData);
|
58 |
$this->_sendPayload('addToCart', $payload);
|
77 |
|
78 |
// CHECKOUT SUCCESS
|
79 |
public function checkoutSuccess(Varien_Event_Observer $observer) {
|
|
|
|
|
80 |
$quote = new Mage_Sales_Model_Order();
|
81 |
$incrementId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
|
82 |
$quote->loadByIncrementId($incrementId);
|
86 |
$payload = array_merge(array('cart' => $cartData), $customerData);
|
87 |
$payload = $this->_preparePayload($payload);
|
88 |
$this->_sendPayload('checkoutSuccess', $payload);
|
89 |
+
|
90 |
+
// Magento ticks down the stock inventory as soon as an order is created,
|
91 |
+
// so in addition to sending an analytics event, update the product in distillery
|
92 |
+
$helper = Mage::helper('pixlee');
|
93 |
+
foreach ($quote->getAllVisibleItems() as $item) {
|
94 |
+
$product = $helper->_extractActualProduct($item);
|
95 |
+
$helper->exportProductToPixlee($product);
|
96 |
+
}
|
97 |
}
|
98 |
|
99 |
+
// CANCEL ORDER
|
100 |
+
public function cancelOrder(Varien_Event_Observer $observer) {
|
101 |
+
// When an order is cancelled, Magento ticks the stock inventory back up
|
102 |
+
$helper = Mage::helper('pixlee');
|
103 |
+
$order = $observer->getEvent()->getOrder();
|
104 |
+
foreach ($order->getAllVisibleItems() as $item) {
|
105 |
+
$product = $helper->_extractActualProduct($item);
|
106 |
+
$helper->exportProductToPixlee($product);
|
107 |
+
}
|
108 |
}
|
|
|
109 |
|
110 |
// VALIDATE CREDENTIALS
|
111 |
public function validateCredentials(Varien_Event_Observer $observer){
|
151 |
}
|
152 |
Mage::log("** Before building payload");
|
153 |
// Required key/value pairs not in the payload by default.
|
154 |
+
$payload['API_KEY']= Mage::getStoreConfig('pixlee/pixlee/account_api_key', Mage::app()->getStore());
|
155 |
$payload['uid'] = $payload['CURRENT_PIXLEE_USER_ID'];
|
156 |
$payload['pixlee_album_photos_timestamps'] = $payload['CURRENT_PIXLEE_ALBUM_PHOTOS_TIMESTAMP'];
|
157 |
$payload['pixlee_album_photos'] = $payload['CURRENT_PIXLEE_ALBUM_PHOTOS'];
|
158 |
$payload['horizontal_page'] = $payload['HORIZONTAL_PAGE'];
|
159 |
Mage::log("** After building payload");
|
|
|
160 |
$payload['ecommerce_platform'] = 'magento_1';
|
161 |
$payload['ecommerce_platform_version'] = '2.0.0';
|
162 |
$payload['version_hash'] = $this->_getVersionHash();
|
207 |
$productData['quantity'] = (int) $product->getQty();
|
208 |
$product = $product->getProduct();
|
209 |
} else if(is_a($product, 'Mage_Sales_Model_Order_Item')) {
|
210 |
+
// BUGZ-1081: We used to have getQtyToInvoice() here, but it seems Goorin
|
211 |
+
// has maybe...and auto-invoice extension maybe?
|
212 |
+
$productData['quantity'] = (int) $product->getQtyOrdered();
|
213 |
$product = $product->getProduct();
|
214 |
} else {
|
215 |
$productData['quantity'] = (int) $product->getQty();
|
app/code/community/Pixlee/Base/Test/Helper/fixtures/testIsActive.yaml
CHANGED
@@ -1,4 +1,2 @@
|
|
1 |
config:
|
2 |
-
stores/admin/pixlee/pixlee/
|
3 |
-
stores/admin/pixlee/pixlee/secret_key: 'secret_key_exists'
|
4 |
-
stores/admin/pixlee/pixlee/user_id: 'user_id'
|
1 |
config:
|
2 |
+
stores/admin/pixlee/pixlee/account_api_key: 'api_key_exists'
|
|
|
|
app/code/community/Pixlee/Base/Test/Helper/fixtures/testIsInactive.yaml
CHANGED
@@ -1,4 +1,2 @@
|
|
1 |
config:
|
2 |
-
stores/admin/pixlee/pixlee/
|
3 |
-
stores/admin/pixlee/pixlee/secret_key: ''
|
4 |
-
stores/admin/pixlee/pixlee/user_id: ''
|
1 |
config:
|
2 |
+
stores/admin/pixlee/pixlee/account_api_key: ''
|
|
|
|
app/code/community/Pixlee/Base/etc/config.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Pixlee_Base>
|
5 |
-
<version>2.0.0</version>
|
6 |
</Pixlee_Base>
|
7 |
</modules>
|
8 |
<global>
|
@@ -86,16 +86,16 @@
|
|
86 |
</observers>
|
87 |
</sales_quote_remove_item>
|
88 |
|
89 |
-
<!--
|
90 |
-
<
|
91 |
<observers>
|
92 |
-
<
|
93 |
<type>singleton</type>
|
94 |
<class>pixlee/observer</class>
|
95 |
-
<method>
|
96 |
-
</
|
97 |
</observers>
|
98 |
-
</
|
99 |
|
100 |
<!-- ADMIN: CHECK IF NEW PRODUCT OR UPDATING -->
|
101 |
<catalog_product_save_before>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Pixlee_Base>
|
5 |
+
<version>2.0.0.3</version>
|
6 |
</Pixlee_Base>
|
7 |
</modules>
|
8 |
<global>
|
86 |
</observers>
|
87 |
</sales_quote_remove_item>
|
88 |
|
89 |
+
<!-- CANCEL ORDER -->
|
90 |
+
<order_cancel_after>
|
91 |
<observers>
|
92 |
+
<pixlee_cancel_order_analytics>
|
93 |
<type>singleton</type>
|
94 |
<class>pixlee/observer</class>
|
95 |
+
<method>cancelOrder</method>
|
96 |
+
</pixlee_cancel_order_analytics>
|
97 |
</observers>
|
98 |
+
</order_cancel_after>
|
99 |
|
100 |
<!-- ADMIN: CHECK IF NEW PRODUCT OR UPDATING -->
|
101 |
<catalog_product_save_before>
|
app/code/community/Pixlee/Base/version.txt
CHANGED
@@ -1 +1 @@
|
|
1 |
-
|
1 |
+
a9fca855e13805275e8131bc2f3778a8c7a9e734
|
app/design/frontend/base/default/layout/pixlee/gallery.xml
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<layout version="0.1.0">
|
3 |
-
<!--
|
4 |
To implement the Pixlee gallery, insert the "pixlee_gallery_tag"
|
5 |
update handle in the layout XML for your page. Example:
|
6 |
|
@@ -39,4 +39,10 @@
|
|
39 |
<update handle="pixlee_gallery_tag" />
|
40 |
</default>
|
41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
</layout>
|
1 |
<?xml version="1.0"?>
|
2 |
<layout version="0.1.0">
|
3 |
+
<!--
|
4 |
To implement the Pixlee gallery, insert the "pixlee_gallery_tag"
|
5 |
update handle in the layout XML for your page. Example:
|
6 |
|
39 |
<update handle="pixlee_gallery_tag" />
|
40 |
</default>
|
41 |
|
42 |
+
<catalog_product_view>
|
43 |
+
<reference name="head">
|
44 |
+
<action method="addJs"><script>pixlee/getAnalyticsCookie.js</script></action>
|
45 |
+
</reference>
|
46 |
+
</catalog_product_view>
|
47 |
+
|
48 |
</layout>
|
js/pixlee/getAnalyticsCookie.js
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
var createPixleeAnalyticsCookie = function() {
|
2 |
+
var iframe = document.createElement('iframe');
|
3 |
+
iframe.style.display = "none";
|
4 |
+
iframe.src = 'https://photos.pixlee.com/getDUH';
|
5 |
+
document.body.appendChild(iframe);
|
6 |
+
|
7 |
+
window.addEventListener("message", function receiveMessage(event) {
|
8 |
+
try {
|
9 |
+
var eventData = JSON.parse(event.data);
|
10 |
+
if (eventData.function == "pixlee_distinct_user_hash") {
|
11 |
+
if (eventData.data) {
|
12 |
+
var distinct_user_hash_linker = eventData.value;
|
13 |
+
setCookie('pixlee_analytics_cookie', encodeURIComponent(JSON.stringify({
|
14 |
+
CURRENT_PIXLEE_USER_ID: distinct_user_hash_linker,
|
15 |
+
CURRENT_PIXLEE_ALBUM_PHOTOS: [],
|
16 |
+
HORIZONTAL_PAGE: [],
|
17 |
+
CURRENT_PIXLEE_ALBUM_PHOTOS_TIMESTAMP: []
|
18 |
+
})), 30);
|
19 |
+
}
|
20 |
+
}
|
21 |
+
} catch(e) {
|
22 |
+
console.log("Exception " + e);
|
23 |
+
};
|
24 |
+
}, false);
|
25 |
+
}
|
26 |
+
|
27 |
+
var setCookie = function(name, value, days) {
|
28 |
+
if (days) {
|
29 |
+
var date = new Date();
|
30 |
+
date.setTime(date.getTime()+(days*24*60*60*1000));
|
31 |
+
var expires = "; expires="+date.toGMTString();
|
32 |
+
}
|
33 |
+
else var expires = "";
|
34 |
+
document.cookie = name+"="+value+expires+"; path=/; domain=" + window.location.host.replace('www', '');
|
35 |
+
};
|
36 |
+
|
37 |
+
window.addEventListener('load', createPixleeAnalyticsCookie);
|
lib/Pixlee/.Pixlee.php.swp
ADDED
Binary file
|
lib/Pixlee/Pixlee.php
CHANGED
@@ -71,6 +71,13 @@ class Pixlee_Pixlee {
|
|
71 |
}
|
72 |
}
|
73 |
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
$product = array('name' => $product_name, 'sku' => $sku, 'buy_now_link_url' => $product_url,
|
75 |
'product_photo' => $product_image, 'stock' => $aggregateStock,
|
76 |
'native_product_id' => $product_id, 'variants_json' => $variantsDict);
|
71 |
}
|
72 |
}
|
73 |
*/
|
74 |
+
|
75 |
+
// I feel like this is the result of a long chain of engineers being uncertain, that
|
76 |
+
// a product's ID, which is inaccesible to the user, and almost certainly a number,
|
77 |
+
// comes back as a string from $product->getId(). I'm just going to decide to break the cycle.
|
78 |
+
// Let's hope I'm right.
|
79 |
+
$product_id = (int) $product_id;
|
80 |
+
|
81 |
$product = array('name' => $product_name, 'sku' => $sku, 'buy_now_link_url' => $product_url,
|
82 |
'product_photo' => $product_image, 'stock' => $aggregateStock,
|
83 |
'native_product_id' => $product_id, 'variants_json' => $variantsDict);
|
package.xml
CHANGED
@@ -1,58 +1,2 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
-
<package>
|
3 |
-
<name>Pixlee_Base</name>
|
4 |
-
<version>2.0.0</version>
|
5 |
-
<stability>stable</stability>
|
6 |
-
<license>MIT</license>
|
7 |
-
<channel>community</channel>
|
8 |
-
<extends/>
|
9 |
-
<summary>Social commerce platform to collect, curate, and display user-generated content to enhance your Magento store</summary>
|
10 |
-
<description>Pixlee’s pre-built integration allows brands to easily deploy real customer photos and videos across online storefronts to create a more social ecommerce experience and to drive higher sales. <br /><br />
|
11 |
-

|
12 |
-
Magento customers use Pixlee to increase conversion, average order value, and engagement with: <br /><br />
|
13 |
-

|
14 |
-
<strong>Visual Reviews on Product and Category Pages: </strong>Publish product specific galleries on product and category pages to give shoppers an authentic view of how real customers enjoy the product they are shopping. (See Screenshot example) <br /><br />
|
15 |
-

|
16 |
-
<strong>Shoppable Galleries &amp; Look Books:</strong> Create authentic ways for shoppers to browse real customers visual endorsement of your brand, get inspiration to purchase, and discover new products. (See Screenshot example) <br /><br />
|
17 |
-

|
18 |
-
<strong>Campaigns &amp; Contests: </strong>Create, manage, and promote new and existing marketing campaigns &amp; contests to bridge the gap between social engagement and new sales. (See Screenshot example)<br /><br />
|
19 |
-

|
20 |
-
<strong>Track Performance &amp; Discover Customer Insights: </strong> Use full social and content analytics dashboard to track conversion, engagement, and social performance of your brand and discover key insights about customers. <br /><br />
|
21 |
-

|
22 |
-
Learn more about the Pixlee platform at <a href="http://www.pixlee.com/">www.pixleeteam.com </a>.</description>
|
23 |
-
<notes>This plugin is an upgrade to the Pixlee Magento plugin 1.0.0. It includes the following improvements -
|
24 |
-

|
25 |
-
1. Product exports updated to use Pixlee V2 API
|
26 |
-
- Product exports now send inventory (stock) information
|
27 |
-
- Product exports on "configurable" and "grouped" products now also send a JSON of IDs/SKUs of associated products
|
28 |
-

|
29 |
-
2. Standardized Analytics 
|
30 |
-
Add to Cart and Remove From Cart analytics will now include the following fields
|
31 |
-
- product_id
|
32 |
-
- product_sku
|
33 |
-
- variant_id
|
34 |
-
- variant_sku
|
35 |
-
- quantity
|
36 |
-
- price
|
37 |
-

|
38 |
-
Checkout Start and Conversion will now include the following fields
|
39 |
-
- cart_contents (Summary of all the products in the cart)
|
40 |
-
- cart_total (net price)
|
41 |
-
- cart_total_quantity
|
42 |
-
- currency
|
43 |
-
- order_id
|
44 |
-

|
45 |
-
In addition to those fields, all of the events will include the following fields
|
46 |
-
- ecommerce_platform (magento_1)
|
47 |
-
- ecommerce_version (version of the plugin)
|
48 |
-
- version_hash - refers to the latest git commit hash in the master branch
|
49 |
-

|
50 |
-
3. Recognizing unique users
|
51 |
-
All of the users are now tracked using a 'distinct_user_hash' which is issued by Segment. To keep the 'distinct_user_hash' consistent throughout the period of time when the user is on the website - we use segment to only issue a distinct_user_hash relative to photos.pixlee.com. This helps us to recognize all users even if they we re-directed to a different domain.</notes>
|
52 |
-
<authors><author><name>Awad Sayeed</name><user>awadsayeed</user><email>awad@pixleeteam.com</email></author><author><name>Yunfan Luo</name><user>GANDAMU</user><email>yunfan@pixleeteam.com</email></author><author><name>Satnam Dhanoa</name><user>Satnam14</user><email>satnam@pixleeteam.com</email></author></authors>
|
53 |
-
<date>2016-03-14</date>
|
54 |
-
<time>22:24:25</time>
|
55 |
-
<contents><target name="mageetc"><dir name="modules"><file name="Pixlee_Base.xml" hash="d61d4914e77a6f00ecad4d1c08a69c01"/></dir></target><target name="magecommunity"><dir name="Pixlee"><dir name="Base"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Form"><file name="Export.php" hash="a86d00b5a2e312a5bfdd856fd9ede257"/></dir></dir></dir></dir><file name="Gallery.php" hash="422d945772d1a38acf8ebc4f898971d0"/></dir><dir name="Helper"><file name="Data.php" hash="4f818cc47718aee113fa3c91d6fe5162"/></dir><dir name="Model"><file name="Observer.php" hash="a77b97332798cb88744b25ff30b7cda5"/><dir name="Product"><file name="Album.php" hash="1b415ff13e6fc9403e1149b327f9acb9"/></dir><dir name="Resource"><dir name="Product"><file name="Album.php" hash="a7f1e58ac017f183a2d1620d35645342"/></dir><file name="Setup.php" hash="a4f0721d4b19d19290e4999ef7ad327f"/></dir></dir><dir name="Test"><dir name="Helper"><file name="Data.php" hash="97b4546146d750033aed7c6855ea6327"/><dir name="fixtures"><file name="testGetUnexportedProducts.yaml" hash="9575424d3b1061d07181a8e9b2aaa6f4"/><file name="testIsActive.yaml" hash="53462b2a4bf02c846ae699633b24570c"/><file name="testIsInactive.yaml" hash="46909f781f699e14b389eed83b728433"/></dir></dir><file name="autoload.php" hash="05ed6c18a3ee3f523c242312de048eef"/></dir><dir name="controllers"><dir name="Pixlee"><file name="ExportController.php" hash="48eb932a2089646258d6b5ad6f744a5b"/></dir></dir><dir name="etc"><file name="config.xml" hash="45c1f57cae7589c9b9cf178a8316a15e"/><file name="system.xml" hash="07b4c9d8fb738e7a954d9c6e3ea15129"/></dir><dir name="sql"><dir name="pixlee_base_setup"><file name="mysql4-install-1.0.0.php" hash="219da3718bcbf86509c6be9609dd3ebb"/></dir></dir><file name="version.txt" hash="d925555f64cc9ab9d72f8702547e468d"/></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="pixlee"><file name="base.xml" hash="e0fb83dce0f81138137a5d320de1dd96"/></dir></dir><dir name="template"><dir name="pixlee"><dir name="system"><dir name="config"><file name="export_button.phtml" hash="cbd180213a7c271bbf7b99ce8278764d"/></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="pixlee"><file name="gallery.xml" hash="4b8d94d02025fb4ecf5f32d554e5492f"/></dir></dir><dir name="template"><dir name="pixlee"><file name="gallery.phtml" hash="5c3bfd7f33ed99585d7bb7500aab05d3"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="pixlee"><file name="base.css" hash="22234fd8f1606d2d8a440d9a037c7fe4"/><file name="pixlee_logo_133x24.png" hash="af22b06f1fbffc0cf9e640926e59b736"/></dir></dir></dir></dir></target><target name="magelib"><dir name="Pixlee"><file name="Pixlee.php" hash="de26fabb97c19ce7aa79ac429fcf1506"/></dir></target></contents>
|
56 |
-
<compatible/>
|
57 |
-
<dependencies><required><php><min>5.2.0</min><max>5.6.10</max></php></required></dependencies>
|
58 |
-
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
+
<package><name>Pixlee_Base</name><version>2.0.0.3</version><stability>stable</stability><license>MITL</license><channel>community</channel><extends></extends><summary>Pixlee extension to export products and capture cart events.</summary><description>This extension updates Pixlee's albums and products automatically with products created within Magento. Also, after setup, allows tracking of cart analytics.</description><notes>First requires configuration in System > Configuration > Pixlee Account Configuration.</notes><authors><author><name>Awad Sayeed</name><user>Pixlee</user><email>awad@pixleeteam.com</email></author></authors><date>2016-03-24</date><time>14:30:05</time><compatible></compatible><dependencies><required><php><min>5.2.0</min><max>5.6.10</max></php></required></dependencies><contents><target name="mage"><dir name="skin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="pixlee"><file name="base.css" hash="22234fd8f1606d2d8a440d9a037c7fe4"/><file name="pixlee_logo_133x24.png" hash="af22b06f1fbffc0cf9e640926e59b736"/></dir></dir></dir></dir></dir><dir name="lib"><dir name="Pixlee"><file name="Pixlee.php" hash="cc25da72b40fca1df3e905e7cce626f4"/></dir></dir><dir name="app"><dir name="etc"><dir name="modules"><file name="Pixlee_Base.xml" hash="d61d4914e77a6f00ecad4d1c08a69c01"/></dir></dir><dir name="design"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="pixlee"><file name="gallery.phtml" hash="5c3bfd7f33ed99585d7bb7500aab05d3"/></dir></dir><dir name="layout"><dir name="pixlee"><file name="gallery.xml" hash="6e7d730b61aada25d5d07c015dd2b7cc"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="pixlee"><dir name="system"><dir name="config"><file name="export_button.phtml" hash="cbd180213a7c271bbf7b99ce8278764d"/></dir></dir></dir></dir><dir name="layout"><dir name="pixlee"><file name="base.xml" hash="e0fb83dce0f81138137a5d320de1dd96"/></dir></dir></dir></dir></dir></dir><dir name="code"><dir name="community"><dir name="Pixlee"><dir name="Base"><file name="version.txt" hash="07c616195cb098893f6566357e031a15"/><dir name="etc"><file name="config.xml" hash="b777d966e0210846f8cbff579d884e69"/><file name="system.xml" hash="07b4c9d8fb738e7a954d9c6e3ea15129"/></dir><dir name="sql"><dir name="pixlee_base_setup"><file name="mysql4-install-1.0.0.php" hash="219da3718bcbf86509c6be9609dd3ebb"/></dir></dir><dir name="Helper"><file name="Data.php" hash="f09499f47501983b16b2b9125f11fd05"/></dir><dir name="controllers"><dir name="Pixlee"><file name="ExportController.php" hash="48eb932a2089646258d6b5ad6f744a5b"/></dir></dir><dir name="Block"><file name="Gallery.php" hash="aa893b2190f3fd683432dc4d16e3870f"/><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Form"><file name="Export.php" hash="a86d00b5a2e312a5bfdd856fd9ede257"/></dir></dir></dir></dir></dir><dir name="Model"><file name="Observer.php" hash="78b723dcf1a8719d8e08bb0e73ee6b4c"/><dir name="Resource"><file name="Setup.php" hash="a4f0721d4b19d19290e4999ef7ad327f"/><dir name="Product"><file name="Album.php" hash="a7f1e58ac017f183a2d1620d35645342"/></dir></dir><dir name="Product"><file name="Album.php" hash="1b415ff13e6fc9403e1149b327f9acb9"/></dir></dir><dir name="Test"><file name="autoload.php" hash="05ed6c18a3ee3f523c242312de048eef"/><dir name="Helper"><file name="Data.php" hash="97b4546146d750033aed7c6855ea6327"/><dir name="fixtures"><file name="testGetUnexportedProducts.yaml" hash="9575424d3b1061d07181a8e9b2aaa6f4"/><file name="testIsActive.yaml" hash="9d0b9138d8b919f203b9534585ea83ec"/><file name="testIsInactive.yaml" hash="630d629b1482583c5e250f6eed8769af"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="js"><dir name="pixlee"><file name="getAnalyticsCookie.js" hash="665ec62a65d6a0762f676de8909685d5"/></dir></dir></target></contents></package>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|