It's just here that I got stuck on a problem that I don't quite understand!
I tried restoring all the products that were running fine:
$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);
Except I only need to display products with a predefined ID.
P粉4102398192024-03-30 15:20:32
Use the constructor to get a specific Product
instance via id_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 }