I want to edit the top navbar on Magento so that it's main categories are each a different colour, rather than the present bar which is one colour. I know how to do this using html/css but not how to tweak it through Magnento. Has anyone got any pointers please?
1) Add a new Category Attribute. We will use this attribute to store the colour code you want to use for each category. You could store a class name to add into the element, or just a colour code that's upto you :)
http://inchoo.net/ecommerce/magento/how-to-add-new-custom-category-attribute-in-magento/
2) Modify Navigation block to inject the colour/style into the nav when it's rendered.
Mage_Catalog_Block_Navigation::_renderCategoryMenuItemHtml()
what you need to do here will depend on the version of Magento you are using.
Related
I am using the WordPress Customizer and I'd like to add options for categories, for instance "category background image", and so in the Customizer you go on Category X in the preview, you then set the category background option to be "red", and you then navigate to Category Y in the preview, and using the same option you can set it to be "blue" for this particular category. And the idea is you could do this with unlimited categories, so they can all have different background colors.
Is this possible? I know you can use the active_callback to make options in the customizer itself appear/disappear depending on where you are (i.e on a category page), but can you make options save an array with the current category ID seen in the preview + a value?
You could add all your options and use the active_callback parameter on the parent sections. In your active_callback function you could have something like return(is_category(Category ID, name, slug, or array of Category IDs, names, and/or slugs)).
if what you mean by Customizer is just a style customizer, I had an issue before where style should be changed according to a specific action and what I ended up doing is writing a php code that will generate css file which is imported in style.css
something like this:
$style='.';
$style.=get_selected_category_Id().'{';
$style.='color:'.get_selected_color().'}';
etc...
I know it is not a very good solution, but if you need this module for just one or if you do not have much time, it might work well for you
I am using Magento 1.7 for a webshop and I want to display some specific static blocks above the catalog. So when customers go to the menu and click on for example category A and after that clicking on manufacturer B, there should be a text-block above the catalog product listing with manufacturer specific information. Also when they click on manufacturer C, there should be other text then manufacturer B.
I think the easiest way to do this is making static blocks for all manufacturers, and making a PHP script. Is that possible? Or can I do this on another way?
Thank you in advance!
Kind regards,
Jean-Paul
here is the list of free extensions. just download them and you can change/upgrade edit it to your needs.
Shop By Brand /
Manufacturer
Brand Manufacturer
Management
Manufacturer Brand
Logo
i hope you get the idea, i think it`s easy to understand when you have something to start.
If you want to do it by yourself, you can implement an observer, check which filters are applied in the layered navigation and add your block to the content block.
Your block then implements whatever logic you want to show the different informations for the manufacturer.
I would try controller_action_layout_generate_blocks_after, controller_action_layout_render_before or controller_action_layout_render_before_'.$this->getFullActionName() whatever the FullActionName for the layered category is :-)
About Observers you can find things at inchoos: http://inchoo.net/category/ecommerce/magento/events-observers/
To get the information wether a manufactuerer is choosen, I think there are two ways:
get the information from the get Mage::app()->getRequest()->getParam() should work
get the layout, then $layout->getBlock('catalog.leftnav') and pull the information somehow out of the block
afterwards you can add your block.
After reading this: Magento: Add content block at the end of the structual block "content"
I would suggest to introduce your own update handle (because I don't know, how to prepend blocks to the beginning of content). with your own handle, you can use before="-"
And as described here:
http://www.classyllama.com/magento/add-custom-layout-handles-e-g-parent-categories
you can add your handle via $layout->getUpdate()->addHandle('manufacturer_informations');
I would try something like this in the observer:
if($category = Mage::registry('current_category')) {
if($category->getName() == 'MyBrand') { // ot maybe $category->getId() == ...
//instantiate some $block
}
$layout->getBlock('content')->insert($block, 'brand-information');
}
I'm working on a store with a small amount of categories and for the purpose of tayloring the drop down menu li's with bg images and descriptions, I want to markup the top.phtml manually.
After searching high and low I'm posting here to know if anyone can point me in the right direction for adding active class to the current category/parent category?
Much obliged,
Peter
There are a couple options here.
#1, You can let the menu render itself and then do string finds and replaces to mark it up better.
#2, You can compare the requested url to category url fragments to determine which ones are active.
I've used a combination of the two to create menus with CMS pages and certain categories with different CSS classes etc.
I have been searching for a an answer to this for a roughly 2 days and I am just not finding much on this, hopefully some one here may be able to assist.
Basically I am looking to call a product attribute in a theme file eg: 2columns-right.phtml
While I realize this is not possible by default as attributes are available in front end: product, category & search pages, I am hoping some one may have done this before and could point me in the right direction.
The goal is the following:
I have a that contains a banner image on the product detail, what I would like to do is use a small script that checks against the "attribute" manufacturer, and display a banner that is related to the manufacturer name, so brand-x gets banner x, brand-y gets banner-x.
If there is no, image or the manufacturer is not set then it will use a default banner.
Quite a simple concept, but proving to be troublesome since I am unable to call the function outside of view.phtml
I am currently trying to use: $_product->getAttributeName(); works great on view.pthml, not so great outside the page.
As a last resort I thought to create a simple hack where I would just have the above mentioned div empty while retaining its size selectors and then use and image with an absolute position that is called from view.phtml and lives in the desired location.
This would easily handle what I aiming to achieve but I would prefer if I could find the proper method to get the desired result and with out changing core Mage files.
Thank you in advance!
You can get the current product from Magento's registry:
if (Mage::registry('product')) {
$product = Mage::registry('product');
$attribute = $product->getAttributeName();
}
I am making custom theme in drupal6. I want to assign different css classes to different menu. how can i do this. Please help.
The easiest way would be to use the Menu Attributes module.
From the module's project page:
You should use this module when
You want to "nofollow" certain menu items to sculpt the flow of PageRank through your site
You want to give a menu item an ID so you can easily select it using jQuery
You want to add additional classes or styles to a menu item
The module currently allows you to set the following attributes for each menu item:
Id
Name
Target
Rel
Class Style
Accesskey