Opencart tip and trick to show discounts at featured products module in Opencart 2.3 for free, download and install and it will show discounts at the featured module.
Click to Download Ocmod file to show discounts at featured module
Go to catalog\language\en-gb\extension\module\featured.php Add following code:
$_['text_discount'] = ' or more ';
Go to catalog\controller\extension\module\featured.php Find the following lines of code:
$data['heading_title'] = $this->language->get('heading_title');
Add the following lines of code:
$data['text_discount'] = $this->language->get('text_discount');
Find the following lines of code:
foreach ($products as $product_id) { $product_info = $this->model_catalog_product->getProduct($product_id);
Add the following lines of code:
$discounts = $this->model_catalog_product->getProductDiscounts($product_id); $product_info['discounts'] = array(); foreach ($discounts as $discount) { $product_info['discounts'][] = array( 'quantity' => $discount['quantity'], 'price' => $this->currency->format($this->tax->calculate($discount['price'], $product_info['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']) ); }
Find the following lines of code:
$data['products'][] = array( 'product_id' => $product_info['product_id'],
Just below it, add the following lines of code:
'discounts'=>$product_info['discounts'],
Now go to catalog\view\theme\YOUR_ACTIVE_THEME\template\extension\module\featured.tpl
Find the following lines of code:
Rupak Nepali
Author of four Opencart book. The recent are Opencart 4 developer book and Opencart 4 user manualRelated Posts
Opencart4 min readAI Description Generator Extension for OpenCart 4.1.0.3
Featured25 min readHost LAMP stack in AWS Lightsail, Opencart hosting in AWS
Extensions3 min readMerge OpenCart Categories Easily with the Category Merger Extension
Opencart3 min readImport Product Reviews in Bulk with CSV – OpenCart Extension Spotlight
Drupal5 min readBuilding Content That Answers Real Questions: A Modern Approach
Drupal3 min readSeptember Holiday E-Commerce Marketing Calendar & Campaign Ideas (2025 Edition)
Comments
Join the conversation and share your thoughts
Leave a Comment
JJF
Hello
Is this compatible with opencart 3.0.2.0 ?
I need to show discount percentage featured module block in home page
SSudirman wang
hi….before i said thank’s for your free extension
i try this extension “Show discounts at featured module OpenCart 2.3”
but not work, i use opencart 2.3.0.2
could you give me tutorial/document step by step, because i am beginner
thanks