visual-merchandising-product-listing-campaign-creator - Version 1.2.0

Version Notes

Any questions or concerns, please email cs@tagalys.com and we will get back to you in less than 24 hours.

Download this release

Release Info

Developer Palani
Extension visual-merchandising-product-listing-campaign-creator
Version 1.2.0
Comparing to
See all releases


Code changes from version 1.1.1 to 1.2.0

app/code/community/Tagalys/Analytics/Block/Productview.php ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?php
2
+ class Tagalys_Analytics_Block_Productview extends Mage_Catalog_Block_Product_View {
3
+
4
+ }
app/code/community/Tagalys/Analytics/Model/Observer.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Tagalys_Analytics_Model_Observer extends Varien_Object {
3
+ public function addToCart(Varien_Event_Observer $observer) {
4
+ try {
5
+ $mainProduct = $observer->getProduct();
6
+ $productType = $mainProduct->getTypeId();
7
+ $analyticsCookieData = array(1 /* cookie format version */, 'product_action', 'add_to_cart', array(array(Mage::app()->getRequest()->getParam('qty', 1), $mainProduct->getId())));
8
+ if ($productType == 'configurable') {
9
+ $simpleProduct = $observer->getEvent()->getQuoteItem()->getProduct();
10
+ $analyticsCookieData[3][0][] = $simpleProduct->getId();
11
+ }
12
+ Mage::getModel('core/cookie')->set('__ta_event', json_encode($analyticsCookieData));
13
+ } catch (Exception $e) {
14
+
15
+ }
16
+ }
17
+
18
+ public function orderSuccess(Varien_Event_Observer $observer) {
19
+ try {
20
+ $orderIds = $observer->getEvent()->getOrderIds();
21
+ if (empty($orderIds) || !is_array($orderIds)) {
22
+ return;
23
+ }
24
+ $orderId = $orderIds[0];
25
+ $order = Mage::getModel('sales/order')->load($orderId);
26
+ $analyticsCookieData = array(1 /* cookie format version */, 'product_action', 'buy', array(), $orderId);
27
+
28
+ $returnItems = array();
29
+ foreach($order->getAllItems() as $item){
30
+ $qty = $item->getQtyToShip();
31
+ $product = $item->getProduct();
32
+ if ($product->getTypeId() == 'simple') {
33
+ $parentId = Mage::getModel('catalog/product_type_configurable')->getParentIdsByChild($product->getId());
34
+ if(isset($parentId[0])) {
35
+ $configurableProduct = Mage::getModel('catalog/product')->load($parentId[0]);
36
+ $analyticsCookieData[3][] = array((int)$item->getQtyOrdered(), $configurableProduct->getId(), $product->getId());
37
+ } else {
38
+ $analyticsCookieData[3][] = array((int)$item->getQtyOrdered(), $product->getId());
39
+ }
40
+ }
41
+ }
42
+ Mage::register('tagalys_analytics_event', json_encode($analyticsCookieData));
43
+ } catch (Exception $e) {
44
+
45
+ }
46
+ }
47
+ }
app/code/community/Tagalys/Analytics/controllers/IndexController.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Tagalys_Analytics_IndexController extends Mage_Core_Controller_Front_Action {
3
+
4
+ public function detailsAction() {
5
+ $data = json_decode(Mage::app()->getRequest()->getParam('event_json'), true);
6
+ $productsData = array();
7
+ if ($data[1] == 'product_action') {
8
+ if ($data[2] == 'add_to_cart' || $data[2] == 'buy') {
9
+ for($i = 0; $i < count($data[3]); $i++) {
10
+ $productsData[] = $this->getProductDetails($data[3][$i]);
11
+ }
12
+ }
13
+ }
14
+ echo json_encode($productsData);
15
+ }
16
+
17
+ public function getProductDetails($details) {
18
+ $mainProduct = Mage::getModel('catalog/product')->load($details[1]);
19
+ $productDetails = array(
20
+ 'sku' => $mainProduct->getSku(),
21
+ 'quantity' => $details[0]
22
+ );
23
+ $noOfItems = count($details);
24
+ if ($noOfItems == 3) {
25
+ $configurableAttributes = array();
26
+ foreach ($mainProduct->getTypeInstance(true)->getConfigurableAttributes($mainProduct) as $attribute) {
27
+ $configurableAttributes[] = $attribute->getProductAttribute()->getAttributeCode();
28
+ }
29
+ $simpleProduct = Mage::getModel('catalog/product')->load($details[2]);
30
+ $product_data = new stdClass();
31
+ $simpleProductAttributes = Mage::getModel("tagalys_core/productDetails")->getProductAttributes($simpleProduct->getId(), Mage::app()->getStore()->getId(), array_keys((array) $product_data));
32
+ $configurableSimpleProductAttributes = array();
33
+ for ($i = 0; $i < count($simpleProductAttributes); $i++) {
34
+ if (in_array($simpleProductAttributes[$i]['tag_set']['id'], $configurableAttributes)) {
35
+ $configurableSimpleProductAttributes[] = $simpleProductAttributes[$i];
36
+ }
37
+ }
38
+ if (count($configurableSimpleProductAttributes) > 0) {
39
+ $productDetails['__tags'] = $configurableSimpleProductAttributes;
40
+ }
41
+ }
42
+ return $productDetails;
43
+ }
44
+
45
+ }
app/code/community/Tagalys/Analytics/etc/config.xml ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Tagalys_Analytics>
5
+ <version>0.1.0</version>
6
+ </Tagalys_Analytics>
7
+ </modules>
8
+ <frontend>
9
+ <layout>
10
+ <updates>
11
+ <tagalys_analytics>
12
+ <file>tagalys_analytics.xml</file>
13
+ </tagalys_analytics>
14
+ </updates>
15
+ </layout>
16
+ <routers>
17
+ <tagalys_tanalytics>
18
+ <use>standard</use>
19
+ <args>
20
+ <module>Tagalys_Analytics</module>
21
+ <frontName>tanalytics</frontName>
22
+ </args>
23
+ </tagalys_tanalytics>
24
+ </routers>
25
+ </frontend>
26
+ <global>
27
+ <blocks>
28
+ <analytics>
29
+ <class>Tagalys_Analytics_Block</class>
30
+ </analytics>
31
+ </blocks>
32
+ <models>
33
+ <analytics>
34
+ <class>Tagalys_Analytics_Model</class>
35
+ </analytics>
36
+ </models>
37
+ <events>
38
+ <checkout_cart_product_add_after>
39
+ <observers>
40
+ <checkout_cart_product_add_after_handler>
41
+ <type>singleton</type>
42
+ <class>analytics/observer</class>
43
+ <method>addToCart</method>
44
+ <args></args>
45
+ </checkout_cart_product_add_after_handler>
46
+ </observers>
47
+ </checkout_cart_product_add_after>
48
+ <checkout_onepage_controller_success_action>
49
+ <observers>
50
+ <checkout_onepage_controller_success_action_handler>
51
+ <type>singleton</type>
52
+ <class>analytics/observer</class>
53
+ <method>orderSuccess</method>
54
+ <args></args>
55
+ </checkout_onepage_controller_success_action_handler>
56
+ </observers>
57
+ </checkout_onepage_controller_success_action>
58
+ </events>
59
+ </global>
60
+ </config>
app/code/community/Tagalys/Core/Block/Adminhtml/Tagalys/Edit/Tab/Syncsettings.php CHANGED
@@ -39,8 +39,13 @@ class Tagalys_Core_Block_Adminhtml_Tagalys_Edit_Tab_Syncsettings extends Mage_Ad
39
  $setup_status = Mage::getModel('tagalys_core/config')->getTagalysConfig('setup_status');
40
  if ($setup_status == 'complete') {
41
  } else {
42
- $fieldset->addField('note_cron', 'note', array(
43
- 'text' => $this->__('<small><b>NOTE: Please make sure Cron is setup and running. <a target=_blank href="http://devdocs.magento.com/guides/m1x/install/installing_install.html#install-cron">Cron Documentation</a></b></small>'),
 
 
 
 
 
44
  ));
45
 
46
  $fieldset->addField('agree_start_sync', 'checkbox', array(
@@ -48,10 +53,14 @@ class Tagalys_Core_Block_Adminhtml_Tagalys_Edit_Tab_Syncsettings extends Mage_Ad
48
  'checked' => false,
49
  'onclick' => 'this.value = this.checked ? 1 : 0;',
50
  'disabled' => false,
51
- 'after_element_html' => '<small>I agree to start syncing the selected stores.<br><em>We recommend you to do this at low traffic hours.</em><br><em>Please enable the checkbox to save and start syncing.</em></small>',
52
  'tabindex' => 1
53
  ));
54
 
 
 
 
 
55
  $fieldset->addField('submit', 'submit', array(
56
  'name' => 'tagalys_submit_action',
57
  'value' => 'Save & Start Sync',
39
  $setup_status = Mage::getModel('tagalys_core/config')->getTagalysConfig('setup_status');
40
  if ($setup_status == 'complete') {
41
  } else {
42
+ $fieldset->addField('agree_cron_enabled', 'checkbox', array(
43
+ 'name' => 'Checkbox',
44
+ 'checked' => false,
45
+ 'onclick' => 'this.value = this.checked ? 1 : 0;',
46
+ 'disabled' => false,
47
+ 'after_element_html' => '<small>Cron is enabled on this Magento installation.<br><em><b><a target=_blank href="http://devdocs.magento.com/guides/m1x/install/installing_install.html#install-cron">Cron Documentation</a></b></em></small>',
48
+ 'tabindex' => 1
49
  ));
50
 
51
  $fieldset->addField('agree_start_sync', 'checkbox', array(
53
  'checked' => false,
54
  'onclick' => 'this.value = this.checked ? 1 : 0;',
55
  'disabled' => false,
56
+ 'after_element_html' => '<small>I agree to start syncing the selected stores.<br><em><b>We recommend you to do this at low traffic hours.</b></em></small>',
57
  'tabindex' => 1
58
  ));
59
 
60
+ $fieldset->addField('note_checkboxes', 'note', array(
61
+ 'text' => $this->__('<em>Please check both checkboxes to continue.</em>'),
62
+ ));
63
+
64
  $fieldset->addField('submit', 'submit', array(
65
  'name' => 'tagalys_submit_action',
66
  'value' => 'Save & Start Sync',
app/code/community/Tagalys/Core/Helper/Service.php CHANGED
@@ -2,7 +2,7 @@
2
  class Tagalys_Core_Helper_Service extends Mage_Core_Helper_Abstract {
3
  protected $_storeId;
4
 
5
- public function getProductPayload($product_id, $store_id, $admin = false) {
6
  $core_helper = Mage::helper('tagalys_core');
7
  $details_model = Mage::getModel("tagalys_core/productDetails");
8
 
@@ -13,9 +13,12 @@ class Tagalys_Core_Helper_Service extends Mage_Core_Helper_Abstract {
13
  Mage::app()->setCurrentStore($store_id);
14
  $attributes = $details_model->getProductAttributes($product_id, $store_id, array_keys((array) $product_data));
15
  $product_data = $details_model->getProductFields($product_id, $store_id);
16
- $product_data->synced_at = $time_now;
17
  $product_data->__tags = $attributes;
18
 
 
 
 
 
19
  return $product_data;
20
  }
21
 
2
  class Tagalys_Core_Helper_Service extends Mage_Core_Helper_Abstract {
3
  protected $_storeId;
4
 
5
+ public function getProductPayload($product_id, $store_id) {
6
  $core_helper = Mage::helper('tagalys_core');
7
  $details_model = Mage::getModel("tagalys_core/productDetails");
8
 
13
  Mage::app()->setCurrentStore($store_id);
14
  $attributes = $details_model->getProductAttributes($product_id, $store_id, array_keys((array) $product_data));
15
  $product_data = $details_model->getProductFields($product_id, $store_id);
 
16
  $product_data->__tags = $attributes;
17
 
18
+ if (!$forAnalytics) {
19
+ $product_data->synced_at = $time_now;
20
+ }
21
+
22
  return $product_data;
23
  }
24
 
app/code/community/Tagalys/Core/Model/ProductDetails.php CHANGED
@@ -4,7 +4,7 @@ class Tagalys_Core_Model_ProductDetails extends Mage_Core_Model_Abstract {
4
  protected $syncfield;
5
  protected $inventorySyncField;
6
 
7
- public function getProductFields($productId, $store = null) {
8
  try {
9
  $this->_storeId = $store;
10
  $core_helper = Mage::helper('tagalys_core');
@@ -43,6 +43,7 @@ class Tagalys_Core_Model_ProductDetails extends Mage_Core_Model_Abstract {
43
  $productFields->price = $product->getPrice();
44
  }
45
 
 
46
  $productFields->image_url = Mage::getModel('catalog/product_media_config')->getMediaUrl( $product->getImage());
47
  $fields = array('created_at');
48
  foreach ($fields as $key => $name) {
@@ -51,15 +52,13 @@ class Tagalys_Core_Model_ProductDetails extends Mage_Core_Model_Abstract {
51
  $introduced_at->setTimeZone(new DateTimeZone('UTC'));
52
  $productFields->introduced_at = $introduced_at->format(DateTime::ATOM);
53
  }
54
-
55
- // $productFields->parent_id = $this->getProductParent($productId);
56
  $productFields->in_stock = Mage::getModel('catalog/product')->load($product->getId())->isSaleable();
57
 
58
  return $productFields;
59
 
60
  } catch (Exception $e) {
61
 
62
- }
63
  }
64
  public function getProductType($productId) {
65
  $product = Mage::getModel('catalog/product')->load($productId);
4
  protected $syncfield;
5
  protected $inventorySyncField;
6
 
7
+ public function getProductFields($productId, $store) {
8
  try {
9
  $this->_storeId = $store;
10
  $core_helper = Mage::helper('tagalys_core');
43
  $productFields->price = $product->getPrice();
44
  }
45
 
46
+ $product_data->synced_at = $time_now;
47
  $productFields->image_url = Mage::getModel('catalog/product_media_config')->getMediaUrl( $product->getImage());
48
  $fields = array('created_at');
49
  foreach ($fields as $key => $name) {
52
  $introduced_at->setTimeZone(new DateTimeZone('UTC'));
53
  $productFields->introduced_at = $introduced_at->format(DateTime::ATOM);
54
  }
 
 
55
  $productFields->in_stock = Mage::getModel('catalog/product')->load($product->getId())->isSaleable();
56
 
57
  return $productFields;
58
 
59
  } catch (Exception $e) {
60
 
61
+ }
62
  }
63
  public function getProductType($productId) {
64
  $product = Mage::getModel('catalog/product')->load($productId);
app/code/community/Tagalys/Core/etc/config.xml CHANGED
@@ -6,7 +6,7 @@
6
  <tagalys>
7
  <package>
8
  <name>Mpages</name>
9
- <version>1.1.1</version>
10
  </package>
11
  </tagalys>
12
  </default>
6
  <tagalys>
7
  <package>
8
  <name>Mpages</name>
9
+ <version>1.2.0</version>
10
  </package>
11
  </tagalys>
12
  </default>
app/design/frontend/base/default/layout/tagalys_analytics.xml ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <catalog_product_view translate="label">
4
+ <reference name="content">
5
+ <block type="analytics/productview" name="analytics_productview" template="tagalys_analytics/product_view.phtml"></block>
6
+ </reference>
7
+ </catalog_product_view>
8
+ <default>
9
+ <reference name="content">
10
+ <block type="core/template" name="tagalys_trackcookie" template="tagalys_analytics/track_cookie.phtml" />
11
+ </reference>
12
+ </default>
13
+ </layout>
app/design/frontend/base/default/layout/tagalys_search_suggestions.xml CHANGED
@@ -2,7 +2,7 @@
2
  <layout version="0.1.0">
3
  <default>
4
  <reference name="content">
5
- <block type="core/template" template="tagalys_search_suggestions/search_suggestions.phtml" name="tagalys_search_suggestions" />
6
  </reference>
7
  </default>
8
  </layout>
2
  <layout version="0.1.0">
3
  <default>
4
  <reference name="content">
5
+ <block type="core/template" name="tagalys_search_suggestions" template="tagalys_search_suggestions/search_suggestions.phtml" />
6
  </reference>
7
  </default>
8
  </layout>
app/design/frontend/base/default/template/tagalys_analytics/product_view.phtml ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $eventDetails = false;
3
+ try {
4
+ $eventDetails = array(
5
+ 'action' => 'view',
6
+ 'sku' => $this->getProduct()->getSku()
7
+ );
8
+ } catch (Exception $e) {
9
+ // don't log this as it might happen too often
10
+ }
11
+ ?>
12
+ <?php if ($eventDetails != false): ?>
13
+ <script>
14
+ try {
15
+ (function( $ ) {
16
+ jQuery(function() {
17
+ jQuery.fn.tagalys_analytics.track_event('product_action', <?php echo json_encode($eventDetails) ?>);
18
+ });
19
+ }( jQuery ));
20
+ }
21
+ catch(err) {
22
+
23
+ }
24
+ </script>
25
+ <?php endif; ?>
app/design/frontend/base/default/template/tagalys_analytics/track_cookie.phtml ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $analyticsEvent = false;
3
+ try {
4
+ $analyticsEvent = Mage::getModel('core/cookie')->get('__ta_event');
5
+ if ($analyticsEvent == false) {
6
+ $analyticsEvent = Mage::registry('tagalys_analytics_event');
7
+ }
8
+ if ($analyticsEvent != false) {
9
+ $analyticsEvent = json_decode($analyticsEvent, true);
10
+ Mage::getModel('core/cookie')->delete('__ta_event');
11
+ }
12
+ } catch (Exception $e) {
13
+ // don't log this as it might happen too often
14
+ }
15
+ ?>
16
+ <?php if ($analyticsEvent != false): ?>
17
+ <script>
18
+ try {
19
+ (function( $ ) {
20
+ $(function() {
21
+ $.ajax({
22
+ url: "<?php echo Mage::getUrl('tanalytics/index/details/'); ?>",
23
+ data: { event_json: '<?php echo json_encode($analyticsEvent) ?>' },
24
+ dataType: 'json',
25
+ method: 'POST',
26
+ context: <?php echo json_encode($analyticsEvent) ?>,
27
+ success: function(data, textStatus, jqXHR) {
28
+ for (var i = 0; i < this[3].length; i++) {
29
+ if (this[2] == 'buy') {
30
+ $.fn.tagalys_analytics.track_event(this[1], $.extend({ action: this[2], order_id: this[4] }, data[i]));
31
+ } else {
32
+ $.fn.tagalys_analytics.track_event(this[1], $.extend({ action: this[2] }, data[i]));
33
+ }
34
+ }
35
+ }
36
+ });
37
+ });
38
+ }( jQuery ));
39
+ }
40
+ catch(err) {
41
+
42
+ }
43
+ </script>
44
+ <?php endif; ?>
app/design/frontend/base/default/template/tagalys_search_suggestions/search_suggestions.phtml CHANGED
@@ -12,71 +12,76 @@
12
 
13
  <script>
14
  (function( $ ) {
15
- $.fn.tagalys_search_suggestions.search_link = function( q, qf, qin ) {
16
- var categories_base_url = "<?php echo Mage::getBaseUrl(); ?>catalog/category/view/id/";
17
- var tagalys_search_base_url = "<?php echo Mage::getUrl('tsearch'); ?>?q=";
18
- var magento_search_base_url = "<?php echo Mage::helper('catalogsearch')->getResultUrl(""); ?>";
19
- if (typeof(qf) == 'undefined' || $.isEmptyObject(qf)) {
20
- <?php if($tagalys_search_enabled): ?>
21
- return (tagalys_search_base_url + encodeURIComponent(q));
22
- <?php else: ?>
23
- return (magento_search_base_url + encodeURIComponent(q));
24
- <?php endif; ?>
25
- } else {
26
- <?php if($tagalys_search_enabled): ?>
27
- str = Object.keys(qf).map(function(key){
28
- return encodeURIComponent(key) + "-"+ encodeURIComponent(qf[key]);
29
- }).join('~');
30
- qf_param = encodeURIComponent("qf") + '=' + str;
 
31
 
32
- return tagalys_search_base_url.concat(encodeURIComponent(q) +"&"+qf_param);
33
- <?php else: ?>
34
- if (typeof(qin) == "undefined" ) {
35
- if (typeof(qf) != "undefined" && qf.hasOwnProperty("__categories")) {
36
- return categories_base_url+Number(qf["__categories"]);
 
37
  }
38
- }
39
- var str = Object.keys(qf).map(function(key){
40
- if(key == "__categories")
41
- keyword = "cat";
42
- else
43
- keyword = key;
44
- return encodeURIComponent(keyword) + '=' + encodeURIComponent(qf[key]);
45
- }).join('&');
46
- return magento_search_base_url.concat(encodeURIComponent(q) +"&"+str);
47
- <?php endif ?>
48
- }
49
- };
50
- $.fn.tagalys_search_suggestions.popular_searches = function() {
51
- <?php
52
- try {
53
- $popular_searches = Mage::getModel('tagalys_core/config')->getTagalysConfig('store:'.Mage::app()->getStore()->getId().':popular_searches');
54
- if ($popular_searches) {
55
- echo 'return ' . $popular_searches . ';';
56
- } else {
 
 
57
  echo 'return [];';
58
  }
59
- } catch (Exception $e) {
60
- echo 'return [];';
61
- }
 
 
 
 
 
 
62
  ?>
63
- };
64
- <?php
65
- $api_credentials = json_decode(Mage::getModel('tagalys_core/config')->getTagalysConfig("api_credentials"), true);
66
- ?>
67
- $.fn.tagalys_public_api.server = '<?php echo $api_credentials['api_server'] ?>';
68
- $.fn.tagalys_public_api.identification = {"client_code":"<?php echo $api_credentials['client_code'] ?>","api_key":"<?php echo $api_credentials['public_api_key'] ?>","store_id":"<?php echo Mage::app()->getStore()->getStoreId() ?>"};
69
- <?php
70
- $currency = Mage::helper('search_suggestions')->getCurrentCurrency();
71
- ?>
72
- $('#search').tagalys_search_suggestions({
73
- currency: {
74
- label: "<?php echo $currency[0]['label']; ?>",
75
- exchange_rate: "<?php echo $currency[0]['exchange_rate']; ?>",
76
- fractional_digits:"<?php echo $currency[0]['fractional_digits']; ?>"
77
- },
78
- track: 'asynchronous'
79
- });
80
  }( jQuery ));
81
  </script>
82
  <?php endif ?>
12
 
13
  <script>
14
  (function( $ ) {
15
+ try {
16
+ $.fn.tagalys_search_suggestions.search_link = function( q, qf, qin ) {
17
+ var categories_base_url = "<?php echo Mage::getBaseUrl(); ?>catalog/category/view/id/";
18
+ var tagalys_search_base_url = "<?php echo Mage::getUrl('tsearch'); ?>?q=";
19
+ var magento_search_base_url = "<?php echo Mage::helper('catalogsearch')->getResultUrl(""); ?>";
20
+ if (typeof(qf) == 'undefined' || $.isEmptyObject(qf)) {
21
+ <?php if($tagalys_search_enabled): ?>
22
+ return (tagalys_search_base_url + encodeURIComponent(q));
23
+ <?php else: ?>
24
+ return (magento_search_base_url + encodeURIComponent(q));
25
+ <?php endif; ?>
26
+ } else {
27
+ <?php if($tagalys_search_enabled): ?>
28
+ str = Object.keys(qf).map(function(key){
29
+ return encodeURIComponent(key) + "-"+ encodeURIComponent(qf[key]);
30
+ }).join('~');
31
+ qf_param = encodeURIComponent("qf") + '=' + str;
32
 
33
+ return tagalys_search_base_url.concat(encodeURIComponent(q) +"&"+qf_param);
34
+ <?php else: ?>
35
+ if (typeof(qin) == "undefined" ) {
36
+ if (typeof(qf) != "undefined" && qf.hasOwnProperty("__categories")) {
37
+ return categories_base_url+Number(qf["__categories"]);
38
+ }
39
  }
40
+ var str = Object.keys(qf).map(function(key){
41
+ if(key == "__categories")
42
+ keyword = "cat";
43
+ else
44
+ keyword = key;
45
+ return encodeURIComponent(keyword) + '=' + encodeURIComponent(qf[key]);
46
+ }).join('&');
47
+ return magento_search_base_url.concat(encodeURIComponent(q) +"&"+str);
48
+ <?php endif ?>
49
+ }
50
+ };
51
+ $.fn.tagalys_search_suggestions.popular_searches = function() {
52
+ <?php
53
+ try {
54
+ $popular_searches = Mage::getModel('tagalys_core/config')->getTagalysConfig('store:'.Mage::app()->getStore()->getId().':popular_searches');
55
+ if ($popular_searches) {
56
+ echo 'return ' . $popular_searches . ';';
57
+ } else {
58
+ echo 'return [];';
59
+ }
60
+ } catch (Exception $e) {
61
  echo 'return [];';
62
  }
63
+ ?>
64
+ };
65
+ <?php
66
+ $api_credentials = json_decode(Mage::getModel('tagalys_core/config')->getTagalysConfig("api_credentials"), true);
67
+ ?>
68
+ $.fn.tagalys_public_api.server = '<?php echo $api_credentials['api_server'] ?>';
69
+ $.fn.tagalys_public_api.identification = {"client_code":"<?php echo $api_credentials['client_code'] ?>","api_key":"<?php echo $api_credentials['public_api_key'] ?>","store_id":"<?php echo Mage::app()->getStore()->getStoreId() ?>"};
70
+ <?php
71
+ $currency = Mage::helper('search_suggestions')->getCurrentCurrency();
72
  ?>
73
+ $('#search').tagalys_search_suggestions({
74
+ currency: {
75
+ label: "<?php echo $currency[0]['label']; ?>",
76
+ exchange_rate: "<?php echo $currency[0]['exchange_rate']; ?>",
77
+ fractional_digits:"<?php echo $currency[0]['fractional_digits']; ?>"
78
+ },
79
+ track: 'asynchronous'
80
+ });
81
+ }
82
+ catch(err) {
83
+
84
+ }
 
 
 
 
 
85
  }( jQuery ));
86
  </script>
87
  <?php endif ?>
app/etc/modules/Tagalys_Analytics.xml ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version = "1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Tagalys_Analytics>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ <version>0.1.0</version>
8
+ </Tagalys_Analytics>
9
+ </modules>
10
+ </config>
11
+
js/tagalys-configuration.js CHANGED
@@ -1,8 +1,13 @@
1
  document.addEventListener("DOMContentLoaded", function (e) {
2
- if(typeof($$("#tagalys_admin_core_agree_start_sync")[0]) != "undefined") {
3
- $$("#tagalys_admin_core_agree_start_sync")[0].on("change", function () {
4
- // alert($$("#tagalys_admin_core_agree_start_sync")[0].value);
5
- document.getElementById('tagalys_admin_core_submit').disabled = !document.getElementById('tagalys_admin_core_submit').disabled;
6
- });
 
 
7
  }
8
- });
 
 
 
1
  document.addEventListener("DOMContentLoaded", function (e) {
2
+ if(typeof($$("#tagalys_admin_core_agree_cron_enabled")[0]) != "undefined" && typeof($$("#tagalys_admin_core_agree_start_sync")[0]) != "undefined") {
3
+ document.getElementById('tagalys_admin_core_agree_cron_enabled').onclick = tagalysCheckAndEnableSyncButton;
4
+ document.getElementById('tagalys_admin_core_agree_start_sync').onclick = tagalysCheckAndEnableSyncButton;
5
+ // $$("#tagalys_admin_core_agree_start_sync")[0].on("change", function () {
6
+ // // alert($$("#tagalys_admin_core_agree_start_sync")[0].value);
7
+ // document.getElementById('tagalys_admin_core_submit').disabled = !document.getElementById('tagalys_admin_core_submit').disabled;
8
+ // });
9
  }
10
+ });
11
+ function tagalysCheckAndEnableSyncButton() {
12
+ document.getElementById('tagalys_admin_core_submit').disabled = !(document.getElementById('tagalys_admin_core_agree_cron_enabled').checked && document.getElementById('tagalys_admin_core_agree_start_sync').checked);
13
+ }
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>visual-merchandising-product-listing-campaign-creator</name>
4
- <version>1.1.1</version>
5
  <stability>stable</stability>
6
  <license>Tagalys</license>
7
  <channel>community</channel>
@@ -12,9 +12,9 @@
12
  Visual Merchandising allows you to to create, modify or delete product listing pages that can be used from campaigns in SEO, SEM, Social Media and show collections at your online store. Visual Merchandisers do not require any assistance from IT or Tech teams allowing them to focus on managing the platform.</description>
13
  <notes>Any questions or concerns, please email cs@tagalys.com and we will get back to you in less than 24 hours. </notes>
14
  <authors><author><name>Palani</name><user>Palani</user><email>pc@tagalys.com</email></author></authors>
15
- <date>2017-04-20</date>
16
- <time>10:54:55</time>
17
- <contents><target name="mageetc"><dir><dir name="modules"><file name="Tagalys_Core.xml" hash="7576ed5aa125c580f0b791018f24a0e9"/><file name="Tagalys_SearchSuggestions.xml" hash="dbf6f4ff1859ef2df72560c9282af435"/><file name="Tagalys_Search.xml" hash="820b96f53d2f0e86cb49906a4dda7f41"/><file name="Tagalys_Mpages.xml" hash="6ccb4f45669c98fd746c6abd92ab32ca"/></dir></dir></target><target name="magecommunity"><dir><dir name="Tagalys"><dir name="Core"><dir name="Block"><dir name="Adminhtml"><dir name="Tagalys"><dir name="Edit"><file name="Form.php" hash="31cae34d1e9bd5cb0c881ae5a6fc03c0"/><dir name="Tab"><file name="Apicredentials.php" hash="9005c30790a51ad077cb4be46a07b766"/><file name="Mpages.php" hash="ba526eb77efd4000ae96404bd04aa638"/><file name="Search.php" hash="fef14680d0feb63bb4e928296c3b9032"/><file name="Searchsuggestions.php" hash="5c87af24ad22c663da17e0a1ffe9a655"/><file name="Support.php" hash="c68547cfe57cbccdcbcf7c3eb35ed6b3"/><file name="Sync.php" hash="849f7bb77ff568e7f29cf63d54e7faa8"/><file name="Syncsettings.php" hash="eecdbdee1c7b3a0e7b978f46b6879acc"/><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><file name="Tabs.php" hash="20d85d9037ba7a885c33030657900c88"/><file name=".DS_Store" hash="711f187349473a2c6e6d564d4a2faeb9"/></dir><file name="Edit.php" hash="9da04e9a4aec76ce5f5bd88c453390cd"/><file name=".DS_Store" hash="2f95379345a665b8fd261ff7c2f5a7af"/></dir><file name=".DS_Store" hash="96cf5cac0d87be80da73c36e96971923"/></dir><file name=".DS_Store" hash="8c5a4cb1f6f8e10ade87d78ff4d0bfe4"/></dir><dir name="Helper"><file name="Data.php" hash="a58dbfb1712015d7c4097c5efd4c8ad4"/><file name="Service.php" hash="7eda8b6e644818b607c122d80ba2f68d"/><file name="SyncFile.php" hash="5b60934e482b5d2332e7eae44c907a72"/></dir><dir name="Model"><file name="Client.php" hash="30e1a58406d31c97bc249acc8ebeee9c"/><file name="Config.php" hash="784ee62e5d029503f915bfdaf9cff003"/><dir name="Mysql4"><dir name="Config"><file name="Collection.php" hash="0967ac6ac1a049d9e09288641d2b4a58"/></dir><file name="Config.php" hash="3562b9ffdf260e34945f9e7830facc1b"/><dir name="Queue"><file name="Collection.php" hash="db01d5b412ca3f8cbc1cbbe8b1ed3d0d"/></dir><file name="Queue.php" hash="50fd814880c6adf02dcb9babe5874811"/><file name=".DS_Store" hash="d3dec31675796dca442be9f6076210df"/></dir><file name="Observer.php" hash="9197f6fb573484db244c141607872b95"/><file name="ProductDetails.php" hash="0e06fa7061b325734554b05f81673201"/><file name="Queue.php" hash="459a74e66f2a7ccd146f480701574464"/><file name=".DS_Store" hash="3db11e65f616ba2524ebf71cf1300fa5"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="TagalysController.php" hash="ae3d1b6cc8d229e98130704b8e010e17"/></dir><file name="SyncfilesController.php" hash="1b8476cbb4d02ec87b7742e4dc9fff4b"/><file name=".DS_Store" hash="db462bf5da1a15c73197a0fefd3f5b51"/></dir><dir name="etc"><file name="config.xml" hash="428df3c01ee2ec6067bf65ec72ec3fea"/></dir><dir name="sql"><dir name="tagalys_core_setup"><file name="mysql4-install-0.3.0.php" hash="fca9f934db6850d950dfdcd71dba7dcd"/><file name="mysql4-upgrade-0.1.0-0.3.0.php" hash="1eb2da3bdf0753b6f4904f1fd62af32f"/><file name="mysql4-upgrade-0.2.0-0.3.0.php" hash="1eb2da3bdf0753b6f4904f1fd62af32f"/></dir><file name=".DS_Store" hash="d87f0e93ae82377a5ceeda9bd58740e8"/></dir><file name=".DS_Store" hash="d1024e81b6252a3d102a906452f53021"/></dir><dir name="SearchSuggestions"><dir name="Helper"><file name="Data.php" hash="a88adfc9f92bb01b4fdb851ea4f265d3"/></dir><dir name="Model"><file name="Observer.php" hash="73e90449054eac498e3b4dfd55db33f1"/></dir><dir name="etc"><file name="config.xml" hash="1e1ee26e326c03473e5854f5dae06c59"/></dir></dir><dir name="Search"><dir name="controllers"><file name="IndexController.php" hash="baaeb347db3b8d32d09a83d3369388a8"/></dir><dir name="etc"><file name="config.xml" hash="5e5a0a2d2de927241c1e97f435a382f7"/></dir><file name=".DS_Store" hash="822777d708619165d544d3256174adc2"/></dir><dir name="Mpages"><dir name="controllers"><file name="IndexController.php" hash="1d80e73a3e3d2a51cff12ebbe1b1364e"/></dir><dir name="etc"><file name="config.xml" hash="80d1b3c82d4da93c271376881f663db5"/></dir><file name=".DS_Store" hash="822777d708619165d544d3256174adc2"/></dir></dir></dir></target><target name="magedesign"><dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="tagalys_core.xml" hash="a0875951441399a46dfb5cb3d346b7d8"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="tagalys_search_suggestions.xml" hash="fc80c019c80782d9b956553c56f236e1"/></dir><dir name="template"><dir name="tagalys_search_suggestions"><file name="search_suggestions.phtml" hash="b55dbbb4f333ca8351772a3c4f2102ea"/></dir><dir name="tagalys_search"><file name="index.phtml" hash="45947e71dd01470b5d1664a7e7eaa5bd"/></dir><dir name="tagalys_mpages"><file name="index.phtml" hash="8ad2aeed80bc1d9b86649ac34e5eaa2f"/></dir></dir></dir></dir></dir></dir></target><target name="mageskin"><dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="css"><dir name="tagalys"><file name="tagalys-configuration.css" hash="fa3b8f3a4d1bebbbcef261f10e4652b7"/></dir></dir><dir name="images"><dir name="tagalys"><file name="tagalys-logo.png" hash="b26278b173e29b21edc16ddd06ca0192"/></dir></dir></dir></dir></dir></dir></target><target name="mage"><dir><dir name="js"><file name="tagalys-configuration.js" hash="310c28a4b52225884d06a9e596758053"/></dir></dir></target></contents>
18
  <compatible/>
19
  <dependencies><required><php><min>5.3.0</min><max>7.0.10</max></php></required></dependencies>
20
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>visual-merchandising-product-listing-campaign-creator</name>
4
+ <version>1.2.0</version>
5
  <stability>stable</stability>
6
  <license>Tagalys</license>
7
  <channel>community</channel>
12
  Visual Merchandising allows you to to create, modify or delete product listing pages that can be used from campaigns in SEO, SEM, Social Media and show collections at your online store. Visual Merchandisers do not require any assistance from IT or Tech teams allowing them to focus on managing the platform.</description>
13
  <notes>Any questions or concerns, please email cs@tagalys.com and we will get back to you in less than 24 hours. </notes>
14
  <authors><author><name>Palani</name><user>Palani</user><email>pc@tagalys.com</email></author></authors>
15
+ <date>2017-04-28</date>
16
+ <time>17:37:57</time>
17
+ <contents><target name="mageetc"><dir><dir name="modules"><file name="Tagalys_Core.xml" hash="7576ed5aa125c580f0b791018f24a0e9"/><file name="Tagalys_SearchSuggestions.xml" hash="dbf6f4ff1859ef2df72560c9282af435"/><file name="Tagalys_Search.xml" hash="820b96f53d2f0e86cb49906a4dda7f41"/><file name="Tagalys_Mpages.xml" hash="6ccb4f45669c98fd746c6abd92ab32ca"/><file name="Tagalys_Analytics.xml" hash="59ce2628610a4624235a5c820beac2d2"/></dir></dir></target><target name="magecommunity"><dir><dir name="Tagalys"><dir name="Core"><dir name="Block"><dir name="Adminhtml"><dir name="Tagalys"><dir name="Edit"><file name="Form.php" hash="31cae34d1e9bd5cb0c881ae5a6fc03c0"/><dir name="Tab"><file name="Apicredentials.php" hash="9005c30790a51ad077cb4be46a07b766"/><file name="Mpages.php" hash="ba526eb77efd4000ae96404bd04aa638"/><file name="Search.php" hash="fef14680d0feb63bb4e928296c3b9032"/><file name="Searchsuggestions.php" hash="5c87af24ad22c663da17e0a1ffe9a655"/><file name="Support.php" hash="c68547cfe57cbccdcbcf7c3eb35ed6b3"/><file name="Sync.php" hash="849f7bb77ff568e7f29cf63d54e7faa8"/><file name="Syncsettings.php" hash="77ecb1594c7b409e2055ff8394b85aa8"/><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><file name="Tabs.php" hash="20d85d9037ba7a885c33030657900c88"/><file name=".DS_Store" hash="711f187349473a2c6e6d564d4a2faeb9"/></dir><file name="Edit.php" hash="9da04e9a4aec76ce5f5bd88c453390cd"/><file name=".DS_Store" hash="2f95379345a665b8fd261ff7c2f5a7af"/></dir><file name=".DS_Store" hash="96cf5cac0d87be80da73c36e96971923"/></dir><file name=".DS_Store" hash="8c5a4cb1f6f8e10ade87d78ff4d0bfe4"/></dir><dir name="Helper"><file name="Data.php" hash="a58dbfb1712015d7c4097c5efd4c8ad4"/><file name="Service.php" hash="94f22f59fb9f6a8f021695ce18d02aec"/><file name="SyncFile.php" hash="5b60934e482b5d2332e7eae44c907a72"/></dir><dir name="Model"><file name="Client.php" hash="30e1a58406d31c97bc249acc8ebeee9c"/><file name="Config.php" hash="784ee62e5d029503f915bfdaf9cff003"/><dir name="Mysql4"><dir name="Config"><file name="Collection.php" hash="0967ac6ac1a049d9e09288641d2b4a58"/></dir><file name="Config.php" hash="3562b9ffdf260e34945f9e7830facc1b"/><dir name="Queue"><file name="Collection.php" hash="db01d5b412ca3f8cbc1cbbe8b1ed3d0d"/></dir><file name="Queue.php" hash="50fd814880c6adf02dcb9babe5874811"/><file name=".DS_Store" hash="d3dec31675796dca442be9f6076210df"/></dir><file name="Observer.php" hash="9197f6fb573484db244c141607872b95"/><file name="ProductDetails.php" hash="9ee376662c3551a3e531262905fe057e"/><file name="Queue.php" hash="459a74e66f2a7ccd146f480701574464"/><file name=".DS_Store" hash="3db11e65f616ba2524ebf71cf1300fa5"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="TagalysController.php" hash="ae3d1b6cc8d229e98130704b8e010e17"/></dir><file name="SyncfilesController.php" hash="1b8476cbb4d02ec87b7742e4dc9fff4b"/><file name=".DS_Store" hash="db462bf5da1a15c73197a0fefd3f5b51"/></dir><dir name="etc"><file name="config.xml" hash="2efe8ad14f494f8c8fe36c9b8734f963"/></dir><dir name="sql"><dir name="tagalys_core_setup"><file name="mysql4-install-0.3.0.php" hash="fca9f934db6850d950dfdcd71dba7dcd"/><file name="mysql4-upgrade-0.1.0-0.3.0.php" hash="1eb2da3bdf0753b6f4904f1fd62af32f"/><file name="mysql4-upgrade-0.2.0-0.3.0.php" hash="1eb2da3bdf0753b6f4904f1fd62af32f"/></dir><file name=".DS_Store" hash="d87f0e93ae82377a5ceeda9bd58740e8"/></dir><file name=".DS_Store" hash="d1024e81b6252a3d102a906452f53021"/></dir><dir name="SearchSuggestions"><dir name="Helper"><file name="Data.php" hash="a88adfc9f92bb01b4fdb851ea4f265d3"/></dir><dir name="Model"><file name="Observer.php" hash="73e90449054eac498e3b4dfd55db33f1"/></dir><dir name="etc"><file name="config.xml" hash="1e1ee26e326c03473e5854f5dae06c59"/></dir></dir><dir name="Search"><dir name="controllers"><file name="IndexController.php" hash="baaeb347db3b8d32d09a83d3369388a8"/></dir><dir name="etc"><file name="config.xml" hash="5e5a0a2d2de927241c1e97f435a382f7"/></dir><file name=".DS_Store" hash="822777d708619165d544d3256174adc2"/></dir><dir name="Mpages"><dir name="controllers"><file name="IndexController.php" hash="1d80e73a3e3d2a51cff12ebbe1b1364e"/></dir><dir name="etc"><file name="config.xml" hash="80d1b3c82d4da93c271376881f663db5"/></dir><file name=".DS_Store" hash="822777d708619165d544d3256174adc2"/></dir><dir name="Analytics"><dir name="Block"><file name="Productview.php" hash="117109f50c13a14efc4d5740d9e1eace"/></dir><dir name="Model"><file name="Observer.php" hash="650e1c3bacab113e25958af98195de51"/></dir><dir name="controllers"><file name="IndexController.php" hash="eb9aa135e201be33671b11838df576c6"/></dir><dir name="etc"><file name="config.xml" hash="ad31a8918cafb214865a7e55fad09383"/></dir></dir></dir></dir></target><target name="magedesign"><dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="tagalys_core.xml" hash="a0875951441399a46dfb5cb3d346b7d8"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="tagalys_search_suggestions.xml" hash="d2747d9b9047e64a3072d88bfd6ced73"/><file name="tagalys_analytics.xml" hash="118011a85efeff3dc83370777b40082c"/></dir><dir name="template"><dir name="tagalys_search_suggestions"><file name="search_suggestions.phtml" hash="eccd95a4ed035215986831383d6ca738"/></dir><dir name="tagalys_search"><file name="index.phtml" hash="45947e71dd01470b5d1664a7e7eaa5bd"/></dir><dir name="tagalys_mpages"><file name="index.phtml" hash="8ad2aeed80bc1d9b86649ac34e5eaa2f"/></dir><dir name="tagalys_analytics"><file name="product_view.phtml" hash="1506f400ebab1f39c5e4d4c294911fb0"/><file name="track_cookie.phtml" hash="8e1e120aeead1a80a92762be1fea7ab1"/></dir></dir></dir></dir></dir></dir></target><target name="mageskin"><dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="css"><dir name="tagalys"><file name="tagalys-configuration.css" hash="fa3b8f3a4d1bebbbcef261f10e4652b7"/></dir></dir><dir name="images"><dir name="tagalys"><file name="tagalys-logo.png" hash="b26278b173e29b21edc16ddd06ca0192"/></dir></dir></dir></dir></dir></dir></target><target name="mage"><dir><dir name="js"><file name="tagalys-configuration.js" hash="e32466267eb8e54a32119ac8e49c6589"/></dir></dir></target></contents>
18
  <compatible/>
19
  <dependencies><required><php><min>5.3.0</min><max>7.0.10</max></php></required></dependencies>
20
  </package>