Magento新产品小部件图像大小调整

Magento新产品小部件图像大小调整,magento,widget,grid,product,Magento,Widget,Grid,Product,我正在使用自定义模板运行magento。在过去的一周里,我一直在尝试将新产品小部件(无论是网格还是列表)的图像大小放大到232px宽,280px长。我已在以下位置成功找到新的_grid.phtml和新的_list.phtml文件: app/design/frontend/base/default/template/catalog/product/widget/new/content。 我还改变了图像的大小,从我认为的85px宽度和85px长度到我想要的232px宽度和280px长度。图像似乎被放

我正在使用自定义模板运行magento。在过去的一周里,我一直在尝试将新产品小部件(无论是网格还是列表)的图像大小放大到232px宽,280px长。我已在以下位置成功找到新的_grid.phtml和新的_list.phtml文件: app/design/frontend/base/default/template/catalog/product/widget/new/content。 我还改变了图像的大小,从我认为的85px宽度和85px长度到我想要的232px宽度和280px长度。图像似乎被放大了,但帧在85px 85px处保持不变,而不是放大图像的帧和图像本身。因此,在85px×85px的图像帧中,您只能看到图像的一小部分。 我所说的小部件是可以从CMS页面插入的新产品小部件。我正在运行magento社区版1.7

下面是新的_grid.phtml的代码片段。感谢您的帮助。谢谢

<div class="widget-products">
<?php $_columnCount = $this->getColumnCount(); ?>
    <?php $i=0; foreach ($_products->getItems() as $_product): ?>
    <?php if ($i++%$_columnCount==0): ?>
    <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($_product->getName(), null, true) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(232,280) ?>" width="232" height="280" alt="<?php echo $this->stripTags($_product->getName(), null, true) ?>" /></a>
            <h3 class="product-name"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($_product->getName(), null, true) ?>)"><?php echo $this->helper('catalog/output')->productAttribute($_product, $_product->getName() , 'name') ?></a></h3>
            <?php echo $this->getReviewsSummaryHtml($_product, 'short') ?>
            <?php echo $this->getPriceHtml($_product, true, '-widget-new-grid') ?>
            <div class="actions">
                <?php if ($_product->isSaleable()): ?>
                    <button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button>
                <?php else: ?>
                    <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
                <?php endif; ?>
                <ul class="add-to-links">
                    <?php if ($this->helper('wishlist')->isAllow()) : ?>
                        <li><a href="<?php echo $this->getAddToWishlistUrl($_product) ?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a></li>
                    <?php endif; ?>
                    <?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
                        <li><span class="separator">|</span> <a href="<?php echo $_compareUrl ?>" class="link-compare"><?php echo $this->__('Add to Compare') ?></a></li>
                    <?php endif; ?>
                </ul>
            </div>
        </li>
    <?php if ($i%$_columnCount==0 || $i==count($_products)): ?>
    </ul>
    <?php endif ?>
    <?php endforeach; ?>


    这几乎肯定是一个css问题

    您似乎正确地调整了图像的大小:

    <?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(232,280) ?>
    
    我强烈建议您打开您最喜欢的浏览器的检查工具,找出覆盖服务器端更改的确切规则


    为所有像我一样遇到这件事的人干杯

    通过更改new.phtml中的网格列表来更正我的错误:

    致:


    您可以使用CSS For Image将高度和宽度设置为所需的值,而无需像这样更新模板

    <Your Image class/id>{
    width:50%;
    max-width:100%;
    }
    

    哦,上帝!!!你应该得到你最爱的人的一个吻!非常感谢你!工作得很有魅力!
    <Your Image class/id>{
    width:50%;
    max-width:100%;
    }
    
    jQuery("document").ready(function() {
        jQuery(".product-image img").attr({ width: "100%", height: "auto" });
    });