Création du module BrandsOnHome (affichage des marques vendues sur la page d'accueil)
This commit is contained in:
11
local/modules/BrandsOnHome/BrandsOnHome.php
Normal file
11
local/modules/BrandsOnHome/BrandsOnHome.php
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace BrandsOnHome;
|
||||||
|
|
||||||
|
use Thelia\Module\BaseModule;
|
||||||
|
|
||||||
|
class BrandsOnHome extends BaseModule
|
||||||
|
{
|
||||||
|
/** @var string */
|
||||||
|
const DOMAIN_NAME = 'brandsonhome';
|
||||||
|
}
|
||||||
14
local/modules/BrandsOnHome/Config/config.xml
Normal file
14
local/modules/BrandsOnHome/Config/config.xml
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
|
||||||
|
<config xmlns="http://thelia.net/schema/dic/config"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://thelia.net/schema/dic/config http://thelia.net/schema/dic/config/thelia-1.0.xsd">
|
||||||
|
|
||||||
|
<hooks>
|
||||||
|
<hook id="brandsonhome.hook.front">
|
||||||
|
<tag name="hook.event_listener" event="main.stylesheet" type="front" active="1" templates="css:assets/style.css" />
|
||||||
|
<tag name="hook.event_listener" event="main.content-bottom" type="front" active="1" templates="render:main-content-bottom.html" />
|
||||||
|
</hook>
|
||||||
|
</hooks>
|
||||||
|
|
||||||
|
</config>
|
||||||
26
local/modules/BrandsOnHome/Config/module.xml
Normal file
26
local/modules/BrandsOnHome/Config/module.xml
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module xmlns="http://thelia.net/schema/dic/module"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://thelia.net/schema/dic/module http://thelia.net/schema/dic/module/module-2_2.xsd">
|
||||||
|
<fullnamespace>BrandsOnHome\BrandsOnHome</fullnamespace>
|
||||||
|
<descriptive locale="en_US">
|
||||||
|
<title>Displays brands sold by the shop on site's homepage</title>
|
||||||
|
</descriptive>
|
||||||
|
<descriptive locale="fr_FR">
|
||||||
|
<title>Affiche les logos des marques vendues par la boutique sur sa page d'accueil</title>
|
||||||
|
</descriptive>
|
||||||
|
<languages>
|
||||||
|
<language>en_US</language>
|
||||||
|
<language>fr_FR</language>
|
||||||
|
</languages>
|
||||||
|
<version>1.0</version>
|
||||||
|
<authors>
|
||||||
|
<author>
|
||||||
|
<name>Laurent LE CORRE</name>
|
||||||
|
<email>laurent@thecoredev.fr</email>
|
||||||
|
</author>
|
||||||
|
</authors>
|
||||||
|
<type>classic</type>
|
||||||
|
<thelia>2.3.0</thelia>
|
||||||
|
<stability>other</stability>
|
||||||
|
</module>
|
||||||
20
local/modules/BrandsOnHome/Hook/FrontHook.php
Normal file
20
local/modules/BrandsOnHome/Hook/FrontHook.php
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace BrandsOnHome\Hook;
|
||||||
|
|
||||||
|
use Thelia\Core\Hook\BaseHook;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class FrontHook
|
||||||
|
* @package BrandsOnHome\Hook
|
||||||
|
* @author Laurent LE CORRE <laurent@thecoredev.fr>
|
||||||
|
*/
|
||||||
|
class FrontHook extends BaseHook {
|
||||||
|
public function onMainContentBottom(HookRenderEvent $event)
|
||||||
|
{
|
||||||
|
$content = trim($this->render("main-content-bottom.html"));
|
||||||
|
if ("" != $content) {
|
||||||
|
$event->add($content);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
6
local/modules/BrandsOnHome/I18n/en_US.php
Normal file
6
local/modules/BrandsOnHome/I18n/en_US.php
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'Our brands' => 'Our brands',
|
||||||
|
];
|
||||||
|
|
||||||
5
local/modules/BrandsOnHome/I18n/fr_FR.php
Normal file
5
local/modules/BrandsOnHome/I18n/fr_FR.php
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'Our brands' => 'Nos marques',
|
||||||
|
];
|
||||||
55
local/modules/BrandsOnHome/Readme.md
Normal file
55
local/modules/BrandsOnHome/Readme.md
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
# Brands On Home
|
||||||
|
|
||||||
|
Add a short description here. You can also add a screenshot if needed.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
### Manually
|
||||||
|
|
||||||
|
* Copy the module into ```<thelia_root>/local/modules/``` directory and be sure that the name of the module is BrandsOnHome.
|
||||||
|
* Activate it in your thelia administration panel
|
||||||
|
|
||||||
|
### Composer
|
||||||
|
|
||||||
|
Add it in your main thelia composer.json file
|
||||||
|
|
||||||
|
```
|
||||||
|
composer require your-vendor/brands-on-home-module:~1.0
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
Explain here how to use your module, how to configure it, etc.
|
||||||
|
|
||||||
|
## Hook
|
||||||
|
|
||||||
|
If your module use one or more hook, fill this part. Explain which hooks are used.
|
||||||
|
|
||||||
|
|
||||||
|
## Loop
|
||||||
|
|
||||||
|
If your module declare one or more loop, describe them here like this :
|
||||||
|
|
||||||
|
[loop name]
|
||||||
|
|
||||||
|
### Input arguments
|
||||||
|
|
||||||
|
|Argument |Description |
|
||||||
|
|--- |--- |
|
||||||
|
|**arg1** | describe arg1 with an exemple. |
|
||||||
|
|**arg2** | describe arg2 with an exemple. |
|
||||||
|
|
||||||
|
### Output arguments
|
||||||
|
|
||||||
|
|Variable |Description |
|
||||||
|
|--- |--- |
|
||||||
|
|$VAR1 | describe $VAR1 variable |
|
||||||
|
|$VAR2 | describe $VAR2 variable |
|
||||||
|
|
||||||
|
### Exemple
|
||||||
|
|
||||||
|
Add a complete exemple of your loop
|
||||||
|
|
||||||
|
## Other ?
|
||||||
|
|
||||||
|
If you have other think to put, feel free to complete your readme as you want.
|
||||||
11
local/modules/BrandsOnHome/composer.json
Normal file
11
local/modules/BrandsOnHome/composer.json
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"name": "your-vendor/brands-on-home-module",
|
||||||
|
"license": "LGPL-3.0+",
|
||||||
|
"type": "thelia-module",
|
||||||
|
"require": {
|
||||||
|
"thelia/installer": "~1.1"
|
||||||
|
},
|
||||||
|
"extra": {
|
||||||
|
"installer-name": "BrandsOnHome"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
.brand_list {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.brand_list .item {
|
||||||
|
margin: 10px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.brands-heading h2 {
|
||||||
|
color: #7a7a7a;
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.list .brands-content > ul .item {
|
||||||
|
width: 100%;
|
||||||
|
float: none;
|
||||||
|
}
|
||||||
|
.list .brands-content > ul .item + .item {
|
||||||
|
padding-top: 15px;
|
||||||
|
}
|
||||||
|
.list .brands-content > ul .item > article {
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
.list .brands-content > ul .item > article .product-image {
|
||||||
|
margin-bottom: 15px;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
<section id="our-brands">
|
||||||
|
<div class="brands-heading">
|
||||||
|
<h2 class="block-title">{intl l="Our brands" d="brandsonhome"}</h2>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="brands">
|
||||||
|
<div class="brands-content">
|
||||||
|
<ul class="list-unstyled row">
|
||||||
|
{loop type="brand" name="brand_list"}
|
||||||
|
{loop type="image" name="brand_images" brand={$ID} width=100}
|
||||||
|
<li class="item col-md-2">
|
||||||
|
<article class="row" itemscope itemtype="http://schema.org/Product">
|
||||||
|
<img src="{$IMAGE_URL}" alt="{$TITLE}" />
|
||||||
|
</article>
|
||||||
|
</li>
|
||||||
|
{/loop}
|
||||||
|
{/loop}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
Reference in New Issue
Block a user