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?>
Related
I'm running 1.9.x and have 3 different payment methods, amazon payments, paypal express, sage pay and a continue shopping button. On the cart page I am attempting to reorder how these appear in the checkout-types UL.
I currently have the below which I believe is default
<ul class="checkout-types">
<li><?php if($this->getContinueShoppingUrl()): ?>
<button type="button" title="<?php echo $this->__('Continue Shopping') ?>" class="button btn-continue btn-inline" onclick="setLocation('<?php echo $this->getContinueShoppingUrl() ?>')"><span><span><?php echo $this->__('Continue Shopping') ?></span></span></button>
<?php endif; ?></li>
<?php foreach ($this->getMethods('top_methods') as $method): ?>
<?php if ($methodHtml = $this->getMethodHtml($method)): ?>
<li><?php echo $methodHtml; ?></li>
<?php endif; ?>
<?php endforeach; ?>
</ul>
My aim is to have the pay now button which goes into the one page checkout button appear after the continue shopping button and then amazon and paypal. I have spent hours looking through the code and can't seem to find a way to change the sort order on the $method array.
The getMethods($name) method will actually fall for sorting to the configuration in the layout files.
As an example for top_methods which is an alias in the layout, it will look for all the updates on that handle from XML files in the system, in case of PayPal it will be, Considering that RWD is the package you are using :
app/design/frontend/rwd/default/layout/paypal.xml
And this is the xml block part for it:
<block type="paypal/express_shortcut" name="checkout.cart.methods.paypal_express.top" before="checkout.cart.methods.onepage.top" template="paypal/express/shortcut.phtml">
<action method="setIsQuoteAllowed"><value>1</value></action>
<action method="setShowOrPosition"><value>after</value></action>
</block>
In this default theme configuration, the paypal express checkout is placed before the block checkout.cart.methods.onepage.top which is configured to be the last block in top_methods with the after="-" :
<block type="core/text_list" name="checkout.cart.top_methods" as="top_methods" translate="label">
<label>Payment Methods Before Checkout Button</label>
<block type="checkout/onepage_link" name="checkout.cart.methods.onepage.top" template="checkout/onepage/link.phtml" after="-" />
</block>
So in conclusion, what you need to do is to go through the XML layout files for the payment methods you are using, and set the before and after depending on the sort you need. if you have cache enabled, you will need to flush it and you should get the result intended.
An example would be:
Change display order of checkout buttons in Magento
adding the following to the checkout layout sorted the issue
before="checkout.cart.methods.amazonpayments_pay.top"
I'm fairly new to magento, using CE 1.9.
I know how to remove / add tabs on the product page via local.xml
However I'm trying to hide/show a tab based on the value of an attribute of the product.
I have created a custom tab successfully. Additionally the customTab.phtml file I created I was able to get an if statement to work successfully... sort of...
Here is my code inside the phtml file:
<?php
$staticBlockId = 'block_product_tab2';
$product = Mage::registry('current_product'); ?>
<?php if($product->getRepairservice()): ?>
<div class="std"><?php echo $this->getLayout()->createBlock('cms/block')->setBlockId($staticBlockId)->toHtml(); ?></div>
<?php endif; ?>
This will successfully hide or show "content" of the tab based on the boolean value of the attribute. However it still is showing the tab, it's just empty.
So I'm thinking I need to go to where it's created in local.xml but I'm not sure how to structure the if statement or get access to the attribute. Any help would be appreciated.
I think the most clear way of doing this is by creating your own layout handle, see: http://inchoo.net/magento/custom-layout-update-handles/. There you've to check if you're on a product page and then check your getRepairservice(), for example:
// Inside the controllerActionLayoutLoadBefore() function of Inchoo's example
$layout = $observer->getEvent()->getLayout();
$product = Mage::registry('current_product');
if($product && $product->getRepairservice())
{
$layout->getUpdate()->addHandle('REPAIR_SERVICE')
}
After that you can add your tab nicely with XML.
<REPAIR_SERVICE>
<reference name="product.info">
<block type="catalog/product_view_description" name="product.new.tab" as="new.tab" template="catalog/product/view/mynewcustomtab.phtml">
<action method="addToParentGroup"><group>detailed_info</group></action>
<action method="setTitle" translate="value"><value>Custom Tab</value></action>
</block>
</reference>
</REPAIR_SERVICE>
Is there a way to hide the Shopping Cart on Top Menu when it's empty? I believe it is on Links.php file but I don't know what code to add. Also, "Links.php" is a Core file, I am thinking on creating a new module on Local for it. Would it work? Thanks.
Hide the shopping cart side bar when it is empty:
1. Open: app/design/frontend/default/<your template>/template/checkout/cart/sidebar.phtml
2. Go to line 32 Look for
<div class="box base-mini mini-cart">
3. Add these lines right before that opening div tag
<?php $_cartQty = $this->getSummaryCount() ?>
<?php if ($_cartQty >0): ?>
4.Add this line to the bottom of the file
The shopping cart will only show if user adds items to their shopping cart.
Or use these plugin... it's a free plugin for hiding when it is
empty..
Xogenics Hide Cart for Magneto
For hiding in header menu use this
Remove My Cart and Checkout links from the header menu.The code for
these links is located in the checkout.xml file:
In Magento, on your ecommerce site may be you do not want to show MyCart or Checkout links.Follow the steps below to remove the link.
1. Copy the file checkout.xml from app/design/frontend/base/default/layout to app/design/frontend/YOUR_PACKAGE/YOUR_THEME/layout or app/design/frontend/default/YOUR_THEME/layout
2. Edit the checkout.xml copied to the app/design/frontend/YOUR_PACKAGE/YOUR_THEME/layout folder or app/design/frontend/default/YOUR_THEME/layout folder
3. Look for the following Code snippet
<reference name="top.links">
<block type="checkout/links" name="checkout_cart_link">
<action method="addCartLink"></action>
<action method="addCheckoutLink"></action>
</block>
</reference>
4. Comment the following Lines
4.1 Comment the following Line to Remove My Cart Link from header
<!--<action method="addCartLink"></action>-->
4.2 Comment the following Line to Remove Checkout Link from header
<!--<action method="addCheckoutLink"></action>-->
5. Refresh the Magento Cache and Website Page to see the changes
$(document).ready(function(){
$(".top-car").hide();
});
First check if there's quantity in the cart ofcourse with something like:
$qty = $this->helper('checkout/cart')->getSummaryCount()
Hope this helps you
I use this opencatalog mod for opencart link here
It turns the opencart shopping cart site into a catalog, renames add to cart buttons, changes their functions, etc.
As you can see here
this mode changes related product add to cart button to "Enquire Now" but the function doesn't changed. This button still works as a add to cart.
But I want to change it to "View More" button with it's function, as I have on home page featured area.
I try to add this code in xml file but it doesn't work for me. When I add this code, both "Enquire Now" buttons on product page changes to "add to cart" again, because both buttons has the same class I think.
<file name="catalog/view/theme/bigshop/template/product/product.tpl">
<operation error="abort" info="">
<search position="replace"><![CDATA[<div class="rating"><input type="button" value="<?php echo $button_cart; ?>" onclick="addToCart('<?php echo $product['product_id']; ?>');" class="button" /></div>]]></search>
<add><![CDATA[<div class="rating"><?php echo 'View More'; ?></div>]]></add>
</operation>
</file>
Where is my mistake?!
Version of Opencart 1.5.6.4
Thanks.
the text you are showing is from a vqmod file. You need to make sure you have a compatible install of VQMod in your set up. Link then make sure the line of code being looked for is actually there in your theme's template files. if not edit the xml file to look for the code from your template it should be in several places eg. featured module and product.tpl
Hope that helps somewhat.
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.