Magento - How to Resize Product Thumbnails
I am using a Magento extension to control my color swatches. This module also controls catalog list thumbnails. I have experience using resize, but it doesn't seem to be working at the moment.
In developer mode, I have enabled Template Path Hints and it tells me that it's in frontend/.../default/template/catalog/product/list.phtml (typical directory)
Issue: Before clicking, the images default at the correct size. But when I click the thumbnails, they resize to 135x135(skewed, and lower res).
my products-grid in list.phtml:
<ul class="products-grid">
<?php endif ?>
<li class="item<?php if(($i-1)%$_columnCount==0): ?> first<?php elseif($i%$_columnCount==0): ?> last<?php endif; ?>">
<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image"><img id="<?php echo $_product->getId();?>" src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(146,196); ?>" width="146" height="196" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" /></a>
<h2 class="product-name"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($_product->getName(), null, true) ?>"><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></a></h2>
<?php echo $this->getLayout()->createBlock("colorselectorplus/listswatch")->setTemplate("colorselectorplus/listswatches.phtml")->setData('product', $_product)->toHtml(); ?>
<?php if($_product->getRatingSummary()): ?>
<?php echo $this->getReviewsSummaryHtml($_product, 'short') ?>
<?php endif; ?>
<?php echo $this->getPriceHtml($_product, true) ?>
</li&开发者_开发问答gt;
<?php if ($i%$_columnCount==0 || $i==$_collectionSize): ?>
</ul>
If I am correct, this should be controlled by
resize(146,196)
Is it possible that onclick the images are loaded by a different phtml?
Thanks! Let me know if you need a URL. (we're not live yet)
I have contacted the author, and read the FAQ. I have yet to hear a response.
I have encountered the same issue and contacted the Amasty Support. Here is the solution they sent me as the above solution is not a solution.
Our Colors Swatches resize images at this file(lines 78-85): app\code\local\Amasty\Conf\Block\Catalog\Product\View\Type\Configurable.php
$parentProduct = Mage::getModel('catalog/product')->load($simple->getParentId());
if($parentProduct){
$confData[$strKey]['parent_image'] =(string)($this->helper('catalog/image')->init($parentProduct, 'small_image')->resize(135));
if(!('no_selection' == $simple->getSmallImage() || '' == $simple->getSmallImage())){
$confData[$strKey]['small_image'] = (string)($this->helper('catalog/image')->init($simple, 'small_image')->resize(135));
}
else{
$confData[$strKey]['small_image'] = (string)($this->helper('catalog/image')->init($parentProduct, 'small_image')->resize(135));
}
}
This fix was in a local file pertaining to the module we had installed. Just as simple as editing the resize width/height, but not stored in a user-friendly area.
精彩评论