Merge branch 'master' of gitlab.antadis.fr:dev-antadis/toutpratique
This commit is contained in:
commit
58a077e7a8
@ -1,2 +1,2 @@
|
||||
<?xml version="1.0"?>
|
||||
<modules_list><modules type="untrusted"><module name="bankwire"/><module name="blockadshooks"/><module name="blockadvertising"/><module name="blockbanner"/><module name="blockbestsellers"/><module name="blockcart"/><module name="blockcategories"/><module name="blockcms"/><module name="blockcmsinfo"/><module name="blockcontact"/><module name="blockcontactinfos"/><module name="blockcurrencies"/><module name="blockcustomerprivacy"/><module name="blocklanguages"/><module name="blocklink"/><module name="blockmanufacturer"/><module name="blockmyaccount"/><module name="blockmyaccountfooter"/><module name="blocknewproducts"/><module name="blocknewsletter"/><module name="blockpaymentlogo"/><module name="blockpermanentlinks"/><module name="blockreinsurance"/><module name="blockrss"/><module name="blocksearch"/><module name="blocksharefb"/><module name="blocksocial"/><module name="blockspecials"/><module name="blockstore"/><module name="blocksupplier"/><module name="blocktags"/><module name="blocktopmenu"/><module name="blockuserinfo"/><module name="blockviewed"/><module name="blockwishlist"/><module name="categorieshome"/><module name="cheque"/><module name="cms_comments"/><module name="cms_extrafields"/><module name="cms_menu"/><module name="cms_pack"/><module name="cmsps"/><module name="cronjobs"/><module name="crossselling"/><module name="dashactivity"/><module name="dashgoals"/><module name="dashproducts"/><module name="dashtrends"/><module name="graphnvd3"/><module name="gridhtml"/><module name="homefeatured"/><module name="homeslider"/><module name="pagesnotfound"/><module name="productcomments"/><module name="productpaymentlogos"/><module name="productscategory"/><module name="producttooltip"/><module name="referralprogram"/><module name="sekeywords"/><module name="sendtoafriend"/><module name="seourl"/><module name="socialsharing"/><module name="vatnumber"/></modules></modules_list>
|
||||
<modules_list><modules type="untrusted"><module name="bankwire"/><module name="blockadshooks"/><module name="blockadvertising"/><module name="blockbanner"/><module name="blockbestsellers"/><module name="blockcart"/><module name="blockcategories"/><module name="blockcms"/><module name="blockcmsinfo"/><module name="blockcontact"/><module name="blockcontactinfos"/><module name="blockcurrencies"/><module name="blockcustomerprivacy"/><module name="blocklanguages"/><module name="blocklink"/><module name="blockmanufacturer"/><module name="blockmyaccount"/><module name="blockmyaccountfooter"/><module name="blocknewproducts"/><module name="blocknewsletter"/><module name="blockpaymentlogo"/><module name="blockpermanentlinks"/><module name="blockreinsurance"/><module name="blockrss"/><module name="blocksearch"/><module name="blocksharefb"/><module name="blocksocial"/><module name="blockspecials"/><module name="blockstore"/><module name="blocksupplier"/><module name="blocktags"/><module name="blocktopmenu"/><module name="blockuserinfo"/><module name="blockviewed"/><module name="blockwishlist"/><module name="categorieshome"/><module name="cheque"/><module name="cms_comments"/><module name="cms_extrafields"/><module name="cms_menu"/><module name="cms_pack"/><module name="cmsps"/><module name="cronjobs"/><module name="crossselling"/><module name="dashactivity"/><module name="dashgoals"/><module name="dashproducts"/><module name="dashtrends"/><module name="graphnvd3"/><module name="gridhtml"/><module name="homefeatured"/><module name="homeproduct"/><module name="homeslider"/><module name="pagesnotfound"/><module name="productcomments"/><module name="productpaymentlogos"/><module name="productscategory"/><module name="producttooltip"/><module name="referralprogram"/><module name="sekeywords"/><module name="sendtoafriend"/><module name="seourl"/><module name="socialsharing"/><module name="vatnumber"/></modules></modules_list>
|
||||
|
30
controllers/front/VideosController.php
Normal file
30
controllers/front/VideosController.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
require _MODULE_DIR_.'cmsps/cmsps.php';
|
||||
|
||||
class VideosControllerCore extends FrontController
|
||||
{
|
||||
public $php_self = 'videos';
|
||||
|
||||
public function canonicalRedirection($canonical_url = '') {
|
||||
parent::canonicalRedirection($this->context->link->getVideosLink());
|
||||
}
|
||||
|
||||
public function init() {
|
||||
parent::init();
|
||||
}
|
||||
|
||||
public function initContent() {
|
||||
parent::initContent();
|
||||
$id_lang = Context::getContext()->language->id;
|
||||
|
||||
$articles = CmsPsPost::getVideoPost($id_lang, 999);
|
||||
|
||||
$this->context->smarty->assign(array(
|
||||
'articles' => $articles
|
||||
));
|
||||
|
||||
$this->setTemplate(_PS_THEME_DIR_.'videos.tpl');
|
||||
}
|
||||
|
||||
}
|
@ -372,4 +372,23 @@ class CmsPsPost extends ObjectModel {
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
public static function getPostRelationWithProduct($id_product, $limit = 3, $id_lang)
|
||||
{
|
||||
$relations = array();
|
||||
$ids = Db::getInstance()->executeS('
|
||||
SELECT r.`id_post`
|
||||
FROM `'._DB_PREFIX_.'cmsps_posts_relation_product` r
|
||||
LEFT JOIN `'._DB_PREFIX_.'cmsps_posts` c ON(r.`id_post` = c.`id_post`)
|
||||
WHERE r.`id_product` ='.(int)$id_product.'
|
||||
ORDER BY c.`note` DESC
|
||||
LIMIT '.(int)$limit
|
||||
|
||||
);
|
||||
foreach ($ids as $key => $id) {
|
||||
$relations[] = new CmsPsPost($id['id_post'], $id_lang);
|
||||
}
|
||||
return self::injectsData($relations);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
{$video_article[0]->video}
|
||||
</div>
|
||||
<div class="col-sm-3" class="link_video_tips">
|
||||
<a href="#">
|
||||
<a href="{$link->getVideosLink()}">
|
||||
<img src="{$img_dir}video_tips_home.png" alt="{l s='Les vidéos Tips'}" class="img-responsive">
|
||||
</a>
|
||||
</div>
|
||||
|
12
modules/homeproduct/config_fr.xml
Normal file
12
modules/homeproduct/config_fr.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<module>
|
||||
<name>homeproduct</name>
|
||||
<displayName><![CDATA[Display product on Home]]></displayName>
|
||||
<version><![CDATA[1.0]]></version>
|
||||
<description><![CDATA[Display product on Home]]></description>
|
||||
<author><![CDATA[Antadis]]></author>
|
||||
<tab><![CDATA[front_office_features]]></tab>
|
||||
<is_configurable>0</is_configurable>
|
||||
<need_instance>0</need_instance>
|
||||
<limited_countries></limited_countries>
|
||||
</module>
|
63
modules/homeproduct/homeproduct.php
Normal file
63
modules/homeproduct/homeproduct.php
Normal file
@ -0,0 +1,63 @@
|
||||
<?php
|
||||
if (!defined('_CAN_LOAD_FILES_'))
|
||||
exit;
|
||||
|
||||
class Homeproduct extends Module
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->name = 'homeproduct';
|
||||
$this->tab = 'front_office_features';
|
||||
$this->version = '1.0';
|
||||
$this->author = 'Antadis';
|
||||
$this->need_instance = 0;
|
||||
|
||||
$this->bootstrap = true;
|
||||
parent::__construct();
|
||||
|
||||
$this->displayName = $this->l('Display product on Home');
|
||||
$this->description = $this->l('Display product on Home');
|
||||
$this->secure_key = Tools::encrypt($this->name);
|
||||
$this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_);
|
||||
}
|
||||
|
||||
public function install()
|
||||
{
|
||||
if (Shop::isFeatureActive())
|
||||
Shop::setContext(Shop::CONTEXT_ALL);
|
||||
|
||||
if (!parent::install()
|
||||
|| !$this->registerHook('displayHomeProduct')
|
||||
)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public function hookdisplayHomeProduct($params)
|
||||
{
|
||||
$products = self::loadProduct(Context::getContext()->language->id, 2);
|
||||
|
||||
$this->smarty->assign(array(
|
||||
'products' => $products,
|
||||
));
|
||||
return $this->display(__FILE__, 'home.tpl');
|
||||
}
|
||||
|
||||
public static function loadProduct($id_lang, $limit)
|
||||
{
|
||||
$collection = new Collection('Product', $id_lang);
|
||||
$collection->where('active', '=', 1);
|
||||
$collection->where('online_only', '=', 1);
|
||||
$collection->where('online_only', '=', 1);
|
||||
$collection->setPageSize($limit);
|
||||
$products = $collection->getResults();
|
||||
|
||||
$products = array_map(function($elem) {
|
||||
$elem = $elem->loadReductionInfo();
|
||||
return get_object_vars($elem);
|
||||
}, $products);
|
||||
|
||||
return $products;
|
||||
}
|
||||
|
||||
}
|
35
modules/homeproduct/index.php
Normal file
35
modules/homeproduct/index.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2015 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2015 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
4
modules/homeproduct/views/templates/hook/home.tpl
Normal file
4
modules/homeproduct/views/templates/hook/home.tpl
Normal file
@ -0,0 +1,4 @@
|
||||
<img src="{$img_dir}logo_shopping.png" alt="{l s='Shopping Tout Pratique' mod='homeproduct'}" class="img-responsive">
|
||||
<div class="product_home row">
|
||||
{include file="$tpl_dir./product-list.tpl" products=$products position=6}
|
||||
</div>
|
@ -12,6 +12,7 @@ class ManageSeoUrl extends ObjectModel {
|
||||
const TYPE_301 = 8;
|
||||
const TYPE_STORE_HOME = 9;
|
||||
const TYPE_HOME_EDITO = 10;
|
||||
const TYPE_VIDEO = 11;
|
||||
|
||||
const SUFFIX_HTML = '.html';
|
||||
const SUFFIX_PHP = '.php';
|
||||
|
@ -13,7 +13,8 @@ class AdminSeoUrlController extends ModuleAdminController {
|
||||
ManageSeoUrl::TYPE_CMS => 'CMS',
|
||||
ManageSeoUrl::TYPE_301 => 'Redirection 301',
|
||||
ManageSeoUrl::TYPE_STORE_HOME => 'Page accueil boutique',
|
||||
ManageSeoUrl::TYPE_HOME_EDITO => 'Page accueil edito'
|
||||
ManageSeoUrl::TYPE_HOME_EDITO => 'Page accueil edito',
|
||||
ManageSeoUrl::TYPE_VIDEO => 'Page vidéo'
|
||||
);
|
||||
|
||||
public function __construct() {
|
||||
@ -117,6 +118,10 @@ class AdminSeoUrlController extends ModuleAdminController {
|
||||
9 => array(
|
||||
'id_type' => ManageSeoUrl::TYPE_HOME_EDITO,
|
||||
'type' => $this->l('Accueil edito')
|
||||
),
|
||||
10 => array(
|
||||
'id_type' => ManageSeoUrl::TYPE_VIDEO,
|
||||
'type' => $this->l('Vidéos')
|
||||
)
|
||||
);
|
||||
|
||||
@ -184,10 +189,10 @@ class AdminSeoUrlController extends ModuleAdminController {
|
||||
parent::copyFromPost($object, $table);
|
||||
|
||||
// Auto increment id_element pour les redirections 301
|
||||
if($object->type == ManageSeoUrl::TYPE_301){
|
||||
if ($object->type == ManageSeoUrl::TYPE_301){
|
||||
$max_id = Db::getInstance()->getValue('SELECT MAX(id_element) FROM ps_seourl WHERE type = ' . ManageSeoUrl::TYPE_301);
|
||||
|
||||
if(empty($max_id)){
|
||||
if (empty($max_id)) {
|
||||
$max_id = 0;
|
||||
}
|
||||
$object->id_element = $max_id + 1;
|
||||
|
@ -70,6 +70,9 @@ class Dispatcher extends DispatcherCore {
|
||||
elseif ($current_uri['type'] == ManageSeoUrl::TYPE_STORE_HOME) {
|
||||
$this->controller = 'homestore';
|
||||
}
|
||||
elseif ($current_uri['type'] == ManageSeoUrl::TYPE_VIDEO) {
|
||||
$this->controller = 'videos';
|
||||
}
|
||||
elseif ($current_uri['type'] == ManageSeoUrl::TYPE_CMS) {
|
||||
$this->controller = 'cms';
|
||||
$_POST['id_cms'] = $current_uri['id_element'];
|
||||
|
@ -16,6 +16,22 @@ class Link extends LinkCore
|
||||
public static $url_home_store = '';
|
||||
|
||||
|
||||
public function getVideosLink($id = 1, $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);
|
||||
|
||||
|
||||
$link = ManageSeoUrl::getByType($id, ManageSeoUrl::TYPE_VIDEO, FALSE, $id_lang, $id_shop);
|
||||
self::$url_home_store = $url.$link->link_rewrite;
|
||||
return $url.$link->link_rewrite;
|
||||
}
|
||||
|
||||
public function getHomeStoreLink($id = 1, $id_lang = null, $id_shop = null,
|
||||
$ipa = 0, $force_routes = false, $relative_protocol = false) {
|
||||
|
||||
|
@ -18,6 +18,11 @@ class Product extends ProductCore
|
||||
}
|
||||
|
||||
$this->category = Category::getLinkRewrite((int)$this->id_category_default, (int)$id_lang);
|
||||
$this->link = Context::getContext()->link->getProductLink($this);
|
||||
$this->id_product = $this->id;
|
||||
|
||||
$id_image = Product::getCover($this->id);
|
||||
$this->id_image = $id_image['id_image'];
|
||||
|
||||
if (self::$_taxCalculationMethod == PS_TAX_EXC)
|
||||
{
|
||||
|
@ -358,6 +358,12 @@ body .ac_results {
|
||||
.center_home {
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
.product_home {
|
||||
padding-top: 15px;
|
||||
}
|
||||
.product_home .product-container:last-child {
|
||||
border-right: 0;
|
||||
}
|
||||
|
||||
.video_home {
|
||||
border-top: 3px solid #333333;
|
||||
|
@ -73,10 +73,7 @@
|
||||
|
||||
<div class="row center_home">
|
||||
<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>
|
||||
{hook h='displayHomeProduct'}
|
||||
</div>
|
||||
<div class="col-sm-8">
|
||||
{hook h='displayHomeVideo'}
|
||||
@ -91,7 +88,6 @@
|
||||
{/foreach}
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row">
|
||||
{hook h="displayHomeBottom"}
|
||||
</div>
|
||||
|
@ -25,7 +25,7 @@
|
||||
*}
|
||||
<h2>{l s='Produits les plus populaires' mod='blockbestsellers'}</h2>
|
||||
{if isset($best_sellers) && $best_sellers}
|
||||
{include file="$tpl_dir./product-list.tpl" products=$best_sellers class='blockbestsellers tab-pane' id='blockbestsellers' position='homestore'}
|
||||
{include file="$tpl_dir./product-list.tpl" products=$best_sellers class='blockbestsellers tab-pane' id='blockbestsellers' position=2}
|
||||
{else}
|
||||
<ul id="blockbestsellers" class="blockbestsellers tab-pane">
|
||||
<li class="alert alert-info">{l s='No best sellers at this time.' mod='blockbestsellers'}</li>
|
||||
|
@ -4,7 +4,7 @@
|
||||
{foreach from=$products item=product name=products key=key}
|
||||
{if (isset($nbProduct) && $key < $nbProduct) || !isset($nbProduct)}
|
||||
|
||||
<div class="product-container col-md-{if isset($position)}2{else}3{/if} col-sm-4 col-xs-6 col-xxs-12" itemscope itemtype="http://schema.org/Product">
|
||||
<div class="product-container col-md-{if isset($position)}{$position}{else}3{/if} col-sm-4 col-xs-6 col-xxs-12" itemscope itemtype="http://schema.org/Product">
|
||||
<div class="border {if isset($percentReduction) && $percentReduction > 0} discount{/if}">
|
||||
{if $product.specific_prices.reduction_type == 'percentage'}
|
||||
<span class="price-percent-reduction">-{$product.specific_prices.reduction * 100}%</span>
|
||||
@ -44,7 +44,7 @@
|
||||
<!-- Ajout panier -->
|
||||
<div class="add_to_cart_contain">
|
||||
<a class="btn ajax_add_to_cart_button" data-id-product="{$product.id_product}" data-minimal_quantity="1">
|
||||
<i class="icon icon-shopping-cart"></i> {l s='J\'achete'}
|
||||
<i class="icon icon-shopping-cart"></i> <span>{l s='J\'achete'}</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
|
25
themes/toutpratique/videos.tpl
Normal file
25
themes/toutpratique/videos.tpl
Normal file
@ -0,0 +1,25 @@
|
||||
{capture name=path}{l s='Vidéos'}{/capture}
|
||||
|
||||
<div class="intro_top">
|
||||
<div class="container">
|
||||
<div class="intro_cat">
|
||||
<h1>{l s='Vidéos'}</h1>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="breadcrumbs">
|
||||
<div class="container">
|
||||
{include file="$tpl_dir./breadcrumb.tpl"}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Blocs -->
|
||||
<main class="container">
|
||||
<div class="row">
|
||||
{foreach from=$articles item=post key=key}
|
||||
<div class="col-md-4 col-sm-4">
|
||||
{include file="./post_img.tpl" post=$post}
|
||||
</div>
|
||||
{/foreach}
|
||||
</div>
|
||||
</main>
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user