Klevu_SmartSearch - Version 1.2.0

Version Notes

- Price tag added
- Catalog rule price change
- Cms configuration included
- Change in store configuration wizard
- Bug fix for store code url
- Added category pages by default
- Search term page setting

Download this release

Release Info

Developer Klevu
Extension Klevu_SmartSearch
Version 1.2.0
Comparing to
See all releases


Code changes from version 1.1.26 to 1.2.0

Files changed (125) hide show
  1. app/code/community/Klevu/Addtocart/Helper/Data.php +17 -0
  2. app/code/community/Klevu/Addtocart/etc/config.xml +45 -0
  3. app/code/community/Klevu/Addtocart/etc/system.xml +41 -0
  4. app/code/community/Klevu/Boosting/Block/Adminhtml/Boost.php +13 -0
  5. app/code/community/Klevu/Boosting/Block/Adminhtml/Boost/Edit.php +30 -0
  6. app/code/community/Klevu/Boosting/Block/Adminhtml/Boost/Edit/Form.php +18 -0
  7. app/code/community/Klevu/Boosting/Block/Adminhtml/Boost/Edit/Tab/Actions.php +30 -0
  8. app/code/community/Klevu/Boosting/Block/Adminhtml/Boost/Edit/Tab/Conditions.php +40 -0
  9. app/code/community/Klevu/Boosting/Block/Adminhtml/Boost/Edit/Tab/Form.php +42 -0
  10. app/code/community/Klevu/Boosting/Block/Adminhtml/Boost/Edit/Tabs.php +30 -0
  11. app/code/community/Klevu/Boosting/Block/Adminhtml/Boost/Grid.php +62 -0
  12. app/code/community/Klevu/Boosting/Block/Adminhtml/Form/Field/Rule/Button.php +48 -0
  13. app/code/community/Klevu/Boosting/Helper/Data.php +67 -0
  14. app/code/community/Klevu/Boosting/Model/Boost.php +49 -0
  15. app/code/community/Klevu/Boosting/Model/Boost/Rule/Condition/Combine.php +37 -0
  16. app/code/community/Klevu/Boosting/Model/Boost/Rule/Condition/Product.php +109 -0
  17. app/code/community/Klevu/Boosting/Model/Mysql4/Boost.php +20 -0
  18. app/code/community/Klevu/Boosting/Model/Mysql4/Boost/Collection.php +12 -0
  19. app/code/community/Klevu/Boosting/Model/Observer.php +47 -0
  20. app/code/community/Klevu/Boosting/Model/System/Config/Source/Boosting/Attribute.php +41 -0
  21. app/code/community/Klevu/Boosting/Test/Model/Boost.php +19 -0
  22. app/code/community/Klevu/Boosting/Test/Model/Boost/fixtures/testGetMatchingProductIds.yaml +44 -0
  23. app/code/community/Klevu/Boosting/controllers/Adminhtml/BoostController.php +172 -0
  24. app/code/community/Klevu/Boosting/etc/config.xml +136 -0
  25. app/code/community/Klevu/Boosting/etc/system.xml +40 -0
  26. app/code/community/Klevu/Boosting/sql/klevu_boosting_setup/mysql4-install-10.0.0.php +19 -0
  27. app/code/community/Klevu/Content/Block/Adminhtml/Form/Cmspages.php +53 -0
  28. app/code/community/Klevu/Content/Block/Adminhtml/Form/System/Config/Field/Select.php +10 -0
  29. app/code/community/Klevu/Content/Block/Adminhtml/Wizard/Configure/Store.php +75 -0
  30. app/code/community/Klevu/Content/Block/Index.php +23 -0
  31. app/code/community/Klevu/Content/Block/Tracking.php +27 -0
  32. app/code/community/Klevu/Content/Helper/Data.php +262 -0
  33. app/code/community/Klevu/Content/Model/Content.php +433 -0
  34. app/code/community/Klevu/Content/Model/Observer.php +55 -0
  35. app/code/community/Klevu/Content/Test/Controller/ContentSearch.php +101 -0
  36. app/code/community/Klevu/Content/Test/Controller/ContentSearch/fixtures/content_search_results.yaml +18 -0
  37. app/code/community/Klevu/Content/Test/Helper/Data.php +52 -0
  38. app/code/community/Klevu/Content/Test/Helper/Data/fixtures/content_search_results.yaml +18 -0
  39. app/code/community/Klevu/Content/Test/Helper/Data/fixtures/testIsCmsEnabledDisabled.yaml +2 -0
  40. app/code/community/Klevu/Content/Test/Helper/Data/fixtures/testIsCmsEnabledEnabled.yaml +2 -0
  41. app/code/community/Klevu/Content/Test/Helper/Data/providers/testGetExcludedCmsPages.yaml +5 -0
  42. app/code/community/Klevu/Content/Test/Helper/Data/providers/testIsCmsSyncEnabled.yaml +8 -0
  43. app/code/community/Klevu/Content/Test/Model/Api/data/message_response_content_success.xml +4 -0
  44. app/code/community/Klevu/Content/Test/Model/Api/data/search_response_empty.xml +10 -0
  45. app/code/community/Klevu/Content/Test/Model/Api/data/search_response_success.xml +23 -0
  46. app/code/community/Klevu/Content/Test/Model/Api/data/startsession_response_content_success.xml +5 -0
  47. app/code/community/Klevu/Content/Test/Model/Content.php +175 -0
  48. app/code/community/Klevu/Content/Test/Model/Content/fixtures/testAddCms.yaml +24 -0
  49. app/code/community/Klevu/Content/Test/Model/Content/fixtures/testClearAllProducts.yaml +19 -0
  50. app/code/community/Klevu/Content/Test/Model/Content/fixtures/testCmsRun.yaml +48 -0
  51. app/code/community/Klevu/Content/Test/Model/Content/fixtures/testDeleteCms.yaml +14 -0
  52. app/code/community/Klevu/Content/Test/Model/Content/fixtures/testUpdateCms.yaml +25 -0
  53. app/code/community/Klevu/Content/controllers/SearchController.php +20 -0
  54. app/code/community/Klevu/Content/etc/config.xml +139 -0
  55. app/code/community/Klevu/Content/etc/system.xml +81 -0
  56. app/code/community/Klevu/Content/sql/klevu_content_setup/mysql4-install-0.1.0.php +0 -0
  57. app/code/community/Klevu/Search/Block/Adminhtml/Form/Infolinks.php +28 -0
  58. app/code/community/Klevu/Search/Block/Adminhtml/System/Config/Form/Field.php +367 -0
  59. app/code/community/Klevu/Search/Block/Adminhtml/Wizard/Configure/User.php +3 -0
  60. app/code/community/Klevu/Search/Block/Adminhtml/Wizard/Configure/Userplan.php +25 -0
  61. app/code/community/Klevu/Search/Helper/Api.php +31 -2
  62. app/code/community/Klevu/Search/Helper/Config.php +94 -1
  63. app/code/community/Klevu/Search/Helper/Data.php +82 -16
  64. app/code/community/Klevu/Search/Model/Adminhtml/Comment.php +24 -0
  65. app/code/community/Klevu/Search/Model/Api/Action/Checkuserdetail.php +23 -0
  66. app/code/community/Klevu/Search/Model/Api/Action/Features.php +48 -0
  67. app/code/community/Klevu/Search/Model/Api/Response.php +1 -0
  68. app/code/community/Klevu/Search/Model/CatalogSearch/Resource/Fulltext/Collection.php +1 -1
  69. app/code/community/Klevu/Search/Model/Observer.php +11 -2
  70. app/code/community/Klevu/Search/Model/Product/Sync.php +500 -41
  71. app/code/community/Klevu/Search/Model/System/Config/Source/Landingoptions.php +26 -6
  72. app/code/community/Klevu/Search/Test/Model/Api/Action/Getuserfeaturesdetail.php +74 -0
  73. app/code/community/Klevu/Search/Test/Model/Api/Action/Getuserfeaturesdetail/providers/testValidateRequiredFields.yaml +3 -0
  74. app/code/community/Klevu/Search/Test/Model/Api/data/feature_response.xml +13 -0
  75. app/code/community/Klevu/Search/controllers/Adminhtml/Klevu/Search/WizardController.php +87 -32
  76. app/code/community/Klevu/Search/controllers/Adminhtml/Klevu/SearchController.php +9 -0
  77. app/code/community/Klevu/Search/etc/config.xml +44 -1
  78. app/code/community/Klevu/Search/etc/system.xml +64 -28
  79. app/code/community/Klevu/Search/sql/klevu_search_setup/mysql4-data-upgrade-1.1.27-1.1.28.php +8 -0
  80. app/code/community/Klevu/Searchterms/Block/Catalog/Product/Popularterms.php +13 -0
  81. app/code/community/Klevu/Searchterms/Block/Popularterms.php +13 -0
  82. app/code/community/Klevu/Searchterms/Helper/Data.php +18 -0
  83. app/code/community/Klevu/Searchterms/Model/Api/Action/Boostingscore.php +55 -0
  84. app/code/community/Klevu/Searchterms/Model/Api/Action/Popularterms.php +55 -0
  85. app/code/community/Klevu/Searchterms/Model/Observer.php +18 -0
  86. app/code/community/Klevu/Searchterms/Model/Product/Seo.php +50 -0
  87. app/code/community/Klevu/Searchterms/controllers/IndexController.php +22 -0
  88. app/code/community/Klevu/Searchterms/etc/config.xml +72 -0
  89. app/code/community/Klevu/Searchterms/etc/system.xml +39 -0
  90. app/code/community/Klevu/Searchterms/sql/klevu_searchterms_setup/mysql4-data-upgrade-10.0.0-10.0.1.php +0 -0
  91. app/code/community/Klevu/Searchterms/sql/klevu_searchterms_setup/mysql4-install-10.0.0.php +0 -0
  92. app/design/adminhtml/default/default/layout/klevu/boosting.xml +33 -0
  93. app/design/adminhtml/default/default/layout/klevu/search.xml +9 -1
  94. app/design/adminhtml/default/default/template/klevu/boosting/form/field/rule/button.phtml +17 -0
  95. app/design/adminhtml/default/default/template/klevu/search/form/information.phtml +35 -9
  96. app/design/adminhtml/default/default/template/klevu/search/form/klevuinfo.phtml +1 -1
  97. app/design/adminhtml/default/default/template/klevu/search/form/quickinfo.phtml +1 -0
  98. app/design/adminhtml/default/default/template/klevu/search/system/config/form/field/array.phtml +171 -0
  99. app/design/adminhtml/default/default/template/klevu/search/wizard/complete.phtml +35 -8
  100. app/design/adminhtml/default/default/template/klevu/search/wizard/configure/store.phtml +26 -8
  101. app/design/adminhtml/default/default/template/klevu/search/wizard/configure/user.phtml +34 -35
  102. app/design/adminhtml/default/default/template/klevu/search/wizard/configure/userplan.phtml +133 -0
  103. app/design/frontend/base/default/layout/klevu/addtocart.xml +9 -0
  104. app/design/frontend/base/default/layout/klevu/content.xml +47 -0
  105. app/design/frontend/base/default/layout/klevu/searchterms.xml +16 -0
  106. app/design/frontend/base/default/template/klevu/addtocart/index.phtml +20 -0
  107. app/design/frontend/base/default/template/klevu/content/content_tracking.phtml +35 -0
  108. app/design/frontend/base/default/template/klevu/content/index.phtml +22 -0
  109. app/design/frontend/base/default/template/klevu/content/left.phtml +33 -0
  110. app/design/frontend/base/default/template/klevu/content/search.phtml +133 -0
  111. app/design/frontend/base/default/template/klevu/content/top.phtml +12 -0
  112. app/design/frontend/base/default/template/klevu/content/type_of_query.phtml +16 -0
  113. app/design/frontend/base/default/template/klevu/learning/category.phtml +5 -0
  114. app/design/frontend/base/default/template/klevu/learning/category_tracking.phtml +35 -0
  115. app/design/frontend/base/default/template/klevu/searchterm/popular_searchterms.phtml +43 -0
  116. app/etc/modules/Klevu_Addtocart.xml +10 -0
  117. app/etc/modules/Klevu_Boosting.xml +12 -0
  118. app/etc/modules/Klevu_Content.xml +13 -0
  119. app/etc/modules/Klevu_Searchterms.xml +13 -0
  120. js/klevu/search/lib/Wizard.js +37 -3
  121. package.xml +13 -7
  122. skin/adminhtml/default/default/klevu/search/klevumagestyle.css +413 -0
  123. skin/adminhtml/default/default/klevu/search/notifications.css +0 -1
  124. skin/frontend/base/default/css/klevu/content/klevu-landing-left.css +16 -0
  125. skin/frontend/base/default/css/klevu/search/klevu-search-term.css +16 -0
app/code/community/Klevu/Addtocart/Helper/Data.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Klevu_Addtocart_Helper_Data extends Mage_Core_Helper_Abstract
3
+ {
4
+ const XML_PATH_ADDTOCART_ENABLED = "klevu_search/add_to_cart/enabledaddtocartfront";
5
+
6
+ /**
7
+ * Check if the add to cart is enabled in the system configuration for the current store.
8
+ *
9
+ * @param $store_id
10
+ *
11
+ * @return bool
12
+ */
13
+ public function isAddtocartEnabled($store_id = null) {
14
+ return Mage::getStoreConfigFlag(static::XML_PATH_ADDTOCART_ENABLED, $store_id);
15
+ }
16
+ }
17
+
app/code/community/Klevu/Addtocart/etc/config.xml ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Klevu_Addtocart>
5
+ <version>10.0.4</version>
6
+ </Klevu_Addtocart>
7
+ </modules>
8
+ <frontend>
9
+ <routers>
10
+ <addtocart>
11
+ <use>standard</use>
12
+ <args>
13
+ <module>Klevu_Addtocart</module>
14
+ <frontName>addtocart</frontName>
15
+ </args>
16
+ </addtocart>
17
+ </routers>
18
+ <layout>
19
+ <updates>
20
+ <addtocart>
21
+ <file>klevu/addtocart.xml</file>
22
+ </addtocart>
23
+ </updates>
24
+ </layout>
25
+ </frontend>
26
+ <global>
27
+ <helpers>
28
+ <addtocart>
29
+ <class>Klevu_Addtocart_Helper</class>
30
+ </addtocart>
31
+ </helpers>
32
+ <blocks>
33
+ <addtocart>
34
+ <class>Klevu_Addtocart_Block</class>
35
+ </addtocart>
36
+ </blocks>
37
+ </global>
38
+ <default>
39
+ <klevu_search>
40
+ <add_to_cart>
41
+ <enabled>0</enabled>
42
+ </add_to_cart>
43
+ </klevu_search>
44
+ </default>
45
+ </config>
app/code/community/Klevu/Addtocart/etc/system.xml ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <sections>
4
+ <klevu_search translate="label" module="klevu_search">
5
+ <groups>
6
+ <add_to_cart translate="label">
7
+ <label>Add To Cart Button</label>
8
+ <sort_order>102</sort_order>
9
+ <show_in_default>1</show_in_default>
10
+ <show_in_website>1</show_in_website>
11
+ <show_in_store>1</show_in_store>
12
+ <comment>
13
+ <![CDATA[<div class="kuGuideLink"><a target="_blank" href="http://support.klevu.com/section/manuals/magento-manuals/add-to-cart-button/">Quick Guide</a></div>
14
+ ]]></comment>
15
+ <fields>
16
+ <enabled_info translate="label comment">
17
+ <label></label>
18
+ <comment><![CDATA[Switch to store view scope to set.]]></comment>
19
+ <sort_order>100</sort_order>
20
+ <frontend_type>label</frontend_type>
21
+ <show_in_default>1</show_in_default>
22
+ <show_in_website>1</show_in_website>
23
+ <show_in_store>0</show_in_store>
24
+ </enabled_info>
25
+ <enabledaddtocartfront translate="label">
26
+ <label>Show Add To Cart Button</label>
27
+ <comment><![CDATA[If enabled, the Add To Cart button is displayed for every product in
28
+ the Klevu Search results.]]></comment>
29
+ <frontend_type>select</frontend_type>
30
+ <source_model>adminhtml/system_config_source_yesno</source_model>
31
+ <sort_order>100</sort_order>
32
+ <show_in_default>0</show_in_default>
33
+ <show_in_website>0</show_in_website>
34
+ <show_in_store>1</show_in_store>
35
+ </enabledaddtocartfront>
36
+ </fields>
37
+ </add_to_cart>
38
+ </groups>
39
+ </klevu_search>
40
+ </sections>
41
+ </config>
app/code/community/Klevu/Boosting/Block/Adminhtml/Boost.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Klevu_Boosting_Block_Adminhtml_Boost extends Mage_Adminhtml_Block_Widget_Grid_Container
3
+ {
4
+ public function __construct()
5
+
6
+ {
7
+ $this->_controller = "adminhtml_boost";
8
+ $this->_blockGroup = "boosting";
9
+ $this->_headerText = Mage::helper("boosting")->__("Klevu Product Boosting Manager");
10
+ $this->_addButtonLabel = Mage::helper("boosting")->__("Add New Rule");
11
+ parent::__construct();
12
+ }
13
+ }
app/code/community/Klevu/Boosting/Block/Adminhtml/Boost/Edit.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Klevu_Boosting_Block_Adminhtml_Boost_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
3
+ {
4
+ public function __construct()
5
+ {
6
+ parent::__construct();
7
+ $this->_objectId = "id";
8
+ $this->_blockGroup = "boosting";
9
+ $this->_controller = "adminhtml_boost";
10
+ $this->_updateButton("save", "label", Mage::helper("boosting")->__("Save Rule"));
11
+ $this->_updateButton("delete", "label", Mage::helper("boosting")->__("Delete Rule"));
12
+ $this->_addButton("saveandcontinue", array(
13
+ "label" => Mage::helper("boosting")->__("Save And Continue Edit") ,
14
+ "onclick" => "saveAndContinueEdit()",
15
+ "class" => "save",
16
+ ) , -100);
17
+ $this->_formScripts[] = "function saveAndContinueEdit(){editForm.submit($('edit_form').action+'back/edit/');}";
18
+
19
+ }
20
+ public function getHeaderText()
21
+ {
22
+ if (Mage::registry("boost_data") && Mage::registry("boost_data")->getId()) {
23
+ return Mage::helper("boosting")->__("Edit Rule '%s'", $this->htmlEscape(Mage::registry("boost_data")->getName()));
24
+ }
25
+ else {
26
+ return Mage::helper("boosting")->__("Add Rule");
27
+
28
+ }
29
+ }
30
+ }
app/code/community/Klevu/Boosting/Block/Adminhtml/Boost/Edit/Form.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Klevu_Boosting_Block_Adminhtml_Boost_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
3
+ {
4
+ protected function _prepareForm()
5
+ {
6
+ $form = new Varien_Data_Form(array(
7
+ "id" => "edit_form",
8
+ "action" => $this->getUrl("*/*/save", array(
9
+ "id" => $this->getRequest()->getParam("id")
10
+ )) ,
11
+ "method" => "post",
12
+ "enctype" => "multipart/form-data",
13
+ ));
14
+ $form->setUseContainer(true);
15
+ $this->setForm($form);
16
+ return parent::_prepareForm();
17
+ }
18
+ }
app/code/community/Klevu/Boosting/Block/Adminhtml/Boost/Edit/Tab/Actions.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Klevu_Boosting_Block_Adminhtml_Boost_Edit_Tab_Actions extends Mage_Adminhtml_Block_Widget_Form
3
+ {
4
+ protected function _prepareForm()
5
+ {
6
+ $form = new Varien_Data_Form();
7
+ $this->setForm($form);
8
+ $fieldset = $form->addFieldset("boosting_form", array(
9
+ "legend" => Mage::helper("boosting")->__("Specify the boosting score to be assigned to the
10
+ products matching the conditions of your rule")
11
+ ));
12
+ $afterElementHtml = '<p class="nm"><small>Please enter a value between 1 and 999. If a product satisfies all the
13
+ condition, the boosting score given here is assigned to the product.</small></p>';
14
+ $fieldset->addField("boosting", "text", array(
15
+ "label" => Mage::helper("boosting")->__("Boost Value") ,
16
+ "class" => "required-entry validate-number validate-number-range number-range-1-999",
17
+ "required" => true,
18
+ "name" => "boosting",
19
+ 'after_element_html' => $afterElementHtml,
20
+ ));
21
+ if (Mage::getSingleton("adminhtml/session")->getBoostData()) {
22
+ $form->setValues(Mage::getSingleton("adminhtml/session")->getBoostData());
23
+ Mage::getSingleton("adminhtml/session")->setBoostData(null);
24
+ }
25
+ elseif (Mage::registry("boost_data")) {
26
+ $form->setValues(Mage::registry("boost_data")->getData());
27
+ }
28
+ return parent::_prepareForm();
29
+ }
30
+ }
app/code/community/Klevu/Boosting/Block/Adminhtml/Boost/Edit/Tab/Conditions.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Klevu_Boosting_Block_Adminhtml_Boost_Edit_Tab_Conditions extends Mage_Adminhtml_Block_Widget_Form implements Mage_Adminhtml_Block_Widget_Tab_Interface
3
+ {
4
+ public function getTabLabel()
5
+ {
6
+ return $this->__('Conditions');
7
+ }
8
+ public function getTabTitle()
9
+ {
10
+ return $this->getTabLabel();
11
+ }
12
+ public function canShowTab()
13
+ {
14
+ return true;
15
+ }
16
+ public function isHidden()
17
+ {
18
+ return false;
19
+ }
20
+ protected function _prepareForm()
21
+ {
22
+ $boostModel = Mage::registry('boost_data');
23
+ $form = new Varien_Data_Form();
24
+ $form->setHtmlIdPrefix('rule_');
25
+ $renderer = Mage::getBlockSingleton('adminhtml/widget_form_renderer_fieldset')->setTemplate('promo/fieldset.phtml')->setNewChildUrl($this->getUrl('*/adminhtml_boost/newConditionHtml/form/rule_conditions_fieldset'));
26
+ $fieldset = $form->addFieldset('conditions_fieldset', array(
27
+ 'legend' => $this->__('Specify "Conditions" when the rule should be executed (Note: Only the attributes which have been enabled for promotion use are visible in the dropdown below (see Catalog > Attributes > Manage Attributes > Choose your attribute > Properties > Use for Promo Rule Conditions).
28
+ )')
29
+ ))->setRenderer($renderer);
30
+ $fieldset->addField('conditions', 'text', array(
31
+ 'type' => 'conditions',
32
+ 'label' => $this->__('Conditions') ,
33
+ 'title' => $this->__('Conditions') ,
34
+ 'required' => true,
35
+ ))->setRule($boostModel)->setRenderer(Mage::getBlockSingleton('rule/conditions'));
36
+ $form->setValues($boostModel->getData());
37
+ $this->setForm($form);
38
+ return parent::_prepareForm();
39
+ }
40
+ }
app/code/community/Klevu/Boosting/Block/Adminhtml/Boost/Edit/Tab/Form.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Klevu_Boosting_Block_Adminhtml_Boost_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
3
+ {
4
+ protected function _prepareForm()
5
+ {
6
+ $form = new Varien_Data_Form();
7
+ $this->setForm($form);
8
+ $fieldset = $form->addFieldset("boosting_form", array(
9
+ "legend" => Mage::helper("boosting")->__("Rule Information")
10
+ ));
11
+ $fieldset->addField("name", "text", array(
12
+ "label" => Mage::helper("boosting")->__("Rule Name") ,
13
+ "class" => "required-entry",
14
+ "required" => true,
15
+ "name" => "name",
16
+ ));
17
+ $fieldset->addField("description", "textarea", array(
18
+ "label" => Mage::helper("boosting")->__("Description") ,
19
+ "class" => "required-entry",
20
+ "required" => true,
21
+ "name" => "description",
22
+ ));
23
+ $fieldset->addField('status', 'select', array(
24
+ 'label' => $this->__('Status') ,
25
+ 'title' => $this->__('Status') ,
26
+ 'name' => 'status',
27
+ 'required' => true,
28
+ 'options' => array(
29
+ '1' => $this->__('Active') ,
30
+ '0' => $this->__('Inactive') ,
31
+ ) ,
32
+ ));
33
+ if (Mage::getSingleton("adminhtml/session")->getBoostData()) {
34
+ $form->setValues(Mage::getSingleton("adminhtml/session")->getBoostData());
35
+ Mage::getSingleton("adminhtml/session")->setBoostData(null);
36
+ }
37
+ else if (Mage::registry("boost_data")) {
38
+ $form->setValues(Mage::registry("boost_data")->getData());
39
+ }
40
+ return parent::_prepareForm();
41
+ }
42
+ }
app/code/community/Klevu/Boosting/Block/Adminhtml/Boost/Edit/Tabs.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Klevu_Boosting_Block_Adminhtml_Boost_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
3
+ {
4
+ public function __construct()
5
+ {
6
+ parent::__construct();
7
+ $this->setId("boost_tabs");
8
+ $this->setDestElementId("edit_form");
9
+ $this->setTitle(Mage::helper("boosting")->__("Klevu Rule Information"));
10
+ }
11
+ protected function _beforeToHtml()
12
+ {
13
+ $this->addTab("form_general_section", array(
14
+ "label" => Mage::helper("boosting")->__("Rule Information") ,
15
+ "title" => Mage::helper("boosting")->__("Rule Information") ,
16
+ "content" => $this->getLayout()->createBlock("boosting/adminhtml_boost_edit_tab_form")->toHtml() ,
17
+ ));
18
+ $this->addTab('form_condition_section', array(
19
+ 'label' => Mage::helper('boosting')->__('Conditions') ,
20
+ 'title' => Mage::helper('boosting')->__('Conditions') ,
21
+ 'content' => $this->getLayout()->createBlock('boosting/adminhtml_boost_edit_tab_conditions')->toHtml() ,
22
+ ));
23
+ $this->addTab('form_action_section', array(
24
+ 'label' => Mage::helper('boosting')->__('Actions') ,
25
+ 'title' => Mage::helper('boosting')->__('Actions') ,
26
+ 'content' => $this->getLayout()->createBlock('boosting/adminhtml_boost_edit_tab_actions')->toHtml() ,
27
+ ));
28
+ return parent::_beforeToHtml();
29
+ }
30
+ }
app/code/community/Klevu/Boosting/Block/Adminhtml/Boost/Grid.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Klevu_Boosting_Block_Adminhtml_Boost_Grid extends Mage_Adminhtml_Block_Widget_Grid
3
+ {
4
+ public function __construct()
5
+ {
6
+ parent::__construct();
7
+ $this->setId("boostGrid");
8
+ $this->setDefaultSort("id");
9
+ $this->setDefaultDir("DESC");
10
+ $this->setSaveParametersInSession(true);
11
+ }
12
+ protected function _prepareCollection()
13
+ {
14
+ $collection = Mage::getModel("boosting/boost")->getCollection();
15
+ $this->setCollection($collection);
16
+ return parent::_prepareCollection();
17
+ }
18
+ protected function _prepareColumns()
19
+ {
20
+ $this->addColumn("id", array(
21
+ "header" => Mage::helper("boosting")->__("ID") ,
22
+ "align" => "right",
23
+ "width" => "50px",
24
+ "type" => "number",
25
+ "index" => "id",
26
+ ));
27
+ $this->addColumn("name", array(
28
+ "header" => Mage::helper("boosting")->__("Rule Name") ,
29
+ "index" => "name",
30
+ ));
31
+ $this->addColumn('status', array(
32
+ 'header' => $this->__('Status') ,
33
+ 'align' => 'left',
34
+ 'width' => '80px',
35
+ 'index' => 'status',
36
+ 'type' => 'options',
37
+ 'options' => array(
38
+ 1 => $this->__('Active') ,
39
+ 0 => $this->__('Inactive')
40
+ ) ,
41
+ ));
42
+ return parent::_prepareColumns();
43
+ }
44
+ public function getRowUrl($row)
45
+ {
46
+ return $this->getUrl("*/*/edit", array(
47
+ "id" => $row->getId()
48
+ ));
49
+ }
50
+ protected function _prepareMassaction()
51
+ {
52
+ $this->setMassactionIdField('id');
53
+ $this->getMassactionBlock()->setFormFieldName('ids');
54
+ $this->getMassactionBlock()->setUseSelectAll(true);
55
+ $this->getMassactionBlock()->addItem('remove_boost', array(
56
+ 'label' => Mage::helper('boosting')->__('Remove Rule') ,
57
+ 'url' => $this->getUrl('*/adminhtml_boost/massRemove') ,
58
+ 'confirm' => Mage::helper('boosting')->__('Are you sure?')
59
+ ));
60
+ return $this;
61
+ }
62
+ }
app/code/community/Klevu/Boosting/Block/Adminhtml/Form/Field/Rule/Button.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class Klevu_Search_Block_Adminhtml_Form_Field_Sync_Button
5
+ *
6
+ * @method setStoreId($id)
7
+ * @method string getStoreId()
8
+ */
9
+ class Klevu_Boosting_Block_Adminhtml_Form_Field_Rule_Button extends Mage_Adminhtml_Block_System_Config_Form_Field {
10
+
11
+ protected function _prepareLayout() {
12
+ parent::_prepareLayout();
13
+
14
+ // Set the default template
15
+ if (!$this->getTemplate()) {
16
+ $this->setTemplate('klevu/boosting/form/field/rule/button.phtml');
17
+ }
18
+
19
+ return $this;
20
+ }
21
+
22
+ public function render(Varien_Data_Form_Element_Abstract $element) {
23
+ if ($element->getScope() == "stores") {
24
+ $this->setStoreId($element->getScopeId());
25
+ }
26
+
27
+ // Remove the scope information so it doesn't get printed out
28
+ $element
29
+ ->unsScope()
30
+ ->unsCanUseWebsiteValue()
31
+ ->unsCanUseDefaultValue();
32
+
33
+ return parent::render($element);
34
+ }
35
+
36
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
37
+ $url_params = ($this->getStoreId()) ? array("store" => $this->getStoreId()) : array();
38
+ $label_suffix = "";
39
+
40
+ $this->addData(array(
41
+ "html_id" => $element->getHtmlId(),
42
+ "button_label" => sprintf("Configure Product Boosting Rules%s", $label_suffix),
43
+ "destination_url" => $this->getUrl("admin_boosting/adminhtml_boost", $url_params),
44
+ ));
45
+
46
+ return $this->_toHtml();
47
+ }
48
+ }
app/code/community/Klevu/Boosting/Helper/Data.php ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Klevu_Boosting_Helper_Data extends Mage_Core_Helper_Abstract
3
+ {
4
+ /**
5
+ * Return the Boost value for the given product from klevu boosting rule module.
6
+ *
7
+ * @param array $product_id.
8
+ *
9
+ * @return int as boost value.
10
+ */
11
+ public function applyBoostRuleToProduct($id)
12
+ {
13
+ $connection = Mage::getSingleton('core/resource')->getConnection('core_read');
14
+ $select = $connection->select()->from(Mage::getSingleton('core/resource')->getTableName('boosting/boost') , array(
15
+ 'MAX(boosting) AS boost_value'
16
+ ))->where("matchingids", array(
17
+ "finset" => $id
18
+ ));
19
+ $result = $connection->fetchCol($select);
20
+ return $result[0];
21
+ }
22
+ /**
23
+ * Return array of product ids for boosting rules.
24
+ *
25
+ * @return array.
26
+ */
27
+ public function getProdcutsBoostingValues()
28
+ {
29
+ $boostRules = Mage::getModel("boosting/boost")->getCollection()->addFieldToFilter('status', '1');
30
+ if (count($boostRules) > 0) {
31
+ foreach($boostRules as $obj) {
32
+ $boostarr[$obj->getId() ][$obj->getBoosting() ] = $obj->getMatchingids();
33
+ }
34
+ return $boostarr;
35
+ }
36
+ }
37
+ /**
38
+ * Return array of product ids for boosting rules.
39
+ *
40
+ * @param int $product_id,$boostarray
41
+ *
42
+ * @return array.
43
+ */
44
+ public function findMaxBoostValueForProduct($id, $boostarray)
45
+ {
46
+ $product['curent_boost_value'] = 0;
47
+ $product['prev_boost'] = 0;
48
+ foreach($boostarray as $key => $value) {
49
+ foreach($value as $boostkey => $boostvalue) {
50
+ $find = "," . $id . ",";
51
+ if (strpos($boostvalue, $find) !== false) {
52
+ if ($product['prev_boost'] < $boostkey) {
53
+ $product['curent_boost_value'] = $boostkey;
54
+ }
55
+ $product['prev_boost'] = $boostkey;
56
+ }
57
+ }
58
+ }
59
+
60
+ if($product['curent_boost_value'] > 0) {
61
+ return $product['curent_boost_value'];
62
+ } else {
63
+ return;
64
+ }
65
+ }
66
+
67
+ }
app/code/community/Klevu/Boosting/Model/Boost.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Klevu_Boosting_Model_Boost extends Mage_CatalogRule_Model_Rule
3
+ {
4
+ protected $_eventPrefix = 'boosting';
5
+ protected $_eventObject = 'object';
6
+ protected function _construct()
7
+ {
8
+ $this->_init("boosting/boost");
9
+ }
10
+ public function getConditionsInstance()
11
+
12
+ {
13
+ return Mage::getModel('boosting/boost_rule_condition_combine');
14
+ }
15
+ /**
16
+ * Get array of product ids which are matched by rule
17
+ *
18
+ * @return array
19
+ */
20
+ public function getMatchingProductIds()
21
+ {
22
+ $rows = array();
23
+ if (is_null($this->_productIds)) {
24
+ $this->_productIds = array();
25
+ $this->setCollectedAttributes(array());
26
+ /** @var $productCollection Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection */
27
+ $productCollection = Mage::getResourceModel('catalog/product_collection');
28
+ $this->getConditions()->collectValidatedAttributes($productCollection);
29
+ Mage::getSingleton('core/resource_iterator')->walk($productCollection->getSelect() , array(
30
+ array(
31
+ $this,
32
+ 'callbackValidateProduct'
33
+ )
34
+ ) , array(
35
+ 'attributes' => $this->getCollectedAttributes() ,
36
+ 'product' => Mage::getModel('catalog/product') ,
37
+ ));
38
+ }
39
+ if (version_compare(Mage::getVersion(), '1.7.0.2', '<=')===true) {
40
+ return $this->_productIds;
41
+ }
42
+ foreach($this->_productIds as $key => $value) {
43
+ if ($value[0] == 1) {
44
+ $rows[] = $key;
45
+ }
46
+ }
47
+ return $rows;
48
+ }
49
+ }
app/code/community/Klevu/Boosting/Model/Boost/Rule/Condition/Combine.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Klevu_Boosting_Model_Boost_Rule_Condition_Combine extends Mage_CatalogRule_Model_Rule_Condition_Combine
3
+ {
4
+ public function __construct()
5
+ {
6
+ parent::__construct();
7
+ $this->setType('boosting/boost_rule_condition_combine');
8
+ }
9
+
10
+ public function getNewChildSelectOptions()
11
+ {
12
+ $productCondition = Mage::getModel('boosting/boost_rule_condition_product');
13
+ $productAttributes = $productCondition->loadAttributeOptions()->getAttributeOption();
14
+ $attributes = array();
15
+ foreach ($productAttributes as $code=>$label) {
16
+ $attributes[] = array('value'=>'boosting/boost_rule_condition_product|'.$code, 'label'=>$label);
17
+ }
18
+ //$conditions = parent::getNewChildSelectOptions();
19
+ $conditions =array();
20
+ $conditions = array_merge_recursive($conditions, array(
21
+ array('value'=>'boosting/boost_rule_condition_combine', 'label'=>Mage::helper('catalogrule')->__('Conditions Combination')),
22
+ array('label'=>Mage::helper('catalogrule')->__('Product Attribute'), 'value'=>$attributes),
23
+ ));
24
+ return $conditions;
25
+ }
26
+
27
+ public function collectValidatedAttributes($productCollection)
28
+ {
29
+ foreach ($this->getConditions() as $condition) {
30
+ $condition->collectValidatedAttributes($productCollection);
31
+ }
32
+ return $this;
33
+ }
34
+
35
+
36
+
37
+ }
app/code/community/Klevu/Boosting/Model/Boost/Rule/Condition/Product.php ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Klevu_Boosting_Model_Boost_Rule_Condition_Product extends Mage_CatalogRule_Model_Rule_Condition_Product
3
+ {
4
+
5
+ /**
6
+ * Validate product attribute value for condition
7
+ *
8
+ * @param Varien_Object $object
9
+ * @return bool
10
+ */
11
+ public function validate(Varien_Object $object)
12
+ {
13
+ $attrCode = $this->getAttribute();
14
+ if ('category_ids' == $attrCode) {
15
+ return $this->validateAttribute($object->getAvailableInCategories());
16
+ }
17
+ if ('attribute_set_id' == $attrCode) {
18
+ return $this->validateAttribute($object->getData($attrCode));
19
+ }
20
+
21
+ $oldAttrValue = $object->hasData($attrCode) ? $object->getData($attrCode) : null;
22
+ $object->setData($attrCode, $this->_getAttributeValue($object));
23
+ $result = $this->_validateProduct($object);
24
+ $this->_restoreOldAttrValue($object, $oldAttrValue);
25
+
26
+ return (bool)$result;
27
+ }
28
+
29
+
30
+ /**
31
+ * Get attribute value
32
+ *
33
+ * @param Varien_Object $object
34
+ * @return mixed
35
+ */
36
+ protected function _getAttributeValue($object)
37
+ {
38
+
39
+ $storeId = $object->getStoreId();
40
+ $defaultStoreId = Mage_Core_Model_App::ADMIN_STORE_ID;
41
+ $productValues = isset($this->_entityAttributeValues[$object->getId()])
42
+ ? $this->_entityAttributeValues[$object->getId()] : array($defaultStoreId => $object->getData($this->getAttribute()));
43
+ $defaultValue = isset($productValues[$defaultStoreId]) ? $productValues[$defaultStoreId] : null;
44
+ $value = isset($productValues[$storeId]) ? $productValues[$storeId] : $defaultValue;
45
+ $value = $this->_prepareDatetimeValue($value, $object);
46
+ $value = $this->_prepareMultiselectValue($value, $object);
47
+
48
+ return $value;
49
+ }
50
+
51
+ /**
52
+ * Prepare datetime attribute value
53
+ *
54
+ * @param mixed $value
55
+ * @param Varien_Object $object
56
+ * @return mixed
57
+ */
58
+ protected function _prepareDatetimeValue($value, $object)
59
+ {
60
+ $attribute = $object->getResource()->getAttribute($this->getAttribute());
61
+ if ($attribute && $attribute->getBackendType() == 'datetime') {
62
+ $value = date('Y-m-d',strtotime($value));
63
+ }
64
+ return $value;
65
+ }
66
+
67
+ /**
68
+ * Prepare multiselect attribute value
69
+ *
70
+ * @param mixed $value
71
+ * @param Varien_Object $object
72
+ * @return mixed
73
+ */
74
+ protected function _prepareMultiselectValue($value, $object)
75
+ {
76
+ $attribute = $object->getResource()->getAttribute($this->getAttribute());
77
+ if ($attribute && $attribute->getFrontendInput() == 'multiselect') {
78
+ $value = strlen($value) ? explode(',', $value) : array();
79
+ }
80
+ return $value;
81
+ }
82
+
83
+ /**
84
+ * Validate product
85
+ *
86
+ * @param Varien_Object $object
87
+ * @return bool
88
+ */
89
+ protected function _validateProduct($object)
90
+ {
91
+ return Mage_Rule_Model_Condition_Abstract::validate($object);
92
+ }
93
+
94
+ /**
95
+ * Restore old attribute value
96
+ *
97
+ * @param Varien_Object $object
98
+ * @param mixed $oldAttrValue
99
+ */
100
+ protected function _restoreOldAttrValue($object, $oldAttrValue)
101
+ {
102
+ $attrCode = $this->getAttribute();
103
+ if (is_null($oldAttrValue)) {
104
+ $object->unsetData($attrCode);
105
+ } else {
106
+ $object->setData($attrCode, $oldAttrValue);
107
+ }
108
+ }
109
+ }
app/code/community/Klevu/Boosting/Model/Mysql4/Boost.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Klevu_Boosting_Model_Mysql4_Boost extends Mage_Core_Model_Mysql4_Abstract
3
+ {
4
+ protected function _construct()
5
+ {
6
+ $this->_init("boosting/boost", "id");
7
+ }
8
+ public function updateMatchingIds($matchingids, $id)
9
+ {
10
+ $write = $this->_getWriteAdapter();
11
+ $write->update(Mage::getSingleton('core/resource')->getTableName('boosting/boost') , array(
12
+ "matchingids" => $matchingids
13
+ ) , "id=" . $id);
14
+ }
15
+
16
+ // this function included for magento 1.5 and 1.6 only
17
+ public function updateRuleProductData(){
18
+
19
+ }
20
+ }
app/code/community/Klevu/Boosting/Model/Mysql4/Boost/Collection.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Klevu_Boosting_Model_Mysql4_Boost_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
3
+ {
4
+ public function _construct()
5
+ {
6
+ $this->_init("boosting/boost");
7
+ }
8
+ public function addActiveFilter()
9
+ {
10
+ return $this->addFieldToFilter('is_active', 1);
11
+ }
12
+ }
app/code/community/Klevu/Boosting/Model/Observer.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Klevu_Boosting_Model_Observer extends Varien_Object
3
+ {
4
+
5
+ /* update matching product ids */
6
+ public function updateMatchingids(Varien_Event_Observer $observer) {
7
+ $obj = $observer->getEvent()->getObject();
8
+ $matchingids = ",".implode(",",$obj->getMatchingProductIds()).",";
9
+ Mage::getResourceModel("boosting/boost")->updateMatchingIds($matchingids,$obj->getId());
10
+ }
11
+
12
+ /* update matching product ids */
13
+ public function addBoostingAttribute(Varien_Event_Observer $observer) {
14
+ $product = $observer->getEvent()->getProduct();
15
+ $parent = $observer->getEvent()->getParent();
16
+ $store = $observer->getEvent()->getStore();
17
+ $boosting_settings = Mage::helper('klevu_search/config')->getBoostingAttribute($store);
18
+ if($boosting_settings == "use_boosting_rule") {
19
+ $boostarray = Mage::helper('boosting')->getProdcutsBoostingValues();
20
+ if(!empty($boostarray)) {
21
+ if($parent) {
22
+ $product["boostingAttribute"] = Mage::helper('boosting')->findMaxBoostValueForProduct($product['parent_id'],$boostarray);
23
+ } else if($product['product_id']){
24
+ $product["boostingAttribute"] = Mage::helper('boosting')->findMaxBoostValueForProduct($product['product_id'],$boostarray);
25
+ }
26
+ $observer->getEvent()->setProduct($product);
27
+ return $this;
28
+ }
29
+ }
30
+ }
31
+
32
+ /* apply boosting rule for products */
33
+ public function applyALlBoostingRule(Varien_Event_Observer $observer) {
34
+ try {
35
+ $collectionData = Mage::getModel("boosting/boost")->getCollection()->addFieldToFilter('status', '1')->addFieldToSelect('id');
36
+ foreach($collectionData->getData() as $key => $value){
37
+ $boostModel = Mage::getModel('boosting/boost')->load($value['id']);
38
+ $matchingids = ",".implode(",",$boostModel->getMatchingProductIds()).",";
39
+ Mage::getResourceModel("boosting/boost")->updateMatchingIds($matchingids,$value['id']);
40
+ }
41
+ } catch (Exception $e) {
42
+ // Catch the exception that was thrown, log it.
43
+ Mage::helper('klevu_search')->log(Zend_Log::CRIT, sprintf("Exception thrown in %s::%s - %s", __CLASS__, __METHOD__, $e->getMessage()));
44
+ }
45
+ }
46
+
47
+ }
app/code/community/Klevu/Boosting/Model/System/Config/Source/Boosting/Attribute.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Klevu_Boosting_Model_System_Config_Source_Boosting_Attribute extends Klevu_Search_Model_System_Config_Source_Boosting_Attribute {
4
+
5
+ /**
6
+ * Fetch all integer and decimal attributes and return in as options array.
7
+ *
8
+ * @return array
9
+ */
10
+ public function toOptionArray() {
11
+ $attributes = $this->getAttributeCollection();
12
+ $boost_option = array(
13
+ 'value' => null,
14
+ 'label' => ''
15
+ );
16
+ if(Mage::helper('core')->isModuleEnabled("Klevu_Boosting"))
17
+ {
18
+ $boost_option = array(
19
+ 'value' => 'use_boosting_rule',
20
+ 'label' => 'Apply Product Boosting Rules'
21
+ );
22
+ }
23
+ $options = array(
24
+ array(
25
+ 'value' => null,
26
+ 'label' => '--- No Attribute Selected ---'
27
+ ),
28
+ $boost_option
29
+ );
30
+ foreach($attributes as $attribute) {
31
+ /** @var Mage_Catalog_Model_Resource_Eav_Attribute $attribute */
32
+ $options[] = array(
33
+ 'value' => $attribute->getAttributeCode(),
34
+ 'label' => $attribute->getAttributeCode()
35
+ );
36
+ }
37
+
38
+ return $options;
39
+ }
40
+
41
+ }
app/code/community/Klevu/Boosting/Test/Model/Boost.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Klevu_Boosting_Test_Model_Boost extends Klevu_Search_Test_Model_Api_Test_Case
3
+ {
4
+
5
+ /**
6
+ * @test
7
+ * @loadFixture
8
+ */
9
+ public function testGetMatchingProductIds()
10
+ {
11
+ //test Data with attribute condition
12
+ $model = Mage::getModel('boosting/boost')->load(466);
13
+ $this->assertEquals(array(132), $model->getMatchingProductIds());
14
+
15
+ //test Data with category condition
16
+ $model = Mage::getModel('boosting/boost')->load(467);
17
+ $this->assertEquals(array(132), $model->getMatchingProductIds());
18
+ }
19
+ }
app/code/community/Klevu/Boosting/Test/Model/Boost/fixtures/testGetMatchingProductIds.yaml ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ eav:
2
+ catalog_product:
3
+ -
4
+ entity_id: 132
5
+ attribute_set_id: 4
6
+ type_id: simple
7
+ sku: ac674
8
+ name: SLR Camera Tripod
9
+ short_description: Sturdy, lightweight tripods are designed to meet the needs of amateur and professional photographers and videographers.
10
+ description: Sturdy, lightweight tripods are designed to meet the needs of amateur and professional photographers and videographers.
11
+ url_key: slr-camera-tripod
12
+ image: /s/l/slr-camera-tripod.jpg
13
+ weight: 42
14
+ stock:
15
+ qty: 100.00
16
+ is_in_stock: 1
17
+ website_ids:
18
+ - 1 # Default website
19
+ category_ids:
20
+ - 2 # Default category
21
+ price: 99
22
+ tax_class_id: 2
23
+ status: 1
24
+ visibility: 4
25
+ created_at: 2007-08-29 19:53:55
26
+ updated_at: 2008-08-08 15:05:45
27
+ tables:
28
+ klevu_products_boosting:
29
+ -
30
+ id:466
31
+ name: Test
32
+ description: Test
33
+ status: 1
34
+ boosting:23
35
+ matchingids:,1307,1309,
36
+ conditions_serialized:'a:7:{s:4:"type";s:37:"boosting/boost_rule_condition_combine";s:9:"attribute";N;s:8:"operator";N;s:5:"value";s:1:"1";s:18:"is_value_processed";N;s:10:"aggregator";s:3:"all";s:10:"conditions";a:1:{i:0;a:5:{s:4:"type";s:37:"boosting/boost_rule_condition_product";s:9:"attribute";s:3:"sku";s:8:"operator";s:2:"==";s:5:"value";s:5:"ac674";s:18:"is_value_processed";b:0;}}}'
37
+ -
38
+ id:467
39
+ name: Test
40
+ description: Test
41
+ status: 1
42
+ boosting:23
43
+ matchingids:,1307,1309,
44
+ conditions_serialized:'a:7:{s:4:"type";s:37:"boosting/boost_rule_condition_combine";s:9:"attribute";N;s:8:"operator";N;s:5:"value";s:1:"1";s:18:"is_value_processed";N;s:10:"aggregator";s:3:"all";s:10:"conditions";a:1:{i:0;a:5:{s:4:"type";s:37:"boosting/boost_rule_condition_product";s:9:"attribute";s:12:"category_ids";s:8:"operator";s:2:"==";s:5:"value";s:1:"2";s:18:"is_value_processed";b:0;}}}'
app/code/community/Klevu/Boosting/controllers/Adminhtml/BoostController.php ADDED
@@ -0,0 +1,172 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Klevu_Boosting_Adminhtml_BoostController extends Mage_Adminhtml_Controller_Action
3
+ {
4
+ protected function _initAction()
5
+ {
6
+ $this->loadLayout()->_setActiveMenu("boosting/boost")->_addBreadcrumb(Mage::helper("adminhtml")->__("Product Boosting Manager") , Mage::helper("adminhtml")->__("Boost Manager"));
7
+ return $this;
8
+ }
9
+ public function indexAction()
10
+ {
11
+ $this->_title($this->__("Product Boosting Manager"));
12
+ $this->_initAction();
13
+ $this->renderLayout();
14
+ }
15
+ public function editAction()
16
+ {
17
+ $this->_title($this->__("Edit Rule"));
18
+ $id = $this->getRequest()->getParam("id");
19
+ $model = Mage::getModel("boosting/boost")->load($id);
20
+ $model->getConditions()->setJsFormObject('rule_conditions_fieldset');
21
+ if ($model->getId()) {
22
+ Mage::register("boost_data", $model);
23
+ $this->loadLayout();
24
+ $this->_setActiveMenu("boosting/boost");
25
+ $this->_addBreadcrumb(Mage::helper("adminhtml")->__("Product Boosting Manager") , Mage::helper("adminhtml")->__("Product Boosting Manager"));
26
+ $this->_addBreadcrumb(Mage::helper("adminhtml")->__("Product Boosting Description") , Mage::helper("adminhtml")->__("Product Boosting Description"));
27
+ $this->getLayout()->getBlock("head")->setCanLoadExtJs(true);
28
+ $this->_addContent($this->getLayout()->createBlock("boosting/adminhtml_boost_edit"))->_addLeft($this->getLayout()->createBlock("boosting/adminhtml_boost_edit_tabs"));
29
+ $this->renderLayout();
30
+ }
31
+ else {
32
+ Mage::getSingleton("adminhtml/session")->addError(Mage::helper("boosting")->__("Rule does not exist."));
33
+ $this->_redirect("*/*/");
34
+ }
35
+ }
36
+ public function newAction()
37
+ {
38
+ $this->_title($this->__("Boosting"));
39
+ $this->_title($this->__("Boost"));
40
+ $this->_title($this->__("New Rule"));
41
+ $id = $this->getRequest()->getParam("id");
42
+ $model = Mage::getModel("boosting/boost")->load($id);
43
+ $data = Mage::getSingleton("adminhtml/session")->getFormData(true);
44
+ if (!empty($data)) {
45
+ $model->loadPost($data);
46
+ }
47
+ Mage::register("boost_data", $model);
48
+ $this->loadLayout();
49
+ $this->_setActiveMenu("boosting/boost");
50
+ $this->getLayout()->getBlock("head")->setCanLoadExtJs(true);
51
+ $this->_addBreadcrumb(Mage::helper("adminhtml")->__("Product Boosting Manager") , Mage::helper("adminhtml")->__("Product Boosting Manager"));
52
+ $this->_addBreadcrumb(Mage::helper("adminhtml")->__("Product Boosting Description") , Mage::helper("adminhtml")->__("Product Boosting Description"));
53
+ $this->_addContent($this->getLayout()->createBlock("boosting/adminhtml_boost_edit"))->_addLeft($this->getLayout()->createBlock("boosting/adminhtml_boost_edit_tabs"));
54
+ $this->renderLayout();
55
+ }
56
+ public function saveAction()
57
+ {
58
+ if (!$this->getRequest()->getPost()) {
59
+ $this->_redirect('*/*/');
60
+ }
61
+ $boostModel = $this->_initBoost();
62
+ $data = $this->getRequest()->getPost();
63
+ try {
64
+ $validateResult = $boostModel->validateData(new Varien_Object($data));
65
+ if ($validateResult !== true) {
66
+ foreach($validateResult as $errorMessage) {
67
+ $this->_getSession()->addError($errorMessage);
68
+ }
69
+ $this->_redirect('*/*/edit', array(
70
+ 'id' => $boostModel->getId()
71
+ ));
72
+ return;
73
+ }
74
+ $data['conditions'] = $data['rule']['conditions'];
75
+ unset($data['rule']);
76
+ $boostModel->loadPost($data);
77
+ $boostModel->save();
78
+ Mage::getSingleton('adminhtml/session')->addSuccess($this->__('The Product rule has been saved.'));
79
+ if ($this->getRequest()->getParam('back')) {
80
+ return $this->_redirect('*/*/edit', array(
81
+ 'id' => $boostModel->getId() ,
82
+ ));
83
+ }
84
+ }
85
+ catch(Mage_Core_Exception $e) {
86
+ $this->_getSession()->addError($e->getMessage());
87
+ }
88
+ catch(Exception $e) {
89
+ $this->_getSession()->addError($this->__('An error occurred while saving the rule data. Please review the log and try again.'));
90
+ Mage::logException($e);
91
+ $this->_redirect('*/*/edit', array(
92
+ 'id' => $this->getRequest()->getParam('id')
93
+ ));
94
+ return;
95
+ }
96
+ $this->_redirect('*/*/');
97
+ }
98
+ protected function _initBoost()
99
+ {
100
+ $boostModel = Mage::getModel('boosting/boost');
101
+ $id = (int)$this->getRequest()->getParam('id', null);
102
+ if ($id) {
103
+ try {
104
+ $boostModel->load($id);
105
+ if (null === $boostModel->getId()) {
106
+ throw new Exception($this->__('This rule no longer exists'));
107
+ }
108
+ }
109
+ catch(Exception $e) {
110
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
111
+ return null;
112
+ }
113
+ }
114
+ Mage::register('boost_data', $boostModel);
115
+ return $boostModel;
116
+ }
117
+ public function deleteAction()
118
+ {
119
+ if ($this->getRequest()->getParam("id") > 0) {
120
+ try {
121
+ $model = Mage::getModel("boosting/boost");
122
+ $model->setId($this->getRequest()->getParam("id"))->delete();
123
+ Mage::getSingleton("adminhtml/session")->addSuccess(Mage::helper("adminhtml")->__("Rule was successfully deleted"));
124
+ $this->_redirect("*/*/");
125
+ }
126
+ catch(Exception $e) {
127
+ Mage::getSingleton("adminhtml/session")->addError($e->getMessage());
128
+ $this->_redirect("*/*/edit", array(
129
+ "id" => $this->getRequest()->getParam("id")
130
+ ));
131
+ }
132
+ }
133
+ $this->_redirect("*/*/");
134
+ }
135
+ public function massRemoveAction()
136
+ {
137
+ try {
138
+ $ids = $this->getRequest()->getPost('ids', array());
139
+ foreach($ids as $id) {
140
+ $model = Mage::getModel("boosting/boost");
141
+ $model->setId($id)->delete();
142
+ }
143
+ Mage::getSingleton("adminhtml/session")->addSuccess(Mage::helper("adminhtml")->__("Rule(s) were successfully removed."));
144
+ }
145
+ catch(Exception $e) {
146
+ Mage::getSingleton("adminhtml/session")->addError($e->getMessage());
147
+ }
148
+ $this->_redirect('*/*/');
149
+ }
150
+
151
+ public function newConditionHtmlAction()
152
+ {
153
+ $id = $this->getRequest()->getParam('id');
154
+ $typeArr = explode('|', str_replace('-', '/', $this->getRequest()->getParam('type')));
155
+ $type = $typeArr[0];
156
+ $model = Mage::getModel($type)->setId($id)->setType($type)->setRule(Mage::getModel('boosting/boost'))->setPrefix('conditions');
157
+ if (!empty($typeArr[1])) {
158
+ $model->setAttribute($typeArr[1]);
159
+ }
160
+ $html = '';
161
+ if ($model instanceof Mage_Rule_Model_Condition_Abstract) {
162
+ $model->setJsFormObject($this->getRequest()->getParam('form'));
163
+ $html = $model->asHtmlRecursive();
164
+ }
165
+ $this->getResponse()->setBody($html);
166
+ }
167
+
168
+ protected function _isAllowed()
169
+ {
170
+ return true;
171
+ }
172
+ }
app/code/community/Klevu/Boosting/etc/config.xml ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <modules>
4
+ <Klevu_Boosting>
5
+ <version>10.0.4</version>
6
+ </Klevu_Boosting>
7
+ </modules>
8
+ <global>
9
+ <helpers>
10
+ <boosting>
11
+ <class>Klevu_Boosting_Helper</class>
12
+ </boosting>
13
+ </helpers>
14
+ <blocks>
15
+ <boosting>
16
+ <class>Klevu_Boosting_Block</class>
17
+ </boosting>
18
+ </blocks>
19
+ <models>
20
+ <boosting>
21
+ <class>Klevu_Boosting_Model</class>
22
+ <resourceModel>boosting_mysql4</resourceModel>
23
+ </boosting>
24
+ <boosting_mysql4>
25
+ <class>Klevu_Boosting_Model_Mysql4</class>
26
+ <entities>
27
+ <boost>
28
+ <table>klevu_products_boosting</table>
29
+ </boost>
30
+ </entities>
31
+ </boosting_mysql4>
32
+ <klevu_search>
33
+ <rewrite>
34
+ <system_config_source_boosting_attribute>Klevu_Boosting_Model_System_Config_Source_Boosting_Attribute</system_config_source_boosting_attribute>
35
+ </rewrite>
36
+ </klevu_search>
37
+ </models>
38
+ <resources>
39
+ <klevu_boosting_setup>
40
+ <setup>
41
+ <module>Klevu_Boosting</module>
42
+ </setup>
43
+ <connection>
44
+ <use>core_setup</use>
45
+ </connection>
46
+ </klevu_boosting_setup>
47
+ <boosting_write>
48
+ <connection>
49
+ <use>core_write</use>
50
+ </connection>
51
+ </boosting_write>
52
+ <boosting_read>
53
+ <connection>
54
+ <use>core_read</use>
55
+ </connection>
56
+ </boosting_read>
57
+ </resources>
58
+ <events>
59
+ <boosting_save_after>
60
+ <observers>
61
+ <boosting_update_matchingids>
62
+ <type>singleton</type>
63
+ <class>boosting/observer</class>
64
+ <method>updateMatchingids</method>
65
+ </boosting_update_matchingids>
66
+ </observers>
67
+ </boosting_save_after>
68
+ <add_external_data_to_sync>
69
+ <observers>
70
+ <add_boosting_data_to_sync>
71
+ <type>singleton</type>
72
+ <class>boosting/observer</class>
73
+ <method>addBoostingAttribute</method>
74
+ </add_boosting_data_to_sync>
75
+ </observers>
76
+ </add_external_data_to_sync>
77
+ <update_rule_of_products>
78
+ <observers>
79
+ <update_rule_of_products_data>
80
+ <type>singleton</type>
81
+ <class>boosting/observer</class>
82
+ <method>applyALlBoostingRule</method>
83
+ </update_rule_of_products_data>
84
+ </observers>
85
+ </update_rule_of_products>
86
+ </events>
87
+ </global>
88
+ <admin>
89
+ <routers>
90
+ <boosting>
91
+ <use>admin</use>
92
+ <args>
93
+ <module>Klevu_Boosting</module>
94
+ <frontName>admin_boosting</frontName>
95
+ </args>
96
+ </boosting>
97
+ </routers>
98
+ </admin>
99
+ <adminhtml>
100
+ <acl>
101
+ <resources>
102
+ <all>
103
+ <title>Allow Everything</title>
104
+ </all>
105
+ <admin>
106
+ <children>
107
+ <boosting translate="title" module="boosting">
108
+ <title>Klevu Product Boosting</title>
109
+ <sort_order>1000</sort_order>
110
+ <children>
111
+ <boost translate="title">
112
+ <title>Klevu Product Boosting Manager</title>
113
+ <sort_order>0</sort_order>
114
+ </boost>
115
+ </children>
116
+ </boosting>
117
+ </children>
118
+ </admin>
119
+ </resources>
120
+ </acl>
121
+ <layout>
122
+ <updates>
123
+ <boosting>
124
+ <file>klevu/boosting.xml</file>
125
+ </boosting>
126
+ </updates>
127
+ </layout>
128
+ </adminhtml>
129
+ <phpunit>
130
+ <suite>
131
+ <modules>
132
+ <Klevu_Boosting/>
133
+ </modules>
134
+ </suite>
135
+ </phpunit>
136
+ </config>
app/code/community/Klevu/Boosting/etc/system.xml ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <sections>
4
+ <klevu_search translate="label" module="klevu_search">
5
+ <groups>
6
+ <attribute_boost translate="label">
7
+ <label>Search Merchandising</label>
8
+ <sort_order>300</sort_order>
9
+ <show_in_default>1</show_in_default>
10
+ <show_in_website>1</show_in_website>
11
+ <show_in_store>1</show_in_store>
12
+ <comment>
13
+ <![CDATA[<div class="kuGuideLink"><a target="_blank" href="http://support.klevu.com/section/manuals/magento-manuals/merchandising">Quick Guide</a></div>
14
+ ]]></comment>
15
+ <fields>
16
+ <boosting_rule_info translate="label comment">
17
+ <label></label>
18
+ <comment><![CDATA[Switch to store view scope to set.]]></comment>
19
+ <sort_order>801</sort_order>
20
+ <frontend_type>label</frontend_type>
21
+ <show_in_default>1</show_in_default>
22
+ <show_in_website>1</show_in_website>
23
+ <show_in_store>0</show_in_store>
24
+ </boosting_rule_info>
25
+ <boosting_rule translate="label comment">
26
+ <label></label>
27
+ <comment><![CDATA[To use rule based product boosting, ensure you have selected "Apply
28
+ Product Boosting Rules" option as the Boosting Attribute above.]]></comment>
29
+ <frontend_model>boosting/adminhtml_form_field_rule_button</frontend_model>
30
+ <sort_order>801</sort_order>
31
+ <show_in_default>0</show_in_default>
32
+ <show_in_website>0</show_in_website>
33
+ <show_in_store>1</show_in_store>
34
+ </boosting_rule>
35
+ </fields>
36
+ </attribute_boost>
37
+ </groups>
38
+ </klevu_search>
39
+ </sections>
40
+ </config>
app/code/community/Klevu/Boosting/sql/klevu_boosting_setup/mysql4-install-10.0.0.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+ $installer->startSetup();
4
+ $klevu_products_boosting = $installer->getTable('klevu_products_boosting');
5
+ $sql=<<<SQLTEXT
6
+ CREATE TABLE IF NOT EXISTS `{$klevu_products_boosting}` (
7
+ `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
8
+ `name` tinytext NOT NULL,
9
+ `description` text NOT NULL,
10
+ `status` tinyint(4) NOT NULL,
11
+ `boosting` int(11) NOT NULL,
12
+ `matchingids` text NOT NULL,
13
+ `conditions_serialized` mediumtext NOT NULL,
14
+ PRIMARY KEY (`id`)
15
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
16
+ SQLTEXT;
17
+ $installer->run($sql);
18
+ $installer->endSetup();
19
+
app/code/community/Klevu/Content/Block/Adminhtml/Form/Cmspages.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Klevu_Content_Block_Adminhtml_Form_Cmspages extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
3
+ {
4
+ protected $selectPages = array();
5
+
6
+ public function __construct()
7
+ {
8
+ $this->addColumn('cmspages', array(
9
+ 'label' => Mage::helper('adminhtml')->__('CMS Pages'),
10
+ 'renderer'=> $this->getRenderer('cmspages'),
11
+ ));
12
+ $this->_addAfter = false;
13
+ $this->_addButtonLabel = Mage::helper('adminhtml')->__('Exclude CMS Pages');
14
+ parent::__construct();
15
+ $this->setTemplate('klevu/search/system/config/form/field/array.phtml');
16
+
17
+ }
18
+ /**
19
+ * Get all pages in the store.
20
+ *
21
+ * @param int $columnId.
22
+ *
23
+ * @return $selectPages
24
+ */
25
+ protected function getRenderer($columnId) {
26
+ if (!array_key_exists($columnId, $this->selectPages) || !$this->selectPages[$columnId]) {
27
+ $cmsOptions = array();
28
+ switch($columnId) {
29
+ case 'cmspages':
30
+ $cms_pages = Mage::getModel('cms/page')->getCollection()->addFieldToSelect(array("page_id","title"))->addFieldToFilter('is_active',1);
31
+ $page_ids = $cms_pages->getData();
32
+ foreach ($page_ids as $id) {
33
+ $cmsOptions[$id['page_id']] = $id['title'];
34
+ }
35
+ break;
36
+ default:
37
+ }
38
+ $selectPage = Mage::app()->getLayout()->createBlock('content/adminhtml_form_system_config_field_select')->setIsRenderToJsTemplate(true);
39
+ $selectPage->setOptions($cmsOptions);
40
+ $selectPage->setExtraParams('style="width:200px;"');
41
+ $this->selectPages[$columnId] = $selectPage;
42
+ }
43
+
44
+ return $this->selectPages[$columnId];
45
+ }
46
+
47
+ protected function _prepareArrayRow(Varien_Object $row)
48
+ {
49
+ $row->setData('option_extra_attr_' . $this->getRenderer('cmspages')->calcOptionHash($row->getCmspages()),
50
+ 'selected="selected"'
51
+ );
52
+ }
53
+ }
app/code/community/Klevu/Content/Block/Adminhtml/Form/System/Config/Field/Select.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Klevu_Content_Block_Adminhtml_Form_System_Config_Field_Select extends Mage_Adminhtml_Block_Html_Select
3
+ {
4
+ protected function _toHtml()
5
+ {
6
+ $this->setName($this->getInputName());
7
+ $this->setClass('select');
8
+ return trim(preg_replace('/\s+/', ' ',parent::_toHtml()));
9
+ }
10
+ }
app/code/community/Klevu/Content/Block/Adminhtml/Wizard/Configure/Store.php ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Klevu_Content_Block_Adminhtml_Wizard_Configure_Store extends Mage_Adminhtml_Block_Template {
4
+
5
+ /**
6
+ * Return the submit URL for the store configuration form.
7
+ *
8
+ * @return string
9
+ */
10
+ protected function getFormActionUrl() {
11
+ return $this->getUrl("adminhtml/klevu_search_wizard/configure_store_post");
12
+ }
13
+
14
+ /**
15
+ * Return the list of stores that can be selected to be configured (i.e. haven't
16
+ * been configured already), organised by website name and group name.
17
+ *
18
+ * @return array
19
+ */
20
+ protected function getStoreSelectData() {
21
+ $stores = Mage::app()->getStores(false);
22
+ $config = Mage::helper("klevu_search/config");
23
+
24
+ $data = array();
25
+
26
+ foreach ($stores as $store) {
27
+ /** @var Mage_Core_Model_Store $store */
28
+ if ($config->getJsApiKey($store) && $config->getRestApiKey($store)) {
29
+ // Skip already configured stores
30
+ continue;
31
+ }
32
+
33
+ $website = $store->getWebsite()->getName();
34
+ $group = $store->getGroup()->getName();
35
+
36
+ if (!isset($data[$website])) {
37
+ $data[$website] = array();
38
+ }
39
+ if (!isset($data[$website][$group])) {
40
+ $data[$website][$group] = array();
41
+ }
42
+
43
+ $data[$website][$group][] = $store;
44
+ }
45
+
46
+ return $data;
47
+ }
48
+
49
+ /**
50
+ * Return the list of stores that can be selected to be configured (i.e. haven't
51
+ * been configured already), organised by website name and group name.
52
+ *
53
+ * @return array
54
+ */
55
+ protected function getCmsMappingsHtml() {
56
+ $element = new Varien_Data_Form_Element_Text(array(
57
+ "name" => "excludedpages",
58
+ "label" => $this->__("Exclude CMS pages from search"),
59
+ "tooltip" => "",
60
+ "hint" => "",
61
+ "value" => Mage::helper("content")->getCmsPageMap($this->getStore()),
62
+ "inherit" => false,
63
+ "class" => "",
64
+ "can_use_default_value" => false,
65
+ "can_use_website_value" => false
66
+ ));
67
+ $element->setForm(new Varien_Data_Form());
68
+
69
+ /** @var Klevu_Search_Block_Adminhtml_Form_Field_Attribute_Mappings $renderer */
70
+ $renderer = Mage::getBlockSingleton("content/adminhtml_form_cmspages");
71
+ $renderer->setTemplate("klevu/search/wizard/form/field/array.phtml");
72
+
73
+ return $renderer->render($element);
74
+ }
75
+ }
app/code/community/Klevu/Content/Block/Index.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Klevu_Content_Block_Index extends Mage_Core_Block_Template
3
+ {
4
+ /**
5
+ * Get the Klevu other content
6
+ * @return array
7
+ */
8
+ public function getCmsContent()
9
+ {
10
+ $collection = Mage::helper("content")->getCmsData();
11
+ return $collection;
12
+ }
13
+ /**
14
+ * Return the Klevu other content filters
15
+ * @return array
16
+ */
17
+ public function getContentFilters()
18
+
19
+ {
20
+ $filters = Mage::helper("content")->getKlevuFilters();
21
+ return $filters;
22
+ }
23
+ }
app/code/community/Klevu/Content/Block/Tracking.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Klevu_Content_Block_Tracking extends Mage_Core_Block_Template
3
+ {
4
+ /**
5
+ * JSON of required tracking parameter for Klevu Product Click Tracking, based on current product
6
+ * @return string
7
+ * @throws Exception
8
+ */
9
+ public function getJsonTrackingData() {
10
+
11
+ $api_key = Mage::helper('klevu_search/config')->getJsApiKey();
12
+ // Get current Cms page object
13
+ $page = Mage::getSingleton('cms/page');
14
+ if ($page->getId()) {
15
+ $content = array(
16
+ 'klevu_apiKey' => $api_key,
17
+ 'klevu_term' => '',
18
+ 'klevu_type' => 'clicked',
19
+ 'klevu_productId' => $page->getPageId(),
20
+ 'klevu_productName' => $page->getTitle(),
21
+ 'klevu_productUrl' => $page->getIdentifier(),
22
+ 'Klevu_typeOfRecord' => 'KLEVU_CMS'
23
+ );
24
+ return json_encode($content);
25
+ }
26
+ }
27
+ }
app/code/community/Klevu/Content/Helper/Data.php ADDED
@@ -0,0 +1,262 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Klevu_Content_Helper_Data extends Mage_Core_Helper_Abstract
3
+ {
4
+ protected $_klevu_Content_parameters;
5
+ protected $_klevu_Content_response;
6
+ protected $_klevu_Cms_Data;
7
+
8
+ const XML_PATH_CMS_SYNC_ENABLED = "klevu_search/product_sync/enabledcms";
9
+ const XML_PATH_EXCLUDED_CMS_PAGES = "klevu_search/cmscontent/excludecms";
10
+ const XML_PATH_EXCLUDEDCMS_PAGES = "klevu_search/cmscontent/excludecms_pages";
11
+ const XML_PATH_CMS_ENABLED_ON_FRONT = "klevu_search/cmscontent/enabledcmsfront";
12
+ /**
13
+ * Return the Klevu api content filters
14
+ * @return array
15
+ */
16
+ public function getContentSearchFilters()
17
+ {
18
+ if (empty($this->_klevu_Content_parameters)) {
19
+ $q = Mage::app()->getRequest()->getParam('q');
20
+ $this->_klevu_Content_parameters = array(
21
+ 'ticket' => Mage::helper('klevu_search/config')->getJsApiKey() ,
22
+ 'noOfResults' => 1000,
23
+ 'term' => $q,
24
+ 'klevuSort' => 'rel',
25
+ 'paginationStartsFrom' => 0,
26
+ 'enableFilters' => 'true',
27
+ 'category' => 'KLEVU_CMS',
28
+ 'fl' => 'name,shortDesc,url',
29
+ 'klevuShowOutOfStockProducts' => 'true',
30
+ 'filterResults' => $this->_getPreparedFilters() ,
31
+ );
32
+ $this->log(Zend_Log::DEBUG, sprintf("Starting search for term: %s", $q));
33
+ }
34
+ return $this->_klevu_Content_parameters;
35
+ }
36
+ /**
37
+ * Send the API Request and return the API Response.
38
+ * @return Klevu_Search_Model_Api_Response
39
+ */
40
+ public function getKlevuResponse()
41
+ {
42
+ if (!$this->_klevu_Content_response) {
43
+ $this->_klevu_Content_response = Mage::getModel('klevu_search/api_action_idsearch')->execute($this->getContentSearchFilters());
44
+ }
45
+ return $this->_klevu_Content_response;
46
+ }
47
+
48
+ /**
49
+ * Return the Klevu api search filters
50
+ * @return array
51
+ */
52
+ public function getContentSearchTracking($noOfTrackingResults,$queryType) {
53
+ $q = Mage::app()->getRequest()->getParam('q');
54
+ $this->_klevu_tracking_parameters = array(
55
+ 'klevu_apiKey' => Mage::helper('klevu_search/config')->getJsApiKey(),
56
+ 'klevu_term' => $q,
57
+ 'klevu_totalResults' => $noOfTrackingResults,
58
+ 'klevu_shopperIP' => Mage::helper('klevu_search')->getIp(),
59
+ 'klevu_typeOfQuery' => $queryType,
60
+ 'Klevu_typeOfRecord' => 'KLEVU_CMS'
61
+ );
62
+ $this->log(Zend_Log::DEBUG, sprintf("Content Search tracking for term: %s", $q));
63
+ return $this->_klevu_tracking_parameters;
64
+ }
65
+
66
+ /**
67
+ * This method executes the the Klevu API request if it has not already been called, and takes the result
68
+ * with the result
69
+ * We then add all these values to our class variable $_klevu_Cms_Data.
70
+ *
71
+ * @return array
72
+ */
73
+ Public function getCmsData()
74
+ {
75
+ if (empty($this->_klevu_Cms_Data)) {
76
+ // If no results, return an empty array
77
+ if (!$this->getKlevuResponse()->hasData('result')) {
78
+ return array();
79
+ }
80
+ foreach($this->getKlevuResponse()->getData('result') as $key => $value) {
81
+ $value["name"] = $value['name'];
82
+ $value["url"] = $value["url"];
83
+ if (!empty($value['shortDesc'])) {
84
+ $value["shortDesc"] = $value['shortDesc'];
85
+ }
86
+ $cms_data[] = $value;
87
+ }
88
+ $this->_klevu_Cms_Data = $cms_data;
89
+
90
+ $response_meta = $this->getKlevuResponse()->getData('meta');
91
+ Mage::getModel('klevu_search/api_action_searchtermtracking')->execute($this->getContentSearchTracking(count($this->_klevu_Cms_Data),$response_meta['typeOfQuery']));
92
+ $this->log(Zend_Log::DEBUG, sprintf("Cms count returned: %s", count($this->_klevu_Cms_Data)));
93
+ }
94
+ return $this->_klevu_Cms_Data;
95
+ }
96
+ /**
97
+ * Print Log in Klevu log file.
98
+ *
99
+ * @param int $level ,string $message
100
+ *
101
+ */
102
+ protected function log($level, $message)
103
+ {
104
+ Mage::helper('klevu_search')->log($level, $message);
105
+ }
106
+ /**
107
+ * Get excluded cms page for store.
108
+ *
109
+ * @param Mage_Core_Model_Store|int $store
110
+ *
111
+ * @return strings
112
+ */
113
+ public function getExcludedCmsPages($store = null)
114
+ {
115
+ return Mage::getStoreConfig(static ::XML_PATH_EXCLUDED_CMS_PAGES, $store);
116
+ }
117
+
118
+ /**
119
+ * Get excluded cms page for store.
120
+ *
121
+ * @param Mage_Core_Model_Store|int $store
122
+ *
123
+ * @return strings
124
+ */
125
+ public function getExcludedPages($store = null)
126
+ {
127
+ $values = unserialize(Mage::getStoreConfig(static::XML_PATH_EXCLUDEDCMS_PAGES, $store));
128
+ if (is_array($values)) {
129
+ return $values;
130
+ }
131
+ return array();
132
+ }
133
+
134
+
135
+ /**
136
+ * Get value of cms synchronize for the given store.
137
+ *
138
+ * @param Mage_Core_Model_Store|int $store
139
+ *
140
+ * @return bool
141
+ */
142
+ public function getCmsSyncEnabledFlag($store = null)
143
+ {
144
+ return intval(Mage::getStoreConfig(static ::XML_PATH_CMS_SYNC_ENABLED, $store));
145
+ }
146
+ /**
147
+ * Check if Cms Sync is enabled for the given store.
148
+ *
149
+ * @param Mage_Core_Model_Store|int $store
150
+ *
151
+ * @return bool
152
+ */
153
+ public function isCmsSyncEnabled($store = null)
154
+ {
155
+ $flag = $this->getCmsSyncEnabledFlag($store);
156
+ return in_array($flag, array(
157
+ Klevu_Search_Model_System_Config_Source_Yesnoforced::YES,
158
+ ));
159
+ }
160
+ /**
161
+ * Get value of cms synchronize for the given store.
162
+ *
163
+ * @param Mage_Core_Model_Store|int $store
164
+ *
165
+ * @return bool
166
+ */
167
+ public function getCmsSyncEnabledOnFront($store = null)
168
+ {
169
+ return intval(Mage::getStoreConfig(static ::XML_PATH_CMS_ENABLED_ON_FRONT, $store));
170
+ }
171
+ /**
172
+ * Check if Cms is enabled on frontend for the given store.
173
+ *
174
+ * @param Mage_Core_Model_Store|int $store
175
+ *
176
+ * @return bool
177
+ */
178
+ public function isCmsSyncEnabledOnFront($store = null)
179
+ {
180
+ $flag = $this->getCmsSyncEnabledOnFront($store);
181
+ return in_array($flag, array(
182
+ Klevu_Search_Model_System_Config_Source_Yesnoforced::YES,
183
+ ));
184
+ }
185
+ /**
186
+ * Get the type filters for Content from Klevu .
187
+ *
188
+ * @return array
189
+ */
190
+ public function getKlevuFilters()
191
+ {
192
+ $attributes = array();
193
+ $filters = $this->getKlevuResponse()->getData('filters');
194
+ // If there are no filters, return empty array.
195
+ if (empty($filters)) {
196
+ return array();
197
+ }
198
+ foreach($filters as $filter) {
199
+ $key = (string)$filter['key'];
200
+ $attributes[$key] = array(
201
+ 'label' => (string)$filter['label']
202
+ );
203
+ $attributes[$key]['options'] = array();
204
+ if ($filter['options']) {
205
+ foreach($filter['options'] as $option) {
206
+ $attributes[$key]['options'][] = array(
207
+ 'label' => trim((string)$option['name']) ,
208
+ 'count' => trim((string)$option['count']) ,
209
+ 'selected' => trim((string)$option['selected'])
210
+ );
211
+ }
212
+ }
213
+ }
214
+ return $attributes;
215
+ }
216
+ /**
217
+ * Get the active filters, then prepare them for Klevu.
218
+ *
219
+ * @return string
220
+ */
221
+ protected function _getPreparedFilters()
222
+ {
223
+ $prepared_filters = array();
224
+ $filter_type = Mage::app()->getRequest()->getParam('cat');
225
+ if (!empty($filter_type)) {
226
+ switch ($filter_type) {
227
+ case "cat":
228
+ $prepared_filters['category'] = $filter_type;
229
+ break;
230
+
231
+ default:
232
+ $prepared_filters['category'] = $filter_type;
233
+ break;
234
+ }
235
+ $this->log(Zend_Log::DEBUG, sprintf('Active For Category Filters: %s', var_export($prepared_filters, true)));
236
+ return implode(';;', array_map(function ($v, $k)
237
+ {
238
+ return sprintf('%s:%s', $k, $v);
239
+ }
240
+ , $prepared_filters, array_keys($prepared_filters)));
241
+ }
242
+ }
243
+
244
+ /**
245
+ * Return the Cms pages.
246
+ *
247
+ * @param int|Mage_Core_Model_Store $store
248
+ *
249
+ * @return array
250
+ */
251
+ public function getCmsPageMap($store = null) {
252
+ $cmsmap = unserialize(Mage::getStoreConfig(static::XML_PATH_EXCLUDEDCMS_PAGES, $store));
253
+ return (is_array($cmsmap)) ? $cmsmap : array();
254
+ }
255
+
256
+ public function setCmsPageMap($map, $store = null) {
257
+ unset($map["__empty"]);
258
+ Mage::helper("klevu_search/config")->setStoreConfig(static::XML_PATH_EXCLUDEDCMS_PAGES, serialize($map), $store);
259
+ return $this;
260
+ }
261
+
262
+ }
app/code/community/Klevu/Content/Model/Content.php ADDED
@@ -0,0 +1,433 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Klevu_Content_Model_Content extends Klevu_Search_Model_Product_Sync
3
+ {
4
+ public function _construct() {
5
+ parent::_construct();
6
+
7
+ $this->addData(array(
8
+ "connection" => Mage::getModel("core/resource")->getConnection("core_write")
9
+ ));
10
+ }
11
+
12
+ public function getJobCode() {
13
+ return "klevu_search_content_sync";
14
+ }
15
+
16
+ /**
17
+ * Perform Content Sync on any configured stores, adding new content, updating modified and
18
+ * deleting removed content since last sync.
19
+ */
20
+ public function run()
21
+ {
22
+
23
+ // Sync Data only for selected store from config wizard
24
+ $session = Mage::getSingleton('klevu_search/session');
25
+ $firstSync = $session->getFirstSync();
26
+ if(!empty($firstSync)){
27
+ $onestore = Mage::app()->getStore($firstSync);
28
+ $this->reset();
29
+ if (!Mage::helper("content")->isCmsSyncEnabled($onestore->getId())) {
30
+ return;
31
+ }
32
+ if (!$this->setupSession($onestore)) {
33
+ return;
34
+ }
35
+ $this->syncCmsData($onestore);
36
+ return;
37
+ }
38
+
39
+ if ($this->isRunning(2)) {
40
+ // Stop if another copy is already running
41
+ $this->log(Zend_Log::INFO, "Stopping because another copy is already running.");
42
+ return;
43
+ }
44
+
45
+ // Sync all store cms Data
46
+ $stores = Mage::app()->getStores();
47
+ foreach($stores as $store) {
48
+ /** @var Mage_Core_Model_Store $store */
49
+ $this->reset();
50
+ if (!Mage::helper("content")->isCmsSyncEnabled($store->getId())) {
51
+ continue;
52
+ }
53
+ if (!$this->setupSession($store)) {
54
+ continue;
55
+ }
56
+ $this->syncCmsData($store);
57
+ }
58
+
59
+ }
60
+
61
+ public function syncCmsData($store){
62
+
63
+ if ($this->rescheduleIfOutOfMemory()) {
64
+ return;
65
+ }
66
+
67
+ $cPgaes = Mage::helper("content")->getExcludedPages($store);
68
+ if(count($cPgaes) > 0) {
69
+ foreach($cPgaes as $key => $cvalue){
70
+ $pageids[] = intval($cvalue['cmspages']);
71
+ }
72
+ } else {
73
+ $pageids = "";
74
+ }
75
+
76
+ if(!empty($pageids)){
77
+ $eids = implode("','",$pageids);
78
+ } else {
79
+ $eids = $pageids;
80
+ }
81
+
82
+ $this->log(Zend_Log::INFO, sprintf("Starting Cms sync for %s (%s).", $store->getWebsite()->getName() , $store->getName()));
83
+ $actions = array(
84
+ 'delete' => $this->getConnection()
85
+ ->select()
86
+ /*
87
+ * Select synced cms in the current store/mode that
88
+ * are no longer enabled
89
+ */
90
+ ->from(
91
+ array('k' => $this->getTableName("klevu_search/product_sync")),
92
+ array('page_id' => "k.product_id")
93
+
94
+ )
95
+ ->joinLeft(
96
+ array('c' => $this->getTableName("cms_page")),
97
+ "k.product_id = c.page_id",
98
+ ""
99
+ )
100
+ ->joinLeft(
101
+ array('v' => $this->getTableName("cms_page_store")),
102
+ "v.page_id = c.page_id",
103
+ ""
104
+ )
105
+ ->where("((k.store_id = :store_id AND v.store_id != 0) AND (k.type = :type) AND (k.product_id NOT IN ?)) OR ( (k.product_id IN ('".$eids."') OR (c.page_id IS NULL) OR (c.is_active = 0)) AND (k.type = :type) AND k.store_id = :store_id)",
106
+ $this->getConnection()
107
+ ->select()
108
+ ->from(
109
+ array('i' => $this->getTableName("cms_page_store")),
110
+ array('page_id' => "i.page_id")
111
+ )
112
+ ->where('i.page_id NOT IN (?)', $pageids)
113
+ // ->where("i.store_id = :store_id")
114
+ )
115
+ ->group(array('k.product_id'))
116
+ ->bind(array(
117
+ 'store_id'=> $store->getId(),
118
+ 'type' => "pages",
119
+ )),
120
+
121
+ 'update' =>
122
+ $this->getConnection()
123
+ ->select()
124
+ /*
125
+ * Select pages for the current store/mode
126
+ * have been updated since last sync.
127
+ */
128
+ ->from(
129
+ array('k' => $this->getTableName("klevu_search/product_sync")),
130
+ array('page_id' => "k.product_id")
131
+
132
+ )
133
+ ->join(
134
+ array('c' => $this->getTableName("cms_page")),
135
+ "c.page_id = k.product_id",
136
+ ""
137
+ )
138
+ ->joinLeft(
139
+ array('v' => $this->getTableName("cms_page_store")),
140
+ "v.page_id = c.page_id AND v.store_id = :store_id",
141
+ ""
142
+ )
143
+ ->where("(c.is_active = 1) AND (k.type = :type) AND (k.store_id = :store_id) AND (c.update_time > k.last_synced_at)")
144
+ ->where('c.page_id NOT IN (?)', $pageids)
145
+ ->bind(array(
146
+ 'store_id' => $store->getId(),
147
+ 'type'=> "pages",
148
+ )),
149
+
150
+ 'add' => $this->getConnection()
151
+ ->select()
152
+ ->union(array(
153
+ $this->getConnection()
154
+ ->select()
155
+ /*
156
+ * Select pages for the current store/mode
157
+ * have been updated since last sync.
158
+ */
159
+ ->from(
160
+ array('p' => $this->getTableName("cms_page")),
161
+ array('page_id' => "p.page_id")
162
+ )
163
+ ->where('p.page_id NOT IN (?)', $pageids)
164
+ ->joinLeft(
165
+ array('v' => $this->getTableName("cms_page_store")),
166
+ "p.page_id = v.page_id",
167
+ ""
168
+ )
169
+ ->joinLeft(
170
+ array('k' => $this->getTableName("klevu_search/product_sync")),
171
+ "p.page_id = k.product_id AND k.store_id = :store_id AND k.test_mode = :test_mode AND k.type = :type",
172
+ ""
173
+ )
174
+ ->where("p.is_active = 1 AND k.product_id IS NULL AND v.store_id =0"),
175
+ $this->getConnection()
176
+ ->select()
177
+ /*
178
+ * Select pages for the current store/mode
179
+ * have been updated since last sync.
180
+ */
181
+ ->from(
182
+ array('p' => $this->getTableName("cms_page")),
183
+ array('page_id' => "p.page_id")
184
+ )
185
+ ->where('p.page_id NOT IN (?)', $pageids)
186
+ ->join(
187
+ array('v' => $this->getTableName("cms_page_store")),
188
+ "p.page_id = v.page_id AND v.store_id = :store_id",
189
+ ""
190
+ )
191
+ ->joinLeft(
192
+ array('k' => $this->getTableName("klevu_search/product_sync")),
193
+ "v.page_id = k.product_id AND k.store_id = :store_id AND k.test_mode = :test_mode AND k.type = :type",
194
+ ""
195
+ )
196
+ ->where("p.is_active = 1 AND k.product_id IS NULL")
197
+ ))
198
+ ->bind(array(
199
+ 'type' => "pages",
200
+ 'store_id' => $store->getId(),
201
+ 'test_mode' => $this->isTestModeEnabled(),
202
+ )),
203
+ );
204
+ $errors = 0;
205
+ foreach($actions as $action => $statement) {
206
+ if ($this->rescheduleIfOutOfMemory()) {
207
+ return;
208
+ }
209
+ $method = $action . "cms";
210
+ $cms_pages = $this->getConnection()->fetchAll($statement, $statement->getBind());
211
+ $total = count($cms_pages);
212
+ $this->log(Zend_Log::INFO, sprintf("Found %d Cms Pages to %s.", $total, $action));
213
+ $pages = ceil($total / static ::RECORDS_PER_PAGE);
214
+ for ($page = 1; $page <= $pages; $page++) {
215
+ if ($this->rescheduleIfOutOfMemory()) {
216
+ return;
217
+ }
218
+ $offset = ($page - 1) * static ::RECORDS_PER_PAGE;
219
+ $result = $this->$method(array_slice($cms_pages, $offset, static ::RECORDS_PER_PAGE));
220
+ if ($result !== true) {
221
+ $errors++;
222
+ $this->log(Zend_Log::ERR, sprintf("Errors occurred while attempting to %s cms pages %d - %d: %s", $action, $offset + 1, ($offset + static ::RECORDS_PER_PAGE <= $total) ? $offset + static ::RECORDS_PER_PAGE : $total, $result));
223
+ }
224
+ }
225
+ }
226
+ $this->log(Zend_Log::INFO, sprintf("Finished cms page sync for %s (%s).", $store->getWebsite()->getName() , $store->getName()));
227
+ }
228
+ /**
229
+ * Delete the given pages from Klevu Search. Returns true if the operation was
230
+ * successful, or the error message if the operation failed.
231
+ *
232
+ * @param array $data List of pages to delete. Each element should be an array
233
+ * containing an element with "page_id" as the key and page id as
234
+ * the value.
235
+ *
236
+ * @return bool|string
237
+ */
238
+ protected function deletecms(array $data)
239
+ {
240
+ $total = count($data);
241
+ $response = Mage::getModel('klevu_search/api_action_deleterecords')->setStore($this->getStore())->execute(array(
242
+ 'sessionId' => $this->getSessionId() ,
243
+ 'records' => array_map(function ($v)
244
+ {
245
+ return array(
246
+ 'id' => "pageid_" . $v['page_id']
247
+ );
248
+ }
249
+ , $data)
250
+ ));
251
+ if ($response->isSuccessful()) {
252
+ $connection = $this->getConnection();
253
+ $select = $connection->select()->from(array(
254
+ 'k' => $this->getTableName("klevu_search/product_sync")
255
+ ))->where("k.store_id = ?", $this->getStore()->getId())->where("k.type = ?", "pages")->where("k.test_mode = ?", $this->isTestModeEnabled());
256
+ $skipped_record_ids = array();
257
+ if ($skipped_records = $response->getSkippedRecords()) {
258
+ $skipped_record_ids = array_flip($skipped_records["index"]);
259
+ }
260
+ $or_where = array();
261
+ for ($i = 0; $i < count($data); $i++) {
262
+ if (isset($skipped_record_ids[$i])) {
263
+ continue;
264
+ }
265
+ $or_where[] = sprintf("(%s)", $connection->quoteInto("k.product_id = ?", $data[$i]['page_id']));
266
+ }
267
+ $select->where(implode(" OR ", $or_where));
268
+ $connection->query($select->deleteFromSelect("k"));
269
+ $skipped_count = count($skipped_record_ids);
270
+ if ($skipped_count > 0) {
271
+ return sprintf("%d cms%s failed (%s)", $skipped_count, ($skipped_count > 1) ? "s" : "", implode(", ", $skipped_records["messages"]));
272
+ }
273
+ else {
274
+ return true;
275
+ }
276
+ }
277
+ else {
278
+ return sprintf("%d cms%s failed (%s)", $total, ($total > 1) ? "s" : "", $response->getMessage());
279
+ }
280
+ }
281
+ /**
282
+ * Add the given pages to Klevu Search. Returns true if the operation was successful,
283
+ * or the error message if it failed.
284
+ *
285
+ * @param array $data List of pages to add. Each element should be an array
286
+ * containing an element with "page_id" as the key and page id as
287
+ * the value.
288
+ *
289
+ * @return bool|string
290
+ */
291
+ protected function addCms(array $data)
292
+ {
293
+ $total = count($data);
294
+ $data = $this->addCmsData($data);
295
+ $response = Mage::getModel('klevu_search/api_action_addrecords')->setStore($this->getStore())->execute(array(
296
+ 'sessionId' => $this->getSessionId() ,
297
+ 'records' => $data
298
+ ));
299
+ if ($response->isSuccessful()) {
300
+ $skipped_record_ids = array();
301
+ if ($skipped_records = $response->getSkippedRecords()) {
302
+ $skipped_record_ids = array_flip($skipped_records["index"]);
303
+ }
304
+ $sync_time = Mage::helper("klevu_search/compat")->now();
305
+ foreach($data as $i => & $record) {
306
+ if (isset($skipped_record_ids[$i])) {
307
+ unset($data[$i]);
308
+ continue;
309
+ }
310
+ $ids[$i] = explode("_", $data[$i]['id']);
311
+ $record = array(
312
+ $ids[$i][1],
313
+ 0,
314
+ $this->getStore()->getId() ,
315
+ $this->isTestModeEnabled() ,
316
+ $sync_time,
317
+ "pages"
318
+ );
319
+ }
320
+ $this->getConnection()->insertArray($this->getTableName('klevu_search/product_sync') , array(
321
+ "product_id",
322
+ "parent_id",
323
+ "store_id",
324
+ "test_mode",
325
+ "last_synced_at",
326
+ "type"
327
+ ) , $data);
328
+ $skipped_count = count($skipped_record_ids);
329
+ if ($skipped_count > 0) {
330
+ return sprintf("%d cms%s failed (%s)", $skipped_count, ($skipped_count > 1) ? "s" : "", implode(", ", $skipped_records["messages"]));
331
+ }
332
+ else {
333
+ return true;
334
+ }
335
+ }
336
+ else {
337
+ return sprintf("%d cms%s failed (%s)", $total, ($total > 1) ? "s" : "", $response->getMessage());
338
+ }
339
+ }
340
+ /**
341
+ * Add the page Sync data to each page in the given list. Updates the given
342
+ * list directly to save memory.
343
+ *
344
+ * @param array $pages An array of pages. Each element should be an array with
345
+ * containing an element with "id" as the key and the Page
346
+ * ID as the value.
347
+ *
348
+ * @return $this
349
+ */
350
+ protected function addcmsData(&$pages)
351
+ {
352
+ $page_ids = array();
353
+ foreach($pages as $key => $value) {
354
+ $page_ids[] = $value["page_id"];
355
+ }
356
+ if ($this->getStore()->isFrontUrlSecure()) {
357
+ $base_url = $this->getStore()->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK, true);
358
+ }
359
+ else {
360
+ $base_url = $this->getStore()->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK);
361
+ }
362
+ $data = Mage::getModel('cms/page')->getCollection()->addFieldToSelect("*")->addFieldToFilter('page_id', array(
363
+ 'in' => $page_ids
364
+ ));
365
+ $cms_data = $data->load()->getData();
366
+ foreach($cms_data as $key => $value) {
367
+ $value["name"] = $value["title"];
368
+ $value["desc"] = $value["content"];
369
+ $value["id"] = "pageid_" . $value["page_id"];
370
+ $value["url"] = $base_url . $value["identifier"];
371
+ $value["desc"] = strip_tags($value["content"]);
372
+ $value["metaDesc"] = $value["meta_description"] . $value["meta_keywords"];
373
+ $value["shortDesc"] = substr(strip_tags($value["content"]) , 0, 200);
374
+ $value["listCategory"] = "KLEVU_CMS";
375
+ $value["category"] = "pages";
376
+ $value["salePrice"] = 0;
377
+ $value["currency"] = "USD";
378
+ $value["inStock"] = "yes";
379
+ $cms_data_new[] = $value;
380
+ }
381
+ return $cms_data_new;
382
+ }
383
+ /**
384
+ * Update the given pages on Klevu Search. Returns true if the operation was successful,
385
+ * or the error message if it failed.
386
+ *
387
+ * @param array $data List of Pages to update. Each element should be an array
388
+ * containing an element with "page_id" as the key and page id as
389
+ * the value
390
+ *
391
+ * @return bool|string
392
+ */
393
+ protected function updateCms(array $data)
394
+ {
395
+ $total = count($data);
396
+ $data = $this->addCmsData($data);
397
+ $response = Mage::getModel('klevu_search/api_action_updaterecords')->setStore($this->getStore())->execute(array(
398
+ 'sessionId' => $this->getSessionId() ,
399
+ 'records' => $data
400
+ ));
401
+ if ($response->isSuccessful()) {
402
+ $helper = Mage::helper('klevu_search');
403
+ $connection = $this->getConnection();
404
+ $skipped_record_ids = array();
405
+ if ($skipped_records = $response->getSkippedRecords()) {
406
+ $skipped_record_ids = array_flip($skipped_records["index"]);
407
+ }
408
+ $where = array();
409
+ for ($i = 0; $i < count($data); $i++) {
410
+ if (isset($skipped_record_ids[$i])) {
411
+ continue;
412
+ }
413
+ $ids[$i] = explode("_", $data[$i]['id']);
414
+ $where[] = sprintf("(%s AND %s AND %s)", $connection->quoteInto("product_id = ?", $ids[$i][1]) , $connection->quoteInto("parent_id = ?", 0) , $connection->quoteInto("type = ?", "pages"));
415
+ }
416
+ $where = sprintf("(%s) AND (%s) AND (%s)", $connection->quoteInto("store_id = ?", $this->getStore()->getId()) , $connection->quoteInto("test_mode = ?", $this->isTestModeEnabled()) , implode(" OR ", $where));
417
+ $this->getConnection()->update($this->getTableName('klevu_search/product_sync') , array(
418
+ 'last_synced_at' => Mage::helper("klevu_search/compat")->now()
419
+ ) , $where);
420
+ $skipped_count = count($skipped_record_ids);
421
+ if ($skipped_count > 0) {
422
+ return sprintf("%d cms%s failed (%s)", $skipped_count, ($skipped_count > 1) ? "s" : "", implode(", ", $skipped_records["messages"]));
423
+ }
424
+ else {
425
+ return true;
426
+ }
427
+ }
428
+ else {
429
+ return sprintf("%d cms%s failed (%s)", $total, ($total > 1) ? "s" : "", $response->getMessage());
430
+ }
431
+ }
432
+
433
+ }
app/code/community/Klevu/Content/Model/Observer.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Klevu_Content_Model_Observer extends Varien_Object
3
+ {
4
+ /* Re-syn all content and schedule cron for store */
5
+ public function syncAllContent(Varien_Event_Observer $observer) {
6
+ $store = $observer->getStore();
7
+ if(!empty($store)) {
8
+ if (Mage::helper("content")->isCmsSyncEnabled($store->getId())) {
9
+ Mage::getModel('content/content')->schedule();
10
+ } else {
11
+ Mage::getSingleton('adminhtml/session')->addError(sprintf("Klevu Search Content Sync is disabled for %s (%s).", $store->getWebsite()->getName() , $store->getName()));
12
+ }
13
+ } else {
14
+ $stores = Mage::app()->getStores();
15
+ foreach($stores as $store) {
16
+ if (!Mage::helper("content")->isCmsSyncEnabled($store->getId())) {
17
+ Mage::getSingleton('adminhtml/session')->addError(sprintf("Klevu Search Content Sync is disabled for %s (%s).", $store->getWebsite()->getName() , $store->getName()));
18
+ continue;
19
+ } else {
20
+ Mage::getModel('content/content')->schedule();
21
+ }
22
+ }
23
+
24
+ }
25
+ }
26
+
27
+
28
+ /**
29
+ * Run Other content based on event call.
30
+ *
31
+ * @param Varien_Event_Observer $observer
32
+ */
33
+ public function syncOtherContent(Varien_Event_Observer $observer) {
34
+ Mage::getModel("content/content")->run();
35
+ }
36
+
37
+ /**
38
+ * Run Other content based on event call.
39
+ *
40
+ * @param Varien_Event_Observer $observer
41
+ */
42
+ public function scheduleOtherContent(Varien_Event_Observer $observer) {
43
+ Mage::getModel("content/content")->schedule();
44
+ }
45
+
46
+ /**
47
+ * Save excluded cms pages for store.
48
+ *
49
+ * @param Varien_Event_Observer $observer
50
+ */
51
+ public function saveExcludedCmsPages(Varien_Event_Observer $observer) {
52
+ Mage::helper("content")->setCmsPageMap($observer->getExcludedPages(),$observer->getStore());
53
+ }
54
+
55
+ }
app/code/community/Klevu/Content/Test/Controller/ContentSearch.php ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Klevu_Content_Test_Controller_ContentSearch extends EcomDev_PHPUnit_Test_Case_Controller {
4
+
5
+ /**
6
+ * Run search and make sure the page returns HTTP Code 200
7
+ * @test
8
+ * @loadFixture content_search_results
9
+ */
10
+ public function testSearchResultsPageLoads() {
11
+ $this->mockAndDispatchSearchResults();
12
+ // Assert the request was successful.
13
+ $this->assertResponseHttpCode(200);
14
+ }
15
+
16
+ /**
17
+ * @param string $query
18
+ * @return $this
19
+ * @throws Zend_Controller_Exception
20
+ */
21
+ protected function mockAndDispatchSearchResults($query = 'example', $response_type = 'successful', $pagination = 0) {
22
+ $this->mockApiAndCollection($query, $response_type, $pagination);
23
+ // Set the search query
24
+ $this->app()->getRequest()->setQuery('q', $query);
25
+ // Load the search results page
26
+ return $this->dispatch('content/index/index');
27
+ }
28
+
29
+
30
+ protected function mockApiAndCollection($query = 'example', $response_type = 'successful', $pagination = 0) {
31
+ // Mock the API Action
32
+ switch($response_type) {
33
+ default:
34
+ case 'successful':
35
+ $response = $this->getSearchResponse('search_response_success.xml');
36
+ break;
37
+ case 'empty':
38
+ echo "new";
39
+ exit;
40
+ $response = $this->getSearchResponse('search_response_empty.xml');
41
+ break;
42
+ }
43
+
44
+ $this->replaceApiActionByMock("klevu_search/api_action_idsearch", $response);
45
+
46
+ }
47
+
48
+
49
+ /**
50
+ * Return a klevu_search/api_response_message model with a successful response from
51
+ * a startSession API call.
52
+ *
53
+ * @return Klevu_Search_Model_Api_Response_Message
54
+ */
55
+ protected function getSearchResponse($data_file) {
56
+ $model = Mage::getModel('klevu_search/api_response_search')->setRawResponse(
57
+ new Zend_Http_Response(200, array(), $this->getDataFileContents($data_file))
58
+ );
59
+
60
+ return $model;
61
+
62
+ }
63
+
64
+ protected function getDataFileContents($file) {
65
+ $directory_tree = array(
66
+ Mage::getModuleDir('', 'Klevu_Content'),
67
+ 'Test',
68
+ 'Model',
69
+ 'Api',
70
+ 'data',
71
+ $file
72
+ );
73
+
74
+ $file_path = join(DS, $directory_tree);
75
+
76
+ return file_get_contents($file_path);
77
+ }
78
+
79
+
80
+ /**
81
+ * Create a mock class of the given API action model which will expect to be executed
82
+ * once and will return the given response. Then replace that model in Magento with
83
+ * the created mock.
84
+ *
85
+ * @param string $alias A grouped class name of the API action model to mock
86
+ * @param Klevu_Search_Model_Api_Response $response
87
+ *
88
+ * @return $this
89
+ */
90
+ protected function replaceApiActionByMock($alias, $response) {
91
+ $mock = $this->getModelMock($alias, array("execute"));
92
+ $mock
93
+ ->expects($this->any())
94
+ ->method("execute")
95
+ ->will($this->returnValue($response));
96
+
97
+ $this->replaceByMock("model", $alias, $mock);
98
+ return $this;
99
+ }
100
+
101
+ }
app/code/community/Klevu/Content/Test/Controller/ContentSearch/fixtures/content_search_results.yaml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ config:
2
+ default/klevu_search/general/rest_api_key: a2xldnUtMTQzNTczMzMwNDcwMjE3Mzk6S2xldnUtOHJqczNocnViYQ==
3
+ default/klevu_search/general/js_api_key: klevu-14357333047021739
4
+ default/klevu_search/product_sync/enabledcms: 1
5
+
6
+ tables:
7
+ cms_page:
8
+ - page_id: 1
9
+ title: test
10
+ identifier: test
11
+ content: test test women
12
+ is_active:1
13
+ - page_id: 2
14
+ title: test
15
+ identifier: test
16
+ content: test test women
17
+ is_active:1
18
+
app/code/community/Klevu/Content/Test/Helper/Data.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Klevu_Content_Test_Helper_Data extends EcomDev_PHPUnit_Test_Case {
4
+
5
+ /** @var Klevu_Content_Helper_Data $helper */
6
+ protected $helper;
7
+
8
+ protected function setUp() {
9
+ parent::setUp();
10
+ $this->helper = Mage::helper("content");
11
+ $this->getConfig()->deleteConfig("klevu_search/product_sync/enabledcms");
12
+ }
13
+
14
+ protected function getConfig() {
15
+ return Mage::app()->getConfig();
16
+ }
17
+
18
+
19
+ /**
20
+ * @test
21
+ * @loadFixture
22
+ */
23
+ public function testIsCmsEnabledEnabled() {
24
+ $this->assertEquals(true, $this->helper->isCmsSyncEnabled());
25
+ }
26
+
27
+ /**
28
+ * @test
29
+ * @loadFixture
30
+ */
31
+ public function testIsCmsEnabledDisabled() {
32
+ $this->assertEquals(false, $this->helper->isCmsSyncEnabled());
33
+ }
34
+
35
+ /**
36
+ * @test
37
+ * @dataProvider dataProvider
38
+ */
39
+ public function testIsCmsSyncEnabled($input, $output) {
40
+ $this->assertEquals($output, $this->helper->isCmsSyncEnabled($input));
41
+ }
42
+
43
+ /**
44
+ * @test
45
+ * @dataProvider dataProvider
46
+ */
47
+ /*public function testGetExcludedCmsPages($input,$storeId)
48
+ {
49
+ $this->assertEquals($input,$this->helper->getExcludedCmsPages($this->getStore($storeId)));
50
+ }*/
51
+
52
+ }
app/code/community/Klevu/Content/Test/Helper/Data/fixtures/content_search_results.yaml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ config:
2
+ default/klevu_search/general/rest_api_key: a2xldnUtMTQzNTczMzMwNDcwMjE3Mzk6S2xldnUtOHJqczNocnViYQ==
3
+ default/klevu_search/general/js_api_key: klevu-14357333047021739
4
+ default/klevu_search/product_sync/enabledcms: 1
5
+
6
+ tables:
7
+ cms_page:
8
+ - page_id: 1
9
+ title: privacy
10
+ identifier: privacy
11
+ content: privacy privacy women
12
+ is_active:1
13
+ - page_id: 2
14
+ title: test
15
+ identifier: test
16
+ content: test test women
17
+ is_active:1
18
+
app/code/community/Klevu/Content/Test/Helper/Data/fixtures/testIsCmsEnabledDisabled.yaml ADDED
@@ -0,0 +1,2 @@
 
 
1
+ config:
2
+ default/klevu_search/product_sync/enabledcms: 0
app/code/community/Klevu/Content/Test/Helper/Data/fixtures/testIsCmsEnabledEnabled.yaml ADDED
@@ -0,0 +1,2 @@
 
 
1
+ config:
2
+ default/klevu_search/product_sync/enabledcms:1
app/code/community/Klevu/Content/Test/Helper/Data/providers/testGetExcludedCmsPages.yaml ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ -
2
+ input: 2,3
3
+ storeId: 1
4
+
5
+
app/code/community/Klevu/Content/Test/Helper/Data/providers/testIsCmsSyncEnabled.yaml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ -
2
+ input: 1
3
+ output: 1
4
+
5
+ -
6
+ input: 4
7
+ output: 1
8
+
app/code/community/Klevu/Content/Test/Model/Api/data/message_response_content_success.xml ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <message>
2
+ <status>SUCCESS</status>
3
+ <msg>Successful test status</msg>
4
+ </message>
app/code/community/Klevu/Content/Test/Model/Api/data/search_response_empty.xml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <data>
3
+ <meta>
4
+ <totalResultsFound>0</totalResultsFound>
5
+ <typeOfQuery>FUZZY_OR</typeOfQuery>
6
+ <paginationStartFrom>0</paginationStartFrom>
7
+ <noOfResults>1000</noOfResults>
8
+ </meta>
9
+ <filters />
10
+ </data>
app/code/community/Klevu/Content/Test/Model/Api/data/search_response_success.xml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <data>
3
+ <result>
4
+ <id>pageid_6</id>
5
+ <name>Privacy Policy</name>
6
+ <shortDesc>Please replace this text with you Privacy Policy. Please add any additional cookies your website uses below (e.g., Google Analytics) This privacy policy sets out how {{config path="general/store_info</shortDesc>
7
+ <url>http://127.0.0.1/klevu_primium/index.php/privacy-policy-cookie-restriction-mode</url>
8
+ </result>
9
+ <meta>
10
+ <totalResultsFound>1</totalResultsFound>
11
+ <typeOfQuery>WILDCARD_AND</typeOfQuery>
12
+ <paginationStartFrom>0</paginationStartFrom>
13
+ <noOfResults>1000</noOfResults>
14
+ </meta>
15
+ <filters>
16
+ <filter type="other" label="CATEGORY" key="category">
17
+ <option name="Pages " value="category:pages" count="1" selected="false" />
18
+ </filter>
19
+ <filter type="other" label="PRICE RANGE" key="Price Range">
20
+ <option name="0 - 49" value="klevu_price:0 - 49" count="1" selected="false" />
21
+ </filter>
22
+ </filters>
23
+ </data>
app/code/community/Klevu/Content/Test/Model/Api/data/startsession_response_content_success.xml ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2
+ <message>
3
+ <status>SUCCESS</status>
4
+ <sessionId>Klevu_4090-klevu-14357333047021739</sessionId>
5
+ </message>
app/code/community/Klevu/Content/Test/Model/Content.php ADDED
@@ -0,0 +1,175 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Klevu_Content_Test_Model_Content extends Klevu_Search_Test_Model_Api_Test_Case {
4
+
5
+ protected function tearDown() {
6
+ $resource = Mage::getModel('core/resource');
7
+ $resource->getConnection("core_write")->delete($resource->getTableName("klevu_search/product_sync"));
8
+ parent::tearDown();
9
+ }
10
+
11
+ /**
12
+ * @test
13
+ * @loadFixture
14
+ */
15
+ public function testCmsRun() {
16
+ $this->replaceApiActionByMock("klevu_search/api_action_startsession", $this->getSuccessfulSessionResponse());
17
+ $model = $this->getModelMock("content/content", array(
18
+ "isBelowMemoryLimit", "deletecms", "updatecms", "addcms"
19
+ ));
20
+ $model
21
+ ->expects($this->any())
22
+ ->method("isBelowMemoryLimit")
23
+ ->will($this->returnValue(true));
24
+
25
+ $model
26
+ ->expects($this->once())
27
+ ->method("deletecms")
28
+ ->with(array(
29
+ array("product_id" => "1", "parent_id" => "0"),
30
+ ))
31
+ ->will($this->returnValue(true));
32
+ $model
33
+ ->expects($this->once())
34
+ ->method("updatecms")
35
+ ->with(array(
36
+ array("product_id" => "2", "parent_id" => "0"),
37
+
38
+ ))
39
+ ->will($this->returnValue(true));
40
+ $model
41
+ ->expects($this->once())
42
+ ->method("addcms")
43
+ ->with(array(
44
+ array("product_id" => "3", "parent_id" => "0"),
45
+ ))
46
+ ->will($this->returnValue(true));
47
+
48
+ Mage::getModel("content/content")->runCms();
49
+ }
50
+
51
+ /**
52
+ * @test
53
+ * @loadFixture
54
+ */
55
+ public function testDeleteCms() {
56
+
57
+ $this->replaceApiActionByMock("klevu_search/api_action_startsession", $this->getSuccessfulSessionResponse());
58
+ $this->replaceApiActionByMock("klevu_search/api_action_deleterecords", $this->getSuccessfulMessageResponse());
59
+
60
+ $content = $this->getProductSyncTableContents();
61
+
62
+ $this->assertEquals("1", $content[0]['product_id']);
63
+ }
64
+
65
+ /**
66
+ * @test
67
+ * @loadFixture
68
+ */
69
+ public function testUpdateCms() {
70
+
71
+ $this->replaceApiActionByMock("klevu_search/api_action_startsession", $this->getSuccessfulSessionResponse());
72
+ $this->replaceApiActionByMock("klevu_search/api_action_updaterecords", $this->getSuccessfulMessageResponse());
73
+
74
+ $this->replaceSessionByMock("core/session");
75
+ $this->replaceSessionByMock("customer/session");
76
+ $contents = $this->getProductSyncTableContentsForUpdate();
77
+ $this->assertEquals("2", $contents[0]['product_id']);
78
+ }
79
+
80
+ /**
81
+ * @test
82
+ * @loadFixture
83
+ */
84
+ public function testAddCms() {
85
+
86
+ $this->replaceApiActionByMock("klevu_search/api_action_startsession", $this->getSuccessfulSessionResponse());
87
+ $this->replaceApiActionByMock("klevu_search/api_action_addrecords", $this->getSuccessfulMessageResponse());
88
+
89
+ $this->replaceSessionByMock("core/session");
90
+ $this->replaceSessionByMock("customer/session");
91
+
92
+ $contents = $this->getProductSyncTableContents();
93
+
94
+ $this->assertEquals("4", $contents[0]['product_id']);
95
+ }
96
+
97
+ /**
98
+ * Return a klevu_search/api_response_message model with a successful response from
99
+ * a startSession API call.
100
+ *
101
+ * @return Klevu_Search_Model_Api_Response_Message
102
+ */
103
+ protected function getSuccessfulSessionResponse() {
104
+ $model = Mage::getModel('klevu_search/api_response_message')->setRawResponse(
105
+ new Zend_Http_Response(200, array(), $this->getDataFileContents("startsession_response_success.xml"))
106
+ );
107
+
108
+ return $model;
109
+ }
110
+
111
+ /**
112
+ * Return a klevu_search/api_response_message model with a successful response.
113
+ *
114
+ * @return Klevu_Search_Model_Api_Response_Message
115
+ */
116
+ protected function getSuccessfulMessageResponse() {
117
+ $model = Mage::getModel('klevu_search/api_response_message')->setRawResponse(
118
+ new Zend_Http_Response(200, array(), $this->getDataFileContents("message_response_success.xml"))
119
+ );
120
+
121
+ return $model;
122
+ }
123
+
124
+ /**
125
+ * Return the contents of the Product Sync table.
126
+ *
127
+ * @param string $where The where clause to use in the database query
128
+ *
129
+ * @return array
130
+ */
131
+ protected function getProductSyncTableContents($where = null) {
132
+ $resource = Mage::getModel('core/resource');
133
+ $connection = $resource->getConnection("core_write");
134
+ $select = $connection->select()->from($resource->getTableName('klevu_search/product_sync'))
135
+ ->where('type=?',"pages");
136
+ if ($where) {
137
+ $select->where($where);
138
+ }
139
+ return $connection->fetchAll($select);
140
+ }
141
+
142
+ /**
143
+ * Return the contents of the Product Sync table.
144
+ *
145
+ * @param string $where The where clause to use in the database query
146
+ *
147
+ * @return array
148
+ */
149
+ protected function getProductSyncTableContentsForUpdate($where = null) {
150
+ $resource = Mage::getModel('core/resource');
151
+ $connection = $resource->getConnection("core_write");
152
+ $select = $connection->select()->from($resource->getTableName('klevu_search/product_sync'));
153
+ //->where('type=?',"pages");
154
+ $where = 'last_synced_at > "2008-06-27 01:57:22" AND type="pages"';
155
+ if ($where) {
156
+ $select->where($where);
157
+ }
158
+ return $connection->fetchAll($select);
159
+ }
160
+
161
+ protected function getDataFileContents($file) {
162
+ $directory_tree = array(
163
+ Mage::getModuleDir('', 'Klevu_Search'),
164
+ 'Test',
165
+ 'Model',
166
+ 'Api',
167
+ 'data',
168
+ $file
169
+ );
170
+
171
+ $file_path = join(DS, $directory_tree);
172
+
173
+ return file_get_contents($file_path);
174
+ }
175
+ }
app/code/community/Klevu/Content/Test/Model/Content/fixtures/testAddCms.yaml ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ config:
2
+ default/klevu_search/general/enabled: 1
3
+ default/klevu_search/general/test_rest_api_key: a2xldnUtMTQyNTU1MTA4OTU2NDEwNjk6S2xldnUtZmo4NzQ3cHUxMg==
4
+ default/klevu_search/product_sync/enabled: 1
5
+ tables:
6
+ cms_page:
7
+ - page_id: 4
8
+ title: new content
9
+ identifier: new content
10
+ content: new content
11
+ is_active:1
12
+ type:pages
13
+ created_at: 2015-07-17 01:57:22
14
+ updated_at: 2015-07-17 01:57:22
15
+ tables:
16
+ klevu_search/product_sync:
17
+ -
18
+ product_id:4
19
+ parent_id: 0
20
+ store_id: 1
21
+ test_mode: 0
22
+ type:pages
23
+ last_synced_at: 0000-00-00 00:00:00
24
+
app/code/community/Klevu/Content/Test/Model/Content/fixtures/testClearAllProducts.yaml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ config:
2
+ default/klevu_search/general/enabled: 1
3
+ default/klevu_search/general/rest_api_key: a2xldnUtMTQyNTU1MTA4OTU2NDEwNjk6S2xldnUtZmo4NzQ3cHUxMg==
4
+ default/klevu_search/product_sync/enabled: 1
5
+ tables:
6
+ klevu_search/product_sync:
7
+ -
8
+ product_id: 1
9
+ parent_id: 0
10
+ store_id: 1
11
+ test_mode: 0
12
+ last_synced_at: 0
13
+ -
14
+ product_id: 2
15
+ parent_id: 0
16
+ store_id: 2
17
+ test_mode: 0
18
+ last_synced_at: 0
19
+
app/code/community/Klevu/Content/Test/Model/Content/fixtures/testCmsRun.yaml ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ config:
2
+ default/klevu_search/general/rest_api_key: a2xldnUtMTQzNTczMzMwNDcwMjE3Mzk6S2xldnUtOHJqczNocnViYQ==
3
+ default/klevu_search/general/js_api_key: klevu-14357333047021739
4
+ default/klevu_search/product_sync/enabledcms: 1
5
+
6
+ tables:
7
+ cms_page:
8
+ - page_id: 1
9
+ title: privacy
10
+ identifier: privacy
11
+ content: privacy privacy women
12
+ is_active:1
13
+ - page_id: 2
14
+ title: test
15
+ identifier: test
16
+ content: test test women
17
+ is_active:1
18
+ - page_id: 3
19
+ title: new content
20
+ identifier: new content
21
+ content: new content
22
+ is_active:1
23
+ type:pages
24
+ created_at: 2015-07-17 01:57:22
25
+ updated_at: 2015-07-17 01:57:22
26
+ tables:
27
+ klevu_search/product_sync:
28
+ -
29
+ product_id:1
30
+ parent_id: 0
31
+ store_id: 1
32
+ test_mode: 0
33
+ type:pages
34
+ last_synced_at: 2008-08-10 13:36:29
35
+ -
36
+ product_id:2
37
+ parent_id: 0
38
+ store_id: 1
39
+ test_mode: 0
40
+ type:pages
41
+ last_synced_at: 2008-06-27 01:57:22
42
+ -
43
+ product_id:3
44
+ parent_id: 0
45
+ store_id: 1
46
+ test_mode: 0
47
+ type:pages
48
+ last_synced_at: 2008-06-27 01:57:22
app/code/community/Klevu/Content/Test/Model/Content/fixtures/testDeleteCms.yaml ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ config:
2
+ default/klevu_search/general/enabled: 1
3
+ default/klevu_search/general/rest_api_key: a2xldnUtMTQyNTU1MTA4OTU2NDEwNjk6S2xldnUtZmo4NzQ3cHUxMg==
4
+ default/klevu_search/product_sync/enabled: 1
5
+ tables:
6
+ klevu_search/product_sync:
7
+ -
8
+ product_id:1
9
+ parent_id: 0
10
+ store_id: 1
11
+ test_mode: 0
12
+ type:pages
13
+ last_synced_at: 2008-08-10 13:36:29
14
+
app/code/community/Klevu/Content/Test/Model/Content/fixtures/testUpdateCms.yaml ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ config:
2
+ default/klevu_search/general/enabled: 1
3
+ default/klevu_search/general/rest_api_key: a2xldnUtMTQyNTU1MTA4OTU2NDEwNjk6S2xldnUtZmo4NzQ3cHUxMg==
4
+ default/klevu_search/product_sync/enabled: 1
5
+ tables:
6
+ cms_page:
7
+ - page_id: 2
8
+ title: privacy
9
+ identifier: privacy
10
+ content: privacy privacy women
11
+ is_active:1
12
+ created_at: 2015-03-13 01:57:22
13
+ updated_at: 2015-07-15 01:57:22
14
+
15
+ tables:
16
+ klevu_search/product_sync:
17
+ -
18
+ product_id:2
19
+ parent_id: 0
20
+ store_id: 1
21
+ test_mode: 0
22
+ type:pages
23
+ last_synced_at: 2009-06-27 01:57:22
24
+
25
+
app/code/community/Klevu/Content/controllers/SearchController.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Klevu_Content_SearchController extends Mage_Core_Controller_Front_Action
3
+ {
4
+ public function IndexAction()
5
+ {
6
+ $this->loadLayout();
7
+ $this->getLayout()->getBlock("head")->setTitle($this->__("Content Search"));
8
+ $breadcrumbs = $this->getLayout()->getBlock("breadcrumbs");
9
+ $breadcrumbs->addCrumb("home", array(
10
+ "label" => $this->__("Home") ,
11
+ "title" => $this->__("Home") ,
12
+ "link" => Mage::getBaseUrl()
13
+ ));
14
+ $breadcrumbs->addCrumb("titlename", array(
15
+ "label" => $this->__("Content Search") ,
16
+ "title" => $this->__("Content Search")
17
+ ));
18
+ $this->renderLayout();
19
+ }
20
+ }
app/code/community/Klevu/Content/etc/config.xml ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <modules>
4
+ <Klevu_Content>
5
+ <version>10.0.4</version>
6
+ </Klevu_Content>
7
+ </modules>
8
+ <frontend>
9
+ <routers>
10
+ <content>
11
+ <use>standard</use>
12
+ <args>
13
+ <module>Klevu_Content</module>
14
+ <frontName>content</frontName>
15
+ </args>
16
+ </content>
17
+ </routers>
18
+ <layout>
19
+ <updates>
20
+ <content>
21
+ <file>klevu/content.xml</file>
22
+ </content>
23
+ </updates>
24
+ </layout>
25
+ </frontend>
26
+ <global>
27
+ <helpers>
28
+ <content>
29
+ <class>Klevu_Content_Helper</class>
30
+ </content>
31
+ </helpers>
32
+ <blocks>
33
+ <content>
34
+ <class>Klevu_Content_Block</class>
35
+ </content>
36
+ </blocks>
37
+ <models>
38
+ <content>
39
+ <class>Klevu_Content_Model</class>
40
+ </content>
41
+ </models>
42
+ <resources>
43
+ <klevu_content_setup>
44
+ <setup>
45
+ <module>Klevu_Content</module>
46
+ </setup>
47
+ <connection>
48
+ <use>core_setup</use>
49
+ </connection>
50
+ </klevu_content_setup>
51
+ <content_write>
52
+ <connection>
53
+ <use>core_write</use>
54
+ </connection>
55
+ </content_write>
56
+ <content_read>
57
+ <connection>
58
+ <use>core_read</use>
59
+ </connection>
60
+ </content_read>
61
+ </resources>
62
+ <events>
63
+ <cms_page_prepare_save>
64
+ <observers>
65
+ <content_cms_page_prepare_save>
66
+ <type>singleton</type>
67
+ <class>content/observer</class>
68
+ <method>scheduleOtherContent</method>
69
+ </content_cms_page_prepare_save>
70
+ </observers>
71
+ </cms_page_prepare_save>
72
+ <adminhtml_cmspage_on_delete>
73
+ <observers>
74
+ <content_adminhtml_cmspage_on_delete>
75
+ <type>singleton</type>
76
+ <class>content/observer</class>
77
+ <method>scheduleOtherContent</method>
78
+ </content_adminhtml_cmspage_on_delete>
79
+ </observers>
80
+ </adminhtml_cmspage_on_delete>
81
+ <sync_all_external_data>
82
+ <observers>
83
+ <sync_all_content_data>
84
+ <type>singleton</type>
85
+ <class>content/observer</class>
86
+ <method>syncAllContent</method>
87
+ </sync_all_content_data>
88
+ </observers>
89
+ </sync_all_external_data>
90
+ <content_data_to_sync>
91
+ <observers>
92
+ <add_content_data_to_sync>
93
+ <type>singleton</type>
94
+ <class>content/observer</class>
95
+ <method>syncOtherContent</method>
96
+ </add_content_data_to_sync>
97
+ </observers>
98
+ </content_data_to_sync>
99
+ <excluded_cms_pages>
100
+ <observers>
101
+ <add_boosting_data_to_sync>
102
+ <type>singleton</type>
103
+ <class>content/observer</class>
104
+ <method>saveExcludedCmsPages</method>
105
+ </add_boosting_data_to_sync>
106
+ </observers>
107
+ </excluded_cms_pages>
108
+ </events>
109
+ </global>
110
+ <crontab>
111
+ <jobs>
112
+ <klevu_search_content_sync>
113
+ <schedule>
114
+ <config_path>klevu_search/product_sync/frequency</config_path>
115
+ </schedule>
116
+ <run>
117
+ <model>content/content::run</model>
118
+ </run>
119
+ </klevu_search_content_sync>
120
+ </jobs>
121
+ </crontab>
122
+ <default>
123
+ <klevu_search>
124
+ <product_sync>
125
+ <enabledcms>1</enabledcms>
126
+ </product_sync>
127
+ <cmscontent>
128
+ <enabledcmsfront>0</enabledcmsfront>
129
+ </cmscontent>
130
+ </klevu_search>
131
+ </default>
132
+ <phpunit>
133
+ <suite>
134
+ <modules>
135
+ <Klevu_Content />
136
+ </modules>
137
+ </suite>
138
+ </phpunit>
139
+ </config>
app/code/community/Klevu/Content/etc/system.xml ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <sections>
4
+ <klevu_search translate="label" module="klevu_search">
5
+ <label>Search Configuration</label>
6
+ <tab>klevu</tab>
7
+ <sort_order>300</sort_order>
8
+ <show_in_default>1</show_in_default>
9
+ <show_in_website>1</show_in_website>
10
+ <show_in_store>1</show_in_store>
11
+ <groups>
12
+ <product_sync translate="label">
13
+ <label>Data Sync Settings</label>
14
+ <sort_order>3</sort_order>
15
+ <show_in_default>1</show_in_default>
16
+ <show_in_website>1</show_in_website>
17
+ <show_in_store>1</show_in_store>
18
+ <comment>
19
+ <![CDATA[<div class="kuGuideLink"><a target="_blank" href="http://support.klevu.com/section/manuals/magento-manuals/data-synchronization/">Quick Guide</a></div>
20
+ ]]></comment>
21
+ <fields>
22
+ <enabledcms translate="label">
23
+ <label>Enable Other Content Sync</label>
24
+ <comment><![CDATA[Enable CMS Synchronization.]]></comment>
25
+ <frontend_type>select</frontend_type>
26
+ <source_model>adminhtml/system_config_source_yesno</source_model>
27
+ <sort_order>111</sort_order>
28
+ <show_in_default>1</show_in_default>
29
+ <show_in_website>1</show_in_website>
30
+ <show_in_store>1</show_in_store>
31
+ </enabledcms>
32
+ </fields>
33
+ </product_sync>
34
+ <cmscontent translate="label">
35
+ <label>CMS / Other (Non-Product) Content</label>
36
+ <frontend_type>select</frontend_type>
37
+ <source_model>adminhtml/system_config_source_yesno</source_model>
38
+ <sort_order>103</sort_order>
39
+ <show_in_default>1</show_in_default>
40
+ <show_in_website>1</show_in_website>
41
+ <show_in_store>1</show_in_store>
42
+ <comment>
43
+ <![CDATA[<div class="kuGuideLink"><a target="_blank" href="http://support.klevu.com/section/manuals/magento-manuals/cms-pages-non-product-content/">Quick Guide</a></div>
44
+ ]]></comment>
45
+ <fields>
46
+ <enabledcmsfront_info translate="label comment">
47
+ <label></label>
48
+ <comment><![CDATA[Switch to store view scope to set.]]></comment>
49
+ <sort_order>100</sort_order>
50
+ <frontend_type>label</frontend_type>
51
+ <show_in_default>1</show_in_default>
52
+ <show_in_website>1</show_in_website>
53
+ <show_in_store>0</show_in_store>
54
+ </enabledcmsfront_info>
55
+ <enabledcmsfront translate="label">
56
+ <label>Enable Other Content in Frontend</label>
57
+ <comment><![CDATA[By default, when a search query is fired, Klevu searches in the
58
+ product catalog. To enable search in the other content (e.g. CMS and Other non-product content), select Yes.]]></comment>
59
+ <frontend_type>select</frontend_type>
60
+ <source_model>adminhtml/system_config_source_yesno</source_model>
61
+ <sort_order>100</sort_order>
62
+ <show_in_default>0</show_in_default>
63
+ <show_in_website>0</show_in_website>
64
+ <show_in_store>1</show_in_store>
65
+ </enabledcmsfront>
66
+ <excludecms_pages translate="label">
67
+ <label>Exclude CMS Pages from Search</label>
68
+ <comment><![CDATA[Please make sure to resynchronize data by choosing the "All data" option and clicking on the "Sync Data for This Store" button under the "Data Sync Settings".]]></comment>
69
+ <frontend_model>content/adminhtml_form_cmspages</frontend_model>
70
+ <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
71
+ <sort_order>102</sort_order>
72
+ <show_in_default>0</show_in_default>
73
+ <show_in_website>0</show_in_website>
74
+ <show_in_store>1</show_in_store>
75
+ </excludecms_pages>
76
+ </fields>
77
+ </cmscontent>
78
+ </groups>
79
+ </klevu_search>
80
+ </sections>
81
+ </config>
app/code/community/Klevu/Content/sql/klevu_content_setup/mysql4-install-0.1.0.php ADDED
File without changes
app/code/community/Klevu/Search/Block/Adminhtml/Form/Infolinks.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Klevu_Search_Block_Adminhtml_Form_Infolinks extends Mage_Adminhtml_Block_System_Config_Form_Fieldset {
4
+
5
+ protected function _construct() {
6
+ parent::_construct();
7
+
8
+ if (!$this->getTemplate()) {
9
+ // Set the default template
10
+ $this->setTemplate("klevu/search/form/information.phtml");
11
+ }
12
+ }
13
+
14
+ public function render(Varien_Data_Form_Element_Abstract $element) {
15
+ $html = $this->_getHeaderHtml($element);
16
+
17
+ $html .= $this->_toHtml();
18
+
19
+ $html .= $this->_getFooterHtml($element);
20
+
21
+ return $html;
22
+ }
23
+
24
+ public function getVersion() {
25
+ return Mage::getConfig()->getModuleConfig('Klevu_Search')->version;
26
+ }
27
+
28
+ }
app/code/community/Klevu/Search/Block/Adminhtml/System/Config/Form/Field.php ADDED
@@ -0,0 +1,367 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Klevu_Search_Block_Adminhtml_System_Config_Form_Field extends Mage_Adminhtml_Block_System_Config_Form_Field {
4
+
5
+ /**
6
+ * Enter description here...
7
+ *
8
+ * @param Varien_Data_Form_Element_Abstract $element
9
+ * @return string
10
+ */
11
+ public function render(Varien_Data_Form_Element_Abstract $element) {
12
+ if (version_compare(Mage::getVersion(), '1.7.0.1', '<')) {
13
+ if (Mage::app()->getRequest()->getParam('section') == "klevu_search") {
14
+ $id = $element->getHtmlId();
15
+ $features = Mage::helper('klevu_search/config')->getFeaturesUpdate($element->getHtmlId());
16
+ if (!empty($features)) {
17
+ $style = 'class="klevu-disabled"';
18
+ $upgrade_text = '';
19
+ if (!empty($features['upgrade_message']) || !empty($features['upgrade_label'])) {
20
+ $upgrade_text .= "<div class='klevu-upgrade-block'>";
21
+ if (!empty($features['upgrade_message'])) {
22
+ $upgrade_text .= $features['upgrade_message'];
23
+ }
24
+ if (!empty($features['upgrade_label'])) {
25
+ $upgrade_text .= "<br/><button type='button' onClick=upgradeLink('" . $features["upgrade_url"] . "')>" . $features['upgrade_label'] . "</button>";
26
+ }
27
+ $upgrade_text .= "</div>";
28
+ }
29
+ } else {
30
+ $style = '';
31
+ $upgrade_text = '';
32
+ }
33
+ $useContainerId = $element->getData('use_container_id');
34
+ $html = '<tr id="row_' . $id . '">' . '<td class="label"><label for="' . $id . '" ' . $style . '>' . $element->getLabel() . '</label>' . $upgrade_text . '</td>';
35
+ // $isDefault = !$this->getRequest()->getParam('website') && !$this->getRequest()->getParam('store');
36
+ $isMultiple = $element->getExtType() === 'multiple';
37
+ // replace [value] with [inherit]
38
+ $namePrefix = preg_replace('#\[value\](\[\])?$#', '', $element->getName());
39
+ $options = $element->getValues();
40
+ $addInheritCheckbox = false;
41
+ if ($element->getCanUseWebsiteValue()) {
42
+ $addInheritCheckbox = true;
43
+ $checkboxLabel = Mage::helper('adminhtml')->__('Use Website');
44
+ } elseif ($element->getCanUseDefaultValue()) {
45
+ $addInheritCheckbox = true;
46
+ $checkboxLabel = Mage::helper('adminhtml')->__('Use Default');
47
+ }
48
+ if ($addInheritCheckbox) {
49
+ $inherit = $element->getInherit() == 1 ? 'checked="checked"' : '';
50
+ if ($inherit) {
51
+ $element->setDisabled(true);
52
+ }
53
+ }
54
+ // Code added by klevu
55
+ if (!empty($features)) {
56
+ $element->setDisabled(true);
57
+ $element->setValue(0);
58
+ }
59
+ $html .= '<td class="value">';
60
+ $html .= $this->_getElementHtml($element);
61
+ if ($element->getComment()) {
62
+ $html .= '<p class="note"><span>' . $element->getComment() . '</span></p>';
63
+ }
64
+ $html .= '</td>';
65
+ if ($addInheritCheckbox) {
66
+ $defText = $element->getDefaultValue();
67
+ if ($options) {
68
+ $defTextArr = array();
69
+ foreach ($options as $k => $v) {
70
+ if ($isMultiple) {
71
+ if (is_array($v['value']) && in_array($k, $v['value'])) {
72
+ $defTextArr[] = $v['label'];
73
+ }
74
+ } elseif ($v['value'] == $defText) {
75
+ $defTextArr[] = $v['label'];
76
+ break;
77
+ }
78
+ }
79
+ $defText = join(', ', $defTextArr);
80
+ }
81
+ // code added by klevu
82
+ if (!empty($features)) {
83
+ } else {
84
+ // default value
85
+ $html .= '<td class="use-default">';
86
+ // $html.= '<input id="'.$id.'_inherit" name="'.$namePrefix.'[inherit]" type="checkbox" value="1" class="input-checkbox config-inherit" '.$inherit.' onclick="$(\''.$id.'\').disabled = this.checked">';
87
+ $html .= '<input id="' . $id . '_inherit" name="' . $namePrefix . '[inherit]" type="checkbox" value="1" class="checkbox config-inherit" ' . $inherit . ' onclick="toggleValueElements(this, Element.previous(this.parentNode))" /> ';
88
+ $html .= '<label for="' . $id . '_inherit" class="inherit" title="' . htmlspecialchars($defText) . '">' . $checkboxLabel . '</label>';
89
+ $html .= '</td>';
90
+ }
91
+ }
92
+ $html .= '<td class="scope-label">';
93
+ if ($element->getScope()) {
94
+ $html .= $element->getScopeLabel();
95
+ }
96
+ $html .= '</td>';
97
+ // code added by klevu
98
+ if (!empty($features)) {
99
+ $element->setDisabled(true);
100
+ }
101
+ $html .= '<td class="">';
102
+ if ($element->getHint()) {
103
+ $html .= '<div class="hint" >';
104
+ $html .= '<div style="display: none;">' . $element->getHint() . '</div>';
105
+ $html .= '</div>';
106
+ }
107
+ $html .= '</td>';
108
+ $html .= '</tr>';
109
+ return $html;
110
+ } else {
111
+ $id = $element->getHtmlId();
112
+ $useContainerId = $element->getData('use_container_id');
113
+ $html = '<tr id="row_' . $id . '">' . '<td class="label"><label for="' . $id . '">' . $element->getLabel() . '</label></td>';
114
+ // $isDefault = !$this->getRequest()->getParam('website') && !$this->getRequest()->getParam('store');
115
+ $isMultiple = $element->getExtType() === 'multiple';
116
+ // replace [value] with [inherit]
117
+ $namePrefix = preg_replace('#\[value\](\[\])?$#', '', $element->getName());
118
+ $options = $element->getValues();
119
+ $addInheritCheckbox = false;
120
+ if ($element->getCanUseWebsiteValue()) {
121
+ $addInheritCheckbox = true;
122
+ $checkboxLabel = Mage::helper('adminhtml')->__('Use Website');
123
+ } elseif ($element->getCanUseDefaultValue()) {
124
+ $addInheritCheckbox = true;
125
+ $checkboxLabel = Mage::helper('adminhtml')->__('Use Default');
126
+ }
127
+ if ($addInheritCheckbox) {
128
+ $inherit = $element->getInherit() == 1 ? 'checked="checked"' : '';
129
+ if ($inherit) {
130
+ $element->setDisabled(true);
131
+ }
132
+ }
133
+ $html .= '<td class="value">';
134
+ $html .= $this->_getElementHtml($element);
135
+ if ($element->getComment()) {
136
+ $html .= '<p class="note"><span>' . $element->getComment() . '</span></p>';
137
+ }
138
+ $html .= '</td>';
139
+ if ($addInheritCheckbox) {
140
+ $defText = $element->getDefaultValue();
141
+ if ($options) {
142
+ $defTextArr = array();
143
+ foreach ($options as $k => $v) {
144
+ if ($isMultiple) {
145
+ if (is_array($v['value']) && in_array($k, $v['value'])) {
146
+ $defTextArr[] = $v['label'];
147
+ }
148
+ } elseif ($v['value'] == $defText) {
149
+ $defTextArr[] = $v['label'];
150
+ break;
151
+ }
152
+ }
153
+ $defText = join(', ', $defTextArr);
154
+ }
155
+ // default value
156
+ $html .= '<td class="use-default">';
157
+ // $html.= '<input id="'.$id.'_inherit" name="'.$namePrefix.'[inherit]" type="checkbox" value="1" class="input-checkbox config-inherit" '.$inherit.' onclick="$(\''.$id.'\').disabled = this.checked">';
158
+ $html .= '<input id="' . $id . '_inherit" name="' . $namePrefix . '[inherit]" type="checkbox" value="1" class="checkbox config-inherit" ' . $inherit . ' onclick="toggleValueElements(this, Element.previous(this.parentNode))" /> ';
159
+ $html .= '<label for="' . $id . '_inherit" class="inherit" title="' . htmlspecialchars($defText) . '">' . $checkboxLabel . '</label>';
160
+ $html .= '</td>';
161
+ }
162
+ $html .= '<td class="scope-label">';
163
+ if ($element->getScope()) {
164
+ $html .= $element->getScopeLabel();
165
+ }
166
+ $html .= '</td>';
167
+ $html .= '<td class="">';
168
+ if ($element->getHint()) {
169
+ $html .= '<div class="hint" >';
170
+ $html .= '<div style="display: none;">' . $element->getHint() . '</div>';
171
+ $html .= '</div>';
172
+ }
173
+ $html .= '</td>';
174
+ $html .= '</tr>';
175
+ return $html;
176
+ }
177
+ } else {
178
+ if (Mage::app()->getRequest()->getParam('section') == "klevu_search") {
179
+ $id = $element->getHtmlId();
180
+ $feature_data = Mage::helper('klevu_search/config')->getFeaturesUpdate($element->getHtmlId());
181
+
182
+
183
+ if (!empty($feature_data)) {
184
+ $style = 'class="klevu-disabled"';
185
+ $upgrade_text = '';
186
+ if (!empty($feature_data['upgrade_message']) || !empty($feature_data['upgrade_label'])) {
187
+ $upgrade_text .= "<div class='klevu-upgrade-block'>";
188
+ if (!empty($feature_data['upgrade_message'])) {
189
+ $upgrade_text .= $feature_data['upgrade_message'];
190
+ }
191
+ if (!empty($feature_data['upgrade_label'])) {
192
+ $upgrade_text .= "<br/><button type='button' onClick=upgradeLink('" . $feature_data["upgrade_url"] . "')>" . $feature_data['upgrade_label'] . "</button>";
193
+ }
194
+ $upgrade_text .= "</div>";
195
+ }
196
+ } else {
197
+ $style = '';
198
+ $upgrade_text = '';
199
+ }
200
+
201
+ $html = '<td class="label"><label for="' . $id . '" ' . $style . '>' . $element->getLabel() . '</label>' . $upgrade_text . '</td>';
202
+ // $isDefault = !$this->getRequest()->getParam('website') && !$this->getRequest()->getParam('store');
203
+ $isMultiple = $element->getExtType() === 'multiple';
204
+ // replace [value] with [inherit]
205
+ $namePrefix = preg_replace('#\[value\](\[\])?$#', '', $element->getName());
206
+ $options = $element->getValues();
207
+ $addInheritCheckbox = false;
208
+ if ($element->getCanUseWebsiteValue()) {
209
+ $addInheritCheckbox = true;
210
+ $checkboxLabel = $this->__('Use Website');
211
+ } elseif ($element->getCanUseDefaultValue()) {
212
+ $addInheritCheckbox = true;
213
+ $checkboxLabel = $this->__('Use Default');
214
+ }
215
+ if ($addInheritCheckbox) {
216
+ $inherit = $element->getInherit() == 1 ? 'checked="checked"' : '';
217
+ if ($inherit) {
218
+ $element->setDisabled(true);
219
+ }
220
+ }
221
+ if (!empty($feature_data)) {
222
+ $element->setDisabled(true);
223
+ $element->setValue(0);
224
+ }
225
+ if ($element->getTooltip()) {
226
+ $html .= '<td class="value with-tooltip">';
227
+ $html .= $this->_getElementHtml($element);
228
+ $html .= '<div class="field-tooltip"><div>' . $element->getTooltip() . '</div></div>';
229
+ } else {
230
+ $html .= '<td class="value">';
231
+ $html .= $this->_getElementHtml($element);
232
+ }
233
+ ;
234
+ if ($element->getComment()) {
235
+ $html .= '<p class="note"><span>' . $element->getComment() . '</span></p>';
236
+ }
237
+ $html .= '</td>';
238
+ if ($addInheritCheckbox) {
239
+ $defText = $element->getDefaultValue();
240
+ if ($options) {
241
+ $defTextArr = array();
242
+ foreach ($options as $k => $v) {
243
+ if ($isMultiple) {
244
+ if (is_array($v['value']) && in_array($k, $v['value'])) {
245
+ $defTextArr[] = $v['label'];
246
+ }
247
+ } elseif (isset($v['value'])) {
248
+ if ($v['value'] == $defText) {
249
+ $defTextArr[] = $v['label'];
250
+ break;
251
+ }
252
+ } elseif (!is_array($v)) {
253
+ if ($k == $defText) {
254
+ $defTextArr[] = $v;
255
+ break;
256
+ }
257
+ }
258
+ }
259
+ $defText = join(', ', $defTextArr);
260
+ }
261
+ if (!empty($feature_data)) {
262
+ } else {
263
+ // default value
264
+ $html .= '<td class="use-default">';
265
+ $html .= '<input id="' . $id . '_inherit" name="' . $namePrefix . '[inherit]" type="checkbox" value="1" class="checkbox config-inherit" ' . $inherit . ' onclick="toggleValueElements(this, Element.previous(this.parentNode))" /> ';
266
+ $html .= '<label for="' . $id . '_inherit" class="inherit" title="' . htmlspecialchars($defText) . '">' . $checkboxLabel . '</label>';
267
+ $html .= '</td>';
268
+ }
269
+ }
270
+ $html .= '<td class="scope-label">';
271
+ if ($element->getScope()) {
272
+ $html .= $element->getScopeLabel();
273
+ }
274
+ $html .= '</td>';
275
+ if (!empty($feature_data)) {
276
+ $element->setDisabled(true);
277
+ }
278
+ $html .= '<td class="">';
279
+ if ($element->getHint()) {
280
+ $html .= '<div class="hint" >';
281
+ $html .= '<div style="display: none;">' . $element->getHint() . '</div>';
282
+ $html .= '</div>';
283
+ }
284
+ $html .= '</td>';
285
+ return $this->_decorateRowHtml($element, $html);
286
+ } else {
287
+ $id = $element->getHtmlId();
288
+ $html = '<td class="label"><label for="' . $id . '">' . $element->getLabel() . '</label></td>';
289
+ // $isDefault = !$this->getRequest()->getParam('website') && !$this->getRequest()->getParam('store');
290
+ $isMultiple = $element->getExtType() === 'multiple';
291
+ // replace [value] with [inherit]
292
+ $namePrefix = preg_replace('#\[value\](\[\])?$#', '', $element->getName());
293
+ $options = $element->getValues();
294
+ $addInheritCheckbox = false;
295
+ if ($element->getCanUseWebsiteValue()) {
296
+ $addInheritCheckbox = true;
297
+ $checkboxLabel = $this->__('Use Website');
298
+ } elseif ($element->getCanUseDefaultValue()) {
299
+ $addInheritCheckbox = true;
300
+ $checkboxLabel = $this->__('Use Default');
301
+ }
302
+ if ($addInheritCheckbox) {
303
+ $inherit = $element->getInherit() == 1 ? 'checked="checked"' : '';
304
+ if ($inherit) {
305
+ $element->setDisabled(true);
306
+ }
307
+ }
308
+ if ($element->getTooltip()) {
309
+ $html .= '<td class="value with-tooltip">';
310
+ $html .= $this->_getElementHtml($element);
311
+ $html .= '<div class="field-tooltip"><div>' . $element->getTooltip() . '</div></div>';
312
+ } else {
313
+ $html .= '<td class="value">';
314
+ $html .= $this->_getElementHtml($element);
315
+ }
316
+ ;
317
+ if ($element->getComment()) {
318
+ $html .= '<p class="note"><span>' . $element->getComment() . '</span></p>';
319
+ }
320
+ $html .= '</td>';
321
+ if ($addInheritCheckbox) {
322
+ $defText = $element->getDefaultValue();
323
+ if ($options) {
324
+ $defTextArr = array();
325
+ foreach ($options as $k => $v) {
326
+ if ($isMultiple) {
327
+ if (is_array($v['value']) && in_array($k, $v['value'])) {
328
+ $defTextArr[] = $v['label'];
329
+ }
330
+ } elseif (isset($v['value'])) {
331
+ if ($v['value'] == $defText) {
332
+ $defTextArr[] = $v['label'];
333
+ break;
334
+ }
335
+ } elseif (!is_array($v)) {
336
+ if ($k == $defText) {
337
+ $defTextArr[] = $v;
338
+ break;
339
+ }
340
+ }
341
+ }
342
+ $defText = join(', ', $defTextArr);
343
+ }
344
+ // default value
345
+ $html .= '<td class="use-default">';
346
+ $html .= '<input id="' . $id . '_inherit" name="' . $namePrefix . '[inherit]" type="checkbox" value="1" class="checkbox config-inherit" ' . $inherit . ' onclick="toggleValueElements(this, Element.previous(this.parentNode))" /> ';
347
+ $html .= '<label for="' . $id . '_inherit" class="inherit" title="' . htmlspecialchars($defText) . '">' . $checkboxLabel . '</label>';
348
+ $html .= '</td>';
349
+ }
350
+ $html .= '<td class="scope-label">';
351
+ if ($element->getScope()) {
352
+ $html .= $element->getScopeLabel();
353
+ }
354
+ $html .= '</td>';
355
+ $html .= '<td class="">';
356
+ if ($element->getHint()) {
357
+ $html .= '<div class="hint" >';
358
+ $html .= '<div style="display: none;">' . $element->getHint() . '</div>';
359
+ $html .= '</div>';
360
+ }
361
+ $html .= '</td>';
362
+ return $this->_decorateRowHtml($element, $html);
363
+ }
364
+ }
365
+ }
366
+
367
+ }
app/code/community/Klevu/Search/Block/Adminhtml/Wizard/Configure/User.php CHANGED
@@ -19,4 +19,7 @@ class Klevu_Search_Block_Adminhtml_Wizard_Configure_User extends Mage_Adminhtml_
19
  protected function getStoreUrl() {
20
  return $this->getBaseUrl();
21
  }
 
 
 
22
  }
19
  protected function getStoreUrl() {
20
  return $this->getBaseUrl();
21
  }
22
+
23
+
24
+
25
  }
app/code/community/Klevu/Search/Block/Adminhtml/Wizard/Configure/Userplan.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Klevu_Search_Block_Adminhtml_Wizard_Configure_Userplan extends Mage_Adminhtml_Block_Template {
4
+
5
+ /**
6
+ * Return the submit URL for the user configuration form.
7
+ *
8
+ * @return string
9
+ */
10
+ protected function getFormActionUrl() {
11
+ return $this->getUrl('adminhtml/klevu_search_wizard/configure_userplan_post');
12
+ }
13
+
14
+ /**
15
+ * Return the base URL for the store.
16
+ *
17
+ * @return string
18
+ */
19
+ protected function getStoreUrl() {
20
+ return $this->getBaseUrl();
21
+ }
22
+
23
+
24
+
25
+ }
app/code/community/Klevu/Search/Helper/Api.php CHANGED
@@ -19,6 +19,7 @@ class Klevu_Search_Helper_Api extends Mage_Core_Helper_Abstract {
19
  public function createUser($email, $password, $userPlan, $partnerAccount, $url, $merchantEmail,$contactNo) {
20
  $user = Mage::getSingleton('admin/session');
21
  $userEmail = $user->getUser()->getEmail();
 
22
  $storePhone = Mage::getStoreConfig('general/store_information/phone');
23
  $response = Mage::getModel("klevu_search/api_action_adduser")->execute(array(
24
  "email" => $email,
@@ -28,7 +29,8 @@ class Klevu_Search_Helper_Api extends Mage_Core_Helper_Abstract {
28
  "url" => $url,
29
  "merchantEmail" => $merchantEmail,
30
  "contactNo" => $contactNo,
31
- "shopInfo" => $userEmail.";".$storePhone,
 
32
  ));
33
 
34
  if ($response->isSuccessful()) {
@@ -101,6 +103,33 @@ class Klevu_Search_Helper_Api extends Mage_Core_Helper_Abstract {
101
  );
102
  }
103
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
104
 
105
  /**
106
  * Create a Klevu Webstore using the API for the given Magento store.
@@ -141,7 +170,6 @@ class Klevu_Search_Helper_Api extends Mage_Core_Helper_Abstract {
141
  "locale" => $locale,
142
  "testMode" => $test_mode,
143
  ));
144
-
145
  if ($response->isSuccessful()) {
146
  $webstore = new Varien_Object(array(
147
  "store_name" => $name,
@@ -153,6 +181,7 @@ class Klevu_Search_Helper_Api extends Mage_Core_Helper_Abstract {
153
  "analytics_url" => $response->getAnalyticsUrl(),
154
  "js_url" => $response->getJsUrl(),
155
  "rest_hostname" => $response->getRestUrl(),
 
156
  ));
157
 
158
  return array(
19
  public function createUser($email, $password, $userPlan, $partnerAccount, $url, $merchantEmail,$contactNo) {
20
  $user = Mage::getSingleton('admin/session');
21
  $userEmail = $user->getUser()->getEmail();
22
+ $mageVersionInfo = Mage::getVersion();
23
  $storePhone = Mage::getStoreConfig('general/store_information/phone');
24
  $response = Mage::getModel("klevu_search/api_action_adduser")->execute(array(
25
  "email" => $email,
29
  "url" => $url,
30
  "merchantEmail" => $merchantEmail,
31
  "contactNo" => $contactNo,
32
+ "bmVersion" => 1,
33
+ "shopInfo" => $userEmail.";".$storePhone.";".$mageVersionInfo,
34
  ));
35
 
36
  if ($response->isSuccessful()) {
103
  );
104
  }
105
  }
106
+
107
+
108
+ /**
109
+ * Retrieve the information of already Klevu user registered from the API.
110
+ *
111
+ * @param $email
112
+ *
113
+ * @return array An array containing the following keys:
114
+ * success: boolean value indicating whether the operation was successful.
115
+ * message: (on failure only) Error message to be shown to the user.
116
+ */
117
+ public function checkUserDetail($email) {
118
+ $response = Mage::getModel("klevu_search/api_action_checkuserdetail")->execute(array(
119
+ "email" => $email,
120
+ ));
121
+
122
+ if ($response->isSuccessful()) {
123
+ return array(
124
+ "success" => true,
125
+ );
126
+ } else {
127
+ return array(
128
+ "success" => false,
129
+ "message" => $response->getMessage()
130
+ );
131
+ }
132
+ }
133
 
134
  /**
135
  * Create a Klevu Webstore using the API for the given Magento store.
170
  "locale" => $locale,
171
  "testMode" => $test_mode,
172
  ));
 
173
  if ($response->isSuccessful()) {
174
  $webstore = new Varien_Object(array(
175
  "store_name" => $name,
181
  "analytics_url" => $response->getAnalyticsUrl(),
182
  "js_url" => $response->getJsUrl(),
183
  "rest_hostname" => $response->getRestUrl(),
184
+ "tires_url" => $response->getTiersUrl(),
185
  ));
186
 
187
  return array(
app/code/community/Klevu/Search/Helper/Config.php CHANGED
@@ -17,7 +17,7 @@ class Klevu_Search_Helper_Config extends Mage_Core_Helper_Abstract {
17
  const XML_PATH_ATTRIBUTES_ADDITIONAL = "klevu_search/attributes/additional";
18
  const XML_PATH_ATTRIBUTES_AUTOMATIC = "klevu_search/attributes/automatic";
19
  const XML_PATH_ATTRIBUTES_OTHER = "klevu_search/attributes/other";
20
- const XML_PATH_ATTRIBUTES_BOOSTING = "klevu_search/attributes/boosting";
21
  const XML_PATH_ORDER_SYNC_ENABLED = "klevu_search/order_sync/enabled";
22
  const XML_PATH_ORDER_SYNC_FREQUENCY = "klevu_search/order_sync/frequency";
23
  const XML_PATH_ORDER_SYNC_LAST_RUN = "klevu_search/order_sync/last_run";
@@ -37,8 +37,12 @@ class Klevu_Search_Helper_Config extends Mage_Core_Helper_Abstract {
37
  const XML_PATH_SYNC_OPTIONS = "klevu_search/product_sync/sync_options";
38
  const XML_PATH_UPGRADE_PREMIUM = "klevu_search/general/premium";
39
  const XML_PATH_RATING = "klevu_search/general/rating_flag";
 
 
40
 
41
  const DATETIME_FORMAT = "Y-m-d H:i:s T";
 
 
42
 
43
  /**
44
  * Set the Enable on Frontend flag in System Configuration for the given store.
@@ -318,6 +322,27 @@ class Klevu_Search_Helper_Config extends Mage_Core_Helper_Abstract {
318
  $this->setStoreConfig($path, $url, $store);
319
  return $this;
320
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
321
 
322
  /**
323
  * @param null $store
@@ -591,6 +616,7 @@ class Klevu_Search_Helper_Config extends Mage_Core_Helper_Abstract {
591
  "description",
592
  "short_description",
593
  "price",
 
594
  "tax_class_id",
595
  "weight",
596
  "rating"),
@@ -600,6 +626,7 @@ class Klevu_Search_Helper_Config extends Mage_Core_Helper_Abstract {
600
  "image",
601
  "desc",
602
  "shortDesc",
 
603
  "salePrice",
604
  "salePrice",
605
  "weight",
@@ -727,4 +754,70 @@ class Klevu_Search_Helper_Config extends Mage_Core_Helper_Abstract {
727
  public function getRatingUpgradeFlag() {
728
  return Mage::getStoreConfig(static::XML_PATH_RATING);
729
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
730
  }
17
  const XML_PATH_ATTRIBUTES_ADDITIONAL = "klevu_search/attributes/additional";
18
  const XML_PATH_ATTRIBUTES_AUTOMATIC = "klevu_search/attributes/automatic";
19
  const XML_PATH_ATTRIBUTES_OTHER = "klevu_search/attributes/other";
20
+ const XML_PATH_ATTRIBUTES_BOOSTING = "klevu_search/attribute_boost/boosting";
21
  const XML_PATH_ORDER_SYNC_ENABLED = "klevu_search/order_sync/enabled";
22
  const XML_PATH_ORDER_SYNC_FREQUENCY = "klevu_search/order_sync/frequency";
23
  const XML_PATH_ORDER_SYNC_LAST_RUN = "klevu_search/order_sync/last_run";
37
  const XML_PATH_SYNC_OPTIONS = "klevu_search/product_sync/sync_options";
38
  const XML_PATH_UPGRADE_PREMIUM = "klevu_search/general/premium";
39
  const XML_PATH_RATING = "klevu_search/general/rating_flag";
40
+ const XML_PATH_UPGRADE_FEATURES = "klevu_search/general/upgrade_features";
41
+ const XML_PATH_UPGRADE_TIRES_URL = "klevu_search/general/tiers_url";
42
 
43
  const DATETIME_FORMAT = "Y-m-d H:i:s T";
44
+ protected $_klevu_features_response;
45
+ protected $_klevu_enabled_feature_response;
46
 
47
  /**
48
  * Set the Enable on Frontend flag in System Configuration for the given store.
322
  $this->setStoreConfig($path, $url, $store);
323
  return $this;
324
  }
325
+
326
+ /**
327
+ * @param $url
328
+ * @param null $store
329
+ * @param bool $test_mode
330
+ * @return $this
331
+ */
332
+ public function setTiresUrl($url, $store = null, $test_mode = false) {
333
+ $path = static::XML_PATH_UPGRADE_TIRES_URL;
334
+ $this->setStoreConfig($path, $url, $store);
335
+ return $this;
336
+ }
337
+
338
+ /**
339
+ * @param null $store
340
+ * @return string
341
+ */
342
+ public function getTiresUrl($store = null) {
343
+ $url = Mage::getStoreConfig(static::XML_PATH_UPGRADE_TIRES_URL,$store);
344
+ return ($url) ? $url : Klevu_Search_Helper_Api::ENDPOINT_DEFAULT_HOSTNAME;
345
+ }
346
 
347
  /**
348
  * @param null $store
616
  "description",
617
  "short_description",
618
  "price",
619
+ "price",
620
  "tax_class_id",
621
  "weight",
622
  "rating"),
626
  "image",
627
  "desc",
628
  "shortDesc",
629
+ "price",
630
  "salePrice",
631
  "salePrice",
632
  "weight",
754
  public function getRatingUpgradeFlag() {
755
  return Mage::getStoreConfig(static::XML_PATH_RATING);
756
  }
757
+
758
+ /**
759
+ * get feature update
760
+ *
761
+ * @return bool
762
+ */
763
+ public function getFeaturesUpdate($elemnetID) {
764
+ try {
765
+ if (!$this->_klevu_features_response) {
766
+ $this->_klevu_features_response = Mage::getModel("klevu_search/product_sync")->getFeatures();
767
+ }
768
+ $features = $this->_klevu_features_response;
769
+ if(!empty($features) && !empty($features['disabled'])) {
770
+ $checkStr = explode("_",$elemnetID);
771
+ $disable_features = explode(",",$features['disabled']);
772
+ $code = Mage::app()->getRequest()->getParam('store');// store level
773
+ $store = Mage::getModel('core/store')->load($code);
774
+ if(in_array("preserves_layout", $disable_features) && Mage::app()->getRequest()->getParam('section')=="klevu_search") {
775
+ // when some upgrade plugin if default value set to 1 means preserve layout
776
+ // then convert to klevu template layout
777
+ if(Mage::getStoreConfig(Klevu_Search_Helper_Config::XML_PATH_LANDING_ENABLED,$store) == 1){
778
+ $this->setStoreConfig(Klevu_Search_Helper_Config::XML_PATH_LANDING_ENABLED,2,$store);
779
+ }
780
+ }
781
+ if (in_array($checkStr[count($checkStr)-1], $disable_features) && Mage::app()->getRequest()->getParam('section')=="klevu_search") {
782
+ $check = $checkStr[count($checkStr)-1];
783
+ if(!empty($check)) {
784
+ $configs = Mage::getModel('core/config_data')->getCollection()
785
+ ->addFieldToFilter('path', array("like" => '%/'.$check.'%'))->load();
786
+ $data = $configs->getData();
787
+ if(!empty($data)) {
788
+ $this->setStoreConfig($data[0]['path'],0,$store);
789
+ }
790
+ return $features;
791
+ }
792
+ }
793
+
794
+ }
795
+ } catch(Exception $e) {
796
+ Mage::helper('klevu_search')->log(Zend_Log::CRIT, sprintf("Error occured while getting features based on account %s::%s - %s", __CLASS__, __METHOD__, $e->getMessage()));
797
+ }
798
+ return;
799
+ }
800
+
801
+
802
+ public function executeFeatures($restApi,$store) {
803
+ if(!$this->_klevu_enabled_feature_response) {
804
+ $param = array("restApiKey" => $restApi,"store" => $store->getId());
805
+ $features_request = Mage::getModel("klevu_search/api_action_features")->execute($param);
806
+ if($features_request->isSuccessful() === true) {
807
+ $this->_klevu_enabled_feature_response = $features_request->getData();
808
+ $this->saveUpgradeFetaures(serialize($this->_klevu_enabled_feature_response),$store);
809
+ } else {
810
+ if(!empty($restApi)) {
811
+ $this->_klevu_enabled_feature_response = unserialize(Mage::getStoreConfig(static::XML_PATH_UPGRADE_FEATURES, $store));
812
+ }
813
+ Mage::helper('klevu_search')->log(Zend_Log::INFO,sprintf("failed to fetch feature details (%s)",$features_request->getMessage()));
814
+ }
815
+ }
816
+ return $this->_klevu_enabled_feature_response;
817
+ }
818
+
819
+ public function saveUpgradeFetaures($value,$store=null) {
820
+ $this->setStoreConfig(static::XML_PATH_UPGRADE_FEATURES,$value,$store);
821
+ }
822
+
823
  }
app/code/community/Klevu/Search/Helper/Data.php CHANGED
@@ -203,9 +203,10 @@ class Klevu_Search_Helper_Data extends Mage_Core_Helper_Abstract {
203
  * @return
204
  */
205
  public function getGroupProductMinPrice($product,$store){
206
- $groupProductIds = $product->getTypeInstance()->getChildrenIds($product->getId());
207
- $config = Mage::helper('klevu_search/config');
208
- $groupPrices = array();
 
209
  foreach ($groupProductIds as $ids) {
210
  foreach ($ids as $id) {
211
  $groupProduct = Mage::getModel('catalog/product')->load($id);
@@ -216,8 +217,11 @@ class Klevu_Search_Helper_Data extends Mage_Core_Helper_Abstract {
216
  }
217
  }
218
  }
219
- asort($groupPrices);
220
- $product->setFinalPrice(array_shift($groupPrices));
 
 
 
221
  }
222
 
223
  /**
@@ -228,22 +232,84 @@ class Klevu_Search_Helper_Data extends Mage_Core_Helper_Abstract {
228
  * @return
229
  */
230
  public function getBundleProductPrices($item,$store){
231
- $config = Mage::helper('klevu_search/config');
232
- if($config->isTaxEnabled($store->getId())) {
233
- if (version_compare(Mage::getVersion(), "1.6.0.0", "<")) {
234
- return $item->getPriceModel()->getPricesDependingOnTax($item,null,true);
235
- } else {
236
- return $item->getPriceModel()->getTotalPrices($item, null, true, false);
237
- }
238
- } else {
239
- if (version_compare(Mage::getVersion(), "1.6.0.0", "<")) {
240
- return $item->getPriceModel()->getPricesDependingOnTax($item,null,null);
241
  } else {
242
- return $item->getPriceModel()->getTotalPrices($item, null, null, false);
 
 
 
 
243
  }
 
 
244
  }
245
  }
246
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
247
  public function getIp() {
248
  if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
249
  $ip = $_SERVER['HTTP_CLIENT_IP'];
203
  * @return
204
  */
205
  public function getGroupProductMinPrice($product,$store){
206
+ try {
207
+ $groupProductIds = $product->getTypeInstance()->getChildrenIds($product->getId());
208
+ $config = Mage::helper('klevu_search/config');
209
+ $groupPrices = array();
210
  foreach ($groupProductIds as $ids) {
211
  foreach ($ids as $id) {
212
  $groupProduct = Mage::getModel('catalog/product')->load($id);
217
  }
218
  }
219
  }
220
+ asort($groupPrices);
221
+ $product->setFinalPrice(array_shift($groupPrices));
222
+ } catch(Exception $e) {
223
+ Mage::helper('klevu_search')->log(Zend_Log::WARN, sprintf("Unable to get group price for product id %s",$product->getId()));
224
+ }
225
  }
226
 
227
  /**
232
  * @return
233
  */
234
  public function getBundleProductPrices($item,$store){
235
+ try {
236
+ $config = Mage::helper('klevu_search/config');
237
+ if($config->isTaxEnabled($store->getId())) {
238
+ if (version_compare(Mage::getVersion(), "1.6.0.0", "<")) {
239
+ return $item->getPriceModel()->getPricesDependingOnTax($item,null,true);
240
+ } else {
241
+ return $item->getPriceModel()->getTotalPrices($item, null, true, false);
242
+ }
 
 
243
  } else {
244
+ if (version_compare(Mage::getVersion(), "1.6.0.0", "<")) {
245
+ return $item->getPriceModel()->getPricesDependingOnTax($item,null,null);
246
+ } else {
247
+ return $item->getPriceModel()->getTotalPrices($item, null, null, false);
248
+ }
249
  }
250
+ } catch(Exception $e) {
251
+ Mage::helper('klevu_search')->log(Zend_Log::WARN, sprintf("Unable to get get group price for product id %s",$product->getId()));
252
  }
253
  }
254
 
255
+
256
+
257
+ /**
258
+ Get Original price for group product.
259
+ *
260
+ * @param object $product.
261
+ *
262
+ * @return
263
+ */
264
+ public function getGroupProductOriginalPrice($product,$store){
265
+ try {
266
+ $groupProductIds = $product->getTypeInstance()->getChildrenIds($product->getId());
267
+ $config = Mage::helper('klevu_search/config');
268
+ $groupPrices = array();
269
+ foreach ($groupProductIds as $ids) {
270
+ foreach ($ids as $id) {
271
+ $groupProduct = Mage::getModel('catalog/product')->load($id);
272
+ if($config->isTaxEnabled($store->getId())) {
273
+ $groupPrices[] = Mage::helper("tax")->getPrice($groupProduct, $groupProduct->getPrice(), true, null, null, null, $store,false);
274
+ } else {
275
+ $groupPrices[] = $groupProduct->getPrice();
276
+ }
277
+ }
278
+ }
279
+ asort($groupPrices);
280
+ $product->setPrice(array_shift($groupPrices));
281
+ } catch(Exception $e) {
282
+ Mage::helper('klevu_search')->log(Zend_Log::WARN, sprintf("Unable to get original group price for product id %s",$product->getId()));
283
+ }
284
+ }
285
+
286
+
287
+ /**
288
+ * Get the is active attribute id
289
+ *
290
+ * @return string
291
+ */
292
+ public function getIsActiveAttributeId(){
293
+ $entity_type = Mage::getSingleton("eav/entity_type")->loadByCode("catalog_category");
294
+ $entity_typeid = $entity_type->getId();
295
+ $attributecollection = Mage::getModel("eav/entity_attribute")->getCollection()->addFieldToFilter("entity_type_id", $entity_typeid)->addFieldToFilter("attribute_code", "is_active");
296
+ $attribute = $attributecollection->getFirstItem();
297
+ return $attribute->getAttributeId();
298
+ }
299
+
300
+ /**
301
+ * Get the is visibility attribute id
302
+ *
303
+ * @return string
304
+ */
305
+ public function getVisibilityAttributeId(){
306
+ $entity_type = Mage::getSingleton("eav/entity_type")->loadByCode("catalog_product");
307
+ $entity_typeid = $entity_type->getId();
308
+ $attributecollection = Mage::getModel("eav/entity_attribute")->getCollection()->addFieldToFilter("entity_type_id", $entity_typeid)->addFieldToFilter("attribute_code", "visibility");
309
+ $attribute = $attributecollection->getFirstItem();
310
+ return $attribute->getAttributeId();
311
+ }
312
+
313
  public function getIp() {
314
  if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
315
  $ip = $_SERVER['HTTP_CLIENT_IP'];
app/code/community/Klevu/Search/Model/Adminhtml/Comment.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Klevu_Search_Model_Adminhtml_Comment extends Klevu_Search_Model_Product_Sync {
4
+
5
+ public function getCommentText(){ //this method returns the text for the label
6
+ $check_preserve = Mage::getModel("klevu_search/product_sync")->getFeatures();
7
+ if(!empty($check_preserve['disabled'])) {
8
+ if(strpos($check_preserve['disabled'],"preserves_layout") !== false) {
9
+ $klevu_html ="";
10
+ if(!empty($check_preserve['preserve_layout_message']) || !empty($check_preserve['upgrade_label'])) {
11
+ $klevu_html.= "<div class='klevu-upgrade-block-simple'>";
12
+ if(!empty($check_preserve['preserve_layout_message'])){
13
+ $klevu_html.=$check_preserve['preserve_layout_message'];
14
+ }
15
+
16
+ $klevu_html.="</div>";
17
+ }
18
+ return $klevu_html;
19
+ } else {
20
+ return "Choose your Layout";
21
+ }
22
+ }
23
+ }
24
+ }
app/code/community/Klevu/Search/Model/Api/Action/Checkuserdetail.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Klevu_Search_Model_Api_Action_Checkuserdetail extends Klevu_Search_Model_Api_Action {
4
+
5
+ const ENDPOINT = "/n-search/checkUserDetail";
6
+ const METHOD = "POST";
7
+
8
+ const DEFAULT_REQUEST_MODEL = "klevu_search/api_request_post";
9
+ const DEFAULT_RESPONSE_MODEL = "klevu_search/api_response_data";
10
+
11
+ protected function validate($parameters) {
12
+ $errors = array();
13
+
14
+ if (!isset($parameters['email']) || empty($parameters['email'])) {
15
+ $errors['email'] = "Missing email";
16
+ }
17
+ if (count($errors) == 0) {
18
+ return true;
19
+ }
20
+
21
+ return $errors;
22
+ }
23
+ }
app/code/community/Klevu/Search/Model/Api/Action/Features.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Klevu_Search_Model_Api_Action_Features extends Klevu_Search_Model_Api_Action {
4
+
5
+ const ENDPOINT = "/uti/getFeaturesAndUpgradeLink";
6
+ const METHOD = "POST";
7
+ const DEFAULT_REQUEST_MODEL = "klevu_search/api_request_post";
8
+ const DEFAULT_RESPONSE_MODEL = "klevu_search/api_response_data";
9
+
10
+ protected function validate($parameters) {
11
+
12
+ $errors = array();
13
+
14
+ if (!isset($parameters["restApiKey"]) || empty($parameters["restApiKey"])) {
15
+ $errors["restApiKey"] = "Missing Rest API key.";
16
+ }
17
+
18
+ if (count($errors) == 0) {
19
+ return true;
20
+ }
21
+ return $errors;
22
+ }
23
+ /**
24
+ * Execute the API action with the given parameters.
25
+ *
26
+ * @param array $parameters
27
+ *
28
+ * @return Klevu_Search_Model_Api_Response
29
+ */
30
+ public function execute($parameters = array()) {
31
+
32
+ $validation_result = $this->validate($parameters);
33
+ if ($validation_result !== true) {
34
+ return Mage::getModel('klevu_search/api_response_invalid')->setErrors($validation_result);
35
+ }
36
+
37
+ $request = $this->getRequest();
38
+ $store = Mage::getModel('core/store')->load($parameters['store']);
39
+ $endpoint = Mage::helper('klevu_search/api')->buildEndpoint(static::ENDPOINT, $store,Mage::helper('klevu_search/config')->getTiresUrl($store));
40
+ $request
41
+ ->setResponseModel($this->getResponse())
42
+ ->setEndpoint($endpoint)
43
+ ->setMethod(static::METHOD)
44
+ ->setData($parameters);
45
+ return $request->send();
46
+
47
+ }
48
+ }
app/code/community/Klevu/Search/Model/Api/Response.php CHANGED
@@ -98,6 +98,7 @@ class Klevu_Search_Model_Api_Response extends Varien_Object {
98
  default:
99
  $message = "Unexpected error.";
100
  }
 
101
  $this->setMessage(sprintf("Failed to connect to Klevu: %s", $message));
102
  Mage::helper('klevu_search')->log(Zend_Log::ERR, sprintf("Unsuccessful HTTP response: %s %s", $response->getStatus(), $response->responseCodeAsText($response->getStatus())));
103
  }
98
  default:
99
  $message = "Unexpected error.";
100
  }
101
+
102
  $this->setMessage(sprintf("Failed to connect to Klevu: %s", $message));
103
  Mage::helper('klevu_search')->log(Zend_Log::ERR, sprintf("Unsuccessful HTTP response: %s %s", $response->getStatus(), $response->responseCodeAsText($response->getStatus())));
104
  }
app/code/community/Klevu/Search/Model/CatalogSearch/Resource/Fulltext/Collection.php CHANGED
@@ -8,7 +8,7 @@ class Klevu_Search_Model_CatalogSearch_Resource_Fulltext_Collection extends Mage
8
  */
9
  protected $_klevu_parameters;
10
  protected $_klevu_tracking_parameters;
11
- protected $_klevu_type_of_records = null;
12
 
13
  /**
14
  * Klevu Search API Product IDs
8
  */
9
  protected $_klevu_parameters;
10
  protected $_klevu_tracking_parameters;
11
+ protected $_klevu_type_of_records = 'KLEVU_PRODUCT';
12
 
13
  /**
14
  * Klevu Search API Product IDs
app/code/community/Klevu/Search/Model/Observer.php CHANGED
@@ -96,7 +96,17 @@ class Klevu_Search_Model_Observer extends Varien_Object {
96
  * @param Varien_Event_Observer $observer
97
  */
98
  public function createThumb(Varien_Event_Observer $observer) {
99
-
 
 
 
 
 
 
 
 
 
 
100
  $image = $observer->getEvent()->getProduct()->getImage();
101
  if(($image != "no_selection") && (!empty($image))) {
102
  try {
@@ -208,5 +218,4 @@ class Klevu_Search_Model_Observer extends Varien_Object {
208
  }
209
  }
210
 
211
-
212
  }
96
  * @param Varien_Event_Observer $observer
97
  */
98
  public function createThumb(Varien_Event_Observer $observer) {
99
+
100
+ try {
101
+ if($observer->getEvent()->getProduct()->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_SIMPLE){
102
+ $parentIds = Mage::getResourceSingleton('bundle/selection')->getParentIdsByChild($observer->getEvent()->getProduct()->getId());
103
+ if(count($parentIds) > 0 && !empty($parentIds)) {
104
+ Mage::getModel("klevu_search/product_sync")->updateSpecificProductIds($parentIds);
105
+ }
106
+ }
107
+ } catch(Exception $e) {
108
+ Mage::helper('klevu_search')->log(Zend_Log::DEBUG, sprintf("error while updating bundle product id :\n%s", $e->getMessage()));
109
+ }
110
  $image = $observer->getEvent()->getProduct()->getImage();
111
  if(($image != "no_selection") && (!empty($image))) {
112
  try {
218
  }
219
  }
220
 
 
221
  }
app/code/community/Klevu/Search/Model/Product/Sync.php CHANGED
@@ -17,6 +17,7 @@ class Klevu_Search_Model_Product_Sync extends Klevu_Search_Model_Sync {
17
 
18
  const NOTIFICATION_GLOBAL_TYPE = "product_sync";
19
  const NOTIFICATION_STORE_TYPE_PREFIX = "product_sync_store_";
 
20
 
21
  public function _construct() {
22
  parent::_construct();
@@ -42,36 +43,72 @@ class Klevu_Search_Model_Product_Sync extends Klevu_Search_Model_Sync {
42
  $this->markProductForUpdate();
43
 
44
  /* update boosting rule event */
45
- Mage::dispatchEvent('update_rule_of_products', array());
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
 
47
  if ($this->isRunning(2)) {
48
  // Stop if another copy is already running
49
  $this->log(Zend_Log::INFO, "Stopping because another copy is already running.");
50
  return;
51
  }
52
-
53
  $stores = Mage::app()->getStores();
54
-
 
55
  foreach ($stores as $store) {
56
-
57
- /** @var Mage_Core_Model_Store $store */
58
  $this->reset();
59
-
60
- if ($this->rescheduleIfOutOfMemory()) {
61
- return;
62
- }
63
-
64
  if (!$this->setupSession($store)) {
65
  continue;
66
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  try {
68
- $config = Mage::helper('klevu_search/config');
69
  $rating_upgrade_flag = $config->getRatingUpgradeFlag();
70
- $session = Mage::getSingleton('klevu_search/session');
71
- $firstSync = $session->getFirstSync();
72
  if(!empty($firstSync) || $rating_upgrade_flag==0) {
73
  $this->updateProductsRating($store);
74
- $session->unsFirstSync();
75
  }
76
  } catch(Exception $e) {
77
  Mage::helper('klevu_search')->log(Zend_Log::WARN, sprintf("Unable to update rating attribute %s", $store->getName()));
@@ -336,15 +373,19 @@ class Klevu_Search_Model_Product_Sync extends Klevu_Search_Model_Sync {
336
  }
337
 
338
  $this->log(Zend_Log::INFO, sprintf("Finished sync for %s (%s).", $store->getWebsite()->getName(), $store->getName()));
339
-
340
- $config = Mage::helper('klevu_search/config');
 
 
341
  if (!$config->isExtensionEnabled($store) && !$config->hasProductSyncRun($store)) {
342
  // Enable Klevu Search after the first sync
343
- $config->setExtensionEnabledFlag(true, $store);
344
- $this->log(Zend_Log::INFO, sprintf("Automatically enabled Klevu Search on Frontend for %s (%s).",
345
- $store->getWebsite()->getName(),
346
- $store->getName()
347
- ));
 
 
348
 
349
  }
350
  $config->setLastProductSyncRun("now", $store);
@@ -353,16 +394,7 @@ class Klevu_Search_Model_Product_Sync extends Klevu_Search_Model_Sync {
353
  // If Product Sync finished without any errors, notifications are not relevant anymore
354
  $this->deleteNotifications($store);
355
  }
356
- }
357
- // update rating flag after all store view sync
358
- if($rating_upgrade_flag==0) {
359
- $config->saveRatingUpgradeFlag(1);
360
- }
361
- } catch (Exception $e) {
362
- // Catch the exception that was thrown, log it, then throw a new exception to be caught the Magento cron.
363
- Mage::helper('klevu_search')->log(Zend_Log::CRIT, sprintf("Exception thrown in %s::%s - %s", __CLASS__, __METHOD__, $e->getMessage()));
364
- throw $e;
365
- }
366
  }
367
 
368
  /**
@@ -631,10 +663,7 @@ class Klevu_Search_Model_Product_Sync extends Klevu_Search_Model_Sync {
631
  */
632
  protected function updateProducts(array $data) {
633
  $total = count($data);
634
-
635
  $this->addProductSyncData($data);
636
- //print_r($data);
637
- //exit;
638
  $response = Mage::getModel('klevu_search/api_action_updaterecords')
639
  ->setStore($this->getStore())
640
  ->execute(array(
@@ -677,7 +706,7 @@ class Klevu_Search_Model_Product_Sync extends Klevu_Search_Model_Sync {
677
  array('last_synced_at' => Mage::helper("klevu_search/compat")->now()),
678
  $where
679
  );
680
-
681
  $skipped_count = count($skipped_record_ids);
682
  if ($skipped_count > 0) {
683
  return sprintf("%d product%s failed (%s)",
@@ -709,7 +738,6 @@ class Klevu_Search_Model_Product_Sync extends Klevu_Search_Model_Sync {
709
  */
710
  protected function addProducts(array $data) {
711
  $total = count($data);
712
-
713
  $this->addProductSyncData($data);
714
  $response = Mage::getModel('klevu_search/api_action_addrecords')
715
  ->setStore($this->getStore())
@@ -804,7 +832,7 @@ class Klevu_Search_Model_Product_Sync extends Klevu_Search_Model_Sync {
804
 
805
  $url_rewrite_data = $this->getUrlRewriteData($product_ids);
806
  $visibility_data = $this->getVisibilityData($product_ids);
807
- $configurable_price_data = $this->getConfigurablePriceData($parent_ids);
808
 
809
  $stock_data = $this->getStockData($product_ids);
810
 
@@ -820,14 +848,15 @@ class Klevu_Search_Model_Product_Sync extends Klevu_Search_Model_Sync {
820
  }
821
  $currency = $this->getStore()->getDefaultCurrencyCode();
822
  $media_url .= Mage::getModel('catalog/product_media_config')->getBaseMediaUrlAddition();
823
-
824
  foreach ($products as $index => &$product) {
825
  //$item = $data->getItemById($product['product_id']);
826
  $item = Mage::getModel('catalog/product')->load($product['product_id']);
827
  $item->setCustomerGroupId(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID);
828
-
829
  //$parent = ($product['parent_id'] != 0) ? $data->getItemById($product['parent_id']) : null;
830
- $parent = ($product['parent_id'] != 0) ? Mage::getModel('catalog/product')->load($product['parent_id'])->setCustomerGroupId(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID): null;
 
831
  if (!$item) {
832
  // Product data query did not return any data for this product
833
  // Remove it from the list to skip syncing it
@@ -983,6 +1012,48 @@ class Klevu_Search_Model_Product_Sync extends Klevu_Search_Model_Sync {
983
  }
984
  }
985
  break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
986
  default:
987
  foreach ($attributes as $attribute) {
988
  if ($item->getData($attribute)) {
@@ -1473,7 +1544,8 @@ class Klevu_Search_Model_Product_Sync extends Klevu_Search_Model_Sync {
1473
  * @return array
1474
  */
1475
  protected function getGroupPrices($proData) {
1476
- $groupPrices = $proData->getData('group_price');
 
1477
  if (is_null($groupPrices)) {
1478
  $attribute = $proData->getResource()->getAttribute('group_price');
1479
  if ($attribute){
@@ -1494,6 +1566,9 @@ class Klevu_Search_Model_Product_Sync extends Klevu_Search_Model_Sync {
1494
  }
1495
  return $priceGroupData;
1496
  }
 
 
 
1497
  }
1498
 
1499
  /**
@@ -1965,6 +2040,31 @@ class Klevu_Search_Model_Product_Sync extends Klevu_Search_Model_Sync {
1965
  return $pro_ids;
1966
 
1967
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1968
 
1969
 
1970
  /**
@@ -2011,6 +2111,7 @@ class Klevu_Search_Model_Product_Sync extends Klevu_Search_Model_Sync {
2011
  */
2012
  public function updateProductsRating($store)
2013
  {
 
2014
  $entity_type = Mage::getSingleton("eav/entity_type")->loadByCode("catalog_product");
2015
  $entity_typeid = $entity_type->getId();
2016
  $attributecollection = Mage::getModel("eav/entity_attribute")->getCollection()->addFieldToFilter("entity_type_id", $entity_typeid)->addFieldToFilter("attribute_code", "rating");
@@ -2066,5 +2167,363 @@ class Klevu_Search_Model_Product_Sync extends Klevu_Search_Model_Sync {
2066
  return;
2067
  }
2068
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2069
 
 
 
 
 
 
 
 
 
 
 
 
 
2070
  }
17
 
18
  const NOTIFICATION_GLOBAL_TYPE = "product_sync";
19
  const NOTIFICATION_STORE_TYPE_PREFIX = "product_sync_store_";
20
+ protected $_klevu_features_response;
21
 
22
  public function _construct() {
23
  parent::_construct();
43
  $this->markProductForUpdate();
44
 
45
  /* update boosting rule event */
46
+ try {
47
+ Mage::helper('klevu_search')->log(Zend_Log::INFO, "Boosting rule update is started");
48
+ Mage::dispatchEvent('update_rule_of_products', array());
49
+ } catch(Exception $e) {
50
+ Mage::helper('klevu_search')->log(Zend_Log::WARN, "Unable to update boosting rule");
51
+
52
+ }
53
+
54
+ // Sync Data only for selected store from config wizard
55
+ $firstSync = Mage::getSingleton('klevu_search/session')->getFirstSync();
56
+
57
+ if(!empty($firstSync)){
58
+ /** @var Mage_Core_Model_Store $store */
59
+ $this->reset();
60
+ $onestore = Mage::app()->getStore($firstSync);
61
+ if (!$this->setupSession($onestore)) {
62
+ return;
63
+ }
64
+
65
+ $this->syncData($onestore);
66
+ return;
67
+ }
68
 
69
  if ($this->isRunning(2)) {
70
  // Stop if another copy is already running
71
  $this->log(Zend_Log::INFO, "Stopping because another copy is already running.");
72
  return;
73
  }
74
+
75
  $stores = Mage::app()->getStores();
76
+ $config = Mage::helper('klevu_search/config');
77
+
78
  foreach ($stores as $store) {
 
 
79
  $this->reset();
 
 
 
 
 
80
  if (!$this->setupSession($store)) {
81
  continue;
82
  }
83
+ $this->syncData($store);
84
+ }
85
+
86
+ // update rating flag after all store view sync
87
+ $rating_upgrade_flag = $config->getRatingUpgradeFlag();
88
+ if($rating_upgrade_flag==0) {
89
+ $config->saveRatingUpgradeFlag(1);
90
+ }
91
+ } catch (Exception $e) {
92
+ // Catch the exception that was thrown, log it, then throw a new exception to be caught the Magento cron.
93
+ Mage::helper('klevu_search')->log(Zend_Log::CRIT, sprintf("Exception thrown in %s::%s - %s", __CLASS__, __METHOD__, $e->getMessage()));
94
+ throw $e;
95
+ }
96
+ }
97
+
98
+
99
+ public function syncData($store){
100
+
101
+ if ($this->rescheduleIfOutOfMemory()) {
102
+ return;
103
+ }
104
+
105
+ $config = Mage::helper('klevu_search/config');
106
+ $session = Mage::getSingleton('klevu_search/session');
107
+ $firstSync = $session->getFirstSync();
108
  try {
 
109
  $rating_upgrade_flag = $config->getRatingUpgradeFlag();
 
 
110
  if(!empty($firstSync) || $rating_upgrade_flag==0) {
111
  $this->updateProductsRating($store);
 
112
  }
113
  } catch(Exception $e) {
114
  Mage::helper('klevu_search')->log(Zend_Log::WARN, sprintf("Unable to update rating attribute %s", $store->getName()));
373
  }
374
 
375
  $this->log(Zend_Log::INFO, sprintf("Finished sync for %s (%s).", $store->getWebsite()->getName(), $store->getName()));
376
+
377
+ /* Sync category content */
378
+ $this->runCategory($store);
379
+
380
  if (!$config->isExtensionEnabled($store) && !$config->hasProductSyncRun($store)) {
381
  // Enable Klevu Search after the first sync
382
+ if(!empty($firstSync)) {
383
+ $config->setExtensionEnabledFlag(true, $store);
384
+ $this->log(Zend_Log::INFO, sprintf("Automatically enabled Klevu Search on Frontend for %s (%s).",
385
+ $store->getWebsite()->getName(),
386
+ $store->getName()
387
+ ));
388
+ }
389
 
390
  }
391
  $config->setLastProductSyncRun("now", $store);
394
  // If Product Sync finished without any errors, notifications are not relevant anymore
395
  $this->deleteNotifications($store);
396
  }
397
+
 
 
 
 
 
 
 
 
 
398
  }
399
 
400
  /**
663
  */
664
  protected function updateProducts(array $data) {
665
  $total = count($data);
 
666
  $this->addProductSyncData($data);
 
 
667
  $response = Mage::getModel('klevu_search/api_action_updaterecords')
668
  ->setStore($this->getStore())
669
  ->execute(array(
706
  array('last_synced_at' => Mage::helper("klevu_search/compat")->now()),
707
  $where
708
  );
709
+
710
  $skipped_count = count($skipped_record_ids);
711
  if ($skipped_count > 0) {
712
  return sprintf("%d product%s failed (%s)",
738
  */
739
  protected function addProducts(array $data) {
740
  $total = count($data);
 
741
  $this->addProductSyncData($data);
742
  $response = Mage::getModel('klevu_search/api_action_addrecords')
743
  ->setStore($this->getStore())
832
 
833
  $url_rewrite_data = $this->getUrlRewriteData($product_ids);
834
  $visibility_data = $this->getVisibilityData($product_ids);
835
+ //$configurable_price_data = $this->getConfigurablePriceData($parent_ids);
836
 
837
  $stock_data = $this->getStockData($product_ids);
838
 
848
  }
849
  $currency = $this->getStore()->getDefaultCurrencyCode();
850
  $media_url .= Mage::getModel('catalog/product_media_config')->getBaseMediaUrlAddition();
851
+ Mage::app()->loadAreaPart(Mage_Core_Model_App_Area::AREA_FRONTEND,Mage_Core_Model_App_Area::PART_EVENTS);
852
  foreach ($products as $index => &$product) {
853
  //$item = $data->getItemById($product['product_id']);
854
  $item = Mage::getModel('catalog/product')->load($product['product_id']);
855
  $item->setCustomerGroupId(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID);
856
+
857
  //$parent = ($product['parent_id'] != 0) ? $data->getItemById($product['parent_id']) : null;
858
+ $parent = ($product['parent_id'] != 0) ? Mage::getModel('catalog/product')->load($product['parent_id'])->setCustomerGroupId(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID): null;
859
+
860
  if (!$item) {
861
  // Product data query did not return any data for this product
862
  // Remove it from the list to skip syncing it
1012
  }
1013
  }
1014
  break;
1015
+ case "price":
1016
+ // Default to 0 if price can't be determined
1017
+ $product['price'] = 0;
1018
+ $tax_class_id = "";
1019
+ if ($parent && $parent->getData("type_id") == Mage_Catalog_Model_Product_Type_Configurable::TYPE_CODE) {
1020
+ // Calculate configurable product price based on option values
1021
+ $orgPrice = $parent->getPrice();
1022
+ $price = (isset($orgPrice)) ? $orgPrice: $parent->getData("price");
1023
+
1024
+ // also send sale price for sorting and filters for klevu
1025
+ $product['price'] = $this->processPrice($price , $tax_class_id, $parent);
1026
+ } else {
1027
+ // Use price index prices to set the product price and start/end prices if available
1028
+ // Falling back to product price attribute if not
1029
+ if ($item) {
1030
+
1031
+ // Always use minimum price as the sale price as it's the most accurate
1032
+ $product['price'] = $this->processPrice($item->getPrice(), $tax_class_id, $item);
1033
+
1034
+ if ($item->getData('type_id') == Mage_Catalog_Model_Product_Type::TYPE_GROUPED) {
1035
+ // Get the group product original price
1036
+ Mage::helper('klevu_search')->getGroupProductOriginalPrice($item,$this->getStore());
1037
+ $sPrice = $item->getPrice();
1038
+ $product["price"] = $this->processPrice($sPrice, $tax_class_id, $item);
1039
+ }
1040
+
1041
+ if ($item->getData('type_id') == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE) {
1042
+
1043
+ // product detail page always shows final price as price so we also taken final price as original price only for bundle product
1044
+ list($minimalPrice, $maximalPrice) = Mage::helper('klevu_search')->getBundleProductPrices($item,$this->getStore());
1045
+ $product["price"] = $this->processPrice($minimalPrice, $tax_class_id, $item);
1046
+ }
1047
+
1048
+ } else {
1049
+ if ($item->getData("price") !== null) {
1050
+ $product["price"] = $this->processPrice($item->getData("price"), $tax_class_id, $item);
1051
+ } else if ($parent) {
1052
+ $product["price"] = $this->processPrice($parent->getData("price"), $tax_class_id, $parent);
1053
+ }
1054
+ }
1055
+ }
1056
+ break;
1057
  default:
1058
  foreach ($attributes as $attribute) {
1059
  if ($item->getData($attribute)) {
1544
  * @return array
1545
  */
1546
  protected function getGroupPrices($proData) {
1547
+ try {
1548
+ $groupPrices = $proData->getData('group_price');
1549
  if (is_null($groupPrices)) {
1550
  $attribute = $proData->getResource()->getAttribute('group_price');
1551
  if ($attribute){
1566
  }
1567
  return $priceGroupData;
1568
  }
1569
+ } catch(Exception $e) {
1570
+ Mage::helper('klevu_search')->log(Zend_Log::DEBUG, sprintf("Unable to get group price data for product id %s",$proData->getId()));
1571
+ }
1572
  }
1573
 
1574
  /**
2040
  return $pro_ids;
2041
 
2042
  }
2043
+
2044
+
2045
+ /**
2046
+ * Get prodcuts ids which have expiry date gone and update next day
2047
+ * @return array
2048
+ */
2049
+ public function getCatalogRuleProductsIds() {
2050
+ $attribute_id = $this->getExpiryDateAttributeId();
2051
+ $current_date = date_create("now")->format("Y-m-d");
2052
+ $query = $this->getConnection()->select()
2053
+ ->from($this->getTableName("catalog_product_entity_datetime"), array('entity_id'))
2054
+ ->where("attribute_id=:attribute_id AND DATE_ADD(value,INTERVAL 1 DAY)=:current_date")
2055
+ ->bind(array(
2056
+ 'attribute_id' => $attribute_id,
2057
+ 'current_date' => $current_date
2058
+ ));
2059
+ $data = $this->getConnection()->fetchAll($query, $query->getBind());
2060
+ $pro_ids = array();
2061
+ foreach($data as $key => $value)
2062
+ {
2063
+ $pro_ids[] = $value['entity_id'];
2064
+ }
2065
+ return $pro_ids;
2066
+
2067
+ }
2068
 
2069
 
2070
  /**
2111
  */
2112
  public function updateProductsRating($store)
2113
  {
2114
+
2115
  $entity_type = Mage::getSingleton("eav/entity_type")->loadByCode("catalog_product");
2116
  $entity_typeid = $entity_type->getId();
2117
  $attributecollection = Mage::getModel("eav/entity_attribute")->getCollection()->addFieldToFilter("entity_type_id", $entity_typeid)->addFieldToFilter("attribute_code", "rating");
2167
  return;
2168
  }
2169
  }
2170
+
2171
+ /**
2172
+ * Perform Category Sync on any configured stores, adding new categories, updating modified and
2173
+ * deleting removed category since last sync.
2174
+ */
2175
+ public function runCategory($store)
2176
+ {
2177
+ $isActiveAttributeId = Mage::helper("klevu_search")->getIsActiveAttributeId();
2178
+ $this->log(Zend_Log::INFO, sprintf("Starting sync for category %s (%s).", $store->getWebsite()->getName() , $store->getName()));
2179
+ $rootId = $this->getStore()->getRootCategoryId();
2180
+ $rootStoreCategory = "1/$rootId/";
2181
+ $actions = array(
2182
+ 'delete' => $this->getConnection()
2183
+ ->select()
2184
+ /*
2185
+ * Select synced categories in the current store/mode that
2186
+ * are no longer enabled
2187
+ */
2188
+ ->from(
2189
+ array('k' => $this->getTableName("klevu_search/product_sync")),
2190
+ array('category_id' => "k.product_id")
2191
+
2192
+ )
2193
+ ->joinLeft(
2194
+ array('ci' => $this->getTableName("catalog_category_entity_int")),
2195
+ "k.product_id = ci.entity_id AND ci.attribute_id = :is_active",
2196
+ ""
2197
+ )
2198
+ ->where("k.type = :type AND (ci.value = 0 OR k.product_id NOT IN ?)",
2199
+ $this->getConnection()
2200
+ ->select()
2201
+ ->from(
2202
+ array('i' => $this->getTableName("catalog_category_entity_int")),
2203
+ array('category_id' => "i.entity_id")
2204
+ )
2205
+ )
2206
+ ->group(array('k.product_id', 'k.parent_id'))
2207
+ ->bind(array(
2208
+ 'type'=>"categories",
2209
+ 'is_active' => $isActiveAttributeId
2210
+ )),
2211
+ 'update' =>
2212
+ $this->getConnection()
2213
+ ->select()
2214
+ /*
2215
+ * Select categories for the current store/mode
2216
+ * have been updated since last sync.
2217
+ */
2218
+ ->from(
2219
+ array('k' => $this->getTableName("klevu_search/product_sync")),
2220
+ array('category_id' => "k.product_id")
2221
+
2222
+ )
2223
+ ->join(
2224
+ array('ce' => $this->getTableName("catalog_category_entity")),
2225
+ "k.product_id = ce.entity_id",
2226
+ ""
2227
+ )
2228
+ ->where("(k.type = :type) AND k.test_mode = :test_mode AND (k.store_id = :store_id) AND (ce.updated_at > k.last_synced_at)")
2229
+ ->bind(array(
2230
+ 'store_id' => $store->getId(),
2231
+ 'type'=> "categories",
2232
+ 'test_mode' => $this->isTestModeEnabled(),
2233
+ )),
2234
+ 'add' => $this->getConnection()
2235
+ ->select()
2236
+ /*
2237
+ * Select categories for the current store/mode
2238
+ * have been updated since last sync.
2239
+ */
2240
+ ->from(
2241
+ array('c' => $this->getTableName("catalog_category_entity")),
2242
+ array('category_id' => "c.entity_id")
2243
+ )
2244
+ ->join(
2245
+ array('ci' => $this->getTableName("catalog_category_entity_int")),
2246
+ "c.entity_id = ci.entity_id AND ci.attribute_id = :is_active AND ci.value = 1",
2247
+ ""
2248
+ )
2249
+ ->joinLeft(
2250
+ array('k' => $this->getTableName("klevu_search/product_sync")),
2251
+ "ci.entity_id = k.product_id AND k.store_id = :store_id AND k.test_mode = :test_mode AND k.type = :type",
2252
+ ""
2253
+ )
2254
+ ->where("k.product_id IS NULL")
2255
+ ->where("c.path LIKE ?","{$rootStoreCategory}%")
2256
+ ->bind(array(
2257
+ 'type' => "categories",
2258
+ 'store_id' => $store->getId(),
2259
+ 'is_active' => $isActiveAttributeId,
2260
+ 'test_mode' => $this->isTestModeEnabled(),
2261
+ )),
2262
+ );
2263
+ $errors = 0;
2264
+ foreach($actions as $action => $statement) {
2265
+ if ($this->rescheduleIfOutOfMemory()) {
2266
+ return;
2267
+ }
2268
+ $method = $action . "Category";
2269
+ $category_pages = $this->getConnection()->fetchAll($statement, $statement->getBind());
2270
+ $total = count($category_pages);
2271
+ $this->log(Zend_Log::INFO, sprintf("Found %d category Pages to %s.", $total, $action));
2272
+ $pages = ceil($total / static ::RECORDS_PER_PAGE);
2273
+ for ($page = 1; $page <= $pages; $page++) {
2274
+ if ($this->rescheduleIfOutOfMemory()) {
2275
+ return;
2276
+ }
2277
+ $offset = ($page - 1) * static ::RECORDS_PER_PAGE;
2278
+ $result = $this->$method(array_slice($category_pages, $offset, static ::RECORDS_PER_PAGE));
2279
+ if ($result !== true) {
2280
+ $errors++;
2281
+ $this->log(Zend_Log::ERR, sprintf("Errors occurred while attempting to %s categories pages %d - %d: %s", $action, $offset + 1, ($offset + static ::RECORDS_PER_PAGE <= $total) ? $offset + static ::RECORDS_PER_PAGE : $total, $result));
2282
+ }
2283
+ }
2284
+ }
2285
+ $this->log(Zend_Log::INFO, sprintf("Finished category page sync for %s (%s).", $store->getWebsite()->getName() , $store->getName()));
2286
+ }
2287
+ /**
2288
+ * Add the given Categories to Klevu Search. Returns true if the operation was successful,
2289
+ * or the error message if it failed.
2290
+ *
2291
+ * @param array $data List of Categories to add. Each element should be an array
2292
+ * containing an element with "category_id" as the key and category id as
2293
+ * the value.
2294
+ *
2295
+ * @return bool|string
2296
+ */
2297
+ protected function addCategory(array $data)
2298
+ {
2299
+ $total = count($data);
2300
+ $data = $this->addcategoryData($data);
2301
+ $response = Mage::getModel('klevu_search/api_action_addrecords')->setStore($this->getStore())->execute(array(
2302
+ 'sessionId' => $this->getSessionId() ,
2303
+ 'records' => $data
2304
+ ));
2305
+ if ($response->isSuccessful()) {
2306
+ $skipped_record_ids = array();
2307
+ if ($skipped_records = $response->getSkippedRecords()) {
2308
+ $skipped_record_ids = array_flip($skipped_records["index"]);
2309
+ }
2310
+ $sync_time = Mage::helper("klevu_search/compat")->now();
2311
+ foreach($data as $i => & $record) {
2312
+ if (isset($skipped_record_ids[$i])) {
2313
+ unset($data[$i]);
2314
+ continue;
2315
+ }
2316
+ $ids[$i] = explode("_", $data[$i]['id']);
2317
+ $record = array(
2318
+ $ids[$i][1],
2319
+ 0,
2320
+ $this->getStore()->getId() ,
2321
+ $this->isTestModeEnabled() ,
2322
+ $sync_time,
2323
+ "categories"
2324
+ );
2325
+ }
2326
+ $this->getConnection()->insertArray($this->getTableName('klevu_search/product_sync') , array(
2327
+ "product_id",
2328
+ "parent_id",
2329
+ "store_id",
2330
+ "test_mode",
2331
+ "last_synced_at",
2332
+ "type"
2333
+ ) , $data);
2334
+ $skipped_count = count($skipped_record_ids);
2335
+ if ($skipped_count > 0) {
2336
+ return sprintf("%d category%s failed (%s)", $skipped_count, ($skipped_count > 1) ? "s" : "", implode(", ", $skipped_records["messages"]));
2337
+ }
2338
+ else {
2339
+ return true;
2340
+ }
2341
+ }
2342
+ else {
2343
+ return sprintf("%d category%s failed (%s)", $total, ($total > 1) ? "s" : "", $response->getMessage());
2344
+ }
2345
+ }
2346
+ /**
2347
+ * Add the Category Sync data to each Category in the given list. Updates the given
2348
+ * list directly to save memory.
2349
+ *
2350
+ * @param array $categories An array of categories. Each element should be an array with
2351
+ * containing an element with "id" as the key and the Category
2352
+ * ID as the value.
2353
+ *
2354
+ * @return $this
2355
+ */
2356
+ protected function addcategoryData(&$pages)
2357
+ {
2358
+ $category_ids = array();
2359
+ foreach($pages as $key => $value) {
2360
+ $category_ids[] = $value["category_id"];
2361
+ }
2362
+ $category_data = Mage::getModel('catalog/category')->getCollection()->addAttributeToSelect("*")->addFieldToFilter('entity_id', array(
2363
+ 'in' => $category_ids
2364
+ ));
2365
+ foreach($category_data as $category) {
2366
+ $value["id"] = "categoryid_" . $category->getId();
2367
+ $value["name"] = $category->getName();
2368
+ $value["desc"] = strip_tags($category->getDescription());
2369
+ $value["url"] = $category->getURL();
2370
+ $value["metaDesc"] = $category->getMetaDescription() . $category->getMetaKeywords();
2371
+ $value["shortDesc"] = substr(strip_tags($category->getDescription()) , 0, 200);
2372
+ $value["listCategory"] = "KLEVU_CATEGORY";
2373
+ $value["category"] = "Categories";
2374
+ $value["salePrice"] = 0;
2375
+ $value["currency"] = "USD";
2376
+ $value["inStock"] = "yes";
2377
+ $category_data_new[] = $value;
2378
+ }
2379
+ return $category_data_new;
2380
+ }
2381
+ /**
2382
+ * Update the given categories on Klevu Search. Returns true if the operation was successful,
2383
+ * or the error message if it failed.
2384
+ *
2385
+ * @param array $data List of categories to update. Each element should be an array
2386
+ * containing an element with "category_id" as the key and category id as
2387
+ * the value
2388
+ *
2389
+ * @return bool|string
2390
+ */
2391
+ protected function updateCategory(array $data)
2392
+ {
2393
+ $total = count($data);
2394
+ $data = $this->addcategoryData($data);
2395
+ $response = Mage::getModel('klevu_search/api_action_updaterecords')->setStore($this->getStore())->execute(array(
2396
+ 'sessionId' => $this->getSessionId() ,
2397
+ 'records' => $data
2398
+ ));
2399
+ if ($response->isSuccessful()) {
2400
+ $helper = Mage::helper('klevu_search');
2401
+ $connection = $this->getConnection();
2402
+ $skipped_record_ids = array();
2403
+ if ($skipped_records = $response->getSkippedRecords()) {
2404
+ $skipped_record_ids = array_flip($skipped_records["index"]);
2405
+ }
2406
+ $where = array();
2407
+ for ($i = 0; $i < count($data); $i++) {
2408
+ if (isset($skipped_record_ids[$i])) {
2409
+ continue;
2410
+ }
2411
+ $ids[$i] = explode("_", $data[$i]['id']);
2412
+ $where[] = sprintf("(%s AND %s AND %s)", $connection->quoteInto("product_id = ?", $ids[$i][1]) , $connection->quoteInto("parent_id = ?", 0) , $connection->quoteInto("type = ?", "categories"));
2413
+ }
2414
+ $where = sprintf("(%s) AND (%s) AND (%s)", $connection->quoteInto("store_id = ?", $this->getStore()->getId()) , $connection->quoteInto("test_mode = ?", $this->isTestModeEnabled()) , implode(" OR ", $where));
2415
+ $this->getConnection()->update($this->getTableName('klevu_search/product_sync') , array(
2416
+ 'last_synced_at' => Mage::helper("klevu_search/compat")->now()
2417
+ ) , $where);
2418
+ $skipped_count = count($skipped_record_ids);
2419
+ if ($skipped_count > 0) {
2420
+ return sprintf("%d category%s failed (%s)", $skipped_count, ($skipped_count > 1) ? "s" : "", implode(", ", $skipped_records["messages"]));
2421
+ }
2422
+ else {
2423
+ return true;
2424
+ }
2425
+ }
2426
+ else {
2427
+ return sprintf("%d category%s failed (%s)", $total, ($total > 1) ? "s" : "", $response->getMessage());
2428
+ }
2429
+ }
2430
+ /**
2431
+ * Delete the given categories from Klevu Search. Returns true if the operation was
2432
+ * successful, or the error message if the operation failed.
2433
+ *
2434
+ * @param array $data List of categories to delete. Each element should be an array
2435
+ * containing an element with "category_id" as the key and category id as
2436
+ * the value.
2437
+ *
2438
+ * @return bool|string
2439
+ */
2440
+ protected function deleteCategory(array $data)
2441
+ {
2442
+ $total = count($data);
2443
+ $response = Mage::getModel('klevu_search/api_action_deleterecords')->setStore($this->getStore())->execute(array(
2444
+ 'sessionId' => $this->getSessionId() ,
2445
+ 'records' => array_map(function ($v)
2446
+ {
2447
+ return array(
2448
+ 'id' => "categoryid_" . $v['category_id']
2449
+ );
2450
+ }
2451
+ , $data)
2452
+ ));
2453
+ if ($response->isSuccessful()) {
2454
+ $connection = $this->getConnection();
2455
+ $select = $connection->select()->from(array(
2456
+ 'k' => $this->getTableName("klevu_search/product_sync")
2457
+ ))->where("k.store_id = ?", $this->getStore()->getId())->where("k.type = ?", "categories")->where("k.test_mode = ?", $this->isTestModeEnabled());
2458
+ $skipped_record_ids = array();
2459
+ if ($skipped_records = $response->getSkippedRecords()) {
2460
+ $skipped_record_ids = array_flip($skipped_records["index"]);
2461
+ }
2462
+ $or_where = array();
2463
+ for ($i = 0; $i < count($data); $i++) {
2464
+ if (isset($skipped_record_ids[$i])) {
2465
+ continue;
2466
+ }
2467
+ $or_where[] = sprintf("(%s)", $connection->quoteInto("k.product_id = ?", $data[$i]['category_id']));
2468
+ }
2469
+ $select->where(implode(" OR ", $or_where));
2470
+ $connection->query($select->deleteFromSelect("k"));
2471
+ $skipped_count = count($skipped_record_ids);
2472
+ if ($skipped_count > 0) {
2473
+ return sprintf("%d category%s failed (%s)", $skipped_count, ($skipped_count > 1) ? "s" : "", implode(", ", $skipped_records["messages"]));
2474
+ }
2475
+ else {
2476
+ return true;
2477
+ }
2478
+ }
2479
+ else {
2480
+ return sprintf("%d category%s failed (%s)", $total, ($total > 1) ? "s" : "", $response->getMessage());
2481
+ }
2482
+ }
2483
+
2484
+
2485
+
2486
+ // Get features for account
2487
+ public function getFeatures()
2488
+ {
2489
+ if (strlen($code = Mage::app()->getRequest()->getParam('store'))) { // store level
2490
+ $code = Mage::app()->getRequest()->getParam('store');
2491
+ if (!$this->_klevu_features_response) {
2492
+ $store = Mage::getModel('core/store')->load($code);
2493
+ $store_id = $store->getId();
2494
+ $config = Mage::helper('klevu_search/config');
2495
+ $restapi = $config->getRestApiKey($store_id);
2496
+ $param = array("restApiKey" => $restapi);
2497
+ $this->_klevu_features_response = Mage::helper('klevu_search/config')->executeFeatures($restapi,$store);
2498
+ }
2499
+ return $this->_klevu_features_response;
2500
+ }
2501
+
2502
+ }
2503
+
2504
+ // Get all products for update
2505
+ public function catalogruleupdateifno(){
2506
+ $timestamp_after = strtotime("+1 day",strtotime(date_create("now")->format("Y-m-d")));
2507
+ $timestamp_before = strtotime("-1 day",strtotime(date_create("now")->format("Y-m-d")));
2508
+ $query = $this->getConnection()->select()
2509
+ ->from($this->getTableName("catalogrule_product"), array('product_id'))
2510
+ ->where("customer_group_id=:customer_group_id AND ((from_time BETWEEN :timestamp_before AND :timestamp_after) OR (to_time BETWEEN :timestamp_before AND :timestamp_after))")
2511
+ ->bind(array(
2512
+ 'customer_group_id' => Mage_Customer_Model_Group::NOT_LOGGED_IN_ID,
2513
+ 'timestamp_before' => $timestamp_before,
2514
+ 'timestamp_after' => $timestamp_after
2515
+ ));
2516
 
2517
+ $data = $this->getConnection()->fetchAll($query, $query->getBind());
2518
+
2519
+ $pro_ids = array();
2520
+
2521
+ foreach($data as $key => $value)
2522
+ {
2523
+ $pro_ids[] = $value['product_id'];
2524
+ }
2525
+ if(!empty($pro_ids)) {
2526
+ $this->updateSpecificProductIds($pro_ids);
2527
+ }
2528
+ }
2529
  }
app/code/community/Klevu/Search/Model/System/Config/Source/Landingoptions.php CHANGED
@@ -8,12 +8,32 @@ class Klevu_Search_Model_System_Config_Source_Landingoptions {
8
 
9
  public function toOptionArray() {
10
  $helper = Mage::helper("klevu_search");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
 
12
- return array(
13
- array('value' => static::NO, 'label' => $helper->__("Disable")),
14
- array('value' => static::KlEVULAND, 'label' => $helper->__("Based on Klevu Template (Recommended)")),
15
- array('value' => static::YES, 'label' => $helper->__("Preserves Your Theme Layout**"))
16
-
17
- );
18
  }
19
  }
8
 
9
  public function toOptionArray() {
10
  $helper = Mage::helper("klevu_search");
11
+ $check_preserve = Mage::getModel("klevu_search/product_sync")->getFeatures();
12
+ if(!empty($check_preserve['disabled'])) {
13
+ if(strpos($check_preserve['disabled'],"preserves_layout") !== false) {
14
+ return array_reverse(array(
15
+ array('value' => static::NO, 'label' => $helper->__("Disable")),
16
+ array('value' => static::KlEVULAND, 'label' => $helper->__("Based on Klevu Template (Recommended)")),
17
+ ));
18
+ } else {
19
+ return array_reverse(array(
20
+ array('value' => static::NO, 'label' => $helper->__("Disable")),
21
+ array('value' => static::KlEVULAND, 'label' => $helper->__("Based on Klevu Template (Recommended)")),
22
+ array('value' => static::YES, 'label' => $helper->__("Preserves Your Theme Layout"))
23
+ ));
24
+ }
25
+ } else if(empty($check_preserve['disabled'])){
26
+ return array_reverse(array(
27
+ array('value' => static::NO, 'label' => $helper->__("Disable")),
28
+ array('value' => static::KlEVULAND, 'label' => $helper->__("Based on Klevu Template (Recommended)")),
29
+ array('value' => static::YES, 'label' => $helper->__("Preserves Your Theme Layout"))
30
+ ));
31
+ } else {
32
+ return array_reverse(array(
33
+ array('value' => static::NO, 'label' => $helper->__("Disable")),
34
+ array('value' => static::KlEVULAND, 'label' => $helper->__("Based on Klevu Template (Recommended)")),
35
+ ));
36
+ }
37
 
 
 
 
 
 
 
38
  }
39
  }
app/code/community/Klevu/Search/Test/Model/Api/Action/Getuserfeaturesdetail.php ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Klevu_Search_Test_Model_Api_Action_Getuserfeaturesdetail extends Klevu_Search_Test_Model_Api_Test_Case {
4
+
5
+ /**
6
+ * @test
7
+ */
8
+ public function testValidate() {
9
+ $parameters = $this->getTestParameters();
10
+
11
+ $response = Mage::getModel('klevu_search/api_response');
12
+ $response->setRawResponse(new Zend_Http_Response(200, array(), "Test response"));
13
+
14
+ $request = $this->getModelMock('klevu_search/api_request', array("send"));
15
+ $request
16
+ ->expects($this->once())
17
+ ->method("send")
18
+ ->will($this->returnValue($response));
19
+
20
+ $action = Mage::getModel('klevu_search/api_action_features');
21
+ $action
22
+ ->setRequest($request);
23
+
24
+ $this->assertEquals($response, $action->execute($parameters));
25
+ }
26
+
27
+ /**
28
+ * @test
29
+ * @dataProvider dataProvider
30
+ */
31
+ public function testValidateRequiredFields($field) {
32
+ $parameters = $this->getTestParameters();
33
+ unset($parameters[$field]);
34
+
35
+ $request = $this->getModelMock('klevu_search/api_request', array("send"));
36
+ $request
37
+ ->expects($this->never())
38
+ ->method("send");
39
+
40
+ $action = Mage::getModel('klevu_search/api_action_features');
41
+ $action
42
+ ->setRequest($request);
43
+
44
+ $response = $action->execute($parameters);
45
+
46
+ $this->assertInstanceOf("Klevu_Search_Model_Api_Response_Invalid", $response);
47
+
48
+ $this->assertArrayHasKey(
49
+ $field,
50
+ $response->getErrors(),
51
+ sprintf("Failed to assert that an error is returned for %s parameter.", $field)
52
+ );
53
+ }
54
+
55
+ protected function getTestParameters() {
56
+ return array(
57
+ 'restApiKey' => "a2xldnUtMTQ1MDI3MDEyNTY2NDI0ODc6S2xldnUtMXV1Z3FwNmthbw==",
58
+ );
59
+ }
60
+
61
+
62
+ /**
63
+ * @test
64
+ */
65
+ public function testGetFeatures() {
66
+ $http_response = new Zend_Http_Response(200, array(), $this->getDataFileContents("feature_response.xml"));
67
+ $model = Mage::getModel('klevu_search/api_action_features');
68
+ $model->setRawResponse($http_response);
69
+ $features = $model->getData();
70
+ $actual_disabled_features = $features['disabled'];
71
+ $expected_disabled_features = "boosting,enabledpopulartermfront,preserves_layout";
72
+ $this->assertEquals($expected_disabled_features, $actual_disabled_features, 'expected features not matching with actual fearures');
73
+ }
74
+ }
app/code/community/Klevu/Search/Test/Model/Api/Action/Getuserfeaturesdetail/providers/testValidateRequiredFields.yaml ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ -
2
+ field: restApiKey
3
+
app/code/community/Klevu/Search/Test/Model/Api/data/feature_response.xml ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <data>
2
+ <upgradeUrl>https://box.klevu.com/analytics</upgradeUrl>
3
+ <upgradeLabel>Upgrade</upgradeLabel>
4
+ <upgradeMessage>
5
+ This feature is not available in your plan. Upgrade your plan to activate this feature.
6
+ </upgradeMessage>
7
+ <preserveLayoutMessage>
8
+ If you want to use <b>Native search result page (which preserves your theme layout)</b> then upgrade your plan.
9
+ </preserveLayoutMessage>
10
+ <enabled>enabledaddtocartfront,enabledcmsfront</enabled>
11
+ <disabled>boosting,enabledpopulartermfront,preserves_layout</disabled>
12
+ <userPlanForStore>Growth</userPlanForStore>
13
+ </data>
app/code/community/Klevu/Search/controllers/Adminhtml/Klevu/Search/WizardController.php CHANGED
@@ -2,7 +2,53 @@
2
 
3
  class Klevu_Search_Adminhtml_Klevu_Search_WizardController extends Mage_Adminhtml_Controller_Action {
4
 
5
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  public function configure_userAction() {
7
  $this->loadLayout();
8
  $this->initLayoutMessages('klevu_search/session');
@@ -19,13 +65,26 @@ class Klevu_Search_Adminhtml_Klevu_Search_WizardController extends Mage_Adminhtm
19
 
20
  $api = Mage::helper("klevu_search/api");
21
  $session = Mage::getSingleton('klevu_search/session');
22
-
23
  if ($request->getPost("klevu_existing_email")) {
24
  $result = $api->getUser(
25
  $request->getPost("klevu_existing_email"),
26
  $request->getPost("klevu_existing_password")
27
  );
 
 
 
 
 
 
 
 
 
 
 
 
28
  } else {
 
29
  $klevu_new_email = $request->getPost("klevu_new_email");
30
  $klevu_new_password = $request->getPost("klevu_new_password");
31
  $userPlan = $request->getPost("userPlan");
@@ -34,8 +93,8 @@ class Klevu_Search_Adminhtml_Klevu_Search_WizardController extends Mage_Adminhtm
34
  $merchantEmail = $request->getPost("merchantEmail");
35
  $contactNo = $request->getPost("countyCode")."-".$request->getPost("contactNo");
36
  $error = true;
37
- if(empty($klevu_new_email) && empty($klevu_new_password) && empty($userPlan) && empty($klevu_new_url)
38
- && empty($merchantEmail) ) {
39
  $session->addError(Mage::helper("klevu_search")->__("Missing details in the form. Please check."));
40
  return $this->_forward("configure_user");
41
  } else if(!preg_match("/^[_\.0-9a-zA-Z-]+@([0-9a-zA-Z][0-9a-zA-Z-]+\.)+[a-zA-Z]{2,6}$/i",$klevu_new_email)) {
@@ -44,34 +103,30 @@ class Klevu_Search_Adminhtml_Klevu_Search_WizardController extends Mage_Adminhtm
44
  } else if(!preg_match("/^[_\.0-9a-zA-Z-]+@([0-9a-zA-Z][0-9a-zA-Z-]+\.)+[a-zA-Z]{2,6}$/i",$merchantEmail)) {
45
  $session->addError(Mage::helper("klevu_search")->__("Please enter valid Retailer Email."));
46
  return $this->_forward("configure_user");
 
 
 
47
  }else {
48
- /* if partner account selected as UserPlan then change plan to trial*/
49
- if($userPlan=="partnerAccount"){
50
- $userPlan = "trial";
51
- $partnerAccount = true;
52
- }
53
- $result = $api->createUser(
54
- $request->getPost("klevu_new_email"),
55
- $request->getPost("klevu_new_password"),
56
- $userPlan,
57
- $partnerAccount,
58
- $request->getPost("klevu_new_url"),
59
- $request->getPost("merchantEmail"),
60
- $contactNo
61
- );
 
 
 
62
  }
63
  }
64
-
65
- if ($result["success"]) {
66
- $session->setConfiguredCustomerId($result["customer_id"]);
67
- if (isset($result["message"])) {
68
- $session->addSuccess(Mage::helper("klevu_search")->__($result["message"]));
69
- }
70
- return $this->_forward("configure_store");
71
- } else {
72
- $session->addError(Mage::helper("klevu_search")->__($result["message"]));
73
- return $this->_forward("configure_user");
74
- }
75
  }
76
 
77
  public function configure_storeAction() {
@@ -94,8 +149,8 @@ class Klevu_Search_Adminhtml_Klevu_Search_WizardController extends Mage_Adminhtm
94
  }
95
 
96
  public function configure_store_postAction() {
97
- $request = $this->getRequest();
98
 
 
99
  if (!$request->isPost() || !$request->isAjax()) {
100
  return $this->_redirect("adminhtml/dashboard");
101
  }
@@ -134,6 +189,7 @@ class Klevu_Search_Adminhtml_Klevu_Search_WizardController extends Mage_Adminhtm
134
  $config->setAnalyticsUrl($result['webstore']->getAnalyticsUrl(), $store, $test_mode);
135
  $config->setJsUrl($result['webstore']->getJsUrl(), $store, $test_mode);
136
  $config->setRestHostname($result['webstore']->getRestHostname(), $store, $test_mode);
 
137
  if (isset($result["message"])) {
138
  $session->addSuccess(Mage::helper("klevu_search")->__($result["message"]));
139
  $session->setFirstSync($store_code);
@@ -143,8 +199,7 @@ class Klevu_Search_Adminhtml_Klevu_Search_WizardController extends Mage_Adminhtm
143
  return $this->_forward("configure_store");
144
  }
145
  }
146
-
147
-
148
  $config->setTaxEnabledFlag($request->getPost("tax_enable"), $store);
149
  $config->setSecureUrlEnabledFlag($request->getPost("secureurl_setting"), $store);
150
 
2
 
3
  class Klevu_Search_Adminhtml_Klevu_Search_WizardController extends Mage_Adminhtml_Controller_Action {
4
 
5
+ public function configure_userplanAction() {
6
+ $this->loadLayout();
7
+ $this->initLayoutMessages('klevu_search/session');
8
+ $this->renderLayout();
9
+ }
10
+
11
+ public function configure_userplan_postAction() {
12
+ /* if partner account selected as UserPlan then change plan to trial*/
13
+ $partnerAccount = false;
14
+ $request = $this->getRequest();
15
+ $session = Mage::getSingleton('klevu_search/session');
16
+ $userPlan = $request->getPost("userPlan");
17
+ if($userPlan=="partnerAccount"){
18
+ $partnerAccount = true;
19
+ }
20
+
21
+ if(empty($userPlan)) {
22
+ $session->addError(Mage::helper("klevu_search")->__("Not sure, which plan to select? Select Premium to try all features free for 14-days."));
23
+ return $this->_forward("configure_userplan");
24
+
25
+ }
26
+
27
+ $api = Mage::helper("klevu_search/api");
28
+ $result = $api->createUser(
29
+ Mage::getSingleton('core/session')->getKlevuNewEmail(),
30
+ Mage::getSingleton('core/session')->getKlevuNewPassword(),
31
+ $userPlan,
32
+ $partnerAccount,
33
+ Mage::getSingleton('core/session')->getKlevuNewUrl(),
34
+ Mage::getSingleton('core/session')->getMerchantEmail(),
35
+ Mage::getSingleton('core/session')->getContactNo()
36
+ );
37
+
38
+ if ($result["success"]) {
39
+ $session->setConfiguredCustomerId($result["customer_id"]);
40
+ if (isset($result["message"])) {
41
+ $session->addSuccess(Mage::helper("klevu_search")->__($result["message"]));
42
+ }
43
+ return $this->_forward("configure_store");
44
+ } else {
45
+ $session->addError(Mage::helper("klevu_search")->__($result["message"]));
46
+ return $this->_forward("configure_userplan");
47
+ }
48
+
49
+
50
+ return $this->_forward("configure_store");
51
+ }
52
  public function configure_userAction() {
53
  $this->loadLayout();
54
  $this->initLayoutMessages('klevu_search/session');
65
 
66
  $api = Mage::helper("klevu_search/api");
67
  $session = Mage::getSingleton('klevu_search/session');
68
+ Mage::getSingleton('core/session')->setHideStep("no");
69
  if ($request->getPost("klevu_existing_email")) {
70
  $result = $api->getUser(
71
  $request->getPost("klevu_existing_email"),
72
  $request->getPost("klevu_existing_password")
73
  );
74
+
75
+ if ($result["success"]) {
76
+ Mage::getSingleton('core/session')->setHideStep("yes");
77
+ $session->setConfiguredCustomerId($result["customer_id"]);
78
+ if (isset($result["message"])) {
79
+ $session->addSuccess(Mage::helper("klevu_search")->__($result["message"]));
80
+ }
81
+ return $this->_forward("configure_store");
82
+ } else {
83
+ $session->addError(Mage::helper("klevu_search")->__($result["message"]));
84
+ return $this->_forward("configure_user");
85
+ }
86
  } else {
87
+ $termsconditions = $request->getPost("termsconditions");
88
  $klevu_new_email = $request->getPost("klevu_new_email");
89
  $klevu_new_password = $request->getPost("klevu_new_password");
90
  $userPlan = $request->getPost("userPlan");
93
  $merchantEmail = $request->getPost("merchantEmail");
94
  $contactNo = $request->getPost("countyCode")."-".$request->getPost("contactNo");
95
  $error = true;
96
+ if(empty($klevu_new_email) || empty($klevu_new_password) || empty($klevu_new_url)
97
+ || empty($merchantEmail) ) {
98
  $session->addError(Mage::helper("klevu_search")->__("Missing details in the form. Please check."));
99
  return $this->_forward("configure_user");
100
  } else if(!preg_match("/^[_\.0-9a-zA-Z-]+@([0-9a-zA-Z][0-9a-zA-Z-]+\.)+[a-zA-Z]{2,6}$/i",$klevu_new_email)) {
103
  } else if(!preg_match("/^[_\.0-9a-zA-Z-]+@([0-9a-zA-Z][0-9a-zA-Z-]+\.)+[a-zA-Z]{2,6}$/i",$merchantEmail)) {
104
  $session->addError(Mage::helper("klevu_search")->__("Please enter valid Retailer Email."));
105
  return $this->_forward("configure_user");
106
+ }else if(empty($termsconditions)){
107
+ $session->addError(Mage::helper("klevu_search")->__("Please accept terms and conditions."));
108
+ return $this->_forward("configure_user");
109
  }else {
110
+
111
+ $result = $api->checkUserDetail(
112
+ $request->getPost("klevu_new_email")
113
+ );
114
+ if ($result["success"]) {
115
+ Mage::getSingleton('core/session')->setTermsconditions($request->getPost("termsconditions"));
116
+ Mage::getSingleton('core/session')->setKlevuNewEmail($request->getPost("klevu_new_email"));
117
+ Mage::getSingleton('core/session')->setKlevuNewPassword($request->getPost("klevu_new_password"));
118
+ Mage::getSingleton('core/session')->setKlevuNewUrl($request->getPost("klevu_new_url"));
119
+ Mage::getSingleton('core/session')->setMerchantEmail($request->getPost("merchantEmail"));
120
+ $contactNo = $request->getPost("countyCode")."-".$request->getPost("contactNo");
121
+ Mage::getSingleton('core/session')->setContactNo($contactNo);
122
+ return $this->_forward("configure_userplan");
123
+ } else {
124
+ $session->addError(Mage::helper("klevu_search")->__($result["message"]));
125
+ return $this->_forward("configure_user");
126
+ }
127
  }
128
  }
129
+
 
 
 
 
 
 
 
 
 
 
130
  }
131
 
132
  public function configure_storeAction() {
149
  }
150
 
151
  public function configure_store_postAction() {
 
152
 
153
+ $request = $this->getRequest();
154
  if (!$request->isPost() || !$request->isAjax()) {
155
  return $this->_redirect("adminhtml/dashboard");
156
  }
189
  $config->setAnalyticsUrl($result['webstore']->getAnalyticsUrl(), $store, $test_mode);
190
  $config->setJsUrl($result['webstore']->getJsUrl(), $store, $test_mode);
191
  $config->setRestHostname($result['webstore']->getRestHostname(), $store, $test_mode);
192
+ $config->setTiresUrl($result['webstore']->getTiresUrl(), $store, $test_mode);
193
  if (isset($result["message"])) {
194
  $session->addSuccess(Mage::helper("klevu_search")->__($result["message"]));
195
  $session->setFirstSync($store_code);
199
  return $this->_forward("configure_store");
200
  }
201
  }
202
+
 
203
  $config->setTaxEnabledFlag($request->getPost("tax_enable"), $store);
204
  $config->setSecureUrlEnabledFlag($request->getPost("secureurl_setting"), $store);
205
 
app/code/community/Klevu/Search/controllers/Adminhtml/Klevu/SearchController.php CHANGED
@@ -55,6 +55,9 @@ class Klevu_Search_Adminhtml_Klevu_SearchController extends Mage_Adminhtml_Contr
55
  Mage::getModel("klevu_search/product_sync")->runManually();
56
  /* Use event For other content sync */
57
  Mage::dispatchEvent('content_data_to_sync', array());
 
 
 
58
  return $this->_redirectReferer("adminhtml/dashboard");
59
  }
60
 
@@ -68,6 +71,8 @@ class Klevu_Search_Adminhtml_Klevu_SearchController extends Mage_Adminhtml_Contr
68
  } catch (Mage_Core_Model_Store_Exception $e) {
69
  Mage::logException($e);
70
  }
 
 
71
  return $this->_redirectReferer("adminhtml/dashboard");
72
  }
73
 
@@ -77,4 +82,8 @@ class Klevu_Search_Adminhtml_Klevu_SearchController extends Mage_Adminhtml_Contr
77
  Mage::helper('klevu_search/config')->saveSyncOptions($sync_options);
78
  }
79
 
 
 
 
 
80
  }
55
  Mage::getModel("klevu_search/product_sync")->runManually();
56
  /* Use event For other content sync */
57
  Mage::dispatchEvent('content_data_to_sync', array());
58
+ Mage::getSingleton('klevu_search/session')->unsFirstSync();
59
+ $storeId = Mage_Core_Model_App::ADMIN_STORE_ID;
60
+ Mage::app()->setCurrentStore($storeId);
61
  return $this->_redirectReferer("adminhtml/dashboard");
62
  }
63
 
71
  } catch (Mage_Core_Model_Store_Exception $e) {
72
  Mage::logException($e);
73
  }
74
+ $storeId = Mage_Core_Model_App::ADMIN_STORE_ID;
75
+ Mage::app()->setCurrentStore($storeId);
76
  return $this->_redirectReferer("adminhtml/dashboard");
77
  }
78
 
82
  Mage::helper('klevu_search/config')->saveSyncOptions($sync_options);
83
  }
84
 
85
+ protected function _isAllowed()
86
+ {
87
+ return true;
88
+ }
89
  }
app/code/community/Klevu/Search/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Klevu_Search>
5
- <version>1.1.26</version>
6
  </Klevu_Search>
7
  </modules>
8
  <global>
@@ -10,6 +10,11 @@
10
  <klevu_search>
11
  <class>Klevu_Search_Block</class>
12
  </klevu_search>
 
 
 
 
 
13
  </blocks>
14
  <helpers>
15
  <klevu_search>
@@ -171,6 +176,24 @@
171
  </klevu_search_categroy_product_sync>
172
  </observers>
173
  </catalog_category_change_products>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
174
  <review_save_after>
175
  <observers>
176
  <ratingsUpdate>
@@ -180,6 +203,24 @@
180
  </ratingsUpdate>
181
  </observers>
182
  </review_save_after>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
183
  </events>
184
  </global>
185
  <admin>
@@ -243,6 +284,7 @@
243
  <model>klevu_search/order_sync::run</model>
244
  </run>
245
  </klevu_search_order_sync>
 
246
  </jobs>
247
  </crontab>
248
  <default>
@@ -259,6 +301,7 @@
259
  <test_analytics_url>stats.klevu.com</test_analytics_url>
260
  <js_url>js.klevu.com</js_url>
261
  <test_js_url>js.klevu.com</test_js_url>
 
262
  </general>
263
  <product_sync>
264
  <enabled>1</enabled>
2
  <config>
3
  <modules>
4
  <Klevu_Search>
5
+ <version>1.2.0</version>
6
  </Klevu_Search>
7
  </modules>
8
  <global>
10
  <klevu_search>
11
  <class>Klevu_Search_Block</class>
12
  </klevu_search>
13
+ <adminhtml>
14
+ <rewrite>
15
+ <system_config_form_field>Klevu_Search_Block_Adminhtml_System_Config_Form_Field</system_config_form_field>
16
+ </rewrite>
17
+ </adminhtml>
18
  </blocks>
19
  <helpers>
20
  <klevu_search>
176
  </klevu_search_categroy_product_sync>
177
  </observers>
178
  </catalog_category_change_products>
179
+ <catalog_category_save_after>
180
+ <observers>
181
+ <catalog_category_page_prepare_save>
182
+ <type>singleton</type>
183
+ <class>klevu_search/observer</class>
184
+ <method>scheduleProductSync</method>
185
+ </catalog_category_page_prepare_save>
186
+ </observers>
187
+ </catalog_category_save_after>
188
+ <catalog_controller_category_delete>
189
+ <observers>
190
+ <catalog_controller_category_delete_page>
191
+ <type>singleton</type>
192
+ <class>klevu_search/observer</class>
193
+ <method>scheduleProductSync</method>
194
+ </catalog_controller_category_delete_page>
195
+ </observers>
196
+ </catalog_controller_category_delete>
197
  <review_save_after>
198
  <observers>
199
  <ratingsUpdate>
203
  </ratingsUpdate>
204
  </observers>
205
  </review_save_after>
206
+ <catalogrule_before_apply>
207
+ <observers>
208
+ <catalogruleexpiryupdatebefore>
209
+ <type>singleton</type>
210
+ <class>klevu_search/product_sync</class>
211
+ <method>catalogruleupdateifno</method>
212
+ </catalogruleexpiryupdatebefore>
213
+ </observers>
214
+ </catalogrule_before_apply>
215
+ <catalogrule_after_apply>
216
+ <observers>
217
+ <catalogruleexpiryupdateafter>
218
+ <type>singleton</type>
219
+ <class>klevu_search/product_sync</class>
220
+ <method>catalogruleupdateifno</method>
221
+ </catalogruleexpiryupdateafter>
222
+ </observers>
223
+ </catalogrule_after_apply>
224
  </events>
225
  </global>
226
  <admin>
284
  <model>klevu_search/order_sync::run</model>
285
  </run>
286
  </klevu_search_order_sync>
287
+
288
  </jobs>
289
  </crontab>
290
  <default>
301
  <test_analytics_url>stats.klevu.com</test_analytics_url>
302
  <js_url>js.klevu.com</js_url>
303
  <test_js_url>js.klevu.com</test_js_url>
304
+ <tiers_url>tiers.klevu.com</tiers_url>
305
  </general>
306
  <product_sync>
307
  <enabled>1</enabled>
app/code/community/Klevu/Search/etc/system.xml CHANGED
@@ -26,7 +26,7 @@
26
  </information>
27
  <general translate="label">
28
  <label>General Settings</label>
29
- <sort_order>100</sort_order>
30
  <expanded>1</expanded>
31
  <show_in_default>1</show_in_default>
32
  <show_in_website>1</show_in_website>
@@ -106,31 +106,50 @@
106
  <show_in_website>0</show_in_website>
107
  <show_in_store>1</show_in_store>
108
  </js_url>
109
-
 
 
 
 
 
 
 
110
  </fields>
111
  </general>
112
  <searchlanding translate="label">
113
- <label>Search Result Page Settings</label>
114
  <sort_order>101</sort_order>
115
  <show_in_default>1</show_in_default>
116
  <show_in_website>1</show_in_website>
117
  <show_in_store>1</show_in_store>
 
 
 
118
  <fields>
 
 
 
 
 
 
 
 
 
119
  <landenabled translate="label">
120
  <label>Search Result Page</label>
121
- <comment><![CDATA[** "Preserves Your Theme Layout" option preserves layout of your theme.]]></comment>
122
  <frontend_type>select</frontend_type>
123
  <source_model>klevu_search/system_config_source_landingoptions</source_model>
124
  <sort_order>100</sort_order>
125
- <show_in_default>1</show_in_default>
126
- <show_in_website>1</show_in_website>
127
  <show_in_store>1</show_in_store>
128
  </landenabled>
129
  </fields>
130
  </searchlanding>
131
  <product_sync translate="label">
132
  <label>Product Sync Settings</label>
133
- <sort_order>250</sort_order>
134
  <show_in_default>1</show_in_default>
135
  <show_in_website>1</show_in_website>
136
  <show_in_store>1</show_in_store>
@@ -192,7 +211,7 @@
192
  </product_sync>
193
  <order_sync translate="label">
194
  <label>Order Sync Settings</label>
195
- <sort_order>201</sort_order>
196
  <show_in_default>1</show_in_default>
197
  <show_in_default>1</show_in_default>
198
  <show_in_store>1</show_in_store>
@@ -228,15 +247,37 @@
228
  </last_run>
229
  </fields>
230
  </order_sync>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
231
  <attributes translate="label">
232
- <label>Product Attribute Settings</label>
233
- <sort_order>101</sort_order>
234
  <show_in_default>1</show_in_default>
235
  <show_in_website>1</show_in_website>
236
  <show_in_store>1</show_in_store>
 
 
 
237
  <fields>
238
  <info_attribute translate="label comment">
239
- <label>Attribute Settings</label>
240
  <comment><![CDATA[Switch to store view scope to set]]></comment>
241
  <frontend_type>label</frontend_type>
242
  <sort_order>100</sort_order>
@@ -264,16 +305,6 @@
264
  <show_in_website>0</show_in_website>
265
  <show_in_store>0</show_in_store>
266
  </automatic>
267
- <boosting translate="label comment">
268
- <label>Boosting Attribute</label>
269
- <comment><![CDATA[Select the attribute you wish to use as the Boosting attribute in Klevu. The Boosting attribute is a decimal or integer product attribute. To promote a product simply give the product a score higher than 1 and to demote give a score lower than 1 (i.e. 0.1).]]></comment>
270
- <frontend_type>select</frontend_type>
271
- <source_model>klevu_search/system_config_source_boosting_attribute</source_model>
272
- <sort_order>800</sort_order>
273
- <show_in_default>0</show_in_default>
274
- <show_in_website>0</show_in_website>
275
- <show_in_store>1</show_in_store>
276
- </boosting>
277
  <other translate="label comment">
278
  <label>Other Attributes To Use In Search</label>
279
  <comment><![CDATA[By default, Klevu uses the following attributes in search: name, sku, description, short_description, price and rating. To add more attributes to search, please select one or more attributes from the list above. Once you have selected the respective attributes, please make sure to resynchronize all the products.]]></comment>
@@ -294,18 +325,20 @@
294
  <show_in_website>0</show_in_website>
295
  <show_in_store>1</show_in_store>
296
  </info_attribute_filters>
297
-
298
  </fields>
299
  </attributes>
300
  <tax_setting translate="label">
301
- <label>Tax Settings</label>
302
- <sort_order>898</sort_order>
303
  <show_in_default>1</show_in_default>
304
  <show_in_website>0</show_in_website>
305
  <show_in_store>1</show_in_store>
 
 
 
306
  <fields>
307
  <info_enabled translate="label comment">
308
- <label>Include Tax in Price</label>
309
  <comment><![CDATA[Switch to store view scope to set]]></comment>
310
  <frontend_type>label</frontend_type>
311
  <sort_order>100</sort_order>
@@ -326,15 +359,18 @@
326
  </fields>
327
  </tax_setting>
328
  <secureurl_setting translate="label">
329
- <label>Secure Url Settings</label>
330
- <sort_order>899</sort_order>
331
  <show_in_default>1</show_in_default>
332
  <show_in_website>0</show_in_website>
333
  <show_in_store>1</show_in_store>
334
  <expanded>0</expanded>
 
 
 
335
  <fields>
336
  <info_enabled translate="label comment">
337
- <label>Use Secure Base Url for Products and Images</label>
338
  <comment><![CDATA[Switch to store view scope to set]]></comment>
339
  <frontend_type>label</frontend_type>
340
  <sort_order>100</sort_order>
26
  </information>
27
  <general translate="label">
28
  <label>General Settings</label>
29
+ <sort_order>2</sort_order>
30
  <expanded>1</expanded>
31
  <show_in_default>1</show_in_default>
32
  <show_in_website>1</show_in_website>
106
  <show_in_website>0</show_in_website>
107
  <show_in_store>1</show_in_store>
108
  </js_url>
109
+ <tiers_url translate="label comment">
110
+ <label>Tiers URL</label>
111
+ <comment><![CDATA[The Tiers URL is used for getting Klevu's Search Tires]]></comment>
112
+ <sort_order>200</sort_order>
113
+ <show_in_default>0</show_in_default>
114
+ <show_in_website>0</show_in_website>
115
+ <show_in_store>1</show_in_store>
116
+ </tiers_url>
117
  </fields>
118
  </general>
119
  <searchlanding translate="label">
120
+ <label>Search Result Page</label>
121
  <sort_order>101</sort_order>
122
  <show_in_default>1</show_in_default>
123
  <show_in_website>1</show_in_website>
124
  <show_in_store>1</show_in_store>
125
+ <comment>
126
+ <![CDATA[<div class="kuGuideLink"><a target="_blank" href="http://support.klevu.com/section/manuals/magento-manuals/search-result-page/">Quick Guide</a></div>
127
+ ]]></comment>
128
  <fields>
129
+ <landenabled_info translate="label comment">
130
+ <label></label>
131
+ <comment><![CDATA[Switch to store view scope to set.]]></comment>
132
+ <sort_order>100</sort_order>
133
+ <frontend_type>label</frontend_type>
134
+ <show_in_default>1</show_in_default>
135
+ <show_in_website>1</show_in_website>
136
+ <show_in_store>0</show_in_store>
137
+ </landenabled_info>
138
  <landenabled translate="label">
139
  <label>Search Result Page</label>
140
+ <comment><model>klevu_search/adminhtml_comment</model></comment>
141
  <frontend_type>select</frontend_type>
142
  <source_model>klevu_search/system_config_source_landingoptions</source_model>
143
  <sort_order>100</sort_order>
144
+ <show_in_default>0</show_in_default>
145
+ <show_in_website>0</show_in_website>
146
  <show_in_store>1</show_in_store>
147
  </landenabled>
148
  </fields>
149
  </searchlanding>
150
  <product_sync translate="label">
151
  <label>Product Sync Settings</label>
152
+ <sort_order>3</sort_order>
153
  <show_in_default>1</show_in_default>
154
  <show_in_website>1</show_in_website>
155
  <show_in_store>1</show_in_store>
211
  </product_sync>
212
  <order_sync translate="label">
213
  <label>Order Sync Settings</label>
214
+ <sort_order>4</sort_order>
215
  <show_in_default>1</show_in_default>
216
  <show_in_default>1</show_in_default>
217
  <show_in_store>1</show_in_store>
247
  </last_run>
248
  </fields>
249
  </order_sync>
250
+ <attribute_boost>
251
+ <label>Boosting Attribute Settings</label>
252
+ <sort_order>5</sort_order>
253
+ <show_in_default>0</show_in_default>
254
+ <show_in_website>0</show_in_website>
255
+ <show_in_store>1</show_in_store>
256
+ <fields>
257
+ <boosting translate="label comment">
258
+ <label>Boosting Attribute</label>
259
+ <comment><![CDATA[Select the attribute you wish to use as the Boosting attribute in Klevu. The Boosting attribute is a decimal or integer product attribute. To promote a product simply give the product a score higher than 1 and to demote give a score lower than 1 (i.e. 0.1).]]></comment>
260
+ <frontend_type>select</frontend_type>
261
+ <source_model>klevu_search/system_config_source_boosting_attribute</source_model>
262
+ <sort_order>800</sort_order>
263
+ <show_in_default>0</show_in_default>
264
+ <show_in_website>0</show_in_website>
265
+ <show_in_store>1</show_in_store>
266
+ </boosting>
267
+ </fields>
268
+ </attribute_boost>
269
  <attributes translate="label">
270
+ <label><![CDATA[Searchable ​Attributes & Facets]]></label>
271
+ <sort_order>5</sort_order>
272
  <show_in_default>1</show_in_default>
273
  <show_in_website>1</show_in_website>
274
  <show_in_store>1</show_in_store>
275
+ <comment>
276
+ <![CDATA[<div class="kuGuideLink"><a target="_blank" href="http://support.klevu.com/section/manuals/magento-manuals/facet-filter/">Quick Guide</a></div>
277
+ ]]></comment>
278
  <fields>
279
  <info_attribute translate="label comment">
280
+ <label></label>
281
  <comment><![CDATA[Switch to store view scope to set]]></comment>
282
  <frontend_type>label</frontend_type>
283
  <sort_order>100</sort_order>
305
  <show_in_website>0</show_in_website>
306
  <show_in_store>0</show_in_store>
307
  </automatic>
 
 
 
 
 
 
 
 
 
 
308
  <other translate="label comment">
309
  <label>Other Attributes To Use In Search</label>
310
  <comment><![CDATA[By default, Klevu uses the following attributes in search: name, sku, description, short_description, price and rating. To add more attributes to search, please select one or more attributes from the list above. Once you have selected the respective attributes, please make sure to resynchronize all the products.]]></comment>
325
  <show_in_website>0</show_in_website>
326
  <show_in_store>1</show_in_store>
327
  </info_attribute_filters>
 
328
  </fields>
329
  </attributes>
330
  <tax_setting translate="label">
331
+ <label>Tax in Price</label>
332
+ <sort_order>7</sort_order>
333
  <show_in_default>1</show_in_default>
334
  <show_in_website>0</show_in_website>
335
  <show_in_store>1</show_in_store>
336
+ <comment>
337
+ <![CDATA[<div class="kuGuideLink"><a target="_blank" href="http://support.klevu.com/knowledgebase/include-tax-in-price/">Quick Guide</a></div>
338
+ ]]></comment>
339
  <fields>
340
  <info_enabled translate="label comment">
341
+ <label></label>
342
  <comment><![CDATA[Switch to store view scope to set]]></comment>
343
  <frontend_type>label</frontend_type>
344
  <sort_order>100</sort_order>
359
  </fields>
360
  </tax_setting>
361
  <secureurl_setting translate="label">
362
+ <label>Secure URL</label>
363
+ <sort_order>8</sort_order>
364
  <show_in_default>1</show_in_default>
365
  <show_in_website>0</show_in_website>
366
  <show_in_store>1</show_in_store>
367
  <expanded>0</expanded>
368
+ <comment>
369
+ <![CDATA[<div class="kuGuideLink"><a target="_blank" href="http://support.klevu.com/knowledgebase/use-secure-base-url-for-products-and-images/">Quick Guide</a></div>
370
+ ]]></comment>
371
  <fields>
372
  <info_enabled translate="label comment">
373
+ <label></label>
374
  <comment><![CDATA[Switch to store view scope to set]]></comment>
375
  <frontend_type>label</frontend_type>
376
  <sort_order>100</sort_order>
app/code/community/Klevu/Search/sql/klevu_search_setup/mysql4-data-upgrade-1.1.27-1.1.28.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /** @var Mage_Core_Model_Resource_Setup $installer */
3
+ $installer = $this;
4
+ $installer->startSetup();
5
+ $core_config_data = $installer->getTable('core_config_data');
6
+ $installer->run("UPDATE {$core_config_data} SET `path` = 'klevu_search/attribute_boost/boosting' WHERE path LIKE '%klevu_search/attributes/boosting%'");
7
+ $installer->run("UPDATE {$core_config_data} SET `path` = 'klevu_search/add_to_cart/enabledaddtocartfront' WHERE path LIKE '%klevu_search/add_to_cart/enabled%'");
8
+ $installer->endSetup();
app/code/community/Klevu/Searchterms/Block/Catalog/Product/Popularterms.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Klevu_Searchterms_Block_Catalog_Product_Popularterms extends Mage_Core_Block_Template {
4
+ /**
5
+ * Get the popular search terms
6
+ * @return string
7
+ * @throws Exception
8
+ */
9
+ public function getPopularterms() {
10
+ // Get the product
11
+ return Mage::getModel("klevu_searchterms/product_seo")->getSearchTerms();
12
+ }
13
+ }
app/code/community/Klevu/Searchterms/Block/Popularterms.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Klevu_Searchterms_Block_Catalog_Product_Popularterms extends Mage_Core_Block_Template {
4
+ /**
5
+ * Get the popular search terms
6
+ * @return string
7
+ * @throws Exception
8
+ */
9
+ public function getPopularterms() {
10
+ // Get the product
11
+ return Mage::getModel("klevu_searchterms/product_seo")->getSearchTerms();
12
+ }
13
+ }
app/code/community/Klevu/Searchterms/Helper/Data.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Klevu_Searchterms_Helper_Data extends Mage_Core_Helper_Abstract
3
+ {
4
+ const XML_PATH_POPULARSEARCH_ENABLED = "klevu_search/popular_search_term/enabledpopulartermfront";
5
+
6
+ /**
7
+ * Check if the add to cart is enabled in the system configuration for the current store.
8
+ *
9
+ * @param $store_id
10
+ *
11
+ * @return bool
12
+ */
13
+ public function isPoplularSearchPageEnabled($store_id = null) {
14
+ return Mage::getStoreConfigFlag(static::XML_PATH_POPULARSEARCH_ENABLED, $store_id);
15
+ }
16
+
17
+ }
18
+
app/code/community/Klevu/Searchterms/Model/Api/Action/Boostingscore.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Klevu_Learning_Model_Api_Action_Boostingscore extends Klevu_Search_Model_Api_Action {
4
+
5
+ const ENDPOINT = "/cloud-search/learningNavigation";
6
+ const METHOD = "POST";
7
+ const DEFAULT_REQUEST_MODEL = "klevu_search/api_request_post";
8
+ const DEFAULT_RESPONSE_MODEL = "klevu_search/api_response_data";
9
+
10
+ protected function validate($parameters) {
11
+
12
+ $errors = array();
13
+
14
+ if (!isset($parameters["restApiKey"]) || empty($parameters["restApiKey"])) {
15
+ $errors["restApiKey"] = "Missing Rest API key.";
16
+ }
17
+
18
+ if (!isset($parameters["resetData"]) || empty($parameters["resetData"])) {
19
+ $errors["resetData"] = "Missing Reset Flag.";
20
+ }
21
+
22
+ if (!isset($parameters["ack"]) || empty($parameters["ack"])) {
23
+ $errors["ack"] = "Missing Acknowledge Flag.";
24
+ }
25
+
26
+ if (count($errors) == 0) {
27
+ return true;
28
+ }
29
+ return $errors;
30
+ }
31
+ /**
32
+ * Execute the API action with the given parameters.
33
+ *
34
+ * @param array $parameters
35
+ *
36
+ * @return Klevu_Search_Model_Api_Response
37
+ */
38
+ public function execute($parameters = array()) {
39
+
40
+ $validation_result = $this->validate($parameters);
41
+ if ($validation_result !== true) {
42
+ return Mage::getModel('klevu_search/api_response_invalid')->setErrors($validation_result);
43
+ }
44
+
45
+ $request = $this->getRequest();
46
+ $endpoint = Mage::helper('klevu_search/api')->buildEndpoint(static::ENDPOINT, $this->getStore(), Mage::helper('learning')->getLearningUrl($this->getStore()));
47
+ $request
48
+ ->setResponseModel($this->getResponse())
49
+ ->setEndpoint($endpoint)
50
+ ->setMethod(static::METHOD)
51
+ ->setData($parameters);
52
+ return $request->send();
53
+
54
+ }
55
+ }
app/code/community/Klevu/Searchterms/Model/Api/Action/Popularterms.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Klevu_Searchterms_Model_Api_Action_Popularterms extends Klevu_Search_Model_Api_Action {
4
+
5
+ const ENDPOINT = "/analytics/webstorePopularSearches";
6
+ const METHOD = "POST";
7
+ const DEFAULT_REQUEST_MODEL = "klevu_search/api_request_post";
8
+ const DEFAULT_RESPONSE_MODEL = "klevu_search/api_response_data";
9
+
10
+ protected function validate($parameters) {
11
+ $errors = array();
12
+
13
+ if (!isset($parameters["klevuApiKey"]) || empty($parameters["klevuApiKey"])) {
14
+ $errors["klevuApiKey"] = "Missing JS API key.";
15
+ }
16
+
17
+ if (count($errors) == 0) {
18
+ return true;
19
+ }
20
+ return $errors;
21
+ }
22
+
23
+
24
+ /**
25
+ * Execute the API action with the given parameters.
26
+ *
27
+ * @param array $parameters
28
+ *
29
+ * @return Klevu_Search_Model_Api_Response
30
+ */
31
+ public function execute($parameters = array()) {
32
+
33
+ $validation_result = $this->validate($parameters);
34
+ if ($validation_result !== true) {
35
+ return Mage::getModel('klevu_search/api_response_invalid')->setErrors($validation_result);
36
+ }
37
+
38
+ $request = $this->getRequest();
39
+
40
+ $endpoint = Mage::helper('klevu_search/api')->buildEndpoint(
41
+ static::ENDPOINT,
42
+ $this->getStore(),
43
+ null
44
+ );
45
+
46
+ $request
47
+ ->setResponseModel($this->getResponse())
48
+ ->setEndpoint($endpoint)
49
+ ->setMethod(static::METHOD)
50
+ ->setData($parameters);
51
+
52
+ return $request->send();
53
+ }
54
+
55
+ }
app/code/community/Klevu/Searchterms/Model/Observer.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class Klevu_Search_Model_Observer
5
+ *
6
+ */
7
+ class Klevu_Searchterms_Model_Observer {
8
+
9
+ // Get n popular products with fromdate and todate
10
+ public function applySearchtermsPageModelRewrites(Varien_Event_Observer $observer)
11
+ {
12
+ $config = Mage::helper('klevu_searchterms');
13
+ if ($config->isPoplularSearchPageEnabled()) {
14
+ Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('popular-search-terms'));
15
+ }
16
+
17
+ }
18
+ }
app/code/community/Klevu/Searchterms/Model/Product/Seo.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class Klevu_Searchterms_Model_Product_Seo
5
+ *
6
+ */
7
+ class Klevu_Searchterms_Model_Product_Seo {
8
+
9
+ /**
10
+ * Return the JS API key for the given store.
11
+ *
12
+ * @param $store_id
13
+ *
14
+ * @return string|null
15
+ */
16
+ public function getApiKey($store_id) {
17
+ $api_keys = array();
18
+ if (!isset($api_keys[$store_id])) {
19
+ $api_keys[$store_id] = Mage::helper("klevu_search/config")->getJsApiKey($store_id);
20
+ }
21
+ return $api_keys[$store_id];
22
+ }
23
+
24
+ // Get n popular search terms
25
+ public function getSearchTerms()
26
+ {
27
+ $param = array( "klevuApiKey" => $this->getApiKey(Mage::app()->getStore()->getStoreId()),
28
+ "topN"=> 1000);
29
+ $response = Mage::getModel("klevu_searchterms/api_action_popularterms")
30
+ ->setStore(Mage::app()->getStore())
31
+ ->execute($param);
32
+ $populersearch = $response->getData();
33
+ if(!empty($populersearch)) {
34
+ return $populersearch['term'];
35
+ }
36
+ }
37
+
38
+ // Get n popular products with fromdate and todate
39
+ public function getPopularProducts()
40
+ {
41
+ $param = array( "klevuApiKey" => $this->getApiKey(Mage::app()->getStore()->getStoreId()));
42
+ $response = Mage::getModel("klevu_searchterms/api_action_popularterms")
43
+ ->setStore(Mage::app()->getStore())
44
+ ->execute($param);
45
+ $popularproducts = $response->getData();
46
+ if(!empty($popularproducts)) {
47
+ return $popularproducts['product'];
48
+ }
49
+ }
50
+ }
app/code/community/Klevu/Searchterms/controllers/IndexController.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Klevu_Searchterms_IndexController extends Mage_Core_Controller_Front_Action{
3
+ public function IndexAction() {
4
+
5
+ $this->loadLayout();
6
+ $this->getLayout()->getBlock("head")->setTitle($this->__("Popular Search Terms"));
7
+ $breadcrumbs = $this->getLayout()->getBlock("breadcrumbs");
8
+ $breadcrumbs->addCrumb("home", array(
9
+ "label" => $this->__("Home"),
10
+ "title" => $this->__("Home"),
11
+ "link" => Mage::getBaseUrl()
12
+ ));
13
+
14
+ $breadcrumbs->addCrumb("titlename", array(
15
+ "label" => $this->__("Popular Search Terms"),
16
+ "title" => $this->__("Popular Search Terms")
17
+ ));
18
+
19
+ $this->renderLayout();
20
+
21
+ }
22
+ }
app/code/community/Klevu/Searchterms/etc/config.xml ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Klevu_Searchterms>
5
+ <version>10.0.4</version>
6
+ </Klevu_Searchterms>
7
+ </modules>
8
+ <frontend>
9
+ <routers>
10
+ <searchterms>
11
+ <use>standard</use>
12
+ <args>
13
+ <module>Klevu_Searchterms</module>
14
+ <frontName>popular-search-terms</frontName>
15
+ </args>
16
+ </searchterms>
17
+ </routers>
18
+ <layout>
19
+ <updates>
20
+ <searchterms>
21
+ <file>klevu/searchterms.xml</file>
22
+ </searchterms>
23
+ </updates>
24
+ </layout>
25
+ </frontend>
26
+ <global>
27
+ <helpers>
28
+ <klevu_searchterms>
29
+ <class>Klevu_Searchterms_Helper</class>
30
+ </klevu_searchterms>
31
+ </helpers>
32
+ <models>
33
+ <klevu_searchterms>
34
+ <class>Klevu_Searchterms_Model</class>
35
+ </klevu_searchterms>
36
+ </models>
37
+ <events>
38
+ <controller_action_predispatch_catalogsearch_term_popular>
39
+ <observers>
40
+ <controller_action_predispatch_catalogsearch_term_popular_handler>
41
+ <type>singleton</type>
42
+ <class>klevu_searchterms/observer</class>
43
+ <method>applySearchtermsPageModelRewrites</method>
44
+ <args></args>
45
+ </controller_action_predispatch_catalogsearch_term_popular_handler>
46
+ </observers>
47
+ </controller_action_predispatch_catalogsearch_term_popular>
48
+ </events>
49
+ <blocks>
50
+ <klevu_searchterms>
51
+ <class>Klevu_Searchterms_Block</class>
52
+ </klevu_searchterms>
53
+ </blocks>
54
+ <resources>
55
+ <klevu_searchterms_setup>
56
+ <setup>
57
+ <module>Klevu_Searchterms</module>
58
+ </setup>
59
+ <connection>
60
+ <use>core_setup</use>
61
+ </connection>
62
+ </klevu_searchterms_setup>
63
+ </resources>
64
+ </global>
65
+ <default>
66
+ <klevu_search>
67
+ <popular_search_term>
68
+ <enabled>0</enabled>
69
+ </popular_search_term>
70
+ </klevu_search>
71
+ </default>
72
+ </config>
app/code/community/Klevu/Searchterms/etc/system.xml ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <sections>
4
+ <klevu_search translate="label" module="klevu_search">
5
+ <groups>
6
+ <popular_search_term translate="label">
7
+ <label>Search Terms Page</label>
8
+ <sort_order>1000</sort_order>
9
+ <show_in_default>1</show_in_default>
10
+ <show_in_website>1</show_in_website>
11
+ <show_in_store>1</show_in_store>
12
+ <comment>
13
+ <![CDATA[<div class="kuGuideLink"><a target="_blank" href="http://support.klevu.com/section/manuals/magento-manuals/search-term-page/">Quick Guide</a></div>
14
+ ]]></comment>
15
+ <fields>
16
+ <enabled_info translate="label comment">
17
+ <label></label>
18
+ <comment><![CDATA[Switch to store view scope to set.]]></comment>
19
+ <sort_order>100</sort_order>
20
+ <frontend_type>label</frontend_type>
21
+ <show_in_default>1</show_in_default>
22
+ <show_in_website>1</show_in_website>
23
+ <show_in_store>0</show_in_store>
24
+ </enabled_info>
25
+ <enabledpopulartermfront translate="label">
26
+ <label>Enable search term page</label>
27
+ <frontend_type>select</frontend_type>
28
+ <source_model>adminhtml/system_config_source_yesno</source_model>
29
+ <sort_order>100</sort_order>
30
+ <show_in_default>0</show_in_default>
31
+ <show_in_website>0</show_in_website>
32
+ <show_in_store>1</show_in_store>
33
+ </enabledpopulartermfront>
34
+ </fields>
35
+ </popular_search_term>
36
+ </groups>
37
+ </klevu_search>
38
+ </sections>
39
+ </config>
app/code/community/Klevu/Searchterms/sql/klevu_searchterms_setup/mysql4-data-upgrade-10.0.0-10.0.1.php ADDED
File without changes
app/code/community/Klevu/Searchterms/sql/klevu_searchterms_setup/mysql4-install-10.0.0.php ADDED
File without changes
app/design/adminhtml/default/default/layout/klevu/boosting.xml ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <boosting_adminhtml_boost_index>
4
+ <reference name="messages">
5
+ <action method="addNotice" translate="message">
6
+ <message><![CDATA[Steps:</br>
7
+ 1. Click on the "Add New Rule" button to start adding Product Boosting Rules.</br>
8
+ 2. Once you are done with adding rules, at the store view scope, choose the option "Apply Product Boosting Rules" for the "Boosting attribute".</br>
9
+ 3. Resynchronize ALL your products.]]>
10
+ </message>
11
+ </action>
12
+ </reference>
13
+ <reference name="head">
14
+ <action method="setCanLoadExtJs"><flag>1</flag></action>
15
+ <action method="setCanLoadRulesJs"><flag>1</flag></action>
16
+ </reference>
17
+ <reference name="content">
18
+ <block type="boosting/adminhtml_boost" name="boost" />
19
+ </reference>
20
+ </boosting_adminhtml_boost_index>
21
+ <boosting_adminhtml_boost_edit>
22
+ <reference name="head">
23
+ <action method="setCanLoadExtJs"><flag>1</flag></action>
24
+ <action method="setCanLoadRulesJs"><flag>1</flag></action>
25
+ </reference>
26
+ </boosting_adminhtml_boost_edit>
27
+ <boosting_adminhtml_boost_new>
28
+ <reference name="head">
29
+ <action method="setCanLoadExtJs"><flag>1</flag></action>
30
+ <action method="setCanLoadRulesJs"><flag>1</flag></action>
31
+ </reference>
32
+ </boosting_adminhtml_boost_new>
33
+ </layout>
app/design/adminhtml/default/default/layout/klevu/search.xml CHANGED
@@ -4,13 +4,13 @@
4
  <default>
5
  <reference name="head">
6
  <action method="addItem"><type>skin_css</type><name>klevu/search/notifications.css</name></action>
 
7
  </reference>
8
  <reference name="notifications">
9
  <block type="klevu_search/adminhtml_notifications" name="klevu_notifications"
10
  template="klevu/search/notifications.phtml"/>
11
  </reference>
12
  </default>
13
-
14
  <adminhtml_catalog_product_index>
15
  <reference name="products_list">
16
  <action method="addButton" ifconfig="klevu_search/product_sync/enabled">
@@ -35,6 +35,14 @@
35
  <block type="core/messages" name="messages" as="messages" />
36
  </block>
37
  </adminhtml_klevu_search_wizard_configure_user>
 
 
 
 
 
 
 
 
38
 
39
  <adminhtml_klevu_search_wizard_configure_store>
40
  <remove name="root" />
4
  <default>
5
  <reference name="head">
6
  <action method="addItem"><type>skin_css</type><name>klevu/search/notifications.css</name></action>
7
+ <action method="addItem"><type>skin_css</type><name>klevu/search/klevumagestyle.css</name></action>
8
  </reference>
9
  <reference name="notifications">
10
  <block type="klevu_search/adminhtml_notifications" name="klevu_notifications"
11
  template="klevu/search/notifications.phtml"/>
12
  </reference>
13
  </default>
 
14
  <adminhtml_catalog_product_index>
15
  <reference name="products_list">
16
  <action method="addButton" ifconfig="klevu_search/product_sync/enabled">
35
  <block type="core/messages" name="messages" as="messages" />
36
  </block>
37
  </adminhtml_klevu_search_wizard_configure_user>
38
+
39
+ <adminhtml_klevu_search_wizard_configure_userplan>
40
+ <remove name="root"/>
41
+ <block type="klevu_search/adminhtml_wizard_configure_userplan" name="configure_userplan"
42
+ template="klevu/search/wizard/configure/userplan.phtml" output="toHtml">
43
+ <block type="core/messages" name="messages" as="messages" />
44
+ </block>
45
+ </adminhtml_klevu_search_wizard_configure_userplan>
46
 
47
  <adminhtml_klevu_search_wizard_configure_store>
48
  <remove name="root" />
app/design/adminhtml/default/default/template/klevu/boosting/form/field/rule/button.phtml ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php /** @var Klevu_Search_Block_Adminhtml_Form_Field_Sync_Button $this */ ?>
2
+ <?php
3
+ $check_preserve = Mage::getModel("klevu_search/product_sync")->getFeatures();
4
+ if(!empty($check_preserve['disabled'])) {
5
+ $disable_features = explode(",",$check_preserve['disabled']);
6
+ } else {
7
+ $disable_features = array();
8
+ }
9
+ ?>
10
+ <button id="<?php echo $this->getHtmlId() ?>" class="scalable <?php if (in_array("boosting", $disable_features)) {?>klevu-btn-disabled <?php } ?>" type="button" <?php if (in_array("boosting", $disable_features)) {?> disabled="disabled" style="opacity:0.60" <?php } ?>>
11
+ <span><?php echo $this->__($this->getButtonLabel()) ?></span>
12
+ </button>
13
+ <script type="text/javascript">
14
+ $("<?php echo $this->getHtmlId() ?>").observe("click", function () {
15
+ window.open('<?php echo $this->getDestinationUrl() ?>','_blank');
16
+ });
17
+ </script>
app/design/adminhtml/default/default/template/klevu/search/form/information.phtml CHANGED
@@ -1,10 +1,36 @@
1
  <?php /** @var Klevu_Search_Block_Adminhtml_Form_Information $this */ ?>
2
- <p><?php echo $this->__("Installed Version: {$this->getVersion()}") ?></br></p>
3
- <p><b><?php echo $this->__("Prerequisites:") ?></b></br>
4
- <?php echo $this->__("1. Ensure cron is running > (<a href='http://www.klevu.com/support/setup-cron.html' target='_blank'>click here</a> for more information on setting up a cron)") ?></br>
5
- <?php echo $this->__("2. Indices are uptodate (System > Index Management)") ?></br>
6
- <?php echo $this->__("3. Products should be enabled and have the visibility set to catalog and search.") ?></p>
7
- <p><b><?php echo $this->__(" Klevu Merchant Centre: <a href='https://box.klevu.com' target='_blank'>https://box.klevu.com</a>");?></b></p>
8
- <p><?php echo $this->__("Once the Klevu Search is working on your website, login into Klevu Merchant Centre account to change look and feel of your search results, setup product promotions, see search activity, upgrade your account and lot more.");?></p>
9
- <p><b><?php echo $this->__("FAQs and Troubleshooting: <a href='http://www.klevu.com/support/support-home.html' target='_blank'>click here</a>");?></b></p>
10
- <p><b><?php echo $this->__("Migrating from staging to live: <a href='http://www.klevu.com/support/staging-to-live.html' target='_blank'>click here</a>");?></b></p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <?php /** @var Klevu_Search_Block_Adminhtml_Form_Information $this */ ?>
2
+ <div class="kuInfo">
3
+ <div class="kuInfo-fLeft">
4
+ <p><b><?php echo $this->__("Installed Version:") ?></b> <?php echo $this->__("{$this->getVersion()}") ?></br></p>
5
+ <?php $check_plan = Mage::getModel("klevu_search/product_sync")->getFeatures();?>
6
+ <?php if(empty($check_plan["errors"]) && !empty($check_plan)) { ?>
7
+ <p>
8
+ <?php if(!empty($check_plan['user_plan_for_store'])) {?>
9
+ <b><?php echo $this->__("My Current Plan:") ?></b>
10
+ <?php echo ucfirst($check_plan['user_plan_for_store']);
11
+ } ?>
12
+ <?php if(!empty($check_plan['upgrade_label'])) { ?>
13
+ <button type='button' onClick=upgradeLink('<?php echo $check_plan["upgrade_url"]; ?>')><?php echo $check_plan['upgrade_label']; ?></button>
14
+ &nbsp;&nbsp;<a href="#" onClick="compareplan();"><?php echo $this->__("Compare Plans"); ?></a>
15
+ <?php } ?>
16
+ </p>
17
+ <?php } ?>
18
+ </div>
19
+ <div class="kuInfo-fRight">
20
+ <ul>
21
+ <li><b>Quick Links:</b></li>
22
+ <li><a target="_blank" href="http://support.klevu.com/knowledgebase/integration-steps-for-magento/"><?php echo $this->__("Integration Steps");?></a></li>
23
+ <li><a target="_blank" href="http://support.klevu.com/section/manuals/magento-manuals/migrate-klevu-search-from-staging-to-live/"><?php echo $this->__("Migrating from Staging to Live");?></a></li>
24
+ <li><a target="_blank" href="http://support.klevu.com/faq/faqs/how-to-upgrade-my-current-plan/"><?php echo $this->__("How to upgrade plan?");?></a></li>
25
+ <li><a target="_blank" href="http://box.klevu.com/"><?php echo $this->__("Klevu Merchant Center");?></a></li>
26
+ </ul>
27
+ </div>
28
+ <div class="kuInfoClear"></div>
29
+ </div>
30
+ <div>
31
+ <p><b><?php echo $this->__("Prerequisites:") ?></b></br>
32
+ <?php echo $this->__("1. Ensure cron is running (<a href='http://support.klevu.com/knowledgebase/setup-a-cron/' target='_blank'>Click here</a> for more information on setting up a cron)") ?></br>
33
+ <?php echo $this->__("2. Indices are uptodate (System > Index Management)") ?></br>
34
+ <?php echo $this->__("3. Products should be enabled and have the visibility set to catalog and search") ?>
35
+ </p>
36
+ </div>
app/design/adminhtml/default/default/template/klevu/search/form/klevuinfo.phtml CHANGED
@@ -1,2 +1,2 @@
1
  <?php /** @var Klevu_Search_Block_Adminhtml_Form_KlevuInfo $this */ ?>
2
- <iframe src="https://js.klevu.com/klevu-js-v1/help/" frameBorder="0" width="100%" height="1362"></iframe>
1
  <?php /** @var Klevu_Search_Block_Adminhtml_Form_KlevuInfo $this */ ?>
2
+ <iframe src="http://support.klevu.com/section/manuals/magento-manuals/" frameBorder="0" style="margin-top:-86px;" width="100%" height="2160"></iframe>
app/design/adminhtml/default/default/template/klevu/search/form/quickinfo.phtml ADDED
@@ -0,0 +1 @@
 
1
+ <?php /** @var Klevu_Search_Block_Adminhtml_Form_Infolinks $this */ ?>
app/design/adminhtml/default/default/template/klevu/search/system/config/form/field/array.phtml ADDED
@@ -0,0 +1,171 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magento.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magento.com for more information.
20
+ *
21
+ * @category design
22
+ * @package default_default
23
+ * @copyright Copyright (c) 2006-2015 X.commerce, Inc. (http://www.magento.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+
28
+ <?php
29
+ $_htmlId = $this->getHtmlId() ? $this->getHtmlId() : '_' . uniqid();
30
+
31
+ $_colspan = 2;
32
+ if (!$this->_addAfter) {
33
+ $_colspan -= 1;
34
+ }
35
+ $_colspan = $_colspan > 1 ? 'colspan="' . $_colspan . '"' : '';
36
+
37
+ $check_preserve = Mage::getModel("klevu_search/product_sync")->getFeatures();
38
+ if(!empty($check_preserve['disabled'])) {
39
+ $disable_features = explode(",",$check_preserve['disabled']);
40
+ } else {
41
+ $disable_features = array();
42
+ }
43
+ ?>
44
+
45
+ <div class="grid" id="grid<?php echo $_htmlId ?>">
46
+ <table cellpadding="0" cellspacing="0" class="border">
47
+ <tbody>
48
+
49
+ <tr class="headings" id="headings<?php echo $_htmlId ?>">
50
+ <?php foreach ($this->_columns as $columnName => $column):?>
51
+ <th><?php echo $column['label'] ?></th>
52
+ <?php endforeach;?>
53
+ <th <?php echo $_colspan?>></th>
54
+ </tr>
55
+
56
+ <tr id="addRow<?php echo $_htmlId ?>">
57
+ <td colspan="<?php echo count($this->_columns) ?>"></td>
58
+ <td <?php echo $_colspan?>>
59
+ <button style="" onclick="" <?php if(in_array("enabledcmsfront", $disable_features)) { ?> disabled="disabled" <?php } ?> class="scalable add <?php if(in_array("enabledcmsfront", $disable_features)) { ?> klevu-btn-disabled <?php } ?>" type="button" id="addToEndBtn<?php echo $_htmlId ?>">
60
+ <span><span><span><?php echo $this->_addButtonLabel ?></span></span></span>
61
+ </button>
62
+ </td>
63
+ </tr>
64
+
65
+ </tbody>
66
+ </table>
67
+ <input type="hidden" name="<?php echo $this->getElement()->getName() ?>[__empty]" value="" />
68
+ </div>
69
+ <div id="empty<?php echo $_htmlId ?>">
70
+ <button style="" onclick="" <?php if(in_array("enabledcmsfront", $disable_features)) { ?> disabled="disabled" <?php } ?> class="scalable add <?php if(in_array("enabledcmsfront", $disable_features)) { ?>klevu-btn-disabled <?php } ?>" type="button" id="emptyAddBtn<?php echo $_htmlId ?>">
71
+ <span><span><span><?php echo $this->_addButtonLabel ?></span></span></span>
72
+ </button>
73
+ </div>
74
+
75
+ <script type="text/javascript">
76
+ //<![CDATA[
77
+ // create row creator
78
+ var arrayRow<?php echo $_htmlId ?> = {
79
+ // define row prototypeJS template
80
+ template : new Template(
81
+ '<tr id="#{_id}">'
82
+ <?php foreach ($this->_columns as $columnName => $column):?>
83
+ +'<td>'
84
+ +'<?php echo Mage::helper('core')->jsQuoteEscape($this->_renderCellTemplate($columnName)) ?>'
85
+ +'<\/td>'
86
+ <?php endforeach;?>
87
+ <?php if ($this->_addAfter):?>
88
+ +'<td><button onclick="" class="scalable add" type="button" id="addAfterBtn#{_id}"><span><span><span><?php echo Mage::helper('core')->jsQuoteEscape(Mage::helper('adminhtml')->__('Add after')) ?><\/span><\/span><\/span><\/button><\/td>'
89
+ <?php endif;?>
90
+ +'<td><button onclick="arrayRow<?php echo $_htmlId ?>.del(\'#{_id}\')" class="scalable delete" type="button"><span><span><span><?php echo Mage::helper('core')->jsQuoteEscape(Mage::helper('adminhtml')->__('Delete')) ?><\/span><\/span><\/span><\/button><\/td>'
91
+ +'<\/tr>'
92
+ ),
93
+
94
+ rowsCount : 0,
95
+
96
+ add : function(templateData, insertAfterId)
97
+ {
98
+ // generate default template data
99
+ if ('' == templateData) {
100
+ var d = new Date();
101
+ var templateData = {
102
+ <?php foreach ($this->_columns as $columnName => $column):?>
103
+ <?php echo $columnName ?> : '',
104
+ <?php endforeach;?>
105
+ _id : '_' + d.getTime() + '_' + d.getMilliseconds()
106
+ };
107
+ }
108
+
109
+ // insert before last row
110
+ if ('' == insertAfterId) {
111
+ Element.insert($('addRow<?php echo $_htmlId ?>'), {before: this.template.evaluate(templateData)});
112
+ }
113
+ // insert after specified row
114
+ else {
115
+ Element.insert($(insertAfterId), {after: this.template.evaluate(templateData)});
116
+ }
117
+
118
+ <?php if ($this->_addAfter):?>
119
+ Event.observe('addAfterBtn' + templateData._id, 'click', this.add.bind(this, '', templateData._id));
120
+ <?php endif;?>
121
+
122
+ this.rowsCount += 1;
123
+ },
124
+
125
+ del : function(rowId)
126
+ {
127
+ $(rowId).remove();
128
+ this.rowsCount -= 1;
129
+ if (0 == this.rowsCount) {
130
+ this.showButtonOnly();
131
+ }
132
+ },
133
+
134
+ showButtonOnly : function()
135
+ {
136
+ $('grid<?php echo $_htmlId ?>').hide();
137
+ $('empty<?php echo $_htmlId ?>').show();
138
+ }
139
+ }
140
+
141
+ // bind add action to "Add" button in last row
142
+ Event.observe('addToEndBtn<?php echo $_htmlId ?>', 'click', arrayRow<?php echo $_htmlId ?>.add.bind(arrayRow<?php echo $_htmlId ?>, '', ''));
143
+
144
+ // add existing rows
145
+ <?php
146
+ $_addAfterId = "headings{$_htmlId}";
147
+ foreach ($this->getArrayRows() as $_rowId => $_row) {
148
+ echo "arrayRow{$_htmlId}.add(" . $_row->toJson() . ", '{$_addAfterId}');\n";
149
+ $_addAfterId = $_rowId;
150
+ }
151
+ ?>
152
+
153
+ // initialize standalone button
154
+ $('empty<?php echo $_htmlId ?>').hide();
155
+ Event.observe('emptyAddBtn<?php echo $_htmlId ?>', 'click', function () {
156
+ $('grid<?php echo $_htmlId ?>').show();
157
+ $('empty<?php echo $_htmlId ?>').hide();
158
+ arrayRow<?php echo $_htmlId ?>.add('', '');
159
+ });
160
+
161
+ // if no rows, hide grid and show button only
162
+ <?php if (!$this->getArrayRows()):?>
163
+ arrayRow<?php echo $_htmlId ?>.showButtonOnly();
164
+ <?php endif;?>
165
+
166
+ // toggle the grid, if element is disabled (depending on scope)
167
+ <?php if ($this->getElement()->getDisabled()):?>
168
+ toggleValueElements({checked:true}, $('grid<?php echo $_htmlId ?>').parentNode);
169
+ <?php endif;?>
170
+ //]]>
171
+ </script>
app/design/adminhtml/default/default/template/klevu/search/wizard/complete.phtml CHANGED
@@ -1,17 +1,44 @@
1
  <?php /** @var Mage_Core_Block_Template $this */ ?>
2
- <div class="content-header">
3
- <h3>Complete</h3>
4
- </div>
5
  <?php echo $this->getChildHtml('messages') ?>
6
- <p><?php echo $this->__("You have completed Klevu Search Configuration Wizard.") ?></p>
7
- <p><?php echo $this->__("Please click the \"Finish and Sync\" button below to synchronise your products to Klevu. Afterwards, the products will be automatically resynchronised periodically as well as when any information changes.") ?></p>
8
- <p><?php echo $this->__("Klevu Search will be automatically enabled on frontend after the first synchronisation completes. Afterwards, you can manually control that using the \"Enable on Frontend\" flag on the System Configuration page.") ?></p>
9
- <p class="warning"><b><?php echo $this->__("Warning") ?>:</b> <?php echo $this->__("Product synchronisation takes time. Please do not close or refresh the page after clicking the button until the page finishes loading.") ?></p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  <div class="button-set">
11
- <button id="sync-button"><span><?php echo $this->__("Finish and Sync") ?></span></button>
12
  </div>
 
13
  <script type="text/javascript">
14
  $("sync-button").observe("click", function (e) {
 
15
  window.location = "<?php echo $this->getUrl("adminhtml/klevu_search/manual_sync") ?>";
16
  });
17
  </script>
1
  <?php /** @var Mage_Core_Block_Template $this */ ?>
 
 
 
2
  <?php echo $this->getChildHtml('messages') ?>
3
+ <div class="kuWizardSteps">
4
+ <ol class="wizard-progress clearfix">
5
+ <li class="active-step">
6
+ <span class="step-name"><?php echo $this->__("Register/Login");?></span>
7
+ <span class="visuallyhidden"><?php echo $this->__("Step");?> </span><span class="step-num">&nbsp;</span>
8
+ </li>
9
+ <?php if(Mage::getSingleton('core/session')->getHideStep() != "yes") { ?>
10
+ <li class="active-step">
11
+ <span class="step-name"><?php echo $this->__("Select Plan");?></span>
12
+ <span class="visuallyhidden"><?php echo $this->__("Step");?> </span><span class="step-num">&nbsp;</span>
13
+ </li>
14
+ <?php } ?>
15
+ <li class="active-step">
16
+ <span class="step-name"><?php echo $this->__("Configure Store");?></span>
17
+ <span class="visuallyhidden"><?php echo $this->__("Step");?> </span><span class="step-num">&nbsp;</span>
18
+ </li>
19
+ <li class="active-step">
20
+ <span class="step-name"><?php echo $this->__("Finish & Sync");?></span>
21
+ <span class="visuallyhidden"><?php echo $this->__("Step");?> </span><span class="step-num">&nbsp;</span>
22
+ </li>
23
+ </ol>
24
+ </div>
25
+ <div class="kuFinishSyncInfo">
26
+ <h3><?php echo $this->__('Please click the "Finish and Sync" button below to synchronise your products to Klevu.');?></h3>
27
+
28
+ <ul>
29
+ <li><?php echo $this->__('Klevu Search will be automatically enabled on frontend after the first synchronisation completes.');?></li>
30
+ <li><?php echo $this->__('Data will be automatically resynchronised periodically as well as when any information changes.');?></li>
31
+ <li><?php echo $this->__('Make sure your CRON is setup.');?></li>
32
+ </ul>
33
+ </div>
34
+ <br/>
35
  <div class="button-set">
36
+ <button id="sync-button"><span><?php echo $this->__("Finish and Sync") ?></span></button><br/>
37
  </div>
38
+ <h4 class="kuCompleteWarning"><?php echo $this->__('Please do not close or refresh the page after clicking the button until the page has finished loading.');?></h4>
39
  <script type="text/javascript">
40
  $("sync-button").observe("click", function (e) {
41
+ Element.show('loading-mask');
42
  window.location = "<?php echo $this->getUrl("adminhtml/klevu_search/manual_sync") ?>";
43
  });
44
  </script>
app/design/adminhtml/default/default/template/klevu/search/wizard/configure/store.phtml CHANGED
@@ -1,17 +1,35 @@
1
  <?php /** @var Klevu_Search_Block_Adminhtml_Wizard_Configure_Store $this */ ?>
2
- <?php $store = $this->getStore() ?>
3
- <div class="content-header">
4
- <h3>Configure Store</h3>
5
- </div>
6
  <?php echo $this->getChildHtml('messages') ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  <form id="klevu_search_wizard_configure_store_form" action="<?php echo $this->getFormActionUrl() ?>" method="POST">
8
  <input type="hidden" name="form_key" value="<?php echo $this->getFormKey() ?>" />
9
- <p><?php echo $this->__("Select a Magento store you want to configure Klevu search for.") ?></p>
10
  <fieldset class="fieldset">
11
  <table cellspacing="0" class="form-list">
12
  <tbody>
13
  <tr>
14
- <td class="label"><label for="store"><?php echo $this->__("Magento store:") ?></label></td>
15
  <td class="value">
16
  <select name="store">
17
  <option value=""></option>
@@ -32,7 +50,7 @@
32
  </tr>
33
 
34
  <tr>
35
- <td class="label"><label for="tax_enable"><?php echo $this->__("Would you like to show price including taxes for search results?") ?></label></td>
36
  <td class="value">
37
  <select name="tax_enable" id="tax_enable">
38
  <option value="0" selected="selected"><?php echo $this->__("No") ?></option>
@@ -53,6 +71,6 @@
53
  </table>
54
  </fieldset>
55
  <div class="button-set">
56
- <button type="submit"><span><?php echo $this->__("Continue") ?></span></button>
57
  </div>
58
  </form>
1
  <?php /** @var Klevu_Search_Block_Adminhtml_Wizard_Configure_Store $this */ ?>
2
+ <?php $store = $this->getStore(); ?>
 
 
 
3
  <?php echo $this->getChildHtml('messages') ?>
4
+ <div class="kuWizardSteps">
5
+ <ol class="wizard-progress clearfix">
6
+ <li class="active-step">
7
+ <span class="step-name">Register/Login</span>
8
+ <span class="visuallyhidden">Step </span><span class="step-num">&nbsp;</span>
9
+ </li>
10
+ <?php if(Mage::getSingleton('core/session')->getHideStep() != "yes") { ?>
11
+ <li class="active-step">
12
+ <span class="step-name">Select Plan</span>
13
+ <span class="visuallyhidden">Step </span><span class="step-num">&nbsp;</span>
14
+ </li>
15
+ <?php } ?>
16
+ <li class="active-step">
17
+ <span class="step-name">Configure Store</span>
18
+ <span class="visuallyhidden">Step </span><span class="step-num">&nbsp;</span>
19
+ </li>
20
+ <li>
21
+ <span class="step-name">Finish & Sync</span>
22
+ <span class="visuallyhidden">Step </span><span class="step-num">&nbsp;</span>
23
+ </li>
24
+ </ol>
25
+ </div>
26
  <form id="klevu_search_wizard_configure_store_form" action="<?php echo $this->getFormActionUrl() ?>" method="POST">
27
  <input type="hidden" name="form_key" value="<?php echo $this->getFormKey() ?>" />
 
28
  <fieldset class="fieldset">
29
  <table cellspacing="0" class="form-list">
30
  <tbody>
31
  <tr>
32
+ <td class="label"><label for="store"><?php echo $this->__("Select a Magento store you want to configure Klevu search for:") ?></label></td>
33
  <td class="value">
34
  <select name="store">
35
  <option value=""></option>
50
  </tr>
51
 
52
  <tr>
53
+ <td class="label"><label for="tax_enable"><?php echo $this->__("Would you like to show product prices inclusive of tax in search results?") ?></label></td>
54
  <td class="value">
55
  <select name="tax_enable" id="tax_enable">
56
  <option value="0" selected="selected"><?php echo $this->__("No") ?></option>
71
  </table>
72
  </fieldset>
73
  <div class="button-set">
74
+ <button type="submit"><span><?php echo $this->__("Next") ?></span></button>
75
  </div>
76
  </form>
app/design/adminhtml/default/default/template/klevu/search/wizard/configure/user.phtml CHANGED
@@ -1,8 +1,30 @@
1
  <?php /** @var Klevu_Search_Block_Adminhtml_Wizard_Configure_User $this */ ?>
2
- <?php echo $this->getChildHtml('messages') ?>
 
3
  <form id="klevu_search_wizard_configure_user_form" action="<?php echo $this->getFormActionUrl() ?>" method="POST">
4
  <input type="hidden" name="form_key" value="<?php echo $this->getFormKey() ?>" />
5
  <fieldset class="fieldset">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  <table cellspacing="0" class="form-list" style="width:100%;">
7
  <tbody>
8
  <tr>
@@ -20,16 +42,16 @@
20
  <td class="label"><label for="klevu_new_email"><?php echo $this->__("Primary Email:") ?><span class="required">&nbsp;<em>*</em></span></label>
21
  </td>
22
  <td class="value">
23
- <input type="text" name="klevu_new_email" id="klevu_new_email" class="required-entry input-text" />
24
- <p class="note">For login and technical support</p>
25
  </td>
26
  </tr>
27
  <tr>
28
  <td class="label"><label for="merchantEmail"><?php echo $this->__("Retailer Email:") ?><span class="required">&nbsp;<em>*</em></span></label></td>
29
  <td class="value">
30
- <input type="text" name="merchantEmail" id="merchantEmail" class="input-text" />
31
  <p class="note">
32
- For search insights and billing
33
  </p>
34
  </td>
35
  </tr>
@@ -38,47 +60,24 @@
38
  <td class="value"><input type="password" name="klevu_new_password" id="klevu_new_password" class="input-text" />
39
  </td>
40
  </tr>
41
- <tr>
42
- <td class="label"><label for="userPlan"><?php echo $this->__("Choose Your Solution:") ?><span class="required">&nbsp;<em>*</em></span></label></td>
43
- <td class="value">
44
- <table cellpadding="3" cellspacing="0">
45
- <tr>
46
- <td><input type="radio" name="userPlan" value="free">&nbsp;Klevu BASIC&nbsp;&nbsp;&nbsp;</td>
47
- <td><input type="radio" name="userPlan" value="trial">&nbsp;Klevu PRO&nbsp;&nbsp;&nbsp;</td>
48
- <td><input type="radio" name="userPlan" value="partnerAccount">&nbsp;Klevu Partner</td>
49
- </tr>
50
- </table>
51
- <table>
52
- <tr>
53
- <td colspan="2" style="padding-top:5px;"><img src="http://www.klevu.com/magento-screens/klevu-mage-package.jpg" />
54
- </td>
55
- </tr>
56
- <tr>
57
- <td colspan="2">
58
- <p class="note" style="width:auto !important;"><a href="#" onClick="checkplan();" style="font-size:11px;">Learn more about BASIC v/s PRO </a></p>
59
- </td>
60
- </tr>
61
- <tr>
62
- <td colspan="2">
63
- <p style="width:auto !important;">Please select Klevu partner option</br>if you are an authorized Klevu partner.</p>
64
- </td>
65
- </tr>
66
- </table>
67
- </td>
68
- </tr>
69
  <tr>
70
  <td class="label"><label for="contactNo"> <?php echo $this->__("Phone Number:") ?><span class="required">&nbsp;</span></label></td>
71
- <td class="value"><input type="text" placeholder="Country code" name="countyCode" id="countyCode" class="input-text" value="<?php echo $this->getCountyCode() ?>" /> <input type="text" name="contactNo" id="contactNo" class="input-text" value="<?php echo $this->getContactNo() ?>" /></td>
72
  </tr>
73
  <tr>
74
  <td class="label"><label for="klevu_new_url"> <?php echo $this->__("Store URL:") ?><span class="required">&nbsp;<em>*</em></span></label></td>
75
  <td class="value"><input type="text" name="klevu_new_url" id="klevu_new_url" class="input-text" value="<?php echo $this->getStoreUrl() ?>" /></td>
76
  </tr>
 
 
 
 
77
  <tr>
78
  <td class="label"></td>
79
  <td class="value" style="padding-right: 26px;">
80
  <div class="button-set">
81
- <button type="submit"><span><?php echo $this->__("Register") ?></span></button>
82
  </div>
83
  </td>
84
  </tr>
1
  <?php /** @var Klevu_Search_Block_Adminhtml_Wizard_Configure_User $this */ ?>
2
+ <?php echo $this->getChildHtml('messages');
3
+ $request = $this->getRequest(); ?>
4
  <form id="klevu_search_wizard_configure_user_form" action="<?php echo $this->getFormActionUrl() ?>" method="POST">
5
  <input type="hidden" name="form_key" value="<?php echo $this->getFormKey() ?>" />
6
  <fieldset class="fieldset">
7
+ <div class="kuWizardSteps">
8
+ <ol class="wizard-progress clearfix">
9
+ <li class="active-step">
10
+ <span class="step-name">Register/Login</span>
11
+ <span class="visuallyhidden">Step </span><span class="step-num">&nbsp;</span>
12
+ </li>
13
+ <li>
14
+ <span class="step-name">Select Plan</span>
15
+ <span class="visuallyhidden">Step </span><span class="step-num">&nbsp;</span>
16
+ </li>
17
+ <li>
18
+ <span class="step-name">Configure Store</span>
19
+ <span class="visuallyhidden">Step </span><span class="step-num">&nbsp;</span>
20
+ </li>
21
+ <li>
22
+ <span class="step-name">Finish & Sync</span>
23
+ <span class="visuallyhidden">Step </span><span class="step-num">&nbsp;</span>
24
+ </li>
25
+ </ol>
26
+ </div>
27
+
28
  <table cellspacing="0" class="form-list" style="width:100%;">
29
  <tbody>
30
  <tr>
42
  <td class="label"><label for="klevu_new_email"><?php echo $this->__("Primary Email:") ?><span class="required">&nbsp;<em>*</em></span></label>
43
  </td>
44
  <td class="value">
45
+ <input type="text" name="klevu_new_email" value="<?php if($request->getPost("klevu_new_email")){ echo $request->getPost("klevu_new_email");} ?>" id="klevu_new_email" class="required-entry input-text" />
46
+ <p class="note"><?php echo $this->__("For login and technical support");?></p>
47
  </td>
48
  </tr>
49
  <tr>
50
  <td class="label"><label for="merchantEmail"><?php echo $this->__("Retailer Email:") ?><span class="required">&nbsp;<em>*</em></span></label></td>
51
  <td class="value">
52
+ <input type="text" name="merchantEmail" value="<?php if($request->getPost("merchantEmail")){ echo $request->getPost("merchantEmail");} ?>" id="merchantEmail" class="input-text" />
53
  <p class="note">
54
+ <?php echo $this->__("For search insights and billing");?>
55
  </p>
56
  </td>
57
  </tr>
60
  <td class="value"><input type="password" name="klevu_new_password" id="klevu_new_password" class="input-text" />
61
  </td>
62
  </tr>
63
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
  <tr>
65
  <td class="label"><label for="contactNo"> <?php echo $this->__("Phone Number:") ?><span class="required">&nbsp;</span></label></td>
66
+ <td class="value"><input type="text" value="<?php if($request->getPost("countyCode")){ echo $request->getPost("countyCode");} ?>" placeholder="Country code" name="countyCode" id="countyCode" class="input-text" /> <input type="text" name="contactNo" id="contactNo" value="<?php echo Mage::getStoreConfig('general/store_information/phone');?>" class="input-text" /></td>
67
  </tr>
68
  <tr>
69
  <td class="label"><label for="klevu_new_url"> <?php echo $this->__("Store URL:") ?><span class="required">&nbsp;<em>*</em></span></label></td>
70
  <td class="value"><input type="text" name="klevu_new_url" id="klevu_new_url" class="input-text" value="<?php echo $this->getStoreUrl() ?>" /></td>
71
  </tr>
72
+ <tr>
73
+ <td class="label">&nbsp;</td>
74
+ <td colspan="2"><input type="checkbox" name="termsconditions" id="termsOfService"> <label for="termsOfService">I accept <a href="#" onClick="termsofservice();" style="font-size:11px;"><?php echo $this->__("Terms of Service");?></a></label></td>
75
+ </tr>
76
  <tr>
77
  <td class="label"></td>
78
  <td class="value" style="padding-right: 26px;">
79
  <div class="button-set">
80
+ <button type="submit"><span><?php echo $this->__("Next") ?></span></button>
81
  </div>
82
  </td>
83
  </tr>
app/design/adminhtml/default/default/template/klevu/search/wizard/configure/userplan.phtml ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php /** @var Klevu_Search_Block_Adminhtml_Wizard_Configure_Store $this */ ?>
2
+ <?php echo $this->getChildHtml('messages'); ?>
3
+ <div class="kuWizardSteps">
4
+ <ol class="wizard-progress clearfix">
5
+ <li class="active-step">
6
+ <span class="step-name"><?php echo $this->__("Register/Login");?></span>
7
+ <span class="visuallyhidden"><?php echo $this->__("Step");?> </span><span class="step-num">&nbsp;</span>
8
+ </li>
9
+ <li class="active-step">
10
+ <span class="step-name"><?php echo $this->__("Select Plan");?></span>
11
+ <span class="visuallyhidden"><?php echo $this->__("Step");?> </span><span class="step-num">&nbsp;</span>
12
+ </li>
13
+ <li>
14
+ <span class="step-name"><?php echo $this->__("Configure Store");?></span>
15
+ <span class="visuallyhidden"><?php echo $this->__("Step");?></span><span class="step-num">&nbsp;</span>
16
+ </li>
17
+ <li>
18
+ <span class="step-name"><?php echo $this->__("Finish & Sync");?></span>
19
+ <span class="visuallyhidden"><?php echo $this->__("Step");?> </span><span class="step-num">&nbsp;</span>
20
+ </li>
21
+ </ol>
22
+ </div>
23
+
24
+
25
+ <form id="klevu_search_wizard_configure_store_form" action="<?php echo $this->getFormActionUrl() ?>" method="POST">
26
+ <input type="hidden" name="form_key" value="<?php echo $this->getFormKey() ?>" />
27
+ <fieldset class="fieldset">
28
+ <div class="kuSelectPlanHeader">
29
+ <h2><?php echo $this->__("Start 14-Day risk free trial");?></h2>
30
+ <h5><?php echo $this->__("No obligation to continue, no credit card required");?></h5>
31
+ <h5><?php echo $this->__("10% off when paid yearly");?></h5>
32
+ </div>
33
+ <table cellspacing="0" cellpadding="10" class="form-list kuPlanDetails">
34
+ <tbody>
35
+ <tr>
36
+
37
+ <td>
38
+ <table class="kuPlanColumn" cellspacing="0">
39
+ <tbody>
40
+ <tr>
41
+ <td><input type="radio" name="userPlan" value="starter" id="kuStarter"/> <label for="kuStarter">Starter</label></td>
42
+ </tr>
43
+ <tr>
44
+ <td><img src="http://www.klevu.com/support/magento-links/plans/starter.jpg"/></td>
45
+ </tr>
46
+ </tbody>
47
+ </table>
48
+ </td>
49
+ <td>
50
+ <table class="kuPlanColumn" cellspacing="0">
51
+ <tbody>
52
+ <tr>
53
+ <td><input type="radio" name="userPlan" value="plus" id="kuPlus"/> <label for="kuPlus">Plus</label></td>
54
+ </tr>
55
+ <tr>
56
+ <td><img src="http://www.klevu.com/support/magento-links/plans/plus.jpg"/></td>
57
+ </tr>
58
+ </tbody>
59
+ </table>
60
+ </td>
61
+ <td>
62
+ <table class="kuPlanColumn" cellspacing="0">
63
+ <tbody>
64
+ <tr>
65
+ <td><input type="radio" name="userPlan" value="growth" id="kuGrowth"/> <label for="kuGrowth">Growth</label></td>
66
+ </tr>
67
+ <tr>
68
+ <td><img src="http://www.klevu.com/support/magento-links/plans/growth.jpg"/></td>
69
+ </tr>
70
+ </tbody>
71
+ </table>
72
+ </td>
73
+ <td>
74
+ <table class="kuPlanColumn" cellspacing="0">
75
+ <tbody>
76
+ <tr>
77
+ <td><input type="radio" name="userPlan" value="premium" id="kuPremium"/> <label for="kuPremium">Premium</label></td>
78
+ </tr>
79
+ <tr>
80
+ <td><img src="http://www.klevu.com/support/magento-links/plans/premium.jpg"/></td>
81
+ </tr>
82
+ </tbody>
83
+ </table>
84
+ </td>
85
+ </tr>
86
+
87
+ <tr>
88
+ <td colspan="4">
89
+ <table class="kuOtherPlan">
90
+ <tbody>
91
+ <tr>
92
+ <td>
93
+ <table class="kuOtherPlanBox" cellpadding="0" cellspacing="0">
94
+ <tbody>
95
+ <tr>
96
+ <td class="kuOtherPlanHeader"><input type="radio" name="userPlan" value="enterprise" id="kuEnterprise"/> <label for="kuEnterprise">Enterprise</label></td>
97
+ <td rowspan="2" class="kuOtherPlanDesc">The most advance search, unlimited data, dedicated cloud option.</td>
98
+ </tr>
99
+ <tr>
100
+ <td class="kuOtherPlanPrice"><span>Starts at</span> $1200/mo</td>
101
+ </tr>
102
+ </tbody>
103
+ </table>
104
+ </td>
105
+ <td>
106
+ <table class="kuOtherPlanBox" cellpadding="0" cellspacing="0">
107
+ <tbody>
108
+ <tr>
109
+ <td class="kuOtherPlanHeader"><div class="kuTooltip"><input type="radio" name="userPlan" value="micro" id="kuMicro"/> <label for="kuMicro">Micro</label>
110
+ <span> In case total records or search terms exceed the permitted limit, the account will be moved to trial version of the applicable tier. A notification will be sent to registered email address. <b></b></span></div>
111
+ </td>
112
+ <td rowspan="2" class="kuOtherPlanDesc">Maximum 500 records and 1000 search terms per month.</td>
113
+ </tr>
114
+ <tr>
115
+ <td class="kuOtherPlanPrice">FREE</td>
116
+ </tr>
117
+ </tbody>
118
+ </table>
119
+ </td>
120
+ </tr>
121
+ </tbody>
122
+ </table>
123
+ </td>
124
+ </tr>
125
+
126
+ </tbody>
127
+ </table>
128
+ </fieldset>
129
+ <div class="button-set">
130
+ <button type="submit"><span><?php echo $this->__("Next") ?></span></button>
131
+ </div>
132
+
133
+ </form>
app/design/frontend/base/default/layout/klevu/addtocart.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <default>
4
+ <reference name="before_body_end">
5
+ <block type="core/template" name="klevu.addtocart.index" template="klevu/addtocart/index.phtml"/>
6
+ </reference>
7
+ </default>
8
+ </layout>
9
+
app/design/frontend/base/default/layout/klevu/content.xml ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <content_search_index>
4
+ <reference name="root">
5
+ <action method="setTemplate"><template>page/2columns-left.phtml</template></action>
6
+ </reference>
7
+ <reference name="head">
8
+ <action method="addCss"><stylesheet>css/klevu/content/klevu-landing-left.css</stylesheet></action>
9
+ </reference>
10
+ <reference name="content">
11
+ <block type="core/template" name="contentsearch.top.block" before="-" as="contentsearch_top_block" template="klevu/content/top.phtml" />
12
+ <block type="content/index" name="content_index" template="klevu/content/index.phtml"/>
13
+ </reference>
14
+ <reference name="left">
15
+ <block type="content/index" name="contentsearch.left.block" as="contentsearch_top_block" template="klevu/content/left.phtml" />
16
+ </reference>
17
+ </content_search_index>
18
+ <catalogsearch_result_index translate="label">
19
+ <reference name="content">
20
+ <block type="core/template" name="contentsearch.top.block" before="-" as="contentsearch_top_block" template="klevu/content/top.phtml" />
21
+ </reference>
22
+ </catalogsearch_result_index>
23
+ <search_index_index>
24
+ <reference name="head">
25
+ <action method="addCss"><stylesheet>css/klevu/klevu-landing-page-style.css</stylesheet></action>
26
+ <action method="addCss"><stylesheet>css/klevu/klevu-landing-responsive.css</stylesheet></action>
27
+ </reference>
28
+ <reference name="root">
29
+ <action method="setTemplate"><template>page/1column.phtml</template></action>
30
+ </reference>
31
+ <reference name="content">
32
+ <remove name="search_index"/>
33
+ <block type="core/template" name="search_content_index" template="klevu/content/search.phtml"/>
34
+ </reference>
35
+ </search_index_index>
36
+ <cms_page>
37
+ <reference name="before_body_end">
38
+ <block type="content/tracking" name="klevu.content.tracking" template="klevu/content/content_tracking.phtml" />
39
+ </reference>
40
+ </cms_page>
41
+ <default>
42
+ <reference name="before_body_end">
43
+ <block type="core/template" name="klevu.content.typeofquery" template="klevu/content/type_of_query.phtml"/>
44
+ </reference>
45
+ </default>
46
+ </layout>
47
+
app/design/frontend/base/default/layout/klevu/searchterms.xml ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <searchterms_index_index>
4
+ <reference name="root">
5
+ <action method="setTemplate"><template>page/1column.phtml</template></action>
6
+ </reference>
7
+ <reference name="head">
8
+ <action method="addCss"><stylesheet>css/klevu/search/klevu-search-term.css</stylesheet></action>
9
+ </reference>
10
+ <reference name="content">
11
+ <block type="klevu_searchterms/catalog_product_popularterms" name="klevu_searchterms.catalog.product.popularterms" template="klevu/searchterm/popular_searchterms.phtml"/>
12
+ </reference>
13
+ </searchterms_index_index>
14
+
15
+ </layout>
16
+
app/design/frontend/base/default/template/klevu/addtocart/index.phtml ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $config = Mage::helper('addtocart'); ?>
2
+ <?php if ($config->isAddtocartEnabled()) {?>
3
+ <script type="text/javascript">
4
+ function klevu_addtocart(id,url,qty) {
5
+ var form_key = '<?php echo Mage::getSingleton('core/session')->getFormKey()?>';
6
+ var url = '<?php echo Mage::getUrl('checkout/cart/add');?>'+'product/'+id+'/qty/'+qty+'/form_key/'+form_key;
7
+ window.location.assign(url);
8
+ }
9
+
10
+ /* function klevu_uc_addtocartButton(){
11
+ if( 'undefined' !== typeof klevu_userOptions ){
12
+ klevu_userOptions.addToCartButton = 'Add to cart';
13
+ } else{
14
+ setTimeout( klevu_uc_addtocartButton, 300 );
15
+ }
16
+ }
17
+ klevu_uc_addtocartButton(); */
18
+ </script>
19
+
20
+ <?php } ?>
app/design/frontend/base/default/template/klevu/content/content_tracking.phtml ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php /** @var Klevu_Search_Block_Catalog_Product_Tracking $this */ ?>
2
+ <?php $config = Mage::helper('klevu_search/config'); ?>
3
+ <?php if ($config->isExtensionConfigured()):
4
+ ?>
5
+ <script type="text/javascript">
6
+ (function() {
7
+ var referrer, search_term, klevu_search_product_tracking;
8
+ referrer = document.referrer;
9
+ search_term = referrer.toQueryParams().q;
10
+ if (referrer.indexOf('content/index') > -1 && search_term) {
11
+ klevu_search_product_tracking = <?php echo $this->getJsonTrackingData() ?>;
12
+ klevu_search_product_tracking.klevu_term = search_term;
13
+
14
+ // Send the ajax request
15
+ new Ajax.Request('//<?php echo $config->getAnalyticsUrl() ?>/analytics/productTracking', {
16
+ method: "GET",
17
+ parameters: klevu_search_product_tracking,
18
+
19
+ // We need to remove the AJAX headers so the request does not get preflighted and break cross-origin request policy
20
+ onCreate: function(response) {
21
+ var t = response.transport;
22
+ t.setRequestHeader = t.setRequestHeader.wrap(function(original, k, v) {
23
+ if (/^(accept|accept-language|content-language)$/i.test(k))
24
+ return original(k, v);
25
+ if (/^content-type$/i.test(k) &&
26
+ /^(application\/x-www-form-urlencoded|multipart\/form-data|text\/plain)(;.+)?$/i.test(v))
27
+ return original(k, v);
28
+ return;
29
+ });
30
+ }
31
+ });
32
+ }
33
+ })();
34
+ </script>
35
+ <?php endif; ?>
app/design/frontend/base/default/template/klevu/content/index.phtml ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
2
+ <?php $datasets = $this->getCmsContent(); ?>
3
+ <?php if(count($datasets)>0): ?>
4
+ <div class="category-products">
5
+ <ol id="products-list" class="products-list">
6
+ <?php foreach ($datasets as $key => $value):?>
7
+ <li class="item">
8
+ <h2 class="product-name"><a title="<?php echo $value["name"]; ?>" target="_blank" href="<?php echo $value["url"]; ?>"><?php echo $value["name"]; ?></a></h2>
9
+ <?php if(!empty($value['shortDesc'])) { ?>
10
+ <div class="desc std"> <?php echo $value["shortDesc"]."..."; ?> </div>
11
+ <?php } ?>
12
+ </li>
13
+ <?php endforeach; ?>
14
+ </ol>
15
+ </div>
16
+ <?php else: ?>
17
+ <p><?php echo $this->__('No Records Found.'); ?></p>
18
+ <?php endif ?>
19
+
20
+
21
+
22
+
app/design/frontend/base/default/template/klevu/content/left.phtml ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $contentFilters = $this->getContentFilters();
2
+ if(count($contentFilters)> 0) {
3
+ ?>
4
+ <div class="col-left-first">
5
+ <div class="block block-layered-nav">
6
+ <div class="block-content toggle-content">
7
+ <dl id="narrow-by-list">
8
+ <dt class="odd"><?php echo $this->__("Type"); ?></dt>
9
+ <dd class="odd">
10
+ <ol>
11
+ <?php foreach($contentFilters["category"]["options"] as $key => $value) {
12
+ $url_content = Mage::getUrl('content/search',array("q" => Mage::app()->getRequest()->getParam("q")));
13
+ ?>
14
+ <li class="kuFilterSelect">
15
+ <a href="<?php echo $url_content."?cat=".strtolower($value["label"]);?>" class="kuFilterLbl">
16
+ <?php echo $value["label"]; ?><span class="count"> (<?php echo $value["count"]; ?>)</span>
17
+
18
+ </a>
19
+ <?php if($value["selected"]=="true") { ?>
20
+ <a href="<?php echo $url_content;?>" class="kuFilterClose">X</a>
21
+ <?php } ?>
22
+ </li>
23
+ <div class="kuClrFilterBoth"></div>
24
+ <?php } ?>
25
+ </ol>
26
+ </dd>
27
+ </ol>
28
+ </dd>
29
+ </dl>
30
+ </div>
31
+ </div>
32
+ </div>
33
+ <?php } ?>
app/design/frontend/base/default/template/klevu/content/search.phtml ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $config = Mage::helper('klevu_search/config'); ?>
2
+ <div class="kuContainer">
3
+ <div id="loader" style="text-align:center"><img src="<?php echo $this->getSkinUrl('images/klevu/ku-loader.gif'); ?>" alt="Loading..."/></div>
4
+ <div class="kuNoRecordFound" id="kuNoRecordFound" style="display:none;">
5
+ <p><?php echo $this->__('No matching products found.');?></p>
6
+ </div>
7
+ <div class="kuProListing" id="kuProListing" style="display: none;">
8
+ <div class="kuFilters" id="kuFilters"></div><!-- End of kuFilters -->
9
+
10
+ <div class="kuResultList" id="kuResultListBlock">
11
+ <div class="kuListHeader">
12
+ <div class="kuTotResults" id="kuTotResults"></div>
13
+
14
+ <div class="kuProductContent" id="kuProductContent">
15
+ <div class="kuSortHeader">
16
+ <div class="kuSortingOpt">
17
+ <div class="kuSortby">
18
+ <label><?php echo $this->__('Sort by');?>:</label>
19
+ <select name="kuSortby" id="kuSortby" onchange="klevu_changeSortingOptionsForLandigPage(this.value);">
20
+ <option value="rel"><?php echo $this->__('Relevance');?></option>
21
+ <option value="lth"><?php echo $this->__('Price').":".$this->__('Low to high');?></option>
22
+ <option value="htl"><?php echo $this->__('Price').":".$this->__('High to low');?></option>
23
+ </select>
24
+ </div>
25
+
26
+ <div class="kuView">
27
+ <a class="kuGridviewBtn" id="gridViewBtn" onclick="klevu_setKuView('grid');">
28
+ <span class="icon-gridview"></span>
29
+ </a>
30
+ <a class="kuListviewBtn kuCurrent" id="listViewBtn" onclick="klevu_setKuView('list');">
31
+ <span class="icon-listview"></span>
32
+ </a>
33
+ </div>
34
+
35
+ <div class="kuPerPage">
36
+ <label><?php echo $this->__('Items per page');?>:</label>
37
+ <select onchange="klevu_changeItemsPerPage(this.value);" id="noOfRecords1">
38
+ <?php
39
+ $per_page = explode(",",Mage::getStoreConfig("catalog/frontend/grid_per_page_values"));
40
+ if(!empty($per_page)){
41
+ foreach($per_page as $key => $value) { ?>
42
+ <option> <?php echo $value;?></option>
43
+ <?php }
44
+ }?>
45
+ </select>
46
+ </div>
47
+
48
+ <div class="kuPagination" id="kuPagination1">
49
+ </div>
50
+
51
+ <div class="kuClearLeft"></div>
52
+ </div>
53
+ </div>
54
+ <div class="kuListView" id="kuResultsView">
55
+
56
+ </div><!-- End of klevuResults-->
57
+ <div class="kuBottomPagi">
58
+ <div class="kuPerPage">
59
+ <label><?php echo $this->__('Items per page');?>:</label>
60
+ <select onchange="klevu_changeItemsPerPage(this.value);" id="noOfRecords2">
61
+ <?php
62
+ if(!empty($per_page)){
63
+ foreach($per_page as $key => $value) { ?>
64
+ <option> <?php echo $value;?></option>
65
+ <?php }
66
+ }?>
67
+ </select>
68
+ </div>
69
+ <div class="kuPagination" id="kuPagination2">
70
+
71
+ </div>
72
+ <div class="kuClearLeft"></div>
73
+ </div>
74
+ </div>
75
+ <div class="klevu-clear-both"></div>
76
+ </div>
77
+ <!-- End of product content -->
78
+
79
+ <!-- Other content -->
80
+
81
+ <div class="kuListView kuOtherContent" id="kuOtherContent">
82
+ <div class="kuSortHeader">
83
+ <div class="kuSortingOpt">
84
+ <div class="kuPerPage">
85
+ <label><?php echo $this->__('Items per page');?>:</label>
86
+ <select onchange="klevu_changeCmsItemsPerPage(this.value);" id="noOfRecords3">
87
+ <option>12</option>
88
+ <option>24</option>
89
+ <option>36</option>
90
+ </select>
91
+ </div>
92
+ <div class="kuPagination" id="kuPagination3"></div>
93
+ <div class="kuClearLeft"></div>
94
+ </div>
95
+ </div>
96
+ <div class="kuOtherContentView" id="kuOtherContentView">
97
+ </div>
98
+ <div class="kuSortHeader">
99
+ <div class="kuSortingOpt">
100
+ <div class="kuPerPage">
101
+ <label><?php echo $this->__('Items per page');?>:</label>
102
+ <select onchange="klevu_changeCmsItemsPerPage(this.value);" id="noOfRecords4">
103
+ <option>12</option>
104
+ <option>24</option>
105
+ <option>36</option>
106
+ </select>
107
+ </div>
108
+ <div class="kuPagination" id="kuPagination4"></div>
109
+ <div class="kuClearLeft"></div>
110
+ </div>
111
+ </div>
112
+ </div>
113
+ <!-- End of other content -->
114
+ </div>
115
+ </div>
116
+ <div class="kuClearBoth"></div>
117
+ </div><!-- End of kuProListing -->
118
+ </div><!-- End of klevu-container -->
119
+ <?php $grid_per_page = Mage::getStoreConfig("catalog/frontend/grid_per_page"); ?>
120
+ <input id="noOfRecords" type="hidden" name="noOfRecords" value="<?php if(!empty($grid_per_page)){ echo $grid_per_page; } else { echo "12";}?>" />
121
+ <input type="hidden" name="startPos" id="startPos" value="0"/>
122
+ <input type="hidden" name="totalResultsFound" id="totalResultsFound" value="0"/>
123
+ <input type="hidden" name="searchedKeyword" id="searchedKeyword" value=""/>
124
+ <input type="hidden" name="totalPages" id="totalPages" value="0"/>
125
+ <?php
126
+ $protocol = stripos($_SERVER['SERVER_PROTOCOL'],'https') === true ? 'https://' : 'http://';
127
+ $src = $protocol.$config->getJsUrl();
128
+ ?>
129
+ <script type="text/javascript" src="<?php echo $src; ?>/klevu-js-v1/js-1-1/klevu-landing.js">// <![CDATA[
130
+ // ]]></script>
131
+ <script type="text/javascript">// <![CDATA[
132
+ document.getElementById("searchedKeyword").value= klevu_getParamValue("q");
133
+ // ]]></script>
app/design/frontend/base/default/template/klevu/content/top.phtml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $config = Mage::helper('content');
3
+ if($config->isCmsSyncEnabledOnFront()) {?>
4
+ <?php
5
+ $url = Mage::getUrl('catalogsearch/result/')."?q=".Mage::app()->getRequest()->getParam("q");
6
+ $url_content = Mage::getUrl('content/search')."?q=".Mage::app()->getRequest()->getParam("q");
7
+ ?>
8
+ <div class="page-title">
9
+ <?php $selected_tab = Mage::app()->getRequest()->getModuleName(); ?>
10
+ <a href="<?php echo $url; ?>" <?php if($selected_tab == "catalogsearch"){?> class="contentSelect" <?php } ?> ><?php echo $this->__('Products'); ?></a> | <a href="<?php echo $url_content; ?>" <?php if($selected_tab == "content"){?> class="contentSelect" <?php } ?>><?php echo $this->__('Other content'); ?></a>
11
+ </div>
12
+ <?php } ?>
app/design/frontend/base/default/template/klevu/content/type_of_query.phtml ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $config = Mage::helper('klevu_search/config'); ?>
2
+ <?php if ($config->isExtensionConfigured()):?>
3
+ <script type="text/javascript">
4
+ var klevu_cms_module_enabled=true;
5
+ </script>
6
+ <?php endif; ?>
7
+ <script type="text/javascript">
8
+ // Enable cms for klevu template
9
+ <?php
10
+ $content = Mage::helper('content');
11
+ if($content->isCmsSyncEnabledOnFront()) { ?>
12
+ var klevu_cmsSearchEnabled = true;
13
+ <?php } else {?>
14
+ var klevu_cmsSearchEnabled = false;
15
+ <?php } ?>
16
+ </script>
app/design/frontend/base/default/template/klevu/learning/category.phtml ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php /** @var Klevu_Learning_Block_Tracking $this */ ?>
2
+ <?php $config = Mage::helper('klevu_search/config'); ?>
3
+ <?php if ($config->isExtensionConfigured()): ?>
4
+ <?php $this->setCategoryData(); ?>
5
+ <?php endif; ?>
app/design/frontend/base/default/template/klevu/learning/category_tracking.phtml ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php /** @var Klevu_Learning_Block_Tracking $this */ ?>
2
+ <?php $config = Mage::helper('klevu_search/config'); ?>
3
+ <?php if ($config->isExtensionConfigured()): ?>
4
+ <?php $cat_name = Mage::getSingleton('core/session')->getCategoryValue();?>
5
+ <?php if($cat_name!=' ') { ?>
6
+ <script type="text/javascript">
7
+ (function() {
8
+ search_term = <?php echo Mage::getSingleton('core/session')->getCategoryValue(); ?>;
9
+ if (search_term) {
10
+ klevu_search_product_tracking = <?php echo $this->getJsonTrackingData() ?>;
11
+ klevu_search_product_tracking.klevu_term = search_term;
12
+
13
+ // Send the ajax request
14
+ new Ajax.Request('//<?php echo $config->getAnalyticsUrl() ?>/analytics/productTracking', {
15
+ method: "GET",
16
+ parameters: klevu_search_product_tracking,
17
+
18
+ // We need to remove the AJAX headers so the request does not get preflighted and break cross-origin request policy
19
+ onCreate: function(response) {
20
+ var t = response.transport;
21
+ t.setRequestHeader = t.setRequestHeader.wrap(function(original, k, v) {
22
+ if (/^(accept|accept-language|content-language)$/i.test(k))
23
+ return original(k, v);
24
+ if (/^content-type$/i.test(k) &&
25
+ /^(application\/x-www-form-urlencoded|multipart\/form-data|text\/plain)(;.+)?$/i.test(v))
26
+ return original(k, v);
27
+ return;
28
+ });
29
+ }
30
+ });
31
+ }
32
+ })();
33
+ </script>
34
+ <?php } ?>
35
+ <?php endif; ?>
app/design/frontend/base/default/template/klevu/searchterm/popular_searchterms.phtml ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /** @var Klevu_Search_Block_Catalog_Product_Popularterms $this */
3
+ ?>
4
+ <?php
5
+ $config = Mage::helper('klevu_search/config');
6
+ ?>
7
+ <?php
8
+ if ($config->isExtensionConfigured()):
9
+ ?>
10
+ <?php
11
+ $terms = $this->getPopularterms();
12
+ if (count($terms) == 1) {
13
+ $terms = array(
14
+ $terms
15
+ );
16
+ }
17
+ if (count($terms) > 0) {
18
+ sort($terms);
19
+ foreach ($terms as $term) {
20
+ $terms_array[mb_substr($term, 0, 1,'utf-8')][] = $term;
21
+ }
22
+ foreach ($terms_array as $key => $value) {
23
+ $newArray = array_slice($value, 0, 5, true);
24
+ echo '<div class="klevu-search-terms"><h3>' . $key . '</h3><ul>';
25
+ foreach ($newArray as $key => $value) {
26
+ if ($config->isLandingEnabled() == 2) {
27
+ $url = Mage::getBaseUrl() . "search?q=" . $value;
28
+ } else {
29
+ $url = Mage::getUrl('catalogsearch/result/index', array(
30
+ 'q' => $value
31
+ ));
32
+ }
33
+ echo '<li><a href="' . $url . '">' . $value . "</a></li>";
34
+ }
35
+ echo '</ul></div>';
36
+ }
37
+ } else {
38
+ echo $this->__("No Popular search term found");
39
+ }
40
+ ?>
41
+ <?php
42
+ endif;
43
+ ?>
app/etc/modules/Klevu_Addtocart.xml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Klevu_Addtocart>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ <version>0.1.0</version>
8
+ </Klevu_Addtocart>
9
+ </modules>
10
+ </config>
app/etc/modules/Klevu_Boosting.xml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <config>
2
+ <modules>
3
+ <Klevu_Boosting>
4
+ <active>true</active>
5
+ <codePool>community</codePool>
6
+ <version>0.1.0</version>
7
+ <depends>
8
+ <Klevu_Search/>
9
+ </depends>
10
+ </Klevu_Boosting>
11
+ </modules>
12
+ </config>
app/etc/modules/Klevu_Content.xml ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Klevu_Content>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ <version>0.1.0</version>
8
+ <depends>
9
+ <Klevu_Search/>
10
+ </depends>
11
+ </Klevu_Content>
12
+ </modules>
13
+ </config>
app/etc/modules/Klevu_Searchterms.xml ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Klevu_Searchterms>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ <version>0.1.0</version>
8
+ <depends>
9
+ <Klevu_Search/>
10
+ </depends>
11
+ </Klevu_Searchterms>
12
+ </modules>
13
+ </config>
js/klevu/search/lib/Wizard.js CHANGED
@@ -152,7 +152,7 @@ function showPopup(sUrl) {
152
  id:'popup_window',
153
  className: 'magento',
154
  url: sUrl,
155
- title: "Klevu Search Pro Features",
156
  width: 1000,
157
  height: 600,
158
  minimizable: false,
@@ -169,12 +169,46 @@ function showPopup(sUrl) {
169
  oPopup.showCenter(true);
170
  }
171
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
172
  function closePopup() {
173
  Windows.close('popup_window');
174
  }
175
 
176
- function checkplan()
177
  {
178
- showPopup("http://www.klevu.com/magento-free-vs-pro.html");
 
 
 
 
 
 
 
 
 
179
  }
180
  var klevu_search_wizard_configure_user_form = new varienForm('klevu_search_wizard_configure_user_form');
 
 
152
  id:'popup_window',
153
  className: 'magento',
154
  url: sUrl,
155
+ title: "Compare Plans",
156
  width: 1000,
157
  height: 600,
158
  minimizable: false,
169
  oPopup.showCenter(true);
170
  }
171
 
172
+ function showTermsPopup(sUrl) {
173
+ oPopup = new Window({
174
+ id:'popup_window',
175
+ className: 'magento',
176
+ url: sUrl,
177
+ title: "Terms of Service",
178
+ width: 1000,
179
+ height: 600,
180
+ minimizable: false,
181
+ maximizable: false,
182
+ showEffectOptions: {
183
+ duration: 0.4
184
+ },
185
+ hideEffectOptions:{
186
+ duration: 0.4
187
+ },
188
+ destroyOnClose: true
189
+ });
190
+ oPopup.setZIndex(100);
191
+ oPopup.showCenter(true);
192
+ }
193
+
194
+
195
  function closePopup() {
196
  Windows.close('popup_window');
197
  }
198
 
199
+ function compareplan()
200
  {
201
+ showPopup("http://www.klevu.com/support/magento-links/compare-plans.html");
202
+ }
203
+
204
+ function termsofservice()
205
+ {
206
+ showTermsPopup("http://www.klevu.com/support/magento-links/terms-of-service.html");
207
+ }
208
+
209
+ function upgradeLink(url){
210
+ window.open(url,'_blank');
211
  }
212
  var klevu_search_wizard_configure_user_form = new varienForm('klevu_search_wizard_configure_user_form');
213
+
214
+
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Klevu_SmartSearch</name>
4
- <version>1.1.26</version>
5
  <stability>stable</stability>
6
  <license uri="http://klevu.com">Commercial</license>
7
  <channel>community</channel>
@@ -14,13 +14,19 @@ Intelligent boosting - Just select products you want to promote, no need to manu
14
  Dynamic filters - Shoppers get excellent shopping experience.&#xD;
15
  Search as you type - Shoppers see results even with long keywords.&#xD;
16
  Actionable insights - Drive traffic by learning from shoppers' search patterns.</description>
17
- <notes>- bug fixes for catalog price rule &#xD;
18
- - Css change&#xD;
 
 
 
 
 
 
19
  </notes>
20
  <authors><author><name>Klevu</name><user>Klevu</user><email>niraj.aswani@klevu.com</email></author></authors>
21
- <date>2015-11-02</date>
22
- <time>05:47:50</time>
23
- <contents><target name="mageetc"><dir name="modules"><file name="Klevu_Search.xml" hash="49674c121481f67bcfc2f31bb21e5aaf"/></dir></target><target name="magecommunity"><dir name="Klevu"><dir name="Search"><dir name="Block"><dir name="Adminhtml"><dir name="Form"><dir name="Field"><dir name="Attribute"><file name="Mappings.php" hash="293c4d19663fa3aad76c17287fec2114"/></dir><dir name="Automatic"><dir name="Attribute"><file name="Mappings.php" hash="b0d192bd03319957d09f34d510914a2f"/></dir></dir><dir name="Html"><file name="Select.php" hash="adc22272b93deb46b524f46f7000972f"/></dir><dir name="Image"><file name="Log.php" hash="5be8e22db76874a10914b297425532c6"/></dir><dir name="Store"><dir name="Level"><file name="Label.php" hash="df3680c83924ece232eb14bd0b7ac9b3"/></dir></dir><dir name="Sync"><file name="Button.php" hash="aeec22e3e952e40d1e1bed33a9e8185b"/></dir></dir><file name="Information.php" hash="b422d8aa8524b4277f2b4013e90379a0"/><file name="Klevuinfo.php" hash="d2532a3a273acd33515165b3d98ac4d1"/><file name="Syncoptionsinfo.php" hash="28621e3bd17eb8216639fa3a2da47840"/></dir><file name="Notifications.php" hash="9fc2511a89e04cb2c9ce86fc7c3684cd"/><dir name="Wizard"><dir name="Config"><file name="Button.php" hash="d17ba7640d5777612ab9fb27f85aa5c9"/></dir><dir name="Configure"><file name="Attributes.php" hash="3801cd4ebb45b3d29cfbacf830af2874"/><file name="Store.php" hash="a5e900bf91db47115ce54497669fd384"/><file name="User.php" hash="f353da92a383854f419333e842380273"/></dir></dir></dir><dir name="Catalog"><dir name="Product"><file name="Tracking.php" hash="e314132d47d15ba686c62a0d5ce1668e"/></dir></dir></dir><dir name="Helper"><file name="Api.php" hash="489164a62c7d54f5365c09ec537e3e44"/><file name="Compat.php" hash="3726862a4576a53c5a44dda59a1e9a86"/><file name="Config.php" hash="02fdd9e550f7de14a1a3eae95a8bb9ad"/><file name="Data.php" hash="723455bc7edd6ad01373bec31b2bac87"/></dir><dir name="Model"><dir name="Api"><dir name="Action"><file name="Addrecords.php" hash="eeba80aa6abf651cf3ef2b0584cd4354"/><file name="Adduser.php" hash="d8b6e6d37fe6ce522747fd6951c8e9df"/><file name="Addwebstore.php" hash="ea33f2c7032682a6ec2bdb8324cdaf0e"/><file name="Debuginfo.php" hash="dd92df091719aa73eca07a08d9681d42"/><file name="Deleterecords.php" hash="0e404db0aab2c58ff90a4e7e4fe73818"/><file name="Gettimezone.php" hash="4bb572b68f42236d765f8194e413b1ca"/><file name="Getuserdetail.php" hash="849a0f04bfdbf39ae75a2627d26717ca"/><file name="Idsearch.php" hash="9244fbdf1e67beea19c99ad0a014d0fc"/><file name="Producttracking.php" hash="50dacac910b7a68b035078771e9f8ff6"/><file name="Removetestmode.php" hash="bd2e7ecf6c233b1430e2989b2b62000f"/><file name="Searchtermtracking.php" hash="e58d1c361cdc8c57886ecaaa7218b394"/><file name="Startsession.php" hash="14edcef879dce92c76a9c78d4106fc6c"/><file name="Updaterecords.php" hash="9e99ce8da72a030b10e9af8353233427"/></dir><file name="Action.php" hash="792f3fe4348f7d13bdf09562ec0d8b59"/><dir name="Request"><file name="Get.php" hash="2d6f510d4dcc171b8e44322b76a49f93"/><file name="Post.php" hash="a46b484a50ced15e2c02deb16bbeb6bb"/><file name="Xml.php" hash="73b3f04d29c2bd79c470d7b81cfc0390"/></dir><file name="Request.php" hash="7f15814e8a01982499563e0e056d2d52"/><dir name="Response"><file name="Data.php" hash="9dbe8e28a501feacb07a6ce2bcc4deb8"/><file name="Empty.php" hash="5988ec43c1756cf4acfedb212787b2b9"/><file name="Invalid.php" hash="8287280c3b99f64e08cf54a0bf65e4a1"/><file name="Message.php" hash="5b6d717c75014e798e619e3df2008d29"/><file name="Search.php" hash="96b9bdef60811c4d994cb457f0d355a9"/><file name="Timezone.php" hash="ffa4d48e42fa52d2c928e202c2af61fd"/></dir><file name="Response.php" hash="b2c244001dedd653e1f0953d6bf25e0e"/></dir><dir name="Catalog"><dir name="Model"><file name="Config.php" hash="57ae55e3cea3dd1b4c60dafcb06d5efd"/></dir></dir><dir name="CatalogSearch"><dir name="Layer"><dir name="Filter"><file name="Attribute.php" hash="104ac92f6ef59879b593a9f1baffd562"/><file name="Category.php" hash="39e56a1a1a1070f09fce2bec6d48c4ce"/><file name="Price.php" hash="4ca1e56183364670fb39a88ea5666c13"/></dir></dir><dir name="Resource"><dir name="Fulltext"><file name="Collection.php" hash="f784533c34276e7f104ab3496233d1a0"/></dir><dir name="Layer"><dir name="Filter"><file name="Attribute.php" hash="d675e50ad7c5277b9ca4100770ac16d3"/></dir></dir></dir></dir><dir name="Config"><dir name="Log"><file name="Level.php" hash="ef07b22f48c4ca72066bf90a1cf9ac27"/></dir></dir><file name="Cron.php" hash="0936cc2667e056182668c9f61fc171bc"/><file name="Notification.php" hash="771d45868668c5b925e3bf2202482b43"/><file name="Observer.php" hash="d006410363a88869fdd3b64046b0e593"/><dir name="Order"><file name="Sync.php" hash="1f5c2290ba46ab597f6e85747093bb16"/></dir><dir name="Product"><file name="Sync.php" hash="69ee0281341ff02c8d4d2f8ce2dc1bdd"/></dir><dir name="Resource"><dir name="Notification"><file name="Collection.php" hash="936a242678b1c89853149e9dc77b6aff"/></dir><file name="Notification.php" hash="f3206c5286bf6ccb4df268c54fcff0f5"/></dir><file name="Session.php" hash="a4ab94b093ba8a414fbfa031f0d2cabe"/><file name="Sync.php" hash="f9f6f4d1251d493944ab13f1467d5257"/><dir name="System"><dir name="Config"><dir name="Source"><dir name="Additional"><file name="Attributes.php" hash="d91e1af65488d647b035fbb100a4eb1d"/></dir><dir name="Boosting"><file name="Attribute.php" hash="f6db7762064a7e97ca73b5e15757148f"/></dir><file name="Frequency.php" hash="5866e9d92476cdaa8a5f27c5fa0dc48b"/><file name="Landingoptions.php" hash="058c81eb9faec57f6c77db697ff3279e"/><dir name="Log"><file name="Level.php" hash="ba2bee63eb18b966db6beade72293036"/></dir><dir name="Product"><file name="Attributes.php" hash="f99ced41d6504f1570a703e66743dd0b"/></dir><file name="Syncoptions.php" hash="6114fd30c79d1d268b039c09f93e9f74"/><file name="Yesnoforced.php" hash="0cf0e7842afae56af0caf92c9490295b"/></dir></dir></dir></dir><dir name="Test"><dir name="Config"><file name="Base.php" hash="a1a8faa15e50cd1d394bc79ca94f712b"/></dir><dir name="Controller"><dir name="CatalogSearch"><dir name="fixtures"><file name="search_results.yaml" hash="bfa6ebad238b75d771b89fb369201540"/></dir></dir><file name="CatalogSearch.php" hash="f6c2615ef27061d0cce7e7eae717c040"/></dir><dir name="Helper"><file name="Api.php" hash="c8484c149e920b3f74b8f6f2dce82936"/><file name="Compat.php" hash="8bae993e0da8f368eb50689f271446a5"/><dir name="Config"><dir name="fixtures"><file name="testGetOrderSyncEnabledFlag.yaml" hash="d1427ea15734ca336c47aad51ad7026e"/><file name="testGetOrderSyncFrequency.yaml" hash="52dffcad75b15761a695eb451b99c751"/><file name="testGetProductSyncEnabledFlag.yaml" hash="43e7263c8b781ef7fb6efbb6598f0226"/><file name="testGetProductSyncFrequency.yaml" hash="004e62dfa22c9abfd8dcf56c92270e19"/><file name="testIsExtensionEnabledDisabled.yaml" hash="5d706b347b4f32f87dc8eb4dd6102148"/><file name="testIsExtensionEnabledEnabled.yaml" hash="52c9eb8a4fad4d8f3ba25c68d35977f3"/></dir><dir name="providers"><file name="testIsOrderSyncEnabled.yaml" hash="938cc58e15b310ba2760be6c64e3d3cb"/><file name="testIsProductSyncEnabled.yaml" hash="5be1dcfb21264a012de32cbd252a09c9"/><file name="testIsTestModeEnabled.yaml" hash="d41d8cd98f00b204e9800998ecf8427e"/></dir></dir><file name="Config.php" hash="9ef7b00d63104e11426f3085afa36744"/><dir name="Data"><dir name="providers"><file name="testBytesToHumanReadable.yaml" hash="7cdb8705e108715abc63fa2cfd81626b"/><file name="testGetLanguageFromLocale.yaml" hash="c301f8dc090142627f6af4e4222b7708"/><file name="testHumanReadableToBytes.yaml" hash="dd89ae5b6705cfcfbf42ba64432c0f0a"/><file name="testIsProductionDomain.yaml" hash="f88ef0f80073fdb9cbdbd020348527a7"/></dir></dir><file name="Data.php" hash="93bb38ec55380a6ec7d79008496cac34"/></dir><dir name="Model"><dir name="Api"><dir name="Action"><dir name="Addrecords"><dir name="providers"><file name="testValidateRequiredFields.yaml" hash="26eea8bfc58c60e4a2f07dcbddc2e6fd"/><file name="testValidateRequiredFieldsRecords.yaml" hash="590b7ec9b7c33debb740b8c6c6db717f"/><file name="testValidateRequiredFieldsRecordsAllowedEmpty.yaml" hash="f82933b3d219491015cef39a214543bd"/><file name="testValidateRequiredFieldsRecordsEmpty.yaml" hash="d5dcd5aad682db42b1352c35b8905d47"/><file name="testValidateRequiredFieldsRecordsOptional.yaml" hash="25092bb84ba311815ca33971a388256e"/></dir></dir><file name="Addrecords.php" hash="14f5c217fac3f82957f54916fa29b387"/><dir name="Adduser"><dir name="providers"><file name="testValidateRequiredFields.yaml" hash="841f068ff3ffd8081ccc91e8675f998c"/></dir></dir><file name="Adduser.php" hash="5189f29f08c4ed30d9b6ac83429de3d0"/><dir name="Addwebstore"><dir name="providers"><file name="testValidateRequiredFields.yaml" hash="e52324b58b76d2d63cfa83ee228e1b31"/></dir></dir><file name="Addwebstore.php" hash="fbeac1b8adc5df45ef08a0a3331e5fbc"/><dir name="Getuserdetail"><dir name="providers"><file name="testValidateRequiredFields.yaml" hash="297df49838c47536bc9ee928b27470b2"/></dir></dir><file name="Getuserdetail.php" hash="4733d1ec7fd5b3b765aa88f182adf390"/><dir name="Idsearch"><dir name="providers"><file name="testValidateRequiredFields.yaml" hash="f36c1a1a1e6d1f5a2d3a59d8d349036e"/></dir></dir><file name="Idsearch.php" hash="4c8849b460a0df494911e3a4df65719c"/><dir name="Producttracking"><dir name="providers"><file name="testValidateRequiredFields.yaml" hash="4bc690980c701649d17ff6caba3ef646"/></dir></dir><file name="Producttracking.php" hash="04d8ef59f24f848d36493aabfa413828"/><file name="Startsession.php" hash="c1ae49d22b5e75672b8d84499d51f3d4"/></dir><file name="Action.php" hash="14ce7e11eb3acfda2dfea539c8f5254b"/><dir name="Request"><dir name="Xml"><dir name="providers"><file name="testGetDataAsXml.yaml" hash="4aa16e3557481444ba39775ee0b99d29"/></dir></dir><file name="Xml.php" hash="279a5defe0c933540e9635455590d8b1"/></dir><file name="Request.php" hash="b0cbdfe6a023d0479dc1b1c7fc6869c0"/><dir name="Response"><dir name="Data"><dir name="providers"><file name="testIsSuccessful.yaml" hash="f085922f4329b3d6b19c1e0010d3ca22"/></dir></dir><file name="Data.php" hash="1ab05c7225658f54bd31f0c205d05a2b"/><file name="Empty.php" hash="9933c42aa9ff06977ca3e53d2de15857"/><file name="Invalid.php" hash="bb68f25a053b7e5fc024bce0f5286fcb"/><dir name="Message"><dir name="providers"><file name="testIsSuccessful.yaml" hash="d53562002270a0c4b58ca94733309a21"/></dir></dir><file name="Message.php" hash="135c0d136fa9d0e86158407fc59294c3"/><dir name="Timezone"><dir name="providers"><file name="testIsSuccessful.yaml" hash="67f35e7ee5081689a1eddb867ae6256d"/></dir></dir><file name="Timezone.php" hash="f9cb063ef1f506f656a25c6206899eb3"/><dir name="providers"><file name="response_testIsSuccessful.yaml" hash="ac214d5ebf1eccb89e8fa85e8e3cbb75"/></dir></dir><file name="Response.php" hash="dbcce43ccb2cdf47bce5c05fcf27e759"/><dir name="Test"><file name="Case.php" hash="ec6d3169b9e2bd26655687124be779dd"/></dir><dir name="data"><file name="data_response_data.xml" hash="cd2e5d3dcac402828b9e5f0b0b637c76"/><file name="data_response_failure.xml" hash="ba677628e68149e0283729c1c8e5e86a"/><file name="data_response_no_response.xml" hash="98944f0eda050221de59100f4b22f030"/><file name="data_response_success.xml" hash="e92d1cfcd4461dc8d3fcabe1f902b40b"/><file name="data_response_success_only.xml" hash="276055d04a3f112efe9e6f1c337d7699"/><file name="message_response_failure.xml" hash="ab63c55523b26bd53ea6abf426dd11f5"/><file name="message_response_missing_message.xml" hash="4a43490eda6f33804ca400da2f9cdac1"/><file name="message_response_missing_status.xml" hash="39103fec18a0be88e4ff00a8149c8ad4"/><file name="message_response_session_id.xml" hash="415f25f79a3795ae70b983504cbb784f"/><file name="message_response_success.xml" hash="3ac53566b3d187cb81eb04d40a195c50"/><file name="response_malformed.xml" hash="bfeb4e75829a42082a7935a8e7be491e"/><file name="response_noxml.xml" hash="2debfdcf79f03e4a65a667d21ef9de14"/><file name="response_valid.xml" hash="c915992330f0e4bd37bb629637139f98"/><file name="search_response_empty.xml" hash="601298402d21f3626052634cbbb0ae72"/><file name="search_response_paged.xml" hash="04203807a1d6df787c54afd84690a50e"/><file name="search_response_sorted.xml" hash="c3ee65658a56f65334417328c7fbdcac"/><file name="search_response_success.xml" hash="fea4e59e7ae6e68b387729e320d5f49c"/><file name="startsession_response_success.xml" hash="1865ee2da80359e5a84914c56cae2c8d"/><file name="timezone_response_no_data.xml" hash="276055d04a3f112efe9e6f1c337d7699"/><file name="timezone_response_no_status.xml" hash="bd695479b03e3607196f01f627af4a45"/><file name="timezone_response_with_failure.xml" hash="69a6b1fa7b2cf087d85be162064525b0"/><file name="timezone_response_with_success.xml" hash="e6888eca066741675d228ba1397b5554"/></dir></dir><dir name="Config"><dir name="Log"><file name="Level.php" hash="2032f568dc75c8a5ff63c7daaf8bd049"/></dir></dir><dir name="Notification"><dir name="fixtures"><file name="testLoad.yaml" hash="305afce09851bb40e8c990c138aff162"/></dir></dir><file name="Notification.php" hash="889ec647dbdb938741cfc75e1baa2bc2"/><dir name="Observer"><dir name="fixtures"><file name="testLandingPageRewritesDisabled.yaml" hash="88f0c274444dbaab4fded639b4f40048"/><file name="testLandingPageRewritesEnabled.yaml" hash="bfe60a7ccc0ac73c664f24a4b7394343"/><file name="testScheduleOrderSync.yaml" hash="170806194b4a1bd7f00bc346a51709e1"/></dir></dir><file name="Observer.php" hash="73349e9c475129197c2cf55a1e1d4cdc"/><dir name="Order"><dir name="Sync"><dir name="fixtures"><file name="testAddOrderToQueue.yaml" hash="c93c3c28273757a13b878f97dd0b9e97"/><file name="testClearQueue.yaml" hash="d7ad7abd553e333e84cbab149cdcfb31"/><file name="testRun.yaml" hash="44f091d24de97d230f61fcaf3689ba81"/></dir></dir><file name="Sync.php" hash="d2166272904e003b6bea3862f66e0235"/></dir><dir name="Product"><dir name="Sync"><dir name="fixtures"><file name="testAddProducts.yaml" hash="0ac9a9e6666f285eff796d30c8e0a4e3"/><file name="testCatalogruleProducts.yaml" hash="c37fe4fe86fda18d9fd90794ea1520e4"/><file name="testClearAllProducts.yaml" hash="b7ec8b285d34a27e1c50d572b5ae8227"/><file name="testDeleteProducts.yaml" hash="22f94366cc64b6980b8d648067920533"/><file name="testRun.yaml" hash="eaac2bf57835625a6cd80294e6c5a99c"/><file name="testSpecialpriceProducts.yaml" hash="7d44672dcf91473c0bf1d9cb523a394a"/><file name="testUpdateProducts.yaml" hash="61266411faa659dc175f75ffbccce97e"/></dir></dir><file name="Sync.php" hash="62c07a8123480172bba781b78103fcf6"/></dir><dir name="Sync"><dir name="providers"><file name="testSchedule.yaml" hash="97f1043c42eb74162ae97941dc920d8f"/></dir></dir><file name="Sync.php" hash="8c091e168e251761be7fb1d1d2149305"/><dir name="System"><dir name="Config"><dir name="Source"><dir name="Test"><dir name="providers"><file name="testIsValidSourceModel.yaml" hash="cfedc94014707ee5586dd212b4d1ee16"/></dir></dir><file name="Test.php" hash="3e915599d4f76a2fbbb20aed9ffdf968"/></dir></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Klevu"><file name="NotificationsController.php" hash="e6a8f7ee4ca5463bb9b3df5fa901b6b1"/><dir name="Search"><file name="WizardController.php" hash="f8b68edbffcd6dae88c7d0e5b1751da6"/></dir><file name="SearchController.php" hash="85f8b8ee09a575534c1c6c4bb136f8eb"/></dir></dir><file name="IndexController.php" hash="2ed1a9392ce871e0b733bbaead48f6f3"/></dir><dir name="etc"><file name="adminhtml.xml" hash="6ce395b9dec2d88a7709d0917c13d50f"/><file name="config.xml" hash="4e27d5e712025adf2bf4b6fdfd27d654"/><file name="system.xml" hash="d0f6d278f01ee90368e8307268bd8f9a"/></dir><dir name="sql"><dir name="klevu_search_setup"><file name="mysql4-data-upgrade-1.1.1-1.1.2.php" hash="a65f702cf64af452f2fb6f6cdac130a7"/><file name="mysql4-data-upgrade-1.1.22-1.1.23.php" hash="79a74acda887a3a5e435a4793bd39dfd"/><file name="mysql4-data-upgrade-1.1.25-1.1.26.php" hash="0c31a59a5562739a00909738ef26d742"/><file name="mysql4-install-1.0.0.php" hash="860c1991c2ebf804f939598e9932edf5"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="klevu"><dir name="search"><dir name="form"><dir name="field"><file name="array_readonly.phtml" hash="d3a3be4cf22f89d84bd73121a1adfa86"/><dir name="sync"><file name="button.phtml" hash="dae55579390ed8b72e1fadcbb538442b"/><file name="logbutton.phtml" hash="d31dd881015319d78d9fb2b83874f296"/></dir></dir><file name="information.phtml" hash="26f0370ba789126b6aa5895b48600166"/><file name="klevuinfo.phtml" hash="87ae995129b69b329da65ac0b4058683"/></dir><file name="notifications.phtml" hash="090714ca57b11d24769c1baa1bcd4615"/><dir name="wizard"><file name="complete.phtml" hash="aeca8d1a3335b461f5e6bcbba08c22b6"/><dir name="config"><file name="button.phtml" hash="b1644ee569882b05c2d8cb2f1eecddbc"/></dir><dir name="configure"><file name="attributes.phtml" hash="d54f0a86e78390fbe66825d0771aad25"/><file name="store.phtml" hash="037b9de18293b3dba4511409e4f3f30a"/><file name="user.phtml" hash="8f5d6da7920bfbcc8eb600634fa7a14b"/></dir><dir name="form"><dir name="field"><file name="array.phtml" hash="ccdccab02fbd9cfc2145f094d5e12a2e"/></dir></dir></dir></dir></dir></dir><dir name="layout"><dir name="klevu"><file name="search.xml" hash="f385a7290bad22fb212b440afa82d2a7"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="klevu"><file name="search.xml" hash="7c581fe86dd6379ccdfdfce5120e43ca"/></dir></dir><dir name="template"><dir name="klevu"><dir name="search"><file name="form_js.phtml" hash="a5141d394a3b34b57ceea83031400081"/><file name="index.phtml" hash="abdd1e62171a43fee32e35ac42099843"/><file name="klevulog.phtml" hash="9cebbd9ec162570768aefc30c777fb78"/><file name="product_tracking.phtml" hash="e773b0cfcc8c3649bf26cc83d71345ec"/></dir></dir></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="klevu"><dir name="search"><dir name="lib"><file name="Wizard.js" hash="a90f1eae9f2603421a38fd822260344f"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="klevu"><dir name="search"><file name="notifications.css" hash="80954cfc49bb2bc45d2eafb7c28cedad"/><file name="wizard.css" hash="824f735715f3ed97ce98414b9895e46b"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="klevu"><file name="klevu-landing-page-style.css" hash="3b610e806f513b56a9b7d4c05ad071cd"/><file name="klevu-landing-responsive.css" hash="811e1bfece09ba7d5529fec850963ac6"/></dir></dir><dir name="images"><dir name="klevu"><file name="btn-gridview.png" hash="c3dd97f4f53e1dfe34b6c5b6b4237b8a"/><file name="btn-listview.png" hash="00aaaa62d67e252248d6075f53b04f7f"/><file name="ku-loader.gif" hash="6050f5bcf455cc8f0332dd65e72f8e52"/></dir></dir></dir></dir></dir></target></contents>
24
  <compatible/>
25
- <dependencies><required><php><min>5.3.0</min><max>5.6.0</max></php></required></dependencies>
26
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Klevu_SmartSearch</name>
4
+ <version>1.2.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://klevu.com">Commercial</license>
7
  <channel>community</channel>
14
  Dynamic filters - Shoppers get excellent shopping experience.&#xD;
15
  Search as you type - Shoppers see results even with long keywords.&#xD;
16
  Actionable insights - Drive traffic by learning from shoppers' search patterns.</description>
17
+ <notes>- Price tag added &#xD;
18
+ - Catalog rule price change&#xD;
19
+ - Cms configuration included&#xD;
20
+ - Change in store configuration wizard&#xD;
21
+ - Bug fix for store code url&#xD;
22
+ - Added category pages by default&#xD;
23
+ - Search term page setting&#xD;
24
+ &#xD;
25
  </notes>
26
  <authors><author><name>Klevu</name><user>Klevu</user><email>niraj.aswani@klevu.com</email></author></authors>
27
+ <date>2016-02-10</date>
28
+ <time>11:12:46</time>
29
+ <contents><target name="mageetc"><dir name="modules"><file name="Klevu_Search.xml" hash="49674c121481f67bcfc2f31bb21e5aaf"/><file name="Klevu_Boosting.xml" hash="760dd6473e4c12c619691c6c553a4658"/><file name="Klevu_Content.xml" hash="36bede0a8b596e50aa11cac1ed7b0c5e"/><file name="Klevu_Searchterms.xml" hash="b1ff813c77dbbb1d1d555c11f699fc8e"/><file name="Klevu_Addtocart.xml" hash="88c66ba423c823ce3a86670b4e2c1f65"/></dir></target><target name="magecommunity"><dir name="Klevu"><dir name="Boosting"><dir name="Block"><dir name="Adminhtml"><dir name="Boost"><dir name="Edit"><file name="Form.php" hash="f383d355c07e8f6930037a3cb663fea8"/><dir name="Tab"><file name="Actions.php" hash="bea65d14949e38f7e2470f596e6a8757"/><file name="Conditions.php" hash="48d378c2a7fc4bc07e1fcd3b765f4d78"/><file name="Form.php" hash="ceb369273be213ab6c0699edf029f8f5"/></dir><file name="Tabs.php" hash="956926b08afbd7d5c24d4015b8d5fb1a"/></dir><file name="Edit.php" hash="102725d29f9a72655baa68f334837d2c"/><file name="Grid.php" hash="57cf6190293cb6d08862d4bbe10d3e33"/></dir><file name="Boost.php" hash="ca0e56e107ef39310f81d43ad16f6ae5"/><dir name="Form"><dir name="Field"><dir name="Rule"><file name="Button.php" hash="097d738836c5482fe6aaa05186bf2db9"/></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="5dd9cdbc59b7886d7248a49013ee0692"/></dir><dir name="Model"><dir name="Boost"><dir name="Rule"><dir name="Condition"><file name="Combine.php" hash="f01c5f12ea202559feed422130df4d5f"/><file name="Product.php" hash="f35bd54c39f6412db9e08b78a00687fc"/></dir></dir></dir><file name="Boost.php" hash="b11c92c884361d22e705bde6f18f413a"/><dir name="Mysql4"><dir name="Boost"><file name="Collection.php" hash="1ac0d91b93e00c6ca0c6229b8dce69e0"/></dir><file name="Boost.php" hash="0f1e02a537093d2c7cf6392e691646e8"/></dir><file name="Observer.php" hash="60a570b0a9408c32facbacac05ac0d9e"/><dir name="System"><dir name="Config"><dir name="Source"><dir name="Boosting"><file name="Attribute.php" hash="6debec1229df22e3f4eda58dd781053a"/></dir></dir></dir></dir></dir><dir name="Test"><dir name="Model"><dir name="Boost"><dir name="fixtures"><file name="testGetMatchingProductIds.yaml" hash="023c1cc74e5525ccfbed76d38674243d"/></dir></dir><file name="Boost.php" hash="e2cba3650eeed3e39ed29381a6014579"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="BoostController.php" hash="0f2ce187d18fe74c8445becd6e44acfc"/></dir></dir><dir name="etc"><file name="config.xml" hash="8eeebfd154ffa219e7965996cbec214d"/><file name="system.xml" hash="a9f3647f178f8f373c31a90569ffd651"/></dir><dir name="sql"><dir name="klevu_boosting_setup"><file name="mysql4-install-10.0.0.php" hash="b36ab1905efd2ba496635fd8830d7438"/></dir></dir></dir><dir name="Search"><dir name="Block"><dir name="Adminhtml"><dir name="Form"><dir name="Field"><dir name="Attribute"><file name="Mappings.php" hash="293c4d19663fa3aad76c17287fec2114"/></dir><dir name="Automatic"><dir name="Attribute"><file name="Mappings.php" hash="b0d192bd03319957d09f34d510914a2f"/></dir></dir><dir name="Html"><file name="Select.php" hash="adc22272b93deb46b524f46f7000972f"/></dir><dir name="Image"><file name="Log.php" hash="5be8e22db76874a10914b297425532c6"/></dir><dir name="Store"><dir name="Level"><file name="Label.php" hash="df3680c83924ece232eb14bd0b7ac9b3"/></dir></dir><dir name="Sync"><file name="Button.php" hash="aeec22e3e952e40d1e1bed33a9e8185b"/></dir></dir><file name="Infolinks.php" hash="201b94b4b627bf9053424fcd70bbd101"/><file name="Information.php" hash="b422d8aa8524b4277f2b4013e90379a0"/><file name="Klevuinfo.php" hash="d2532a3a273acd33515165b3d98ac4d1"/><file name="Syncoptionsinfo.php" hash="28621e3bd17eb8216639fa3a2da47840"/></dir><file name="Notifications.php" hash="9fc2511a89e04cb2c9ce86fc7c3684cd"/><dir name="System"><dir name="Config"><dir name="Form"><file name="Field.php" hash="d4e9023e6cdbedceb7145d248168d33b"/></dir></dir></dir><dir name="Wizard"><dir name="Config"><file name="Button.php" hash="d17ba7640d5777612ab9fb27f85aa5c9"/></dir><dir name="Configure"><file name="Attributes.php" hash="3801cd4ebb45b3d29cfbacf830af2874"/><file name="Store.php" hash="a5e900bf91db47115ce54497669fd384"/><file name="User.php" hash="b885cf0d838e5de5d734c4c0c76cb173"/><file name="Userplan.php" hash="5fc147d5266c2251b4388800fe8f78fb"/></dir></dir></dir><dir name="Catalog"><dir name="Product"><file name="Tracking.php" hash="e314132d47d15ba686c62a0d5ce1668e"/></dir></dir></dir><dir name="Helper"><file name="Api.php" hash="f7f1b51781d27032c114ec2392cb5371"/><file name="Compat.php" hash="3726862a4576a53c5a44dda59a1e9a86"/><file name="Config.php" hash="a83918ba8023adbbcfae454b95982907"/><file name="Data.php" hash="2b10f60163baa9c7f327b33b12344b86"/></dir><dir name="Model"><dir name="Adminhtml"><file name="Comment.php" hash="2d3cb94ca5bea4c6ea50f9aa9dd3a936"/></dir><dir name="Api"><dir name="Action"><file name="Addrecords.php" hash="eeba80aa6abf651cf3ef2b0584cd4354"/><file name="Adduser.php" hash="d8b6e6d37fe6ce522747fd6951c8e9df"/><file name="Addwebstore.php" hash="ea33f2c7032682a6ec2bdb8324cdaf0e"/><file name="Checkuserdetail.php" hash="ebe4eeaf8986684bb7081932e68553bf"/><file name="Debuginfo.php" hash="dd92df091719aa73eca07a08d9681d42"/><file name="Deleterecords.php" hash="0e404db0aab2c58ff90a4e7e4fe73818"/><file name="Features.php" hash="f3f22d268fe2e6651cdab8f12c56599a"/><file name="Gettimezone.php" hash="4bb572b68f42236d765f8194e413b1ca"/><file name="Getuserdetail.php" hash="849a0f04bfdbf39ae75a2627d26717ca"/><file name="Idsearch.php" hash="9244fbdf1e67beea19c99ad0a014d0fc"/><file name="Producttracking.php" hash="50dacac910b7a68b035078771e9f8ff6"/><file name="Removetestmode.php" hash="bd2e7ecf6c233b1430e2989b2b62000f"/><file name="Searchtermtracking.php" hash="e58d1c361cdc8c57886ecaaa7218b394"/><file name="Startsession.php" hash="14edcef879dce92c76a9c78d4106fc6c"/><file name="Updaterecords.php" hash="9e99ce8da72a030b10e9af8353233427"/></dir><file name="Action.php" hash="792f3fe4348f7d13bdf09562ec0d8b59"/><dir name="Request"><file name="Get.php" hash="2d6f510d4dcc171b8e44322b76a49f93"/><file name="Post.php" hash="a46b484a50ced15e2c02deb16bbeb6bb"/><file name="Xml.php" hash="73b3f04d29c2bd79c470d7b81cfc0390"/></dir><file name="Request.php" hash="7f15814e8a01982499563e0e056d2d52"/><dir name="Response"><file name="Data.php" hash="9dbe8e28a501feacb07a6ce2bcc4deb8"/><file name="Empty.php" hash="5988ec43c1756cf4acfedb212787b2b9"/><file name="Invalid.php" hash="8287280c3b99f64e08cf54a0bf65e4a1"/><file name="Message.php" hash="5b6d717c75014e798e619e3df2008d29"/><file name="Search.php" hash="96b9bdef60811c4d994cb457f0d355a9"/><file name="Timezone.php" hash="ffa4d48e42fa52d2c928e202c2af61fd"/></dir><file name="Response.php" hash="9d85b7a9e899375df6cffb375cd59ed7"/></dir><dir name="Catalog"><dir name="Model"><file name="Config.php" hash="57ae55e3cea3dd1b4c60dafcb06d5efd"/></dir></dir><dir name="CatalogSearch"><dir name="Layer"><dir name="Filter"><file name="Attribute.php" hash="104ac92f6ef59879b593a9f1baffd562"/><file name="Category.php" hash="39e56a1a1a1070f09fce2bec6d48c4ce"/><file name="Price.php" hash="4ca1e56183364670fb39a88ea5666c13"/></dir></dir><dir name="Resource"><dir name="Fulltext"><file name="Collection.php" hash="ae39faa3bb9ed99678f667f7d86c0420"/></dir><dir name="Layer"><dir name="Filter"><file name="Attribute.php" hash="d675e50ad7c5277b9ca4100770ac16d3"/></dir></dir></dir></dir><dir name="Config"><dir name="Log"><file name="Level.php" hash="ef07b22f48c4ca72066bf90a1cf9ac27"/></dir></dir><file name="Cron.php" hash="0936cc2667e056182668c9f61fc171bc"/><file name="Notification.php" hash="771d45868668c5b925e3bf2202482b43"/><file name="Observer.php" hash="1ccc24d37bafdfb7c3240e3d44de1d70"/><dir name="Order"><file name="Sync.php" hash="1f5c2290ba46ab597f6e85747093bb16"/></dir><dir name="Product"><file name="Sync.php" hash="6c9174a710764f875b2f9f12059e3a6a"/></dir><dir name="Resource"><dir name="Notification"><file name="Collection.php" hash="936a242678b1c89853149e9dc77b6aff"/></dir><file name="Notification.php" hash="f3206c5286bf6ccb4df268c54fcff0f5"/></dir><file name="Session.php" hash="a4ab94b093ba8a414fbfa031f0d2cabe"/><file name="Sync.php" hash="f9f6f4d1251d493944ab13f1467d5257"/><dir name="System"><dir name="Config"><dir name="Source"><dir name="Additional"><file name="Attributes.php" hash="d91e1af65488d647b035fbb100a4eb1d"/></dir><dir name="Boosting"><file name="Attribute.php" hash="f6db7762064a7e97ca73b5e15757148f"/></dir><file name="Frequency.php" hash="5866e9d92476cdaa8a5f27c5fa0dc48b"/><file name="Landingoptions.php" hash="031834ff6c6c794735350120a686c77e"/><dir name="Log"><file name="Level.php" hash="ba2bee63eb18b966db6beade72293036"/></dir><dir name="Product"><file name="Attributes.php" hash="f99ced41d6504f1570a703e66743dd0b"/></dir><file name="Syncoptions.php" hash="6114fd30c79d1d268b039c09f93e9f74"/><file name="Yesnoforced.php" hash="0cf0e7842afae56af0caf92c9490295b"/></dir></dir></dir></dir><dir name="Test"><dir name="Config"><file name="Base.php" hash="a1a8faa15e50cd1d394bc79ca94f712b"/></dir><dir name="Controller"><dir name="CatalogSearch"><dir name="fixtures"><file name="search_results.yaml" hash="bfa6ebad238b75d771b89fb369201540"/></dir></dir><file name="CatalogSearch.php" hash="f6c2615ef27061d0cce7e7eae717c040"/></dir><dir name="Helper"><file name="Api.php" hash="c8484c149e920b3f74b8f6f2dce82936"/><file name="Compat.php" hash="8bae993e0da8f368eb50689f271446a5"/><dir name="Config"><dir name="fixtures"><file name="testGetOrderSyncEnabledFlag.yaml" hash="d1427ea15734ca336c47aad51ad7026e"/><file name="testGetOrderSyncFrequency.yaml" hash="52dffcad75b15761a695eb451b99c751"/><file name="testGetProductSyncEnabledFlag.yaml" hash="43e7263c8b781ef7fb6efbb6598f0226"/><file name="testGetProductSyncFrequency.yaml" hash="004e62dfa22c9abfd8dcf56c92270e19"/><file name="testIsExtensionEnabledDisabled.yaml" hash="5d706b347b4f32f87dc8eb4dd6102148"/><file name="testIsExtensionEnabledEnabled.yaml" hash="52c9eb8a4fad4d8f3ba25c68d35977f3"/></dir><dir name="providers"><file name="testIsOrderSyncEnabled.yaml" hash="938cc58e15b310ba2760be6c64e3d3cb"/><file name="testIsProductSyncEnabled.yaml" hash="5be1dcfb21264a012de32cbd252a09c9"/><file name="testIsTestModeEnabled.yaml" hash="d41d8cd98f00b204e9800998ecf8427e"/></dir></dir><file name="Config.php" hash="9ef7b00d63104e11426f3085afa36744"/><dir name="Data"><dir name="providers"><file name="testBytesToHumanReadable.yaml" hash="7cdb8705e108715abc63fa2cfd81626b"/><file name="testGetLanguageFromLocale.yaml" hash="c301f8dc090142627f6af4e4222b7708"/><file name="testHumanReadableToBytes.yaml" hash="dd89ae5b6705cfcfbf42ba64432c0f0a"/><file name="testIsProductionDomain.yaml" hash="f88ef0f80073fdb9cbdbd020348527a7"/></dir></dir><file name="Data.php" hash="93bb38ec55380a6ec7d79008496cac34"/></dir><dir name="Model"><dir name="Api"><dir name="Action"><dir name="Addrecords"><dir name="providers"><file name="testValidateRequiredFields.yaml" hash="26eea8bfc58c60e4a2f07dcbddc2e6fd"/><file name="testValidateRequiredFieldsRecords.yaml" hash="590b7ec9b7c33debb740b8c6c6db717f"/><file name="testValidateRequiredFieldsRecordsAllowedEmpty.yaml" hash="f82933b3d219491015cef39a214543bd"/><file name="testValidateRequiredFieldsRecordsEmpty.yaml" hash="d5dcd5aad682db42b1352c35b8905d47"/><file name="testValidateRequiredFieldsRecordsOptional.yaml" hash="25092bb84ba311815ca33971a388256e"/></dir></dir><file name="Addrecords.php" hash="14f5c217fac3f82957f54916fa29b387"/><dir name="Adduser"><dir name="providers"><file name="testValidateRequiredFields.yaml" hash="841f068ff3ffd8081ccc91e8675f998c"/></dir></dir><file name="Adduser.php" hash="5189f29f08c4ed30d9b6ac83429de3d0"/><dir name="Addwebstore"><dir name="providers"><file name="testValidateRequiredFields.yaml" hash="e52324b58b76d2d63cfa83ee228e1b31"/></dir></dir><file name="Addwebstore.php" hash="fbeac1b8adc5df45ef08a0a3331e5fbc"/><dir name="Getuserdetail"><dir name="providers"><file name="testValidateRequiredFields.yaml" hash="297df49838c47536bc9ee928b27470b2"/></dir></dir><file name="Getuserdetail.php" hash="4733d1ec7fd5b3b765aa88f182adf390"/><dir name="Getuserfeaturesdetail"><dir name="providers"><file name="testValidateRequiredFields.yaml" hash="e4ef56d9b494fad5392984a144401998"/></dir></dir><file name="Getuserfeaturesdetail.php" hash="601f204cb67a44628c2c951aa8228cd3"/><dir name="Idsearch"><dir name="providers"><file name="testValidateRequiredFields.yaml" hash="f36c1a1a1e6d1f5a2d3a59d8d349036e"/></dir></dir><file name="Idsearch.php" hash="4c8849b460a0df494911e3a4df65719c"/><dir name="Producttracking"><dir name="providers"><file name="testValidateRequiredFields.yaml" hash="4bc690980c701649d17ff6caba3ef646"/></dir></dir><file name="Producttracking.php" hash="04d8ef59f24f848d36493aabfa413828"/><file name="Startsession.php" hash="c1ae49d22b5e75672b8d84499d51f3d4"/></dir><file name="Action.php" hash="14ce7e11eb3acfda2dfea539c8f5254b"/><dir name="Request"><dir name="Xml"><dir name="providers"><file name="testGetDataAsXml.yaml" hash="4aa16e3557481444ba39775ee0b99d29"/></dir></dir><file name="Xml.php" hash="279a5defe0c933540e9635455590d8b1"/></dir><file name="Request.php" hash="b0cbdfe6a023d0479dc1b1c7fc6869c0"/><dir name="Response"><dir name="Data"><dir name="providers"><file name="testIsSuccessful.yaml" hash="f085922f4329b3d6b19c1e0010d3ca22"/></dir></dir><file name="Data.php" hash="1ab05c7225658f54bd31f0c205d05a2b"/><file name="Empty.php" hash="9933c42aa9ff06977ca3e53d2de15857"/><file name="Invalid.php" hash="bb68f25a053b7e5fc024bce0f5286fcb"/><dir name="Message"><dir name="providers"><file name="testIsSuccessful.yaml" hash="d53562002270a0c4b58ca94733309a21"/></dir></dir><file name="Message.php" hash="135c0d136fa9d0e86158407fc59294c3"/><dir name="Timezone"><dir name="providers"><file name="testIsSuccessful.yaml" hash="67f35e7ee5081689a1eddb867ae6256d"/></dir></dir><file name="Timezone.php" hash="f9cb063ef1f506f656a25c6206899eb3"/><dir name="providers"><file name="response_testIsSuccessful.yaml" hash="ac214d5ebf1eccb89e8fa85e8e3cbb75"/></dir></dir><file name="Response.php" hash="dbcce43ccb2cdf47bce5c05fcf27e759"/><dir name="Test"><file name="Case.php" hash="ec6d3169b9e2bd26655687124be779dd"/></dir><dir name="data"><file name="data_response_data.xml" hash="cd2e5d3dcac402828b9e5f0b0b637c76"/><file name="data_response_failure.xml" hash="ba677628e68149e0283729c1c8e5e86a"/><file name="data_response_no_response.xml" hash="98944f0eda050221de59100f4b22f030"/><file name="data_response_success.xml" hash="e92d1cfcd4461dc8d3fcabe1f902b40b"/><file name="data_response_success_only.xml" hash="276055d04a3f112efe9e6f1c337d7699"/><file name="feature_response.xml" hash="4d400030f5c322b6ab85ccbc7bcd2c0d"/><file name="message_response_failure.xml" hash="ab63c55523b26bd53ea6abf426dd11f5"/><file name="message_response_missing_message.xml" hash="4a43490eda6f33804ca400da2f9cdac1"/><file name="message_response_missing_status.xml" hash="39103fec18a0be88e4ff00a8149c8ad4"/><file name="message_response_session_id.xml" hash="415f25f79a3795ae70b983504cbb784f"/><file name="message_response_success.xml" hash="3ac53566b3d187cb81eb04d40a195c50"/><file name="response_malformed.xml" hash="bfeb4e75829a42082a7935a8e7be491e"/><file name="response_noxml.xml" hash="2debfdcf79f03e4a65a667d21ef9de14"/><file name="response_valid.xml" hash="c915992330f0e4bd37bb629637139f98"/><file name="search_response_empty.xml" hash="601298402d21f3626052634cbbb0ae72"/><file name="search_response_paged.xml" hash="04203807a1d6df787c54afd84690a50e"/><file name="search_response_sorted.xml" hash="c3ee65658a56f65334417328c7fbdcac"/><file name="search_response_success.xml" hash="fea4e59e7ae6e68b387729e320d5f49c"/><file name="startsession_response_success.xml" hash="1865ee2da80359e5a84914c56cae2c8d"/><file name="timezone_response_no_data.xml" hash="276055d04a3f112efe9e6f1c337d7699"/><file name="timezone_response_no_status.xml" hash="bd695479b03e3607196f01f627af4a45"/><file name="timezone_response_with_failure.xml" hash="69a6b1fa7b2cf087d85be162064525b0"/><file name="timezone_response_with_success.xml" hash="e6888eca066741675d228ba1397b5554"/></dir></dir><dir name="Config"><dir name="Log"><file name="Level.php" hash="2032f568dc75c8a5ff63c7daaf8bd049"/></dir></dir><dir name="Notification"><dir name="fixtures"><file name="testLoad.yaml" hash="305afce09851bb40e8c990c138aff162"/></dir></dir><file name="Notification.php" hash="889ec647dbdb938741cfc75e1baa2bc2"/><dir name="Observer"><dir name="fixtures"><file name="testLandingPageRewritesDisabled.yaml" hash="88f0c274444dbaab4fded639b4f40048"/><file name="testLandingPageRewritesEnabled.yaml" hash="bfe60a7ccc0ac73c664f24a4b7394343"/><file name="testScheduleOrderSync.yaml" hash="170806194b4a1bd7f00bc346a51709e1"/></dir></dir><file name="Observer.php" hash="73349e9c475129197c2cf55a1e1d4cdc"/><dir name="Order"><dir name="Sync"><dir name="fixtures"><file name="testAddOrderToQueue.yaml" hash="c93c3c28273757a13b878f97dd0b9e97"/><file name="testClearQueue.yaml" hash="d7ad7abd553e333e84cbab149cdcfb31"/><file name="testRun.yaml" hash="44f091d24de97d230f61fcaf3689ba81"/></dir></dir><file name="Sync.php" hash="d2166272904e003b6bea3862f66e0235"/></dir><dir name="Product"><dir name="Sync"><dir name="fixtures"><file name="testAddProducts.yaml" hash="0ac9a9e6666f285eff796d30c8e0a4e3"/><file name="testCatalogruleProducts.yaml" hash="c37fe4fe86fda18d9fd90794ea1520e4"/><file name="testClearAllProducts.yaml" hash="b7ec8b285d34a27e1c50d572b5ae8227"/><file name="testDeleteProducts.yaml" hash="22f94366cc64b6980b8d648067920533"/><file name="testRun.yaml" hash="eaac2bf57835625a6cd80294e6c5a99c"/><file name="testSpecialpriceProducts.yaml" hash="7d44672dcf91473c0bf1d9cb523a394a"/><file name="testUpdateProducts.yaml" hash="61266411faa659dc175f75ffbccce97e"/></dir></dir><file name="Sync.php" hash="62c07a8123480172bba781b78103fcf6"/></dir><dir name="Sync"><dir name="providers"><file name="testSchedule.yaml" hash="97f1043c42eb74162ae97941dc920d8f"/></dir></dir><file name="Sync.php" hash="8c091e168e251761be7fb1d1d2149305"/><dir name="System"><dir name="Config"><dir name="Source"><dir name="Test"><dir name="providers"><file name="testIsValidSourceModel.yaml" hash="cfedc94014707ee5586dd212b4d1ee16"/></dir></dir><file name="Test.php" hash="3e915599d4f76a2fbbb20aed9ffdf968"/></dir></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Klevu"><file name="NotificationsController.php" hash="e6a8f7ee4ca5463bb9b3df5fa901b6b1"/><dir name="Search"><file name="WizardController.php" hash="1da9a698cc4263d7338784b8f1e3e21e"/></dir><file name="SearchController.php" hash="7e9645eac02a8730ddfec5df977ef0be"/></dir></dir><file name="IndexController.php" hash="2ed1a9392ce871e0b733bbaead48f6f3"/></dir><dir name="etc"><file name="adminhtml.xml" hash="6ce395b9dec2d88a7709d0917c13d50f"/><file name="config.xml" hash="6bb086cadd6d07af64c73fa50801ca19"/><file name="system.xml" hash="02560c50ff31a5b1b1d9968900fb7233"/></dir><dir name="sql"><dir name="klevu_search_setup"><file name="mysql4-data-upgrade-1.1.1-1.1.2.php" hash="a65f702cf64af452f2fb6f6cdac130a7"/><file name="mysql4-data-upgrade-1.1.22-1.1.23.php" hash="79a74acda887a3a5e435a4793bd39dfd"/><file name="mysql4-data-upgrade-1.1.25-1.1.26.php" hash="0c31a59a5562739a00909738ef26d742"/><file name="mysql4-data-upgrade-1.1.27-1.1.28.php" hash="b9dcc6b50d2177976e13b61064adfa2a"/><file name="mysql4-install-1.0.0.php" hash="860c1991c2ebf804f939598e9932edf5"/></dir></dir></dir><dir name="Searchterms"><dir name="Block"><dir name="Catalog"><dir name="Product"><file name="Popularterms.php" hash="aa85fe13044e5477b08dc8b5b5b9da24"/></dir></dir><file name="Popularterms.php" hash="aa85fe13044e5477b08dc8b5b5b9da24"/></dir><dir name="Helper"><file name="Data.php" hash="8e9151b766cdb3eda6f78063c3abbe08"/></dir><dir name="Model"><dir name="Api"><dir name="Action"><file name="Boostingscore.php" hash="13ab65ce0a7109d71b6764495cee7790"/><file name="Popularterms.php" hash="8551ebb57c02e80cf36497f324b55955"/></dir></dir><file name="Observer.php" hash="38538cda2093dfa3502b2ba5dd3dd833"/><dir name="Product"><file name="Seo.php" hash="52dcabcd7be98ccceaa2d3cdea6aaa6c"/></dir></dir><dir name="controllers"><file name="IndexController.php" hash="4578e1f39d16335c7a3acd9bb6fdc560"/></dir><dir name="etc"><file name="config.xml" hash="5c8664b8fa4997b2b762e571111868da"/><file name="system.xml" hash="17b7d94f5635e3cbbdaa164ced250e0d"/></dir><dir name="sql"><dir name="klevu_searchterms_setup"><file name="mysql4-data-upgrade-10.0.0-10.0.1.php" hash="d41d8cd98f00b204e9800998ecf8427e"/><file name="mysql4-install-10.0.0.php" hash="d41d8cd98f00b204e9800998ecf8427e"/></dir></dir></dir><dir name="Addtocart"><dir name="Helper"><file name="Data.php" hash="1cf568a02f4d4a319683c986201934e7"/></dir><dir name="etc"><file name="config.xml" hash="bb74783fa2486f42a92efc93ac1b1e8e"/><file name="system.xml" hash="5f214a95e3095fbd78a17f69bf5dc249"/></dir></dir><dir name="Content"><dir name="Block"><dir name="Adminhtml"><dir name="Form"><file name="Cmspages.php" hash="74fc3262b45481e33dad508f48002746"/><dir name="System"><dir name="Config"><dir name="Field"><file name="Select.php" hash="a42ac33f00dfd9346479143ac910f53f"/></dir></dir></dir></dir><dir name="Wizard"><dir name="Configure"><file name="Store.php" hash="6926f8cc65cdcf47bdc89d5067a1e0e4"/></dir></dir></dir><file name="Index.php" hash="4e40ebae7545e7a61a2fcd8da21b7e64"/><file name="Tracking.php" hash="15150693e0d1a6167960f3f96ea3ed22"/></dir><dir name="Helper"><file name="Data.php" hash="3fa32fbc5a5a3ed4396149bdf1fd8e4a"/></dir><dir name="Model"><file name="Content.php" hash="889d353af39dc2c9426faf4bc11c04a5"/><file name="Observer.php" hash="e3f82254218a2db909ecb1d9a2a69b37"/></dir><dir name="Test"><dir name="Controller"><dir name="ContentSearch"><dir name="fixtures"><file name="content_search_results.yaml" hash="952b8215496a66cca9563eea08030f8a"/></dir></dir><file name="ContentSearch.php" hash="9b0e012f2c9bf7d33394361f880020af"/></dir><dir name="Helper"><dir name="Data"><dir name="fixtures"><file name="content_search_results.yaml" hash="65a8b23a351f8b87c2993301361d9191"/><file name="testIsCmsEnabledDisabled.yaml" hash="24e89be563a355b9dcfd6016eb7fe3e2"/><file name="testIsCmsEnabledEnabled.yaml" hash="8903e1fc649bb70f4d76454fced95e2a"/></dir><dir name="providers"><file name="testGetExcludedCmsPages.yaml" hash="954599a138a65fecd75da2366aa6b515"/><file name="testIsCmsSyncEnabled.yaml" hash="9c3006c510c146f6511cae9287b3fdb8"/></dir></dir><file name="Data.php" hash="a8ee9e9d91eece007d94c0d92ddb654b"/></dir><dir name="Model"><dir name="Api"><dir name="data"><file name="message_response_content_success.xml" hash="3ac53566b3d187cb81eb04d40a195c50"/><file name="search_response_empty.xml" hash="39b739de681275c6a192dcd4ce796207"/><file name="search_response_success.xml" hash="15fea6ab852abd01c9630c86b895d773"/><file name="startsession_response_content_success.xml" hash="5fd26f817657ca9e1c1980d59219b28e"/></dir></dir><dir name="Content"><dir name="fixtures"><file name="testAddCms.yaml" hash="3054d1f054399ac080721e9a03be5f0e"/><file name="testClearAllProducts.yaml" hash="b7ec8b285d34a27e1c50d572b5ae8227"/><file name="testCmsRun.yaml" hash="074c89e69ec7a903f224ea430534c12d"/><file name="testDeleteCms.yaml" hash="21071d067eb03b1e546d1e12fe70955b"/><file name="testUpdateCms.yaml" hash="0e3a9db13fdee6858284ebb8b1d31083"/></dir></dir><file name="Content.php" hash="4d2f4c54d5389c686cd745c28fa97d40"/></dir></dir><dir name="controllers"><file name="SearchController.php" hash="b84ae7ea7a66f7c7f78c54fa7afdcfd1"/></dir><dir name="etc"><file name="config.xml" hash="c0e3647d7d4f067f14a45ab037cfc2c8"/><file name="system.xml" hash="de4dfb0d239a9d498c3157ce14d2fd57"/></dir><dir name="sql"><dir name="klevu_content_setup"><file name="mysql4-install-0.1.0.php" hash="d41d8cd98f00b204e9800998ecf8427e"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="klevu"><dir name="boosting"><dir name="form"><dir name="field"><dir name="rule"><file name="button.phtml" hash="f27feff3fad2bbcd68b56df38de5cc83"/></dir></dir></dir></dir><dir name="search"><dir name="form"><dir name="field"><file name="array_readonly.phtml" hash="d3a3be4cf22f89d84bd73121a1adfa86"/><dir name="sync"><file name="button.phtml" hash="dae55579390ed8b72e1fadcbb538442b"/><file name="logbutton.phtml" hash="d31dd881015319d78d9fb2b83874f296"/></dir></dir><file name="information.phtml" hash="9014ac2b78bf4f22be503208b377dc2c"/><file name="klevuinfo.phtml" hash="88f965b9f5ccbbcd6a540ab6197c7f5f"/><file name="quickinfo.phtml" hash="a383bb10176e87206954b5e379d20c7f"/></dir><file name="notifications.phtml" hash="090714ca57b11d24769c1baa1bcd4615"/><dir name="system"><dir name="config"><dir name="form"><dir name="field"><file name="array.phtml" hash="2e55476e647b79114b28d0a3a02704d5"/></dir></dir></dir></dir><dir name="wizard"><file name="complete.phtml" hash="7cf33a9a829eb07148d16da5056324dd"/><dir name="config"><file name="button.phtml" hash="b1644ee569882b05c2d8cb2f1eecddbc"/></dir><dir name="configure"><file name="attributes.phtml" hash="d54f0a86e78390fbe66825d0771aad25"/><file name="store.phtml" hash="ae9229bf0e74a70be66705dba17c5a6c"/><file name="user.phtml" hash="e5678d947c0ccd6f14a23be3df7e9d7d"/><file name="userplan.phtml" hash="948ae8a4cef7e4a5e4f5540fe0c3ee50"/></dir><dir name="form"><dir name="field"><file name="array.phtml" hash="ccdccab02fbd9cfc2145f094d5e12a2e"/></dir></dir></dir></dir></dir></dir><dir name="layout"><dir name="klevu"><file name="boosting.xml" hash="1b5cfeeab8891bc702294eab4e21994c"/><file name="search.xml" hash="26cef989bb342bad783f5d8fc6a49e7f"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="klevu"><dir name="addtocart"><file name="index.phtml" hash="5697e2f53a92173a1ce89a933ac674f4"/><file name="index.phtml" hash="5697e2f53a92173a1ce89a933ac674f4"/></dir><dir name="content"><file name="content_tracking.phtml" hash="54dc6f0ce8112013c1bcaad01899d7bc"/><file name="index.phtml" hash="a6fdec47b211db2177c9ceba0683d302"/><file name="left.phtml" hash="51f0cad58008a71a27e44377319fa044"/><file name="search.phtml" hash="9153e3d532aedb7245837b6119f56f4f"/><file name="top.phtml" hash="2e2e3484388be8eed022ff541fc354f5"/><file name="type_of_query.phtml" hash="25b05bfe942a3bba838a44a8e150a453"/><file name="content_tracking.phtml" hash="54dc6f0ce8112013c1bcaad01899d7bc"/><file name="index.phtml" hash="a6fdec47b211db2177c9ceba0683d302"/><file name="left.phtml" hash="51f0cad58008a71a27e44377319fa044"/><file name="search.phtml" hash="9153e3d532aedb7245837b6119f56f4f"/><file name="top.phtml" hash="2e2e3484388be8eed022ff541fc354f5"/><file name="type_of_query.phtml" hash="25b05bfe942a3bba838a44a8e150a453"/></dir><dir name="learning"><file name="category.phtml" hash="ce6ab73d3c9f2a36ac0d34e7a0cf3280"/><file name="category_tracking.phtml" hash="b825ba28a49b9ebb2e4d15ac5459fbf4"/></dir><dir name="search"><file name="form_js.phtml" hash="a5141d394a3b34b57ceea83031400081"/><file name="index.phtml" hash="abdd1e62171a43fee32e35ac42099843"/><file name="klevulog.phtml" hash="9cebbd9ec162570768aefc30c777fb78"/><file name="product_tracking.phtml" hash="e773b0cfcc8c3649bf26cc83d71345ec"/><file name="form_js.phtml" hash="a5141d394a3b34b57ceea83031400081"/><file name="index.phtml" hash="abdd1e62171a43fee32e35ac42099843"/><file name="klevulog.phtml" hash="9cebbd9ec162570768aefc30c777fb78"/><file name="product_tracking.phtml" hash="e773b0cfcc8c3649bf26cc83d71345ec"/></dir><dir name="searchterm"><file name="popular_searchterms.phtml" hash="4306a14ced0036bdb72158e11d4091d3"/></dir></dir></dir><dir name="layout"><dir name="klevu"><file name="search.xml" hash="7c581fe86dd6379ccdfdfce5120e43ca"/><file name="addtocart.xml" hash="78bb1c4910c4c2c37b49a9c36446f9d5"/><file name="content.xml" hash="b420ba1cceb6b45e8eb1754370439da1"/><file name="searchterms.xml" hash="c0db7111782ef105d6c44281b5a95303"/></dir></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="klevu"><dir name="search"><dir name="lib"><file name="Wizard.js" hash="359afd117dc5cc7ccd14c838eacb573d"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="klevu"><dir name="search"><file name="klevumagestyle.css" hash="1e014f38c2169e415e01b24cba8fa6a0"/><file name="notifications.css" hash="019a5a055bc621cb0f4c166ab8e5604c"/><file name="wizard.css" hash="824f735715f3ed97ce98414b9895e46b"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="klevu"><dir name="content"><file name="klevu-landing-left.css" hash="38c63d7796e4e33b212a1d8b044d0a91"/></dir><file name="klevu-landing-page-style.css" hash="3b610e806f513b56a9b7d4c05ad071cd"/><file name="klevu-landing-responsive.css" hash="811e1bfece09ba7d5529fec850963ac6"/><dir name="search"><file name="klevu-search-term.css" hash="e7e3f2e24073e6fa0949ac157d6d4d34"/></dir></dir></dir><dir name="images"><dir name="klevu"><file name="btn-gridview.png" hash="c3dd97f4f53e1dfe34b6c5b6b4237b8a"/><file name="btn-listview.png" hash="00aaaa62d67e252248d6075f53b04f7f"/><file name="ku-loader.gif" hash="6050f5bcf455cc8f0332dd65e72f8e52"/></dir></dir></dir></dir></dir></target></contents>
30
  <compatible/>
31
+ <dependencies><required><php><min>5.3.0</min><max>5.6.18</max></php></required></dependencies>
32
  </package>
skin/adminhtml/default/default/klevu/search/klevumagestyle.css ADDED
@@ -0,0 +1,413 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .klevu-upgrade-block {
2
+ width:85%;
3
+ padding:5px;
4
+ border-radius:5px;
5
+ position: relative;
6
+ background: #eff5ea;
7
+ border: 1px solid #95a486;
8
+ text-align:center;
9
+ margin-top:15px;
10
+ color: #3d6611;
11
+ }
12
+
13
+ .klevu-upgrade-block-simple {
14
+ width:90%;
15
+ padding:5px;
16
+ border-radius:5px;
17
+ position: relative;
18
+ background: #eff5ea;
19
+ border: 1px solid #95a486;
20
+ text-align:center;
21
+ margin-top:15px;
22
+ color: #3d6611;
23
+ margin-top:25px;
24
+ }
25
+
26
+ .klevu-upgrade-block:after, .klevu-upgrade-block:before {
27
+ bottom: 100%;
28
+ left: 50%;
29
+ border: solid transparent;
30
+ content: " ";
31
+ height: 0;
32
+ width: 0;
33
+ position: absolute;
34
+ pointer-events: none;
35
+ }
36
+
37
+ .klevu-upgrade-block:after {
38
+ border-color: rgba(255, 249, 233, 0);
39
+ border-bottom-color: #eff5ea;
40
+ border-width: 8px;
41
+ margin-left: -8px;
42
+ left:34px;
43
+ }
44
+ .klevu-upgrade-block:before {
45
+ border-color: rgba(238, 226, 190, 0);
46
+ border-bottom-color: #95a486;
47
+ border-width: 10px;
48
+ margin-left: -10px;
49
+ left:34px;
50
+ }
51
+
52
+ .klevu-upgrade-block b{
53
+ color: #3d6611;
54
+ font-size:12px;
55
+ }
56
+
57
+ .kuInfo .kuInfo-fLeft{
58
+ float:left;
59
+ width:31%;
60
+ }
61
+
62
+ .kuInfo .kuInfo-fRight{
63
+ float:right;
64
+ width:68%;
65
+ text-align:right;
66
+ }
67
+
68
+ .kuInfo .kuInfo-fRight ul li{
69
+ display:inline-table;
70
+ padding-left:5px;
71
+ padding-right:5px;
72
+ border-right:1px solid #ccc;
73
+ }
74
+
75
+ .kuInfo .kuInfo-fRight ul li:last-child{
76
+ padding-right:0px;
77
+ }
78
+
79
+ .kuInfo .kuInfo-fRight ul li:first-child, .kuInfo .kuInfo-fRight ul li:last-child{
80
+ border-right:none;
81
+ }
82
+
83
+ .kuInfo .kuInfoClear{
84
+ clear:both;
85
+ }
86
+
87
+ table.kuPlanSelection{
88
+ width:100%;
89
+ border-bottom:1px solid #ddd;
90
+ padding-bottom:8px;
91
+ }
92
+
93
+ table.kuPlanSelection:last-child{
94
+ border-bottom:none;
95
+ }
96
+
97
+
98
+ .klevu-upgrade-block button{
99
+ margin-top:10px;
100
+ }
101
+
102
+ .klevu-upgrade-block a{
103
+ color:#eb5e00;
104
+ font-weight:bold;
105
+ text-decoration:underline;
106
+ }
107
+
108
+
109
+
110
+ .klevu-btn-disabled, .klevu-btn-disabled:hover{
111
+ background: rgba(212,212,212,1);
112
+ background: -moz-linear-gradient(top, rgba(212,212,212,1) 0%, rgba(204,204,204,1) 47%, rgba(196,196,196,1) 100%);
113
+ background: -webkit-gradient(left top, left bottom, color-stop(0%, rgba(212,212,212,1)), color-stop(47%, rgba(204,204,204,1)), color-stop(100%, rgba(196,196,196,1)));
114
+ background: -webkit-linear-gradient(top, rgba(212,212,212,1) 0%, rgba(204,204,204,1) 47%, rgba(196,196,196,1) 100%);
115
+ background: -o-linear-gradient(top, rgba(212,212,212,1) 0%, rgba(204,204,204,1) 47%, rgba(196,196,196,1) 100%);
116
+ background: -ms-linear-gradient(top, rgba(212,212,212,1) 0%, rgba(204,204,204,1) 47%, rgba(196,196,196,1) 100%);
117
+ background: linear-gradient(to bottom, rgba(212,212,212,1) 0%, rgba(204,204,204,1) 47%, rgba(196,196,196,1) 100%);
118
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#d4d4d4', endColorstr='#c4c4c4', GradientType=0 );
119
+ border-color: #999;
120
+ cursor:auto;
121
+ }
122
+
123
+ .kuSelectPlanHeader{
124
+ text-align:center;
125
+ margin-top:10px;
126
+ }
127
+
128
+ .kuSelectPlanHeader h2{
129
+ margin-bottom:5px !important;
130
+ }
131
+
132
+ table.kuPlanDetails{
133
+ width: 85%;
134
+ margin: 0 auto;
135
+ margin-top: 15px;
136
+ }
137
+
138
+ table.kuPlanColumn {
139
+ width:175px;
140
+ background-color:#ffffff;
141
+ border:1px solid #ddd;
142
+ border-radius:5px;
143
+ margin: 0 auto;
144
+ }
145
+
146
+ table.kuPlanColumn tr:first-child td{
147
+ border-bottom:1px solid #ddd;
148
+ padding:5px;
149
+ text-align:center;
150
+ font-size:15px;
151
+ line-height:24px;
152
+ background-color: #009ACD;
153
+ border-top-left-radius:5px;
154
+ border-top-right-radius:5px;
155
+ }
156
+
157
+ table.kuPlanColumn tr:first-child td input[type="radio"]{
158
+ margin-top:-3px;
159
+ }
160
+
161
+ table.kuPlanColumn tr:first-child td label{
162
+ color:#ffffff;
163
+ font-family: Arial;
164
+ }
165
+
166
+
167
+ table.kuOtherPlan{
168
+ width:100%;
169
+ margin-top:20px;
170
+ }
171
+
172
+ table.kuOtherPlan td{
173
+ width:40%;
174
+ }
175
+
176
+ table.kuOtherPlanBox{
177
+ width: 96%;
178
+ margin: 0 auto;
179
+ background-color:#fff;
180
+ border:1px solid #ddd;
181
+ border-radius:5px;
182
+ }
183
+
184
+
185
+ table.kuOtherPlan table.kuOtherPlanBox td.kuOtherPlanHeader{
186
+ width:20% !important;
187
+ background-color: #009ACD;
188
+ border-top-left-radius: 5px;
189
+ font-size:15px;
190
+ text-align:center;
191
+ padding:5px !important;
192
+ border-right:1px solid #dddddd;
193
+ line-height:24px;
194
+ }
195
+
196
+ table.kuOtherPlan table.kuOtherPlanBox td.kuOtherPlanHeader input[type="radio"]{
197
+ margin-top:-3px;
198
+ }
199
+
200
+ table.kuOtherPlan table.kuOtherPlanBox td.kuOtherPlanPrice{
201
+ width:20% !important;
202
+ background-color: #ffffff;
203
+ font-size:13px;
204
+ padding:3px;
205
+ text-align:center;
206
+ color:#1772b0;
207
+ border-right:1px solid #dddddd;
208
+ border-bottom-left-radius: 5px;
209
+ }
210
+
211
+ table.kuOtherPlan table.kuOtherPlanBox td.kuOtherPlanPrice span{
212
+ font-size:12px;
213
+ color:#888888;
214
+ }
215
+
216
+ table.kuOtherPlan table.kuOtherPlanBox td.kuOtherPlanDesc{
217
+ padding:8px !important;
218
+ text-align:center;'
219
+ width:80% !important;
220
+ vertical-align:middle;
221
+ }
222
+
223
+ table.kuOtherPlanBox td:first-child label{
224
+ color:#ffffff;
225
+ }
226
+
227
+ .visuallyhidden {
228
+ display: none;
229
+ }
230
+
231
+ .kuWizardSteps{
232
+ width:100%;
233
+ min-height:70px;
234
+ }
235
+
236
+ .kuWizardSteps .wizard-progress {
237
+ list-style: none;
238
+ list-style-image: none;
239
+ margin: 0;
240
+ padding: 0;
241
+ margin-top: 10px;
242
+ white-space: nowrap;
243
+ width:625px;
244
+ margin:0 auto;
245
+ }
246
+
247
+ .kuWizardSteps .wizard-progress li {
248
+ float: left;
249
+ margin-right: 50px;
250
+ text-align: center;
251
+ position: relative;
252
+ width: 100px;
253
+ }
254
+
255
+ .kuWizardSteps .wizard-progress .step-name {
256
+ display: table-cell;
257
+ height: 32px;
258
+ vertical-align: bottom;
259
+ text-align: center;
260
+ width: 100px;
261
+ font-weight:bold;
262
+ font-size:13px;
263
+ }
264
+
265
+ .kuWizardSteps .wizard-progress .step-name-wrapper {
266
+ display: table-cell;
267
+ height: 100%;
268
+ vertical-align: bottom;
269
+ }
270
+
271
+ .kuWizardSteps .wizard-progress .step-num {
272
+ font-size: 14px;
273
+ font-weight: bold;
274
+ border: 1px solid #999;
275
+ border-radius: 50%;
276
+ width: 20px;
277
+ height:20px;
278
+ display: inline-block;
279
+ margin-top: 10px;
280
+ }
281
+
282
+ .kuWizardSteps .wizard-progress .step-num:after {
283
+ content: "";
284
+ display: block;
285
+ background: #999999;
286
+ height: 1px;
287
+ width: 130px;
288
+ position: absolute;
289
+ bottom: 10px;
290
+ left: 60px;
291
+ }
292
+
293
+ .kuWizardSteps .wizard-progress li:last-of-type .step-num:after {
294
+ display: none;
295
+ }
296
+
297
+ .kuWizardSteps .wizard-progress .active-step .step-num {
298
+ background-color: #97c63b;
299
+ border: 1px solid #999999;
300
+ }
301
+
302
+ .kuWizardSteps .wizard-progress li:last-child{
303
+ margin-right:0px;
304
+ }
305
+
306
+ .kuTooltip {
307
+ outline: none;
308
+ text-decoration: none;
309
+ position: relative;
310
+ }
311
+
312
+ .kuTooltip strong {
313
+ line-height: 30px;
314
+ }
315
+
316
+ .kuTooltip > span {
317
+ display:none;
318
+ width: 300px;
319
+ padding: 10px 20px;
320
+ margin-top: 0;
321
+ margin-left: -120px;
322
+ line-height:20px;
323
+ opacity: 0;
324
+ visibility: hidden;
325
+ z-index: 10;
326
+ position: absolute;
327
+ font-family: Arial;
328
+ font-size: 12px;
329
+ font-style: normal;
330
+ border-radius: 3px;
331
+ box-shadow: 2px 2px 2px #999;
332
+ }
333
+
334
+ /*a.tooltip > span:hover,*/
335
+ .kuTooltip:hover > span {
336
+ opacity: 1;
337
+ text-decoration: none;
338
+ visibility: visible;
339
+ overflow: visible;
340
+ margin-top: -115px;
341
+ display: inline;
342
+ margin-left: -90px;
343
+ }
344
+
345
+ .kuTooltip span b {
346
+ width: 18px;
347
+ height: 18px;
348
+ margin-left: 40px;
349
+ margin-bottom: -20px;
350
+ display: block;
351
+ position: absolute;
352
+ -webkit-transform: rotate(-45deg);
353
+ -moz-transform: rotate(-45deg);
354
+ -o-transform: rotate(-45deg);
355
+ transform: rotate(-45deg);
356
+ }
357
+
358
+ .kuTooltip > span {
359
+ color: #000000;
360
+ background: #FBF5E6;
361
+ border: 1px solid #CFB57C;
362
+ }
363
+
364
+ .kuTooltip span b {
365
+ background: #FBF5E6;
366
+ border-bottom: 1px solid #CFB57C;
367
+ border-left: 1px solid #CFB57C;
368
+ }
369
+
370
+ .kuGuideLink{
371
+ position:absolute;
372
+ right:0;
373
+ margin-right:60px;
374
+ }
375
+
376
+ .kuGuideLink a{
377
+ color:#ea7601;
378
+ }
379
+
380
+ .kuGuideLink a:hover{
381
+ text-decoration:underline;
382
+ }
383
+
384
+ #klevu_search_info_searchinformation{
385
+ overflow:hidden;
386
+ }
387
+
388
+ .kuFinishSyncInfo{
389
+ width:800px;
390
+ margin:0 auto;
391
+ text-align: center;
392
+ margin-bottom:20px;
393
+ margin-top:20px;
394
+ }
395
+
396
+
397
+ .kuFinishSyncInfo ul{
398
+ margin-top: 21px;
399
+ line-height: 22px;
400
+ font-size: 14px;
401
+ text-align: left;
402
+ width: 606px;
403
+ margin: 0 auto;
404
+ }
405
+
406
+ .kuFinishSyncInfo ul li{
407
+ list-style-type: disc;
408
+ }
409
+
410
+ h4.kuCompleteWarning{
411
+ text-align: right;
412
+ font-size: 12px;
413
+ }
skin/adminhtml/default/default/klevu/search/notifications.css CHANGED
@@ -7,4 +7,3 @@
7
  .klevu-notification .dismiss {
8
  float: right;
9
  }
10
-
7
  .klevu-notification .dismiss {
8
  float: right;
9
  }
 
skin/frontend/base/default/css/klevu/content/klevu-landing-left.css ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .kuClrFilterBoth{
2
+ clear:both;
3
+ }
4
+
5
+ .kuFilterLbl{
6
+ display:inline-block !important;
7
+ float:left;
8
+ }
9
+
10
+ .kuFilterClose{
11
+ display:inline-block !important;
12
+ float:right;
13
+ }
14
+ .contentSelect{
15
+ font-weight:bold;
16
+ }
skin/frontend/base/default/css/klevu/search/klevu-search-term.css ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .klevu-search-terms{
2
+ width:100%;
3
+ margin-bottom:20px;
4
+ }
5
+
6
+ .klevu-search-terms h3{
7
+ text-transform:uppercase;
8
+ border-bottom:1px solid #ddd;
9
+ }
10
+
11
+ .klevu-search-terms ul li{
12
+ display:inline;
13
+ margin-bottom:3px;
14
+ margin-right:3px;
15
+
16
+ }