2014-08-21 19:14
浏览 102

通过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);

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

    解决 无用
    打赏 举报

相关推荐 更多相似问题