Prestashop 1.7.5 如何通过组合获得产品的基本价格



我正在寻找一个智能变量,它显示具有组合的产品的基本价格。这些组合可能会影响也可能不会影响基本价格。我能够找到包含包含"对价格的影响"价格的组合数组的$combinations变量,但由于某种原因,在调试窗口中,我无法在组合对价格的影响之前找到基本/根价格。

任何人都知道默认情况下是否提供此变量,如果没有,我将如何添加它?

非常感谢。

尝试:

$prod = new Product($id_product);
echo $prod->price;

问候

也许这会有所帮助:使用 getPriceStatic 方法。所以,在/controllers/ProductController 中.php在大约 231 和 234 行下

$productPrice = $this->product->getPrice(true, null, 6);
    $productPricet = $this->product->getPriceStatic($this->product->id, false, null, 2, null, false, false, 1, false, null, null, null, $this->specificPrice);

并在行 ~365 中将其分配给数组

 $this->context->smarty->assign(array(
                'priceDisplay' => $priceDisplay,
                'productPriceWithoutReduction' => $productPriceWithoutReduction,
                'customizationFields' => $customization_fields,
                'id_customization' => empty($customization_datas) ? null : $customization_datas[0]['id_customization'],
                'accessories' => $accessories,
                'product' => $product_for_template,
                'displayUnitPrice' => (!empty($this->product->unity) && $this->product->unit_price_ratio > 0.000000) ? true : false,
                'product_manufacturer' => $productManufacturer,
                'manufacturer_image_url' => $manufacturerImageUrl,
                'product_brand_url' => $productBrandUrl,
                'productPricet' => $productPricet,
            ));

然后在主题中的 .tpl 文件中

{$productPricet}

编辑:测试了它,不能很好地工作 - 你得到的与下面的解决方法完全相同...... - 对不起。简单的解决方法是在 tpl 文件中使用格式化的 {$productPriceWithoutReduction}>将显示基本属性价格,并且在属性更改期间不会更改。

相关内容

最新更新