You can retrieve the active category and output it's values
$category = Mage::registry('current_category');
echo $category->getName();
echo $category->getDescr();
// etc
This can be done from any existing PHTML file that is placed there or by adding your own file like so:
local.xml
<catalog_category_layered>
<reference name="left">
<block type="core/template" name="top_cat_title" before="-" template="catalog/category/custom_title.phtml"/>
</reference>
</catalog_category_layered>
Now create a PHTML file in the templates catalog/category
directory called custom_title.phtml
and add the above PHP code.
This will display the current category data for you
Assuming you've setup Magento's admin area to use comapnyname
, as per Ben's answer, if you're still running into trouble, I'd jump right to the source.
The Mage_Core_Model_Design_Package
class is where Magento decides which files to use for a theme. First the current theme is checked. If nothing's found there, then the default
theme is checked. That check happens here
#File: app/code/core/Mage/Core/Model/Design/Package.php
public function validateFile($file, array $params)
{
$fileName = $this->_renderFilename($file, $params);
$testFile = (empty($params['_relative']) ? '' : Mage::getBaseDir('design') . DS) . $fileName;
if (!file_exists($testFile)) {
return false;
}
return $fileName;
}
I'd temporarily add some poor man's logging to this function to see the file's Magento is actually accepting or rejecting during a request.
#File: app/code/core/Mage/Core/Model/Design/Package.php
public function validateFile($file, array $params)
{
$fileName = $this->_renderFilename($file, $params);
$testFile = (empty($params['_relative']) ? '' : Mage::getBaseDir('design') . DS) . $fileName;
if (!file_exists($testFile)) {
file_put_contents('/tmp/design-files.log',"REJECT: $testFile\n",FILE_APPEND);
return false;
}
file_put_contents('/tmp/design-files.log',"ACCEPT: $testFile\n",FILE_APPEND);
return $fileName;
}
My guess is you've got a subtle, hard to spot typo in one of your file paths. Try
ls -l [filename]
with the results from the above logging.
Update: Based on the comments you've made, it sounds like you're working with a system where someone has customized things to work differently, and the behavior is a side effect on that.
The two tacts I'd take on debugging this are
Figure out how your system sets the value for customtheme
, and why this code isn't called when the page renders the Custom Options section
The custom options are rendered via ajax. Normally, this is with a URL that looks like the following
http://magento.example.com/index.php/admin/catalog_product/options/id/166/key/2d18a7efe76c64829ba80b26aa153875/?isAjax=true
and the render is handled in the optionsAction
method of
app/code/core/Mage/Adminhtml/controllers/Catalog/ProductController.php
I'd look into if this is different on your system, either via a URL rewrite or a controller override of some kind. This may explain why this particular URL is ignoring the custom theme.
Good luck!
Best Answer
You can do this without changing core files, you need to create an observer that will create a new layout handle based on the attribute. Then you can create a layout update for that handle to change the template used for the product view page.
The following code is based on the article from http://magebase.com/magento-tutorials/creating-custom-layout-handles/
Module init file app/etc/modules/Example_AttributeHandle.xml
Module configuration: app/code/local/Example/AttributeHandle/etc/config.xml
Observer file: app/code/local/Example/AttributeHandle/Model/Observer.php
Replace the $attributeName value with the attribute that you would like to use. When the attribute is dropdown, it will use the numeric value of the selected option. Also this will not work for multiselect attributes.
Now you can change the product view template with the following code in your local.xml to select an other template when the product attribute myattribute has the value demotxt:
Hope that this info is helpful, I did not had the option to test it completly.