I need help with the following error:
Fatal error: Call to a member function getno_cart_button() on a non-object in /var/home/hifi-studio_at/www/app/design/frontend/default/theme582/template/catalog/product/compare/list.phtml on line 134
This error occurs only in the compare-list. I made an Attribute called "no_cart_button", if it is checked, the product does not show the "Cart-Button" any more, but instead a "Anfrage (Ask)" linking to a Contact-Page. On all other lists and grids it does work. But why no here? This is the code I used:
<!-- // Warenkorb in Anfrage verändern // Start // -->
<?php if($_product->getno_cart_button()){ ?> <div class="add-to-cart"><button type="button" title="<?php echo $this->__('Anfrage') ?>" class="button btn-cart" onClick="parent.location='/kontakt'"><span><span><?php echo $this->__('Anfrage') ?></span></span></button></div> <?php }
else { ?> <p><button type="button" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Add to Cart')) ?>" class="button btn-cart" onclick="setPLocation('<?php echo $this->helper('catalog/product_compare')->getAddToCartUrl($_item) ?>', true)"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button></p> <?php } ?>
<?php else: ?>
<!-- // Warenkorb in Anfrage verändern // ENDE // -->
This Error also occurs only with Products that have this attribute. Others don't show the cart button nor the error.
Any suggestions? Thanks!
This is the full code:
<?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 [email protected] 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 rwd_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) / / @var $this Mage_Catalog_Block_Product_Compare_List */ ?>
__('Compare Products') ?>
__('Print This Page') ?> getItems()->count() ?> getItems() as $_item): ?> %" /> 2): ?> getItems() as $_item): ?> helper('catalog/product_compare')->getRemoveUrl($_item) ?>');" title="quoteEscape($this->__('Remove This Item')) ?>">__('Remove This Item') ?> getItems() as $_item): ?> getProductUrl($_item) ?>', true)" title="stripTags($_item->getName(), null, true) ?>">helper('catalog/image')->init($_item, 'small_image')->resize(125, 125); ?>" width="125" height="125" alt="stripTags($_item->getName(), null, true) ?>" /> getProductUrl($_item) ?>', true)" title="stripTags($_item->getName(), null, true) ?>">helper('catalog/output')->productAttribute($_item, $_item->getName(), 'name') ?> getReviewsSummaryHtml($_item, 'short') ?> getPriceHtml($_item, true, '-compare-list-top') ?> getItems() as $_item): ?> isSaleable()): ?> getno_cart_button()){ ?>__('Anfrage') ?>" class="button btn-cart" onClick="parent.location='/kontakt'">__('Anfrage') ?>
__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('getAddToCartUrl($_product) ?>')">__('Add to Cart') ?> __('Out of stock') ?> helper('wishlist')->isAllow()) : ?>__('Anfrage') ?>" class="button btn-cart" onClick="parent.location='/kontakt'">__('Anfrage') ?>
__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('getAddToCartUrl($_product) ?>')">__('Add to Cart') ?> __('Out of stock') ?> helper('wishlist')->isAllow()) : ?> /**
* Send remove item request, after that reload windows
*/
function removeItem(url)
{
new Ajax.Request(url, {
parameters: {isAjax: 1, method: 'POST'},
onLoading: function(){$('compare-list-please-wait').show();},
onSuccess: function(transport) {
$('compare-list-please-wait').hide();
window.location.reload();
window.opener.location.reload();
}
});
}
</script>
<script type="text/javascript">window.close();</script>