I have created a web store with custom CMS page which has custom layout too. This page will show all the products of the store.
On that CMS page all the product is displaying but
I want to remove 'add to cart' button, 'add to wishlist' link and 'add to compare' link from products
I want to remove these links from that specific CMS page only.
I tried
<remove name="" />
in Layout Update XML of that CMS page but I can't get specific names to remove and while searching I tried every possible name but no success.
Any suggestions?
If you have used a custom layout and you are displaying all products on that page then you must have used block type to display all products in content of that page.
Something like
{{block type="catalog/product_list_random" name="product" template="catalog/product/list.phtml"}}
Simply make a new file and save it on same loction where list.phtml is saved (obviously with different name say new.phtml
Put that new.phtml instead of list.phtml
And delete whatever you don't want to display on that page from new.phtml
You only can remove whole blocks with layout updates like that, but those links and buttons are not separate blocks but get rendered within the Mage_Catalog_Block_Product_List block. You will have to replace the template of this block with your own:
copy /app/design/frontend/base/default/template/catalog/product/list.phtml to /app/design/frontend/YOUR/THEME/template/WHATEVER/catalog/product/list.phtml (use your theme directory and a directory name under template that refers to your CMS page)
edit this copy and remove the links and buttons
in the layout update handle for your CMS page, add:
XML:
<reference name="product_list">
<action method="setTemplate" template="WHATEVER/catalog/product/list.phtml" />
</reference>
(assuming that the product list block is called product_list)
Then, depending on what you want to remove, you can put between the "default" tags the following lines:
<remove name="cart_sidebar" /> "
<remove name="catalog.compare.sidebar" /> "
http://www.hostknox.com/tutorials/magento/remove-default-blocks/manual-removal
Related
I am using Magento 1.8.1 and I am working on SEO. I need to put micro-data (schema code) for some category on that page only. I don't understand how to put the data for specific page because if I put any data in template page, it will update on all categories.
For example: I need to put data only for this page.
As I understand it, you want to add some code to only appear on a specific category view. You can add Javascript to the description field in the General Information tab of the category:
You can also add a template to before_body_end block of the page:
You can add additional layout directives here. This layout update:
<reference name="before_body_end">
<block type="core/template" name="seocode" template="seocode/seocode.phtml" />
</reference>
means render out your custom block (seocode) and template file (seocode.phtml) in the before_body_end block. The before_body_end block can be found in the page templates; i.e. page/1column.phtml or page/2columns-left.phtml.
How can I add a custom code i.e. Facebook retargetting or conversion pixel, etc. to a section of a SPECIFIC page? (not global)
I am using the latest magento version.
Thanks
You can accomplish this cleanly using Magento’s layout system. Create or modify the local.xml file in your current theme’s layout subdirectory. Add a new layout update like this:
<!-- Add Facebook retargeting pixel on success page. -->
<checkout_onepage_success>
<reference name="before_body_end">
<block type="core/template" name="fb_retargeting" template="tracking/fb_retargeting.phtml"/>
</reference>
</checkout_onepage_success>
Notice that this layout update is targeting the <checkout_onepage_success> handle, which corresponds to the /checkout/onepage/success page. If you need to target a different page, you have to figure out the layout handle for that page. The handle is created by combining the route name, controller name, and controller method into a single underscore-separated string.
Now you just need to create your template file in your current design’s template subdirectory. In my above example, the template being referenced should be created at: app/design/frontend/.../template/tracking/fb_retargeting.phtml. You would just put the markup for your tracking pixel in that file.
1) If its going to be a CMS pages you can add in the design tab Layout Update XML and add custom xml code, for example
<reference name="head">
<block type="module/block" name="module" template="module/view.phtml" ></block>
</reference>
2) If this need to be in other pages, you can add same code in local.xml of your theme file
go to app/design/frontend/base/your theme/template/page/html/head.phtml
$currentUrl = Mage::helper('core/url')->getCurrentUrl();
$url = Mage::getSingleton('core/url')->parseUrl($currentUrl);
$path = $url->getPath();
if($path == your specic page url){
your code.
}
I've modified my search results page to use the 2columns-right template. But all of my product pages use the 1column template.
When I click on any of the links to products in my Magento search results, the product page is displayed in the left side of the 2columns-right template. Since product pages should use the 1column template, the result looks broken.
The product pages, when linked to from search results, don't seem to retain their heirarchy in the url, either. They appear as standalone pages instead of pages within the catalog. I'm guessing that this is part of the problem.
Is there any way to retain the page heirarchy in search results? Or any way to get the different types of pages that may show up in search results to use their respective templates?
I solved it by editing this block in layout/catalog.xml:
<catalog_product_view translate="label">
<label>Catalog Product View (Any)</label>
<!-- Mage_Catalog -->
<reference name="root">
<action method="setTemplate"><template>page/1column.phtml</template></action>
</reference>
I just changed the template there & now the results look correct.
I want to show a sidebar in the left side of customer account login page. I have successfully placed the sidebar in the product page by calling the navigation bar in catlog.xml file.
But doing the same method with the customer.xml file is not showing the sidebar.
Note
By going through the post "Magento: Display Categories in Sidebar" I had changed my sidebar in product page. But its not working for customer login page.
You need to first tell Magento to use the 2 column template for the Customer Account Login page - as standard it uses the 1 column template file and as such wont have either the left or right structural blocks for your sidebar to go into.
Simple to do - best practice would be to add the layout instruction to an existing or create a local.xml file in your app/design/frontend/YOUR_PACKAGE/YOUR_THEME/layout/ folder.
Using the handle <customer_account_login> so as to reference the login page, add the following to local.xml
<customer_account_login>
<reference name="root">
<action method="setTemplate"><template>page/2column-left.phtml</template></action><!-- Tells Magento to use 2 Column Left page template -->
</reference>
</customer_account_login>
This will use the template with a left sidebar.
Then, also within the same <customer_account_login> handle call in your block to the left structural block...
<customer_account_login>
<reference name="root">
<action method="setTemplate"><template>page/2column-left.phtml</template></action><!-- Tells Magento to use 2 Column Left page template -->
</reference>
<reference name="left"><!-- Tells Magento to place the following content in the left structural block-->
<!-- Your Block Goes Here -->
</reference>
</customer_account_login>
Done.
If you're not comfortable working in a local.xml file you can just amend the content of the <customer_account_login> handle in customers.xml to use the above mentioned "root" and "left" - you'll find it calls the page/1column.phtml file under root and of course wont yet have a <reference name="left">.
I want to change my category page layout to 2columns-left.phtml. The default is a 3 column layout. I only want to set the category page layout to 2columns-left.phtml. The rest should keep the default page layout (3 columns). How can I do this?
You can do this for categories individually under the Design tab. You can do this for all categories by adding a local.xml to your custom theme's layout folder which contains the following:
<?xml version="1.0"?>
<layout>
<my_category_root_template>
<reference name="root">
<tpl>page/2columns-left.phtml</tpl>
</reference>
<my_category_root_template>
<catalog_category_layered>
<update handle="my_category_root_template" />
</catalog_category_layered>
<catalog_category_layered_nochildren>
<update handle="my_category_root_template" />
</catalog_category_layered_nochildren>
<catalog_category_default>
<update handle="my_category_root_template" />
</catalog_category_default>
<!-- EDIT: forgot about search results page -->
<catalogsearch_advanced_result>
<update handle="my_category_root_template" />
</catalogsearch_advanced_result>
<layout>
For further info, Magebase has a great Layout XML primer, and Alan Storm wrote the book on it.
I don't have much experience with magneto but i think it may work.
Go to admin->Catalog->Categories->Manage Categories
Then go to ->Custom Design
You will find Page Layout option there change that to whatever you like.
First to set up the categories: in the admin panel, select the Catalog menu. Then on the left, select the category that you wish to edit. On the right, the Custom Design tab contains the Page Layout property. If you want all categories to have the same layout, set the root category's Page Layout accordingly, and then the child categories' "Use Parent Category Settings" property to True.
The layout for all other pages will be determined by the CMS->Pages page. Click the page to modify, then on the left, select Design, and then on the right, the Layout property.
If you are wondering how to make sure that all subsequently created pages in the CMS admin area by default use a particular layout, so that you don't have to change it each time you create a new content page, I am not certain, as mine seems to default to 1column, even though the XML seems to configure the page to use 3-column (I'm referring to what is in /app/design/frontend///layout/page.xml).. I may misunderstand how that is linked to this, though, perhaps someone else can comment. My understanding is that the CMS pages have their layout settings and custom layout information stored in the database. Therefore, perhaps there is another setting in the database that choose the default when creating a new CMS page.