Use the code below to redirect to any page from a Magento template (phtml) file. In this case, it is a redirect to the home page.
1 |
Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getBaseUrl()); |
Use the code below to redirect to any page from a Magento template (phtml) file. In this case, it is a redirect to the home page.
1 |
Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getBaseUrl()); |
Add the following code to your themes catalog\product\list.phtml file. It will change the column count to 2.
1 |
$this->setColumnCount(2); |
The below code shows how to echo the HTML of a block with the id ‘my_block’.
1 |
echo $this->getLayout()->createBlock('cms/block')->setBlockId('my_block')->toHtml(); |
You have to use so called filters to send parameters to a static block from a template for example. Lets take a look at the following code: Thats the static Magento block:
1 2 3 |
<a href="{{store url=''}}{{var attributset_name}}/configuration/test/product_id/{{var product_id}}"> konfigurieren </a> |
We want to send attributset_name and product_id…
If you want to show the Magento messages (success, error, …) in your template file, add the following code the top of your template:
1 |
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?> |