unbxd_recommendation - Version 1.0.17

Version Notes

pdp top sellers fix

Download this release

Release Info

Developer ananthesh
Extension unbxd_recommendation
Version 1.0.17
Comparing to
See all releases


Code changes from version 1.0.16 to 1.0.17

Files changed (32) hide show
  1. app/code/local/Unbxd/Recommendation/Helper/Feedhelper.php +1 -44
  2. app/code/local/Unbxd/Recommendation/Model/Api/Task/Widget.php +5 -2
  3. app/code/local/Unbxd/Recommendation/Model/Config.php +15 -3
  4. app/code/local/Unbxd/Recommendation/Model/Feed/Feedcreator.php +228 -131
  5. app/code/local/Unbxd/Recommendation/Model/Feed/Feedmanager.php +41 -20
  6. app/code/local/Unbxd/Recommendation/Model/Feed/Jsonbuilder/Productbuilder.php +1 -1
  7. app/code/local/Unbxd/Recommendation/Model/Feed/Tags.php +32 -0
  8. app/code/local/Unbxd/Recommendation/Model/Observer.php +47 -35
  9. app/code/local/Unbxd/Recommendation/Model/Resource/Config.php +56 -10
  10. app/code/local/Unbxd/Recommendation/Model/Resource/Field.php +2 -0
  11. app/code/local/Unbxd/Recommendation/Model/Resource/Product/Collection.php +82 -0
  12. app/code/local/Unbxd/Recommendation/Model/Resource/Sync.php +17 -0
  13. app/code/local/Unbxd/Recommendation/Model/Resource/Sync/Collection.php +53 -0
  14. app/code/local/Unbxd/Recommendation/Model/Sync.php +117 -0
  15. app/code/local/Unbxd/Recommendation/controllers/ConfigController.php +8 -2
  16. app/code/local/Unbxd/Recommendation/etc/config.xml +47 -1
  17. app/code/local/Unbxd/Recommendation/sql/unbxd_recommendation_setup/upgrade-1.0.11-1.0.12.php +4 -4
  18. app/code/local/Unbxd/Recommendation/sql/unbxd_recommendation_setup/upgrade-1.0.16-1.0.17.php +22 -0
  19. app/etc/modules/Unbxd_Recommendation.xml +8 -4
  20. package.xml +4 -4
  21. skin/adminhtml/default/default/unbxd/img/drop-down.png +0 -0
  22. skin/adminhtml/default/default/unbxd/img/saved.png +0 -0
  23. skin/adminhtml/default/default/unbxd/js/app/analytics.js +56 -0
  24. skin/adminhtml/default/default/unbxd/js/app/catalog.js +384 -0
  25. skin/adminhtml/default/default/unbxd/js/app/credentails.js +139 -0
  26. skin/adminhtml/default/default/unbxd/js/app/utils.js +33 -0
  27. skin/adminhtml/default/default/unbxd/js/app/widgets.js +25 -0
  28. skin/adminhtml/default/default/unbxd/js/lib/backbone.js +1 -0
  29. skin/adminhtml/default/default/unbxd/js/lib/ractive-backbone.js +1 -0
  30. skin/adminhtml/default/default/unbxd/js/lib/require.js +36 -0
  31. skin/adminhtml/default/default/unbxd/js/lib/underscore.js +5 -0
  32. skin/adminhtml/default/default/unbxd/js/main.js +253 -0
app/code/local/Unbxd/Recommendation/Helper/Feedhelper.php CHANGED
@@ -72,50 +72,6 @@ class Unbxd_Recommendation_Helper_Feedhelper extends Unbxd_Recommendation_Helper
72
  return $categoryValues;
73
  }
74
 
75
- public function getCatLevel2(Mage_Core_Model_Website $website, $category_ids, $catlevel1Categories = null) {
76
- if(is_null($catlevel1Categories)) {
77
- $catlevel1Categories = $this->getCatLevel1($website, $category_ids);
78
- }
79
- $catlevel1Ids = array_keys($catlevel1Categories);
80
- $catlevel1 = array();
81
- foreach($category_ids as $category_id) {
82
- $category = $this->getCategory($category_id);
83
- $parentIds = $category->getParentIds();
84
-
85
- if(!is_null($category) &&
86
- $this->array_match($category->getParentId(), $catlevel1Ids)) {
87
- $catlevel1 = $catlevel1 + array($category->getId() => $category->getName());
88
- } else if ($category instanceof Mage_Catalog_Model_Category && is_array($parentIds) &&
89
- (sizeof($parentIds) >0)) {
90
- $catlevel1 = $catlevel1 + $this->getCatLevel2($website, $parentIds, $catlevel1Categories);
91
- }
92
- }
93
- return $catlevel1;
94
- }
95
-
96
- public function getCatLevel3(Mage_Core_Model_Website $website, $category_ids, $catlevel2Categories = null) {
97
- if(is_null($catlevel2Categories)) {
98
- $catlevel2Categories = $this->getCatLevel1($website, $category_ids);
99
- }
100
- $catlevel2Ids = array_keys($catlevel2Categories);
101
- $catlevel1 = array();
102
- foreach($category_ids as $category_id) {
103
- $category = $this->getCategory($category_id);
104
- $parentIds = $category->getParentIds();
105
-
106
- if(!is_null($category) &&
107
- $this->array_match($category->getParentId(), $catlevel2Ids)) {
108
- $catlevel1 = $catlevel1 + array($category->getId() => $category->getName());
109
- } else if ($category instanceof Mage_Catalog_Model_Category &&
110
- is_array($parentIds) &&
111
- (sizeof($parentIds) >0)) {
112
- $catlevel1 = $catlevel1 + $this->getCatLevel2($website, $parentIds, $catlevel2Categories);
113
- }
114
- }
115
- return $catlevel1;
116
- }
117
-
118
-
119
  /**
120
  * method to get all the attributes
121
  **/
@@ -155,6 +111,7 @@ class Unbxd_Recommendation_Helper_Feedhelper extends Unbxd_Recommendation_Helper
155
  }
156
  if($this->getFieldType($attributeName) == "select" ||
157
  $this->getFieldType($attributeName) == "multiselect" ||
 
158
  $attributeName == Unbxd_Recommendation_Model_Resource_Field::CATEGORY_IDS_NAME ||
159
  $attributeName == Unbxd_Recommendation_Model_Resource_Field::CAT_LEVEL_1_NAME ||
160
  $attributeName == Unbxd_Recommendation_Model_Resource_Field::CAT_LEVEL_2_NAME ||
72
  return $categoryValues;
73
  }
74
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
  /**
76
  * method to get all the attributes
77
  **/
111
  }
112
  if($this->getFieldType($attributeName) == "select" ||
113
  $this->getFieldType($attributeName) == "multiselect" ||
114
+ $attributeName == Unbxd_Recommendation_Model_Resource_Field::CATEGORY_IDS ||
115
  $attributeName == Unbxd_Recommendation_Model_Resource_Field::CATEGORY_IDS_NAME ||
116
  $attributeName == Unbxd_Recommendation_Model_Resource_Field::CAT_LEVEL_1_NAME ||
117
  $attributeName == Unbxd_Recommendation_Model_Resource_Field::CAT_LEVEL_2_NAME ||
app/code/local/Unbxd/Recommendation/Model/Api/Task/Widget.php CHANGED
@@ -12,7 +12,9 @@ class Unbxd_Recommendation_Model_Api_Task_Widget extends Unbxd_Recommendation_Mo
12
 
13
  const jsonResponse = false;
14
 
15
- public static $WIDGET_TYPES = array('recommend' => 'unbxd_recommended_for_you',
 
 
16
  'recently-viewed' =>'unbxd_recently_viewed',
17
  'more-like-these' => 'unbxd_more_like_these',
18
  'also-bought' =>'unbxd_also_bought',
@@ -21,6 +23,7 @@ class Unbxd_Recommendation_Model_Api_Task_Widget extends Unbxd_Recommendation_Mo
21
  'category-top-sellers' => 'unbxd_category_top_sellers',
22
  'brand-top-sellers' => 'unbxd_brand_top_sellers',
23
  'pdp-top-sellers' => 'unbxd_pdp_top_sellers',
 
24
  'cart-recommend' => 'unbxd_cart_recommendations');
25
 
26
  public function prepare(Mage_Core_Model_Website $website) {
@@ -94,7 +97,7 @@ class Unbxd_Recommendation_Model_Api_Task_Widget extends Unbxd_Recommendation_Mo
94
 
95
  if($params[static::WIDGET_TYPE] == 'also-viewed' || $params[static::WIDGET_TYPE] == 'also-bought' ||
96
  $params[static::WIDGET_TYPE] == 'more-like-these' || $params[static::WIDGET_TYPE] == 'pdp-top-sellers') {
97
- if(array_key_exists('uid', $params)) {
98
  return $params['pid'];
99
  } else {
100
  return '';
12
 
13
  const jsonResponse = false;
14
 
15
+ public static $WIDGET_TYPES = array(
16
+ 'recommend' => 'unbxd_recommended_for_you',
17
+ 'recommend' => 'unbxd_recommended_for_you',
18
  'recently-viewed' =>'unbxd_recently_viewed',
19
  'more-like-these' => 'unbxd_more_like_these',
20
  'also-bought' =>'unbxd_also_bought',
23
  'category-top-sellers' => 'unbxd_category_top_sellers',
24
  'brand-top-sellers' => 'unbxd_brand_top_sellers',
25
  'pdp-top-sellers' => 'unbxd_pdp_top_sellers',
26
+ 'brand-top-sellers' => 'unbxd_brand_top_sellers',
27
  'cart-recommend' => 'unbxd_cart_recommendations');
28
 
29
  public function prepare(Mage_Core_Model_Website $website) {
97
 
98
  if($params[static::WIDGET_TYPE] == 'also-viewed' || $params[static::WIDGET_TYPE] == 'also-bought' ||
99
  $params[static::WIDGET_TYPE] == 'more-like-these' || $params[static::WIDGET_TYPE] == 'pdp-top-sellers') {
100
+ if(array_key_exists('pid', $params)) {
101
  return $params['pid'];
102
  } else {
103
  return '';
app/code/local/Unbxd/Recommendation/Model/Config.php CHANGED
@@ -9,11 +9,23 @@
9
  */
10
  class Unbxd_Recommendation_Model_Config extends Mage_Core_Model_Abstract {
11
 
12
- const key = "key";
13
 
14
- const value = 'value';
15
 
16
- const website_id = 'website_id';
 
 
 
 
 
 
 
 
 
 
 
 
17
 
18
  /**
19
  *
9
  */
10
  class Unbxd_Recommendation_Model_Config extends Mage_Core_Model_Abstract {
11
 
12
+ const KEY = "key";
13
 
14
+ const VALUE = 'value';
15
 
16
+ const WEBSITE_ID = 'website_id';
17
+
18
+ const FEED_LOCK_TIME = 'feed_lock_time';
19
+
20
+ const FEED_LOCK = 'feed_lock';
21
+
22
+ const FEED_LOCK_TRUE = '1';
23
+
24
+ const FEED_LOCK_FALSE = '0';
25
+
26
+ const MAX_FEED_LOCK_TIME = 6;
27
+
28
+ const LAST_UPLOAD_TIME = 'lastUpload';
29
 
30
  /**
31
  *
app/code/local/Unbxd/Recommendation/Model/Feed/Feedcreator.php CHANGED
@@ -3,47 +3,80 @@
3
  class Unbxd_Recommendation_Model_Feed_Feedcreator {
4
 
5
  var $fileName;
6
-
7
  var $fields;
8
  var $taxonomyFlag;
9
  const PAGE_SIZE = 500;
 
 
 
 
 
 
10
 
11
  public function init(Mage_Core_Model_Website $website, $fileName) {
12
- $this->setFields($website);
13
  $this->fileName = $fileName;
14
  }
15
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
 
17
  /**
18
  * method to create the feed
19
  **/
20
- public function createFeed($fileName, $fromdate, $todate, Mage_Core_Model_Website $website, $operation, $ids){
21
  $this->init($website, $fileName);
22
- if($this->createFile()){
23
  $this->log("started writing header");
24
 
25
- if(!$this->writeFeedContent($fromdate,$todate,$website,$operation,$ids)){
26
  return false;
27
  }
28
 
29
  } else {
30
  return false;
31
  }
32
- return true;
33
  }
34
 
35
- private function writeFeedContent($fromdate,$todate,Mage_Core_Model_Website $website,$operation,$ids) {
36
- if(!$this->appendTofile('{"feed":')) {
 
 
 
 
 
 
 
 
 
37
  $this->log("Error writing feed tag");
38
  return false;
39
  }
40
 
41
- if(!$this->writeCatalogContent($fromdate,$todate,$website,$operation,$ids)) {
42
  $this->log("Error writing catalog tag");
43
  return false;
44
  }
45
 
46
- if(!$this->appendTofile("}")) {
47
  $this->log("Error writing closing feed tag");
48
  return false;
49
  }
@@ -51,106 +84,206 @@ class Unbxd_Recommendation_Model_Feed_Feedcreator {
51
  return true;
52
  }
53
 
54
- private function writeCatalogContent($fromdate,$todate,Mage_Core_Model_Website $website,$operation,$ids) {
55
- if(!$this->appendTofile('{"catalog":{')) {
 
 
 
 
 
 
 
56
  $this->log("Error writing closing catalog tag");
57
  return false;
58
  }
59
- if(!$this->writeSchemaContent()) {
60
  return false;
61
  }
62
 
63
- if(!$this->appendTofile(",")) {
64
  $this->log("Error while adding comma in catalog");
65
  return false;
66
  }
67
 
68
- if(!$this->writeProductsContent($fromdate,$todate,$website,$operation,$ids)) {
 
 
69
  return false;
70
  }
71
 
72
 
73
- if(!$this->appendTofile("}")) {
 
74
  $this->log("Error writing closing catalog tag");
75
  return false;
76
  }
77
  /*
78
- if(!$this->writeTaxonomyContents($site)) {
79
  return false;
80
  }*/
81
 
82
- if(!$this->appendTofile("}")) {
83
  $this->log("Error writing closing feed tag");
84
  return false;
85
  }
86
 
87
-
88
  return true;
89
  }
90
 
91
- private function writeSchemaContent() {
92
- return $this->appendTofile('"schema":'.
 
 
 
 
93
  Mage::getSingleton('unbxd_recommendation/feed_jsonbuilder_schemabuilder')->getSchema($this->fields));
94
  }
95
 
96
- private function writeProductsContent($fromdate,$todate,Mage_Core_Model_Website $website,$operation,$ids) {
97
-
98
- $collection = $this->getCatalogCollection($fromdate,$todate,$website,$operation,$ids);
99
- // get total size
100
- //set the time limit to infinite
101
- ignore_user_abort(true);
102
- set_time_limit(0);
103
- $pageNum = 0;
104
- $this->log('started writing products');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
105
 
106
- if(!$this->appendTofile('"'. $operation . '":{ "items":[')) {
107
- $this->log("Error while adding items tag");
108
- return false;
109
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
110
 
111
- $firstLoop = true;
112
 
113
- while(true){
114
- $collection->clear();
115
- $collection->getSelect()->limit(self::PAGE_SIZE, ($pageNum++) * self::PAGE_SIZE);
116
- $collection->load();
 
 
 
 
 
 
 
 
 
 
 
 
117
  Mage::getModel('cataloginventory/stock_status')->addStockStatusToProducts($collection);
118
- if(count($collection) == 0){
119
- if($pageNum == 1){
120
- $this->log("No products found");
121
- return false;
122
- }
123
- break;
124
- }
125
-
126
- if(!$firstLoop) {
127
- if(!$this->appendTofile( ',')) {
128
- $this->log("Error while addings items separator");
129
- return false;
130
- }
131
- }
132
- $content = Mage::getSingleton('unbxd_recommendation/feed_jsonbuilder_productbuilder')
133
- ->getProducts($website, $collection, $this->fields);
134
- $status=$this->appendTofile($content);
135
- if(!$status){
136
- $this->log("Error while addings items");
137
- return false;
138
- }
139
- $this->log('Added '.($pageNum) * self::PAGE_SIZE.' products');
140
- $firstLoop = false;
141
- }
142
-
143
- if(!$this->appendTofile("]}")) {
144
- $this->log("Error writing closing items tag");
145
- return false;
146
- }
147
 
148
-
149
- $this->log('Added all products');
150
- return true;
151
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
152
 
153
- private function writeTaxonomyContents($site){
154
 
155
  $collection=$this->getTaxonomyMappingCollection();
156
  // get total size
@@ -160,38 +293,39 @@ class Unbxd_Recommendation_Model_Feed_Feedcreator {
160
  $pageNum = 0;
161
  $this->log('started writing taxonomy tree');
162
 
163
- if(!$this->appendTofile(',"'. 'taxonomy' . '":{ "tree":[')) {
164
  $this->log("Error while adding tree tag");
165
  return false;
166
  }
167
 
168
- $content=Mage::getSingleton('unbxd_recommendation/feed_jsonbuilder_taxonomybuilder')->createTaxonomyFeed($site);
169
- $status=$this->appendTofile($content);
 
170
 
171
- if(!$status){
172
- $this->log("Error while addings taxonomy");
173
- return false;
174
- }
175
 
176
- if(!$this->appendTofile("]")) {
177
- $this->log("Error writing closing tree tag");
178
- return false;
179
  }
180
 
181
- if(!$this->appendTofile(',"mapping":[')) {
182
  $this->log("Error writing opening mapping tag");
183
  return false;
184
  }
185
 
186
- $content=Mage::getSingleton('unbxd_recommendation/feed_jsonbuilder_taxonomybuilder')->createMappingFeed($collection);
187
- $status=$this->appendTofile($content);
188
 
189
- if(!$status){
190
- $this->log("Error while addings taxonomy");
191
- return false;
192
- }
193
 
194
- if(!$this->appendTofile(']}')) {
195
  $this->log("Error writing closing mapping tag");
196
  return false;
197
  }
@@ -200,9 +334,7 @@ class Unbxd_Recommendation_Model_Feed_Feedcreator {
200
  }
201
 
202
 
203
-
204
-
205
- private function setFields(Mage_Core_Model_Website $website) {
206
  $fields = Mage::getResourceModel("unbxd_recommendation/field_collection")->getFields($website);
207
  $featureFields = Mage::getModel('unbxd_recommendation/field')->getFeaturedFields();
208
  foreach($fields as $eachfield) {
@@ -227,49 +359,14 @@ class Unbxd_Recommendation_Model_Feed_Feedcreator {
227
 
228
  }
229
 
230
- /**
231
- * method to get the catalog collection
232
- *
233
- */
234
- public function getCatalogCollection($fromdate,$todate,Mage_Core_Model_Website $website,$operation,$ids) {
235
- if ($operation == "add") {
236
- $adapter = Mage::getSingleton("core/resource");
237
- $_catalogInventoryTable = method_exists($adapter, 'getTableName')
238
- ? $adapter->getTableName('cataloginventory_stock_item'): 'catalog_category_product_index';
239
- $collection = Mage::getResourceModel('unbxd_recommendation/product_collection')
240
- ->addWebsiteFilter($website->getWebsiteId())
241
- ->joinField("qty", $_catalogInventoryTable, 'qty', 'product_id=entity_id', null, 'left')
242
- ->addAttributeToSelect('*')
243
- ->addCategoryIds()
244
- ->addPriceData(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID, $website->getWebsiteId());
245
-
246
- Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
247
- Mage::getSingleton('catalog/product_visibility')->addVisibleInSiteFilterToCollection($collection);
248
-
249
- if(sizeof($ids) > 0){
250
- $condition = array('in' => $ids);
251
- $collection=$collection->addAttributeToFilter('entity_id',$condition);
252
- }
253
- } else {
254
- $collection = Mage::getResourceModel('catalog/product_collection');
255
- if(sizeof($ids) > 0) {
256
- $condition = array('in' => $ids);
257
- $collection= $collection->addAttributeToFilter('entity_id',$condition)->addAttributeToSelect('entity_id');
258
- }
259
- }
260
-
261
- $this->log((string)$collection->getSelect());
262
- return $collection;
263
- }
264
-
265
  /**
266
  * Function to initialize to feed creation process
267
  */
268
- protected function createFile(){
269
  return Mage::getSingleton('unbxd_recommendation/feed_filemanager')->createFile($this->fileName);
270
  }
271
 
272
- protected function appendTofile($data){
273
  return Mage::getSingleton('unbxd_recommendation/feed_filemanager')->appendTofile($this->fileName, $data);
274
  }
275
 
3
  class Unbxd_Recommendation_Model_Feed_Feedcreator {
4
 
5
  var $fileName;
 
6
  var $fields;
7
  var $taxonomyFlag;
8
  const PAGE_SIZE = 500;
9
+ var $_fullupload;
10
+
11
+
12
+ public function __construct() {
13
+ $this->_fullupload = true;
14
+ }
15
 
16
  public function init(Mage_Core_Model_Website $website, $fileName) {
17
+ $this->_setFields($website);
18
  $this->fileName = $fileName;
19
  }
20
 
21
+ /**
22
+ * Method to set the full upload
23
+ * @param bool $value
24
+ * @return void
25
+ */
26
+ public function setFullUpload($value = true) {
27
+ if($value === false) {
28
+ $this->_fullupload = false;
29
+ }
30
+ return $this;
31
+ }
32
+
33
+ /**
34
+ * Method to check whether is full upload or not
35
+ * @return mixed
36
+ */
37
+ public function isFullUpload() {
38
+ return $this->_fullupload;
39
+ }
40
 
41
  /**
42
  * method to create the feed
43
  **/
44
+ public function createFeed($fileName, Mage_Core_Model_Website $website, $fromDate, $currentDate){
45
  $this->init($website, $fileName);
46
+ if($this->_createFile()){
47
  $this->log("started writing header");
48
 
49
+ if(!$this->_writeFeedContent($website, $fromDate, $currentDate)){
50
  return false;
51
  }
52
 
53
  } else {
54
  return false;
55
  }
56
+ return true;
57
  }
58
 
59
+ /**
60
+ * Method to trigger write the feed contents
61
+ * @param $fromdate
62
+ * @param $todate
63
+ * @param Mage_Core_Model_Website $website
64
+ * @param $operation
65
+ * @param $ids
66
+ * @return bool
67
+ */
68
+ protected function _writeFeedContent(Mage_Core_Model_Website $website, $fromDate, $currentDate) {
69
+ if(!$this->_appendTofile('{"feed":')) {
70
  $this->log("Error writing feed tag");
71
  return false;
72
  }
73
 
74
+ if(!$this->_writeCatalogContent($website, $fromDate, $currentDate)) {
75
  $this->log("Error writing catalog tag");
76
  return false;
77
  }
78
 
79
+ if(!$this->_appendTofile("}")) {
80
  $this->log("Error writing closing feed tag");
81
  return false;
82
  }
84
  return true;
85
  }
86
 
87
+ /**
88
+ * Method to trigger only the catalog content
89
+ * @param Mage_Core_Model_Website $website
90
+ * @param $operation
91
+ * @param $ids
92
+ * @return bool
93
+ */
94
+ protected function _writeCatalogContent(Mage_Core_Model_Website $website, $fromDate, $currentDate) {
95
+ if(!$this->_appendTofile('{"catalog":{')) {
96
  $this->log("Error writing closing catalog tag");
97
  return false;
98
  }
99
+ if(!$this->_writeSchemaContent()) {
100
  return false;
101
  }
102
 
103
+ if(!$this->_appendTofile(",")) {
104
  $this->log("Error while adding comma in catalog");
105
  return false;
106
  }
107
 
108
+ // If both of them are unsuccessful, then tag it as unsuccessful
109
+ if(!($this->_writeAddProductsContent($website, $fromDate, $currentDate)
110
+ || $this->_writeDeleteProductsContent($website, $fromDate, $currentDate))) {
111
  return false;
112
  }
113
 
114
 
115
+
116
+ if(!$this->_appendTofile("}")) {
117
  $this->log("Error writing closing catalog tag");
118
  return false;
119
  }
120
  /*
121
+ if(!$this->_writeTaxonomyContents($site)) {
122
  return false;
123
  }*/
124
 
125
+ if(!$this->_appendTofile("}")) {
126
  $this->log("Error writing closing feed tag");
127
  return false;
128
  }
129
 
 
130
  return true;
131
  }
132
 
133
+ /**
134
+ * Method to trigger to write the schema content
135
+ * @return mixed
136
+ */
137
+ protected function _writeSchemaContent() {
138
+ return $this->_appendTofile('"schema":'.
139
  Mage::getSingleton('unbxd_recommendation/feed_jsonbuilder_schemabuilder')->getSchema($this->fields));
140
  }
141
 
142
+ /**
143
+ * method to get the collection to add
144
+ * @param Mage_Core_Model_Website $website
145
+ * @param $currentDate
146
+ * @return mixed
147
+ */
148
+ protected function _getCatalogCollectionToAdd(Mage_Core_Model_Website $website, $fromDate, $currentDate) {
149
+ if($this->isFullUpload()) {
150
+ return Mage::getResourceModel('unbxd_recommendation/product_collection')
151
+ ->addFullUploadFilters($website);
152
+ } else {
153
+ $products = Mage::getModel('unbxd_recommendation/sync')
154
+ ->getCollection()
155
+ ->addWebsiteFilter($website->getWebsiteId())
156
+ ->addUnsyncFilter()
157
+ ->addOperationFilter(Unbxd_Recommendation_Model_Sync::OPERATION_ADD)
158
+ ->load();
159
+ $productIds = array();
160
+ foreach($products as $product) {
161
+ $productIds[] = $product->getProductId();
162
+ }
163
+ return Mage::getResourceModel('unbxd_recommendation/product_collection')
164
+ ->addIncrementalUploadFiltersToAdd($website, $fromDate, $currentDate, $productIds);
165
+ }
166
+ }
167
+
168
+ protected function _getCatalogCollectionToDelete(Mage_Core_Model_Website $website) {
169
+ $products = Mage::getModel('unbxd_recommendation/sync')
170
+ ->getCollection()
171
+ ->addWebsiteFilter($website->getWebsiteId())
172
+ ->addUnsyncFilter()
173
+ ->addOperationFilter(Unbxd_Recommendation_Model_Sync::OPERATION_DELETE)
174
+ ->load();
175
+ $collection = Mage::getResourceModel('unbxd_recommendation/product_collection');
176
+ foreach($products as $eachProduct) {
177
+ $product = new Mage_Catalog_Model_Product();
178
+ $product->setEntityId($eachProduct->getProductId());
179
+ $collection->addItem($product);
180
+ }
181
+ return $collection;
182
+ }
183
 
184
+ protected function _writeDeleteProductsContent(Mage_Core_Model_Website $website, $fromDate, $currentDate) {
185
+ if($this->isFullUpload()) {
186
+ return true;
187
+ }
188
+ $collection1 = $this->_getCatalogCollectionToDelete($website);
189
+ $collection2 = Mage::getResourceModel('unbxd_recommendation/product_collection')
190
+ ->addIncrementalUploadFiltersToDelete($website, $fromDate, $currentDate)
191
+ ->load();
192
+
193
+ $collection = $collection1
194
+ ->mergeCollection($collection2)
195
+ ->virtuallyLoad();
196
+ return $this->_writeProducts($website, $collection, Unbxd_Recommendation_Model_Feed_Tags::DELETE, true);
197
+ }
198
+
199
+
200
+
201
+ /**
202
+ * Method to trigger to write the products
203
+ * @param Mage_Core_Model_Website $website
204
+ * @param $operation
205
+ * @param $ids
206
+ * @return bool
207
+ */
208
+ protected function _writeAddProductsContent(Mage_Core_Model_Website $website, $fromDate, $currentDate) {
209
+ $collection = $this->_getCatalogCollectionToAdd($website, $fromDate, $currentDate);
210
+ return $this->_writeProducts($website, $collection);
211
 
212
+ }
213
 
214
+ /**
215
+ * Method to process the collection
216
+ * @param $collection
217
+ * @param $pageNum
218
+ * @param string $operation
219
+ * @param bool $loadAll
220
+ * @return mixed
221
+ */
222
+ protected function _processCollection($collection , $pageNum,
223
+ $operation = Unbxd_Recommendation_Model_Feed_Tags::ADD, $loadAll = false) {
224
+ if(!$loadAll) {
225
+ $collection->clear();
226
+ $collection->getSelect()->limit(self::PAGE_SIZE, ($pageNum) * self::PAGE_SIZE);
227
+ $collection->load();
228
+ }
229
+ if($operation == Unbxd_Recommendation_Model_Feed_Tags::ADD) {
230
  Mage::getModel('cataloginventory/stock_status')->addStockStatusToProducts($collection);
231
+ }
232
+ return $collection;
233
+ }
234
+
235
+ protected function _writeProducts(Mage_Core_Model_Website $website, $collection,
236
+ $operation = Unbxd_Recommendation_Model_Feed_Tags::ADD, $loadAllAtOnce = false) {
237
+ $pageNum = 0;
238
+ $this->log('started writing products');
239
+ $firstLoop = true;
240
+ while(true){
241
+ $collection = $this->_processCollection($collection, $pageNum++ , $operation, $loadAllAtOnce);
242
+
243
+ if(count($collection) == 0){
244
+ if($pageNum == 1){
245
+ $this->log("No products found");
246
+ throw new Exception("No Products found");
247
+ }
248
+ break;
249
+ }
 
 
 
 
 
 
 
 
 
 
250
 
251
+ if(!$firstLoop && $loadAllAtOnce) {
252
+ break;
253
+ } else if(!$firstLoop) {
254
+ if(!$this->_appendTofile(Unbxd_Recommendation_Model_Feed_Tags::COMMA)) {
255
+ $this->log("Error while addings items separator");
256
+ return false;
257
+ }
258
+ } else {
259
+ // If it is the first loop adding json tag
260
+ if(!$this->_appendTofile(Mage::getSingleton('unbxd_recommendation/feed_tags')->getKey($operation) .
261
+ Unbxd_Recommendation_Model_Feed_Tags::COLON. Unbxd_Recommendation_Model_Feed_Tags::OBJ_START.
262
+ Mage::getSingleton('unbxd_recommendation/feed_tags')->getKey($operation) .
263
+ Unbxd_Recommendation_Model_Feed_Tags::COLON.Unbxd_Recommendation_Model_Feed_Tags::ARRAY_START)) {
264
+ $this->log("Error while adding items tag");
265
+ return false;
266
+ }
267
+ }
268
+ $content = Mage::getSingleton('unbxd_recommendation/feed_jsonbuilder_productbuilder')
269
+ ->getProducts($website, $collection, $this->fields);
270
+ if(!$this->_appendTofile($content)){
271
+ $this->log("Error while addings items");
272
+ return false;
273
+ }
274
+ $this->log('Added '.($pageNum) * self::PAGE_SIZE.' products');
275
+ $firstLoop = false;
276
+ }
277
+ if(!$this->_appendTofile(Unbxd_Recommendation_Model_Feed_Tags::ARRAY_END .
278
+ Unbxd_Recommendation_Model_Feed_Tags::OBJ_END)) {
279
+ $this->log("Error writing closing items tag");
280
+ return false;
281
+ }
282
+ $this->log('Added all products');
283
+ return true;
284
+ }
285
 
286
+ protected function _writeTaxonomyContents($site){
287
 
288
  $collection=$this->getTaxonomyMappingCollection();
289
  // get total size
293
  $pageNum = 0;
294
  $this->log('started writing taxonomy tree');
295
 
296
+ if(!$this->_appendTofile(',"'. 'taxonomy' . '":{ "tree":[')) {
297
  $this->log("Error while adding tree tag");
298
  return false;
299
  }
300
 
301
+ $content=Mage::getSingleton('unbxd_recommendation/feed_jsonbuilder_taxonomybuilder')
302
+ ->createTaxonomyFeed($site);
303
+ $status=$this->_appendTofile($content);
304
 
305
+ if(!$status){
306
+ $this->log("Error while addings taxonomy");
307
+ return false;
308
+ }
309
 
310
+ if(!$this->_appendTofile("]")) {
311
+ $this->log("Error writing closing tree tag");
312
+ return false;
313
  }
314
 
315
+ if(!$this->_appendTofile(',"mapping":[')) {
316
  $this->log("Error writing opening mapping tag");
317
  return false;
318
  }
319
 
320
+ $content=Mage::getSingleton('unbxd_recommendation/feed_jsonbuilder_taxonomybuilder')->createMappingFeed($collection);
321
+ $status=$this->_appendTofile($content);
322
 
323
+ if(!$status){
324
+ $this->log("Error while addings taxonomy");
325
+ return false;
326
+ }
327
 
328
+ if(!$this->appendTofile(']}')) {
329
  $this->log("Error writing closing mapping tag");
330
  return false;
331
  }
334
  }
335
 
336
 
337
+ protected function _setFields(Mage_Core_Model_Website $website) {
 
 
338
  $fields = Mage::getResourceModel("unbxd_recommendation/field_collection")->getFields($website);
339
  $featureFields = Mage::getModel('unbxd_recommendation/field')->getFeaturedFields();
340
  foreach($fields as $eachfield) {
359
 
360
  }
361
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
362
  /**
363
  * Function to initialize to feed creation process
364
  */
365
+ protected function _createFile(){
366
  return Mage::getSingleton('unbxd_recommendation/feed_filemanager')->createFile($this->fileName);
367
  }
368
 
369
+ protected function _appendTofile($data){
370
  return Mage::getSingleton('unbxd_recommendation/feed_filemanager')->appendTofile($this->fileName, $data);
371
  }
372
 
app/code/local/Unbxd/Recommendation/Model/Feed/Feedmanager.php CHANGED
@@ -11,15 +11,11 @@ class Unbxd_Recommendation_Model_Feed_Feedmanager {
11
 
12
  var $siteName;
13
 
14
- const LAST_UPLOAD_TIME = 'lastUpload';
15
-
16
  /**
17
  * method to push the feed to the Unbxd server
18
  **/
19
- public function pushFeed($fullimport=true){
20
  $fields=array('file'=>'@'.$this->fileName.';filename='.'unbxdFeed.json');
21
- $header = array('Content-Type: multipart/form-data');
22
-
23
  $url="http://feed.unbxdapi.com/upload/v2/".$this->key."/".$this->siteName. ($fullimport?"?fullimport=true":"");
24
 
25
  $ch = curl_init();
@@ -44,7 +40,7 @@ class Unbxd_Recommendation_Model_Feed_Feedmanager {
44
  return true;
45
  }
46
 
47
- public function exec($ch)
48
  {
49
  $response = curl_exec($ch);
50
  $error = curl_error($ch);
@@ -69,9 +65,10 @@ class Unbxd_Recommendation_Model_Feed_Feedmanager {
69
  /**
70
  * method to set the feedName, log, apikey based on site Name
71
  **/
72
- public function init(Mage_Core_Model_Website $website)
73
  {
74
- $this->fileName = Mage::getBaseDir('tmp').DS.str_replace(' ', '_', $website->getName()). "_Feed.json";
 
75
  $this->key = Mage::getResourceModel("unbxd_recommendation/config")
76
  ->getValue($website->getWebsiteId(), Unbxd_Recommendation_Helper_Confighelper::SECRET_KEY);
77
  $this->siteName = Mage::getResourceModel("unbxd_recommendation/config")
@@ -108,40 +105,64 @@ class Unbxd_Recommendation_Model_Feed_Feedmanager {
108
  /**
109
  * method to initiate feed uploading to the unbxd servers
110
  **/
111
- public function process($fromdate, Mage_Core_Model_Website $website, $operation = "add", $ids=array()){
112
 
113
  $this->log('Feed Uploading request recieved');
114
- $response = $this->init($website);
115
  if(is_array($response)){
116
  return $response;
117
  }
118
  $currentDate = date('Y-m-d H:i:s');
119
 
120
  // check the lock, that if already indexing is happening
121
- if(!Mage::getResourceModel("unbxd_recommendation/config")->isLock($website->getWebsiteId())) {
 
 
 
 
 
 
 
122
 
123
  $this->log('site '. $website->getName() .' is acquiring feed lock');
124
- Mage::getResourceModel('unbxd_recommendation/config')->lockSite($website->getWebsiteId());
 
 
125
 
126
  // create the feed
127
- $status=Mage::getSingleton('unbxd_recommendation/feed_feedcreator')
128
- ->createFeed($this->fileName, $fromdate, $currentDate, $website, $operation, $ids);
 
 
 
 
 
 
129
  $this->log('unbxd Datafeeder finished creating file');
130
 
131
  if($status){
132
- $status=$this->pushFeed();
133
  if($status){
134
  Mage::getResourceSingleton("unbxd_recommendation/config")
135
- ->setValue($website->getWebsiteId(), self::LAST_UPLOAD_TIME, $currentDate);
 
 
136
  }
137
  }
138
 
139
- // unlock the feed once everything is completed
140
- Mage::getResourceModel('unbxd_recommendation/config')->unLockSite($website->getWebsiteId());
141
- $this->updateFeatureFields($website);
 
 
 
 
 
142
  $this->log('site ' . $website->getName() .' has been unlocked');
143
  if($status) {
144
- return array('success' => true, 'message' => 'File uploaded successfully');
 
 
145
  }
146
  return array('success' => false, 'message' => 'Unexpected error, please contact support');
147
  } else {
11
 
12
  var $siteName;
13
 
 
 
14
  /**
15
  * method to push the feed to the Unbxd server
16
  **/
17
+ protected function _pushFeed($fullimport=true){
18
  $fields=array('file'=>'@'.$this->fileName.';filename='.'unbxdFeed.json');
 
 
19
  $url="http://feed.unbxdapi.com/upload/v2/".$this->key."/".$this->siteName. ($fullimport?"?fullimport=true":"");
20
 
21
  $ch = curl_init();
40
  return true;
41
  }
42
 
43
+ protected function exec($ch)
44
  {
45
  $response = curl_exec($ch);
46
  $error = curl_error($ch);
65
  /**
66
  * method to set the feedName, log, apikey based on site Name
67
  **/
68
+ public function init(Mage_Core_Model_Website $website, $isFullUpload)
69
  {
70
+ $this->fileName = Mage::getBaseDir('tmp').DS.str_replace(' ', '_', $website->getName()).
71
+ "_Feed" . (!$isFullUpload?round(microtime(true) * 1000):'') . ".json";
72
  $this->key = Mage::getResourceModel("unbxd_recommendation/config")
73
  ->getValue($website->getWebsiteId(), Unbxd_Recommendation_Helper_Confighelper::SECRET_KEY);
74
  $this->siteName = Mage::getResourceModel("unbxd_recommendation/config")
105
  /**
106
  * method to initiate feed uploading to the unbxd servers
107
  **/
108
+ public function process($isFullUpload = true, Mage_Core_Model_Website $website){
109
 
110
  $this->log('Feed Uploading request recieved');
111
+ $response = $this->init($website, $isFullUpload);
112
  if(is_array($response)){
113
  return $response;
114
  }
115
  $currentDate = date('Y-m-d H:i:s');
116
 
117
  // check the lock, that if already indexing is happening
118
+ if(!$isFullUpload ||
119
+ !Mage::getResourceModel("unbxd_recommendation/config")->isLock($website->getWebsiteId())) {
120
+
121
+ $fromDate = Mage::getResourceSingleton('unbxd_recommendation/config')
122
+ ->getValue($website->getWebsiteId(), Unbxd_Recommendation_Model_Config::LAST_UPLOAD_TIME);
123
+ if(is_null($fromDate)) {
124
+ $fromDate = "1970-01-01 00:00:00";
125
+ }
126
 
127
  $this->log('site '. $website->getName() .' is acquiring feed lock');
128
+ if($isFullUpload) {
129
+ Mage::getResourceModel('unbxd_recommendation/config')->lockSite($website->getWebsiteId());
130
+ }
131
 
132
  // create the feed
133
+ try {
134
+ $status = Mage::getSingleton('unbxd_recommendation/feed_feedcreator')
135
+ ->setFullUpload($isFullUpload)
136
+ ->createFeed($this->fileName, $website, $fromDate, $currentDate);
137
+ } catch (Exception $e) {
138
+ $this->log('Caught exception: '. $e->getMessage());
139
+ return array('success' => false, 'message' => $e->getMessage());
140
+ }
141
  $this->log('unbxd Datafeeder finished creating file');
142
 
143
  if($status){
144
+ $status=$this->_pushFeed($isFullUpload);
145
  if($status){
146
  Mage::getResourceSingleton("unbxd_recommendation/config")
147
+ ->setValue($website->getWebsiteId(),
148
+ Unbxd_Recommendation_Model_Config::LAST_UPLOAD_TIME, $currentDate);
149
+ $this->updateFeatureFields($website);
150
  }
151
  }
152
 
153
+ if($isFullUpload) {
154
+ // unlock the feed once everything is completed
155
+ Mage::getResourceModel('unbxd_recommendation/config')->unLockSite($website->getWebsiteId());
156
+ } else {
157
+ //In case of incremental feed delete the feed
158
+ Mage::getSingleton('unbxd_recommendation/feed_filemanager')->deleteFile($this->fileName);
159
+ }
160
+
161
  $this->log('site ' . $website->getName() .' has been unlocked');
162
  if($status) {
163
+ Mage::getModel('unbxd_recommendation/sync')
164
+ ->markItSynced($website->getWebsiteId(), $fromDate, $currentDate);
165
+ return array('success' => true, 'message' => 'File uploaded successfully');
166
  }
167
  return array('success' => false, 'message' => 'Unexpected error, please contact support');
168
  } else {
app/code/local/Unbxd/Recommendation/Model/Feed/Jsonbuilder/Productbuilder.php CHANGED
@@ -119,7 +119,7 @@ class Unbxd_Recommendation_Model_Feed_Jsonbuilder_Productbuilder extends
119
  if (sizeof($levelCategories) > 0) {
120
  $categoryData['categoryLevel' . $level] = $levelCategories;
121
  $categoryData['catLevel' . $level . 'Name'] = $levelCategories[0];
122
- $category = $category + $levelCategories;
123
  }
124
  }
125
 
119
  if (sizeof($levelCategories) > 0) {
120
  $categoryData['categoryLevel' . $level] = $levelCategories;
121
  $categoryData['catLevel' . $level . 'Name'] = $levelCategories[0];
122
+ $category = array_merge($category, $levelCategories);
123
  }
124
  }
125
 
app/code/local/Unbxd/Recommendation/Model/Feed/Tags.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by IntelliJ IDEA.
4
+ * User: anantheshadiga
5
+ * Date: 1/29/15
6
+ * Time: 12:25 PM
7
+ */
8
+ class Unbxd_Recommendation_Model_Feed_Tags {
9
+ const CATALOG = 'catalog';
10
+
11
+ const ADD = 'add';
12
+
13
+ const DELETE = 'delete';
14
+
15
+ const OBJ_START = '{';
16
+
17
+ const OBJ_END = '}';
18
+
19
+ const ARRAY_START = '[';
20
+
21
+ const ARRAY_END = ']';
22
+
23
+ const COLON = ':';
24
+
25
+ const COMMA = ',';
26
+
27
+ const DOUBLE_QUOTE = '"';
28
+
29
+ public function getKey($key) {
30
+ return self::DOUBLE_QUOTE . $key . self::DOUBLE_QUOTE;
31
+ }
32
+ }
app/code/local/Unbxd/Recommendation/Model/Observer.php CHANGED
@@ -18,7 +18,8 @@ class Unbxd_Recommendation_Model_Observer {
18
  return $this;
19
  }
20
  $response = Mage::getModel('unbxd_recommendation/api_task_trackcart')
21
- ->setData('data', array('pid' => Mage::helper('unbxd_recommendation/feedhelper')->getUniqueId($product),'visit_type' => 'repeat'))
 
22
  ->setData('ip', isset($_SERVER['HTTP_X_FORWARDED_FOR'])?$_SERVER['HTTP_X_FORWARDED_FOR']:$_SERVER['REMOTE_ADDR'])
23
  ->setData('agent', $_SERVER['HTTP_USER_AGENT'])
24
  ->prepare(Mage::app()->getWebsite())
@@ -36,7 +37,10 @@ class Unbxd_Recommendation_Model_Observer {
36
  * @return $this
37
  */
38
  public function trackOrder(Varien_Event_Observer $observer) {
 
39
  $payment = $observer->getEvent()->getPayment();
 
 
40
  if(!$payment instanceof Mage_Sales_Model_Order_Payment) {
41
  Mage::helper('unbxd_recommendation')->log(Zend_Log::ERR, 'ORDER_TRACKER:payment is not a valid type');
42
  return $this;
@@ -49,62 +53,70 @@ class Unbxd_Recommendation_Model_Observer {
49
  ->log(Zend_Log::ERR, 'ORDER_TRACKER:request failed because item is of instancetype ' . get_class($item));
50
  continue;
51
  }
52
- $type = $item->getProductType();
53
-
54
- switch($type){
55
- case 'configurable':
56
- if ($item->getHasChildren()) {
57
- $productId = $item->getProductId();
58
- }elseif($item->getParentItem() != null) {
59
- $productId = $item->getParentItem()->getProductId();
60
- }
61
- break;
62
- case 'grouped':
63
- $values=$item->getProductOptionByCode('info_buyRequest');
64
- $parentId = $values['super_product_config']['product_id'];
65
- $productId = $parentId;
66
- break;
67
- case 'bundle':
68
- $productId = $item->getProductId();
69
- break;
70
- case 'simple':
71
- if ($item->getParentItem() != null) {
72
- $productId = $item->getParentItem()->getProductId();
73
- } else {
74
- $productId = $item->getProductId();
75
- }
76
- break;
77
- default:
78
- $productId = $item->getProductId();
79
- }
80
  $response = Mage::getModel('unbxd_recommendation/api_task_trackorder')
81
  ->setData('data',
82
- array('visit_type' => 'repeat', 'pid' => $productId,
83
- 'qty' => $item->getQtyOrdered(), 'price' => $item->getPriceInclTax()))
 
 
84
  ->setData('ip', isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR'])
85
  ->setData('agent', $_SERVER['HTTP_USER_AGENT'])
86
  ->prepare(Mage::app()->getWebsite())
87
  ->process();
 
88
  if ($response->isSuccess() && is_array($response->getErrors()) && sizeof($response->getErrors()) > 0) {
89
  Mage::helper('unbxd_recommendation')
90
  ->log(Zend_Log::ERR, 'ORDER_TRACKER:request failed because ' . json_encode($response->getErrors()));
91
  }
 
92
  }
93
  return $this;
94
  }
95
 
96
-
97
- public function syncProduct()
 
 
 
 
98
  {
99
  $websiteCollection = Mage::getModel('core/website')->getCollection()->load();
100
 
101
  foreach ($websiteCollection as $website) {
102
  Mage::getResourceModel('unbxd_recommendation/config')
103
  ->setValue($website->getWebsiteId(), Unbxd_Recommendation_Helper_Confighelper::IS_CRON_ENABLED, 1);
104
- $fromdate = "1970-01-01 00:00:01";
105
- Mage::getSingleton('unbxd_recommendation/feed_feedmanager')->process($fromdate, $website);
106
  }
107
  return $this;
108
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
109
  }
110
  ?>
18
  return $this;
19
  }
20
  $response = Mage::getModel('unbxd_recommendation/api_task_trackcart')
21
+ ->setData('data', array('pid' => Mage::helper('unbxd_recommendation/feedhelper')->getUniqueId($product),
22
+ 'visit_type' => 'repeat'))
23
  ->setData('ip', isset($_SERVER['HTTP_X_FORWARDED_FOR'])?$_SERVER['HTTP_X_FORWARDED_FOR']:$_SERVER['REMOTE_ADDR'])
24
  ->setData('agent', $_SERVER['HTTP_USER_AGENT'])
25
  ->prepare(Mage::app()->getWebsite())
37
  * @return $this
38
  */
39
  public function trackOrder(Varien_Event_Observer $observer) {
40
+
41
  $payment = $observer->getEvent()->getPayment();
42
+ /* @var Mage_Sales_Model_Order_Payment */
43
+
44
  if(!$payment instanceof Mage_Sales_Model_Order_Payment) {
45
  Mage::helper('unbxd_recommendation')->log(Zend_Log::ERR, 'ORDER_TRACKER:payment is not a valid type');
46
  return $this;
53
  ->log(Zend_Log::ERR, 'ORDER_TRACKER:request failed because item is of instancetype ' . get_class($item));
54
  continue;
55
  }
56
+ $product =$item->getProduct();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  $response = Mage::getModel('unbxd_recommendation/api_task_trackorder')
58
  ->setData('data',
59
+ array('visit_type' => 'repeat',
60
+ 'pid' => Mage::helper('unbxd_recommendation/feedhelper')->getUniqueId($product),
61
+ 'qty' => $item->getQtyOrdered(),
62
+ 'price' => $item->getPriceInclTax()))
63
  ->setData('ip', isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR'])
64
  ->setData('agent', $_SERVER['HTTP_USER_AGENT'])
65
  ->prepare(Mage::app()->getWebsite())
66
  ->process();
67
+
68
  if ($response->isSuccess() && is_array($response->getErrors()) && sizeof($response->getErrors()) > 0) {
69
  Mage::helper('unbxd_recommendation')
70
  ->log(Zend_Log::ERR, 'ORDER_TRACKER:request failed because ' . json_encode($response->getErrors()));
71
  }
72
+ Mage::getSingleton('unbxd_recommendation/sync')->addProduct($product);
73
  }
74
  return $this;
75
  }
76
 
77
+ /**
78
+ * Method to sync the product catalog through cron
79
+ * @param Varien_Event_Observer $observer
80
+ * @return $this
81
+ */
82
+ public function syncProduct(Varien_Event_Observer $observer)
83
  {
84
  $websiteCollection = Mage::getModel('core/website')->getCollection()->load();
85
 
86
  foreach ($websiteCollection as $website) {
87
  Mage::getResourceModel('unbxd_recommendation/config')
88
  ->setValue($website->getWebsiteId(), Unbxd_Recommendation_Helper_Confighelper::IS_CRON_ENABLED, 1);
89
+ Mage::getSingleton('unbxd_recommendation/feed_feedmanager')->process($website);
 
90
  }
91
  return $this;
92
  }
93
+
94
+ /**
95
+ * Method to track deleted product
96
+ * @param Varien_Event_Observer $observer
97
+ * @return void
98
+ */
99
+ public function trackDeleteOfChildProduct(Varien_Event_Observer $observer) {
100
+ $product = $observer->getEvent()->getDataObject();
101
+ $parentIds = Mage::getModel('catalog/product_type_grouped')->getParentIdsByChild($product->getId());
102
+ if(!$parentIds)
103
+ $parentIds = Mage::getModel('catalog/product_type_configurable')->getParentIdsByChild($product->getId());
104
+ foreach($parentIds as $parentId) {
105
+ $parentProduct = Mage::getModel('catalog/product')->load($parentId);
106
+ Mage::getSingleton('unbxd_recommendation/sync')->addProduct($parentProduct);
107
+ }
108
+ Mage::getSingleton('unbxd_recommendation/sync')->deleteProduct($product);
109
+ return $this;
110
+ }
111
+
112
+ public function catalogInventorySave(Varien_Event_Observer $observer) {
113
+ $_item = $observer->getEvent()->getItem()->getProduct();
114
+ Mage::getSingleton('unbxd_recommendation/sync')->addProduct($_item);
115
+ return $this;
116
+ }
117
+
118
+ public function saleOrderCancel(Varien_Event_Observer $observer) {
119
+
120
+ }
121
  }
122
  ?>
app/code/local/Unbxd/Recommendation/Model/Resource/Config.php CHANGED
@@ -15,6 +15,9 @@ class Unbxd_Recommendation_Model_Resource_Config extends Mage_Core_Model_Mysql4_
15
  */
16
  protected $_unbxdConfigTable;
17
 
 
 
 
18
  /**
19
  * @return void
20
  */
@@ -33,10 +36,18 @@ class Unbxd_Recommendation_Model_Resource_Config extends Mage_Core_Model_Mysql4_
33
  {
34
  $adapter = $this->_getReadAdapter();
35
 
 
 
 
 
 
 
 
 
36
  $select = $adapter->select()
37
  ->from($this->_unbxdConfigTable, 'value')
38
- ->where('`'.Unbxd_Recommendation_Model_Config::website_id.'` = ?', (int)$website_id)
39
- ->where('`'.Unbxd_Recommendation_Model_Config::key.'` = ?', $key);
40
 
41
  $result = $adapter->fetchOne($select);
42
  if($result == false) {
@@ -51,15 +62,22 @@ class Unbxd_Recommendation_Model_Resource_Config extends Mage_Core_Model_Mysql4_
51
  * @param string $value
52
  * @return void
53
  */
54
- public function setValue($website_id, $key, $value)
55
  {
56
  if (!isset($value) || $value == "" || !isset($key) || $key == "") {
57
  return;
58
  }
59
 
 
 
 
 
 
 
 
60
  $config = Mage::getModel('unbxd_recommendation/config')->getCollection()
61
- ->addFieldToFilter('`'.Unbxd_Recommendation_Model_Config::key.'`', $key)
62
- ->addFieldToFilter('`'.Unbxd_Recommendation_Model_Config::website_id.'`', (int)$website_id)
63
  ->getFirstItem();
64
 
65
  $config->setWebsiteId($website_id)
@@ -69,20 +87,48 @@ class Unbxd_Recommendation_Model_Resource_Config extends Mage_Core_Model_Mysql4_
69
  }
70
 
71
  public function lockSite($website_id) {
72
- $this->setValue($website_id, 'feed_lock', '1');
73
- $this->setValue($website_id, 'feed_lock_time', date('Y-m-d H:i:s'));
 
 
74
  }
75
 
76
 
77
  public function unLockSite($website_id) {
78
- $this->setValue($website_id, 'feed_lock', '0');
 
79
  }
80
 
81
  public function isLock($website_id) {
82
- $feedLock = $this->getValue($website_id, 'feed_lock');
83
- if(is_null($feedLock) || $feedLock == 0){
 
 
 
 
 
 
84
  return false;
85
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86
  return true;
87
  }
88
  }
15
  */
16
  protected $_unbxdConfigTable;
17
 
18
+ // date format
19
+ const DATE_FORMAT = 'Y-m-d H:i:s';
20
+
21
  /**
22
  * @return void
23
  */
36
  {
37
  $adapter = $this->_getReadAdapter();
38
 
39
+ if(is_array($key)) {
40
+ $keyValuePair = array();
41
+ foreach ($key as $eachKey) {
42
+ $keyValuePair[$key] = $this->getValue($website_id, $eachKey);
43
+ }
44
+ return $keyValuePair;
45
+ }
46
+
47
  $select = $adapter->select()
48
  ->from($this->_unbxdConfigTable, 'value')
49
+ ->where('`'.Unbxd_Recommendation_Model_Config::WEBSITE_ID.'` = ?', (int)$website_id)
50
+ ->where('`'.Unbxd_Recommendation_Model_Config::KEY.'` = ?', $key);
51
 
52
  $result = $adapter->fetchOne($select);
53
  if($result == false) {
62
  * @param string $value
63
  * @return void
64
  */
65
+ public function setValue($website_id, $key, $value = null)
66
  {
67
  if (!isset($value) || $value == "" || !isset($key) || $key == "") {
68
  return;
69
  }
70
 
71
+ if(is_array($key)) {
72
+ foreach($key as $eachKey => $eachValue) {
73
+ $this->setValue($website_id, $eachKey, $eachValue);
74
+ }
75
+ return;
76
+ }
77
+
78
  $config = Mage::getModel('unbxd_recommendation/config')->getCollection()
79
+ ->addFieldToFilter('`'.Unbxd_Recommendation_Model_Config::KEY.'`', $key)
80
+ ->addFieldToFilter('`'.Unbxd_Recommendation_Model_Config::WEBSITE_ID.'`', (int)$website_id)
81
  ->getFirstItem();
82
 
83
  $config->setWebsiteId($website_id)
87
  }
88
 
89
  public function lockSite($website_id) {
90
+ $this->setValue($website_id, array(
91
+ Unbxd_Recommendation_Model_Config::FEED_LOCK => Unbxd_Recommendation_Model_Config::FEED_LOCK_TRUE,
92
+ Unbxd_Recommendation_Model_Config::FEED_LOCK_TIME => date(self::DATE_FORMAT)));
93
+
94
  }
95
 
96
 
97
  public function unLockSite($website_id) {
98
+ $this->setValue($website_id, Unbxd_Recommendation_Model_Config::FEED_LOCK,
99
+ Unbxd_Recommendation_Model_Config::FEED_LOCK_FALSE);
100
  }
101
 
102
  public function isLock($website_id) {
103
+ //fetch the values for feedlock, feed lock time from db
104
+ $feedLockDetails = $this->getValue($website_id,
105
+ array(Unbxd_Recommendation_Model_Config::FEED_LOCK, Unbxd_Recommendation_Model_Config::FEED_LOCK_TIME));
106
+ //fetch feed lock from @var feedLockDetails
107
+ $feedLock = array_key_exists(Unbxd_Recommendation_Model_Config::FEED_LOCK, $feedLockDetails)?
108
+ $feedLockDetails[Unbxd_Recommendation_Model_Config::FEED_LOCK]:null;
109
+
110
+ if(is_null($feedLock) || $feedLock == Unbxd_Recommendation_Model_Config::FEED_LOCK_FALSE){
111
  return false;
112
  }
113
+
114
+ // Ignoring the feed Lock, if the feed has been locked more than $maxFeedLockTime
115
+ if($feedLock == Unbxd_Recommendation_Model_Config::FEED_LOCK_TRUE &&
116
+ array_key_exists(Unbxd_Recommendation_Model_Config::FEED_LOCK_TIME, $feedLockDetails)) {
117
+
118
+ $feedLockTime = $feedLockDetails[Unbxd_Recommendation_Model_Config::FEED_LOCK_TIME];
119
+ $date = strtotime($feedLockTime);
120
+ $currentTime = strtotime(date(self::DATE_FORMAT));
121
+ $diff = abs($date - $currentTime);
122
+ $maxFeedLockTime = Mage::getConfig()->getNode('default/unbxd/general/max_feed_lock_feed');
123
+ if(is_null($maxFeedLockTime)) {
124
+ $maxFeedLockTime = Unbxd_Recommendation_Model_Config::MAX_FEED_LOCK_TIME;
125
+ }
126
+
127
+ if(round($diff / ( 60 * 60 )) > $maxFeedLockTime) {
128
+ return false;
129
+ }
130
+ }
131
+
132
  return true;
133
  }
134
  }
app/code/local/Unbxd/Recommendation/Model/Resource/Field.php CHANGED
@@ -26,6 +26,8 @@ class Unbxd_Recommendation_Model_Resource_Field extends Mage_Core_Model_Mysql4_A
26
 
27
  const CATEGORY_IDS_NAME = "categoryIds";
28
 
 
 
29
  const CATEGORY_NAME = "category";
30
 
31
  const AVAILABILITY = 'availability';
26
 
27
  const CATEGORY_IDS_NAME = "categoryIds";
28
 
29
+ const CATEGORY_IDS = "category_ids";
30
+
31
  const CATEGORY_NAME = "category";
32
 
33
  const AVAILABILITY = 'availability';
app/code/local/Unbxd/Recommendation/Model/Resource/Product/Collection.php CHANGED
@@ -21,6 +21,88 @@ class Unbxd_Recommendation_Model_Resource_Product_Collection extends Mage_Catalo
21
  return $this->_productLimitationPrice(true);
22
  }
23
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  }
25
 
26
  ?>
21
  return $this->_productLimitationPrice(true);
22
  }
23
 
24
+ /**
25
+ * Merge colle
26
+ * @param $collection1
27
+ * @param $collection2
28
+ * @return mixed
29
+ */
30
+ public function mergeCollection($collection) {
31
+ foreach($collection as $product) {
32
+ if(!array_key_exists($product->getEntityId(), $this->_items)) {
33
+ $this->addItem($product);
34
+ }
35
+ }
36
+ return $this;
37
+ }
38
+
39
+ /**
40
+ * sets collection is loaded
41
+ * @param $collection
42
+ * @return $this
43
+ */
44
+ public function virtuallyLoad($collection) {
45
+ $this->_setIsLoaded(true);
46
+ return $this;
47
+ }
48
+
49
+ public function addIncrementalUploadFiltersToAdd(Mage_Core_Model_Website $website, $fromDate,
50
+ $toDate, $productIds = array()) {
51
+ $this->_addBasicFilterToUpload($website);
52
+ $this->addAttributeToFilter(array(
53
+ array( 'attribute' => 'updated_at',
54
+ 'from' => $fromDate,
55
+ 'to' => $toDate,
56
+ 'date' => true
57
+ ),
58
+ array( 'attribute' => 'entity_id',
59
+ 'in' => $productIds
60
+ )
61
+ ));
62
+ Mage::helper('unbxd_recommendation')->log(Zend_Log::DEBUG, (string)$this->getSelect());
63
+ return $this;
64
+ }
65
+
66
+ public function addIncrementalUploadFiltersToDelete(Mage_Core_Model_Website $website, $fromDate, $toDate) {
67
+ $this->addAttributeToSelect('entity_id');
68
+ $this->addAttributeToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_DISABLED);
69
+ $this->addAttributeToFilter(array(
70
+ array( 'attribute' => 'updated_at',
71
+ 'from' => $fromDate,
72
+ 'to' => $toDate,
73
+ 'date' => true
74
+ )
75
+ ));
76
+ return $this;
77
+
78
+ }
79
+
80
+ protected function _addBasicFilterToUpload(Mage_Core_Model_Website $website){
81
+ $adapter = Mage::getSingleton("core/resource");
82
+ $_catalogInventoryTable = method_exists($adapter, 'getTableName')
83
+ ? $adapter->getTableName('cataloginventory_stock_item'): 'catalog_category_product_index';
84
+
85
+ $this
86
+ ->addWebsiteFilter($website->getWebsiteId())
87
+ ->joinField("qty", $_catalogInventoryTable, 'qty', 'product_id=entity_id', null, 'left')
88
+ ->addAttributeToSelect('*')
89
+ ->addCategoryIds()
90
+ ->addPriceData(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID, $website->getWebsiteId());
91
+
92
+ Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($this);
93
+ Mage::getSingleton('catalog/product_visibility')->addVisibleInSiteFilterToCollection($this);
94
+ return $this;
95
+ }
96
+
97
+
98
+ /**
99
+ * method to get the catalog collection
100
+ *
101
+ */
102
+ public function addFullUploadFilters(Mage_Core_Model_Website $website) {
103
+ $this->_addBasicFilterToUpload($website);
104
+ return $this;
105
+ }
106
  }
107
 
108
  ?>
app/code/local/Unbxd/Recommendation/Model/Resource/Sync.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Unbxd
5
+ * @package Unbxd_Recommendation
6
+ * @author Unbxd Software Pvt. Ltd
7
+ */
8
+ class Unbxd_Recommendation_Model_Resource_Sync extends Mage_Core_Model_Mysql4_Abstract {
9
+
10
+ /**
11
+ * @return void
12
+ */
13
+ protected function _construct()
14
+ {
15
+ $this->_init('unbxd_recommendation/sync', 'id');
16
+ }
17
+ }
app/code/local/Unbxd/Recommendation/Model/Resource/Sync/Collection.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Unbxd
5
+ * @package Unbxd_Recommendation
6
+ * @author Unbxd Software Pvt. Ltd {
7
+ */
8
+ class Unbxd_Recommendation_Model_Resource_Sync_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
9
+ {
10
+ /**
11
+ */
12
+ public function _construct()
13
+ {
14
+ $this->_init('unbxd_recommendation/sync');
15
+ }
16
+
17
+ /**
18
+ * add field to Filter
19
+ * @param $websiteId
20
+ * @return void
21
+ */
22
+ public function addWebsiteFilter($websiteIds) {
23
+ $this->addFieldToFilter(Unbxd_Recommendation_Model_Sync::WEBSITE_ID, $websiteIds);
24
+ return $this;
25
+ }
26
+
27
+ /**
28
+ * Add Unsync filter
29
+ * @return void
30
+ */
31
+ public function addUnsyncFilter() {
32
+ $this->addFieldToFilter(Unbxd_Recommendation_Model_Sync::SYNCED,
33
+ Unbxd_Recommendation_Model_Sync::SYNCED_FALSE);
34
+ return $this;
35
+ }
36
+
37
+ /**
38
+ * Add Synced filter
39
+ * @return void
40
+ */
41
+ public function addSyncFilter() {
42
+ $this->addFieldToFilter(Unbxd_Recommendation_Model_Sync::SYNCED,
43
+ Unbxd_Recommendation_Model_Sync::SYNCED_TRUE);
44
+ return $this;
45
+ }
46
+
47
+ public function addOperationFilter($operation = Unbxd_Recommendation_Model_Sync::OPERATION_ADD) {
48
+ $this->addFieldToFilter(Unbxd_Recommendation_Model_Sync::OPERATION, $operation);
49
+ return $this;
50
+ }
51
+ }
52
+
53
+ ?>
app/code/local/Unbxd/Recommendation/Model/Sync.php ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Model which maintains the product sync
5
+ * @category Unbxd
6
+ * @package Unbxd_Recommendation
7
+ * @author Unbxd Software Pvt. Ltd
8
+ */
9
+ class Unbxd_Recommendation_Model_Sync extends Mage_Core_Model_Abstract {
10
+
11
+ /** Value to store the synced boolean value */
12
+ const SYNCED_FALSE = 0;
13
+
14
+ /** Value to store the synced boolean value */
15
+ const SYNCED_TRUE = 1;
16
+
17
+ const WEBSITE_ID = 'website_id';
18
+
19
+ const SYNCED = 'synced';
20
+
21
+ const SYNCED_TIME = 'sync_time';
22
+
23
+ const PRODUCT_ID = 'product_id';
24
+
25
+ const OPERATION_ADD = 'ADD';
26
+
27
+ const OPERATION_DELETE = 'DELETE';
28
+
29
+ const OPERATION = 'operation';
30
+
31
+ const UPDATED_TIME = 'updated_time';
32
+
33
+ /**
34
+ *
35
+ * @return void
36
+ */
37
+ protected function _construct()
38
+ {
39
+ $this->_init('unbxd_recommendation/sync');
40
+
41
+ }
42
+
43
+ /**
44
+ * Method to addProduct to sync
45
+ * @param Mage_Catalog_Model_Product $product
46
+ * @return bool
47
+ */
48
+ public function addProduct(Mage_Catalog_Model_Product $product = null) {
49
+ if (is_null($product) || !$product->hasData('entity_id')) {
50
+ Mage::helper('unbxd_recommendation')->log(Zend_Log::ERR, 'product argument sent is empty');
51
+ return false;
52
+ }
53
+ $write = Mage::getSingleton("core/resource")->getConnection("core_write");
54
+ foreach($product->getWebsiteIds() as $websiteId) {
55
+
56
+ $query = "insert into " . $this->getResource()->getTable('unbxd_recommendation/sync')
57
+ . "(".self::PRODUCT_ID.", ".self::WEBSITE_ID.", ".self::SYNCED.",".self::UPDATED_TIME.") values "
58
+ . "(:productId, :websiteId, :synced, :updated_time) ON DUPLICATE KEY
59
+ UPDATE ".self::UPDATED_TIME."=NOW(), ".self::SYNCED." = 0, ".self::OPERATION." = :operation";
60
+
61
+ $binds = array(
62
+ 'productId' => $product->getEntityId(),
63
+ 'websiteId' => $websiteId,
64
+ 'synced' => self::SYNCED_FALSE,
65
+ 'updated_time' => date('Y-m-d H:i:s'),
66
+ 'operation' => self::OPERATION_ADD
67
+ );
68
+ $write->query($query, $binds);
69
+ }
70
+ }
71
+
72
+ /**
73
+ * Method to addProduct to sync
74
+ * @param Mage_Catalog_Model_Product $product
75
+ * @return bool
76
+ */
77
+ public function deleteProduct(Mage_Catalog_Model_Product $product = null) {
78
+ if (is_null($product) || !$product->hasData('entity_id')) {
79
+ Mage::helper('unbxd_recommendation')->log(Zend_Log::ERR, 'product argument sent is empty');
80
+ return false;
81
+ }
82
+ $write = Mage::getSingleton("core/resource")->getConnection("core_write");
83
+ foreach($product->getWebsiteIds() as $websiteId) {
84
+
85
+ $query = "insert into " . $this->getResource()->getTable('unbxd_recommendation/sync')
86
+ . "(product_id, website_id, synced, operation, updated_time) values "
87
+ . "(:productId, :websiteId, :synced, :operation, :updated_time) ON DUPLICATE KEY
88
+ UPDATE ".self::UPDATED_TIME."=NOW(), ".self::SYNCED." = 0, ".self::OPERATION." = :operation";
89
+
90
+ $binds = array(
91
+ 'productId' => $product->getEntityId(),
92
+ 'websiteId' => $websiteId,
93
+ 'synced' => self::SYNCED_FALSE,
94
+ 'operation' => self::OPERATION_DELETE,
95
+ 'updated_time' => date('Y-m-d H:i:s')
96
+ );
97
+ $write->query($query, $binds);
98
+ }
99
+ }
100
+
101
+
102
+ public function markItSynced($websiteId, $fromTime, $toTime) {
103
+ $write = Mage::getSingleton("core/resource")->getConnection("core_write");
104
+ $query = "update " . $this->getResource()->getTable('unbxd_recommendation/sync')
105
+ . " set ".self::SYNCED." = 1, ".self::SYNCED_TIME." = :currentTime
106
+ where ".self::WEBSITE_ID." = :websiteId
107
+ and ".self::UPDATED_TIME." < :toTime and ".self::UPDATED_TIME." > :fromTime";
108
+
109
+ $binds = array(
110
+ 'currentTime' => date('Y-m-d H:i:s'),
111
+ 'websiteId' => $websiteId,
112
+ 'toTime' => $toTime,
113
+ 'fromTime' => $fromTime
114
+ );
115
+ $write->query($query, $binds);
116
+ }
117
+ }
app/code/local/Unbxd/Recommendation/controllers/ConfigController.php CHANGED
@@ -289,9 +289,15 @@ class Unbxd_Recommendation_ConfigController extends Mage_Core_Controller_Front_A
289
  if (is_null($website)) {
290
  return;
291
  }
292
- $fromdate="1970-01-01 00:00:01";
 
 
 
 
 
 
293
 
294
- $response = Mage::getSingleton('unbxd_recommendation/feed_feedmanager')->process($fromdate,$website);
295
  $this->getResponse()->setBody(json_encode($response));
296
  return;
297
  }
289
  if (is_null($website)) {
290
  return;
291
  }
292
+ ignore_user_abort(true);
293
+ set_time_limit(0);
294
+ $isFullUpload = true;
295
+ $feedMgr = Mage::getSingleton('unbxd_recommendation/feed_feedmanager');
296
+ if(array_key_exists('incremental', $_REQUEST)) {
297
+ $isFullUpload = false;
298
+ }
299
 
300
+ $response = $feedMgr->process($isFullUpload, $website);
301
  $this->getResponse()->setBody(json_encode($response));
302
  return;
303
  }
app/code/local/Unbxd/Recommendation/etc/config.xml CHANGED
@@ -1,7 +1,7 @@
1
  <config>
2
  <modules>
3
  <Unbxd_Recommendation>
4
- <version>1.0.16</version>
5
  </Unbxd_Recommendation>
6
  </modules>
7
  <admin>
@@ -60,6 +60,9 @@
60
  <field>
61
  <table>unbxd_field_conf</table>
62
  </field>
 
 
 
63
  </entities>
64
  </unbxd_recommendation_resource>
65
  </models>
@@ -87,6 +90,42 @@
87
  </unbxd_recommendation_order_tracker>
88
  </observers>
89
  </sales_order_payment_place_end>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
  </events>
91
  </global>
92
  <adminhtml>
@@ -106,4 +145,11 @@
106
  </unbxd_recommendation_cron>
107
  </jobs>
108
  </crontab>
 
 
 
 
 
 
 
109
  </config>
1
  <config>
2
  <modules>
3
  <Unbxd_Recommendation>
4
+ <version>1.0.17</version>
5
  </Unbxd_Recommendation>
6
  </modules>
7
  <admin>
60
  <field>
61
  <table>unbxd_field_conf</table>
62
  </field>
63
+ <sync>
64
+ <table>unbxd_product_sync</table>
65
+ </sync>
66
  </entities>
67
  </unbxd_recommendation_resource>
68
  </models>
90
  </unbxd_recommendation_order_tracker>
91
  </observers>
92
  </sales_order_payment_place_end>
93
+ <catalog_product_delete_before>
94
+ <observers>
95
+ <unbxd_recommendation_order_tracker>
96
+ <type>singleton</type>
97
+ <class>unbxd_recommendation/observer</class>
98
+ <method>trackDeleteOfChildProduct</method>
99
+ </unbxd_recommendation_order_tracker>
100
+ </observers>
101
+ </catalog_product_delete_before>
102
+ <catalog_product_delete_commit_after>
103
+ <observers>
104
+ <unbxd_recommendation_order_tracker>
105
+ <type>singleton</type>
106
+ <class>unbxd_recommendation/observer</class>
107
+ <method>trackDeleteOfMainProduct</method>
108
+ </unbxd_recommendation_order_tracker>
109
+ </observers>
110
+ </catalog_product_delete_commit_after>
111
+ <cataloginventory_stock_item_save_commit_after>
112
+ <observers>
113
+ <unbxd_recommendation_catalog_inventory_save>
114
+ <type>singleton</type>
115
+ <class>unbxd_recommendation/observer</class>
116
+ <method>catalogInventorySave</method>
117
+ </unbxd_recommendation_catalog_inventory_save>
118
+ </observers>
119
+ </cataloginventory_stock_item_save_commit_after>
120
+ <sales_order_item_cancel>
121
+ <observers>
122
+ <unbxd_recommendation_order_cancel>
123
+ <type>singleton</type>
124
+ <class>unbxd_recommendation/observer</class>
125
+ <method>catalogInventorySave</method>
126
+ </unbxd_recommendation_order_cancel>
127
+ </observers>
128
+ </sales_order_item_cancel>
129
  </events>
130
  </global>
131
  <adminhtml>
145
  </unbxd_recommendation_cron>
146
  </jobs>
147
  </crontab>
148
+ <default>
149
+ <unbxd>
150
+ <general>
151
+ <max_feed_lock_feed>6</max_feed_lock_feed>
152
+ </general>
153
+ </unbxd>
154
+ </default>
155
  </config>
app/code/local/Unbxd/Recommendation/sql/unbxd_recommendation_setup/upgrade-1.0.11-1.0.12.php CHANGED
@@ -17,10 +17,10 @@ INSERT INTO `{$fieldTable}` (`website_id`, `field_name`, `datatype`, `autosugges
17
  VALUES
18
  ({$websiteId}, 'gender', 'text', 0, 'gender', 0, 1),
19
  ({$websiteId}, 'description', 'longText', 0, 'description', 0, 1),
20
- ({$websiteId}, 'catLevel1Name', 'text', 0, 'catLevel1Name', 0, 0),
21
- ({$websiteId}, 'catLevel2Name', 'text', 0, 'catLevel2Name', 0, 0),
22
- ({$websiteId}, 'catLevel3Name', 'text', 0, 'catLevel3Name', 0, 0),
23
- ({$websiteId}, 'catLevel4Name', 'text', 0, 'catLevel4Name', 0, 0),
24
  ({$websiteId}, 'categoryLevel1', 'text', 0, NULL, 1, 0),
25
  ({$websiteId}, 'categoryLevel2', 'text', 0, NULL, 1, 0),
26
  ({$websiteId}, 'categoryLevel3', 'text', 0, NULL, 1, 0),
17
  VALUES
18
  ({$websiteId}, 'gender', 'text', 0, 'gender', 0, 1),
19
  ({$websiteId}, 'description', 'longText', 0, 'description', 0, 1),
20
+ ({$websiteId}, 'catLevel1Name', 'text', 0, 'catlevel1Name', 0, 0),
21
+ ({$websiteId}, 'catLevel2Name', 'text', 0, 'catlevel2Name', 0, 0),
22
+ ({$websiteId}, 'catLevel3Name', 'text', 0, 'catlevel3Name', 0, 0),
23
+ ({$websiteId}, 'catLevel4Name', 'text', 0, 'catlevel4Name', 0, 0),
24
  ({$websiteId}, 'categoryLevel1', 'text', 0, NULL, 1, 0),
25
  ({$websiteId}, 'categoryLevel2', 'text', 0, NULL, 1, 0),
26
  ({$websiteId}, 'categoryLevel3', 'text', 0, NULL, 1, 0),
app/code/local/Unbxd/Recommendation/sql/unbxd_recommendation_setup/upgrade-1.0.16-1.0.17.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ /* @var $installer Mage_Core_Model_Resource_Setup */
5
+
6
+ $installer->startSetup();
7
+ $productSyncTable = $installer->getTable('unbxd_product_sync');
8
+
9
+ $installer->run("
10
+ DROP TABLE IF EXISTS `{$productSyncTable}`;
11
+ CREATE TABLE `{$productSyncTable}` (
12
+ `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
13
+ `product_id` int(10) unsigned NOT NULL,
14
+ `website_id` smallint(5) unsigned NOT NULL,
15
+ `synced` tinyint(1) NOT NULL DEFAULT '0',
16
+ `updated_time` datetime DEFAULT NULL,
17
+ `sync_time` datetime DEFAULT NULL,
18
+ `operation` enum('ADD','DELETE') NOT NULL DEFAULT 'ADD',
19
+ PRIMARY KEY (`id`),
20
+ UNIQUE KEY `product_id` (`product_id`,`website_id`)
21
+ ) ENGINE=InnoDB DEFAULT CHARSET=latin1;");
22
+ $installer->endSetup();
app/etc/modules/Unbxd_Recommendation.xml CHANGED
@@ -1,8 +1,12 @@
1
  <config>
2
  <modules>
3
- <Unbxd_Recommendation>
4
- <active>true</active>
5
- <codePool>local</codePool>
6
- </Unbxd_Recommendation>
 
 
 
 
7
  </modules>
8
  </config>
1
  <config>
2
  <modules>
3
+ <Unbxd_Core>
4
+ <active>true</active>
5
+ <codePool>local</codePool>
6
+ </Unbxd_Core>
7
+ <Unbxd_Recommendation>
8
+ <active>true</active>
9
+ <codePool>local</codePool>
10
+ </Unbxd_Recommendation>
11
  </modules>
12
  </config>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>unbxd_recommendation</name>
4
- <version>1.0.16</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
  <channel>community</channel>
@@ -10,9 +10,9 @@
10
  <description>helps integrating the unbxd recommender widgets</description>
11
  <notes>pdp top sellers fix</notes>
12
  <authors><author><name>ananthesh</name><user>ananthesh</user><email>ananthesh@unbxd.com</email></author></authors>
13
- <date>2015-02-12</date>
14
- <time>11:34:54</time>
15
- <contents><target name="magelocal"><dir name="Unbxd"><dir name="Recommendation"><dir name="Block"><file name="Admin.php" hash="82a902698e1b090d0e532905ed7f2d37"/><file name="Tracker.php" hash="d41d8cd98f00b204e9800998ecf8427e"/></dir><dir name="Helper"><file name="Confighelper.php" hash="8fc5f4943a0ae3cf92c30ccff9131bea"/><file name="Data.php" hash="74562d257ec4ef3add0fbd90ea51e671"/><file name="Feedhelper.php" hash="b191295ab12f9e4dc28c9577cc734138"/></dir><dir name="Model"><dir name="Api"><file name="Request.php" hash="98c92b643e28e750a8bb2e6a384733de"/><file name="Response.php" hash="448a7f48496babd313e4ac147405fea1"/><dir name="Task"><file name="Analyticsimpression.php" hash="cc65a5549dba4f6a0cc1b52d9a273b18"/><file name="Feeddetails.php" hash="60bc2c9f743d5ee9c3b5dce4dd8e2e0a"/><file name="Trackcart.php" hash="4e4ba196f66cbbd17abc7415ac312f7e"/><file name="Trackorder.php" hash="ba8204eb82fea24cc0b5e27cd5ab7936"/><file name="Triggerfeedupload.php" hash="4e1c645ae51d655be2ac7b1ad90b5fa6"/><file name="Updatefeaturefields.php" hash="112ce06194a30f53515846dc7c219ac0"/><file name="Validatekeys.php" hash="b4b0c1a945a9ec1d0adc534a7d2bc08f"/><file name="Widget.php" hash="01e3bb20e839f19fa7db3592fbe75b19"/></dir><file name="Task.php" hash="d6b35467cd84fc99b9ea70ae55f2c727"/></dir><file name="Config.php" hash="67a0fda09eb4ae9b9ba3c421eae46efc"/><dir name="Feed"><file name="Feedcreator.php" hash="3dbf663662073add542414630baf1225"/><file name="Feedmanager.php" hash="1a1982a4e0fd192ba84560615a07d624"/><file name="Filemanager.php" hash="9e3602428c8783c68f9bb951f52120ba"/><dir name="Jsonbuilder"><file name="Jsonbuilder.php" hash="31f422f3cf18f057e887c9f1812538a2"/><file name="Productbuilder.php" hash="ac385f8d756981dd2c3ba0cddc3fb288"/><file name="Schemabuilder.php" hash="b41389c9ffa08063d5559f05d2367238"/><file name="Taxonomybuilder.php" hash="f4829a5902d7320901efa33d0dfc9e81"/></dir></dir><file name="Field.php" hash="7d344b852abd182df2f54ef73334eadf"/><file name="Observer.php" hash="bf0f63c6c24ba1fce3b059fba84e9041"/><dir name="Resource"><file name="Attribute.php" hash="bdd6026954b734430903f3fdb2a2f1e6"/><dir name="Config"><file name="Collection.php" hash="f50c88e3f7c10137ea9da5fc890218b5"/></dir><file name="Config.php" hash="8a08f5c9b2345f9e6899419a47aeec9f"/><dir name="Field"><file name="Collection.php" hash="455d7a3e8fce1741c189c86ed5fc5e22"/></dir><file name="Field.php" hash="d2a322f079651f30e62c0a65ff2a3ffa"/><dir name="Product"><file name="Collection.php" hash="fdacb1b6d49eee2ac385766e49cfc307"/></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="IndexController.php" hash="560810e25071ac9f4b9835911a66a741"/></dir><file name="ConfigController.php" hash="01071bfd5b52b178e08e7c04b3ce613b"/><file name="WidgetController.php" hash="ea4697c1d659612681b9c01ec2803b4f"/></dir><dir name="etc"><file name="adminhtml.xml" hash="8a9b714c7ccdff748ec0345861034658"/><file name="config.xml" hash="6a0c970de1f5f26d6f5e89686b3dc2fc"/></dir><dir name="sql"><dir name="unbxd_recommendation_setup"><file name="mysql4-install-1.0.0.php" hash="43e07764886f75274d3866d305c0daae"/><file name="upgrade-1.0.11-1.0.12.php" hash="9abd85ccafc09c4ef619a2fa5a84e7d4"/></dir></dir><file name=".DS_Store" hash="b4a356bd7741138b66aa79afcc4abd2f"/></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="unbxd"><file name="recommendation.xml" hash="a2f03791a48c83fceee42822f19695f5"/></dir></dir><dir name="template"><dir name="unbxd"><file name="recommendation.phtml" hash="42d2370984e91190003c254f4c5332f5"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="unbxd"><file name="tracker.phtml" hash="fcc3a7975e2e3c92ea010a4d98e3fe97"/><dir name="tracking"><file name="cart.phtml" hash="1602ccd541917fdaa539b88b59e16933"/><file name="category.phtml" hash="59b245e277bf1bd171354893a624d922"/><file name="order.phtml" hash="3ddc154f41138d5f924bc415f8feeb9b"/><file name="product.phtml" hash="bb4ce6b658e11aa24a9b322befcd5353"/></dir></dir></dir><dir name="layout"><dir name="unbxd"><file name="recommendation.xml" hash="79b0ba853521b40bc26c6efc2e57282e"/></dir></dir></dir></dir></dir></target><target name="mageweb"><dir name="skin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="unbxd"><dir name="css"><file name="app.css" hash="d8be8236609ed4e422db6996cb866383"/><file name="bootstrap-them.css" hash="df854606e8bfb38abe58305c389301ae"/><file name="bootstrap.css" hash="59899c8b554b99637d119d3fe5f844de"/><file name="chosen.css" hash="50141f749f8ed2dd209682800618dca2"/><file name="unbxd-magento.css" hash="a5a0805eeba3db5f96910670bfc7b9bf"/></dir><dir name="img"><file name="Custom-platform.png" hash="d053db68b99519a2b0303624ab647f16"/><file name="DONE.png" hash="470356a4749d5fde1b86d9c0eeb9c806"/><file name="HEXAGON-Only.png" hash="f070ca957f922446f715555d94192298"/><file name="Magento-small.png" hash="0b80c21a5daa1669317095843590aa10"/><file name="Magento.png" hash="23b3159d445fe3fe5de7ea4a6d7f0271"/><file name="X-popup-hover.png" hash="41022fc34b63fc668477bcb991652577"/><file name="X-popup.png" hash="301b49b195fd8e9106eef93805182c11"/><file name="X-pricing.png" hash="ab7c15dacab6b4e13e19d9614741e9ef"/><file name="add-actv.png" hash="51bfeb67fce50aef4fe79ccea4e0d840"/><file name="add-icon.png" hash="46dea9858757fa584de457bfc421269f"/><file name="add-inactv.png" hash="164d79389bcd58d9d606871307d16e7e"/><file name="add-raw-hover.png" hash="591316d60847c12340d66cea0eb2ee97"/><file name="add-raw.png" hash="1fcdb060d898a7807bb37c796a772993"/><file name="add.png" hash="9a4026af014537b7d18032fd3a1bcb05"/><file name="arrow-2.png" hash="627be933821070bb0514ba331739cbdb"/><file name="arrow-calendar-down.png" hash="15a5f0cba1424dbc6d7f2069dca59a2a"/><file name="arrow-calendar-down1.png" hash="ed6aac9b4e114418f639ce874e75ed19"/><file name="arrow-down-disabled.jpg" hash="5b62a642490f264b58771e38e687eb19"/><file name="arrow-down-enabled.jpg" hash="4a0b2fafe44c58dd390d5eb0473c365e"/><file name="arrow-down-white.jpg" hash="edd441fe8c391969859dc72e5e95e83c"/><file name="arrow-down-white1.jpg" hash="6b7c7662f141a30635d408dad048dd54"/><file name="arrow-down-white2.jpg" hash="bd948050a2d7b0b6dfd7e349734df63b"/><file name="arrow-down.png" hash="379a11ee447d83e850a03581928acae8"/><file name="arrow-gray.png" hash="6e345006dfc2b0f1e52b8266c21bcbbc"/><file name="arrow-left-white.jpg" hash="36a0b2d5784c980a54edb3b874bc47c7"/><file name="arrow-left.jpg" hash="e22a795292c8bf95e62c86d7f5c3a149"/><file name="arrow-mail-developer).png" hash="a96ecd000175538c0dd0914395cf203d"/><file name="arrow-right-blue.png" hash="4ef79b5fc672c2a285b0c2ba5504f1e4"/><file name="arrow-right-gray.jpg" hash="5ac0235afe90023e26126134f151a2bd"/><file name="arrow-right-white.jpg" hash="9916e44542fbaa7a9e9b69f3551d321f"/><file name="arrow-right.jpg" hash="c2ad8f3435733f35a46fd8fdf29a9323"/><file name="arrow-up-black.png" hash="1e5a76b450fd32c3577078829d38ac58"/><file name="arrow-up-disabled.jpg" hash="6659a79f97099b525bd1b0713b99ad8b"/><file name="arrow-up-enabled.jpg" hash="4074eee100e01429ea4defed741b2ac2"/><file name="arrow-up-red.png" hash="84b29f0c6964c69ed6e78501123bfccf"/><file name="arrow-up-white.jpg" hash="38d5ec238c32cb7124fb6bc31ffe126e"/><file name="arrow-up-white1.jpg" hash="3221729d064ae198dff6effcc62e6a5e"/><file name="arrow-up.png" hash="6c54432350ad68d3345eb151d7534ae2"/><file name="arrow-white.png" hash="4b4e57f5b8d2b678df89b5a2dc85bba3"/><file name="arrow.png" hash="4b4e57f5b8d2b678df89b5a2dc85bba3"/><file name="authenticated.png" hash="78140247146f512d014be386a116a699"/><file name="back.png" hash="32b2ff86ee7ba8a1f19270a121f00205"/><file name="bg.jpg" hash="4a2f6fda25f44f7009e9a22ccf90e330"/><file name="big-arrow-gray.jpg" hash="745194d74525c2fd3238475c55a47cbc"/><file name="bigcommerce.png" hash="2a2599c562ec94be2545ab335131c71a"/><file name="black-right-small.jpg" hash="25253ab5ae165f13a1827ccd387d7b2f"/><file name="black-right-thick.jpg" hash="ae89e8e2c9d39ab8970782a829edeaeb"/><file name="btn-arrow-top.png" hash="42b3a9ffa2eccd2cfc9da9c33975f64c"/><file name="btn-arrow.png" hash="8cc68b6207307260a75bcc9331447c5e"/><file name="button-arrow-blue.png" hash="1e8d1741ecef49e021f35460fe16c76b"/><file name="button-arrow-grey.png" hash="76cd7acb80bf814c6605aa3f88c2c19b"/><file name="button-arrow-red.png" hash="03092367ac79745b0d7b2f9b707c802b"/><file name="cancel.png" hash="dd81fdd1129b4ef172d4c434d6156d87"/><file name="card-image.jpg" hash="bd1f292965163bbcc869a48bbe806deb"/><file name="card-image1.jpg" hash="95ccedbe1e8d01685f2527b08230b4a7"/><file name="card-image2.jpg" hash="963c39821d0cb5b1f0dfb691e12eefb5"/><file name="card-image3.jpg" hash="961e69aeecd5ab5d17743c5d3e4764cf"/><file name="checkmark.png" hash="4a0de13372944f21034dee674f92b7d1"/><file name="chosen-sprite.png" hash="25b9acb1b504c95c6b95c33986b7317e"/><file name="close-analytics.png" hash="0ca667d6de9a98999e37811861e6768e"/><file name="close.png" hash="daa5df0af5c219e136505132e18f5242"/><file name="color-pic.png" hash="470ec0178867dac04fcbce638c14a4cf"/><file name="congrats-magento.png" hash="ec3d2e0a2bf1d012e56583e89513664d"/><file name="congrats.png" hash="ec3d2e0a2bf1d012e56583e89513664d"/><file name="copy-black.png" hash="3f2b73b7287849ba2d341f194be7cd44"/><file name="copy-white.png" hash="208f74184462db7f5861d4c48dd300da"/><file name="cros.png" hash="bbf540cf6fe3d7fba4fab37b4d0b22c9"/><file name="cross-2.png" hash="1dfc504ed86c82bd86de8c74a09c906f"/><file name="cvv-number.jpg" hash="0ada16245fd0cb05a3967461eba12a28"/><file name="delete-raw-hover.png" hash="e3df4faf0450feaa2aed503dbf6759df"/><file name="delete-raw.png" hash="09806aed8283ae6168ecfdcec8237881"/><file name="delete-red.png" hash="c070eaad8207d3fe4e839b0f63deb68c"/><file name="delete.png" hash="b45f9d0e4d1fd160dbaa6ec41559f369"/><file name="detect.png" hash="9b6980d0bbd7ea6bded8ad05be4db7dd"/><file name="down-arrow.png" hash="3d1e707e03353aa01ac7f66610214c6b"/><file name="down-black.png" hash="80236500f0e70d2312b12a0d15e5fa81"/><file name="down-gray.png" hash="160e694e54afdc73edf828e4f02f5945"/><file name="dropdown-arrow.png" hash="4450401ccb623ec2a0ccae215e8b2a63"/><file name="edit-magento.png" hash="043c35fcd4396838a0db85d8d93aed04"/><file name="edit.png" hash="043c35fcd4396838a0db85d8d93aed04"/><file name="eye-hover.png" hash="cf7047c5218c147959a7afc282c01568"/><file name="eye.png" hash="b7a4815cce6e051a785f417f0ecb3427"/><file name="favicon.png" hash="402ca129cd67c7601ea429310c6aa2f5"/><file name="fill.png" hash="4bb20f0886094d62ac0c741edcc03742"/><file name="group-arrow.png" hash="89eba421d4e2a3f83e47e00f26e80888"/><file name="help.png" hash="94b200dfffcdb8ded1429791c2d22b8c"/><file name="icon-analytics.png" hash="4e62393fa4013bdc4e134b469dcd280b"/><file name="icon-info.png" hash="52c2f72d690d0f979afcb5a712b34c3c"/><file name="icon-widget.png" hash="8d6ed9abd86d3095993b4ca773bfdbc3"/><file name="install.png" hash="b284e88eb06554283ef98d6f50836e46"/><file name="integration-gray.png" hash="0fc90ad557b62f693098d862d5599085"/><file name="introduction-gray.png" hash="092fce8aa83ab7bcdb9b7a7a62b4a7d6"/><file name="left-black.png" hash="24b87ee6bf514b8666b12d7d9297eb4e"/><file name="left-gray.png" hash="e53e0389cd719dd5aed2ad6017d32b0e"/><file name="level-arrow-active.png" hash="56bbbf4701324c79e111a36abc235092"/><file name="level-arrow.png" hash="5861fea9a80e3c4fcc14210569d7effa"/><file name="link-arrow.png" hash="21354972164f512795bf1f54c6a71f3f"/><file name="loader-16x16.gif" hash="778e6b9e73274330dae0dab8104948a0"/><file name="loader-24x24.gif" hash="e403534956d055d636b3a5fa813b82b7"/><file name="loader-32x32.gif" hash="009c5064d779a3c67a202f299bd5d301"/><file name="loader.gif" hash="fd1345456c4a685afb42b67c25354ca2"/><file name="loader_black.gif" hash="5bfd8de3193a5fc2e5b472f57df1408f"/><file name="lock-image.jpg" hash="e80f8aa765e8ea121b056e188651629b"/><file name="logo-unbxd.png" hash="0b6c4b8887f8d57577023d8ddc1fa951"/><file name="logo.png" hash="27fa979ee65c84aefd15ffd6cc973e4d"/><file name="mail-new.png" hash="831e8c8c1eba8f4733d1d1e44a8c6549"/><file name="mail.png" hash="1cf907fd4c5d98230c7c2b89d6ff235f"/><file name="minus.jpg" hash="bdddd9b0d971d461a7e472b5bf38bfce"/><file name="nav-highlight-arrow.png" hash="64f6ae56f54568594d04df5c80ce069c"/><file name="not-detected.png" hash="59d0c0115b4b9f192eb4a77f22ce1609"/><file name="oops.png" hash="0735ac87c8e81325be4dc901ba354937"/><file name="or.png" hash="64c351e685fdb8339b7c7857ff14f56d"/><file name="other-gray.png" hash="646b84e4629dfadf3163bc9cd1aa83de"/><file name="overview-gray.png" hash="498e242cdd5b738d088d7ed4ae6c8e3e"/><file name="plus.jpg" hash="a8b80b4d5eee0ad842ce22ee7ea4c752"/><file name="question-mark2.jpg" hash="de9555459f3b9c93482c4a6061fea66b"/><file name="red-cross.png" hash="4213a8ee001ae75166d270be44b199a0"/><file name="red-loading.gif" hash="e644579431a4666564d92ec62c7c74e2"/><file name="remove.png" hash="401b59fb5aed9c68e5f1b3e47fe6ea60"/><file name="right-black.png" hash="fce5a7892866ef65e91fb006b1959c21"/><file name="right-gray.png" hash="b09daca9ca3c40451de0d62fbadd3cf6"/><file name="save.png" hash="fd61c5589c9fabe20a988121822ef81a"/><file name="search.png" hash="71829ed3818c8832469c46d1f9203be0"/><file name="settings.png" hash="9dd7ca159584c09c41717c578f8aa1f6"/><file name="shopify.png" hash="93d8d9c1dd93680819fd642f9136b07c"/><file name="site-dropdownarrow-down.png" hash="c4c89958d88c58785c15e11c83bf0c4a"/><file name="site-dropdownarrow-up.png" hash="f52281c034fdc67f339efeab9127ddfc"/><file name="slider-bg.png" hash="242bb276022f24fc7ac71b181dd34e36"/><file name="slider-button.png" hash="4d17b9bd17415f9df5ccfafefcd32a24"/><file name="sort-arrow-blue-down.png" hash="1fd1bfd16d5f3a9c15017248a7d7f0e0"/><file name="sort-arrow-blue-up.png" hash="24eee605bc0fc9432b7b499633a6c7bc"/><file name="sort-arrow-grey-down.png" hash="b64554cc698560bb38bb43a7a6480dd3"/><file name="sort-arrow-grey-up.png" hash="d14911ddaef0a4de79b1a4a54efbf68b"/><file name="spree.png" hash="119dbad2cfa857a786d746158b9f36f0"/><file name="start-gray.png" hash="fe86f1b188d5b3f0f375421aa5435939"/><file name="step-arrow.png" hash="167c9a25eda4cd9bb4d88762883ba47d"/><file name="success.png" hash="4a8d69083fc4447d9c4ae9bdcc6560ce"/><file name="tick-analytics.png" hash="da1c588c876b2ea12bede76ef17ca1ff"/><file name="tick-green.png" hash="5108aa311b8e64e8f69642a53e4d3506"/><file name="tick-pricing.png" hash="42b0c3bb2c8e270833b0856360722124"/><file name="tick.png" hash="a5bb66f590af2746711bfdefe3b37d7a"/><file name="tooltip-arrow.png" hash="d37dac7a1d706a453ea0637f1db04907"/><file name="tooltip-left-arrow.jpg" hash="90143af415043466956e264b5e9a5910"/><file name="tooltip.png" hash="39a75f32b4b78b07033635f14a182124"/><file name="up-arrow.png" hash="f3d15dec451c405decfbc6d3a3fa7696"/><file name="up-black.png" hash="e77b8b75ecf6e5e63eed7fbb84c265a3"/><file name="up-gray.png" hash="0c721f2f05c729e07bd22a0a90f51ab0"/><file name="user.png" hash="ad7be0166b1484d9ff9e1d2708c83a71"/><file name="warning.png" hash="43e8ab0f26ce3ecf8ecdd162a8c8f366"/><file name="x-widget.png" hash="f000d6861e99a51e5ea2fdf68e0e0910"/><file name="x.png" hash="c517855b1803534e2bcecc9ed50808a9"/></dir><dir name="js"><file name="app.js" hash="6c610a36fd3974af49e009f32e3697c7"/><dir name="lib"><file name="bootstrap-tooltip.js" hash="304bf569ee1a25e8fae5532d90661662"/><file name="chosen.js" hash="4fabe14fb10d99c4b432db5ce9847c06"/><file name="ractive-chosen.js" hash="837381e6e428a7fa2b9f8f67c974d195"/><file name="ractive.js" hash="4887bb0d23f93ca78c46d2a7420cd360"/></dir></dir><dir name="templates"><file name="analytics.html" hash="8885b3170719fcd525ad7a27bdf45624"/><file name="catalog.html" hash="1260ad88c8f004612863b528c0b6c3aa"/><file name="credentails.html" hash="1e6eb46ac91cf8083b7709659bc4783a"/><file name="custom.html" hash="4a4154b74c4ebbfde132857684c92e60"/><file name="widgets.html" hash="f337583a8def22cc39d62233bc8d0e0a"/></dir></dir></dir></dir></dir></dir><dir name="js"><dir name="unbxd"><file name="app.js" hash="5790870aa32c641bbad8d064fd41b610"/><file name="embed.js" hash="9ad60159c46080c5a071d54eb0ab6f9e"/><file name="jquery.js" hash="52d16e147b5346147d0f3269cd4d0f80"/><file name="unbxdAnalytics.js" hash="98738dccf6a9e9378e79ca6931d9d3c1"/></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Unbxd_Recommendation.xml" hash="8ea2aaae2654aa0caf10fa3b326fcdb0"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>unbxd_recommendation</name>
4
+ <version>1.0.17</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
  <channel>community</channel>
10
  <description>helps integrating the unbxd recommender widgets</description>
11
  <notes>pdp top sellers fix</notes>
12
  <authors><author><name>ananthesh</name><user>ananthesh</user><email>ananthesh@unbxd.com</email></author></authors>
13
+ <date>2015-03-03</date>
14
+ <time>10:17:03</time>
15
+ <contents><target name="magelocal"><dir name="Unbxd"><dir name="Recommendation"><dir name="Block"><file name="Admin.php" hash="82a902698e1b090d0e532905ed7f2d37"/><file name="Tracker.php" hash="d41d8cd98f00b204e9800998ecf8427e"/></dir><dir name="Helper"><file name="Confighelper.php" hash="8fc5f4943a0ae3cf92c30ccff9131bea"/><file name="Data.php" hash="74562d257ec4ef3add0fbd90ea51e671"/><file name="Feedhelper.php" hash="ba84484c3dacc8f4074ece9e5a0e8efb"/></dir><dir name="Model"><dir name="Api"><file name="Request.php" hash="98c92b643e28e750a8bb2e6a384733de"/><file name="Response.php" hash="448a7f48496babd313e4ac147405fea1"/><dir name="Task"><file name="Analyticsimpression.php" hash="cc65a5549dba4f6a0cc1b52d9a273b18"/><file name="Feeddetails.php" hash="60bc2c9f743d5ee9c3b5dce4dd8e2e0a"/><file name="Trackcart.php" hash="4e4ba196f66cbbd17abc7415ac312f7e"/><file name="Trackorder.php" hash="ba8204eb82fea24cc0b5e27cd5ab7936"/><file name="Triggerfeedupload.php" hash="4e1c645ae51d655be2ac7b1ad90b5fa6"/><file name="Updatefeaturefields.php" hash="112ce06194a30f53515846dc7c219ac0"/><file name="Validatekeys.php" hash="b4b0c1a945a9ec1d0adc534a7d2bc08f"/><file name="Widget.php" hash="e2b248692d8bca31389f4fc69438e1b7"/></dir><file name="Task.php" hash="d6b35467cd84fc99b9ea70ae55f2c727"/></dir><file name="Config.php" hash="ac5fbfd05c8b74ac466c1f2cf082dbf3"/><dir name="Feed"><file name="Feedcreator.php" hash="7bd33c4c3a7096bc52f3285b0692bbd4"/><file name="Feedmanager.php" hash="6a0c335f4f9195c9f23724ff04e1b23b"/><file name="Filemanager.php" hash="9e3602428c8783c68f9bb951f52120ba"/><dir name="Jsonbuilder"><file name="Jsonbuilder.php" hash="31f422f3cf18f057e887c9f1812538a2"/><file name="Productbuilder.php" hash="7b1fe4ddc3ad6e3843b24867fd143437"/><file name="Schemabuilder.php" hash="b41389c9ffa08063d5559f05d2367238"/><file name="Taxonomybuilder.php" hash="f4829a5902d7320901efa33d0dfc9e81"/></dir><file name="Tags.php" hash="5ff3fb1dfb70f25026f153bb222537f0"/></dir><file name="Field.php" hash="7d344b852abd182df2f54ef73334eadf"/><file name="Observer.php" hash="e1490f1bbd7e886df2eb6617277d9788"/><dir name="Resource"><file name="Attribute.php" hash="bdd6026954b734430903f3fdb2a2f1e6"/><dir name="Config"><file name="Collection.php" hash="f50c88e3f7c10137ea9da5fc890218b5"/></dir><file name="Config.php" hash="da016075736b5f799f9db4b85361aabf"/><dir name="Field"><file name="Collection.php" hash="455d7a3e8fce1741c189c86ed5fc5e22"/></dir><file name="Field.php" hash="a36c44f5335d5db472c521e5fd97cbab"/><dir name="Product"><file name="Collection.php" hash="f9832a0720d40d0750381aa8dbb0d0d7"/></dir><dir name="Sync"><file name="Collection.php" hash="ffec2577fdbbb27a6d2070020f526e0e"/></dir><file name="Sync.php" hash="22eb150ac02456c9dec11895bc3fd7ba"/></dir><file name="Sync.php" hash="8ee52a3c55dd05ad53d84f05cc1635b5"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="IndexController.php" hash="560810e25071ac9f4b9835911a66a741"/></dir><file name="ConfigController.php" hash="b9a9380eb767bb9a043662edcc94fbcf"/><file name="WidgetController.php" hash="ea4697c1d659612681b9c01ec2803b4f"/></dir><dir name="etc"><file name="adminhtml.xml" hash="8a9b714c7ccdff748ec0345861034658"/><file name="config.xml" hash="096a2c83643e8b75faa5b67661223889"/></dir><dir name="sql"><dir name="unbxd_recommendation_setup"><file name="mysql4-install-1.0.0.php" hash="43e07764886f75274d3866d305c0daae"/><file name="upgrade-1.0.11-1.0.12.php" hash="5da17d19502bbfea056a0d4d20583b20"/><file name="upgrade-1.0.16-1.0.17.php" hash="23aba9e2568363125744c245d7cf6f23"/></dir></dir><file name=".DS_Store" hash="b4a356bd7741138b66aa79afcc4abd2f"/></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="unbxd"><file name="recommendation.xml" hash="a2f03791a48c83fceee42822f19695f5"/></dir></dir><dir name="template"><dir name="unbxd"><file name="recommendation.phtml" hash="42d2370984e91190003c254f4c5332f5"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="unbxd"><file name="tracker.phtml" hash="fcc3a7975e2e3c92ea010a4d98e3fe97"/><dir name="tracking"><file name="cart.phtml" hash="1602ccd541917fdaa539b88b59e16933"/><file name="category.phtml" hash="59b245e277bf1bd171354893a624d922"/><file name="order.phtml" hash="3ddc154f41138d5f924bc415f8feeb9b"/><file name="product.phtml" hash="bb4ce6b658e11aa24a9b322befcd5353"/></dir></dir></dir><dir name="layout"><dir name="unbxd"><file name="recommendation.xml" hash="79b0ba853521b40bc26c6efc2e57282e"/></dir></dir></dir></dir></dir></target><target name="mageweb"><dir name="skin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="unbxd"><dir name="css"><file name="app.css" hash="d8be8236609ed4e422db6996cb866383"/><file name="bootstrap-them.css" hash="df854606e8bfb38abe58305c389301ae"/><file name="bootstrap.css" hash="59899c8b554b99637d119d3fe5f844de"/><file name="chosen.css" hash="50141f749f8ed2dd209682800618dca2"/><file name="unbxd-magento.css" hash="a5a0805eeba3db5f96910670bfc7b9bf"/></dir><dir name="img"><file name="Custom-platform.png" hash="d053db68b99519a2b0303624ab647f16"/><file name="DONE.png" hash="470356a4749d5fde1b86d9c0eeb9c806"/><file name="HEXAGON-Only.png" hash="f070ca957f922446f715555d94192298"/><file name="Magento-small.png" hash="0b80c21a5daa1669317095843590aa10"/><file name="Magento.png" hash="23b3159d445fe3fe5de7ea4a6d7f0271"/><file name="X-popup-hover.png" hash="41022fc34b63fc668477bcb991652577"/><file name="X-popup.png" hash="301b49b195fd8e9106eef93805182c11"/><file name="X-pricing.png" hash="ab7c15dacab6b4e13e19d9614741e9ef"/><file name="add-actv.png" hash="51bfeb67fce50aef4fe79ccea4e0d840"/><file name="add-icon.png" hash="46dea9858757fa584de457bfc421269f"/><file name="add-inactv.png" hash="164d79389bcd58d9d606871307d16e7e"/><file name="add-raw-hover.png" hash="591316d60847c12340d66cea0eb2ee97"/><file name="add-raw.png" hash="1fcdb060d898a7807bb37c796a772993"/><file name="add.png" hash="9a4026af014537b7d18032fd3a1bcb05"/><file name="arrow-2.png" hash="627be933821070bb0514ba331739cbdb"/><file name="arrow-calendar-down.png" hash="15a5f0cba1424dbc6d7f2069dca59a2a"/><file name="arrow-calendar-down1.png" hash="ed6aac9b4e114418f639ce874e75ed19"/><file name="arrow-down-disabled.jpg" hash="5b62a642490f264b58771e38e687eb19"/><file name="arrow-down-enabled.jpg" hash="4a0b2fafe44c58dd390d5eb0473c365e"/><file name="arrow-down-white.jpg" hash="edd441fe8c391969859dc72e5e95e83c"/><file name="arrow-down-white1.jpg" hash="6b7c7662f141a30635d408dad048dd54"/><file name="arrow-down-white2.jpg" hash="bd948050a2d7b0b6dfd7e349734df63b"/><file name="arrow-down.png" hash="379a11ee447d83e850a03581928acae8"/><file name="arrow-gray.png" hash="6e345006dfc2b0f1e52b8266c21bcbbc"/><file name="arrow-left-white.jpg" hash="36a0b2d5784c980a54edb3b874bc47c7"/><file name="arrow-left.jpg" hash="e22a795292c8bf95e62c86d7f5c3a149"/><file name="arrow-mail-developer).png" hash="a96ecd000175538c0dd0914395cf203d"/><file name="arrow-right-blue.png" hash="4ef79b5fc672c2a285b0c2ba5504f1e4"/><file name="arrow-right-gray.jpg" hash="5ac0235afe90023e26126134f151a2bd"/><file name="arrow-right-white.jpg" hash="9916e44542fbaa7a9e9b69f3551d321f"/><file name="arrow-right.jpg" hash="c2ad8f3435733f35a46fd8fdf29a9323"/><file name="arrow-up-black.png" hash="1e5a76b450fd32c3577078829d38ac58"/><file name="arrow-up-disabled.jpg" hash="6659a79f97099b525bd1b0713b99ad8b"/><file name="arrow-up-enabled.jpg" hash="4074eee100e01429ea4defed741b2ac2"/><file name="arrow-up-red.png" hash="84b29f0c6964c69ed6e78501123bfccf"/><file name="arrow-up-white.jpg" hash="38d5ec238c32cb7124fb6bc31ffe126e"/><file name="arrow-up-white1.jpg" hash="3221729d064ae198dff6effcc62e6a5e"/><file name="arrow-up.png" hash="6c54432350ad68d3345eb151d7534ae2"/><file name="arrow-white.png" hash="4b4e57f5b8d2b678df89b5a2dc85bba3"/><file name="arrow.png" hash="4b4e57f5b8d2b678df89b5a2dc85bba3"/><file name="authenticated.png" hash="78140247146f512d014be386a116a699"/><file name="back.png" hash="32b2ff86ee7ba8a1f19270a121f00205"/><file name="bg.jpg" hash="4a2f6fda25f44f7009e9a22ccf90e330"/><file name="big-arrow-gray.jpg" hash="745194d74525c2fd3238475c55a47cbc"/><file name="bigcommerce.png" hash="2a2599c562ec94be2545ab335131c71a"/><file name="black-right-small.jpg" hash="25253ab5ae165f13a1827ccd387d7b2f"/><file name="black-right-thick.jpg" hash="ae89e8e2c9d39ab8970782a829edeaeb"/><file name="btn-arrow-top.png" hash="42b3a9ffa2eccd2cfc9da9c33975f64c"/><file name="btn-arrow.png" hash="8cc68b6207307260a75bcc9331447c5e"/><file name="button-arrow-blue.png" hash="1e8d1741ecef49e021f35460fe16c76b"/><file name="button-arrow-grey.png" hash="76cd7acb80bf814c6605aa3f88c2c19b"/><file name="button-arrow-red.png" hash="03092367ac79745b0d7b2f9b707c802b"/><file name="cancel.png" hash="dd81fdd1129b4ef172d4c434d6156d87"/><file name="card-image.jpg" hash="bd1f292965163bbcc869a48bbe806deb"/><file name="card-image1.jpg" hash="95ccedbe1e8d01685f2527b08230b4a7"/><file name="card-image2.jpg" hash="963c39821d0cb5b1f0dfb691e12eefb5"/><file name="card-image3.jpg" hash="961e69aeecd5ab5d17743c5d3e4764cf"/><file name="checkmark.png" hash="4a0de13372944f21034dee674f92b7d1"/><file name="chosen-sprite.png" hash="25b9acb1b504c95c6b95c33986b7317e"/><file name="close-analytics.png" hash="0ca667d6de9a98999e37811861e6768e"/><file name="close.png" hash="daa5df0af5c219e136505132e18f5242"/><file name="color-pic.png" hash="470ec0178867dac04fcbce638c14a4cf"/><file name="congrats-magento.png" hash="ec3d2e0a2bf1d012e56583e89513664d"/><file name="congrats.png" hash="ec3d2e0a2bf1d012e56583e89513664d"/><file name="copy-black.png" hash="3f2b73b7287849ba2d341f194be7cd44"/><file name="copy-white.png" hash="208f74184462db7f5861d4c48dd300da"/><file name="cros.png" hash="bbf540cf6fe3d7fba4fab37b4d0b22c9"/><file name="cross-2.png" hash="1dfc504ed86c82bd86de8c74a09c906f"/><file name="cvv-number.jpg" hash="0ada16245fd0cb05a3967461eba12a28"/><file name="delete-raw-hover.png" hash="e3df4faf0450feaa2aed503dbf6759df"/><file name="delete-raw.png" hash="09806aed8283ae6168ecfdcec8237881"/><file name="delete-red.png" hash="c070eaad8207d3fe4e839b0f63deb68c"/><file name="delete.png" hash="b45f9d0e4d1fd160dbaa6ec41559f369"/><file name="detect.png" hash="9b6980d0bbd7ea6bded8ad05be4db7dd"/><file name="down-arrow.png" hash="3d1e707e03353aa01ac7f66610214c6b"/><file name="down-black.png" hash="80236500f0e70d2312b12a0d15e5fa81"/><file name="down-gray.png" hash="160e694e54afdc73edf828e4f02f5945"/><file name="drop-down.png" hash="ab8561f879ec10c16d6ca5393edf5db4"/><file name="dropdown-arrow.png" hash="4450401ccb623ec2a0ccae215e8b2a63"/><file name="edit-magento.png" hash="043c35fcd4396838a0db85d8d93aed04"/><file name="edit.png" hash="043c35fcd4396838a0db85d8d93aed04"/><file name="eye-hover.png" hash="cf7047c5218c147959a7afc282c01568"/><file name="eye.png" hash="b7a4815cce6e051a785f417f0ecb3427"/><file name="favicon.png" hash="402ca129cd67c7601ea429310c6aa2f5"/><file name="fill.png" hash="4bb20f0886094d62ac0c741edcc03742"/><file name="group-arrow.png" hash="89eba421d4e2a3f83e47e00f26e80888"/><file name="help.png" hash="94b200dfffcdb8ded1429791c2d22b8c"/><file name="icon-analytics.png" hash="4e62393fa4013bdc4e134b469dcd280b"/><file name="icon-info.png" hash="52c2f72d690d0f979afcb5a712b34c3c"/><file name="icon-widget.png" hash="8d6ed9abd86d3095993b4ca773bfdbc3"/><file name="install.png" hash="b284e88eb06554283ef98d6f50836e46"/><file name="integration-gray.png" hash="0fc90ad557b62f693098d862d5599085"/><file name="introduction-gray.png" hash="092fce8aa83ab7bcdb9b7a7a62b4a7d6"/><file name="left-black.png" hash="24b87ee6bf514b8666b12d7d9297eb4e"/><file name="left-gray.png" hash="e53e0389cd719dd5aed2ad6017d32b0e"/><file name="level-arrow-active.png" hash="56bbbf4701324c79e111a36abc235092"/><file name="level-arrow.png" hash="5861fea9a80e3c4fcc14210569d7effa"/><file name="link-arrow.png" hash="21354972164f512795bf1f54c6a71f3f"/><file name="loader-16x16.gif" hash="778e6b9e73274330dae0dab8104948a0"/><file name="loader-24x24.gif" hash="e403534956d055d636b3a5fa813b82b7"/><file name="loader-32x32.gif" hash="009c5064d779a3c67a202f299bd5d301"/><file name="loader.gif" hash="fd1345456c4a685afb42b67c25354ca2"/><file name="loader_black.gif" hash="5bfd8de3193a5fc2e5b472f57df1408f"/><file name="lock-image.jpg" hash="e80f8aa765e8ea121b056e188651629b"/><file name="logo-unbxd.png" hash="0b6c4b8887f8d57577023d8ddc1fa951"/><file name="logo.png" hash="27fa979ee65c84aefd15ffd6cc973e4d"/><file name="mail-new.png" hash="831e8c8c1eba8f4733d1d1e44a8c6549"/><file name="mail.png" hash="1cf907fd4c5d98230c7c2b89d6ff235f"/><file name="minus.jpg" hash="bdddd9b0d971d461a7e472b5bf38bfce"/><file name="nav-highlight-arrow.png" hash="64f6ae56f54568594d04df5c80ce069c"/><file name="not-detected.png" hash="59d0c0115b4b9f192eb4a77f22ce1609"/><file name="oops.png" hash="0735ac87c8e81325be4dc901ba354937"/><file name="or.png" hash="64c351e685fdb8339b7c7857ff14f56d"/><file name="other-gray.png" hash="646b84e4629dfadf3163bc9cd1aa83de"/><file name="overview-gray.png" hash="498e242cdd5b738d088d7ed4ae6c8e3e"/><file name="plus.jpg" hash="a8b80b4d5eee0ad842ce22ee7ea4c752"/><file name="question-mark2.jpg" hash="de9555459f3b9c93482c4a6061fea66b"/><file name="red-cross.png" hash="4213a8ee001ae75166d270be44b199a0"/><file name="red-loading.gif" hash="e644579431a4666564d92ec62c7c74e2"/><file name="remove.png" hash="401b59fb5aed9c68e5f1b3e47fe6ea60"/><file name="right-black.png" hash="fce5a7892866ef65e91fb006b1959c21"/><file name="right-gray.png" hash="b09daca9ca3c40451de0d62fbadd3cf6"/><file name="save.png" hash="fd61c5589c9fabe20a988121822ef81a"/><file name="saved.png" hash="9bb84699bb703a00b4b168e0997eeda5"/><file name="search.png" hash="71829ed3818c8832469c46d1f9203be0"/><file name="settings.png" hash="9dd7ca159584c09c41717c578f8aa1f6"/><file name="shopify.png" hash="93d8d9c1dd93680819fd642f9136b07c"/><file name="site-dropdownarrow-down.png" hash="c4c89958d88c58785c15e11c83bf0c4a"/><file name="site-dropdownarrow-up.png" hash="f52281c034fdc67f339efeab9127ddfc"/><file name="slider-bg.png" hash="242bb276022f24fc7ac71b181dd34e36"/><file name="slider-button.png" hash="4d17b9bd17415f9df5ccfafefcd32a24"/><file name="sort-arrow-blue-down.png" hash="1fd1bfd16d5f3a9c15017248a7d7f0e0"/><file name="sort-arrow-blue-up.png" hash="24eee605bc0fc9432b7b499633a6c7bc"/><file name="sort-arrow-grey-down.png" hash="b64554cc698560bb38bb43a7a6480dd3"/><file name="sort-arrow-grey-up.png" hash="d14911ddaef0a4de79b1a4a54efbf68b"/><file name="spree.png" hash="119dbad2cfa857a786d746158b9f36f0"/><file name="start-gray.png" hash="fe86f1b188d5b3f0f375421aa5435939"/><file name="step-arrow.png" hash="167c9a25eda4cd9bb4d88762883ba47d"/><file name="success.png" hash="4a8d69083fc4447d9c4ae9bdcc6560ce"/><file name="tick-analytics.png" hash="da1c588c876b2ea12bede76ef17ca1ff"/><file name="tick-green.png" hash="5108aa311b8e64e8f69642a53e4d3506"/><file name="tick-pricing.png" hash="42b0c3bb2c8e270833b0856360722124"/><file name="tick.png" hash="a5bb66f590af2746711bfdefe3b37d7a"/><file name="tooltip-arrow.png" hash="d37dac7a1d706a453ea0637f1db04907"/><file name="tooltip-left-arrow.jpg" hash="90143af415043466956e264b5e9a5910"/><file name="tooltip.png" hash="39a75f32b4b78b07033635f14a182124"/><file name="up-arrow.png" hash="f3d15dec451c405decfbc6d3a3fa7696"/><file name="up-black.png" hash="e77b8b75ecf6e5e63eed7fbb84c265a3"/><file name="up-gray.png" hash="0c721f2f05c729e07bd22a0a90f51ab0"/><file name="user.png" hash="ad7be0166b1484d9ff9e1d2708c83a71"/><file name="warning.png" hash="43e8ab0f26ce3ecf8ecdd162a8c8f366"/><file name="x-widget.png" hash="f000d6861e99a51e5ea2fdf68e0e0910"/><file name="x.png" hash="c517855b1803534e2bcecc9ed50808a9"/></dir><dir name="js"><dir name="app"><file name="analytics.js" hash="02e412d6d61ce0db1eefe1d1b64f87ad"/><file name="catalog.js" hash="ba8ff3410e263a254643b4e3e2ac36d2"/><file name="credentails.js" hash="a30597855db9aa04d83eb17624b23d5b"/><file name="utils.js" hash="0931d2484cae073b3b8209202e30e090"/><file name="widgets.js" hash="614b844d7129a912a84f89d6e88df5d2"/></dir><file name="app.js" hash="6c610a36fd3974af49e009f32e3697c7"/><dir name="lib"><file name="backbone.js" hash="88fee57a12be8ea719ed85fe29f062d3"/><file name="bootstrap-tooltip.js" hash="304bf569ee1a25e8fae5532d90661662"/><file name="chosen.js" hash="4fabe14fb10d99c4b432db5ce9847c06"/><file name="ractive-backbone.js" hash="afeac03a42a51483a7389f2b26a3e3d7"/><file name="ractive-chosen.js" hash="837381e6e428a7fa2b9f8f67c974d195"/><file name="ractive.js" hash="4887bb0d23f93ca78c46d2a7420cd360"/><file name="require.js" hash="177879fbe7dd333386711389ffa44d21"/><file name="underscore.js" hash="f809a744b7a4fe79a94749a569aa17f9"/></dir><file name="main.js" hash="68548c96331300ca0db2561c9c9b481f"/></dir><dir name="templates"><file name="analytics.html" hash="8885b3170719fcd525ad7a27bdf45624"/><file name="catalog.html" hash="1260ad88c8f004612863b528c0b6c3aa"/><file name="credentails.html" hash="1e6eb46ac91cf8083b7709659bc4783a"/><file name="custom.html" hash="4a4154b74c4ebbfde132857684c92e60"/><file name="widgets.html" hash="f337583a8def22cc39d62233bc8d0e0a"/></dir></dir></dir></dir></dir></dir><dir name="js"><dir name="unbxd"><file name="app.js" hash="5790870aa32c641bbad8d064fd41b610"/><file name="embed.js" hash="9ad60159c46080c5a071d54eb0ab6f9e"/><file name="jquery.js" hash="52d16e147b5346147d0f3269cd4d0f80"/><file name="unbxdAnalytics.js" hash="98738dccf6a9e9378e79ca6931d9d3c1"/></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Unbxd_Recommendation.xml" hash="72e1cb88ed2106b67858c9d529939cb2"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>
skin/adminhtml/default/default/unbxd/img/drop-down.png ADDED
Binary file
skin/adminhtml/default/default/unbxd/img/saved.png ADDED
Binary file
skin/adminhtml/default/default/unbxd/js/app/analytics.js ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ define([ "jquery"],
2
+ function( $ ){
3
+
4
+ var Analytics = {
5
+
6
+ loadAnalyticsTab : function(){
7
+
8
+ var ractiveAnalytics = new Ractive({
9
+ el: 'innerContainr',
10
+ template: '#tab3Template',
11
+ data:{
12
+ productClick : _unbxdObject.ractiveAnalytics.CLICKRANK || false,
13
+ addToCartClick : _unbxdObject.ractiveAnalytics.ADDTOCART || false,
14
+ productBuysClick : _unbxdObject.ractiveAnalytics.ORDER || false,
15
+ _unbxdObject:_unbxdObject
16
+ }
17
+ });
18
+
19
+ _unbxdObject.pollingId = window.setInterval(function(){
20
+ $.get(_unbxdBaseurl+"unbxd/config/analyticsimpression?site="+site)
21
+ .then(
22
+ function(data){
23
+ if(data.success){
24
+ data = data.IntegrationDetails[0];
25
+ ractiveAnalytics.set({
26
+ productClick:data.CLICKRANK,
27
+ addToCartClick:data.ADDTOCART,
28
+ productBuysClick:data.ORDER
29
+ })
30
+ _unbxdObject.ractiveAnalytics = data;
31
+
32
+ if(data.CLICKRANK && data.ADDTOCART && data.ORDER)
33
+ clearInterval( _unbxdObject.pollingId );
34
+ }
35
+ },
36
+ function(error){
37
+ clearInterval( _unbxdObject.pollingId );
38
+ });
39
+ }, 3000);
40
+
41
+ ractiveAnalytics.on({
42
+ showWidgets:function( event ){
43
+ activateLink( "four" );
44
+ loadWidgetsTab();
45
+ clearInterval( _unbxdObject.pollingId );
46
+ }
47
+ });
48
+
49
+
50
+ }
51
+
52
+ };
53
+
54
+ return Analytics;
55
+
56
+ });
skin/adminhtml/default/default/unbxd/js/app/catalog.js ADDED
@@ -0,0 +1,384 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ define([ "jquery", "app/utils"],
2
+ function( $, Utils ){
3
+
4
+ var Catalog = {
5
+
6
+ loadCatalogTab : function( _unbxdObject ){
7
+
8
+ var mappedAttributes = _unbxdObject.originalMapping, //catalog map first table
9
+ magentoFields = [ {value:'', disabled:false}],
10
+ customAttributes = [],
11
+ dataTypes = [];
12
+
13
+ var RactiveCatalog = Ractive.extend({
14
+ template: '#tab2Template',
15
+ partials: { item: $('#rowTemplate').text() },
16
+
17
+ addItem: function ( description ) {
18
+ this.push( 'customAttributes', {
19
+ field_name : '',
20
+ datatype: '',
21
+ canRemove:true
22
+ });
23
+ },
24
+
25
+ init: function ( options ) {
26
+ var self = this;
27
+
28
+ this.on({
29
+
30
+ newTodo: function ( event ) {
31
+ this.addItem();
32
+ }
33
+
34
+ });
35
+ },
36
+
37
+
38
+ });
39
+
40
+ var ractiveCatalog = new RactiveCatalog({
41
+ el: 'innerContainr',
42
+ data : _unbxdObject.catalogData ||
43
+ {
44
+ magentoFields : [{disabled:false, value:"", test:"test"}],
45
+ mappedAttributes : mappedAttributes,
46
+ customAttributes : customAttributes,
47
+ enableEdit : false,
48
+ dataTypes : dataTypes,
49
+ saveMapping:'disabled-btn',
50
+ disableSaveCustomAttr:'disabled-btn',
51
+ _unbxdObject:_unbxdObject,
52
+ successMsg:null,
53
+ errorMsg:null,
54
+ customAttrSucessMsg:null,
55
+ customAttrErrorMsg: null,
56
+ dataErrorMsg:null,
57
+ dataSuccessMsg:null,
58
+ dataWaitMsg:null,
59
+ disableButton:false
60
+ },
61
+
62
+ });
63
+
64
+ $(".magento-tooltip").popover({ trigger:'hover' });
65
+
66
+
67
+ //when user maps a magento attribute, remove it from magento fields
68
+ ractiveCatalog.observe('mappedAttributes.*.field_name', function(newValue, oldValue, keypath, s) {
69
+ if( !oldValue && !newValue )
70
+ this.set('saveMapping', 'disabled-btn');
71
+ this.set('saveMapping', null);
72
+ var count = 0,
73
+ mappedAttributes = this.get('mappedAttributes'),
74
+ arr = [],
75
+ magentoFields = this.get("magentoFields"),
76
+ self = this;
77
+
78
+
79
+ magentoFields.each(function(obj, i){
80
+ if(obj.value === newValue){
81
+ obj.disabled = 'unbxd-hide';
82
+ }
83
+ if( obj.value === oldValue ){
84
+ obj.disabled = '';
85
+ }
86
+
87
+ })
88
+ this.set('magentoFields', magentoFields);
89
+ ractiveCatalog.update();
90
+ _unbxdObject.catalogData = ractiveCatalog.data;
91
+ Utils.updateAllSelect();
92
+
93
+ });
94
+
95
+ ractiveCatalog.observe('customAttributes.*.field_name', function(newValue, oldValue, keypath, s) {
96
+ if( !newValue && !oldValue )
97
+ return;
98
+ this.set('disableSaveCustomAttr', 'disabled-btn');
99
+ var count = 0,
100
+ customAttributes = this.get('customAttributes'),
101
+ self = this,
102
+ magentoFields = this.get("magentoFields");
103
+
104
+ if(customAttributes && customAttributes.length > 0)
105
+ this.set('disableSaveCustomAttr', null);
106
+
107
+ magentoFields.each(function(obj, i){
108
+ if(obj.value === newValue ){
109
+ obj.disabled = 'unbxd-hide';
110
+ }
111
+ if(obj.value === oldValue)
112
+ obj.disabled = '';
113
+ })
114
+
115
+ this.set('magentoFields', magentoFields);
116
+ ractiveCatalog.update();
117
+ _unbxdObject.catalogData = ractiveCatalog.data;
118
+ Utils.updateAllSelect();
119
+ });
120
+
121
+ ractiveCatalog.observe('customAttributes.*.datatype', function(newValue, oldValue, keypath, s) {
122
+
123
+ if( !newValue && !oldValue )
124
+ return;
125
+
126
+ var customAttributes = this.get('customAttributes');
127
+
128
+ if(customAttributes && customAttributes.length > 0)
129
+ this.set('disableSaveCustomAttr', null);
130
+ });
131
+
132
+ if( !_unbxdObject.catalogData ){
133
+ var $obj = $.get( _unbxdBaseurl + "unbxd/config/fields?site="+site);
134
+ $obj.then(function( data ){
135
+
136
+ var allFields = data.fields,
137
+ field = null;
138
+
139
+ $.each(data.fields, function(a, val){
140
+ magentoFields.push({ value:val, disabled:false} );
141
+ });
142
+
143
+ $.each(data.mappedFields, function(a, obj){
144
+ if(obj.featured_field){
145
+ if(!obj.field_name)
146
+ obj.field_name = "";
147
+ mappedAttributes.push(obj );
148
+ }else{
149
+ obj.disabled = "disabled";
150
+ customAttributes.push(obj)
151
+ }
152
+
153
+ magentoFields.each( function(item, j){
154
+ if(obj.field_name === item.value)
155
+ item.disabled = 'unbxd-hide';
156
+
157
+ });
158
+
159
+ field = magentoFields.find(function( item ){
160
+ return item.value === obj.field_name
161
+ })
162
+
163
+ if(!field)
164
+ magentoFields.push({value:obj.field_name, disabled:'unbxd-hide'});
165
+
166
+ });
167
+
168
+ //data = JSON.parse(data);
169
+
170
+ _unbxdObject.originalMapping = $.map( mappedAttributes, function(obj){
171
+ return $.extend({}, obj);
172
+ })
173
+ if(customAttributes.length < 1)
174
+ customAttributes = [{ field_name: '', datatype: '', canRemove:true }];
175
+
176
+ try{
177
+ mappedAttributes.forEach(function(obj, i){
178
+ obj.tooltip = unbxdDimensions.filter(
179
+ function( dimension ){
180
+ return dimension.value === obj.featured_field;
181
+ })[0].helpText;
182
+ });
183
+ }catch(e){}
184
+
185
+
186
+ ractiveCatalog.set({
187
+ mappedAttributes: mappedAttributes,
188
+ magentoFields: magentoFields,
189
+ customAttributes:customAttributes,
190
+ dataTypes : data.datatype
191
+ });
192
+
193
+ _unbxdObject.catalogData = ractiveCatalog.data;
194
+ $("._tooltip").popover({ trigger:'hover' });
195
+ $('select[name="unbxd-customattr"]').chosen('chosen:updated');
196
+ $('select[name="unbxd-select"]').prop('disabled', true).trigger("chosen:updated");
197
+ Utils.updateAllSelect();
198
+ ractiveCatalog.update();
199
+ })
200
+ }
201
+
202
+
203
+
204
+
205
+
206
+
207
+ ractiveCatalog.on({
208
+
209
+ showDataHelp:function(){
210
+ $('#dataHelp').toggle();
211
+ },
212
+
213
+ removeRow:function ( event ) {
214
+ var obj = this.get('customAttributes')[event.index.i];
215
+ if( !obj.canRemove ){
216
+ result = window.confirm("Are you sure, you want to delete "+obj.field_name );
217
+ if(result){
218
+ $.ajax({
219
+ url:_unbxdBaseurl + 'unbxd/config/fields?site='+site ,
220
+ type:'PUT',
221
+ data:JSON.stringify({ fields:[obj] }),
222
+ });
223
+ this.get('customAttributes').splice(event.index.i, 1);
224
+ }
225
+ }else{
226
+ this.get('customAttributes').splice(event.index.i, 1);
227
+ }
228
+
229
+ },
230
+
231
+ saveMapping:function(event){
232
+ var mapping = this.get('mappedAttributes'),
233
+ self = this, data = [];
234
+
235
+ this.set( {'saveMapping':'disabled-btn',
236
+ 'successMsg':null,
237
+ 'errorMsg':null
238
+ });
239
+ mapping.each(function(obj, i){
240
+ if(obj.field_name)
241
+ data.push(obj);
242
+ })
243
+
244
+ Utils.saveFields( data ).then(
245
+ function( data ){
246
+ if(data.success){
247
+ self.set({
248
+ enableEdit: false,
249
+ saveMapping:'disabled-btn',
250
+ successMsg:"Saved",
251
+ errorMsg:null
252
+ });
253
+ }else{
254
+ for(var key in data.errors)
255
+ self.set("errorMsg", data.errors[key])
256
+ }
257
+ self.set('saveMapping', null);
258
+ },
259
+ function( error ){
260
+
261
+ })
262
+
263
+ },
264
+
265
+ saveCustomAttribute : function(){
266
+ var customMapping = this.get('customAttributes'),
267
+ self = this,
268
+ data = [];
269
+ customMapping.each(function(obj, i){
270
+ if( obj.field_name )
271
+ data.push(obj);
272
+ });
273
+
274
+ this.set("disableSaveCustomAttr", "disabled-btn");
275
+ Utils.saveFields( data ).then(
276
+ function( response ){
277
+ if(response.success){
278
+ self.set("customAttrSucessMsg", "Saved");
279
+ data.each(function(obj){
280
+ obj.canRemove = false;
281
+ })
282
+ }else{
283
+ self.set("customAttrErrorMsg", "Some error in saving !");
284
+ }
285
+
286
+ self.set("disableSaveCustomAttr", null);
287
+ },
288
+ function( error ){
289
+
290
+ });
291
+
292
+ },
293
+
294
+ showCustomAttribute:function(){
295
+ Utils.updateAllSelect();
296
+ $(".add-attr").toggle();
297
+ $(".custom-attributes").toggle();
298
+ this.set({
299
+ disableSaveCustomAttr : 'disabled-btn',
300
+ customAttrSucessMsg : null,
301
+ customAttrErrorMsg : null
302
+ });
303
+ },
304
+
305
+ enableEdit:function(){
306
+ this.set({ enableEdit: true,
307
+ saveMapping:'disabled-btn',
308
+ successMsg:""
309
+ });
310
+ $('select[name="unbxd-select"]').prop('disabled', false).trigger("chosen:updated");
311
+ },
312
+
313
+ disableEdit:function(){
314
+
315
+ this.set({ enableEdit: false,
316
+ saveMapping:'disabled-btn',
317
+ mappedAttributes : _unbxdObject.originalMapping,
318
+ successMsg:null,
319
+ errorMsg:null
320
+ });
321
+
322
+ _unbxdObject.originalMapping = $.map( _unbxdObject.originalMapping, function(obj){
323
+ return $.extend({}, obj);
324
+ })
325
+
326
+ ractiveCatalog.update();
327
+ _unbxdObject.catalogData = ractiveCatalog.data;
328
+ $('select[name="unbxd-select"]').prop('disabled', true).trigger("chosen:updated");
329
+ },
330
+
331
+ uploadData:function(){
332
+ this.set({
333
+ dataWaitMsg : "Uploading data",
334
+ dataSuccessMsg:"",
335
+ dataErrorMsg:"",
336
+ disableButton:true
337
+ });
338
+ var self = this;
339
+
340
+ $.ajax({
341
+
342
+ url:_unbxdBaseurl + "unbxd/config/productsync?site=" +site,
343
+ type:"GET",
344
+ success : function(data){
345
+
346
+ if(data.success){
347
+ self.set({
348
+ dataSuccessMsg:unbxdMessages.uploadSuccess,
349
+ disableButton:false
350
+ });
351
+ _unbxdObject.step2 = true;
352
+ }else{
353
+ self.set({
354
+ dataErrorMsg:data.message,
355
+ dataSuccessMsg:"",
356
+ disableButton:false
357
+ });
358
+ }
359
+ ractiveParent.update();
360
+ },
361
+ error : function(){
362
+ self.set({
363
+ dataErrorMsg : "Some error, please try again"
364
+ });
365
+ },
366
+ complete:function(){
367
+ self.set({
368
+ disableButton:false,
369
+ dataWaitMsg:""
370
+ });
371
+ }
372
+
373
+ });
374
+
375
+ }
376
+
377
+ });
378
+
379
+ }
380
+
381
+ };
382
+
383
+ return Catalog;
384
+ });
skin/adminhtml/default/default/unbxd/js/app/credentails.js ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ define([ "jquery" ],
3
+ function( $ ) {
4
+
5
+ var credentails = {
6
+
7
+ //credentials view
8
+ loadCredentailsTab : function( _unbxdObject ){
9
+
10
+ var ractiveCredentials = new Ractive({
11
+ el: 'innerContainr',
12
+ template: '#tab1Template',
13
+ data : {
14
+ site_key : _unbxdObject.siteKey,
15
+ secret_key : _unbxdObject.secretKey,
16
+ step1:_unbxdObject.step1,
17
+ _unbxdObject:_unbxdObject,
18
+ btnDisabled:false,
19
+ errorMsg:null,
20
+ successMsg:null
21
+ }
22
+ });
23
+
24
+ site = jQuery("#selectSites").chosen().val();
25
+ _unbxdObject.siteName = site;
26
+
27
+ var $keys = $.get( _unbxdBaseurl + "unbxd/config/keys?site="+site);
28
+
29
+ $keys.then(function( data ){
30
+ if( !data.success) {
31
+ ractiveCredentials.set({site_key:"", secret_key:"", step1:false})
32
+ return;
33
+ }
34
+
35
+ _unbxdObject.step1 = true;
36
+ _unbxdObject.siteKey = data.site_key;
37
+ _unbxdObject.secretKey = data.secret_key;
38
+ ractiveCredentials.set({site_key:data.site_key, secret_key:_unbxdObject.secretKey, step1:true})
39
+ ractiveParent.update();
40
+ },function( error ){
41
+ console.log(error);
42
+
43
+ })
44
+
45
+
46
+
47
+ ractiveCredentials.on({
48
+ //show tool tip
49
+ showSiteKeyHelp:function(){
50
+ $('.site-key-help').show();
51
+ },
52
+
53
+ hideSiteKeyHelp:function(){
54
+ $('.site-key-help').hide();
55
+ },
56
+
57
+ showSecretKeyHelp:function(){
58
+ $('.secret-key-help').show();
59
+ },
60
+
61
+ hideSecretKeyHelp:function(){
62
+ $('.secret-key-help').hide();
63
+ },
64
+
65
+ authenticate:function(){
66
+ var data = {
67
+ site_key: this.get("site_key"),
68
+ secret_key:this.get("secret_key")
69
+ };
70
+ data = JSON.stringify(data);
71
+ var self = this;
72
+ this.set({
73
+ btnDisabled : true,
74
+ errorMsg : null,
75
+ successMsg:null
76
+ });
77
+ $.ajax({
78
+ type:'POST',
79
+ url:_unbxdBaseurl +'unbxd/config/keys?site='+ site,
80
+ contentType:"application/json",
81
+ data:data,
82
+ success:function( data ){
83
+ if(!data.success){
84
+ self.set('errorMsg', data.errors.message);
85
+ return;
86
+ }
87
+ _unbxdObject.step1 = true;
88
+ self.set({
89
+ step1 : true,
90
+ successMsg:unbxdMessages.authSuccess
91
+ });
92
+ },
93
+ error:function(){
94
+
95
+ },
96
+ complete:function(){
97
+ self.set('btnDisabled', false);
98
+ }
99
+ })
100
+
101
+ },
102
+
103
+ reauthenticate:function(){
104
+ this.set({
105
+ step1:false,
106
+ site_key:"",
107
+ secret_key:""
108
+ })
109
+ }
110
+ })
111
+
112
+
113
+ $(".magento-tooltip").popover({ trigger:'hover' });
114
+ }
115
+
116
+
117
+ };
118
+
119
+
120
+ return credentails;
121
+
122
+ });
123
+
124
+
125
+
126
+
127
+
128
+
129
+
130
+
131
+
132
+
133
+
134
+
135
+
136
+
137
+
138
+
139
+
skin/adminhtml/default/default/unbxd/js/app/utils.js ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ define([ "jquery"],
2
+ function( $ ){
3
+
4
+ var Utils = {
5
+
6
+ activateLink : function( step ){
7
+ _unbxdObject.activeStep = {};
8
+ _unbxdObject.activeStep[step] = true;
9
+ ractiveParent.update();
10
+ },
11
+
12
+ configureSelect : function(){
13
+ var chosenObj = $('select[name="unbxd-select"]').chosen();
14
+ chosenObj.trigger('chosen:updated');
15
+ },
16
+ //re render all chosen selects
17
+ updateAllSelect : function(){
18
+ $('select').trigger('chosen:updated');
19
+ },
20
+
21
+ saveFields : function( data ){
22
+ return $.ajax({
23
+ data: JSON.stringify({ "fields": data }) ,
24
+ contentType:'application/json',
25
+ type:'POST',
26
+ url: _unbxdBaseurl + 'unbxd/config/fields?site='+site
27
+ })
28
+ }
29
+
30
+ };
31
+
32
+ return Utils;
33
+ });
skin/adminhtml/default/default/unbxd/js/app/widgets.js ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ define([ "jquery"],
2
+ function( $ ){
3
+
4
+ var Widgets = {
5
+
6
+ loadWidgetsTab : function(){
7
+
8
+ var ractiveWidgets = new Ractive({
9
+ el: 'innerContainr',
10
+ template: '#tab4Template'
11
+ });
12
+
13
+ ractiveWidgets.on({
14
+ showCMSHelp:function(){
15
+ $('#cmsHelp').toggle();
16
+ }
17
+ });
18
+
19
+ $(".magento-tooltip").popover({ trigger:'hover' });
20
+ }
21
+
22
+ };
23
+
24
+ return Widgets;
25
+ });
skin/adminhtml/default/default/unbxd/js/lib/backbone.js ADDED
@@ -0,0 +1 @@
 
1
+ (function(t,e){if(typeof define==="function"&&define.amd){define(["underscore","jquery","exports"],function(i,r,s){t.Backbone=e(t,s,i,r)})}else if(typeof exports!=="undefined"){var i=require("underscore");e(t,exports,i)}else{t.Backbone=e(t,{},t._,t.jQuery||t.Zepto||t.ender||t.$)}})(this,function(t,e,i,r){var s=t.Backbone;var n=[];var a=n.push;var o=n.slice;var h=n.splice;e.VERSION="1.1.2";e.$=r;e.noConflict=function(){t.Backbone=s;return this};e.emulateHTTP=false;e.emulateJSON=false;var u=e.Events={on:function(t,e,i){if(!c(this,"on",t,[e,i])||!e)return this;this._events||(this._events={});var r=this._events[t]||(this._events[t]=[]);r.push({callback:e,context:i,ctx:i||this});return this},once:function(t,e,r){if(!c(this,"once",t,[e,r])||!e)return this;var s=this;var n=i.once(function(){s.off(t,n);e.apply(this,arguments)});n._callback=e;return this.on(t,n,r)},off:function(t,e,r){var s,n,a,o,h,u,l,f;if(!this._events||!c(this,"off",t,[e,r]))return this;if(!t&&!e&&!r){this._events=void 0;return this}o=t?[t]:i.keys(this._events);for(h=0,u=o.length;h<u;h++){t=o[h];if(a=this._events[t]){this._events[t]=s=[];if(e||r){for(l=0,f=a.length;l<f;l++){n=a[l];if(e&&e!==n.callback&&e!==n.callback._callback||r&&r!==n.context){s.push(n)}}}if(!s.length)delete this._events[t]}}return this},trigger:function(t){if(!this._events)return this;var e=o.call(arguments,1);if(!c(this,"trigger",t,e))return this;var i=this._events[t];var r=this._events.all;if(i)f(i,e);if(r)f(r,arguments);return this},stopListening:function(t,e,r){var s=this._listeningTo;if(!s)return this;var n=!e&&!r;if(!r&&typeof e==="object")r=this;if(t)(s={})[t._listenId]=t;for(var a in s){t=s[a];t.off(e,r,this);if(n||i.isEmpty(t._events))delete this._listeningTo[a]}return this}};var l=/\s+/;var c=function(t,e,i,r){if(!i)return true;if(typeof i==="object"){for(var s in i){t[e].apply(t,[s,i[s]].concat(r))}return false}if(l.test(i)){var n=i.split(l);for(var a=0,o=n.length;a<o;a++){t[e].apply(t,[n[a]].concat(r))}return false}return true};var f=function(t,e){var i,r=-1,s=t.length,n=e[0],a=e[1],o=e[2];switch(e.length){case 0:while(++r<s)(i=t[r]).callback.call(i.ctx);return;case 1:while(++r<s)(i=t[r]).callback.call(i.ctx,n);return;case 2:while(++r<s)(i=t[r]).callback.call(i.ctx,n,a);return;case 3:while(++r<s)(i=t[r]).callback.call(i.ctx,n,a,o);return;default:while(++r<s)(i=t[r]).callback.apply(i.ctx,e);return}};var d={listenTo:"on",listenToOnce:"once"};i.each(d,function(t,e){u[e]=function(e,r,s){var n=this._listeningTo||(this._listeningTo={});var a=e._listenId||(e._listenId=i.uniqueId("l"));n[a]=e;if(!s&&typeof r==="object")s=this;e[t](r,s,this);return this}});u.bind=u.on;u.unbind=u.off;i.extend(e,u);var p=e.Model=function(t,e){var r=t||{};e||(e={});this.cid=i.uniqueId("c");this.attributes={};if(e.collection)this.collection=e.collection;if(e.parse)r=this.parse(r,e)||{};r=i.defaults({},r,i.result(this,"defaults"));this.set(r,e);this.changed={};this.initialize.apply(this,arguments)};i.extend(p.prototype,u,{changed:null,validationError:null,idAttribute:"id",initialize:function(){},toJSON:function(t){return i.clone(this.attributes)},sync:function(){return e.sync.apply(this,arguments)},get:function(t){return this.attributes[t]},escape:function(t){return i.escape(this.get(t))},has:function(t){return this.get(t)!=null},set:function(t,e,r){var s,n,a,o,h,u,l,c;if(t==null)return this;if(typeof t==="object"){n=t;r=e}else{(n={})[t]=e}r||(r={});if(!this._validate(n,r))return false;a=r.unset;h=r.silent;o=[];u=this._changing;this._changing=true;if(!u){this._previousAttributes=i.clone(this.attributes);this.changed={}}c=this.attributes,l=this._previousAttributes;if(this.idAttribute in n)this.id=n[this.idAttribute];for(s in n){e=n[s];if(!i.isEqual(c[s],e))o.push(s);if(!i.isEqual(l[s],e)){this.changed[s]=e}else{delete this.changed[s]}a?delete c[s]:c[s]=e}if(!h){if(o.length)this._pending=r;for(var f=0,d=o.length;f<d;f++){this.trigger("change:"+o[f],this,c[o[f]],r)}}if(u)return this;if(!h){while(this._pending){r=this._pending;this._pending=false;this.trigger("change",this,r)}}this._pending=false;this._changing=false;return this},unset:function(t,e){return this.set(t,void 0,i.extend({},e,{unset:true}))},clear:function(t){var e={};for(var r in this.attributes)e[r]=void 0;return this.set(e,i.extend({},t,{unset:true}))},hasChanged:function(t){if(t==null)return!i.isEmpty(this.changed);return i.has(this.changed,t)},changedAttributes:function(t){if(!t)return this.hasChanged()?i.clone(this.changed):false;var e,r=false;var s=this._changing?this._previousAttributes:this.attributes;for(var n in t){if(i.isEqual(s[n],e=t[n]))continue;(r||(r={}))[n]=e}return r},previous:function(t){if(t==null||!this._previousAttributes)return null;return this._previousAttributes[t]},previousAttributes:function(){return i.clone(this._previousAttributes)},fetch:function(t){t=t?i.clone(t):{};if(t.parse===void 0)t.parse=true;var e=this;var r=t.success;t.success=function(i){if(!e.set(e.parse(i,t),t))return false;if(r)r(e,i,t);e.trigger("sync",e,i,t)};q(this,t);return this.sync("read",this,t)},save:function(t,e,r){var s,n,a,o=this.attributes;if(t==null||typeof t==="object"){s=t;r=e}else{(s={})[t]=e}r=i.extend({validate:true},r);if(s&&!r.wait){if(!this.set(s,r))return false}else{if(!this._validate(s,r))return false}if(s&&r.wait){this.attributes=i.extend({},o,s)}if(r.parse===void 0)r.parse=true;var h=this;var u=r.success;r.success=function(t){h.attributes=o;var e=h.parse(t,r);if(r.wait)e=i.extend(s||{},e);if(i.isObject(e)&&!h.set(e,r)){return false}if(u)u(h,t,r);h.trigger("sync",h,t,r)};q(this,r);n=this.isNew()?"create":r.patch?"patch":"update";if(n==="patch")r.attrs=s;a=this.sync(n,this,r);if(s&&r.wait)this.attributes=o;return a},destroy:function(t){t=t?i.clone(t):{};var e=this;var r=t.success;var s=function(){e.trigger("destroy",e,e.collection,t)};t.success=function(i){if(t.wait||e.isNew())s();if(r)r(e,i,t);if(!e.isNew())e.trigger("sync",e,i,t)};if(this.isNew()){t.success();return false}q(this,t);var n=this.sync("delete",this,t);if(!t.wait)s();return n},url:function(){var t=i.result(this,"urlRoot")||i.result(this.collection,"url")||M();if(this.isNew())return t;return t.replace(/([^\/])$/,"$1/")+encodeURIComponent(this.id)},parse:function(t,e){return t},clone:function(){return new this.constructor(this.attributes)},isNew:function(){return!this.has(this.idAttribute)},isValid:function(t){return this._validate({},i.extend(t||{},{validate:true}))},_validate:function(t,e){if(!e.validate||!this.validate)return true;t=i.extend({},this.attributes,t);var r=this.validationError=this.validate(t,e)||null;if(!r)return true;this.trigger("invalid",this,r,i.extend(e,{validationError:r}));return false}});var v=["keys","values","pairs","invert","pick","omit"];i.each(v,function(t){p.prototype[t]=function(){var e=o.call(arguments);e.unshift(this.attributes);return i[t].apply(i,e)}});var g=e.Collection=function(t,e){e||(e={});if(e.model)this.model=e.model;if(e.comparator!==void 0)this.comparator=e.comparator;this._reset();this.initialize.apply(this,arguments);if(t)this.reset(t,i.extend({silent:true},e))};var m={add:true,remove:true,merge:true};var y={add:true,remove:false};i.extend(g.prototype,u,{model:p,initialize:function(){},toJSON:function(t){return this.map(function(e){return e.toJSON(t)})},sync:function(){return e.sync.apply(this,arguments)},add:function(t,e){return this.set(t,i.extend({merge:false},e,y))},remove:function(t,e){var r=!i.isArray(t);t=r?[t]:i.clone(t);e||(e={});var s,n,a,o;for(s=0,n=t.length;s<n;s++){o=t[s]=this.get(t[s]);if(!o)continue;delete this._byId[o.id];delete this._byId[o.cid];a=this.indexOf(o);this.models.splice(a,1);this.length--;if(!e.silent){e.index=a;o.trigger("remove",o,this,e)}this._removeReference(o,e)}return r?t[0]:t},set:function(t,e){e=i.defaults({},e,m);if(e.parse)t=this.parse(t,e);var r=!i.isArray(t);t=r?t?[t]:[]:i.clone(t);var s,n,a,o,h,u,l;var c=e.at;var f=this.model;var d=this.comparator&&c==null&&e.sort!==false;var v=i.isString(this.comparator)?this.comparator:null;var g=[],y=[],_={};var b=e.add,w=e.merge,x=e.remove;var E=!d&&b&&x?[]:false;for(s=0,n=t.length;s<n;s++){h=t[s]||{};if(h instanceof p){a=o=h}else{a=h[f.prototype.idAttribute||"id"]}if(u=this.get(a)){if(x)_[u.cid]=true;if(w){h=h===o?o.attributes:h;if(e.parse)h=u.parse(h,e);u.set(h,e);if(d&&!l&&u.hasChanged(v))l=true}t[s]=u}else if(b){o=t[s]=this._prepareModel(h,e);if(!o)continue;g.push(o);this._addReference(o,e)}o=u||o;if(E&&(o.isNew()||!_[o.id]))E.push(o);_[o.id]=true}if(x){for(s=0,n=this.length;s<n;++s){if(!_[(o=this.models[s]).cid])y.push(o)}if(y.length)this.remove(y,e)}if(g.length||E&&E.length){if(d)l=true;this.length+=g.length;if(c!=null){for(s=0,n=g.length;s<n;s++){this.models.splice(c+s,0,g[s])}}else{if(E)this.models.length=0;var k=E||g;for(s=0,n=k.length;s<n;s++){this.models.push(k[s])}}}if(l)this.sort({silent:true});if(!e.silent){for(s=0,n=g.length;s<n;s++){(o=g[s]).trigger("add",o,this,e)}if(l||E&&E.length)this.trigger("sort",this,e)}return r?t[0]:t},reset:function(t,e){e||(e={});for(var r=0,s=this.models.length;r<s;r++){this._removeReference(this.models[r],e)}e.previousModels=this.models;this._reset();t=this.add(t,i.extend({silent:true},e));if(!e.silent)this.trigger("reset",this,e);return t},push:function(t,e){return this.add(t,i.extend({at:this.length},e))},pop:function(t){var e=this.at(this.length-1);this.remove(e,t);return e},unshift:function(t,e){return this.add(t,i.extend({at:0},e))},shift:function(t){var e=this.at(0);this.remove(e,t);return e},slice:function(){return o.apply(this.models,arguments)},get:function(t){if(t==null)return void 0;return this._byId[t]||this._byId[t.id]||this._byId[t.cid]},at:function(t){return this.models[t]},where:function(t,e){if(i.isEmpty(t))return e?void 0:[];return this[e?"find":"filter"](function(e){for(var i in t){if(t[i]!==e.get(i))return false}return true})},findWhere:function(t){return this.where(t,true)},sort:function(t){if(!this.comparator)throw new Error("Cannot sort a set without a comparator");t||(t={});if(i.isString(this.comparator)||this.comparator.length===1){this.models=this.sortBy(this.comparator,this)}else{this.models.sort(i.bind(this.comparator,this))}if(!t.silent)this.trigger("sort",this,t);return this},pluck:function(t){return i.invoke(this.models,"get",t)},fetch:function(t){t=t?i.clone(t):{};if(t.parse===void 0)t.parse=true;var e=t.success;var r=this;t.success=function(i){var s=t.reset?"reset":"set";r[s](i,t);if(e)e(r,i,t);r.trigger("sync",r,i,t)};q(this,t);return this.sync("read",this,t)},create:function(t,e){e=e?i.clone(e):{};if(!(t=this._prepareModel(t,e)))return false;if(!e.wait)this.add(t,e);var r=this;var s=e.success;e.success=function(t,i){if(e.wait)r.add(t,e);if(s)s(t,i,e)};t.save(null,e);return t},parse:function(t,e){return t},clone:function(){return new this.constructor(this.models)},_reset:function(){this.length=0;this.models=[];this._byId={}},_prepareModel:function(t,e){if(t instanceof p)return t;e=e?i.clone(e):{};e.collection=this;var r=new this.model(t,e);if(!r.validationError)return r;this.trigger("invalid",this,r.validationError,e);return false},_addReference:function(t,e){this._byId[t.cid]=t;if(t.id!=null)this._byId[t.id]=t;if(!t.collection)t.collection=this;t.on("all",this._onModelEvent,this)},_removeReference:function(t,e){if(this===t.collection)delete t.collection;t.off("all",this._onModelEvent,this)},_onModelEvent:function(t,e,i,r){if((t==="add"||t==="remove")&&i!==this)return;if(t==="destroy")this.remove(e,r);if(e&&t==="change:"+e.idAttribute){delete this._byId[e.previous(e.idAttribute)];if(e.id!=null)this._byId[e.id]=e}this.trigger.apply(this,arguments)}});var _=["forEach","each","map","collect","reduce","foldl","inject","reduceRight","foldr","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","max","min","toArray","size","first","head","take","initial","rest","tail","drop","last","without","difference","indexOf","shuffle","lastIndexOf","isEmpty","chain","sample"];i.each(_,function(t){g.prototype[t]=function(){var e=o.call(arguments);e.unshift(this.models);return i[t].apply(i,e)}});var b=["groupBy","countBy","sortBy","indexBy"];i.each(b,function(t){g.prototype[t]=function(e,r){var s=i.isFunction(e)?e:function(t){return t.get(e)};return i[t](this.models,s,r)}});var w=e.View=function(t){this.cid=i.uniqueId("view");t||(t={});i.extend(this,i.pick(t,E));this._ensureElement();this.initialize.apply(this,arguments);this.delegateEvents()};var x=/^(\S+)\s*(.*)$/;var E=["model","collection","el","id","attributes","className","tagName","events"];i.extend(w.prototype,u,{tagName:"div",$:function(t){return this.$el.find(t)},initialize:function(){},render:function(){return this},remove:function(){this.$el.remove();this.stopListening();return this},setElement:function(t,i){if(this.$el)this.undelegateEvents();this.$el=t instanceof e.$?t:e.$(t);this.el=this.$el[0];if(i!==false)this.delegateEvents();return this},delegateEvents:function(t){if(!(t||(t=i.result(this,"events"))))return this;this.undelegateEvents();for(var e in t){var r=t[e];if(!i.isFunction(r))r=this[t[e]];if(!r)continue;var s=e.match(x);var n=s[1],a=s[2];r=i.bind(r,this);n+=".delegateEvents"+this.cid;if(a===""){this.$el.on(n,r)}else{this.$el.on(n,a,r)}}return this},undelegateEvents:function(){this.$el.off(".delegateEvents"+this.cid);return this},_ensureElement:function(){if(!this.el){var t=i.extend({},i.result(this,"attributes"));if(this.id)t.id=i.result(this,"id");if(this.className)t["class"]=i.result(this,"className");var r=e.$("<"+i.result(this,"tagName")+">").attr(t);this.setElement(r,false)}else{this.setElement(i.result(this,"el"),false)}}});e.sync=function(t,r,s){var n=T[t];i.defaults(s||(s={}),{emulateHTTP:e.emulateHTTP,emulateJSON:e.emulateJSON});var a={type:n,dataType:"json"};if(!s.url){a.url=i.result(r,"url")||M()}if(s.data==null&&r&&(t==="create"||t==="update"||t==="patch")){a.contentType="application/json";a.data=JSON.stringify(s.attrs||r.toJSON(s))}if(s.emulateJSON){a.contentType="application/x-www-form-urlencoded";a.data=a.data?{model:a.data}:{}}if(s.emulateHTTP&&(n==="PUT"||n==="DELETE"||n==="PATCH")){a.type="POST";if(s.emulateJSON)a.data._method=n;var o=s.beforeSend;s.beforeSend=function(t){t.setRequestHeader("X-HTTP-Method-Override",n);if(o)return o.apply(this,arguments)}}if(a.type!=="GET"&&!s.emulateJSON){a.processData=false}if(a.type==="PATCH"&&k){a.xhr=function(){return new ActiveXObject("Microsoft.XMLHTTP")}}var h=s.xhr=e.ajax(i.extend(a,s));r.trigger("request",r,h,s);return h};var k=typeof window!=="undefined"&&!!window.ActiveXObject&&!(window.XMLHttpRequest&&(new XMLHttpRequest).dispatchEvent);var T={create:"POST",update:"PUT",patch:"PATCH","delete":"DELETE",read:"GET"};e.ajax=function(){return e.$.ajax.apply(e.$,arguments)};var $=e.Router=function(t){t||(t={});if(t.routes)this.routes=t.routes;this._bindRoutes();this.initialize.apply(this,arguments)};var S=/\((.*?)\)/g;var H=/(\(\?)?:\w+/g;var A=/\*\w+/g;var I=/[\-{}\[\]+?.,\\\^$|#\s]/g;i.extend($.prototype,u,{initialize:function(){},route:function(t,r,s){if(!i.isRegExp(t))t=this._routeToRegExp(t);if(i.isFunction(r)){s=r;r=""}if(!s)s=this[r];var n=this;e.history.route(t,function(i){var a=n._extractParameters(t,i);n.execute(s,a);n.trigger.apply(n,["route:"+r].concat(a));n.trigger("route",r,a);e.history.trigger("route",n,r,a)});return this},execute:function(t,e){if(t)t.apply(this,e)},navigate:function(t,i){e.history.navigate(t,i);return this},_bindRoutes:function(){if(!this.routes)return;this.routes=i.result(this,"routes");var t,e=i.keys(this.routes);while((t=e.pop())!=null){this.route(t,this.routes[t])}},_routeToRegExp:function(t){t=t.replace(I,"\\$&").replace(S,"(?:$1)?").replace(H,function(t,e){return e?t:"([^/?]+)"}).replace(A,"([^?]*?)");return new RegExp("^"+t+"(?:\\?([\\s\\S]*))?$")},_extractParameters:function(t,e){var r=t.exec(e).slice(1);return i.map(r,function(t,e){if(e===r.length-1)return t||null;return t?decodeURIComponent(t):null})}});var N=e.History=function(){this.handlers=[];i.bindAll(this,"checkUrl");if(typeof window!=="undefined"){this.location=window.location;this.history=window.history}};var R=/^[#\/]|\s+$/g;var O=/^\/+|\/+$/g;var P=/msie [\w.]+/;var C=/\/$/;var j=/#.*$/;N.started=false;i.extend(N.prototype,u,{interval:50,atRoot:function(){return this.location.pathname.replace(/[^\/]$/,"$&/")===this.root},getHash:function(t){var e=(t||this).location.href.match(/#(.*)$/);return e?e[1]:""},getFragment:function(t,e){if(t==null){if(this._hasPushState||!this._wantsHashChange||e){t=decodeURI(this.location.pathname+this.location.search);var i=this.root.replace(C,"");if(!t.indexOf(i))t=t.slice(i.length)}else{t=this.getHash()}}return t.replace(R,"")},start:function(t){if(N.started)throw new Error("Backbone.history has already been started");N.started=true;this.options=i.extend({root:"/"},this.options,t);this.root=this.options.root;this._wantsHashChange=this.options.hashChange!==false;this._wantsPushState=!!this.options.pushState;this._hasPushState=!!(this.options.pushState&&this.history&&this.history.pushState);var r=this.getFragment();var s=document.documentMode;var n=P.exec(navigator.userAgent.toLowerCase())&&(!s||s<=7);this.root=("/"+this.root+"/").replace(O,"/");if(n&&this._wantsHashChange){var a=e.$('<iframe src="javascript:0" tabindex="-1">');this.iframe=a.hide().appendTo("body")[0].contentWindow;this.navigate(r)}if(this._hasPushState){e.$(window).on("popstate",this.checkUrl)}else if(this._wantsHashChange&&"onhashchange"in window&&!n){e.$(window).on("hashchange",this.checkUrl)}else if(this._wantsHashChange){this._checkUrlInterval=setInterval(this.checkUrl,this.interval)}this.fragment=r;var o=this.location;if(this._wantsHashChange&&this._wantsPushState){if(!this._hasPushState&&!this.atRoot()){this.fragment=this.getFragment(null,true);this.location.replace(this.root+"#"+this.fragment);return true}else if(this._hasPushState&&this.atRoot()&&o.hash){this.fragment=this.getHash().replace(R,"");this.history.replaceState({},document.title,this.root+this.fragment)}}if(!this.options.silent)return this.loadUrl()},stop:function(){e.$(window).off("popstate",this.checkUrl).off("hashchange",this.checkUrl);if(this._checkUrlInterval)clearInterval(this._checkUrlInterval);N.started=false},route:function(t,e){this.handlers.unshift({route:t,callback:e})},checkUrl:function(t){var e=this.getFragment();if(e===this.fragment&&this.iframe){e=this.getFragment(this.getHash(this.iframe))}if(e===this.fragment)return false;if(this.iframe)this.navigate(e);this.loadUrl()},loadUrl:function(t){t=this.fragment=this.getFragment(t);return i.any(this.handlers,function(e){if(e.route.test(t)){e.callback(t);return true}})},navigate:function(t,e){if(!N.started)return false;if(!e||e===true)e={trigger:!!e};var i=this.root+(t=this.getFragment(t||""));t=t.replace(j,"");if(this.fragment===t)return;this.fragment=t;if(t===""&&i!=="/")i=i.slice(0,-1);if(this._hasPushState){this.history[e.replace?"replaceState":"pushState"]({},document.title,i)}else if(this._wantsHashChange){this._updateHash(this.location,t,e.replace);if(this.iframe&&t!==this.getFragment(this.getHash(this.iframe))){if(!e.replace)this.iframe.document.open().close();this._updateHash(this.iframe.location,t,e.replace)}}else{return this.location.assign(i)}if(e.trigger)return this.loadUrl(t)},_updateHash:function(t,e,i){if(i){var r=t.href.replace(/(javascript:|#).*$/,"");t.replace(r+"#"+e)}else{t.hash="#"+e}}});e.history=new N;var U=function(t,e){var r=this;var s;if(t&&i.has(t,"constructor")){s=t.constructor}else{s=function(){return r.apply(this,arguments)}}i.extend(s,r,e);var n=function(){this.constructor=s};n.prototype=r.prototype;s.prototype=new n;if(t)i.extend(s.prototype,t);s.__super__=r.prototype;return s};p.extend=g.extend=$.extend=w.extend=N.extend=U;var M=function(){throw new Error('A "url" property or function must be specified')};var q=function(t,e){var i=e.error;e.error=function(r){if(i)i(t,r,e);t.trigger("error",t,r,e)}};return e});
skin/adminhtml/default/default/unbxd/js/lib/ractive-backbone.js ADDED
@@ -0,0 +1 @@
 
1
+ (function(e,t){"use strict";if(typeof module!=="undefined"&&module.exports&&typeof require==="function"){t(require("ractive"),require("backbone"))}else if(typeof define==="function"&&define.amd){define(["ractive","backbone"],t)}else if(e.Ractive&&e.Backbone){t(e.Ractive,e.Backbone)}else{throw new Error("Could not find Ractive or Backbone! Both must be loaded before the ractive-adaptors-backbone plugin")}})(typeof window!=="undefined"?window:this,function(e,t){"use strict";var n,o,i="_ractiveAdaptorsBackboneLock";if(!e||!t){throw new Error("Could not find Ractive or Backbone! Check your paths config")}function r(e){e[i]=(e[i]||0)+1;return function t(){e[i]-=1;if(!e[i]){delete e[i]}}}function a(e){return!!e[i]}e.adaptors.Backbone={filter:function(e){return e instanceof t.Model||e instanceof t.Collection},wrap:function(e,i,r,a){if(i instanceof t.Model){return new n(e,i,r,a)}return new o(e,i,r,a)}};n=function(e,t,n,o){this.value=t;t.on("change",this.modelChangeHandler=function(){var n=r(t);e.set(o(t.changed));n()})};n.prototype={teardown:function(){this.value.off("change",this.modelChangeHandler)},get:function(){return this.value.attributes},set:function(e,t){if(!a(this.value)&&e.indexOf(".")===-1){this.value.set(e,t)}},reset:function(e){if(e instanceof t.Model||!(e instanceof Object)){return false}this.value.set(e)}};o=function(e,t,n){this.value=t;t.on("add remove reset sort",this.changeHandler=function(){var o=r(t);e.set(n,t.models);o()})};o.prototype={teardown:function(){this.value.off("add remove reset sort",this.changeHandler)},get:function(){return this.value.models},reset:function(e){if(a(this.value)){return}if(e instanceof t.Collection||Object.prototype.toString.call(e)!=="[object Array]"){return false}this.value.reset(e)}}});
skin/adminhtml/default/default/unbxd/js/lib/require.js ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ RequireJS 2.1.15 Copyright (c) 2010-2014, The Dojo Foundation All Rights Reserved.
3
+ Available via the MIT or new BSD license.
4
+ see: http://github.com/jrburke/requirejs for details
5
+ */
6
+ var requirejs,require,define;
7
+ (function(ba){function G(b){return"[object Function]"===K.call(b)}function H(b){return"[object Array]"===K.call(b)}function v(b,c){if(b){var d;for(d=0;d<b.length&&(!b[d]||!c(b[d],d,b));d+=1);}}function T(b,c){if(b){var d;for(d=b.length-1;-1<d&&(!b[d]||!c(b[d],d,b));d-=1);}}function t(b,c){return fa.call(b,c)}function m(b,c){return t(b,c)&&b[c]}function B(b,c){for(var d in b)if(t(b,d)&&c(b[d],d))break}function U(b,c,d,e){c&&B(c,function(c,g){if(d||!t(b,g))e&&"object"===typeof c&&c&&!H(c)&&!G(c)&&!(c instanceof
8
+ RegExp)?(b[g]||(b[g]={}),U(b[g],c,d,e)):b[g]=c});return b}function u(b,c){return function(){return c.apply(b,arguments)}}function ca(b){throw b;}function da(b){if(!b)return b;var c=ba;v(b.split("."),function(b){c=c[b]});return c}function C(b,c,d,e){c=Error(c+"\nhttp://requirejs.org/docs/errors.html#"+b);c.requireType=b;c.requireModules=e;d&&(c.originalError=d);return c}function ga(b){function c(a,k,b){var f,l,c,d,e,g,i,p,k=k&&k.split("/"),h=j.map,n=h&&h["*"];if(a){a=a.split("/");l=a.length-1;j.nodeIdCompat&&
9
+ Q.test(a[l])&&(a[l]=a[l].replace(Q,""));"."===a[0].charAt(0)&&k&&(l=k.slice(0,k.length-1),a=l.concat(a));l=a;for(c=0;c<l.length;c++)if(d=l[c],"."===d)l.splice(c,1),c-=1;else if(".."===d&&!(0===c||1==c&&".."===l[2]||".."===l[c-1])&&0<c)l.splice(c-1,2),c-=2;a=a.join("/")}if(b&&h&&(k||n)){l=a.split("/");c=l.length;a:for(;0<c;c-=1){e=l.slice(0,c).join("/");if(k)for(d=k.length;0<d;d-=1)if(b=m(h,k.slice(0,d).join("/")))if(b=m(b,e)){f=b;g=c;break a}!i&&(n&&m(n,e))&&(i=m(n,e),p=c)}!f&&i&&(f=i,g=p);f&&(l.splice(0,
10
+ g,f),a=l.join("/"))}return(f=m(j.pkgs,a))?f:a}function d(a){z&&v(document.getElementsByTagName("script"),function(k){if(k.getAttribute("data-requiremodule")===a&&k.getAttribute("data-requirecontext")===i.contextName)return k.parentNode.removeChild(k),!0})}function e(a){var k=m(j.paths,a);if(k&&H(k)&&1<k.length)return k.shift(),i.require.undef(a),i.makeRequire(null,{skipMap:!0})([a]),!0}function n(a){var k,c=a?a.indexOf("!"):-1;-1<c&&(k=a.substring(0,c),a=a.substring(c+1,a.length));return[k,a]}function p(a,
11
+ k,b,f){var l,d,e=null,g=k?k.name:null,j=a,p=!0,h="";a||(p=!1,a="_@r"+(K+=1));a=n(a);e=a[0];a=a[1];e&&(e=c(e,g,f),d=m(r,e));a&&(e?h=d&&d.normalize?d.normalize(a,function(a){return c(a,g,f)}):-1===a.indexOf("!")?c(a,g,f):a:(h=c(a,g,f),a=n(h),e=a[0],h=a[1],b=!0,l=i.nameToUrl(h)));b=e&&!d&&!b?"_unnormalized"+(O+=1):"";return{prefix:e,name:h,parentMap:k,unnormalized:!!b,url:l,originalName:j,isDefine:p,id:(e?e+"!"+h:h)+b}}function s(a){var k=a.id,b=m(h,k);b||(b=h[k]=new i.Module(a));return b}function q(a,
12
+ k,b){var f=a.id,c=m(h,f);if(t(r,f)&&(!c||c.defineEmitComplete))"defined"===k&&b(r[f]);else if(c=s(a),c.error&&"error"===k)b(c.error);else c.on(k,b)}function w(a,b){var c=a.requireModules,f=!1;if(b)b(a);else if(v(c,function(b){if(b=m(h,b))b.error=a,b.events.error&&(f=!0,b.emit("error",a))}),!f)g.onError(a)}function x(){R.length&&(ha.apply(A,[A.length,0].concat(R)),R=[])}function y(a){delete h[a];delete V[a]}function F(a,b,c){var f=a.map.id;a.error?a.emit("error",a.error):(b[f]=!0,v(a.depMaps,function(f,
13
+ d){var e=f.id,g=m(h,e);g&&(!a.depMatched[d]&&!c[e])&&(m(b,e)?(a.defineDep(d,r[e]),a.check()):F(g,b,c))}),c[f]=!0)}function D(){var a,b,c=(a=1E3*j.waitSeconds)&&i.startTime+a<(new Date).getTime(),f=[],l=[],g=!1,h=!0;if(!W){W=!0;B(V,function(a){var i=a.map,j=i.id;if(a.enabled&&(i.isDefine||l.push(a),!a.error))if(!a.inited&&c)e(j)?g=b=!0:(f.push(j),d(j));else if(!a.inited&&(a.fetched&&i.isDefine)&&(g=!0,!i.prefix))return h=!1});if(c&&f.length)return a=C("timeout","Load timeout for modules: "+f,null,
14
+ f),a.contextName=i.contextName,w(a);h&&v(l,function(a){F(a,{},{})});if((!c||b)&&g)if((z||ea)&&!X)X=setTimeout(function(){X=0;D()},50);W=!1}}function E(a){t(r,a[0])||s(p(a[0],null,!0)).init(a[1],a[2])}function I(a){var a=a.currentTarget||a.srcElement,b=i.onScriptLoad;a.detachEvent&&!Y?a.detachEvent("onreadystatechange",b):a.removeEventListener("load",b,!1);b=i.onScriptError;(!a.detachEvent||Y)&&a.removeEventListener("error",b,!1);return{node:a,id:a&&a.getAttribute("data-requiremodule")}}function J(){var a;
15
+ for(x();A.length;){a=A.shift();if(null===a[0])return w(C("mismatch","Mismatched anonymous define() module: "+a[a.length-1]));E(a)}}var W,Z,i,L,X,j={waitSeconds:7,baseUrl:"./",paths:{},bundles:{},pkgs:{},shim:{},config:{}},h={},V={},$={},A=[],r={},S={},aa={},K=1,O=1;L={require:function(a){return a.require?a.require:a.require=i.makeRequire(a.map)},exports:function(a){a.usingExports=!0;if(a.map.isDefine)return a.exports?r[a.map.id]=a.exports:a.exports=r[a.map.id]={}},module:function(a){return a.module?
16
+ a.module:a.module={id:a.map.id,uri:a.map.url,config:function(){return m(j.config,a.map.id)||{}},exports:a.exports||(a.exports={})}}};Z=function(a){this.events=m($,a.id)||{};this.map=a;this.shim=m(j.shim,a.id);this.depExports=[];this.depMaps=[];this.depMatched=[];this.pluginMaps={};this.depCount=0};Z.prototype={init:function(a,b,c,f){f=f||{};if(!this.inited){this.factory=b;if(c)this.on("error",c);else this.events.error&&(c=u(this,function(a){this.emit("error",a)}));this.depMaps=a&&a.slice(0);this.errback=
17
+ c;this.inited=!0;this.ignore=f.ignore;f.enabled||this.enabled?this.enable():this.check()}},defineDep:function(a,b){this.depMatched[a]||(this.depMatched[a]=!0,this.depCount-=1,this.depExports[a]=b)},fetch:function(){if(!this.fetched){this.fetched=!0;i.startTime=(new Date).getTime();var a=this.map;if(this.shim)i.makeRequire(this.map,{enableBuildCallback:!0})(this.shim.deps||[],u(this,function(){return a.prefix?this.callPlugin():this.load()}));else return a.prefix?this.callPlugin():this.load()}},load:function(){var a=
18
+ this.map.url;S[a]||(S[a]=!0,i.load(this.map.id,a))},check:function(){if(this.enabled&&!this.enabling){var a,b,c=this.map.id;b=this.depExports;var f=this.exports,l=this.factory;if(this.inited)if(this.error)this.emit("error",this.error);else{if(!this.defining){this.defining=!0;if(1>this.depCount&&!this.defined){if(G(l)){if(this.events.error&&this.map.isDefine||g.onError!==ca)try{f=i.execCb(c,l,b,f)}catch(d){a=d}else f=i.execCb(c,l,b,f);this.map.isDefine&&void 0===f&&((b=this.module)?f=b.exports:this.usingExports&&
19
+ (f=this.exports));if(a)return a.requireMap=this.map,a.requireModules=this.map.isDefine?[this.map.id]:null,a.requireType=this.map.isDefine?"define":"require",w(this.error=a)}else f=l;this.exports=f;if(this.map.isDefine&&!this.ignore&&(r[c]=f,g.onResourceLoad))g.onResourceLoad(i,this.map,this.depMaps);y(c);this.defined=!0}this.defining=!1;this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=!0)}}else this.fetch()}},callPlugin:function(){var a=
20
+ this.map,b=a.id,d=p(a.prefix);this.depMaps.push(d);q(d,"defined",u(this,function(f){var l,d;d=m(aa,this.map.id);var e=this.map.name,P=this.map.parentMap?this.map.parentMap.name:null,n=i.makeRequire(a.parentMap,{enableBuildCallback:!0});if(this.map.unnormalized){if(f.normalize&&(e=f.normalize(e,function(a){return c(a,P,!0)})||""),f=p(a.prefix+"!"+e,this.map.parentMap),q(f,"defined",u(this,function(a){this.init([],function(){return a},null,{enabled:!0,ignore:!0})})),d=m(h,f.id)){this.depMaps.push(f);
21
+ if(this.events.error)d.on("error",u(this,function(a){this.emit("error",a)}));d.enable()}}else d?(this.map.url=i.nameToUrl(d),this.load()):(l=u(this,function(a){this.init([],function(){return a},null,{enabled:!0})}),l.error=u(this,function(a){this.inited=!0;this.error=a;a.requireModules=[b];B(h,function(a){0===a.map.id.indexOf(b+"_unnormalized")&&y(a.map.id)});w(a)}),l.fromText=u(this,function(f,c){var d=a.name,e=p(d),P=M;c&&(f=c);P&&(M=!1);s(e);t(j.config,b)&&(j.config[d]=j.config[b]);try{g.exec(f)}catch(h){return w(C("fromtexteval",
22
+ "fromText eval for "+b+" failed: "+h,h,[b]))}P&&(M=!0);this.depMaps.push(e);i.completeLoad(d);n([d],l)}),f.load(a.name,n,l,j))}));i.enable(d,this);this.pluginMaps[d.id]=d},enable:function(){V[this.map.id]=this;this.enabling=this.enabled=!0;v(this.depMaps,u(this,function(a,b){var c,f;if("string"===typeof a){a=p(a,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap);this.depMaps[b]=a;if(c=m(L,a.id)){this.depExports[b]=c(this);return}this.depCount+=1;q(a,"defined",u(this,function(a){this.defineDep(b,
23
+ a);this.check()}));this.errback&&q(a,"error",u(this,this.errback))}c=a.id;f=h[c];!t(L,c)&&(f&&!f.enabled)&&i.enable(a,this)}));B(this.pluginMaps,u(this,function(a){var b=m(h,a.id);b&&!b.enabled&&i.enable(a,this)}));this.enabling=!1;this.check()},on:function(a,b){var c=this.events[a];c||(c=this.events[a]=[]);c.push(b)},emit:function(a,b){v(this.events[a],function(a){a(b)});"error"===a&&delete this.events[a]}};i={config:j,contextName:b,registry:h,defined:r,urlFetched:S,defQueue:A,Module:Z,makeModuleMap:p,
24
+ nextTick:g.nextTick,onError:w,configure:function(a){a.baseUrl&&"/"!==a.baseUrl.charAt(a.baseUrl.length-1)&&(a.baseUrl+="/");var b=j.shim,c={paths:!0,bundles:!0,config:!0,map:!0};B(a,function(a,b){c[b]?(j[b]||(j[b]={}),U(j[b],a,!0,!0)):j[b]=a});a.bundles&&B(a.bundles,function(a,b){v(a,function(a){a!==b&&(aa[a]=b)})});a.shim&&(B(a.shim,function(a,c){H(a)&&(a={deps:a});if((a.exports||a.init)&&!a.exportsFn)a.exportsFn=i.makeShimExports(a);b[c]=a}),j.shim=b);a.packages&&v(a.packages,function(a){var b,
25
+ a="string"===typeof a?{name:a}:a;b=a.name;a.location&&(j.paths[b]=a.location);j.pkgs[b]=a.name+"/"+(a.main||"main").replace(ia,"").replace(Q,"")});B(h,function(a,b){!a.inited&&!a.map.unnormalized&&(a.map=p(b))});if(a.deps||a.callback)i.require(a.deps||[],a.callback)},makeShimExports:function(a){return function(){var b;a.init&&(b=a.init.apply(ba,arguments));return b||a.exports&&da(a.exports)}},makeRequire:function(a,e){function j(c,d,m){var n,q;e.enableBuildCallback&&(d&&G(d))&&(d.__requireJsBuild=
26
+ !0);if("string"===typeof c){if(G(d))return w(C("requireargs","Invalid require call"),m);if(a&&t(L,c))return L[c](h[a.id]);if(g.get)return g.get(i,c,a,j);n=p(c,a,!1,!0);n=n.id;return!t(r,n)?w(C("notloaded",'Module name "'+n+'" has not been loaded yet for context: '+b+(a?"":". Use require([])"))):r[n]}J();i.nextTick(function(){J();q=s(p(null,a));q.skipMap=e.skipMap;q.init(c,d,m,{enabled:!0});D()});return j}e=e||{};U(j,{isBrowser:z,toUrl:function(b){var d,e=b.lastIndexOf("."),k=b.split("/")[0];if(-1!==
27
+ e&&(!("."===k||".."===k)||1<e))d=b.substring(e,b.length),b=b.substring(0,e);return i.nameToUrl(c(b,a&&a.id,!0),d,!0)},defined:function(b){return t(r,p(b,a,!1,!0).id)},specified:function(b){b=p(b,a,!1,!0).id;return t(r,b)||t(h,b)}});a||(j.undef=function(b){x();var c=p(b,a,!0),e=m(h,b);d(b);delete r[b];delete S[c.url];delete $[b];T(A,function(a,c){a[0]===b&&A.splice(c,1)});e&&(e.events.defined&&($[b]=e.events),y(b))});return j},enable:function(a){m(h,a.id)&&s(a).enable()},completeLoad:function(a){var b,
28
+ c,d=m(j.shim,a)||{},g=d.exports;for(x();A.length;){c=A.shift();if(null===c[0]){c[0]=a;if(b)break;b=!0}else c[0]===a&&(b=!0);E(c)}c=m(h,a);if(!b&&!t(r,a)&&c&&!c.inited){if(j.enforceDefine&&(!g||!da(g)))return e(a)?void 0:w(C("nodefine","No define call for "+a,null,[a]));E([a,d.deps||[],d.exportsFn])}D()},nameToUrl:function(a,b,c){var d,e,h;(d=m(j.pkgs,a))&&(a=d);if(d=m(aa,a))return i.nameToUrl(d,b,c);if(g.jsExtRegExp.test(a))d=a+(b||"");else{d=j.paths;a=a.split("/");for(e=a.length;0<e;e-=1)if(h=a.slice(0,
29
+ e).join("/"),h=m(d,h)){H(h)&&(h=h[0]);a.splice(0,e,h);break}d=a.join("/");d+=b||(/^data\:|\?/.test(d)||c?"":".js");d=("/"===d.charAt(0)||d.match(/^[\w\+\.\-]+:/)?"":j.baseUrl)+d}return j.urlArgs?d+((-1===d.indexOf("?")?"?":"&")+j.urlArgs):d},load:function(a,b){g.load(i,a,b)},execCb:function(a,b,c,d){return b.apply(d,c)},onScriptLoad:function(a){if("load"===a.type||ja.test((a.currentTarget||a.srcElement).readyState))N=null,a=I(a),i.completeLoad(a.id)},onScriptError:function(a){var b=I(a);if(!e(b.id))return w(C("scripterror",
30
+ "Script error for: "+b.id,a,[b.id]))}};i.require=i.makeRequire();return i}var g,x,y,D,I,E,N,J,s,O,ka=/(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,la=/[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,Q=/\.js$/,ia=/^\.\//;x=Object.prototype;var K=x.toString,fa=x.hasOwnProperty,ha=Array.prototype.splice,z=!!("undefined"!==typeof window&&"undefined"!==typeof navigator&&window.document),ea=!z&&"undefined"!==typeof importScripts,ja=z&&"PLAYSTATION 3"===navigator.platform?/^complete$/:/^(complete|loaded)$/,
31
+ Y="undefined"!==typeof opera&&"[object Opera]"===opera.toString(),F={},q={},R=[],M=!1;if("undefined"===typeof define){if("undefined"!==typeof requirejs){if(G(requirejs))return;q=requirejs;requirejs=void 0}"undefined"!==typeof require&&!G(require)&&(q=require,require=void 0);g=requirejs=function(b,c,d,e){var n,p="_";!H(b)&&"string"!==typeof b&&(n=b,H(c)?(b=c,c=d,d=e):b=[]);n&&n.context&&(p=n.context);(e=m(F,p))||(e=F[p]=g.s.newContext(p));n&&e.configure(n);return e.require(b,c,d)};g.config=function(b){return g(b)};
32
+ g.nextTick="undefined"!==typeof setTimeout?function(b){setTimeout(b,4)}:function(b){b()};require||(require=g);g.version="2.1.15";g.jsExtRegExp=/^\/|:|\?|\.js$/;g.isBrowser=z;x=g.s={contexts:F,newContext:ga};g({});v(["toUrl","undef","defined","specified"],function(b){g[b]=function(){var c=F._;return c.require[b].apply(c,arguments)}});if(z&&(y=x.head=document.getElementsByTagName("head")[0],D=document.getElementsByTagName("base")[0]))y=x.head=D.parentNode;g.onError=ca;g.createNode=function(b){var c=
33
+ b.xhtml?document.createElementNS("http://www.w3.org/1999/xhtml","html:script"):document.createElement("script");c.type=b.scriptType||"text/javascript";c.charset="utf-8";c.async=!0;return c};g.load=function(b,c,d){var e=b&&b.config||{};if(z)return e=g.createNode(e,c,d),e.setAttribute("data-requirecontext",b.contextName),e.setAttribute("data-requiremodule",c),e.attachEvent&&!(e.attachEvent.toString&&0>e.attachEvent.toString().indexOf("[native code"))&&!Y?(M=!0,e.attachEvent("onreadystatechange",b.onScriptLoad)):
34
+ (e.addEventListener("load",b.onScriptLoad,!1),e.addEventListener("error",b.onScriptError,!1)),e.src=d,J=e,D?y.insertBefore(e,D):y.appendChild(e),J=null,e;if(ea)try{importScripts(d),b.completeLoad(c)}catch(m){b.onError(C("importscripts","importScripts failed for "+c+" at "+d,m,[c]))}};z&&!q.skipDataMain&&T(document.getElementsByTagName("script"),function(b){y||(y=b.parentNode);if(I=b.getAttribute("data-main"))return s=I,q.baseUrl||(E=s.split("/"),s=E.pop(),O=E.length?E.join("/")+"/":"./",q.baseUrl=
35
+ O),s=s.replace(Q,""),g.jsExtRegExp.test(s)&&(s=I),q.deps=q.deps?q.deps.concat(s):[s],!0});define=function(b,c,d){var e,g;"string"!==typeof b&&(d=c,c=b,b=null);H(c)||(d=c,c=null);!c&&G(d)&&(c=[],d.length&&(d.toString().replace(ka,"").replace(la,function(b,d){c.push(d)}),c=(1===d.length?["require"]:["require","exports","module"]).concat(c)));if(M){if(!(e=J))N&&"interactive"===N.readyState||T(document.getElementsByTagName("script"),function(b){if("interactive"===b.readyState)return N=b}),e=N;e&&(b||
36
+ (b=e.getAttribute("data-requiremodule")),g=F[e.getAttribute("data-requirecontext")])}(g?g.defQueue:R).push([b,c,d])};define.amd={jQuery:!0};g.exec=function(b){return eval(b)};g(q)}})(this);
skin/adminhtml/default/default/unbxd/js/lib/underscore.js ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ // Underscore.js 1.8.2
2
+ // http://underscorejs.org
3
+ // (c) 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
4
+ // Underscore may be freely distributed under the MIT license.
5
+ (function(){function n(n){function t(t,r,e,u,i,o){for(;i>=0&&o>i;i+=n){var a=u?u[i]:i;e=r(e,t[a],a,t)}return e}return function(r,e,u,i){e=d(e,i,4);var o=!w(r)&&m.keys(r),a=(o||r).length,c=n>0?0:a-1;return arguments.length<3&&(u=r[o?o[c]:c],c+=n),t(r,e,u,o,c,a)}}function t(n){return function(t,r,e){r=b(r,e);for(var u=null!=t&&t.length,i=n>0?0:u-1;i>=0&&u>i;i+=n)if(r(t[i],i,t))return i;return-1}}function r(n,t){var r=S.length,e=n.constructor,u=m.isFunction(e)&&e.prototype||o,i="constructor";for(m.has(n,i)&&!m.contains(t,i)&&t.push(i);r--;)i=S[r],i in n&&n[i]!==u[i]&&!m.contains(t,i)&&t.push(i)}var e=this,u=e._,i=Array.prototype,o=Object.prototype,a=Function.prototype,c=i.push,l=i.slice,f=o.toString,s=o.hasOwnProperty,p=Array.isArray,h=Object.keys,v=a.bind,g=Object.create,y=function(){},m=function(n){return n instanceof m?n:this instanceof m?void(this._wrapped=n):new m(n)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=m),exports._=m):e._=m,m.VERSION="1.8.2";var d=function(n,t,r){if(t===void 0)return n;switch(null==r?3:r){case 1:return function(r){return n.call(t,r)};case 2:return function(r,e){return n.call(t,r,e)};case 3:return function(r,e,u){return n.call(t,r,e,u)};case 4:return function(r,e,u,i){return n.call(t,r,e,u,i)}}return function(){return n.apply(t,arguments)}},b=function(n,t,r){return null==n?m.identity:m.isFunction(n)?d(n,t,r):m.isObject(n)?m.matcher(n):m.property(n)};m.iteratee=function(n,t){return b(n,t,1/0)};var x=function(n,t){return function(r){var e=arguments.length;if(2>e||null==r)return r;for(var u=1;e>u;u++)for(var i=arguments[u],o=n(i),a=o.length,c=0;a>c;c++){var l=o[c];t&&r[l]!==void 0||(r[l]=i[l])}return r}},_=function(n){if(!m.isObject(n))return{};if(g)return g(n);y.prototype=n;var t=new y;return y.prototype=null,t},j=Math.pow(2,53)-1,w=function(n){var t=n&&n.length;return"number"==typeof t&&t>=0&&j>=t};m.each=m.forEach=function(n,t,r){t=d(t,r);var e,u;if(w(n))for(e=0,u=n.length;u>e;e++)t(n[e],e,n);else{var i=m.keys(n);for(e=0,u=i.length;u>e;e++)t(n[i[e]],i[e],n)}return n},m.map=m.collect=function(n,t,r){t=b(t,r);for(var e=!w(n)&&m.keys(n),u=(e||n).length,i=Array(u),o=0;u>o;o++){var a=e?e[o]:o;i[o]=t(n[a],a,n)}return i},m.reduce=m.foldl=m.inject=n(1),m.reduceRight=m.foldr=n(-1),m.find=m.detect=function(n,t,r){var e;return e=w(n)?m.findIndex(n,t,r):m.findKey(n,t,r),e!==void 0&&e!==-1?n[e]:void 0},m.filter=m.select=function(n,t,r){var e=[];return t=b(t,r),m.each(n,function(n,r,u){t(n,r,u)&&e.push(n)}),e},m.reject=function(n,t,r){return m.filter(n,m.negate(b(t)),r)},m.every=m.all=function(n,t,r){t=b(t,r);for(var e=!w(n)&&m.keys(n),u=(e||n).length,i=0;u>i;i++){var o=e?e[i]:i;if(!t(n[o],o,n))return!1}return!0},m.some=m.any=function(n,t,r){t=b(t,r);for(var e=!w(n)&&m.keys(n),u=(e||n).length,i=0;u>i;i++){var o=e?e[i]:i;if(t(n[o],o,n))return!0}return!1},m.contains=m.includes=m.include=function(n,t,r){return w(n)||(n=m.values(n)),m.indexOf(n,t,"number"==typeof r&&r)>=0},m.invoke=function(n,t){var r=l.call(arguments,2),e=m.isFunction(t);return m.map(n,function(n){var u=e?t:n[t];return null==u?u:u.apply(n,r)})},m.pluck=function(n,t){return m.map(n,m.property(t))},m.where=function(n,t){return m.filter(n,m.matcher(t))},m.findWhere=function(n,t){return m.find(n,m.matcher(t))},m.max=function(n,t,r){var e,u,i=-1/0,o=-1/0;if(null==t&&null!=n){n=w(n)?n:m.values(n);for(var a=0,c=n.length;c>a;a++)e=n[a],e>i&&(i=e)}else t=b(t,r),m.each(n,function(n,r,e){u=t(n,r,e),(u>o||u===-1/0&&i===-1/0)&&(i=n,o=u)});return i},m.min=function(n,t,r){var e,u,i=1/0,o=1/0;if(null==t&&null!=n){n=w(n)?n:m.values(n);for(var a=0,c=n.length;c>a;a++)e=n[a],i>e&&(i=e)}else t=b(t,r),m.each(n,function(n,r,e){u=t(n,r,e),(o>u||1/0===u&&1/0===i)&&(i=n,o=u)});return i},m.shuffle=function(n){for(var t,r=w(n)?n:m.values(n),e=r.length,u=Array(e),i=0;e>i;i++)t=m.random(0,i),t!==i&&(u[i]=u[t]),u[t]=r[i];return u},m.sample=function(n,t,r){return null==t||r?(w(n)||(n=m.values(n)),n[m.random(n.length-1)]):m.shuffle(n).slice(0,Math.max(0,t))},m.sortBy=function(n,t,r){return t=b(t,r),m.pluck(m.map(n,function(n,r,e){return{value:n,index:r,criteria:t(n,r,e)}}).sort(function(n,t){var r=n.criteria,e=t.criteria;if(r!==e){if(r>e||r===void 0)return 1;if(e>r||e===void 0)return-1}return n.index-t.index}),"value")};var A=function(n){return function(t,r,e){var u={};return r=b(r,e),m.each(t,function(e,i){var o=r(e,i,t);n(u,e,o)}),u}};m.groupBy=A(function(n,t,r){m.has(n,r)?n[r].push(t):n[r]=[t]}),m.indexBy=A(function(n,t,r){n[r]=t}),m.countBy=A(function(n,t,r){m.has(n,r)?n[r]++:n[r]=1}),m.toArray=function(n){return n?m.isArray(n)?l.call(n):w(n)?m.map(n,m.identity):m.values(n):[]},m.size=function(n){return null==n?0:w(n)?n.length:m.keys(n).length},m.partition=function(n,t,r){t=b(t,r);var e=[],u=[];return m.each(n,function(n,r,i){(t(n,r,i)?e:u).push(n)}),[e,u]},m.first=m.head=m.take=function(n,t,r){return null==n?void 0:null==t||r?n[0]:m.initial(n,n.length-t)},m.initial=function(n,t,r){return l.call(n,0,Math.max(0,n.length-(null==t||r?1:t)))},m.last=function(n,t,r){return null==n?void 0:null==t||r?n[n.length-1]:m.rest(n,Math.max(0,n.length-t))},m.rest=m.tail=m.drop=function(n,t,r){return l.call(n,null==t||r?1:t)},m.compact=function(n){return m.filter(n,m.identity)};var k=function(n,t,r,e){for(var u=[],i=0,o=e||0,a=n&&n.length;a>o;o++){var c=n[o];if(w(c)&&(m.isArray(c)||m.isArguments(c))){t||(c=k(c,t,r));var l=0,f=c.length;for(u.length+=f;f>l;)u[i++]=c[l++]}else r||(u[i++]=c)}return u};m.flatten=function(n,t){return k(n,t,!1)},m.without=function(n){return m.difference(n,l.call(arguments,1))},m.uniq=m.unique=function(n,t,r,e){if(null==n)return[];m.isBoolean(t)||(e=r,r=t,t=!1),null!=r&&(r=b(r,e));for(var u=[],i=[],o=0,a=n.length;a>o;o++){var c=n[o],l=r?r(c,o,n):c;t?(o&&i===l||u.push(c),i=l):r?m.contains(i,l)||(i.push(l),u.push(c)):m.contains(u,c)||u.push(c)}return u},m.union=function(){return m.uniq(k(arguments,!0,!0))},m.intersection=function(n){if(null==n)return[];for(var t=[],r=arguments.length,e=0,u=n.length;u>e;e++){var i=n[e];if(!m.contains(t,i)){for(var o=1;r>o&&m.contains(arguments[o],i);o++);o===r&&t.push(i)}}return t},m.difference=function(n){var t=k(arguments,!0,!0,1);return m.filter(n,function(n){return!m.contains(t,n)})},m.zip=function(){return m.unzip(arguments)},m.unzip=function(n){for(var t=n&&m.max(n,"length").length||0,r=Array(t),e=0;t>e;e++)r[e]=m.pluck(n,e);return r},m.object=function(n,t){for(var r={},e=0,u=n&&n.length;u>e;e++)t?r[n[e]]=t[e]:r[n[e][0]]=n[e][1];return r},m.indexOf=function(n,t,r){var e=0,u=n&&n.length;if("number"==typeof r)e=0>r?Math.max(0,u+r):r;else if(r&&u)return e=m.sortedIndex(n,t),n[e]===t?e:-1;if(t!==t)return m.findIndex(l.call(n,e),m.isNaN);for(;u>e;e++)if(n[e]===t)return e;return-1},m.lastIndexOf=function(n,t,r){var e=n?n.length:0;if("number"==typeof r&&(e=0>r?e+r+1:Math.min(e,r+1)),t!==t)return m.findLastIndex(l.call(n,0,e),m.isNaN);for(;--e>=0;)if(n[e]===t)return e;return-1},m.findIndex=t(1),m.findLastIndex=t(-1),m.sortedIndex=function(n,t,r,e){r=b(r,e,1);for(var u=r(t),i=0,o=n.length;o>i;){var a=Math.floor((i+o)/2);r(n[a])<u?i=a+1:o=a}return i},m.range=function(n,t,r){arguments.length<=1&&(t=n||0,n=0),r=r||1;for(var e=Math.max(Math.ceil((t-n)/r),0),u=Array(e),i=0;e>i;i++,n+=r)u[i]=n;return u};var O=function(n,t,r,e,u){if(!(e instanceof t))return n.apply(r,u);var i=_(n.prototype),o=n.apply(i,u);return m.isObject(o)?o:i};m.bind=function(n,t){if(v&&n.bind===v)return v.apply(n,l.call(arguments,1));if(!m.isFunction(n))throw new TypeError("Bind must be called on a function");var r=l.call(arguments,2),e=function(){return O(n,e,t,this,r.concat(l.call(arguments)))};return e},m.partial=function(n){var t=l.call(arguments,1),r=function(){for(var e=0,u=t.length,i=Array(u),o=0;u>o;o++)i[o]=t[o]===m?arguments[e++]:t[o];for(;e<arguments.length;)i.push(arguments[e++]);return O(n,r,this,this,i)};return r},m.bindAll=function(n){var t,r,e=arguments.length;if(1>=e)throw new Error("bindAll must be passed function names");for(t=1;e>t;t++)r=arguments[t],n[r]=m.bind(n[r],n);return n},m.memoize=function(n,t){var r=function(e){var u=r.cache,i=""+(t?t.apply(this,arguments):e);return m.has(u,i)||(u[i]=n.apply(this,arguments)),u[i]};return r.cache={},r},m.delay=function(n,t){var r=l.call(arguments,2);return setTimeout(function(){return n.apply(null,r)},t)},m.defer=m.partial(m.delay,m,1),m.throttle=function(n,t,r){var e,u,i,o=null,a=0;r||(r={});var c=function(){a=r.leading===!1?0:m.now(),o=null,i=n.apply(e,u),o||(e=u=null)};return function(){var l=m.now();a||r.leading!==!1||(a=l);var f=t-(l-a);return e=this,u=arguments,0>=f||f>t?(o&&(clearTimeout(o),o=null),a=l,i=n.apply(e,u),o||(e=u=null)):o||r.trailing===!1||(o=setTimeout(c,f)),i}},m.debounce=function(n,t,r){var e,u,i,o,a,c=function(){var l=m.now()-o;t>l&&l>=0?e=setTimeout(c,t-l):(e=null,r||(a=n.apply(i,u),e||(i=u=null)))};return function(){i=this,u=arguments,o=m.now();var l=r&&!e;return e||(e=setTimeout(c,t)),l&&(a=n.apply(i,u),i=u=null),a}},m.wrap=function(n,t){return m.partial(t,n)},m.negate=function(n){return function(){return!n.apply(this,arguments)}},m.compose=function(){var n=arguments,t=n.length-1;return function(){for(var r=t,e=n[t].apply(this,arguments);r--;)e=n[r].call(this,e);return e}},m.after=function(n,t){return function(){return--n<1?t.apply(this,arguments):void 0}},m.before=function(n,t){var r;return function(){return--n>0&&(r=t.apply(this,arguments)),1>=n&&(t=null),r}},m.once=m.partial(m.before,2);var F=!{toString:null}.propertyIsEnumerable("toString"),S=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"];m.keys=function(n){if(!m.isObject(n))return[];if(h)return h(n);var t=[];for(var e in n)m.has(n,e)&&t.push(e);return F&&r(n,t),t},m.allKeys=function(n){if(!m.isObject(n))return[];var t=[];for(var e in n)t.push(e);return F&&r(n,t),t},m.values=function(n){for(var t=m.keys(n),r=t.length,e=Array(r),u=0;r>u;u++)e[u]=n[t[u]];return e},m.mapObject=function(n,t,r){t=b(t,r);for(var e,u=m.keys(n),i=u.length,o={},a=0;i>a;a++)e=u[a],o[e]=t(n[e],e,n);return o},m.pairs=function(n){for(var t=m.keys(n),r=t.length,e=Array(r),u=0;r>u;u++)e[u]=[t[u],n[t[u]]];return e},m.invert=function(n){for(var t={},r=m.keys(n),e=0,u=r.length;u>e;e++)t[n[r[e]]]=r[e];return t},m.functions=m.methods=function(n){var t=[];for(var r in n)m.isFunction(n[r])&&t.push(r);return t.sort()},m.extend=x(m.allKeys),m.extendOwn=m.assign=x(m.keys),m.findKey=function(n,t,r){t=b(t,r);for(var e,u=m.keys(n),i=0,o=u.length;o>i;i++)if(e=u[i],t(n[e],e,n))return e},m.pick=function(n,t,r){var e,u,i={},o=n;if(null==o)return i;m.isFunction(t)?(u=m.allKeys(o),e=d(t,r)):(u=k(arguments,!1,!1,1),e=function(n,t,r){return t in r},o=Object(o));for(var a=0,c=u.length;c>a;a++){var l=u[a],f=o[l];e(f,l,o)&&(i[l]=f)}return i},m.omit=function(n,t,r){if(m.isFunction(t))t=m.negate(t);else{var e=m.map(k(arguments,!1,!1,1),String);t=function(n,t){return!m.contains(e,t)}}return m.pick(n,t,r)},m.defaults=x(m.allKeys,!0),m.clone=function(n){return m.isObject(n)?m.isArray(n)?n.slice():m.extend({},n):n},m.tap=function(n,t){return t(n),n},m.isMatch=function(n,t){var r=m.keys(t),e=r.length;if(null==n)return!e;for(var u=Object(n),i=0;e>i;i++){var o=r[i];if(t[o]!==u[o]||!(o in u))return!1}return!0};var E=function(n,t,r,e){if(n===t)return 0!==n||1/n===1/t;if(null==n||null==t)return n===t;n instanceof m&&(n=n._wrapped),t instanceof m&&(t=t._wrapped);var u=f.call(n);if(u!==f.call(t))return!1;switch(u){case"[object RegExp]":case"[object String]":return""+n==""+t;case"[object Number]":return+n!==+n?+t!==+t:0===+n?1/+n===1/t:+n===+t;case"[object Date]":case"[object Boolean]":return+n===+t}var i="[object Array]"===u;if(!i){if("object"!=typeof n||"object"!=typeof t)return!1;var o=n.constructor,a=t.constructor;if(o!==a&&!(m.isFunction(o)&&o instanceof o&&m.isFunction(a)&&a instanceof a)&&"constructor"in n&&"constructor"in t)return!1}r=r||[],e=e||[];for(var c=r.length;c--;)if(r[c]===n)return e[c]===t;if(r.push(n),e.push(t),i){if(c=n.length,c!==t.length)return!1;for(;c--;)if(!E(n[c],t[c],r,e))return!1}else{var l,s=m.keys(n);if(c=s.length,m.keys(t).length!==c)return!1;for(;c--;)if(l=s[c],!m.has(t,l)||!E(n[l],t[l],r,e))return!1}return r.pop(),e.pop(),!0};m.isEqual=function(n,t){return E(n,t)},m.isEmpty=function(n){return null==n?!0:w(n)&&(m.isArray(n)||m.isString(n)||m.isArguments(n))?0===n.length:0===m.keys(n).length},m.isElement=function(n){return!(!n||1!==n.nodeType)},m.isArray=p||function(n){return"[object Array]"===f.call(n)},m.isObject=function(n){var t=typeof n;return"function"===t||"object"===t&&!!n},m.each(["Arguments","Function","String","Number","Date","RegExp","Error"],function(n){m["is"+n]=function(t){return f.call(t)==="[object "+n+"]"}}),m.isArguments(arguments)||(m.isArguments=function(n){return m.has(n,"callee")}),"function"!=typeof/./&&"object"!=typeof Int8Array&&(m.isFunction=function(n){return"function"==typeof n||!1}),m.isFinite=function(n){return isFinite(n)&&!isNaN(parseFloat(n))},m.isNaN=function(n){return m.isNumber(n)&&n!==+n},m.isBoolean=function(n){return n===!0||n===!1||"[object Boolean]"===f.call(n)},m.isNull=function(n){return null===n},m.isUndefined=function(n){return n===void 0},m.has=function(n,t){return null!=n&&s.call(n,t)},m.noConflict=function(){return e._=u,this},m.identity=function(n){return n},m.constant=function(n){return function(){return n}},m.noop=function(){},m.property=function(n){return function(t){return null==t?void 0:t[n]}},m.propertyOf=function(n){return null==n?function(){}:function(t){return n[t]}},m.matcher=m.matches=function(n){return n=m.extendOwn({},n),function(t){return m.isMatch(t,n)}},m.times=function(n,t,r){var e=Array(Math.max(0,n));t=d(t,r,1);for(var u=0;n>u;u++)e[u]=t(u);return e},m.random=function(n,t){return null==t&&(t=n,n=0),n+Math.floor(Math.random()*(t-n+1))},m.now=Date.now||function(){return(new Date).getTime()};var M={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},N=m.invert(M),I=function(n){var t=function(t){return n[t]},r="(?:"+m.keys(n).join("|")+")",e=RegExp(r),u=RegExp(r,"g");return function(n){return n=null==n?"":""+n,e.test(n)?n.replace(u,t):n}};m.escape=I(M),m.unescape=I(N),m.result=function(n,t,r){var e=null==n?void 0:n[t];return e===void 0&&(e=r),m.isFunction(e)?e.call(n):e};var B=0;m.uniqueId=function(n){var t=++B+"";return n?n+t:t},m.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var T=/(.)^/,R={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},q=/\\|'|\r|\n|\u2028|\u2029/g,K=function(n){return"\\"+R[n]};m.template=function(n,t,r){!t&&r&&(t=r),t=m.defaults({},t,m.templateSettings);var e=RegExp([(t.escape||T).source,(t.interpolate||T).source,(t.evaluate||T).source].join("|")+"|$","g"),u=0,i="__p+='";n.replace(e,function(t,r,e,o,a){return i+=n.slice(u,a).replace(q,K),u=a+t.length,r?i+="'+\n((__t=("+r+"))==null?'':_.escape(__t))+\n'":e?i+="'+\n((__t=("+e+"))==null?'':__t)+\n'":o&&(i+="';\n"+o+"\n__p+='"),t}),i+="';\n",t.variable||(i="with(obj||{}){\n"+i+"}\n"),i="var __t,__p='',__j=Array.prototype.join,"+"print=function(){__p+=__j.call(arguments,'');};\n"+i+"return __p;\n";try{var o=new Function(t.variable||"obj","_",i)}catch(a){throw a.source=i,a}var c=function(n){return o.call(this,n,m)},l=t.variable||"obj";return c.source="function("+l+"){\n"+i+"}",c},m.chain=function(n){var t=m(n);return t._chain=!0,t};var z=function(n,t){return n._chain?m(t).chain():t};m.mixin=function(n){m.each(m.functions(n),function(t){var r=m[t]=n[t];m.prototype[t]=function(){var n=[this._wrapped];return c.apply(n,arguments),z(this,r.apply(m,n))}})},m.mixin(m),m.each(["pop","push","reverse","shift","sort","splice","unshift"],function(n){var t=i[n];m.prototype[n]=function(){var r=this._wrapped;return t.apply(r,arguments),"shift"!==n&&"splice"!==n||0!==r.length||delete r[0],z(this,r)}}),m.each(["concat","join","slice"],function(n){var t=i[n];m.prototype[n]=function(){return z(this,t.apply(this._wrapped,arguments))}}),m.prototype.value=function(){return this._wrapped},m.prototype.valueOf=m.prototype.toJSON=m.prototype.value,m.prototype.toString=function(){return""+this._wrapped},"function"==typeof define&&define.amd&&define("underscore",[],function(){return m})}).call(this);
skin/adminhtml/default/default/unbxd/js/main.js ADDED
@@ -0,0 +1,253 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+
3
+ //using global jquery as requirejs module
4
+ define('jquery', [], function() {
5
+ return jQuery.noConflict();
6
+ });
7
+
8
+
9
+ requirejs.config({
10
+ baseUrl: window._unbxdSkinurl + 'unbxd/js/lib',
11
+ paths: {
12
+ app: '../app'
13
+ },
14
+ });
15
+
16
+ // Start the main app logic.
17
+ requirejs([
18
+ 'jquery',
19
+ 'ractive',
20
+ 'chosen',
21
+ 'ractive-chosen',
22
+ 'bootstrap-tooltip',
23
+ 'app/credentails',
24
+ 'app/catalog',
25
+ 'app/analytics',
26
+ 'app/widgets',
27
+ 'app/utils'],
28
+ function (
29
+ $,
30
+ Ractive,
31
+ Chosen,
32
+ RC,
33
+ BC,
34
+ Credentails,
35
+ Catalog,
36
+ Analytics,
37
+ Widgets,
38
+ Utils) {
39
+
40
+
41
+ var baseUrl = _unbxdSkinurl +'unbxd/templates/';
42
+ site = "",
43
+ ractiveParent = {},
44
+ _unbxdObject = {
45
+ step1 : false,
46
+ step2 : false,
47
+ step3 : false,
48
+ step4 : false,
49
+ activeStep:{
50
+ one:true
51
+ },
52
+ originalMapping:[],
53
+ _unbxdSkinurl:_unbxdSkinurl,
54
+ siteName : site,
55
+ ractiveAnalytics:{}
56
+ },
57
+ unbxdMessages = {
58
+ authSuccess:"The Unbxd Module has been authenticated. Proceed to Catalog Configuration",
59
+ uploadSuccess:"Uploaded Catalog Data successfully. Proceed to Analytics integration"
60
+ },
61
+ unbxdDimensions = [
62
+ {
63
+ "value": "brand",
64
+ "helpText": "The brand to which a product belongs to"
65
+ },
66
+ {
67
+ "value": "imageUrl",
68
+ "helpText": "Thumbnail - the URL of the image of a product that needs to be displayed in the recommendation widget, normally the thumnail"
69
+ },
70
+ {
71
+ "value": "title",
72
+ "helpText": "The title or name of the product e.g 'Blue Nike Shoe' "
73
+ },
74
+ {
75
+ "value": "price",
76
+ "helpText": "The display price of the product e.g $499"
77
+ },
78
+ {
79
+ "value": "color",
80
+ "helpText": "The color of the product e.g. 'Green t-shirt' "
81
+ },
82
+ {
83
+ "value": "productUrl",
84
+ "helpText": "The material the product is made of e.g. 'Cotton trousers' "
85
+ },
86
+ {
87
+ "value": "sellingPrice",
88
+ "helpText": "The display price of the product e.g $499"
89
+ },
90
+ {
91
+ "value": "size",
92
+ "helpText": "The size of the product e.g. 'Size 10' shoes"
93
+ }
94
+ ];
95
+
96
+
97
+
98
+ var loadMain = function(){
99
+
100
+ var $result = $.get( _unbxdBaseurl + 'unbxd/config/site');
101
+ $result.then(function( data ){
102
+
103
+ ractiveParent = new Ractive({
104
+ el: 'container',
105
+ template: '#template',
106
+ data: { sites: ['a', 'b'],
107
+ site:data.sites[0].name,
108
+ _unbxdObject:_unbxdObject
109
+ }
110
+ });
111
+
112
+ ractiveParent.observe('site', function(newValue, oldValue, keypath, s) {
113
+ if( !oldValue)
114
+ return;
115
+
116
+ _unbxdObject.catalogData = null;
117
+ _unbxdObject.originalMapping = [];
118
+ _unbxdObject.secretKey = "";
119
+ _unbxdObject.siteKey = "";
120
+ _unbxdObject.step1 = false;
121
+ Utils.activateLink( "one" );
122
+ Credentails.loadCredentailsTab( _unbxdObject );
123
+ clearInterval( _unbxdObject.pollingId );
124
+
125
+ });
126
+
127
+
128
+ ractiveParent.on({
129
+
130
+ showCredentials: function ( event ) {
131
+ Utils.activateLink( "one" );
132
+ Credentails.loadCredentailsTab( _unbxdObject );
133
+ clearInterval( _unbxdObject.pollingId );
134
+ },
135
+
136
+ showCatalog:function( event ){
137
+ Utils.activateLink( "two" );
138
+ Catalog.loadCatalogTab( _unbxdObject );
139
+ clearInterval( _unbxdObject.pollingId );
140
+ },
141
+
142
+ showAnalytics:function( event ){
143
+ Utils.activateLink( "three" );
144
+ Analytics.loadAnalyticsTab( _unbxdObject );
145
+ },
146
+
147
+ showWidgets:function( event ){
148
+ Utils.activateLink( "four" );
149
+ Widgets.loadWidgetsTab( _unbxdObject );
150
+ clearInterval( _unbxdObject.pollingId );
151
+ }
152
+
153
+ });
154
+
155
+ site = data.sites[0].name;
156
+ ractiveParent.set('sites', data.sites);
157
+ data = data.sites[0];
158
+ if(data.numDocs && data.numDocs > 0){
159
+ _unbxdObject.step2 = true;
160
+ _unbxdObject.products = site.numDocs
161
+ }
162
+
163
+ Credentails.loadCredentailsTab( _unbxdObject );
164
+ Utils.updateAllSelect();
165
+
166
+
167
+ })
168
+ }//load main
169
+
170
+ $.get( baseUrl + 'credentails.html')
171
+ .then(function( template ){
172
+ $('#tab1Template').text( template );
173
+ //load tab2
174
+ $.get( baseUrl + 'catalog.html')
175
+ .then(function( template ){
176
+ $('#tab2Template').text( template );
177
+ //load tab3
178
+ $.get( baseUrl + 'analytics.html')
179
+ .then(function( template ){
180
+ $('#tab3Template').text( template );
181
+ //load tab4
182
+ $.get( baseUrl + 'widgets.html')
183
+ .then(function( template ){
184
+ $('#tab4Template').text( template );
185
+ //load row
186
+ $.get( baseUrl + 'custom.html')
187
+ .then(function( template ){
188
+ $('#rowTemplate').text( template );
189
+ loadMain();
190
+ })
191
+ });
192
+ });
193
+ });
194
+ });
195
+
196
+
197
+
198
+
199
+
200
+ Ractive.decorators.chosen.type.site = function (node) {
201
+ return {
202
+ disable_search_threshold:5
203
+ }
204
+ };
205
+
206
+
207
+ });
208
+
209
+
210
+ Array.prototype.map = function(callback, thisArg) {
211
+
212
+ var T, A, k;
213
+
214
+ if (this == null) {
215
+ throw new TypeError(" this is null or not defined");
216
+ }
217
+
218
+ var O = Object(this);
219
+ var len = O.length >>> 0;
220
+
221
+ if (typeof callback !== "function") {
222
+ throw new TypeError(callback + " is not a function");
223
+ }
224
+
225
+ if (arguments.length > 1) {
226
+ T = thisArg;
227
+ }
228
+
229
+ A = new Array(len);
230
+ k = 0;
231
+ while (k < len) {
232
+ var kValue, mappedValue;
233
+ if (k in O) {
234
+ kValue = O[k];
235
+ mappedValue = callback.call(T, kValue, k, O);
236
+ A[k] = mappedValue;
237
+ }
238
+ k++;
239
+ }
240
+
241
+ return A;
242
+ };
243
+
244
+
245
+
246
+
247
+
248
+
249
+
250
+
251
+
252
+
253
+