Front integration

This commit is contained in:
Michael RICOIS 2017-11-06 10:26:53 +01:00
parent cc35d92d83
commit 3eab7df2ef
12 changed files with 171 additions and 82 deletions

View File

@ -0,0 +1,6 @@
<?php
require_once dirname(__FILE__).'/../../config/config.inc.php';
require_once dirname(__FILE__).'/controllers/front/CategoryController.php';
$controller = new CategoryController();
$controller->run();

View File

@ -31,7 +31,7 @@ class GuideCategory extends ObjectModel
'meta_title' => 128,
'meta_description' => 255,
'meta_keywords' => 255
);
);
protected $fieldsValidateLang = array(
'name' => 'isCatalogName',
'link_rewrite' => 'isLinkRewrite',
@ -39,20 +39,22 @@ class GuideCategory extends ObjectModel
'meta_title' => 'isGenericName',
'meta_description' => 'isGenericName',
'meta_keywords' => 'isGenericName'
);
);
private $error;
public function getFields()
{
parent::validateFields();
if (isset($this->id))
$fields['id_guide_category'] = (int)($this->id);
if (isset($this->id)) {
$fields['id_guide_category'] = (int)($this->id);
}
$fields['id_category_family'] = (int)($this->id_category_family);
$fields['active'] = (int)($this->active);
$fields['id_parent'] = (int)($this->id_parent);
$fields['position'] = (int)($this->position);
$fields['level_depth'] = (int)($this->level_depth);
return $fields;
}
@ -66,6 +68,7 @@ class GuideCategory extends ObjectModel
if ($this->id) {
return _PS_ROOT_DIR_.'/'.self::getSubPath().'/'.$this->id.'.jpg';
}
return '';
}
@ -74,6 +77,7 @@ class GuideCategory extends ObjectModel
if ($this->id) {
return __PS_BASE_URI__.self::getSubPath().'/'.$this->id.'.jpg';
}
return '';
}
@ -90,15 +94,12 @@ class GuideCategory extends ObjectModel
$sql .= " AND a.`id_guide_category` <> '".intval($exclude_id)."'";
}
$rows = array();
self::findRecursiveData(
$rows,
$sql,
array(
'id_parent' => 0,
'identifier' => 'id_guide_category',
'level' => -1
)
);
self::findRecursiveData($rows, $sql, array(
'id_parent' => 0,
'identifier' => 'id_guide_category',
'level' => -1
));
return $rows;
}
@ -115,24 +116,17 @@ class GuideCategory extends ObjectModel
$sql .= " AND a.`id_category_family` <> '".intval($exclude_id)."'";
}
$rows = array();
self::findRecursiveData(
$rows,
$sql,
array(
'id_parent' => 0,
'identifier' => 'id_category_family',
'level' => -1
)
);
self::findRecursiveData($rows, $sql, array(
'id_parent' => 0,
'identifier' => 'id_category_family',
'level' => -1
));
return $rows;
}
private static function findRecursiveData(
&$rows,
$sql,
array $params
)
private static function findRecursiveData(&$rows, $sql, array $params)
{
$level = $params['level'];
$level++;
@ -141,15 +135,11 @@ class GuideCategory extends ObjectModel
foreach($resuts as &$row) {
$row['level'] = $level;
$rows[] = $row;
self::findRecursiveData(
$rows,
$sql,
array(
'id_parent' => $row[$params['identifier']],
'identifier' => $params['identifier'],
'level' => $level
)
);
self::findRecursiveData($rows, $sql, array(
'id_parent' => $row[$params['identifier']],
'identifier' => $params['identifier'],
'level' => $level
));
}
}

View File

@ -0,0 +1,6 @@
<?php
require_once dirname(__FILE__).'/../../config/config.inc.php';
require_once dirname(__FILE__).'/controllers/front/ContentController.php';
$controller = new ContentController();
$controller->run();

View File

@ -0,0 +1,23 @@
<?php
class CategoryController extends FrontController
{
//public function init(){}
//public function preProcess(){}
//public function displayHeader(){}
//public function process(){}
public function displayContent()
{
parent::displayContent();
if (is_file(_PS_THEME_DIR_ . 'modules/purchaseguide/views/front/category.tpl')) {
$tplFile = _PS_THEME_DIR_ . 'modules/purchaseguide/views/front/category.tpl';
}
else {
$tplFile = _PS_MODULE_DIR_ . 'purchaseguide/views/templates/front/category.tpl';
}
self::$smarty->display($tplFile);
}
}

View File

@ -0,0 +1,17 @@
<?php
class ContentController extends FrontController
{
public function displayContent()
{
parent::displayContent();
if (is_file(_PS_THEME_DIR_ . 'modules/purchaseguide/views/front/content.tpl')) {
$tplFile = _PS_THEME_DIR_ . 'modules/purchaseguide/views/front/content.tpl';
}
else {
$tplFile = _PS_MODULE_DIR_ . 'purchaseguide/views/templates/front/content.tpl';
}
self::$smarty->display($tplFile);
}
}

View File

@ -31,6 +31,8 @@ class PurchaseGuide extends Module
return FALSE;
}
$this->registerHook('leftColumn');
return TRUE;
}
@ -241,4 +243,19 @@ class PurchaseGuide extends Module
');
}
public function hookDisplayNavTop(){}
public function hookDisplayNavLeft(){}
public function hookRightColumn(){}
public function hookLeftColumn()
{
return $this->display(__FILE__, '/views/templates/front/leftcolumn.tpl');
}
public function displayCategory(){}
public function displayContent(){}
}

View File

@ -0,0 +1,6 @@
{include file="$tpl_dir./breadcrumb.tpl"}
<h1>TITLE</h1>
<div class="rte{if $content_only} content_only{/if}">
CONTENT
</div>

View File

@ -0,0 +1,12 @@
LEFT
HOOK_EXEC
Blockcms
Liste des catégories
RIGHT
Affichage du contenu categorie
Titre + Texte + image
Affichage menu des sous rubriques
Affichage du contenu de la sous rubrique

View File

@ -0,0 +1,11 @@
<div class="block-cms informations_block_left">
<h4>Vêtements</h4>
<ul class="block_content">
<li>
<a href="#">Bébés</a>
</li>
<li>
<a href="#">Enfants</a>
</li>
</ul>
</div>

View File

@ -396,6 +396,7 @@ class FrontController extends FrontControllerCore {
'module-ant_support_form-support',
'module-paypal-express_checkout-payment',
'module-paymentinfo-manage',
'module-purchaseguide-',
);
$displayRight = array(