I am using magento 1.9.1 and trying to create a product link directly on cms page.I have created a custombutton.phtml file and add button code here.
<?php $formKey = Mage::getSingleton('core/session')->getFormKey(); ?>
<a class="animated infinite swing btn btn-yellow btn-lg m-r-2" role="button" href="abc.com/checkout/cart/add?product=401&qty=1&form_key=<?php echo $formKey ?>">Add to cart</a>
Now i am calling this phtml file as block on cms page.
{{block type="core/template" name="custombutton" template="custombutton.phtml"}}
But sometimes it is showing button and sometimes not. Not getting the issue.
Please give rights to block goto->system->permissions->block
and add your block name. Hope this helps
Related
How to get recently viewed products in magento.
I tried the following code also
$this->getRecentlyViewedProducts();
in the file product_viewed.phtml
1.Place code snippet below in any template u want to add
<?php echo $this->getLayout()->createBlock('reports/product_viewed')->setTemplate('reports/product_viewed.phtml')->toHtml(); ?>
2.Place code snippet below in any Backend cms-> page or static block
{{block type="reports/product_viewed" template="reports/product_viewed.phtml"}}
Replace template name, product_viewed.phtml with your site.
I want to how recently viewed products on home page in magento.
Currently I am using below code but this is now working. so please help!!
getLayout()->createBlock('reports/product_viewed')->setTemplate('reports/product_viewed.phtml')->toHtml(); ?>
Did you forget to echo?
<?php echo $this->getLayout()->createBlock('reports/product_viewed')->setTemplate('reports/product_viewed.phtml')->toHtml(); ?>
By the way if you're doing it from the CMS you need to use:
{{block type="reports/product_viewed" template="reports/product_viewed.phtml"}}
I have a magento custom page which is the homepage for our site - the guy before me however for some reason did not add the main menu to this page. How would I go about doing this?
The way i work with menus in Magento is:
First, i create a custom block, from the cms menu, in that block i add the li:
<li>Home</li>
Then in your template, edit the following file: app/desing/frontend/yourtheme/default/page/html/topmenu.phtml
you will see: <?php echo $_menu ?> before it add:
<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('yourblockname')->toHtml() ?>
And then you will be able to manage the menu option from your admin panel in your custom block.
I hope this help.
How to add Home menu in magento home page. I add the code In this location
magento\app\design\frontend\default\grayscale\template\catalog\navigation
<li>
<a href="<?php echo $this->getUrl('') ?>">
<?php echo $this->__('Home'); ?>
</a>
</li>
But home menu not displayed on the home page of Magento
You have to keep the categories you want to display in menu under the root directory.
There may be more cases possible on why menu is not appearing.
Please consider following these guides :
http://www.magentocommerce.com/wiki/3_-_store_setup_and_management/catalog/enable_top_menu_navigation
http://www.atwix.com/magento/how-to-add-a-new-item-to-the-navigation-menu/
http://www.youtube.com/watch?v=w4z1RyyFHhU
Are you sure this is the template you're store is using?
You can check by enabling template hints in the developer section of the admin area.
this will hiliight all the blocks/templates for you and show the path to each file used. You will be able to check if the template you have modified is the template being used.
I am new in magento.I want to change footer part.
my footer file path: D:\wamp\www\magento\app\design\frontend\base\default\template\page\html\footer.phtml.
<div class="footer-container">
<div class="footer">
<?php echo $this->getChildHtml() ?>
<p class="bugs"><?php echo $this->__('Help Us to Keep Magento Healthy') ?> - <strong><?php echo $this->__('Report All Bugs') ?></strong> <?php echo $this->__('(ver. %s)', Mage::getVersion()) ?></p>
<address><?php echo $this->getCopyright() ?></address>
</div>
Now I want to remove Help us to keep sentence.
please tell me how to remove this
I have deleted fulll then also it is shown in frontend.
Go to admin section System>Configuration>Advanced>Developer>Debug Then enable Template path hints. After this refresh your site frontend.
You will get the correct information from which theme your file is being loaded.
Then change the correct footer.phtml file.
This message will go.
I think you are new to magento.
For better knowledge read Design Packages
This is a cache issue.
Navigate to your site's cache:
public_html/var/cache //Or where ever the route of your Magento cart is.
Then Delete all the things in the var directory!
Refresh your site and your changes should appear.