Magento removing a block for certain products - magento

I am using a block "block_product_primary_bottom" on 98% of my products. however one the other 2% I want to have it removed, since it will only be about 4 products, I don't see the need to create a custom layout. Is there a way when creating the product to remove the block in the design.
I have tried:
<reference name="product.info">
<remove name="block_product_primary_bottom"/>
</reference>
What do I need to do?

That's the right way to do it.
I tried this in product design, as a test, and it removed the media block (I'm using 1.9.3.6):
<reference name="product.info">
<remove name="product.info.media" />
</reference>
Also, you don't need to reference product.info, the name alone is descriptive enough to remove it:
<remove name="product.info.media" />
Make sure you are referencing the block name and not the block alias (as="..."). Referencing the alias won't work.

If you want to remove it for some particular products only, you can do this from admin panel. Edit that particular product, now in design tab add below code for Custom Layout Update
<remove name="block_product_primary_bottom" />

Related

Magento: Using Custom layout update XML to remove price

In Magento i want to remove the prices from all articles in certain categories by using a custom layout update in the category.
This is what i came up with my self, but i'm still missing the last piece of the puzzle.
<catalog_product_view>
<reference name="product_list">
<remove name="xxx" />
</reference>
</catalog_product_view>
In the above piece of code i need the corresponding name for the price template.
Does anyone know which one i have to use here?
Thanks!!

Magento Cart layout change not sticking

Sorry this is a novice question...
I have changed the layout of my magento cart to popup.html.
i have edited the checkout.xml to use popup.phtml... this is the code i have used in the checkout.xml....
<checkout_cart_index translate="label">
<label>Shopping Cart</label>
<remove name="right"/>
<remove name="left"/>
<reference name="root">
<action method="setTemplate">
<template>page/popup.phtml</template>
</action>
</reference>
</checkout_cart_index>
The problem is that everything was working fine... but i was making changes on the category page and suddenly the cart has stopped showing layout popup.phtml and has started showing 2 column-left and that too without the cart content.
i was making some changes to catalog.xml ... but cant see how it would override the display of checkout/cart
I have been banging my head around this for couple of hours now... Any suggestions as to where i should look to see whats overriding the popup.phtml completely and just displaying an empty two column layout with left column.
thanks..much appreciate..
The particular file generally does not matter. What matters is the layout update handle, i.e. top level nodes in layout update XML, e.g. default, catalog_category_layered, checkout_onepage_index. It is these which "scope" your layout XML directives.

Magento 'Sort By' - How to make Magento forget which option was selected

Something that I have not noticed before is that Magento will remember which option you've selected to 'Sort By' on category list pages. So if you go to a category page, and lets say the default sort is ordered by price, if you change the sort to be ordered by name instead, the page reloads and all is well.
However, if you remove the get variable(s) in the URL and reload the page, it still sorts by name instead of reverting back to price.
I was thinking this was a problem specific to the site I'm working on, as there are some custom things happening with collection building and sorting and such, but I've now checked a handful of other Magento sites (some of which I found at random on the web) and they all do the same thing.
Does anyone know how this is being 'remembered'? Is this stored in user's session? I would think it's part of caching, but this site is still in development and thus caching is disabled.
It's not that big of a deal, but it does seem like a bug.
The sort order parameter is stored in session. See Mage_Catalog_Block_Product_List_Toolbar::getCurrentOrder method. You can switch it off by calling Mage_Catalog_Block_Product_List_Toolbar::disableParamsMemorizing method or by setting params_memorize_allowed in catalog session. I mean Mage::getSingleton('catalog/session')->setParamsMemorizeAllowed(true)
What worked for me is adding this in local.xml:
<!--
Category default layout
-->
<catalog_category_default translate="label">
<!-- Disable memorizing toolbar parameters -->
<reference name="content">
<reference name="product_list_toolbar">
<action method="disableParamsMemorizing" />
</reference>
</reference>
</catalog_category_default>
<!--
Category layered navigation layout
-->
<catalog_category_layered translate="label">
<!-- Disable memorizing toolbar parameters -->
<reference name="content">
<reference name="product_list_toolbar">
<action method="disableParamsMemorizing" />
</reference>
</reference>
</catalog_category_layered>

Magento: How to enable/disable module output per website level?

I would like to display an image in the onepage checkout payment methods section that would only show up in one of two website levels. So I have three questions:
1) Am I correct to assume this change would be coded in app/design/frontend/default/mytheme/layout/checkout.xml ?
2) if that is the correct file, what would the change be from:
<!--
One page checkout payment methods block
-->
<checkout_onepage_paymentmethod>
<remove name="left"/>
<block type="checkout/onepage_payment_methods" name="root" output="toHtml" template="checkout/onepage/payment/methods.phtml">
<action method="setMethodFormTemplate"><method>purchaseorder</method><template>payment/form/purchaseorder.phtml</template></action>
</block>
</checkout_onepage_paymentmethod>
in order to point to, for example, checkout/onepage/payment/methods-site2.phtml when site2 is being used?
3) Is this the proper way to do this in 1.5.x ?
Yes
You need add STORE_[your_store_code] handle and put there this store specific stuff. More info you can read in this article.
So, in your case, you need update block with name root. To change block template you need some method for this, let's say its name is setTemplate. So, in your layout update file you should write
<STORE_your_code>
<reference name="root">
<action method="setTemplate"><template>checkout/onepage/payment/methods-site2.phtml</template></action>
<block type="my_cool/block" name="my_cool_block">
...
</block>
</reference>
</STORE_your_code>
3. Yes, adding store specific handle to your theme layout update file is the right way for magento CE 1.5.x.

Removing the block "Popular Tags" from the index view in Magento

I started working with Magento this week and I'm trying to create a new theme. Following the "Designing for Magento" article of the wiki, I tried to remove the Popular Tags block from the index view, adding this line to local.xml on magento\app\design\frontend\default\mytheme\layout:
<remove name="tags_popular"/>
I don't why, but the tags are still there while if I do the following the language switcher disappears:
<remove name="store_language"/>
I also tried this to no effect:
<reference name="left">
<action method="unsetChild"><name>tags_popular</name></action>
</reference>
I even deleted tag.xml and the tags are still there!
I know that I can get rid of them disabling the Mage_tag in the backend, buy I want to understand why this is not working.
Thanks!
Just add this in your theme->page.xml default block
<remove name="tags_popular"/>
you can remove block any of magneto. then you can remove after it's block name.
here you see tag_popular it's block name remove plus it's block name
Remove default magento block
Have a look into tag.xml where you will find this code, which you have to comment out:
<default>
<!-- Mage_Tag -->
<reference name="left">
<block type="tag/popular" name="tags_popular" template="tag/popular.phtm">
<action method="setTemplate"><template>tag/popular.phtml</template></action>
</block>
</reference>
</default>
How silly, the popular tags were shown in the main page because they came in the default code of the content page (menu: CMS > Pages), so I just had to erase that :P

Resources