EDITED:Here is what I have now:
_______________
I would like this info to be above the add to cart button:
Here is the code from the product page NOW:
`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) ?>" />
<h2 class="product-name"><a href="#" onclick="setPLocation('<?php echo $this->getProductUrl($_item) ?>', true)" title="<?php echo $this->stripTags($_item->getName(), null, true) ?>"><?php echo $this->helper('catalog/output')->productAttribute($_item, $_item->getName(), 'name') ?></a></h2>
<?php echo $this->getReviewsSummaryHtml($_item, 'short') ?>
<?php echo $this->getPriceHtml($_item, true, '-compare-list-top') ?>
<?php if($_item->isSaleable()): ?>
<p><button type="button" title="<?php echo $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 else: ?>
<p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
<?php endif; ?>
<?php if ($this->helper('wishlist')->isAllow()) : ?>
<ul class="add-to-links">
<li><a href="<?php echo $this->getAddToWishlistUrl($_item) ?>" class="link-wishlist" onclick="setPLocation(this.href, true)"><?php echo $this->__('Add to Wishlist') ?></a>`
and here is the code from the PRODUCT PAGE that I am (naively) attempting to copy over..<?php echo (($_product->getResource()->getAttribute('hersteller')->getFrontend()->getValue($_product) && $_product->getResource()->getAttribute('hersteller')->getFrontend()->getValue($_product) != "Nein") ? $_product->getResource()->getAttribute('hersteller')->getFrontend()->getValue($_product) : ''); ?>
<?php echo (($_product->getResource()->getAttribute('weingut')->getFrontend()->getValue($_product) && $_product->getResource()->getAttribute('weingut')->getFrontend()->getValue($_product) != "Nein") ? $_product->getResource()->getAttribute('weingut')->getFrontend()->getValue($_product) : ''); ?>
<?php echo (($_product->getResource()->getAttribute('ob_hersteller')->getFrontend()->getValue($_product) && $_product->getResource()->getAttribute('ob_hersteller')->getFrontend()->getValue($_product) != "Nein") ? $_product->getResource()->getAttribute('ob_hersteller')->getFrontend()->getValue($_product) : ''); ?>
old post
I am trying to add more attributes to the compare page in magento but i get the following error when I add the code that successfully worked on the product page.
MY PRODUCT PAGE HAS THE FOLLOWING:
* image
* model name
* price
* add to cart button
I WOULD LIKE THE FOLLOWING INSTEAD:
* image
* Brand OR Vineyard OR Destillery
* model name
* price
* in stock
* delivery time
* add to cart button
This is how I have it on my product page's "list.phtml". However, when I copy that code to the compare "list.phtml" I get the following error:
Fatal error: Call to a member function getResource() on a non-object in ........./app/design/frontend/base/default/template/catalog/product/compare/list.phtml on line 68
here is a product page with the code working:
http://weinwerk-klimascout.de/obstbrand/selection-kirsch.html
and here is the code:
<h2>
<?php echo (($_product->getResource()->getAttribute('hersteller')->getFrontend()->getValue($_product) && $_product->getResource()->getAttribute('hersteller')->getFrontend()->getValue($_product) != "Nein") ? $_product->getResource()->getAttribute('hersteller')->getFrontend()->getValue($_product) : ''); ?>
<?php echo (($_product->getResource()->getAttribute('weingut')->getFrontend()->getValue($_product) && $_product->getResource()->getAttribute('weingut')->getFrontend()->getValue($_product) != "Nein") ? $_product->getResource()->getAttribute('weingut')->getFrontend()->getValue($_product) : ''); ?>
<?php echo (($_product->getResource()->getAttribute('ob_hersteller')->getFrontend()->getValue($_product) && $_product->getResource()->getAttribute('ob_hersteller')->getFrontend()->getValue($_product) != "Nein") ? $_product->getResource()->getAttribute('ob_hersteller')->getFrontend()->getValue($_product) : ''); ?>
</h2>
What's wrong?