Initial Commit
This commit is contained in:
17
local/modules/Sitemap/Config/config.xml
Normal file
17
local/modules/Sitemap/Config/config.xml
Normal file
@@ -0,0 +1,17 @@
|
||||
<?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="sitemap.hook" class="Sitemap\Hook\SitemapHook" scope="request">
|
||||
<tag name="hook.event_listener" event="module.configuration" type="back" method="onModuleConfig" />
|
||||
</hook>
|
||||
</hooks>
|
||||
|
||||
<forms>
|
||||
<form name="sitemap_config_form" class="Sitemap\Form\SitemapConfigForm" />
|
||||
</forms>
|
||||
|
||||
</config>
|
||||
26
local/modules/Sitemap/Config/module.xml
Normal file
26
local/modules/Sitemap/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>Sitemap\Sitemap</fullnamespace>
|
||||
<descriptive locale="en_US">
|
||||
<title>Create sitemap and sitemap image files more quickly</title>
|
||||
</descriptive>
|
||||
<descriptive locale="fr_FR">
|
||||
<title>Génère les fichiers sitemap et sitemap image plus rapidement</title>
|
||||
</descriptive>
|
||||
<languages>
|
||||
<language>en_US</language>
|
||||
<language>fr_FR</language>
|
||||
</languages>
|
||||
<version>1.3.2</version>
|
||||
<authors>
|
||||
<author>
|
||||
<name>Etienne Perriere</name>
|
||||
<email>eperriere@openstudio.fr</email>
|
||||
</author>
|
||||
</authors>
|
||||
<type>classic</type>
|
||||
<thelia>2.1.0</thelia>
|
||||
<stability>beta</stability>
|
||||
</module>
|
||||
23
local/modules/Sitemap/Config/routing.xml
Normal file
23
local/modules/Sitemap/Config/routing.xml
Normal file
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<routes xmlns="http://symfony.com/schema/routing"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">
|
||||
|
||||
<route id="sitemap.process" path="/sitemap">
|
||||
<default key="_controller">Sitemap\Controller\SitemapController::generateAction</default>
|
||||
</route>
|
||||
|
||||
<route id="sitemap.image.process" path="/sitemap-image">
|
||||
<default key="_controller">Sitemap\Controller\SitemapController::generateImageAction</default>
|
||||
</route>
|
||||
|
||||
<route id="sitemap.configuration.default" path="/admin/module/Sitemap" methods="get">
|
||||
<default key="_controller">Sitemap:SitemapConfig:default</default>
|
||||
</route>
|
||||
|
||||
<route id="sitemap.configuration.save" path="/admin/module/Sitemap" methods="post">
|
||||
<default key="_controller">Sitemap:SitemapConfig:save</default>
|
||||
</route>
|
||||
|
||||
</routes>
|
||||
82
local/modules/Sitemap/Controller/CategorySitemapTrait.php
Normal file
82
local/modules/Sitemap/Controller/CategorySitemapTrait.php
Normal file
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
namespace Sitemap\Controller;
|
||||
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Propel\Runtime\ActiveQuery\Join;
|
||||
use Thelia\Model\Map\CategoryTableMap;
|
||||
use Thelia\Model\Map\RewritingUrlTableMap;
|
||||
use Thelia\Model\RewritingUrl;
|
||||
use Thelia\Model\RewritingUrlQuery;
|
||||
use Thelia\Tools\URL;
|
||||
|
||||
/**
|
||||
* Trait CategorySitemapTrait
|
||||
* @package Sitemap\Controller
|
||||
* @author Etienne Perriere <eperriere@openstudio.fr>
|
||||
*/
|
||||
trait CategorySitemapTrait
|
||||
{
|
||||
/**
|
||||
* Get categories
|
||||
*
|
||||
* @param $sitemap
|
||||
* @param $locale
|
||||
* @throws \Propel\Runtime\Exception\PropelException
|
||||
*/
|
||||
protected function setSitemapCategories(&$sitemap, $locale)
|
||||
{
|
||||
// Prepare query - get categories URL
|
||||
$query = RewritingUrlQuery::create()
|
||||
->filterByView('category')
|
||||
->filterByRedirected(null)
|
||||
->filterByViewLocale($locale);
|
||||
|
||||
// Join with visible categories
|
||||
self::addJoinCategory($query, $locale);
|
||||
|
||||
// Get categories last update
|
||||
$query->withColumn(CategoryTableMap::UPDATED_AT, 'CATEGORY_UPDATE_AT');
|
||||
|
||||
// Execute query
|
||||
$results = $query->find();
|
||||
|
||||
// For each result, hydrate XML file
|
||||
/** @var RewritingUrl $result */
|
||||
foreach ($results as $result) {
|
||||
|
||||
// Open new sitemap line & set category URL & update date
|
||||
$sitemap[] = '
|
||||
<url>
|
||||
<loc>'.URL::getInstance()->absoluteUrl($result->getUrl()).'</loc>
|
||||
<lastmod>'.date('c', strtotime($result->getVirtualColumn('CATEGORY_UPDATE_AT'))).'</lastmod>
|
||||
</url>';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Join categories and their URLs
|
||||
*
|
||||
* @param Criteria $query
|
||||
*/
|
||||
protected function addJoinCategory(Criteria &$query)
|
||||
{
|
||||
// Join RewritingURL with Category to have only visible categories
|
||||
$join = new Join();
|
||||
|
||||
$join->addExplicitCondition(
|
||||
RewritingUrlTableMap::TABLE_NAME,
|
||||
'VIEW_ID',
|
||||
null,
|
||||
CategoryTableMap::TABLE_NAME,
|
||||
'ID',
|
||||
null
|
||||
);
|
||||
|
||||
$join->setJoinType(Criteria::INNER_JOIN);
|
||||
$query->addJoinObject($join, 'categoryJoin');
|
||||
|
||||
// Get only visible categories
|
||||
$query->addJoinCondition('categoryJoin', CategoryTableMap::VISIBLE, 1, Criteria::EQUAL, \PDO::PARAM_INT);
|
||||
}
|
||||
}
|
||||
83
local/modules/Sitemap/Controller/ContentSitemapTrait.php
Normal file
83
local/modules/Sitemap/Controller/ContentSitemapTrait.php
Normal file
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
namespace Sitemap\Controller;
|
||||
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Propel\Runtime\ActiveQuery\Join;
|
||||
use Thelia\Model\Map\ContentTableMap;
|
||||
use Thelia\Model\Map\RewritingUrlTableMap;
|
||||
use Thelia\Model\RewritingUrl;
|
||||
use Thelia\Model\RewritingUrlQuery;
|
||||
use Thelia\Tools\URL;
|
||||
|
||||
/**
|
||||
* Class ContentSitemapTrait
|
||||
* @package Sitemap\Controller
|
||||
* @author Etienne Perriere <eperriere@openstudio.fr>
|
||||
*/
|
||||
trait ContentSitemapTrait
|
||||
{
|
||||
/**
|
||||
* Get contents
|
||||
*
|
||||
* @param $sitemap
|
||||
* @param $locale
|
||||
* @throws \Propel\Runtime\Exception\PropelException
|
||||
*/
|
||||
protected function setSitemapContents(&$sitemap, $locale)
|
||||
{
|
||||
// Prepare query - get contents URL
|
||||
$query = RewritingUrlQuery::create()
|
||||
->filterByView('content')
|
||||
->filterByRedirected(null)
|
||||
->filterByViewLocale($locale);
|
||||
|
||||
// Join with visible contents
|
||||
self::addJoinContent($query);
|
||||
|
||||
// Get contents last update
|
||||
$query->withColumn(ContentTableMap::UPDATED_AT, 'CONTENT_UPDATE_AT');
|
||||
|
||||
// Execute query
|
||||
$results = $query->find();
|
||||
|
||||
// For each result, hydrate XML file
|
||||
/** @var RewritingUrl $result */
|
||||
foreach ($results as $result) {
|
||||
|
||||
// Open new sitemap line & set content URL & update date
|
||||
$sitemap[] = '
|
||||
<url>
|
||||
<loc>'.URL::getInstance()->absoluteUrl($result->getUrl()).'</loc>
|
||||
<lastmod>'.date('c', strtotime($result->getVirtualColumn('CONTENT_UPDATE_AT'))).'</lastmod>
|
||||
</url>';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Join contents and their URLs
|
||||
*
|
||||
* @param Criteria $query
|
||||
*/
|
||||
protected function addJoinContent(Criteria &$query)
|
||||
{
|
||||
// Join RewritingURL with Content to have only visible contents
|
||||
$join = new Join();
|
||||
|
||||
$join->addExplicitCondition(
|
||||
RewritingUrlTableMap::TABLE_NAME,
|
||||
'VIEW_ID',
|
||||
null,
|
||||
ContentTableMap::TABLE_NAME,
|
||||
'ID',
|
||||
null
|
||||
);
|
||||
|
||||
$join->setJoinType(Criteria::INNER_JOIN);
|
||||
$query->addJoinObject($join, 'contentJoin');
|
||||
|
||||
// Get only visible products
|
||||
$query->addJoinCondition('contentJoin', ContentTableMap::VISIBLE, 1, Criteria::EQUAL, \PDO::PARAM_INT);
|
||||
}
|
||||
|
||||
}
|
||||
82
local/modules/Sitemap/Controller/FolderSitemapTrait.php
Normal file
82
local/modules/Sitemap/Controller/FolderSitemapTrait.php
Normal file
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
namespace Sitemap\Controller;
|
||||
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Propel\Runtime\ActiveQuery\Join;
|
||||
use Thelia\Model\Map\FolderTableMap;
|
||||
use Thelia\Model\Map\RewritingUrlTableMap;
|
||||
use Thelia\Model\RewritingUrl;
|
||||
use Thelia\Model\RewritingUrlQuery;
|
||||
use Thelia\Tools\URL;
|
||||
|
||||
/**
|
||||
* Class FolderSitemapTrait
|
||||
* @package Sitemap\Controller
|
||||
* @author Etienne Perriere <eperriere@openstudio.fr>
|
||||
*/
|
||||
trait FolderSitemapTrait
|
||||
{
|
||||
/**
|
||||
* Get folders
|
||||
*
|
||||
* @param $sitemap
|
||||
* @param $locale
|
||||
* @throws \Propel\Runtime\Exception\PropelException
|
||||
*/
|
||||
protected function setSitemapFolders(&$sitemap, $locale)
|
||||
{
|
||||
// Prepare query - get folders URL
|
||||
$query = RewritingUrlQuery::create()
|
||||
->filterByView('folder')
|
||||
->filterByRedirected(null)
|
||||
->filterByViewLocale($locale);
|
||||
|
||||
// Join with visible folders
|
||||
self::addJoinFolder($query);
|
||||
|
||||
// Get folders last update
|
||||
$query->withColumn(FolderTableMap::UPDATED_AT, 'FOLDER_UPDATE_AT');
|
||||
|
||||
// Execute query
|
||||
$results = $query->find();
|
||||
|
||||
// For each result, hydrate XML file
|
||||
/** @var RewritingUrl $result */
|
||||
foreach ($results as $result) {
|
||||
|
||||
// Open new sitemap line & set folder URL & update date
|
||||
$sitemap[] = '
|
||||
<url>
|
||||
<loc>'.URL::getInstance()->absoluteUrl($result->getUrl()).'</loc>
|
||||
<lastmod>'.date('c', strtotime($result->getVirtualColumn('FOLDER_UPDATE_AT'))).'</lastmod>
|
||||
</url>';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Join folders and their URLs
|
||||
*
|
||||
* @param Criteria $query
|
||||
*/
|
||||
protected function addJoinFolder(Criteria &$query)
|
||||
{
|
||||
// Join RewritingURL with Folder to have only visible folders
|
||||
$join = new Join();
|
||||
|
||||
$join->addExplicitCondition(
|
||||
RewritingUrlTableMap::TABLE_NAME,
|
||||
'VIEW_ID',
|
||||
null,
|
||||
FolderTableMap::TABLE_NAME,
|
||||
'ID',
|
||||
null
|
||||
);
|
||||
|
||||
$join->setJoinType(Criteria::INNER_JOIN);
|
||||
$query->addJoinObject($join, 'folderJoin');
|
||||
|
||||
// Get only visible folders
|
||||
$query->addJoinCondition('folderJoin', FolderTableMap::VISIBLE, 1, Criteria::EQUAL, \PDO::PARAM_INT);
|
||||
}
|
||||
}
|
||||
129
local/modules/Sitemap/Controller/ProductImageTrait.php
Normal file
129
local/modules/Sitemap/Controller/ProductImageTrait.php
Normal file
@@ -0,0 +1,129 @@
|
||||
<?php
|
||||
|
||||
namespace Sitemap\Controller;
|
||||
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Propel\Runtime\ActiveQuery\Join;
|
||||
use Sitemap\Sitemap;
|
||||
use Thelia\Model\Map\ProductI18nTableMap;
|
||||
use Thelia\Model\Map\ProductImageTableMap;
|
||||
use Thelia\Model\Map\ProductTableMap;
|
||||
use Thelia\Model\Map\RewritingUrlTableMap;
|
||||
use Thelia\Model\RewritingUrl;
|
||||
use Thelia\Model\RewritingUrlQuery;
|
||||
|
||||
/**
|
||||
* Class ProductImageTrait
|
||||
* @package Sitemap\Controller
|
||||
* @author Etienne Perriere <eperriere@openstudio.fr>
|
||||
*/
|
||||
trait ProductImageTrait
|
||||
{
|
||||
protected function setSitemapProductImages(&$sitemap, $locale)
|
||||
{
|
||||
// Change timeout for this script
|
||||
ini_set('max_execution_time', Sitemap::getConfigValue('timeout', 30));
|
||||
|
||||
// Prepare query - get products URL
|
||||
$query = RewritingUrlQuery::create()
|
||||
->filterByView('product')
|
||||
->filterByRedirected(null)
|
||||
->filterByViewLocale($locale);
|
||||
|
||||
// Join with visible products
|
||||
self::addJoinProductI18n($query);
|
||||
|
||||
// Get products title & image file name
|
||||
$query->withColumn(ProductI18nTableMap::TITLE, 'PRODUCT_TITLE');
|
||||
$query->addDescendingOrderByColumn(ProductImageTableMap::POSITION);
|
||||
$query->addGroupByColumn(RewritingUrlTableMap::VIEW_ID);
|
||||
$query->withColumn(ProductImageTableMap::FILE, 'PRODUCT_FILE');
|
||||
|
||||
// Execute query
|
||||
$results = $query->find();
|
||||
|
||||
// Get image generation configuration values
|
||||
$configValues = [];
|
||||
$configValues['width'] = Sitemap::getConfigValue('width');
|
||||
$configValues['height'] = Sitemap::getConfigValue('height');
|
||||
$configValues['quality'] = Sitemap::getConfigValue('quality', 75);
|
||||
$configValues['rotation'] = Sitemap::getConfigValue('rotation', 0);
|
||||
$configValues['resizeMode'] = Sitemap::getConfigValue('resize_mode', \Thelia\Action\Image::EXACT_RATIO_WITH_BORDERS);
|
||||
$configValues['bgColor'] = Sitemap::getConfigValue('background_color');
|
||||
$configValues['allowZoom'] = Sitemap::getConfigValue('allow_zoom', false);
|
||||
|
||||
// For each result, hydrate XML file
|
||||
/** @var RewritingUrl $result */
|
||||
foreach ($results as $result) {
|
||||
|
||||
// Generate image data
|
||||
$this->generateSitemapImage('product', $result, $configValues, $sitemap);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Join products and their URLs
|
||||
*
|
||||
* @param Criteria $query
|
||||
*/
|
||||
protected function addJoinProductI18n(Criteria &$query)
|
||||
{
|
||||
// Join RewritingURL with Product to have only visible products
|
||||
$join = new Join();
|
||||
|
||||
$join->addExplicitCondition(
|
||||
RewritingUrlTableMap::TABLE_NAME,
|
||||
'VIEW_ID',
|
||||
null,
|
||||
ProductTableMap::TABLE_NAME,
|
||||
'ID',
|
||||
null
|
||||
);
|
||||
|
||||
$join->setJoinType(Criteria::INNER_JOIN);
|
||||
$query->addJoinObject($join, 'productJoin');
|
||||
|
||||
$query->addJoinCondition('productJoin', ProductTableMap::VISIBLE, 1, Criteria::EQUAL, \PDO::PARAM_INT);
|
||||
|
||||
// Join RewritingURL with ProductI18n to have product title for it's image
|
||||
$joinI18n = new Join();
|
||||
|
||||
$joinI18n->addExplicitCondition(
|
||||
RewritingUrlTableMap::TABLE_NAME,
|
||||
'VIEW_ID',
|
||||
null,
|
||||
ProductI18nTableMap::TABLE_NAME,
|
||||
'ID',
|
||||
null
|
||||
);
|
||||
$joinI18n->addExplicitCondition(
|
||||
RewritingUrlTableMap::TABLE_NAME,
|
||||
'VIEW_LOCALE',
|
||||
null,
|
||||
ProductI18nTableMap::TABLE_NAME,
|
||||
'LOCALE',
|
||||
null
|
||||
);
|
||||
|
||||
$joinI18n->setJoinType(Criteria::INNER_JOIN);
|
||||
$query->addJoinObject($joinI18n);
|
||||
|
||||
|
||||
// Join RewritingURL with ProductImage to have image file
|
||||
$joinImage = new Join();
|
||||
|
||||
$joinImage->addExplicitCondition(
|
||||
RewritingUrlTableMap::TABLE_NAME,
|
||||
'VIEW_ID',
|
||||
null,
|
||||
ProductImageTableMap::TABLE_NAME,
|
||||
'PRODUCT_ID',
|
||||
null
|
||||
);
|
||||
|
||||
$joinImage->setJoinType(Criteria::INNER_JOIN);
|
||||
$query->addJoinObject($joinImage, 'productImageJoin');
|
||||
|
||||
$query->addJoinCondition('productImageJoin', ProductImageTableMap::VISIBLE, 1, Criteria::EQUAL, \PDO::PARAM_INT);
|
||||
}
|
||||
}
|
||||
82
local/modules/Sitemap/Controller/ProductSitemapTrait.php
Normal file
82
local/modules/Sitemap/Controller/ProductSitemapTrait.php
Normal file
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
namespace Sitemap\Controller;
|
||||
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Propel\Runtime\ActiveQuery\Join;
|
||||
use Thelia\Model\Map\ProductTableMap;
|
||||
use Thelia\Model\Map\RewritingUrlTableMap;
|
||||
use Thelia\Model\RewritingUrl;
|
||||
use Thelia\Model\RewritingUrlQuery;
|
||||
use Thelia\Tools\URL;
|
||||
|
||||
/**
|
||||
* Trait ProductSitemapTrait
|
||||
* @package Sitemap\Controller
|
||||
* @author Etienne Perriere <eperriere@openstudio.fr>
|
||||
*/
|
||||
trait ProductSitemapTrait
|
||||
{
|
||||
/**
|
||||
* Get products
|
||||
*
|
||||
* @param $sitemap
|
||||
* @param $locale
|
||||
* @throws \Propel\Runtime\Exception\PropelException
|
||||
*/
|
||||
protected function setSitemapProducts(&$sitemap, $locale)
|
||||
{
|
||||
// Prepare query - get products URL
|
||||
$query = RewritingUrlQuery::create()
|
||||
->filterByView('product')
|
||||
->filterByRedirected(null)
|
||||
->filterByViewLocale($locale);
|
||||
|
||||
// Join with visible products
|
||||
self::addJoinProduct($query);
|
||||
|
||||
// Get products last update
|
||||
$query->withColumn(ProductTableMap::UPDATED_AT, 'PRODUCT_UPDATE_AT');
|
||||
|
||||
// Execute query
|
||||
$results = $query->find();
|
||||
|
||||
// For each result, hydrate XML file
|
||||
/** @var RewritingUrl $result */
|
||||
foreach ($results as $result) {
|
||||
|
||||
// Open new sitemap line & set product URL & update date
|
||||
$sitemap[] = '
|
||||
<url>
|
||||
<loc>'.URL::getInstance()->absoluteUrl($result->getUrl()).'</loc>
|
||||
<lastmod>'.date('c', strtotime($result->getVirtualColumn('PRODUCT_UPDATE_AT'))).'</lastmod>
|
||||
</url>';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Join products and their URLs
|
||||
*
|
||||
* @param Criteria $query
|
||||
*/
|
||||
protected function addJoinProduct(Criteria &$query)
|
||||
{
|
||||
// Join RewritingURL with Product to have only visible products
|
||||
$join = new Join();
|
||||
|
||||
$join->addExplicitCondition(
|
||||
RewritingUrlTableMap::TABLE_NAME,
|
||||
'VIEW_ID',
|
||||
null,
|
||||
ProductTableMap::TABLE_NAME,
|
||||
'ID',
|
||||
null
|
||||
);
|
||||
|
||||
$join->setJoinType(Criteria::INNER_JOIN);
|
||||
$query->addJoinObject($join, 'productJoin');
|
||||
|
||||
// Get only visible products
|
||||
$query->addJoinCondition('productJoin', ProductTableMap::VISIBLE, 1, Criteria::EQUAL, \PDO::PARAM_INT);
|
||||
}
|
||||
}
|
||||
137
local/modules/Sitemap/Controller/SitemapConfigController.php
Normal file
137
local/modules/Sitemap/Controller/SitemapConfigController.php
Normal file
@@ -0,0 +1,137 @@
|
||||
<?php
|
||||
|
||||
namespace Sitemap\Controller;
|
||||
|
||||
use Sitemap\Sitemap;
|
||||
use Thelia\Controller\Admin\BaseAdminController;
|
||||
use Thelia\Core\Security\AccessManager;
|
||||
use Thelia\Core\Security\Resource\AdminResources;
|
||||
use Thelia\Form\Exception\FormValidationException;
|
||||
|
||||
/**
|
||||
* Class SitemapConfigController
|
||||
* @package Sitemap\Controller
|
||||
* @author Etienne Perriere <eperriere@openstudio.fr>
|
||||
*/
|
||||
class SitemapConfigController extends BaseAdminController
|
||||
{
|
||||
public function defaultAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth([AdminResources::MODULE], ["sitemap"], AccessManager::VIEW)) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
// Get resize mode name
|
||||
switch (Sitemap::getConfigValue('resize_mode')) {
|
||||
case 1:
|
||||
$resizeMode = 'borders';
|
||||
break;
|
||||
|
||||
case 2:
|
||||
$resizeMode = 'crop';
|
||||
break;
|
||||
|
||||
case 3:
|
||||
$resizeMode = 'none';
|
||||
break;
|
||||
|
||||
default:
|
||||
$resizeMode = '';
|
||||
break;
|
||||
}
|
||||
|
||||
// Build form
|
||||
$form = $this->createForm(
|
||||
"sitemap_config_form",
|
||||
'form',
|
||||
[
|
||||
'timeout' => Sitemap::getConfigValue('timeout'),
|
||||
'width' => Sitemap::getConfigValue('width'),
|
||||
'height' => Sitemap::getConfigValue('height'),
|
||||
'quality' => Sitemap::getConfigValue('quality'),
|
||||
'rotation' => Sitemap::getConfigValue('rotation'),
|
||||
'resize_mode' => $resizeMode,
|
||||
'background_color' => Sitemap::getConfigValue('background_color'),
|
||||
'allow_zoom' => Sitemap::getConfigValue('allow_zoom')
|
||||
]
|
||||
);
|
||||
|
||||
$this->getParserContext()->addForm($form);
|
||||
|
||||
return $this->render("sitemap-configuration");
|
||||
}
|
||||
|
||||
/**
|
||||
* Save data
|
||||
*
|
||||
* @return mixed|\Thelia\Core\HttpFoundation\Response
|
||||
*/
|
||||
public function saveAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth([AdminResources::MODULE], ["sitemap"], AccessManager::UPDATE)) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
$baseForm = $this->createForm("sitemap_config_form");
|
||||
|
||||
$errorMessage = null;
|
||||
|
||||
// Get current edition language locale
|
||||
$locale = $this->getCurrentEditionLocale();
|
||||
|
||||
try {
|
||||
$form = $this->validateForm($baseForm);
|
||||
$data = $form->getData();
|
||||
|
||||
// Get resize mode
|
||||
switch ($data["resize_mode"]) {
|
||||
case 'none':
|
||||
$resizeMode = \Thelia\Action\Image::KEEP_IMAGE_RATIO;
|
||||
break;
|
||||
|
||||
case 'crop':
|
||||
$resizeMode = \Thelia\Action\Image::EXACT_RATIO_WITH_CROP;
|
||||
break;
|
||||
|
||||
case 'borders':
|
||||
default:
|
||||
$resizeMode = \Thelia\Action\Image::EXACT_RATIO_WITH_BORDERS;
|
||||
break;
|
||||
}
|
||||
|
||||
// Save data
|
||||
Sitemap::setConfigValue('timeout', $data['timeout']);
|
||||
Sitemap::setConfigValue('width', $data['width']);
|
||||
Sitemap::setConfigValue('height', $data['height']);
|
||||
Sitemap::setConfigValue('quality', $data['quality']);
|
||||
Sitemap::setConfigValue('rotation', $data['rotation']);
|
||||
Sitemap::setConfigValue('resize_mode', $resizeMode);
|
||||
Sitemap::setConfigValue('background_color', $data['background_color']);
|
||||
Sitemap::setConfigValue('allow_zoom', $data['allow_zoom']);
|
||||
|
||||
} catch (FormValidationException $ex) {
|
||||
// Invalid data entered
|
||||
$errorMessage = $this->createStandardFormValidationErrorMessage($ex);
|
||||
} catch (\Exception $ex) {
|
||||
// Any other error
|
||||
$errorMessage = $this->getTranslator()->trans('Sorry, an error occurred: %err', ['%err' => $ex->getMessage()], Sitemap::DOMAIN_NAME, $locale);
|
||||
}
|
||||
|
||||
if (null !== $errorMessage) {
|
||||
// Mark the form as with error
|
||||
$baseForm->setErrorMessage($errorMessage);
|
||||
|
||||
// Send the form and the error to the parser
|
||||
$this->getParserContext()
|
||||
->addForm($baseForm)
|
||||
->setGeneralError($errorMessage)
|
||||
;
|
||||
} else {
|
||||
$this->getParserContext()
|
||||
->set("success", true)
|
||||
;
|
||||
}
|
||||
|
||||
return $this->defaultAction();
|
||||
}
|
||||
}
|
||||
270
local/modules/Sitemap/Controller/SitemapController.php
Normal file
270
local/modules/Sitemap/Controller/SitemapController.php
Normal file
@@ -0,0 +1,270 @@
|
||||
<?php
|
||||
|
||||
namespace Sitemap\Controller;
|
||||
|
||||
use Doctrine\Common\Cache\FilesystemCache;
|
||||
use Thelia\Controller\Front\BaseFrontController;
|
||||
use Thelia\Core\Event\Image\ImageEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\HttpFoundation\Response;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Model\LangQuery;
|
||||
use Thelia\Model\RewritingUrl;
|
||||
use Thelia\Tools\URL;
|
||||
|
||||
/**
|
||||
* Class SitemapController
|
||||
* @package Sitemap\Controller
|
||||
* @author Etienne Perriere <eperriere@openstudio.fr>
|
||||
*/
|
||||
class SitemapController extends BaseFrontController
|
||||
{
|
||||
use CategorySitemapTrait;
|
||||
use ProductSitemapTrait;
|
||||
use FolderSitemapTrait;
|
||||
use ContentSitemapTrait;
|
||||
|
||||
use ProductImageTrait;
|
||||
|
||||
/** Folder name for sitemap cache */
|
||||
const SITEMAP_CACHE_DIR = "sitemap";
|
||||
|
||||
/** Key prefix for sitemap cache */
|
||||
const SITEMAP_CACHE_KEY = "sitemap";
|
||||
|
||||
/** Folder name for sitemap image cache */
|
||||
const SITEMAP_IMAGE_CACHE_DIR = "sitemap-image";
|
||||
|
||||
/** Key prefix for sitemap image cache */
|
||||
const SITEMAP_IMAGE_CACHE_KEY = "sitemap-image";
|
||||
|
||||
protected $useFallbackTemplate = true;
|
||||
|
||||
/**
|
||||
* Generate sitemap
|
||||
*/
|
||||
public function generateAction()
|
||||
{
|
||||
return $this->generateSitemap(self::SITEMAP_CACHE_KEY, self::SITEMAP_CACHE_DIR);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate sitemap image
|
||||
*/
|
||||
public function generateImageAction()
|
||||
{
|
||||
return $this->generateSitemap(self::SITEMAP_IMAGE_CACHE_KEY, self::SITEMAP_IMAGE_CACHE_DIR);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if cached sitemap can be used or generate a new one and cache it
|
||||
*
|
||||
* @param $cacheKey
|
||||
* @param $cacheDirName
|
||||
* @return Response
|
||||
*/
|
||||
public function generateSitemap($cacheKey, $cacheDirName)
|
||||
{
|
||||
// Get and check locale
|
||||
$locale = $this->getSession()->getLang()->getLocale();
|
||||
|
||||
if ("" !== $locale) {
|
||||
if (! $this->checkLang($locale)){
|
||||
$this->pageNotFound();
|
||||
}
|
||||
}
|
||||
|
||||
// Get sitemap cache information
|
||||
$sitemapContent = false;
|
||||
$cacheDir = $this->getCacheDir($cacheDirName);
|
||||
$cacheKey .= $locale;
|
||||
$cacheExpire = intval(ConfigQuery::read("sitemap_ttl", '7200')) ?: 7200;
|
||||
$cacheDriver = new FilesystemCache($cacheDir);
|
||||
|
||||
// Check if sitemap has to be deleted
|
||||
if (!($this->checkAdmin() && "" !== $this->getRequest()->query->get("flush", ""))){
|
||||
// Get cached sitemap
|
||||
$sitemapContent = $cacheDriver->fetch($cacheKey);
|
||||
} else {
|
||||
$cacheDriver->delete($cacheKey);
|
||||
}
|
||||
|
||||
// If not in cache, generate and cache it
|
||||
if (false === $sitemapContent){
|
||||
|
||||
// Check if we generate the standard sitemap or the sitemap image
|
||||
switch ($cacheDirName) {
|
||||
// Image
|
||||
case self::SITEMAP_IMAGE_CACHE_DIR:
|
||||
$sitemap = $this->hydrateSitemapImage($locale);
|
||||
break;
|
||||
|
||||
// Standard
|
||||
case self::SITEMAP_CACHE_DIR:
|
||||
default:
|
||||
$sitemap = $this->hydrateSitemap($locale);
|
||||
break;
|
||||
}
|
||||
|
||||
$sitemapContent = implode("\n", $sitemap);
|
||||
|
||||
// Save cache
|
||||
$cacheDriver->save($cacheKey, $sitemapContent, $cacheExpire);
|
||||
}
|
||||
|
||||
// Render
|
||||
$response = new Response();
|
||||
$response->setContent($sitemapContent);
|
||||
$response->headers->set('Content-Type', 'application/xml');
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/* ------------------ */
|
||||
|
||||
/**
|
||||
* Build sitemap array
|
||||
*
|
||||
* @param $locale
|
||||
* @return array
|
||||
*/
|
||||
protected function hydrateSitemap($locale)
|
||||
{
|
||||
// Begin sitemap
|
||||
$sitemap = ['<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated on : '. date('Y-m-d H:i:s') .' -->
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
|
||||
xmlns:xhtml="http://www.w3.org/1999/xhtml">
|
||||
<url>
|
||||
<loc>'.URL::getInstance()->getIndexPage().'</loc>
|
||||
</url>'
|
||||
];
|
||||
|
||||
// Hydrate sitemap
|
||||
$this->setSitemapCategories($sitemap, $locale);
|
||||
$this->setSitemapProducts($sitemap, $locale);
|
||||
$this->setSitemapFolders($sitemap, $locale);
|
||||
$this->setSitemapContents($sitemap, $locale);
|
||||
|
||||
// End sitemap
|
||||
$sitemap[] = "\t".'</urlset>';
|
||||
|
||||
return $sitemap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build sitemap image array
|
||||
*
|
||||
* @param $locale
|
||||
* @return array
|
||||
*/
|
||||
protected function hydrateSitemapImage($locale)
|
||||
{
|
||||
// Begin sitemap image
|
||||
$sitemap = ['<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated on : '. date('Y-m-d H:i:s') .' -->
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
|
||||
xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">
|
||||
<url>
|
||||
<loc>'.URL::getInstance()->getIndexPage().'</loc>
|
||||
</url>'
|
||||
];
|
||||
|
||||
// Hydrate sitemap image
|
||||
$this->setSitemapProductImages($sitemap, $locale);
|
||||
|
||||
// End sitemap image
|
||||
$sitemap[] = "\t".'</urlset>';
|
||||
|
||||
return $sitemap;
|
||||
}
|
||||
|
||||
/* ------------------ */
|
||||
|
||||
/**
|
||||
* @param $type
|
||||
* @param RewritingUrl $result
|
||||
* @param $configValues
|
||||
* @param $sitemap
|
||||
*/
|
||||
protected function generateSitemapImage($type, $result, $configValues, &$sitemap)
|
||||
{
|
||||
$event = new ImageEvent();
|
||||
|
||||
$event
|
||||
->setWidth($configValues['width'])
|
||||
->setHeight($configValues['height'])
|
||||
->setQuality($configValues['quality'])
|
||||
->setRotation($configValues['rotation'])
|
||||
->setResizeMode($configValues['resizeMode'])
|
||||
->setBackgroundColor($configValues['bgColor'])
|
||||
->setAllowZoom($configValues['allowZoom']);
|
||||
|
||||
// Put source image file path
|
||||
$source_filepath = sprintf("%s%s/%s/%s",
|
||||
THELIA_ROOT,
|
||||
ConfigQuery::read('images_library_path', 'local/media/images'),
|
||||
$type,
|
||||
$result->getVirtualColumn('PRODUCT_FILE')
|
||||
);
|
||||
|
||||
$event->setSourceFilepath($source_filepath);
|
||||
$event->setCacheSubdirectory($type);
|
||||
|
||||
try {
|
||||
// Dispatch image processing event
|
||||
$this->dispatch(TheliaEvents::IMAGE_PROCESS, $event);
|
||||
|
||||
// New sitemap image entry
|
||||
$sitemap[] = '
|
||||
<url>
|
||||
<loc>'.URL::getInstance()->absoluteUrl($result->getUrl()).'</loc>
|
||||
<image:image>
|
||||
<image:loc>'.$event->getFileUrl().'</image:loc>
|
||||
<image:title>'.htmlspecialchars($result->getVirtualColumn('PRODUCT_TITLE')).'</image:title>
|
||||
</image:image>
|
||||
</url>';
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
}
|
||||
}
|
||||
|
||||
/* ------------------ */
|
||||
|
||||
/**
|
||||
* @param $locale
|
||||
* @return bool true if the language is used, otherwise false
|
||||
*/
|
||||
protected function checkLang($locale)
|
||||
{
|
||||
// Load locales
|
||||
$locale = LangQuery::create()
|
||||
->findOneByLocale($locale);
|
||||
|
||||
return (null !== $locale);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the cache directory for sitemap
|
||||
*
|
||||
* @param $cacheDirName
|
||||
* @return mixed|string
|
||||
*/
|
||||
protected function getCacheDir($cacheDirName)
|
||||
{
|
||||
$cacheDir = $this->container->getParameter("kernel.cache_dir");
|
||||
$cacheDir = rtrim($cacheDir, '/');
|
||||
$cacheDir .= '/' . $cacheDirName . '/';
|
||||
|
||||
return $cacheDir;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if current user has ADMIN role
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function checkAdmin(){
|
||||
return $this->getSecurityContext()->hasAdminUser();
|
||||
}
|
||||
}
|
||||
67
local/modules/Sitemap/Form/SitemapConfigForm.php
Normal file
67
local/modules/Sitemap/Form/SitemapConfigForm.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace Sitemap\Form;
|
||||
|
||||
use Thelia\Form\BaseForm;
|
||||
|
||||
/**
|
||||
* Class SitemapConfigForm
|
||||
* @package Sitemap\Form
|
||||
* @author Etienne Perriere <eperriere@openstudio.fr>
|
||||
*/
|
||||
class SitemapConfigForm extends BaseForm
|
||||
{
|
||||
public function getName()
|
||||
{
|
||||
return 'sitemap_config_form';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null
|
||||
*/
|
||||
protected function buildForm()
|
||||
{
|
||||
$this->formBuilder
|
||||
->add(
|
||||
'timeout',
|
||||
'number',
|
||||
['label' => $this->translator->trans('Script timeout (in seconds) for images generation (default: 30)', [], 'sitemap')]
|
||||
)
|
||||
->add(
|
||||
'width',
|
||||
'text',
|
||||
['label' => $this->translator->trans('Image width', [], 'sitemap')]
|
||||
)
|
||||
->add(
|
||||
'height',
|
||||
'text',
|
||||
['label' => $this->translator->trans('Image height', [], 'sitemap')]
|
||||
)
|
||||
->add(
|
||||
'quality',
|
||||
'text',
|
||||
['label' => $this->translator->trans('Image quality', [], 'sitemap')]
|
||||
)
|
||||
->add(
|
||||
'rotation',
|
||||
'text',
|
||||
['label' => $this->translator->trans('Image rotation', [], 'sitemap')]
|
||||
)
|
||||
->add(
|
||||
'resize_mode',
|
||||
'text',
|
||||
['label' => $this->translator->trans('Image resize mode ([borders] / crop / none)', [], 'sitemap')]
|
||||
)
|
||||
->add(
|
||||
'background_color',
|
||||
'text',
|
||||
['label' => $this->translator->trans('Image background color', [], 'sitemap')]
|
||||
)
|
||||
->add(
|
||||
'allow_zoom',
|
||||
'text',
|
||||
['label' => $this->translator->trans('Allow image zoom ([false] / true)', [], 'sitemap')]
|
||||
)
|
||||
;
|
||||
}
|
||||
}
|
||||
19
local/modules/Sitemap/Hook/SitemapHook.php
Normal file
19
local/modules/Sitemap/Hook/SitemapHook.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace Sitemap\Hook;
|
||||
|
||||
use Thelia\Core\Event\Hook\HookRenderEvent;
|
||||
use Thelia\Core\Hook\BaseHook;
|
||||
|
||||
/**
|
||||
* Class SitemapHook
|
||||
* @package Sitemap\Hook
|
||||
* @author Etienne Perriere <eperriere@openstudio.fr>
|
||||
*/
|
||||
class SitemapHook extends BaseHook
|
||||
{
|
||||
public function onModuleConfig(HookRenderEvent $event)
|
||||
{
|
||||
$event->add($this->render('sitemap-configuration.html'));
|
||||
}
|
||||
}
|
||||
12
local/modules/Sitemap/I18n/backOffice/default/en_US.php
Normal file
12
local/modules/Sitemap/I18n/backOffice/default/en_US.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
'<b>Warning!</b> Only fill this input with a greater value than 30 if you have so many images that the sitemap-image can\'t be generated because of timeout.' => '<b>Warning!</b> Only fill this input with a greater value than 30 if you have so many images that the sitemap-image can\'t be generated because of timeout.',
|
||||
'Configuration correctly saved' => 'Configuration correctly saved',
|
||||
'Configure sitemap images' => 'Configure sitemap images',
|
||||
'Depending on your server, this may have no effect.' => 'Depending on your server, this may have no effect.',
|
||||
'Home' => 'Home',
|
||||
'Modules' => 'Modules',
|
||||
'Set the same information as in your product image loop' => 'Set the same information as in your product image loop',
|
||||
'Sitemap images configuration' => 'Sitemap images configuration',
|
||||
);
|
||||
12
local/modules/Sitemap/I18n/backOffice/default/fr_FR.php
Normal file
12
local/modules/Sitemap/I18n/backOffice/default/fr_FR.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
'<b>Warning!</b> Only fill this input with a greater value than 30 if you have so many images that the sitemap-image can\'t be generated because of timeout.' => '<b>Attention !</b> Ne remplissez ce champ avec une valeur plus grande que 30 que si vous avez beaucoup d\'images et que le sitemap-image n\'arrive pas à se générer.',
|
||||
'Configuration correctly saved' => 'Configuration sauvegardée avec succès',
|
||||
'Configure sitemap images' => 'Configurer les images du sitemap',
|
||||
'Depending on your server, this may have no effect.' => 'En fonction de votre serveur, cela pourrait n\'avoir aucun effet.',
|
||||
'Home' => 'Accueil',
|
||||
'Modules' => 'Modules',
|
||||
'Set the same information as in your product image loop' => 'Entrez les mêmes informations que dans la boucle image des produits',
|
||||
'Sitemap images configuration' => 'Configuration des images du module Sitemap',
|
||||
);
|
||||
13
local/modules/Sitemap/I18n/en_US.php
Normal file
13
local/modules/Sitemap/I18n/en_US.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
'Allow image zoom ([false] / true)' => 'Allow image zoom ([false] / true)',
|
||||
'Image background color' => 'Image background color',
|
||||
'Image height' => 'Image height',
|
||||
'Image quality' => 'Image quality',
|
||||
'Image resize mode ([borders] / crop / none)' => 'Image resize mode ([borders] / crop / none)',
|
||||
'Image rotation' => 'Image rotation',
|
||||
'Image width' => 'Image width',
|
||||
'Script timeout (in seconds) for images generation (default: 30)' => 'Script timeout (in seconds) for images generation (default: 30)',
|
||||
'Sorry, an error occurred: %err' => 'Sorry, an error occurred: %err',
|
||||
);
|
||||
13
local/modules/Sitemap/I18n/fr_FR.php
Normal file
13
local/modules/Sitemap/I18n/fr_FR.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
'Allow image zoom ([false] / true)' => 'Autoriser le zoom des images ([false] / true)',
|
||||
'Image background color' => 'Couleur de fond des images',
|
||||
'Image height' => 'Hauteur des images',
|
||||
'Image quality' => 'Qualité des images',
|
||||
'Image resize mode ([borders] / crop / none)' => 'Mode de redimensionnement des images ([borders] / crop / none)',
|
||||
'Image rotation' => 'Rotation des images',
|
||||
'Image width' => 'Largeur des images',
|
||||
'Script timeout (in seconds) for images generation (default: 30)' => 'Temps maximum d\'exécution (en secondes) pour la génération des images (par défaut : 30)',
|
||||
'Sorry, an error occurred: %err' => 'Désolé, une erreur s\'est produite : %err',
|
||||
);
|
||||
30
local/modules/Sitemap/Readme.md
Normal file
30
local/modules/Sitemap/Readme.md
Normal file
@@ -0,0 +1,30 @@
|
||||
# Sitemap
|
||||
|
||||
Generate sitemaps faster than Thelia default ones.
|
||||
|
||||
## Installation
|
||||
|
||||
### Manually
|
||||
|
||||
* Copy the module into ```<thelia_root>/local/modules/``` directory and be sure that the name of the module is Sitemap.
|
||||
* Activate it in your thelia administration panel
|
||||
|
||||
### Composer
|
||||
|
||||
Add it in your main thelia composer.json file
|
||||
|
||||
```
|
||||
composer require thelia/sitemap-module:~1.3
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Configure the module with the same information as in you product image loop.
|
||||
|
||||
If you have a lot of products with images, change the timeout in the configuration. **However, be aware** that it may not work depending on your server.
|
||||
|
||||
The sitemap will be filled with all your categories, products, folders and contents URLs, depending on the language.
|
||||
|
||||
The sitemap-image will be filled with all your product images (1 by product) URLs, depending on the language.
|
||||
|
||||
The module will be used to generate sitemap when going on http://yourSite.com/sitemap and the sitemap-image on http://yourSite.com/sitemap-image.
|
||||
21
local/modules/Sitemap/Sitemap.php
Normal file
21
local/modules/Sitemap/Sitemap.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* This file is part of the Thelia package. */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : dev@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* For the full copyright and license information, please view the LICENSE.txt */
|
||||
/* file that was distributed with this source code. */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Sitemap;
|
||||
|
||||
use Thelia\Module\BaseModule;
|
||||
|
||||
class Sitemap extends BaseModule
|
||||
{
|
||||
/** @var string */
|
||||
const DOMAIN_NAME = 'sitemap';
|
||||
}
|
||||
11
local/modules/Sitemap/composer.json
Normal file
11
local/modules/Sitemap/composer.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "thelia/sitemap-module",
|
||||
"license": "LGPL-3.0+",
|
||||
"type": "thelia-module",
|
||||
"require": {
|
||||
"thelia/installer": "~1.1"
|
||||
},
|
||||
"extra": {
|
||||
"installer-name": "Sitemap"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,174 @@
|
||||
{extends file="admin-layout.tpl"}
|
||||
|
||||
{block name="no-return-functions"}
|
||||
{$admin_current_location = 'modules'}
|
||||
{/block}
|
||||
|
||||
{block name="page-title"}{intl d="sitemap.bo.default" l='Sitemap images configuration'}{/block}
|
||||
|
||||
{block name="check-resource"}admin.module{/block}
|
||||
{block name="check-access"}view{/block}
|
||||
{block name="check-module"}Sitemap{/block}
|
||||
|
||||
{block name="main-content"}
|
||||
<div class="container" id="wrapper">
|
||||
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="{url path='/admin'}">{intl l="Home" d="sitemap.bo.default"}</a></li>
|
||||
<li><a href="{url path='/admin/modules'}">{intl l="Modules" d="sitemap.bo.default"}</a></li>
|
||||
<li>{intl l="Sitemap images configuration" d="sitemap.bo.default"}</li>
|
||||
</ul>
|
||||
|
||||
<div class="general-block-decorator">
|
||||
|
||||
<div class="title title-without-tabs">
|
||||
{intl l="Configure sitemap images" d="sitemap.bo.default"}
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
{if $success}
|
||||
<div class="alert alert-success">
|
||||
{intl l="Configuration correctly saved" d="sitemap.bo.default"}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{form name='sitemap_config_form'}
|
||||
<form method="post" action="{url path='/admin/module/Sitemap'}">
|
||||
|
||||
{form_hidden_fields form=$form}
|
||||
|
||||
{include "includes/inner-form-toolbar.html" hide_flags=true close_url={url path='/admin/modules'}}
|
||||
|
||||
<h3>{intl l="Set the same information as in your product image loop" d="sitemap.bo.default"}.</h3>
|
||||
|
||||
{form_field form=$form field="timeout"}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label class="control-label">
|
||||
{$label}
|
||||
|
||||
{form_error form=$form field="timeout"}
|
||||
<br />
|
||||
<span class="error">{$message}</span>
|
||||
{/form_error}
|
||||
</label>
|
||||
|
||||
<p>{intl l='<b>Warning!</b> Only fill this input with a greater value than 30 if you have so many images that the sitemap-image can\'t be generated because of timeout.' d='sitemap.bo.default'}</p>
|
||||
<p>{intl l='Depending on your server, this may have no effect.' d="sitemap.bo.default"}</p>
|
||||
<input type="text" class="form-control" name="{$name}" value="{$value}" />
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field="width"}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label class="control-label">
|
||||
{$label}
|
||||
|
||||
{form_error form=$form field="width"}
|
||||
<br />
|
||||
<span class="error">{$message}</span>
|
||||
{/form_error}
|
||||
</label>
|
||||
|
||||
<input type="text" class="form-control" name="{$name}" value="{$value}" />
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field="height"}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label class="control-label">
|
||||
{$label}
|
||||
|
||||
{form_error form=$form field="height"}
|
||||
<br />
|
||||
<span class="error">{$message}</span>
|
||||
{/form_error}
|
||||
</label>
|
||||
|
||||
<input type="text" class="form-control" name="{$name}" value="{$value}" />
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field="quality"}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label class="control-label">
|
||||
{$label}
|
||||
|
||||
{form_error form=$form field="quality"}
|
||||
<br />
|
||||
<span class="error">{$message}</span>
|
||||
{/form_error}
|
||||
</label>
|
||||
|
||||
<input type="text" class="form-control" name="{$name}" value="{$value}" />
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field="rotation"}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label class="control-label">
|
||||
{$label}
|
||||
|
||||
{form_error form=$form field="rotation"}
|
||||
<br />
|
||||
<span class="error">{$message}</span>
|
||||
{/form_error}
|
||||
</label>
|
||||
|
||||
<input type="text" class="form-control" name="{$name}" value="{$value}" />
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field="resize_mode"}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label class="control-label">
|
||||
{$label}
|
||||
|
||||
{form_error form=$form field="resize_mode"}
|
||||
<br />
|
||||
<span class="error">{$message}</span>
|
||||
{/form_error}
|
||||
</label>
|
||||
|
||||
<input type="text" class="form-control" name="{$name}" value="{$value}" />
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field="background_color"}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label class="control-label">
|
||||
{$label}
|
||||
|
||||
{form_error form=$form field="background_color"}
|
||||
<br />
|
||||
<span class="error">{$message}</span>
|
||||
{/form_error}
|
||||
</label>
|
||||
|
||||
<input type="text" class="form-control" name="{$name}" value="{$value}" />
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field="allow_zoom"}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label class="control-label">
|
||||
{$label}
|
||||
|
||||
{form_error form=$form field="allow_zoom"}
|
||||
<br />
|
||||
<span class="error">{$message}</span>
|
||||
{/form_error}
|
||||
</label>
|
||||
|
||||
<input type="text" class="form-control" name="{$name}" value="{$value}" />
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
</form>
|
||||
{/form}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
||||
Reference in New Issue
Block a user