Skip to content

Commit 6bbead8

Browse files
committed
Merge branch 'develop'
2 parents 3e2e5f0 + cd4e035 commit 6bbead8

File tree

10 files changed

+89
-20
lines changed

10 files changed

+89
-20
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"homepage": "https://github.com/integer-net/solr-magento1",
66
"require": {
77
"aoepeople/aoe_layoutconditions": "~1.0.0",
8-
"integer-net/solr-base": "~2.0.0"
8+
"integer-net/solr-base": "^3.0.0"
99
},
1010
"require-dev": {
1111
"ecomdev/ecomdev_phpunit": "dev-dev",

doc/release-notes.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@ IntegerNet_Solr Free for Magento 1
22
===============
33
Release Notes
44

5+
Version 1.7.4 (Jul 17, 2017)
6+
---------------
7+
8+
- Choose if you want to display products which are not on stock via a new configuration setting
9+
- Configure the score multiplier for products which are not on stock
10+
511
Version 1.7.3 (May 18, 2017)
612
---------------
713

src/app/code/community/IntegerNet/Solr/Helper/Factory.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ public function getSolrRequest($requestMode = self::REQUEST_MODE_AUTODETECT)
101101
$this->getSolrResource(),
102102
$storeId);
103103
} elseif ($isCategoryPage) {
104+
$applicationContext
105+
->setCategoryConfig($this->getCurrentStoreConfig()->getCategoryConfig());
104106
$factory = new CategoryRequestFactory(
105107
$applicationContext,
106108
$this->getSolrResource(),

src/app/code/community/IntegerNet/Solr/Model/Bridge/Product.php

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,14 @@ public function hasSpecialPrice()
6565

6666
public function getSolrBoost()
6767
{
68-
return $this->_product->getData('solr_boost');
68+
$boost = $this->_product->getData('solr_boost');
69+
if (!$this->isInStock()) {
70+
if ($boost === null) {
71+
$boost = 1;
72+
}
73+
$boost *= floatval(Mage::getStoreConfig('integernet_solr/results/priority_outofstock'));
74+
}
75+
return $boost;
6976
}
7077

7178
public function getPrice()
@@ -133,18 +140,6 @@ public function isIndexable()
133140
if (!in_array($this->_product->getStore()->getWebsiteId(), $this->_product->getWebsiteIds())) {
134141
return false;
135142
}
136-
if (!Mage::helper('cataloginventory')->isShowOutOfStock()) {
137-
/** @var Mage_CatalogInventory_Model_Stock_Item $stockItem */
138-
if (!$this->_product->getStockItem()) {
139-
$stockItem = Mage::getModel('cataloginventory/stock_item')
140-
->loadByProduct($this->_product->getId());
141-
$this->_product->setStockItem($stockItem);
142-
}
143-
144-
if (!$this->_product->getStockItem()->getIsInStock()) {
145-
return false;
146-
}
147-
}
148143
return true;
149144

150145
}
@@ -159,4 +154,19 @@ public function __call($method, $args)
159154
{
160155
return call_user_func_array(array($this->_product, $method), $args);
161156
}
157+
158+
/**
159+
* return boolean
160+
*/
161+
public function isInStock()
162+
{
163+
/** @var Mage_CatalogInventory_Model_Stock_Item $stockItem */
164+
if (!$this->_product->getStockItem()) {
165+
$stockItem = Mage::getModel('cataloginventory/stock_item')
166+
->loadByProduct($this->_product->getId());
167+
$this->_product->setStockItem($stockItem);
168+
}
169+
170+
return $this->_product->getStockItem()->getIsInStock();
171+
}
162172
}

src/app/code/community/IntegerNet/Solr/Model/Config/Store.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,8 @@ public function getAutosuggestConfig()
163163
$this->_getConfig($prefix . 'max_number_cms_page_suggestions'),
164164
$this->_getConfigFlag($prefix . 'show_complete_category_path'),
165165
$this->_getConfig($prefix . 'category_link_type'),
166-
@unserialize($this->_getConfig($prefix . 'attribute_filter_suggestions'))
166+
@unserialize($this->_getConfig($prefix . 'attribute_filter_suggestions')),
167+
$this->_getConfig($prefix . 'show_outofstock')
167168
);
168169
}
169170
return $this->_autosuggest;
@@ -222,7 +223,7 @@ public function getResultsConfig()
222223
$this->_getConfig($prefix . 'max_price'),
223224
$this->_getConfigFlag($prefix . 'use_custom_price_intervals'),
224225
explode(',', $this->_getConfig($prefix . 'custom_price_intervals')),
225-
$this->_getConfigFlag($prefix . 'show_category_filter')
226+
$this->_getConfig($prefix . 'show_outofstock')
226227
);
227228
}
228229
return $this->_results;
@@ -264,7 +265,8 @@ public function getCategoryConfig()
264265
$this->_getConfigFlag($prefix . 'use_in_search_results'),
265266
intval($this->_getConfig($prefix . 'max_number_results')),
266267
$this->_getConfigFlag($prefix . 'fuzzy_is_active'),
267-
floatval($this->_getConfig($prefix . 'fuzzy_sensitivity'))
268+
floatval($this->_getConfig($prefix . 'fuzzy_sensitivity')),
269+
$this->_getConfig($prefix . 'show_outofstock')
268270
);
269271
}
270272
return $this->_category;

src/app/code/community/IntegerNet/Solr/Test/Model/Result.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public function shouldUseParametersBasedOnToolbar()
9595
)
9696
);
9797
$logMock->expects($this->at(4))->method('debug')->with(
98-
'Filter Query: content_type:product AND store_id:1 AND is_visible_in_search_i:1');
98+
'Filter Query: content_type:product AND store_id:1 AND is_visible_in_search_i:1 AND -is_in_stock_i:0');
9999

100100
/* @var Mage_Core_Block_Text $toolbar Not using actual toolbar block which reads from session */
101101
$toolbar = $this->app()->getLayout()->createBlock('core/text', 'product_list_toolbar');

src/app/code/community/IntegerNet/Solr/etc/config.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<config>
33
<modules>
44
<IntegerNet_Solr>
5-
<version>1.7.3</version>
5+
<version>1.7.4</version>
66
<version_suffix />
77
</IntegerNet_Solr>
88
</modules>
@@ -257,6 +257,8 @@
257257
<filter_position>1</filter_position>
258258
<show_category_filter>1</show_category_filter>
259259
<priority_categories>2</priority_categories>
260+
<show_outofstock>1</show_outofstock>
261+
<priority_outofstock>1</priority_outofstock>
260262
<max_number_filter_options>0</max_number_filter_options>
261263
<price_step_size>10</price_step_size>
262264
<max_price>200</max_price>

src/app/code/community/IntegerNet/Solr/etc/system.xml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,25 @@
309309
<show_in_website>1</show_in_website>
310310
<show_in_store>1</show_in_store>
311311
</priority_categories>
312+
<show_outofstock translate="label,comment">
313+
<label>Show products which are out of stock</label>
314+
<frontend_type>select</frontend_type>
315+
<source_model>adminhtml/system_config_source_yesno</source_model>
316+
<sort_order>57</sort_order>
317+
<show_in_default>1</show_in_default>
318+
<show_in_website>1</show_in_website>
319+
<show_in_store>1</show_in_store>
320+
</show_outofstock>
321+
<priority_outofstock translate="label,comment">
322+
<label>Solr Priority Multiplier for Products being out of Stock</label>
323+
<comment>0 = don't show at all, 1 = don't modify, anything between = lower priority</comment>
324+
<frontend_type>text</frontend_type>
325+
<validate>validate-number validate-zero-or-greater</validate>
326+
<sort_order>58</sort_order>
327+
<show_in_default>1</show_in_default>
328+
<show_in_website>1</show_in_website>
329+
<show_in_store>1</show_in_store>
330+
</priority_outofstock>
312331
<price_step_size translate="label,comment">
313332
<label>Size of Price Steps</label>
314333
<comment><![CDATA[i.e. 100]]></comment>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
/**
3+
* integer_net Magento Module
4+
*
5+
* @category IntegerNet
6+
* @package IntegerNet_Solr
7+
* @copyright Copyright (c) 2016 integer_net GmbH (http://www.integer-net.de/)
8+
* @author Andreas von Studnitz <avs@integer-net.de>
9+
*/
10+
11+
/** @var Mage_Catalog_Model_Resource_Setup $installer */
12+
$installer = $this;
13+
14+
$installer->startSetup();
15+
16+
$installer->setConfigData('integernet_solr/results/show_outofstock', Mage::getStoreConfig('cataloginventory/options/show_out_of_stock'));
17+
$installer->setConfigData('integernet_solr/autosuggest/show_outofstock', Mage::getStoreConfig('cataloginventory/options/show_out_of_stock'));
18+
$installer->setConfigData('integernet_solr/category/show_outofstock', Mage::getStoreConfig('cataloginventory/options/show_out_of_stock'));
19+
20+
Mage::getModel('index/process')
21+
->load('integernet_solr', 'indexer_code')
22+
->setStatus(Mage_Index_Model_Process::STATUS_REQUIRE_REINDEX)
23+
->save();
24+
25+
$installer->endSetup();

src/app/locale/de_DE/IntegerNet_Solr.csv

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,4 +106,7 @@
106106
"0 = all","0 = alle"
107107
"Sort Filter Options alphabetically","Filteroptionen alphabetisch sortieren"
108108
"By default, filters are sorted by number of results.","Filter sind standardmäßig nach Anzahl der Treffer sortiert."
109-
"Show category filter","Kategorie-Filter anzeigen"
109+
"Show category filter","Kategorie-Filter anzeigen"
110+
"Show products which are out of stock","Produkte anzeigen, die nicht auf Lager sind"
111+
"Solr Priority Multiplier for Products being out of Stock","Solr-Prioritäts-Multiplikator für ausverkaufte Produkte"
112+
"0 = don't show at all, 1 = don't modify, anything between = lower priority","0 = gar nicht anzeigen, 1 = wie Produkte auf Lager, alles dazwischen = niedrigere Priorität"

0 commit comments

Comments
 (0)