├── .gitignore ├── LICENSE ├── README.md ├── composer.json ├── doc ├── manual.md ├── manual_de.md ├── release-notes.md └── solr_free_banner.png ├── modman ├── phpunit.xml.dist ├── src ├── app │ ├── code │ │ └── community │ │ │ └── IntegerNet │ │ │ └── Solr │ │ │ ├── Block │ │ │ ├── Config │ │ │ │ ├── Adminhtml │ │ │ │ │ ├── Form.php │ │ │ │ │ └── Form │ │ │ │ │ │ ├── Field │ │ │ │ │ │ └── Attribute.php │ │ │ │ │ │ └── Upgrade.php │ │ │ │ ├── AttributeFilterSuggestions.php │ │ │ │ ├── Description.php │ │ │ │ └── Status.php │ │ │ ├── Indexer │ │ │ │ └── Item.php │ │ │ ├── Mana │ │ │ │ └── Filters │ │ │ │ │ └── Search.php │ │ │ └── Result │ │ │ │ ├── Layer.php │ │ │ │ ├── Layer │ │ │ │ ├── Ajax.php │ │ │ │ ├── Checkbox.php │ │ │ │ ├── Filter.php │ │ │ │ ├── Renderers.php │ │ │ │ ├── State.php │ │ │ │ └── View.php │ │ │ │ ├── List.php │ │ │ │ └── List │ │ │ │ ├── Item.php │ │ │ │ └── Toolbar.php │ │ │ ├── Helper │ │ │ ├── Attribute.php │ │ │ ├── Autoloader.php │ │ │ ├── Autoloader │ │ │ │ └── PayPalPlus.php │ │ │ ├── CatalogSearch │ │ │ │ └── Data.php │ │ │ ├── Data.php │ │ │ ├── Event.php │ │ │ ├── Factory.php │ │ │ ├── Filter.php │ │ │ ├── Log.php │ │ │ ├── Module.php │ │ │ ├── Page.php │ │ │ ├── Query.php │ │ │ ├── SearchUrl.php │ │ │ ├── Searchterm.php │ │ │ └── SearchtermSynonym.php │ │ │ ├── Model │ │ │ ├── Bridge │ │ │ │ ├── Attribute.php │ │ │ │ ├── AttributeRepository.php │ │ │ │ ├── Category.php │ │ │ │ ├── CategoryIterator.php │ │ │ │ ├── CategoryRenderer.php │ │ │ │ ├── CategoryRepository.php │ │ │ │ ├── Factory.php │ │ │ │ ├── IndexCategoryRepository.php │ │ │ │ ├── LazyCategoryIterator.php │ │ │ │ ├── LazyPageIterator.php │ │ │ │ ├── LazyProductIterator.php │ │ │ │ ├── Page.php │ │ │ │ ├── PageIterator.php │ │ │ │ ├── PageRenderer.php │ │ │ │ ├── PageRepository.php │ │ │ │ ├── Pagination │ │ │ │ │ └── Toolbar.php │ │ │ │ ├── Product.php │ │ │ │ ├── ProductIterator.php │ │ │ │ ├── ProductRenderer.php │ │ │ │ ├── ProductRepository.php │ │ │ │ ├── Source.php │ │ │ │ └── StoreEmulation.php │ │ │ ├── Catalog │ │ │ │ ├── Layer.php │ │ │ │ └── Layer │ │ │ │ │ └── Filter │ │ │ │ │ ├── Attribute.php │ │ │ │ │ ├── Category.php │ │ │ │ │ └── Price.php │ │ │ ├── CatalogSearch │ │ │ │ ├── Layer.php │ │ │ │ └── Layer │ │ │ │ │ └── Filter │ │ │ │ │ └── Attribute.php │ │ │ ├── Config │ │ │ │ └── Store.php │ │ │ ├── Configuration.php │ │ │ ├── Eav │ │ │ │ ├── Backend │ │ │ │ │ └── FilterableAttribute.php │ │ │ │ └── Source │ │ │ │ │ ├── FilterPosition.php │ │ │ │ │ └── FilterableAttribute.php │ │ │ ├── Indexer.php │ │ │ ├── Observer.php │ │ │ ├── Resource │ │ │ │ ├── Catalog │ │ │ │ │ ├── Layer │ │ │ │ │ │ └── Filter │ │ │ │ │ │ │ ├── Attribute.php │ │ │ │ │ │ │ └── Price.php │ │ │ │ │ └── Product │ │ │ │ │ │ ├── Collection.php │ │ │ │ │ │ ├── Indexing │ │ │ │ │ │ └── Collection.php │ │ │ │ │ │ └── Type │ │ │ │ │ │ ├── Bundle.php │ │ │ │ │ │ ├── Configurable.php │ │ │ │ │ │ └── Grouped.php │ │ │ │ └── Db.php │ │ │ ├── Result.php │ │ │ ├── Result │ │ │ │ └── Collection.php │ │ │ └── Source │ │ │ │ ├── AutosuggestMethod.php │ │ │ │ ├── CategoryLinkType.php │ │ │ │ ├── FilterPosition.php │ │ │ │ ├── HttpTransportMethod.php │ │ │ │ ├── LoaderStyle.php │ │ │ │ ├── SearchOperator.php │ │ │ │ ├── VarcharCategoryAttribute.php │ │ │ │ └── VarcharProductAttribute.php │ │ │ ├── Test │ │ │ ├── Config │ │ │ │ └── Config.php │ │ │ ├── Controller │ │ │ │ ├── Abstract.php │ │ │ │ ├── Configuration.php │ │ │ │ └── Search.php │ │ │ ├── Helper │ │ │ │ └── Factory.php │ │ │ ├── Model │ │ │ │ ├── Bridge │ │ │ │ │ └── AttributeRepository.php │ │ │ │ ├── Indexer │ │ │ │ │ └── Product.php │ │ │ │ ├── Lib │ │ │ │ │ └── SolrResource.php │ │ │ │ ├── ProductIterator.php │ │ │ │ ├── Resource │ │ │ │ │ └── Db.php │ │ │ │ └── Result.php │ │ │ ├── README.md │ │ │ ├── bootstrap.php │ │ │ ├── fixtures │ │ │ │ ├── bigcatalog.yaml │ │ │ │ ├── catalog.yaml │ │ │ │ ├── config.yaml │ │ │ │ └── registry.yaml │ │ │ └── providers │ │ │ │ └── invalid-config.yaml │ │ │ ├── controllers │ │ │ └── Frontend │ │ │ │ ├── CategoryController.php │ │ │ │ └── ResultController.php │ │ │ ├── data │ │ │ └── integernet_solr_setup │ │ │ │ ├── data-upgrade-0.2.0-0.3.0.php │ │ │ │ └── data-upgrade-1.3.0-1.4.0.php │ │ │ ├── etc │ │ │ ├── adminhtml.xml │ │ │ ├── config.xml │ │ │ └── system.xml │ │ │ └── sql │ │ │ └── integernet_solr_setup │ │ │ ├── install-1.5.0.php │ │ │ ├── upgrade-1.4.9-1.5.0.php │ │ │ └── upgrade-1.7.3-1.7.4.php │ ├── design │ │ ├── adminhtml │ │ │ └── default │ │ │ │ └── default │ │ │ │ ├── layout │ │ │ │ └── integernet │ │ │ │ │ └── solr.xml │ │ │ │ └── template │ │ │ │ └── integernet │ │ │ │ └── solr │ │ │ │ └── config │ │ │ │ ├── status.phtml │ │ │ │ └── upgrade.phtml │ │ └── frontend │ │ │ ├── base │ │ │ └── default │ │ │ │ ├── layout │ │ │ │ └── integernet │ │ │ │ │ ├── solr.xml │ │ │ │ │ └── solr │ │ │ │ │ └── filter.xml │ │ │ │ └── template │ │ │ │ └── integernet │ │ │ │ └── solr │ │ │ │ ├── filter │ │ │ │ └── checkbox.phtml │ │ │ │ ├── layer │ │ │ │ └── top │ │ │ │ │ ├── filter.phtml │ │ │ │ │ ├── state.phtml │ │ │ │ │ └── view.phtml │ │ │ │ ├── loader.phtml │ │ │ │ ├── result.phtml │ │ │ │ └── result │ │ │ │ ├── autosuggest │ │ │ │ └── item.phtml │ │ │ │ ├── grid │ │ │ │ └── item.phtml │ │ │ │ └── list │ │ │ │ └── item.phtml │ │ │ └── rwd │ │ │ └── default │ │ │ ├── layout │ │ │ └── integernet │ │ │ │ ├── solr.xml │ │ │ │ └── solr │ │ │ │ └── filter.xml │ │ │ └── template │ │ │ └── integernet │ │ │ └── solr │ │ │ ├── layer │ │ │ └── top │ │ │ │ ├── filter.phtml │ │ │ │ ├── state.phtml │ │ │ │ └── view.phtml │ │ │ ├── result.phtml │ │ │ └── result │ │ │ ├── grid │ │ │ └── item.phtml │ │ │ └── list │ │ │ └── item.phtml │ ├── etc │ │ └── modules │ │ │ └── IntegerNet_Solr.xml │ └── locale │ │ └── de_DE │ │ └── IntegerNet_Solr.csv ├── shell │ └── integernet-solr.php └── skin │ ├── adminhtml │ └── default │ │ └── default │ │ └── integernet │ │ └── solr │ │ ├── integer_net_logo.png │ │ ├── solr_free_banner_upgrade_to_pro.png │ │ └── style.css │ └── frontend │ ├── base │ └── default │ │ └── integernet │ │ └── solr │ │ ├── css │ │ ├── filter.css │ │ ├── filter.min.css │ │ ├── loader.css │ │ ├── loader.min.css │ │ ├── topfilter.css │ │ └── topfilter.min.css │ │ ├── js │ │ └── result.js │ │ └── sass │ │ ├── filter.sass │ │ └── loader.sass │ └── rwd │ └── default │ └── integernet │ └── solr │ ├── css │ ├── filter.css │ ├── filter.min.css │ ├── loader.css │ └── loader.min.css │ └── sass │ ├── filter.sass │ └── loader.sass ├── test ├── README.md └── bootstrap.php └── wercker.yml /.gitignore: -------------------------------------------------------------------------------- 1 | composer.lock 2 | /*.log 3 | vendor 4 | /build 5 | node_modules 6 | ENVIRONMENT 7 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "integer-net/solr-magento1", 3 | "type": "magento-module", 4 | "description": "IntegerNet_Solr Module for Magento 1 (free)", 5 | "homepage": "https://github.com/integer-net/solr-magento1", 6 | "require": { 7 | "aoepeople/aoe_layoutconditions": "~1.0.0", 8 | "integer-net/solr-base": "^3.3.0" 9 | }, 10 | "require-dev": { 11 | "ecomdev/ecomdev_phpunit": "dev-dev", 12 | "phpunit/phpunit": "~4.5", 13 | "mikey179/vfsStream": "~1.3" 14 | }, 15 | "suggest": { 16 | "magento-hackathon/magento-composer-installer": "Magento module installer", 17 | "firegento/psr0autoloader": "With this extension you can include the composer autoloader and you don't need to activate the custom autoloader shipped with IntegerNet_Solr" 18 | }, 19 | "minimum-stability": "dev", 20 | "repositories": [ 21 | { 22 | "type": "vcs", 23 | "url": "git@github.com:schmengler/Aoe_LayoutConditions.git" 24 | }, 25 | { 26 | "type": "vcs", 27 | "url": "git@github.com:integer-net/solr-base.git" 28 | }, 29 | { 30 | "type": "composer", 31 | "url": "https://packages.firegento.com" 32 | } 33 | ], 34 | "extra": { 35 | "magento-root-dir": ".travis/magento" 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /doc/release-notes.md: -------------------------------------------------------------------------------- 1 | IntegerNet_Solr Free for Magento 1 2 | =============== 3 | Release Notes 4 | 5 | Version 1.8.0 (Feb 4, 2019) 6 | --------------------------- 7 | 8 | - Improve search results by boosting full word matches 9 | 10 | **Attention: the [new solr schema](https://github.com/integer-net/solr-base/blob/master/conf/schema.xml) has to be configured in Solr!** 11 | 12 | Version 1.7.6 (Aug 16, 2017) 13 | --------------- 14 | 15 | - Update documentation 16 | 17 | Version 1.7.5 (Aug 14, 2017) 18 | --------------- 19 | 20 | - Make the MySQL connection disconnect/reconnect feature configurable (default: off) 21 | 22 | Version 1.7.4 (Jul 17, 2017) 23 | --------------- 24 | 25 | - Choose if you want to display products which are not on stock via a new configuration setting 26 | - Configure the score multiplier for products which are not on stock 27 | 28 | Version 1.7.3 (May 18, 2017) 29 | --------------- 30 | 31 | - Bugfix regarding RWD theme 32 | 33 | Version 1.7.2 (May 16, 2017) 34 | --------------- 35 | 36 | - Add slicing functionality (see src/shell/integernet-solr.php) 37 | - Fix bug with indexing multistore products with activated flat catalog 38 | - Exclude items with zero counts from filter items count calculation (thanks @tim-bezhashvyly!) 39 | - Fallback to Magento if category is excluded from Solr index (thanks @tim-bezhashvyly!) 40 | - Move files regarding autosuggest to Pro module 41 | 42 | Version 1.7.1 (May 3, 2017) 43 | --------------- 44 | 45 | - Support Indexing of Bundle Child Products 46 | - Optimization of Search Results for search queries containing numbers 47 | - Bugfix regarding Flat Product Setting 48 | - Bugfix regarding Flat Category Setting 49 | - Bugfix regarding Re-Initialization of MySQL Connection 50 | - Bugfix regarding duplicate Layout Update (thanks @tim-bezhashvyly!) 51 | 52 | Version 1.7.0 (Oct 12, 2016) 53 | --------------- 54 | 55 | - First public release of IntegerNet_Solr Free 56 | 57 | Version 1.6.0 (Aug 1, 2016) 58 | --------------- 59 | 60 | - Improved search algorithm, e.g. for search terms containing both words and numbers 61 | - Category and CMS pages in autosuggest results 62 | - More configuration options for filters 63 | - Improved compatibility with other third party extensions 64 | 65 | Version 1.5.0 (Mar 7, 2016) 66 | --------------- 67 | 68 | This is a completely refactored version. Plus, we added quite a number of new features, improving usability, search results and SEO: 69 | 70 | - Select multiple filter values 71 | - Horizontal display of filters on search result pages 72 | - Select per category which filters shall be available 73 | - Configurable meta robots tag (NOINDEX, NOFOLLOW) for search result pages, filtered search results and filtered category pages 74 | - Adjustable boost for products in search results if they are in a category whose name matches the search term 75 | - Direct redirects to a product or category page if the search term is an exact match with the product name, SKU, category name, or a different attribute of your choice 76 | -------------------------------------------------------------------------------- /doc/solr_free_banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/integer-net/solr-magento1/82fb1768ac7a09dc9a64d60edc8278f41f276c7e/doc/solr_free_banner.png -------------------------------------------------------------------------------- /modman: -------------------------------------------------------------------------------- 1 | src/app/code/community/IntegerNet/* app/code/community/IntegerNet/ 2 | src/app/design/adminhtml/default/default/layout/integernet/* app/design/adminhtml/default/default/layout/integernet/ 3 | src/app/design/adminhtml/default/default/template/integernet/solr/* app/design/adminhtml/default/default/template/integernet/solr/ 4 | src/app/design/frontend/base/default/layout/integernet/solr.xml app/design/frontend/base/default/layout/integernet/solr.xml 5 | src/app/design/frontend/base/default/layout/integernet/solr/* app/design/frontend/base/default/layout/integernet/solr/ 6 | src/app/design/frontend/base/default/template/integernet/solr/* app/design/frontend/base/default/template/integernet/solr/ 7 | src/app/design/frontend/rwd/default/layout/integernet/solr.xml app/design/frontend/rwd/default/layout/integernet/solr.xml 8 | src/app/design/frontend/rwd/default/layout/integernet/solr/* app/design/frontend/rwd/default/layout/integernet/solr/ 9 | src/app/design/frontend/rwd/default/template/integernet/solr/* app/design/frontend/rwd/default/template/integernet/solr/ 10 | src/app/etc/modules/* app/etc/modules/ 11 | src/app/locale/de_DE/IntegerNet_Solr.csv app/locale/de_DE/IntegerNet_Solr.csv 12 | src/shell/integernet-solr.php shell/integernet-solr.php 13 | src/skin/frontend/base/default/integernet/solr/css/* skin/frontend/base/default/integernet/solr/css/ 14 | src/skin/frontend/base/default/integernet/solr/js/* skin/frontend/base/default/integernet/solr/js/ 15 | src/skin/frontend/rwd/default/integernet/solr/css/* skin/frontend/rwd/default/integernet/solr/css/ 16 | src/skin/adminhtml/default/default/integernet/solr/* skin/adminhtml/default/default/integernet/solr/ 17 | -------------------------------------------------------------------------------- /phpunit.xml.dist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 15 | 16 | test/IntegerNet/Solr 17 | 18 | 19 | 20 | src/lib/IntegerNet_Solr/Solr 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Block/Config/Adminhtml/Form.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | class IntegerNet_Solr_Block_Config_Adminhtml_Form extends Mage_Adminhtml_Block_System_Config_Form 11 | { 12 | protected function _toHtml() 13 | { 14 | $html = ''; 15 | if (!Mage::helper('core')->isModuleEnabled('IntegerNet_SolrPro')) { 16 | $html .= $this->getLayout()->createBlock('integernet_solr/config_adminhtml_form_upgrade')->toHtml(); 17 | } 18 | $html .= parent::_toHtml(); 19 | return $html; 20 | } 21 | } -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Block/Config/Adminhtml/Form/Field/Attribute.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | class IntegerNet_Solr_Block_Config_Adminhtml_Form_Field_Attribute extends Mage_Core_Block_Html_Select { 11 | 12 | public function _toHtml() 13 | { 14 | $attributes = Mage::getModel('integernet_solr/bridge_factory')->getAttributeRepository() 15 | ->getFilterableInSearchAttributes(Mage::app()->getStore()->getId()); 16 | 17 | foreach($attributes as $attribute) { 18 | $this->addOption($attribute->getAttributeCode(), $attribute->getFrontendLabel() . ' [' . $attribute->getAttributeCode() . ']'); 19 | } 20 | 21 | return parent::_toHtml(); 22 | } 23 | 24 | /** 25 | * @param string $value 26 | * @return IntegerNet_Solr_Block_Config_Adminhtml_Form_Field_Attribute 27 | */ 28 | public function setInputName($value) 29 | { 30 | return $this->setName($value); 31 | } 32 | } -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Block/Config/Adminhtml/Form/Upgrade.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | class IntegerNet_Solr_Block_Config_Adminhtml_Form_Upgrade extends Mage_Core_Block_Template 11 | { 12 | protected function _construct() 13 | { 14 | $this->setTemplate('integernet/solr/config/upgrade.phtml'); 15 | parent::_construct(); 16 | } 17 | 18 | public function getBannerUrl() 19 | { 20 | return $this->getSkinUrl('integernet/solr/solr_free_banner_upgrade_to_pro.png'); 21 | } 22 | 23 | public function getLinkUrl() 24 | { 25 | $languageCode = Mage::app()->getLocale()->getLocale()->getLanguage(); 26 | if ($languageCode == 'de') { 27 | return 'https://www.integer-net.de/solr-magento/features/?utm_source=free-user&utm_medium=banner&utm_term=features&utm_content=features&utm_campaign=upgrade'; 28 | } 29 | return 'https://www.integer-net.com/solr-magento/features/?utm_source=free-user&utm_medium=banner&utm_term=features&utm_content=features&utm_campaign=upgrade'; 30 | } 31 | } -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Block/Config/AttributeFilterSuggestions.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | class IntegerNet_Solr_Block_Config_AttributeFilterSuggestions extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract 11 | { 12 | protected $_itemRenderer = null; 13 | 14 | public function __construct() 15 | { 16 | $this->addColumn('attribute_code', array( 17 | 'label' => Mage::helper('integernet_solr')->__('Attribute'), 18 | 'style' => 'width:120px', 19 | 'renderer' => $this->_getRenderer(), 20 | )); 21 | $this->addColumn('max_number_suggestions', array( 22 | 'label' => Mage::helper('integernet_solr')->__('Maximum number of suggestions'), 23 | 'style' => 'width:60px', 24 | 'class' => 'validate-number validate-zero-or-greater', 25 | )); 26 | $this->addColumn('sorting', array( 27 | 'label' => Mage::helper('integernet_solr')->__('Sorting'), 28 | 'style' => 'width:60px', 29 | 'class' => 'validate-number validate-zero-or-greater', 30 | )); 31 | 32 | $this->_addAfter = false; 33 | $this->_addButtonLabel = Mage::helper('integernet_solr')->__('Add'); 34 | parent::__construct(); 35 | } 36 | 37 | /** 38 | * @return IntegerNet_Solr_Block_Config_Adminhtml_Form_Field_Attribute 39 | */ 40 | protected function _getRenderer() { 41 | if (!$this->_itemRenderer) { 42 | $this->_itemRenderer = Mage::app()->getLayout()->createBlock( 43 | 'integernet_solr/config_adminhtml_form_field_attribute', '', 44 | array('is_render_to_js_template' => true) 45 | ); 46 | } 47 | return $this->_itemRenderer; 48 | } 49 | 50 | /** 51 | * Prepare existing row data object 52 | * 53 | * @param Varien_Object 54 | */ 55 | protected function _prepareArrayRow(Varien_Object $row) 56 | { 57 | $row->setData( 58 | 'option_extra_attr_' . $this->_getRenderer()->calcOptionHash($row->getData('attribute_code')), 59 | 'selected="selected"' 60 | ); 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Block/Config/Description.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | class IntegerNet_Solr_Block_Config_Description extends Mage_Adminhtml_Block_System_Config_Form_Field 11 | { 12 | /** 13 | * @param Varien_Data_Form_Element_Abstract $element 14 | * @return string 15 | */ 16 | protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) 17 | { 18 | return $this->getLayout() 19 | ->createBlock('integernet_solr/config_status', 'integernet_solr_config_status') 20 | ->setTemplate('integernet/solr/config/status.phtml') 21 | ->toHtml(); 22 | } 23 | 24 | /** 25 | * Enter description here... 26 | * 27 | * @param Varien_Data_Form_Element_Abstract $element 28 | * @return string 29 | */ 30 | public function render(Varien_Data_Form_Element_Abstract $element) 31 | { 32 | $id = $element->getHtmlId(); 33 | 34 | $html = '' 35 | . '' . $this->_getElementHtml($element) . ''; 36 | 37 | 38 | $html.= ''; 39 | $html.= ''; 40 | return $html; 41 | } 42 | } -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Block/Config/Status.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | class IntegerNet_Solr_Block_Config_Status extends Mage_Core_Block_Template 11 | { 12 | protected $_messages = null; 13 | 14 | /** 15 | * @return string[] 16 | */ 17 | public function getSuccessMessages() 18 | { 19 | return $this->_getMessages('success'); 20 | } 21 | 22 | /** 23 | * @return string[] 24 | */ 25 | public function getErrorMessages() 26 | { 27 | return $this->_getMessages('error'); 28 | } 29 | 30 | /** 31 | * @return string[] 32 | */ 33 | public function getWarningMessages() 34 | { 35 | return $this->_getMessages('warning'); 36 | } 37 | 38 | /** 39 | * @return string[] 40 | */ 41 | public function getNoticeMessages() 42 | { 43 | return $this->_getMessages('notice'); 44 | } 45 | 46 | /** 47 | * @param string $type 48 | * @return string[] 49 | */ 50 | protected function _getMessages($type) 51 | { 52 | if (is_null($this->_messages)) { 53 | $this->_createMessages(); 54 | } 55 | if (isset($this->_messages[$type])) { 56 | return $this->_messages[$type]; 57 | } 58 | 59 | return array(); 60 | } 61 | 62 | protected function _createMessages() 63 | { 64 | $storeId = null; 65 | if ($storeCode = Mage::app()->getRequest()->getParam('store')) { 66 | $storeId = Mage::app()->getStore($storeCode)->getId(); 67 | } else { 68 | if ($websiteCode = Mage::app()->getRequest()->getParam('website')) { 69 | $storeId = Mage::app()->getWebsite($websiteCode)->getDefaultStore()->getId(); 70 | } 71 | } 72 | $this->_messages = Mage::getSingleton('integernet_solr/configuration')->getMessages($storeId); 73 | } 74 | } -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Block/Indexer/Item.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | 11 | class IntegerNet_Solr_Block_Indexer_Item extends Mage_Catalog_Block_Product_Abstract 12 | { 13 | 14 | } -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Block/Mana/Filters/Search.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | class IntegerNet_Solr_Block_Mana_Filters_Search extends Mana_Filters_Block_Search 11 | { 12 | public function delayedPrepareLayout() 13 | { 14 | if (Mage::helper('integernet_solr')->module()->isActive()) { 15 | 16 | return $this; 17 | } 18 | 19 | return parent::delayedPrepareLayout(); 20 | } 21 | } -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Block/Result/Layer.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | class IntegerNet_Solr_Block_Result_Layer extends Mage_Core_Block_Abstract 11 | { 12 | /** 13 | * @return IntegerNet_Solr_Block_Result_Layer_State 14 | */ 15 | public function getState() 16 | { 17 | if (Mage::helper('integernet_solr')->page()->isCategoryPage()) { 18 | if ($block = $this->getLayout()->getBlock('catalog.solr.layer.state')) { 19 | return $block; 20 | } 21 | 22 | $block = $this->getLayout()->createBlock('integernet_solr/result_layer_state') 23 | ->setTemplate('integernet/solr/layer/top/state.phtml') 24 | ->setLayer($this); 25 | 26 | return $block; 27 | } 28 | 29 | if ($block = $this->getLayout()->getBlock('catalogsearch.solr.layer.state')) { 30 | return $block; 31 | } 32 | 33 | $block = $this->getLayout()->createBlock('integernet_solr/result_layer_state') 34 | ->setTemplate('integernet/solr/layer/top/state.phtml') 35 | ->setLayer($this); 36 | 37 | return $block; 38 | } 39 | } -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Block/Result/Layer/Ajax.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | 11 | class IntegerNet_Solr_Block_Result_Layer_Ajax extends Mage_Core_Block_Abstract 12 | { 13 | protected function _toHtml() 14 | { 15 | if ($this->getLayout()->getBlock('search.result')) { 16 | $content = array( 17 | 'products' => $this->getLayout()->getBlock('search.result')->toHtml(), 18 | 'leftnav' => $this->getLayout()->getBlock('catalogsearch.solr.leftnav')->toHtml(), 19 | 'topnav' => $this->getLayout()->getBlock('catalogsearch.solr.topnav')->toHtml(), 20 | ); 21 | } else { 22 | $content = array( 23 | 'products' => $this->getLayout()->getBlock('category.products')->toHtml(), 24 | 'leftnav' => $this->getLayout()->getBlock('catalog.solr.leftnav')->toHtml(), 25 | 'topnav' => $this->getLayout()->getBlock('catalog.solr.topnav')->toHtml(), 26 | ); 27 | } 28 | 29 | return Zend_Json::encode($content); 30 | } 31 | } -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Block/Result/Layer/Checkbox.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | 11 | /** 12 | * Class IntegerNet_Solr_Block_Result_Layer_Checkbox 13 | * 14 | * @method boolean getIsChecked() 15 | * @method IntegerNet_Solr_Block_Result_Layer_Checkbox setIsChecked(boolean $value) 16 | * @method boolean getIsTopNav() 17 | * @method IntegerNet_Solr_Block_Result_Layer_Checkbox setIsTopNav(boolean $value) 18 | * @method int getOptionId() 19 | * @method IntegerNet_Solr_Block_Result_Layer_Checkbox setOptionId(int $value) 20 | * @method string getAttributeCode() 21 | * @method IntegerNet_Solr_Block_Result_Layer_Checkbox setAttributeCode(string $value) 22 | */ 23 | class IntegerNet_Solr_Block_Result_Layer_Checkbox extends Mage_Core_Block_Template 24 | { 25 | protected function _construct() 26 | { 27 | $this->setTemplate('integernet/solr/filter/checkbox.phtml'); 28 | } 29 | } -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Block/Result/Layer/Renderers.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | class IntegerNet_Solr_Block_Result_Layer_Renderers extends Mage_Core_Block_Abstract 11 | { 12 | /** 13 | * Dummy method to force old (pre-rwd) behavior of filters 14 | * 15 | * @return array 16 | */ 17 | public function getSortedChildren() 18 | { 19 | return array(); 20 | } 21 | } -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Block/Result/List/Item.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | class IntegerNet_Solr_Block_Result_List_Item extends Mage_Core_Block_Abstract 11 | { 12 | /** 13 | * Override this method in descendants to produce html 14 | * 15 | * @return string 16 | */ 17 | protected function _toHtml() 18 | { 19 | /** @var Apache_Solr_Document $product */ 20 | $product = $this->getProduct(); 21 | 22 | switch ($this->getListType()) { 23 | case 'autosuggest': 24 | $field = $product->getField('result_html_autosuggest_nonindex'); 25 | break; 26 | 27 | case 'list': 28 | $field = $product->getField('result_html_list_nonindex'); 29 | break; 30 | 31 | default: 32 | $field = $product->getField('result_html_grid_nonindex'); 33 | } 34 | return $field['value']; 35 | } 36 | } -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Block/Result/List/Toolbar.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | class IntegerNet_Solr_Block_Result_List_Toolbar extends Mage_Catalog_Block_Product_List_Toolbar 11 | { 12 | 13 | /** 14 | * Return current URL with rewrites and additional parameters 15 | * 16 | * @param array $params Query parameters 17 | * @return string 18 | */ 19 | public function getPagerUrl($params=array()) 20 | { 21 | $urlParams = array(); 22 | $urlParams['_current'] = true; 23 | $urlParams['_escape'] = true; 24 | $urlParams['_use_rewrite'] = true; 25 | $urlParams['_query'] = $params; 26 | return $this->getUrl($this->_getRoute(), $urlParams); 27 | } 28 | 29 | /** 30 | * @return string 31 | */ 32 | protected function _getRoute() 33 | { 34 | if (Mage::helper('integernet_solr')->page()->isCategoryPage()) { 35 | 36 | return 'catalog/category/view'; 37 | } 38 | return 'catalogsearch/result/*'; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Helper/Attribute.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | 11 | use IntegerNet\Solr\Implementor\Attribute; 12 | use IntegerNet\Solr\Indexer\IndexField; 13 | 14 | /** 15 | * @deprecated 16 | */ 17 | class IntegerNet_Solr_Helper_Attribute 18 | { 19 | protected $_bridgeFactory; 20 | 21 | public function __construct() 22 | { 23 | $this->_bridgeFactory = Mage::getModel('integernet_solr/bridge_factory'); 24 | } 25 | 26 | /** 27 | * @deprecated use IndexField directly 28 | * @param Attribute $attribute 29 | * @param bool $forSorting 30 | * @return string 31 | */ 32 | public function getFieldName($attribute, $forSorting = false) 33 | { 34 | if (! $attribute instanceof Attribute) { 35 | $attribute = $this->_bridgeFactory->createAttribute($attribute); 36 | } 37 | $indexField = new IndexField($attribute, $this->_getEventDispatcher(), $forSorting); 38 | return $indexField->getFieldName(); 39 | } 40 | 41 | /** 42 | * @return IntegerNet_Solr_Helper_Event 43 | */ 44 | protected function _getEventDispatcher() 45 | { 46 | return Mage::helper('integernet_solr/event'); 47 | } 48 | } -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Helper/Autoloader/PayPalPlus.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | 11 | /** 12 | * This rewrite fixes the Iways_PayPalPlus autoloader to work nicely together with other third party autoloaders, 13 | * i.e. without warnings. 14 | */ 15 | class IntegerNet_Solr_Helper_Autoloader_PayPalPlus extends Iways_PayPalPlus_Model_Autoloader 16 | { 17 | /** 18 | * Autoload 19 | * 20 | * @param string $class 21 | */ 22 | public function autoload($class) 23 | { 24 | $classFile = str_replace('\\', DS, $class) . '.php'; 25 | // Actually check if file exists in include path, do nothing otherwise 26 | if (stream_resolve_include_path($classFile) !== false) { 27 | include $classFile; 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Helper/CatalogSearch/Data.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | class IntegerNet_Solr_Helper_CatalogSearch_Data extends Mage_CatalogSearch_Helper_Data 11 | { 12 | /** 13 | * Retrieve suggest url 14 | * 15 | * @return string 16 | */ 17 | public function getSuggestUrl() 18 | { 19 | if (Mage::getStoreConfigFlag('integernet_solr/general/is_active')) { 20 | if (Mage::app()->getStore()->isCurrentlySecure()) { 21 | $baseUrl = Mage::getStoreConfig('web/secure/base_url'); 22 | } else { 23 | $baseUrl = Mage::getStoreConfig('web/unsecure/base_url'); 24 | } 25 | switch (Mage::getStoreConfig('integernet_solr/autosuggest/use_php_file_in_home_dir')) { 26 | case IntegerNet_Solr_Model_Source_AutosuggestMethod::AUTOSUGGEST_METHOD_PHP: 27 | return $baseUrl . 'autosuggest.php?store_id=' . Mage::app()->getStore()->getId(); 28 | case IntegerNet_Solr_Model_Source_AutosuggestMethod::AUTOSUGGEST_METHOD_MAGENTO_DIRECT: 29 | return $baseUrl . 'autosuggest-mage.php?store_id=' . Mage::app()->getStore()->getId(); 30 | } 31 | } 32 | 33 | return parent::getSuggestUrl(); 34 | } 35 | } -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Helper/Data.php: -------------------------------------------------------------------------------- 1 | 10 | */ 11 | 12 | /** 13 | * This class is only meant to be used as proxy for other helpers with concrete responsibilities. 14 | * 15 | * Use the methods to instantiate other helpers, this way it is ensured that the autoloader 16 | * is registered before. 17 | * 18 | */ 19 | class IntegerNet_Solr_Helper_Data extends Mage_Core_Helper_Abstract 20 | { 21 | 22 | public function __construct() 23 | { 24 | IntegerNet_Solr_Helper_Autoloader::createAndRegister(); 25 | } 26 | 27 | /** 28 | * @return IntegerNet_Solr_Helper_Factory 29 | */ 30 | public function factory() 31 | { 32 | return Mage::helper('integernet_solr/factory'); 33 | } 34 | 35 | /** 36 | * @return IntegerNet_Solr_Helper_Attribute 37 | */ 38 | public function attribute() 39 | { 40 | return Mage::helper('integernet_solr/attribute'); 41 | } 42 | 43 | /** 44 | * @return IntegerNet_Solr_Helper_Module 45 | */ 46 | public function module() 47 | { 48 | return Mage::helper('integernet_solr/module'); 49 | } 50 | 51 | /** 52 | * @return IntegerNet_Solr_Helper_Page 53 | */ 54 | public function page() 55 | { 56 | return Mage::helper('integernet_solr/page'); 57 | } 58 | 59 | /** 60 | * @return bool 61 | * @deprecated use Module helper instead: module()->isActive() 62 | */ 63 | public function isActive() 64 | { 65 | return $this->module()->isActive(); 66 | } 67 | 68 | /** 69 | * @return bool 70 | * @deprecated use Page helper instead: page()->isSearchPage() 71 | */ 72 | public function isSearchPage() 73 | { 74 | return $this->page()->isSearchPage(); 75 | } 76 | 77 | /** 78 | * @return bool 79 | * @deprecated use Page helper instead: page()->isCategoryPage() 80 | */ 81 | public function isCategoryPage() 82 | { 83 | return $this->page()->isCategoryPage(); 84 | } 85 | 86 | /** 87 | * @return bool 88 | * @deprecated use Page helper instead: page()->isSolrResultPage() 89 | */ 90 | public function isSolrResultPage() 91 | { 92 | return $this->page()->isSolrResultPage(); 93 | } 94 | 95 | /** 96 | * @return bool 97 | */ 98 | public function isCategoryDisplayActive() 99 | { 100 | return Mage::getStoreConfigFlag('integernet_solr/category/is_active'); 101 | } 102 | 103 | } -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Helper/Event.php: -------------------------------------------------------------------------------- 1 | 14 | */ 15 | class IntegerNet_Solr_Helper_Event implements EventDispatcher 16 | { 17 | /** 18 | * Dispatch event 19 | * 20 | * @param string $eventName 21 | * @param array $data 22 | * @return void 23 | */ 24 | public function dispatch($eventName, array $data = array()) 25 | { 26 | Mage::dispatchEvent($eventName, $data); 27 | } 28 | } -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Helper/Filter.php: -------------------------------------------------------------------------------- 1 | 11 | */ 12 | class IntegerNet_Solr_Helper_Filter extends Mage_Core_Helper_Abstract 13 | { 14 | public function getFilterPosition() 15 | { 16 | if (!@class_exists('CategoryConfig')) { 17 | return ''; 18 | } 19 | if( $category = Mage::registry('current_category') ){ 20 | switch ( $category->getData('filter_position') ){ 21 | case CategoryConfig::FILTER_POSITION_DEFAULT: 22 | switch(Mage::getStoreConfig('integernet_solr/category/filter_position')){ 23 | case CategoryConfig::FILTER_POSITION_LEFT: 24 | return 'left'; 25 | case CategoryConfig::FILTER_POSITION_TOP: 26 | return 'top'; 27 | } 28 | case CategoryConfig::FILTER_POSITION_LEFT: 29 | return 'left'; 30 | case CategoryConfig::FILTER_POSITION_TOP: 31 | return 'top'; 32 | }; 33 | }else { 34 | switch(Mage::getStoreConfig('integernet_solr/results/filter_position')){ 35 | case CategoryConfig::FILTER_POSITION_LEFT: 36 | return 'left'; 37 | case CategoryConfig::FILTER_POSITION_TOP: 38 | return 'top'; 39 | } 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Helper/Log.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | use Psr\Log\AbstractLogger; 11 | use Psr\Log\LogLevel; 12 | 13 | final class IntegerNet_Solr_Helper_Log extends AbstractLogger 14 | { 15 | /** 16 | * @var array 17 | */ 18 | protected static $_levelMapping = array( 19 | LogLevel::ALERT => Zend_Log::ALERT, 20 | LogLevel::CRITICAL => Zend_Log::CRIT, 21 | LogLevel::DEBUG => Zend_Log::DEBUG, 22 | LogLevel::EMERGENCY => Zend_Log::EMERG, 23 | LogLevel::ERROR => Zend_Log::ERR, 24 | LogLevel::INFO => Zend_Log::INFO, 25 | LogLevel::NOTICE => Zend_Log::NOTICE, 26 | LogLevel::WARNING => Zend_Log::WARN, 27 | ); 28 | /** 29 | * @var string 30 | */ 31 | protected $_file = 'solr.log'; 32 | 33 | /** 34 | * @param string $file 35 | * @return $this 36 | */ 37 | public function setFile($file) 38 | { 39 | $this->_file = $file; 40 | return $this; 41 | } 42 | 43 | /** 44 | * Logs with an arbitrary level. 45 | * 46 | * @param mixed $level 47 | * @param string $message 48 | * @param array $context 49 | * 50 | * @return null 51 | */ 52 | public function log($level, $message, array $context = array()) 53 | { 54 | Mage::log($message, self::$_levelMapping[$level], $this->_file); 55 | } 56 | 57 | } -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Helper/Module.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | class IntegerNet_Solr_Helper_Module 11 | { 12 | /** 13 | * @return bool 14 | */ 15 | public function isActive() 16 | { 17 | $helper = Mage::helper('integernet_solr'); 18 | if (!Mage::getStoreConfigFlag('integernet_solr/general/is_active')) { 19 | return false; 20 | } 21 | 22 | if (!$this->isLicensed()) { 23 | return false; 24 | } 25 | 26 | if (Mage::registry('is_autosuggest')) { 27 | return true; 28 | } 29 | 30 | if ($helper->page()->isCategoryPage() && !$helper->isCategoryDisplayActive()) { 31 | return false; 32 | } 33 | 34 | if (!$helper->page()->isSolrResultPage()) { 35 | return false; 36 | } 37 | 38 | return true; 39 | } 40 | /** 41 | * @param string $key 42 | * @return bool 43 | */ 44 | public function isKeyValid($key) 45 | { 46 | if (!$key) { 47 | return true; 48 | } 49 | $key = trim(strtolower($key)); 50 | $key = str_replace(array('-', '_', ' '), '', $key); 51 | 52 | if (strlen($key) != 10) { 53 | return false; 54 | } 55 | 56 | $hash = md5($key); 57 | 58 | return substr($hash, -3) == 'f11'; 59 | } 60 | 61 | /** 62 | * @return bool 63 | */ 64 | public function isLicensed() 65 | { 66 | if (!Mage::helper('core')->isModuleEnabled('IntegerNet_SolrPro')) { 67 | return true; 68 | } 69 | if (!$this->isKeyValid(Mage::getStoreConfig('integernet_solr/general/license_key'))) { 70 | 71 | if ($installTimestamp = Mage::getStoreConfig('integernet_solr/general/install_date')) { 72 | 73 | $diff = time() - $installTimestamp; 74 | if (($diff < 0) || ($diff > 2419200)) { 75 | 76 | Mage::log('The IntegerNet_Solr module is not correctly licensed. Please enter your license key at System -> Configuration -> Solr or contact us via http://www.integer-net.com/solr-magento/.', Zend_Log::WARN, 'exception.log'); 77 | return false; 78 | 79 | } else if ($diff > 1209600) { 80 | 81 | Mage::log('The IntegerNet_Solr module is not correctly licensed. Please enter your license key at System -> Configuration -> Solr or contact us via http://www.integer-net.com/solr-magento/.', Zend_Log::WARN, 'exception.log'); 82 | } 83 | } 84 | } 85 | 86 | return true; 87 | } 88 | } -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Helper/Page.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | class IntegerNet_Solr_Helper_Page 11 | { 12 | /** 13 | * @return bool 14 | */ 15 | public function isSearchPage() 16 | { 17 | return Mage::app()->getRequest()->getModuleName() == 'catalogsearch' 18 | && Mage::app()->getRequest()->getControllerName() == 'result'; 19 | } 20 | 21 | /** 22 | * @return bool 23 | */ 24 | public function isCategoryPage() 25 | { 26 | return Mage::helper('core')->isModuleEnabled('IntegerNet_SolrPro') 27 | && ((Mage::app()->getRequest()->getModuleName() == 'catalog' && Mage::app()->getRequest()->getControllerName() == 'category') 28 | || (Mage::app()->getRequest()->getModuleName() == 'solr' && Mage::app()->getRequest()->getControllerName() == 'category')); 29 | } 30 | 31 | /** 32 | * @return bool 33 | */ 34 | public function isSolrResultPage() 35 | { 36 | return Mage::app()->getRequest()->getModuleName() == 'catalogsearch' 37 | || Mage::app()->getRequest()->getModuleName() == 'solr' 38 | || $this->isCategoryPage(); 39 | } 40 | 41 | } -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Helper/Query.php: -------------------------------------------------------------------------------- 1 | 14 | */ 15 | class IntegerNet_Solr_Helper_SearchUrl implements SearchUrl 16 | { 17 | /** 18 | * Returns search URL for given user query text 19 | * 20 | * @param string $queryText 21 | * @param string[] $additionalParameters 22 | * @return string 23 | */ 24 | public function getUrl($queryText, array $additionalParameters = array()) 25 | { 26 | return Mage::getUrl('catalogsearch/result', 27 | array('_query' => array_merge(array('q' => $queryText), $additionalParameters))); 28 | } 29 | 30 | } -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Helper/Searchterm.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | 11 | use IntegerNet\Solr\Implementor\HasUserQuery; 12 | 13 | class IntegerNet_Solr_Helper_Searchterm implements HasUserQuery 14 | { 15 | /** 16 | * Returns query as entered by user 17 | * 18 | * @return string 19 | */ 20 | public function getUserQueryText() 21 | { 22 | return Mage::helper('catalogsearch')->getQuery()->getQueryText(); 23 | } 24 | 25 | } -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Helper/SearchtermSynonym.php: -------------------------------------------------------------------------------- 1 | 14 | */ 15 | class IntegerNet_Solr_Helper_SearchtermSynonym implements HasUserQuery 16 | { 17 | /** 18 | * Returns query as entered by user 19 | * 20 | * @return string 21 | */ 22 | public function getUserQueryText() 23 | { 24 | $query = Mage::helper('catalogsearch')->getQuery(); 25 | $queryText = $query->getQueryText(); 26 | if ($query->getSynonymFor()) { 27 | $queryText = $query->getSynonymFor(); 28 | return $queryText; 29 | } 30 | return $queryText; 31 | } 32 | } -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Model/Bridge/Attribute.php: -------------------------------------------------------------------------------- 1 | 12 | */ 13 | final class IntegerNet_Solr_Model_Bridge_Attribute implements Attribute 14 | { 15 | /** 16 | * @var Mage_Catalog_Model_Resource_Eav_Attribute 17 | */ 18 | protected $_attribute; 19 | /** 20 | * @var IntegerNet_Solr_Model_Bridge_Source 21 | */ 22 | protected $_source; 23 | 24 | /** 25 | * @param Mage_Catalog_Model_Resource_Eav_Attribute $attribute 26 | * @throws Mage_Core_Exception 27 | */ 28 | public function __construct(Mage_Catalog_Model_Resource_Eav_Attribute $attribute) 29 | { 30 | $this->_attribute = $attribute; 31 | $this->_source = Mage::getModel('integernet_solr/bridge_factory')->createAttributeSource($this->_attribute->getSource()); 32 | } 33 | /** 34 | * @return string 35 | */ 36 | public function getAttributeCode() 37 | { 38 | return $this->_attribute->getAttributeCode(); 39 | } 40 | 41 | /** 42 | * @return string 43 | */ 44 | public function getStoreLabel() 45 | { 46 | return $this->_attribute->getStoreLabel(); 47 | } 48 | 49 | /** 50 | * @return float 51 | */ 52 | public function getSolrBoost() 53 | { 54 | return $this->_attribute->getData('solr_boost'); 55 | } 56 | 57 | /** 58 | * @return Source 59 | */ 60 | public function getSource() 61 | { 62 | return $this->_source; 63 | } 64 | 65 | public function getFacetType() 66 | { 67 | return $this->_attribute->getFrontendInput(); 68 | } 69 | 70 | /** 71 | * @return bool 72 | */ 73 | public function getIsSearchable() 74 | { 75 | return $this->_attribute->getIsSearchable(); 76 | } 77 | 78 | /** 79 | * @return string 80 | */ 81 | public function getBackendType() 82 | { 83 | return $this->_attribute->getBackendType(); 84 | } 85 | 86 | /** 87 | * @return bool 88 | */ 89 | public function getUsedForSortBy() 90 | { 91 | return $this->_attribute->getUsedForSortBy(); 92 | } 93 | 94 | /** 95 | * Delegate all other calls (by Magento) to attribute 96 | * 97 | * @param $name string 98 | * @param $arguments array 99 | * @return mixed 100 | */ 101 | function __call($name, $arguments) 102 | { 103 | return call_user_func_array(array($this->_attribute, $name), $arguments); 104 | } 105 | 106 | 107 | } -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Model/Bridge/CategoryIterator.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | use IntegerNet\SolrCategories\Implementor\Category; 11 | use IntegerNet\SolrCategories\Implementor\CategoryIterator; 12 | 13 | class IntegerNet_Solr_Model_Bridge_CategoryIterator extends IteratorIterator implements CategoryIterator 14 | { 15 | protected $_bridgeFactory; 16 | 17 | /** 18 | * @param Mage_Catalog_Model_Resource_Category_Collection $_collection 19 | */ 20 | public function __construct(Mage_Catalog_Model_Resource_Category_Collection $_collection) 21 | { 22 | $this->_bridgeFactory = Mage::getModel('integernet_solr/bridge_factory'); 23 | parent::__construct($_collection->getIterator()); 24 | } 25 | 26 | /** 27 | * @return Category 28 | */ 29 | public function current() 30 | { 31 | return $this->_bridgeFactory->createCategory($this->getInnerIterator()->current()); 32 | } 33 | 34 | } -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Model/Bridge/CategoryRenderer.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | 11 | use IntegerNet\SolrCategories\Implementor\CategoryRenderer; 12 | use IntegerNet\SolrCategories\Implementor\Category; 13 | use IntegerNet\Solr\Indexer\IndexDocument; 14 | 15 | class IntegerNet_Solr_Model_Bridge_CategoryRenderer implements CategoryRenderer 16 | { 17 | /** @var IntegerNet_Solr_Block_Indexer_Item[] */ 18 | private $_itemBlocks = array(); 19 | 20 | /** 21 | * @param Category $category 22 | * @param IndexDocument $categoryData 23 | * @param bool $useHtmlInResults 24 | */ 25 | public function addResultHtmlToCategoryData(Category $category, IndexDocument $categoryData, $useHtmlInResults) 26 | { 27 | if (! $category instanceof IntegerNet_Solr_Model_Bridge_Category) { 28 | // We need direct access to the Magento category 29 | throw new InvalidArgumentException('Magento 1 category bridge expected, '. get_class($category) .' received.'); 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Model/Bridge/PageIterator.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | use IntegerNet\SolrCms\Implementor\Page; 11 | use IntegerNet\SolrCms\Implementor\PageIterator; 12 | 13 | class IntegerNet_Solr_Model_Bridge_PageIterator extends IteratorIterator implements PageIterator 14 | { 15 | protected $_bridgeFactory; 16 | 17 | /** 18 | * @param Mage_Cms_Model_Resource_Page_Collection $_collection 19 | */ 20 | public function __construct(Mage_Cms_Model_Resource_Page_Collection $_collection) 21 | { 22 | $this->_bridgeFactory = Mage::getModel('integernet_solr/bridge_factory'); 23 | parent::__construct($_collection->getIterator()); 24 | } 25 | 26 | /** 27 | * @return Page 28 | */ 29 | public function current() 30 | { 31 | return $this->_bridgeFactory->createPage($this->getInnerIterator()->current()); 32 | } 33 | 34 | } -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Model/Bridge/PageRenderer.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | 11 | use IntegerNet\SolrCms\Implementor\PageRenderer; 12 | use IntegerNet\SolrCms\Implementor\Page; 13 | use IntegerNet\Solr\Indexer\IndexDocument; 14 | 15 | class IntegerNet_Solr_Model_Bridge_PageRenderer implements PageRenderer 16 | { 17 | /** @var IntegerNet_Solr_Block_Indexer_Item[] */ 18 | private $_itemBlocks = array(); 19 | 20 | /** 21 | * @param Page $page 22 | * @param IndexDocument $pageData 23 | * @param bool $useHtmlInResults 24 | */ 25 | public function addResultHtmlToPageData(Page $page, IndexDocument $pageData, $useHtmlInResults) 26 | { 27 | if (! $page instanceof IntegerNet_Solr_Model_Bridge_Page) { 28 | // We need direct access to the Magento page 29 | throw new InvalidArgumentException('Magento 1 page bridge expected, '. get_class($page) .' received.'); 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Model/Bridge/PageRepository.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | use IntegerNet\SolrCms\Implementor\PageRepository; 11 | use IntegerNet\SolrCms\Implementor\PageIterator; 12 | 13 | class IntegerNet_Solr_Model_Bridge_PageRepository implements PageRepository 14 | { 15 | protected $_bridgeFactory; 16 | 17 | public function __construct() 18 | { 19 | $this->_bridgeFactory = Mage::getModel('integernet_solr/bridge_factory'); 20 | } 21 | 22 | /** 23 | * @var int 24 | */ 25 | protected $_pageSize; 26 | 27 | /** 28 | * @param int $pageSize 29 | * @return $this 30 | */ 31 | public function setPageSizeForIndex($pageSize) 32 | { 33 | $this->_pageSize = $pageSize; 34 | return $this; 35 | } 36 | 37 | /** 38 | * Return page iterator, which may implement lazy loading 39 | * 40 | * @param int $storeId Pages will be returned that are visible in this store and with store specific values 41 | * @param null|int[] $pageIds filter by page ids 42 | * @return PageIterator 43 | */ 44 | public function getPagesForIndex($storeId, $pageIds = null) 45 | { 46 | return $this->_bridgeFactory->createLazyPageIterator($storeId, $pageIds, $this->_pageSize); 47 | } 48 | } -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Model/Bridge/Pagination/Toolbar.php: -------------------------------------------------------------------------------- 1 | 11 | */ 12 | class IntegerNet_Solr_Model_Bridge_Pagination_Toolbar implements Pagination 13 | { 14 | /** 15 | * @var Varien_Object|Mage_Catalog_Block_Product_List_Toolbar 16 | */ 17 | protected $_toolbarBlock; 18 | 19 | /** 20 | * @param Varien_Object|Mage_Catalog_Block_Product_List_Toolbar $toolbarBlock 21 | */ 22 | public function __construct(Varien_Object $toolbarBlock) 23 | { 24 | $this->_toolbarBlock = $toolbarBlock; 25 | } 26 | /** 27 | * Returns page size 28 | * 29 | * @return int 30 | */ 31 | public function getPageSize() 32 | { 33 | $limit = $this->_toolbarBlock->getLimit(); 34 | if ($limit == 'all') { 35 | return 10000; 36 | } 37 | return $limit; 38 | } 39 | 40 | /** 41 | * Returns current page 42 | * 43 | * @return int 44 | */ 45 | public function getCurrentPage() 46 | { 47 | return $this->_toolbarBlock->getCurrentPage(); 48 | } 49 | 50 | /** 51 | * Returns sort order 52 | * 53 | * @return string {'asc', 'desc'} 54 | */ 55 | public function getCurrentDirection() 56 | { 57 | return $this->_toolbarBlock->getCurrentDirection(); 58 | } 59 | 60 | /** 61 | * Returns sort criterion (attribute) 62 | * 63 | * @return string 64 | */ 65 | public function getCurrentOrder() 66 | { 67 | return $this->_toolbarBlock->getCurrentOrder(); 68 | } 69 | 70 | } -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Model/Bridge/ProductIterator.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | use IntegerNet\Solr\Implementor\Product; 11 | use IntegerNet\Solr\Implementor\ProductIterator; 12 | 13 | class IntegerNet_Solr_Model_Bridge_ProductIterator extends IteratorIterator implements ProductIterator 14 | { 15 | protected $_bridgeFactory; 16 | 17 | /** 18 | * @param Varien_Data_Collection $_collection 19 | */ 20 | public function __construct(Varien_Data_Collection $_collection) 21 | { 22 | $this->_bridgeFactory = Mage::getModel('integernet_solr/bridge_factory'); 23 | parent::__construct($_collection->getIterator()); 24 | } 25 | 26 | /** 27 | * @return Product 28 | */ 29 | public function current() 30 | { 31 | return $this->_bridgeFactory->createProduct($this->getInnerIterator()->current()); 32 | } 33 | 34 | } -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Model/Bridge/Source.php: -------------------------------------------------------------------------------- 1 | 11 | */ 12 | class IntegerNet_Solr_Model_Bridge_Source implements Source 13 | { 14 | /** 15 | * @var Mage_Eav_Model_Entity_Attribute_Source_Interface 16 | */ 17 | private $_source; 18 | 19 | /** 20 | * @param $_source Mage_Eav_Model_Entity_Attribute_Source_Interface 21 | */ 22 | public function __construct(Mage_Eav_Model_Entity_Attribute_Source_Interface $_source) 23 | { 24 | $this->_source = $_source; 25 | } 26 | 27 | /** 28 | * @param int $optionId 29 | * @return string 30 | */ 31 | public function getOptionText($optionId) 32 | { 33 | return $this->_source->getOptionText($optionId); 34 | } 35 | 36 | /** 37 | * Returns [optionId => optionText] map 38 | * 39 | * @return string[] 40 | */ 41 | public function getOptionMap() 42 | { 43 | $result = array(); 44 | foreach ($this->_source->getAllOptions() as $option) { 45 | $result[$option['value']] = $option['label']; 46 | } 47 | return $result; 48 | } 49 | 50 | 51 | /** 52 | * Delegate all other calls (by Magento) to source model 53 | * 54 | * @param $name string 55 | * @param $arguments array 56 | * @return mixed 57 | */ 58 | function __call($name, $arguments) 59 | { 60 | return call_user_func_array(array($this->_source, $name), $arguments); 61 | } 62 | } -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Model/Bridge/StoreEmulation.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | 11 | use IntegerNet\Solr\Implementor\StoreEmulation; 12 | 13 | class IntegerNet_Solr_Model_Bridge_StoreEmulation implements StoreEmulation 14 | { 15 | protected $_currentStoreId = null; 16 | protected $_isEmulated = false; 17 | protected $_initialEnvironmentInfo = null; 18 | protected $_unsecureBaseConfig = array(); 19 | 20 | /** 21 | * @param int $storeId 22 | * @throws Mage_Core_Exception 23 | */ 24 | public function start($storeId) 25 | { 26 | $this->stop(); 27 | $newLocaleCode = Mage::getStoreConfig(Mage_Core_Model_Locale::XML_PATH_DEFAULT_LOCALE, $storeId); 28 | $this->_currentStoreId = $storeId; 29 | $this->_initialEnvironmentInfo = Mage::getSingleton('core/app_emulation')->startEnvironmentEmulation($storeId); 30 | $this->_isEmulated = true; 31 | Mage::app()->getLocale()->setLocaleCode($newLocaleCode); 32 | Mage::getSingleton('core/translate')->setLocale($newLocaleCode)->init(Mage_Core_Model_App_Area::AREA_FRONTEND, true); 33 | Mage::getDesign()->setStore($storeId); 34 | Mage::getDesign()->setPackageName(); 35 | 36 | Mage::getDesign()->setTheme(Mage::getStoreConfig('design/theme/default', $storeId)); 37 | foreach(array('layout', 'template', 'skin', 'locale') as $areaName) { 38 | if ($themeName = Mage::getStoreConfig('design/theme/' . $areaName, $storeId)) { 39 | Mage::getDesign()->setTheme($areaName, $themeName); 40 | } 41 | } 42 | 43 | $this->_unsecureBaseConfig[$storeId] = Mage::getStoreConfig('web/unsecure', $storeId); 44 | $store = Mage::app()->getStore($storeId); 45 | $store->setConfig('web/unsecure/base_skin_url', Mage::getStoreConfig('web/secure/base_skin_url', $storeId)); 46 | $store->setConfig('web/unsecure/base_media_url', Mage::getStoreConfig('web/secure/base_media_url', $storeId)); 47 | $store->setConfig('web/unsecure/base_js_url', Mage::getStoreConfig('web/secure/base_js_url', $storeId)); 48 | } 49 | 50 | public function stop() 51 | { 52 | if (isset($this->_unsecureBaseConfig[$this->_currentStoreId])) { 53 | $store = Mage::app()->getStore($this->_currentStoreId); 54 | $store->setConfig('web/unsecure/base_skin_url', $this->_unsecureBaseConfig[$this->_currentStoreId]['base_skin_url']); 55 | $store->setConfig('web/unsecure/base_media_url', $this->_unsecureBaseConfig[$this->_currentStoreId]['base_media_url']); 56 | $store->setConfig('web/unsecure/base_js_url', $this->_unsecureBaseConfig[$this->_currentStoreId]['base_js_url']); 57 | } 58 | 59 | if ($this->_isEmulated && $this->_initialEnvironmentInfo) { 60 | Mage::getSingleton('core/app_emulation')->stopEnvironmentEmulation($this->_initialEnvironmentInfo); 61 | $this->_isEmulated = false; 62 | } 63 | } 64 | 65 | /** 66 | * Executes callback with environment emulation for given store. Emulation is stopped in any case (Exception or successful execution). 67 | * 68 | * @param $storeId 69 | * @param callable $callback 70 | * @throws Exception 71 | */ 72 | public function runInStore($storeId, $callback) 73 | { 74 | $this->start($storeId); 75 | try { 76 | $callback(); 77 | } catch (Exception $e) { 78 | $this->stop(); 79 | throw $e; 80 | } 81 | $this->stop(); 82 | } 83 | 84 | public function __destruct() 85 | { 86 | $this->stop(); 87 | } 88 | } -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Model/Catalog/Layer.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | class IntegerNet_Solr_Model_Catalog_Layer extends Mage_Catalog_Model_Layer 11 | { 12 | /** 13 | * Get current layer product collection 14 | * 15 | * @return Varien_Data_Collection 16 | */ 17 | public function getProductCollection() 18 | { 19 | if (!Mage::helper('integernet_solr')->module()->isActive()) { 20 | return parent::getProductCollection(); 21 | } 22 | 23 | $category = $this->getCurrentCategory(); 24 | 25 | if ($category->getData('solr_exclude')) { 26 | return parent::getProductCollection(); 27 | } 28 | 29 | if (! isset($this->_productCollections[$category->getId()])) { 30 | $this->_productCollections[$category->getId()] = Mage::getModel('integernet_solr/result_collection'); 31 | } 32 | 33 | return $this->_productCollections[$category->getId()]; 34 | } 35 | 36 | /** 37 | * Get collection of all filterable attributes for layer products set 38 | * 39 | * @return Mage_Catalog_Model_Resource_Product_Attribute_Collection 40 | */ 41 | public function getFilterableAttributes() 42 | { 43 | if (!Mage::helper('integernet_solr')->module()->isActive()) { 44 | return parent::getFilterableAttributes(); 45 | } 46 | 47 | /** @var $collection Mage_Catalog_Model_Resource_Product_Attribute_Collection */ 48 | $collection = Mage::getResourceModel('catalog/product_attribute_collection'); 49 | $collection 50 | ->setItemObjectClass('catalog/resource_eav_attribute') 51 | ->addStoreLabel(Mage::app()->getStore()->getId()) 52 | ->setOrder('position', 'ASC'); 53 | $collection = $this->_prepareAttributeCollection($collection); 54 | $collection->load(); 55 | 56 | return $collection; 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Model/Catalog/Layer/Filter/Attribute.php: -------------------------------------------------------------------------------- 1 | 10 | */ 11 | class IntegerNet_Solr_Model_Catalog_Layer_Filter_Attribute extends Mage_Catalog_Model_Layer_Filter_Attribute 12 | { 13 | /** 14 | * Apply attribute option filter to product collection 15 | * 16 | * @param Zend_Controller_Request_Abstract $request 17 | * @param Varien_Object $filterBlock 18 | * @return Mage_Catalog_Model_Layer_Filter_Attribute 19 | */ 20 | public function apply(Zend_Controller_Request_Abstract $request, $filterBlock) 21 | { 22 | $filter = $request->getParam($this->_requestVar); 23 | if (is_array($filter)) { 24 | return $this; 25 | } 26 | foreach (explode(',', $filter) as $optionValue) { 27 | $text = $this->_getOptionText($optionValue); 28 | if ($filter && strlen($text)) { 29 | $this->_getResource()->applyFilterToCollection($this, $optionValue); 30 | $this->getLayer()->getState()->addFilter($this->_createItem($text, $optionValue)); 31 | $this->_items = array(); 32 | } 33 | } 34 | return $this; 35 | } 36 | } -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Model/Catalog/Layer/Filter/Category.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | class IntegerNet_Solr_Model_Catalog_Layer_Filter_Category extends Mage_Catalog_Model_Layer_Filter_Category 11 | { 12 | 13 | 14 | /** 15 | * Apply category filter to layer 16 | * 17 | * @param Zend_Controller_Request_Abstract $request 18 | * @param Mage_Core_Block_Abstract $filterBlock 19 | * @return Mage_Catalog_Model_Layer_Filter_Category 20 | */ 21 | public function apply(Zend_Controller_Request_Abstract $request, $filterBlock) 22 | { 23 | $filter = $request->getParam($this->getRequestVar()); 24 | if (!$filter) { 25 | return $this; 26 | } 27 | 28 | foreach(explode(',', $filter) as $subFilter) { 29 | 30 | $this->_categoryId = $subFilter; 31 | 32 | Mage::register('current_category_filter', $this->getCategory(), true); 33 | 34 | $this->_appliedCategory = Mage::getModel('catalog/category') 35 | ->setStoreId(Mage::app()->getStore()->getId()) 36 | ->load($subFilter); 37 | 38 | if ($this->_isValidCategory($this->_appliedCategory)) { 39 | $this->getLayer()->getProductCollection() 40 | ->addCategoryFilter($this->_appliedCategory); 41 | 42 | $this->getLayer()->getState()->addFilter( 43 | $this->_createItem($this->_appliedCategory->getName(), $filter) 44 | ); 45 | } 46 | } 47 | 48 | return $this; 49 | } 50 | } -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Model/Catalog/Layer/Filter/Price.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | class IntegerNet_Solr_Model_Catalog_Layer_Filter_Price extends Mage_Catalog_Model_Layer_Filter_Price 11 | { 12 | /** 13 | * Get price range for building filter steps 14 | * 15 | * @return int 16 | */ 17 | public function getPriceRange() 18 | { 19 | if (!Mage::helper('integernet_solr')->module()->isActive()) { 20 | return parent::getPriceRange(); 21 | } 22 | 23 | if (!Mage::helper('integernet_solr')->page()->isSolrResultPage()) { 24 | return parent::getPriceRange(); 25 | } 26 | 27 | return Mage::getStoreConfig('integernet_solr/results/price_step_size'); 28 | } 29 | 30 | /** 31 | * Apply price range filter 32 | * 33 | * @param Zend_Controller_Request_Abstract $request 34 | * @param $filterBlock 35 | * 36 | * @return Mage_Catalog_Model_Layer_Filter_Price 37 | */ 38 | public function apply(Zend_Controller_Request_Abstract $request, $filterBlock) 39 | { 40 | /** 41 | * Filter must be string: $fromPrice-$toPrice 42 | */ 43 | $filter = $request->getParam($this->getRequestVar()); 44 | if (!$filter) { 45 | return $this; 46 | } 47 | 48 | foreach(explode(',', $filter) as $subFilter) { 49 | 50 | //validate filter 51 | $filterParams = explode(',', $subFilter); 52 | $subFilter = $this->_validateFilter($filterParams[0]); 53 | if (!$subFilter) { 54 | return $this; 55 | } 56 | 57 | list($from, $to) = $subFilter; 58 | 59 | $this->setInterval(array($from, $to)); 60 | 61 | $priorFilters = array(); 62 | for ($i = 1; $i < count($filterParams); ++$i) { 63 | $priorFilter = $this->_validateFilter($filterParams[$i]); 64 | if ($priorFilter) { 65 | $priorFilters[] = $priorFilter; 66 | } else { 67 | //not valid data 68 | $priorFilters = array(); 69 | break; 70 | } 71 | } 72 | if ($priorFilters) { 73 | $this->setPriorIntervals($priorFilters); 74 | } 75 | 76 | $this->_applyPriceRange(); 77 | $this->getLayer()->getState()->addFilter($this->_createItem( 78 | $this->_renderRangeLabel(empty($from) ? 0 : $from, $to), 79 | $filter 80 | )); 81 | } 82 | 83 | return $this; 84 | } 85 | } -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Model/CatalogSearch/Layer.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | class IntegerNet_Solr_Model_CatalogSearch_Layer extends Mage_CatalogSearch_Model_Layer 11 | { 12 | /** 13 | * Get current layer product collection 14 | * 15 | * @return Varien_Data_Collection 16 | */ 17 | public function getProductCollection() 18 | { 19 | if (!Mage::helper('integernet_solr')->module()->isActive()) { 20 | return parent::getProductCollection(); 21 | } 22 | 23 | if (isset($this->_productCollections[$this->getCurrentCategory()->getId()])) { 24 | $collection = $this->_productCollections[$this->getCurrentCategory()->getId()]; 25 | } else { 26 | $collection = Mage::getModel('integernet_solr/result_collection'); 27 | $this->_productCollections[$this->getCurrentCategory()->getId()] = $collection; 28 | } 29 | return $collection; 30 | } 31 | 32 | /** 33 | * Get collection of all filterable attributes for layer products set 34 | * 35 | * @return Mage_Catalog_Model_Resource_Product_Attribute_Collection 36 | */ 37 | public function getFilterableAttributes() 38 | { 39 | if (!Mage::helper('integernet_solr')->module()->isActive()) { 40 | return parent::getFilterableAttributes(); 41 | } 42 | 43 | /** @var $collection Mage_Catalog_Model_Resource_Product_Attribute_Collection */ 44 | $collection = Mage::getResourceModel('catalog/product_attribute_collection'); 45 | $collection 46 | ->setItemObjectClass('catalog/resource_eav_attribute') 47 | ->addStoreLabel(Mage::app()->getStore()->getId()) 48 | ->addIsFilterableInSearchFilter() 49 | ->setOrder('position', 'ASC'); 50 | $collection = $this->_prepareAttributeCollection($collection); 51 | $collection->load(); 52 | 53 | return $collection; 54 | } 55 | 56 | } -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Model/CatalogSearch/Layer/Filter/Attribute.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | class IntegerNet_Solr_Model_CatalogSearch_Layer_Filter_Attribute extends IntegerNet_Solr_Model_Catalog_Layer_Filter_Attribute 11 | { 12 | /** 13 | * Check whether specified attribute can be used in LN 14 | * 15 | * @param Mage_Catalog_Model_Resource_Eav_Attribute $attribute 16 | * @return bool 17 | */ 18 | protected function _getIsFilterableAttribute($attribute) 19 | { 20 | return $attribute->getIsFilterableInSearch(); 21 | } 22 | } -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Model/Eav/Backend/FilterableAttribute.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | class IntegerNet_Solr_Model_Eav_Backend_FilterableAttribute extends Mage_Eav_Model_Entity_Attribute_Backend_Abstract 11 | { 12 | /** 13 | * Before Attribute Save Process 14 | * 15 | * @param Varien_Object $object 16 | * @return Mage_Catalog_Model_Category_Attribute_Backend_Sortby 17 | */ 18 | public function beforeSave($object) { 19 | $attributeCode = $this->getAttribute()->getName(); 20 | if ($attributeCode == 'solr_remove_filters') { 21 | $data = $object->getData($attributeCode); 22 | if (!is_array($data)) { 23 | $data = array(); 24 | } 25 | $object->setData($attributeCode, join(',', $data)); 26 | } 27 | if (is_null($object->getData($attributeCode))) { 28 | $object->setData($attributeCode, false); 29 | } 30 | return $this; 31 | } 32 | 33 | public function afterLoad($object) { 34 | $attributeCode = $this->getAttribute()->getName(); 35 | if ($attributeCode == 'solr_remove_filters') { 36 | $data = $object->getData($attributeCode); 37 | if ($data) { 38 | $object->setData($attributeCode, explode(',', $data)); 39 | } 40 | } 41 | return $this; 42 | } 43 | } -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Model/Eav/Source/FilterPosition.php: -------------------------------------------------------------------------------- 1 | 11 | */ 12 | 13 | class IntegerNet_Solr_Model_Eav_Source_FilterPosition extends Mage_Eav_Model_Entity_Attribute_Source_Abstract 14 | { 15 | public function __construct() 16 | { 17 | IntegerNet_Solr_Helper_Autoloader::createAndRegister(); 18 | } 19 | 20 | /** 21 | * Options getter 22 | * 23 | * @return array 24 | */ 25 | public function getAllOptions() 26 | { 27 | $options = array(array( 28 | 'value' => CategoryConfig::FILTER_POSITION_DEFAULT, 29 | 'label' => Mage::helper('integernet_solr')->__('Default Value from Configuration'), 30 | )); 31 | 32 | foreach(Mage::getSingleton('integernet_solr/source_filterPosition')->toOptionArray() as $option) { 33 | $options[] = $option; 34 | } 35 | return $options; 36 | } 37 | 38 | /** 39 | * Retrieve option array 40 | * 41 | * @return array 42 | */ 43 | public function getOptionArray() 44 | { 45 | $_options = array(); 46 | foreach ($this->getAllOptions() as $option) { 47 | $_options[$option['value']] = $option['label']; 48 | } 49 | return $_options; 50 | } 51 | 52 | /** 53 | * Get a text for option value 54 | * 55 | * @param string|integer $value 56 | * @return string 57 | */ 58 | public function getOptionText($value) 59 | { 60 | $options = $this->getAllOptions(); 61 | foreach ($options as $option) { 62 | if ($option['value'] == $value) { 63 | return $option['label']; 64 | } 65 | } 66 | return false; 67 | } 68 | } -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Model/Eav/Source/FilterableAttribute.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | 11 | class IntegerNet_Solr_Model_Eav_Source_FilterableAttribute extends Mage_Eav_Model_Entity_Attribute_Source_Abstract 12 | { 13 | /** 14 | * Options getter 15 | * 16 | * @return array 17 | */ 18 | public function getAllOptions() 19 | { 20 | $options = array(array( 21 | 'value' => '', 22 | 'label' => '', 23 | )); 24 | $attributes = Mage::getModel('integernet_solr/bridge_factory')->getAttributeRepository() 25 | ->getFilterableInCatalogAttributes(Mage::app()->getStore()->getId()); 26 | 27 | foreach($attributes as $attribute) { /** @var Mage_Catalog_Model_Entity_Attribute $attribute */ 28 | $options[] = array( 29 | 'value' => $attribute->getAttributeCode(), 30 | 'label' => sprintf('%s [%s]', $attribute->getFrontendLabel(), $attribute->getAttributeCode()), 31 | ); 32 | } 33 | return $options; 34 | } 35 | 36 | /** 37 | * Retrieve option array 38 | * 39 | * @return array 40 | */ 41 | public function getOptionArray() 42 | { 43 | $_options = array(); 44 | foreach ($this->getAllOptions() as $option) { 45 | $_options[$option['value']] = $option['label']; 46 | } 47 | return $_options; 48 | } 49 | 50 | /** 51 | * Get a text for option value 52 | * 53 | * @param string|integer $value 54 | * @return string 55 | */ 56 | public function getOptionText($value) 57 | { 58 | $options = $this->getAllOptions(); 59 | foreach ($options as $option) { 60 | if ($option['value'] == $value) { 61 | return $option['label']; 62 | } 63 | } 64 | return false; 65 | } 66 | } -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Model/Resource/Catalog/Layer/Filter/Attribute.php: -------------------------------------------------------------------------------- 1 | 10 | */ 11 | class IntegerNet_Solr_Model_Resource_Catalog_Layer_Filter_Attribute extends Mage_Catalog_Model_Resource_Layer_Filter_Attribute 12 | { 13 | /** 14 | * @var IntegerNet_Solr_Model_Bridge_Factory 15 | */ 16 | protected $_bridgeFactory; 17 | 18 | protected function _construct() 19 | { 20 | if (!Mage::helper('integernet_solr')->module()->isActive()) { 21 | parent::_construct(); 22 | } 23 | 24 | if (!Mage::helper('integernet_solr')->page()->isSolrResultPage()) { 25 | parent::_construct(); 26 | } 27 | 28 | $this->_bridgeFactory = Mage::getModel('integernet_solr/bridge_factory'); 29 | } 30 | /** 31 | * Apply attribute filter to product collection 32 | * 33 | * @param Mage_Catalog_Model_Layer_Filter_Attribute $filter 34 | * @param int $value 35 | * @return Mage_Catalog_Model_Resource_Layer_Filter_Attribute 36 | */ 37 | public function applyFilterToCollection($filter, $value) 38 | { 39 | if (!Mage::helper('integernet_solr')->module()->isActive()) { 40 | return parent::applyFilterToCollection($filter, $value); 41 | } 42 | 43 | if (!Mage::helper('integernet_solr')->page()->isSolrResultPage()) { 44 | return parent::applyFilterToCollection($filter, $value); 45 | } 46 | 47 | $bridgeAttribute = $this->_bridgeFactory->createAttribute($filter->getAttributeModel()); 48 | 49 | $attributeFilters = Mage::registry('attribute_filters'); 50 | if (!is_array($attributeFilters)) { 51 | $attributeFilters = array(); 52 | } 53 | $attributeFilters[] = array( 54 | 'attribute' => $bridgeAttribute, 55 | 'value' => $value, 56 | ); 57 | Mage::unregister('attribute_filters'); 58 | Mage::register('attribute_filters', $attributeFilters); 59 | 60 | return $this; 61 | } 62 | 63 | /** 64 | * Retrieve array with products counts per attribute option 65 | * 66 | * @param Mage_Catalog_Model_Layer_Filter_Attribute $filter 67 | * @return array 68 | */ 69 | public function getCount($filter) 70 | { 71 | if (!Mage::helper('integernet_solr')->module()->isActive()) { 72 | return parent::getCount($filter); 73 | } 74 | 75 | if (!Mage::helper('integernet_solr')->page()->isSolrResultPage()) { 76 | return parent::getCount($filter); 77 | } 78 | 79 | /** @var $solrResult StdClass */ 80 | $solrResult = Mage::getSingleton('integernet_solr/result')->getSolrResult(); 81 | 82 | $attribute = $filter->getAttributeModel(); 83 | 84 | $count = array(); 85 | if (isset($solrResult->facet_counts->facet_fields->{$attribute->getAttributeCode() . '_facet'})) { 86 | foreach ((array)$solrResult->facet_counts->facet_fields->{$attribute->getAttributeCode() . '_facet'} as $key => $value) { 87 | $count[intval($key)] = $value; 88 | } 89 | return $count; 90 | } 91 | 92 | return array(); 93 | } 94 | } -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Model/Resource/Catalog/Product/Indexing/Collection.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | class IntegerNet_Solr_Model_Resource_Catalog_Product_Indexing_Collection extends Mage_Catalog_Model_Resource_Product_Collection 11 | { 12 | public function isEnabledFlat() 13 | { 14 | return false; 15 | } 16 | 17 | /** 18 | * Join Product Price Table 19 | * Join left by default in order to include products without price index entry 20 | * 21 | * @return IntegerNet_Solr_Model_Resource_Catalog_Product_Indexing_Collection 22 | */ 23 | protected function _productLimitationJoinPrice() 24 | { 25 | return $this->_productLimitationPrice(true); 26 | } 27 | } -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Model/Resource/Catalog/Product/Type/Bundle.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | class IntegerNet_Solr_Model_Resource_Catalog_Product_Type_Bundle extends Mage_Bundle_Model_Resource_Selection 11 | { 12 | /** 13 | * Retrieve Required children ids 14 | * Return grouped array, ex array( 15 | * group => array(ids) 16 | * ) 17 | * 18 | * @param null|int[] $parentIds 19 | * @return int[][] 20 | */ 21 | public function getChildrenIdsForMultipleParents($parentIds) 22 | { 23 | $childrenIds = array(); 24 | $adapter = $this->_getReadAdapter(); 25 | $select = $adapter->select() 26 | ->from( 27 | array('tbl_selection' => $this->getMainTable()), 28 | array('product_id', 'parent_product_id', 'option_id') 29 | ) 30 | ->join( 31 | array('e' => $this->getTable('catalog/product')), 32 | 'e.entity_id = tbl_selection.product_id AND e.required_options=0', 33 | array() 34 | ) 35 | ->join( 36 | array('tbl_option' => $this->getTable('bundle/option')), 37 | 'tbl_option.option_id = tbl_selection.option_id', 38 | array('required') 39 | ); 40 | if (!is_null($parentIds)) { 41 | $select->where('tbl_selection.parent_product_id IN (?)', $parentIds); 42 | } 43 | 44 | foreach ($this->_getReadAdapter()->fetchAll($select) as $row) { 45 | $childrenIds[$row['parent_product_id']][$row['product_id']] = $row['product_id']; 46 | } 47 | 48 | return $childrenIds; 49 | } 50 | } -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Model/Resource/Catalog/Product/Type/Configurable.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | class IntegerNet_Solr_Model_Resource_Catalog_Product_Type_Configurable extends Mage_Catalog_Model_Resource_Product_Type_Configurable 11 | { 12 | /** 13 | * Retrieve Required children ids 14 | * Return grouped array, ex array( 15 | * group => array(ids) 16 | * ) 17 | * 18 | * @param null|int[] $parentIds 19 | * @return int[][] 20 | */ 21 | public function getChildrenIdsForMultipleParents($parentIds) 22 | { 23 | $childrenIds = array(); 24 | $select = $this->_getReadAdapter()->select() 25 | ->from(array('l' => $this->getMainTable()), array('product_id', 'parent_id')) 26 | ->join( 27 | array('e' => $this->getTable('catalog/product')), 28 | 'e.entity_id = l.product_id AND e.required_options = 0', 29 | array() 30 | ); 31 | if (!is_null($parentIds)) { 32 | $select->where('parent_id IN (?)', $parentIds); 33 | } 34 | 35 | foreach ($this->_getReadAdapter()->fetchAll($select) as $row) { 36 | $childrenIds[$row['parent_id']][$row['product_id']] = $row['product_id']; 37 | } 38 | 39 | return $childrenIds; 40 | } 41 | } -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Model/Resource/Catalog/Product/Type/Grouped.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | class IntegerNet_Solr_Model_Resource_Catalog_Product_Type_Grouped extends Mage_Catalog_Model_Resource_Product_Link 11 | { 12 | /** 13 | * Retrieve Required children ids 14 | * Return grouped array, ex array( 15 | * group => array(ids) 16 | * ) 17 | * 18 | * @param null|int[] $parentIds 19 | * @param int $typeId 20 | * @return int[][] 21 | */ 22 | public function getChildrenIdsForMultipleParents($parentIds, $typeId = Mage_Catalog_Model_Product_Link::LINK_TYPE_GROUPED) 23 | { 24 | $adapter = $this->_getReadAdapter(); 25 | $childrenIds = array(); 26 | $bind = array( 27 | ':link_type_id' => (int)$typeId, 28 | ); 29 | $select = $adapter->select() 30 | ->from(array('l' => $this->getMainTable()), array('product_id', 'linked_product_id')) 31 | ->where('link_type_id = :link_type_id'); 32 | if (!is_null($parentIds)) { 33 | $bind[':product_ids'] = implode(',', $parentIds); 34 | $select->where('product_id IN (:product_ids)'); 35 | } 36 | 37 | $result = $adapter->fetchAll($select, $bind); 38 | foreach ($result as $row) { 39 | $childrenIds[$row['product_id']][$row['linked_product_id']] = $row['linked_product_id']; 40 | } 41 | 42 | return $childrenIds; 43 | } 44 | } -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Model/Resource/Db.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | class IntegerNet_Solr_Model_Resource_Db 11 | { 12 | /** 13 | * Close all open MySQL connections (will be automatically reopened by Magento if used) 14 | * 15 | * Can be called during indexing to prevent wait timeout 16 | */ 17 | public function disconnectMysql() 18 | { 19 | if (!Mage::getStoreConfigFlag('integernet_solr/indexing/disconnect_mysql_connections')) { 20 | return; 21 | } 22 | 23 | /** @var $coreResource Mage_Core_Model_Resource */ 24 | $coreResource = Mage::getSingleton('core/resource'); 25 | if (!method_exists($coreResource, 'getConnections')) { 26 | return; // method only exists from Magento CE 1.9.1 / EE 1.14.1 27 | } 28 | 29 | /** @var Zend_Db_Adapter_Abstract $connection */ 30 | foreach ($coreResource->getConnections() as $name => $connection) { 31 | if ($connection instanceof Zend_Db_Adapter_Abstract) { 32 | if ($this->isTransactionOpen($connection)) { 33 | continue; 34 | } 35 | $connection->closeConnection(); 36 | } 37 | } 38 | 39 | // connections (adapter objects) must be fully reinitialized, otherwise initStatements are not executed 40 | Mage::unregister('_singleton/core/resource'); 41 | } 42 | 43 | /** 44 | * Returns true if the given connection has open transactions 45 | * 46 | * @param Zend_Db_Adapter_Abstract $connection 47 | * @return bool 48 | */ 49 | private function isTransactionOpen(Zend_Db_Adapter_Abstract $connection) 50 | { 51 | return $connection instanceof Magento_Db_Adapter_Pdo_Mysql && $connection->isTransaction(); 52 | } 53 | } -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Model/Source/AutosuggestMethod.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | 11 | class IntegerNet_Solr_Model_Source_AutosuggestMethod 12 | { 13 | const AUTOSUGGEST_METHOD_MAGENTO_CONTROLLER = 0; 14 | const AUTOSUGGEST_METHOD_PHP = 1; 15 | const AUTOSUGGEST_METHOD_MAGENTO_DIRECT = 2; 16 | 17 | /** 18 | * Options getter 19 | * 20 | * @return array 21 | */ 22 | public function toOptionArray() 23 | { 24 | return array( 25 | array( 26 | 'value' => self::AUTOSUGGEST_METHOD_MAGENTO_CONTROLLER, 27 | 'label' => Mage::helper('integernet_solr')->__('Magento Controller') 28 | ), 29 | array( 30 | 'value' => self::AUTOSUGGEST_METHOD_MAGENTO_DIRECT, 31 | 'label' => Mage::helper('integernet_solr')->__('Magento with separate PHP file') 32 | ), 33 | array( 34 | 'value' => self::AUTOSUGGEST_METHOD_PHP, 35 | 'label' => Mage::helper('integernet_solr')->__('PHP without Magento instantiation') 36 | ), 37 | ); 38 | } 39 | } -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Model/Source/CategoryLinkType.php: -------------------------------------------------------------------------------- 1 | 11 | */ 12 | 13 | class IntegerNet_Solr_Model_Source_CategoryLinkType 14 | { 15 | public function __construct() 16 | { 17 | IntegerNet_Solr_Helper_Autoloader::createAndRegister(); 18 | } 19 | 20 | /** 21 | * Options getter 22 | * 23 | * @return array 24 | */ 25 | public function toOptionArray() 26 | { 27 | return array( 28 | array( 29 | 'value' => AutosuggestConfig::CATEGORY_LINK_TYPE_FILTER, 30 | 'label' => Mage::helper('integernet_solr')->__('Search result page with set category filter') 31 | ), 32 | array( 33 | 'value' => AutosuggestConfig::CATEGORY_LINK_TYPE_DIRECT, 34 | 'label' => Mage::helper('integernet_solr')->__('Category page') 35 | ), 36 | ); 37 | } 38 | } -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Model/Source/FilterPosition.php: -------------------------------------------------------------------------------- 1 | 11 | */ 12 | 13 | class IntegerNet_Solr_Model_Source_FilterPosition 14 | { 15 | public function __construct() 16 | { 17 | IntegerNet_Solr_Helper_Autoloader::createAndRegister(); 18 | } 19 | 20 | /** 21 | * Options getter 22 | * 23 | * @return array 24 | */ 25 | public function toOptionArray() 26 | { 27 | return array( 28 | array( 29 | 'value' => CategoryConfig::FILTER_POSITION_LEFT, 30 | 'label' => Mage::helper('integernet_solr')->__('Left column (Magento default)') 31 | ), 32 | array( 33 | 'value' => CategoryConfig::FILTER_POSITION_TOP, 34 | 'label' => Mage::helper('integernet_solr')->__('Content column (above products)') 35 | ), 36 | ); 37 | } 38 | } -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Model/Source/HttpTransportMethod.php: -------------------------------------------------------------------------------- 1 | 11 | */ 12 | 13 | class IntegerNet_Solr_Model_Source_HttpTransportMethod 14 | { 15 | public function __construct() 16 | { 17 | IntegerNet_Solr_Helper_Autoloader::createAndRegister(); 18 | } 19 | 20 | /** 21 | * Options getter 22 | * 23 | * @return array 24 | */ 25 | public function toOptionArray() 26 | { 27 | return array( 28 | array( 29 | 'value' => HttpTransportMethod::HTTP_TRANSPORT_METHOD_FILEGETCONTENTS, 30 | 'label' => Mage::helper('integernet_solr')->__('file_get_contents'), 31 | ), 32 | array( 33 | 'value' => HttpTransportMethod::HTTP_TRANSPORT_METHOD_CURL, 34 | 'label' => Mage::helper('integernet_solr')->__('cURL'), 35 | ), 36 | ); 37 | } 38 | } -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Model/Source/LoaderStyle.php: -------------------------------------------------------------------------------- 1 | 10 | */ 11 | 12 | class IntegerNet_Solr_Model_Source_LoaderStyle 13 | { 14 | /** 15 | * Options getter 16 | * 17 | * @return array 18 | */ 19 | public function toOptionArray() 20 | { 21 | return array( 22 | array( 23 | 'value' => 'solr-system', 24 | 'label' => 'Solr-System', 25 | ), 26 | array( 27 | 'value' => 'modern', 28 | 'label' => 'Modern/RWD', 29 | ), 30 | ); 31 | } 32 | } -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Model/Source/SearchOperator.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | 11 | class IntegerNet_Solr_Model_Source_SearchOperator 12 | { 13 | const SEARCH_OPERATOR_AND = 'AND'; 14 | const SEARCH_OPERATOR_OR = 'OR'; 15 | 16 | /** 17 | * Options getter 18 | * 19 | * @return array 20 | */ 21 | public function toOptionArray() 22 | { 23 | return array( 24 | array( 25 | 'value' => self::SEARCH_OPERATOR_AND, 26 | 'label' => Mage::helper('integernet_solr')->__('AND') 27 | ), 28 | array( 29 | 'value' => self::SEARCH_OPERATOR_OR, 30 | 'label' => Mage::helper('integernet_solr')->__('OR') 31 | ), 32 | ); 33 | } 34 | } -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Model/Source/VarcharCategoryAttribute.php: -------------------------------------------------------------------------------- 1 | 10 | */ 11 | class IntegerNet_Solr_Model_Source_VarcharCategoryAttribute 12 | { 13 | /** 14 | * Options getter 15 | * 16 | * @return array 17 | */ 18 | public function toOptionArray() 19 | { 20 | $options = array(array( 21 | 'value' => '', 22 | 'label' => '', 23 | )); 24 | 25 | /** @var $attributes Mage_Catalog_Model_Resource_Category_Attribute_Collection */ 26 | $attributes = Mage::getResourceModel('catalog/category_attribute_collection') 27 | ->addFieldToFilter('backend_type', array('in' => array('static', 'varchar'))) 28 | ->addFieldToFilter('frontend_input', 'text') 29 | ->addFieldToFilter('attribute_code', array('nin' => array( 30 | 'url_path', 31 | 'children_count', 32 | 'level', 33 | 'path', 34 | 'position', 35 | ))) 36 | ->setOrder('frontend_label', Mage_Eav_Model_Entity_Collection_Abstract::SORT_ORDER_ASC); 37 | 38 | foreach ($attributes as $attribute) { 39 | /** @var Mage_Catalog_Model_Entity_Attribute $attribute */ 40 | $options[] = array( 41 | 'value' => $attribute->getAttributeCode(), 42 | 'label' => sprintf('%s [%s]', $attribute->getFrontendLabel(), $attribute->getAttributeCode()), 43 | ); 44 | } 45 | return $options; 46 | } 47 | } -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Model/Source/VarcharProductAttribute.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | 11 | class IntegerNet_Solr_Model_Source_VarcharProductAttribute 12 | { 13 | /** 14 | * Options getter 15 | * 16 | * @return array 17 | */ 18 | public function toOptionArray() 19 | { 20 | $options = array(array( 21 | 'value' => '', 22 | 'label' => '', 23 | )); 24 | $attributes = Mage::getModel('integernet_solr/bridge_factory')->getAttributeRepository()->getVarcharProductAttributes(); 25 | 26 | foreach($attributes as $attribute) { /** @var Mage_Catalog_Model_Entity_Attribute $attribute */ 27 | $options[] = array( 28 | 'value' => $attribute->getAttributeCode(), 29 | 'label' => sprintf('%s [%s]', $attribute->getFrontendLabel(), $attribute->getAttributeCode()), 30 | ); 31 | } 32 | return $options; 33 | } 34 | } -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Test/Config/Config.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | class IntegerNet_Solr_Test_Config_Config extends EcomDev_PHPUnit_Test_Case_Config 11 | { 12 | /** 13 | * @test 14 | */ 15 | public function globalConfig() 16 | { 17 | $this->assertModuleVersionGreaterThanOrEquals('0.1.0'); 18 | $this->assertModuleCodePool('community'); 19 | } 20 | 21 | /** 22 | * @test 23 | */ 24 | public function modelConfig() 25 | { 26 | $this->assertModelAlias('integernet_solr/indexer', 'IntegerNet_Solr_Model_Indexer'); 27 | $this->assertModelAlias('integernet_solr/resource_indexer', 'IntegerNet_Solr_Model_Resource_Indexer'); 28 | } 29 | 30 | /** 31 | * @test 32 | */ 33 | public function helperConfig() 34 | { 35 | $this->assertHelperAlias('integernet_solr', 'IntegerNet_Solr_Helper_Data'); 36 | } 37 | 38 | /** 39 | * @test 40 | */ 41 | public function translationConfig() 42 | { 43 | $this->assertConfigNodeValue('adminhtml/translate/modules/integernet_solr/files/default', 'IntegerNet_Solr.csv'); 44 | } 45 | 46 | /** 47 | * @test 48 | */ 49 | public function indexerConfig() 50 | { 51 | $this->assertConfigNodeValue('global/index/indexer/integernet_solr/model', 'integernet_solr/indexer'); 52 | } 53 | 54 | /** 55 | * @test 56 | */ 57 | public function storeConfigShouldContainBaseUrl() 58 | { 59 | $config = Mage::getModel('integernet_solr/config_store', 1); 60 | $this->assertEquals(Mage::app()->getStore(1)->getBaseUrl(), $config->getStoreConfig()->getBaseUrl()); 61 | } 62 | 63 | } -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Test/Controller/Abstract.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | 11 | abstract class IntegerNet_Solr_Test_Controller_Abstract extends EcomDev_PHPUnit_Test_Case_Controller 12 | { 13 | public static function setUpBeforeClass() 14 | { 15 | Mage::register('isSecureArea', true, true); 16 | } 17 | public static function tearDownAfterClass() 18 | { 19 | Mage::unregister('isSecureArea'); 20 | } 21 | protected function setUp() 22 | { 23 | parent::setUp(); 24 | $this->app()->getStore(0)->setConfig('integernet_solr/general/install_date', time()-1); 25 | $installer = new Mage_Catalog_Model_Resource_Setup('catalog_setup'); 26 | $installer->updateAttribute('catalog_product', 'manufacturer', array( 27 | 'is_filterable_in_search' => '1' 28 | )); 29 | } 30 | protected function tearDown() 31 | { 32 | parent::tearDown(); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Test/Controller/Configuration.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | /** 11 | * @loadFixture registry 12 | * @loadFixture config 13 | */ 14 | class IntegerNet_Solr_Test_Controller_Configuration extends IntegerNet_Solr_Test_Controller_Abstract 15 | { 16 | /** 17 | * @test 18 | */ 19 | public function shouldShowStatusBlock() 20 | { 21 | $this->adminSession(); 22 | $this->dispatch('adminhtml/system_config/edit', ['section' => 'integernet_solr']); 23 | $this->assertRequestRoute('adminhtml/system_config/edit'); 24 | $this->assertLayoutBlockRendered('integernet_solr_config_status'); 25 | 26 | $expectedMessages = [ 27 | 'Solr version:', 28 | 'Solr Module is activated.', 29 | 'Solr server configuration is complete.', 30 | 'Connection to Solr server established successfully.', 31 | 'Test search request issued successfully.', 32 | ]; 33 | foreach ($expectedMessages as $message) { 34 | /* 35 | * would use assertLayoutBlockRenderedContent() but it evaluates the constraint and discards the result 36 | * without actually failing. 37 | */ 38 | $this->assertResponseBodyContains($message); 39 | } 40 | } 41 | 42 | /** 43 | * @test 44 | * @dataProvider dataProvider 45 | * @dataProviderFile invalid-config.yaml 46 | */ 47 | public function invalidConfigurationShouldShowError(array $config) 48 | { 49 | $this->markTestSkipped('Currently swap configuration is checked only on reindex'); 50 | } 51 | } -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Test/Controller/Search.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | 11 | /** 12 | * @loadFixture registry 13 | * @loadFixture config 14 | * @todo test with HTML from Solr turned on and off 15 | */ 16 | class IntegerNet_Solr_Test_Controller_Search extends IntegerNet_Solr_Test_Controller_Abstract 17 | { 18 | protected function setUp() 19 | { 20 | parent::setUp(); 21 | Mage::getModel('integernet_solr/indexer')->reindexAll(); 22 | } 23 | 24 | /** 25 | * @test 26 | * @loadFixture catalog 27 | */ 28 | public function shouldShowSearchResult() 29 | { 30 | $this->dispatch('catalogsearch/result/index', ['q' => 'wells']); 31 | $this->assertResponseBodyContains('Search results for \'wells\''); 32 | $this->assertResponseBodyContains('2 Item(s)'); 33 | $this->assertResponseBodyContains('Wells, H.G. 1898. The Time Machine'); 34 | $this->assertResponseBodyContains('Herbert George Wells: The War of the Worlds'); 35 | $this->assertResponseBodyNotContains('Jack Williamson: The Humanoids: A Novel'); 36 | } 37 | 38 | /** 39 | * @test 40 | * @loadFixture catalog 41 | */ 42 | public function shouldShowChildrenSearchResult() 43 | { 44 | $this->dispatch('catalogsearch/result/index', ['q' => 'blue']); 45 | $this->assertResponseBodyContains('Search results for \'blue\''); 46 | $this->assertResponseBodyContains('1 Item(s)'); 47 | $this->assertResponseBodyContains('Product One'); 48 | } 49 | 50 | /** 51 | * @test 52 | * @loadFixture catalog 53 | */ 54 | public function shouldFilterSearchResult() 55 | { 56 | $this->dispatch('catalogsearch/result/index', ['q' => 'wells', 'cat' => '222']); 57 | $this->assertResponseBodyContains('Search results for \'wells\''); 58 | $this->assertResponseBodyContains('1 Item(s)'); 59 | $this->assertResponseBodyContains('Wells, H.G. 1898. The Time Machine'); 60 | $this->assertResponseBodyNotContains('Herbert George Wells: The War of the Worlds'); 61 | $this->assertResponseBodyNotContains('Jack Williamson: The Humanoids: A Novel'); 62 | } 63 | 64 | /** 65 | * @test 66 | * @loadFixture bigcatalog 67 | */ 68 | public function shouldShowSearchResultWithPagination() 69 | { 70 | $this->dispatch('catalogsearch/result/index', ['_query' => ['p' => '2', 'q' => 'clone']]); 71 | $this->assertResponseBodyContains('Search results for \'clone\''); 72 | $this->assertResponseBodyContains('13-24 of'); 73 | $this->assertResponseBodyContains('Clone 13'); 74 | $this->assertResponseBodyContains('Clone 24'); 75 | } 76 | 77 | } -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Test/Helper/Factory.php: -------------------------------------------------------------------------------- 1 | 15 | */ 16 | class IntegerNet_Solr_Test_Helper_Factory extends EcomDev_PHPUnit_Test_Case 17 | { 18 | /** 19 | * @test 20 | */ 21 | public function shouldCreateSolrResourceWithStoreConfiguration() 22 | { 23 | $resource = Mage::helper('integernet_solr')->factory()->getSolrResource(); 24 | $this->assertInstanceOf(ResourceFacade::class, $resource); 25 | $storeConfigs = [ 26 | $resource->getStoreConfig(1), // default store view 27 | $resource->getStoreConfig(0), // admin store view 28 | $resource->getStoreConfig(null) // admin store view 29 | ]; 30 | foreach ($storeConfigs as $storeConfig) { 31 | $this->assertInstanceOf(Config::class, $storeConfig); 32 | $this->assertInstanceOf(IndexingConfig::class, $storeConfig->getIndexingConfig()); 33 | $this->assertInstanceOf(ServerConfig::class, $storeConfig->getServerConfig()); 34 | } 35 | 36 | $this->setExpectedException(Exception::class, "Store with ID -1 not found."); 37 | $resource->getStoreConfig(-1); 38 | } 39 | 40 | } -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Test/Model/Indexer/Product.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | use IntegerNet\Solr\Exception; 11 | use IntegerNet\Solr\Resource\ResourceFacade; 12 | 13 | /** 14 | * @loadFixture registry 15 | * @loadFixture config 16 | */ 17 | class IntegerNet_Solr_Test_Model_Indexer_Product extends IntegerNet_Solr_Test_Controller_Abstract 18 | { 19 | /** 20 | * @param array $config 21 | * @test 22 | * @dataProvider dataProvider 23 | * @dataProviderFile invalid-config.yaml 24 | * @expectedException Exception 25 | * @expectedExceptionMessage Configuration Error 26 | */ 27 | public function invalidSwapConfigurationShouldThrowException(array $config) 28 | { 29 | foreach (Mage::app()->getStores(true) as $store) { 30 | $store->resetConfig(); 31 | } 32 | foreach ($config as $path => $value) { 33 | Mage::getConfig()->setNode($path, $value); 34 | } 35 | Mage::helper('integernet_solr')->factory()->getProductIndexer()->reindex(); 36 | } 37 | 38 | /** 39 | * @test 40 | * @loadFixture catalog 41 | */ 42 | public function saveProductShouldUpdateSolrIndex() 43 | { 44 | $this->setUpFreshIndex(); 45 | 46 | $this->assertCount(0, $this->searchInStore(1, 'SUPERDUPER')->documents()); 47 | $productId = 21001; 48 | $this->setCurrentStore(0); 49 | $product = Mage::getModel('catalog/product')->load($productId); 50 | $product->setData('name', 'SUPERDUPER'); 51 | $product->save(); 52 | $searchResponse = $this->searchInStore(1, 'SUPERDUPER'); 53 | $this->assertCount(1, $searchResponse->documents()); 54 | } 55 | 56 | /** 57 | * @param $queryText 58 | * @return \IntegerNet\Solr\Resource\SolrResponse 59 | */ 60 | public function searchInStore($storeId, $queryText) 61 | { 62 | $queryStub = $this->getMockBuilder(\IntegerNet\Solr\Implementor\HasUserQuery::class) 63 | ->getMockForAbstractClass(); 64 | $queryStub->method('getUserQueryText')->willReturn($queryText); 65 | $factory = Mage::helper('integernet_solr/factory'); 66 | $applicationContext = $factory->getApplicationContext(); 67 | $applicationContext->setFuzzyConfig($factory->getCurrentStoreConfig()->getFuzzySearchConfig()); 68 | $applicationContext->setQuery($queryStub); 69 | $applicationContext->setPagination(new \IntegerNet\Solr\Request\SinglePage(2)); 70 | $searchRequestFactory = new \IntegerNet\Solr\Request\SearchRequestFactory( 71 | $applicationContext, 72 | $factory->getSolrResource(), 73 | $storeId 74 | ); 75 | return $searchRequestFactory->createRequest()->doRequest(); 76 | } 77 | 78 | private function setUpFreshIndex() 79 | { 80 | Mage::getModel('integernet_solr/indexer')->reindexAll(); 81 | } 82 | } -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Test/Model/ProductIterator.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | use IntegerNet\Solr\Indexer\Data\ProductIdChunks; 11 | 12 | /** 13 | * @loadFixture registry 14 | * @loadFixture config 15 | */ 16 | class IntegerNet_Solr_Test_Model_ProductIterator extends EcomDev_PHPUnit_Test_Case_Controller 17 | { 18 | /** 19 | * @test 20 | * @loadFixture catalog 21 | * @dataProvider dataIteratorParameters 22 | */ 23 | public function shouldLazyloadCollections($idFilter, $pageSize, $expectedProductIds, $expectedInnerIteratorCount) 24 | { 25 | // Magento needs a customer session to work with product collections :-/ 26 | // and replacing it with a mock causes side effects with other tests :-( 27 | // these lines above accidentally have the same amount of characters :-) 28 | $this->customerSession(0); 29 | 30 | $productRepository = new IntegerNet_Solr_Model_Bridge_ProductRepository(); 31 | 32 | $iterator = $productRepository->getProductsInChunks(1, 33 | ProductIdChunks::withAssociationsTogether( 34 | $idFilter ? $idFilter : $productRepository->getAllProductIds(), 35 | [], $pageSize 36 | ) 37 | ); 38 | $actualProductIds = []; 39 | $guard = 0; 40 | $callbackMock = $this->getMockBuilder(\stdClass::class)->setMethods(['__invoke'])->getMock(); 41 | /*$callbackMock->expects($this->exactly($expectedInnerIteratorCount)) 42 | ->method('__invoke');*/ 43 | $iterator->setPageCallback($callbackMock); 44 | foreach ($iterator as $product) 45 | { 46 | if (!in_array(intval($product->getId()), $actualProductIds)) { 47 | $actualProductIds[]= intval($product->getId()); 48 | } 49 | if (++$guard > 2 * count($expectedProductIds)) { 50 | $this->fail('Too many iterations. Collected product ids: ' . join(',', $actualProductIds)); 51 | break; 52 | } 53 | } 54 | $this->assertEquals($expectedProductIds, array_unique($actualProductIds), 'product ids', 0.0, 10, false, true); 55 | $this->assertEventDispatchedExactly('integernet_solr_product_collection_load_after', $expectedInnerIteratorCount); 56 | } 57 | 58 | /** 59 | * Data provider 60 | * 61 | * @return array 62 | */ 63 | public static function dataIteratorParameters() 64 | { 65 | return [ 66 | 'no_filter_pagesize_1' => [null, 1, [1, 2, 3, 21001, 22101, 22111, 22201], 7], 67 | 'no_filter_pagesize_3' => [null, 3, [1, 2, 3, 21001, 22101, 22111, 22201], 3], 68 | 'no_filter_pagesize_6' => [null, 6, [1, 2, 3, 21001, 22101, 22111, 22201], 2], 69 | 'no_filter_pagesize_7' => [null, 7, [1, 2, 3, 21001, 22101, 22111, 22201], 1], 70 | 'no_filter_pagesize_8' => [null, 8, [1, 2, 3, 21001, 22101, 22111, 22201], 1], 71 | 'filter_pagesize_1' => [[21000, 21001, 22101], 1, [21001, 22101], 3], 72 | ]; 73 | } 74 | } -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Test/Model/Resource/Db.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | 11 | /** 12 | * @loadFixture registry 13 | * @loadFixture config 14 | * @doNotIndexAll 15 | */ 16 | class IntegerNet_Solr_Test_Model_Resource_Db extends EcomDev_PHPUnit_Test_Case 17 | { 18 | public function testDisconnectUnsetsConnection() 19 | { 20 | Mage::getResourceModel('integernet_solr/db')->disconnectMysql(); 21 | $this->assertEquals( 22 | [], 23 | Mage::getSingleton('core/resource')->getConnections() 24 | ); 25 | } 26 | } -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Test/README.md: -------------------------------------------------------------------------------- 1 | # Integration Test Suite 2 | 3 | The Magento 1.x integration test suite requires a running Solr instance at `localhost:8983/solr/` with cores `core0`, `core1` and `core2` 4 | 5 | If your Solr configuration differs, change it in `fixtures/config.yaml` 6 | 7 | ## Run Tests: 8 | 9 | phpunit --group IntegerNet_Solr -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Test/bootstrap.php: -------------------------------------------------------------------------------- 1 | 12 | */ 13 | include 'IntegerNet/Solr/Helper/Autoloader.php'; 14 | IntegerNet_Solr_Helper_Autoloader::createAndRegister(); -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Test/fixtures/config.yaml: -------------------------------------------------------------------------------- 1 | scope: 2 | store: 3 | - store_id: 2 4 | website_id: 1 5 | group_id: 1 6 | code: store2 7 | name: Alternate Store View 8 | is_active: 1 9 | config: 10 | default/dev/template/allow_symlink: 1 11 | default/integernet_solr/general/is_active: 1 12 | default/integernet_solr/general/log: 1 13 | default/integernet_solr/server/host: localhost 14 | default/integernet_solr/server/port: 8983 15 | default/integernet_solr/server/path: /solr/ 16 | default/integernet_solr/server/core: core0 17 | default/integernet_solr/server/http_method: curl 18 | default/integernet_solr/server/use_https: 0 19 | default/integernet_solr/server/use_http_basic_auth: 0 20 | default/integernet_solr/indexing/disconnect_mysql_connections: 1 21 | default/integernet_solr/connection_check/is_active: 1 22 | default/integernet_solr/fuzzy/is_active: 0 23 | default/integernet_solr/category/is_active: 1 24 | default/integernet_solr/category/is_indexer_active: 0 25 | default/integernet_solr/autosuggest/max_number_category_suggestions: 8 26 | default/integernet_solr/autosuggest/attribute_filter_suggestions: 'a:1:{s:18:"_1453996401595_595";a:3:{s:14:"attribute_code";s:12:"manufacturer";s:22:"max_number_suggestions";s:1:"2";s:7:"sorting";s:0:"";}}' 27 | stores/store2/web/secure/base_url: http://store2.magento.local/ 28 | stores/store2/web/unsecure/base_url: http://store2.magento.local/ -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Test/fixtures/registry.yaml: -------------------------------------------------------------------------------- 1 | registry: 2 | registry: 3 | - current_category 4 | - current_entity_key 5 | helper: 6 | - catalogsearch 7 | - integernet_solr/factory 8 | - integernet_solr/log 9 | singleton: 10 | - eav/config 11 | - core/app_emulation 12 | - core/factory 13 | - catalog/layer 14 | - core/session 15 | - customer/session 16 | - catalog/session 17 | - customer/session 18 | - reports/session 19 | - index/indexer 20 | - integernet_solr/observer 21 | - integernet_solr/bridge_attributeRepository 22 | - integernet_solr/bridge_categoryRepository 23 | - integernet_solr/result 24 | - integernet_solr/result_collection 25 | resource: 26 | - catalog/category_indexer_product -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/Test/providers/invalid-config.yaml: -------------------------------------------------------------------------------- 1 | same-core-swapped-not-in-all-stores: 2 | config: 3 | stores/default/integernet_solr/general/is_active: 1 4 | stores/default/integernet_solr/indexing/swap_cores: 1 5 | stores/default/integernet_solr/indexing/swap_core: core1 6 | stores/store2/integernet_solr/general/is_active: 1 7 | stores/store2/integernet_solr/indexing/swap_cores: 0 8 | same-core-swapped-with-different-cores: 9 | config: 10 | stores/default/integernet_solr/general/is_active: 1 11 | stores/default/integernet_solr/indexing/swap_cores: 1 12 | stores/default/integernet_solr/indexing/swap_core: core1 13 | stores/store2/integernet_solr/general/is_active: 1 14 | stores/store2/integernet_solr/indexing/swap_cores: 1 15 | stores/store2/integernet_solr/indexing/swap_core: core2 16 | -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/controllers/Frontend/CategoryController.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | require_once('Mage' . DS . 'Catalog' . DS . 'controllers' . DS . 'CategoryController.php'); 11 | class IntegerNet_Solr_Frontend_CategoryController extends Mage_Catalog_CategoryController 12 | { 13 | /** 14 | * Category view action 15 | */ 16 | public function viewAction() 17 | { 18 | if ($category = $this->_initCatagory()) { 19 | 20 | $update = $this->getLayout()->getUpdate(); 21 | $update->addHandle('default'); 22 | 23 | if (!$category->hasChildren()) { 24 | $update->addHandle('catalog_category_layered_nochildren'); 25 | } 26 | 27 | $this->addActionLayoutHandles(); 28 | $update->addHandle($category->getLayoutUpdateHandle()); 29 | $update->addHandle('CATEGORY_' . $category->getId()); 30 | $this->loadLayoutUpdates(); 31 | 32 | $this->generateLayoutXml()->generateLayoutBlocks(); 33 | 34 | if ($root = $this->getLayout()->getBlock('root')) { 35 | $root->addBodyClass('categorypath-' . $category->getUrlPath()) 36 | ->addBodyClass('category-' . $category->getUrlKey()); 37 | $root->setTemplate('integernet/solr/ajax/json.phtml'); 38 | } 39 | 40 | $this->renderLayout(); 41 | } 42 | elseif (!$this->getResponse()->isRedirect()) { 43 | $this->_forward('noRoute'); 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/controllers/Frontend/ResultController.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | require_once('Mage' . DS . 'CatalogSearch' . DS . 'controllers' . DS . 'ResultController.php'); 11 | class IntegerNet_Solr_Frontend_ResultController extends Mage_CatalogSearch_ResultController 12 | { 13 | } -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/data/integernet_solr_setup/data-upgrade-0.2.0-0.3.0.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | 11 | /** @var Mage_Catalog_Model_Resource_Setup $installer */ 12 | $installer = $this; 13 | 14 | $installer->startSetup(); 15 | 16 | /** @var $attributes Mage_Catalog_Model_Resource_Product_Attribute_Collection */ 17 | $attributes = Mage::getResourceModel('catalog/product_attribute_collection') 18 | ->addFieldToFilter('attribute_code', array('in' => array('name', 'sku', 'manufacturer', 'brand'))); 19 | 20 | foreach($attributes as $attribute) { 21 | switch ($attribute->getAttributeCode()) { 22 | case 'name': 23 | case 'sku': 24 | $attribute->setSolrBoost(5)->save(); 25 | break; 26 | 27 | default: 28 | $attribute->setSolrBoost(2)->save(); 29 | } 30 | } 31 | 32 | $installer->endSetup(); -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/data/integernet_solr_setup/data-upgrade-1.3.0-1.4.0.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | 11 | /** @var Mage_Catalog_Model_Resource_Setup $installer */ 12 | $installer = $this; 13 | 14 | $installer->startSetup(); 15 | 16 | Mage::getModel('index/process') 17 | ->load('integernet_solr', 'indexer_code') 18 | ->setStatus(Mage_Index_Model_Process::STATUS_REQUIRE_REINDEX) 19 | ->save(); 20 | 21 | $installer->endSetup(); -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/etc/adminhtml.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | Solr 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/sql/integernet_solr_setup/install-1.5.0.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | 11 | /** @var Mage_Catalog_Model_Resource_Setup $installer */ 12 | $installer = $this; 13 | 14 | $installer->startSetup(); 15 | 16 | $installer->addAttribute('catalog_category', 'solr_exclude', array( 17 | 'type' => 'int', 18 | 'input' => 'select', 19 | 'source' => 'eav/entity_attribute_source_boolean', 20 | 'label' => Mage::helper('integernet_solr')->__('Exclude this Category from Solr Index'), 21 | 'note' => Mage::helper('integernet_solr')->__('Exclude only Categories, not included Products'), 22 | 'required' => 0, 23 | 'user_defined' => 0, 24 | 'group' => 'Solr', 25 | 'global' => 0, 26 | 'visible' => 1, 27 | )); 28 | 29 | $installer->addAttribute('catalog_category', 'solr_exclude_children', array( 30 | 'type' => 'int', 31 | 'input' => 'select', 32 | 'source' => 'eav/entity_attribute_source_boolean', 33 | 'label' => Mage::helper('integernet_solr')->__('Exclude Child Categories from Solr Index'), 34 | 'note' => Mage::helper('integernet_solr')->__('Exclude only Categories, not included Products'), 35 | 'required' => 0, 36 | 'user_defined' => 0, 37 | 'group' => 'Solr', 38 | 'global' => 0, 39 | 'visible' => 1, 40 | )); 41 | 42 | $installer->addAttribute('catalog_category', 'solr_remove_filters', array( 43 | 'type' => 'text', 44 | 'input' => 'multiselect', 45 | 'source' => 'integernet_solr/eav_source_filterableAttribute', 46 | 'backend' => 'integernet_solr/eav_backend_filterableAttribute', 47 | 'label' => Mage::helper('integernet_solr')->__('Remove Filters'), 48 | 'note' => Mage::helper('integernet_solr')->__('Hold the CTRL key to select multiple filters'), 49 | 'required' => 0, 50 | 'user_defined' => 0, 51 | 'group' => 'Solr', 52 | 'global' => 0, 53 | 'visible' => 1, 54 | )); 55 | 56 | $installer->addAttribute('catalog_product', 'solr_boost', array( 57 | 'type' => 'decimal', 58 | 'input' => 'text', 59 | 'label' => Mage::helper('integernet_solr')->__('Solr Priority'), 60 | 'frontend_class' => 'validate-number', 61 | 'required' => 0, 62 | 'user_defined' => 1, 63 | 'default' => 1, 64 | 'unique' => 0, 65 | 'note' => Mage::helper('integernet_solr')->__('1 is default, use higher numbers for higher priority.'), 66 | 'group' => 'Solr', 67 | 'global' => 0, 68 | 'visible' => 1, 69 | )); 70 | 71 | $installer->addAttribute('catalog_product', 'solr_exclude', array( 72 | 'type' => 'int', 73 | 'input' => 'select', 74 | 'source' => 'eav/entity_attribute_source_boolean', 75 | 'label' => Mage::helper('integernet_solr')->__('Exclude this Product from Solr Index'), 76 | 'required' => 0, 77 | 'user_defined' => 0, 78 | 'group' => 'Solr', 79 | 'global' => 0, 80 | 'visible' => 1, 81 | 'default' => 0, 82 | 'unique' => 0, 83 | )); 84 | 85 | $installer->getConnection()->addColumn($installer->getTable('catalog/eav_attribute'), 'solr_boost', 'float( 12,4 ) UNSIGNED NOT NULL DEFAULT 1'); 86 | 87 | $installer->setConfigData('integernet_solr/general/install_date', time()); 88 | 89 | $installer->endSetup(); -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/sql/integernet_solr_setup/upgrade-1.4.9-1.5.0.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | 11 | /** @var Mage_Catalog_Model_Resource_Setup $installer */ 12 | $installer = $this; 13 | 14 | $installer->startSetup(); 15 | 16 | $autoloader = new IntegerNet_Solr_Helper_Autoloader(); 17 | $autoloader->createAndRegister(); 18 | 19 | $installer->addAttribute('catalog_category', 'solr_remove_filters', array( 20 | 'type' => 'text', 21 | 'input' => 'multiselect', 22 | 'source' => 'integernet_solr/eav_source_filterableAttribute', 23 | 'backend' => 'integernet_solr/eav_backend_filterableAttribute', 24 | 'label' => 'Remove Filters', 25 | 'note' => 'Hold the CTRL key to select multiple filters', 26 | 'required' => 0, 27 | 'user_defined' => 0, 28 | 'group' => 'Solr', 29 | 'global' => 0, 30 | 'visible' => 1, 31 | )); 32 | 33 | 34 | 35 | $installer->endSetup(); -------------------------------------------------------------------------------- /src/app/code/community/IntegerNet/Solr/sql/integernet_solr_setup/upgrade-1.7.3-1.7.4.php: -------------------------------------------------------------------------------- 1 | 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/design/adminhtml/default/default/layout/integernet/solr.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/app/design/adminhtml/default/default/template/integernet/solr/config/status.phtml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/app/design/adminhtml/default/default/template/integernet/solr/config/upgrade.phtml: -------------------------------------------------------------------------------- 1 | 2 | 3 |

4 | 5 | <?php echo $this->__('Upgrade to IntegerNet_Solr Pro') ?> 9 | 10 |

11 | -------------------------------------------------------------------------------- /src/app/design/frontend/base/default/layout/integernet/solr/filter.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | integernet/solr/css/filter.css 8 | 9 | 10 | integernet/solr/css/loader.css 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | catalogsearch.leftnav 23 | 24 | 25 | enterprisesearch.leftnav 26 | 27 | 28 | 29 | Mage_CatalogSearch 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | Mage_CatalogSearch 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /src/app/design/frontend/base/default/template/integernet/solr/filter/checkbox.phtml: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | /** @var IntegerNet_Solr_Block_Result_Layer_Checkbox $this */ 11 | ?> 12 | getIsTopNav()): ?> 13 | getIsChecked()): ?>checked="checked" /> 19 | 20 | -------------------------------------------------------------------------------- /src/app/design/frontend/base/default/template/integernet/solr/layer/top/filter.phtml: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | ?> 11 | 12 | 19 | 20 |
    21 | getItems() as $_item): ?> 22 |
  1. 23 | getCount() > 0): ?> 24 | getIsChecked() ? 'crossbox crossbox--checked' : 'crossbox' ?> 25 | getLabel() ?> 26 | getLabel() ?> 27 | 28 | shouldDisplayProductCount()): ?> 29 | (getCount() ?>) 30 | 31 |
  2. 32 | 33 |
34 | -------------------------------------------------------------------------------- /src/app/design/frontend/base/default/template/integernet/solr/layer/top/state.phtml: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | ?> 11 | 12 | 19 | getActiveFilters() ?> 20 | 21 |
22 |
    23 |
  1. __('Currently Shopping by:') ?>
  2. 24 | 25 |
  3. 26 | getClearLinkUrl(); 28 | if ($clearLinkUrl): 29 | ?> 30 | __('Previous') ?> 31 | escapeHtml($_filter->getFilter()->getClearLinkText()) ?> 32 | 33 | __('Remove This Item') ?> 34 | 35 | __($_filter->getName()) ?>: stripTags($_filter->getLabel()) ?> 36 |
  4. 37 | 38 |
39 |
40 | 41 | -------------------------------------------------------------------------------- /src/app/design/frontend/base/default/template/integernet/solr/layer/top/view.phtml: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | ?> 11 | 12 | 19 | canShowBlock()): ?> 20 |
21 |
22 | __('Shop By') ?> 23 |
24 |
25 | getLayer()->getState()->getFilters()): ?> 26 | 27 | 28 | canShowOptions()): ?> 29 |

__('Filter') ?>

30 | 31 |
32 | getFilters() ?> 33 | 34 | getItemsCount()): ?> 35 |
36 |
__($_filter->getName()) ?>
37 |
38 |
39 | getHtml() ?> 40 |
41 |
42 |
43 | 44 | 45 |
46 | 47 | 62 | 63 | getStateHtml() ?> 64 |
65 | getChildHtml('solr.loader') ?> 66 |
67 | 68 | -------------------------------------------------------------------------------- /src/app/design/frontend/base/default/template/integernet/solr/loader.phtml: -------------------------------------------------------------------------------- 1 | escapeHtml(trim(Mage::getStoreConfig('integernet_solr/solr_theme/loader_style'))); ?> 2 | 3 |
4 |
__('Loading...') ?>
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | 14 |
15 |
__('Loading...') ?>
16 |
17 |
18 | 19 | -------------------------------------------------------------------------------- /src/app/design/frontend/base/default/template/integernet/solr/result.phtml: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | ?> 11 | 12 | 21 | getLoadedProductCollection(); 23 | $_helper = $this->helper('catalog/output'); 24 | ?> 25 | count()): ?> 26 |

__('There are no products matching the selection.') ?>

27 | 28 |
29 | getToolbarHtml() ?> 30 | 31 | getMode()!='grid'): ?> 32 | 33 |
    34 | 35 |
  1. 36 | getChild('item') 38 | ->setProduct($_product) 39 | ->setListType('list') 40 | ->toHtml() ?> 41 |
  2. 42 | 43 |
44 | 45 | 46 | 47 | 48 | 49 | 50 | count() ?> 51 | getColumnCount(); ?> 52 | 53 | 54 | 65 | 66 | 67 | 68 | 69 | 70 |
71 | getToolbarHtml() ?> 72 |
73 |
74 | 75 | -------------------------------------------------------------------------------- /src/app/design/frontend/base/default/template/integernet/solr/result/autosuggest/item.phtml: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | ?> 11 | 12 | 20 | getProduct(); 22 | $_helper = $this->helper('catalog/output'); 23 | ?> 24 |
25 | <?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?> 26 |
27 | stripTags($_product->getName(), null, true); ?> 28 |
29 | 30 | productAttribute($_product, $_product->getName() , 'name'); ?> 31 | 32 |
33 |
34 | getPriceHtml($_product, true) ?> 35 |
36 | -------------------------------------------------------------------------------- /src/app/design/frontend/base/default/template/integernet/solr/result/grid/item.phtml: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | ?> 11 | 12 | 21 | getProduct(); 23 | $_helper = $this->helper('catalog/output'); 24 | ?> 25 | <?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?> 26 |

productAttribute($_product, $_product->getName(), 'name') ?>

27 | getRatingSummary()): ?> 28 | getReviewsSummaryHtml($_product, 'short') ?> 29 | 30 | getPriceHtml($_product, true) ?> 31 |
32 | isSaleable()): ?> 33 | 34 | 35 |

__('Out of stock') ?>

36 | 37 | 45 |
46 | -------------------------------------------------------------------------------- /src/app/design/frontend/base/default/template/integernet/solr/result/list/item.phtml: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | ?> 11 | 12 | 21 | getProduct(); 23 | $_helper = $this->helper('catalog/output'); 24 | ?> 25 | 26 | <?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?> 27 | 28 |
29 |
30 | stripTags($_product->getName(), null, true); ?> 31 |

productAttribute($_product, $_product->getName() , 'name'); ?>

32 | getRatingSummary()): ?> 33 | getReviewsSummaryHtml($_product) ?> 34 | 35 | getPriceHtml($_product, true) ?> 36 | isSaleable()): ?> 37 |

38 | 39 |

__('Out of stock') ?>

40 | 41 |
42 | productAttribute($_product, $_product->getShortDescription(), 'short_description') ?> 43 | __('Learn More') ?> 44 |
45 | 53 |
54 |
55 | -------------------------------------------------------------------------------- /src/app/design/frontend/rwd/default/layout/integernet/solr/filter.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | integernet/solr/css/filter.css 8 | 9 | 10 | integernet/solr/css/loader.css 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | catalogsearch.leftnav 23 | 24 | 25 | enterprisesearch.leftnav 26 | 27 | 29 | 30 | Mage_CatalogSearch 31 | 32 | 34 | 36 | 38 | 39 | 40 | 41 | 42 | 45 | 46 | Mage_CatalogSearch 47 | 48 | 50 | 52 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /src/app/design/frontend/rwd/default/template/integernet/solr/layer/top/filter.phtml: -------------------------------------------------------------------------------- 1 | 27 | 34 | 35 |
    36 | getItems() as $_item): ?> 37 |
  1. 38 | getCount() > 0): ?> 39 | getIsChecked() ? 'crossbox crossbox--checked' : 'crossbox' ?> 40 | 41 | getLabel() ?> 42 | shouldDisplayProductCount()): ?> 43 | (getCount() ?>) 44 | 45 | 46 | 47 | 48 | getLabel(); ?> 49 | shouldDisplayProductCount()): ?> 50 | (getCount() ?>) 51 | 52 | 53 | 54 |
  2. 55 | 56 |
57 | -------------------------------------------------------------------------------- /src/app/design/frontend/rwd/default/template/integernet/solr/layer/top/state.phtml: -------------------------------------------------------------------------------- 1 | 27 | 34 | getActiveFilters(); 36 | $_renderers = $this->getParentBlock()->getChild('state_renderers')->getSortedChildren(); 37 | ?> 38 | 39 |
40 |
    41 |
  1. __('Currently Shopping by:') ?>
  2. 42 | 43 | getParentBlock()->getChild('state_renderers')->getChild($_rendererName); 47 | if (method_exists($_renderer, 'shouldRender') && $_renderer->shouldRender($_filter)): 48 | $_renderer->setFilter($_filter); 49 | echo $_renderer->toHtml(); 50 | $_rendered = true; 51 | break; 52 | endif; 53 | endforeach; 54 | 55 | if (!$_rendered): 56 | ?> 57 |
  3. 58 | getClearLinkUrl(); 60 | if ($clearLinkUrl): 61 | ?> 62 | __('Previous') ?> 63 | escapeHtml($_filter->getFilter()->getClearLinkText()) ?> 64 | 65 | __('Remove This Item') ?> 66 | 67 | __($_filter->getName()) ?>: stripTags($_filter->getLabel()) ?> 68 |
  4. 69 | 70 | 71 |
72 |
73 | 74 | -------------------------------------------------------------------------------- /src/app/design/frontend/rwd/default/template/integernet/solr/layer/top/view.phtml: -------------------------------------------------------------------------------- 1 | 27 | 34 | canShowBlock()): ?> 35 |
36 |
37 | __('Shop By') ?> 38 |
39 |
40 | getLayer()->getState()->getFilters()): ?> 41 | 42 | 43 | canShowOptions()): ?> 44 |

__('Filter') ?>

45 | 46 |
47 | getFilters() ?> 48 | 49 | getItemsCount()): ?> 50 |
51 |
__($_filter->getName()) ?>
52 |
53 |
54 | getHtml() ?> 55 |
56 |
57 |
58 | 59 | 60 | getChildHtml('solr.loader') ?> 61 |
62 | 63 | 78 | 79 | getStateHtml() ?> 80 |
81 |
82 | 83 | -------------------------------------------------------------------------------- /src/app/design/frontend/rwd/default/template/integernet/solr/result.phtml: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | ?> 11 | 12 | 20 | getLoadedProductCollection(); 22 | $_helper = $this->helper('catalog/output'); 23 | ?> 24 | count()): ?> 25 |

__('There are no products matching the selection.') ?>

26 | 27 |
28 | getToolbarHtml() ?> 29 | 30 | getMode()!='grid'): ?> 31 | 32 |
    33 | 34 |
  1. 35 | getChild('item') 37 | ->setProduct($_product) 38 | ->setListType('list') 39 | ->toHtml() ?> 40 |
  2. 41 | 42 |
43 | 44 | 45 | 46 | 47 | 48 | 49 | count() ?> 50 | getColumnCount(); ?> 51 | 66 | 67 | 68 | 69 |
70 | getToolbarHtml() ?> 71 |
72 |
73 | 74 | 75 | getChild('after'); 78 | if (is_object($child)) { 79 | $_afterChildren = $child->getSortedChildren(); 80 | foreach($_afterChildren as $_afterChildName) { 81 | $_afterChild = $child->getChild($_afterChildName); 82 | $_afterChild->setProductCollection($_productCollection); 83 | echo $_afterChild->toHtml(); 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /src/app/design/frontend/rwd/default/template/integernet/solr/result/grid/item.phtml: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | ?> 11 | 12 | 20 | getProduct(); 22 | $_helper = $this->helper('catalog/output'); 23 | ?> 24 | 25 | 26 | <?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?> 29 | 30 |
31 |

productAttribute($_product, $_product->getName(), 'name') ?>

32 | 33 | getChild('name.after')->getSortedChildren(); 35 | foreach($_nameAfterChildren as $_nameAfterChildName): 36 | $_nameAfterChild = $this->getChild('name.after')->getChild($_nameAfterChildName); 37 | $_nameAfterChild->setProduct($_product); 38 | ?> 39 | toHtml(); ?> 40 | 41 | 42 | getPriceHtml($_product, true) ?> 43 | getRatingSummary()): ?> 44 | getReviewsSummaryHtml($_product, 'short') ?> 45 | 46 |
47 | isSaleable() && !$_product->canConfigure()): ?> 48 | 49 | isSaleable()): ?> 50 | __('View Details') ?> 51 | 52 |

__('Out of stock') ?>

53 | 54 | 62 |
63 |
64 | -------------------------------------------------------------------------------- /src/app/etc/modules/IntegerNet_Solr.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | true 6 | community 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/skin/adminhtml/default/default/integernet/solr/integer_net_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/integer-net/solr-magento1/82fb1768ac7a09dc9a64d60edc8278f41f276c7e/src/skin/adminhtml/default/default/integernet/solr/integer_net_logo.png -------------------------------------------------------------------------------- /src/skin/adminhtml/default/default/integernet/solr/solr_free_banner_upgrade_to_pro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/integer-net/solr-magento1/82fb1768ac7a09dc9a64d60edc8278f41f276c7e/src/skin/adminhtml/default/default/integernet/solr/solr_free_banner_upgrade_to_pro.png -------------------------------------------------------------------------------- /src/skin/adminhtml/default/default/integernet/solr/style.css: -------------------------------------------------------------------------------- 1 | .integernet-solr-tab 2 | { 3 | position: relative; 4 | } 5 | 6 | .integernet-solr-tab span:after 7 | { 8 | top: 0; 9 | right: 8px; 10 | position: absolute; 11 | content: " "; 12 | display: block; 13 | background: url(integer_net_logo.png) no-repeat; 14 | width: 22px; 15 | height: 23px; 16 | } -------------------------------------------------------------------------------- /src/skin/frontend/base/default/integernet/solr/css/filter.css: -------------------------------------------------------------------------------- 1 | .triangle-up, .filter-item:before, .filter-item:after { 2 | width: 0; 3 | height: 0; 4 | border-left: 3px solid transparent; 5 | border-right: 3px solid transparent; 6 | border-bottom: 6px solid #e7e7e7; } 7 | 8 | .solr-checkbox { 9 | display: none; } 10 | 11 | .crossbox { 12 | position: relative; 13 | padding-left: 0; 14 | color: #444444; 15 | line-height: 16px; } 16 | .crossbox:before { 17 | position: relative; 18 | content: ''; 19 | display: block; 20 | float: left; 21 | width: 15px; 22 | height: 15px; 23 | border: 1px solid #e7e7e7; 24 | background-color: white; 25 | margin-right: 10px; } 26 | 27 | .crossbox--checked:before { 28 | background-color: #444444; 29 | border-color: #444444; } 30 | 31 | .crossbox--checked:after { 32 | position: absolute; 33 | top: -1px; 34 | left: -22px; 35 | content: 'x'; 36 | width: 13px; 37 | height: 13px; 38 | font-size: 13px; 39 | font-weight: bold; 40 | color: #ffffff; } 41 | 42 | .col-main { 43 | position: relative; } 44 | 45 | .block-filter-nav { 46 | position: relative; 47 | min-height: 180px; 48 | background-color: #f6f6f6; } 49 | 50 | .filter { 51 | width: 100%; 52 | margin-bottom: 10px; } 53 | .filter:after { 54 | content: ''; 55 | position: relative; 56 | display: block; 57 | clear: both; } 58 | 59 | .filter-item { 60 | position: relative; 61 | float: left; 62 | height: 35px; 63 | margin-right: 10px; 64 | margin-bottom: 10px; 65 | background-color: #ffffff; 66 | cursor: pointer; 67 | width: calc(1/4 * (100% - ((4 - 1) * 10px))); } 68 | .filter-item:nth-child(4n) { 69 | margin-right: 0; } 70 | .filter-item:hover { 71 | background-color: #444444; } 72 | .filter-item:hover .filter-title { 73 | color: #ffffff; } 74 | .filter-item:before, .filter-item:after { 75 | content: ''; 76 | position: absolute; 77 | top: calc(50% - 6px); 78 | right: 15px; } 79 | .filter-item:after { 80 | top: calc(50% + 3px); 81 | -webkit-transform: rotate(180deg); 82 | transform: rotate(180deg); } 83 | 84 | .filter-title { 85 | padding: 10px 15px; } 86 | 87 | .filter-content { 88 | display: none; 89 | position: absolute; 90 | z-index: 200; 91 | left: 0px; 92 | top: 35px; 93 | height: 0; 94 | transition: all .4s ease; } 95 | 96 | .filter-list { 97 | overflow: auto; 98 | height: 100%; } 99 | .filter-list ol { 100 | width: 100%; 101 | list-style: none; 102 | margin: 0; 103 | padding: 0; 104 | box-sizing: border-box; } 105 | .filter-list ol li { 106 | display: inline-block; 107 | width: 100%; 108 | padding: 5px 15px; } 109 | 110 | .filter-item--active { 111 | background-color: #444444; 112 | color: #ffffff; } 113 | .filter-item--active:before, .filter-item--active:after { 114 | border-bottom-color: #ffffff; } 115 | .filter-item--active .filter-content { 116 | display: block; 117 | width: 150%; 118 | height: auto; 119 | max-height: 200px; 120 | padding: 10px 0; 121 | background-color: #ffffff; 122 | box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3); } 123 | .filter-item--active .filter-content li { 124 | font-style: italic; } 125 | 126 | .currently { 127 | width: 100%; 128 | overflow: hidden; } 129 | 130 | .filter-currently-intro { 131 | float: left; 132 | margin-left: 0; 133 | margin-right: 10px; 134 | font-weight: bold; 135 | line-height: 22px; } 136 | 137 | .filter-currently-item { 138 | float: left; 139 | margin-right: 10px; 140 | background-color: #f6f6f6; 141 | color: #444444; 142 | padding: 2px 5px 0px; 143 | height: 24px; 144 | line-height: 20px; } 145 | .filter-currently-item .btn-remove { 146 | position: relative; 147 | top: 2px; } 148 | -------------------------------------------------------------------------------- /src/skin/frontend/base/default/integernet/solr/css/filter.min.css: -------------------------------------------------------------------------------- 1 | .filter-item:after,.filter-item:before,.triangle-up{width:0;height:0;border-left:3px solid transparent;border-right:3px solid transparent;border-bottom:6px solid #e7e7e7}.solr-checkbox{display:none}.crossbox{position:relative;padding-left:0;color:#444;line-height:16px}.crossbox:before{position:relative;content:'';display:block;float:left;width:15px;height:15px;border:1px solid #e7e7e7;background-color:#fff;margin-right:10px}.crossbox--checked:before{background-color:#444;border-color:#444}.crossbox--checked:after{position:absolute;top:-1px;left:-22px;content:'x';width:13px;height:13px;font-size:13px;font-weight:700;color:#fff}.col-main{position:relative}.block-filter-nav{position:relative;min-height:180px;background-color:#f6f6f6}.filter{width:100%;margin-bottom:10px}.filter:after{content:'';position:relative;display:block;clear:both}.filter-item{position:relative;float:left;height:35px;margin-right:10px;margin-bottom:10px;background-color:#fff;cursor:pointer;width:calc(1/4 * (100% - 30px))}.filter-item:nth-child(4n){margin-right:0}.filter-item:hover{background-color:#444}.filter-item:hover .filter-title{color:#fff}.filter-item:after,.filter-item:before{content:'';position:absolute;top:calc(50% - 6px);right:15px}.filter-item:after{top:calc(50% + 3px);-webkit-transform:rotate(180deg);transform:rotate(180deg)}.filter-title{padding:10px 15px}.filter-content{display:none;position:absolute;z-index:1;left:0;top:35px;height:0;transition:all .4s ease}.filter-list{overflow:auto;height:100%}.filter-list ol{width:100%;list-style:none;margin:0;padding:0;box-sizing:border-box}.filter-list ol li{display:inline-block;width:100%;padding:5px 15px}.filter-item--active{background-color:#444;color:#fff}.filter-item--active:after,.filter-item--active:before{border-bottom-color:#fff}.filter-item--active .filter-content{display:block;width:150%;height:auto;max-height:200px;padding:10px 0;background-color:#fff;box-shadow:0 2px 5px rgba(0,0,0,.3)}.filter-item--active .filter-content li{font-style:italic}.currently{width:100%;overflow:hidden}.filter-currently-intro{float:left;margin-left:0;margin-right:10px;font-weight:700;line-height:22px}.filter-currently-item{float:left;margin-right:10px;background-color:#f6f6f6;color:#444;padding:2px 5px 0;height:24px;line-height:20px}.filter-currently-item .btn-remove{position:relative;top:2px} -------------------------------------------------------------------------------- /src/skin/frontend/base/default/integernet/solr/css/loader.css: -------------------------------------------------------------------------------- 1 | .solr-loader, 2 | .solr-system { 3 | display: none; 4 | width: 100%; 5 | height: 100%; 6 | position: absolute; 7 | top: 0; 8 | background: rgba(255, 255, 255, 0.8); } 9 | .solr-loader.active, 10 | .solr-system.active { 11 | display: block; 12 | z-index: 300; } 13 | 14 | .solr-system__notice, 15 | .solr-loader--modern__notice { 16 | position: absolute; 17 | top: 45%; 18 | left: 0; 19 | width: 100%; 20 | text-align: center; 21 | padding-top: 30px; 22 | font-size: 8px; 23 | text-transform: uppercase; 24 | font-family: 'Helvetica Neue',Verdana, Arial, sans-serif; 25 | font-weight: bold; 26 | opacity: 0.6; 27 | padding-left: 15px; } 28 | 29 | .solr-system__stars { 30 | position: relative; 31 | margin: 0 auto; 32 | top: 45%; 33 | left: 50%; } 34 | 35 | .solr-system__star { 36 | content: ""; 37 | position: absolute; 38 | width: 5px; 39 | height: 5px; 40 | border-radius: 50%; } 41 | 42 | .solr-system__star--sun { 43 | background-color: #F8E71C; 44 | width: 20px; 45 | height: 20px; 46 | margin: 0 auto; } 47 | 48 | .solr-system__star--mercury { 49 | left: -10px; 50 | top: -10px; 51 | background-color: #C7C2A6; 52 | -webkit-transform-origin: 20px 20px; 53 | transform-origin: 20px 20px; 54 | -webkit-animation: axis 1.3s linear infinite; 55 | animation: axis 1.3s linear infinite; } 56 | 57 | .solr-system__star--venus { 58 | width: 8px; 59 | height: 8px; 60 | left: -22px; 61 | top: -22px; 62 | background-color: #C7C2A6; 63 | -webkit-transform-origin: 32px 32px; 64 | transform-origin: 32px 32px; 65 | -webkit-animation: axis 1.9s linear infinite; 66 | animation: axis 1.9s linear infinite; } 67 | 68 | .solr-system__star--earth { 69 | width: 10px; 70 | height: 10px; 71 | left: -36px; 72 | top: -36px; 73 | background-color: #009bff; 74 | -webkit-transform-origin: 46px 46px; 75 | transform-origin: 46px 46px; 76 | -webkit-animation: axis 2.5s linear infinite; 77 | animation: axis 2.5s linear infinite; } 78 | 79 | .solr-system__star--mars { 80 | left: -45px; 81 | top: -45px; 82 | background-color: #C7C2A6; 83 | -webkit-transform-origin: 55px 55px; 84 | transform-origin: 55px 55px; 85 | -webkit-animation: axis 3.5s linear infinite; 86 | animation: axis 3.5s linear infinite; } 87 | 88 | .solr-loader--modern__notice { 89 | color: #444444; 90 | margin-top: -5px; 91 | padding-left: 10px; 92 | top: 40%; } 93 | 94 | .solr-loader--modern__spinner { 95 | position: relative; 96 | top: 40%; 97 | left: -30px; 98 | width: 60px; 99 | height: 60px; 100 | margin: 0 auto; 101 | background-color: #d75f07; 102 | border-radius: 100%; 103 | -webkit-animation: sk-scaleout 1.0s infinite ease-in-out; 104 | animation: sk-scaleout 1.0s infinite ease-in-out; } 105 | 106 | @-webkit-keyframes axis { 107 | 0% { 108 | -webkit-transform: rotateZ(0deg) translate3d(0, 0, 0); 109 | transform: rotateZ(0deg) translate3d(0, 0, 0); } 110 | 100% { 111 | -webkit-transform: rotateZ(360deg) translate3d(0, 0, 0); 112 | transform: rotateZ(360deg) translate3d(0, 0, 0); } } 113 | 114 | @keyframes axis { 115 | 0% { 116 | -webkit-transform: rotateZ(0deg) translate3d(0, 0, 0); 117 | transform: rotateZ(0deg) translate3d(0, 0, 0); } 118 | 100% { 119 | -webkit-transform: rotateZ(360deg) translate3d(0, 0, 0); 120 | transform: rotateZ(360deg) translate3d(0, 0, 0); } } 121 | 122 | @-webkit-keyframes sk-scaleout { 123 | 0% { 124 | -webkit-transform: scale(0); 125 | transform: scale(0); } 126 | 100% { 127 | -webkit-transform: scale(1); 128 | transform: scale(1); 129 | opacity: 0; } } 130 | 131 | @keyframes sk-scaleout { 132 | 0% { 133 | -webkit-transform: scale(0); 134 | transform: scale(0); } 135 | 100% { 136 | -webkit-transform: scale(1); 137 | transform: scale(1); 138 | opacity: 0; } } 139 | -------------------------------------------------------------------------------- /src/skin/frontend/base/default/integernet/solr/css/loader.min.css: -------------------------------------------------------------------------------- 1 | .solr-loader,.solr-system{display:none;width:100%;height:100%;position:absolute;top:0;background:hsla(0,0%,100%,.8)}.solr-loader.active,.solr-system.active{display:block;z-index:1}.solr-loader--modern__notice,.solr-system__notice{position:absolute;top:45%;left:0;width:100%;text-align:center;padding-top:30px;font-size:8px;text-transform:uppercase;font-family:Helvetica Neue,Verdana,Arial,sans-serif;font-weight:700;opacity:.6;padding-left:15px}.solr-system__stars{position:relative;margin:0 auto;top:45%;left:50%}.solr-system__star{content:"";position:absolute;width:5px;height:5px;border-radius:50%}.solr-system__star--sun{background-color:#f8e71c;width:20px;height:20px;margin:0 auto}.solr-system__star--mercury{left:-10px;top:-10px;background-color:#c7c2a6;-webkit-transform-origin:20px 20px;transform-origin:20px 20px;-webkit-animation:a 1.3s linear infinite;animation:a 1.3s linear infinite}.solr-system__star--venus{width:8px;height:8px;left:-22px;top:-22px;background-color:#c7c2a6;-webkit-transform-origin:32px 32px;transform-origin:32px 32px;-webkit-animation:a 1.9s linear infinite;animation:a 1.9s linear infinite}.solr-system__star--earth{width:10px;height:10px;left:-36px;top:-36px;background-color:#009bff;-webkit-transform-origin:46px 46px;transform-origin:46px 46px;-webkit-animation:a 2.5s linear infinite;animation:a 2.5s linear infinite}.solr-system__star--mars{left:-45px;top:-45px;background-color:#c7c2a6;-webkit-transform-origin:55px 55px;transform-origin:55px 55px;-webkit-animation:a 3.5s linear infinite;animation:a 3.5s linear infinite}.solr-loader--modern__notice{color:#444;margin-top:-5px;padding-left:10px;top:40%}.solr-loader--modern__spinner{position:relative;top:40%;left:-30px;width:60px;height:60px;margin:0 auto;background-color:#d75f07;border-radius:100%;-webkit-animation:b 1s infinite ease-in-out;animation:b 1s infinite ease-in-out}@-webkit-keyframes a{0%{-webkit-transform:rotate(0deg) translateZ(0);transform:rotate(0deg) translateZ(0)}to{-webkit-transform:rotate(1turn) translateZ(0);transform:rotate(1turn) translateZ(0)}}@keyframes a{0%{-webkit-transform:rotate(0deg) translateZ(0);transform:rotate(0deg) translateZ(0)}to{-webkit-transform:rotate(1turn) translateZ(0);transform:rotate(1turn) translateZ(0)}}@-webkit-keyframes b{0%{-webkit-transform:scale(0);transform:scale(0)}to{-webkit-transform:scale(1);transform:scale(1);opacity:0}}@keyframes b{0%{-webkit-transform:scale(0);transform:scale(0)}to{-webkit-transform:scale(1);transform:scale(1);opacity:0}} -------------------------------------------------------------------------------- /src/skin/frontend/base/default/integernet/solr/css/topfilter.css: -------------------------------------------------------------------------------- 1 | .triangle-up, .filter-item:before, .filter-item:after { 2 | width: 0; 3 | height: 0; 4 | border-left: 3px solid transparent; 5 | border-right: 3px solid transparent; 6 | border-bottom: 6px solid #e7e7e7; } 7 | 8 | .block-filter-nav { 9 | position: relative; 10 | min-height: 180px; 11 | background-color: #f6f6f6; } 12 | 13 | .filter { 14 | width: 100%; 15 | margin-bottom: 10px; } 16 | .filter:after { 17 | content: ''; 18 | position: relative; 19 | display: block; 20 | clear: both; } 21 | 22 | .filter-item { 23 | position: relative; 24 | float: left; 25 | height: 35px; 26 | margin-right: 10px; 27 | margin-bottom: 10px; 28 | background-color: #ffffff; 29 | cursor: pointer; 30 | width: calc(1/4 * (100% - ((4 - 1) * 10px))); } 31 | .filter-item:nth-child(4n) { 32 | margin-right: 0; } 33 | .filter-item:hover { 34 | background-color: #444444; } 35 | .filter-item:hover .filter-title { 36 | color: #ffffff; } 37 | .filter-item:before, .filter-item:after { 38 | content: ''; 39 | position: absolute; 40 | top: calc(50% - 6px); 41 | right: 15px; } 42 | .filter-item:after { 43 | top: calc(50% + 3px); 44 | -webkit-transform: rotate(180deg); 45 | transform: rotate(180deg); } 46 | 47 | .filter-title { 48 | padding: 10px 15px; } 49 | 50 | .filter-content { 51 | display: none; 52 | position: absolute; 53 | z-index: 200; 54 | left: 0px; 55 | top: 35px; 56 | height: 0; 57 | transition: all .4s ease; } 58 | 59 | .filter-list { 60 | overflow: auto; 61 | height: 100%; } 62 | .filter-list ol { 63 | width: 100%; 64 | list-style: none; 65 | margin: 0; 66 | padding: 0; 67 | box-sizing: border-box; } 68 | .filter-list ol li { 69 | display: inline-block; 70 | width: 100%; 71 | padding: 5px 15px; } 72 | 73 | .filter-link { 74 | position: relative; 75 | padding-left: 0; 76 | color: #444444; 77 | line-height: 16px; } 78 | .filter-link:before { 79 | position: relative; 80 | content: ''; 81 | display: block; 82 | float: left; 83 | width: 15px; 84 | height: 15px; 85 | border: 1px solid #e7e7e7; 86 | background-color: white; 87 | margin-right: 10px; } 88 | 89 | .filter-link--checked:before { 90 | background-color: #444444; 91 | border-color: #444444; } 92 | 93 | .filter-link--checked:after { 94 | position: absolute; 95 | top: -1px; 96 | left: -22px; 97 | content: 'x'; 98 | width: 13px; 99 | height: 13px; 100 | font-size: 13px; 101 | font-weight: bold; 102 | color: #ffffff; } 103 | 104 | .filter-item--active { 105 | background-color: #444444; 106 | color: #ffffff; } 107 | .filter-item--active:before, .filter-item--active:after { 108 | border-bottom-color: #ffffff; } 109 | .filter-item--active .filter-content { 110 | display: block; 111 | width: 150%; 112 | height: auto; 113 | max-height: 200px; 114 | padding: 10px 0; 115 | background-color: #ffffff; 116 | box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3); } 117 | .filter-item--active .filter-content li { 118 | font-style: italic; } 119 | 120 | .currently { 121 | width: 100%; 122 | overflow: hidden; } 123 | 124 | .filter-currently-intro { 125 | float: left; 126 | margin-left: 0; 127 | margin-right: 10px; 128 | font-weight: bold; 129 | line-height: 22px; } 130 | 131 | .filter-currently-item { 132 | float: left; 133 | margin-right: 10px; 134 | background-color: #f6f6f6; 135 | color: #444444; 136 | padding: 2px 5px 0px; 137 | height: 24px; 138 | line-height: 20px; } 139 | .filter-currently-item .btn-remove { 140 | position: relative; 141 | top: 2px; } 142 | -------------------------------------------------------------------------------- /src/skin/frontend/base/default/integernet/solr/css/topfilter.min.css: -------------------------------------------------------------------------------- 1 | .filter-item:after,.filter-item:before,.triangle-up{width:0;height:0;border-left:3px solid transparent;border-right:3px solid transparent;border-bottom:6px solid #e7e7e7}.block-filter-nav{position:relative;min-height:180px;background-color:#f6f6f6}.filter{width:100%;margin-bottom:10px}.filter:after{content:'';position:relative;display:block;clear:both}.filter-item{position:relative;float:left;height:35px;margin-right:10px;margin-bottom:10px;background-color:#fff;cursor:pointer;width:calc(1/4 * (100% - 30px))}.filter-item:nth-child(4n){margin-right:0}.filter-item:hover{background-color:#444}.filter-item:hover .filter-title{color:#fff}.filter-item:after,.filter-item:before{content:'';position:absolute;top:calc(50% - 6px);right:15px}.filter-item:after{top:calc(50% + 3px);-webkit-transform:rotate(180deg);transform:rotate(180deg)}.filter-title{padding:10px 15px}.filter-content{display:none;position:absolute;z-index:1;left:0;top:35px;height:0;transition:all .4s ease}.filter-list{overflow:auto;height:100%}.filter-list ol{width:100%;list-style:none;margin:0;padding:0;box-sizing:border-box}.filter-list ol li{display:inline-block;width:100%;padding:5px 15px}.filter-link{position:relative;padding-left:0;color:#444;line-height:16px}.filter-link:before{position:relative;content:'';display:block;float:left;width:15px;height:15px;border:1px solid #e7e7e7;background-color:#fff;margin-right:10px}.filter-link--checked:before{background-color:#444;border-color:#444}.filter-link--checked:after{position:absolute;top:-1px;left:-22px;content:'x';width:13px;height:13px;font-size:13px;font-weight:700;color:#fff}.filter-item--active{background-color:#444;color:#fff}.filter-item--active:after,.filter-item--active:before{border-bottom-color:#fff}.filter-item--active .filter-content{display:block;width:150%;height:auto;max-height:200px;padding:10px 0;background-color:#fff;box-shadow:0 2px 5px rgba(0,0,0,.3)}.filter-item--active .filter-content li{font-style:italic}.currently{width:100%;overflow:hidden}.filter-currently-intro{float:left;margin-left:0;margin-right:10px;font-weight:700;line-height:22px}.filter-currently-item{float:left;margin-right:10px;background-color:#f6f6f6;color:#444;padding:2px 5px 0;height:24px;line-height:20px}.filter-currently-item .btn-remove{position:relative;top:2px} -------------------------------------------------------------------------------- /src/skin/frontend/base/default/integernet/solr/sass/filter.sass: -------------------------------------------------------------------------------- 1 | $c-white: #ffffff 2 | $c-grey: #f6f6f6 3 | $c-grey--dark: #e7e7e7 4 | $c-anthracite: #444444 5 | $c-blue: #3399cc 6 | $grid-columns: 4 7 | $grid-gutter: 10px 8 | 9 | 10 | .triangle-up 11 | width: 0 12 | height: 0 13 | border-left: 3px solid transparent 14 | border-right: 3px solid transparent 15 | border-bottom: 6px solid $c-grey--dark 16 | 17 | // Hide default input fields 18 | 19 | .solr-checkbox 20 | display: none 21 | 22 | // Custom Checkbox 23 | 24 | .crossbox 25 | position: relative 26 | padding-left: 0 27 | color: $c-anthracite 28 | line-height: 16px 29 | 30 | &:before 31 | position: relative 32 | content: '' 33 | display: block 34 | float: left 35 | width: 15px 36 | height: 15px 37 | border: 1px solid $c-grey--dark 38 | background-color: white 39 | margin-right: 10px 40 | 41 | .crossbox--checked 42 | &:before 43 | background-color: $c-anthracite 44 | border-color: $c-anthracite 45 | 46 | &:after 47 | position: absolute 48 | top: -1px 49 | left: -22px 50 | content: 'x' 51 | width: 13px 52 | height: 13px 53 | font-size: 13px 54 | font-weight: bold 55 | color: $c-white 56 | 57 | .col-main 58 | position: relative 59 | 60 | .block-filter-nav 61 | position: relative 62 | min-height: 180px 63 | background-color: #f6f6f6 64 | 65 | .filter 66 | width: 100% 67 | margin-bottom: 10px 68 | &:after 69 | content: '' 70 | position: relative 71 | display: block 72 | clear: both 73 | 74 | .filter-item 75 | position: relative 76 | float: left 77 | height: 35px 78 | margin: 79 | right: 10px 80 | bottom: 10px 81 | background-color: $c-white 82 | cursor: pointer 83 | width: calc(1/#{$grid-columns} * (100% - ((#{$grid-columns} - 1) * #{$grid-gutter}))) 84 | 85 | &:nth-child(#{$grid-columns}n) 86 | margin-right: 0 87 | 88 | &:hover 89 | background-color: $c-anthracite 90 | .filter-title 91 | color: $c-white 92 | 93 | &:before, 94 | &:after 95 | @extend .triangle-up 96 | content: '' 97 | position: absolute 98 | top: calc(50% - 6px) 99 | right: 15px 100 | 101 | &:after 102 | top: calc(50% + 3px) 103 | transform: rotate(180deg) 104 | 105 | 106 | .filter-title 107 | padding: 10px 15px 108 | 109 | .filter-content 110 | display: none 111 | position: absolute 112 | z-index: 200 113 | left: 0px 114 | top: 35px 115 | height: 0 116 | transition: all .4s ease 117 | 118 | .filter-list 119 | overflow: auto 120 | height: 100% 121 | 122 | ol 123 | width: 100% 124 | list-style: none 125 | margin: 0 126 | padding: 0 127 | box-sizing: border-box 128 | li 129 | display: inline-block 130 | width: 100% 131 | padding: 5px 15px 132 | 133 | // Active item state 134 | 135 | .filter-item--active 136 | background-color: $c-anthracite 137 | color: $c-white 138 | 139 | &:before, 140 | &:after 141 | border-bottom-color: $c-white 142 | 143 | .filter-content 144 | display: block 145 | width: 150% 146 | height: auto 147 | max-height: 200px 148 | padding: 10px 0 149 | background-color: $c-white 150 | box-shadow: 0 2px 5px rgba(#000000,.3) 151 | 152 | li 153 | font-style: italic 154 | 155 | 156 | // Current items 157 | 158 | .currently 159 | width: 100% 160 | overflow: hidden 161 | 162 | .filter-currently-intro 163 | float: left 164 | margin-left: 0 165 | margin-right: 10px 166 | font-weight: bold 167 | line-height: 22px 168 | 169 | .filter-currently-item 170 | float: left 171 | margin-right: 10px 172 | background-color: $c-grey 173 | color: $c-anthracite 174 | padding: 2px 5px 0px 175 | height: 24px 176 | line-height: 20px 177 | 178 | .btn-remove 179 | position: relative 180 | top: 2px -------------------------------------------------------------------------------- /src/skin/frontend/base/default/integernet/solr/sass/loader.sass: -------------------------------------------------------------------------------- 1 | $c-grey: #C7C2A6 2 | $c-black: #444444 3 | $c-blue: rgb(0,155,255) 4 | $c-orange: #d75f07 5 | $c-yellow: #F8E71C 6 | $c-background: rgba(255,255,255,.8) 7 | 8 | // -------------------------------------------------- 9 | // Fancy Solr Theme 10 | // Inspired by: http://codepen.io/georgehastings/pen/QyXeNR 11 | 12 | .solr-loader, 13 | .solr-system 14 | display: none 15 | width: 100% 16 | height: 100% 17 | position: absolute 18 | top: 0 19 | background: $c-background 20 | 21 | &.active 22 | display: block 23 | z-index: 300 24 | 25 | .solr-system__notice, 26 | .solr-loader--modern__notice 27 | position: absolute 28 | top: 45% 29 | left: 0 30 | width: 100% 31 | text-align: center 32 | padding-top: 30px 33 | font-size: 8px 34 | text-transform: uppercase 35 | font-family: 'Helvetica Neue',Verdana, Arial, sans-serif 36 | font-weight: bold 37 | opacity: 0.6 38 | padding-left: 15px 39 | 40 | .solr-system__stars 41 | position: relative 42 | margin: 0 auto 43 | top: 45% 44 | left: 50% 45 | 46 | .solr-system__star 47 | content: "" 48 | position: absolute 49 | width: 5px 50 | height: 5px 51 | border-radius: 50% 52 | 53 | .solr-system__star--sun 54 | background-color: $c-yellow 55 | width: 20px 56 | height: 20px 57 | margin: 0 auto 58 | 59 | .solr-system__star--mercury 60 | left: -10px 61 | top: -10px 62 | background-color: $c-grey 63 | transform-origin: 20px 20px 64 | animation: axis 1.3s linear infinite 65 | 66 | .solr-system__star--venus 67 | width: 8px 68 | height: 8px 69 | left: -22px 70 | top: -22px 71 | background-color: $c-grey 72 | transform-origin: 32px 32px 73 | animation: axis 1.9s linear infinite 74 | 75 | .solr-system__star--earth 76 | width: 10px 77 | height: 10px 78 | left: -36px 79 | top: -36px 80 | background-color: $c-blue 81 | transform-origin: 46px 46px 82 | animation: axis 2.5s linear infinite 83 | 84 | .solr-system__star--mars 85 | left: -45px 86 | top: -45px 87 | background-color: $c-grey 88 | transform-origin: 55px 55px 89 | animation: axis 3.5s linear infinite 90 | 91 | // -------------------------------------------------- 92 | // Modern/RWD Defaultish Theme 93 | // Credits: https://github.com/tobiasahlin/SpinKit 94 | 95 | .solr-loader--modern__notice 96 | color: $c-black 97 | margin-top: -5px 98 | padding-left: 10px 99 | top: 40% 100 | 101 | .solr-loader--modern__spinner 102 | position: relative 103 | top: 40% 104 | left: -30px 105 | width: 60px 106 | height: 60px 107 | margin: 0 auto 108 | background-color: $c-orange 109 | border-radius: 100% 110 | -webkit-animation: sk-scaleout 1.0s infinite ease-in-out 111 | animation: sk-scaleout 1.0s infinite ease-in-out 112 | 113 | // -------------------------------------------------- 114 | // Animations 115 | 116 | @keyframes axis 117 | 0% 118 | transform: rotateZ(0deg) translate3d(0,0,0) 119 | 100% 120 | transform: rotateZ(360deg) translate3d(0,0,0) 121 | 122 | @keyframes sk-scaleout 123 | 0% 124 | transform: scale(0) 125 | 100% 126 | transform: scale(1.0) 127 | opacity: 0 128 | 129 | -------------------------------------------------------------------------------- /src/skin/frontend/rwd/default/integernet/solr/css/filter.min.css: -------------------------------------------------------------------------------- 1 | .filter-item:after,.filter-item:before,.triangle-up{width:0;height:0;border-left:3px solid transparent;border-right:3px solid transparent;border-bottom:6px solid #ccc}.solr-checkbox{display:none}.crossbox{display:inline-block;margin-top:2px}.crossbox,.crossbox:before{position:relative;float:left}.crossbox:before{content:'';display:block;width:15px;height:15px;border:1px solid #ccc;background-color:#fff;margin-right:10px}.crossbox--checked:before{background-color:#39c;border-color:#39c}.crossbox--checked:after{position:absolute;top:0;left:5px;content:'x';width:13px;height:13px;font-size:13px;line-height:13px;font-weight:700;color:#fff}.filter{position:relative;width:100%;margin-bottom:20px}.filter:after{content:'';position:relative;display:block;clear:both}.filter-item{position:relative;float:left;height:35px;margin-right:10px;margin-bottom:10px;background-color:#f4f4f4;cursor:pointer}@media screen and (max-width:479px){.filter-item{width:calc(1/2 * (100% - 10px))}.filter-item:nth-child(2n){margin-right:0}}@media screen and (min-width:480px) and (max-width:768px){.filter-item{width:calc(1/3 * (100% - 20px))}.filter-item:nth-child(3n){margin-right:0}}@media screen and (min-width:768px){.filter-item{width:calc(1/4 * (100% - 30px))}.filter-item:nth-child(4n){margin-right:0}}.filter-item:hover{background-color:#39c}.filter-item:hover .filter-title{color:#fff}.filter-item:after,.filter-item:before{content:'';position:absolute;top:calc(50% - 6px);right:15px}.filter-item:after{top:calc(50% + 3px);-webkit-transform:rotate(180deg);transform:rotate(180deg)}.filter-title{padding:10px 15px;font-size:.8em}.filter-content{display:none;position:absolute;z-index:1;left:2px;top:25px;height:0;transition:all .4s ease}.filter-list{overflow:auto;height:100%}.filter-list>ol>li{padding:5px 15px}.filter-list>ol>li>a{padding:0!important}.filter-item--active{background-color:#39c;color:#fff}.filter-item--active:after,.filter-item--active:before{border-bottom-color:#fff}.filter-item--active .filter-content{display:block;width:150%;height:auto;overflow:auto;max-height:200px;padding:10px 0;background-color:#fff;box-shadow:0 2px 5px rgba(0,0,0,.3)}.filter-item--active .filter-content li{font-size:.8em;font-style:italic}.currently{width:100%;margin-bottom:20px;overflow:hidden}.filter-currently-intro{float:left;margin-right:10px;margin-left:-10px;font-size:.8em;font-weight:700;line-height:22px}.filter-currently-item{float:left;margin-right:10px;background-color:#f4f4f4;color:#888;padding:2px 5px 0;font-size:.8em;height:24px;line-height:20px}.filter-currently-item .btn-remove{height:22px;margin-right:-6px;border:0 solid transparent}.filter-currently-item .btn-remove:hover{background-color:#ccc;border-color:transparent;text-decoration:none}.filter-currently-item .btn-remove:after{line-height:22px;color:#888} -------------------------------------------------------------------------------- /src/skin/frontend/rwd/default/integernet/solr/css/loader.css: -------------------------------------------------------------------------------- 1 | .col-main { 2 | position: relative; } 3 | 4 | .solr-loader, 5 | .solr-system { 6 | display: none; 7 | width: 100%; 8 | height: 100%; 9 | position: absolute; 10 | top: 0; 11 | z-index: 300; 12 | background: rgba(255, 255, 255, 0.8); } 13 | .solr-loader.active, 14 | .solr-system.active { 15 | display: block; } 16 | 17 | .solr-system__notice, 18 | .solr-loader--modern__notice { 19 | position: absolute; 20 | top: 80px; 21 | left: 0; 22 | width: 100%; 23 | text-align: center; 24 | padding-top: 30px; 25 | font-size: 8px; 26 | text-transform: uppercase; 27 | font-family: 'Helvetica Neue',Verdana, Arial, sans-serif; 28 | font-weight: bold; 29 | opacity: 0.6; 30 | padding-left: 25px; } 31 | 32 | .solr-system__stars { 33 | position: relative; 34 | margin: 0 auto; 35 | top: 80px; 36 | left: 50%; } 37 | 38 | .solr-system__star { 39 | content: ""; 40 | position: absolute; 41 | width: 5px; 42 | height: 5px; 43 | border-radius: 50%; } 44 | 45 | .solr-system__star--sun { 46 | background-color: #F8E71C; 47 | width: 20px; 48 | height: 20px; 49 | margin: 0 auto; } 50 | 51 | .solr-system__star--mercury { 52 | left: -10px; 53 | top: -10px; 54 | background-color: #C7C2A6; 55 | -webkit-transform-origin: 20px 20px; 56 | transform-origin: 20px 20px; 57 | -webkit-animation: axis 1.3s linear infinite; 58 | animation: axis 1.3s linear infinite; } 59 | 60 | .solr-system__star--venus { 61 | width: 8px; 62 | height: 8px; 63 | left: -22px; 64 | top: -22px; 65 | background-color: #C7C2A6; 66 | -webkit-transform-origin: 32px 32px; 67 | transform-origin: 32px 32px; 68 | -webkit-animation: axis 1.9s linear infinite; 69 | animation: axis 1.9s linear infinite; } 70 | 71 | .solr-system__star--earth { 72 | width: 10px; 73 | height: 10px; 74 | left: -36px; 75 | top: -36px; 76 | background-color: #009bff; 77 | -webkit-transform-origin: 46px 46px; 78 | transform-origin: 46px 46px; 79 | -webkit-animation: axis 2.5s linear infinite; 80 | animation: axis 2.5s linear infinite; } 81 | 82 | .solr-system__star--mars { 83 | left: -45px; 84 | top: -45px; 85 | background-color: #C7C2A6; 86 | -webkit-transform-origin: 55px 55px; 87 | transform-origin: 55px 55px; 88 | -webkit-animation: axis 3.5s linear infinite; 89 | animation: axis 3.5s linear infinite; } 90 | 91 | .solr-loader--modern__notice { 92 | color: #009bff; 93 | margin-top: -5px; 94 | padding-left: 60px; } 95 | 96 | .solr-loader--modern__spinner { 97 | position: relative; 98 | top: 80px; 99 | width: 60px; 100 | height: 60px; 101 | margin: 0 auto; 102 | background-color: #009bff; 103 | border-radius: 100%; 104 | -webkit-animation: sk-scaleout 1.0s infinite ease-in-out; 105 | animation: sk-scaleout 1.0s infinite ease-in-out; } 106 | 107 | @-webkit-keyframes axis { 108 | 0% { 109 | -webkit-transform: rotateZ(0deg) translate3d(0, 0, 0); 110 | transform: rotateZ(0deg) translate3d(0, 0, 0); } 111 | 100% { 112 | -webkit-transform: rotateZ(360deg) translate3d(0, 0, 0); 113 | transform: rotateZ(360deg) translate3d(0, 0, 0); } } 114 | 115 | @keyframes axis { 116 | 0% { 117 | -webkit-transform: rotateZ(0deg) translate3d(0, 0, 0); 118 | transform: rotateZ(0deg) translate3d(0, 0, 0); } 119 | 100% { 120 | -webkit-transform: rotateZ(360deg) translate3d(0, 0, 0); 121 | transform: rotateZ(360deg) translate3d(0, 0, 0); } } 122 | 123 | @-webkit-keyframes sk-scaleout { 124 | 0% { 125 | -webkit-transform: scale(0); 126 | transform: scale(0); } 127 | 100% { 128 | -webkit-transform: scale(1); 129 | transform: scale(1); 130 | opacity: 0; } } 131 | 132 | @keyframes sk-scaleout { 133 | 0% { 134 | -webkit-transform: scale(0); 135 | transform: scale(0); } 136 | 100% { 137 | -webkit-transform: scale(1); 138 | transform: scale(1); 139 | opacity: 0; } } 140 | -------------------------------------------------------------------------------- /src/skin/frontend/rwd/default/integernet/solr/css/loader.min.css: -------------------------------------------------------------------------------- 1 | .col-main{position:relative}.solr-loader,.solr-system{display:none;width:100%;height:100%;position:absolute;top:0;z-index:1;background:hsla(0,0%,100%,.8)}.solr-loader.active,.solr-system.active{display:block}.solr-loader--modern__notice,.solr-system__notice{position:absolute;top:80px;left:0;width:100%;text-align:center;padding-top:30px;font-size:8px;text-transform:uppercase;font-family:Helvetica Neue,Verdana,Arial,sans-serif;font-weight:700;opacity:.6;padding-left:25px}.solr-system__stars{position:relative;margin:0 auto;top:80px;left:50%}.solr-system__star{content:"";position:absolute;width:5px;height:5px;border-radius:50%}.solr-system__star--sun{background-color:#f8e71c;width:20px;height:20px;margin:0 auto}.solr-system__star--mercury{left:-10px;top:-10px;background-color:#c7c2a6;-webkit-transform-origin:20px 20px;transform-origin:20px 20px;-webkit-animation:a 1.3s linear infinite;animation:a 1.3s linear infinite}.solr-system__star--venus{width:8px;height:8px;left:-22px;top:-22px;background-color:#c7c2a6;-webkit-transform-origin:32px 32px;transform-origin:32px 32px;-webkit-animation:a 1.9s linear infinite;animation:a 1.9s linear infinite}.solr-system__star--earth{width:10px;height:10px;left:-36px;top:-36px;background-color:#009bff;-webkit-transform-origin:46px 46px;transform-origin:46px 46px;-webkit-animation:a 2.5s linear infinite;animation:a 2.5s linear infinite}.solr-system__star--mars{left:-45px;top:-45px;background-color:#c7c2a6;-webkit-transform-origin:55px 55px;transform-origin:55px 55px;-webkit-animation:a 3.5s linear infinite;animation:a 3.5s linear infinite}.solr-loader--modern__notice{color:#009bff;margin-top:-5px;padding-left:60px}.solr-loader--modern__spinner{position:relative;top:80px;width:60px;height:60px;margin:0 auto;background-color:#009bff;border-radius:100%;-webkit-animation:b 1s infinite ease-in-out;animation:b 1s infinite ease-in-out}@-webkit-keyframes a{0%{-webkit-transform:rotate(0deg) translateZ(0);transform:rotate(0deg) translateZ(0)}to{-webkit-transform:rotate(1turn) translateZ(0);transform:rotate(1turn) translateZ(0)}}@keyframes a{0%{-webkit-transform:rotate(0deg) translateZ(0);transform:rotate(0deg) translateZ(0)}to{-webkit-transform:rotate(1turn) translateZ(0);transform:rotate(1turn) translateZ(0)}}@-webkit-keyframes b{0%{-webkit-transform:scale(0);transform:scale(0)}to{-webkit-transform:scale(1);transform:scale(1);opacity:0}}@keyframes b{0%{-webkit-transform:scale(0);transform:scale(0)}to{-webkit-transform:scale(1);transform:scale(1);opacity:0}} -------------------------------------------------------------------------------- /src/skin/frontend/rwd/default/integernet/solr/sass/loader.sass: -------------------------------------------------------------------------------- 1 | $c-grey: #C7C2A6 2 | $c-blue: rgb(0,155,255) 3 | $c-yellow: #F8E71C 4 | $c-background: rgba(255,255,255,.8) 5 | 6 | // -------------------------------------------------- 7 | // Fancy Solr Theme 8 | // Inspired by: http://codepen.io/georgehastings/pen/QyXeNR 9 | 10 | .col-main 11 | position: relative 12 | 13 | .solr-loader, 14 | .solr-system 15 | display: none 16 | width: 100% 17 | height: 100% 18 | position: absolute 19 | top: 0 20 | z-index: 300 21 | background: $c-background 22 | 23 | &.active 24 | display: block 25 | 26 | .solr-system__notice, 27 | .solr-loader--modern__notice 28 | position: absolute 29 | top: 80px 30 | left: 0 31 | width: 100% 32 | text-align: center 33 | padding-top: 30px 34 | font-size: 8px 35 | text-transform: uppercase 36 | font-family: 'Helvetica Neue',Verdana, Arial, sans-serif 37 | font-weight: bold 38 | opacity: 0.6 39 | padding-left: 25px 40 | 41 | .solr-system__stars 42 | position: relative 43 | margin: 0 auto 44 | top: 80px 45 | left: 50% 46 | 47 | .solr-system__star 48 | content: "" 49 | position: absolute 50 | width: 5px 51 | height: 5px 52 | border-radius: 50% 53 | 54 | .solr-system__star--sun 55 | background-color: $c-yellow 56 | width: 20px 57 | height: 20px 58 | margin: 0 auto 59 | 60 | .solr-system__star--mercury 61 | left: -10px 62 | top: -10px 63 | background-color: $c-grey 64 | transform-origin: 20px 20px 65 | animation: axis 1.3s linear infinite 66 | 67 | .solr-system__star--venus 68 | width: 8px 69 | height: 8px 70 | left: -22px 71 | top: -22px 72 | background-color: $c-grey 73 | transform-origin: 32px 32px 74 | animation: axis 1.9s linear infinite 75 | 76 | .solr-system__star--earth 77 | width: 10px 78 | height: 10px 79 | left: -36px 80 | top: -36px 81 | background-color: $c-blue 82 | transform-origin: 46px 46px 83 | animation: axis 2.5s linear infinite 84 | 85 | .solr-system__star--mars 86 | left: -45px 87 | top: -45px 88 | background-color: $c-grey 89 | transform-origin: 55px 55px 90 | animation: axis 3.5s linear infinite 91 | 92 | // -------------------------------------------------- 93 | // Modern/RWD Defaultish Theme 94 | // Credits: https://github.com/tobiasahlin/SpinKit 95 | 96 | .solr-loader--modern__notice 97 | color: $c-blue 98 | margin-top: -5px 99 | padding-left: 60px 100 | 101 | .solr-loader--modern__spinner 102 | position: relative 103 | top: 80px 104 | width: 60px 105 | height: 60px 106 | margin: 0 auto 107 | background-color: $c-blue 108 | border-radius: 100% 109 | -webkit-animation: sk-scaleout 1.0s infinite ease-in-out 110 | animation: sk-scaleout 1.0s infinite ease-in-out 111 | 112 | // -------------------------------------------------- 113 | // Animations 114 | 115 | @keyframes axis 116 | 0% 117 | transform: rotateZ(0deg) translate3d(0,0,0) 118 | 100% 119 | transform: rotateZ(360deg) translate3d(0,0,0) 120 | 121 | 122 | @keyframes sk-scaleout 123 | 0% 124 | transform: scale(0) 125 | 100% 126 | transform: scale(1.0) 127 | opacity: 0 128 | 129 | -------------------------------------------------------------------------------- /test/README.md: -------------------------------------------------------------------------------- 1 | # Unit Test Suite 2 | 3 | The unit test suite does not need additional resources 4 | 5 | ## Run Tests: 6 | 7 | In the root directory: 8 | 9 | phpunit --testsuite unit 10 | 11 | ## Run Tests: 12 | 13 | In the root directory: 14 | 15 | phpunit --testsuite integration 16 | 17 | The EcomDev_PHPUnit Magento integration test suite can be found at 18 | src/app/code/community/IntegerNet/Solr/Test -------------------------------------------------------------------------------- /test/bootstrap.php: -------------------------------------------------------------------------------- 1 | > /usr/local/etc/php/php.ini 30 | export WORKSPACE=`pwd` 31 | export MAGENTO_VERSION=magento-mirror-1.9.2.2 32 | export MAGENTO_DB_HOST=$MYSQL_PORT_3306_TCP_ADDR 33 | export MAGENTO_DB_PORT=$MYSQL_PORT_3306_TCP_PORT 34 | export MAGENTO_DB_USER=root 35 | export MAGENTO_DB_PASS=$MYSQL_ENV_MYSQL_ROOT_PASSWORD 36 | export MAGENTO_DB_NAME=magento 37 | export MAGENTO_DB_ALLOWSAME=0 38 | export MAGENTO_INSTALL_SAMPLE_DATA=no 39 | export ECOMDEV_PHPUNIT_CUSTOM_BOOTSTRAP=IntegerNet/Solr/Test/bootstrap.php 40 | sed -i -e "s/8983/$SOLR_CI_PORT_8983_TCP_PORT/g" src/app/code/community/IntegerNet/Solr/Test/fixtures/config.yaml 41 | sed -i -e "s/localhost/$SOLR_CI_PORT_8983_TCP_ADDR/g" src/app/code/community/IntegerNet/Solr/Test/fixtures/config.yaml 42 | curl -sSL https://raw.githubusercontent.com/composer/getcomposer.org/master/web/installer | php -- --quiet 43 | php composer.phar require aoepeople/composer-installers:* 44 | php composer.phar install --dev --no-interaction 45 | curl -sSL https://raw.githubusercontent.com/schmengler/MageTestStand/master/setup.sh | bash --------------------------------------------------------------------------------