Jump to content

Image Mapping(scenes) on homepage


Snade

Recommended Posts

Hello everyone,

I'm trying to get Image Mapping (scenes) show on homepage.

I've found this solution in the forum, but cant get it running in 1.5.6.2

http://www.prestashop.com/forums/topic/43699-solved-image-mapping-on-the-home-page/page-2?do=findComment&comment=1174995


 

<?php
class IndexController extends IndexControllerCore
{
public function __construct()
{
  parent::__construct();
}

public function setMedia() {
  parent::setMedia();
  if ($this->context->getMobileDevice() == false)
  {
   //TODO : check why cluetip css is include without js file
   $this->addCSS(array(
    _THEME_CSS_DIR_.'scenes.css' => 'all',
    _THEME_CSS_DIR_.'category.css' => 'all',
    _THEME_CSS_DIR_.'product_list.css' => 'all',
   ));
   if (Configuration::get('PS_COMPARATOR_MAX_ITEM') > 0)
    $this->addJS(_THEME_JS_DIR_.'products-comparison.js');
  }
}

public function process()
{
  parent::process();
  $this->assignScenes(); 
}
/**
  * Assign scenes template vars
  */

protected function assignScenes()
{
  $this->category->id=2;
  // Scenes (could be externalised to another controler if you need them)
  $scenes = Scene::getScenes($this->category->id, $this->context->language->id, true, false);
  $this->context->smarty->assign('scenes', $scenes);

  // Scenes images formats
  if ($scenes && ($sceneImageTypes = ImageType::getImagesTypes('scenes')))
  {
   foreach ($sceneImageTypes as $sceneImageType)
   {
    if ($sceneImageType['name'] == ImageType::getFormatedName('m_scene'))
	 $thumbSceneImageType = $sceneImageType;
    elseif ($sceneImageType['name'] == ImageType::getFormatedName('scene'))
    $largeSceneImageType = $sceneImageType;
   }

   $this->context->smarty->assign(array(
	 'thumbSceneImageType' => isset($thumbSceneImageType) ? $thumbSceneImageType : null,
	 'largeSceneImageType' => isset($largeSceneImageType) ? $largeSceneImageType : null,
   ));
  }
}


}

In your index.tpl:
 

{if $scenes}
<!-- Scenes -->
{include file="$tpl_dir./scenes.tpl" scenes=$scenes}
{/if}


I dont have any idea why its not working. Will appriciate very much any help

Thank you very much :)

All the best,
Alexander

Link to comment
Share on other sites

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