Skip to content

Commit a369f9e

Browse files
committed
Merge branch 'develop' of github.com:algolia/algoliasearch-magento into develop
2 parents d2e0138 + 4095de6 commit a369f9e

File tree

4 files changed

+36
-10
lines changed

4 files changed

+36
-10
lines changed

code/Helper/Config.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class Algolia_Algoliasearch_Helper_Config extends Mage_Core_Helper_Abstract
2828
const EXCLUDED_PAGES = 'algoliasearch/autocomplete/excluded_pages';
2929
const MIN_POPULARITY = 'algoliasearch/autocomplete/min_popularity';
3030
const MIN_NUMBER_OF_RESULTS = 'algoliasearch/autocomplete/min_number_of_results';
31+
const RENDER_TEMPLATE_DIRECTIVES = 'algoliasearch/autocomplete/render_template_directives';
3132

3233
const NUMBER_OF_PRODUCT_RESULTS = 'algoliasearch/products/number_product_results';
3334
const PRODUCT_ATTRIBUTES = 'algoliasearch/products/product_additional_attributes';
@@ -271,6 +272,11 @@ public function getExcludedPages($storeId = NULL)
271272
return array();
272273
}
273274

275+
public function getRenderTemplateDirectives($storeId = NULL)
276+
{
277+
return Mage::getStoreConfigFlag(self::RENDER_TEMPLATE_DIRECTIVES, $storeId);
278+
}
279+
274280
public function getSortingIndices($storeId = NULL)
275281
{
276282
$product_helper = Mage::helper('algoliasearch/entity_producthelper');

code/Helper/Entity/Pagehelper.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,19 @@ public function getPages($storeId)
4545
if (! $page->getId())
4646
continue;
4747

48-
$page_obj['objectID'] = $page->getId();
48+
$content = $page->getContent();
49+
if ($this->config->getRenderTemplateDirectives()) {
50+
$tmplProc = Mage::helper('cms')->getPageTemplateProcessor();
51+
$content = $tmplProc->filter($content);
52+
}
4953

54+
$page_obj['objectID'] = $page->getId();
5055
$page_obj['url'] = Mage::helper('cms/page')->getPageUrl($page->getId());
51-
$page_obj['content'] = $this->strip($page->getContent());
56+
$page_obj['content'] = $this->strip($content);
5257

5358
$pages[] = $page_obj;
5459
}
5560

5661
return $pages;
5762
}
58-
}
63+
}

code/etc/config.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@
168168
<sections>a:1:{s:18:"_1450089283397_397";a:3:{s:4:"name";s:5:"pages";s:5:"label";s:5:"Pages";s:11:"hitsPerPage";s:1:"2";}}</sections>
169169
<min_popularity>1000</min_popularity>
170170
<min_number_of_results>2</min_number_of_results>
171+
<render_template_directives>1</render_template_directives>
171172
</autocomplete>
172173
<categories>
173174
<number_category_suggestions>5</number_category_suggestions>
@@ -201,4 +202,4 @@
201202
</product_map>
202203
</algoliasearch>
203204
</default>
204-
</config>
205+
</config>

code/etc/system.xml

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
<sort_order>10</sort_order>
3333
<show_in_default>1</show_in_default>
3434
<show_in_website>1</show_in_website>
35-
<show_in_store>1</show_in_store>
35+
<show_in_store>1</show_in_store>
3636
<expanded>1</expanded>
3737
<comment>
3838
<![CDATA[
@@ -146,7 +146,7 @@
146146
<show_in_store>1</show_in_store>
147147
<comment>
148148
<![CDATA[
149-
If set to Yes, the seach box will display a search-as-you-type drop-down menu. It requires your theme to expose a <code>top.search</code> and <code>content</code> block.
149+
If set to Yes, the search box will display a search-as-you-type drop-down menu. It requires your theme to expose a <code>top.search</code> and <code>content</code> block.
150150
]]>
151151
</comment>
152152
</is_popup_enabled>
@@ -258,11 +258,25 @@
258258
<show_in_store>1</show_in_store>
259259
<comment>
260260
<![CDATA[
261-
Configure here the pages you don't want to search in.<br><br>
262-
<span style="font-size: 20px; color: #D83900">&#9888;</span> Do not forget to trigger the Algolia Search indexers whenever you modify those settings.
261+
Configure here the pages you don't want to search in.
263262
]]>
264263
</comment>
265264
</excluded_pages>
265+
<render_template_directives translate="label comment">
266+
<label>Render template directives</label>
267+
<frontend_type>select</frontend_type>
268+
<source_model>adminhtml/system_config_source_yesno</source_model>
269+
<sort_order>30</sort_order>
270+
<show_in_default>1</show_in_default>
271+
<show_in_website>1</show_in_website>
272+
<show_in_store>1</show_in_store>
273+
<comment>
274+
<![CDATA[
275+
For CMS pages, template directives (e.g. <code>{{block type="core/template" ...}}</code>) will be processed by default. Set this to "No" if you don't want to have template content indexed.<br><br>
276+
<span style="font-size: 20px; color: #D83900">&#9888;</span> Do not forget to trigger the Algolia Search indexers whenever you modify those settings.
277+
]]>
278+
</comment>
279+
</render_template_directives>
266280
</fields>
267281
</autocomplete>
268282
<instant>
@@ -531,7 +545,7 @@
531545
<show_in_website>1</show_in_website>
532546
<show_in_store>1</show_in_store>
533547
<comment><![CDATA[You can specify the size of the images used at the Search Results Page.<br />
534-
If your images are already present in some size, eg. 265x265, Algolia's index job may not have to resize those, potentially saving time and resources.]]></comment>
548+
If your images are already present in some size, e.g. 265x265, Algolia's index job may not have to resize those, potentially saving time and resources.]]></comment>
535549
</height>
536550
<type translate="label comment">
537551
<label>Type</label>
@@ -564,7 +578,7 @@
564578
<show_in_store>1</show_in_store>
565579
<comment>
566580
<![CDATA[
567-
If enabled, all inxdexing operations (add, remove & update operations) will be done asynchronously using the CRON mechanism.<br />
581+
If enabled, all indexing operations (add, remove & update operations) will be done asynchronously using the CRON mechanism.<br />
568582
<br>
569583
To schedule the run you need to add this in your crontab:<br>
570584
*/5 * * * * php -f /absolute/path/to/magento/shell/indexer.php -- -reindex algolia_queue_runner

0 commit comments

Comments
 (0)