Jump to content

[SOLVED] How to add a cms page with link in product page


Recommended Posts

Hello

i want to have a text under my "Add to cart" button with linking to a cms page that i can write some rules for shipping and return so customers by clicking to this text can view a chart for shipping costs.

something like this page:

http://www.meincupcake.de/shop/Lebensmittelfarbstoffe/Lebensmittelfarbe-fluessig/Lebensmittelfarbe--Metallic---Pearlescent---Dunkel-Gold.html

 

you can see text "Versand" above add to cart button that when click on it you will go to this page:

 

http://www.meincupcake.de/shop/info/Lieferung-und-Versandkosten.html

I have found this:

 

http://hassadee.com/2012/10/06/how-to-link-to-page-of-cms-in-prestashop/

 

but dont know where i must put this code in my product.tpl file?

thank you for helping

Edited by niloo (see edit history)
Link to comment
Share on other sites

you can edit product.tpl file

below the add to cart button you can add code like:

<a href="{$link->getCmsLink(1)}">{l s='my cms page'}</a>

where the 1 is an ID of page you want to link

here is my tpl file. could you please tell me exactly in which line i must add this? because there is several "add to cart" text in it:



{include file="$tpl_dir./errors.tpl"}
{if $errors|@count == 0}
<script type="text/javascript">
// <![CDATA[

// PrestaShop internal settings
var currencySign = '{$currencySign|html_entity_decode:2:"UTF-8"}';
var currencyRate = '{$currencyRate|floatval}';
var currencyFormat = '{$currencyFormat|intval}';
var currencyBlank = '{$currencyBlank|intval}';
var taxRate = {$tax_rate|floatval};
var jqZoomEnabled = {if $jqZoomEnabled}true{else}false{/if};

//JS Hook
var oosHookJsCodeFunctions = new Array();
.....

// Parameters
{if isset($packItems) && $packItems|@count > 0}
    <div id="blockpack">
        <h2>{l s='Pack content'}</h2>
        {include file="$tpl_dir./product-list.tpl" products=$packItems}
    </div>
{/if}

{/if}
Edited by niloo (see edit history)
Link to comment
Share on other sites

below this code:
 

<div class="price">
                        {if !$priceDisplay || $priceDisplay == 2}
                            {assign var='productPrice' value=$product->getPrice(true, $smarty.const.NULL)}
                            {assign var='productPriceWithoutRedution' value=$product->getPriceWithoutReduct(false, $smarty.const.NULL)}
                        {elseif $priceDisplay == 1}
                            {assign var='productPrice' value=$product->getPrice(false, $smarty.const.NULL)}
                            {assign var='productPriceWithoutRedution' value=$product->getPriceWithoutReduct(true, $smarty.const.NULL)}
                        {/if}
                        {if $product->specificPrice AND $product->specificPrice.reduction}
                                {if $priceDisplay >= 0 && $priceDisplay <= 2}
                                    {if $productPriceWithoutRedution > $productPrice}
                                        <span id="old_price_display">{convertPrice price=$productPriceWithoutRedution}</span>
                                        <!-- {if $tax_enabled && $display_tax_label == 1}
                                            {if $priceDisplay == 1}{l s='tax excl.'}{else}{l s='tax incl.'}{/if}
                                        {/if} -->
                                    {/if}
                                {/if}
                            {/if}
                            {if $product->specificPrice AND $product->specificPrice.reduction_type == 'percentage'}
                                <span id="reduction_percent">-{$product->specificPrice.reduction*100}%</span>
                            {elseif $product->specificPrice AND $product->specificPrice.reduction_type == 'amount' && $product->specificPrice.reduction|intval !=0}
                                <span id="reduction_amount">-{convertPrice price=$product->specificPrice.reduction|floatval}</span>
                            {/if}
                        <p class="our_price_display">
                        {if $priceDisplay >= 0 && $priceDisplay <= 2}
                            <span id="our_price_display">{convertPrice price=$productPrice}</span>                            
                            <!--{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}-->
                        {/if}
                        </p>
                            
                            {if (!$allow_oosp && $product->quantity <= 0) OR !$product->available_for_order OR (isset($restricted_country_mode) AND $restricted_country_mode) OR $PS_CATALOG_MODE}
                            <span class="exclusive">
                                <span></span>
                                {l s='Add to cart'}
                            </span>
                        {else}
                            <p id="add_to_cart" class="buttons_bottom_block">
                                <span></span>
                                <input type="submit" name="Submit" value="{l s='Add to cart'}" class="exclusive" />
                            </p>
                        {/if}
                        {if $product->on_sale}
                            <img src="{$img_dir}onsale_{$lang_iso}.gif" alt="{l s='On sale'}" class="on_sale_img"/>
                            <span class="on_sale">{l s='On sale!'}</span>
                        {elseif $product->specificPrice AND $product->specificPrice.reduction AND $productPriceWithoutRedution > $productPrice}
                            <span class="discount">{l s='Reduced price!'}</span>
                        {/if}
                        {if $priceDisplay == 2}
                            <br />
                            <span id="pretaxe_price"><span id="pretaxe_price_display">{convertPrice price=$product->getPrice(false, $smarty.const.NULL)}</span> {l s='tax excl.'}</span>
                        {/if}
                    </div>
  • Like 1
Link to comment
Share on other sites

 

below this code:

 

<div class="price">

Thank you so much. works like charm. a little customization i need. as you can see in picture it is stuck to the price.

post-65356-0-07743300-1393331786_thumb.jpg

i want it to go under "add to cart" button and a little have space with it. i have highlighted the desired place.

what must i do? cos in tpl file when i press enter between two cods nothing is happen.

Link to comment
Share on other sites

alysum.css line ~2262

 

add margin-bottom:3px; to

#productsCarousel div.price span, div.price {
direction: rtl;
overflow: hidden !important;
}

final code:

#productsCarousel div.price span, div.price {
direction: rtl;
overflow: hidden !important;
margin-bottom:3px;
}
  • Like 1
Link to comment
Share on other sites

  • 2 years later...

vekia you are a legend for me! ;))

i'd need a small suggestion:

if i want to insert an image somewhere in product.tpl (done, thanks to your tips)

but i want that image to be the #2 of uploaded product images...

example:

<a href="#2 thumb img" class="fancybox" width="458" height="271">
					<img src="#2 big img" alt="somethingh i like" title="always same">
				</a>

but i don't know how to give info of the ID 2 img

Link to comment
Share on other sites

×
×
  • Create New...