Hopefully it will be ready in a couple of days.
Norman in 't Veldt
Moderator OpenCart Forums
_________________ READ and Search BEFORE POSTING _________________
Our FREE search: Find your answer FAST!.
[How to] BTW + Verzend + betaal setup.
Code: Select all
$fullprice = $this->currency->format($this->tax->calculate($product_info['price'], $product_info['tax_class_id'], $this->config->get('config_tax')));
Code: Select all
<?php echo $fullprice; ?>
I've got the code that will show:
Regular price: (strike out)
Our price: (bold)
Discount: (amount saved)
Saved: (in %)
Norman in 't Veldt
Moderator OpenCart Forums
_________________ READ and Search BEFORE POSTING _________________
Our FREE search: Find your answer FAST!.
[How to] BTW + Verzend + betaal setup.
So a BIG THANK YOU goes to Fido-X.
This zip contains the files needed for a vanilla 1.4.9.2 install, using Winmerge I think you can harvest the code to use for your own install/store.
I know the code works, as it does atm. in my store that is under construction.
Attachments
Updated with the fix mentioned by Fido-X below.
Norman in 't Veldt
Moderator OpenCart Forums
_________________ READ and Search BEFORE POSTING _________________
Our FREE search: Find your answer FAST!.
[How to] BTW + Verzend + betaal setup.
Modules for OpenCart 2.3.0.2
Homepage Module [Free - since OpenCart 0.7.7]
Multistore Extensions
Store Manager Multi-Vendor/Multi-Store management tool
If you're not living on the edge ... you're taking up too much space!
Modules for OpenCart 2.3.0.2
Homepage Module [Free - since OpenCart 0.7.7]
Multistore Extensions
Store Manager Multi-Vendor/Multi-Store management tool
If you're not living on the edge ... you're taking up too much space!
Can you maybe help me with this. I have used your code for discount percentage, it is great but the problem with me is that it gives a percentages with a large number behind the comma. Like this: 20.3458622354%. How can I fix this.
Tim
In the modified "catalog/controller/product/product.php" file that is included in the package, change line 215 from:timmieboy wrote:Hello,
Can you maybe help me with this. I have used your code for discount percentage, it is great but the problem with me is that it gives a percentages with a large number behind the comma. Like this: 20.3458622354%. How can I fix this.
Tim
Code: Select all
$this->data['percent_savings'] = ($product_info['price'] - $special) / $product_info['price'] * 100;
Code: Select all
$this->data['percent_savings'] = round((($product_info['price'] - $special) / $product_info['price'] * 100), 2);
The price being saved is the correct one. Example: product has a price of $100 and you put it on special for $50, the discounted special price is $50, you save 50%. Tax (as always) is calculated after the discount is applied.timmieboy wrote:Hi
I also discovered that the amount that is being saved is not the correct one. It is without tax, how can I change that.
Tim
Using the above example, the product is priced at $100 and the tax is 17.5%. The product is put on special with a "special" price of $50. The discount is $50, the saving is 50%. The tax is still 17.5%. The amount you save is based on the difference in the product's price, not the tax that may (or may not) be applicable.
Modules for OpenCart 2.3.0.2
Homepage Module [Free - since OpenCart 0.7.7]
Multistore Extensions
Store Manager Multi-Vendor/Multi-Store management tool
If you're not living on the edge ... you're taking up too much space!
Norman in 't Veldt
Moderator OpenCart Forums
_________________ READ and Search BEFORE POSTING _________________
Our FREE search: Find your answer FAST!.
[How to] BTW + Verzend + betaal setup.
I still have a question about the taxes. With us in the Netherlands we have to sell the products to consumers inc. taxes. So if we make a discount price it has to be inc taxes. So all my prices are inclusive taxes, this is the reason that the amount is different. Is there a way to change this.
Using the previous example: the product is priced at $100 PLUS 17.5% tax, bringing the total price (including tax) to $117.50. The product is put on special with a price of $50 (ie. it is discounted $50, a saving of 50%) PLUS 17.5% tax, which brings the price to $58.75. Again a saving of 50%.
Modules for OpenCart 2.3.0.2
Homepage Module [Free - since OpenCart 0.7.7]
Multistore Extensions
Store Manager Multi-Vendor/Multi-Store management tool
If you're not living on the edge ... you're taking up too much space!
thanks for the mod!
I would have spent a while debugging my code since I forgot to consider using discounts.
in the files your missing from the language file;
Code: Select all
$_['text_discounted'] = 'discount';
Code: Select all
$this->data['percent_savings'] = round((($product_info['price'] - $special) / $product_info['price'] * 100), 2);
Code: Select all
$this->data['savings_percentage'] = round( ($this->data['savings']/$product_info['price'])*100, 0 );
I had used an extra line of code to come up with my calculation so I borrowed your code instead.
930sc ... because it is fun!
Users browsing this forum: dparakhiya and 80 guests