Post by kajrob » Fri Nov 05, 2010 7:31 am

Can I show the regular price and the discount price at the same time? How? V1.4.9.

Newbie

Posts

Joined
Fri Nov 05, 2010 7:23 am

Post by i2Paq » Sat Nov 06, 2010 3:07 am

I'm looking into this code atm.

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.


User avatar
Global Moderator

Posts

Joined
Mon Nov 09, 2009 7:00 pm
Location - Winkel - The Netherlands

Post by Qphoria » Sat Nov 06, 2010 4:08 am

doesn't it already show?
Image

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by bobgirl » Sat Nov 06, 2010 5:06 pm

No it doesn't do it in v1.4.9 for the discount prices. Q maybe you're thinking of the special prices.
If anyone's got a solution, I'm interested!

Newbie

Posts

Joined
Sat Nov 06, 2010 5:02 pm

Post by billyggla » Sat Nov 06, 2010 6:43 pm

In the controller file could you not add something like

Code: Select all

$fullprice = $this->currency->format($this->tax->calculate($product_info['price'], $product_info['tax_class_id'], $this->config->get('config_tax'))); 
then you could echo the original price on the template file

Code: Select all

<?php echo $fullprice; ?>

Active Member

Posts

Joined
Mon Sep 20, 2010 7:05 am

Post by i2Paq » Sun Nov 07, 2010 2:02 am

OK,

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.


User avatar
Global Moderator

Posts

Joined
Mon Nov 09, 2009 7:00 pm
Location - Winkel - The Netherlands

Post by adi_555 » Tue Nov 09, 2010 4:06 am

Hi i2paq,

Could you please share it as I require this feature asap.

thanks!

Active Member

Posts

Joined
Mon Nov 08, 2010 6:21 pm

Post by i2Paq » Tue Nov 09, 2010 6:00 am

This code has been made by Fido-X, I made a donation to him for this code and it was OK by him that I would donate this/his code to the OC Community.

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.


User avatar
Global Moderator

Posts

Joined
Mon Nov 09, 2009 7:00 pm
Location - Winkel - The Netherlands

Post by adi_555 » Tue Nov 09, 2010 6:35 pm

Thanks i2paq,

Can you just guide me on which codes to copy, because my developer has already done alot of modifications to product.php.

Active Member

Posts

Joined
Mon Nov 08, 2010 6:21 pm

Post by fido-x » Tue Nov 09, 2010 6:55 pm

All code inserts are commented.

Image
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!


User avatar
Expert Member

Posts

Joined
Sat Jun 28, 2008 1:09 am
Location - Tasmania, Australia

Post by adi_555 » Tue Nov 09, 2010 10:46 pm

Thanks Fido-x,

As i am new to all this, I managed to get the front end working. can you please help me out to setup the admin? there are no codes for admin in that zip file.

Active Member

Posts

Joined
Mon Nov 08, 2010 6:21 pm

Post by fido-x » Wed Nov 10, 2010 2:15 pm

There is no administrative component provided, because it's already built-in to the OpenCart system. This works off the product specials.

Image
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!


User avatar
Expert Member

Posts

Joined
Sat Jun 28, 2008 1:09 am
Location - Tasmania, Australia

Post by timmieboy » Thu Nov 11, 2010 6:06 pm

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

Active Member

Posts

Joined
Thu Jun 10, 2010 2:56 am

Post by timmieboy » Thu Nov 11, 2010 6:20 pm

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

Active Member

Posts

Joined
Thu Jun 10, 2010 2:56 am

Post by fido-x » Thu Nov 11, 2010 9:13 pm

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
In the modified "catalog/controller/product/product.php" file that is included in the package, change line 215 from:

Code: Select all

$this->data['percent_savings'] = ($product_info['price'] - $special) / $product_info['price'] * 100; 
to:

Code: Select all

$this->data['percent_savings'] = round((($product_info['price'] - $special) / $product_info['price'] * 100), 2); 
FIX added to the download above.
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
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.

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.

Image
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!


User avatar
Expert Member

Posts

Joined
Sat Jun 28, 2008 1:09 am
Location - Tasmania, Australia

Post by i2Paq » Thu Nov 11, 2010 9:41 pm

Why is it that I do not have this issue?

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.


User avatar
Global Moderator

Posts

Joined
Mon Nov 09, 2009 7:00 pm
Location - Winkel - The Netherlands

Post by timmieboy » Thu Nov 11, 2010 9:49 pm

Hi, thank you very much, it is working fine now.

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.

Active Member

Posts

Joined
Thu Jun 10, 2010 2:56 am

Post by fido-x » Thu Nov 11, 2010 10:07 pm

The price that is displayed, whether it be the regular price or the discounted price, includes the tax. The discount is applied before the tax is added.

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%.

Image
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!


User avatar
Expert Member

Posts

Joined
Sat Jun 28, 2008 1:09 am
Location - Tasmania, Australia

Post by timmieboy » Fri Nov 12, 2010 11:22 pm

Hi, I am sorry but it is not working on my site. When I price a product € 44.50 (inc Tax) and the discount price is € 29,95(inc tax) it gives me a discount price of € 12,23 discount (without tax). I use 19% taxes. The discount amount has to be €14.55 (inc taxes). Otherwise it is confusing.

Active Member

Posts

Joined
Thu Jun 10, 2010 2:56 am

Post by SapporoGuy » Sat Nov 13, 2010 12:59 am

Fido and i2paq
thanks for the mod!
I would have spent a while debugging my code since I forgot to consider using discounts. :choke:

in the files your missing from the language file;

Code: Select all

$_['text_discounted']     = 'discount';
Fido, why did you round to 2 instead of 0?

Code: Select all

$this->data['percent_savings'] = round((($product_info['price'] - $special) / $product_info['price'] * 100), 2);
vs

Code: Select all

$this->data['savings_percentage'] =  round( ($this->data['savings']/$product_info['price'])*100, 0 );
percentage will come out to 2 decimal places.

I had used an extra line of code to come up with my calculation so I borrowed your code instead. ;D

930sc ... because it is fun!


User avatar
Active Member

Posts

Joined
Mon Nov 01, 2010 7:29 pm
Who is online

Users browsing this forum: dparakhiya and 80 guests