From d8b5df416214f83de2f047f4c2aeeb35003a1530 Mon Sep 17 00:00:00 2001 From: Etienne Roudeix Date: Mon, 16 Sep 2013 15:24:08 +0200 Subject: [PATCH] delivery process --- .../Thelia/Core/Template/Loop/Delivery.php | 15 +++++++-- core/lib/Thelia/Module/BaseModule.php | 3 ++ install/insert.sql | 3 +- local/config/schema.xml | 3 +- templates/default/cart_billing.html | 31 ++++++++++++------- 5 files changed, 39 insertions(+), 16 deletions(-) diff --git a/core/lib/Thelia/Core/Template/Loop/Delivery.php b/core/lib/Thelia/Core/Template/Loop/Delivery.php index a0e9ebb7a..b679e5061 100644 --- a/core/lib/Thelia/Core/Template/Loop/Delivery.php +++ b/core/lib/Thelia/Core/Template/Loop/Delivery.php @@ -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); diff --git a/core/lib/Thelia/Module/BaseModule.php b/core/lib/Thelia/Module/BaseModule.php index 9d76e08f3..a13403482 100755 --- a/core/lib/Thelia/Module/BaseModule.php +++ b/core/lib/Thelia/Module/BaseModule.php @@ -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() { diff --git a/install/insert.sql b/install/insert.sql index 03fbc690c..a49dc7231 100755 --- a/install/insert.sql +++ b/install/insert.sql @@ -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()), diff --git a/local/config/schema.xml b/local/config/schema.xml index 49a76ebed..186bdbfd6 100755 --- a/local/config/schema.xml +++ b/local/config/schema.xml @@ -1,4 +1,4 @@ - + @@ -80,6 +80,7 @@ + diff --git a/templates/default/cart_billing.html b/templates/default/cart_billing.html index d44753e48..8720bf696 100644 --- a/templates/default/cart_billing.html +++ b/templates/default/cart_billing.html @@ -48,18 +48,29 @@ @@ -83,18 +94,14 @@
Choose your delivery method
+ {loop type="delivery" name="deliveries" force_return="true"}
-
- -
+ {/loop}
  • - M. DUPONT Jean - Agency XY + {loop type="title" name="customer.title.info" id=$TITLE}{$SHORT}{/loop} {$LASTNAME|upper} {$FIRSTNAME|ucwords} + {$COMPANY}
  • - street name of my business
    - 75000 - City, Country + {$ADDRESS1} + {if $ADDRESS2 != ""} +
    {$ADDRESS2} + {/if} + {if $ADDRESS3 != ""} +
    {$ADDRESS3} + {/if} +
    {$ZIPCODE} + {$CITY}, {loop type="country" name="customer.country.info" id=$COUNTRY}{$TITLE}{/loop}
  • - +33 09 08 07 06 05 + {if $CELLPHONE != ""} + {$CELLPHONE} + {/if} + {if $PHONE != ""} +
    {$PHONE} + {/if}