Prestashop-Funktion: Produktinformationen abrufen
P粉298305266
P粉298305266 2024-03-29 17:09:04
0
1
322

Genau hier bin ich bei einem Problem hängen geblieben, das ich nicht ganz verstehe!

Ich habe versucht, alles wiederherzustellen, was gut funktioniert hat:

        $id_lang = (int)Context::getContext()->language->id;
        $start = 0;
        $limit = 100;
        $order_by = 'id_product';
        $order_way = 'DESC';
        $id_category = false;
        $only_active = true;
        $context = null;
        $all_products = Product::getProducts($id_lang, $start, $limit, $order_by, $order_way, $id_category, $only_active, $context);

Außer ich muss nur Produkte mit einer vordefinierten ID anzeigen.

P粉298305266
P粉298305266

Antworte allen(1)
P粉410239819

使用构造函数通过id_product获取特定的Product实例。

/** @var int Specific Product ID */
$id_product = 1337;

/** @var Product Specific Product instance */
$specific_product = new Product($id_product);

if(false !== $specific_product) {
  // Product found in database, so can use instance
} else {
  // Product does not exist
}
Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage
Über uns Haftungsausschluss Sitemap
Chinesische PHP-Website:Online-PHP-Schulung für das Gemeinwohl,Helfen Sie PHP-Lernenden, sich schnell weiterzuentwickeln!