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'),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user