inté homepage with edito

This commit is contained in:
Thibault GUILLAUME 2015-07-30 15:08:21 +02:00
parent 398aafeb1c
commit 8cf5f976fc
14 changed files with 247 additions and 70 deletions

View File

@ -0,0 +1,36 @@
<?php
require_once _MODULE_DIR_.'cmsps/classes/CmsPsEdito.php';
class PostEditoControllerCore extends FrontController
{
public $php_self = 'postedito';
public $postedito;
public function canonicalRedirection($canonical_url = '') {
parent::canonicalRedirection($this->context->link->getPostEditoLink($this->postedito->id));
}
public function init() {
$id_post_edito = Tools::getValue('id_post_edito', 0);
$this->postedito = new CmsPsEdito($id_post_edito, $this->context->language->id);
if (!Validate::isLoadedObject($this->postedito)
|| !$this->postedito->active) {
header('HTTP/1.1 404 Not Found');
header('Status: 404 Not Found');
}
parent::init();
}
public function initContent() {
parent::initContent();
$this->context->smarty->assign(array(
// 'path' => Tools::getPath($this->postedito->id, '', FALSE, 'postedito'),
'post' => $this->postedito
));
// $this->setTemplate(_PS_THEME_DIR_.'postedito.tpl');
}
}

View File

@ -14,19 +14,6 @@ class CmsPsEdito extends ObjectModel {
public $meta_title;
public $meta_desc;
public $img_size = array(
array(
'name' => 'small',
'width' => 400,
'height' => 240
),
array(
'name' => 'big',
'width' => 770,
'height' => 500
)
);
/**
* @see ObjectModel::$definition
*/
@ -55,5 +42,13 @@ class CmsPsEdito extends ObjectModel {
parent::__construct($id, $id_lang, $id_shop);
}
public static function getLast($id_lang) {
$collection_post = new Collection('CmsPsEdito', $id_lang);
$collection_post->where('active', '=', 1);
$collection_post->orderby('date_add', 'DESC');
$collection_post->setPageSize(1);
$edito = $collection_post->getFirst();
return $edito;
}
}

View File

@ -7,12 +7,14 @@ class ManageSeoUrl extends ObjectModel {
const TYPE_MANUFACTURER = 3;
const TYPE_CATEGORY_CMS = 4;
const TYPE_POST_CMS = 5;
const TYPE_CMS = 6;
const TYPE_301 = 7;
const TYPE_STORE_HOME = 8;
const TYPE_POST_EDITO = 6;
const TYPE_CMS = 7;
const TYPE_301 = 8;
const TYPE_STORE_HOME = 9;
const SUFFIX_HTML = '.html';
const SUFFIX_PHP = '.php';
const PREFIX_EDITO = 'edito-';
public $id_seourl;
public $link_rewrite;

View File

@ -9,6 +9,7 @@ class AdminSeoUrlController extends ModuleAdminController {
ManageSeoUrl::TYPE_MANUFACTURER => 'Fabricants',
ManageSeoUrl::TYPE_CATEGORY_CMS => 'Catégorie CMS',
ManageSeoUrl::TYPE_POST_CMS => 'Article CMS',
ManageSeoUrl::TYPE_POST_EDITO => 'Edito',
ManageSeoUrl::TYPE_CMS => 'CMS',
ManageSeoUrl::TYPE_301 => 'Redirection 301',
ManageSeoUrl::TYPE_STORE_HOME => 'Page accueil boutique'
@ -97,14 +98,18 @@ class AdminSeoUrlController extends ModuleAdminController {
'type' => $this->l('Article CMS')
),
5 => array(
'id_type' => ManageSeoUrl::TYPE_POST_EDITO,
'type' => $this->l('Edito')
),
6 => array(
'id_type' => ManageSeoUrl::TYPE_CMS,
'type' => $this->l('CMS')
),
6 => array(
7 => array(
'id_type' => ManageSeoUrl::TYPE_301,
'type' => $this->l('Redirection 301')
),
7 => array(
8 => array(
'id_type' => ManageSeoUrl::TYPE_STORE_HOME,
'type' => $this->l('Accueil boutique')
)

View File

@ -29,6 +29,7 @@ class SeoUrl extends Module {
if (!parent::install() || !$this->registerHook('actionProductDelete')
|| !$this->registerHook('seoUrlCmsCategory')
|| !$this->registerHook('seoUrlCmsPost')
|| !$this->registerHook('seoUrlCmsEdito')
|| !$this->registerHook('actionObjectCmsUpdateAfter')
|| !$this->registerHook('actionObjectCmsDeleteAfter')
|| !$this->registerHook('displayHeader')
@ -135,4 +136,22 @@ class SeoUrl extends Module {
}
}
public function hookseoUrlCmsEdito($params) {
$id_shop = Context::getContext()->shop->id;
$seo_url = ManageSeoUrl::getByType($params['object']->id, ManageSeoUrl::TYPE_POST_EDITO, FALSE, NULL, $id_shop);
$urls = array();
foreach (Language::getLanguages() as $language) {
$id_lang = (int)$language['id_lang'];
$urls[$id_lang] = ManageSeoUrl::PREFIX_EDITO.$params['object']->id.'-'.$params['object']->slug[$id_lang].'.php';
}
if (!$seo_url instanceOf ManageSeoUrl) {
ManageSeoUrl::createUrl(ManageSeoUrl::TYPE_POST_EDITO, $params['object']->id, $urls);
} else {
$seo_url->link_rewrite = $urls;
$seo_url->save();
}
}
}

View File

@ -60,6 +60,10 @@ class Dispatcher extends DispatcherCore {
$this->controller = 'postcms';
$_POST['id_post_cms'] = $current_uri['id_element'];
}
elseif ($current_uri['type'] == ManageSeoUrl::TYPE_POST_EDITO) {
$this->controller = 'postedito';
$_POST['id_post_edito'] = $current_uri['id_element'];
}
elseif ($current_uri['type'] == ManageSeoUrl::TYPE_CMS) {
$this->controller = 'cms';
$_POST['id_cms'] = $current_uri['id_element'];

View File

@ -10,6 +10,7 @@ class Link extends LinkCore
// CMS
public static $urls_categories_cms = array();
public static $urls_posts_cms = array();
public static $urls_editos_cms = array();
public function getCategoryCmsLink($id_category_cms, $id_lang = null, $id_shop = null,
@ -52,6 +53,24 @@ class Link extends LinkCore
}
public function getPostEditoLink($id_post_edito, $id_lang = null, $id_shop = null,
$ipa = 0, $force_routes = false, $relative_protocol = false) {
if (!$id_lang)
$id_lang = Context::getContext()->language->id;
if (!$id_shop)
$id_shop = Context::getContext()->shop->id;
$url = $this->getBaseLink($id_shop, null, $relative_protocol).$this->getLangLink($id_lang, null, $id_shop);
if(!isset(self::$urls_editos_cms[$id_post_edito])) {
$link = ManageSeoUrl::getByType($id_post_edito, ManageSeoUrl::TYPE_POST_EDITO, FALSE, $id_lang, $id_shop);
self::$urls_editos_cms[$id_post_edito] = $url.$link->link_rewrite;
return $url.$link->link_rewrite;
} else {
return self::$urls_editos_cms[$id_post_edito];
}
}
}

View File

@ -1,4 +1,5 @@
<?php
include _MODULE_DIR_.'cmsps/classes/CmsPsEdito.php';
include _MODULE_DIR_.'cmsps/classes/CmsPsPost.php';
class IndexController extends IndexControllerCore
@ -6,11 +7,11 @@ class IndexController extends IndexControllerCore
public function initContent() {
$id_lang = Context::getContext()->language->id;
$last_edito = '';
$edito = CmsPsEdito::getLast($id_lang);
$posts = CmsPsPost::getPostHome($id_lang);
$this->context->smarty->assign(array(
'edito' => $last_edito,
'edito' => $edito,
'posts_home_1' => array_slice($posts, 0, 4),
'posts_home_2' => array_slice($posts, 4, 3),
'posts_home_3' => array_slice($posts, 7, 3),

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
html { background: #ffffff }
body { background: #ffffff; font-family: 'Myriad Pro'; font-size: 16px; margin: 0 }
body { background: #ffffff; font-family: 'pt_sans'; font-size: 16px; margin: 0 }
body.content_only { margin: 0 }
.container.main,
.container.account { min-height: 300px; padding: 30px 15px }
@ -134,7 +134,7 @@ body .ac_results {
}
.intro_top .intro_home { text-align: center; }
.intro_top .intro_home h2 { font-family: 'vidaloka'; font-size: 60px; }
.intro_top .intro_home p { font-family: 'pt_sans'; font-size: 15px; font-weight: normal; }
.intro_top .intro_home p { font-family: 'pt_sans'; font-size: 15px; font-weight: normal; }
#index main {
clear: both;
@ -144,6 +144,47 @@ body .ac_results {
#index main .pub {
}
.inner_edito {
border-bottom: 2px solid #333333;
border-top: 2px solid #333333;
padding: 15px;
}
.inner_edito .inner {
background: url('../img/edito_home.png') no-repeat;
color: #fff;
height: 292px;
overflow: auto;
text-align: center;
width: 170px;
}
.inner_edito .inner .name {
font-family: 'nautilus';
margin-top: 150px;
display: block;
font-size: 18px;
}
.inner_edito .inner .name_edito {
font-family: 'pompiere_regular';
text-transform: uppercase;
font-size: 42px;
}
.inner_edito h2 {
font-family: 'vidaloka';
font-size: 36px;
margin: 0 0 15px 0;
}
.inner_edito h2 a { color: #333333}
.inner_edito h2 a:hover {text-decoration: none;}
.inner_edito .readmore { float: right;}
.inner_edito .readmore a { color: #333333;}
.inner_edito ul { margin: 0; margin-left: 45px; padding: 0; }
.inner_edito ul li {
float: left;
margin: 0 5px;
}
.inner_edito ul li a { color: #fff; font-size: 30px;}
.post_home_top {}
.post_home_top .post.post_simple {
@ -180,7 +221,7 @@ body .ac_results {
text-indent: 10px;
text-transform: uppercase;
top: -23px;
width: 122px;
width: 122px;
}
.post .info .label_post.trick{
background-position: 0px -57px;
@ -190,13 +231,14 @@ body .ac_results {
color: #333333;
font-family: "vidaloka";
margin: 10px 0 0;
padding-left: 15px;
padding-left: 25px;
padding-right: 0;
max-height: 30px;
}
.post_simple h3 {
font-size: 18px;
margin-top: 0;
padding-left: 15px;
}
.post_simple h3 a,
.post .info h3 a {
@ -254,7 +296,7 @@ body .ac_results {
.encart_boutique {
background: url('../img/logo_home_boutique.jpg') no-repeat top center;
background: url('../img/logo_home_boutique.jpg') no-repeat center center;
height: 344px;
padding-top: 215px;
text-align: center;
@ -310,7 +352,7 @@ body .ac_results {
}
@media screen and (max-width: 1259px) {
@media screen and (max-width: 1199px) {
#header .info_header { padding-top: 0px; }
#header .info_header .pl0 { padding-top: 0px; padding-left: 15px; padding-bottom: 5px;}
#header .photo_header {
@ -326,8 +368,20 @@ body .ac_results {
#header #header_user{ margin-top: 10px;}
#header #header-cart,
#header #header_user { clear: none; float: right; margin-right: 10px; }
.encart_boutique {
-webkit-background-size: 100%;
background-size: 100%;
height: 303px;
padding-top: 186px;
}
.encart_boutique a { margin-top: 5px; }
.post .info h3 { font-size: 20px; line-height: 27px;}
.post .vote_box { margin-top: 0; }
}
@media (max-width: 1052px) {
@media (max-width: 991px) {
#header .photo_header {
float: none;
}
@ -336,11 +390,31 @@ body .ac_results {
}
#header #header-cart,
#header #header_user { clear: none; float: right; margin-right: 10px; margin-top: 0; }
.intro_top .intro_home h2 { font-size: 50px; }
.encart_boutique { padding-top: 178px;}
.encart_boutique .boutique { font-size: 26px; }
.encart_boutique a {font-size: 22px;}
.post .vote_box { margin-top: 10px; }
}
@media (max-width: 767px) {
.encart_boutique {
background: none;
height: auto;
padding-top: 15px;
}
.encart_boutique a {
background: #ce4f85;
color: #fff;
height: 30px;
line-height: 30px;
margin: 0 auto;
width: 120px;
}
}
@media (max-width: 500px) {
#header #header_logo img { width: 50%; }
#header .info_header h1 { margin-top: 20px;}
}
@ -358,7 +432,6 @@ body .ac_results {
#categorycms .desc {
color:#666666;
font-family: 'pt_sans';
font-size: 14px;
max-height: 100px;
overflow: hidden;
@ -378,7 +451,7 @@ body .ac_results {
}
@media (max-width: 1052px) {
@media (max-width: 991px) {
header.page-heading h1 { font-size: 36px; margin: 20px 0 }
header.page-heading .sub-heading { margin: -10px 0 0 }
#category header.page-heading .category-img img { float: none; margin: 0 auto }
@ -509,7 +582,7 @@ body .ac_results {
margin: 5px 0 0;
}
@media (max-width: 1260px) {
@media (max-width: 1199px) {
#layer_cart { padding: 0 60px; }
#layer_cart .cross { right: 60px }
@ -518,7 +591,7 @@ body .ac_results {
#layer_cart .layer_cart_product .product-box { padding-left: 25px }
}
@media (max-width: 1052px) {
@media (max-width: 991px) {
#layer_cart { left: 10px; padding: 0; right: 10px; }
#layer_cart .cross { right: 0 }
@ -786,13 +859,13 @@ body .ac_results {
margin: 24px 0 16px 0;
}
@media (max-width: 1260px) {
@media (max-width: 1199px) {
#shopping-cart .cart_quantity_button .cart_quantity_up, #shopping-cart .cart_quantity_button .cart_quantity_down { padding: 0 }
#shopping-cart .cart_quantity_button .cart_quantity_input { margin: 0 -2px }
#shopping-cart #shopping-cart-products .extension .image .custom-checkbox { margin: 24px 0 0 5px; }
#shopping-cart #shopping-cart-products .extension .image .custom-checkbox:after { margin-right: 0 }
}
@media (max-width: 1052px) {
@media (max-width: 991px) {
#shopping-cart #shopping-cart-products .inner > .image { height: 150px; margin-left: 0; position: absolute; left: 15px; z-index: 1; }
#shopping-cart #shopping-cart-products .image img { margin: 0; }
#shopping-cart #shopping-cart-products .inner > div { margin-left: 30%; }
@ -948,13 +1021,13 @@ body .ac_results {
}
@media (max-width: 1260px) {
@media (max-width: 1199px) {
#auth #noSlide form h2,
#auth form h2 { padding: 15px 50px }
#auth form .newsletter h2 { margin: 0 50px; padding: 25px 0 20px }
#auth #login_form .form_content { padding: 20px 50px }
}
@media (max-width: 1052px) {
@media (max-width: 991px) {
#auth #login_form { margin-bottom: 40px }
#auth form h2 { padding: 15px 100px }
#auth form .newsletter h2 { margin: 0 100px; padding: 25px 0 20px }
@ -1062,7 +1135,7 @@ body .addresses {
font-size: 18px;
}
@media (max-width: 1052px) {
@media (max-width: 991px) {
.addresses .address { min-height: 310px }
.addresses .address li { padding-left: 40px }
.addresses .address .address_title { padding-left: 40px }
@ -1205,11 +1278,11 @@ body .addresses {
font-size: 14px;
line-height: 16px;
}
@media (max-width: 1260px) {
@media (max-width: 1199px) {
.order-paiement .submit { text-align: center }
.order-paiement .submit .btn.btn-next, .order-paiement .cgv .submit span { float: none }
}
@media (max-width: 1052px) {
@media (max-width: 991px) {
.order-paiement .submit .btn.btn-next { float: right }
.order-paiement .submit span { text-align: center; }
}
@ -1293,7 +1366,7 @@ body .addresses {
.account .table-div .table-row > div a {
color: #b4293c;
}
@media (max-width: 1052px) {
@media (max-width: 991px) {
.account .table-div .table-head > div:last-child { font-family: 'GothamRndMedium'; font-size: 16px; padding-left: 0; }
.account .table-div .table-row > div, #history .account .table-div .table-row > div { display: block }
@ -1387,13 +1460,13 @@ body .addresses {
.add_message .form-group {
padding: 0;
}
@media (max-width: 1260px) {
@media (max-width: 1199px) {
#order-detail .account .table-div .table-row.nobg .price { font-size: 24px; padding-left: 0; }
.account .addresses { margin-bottom: 0 }
#order-detail .account h3 { margin: 20px 0 5px }
#order-detail .account .product-row .form-group input { width: 60px }
}
@media (max-width: 1052px) {
@media (max-width: 991px) {
#order-detail .order-info > div:last-child { margin-top: 25px }
.account .addresses .address { margin-bottom: 20px; }
#order-detail .account .product-row.return-allowed > div { padding-left: 70px }
@ -1424,7 +1497,7 @@ body .addresses {
}
.block-order-detail strong { color: #fff }
@media (max-width: 1052px) {
@media (max-width: 991px) {
.block-order-detail .text-center { text-align: left; }
}
@ -1481,7 +1554,7 @@ form.std {
.submit > *:first-child {
float: right;
}
@media (max-width: 1260px) {
@media (max-width: 1199px) {
form.std .form_content { padding: 20px 100px }
}
@media (max-width: 767px) {
@ -1559,11 +1632,11 @@ form.std {
}
@media (max-width: 1260px) {
@media (max-width: 1199px) {
#product-register form h2 { padding: 15px 100px }
#product-register form .form_content { padding: 20px 100px }
}
@media (max-width: 1052px) {
@media (max-width: 991px) {
#product-register form h2 { padding: 15px 100px }
#product-register form .form_content { padding: 20px 100px }
#product-register .subheading-picto .border { height: 170px }
@ -1648,7 +1721,7 @@ form.std {
}
@media (max-width: 1052px) {
@media (max-width: 991px) {
#firmware .account .table-div .table-row > div { display: inline-block }
}
@media (max-width: 500px) {
@ -1709,10 +1782,10 @@ form.std {
.popover.right > .arrow { border-right-color: #dbdbdb }
.popover.right > .arrow:after { border-left-width: 2px; }
@media (max-width: 1260px) {
@media (max-width: 1199px) {
.container .odr .description > div .btn { font-size: 16px; height: auto }
}
@media (max-width: 1052px) {
@media (max-width: 991px) {
.container .odr .description > div .btn { font-size: 20px; height: 50px }
}
@media (max-width: 500px) {
@ -1771,11 +1844,11 @@ form.std {
margin: 0;
padding: 15px 150px;
}
@media (max-width: 1260px) {
@media (max-width: 1199px) {
.container.odrs .account_creation h2 { padding: 15px 30px }
.container.odrs .form_content { padding: 15px 30px }
}
@media (max-width: 1052px) {
@media (max-width: 991px) {
.container.odrs .account_creation h2 { padding: 20px 100px }
.container.odrs .form_content { padding: 20px 100px }
}
@ -1810,7 +1883,7 @@ form.std {
width: 100%;
}
@media (max-width: 1260px) {
@media (max-width: 1199px) {
.page-heading.pagenotfound h1 { font-size: 60px }
#pagenotfound .form-group .btn { margin-top: 10px; }
}
@ -1844,13 +1917,13 @@ form.std {
#module-we_mail-default .submit {
margin-top: 0;
}
@media (max-width: 1260px) {
@media (max-width: 1199px) {
#contact div.uploader span.filename,
#module-we_mail-default div.uploader span.filename { width: 250px }
#contact div.uploader span.action,
#module-we_mail-default div.uploader span.action { padding: 12px 15px 12px; width: 115px }
}
@media (max-width: 1052px) {
@media (max-width: 991px) {
#contact div.uploader span.filename,
#module-we_mail-default div.uploader span.filename { width: 60% }
#contact div.uploader span.action,
@ -2027,14 +2100,14 @@ form.std {
color: #2d2b33;
font-size: 14px;
}
@media (max-width: 1260px) {
@media (max-width: 1199px) {
#cms .sub-nav-cms { width: 222px }
#cms .sub-nav-cms.stacked { margin-left: -470px }
#cms .sub-nav-cms .title-cat-cms { padding: 25px 15px 25px 15px }
#cms .sub-nav-cms ul.list-group > li > span { padding: 10px 15px 10px 15px }
#cms .sub-nav-cms ul.list-group ul li { padding-left: 20px }
}
@media (max-width: 1052px) {
@media (max-width: 991px) {
#cms .sub-nav-cms ,#cms .sub-nav-cms.stacked { position: static; margin: 0 0 30px 0; width: 100%; }
#cms .sub-nav-cms .title-cat-cms { padding: 25px 15px 25px 15px }

View File

@ -417,7 +417,7 @@ header.page-heading.order-process { padding: 25px 0 0 0 }
}
.product-container .border:hover .product-infos .icon { display: block }
.product-container .border.discount:hover .product-infos .icon { background-position: 0 0 }
@media (max-width: 1260px) {
@media (max-width: 1199px) {
.product-container .border:hover .overlay { top: 180px; transform: rotate(-8deg) translateY(0); }
.product-container .border .product-infos .quick-view { right: -10px; }
}
@ -534,11 +534,11 @@ body .fancybox-overlay {
padding-top: 30px;
}
@media (min-width: 1052px) {
@media (min-width: 991px) {
.table-div strong { display: none; }
}
@media (max-width: 1052px) {
@media (max-width: 991px) {
.table-div strong
.table-div .table-row .table-hide-info { max-height: 200px }
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

View File

@ -17,10 +17,33 @@
</div>
<div class="row">
<div class="col-md-8">
EDITO
<div class="col-md-8 col-sm-8">
<div class="inner_edito">
<div class="row">
<div class="col-lg-3 col-md-4 hidden-sm hidden-xs pl0">
<div class="inner">
<span class="name">{l s='Claudine'}</span>
<span class="name_edito">{l s='L\'édito'}</span>
<ul>
<li><a href="#"><i class="icon-facebook"></i></a></li>
<li><a href="#"><i class="icon-twitter"></i></a></li>
</ul>
</div>
</div>
<div class="col-lg-9 col-md-8 col-sm-12 col-xs-12 pr0">
<h2><a href="{$link->getPostEditoLink($edito->id)}">{$edito->title}</a></h2>
<div class="intro_edito">
{$edito->intro}
<span class="readmore">
<a href="{$link->getPostEditoLink($edito->id)}">{l s='Lire l\'édito'}</a> |
<a href="{$link->getPostEditoLink($edito->id)}">{l s='Lire tous les éditos'}</a>
</span>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-4">
<div class="col-md-4 col-sm-4 pr0 pl0">
{include file="$tpl_dir./encart_boutique.tpl"}
</div>
</div>
@ -40,7 +63,7 @@
</div>
<div class="post_home_right">
<div class="post_home_top">
{foreach from=$posts_home_2 item=post key=key}
{foreach from=$posts_home_2 item=post key=key}
{include file="./post_simple.tpl" post=$post}
{/foreach}
</div>
@ -49,13 +72,13 @@
</div>
<div class="row center_home">
<div class="col-md-4">
<img src="{$img_dir}logo_shopping.png" alt="{l s='Shopping Tout Pratique'}">
<div class="col-sm-4">
<img src="{$img_dir}logo_shopping.png" alt="{l s='Shopping Tout Pratique'}" class="img-responsive">
<div class="product_home">
HOOK PRODUIT EN REMONTE HOME
</div>
</div>
<div class="col-md-8">
<div class="col-sm-8">
<div class="video_home">
<h4>{l s='J\'ai testé pour vous'}</h4>
<div class="row">

View File

@ -11,10 +11,10 @@
</div>
{/if}
<div class="row">
<div class="col-md-9 pr0">
<div class="col-md-9 col-sm-9 col-xs-9 pl0 pr0">
<h3><a href="{$link->getPostCmsLink($post->id)}">{$post->title|truncate:50:"...":true}</a></h3>
</div>
<div class="col-md-3 pl0 pr0">
<div class="col-md-3 col-sm-3 col-xs-3 pl0">
<div class="vote_box">
<span class="vote"><i class="icon-thumb"></i></span>
<span class="nb_vote">10</span>