// Themeconfigurator and homeslider

This commit is contained in:
Jerome Nadaud
2013-11-18 20:49:52 +01:00
parent c451ee1bd8
commit f2b5e6de51
11 changed files with 89 additions and 14 deletions
+1
View File
@@ -568,6 +568,7 @@ class InstallModelInstall extends InstallAbstractModel
'statssearch',
'statsstock',
'statsvisits',
'themeconfigurator',
);
}
return $modules;
+2 -7
View File
@@ -60,7 +60,7 @@ class HomeSlider extends Module
public function install()
{
/* Adds Module */
if (parent::install() && $this->registerHook('displayHome') && $this->registerHook('actionShopDataDuplication'))
if (parent::install() && $this->registerHook('displayTop') && $this->registerHook('actionShopDataDuplication'))
{
/* Sets up configuration */
$res = Configuration::updateValue('HOMESLIDER_WIDTH', '779');
@@ -660,7 +660,7 @@ class HomeSlider extends Module
return true;
}
public function hookDisplayHome()
public function hookDisplayTop()
{
if(!$this->_prepareHook())
return;
@@ -682,11 +682,6 @@ class HomeSlider extends Module
return parent::getCacheId($name);
}
public function hookTop()
{
return $this->hookDisplayHome();
}
public function clearCache()
{
$this->_clearCache('homeslider.tpl');
Binary file not shown.

After

Width:  |  Height:  |  Size: 162 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

@@ -70,7 +70,8 @@ class ThemeConfigurator extends Module
);
if (!parent::install() ||
!$this->installDB() ||
!$this->installDB() ||
!$this->installFixtures() ||
!$this->registerHook('displayHeader') ||
!$this->registerHook('displayTop') ||
!$this->registerHook('displayLeftColumn') ||
@@ -78,7 +79,6 @@ class ThemeConfigurator extends Module
!$this->registerHook('displayHome') ||
!$this->registerHook('displayFooter') ||
!$this->registerHook('displayBackOfficeHeader') ||
!Configuration::updateValue('PS_TC_THEMES', serialize($themes_colors)) ||
!Configuration::updateValue('PS_TC_FONTS', serialize($themes_fonts)))
return false;
@@ -113,6 +113,58 @@ class ThemeConfigurator extends Module
return true;
}
public function installFixtures()
{
$result = true;
for ($i = 1; $i < 6; $i++)
{
$result &= Db::getInstance()->Execute('
INSERT INTO `'._DB_PREFIX_.'themeconfigurator` (
`id_shop`, `id_lang`, `item_order`, `title`, `title_use`, `hook`, `url`, `target`, `image`, `image_w`, `image_h`, `html`, `active`
) VALUES (
\''.(int)$this->context->shop->id.'\',
\''.(int)$this->context->language->id.'\',
\''.(int)$i.'\',
\'\',
\'0\',
\'home\',
\'\',
\'\',
\'banner-img'.$i.'.jpg\',
\'\',
\'\',
\'\',
1)
');
}
for ($i = 6; $i < 8; $i++)
{
$result &= Db::getInstance()->Execute('
INSERT INTO `'._DB_PREFIX_.'themeconfigurator` (
`id_shop`, `id_lang`, `item_order`, `title`, `title_use`, `hook`, `url`, `target`, `image`, `image_w`, `image_h`, `html`, `active`
) VALUES (
\''.(int)$this->context->shop->id.'\',
\''.(int)$this->context->language->id.'\',
\''.(int)$i.'\',
\'\',
\'0\',
\'top\',
\'\',
\'\',
\'banner-img'.$i.'.jpg\',
\'\',
\'\',
\'\',
1)
');
}
return $result;
}
public function uninstall()
{
$images = Db::getInstance()->executeS('SELECT image FROM `'._DB_PREFIX_.'themeconfigurator`');
@@ -166,7 +218,7 @@ class ThemeConfigurator extends Module
'htmlitems'=> $this->getItemsFromHook('top'),
'hook' => 'top'
));
return $this->display(__FILE__, 'views/templates/hooks/hook.tpl');
return $this->display(__FILE__, 'hook.tpl');
}
public function hookDisplayHome()
@@ -175,7 +227,7 @@ class ThemeConfigurator extends Module
'htmlitems'=> $this->getItemsFromHook('home'),
'hook' => 'home'
));
return $this->display(__FILE__, 'views/templates/hooks/hook.tpl');
return $this->display(__FILE__, 'hook.tpl');
}
public function hookDisplayLeftColumn()
@@ -184,7 +236,7 @@ class ThemeConfigurator extends Module
'htmlitems'=> $this->getItemsFromHook('left'),
'hook' => 'left'
));
return $this->display(__FILE__, 'views/templates/hooks/hook.tpl');
return $this->display(__FILE__, 'hook.tpl');
}
public function hookDisplayRightColumn()
@@ -193,7 +245,7 @@ class ThemeConfigurator extends Module
'htmlitems'=> $this->getItemsFromHook('right'),
'hook' => 'right'
));
return $this->display(__FILE__, 'views/templates/hooks/hook.tpl');
return $this->display(__FILE__, 'hook.tpl');
}
public function hookDisplayFooter()
@@ -202,7 +254,7 @@ class ThemeConfigurator extends Module
'htmlitems'=> $this->getItemsFromHook('footer'),
'hook' => 'footer'
));
return $this->display(__FILE__, 'views/templates/hooks/hook.tpl');
return $this->display(__FILE__, 'hook.tpl');
}
protected function getItemsFromHook($hook)
@@ -0,0 +1,27 @@
{if isset($htmlitems) && $htmlitems}
<div id="htmlcontent_{$hook}">
<ul class="htmlcontent-home clearfix row">
{foreach name=items from=$htmlitems item=hItem}
<li class="htmlcontent-item col-xs-4">
{if $hItem.url}
<a href="{$hItem.url}" class="item-link"{if $hItem.target == 1} target="_blank"{/if}>
{/if}
{if $hItem.image}
<img src="{$module_dir}images/{$hItem.image}" class="item-img" alt="" />
{/if}
{if $hItem.title && $hItem.title_use == 1}
<h3 class="item-title">{$hItem.title}</h3>
{/if}
{if $hItem.html}
<div class="item-html">
{$hItem.html} <i class="icon-double-angle-right"></i>
</div>
{/if}
{if $hItem.url}
</a>
{/if}
</li>
{/foreach}
</ul>
</div>
{/if}