<?php
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE_AFL.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magento.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magento.com for more information.
 *
 * @category    design
 * @package     base_default
 * @copyright   Copyright (c) 2006-2015 X.commerce, Inc. (http://www.magento.com)
 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
?>
<div class="page-title">
    <h1><?php echo $this->__('My Tags') ?></h1>
</div>
<?php echo $this->getMessagesBlock()->toHtml() ?>
<p class="my-tag-edit">
    <a href="#" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Delete')) ?>" onclick="if(confirm('<?php echo Mage::helper('core')->quoteEscape($this->__('Are you sure you want to delete this tag?'), true) ?>')) window.location='<?php echo $this->getTagInfo()->getRemoveTagUrl(); ?>'; return false;" class="button btn-remove"><span><?php echo $this->__('Delete') ?></span></a>
    <?php echo $this->__('<strong>Tag Name:</strong> %s', $this->escapeHtml($this->getTagInfo()->getName())) ?>
</p>
<div class="clearer"></div>
<?php echo $this->getToolbarHtml() ?>
<table class="data-table" id="my-tags-table">
<?php if( sizeof($this->getMyProducts()) > 0 ): ?>
    <col width="1" />
    <col />
    <col width="1" />
    <tbody>
    <?php $iterator = 0 ?>
    <?php foreach($this->getMyProducts() as $_product): ?>
        <tr<?php if($iterator % 2 == 0): ?> class="odd"<?php $iterator++;endif; ?>>
            <td><a href="<?php echo $_product->getProductUrl(); ?>" title="<?php echo $this->escapeHtml($_product->getName()) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(100, 100); ?>" width="100" height="100" alt="<?php echo $this->escapeHtml($_product->getName()) ?>" /></a></td>
            <td>
                <h2 class="product-name"><a href="<?php echo $_product->getProductUrl() ?>"><?php echo $this->escapeHtml($_product->getName()) ?></a></h2>
                <?php echo $this->getReviewsSummaryHtml($_product, 'short') ?>
                <?php echo $this->getPriceHtml($_product) ?>
                <?php echo $this->escapeHtml($_product->getDescription()) ?>
            </td>
            <td>
                <?php if($_product->isSaleable()): ?>
                    <?php $params[Mage_Core_Model_Url::FORM_KEY] = Mage::getSingleton('core/session')->getFormKey() ?>
                    <?php $params['product'] = $_product->getId(); ?>
                    <button type="button" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Add to Cart')) ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getUrl('checkout/cart/add', $params) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button>
                <?php endif; ?>
                <?php if ($this->helper('wishlist')->isAllow()) : ?>
                <ul class="add-to-links">
                    <li>
                        <a href="<?php echo $this->getUrl('wishlist/index/add',array('product'=>$_product->getId())) ?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a>
                    </li>
                </ul>
                <?php endif; ?>
            </td>
        </tr>
    <?php endforeach; ?>
    </tbody>
<?php else: ?>
    <tbody>
        <tr>
            <td>
                <?php echo $this->__("Unable to find any products tagged with '%s' in the current store", $this->escapeHtml($this->getTagInfo()->getName()) ) ?>
            </td>
        </tr>
    </tbody>
<?php endif; ?>
</table>
<script type="text/javascript">decorateTable('my-tags-table')</script>
<?php echo $this->getToolbarHtml() ?>
<div class="buttons-set">
    <p class="back-link"><a href="<?php echo $this->getUrl('*/*/')?>"><small>&laquo; </small><?php echo $this->__('Back to Tags List')?></a></p>
</div>
