diff --git a/src/Hanzo/Bundle/CheckoutBundle/SendOrderConfirmationMail.php b/src/Hanzo/Bundle/CheckoutBundle/SendOrderConfirmationMail.php index 3d7af6b29..255a937db 100644 --- a/src/Hanzo/Bundle/CheckoutBundle/SendOrderConfirmationMail.php +++ b/src/Hanzo/Bundle/CheckoutBundle/SendOrderConfirmationMail.php @@ -173,7 +173,7 @@ public function build(Orders $order) 'shipping_title' => $shippingTitle, 'shipping_cost' => $shippingCost, 'shipping_fee' => $shippingFee, - 'expected_at' => $order->getExpectedDeliveryDate('d-m-Y', true), + 'expected_at' => $order->getExpectedDeliveryDate('d-m-Y', $attributes->global->domain_key), 'username' => $order->getCustomers($this->dbConn)->getEmail(), 'password' => $order->getCustomers($this->dbConn)->getPasswordClear(), 'event_id' => $eventId, diff --git a/src/Hanzo/Model/Orders.php b/src/Hanzo/Model/Orders.php index 9cea5a564..e0e0d79b5 100644 --- a/src/Hanzo/Model/Orders.php +++ b/src/Hanzo/Model/Orders.php @@ -1208,27 +1208,35 @@ public function hasProduct($productId) * returns latest delivery date. * * @param string $format - * @param bool $override + * @param string $domainKey * * @throws Exception * @throws PropelException * @return mixed|string */ - public function getExpectedDeliveryDate($format = 'Y-m-d', $override = false) + public function getExpectedDeliveryDate($format = 'Y-m-d', $domainKey = false) { $now = date('Ymd'); $latest = 0; $expectedAt = ''; - if (false == $override) { + if (false === $domainKey) { $result = Hanzo::getInstance()->get('HD.expected_delivery_date'); $expectedAt = $result ?: ''; } else { - $setting = SettingsQuery::create() - ->filterByNs('HD') + $setting = DomainsSettingsQuery::create() + ->filterByDomainKey($domainKey) ->filterByCKey('expected_delivery_date') + ->filterByNs('HD') ->findOne($this->getDBConnection()); + if (empty($setting)) { + $setting = SettingsQuery::create() + ->filterByNs('HD') + ->filterByCKey('expected_delivery_date') + ->findOne($this->getDBConnection()); + } + if ($setting && $setting->getCValue()) { $expectedAt = $setting->getCValue(); } @@ -1245,6 +1253,7 @@ public function getExpectedDeliveryDate($format = 'Y-m-d', $override = false) return $expectedAt; } + /** * @param bool $v */