wiser_search - Version 1.0.13

Version Notes

1.0.13
- minor bugfix regarding disabled products
- added reinstall button for restricted development environments
1.0.12
- Added more filterable options for visibility in search
1.0.11
- Added notifications to have realtime updates in screen.
1.0.10
- Added support for affiliate stores
1.0.9
- support more price variations
1.0.8
- Multi storeview content pages support added

Download this release

Release Info

Developer Niels - Rejuni
Extension wiser_search
Version 1.0.13
Comparing to
See all releases


Code changes from version 1.0.12 to 1.0.13

app/code/community/Wiser/Search/Block/Adminhtml/System/Config/Form/Button.php ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Atwix
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-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@magentocommerce.com so we can send you a copy immediately.
14
+
15
+ * @category Atwix Mod
16
+ * @package Atwix_Tweaks
17
+ * @author Atwix Core Team
18
+ * @copyright Copyright (c) 2012 Atwix (http://www.atwix.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+
22
+ class Wiser_Search_Block_Adminhtml_System_Config_Form_Button extends Mage_Adminhtml_Block_System_Config_Form_Field
23
+ {
24
+ /*
25
+ * Set template
26
+ */
27
+ protected function _construct()
28
+ {
29
+ parent::_construct();
30
+ $this->setTemplate('wiser_search/system/config/button.phtml');
31
+ }
32
+
33
+ /**
34
+ * Return element html
35
+ *
36
+ * @param Varien_Data_Form_Element_Abstract $element
37
+ * @return string
38
+ */
39
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
40
+ {
41
+ return $this->_toHtml();
42
+ }
43
+
44
+ /**
45
+ * Return ajax url for button
46
+ *
47
+ * @return string
48
+ */
49
+ public function getAjaxCheckUrl()
50
+ {
51
+ return Mage::helper('adminhtml')->getUrl('adminhtml/adminhtml_wisersearch/check');
52
+ }
53
+
54
+ /**
55
+ * Generate button html
56
+ *
57
+ * @return string
58
+ */
59
+ public function getButtonHtml()
60
+ {
61
+ $button = $this->getLayout()->createBlock('adminhtml/widget_button')
62
+ ->setData(array(
63
+ 'id' => 'wisersearch_button',
64
+ 'label' => $this->helper('adminhtml')->__('Reset Wiser Installation'),
65
+ 'onclick' => 'javascript:check(); return false;'
66
+ ));
67
+
68
+ return $button->toHtml();
69
+ }
70
+ }
app/code/community/Wiser/Search/Helper/ProductData.php CHANGED
@@ -28,6 +28,7 @@ class Wiser_Search_Helper_ProductData
28
  $Data['subcategory'] = $Cats['sub'];
29
  $Data['allcategories'] = $Cats['all'];
30
  $Data['brand']=$Product->getResource()->getAttribute('manufacturer')->getFrontend()->getValue($Product);
 
31
 
32
  $parents = Mage::getResourceSingleton('catalog/product_type_configurable')->getParentIdsByChild($ProductInput);
33
  if( count($parents) > 0 ) {
@@ -57,6 +58,7 @@ class Wiser_Search_Helper_ProductData
57
  }
58
 
59
  $Data['visibility_int'] = $Product->getVisibility();
 
60
  $Data['visibility_bool'] = $Product->getVisibility() > 2;
61
 
62
 
28
  $Data['subcategory'] = $Cats['sub'];
29
  $Data['allcategories'] = $Cats['all'];
30
  $Data['brand']=$Product->getResource()->getAttribute('manufacturer')->getFrontend()->getValue($Product);
31
+ $Data['short_description_html']=$Product->getShortDescription();
32
 
33
  $parents = Mage::getResourceSingleton('catalog/product_type_configurable')->getParentIdsByChild($ProductInput);
34
  if( count($parents) > 0 ) {
58
  }
59
 
60
  $Data['visibility_int'] = $Product->getVisibility();
61
+ $Data['status_int'] = $Product->getStatus();
62
  $Data['visibility_bool'] = $Product->getVisibility() > 2;
63
 
64
 
app/code/community/Wiser/Search/Helper/XmlFeed.php CHANGED
@@ -23,6 +23,11 @@ class Wiser_Search_Helper_XmlFeed
23
  {
24
  foreach($product_fields as $field_name => $field_value)
25
  {
 
 
 
 
 
26
  $field_value = $this->_clean_string($field_value);
27
  $product = $xml_product->addChild($field_name, NULL);
28
  $product->add_cdata($field_value);
@@ -30,7 +35,14 @@ class Wiser_Search_Helper_XmlFeed
30
 
31
  return $xml_product;
32
  }
33
-
 
 
 
 
 
 
 
34
  private function _clean_string($string)
35
  {
36
  $string = strip_tags($string);
23
  {
24
  foreach($product_fields as $field_name => $field_value)
25
  {
26
+ if (strpos($field_name, '_html') !== false) {
27
+ $field_value = $this->_clean_html($field_value);
28
+ } else {
29
+ $field_value = $this->_clean_string($field_value);
30
+ }
31
  $field_value = $this->_clean_string($field_value);
32
  $product = $xml_product->addChild($field_name, NULL);
33
  $product->add_cdata($field_value);
35
 
36
  return $xml_product;
37
  }
38
+
39
+ private function _clean_html($html)
40
+ {
41
+ $html = htmlentities($html);
42
+ $html = iconv("UTF-8","UTF-8//IGNORE",str_replace(array('"',"\r\n","\n","\r","\t"), array(""," "," "," ",""), $html));
43
+ return $html;
44
+ }
45
+
46
  private function _clean_string($string)
47
  {
48
  $string = strip_tags($string);
app/code/community/Wiser/Search/Model/Observer.php CHANGED
@@ -56,15 +56,22 @@ class Wiser_Search_Model_Observer
56
  $_Products = array();
57
  $_Configuration = array();
58
 
59
- foreach ($stores as $store)
60
- {
61
- array_push($_Products, Wiser_Search_Helper_ProductData::_getProductData($product->getId(), $store->getStoreId()));
62
- }
63
-
64
- $xmlFeed = $Feed->build_xml($_Products, $_Configuration);
 
 
65
 
66
- // API Call to push XML to Webhook
67
- $this->webhookUpdateProduct($xmlFeed, "POST");
 
 
 
 
 
68
  }
69
 
70
  public function productAfterDelete($observer) {
@@ -150,9 +157,9 @@ class Wiser_Search_Model_Observer
150
 
151
  curl_close ($ch);
152
 
 
153
  if( $status == 200) {
154
  $data = json_decode($result);
155
-
156
  if( $data !== NULL ) {
157
  Mage::getModel('core/config')->saveConfig('wiser_search/wiser_search_group/api_key', $data->api_key);
158
  Mage::getModel('core/config')->saveConfig('wiser_search/wiser_search_group/script', $data->script);
56
  $_Products = array();
57
  $_Configuration = array();
58
 
59
+ die(var_dump($product->getStatus()));
60
+ if($product->getStatus() !== 2) //2 == disabled
61
+ {
62
+ foreach ($stores as $store)
63
+ {
64
+ array_push($_Products, Wiser_Search_Helper_ProductData::_getProductData($product->getId(), $store->getStoreId()));
65
+ }
66
+ $xmlFeed = $Feed->build_xml($_Products, $_Configuration);
67
 
68
+ // API Call to push XML to Webhook
69
+ $this->webhookUpdateProduct($xmlFeed, "POST");
70
+ } else {
71
+ $_Products = array(array("id" => $product->getId()));
72
+ $xmlFeed = $Feed->build_xml($_Products, $_Configuration);
73
+ $this->webhookUpdateProduct($xmlFeed, "DELETE");
74
+ }
75
  }
76
 
77
  public function productAfterDelete($observer) {
157
 
158
  curl_close ($ch);
159
 
160
+
161
  if( $status == 200) {
162
  $data = json_decode($result);
 
163
  if( $data !== NULL ) {
164
  Mage::getModel('core/config')->saveConfig('wiser_search/wiser_search_group/api_key', $data->api_key);
165
  Mage::getModel('core/config')->saveConfig('wiser_search/wiser_search_group/script', $data->script);
app/code/community/Wiser/Search/controllers/Adminhtml/WiserSearchController.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Wiser_Search_Adminhtml_WiserSearchController extends Mage_Adminhtml_Controller_Action
3
+ {
4
+ /**
5
+ * Check if wiser installation was successfull, if not request reinstall
6
+ *
7
+ * @return void
8
+ */
9
+ public function checkAction()
10
+ {
11
+ $target_url = Mage::getStoreConfig('wiser_search/wiser_search_group/webhook') . '?mode=reinstall';
12
+
13
+ $header = array(
14
+ "Authorization: Basic " . base64_encode( Mage::getStoreConfig('wiser_search/wiser_search_group/api_key')),
15
+ // "Content-type: text/plain"
16
+ );
17
+
18
+ $ch = curl_init();
19
+ //curl_setopt($ch, CURLOPT_SAFE_UPLOAD, false);
20
+ curl_setopt($ch, CURLOPT_URL,$target_url);
21
+ //curl_setopt($ch, CURLOPT_GET,1);
22
+
23
+ curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
24
+ //curl_setopt($ch, CURLOPT_POSTFIELDS, $feed);
25
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
26
+
27
+ $result=curl_exec ($ch);
28
+
29
+ $status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
30
+
31
+ curl_close ($ch);
32
+
33
+ if( $status == 200) {
34
+ //correct response
35
+ }
36
+ Mage::app()->getResponse()->setBody($status);
37
+ }
38
+ }
app/code/community/Wiser/Search/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Wiser_Search>
5
- <version>1.0.12</version>
6
  </Wiser_Search>
7
  </modules>
8
  <global>
@@ -11,6 +11,11 @@
11
  <class>Wiser_Search_Model</class>
12
  </wiser_search>
13
  </models>
 
 
 
 
 
14
  <helpers>
15
  <wiser_search>
16
  <class>Wiser_Search_Helper</class>
@@ -59,7 +64,7 @@
59
  <default>
60
  <wiser_search>
61
  <wiser_search_group>
62
- <extension_version>1.0.12</extension_version>
63
  </wiser_search_group>
64
  </wiser_search>
65
  </default>
@@ -116,4 +121,15 @@
116
  </resources>
117
  </acl>
118
  </adminhtml>
 
 
 
 
 
 
 
 
 
 
 
119
  </config>
2
  <config>
3
  <modules>
4
  <Wiser_Search>
5
+ <version>1.0.13</version>
6
  </Wiser_Search>
7
  </modules>
8
  <global>
11
  <class>Wiser_Search_Model</class>
12
  </wiser_search>
13
  </models>
14
+ <blocks>
15
+ <wiser_search>
16
+ <class>Wiser_Search_Block</class>
17
+ </wiser_search>
18
+ </blocks>
19
  <helpers>
20
  <wiser_search>
21
  <class>Wiser_Search_Helper</class>
64
  <default>
65
  <wiser_search>
66
  <wiser_search_group>
67
+ <extension_version>1.0.13</extension_version>
68
  </wiser_search_group>
69
  </wiser_search>
70
  </default>
121
  </resources>
122
  </acl>
123
  </adminhtml>
124
+ <admin>
125
+ <routers>
126
+ <adminhtml>
127
+ <args>
128
+ <modules>
129
+ <wisersearch after="Mage_Adminhtml">Wiser_Search</wisersearch>
130
+ </modules>
131
+ </args>
132
+ </adminhtml>
133
+ </routers>
134
+ </admin>
135
  </config>
app/code/community/Wiser/Search/etc/system.xml CHANGED
@@ -35,7 +35,7 @@
35
  <label>Installation status:</label>
36
  <frontend_type>label</frontend_type>
37
  <comment><![CDATA[ Current installation status for Wiser Search, installation might take up to one hour. ]]></comment>
38
- <sort_order>10</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>
@@ -44,7 +44,7 @@
44
  <label>Disabled:</label>
45
  <comment><![CDATA[ Disables Wiser Search ]]></comment>
46
  <frontend_type>select</frontend_type>
47
- <sort_order>20</sort_order>
48
  <show_in_default>1</show_in_default>
49
  <show_in_website>1</show_in_website>
50
  <show_in_store>1</show_in_store>
@@ -95,6 +95,16 @@
95
  <show_in_website>0</show_in_website>
96
  <show_in_store>0</show_in_store>
97
  </installed>
 
 
 
 
 
 
 
 
 
 
98
  </fields>
99
  </wiser_search_group>
100
  </groups>
35
  <label>Installation status:</label>
36
  <frontend_type>label</frontend_type>
37
  <comment><![CDATA[ Current installation status for Wiser Search, installation might take up to one hour. ]]></comment>
38
+ <sort_order>20</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>
44
  <label>Disabled:</label>
45
  <comment><![CDATA[ Disables Wiser Search ]]></comment>
46
  <frontend_type>select</frontend_type>
47
+ <sort_order>30</sort_order>
48
  <show_in_default>1</show_in_default>
49
  <show_in_website>1</show_in_website>
50
  <show_in_store>1</show_in_store>
95
  <show_in_website>0</show_in_website>
96
  <show_in_store>0</show_in_store>
97
  </installed>
98
+ <reset_magento translate="label">
99
+ <label>Reset Wiser Installation:</label>
100
+ <frontend_type>button</frontend_type>
101
+ <frontend_model>wiser_search/adminhtml_system_config_form_button</frontend_model>
102
+ <comment><![CDATA[ Resets the Wiser installation. Use this button if installation errors occured. ]]></comment>
103
+ <sort_order>40</sort_order>
104
+ <show_in_default>1</show_in_default>
105
+ <show_in_website>1</show_in_website>
106
+ <show_in_store>1</show_in_store>
107
+ </reset_magento>
108
  </fields>
109
  </wiser_search_group>
110
  </groups>
app/design/adminhtml/default/default/template/wiser_search/system/config/button.phtml ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script type="text/javascript">
2
+ //<![CDATA[
3
+ function check() {
4
+ new Ajax.Request('<?php echo $this->getAjaxCheckUrl() ?>', {
5
+ method: 'get',
6
+ onSuccess: function(transport){
7
+
8
+ if (transport.responseText){
9
+ console.log(transport.responseText)
10
+ }
11
+ }
12
+ });
13
+ }
14
+ //]]>
15
+ </script>
16
+
17
+ <?php echo $this->getButtonHtml() ?>
package.xml CHANGED
@@ -1,14 +1,17 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>wiser_search</name>
4
- <version>1.0.12</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/gpl-license.php">GPL</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Quickly have your search results on screen while typing, advanced statistics and advanced layered navigation</summary>
10
  <description>Show search results to your customers while typing, indexes both products and pages. Allows the webshop administrator to view advanced search statistics.</description>
11
- <notes>1.0.12&#xD;
 
 
 
12
  - Added more filterable options for visibility in search&#xD;
13
  1.0.11&#xD;
14
  - Added notifications to have realtime updates in screen.&#xD;
@@ -20,9 +23,9 @@
20
  - Multi storeview content pages support added&#xD;
21
  </notes>
22
  <authors><author><name>Niels - Rejuni</name><user>niels</user><email>niels@rejuni.nl</email></author><author><name>Remco - Rejuni</name><user>remco</user><email>remco@rejuni.nl</email></author></authors>
23
- <date>2016-12-17</date>
24
- <time>10:10:15</time>
25
- <contents><target name="magecommunity"><dir name="Wiser"><dir name="Search"><dir name="Helper"><file name="Data.php" hash="d127ac82b4dd20580f24d1bdc0eb9349"/><file name="ProductData.php" hash="55aa4e5877b2280e1e9283c24ce51667"/><file name="SimpleXml.php" hash="ee3906507dd83a9b540e5fb2afaf767e"/><file name="XmlFeed.php" hash="10a19d78c67c8cb85a5aada89ef0cf03"/></dir><dir name="Model"><file name="Observer.php" hash="782deb17a86b0fece973754252e1fcc0"/></dir><dir name="controllers"><file name="IndexController.php" hash="e1e329d2fc62c9cd19cc9fef8389dac3"/></dir><dir name="etc"><dir name="adminhtml"><file name="events.xml" hash="d41d8cd98f00b204e9800998ecf8427e"/></dir><file name="config.xml" hash="9c0f9bdab7309af6f41303059cb08885"/><file name="system.xml" hash="5a299551f98cd4800bc8b0a8da822dce"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Wiser_Search.xml" hash="4a518f78635b9e09b5b907a096b1ae91"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="wiser_search.xml" hash="f66cf33d0e88676e86bba6f0c561e485"/></dir><dir name="template"><dir name="wiser_search"><file name="conversion.phtml" hash="01671ab852225eec8384d9faae183be9"/></dir></dir></dir></dir></dir></target></contents>
26
  <compatible/>
27
- <dependencies><required><php><min>5.4.0.</min><max>7.0.2.</max></php></required></dependencies>
28
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>wiser_search</name>
4
+ <version>1.0.13</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/gpl-license.php">GPL</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Quickly have your search results on screen while typing, advanced statistics and advanced layered navigation</summary>
10
  <description>Show search results to your customers while typing, indexes both products and pages. Allows the webshop administrator to view advanced search statistics.</description>
11
+ <notes>1.0.13&#xD;
12
+ - minor bugfix regarding disabled products&#xD;
13
+ - added reinstall button for restricted development environments&#xD;
14
+ 1.0.12&#xD;
15
  - Added more filterable options for visibility in search&#xD;
16
  1.0.11&#xD;
17
  - Added notifications to have realtime updates in screen.&#xD;
23
  - Multi storeview content pages support added&#xD;
24
  </notes>
25
  <authors><author><name>Niels - Rejuni</name><user>niels</user><email>niels@rejuni.nl</email></author><author><name>Remco - Rejuni</name><user>remco</user><email>remco@rejuni.nl</email></author></authors>
26
+ <date>2017-04-01</date>
27
+ <time>06:49:35</time>
28
+ <contents><target name="magecommunity"><dir name="Wiser"><dir name="Search"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Form"><file name="Button.php" hash="18b4674ba1f58b83102b5558f88d8d02"/></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="d127ac82b4dd20580f24d1bdc0eb9349"/><file name="ProductData.php" hash="3628d6c64a8f2bf3e6548b69bcea578b"/><file name="SimpleXml.php" hash="ee3906507dd83a9b540e5fb2afaf767e"/><file name="XmlFeed.php" hash="a603ab86bda3c81b0b2c7db85a3ec9fc"/></dir><dir name="Model"><file name="Observer.php" hash="6c44eba674866171689be5833bb749a9"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="WiserSearchController.php" hash="1b86a48a1f81e761481c263ccf31897e"/></dir><file name="IndexController.php" hash="e1e329d2fc62c9cd19cc9fef8389dac3"/></dir><dir name="etc"><dir name="adminhtml"><file name="events.xml" hash="d41d8cd98f00b204e9800998ecf8427e"/></dir><file name="config.xml" hash="d061186432d19b6f9ac419ea7056ffde"/><file name="system.xml" hash="05679e94fda0a18696cf18c2c1f4c701"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Wiser_Search.xml" hash="4a518f78635b9e09b5b907a096b1ae91"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="wiser_search.xml" hash="f66cf33d0e88676e86bba6f0c561e485"/></dir><dir name="template"><dir name="wiser_search"><file name="conversion.phtml" hash="01671ab852225eec8384d9faae183be9"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="wiser_search"><dir name="system"><dir name="config"><file name="button.phtml" hash="4d59a6ef1993f9caa71e34b31b7b988b"/></dir></dir></dir></dir></dir></dir></dir></target></contents>
29
  <compatible/>
30
+ <dependencies><required><php><min>5.4.0.</min><max>7.1.3.</max></php></required></dependencies>
31
  </package>