Magento Pagination in Ajax - ajax

I have a problem in pagination.
It is creating a link like this: www.website.com/shoes.html&p=1
The correct would be like this: www.website.com/shoes.html?p=1
In place of "&" would have to be this "?". How do change it? Or how do disable the pagination in ajax?
I looked inside the page "pager.phtml" but is ok
<?php foreach ($this->getFramePages() as $_page): ?>
<?php if ($this->isPageCurrent($_page)): ?>
<li class="current"><?php echo $_page ?></li>
<?php else: ?>
<li><?php echo $_page ?></li>
<?php endif;?>
<?php endforeach;?>
Thank you

Related

Magento removing item options in checkout order review section

In my website i have enable one page checkout.Also there are only downloadable products.
I need to remove Item options in Checkout Order Review section (Please refer below image. I need to remove highlighted parts.)
Can anyone let me know how to do this please.
Thank You.
I think you want to remove custom option in checkout.
The custom options are displayed in the default template (in \app\design\frontend\base\default\template\checkout\cart\item\default.phtml) with the following snippet:
<?php if ($_options = $this->getOptionList()):?>
<dl class="item-options">
<?php foreach ($_options as $_option) : ?>
<?php $_formatedOptionValue = $this->getFormatedOptionValue($_option) ?>
<dt><?php echo $this->escapeHtml($_option['label']) ?></dt>
<dd<?php if (isset($_formatedOptionValue['full_view'])): ?> class="truncated"<?php endif; ?>><?php echo $_formatedOptionValue['value'] ?>
<?php if (isset($_formatedOptionValue['full_view'])): ?>
<div class="truncated_full_value">
<dl class="item-options">
<dt><?php echo $this->escapeHtml($_option['label']) ?></dt>
<dd><?php echo $_formatedOptionValue['full_view'] ?></dd>
</dl>
</div>
<?php endif; ?>
</dd>
<?php endforeach; ?>
</dl>
<?php endif;?>
So, you comment this or remove as per your convenience.
But in your case you are using onepage checkout So, you have to check this code in extensions phtml file.
You need to go in app\design\frontend\rwd\default\template\downloadable\checkout\onepage\review\item.phtml
Open item.phtml file
And in this file here is code what is displaying that
<?php if ($links = $this->getLinks()): ?>
<dl class="item-options">
<dt><?php echo $this->getLinksTitle() ?></dt>
<?php foreach ($links as $link): ?>
<dd><?php echo $this->escapeHtml($link->getTitle()); ?></dd>
<?php endforeach; ?>
</dl>
<?php endif; ?>
So you can remove or just comment this <!--<dl>...</dl>--> and you will get you want.
And yes go to your theme folder if your is not rwd.

hide wishlist button if item is already in wishlist in magento

Magento ver. 1.9.1.0 .
hide wishlist button if item is already in current customers wishlist or change it to filled heart
<?php if ($this->helper('wishlist')->isAllow()) : ?>
<div class="ajax-wishlist">
<a href="#"
onclick='ajaxWishlist("<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>","<?php echo $_product->getId()?>");return false;' class="link-wishlist" title="Add to Wishlist">
<i class="fa fa-heart-o"></i>
</a>
</div>
<?php endif; ?>
further i would like to update wishlist button dynamically. ie fa-heart-o TO fa-heart as soon as wishlist is updated..
[new to magento]
reference Check whether a product is in the wishlist or not
I tried this.
<?php $wishlist = Mage::getModel('wishlist/item')->load($_product->getId(),'product_id');
if($wishlist->getId())
//product is added
echo "Added! - Product is in the wishlist!";
else
//add product to wishlist
echo "<a href='".$this->helper('wishlist')->getAddUrl($_product) ."'>Add This?</a>";
;?>
It shows all products that have been added to the wishlist by any customers.
and how to use above code for homepage products? ie new arrival, most viewed etc. It shows error.call to a member function getId() on non object
If you need to check if a product is in the wishlist and display that information instead of the default Magento “Add to Wishlist” link, this article is for you. To simplify things I will explain how to detect if a product is in the wishlist on category and product page but the principle is the same for any other pager or block. You just need to be sure that you have the product id available. Everything else should work fine on any page.
Category page
Open template/catalog/product/list.phtml
Find the wishlist link code. If you are using the base theme it should look something like this:
<?php if ($this->helper('wishlist')->isAllow()) : ?>
<li><?php echo $this->__('Add to Wishlist') ?></li>
<?php endif; ?>
Replace it with:
<?php if ($this->helper('wishlist')->isAllow()) : ?>
<?php foreach (Mage::helper('wishlist')->getWishlistItemCollection() as $_wishlist_item): ?>
<?php $_in_wishlist = false; ?>
<?php if($_product->getId() == $_wishlist_item->getProduct()->getId()): ?>
<?php $_in_wishlist = true; break; ?>
<?php endif; ?>
<?php endforeach; ?>
<?php if(!empty($_in_wishlist) && $_in_wishlist): ?>
<li><span class="in-wishlist"><?php echo $this->__('Already in Wishlist') ?></span></li>
<?php else: ?>
<li><?php echo $this->__('Add to Wishlist') ?></li>
<?php endif; ?>
<?php endif; ?>
Product page
Open template/catalog/product/view/addto.phtml
Find the wishlist link code. If you are using the base theme it should look something like this:
<?php if ($this->helper('wishlist')->isAllow()) : ?>
<li><?php echo $this->__('Add to Wishlist') ?></li>
<?php endif; ?>
Replace it with:
<?php if ($this->helper('wishlist')->isAllow()) : ?>
<?php foreach (Mage::helper('wishlist')->getWishlistItemCollection() as $_wishlist_item): ?>
<?php $_in_wishlist = false; ?>
<?php if($_product->getId() == $_wishlist_item->getProduct()->getId()): ?>
<?php $_in_wishlist = true; break; ?>
<?php endif; ?>
<?php endforeach; ?>
<?php if(!empty($_in_wishlist) && $_in_wishlist): ?>
<li><span class="is-wishlist"><?php echo $this->__('Already in Wishlist') ?></span></li>
<?php else: ?>
<li><?php echo $this->__('Add to Wishlist') ?></li>
<?php endif; ?>
<?php endif; ?>
That’s it. As I said above you can use this method to check if the product is in the wishlist on any Magento page or block as long as you have a product id available.

How I get product options block in catalog

I did an quick view in product catalog (list.phtml) using Magento 1.7, but I'm unable to get the FULL product options block so that it is identical to the product page (showing select, radio button, select multiple, etc.). Can someone help me?
*Sorry for my bad English.
I tried put the view.phtml' code, but this don't work.
I also tried some tutorials that I found on google, but what worked converted all options in select, but I need to get entire block.
...
<?php if (!$this->hasOptions()):?>
<div class="add-to-box">
<?php if($_product->isSaleable()): ?>
<?php echo $this->getChildHtml('addtocart') ?>
<?php if( $this->helper('wishlist')->isAllow() || $_compareUrl=$this->helper('catalog/product_compare')->getAddUrl($_product)): ?>
<span class="or"><?php echo $this->__('OR') ?></span>
<?php endif; ?>
<?php endif; ?>
<?php echo $this->getChildHtml('addto') ?>
</div>
<?php endif; ?>
<?php echo $this->getChildHtml('other');?>
<?php if ($_product->isSaleable() && $this->hasOptions()):?>
<?php echo $this->getChildChildHtml('container1', '', true, true) ?>
<?php endif;?>
...

Display specific category products on no results search page

When we search for a wrong keyword like "sdfsdf" in magento site, it displays that "your search returns no results". Here I want to display any category products like "similar products" category as we display "best sellers" on home page. I have tried by calling the block in the catalogsearch.xml. BUt catalogsearch.xml doent contain any block for no results. So how can I display any category products on no results page.
I have an idea like can we display a specific category products on .phtml page? If we can display specific category of products then we can call that category from "result.phtml". Any help?
my result.phtml
<?php if($this->getResultCount()): ?>
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
<div class="page-title category-title">
<?php if ($this->helper('rss/catalog')->getTagFeedUrl()): ?>
<?php echo $this->__('Subscribe to Feed') ?>
<?php endif; ?>
<h1><?php echo ($this->getHeaderText() || $this->getHeaderText() === false) ? $this->getHeaderText() : $this->__("Search results for '%s'", $this->helper('catalogsearch')->getEscapedQueryText()) ?></h1>
</div>
<?php if ($messages = $this->getNoteMessages()):?>
<p class="note-msg">
<?php foreach ($messages as $message):?>
<?php echo $message?><br />
<?php endforeach;?>
</p>
<?php endif; ?>
<?php echo $this->getProductListHtml() ?>
<?php else: ?>
<div class="page-title category-title">
<h1><?php echo ($this->getHeaderText() || $this->getHeaderText() === false) ? $this->getHeaderText() : $this->__("Search results for '%s'", $this->helper('catalogsearch')->getEscapedQueryText()) ?></h1>
</div>
<p class="note-msg">
<?php echo ($this->getNoResultText()) ? $this->getNoResultText() : $this->__('Your search returns no results.') ?>
<?php if ($messages = $this->getNoteMessages()):?>
<?php foreach ($messages as $message):?>
<br /><?php echo $message?>
<?php endforeach;?>
<?php endif; ?>
</p>
<div class="search-noresults">
<h1>Meanwhile, You may go through our featured categories:</h1>
</div>
<?php echo $this->getLayout()->CreateBlock('catalog/product_list')->setCategoryId(18)->setTemplate('catalog/product/list.phtml')->toHtml();?>
<?php endif; ?>
A simple solution is within catalogsearch/result.phtml template you would need to setup what happens when there are no results
<?php if($this->getResultCount()): ?>
SHOW RESULTS
LEAVE DEFAULT
<?php else: ?>
NO RESULTS
<?php echo $this->getLayout()->createBlock('catalog/product_list')->setCategoryId(4)->setTemplate('catalog/product/list.phtml')->toHtml() ?>
<?php endif; ?>

Magento Add url link to open a specific product tab

Magento 1.7.0.0
ok i'm using the product tabs that are available in the modern theme. I've added a custom tab to add reviews as a tab [sucess].
Now where it says:
'Be the first to review this product'
i want this link to go to the tab on that page and not go off to the reviews page.
i realise i need to some javascript but it's just i can't work out how to call a tab.
any ideas?
thanks.
Andy.
if you already using jQuery... you could just simply "hack" it out like this
jQuery(document).ready(function($){
$("#addreview").attr("href", "#review-form");
$("#addreview").click(function(){
$(".product-tabs").children("li").removeClass("active");
$("#product_tabs_reviews").addClass("active");
$(".product-tabs-content").css("display", "none");
$("#product_tabs_reviews_contents").css("display", "block");
});
});
be aware to change the selector according to your own markup
My code looks like this in tabs.phtml:
<div id="tabs">
<ul>
<?php foreach ($this->getTabs() as $_index => $_tab): ?>
<?php if($this->getChildHtml($_tab['alias'])): ?>
<li class="<?php echo !$_index?' active first':(($_index==count($this->getTabs())-1)?' last':'')?>"><?php echo $_tab['title']?></li>
<?php endif; ?>
<?php endforeach; ?>
</ul>
<div class="clearer"></div>
<?php foreach ($this->getTabs() as $_index => $_tab): ?>
<?php if($this->getChildHtml($_tab['alias'])): ?>
<div class="product-tabs-content" id="<?php echo $_tab['alias'] ?>"><?php echo $this->getChildHtml($_tab['alias']) ?></div>
<?php endif; ?>
<?php endforeach; ?>
</div>
and then adding:
jquery-ui-tabs.js and the relevant .css

Resources