delivery process
This commit is contained in:
@@ -42,7 +42,7 @@ class Delivery extends BaseSpecificModule
|
||||
$collection = parent::getArgDefinitions();
|
||||
|
||||
$collection->addArgument(
|
||||
Argument::createIntTypeArgument("country", null, true)
|
||||
Argument::createIntTypeArgument("country")
|
||||
);
|
||||
|
||||
return $collection;
|
||||
@@ -56,9 +56,14 @@ class Delivery extends BaseSpecificModule
|
||||
|
||||
$search->filterByType(BaseModule::DELIVERY_MODULE_TYPE, Criteria::EQUAL);
|
||||
|
||||
$country = $this->getCountry();
|
||||
if(null !== $country) {
|
||||
//@todo
|
||||
$countryId = $this->getCountry();
|
||||
if(null !== $countryId) {
|
||||
$country = CountryQuery::create()->findPk($countryId);
|
||||
if(null === $country) {
|
||||
throw new \InvalidArgumentException('Cannot found country id: `' . $countryId . '` in delivery loop');
|
||||
}
|
||||
} else {
|
||||
$country = CountryQuery::create()->findOneByByDefault(1);
|
||||
}
|
||||
|
||||
/* perform search */
|
||||
@@ -84,7 +89,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(CountryQuery::create()->findPk($country)))
|
||||
->set('PRICE', $moduleInstance->calculate($country))
|
||||
;
|
||||
|
||||
$loopResult->addRow($loopResultRow);
|
||||
|
||||
@@ -115,7 +115,7 @@ class ProductSaleElements extends BaseLoop
|
||||
|
||||
$currencyId = $this->getCurrency();
|
||||
if (null !== $currencyId) {
|
||||
$currency = CurrencyQuery::create()->findOneById($currencyId);
|
||||
$currency = CurrencyQuery::create()->findPk($currencyId);
|
||||
if (null === $currency) {
|
||||
throw new \InvalidArgumentException('Cannot found currency id: `' . $currency . '` in product_sale_elements loop');
|
||||
}
|
||||
|
||||
@@ -155,6 +155,16 @@ class DataAccessFunctions extends AbstractSmartyPlugin
|
||||
}
|
||||
}
|
||||
|
||||
public function countryDataAccess($params, $smarty)
|
||||
{
|
||||
$defaultCountry = CountryQuery::create()->findOneByByDefault(1);
|
||||
|
||||
switch($params["attr"]) {
|
||||
case "default":
|
||||
return $defaultCountry->getId();
|
||||
}
|
||||
}
|
||||
|
||||
public function cartDataAccess($params, $smarty)
|
||||
{
|
||||
$cart = $this->getCart($this->request);
|
||||
@@ -287,6 +297,7 @@ class DataAccessFunctions extends AbstractSmartyPlugin
|
||||
new SmartyPluginDescriptor('function', 'content', $this, 'contentDataAccess'),
|
||||
new SmartyPluginDescriptor('function', 'folder', $this, 'folderDataAccess'),
|
||||
new SmartyPluginDescriptor('function', 'currency', $this, 'currencyDataAccess'),
|
||||
new SmartyPluginDescriptor('function', 'country', $this, 'countryDataAccess'),
|
||||
new SmartyPluginDescriptor('function', 'lang', $this, 'langDataAccess'),
|
||||
new SmartyPluginDescriptor('function', 'cart', $this, 'cartDataAccess'),
|
||||
);
|
||||
|
||||
@@ -31,6 +31,11 @@ INSERT INTO `module` (`id`, `code`, `type`, `activate`, `position`, `full_namesp
|
||||
(1, 'DebugBar', 1, 1, 1, 'DebugBar\\DebugBar', NOW(), NOW()),
|
||||
(2, 'Colissimo', 2, 1, 1, 'Colissimo\\Colissimo', NOW(), NOW());
|
||||
|
||||
INSERT INTO `thelia_2`.`module_i18n` (`id`, `locale`, `title`, `description`, `chapo`, `postscriptum`) VALUES
|
||||
('2', 'en_US', '72h delivery', NULL, NULL, NULL),
|
||||
('2', 'fr_FR', 'Livraison par colissimo en 72h', NULL, NULL, NULL);
|
||||
|
||||
|
||||
INSERT INTO `customer_title`(`id`, `by_default`, `position`, `created_at`, `updated_at`) VALUES
|
||||
(1, 1, 1, NOW(), NOW()),
|
||||
(2, 0, 2, NOW(), NOW()),
|
||||
@@ -44,13 +49,13 @@ INSERT INTO `customer_title_i18n` (`id`, `locale`, `short`, `long`) VALUES
|
||||
(3, 'fr_FR', 'Mlle', 'Madamemoiselle'),
|
||||
(3, 'en_US', 'Miss', 'Miss');
|
||||
|
||||
INSERT INTO `currency` (`id` ,`code` ,`symbol` ,`rate`, `position` ,`by_default` ,`created_at` ,`updated_at`)
|
||||
INSERT INTO `currency` (`id`, `code`, `symbol`, `rate`, `position`, `by_default`, `created_at`, `updated_at`)
|
||||
VALUES
|
||||
(1, 'EUR', '€', '1', 1, '1', NOW() , NOW()),
|
||||
(1, 'EUR', '€', '1', 1, '1', NOW(), NOW()),
|
||||
(2, 'USD', '$', '1.26', 2, '0', NOW(), NOW()),
|
||||
(3, 'GBP', '£', '0.89', 3, '0', NOW(), NOW());
|
||||
|
||||
INSERT INTO `currency_i18n` (`id` ,`locale` ,`name`)
|
||||
INSERT INTO `currency_i18n` (`id`, `locale`, `name`)
|
||||
VALUES
|
||||
(1, 'fr_FR', 'Euro'),
|
||||
(1, 'en_US', 'Euro'),
|
||||
|
||||
@@ -25,6 +25,73 @@
|
||||
</div>
|
||||
|
||||
<form id="form-cart-delivery" action="cart-step3.php" method="post" role="form">
|
||||
|
||||
<div id="billing-address" class="panel">
|
||||
<div class="panel-heading clearfix">
|
||||
<a href="{url path="/address/create"}" class="btn btn-add-address">Add a new address</a>
|
||||
Chose your billing address
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<table class="table table-address" role="presentation" summary="Address Books">
|
||||
<tbody>
|
||||
|
||||
{loop type="address" name="customer.addresses" customer="current"}
|
||||
|
||||
<tr>
|
||||
<th>
|
||||
<div class="radio">
|
||||
<label for="billing-address_<?php echo $count; ?>">
|
||||
<input type="radio" name="billing-address" value"{$ID}">
|
||||
{$LABEL}
|
||||
</label>
|
||||
</div>
|
||||
</th>
|
||||
<td>
|
||||
<ul class="list-address">
|
||||
<li>
|
||||
<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">{$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>
|
||||
{if $CELLPHONE != ""}
|
||||
<span class="tel">{$CELLPHONE}</span>
|
||||
{/if}
|
||||
{if $PHONE != ""}
|
||||
<br><span class="tel">{$PHONE}</span>
|
||||
{/if}
|
||||
</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div class="group-btn">
|
||||
<a href="{url path="/address/update/{$ID}"}" class="btn btn-edit-address" data-toggle="tooltip" title="Edit this address"><i class="icon-pencil"></i> <span>{intl l="Edit"}</span></a>
|
||||
{if $DEFAULT != 1}
|
||||
<a href="{url path="/address/delete/{$ID}"}" class="btn btn-remove-address js-remove-address" title="{intl l="Remove this address"}" data-toggle="tooltip"><i class="icon-remove"></i> <span>{intl l="Cancel"}</span></a>
|
||||
{/if}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
{/loop}
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="delivery-address" class="panel">
|
||||
<div class="panel-heading clearfix">
|
||||
<a href="{url path="/address/create"}" class="btn btn-add-address">Add a new address</a>
|
||||
@@ -98,7 +165,7 @@
|
||||
<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
|
||||
<strong>{$TITLE}</strong> / {currency attr="symbol"} {$PRICE}
|
||||
</label>
|
||||
</div>
|
||||
{/loop}
|
||||
|
||||
Reference in New Issue
Block a user