Simtech_Searchanise - Version 1.1.0

Version Notes

[+] Magento Community 1.5 is now supported.

[!] Grouped, configurable, and bundle product support improved.

[!] Fixed an error that would occur on Magento re-indexation.

Download this release

Release Info

Developer Simbirsk Technologies, Ltd.
Extension Simtech_Searchanise
Version 1.1.0
Comparing to
See all releases


Code changes from version 1.0.8 to 1.1.0

Files changed (23) hide show
  1. app/code/community/Simtech/Searchanise/Block/Async.php +0 -1
  2. app/code/community/Simtech/Searchanise/Block/Product/Result.php +2 -2
  3. app/code/community/Simtech/Searchanise/Helper/ApiSe.php +12 -13
  4. app/code/community/Simtech/Searchanise/Helper/ApiXML.php +157 -127
  5. app/code/community/Simtech/Searchanise/Model/LayerCatalogSearch.php +1 -1
  6. app/code/community/Simtech/Searchanise/Model/Mysql4/Advanced/Collection.php +104 -0
  7. app/code/community/Simtech/Searchanise/Model/Mysql4/Fulltext/Collection.php +104 -0
  8. app/code/community/Simtech/Searchanise/Model/Mysql4/Product/Collection.php +104 -0
  9. app/code/community/Simtech/Searchanise/Model/Mysql4/Product/CollectionTag.php +104 -0
  10. app/code/community/Simtech/Searchanise/Model/Mysql4/Store.php +62 -0
  11. app/code/community/Simtech/Searchanise/Model/Observer.php +34 -1
  12. app/code/community/Simtech/Searchanise/Model/Request.php +13 -1
  13. app/code/community/Simtech/Searchanise/Model/Resource/Advanced/Collection.php +47 -58
  14. app/code/community/Simtech/Searchanise/Model/Resource/Eav/Mysql4/Product/Action.php +38 -0
  15. app/code/community/Simtech/Searchanise/Model/Resource/Fulltext/Collection.php +47 -57
  16. app/code/community/Simtech/Searchanise/Model/Resource/Product/Collection.php +50 -52
  17. app/code/community/Simtech/Searchanise/Model/Resource/Product/CollectionTag.php +56 -29
  18. app/code/community/Simtech/Searchanise/Model/Resource/Store.php +1 -0
  19. app/code/community/Simtech/Searchanise/Model/Searchanise.php +140 -0
  20. app/code/community/Simtech/Searchanise/controllers/AsyncController.php +8 -3
  21. app/code/community/Simtech/Searchanise/controllers/InfoController.php +7 -1
  22. app/code/community/Simtech/Searchanise/etc/config.xml +64 -5
  23. package.xml +7 -6
app/code/community/Simtech/Searchanise/Block/Async.php CHANGED
@@ -41,7 +41,6 @@ class Simtech_Searchanise_Block_Async extends Mage_Core_Block_Text
41
 
42
  if (Mage::helper('searchanise/ApiSe')->checkAjaxAsync()) {
43
  $asyncUrl = Mage::helper('searchanise/ApiSe')->getAsyncUrl(false);
44
-
45
  $html .= "\n<object data=\"$asyncUrl\" width=\"0\" height=\"0\"></object>\n";
46
 
47
  // code for ajax async
41
 
42
  if (Mage::helper('searchanise/ApiSe')->checkAjaxAsync()) {
43
  $asyncUrl = Mage::helper('searchanise/ApiSe')->getAsyncUrl(false);
 
44
  $html .= "\n<object data=\"$asyncUrl\" width=\"0\" height=\"0\"></object>\n";
45
 
46
  // code for ajax async
app/code/community/Simtech/Searchanise/Block/Product/Result.php CHANGED
@@ -19,7 +19,7 @@ class Simtech_Searchanise_Block_Product_Result extends Mage_Tag_Block_Product_Re
19
  if (!Mage::helper('searchanise/ApiSe')->checkSearchaniseResult(true)) {
20
  return parent::_getProductCollection();
21
  }
22
-
23
  if (is_null($this->_productCollection)) {
24
  $tagModel = Mage::getModel('tag/tag');
25
  $collection = $tagModel->getEntityCollection();
@@ -41,7 +41,7 @@ class Simtech_Searchanise_Block_Product_Result extends Mage_Tag_Block_Product_Re
41
  ->addMinimalPrice()
42
  ->addUrlRewrite()
43
  ->setActiveFilter();
44
-
45
  Mage::getSingleton('catalog/product_status')->addSaleableFilterToCollection($this->_productCollection);
46
  Mage::getSingleton('catalog/product_visibility')->addVisibleInSiteFilterToCollection($this->_productCollection);
47
  }
19
  if (!Mage::helper('searchanise/ApiSe')->checkSearchaniseResult(true)) {
20
  return parent::_getProductCollection();
21
  }
22
+
23
  if (is_null($this->_productCollection)) {
24
  $tagModel = Mage::getModel('tag/tag');
25
  $collection = $tagModel->getEntityCollection();
41
  ->addMinimalPrice()
42
  ->addUrlRewrite()
43
  ->setActiveFilter();
44
+
45
  Mage::getSingleton('catalog/product_status')->addSaleableFilterToCollection($this->_productCollection);
46
  Mage::getSingleton('catalog/product_visibility')->addVisibleInSiteFilterToCollection($this->_productCollection);
47
  }
app/code/community/Simtech/Searchanise/Helper/ApiSe.php CHANGED
@@ -16,7 +16,6 @@ class Simtech_Searchanise_Helper_ApiSe
16
  const COMPRESS_RATE = 5;
17
 
18
  const PLATFORM_NAME = 'magento';
19
- const PLATFORM_VERSION = '1.2';
20
 
21
  const CONFIG_PREFIX = 'se_';
22
 
@@ -377,7 +376,7 @@ class Simtech_Searchanise_Helper_ApiSe
377
  $symbol = str_replace('%s', '', $format['pattern']);
378
  }
379
 
380
- $ret = array (
381
  'rate' => $store->getCurrentCurrencyRate(),
382
  'decimals' => $format['precision'],
383
  'decimals_separator' => $format['decimalSymbol'],
@@ -405,7 +404,7 @@ class Simtech_Searchanise_Helper_ApiSe
405
 
406
  $date = Mage::app()->getLocale()->date($timestamp, null, null);
407
 
408
- return Varien_Date::formatDate($date, $format, $showTime);
409
  }
410
 
411
  public static function getAddonOptions($store = null)
@@ -421,15 +420,15 @@ class Simtech_Searchanise_Helper_ApiSe
421
 
422
  $ret['addon_status'] = self::getStatusModule() == 'Y' ? 'enabled' : 'disabled';
423
 
424
- $ret['addon_version'] = self::getVersion();
425
  $ret['core_version'] = Mage::getVersion();
426
 
427
  return $ret;
428
  }
429
 
430
- public static function getVersion()
431
  {
432
- return self::getSetting('version');
433
  }
434
 
435
  public static function getSearchTimeout()
@@ -508,7 +507,7 @@ class Simtech_Searchanise_Helper_ApiSe
508
 
509
  if (!empty($curStores)) {
510
  if (!is_array($curStores)) {
511
- $stores = array (
512
  0 => $curStores,
513
  );
514
  } else {
@@ -650,7 +649,7 @@ class Simtech_Searchanise_Helper_ApiSe
650
  $priceTo = '';
651
 
652
  if (is_array($dataPrice)) {
653
- // example Array ( [from] => 0 [to] => 33 )
654
  if (!empty($dataPrice)) {
655
  if ($dataPrice['from'] != '') {
656
  $priceFrom = trim($dataPrice['from']);
@@ -661,7 +660,7 @@ class Simtech_Searchanise_Helper_ApiSe
661
  }
662
  } elseif ($dataPrice != '') {
663
  if (strpos($dataPrice, '-') === false) {
664
- // for 1.6.X versions
665
  $arrPrice = explode(',', $dataPrice);
666
 
667
  if (is_array($arrPrice) && (count($arrPrice) >= 2)) {
@@ -669,13 +668,13 @@ class Simtech_Searchanise_Helper_ApiSe
669
  next($arrPrice);
670
  $step = (int) current($arrPrice);
671
 
672
- if ($number_range > 1) {
673
  $priceFrom = ($numberRange - 1) * $step;
674
  }
675
  $priceTo = $numberRange * $step;
676
  }
677
  } else {
678
- // For version 1.7.X versions
679
  $arrPrice = explode('-', $dataPrice);
680
  if (is_array($arrPrice) && (count($arrPrice) >= 2)) {
681
  $priceFrom = (int) reset($arrPrice);
@@ -1001,7 +1000,7 @@ class Simtech_Searchanise_Helper_ApiSe
1001
  array(
1002
  'url' => $url,
1003
  'email' => $email,
1004
- 'version' => self::PLATFORM_VERSION,
1005
  'platform' => self::PLATFORM_NAME,
1006
  'parent_private_key' => $parentPrivateKey,
1007
  ),
@@ -1285,7 +1284,7 @@ class Simtech_Searchanise_Helper_ApiSe
1285
  $_product_ids = array_chunk($_product_ids, self::getProductsPerPass());
1286
 
1287
  foreach ($_product_ids as $product_ids) {
1288
- $sqls_arr[] = array (
1289
  'data' => serialize($product_ids),
1290
  'action' => Simtech_Searchanise_Model_Queue::ACT_UPDATE,
1291
  'store_id' => $store->getId(),
16
  const COMPRESS_RATE = 5;
17
 
18
  const PLATFORM_NAME = 'magento';
 
19
 
20
  const CONFIG_PREFIX = 'se_';
21
 
376
  $symbol = str_replace('%s', '', $format['pattern']);
377
  }
378
 
379
+ $ret = array(
380
  'rate' => $store->getCurrentCurrencyRate(),
381
  'decimals' => $format['precision'],
382
  'decimals_separator' => $format['decimalSymbol'],
404
 
405
  $date = Mage::app()->getLocale()->date($timestamp, null, null);
406
 
407
+ return Mage::helper('core')->formatDate($date, $format, $showTime);
408
  }
409
 
410
  public static function getAddonOptions($store = null)
420
 
421
  $ret['addon_status'] = self::getStatusModule() == 'Y' ? 'enabled' : 'disabled';
422
 
423
+ $ret['addon_version'] = (string) Mage::getConfig()->getModuleConfig("Simtech_Searchanise")->version;
424
  $ret['core_version'] = Mage::getVersion();
425
 
426
  return $ret;
427
  }
428
 
429
+ public static function getServerVersion()
430
  {
431
+ return self::getSetting('server_version');
432
  }
433
 
434
  public static function getSearchTimeout()
507
 
508
  if (!empty($curStores)) {
509
  if (!is_array($curStores)) {
510
+ $stores = array(
511
  0 => $curStores,
512
  );
513
  } else {
649
  $priceTo = '';
650
 
651
  if (is_array($dataPrice)) {
652
+ // example array( [from] => 0 [to] => 33 )
653
  if (!empty($dataPrice)) {
654
  if ($dataPrice['from'] != '') {
655
  $priceFrom = trim($dataPrice['from']);
660
  }
661
  } elseif ($dataPrice != '') {
662
  if (strpos($dataPrice, '-') === false) {
663
+ // [v1.5] [v1.6]
664
  $arrPrice = explode(',', $dataPrice);
665
 
666
  if (is_array($arrPrice) && (count($arrPrice) >= 2)) {
668
  next($arrPrice);
669
  $step = (int) current($arrPrice);
670
 
671
+ if ($numberRange > 1) {
672
  $priceFrom = ($numberRange - 1) * $step;
673
  }
674
  $priceTo = $numberRange * $step;
675
  }
676
  } else {
677
+ // [v1.7]
678
  $arrPrice = explode('-', $dataPrice);
679
  if (is_array($arrPrice) && (count($arrPrice) >= 2)) {
680
  $priceFrom = (int) reset($arrPrice);
1000
  array(
1001
  'url' => $url,
1002
  'email' => $email,
1003
+ 'version' => self::getServerVersion(),
1004
  'platform' => self::PLATFORM_NAME,
1005
  'parent_private_key' => $parentPrivateKey,
1006
  ),
1284
  $_product_ids = array_chunk($_product_ids, self::getProductsPerPass());
1285
 
1286
  foreach ($_product_ids as $product_ids) {
1287
+ $sqls_arr[] = array(
1288
  'data' => serialize($product_ids),
1289
  'action' => Simtech_Searchanise_Model_Queue::ACT_UPDATE,
1290
  'store_id' => $store->getId(),
app/code/community/Simtech/Searchanise/Helper/ApiXML.php CHANGED
@@ -102,7 +102,135 @@ class Simtech_Searchanise_Helper_ApiXML extends Mage_Core_Helper_Data
102
 
103
  return $imageLink;
104
  }
105
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
106
  public static function generateProductXML($product, $store = null)
107
  {
108
  $entry = '<entry>' . self::XML_END_LINE;
@@ -122,37 +250,22 @@ class Simtech_Searchanise_Helper_ApiXML extends Mage_Core_Helper_Data
122
  $entry .= '<link href="' . $productUrl . '" />' . self::XML_END_LINE;
123
 
124
  // fixme in the future
125
- // maybe exist simple solution get customerGroupPrices
126
  $customerGroups = Mage::getModel('customer/group')->getCollection()->load();
127
  $defaultPrice = '';
128
 
129
  if ($customerGroups) {
130
- if (($product->getData('type_id') == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE) ||
131
- ($product->getData('type_id') == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE)) {
132
- $productsCustomerGroup = self::getProduct($product->getId(), $store, true);
133
- if ($productsCustomerGroup) {
134
- foreach ($productsCustomerGroup as $productCustomerGroup) {
135
- $defaultPrice = $productCustomerGroup->getData('min_price');
136
- break;
137
- }
138
- }
139
- }
140
-
141
  foreach ($customerGroups as $kCostomerGroup => $customerGroup) {
142
  $price = '';
143
- $minPrice = '';
144
 
145
- if (($product->getData('type_id') == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE) ||
146
- ($product->getData('type_id') == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE)) {
147
- $price = $defaultPrice;
148
- } else {
149
- $productsCustomerGroup = self::getProduct($product->getId(), $store, false, $customerGroup->getId());
150
- if ($productsCustomerGroup) {
151
- foreach ($productsCustomerGroup as $productCustomerGroup) {
152
- $price = $productCustomerGroup->getFinalPrice();
153
- break;
154
- }
155
  }
 
 
156
  }
157
 
158
  if ($price != '') {
@@ -161,7 +274,7 @@ class Simtech_Searchanise_Helper_ApiXML extends Mage_Core_Helper_Data
161
 
162
  if ($customerGroup->getId() == Mage_Customer_Model_Group::NOT_LOGGED_IN_ID) {
163
  $entry .= '<cs:price>' . $price . '</cs:price>'. self::XML_END_LINE;
164
- $defaultPrice = $price;
165
  }
166
  $label_ = Mage::helper('searchanise/ApiSe')->getLabelForPricesUsergroup() . $customerGroup->getId();
167
  $entry .= '<cs:attribute name="' . $label_ . '" type="float">' . $price . '</cs:attribute>' . self::XML_END_LINE;
@@ -169,30 +282,11 @@ class Simtech_Searchanise_Helper_ApiXML extends Mage_Core_Helper_Data
169
  }
170
 
171
  $entry .= '<cs:product_code><![CDATA[' . $product->getSku() . ']]></cs:product_code>' . self::XML_END_LINE;
 
172
  // <quantity>
173
  {
174
- $quantity = 1;
175
- $stockItem = self::getStockItem($product);
176
- if ($stockItem) {
177
- $manageStock = null;
178
- if ($stockItem->getData('use_config_manage_stock')) {
179
- $manageStock = Mage::getStoreConfig(Mage_CatalogInventory_Model_Stock_Item::XML_PATH_MANAGE_STOCK);
180
- } else {
181
- $manageStock = $stockItem->getData('manage_stock');
182
- }
183
 
184
- if (!$manageStock) {
185
- $quantity = 1;
186
- } else {
187
- $isInStock = $stockItem->getIsInStock();
188
- if (!empty($isInStock)) {
189
- $quantity = $stockItem->getQty();
190
- } else {
191
- $quantity = 0;
192
- }
193
- }
194
- }
195
-
196
  $entry .= '<cs:quantity>' . ceil($quantity) . '</cs:quantity>' . self::XML_END_LINE;
197
  $entry .= '<cs:attribute name="is_in_stock" type="text">' . ($quantity > 0) . '</cs:attribute>' . self::XML_END_LINE;
198
  $quantity = round($quantity, Mage::helper('searchanise/ApiSe')->getFloatPrecision());
@@ -425,90 +519,47 @@ class Simtech_Searchanise_Helper_ApiXML extends Mage_Core_Helper_Data
425
  return $entry;
426
  }
427
 
428
- private static function getProduct($productIds = null, $store = null, $flAddMinimalPrice = true, $customerGroupId = null)
429
  {
 
 
430
  $products = Mage::getModel('catalog/product')
431
  ->getCollection()
432
- ->addAttributeToSelect('*');
433
-
434
- if (!empty($store)) {
435
- $products
436
- ->setStoreId($store)
437
- ->addStoreFilter($store);
438
- } else {
439
- $products->setStoreId(Mage::app()->getStores());
440
- }
441
-
442
- if (!empty($productIds)) {
443
- if (is_array($productIds)) {
444
- $products->addFieldToFilter('entity_id', array('in' => $productIds));
445
- } else {
446
- $products->addFieldToFilter('entity_id', array('eq' => $productIds));
447
- }
448
- }
449
 
450
- if ($flAddMinimalPrice == true) {
451
- $products->addMinimalPrice($customerGroupId);
452
- }
453
-
454
- if ($customerGroupId) {
455
  if ($store) {
456
  $products->addPriceData($customerGroupId, $store->getWebsiteId());
457
  } else {
458
  $products->addPriceData($customerGroupId);
459
  }
460
  }
461
-
462
- $products
463
- ->addUrlRewrite()
464
- ->load();
465
-
466
- return $products;
467
- }
468
-
469
- private static function getProducts($productIds = null, $store = null, $flAddMinimalPrice = false, $customerGroupId = null)
470
- {
471
- $products = Mage::getModel('catalog/product')
472
- ->getCollection()
473
- ->addAttributeToSelect('*');
474
 
475
  if (!empty($store)) {
476
  $products
477
  ->setStoreId($store)
478
  ->addStoreFilter($store);
479
  } else {
480
- $products->setStoreId(Mage::app()->getStores());
481
  }
482
 
483
  if (!empty($productIds)) {
484
- if (is_array($productIds)) {
485
- $products->addFieldToFilter('entity_id', array('in' => $productIds));
486
- } else {
487
- $products->addFieldToFilter('entity_id', array('eq' => $productIds));
488
- }
489
  }
490
 
491
- if ($flAddMinimalPrice == true) {
492
  $products->addMinimalPrice();
493
  }
494
 
495
- if ($customerGroupId) {
496
- if (!$store) {
497
- $products->addPriceData($customerGroupId, $store->getWebsiteId());
498
- } else {
499
- $products->addPriceData($customerGroupId);
500
- }
501
- }
502
 
503
- $products
504
- ->addUrlRewrite()
505
- ->load();
506
-
507
  return $products;
508
  }
509
 
510
  // Main functions //
511
- public static function generateProductsXML($productIds = null, $store = null, $flAddMinimalPrice = false)
512
  {
513
  if ($store) {
514
  // need for generate correct url
@@ -516,12 +567,13 @@ class Simtech_Searchanise_Helper_ApiXML extends Mage_Core_Helper_Data
516
  }
517
  $ret = '';
518
 
519
- $products = self::getProducts($productIds, $store, $flAddMinimalPrice);
520
  $arrProduct = $products->toArray();
521
 
 
522
  // additional check for products without minimal price
523
- // deprecated, because use only $flAddMinimalPrice = false in current module
524
- if ($flAddMinimalPrice === true) {
525
  if ((empty($arrProduct)) || (count($arrProduct) == 0)) {
526
  return self::generateProductsXML($productIds, $store, false);
527
  }
@@ -545,6 +597,7 @@ class Simtech_Searchanise_Helper_ApiXML extends Mage_Core_Helper_Data
545
  }
546
  }
547
  }
 
548
 
549
  if ((!empty($arrProduct)) && (count($arrProduct) != 0)) {
550
  foreach ($products as $product) {
@@ -610,29 +663,6 @@ class Simtech_Searchanise_Helper_ApiXML extends Mage_Core_Helper_Data
610
  $entry .= '</entry>' . self::XML_END_LINE;
611
 
612
  return $entry;
613
-
614
- // deprecated, because use "union"
615
- $customerGroups = Mage::getModel('customer/group')->getCollection()->load();
616
- if ($customerGroups) {
617
- foreach ($customerGroups as $kCostomerGroup => $customerGroup) {
618
- $entry .= '<entry>' . self::XML_END_LINE;
619
- $entry .= '<title><![CDATA[Price (' . $customerGroup->getId() . ')]]></title>' . self::XML_END_LINE;
620
- // not set
621
- // $entry .= '<cs:position>' . 0 . '</cs:position>' . self::XML_END_LINE;
622
- $label_ = Mage::helper('searchanise/ApiSe')->getLabelForPricesUsergroup() . $customerGroup->getId();
623
- $entry .= '<cs:attribute>' . $label_ . '</cs:attribute>' . self::XML_END_LINE;
624
-
625
- $entry .= '<cs:type>dynamic</cs:type>' . self::XML_END_LINE;
626
-
627
- if (!empty($step)) {
628
- $entry .= '<cs:min_range>' . $step . '</cs:min_range>' . self::XML_END_LINE;
629
- }
630
-
631
- $entry .= '</entry>' . self::XML_END_LINE;
632
- }
633
- }
634
-
635
- return $entry;
636
  }
637
 
638
  public static function generateFacetXMLTags()
102
 
103
  return $imageLink;
104
  }
105
+
106
+ /**
107
+ * getProductQty
108
+ *
109
+ * @param Mage_Catalog_Model_Product $product
110
+ * @param Mage_Core_Model_Store $store
111
+ * @param bool $flagWithChildrenProducts
112
+ * @return float
113
+ */
114
+ private static function getProductQty($product, $store, $flagWithChildrenProducts = true)
115
+ {
116
+ $quantity = 1;
117
+
118
+ $stockItem = self::getStockItem($product);
119
+ if ($stockItem) {
120
+ $manageStock = null;
121
+ if ($stockItem->getData('use_config_manage_stock')) {
122
+ $manageStock = Mage::getStoreConfig(Mage_CatalogInventory_Model_Stock_Item::XML_PATH_MANAGE_STOCK);
123
+ } else {
124
+ $manageStock = $stockItem->getData('manage_stock');
125
+ }
126
+
127
+ if (!$manageStock) {
128
+ $quantity = 1;
129
+ } else {
130
+ $isInStock = $stockItem->getIsInStock();
131
+
132
+ if (empty($isInStock)) {
133
+ $quantity = 0;
134
+ } else {
135
+ $quantity = $stockItem->getQty();
136
+
137
+ if ($flagWithChildrenProducts) {
138
+ // if CONFIGURABLE OR GROUPED OR BUNDLE
139
+ if (($product->getData('type_id') == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE) ||
140
+ ($product->isSuper())) {
141
+ $quantity = 1;
142
+
143
+ // fixme in the future
144
+ // maybe exist simple solution get `quantity` for TYPE_BUNDLE or TYPE_CONFIGURABLE product
145
+ if ($typeInstance = $product->getTypeInstance()) {
146
+ $requiredChildrenIds = $typeInstance->getChildrenIds($product->getId(), true);
147
+ if ($requiredChildrenIds) {
148
+ $quantity = 0;
149
+ $childrenIds = array();
150
+ foreach ($requiredChildrenIds as $groupedChildrenIds) {
151
+ $childrenIds = array_merge($childrenIds, $groupedChildrenIds);
152
+ }
153
+
154
+ $childrenProducts = self::getProducts($childrenIds, $store);
155
+
156
+ if ($childrenProducts) {
157
+ foreach ($childrenProducts as $childrenProductsKey => $childrenProduct) {
158
+ if ($childrenProduct) {
159
+ $quantity += self::getProductQty($childrenProduct, $store, false);
160
+ }
161
+ }
162
+ }
163
+ }
164
+ }
165
+ // end fixme
166
+ }
167
+ }
168
+ }
169
+ }
170
+ }
171
+
172
+ return $quantity;
173
+ }
174
+
175
+ /**
176
+ * getProductMinimalPrice
177
+ *
178
+ * @param Mage_Catalog_Model_Product $product
179
+ * @param Mage_Core_Model_Store $store
180
+ * @param bool $flagWithChildrenProducts
181
+ * @return float
182
+ */
183
+ private static function getProductMinimalPrice($product, $store, $flagWithChildrenProducts = true, $customerGroupId = null)
184
+ {
185
+ $minimalPrice = $product->getMinimalPrice();
186
+
187
+ if ($minimalPrice == '') {
188
+ $minimalPrice = $product->getFinalPrice();
189
+ }
190
+
191
+ if ($product->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE) {
192
+ $_priceModel = $product->getPriceModel();
193
+ if ($_priceModel) {
194
+ $minimalPrice = $_priceModel->getTotalPrices($product, 'min', null, false);
195
+ }
196
+
197
+ } elseif ($flagWithChildrenProducts) {
198
+ if ($product->isGrouped()) {
199
+ // fixme in the future
200
+ // maybe exist better solution get `minimalPrice` for `Grouped` product
201
+ if ($typeInstance = $product->getTypeInstance()) {
202
+ $requiredChildrenIds = $typeInstance->getChildrenIds($product->getId(), true);
203
+ if ($requiredChildrenIds) {
204
+ $childrenIds = array();
205
+ foreach ($requiredChildrenIds as $groupedChildrenIds) {
206
+ $childrenIds = array_merge($childrenIds, $groupedChildrenIds);
207
+ }
208
+
209
+ $childrenProducts = self::getProducts($childrenIds, $store, false, $customerGroupId);
210
+
211
+ if ($childrenProducts) {
212
+ $minimalPrice = '';
213
+
214
+ foreach ($childrenProducts as $childrenProductsKey => $childrenProduct) {
215
+ if ($childrenProduct) {
216
+ $minimalPriceChildren = self::getProductMinimalPrice($childrenProduct, $store, false, $customerGroupId);
217
+
218
+ if (($minimalPriceChildren < $minimalPrice) ||
219
+ ($minimalPrice == '')) {
220
+ $minimalPrice = $minimalPriceChildren;
221
+ }
222
+ }
223
+ }
224
+ }
225
+ }
226
+ }
227
+ // end fixme
228
+ }
229
+ }
230
+
231
+ return $minimalPrice;
232
+ }
233
+
234
  public static function generateProductXML($product, $store = null)
235
  {
236
  $entry = '<entry>' . self::XML_END_LINE;
250
  $entry .= '<link href="' . $productUrl . '" />' . self::XML_END_LINE;
251
 
252
  // fixme in the future
253
+ // maybe exist better solution get customerGroupPrices
254
  $customerGroups = Mage::getModel('customer/group')->getCollection()->load();
255
  $defaultPrice = '';
256
 
257
  if ($customerGroups) {
 
 
 
 
 
 
 
 
 
 
 
258
  foreach ($customerGroups as $kCostomerGroup => $customerGroup) {
259
  $price = '';
 
260
 
261
+ $productsCustomerGroup = self::getProducts($product->getId(), $store, false, $customerGroup->getId());
262
+ if (($productsCustomerGroup) && (count($productsCustomerGroup) > 0)) {
263
+ foreach ($productsCustomerGroup as $productCustomerGroup) {
264
+ $price = self::getProductMinimalPrice($productCustomerGroup, $store, true, $customerGroup->getId());
265
+ break;
 
 
 
 
 
266
  }
267
+ } else {
268
+ $price = self::getProductMinimalPrice($product, $store, true, $customerGroup->getId());
269
  }
270
 
271
  if ($price != '') {
274
 
275
  if ($customerGroup->getId() == Mage_Customer_Model_Group::NOT_LOGGED_IN_ID) {
276
  $entry .= '<cs:price>' . $price . '</cs:price>'. self::XML_END_LINE;
277
+ $defaultPrice = $price; // need in `<attributes>` with $inputType == 'price'
278
  }
279
  $label_ = Mage::helper('searchanise/ApiSe')->getLabelForPricesUsergroup() . $customerGroup->getId();
280
  $entry .= '<cs:attribute name="' . $label_ . '" type="float">' . $price . '</cs:attribute>' . self::XML_END_LINE;
282
  }
283
 
284
  $entry .= '<cs:product_code><![CDATA[' . $product->getSku() . ']]></cs:product_code>' . self::XML_END_LINE;
285
+
286
  // <quantity>
287
  {
288
+ $quantity = self::getProductQty($product, $store, true);
 
 
 
 
 
 
 
 
289
 
 
 
 
 
 
 
 
 
 
 
 
 
290
  $entry .= '<cs:quantity>' . ceil($quantity) . '</cs:quantity>' . self::XML_END_LINE;
291
  $entry .= '<cs:attribute name="is_in_stock" type="text">' . ($quantity > 0) . '</cs:attribute>' . self::XML_END_LINE;
292
  $quantity = round($quantity, Mage::helper('searchanise/ApiSe')->getFloatPrecision());
519
  return $entry;
520
  }
521
 
522
+ private static function getProducts($productIds = null, $store = null, $flagAddMinimalPrice = false, $customerGroupId = null)
523
  {
524
+ Mage::app("default")->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
525
+
526
  $products = Mage::getModel('catalog/product')
527
  ->getCollection()
528
+ ->addAttributeToSelect('*')
529
+ ->addUrlRewrite();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
530
 
531
+ if ($customerGroupId != null) {
 
 
 
 
532
  if ($store) {
533
  $products->addPriceData($customerGroupId, $store->getWebsiteId());
534
  } else {
535
  $products->addPriceData($customerGroupId);
536
  }
537
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
538
 
539
  if (!empty($store)) {
540
  $products
541
  ->setStoreId($store)
542
  ->addStoreFilter($store);
543
  } else {
544
+ // nothing
545
  }
546
 
547
  if (!empty($productIds)) {
548
+ // Already exist automatic definition 'one value' or 'array'.
549
+ $products->addIdFilter($productIds);
 
 
 
550
  }
551
 
552
+ if ($flagAddMinimalPrice == true) {
553
  $products->addMinimalPrice();
554
  }
555
 
556
+ $products->load();
 
 
 
 
 
 
557
 
 
 
 
 
558
  return $products;
559
  }
560
 
561
  // Main functions //
562
+ public static function generateProductsXML($productIds = null, $store = null, $flagAddMinimalPrice = false)
563
  {
564
  if ($store) {
565
  // need for generate correct url
567
  }
568
  $ret = '';
569
 
570
+ $products = self::getProducts($productIds, $store, $flagAddMinimalPrice);
571
  $arrProduct = $products->toArray();
572
 
573
+ // fixme, need delete
574
  // additional check for products without minimal price
575
+ // deprecated, because use only $flagAddMinimalPrice = false in current module
576
+ if ($flagAddMinimalPrice === true) {
577
  if ((empty($arrProduct)) || (count($arrProduct) == 0)) {
578
  return self::generateProductsXML($productIds, $store, false);
579
  }
597
  }
598
  }
599
  }
600
+ // end fixme
601
 
602
  if ((!empty($arrProduct)) && (count($arrProduct) != 0)) {
603
  foreach ($products as $product) {
663
  $entry .= '</entry>' . self::XML_END_LINE;
664
 
665
  return $entry;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
666
  }
667
 
668
  public static function generateFacetXMLTags()
app/code/community/Simtech/Searchanise/Model/LayerCatalogSearch.php CHANGED
@@ -17,7 +17,7 @@ class Simtech_Searchanise_Model_LayerCatalogSearch extends Mage_CatalogSearch_Mo
17
  /**
18
  * Prepare product collection
19
  *
20
- * @param Simtech_Searchanise_Model_Resource_Fulltext_Collection $collection
21
  * @return Mage_Catalog_Model_Layer
22
  */
23
  public function prepareProductCollection($collection)
17
  /**
18
  * Prepare product collection
19
  *
20
+ * @param Mage_Catalog_Model_Resource_Product_Collection [1.6] [1.7], Mage_Catalog_Model_Mysql4_Product_Collection [1.5] $collection
21
  * @return Mage_Catalog_Model_Layer
22
  */
23
  public function prepareProductCollection($collection)
app/code/community/Simtech/Searchanise/Model/Mysql4/Advanced/Collection.php ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /***************************************************************************
3
+ * *
4
+ * (c) 2004 Vladimir V. Kalynyak, Alexey V. Vinokurov, Ilya M. Shalnev *
5
+ * *
6
+ * This is commercial software, only users who have purchased a valid *
7
+ * license and accept to the terms of the License Agreement can install *
8
+ * and use this program. *
9
+ * *
10
+ ****************************************************************************
11
+ * PLEASE READ THE FULL TEXT OF THE SOFTWARE LICENSE AGREEMENT IN THE *
12
+ * "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE. *
13
+ ****************************************************************************/
14
+
15
+ // [v1.5]
16
+ class Simtech_Searchanise_Model_Mysql4_Advanced_Collection extends Mage_CatalogSearch_Model_Mysql4_Advanced_Collection
17
+ {
18
+ /**
19
+ * Searchanise Collection Product
20
+ *
21
+ * @var Simtech_Searchanise_Model_Searchanise
22
+ */
23
+ protected $_searchaniseCollection = null;
24
+
25
+ /**
26
+ * Initialize resource
27
+ * @return Simtech_Searchanise_Model_Mysql4_Product_CollectionSearhanise
28
+ */
29
+ protected function _construct()
30
+ {
31
+ parent::_construct();
32
+ $this->_searchaniseCollection = Mage::getModel('searchanise/searchanise');
33
+ $this->_searchaniseCollection->setCollection($this);
34
+ }
35
+
36
+ public function initSearchaniseRequest()
37
+ {
38
+ return $this->_searchaniseCollection->initSearchaniseRequest();
39
+ }
40
+
41
+ public function checkSearchaniseResult()
42
+ {
43
+ return $this->_searchaniseCollection->checkSearchaniseResult();
44
+ }
45
+
46
+ public function setSearchaniseRequest($request)
47
+ {
48
+ return $this->_searchaniseCollection->setSearchaniseRequest($request);
49
+ }
50
+
51
+ public function getSearchaniseRequest()
52
+ {
53
+ return $this->_searchaniseCollection->getSearchaniseRequest();
54
+ }
55
+
56
+ public function addSearchaniseFilter()
57
+ {
58
+ return $this->_searchaniseCollection->addSearchaniseFilter();
59
+ }
60
+
61
+ /**
62
+ * Set Order field
63
+ *
64
+ * @param string $attribute
65
+ * @param string $dir
66
+ * @return Mage_CatalogSearch_Model_Mysql4_Fulltext_Collection
67
+ */
68
+ public function setOrder($attribute, $dir = 'desc')
69
+ {
70
+ return $this->_searchaniseCollection->setOrder($attribute, $dir);
71
+ }
72
+
73
+ /**
74
+ * Set Order field
75
+ *
76
+ * @param string $attribute
77
+ * @param string $dir
78
+ * @return Mage_CatalogSearch_Model_Mysql4_Fulltext_Collection
79
+ */
80
+ public function setOrderParent($attribute, $dir = 'desc')
81
+ {
82
+ return parent::setOrder($attribute, $dir);
83
+ }
84
+
85
+ /**
86
+ * Retrieve collection last page number
87
+ *
88
+ * @return int
89
+ */
90
+ public function getLastPageNumber()
91
+ {
92
+ return $this->_searchaniseCollection->getLastPageNumber();
93
+ }
94
+
95
+ /**
96
+ * Retrieve collection last page number
97
+ *
98
+ * @return int
99
+ */
100
+ public function getLastPageNumberParent()
101
+ {
102
+ return parent::getLastPageNumber();
103
+ }
104
+ }
app/code/community/Simtech/Searchanise/Model/Mysql4/Fulltext/Collection.php ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /***************************************************************************
3
+ * *
4
+ * (c) 2004 Vladimir V. Kalynyak, Alexey V. Vinokurov, Ilya M. Shalnev *
5
+ * *
6
+ * This is commercial software, only users who have purchased a valid *
7
+ * license and accept to the terms of the License Agreement can install *
8
+ * and use this program. *
9
+ * *
10
+ ****************************************************************************
11
+ * PLEASE READ THE FULL TEXT OF THE SOFTWARE LICENSE AGREEMENT IN THE *
12
+ * "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE. *
13
+ ****************************************************************************/
14
+
15
+ // [v1.5]
16
+ class Simtech_Searchanise_Model_Mysql4_Fulltext_Collection extends Mage_CatalogSearch_Model_Mysql4_Fulltext_Collection
17
+ {
18
+ /**
19
+ * Searchanise Collection Product
20
+ *
21
+ * @var Simtech_Searchanise_Model_Searchanise
22
+ */
23
+ protected $_searchaniseCollection = null;
24
+
25
+ /**
26
+ * Initialize resource
27
+ * @return Simtech_Searchanise_Model_Mysql4_Product_CollectionSearhanise
28
+ */
29
+ protected function _construct()
30
+ {
31
+ parent::_construct();
32
+ $this->_searchaniseCollection = Mage::getModel('searchanise/searchanise');
33
+ $this->_searchaniseCollection->setCollection($this);
34
+ }
35
+
36
+ public function initSearchaniseRequest()
37
+ {
38
+ return $this->_searchaniseCollection->initSearchaniseRequest();
39
+ }
40
+
41
+ public function checkSearchaniseResult()
42
+ {
43
+ return $this->_searchaniseCollection->checkSearchaniseResult();
44
+ }
45
+
46
+ public function setSearchaniseRequest($request)
47
+ {
48
+ return $this->_searchaniseCollection->setSearchaniseRequest($request);
49
+ }
50
+
51
+ public function getSearchaniseRequest()
52
+ {
53
+ return $this->_searchaniseCollection->getSearchaniseRequest();
54
+ }
55
+
56
+ public function addSearchaniseFilter()
57
+ {
58
+ return $this->_searchaniseCollection->addSearchaniseFilter();
59
+ }
60
+
61
+ /**
62
+ * Set Order field
63
+ *
64
+ * @param string $attribute
65
+ * @param string $dir
66
+ * @return Mage_CatalogSearch_Model_Mysql4_Fulltext_Collection
67
+ */
68
+ public function setOrder($attribute, $dir = 'desc')
69
+ {
70
+ return $this->_searchaniseCollection->setOrder($attribute, $dir);
71
+ }
72
+
73
+ /**
74
+ * Set Order field
75
+ *
76
+ * @param string $attribute
77
+ * @param string $dir
78
+ * @return Mage_CatalogSearch_Model_Mysql4_Fulltext_Collection
79
+ */
80
+ public function setOrderParent($attribute, $dir = 'desc')
81
+ {
82
+ return parent::setOrder($attribute, $dir);
83
+ }
84
+
85
+ /**
86
+ * Retrieve collection last page number
87
+ *
88
+ * @return int
89
+ */
90
+ public function getLastPageNumber()
91
+ {
92
+ return $this->_searchaniseCollection->getLastPageNumber();
93
+ }
94
+
95
+ /**
96
+ * Retrieve collection last page number
97
+ *
98
+ * @return int
99
+ */
100
+ public function getLastPageNumberParent()
101
+ {
102
+ return parent::getLastPageNumber();
103
+ }
104
+ }
app/code/community/Simtech/Searchanise/Model/Mysql4/Product/Collection.php ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /***************************************************************************
3
+ * *
4
+ * (c) 2004 Vladimir V. Kalynyak, Alexey V. Vinokurov, Ilya M. Shalnev *
5
+ * *
6
+ * This is commercial software, only users who have purchased a valid *
7
+ * license and accept to the terms of the License Agreement can install *
8
+ * and use this program. *
9
+ * *
10
+ ****************************************************************************
11
+ * PLEASE READ THE FULL TEXT OF THE SOFTWARE LICENSE AGREEMENT IN THE *
12
+ * "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE. *
13
+ ****************************************************************************/
14
+
15
+ // [v1.5]
16
+ class Simtech_Searchanise_Model_Mysql4_Product_Collection extends Mage_Catalog_Model_Mysql4_Product_Collection
17
+ {
18
+ /**
19
+ * Searchanise Collection Product
20
+ *
21
+ * @var Simtech_Searchanise_Model_Searchanise
22
+ */
23
+ protected $_searchaniseCollection = null;
24
+
25
+ /**
26
+ * Initialize resource
27
+ * @return Simtech_Searchanise_Model_Mysql4_Product_CollectionSearhanise
28
+ */
29
+ protected function _construct()
30
+ {
31
+ parent::_construct();
32
+ $this->_searchaniseCollection = Mage::getModel('searchanise/searchanise');
33
+ $this->_searchaniseCollection->setCollection($this);
34
+ }
35
+
36
+ public function initSearchaniseRequest()
37
+ {
38
+ return $this->_searchaniseCollection->initSearchaniseRequest();
39
+ }
40
+
41
+ public function checkSearchaniseResult()
42
+ {
43
+ return $this->_searchaniseCollection->checkSearchaniseResult();
44
+ }
45
+
46
+ public function setSearchaniseRequest($request)
47
+ {
48
+ return $this->_searchaniseCollection->setSearchaniseRequest($request);
49
+ }
50
+
51
+ public function getSearchaniseRequest()
52
+ {
53
+ return $this->_searchaniseCollection->getSearchaniseRequest();
54
+ }
55
+
56
+ public function addSearchaniseFilter()
57
+ {
58
+ return $this->_searchaniseCollection->addSearchaniseFilter();
59
+ }
60
+
61
+ /**
62
+ * Set Order field
63
+ *
64
+ * @param string $attribute
65
+ * @param string $dir
66
+ * @return Mage_CatalogSearch_Model_Mysql4_Fulltext_Collection
67
+ */
68
+ public function setOrder($attribute, $dir = 'desc')
69
+ {
70
+ return $this->_searchaniseCollection->setOrder($attribute, $dir);
71
+ }
72
+
73
+ /**
74
+ * Set Order field
75
+ *
76
+ * @param string $attribute
77
+ * @param string $dir
78
+ * @return Mage_CatalogSearch_Model_Mysql4_Fulltext_Collection
79
+ */
80
+ public function setOrderParent($attribute, $dir = 'desc')
81
+ {
82
+ return parent::setOrder($attribute, $dir);
83
+ }
84
+
85
+ /**
86
+ * Retrieve collection last page number
87
+ *
88
+ * @return int
89
+ */
90
+ public function getLastPageNumber()
91
+ {
92
+ return $this->_searchaniseCollection->getLastPageNumber();
93
+ }
94
+
95
+ /**
96
+ * Retrieve collection last page number
97
+ *
98
+ * @return int
99
+ */
100
+ public function getLastPageNumberParent()
101
+ {
102
+ return parent::getLastPageNumber();
103
+ }
104
+ }
app/code/community/Simtech/Searchanise/Model/Mysql4/Product/CollectionTag.php ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /***************************************************************************
3
+ * *
4
+ * (c) 2004 Vladimir V. Kalynyak, Alexey V. Vinokurov, Ilya M. Shalnev *
5
+ * *
6
+ * This is commercial software, only users who have purchased a valid *
7
+ * license and accept to the terms of the License Agreement can install *
8
+ * and use this program. *
9
+ * *
10
+ ****************************************************************************
11
+ * PLEASE READ THE FULL TEXT OF THE SOFTWARE LICENSE AGREEMENT IN THE *
12
+ * "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE. *
13
+ ****************************************************************************/
14
+
15
+ // [v1.5]
16
+ class Simtech_Searchanise_Model_Mysql4_Product_CollectionTag extends Mage_Tag_Model_Mysql4_Product_Collection
17
+ {
18
+ /**
19
+ * Product Collection
20
+ *
21
+ * @var Mage_Catalog_Model_Resource_Collection [v1.6] [v1.7], Mage_Catalog_Model_Mysql4_Collection [v1.5]
22
+ */
23
+ protected $_searchaniseCollection = null;
24
+
25
+ /**
26
+ * Initialize resource
27
+ * @return Simtech_Searchanise_Model_Mysql4_Product_CollectionSearhanise
28
+ */
29
+ protected function _construct()
30
+ {
31
+ parent::_construct();
32
+ $this->_searchaniseCollection = Mage::getModel('searchanise/searchanise');
33
+ $this->_searchaniseCollection->setCollection($this);
34
+ }
35
+
36
+ public function initSearchaniseRequest()
37
+ {
38
+ return $this->_searchaniseCollection->initSearchaniseRequest();
39
+ }
40
+
41
+ public function checkSearchaniseResult()
42
+ {
43
+ return $this->_searchaniseCollection->checkSearchaniseResult();
44
+ }
45
+
46
+ public function setSearchaniseRequest($request)
47
+ {
48
+ return $this->_searchaniseCollection->setSearchaniseRequest($request);
49
+ }
50
+
51
+ public function getSearchaniseRequest()
52
+ {
53
+ return $this->_searchaniseCollection->getSearchaniseRequest();
54
+ }
55
+
56
+ public function addSearchaniseFilter()
57
+ {
58
+ return $this->_searchaniseCollection->addSearchaniseFilter();
59
+ }
60
+
61
+ /**
62
+ * Set Order field
63
+ *
64
+ * @param string $attribute
65
+ * @param string $dir
66
+ * @return Mage_Catalog_Model_Resource_Collection [v1.6] [v1.7], Mage_Catalog_Model_Mysql4_Collection [v1.5]
67
+ */
68
+ public function setOrder($attribute, $dir = 'desc')
69
+ {
70
+ return $this->_searchaniseCollection->setOrder($attribute, $dir);
71
+ }
72
+
73
+ /**
74
+ * Set Order field
75
+ *
76
+ * @param string $attribute
77
+ * @param string $dir
78
+ * @return Mage_Catalog_Model_Resource_Collection [v1.6] [v1.7], Mage_Catalog_Model_Mysql4_Collection [v1.5]
79
+ */
80
+ public function setOrderParent($attribute, $dir = 'desc')
81
+ {
82
+ return parent::setOrder($attribute, $dir);
83
+ }
84
+
85
+ /**
86
+ * Retrieve collection last page number
87
+ *
88
+ * @return int
89
+ */
90
+ public function getLastPageNumber()
91
+ {
92
+ return $this->_searchaniseCollection->getLastPageNumber();
93
+ }
94
+
95
+ /**
96
+ * Retrieve collection last page number
97
+ *
98
+ * @return int
99
+ */
100
+ public function getLastPageNumberParent()
101
+ {
102
+ return parent::getLastPageNumber();
103
+ }
104
+ }
app/code/community/Simtech/Searchanise/Model/Mysql4/Store.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /***************************************************************************
3
+ * *
4
+ * (c) 2004 Vladimir V. Kalynyak, Alexey V. Vinokurov, Ilya M. Shalnev *
5
+ * *
6
+ * This is commercial software, only users who have purchased a valid *
7
+ * license and accept to the terms of the License Agreement can install *
8
+ * and use this program. *
9
+ * *
10
+ ****************************************************************************
11
+ * PLEASE READ THE FULL TEXT OF THE SOFTWARE LICENSE AGREEMENT IN THE *
12
+ * "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE. *
13
+ ****************************************************************************/
14
+
15
+ // [v1.5]
16
+ class Simtech_Searchanise_Model_Mysql4_Store extends Mage_Core_Model_Mysql4_Store
17
+ {
18
+ /**
19
+ * Check store code before save
20
+ *
21
+ * @param Mage_Core_Model_Abstract $model
22
+ * @return Mage_Core_Model_Resource_Store
23
+ */
24
+ protected function _beforeSave(Mage_Core_Model_Abstract $model)
25
+ {
26
+ $ret = parent::_beforeSave($model);
27
+
28
+ Mage::dispatchEvent('searchanise_core_save_store_before', array('store' => $model));
29
+
30
+ return $ret;
31
+ }
32
+
33
+ /**
34
+ * Update Store Group data after save store
35
+ *
36
+ * @param Mage_Core_Model_Abstract $object
37
+ * @return Mage_Core_Model_Resource_Store
38
+ */
39
+ protected function _afterSave(Mage_Core_Model_Abstract $object)
40
+ {
41
+ $ret = parent::_afterSave($object);
42
+
43
+ Mage::dispatchEvent('searchanise_core_save_store_after', array('store' => $object));
44
+
45
+ return $ret;
46
+ }
47
+
48
+ /**
49
+ * Remove core configuration data after delete store
50
+ *
51
+ * @param Mage_Core_Model_Abstract $model
52
+ * @return Mage_Core_Model_Resource_Store
53
+ */
54
+ protected function _afterDelete(Mage_Core_Model_Abstract $model)
55
+ {
56
+ $ret = parent::_afterDelete($model);
57
+
58
+ Mage::dispatchEvent('searchanise_core_delete_store_after', array('store' => $model));
59
+
60
+ return $ret;
61
+ }
62
+ }
app/code/community/Simtech/Searchanise/Model/Observer.php CHANGED
@@ -237,7 +237,40 @@ class Simtech_Searchanise_Model_Observer
237
 
238
  return $this;
239
  }
240
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
241
  // FOR SALES //
242
  /**
243
  *
237
 
238
  return $this;
239
  }
240
+
241
+ /**
242
+ * Move category after
243
+ *
244
+ * @param Varien_Event_Observer $observer
245
+ * @return Mage_CatalogIndex_Model_Observer
246
+ */
247
+ public function catalogCategoryTreeMoveAfter(Varien_Event_Observer $observer)
248
+ {
249
+ $category = $observer->getEvent()->getCategory();
250
+
251
+ if ($category && $category->getId()) {
252
+ $products = $category->getProductCollection();
253
+
254
+ if (!empty($products)) {
255
+ if (empty(self::$productIdsInCategory)) {
256
+ Mage::getModel('searchanise/queue')->addActionProducts($products);
257
+ } else {
258
+ $productIds = array();
259
+ foreach ($products as $product) {
260
+ $id = $product->getId();
261
+ if ((!empty($id)) && (!in_array($id, self::$productIdsInCategory))) {
262
+ $productIds[] = $id;
263
+ }
264
+ }
265
+
266
+ Mage::getModel('searchanise/queue')->addActionProductIds($productIds);
267
+ }
268
+ }
269
+ }
270
+
271
+ return $this;
272
+ }
273
+
274
  // FOR SALES //
275
  /**
276
  *
app/code/community/Simtech/Searchanise/Model/Request.php CHANGED
@@ -1,4 +1,16 @@
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
  class Simtech_Searchanise_Model_Request extends Mage_Core_Model_Abstract
4
  {
@@ -551,4 +563,4 @@ class Simtech_Searchanise_Model_Request extends Mage_Core_Model_Abstract
551
 
552
  return $this->getAttributesCountLabel($label);
553
  }
554
- }
1
  <?php
2
+ /***************************************************************************
3
+ * *
4
+ * (c) 2004 Vladimir V. Kalynyak, Alexey V. Vinokurov, Ilya M. Shalnev *
5
+ * *
6
+ * This is commercial software, only users who have purchased a valid *
7
+ * license and accept to the terms of the License Agreement can install *
8
+ * and use this program. *
9
+ * *
10
+ ****************************************************************************
11
+ * PLEASE READ THE FULL TEXT OF THE SOFTWARE LICENSE AGREEMENT IN THE *
12
+ * "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE. *
13
+ ****************************************************************************/
14
 
15
  class Simtech_Searchanise_Model_Request extends Mage_Core_Model_Abstract
16
  {
563
 
564
  return $this->getAttributesCountLabel($label);
565
  }
566
+ }
app/code/community/Simtech/Searchanise/Model/Resource/Advanced/Collection.php CHANGED
@@ -12,42 +12,50 @@
12
  * "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE. *
13
  ****************************************************************************/
14
 
 
15
  class Simtech_Searchanise_Model_Resource_Advanced_Collection extends Mage_CatalogSearch_Model_Resource_Advanced_Collection
16
  {
17
  /**
18
- * Searchanise request
19
  *
20
- * @var Simtech_Searchanise_Model_Request
21
  */
22
- protected $_searchaniseRequest = null;
23
-
 
 
 
 
 
 
 
 
 
 
 
24
  public function initSearchaniseRequest()
25
  {
26
- $this->_searchaniseRequest = Mage::getModel('searchanise/request');
27
-
28
- return $this;
29
  }
30
 
31
  public function checkSearchaniseResult()
32
  {
33
- return Mage::helper('searchanise/ApiSe')->checkSearchaniseResult($this->_searchaniseRequest);
34
  }
35
 
36
  public function setSearchaniseRequest($request)
37
  {
38
- $this->_searchaniseRequest = $request;
39
  }
40
 
41
  public function getSearchaniseRequest()
42
  {
43
- return $this->_searchaniseRequest;
44
  }
45
 
46
  public function addSearchaniseFilter()
47
  {
48
- $this->addFieldToFilter('entity_id', array('in' => $this->getSearchaniseRequest()->getProductIds()));
49
-
50
- return $this;
51
  }
52
 
53
  /**
@@ -55,33 +63,25 @@ class Simtech_Searchanise_Model_Resource_Advanced_Collection extends Mage_Catalo
55
  *
56
  * @param string $attribute
57
  * @param string $dir
58
- * @return Mage_CatalogSearch_Model_Resource_Fulltext_Collection
59
  */
60
  public function setOrder($attribute, $dir = 'desc')
61
  {
62
- if (!Mage::helper('searchanise/ApiSe')->checkSearchaniseResult(true)) {
63
- return parent::setOrder($attribute, $dir);
64
- }
65
-
66
- if (!$this->checkSearchaniseResult()) {
67
- return parent::setOrder($attribute, $dir);
68
- }
69
-
70
- if ($attribute == 'relevance') {
71
- $product_ids = $this
72
- ->getSearchaniseRequest()
73
- ->getProductIdsString();
74
- if (!empty($product_ids)) {
75
- $sortBy = "FIELD(e.entity_id, {$product_ids}) {$dir}";
76
- $this->getSelect()->order(new Zend_Db_Expr($sortBy));
77
- }
78
- } else {
79
- parent::setOrder($attribute, $dir);
80
- }
81
-
82
- return $this;
83
  }
84
-
 
 
 
 
 
 
 
 
 
 
 
 
85
  /**
86
  * Retrieve collection last page number
87
  *
@@ -89,27 +89,16 @@ class Simtech_Searchanise_Model_Resource_Advanced_Collection extends Mage_Catalo
89
  */
90
  public function getLastPageNumber()
91
  {
92
- if (!Mage::helper('searchanise/ApiSe')->checkSearchaniseResult(true)) {
93
- return parent::getLastPageNumber();
94
- }
95
-
96
- if (!$this->checkSearchaniseResult()) {
97
- return parent::getLastPageNumber();
98
- }
99
-
100
- $collectionSize = (int) $this
101
- ->getSearchaniseRequest()
102
- ->getTotalProduct();
103
-
104
- if (0 === $collectionSize) {
105
- return 1;
106
- }
107
- elseif ($this->_pageSize) {
108
- return ceil($collectionSize/$this->_pageSize);
109
- }
110
- else{
111
- return 1;
112
- }
113
  }
114
- }
115
 
 
 
 
 
 
 
 
 
 
 
12
  * "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE. *
13
  ****************************************************************************/
14
 
15
+ // [v1.6] [v1.7]
16
  class Simtech_Searchanise_Model_Resource_Advanced_Collection extends Mage_CatalogSearch_Model_Resource_Advanced_Collection
17
  {
18
  /**
19
+ * Searchanise Collection Product
20
  *
21
+ * @var Simtech_Searchanise_Model_Searchanise
22
  */
23
+ protected $_searchaniseCollection = null;
24
+
25
+ /**
26
+ * Initialize resource
27
+ * @return Simtech_Searchanise_Model_Mysql4_Product_CollectionSearhanise
28
+ */
29
+ protected function _construct()
30
+ {
31
+ parent::_construct();
32
+ $this->_searchaniseCollection = Mage::getModel('searchanise/searchanise');
33
+ $this->_searchaniseCollection->setCollection($this);
34
+ }
35
+
36
  public function initSearchaniseRequest()
37
  {
38
+ return $this->_searchaniseCollection->initSearchaniseRequest();
 
 
39
  }
40
 
41
  public function checkSearchaniseResult()
42
  {
43
+ return $this->_searchaniseCollection->checkSearchaniseResult();
44
  }
45
 
46
  public function setSearchaniseRequest($request)
47
  {
48
+ return $this->_searchaniseCollection->setSearchaniseRequest($request);
49
  }
50
 
51
  public function getSearchaniseRequest()
52
  {
53
+ return $this->_searchaniseCollection->getSearchaniseRequest();
54
  }
55
 
56
  public function addSearchaniseFilter()
57
  {
58
+ return $this->_searchaniseCollection->addSearchaniseFilter();
 
 
59
  }
60
 
61
  /**
63
  *
64
  * @param string $attribute
65
  * @param string $dir
66
+ * @return Mage_CatalogSearch_Model_Mysql4_Fulltext_Collection
67
  */
68
  public function setOrder($attribute, $dir = 'desc')
69
  {
70
+ return $this->_searchaniseCollection->setOrder($attribute, $dir);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
  }
72
+
73
+ /**
74
+ * Set Order field
75
+ *
76
+ * @param string $attribute
77
+ * @param string $dir
78
+ * @return Mage_CatalogSearch_Model_Mysql4_Fulltext_Collection
79
+ */
80
+ public function setOrderParent($attribute, $dir = 'desc')
81
+ {
82
+ return parent::setOrder($attribute, $dir);
83
+ }
84
+
85
  /**
86
  * Retrieve collection last page number
87
  *
89
  */
90
  public function getLastPageNumber()
91
  {
92
+ return $this->_searchaniseCollection->getLastPageNumber();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93
  }
 
94
 
95
+ /**
96
+ * Retrieve collection last page number
97
+ *
98
+ * @return int
99
+ */
100
+ public function getLastPageNumberParent()
101
+ {
102
+ return parent::getLastPageNumber();
103
+ }
104
+ }
app/code/community/Simtech/Searchanise/Model/Resource/Eav/Mysql4/Product/Action.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /***************************************************************************
3
+ * *
4
+ * (c) 2004 Vladimir V. Kalynyak, Alexey V. Vinokurov, Ilya M. Shalnev *
5
+ * *
6
+ * This is commercial software, only users who have purchased a valid *
7
+ * license and accept to the terms of the License Agreement can install *
8
+ * and use this program. *
9
+ * *
10
+ ****************************************************************************
11
+ * PLEASE READ THE FULL TEXT OF THE SOFTWARE LICENSE AGREEMENT IN THE *
12
+ * "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE. *
13
+ ****************************************************************************/
14
+
15
+ // [v1.5]
16
+ class Simtech_Searchanise_Model_Resource_Eav_Mysql4_Product_Action extends Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Action
17
+ {
18
+ /**
19
+ * Update attribute values for entity list per store
20
+ *
21
+ * @param array $entityIds
22
+ * @param array $attrData
23
+ * @param int $storeId
24
+ * @return Mage_Catalog_Model_Product_Action
25
+ */
26
+ public function updateAttributes($entityIds, $attrData, $storeId)
27
+ {
28
+ if (version_compare(Mage::getVersion(), '1.6', '<')) {
29
+ Mage::dispatchEvent('searchanise_product_attribute_update_before', array(
30
+ 'attributes_data' => &$attrData,
31
+ 'product_ids' => &$entityIds,
32
+ 'store_id' => &$storeId
33
+ ));
34
+ }
35
+
36
+ return parent::updateAttributes($entityIds, $attrData, $storeId);
37
+ }
38
+ }
app/code/community/Simtech/Searchanise/Model/Resource/Fulltext/Collection.php CHANGED
@@ -12,42 +12,50 @@
12
  * "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE. *
13
  ****************************************************************************/
14
 
 
15
  class Simtech_Searchanise_Model_Resource_Fulltext_Collection extends Mage_CatalogSearch_Model_Resource_Fulltext_Collection
16
  {
17
  /**
18
- * Searchanise request
19
  *
20
- * @var Simtech_Searchanise_Model_Request
21
  */
22
- protected $_searchaniseRequest = null;
23
-
 
 
 
 
 
 
 
 
 
 
 
24
  public function initSearchaniseRequest()
25
  {
26
- $this->_searchaniseRequest = Mage::getModel('searchanise/request');
27
-
28
- return $this;
29
  }
30
 
31
  public function checkSearchaniseResult()
32
  {
33
- return Mage::helper('searchanise/ApiSe')->checkSearchaniseResult($this->_searchaniseRequest);
34
  }
35
 
36
  public function setSearchaniseRequest($request)
37
  {
38
- $this->_searchaniseRequest = $request;
39
  }
40
 
41
  public function getSearchaniseRequest()
42
  {
43
- return $this->_searchaniseRequest;
44
  }
45
 
46
  public function addSearchaniseFilter()
47
  {
48
- $this->addFieldToFilter('entity_id', array('in' => $this->getSearchaniseRequest()->getProductIds()));
49
-
50
- return $this;
51
  }
52
 
53
  /**
@@ -55,33 +63,25 @@ class Simtech_Searchanise_Model_Resource_Fulltext_Collection extends Mage_Catalo
55
  *
56
  * @param string $attribute
57
  * @param string $dir
58
- * @return Mage_CatalogSearch_Model_Resource_Fulltext_Collection
59
  */
60
  public function setOrder($attribute, $dir = 'desc')
61
  {
62
- if (!Mage::helper('searchanise/ApiSe')->checkSearchaniseResult(true)) {
63
- return parent::setOrder($attribute, $dir);
64
- }
65
-
66
- if (!$this->checkSearchaniseResult()) {
67
- return parent::setOrder($attribute, $dir);
68
- }
69
-
70
- if ($attribute == 'relevance') {
71
- $product_ids = $this
72
- ->getSearchaniseRequest()
73
- ->getProductIdsString();
74
- if (!empty($product_ids)) {
75
- $sortBy = "FIELD(e.entity_id, {$product_ids}) {$dir}";
76
- $this->getSelect()->order(new Zend_Db_Expr($sortBy));
77
- }
78
- } else {
79
- parent::setOrder($attribute, $dir);
80
- }
81
-
82
- return $this;
83
  }
84
-
 
 
 
 
 
 
 
 
 
 
 
 
85
  /**
86
  * Retrieve collection last page number
87
  *
@@ -89,26 +89,16 @@ class Simtech_Searchanise_Model_Resource_Fulltext_Collection extends Mage_Catalo
89
  */
90
  public function getLastPageNumber()
91
  {
92
- if (!Mage::helper('searchanise/ApiSe')->checkSearchaniseResult(true)) {
93
- return parent::getLastPageNumber();
94
- }
95
-
96
- if (!$this->checkSearchaniseResult()) {
97
- return parent::getLastPageNumber();
98
- }
99
-
100
- $collectionSize = (int) $this
101
- ->getSearchaniseRequest()
102
- ->getTotalProduct();
103
-
104
- if (0 === $collectionSize) {
105
- return 1;
106
- }
107
- elseif ($this->_pageSize) {
108
- return ceil($collectionSize/$this->_pageSize);
109
- }
110
- else{
111
- return 1;
112
- }
113
  }
114
  }
12
  * "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE. *
13
  ****************************************************************************/
14
 
15
+ // [v1.6] [v1.7]
16
  class Simtech_Searchanise_Model_Resource_Fulltext_Collection extends Mage_CatalogSearch_Model_Resource_Fulltext_Collection
17
  {
18
  /**
19
+ * Searchanise Collection Product
20
  *
21
+ * @var Simtech_Searchanise_Model_Searchanise
22
  */
23
+ protected $_searchaniseCollection = null;
24
+
25
+ /**
26
+ * Initialize resource
27
+ * @return Simtech_Searchanise_Model_Mysql4_Product_CollectionSearhanise
28
+ */
29
+ protected function _construct()
30
+ {
31
+ parent::_construct();
32
+ $this->_searchaniseCollection = Mage::getModel('searchanise/searchanise');
33
+ $this->_searchaniseCollection->setCollection($this);
34
+ }
35
+
36
  public function initSearchaniseRequest()
37
  {
38
+ return $this->_searchaniseCollection->initSearchaniseRequest();
 
 
39
  }
40
 
41
  public function checkSearchaniseResult()
42
  {
43
+ return $this->_searchaniseCollection->checkSearchaniseResult();
44
  }
45
 
46
  public function setSearchaniseRequest($request)
47
  {
48
+ return $this->_searchaniseCollection->setSearchaniseRequest($request);
49
  }
50
 
51
  public function getSearchaniseRequest()
52
  {
53
+ return $this->_searchaniseCollection->getSearchaniseRequest();
54
  }
55
 
56
  public function addSearchaniseFilter()
57
  {
58
+ return $this->_searchaniseCollection->addSearchaniseFilter();
 
 
59
  }
60
 
61
  /**
63
  *
64
  * @param string $attribute
65
  * @param string $dir
66
+ * @return Mage_CatalogSearch_Model_Mysql4_Fulltext_Collection
67
  */
68
  public function setOrder($attribute, $dir = 'desc')
69
  {
70
+ return $this->_searchaniseCollection->setOrder($attribute, $dir);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
  }
72
+
73
+ /**
74
+ * Set Order field
75
+ *
76
+ * @param string $attribute
77
+ * @param string $dir
78
+ * @return Mage_CatalogSearch_Model_Mysql4_Fulltext_Collection
79
+ */
80
+ public function setOrderParent($attribute, $dir = 'desc')
81
+ {
82
+ return parent::setOrder($attribute, $dir);
83
+ }
84
+
85
  /**
86
  * Retrieve collection last page number
87
  *
89
  */
90
  public function getLastPageNumber()
91
  {
92
+ return $this->_searchaniseCollection->getLastPageNumber();
93
+ }
94
+
95
+ /**
96
+ * Retrieve collection last page number
97
+ *
98
+ * @return int
99
+ */
100
+ public function getLastPageNumberParent()
101
+ {
102
+ return parent::getLastPageNumber();
 
 
 
 
 
 
 
 
 
 
103
  }
104
  }
app/code/community/Simtech/Searchanise/Model/Resource/Product/Collection.php CHANGED
@@ -12,42 +12,74 @@
12
  * "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE. *
13
  ****************************************************************************/
14
 
 
15
  class Simtech_Searchanise_Model_Resource_Product_Collection extends Mage_Catalog_Model_Resource_Product_Collection
16
  {
17
  /**
18
- * Searchanise request
19
  *
20
- * @var Simtech_Searchanise_Model_Request
21
  */
22
- protected $_searchaniseRequest = null;
23
-
 
 
 
 
 
 
 
 
 
 
 
24
  public function initSearchaniseRequest()
25
  {
26
- $this->_searchaniseRequest = Mage::getModel('searchanise/request');
27
-
28
- return $this;
29
  }
30
 
31
  public function checkSearchaniseResult()
32
  {
33
- return Mage::helper('searchanise/ApiSe')->checkSearchaniseResult($this->_searchaniseRequest);
34
  }
35
 
36
  public function setSearchaniseRequest($request)
37
  {
38
- $this->_searchaniseRequest = $request;
39
  }
40
 
41
  public function getSearchaniseRequest()
42
  {
43
- return $this->_searchaniseRequest;
44
  }
45
 
46
  public function addSearchaniseFilter()
47
  {
48
- $this->addFieldToFilter('entity_id', array('in' => $this->getSearchaniseRequest()->getProductIds()));
49
-
50
- return $this;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  }
52
 
53
  /**
@@ -57,50 +89,16 @@ class Simtech_Searchanise_Model_Resource_Product_Collection extends Mage_Catalog
57
  */
58
  public function getLastPageNumber()
59
  {
60
- if (!$this->checkSearchaniseResult()) {
61
- return parent::getLastPageNumber();
62
- }
63
-
64
- $collectionSize = (int) $this
65
- ->getSearchaniseRequest()
66
- ->getTotalProduct();
67
-
68
- if (0 === $collectionSize) {
69
- return 1;
70
- } elseif ($this->_pageSize) {
71
- return ceil($collectionSize/$this->_pageSize);
72
- }
73
-
74
- return 1;
75
  }
76
 
77
  /**
78
- * Set Order field
79
  *
80
- * @param string $attribute
81
- * @param string $dir
82
- * @return Mage_CatalogSearch_Model_Resource_Fulltext_Collection
83
  */
84
- public function setOrder($attribute, $dir = 'desc')
85
  {
86
- if (!$this->checkSearchaniseResult()) {
87
- return parent::setOrder($attribute, $dir);
88
- }
89
-
90
- if ($attribute == 'relevance') {
91
- $product_ids = $this
92
- ->getSearchaniseRequest()
93
- ->getProductIdsString();
94
-
95
- if (!empty($product_ids)) {
96
- $sortBy = "FIELD(e.entity_id, {$product_ids}) {$dir}";
97
- $this->getSelect()->order(new Zend_Db_Expr($sortBy));
98
- }
99
-
100
- } else {
101
- parent::setOrder($attribute, $dir);
102
- }
103
-
104
- return $this;
105
  }
106
  }
12
  * "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE. *
13
  ****************************************************************************/
14
 
15
+ // [v1.6] [v1.7]
16
  class Simtech_Searchanise_Model_Resource_Product_Collection extends Mage_Catalog_Model_Resource_Product_Collection
17
  {
18
  /**
19
+ * Searchanise Collection Product
20
  *
21
+ * @var Simtech_Searchanise_Model_Searchanise
22
  */
23
+ protected $_searchaniseCollection = null;
24
+
25
+ /**
26
+ * Initialize resource
27
+ * @return Simtech_Searchanise_Model_Mysql4_Product_CollectionSearhanise
28
+ */
29
+ protected function _construct()
30
+ {
31
+ parent::_construct();
32
+ $this->_searchaniseCollection = Mage::getModel('searchanise/searchanise');
33
+ $this->_searchaniseCollection->setCollection($this);
34
+ }
35
+
36
  public function initSearchaniseRequest()
37
  {
38
+ return $this->_searchaniseCollection->initSearchaniseRequest();
 
 
39
  }
40
 
41
  public function checkSearchaniseResult()
42
  {
43
+ return $this->_searchaniseCollection->checkSearchaniseResult();
44
  }
45
 
46
  public function setSearchaniseRequest($request)
47
  {
48
+ return $this->_searchaniseCollection->setSearchaniseRequest($request);
49
  }
50
 
51
  public function getSearchaniseRequest()
52
  {
53
+ return $this->_searchaniseCollection->getSearchaniseRequest();
54
  }
55
 
56
  public function addSearchaniseFilter()
57
  {
58
+ return $this->_searchaniseCollection->addSearchaniseFilter();
59
+ }
60
+
61
+ /**
62
+ * Set Order field
63
+ *
64
+ * @param string $attribute
65
+ * @param string $dir
66
+ * @return Mage_CatalogSearch_Model_Mysql4_Fulltext_Collection
67
+ */
68
+ public function setOrder($attribute, $dir = 'desc')
69
+ {
70
+ return $this->_searchaniseCollection->setOrder($attribute, $dir);
71
+ }
72
+
73
+ /**
74
+ * Set Order field
75
+ *
76
+ * @param string $attribute
77
+ * @param string $dir
78
+ * @return Mage_CatalogSearch_Model_Mysql4_Fulltext_Collection
79
+ */
80
+ public function setOrderParent($attribute, $dir = 'desc')
81
+ {
82
+ return parent::setOrder($attribute, $dir);
83
  }
84
 
85
  /**
89
  */
90
  public function getLastPageNumber()
91
  {
92
+ return $this->_searchaniseCollection->getLastPageNumber();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93
  }
94
 
95
  /**
96
+ * Retrieve collection last page number
97
  *
98
+ * @return int
 
 
99
  */
100
+ public function getLastPageNumberParent()
101
  {
102
+ return parent::getLastPageNumber();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
  }
104
  }
app/code/community/Simtech/Searchanise/Model/Resource/Product/CollectionTag.php CHANGED
@@ -12,44 +12,76 @@
12
  * "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE. *
13
  ****************************************************************************/
14
 
 
15
  class Simtech_Searchanise_Model_Resource_Product_CollectionTag extends Mage_Tag_Model_Resource_Product_Collection
16
  {
17
  /**
18
- * Searchanise request
19
  *
20
- * @var Simtech_Searchanise_Model_Request
21
  */
22
- protected $_searchaniseRequest = null;
23
-
 
 
 
 
 
 
 
 
 
 
 
24
  public function initSearchaniseRequest()
25
  {
26
- $this->_searchaniseRequest = Mage::getModel('searchanise/request');
27
-
28
- return $this;
29
  }
30
 
31
  public function checkSearchaniseResult()
32
  {
33
- return Mage::helper('searchanise/ApiSe')->checkSearchaniseResult($this->_searchaniseRequest);
34
  }
35
 
36
  public function setSearchaniseRequest($request)
37
  {
38
- $this->_searchaniseRequest = $request;
39
  }
40
 
41
  public function getSearchaniseRequest()
42
  {
43
- return $this->_searchaniseRequest;
44
  }
45
 
46
  public function addSearchaniseFilter()
47
  {
48
- $this->addFieldToFilter('entity_id', array('in' => $this->getSearchaniseRequest()->getProductIds()));
49
-
50
- return $this;
51
  }
52
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  /**
54
  * Retrieve collection last page number
55
  *
@@ -57,21 +89,16 @@ class Simtech_Searchanise_Model_Resource_Product_CollectionTag extends Mage_Tag_
57
  */
58
  public function getLastPageNumber()
59
  {
60
- if (!$this->checkSearchaniseResult()) {
61
- return parent::getLastPageNumber();
62
- }
63
-
64
- $collectionSize = (int) $this
65
- ->getSearchaniseRequest()
66
- ->getTotalProduct();
67
-
68
- if (0 === $collectionSize) {
69
- return 1;
70
-
71
- } elseif ($this->_pageSize) {
72
- return ceil($collectionSize/$this->_pageSize);
73
- }
74
-
75
- return 1;
76
  }
77
  }
12
  * "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE. *
13
  ****************************************************************************/
14
 
15
+ // [v1.6] [v1.7]
16
  class Simtech_Searchanise_Model_Resource_Product_CollectionTag extends Mage_Tag_Model_Resource_Product_Collection
17
  {
18
  /**
19
+ * Searchanise Collection Product
20
  *
21
+ * @var Simtech_Searchanise_Model_Searchanise
22
  */
23
+ protected $_searchaniseCollection = null;
24
+
25
+ /**
26
+ * Initialize resource
27
+ * @return Simtech_Searchanise_Model_Mysql4_Product_CollectionSearhanise
28
+ */
29
+ protected function _construct()
30
+ {
31
+ parent::_construct();
32
+ $this->_searchaniseCollection = Mage::getModel('searchanise/searchanise');
33
+ $this->_searchaniseCollection->setCollection($this);
34
+ }
35
+
36
  public function initSearchaniseRequest()
37
  {
38
+ return $this->_searchaniseCollection->initSearchaniseRequest();
 
 
39
  }
40
 
41
  public function checkSearchaniseResult()
42
  {
43
+ return $this->_searchaniseCollection->checkSearchaniseResult();
44
  }
45
 
46
  public function setSearchaniseRequest($request)
47
  {
48
+ return $this->_searchaniseCollection->setSearchaniseRequest($request);
49
  }
50
 
51
  public function getSearchaniseRequest()
52
  {
53
+ return $this->_searchaniseCollection->getSearchaniseRequest();
54
  }
55
 
56
  public function addSearchaniseFilter()
57
  {
58
+ return $this->_searchaniseCollection->addSearchaniseFilter();
 
 
59
  }
60
 
61
+ /**
62
+ * Set Order field
63
+ *
64
+ * @param string $attribute
65
+ * @param string $dir
66
+ * @return Mage_CatalogSearch_Model_Mysql4_Fulltext_Collection
67
+ */
68
+ public function setOrder($attribute, $dir = 'desc')
69
+ {
70
+ return $this->_searchaniseCollection->setOrder($attribute, $dir);
71
+ }
72
+
73
+ /**
74
+ * Set Order field
75
+ *
76
+ * @param string $attribute
77
+ * @param string $dir
78
+ * @return Mage_CatalogSearch_Model_Mysql4_Fulltext_Collection
79
+ */
80
+ public function setOrderParent($attribute, $dir = 'desc')
81
+ {
82
+ return parent::setOrder($attribute, $dir);
83
+ }
84
+
85
  /**
86
  * Retrieve collection last page number
87
  *
89
  */
90
  public function getLastPageNumber()
91
  {
92
+ return $this->_searchaniseCollection->getLastPageNumber();
93
+ }
94
+
95
+ /**
96
+ * Retrieve collection last page number
97
+ *
98
+ * @return int
99
+ */
100
+ public function getLastPageNumberParent()
101
+ {
102
+ return parent::getLastPageNumber();
 
 
 
 
 
103
  }
104
  }
app/code/community/Simtech/Searchanise/Model/Resource/Store.php CHANGED
@@ -12,6 +12,7 @@
12
  * "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE. *
13
  ****************************************************************************/
14
 
 
15
  class Simtech_Searchanise_Model_Resource_Store extends Mage_Core_Model_Resource_Store
16
  {
17
  /**
12
  * "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE. *
13
  ****************************************************************************/
14
 
15
+ // [1.6] [1.7]
16
  class Simtech_Searchanise_Model_Resource_Store extends Mage_Core_Model_Resource_Store
17
  {
18
  /**
app/code/community/Simtech/Searchanise/Model/Searchanise.php ADDED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /***************************************************************************
3
+ * *
4
+ * (c) 2004 Vladimir V. Kalynyak, Alexey V. Vinokurov, Ilya M. Shalnev *
5
+ * *
6
+ * This is commercial software, only users who have purchased a valid *
7
+ * license and accept to the terms of the License Agreement can install *
8
+ * and use this program. *
9
+ * *
10
+ ****************************************************************************
11
+ * PLEASE READ THE FULL TEXT OF THE SOFTWARE LICENSE AGREEMENT IN THE *
12
+ * "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE. *
13
+ ****************************************************************************/
14
+
15
+ class Simtech_Searchanise_Model_Searchanise extends Mage_Core_Model_Abstract
16
+ {
17
+ /**
18
+ * Mysql4_Product_Collection
19
+ *
20
+ * @var Mage_Catalog_Model_Resource_Product_Collection [v1.6] [v1.7], Mage_Catalog_Model_Mysql4_Product_Collection [v1.5]
21
+ */
22
+ protected $_collection = null;
23
+
24
+ /**
25
+ * Searchanise request
26
+ *
27
+ * @var Simtech_Searchanise_Model_Request
28
+ */
29
+ protected $_searchaniseRequest = null;
30
+
31
+ public function initSearchaniseRequest()
32
+ {
33
+ $this->_searchaniseRequest = Mage::getModel('searchanise/request');
34
+
35
+ return $this;
36
+ }
37
+
38
+ /**
39
+ * Set colection
40
+ *
41
+ * @param Mage_Catalog_Model_Mysql4_Product_Collection
42
+ * @return Simtech_Searchanise_Model_Mysql4_Product_CollectionSearhanise
43
+ */
44
+ public function setCollection($collection)
45
+ {
46
+ $this->_collection = $collection;
47
+
48
+ return $this;
49
+ }
50
+
51
+ /**
52
+ * Get colection
53
+ *
54
+ * @return Mage_Catalog_Model_Mysql4_Product_Collection
55
+ */
56
+ public function getCollection()
57
+ {
58
+ return $this->_collection;
59
+ }
60
+
61
+ public function checkSearchaniseResult()
62
+ {
63
+ return Mage::helper('searchanise/ApiSe')->checkSearchaniseResult($this->_searchaniseRequest);
64
+ }
65
+
66
+ public function setSearchaniseRequest($request)
67
+ {
68
+ $this->_searchaniseRequest = $request;
69
+ }
70
+
71
+ public function getSearchaniseRequest()
72
+ {
73
+ return $this->_searchaniseRequest;
74
+ }
75
+
76
+ public function addSearchaniseFilter()
77
+ {
78
+ $this->_collection->addFieldToFilter('entity_id', array('in' => $this->getSearchaniseRequest()->getProductIds()));
79
+
80
+ return $this->_collection;
81
+ }
82
+
83
+ /**
84
+ * Retrieve collection last page number
85
+ *
86
+ * @return int
87
+ */
88
+ public function getLastPageNumber()
89
+ {
90
+ if (!$this->checkSearchaniseResult()) {
91
+ return $this->_collection->getLastPageNumberParent();
92
+ }
93
+
94
+ $collectionSize = (int) $this
95
+ ->getSearchaniseRequest()
96
+ ->getTotalProduct();
97
+
98
+ if (0 === $collectionSize) {
99
+ return 1;
100
+ } else {
101
+ $pageSize = $this->_collection->getPageSize();
102
+
103
+ if ($pageSize) {
104
+ return ceil($collectionSize/$pageSize);
105
+ }
106
+ }
107
+
108
+ return 1;
109
+ }
110
+
111
+ /**
112
+ * Set Order field
113
+ *
114
+ * @param string $attribute
115
+ * @param string $dir
116
+ * @return Mage_CatalogSearch_Model_Mysql4_Fulltext_Collection
117
+ */
118
+ public function setOrder($attribute, $dir = 'desc')
119
+ {
120
+ if (!$this->checkSearchaniseResult()) {
121
+ return $this->_collection->setOrderParent($attribute, $dir);
122
+ }
123
+
124
+ if ($attribute == 'relevance') {
125
+ $product_ids = $this
126
+ ->getSearchaniseRequest()
127
+ ->getProductIdsString();
128
+
129
+ if (!empty($product_ids)) {
130
+ $sortBy = "FIELD(e.entity_id, {$product_ids}) {$dir}";
131
+ $this->_collection->getSelect()->order(new Zend_Db_Expr($sortBy));
132
+ }
133
+
134
+ } else {
135
+ return $this->_collection->setOrderParent($attribute, $dir);
136
+ }
137
+
138
+ return $this;
139
+ }
140
+ }
app/code/community/Simtech/Searchanise/controllers/AsyncController.php CHANGED
@@ -36,11 +36,16 @@ class Simtech_Searchanise_AsyncController extends Mage_Core_Controller_Front_Act
36
  */
37
  public function preDispatch()
38
  {
39
- $this->setFlag('', self::FLAG_NO_START_SESSION, 1);
 
 
 
40
  $this->setFlag('', self::FLAG_NO_CHECK_INSTALLATION, 1);
41
  $this->setFlag('', self::FLAG_NO_COOKIES_REDIRECT, 0);
42
  $this->setFlag('', self::FLAG_NO_PRE_DISPATCH, 1);
43
- $this->setFlag('', self::FLAG_NO_POST_DISPATCH, 1);
 
 
44
 
45
  parent::preDispatch();
46
  }
@@ -82,7 +87,7 @@ class Simtech_Searchanise_AsyncController extends Mage_Core_Controller_Front_Act
82
  array(),
83
  array(),
84
  Mage::helper('searchanise/ApiSe')->getAjaxAsyncTimeout(),
85
- 2
86
  );
87
  }
88
  }
36
  */
37
  public function preDispatch()
38
  {
39
+ Mage::app()->setCurrentStore('admin');
40
+
41
+ // Do not start standart session
42
+ $this->setFlag('', self::FLAG_NO_START_SESSION, 1);
43
  $this->setFlag('', self::FLAG_NO_CHECK_INSTALLATION, 1);
44
  $this->setFlag('', self::FLAG_NO_COOKIES_REDIRECT, 0);
45
  $this->setFlag('', self::FLAG_NO_PRE_DISPATCH, 1);
46
+
47
+ // Need for delete the "PDOExceptionPDOException" error
48
+ $this->setFlag('', self::FLAG_NO_POST_DISPATCH, 1);
49
 
50
  parent::preDispatch();
51
  }
87
  array(),
88
  array(),
89
  Mage::helper('searchanise/ApiSe')->getAjaxAsyncTimeout(),
90
+ 2 // maxredirects
91
  );
92
  }
93
  }
app/code/community/Simtech/Searchanise/controllers/InfoController.php CHANGED
@@ -16,6 +16,7 @@ class Simtech_Searchanise_InfoController extends Mage_Core_Controller_Front_Acti
16
  {
17
  const RESYNC = 'resync';
18
  const OUTPUT = 'visual';
 
19
  const PRODUCT_IDS = 'product_ids';
20
  const PARENT_PRIVATE_KEY = 'parent_private_key';
21
 
@@ -23,6 +24,7 @@ class Simtech_Searchanise_InfoController extends Mage_Core_Controller_Front_Acti
23
  {
24
  $resync = $this->getRequest()->getParam(self::RESYNC);
25
  $visual = $this->getRequest()->getParam(self::OUTPUT);
 
26
  $productIds = $this->getRequest()->getParam(self::PRODUCT_IDS);
27
  $parentPrivateKey = $this->getRequest()->getParam(self::PARENT_PRIVATE_KEY);
28
 
@@ -46,7 +48,11 @@ class Simtech_Searchanise_InfoController extends Mage_Core_Controller_Front_Acti
46
  Mage::helper('searchanise/ApiSe')->queueImport();
47
 
48
  } elseif (!empty($productIds)) {
49
- $productFeeds = Mage::helper('searchanise/ApiXML')->generateProductsXML($productIds);
 
 
 
 
50
 
51
  if ($visual) {
52
  Mage::helper('searchanise/ApiSe')->printR($productFeeds);
16
  {
17
  const RESYNC = 'resync';
18
  const OUTPUT = 'visual';
19
+ const STORE_ID = 'store_id';
20
  const PRODUCT_IDS = 'product_ids';
21
  const PARENT_PRIVATE_KEY = 'parent_private_key';
22
 
24
  {
25
  $resync = $this->getRequest()->getParam(self::RESYNC);
26
  $visual = $this->getRequest()->getParam(self::OUTPUT);
27
+ $storeId = $this->getRequest()->getParam(self::STORE_ID);
28
  $productIds = $this->getRequest()->getParam(self::PRODUCT_IDS);
29
  $parentPrivateKey = $this->getRequest()->getParam(self::PARENT_PRIVATE_KEY);
30
 
48
  Mage::helper('searchanise/ApiSe')->queueImport();
49
 
50
  } elseif (!empty($productIds)) {
51
+ $store = null;
52
+ if (!empty($storeId)) {
53
+ $store = Mage::app()->getStore($storeId);
54
+ }
55
+ $productFeeds = Mage::helper('searchanise/ApiXML')->generateProductsXML($productIds, $store);
56
 
57
  if ($visual) {
58
  Mage::helper('searchanise/ApiSe')->printR($productFeeds);
app/code/community/Simtech/Searchanise/etc/config.xml CHANGED
@@ -15,7 +15,7 @@
15
  <config>
16
  <modules>
17
  <Simtech_Searchanise>
18
- <version>1.0.8</version>
19
  </Simtech_Searchanise>
20
  </modules>
21
  <frontend>
@@ -101,7 +101,7 @@
101
  <children>
102
  <Simtech_Searchanise>
103
  <title>Searchanise Module</title>
104
- <sort_order>10</sort_order>
105
  </Simtech_Searchanise>
106
  <system>
107
  <children>
@@ -154,6 +154,13 @@
154
  <layer_filter_price>Simtech_Searchanise_Model_Resource_Layer_Filter_Price</layer_filter_price>
155
  </rewrite>
156
  </catalog_resource>
 
 
 
 
 
 
 
157
  <!-- END -->
158
  <!-- OVERRIDE CATALOGSEARCH MODEL -->
159
  <catalogsearch>
@@ -163,15 +170,26 @@
163
  </rewrite>
164
  </catalogsearch>
165
  <!-- END -->
 
166
  <!-- <OVERRIDE CATALOGSEARCH RESOURCE> -->
 
167
  <catalogsearch_resource>
168
  <rewrite>
169
- <fulltext>Simtech_Searchanise_Model_Resource_Fulltext</fulltext>
170
  <fulltext_collection>Simtech_Searchanise_Model_Resource_Fulltext_Collection</fulltext_collection>
171
  <advanced_collection>Simtech_Searchanise_Model_Resource_Advanced_Collection</advanced_collection>
172
  </rewrite>
173
  </catalogsearch_resource>
 
 
 
 
 
 
 
 
 
174
  <!-- END -->
 
175
  <!-- OVERRIDE TAG MODEL -->
176
  <tag>
177
  <rewrite>
@@ -179,13 +197,24 @@
179
  </rewrite>
180
  </tag>
181
  <!-- END -->
182
- <!-- OVERRIDE CATALOGSEARCH MODEL -->
 
 
183
  <tag_resource>
184
  <rewrite>
185
  <product_collection>Simtech_Searchanise_Model_Resource_Product_CollectionTag</product_collection>
186
  </rewrite>
187
  </tag_resource>
 
 
 
 
 
 
 
 
188
  <!-- END -->
 
189
  <!-- OVERRIDE IMPORTEXPORT MODEL -->
190
  <importexport>
191
  <rewrite>
@@ -194,11 +223,20 @@
194
  </importexport>
195
  <!-- END -->
196
  <!-- <OVERRIDE CORE RESOURCE> -->
 
197
  <core_resource>
198
  <rewrite>
199
  <store>Simtech_Searchanise_Model_Resource_Store</store>
200
  </rewrite>
201
  </core_resource>
 
 
 
 
 
 
 
 
202
  <!-- END -->
203
  <!-- OVERRIDE ADMINHTML MODEL -->
204
  <adminhtml>
@@ -287,6 +325,7 @@
287
  </rating>
288
  </observers>
289
  </catalog_product_delete_before>
 
290
  <catalog_product_attribute_update_before>
291
  <observers>
292
  <rating>
@@ -295,6 +334,17 @@
295
  </rating>
296
  </observers>
297
  </catalog_product_attribute_update_before>
 
 
 
 
 
 
 
 
 
 
 
298
  <catalog_product_website_update_before>
299
  <observers>
300
  <rating>
@@ -303,6 +353,14 @@
303
  </rating>
304
  </observers>
305
  </catalog_product_website_update_before>
 
 
 
 
 
 
 
 
306
  <!-- facets-->
307
  <catalog_entity_attribute_save_before>
308
  <observers>
@@ -477,7 +535,7 @@
477
  <default>
478
  <searchanise>
479
  <config>
480
- <version>1.0.7</version>
481
  <search_timeout>3</search_timeout>
482
  <request_timeout>15</request_timeout>
483
  <ajax_async_timeout>1</ajax_async_timeout>
@@ -489,6 +547,7 @@
489
  <service_url>http://www.searchanise.com</service_url>
490
  <cron_enabled>1</cron_enabled>
491
  <input_id_search>search</input_id_search>
 
492
  <type_async>2</type_async>
493
  </config>
494
  </searchanise>
15
  <config>
16
  <modules>
17
  <Simtech_Searchanise>
18
+ <version>1.1.0</version>
19
  </Simtech_Searchanise>
20
  </modules>
21
  <frontend>
101
  <children>
102
  <Simtech_Searchanise>
103
  <title>Searchanise Module</title>
104
+ <sort_order>1</sort_order>
105
  </Simtech_Searchanise>
106
  <system>
107
  <children>
154
  <layer_filter_price>Simtech_Searchanise_Model_Resource_Layer_Filter_Price</layer_filter_price>
155
  </rewrite>
156
  </catalog_resource>
157
+ <!-- [v1.5] -->
158
+ <catalog_resource_eav_mysql4>
159
+ <rewrite>
160
+ <product_action>Simtech_Searchanise_Model_Resource_Eav_Mysql4_Product_Action</product_action>
161
+ </rewrite>
162
+ </catalog_resource_eav_mysql4>
163
+ <!-- [/v1.5] -->
164
  <!-- END -->
165
  <!-- OVERRIDE CATALOGSEARCH MODEL -->
166
  <catalogsearch>
170
  </rewrite>
171
  </catalogsearch>
172
  <!-- END -->
173
+
174
  <!-- <OVERRIDE CATALOGSEARCH RESOURCE> -->
175
+ <!-- [v1.6] [v1.7] -->
176
  <catalogsearch_resource>
177
  <rewrite>
 
178
  <fulltext_collection>Simtech_Searchanise_Model_Resource_Fulltext_Collection</fulltext_collection>
179
  <advanced_collection>Simtech_Searchanise_Model_Resource_Advanced_Collection</advanced_collection>
180
  </rewrite>
181
  </catalogsearch_resource>
182
+ <!-- [/v1.6] [/v1.7] -->
183
+ <!-- [v1.5] -->
184
+ <catalogsearch_mysql4>
185
+ <rewrite>
186
+ <fulltext_collection>Simtech_Searchanise_Model_Mysql4_Fulltext_Collection</fulltext_collection>
187
+ <advanced_collection>Simtech_Searchanise_Model_Mysql4_Advanced_Collection</advanced_collection>
188
+ </rewrite>
189
+ </catalogsearch_mysql4>
190
+ <!-- [/v1.5] -->
191
  <!-- END -->
192
+
193
  <!-- OVERRIDE TAG MODEL -->
194
  <tag>
195
  <rewrite>
197
  </rewrite>
198
  </tag>
199
  <!-- END -->
200
+
201
+ <!-- OVERRIDE TAG RESOURCE -->
202
+ <!-- [v1.6] [v1.7] -->
203
  <tag_resource>
204
  <rewrite>
205
  <product_collection>Simtech_Searchanise_Model_Resource_Product_CollectionTag</product_collection>
206
  </rewrite>
207
  </tag_resource>
208
+ <!-- [/v1.6] [/v1.7] -->
209
+ <!-- [v1.5]-->
210
+ <tag_mysql4>
211
+ <rewrite>
212
+ <product_collection>Simtech_Searchanise_Model_Mysql4_Product_CollectionTag</product_collection>
213
+ </rewrite>
214
+ </tag_mysql4>
215
+ <!-- [/v1.5]-->
216
  <!-- END -->
217
+
218
  <!-- OVERRIDE IMPORTEXPORT MODEL -->
219
  <importexport>
220
  <rewrite>
223
  </importexport>
224
  <!-- END -->
225
  <!-- <OVERRIDE CORE RESOURCE> -->
226
+ <!-- [v1.6] [v1.7] -->
227
  <core_resource>
228
  <rewrite>
229
  <store>Simtech_Searchanise_Model_Resource_Store</store>
230
  </rewrite>
231
  </core_resource>
232
+ <!-- [/v1.6] [/v1.7] -->
233
+ <!-- [v1.5] -->
234
+ <core_mysql4>
235
+ <rewrite>
236
+ <store>Simtech_Searchanise_Model_Mysql4_Store</store>
237
+ </rewrite>
238
+ </core_mysql4>
239
+ <!-- [/v1.5] -->
240
  <!-- END -->
241
  <!-- OVERRIDE ADMINHTML MODEL -->
242
  <adminhtml>
325
  </rating>
326
  </observers>
327
  </catalog_product_delete_before>
328
+ <!-- [v1.6] [v1.7] -->
329
  <catalog_product_attribute_update_before>
330
  <observers>
331
  <rating>
334
  </rating>
335
  </observers>
336
  </catalog_product_attribute_update_before>
337
+ <!-- [/v1.6] [/v1.7] -->
338
+ <!-- [v1.5] -->
339
+ <searchanise_product_attribute_update_before>
340
+ <observers>
341
+ <rating>
342
+ <class>searchanise/observer</class>
343
+ <method>catalogProductAttributeUpdateBefore</method>
344
+ </rating>
345
+ </observers>
346
+ </searchanise_product_attribute_update_before>
347
+ <!-- [/v1.5] -->
348
  <catalog_product_website_update_before>
349
  <observers>
350
  <rating>
353
  </rating>
354
  </observers>
355
  </catalog_product_website_update_before>
356
+ <catalog_category_tree_move_after>
357
+ <observers>
358
+ <rating>
359
+ <class>searchanise/observer</class>
360
+ <method>catalogCategoryTreeMoveAfter</method>
361
+ </rating>
362
+ </observers>
363
+ </catalog_category_tree_move_after>
364
  <!-- facets-->
365
  <catalog_entity_attribute_save_before>
366
  <observers>
535
  <default>
536
  <searchanise>
537
  <config>
538
+ <server_version>1.2</server_version>
539
  <search_timeout>3</search_timeout>
540
  <request_timeout>15</request_timeout>
541
  <ajax_async_timeout>1</ajax_async_timeout>
547
  <service_url>http://www.searchanise.com</service_url>
548
  <cron_enabled>1</cron_enabled>
549
  <input_id_search>search</input_id_search>
550
+ <!-- '2' - ajax -->
551
  <type_async>2</type_async>
552
  </config>
553
  </searchanise>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Simtech_Searchanise</name>
4
- <version>1.0.8</version>
5
  <stability>stable</stability>
6
  <license uri="https://searchanise.atlassian.net/wiki/display/DD/LICENSE+AGREEMENT">Commercial license: https://searchanise.atlassian.net/wiki/display/DD/LICENSE+AGREEMENT</license>
7
  <channel>community</channel>
@@ -10,12 +10,13 @@
10
  <description>Searchanise is a free SaaS solution providing fast and smart search for online stores. It provides rapid search results and instant search suggestions presented in a fancy and customizable widget.&#xD;
11
  &#xD;
12
  With the help of Searchanise Connector Add-on you will be able to connect your store to the service and start using the search widget in no time. Power up your store right now!</description>
13
- <notes>[+] Maximal thumbnail size is now 70&#xD7;70 pixels with the original aspect ratio preserved. For example, for a 360x535 image a 47x70 thumbnail will be generated.&lt;br&gt;&#xD;
14
- [+] Catalog resync is performed automatically on image cache flushing.</notes>
 
15
  <authors><author><name>Simbirsk Technologies, Ltd.</name><user>searchanise</user><email>sales@searchanise.com</email></author></authors>
16
- <date>2013-05-27</date>
17
- <time>10:59:51</time>
18
- <contents><target name="magecommunity"><dir name="Simtech"><dir name="Searchanise"><dir name="Block"><file name="Async.php" hash="e7f47cd4afa3f2a0d32776553a89c557"/><file name="Autocomplete.php" hash="efc89ac3f897be3bc307fba6a36778f0"/><file name="Jsinit.php" hash="71ba588cf3f94768a76fca4f52c563e9"/><dir name="Product"><dir name="List"><file name="Toolbar.php" hash="7191058de95d20a86b65c27b3c73b064"/></dir><file name="Result.php" hash="93bad80ca402362e6d56b13da7064fa1"/></dir><file name="Result.php" hash="dec7b27ab9511c956680eb60eba9b95e"/></dir><dir name="Helper"><file name="ApiSe.php" hash="1df3d62b73ce6386b423aa9475236386"/><file name="ApiXML.php" hash="3822be2e0891d7b1f6cad751b662afe6"/><file name="Data.php" hash="8eefead1610d937cf9470ec45c364781"/></dir><dir name="Model"><file name="Advanced.php" hash="2a22ebcf7ac75b54681ef8a27bad2e47"/><dir name="Config"><file name="Data.php" hash="ddc558d22208f0ebc1e4378c9d050022"/></dir><file name="Config.php" hash="00ca3c7955f3ff2283c636a2074b6f03"/><dir name="Import"><dir name="Entity"><file name="Product.php" hash="4997af528b36f0f576d1c01402e14b03"/></dir></dir><dir name="Layer"><dir name="Filter"><file name="Category.php" hash="e290ab29f2d50e1acbbbb37496150ea4"/><file name="Price.php" hash="743887b32bf012274ad8a371fff96411"/></dir></dir><file name="Layer.php" hash="3e8c975d649ae6e20fcc69d35779c97c"/><file name="LayerCatalogSearch.php" hash="c32156da4147670c6bc5583e083c22a1"/><dir name="Mysql4"><dir name="Config"><file name="Collection.php" hash="470218c1eb3f1cc1ca0e6d0e93e1b097"/></dir><file name="Config.php" hash="c95dc8ecd7ab4f955b6eaf4710ab960e"/><dir name="Queue"><file name="Collection.php" hash="30ca0f8640bdc443deb94cd2e71010c8"/></dir><file name="Queue.php" hash="286351623e8f011a21519f8d9c3e3151"/></dir><file name="Observer.php" hash="9fc59a5463e4df66e772a8fc03a28cff"/><file name="Queue.php" hash="4906e1669bac61e66f3d690c646c9ba3"/><file name="Request.php" hash="987e3f8b6691aa982101f002695e70af"/><dir name="Resource"><dir name="Advanced"><file name="Collection.php" hash="bb2843f4b1b7672cf1334f7543969f95"/></dir><dir name="Fulltext"><file name="Collection.php" hash="3b8260ba3184172d220b87619159482f"/></dir><file name="Fulltext.php" hash="e9ea5b1ea7a2a5bc38d89f519e12347a"/><dir name="Layer"><dir name="Filter"><file name="Attribute.php" hash="4fd102cb09e8e80e50f9cbf1f621adbb"/><file name="Price.php" hash="0b3302f2d99f5f0d62d7fcd705825db0"/></dir></dir><dir name="Product"><file name="Collection.php" hash="cfd22d67e6a8cf032cf4a6343e10a450"/><file name="CollectionTag.php" hash="be55f448ecf92aad043c2480b7fe49df"/></dir><file name="Store.php" hash="5664dbfc69749b767db08b288c5aefbe"/></dir><dir name="System"><dir name="Config"><dir name="Source"><dir name="Searchanise"><file name="TypeAsync.php" hash="11d1aa481094ccbeab365b1fed33440d"/></dir></dir></dir></dir><dir name="Tag"><file name="Relation.php" hash="598f81fd8b2ac77baf24211c2ed03e55"/></dir></dir><dir name="controllers"><file name="AdvancedController.php" hash="7500f6075382cd8a14816e424da2348f"/><file name="AsyncController.php" hash="36fac5872193c47b47115eb7261e3571"/><file name="CategoryController.php" hash="909f99c5cf7f85405fc76ebe976c2c8e"/><file name="IndexController.php" hash="e3234ca51a7669741e29ff7c38789989"/><file name="InfoController.php" hash="177263a2ac421ba1d759868c2173b2ba"/><file name="OptionsController.php" hash="56785c8ea24472c2047268b2d9e8e878"/><file name="ProductController.php" hash="6633fde99f35ffeaa05884f0e0d98da7"/><file name="ResultController.php" hash="434b72272ebb222f775b8010f72ffdde"/><file name="ResyncController.php" hash="0612f929d375427326821dfc12186be8"/><file name="SignupController.php" hash="80f87a63d6272f98a068dde35f1d140e"/></dir><dir name="etc"><file name="config.xml" hash="0f0833c2ddc64c8abf68b6dc1e976cd5"/><file name="system.xml" hash="881fb083ae8711b7dadadd6ab954f764"/></dir><dir name="sql"><dir name="searchanise_setup"><file name="mysql4-install-0.1.0.php" hash="36781ba462935d4026358fb3a1f7c842"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="searchanise"><file name="dashboard.phtml" hash="c76131581bb8dfc21a1f9aa492179b01"/></dir></dir><dir name="layout"><file name="searchanise.xml" hash="1eaff51919b0b8c227fdf1b975ebe6b2"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="searchanise.xml" hash="9a1338f1522adad70042119c25ab64d9"/></dir></dir></dir><dir name="default"><dir name="default"><dir name="template"><dir name="catalogsearch"><file name="form.mini.phtml" hash="937e73ae35afdf220d96132e3ee13424"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Simtech_Searchanise.xml" hash="04148681a6648bd370ab62140cbf2ad9"/></dir></target><target name="magelocale"><dir name="en_US"><file name="Simtech_Searchanise.csv" hash="1bdb7fddc596dac1460bc3054c425187"/></dir></target></contents>
19
  <compatible/>
20
  <dependencies><required><php><min>5.2.13</min><max>6.0.0</max></php></required></dependencies>
21
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Simtech_Searchanise</name>
4
+ <version>1.1.0</version>
5
  <stability>stable</stability>
6
  <license uri="https://searchanise.atlassian.net/wiki/display/DD/LICENSE+AGREEMENT">Commercial license: https://searchanise.atlassian.net/wiki/display/DD/LICENSE+AGREEMENT</license>
7
  <channel>community</channel>
10
  <description>Searchanise is a free SaaS solution providing fast and smart search for online stores. It provides rapid search results and instant search suggestions presented in a fancy and customizable widget.&#xD;
11
  &#xD;
12
  With the help of Searchanise Connector Add-on you will be able to connect your store to the service and start using the search widget in no time. Power up your store right now!</description>
13
+ <notes>[+] Magento Community 1.5 is now supported.&lt;br&gt;&#xD;
14
+ [!] Grouped, configurable, and bundle product support improved.&lt;br&gt;&#xD;
15
+ [!] Fixed an error that would occur on Magento re-indexation.</notes>
16
  <authors><author><name>Simbirsk Technologies, Ltd.</name><user>searchanise</user><email>sales@searchanise.com</email></author></authors>
17
+ <date>2013-06-03</date>
18
+ <time>07:39:44</time>
19
+ <contents><target name="magecommunity"><dir name="Simtech"><dir name="Searchanise"><dir name="Block"><file name="Async.php" hash="973ab1c442dc6ebe91565d313387d2f6"/><file name="Autocomplete.php" hash="efc89ac3f897be3bc307fba6a36778f0"/><file name="Jsinit.php" hash="71ba588cf3f94768a76fca4f52c563e9"/><dir name="Product"><dir name="List"><file name="Toolbar.php" hash="7191058de95d20a86b65c27b3c73b064"/></dir><file name="Result.php" hash="4e767e273ee21a38332ac226af878291"/></dir><file name="Result.php" hash="dec7b27ab9511c956680eb60eba9b95e"/></dir><dir name="Helper"><file name="ApiSe.php" hash="c1f3fda5d9096518890d817067ee5a47"/><file name="ApiXML.php" hash="ec9ec4a2a937ed15c8084f921b827193"/><file name="Data.php" hash="8eefead1610d937cf9470ec45c364781"/></dir><dir name="Model"><file name="Advanced.php" hash="2a22ebcf7ac75b54681ef8a27bad2e47"/><dir name="Config"><file name="Data.php" hash="ddc558d22208f0ebc1e4378c9d050022"/></dir><file name="Config.php" hash="00ca3c7955f3ff2283c636a2074b6f03"/><dir name="Import"><dir name="Entity"><file name="Product.php" hash="4997af528b36f0f576d1c01402e14b03"/></dir></dir><dir name="Layer"><dir name="Filter"><file name="Category.php" hash="e290ab29f2d50e1acbbbb37496150ea4"/><file name="Price.php" hash="743887b32bf012274ad8a371fff96411"/></dir></dir><file name="Layer.php" hash="3e8c975d649ae6e20fcc69d35779c97c"/><file name="LayerCatalogSearch.php" hash="61728092fdb9cf42490afacdc4e731fd"/><dir name="Mysql4"><dir name="Advanced"><file name="Collection.php" hash="dd8c6f3cbb0621a5a7320f3104e68da6"/></dir><dir name="Config"><file name="Collection.php" hash="470218c1eb3f1cc1ca0e6d0e93e1b097"/></dir><file name="Config.php" hash="c95dc8ecd7ab4f955b6eaf4710ab960e"/><dir name="Fulltext"><file name="Collection.php" hash="5646955503a90020f87cfd861ac07e73"/></dir><dir name="Product"><file name="Collection.php" hash="28b478eb328502ce03e389404d9f54b5"/><file name="CollectionTag.php" hash="def509d1365374e6dede36be17e75bf3"/></dir><dir name="Queue"><file name="Collection.php" hash="30ca0f8640bdc443deb94cd2e71010c8"/></dir><file name="Queue.php" hash="286351623e8f011a21519f8d9c3e3151"/><file name="Store.php" hash="0126a4291d7dad6641bf59abb0f64cc4"/></dir><file name="Observer.php" hash="04178f446ade0ad2084922f1b0815fe6"/><file name="Queue.php" hash="4906e1669bac61e66f3d690c646c9ba3"/><file name="Request.php" hash="581cda79900b00e16610d0ac679dc02b"/><dir name="Resource"><dir name="Advanced"><file name="Collection.php" hash="12933839daa74d17ac82fca89071bc0a"/></dir><dir name="Eav"><dir name="Mysql4"><dir name="Product"><file name="Action.php" hash="006e3c8c775cf31a8b9c66fb934c9d2d"/></dir></dir></dir><dir name="Fulltext"><file name="Collection.php" hash="b9e2e4884a7ecee0000e6a41c0e6d3e2"/></dir><file name="Fulltext.php" hash="e9ea5b1ea7a2a5bc38d89f519e12347a"/><dir name="Layer"><dir name="Filter"><file name="Attribute.php" hash="4fd102cb09e8e80e50f9cbf1f621adbb"/><file name="Price.php" hash="0b3302f2d99f5f0d62d7fcd705825db0"/></dir></dir><dir name="Product"><file name="Collection.php" hash="6072bf2a7a4713f3db2fa96014e7453a"/><file name="CollectionTag.php" hash="e89307da7c26ee153c3f9dead94dcd13"/></dir><file name="Store.php" hash="8dd81bf57d38af2b4640bbf14063d3f8"/></dir><file name="Searchanise.php" hash="165cf4d8bfad9b53501376e367c0388c"/><dir name="System"><dir name="Config"><dir name="Source"><dir name="Searchanise"><file name="TypeAsync.php" hash="11d1aa481094ccbeab365b1fed33440d"/></dir></dir></dir></dir><dir name="Tag"><file name="Relation.php" hash="598f81fd8b2ac77baf24211c2ed03e55"/></dir></dir><dir name="controllers"><file name="AdvancedController.php" hash="7500f6075382cd8a14816e424da2348f"/><file name="AsyncController.php" hash="f652d0034b42fca3f38f215b869183ac"/><file name="CategoryController.php" hash="909f99c5cf7f85405fc76ebe976c2c8e"/><file name="IndexController.php" hash="e3234ca51a7669741e29ff7c38789989"/><file name="InfoController.php" hash="2dd9fd33883fca3010989d5f468cccf3"/><file name="OptionsController.php" hash="56785c8ea24472c2047268b2d9e8e878"/><file name="ProductController.php" hash="6633fde99f35ffeaa05884f0e0d98da7"/><file name="ResultController.php" hash="434b72272ebb222f775b8010f72ffdde"/><file name="ResyncController.php" hash="0612f929d375427326821dfc12186be8"/><file name="SignupController.php" hash="80f87a63d6272f98a068dde35f1d140e"/></dir><dir name="etc"><file name="config.xml" hash="b934796e46d8682af31b801303b5f4e3"/><file name="system.xml" hash="881fb083ae8711b7dadadd6ab954f764"/></dir><dir name="sql"><dir name="searchanise_setup"><file name="mysql4-install-0.1.0.php" hash="36781ba462935d4026358fb3a1f7c842"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="searchanise"><file name="dashboard.phtml" hash="c76131581bb8dfc21a1f9aa492179b01"/></dir></dir><dir name="layout"><file name="searchanise.xml" hash="1eaff51919b0b8c227fdf1b975ebe6b2"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="searchanise.xml" hash="9a1338f1522adad70042119c25ab64d9"/></dir></dir></dir><dir name="default"><dir name="default"><dir name="template"><dir name="catalogsearch"><file name="form.mini.phtml" hash="937e73ae35afdf220d96132e3ee13424"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Simtech_Searchanise.xml" hash="04148681a6648bd370ab62140cbf2ad9"/></dir></target><target name="magelocale"><dir name="en_US"><file name="Simtech_Searchanise.csv" hash="1bdb7fddc596dac1460bc3054c425187"/></dir></target></contents>
20
  <compatible/>
21
  <dependencies><required><php><min>5.2.13</min><max>6.0.0</max></php></required></dependencies>
22
  </package>