delivery process

This commit is contained in:
Etienne Roudeix
2013-09-16 15:24:08 +02:00
parent c7b3aea7f0
commit d8b5df4162
5 changed files with 39 additions and 16 deletions

View File

@@ -22,9 +22,12 @@
/*************************************************************************************/
namespace Thelia\Core\Template\Loop;
use Propel\Runtime\ActiveQuery\Criteria;
use Thelia\Core\Template\Element\LoopResult;
use Thelia\Core\Template\Element\LoopResultRow;
use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Model\CountryQuery;
use Thelia\Module\BaseModule;
/**
* Class Delivery
@@ -39,7 +42,7 @@ class Delivery extends BaseSpecificModule
$collection = parent::getArgDefinitions();
$collection->addArgument(
Argument::createIntTypeArgument("country")
Argument::createIntTypeArgument("country", null, true)
);
return $collection;
@@ -50,6 +53,14 @@ class Delivery extends BaseSpecificModule
$search = parent::exec($pagination);
/* manage translations */
$locale = $this->configureI18nProcessing($search);
$search->filterByType(BaseModule::DELIVERY_MODULE_TYPE, Criteria::EQUAL);
$country = $this->getCountry();
if(null !== $country) {
//@todo
}
/* perform search */
$deliveryModules = $this->search($search, $pagination);
@@ -73,7 +84,7 @@ class Delivery extends BaseSpecificModule
->set('CHAPO', $deliveryModule->getVirtualColumn('i18n_CHAPO'))
->set('DESCRIPTION', $deliveryModule->getVirtualColumn('i18n_DESCRIPTION'))
->set('POSTSCRIPTUM', $deliveryModule->getVirtualColumn('i18n_POSTSCRIPTUM'))
->set('PRICE', $moduleInstance->calculate($this->getCountry()))
->set('PRICE', $moduleInstance->calculate(CountryQuery::create()->findPk($country)))
;
$loopResult->addRow($loopResultRow);

View File

@@ -28,6 +28,9 @@ use Symfony\Component\DependencyInjection\ContainerAware;
abstract class BaseModule extends ContainerAware
{
const CLASSIC_MODULE_TYPE = 1;
const DELIVERY_MODULE_TYPE = 2;
const PAYMENT_MODULE_TYPE = 3;
public function __construct()
{

View File

@@ -28,7 +28,8 @@ INSERT INTO `config` (`name`, `value`, `secured`, `hidden`, `created_at`, `updat
INSERT INTO `module` (`id`, `code`, `type`, `activate`, `position`, `full_namespace`, `created_at`, `updated_at`) VALUES
(1, 'DebugBar', 1, 1, 1, 'DebugBar\\DebugBar', NOW(), NOW());
(1, 'DebugBar', 1, 1, 1, 'DebugBar\\DebugBar', NOW(), NOW()),
(2, 'Colissimo', 2, 1, 1, 'Colissimo\\Colissimo', NOW(), NOW());
INSERT INTO `customer_title`(`id`, `by_default`, `position`, `created_at`, `updated_at`) VALUES
(1, 1, 1, NOW(), NOW()),

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<database defaultIdMethod="native" name="thelia">
<table name="category" namespace="Thelia\Model">
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" />
@@ -80,6 +80,7 @@
<column name="description" type="CLOB" />
<column name="chapo" type="LONGVARCHAR" />
<column name="postscriptum" type="LONGVARCHAR" />
<column name="by_default" type="TINYINT" />
<foreign-key foreignTable="area" name="fk_country_area_id" onDelete="SET NULL" onUpdate="RESTRICT">
<reference foreign="id" local="area_id" />
</foreign-key>

View File

@@ -48,18 +48,29 @@
<td>
<ul class="list-address">
<li>
<span class="fn">M. DUPONT Jean</span>
<span class="org">Agency XY</span>
<span class="fn">{loop type="title" name="customer.title.info" id=$TITLE}{$SHORT}{/loop} {$LASTNAME|upper} {$FIRSTNAME|ucwords}</span>
<span class="org">{$COMPANY}</span>
</li>
<li>
<address class="adr">
<span class="street-address">street name of my business</span><br>
<span class="postal-code">75000</span>
<span class="locality">City, <span class="country-name">Country</span></span>
<span class="street-address">{$ADDRESS1}</span>
{if $ADDRESS2 != ""}
<br><span class="street-address">{$ADDRESS2}</span>
{/if}
{if $ADDRESS3 != ""}
<br><span class="street-address">{$ADDRESS3}</span>
{/if}
<br><span class="postal-code">{$ZIPCODE}</span>
<span class="locality">{$CITY}, <span class="country-name">{loop type="country" name="customer.country.info" id=$COUNTRY}{$TITLE}{/loop}</span></span>
</address>
</li>
<li>
<span class="tel">+33 09 08 07 06 05</span>
{if $CELLPHONE != ""}
<span class="tel">{$CELLPHONE}</span>
{/if}
{if $PHONE != ""}
<br><span class="tel">{$PHONE}</span>
{/if}
</li>
</ul>
</td>
@@ -83,18 +94,14 @@
<div id="delivery-method" class="panel">
<div class="panel-heading">Choose your delivery method</div>
<div class="panel-body">
{loop type="delivery" name="deliveries" force_return="true"}
<div class="radio">
<label for="delivery-method_1">
<input type="radio" name="delivery-method" id="delivery-method_1" value="1">
<strong>Delivery method #1</strong> / $12.50
</label>
</div>
<div class="radio">
<label for="delivery-method_2">
<input type="radio" name="delivery-method" id="delivery-method_2" value="2">
<strong>Delivery method #2</strong> / $6.00
</label>
</div>
{/loop}
</div>
</div>