duanpiyao2734 2014-11-29 17:06
浏览 59
已采纳

编辑Magento 1.9 CSS以自定义类别布局

I'm trying to customize the list.phtml page on magento for a specific category .

I took away the product image as well as the product description and now I want to push the product name over to the left where the image was . I tried using a negative value for margin-left in my css file which takes care of the text but it seems as if something is floating in front of the text (i.e. the text slides behind white space.) Any ideas ? Another way of going about this maybe ?

Thanks !

Before:

http://i.stack.imgur.com/mtlZX.jpg

After:

http://i.stack.imgur.com/OQpCW.jpg

I have also tried modifying these values in the styles.css:

.product-view .product-shop {
   width: 50%;
   float: left;
}

.product-img-box {
   width: 50%;
   float: right;
}

</div>
  • 写回答

1条回答 默认 最新

  • dongzong2017 2014-11-29 20:34
    关注

    Try adding this after removing the images to your css file.

    .products-list .product-shop {
      float: right;
      padding-left: 20px;
      width: 100%;
    }
    

    This will let the products div take up the entire width. But you should first remove the images,

    To remove the images go to your Magento installation (1.9.1) and then go to app/design/frontend/YOURMAGENTOTHEME/default/template/catalog/product/list.phtml

    YOURMAGENTOTHEME is by default rwd in 1.9 and newer

    Now you need to remove the following between line 50 and 63 (1.9.1)

      <?php // Product Image ?>
                <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image">
                    <?php /* Based on the native RWD styling, product images are displayed at a max of ~400px wide when viewed on a
                            one column page layout with four product columns from a 1280px viewport. For bandwidth reasons,
                            we are going to serve a 300px image, as it will look fine at 400px and most of the times, the image
                            will be displayed at a smaller size (eg, if two column are being used or viewport is smaller than 1280px).
                            This $_imgSize value could even be decreased further, based on the page layout
                            (one column, two column, three column) and number of product columns. */ ?>
                    <?php $_imgSize = 300; ?>
                    <img id="product-collection-image-<?php echo $_product->getId(); ?>"
                         src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->keepFrame(false)->resize($_imgSize); ?>"
                         alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" />
                </a>
                <?php // Product description ?>
    

    This is the more correct way, alternatively you can add this to your CSS to hide the image:

    .product-image > img{
    display:none;    
    }
    

    This is incorrect however.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 java 的protected权限 ,问题在注释里
  • ¥15 这个是哪里有问题啊?