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
eCommerce, Web 3.0, blockchain, nft and metaverse3 min readTop August Holidays and Their Usefulness for E-commerce Marketing
Drupal6 min readReflectionClass usage: Get all properties or methods of a Class in PHP
eCommerce, Web 3.0, blockchain, nft and metaverse3 min readJuly Holiday E-Commerce Marketing Calendar & Social Schedule for Online Retailers
eCommerce, Web 3.0, blockchain, nft and metaverse4 min readThe Ultimate Marketing Calendar for E-Commerce Stores (June 2025 Edition)
eCommerce, Web 3.0, blockchain, nft and metaverse4 min readE-Commerce Holiday Calendar for May: Sales & Marketing Ideas to Boost Revenue
Ecommerce Templates3 min readMay the Sales Be With You: Star Wars-Themed E-commerce Campaign Ideas
Comments
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
Featured Posts
Docker set up for Opencart for local development
Opencart 4 book: User manual to create a full-fledged eCommerce store
OpenAI ChatGPT uses in eCommerce business
40 cool final year college projects for students in 2025
OpenCart 4.1.0.0 Launch: New Features, Updates, and Fixes
Host LAMP stack in AWS Lightsail, Opencart hosting in AWS
25 SEO best practices for Opencart 4 & 3 with free SEO Opencart module
Categories
- Drupal
- Ecommerce Templates
- eCommerce, Web 3.0, blockchain, nft and metaverse
- Extensions
- Featured
- Internship
- Javascript
- Mongo DB Solution
- Opencart
- Opencart 3
- Opencart 4
- Opencart 4 tutorial, opencart 3 tutorials, custom module theme development
- Opencart extensions free download
- OpenCart Guide
- Opencart themes for free
- OpenCart Tips and Tricks
- Opencart Videos
- Other
- PHP development
- Programming