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;?>
...
Related
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.
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.
I am trying to change Magento toplink wishlist button url.
At the moment it is generated in wishlist.xml with
<reference name="top.links">
<block type="wishlist/links" name="wishlist_link" />
<action method="addLinkBlock"><blockName>wishlist_link</blockName></action>
</reference>
This leads me to merry chase in core files with no result.
What I want to do is for the button to direct to /guestwishlist/ instead of /wishlist/ (which in addition atm, for some reason leads to wishlist/index/share).
I've read most of the relevant guides and answers since worked on it for hours.
Just need to change that single button url to go to /guestwishlist/.
EDIT>
This is how my top.links.phtml looks like
<?php if($toplinks && is_array($toplinks)): ?>
<ul class="links">
<?php echo $this->getChildHtml() ?>
<?php foreach($toplinks as $_toplink): ?>
<li<?php if($_toplink['first']||$_toplink['last']): ?> class="<?php if($_toplink['first']): ?>first<?php endif; ?><?php if($_toplink['last']): ?> last<?php endif; ?>"<?php endif; ?> <?php echo $_toplink['liParams'] ?>><?php echo $_toplink['beforeText'] ?><a <?php echo $_toplink['aParams'] ?>><?php echo $_toplink['innerText'] ?></a><?php echo $_toplink['afterText'] ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
You can change the wishlist url to custom url by editing template/page/html/top.links.phtml
There is a foreach in which you can check if current looping item is wishlist, change the default url to your custom URL.
This will make sure whatever changes you are making are only limited to frontend rendering of content and also no need to override any core files.
To change wishlist url in proper magento way you need to override:
app/code/core/Mage/Wishlist/Block/Links.php
in local or community codePool.
In this file you will find code like this:
protected function _toHtml()
{
if ($this->helper('wishlist')->isAllow()) {
$text = $this->_createLabel($this->_getItemCount());
$this->_label = $text;
$this->_title = $text;
$this->_url = $this->getUrl('wishlist');
return parent::_toHtml();
}
return '';
}
Change
$this->_url = $this->getUrl('wishlist');
to
$this->_url = $this->getUrl('guestwishlist');
and you are done.. :)
Now you must create or have a module for guestwishlist.
The core solution works yeah but I had to keep in mind that I only want to change the link for guests, for customers the link had to stay the same.
Specifics to my site used the template/page/links.phtml file instead of top.links.phtml mentioned by Blastfreak so I had to two everything twice :P
I used the solution of checking for the current item in loop.
<ul class="links"<?php if($this->getName()): ?> id="<?php echo $this->getName() ?>"<?php endif;?>>
<?php foreach($_links as $_link): ?>
<?php if ($_link instanceof Mage_Core_Block_Abstract):?>
<?php if ($_link->gettype() == 'wishlist/links' && (!$this->helper('customer')->isLoggedIn())): ?>
<?php echo '<li class="first last">My Wishlist</li>' ?>
<?php else: ?>
<?php echo $_link->toHtml() ?>
<?php endif;?>
<?php else: ?>
<li<?php if($_link->getIsFirst()||$_link->getIsLast()): ?> class="<?php if($_link->getIsFirst()): ?>first<?php endif; ?><?php if($_link->getIsLast()): ?> last<?php endif; ?>"<?php endif; ?> <?php echo $_link->getLiParams() ?>><?php echo $_link->getBeforeText() ?><a href="<?php echo $_link->getUrl() ?>" title="<?php echo $_link->getTitle() ?>" <?php echo $_link->getAParams() ?>><?php echo $_link->getLabel() ?></a><?php echo $_link->getAfterText() ?></li>
<?php endif;?>
<?php endforeach; ?>
</ul>
Had to echo some extra classes for style.
Hi All I want to show 4 popular products on the home page of my magento 1.7.1 install. (The I can select by putting them into a category).
I've set this up by creating a hidden category called popularhome and added 4 products into it.
I've included this in a static block into my home page template by using:
{{block type="catalog/product_list" column_count="4" category_id="17" template="catalog/product/listhome.phtml"}}
My listhome.phtml template looks like this:
<div class="row popularproducts">
<?php
$_productCollection=$this->getLoadedProductCollection();
$_helper = $this->helper('catalog/output');
?>
<?php if(!$_productCollection->count()): ?>
<div class="alert fade in">
<a class="close" data-dismiss="alert">×</a>
<?php echo $this->__('There are no products matching the selection.') ?>
</div>
<?php else: ?>
<?php // List mode ?>
<?php if($this->getMode()!='grid'): ?>
<?php $_iterator = 0; ?>
<?php else: ?>
<?php // Grid Mode ?>
<?php $_collectionSize = $_productCollection->count() ?>
<?php $_columnCount = $this->getColumnCount(); ?>
<?php $i=0; foreach ($_productCollection as $_product): ?>
<?php if ($i++%$_columnCount==0): ?>
<?php endif ?>
<div class="c3">
<?php if(($i-1)%$_columnCount==0): ?><?php elseif($i%$_columnCount==0): ?><?php endif; ?>
<div class="thumbnail">
<img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(225); ?>" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" />
<div class="caption">
<h2 class="product-name"><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></h2>
<?php if($_product->getRatingSummary()): ?>
<?php echo $this->getReviewsSummaryHtml($_product, 'short') ?>
<?php endif; ?>
<?php echo $this->getPriceHtml($_product, true) ?>
</div>
</div>
</div>
<?php if ($i%$_columnCount==0 || $i==$_collectionSize): ?>
<?php endif ?>
<?php endforeach ?>
<?php endif; ?>
<?php endif; ?>
</div>
However this is only showing 2 of the 4 products yet I cannot figure out why? Does anyone see anything I am missing?
Thanks!
First you need to check ,the products that you want to be appear in category page,
Is they really belong to that categories.
After that make sure Backend > Manage Categories > Edit categories > Display settings >
is Anchor = yes Then re-index your catalog.
To verify you need to cross check catalog_category_product and catalog_category_product_index.
If the category id and product id is mapped properly in these tables you should be good to go.
hope this will sure help you!
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; ?>