I have a Magento site and I disabled the pop up on the compare file so now it loads in a blank page. What I need is to make the "Compare Products" load in the same page but still keep everything as is (design, menus etc).
Thank you
Go to the your custom theme folder
open this file
your_custom_theme\template\catalog/product/compare/sidebar.phtml
Replace with this button
<button type="button" title="<?php echo $this->__('Compare') ?>" class="button" onclick="setLocation('<?php echo $this->htmlEscape($_helper->getListUrl()) ?>')"><span><span><?php echo $this->__('Compare') ?></span></span></button>
From this button
<button type="button" title="<?php echo $this->__('Compare') ?>" class="button" onclick="popWin('<?php echo $_helper->getListUrl() ?>','compare','top:0,left:0,width=820,height=600,resizable=yes,scrollbars=yes')"><span><span><?php echo $this->__('Compare') ?></span></span></button>
Find this and update on your catalog.xml( find this catalog_product_compare_index and change the template name) layout file
<catalog_product_compare_index>
<reference name="root">
<action method="setTemplate"><template>page/1column.phtml</template></action>
</reference></catalog_product_compare_index>
May be it will help you (Note: Don't make changes on the default theme )
Copy the sidebar.phtml from the bellow location
'app\design\frontend\base\default\template\catalog\product\compare'
Put it in your new created theme ( theme name according your choice ) ya existing theme in same directroy strature
'app\design\frontend\default\your_theme_name\template\catalog\product\compare'
change the button as i said my previous answer
Than go to your admin
system --> design --> Add design change --> Custom Design --> select your_theme_name (from the dropdown) save
Find catalog_product_compare_index from catlog.xml file from your your_theme_name
'app\design\frontend\default\your_theme_name\layout\'
and change the bellow line code
<reference name="root">
<action method="setTemplate"><template>page/popup.phtml</template></action>
</reference>
to
<reference name="root">
<action method="setTemplate"><template>page/1column.phtml</template></action>
</reference>
All Done
Your answer is good but you made a little mistake in the last step.
You said to find catalog_product_compare_index from catalog.xml in the following location:
'app\design\frontend\default\your_theme_name\layout\'
The correct location is:
'app\design\frontend\your_theme_name\default\layout\'
If a beginner reads this he wouldn't understand the difference and wouldn't find the file.
I'm a beginner and I was stuck here for a moment.
Related
I'm working on a Magento project which is based on the Ultimo theme and is using the fishpig wordpress extension.
I'm trying to change the 2columns-left.phtml template on the wordpress pages only but can't get it working!
To explain the scenario further:
The Ultimo theme set's the main content before the left column and uses a float: right; css rule on the main content to position it after the left column. The HTML is structured like this:
<div class="col-main grid4-3 grid-col2-main in-col2">
[omitted code]
</div>
<div class="col-left sidebar grid4-1 grid-col2-sidebar in-sidebar"><div class="wp-sidebar">
[omitted code]
</div></div>
This HTML is being generated by ultimo/default/template/page/2columns-left.phtml with:
<div class="col-main grid4-3 grid-col2-main in-col2">
<?php echo $this->getChildHtml('global_messages') ?>
<?php echo $this->getChildHtml('content') ?>
</div>
<div class="col-left sidebar grid4-1 grid-col2-sidebar in-sidebar"><?php echo $this->getChildHtml('left') ?></div>
I would like to use my own template file to position the sidebar before the main content in the HTML for the wordpress pages only, this way the wordpress categories will stack above the main content in a mobile.
I've tried creating my own template called page/wp-2columns-left.phtml and setting it for the Wordpress section of the site with the below code and a few other variations in my themes local.xml:
<wordpress_default>
<reference name="root">
<action method="setTemplate"><template>page/wp-2columns-left.phtml</template></action>
</reference>
</wordpress_default>
But still the origional 2columns-left.phtml template is being called. I could edit the template file directly and get the desired result on the WordPress section of the site but that would affect the rest of the Magento site and is not good practice.
You can achieve this using XML layout code. The following code will change the template for all pages created in WordPress:
<wordpress_page_view>
<reference name="root">
<action method="setTemplate">
<template>page/2columns-left.phtml</template>
</action>
</reference>
</wordpress_page_view>
The following code will change the template for the WordPress page with an ID of 32:
<wordpress_page_view_32>
<reference name="root">
<action method="setTemplate">
<template>page/2columns-left.phtml</template>
</action>
</reference>
</wordpress_page_view_32>
After adding this code to an XML layout file, you will need to refresh your Layout XML cache (if it's enabled).
I followed this tutorial to create the custom block in magento
http://www.gravitywell.co.uk/blog/post/how-to-creating-your-own-custom-block-in-magento
But nothing is showed when I open up home page or any other page. I have searched alot on web but unable to solve the issue.
The above tutorial did not mention where to create layout.xml file but I have created it at:
app\design\frontend\gravitywell\example\layout\layout.xml ---It has just following code:
<block type="gravitywellexample/menu" name="menu" as="menu" template="gravitywell/menu.phtml" />
Any help will be highly appreciated.
Thanks in advance.
I would use local.xml, but then the question becomes what handle tags to put it inside of i.e. where do you want it to show up. When using a 2column-right layout, I can position it inside of the right column on the product page this way:
<catalog_product_view>
<reference name="right">
<block type="gravitywellexample/menu" name="menu" as="menu" template="gravitywell/example/menu.phtml" />
</reference>
</catalog_product_view>
my template is stored in a slightly different folder.
hth, sconnie
I'm trying to remove "recently viewed" from the home page, but I don't know where the block is called. I tried to delete reports.xml but the block stayed there. Then I tried to delete all the code in home_product_viewed.phtml and it worked, but I don't want to delete the code. I only want to delete the call to that file but I don't know where that file is called.
Goto magento backend.
Select the CMS page for homepage.
In the Design section add the below code in the Layout Update XML field
<reference name="right">
<action method="unsetChild"><alias>right.reports.product.viewed</alias></action>
</reference>
To remove it from only the home page, I would do this. Go to your /app/design/frontend/packagename/themename/layout/local.xml
and edit it like this:
<layout>
<cms_index_index>
<remove name="right.reports.product.viewed" />
</cms_index_index>
</layout>
To verify your packagname and themename, go in to admin - System - Configuration - Design.
There may already be other code inside of the layout tag which you should leave there!
This worked for me -> Using left below not right.reports.product.viewed.
Custom Layout Update
<reference name="right">
<action method="unsetChild"><alias>left.reports.product.viewed</alias></action>
</reference>
I am looking to track down the file (and it's location) that generates the "Proceed to Checkout" button in the Magento cart.
Try adding a product to the cart, and then proceeding to the cart. The "Proceed to Checkout" button is on the right hand side of the cart.
I am using a hacked-about variation of the blank theme, if that makes any difference.
Thanks in advance for your help.
The code that produces the Proceed to Checkout link is in templates/checkout/onepage/link.phtml
By default the block for it is in checkout.xml;
<block type="core/text_list" name="checkout.cart.methods" as="methods" translate="label">
<label>Payment Methods After Checkout Button</label>
<block type="checkout/onepage_link" name="checkout.cart.methods.onepage" template="checkout/onepage/link.phtml"/>
<block type="checkout/multishipping_link" name="checkout.cart.methods.multishipping" template="checkout/multishipping/link.phtml"/>
</block>
app/design/frontend/your_package/your_theme/template/checkout/onepage/link.phtml
The "Proceed to Checkout" button that leads to the onepage checkout, is generated with this template : checkout/onepage/link.phtml.
You should be able to know what buttons are added with which templates by looking at the checkout_cart_index handle of the checkout.xml layout file. The block named checkout.cart.methods contains all the buttons, and the two base checkout buttons should be added to it directly in the same file.
Go to System -> Configuration -> Developer change a Current Configuration Scope to some of your websites or stores than go to Debug section - and change Template Path Hints setting to "Yes". Now, on frontend, you'll see an full path to your template file on a filesystem for every block that rendered, so now you can see where your template (that renders a link) exists.
Open this path in your root directory
/app/design/frontend/base/default/template/checkout/onepage/link.phtml
find this code
<?php if ($this->isPossibleOnepageCheckout()):?>
<button type="button" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Proceed to Checkout')) ?>" class="button btn-proceed-checkout btn-checkout<?php if ($this->isDisabled()):?> no-checkout<?php endif; ?>"<?php if ($this->isDisabled()):?> disabled="disabled"<?php endif; ?> onclick="window.location='<?php echo $this->getCheckoutUrl() ?>';"><span><span><?php echo $this->__('Proceed to Checkout') ?></span></span></button>
<?php endif?>
I'm building an extension to add a specific block right before the 'Place Order' button in Magento's Onepage checkout. I'm having some trouble finding the right incantations to simply append a block to this section, much less get it before/after another handle. The object is to engage this override without any template changes.
In my extension's XML, I have:
<checkout_onepage_review>
<reference name="root">
<block type="myextension/blockname" name="myextension.block" template="myextension/block.phtml" before="checkout.onepage.review.button" />
</reference>
</checkout_onepage_review>
myextension/block.phtml is, for now, just a simple block of text. I know the general syntax is correct, as I'm able to add my <block> to checkout_cart_index and see it just fine.
Am I missing something basic?
Thanks!
Background
Not all blocks output their children blocks automatically. Only blocks of the core/text_list type and templates where echo $this->getChildHtml() (no arguments) s called.
Children of template blocks are rendered by a call to echo $this->getChildHtml('child_alias').
It makes sense if you think about it - children of template blocks need to be positioned somewhere in the context of the template HTML.
Referring to your question, there is no functional difference between the layout handles checkout_onepage_review and checkout_cart_index besides them referring to different pages.
Adding content to the checkout review
The checkout review block contains two core/text_list children to whom you can add children using layout XML that will automatically be displayed.
<checkout_onepage_review>
<reference name="checkout.onepage.review.info.items.before">
<block type="core/text" name="review.test.1">
<action method="setText">
<text>Test Block Before</text>
</action>
</block>
</reference>
<reference name="checkout.onepage.review.info.items.after">
<block type="core/text" name="review.test.2">
<action method="setText">
<text>Test Block After</text>
</action>
</block>
</reference>
</checkout_onepage_review>
The only problem is that the checkout.onepage.review.info.items.after block is rendered before the agreements block, so in your case it might not be good enough.
The agreements are rendered with this code:
<?php foreach ($this->getAgreements() as $_a): ?>
<li>
<div class="agreement-content"<?php echo ($_a->getContentHeight() ? ' style="height:' . $_a->getContentHeight() . '"' : '')?>>
<?php if ($_a->getIsHtml()):?>
<?php echo $_a->getContent() ?>
<?php else:?>
<?php echo nl2br($this->htmlEscape($_a->getContent())) ?>
<?php endif; ?>
</div>
<p class="agree">
<input type="checkbox" id="agreement-<?php echo $_a->getId()?>" name="agreement[<?php echo $_a->getId()?>]" value="1" title="<?php echo $this->htmlEscape($_a->getCheckboxText()) ?>" class="checkbox" /><label for="agreement-<?php echo $_a->getId()?>"><?php echo $_a->getIsHtml() ? $_a->getCheckboxText() : $this->htmlEscape($_a->getCheckboxText()) ?></label>
</p>
</li>
<?php endforeach ?>
If you want to add a block after the agreements, right before the "Place Order" button, without changing the template, and without rewriting the agreements block, you can try to add an additional item to the end of the checkout/agreements collection, having is_html set to true, and your output as the content.
This turns out to be problematic, though, because the agreements model, resource, and collection don't offer a custom event prefix.
What this boils down to, if the provided checkout.onepage.review.info.items.after block doesn't work, are the following options. Each one is ugly in it's own way, so the choice of the smallest evil is yours:
Observe the core_block_abstract_to_html_before mentioned in the post linked to in the comments
Observe the core_collection_abstract_load_before event and add a html agreement on the fly
Rewrite the checkout/agreements block and overload the _toHtml() method
My recommendation would be to somehow make use of the checkout.onepage.review.info.items.after block - that solution would be so much nicer.