Prestashop 数据库中的预设数量为0,但实际数量以BO显示

Prestashop 数据库中的预设数量为0,但实际数量以BO显示,prestashop,prestashop-1.7,prestashop-modules,Prestashop,Prestashop 1.7,Prestashop Modules,我对Prestashop 1.7.7有一个完全神秘的问题 在数据库中的ps_产品表中,所有数量都设置为0。然而,在BO中,我可以看到实际数量 编辑:我发现表ps\U stock\U可用。数量在这里。我在控制器中添加了以下代码: $champion->loadStockData(); // This is a Product instance. $chevalier->loadStockData(); // This is a Product instance. $porter->

我对Prestashop 1.7.7有一个完全神秘的问题

在数据库中的ps_产品表中,所有数量都设置为0。然而,在BO中,我可以看到实际数量

编辑:我发现表ps\U stock\U可用。数量在这里。我在控制器中添加了以下代码:

$champion->loadStockData(); // This is a Product instance.
$chevalier->loadStockData(); // This is a Product instance.
$porter->loadStockData(); // This is a Product instance.
$potions->loadStockData(); // This is a Product instance.
$pepites->loadStockData(); // This is a Product instance.
没有运气

我如何在controller中获取产品实例中的库存信息


谢谢您的时间。

我找到了解决问题的方法

$champion = new Product(27);
$chevalier = new Product(28);
$porter = new Product(24);
$potions = new Product(25);
$pepites = new Product(26);
$champion->quantity = Product::getQuantity($champion->id); // Get the actual quantity
$chevalier->quantity = Product::getQuantity($chevalier->id);
$porter->quantity = Product::getQuantity($porter->id);
$potions->quantity = Product::getQuantity($potions->id);
$pepites->quantity = Product::getQuantity($pepites->id);
$champion->price = $champion->getPrice(true, null, 2); // Get the actual price with tax
$chevalier->price = $chevalier->getPrice(true, null, 2);
$porter->price = $porter->getPrice(true, null, 2);
$potions->price = $potions->getPrice(true, null, 2);
$pepites->price = $pepites->getPrice(true, null, 2);