Page 1 of 1

Add percentage saved to specials

Posted: Mon Jul 18, 2011 9:48 pm
by opencart-templates

Code: Select all

<file name="catalog/controller/module/special.php">
        <operation>
            <search position="before"><![CDATA[
            if ($this->config->get('config_review_status')) {
            ]]></search>
            <add><![CDATA[
			if ((float)$result['special']) {
				$saving_value = $result['price'] - $result['special'];
				$saving = round(($saving_value/$result['price'])*100, 0);
			} else {
				$saving = false;
			}
            ]]></add>
        </operation>
        <operation>
            <search position="after"><![CDATA[
            'name'    	 => $result['name'],
            ]]></search>
            <add><![CDATA[
			'saving' => $saving,
            ]]></add>
        </operation>
	</file>

Re: Add percentage saved to specials

Posted: Tue Nov 15, 2011 1:05 am
by Xciso
Does this mod works for 1.5.1.3?

Re: Add percentage saved to specials

Posted: Mon Nov 21, 2011 9:45 pm
by aledmann
Seems like there's a step missing to me? Surely you'd need to edit the tpl file to match?

If we could get this working for 1.5x that would be amazing! I've wanted a "You save" for aaaaaaages!! :D

Re: Add percentage saved to specials

Posted: Mon Nov 21, 2011 11:20 pm
by Qphoria
No need to edit the tpl, the value is being pushed as extension of the original price string

Re: Add percentage saved to specials

Posted: Tue Nov 22, 2011 6:57 pm
by aledmann
So for us beginners who are keen to learn, am I right in thinking that for 1.5.x it goes a little something like this:

1) Open catalog/controller/module/special.php

2) Find

Code: Select all

if ($this->config->get('config_review_status')) {
3) Before it, add

Code: Select all

if ((float)$result['special']) {
$saving_value = $result['price'] - $result['special'];
$saving = round(($saving_value/$result['price'])*100, 0);
} else {
$saving = false;
}

4) In same file, find

Code: Select all

'name' => $result['name'],
5) After it, put

Code: Select all

'saving' => $saving,
If that's the case, I can't get it to work. ???

Re: Add percentage saved to specials

Posted: Thu Nov 24, 2011 11:32 pm
by aledmann
Anyone? :joker:

Re: Add percentage saved to specials

Posted: Sat Nov 26, 2011 10:00 pm
by aledmann
Bueller?...........Bueller?...........Bueller?...........

(Sorry, 80's gag!)

Reeeeeeeeeeeeeeeeeeally would love this on my site so if anyone can please help I'd be forever grateful. ;D

Re: Add percentage saved to specials

Posted: Fri Dec 02, 2011 1:54 am
by webvet
Ok, here goes... be gentle with me ;)

I have installed vqmod today, and have viewed a few threads. Wanted to see if I can make this work and have had a go.

Not sure if it is doing the same as Fido-X's efforts with http://forum.opencart.com/viewtopic.php?f=131&t=39597 and if so then use his - he is a master at this sort of stuff, I am just learning. I will check his out in the next few days so this might be superfluous.

But here goes - works on my site - v1.5.1.2 so I would welcome any feedback from those who have said they wanted it.

WHAT IT DOES:
Displays percentage saved next to the original price and special price in the Specials Module.
Text can be styled (it is set to display in red font, but can easily be changed to underline, bold, other colours etc)
Text can be added to give 'Save x%' or 'x% OFF' - edited to remove comment as giving error!

TO DO:
Will get this to also show on the product page, if anyone interested

Re: Add percentage saved to specials

Posted: Sat Dec 03, 2011 9:18 pm
by aledmann
Not tried this yet but absolutely +1 to have it appear on the product page as well!! ;D ;D ;D

Re: Add percentage saved to specials

Posted: Sat Dec 03, 2011 10:29 pm
by webvet
aledmann

let me know if you have any problems - am away for the weekend now, but will look at sorting the product page next week.

Re: Add percentage saved to specials

Posted: Tue Dec 06, 2011 12:54 am
by aledmann
I should probably clarify that I don't want this as part of a discount, I want it as part of the specials tab. All I want is for it to work out and show what the saving is.

So currently when I set up a product I go to:

catalog/product/edit/price - and I enter a product price (say £3.99) I then go to the specials tab and enter a specials price of £1.49. This works great for sale price and RRP.

But I also want the specials to show the percentage save so it looks like this:

£1.49 RRP £3.99 You saved 50%

I hope that makes sense!

Re: Add percentage saved to specials

Posted: Tue Dec 06, 2011 1:03 am
by webvet
Which version of OC are you using?

I understand what you are asking - is that exactly how you want the price to show:

SPECIAL PRICE in bold then RRP in italics then 'You saved x%' in bold

and in that order?
It may be a bit specialised for everyones requirements, but if that is what you would like then I can pm or email it to you as should be able to do that. Other people might want the text to say 'x% OFF', some may not want RRP etc so might keep the xml file in the thread quite generic.

Just trying to make sure I get exactly what you want.

Re: Add percentage saved to specials

Posted: Tue Dec 06, 2011 6:10 am
by GoGo OpenCart
Hello guys,

I've created such an extension, you can see it here:

http://www.opencart.com/index.php?route ... on_id=4023

Although, as it is, it puts You Save only at the products' page, by the request of some costumers, I've made it to be shown at the Featured products as well (you can read the comments). So, by request, I can make it to be shown in the Specials box as well ;)

Just after purchasing leave a comment at the extension's page by stating the OpenCart version you need Specials for, and when I make it, you'll receive it without any additional charges.



Image