Version Notes
[+] Search results widget was added.
[+] Notice about a new version of extension was added.
[*] Compatibility with third-party addons was improved.
[*] Indexation status check was improved.
[*] Redundant product attributes are no longer collected.
[!] Searching by a product title and description could show incorrect search results on the advanced search page. Fixed.
Download this release
Release Info
| Developer | Simbirsk Technologies, Ltd. |
| Extension | Simtech_Searchanise |
| Version | 3.1.1 |
| Comparing to | |
| See all releases | |
Code changes from version 3.1.0 to 3.1.1
- app/code/community/Simtech/Searchanise/Block/Jsinit.php +10 -7
- app/code/community/Simtech/Searchanise/Block/Product/List/Toolbar.php +1 -18
- app/code/community/Simtech/Searchanise/Block/Resultwidget.php +41 -0
- app/code/community/Simtech/Searchanise/Helper/ApiCategories.php +15 -24
- app/code/community/Simtech/Searchanise/Helper/ApiProducts.php +105 -188
- app/code/community/Simtech/Searchanise/Helper/ApiSe.php +53 -67
- app/code/community/Simtech/Searchanise/Helper/Data.php +34 -58
- app/code/community/Simtech/Searchanise/Model/Layer/Filter/Category.php +0 -68
- app/code/community/Simtech/Searchanise/Model/Layer/Filter/Price.php +0 -51
- app/code/community/Simtech/Searchanise/Model/Observer.php +59 -0
- app/code/community/Simtech/Searchanise/Model/Queue.php +1 -0
- app/code/community/Simtech/Searchanise/Model/Request.php +8 -12
- app/code/community/Simtech/Searchanise/Model/Resource/Fulltext/Collection.php +32 -0
- app/code/community/Simtech/Searchanise/Model/Resource/Layer/Filter/Attribute.php +15 -4
- app/code/community/Simtech/Searchanise/Model/Searchanise.php +8 -15
- app/code/community/Simtech/Searchanise/controllers/InfoController.php +1 -3
- app/code/community/Simtech/Searchanise/controllers/ResultController.php +21 -0
- app/code/community/Simtech/Searchanise/etc/config.xml +25 -11
- app/code/community/Simtech/Searchanise/etc/config_without_search.xml +25 -12
- app/design/adminhtml/default/default/template/searchanise/dashboard.phtml +8 -2
- app/design/frontend/base/default/layout/searchanise.xml +18 -1
- app/design/frontend/base/default/template/searchanise/resultwidget.phtml +47 -0
- package.xml +10 -23
app/code/community/Simtech/Searchanise/Block/Jsinit.php
CHANGED
|
@@ -57,17 +57,11 @@ class Simtech_Searchanise_Block_Jsinit extends Mage_Core_Block_Text
|
|
| 57 |
$restrictBy = '';
|
| 58 |
|
| 59 |
$seServiceUrl = Mage::helper('searchanise/ApiSe')->getServiceUrl();
|
| 60 |
-
$priceFormat = Mage::helper('searchanise/ApiSe')->getPriceFormat($store);
|
| 61 |
$searchWidgetsLink = Mage::helper('searchanise/ApiSe')->getSearchWidgetsLink(false);
|
| 62 |
|
| 63 |
$union .= " Searchanise.AutoCmpParams.union.price = {};";
|
| 64 |
$union .= " Searchanise.AutoCmpParams.union.price.min = '" . Mage::helper('searchanise/ApiSe')->getCurLabelForPricesUsergroup() . "';";
|
| 65 |
|
| 66 |
-
$minQuantityDecimals = Mage::helper('searchanise/ApiSe')->getMinQuantityDecimals();
|
| 67 |
-
if (!empty($minQuantityDecimals)) {
|
| 68 |
-
$restrictBy .= "Searchanise.AutoCmpParams.restrictBy.quantity_decimals = '{$minQuantityDecimals},';";
|
| 69 |
-
}
|
| 70 |
-
|
| 71 |
$showOutOfStock = Mage::getStoreConfigFlag(Mage_CatalogInventory_Helper_Data::XML_PATH_SHOW_OUT_OF_STOCK);
|
| 72 |
if ($showOutOfStock) {
|
| 73 |
// nothing
|
|
@@ -75,6 +69,7 @@ class Simtech_Searchanise_Block_Jsinit extends Mage_Core_Block_Text
|
|
| 75 |
$restrictBy .= "Searchanise.AutoCmpParams.restrictBy.is_in_stock = '1';";
|
| 76 |
}
|
| 77 |
|
|
|
|
| 78 |
$priceFormat['after'] = $priceFormat['after'] ? 'true' : 'false';
|
| 79 |
|
| 80 |
$html .=
|
|
@@ -95,6 +90,14 @@ class Simtech_Searchanise_Block_Jsinit extends Mage_Core_Block_Text
|
|
| 95 |
Searchanise.options = {};
|
| 96 |
Searchanise.AdditionalSearchInputs = '#name,#description,#sku';
|
| 97 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 98 |
Searchanise.options.PriceFormat = {
|
| 99 |
decimals_separator: '" . addslashes($priceFormat['decimals_separator']) . "',
|
| 100 |
thousands_separator: '" . addslashes($priceFormat['thousands_separator']) . "',
|
|
@@ -133,4 +136,4 @@ class Simtech_Searchanise_Block_Jsinit extends Mage_Core_Block_Text
|
|
| 133 |
|
| 134 |
return $html;
|
| 135 |
}
|
| 136 |
-
}
|
| 57 |
$restrictBy = '';
|
| 58 |
|
| 59 |
$seServiceUrl = Mage::helper('searchanise/ApiSe')->getServiceUrl();
|
|
|
|
| 60 |
$searchWidgetsLink = Mage::helper('searchanise/ApiSe')->getSearchWidgetsLink(false);
|
| 61 |
|
| 62 |
$union .= " Searchanise.AutoCmpParams.union.price = {};";
|
| 63 |
$union .= " Searchanise.AutoCmpParams.union.price.min = '" . Mage::helper('searchanise/ApiSe')->getCurLabelForPricesUsergroup() . "';";
|
| 64 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
$showOutOfStock = Mage::getStoreConfigFlag(Mage_CatalogInventory_Helper_Data::XML_PATH_SHOW_OUT_OF_STOCK);
|
| 66 |
if ($showOutOfStock) {
|
| 67 |
// nothing
|
| 69 |
$restrictBy .= "Searchanise.AutoCmpParams.restrictBy.is_in_stock = '1';";
|
| 70 |
}
|
| 71 |
|
| 72 |
+
$priceFormat = Mage::helper('searchanise/ApiSe')->getPriceFormat($store);
|
| 73 |
$priceFormat['after'] = $priceFormat['after'] ? 'true' : 'false';
|
| 74 |
|
| 75 |
$html .=
|
| 90 |
Searchanise.options = {};
|
| 91 |
Searchanise.AdditionalSearchInputs = '#name,#description,#sku';
|
| 92 |
|
| 93 |
+
Searchanise.options.ResultsDiv = '#snize_results';
|
| 94 |
+
Searchanise.options.ResultsFormPath = '" . Mage::helper('searchanise')->getResultsFormPath() . "';
|
| 95 |
+
Searchanise.options.ResultsFallbackUrl = '" . $this->getUrl('catalogsearch/result') . "?q=';
|
| 96 |
+
Searchanise.ResultsParams = {};
|
| 97 |
+
Searchanise.ResultsParams.facetBy = {};
|
| 98 |
+
Searchanise.ResultsParams.facetBy.price = {};
|
| 99 |
+
Searchanise.ResultsParams.facetBy.price.type = 'slider';
|
| 100 |
+
|
| 101 |
Searchanise.options.PriceFormat = {
|
| 102 |
decimals_separator: '" . addslashes($priceFormat['decimals_separator']) . "',
|
| 103 |
thousands_separator: '" . addslashes($priceFormat['thousands_separator']) . "',
|
| 136 |
|
| 137 |
return $html;
|
| 138 |
}
|
| 139 |
+
}
|
app/code/community/Simtech/Searchanise/Block/Product/List/Toolbar.php
CHANGED
|
@@ -170,23 +170,6 @@ class Simtech_Searchanise_Block_Product_List_Toolbar extends Mage_Catalog_Block_
|
|
| 170 |
return 1;
|
| 171 |
}
|
| 172 |
|
| 173 |
-
public function getTotalNum()
|
| 174 |
-
{
|
| 175 |
-
if (!Mage::helper('searchanise/ApiSe')->checkSearchaniseResult(true)) {
|
| 176 |
-
return parent::getTotalNum();
|
| 177 |
-
}
|
| 178 |
-
|
| 179 |
-
$collection = $this->getCollection();
|
| 180 |
-
|
| 181 |
-
if ((!method_exists($collection, 'checkSearchaniseResult')) || (!$collection->checkSearchaniseResult())) {
|
| 182 |
-
return parent::getTotalNum();
|
| 183 |
-
}
|
| 184 |
-
|
| 185 |
-
return $collection
|
| 186 |
-
->getSearchaniseRequest()
|
| 187 |
-
->getTotalProduct();
|
| 188 |
-
}
|
| 189 |
-
|
| 190 |
public function setCollection($collection)
|
| 191 |
{
|
| 192 |
if (!Mage::helper('searchanise/ApiSe')->checkSearchaniseResult(true)) {
|
|
@@ -217,4 +200,4 @@ class Simtech_Searchanise_Block_Product_List_Toolbar extends Mage_Catalog_Block_
|
|
| 217 |
|
| 218 |
return $this;
|
| 219 |
}
|
| 220 |
-
}
|
| 170 |
return 1;
|
| 171 |
}
|
| 172 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 173 |
public function setCollection($collection)
|
| 174 |
{
|
| 175 |
if (!Mage::helper('searchanise/ApiSe')->checkSearchaniseResult(true)) {
|
| 200 |
|
| 201 |
return $this;
|
| 202 |
}
|
| 203 |
+
}
|
app/code/community/Simtech/Searchanise/Block/Resultwidget.php
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
class Simtech_Searchanise_Block_Resultwidget extends Mage_Core_Block_Template
|
| 15 |
+
{
|
| 16 |
+
|
| 17 |
+
/**
|
| 18 |
+
* Prepare layout
|
| 19 |
+
*
|
| 20 |
+
* @return Simtech_Searchanise_Block_Searchresult
|
| 21 |
+
*/
|
| 22 |
+
protected function _prepareLayout()
|
| 23 |
+
{
|
| 24 |
+
$breadcrumbs = $this->getLayout()->getBlock('breadcrumbs');
|
| 25 |
+
if ($breadcrumbs) {
|
| 26 |
+
$title = $this->__("Search results");
|
| 27 |
+
|
| 28 |
+
$breadcrumbs->addCrumb('home', array(
|
| 29 |
+
'label' => $this->__('Home'),
|
| 30 |
+
'title' => $this->__('Go to Home Page'),
|
| 31 |
+
'link' => Mage::getBaseUrl()
|
| 32 |
+
))->addCrumb('searchanise', array(
|
| 33 |
+
'label' => $title,
|
| 34 |
+
'title' => $title
|
| 35 |
+
));
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
return parent::_prepareLayout();
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
}
|
app/code/community/Simtech/Searchanise/Helper/ApiCategories.php
CHANGED
|
@@ -196,33 +196,24 @@ class Simtech_Searchanise_Helper_ApiCategories extends Mage_Core_Helper_Data
|
|
| 196 |
return $arrCategories;
|
| 197 |
}
|
| 198 |
|
| 199 |
-
|
| 200 |
-
*
|
| 201 |
-
*
|
| 202 |
-
* @param array $arr_cat
|
| 203 |
-
* @param Mage_Catalog_Model_Category $category
|
| 204 |
-
* @return array
|
| 205 |
-
*/
|
| 206 |
-
public static function getAllChildrenCategories(&$arr_cat, $category, $fl_include_cur_cat = true)
|
| 207 |
{
|
| 208 |
-
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
$
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
foreach ($children_cat as $cat) {
|
| 221 |
-
self::getAllChildrenCategories($arr_cat, $cat, $fl_include_cur_cat);
|
| 222 |
}
|
| 223 |
}
|
| 224 |
}
|
| 225 |
-
|
| 226 |
-
return $
|
| 227 |
}
|
| 228 |
}
|
| 196 |
return $arrCategories;
|
| 197 |
}
|
| 198 |
|
| 199 |
+
public static function getAllChildrenCategories($catId)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 200 |
{
|
| 201 |
+
$categoryIds = array();
|
| 202 |
+
$categories = Mage::getModel('catalog/category')
|
| 203 |
+
->getCollection()
|
| 204 |
+
->setStoreId(Mage::app()->getStore()->getId())
|
| 205 |
+
->addFieldToFilter('entity_id', $catId)
|
| 206 |
+
->load()
|
| 207 |
+
;
|
| 208 |
+
|
| 209 |
+
if (!empty($categories)) {
|
| 210 |
+
foreach ($categories as $cat) {
|
| 211 |
+
if (!empty($cat)) {
|
| 212 |
+
$categoryIds = $cat->getAllChildren(true);
|
|
|
|
|
|
|
| 213 |
}
|
| 214 |
}
|
| 215 |
}
|
| 216 |
+
|
| 217 |
+
return $categoryIds;
|
| 218 |
}
|
| 219 |
}
|
app/code/community/Simtech/Searchanise/Helper/ApiProducts.php
CHANGED
|
@@ -14,6 +14,7 @@
|
|
| 14 |
|
| 15 |
class Simtech_Searchanise_Helper_ApiProducts extends Mage_Core_Helper_Data
|
| 16 |
{
|
|
|
|
| 17 |
const WEIGHT_SHORT_DESCRIPTION = 40;
|
| 18 |
const WEIGHT_DESCRIPTION = 40;
|
| 19 |
const WEIGHT_DESCRIPTION_GROUPED = 30;
|
|
@@ -445,7 +446,7 @@ class Simtech_Searchanise_Helper_ApiProducts extends Mage_Core_Helper_Data
|
|
| 445 |
if (!isset($arrTextValues[$key]) && !is_null($product->getData($attributeCode))) {
|
| 446 |
$values = array();
|
| 447 |
// Dependency of store already exists
|
| 448 |
-
$textValues = $product->getResource()->getAttribute($attributeCode)->getFrontend()->getValue($product);
|
| 449 |
|
| 450 |
if ($textValues != '') {
|
| 451 |
if ($inputType == 'multiselect') {
|
|
@@ -491,9 +492,6 @@ class Simtech_Searchanise_Helper_ApiProducts extends Mage_Core_Helper_Data
|
|
| 491 |
} elseif (is_array($value) && empty($value)) {
|
| 492 |
// Nothing.
|
| 493 |
|
| 494 |
-
} elseif ($productKey == 0 && ($attributeCode == 'name' || $attributeCode == 'sku')) {// $productKey=0 - parent product
|
| 495 |
-
// Nothing. Prevent dublicate.
|
| 496 |
-
|
| 497 |
} else {
|
| 498 |
if (!in_array($value, $values)) {
|
| 499 |
$values[] = $value;
|
|
@@ -547,7 +545,7 @@ class Simtech_Searchanise_Helper_ApiProducts extends Mage_Core_Helper_Data
|
|
| 547 |
private static function _generateProductAttributes(&$item, $product, $childrenProducts = null, $unitedProducts = null, $store = null)
|
| 548 |
{
|
| 549 |
$attributes = self::getProductAttributes(Simtech_Searchanise_Model_Queue::NOT_DATA, $store);
|
| 550 |
-
|
| 551 |
if ($attributes) {
|
| 552 |
$requiredAttributes = self::_getRequiredAttributes();
|
| 553 |
$useFullFeed = Mage::helper('searchanise/ApiSe')->getUseFullFeed();
|
|
@@ -597,29 +595,16 @@ class Simtech_Searchanise_Helper_ApiProducts extends Mage_Core_Helper_Data
|
|
| 597 |
} elseif ($attributeCode == 'group_price') {
|
| 598 |
// nothing
|
| 599 |
// fixme in the future if need
|
| 600 |
-
|
| 601 |
-
} elseif ($attributeCode == 'short_description') {
|
| 602 |
-
if (!empty($value)) {// if not empty value already sent in summary
|
| 603 |
-
if (count($unitedValues) > 1) {
|
| 604 |
-
$item[$attributeCode] = array_slice($unitedValues, 1);
|
| 605 |
-
}
|
| 606 |
-
|
| 607 |
-
} elseif (!empty($unitedValues)) {
|
| 608 |
-
$item[$attributeCode] = $unitedValues;
|
| 609 |
|
| 610 |
-
|
| 611 |
-
|
| 612 |
-
|
| 613 |
-
|
| 614 |
-
} elseif ($attributeCode == 'description') {//$product->getData('short_description')
|
| 615 |
-
$short_description = $product->getData('short_description');
|
| 616 |
-
|
| 617 |
-
if (!empty($short_description)) {
|
| 618 |
-
$item['full_description'] = $value;
|
| 619 |
}
|
| 620 |
|
|
|
|
|
|
|
| 621 |
if (count($unitedValues) > 1) {
|
| 622 |
-
$item['
|
| 623 |
}
|
| 624 |
|
| 625 |
} elseif (
|
|
@@ -634,11 +619,6 @@ class Simtech_Searchanise_Helper_ApiProducts extends Mage_Core_Helper_Data
|
|
| 634 |
$item[$attributeCode] = $unitedValues;
|
| 635 |
|
| 636 |
} elseif ($inputType == 'select' || $inputType == 'multiselect') {
|
| 637 |
-
// <id_values>
|
| 638 |
-
if ($useFullFeed || $isVisibleInAdvancedSearch || $usedForSortBy || $isFilterableInSearch) {
|
| 639 |
-
$item[$attributeName] = $unitedValues;
|
| 640 |
-
}
|
| 641 |
-
|
| 642 |
// <text_values>
|
| 643 |
$unitedTextValues = self::_getProductAttributeTextValues($unitedProducts, $attributeCode, $inputType, $store);
|
| 644 |
$item[$attributeCode] = $unitedTextValues;
|
|
@@ -688,96 +668,61 @@ class Simtech_Searchanise_Helper_ApiProducts extends Mage_Core_Helper_Data
|
|
| 688 |
|
| 689 |
$item['id'] = $product->getId();
|
| 690 |
$item['title'] = $product->getName();
|
| 691 |
-
|
| 692 |
-
$
|
| 693 |
-
|
| 694 |
-
if ($summary == '') {
|
| 695 |
-
$summary = $product->getData('description');
|
| 696 |
-
}
|
| 697 |
-
|
| 698 |
-
$item['summary'] = $summary;
|
| 699 |
-
|
| 700 |
-
$productUrl = $product->getProductUrl(false);
|
| 701 |
-
$item['link'] = $productUrl;
|
| 702 |
$item['product_code'] = $product->getSku();
|
| 703 |
|
| 704 |
self::_generateProductPrices($item, $product, $childrenProducts, $store);
|
| 705 |
|
| 706 |
-
|
| 707 |
-
|
| 708 |
-
|
| 709 |
|
| 710 |
-
|
| 711 |
-
|
| 712 |
-
|
| 713 |
-
$
|
| 714 |
-
|
|
|
|
| 715 |
}
|
| 716 |
-
// </quantity>
|
| 717 |
-
|
| 718 |
-
// <image_link>
|
| 719 |
-
{
|
| 720 |
-
// Show images without white field
|
| 721 |
-
// Example: image 360 x 535 => 47 х 70
|
| 722 |
-
$flagKeepFrame = false;
|
| 723 |
-
$image = self::getProductImageLink($product, $flagKeepFrame);
|
| 724 |
-
|
| 725 |
-
if ($image) {
|
| 726 |
-
$imageLink = '' . $image;
|
| 727 |
|
| 728 |
-
|
| 729 |
-
|
| 730 |
-
|
|
|
|
|
|
|
| 731 |
}
|
| 732 |
}
|
| 733 |
-
|
| 734 |
-
|
| 735 |
self::_generateProductAttributes($item, $product, $childrenProducts, $unitedProducts, $store);
|
| 736 |
|
| 737 |
-
|
| 738 |
-
{
|
| 739 |
-
|
| 740 |
-
$categoryIds
|
| 741 |
-
|
| 742 |
-
|
| 743 |
-
|
| 744 |
-
foreach ($categoryIds as $catKey => $categoryId) {
|
| 745 |
-
// fixme int the future
|
| 746 |
-
// check value for other language
|
| 747 |
-
$category = Mage::getModel('catalog/category')->load($categoryId);
|
| 748 |
-
if ($category) {
|
| 749 |
-
$categoryNames[] = $category->getName();
|
| 750 |
-
}
|
| 751 |
}
|
| 752 |
-
|
| 753 |
-
$item['category_ids'] = $categoryIds;
|
| 754 |
-
$item['categories'] = $categoryNames;
|
| 755 |
}
|
| 756 |
-
}
|
| 757 |
-
// </categories>
|
| 758 |
|
| 759 |
-
|
| 760 |
-
|
| 761 |
-
|
| 762 |
-
$tagNames = array();
|
| 763 |
|
| 764 |
-
|
| 765 |
-
|
| 766 |
-
|
| 767 |
-
|
| 768 |
-
|
| 769 |
-
|
| 770 |
-
$tagNames[] = $tag->getName();
|
| 771 |
-
}
|
| 772 |
}
|
| 773 |
}
|
|
|
|
| 774 |
|
| 775 |
-
|
| 776 |
-
|
| 777 |
-
$item['tags'] = $tagNames;
|
| 778 |
-
}
|
| 779 |
}
|
| 780 |
-
// </tags>
|
| 781 |
|
| 782 |
return $item;
|
| 783 |
}
|
|
@@ -842,18 +787,9 @@ class Simtech_Searchanise_Helper_ApiProducts extends Mage_Core_Helper_Data
|
|
| 842 |
}
|
| 843 |
|
| 844 |
if (isset($item['type'])) {
|
| 845 |
-
$item['title'] = $attribute->
|
| 846 |
-
$item['position']
|
| 847 |
-
|
| 848 |
-
$attributeCode = $attribute->getAttributeCode();
|
| 849 |
-
|
| 850 |
-
if ($attributeCode == 'price') {
|
| 851 |
-
$labelAttribute = 'price';
|
| 852 |
-
} else {
|
| 853 |
-
$labelAttribute = 'attribute_' . $attribute->getId();
|
| 854 |
-
}
|
| 855 |
-
|
| 856 |
-
$item['attribute'] = $labelAttribute;
|
| 857 |
}
|
| 858 |
}
|
| 859 |
|
|
@@ -1135,20 +1071,14 @@ class Simtech_Searchanise_Helper_ApiProducts extends Mage_Core_Helper_Data
|
|
| 1135 |
|
| 1136 |
private static function _getRequiredAttributes()
|
| 1137 |
{
|
| 1138 |
-
|
| 1139 |
-
|
| 1140 |
-
|
| 1141 |
-
|
| 1142 |
-
|
| 1143 |
-
'visibility',
|
| 1144 |
-
'price',
|
| 1145 |
-
);
|
| 1146 |
-
}
|
| 1147 |
-
|
| 1148 |
-
return $requiredAttributes;
|
| 1149 |
}
|
| 1150 |
|
| 1151 |
-
public static function getSchemaAttribute($attribute)
|
| 1152 |
{
|
| 1153 |
$items = array();
|
| 1154 |
|
|
@@ -1169,9 +1099,9 @@ class Simtech_Searchanise_Helper_ApiProducts extends Mage_Core_Helper_Data
|
|
| 1169 |
return $items;
|
| 1170 |
}
|
| 1171 |
|
| 1172 |
-
$name = $attribute->getAttributeCode();
|
| 1173 |
-
$title = $attribute->getData('frontend_label');
|
| 1174 |
$type = '';
|
|
|
|
|
|
|
| 1175 |
$sorting = $usedForSortBy ? 'Y' : 'N';
|
| 1176 |
$textSearch = $isSearchable ? 'Y' : 'N';
|
| 1177 |
$attributeWeight = 0;
|
|
@@ -1184,6 +1114,7 @@ class Simtech_Searchanise_Helper_ApiProducts extends Mage_Core_Helper_Data
|
|
| 1184 |
} elseif ($attributeCode == 'status' || $attributeCode == 'visibility') {
|
| 1185 |
$type = 'text';
|
| 1186 |
$textSearch = 'N';
|
|
|
|
| 1187 |
} elseif ($attributeCode == 'has_options') {
|
| 1188 |
} elseif ($attributeCode == 'required_options') {
|
| 1189 |
} elseif ($attributeCode == 'custom_layout_update') {
|
|
@@ -1193,11 +1124,16 @@ class Simtech_Searchanise_Helper_ApiProducts extends Mage_Core_Helper_Data
|
|
| 1193 |
} elseif ($attributeCode == 'thumbnail_label') {
|
| 1194 |
} elseif ($attributeCode == 'tax_class_id') {
|
| 1195 |
} elseif ($attributeCode == 'url_key') { // seo name
|
|
|
|
| 1196 |
// <system_attributes>
|
| 1197 |
|
| 1198 |
-
} elseif ($attributeCode == '
|
| 1199 |
-
|
| 1200 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1201 |
} elseif (
|
| 1202 |
$attributeCode == 'short_description' ||
|
| 1203 |
$attributeCode == 'description' ||
|
|
@@ -1206,9 +1142,7 @@ class Simtech_Searchanise_Helper_ApiProducts extends Mage_Core_Helper_Data
|
|
| 1206 |
$attributeCode == 'meta_keyword') {
|
| 1207 |
|
| 1208 |
if ($isSearchable) {
|
| 1209 |
-
if ($attributeCode == '
|
| 1210 |
-
$attributeWeight = self::WEIGHT_SHORT_DESCRIPTION;
|
| 1211 |
-
} elseif ($attributeCode == 'description') {
|
| 1212 |
$attributeWeight = self::WEIGHT_DESCRIPTION;
|
| 1213 |
} elseif ($attributeCode == 'meta_title') {
|
| 1214 |
$attributeWeight = self::WEIGHT_META_TITLE;
|
|
@@ -1224,8 +1158,8 @@ class Simtech_Searchanise_Helper_ApiProducts extends Mage_Core_Helper_Data
|
|
| 1224 |
if ($attributeCode == 'description') {
|
| 1225 |
$name = 'full_description';
|
| 1226 |
$items[] = array(
|
| 1227 |
-
'name' => '
|
| 1228 |
-
'title' => $attribute->
|
| 1229 |
'type' => $type,
|
| 1230 |
'weight' => $isSearchable ? self:: WEIGHT_DESCRIPTION_GROUPED : 0,
|
| 1231 |
'text_search' => $textSearch,
|
|
@@ -1237,18 +1171,7 @@ class Simtech_Searchanise_Helper_ApiProducts extends Mage_Core_Helper_Data
|
|
| 1237 |
|
| 1238 |
} elseif ($inputType == 'select' || $inputType == 'multiselect') {
|
| 1239 |
$type = 'text';
|
| 1240 |
-
$
|
| 1241 |
-
'name' => $name,
|
| 1242 |
-
'title' => $title,
|
| 1243 |
-
'type' => $type,
|
| 1244 |
-
'sorting' => $sorting,
|
| 1245 |
-
'weight' => $isSearchable ? self::WEIGHT_SELECT_ATTRIBUTES : 0,
|
| 1246 |
-
'text_search' => $textSearch,
|
| 1247 |
-
);
|
| 1248 |
-
$name = $attributeName;
|
| 1249 |
-
$title = $title . ' - IDs';
|
| 1250 |
-
$sorting = 'N';
|
| 1251 |
-
$textSearch = 'N';
|
| 1252 |
|
| 1253 |
} elseif ($inputType == 'text' || $inputType == 'textarea') {
|
| 1254 |
if ($isSearchable) {
|
|
@@ -1285,6 +1208,7 @@ class Simtech_Searchanise_Helper_ApiProducts extends Mage_Core_Helper_Data
|
|
| 1285 |
if ($facet = self::_generateFacetFromFilter($attribute)) {
|
| 1286 |
$item['facet'] = $facet;
|
| 1287 |
}
|
|
|
|
| 1288 |
$items[] = $item;
|
| 1289 |
}
|
| 1290 |
|
|
@@ -1314,70 +1238,68 @@ class Simtech_Searchanise_Helper_ApiProducts extends Mage_Core_Helper_Data
|
|
| 1314 |
return $items;
|
| 1315 |
}
|
| 1316 |
|
| 1317 |
-
public static function getSchemaCategories()
|
| 1318 |
{
|
| 1319 |
-
|
| 1320 |
-
|
| 1321 |
-
|
| 1322 |
-
$items[] = array(
|
| 1323 |
'name' => 'categories',
|
| 1324 |
-
'title' => '
|
| 1325 |
'type' => 'text',
|
| 1326 |
'weight' => self::WEIGHT_CATEGORIES,
|
| 1327 |
'text_search' => 'Y',
|
|
|
|
| 1328 |
);
|
| 1329 |
-
|
| 1330 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1331 |
'name' => 'category_ids',
|
| 1332 |
-
'title' => '
|
| 1333 |
'type' => 'text',
|
| 1334 |
'weight' => 0,
|
| 1335 |
'text_search' => 'N',
|
| 1336 |
-
'facet' => self::_generateFacetFromCustom('Category',
|
| 1337 |
);
|
| 1338 |
}
|
| 1339 |
-
|
|
|
|
| 1340 |
}
|
| 1341 |
|
| 1342 |
public static function getSchemaTags()
|
| 1343 |
{
|
| 1344 |
-
|
| 1345 |
-
|
| 1346 |
-
if (!isset($items)) {
|
| 1347 |
-
$items[] = array(
|
| 1348 |
'name' => 'tags',
|
| 1349 |
-
'title' => 'Tags',
|
| 1350 |
'type' => 'text',
|
| 1351 |
'weight' => self::WEIGHT_TAGS,
|
| 1352 |
'text_search' => 'Y',
|
| 1353 |
-
)
|
| 1354 |
-
|
| 1355 |
-
$items[] = array(
|
| 1356 |
-
'name' => 'tag_ids',
|
| 1357 |
-
'title' => 'Tags - IDs',
|
| 1358 |
-
'type' => 'text',
|
| 1359 |
-
'weight' => 0,
|
| 1360 |
-
'text_search' => 'N',
|
| 1361 |
-
'facet' => self::_generateFacetFromCustom('Tag', 0, 'tag_ids', 'select'),
|
| 1362 |
-
);
|
| 1363 |
-
}
|
| 1364 |
-
return $items;
|
| 1365 |
}
|
| 1366 |
|
| 1367 |
-
public static function getSchema($attributeIds = Simtech_Searchanise_Model_Queue::NOT_DATA, $store
|
| 1368 |
{
|
| 1369 |
-
static $
|
| 1370 |
|
| 1371 |
-
if (isset($
|
| 1372 |
-
return $
|
| 1373 |
}
|
| 1374 |
|
|
|
|
|
|
|
| 1375 |
$schema = array();
|
| 1376 |
|
| 1377 |
if ($attributeIds === Simtech_Searchanise_Model_Queue::NOT_DATA) {
|
| 1378 |
$schema = self::getSchemaCustomerGroupsPrices();
|
| 1379 |
|
| 1380 |
-
if ($items = self::getSchemaCategories()) {
|
| 1381 |
foreach ($items as $keyItem => $item) {
|
| 1382 |
$schema[] = $item;
|
| 1383 |
}
|
|
@@ -1390,14 +1312,7 @@ class Simtech_Searchanise_Helper_ApiProducts extends Mage_Core_Helper_Data
|
|
| 1390 |
}
|
| 1391 |
$schema[] = array(
|
| 1392 |
'name' => 'is_in_stock',
|
| 1393 |
-
'title' => 'Stock Availability',
|
| 1394 |
-
'type' => 'text',
|
| 1395 |
-
'weight' => 0,
|
| 1396 |
-
'text_search' => 'N',
|
| 1397 |
-
);
|
| 1398 |
-
$schema[] = array(
|
| 1399 |
-
'name' => 'quantity_decimals',
|
| 1400 |
-
'title' => 'Quantity - decimals',
|
| 1401 |
'type' => 'text',
|
| 1402 |
'weight' => 0,
|
| 1403 |
'text_search' => 'N',
|
|
@@ -1406,7 +1321,7 @@ class Simtech_Searchanise_Helper_ApiProducts extends Mage_Core_Helper_Data
|
|
| 1406 |
|
| 1407 |
if ($attributes = self::getProductAttributes($attributeIds, $store, $isPrice)) {
|
| 1408 |
foreach ($attributes as $attribute) {
|
| 1409 |
-
if ($items = self::getSchemaAttribute($attribute)) {
|
| 1410 |
foreach ($items as $keyItem => $item) {
|
| 1411 |
$schema[] = $item;
|
| 1412 |
}
|
|
@@ -1414,6 +1329,8 @@ class Simtech_Searchanise_Helper_ApiProducts extends Mage_Core_Helper_Data
|
|
| 1414 |
}
|
| 1415 |
}
|
| 1416 |
|
|
|
|
|
|
|
| 1417 |
return $schema;
|
| 1418 |
}
|
| 1419 |
|
| 14 |
|
| 15 |
class Simtech_Searchanise_Helper_ApiProducts extends Mage_Core_Helper_Data
|
| 16 |
{
|
| 17 |
+
const WEIGHT_SHORT_TITLE = 100;
|
| 18 |
const WEIGHT_SHORT_DESCRIPTION = 40;
|
| 19 |
const WEIGHT_DESCRIPTION = 40;
|
| 20 |
const WEIGHT_DESCRIPTION_GROUPED = 30;
|
| 446 |
if (!isset($arrTextValues[$key]) && !is_null($product->getData($attributeCode))) {
|
| 447 |
$values = array();
|
| 448 |
// Dependency of store already exists
|
| 449 |
+
$textValues = $product->getResource()->getAttribute($attributeCode)->setStoreId($store->getId())->getFrontend()->getValue($product);
|
| 450 |
|
| 451 |
if ($textValues != '') {
|
| 452 |
if ($inputType == 'multiselect') {
|
| 492 |
} elseif (is_array($value) && empty($value)) {
|
| 493 |
// Nothing.
|
| 494 |
|
|
|
|
|
|
|
|
|
|
| 495 |
} else {
|
| 496 |
if (!in_array($value, $values)) {
|
| 497 |
$values[] = $value;
|
| 545 |
private static function _generateProductAttributes(&$item, $product, $childrenProducts = null, $unitedProducts = null, $store = null)
|
| 546 |
{
|
| 547 |
$attributes = self::getProductAttributes(Simtech_Searchanise_Model_Queue::NOT_DATA, $store);
|
| 548 |
+
|
| 549 |
if ($attributes) {
|
| 550 |
$requiredAttributes = self::_getRequiredAttributes();
|
| 551 |
$useFullFeed = Mage::helper('searchanise/ApiSe')->getUseFullFeed();
|
| 595 |
} elseif ($attributeCode == 'group_price') {
|
| 596 |
// nothing
|
| 597 |
// fixme in the future if need
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 598 |
|
| 599 |
+
} elseif ($attributeCode == 'short_description' || $attributeCode == 'name' || $attributeCode == 'sku') {
|
| 600 |
+
if (count($unitedValues) > 1) {
|
| 601 |
+
$item['se_grouped_' . $attributeCode] = array_slice($unitedValues, 1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 602 |
}
|
| 603 |
|
| 604 |
+
} elseif ($attributeCode == 'description') {
|
| 605 |
+
$item['full_description'] = $value;
|
| 606 |
if (count($unitedValues) > 1) {
|
| 607 |
+
$item['se_grouped_full_' . $attributeCode] = array_slice($unitedValues, 1);
|
| 608 |
}
|
| 609 |
|
| 610 |
} elseif (
|
| 619 |
$item[$attributeCode] = $unitedValues;
|
| 620 |
|
| 621 |
} elseif ($inputType == 'select' || $inputType == 'multiselect') {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 622 |
// <text_values>
|
| 623 |
$unitedTextValues = self::_getProductAttributeTextValues($unitedProducts, $attributeCode, $inputType, $store);
|
| 624 |
$item[$attributeCode] = $unitedTextValues;
|
| 668 |
|
| 669 |
$item['id'] = $product->getId();
|
| 670 |
$item['title'] = $product->getName();
|
| 671 |
+
$item['summary'] = $product->getData('short_description');
|
| 672 |
+
$item['link'] = $product->getProductUrl(false);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 673 |
$item['product_code'] = $product->getSku();
|
| 674 |
|
| 675 |
self::_generateProductPrices($item, $product, $childrenProducts, $store);
|
| 676 |
|
| 677 |
+
$quantity = self::getProductQty($product, $store, $unitedProducts);
|
| 678 |
+
$item['quantity'] = ceil($quantity);
|
| 679 |
+
$item['is_in_stock'] = $quantity > 0;
|
| 680 |
|
| 681 |
+
// Show images without white field
|
| 682 |
+
// Example: image 360 x 535 => 47 х 70
|
| 683 |
+
if (Mage::helper('searchanise/ApiSe')->getResultsWidgetEnabled($store)) {
|
| 684 |
+
$image = self::getProductImageLink($product, false, 160, 160);
|
| 685 |
+
} else {
|
| 686 |
+
$image = self::getProductImageLink($product, false, 70, 70);
|
| 687 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 688 |
|
| 689 |
+
if ($image) {
|
| 690 |
+
$imageLink = '' . $image;
|
| 691 |
+
|
| 692 |
+
if ($imageLink != '') {
|
| 693 |
+
$item['image_link'] = '' . $imageLink;
|
| 694 |
}
|
| 695 |
}
|
| 696 |
+
|
|
|
|
| 697 |
self::_generateProductAttributes($item, $product, $childrenProducts, $unitedProducts, $store);
|
| 698 |
|
| 699 |
+
$categoryIds = $product->getCategoryIds();
|
| 700 |
+
if (!empty($categoryIds)) {
|
| 701 |
+
$categoryNames = array();
|
| 702 |
+
foreach ($categoryIds as $catKey => $categoryId) {
|
| 703 |
+
$category = Mage::getModel('catalog/category')->load($categoryId);
|
| 704 |
+
if ($category) {
|
| 705 |
+
$categoryNames[] = $category->getName();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 706 |
}
|
|
|
|
|
|
|
|
|
|
| 707 |
}
|
|
|
|
|
|
|
| 708 |
|
| 709 |
+
$item['category_ids'] = $categoryIds;
|
| 710 |
+
$item['categories'] = $categoryNames;
|
| 711 |
+
}
|
|
|
|
| 712 |
|
| 713 |
+
$tagNames = array();
|
| 714 |
+
$tags = self::getTagCollection($product, $store);
|
| 715 |
+
if ($tags && count($tags) > 0) {
|
| 716 |
+
foreach ($tags as $tag) {
|
| 717 |
+
if ($tag) {
|
| 718 |
+
$tagNames[] = $tag->getName();
|
|
|
|
|
|
|
| 719 |
}
|
| 720 |
}
|
| 721 |
+
}
|
| 722 |
|
| 723 |
+
if (!empty($tagNames)) {
|
| 724 |
+
$item['tags'] = $tagNames;
|
|
|
|
|
|
|
| 725 |
}
|
|
|
|
| 726 |
|
| 727 |
return $item;
|
| 728 |
}
|
| 787 |
}
|
| 788 |
|
| 789 |
if (isset($item['type'])) {
|
| 790 |
+
$item['title'] = $attribute->getStoreLabel();
|
| 791 |
+
$item['position'] = ($inputType == 'price')? $attribute->getPosition() : $attribute->getPosition() + 20;
|
| 792 |
+
$item['attribute'] = $attribute->getAttributeCode();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 793 |
}
|
| 794 |
}
|
| 795 |
|
| 1071 |
|
| 1072 |
private static function _getRequiredAttributes()
|
| 1073 |
{
|
| 1074 |
+
return array(
|
| 1075 |
+
'status',
|
| 1076 |
+
'visibility',
|
| 1077 |
+
'price',
|
| 1078 |
+
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1079 |
}
|
| 1080 |
|
| 1081 |
+
public static function getSchemaAttribute($attribute, $store = null)
|
| 1082 |
{
|
| 1083 |
$items = array();
|
| 1084 |
|
| 1099 |
return $items;
|
| 1100 |
}
|
| 1101 |
|
|
|
|
|
|
|
| 1102 |
$type = '';
|
| 1103 |
+
$name = $attribute->getAttributeCode();
|
| 1104 |
+
$title = $attribute->getStoreLabel();
|
| 1105 |
$sorting = $usedForSortBy ? 'Y' : 'N';
|
| 1106 |
$textSearch = $isSearchable ? 'Y' : 'N';
|
| 1107 |
$attributeWeight = 0;
|
| 1114 |
} elseif ($attributeCode == 'status' || $attributeCode == 'visibility') {
|
| 1115 |
$type = 'text';
|
| 1116 |
$textSearch = 'N';
|
| 1117 |
+
|
| 1118 |
} elseif ($attributeCode == 'has_options') {
|
| 1119 |
} elseif ($attributeCode == 'required_options') {
|
| 1120 |
} elseif ($attributeCode == 'custom_layout_update') {
|
| 1124 |
} elseif ($attributeCode == 'thumbnail_label') {
|
| 1125 |
} elseif ($attributeCode == 'tax_class_id') {
|
| 1126 |
} elseif ($attributeCode == 'url_key') { // seo name
|
| 1127 |
+
} elseif ($attributeCode == 'group_price') {
|
| 1128 |
// <system_attributes>
|
| 1129 |
|
| 1130 |
+
} elseif ($attributeCode == 'name' || $attributeCode == 'sku' || $attributeCode == 'short_description') {
|
| 1131 |
+
$type = 'text';
|
| 1132 |
+
$name = 'se_grouped_' . $attributeCode;
|
| 1133 |
+
$sorting = 'N';
|
| 1134 |
+
$title = $attribute->getStoreLabel() . ' - Grouped';
|
| 1135 |
+
$attributeWeight = ($attributeCode == 'short_description')? self::WEIGHT_SHORT_DESCRIPTION : self::WEIGHT_SHORT_TITLE;
|
| 1136 |
+
|
| 1137 |
} elseif (
|
| 1138 |
$attributeCode == 'short_description' ||
|
| 1139 |
$attributeCode == 'description' ||
|
| 1142 |
$attributeCode == 'meta_keyword') {
|
| 1143 |
|
| 1144 |
if ($isSearchable) {
|
| 1145 |
+
if ($attributeCode == 'description') {
|
|
|
|
|
|
|
| 1146 |
$attributeWeight = self::WEIGHT_DESCRIPTION;
|
| 1147 |
} elseif ($attributeCode == 'meta_title') {
|
| 1148 |
$attributeWeight = self::WEIGHT_META_TITLE;
|
| 1158 |
if ($attributeCode == 'description') {
|
| 1159 |
$name = 'full_description';
|
| 1160 |
$items[] = array(
|
| 1161 |
+
'name' => 'se_grouped_full_' . $attributeCode,
|
| 1162 |
+
'title' => $attribute->getStoreLabel() . ' - Grouped',
|
| 1163 |
'type' => $type,
|
| 1164 |
'weight' => $isSearchable ? self:: WEIGHT_DESCRIPTION_GROUPED : 0,
|
| 1165 |
'text_search' => $textSearch,
|
| 1171 |
|
| 1172 |
} elseif ($inputType == 'select' || $inputType == 'multiselect') {
|
| 1173 |
$type = 'text';
|
| 1174 |
+
$attributeWeight = $isSearchable ? self::WEIGHT_SELECT_ATTRIBUTES : 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1175 |
|
| 1176 |
} elseif ($inputType == 'text' || $inputType == 'textarea') {
|
| 1177 |
if ($isSearchable) {
|
| 1208 |
if ($facet = self::_generateFacetFromFilter($attribute)) {
|
| 1209 |
$item['facet'] = $facet;
|
| 1210 |
}
|
| 1211 |
+
|
| 1212 |
$items[] = $item;
|
| 1213 |
}
|
| 1214 |
|
| 1238 |
return $items;
|
| 1239 |
}
|
| 1240 |
|
| 1241 |
+
public static function getSchemaCategories($store)
|
| 1242 |
{
|
| 1243 |
+
$category_schema = array();
|
| 1244 |
+
if (Mage::helper('searchanise/ApiSe')->getResultsWidgetEnabled($store)) {
|
| 1245 |
+
$category_schema[] = array(
|
|
|
|
| 1246 |
'name' => 'categories',
|
| 1247 |
+
'title' => Mage::helper('catalog')->__('Category'),
|
| 1248 |
'type' => 'text',
|
| 1249 |
'weight' => self::WEIGHT_CATEGORIES,
|
| 1250 |
'text_search' => 'Y',
|
| 1251 |
+
'facet' => self::_generateFacetFromCustom(Mage::helper('catalog')->__('Category'), 10, 'categories', 'select'),
|
| 1252 |
);
|
| 1253 |
+
} else {
|
| 1254 |
+
$category_schema[] = array(
|
| 1255 |
+
'name' => 'categories',
|
| 1256 |
+
'title' => Mage::helper('catalog')->__('Category'),
|
| 1257 |
+
'type' => 'text',
|
| 1258 |
+
'weight' => self::WEIGHT_CATEGORIES,
|
| 1259 |
+
'text_search' => 'Y',
|
| 1260 |
+
);
|
| 1261 |
+
$category_schema[] = array(
|
| 1262 |
'name' => 'category_ids',
|
| 1263 |
+
'title' => Mage::helper('catalog')->__('Category') . ' - IDs',
|
| 1264 |
'type' => 'text',
|
| 1265 |
'weight' => 0,
|
| 1266 |
'text_search' => 'N',
|
| 1267 |
+
'facet' => self::_generateFacetFromCustom(Mage::helper('catalog')->__('Category'), 10, 'category_ids', 'select'),
|
| 1268 |
);
|
| 1269 |
}
|
| 1270 |
+
|
| 1271 |
+
return $category_schema;
|
| 1272 |
}
|
| 1273 |
|
| 1274 |
public static function getSchemaTags()
|
| 1275 |
{
|
| 1276 |
+
return array(
|
| 1277 |
+
array(
|
|
|
|
|
|
|
| 1278 |
'name' => 'tags',
|
| 1279 |
+
'title' => Mage::helper('catalog')->__('Product Tags'),
|
| 1280 |
'type' => 'text',
|
| 1281 |
'weight' => self::WEIGHT_TAGS,
|
| 1282 |
'text_search' => 'Y',
|
| 1283 |
+
)
|
| 1284 |
+
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1285 |
}
|
| 1286 |
|
| 1287 |
+
public static function getSchema($attributeIds = Simtech_Searchanise_Model_Queue::NOT_DATA, $store, $isPrice = false)
|
| 1288 |
{
|
| 1289 |
+
static $schemas;
|
| 1290 |
|
| 1291 |
+
if (isset($schemas[$store->getId()])) {
|
| 1292 |
+
return $schemas[$store->getId()];
|
| 1293 |
}
|
| 1294 |
|
| 1295 |
+
Mage::app()->setCurrentStore($store->getId());
|
| 1296 |
+
|
| 1297 |
$schema = array();
|
| 1298 |
|
| 1299 |
if ($attributeIds === Simtech_Searchanise_Model_Queue::NOT_DATA) {
|
| 1300 |
$schema = self::getSchemaCustomerGroupsPrices();
|
| 1301 |
|
| 1302 |
+
if ($items = self::getSchemaCategories($store)) {
|
| 1303 |
foreach ($items as $keyItem => $item) {
|
| 1304 |
$schema[] = $item;
|
| 1305 |
}
|
| 1312 |
}
|
| 1313 |
$schema[] = array(
|
| 1314 |
'name' => 'is_in_stock',
|
| 1315 |
+
'title' => Mage::helper('catalog')->__('Stock Availability'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1316 |
'type' => 'text',
|
| 1317 |
'weight' => 0,
|
| 1318 |
'text_search' => 'N',
|
| 1321 |
|
| 1322 |
if ($attributes = self::getProductAttributes($attributeIds, $store, $isPrice)) {
|
| 1323 |
foreach ($attributes as $attribute) {
|
| 1324 |
+
if ($items = self::getSchemaAttribute($attribute, $store)) {
|
| 1325 |
foreach ($items as $keyItem => $item) {
|
| 1326 |
$schema[] = $item;
|
| 1327 |
}
|
| 1329 |
}
|
| 1330 |
}
|
| 1331 |
|
| 1332 |
+
$schemas[$store->getId()] = $schema;
|
| 1333 |
+
|
| 1334 |
return $schema;
|
| 1335 |
}
|
| 1336 |
|
app/code/community/Simtech/Searchanise/Helper/ApiSe.php
CHANGED
|
@@ -20,9 +20,6 @@ class Simtech_Searchanise_Helper_ApiSe
|
|
| 20 |
|
| 21 |
const MAX_PAGE_SIZE = 100; // The "All" variant of the items per page menu is replaced with this value if the "Allow All Products per Page" option is active.
|
| 22 |
|
| 23 |
-
// const MIN_QUANTITY_DECIMALS = '0.00001';
|
| 24 |
-
const MIN_QUANTITY_DECIMALS = ''; // not activated, because Server have floaf = decimal(12,2)
|
| 25 |
-
|
| 26 |
const SUGGESTIONS_MAX_RESULTS = 1;
|
| 27 |
const FLOAT_PRECISION = 2; // for server float = decimal(12,2)
|
| 28 |
const LABEL_FOR_PRICES_USERGROUP = 'se_price_';
|
|
@@ -137,10 +134,6 @@ class Simtech_Searchanise_Helper_ApiSe
|
|
| 137 |
return self::SUGGESTIONS_MAX_RESULTS;
|
| 138 |
}
|
| 139 |
|
| 140 |
-
public static function getMinQuantityDecimals() {
|
| 141 |
-
return self::MIN_QUANTITY_DECIMALS;
|
| 142 |
-
}
|
| 143 |
-
|
| 144 |
public static function getServiceUrl($onlyHttp = true)
|
| 145 |
{
|
| 146 |
$ret = self::getSetting('service_url');
|
|
@@ -207,6 +200,16 @@ class Simtech_Searchanise_Helper_ApiSe
|
|
| 207 |
return self::getSetting('use_full_feed', self::CONFIG_PREFIX);
|
| 208 |
}
|
| 209 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 210 |
public static function setLastRequest($value = null)
|
| 211 |
{
|
| 212 |
self::setSetting('last_request', $value, self::CONFIG_PREFIX);
|
|
@@ -634,10 +637,18 @@ class Simtech_Searchanise_Helper_ApiSe
|
|
| 634 |
|
| 635 |
public static function showNotificationAsyncCompleted()
|
| 636 |
{
|
| 637 |
-
if (self::
|
| 638 |
-
|
| 639 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 640 |
|
|
|
|
|
|
|
| 641 |
Mage::helper('searchanise/ApiSe')->setNotification('N', Mage::helper('searchanise')->__('Searchanise'), $textNotification);
|
| 642 |
self::setNotificationAsyncComleted(true);
|
| 643 |
}
|
|
@@ -942,7 +953,6 @@ class Simtech_Searchanise_Helper_ApiSe
|
|
| 942 |
|
| 943 |
public static function checkExportStatus($store = null)
|
| 944 |
{
|
| 945 |
-
self::checkImportIsDone($store);
|
| 946 |
return self::getExportStatus($store) == self::EXPORT_STATUS_DONE;
|
| 947 |
}
|
| 948 |
|
|
@@ -1400,25 +1410,29 @@ class Simtech_Searchanise_Helper_ApiSe
|
|
| 1400 |
);
|
| 1401 |
|
| 1402 |
Mage::getModel('searchanise/queue')->setData($queueData)->save();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1403 |
|
| 1404 |
-
|
| 1405 |
-
{
|
| 1406 |
-
$queueData = array(
|
| 1407 |
-
'data' => Simtech_Searchanise_Model_Queue::NOT_DATA,
|
| 1408 |
-
'action' => Simtech_Searchanise_Model_Queue::ACT_DELETE_FACETS_ALL,
|
| 1409 |
-
'store_id' => $store->getId(),
|
| 1410 |
-
);
|
| 1411 |
-
Mage::getModel('searchanise/queue')->setData($queueData)->save();
|
| 1412 |
-
|
| 1413 |
-
$queueData = array(
|
| 1414 |
-
'data' => Simtech_Searchanise_Model_Queue::NOT_DATA,
|
| 1415 |
-
'action' => Simtech_Searchanise_Model_Queue::ACT_UPDATE_ATTRIBUTES,
|
| 1416 |
-
'store_id' => $store->getId(),
|
| 1417 |
-
);
|
| 1418 |
-
|
| 1419 |
-
Mage::getModel('searchanise/queue')->setData($queueData)->save();
|
| 1420 |
-
}
|
| 1421 |
-
// </schemas>
|
| 1422 |
|
| 1423 |
self::_addTaskByChunk($store, $action = Simtech_Searchanise_Model_Queue::ACT_UPDATE_PRODUCTS, true);
|
| 1424 |
self::_addTaskByChunk($store, $action = Simtech_Searchanise_Model_Queue::ACT_UPDATE_CATEGORIES, true);
|
|
@@ -1442,12 +1456,20 @@ class Simtech_Searchanise_Helper_ApiSe
|
|
| 1442 |
if ($status == true) {
|
| 1443 |
self::setExportStatus(self::EXPORT_STATUS_PROCESSING, $store);
|
| 1444 |
}
|
| 1445 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1446 |
} elseif ($q['action'] == Simtech_Searchanise_Model_Queue::ACT_END_FULL_IMPORT) {
|
| 1447 |
$status = self::sendRequest('/api/state/update/json', $privateKey, array('full_import' => self::EXPORT_STATUS_DONE), true);
|
| 1448 |
|
| 1449 |
if ($status == true) {
|
| 1450 |
-
self::setExportStatus(self::
|
| 1451 |
self::setLastResync(self::getTime());
|
| 1452 |
}
|
| 1453 |
|
|
@@ -1691,42 +1713,6 @@ class Simtech_Searchanise_Helper_ApiSe
|
|
| 1691 |
|
| 1692 |
return true;
|
| 1693 |
}
|
| 1694 |
-
|
| 1695 |
-
public static function checkImportIsDone($curStore = null)
|
| 1696 |
-
{
|
| 1697 |
-
$result = true;
|
| 1698 |
-
$stores = self::getStores($curStore);
|
| 1699 |
-
|
| 1700 |
-
$skipTimeCheck = false;
|
| 1701 |
-
|
| 1702 |
-
foreach ($stores as $store) {
|
| 1703 |
-
if (self::getExportStatus($store) == self::EXPORT_STATUS_SENT && ((self::getTime() - self::getLastRequest()) > self::getRequestTimeout() || $skipTimeCheck == true)) {
|
| 1704 |
-
$response = self::sendRequest('/api/state/get/json', self::getPrivateKey($store), array('status' => '', 'full_import' => ''), true);
|
| 1705 |
-
$variable = self::parseStateResponse($response);
|
| 1706 |
-
|
| 1707 |
-
if ((!empty($variable)) && (isset($variable['status']))) {
|
| 1708 |
-
if (($variable['status'] == self::STATUS_NORMAL) &&
|
| 1709 |
-
(isset($variable['full_import'])) &&
|
| 1710 |
-
($variable['full_import'] == self::EXPORT_STATUS_DONE)) {
|
| 1711 |
-
$skipTimeCheck = true;
|
| 1712 |
-
self::setExportStatus(self::EXPORT_STATUS_DONE, $store);
|
| 1713 |
-
|
| 1714 |
-
} elseif ($variable['status'] == self::STATUS_DISABLED) {
|
| 1715 |
-
self::setExportStatus(self::EXPORT_STATUS_NONE, $store);
|
| 1716 |
-
}
|
| 1717 |
-
}
|
| 1718 |
-
}
|
| 1719 |
-
if (self::getExportStatus($store) != self::EXPORT_STATUS_DONE) {
|
| 1720 |
-
$result = false;
|
| 1721 |
-
}
|
| 1722 |
-
}
|
| 1723 |
-
|
| 1724 |
-
if ($skipTimeCheck == true) {
|
| 1725 |
-
// nothing
|
| 1726 |
-
}
|
| 1727 |
-
|
| 1728 |
-
return $result;
|
| 1729 |
-
}
|
| 1730 |
|
| 1731 |
public static function getStoreByWebsiteIds($websiteIds = array())
|
| 1732 |
{
|
| 20 |
|
| 21 |
const MAX_PAGE_SIZE = 100; // The "All" variant of the items per page menu is replaced with this value if the "Allow All Products per Page" option is active.
|
| 22 |
|
|
|
|
|
|
|
|
|
|
| 23 |
const SUGGESTIONS_MAX_RESULTS = 1;
|
| 24 |
const FLOAT_PRECISION = 2; // for server float = decimal(12,2)
|
| 25 |
const LABEL_FOR_PRICES_USERGROUP = 'se_price_';
|
| 134 |
return self::SUGGESTIONS_MAX_RESULTS;
|
| 135 |
}
|
| 136 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 137 |
public static function getServiceUrl($onlyHttp = true)
|
| 138 |
{
|
| 139 |
$ret = self::getSetting('service_url');
|
| 200 |
return self::getSetting('use_full_feed', self::CONFIG_PREFIX);
|
| 201 |
}
|
| 202 |
|
| 203 |
+
public static function setResultsWidgetEnabled($value, $store = null)
|
| 204 |
+
{
|
| 205 |
+
return self::setSettingStore('results_widget_enabled', $store, $value, self::CONFIG_PREFIX);
|
| 206 |
+
}
|
| 207 |
+
|
| 208 |
+
public static function getResultsWidgetEnabled($store = null)
|
| 209 |
+
{
|
| 210 |
+
return self::getSettingStore('results_widget_enabled', $store, self::CONFIG_PREFIX);
|
| 211 |
+
}
|
| 212 |
+
|
| 213 |
public static function setLastRequest($value = null)
|
| 214 |
{
|
| 215 |
self::setSetting('last_request', $value, self::CONFIG_PREFIX);
|
| 637 |
|
| 638 |
public static function showNotificationAsyncCompleted()
|
| 639 |
{
|
| 640 |
+
if (self::checkNotificationAsyncComleted()) {
|
| 641 |
+
$all_stores_done = true;
|
| 642 |
+
$stores = self::getStores();
|
| 643 |
+
foreach ($stores as $store) {
|
| 644 |
+
if (!self::checkExportStatus($store)) {
|
| 645 |
+
$all_stores_done = false;
|
| 646 |
+
break;
|
| 647 |
+
}
|
| 648 |
+
}
|
| 649 |
|
| 650 |
+
if ($all_stores_done) {
|
| 651 |
+
$textNotification = Mage::helper('searchanise')->__('Catalog indexation is complete. Configure Searchanise via the <a href="%s">Admin Panel</a>.', Mage::helper('searchanise/ApiSe')->getModuleUrl());
|
| 652 |
Mage::helper('searchanise/ApiSe')->setNotification('N', Mage::helper('searchanise')->__('Searchanise'), $textNotification);
|
| 653 |
self::setNotificationAsyncComleted(true);
|
| 654 |
}
|
| 953 |
|
| 954 |
public static function checkExportStatus($store = null)
|
| 955 |
{
|
|
|
|
| 956 |
return self::getExportStatus($store) == self::EXPORT_STATUS_DONE;
|
| 957 |
}
|
| 958 |
|
| 1410 |
);
|
| 1411 |
|
| 1412 |
Mage::getModel('searchanise/queue')->setData($queueData)->save();
|
| 1413 |
+
|
| 1414 |
+
$queueData = array(
|
| 1415 |
+
'data' => Simtech_Searchanise_Model_Queue::NOT_DATA,
|
| 1416 |
+
'action' => Simtech_Searchanise_Model_Queue::ACT_GET_INFO,
|
| 1417 |
+
'store_id' => $store->getId(),
|
| 1418 |
+
);
|
| 1419 |
+
|
| 1420 |
+
Mage::getModel('searchanise/queue')->setData($queueData)->save();
|
| 1421 |
+
|
| 1422 |
+
$queueData = array(
|
| 1423 |
+
'data' => Simtech_Searchanise_Model_Queue::NOT_DATA,
|
| 1424 |
+
'action' => Simtech_Searchanise_Model_Queue::ACT_DELETE_FACETS_ALL,
|
| 1425 |
+
'store_id' => $store->getId(),
|
| 1426 |
+
);
|
| 1427 |
+
Mage::getModel('searchanise/queue')->setData($queueData)->save();
|
| 1428 |
+
|
| 1429 |
+
$queueData = array(
|
| 1430 |
+
'data' => Simtech_Searchanise_Model_Queue::NOT_DATA,
|
| 1431 |
+
'action' => Simtech_Searchanise_Model_Queue::ACT_UPDATE_ATTRIBUTES,
|
| 1432 |
+
'store_id' => $store->getId(),
|
| 1433 |
+
);
|
| 1434 |
|
| 1435 |
+
Mage::getModel('searchanise/queue')->setData($queueData)->save();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1436 |
|
| 1437 |
self::_addTaskByChunk($store, $action = Simtech_Searchanise_Model_Queue::ACT_UPDATE_PRODUCTS, true);
|
| 1438 |
self::_addTaskByChunk($store, $action = Simtech_Searchanise_Model_Queue::ACT_UPDATE_CATEGORIES, true);
|
| 1456 |
if ($status == true) {
|
| 1457 |
self::setExportStatus(self::EXPORT_STATUS_PROCESSING, $store);
|
| 1458 |
}
|
| 1459 |
+
|
| 1460 |
+
} elseif ($q['action'] == Simtech_Searchanise_Model_Queue::ACT_GET_INFO) {
|
| 1461 |
+
$params = array();
|
| 1462 |
+
$info = self::sendRequest('/api/state/info/json', $privateKey, $params, true);
|
| 1463 |
+
|
| 1464 |
+
if (!empty($info['result_widget_enabled'])) {
|
| 1465 |
+
self::setResultsWidgetEnabled(($info['result_widget_enabled'] == 'Y')? true : false, $store);
|
| 1466 |
+
}
|
| 1467 |
+
|
| 1468 |
} elseif ($q['action'] == Simtech_Searchanise_Model_Queue::ACT_END_FULL_IMPORT) {
|
| 1469 |
$status = self::sendRequest('/api/state/update/json', $privateKey, array('full_import' => self::EXPORT_STATUS_DONE), true);
|
| 1470 |
|
| 1471 |
if ($status == true) {
|
| 1472 |
+
self::setExportStatus(self::EXPORT_STATUS_DONE, $store);
|
| 1473 |
self::setLastResync(self::getTime());
|
| 1474 |
}
|
| 1475 |
|
| 1713 |
|
| 1714 |
return true;
|
| 1715 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1716 |
|
| 1717 |
public static function getStoreByWebsiteIds($websiteIds = array())
|
| 1718 |
{
|
app/code/community/Simtech/Searchanise/Helper/Data.php
CHANGED
|
@@ -125,7 +125,12 @@ class Simtech_Searchanise_Helper_Data extends Mage_Core_Helper_Abstract
|
|
| 125 |
|
| 126 |
return $check;
|
| 127 |
}
|
| 128 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 129 |
protected function setDefaultSort(&$params, $type)
|
| 130 |
{
|
| 131 |
if (empty($params)) {
|
|
@@ -218,12 +223,7 @@ class Simtech_Searchanise_Helper_Data extends Mage_Core_Helper_Abstract
|
|
| 218 |
$params['suggestions'] = 'true';
|
| 219 |
$params['query_correction'] = 'false';
|
| 220 |
$params['suggestionsMaxResults'] = Mage::helper('searchanise/ApiSe')->getSuggestionsMaxResults();
|
| 221 |
-
|
| 222 |
$params['restrictBy']['visibility'] = '3|4';
|
| 223 |
-
$minQuantityDecimals = Mage::helper('searchanise/ApiSe')->getMinQuantityDecimals();
|
| 224 |
-
if (!empty($minQuantityDecimals)) {
|
| 225 |
-
$params['restrictBy']['quantity_decimals'] = $minQuantityDecimals . ',';
|
| 226 |
-
}
|
| 227 |
|
| 228 |
} elseif ($type == self::TEXT_ADVANCED_FIND) {
|
| 229 |
$params['facets'] = 'false';
|
|
@@ -231,10 +231,6 @@ class Simtech_Searchanise_Helper_Data extends Mage_Core_Helper_Abstract
|
|
| 231 |
$params['query_correction'] = 'false';
|
| 232 |
|
| 233 |
$params['restrictBy']['visibility'] = '3|4';
|
| 234 |
-
$minQuantityDecimals = Mage::helper('searchanise/ApiSe')->getMinQuantityDecimals();
|
| 235 |
-
if (!empty($minQuantityDecimals)) {
|
| 236 |
-
$params['restrictBy']['quantity_decimals'] = $minQuantityDecimals . ',';
|
| 237 |
-
}
|
| 238 |
}
|
| 239 |
|
| 240 |
if ((!empty($controller)) && (!empty($blockToolbar))) {
|
|
@@ -269,6 +265,8 @@ class Simtech_Searchanise_Helper_Data extends Mage_Core_Helper_Abstract
|
|
| 269 |
}
|
| 270 |
|
| 271 |
$sortBy = $blockToolbar->getCurrentOrder();
|
|
|
|
|
|
|
| 272 |
$sortOrder = $blockToolbar->getCurrentDirection();
|
| 273 |
|
| 274 |
$maxResults = (int) $blockToolbar->getLimit();
|
|
@@ -303,46 +301,24 @@ class Simtech_Searchanise_Helper_Data extends Mage_Core_Helper_Abstract
|
|
| 303 |
// CATEGORIES
|
| 304 |
{
|
| 305 |
$arrCat = null;
|
| 306 |
-
$
|
| 307 |
-
if (!empty($
|
| 308 |
-
$
|
| 309 |
-
$arrCat[] = $cat_id; // need if not exist children categories
|
| 310 |
-
|
| 311 |
-
$categories = Mage::getModel('catalog/category')
|
| 312 |
-
->getCollection()
|
| 313 |
-
->setStoreId(Mage::app()->getStore()->getId())
|
| 314 |
-
->addFieldToFilter('entity_id', $cat_id)
|
| 315 |
-
->load()
|
| 316 |
-
;
|
| 317 |
-
|
| 318 |
-
if (!empty($categories)) {
|
| 319 |
-
foreach ($categories as $cat) {
|
| 320 |
-
if (!empty($cat)) {
|
| 321 |
-
$arrCat = $cat->getAllChildren(true);
|
| 322 |
-
}
|
| 323 |
-
}
|
| 324 |
-
}
|
| 325 |
-
}
|
| 326 |
|
| 327 |
-
|
| 328 |
-
|
| 329 |
-
$params['restrictBy']['category_ids'] = implode('|', $arrCat);
|
| 330 |
-
} else {
|
| 331 |
-
$params['restrictBy']['category_ids'] = $arrCat;
|
| 332 |
}
|
| 333 |
}
|
| 334 |
}
|
| 335 |
// ATTRIBUTES
|
| 336 |
{
|
| 337 |
-
$attributes = Mage::getResourceModel('catalog/product_attribute_collection')
|
| 338 |
-
$attributes
|
| 339 |
->setItemObjectClass('catalog/resource_eav_attribute')
|
| 340 |
->load();
|
| 341 |
-
|
| 342 |
if (!empty($attributes)) {
|
| 343 |
foreach ($attributes as $id => $attr) {
|
| 344 |
-
$arrAttributes[$
|
| 345 |
-
$arrInputType[$id] = $attr->getData('frontend_input');
|
| 346 |
}
|
| 347 |
|
| 348 |
if (!empty($arrAttributes)) {
|
|
@@ -350,42 +326,42 @@ class Simtech_Searchanise_Helper_Data extends Mage_Core_Helper_Abstract
|
|
| 350 |
|
| 351 |
if (!empty($requestParams)) {
|
| 352 |
foreach ($requestParams as $name => $val) {
|
| 353 |
-
|
| 354 |
-
|
| 355 |
-
$
|
| 356 |
-
|
| 357 |
if ($name == 'price') {
|
| 358 |
$valPrice = Mage::helper('searchanise/ApiSe')->getPriceValueFromRequest($val);
|
| 359 |
if ($valPrice != '') {
|
| 360 |
$params['restrictBy']['price'] = $valPrice;
|
| 361 |
}
|
| 362 |
|
| 363 |
-
} elseif ($
|
| 364 |
-
$params['union'][$
|
| 365 |
$valPrice = Mage::helper('searchanise/ApiSe')->getPriceValueFromRequest($val);
|
| 366 |
|
| 367 |
if ($valPrice != '') {
|
| 368 |
-
$params['restrictBy'][$
|
| 369 |
}
|
| 370 |
-
|
| 371 |
-
} elseif (($
|
| 372 |
if ($val != '') {
|
| 373 |
$val = Mage::helper('searchanise/ApiSe')->escapingCharacters($val);
|
| 374 |
|
| 375 |
if ($val != '') {
|
| 376 |
-
$
|
|
|
|
|
|
|
| 377 |
}
|
| 378 |
}
|
| 379 |
|
| 380 |
-
} elseif (($
|
| 381 |
-
($arrInputType[$id] == 'multiselect') ||
|
| 382 |
-
($arrInputType[$id] == 'boolean')) {
|
| 383 |
if ($val) {
|
| 384 |
-
|
| 385 |
-
|
| 386 |
-
|
| 387 |
-
$
|
| 388 |
}
|
|
|
|
| 389 |
}
|
| 390 |
|
| 391 |
} else {
|
|
@@ -500,4 +476,4 @@ class Simtech_Searchanise_Helper_Data extends Mage_Core_Helper_Abstract
|
|
| 500 |
return $this->_defaultAvailableLimit;
|
| 501 |
}
|
| 502 |
}
|
| 503 |
-
}
|
| 125 |
|
| 126 |
return $check;
|
| 127 |
}
|
| 128 |
+
|
| 129 |
+
public static function getResultsFormPath()
|
| 130 |
+
{
|
| 131 |
+
return Mage::getUrl() . 'searchanise/result';
|
| 132 |
+
}
|
| 133 |
+
|
| 134 |
protected function setDefaultSort(&$params, $type)
|
| 135 |
{
|
| 136 |
if (empty($params)) {
|
| 223 |
$params['suggestions'] = 'true';
|
| 224 |
$params['query_correction'] = 'false';
|
| 225 |
$params['suggestionsMaxResults'] = Mage::helper('searchanise/ApiSe')->getSuggestionsMaxResults();
|
|
|
|
| 226 |
$params['restrictBy']['visibility'] = '3|4';
|
|
|
|
|
|
|
|
|
|
|
|
|
| 227 |
|
| 228 |
} elseif ($type == self::TEXT_ADVANCED_FIND) {
|
| 229 |
$params['facets'] = 'false';
|
| 231 |
$params['query_correction'] = 'false';
|
| 232 |
|
| 233 |
$params['restrictBy']['visibility'] = '3|4';
|
|
|
|
|
|
|
|
|
|
|
|
|
| 234 |
}
|
| 235 |
|
| 236 |
if ((!empty($controller)) && (!empty($blockToolbar))) {
|
| 265 |
}
|
| 266 |
|
| 267 |
$sortBy = $blockToolbar->getCurrentOrder();
|
| 268 |
+
$sortBy = ($sortBy == 'name')? 'title' : $sortBy;
|
| 269 |
+
$sortBy = ($sortBy == 'sku')? 'product_code' : $sortBy;
|
| 270 |
$sortOrder = $blockToolbar->getCurrentDirection();
|
| 271 |
|
| 272 |
$maxResults = (int) $blockToolbar->getLimit();
|
| 301 |
// CATEGORIES
|
| 302 |
{
|
| 303 |
$arrCat = null;
|
| 304 |
+
$categoryId = (int) $controller->getRequest()->getParam('cat');
|
| 305 |
+
if (!empty($categoryId)) {
|
| 306 |
+
$categoryIds = Mage::helper('searchanise/ApiCategories')->getAllChildrenCategories($categoryId);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 307 |
|
| 308 |
+
if (!empty($categoryIds)) {
|
| 309 |
+
$params['restrictBy']['category_ids'] = implode('|', $categoryIds);
|
|
|
|
|
|
|
|
|
|
| 310 |
}
|
| 311 |
}
|
| 312 |
}
|
| 313 |
// ATTRIBUTES
|
| 314 |
{
|
| 315 |
+
$attributes = Mage::getResourceModel('catalog/product_attribute_collection')
|
|
|
|
| 316 |
->setItemObjectClass('catalog/resource_eav_attribute')
|
| 317 |
->load();
|
| 318 |
+
|
| 319 |
if (!empty($attributes)) {
|
| 320 |
foreach ($attributes as $id => $attr) {
|
| 321 |
+
$arrAttributes[$attr->getName()] = $attr;
|
|
|
|
| 322 |
}
|
| 323 |
|
| 324 |
if (!empty($arrAttributes)) {
|
| 326 |
|
| 327 |
if (!empty($requestParams)) {
|
| 328 |
foreach ($requestParams as $name => $val) {
|
| 329 |
+
if (!empty($arrAttributes[$name])) {
|
| 330 |
+
$attr = $arrAttributes[$name];
|
| 331 |
+
$inputType = $attr->getData('frontend_input');
|
|
|
|
| 332 |
if ($name == 'price') {
|
| 333 |
$valPrice = Mage::helper('searchanise/ApiSe')->getPriceValueFromRequest($val);
|
| 334 |
if ($valPrice != '') {
|
| 335 |
$params['restrictBy']['price'] = $valPrice;
|
| 336 |
}
|
| 337 |
|
| 338 |
+
} elseif ($inputType == 'price') {
|
| 339 |
+
$params['union'][$name]['min'] = Mage::helper('searchanise/ApiSe')->getCurLabelForPricesUsergroup();
|
| 340 |
$valPrice = Mage::helper('searchanise/ApiSe')->getPriceValueFromRequest($val);
|
| 341 |
|
| 342 |
if ($valPrice != '') {
|
| 343 |
+
$params['restrictBy'][$name] = $valPrice;
|
| 344 |
}
|
| 345 |
+
|
| 346 |
+
} elseif (($inputType == 'text') || ($inputType == 'textarea')) {
|
| 347 |
if ($val != '') {
|
| 348 |
$val = Mage::helper('searchanise/ApiSe')->escapingCharacters($val);
|
| 349 |
|
| 350 |
if ($val != '') {
|
| 351 |
+
$queryBy = ($name == 'name')? 'title' : $name;
|
| 352 |
+
$queryBy = ($name == 'sku')? 'product_code' : $queryBy;
|
| 353 |
+
$params['queryBy'][$queryBy] = $val;
|
| 354 |
}
|
| 355 |
}
|
| 356 |
|
| 357 |
+
} elseif (($inputType == 'select') || ($inputType == 'multiselect') || ($inputType == 'boolean')) {
|
|
|
|
|
|
|
| 358 |
if ($val) {
|
| 359 |
+
$values = array();
|
| 360 |
+
$vals = is_array($val)? $val : array($val);
|
| 361 |
+
foreach ($vals as $v) {
|
| 362 |
+
$values[] = $attr->getFrontend()->getOption($v);
|
| 363 |
}
|
| 364 |
+
$params['restrictBy'][$name] = implode('|', $values);
|
| 365 |
}
|
| 366 |
|
| 367 |
} else {
|
| 476 |
return $this->_defaultAvailableLimit;
|
| 477 |
}
|
| 478 |
}
|
| 479 |
+
}
|
app/code/community/Simtech/Searchanise/Model/Layer/Filter/Category.php
DELETED
|
@@ -1,68 +0,0 @@
|
|
| 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_Layer_Filter_Category extends Mage_Catalog_Model_Layer_Filter_Category
|
| 16 |
-
{
|
| 17 |
-
/**
|
| 18 |
-
* Get data array for building category filter items
|
| 19 |
-
*
|
| 20 |
-
* @return array
|
| 21 |
-
*/
|
| 22 |
-
protected function _getItemsData()
|
| 23 |
-
{
|
| 24 |
-
if (!Mage::helper('searchanise/ApiSe')->checkSearchaniseResult(true)) {
|
| 25 |
-
return parent::_getItemsData();
|
| 26 |
-
}
|
| 27 |
-
|
| 28 |
-
$collection = $this->getLayer()->getProductCollection();
|
| 29 |
-
|
| 30 |
-
if ((!method_exists($collection, 'checkSearchaniseResult')) || (!$collection->checkSearchaniseResult()))
|
| 31 |
-
{
|
| 32 |
-
return parent::_getItemsData();
|
| 33 |
-
}
|
| 34 |
-
|
| 35 |
-
$key = $this->getLayer()->getStateKey().'_SUBCATEGORIES';
|
| 36 |
-
$data = $this->getLayer()->getAggregator()->getCacheData($key);
|
| 37 |
-
|
| 38 |
-
if ($data === null)
|
| 39 |
-
{
|
| 40 |
-
$categoty = $this->getCategory();
|
| 41 |
-
/** @var $categoty Mage_Catalog_Model_Categeory */
|
| 42 |
-
$categories = $categoty->getChildrenCategories();
|
| 43 |
-
|
| 44 |
-
$this->getLayer()->getProductCollection()
|
| 45 |
-
->addCountToCategories($categories);
|
| 46 |
-
|
| 47 |
-
$data = array();
|
| 48 |
-
foreach ($categories as $category) {
|
| 49 |
-
$productCount = $collection
|
| 50 |
-
->getSearchaniseRequest()
|
| 51 |
-
->getCountProductCategory($category);
|
| 52 |
-
|
| 53 |
-
if ($category->getIsActive() && $productCount)
|
| 54 |
-
{
|
| 55 |
-
$data[] = array(
|
| 56 |
-
'label' => Mage::helper('core')->htmlEscape($category->getName()),
|
| 57 |
-
'value' => $category->getId(),
|
| 58 |
-
'count' => $productCount,
|
| 59 |
-
);
|
| 60 |
-
}
|
| 61 |
-
}
|
| 62 |
-
$tags = $this->getLayer()->getStateTags();
|
| 63 |
-
$this->getLayer()->getAggregator()->saveCacheData($data, $key, $tags);
|
| 64 |
-
}
|
| 65 |
-
|
| 66 |
-
return $data;
|
| 67 |
-
}
|
| 68 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Simtech/Searchanise/Model/Layer/Filter/Price.php
DELETED
|
@@ -1,51 +0,0 @@
|
|
| 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_Layer_Filter_Price extends Mage_Catalog_Model_Layer_Filter_Price
|
| 16 |
-
{
|
| 17 |
-
/**
|
| 18 |
-
* Get price range for building filter steps
|
| 19 |
-
*
|
| 20 |
-
* @return int
|
| 21 |
-
*/
|
| 22 |
-
public function getPriceRange()
|
| 23 |
-
{
|
| 24 |
-
if (!Mage::helper('searchanise/ApiSe')->checkSearchaniseResult(true)) {
|
| 25 |
-
return parent::getPriceRange();
|
| 26 |
-
}
|
| 27 |
-
|
| 28 |
-
$collection = $this->getLayer()->getProductCollection();
|
| 29 |
-
|
| 30 |
-
if ((!method_exists($collection, 'checkSearchaniseResult')) || (!$collection->checkSearchaniseResult())) {
|
| 31 |
-
return parent::getPriceRange();
|
| 32 |
-
}
|
| 33 |
-
|
| 34 |
-
$newRange = $collection
|
| 35 |
-
->getSearchaniseRequest()
|
| 36 |
-
->getPriceRangeFromAttribute($this->getAttributeModel());
|
| 37 |
-
if (!$newRange) {
|
| 38 |
-
return parent::getPriceRange();
|
| 39 |
-
}
|
| 40 |
-
|
| 41 |
-
$rate = Mage::app()->getStore()->getCurrentCurrencyRate();
|
| 42 |
-
|
| 43 |
-
if ((!$rate) || ($rate == 1)) {
|
| 44 |
-
// nothing
|
| 45 |
-
} else {
|
| 46 |
-
$newRange *= $rate;
|
| 47 |
-
}
|
| 48 |
-
|
| 49 |
-
return $newRange;
|
| 50 |
-
}
|
| 51 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Simtech/Searchanise/Model/Observer.php
CHANGED
|
@@ -803,4 +803,63 @@ class Simtech_Searchanise_Model_Observer
|
|
| 803 |
|
| 804 |
return $this;
|
| 805 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 806 |
}
|
| 803 |
|
| 804 |
return $this;
|
| 805 |
}
|
| 806 |
+
|
| 807 |
+
public function coreBlockAbstractToHtmlBefore(Varien_Event_Observer $observer)
|
| 808 |
+
{
|
| 809 |
+
$data = $observer->getData();
|
| 810 |
+
$block = $data['block'];
|
| 811 |
+
|
| 812 |
+
if ($block instanceof Mage_CatalogSearch_Block_Layer) {
|
| 813 |
+
$filters = $block->getFilters();
|
| 814 |
+
foreach ($filters as $filter) {
|
| 815 |
+
if ($filter->getType() == 'catalog/layer_filter_price') {
|
| 816 |
+
if (!Mage::helper('searchanise/ApiSe')->checkSearchaniseResult(true)) {
|
| 817 |
+
break;
|
| 818 |
+
}
|
| 819 |
+
|
| 820 |
+
$collection = $block->getLayer()->getProductCollection();
|
| 821 |
+
|
| 822 |
+
if ((!method_exists($collection, 'checkSearchaniseResult')) || (!$collection->checkSearchaniseResult())) {
|
| 823 |
+
break;
|
| 824 |
+
}
|
| 825 |
+
|
| 826 |
+
$newRange = $collection
|
| 827 |
+
->getSearchaniseRequest()
|
| 828 |
+
->getPriceRangeFromAttribute($filter->getAttributeModel());
|
| 829 |
+
if (!$newRange) {
|
| 830 |
+
break;
|
| 831 |
+
}
|
| 832 |
+
|
| 833 |
+
$rate = Mage::app()->getStore()->getCurrentCurrencyRate();
|
| 834 |
+
|
| 835 |
+
if ((!$rate) || ($rate == 1)) {
|
| 836 |
+
// nothing
|
| 837 |
+
} else {
|
| 838 |
+
$newRange *= $rate;
|
| 839 |
+
}
|
| 840 |
+
|
| 841 |
+
$currentCategory = Mage::registry('current_category_filter');
|
| 842 |
+
if ($currentCategory) {
|
| 843 |
+
$currentCategory->setFilterPriceRange($newRange);
|
| 844 |
+
} else {
|
| 845 |
+
$filter->getLayer()->getCurrentCategory()->setFilterPriceRange($newRange);
|
| 846 |
+
}
|
| 847 |
+
}
|
| 848 |
+
}
|
| 849 |
+
}
|
| 850 |
+
}
|
| 851 |
+
|
| 852 |
+
public function controllerActionPredispatch(Varien_Event_Observer $observer)
|
| 853 |
+
{
|
| 854 |
+
if (Mage::helper('searchanise/ApiSe')->getSetting('redirect_to_admin_after_install')) {
|
| 855 |
+
Mage::helper('searchanise/ApiSe')->setSetting('redirect_to_admin_after_install', false);
|
| 856 |
+
if (!($observer->getData('controller_action') instanceof Simtech_Searchanise_IndexController)) {
|
| 857 |
+
$redirect_url = Mage::helper('adminhtml')->getUrl(Mage::helper('searchanise/ApiSe')->getSearchaniseLink());
|
| 858 |
+
Mage::app()->getResponse()->setRedirect($redirect_url)->sendResponse();
|
| 859 |
+
exit;
|
| 860 |
+
}
|
| 861 |
+
}
|
| 862 |
+
|
| 863 |
+
return $this;
|
| 864 |
+
}
|
| 865 |
}
|
app/code/community/Simtech/Searchanise/Model/Queue.php
CHANGED
|
@@ -46,6 +46,7 @@ class Simtech_Searchanise_Model_Queue extends Mage_Core_Model_Abstract
|
|
| 46 |
|
| 47 |
const ACT_PREPARE_FULL_IMPORT = 'prepare_full_import';
|
| 48 |
const ACT_START_FULL_IMPORT = 'start_full_import';
|
|
|
|
| 49 |
const ACT_END_FULL_IMPORT = 'end_full_import';
|
| 50 |
|
| 51 |
public static $mainActionTypes = array(
|
| 46 |
|
| 47 |
const ACT_PREPARE_FULL_IMPORT = 'prepare_full_import';
|
| 48 |
const ACT_START_FULL_IMPORT = 'start_full_import';
|
| 49 |
+
const ACT_GET_INFO = 'update_info';
|
| 50 |
const ACT_END_FULL_IMPORT = 'end_full_import';
|
| 51 |
|
| 52 |
public static $mainActionTypes = array(
|
app/code/community/Simtech/Searchanise/Model/Request.php
CHANGED
|
@@ -163,7 +163,7 @@ class Simtech_Searchanise_Model_Request extends Mage_Core_Model_Abstract
|
|
| 163 |
|
| 164 |
$this->setProductIdsString($productIdsString);
|
| 165 |
}
|
| 166 |
-
|
| 167 |
return $this->productIdsString;
|
| 168 |
}
|
| 169 |
|
|
@@ -275,7 +275,7 @@ class Simtech_Searchanise_Model_Request extends Mage_Core_Model_Abstract
|
|
| 275 |
$query = Mage::helper('searchanise/ApiSe')->buildQuery($this->getSearchParams());
|
| 276 |
$this->setSearchParam('api_key', $this->getApiKey());
|
| 277 |
if (Mage::helper('searchanise')->checkDebug()) {
|
| 278 |
-
Mage::helper('searchanise/ApiSe')->printR(Mage::helper('searchanise/ApiSe')->getServiceUrl() . '/search?api_key=' . $this->getApiKey() . $this->getSearchParamsStr());
|
| 279 |
Mage::helper('searchanise/ApiSe')->printR($this->getSearchParams());
|
| 280 |
}
|
| 281 |
|
|
@@ -370,8 +370,8 @@ class Simtech_Searchanise_Model_Request extends Mage_Core_Model_Abstract
|
|
| 370 |
return $ret;
|
| 371 |
}
|
| 372 |
|
| 373 |
-
$label =
|
| 374 |
-
|
| 375 |
if (!$this->checkAttributesCountLabel($label)) {
|
| 376 |
$vals = array();
|
| 377 |
$res = $this->getSearchResult();
|
|
@@ -540,16 +540,12 @@ class Simtech_Searchanise_Model_Request extends Mage_Core_Model_Abstract
|
|
| 540 |
$res = $this->getSearchResult();
|
| 541 |
|
| 542 |
if (!empty($res['facets'])) {
|
| 543 |
-
|
| 544 |
-
// error calc count product in category
|
| 545 |
-
$arr_cat = null;
|
| 546 |
-
Mage::helper('searchanise/ApiCategories')->getAllChildrenCategories($arr_cat, $category);
|
| 547 |
-
|
| 548 |
foreach ($res['facets'] as $facet) {
|
| 549 |
if ($facet['attribute'] == 'category_ids') {
|
| 550 |
if (!empty($facet['buckets'])) {
|
| 551 |
foreach ($facet['buckets'] as $bucket) {
|
| 552 |
-
if (in_array($bucket['value'], $
|
| 553 |
$val += $bucket['count'];
|
| 554 |
}
|
| 555 |
}
|
|
@@ -561,10 +557,10 @@ class Simtech_Searchanise_Model_Request extends Mage_Core_Model_Abstract
|
|
| 561 |
if ($val > $this->getTotalProduct()) {
|
| 562 |
$val = $this->getTotalProduct();
|
| 563 |
}
|
| 564 |
-
|
| 565 |
$this->setAttributesCountLabel($val, $label);
|
| 566 |
}
|
| 567 |
-
|
| 568 |
return $this->getAttributesCountLabel($label);
|
| 569 |
}
|
| 570 |
}
|
| 163 |
|
| 164 |
$this->setProductIdsString($productIdsString);
|
| 165 |
}
|
| 166 |
+
|
| 167 |
return $this->productIdsString;
|
| 168 |
}
|
| 169 |
|
| 275 |
$query = Mage::helper('searchanise/ApiSe')->buildQuery($this->getSearchParams());
|
| 276 |
$this->setSearchParam('api_key', $this->getApiKey());
|
| 277 |
if (Mage::helper('searchanise')->checkDebug()) {
|
| 278 |
+
Mage::helper('searchanise/ApiSe')->printR(Mage::helper('searchanise/ApiSe')->getServiceUrl() . '/search?api_key=' . $this->getApiKey() . '&' . $this->getSearchParamsStr());
|
| 279 |
Mage::helper('searchanise/ApiSe')->printR($this->getSearchParams());
|
| 280 |
}
|
| 281 |
|
| 370 |
return $ret;
|
| 371 |
}
|
| 372 |
|
| 373 |
+
$label = $attribute->getAttributeCode();
|
| 374 |
+
|
| 375 |
if (!$this->checkAttributesCountLabel($label)) {
|
| 376 |
$vals = array();
|
| 377 |
$res = $this->getSearchResult();
|
| 540 |
$res = $this->getSearchResult();
|
| 541 |
|
| 542 |
if (!empty($res['facets'])) {
|
| 543 |
+
$categoryIds = Mage::helper('searchanise/ApiCategories')->getAllChildrenCategories($category->getId());
|
|
|
|
|
|
|
|
|
|
|
|
|
| 544 |
foreach ($res['facets'] as $facet) {
|
| 545 |
if ($facet['attribute'] == 'category_ids') {
|
| 546 |
if (!empty($facet['buckets'])) {
|
| 547 |
foreach ($facet['buckets'] as $bucket) {
|
| 548 |
+
if (in_array($bucket['value'], $categoryIds)) {
|
| 549 |
$val += $bucket['count'];
|
| 550 |
}
|
| 551 |
}
|
| 557 |
if ($val > $this->getTotalProduct()) {
|
| 558 |
$val = $this->getTotalProduct();
|
| 559 |
}
|
| 560 |
+
|
| 561 |
$this->setAttributesCountLabel($val, $label);
|
| 562 |
}
|
| 563 |
+
|
| 564 |
return $this->getAttributesCountLabel($label);
|
| 565 |
}
|
| 566 |
}
|
app/code/community/Simtech/Searchanise/Model/Resource/Fulltext/Collection.php
CHANGED
|
@@ -122,4 +122,36 @@ class Simtech_Searchanise_Model_Resource_Fulltext_Collection extends Mage_Catalo
|
|
| 122 |
{
|
| 123 |
return parent::getLastPageNumber();
|
| 124 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 125 |
}
|
| 122 |
{
|
| 123 |
return parent::getLastPageNumber();
|
| 124 |
}
|
| 125 |
+
|
| 126 |
+
public function _loadEntities($printQuery = false, $logQuery = false)
|
| 127 |
+
{
|
| 128 |
+
$pageSize = $this->_pageSize;
|
| 129 |
+
$this->_pageSize = false;
|
| 130 |
+
$args = func_get_args();
|
| 131 |
+
call_user_func_array(array(__CLASS__, 'parent::_loadEntities'), $args);
|
| 132 |
+
$this->_pageSize = $pageSize;
|
| 133 |
+
return $this;
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
public function getSize()
|
| 137 |
+
{
|
| 138 |
+
if ($this->checkSearchaniseResult()) {
|
| 139 |
+
return $this->getSearchaniseRequest()->getTotalProduct();
|
| 140 |
+
} else {
|
| 141 |
+
return parent::getSize();
|
| 142 |
+
}
|
| 143 |
+
}
|
| 144 |
+
|
| 145 |
+
public function addCountToCategories($categoryCollection)
|
| 146 |
+
{
|
| 147 |
+
if (!Mage::helper('searchanise/ApiSe')->checkSearchaniseResult(true) || !$this->checkSearchaniseResult()) {
|
| 148 |
+
return parent::addCountToCategories($categoryCollection);
|
| 149 |
+
}
|
| 150 |
+
|
| 151 |
+
foreach ($categoryCollection as $category) {
|
| 152 |
+
$category->setProductCount($this->getSearchaniseRequest()->getCountProductCategory($category));
|
| 153 |
+
}
|
| 154 |
+
|
| 155 |
+
return $this;
|
| 156 |
+
}
|
| 157 |
}
|
app/code/community/Simtech/Searchanise/Model/Resource/Layer/Filter/Attribute.php
CHANGED
|
@@ -32,10 +32,21 @@ class Simtech_Searchanise_Model_Resource_Layer_Filter_Attribute extends Mage_Cat
|
|
| 32 |
if ((!method_exists($collection, 'checkSearchaniseResult')) || (!$collection->checkSearchaniseResult())) {
|
| 33 |
return parent::getCount($filter);
|
| 34 |
}
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
}
|
| 40 |
|
| 41 |
/**
|
| 32 |
if ((!method_exists($collection, 'checkSearchaniseResult')) || (!$collection->checkSearchaniseResult())) {
|
| 33 |
return parent::getCount($filter);
|
| 34 |
}
|
| 35 |
+
|
| 36 |
+
$optionsCount = array();
|
| 37 |
+
$options = $filter->getAttributeModel()->getFrontend()->getSelectOptions();
|
| 38 |
+
$searchaniseOptions = $collection->getSearchaniseRequest()->getCountAttribute($filter);
|
| 39 |
+
foreach ($options as $option) {
|
| 40 |
+
if (is_array($option['value'])) {
|
| 41 |
+
continue;
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
if (strlen($option['label']) && isset($searchaniseOptions[$option['label']])) {
|
| 45 |
+
$optionsCount[$option['value']] = $searchaniseOptions[$option['label']];
|
| 46 |
+
}
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
return $optionsCount;
|
| 50 |
}
|
| 51 |
|
| 52 |
/**
|
app/code/community/Simtech/Searchanise/Model/Searchanise.php
CHANGED
|
@@ -120,21 +120,14 @@ class Simtech_Searchanise_Model_Searchanise extends Mage_Core_Model_Abstract
|
|
| 120 |
if (!$this->checkSearchaniseResult()) {
|
| 121 |
return $this->_collection->setOrderParent($attribute, $dir);
|
| 122 |
}
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
if (!empty($product_ids)) {
|
| 132 |
-
$sortBy = "FIELD(e.entity_id, {$product_ids}) {$dir}";
|
| 133 |
-
$this->_collection->getSelect()->order(new Zend_Db_Expr($sortBy));
|
| 134 |
-
}
|
| 135 |
-
|
| 136 |
-
} else {
|
| 137 |
-
return $this->_collection->setOrderParent($attribute, $dir);
|
| 138 |
}
|
| 139 |
|
| 140 |
return $this;
|
| 120 |
if (!$this->checkSearchaniseResult()) {
|
| 121 |
return $this->_collection->setOrderParent($attribute, $dir);
|
| 122 |
}
|
| 123 |
+
|
| 124 |
+
$product_ids = $this
|
| 125 |
+
->getSearchaniseRequest()
|
| 126 |
+
->getProductIdsString();
|
| 127 |
+
|
| 128 |
+
if (!empty($product_ids)) {
|
| 129 |
+
$sortBy = "FIELD(e.entity_id, {$product_ids}) asc";
|
| 130 |
+
$this->_collection->getSelect()->order(new Zend_Db_Expr($sortBy));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 131 |
}
|
| 132 |
|
| 133 |
return $this;
|
app/code/community/Simtech/Searchanise/controllers/InfoController.php
CHANGED
|
@@ -160,14 +160,12 @@ class Simtech_Searchanise_InfoController extends Mage_Core_Controller_Front_Acti
|
|
| 160 |
);
|
| 161 |
|
| 162 |
if ($visual) {
|
| 163 |
-
Mage::helper('searchanise/ApiSe')->printR(
|
| 164 |
} else {
|
| 165 |
echo Mage::helper('core')->jsonEncode($feed);
|
| 166 |
}
|
| 167 |
|
| 168 |
} else {
|
| 169 |
-
Mage::helper('searchanise/ApiSe')->checkImportIsDone();
|
| 170 |
-
|
| 171 |
$options = Mage::helper('searchanise/ApiSe')->getAddonOptions();
|
| 172 |
if (!$options) {
|
| 173 |
$options = array();
|
| 160 |
);
|
| 161 |
|
| 162 |
if ($visual) {
|
| 163 |
+
Mage::helper('searchanise/ApiSe')->printR($feed);
|
| 164 |
} else {
|
| 165 |
echo Mage::helper('core')->jsonEncode($feed);
|
| 166 |
}
|
| 167 |
|
| 168 |
} else {
|
|
|
|
|
|
|
| 169 |
$options = Mage::helper('searchanise/ApiSe')->getAddonOptions();
|
| 170 |
if (!$options) {
|
| 171 |
$options = array();
|
app/code/community/Simtech/Searchanise/controllers/ResultController.php
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
class Simtech_Searchanise_ResultController extends Mage_Core_Controller_Front_Action
|
| 15 |
+
{
|
| 16 |
+
public function indexAction()
|
| 17 |
+
{
|
| 18 |
+
$this->loadLayout();
|
| 19 |
+
$this->renderLayout();
|
| 20 |
+
}
|
| 21 |
+
}
|
app/code/community/Simtech/Searchanise/etc/config.xml
CHANGED
|
@@ -15,7 +15,7 @@
|
|
| 15 |
<config>
|
| 16 |
<modules>
|
| 17 |
<Simtech_Searchanise>
|
| 18 |
-
<version>3.1.
|
| 19 |
</Simtech_Searchanise>
|
| 20 |
</modules>
|
| 21 |
<frontend>
|
|
@@ -61,6 +61,14 @@
|
|
| 61 |
</rating>
|
| 62 |
</observers>
|
| 63 |
</controller_action_predispatch_catalogsearch_advanced_result>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
</events>
|
| 65 |
</frontend>
|
| 66 |
<admin>
|
|
@@ -127,19 +135,19 @@
|
|
| 127 |
</searchanise>
|
| 128 |
</updates>
|
| 129 |
</layout>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 130 |
</adminhtml>
|
| 131 |
<global>
|
| 132 |
<models>
|
| 133 |
-
<!-- OVERRIDE CATALOG MODEL -->
|
| 134 |
-
<!-- [disabled_searchanise_search] -->
|
| 135 |
-
<catalog>
|
| 136 |
-
<rewrite>
|
| 137 |
-
<layer_filter_category>Simtech_Searchanise_Model_Layer_Filter_Category</layer_filter_category>
|
| 138 |
-
<layer_filter_price>Simtech_Searchanise_Model_Layer_Filter_Price</layer_filter_price>
|
| 139 |
-
</rewrite>
|
| 140 |
-
</catalog>
|
| 141 |
-
<!-- [/disabled_searchanise_search] -->
|
| 142 |
-
<!-- END -->
|
| 143 |
|
| 144 |
<!-- <OVERRIDE CATALOG RESOURCE> -->
|
| 145 |
<!-- [disabled_searchanise_search] -->
|
|
@@ -552,6 +560,11 @@
|
|
| 552 |
</catalogsearch>
|
| 553 |
<!-- END -->
|
| 554 |
<!-- [/disabled_searchanise_search] -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 555 |
</blocks>
|
| 556 |
</global>
|
| 557 |
<default>
|
|
@@ -576,6 +589,7 @@
|
|
| 576 |
<object_async_enabled>1</object_async_enabled>
|
| 577 |
<input_id_search>search</input_id_search>
|
| 578 |
<enabled_searchanise_search>1</enabled_searchanise_search>
|
|
|
|
| 579 |
</config>
|
| 580 |
</searchanise>
|
| 581 |
</default>
|
| 15 |
<config>
|
| 16 |
<modules>
|
| 17 |
<Simtech_Searchanise>
|
| 18 |
+
<version>3.1.1</version>
|
| 19 |
</Simtech_Searchanise>
|
| 20 |
</modules>
|
| 21 |
<frontend>
|
| 61 |
</rating>
|
| 62 |
</observers>
|
| 63 |
</controller_action_predispatch_catalogsearch_advanced_result>
|
| 64 |
+
<core_block_abstract_to_html_before>
|
| 65 |
+
<observers>
|
| 66 |
+
<rating>
|
| 67 |
+
<class>searchanise/observer</class>
|
| 68 |
+
<method>coreBlockAbstractToHtmlBefore</method>
|
| 69 |
+
</rating>
|
| 70 |
+
</observers>
|
| 71 |
+
</core_block_abstract_to_html_before>
|
| 72 |
</events>
|
| 73 |
</frontend>
|
| 74 |
<admin>
|
| 135 |
</searchanise>
|
| 136 |
</updates>
|
| 137 |
</layout>
|
| 138 |
+
<!--<events>
|
| 139 |
+
<controller_action_predispatch>
|
| 140 |
+
<observers>
|
| 141 |
+
<rating>
|
| 142 |
+
<class>searchanise/observer</class>
|
| 143 |
+
<method>controllerActionPredispatch</method>
|
| 144 |
+
</rating>
|
| 145 |
+
</observers>
|
| 146 |
+
</controller_action_predispatch>
|
| 147 |
+
</events>-->
|
| 148 |
</adminhtml>
|
| 149 |
<global>
|
| 150 |
<models>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 151 |
|
| 152 |
<!-- <OVERRIDE CATALOG RESOURCE> -->
|
| 153 |
<!-- [disabled_searchanise_search] -->
|
| 560 |
</catalogsearch>
|
| 561 |
<!-- END -->
|
| 562 |
<!-- [/disabled_searchanise_search] -->
|
| 563 |
+
<searchanise>
|
| 564 |
+
<rewrite>
|
| 565 |
+
<resultwidget>Simtech_Searchanise_Block_Resultwidget</resultwidget>
|
| 566 |
+
</rewrite>
|
| 567 |
+
</searchanise>
|
| 568 |
</blocks>
|
| 569 |
</global>
|
| 570 |
<default>
|
| 589 |
<object_async_enabled>1</object_async_enabled>
|
| 590 |
<input_id_search>search</input_id_search>
|
| 591 |
<enabled_searchanise_search>1</enabled_searchanise_search>
|
| 592 |
+
<redirect_to_admin_after_install>1</redirect_to_admin_after_install>
|
| 593 |
</config>
|
| 594 |
</searchanise>
|
| 595 |
</default>
|
app/code/community/Simtech/Searchanise/etc/config_without_search.xml
CHANGED
|
@@ -15,7 +15,7 @@
|
|
| 15 |
<config>
|
| 16 |
<modules>
|
| 17 |
<Simtech_Searchanise>
|
| 18 |
-
<version>3.
|
| 19 |
</Simtech_Searchanise>
|
| 20 |
</modules>
|
| 21 |
<frontend>
|
|
@@ -61,6 +61,14 @@
|
|
| 61 |
</rating>
|
| 62 |
</observers>
|
| 63 |
</controller_action_predispatch_catalogsearch_advanced_result>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
</events>-->
|
| 65 |
</frontend>
|
| 66 |
<admin>
|
|
@@ -127,20 +135,19 @@
|
|
| 127 |
</searchanise>
|
| 128 |
</updates>
|
| 129 |
</layout>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 130 |
</adminhtml>
|
| 131 |
<global>
|
| 132 |
<models>
|
| 133 |
-
<!-- OVERRIDE CATALOG MODEL -->
|
| 134 |
-
<!-- [disabled_searchanise_search] -->
|
| 135 |
-
<!-- <catalog>
|
| 136 |
-
<rewrite>
|
| 137 |
-
<layer_filter_category>Simtech_Searchanise_Model_Layer_Filter_Category</layer_filter_category>
|
| 138 |
-
<layer_filter_price>Simtech_Searchanise_Model_Layer_Filter_Price</layer_filter_price>
|
| 139 |
-
</rewrite>
|
| 140 |
-
</catalog> -->
|
| 141 |
-
<!-- [/disabled_searchanise_search] -->
|
| 142 |
-
<!-- END -->
|
| 143 |
-
|
| 144 |
<!-- <OVERRIDE CATALOG RESOURCE> -->
|
| 145 |
<!-- [disabled_searchanise_search] -->
|
| 146 |
<!-- [v1.6] [v1.7] [v1.8] [v1.9] -->
|
|
@@ -552,6 +559,11 @@
|
|
| 552 |
</catalogsearch> -->
|
| 553 |
<!-- END -->
|
| 554 |
<!-- [/disabled_searchanise_search] -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 555 |
</blocks>
|
| 556 |
</global>
|
| 557 |
<default>
|
|
@@ -576,6 +588,7 @@
|
|
| 576 |
<object_async_enabled>1</object_async_enabled>
|
| 577 |
<input_id_search>search</input_id_search>
|
| 578 |
<enabled_searchanise_search>1</enabled_searchanise_search>
|
|
|
|
| 579 |
</config>
|
| 580 |
</searchanise>
|
| 581 |
</default>
|
| 15 |
<config>
|
| 16 |
<modules>
|
| 17 |
<Simtech_Searchanise>
|
| 18 |
+
<version>3.1.1</version>
|
| 19 |
</Simtech_Searchanise>
|
| 20 |
</modules>
|
| 21 |
<frontend>
|
| 61 |
</rating>
|
| 62 |
</observers>
|
| 63 |
</controller_action_predispatch_catalogsearch_advanced_result>
|
| 64 |
+
<core_block_abstract_to_html_before>
|
| 65 |
+
<observers>
|
| 66 |
+
<rating>
|
| 67 |
+
<class>searchanise/observer</class>
|
| 68 |
+
<method>coreBlockAbstractToHtmlBefore</method>
|
| 69 |
+
</rating>
|
| 70 |
+
</observers>
|
| 71 |
+
</core_block_abstract_to_html_before>
|
| 72 |
</events>-->
|
| 73 |
</frontend>
|
| 74 |
<admin>
|
| 135 |
</searchanise>
|
| 136 |
</updates>
|
| 137 |
</layout>
|
| 138 |
+
<!--<events>
|
| 139 |
+
<controller_action_predispatch>
|
| 140 |
+
<observers>
|
| 141 |
+
<rating>
|
| 142 |
+
<class>searchanise/observer</class>
|
| 143 |
+
<method>controllerActionPredispatch</method>
|
| 144 |
+
</rating>
|
| 145 |
+
</observers>
|
| 146 |
+
</controller_action_predispatch>
|
| 147 |
+
</events>-->
|
| 148 |
</adminhtml>
|
| 149 |
<global>
|
| 150 |
<models>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 151 |
<!-- <OVERRIDE CATALOG RESOURCE> -->
|
| 152 |
<!-- [disabled_searchanise_search] -->
|
| 153 |
<!-- [v1.6] [v1.7] [v1.8] [v1.9] -->
|
| 559 |
</catalogsearch> -->
|
| 560 |
<!-- END -->
|
| 561 |
<!-- [/disabled_searchanise_search] -->
|
| 562 |
+
<searchanise>
|
| 563 |
+
<rewrite>
|
| 564 |
+
<resultwidget>Simtech_Searchanise_Block_Resultwidget</resultwidget>
|
| 565 |
+
</rewrite>
|
| 566 |
+
</searchanise>
|
| 567 |
</blocks>
|
| 568 |
</global>
|
| 569 |
<default>
|
| 588 |
<object_async_enabled>1</object_async_enabled>
|
| 589 |
<input_id_search>search</input_id_search>
|
| 590 |
<enabled_searchanise_search>1</enabled_searchanise_search>
|
| 591 |
+
<redirect_to_admin_after_install>1</redirect_to_admin_after_install>
|
| 592 |
</config>
|
| 593 |
</searchanise>
|
| 594 |
</default>
|
app/design/adminhtml/default/default/template/searchanise/dashboard.phtml
CHANGED
|
@@ -22,7 +22,6 @@
|
|
| 22 |
<div class="snize" id="snize_container"></div>
|
| 23 |
|
| 24 |
<?php
|
| 25 |
-
Mage::helper('searchanise/ApiSe')->checkImportIsDone();
|
| 26 |
$searchaniseOptions = Mage::helper('searchanise/ApiSe')->getAddonOptions();
|
| 27 |
|
| 28 |
$searchaniseOptions['options_link'] = $this->getUrl(Mage::helper('searchanise/ApiSe')->getOptionsLink());
|
|
@@ -43,7 +42,14 @@
|
|
| 43 |
SearchaniseAdmin.LastRequest = '<?php echo $searchaniseOptions['last_request'];?>';
|
| 44 |
SearchaniseAdmin.LastResync = '<?php echo $searchaniseOptions['last_resync'];?>';
|
| 45 |
SearchaniseAdmin.ConnectLink = '<?php echo $searchaniseOptions['connect_link'];?>';
|
|
|
|
|
|
|
| 46 |
SearchaniseAdmin.AddonStatus = '<?php echo $searchaniseOptions['addon_status'];?>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
|
| 48 |
SearchaniseAdmin.Engines = [];
|
| 49 |
|
|
@@ -80,4 +86,4 @@
|
|
| 80 |
//]]>
|
| 81 |
</script>
|
| 82 |
|
| 83 |
-
<script type="text/javascript" src="<?php echo $seServiceUrl;?>/js/init.js"></script>
|
| 22 |
<div class="snize" id="snize_container"></div>
|
| 23 |
|
| 24 |
<?php
|
|
|
|
| 25 |
$searchaniseOptions = Mage::helper('searchanise/ApiSe')->getAddonOptions();
|
| 26 |
|
| 27 |
$searchaniseOptions['options_link'] = $this->getUrl(Mage::helper('searchanise/ApiSe')->getOptionsLink());
|
| 42 |
SearchaniseAdmin.LastRequest = '<?php echo $searchaniseOptions['last_request'];?>';
|
| 43 |
SearchaniseAdmin.LastResync = '<?php echo $searchaniseOptions['last_resync'];?>';
|
| 44 |
SearchaniseAdmin.ConnectLink = '<?php echo $searchaniseOptions['connect_link'];?>';
|
| 45 |
+
SearchaniseAdmin.ShowResultsControlPanel = true;
|
| 46 |
+
|
| 47 |
SearchaniseAdmin.AddonStatus = '<?php echo $searchaniseOptions['addon_status'];?>';
|
| 48 |
+
SearchaniseAdmin.AddonVersion = '<?php echo $searchaniseOptions['addon_version'];?>';
|
| 49 |
+
|
| 50 |
+
SearchaniseAdmin.Platform = 'magento';
|
| 51 |
+
SearchaniseAdmin.PlatformEdition = '<?php echo $searchaniseOptions['core_edition'];?>';
|
| 52 |
+
SearchaniseAdmin.PlatformVersion = '<?php echo $searchaniseOptions['core_version'];?>';
|
| 53 |
|
| 54 |
SearchaniseAdmin.Engines = [];
|
| 55 |
|
| 86 |
//]]>
|
| 87 |
</script>
|
| 88 |
|
| 89 |
+
<script type="text/javascript" src="<?php echo $seServiceUrl;?>/js/init.js"></script>
|
app/design/frontend/base/default/layout/searchanise.xml
CHANGED
|
@@ -22,4 +22,21 @@
|
|
| 22 |
<block type="Simtech_Searchanise_Block_Async" name="searchanise_async"></block>
|
| 23 |
</reference>
|
| 24 |
</default>
|
| 25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
<block type="Simtech_Searchanise_Block_Async" name="searchanise_async"></block>
|
| 23 |
</reference>
|
| 24 |
</default>
|
| 25 |
+
|
| 26 |
+
<searchanise_result_index>
|
| 27 |
+
<label>Searchanise result</label>
|
| 28 |
+
<remove name="right"/>
|
| 29 |
+
<remove name="left"/>
|
| 30 |
+
|
| 31 |
+
<reference name="head">
|
| 32 |
+
<action method="setTitle"><title>Search results</title></action>
|
| 33 |
+
</reference>
|
| 34 |
+
<reference name="root">
|
| 35 |
+
<action method="setTemplate"><template>page/1column.phtml</template></action>
|
| 36 |
+
</reference>
|
| 37 |
+
<reference name="content">
|
| 38 |
+
<block type="searchanise/resultwidget" name="searchanise_resultwidget" template="searchanise/resultwidget.phtml"></block>
|
| 39 |
+
</reference>
|
| 40 |
+
</searchanise_result_index>
|
| 41 |
+
|
| 42 |
+
</layout>
|
app/design/frontend/base/default/template/searchanise/resultwidget.phtml
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php echo $this->getMessagesBlock()->toHtml() ?>
|
| 2 |
+
<div class="page-title">
|
| 3 |
+
<h1>Search results</h1>
|
| 4 |
+
</div>
|
| 5 |
+
|
| 6 |
+
<div class="snize" id="snize_results"></div>
|
| 7 |
+
<style type="text/css"><!--
|
| 8 |
+
/* Load spinner */
|
| 9 |
+
#snize-preload-spinner {
|
| 10 |
+
height: 100px;
|
| 11 |
+
width: 32px;
|
| 12 |
+
margin: 0 auto;
|
| 13 |
+
background-position: 0px center;
|
| 14 |
+
background-repeat: no-repeat;
|
| 15 |
+
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAYAAAAALCAYAAAB2x1oQAAAACXBIWXMAAAsTAAALEwEAmpwYAAAIj0lEQVR42u2bbWhTWRrHn3Puzc37JNYmTduhTMZBZLBF6gt+2h1HMxRUOrjmgzJfXGUXLU23Y0WHYpdWikp13LZU2cVZvwwK1i0WEcq2ju5+ErVSapEi40TqtE3TtE2meb0v5+wHE4l3kjRX9qaF6QMXwsn/3t/93//Jc9P0XIDVWq3VWq3V+k0WAgCYnZ01CILwNaX0DwBgBYAxjHFHaWnpfzPtNDMz85Eoit8AwOfJoR9Ylj1bUlLyKpN+enr6d4SQEwCwEQCCCKF/aTSab202WxQA4P79+6ZQKPS1JEluhJCVUjqq1Wo79uzZ86AQ/CtXrpgmJydPJhKJfRjjIkrpiMlk6mhpafmhEPzjx49/MD4+/k00Gn3LLy4uPn/z5s2hleh/YGDgo2g0ejqdbzAYztTU1BQk/wsXLnw8Ozt7GgB2JYeGbDbbmaampp/eh690/h85cuQTr9f7Dt/pdJ65evXqj4XgK/V/586dz3ieP4EQqqKUBhmG6bVYLN/u2LEj/D58pfm3tbV9Hg6HTyCENhFC5rVabV95efn5o0ePhgvRf9xu9665ubmTKb7BYOjbsGHD2YsXL/5SCP5y+8+VPwoEAqZEIjFICNn+zp0BIRFj/OeysrJ/po/7fL4qURTvUUqLZfoAy7I7HQ7HaPr41NTUHwkhf6eUsunjGOOHWq3WNTo6CvPz8/ckSdomO29Rp9Mdra2tvaomv7e3F16+fHk/kUhskfu3Wq11bW1t/1CTf+7cOfz48eP/hMPhTbL3SVlZWX1/f//lleT/7t27myKRyGAmvtFodO3evXtEzfzb29urZ2dnByVJKkofZxhm3mazuZqbm58q4QMAKJn/Bw4c2OL1egcFQbCmj2s0mqDT6XTduHHjiZp8pf77+/uPxOPxKwDAyvSPioqKdlZVVSniK82/paXlT8FgsEfuX6vVPlm3bt0Ot9sNavaf2traY1NTU92EEJw+bjKZRrZu3fr7U6dOETX5y+1/qfwxz/PNlNLtCCFI3wCAJYR0+/3+svQdJUn6DgCKM+iLk++9Lb/fX0YI6QYAVq6nlG7neb45FAqdFkVxG6UUZBubSCS6BwcHP1STPzEx0SpvfgAAlFI2FAp1dnZ2VqjJf/bsWau8+QMAEEKwz+e7VFdXV7GS/Mdise8IIcXyvAghxbFYTPX8g8HgNXnzS16XomAweE0pX+n8n56eviZv/gAAgiBYp6enVecr8T84OPhhIpHoppSy8usriuK2UCj0V6V8Jfl3dnZWhEKhTnnzS970trx+/bpVzf5TV1dX4fP5LsmbPwBAOBzeNDY2dkZN/nL7zyd/TCn9KsdPRAZRFL9Mm9DrKaVbsokppVv8fv+Gt1/h3uxryKH/SpKkrHxCiC4SiajKFwThYIbmA5RSkCRJ5/f796nJj8fjWf2Losh5vd79K8X/0NDQp5IkVWc7niRJ1UNDQ5+qlX9XV9fGeDxele184/F4VVdX10YlfCXz3+PxVC0uLm7MJl5cXNzo8Xg2qcVX6j8SiXxJCNHlyOugEr7S/P1+/z5JknTZzpfn+YNq9h+v17tfFEUumz4Wi6nKX27/+eTPUkrLKKWQ40NYnnrN83xObVLjAIDx1L5L6MskSUrdwTKWIAiq8gVByMmPRqMlavJjsRjOJQgGgyUrxf/CwoI9+edmVv3CwoIDAJ6rkb/X612Sn9Lky09+cPKa/8PDw8VL/VNteHi4SC2+Uv+CIJTn0kqS5Eg1o3z4SvOPRqMlubQ8zzsopUSt/hMKhUpyaaPRaLGa/OX2n0/+GCE0leuAGOPJ1GuO43y5DogQAo7jfJn2zaKfYhjGl0uj0WhU5Ws0Gn+2OzSlFAwGw4yafL1eH8jFt1qtMyvF/5o1a/xLNUCr1apa/k6n059qmJm2dE2+fCXzf/PmzfNL8aurq+fV4iv1n37tMhXDMD4lfKX5GwyGmVxzKzmfVes/FotlZom5HVCTv9z+88kfI4S+l/+elLZFWZa9ndrBbrePI4Se5NA/sdvt4yk9y7K3EULRHPrvGYa5nu0CIYTiRqNRVT7HcddzXKC43W7vU5Ov1+uv52h+vNPpvLVS/O/ates5wzBPs+XFMMxTl8v1XK38PR7PmE6nG812vjqdbtTj8Ywp4SuZ/11dXSNms3ksG99sNo91d3ePqMVX6t9oNN5GCMVz5HVdCV9p/na7vY9hmHi28+U47rqa/cfpdN7SaDR8Nr5er1eVv9z+88kfcxzXjhB6mOknaIxxvd1un5I1hcMAEMigDyTfg7QTnsIY1wOAmOFu9ZDjuHaLxdLKsuyjDGZErVZb73K5flaTX1FR0arT6X51UTHGxGKxNDQ0NEyoya+srDxtNptH5HyGYYjD4Wjs6emZWEn+9Xr9YYxxIIM+oNfrVc/farUeYll2Xq5nWXbearUeUspXOv9LS0sPcRwXlPM5jguWlpaqzlfi3+Vy/azVausRQmIG/SOLxdKqlK8k/4aGhgmLxdKAMSZyvU6ne1pRUdGqZv/p6emZcDgcjQzD/IpvNptHKisrT6vJX27/+eSfeg7AJAjCXyilbnizDnU0j3WozQDwWXLoAcuy7XmsQ6+CN+ugezUazd9sNlsYAODevXumxcXFE5Ik7UMIFVFKRzmOO793794HheBfvnzZNDk5eZLn+f0YYyuldNRkMp1f4jmA/xu/sbHxgxcvXrzzHMDatWs7ent7/70S/Q8MDHwciUSaIW0dstFobK+pqfmpEPl3dHR8EggEmuHddfDtTU1NP74PX+n8P3z48PpXr141A8AXKX7yOYAXheAr9Z9cB34yuQ58nmGYPrPZ3LFz58734ivNP7kO/iRCqIoQEuQ47lZ5efn5Y8eOhQvRf9xu9xdzc3Mn0p8DWL9+/dlLly79Ugj+cvtfKv/VWq3VWq3V+g3W/wAZmNaB1vZW4QAAAABJRU5ErkJggg==);
|
| 16 |
+
}
|
| 17 |
+
--></style>
|
| 18 |
+
|
| 19 |
+
<script>
|
| 20 |
+
// <![CDATA[
|
| 21 |
+
(function(window, undefined) {
|
| 22 |
+
var sXpos = 0, sIndex = 0, sTotalFrames = 12, sInterval = null;
|
| 23 |
+
|
| 24 |
+
if (document.getElementById('snize_results').innerHTML != '') {
|
| 25 |
+
return;
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
document.getElementById('snize_results').innerHTML = '<div id="snize-preload-spinner"></div>';
|
| 29 |
+
sInterval = setInterval(function()
|
| 30 |
+
{
|
| 31 |
+
var spinner = document.getElementById('snize-preload-spinner');
|
| 32 |
+
if (spinner) {
|
| 33 |
+
document.getElementById('snize-preload-spinner').style.backgroundPosition = (- sXpos) + 'px center';
|
| 34 |
+
} else {
|
| 35 |
+
clearInterval(sInterval);
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
sXpos += 32;
|
| 39 |
+
sIndex += 1;
|
| 40 |
+
|
| 41 |
+
if (sIndex >= 12) {
|
| 42 |
+
sXpos = 0;
|
| 43 |
+
sIndex = 0;
|
| 44 |
+
}
|
| 45 |
+
}, 30);
|
| 46 |
+
}(window));
|
| 47 |
+
// ]]></script>
|
package.xml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Simtech_Searchanise</name>
|
| 4 |
-
<version>3.1.
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license uri="http://docs.searchanise.com/connector_addon/license_agreement.html">Commercial license: http://docs.searchanise.com/connector_addon/license_agreement.html</license>
|
| 7 |
<channel>community</channel>
|
|
@@ -10,29 +10,16 @@
|
|
| 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.
|
| 11 |

|
| 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>[+]
|
| 14 |
-
[+]
|
| 15 |
-
[
|
| 16 |
-
[
|
| 17 |
-
[
|
| 18 |
-
[
|
| 19 |
-
<br>
|
| 20 |
-
[*] Magento: Set search field ID: The setting caption updated.<br>
|
| 21 |
-
[*] Redundant product attributes are now longer collected.<br>
|
| 22 |
-
[*] Obsolete code with category navigation was removed.<br>
|
| 23 |
-
[*] Addition cms pages was hidden from search by default.<br>
|
| 24 |
-
[*] Speed of product export was increased.<br>
|
| 25 |
-
<br>
|
| 26 |
-
[!] Due to inconsistency of Magento's standard "Category Products" index, not all products were searchable. Fixed.<br>
|
| 27 |
-
[!] All categories were submitted for each store, even if it had its own default (parent) category. Fixed.<br>
|
| 28 |
-
[!] If sorting by custom attribute was applied the search results were shown without using Searchanise. Fixed.<br>
|
| 29 |
-
[!] Allow Qty Below 0 setting handing was fixed.<br>
|
| 30 |
-
[!] Erroneous server requests were handled incorrectly, cramming store logs with notices. Fixed.<br>
|
| 31 |
-
[!] Default autocomplete wasn't disabled in magento 1.9. Fixed.<br></notes>
|
| 32 |
<authors><author><name>Simbirsk Technologies, Ltd.</name><user>searchanise</user><email>sales@searchanise.com</email></author></authors>
|
| 33 |
-
<date>
|
| 34 |
-
<time>
|
| 35 |
-
<contents><target name="magecommunity"><dir name="Simtech"><dir name="Searchanise"><dir name="Block"><file name="Async.php" hash="7fb3859416e0d468235082ca41c5a96b"/><file name="Autocomplete.php" hash="efc89ac3f897be3bc307fba6a36778f0"/><file name="Jsinit.php" hash="
|
| 36 |
<compatible/>
|
| 37 |
<dependencies><required><php><min>5.2.13</min><max>6.0.0</max></php></required></dependencies>
|
| 38 |
</package>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Simtech_Searchanise</name>
|
| 4 |
+
<version>3.1.1</version>
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license uri="http://docs.searchanise.com/connector_addon/license_agreement.html">Commercial license: http://docs.searchanise.com/connector_addon/license_agreement.html</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.
|
| 11 |

|
| 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>[+] Search results widget was added.<br>
|
| 14 |
+
[+] Notice about a new version of extension was added.<br>
|
| 15 |
+
[*] Compatibility with third-party addons was improved.<br>
|
| 16 |
+
[*] Indexation status check was improved.<br>
|
| 17 |
+
[*] Redundant product attributes are no longer collected.<br>
|
| 18 |
+
[!] Searching by a product title and description could show incorrect search results on the advanced search page. Fixed.<br></notes>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
<authors><author><name>Simbirsk Technologies, Ltd.</name><user>searchanise</user><email>sales@searchanise.com</email></author></authors>
|
| 20 |
+
<date>2016-02-14</date>
|
| 21 |
+
<time>22:18:41</time>
|
| 22 |
+
<contents><target name="magecommunity"><dir name="Simtech"><dir name="Searchanise"><dir name="Block"><file name="Async.php" hash="7fb3859416e0d468235082ca41c5a96b"/><file name="Autocomplete.php" hash="efc89ac3f897be3bc307fba6a36778f0"/><file name="Jsinit.php" hash="13ed56e4a27e2ee21bc37c3582136ada"/><dir name="Product"><dir name="List"><file name="Toolbar.php" hash="5477041c73350c0f32fdaf5b7c6b99fc"/></dir></dir><file name="Result.php" hash="dec7b27ab9511c956680eb60eba9b95e"/><file name="Resultwidget.php" hash="9b3ec31ad83ca02ca79bbdfc785f8afe"/></dir><dir name="Helper"><file name="ApiCategories.php" hash="06a5d63372280ef0feaa833b23388a09"/><file name="ApiPages.php" hash="40b2c244bb969d3d1a3202e34059e14e"/><file name="ApiProducts.php" hash="359489a0e8590067eea99df8c6f989ab"/><file name="ApiSe.php" hash="225d3a577421658e8134b3b1b577b2ee"/><file name="Data.php" hash="c2ccf96081b5c799530ae69aab504d18"/></dir><dir name="Model"><file name="Advanced.php" hash="e0c92b53cec8fbbfdd79690612c7ee84"/><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="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"/></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="0b48985221748df51e4f867ae6ef0285"/><file name="Queue.php" hash="71647dc365b09e5e00ad9e13cfc37a43"/><file name="Request.php" hash="02d5d46fdbd7923cbc407c40df1d68c0"/><dir name="Resource"><dir name="Advanced"><file name="Collection.php" hash="41256fb10dff7e97d0c9136dc0500bf3"/></dir><dir name="Eav"><dir name="Mysql4"><dir name="Layer"><dir name="Filter"><file name="Attribute.php" hash="05320757b9289edac4f15230cd06c0e1"/><file name="Price.php" hash="ed4e21a18c552e3a92b21ff6e8bc5d61"/></dir></dir><dir name="Product"><file name="Action.php" hash="006e3c8c775cf31a8b9c66fb934c9d2d"/></dir></dir></dir><dir name="Fulltext"><file name="Collection.php" hash="13ef26616fafb14e9b51db31c71e4462"/></dir><dir name="Layer"><dir name="Filter"><file name="Attribute.php" hash="206e81ee170a56fac499169e66ad782d"/><file name="Price.php" hash="57d56f6841c0e2b89c21947aa2a23e86"/></dir></dir><dir name="Product"><file name="Collection.php" hash="ad006af84576dab614a08beec5200964"/></dir><file name="Store.php" hash="6a337d4b6561aa96b96236d66cc9aa30"/></dir><file name="Searchanise.php" hash="a925b75ff5b088f447cc3369c33335a1"/><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"><dir name="Adminhtml"><file name="SearchaniseController.php" hash="b05fe6f1b3d318a7186ec60b15e0fb04"/></dir><file name="AsyncController.php" hash="1fcec63f99231fc260995ae98aaaf86f"/><file name="InfoController.php" hash="74f98b7e5521ca299dbfef65660f1c63"/><file name="ResultController.php" hash="260d0eec9bcb5d2048cf2f0c0040a1cc"/></dir><dir name="etc"><file name="config.xml" hash="0bd340396752f3d556d7593c8e920376"/><file name="config_without_search.xml" hash="e41234b3a935f94bdbf016f8dfe84663"/><file name="system.xml" hash="9d6e139bc5ba5c1bdc789bb8fab01d1c"/></dir><dir name="sql"><dir name="searchanise_setup"><file name="mysql4-install-0.1.0.php" hash="754324c8783e9cc24de86396e1587e73"/></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="3925c38299c0b055e8aa0c1bc9e6a39e"/></dir></dir><dir name="layout"><file name="searchanise.xml" hash="68baa611d05db05f8816ea2a8260e961"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="searchanise.xml" hash="0e2795c2e3c5f5af5544bb8471d67037"/></dir><dir name="template"><dir name="searchanise"><file name="resultwidget.phtml" hash="f4cf9ce97294275b5ae9d8e2252be41b"/></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="955cdb2011b7abf04227aae37db5bb0b"/></dir></target></contents>
|
| 23 |
<compatible/>
|
| 24 |
<dependencies><required><php><min>5.2.13</min><max>6.0.0</max></php></required></dependencies>
|
| 25 |
</package>
|
