Add Homepage link to Magento menu bar - magento

I am trying to add a homepage link to the main menu of Magento. I have modified top.phtml in my template/catalog/navigation and added the line
<li>
<?php echo $this->__('Home'); ?>
</li>
between the <ul>'s but it doesn't work?

Try
<li>
<?php echo $this->__('Home'); ?>
</li>
Then flush cache if any

Try using this. It will return the base url of your site.
<?php echo Mage::getBaseUrl(); ?>

Related

how to change url of "add to wishlist" button in magento

I am designing a magento website and I am new to it. I am unable to find where to change the URL of Add to Wishlist button.
I have attached the screenshot to check if someone needs.
I will be obliged if someone provides a solution.
addtowishlist
You can change the URL from the following template file:
template/catalog/product/view/addto.phtml
Go to
your_theme > default > template > catalog > product > view > addto.phtml
<?php if ($this->helper('wishlist')->isAllow()) : ?>
<a href="<?php echo $_wishlistSubmitUrl ?>" onclick="productAddToCartForm.submitLight(this, this.href); return false;" class="link-wishlist">
<?php echo $this->__('Add to Wishlist') ?>
</a>
<?php endif; ?>
Here you can change href.

Laravel paginator an all pages

I have an paginator that I use for my forum.
The problem is, when I include this, it displays on every page, including the pages that doesn't need to have the pagination jet.
How Can I fix this?
Now I have this to display my pagination:
{{ $comments->links() }}
I guess that you changed the default view for a paginator to your own - because Laravel hides pagination when it isn't needed.
This is how Laravel handles this:
<?php
$presenter = new Illuminate\Pagination\BootstrapPresenter($paginator);
?>
<?php if ($paginator->getLastPage() > 1): ?>
<ul class="pagination">
<?php echo $presenter->render(); ?>
</ul>
<?php endif; ?>
you can find it in:
vendor/laravel/framework/src/Illuminate/Pagination/views/slider-3.php

How do I add pages to menu?

I am new to Magento; now I am trying to develop a simple example site.
My question is this: how can we add pages to main menu?
create one static block with "Your page name"
Create new category with display mode "Static block only" and "include in navigation menu = YES" and select your cms block and save category. And see in front-end side this will be added in navigation item.
Here is the official Magento recommendation on how to do this: http://www.magentocommerce.com/knowledge-base/entry/adding-page-links-in-the-navigation-bar
To add a CMS page link to top navigation the hard way, you should override /mnt/www/x1886/app/design/frontend/default/default/template/catalog/navigation/top.phtml.
There are plenty tutorials out there about how to override files in Magento.
Change a change where I placed a comment:
<div class="header-nav-container">
<div class="header-nav">
<h4 class="no-display"><?php echo $this->__('Category Navigation:') ?></h4>
<ul id="nav">
<!-- ADD ADDITIONAL LINKS HERE -->
<?php foreach ($this->getStoreCategories() as $_category): ?>
<?php echo $this->drawItem($_category) ?>
<?php endforeach ?>
</ul>
</div>
<?php echo $this->getChildHtml('topLeftLinks') ?>
</div>

Product category name on product viewing page

I'm working on a website. Upon clicking the product it shows all the details of it. But my client want me to show parent category of categroy of the product at top, above the image. Please help me about it. I'm a budding developer.
Try this may be help someone else.
<?php $_helper = $this->helper('catalog/output');?>
<?php $_category_detail=Mage::registry('current_category');?>
<?php $_category_detail->getName();?>
<?php $_category_detail->getId(); ?>
You can get the category data from your product object: $_product->getCategory()->getName();. You will have to edit the template at template/catalog/product/view.phtml. In the template file look for <div class="product-img-box"> and add:
<div class="product-img-box">
<h4><?php echo $_product->getCategory()->getName(); ?></h4>
<?php echo $this->getChildHtml('media') ?>
</div>

Category url goes to 404 page in magento

I'm new to magento when i list categories in sidebar. when i click the category name means it will go to 404 error page. If you have any idea Please tell me as soon as possible..
and my code is
<?php
$_categories = Mage::getModel('catalog/category')->load(3)->getChildrenCategories();
if($_categories->count()):
$categorycount = 0;
foreach ($_categories as $_category):
if($_category->getIsActive()):
$cur_category=Mage::getModel('catalog/category')->load($_category->getId());
$layer = Mage::getSingleton('catalog/layer');
$layer->setCurrentCategory($cur_category);
?>
<li><a href="<?php echo $_category->getURL() ?>" title="<?php echo
$this->htmlEscape($_category->getName()) ?>"><span class="categoriesHead"><?php
echo $this->htmlEscape($_category->getName()) ?></span>
</a>
</li>
<?php
endif;
endforeach;
endif;
?>
I had the same issue in 1.5.1 and in my case it was the category url suffix which was expecting a .html suffix but the links were giving me blank. I changed Admin>>System>>Configuration>>Catalog>>Search Engine Optimisations>>category suffix from ".html" to "" (blank) and it's working fine now.
I spend so much time on this problem.... You might have made your categories root categories and not subcategories. Simply drag and drop them into the default category and see if that gives you a better url.
You can see if you are getting a bad url by just appending index.php/name of category in small case/ to the base url
Try this:
Go in admin>>System>>Configuration>>Catalog and under Category permissions select No at Enable option.
Then click Save config and clear Magento cache.

Resources