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');
}
Related
I've got a quick questions for magento experts. I would like to make changes on the PHP core of magento.
I want to add details on product listings, the details will depends on each product, and I want to display the extra details on the catalog list, so it involves the database & PHP.
So my questions is - where can do this? I am not familiar with the magento file structure and I need this rush, I hope I'll have time to study its structure but it will probably take more time than my deadline.
Take note that I am talking about the admin product list, not the customer carting.
You can probably do all of that logic in /template/catalog/product/view.phtml, if is the detail page. If its the category page it would be /template/catalog/product/list.phtml. Either way it would be the same.
$categories = $product->getCategoryIds(); //this is array of category ids the product exists in
$blueCategoryIds = array(1,2,3,4);
$redCategoryIds = array(5,6,7,8);
if(in_array($blueCategoryIds,$categories)){
$newClass = 'blue-background';
} elseif (in_array($redCategoryIds,$categories)) {
$newClass = 'red-background';
} else {
$newClass='';
}
Define .blue-background and .red-background in a CSS file.
.red-background {background:red;}
.blue-background {background:blue;}
Then use $newClass in what ever html element you want to apply your background to. This probably should be part of a custom module a method, but this should you going quick.
I'm customizing my Magento webstore to use rich snippets, so that I had changed the price.phtml to add the itemprop="price" to the price span. The problemn is that I'm getting various itemprop attributes when I have related or agregate products.
I would like to know if there is a way to get the block parent name in php, so I'll be able to ignore the itemprop rendering out of the main product.
The price.phtml template and the corresponding block is almost always called via Mage_Catalog_Block_Product_Abstract::getPriceHtml($product, $displayMinimalPrice, $idSuffix), and therefore has no parent.
To detect from which blocks it is used, you could update those blocks to add something like $product->setIsCalledFromParentBlock(true) before the getPriceHtml() call, and then test the value of $product->getIsCalledFromParentBlock() in price.phtml
I would advise you to get a developer-toolbar extension like mgt-commerce is offering one for free! You get all kind of information straight in your webbrowser.
Good luck!
I am making a site for a car company. Whenever I add an article there are two options: Blog and Category. I would like something like a category with a image preview and instead of the date created to show something like price, or brand.
Is there any simple way to do it? Or any extension already made?
Thanks in advance
Try something like this extension. http://extensions.joomla.org/extensions/authoring-a-content/content-construction/8061. With k2 you can add custom fields for articles. After, you can adjust template for displaying additional fields.
If you want something specific for cars, then I would recommend RD Autos. They have a free version that does most everything you would need as well as a pro version that had additional features.
https://extensions.joomla.org/extensions/vertical-markets/vehicles/5458
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'm wondering if anyone has found or written an extension that would allow a magento website administrator the ability to add values to their products attribute while adding the product. For example, if I sell books and want the book author to be in a drop down list so that it would be used in layered navigation, it seems odd that I would have to add the author via the attributes section before adding the product. From a workflow standpoint it really makes sense to have an "add new value" button next to the drop down on my add product screen.
Anyone have any thoughts or insight?
It's a piece of cake to do, if you know jquery and the (if I may guess) extremely simple model behind magento.
As the other guy said, throw some money and I'll do it ;)
Otherwise, real easy -> find where that dropdown is generated, add a button next to it that opens a popup which you fill "create a new thingie" stuff, create button -> +create +close +refresh your dropdown.
Definitely easy.
And considering the attribute dialog already exists in the tool you cold probably take most from there and just add the popup handlers / button / +refresh .
This extension can Import/Export products and customers from/to CSV file. Create categories, add attribute options, import images and media galleries, reindex, refresh cache, media and price rules automatically. In addition you can backup the entire database in SQL format.
So from above, once you make the csv file, you just have to add the Author header and it would build the list from there. However, the attribute must exist first. I am using this method for the creation of my own manufacturer attribute options.
AMartinez_CustomImportExport
Can't say I have, but I've developed something similar that creates an attribute and adds it to multiple products, it's completely possible, you just need to add something that will call the add attribute on the add product page or change the new product flow to allow a new attribute and add it if needed.
Don't let them scare you, it's not as hard as some people might describe :)
My curiosity finally took over my laziness and I managed to create the module author requested. It's available on github.
Please feel free to check it out and update it if you wish. Maybe in some near future I'll post it on Magento Connect, if feedback is good.
Here's some code that checks if an attribute value exists and adds it if it doesn't: http://www.magentocommerce.com/boards/viewthread/26234/
Shouldn't be too hard to integrate it with the "Add product" form.