www_puertoricoautoforo_com
asked on
Magento CMS > Echo variables in CMS? How? {{product name}} etc.. Product page.
I'm editing a CMS block that appears in the bottom portion of every product page. It's just going to be a bunch of test and <ul>'s with SEO text. Now I have the CMS text working just fine, I love it! My problem is that I want to repeat relevant keywords in my text, but I need to reference these keywords dynamically. If it was just normal PHP in zencart I would have something like this...
echo = "<p>This is a great product for your $category \. You can use the $product everyday when you get out of bed or to clean your kitchen floor \. We all know that shopping for $category can be a hard task, rest assured that purchasing $product is a risk-free purchase since it's covered by our warranty. blah blah blah </p>";
But since I'm using a CMS block I have to have {{product}} type of things.. which I know nothing about.. Can I call these {{variables}} like product name and category from a CMS block? If so how? Thanks!
\app\design\frontend\defau lt\MYTEMPL ATE\templa te\catalog \product\v iew.phtml
<ul>
<li>SEO STUFF, blah blah blah</li>
<li><a href="{{store url=""}}about-magento-demo -store">Ab out Us</a></li>
<li>Manufacturer: $_product->getAttributeTex t('manufac turer'); </li>
<li class="last"><a href="{{store url=""}}customer-service"> Customer Service</a></li>
</ul>
echo = "<p>This is a great product for your $category \. You can use the $product everyday when you get out of bed or to clean your kitchen floor \. We all know that shopping for $category can be a hard task, rest assured that purchasing $product is a risk-free purchase since it's covered by our warranty. blah blah blah </p>";
But since I'm using a CMS block I have to have {{product}} type of things.. which I know nothing about.. Can I call these {{variables}} like product name and category from a CMS block? If so how? Thanks!
\app\design\frontend\defau
<ul>
<li>SEO STUFF, blah blah blah</li>
<li><a href="{{store url=""}}about-magento-demo
<li>Manufacturer: $_product->getAttributeTex
<li class="last"><a href="{{store url=""}}customer-service">
</ul>
Actually use this for that last piece of code instead
echo $this->getLayout()->createBlock('core/template')->setTemplate('path/to/template/file')->toHtml();
ASKER
I get errors when trying either of these, is there another step that I should add to this?
I tried putting both of these scripts in the bottom of my view.phtml file..
Is there a way I can display the product name in one of my CMS blocks?
I tried putting both of these scripts in the bottom of my view.phtml file..
Is there a way I can display the product name in one of my CMS blocks?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I don't believe there a convent way to display the products name in a cms block. This is a very simple way to do the same thing. You have much more control this way and can use php. The only down side is it is not editable in the admin, but for what you are doing it sounds like once you get it set up you will not need to adjust it from the admin.
P.S. You should post your error messages if you get them.
In the code snippet I show how to echo out a cms block and echo a template file . I believe the later will help you more.
You can just retrieve the registered product in the template file and access all the product data and not have to worry about special template like you would on a cms block.
Open in new window