Bluecore_Integration - Version 1.0.3

Version Notes

- Added support for multishipping checkout
- Updated how bundled products are tracked

Download this release

Release Info

Developer Graham Gnall
Extension Bluecore_Integration
Version 1.0.3
Comparing to
See all releases


Version 1.0.3

Files changed (26) hide show
  1. app/code/community/Bluecore/Integration/Block/Cart.php +98 -0
  2. app/code/community/Bluecore/Integration/Block/Category.php +31 -0
  3. app/code/community/Bluecore/Integration/Block/Common/Abstract.php +36 -0
  4. app/code/community/Bluecore/Integration/Block/Head.php +12 -0
  5. app/code/community/Bluecore/Integration/Block/Product.php +248 -0
  6. app/code/community/Bluecore/Integration/Block/Search.php +17 -0
  7. app/code/community/Bluecore/Integration/Block/Success.php +73 -0
  8. app/code/community/Bluecore/Integration/Block/Test.php +42 -0
  9. app/code/community/Bluecore/Integration/Block/Wishlist.php +21 -0
  10. app/code/community/Bluecore/Integration/Helper/Data.php +6 -0
  11. app/code/community/Bluecore/Integration/Model/Observer.php +133 -0
  12. app/code/community/Bluecore/Integration/Model/System/Environment.php +12 -0
  13. app/code/community/Bluecore/Integration/etc/config.xml +119 -0
  14. app/code/community/Bluecore/Integration/etc/system.xml +57 -0
  15. app/design/frontend/base/default/layout/bluecore.xml +60 -0
  16. app/design/frontend/base/default/template/bluecore/cart.phtml +26 -0
  17. app/design/frontend/base/default/template/bluecore/category.phtml +6 -0
  18. app/design/frontend/base/default/template/bluecore/head.phtml +18 -0
  19. app/design/frontend/base/default/template/bluecore/minicart.phtml +19 -0
  20. app/design/frontend/base/default/template/bluecore/product.phtml +6 -0
  21. app/design/frontend/base/default/template/bluecore/search.phtml +6 -0
  22. app/design/frontend/base/default/template/bluecore/success.phtml +8 -0
  23. app/design/frontend/base/default/template/bluecore/test.phtml +30 -0
  24. app/design/frontend/base/default/template/bluecore/wishlist.phtml +9 -0
  25. app/etc/modules/Bluecore_Integration.xml +9 -0
  26. package.xml +22 -0
app/code/community/Bluecore/Integration/Block/Cart.php ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Bluecore_Integration_Block_Cart extends Bluecore_Integration_Block_Common_Abstract
3
+ {
4
+
5
+ // view cart
6
+ private function getCart()
7
+ {
8
+ return Mage::getSingleton('checkout/session')->getQuote();
9
+ }
10
+
11
+ public function getCartProductIds()
12
+ {
13
+ $products = array();
14
+ $cart = $this->getCart();
15
+
16
+ if ($cart) {
17
+ // getAllVisibleItems filters out nonvisible configurable products
18
+ foreach ($cart->getAllVisibleItems() as $cartItem) {
19
+ $product = $cartItem->getProduct();
20
+
21
+ if ($product->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE) {
22
+ // add included products for bundled product types
23
+ if ($product->hasCustomOptions()) {
24
+ $customOption = $product->getCustomOption('bundle_option_ids');
25
+ $optionIds = unserialize($customOption->getValue());
26
+ $options = $product->getTypeInstance(true)->getOptionsByIds($optionIds, $product);
27
+ $customOption = $product->getCustomOption('bundle_selection_ids');
28
+ $selectionIds = unserialize($customOption->getValue());
29
+ $selections = $product->getTypeInstance(true)->getSelectionsByIds($selectionIds, $product);
30
+ foreach ($selections->getItems() as $selection) {
31
+ if ($selection->isSalable()) {
32
+ $optionId = 'selection_qty_' . $selection->getSelectionId();
33
+ $selectionQty = $product->getCustomOption($optionId);
34
+ if ($selectionQty) {
35
+ $products[] = array(
36
+ id => $selection->getSku()
37
+ );
38
+ }
39
+ }
40
+ }
41
+ }
42
+ } else {
43
+ // all other product types
44
+ $products[] = array(
45
+ id => $product->getSku()
46
+ );
47
+ }
48
+ }
49
+ }
50
+
51
+ return $products;
52
+ }
53
+
54
+ public function getAddToCartProducts()
55
+ {
56
+ $addToCartProducts = Mage::getModel('core/session')->getAddToCartProducts();
57
+ if ($addToCartProducts) {
58
+ Mage::getModel('core/session')->unsAddToCartProducts();
59
+ return $addToCartProducts;
60
+ }
61
+ }
62
+
63
+ public function getRemoveFromCartProduct()
64
+ {
65
+ $removeFromCartProduct = Mage::getModel('core/session')->getRemoveFromCartProduct();
66
+ if ($removeFromCartProduct) {
67
+ Mage::getModel('core/session')->unsRemoveFromCartProduct();
68
+ return $removeFromCartProduct;
69
+ }
70
+ }
71
+
72
+ public function getAddToCartEventData($productId)
73
+ {
74
+ $data = array(
75
+ "id" => $productId
76
+ );
77
+
78
+ return $this->encodeEventData($data);
79
+ }
80
+
81
+ public function getRemoveFromCartEventData($product)
82
+ {
83
+ $data = array(
84
+ "id" => $product->getSku()
85
+ );
86
+
87
+ return $this->encodeEventData($data);
88
+ }
89
+
90
+ public function getViewCartEventData($productIds)
91
+ {
92
+ $data = array(
93
+ "productIds" => $productIds
94
+ );
95
+
96
+ return $this->encodeEventData($data);
97
+ }
98
+ }
app/code/community/Bluecore/Integration/Block/Category.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Bluecore_Integration_Block_Category extends Bluecore_Integration_Block_Common_Abstract
3
+ {
4
+ private function getCurrentCategoryName()
5
+ {
6
+ return $this->getCurrentCategory()->getName();
7
+ }
8
+
9
+ private function getBreadcrumbs()
10
+ {
11
+ $categoryNames = array();
12
+ $category = $this->getCurrentCategory();
13
+ if ($category) {
14
+ $categories = $category->getParentCategories();
15
+ foreach ($categories as $category) {
16
+ $categoryNames[] = $category->getName();
17
+ }
18
+ }
19
+ return join(',', $categoryNames);
20
+ }
21
+
22
+ public function eventData()
23
+ {
24
+ $data = array(
25
+ "category" => $this->getCurrentCategoryName(),
26
+ "breadcrumbs" => $this->getBreadcrumbs()
27
+ );
28
+
29
+ return $this->encodeEventData($data);
30
+ }
31
+ }
app/code/community/Bluecore/Integration/Block/Common/Abstract.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Bluecore_Integration_Block_Common_Abstract extends Mage_Core_Block_Template
3
+ {
4
+ public function isEnabled()
5
+ {
6
+ return Mage::getStoreConfig('bluecore/account/enabled');
7
+ }
8
+
9
+ public function getEnvironment()
10
+ {
11
+ return Mage::getStoreConfig('bluecore/account/environment');
12
+ }
13
+
14
+ public function getBluecoreNamespace()
15
+ {
16
+ return strtolower(Mage::getStoreConfig('bluecore/account/namespace'));
17
+ }
18
+
19
+ public function getCurrentProduct()
20
+ {
21
+ return Mage::registry('current_product');
22
+ }
23
+
24
+ public function getCurrentCategory()
25
+ {
26
+ return Mage::registry('current_category');
27
+ }
28
+
29
+ public function encodeEventData($data)
30
+ {
31
+ // $encodeOptions = JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_NUMERIC_CHECK;
32
+ $encodeOptions = JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_NUMERIC_CHECK;
33
+ $data = json_encode($data, $encodeOptions);
34
+ return $data;
35
+ }
36
+ }
app/code/community/Bluecore/Integration/Block/Head.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Bluecore_Integration_Block_Head extends Bluecore_Integration_Block_Common_Abstract
3
+ {
4
+ public function getIdentifyData()
5
+ {
6
+ $identifyData = Mage::getModel('core/session')->getIdentifyData();
7
+ if ($identifyData) {
8
+ Mage::getModel('core/session')->unsIdentifyData();
9
+ return $identifyData;
10
+ }
11
+ }
12
+ }
app/code/community/Bluecore/Integration/Block/Product.php ADDED
@@ -0,0 +1,248 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Bluecore_Integration_Block_Product extends Bluecore_Integration_Block_Common_Abstract
3
+ {
4
+ private function getProductType($product)
5
+ {
6
+ return $product->getTypeId();
7
+ }
8
+
9
+ private function skuId($product)
10
+ {
11
+ return trim($product->getSku());
12
+ }
13
+
14
+ private function name($product)
15
+ {
16
+ return trim($product->getName());
17
+ }
18
+
19
+ private function url($product)
20
+ {
21
+ return $product->getProductUrl();
22
+ }
23
+
24
+ private function price($product)
25
+ {
26
+ return $product->getFinalPrice();
27
+ }
28
+
29
+ private function originalPrice($product)
30
+ {
31
+ $price = $product->getPrice();
32
+ if ($product->getSpecialPrice() < $price) {
33
+ return $price;
34
+ }
35
+ }
36
+
37
+ private function image($product)
38
+ {
39
+ return $product->getImageUrl();
40
+ }
41
+
42
+ private function outOfStock($product)
43
+ {
44
+ return !($product->getStockItem()->getIsInStock());
45
+ }
46
+
47
+ private function inventory($product)
48
+ {
49
+ if ($product->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE) {
50
+ return null;
51
+ }
52
+ $stock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product);
53
+ $qty = $stock->getQty();
54
+ if ($qty > 0) {
55
+ return $qty;
56
+ }
57
+ }
58
+
59
+ private function category($product)
60
+ {
61
+ return $product->getCategory();
62
+ }
63
+
64
+ private function categoryName($product)
65
+ {
66
+ $category = $this->category($product);
67
+ if ($category) {
68
+ return $category->getName();
69
+ }
70
+ }
71
+
72
+ private function categories($product)
73
+ {
74
+ $categoryNames = array();
75
+ $catIds = $product->getCategoryIds();
76
+ foreach ($catIds as $catId) {
77
+ $category = Mage::getModel('catalog/category')->load($catId);
78
+ if ($category) {
79
+ $categoryNames[] = $category->getName();
80
+ }
81
+ }
82
+ return $categoryNames;
83
+ }
84
+
85
+ private function breadcrumbs($product)
86
+ {
87
+ $categoryNames = array();
88
+ $category = $this->category($product);
89
+ if ($category) {
90
+ $categories = $category->getParentCategories();
91
+ foreach ($categories as $category) {
92
+ $categoryNames[] = $category->getName();
93
+ }
94
+ }
95
+ return $categoryNames;
96
+ }
97
+
98
+ // Search and view events should only surface products where this is true
99
+ private function isVisible($product)
100
+ {
101
+ return $product->isVisibleInCatalog() && $product->isVisibleInSiteVisibility();
102
+ }
103
+
104
+ private function associatedProducts($product)
105
+ {
106
+ $products = array();
107
+ $productType = $product->getTypeInstance(true);
108
+ if ($product->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE) {
109
+ $collection = $productType->getUsedProducts(null, $product);
110
+ } elseif ($product->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE) {
111
+ $usedOptions = $productType->getOptionsIds($product);
112
+ $collection = $productType->getSelectionsCollection($usedOptions, $product);
113
+
114
+ //Mage::getResourceModel('bundle/selection')->getChildrenIds(447, false);
115
+
116
+ } elseif ($product->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_GROUPED) {
117
+ $collection = $productType->getAssociatedProductCollection($product);
118
+ }
119
+
120
+ if ($collection) {
121
+ foreach ($collection as $associatedProduct) {
122
+ $simpleproduct = Mage::getModel('catalog/product')->load($associatedProduct->getId());
123
+ $data = array(
124
+ "id" => $this->skuId($simpleproduct),
125
+ "name" => $this->name($simpleproduct),
126
+ "price" => $this->price($simpleproduct),
127
+ // "originalPrice" => $this->originalPrice($simpleproduct),
128
+ // Use product URL if viewable, otherwise return configurable product URL
129
+ "url" => $this->isVisible($simpleproduct) ? $this->url($simpleproduct) : $this->url($product),
130
+ // Use product image, or configurable if undefined
131
+ "image" => $this->image($simpleproduct) ? $this->image($simpleproduct) : $this->image($product),
132
+ "outOfStock" => $this->outOfStock($simpleproduct),
133
+ "inventory" => $this->inventory($simpleproduct),
134
+ "isVisible" => $this->isVisible($simpleproduct),
135
+ "type" => $this->getProductType($simpleproduct),
136
+ );
137
+
138
+ // add attributes such as size, color, width etc
139
+ $data = $this->addAttribuesToArray($data, $associatedProduct);
140
+
141
+ array_push($products, $data);
142
+ }
143
+ }
144
+
145
+ return $products;
146
+ }
147
+
148
+ private function includeAttribute($product, $attribute)
149
+ {
150
+ $blacklist = array(
151
+ 'price',
152
+ 'sku',
153
+ 'status',
154
+ 'name',
155
+ 'small_image_label',
156
+ 'image_label',
157
+ 'thumbnail_label',
158
+ 'description', // allow short_description
159
+ 'tax_class_id',
160
+ 'expected_shipping_date'
161
+ );
162
+ $isBlacklisted = in_array($attribute->getAttributeCode(), $blacklist);
163
+ $isVisibleOnFront = $attribute->getIsVisibleOnFront();
164
+ $isSearchable = $attribute->getData('is_searchable');
165
+ $isVisibleInSearch = $attribute->getData('is_visible_in_advanced_search');
166
+ $isFilterable = $attribute->getData('is_filterable');
167
+ $isFilterableSearch = $attribute->getData('is_filterable_in_search');
168
+ $isIndexed = $isSearchable || $isVisibleInSearch || $isFilterable || $isFilterableSearch;
169
+
170
+ return !$isBlacklisted && ($isIndexed || $isVisibleOnFront);
171
+ }
172
+
173
+ private function allAttributes($product)
174
+ {
175
+ $attributes = array();
176
+ foreach ($product->getAttributes() as $attribute) {
177
+ if ($this->includeAttribute($product, $attribute)) {
178
+ array_push($attributes, $attribute);
179
+ }
180
+ }
181
+ if ($product->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE) {
182
+ $cAttrs = $product->getTypeInstance(true)->getUsedProductAttributes($product);
183
+ foreach ($cAttrs as $attribute) {
184
+ if ($this->includeAttribute($product, $attribute)) {
185
+ array_push($attributes, $attribute);
186
+ }
187
+ }
188
+ }
189
+ return $attributes;
190
+ }
191
+
192
+ private function attributeNames($product)
193
+ {
194
+ $attributeNames = array();
195
+ foreach ($this->allAttributes($product) as $attribute) {
196
+ $attrCode = $attribute->getAttributeCode();
197
+ array_push($attributeNames, $attrCode);
198
+ }
199
+ return $attributeNames;
200
+ }
201
+
202
+ private function addAttribuesToArray($data, $product)
203
+ {
204
+ foreach ($this->allAttributes($product) as $attribute) {
205
+ $attrCode = $attribute->getAttributeCode();
206
+ $attrValue = $attribute->getFrontend()->getValue($product);
207
+ $ignoredValues = array(
208
+ Mage::helper('catalog')->__('N/A'),
209
+ Mage::helper('catalog')->__('No'),
210
+ 'no_selection'
211
+ );
212
+
213
+ if ($attrValue && !in_array($attrValue, $ignoredValues)) {
214
+ $data['attr_' . $attrCode] = $attrValue;
215
+ }
216
+ }
217
+ return $data;
218
+ }
219
+
220
+ public function eventData()
221
+ {
222
+ $product = $this->getCurrentProduct();
223
+ $data = array(
224
+ "id" => $this->skuId($product),
225
+ "name" => $this->name($product),
226
+ "price" => $this->price($product),
227
+ // "originalPrice" => $this->originalPrice($product),
228
+ "url" => $this->url($product),
229
+ "image" => $this->image($product),
230
+
231
+ "breadcrumbs" => $this->breadcrumbs($product),
232
+ "category" => $this->categoryName($product),
233
+ "categories" => $this->categories($product),
234
+ "outOfStock" => $this->outOfStock($product),
235
+ "inventory" => $this->inventory($product),
236
+ "isVisible" => $this->isVisible($product),
237
+ "type" => $this->getProductType($product),
238
+
239
+ "attributeVariations" => $this->attributeNames($product),
240
+ "variants" => $this->associatedProducts($product)
241
+ );
242
+
243
+ // Add product attributes
244
+ $data = $this->addAttribuesToArray($data, $product);
245
+
246
+ return $this->encodeEventData($data);
247
+ }
248
+ }
app/code/community/Bluecore/Integration/Block/Search.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Bluecore_Integration_Block_Search extends Bluecore_Integration_Block_Common_Abstract
3
+ {
4
+ private function getSearchText()
5
+ {
6
+ return Mage::helper('catalogsearch')->getQueryText();
7
+ }
8
+
9
+ public function eventData()
10
+ {
11
+ $data = array(
12
+ "searchTerm" => $this->getSearchText()
13
+ );
14
+
15
+ return $this->encodeEventData($data);
16
+ }
17
+ }
app/code/community/Bluecore/Integration/Block/Success.php ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Bluecore_Integration_Block_Success extends Bluecore_Integration_Block_Common_Abstract
3
+ {
4
+ private function getOrder($orderId)
5
+ {
6
+ $order = Mage::getModel('sales/order');
7
+ return $order->loadByIncrementId($orderId);
8
+ }
9
+
10
+ private function getCustomerEmail($order)
11
+ {
12
+ return $order->getCustomerEmail();
13
+ }
14
+
15
+ private function getTotal($order)
16
+ {
17
+ // $total = $order->getSubtotal(); // w/o tax (no shipping)
18
+ // $total = $order->getSubtotalInclTax(); // w/ tax (no shipping)
19
+ $total = $order->getGrandTotal(); // w/ tax and shipping (discounts applied)
20
+ return $total;
21
+ }
22
+
23
+ private function getProductIds($order)
24
+ {
25
+ $products = array();
26
+ foreach ($order->getAllVisibleItems() as $item) {
27
+ $childItems = $item->getChildrenItems();
28
+ if (!empty($childItems)) {
29
+ foreach ($childItems as $childItem) {
30
+ $products[] = array(id => $childItem->getSku());
31
+ }
32
+ } else {
33
+ $products[] = array(id => $item->getSku());
34
+ }
35
+ }
36
+
37
+ return $products;
38
+ }
39
+
40
+ private function getOrderIds()
41
+ {
42
+ $orderIds = Mage::getSingleton('core/session')->getOrderIds(true);
43
+ if ($orderIds) {
44
+ // get just the customer facing IDs
45
+ $orderIds = array_values($orderIds);
46
+ } else {
47
+ $singleOrderId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
48
+ $orderIds = array($singleOrderId);
49
+ }
50
+ return $orderIds;
51
+ }
52
+
53
+ public function ordersEventData()
54
+ {
55
+ $events = array();
56
+ foreach ($this->getOrderIds() as $orderId) {
57
+ // fetch order
58
+ $order = $this->getOrder($orderId);
59
+
60
+ $orderEvent = array(
61
+ "email" => $this->getCustomerEmail($order),
62
+ "total" => $this->getTotal($order),
63
+ "productIds" => $this->getProductIds($order),
64
+ "orderId" => $orderId,
65
+ );
66
+ $orderEvent = $this->encodeEventData($orderEvent);
67
+
68
+ $events[] = $orderEvent;
69
+ }
70
+
71
+ return $events;
72
+ }
73
+ }
app/code/community/Bluecore/Integration/Block/Test.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Bluecore_Integration_Block_Test extends Mage_Core_Block_Template
3
+ {
4
+
5
+
6
+ public function __construct()
7
+ {
8
+ parent::__construct();
9
+ // exit();
10
+
11
+ $this->execute();
12
+ $this->renderView();
13
+ }
14
+
15
+ public function execute()
16
+ {
17
+ Mage::getModel('core/session')->setAddToCartProduct(
18
+ new Varien_Object(array(
19
+ 'sku' => "BIMMEL + DMX"
20
+ ))
21
+ );
22
+ }
23
+
24
+ public function getAddToCartProduct()
25
+ {
26
+ $addToCartProduct = Mage::getModel('core/session')->getAddToCartProduct();
27
+ if ($addToCartProduct) {
28
+ Mage::getModel('core/session')->unsAddToCartProduct();
29
+ return $addToCartProduct;
30
+ }
31
+ }
32
+
33
+ public function getRemoveFromCartProduct()
34
+ {
35
+ $removeFromCartProduct = Mage::getModel('core/session')->getRemoveFromCartProduct();
36
+ if ($removeFromCartProduct) {
37
+ Mage::getModel('core/session')->unsRemoveFromCartProduct();
38
+ return $removeFromCartProduct;
39
+ }
40
+ }
41
+
42
+ }
app/code/community/Bluecore/Integration/Block/Wishlist.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Bluecore_Integration_Block_Wishlist extends Bluecore_Integration_Block_Common_Abstract
3
+ {
4
+ public function getWishlistProduct()
5
+ {
6
+ $wishlistProduct = Mage::getModel('core/session')->getWishlistProduct();
7
+ if ($wishlistProduct) {
8
+ Mage::getModel('core/session')->unsWishlistProduct();
9
+ return $wishlistProduct;
10
+ }
11
+ }
12
+
13
+ public function eventData($wishlistProduct)
14
+ {
15
+ $data = array(
16
+ "id" => $wishlistProduct->getSku()
17
+ );
18
+
19
+ return $this->encodeEventData($data);
20
+ }
21
+ }
app/code/community/Bluecore/Integration/Helper/Data.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Bluecore_Integration_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+
6
+ }
app/code/community/Bluecore/Integration/Model/Observer.php ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Bluecore_Integration_Model_Observer
4
+ {
5
+ public function setAddToCartProductId($observer)
6
+ {
7
+ $product = $observer->getProduct();
8
+
9
+ if (!$product->getSku()) {
10
+ return;
11
+ }
12
+
13
+ $productIdsAdded = array();
14
+
15
+ if ($product->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_GROUPED) {
16
+ $groupedProductIds = $observer->getRequest()->getParam('super_group');
17
+
18
+ function filterZeroQty($val)
19
+ {
20
+ return $val > 0;
21
+ }
22
+ // Filter to added products only
23
+ $groupedProductIds = array_keys(array_filter($groupedProductIds, "filterZeroQty"));
24
+
25
+ // Fetch products by internal ID to retrieve SKU IDs
26
+ $groupedProducts = Mage::getModel('catalog/product')
27
+ ->getCollection()
28
+ ->addAttributeToFilter('entity_id', array('in' => $groupedProductIds));
29
+ foreach ($groupedProducts as $product) {
30
+ $productIdsAdded[] = $product->getSku();
31
+ }
32
+ } elseif ($product->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE) {
33
+ // add included products for bundled product types
34
+ if ($product->hasCustomOptions()) {
35
+ $customOption = $product->getCustomOption('bundle_option_ids');
36
+ $optionIds = unserialize($customOption->getValue());
37
+ $options = $product->getTypeInstance(true)->getOptionsByIds($optionIds, $product);
38
+ $customOption = $product->getCustomOption('bundle_selection_ids');
39
+ $selectionIds = unserialize($customOption->getValue());
40
+ $selections = $product->getTypeInstance(true)->getSelectionsByIds($selectionIds, $product);
41
+ foreach ($selections->getItems() as $selection) {
42
+ if ($selection->isSalable()) {
43
+ $optionId = 'selection_qty_' . $selection->getSelectionId();
44
+ $selectionQty = $product->getCustomOption($optionId);
45
+ if ($selectionQty) {
46
+ $productIdsAdded[] = $selection->getSku();
47
+ }
48
+ }
49
+ }
50
+ }
51
+ } else {
52
+ // All other types
53
+ $productIdsAdded[] = $product->getSku();
54
+ }
55
+
56
+ // create a session variable named "AddToCartProduct" to store the product ID
57
+ if (!empty($productIdsAdded)) {
58
+ Mage::getModel('core/session')->setAddToCartProducts($productIdsAdded);
59
+ }
60
+ }
61
+
62
+ public function setRemoveFromCartProductId()
63
+ {
64
+ $id = (int)Mage::app()->getRequest()->getParam('id');
65
+ $cart = Mage::getSingleton('checkout/session')->getQuote();
66
+ $product = $cart->getItemById($id);
67
+
68
+ if (!$product->getSku()) {
69
+ return;
70
+ }
71
+
72
+ // create a session variable named "RemoveFromCartProduct" to store the product ID
73
+ Mage::getModel('core/session')->setRemoveFromCartProduct(
74
+ new Varien_Object(array(
75
+ 'sku' => $product->getSku()
76
+ ))
77
+ );
78
+ }
79
+
80
+ public function setWishlistProductId($observer)
81
+ {
82
+ $item = $observer['item'];
83
+ $product = $item->getProduct();
84
+ $option = $item->getOptionByCode('simple_product');
85
+
86
+ if ($option) {
87
+ // Fetch the simple product with configured options if available
88
+ $simpleProductId = $option->getValue();
89
+ $product = Mage::getModel('catalog/product')->load($simpleProductId);
90
+ }
91
+
92
+ if (!$product->getSku()) {
93
+ return;
94
+ }
95
+
96
+ // create a session variable named "WishlistProduct" to store the product ID
97
+ Mage::getModel('core/session')->setWishlistProduct(
98
+ new Varien_Object(array(
99
+ 'sku' => $product->getSku()
100
+ ))
101
+ );
102
+ }
103
+
104
+ private function setIdentifyData($email, $source)
105
+ {
106
+ Mage::getModel('core/session')->setIdentifyData(
107
+ new Varien_Object(array(
108
+ 'email' => $email,
109
+ 'source' => $source
110
+ ))
111
+ );
112
+ }
113
+
114
+ public function newSubscriptionIdentify()
115
+ {
116
+ $request = Mage::app()->getRequest();
117
+ $email = $request->getPost('email');
118
+
119
+ if ($email) {
120
+ $this->setIdentifyData($email, 'newsletter subscribe');
121
+ }
122
+ }
123
+
124
+ // New registrations will trigger this as well
125
+ public function loginIdentify($observer)
126
+ {
127
+ $customer = $observer->getCustomer();
128
+
129
+ if ($customer->getEmail()) {
130
+ $this->setIdentifyData($customer->getEmail(), 'login');
131
+ }
132
+ }
133
+ }
app/code/community/Bluecore/Integration/Model/System/Environment.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Bluecore_Integration_Model_System_Environment
3
+ {
4
+ public function toOptionArray()
5
+ {
6
+ return array(
7
+ array('value'=>'0', 'label'=>Mage::helper('bluecore')->__('Development')),
8
+ // Staging = 1 (Unused)
9
+ array('value'=>'2', 'label'=>Mage::helper('bluecore')->__('Production')),
10
+ );
11
+ }
12
+ }
app/code/community/Bluecore/Integration/etc/config.xml ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Bluecore_Integration>
5
+ <version>0.0.1</version>
6
+ </Bluecore_Integration>
7
+ </modules>
8
+ <global>
9
+ <helpers>
10
+ <bluecore>
11
+ <class>Bluecore_Integration_Helper</class>
12
+ </bluecore>
13
+ </helpers>
14
+ <models>
15
+ <bluecore>
16
+ <class>Bluecore_Integration_Model</class>
17
+ </bluecore>
18
+ </models>
19
+ <blocks>
20
+ <bluecore>
21
+ <class>Bluecore_Integration_Block</class>
22
+ </bluecore>
23
+ </blocks>
24
+ </global>
25
+ <frontend>
26
+ <layout>
27
+ <updates>
28
+ <bluecore>
29
+ <file>bluecore.xml</file>
30
+ </bluecore>
31
+ </updates>
32
+ </layout>
33
+ <events>
34
+ <checkout_cart_add_product_complete>
35
+ <observers>
36
+ <bluecore_add_to_cart>
37
+ <class>Bluecore_Integration_Model_Observer</class>
38
+ <method>setAddToCartProductId</method>
39
+ </bluecore_add_to_cart>
40
+ </observers>
41
+ </checkout_cart_add_product_complete>
42
+ <controller_action_predispatch_checkout_cart_delete>
43
+ <observers>
44
+ <bluecore_add_to_cart>
45
+ <class>Bluecore_Integration_Model_Observer</class>
46
+ <method>setRemoveFromCartProductId</method>
47
+ </bluecore_add_to_cart>
48
+ </observers>
49
+ </controller_action_predispatch_checkout_cart_delete>
50
+ <controller_action_predispatch_checkout_cart_ajaxDelete>
51
+ <observers>
52
+ <bluecore_ajax_remove_from_cart>
53
+ <class>Bluecore_Integration_Model_Observer</class>
54
+ <method>setRemoveFromCartProductId</method>
55
+ </bluecore_ajax_remove_from_cart>
56
+ </observers>
57
+ </controller_action_predispatch_checkout_cart_ajaxDelete>
58
+ <wishlist_add_product>
59
+ <observers>
60
+ <bluecore_add_to_wishlist>
61
+ <class>Bluecore_Integration_Model_Observer</class>
62
+ <method>setWishlistProductId</method>
63
+ </bluecore_add_to_wishlist>
64
+ </observers>
65
+ </wishlist_add_product>
66
+ <controller_action_postdispatch_newsletter_subscriber_new>
67
+ <observers>
68
+ <bluecore_newsletter_subscribe>
69
+ <class>Bluecore_Integration_Model_Observer</class>
70
+ <method>newSubscriptionIdentify</method>
71
+ </bluecore_newsletter_subscribe>
72
+ </observers>
73
+ </controller_action_postdispatch_newsletter_subscriber_new>
74
+ <customer_login>
75
+ <observers>
76
+ <bluecore_login_identify>
77
+ <class>Bluecore_Integration_Model_Observer</class>
78
+ <method>loginIdentify</method>
79
+ </bluecore_login_identify>
80
+ </observers>
81
+ </customer_login>
82
+ </events>
83
+ </frontend>
84
+ <admin>
85
+ <routers>
86
+ <adminhtml>
87
+ <args>
88
+ <modules>
89
+ <Bluecore_Integration after="Mage_Adminhtml">Bluecore_Integration</Bluecore_Integration>
90
+ </modules>
91
+ </args>
92
+ </adminhtml>
93
+ </routers>
94
+ </admin>
95
+ <adminhtml>
96
+ <acl>
97
+ <resources>
98
+ <all>
99
+ <title>Allow Everything</title>
100
+ </all>
101
+ <admin>
102
+ <children>
103
+ <system>
104
+ <children>
105
+ <config>
106
+ <children>
107
+ <bluecore>
108
+ <title>Bluecore Settings</title>
109
+ </bluecore>
110
+ </children>
111
+ </config>
112
+ </children>
113
+ </system>
114
+ </children>
115
+ </admin>
116
+ </resources>
117
+ </acl>
118
+ </adminhtml>
119
+ </config>
app/code/community/Bluecore/Integration/etc/system.xml ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <tabs>
4
+ <bluecore translate="label" module="bluecore">
5
+ <label>Bluecore</label>
6
+ <sort_order>300</sort_order>
7
+ </bluecore>
8
+ </tabs>
9
+ <sections>
10
+ <bluecore translate="label" module="bluecore">
11
+ <label>Integration</label>
12
+ <tab>bluecore</tab>
13
+ <sort_order>0</sort_order>
14
+ <show_in_default>1</show_in_default>
15
+ <show_in_website>1</show_in_website>
16
+ <show_in_store>1</show_in_store>
17
+ <groups>
18
+ <account translate="label" module="bluecore">
19
+ <label>Settings</label>
20
+ <frontend_type>text</frontend_type>
21
+ <sort_order>0</sort_order>
22
+ <show_in_default>1</show_in_default>
23
+ <show_in_website>1</show_in_website>
24
+ <show_in_store>1</show_in_store>
25
+ <fields>
26
+ <enabled translate="label">
27
+ <label>Enable</label>
28
+ <frontend_type>select</frontend_type>
29
+ <source_model>adminhtml/system_config_source_yesno</source_model>
30
+ <sort_order>10</sort_order>
31
+ <show_in_default>1</show_in_default>
32
+ <show_in_website>1</show_in_website>
33
+ <show_in_store>1</show_in_store>
34
+ </enabled>
35
+ <environment translate="label">
36
+ <label>Environment</label>
37
+ <frontend_type>select</frontend_type>
38
+ <source_model>bluecore/system_environment</source_model>
39
+ <sort_order>20</sort_order>
40
+ <show_in_default>1</show_in_default>
41
+ <show_in_website>1</show_in_website>
42
+ <show_in_store>1</show_in_store>
43
+ </environment>
44
+ <namespace translate="label">
45
+ <label>Account ID:</label>
46
+ <frontend_type>text</frontend_type>
47
+ <sort_order>30</sort_order>
48
+ <show_in_default>1</show_in_default>
49
+ <show_in_website>1</show_in_website>
50
+ <show_in_store>1</show_in_store>
51
+ </namespace>
52
+ </fields>
53
+ </account>
54
+ </groups>
55
+ </bluecore>
56
+ </sections>
57
+ </config>
app/design/frontend/base/default/layout/bluecore.xml ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <layout version="0.1.0">
3
+ <default>
4
+ <reference name="head">
5
+ <block type="bluecore/head" name="bluecore_head" template="bluecore/head.phtml"/>
6
+ </reference>
7
+
8
+ <reference name="header">
9
+ <reference name="minicart_head">
10
+ <reference name="minicart_content">
11
+ <reference name="cart_sidebar.cart_promotion">
12
+ <block type="bluecore/cart" name="bluecore_minicart" template="bluecore/minicart.phtml" />
13
+ </reference>
14
+ </reference>
15
+ </reference>
16
+ </reference>
17
+ </default>
18
+
19
+ <catalogsearch_result_index>
20
+ <reference name="head">
21
+ <block type="bluecore/search" name="bluecore_search" template="bluecore/search.phtml" />
22
+ </reference>
23
+ </catalogsearch_result_index>
24
+
25
+ <catalog_category_view>
26
+ <reference name="head">
27
+ <block type="bluecore/category" name="bluecore_category" template="bluecore/category.phtml" />
28
+ </reference>
29
+ </catalog_category_view>
30
+
31
+ <catalog_product_view>
32
+ <reference name="head">
33
+ <block type="bluecore/product" name="bluecore_product" template="bluecore/product.phtml" />
34
+ </reference>
35
+ </catalog_product_view>
36
+
37
+ <wishlist_index_index>
38
+ <reference name="head">
39
+ <block type="bluecore/wishlist" name="bluecore_wishlist" template="bluecore/wishlist.phtml" />
40
+ </reference>
41
+ </wishlist_index_index>
42
+
43
+ <checkout_cart_index>
44
+ <reference name="head">
45
+ <block type="bluecore/cart" name="bluecore_cart" template="bluecore/cart.phtml" />
46
+ </reference>
47
+ </checkout_cart_index>
48
+
49
+ <checkout_onepage_success>
50
+ <reference name="head">
51
+ <block type="bluecore/success" name="bluecore_success" template="bluecore/success.phtml" />
52
+ </reference>
53
+ </checkout_onepage_success>
54
+
55
+ <checkout_multishipping_success>
56
+ <reference name="head">
57
+ <block type="bluecore/success" name="bluecore_success" template="bluecore/success.phtml" />
58
+ </reference>
59
+ </checkout_multishipping_success>
60
+ </layout>
app/design/frontend/base/default/template/bluecore/cart.phtml ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ($this->isEnabled()) {
3
+ $addToCartProducts = $this->getAddToCartProducts();
4
+ $removeFromCartProduct = $this->getRemoveFromCartProduct();
5
+
6
+ if (!$addToCartProducts && !$removeFromCartProduct) {
7
+ // only fetch cart contents if no additions or removals
8
+ $cartProductIds = $this->getCartProductIds();
9
+ }
10
+
11
+ if ($addToCartProducts || $removeFromCartProduct || !empty($cartProductIds)) {
12
+ ?>
13
+ <script type="text/javascript">
14
+ _bluecoreTrack = window._bluecoreTrack || [];
15
+ <?php if ($addToCartProducts) { ?>
16
+ <?php foreach ($addToCartProducts as $productId) { ?>
17
+ _bluecoreTrack.push(["trackAddToCart", <?php echo $this->getAddToCartEventData($productId) ?>, <?php echo $this->getEnvironment() ?>]);
18
+ <?php } ?>
19
+ <?php } elseif ($removeFromCartProduct) { ?>
20
+ _bluecoreTrack.push(["trackRemoveFromCart", <?php echo $this->getRemoveFromCartEventData($removeFromCartProduct) ?>, <?php echo $this->getEnvironment() ?>]);
21
+ <?php } elseif (!empty($cartProductIds)) { ?>
22
+ _bluecoreTrack.push(["trackAddToCart", <?php echo $this->getViewCartEventData($cartProductIds) ?>, <?php echo $this->getEnvironment() ?>]);
23
+ <?php } ?>
24
+ </script>
25
+ <?php } ?>
26
+ <?php } ?>
app/design/frontend/base/default/template/bluecore/category.phtml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php if ($this->isEnabled()) { ?>
2
+ <script type="text/javascript">
3
+ _bluecoreTrack = window._bluecoreTrack || [];
4
+ _bluecoreTrack.push(["trackBrowseCategory", <?php echo $this->eventData() ?>, <?php echo $this->getEnvironment() ?>]);
5
+ </script>
6
+ <?php } ?>
app/design/frontend/base/default/template/bluecore/head.phtml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if ($this->isEnabled()) { ?>
2
+ <script type="text/javascript">
3
+ // Bluecore
4
+ var triggermail=triggermail||[];triggermail.load=function(a){var b=document.createElement("script");b.type="text/javascript";b.async=!0;b.src=("https:"===document.location.protocol?"https://":"http://")+"triggeredmail.appspot.com/triggermail.js/"+a+".js";a=document.getElementsByTagName("script")[0];a.parentNode.insertBefore(b,a)};triggermail.load("<?php echo $this->getBluecoreNamespace(); ?>");window.triggermail=triggermail;
5
+ </script>
6
+
7
+ <?php $identifyData = $this->getIdentifyData(); ?>
8
+ <?php if ($identifyData) { ?>
9
+ <script type="text/javascript">
10
+ _bluecoreTrack = window._bluecoreTrack || [];
11
+ _bluecoreTrack.push(["trackIdentify", {
12
+ 'email': '<?php echo $identifyData->getEmail() ?>',
13
+ 'source': '<?php echo $identifyData->getSource() ?>',
14
+ }, 2]);
15
+ </script>
16
+ <?php } ?>
17
+
18
+ <?php } ?>
app/design/frontend/base/default/template/bluecore/minicart.phtml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ($this->isEnabled()) {
3
+ $addToCartProducts = $this->getAddToCartProducts();
4
+ $removeFromCartProduct = $this->getRemoveFromCartProduct();
5
+
6
+ if ($addToCartProducts || $removeFromCartProduct) {
7
+ ?>
8
+ <script type="text/javascript">
9
+ _bluecoreTrack = window._bluecoreTrack || [];
10
+ <?php if ($addToCartProducts) { ?>
11
+ <?php foreach ($addToCartProducts as $productId) { ?>
12
+ _bluecoreTrack.push(["trackAddToCart", <?php echo $this->getAddToCartEventData($productId) ?>, <?php echo $this->getEnvironment() ?>]);
13
+ <?php } ?>
14
+ <?php } elseif ($removeFromCartProduct) { ?>
15
+ _bluecoreTrack.push(["trackRemoveFromCart", <?php echo $this->getRemoveFromCartEventData($removeFromCartProduct) ?>, <?php echo $this->getEnvironment() ?>]);
16
+ <?php } ?>
17
+ </script>
18
+ <?php } ?>
19
+ <?php } ?>
app/design/frontend/base/default/template/bluecore/product.phtml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php if ($this->isEnabled()) { ?>
2
+ <script type="text/javascript">
3
+ _bluecoreTrack = window._bluecoreTrack || [];
4
+ _bluecoreTrack.push(["trackProductView", <?php echo $this->eventData() ?>, <?php echo $this->getEnvironment() ?>]);
5
+ </script>
6
+ <?php } ?>
app/design/frontend/base/default/template/bluecore/search.phtml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php if ($this->isEnabled()) { ?>
2
+ <script type="text/javascript">
3
+ _bluecoreTrack = window._bluecoreTrack || [];
4
+ _bluecoreTrack.push(["trackSearch", <?php echo $this->eventData() ?>, <?php echo $this->getEnvironment() ?>]);
5
+ </script>
6
+ <?php } ?>
app/design/frontend/base/default/template/bluecore/success.phtml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php if ($this->isEnabled()) { ?>
2
+ <script type="text/javascript">
3
+ _bluecoreTrack = window._bluecoreTrack || [];
4
+ <?php foreach ($this->ordersEventData() as $orderEventData) { ?>
5
+ _bluecoreTrack.push(["trackCheckout", <?php echo $orderEventData ?>, <?php echo $this->getEnvironment() ?>]);
6
+ <?php } ?>
7
+ </script>
8
+ <?php } ?>
app/design/frontend/base/default/template/bluecore/test.phtml ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Test
4
+ *
5
+ * @var Bluecore_Integration_Block_Test $this
6
+ */
7
+ ?>
8
+
9
+
10
+ <script type="text/javascript">
11
+ var message = "TEST.phtml " + +(new Date());
12
+ alert(message);
13
+ console.warn(message);
14
+ </script>
15
+
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
+ Spooky!
24
+
25
+ <!-- <img src="http://magento.local/media/catalog/product/cache/1/thumbnail/180x/9df78eab33525d08d6e5fb8d27136e95/a/c/ace001_1.jpg" alt="Jackie O Round Sunglasses" title="BIMMEL"> -->
26
+
27
+
28
+ <?php
29
+ // echo $this->getChildHtml('bluecore_test')
30
+ ?>
app/design/frontend/base/default/template/bluecore/wishlist.phtml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php if ($this->isEnabled()) { ?>
2
+ <?php $wishlistProduct = $this->getWishlistProduct(); ?>
3
+ <?php if ($wishlistProduct) { ?>
4
+ <script type="text/javascript">
5
+ _bluecoreTrack = window._bluecoreTrack || [];
6
+ _bluecoreTrack.push(["trackWishlist", <?php echo $this->eventData($wishlistProduct) ?>, <?php echo $this->getEnvironment() ?>]);
7
+ </script>
8
+ <?php } ?>
9
+ <?php } ?>
app/etc/modules/Bluecore_Integration.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Bluecore_Integration>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Bluecore_Integration>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Bluecore_Integration</name>
4
+ <version>1.0.3</version>
5
+ <stability>stable</stability>
6
+ <license>gpl</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Your behavioral and product data in one system, powering immediate marketing actions as unique as your customers.</summary>
10
+ <description>&lt;p&gt;Bluecore combines terabytes of behavioral and catalog data to produce powerful insights, drive industry-defying conversion rates and personalize customer experiences. Our real-time interaction management system provides workflows for personalized and effective multi-channel communication with your customers.&lt;/p&gt;&#xD;
11
+ &lt;p&gt;The Bluecore integration with Magento enables customers to quickly and easily implement Bluecore technology on their storefront. The extension automatically deploys Bluecore tracking across the site, collecting vast amounts of customer behavioral data and replicating your entire catalog for product recommendations, notifications and audience insights. Setup the entire Bluecore product suite in just a few easy steps.&lt;/p&gt;&#xD;
12
+ &lt;p&gt;&lt;strong&gt;Features&lt;/strong&gt;&lt;/p&gt;&#xD;
13
+ &lt;ul&gt;&lt;li&gt;Behavioral event tracking&lt;/li&gt;&lt;li&gt;&lt;span&gt;Catalog Replication&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span&gt;Behavioral triggers: Abandoned view, search and cart&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span&gt;Product notification triggers: Back in stock, price drop, new arrivals&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span&gt;Product recommendations in email&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span&gt;Predictive audience generation and insights&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span&gt;Audience syncing to Paid Search, Paid Social, Display and Personalization platforms&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;</description>
14
+ <notes>- Added support for multishipping checkout&#xD;
15
+ - Updated how bundled products are tracked</notes>
16
+ <authors><author><name>Graham Gnall</name><user>bluecore</user><email>graham@bluecore.com</email></author><author><name>Brian Immel</name><user>bimmel</user><email>brian@bluecore.com</email></author></authors>
17
+ <date>2017-01-25</date>
18
+ <time>23:04:51</time>
19
+ <contents><target name="magecommunity"><dir name="Bluecore"><dir name="Integration"><dir name="Block"><file name="Cart.php" hash="01256a56481263e340a629a3f7970494"/><file name="Category.php" hash="aa6a9d71e3a2acccfc6399af12a38cf8"/><dir name="Common"><file name="Abstract.php" hash="124679948572d619b65037083b5388bc"/></dir><file name="Head.php" hash="cc30087f357883bfa17e9ce94df3f098"/><file name="Product.php" hash="3d1d89b00659afd4d99ab3f5ee62c866"/><file name="Search.php" hash="41bf7dac23efce9d0bb0714f03edd726"/><file name="Success.php" hash="0d6774482a687d4b01686154a15d9ed1"/><file name="Test.php" hash="0e574cfaad4c14e7cf3e56f195cba3ad"/><file name="Wishlist.php" hash="e5ff4ecfe652913830f08ec8fb5781ad"/></dir><dir name="Helper"><file name="Data.php" hash="f8dbf7d94cd102ef6734c34857a306f4"/></dir><dir name="Model"><file name="Observer.php" hash="922e56469a774811a7c72ff644584112"/><dir name="System"><file name="Environment.php" hash="19a9d2bbea517a6e18f32adf53716375"/></dir></dir><dir name="etc"><file name="config.xml" hash="c61c481d398fa36c79bd78b87dff881f"/><file name="system.xml" hash="d971fef7b6c455bbdd08a844bfff832c"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="bluecore.xml" hash="69f68d97c3137f0bb2667eafe5eebe91"/></dir><dir name="template"><dir name="bluecore"><file name="cart.phtml" hash="23529fe1827f7f32caa5d499fc4d212f"/><file name="category.phtml" hash="cf00d37c0ecb4943ef501efbdd8b3478"/><file name="head.phtml" hash="c7f49bedb00b9a9144ac4cea8a6f4e24"/><file name="minicart.phtml" hash="2427299f66a67a776f7d0bd929a49536"/><file name="product.phtml" hash="bde794f488c1a681cf663b099473bfcd"/><file name="search.phtml" hash="e4943fc17b677b63c40f95de8c36e55d"/><file name="success.phtml" hash="98c7999c12d3817294fb69c5b1d6eb9a"/><file name="test.phtml" hash="c5812381866cc000665a0db41a6c4c9f"/><file name="wishlist.phtml" hash="74887b4e5cb9af0c30a31b5b9cea4e14"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Bluecore_Integration.xml" hash="1d480a96bbe276fce4d988b24bc911d3"/></dir></target></contents>
20
+ <compatible/>
21
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php><package><name>Mage_Core_Modules</name><channel>community</channel><min>1.8</min><max/></package><package><name>Mage_Core_Modules</name><channel>enterprise</channel><min>1.13</min><max/></package></required></dependencies>
22
+ </package>