0

I am using rwd magento theme for customization.

I want to catalog/product title above the breadcrumbs section in my theme. I also want to show this on category page.

I want to show something like the below screenshot. How can I go about it? Wanted output

1

you can add widget above breadcrumbs please visit:

How do I add a block on the home page above the content, below the navigation on the home page only?

you should also visit how to display product name in widget.

https://stackoverflow.com/questions/27403173/magento-how-to-use-product-link-widget-to-display-name-price-on-homepage

you can also done by local.xml

File : app\design\frontend[package][theme]\layout\local.xml

<cms_page_view> <!-- layout update handle -->
    <reference name="root"> <!-- parent block of our custom block -->
        <block type="core/template" name="my.custom.top.block" as="my_custom_top_block" template="custom/template.phtml" /> <!-- definition of custom block -->
    </reference>
</cms_page_view>

This code snippet defines our block and include it in root block in the case of a cms page rendition. This means this block will be available when a cms page is rendered in frontend. You need to include the block inside root block because it is the block which holds all structural blocks and breadcrumb block is a structural block. Obviously your block is also a structural block.

Specify Where should Custom Block Appear

This is the next important step. Defining a block will not render your block automatically. You need to specify where should it appear. For that you need to open the root template and add the below code there

File : app\design\frontend[package][theme]\template/page/[root-template].phtml

<div class="main">
<?php echo $this->getChildHtml('my_custom_top_block') ?>
    <?php echo $this->getChildHtml('breadcrumbs') ?>

    <div class="col-main">
        <?php echo $this->getChildHtml('global_messages') ?>
        <?php echo $this->getChildHtml('content') ?>
    </div>
</div>

Define your custom block template

This is the last step. Go ahead and create a custom block template which we have specified in our layout udpate.

File : app\design\frontend[package][theme]\template/custom/template.phtml

<div> UREKKAAAA </div>

Now clear the cache and load the page again.

I hope this will help you.

2

You would need to create a new structural block, reference it in the page templates and then create a new .phtml file which references the product title. Then place the xml in your local.xml theme file.

   <catalog_product_view>
<reference name="new_structural_block_name">
  <block type="catalog/product_view" name="product.name" template="pathtofile/product-title.phtml"></reference></catalog_product_view>

Your .phtml template file will look something like this

$_product = $this->getProduct(); $_productName = $_product->getName(); echo $_productName; 
4
  • Will it be the same for catalog? – Bhargav Mehta Apr 28 '15 at 13:08
  • It would be very similar, but instead of referencing the type="catalog/product_view" reference the category block class and change the .phtml to reference the category name. Look in this file for what you need. app/design/frontend/base/default/template/catalog/category/view.phtml – pip Apr 29 '15 at 12:15
  • Hi, I want to edit breadcrumb.phtml file . I want to show titles above breadcrumb section which goes for every page. For Eg., If I am on contact us page then Contact Us should come above breadcrumb . Similar goes for category page for eg., If I am on Women category page Women should appear upon breadcrumb section. @pip Can you please post a new answer for that? – Bhargav Mehta May 1 '15 at 7:16
  • could you help me magento.stackexchange.com/q/178268/39050 – user51361 Jun 12 '17 at 8:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.