Version Notes
New features:
- Improved configurated product support, child product attribute values are now taken into account for the parent product.
- Additional missing/invalid product check.
- Magento Enterprise support.
Improvements & fixes:
- Products from a storefront could appear in another storefront search. Fixed.
- Searchanise admin panel could not work if the store title included the ' symbol. Fixed.
- Third-party extension compatibility improved (the file config_without_search.xml updated).
Download this release
Release Info
Developer | Simbirsk Technologies, Ltd. |
Extension | Simtech_Searchanise |
Version | 2.0.0 |
Comparing to | |
See all releases |
Code changes from version 1.1.8 to 2.0.0
- app/code/community/Simtech/Searchanise/Block/Product/List/Toolbar.php +24 -0
- app/code/community/Simtech/Searchanise/Helper/ApiSe.php +16 -3
- app/code/community/Simtech/Searchanise/Helper/ApiXML.php +259 -161
- app/code/community/Simtech/Searchanise/Helper/Data.php +32 -27
- app/code/community/Simtech/Searchanise/controllers/AdvancedController.php +1 -2
- app/code/community/Simtech/Searchanise/controllers/AsyncController.php +2 -1
- app/code/community/Simtech/Searchanise/controllers/CategoryController.php +1 -2
- app/code/community/Simtech/Searchanise/controllers/InfoController.php +3 -2
- app/code/community/Simtech/Searchanise/controllers/ProductController.php +1 -2
- app/code/community/Simtech/Searchanise/controllers/ResultController.php +4 -5
- app/code/community/Simtech/Searchanise/etc/config.xml +25 -23
- app/code/community/Simtech/Searchanise/etc/config_without_search.xml +25 -23
- app/design/adminhtml/default/default/template/searchanise/dashboard.phtml +4 -4
- package.xml +12 -16
app/code/community/Simtech/Searchanise/Block/Product/List/Toolbar.php
CHANGED
@@ -14,6 +14,30 @@
|
|
14 |
|
15 |
class Simtech_Searchanise_Block_Product_List_Toolbar extends Mage_Catalog_Block_Product_List_Toolbar
|
16 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
/**
|
18 |
* Retrieve available limits for current view mode
|
19 |
*
|
14 |
|
15 |
class Simtech_Searchanise_Block_Product_List_Toolbar extends Mage_Catalog_Block_Product_List_Toolbar
|
16 |
{
|
17 |
+
/**
|
18 |
+
* Retrieve available Order fields list
|
19 |
+
*
|
20 |
+
* @return array
|
21 |
+
*/
|
22 |
+
public function getAvailableOrders()
|
23 |
+
{
|
24 |
+
$availableOrders = parent::getAvailableOrders();
|
25 |
+
|
26 |
+
if (Mage::helper('searchanise')->checkSearchaniseIsRunning()) {
|
27 |
+
// Fixme in the feature:
|
28 |
+
// products could have different position in different categories, sort by "position" disabled.
|
29 |
+
if (isset($availableOrders['position'])) {
|
30 |
+
unset($availableOrders['position']);
|
31 |
+
$this->setAvailableOrders($availableOrders);
|
32 |
+
$this->setDefaultOrder('title');
|
33 |
+
$this->setDefaultDirection('asc');
|
34 |
+
}
|
35 |
+
// end
|
36 |
+
}
|
37 |
+
|
38 |
+
return $availableOrders;
|
39 |
+
}
|
40 |
+
|
41 |
/**
|
42 |
* Retrieve available limits for current view mode
|
43 |
*
|
app/code/community/Simtech/Searchanise/Helper/ApiSe.php
CHANGED
@@ -453,10 +453,23 @@ class Simtech_Searchanise_Helper_ApiSe
|
|
453 |
$ret['last_resync'] = self::formatDate(self::getLastResync(), Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM, true);
|
454 |
|
455 |
$ret['addon_status'] = self::getStatusModule() == 'Y' ? 'enabled' : 'disabled';
|
456 |
-
|
457 |
$ret['addon_version'] = (string) Mage::getConfig()->getModuleConfig("Simtech_Searchanise")->version;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
458 |
$ret['core_version'] = Mage::getVersion();
|
459 |
-
|
|
|
460 |
return $ret;
|
461 |
}
|
462 |
|
@@ -1190,7 +1203,7 @@ class Simtech_Searchanise_Helper_ApiSe
|
|
1190 |
->addFieldToFilter('entity_id', array("from" => $start, "to" => $end))
|
1191 |
->setPageSize($step);
|
1192 |
|
1193 |
-
if (
|
1194 |
$products = $products->addStoreFilter($store);
|
1195 |
}
|
1196 |
|
453 |
$ret['last_resync'] = self::formatDate(self::getLastResync(), Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM, true);
|
454 |
|
455 |
$ret['addon_status'] = self::getStatusModule() == 'Y' ? 'enabled' : 'disabled';
|
|
|
456 |
$ret['addon_version'] = (string) Mage::getConfig()->getModuleConfig("Simtech_Searchanise")->version;
|
457 |
+
|
458 |
+
$versionInfo = Mage::getVersionInfo();
|
459 |
+
$coreEdition = 'Community';
|
460 |
+
// [v1.7] [v1.8]
|
461 |
+
if (method_exists('Mage', 'getEdition')) {
|
462 |
+
$coreEdition = Mage::getEdition();
|
463 |
+
// [/v1.7] [/v1.8]
|
464 |
+
// [v1.5] [v1.6]
|
465 |
+
} elseif (isset($versionInfo['minor']) && $versionInfo['minor'] > 6) {
|
466 |
+
$coreEdition = 'Enterprise';
|
467 |
+
}
|
468 |
+
// [/v1.5] [/v1.6]
|
469 |
+
$ret['core_edition'] = $coreEdition;
|
470 |
$ret['core_version'] = Mage::getVersion();
|
471 |
+
$ret['core_version_info'] = $versionInfo;
|
472 |
+
|
473 |
return $ret;
|
474 |
}
|
475 |
|
1203 |
->addFieldToFilter('entity_id', array("from" => $start, "to" => $end))
|
1204 |
->setPageSize($step);
|
1205 |
|
1206 |
+
if ($store) {
|
1207 |
$products = $products->addStoreFilter($store);
|
1208 |
}
|
1209 |
|
app/code/community/Simtech/Searchanise/Helper/ApiXML.php
CHANGED
@@ -160,10 +160,10 @@ class Simtech_Searchanise_Helper_ApiXML extends Mage_Core_Helper_Data
|
|
160 |
*
|
161 |
* @param Mage_Catalog_Model_Product $product
|
162 |
* @param Mage_Core_Model_Store $store
|
163 |
-
* @param
|
164 |
* @return float
|
165 |
*/
|
166 |
-
private static function getProductQty($product, $store, $
|
167 |
{
|
168 |
$quantity = 1;
|
169 |
|
@@ -186,38 +186,10 @@ class Simtech_Searchanise_Helper_ApiXML extends Mage_Core_Helper_Data
|
|
186 |
} else {
|
187 |
$quantity = $stockItem->getQty();
|
188 |
|
189 |
-
if ($
|
190 |
-
|
191 |
-
|
192 |
-
($
|
193 |
-
|
194 |
-
// fixme in the future
|
195 |
-
// maybe exist simple solution get `quantity` for TYPE_BUNDLE or TYPE_CONFIGURABLE product
|
196 |
-
if ($typeInstance = $product->getTypeInstance()) {
|
197 |
-
$requiredChildrenIds = $typeInstance->getChildrenIds($product->getId(), true);
|
198 |
-
if ($requiredChildrenIds) {
|
199 |
-
$childrenIds = array();
|
200 |
-
$childrenProducts = null;
|
201 |
-
|
202 |
-
foreach ($requiredChildrenIds as $groupedChildrenIds) {
|
203 |
-
$childrenIds = array_merge($childrenIds, $groupedChildrenIds);
|
204 |
-
}
|
205 |
-
|
206 |
-
if ($childrenIds) {
|
207 |
-
$childrenProducts = self::getProducts($childrenIds, $store);
|
208 |
-
}
|
209 |
-
|
210 |
-
if ($childrenProducts) {
|
211 |
-
$quantity = 0;
|
212 |
-
foreach ($childrenProducts as $childrenProductsKey => $childrenProduct) {
|
213 |
-
if ($childrenProduct) {
|
214 |
-
$quantity += self::getProductQty($childrenProduct, $store, false);
|
215 |
-
}
|
216 |
-
}
|
217 |
-
}
|
218 |
-
}
|
219 |
-
}
|
220 |
-
// end fixme
|
221 |
}
|
222 |
}
|
223 |
}
|
@@ -330,6 +302,104 @@ class Simtech_Searchanise_Helper_ApiXML extends Mage_Core_Helper_Data
|
|
330 |
return $minimalPrice;
|
331 |
}
|
332 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
333 |
public static function generateProductXML($product, $store = null, $checkData = true)
|
334 |
{
|
335 |
$entry = '';
|
@@ -341,6 +411,14 @@ class Simtech_Searchanise_Helper_ApiXML extends Mage_Core_Helper_Data
|
|
341 |
return $entry;
|
342 |
}
|
343 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
344 |
$entry .= '<entry>' . self::XML_END_LINE;
|
345 |
$entry .= '<id>' . $product->getId() . '</id>' . self::XML_END_LINE;
|
346 |
|
@@ -385,7 +463,7 @@ class Simtech_Searchanise_Helper_ApiXML extends Mage_Core_Helper_Data
|
|
385 |
|
386 |
// <quantity>
|
387 |
{
|
388 |
-
$quantity = self::getProductQty($product, $store,
|
389 |
|
390 |
$entry .= '<cs:quantity>' . ceil($quantity) . '</cs:quantity>' . self::XML_END_LINE;
|
391 |
$isInStock = $quantity > 0;
|
@@ -412,16 +490,16 @@ class Simtech_Searchanise_Helper_ApiXML extends Mage_Core_Helper_Data
|
|
412 |
|
413 |
// <attributes_position>
|
414 |
{
|
|
|
|
|
415 |
$position = $product->getData('position');
|
416 |
if ($position) {
|
417 |
$entry .= '<cs:attribute name="position" type="int">';
|
418 |
-
|
419 |
-
// fixme in the feature
|
420 |
-
// sort by "position" disabled
|
421 |
$entry .= $product->getData('position');
|
422 |
|
423 |
$entry .= '</cs:attribute>' . self::XML_END_LINE;
|
424 |
}
|
|
|
425 |
}
|
426 |
// </attributes_position>
|
427 |
|
@@ -438,15 +516,38 @@ class Simtech_Searchanise_Helper_ApiXML extends Mage_Core_Helper_Data
|
|
438 |
foreach ($attributes as $attribute) {
|
439 |
$attributeCode = $attribute->getAttributeCode();
|
440 |
$value = $product->getData($attributeCode);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
441 |
$inputType = $attribute->getData('frontend_input');
|
442 |
$isSearchable = $attribute->getIsSearchable();
|
443 |
$attributeName = 'attribute_' . $attribute->getId();
|
444 |
$attributeWeight = 0;
|
445 |
|
446 |
-
if ($
|
447 |
-
// nothing
|
448 |
-
|
449 |
-
} elseif (is_array($value) && empty($value)) {
|
450 |
// nothing
|
451 |
|
452 |
} elseif ($attributeCode == 'price') {
|
@@ -456,48 +557,45 @@ class Simtech_Searchanise_Helper_ApiXML extends Mage_Core_Helper_Data
|
|
456 |
} elseif ($attributeCode == 'group_price') {
|
457 |
// nothing
|
458 |
// fixme in the future if need
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
459 |
|
460 |
-
} elseif ($attributeCode == 'short_description') {
|
461 |
if ($isSearchable) {
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
$attributeWeight = self::WEIGHT_META_TITLE;
|
480 |
}
|
481 |
-
|
482 |
-
$entry .= '<![CDATA[' . $value . ']]>';
|
483 |
-
$entry .= '</cs:attribute>' . self::XML_END_LINE;
|
484 |
-
|
485 |
-
} elseif ($attributeCode == 'meta_description') {
|
486 |
-
if ($isSearchable) {
|
487 |
-
$attributeWeight = self::WEIGHT_META_DESCRIPTION;
|
488 |
-
}
|
489 |
-
$entry .= '<cs:attribute name="' . $attributeName .'" type="text" text_search="Y" weight="' . $attributeWeight . '">';
|
490 |
-
$entry .= '<![CDATA[' . $value . ']]>';
|
491 |
-
$entry .= '</cs:attribute>' . self::XML_END_LINE;
|
492 |
|
493 |
-
|
494 |
-
|
495 |
-
$attributeWeight = self::WEIGHT_META_KEYWORDS;
|
496 |
-
}
|
497 |
$entry .= '<cs:attribute name="' . $attributeName .'" type="text" text_search="Y" weight="' . $attributeWeight . '">';
|
498 |
-
|
|
|
|
|
|
|
|
|
499 |
$entry .= '</cs:attribute>' . self::XML_END_LINE;
|
500 |
-
|
501 |
|
502 |
// <dates>
|
503 |
// It can be used for sort.
|
@@ -532,42 +630,9 @@ class Simtech_Searchanise_Helper_ApiXML extends Mage_Core_Helper_Data
|
|
532 |
$entry .= $value;
|
533 |
$entry .= '</cs:attribute>' . self::XML_END_LINE;
|
534 |
|
535 |
-
} elseif ($inputType == 'select') {
|
536 |
-
// <id_value>
|
537 |
-
// Example values: '0', '1', 'AF'.
|
538 |
-
$entry .= '<cs:attribute name="' . $attributeName .'" type="text" text_search="N">';
|
539 |
-
$entry .= '<![CDATA[' . $value . ']]>';
|
540 |
-
$entry .= '</cs:attribute>' . self::XML_END_LINE;
|
541 |
-
// </id_value>
|
542 |
-
|
543 |
-
// <text_value>
|
544 |
-
if ($isSearchable) {
|
545 |
-
$attributeWeight = self::WEIGHT_SELECT_ATTRIBUTES;
|
546 |
-
$textValue = $product->getResource()->getAttribute($attributeCode)->getFrontend()->getValue($product);
|
547 |
-
|
548 |
-
if ($textValue != '') {
|
549 |
-
$entry .= '<cs:attribute name="' . $attributeCode .'" type="text" text_search="Y" weight="' . $attributeWeight . '">';
|
550 |
-
$entry .= '<![CDATA[' . $textValue . ']]>';
|
551 |
-
$entry .= '</cs:attribute>' . self::XML_END_LINE;
|
552 |
-
}
|
553 |
-
}
|
554 |
-
// <text_value>
|
555 |
-
|
556 |
-
} elseif ($inputType == 'multiselect') {
|
557 |
// <id_values>
|
558 |
-
$strIdValues =
|
559 |
-
if ($value != '') {
|
560 |
-
$arrValues = explode(',', $value);
|
561 |
-
if (!empty($arrValues)) {
|
562 |
-
foreach ($arrValues as $v) {
|
563 |
-
if ($v != '') {
|
564 |
-
$strIdValues .= '<value><![CDATA[' . $v . ']]></value>';
|
565 |
-
}
|
566 |
-
}
|
567 |
-
}
|
568 |
-
}
|
569 |
-
|
570 |
-
if ($strIdValues != '') {
|
571 |
$entry .= '<cs:attribute name="' . $attributeName .'" type="text">';
|
572 |
// fixme in the future
|
573 |
// need for fixed bug of Server
|
@@ -583,21 +648,10 @@ class Simtech_Searchanise_Helper_ApiXML extends Mage_Core_Helper_Data
|
|
583 |
$strTextValues = '';
|
584 |
if ($isSearchable) {
|
585 |
$attributeWeight = self::WEIGHT_SELECT_ATTRIBUTES;
|
586 |
-
$
|
587 |
-
if ($textValues != '') {
|
588 |
-
$arrValues = explode(',', $textValues);
|
589 |
-
if (!empty($arrValues)) {
|
590 |
-
foreach ($arrValues as $v) {
|
591 |
-
if ($v != '') {
|
592 |
-
$trimValue = trim($v);
|
593 |
-
$strTextValues .= '<value><![CDATA[' . $trimValue . ']]></value>';
|
594 |
-
}
|
595 |
-
}
|
596 |
-
}
|
597 |
-
}
|
598 |
}
|
599 |
|
600 |
-
if ($
|
601 |
$entry .= '<cs:attribute name="' . $attributeCode .'" type="text" text_search="Y" weight="' . $attributeWeight . '">';
|
602 |
// fixme in the future
|
603 |
// need for fixed bug of Server
|
@@ -608,24 +662,27 @@ class Simtech_Searchanise_Helper_ApiXML extends Mage_Core_Helper_Data
|
|
608 |
}
|
609 |
// <text_values>
|
610 |
|
611 |
-
} elseif ($inputType == 'text') {
|
612 |
if ($isSearchable) {
|
613 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
614 |
}
|
615 |
-
|
616 |
-
$
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
$
|
|
|
623 |
}
|
624 |
|
625 |
-
$entry .= '<cs:attribute name="' . $attributeName .'" type="text" text_search="Y" weight="' . $attributeWeight . '">';
|
626 |
-
$entry .= '<![CDATA[' . $value . ']]>';
|
627 |
-
$entry .= '</cs:attribute>' . self::XML_END_LINE;
|
628 |
-
|
629 |
} else {
|
630 |
// attribute is not filtrable
|
631 |
}
|
@@ -793,6 +850,40 @@ class Simtech_Searchanise_Helper_ApiXML extends Mage_Core_Helper_Data
|
|
793 |
return $entry;
|
794 |
}
|
795 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
796 |
// public static function getProductsByItems($productIds, $store = null, $flagAddMinimalPrice = false, $customerGroupId = null)
|
797 |
public static function getProducts($productIds, $store = null, $flagAddMinimalPrice = false, $customerGroupId = null)
|
798 |
{
|
@@ -804,32 +895,39 @@ class Simtech_Searchanise_Helper_ApiXML extends Mage_Core_Helper_Data
|
|
804 |
}
|
805 |
|
806 |
$products = array();
|
|
|
807 |
|
808 |
-
if (
|
809 |
-
$
|
810 |
-
|
811 |
-
|
812 |
-
foreach ($productIds as $key => $productId) {
|
813 |
-
if (empty($productId)) {
|
814 |
-
continue;
|
815 |
-
}
|
816 |
-
// It can use various types of data.
|
817 |
-
if (is_array($productId)) {
|
818 |
-
if (isset($productId['entity_id'])) {
|
819 |
-
$productId = $productId['entity_id'];
|
820 |
}
|
821 |
-
|
822 |
-
|
823 |
-
|
824 |
-
|
825 |
-
|
826 |
-
|
827 |
}
|
828 |
-
|
829 |
-
|
|
|
|
|
|
|
|
|
|
|
830 |
}
|
831 |
|
832 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
833 |
}
|
834 |
}
|
835 |
|
160 |
*
|
161 |
* @param Mage_Catalog_Model_Product $product
|
162 |
* @param Mage_Core_Model_Store $store
|
163 |
+
* @param array Mage_Catalog_Model_Product $unitedProducts - Current product + childrens products (if exists)
|
164 |
* @return float
|
165 |
*/
|
166 |
+
private static function getProductQty($product, $store, $unitedProducts = array())
|
167 |
{
|
168 |
$quantity = 1;
|
169 |
|
186 |
} else {
|
187 |
$quantity = $stockItem->getQty();
|
188 |
|
189 |
+
if ($unitedProducts) {
|
190 |
+
$quantity = 0;
|
191 |
+
foreach ($unitedProducts as $itemProductKey => $itemProduct) {
|
192 |
+
$quantity += self::getProductQty($itemProduct, $store);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
193 |
}
|
194 |
}
|
195 |
}
|
302 |
return $minimalPrice;
|
303 |
}
|
304 |
|
305 |
+
/**
|
306 |
+
* Get childs products
|
307 |
+
*
|
308 |
+
* @param Mage_Catalog_Model_Product $product
|
309 |
+
* @return array Mage_Catalog_Model_Resource_Product
|
310 |
+
*/
|
311 |
+
private static function getChildrenProducts($product, $store = null)
|
312 |
+
{
|
313 |
+
$childrenProducts = array();
|
314 |
+
|
315 |
+
// if CONFIGURABLE OR GROUPED OR BUNDLE
|
316 |
+
if (($product->getData('type_id') == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE) ||
|
317 |
+
($product->isSuper())) {
|
318 |
+
|
319 |
+
if ($typeInstance = $product->getTypeInstance()) {
|
320 |
+
$requiredChildrenIds = $typeInstance->getChildrenIds($product->getId(), true);
|
321 |
+
if ($requiredChildrenIds) {
|
322 |
+
$childrenIds = array();
|
323 |
+
|
324 |
+
foreach ($requiredChildrenIds as $groupedChildrenIds) {
|
325 |
+
$childrenIds = array_merge($childrenIds, $groupedChildrenIds);
|
326 |
+
}
|
327 |
+
|
328 |
+
if ($childrenIds) {
|
329 |
+
$childrenProducts = self::getProducts($childrenIds, $store);
|
330 |
+
}
|
331 |
+
}
|
332 |
+
}
|
333 |
+
}
|
334 |
+
|
335 |
+
return $childrenProducts;
|
336 |
+
}
|
337 |
+
|
338 |
+
private static function getIdAttributeValuesXML($value)
|
339 |
+
{
|
340 |
+
$strIdValues = '';
|
341 |
+
|
342 |
+
$arrValues = explode(',', $value);
|
343 |
+
if (!empty($arrValues)) {
|
344 |
+
foreach ($arrValues as $v) {
|
345 |
+
if ($v != '') {
|
346 |
+
// Example values: '0', '1', 'AF'.
|
347 |
+
$strIdValues .= '<value><![CDATA[' . $v . ']]></value>';
|
348 |
+
}
|
349 |
+
}
|
350 |
+
}
|
351 |
+
|
352 |
+
return $strIdValues;
|
353 |
+
}
|
354 |
+
|
355 |
+
private static function getIdAttributesValuesXML($values)
|
356 |
+
{
|
357 |
+
$strIdValues = '';
|
358 |
+
|
359 |
+
foreach ($values as $v) {
|
360 |
+
$strIdValues .= self::getIdAttributeValuesXML($v);
|
361 |
+
}
|
362 |
+
|
363 |
+
return $strIdValues;
|
364 |
+
}
|
365 |
+
|
366 |
+
private static function addArrTextAttributeValues($product, $attributeCode, &$arrTextValues)
|
367 |
+
{
|
368 |
+
$textValues = $product->getResource()->getAttribute($attributeCode)->getFrontend()->getValue($product);
|
369 |
+
if ($textValues != '') {
|
370 |
+
$arrValues = explode(',', $textValues);
|
371 |
+
if (!empty($arrValues)) {
|
372 |
+
foreach ($arrValues as $v) {
|
373 |
+
if ($v != '') {
|
374 |
+
$trimValue = trim($v);
|
375 |
+
if ($trimValue != '' && !in_array($trimValue, $arrTextValues)) {
|
376 |
+
$arrTextValues[] .= $trimValue;
|
377 |
+
}
|
378 |
+
}
|
379 |
+
}
|
380 |
+
}
|
381 |
+
}
|
382 |
+
|
383 |
+
return true;
|
384 |
+
}
|
385 |
+
|
386 |
+
private static function getTextAttributesValuesXML($products, $attributeCode)
|
387 |
+
{
|
388 |
+
$strTextValues = '';
|
389 |
+
$arrTextValues = array();
|
390 |
+
|
391 |
+
foreach ($products as $p) {
|
392 |
+
self::addArrTextAttributeValues($p, $attributeCode, $arrTextValues);
|
393 |
+
}
|
394 |
+
if ($arrTextValues) {
|
395 |
+
foreach ($arrTextValues as $textValue) {
|
396 |
+
$strTextValues .= '<value><![CDATA[' . $textValue . ']]></value>';
|
397 |
+
}
|
398 |
+
}
|
399 |
+
|
400 |
+
return $strTextValues;
|
401 |
+
}
|
402 |
+
|
403 |
public static function generateProductXML($product, $store = null, $checkData = true)
|
404 |
{
|
405 |
$entry = '';
|
411 |
return $entry;
|
412 |
}
|
413 |
}
|
414 |
+
|
415 |
+
$unitedProducts = array($product); // current product + childrens products (if exists)
|
416 |
+
$childrenProducts = self::getChildrenProducts($product, $store);
|
417 |
+
if ($childrenProducts) {
|
418 |
+
foreach ($childrenProducts as $childrenProductsKey => $childrenProduct) {
|
419 |
+
$unitedProducts[] = $childrenProduct;
|
420 |
+
}
|
421 |
+
}
|
422 |
$entry .= '<entry>' . self::XML_END_LINE;
|
423 |
$entry .= '<id>' . $product->getId() . '</id>' . self::XML_END_LINE;
|
424 |
|
463 |
|
464 |
// <quantity>
|
465 |
{
|
466 |
+
$quantity = self::getProductQty($product, $store, $unitedProducts);
|
467 |
|
468 |
$entry .= '<cs:quantity>' . ceil($quantity) . '</cs:quantity>' . self::XML_END_LINE;
|
469 |
$isInStock = $quantity > 0;
|
490 |
|
491 |
// <attributes_position>
|
492 |
{
|
493 |
+
// Fixme in the feature:
|
494 |
+
// products could have different position in different categories, sort by "position" disabled.
|
495 |
$position = $product->getData('position');
|
496 |
if ($position) {
|
497 |
$entry .= '<cs:attribute name="position" type="int">';
|
|
|
|
|
|
|
498 |
$entry .= $product->getData('position');
|
499 |
|
500 |
$entry .= '</cs:attribute>' . self::XML_END_LINE;
|
501 |
}
|
502 |
+
// end
|
503 |
}
|
504 |
// </attributes_position>
|
505 |
|
516 |
foreach ($attributes as $attribute) {
|
517 |
$attributeCode = $attribute->getAttributeCode();
|
518 |
$value = $product->getData($attributeCode);
|
519 |
+
|
520 |
+
// unitedValues - childrens values + main value
|
521 |
+
$unitedValues = array();
|
522 |
+
{
|
523 |
+
if ($value == '') {
|
524 |
+
// nothing
|
525 |
+
} elseif (is_array($value) && empty($value)) {
|
526 |
+
// nothing
|
527 |
+
} else {
|
528 |
+
$unitedValues[] = $value;
|
529 |
+
}
|
530 |
+
if ($childrenProducts) {
|
531 |
+
foreach ($childrenProducts as $childrenProductsKey => $childrenProduct) {
|
532 |
+
$childValue = $childrenProduct->getData($attributeCode);
|
533 |
+
if ($childValue == '') {
|
534 |
+
// Nothing.
|
535 |
+
} elseif (is_array($childValue) && empty($childValue)) {
|
536 |
+
// Nothing.
|
537 |
+
} else {
|
538 |
+
if (!in_array($childValue, $unitedValues)) {
|
539 |
+
$unitedValues[] = $childValue;
|
540 |
+
}
|
541 |
+
}
|
542 |
+
}
|
543 |
+
}
|
544 |
+
}
|
545 |
$inputType = $attribute->getData('frontend_input');
|
546 |
$isSearchable = $attribute->getIsSearchable();
|
547 |
$attributeName = 'attribute_' . $attribute->getId();
|
548 |
$attributeWeight = 0;
|
549 |
|
550 |
+
if (empty($unitedValues)) {
|
|
|
|
|
|
|
551 |
// nothing
|
552 |
|
553 |
} elseif ($attributeCode == 'price') {
|
557 |
} elseif ($attributeCode == 'group_price') {
|
558 |
// nothing
|
559 |
// fixme in the future if need
|
560 |
+
|
561 |
+
} elseif (
|
562 |
+
$attributeCode == 'short_description' ||
|
563 |
+
$attributeCode == 'description' ||
|
564 |
+
$attributeCode == 'meta_title' ||
|
565 |
+
$attributeCode == 'meta_description' ||
|
566 |
+
$attributeCode == 'meta_keyword') {
|
567 |
|
|
|
568 |
if ($isSearchable) {
|
569 |
+
// <descriptions>
|
570 |
+
if ($inputType == 'short_description') {
|
571 |
+
$attributeWeight = self::WEIGHT_SHORT_DESCRIPTION;
|
572 |
+
} elseif ($inputType == 'description') {
|
573 |
+
$attributeWeight = self::WEIGHT_DESCRIPTION;
|
574 |
+
// </descriptions>
|
575 |
+
|
576 |
+
// <meta_information>
|
577 |
+
} elseif ($inputType == 'meta_title') {
|
578 |
+
$attributeWeight = self::WEIGHT_META_TITLE;
|
579 |
+
} elseif ($inputType == 'meta_description') {
|
580 |
+
$attributeWeight = self::WEIGHT_META_DESCRIPTION;
|
581 |
+
} elseif ($inputType == 'meta_keyword') {
|
582 |
+
$attributeWeight = self::WEIGHT_META_KEYWORDS;
|
583 |
+
// </meta_information>
|
584 |
+
} else {
|
585 |
+
// Nothing.
|
|
|
586 |
}
|
587 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
588 |
|
589 |
+
$strTextValues = self::getTextAttributesValuesXML($unitedProducts, $attributeCode);
|
590 |
+
if ($strTextValues != '') {
|
|
|
|
|
591 |
$entry .= '<cs:attribute name="' . $attributeName .'" type="text" text_search="Y" weight="' . $attributeWeight . '">';
|
592 |
+
// fixme in the future
|
593 |
+
// need for fixed bug of Server
|
594 |
+
$entry .= ' ';
|
595 |
+
// end fixme
|
596 |
+
$entry .= $strTextValues;
|
597 |
$entry .= '</cs:attribute>' . self::XML_END_LINE;
|
598 |
+
}
|
599 |
|
600 |
// <dates>
|
601 |
// It can be used for sort.
|
630 |
$entry .= $value;
|
631 |
$entry .= '</cs:attribute>' . self::XML_END_LINE;
|
632 |
|
633 |
+
} elseif ($inputType == 'select' || $inputType == 'multiselect') {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
634 |
// <id_values>
|
635 |
+
if ($strIdValues = self::getIdAttributesValuesXML($unitedValues)) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
636 |
$entry .= '<cs:attribute name="' . $attributeName .'" type="text">';
|
637 |
// fixme in the future
|
638 |
// need for fixed bug of Server
|
648 |
$strTextValues = '';
|
649 |
if ($isSearchable) {
|
650 |
$attributeWeight = self::WEIGHT_SELECT_ATTRIBUTES;
|
651 |
+
$strTextValues = self::getTextAttributesValuesXML($unitedProducts, $attributeCode);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
652 |
}
|
653 |
|
654 |
+
if ($strTextValues != '') {
|
655 |
$entry .= '<cs:attribute name="' . $attributeCode .'" type="text" text_search="Y" weight="' . $attributeWeight . '">';
|
656 |
// fixme in the future
|
657 |
// need for fixed bug of Server
|
662 |
}
|
663 |
// <text_values>
|
664 |
|
665 |
+
} elseif ($inputType == 'text' || $inputType == 'textarea') {
|
666 |
if ($isSearchable) {
|
667 |
+
if ($inputType == 'text') {
|
668 |
+
$attributeWeight = self::WEIGHT_TEXT_ATTRIBUTES;
|
669 |
+
} elseif ($inputType == 'textarea') {
|
670 |
+
$attributeWeight = self::WEIGHT_TEXT_AREA_ATTRIBUTES;
|
671 |
+
} else {
|
672 |
+
// Nothing.
|
673 |
+
}
|
674 |
}
|
675 |
+
$strTextValues = self::getTextAttributesValuesXML($unitedProducts, $attributeCode);
|
676 |
+
if ($strTextValues != '') {
|
677 |
+
$entry .= '<cs:attribute name="' . $attributeName .'" type="text" text_search="Y" weight="' . $attributeWeight . '">';
|
678 |
+
// fixme in the future
|
679 |
+
// need for fixed bug of Server
|
680 |
+
$entry .= ' ';
|
681 |
+
// end fixme
|
682 |
+
$entry .= $strTextValues;
|
683 |
+
$entry .= '</cs:attribute>' . self::XML_END_LINE;
|
684 |
}
|
685 |
|
|
|
|
|
|
|
|
|
686 |
} else {
|
687 |
// attribute is not filtrable
|
688 |
}
|
850 |
return $entry;
|
851 |
}
|
852 |
|
853 |
+
private static function validateProductIds($productIds, $store = null)
|
854 |
+
{
|
855 |
+
$validProductIds = array();
|
856 |
+
if ($store) {
|
857 |
+
Mage::app()->setCurrentStore($store->getId());
|
858 |
+
} else {
|
859 |
+
Mage::app()->setCurrentStore(0);
|
860 |
+
}
|
861 |
+
|
862 |
+
$products = Mage::getModel('catalog/product')
|
863 |
+
->getCollection()
|
864 |
+
->addAttributeToSelect('entity_id');
|
865 |
+
|
866 |
+
if ($store) {
|
867 |
+
$products->addStoreFilter($store);
|
868 |
+
}
|
869 |
+
|
870 |
+
// Already exist automatic definition 'one value' or 'array'.
|
871 |
+
$products->addIdFilter($productIds);
|
872 |
+
|
873 |
+
$products->load();
|
874 |
+
if ($products) {
|
875 |
+
// Not used because 'arrProducts' comprising 'stock_item' field and is 'array(array())'
|
876 |
+
// $arrProducts = $products->toArray(array('entity_id'));
|
877 |
+
foreach ($products as $product) {
|
878 |
+
$validProductIds[] = $product->getId();
|
879 |
+
}
|
880 |
+
}
|
881 |
+
// It is necessary for save memory.
|
882 |
+
unset($products);
|
883 |
+
|
884 |
+
return $validProductIds;
|
885 |
+
}
|
886 |
+
|
887 |
// public static function getProductsByItems($productIds, $store = null, $flagAddMinimalPrice = false, $customerGroupId = null)
|
888 |
public static function getProducts($productIds, $store = null, $flagAddMinimalPrice = false, $customerGroupId = null)
|
889 |
{
|
895 |
}
|
896 |
|
897 |
$products = array();
|
898 |
+
$productIds = self::validateProductIds($productIds, $store);
|
899 |
|
900 |
+
if ($productIds) {
|
901 |
+
foreach ($productIds as $key => $productId) {
|
902 |
+
if (empty($productId)) {
|
903 |
+
continue;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
904 |
}
|
905 |
+
|
906 |
+
// It can use various types of data.
|
907 |
+
if (is_array($productId)) {
|
908 |
+
if (isset($productId['entity_id'])) {
|
909 |
+
$productId = $productId['entity_id'];
|
910 |
+
}
|
911 |
}
|
912 |
+
|
913 |
+
try {
|
914 |
+
$product = Mage::getModel('catalog/product')->load($productId);
|
915 |
+
|
916 |
+
} catch (Exception $e) {
|
917 |
+
Mage::helper('searchanise/ApiSe')->log($e->getMessage(), "Error: Script couldn't get product");
|
918 |
+
continue;
|
919 |
}
|
920 |
|
921 |
+
if ($product) {
|
922 |
+
if ($store) {
|
923 |
+
$product->setWebsiteId($store->getWebsiteId());
|
924 |
+
}
|
925 |
+
if ($customerGroupId != null) {
|
926 |
+
$product->setCustomerGroupId($customerGroupId);
|
927 |
+
}
|
928 |
+
|
929 |
+
$products[] = $product;
|
930 |
+
}
|
931 |
}
|
932 |
}
|
933 |
|
app/code/community/Simtech/Searchanise/Helper/Data.php
CHANGED
@@ -117,15 +117,15 @@ class Simtech_Searchanise_Helper_Data extends Mage_Core_Helper_Abstract
|
|
117 |
|
118 |
} elseif ($type == self::TEXT_ADVANCED_FIND) {
|
119 |
$params['sortBy'] = 'title';
|
120 |
-
$params['sortOrder'] = '
|
121 |
|
122 |
} elseif ($type == self::VIEW_CATEGORY) {
|
123 |
-
$params['sortBy'] = '
|
124 |
-
$params['sortOrder'] = '
|
125 |
|
126 |
} elseif ($type == self::VIEW_TAG) {
|
127 |
$params['sortBy'] = 'title';
|
128 |
-
$params['sortOrder'] = '
|
129 |
}
|
130 |
|
131 |
if (empty($params['restrictBy'])) {
|
@@ -255,51 +255,56 @@ class Simtech_Searchanise_Helper_Data extends Mage_Core_Helper_Abstract
|
|
255 |
$params['restrictBy']['visibility'] = '3|2|4';
|
256 |
}
|
257 |
}
|
258 |
-
|
259 |
if ((!empty($controller)) && (!empty($blockToolbar))) {
|
260 |
if ($availableOrders = $blockToolbar->getAvailableOrders()) {
|
261 |
if (in_array($type, self::$_searchaniseTypes)) {
|
262 |
-
|
|
|
|
|
|
|
|
|
263 |
unset($availableOrders['position']);
|
264 |
-
|
|
|
|
|
|
|
265 |
if (!isset($availableOrders['relevance'])) {
|
|
|
266 |
$availableOrders = array_merge(
|
267 |
array('relevance' => $controller->__('Relevance')),
|
268 |
$availableOrders
|
269 |
);
|
270 |
}
|
271 |
-
|
272 |
-
$blockToolbar->setAvailableOrders($availableOrders);
|
273 |
-
$blockToolbar->setDefaultOrder('relevance');
|
274 |
} elseif ($type == self::TEXT_ADVANCED_FIND) {
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
} elseif ($type == self::VIEW_TAG) {
|
279 |
-
|
280 |
-
|
|
|
281 |
$blockToolbar->setAvailableOrders($availableOrders);
|
|
|
|
|
|
|
282 |
}
|
283 |
}
|
284 |
}
|
285 |
|
286 |
-
if (isset($params['sortOrder'])) {
|
287 |
-
// need for fix error (when runing first search)
|
288 |
-
$blockToolbar->setDefaultDirection($params['sortOrder']);
|
289 |
-
}
|
290 |
$sortBy = $blockToolbar->getCurrentOrder();
|
291 |
$sortOrder = $blockToolbar->getCurrentDirection();
|
292 |
|
293 |
-
$
|
294 |
-
$
|
295 |
-
$
|
296 |
-
$
|
297 |
|
298 |
-
if ($
|
299 |
-
$params['maxResults'] = $
|
300 |
}
|
301 |
-
if ($
|
302 |
-
$params['startIndex'] = $
|
303 |
}
|
304 |
|
305 |
if ($sortBy) {
|
117 |
|
118 |
} elseif ($type == self::TEXT_ADVANCED_FIND) {
|
119 |
$params['sortBy'] = 'title';
|
120 |
+
$params['sortOrder'] = 'asc';
|
121 |
|
122 |
} elseif ($type == self::VIEW_CATEGORY) {
|
123 |
+
$params['sortBy'] = 'title';
|
124 |
+
$params['sortOrder'] = 'asc';
|
125 |
|
126 |
} elseif ($type == self::VIEW_TAG) {
|
127 |
$params['sortBy'] = 'title';
|
128 |
+
$params['sortOrder'] = 'asc';
|
129 |
}
|
130 |
|
131 |
if (empty($params['restrictBy'])) {
|
255 |
$params['restrictBy']['visibility'] = '3|2|4';
|
256 |
}
|
257 |
}
|
258 |
+
|
259 |
if ((!empty($controller)) && (!empty($blockToolbar))) {
|
260 |
if ($availableOrders = $blockToolbar->getAvailableOrders()) {
|
261 |
if (in_array($type, self::$_searchaniseTypes)) {
|
262 |
+
$fl_change_orders = false;
|
263 |
+
// Fixme in the feature:
|
264 |
+
// products could have different position in different categories, sort by "position" disabled.
|
265 |
+
if (isset($availableOrders['position'])) {
|
266 |
+
$fl_change_orders = true;
|
267 |
unset($availableOrders['position']);
|
268 |
+
}
|
269 |
+
// end
|
270 |
+
|
271 |
+
if ($type == self::TEXT_FIND) {
|
272 |
if (!isset($availableOrders['relevance'])) {
|
273 |
+
$fl_change_orders = true;
|
274 |
$availableOrders = array_merge(
|
275 |
array('relevance' => $controller->__('Relevance')),
|
276 |
$availableOrders
|
277 |
);
|
278 |
}
|
|
|
|
|
|
|
279 |
} elseif ($type == self::TEXT_ADVANCED_FIND) {
|
280 |
+
// Nothing.
|
281 |
+
} elseif ($type == self::VIEW_CATEGORY) {
|
282 |
+
// Nothing.
|
283 |
} elseif ($type == self::VIEW_TAG) {
|
284 |
+
// Nothing.
|
285 |
+
}
|
286 |
+
if ($fl_change_orders) {
|
287 |
$blockToolbar->setAvailableOrders($availableOrders);
|
288 |
+
// If it changed orders then necessary set new default order and default direction.
|
289 |
+
$blockToolbar->setDefaultOrder($params['sortBy']);
|
290 |
+
$blockToolbar->setDefaultDirection($params['sortOrder']);
|
291 |
}
|
292 |
}
|
293 |
}
|
294 |
|
|
|
|
|
|
|
|
|
295 |
$sortBy = $blockToolbar->getCurrentOrder();
|
296 |
$sortOrder = $blockToolbar->getCurrentDirection();
|
297 |
|
298 |
+
$maxResults = (int) $blockToolbar->getLimit();
|
299 |
+
$startIndex = 0;
|
300 |
+
$curPage = (int) $blockToolbar->getCurrentPage();
|
301 |
+
$startIndex = $curPage > 1 ? ($curPage - 1) * $maxResults : 0;
|
302 |
|
303 |
+
if ($maxResults) {
|
304 |
+
$params['maxResults'] = $maxResults;
|
305 |
}
|
306 |
+
if ($startIndex) {
|
307 |
+
$params['startIndex'] = $startIndex;
|
308 |
}
|
309 |
|
310 |
if ($sortBy) {
|
app/code/community/Simtech/Searchanise/controllers/AdvancedController.php
CHANGED
@@ -16,8 +16,7 @@ require_once("Mage/CatalogSearch/controllers/AdvancedController.php");
|
|
16 |
class Simtech_Searchanise_AdvancedController extends Mage_CatalogSearch_AdvancedController
|
17 |
{
|
18 |
protected $_defaultToolbarBlock = 'catalog/product_list_toolbar';
|
19 |
-
|
20 |
-
|
21 |
/**
|
22 |
* Display search result
|
23 |
*/
|
16 |
class Simtech_Searchanise_AdvancedController extends Mage_CatalogSearch_AdvancedController
|
17 |
{
|
18 |
protected $_defaultToolbarBlock = 'catalog/product_list_toolbar';
|
19 |
+
|
|
|
20 |
/**
|
21 |
* Display search result
|
22 |
*/
|
app/code/community/Simtech/Searchanise/controllers/AsyncController.php
CHANGED
@@ -94,9 +94,10 @@ class Simtech_Searchanise_AsyncController extends Mage_Core_Controller_Front_Act
|
|
94 |
@ignore_user_abort(true);
|
95 |
@set_time_limit(0);
|
96 |
if ($checkKey && $this->getRequest()->getParam('display_errors') === 'Y') {
|
97 |
-
@error_reporting
|
98 |
@ini_set('display_errors', 1);
|
99 |
} else {
|
|
|
100 |
@ini_set('display_errors', 0);
|
101 |
}
|
102 |
$flIgnoreProcessing = false;
|
94 |
@ignore_user_abort(true);
|
95 |
@set_time_limit(0);
|
96 |
if ($checkKey && $this->getRequest()->getParam('display_errors') === 'Y') {
|
97 |
+
@error_reporting(E_ALL);
|
98 |
@ini_set('display_errors', 1);
|
99 |
} else {
|
100 |
+
@error_reporting(0);
|
101 |
@ini_set('display_errors', 0);
|
102 |
}
|
103 |
$flIgnoreProcessing = false;
|
app/code/community/Simtech/Searchanise/controllers/CategoryController.php
CHANGED
@@ -16,8 +16,7 @@ require_once("Mage/Catalog/controllers/CategoryController.php");
|
|
16 |
class Simtech_Searchanise_CategoryController extends Mage_Catalog_CategoryController
|
17 |
{
|
18 |
protected $_defaultToolbarBlock = 'catalog/product_list_toolbar';
|
19 |
-
|
20 |
-
|
21 |
protected function _getCurCategory()
|
22 |
{
|
23 |
$categoryId = (int) $this->getRequest()->getParam('id', false);
|
16 |
class Simtech_Searchanise_CategoryController extends Mage_Catalog_CategoryController
|
17 |
{
|
18 |
protected $_defaultToolbarBlock = 'catalog/product_list_toolbar';
|
19 |
+
|
|
|
20 |
protected function _getCurCategory()
|
21 |
{
|
22 |
$categoryId = (int) $this->getRequest()->getParam('id', false);
|
app/code/community/Simtech/Searchanise/controllers/InfoController.php
CHANGED
@@ -75,9 +75,10 @@ class Simtech_Searchanise_InfoController extends Mage_Core_Controller_Front_Acti
|
|
75 |
$productIds = $this->getRequest()->getParam(self::PRODUCT_IDS);
|
76 |
|
77 |
if ($displayErrors) {
|
78 |
-
@error_reporting
|
79 |
@ini_set('display_errors', 1);
|
80 |
} else {
|
|
|
81 |
@ini_set('display_errors', 0);
|
82 |
}
|
83 |
|
@@ -125,7 +126,7 @@ class Simtech_Searchanise_InfoController extends Mage_Core_Controller_Front_Acti
|
|
125 |
|
126 |
echo $this->_profiler();
|
127 |
} elseif ($resync) {
|
128 |
-
Mage::helper('searchanise/ApiSe')->queueImport();
|
129 |
|
130 |
} elseif (!empty($productIds)) {
|
131 |
$productFeeds = Mage::helper('searchanise/ApiXML')->generateProductsXML($productIds, $store, false, $checkData);
|
75 |
$productIds = $this->getRequest()->getParam(self::PRODUCT_IDS);
|
76 |
|
77 |
if ($displayErrors) {
|
78 |
+
@error_reporting(E_ALL);
|
79 |
@ini_set('display_errors', 1);
|
80 |
} else {
|
81 |
+
@error_reporting(0);
|
82 |
@ini_set('display_errors', 0);
|
83 |
}
|
84 |
|
126 |
|
127 |
echo $this->_profiler();
|
128 |
} elseif ($resync) {
|
129 |
+
Mage::helper('searchanise/ApiSe')->queueImport($store);
|
130 |
|
131 |
} elseif (!empty($productIds)) {
|
132 |
$productFeeds = Mage::helper('searchanise/ApiXML')->generateProductsXML($productIds, $store, false, $checkData);
|
app/code/community/Simtech/Searchanise/controllers/ProductController.php
CHANGED
@@ -16,8 +16,7 @@ require_once("Mage/Tag/controllers/ProductController.php");
|
|
16 |
class Simtech_Searchanise_ProductController extends Mage_Tag_ProductController
|
17 |
{
|
18 |
protected $_defaultToolbarBlock = 'catalog/product_list_toolbar';
|
19 |
-
|
20 |
-
|
21 |
public function listAction()
|
22 |
{
|
23 |
if (!Mage::helper('searchanise/ApiSe')->checkSearchaniseResult(true)) {
|
16 |
class Simtech_Searchanise_ProductController extends Mage_Tag_ProductController
|
17 |
{
|
18 |
protected $_defaultToolbarBlock = 'catalog/product_list_toolbar';
|
19 |
+
|
|
|
20 |
public function listAction()
|
21 |
{
|
22 |
if (!Mage::helper('searchanise/ApiSe')->checkSearchaniseResult(true)) {
|
app/code/community/Simtech/Searchanise/controllers/ResultController.php
CHANGED
@@ -21,8 +21,7 @@ class Simtech_Searchanise_ResultController extends Mage_CatalogSearch_ResultCont
|
|
21 |
* @var string
|
22 |
*/
|
23 |
protected $_defaultToolbarBlock = 'catalog/product_list_toolbar';
|
24 |
-
|
25 |
-
|
26 |
/**
|
27 |
* Retrieve Toolbar block
|
28 |
*
|
@@ -51,10 +50,10 @@ class Simtech_Searchanise_ResultController extends Mage_CatalogSearch_ResultCont
|
|
51 |
|
52 |
$query = Mage::helper('catalogsearch')->getQuery();
|
53 |
/* @var $query Mage_CatalogSearch_Model_Query */
|
54 |
-
|
55 |
$query->setStoreId(Mage::app()->getStore()->getId());
|
56 |
-
|
57 |
-
if ($query->getQueryText()) {
|
58 |
if (Mage::helper('searchanise')->checkEnabled()) {
|
59 |
$blockToolbar = $this->_getToolbarBlock();
|
60 |
|
21 |
* @var string
|
22 |
*/
|
23 |
protected $_defaultToolbarBlock = 'catalog/product_list_toolbar';
|
24 |
+
|
|
|
25 |
/**
|
26 |
* Retrieve Toolbar block
|
27 |
*
|
50 |
|
51 |
$query = Mage::helper('catalogsearch')->getQuery();
|
52 |
/* @var $query Mage_CatalogSearch_Model_Query */
|
53 |
+
|
54 |
$query->setStoreId(Mage::app()->getStore()->getId());
|
55 |
+
|
56 |
+
if ($query->getQueryText() != '') {
|
57 |
if (Mage::helper('searchanise')->checkEnabled()) {
|
58 |
$blockToolbar = $this->_getToolbarBlock();
|
59 |
|
app/code/community/Simtech/Searchanise/etc/config.xml
CHANGED
@@ -15,7 +15,7 @@
|
|
15 |
<config>
|
16 |
<modules>
|
17 |
<Simtech_Searchanise>
|
18 |
-
<version>
|
19 |
</Simtech_Searchanise>
|
20 |
</modules>
|
21 |
<frontend>
|
@@ -534,28 +534,30 @@
|
|
534 |
<!-- END TAG -->
|
535 |
</events>
|
536 |
<blocks>
|
537 |
-
<!--
|
538 |
-
|
539 |
-
<
|
540 |
-
<
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
<
|
547 |
-
<
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
<
|
555 |
-
<
|
556 |
-
|
557 |
-
|
558 |
-
|
|
|
|
|
559 |
</blocks>
|
560 |
</global>
|
561 |
<default>
|
15 |
<config>
|
16 |
<modules>
|
17 |
<Simtech_Searchanise>
|
18 |
+
<version>2.0.0</version>
|
19 |
</Simtech_Searchanise>
|
20 |
</modules>
|
21 |
<frontend>
|
534 |
<!-- END TAG -->
|
535 |
</events>
|
536 |
<blocks>
|
537 |
+
<!-- [disabled_searchanise_search] -->
|
538 |
+
<!-- OVERRIDE BLOCK CATALOG -->
|
539 |
+
<catalog>
|
540 |
+
<rewrite>
|
541 |
+
<product_list_toolbar>Simtech_Searchanise_Block_Product_List_Toolbar</product_list_toolbar>
|
542 |
+
</rewrite>
|
543 |
+
</catalog>
|
544 |
+
<!-- END -->
|
545 |
+
<!-- OVERRIDE BLOCK CATALOGSEARCH -->
|
546 |
+
<catalogsearch>
|
547 |
+
<rewrite>
|
548 |
+
<result>Simtech_Searchanise_Block_Result</result>
|
549 |
+
<autocomplete>Simtech_Searchanise_Block_Autocomplete</autocomplete>
|
550 |
+
</rewrite>
|
551 |
+
</catalogsearch>
|
552 |
+
<!-- END -->
|
553 |
+
<!-- OVERRIDE BLOCK TAG -->
|
554 |
+
<tag>
|
555 |
+
<rewrite>
|
556 |
+
<product_result>Simtech_Searchanise_Block_Product_Result</product_result>
|
557 |
+
</rewrite>
|
558 |
+
</tag>
|
559 |
+
<!-- END -->
|
560 |
+
<!-- [/disabled_searchanise_search] -->
|
561 |
</blocks>
|
562 |
</global>
|
563 |
<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>
|
19 |
</Simtech_Searchanise>
|
20 |
</modules>
|
21 |
<frontend>
|
@@ -534,28 +534,30 @@
|
|
534 |
<!-- END TAG -->
|
535 |
</events>
|
536 |
<blocks>
|
537 |
-
<!--
|
538 |
-
|
539 |
-
<
|
540 |
-
<
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
<
|
547 |
-
<
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
<
|
555 |
-
<
|
556 |
-
|
557 |
-
|
558 |
-
|
|
|
|
|
559 |
</blocks>
|
560 |
</global>
|
561 |
<default>
|
15 |
<config>
|
16 |
<modules>
|
17 |
<Simtech_Searchanise>
|
18 |
+
<version>2.0.0</version>
|
19 |
</Simtech_Searchanise>
|
20 |
</modules>
|
21 |
<frontend>
|
534 |
<!-- END TAG -->
|
535 |
</events>
|
536 |
<blocks>
|
537 |
+
<!-- [disabled_searchanise_search] -->
|
538 |
+
<!-- OVERRIDE BLOCK CATALOG -->
|
539 |
+
<!-- <catalog>
|
540 |
+
<rewrite>
|
541 |
+
<product_list_toolbar>Simtech_Searchanise_Block_Product_List_Toolbar</product_list_toolbar>
|
542 |
+
</rewrite>
|
543 |
+
</catalog> -->
|
544 |
+
<!-- END -->
|
545 |
+
<!-- OVERRIDE BLOCK CATALOGSEARCH -->
|
546 |
+
<!-- <catalogsearch>
|
547 |
+
<rewrite>
|
548 |
+
<result>Simtech_Searchanise_Block_Result</result>
|
549 |
+
<autocomplete>Simtech_Searchanise_Block_Autocomplete</autocomplete>
|
550 |
+
</rewrite>
|
551 |
+
</catalogsearch> -->
|
552 |
+
<!-- END -->
|
553 |
+
<!-- OVERRIDE BLOCK TAG -->
|
554 |
+
<!-- <tag>
|
555 |
+
<rewrite>
|
556 |
+
<product_result>Simtech_Searchanise_Block_Product_Result</product_result>
|
557 |
+
</rewrite>
|
558 |
+
</tag> -->
|
559 |
+
<!-- END -->
|
560 |
+
<!-- [/disabled_searchanise_search] -->
|
561 |
</blocks>
|
562 |
</global>
|
563 |
<default>
|
app/design/adminhtml/default/default/template/searchanise/dashboard.phtml
CHANGED
@@ -59,19 +59,19 @@
|
|
59 |
$priceFormat['after'] = $priceFormat['after'] ? 'true' : 'false';
|
60 |
|
61 |
echo 'SearchaniseAdmin.Engines.push({';
|
|
|
62 |
echo "PrivateKey: '{$privateKey}',";
|
63 |
echo "LangCode: '{$store->getCode()}',";
|
64 |
-
echo "Name : '{$store->getName()}',";
|
65 |
echo "ExportStatus: '{$exportStatus}',";
|
66 |
echo 'PriceFormat: {';
|
|
|
67 |
echo "rate : '{$priceFormat['rate']}',";
|
68 |
echo "decimals: '{$priceFormat['decimals']}',";
|
69 |
echo "decimals_separator: '{$priceFormat['decimals_separator']}',";
|
70 |
echo "thousands_separator: '{$priceFormat['thousands_separator']}',";
|
71 |
-
echo "symbol: '{$priceFormat['symbol']}',";
|
72 |
echo "after: {$priceFormat['after']}";
|
73 |
-
echo
|
74 |
-
echo
|
75 |
}
|
76 |
}
|
77 |
}
|
59 |
$priceFormat['after'] = $priceFormat['after'] ? 'true' : 'false';
|
60 |
|
61 |
echo 'SearchaniseAdmin.Engines.push({';
|
62 |
+
echo 'Name:"' . addslashes($store->getName()) . '",';
|
63 |
echo "PrivateKey: '{$privateKey}',";
|
64 |
echo "LangCode: '{$store->getCode()}',";
|
|
|
65 |
echo "ExportStatus: '{$exportStatus}',";
|
66 |
echo 'PriceFormat: {';
|
67 |
+
echo 'symbol: "' . addslashes($priceFormat['symbol']) . '",';
|
68 |
echo "rate : '{$priceFormat['rate']}',";
|
69 |
echo "decimals: '{$priceFormat['decimals']}',";
|
70 |
echo "decimals_separator: '{$priceFormat['decimals_separator']}',";
|
71 |
echo "thousands_separator: '{$priceFormat['thousands_separator']}',";
|
|
|
72 |
echo "after: {$priceFormat['after']}";
|
73 |
+
echo '}';
|
74 |
+
echo '});';
|
75 |
}
|
76 |
}
|
77 |
}
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Simtech_Searchanise</name>
|
4 |
-
<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,22 +10,18 @@
|
|
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 |
-
|
20 |
-
|
21 |
-
[*] Internal attribute-based filtering disabled (could be buggy).<br />
|
22 |
-
[!] The 'created_at' and 'updated_at' attributes are now submitted in a product feed.<br />
|
23 |
-
[+] If tags were disabled, the initial sync could crash. Fix.<br />
|
24 |
-
[~] Cron debug info is now stored to a log file.</notes>
|
25 |
<authors><author><name>Simbirsk Technologies, Ltd.</name><user>searchanise</user><email>sales@searchanise.com</email></author></authors>
|
26 |
-
<date>2013-
|
27 |
-
<time>
|
28 |
-
<contents><target name="magecommunity"><dir name="Simtech"><dir name="Searchanise"><dir name="Block"><file name="Async.php" hash="bc97c98da15f5abbc1d8922ca477dc6d"/><file name="Autocomplete.php" hash="efc89ac3f897be3bc307fba6a36778f0"/><file name="Jsinit.php" hash="0cf9770f73064f571420283a0e4bdb8d"/><dir name="Product"><dir name="List"><file name="Toolbar.php" hash="
|
29 |
<compatible/>
|
30 |
<dependencies><required><php><min>5.2.13</min><max>6.0.0</max></php></required></dependencies>
|
31 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Simtech_Searchanise</name>
|
4 |
+
<version>2.0.0</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>New features:<br />
|
14 |
+
- Improved configurated product support, child product attribute values are now taken into account for the parent product.<br />
|
15 |
+
- Additional missing/invalid product check.<br />
|
16 |
+
- Magento Enterprise support.<br /><br />
|
17 |
+
Improvements & fixes:<br />
|
18 |
+
- Products from a storefront could appear in another storefront search. Fixed.<br />
|
19 |
+
- Searchanise admin panel could not work if the store title included the ' symbol. Fixed.<br />
|
20 |
+
- Third-party extension compatibility improved (the file config_without_search.xml updated).</notes>
|
|
|
|
|
|
|
|
|
21 |
<authors><author><name>Simbirsk Technologies, Ltd.</name><user>searchanise</user><email>sales@searchanise.com</email></author></authors>
|
22 |
+
<date>2013-12-16</date>
|
23 |
+
<time>13:02:47</time>
|
24 |
+
<contents><target name="magecommunity"><dir name="Simtech"><dir name="Searchanise"><dir name="Block"><file name="Async.php" hash="bc97c98da15f5abbc1d8922ca477dc6d"/><file name="Autocomplete.php" hash="efc89ac3f897be3bc307fba6a36778f0"/><file name="Jsinit.php" hash="0cf9770f73064f571420283a0e4bdb8d"/><dir name="Product"><dir name="List"><file name="Toolbar.php" hash="759854378cb8c35c37a8a7f44076194f"/></dir><file name="Result.php" hash="4e767e273ee21a38332ac226af878291"/></dir><file name="Result.php" hash="dec7b27ab9511c956680eb60eba9b95e"/></dir><dir name="Helper"><file name="ApiSe.php" hash="8aa645ebb27a884852c0dafc331d9cb7"/><file name="ApiXML.php" hash="3e4c73f3a3638fede64703fefaf860bd"/><file name="Data.php" hash="279067d8d4650b950ff5f8653577b925"/></dir><dir name="Model"><file name="Advanced.php" hash="2a22ebcf7ac75b54681ef8a27bad2e47"/><dir name="Config"><file name="Data.php" hash="ddc558d22208f0ebc1e4378c9d050022"/></dir><file name="Config.php" hash="00ca3c7955f3ff2283c636a2074b6f03"/><dir name="Import"><dir name="Entity"><file name="Product.php" hash="4997af528b36f0f576d1c01402e14b03"/></dir></dir><dir name="Layer"><dir name="Filter"><file name="Category.php" hash="e290ab29f2d50e1acbbbb37496150ea4"/><file name="Price.php" hash="743887b32bf012274ad8a371fff96411"/></dir></dir><file name="Layer.php" hash="3e8c975d649ae6e20fcc69d35779c97c"/><file name="LayerCatalogSearch.php" hash="42058e0552719902f3f40f91e816b460"/><dir name="Mysql4"><dir name="Advanced"><file name="Collection.php" hash="dd8c6f3cbb0621a5a7320f3104e68da6"/></dir><dir name="Config"><file name="Collection.php" hash="470218c1eb3f1cc1ca0e6d0e93e1b097"/></dir><file name="Config.php" hash="c95dc8ecd7ab4f955b6eaf4710ab960e"/><dir name="Fulltext"><file name="Collection.php" hash="5646955503a90020f87cfd861ac07e73"/></dir><dir name="Product"><file name="Collection.php" hash="28b478eb328502ce03e389404d9f54b5"/><file name="CollectionTag.php" hash="ea06ec75ee4d083f2b4232c5fe298f00"/></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="5db27768e7d77ed7ddc63ae9f4c4308c"/><file name="Queue.php" hash="831f5ea7e57810f9c78d09659424e9a7"/><file name="Request.php" hash="af0f9a16a0dbc69ba76458eac802638b"/><dir name="Resource"><dir name="Advanced"><file name="Collection.php" hash="6744555254ba1c57f482504b5f16012a"/></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="273467b2e39649fcd0a8eede59c5ab98"/></dir><dir name="Layer"><dir name="Filter"><file name="Attribute.php" hash="643a513735ac2a2ac9fba08ff1fa79a0"/><file name="Price.php" hash="15d7ab510b37655a148e077dcece13df"/></dir></dir><dir name="Product"><file name="Collection.php" hash="b7c9a1c2fc24ecf78a32fd0d9d46b120"/><file name="CollectionTag.php" hash="60f12d27d78426a8e04e01d2cbdadb48"/></dir><file name="Store.php" hash="dee8bb23b7fe48dc55e46e93f583699a"/></dir><file name="Searchanise.php" hash="0a03a35854470a310f075298c9a1abf2"/><dir name="System"><dir name="Config"><dir name="Source"><dir name="Searchanise"><file name="TypeAsync.php" hash="11d1aa481094ccbeab365b1fed33440d"/></dir></dir></dir></dir><dir name="Tag"><file name="Relation.php" hash="598f81fd8b2ac77baf24211c2ed03e55"/></dir></dir><dir name="controllers"><file name="AdvancedController.php" hash="5ea4f7fb3362d720462dc0a8e1f1497b"/><file name="AsyncController.php" hash="e1a7dd9debd00fb7df09804d99e56e9e"/><file name="CategoryController.php" hash="06eac1ad4730d42379f6bc6aae097427"/><file name="IndexController.php" hash="e3234ca51a7669741e29ff7c38789989"/><file name="InfoController.php" hash="cc27d668d8665468ae01e3017c806965"/><file name="OptionsController.php" hash="56785c8ea24472c2047268b2d9e8e878"/><file name="ProductController.php" hash="4cf4e991446a36ea34b7c1d350971e1a"/><file name="ResultController.php" hash="2c1d838a2897ffcbb8bc61743254e934"/><file name="ResyncController.php" hash="0612f929d375427326821dfc12186be8"/><file name="SignupController.php" hash="80f87a63d6272f98a068dde35f1d140e"/></dir><dir name="etc"><file name="config.xml" hash="7580ef477fd24172b069c5e9f21c09ce"/><file name="config_without_search.xml" hash="e47570f16d83339b3460a220f1e33997"/><file name="system.xml" hash="a006341e693571d11efaa9d289ebf7fa"/></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="3401a5404ae62ba09d67bda091549fdd"/></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="5e904fee02cbd42324a297d513b9f582"/></dir></dir></dir><dir name="default"><dir name="default"><dir name="template"><dir name="catalogsearch"><file name="form.mini.phtml" hash="fcf8e06e66801a36c96f20ca5d187123"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Simtech_Searchanise.xml" hash="04148681a6648bd370ab62140cbf2ad9"/></dir></target><target name="magelocale"><dir name="en_US"><file name="Simtech_Searchanise.csv" hash="1bdb7fddc596dac1460bc3054c425187"/></dir></target></contents>
|
25 |
<compatible/>
|
26 |
<dependencies><required><php><min>5.2.13</min><max>6.0.0</max></php></required></dependencies>
|
27 |
</package>
|