Jump to content

[Solved] How to put CMS Article in product tab for every product or selected few?


Recommended Posts

Add the following code to product.php before the $smarty->display:

$cms = new CMS(1, intval($cookie->id_lang));
$smarty->assign('cms', $cms);



This will get the content of CMS page 1 in the currently selected language. Change 1 to whatever page you want to be displayed on the product page. Then add the following code in product.tpl in the "More info" section:

{$cms->content}

Link to comment
Share on other sites

Add the following code to product.php before the $smarty->display:

$cms = new CMS(1, intval($cookie->id_lang));
$smarty->assign('cms', $cms);



This will get the content of CMS page 1 in the currently selected language. Change 1 to whatever page you want to be displayed on the product page. Then add the following code in product.tpl in the "More info" section:

{$cms->content}



Ok, thanks. But for the 2nd part where exactly do I put the - {$cms->content} in the coding? Seems to break the tab positions up if I try to put them in the coding...
Link to comment
Share on other sites

Try putting it before or after {$product->description} on line 340 of product.tpl (in PrestaShop v1.3.1):

{$product->description}



Thanks that seemed to work but what if I didnt enter a description through the back office? I would like the More Info tab to show with the CMS article regardless. Only seems to show if you entered some text for product description. Thanks!
Link to comment
Share on other sites

Try putting it before or after {$product->description} on line 340 of product.tpl (in PrestaShop v1.3.1):

{$product->description}



Thanks that seemed to work but what if I didnt enter a description through the back office? I would like the More Info tab to show with the CMS article regardless. Only seems to show if you entered some text for product description. Thanks!

Remove
{if $product->description}


Or maybe add something like "OR $cms->content"...

/Mats

Link to comment
Share on other sites

My last post was a little short, maybe, so I'll ellaborate...

Try changing

   {if $product->description}
       <!-- full description -->
{$product->description}
   {/if}


to


       <!-- full description -->
       {$product->description}
       {$cms->content}


or


   {if $product->description}
       <!-- full description -->
       {$product->description}
   {/if}
   {$cms->content}


or even

{if product->description OR $cms->content}

   {if $product->description}
       <!-- full description -->
       {$product->description}
   {/if}
   {if $cms->content}
       {$cms->content}
   {/if}

{/if}


Not sure if any of the if statements are actually needed, especially if cms is never empty. It may however be useful if you want to add text, e.g. {l s='Details:'} {$product->description} and {l s='CMS:'} {$cms->content}

/Mats

Link to comment
Share on other sites

Thanks so much!! ^ ^ :D

Try putting it before or after {$product->description} on line 340 of product.tpl (in PrestaShop v1.3.1):

{$product->description}



Thanks that seemed to work but what if I didnt enter a description through the back office? I would like the More Info tab to show with the CMS article regardless. Only seems to show if you entered some text for product description. Thanks!

Remove
{if $product->description}


Or maybe add something like "OR $cms->content"...

/Mats



ok thanks! It shows though in the "Reviews" Tab above the "Add a review" button
Link to comment
Share on other sites

Not sure I understand...
Are you happy or do you have more questions?
I have a "Review" tab in my shop, but that one was created by me.
Are you saying that you have one too and that the information shows up there instead of in the tab associated with the idTab1 div/tab?

/Mats

Link to comment
Share on other sites

Not sure I understand...
Are you happy or do you have more questions?
I have a "Review" tab in my shop, but that one was created by me.
Are you saying that you have one too and that the information shows up there instead of in the tab associated with the idTab1 div/tab?

/Mats


Its fine now it's just that the info doesn't show up in the more info tab, but under the "review" tab. you can check the site below in my signature:
Link to comment
Share on other sites

OK, as long as you're happy...
It should appear in the tab "whose" div you put the code in... i.e. if you have e.g.

{if $product->description OR $cms->content}{l s='More info'}


and


{$product->description}
{$cms->content}


it should appear in the "More info" tab. The keyword here is "idTab1"

/Mats

Link to comment
Share on other sites

  • 2 weeks later...
  • 10 months 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...