2016-03-05 195 views
0

enter image description hereenter image description here 我的网站图片已附加。我应该在代码中进行哪些更改才能将2行更改为1个单行。我希望移动图片处于单行..是否改变代码行{if $ smarty.foreach.product_list.iteration%$ number_line == 1 || $ number_line == 1} 使它成为单行吗? 以下是我的完整代码...如何将2行合并为1行

{$number_line = 2} 
{$id_lang = Context::getContext()->language->id} 

{foreach from=$group_cat_info item=cat_info name=g_cat_info} 
<div class="block-content"> 
    <div id="wt-prod-cat-{$cat_info.id_cat}" class="row"> 
     <div class="cat-bar col-sm-12"> 
      <div class="out-wt-prod"> 
      {if $cat_info.cat_icon!='' } 
      <div class="icon_cat" style="background-color:{$cat_info.cat_color|escape:'html':'UTF-8'}"> 
       <img src="{$icon_path|escape:'html':'UTF-8'}{$cat_info.cat_icon|escape:'html':'UTF-8'}" alt=""/> 
      </div> 
      {/if} 
      <h3><a href="{$link->getCategoryLink($cat_info.id_cat, $cat_info.link_rewrite)|escape:'html':'UTF-8'}" title="{$cat_info.cat_name|escape:'html':'UTF-8'}">{$cat_info.cat_name|escape:'html':'UTF-8'}</a></h3> 
      </div> 
     </div> 
     {if $group_cat.show_sub == 1} 
     <div class="sub-cat wt-col-md-2"> 
      <ul class="sub-cat-ul"> 
       {foreach from = $cat_info.sub_cat item=sub_cat name=sub_cat_info} 
        <li><a href="{$link->getCategoryLink($sub_cat.id_category, $sub_cat.link_rewrite)|escape:'html':'UTF-8'}" title="{$sub_cat.name|escape:'html':'UTF-8'}">{$sub_cat.name|escape:'html':'UTF-8'}</a></li> 
       {/foreach} 
       {if isset($cat_info.special_prod_obj) && count($cat_info.special_prod_obj)} 
        {$cat_product = $cat_info.special_prod_obj} 
        {$id_lang = Context::getContext()->language->id} 
        <li class="wt-prod-special"> 
         <a class="product_img_link" href="{$link->getProductLink($cat_product)|escape:'html':'UTF-8'}" title="{$cat_product->name[$id_lang]|escape:'html':'UTF-8'}"> 
         <img class="replace-2x img-responsive" src="{$link->getImageLink($cat_product->link_rewrite[$id_lang], $cat_product->id_image, 'home_default')|escape:'html':'UTF-8'}" alt="" title="{$cat_product->name[$id_lang]|escape:'html':'UTF-8'}"/> 
         </a> 
        </li> 
       {/if} 
      </ul> 
     </div> 
     {/if} 
     <div class="cat-banner wt-col-md-4"> 
      {if $cat_info.cat_banner!='' } 
      <a href="{$link->getCategoryLink($cat_info.id_cat, $cat_info.link_rewrite)|escape:'html':'UTF-8'}" title="{$cat_info.cat_name|escape:'html':'UTF-8'}"><img src="{$banner_path|escape:'html':'UTF-8'}{$cat_info.cat_banner|escape:'html':'UTF-8'}" alt=""/></a> 
      {/if} 
     </div> 
     <div class="product_list wt-col-md-8"> 
      <div class="owl-prod-cat"> 
       {if isset($cat_info.product_list) && count($cat_info.product_list) > 0} 
       {foreach from=$cat_info.product_list item=product name=product_list} 
        {if $smarty.foreach.product_list.iteration % $number_line == 1 || $number_line == 1} 
        <div class="item product-box ajax_block_product"> 
        {/if} 
        <div class="product-container"> 
         <div class="product-container-hover"> 
         <h5 class="product-name"><a href="{$product.link|escape:'html'}">{$product.name|truncate:25:''|escape:'html':'UTF-8'}</a></h5> 
         {hook h='displayProductListReviews' product=$product} 
         {if (!$PS_CATALOG_MODE AND ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))} 
         <div class="content_price"> 
          {if isset($product.show_price) && $product.show_price && !isset($restricted_country_mode)} 
           <span class="price product-price"> 
            {if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if} 
           </span> 
           {if isset($product.specific_prices) && $product.specific_prices && isset($product.specific_prices.reduction) && $product.specific_prices.reduction > 0} 
            {hook h="displayProductPriceBlock" product=$product type="old_price"} 
            <span class="old-price product-price"> 
             {displayWtPrice p=$product.price_without_reduction} 
            </span> 
            {hook h="displayProductPriceBlock" id_product=$product.id_product type="old_price"} 
            {if $product.specific_prices.reduction_type == 'percentage'} 
             <span class="price-percent-reduction">-{$product.specific_prices.reduction * 100}%</span> 
            {/if} 
           {/if} 
           {hook h="displayProductPriceBlock" product=$product type="price"} 
           {hook h="displayProductPriceBlock" product=$product type="unit_price"} 
          {/if} 
         </div> 
         {/if} 
         <div class="product-image-container"> 
          <a class="product_img_link" href="{$product.link|escape:'html'}" title="{$product.legend|escape:html:'UTF-8'}"><img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'home_default')|escape:'html'}" alt="{$product.legend|escape:html:'UTF-8'}" /></a> 
          {if isset($quick_view) && $quick_view} 
            <a class="quick-view" href="{$product.link|escape:'html':'UTF-8'}" rel="{$product.link|escape:'html':'UTF-8'}" title="{l s='Quick view'}"> 
             <span>{l s='Quick view'}</span> 
            </a> 
          {/if} 
          {if isset($product.specific_prices) && $product.specific_prices && isset($product.specific_prices.reduction) && $product.specific_prices.reduction > 0} 
           <div class="wt-label"> 
            <a class="sale-box" href="{$product.link|escape:'html':'UTF-8'}"> 
             {if $product.specific_prices.reduction_type == 'percentage'} 
             <span class="sale-label"> 
              -{$product.specific_prices.reduction*100}% 
             </span> 
             {else} 
              <span class="sale-label"> 
               -{convertPrice price=$product.reduction} 
              </span> 
             {/if} 
            </a> 
           </div> 
          {/if} 
         </div> 
         <div class="wt-prod-hover"> 
          <div class="button-container"> 
           {hook h='displayProductListFunctionalButtons' product=$product} 
           {if ($product.id_product_attribute == 0 || (isset($add_prod_display) && ($add_prod_display == 1))) && $product.available_for_order && !isset($restricted_country_mode) && $product.customizable != 2 && !$PS_CATALOG_MODE} 
            {if (!isset($product.customization_required) || !$product.customization_required) && ($product.allow_oosp || $product.quantity > 0)} 
             {capture}add=1&amp;id_product={$product.id_product|intval}{if isset($static_token)}&amp;token={$static_token}{/if}{/capture} 
             <a class="button ajax_add_to_cart_button btn btn-default" href="{$link->getPageLink('cart', true, NULL, $smarty.capture.default, false)|escape:'html':'UTF-8'}" rel="nofollow" title="{l s='Add to cart'}" data-id-product="{$product.id_product|intval}" data-minimal_quantity="{if isset($product.product_attribute_minimal_quantity) && $product.product_attribute_minimal_quantity > 1}{$product.product_attribute_minimal_quantity|intval}{else}{$product.minimal_quantity|intval}{/if}"> 
              <span>{l s='Add to cart' mod='wtproductcategory'}</span> 
             </a> 
            {else} 
             <span class="button ajax_add_to_cart_button btn btn-default disabled"> 
              <span>{l s='Out of stock' mod='wtproductcategory'}</span> 
             </span> 
            {/if} 
           {/if} 
          </div> 
         </div> 
         </div> 
        </div> 
        {if $smarty.foreach.product_list.iteration % $number_line == 0 ||$smarty.foreach.product_list.last || $number_line == 1} 
        </div> 
        {/if} 
       {/foreach} 
       {else} 
        <div class="item product-box ajax_block_product"> 
         <p class="alert alert-warning">{l s='No product at this time' mod='wtproductcategory'}</p> 
        </div> 
       {/if} 
      </div> 
      {if count($cat_info)>0} 
      <div class="manu-list"> 
       <ul> 
        {foreach from=$cat_info.manufacture item=manu_item name=manufacture} 
         <li><a href="#">{$manu_item->name|escape:'html':'UTF-8'}</a></li> 
        {/foreach} 
       </ul> 
      </div> 
      {/if} 
     </div> 
    </div> 
    </div> 
    {if $cat_info.show_img == 1 && isset($cat_info.id_image) && $cat_info.id_image > 0} 
    <div class="cat-img"> 
     <a href="{$link->getCategoryLink($cat_info.id_cat, $cat_info.link_rewrite)|escape:'html':'UTF-8'}" title="{$cat_info.cat_name|escape:'html':'UTF-8'}"> 
      <img src="{$link->getCatImageLink($cat_info.link_rewrite, $cat_info.id_image, 'category_default')|escape:'html':'UTF-8'}"/> 
     </a> 
    </div> 
    {/if} 
    {/foreach} 
+0

您正在使用响应式设计。它会在不同的屏幕尺寸上显示不同。在我的笔记本电脑上(1920 x 1200),一行中有3种产品。 –

+0

你需要改变所显示的盒子的CSS删除/减少他们之间的差距 –

+0

哈桑纳克维,我想知道如何使它成为所有屏幕大小的一行。你能帮我吗? – Jesy

回答

0

尝试使用响应式设计框架。即使你只是使用lib的一部分,它也会帮助你很长一段路。否则,您可以通过在<scr>标记中添加不同的尺寸来设置图像尺寸以重新缩放尺寸。我推荐这个:Very nice link about design