0

I need to change shopping cart page title. but i could not find it. where i should change it. so any help appreciated.

enter image description here

thanks

Shamim Ahmed
  • 931
  • 2
  • 16
  • 30

5 Answers5

5

Changing the XML will have no effect because the title is set by the controller at app/code/core/Mage/Checkout/controllers/CartController.php.

$this
->loadLayout()
->_initLayoutMessages('checkout/session')
->_initLayoutMessages('catalog/session')
->getLayout()->getBlock('head')->setTitle($this->__('Shopping Cart'));

It's never a good idea to modify core files, and overriding controllers can be tedious. Therefore, the correct and quickest place to change this is in your translation file, located at app/locale/YOUR_LANGUAGE/Mage_Checkout.csv. If you do not have this file in your relevant directory you may create it and just add this line:

"Shopping Cart","NEW TITLE HERE"

If you do have the file then simply edit that line, ensuring your new title follows the original title and comma and is enclosed in double quotes.

cfx
  • 3,311
  • 2
  • 35
  • 45
  • 1
    Uhm... In theory app/locale/LOCALE_SETTING/Mage_Checkout.csv is a core-file as well... Only when you make a local override and add your own translation file (app/locale/LOCALE_SETTING/Namespace_Module.csv) it is considered not being a core-file ;) – RichardBernards Jan 29 '14 at 09:33
2

The right way to do it, is making an override on the checkout controllers, is so easy. First: Add a new module with two subdirectories: controllers and etc. Mynamespace/Checkout/controllers Mynamespace/Checkout/etc

Then, in the etc directory add the file: CartController.php with the next content:

require_once 'Mage/Checkout/controllers/CartController.php';

class Mynamespace_Checkout_CartController extends Mage_Checkout_CartController
{

public function indexAction()
{
    $cart = $this->_getCart();
    if ($cart->getQuote()->getItemsCount()) {
        $cart->init();
        $cart->save();

        if (!$this->_getQuote()->validateMinimumAmount()) {
            $minimumAmount = Mage::app()->getLocale()->currency(Mage::app()->getStore()->getCurrentCurrencyCode())
                ->toCurrency(Mage::getStoreConfig('sales/minimum_order/amount'));

            $warning = Mage::getStoreConfig('sales/minimum_order/description')
                ? Mage::getStoreConfig('sales/minimum_order/description')
                : Mage::helper('checkout')->__('Minimum order amount is %s', $minimumAmount);

            $cart->getCheckoutSession()->addNotice($warning);
        }
    }

    // Compose array of messages to add
    $messages = array();
    foreach ($cart->getQuote()->getMessages() as $message) {
        if ($message) {
            // Escape HTML entities in quote message to prevent XSS
            $message->setCode(Mage::helper('core')->escapeHtml($message->getCode()));
            $messages[] = $message;
        }
    }
    $cart->getCheckoutSession()->addUniqueMessages($messages);

    /**
     * if customer enteres shopping cart we should mark quote
     * as modified bc he can has checkout page in another window.
     */
    $this->_getSession()->setCartWasUpdated(true);

    Varien_Profiler::start(__METHOD__ . 'cart_display');
    $this
        ->loadLayout()
        ->_initLayoutMessages('checkout/session')
        ->_initLayoutMessages('catalog/session')
        ->getLayout()->getBlock('head')->setTitle($this->__('Here it go the new title!!!!'));
    $this->renderLayout();
    Varien_Profiler::stop(__METHOD__ . 'cart_display');
    }
} 

and then, the config.xml file:

<config>
    <modules>
    <Mynamespace_Checkout>
        <version>0.1.0</version>
    </Mynamespace_Checkout>
</modules>
<frontend>
    <routers>
        <checkout>
            <args>
                <modules>
                    <mynamespace_sales before="Mage_Checkout">Mynamespace_Checkout</mynamespace_sales>
                </modules>
            </args>
        </checkout>
    </routers>
</frontend>

And last, the module activator: app/etc/modules/Mynamespace_Checkout.xml

<config>
    <modules>
        <Mynamespace_Checkout>
            <active>true</active>
            <codePool>local</codePool>
        </Mynamespace_Checkout>
    </modules>
</config>

This was tested in a Magento Enterprise 1.13.

Greetings

Beto Castillo
  • 867
  • 9
  • 16
1

Here is a short example how to overwrite the title.

Force title

You can change the variable and overwrite the title in the specified layout.xml files.

René Höhle
  • 26,716
  • 22
  • 73
  • 82
1

The title is actually set in the XML for that page. You should open the checkout.xml file in the app/design/frontend/packagename/themename/layout/ directory and place this code inside of the node in the XML:

<reference name="head">
    <action method="setTitle"><title>My New Checkout Title</title></action>
</reference>

By default, I believe it grabs the label associated of the handle if the page title is not assigned explicitly (right now the label is "Shopping Cart" which is why you are getting that title).

Here is what my code looks like:

   <checkout_cart_index translate="label">
       <label>Shopping Cart</label>
       <remove name="right"/>
       <remove name="left"/>
       <!-- Mage_Checkout -->
       <reference name="head">
           <action method="setTitle"><title>My New Checkout Title</title></action>
       </reference>
       <reference name="root">
           <action method="setTemplate"><template>page/1column.phtml</template></action>
       </reference>
       <!-- More Below -->
   </checkout_cart_index>

One other thing to mention, you can also make these changes in a local.xml (which is what I would recommend). The local.xml file will load on top off all the other XML files and your changes in that file will override any other XML files in the layout directory. A pretty good tutorial can be found here.

Zentaurus
  • 758
  • 2
  • 11
  • 27
0

Try this :

<reference name="head">
     <action method="setTitle"><title>My New Checkout Title</title></action>
</reference>
zed Blackbeard
  • 760
  • 12
  • 30