Magento duplicated Menu - magento

Hy!
My problem is in this menu:
cambuistore.com.br/loja/index.php/
I would like others to explain why menu is duplicated in this case, because i have just one of this: getChildHtml('topMenu') ?> in my header.phtml
top.phtml & header.phtml - http://snipt.org/ujiH2
catalog.xml - http://snipt.org/ujiG8
needing any other files guys?
tks

Maybe the header block is defined twice in your layout XML?
It's impossible to tell without more information. Could you please edit your post to include your layout XML and the contents of your phtml files?
EDIT: Thanks
I've had a look over the files you've linked and I can't see any issues. The only thing I can think might be your problem is that elsewhere one of your .xml files is referencing "top.menu" and adding the block again.
In catalog.xml you have this:
<reference NAME="top.menu">
<block TYPE="catalog/navigation" name="catalog.topnav" template="catalog/navigation/top.phtml"/>
</reference>
top.menu is defined in page.xml like this:
<block type="core/text_list" name="top.menu" as="topMenu" translate="label">
<label>Navigation Bar</label>
</block>
the type: core/text_list refers to the file at app/code/core/Mage/Core/Block/Text/List.php, which goes through each of it's children blocks and renders them one by one.
If elsewhere in your xml (maybe page.xml, or something else) you're adding a top.phtml block to topMenu, then it will be rendering twice.
Let me know how you go.

Related

Cannot append my block into not native magento module

I have found lot information about Magento view generation system and this info looks clear but for some reason I have situation where magento patters not works for me. So my company bought module for checkout page and after some time they decided customize it(add some functionality). If we look to magento standarts we see that we never change source code cuz we have lot mechanism for extend it what actually we tried and found some problem. Have I have peace of layout xml which I would like append my custom block:
<block type="ecommerceteam_echeckout/onepage_billing" name="checkout.onepage.address.billing" as="billing_address" template="ecommerceteam/echeckout/billing.phtml">
<block type="ecommerceteam_echeckout/onepage_billing" name="checkout.onepage.address.billing.form" as="address" template="ecommerceteam/echeckout/billing/address.phtml" />
</block>
And inside billing_address block after address block I would like append my block by follows code:
<layout>
<checkout_cart_index>
<reference name="checkout.onepage">
<block type="kukimi_deliverydate/delivery_date" name="delivery_date" after="address" template="kukimi/deliverydate/delivery/date.phtml" />
</reference>
</checkout_cart_index></layout>
And this is doesn't works but if I change reference to the content it will work what reason for this? how I can manage situations like this?

Adding new cart block within local.xml - magento

Trying to add a new cart block to the header within local.xml this is what i have
<default>
<reference name="header">
<block type="checkout/cart_sidebar" name="cart_topbar" as="topCart" template="checkout/cart/top-cart.phtml"/>
</reference>
</default>
Then with in the header i call it with <?php echo $this->getChildHtml('topCart')?> however it shows nothing.
If i try changing the type to type="core/template" then the template will show the content. So this leads me to think i'm missing something specific to the checkout/cart_sidebar type?
The top-cart.phtml file simple contains a single text line to eliminate anything within that.
that's is your local.xml?
syntax is correct.
have you modify any thing else in Mage/Checkout/Block/Cart/Sidebar.php?

how can i show prodcts by their attribute in product details page in magento

In my site home page, I have three blocks like Recommend product,Top ten product and Talking about product, All products are coming properly by their attribute name.For this, I create three attribute in admin section and add layout design in home page in admin section and add block type in page.xml and i call this blocks by their name in 2column-left.phtml
echo $this->getChilidHtml("block_names")
But,My problem is when i click on any product it will redirect to product details page that is catlog/product/view.phtml, on this page i want to add two different blocks as like home page ,I found its xml page also , I think that is catalog.xml on this page make changes in side the content reference and it is coming ,but i want to add a new block as line content , i was trying but i am not getting any idea please any solution for this.
<catalog_category_layered>
<reference name="recommend">
<block type="catalog/product_list" name="catalog.product_list" as="recommend_list" template="catalog/product/view/recommend.phtml">
</block>
</reference>
</catalog_category_layered>
I add above line code in catalog.xml as a new block and call it in view.phtml as echo $this->getChildHtml('recommend') but it is not showing,I am sure this approach is wrong one .
any solution for this how can i call.
Thanks & Regards
Try this,In your catalog.xml
<catalog_product_view translate="label">// find this line
<reference name="content">
..............
<block type="catalog/product_view" name="product.info" template="catalog/product/view.phtml">
<block type="catalog/product_list" name="catalog.product_list" as="recommend_list" template="catalog/product/view/recommend.phtml"/> //add your block into product.info block
.............
</block>
</reference>
................
</catalog_product_view>
call the your block using name in in catalog/product/view.phtml
echo $this->getChildHtml('recommend_list')
Hope this helps

Magento: Referencing a custom block does not work

I'm trying to reference a block from an other custom module to add a child block via layout file but it does not work.
The first layout file contains
<catalog_product_view>
<reference name="content">
<block type="core/template" name="tabcontainer" as="tabcontainer"
template="store/tabcontainer.phtml" >
<block type="catalog/product_list_related" name="kitparts"
template="store/product/kitparts.phtml"/>
</block>
</reference>
</catalog_product_view>
and in the second one I try to reference the tabcontainer block
<catalog_product_view>
<reference name="tabcontainer">
<block type="productshippinginfo/productshipping" name="productshippinginfo"
template="productshippinginfo/productshipping.phtml" after="kitparts"/>
</reference>
</catalog_product_view>
but the productshippinginfo block is not displayed while it is definitely included in the layout (using Alan Storm's layoutviewer plugin). If I reference content it is displayed.
What is wrong? Isn't it possible to add a child to a custom block from a custom extension?
Thanks for your help!
(I'm using Magento 1.6.1.0)
[edit]
in tabcontainer.phtml I'm calling <?php echo $this->getChildHtml(); ?>
First of all: Thank you Vinai!
Adding a dependency to control the loading order of my plugins it works!
in File: app/etc/modules/Company_ContentModule.xml
<Company_ContentModule>
<active>true</active>
<codePool>local</codePool>
<depends>
<Company_ContainerModule />
</depends>
</Company_ContentModule>
So the content module is loaded after the container module.
You are close. You just need to add this to you store/tabcontainer.phtml file:
getChildHtml('productshippinginfo'); ?>
The reason blocks that are children of "content" render without a template change is that the "content" block is a core/text_list block. If you look in Mage_Core_Block_Text_List, you will see that in its rendering method (_toHtml()) it renders its children.
You could also add an empty getChildHtml() call to your tabcontainer template to achieve a similar effect as a core/text_list - in fact, if you use getChildHtml('',false,true); you'll get the sorted children (set with before="" and after="" params).
EDIT: adjusted the getChildHtml() call syntax based on OP's comment correct findings that the first param must be an empty string a/o/t a boolean.
In the second layout I think you need to provide the nesting:
<catalog_product_view>
<reference name="content">
<reference name="tabcontainer">
<block type="productshippinginfo/productshipping" name="productshippinginfo"
template="productshippinginfo/productshipping.phtml" after="kitparts"/>
</reference>
</reference>
</catalog_product_view>
In order that maganto picks that up
And because you are doing
<?php echo $this->getChildHtml(); ?>
You do not need to specifically call it by name unless you want it to appear in a particular place in your HTML output.
In order to test if your block is appearing in the page at all add output="toHtml" in you block tag.
<block type="productshippinginfo/productshipping" name="productshippinginfo"
template="productshippinginfo/productshipping.phtml" after="kitparts" output="toHtml"/>

Custom Magento View.phtml file called via xml

What is the code to pull in a custom view.phtml file via custom layout update (in admin > catalog > manage products > specific product) with magento? I would really like to do this in local.xml for specific products.
I found this:
<PRODUCT_ATTRIBUTE_SET_shirts>
<reference name="product.info">
<action method="setTemplate"><template>my/custom/product/view.phtml</template></action>
</reference>
But this code is for attributes.
Well, I don't think you can do that in local.xml. But Custom Layout Updates were made for situation like that. Just write there your XML:
<reference name="product.info">
<action method="setTemplate"><template>my/custom/product/view.phtml</template></action>
</reference>
Or if you need to apply the same view.phtml for several products, you can create a new theme containing just one catalog/prodcut/view.phtml and make it extend your current theme. Then apply this theme only for products you need.
I am not entirely sure what you are asking for, but I am guessing you want to use your own view.phtml file and don't know how to have the xml layout file point to that new file.
first look for the file:
app/design/frontend/YOUR_THEME/default/layout/catalog.xml
This file essentially controls what blocks will be called within the catalog of products. If you look for the line:
<reference name="content">
<block type="catalog/category_view" name="category.products" template="catalog/category/view.phtml">
You can change the template= portion to point to your custom view.phtml file. Just remember that the file structure starts at the template file:
app/design/frontend/YOUR_THEME/default/template
So you will need to store your view file within that template file if you use this method.
I hope this helps!

Resources