Jump to content

Show 2 prices on products Prestashop 1.6


Recommended Posts

Hello everyone! Prestashop community!
 
Today I will show you a simple and easy way to show 2 or more in the product price. I will explain the pros and cons, and sample code. My idea is to share this with all, and of course, much more to be improving, and that's what you need, and I think with everyone's help we can make this work very well.
 
As we begin !.
 
1- Changing code.
 
For this, we will need to modify the moment, the source code of product-list.tpl, which is in themes / yourtheme /.
 
and look for the following:
 
{if (!$PS_CATALOG_MODE AND ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))}
					<div itemprop="offers" itemscope itemtype="http://schema.org/Offer" class="content_price">
						{if isset($product.show_price) && $product.show_price && !isset($restricted_country_mode)}
							<span itemprop="price" class="price product-price">
								{if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if}
							</span>
							<meta itemprop="priceCurrency" content="{$priceDisplay}" />
							{if isset($product.specific_prices) && $product.specific_prices && isset($product.specific_prices.reduction) && $product.specific_prices.reduction}
								<span class="old-price product-price">
									{displayWtPrice p=$product.price_without_reduction}
								</span>
								
							{/if}
						{/if}
					</div>
					{/if}

in this part where it says: (itemprop="price" class="price product-price") simply add the product price with or without VAT.

 

The idea is simple, it is to show a currency more, with a corresponding price, in my case, I want to show Korean WON.

 

For that, I made a simple code, this will insert between "{if (!$PS_CATALOG_MODE AND ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))}" and "{/if}"

 

first to make it faster and easier, cleared the code (If it's like this) and would look like:

{if (!$PS_CATALOG_MODE AND ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))}




{/if}

then insert Space:

<div itemprop="offers" itemscope itemtype="http://schema.org/Offer" class="content_price">
						{if isset($product.show_price) && $product.show_price && !isset($restricted_country_mode)}
							
                            
                            {if isset($product.specific_prices) && $product.specific_prices && isset($product.specific_prices.reduction) && $product.specific_prices.reduction}
								<span class="old-price product-price">
									{displayWtPrice p=$product.price_without_reduction}
								</span>
								
							{/if}
                            
                            
                            
                            {if isset($product.specific_prices) && $product.specific_prices && isset($product.specific_prices.reduction) && $product.specific_prices.reduction}
								<span class="old-price product-price">
									{$product.price_without_reduction*1350}원
								</span>
								
							{/if}
							
                            <p>
                            <span itemprop="price" class="price product-price">
								{if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if}
							</span>
							<meta itemprop="priceCurrency" content="{$priceDisplay}" />
                            
                            
                            <span id="our_price_display" itemprop="price">
                                	{if !$priceDisplay}{ round($product.price*1350)}{else}{round($product.price_tax_exc*1350)}{/if}원
                            	</span>
                            
							{if $product.specific_prices.reduction_type == 'percentage'}
    <div class="price-percent-reduction">
        <p>{$product.specific_prices.reduction*100}%<p>
    </div>
{/if}
							
						{/if}
                        
                        </p>
                        
                        
                        
					</div>

and shall be as follows:

{if (!$PS_CATALOG_MODE AND ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))}
					<div itemprop="offers" itemscope itemtype="http://schema.org/Offer" class="content_price">
						{if isset($product.show_price) && $product.show_price && !isset($restricted_country_mode)}
							
                            
                            {if isset($product.specific_prices) && $product.specific_prices && isset($product.specific_prices.reduction) && $product.specific_prices.reduction}
								<span class="old-price product-price">
									{displayWtPrice p=$product.price_without_reduction}
								</span>
								
							{/if}
                            
                            
                            
                            {if isset($product.specific_prices) && $product.specific_prices && isset($product.specific_prices.reduction) && $product.specific_prices.reduction}
								<span class="old-price product-price">
									{$product.price_without_reduction*1350}원
								</span>
								
							{/if}
							
                            <p>
                            <span itemprop="price" class="price product-price">
								{if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if}
							</span>
							<meta itemprop="priceCurrency" content="{$priceDisplay}" />
                            
                            
                            <span id="our_price_display" itemprop="price">
                                	{if !$priceDisplay}{ round($product.price*1350)}{else}{round($product.price_tax_exc*1350)}{/if}원
                            	</span>
                            
							{if $product.specific_prices.reduction_type == 'percentage'}
    <div class="price-percent-reduction">
        <p>{$product.specific_prices.reduction*100}%<p>
    </div>
{/if}

						{/if}                        
                        </p>
					</div>
					{/if}

with this, we will show the prices as follows:

 

imagen1.png

 

and when you have discounted prices will be shown as follows:

 

imagen2.png

 

With this we have everything, it's simple as I explained at the outset.

 

2 Advantages and disadvantages.
 
* First let's talk about its benefits:
 
Displays a simple, 2 prices of a product, in my case it is very important because I'm selling Spanish products to South Korea
 
* Cons.
 
Once you do so, you can not add more currency in the store, and that changing to another, obviously I would do the calculation wrong, and that's a bad result and a lack of seriousness of an online store.
 
The format is something even I can not do, wanted to know if anyone can help me on that. It is important and crucial. I have sought ways and can not find it.
 
Updated More than obvious, we can not upgrade from the backoffice currency change, always have to do from the product-list.tpl file, which is very slow when updating.
 
 
 
I hope you liked it, it's just a basic idea, and wanted to know if they can improve. I still have much to learn from prestashop. It's an idea, I'm sure many will help them, and clear to those who are good at programming, you sure have a way of updating and formatting. Estaria buenisimo the encontrasen and share for everyone.
 
Well, hello to everyone, and I hope your answers!
 
 
 

 

post-796871-0-08178600-1415378831_thumb.png

post-796871-0-42518200-1415378834_thumb.png

Link to comment
Share on other sites

  • 2 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...