Jump to content

[SOLVED] Thickbox just like Terms and conditions CMS


Recommended Posts

You will need to copy the code PrestaShop uses to enable thickbox into whatever files you need it on. Here's the code in product.php that enables thickbox:

/* CSS ans JS files calls */
$css_files = array(
   __PS_BASE_URI__.'css/thickbox.css' => 'screen'
);

$js_files = array(
   __PS_BASE_URI__.'js/jquery/thickbox-modified.js',
   __PS_BASE_URI__.'js/jquery/jquery.idTabs.modified.js',
   __PS_BASE_URI__.'js/jquery/jquery.scrollto.js',
   __PS_BASE_URI__.'js/jquery/jquery.serialScroll.js',
   _THEME_JS_DIR_.'tools.js',
   _THEME_JS_DIR_.'product.js'
);

if (file_exists(_PS_THEME_DIR_.'thickbox.tpl'))
   $smarty->display(_PS_THEME_DIR_.'thickbox.tpl');



You will need to edit the appropriate PHP file for the page and add the thickbox.css, thickbox-modified.js and thickbox.tpl references. Once you've done that, you can add code like the following to the page's TPL:

<a href="link_to_content" class="thickbox">link text

Link to comment
Share on other sites

Hi Rocky,


I just tried to follow the steps you mentioned on this post but unfortunately my CMS pages didn't appear on a thickbox like Terms and Conditions during checkout.


Could you please explain the different steps I need to do ?


Thanks,


Dominique

Link to comment
Share on other sites

Rocky,

Thanks but if you don't mind can you please give us an example file that we can use? like putting the above code to which file ? when you say appropriate PHP files... which one is the appropriate PHP file.... will i be able to put a youtube link and it will open up in a thickbox ?

Link to comment
Share on other sites

If you explain exactly what you are wanting to do, it will be easier for me to be more specific. On which page do you want to display something in thickbox? Thickbox lets you display anything from another website in the content area.

Link to comment
Share on other sites

Ok sorry for not explaining very well,

I want to put a text link or image link in the Product page under the MORE INFO section to show a picture or a cms in thickbox

let's say in the MORE INFO tab I put

CLICK HERE for more information


when the customer clicks on CLICK HERE a CMS or a PICTURE or a YOUTUBE VIDEO will appear in a thickbox.

Does that explain it ?
Link to comment
Share on other sites

In that case, it is easy, since product page already includes thickbox for the product images. You just have to put a link like this in the product description:

<a href="link_to_content" class="thickbox">Click here for more information



Change link_to_content to the URL of the content you want to display in thickbox.

  • Like 1
Link to comment
Share on other sites

You need to use a query string to display only the center column. For example, here's the "Terms and conditions" link (with friendly URL turned on):

/content/3-terms-and-conditions-of-use?content_only=1&TB_iframe=true&width=450&height=500&thickbox=true

  • Like 2
Link to comment
Share on other sites

You put the code in the wrong place in cms.php. Try the following instead:

<?php

include(dirname(__FILE__).'/config/config.inc.php');

//will be initialized bellow...
if(intval(Configuration::get('PS_REWRITING_SETTINGS')) === 1)
   $rewrited_url = null;

include(dirname(__FILE__).'/init.php');

if (($id_cms = intval(Tools::getValue('id_cms'))) AND $cms = new CMS(intval($id_cms), intval($cookie->id_lang)) AND Validate::isLoadedObject($cms))
{
   /* rewrited url set */
   $rewrited_url = $link->getCmsLink($cms, $cms->link_rewrite);

   include(dirname(__FILE__).'/header.php');

   /* CSS ans JS files calls */
   $css_files = array(
       __PS_BASE_URI__.'css/thickbox.css' => 'screen'
   );

   $js_files = array(
       __PS_BASE_URI__.'js/jquery/thickbox-modified.js',
   );

   if (file_exists(_PS_THEME_DIR_.'thickbox.tpl'))
       $smarty->display(_PS_THEME_DIR_.'thickbox.tpl');

   $smarty->assign(array(
       'cms' => $cms,
       'content_only' => intval(Tools::getValue('content_only'))
   ));
   $smarty->display(_PS_THEME_DIR_.'cms.tpl');
   include(dirname(__FILE__).'/footer.php');
}
else
   Tools::redirect('404.php');

?>

Link to comment
Share on other sites

Hello Rocky,

thanks for your screenshot as far as cms.php is concerned. I replaced my original cms.php with yours bu none of my CMS pages appear in a thickbox.

Do you think I missed out something ? :) That seems weird !

Here's my cms.tpl on my theme :

{if !$content_only}
   {capture name=path}{l s=$cms->meta_title}{/capture}
   {include file=$tpl_dir./breadcrumb.tpl}
{/if}
{if $cms}

       {$cms->content}

{else}
   {l s='This page does not exist.'}
{/if}


{if !$content_only}

{l s='Home'}
{/if}
Shipping 
Legal notice 
Terms and conditions 
About us 
Secure payment 




Thanks again for your help,

Dominique

Link to comment
Share on other sites

  • 2 months later...

hello
I also want to display a page in CMS from an image in the module freeblock.I 've followed the instructions of Rocky: I put a link like this


but it gives me the page without css and home page disappears.
Then I added the following code in the page freeblock.php

/* CSS ans JS files calls */
$css_files = array(
   __PS_BASE_URI__.'css/thickbox.css' => 'screen'
);
$js_files = array(
   __PS_BASE_URI__.'js/jquery/thickbox-modified.js',
);

but the left column disappears.

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...