2014-07-03 50 views
0

即時通訊使用稱爲「prestashop」的商店軟件,並得到了一個小問題。如果您以客戶身份登錄,則可以選擇將產品添加到收藏夾中。我們在我們的產品簡短描述中使用圖像,並且默認情況下,設計圖產品會顯示簡短描述。由於我們使用圖片的事實,我們只能得到「& nbsp'」而不是圖片。產品shortdescription是隱形的

這是favoriteproduct->前線辦公室的控制器 - >賬號:

class FavoriteproductsAccountModuleFrontController extends ModuleFrontController 
{ 
public $ssl = true; 

public function init() 
{ 
    parent::init(); 

    require_once($this->module->getLocalPath().'FavoriteProduct.php'); 
} 

public function initContent() 
{ 
    parent::initContent(); 

    if (!Context::getContext()->customer->isLogged()) 
     Tools::redirect('index.php?controller=authentication&redirect=module&module=favoriteproducts&action=account'); 

    if (Context::getContext()->customer->id) 
    { 
     $this->context->smarty->assign('favoriteProducts', FavoriteProduct::getFavoriteProducts((int)Context::getContext()->customer->id, (int)Context::getContext()->language->id)); 
     $this->setTemplate('favoriteproducts-account.tpl'); 
    } 
} 
} 

這是.tpl:

{capture name=path} 
    <a href="{$link->getPageLink('my-account', true)|escape:'html':'UTF-8'}"> 
     {l s='My account' mod='favoriteproducts'} 
    </a> 
    <span class="navigation-pipe">{$navigationPipe}</span> 
    <span class="navigation_page">{l s='My favorite products' mod='favoriteproducts'}</span> 
{/capture} 

<div id="favoriteproducts_block_account"> 
    <h1 class="page-heading">{l s='My favorite products' mod='favoriteproducts'}</h1> 
    {if $favoriteProducts} 
     <ul class="row"> 
      {foreach from=$favoriteProducts item=favoriteProduct} 
      <li class="col-xs-12"> 
       <div class="favoriteproduct clearfix inner-content"> 
        <a 
        class="product_img_link" 
        href="{$link->getProductLink($favoriteProduct.id_product, null, null, null, null, $favoriteProduct.id_shop)|escape:'html':'UTF-8'}"> 
         <img 
         src="{$link->getImageLink($favoriteProduct.link_rewrite, $favoriteProduct.image, 'medium_default')|escape:'html':'UTF-8'}" 
         alt=""/> 
        </a> 
        <p class="s_title_block"> 
         <a href="{$link->getProductLink($favoriteProduct.id_product, null, null, null, null, $favoriteProduct.id_shop)|escape:'html':'UTF-8'}"> 
          {$favoriteProduct.name|escape:'html':'UTF-8'} 
         </a> 
        </p> 
        <div class="product_desc">{$favoriteProduct.description_short|strip_tags|escape:'html':'UTF-8'}</div> 
        <div class="remove"> 
         <a href="#" onclick="return false" rel="ajax_id_favoriteproduct_{$favoriteProduct.id_product}"> 
          <i class="icon-remove"></i> 
         </a> 
        </div> 
       </div> 
      </li> 
      {/foreach} 
     </ul> 
    {else} 
     <p class="alert alert-warning">{l s='No favorite products have been determined just yet. ' mod='favoriteproducts'}</p> 
    {/if} 

    <ul class="footer_links clearfix"> 
     <li> 
      <a 
      class="btn btn-default button button-small" 
      href="{$link->getPageLink('my-account', true)|escape:'html':'UTF-8'}"> 
       <span> 
        <i class="icon-chevron-left"></i>{l s='Back to your account' mod='favoriteproducts'} 
       </span> 
      </a> 
     </li> 
    </ul> 
</div> 

所以..如果有人能告訴我什麼我必須刪除我會非常感謝。

+0

其實我可以看到短描述爲.html現在刪除「| stripe_Tags」後,任何建議如何啓用HTML? –

回答

0

你應該改變:

{$favoriteProduct.description_short|strip_tags|escape:'html':'UTF-8'} 

{$favoriteProduct.description_short} 

但是,你需要確保代碼是安全的,否則一個人至少可以打破你的佈局