diff --git a/app/code/community/Emico/Tweakwise/Helper/Seo.php b/app/code/community/Emico/Tweakwise/Helper/Seo.php index 042aa0d..6202141 100644 --- a/app/code/community/Emico/Tweakwise/Helper/Seo.php +++ b/app/code/community/Emico/Tweakwise/Helper/Seo.php @@ -50,7 +50,7 @@ protected function exceedsAttributeLimit(Emico_Tweakwise_Model_Bus_Type_Facet $f $selectedAttributes = $layer->getSelectedAttributes(); $selectedAttributesCount = count($selectedAttributes); - if ($facetLinkedTo !== null && !in_array($facetLinkedTo, $layer->getSelectedFacets())) { + if ($facetLinkedTo !== null) { $selectedAttributesCount++; } @@ -60,16 +60,17 @@ protected function exceedsAttributeLimit(Emico_Tweakwise_Model_Bus_Type_Facet $f /** * Check if the given facet is not in the blacklist for indexing by robots * + * @param Emico_Tweakwise_Model_Bus_Type_Facet|null $facetLinkedTo * @return bool */ protected function isInFacetBlacklist(Emico_Tweakwise_Model_Bus_Type_Facet $facetLinkedTo = null) { + $noFollowFacets = array_filter(explode(',', Mage::getStoreConfig('emico_tweakwise/navigation/nofollow_facets'))); + if ($facetLinkedTo !== null && in_array($facetLinkedTo->getFacetSettings()->getUrlKey(), $noFollowFacets, true)) { + return true; + } $layer = Mage::getSingleton('emico_tweakwise/catalog_layer'); - $noFollowFacets = explode(',', Mage::getStoreConfig('emico_tweakwise/navigation/nofollow_facets')); $selectedFacets = $layer->getSelectedFacets(); - if ($facetLinkedTo !== null && !in_array($facetLinkedTo, $selectedFacets)) { - $selectedFacets[] = $facetLinkedTo; - } foreach ($selectedFacets as $facet) { $attributeCode = $facet->getFacetSettings()->getAttributeName(); @@ -90,6 +91,7 @@ protected function isInFacetBlacklist(Emico_Tweakwise_Model_Bus_Type_Facet $face /** * Check if the combination of 2 filters is allowed for indexing * + * @param Emico_Tweakwise_Model_Bus_Type_Facet|null $facetLinkedTo * @return bool */ protected function isInCombinationWhitelist(Emico_Tweakwise_Model_Bus_Type_Facet $facetLinkedTo = null) diff --git a/app/code/community/Emico/Tweakwise/Model/Catalog/Layer.php b/app/code/community/Emico/Tweakwise/Model/Catalog/Layer.php index 2b57d30..d6fdcd2 100644 --- a/app/code/community/Emico/Tweakwise/Model/Catalog/Layer.php +++ b/app/code/community/Emico/Tweakwise/Model/Catalog/Layer.php @@ -38,6 +38,11 @@ class Emico_Tweakwise_Model_Catalog_Layer */ protected $_templateId; + /** + * @var array + */ + protected $_selectedFacets; + /** * @return Mage_Catalog_Model_Product[]|Mage_Catalog_Model_Resource_Product_Collection */ @@ -350,15 +355,18 @@ public function getSelectedAttributes() */ public function getSelectedFacets() { - $selectedFacets = []; - foreach ($this->getFacets() as $facet) { - foreach ($facet->getAttributes() as $attribute) { - if ($attribute->getIsSelected()) { - $selectedFacets[$facet->getFacetSettings()->getFacetId()] = $facet; + if ($this->_selectedFacets === null) { + $this->_selectedFacets = []; + foreach ($this->getFacets() as $facet) { + foreach ($facet->getAttributes() as $attribute) { + if ($attribute->getIsSelected()) { + $this->_selectedFacets[$facet->getFacetSettings()->getFacetId()] = $facet; + } } } } - return $selectedFacets; + + return $this->_selectedFacets; } /** diff --git a/app/code/community/Emico/Tweakwise/Model/UrlBuilder/Strategy/PathStrategy.php b/app/code/community/Emico/Tweakwise/Model/UrlBuilder/Strategy/PathStrategy.php index 4bbdd95..1074c35 100644 --- a/app/code/community/Emico/Tweakwise/Model/UrlBuilder/Strategy/PathStrategy.php +++ b/app/code/community/Emico/Tweakwise/Model/UrlBuilder/Strategy/PathStrategy.php @@ -335,6 +335,7 @@ public function buildCanonicalUrl(Emico_Tweakwise_Model_Catalog_Layer $state) /** * @param Emico_Tweakwise_Model_Catalog_Layer $state + * @return string */ protected function buildIndexableAttributePath(Emico_Tweakwise_Model_Catalog_Layer $state) { diff --git a/app/design/frontend/base/default/template/emico_tweakwise/catalog/layer/facet/attribute.phtml b/app/design/frontend/base/default/template/emico_tweakwise/catalog/layer/facet/attribute.phtml index 3b5a40e..1f14cc5 100644 --- a/app/design/frontend/base/default/template/emico_tweakwise/catalog/layer/facet/attribute.phtml +++ b/app/design/frontend/base/default/template/emico_tweakwise/catalog/layer/facet/attribute.phtml @@ -12,9 +12,10 @@ __($_settings->getInfoText()); ?> - getAttributes(); ?> + getHrefAttributes(); ?> +