Wednesday, 16 December 2015

How to get latest products on anypage in OpenCart

Load latest module

<?php
                $this->load->model('catalog/product');
                $data = array();
                $limit=6;
               $results = $this->model_catalog_product->getLatestProducts($limit);
           //  $results = $this->model_catalog_product->getProducts($data);
                ?>
<?php foreach ($results as $product) {
//get product link
 $href        = $this->url->link('product/product', 'product_id=' . $product['product_id']);
  echo $product['product_id'];
 echo $product['name'];
 echo $product['rating'];
 } ?>

No comments:

Post a Comment