create Delivery loop
This commit is contained in:
@@ -34,6 +34,7 @@
|
||||
<loop class="Thelia\Core\Template\Loop\Image" name="image"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Config" name="config"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Message" name="message"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Delivery" name="delivery"/>
|
||||
</loops>
|
||||
|
||||
<forms>
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
namespace Thelia\Core\Template\Loop;
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Thelia\Core\Template\Element\BaseLoop;
|
||||
use Thelia\Core\Template\Element\BaseI18nLoop;
|
||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||
use Thelia\Model\ModuleQuery;
|
||||
@@ -34,9 +34,8 @@ use Thelia\Model\ModuleQuery;
|
||||
* @package Thelia\Core\Template\Loop
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class BaseSpecificModule extends BaseLoop {
|
||||
class BaseSpecificModule extends BaseI18nLoop {
|
||||
public $timestampable = true;
|
||||
public $versionable = true;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -106,4 +105,5 @@ class BaseSpecificModule extends BaseLoop {
|
||||
|
||||
return $search;
|
||||
}
|
||||
|
||||
}
|
||||
82
core/lib/Thelia/Core/Template/Loop/Delivery.php
Normal file
82
core/lib/Thelia/Core/Template/Loop/Delivery.php
Normal file
@@ -0,0 +1,82 @@
|
||||
<?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 Thelia\Core\Template\Element\LoopResult;
|
||||
use Thelia\Core\Template\Element\LoopResultRow;
|
||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||
|
||||
|
||||
/**
|
||||
* Class Delivery
|
||||
* @package Thelia\Core\Template\Loop
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class Delivery extends BaseSpecificModule
|
||||
{
|
||||
|
||||
public function getArgDefinitions()
|
||||
{
|
||||
$collection = parent::getArgDefinitions();
|
||||
|
||||
$collection->addArgument(
|
||||
Argument::createIntTypeArgument("country")
|
||||
);
|
||||
|
||||
return $collection;
|
||||
}
|
||||
|
||||
public function exec(&$pagination)
|
||||
{
|
||||
$search = parent::exec($pagination);
|
||||
/* manage translations */
|
||||
$locale = $this->configureI18nProcessing($search);
|
||||
/* perform search */
|
||||
$deliveryModules = $this->search($search, $pagination);
|
||||
|
||||
$loopResult = new LoopResult($deliveryModules);
|
||||
|
||||
foreach ($deliveryModules as $deliveryModule) {
|
||||
$loopResultRow = new LoopResultRow($loopResult, $deliveryModule, $this->versionable, $this->timestampable, $this->countable);
|
||||
|
||||
$moduleReflection = new \ReflectionClass($deliveryModule->getFullNamespace());
|
||||
$moduleInstance = $moduleReflection->newInstance();
|
||||
|
||||
$moduleInstance->setRequest($this->request);
|
||||
$moduleInstance->setDispatcher($this->dispatcher);
|
||||
|
||||
$loopResultRow
|
||||
->set('ID', $deliveryModule->getId())
|
||||
->set('TITLE', $deliveryModule->getVirtualColumn('i18n_TITLE'))
|
||||
->set('CHAPO', $deliveryModule->getVirtualColumn('i18n_CHAPO'))
|
||||
->set('DESCRIPTION', $deliveryModule->getVirtualColumn('i18n_DESCRIPTION'))
|
||||
->set('POSTSCRIPTUM', $deliveryModule->getVirtualColumn('i18n_POSTSCRIPTUM'))
|
||||
->set('PRICE', $moduleInstance->calculate($this->getCountry()))
|
||||
;
|
||||
|
||||
$loopResult->addRow($loopResultRow);
|
||||
}
|
||||
|
||||
return $loopResult;
|
||||
}
|
||||
}
|
||||
@@ -111,7 +111,7 @@ class Thelia extends Kernel
|
||||
try {
|
||||
|
||||
$defintion = new Definition();
|
||||
$defintion->setClass($module->getCode() ."\\". ucfirst($module->getCode()));
|
||||
$defintion->setClass($module->getFullNamespace());
|
||||
$defintion->addMethodCall("setContainer", array('service_container'));
|
||||
|
||||
$container->setDefinition(
|
||||
|
||||
@@ -89,6 +89,12 @@ abstract class Module implements ActiveRecordInterface
|
||||
*/
|
||||
protected $position;
|
||||
|
||||
/**
|
||||
* The value for the full_namespace field.
|
||||
* @var string
|
||||
*/
|
||||
protected $full_namespace;
|
||||
|
||||
/**
|
||||
* The value for the created_at field.
|
||||
* @var string
|
||||
@@ -456,6 +462,17 @@ abstract class Module implements ActiveRecordInterface
|
||||
return $this->position;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [full_namespace] column value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFullNamespace()
|
||||
{
|
||||
|
||||
return $this->full_namespace;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [optionally formatted] temporal [created_at] column value.
|
||||
*
|
||||
@@ -601,6 +618,27 @@ abstract class Module implements ActiveRecordInterface
|
||||
return $this;
|
||||
} // setPosition()
|
||||
|
||||
/**
|
||||
* Set the value of [full_namespace] column.
|
||||
*
|
||||
* @param string $v new value
|
||||
* @return \Thelia\Model\Module The current object (for fluent API support)
|
||||
*/
|
||||
public function setFullNamespace($v)
|
||||
{
|
||||
if ($v !== null) {
|
||||
$v = (string) $v;
|
||||
}
|
||||
|
||||
if ($this->full_namespace !== $v) {
|
||||
$this->full_namespace = $v;
|
||||
$this->modifiedColumns[] = ModuleTableMap::FULL_NAMESPACE;
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
} // setFullNamespace()
|
||||
|
||||
/**
|
||||
* Sets the value of [created_at] column to a normalized version of the date/time value specified.
|
||||
*
|
||||
@@ -695,13 +733,16 @@ abstract class Module implements ActiveRecordInterface
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : ModuleTableMap::translateFieldName('Position', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->position = (null !== $col) ? (int) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : ModuleTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : ModuleTableMap::translateFieldName('FullNamespace', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->full_namespace = (null !== $col) ? (string) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : ModuleTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
if ($col === '0000-00-00 00:00:00') {
|
||||
$col = null;
|
||||
}
|
||||
$this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : ModuleTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : ModuleTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
if ($col === '0000-00-00 00:00:00') {
|
||||
$col = null;
|
||||
}
|
||||
@@ -714,7 +755,7 @@ abstract class Module implements ActiveRecordInterface
|
||||
$this->ensureConsistency();
|
||||
}
|
||||
|
||||
return $startcol + 7; // 7 = ModuleTableMap::NUM_HYDRATE_COLUMNS.
|
||||
return $startcol + 8; // 8 = ModuleTableMap::NUM_HYDRATE_COLUMNS.
|
||||
|
||||
} catch (Exception $e) {
|
||||
throw new PropelException("Error populating \Thelia\Model\Module object", 0, $e);
|
||||
@@ -987,6 +1028,9 @@ abstract class Module implements ActiveRecordInterface
|
||||
if ($this->isColumnModified(ModuleTableMap::POSITION)) {
|
||||
$modifiedColumns[':p' . $index++] = 'POSITION';
|
||||
}
|
||||
if ($this->isColumnModified(ModuleTableMap::FULL_NAMESPACE)) {
|
||||
$modifiedColumns[':p' . $index++] = 'FULL_NAMESPACE';
|
||||
}
|
||||
if ($this->isColumnModified(ModuleTableMap::CREATED_AT)) {
|
||||
$modifiedColumns[':p' . $index++] = 'CREATED_AT';
|
||||
}
|
||||
@@ -1019,6 +1063,9 @@ abstract class Module implements ActiveRecordInterface
|
||||
case 'POSITION':
|
||||
$stmt->bindValue($identifier, $this->position, PDO::PARAM_INT);
|
||||
break;
|
||||
case 'FULL_NAMESPACE':
|
||||
$stmt->bindValue($identifier, $this->full_namespace, PDO::PARAM_STR);
|
||||
break;
|
||||
case 'CREATED_AT':
|
||||
$stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
|
||||
break;
|
||||
@@ -1103,9 +1150,12 @@ abstract class Module implements ActiveRecordInterface
|
||||
return $this->getPosition();
|
||||
break;
|
||||
case 5:
|
||||
return $this->getCreatedAt();
|
||||
return $this->getFullNamespace();
|
||||
break;
|
||||
case 6:
|
||||
return $this->getCreatedAt();
|
||||
break;
|
||||
case 7:
|
||||
return $this->getUpdatedAt();
|
||||
break;
|
||||
default:
|
||||
@@ -1142,8 +1192,9 @@ abstract class Module implements ActiveRecordInterface
|
||||
$keys[2] => $this->getType(),
|
||||
$keys[3] => $this->getActivate(),
|
||||
$keys[4] => $this->getPosition(),
|
||||
$keys[5] => $this->getCreatedAt(),
|
||||
$keys[6] => $this->getUpdatedAt(),
|
||||
$keys[5] => $this->getFullNamespace(),
|
||||
$keys[6] => $this->getCreatedAt(),
|
||||
$keys[7] => $this->getUpdatedAt(),
|
||||
);
|
||||
$virtualColumns = $this->virtualColumns;
|
||||
foreach($virtualColumns as $key => $virtualColumn)
|
||||
@@ -1208,9 +1259,12 @@ abstract class Module implements ActiveRecordInterface
|
||||
$this->setPosition($value);
|
||||
break;
|
||||
case 5:
|
||||
$this->setCreatedAt($value);
|
||||
$this->setFullNamespace($value);
|
||||
break;
|
||||
case 6:
|
||||
$this->setCreatedAt($value);
|
||||
break;
|
||||
case 7:
|
||||
$this->setUpdatedAt($value);
|
||||
break;
|
||||
} // switch()
|
||||
@@ -1242,8 +1296,9 @@ abstract class Module implements ActiveRecordInterface
|
||||
if (array_key_exists($keys[2], $arr)) $this->setType($arr[$keys[2]]);
|
||||
if (array_key_exists($keys[3], $arr)) $this->setActivate($arr[$keys[3]]);
|
||||
if (array_key_exists($keys[4], $arr)) $this->setPosition($arr[$keys[4]]);
|
||||
if (array_key_exists($keys[5], $arr)) $this->setCreatedAt($arr[$keys[5]]);
|
||||
if (array_key_exists($keys[6], $arr)) $this->setUpdatedAt($arr[$keys[6]]);
|
||||
if (array_key_exists($keys[5], $arr)) $this->setFullNamespace($arr[$keys[5]]);
|
||||
if (array_key_exists($keys[6], $arr)) $this->setCreatedAt($arr[$keys[6]]);
|
||||
if (array_key_exists($keys[7], $arr)) $this->setUpdatedAt($arr[$keys[7]]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1260,6 +1315,7 @@ abstract class Module implements ActiveRecordInterface
|
||||
if ($this->isColumnModified(ModuleTableMap::TYPE)) $criteria->add(ModuleTableMap::TYPE, $this->type);
|
||||
if ($this->isColumnModified(ModuleTableMap::ACTIVATE)) $criteria->add(ModuleTableMap::ACTIVATE, $this->activate);
|
||||
if ($this->isColumnModified(ModuleTableMap::POSITION)) $criteria->add(ModuleTableMap::POSITION, $this->position);
|
||||
if ($this->isColumnModified(ModuleTableMap::FULL_NAMESPACE)) $criteria->add(ModuleTableMap::FULL_NAMESPACE, $this->full_namespace);
|
||||
if ($this->isColumnModified(ModuleTableMap::CREATED_AT)) $criteria->add(ModuleTableMap::CREATED_AT, $this->created_at);
|
||||
if ($this->isColumnModified(ModuleTableMap::UPDATED_AT)) $criteria->add(ModuleTableMap::UPDATED_AT, $this->updated_at);
|
||||
|
||||
@@ -1329,6 +1385,7 @@ abstract class Module implements ActiveRecordInterface
|
||||
$copyObj->setType($this->getType());
|
||||
$copyObj->setActivate($this->getActivate());
|
||||
$copyObj->setPosition($this->getPosition());
|
||||
$copyObj->setFullNamespace($this->getFullNamespace());
|
||||
$copyObj->setCreatedAt($this->getCreatedAt());
|
||||
$copyObj->setUpdatedAt($this->getUpdatedAt());
|
||||
|
||||
@@ -1876,6 +1933,7 @@ abstract class Module implements ActiveRecordInterface
|
||||
$this->type = null;
|
||||
$this->activate = null;
|
||||
$this->position = null;
|
||||
$this->full_namespace = null;
|
||||
$this->created_at = null;
|
||||
$this->updated_at = null;
|
||||
$this->alreadyInSave = false;
|
||||
|
||||
@@ -27,6 +27,7 @@ use Thelia\Model\Map\ModuleTableMap;
|
||||
* @method ChildModuleQuery orderByType($order = Criteria::ASC) Order by the type column
|
||||
* @method ChildModuleQuery orderByActivate($order = Criteria::ASC) Order by the activate column
|
||||
* @method ChildModuleQuery orderByPosition($order = Criteria::ASC) Order by the position column
|
||||
* @method ChildModuleQuery orderByFullNamespace($order = Criteria::ASC) Order by the full_namespace column
|
||||
* @method ChildModuleQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
|
||||
* @method ChildModuleQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
|
||||
*
|
||||
@@ -35,6 +36,7 @@ use Thelia\Model\Map\ModuleTableMap;
|
||||
* @method ChildModuleQuery groupByType() Group by the type column
|
||||
* @method ChildModuleQuery groupByActivate() Group by the activate column
|
||||
* @method ChildModuleQuery groupByPosition() Group by the position column
|
||||
* @method ChildModuleQuery groupByFullNamespace() Group by the full_namespace column
|
||||
* @method ChildModuleQuery groupByCreatedAt() Group by the created_at column
|
||||
* @method ChildModuleQuery groupByUpdatedAt() Group by the updated_at column
|
||||
*
|
||||
@@ -58,6 +60,7 @@ use Thelia\Model\Map\ModuleTableMap;
|
||||
* @method ChildModule findOneByType(int $type) Return the first ChildModule filtered by the type column
|
||||
* @method ChildModule findOneByActivate(int $activate) Return the first ChildModule filtered by the activate column
|
||||
* @method ChildModule findOneByPosition(int $position) Return the first ChildModule filtered by the position column
|
||||
* @method ChildModule findOneByFullNamespace(string $full_namespace) Return the first ChildModule filtered by the full_namespace column
|
||||
* @method ChildModule findOneByCreatedAt(string $created_at) Return the first ChildModule filtered by the created_at column
|
||||
* @method ChildModule findOneByUpdatedAt(string $updated_at) Return the first ChildModule filtered by the updated_at column
|
||||
*
|
||||
@@ -66,6 +69,7 @@ use Thelia\Model\Map\ModuleTableMap;
|
||||
* @method array findByType(int $type) Return ChildModule objects filtered by the type column
|
||||
* @method array findByActivate(int $activate) Return ChildModule objects filtered by the activate column
|
||||
* @method array findByPosition(int $position) Return ChildModule objects filtered by the position column
|
||||
* @method array findByFullNamespace(string $full_namespace) Return ChildModule objects filtered by the full_namespace column
|
||||
* @method array findByCreatedAt(string $created_at) Return ChildModule objects filtered by the created_at column
|
||||
* @method array findByUpdatedAt(string $updated_at) Return ChildModule objects filtered by the updated_at column
|
||||
*
|
||||
@@ -156,7 +160,7 @@ abstract class ModuleQuery extends ModelCriteria
|
||||
*/
|
||||
protected function findPkSimple($key, $con)
|
||||
{
|
||||
$sql = 'SELECT ID, CODE, TYPE, ACTIVATE, POSITION, CREATED_AT, UPDATED_AT FROM module WHERE ID = :p0';
|
||||
$sql = 'SELECT ID, CODE, TYPE, ACTIVATE, POSITION, FULL_NAMESPACE, CREATED_AT, UPDATED_AT FROM module WHERE ID = :p0';
|
||||
try {
|
||||
$stmt = $con->prepare($sql);
|
||||
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
|
||||
@@ -438,6 +442,35 @@ abstract class ModuleQuery extends ModelCriteria
|
||||
return $this->addUsingAlias(ModuleTableMap::POSITION, $position, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the full_namespace column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByFullNamespace('fooValue'); // WHERE full_namespace = 'fooValue'
|
||||
* $query->filterByFullNamespace('%fooValue%'); // WHERE full_namespace LIKE '%fooValue%'
|
||||
* </code>
|
||||
*
|
||||
* @param string $fullNamespace The value to use as filter.
|
||||
* Accepts wildcards (* and % trigger a LIKE)
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildModuleQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByFullNamespace($fullNamespace = null, $comparison = null)
|
||||
{
|
||||
if (null === $comparison) {
|
||||
if (is_array($fullNamespace)) {
|
||||
$comparison = Criteria::IN;
|
||||
} elseif (preg_match('/[\%\*]/', $fullNamespace)) {
|
||||
$fullNamespace = str_replace('*', '%', $fullNamespace);
|
||||
$comparison = Criteria::LIKE;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(ModuleTableMap::FULL_NAMESPACE, $fullNamespace, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the created_at column
|
||||
*
|
||||
|
||||
@@ -57,7 +57,7 @@ class ModuleTableMap extends TableMap
|
||||
/**
|
||||
* The total number of columns
|
||||
*/
|
||||
const NUM_COLUMNS = 7;
|
||||
const NUM_COLUMNS = 8;
|
||||
|
||||
/**
|
||||
* The number of lazy-loaded columns
|
||||
@@ -67,7 +67,7 @@ class ModuleTableMap extends TableMap
|
||||
/**
|
||||
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
|
||||
*/
|
||||
const NUM_HYDRATE_COLUMNS = 7;
|
||||
const NUM_HYDRATE_COLUMNS = 8;
|
||||
|
||||
/**
|
||||
* the column name for the ID field
|
||||
@@ -94,6 +94,11 @@ class ModuleTableMap extends TableMap
|
||||
*/
|
||||
const POSITION = 'module.POSITION';
|
||||
|
||||
/**
|
||||
* the column name for the FULL_NAMESPACE field
|
||||
*/
|
||||
const FULL_NAMESPACE = 'module.FULL_NAMESPACE';
|
||||
|
||||
/**
|
||||
* the column name for the CREATED_AT field
|
||||
*/
|
||||
@@ -125,12 +130,12 @@ class ModuleTableMap extends TableMap
|
||||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||
*/
|
||||
protected static $fieldNames = array (
|
||||
self::TYPE_PHPNAME => array('Id', 'Code', 'Type', 'Activate', 'Position', 'CreatedAt', 'UpdatedAt', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'code', 'type', 'activate', 'position', 'createdAt', 'updatedAt', ),
|
||||
self::TYPE_COLNAME => array(ModuleTableMap::ID, ModuleTableMap::CODE, ModuleTableMap::TYPE, ModuleTableMap::ACTIVATE, ModuleTableMap::POSITION, ModuleTableMap::CREATED_AT, ModuleTableMap::UPDATED_AT, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'CODE', 'TYPE', 'ACTIVATE', 'POSITION', 'CREATED_AT', 'UPDATED_AT', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'code', 'type', 'activate', 'position', 'created_at', 'updated_at', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, )
|
||||
self::TYPE_PHPNAME => array('Id', 'Code', 'Type', 'Activate', 'Position', 'FullNamespace', 'CreatedAt', 'UpdatedAt', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'code', 'type', 'activate', 'position', 'fullNamespace', 'createdAt', 'updatedAt', ),
|
||||
self::TYPE_COLNAME => array(ModuleTableMap::ID, ModuleTableMap::CODE, ModuleTableMap::TYPE, ModuleTableMap::ACTIVATE, ModuleTableMap::POSITION, ModuleTableMap::FULL_NAMESPACE, ModuleTableMap::CREATED_AT, ModuleTableMap::UPDATED_AT, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'CODE', 'TYPE', 'ACTIVATE', 'POSITION', 'FULL_NAMESPACE', 'CREATED_AT', 'UPDATED_AT', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'code', 'type', 'activate', 'position', 'full_namespace', 'created_at', 'updated_at', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, )
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -140,12 +145,12 @@ class ModuleTableMap extends TableMap
|
||||
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
|
||||
*/
|
||||
protected static $fieldKeys = array (
|
||||
self::TYPE_PHPNAME => array('Id' => 0, 'Code' => 1, 'Type' => 2, 'Activate' => 3, 'Position' => 4, 'CreatedAt' => 5, 'UpdatedAt' => 6, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'activate' => 3, 'position' => 4, 'createdAt' => 5, 'updatedAt' => 6, ),
|
||||
self::TYPE_COLNAME => array(ModuleTableMap::ID => 0, ModuleTableMap::CODE => 1, ModuleTableMap::TYPE => 2, ModuleTableMap::ACTIVATE => 3, ModuleTableMap::POSITION => 4, ModuleTableMap::CREATED_AT => 5, ModuleTableMap::UPDATED_AT => 6, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'CODE' => 1, 'TYPE' => 2, 'ACTIVATE' => 3, 'POSITION' => 4, 'CREATED_AT' => 5, 'UPDATED_AT' => 6, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'activate' => 3, 'position' => 4, 'created_at' => 5, 'updated_at' => 6, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, )
|
||||
self::TYPE_PHPNAME => array('Id' => 0, 'Code' => 1, 'Type' => 2, 'Activate' => 3, 'Position' => 4, 'FullNamespace' => 5, 'CreatedAt' => 6, 'UpdatedAt' => 7, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'activate' => 3, 'position' => 4, 'fullNamespace' => 5, 'createdAt' => 6, 'updatedAt' => 7, ),
|
||||
self::TYPE_COLNAME => array(ModuleTableMap::ID => 0, ModuleTableMap::CODE => 1, ModuleTableMap::TYPE => 2, ModuleTableMap::ACTIVATE => 3, ModuleTableMap::POSITION => 4, ModuleTableMap::FULL_NAMESPACE => 5, ModuleTableMap::CREATED_AT => 6, ModuleTableMap::UPDATED_AT => 7, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'CODE' => 1, 'TYPE' => 2, 'ACTIVATE' => 3, 'POSITION' => 4, 'FULL_NAMESPACE' => 5, 'CREATED_AT' => 6, 'UPDATED_AT' => 7, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'activate' => 3, 'position' => 4, 'full_namespace' => 5, 'created_at' => 6, 'updated_at' => 7, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, )
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -169,6 +174,7 @@ class ModuleTableMap extends TableMap
|
||||
$this->addColumn('TYPE', 'Type', 'TINYINT', true, null, null);
|
||||
$this->addColumn('ACTIVATE', 'Activate', 'TINYINT', false, null, null);
|
||||
$this->addColumn('POSITION', 'Position', 'INTEGER', false, null, null);
|
||||
$this->addColumn('FULL_NAMESPACE', 'FullNamespace', 'VARCHAR', false, 255, null);
|
||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
|
||||
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
|
||||
} // initialize()
|
||||
@@ -349,6 +355,7 @@ class ModuleTableMap extends TableMap
|
||||
$criteria->addSelectColumn(ModuleTableMap::TYPE);
|
||||
$criteria->addSelectColumn(ModuleTableMap::ACTIVATE);
|
||||
$criteria->addSelectColumn(ModuleTableMap::POSITION);
|
||||
$criteria->addSelectColumn(ModuleTableMap::FULL_NAMESPACE);
|
||||
$criteria->addSelectColumn(ModuleTableMap::CREATED_AT);
|
||||
$criteria->addSelectColumn(ModuleTableMap::UPDATED_AT);
|
||||
} else {
|
||||
@@ -357,6 +364,7 @@ class ModuleTableMap extends TableMap
|
||||
$criteria->addSelectColumn($alias . '.TYPE');
|
||||
$criteria->addSelectColumn($alias . '.ACTIVATE');
|
||||
$criteria->addSelectColumn($alias . '.POSITION');
|
||||
$criteria->addSelectColumn($alias . '.FULL_NAMESPACE');
|
||||
$criteria->addSelectColumn($alias . '.CREATED_AT');
|
||||
$criteria->addSelectColumn($alias . '.UPDATED_AT');
|
||||
}
|
||||
|
||||
@@ -803,6 +803,7 @@ CREATE TABLE `module`
|
||||
`type` TINYINT NOT NULL,
|
||||
`activate` TINYINT,
|
||||
`position` INTEGER,
|
||||
`full_namespace` VARCHAR(255),
|
||||
`created_at` DATETIME,
|
||||
`updated_at` DATETIME,
|
||||
PRIMARY KEY (`id`),
|
||||
|
||||
@@ -605,6 +605,7 @@
|
||||
<column name="description" type="CLOB" />
|
||||
<column name="chapo" type="LONGVARCHAR" />
|
||||
<column name="postscriptum" type="LONGVARCHAR" />
|
||||
<column name="full_namespace" size="255" type="VARCHAR" />
|
||||
<unique name="code_UNIQUE">
|
||||
<unique-column name="code" />
|
||||
</unique>
|
||||
|
||||
@@ -57,9 +57,10 @@ class Colissimo extends BaseModule implements DeliveryModuleInterface
|
||||
*
|
||||
* calculate and return delivery price
|
||||
*
|
||||
* @param null $country
|
||||
* @return mixed
|
||||
*/
|
||||
public function calculate()
|
||||
public function calculate($country = null)
|
||||
{
|
||||
// TODO: Implement calculate() method.
|
||||
return 2;
|
||||
|
||||
10
templates/default/delivery_list.html
Normal file
10
templates/default/delivery_list.html
Normal file
@@ -0,0 +1,10 @@
|
||||
{include file="includes/header.html"}
|
||||
|
||||
<ul>
|
||||
{loop type="delivery" name="delivery.list"}
|
||||
<li>id : #ID</li>
|
||||
<li>prix : #PRICE</li>
|
||||
{/loop}
|
||||
</ul>
|
||||
|
||||
{include file="includes/footer.html"}
|
||||
Reference in New Issue
Block a user