2017-08-03 81 views
-1

当前我的Prestashop商店中的wishlist模块仅显示产品图像和标题。有两个愿望清单视图,客户帐户视图和共享链接视图。我想在这两个视图中显示价格。我试着加入在Prestashop Wishlist模块中显示产品价格

$price = Product::getPriceStatic($productid); 

到managewishlist.php的不同部分,增加

<span id="our_price_display">{convertPrice price=$productPrice}</span> 

到managewishlist TPL文件,但没有显示出来。我正在运行版本1.5.6.2。

编辑:我也尝试添加

{if !$priceDisplay || $priceDisplay == 2}  
{assign var='productPrice' value=$product->getPrice(true, $smarty.const.NULL, $priceDisplayPrecision)} 
{assign var='productPriceWithoutReduction' value=$product->getPriceWithoutReduct(false, $smarty.const.NULL)} 
{elseif $priceDisplay == 1} 
{assign var='productPrice' value=$product->getPrice(false, $smarty.const.NULL, $priceDisplayPrecision)} 
{assign var='productPriceWithoutReduction' value=$product->getPriceWithoutReduct(true, $smarty.const.NULL)} 
{/if} 

到managewishlist.tpl但它所做的心愿消失

+1

请提供更多的细节,什么版本的prestashop?你有什么尝试?你想在哪里增加价格?诸如“请为我做这件事”倾向于很快被删除...... – defuzed

+0

感谢您的建议,我只是添加了这些细节。我感谢任何帮助。 –

+0

您是否已将'productPrice'添加到smarty变量(使用'$ this-> context-> smarty-> assign')? – defuzed

回答

0

不知道你需要编辑但这应该对PS 1.5是正确的实际文件。在blockwishlist X

/view.php添加注释行:

for ($i = 0; $i < sizeof($products); ++$i) 
    { 
     $obj = new Product($products[$i]['id_product'], false, $context->language->id); 
     if (!Validate::isLoadedObject($obj)) 
      continue; 
     else 
     { 
      if ($products[$i]['id_product_attribute'] != 0 && isset($combination_imgs[$products[$i]['id_product_attribute']][0])) 
      { 
       $combination_imgs = $obj->getCombinationImages($context->language->id); 
       $products[$i]['cover'] = $obj->id.'-'.$combination_imgs[$products[$i]['id_product_attribute']][0]['id_image']; 
      } 
      else 
      { 
       $images = $obj->getImages($context->language->id); 
       foreach ($images AS $k => $image) 
       { 
        if ($image['cover']) 
        { 
         $products[$i]['cover'] = $obj->id.'-'.$image['id_image']; 
         break; 
        } 
       } 
       if (!isset($products[$i]['cover'])) 
        $products[$i]['cover'] = $context->language->iso_code.'-default'; 
      } 
      // ADD THIS LINE! 
      $products[$i]['price'] = Product::getPriceStatic($obj->id); 
     } 
    } 

然后在view.tpl(不知道PS 1.5.x使用/ templates/view/dir还是不要试两个),你可以随便使用{convertPrice price=$product.price}

实际上还没有测试过,但至少应该给你一个好的起点。

编辑另外请注意,不建议直接编辑模块文件。然而,由于没有选项覆盖在PS 1.5.x的模块,你唯一的选择是:

一)编辑模块直接 - 这意味着当你更新所述模块

B)的复制,将IF /打破模块和重命名它 - 这是凌乱的,但恕我直言的缺点a)

+0

我真的很感谢帮助,我会继续努力。我的文件不同,所以我一定不会把它放在正确的位置。 –

相关问题