问题描述
我正在查看文件themes/my_theme/templates/catalog/_partials/product-prices.tpl
。在那里尝试显示含税的实际价格:<span class="price-ttc">{Tools::displayPrice($product.price_amount*$prix_ttc)} TTC </span>
。
但是,我在price_amount
中找不到名为web/controllers/front/ProductController.PHP
的属性:
public function getTemplateVarProduct()
{
$productSettings = $this->getProductPresentationSettings();
// Hook displayProductExtraContent
$extraContentFinder = new ProductExtraContentFinder();
$product = $this->objectPresenter->present($this->product);
$product['id_product'] = (int) $this->product->id;
$product['out_of_stock'] = (int) $this->product->out_of_stock;
$product['new'] = (int) $this->product->new;
$product['id_product_attribute'] = $this->getIdProductAttributeByRequestOrGroup();
$product['minimal_quantity'] = $this->getProductMinimalQuantity($product);
$product['quantity_wanted'] = $this->getrequiredQuantity($product);
$product['extraContent'] = $extraContentFinder->addParams(array('product' => $this->product))->present();
$product['ecotax'] = Tools::convertPrice((float) $product['ecotax'],$this->context->currency,true,$this->context);
$product_full = Product::getProductProperties($this->context->language->id,$product,$this->context);
$product_full = $this->addProductCustomizationData($product_full);
$product_full['show_quantities'] = (bool) (
Configuration::get('PS_disPLAY_QTIES')
&& Configuration::get('PS_STOCK_MANAGEMENT')
&& $this->product->quantity > 0
&& $this->product->available_for_order
&& !Configuration::isCatalogMode()
);
$product_full['quantity_label'] = ($this->product->quantity > 1) ? $this->trans('Items',array(),'Shop.Theme.Catalog') : $this->trans('Item','Shop.Theme.Catalog');
$product_full['quantity_discounts'] = $this->quantity_discounts;
if ($product_full['unit_price_ratio'] > 0) {
$unitPrice = ($productSettings->include_taxes) ? $product_full['price'] : $product_full['price_tax_exc'];
$product_full['unit_price'] = $unitPrice / $product_full['unit_price_ratio'];
}
$group_reduction = GroupReduction::getValueForProduct($this->product->id,(int) Group::getCurrent()->id);
if ($group_reduction === false) {
$group_reduction = Group::getReduction((int) $this->context->cookie->id_customer) / 100;
}
$product_full['customer_group_discount'] = $group_reduction;
$product_full['title'] = $this->getProductPageTitle();
$presenter = $this->getProductPresenter();
return $presenter->present(
$productSettings,$product_full,$this->context->language
);
}
能告诉我它在哪里吗?
解决方法
PrestaShop 1.7使用Presenter
s
您的属性在这里定义:
/src/Adapter/Presenter/Product/ProductLazyArray.php
方法中的addPriceInformation