And it worked. viewcat.phtml was almost an exact copy of catalog/layer/view.phtml
Now I get an error:
Fatal error: Call to a member function getProductCollection() on a non-object in /web03/magento/pub/app/code/core/Mage/Catalog/Model/Layer.php on line 40
Any ideas? Why wouldn’t this work anymore?
When I put that in. Running on:
Linux version 2.6.18-5-xen-vserver-amd64 (Debian 2.6.18.dfsg.1-17) () (gcc version 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)) #1 SMP Sat Dec 22 22:58:29 UTC 2007
Apache 2.2.3
MySQL 5.0.32-Debian_7etch5-log
PHP 5.2.0-8+etch10
The above xml I posted works in v. 1.0. I forgot I had modified the model as such:
Mage/Catalog/Model/Layer.php
public function getCurrentCategory() { $category = $this->getData('current_category'); if (is_null($category)) { if ($category = Mage::registry('current_category')) { $this->setData('current_category', $category); } else { $category = false; $this->setData('current_category', $category); } }
//added to make this work for front page: if(is_null($category) || $category == false) { $home_category = Mage::getModel('catalog/category')->load(8); //number must correspond to 'all products page' category $this->setData('current_category', $home_category); $category = $this->getData('current_category'); //return $category; } //end addition
return $category; }
and change the number in this line to define my home page category (in my case the category that has all products so they can all be filtered through)
$home_category = Mage::getModel('catalog/category')->load(8); //number must correspond to 'all products page' category
I’m not sure I can do that since it’s an internal site. What I did is create a category that’s not under root. Put all products as part of it and made it enabled and anchored. Then I got the number I say to change above from looking at the URL rewrite and finding what id that category is. Let me know if I can help you more. I would, but I don’t want to do anything against my contract.
But i am in a far deeper problem........ i want to create a layered navigation for a composite attribute (Like area which is composed of two individual attribute height & width --- but i need to filter it by area).
I think, i need to create a customized filter like the one is done for Price. I have wasted several hours but unable to understand how to do it.
The only bit of your code I changed is below, and screenshot is attached - showing no change.
Thanks.
$attributeName = $this->getName(); $itemcountthreshold =10; // you can change this $itemcount = $this->getItemsCount(); $displayitemcount = true; //set to true/false to display item count in brackets
and
switch ($attributeName) { case 'Brand': case 'Overthreshold': _displayDropdown($this,$displayitemcount); break;
The only bit of your code I changed is below, and screenshot is attached - showing no change.
Thanks.
Hi Tiff, just in case you missed this important steps:
In order for the custom attributes to show up, the input type has to be
Dropdown, Multiple Select or Price. And you need to make sure the ‘Use In Layered Navigation’ is YES.
Functionality I would really love to see is an integration of the select boxes and active filters, exactly as the filter works on the Magento Partner portal. i.e. active filters appear as the default option in the select boxes and there is a reset option.
Thanks Lucian303 - That sounds perfect............where in the backend would I do this hiding? Am I editing code? or is this in the config panel? or......