Jump to content

[MODIFICATION] RRP (Recommended Retail Price)


Zenith
 Share

Recommended Posts

Adds a RRP feature that shows on the product and product list pages. Includes BO import feature.

 

This modification is for PrestaShop v1.4.4.1 (Code may be different for previous versions)

 

Feedback and requests for additional features are always welcome.

 

Installation instructions are contained in the attached archive.

 

CHANGELOG

v1.6a (2011-09-18)

[*] Fixed you save & percentage not showing if tax disabled.

 

v1.6 (2011-09-18)

[*] Fixed typo in installation instructions.

[*] Fixed missing language in BO import feature.

[*] Fixed positioning of RRP on category page.

 

v1.5 (2011-07-23)

[+] Added support for multiple currencies.

 

v1.4 (2011-07-22)

[+] Added tax (if applicable).

[-] 1.3.x version will not be updated anymore!

 

v1.3 (2011-03-19)

[*] Updated for currency format changes. (1.4+)

 

v1.2 (2011-03-08)

[*] Updated for PrestaShop 1.4 Final code.

[+] Added You Save value & percentage.

[+] RRP is hidden if attribute is selected (Thanks to AngelofHaovc).

 

v1.1 (2011-01-28)

[+] Added BO import feature.

 

v1.0 (2009-12-08)

[+] First release to the PrestaShop community.

39986_zYXwjvjJYuKml7WynUnf_t

rrp_1.6a.zip

  • Like 1

Share this post


Link to post
Share on other sites

  • 3 weeks later...

After test, I found a small problem. If there are combination prices defined for a product and the RRP is set, RRP still displays the same whatever price option changed by the user. by using a trick, we can hide the RRP when the user choose different combination price from the drop down menu. but this is up to you for doing such change. If RRP is not set, it doesn't affect at all.

For easy to install, I made the changes by following the instruction and zip the changed files together for easy use. read the readme first if you like to use.

All credits of this mod go to Zenith.

Nice work again Zenith.

rrp.zip

Share this post


Link to post
Share on other sites

I now get this error message on the product page when I go to save the rrp within the admin area:

1 error

1. an error occurred while updating object product (Unknown column 'recommended_retail_price' in 'field list')

what does this mean and how do I fix this?

Thanks,
Adam.

Share this post


Link to post
Share on other sites

Hi Adds, Have you run the SQL script to create a new column in product table yet? you must run the sql first before actually change the codes.


Can you tell me how I do that please?
Please can you send me some guide lines.

I also get this error message when I try to add new products and save the information:

error
1. an error occurred while creating object product

Any idea how I can fix that as well please?

Thanks.

Share this post


Link to post
Share on other sites

hm, You may need to read the instruction first. if you download my zip file, inside the folder, there is a db_sql_run_first.txt document. use the sql statement inside and paste it into SQL command in your phpMyAdmin (you need to navigate to the product table in your prestashop database in phpMyAdmin. run the sql and check if there is a new field called recommended_retail_price in your product table.

after doing so, you may replace the files in you default installed prestashop folder with the one I made in my zip files. I tried this on my default prestashop theme and default module.

if you have other module installed already and those files have changed somehow the product.php and product.tpl, you need to use the manual change mod in my zip file and follow the readme instruction (html and text formats) to make the change manually.

in regards with your error, I am not sure what caused it. You may try this mod on your default (fresh) installed prestashop site and see how it goes.

Good luck!

Share this post


Link to post
Share on other sites

  • 1 month later...
  • 3 months later...
  • 4 weeks later...

Thanks for this feature. I was looking for it.

I am totally new to this phpmyadmin. I have no idea of what it is.

So before i do anything in there i need to ask you. Is it complicated?

What if i do something wrong or if i want to take away this feature for some reason? Can i turn it back the way it was before the changes?

Share this post


Link to post
Share on other sites

You can access phpMyAdmin from your cPanel of your hosting account, ask your host if you cannot find it.

If you don't wish to use the feature in the future you simply don't add a value to the RRP field and nothing will be shown on the front end.

Share this post


Link to post
Share on other sites

Ok, thanks i'll ask my host. Or maybe i'll ask them if they can do the change.

I saw someone else also asked to add a feature that shows how much the customer save in % and £ like play.com does

eg:
Price £9.00
You Save £1 (10%)
RRP: £10.00

I would like to have that two. Is it in the file already?

Just like this picture:

26298_BlPY0kGup2a3cvDNi8xZ_t

Share this post


Link to post
Share on other sites

  • 3 months later...

Hi Zenith, fantastic work!!

It's really what I want. But I want to add more pages.

I want show RRP at home featured products.
I want add "Your Price:" just before real price.
I donot want "RRP:" get inline through. Only price is inlined through is prefered. I have fixed this at product list pages but not product pages.

Pls help me on this small issue for you but big for me.

Millions thanks for you.

Alex

Share this post


Link to post
Share on other sites

- For home featured products just add the code from the product.tpl, this should work in the module as well without any changes.

- Language can be changed in the BO translations section

- Change


to


to remove the strike-through on the product page

Share this post


Link to post
Share on other sites

Zenith, thanks for quick responce.

Where should I insert the code in homefeatured?
No text available now. So no translation at BO. I think I should add or insert this words "Your Price" at some place. But I do not know.
I fixed the last question based on your help.

Thanks in advance.

Share this post


Link to post
Share on other sites

Wherever you want it to show in the template (probably under the price) in homefeatured.tpl

Did you want to change "RRP" to "Your Price" ? You should be able to find RRP in the translations list in the BO and just add your text to replace it.

  • Like 1

Share this post


Link to post
Share on other sites

Hi, i have fixed all problem except homefeatured. It still keep unchanged whatever I modify on homefeatured.tpl

pls help me on this.

Is homefeatured.tpl file is right one I should modify on?
Where I shoud insert the code to display "RRP"?
Where I should insert "Your Price" to display "Your Price" just before our price?

Much thanks for your kind assistant.
Appreciate it.

Alex

Share this post


Link to post
Share on other sites

  • 2 months later...
  • 4 weeks later...
  • 4 weeks later...
  • 2 weeks later...

I've just finished up coding a "You save : $1.00 (10%)" feature for this modification. As soon as it's been tested on a 1.3.x setup (I updated the mod for 1.4 while I did this and the code slightly differs) it will be released for all! :)

Share this post


Link to post
Share on other sites

Testing is now complete and I have successfully got this working on both 1.3 & 1.4 versions. I'll upload a new version tomorrow, it contains instructions for both 1.3 & 1.4 versions. :)

Thanks to spidermax for helping with the testing!

Share this post


Link to post
Share on other sites

New version (1.2) is now available. New features include "You save: $x.xx (xx%)" and the hide RRP when attribute is selected contributed by AngelofHaovc.

The next update will include tax on the RRP, this is all that is left to be added I think.

Enjoy! :)

Share this post


Link to post
Share on other sites

Hi Zeneth

I have recently installed 1.4.0.17 and tried to implement your RRP module

I seem to have the RRP field in the BO products and Import areas, however I'm unable to see this on my FO.

I had to edit your product.tpl and product-list.tpl scripts as they inlcuded > and " In the Prestashop supplied tpl files these now appear to be using tags > < "Please see below:

product.tpl
------------
{if $product->recommended_retail_price != 0}
<p id="rrp_price">{l s='RRP :'} <strike>
{convertPrice price=$product->recommended_retail_price}
{if $tax_enabled}
{if $priceDisplay == 1}{l s='tax excl.'}{else}{l s='tax incl.'}{/if}
{/if}
</strike></p>
<p id="reduction_percent">{l s='You save:'}<span id="reduction_percent_display">
{if $priceDisplay == 1}
{convertPrice price=($product->recommended_retail_price-$product->getPrice(false, $smarty.const.NULL))}
{l s='('}{round((($product->recommended_retail_price-$product->getPrice(false, $smarty.const.NULL))/$product->recommended_retail_price)*100,0)}%{l s=')'}
{else}
{convertPrice price=($product->recommended_retail_price-$product->getPrice(true, $smarty.const.NULL))}{/if}
{l s='('}{round((($product->recommended_retail_price-$product->getPrice(true, $smarty.const.NULL))/$product->recommended_retail_price)*100,0)}%{l s=')'}
</span></p>
<br class="clear" />
{/if}




product-list.tpl
-----------------
{if $product.recommended_retail_price != 0}
<div><span class="old_price" style="display: inline;"><span class="bold">
{l s='RRP:'} <strike>{convertPrice price=$product.recommended_retail_price}
</strike></span></span></div>
{/if}


However my products and product lists will not display on the webstore. If you want to take a look at what I mean http://officegopher.co.uk

Its at dev stage so still contains the originally supplied sample data from prestashop.

From what I can see it has to be something a miss in my product and product-list .tpl / .css / .js files. I have checked them all 10 times over but can not see anything, aside those changes I made above (I must add at this point that I'm no developer and based my changes on assumptions from looking at the code already in the .tpl files!)

Would appreciate it if someone could point out what I've missed.

Thanks

Kevin

Share this post


Link to post
Share on other sites

  • 1 month later...

Nothing I can really say, except, go over all the edits again and make sure you have added them correctly. (Also state which PrestaShop version you are using as there are two different versions of this modification, one for 1.3, one for 1.4 - Make sure you've added the correct code for your version)

Share this post


Link to post
Share on other sites

  • 2 weeks later...

Hi Zenith,

I love the RRP mod but i have a request.

Is it possible to only show the RRP based on customer group?

For example:

I have 2 groups

RETAIL
TRADE

I only wish for the RRP to be viewable by the TRADE GROUP? and hidden to the RETAIL GROUP.

Any help on this would be greatly appreciated.

Regards

Share this post


Link to post
Share on other sites

Not sure on that one, I haven't really checked out the groups coding as I don't use it on my store.

Leave it with me and I'll have a look into it over the weekend if I get some spare time.

It's a great suggestion and would be perfectly suited for just a wholesale group. :)

Would an option (Display: Yes / No) on the BO Edit Group page be the place to put it do you think?

Share this post


Link to post
Share on other sites

Thanks Zenith,

I am going to keep the code live on my site and hopefully if you find a solution i will amend the code to show based on logged in group.

Thanks for a swift reply.
Regards


Not sure on that one, I haven't really checked out the groups coding as I don't use it on my store.

Leave it with me and I'll have a look into it over the weekend if I get some spare time.

It's a great suggestion and would be perfectly suited for just a wholesale group. :)

Would an option (Display: Yes / No) on the groups page be the place to put it do you think?

Share this post


Link to post
Share on other sites

Hi Zenith,

I have managed to achieve what i was asking by altering your code slightly:

{if $groupName == TRADE AND $product->recommended_retail_price != 0}



These changes were made to files: product.tpl & product_list.tpl

This is a dirty hack that works for me but if you manage implement a switch in BO that would be great!

Share this post


Link to post
Share on other sites

  • 2 weeks later...

Hi
I have a problem rrp works perfectly. I also have certain sales tax. When I am importing my product list and selecting recommended price. If i choose including sales tax or excluding sales tax it does the same. It gives me a much higher price than what is my desired ie. IE it gives me the price x 14% . Now i jsut need it to be at price. Any idea? or could it be that its not this mods problem?

Share this post


Link to post
Share on other sites

  • 1 month later...

New version 1.5, now RRP supports multiple currencies :)

 

Hello Zenith,

 

thanks for your work and sharing! I've just tested 1.3 version on clean PS 1.3.7 and seems that currency conversion works only for final price, but not for RRP amount and amount saved (these amounts remains the same if I switch to another currency - Im using CZK and EUR).

 

All the best

 

Jiri

Share this post


Link to post
Share on other sites

As stated in the changelog I am no longer updating the 1.3.x version, therefore it does not have tax or multiple currency changes. Only the 1.4.x version supports these features.

Share this post


Link to post
Share on other sites

  • 1 month later...

I seemed to have an error in controllers/ProductController.php on 1.4.4.0 if anyone else has the error for step:-

 

#----------[ FIND ]----------
#
'ecotaxTax_rate' => $ecotax_rate,

#
#----------[ AFTER, ADD ]----------
#
$rrp_price' => Tools::convertPrice($rrpPrice),

 

 

Instead I did:-

#----------[ FIND ]----------
#
'ecotaxTax_rate' => $ecotax_rate,

#
#----------[ AFTER, ADD ]----------
#
'rrp_price' => Tools::convertPrice($rrpPrice),

 

Hope this helps!

Share this post


Link to post
Share on other sites

  • 2 weeks later...

Thanks Zenith! This modification looks like what I was looking to achieve.

 

I have a question, so I would put the MSRP pricing in the pre-tax retail price/ retail price with tax field. Which field would I have to enter my value for my pricing?

Share this post


Link to post
Share on other sites

the recommended_retail_price field, provided you have done the modification on the import file. To be honest Ive never used it but was told after I coded it that it was working. Maybe someone who uses it can assist you further.

Share this post


Link to post
Share on other sites

Sorry, ignore my post above, I haven't read the mod description.

 

Anyway, I've followed the instructions to the book, though I had to make some changes (odd bracket missing from code etc). I can't get the RRP to display on the front end, on the product page. Any ideas? Thanks.

 

EDIT

In the product.tpl file, I removed

{if $rrp_price}

 

and it's now displaying the RRP div across all the pages, as expected. However, the item I entered a RRP for isn't showing the RRP - or rather, it's showing the RRP as £0.00, as if I haven't entered an RRP.

 

Somehow the RRP I'm entering in the BO isn't presenting itself on the FO. Please see my attached screen shots.

post-26060-0-41111900-1315742557_thumb.pngpost-26060-0-33143000-1315742622_thumb.png

Share this post


Link to post
Share on other sites

I seemed to have an error in controllers/ProductController.php on 1.4.4.0 if anyone else has the error for step:-

 

#----------[ FIND ]----------
#
'ecotaxTax_rate' => $ecotax_rate,

#
#----------[ AFTER, ADD ]----------
#
$rrp_price' => Tools::convertPrice($rrpPrice),

 

 

Instead I did:-

#----------[ FIND ]----------
#
'ecotaxTax_rate' => $ecotax_rate,

#
#----------[ AFTER, ADD ]----------
#
'rrp_price' => Tools::convertPrice($rrpPrice),

 

Hope this helps!

 

Hey this has actually sorted my issue of no RRP being displayed, thanks very much! I did notice when putting this code in that the apostrophes were needed but I left the $ in, which stopped it from working. Thanks man!

 

Now my issue is that the RRP is adding tax on top of it...

 

Sorry, I've hijacked this thread a little bit!

Share this post


Link to post
Share on other sites

I noticed in the Product.PHP the file is in euros; however, my currency that I am working with is USD.

 

#----------[ FIND ]----------
#
/** @var float Price in euros */
public   $price = 0;
#
#----------[ AFTER, ADD ]----------
#
/** @var float Recommended Retail Price in euros */
public   $recommended_retail_price = 0;#

 

Could this be why it isn't showing in my FO? Everything seems to work, the BO RRR field, the import RRR field. But nothing is showing in my FO. The currency I used for my webstore is USD.

Share this post


Link to post
Share on other sites

Thanks Zenith, I went over the code and I fixed it by doing what S7 Media Ltd did.

 

This made it show on the product page; however, it doesn't show the percentage. Also, what do I need to add so it shows up on the product-list as well?

 

2i2aoo2.jpg

Share this post


Link to post
Share on other sites

OK, try this code in product.tpl (I'm thinking it's because I use the SVN, I may have used code that does not exist yet it past versions)

 

{if $rrp_price}
<p id="rrp_price">{l s='RRP :'} <strike>
{convertPrice price=$rrp_price}
  	 {if $priceDisplay == 1}{l s='tax excl.'}{else}{l s='tax incl.'}{/if}
</strike></p>
<p id="reduction_percent">{l s='You save:'}<span id="reduction_percent_display">
  	 {if $priceDisplay == 1}
		{convertPrice price=($rrp_price - $product->getPrice(false, $smarty.const.NULL))}
		{l s='('}{round((($rrp_price - $product->getPrice(false, $smarty.const.NULL)) / $rrp_price) * 100, 0)}%{l s=')'}
	{else}
		{convertPrice price=($rrp_price - $product->getPrice(true, $smarty.const.NULL))}{/if}
		{l s='('}{round((($rrp_price - $product->getPrice(true, $smarty.const.NULL)) / $rrp_price) * 100, 0)}%{l s=')'}
</span></p>
{/if}

Share this post


Link to post
Share on other sites

Success! It works after trying the code. Thank you for all your help, greatly appreciated.

 

For anyone who's using 1.4.4 and runs into the issue I was having, The code Zenith posted above me will solve all your problem. :)

Share this post


Link to post
Share on other sites

No, category page simply shows the RRP, the You Save part is not included. The code in the installation files will work as it uses the same call to check if the RRP price exists.

 

Double check your product_list.tpl to make sure the code is in the correct spot, as you use a different template you may need to play around for a good spot. If all else fails, zip the tpl file and send to me via PM and ill check it.

Share this post


Link to post
Share on other sites

I think the position of the product-list.ccs is in the wrong position. In my lay-out I don't have a product-list.ccs. It seem to be merged into my global.ccs file.

 

I will PM you the two files. Greatly appreciate it if you can help me fix this problem.

Share this post


Link to post
Share on other sites

Is there another code I need to change to let it show up on the product-list page as well?

 

fn8rhi.jpg

 

 

1.4.4.x

 

Yes there is, the code shown in the file actualy doesn't work.

I don't remember everything I've done but I did many changes.

 

I know I didn't find the " {if ($product.allow_oosp || $product.quantity > 0) && $product.customizable != 2} " in the product-list.tpl

 

So what I did is :

FIND :

{if isset($product.on_sale) && $product.on_sale && isset($product.show_price)

 

 

BEFORE ADD :

 

<div><span class="old_price" style="display: inline;"><span class="bold">

{l s='RRP'} <strike>{convertPrice price=(121 * $product.recommended_retail_price) / 100}

</strike></span></span></div><br />

 

121 is the tax value , 21% VAT here so 121 , if you have 15% VAT , change it into 115

 

___________

 

Also in the "admin\tabs\adminImport.php" file , when you have to FIND : 'price_tin' => $this->l('Price tax incl.'), and AFTER ADD : 'recommended_retail_price' => $this->l('Recommended retail price'),

 

It's actualy wrong , you have to AFTER ADD : 'recommended_retail_price' => array('label' => $this->l('Recommended retail price')),

 

I'm working with the 1.4.4.1 version.

 

 

 

Hope it helps.

I did many change into product.tpl too and the css files I can't remember everything : (

Share this post


Link to post
Share on other sites

You seem to be using an old version, the current version has tax included in the RRP.

 

The code in product_list.tpl should go before

		   	 {if ($product.id_product_attribute == 0 || (isset($add_prod_display) && ($add_prod_display == 1))) && $product.available_for_order && !isset($restricted_country_mode) && $product.minimal_quantity <= 1 && $product.customizable != 2 && !$PS_CATALOG_MODE}

 

The missing code in AdminImport seems to be a language string, I'll add this to the installation files.

 

I'm using 1.4.5.0 so code may differ for older versions. I'll download 1.4.4.1 now and check over the edits to make sure everything is correct and upload a new version. :)

 

New version (1.6) has been uploaded to first post, this should address all issues with code differences as it was checked to the 1.4.4.1 version.

Share this post


Link to post
Share on other sites

I attempted to try and use the 1.6 version that Zenith just released hours ago. It isn't the same if you're on 1.4.4. For instance, using the previous 1.5 version, the AdminImport.php works fine. If you use the 1.6, the R import field will not show up.

 

Is the code for product.tpl supposed to be

 

				    {l s='('}{round((($rrp_price - $product->getPrice(false, $smarty.const.NULL)) / $rrp_price) * 100, 0)}%{l s=')'}
		    {else}
				    {convertPrice price=($rrp_price - $product->getPrice(true, $smarty.const.NULL))}{/if}
				    {l s='('}{round((($rrp_price - $product->getPrice(true, $smarty.const.NULL)) / $rrp_price) * 100, 0)}%{l s=')'}

 

Twice?

 

Giving me this result.

 

28vt3ly.jpg

Share this post


Link to post
Share on other sites

What do you mean it won't show up, please explain further so I can fix this. (Add screenshots to show any issues)

 

I used 1.4.4.1 files to make sure it was correct.

 

 

Edit: I did forget to fix the You Save amounts showing on the product page, but that is now done for the next version, once this AdminImport is sorted. (Use code in post #70)

Share this post


Link to post
Share on other sites

Try this code in product.tpl

 

{if $rrp_price}
   <p id="rrp_price">{l s='RRP :'} <strike>
   {convertPrice price=$rrp_price}
   {if $tax_enabled && ((isset($display_tax_label) && $display_tax_label == 1) OR !isset($display_tax_label))}
       {if $priceDisplay == 1}{l s='tax excl.'}{else}{l s='tax incl.'}{/if}
   {/if}
   </strike></p>
   <p id="reduction_percent">{l s='You save:'}<span id="reduction_percent_display">
   {if $priceDisplay >= 0 && $priceDisplay <= 2}
       {convertPrice price=($rrp_price - $product->getPrice(true, $smarty.const.NULL))}{/if}
       {l s='('}{round((($rrp_price - $product->getPrice(true, $smarty.const.NULL)) / $rrp_price) * 100, 0)}%{l s=')'}
   {/if}
   {if $priceDisplay == 2}
       {convertPrice price=($rrp_price - $product->getPrice(false, $smarty.const.NULL))}
       {l s='('}{round((($rrp_price - $product->getPrice(false, $smarty.const.NULL)) / $rrp_price) * 100, 0)}%{l s=')'}
   {/if}
   </span></p>
{/if}

Share this post


Link to post
Share on other sites

1.5 Version AdminImport.php

 

#
#----------[ OPEN ]----------
#
admin/tabs/AdminImport.php
#
#----------[ FIND ]----------
#
'price_tin' => array('AdminImport', 'getPrice'), // Tax included
#
#----------[ AFTER, ADD ]----------
#
'recommended_retail_price' => array('AdminImport', 'getPrice'),
#
#----------[ FIND ]----------
#
'price_tin' => $this->l('Price tax incl.'),
#
#----------[ AFTER, ADD ]----------
#
'recommended_retail_price' => $this->l('Recommended retail price'),

 

1.6 Version AdminImport.PHP

 

 

#
admin/tabs/AdminImport.php
#
#----------[ FIND ]----------
#
'price_tin' => array('AdminImport', 'getPrice'), // Tax included
#
#----------[ AFTER, ADD ]----------
#
'recommended_retail_price' => array('AdminImport', 'getPrice'), // Tax included
#
#----------[ FIND ]----------
#
'price_tin' => array('label' => $this->l('Price tax incl.')),
#
#----------[ AFTER, ADD ]----------
#
'recommended_retail_price' => array('label' => $this->l('Recommended retail price tax incl.')),

 

 

1.5 says

 

 

 

#----------[ AFTER, ADD ]----------

#

'recommended_retail_price' => $this->l('Recommended retail price'),

 

 

1.6 says

 

 

#----------[ AFTER, ADD ]----------

#

'recommended_retail_price' => array('label' => $this->l('Recommended retail price tax incl.')),

 

 

After I tried to update the 1.5 version to 1.6 version, the RRR field in the BO import feature disappeared. I redid it back to 1.5 version, and it pops back up again.

Share this post


Link to post
Share on other sites

OK, which version exactly are you using?

 

do you have:

'price_tin' => $this->l('Price tax incl.'),

or

'price_tin' => array('label' => $this->l('Price tax incl.')),

 

You need to follow the format contained in your file. Code in 1.6 is from 1.4.4.1 Final.

Share this post


Link to post
Share on other sites