Showing results for 
Search instead for 
Did you mean: 

Custom Coding in head.phtml (meta,title,description)

Re: Custom Coding in head.phtml (meta,title,description)

//increase the max execution time
@ini_set('max_execution_time', -1);
@ini_set('memory_limit', -1);

ini_set('display_errors', '1');

// // Start Despaly All Product Meta Title And Description
require_once('app/Mage.php'); //Path to Magento

$categories = Mage::getModel('catalog/category')
                         // magic is prepared here..
                         // then the magic happens here:
                         ->addAttributeToFilter('level', array('eq'=>4))
    if (count($categories) > 0):

        foreach($categories as $category):

            $catId = $category->getId();
            $category = Mage::getModel('catalog/category')->load($catId);

                $CategoryName = $category->getName(); 
                $metaTitle = "Buy ".$CategoryName." Online India - RightGifting";
                $metaDescription = "Shop your favourite ".$CategoryName." for you or send a gifts purpose from RightGifting online store India. Offers available. 100% Fast & free shipping!";

                $check = $category->getMetaTitle();
                echo "<pre>";
                echo "\n";

Re: Custom Coding in head.phtml (meta,title,description)

Please explain Where to add this code?

Re: Custom Coding in head.phtml (meta,title,description)

That's like the easiest task in Magento and I've got step by step instruction with video for you to help complete this task:

Re: Custom Coding in head.phtml (meta,title,description)

very weird that nobody understood the question :-(

one reply provides code based on Magento 1.9!

and all other provide links or whatever about adding custom code, like including script.

but the question is how to edit meta tags, like description, keywords, etc dynamically.

those one:

<meta name="title" content="xxxxxxxx"/>
<meta name="description" content="xxxxxxxxxxxx"/>
<meta name="keywords" content="xxx"/>


dynamically, so going to backend to override those values will not help neither...


in other words in which vendor/xx file are those values retrieved from DB so we can intercept and update dynamically? (in my case I need to concatenate with something stored in session object but it does not matter)



I hope it helps clarifying the request