duanbairan4235
2014-08-21 19:14
浏览 96
已采纳

通过id opencart在主页上显示产品

I need to show one certain product on front page. I didn't find a module for this. What do I need to do? I need to show product with countdown timer but I can do this, I only do not know how to get product from database by ID or SKU. I guess the code should be like this:

echo $product_option_data[] = array(
                    'product_option_id' => $product_option['product_option_id'],
                    'option_id'         => $product_option['option_id'],
                    'name'              => $product_option['name'],
                    'type'              => $product_option['type'],
                    'option_value'      => $product_option['option_value'],
                    'required'          => $product_option['required']
                );
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dtp87205 2014-08-22 08:04
    已采纳

    In OpenCart controller you can call

    $this->load->model('catalog/product'); // only if not yet 'loaded' within the controller
    $product = $this->model_catalog_product->getProduct($productId);
    print_r($product);
    

    which will return you the product by it's ID. Do with it whatever you need afterwards.

    点赞 打赏 评论

相关推荐 更多相似问题