Changed 'template' loop into 'product-template' loop
This commit is contained in:
@@ -48,7 +48,7 @@
|
||||
<loop class="Thelia\Core\Template\Loop\Coupon" name="coupon"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Message" name="message"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Delivery" name="delivery"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Template" name="template"/> <!-- This is product templates ;-) -->
|
||||
<loop class="Thelia\Core\Template\Loop\ProductTemplate" name="product-template"/> <!-- This is product templates ;-) -->
|
||||
<loop class="Thelia\Core\Template\Loop\Tax" name="tax"/>
|
||||
<loop class="Thelia\Core\Template\Loop\TaxRule" name="tax-rule"/>
|
||||
<loop class="Thelia\Core\Template\Loop\TaxRuleCountry" name="tax-rule-country"/>
|
||||
|
||||
108
core/lib/Thelia/Core/Template/Loop/ProductTemplate.php
Normal file
108
core/lib/Thelia/Core/Template/Loop/ProductTemplate.php
Normal file
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Core\Template\Loop;
|
||||
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Thelia\Core\Template\Element\BaseI18nLoop;
|
||||
use Thelia\Core\Template\Element\LoopResult;
|
||||
use Thelia\Core\Template\Element\LoopResultRow;
|
||||
|
||||
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||
|
||||
use Thelia\Model\Base\TemplateQuery;
|
||||
|
||||
/**
|
||||
*
|
||||
* Template loop
|
||||
*
|
||||
*
|
||||
* Class Template
|
||||
* @package Thelia\Core\Template\Loop
|
||||
* @author Etienne Roudeix <eroudeix@openstudio.fr>
|
||||
*/
|
||||
class ProductTemplate extends BaseI18nLoop
|
||||
{
|
||||
public $timestampable = true;
|
||||
|
||||
/**
|
||||
* @return ArgumentCollection
|
||||
*/
|
||||
protected function getArgDefinitions()
|
||||
{
|
||||
return new ArgumentCollection(
|
||||
Argument::createIntListTypeArgument('id'),
|
||||
Argument::createIntListTypeArgument('exclude')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $pagination
|
||||
*
|
||||
* @return \Thelia\Core\Template\Element\LoopResult
|
||||
*/
|
||||
public function exec(&$pagination)
|
||||
{
|
||||
$search = TemplateQuery::create();
|
||||
|
||||
$backendContext = $this->getBackend_context();
|
||||
|
||||
$lang = $this->getLang();
|
||||
|
||||
/* manage translations */
|
||||
$locale = $this->configureI18nProcessing($search, $columns = array('NAME'));
|
||||
|
||||
$id = $this->getId();
|
||||
|
||||
if (null !== $id) {
|
||||
$search->filterById($id, Criteria::IN);
|
||||
}
|
||||
|
||||
$exclude = $this->getExclude();
|
||||
|
||||
if (null !== $exclude) {
|
||||
$search->filterById($exclude, Criteria::NOT_IN);
|
||||
}
|
||||
|
||||
/* perform search */
|
||||
$templates = $this->search($search, $pagination);
|
||||
|
||||
$loopResult = new LoopResult($templates);
|
||||
|
||||
foreach ($templates as $template) {
|
||||
$loopResultRow = new LoopResultRow($loopResult, $template, $this->versionable, $this->timestampable, $this->countable);
|
||||
|
||||
$loopResultRow
|
||||
->set("ID", $template->getId())
|
||||
->set("IS_TRANSLATED" , $template->getVirtualColumn('IS_TRANSLATED'))
|
||||
->set("LOCALE" , $locale)
|
||||
->set("NAME" , $template->getVirtualColumn('i18n_NAME'))
|
||||
;
|
||||
|
||||
$loopResult->addRow($loopResultRow);
|
||||
}
|
||||
|
||||
return $loopResult;
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,7 @@
|
||||
<div class="input-group">
|
||||
<select required="required" name="template_id" id="template_id" class="form-control">
|
||||
<option value="0">{intl l='Do not use a product template'}</option>
|
||||
{loop name="product_template_select" type="template"}
|
||||
{loop name="product_template_select" type="product-template"}
|
||||
<option value="{$ID}" {if $TEMPLATE == $ID}selected="selected"{/if}>{$NAME}</option>
|
||||
{/loop}
|
||||
</select>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
<div id="wrapper" class="container">
|
||||
|
||||
{loop name="template_edit" type="template" id="$template_id" backend_context="1" lang="$edit_language_id"}
|
||||
{loop name="template_edit" type="product-template" id="$template_id" backend_context="1" lang="$edit_language_id"}
|
||||
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="{url path='/admin/home'}">{intl l="Home"}</a></li>
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{loop name="list" type="template" backend_context="1" lang=$lang_id order=$order}
|
||||
{loop name="list" type="product-template" backend_context="1" lang=$lang_id order=$order}
|
||||
<tr>
|
||||
<td>{$ID}</td>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user