sanitize SMS messages,
add active switches for finishedOrder, canceledOrder, sendedOrder add message example content
This commit is contained in:
parent
9bc3576919
commit
fc43a4ade1
@ -47,8 +47,6 @@ class AdminOrder extends AdminController
|
||||
$this->order = $order = oxNew(Order::class);
|
||||
$order->load($this->getEditObjectId());
|
||||
|
||||
$this->sms = oxNew(Sms::class);
|
||||
|
||||
$this->addTplParam('recipient', $this->getRecipientFromCurrentOrder());
|
||||
|
||||
parent::__construct();
|
||||
@ -87,9 +85,9 @@ class AdminOrder extends AdminController
|
||||
$order->load($this->getEditObjectId());
|
||||
|
||||
try {
|
||||
$sms = oxNew( Sms::class );
|
||||
if ( $sms->sendOrderMessage( $order, $messageBody ) ) {
|
||||
$this->setRemark( $sms->getRecipientsList(), $messageBody );
|
||||
$sms = oxNew( Sms::class, $messageBody );
|
||||
if ( $sms->sendOrderMessage( $order ) ) {
|
||||
$this->setRemark( $sms->getRecipientsList(), $sms->getMessage() );
|
||||
Registry::getUtilsView()->addErrorToDisplay(
|
||||
oxNew(successfullySentException::class, $sms->getResponse()->getSmsCount() )
|
||||
);
|
||||
|
@ -46,8 +46,6 @@ class AdminUser extends AdminController
|
||||
$this->user = $user = oxNew(User::class);
|
||||
$user->load($this->getEditObjectId());
|
||||
|
||||
$this->sms = oxNew(Sms::class);
|
||||
|
||||
$this->addTplParam('recipient', $this->getRecipientFromCurrentUser());
|
||||
|
||||
parent::__construct();
|
||||
@ -85,9 +83,9 @@ class AdminUser extends AdminController
|
||||
$user = oxNew(User::class);
|
||||
$user->load($this->getEditObjectId());
|
||||
|
||||
$sms = oxNew(Sms::class);
|
||||
if ($sms->sendUserAccountMessage($user, $messageBody)) {
|
||||
$this->setRemark( $sms->getRecipientsList(), $messageBody );
|
||||
$sms = oxNew(Sms::class, $messageBody);
|
||||
if ($sms->sendUserAccountMessage($user)) {
|
||||
$this->setRemark( $sms->getRecipientsList(), $sms->getMessage() );
|
||||
Registry::getUtilsView()->addErrorToDisplay(
|
||||
sprintf(
|
||||
Registry::getLang()->translateString('D3LM_EXC_SMS_SUCC_SENT'),
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
namespace D3\Linkmobility4OXID\Application\Model;
|
||||
|
||||
use D3\Linkmobility4OXID\Application\Controller\Admin\AdminUser;
|
||||
use D3\Linkmobility4OXID\Application\Model\Exceptions\noRecipientFoundException;
|
||||
use D3\LinkmobilityClient\Client;
|
||||
use D3\LinkmobilityClient\Request\RequestInterface;
|
||||
@ -32,18 +33,45 @@ class MessageSender
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function sendOrderMessage(Order $order, $messageBody)
|
||||
public function sendOrderFinishedMessage(Order $order, $messageBody)
|
||||
{
|
||||
if (false === (bool) Registry::getConfig()->getConfigParam('d3linkmobility_orderActive') ||
|
||||
trim(strlen($messageBody)) < 1
|
||||
$this->sendMessageByOrder('d3linkmobility_orderActive', $order, $messageBody);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Order $order
|
||||
* @param $messageBody
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function sendSendedNowMessage(Order $order, $messageBody)
|
||||
{
|
||||
$this->sendMessageByOrder('d3linkmobility_sendedNowActive', $order, $messageBody);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Order $order
|
||||
* @param $messageBody
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function sendCancelOrderMessage(Order $order, $messageBody)
|
||||
{
|
||||
$this->sendMessageByOrder('d3linkmobility_cancelOrderActive', $order, $messageBody);
|
||||
}
|
||||
|
||||
public function sendMessageByOrder($configParam, Order $order, $messageBody)
|
||||
{
|
||||
if (false === (bool) Registry::getConfig()->getConfigParam($configParam)
|
||||
|| (bool) strlen(trim($messageBody)) === false
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
$sms = oxNew( Sms::class );
|
||||
if ( $sms->sendOrderMessage( $order, $messageBody ) ) {
|
||||
$this->setRemark( $order->getId(), $messageBody );
|
||||
$sms = oxNew( Sms::class, $messageBody );
|
||||
if ( $sms->sendOrderMessage( $order ) ) {
|
||||
$this->setRemark( $order->getId(), $sms->getRecipientsList(), $sms->getMessage() );
|
||||
}
|
||||
} catch (noRecipientFoundException $e) {}
|
||||
}
|
||||
@ -54,23 +82,14 @@ class MessageSender
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function setRemark($orderId, $message)
|
||||
protected function setRemark($orderId, $recipients, $message)
|
||||
{
|
||||
$remark = oxNew( Remark::class );
|
||||
$remark->assign( [
|
||||
'oxtype' => 'LMSMS',
|
||||
'oxtype' => AdminUser::REMARK_IDENT,
|
||||
'oxparentid' => $orderId,
|
||||
'oxtext' => $message
|
||||
'oxtext' => $recipients.PHP_EOL.$message
|
||||
] );
|
||||
$remark->save();
|
||||
}
|
||||
|
||||
public function sendContactMessage($email, $subject, $message)
|
||||
{
|
||||
$lmClient = oxNew(Client::class, 'token');
|
||||
$request = oxNew(Request::class, oxNew(Sender::class, 'sender'), oxNew(SmsMessage::class, $message));
|
||||
$request->setMethod(RequestInterface::METHOD_POST);
|
||||
$response = $lmClient->request($request);
|
||||
dumpvar($response);
|
||||
}
|
||||
}
|
@ -32,19 +32,25 @@ class Sms
|
||||
{
|
||||
private $response;
|
||||
private $recipients = [];
|
||||
private $message;
|
||||
protected $removeLineBreaks = true;
|
||||
protected $removeMultipleSpaces = true;
|
||||
|
||||
public function __construct(string $message)
|
||||
{
|
||||
$this->message = $this->sanitizeMessage($message);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
* @param $message
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function sendUserAccountMessage(User $user, $message): bool
|
||||
public function sendUserAccountMessage(User $user): bool
|
||||
{
|
||||
try {
|
||||
return $this->sendCustomRecipientMessage(
|
||||
[ oxNew( UserRecipients::class, $user )->getSmsRecipient() ],
|
||||
$message
|
||||
[ oxNew( UserRecipients::class, $user )->getSmsRecipient() ]
|
||||
);
|
||||
} catch (noRecipientFoundException $e) {
|
||||
Registry::getLogger()->warning($e->getMessage());
|
||||
@ -56,12 +62,11 @@ class Sms
|
||||
|
||||
/**
|
||||
* @param Order $order
|
||||
* @param $message
|
||||
*
|
||||
* @return bool
|
||||
* @throws noRecipientFoundException
|
||||
*/
|
||||
public function sendOrderMessage(Order $order, $message): bool
|
||||
public function sendOrderMessage(Order $order): bool
|
||||
{
|
||||
try {
|
||||
oxNew( OrderRecipients::class, $order )->getSmsRecipient();
|
||||
@ -72,8 +77,7 @@ class Sms
|
||||
try {
|
||||
Registry::getLogger()->debug('startRequest', ['orderId' => $order->getId()]);
|
||||
$return = $this->sendCustomRecipientMessage(
|
||||
[ oxNew( OrderRecipients::class, $order )->getSmsRecipient() ],
|
||||
$message
|
||||
[ oxNew( OrderRecipients::class, $order )->getSmsRecipient() ]
|
||||
);
|
||||
Registry::getLogger()->debug('finishRequest', ['orderId' => $order->getId()]);
|
||||
return $return;
|
||||
@ -85,18 +89,17 @@ class Sms
|
||||
|
||||
/**
|
||||
* @param array $recipientsArray
|
||||
* @param $message
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function sendCustomRecipientMessage(array $recipientsArray, $message): bool
|
||||
public function sendCustomRecipientMessage(array $recipientsArray): bool
|
||||
{
|
||||
try {
|
||||
$this->setRecipients($recipientsArray);
|
||||
$configuration = oxNew( Configuration::class );
|
||||
$client = oxNew( MessageClient::class )->getClient();
|
||||
|
||||
$request = oxNew( RequestFactory::class, $message, $client )->getSmsRequest();
|
||||
$request = oxNew( RequestFactory::class, $this->getMessage(), $client )->getSmsRequest();
|
||||
$request->setTestMode( $configuration->getTestMode() )->setMethod( RequestInterface::METHOD_POST )->setSenderAddress( oxNew( Sender::class, $configuration->getSmsSenderNumber(), $configuration->getSmsSenderCountry() ) )->setSenderAddressType( RequestInterface::SENDERADDRESSTYPE_INTERNATIONAL );
|
||||
|
||||
$recipientsList = $request->getRecipientsList();
|
||||
@ -149,4 +152,22 @@ class Sms
|
||||
|
||||
return implode(', ', $list);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $message
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function sanitizeMessage($message) : string
|
||||
{
|
||||
$message = trim(strip_tags($message));
|
||||
$message = $this->removeLineBreaks ? str_replace(["\r", "\n"], ' ', $message) : $message;
|
||||
$regexp = '/\s{2,}/m';
|
||||
return $this->removeMultipleSpaces ? preg_replace($regexp, ' ', $message) : $message;
|
||||
}
|
||||
|
||||
public function getMessage() : string
|
||||
{
|
||||
return $this->message;
|
||||
}
|
||||
}
|
@ -23,7 +23,7 @@ $aLang = [
|
||||
'charset' => 'UTF-8',
|
||||
|
||||
'SHOP_MODULE_GROUP_d3linkmobility_general' => 'Grundeinstellungen',
|
||||
'SHOP_MODULE_d3linkmobility_debug' => 'Debug-Modus',
|
||||
'SHOP_MODULE_d3linkmobility_debug' => 'Test-Modus',
|
||||
'HELP_SHOP_MODULE_d3linkmobility_debug' => 'Mit aktiviertem Test-Modus wird Linkmobility die Nachrichten nicht versenden. Die Anfrage wird jedoch verarbeitet und liefert eine Systemantwort zurück.',
|
||||
'SHOP_MODULE_d3linkmobility_apitoken' => 'API-Token',
|
||||
'HELP_SHOP_MODULE_d3linkmobility_apitoken' => 'Den API-Token generieren Sie sich bitte in Ihrem Linkmobility-Konto.',
|
||||
@ -40,6 +40,11 @@ $aLang = [
|
||||
|
||||
'SHOP_MODULE_GROUP_d3linkmobility_trigger' => 'Nachrichtenversand bei ...',
|
||||
'SHOP_MODULE_d3linkmobility_orderActive' => 'abgeschlossener Bestellung',
|
||||
'HELP_SHOP_MODULE_d3linkmobility_orderActive' => 'Wurde eine Bestellung im Frontend erfolgreich abgeschlossen, wird zum Versand der Bestellbestätigungsmail an den Kunden auch die SMS-Nachricht verschickt. Den Inhalt der SMS-Benachrichtigung finden Sie im Template "Application/views/tpl/SMS/order_cust.tpl".',
|
||||
'SHOP_MODULE_d3linkmobility_sendedNowActive' => 'Benachrichtigung über Versand',
|
||||
'HELP_SHOP_MODULE_d3linkmobility_sendedNowActive' => 'Wird im Shopbackend das Versanddatum gesetzt und dieses per Mail an den Kunden mitgeteilt (separate Checkbox), erfolgt gleichermaßen die Information via SMS. Den Inhalt der SMS-Benachrichtigung finden Sie im Template "Application/views/tpl/SMS/sendednow.tpl".',
|
||||
'SHOP_MODULE_d3linkmobility_cancelOrderActive' => 'Bestellstornierung',
|
||||
'HELP_SHOP_MODULE_d3linkmobility_cancelOrderActive' => 'Beim Stornieren der Bestellung erhält der Kunde eine Information per SMS. Den Inhalt der SMS-Benachrichtigung finden Sie im Template "Application/views/tpl/SMS/ordercanceled.tpl".',
|
||||
|
||||
'D3LM_ADMIN_USER_RECIPIENT' => 'Empfängernummer',
|
||||
'D3LM_ADMIN_USER_MESSAGE' => 'Nachricht',
|
||||
|
@ -1,236 +1,7 @@
|
||||
Vielen Dank für Ihre Bestellung!
|
||||
[{assign var="shop" value=$oEmailView->getShop()}]
|
||||
|
||||
[{*
|
||||
[{assign var="shop" value=$oEmailView->getShop()}]
|
||||
[{assign var="oViewConf" value=$oEmailView->getViewConfig()}]
|
||||
[{assign var="currency" value=$oEmailView->getCurrency()}]
|
||||
[{assign var="user" value=$oEmailView->getUser()}]
|
||||
[{assign var="oDelSet" value=$order->getDelSet()}]
|
||||
[{assign var="basket" value=$order->getBasket()}]
|
||||
[{assign var="payment" value=$order->getPayment()}]
|
||||
[{assign var="sOrderId" value=$order->getId()}]
|
||||
[{assign var="oOrderFileList" value=$oEmailView->getOrderFileList($sOrderId)}]
|
||||
Hallo [{$order->getFieldData('oxbillfname')}] [{$order->getFieldData('oxbilllname')}],
|
||||
|
||||
[{block name="email_plain_order_cust_orderemail"}]
|
||||
[{if $payment->oxuserpayments__oxpaymentsid->value == "oxempty"}]
|
||||
[{oxcontent ident="oxuserordernpplainemail"}]
|
||||
[{else}]
|
||||
[{oxcontent ident="oxuserorderplainemail"}]
|
||||
[{/if}]
|
||||
[{/block}]
|
||||
vielen Dank für Ihre Bestellung. Wir haben diese unter der Bestellnummer [{$order->oxorder__oxordernr->value}] angelegt und werden diese schnellstmöglich bearbeiten.
|
||||
|
||||
[{oxmultilang ident="ORDER_NUMBER"}] [{$order->oxorder__oxordernr->value}]
|
||||
|
||||
[{assign var="basketitemlist" value=$basket->getBasketArticles()}]
|
||||
[{foreach key=basketindex from=$basket->getContents() item=basketitem}]
|
||||
[{block name="email_plain_order_cust_basketitem"}]
|
||||
[{assign var="basketproduct" value=$basketitemlist.$basketindex}]
|
||||
[{block name="email_plain_order_cust_title"}][{$basketproduct->oxarticles__oxtitle->getRawValue()|strip_tags}][{if $basketproduct->oxarticles__oxvarselect->value}], [{$basketproduct->oxarticles__oxvarselect->value}][{/if}][{/block}]
|
||||
[{block name="email_plain_order_cust_sellist"}][{if $basketitem->getChosenSelList()}][{foreach from=$basketitem->getChosenSelList() item=oList}]
|
||||
|
||||
[{$oList->name}] [{$oList->value}]
|
||||
|
||||
[{/foreach}][{/if}][{/block}]
|
||||
[{block name="email_plain_order_cust_persparams"}][{if $basketitem->getPersParams()}]
|
||||
[{foreach key=sVar from=$basketitem->getPersParams() item=aParam}]
|
||||
|
||||
[{$sVar}] : [{$aParam}]
|
||||
[{/foreach}]
|
||||
[{/if}][{/block}]
|
||||
[{if $oViewConf->getShowGiftWrapping()}]
|
||||
[{assign var="oWrapping" value=$basketitem->getWrapping()}]
|
||||
|
||||
[{oxmultilang ident="GIFT_WRAPPING"}] [{if !$basketitem->getWrappingId()}][{oxmultilang ident="NONE"}][{else}][{$oWrapping->oxwrapping__oxname->value}][{/if}]
|
||||
[{/if}]
|
||||
[{block name="email_plain_order_cust_orderinfo"}][{if $basketproduct->oxarticles__oxorderinfo->value}]
|
||||
[{$basketproduct->oxarticles__oxorderinfo->getRawValue()}]
|
||||
[{/if}][{/block}]
|
||||
|
||||
[{assign var=dRegUnitPrice value=$basketitem->getRegularUnitPrice()}]
|
||||
[{assign var=dUnitPrice value=$basketitem->getUnitPrice()}]
|
||||
[{block name="email_plain_order_cust_unitprice"}][{oxmultilang ident="UNIT_PRICE"}] [{$basketitem->getFUnitPrice()}] [{$currency->name}] [{if !$basketitem->isBundle()}][{if $dRegUnitPrice->getPrice() > $dUnitPrice->getPrice()}] ([{$basketitem->getFRegularUnitPrice()}] [{$currency->sign}]) [{/if}][{/if}][{/block}]
|
||||
|
||||
[{block name="email_plain_order_cust_amount"}][{oxmultilang ident="QUANTITY"}] [{$basketitem->getAmount()}][{/block}]
|
||||
[{block name="email_plain_order_cust_vat"}][{oxmultilang ident="VAT"}] [{$basketitem->getVatPercent()}]%[{/block}]
|
||||
[{block name="email_plain_order_cust_price"}][{oxmultilang ident="TOTAL"}] [{$basketitem->getFTotalPrice()}] [{$currency->name}][{/block}]
|
||||
[{/block}]
|
||||
[{/foreach}]
|
||||
------------------------------------------------------------------
|
||||
[{if !$basket->getDiscounts()}]
|
||||
[{block name="email_plain_order_cust_nodiscounttotalnet"}]
|
||||
[{oxmultilang ident="TOTAL_NET"}] [{$basket->getProductsNetPrice()}] [{$currency->name}]
|
||||
[{/block}]
|
||||
[{block name="email_plain_order_cust_nodiscountproductvats"}]
|
||||
[{foreach from=$basket->getProductVats() item=VATitem key=key}]
|
||||
[{oxmultilang ident="VAT_PLUS_PERCENT_AMOUNT" suffix="COLON" args=$key}] [{$VATitem}] [{$currency->name}]
|
||||
[{/foreach}]
|
||||
[{/block}]
|
||||
[{block name="email_plain_order_cust_nodiscounttotalgross"}]
|
||||
[{oxmultilang ident="TOTAL_GROSS"}] [{$basket->getFProductsPrice()}] [{$currency->name}]
|
||||
[{/block}]
|
||||
[{/if}]
|
||||
[{if $basket->getDiscounts()}]
|
||||
[{if $order->isNettoMode()}]
|
||||
[{block name="email_plain_order_ownerdiscounttotalnet"}]
|
||||
[{oxmultilang ident="TOTAL_NET"}] [{$basket->getProductsNetPrice()}] [{$currency->name}]
|
||||
[{/block}]
|
||||
[{else}]
|
||||
[{block name="email_plain_order_discountownertotalgross"}]
|
||||
[{oxmultilang ident="TOTAL_GROSS"}] [{$basket->getFProductsPrice()}] [{$currency->name}]
|
||||
[{/block}]
|
||||
[{/if}]
|
||||
[{block name="email_plain_order_cust_discounts"}]
|
||||
[{foreach from=$basket->getDiscounts() item=oDiscount}]
|
||||
[{if $oDiscount->dDiscount < 0}][{oxmultilang ident="SURCHARGE"}][{else}][{oxmultilang ident="DISCOUNT"}][{/if}] [{$oDiscount->sDiscount}]: [{if $oDiscount->dDiscount < 0}][{$oDiscount->fDiscount|replace:"-":""}][{else}]-[{$oDiscount->fDiscount}][{/if}] [{$currency->name}]
|
||||
[{/foreach}]
|
||||
[{/block}]
|
||||
[{if !$order->isNettoMode()}]
|
||||
[{block name="email_plain_order_cust_totalnet"}]
|
||||
[{oxmultilang ident="TOTAL_NET"}] [{$basket->getProductsNetPrice()}] [{$currency->name}]
|
||||
[{/block}]
|
||||
[{/if}]
|
||||
[{block name="email_plain_order_cust_productvats"}]
|
||||
[{foreach from=$basket->getProductVats() item=VATitem key=key}]
|
||||
[{oxmultilang ident="VAT_PLUS_PERCENT_AMOUNT" suffix="COLON" args=$key}] [{$VATitem}] [{$currency->name}]
|
||||
[{/foreach}]
|
||||
[{/block}]
|
||||
[{/if}]
|
||||
[{if $order->isNettoMode()}]
|
||||
[{block name="email_plain_order_ownertotalgross"}]
|
||||
[{oxmultilang ident="TOTAL_GROSS"}] [{$basket->getFProductsPrice()}] [{$currency->name}]
|
||||
[{/block}]
|
||||
[{/if}]
|
||||
[{block name="email_plain_order_cust_voucherdiscount"}]
|
||||
[{if $oViewConf->getShowVouchers() && $basket->getVoucherDiscValue()}]
|
||||
[{oxmultilang ident="COUPON"}] [{if $basket->getFVoucherDiscountValue() > 0}]-[{/if}][{$basket->getFVoucherDiscountValue()|replace:"-":""}] [{$currency->name}]
|
||||
[{/if}]
|
||||
[{/block}]
|
||||
|
||||
[{block name="email_plain_order_cust_delcosts"}]
|
||||
[{if $basket->getDelCostNet()}]
|
||||
[{oxmultilang ident="SHIPPING_NET" suffix="COLON"}] [{$basket->getDelCostNet()}] [{$currency->sign}]
|
||||
[{if $basket->getDelCostVat()}] [{oxmultilang ident="BASKET_TOTAL_PLUS_PROPORTIONAL_VAT"}] [{else}] [{oxmultilang ident="VAT_PLUS_PERCENT_AMOUNT" suffix="COLON" args=$basket->getDelCostVatPercent()}][{/if}] [{$basket->getDelCostVat()}] [{$currency->sign}]
|
||||
[{elseif $basket->getFDeliveryCosts()}]
|
||||
[{oxmultilang ident="SHIPPING_COST"}] [{$basket->getFDeliveryCosts()}] [{$currency->sign}]
|
||||
[{/if}]
|
||||
[{/block}]
|
||||
|
||||
[{block name="email_plain_order_cust_paymentcosts"}]
|
||||
[{if $basket->getPayCostNet()}]
|
||||
[{if $basket->getPaymentCosts() >= 0}][{oxmultilang ident="SURCHARGE"}][{else}][{oxmultilang ident="DEDUCTION"}][{/if}] [{oxmultilang ident="PAYMENT_METHOD"}] [{$basket->getPayCostNet()}] [{$currency->sign}]
|
||||
[{if $basket->getPayCostVat()}]
|
||||
[{if $basket->isProportionalCalculationOn()}] [{oxmultilang ident="BASKET_TOTAL_PLUS_PROPORTIONAL_VAT"}][{else}] [{oxmultilang ident="VAT_PLUS_PERCENT_AMOUNT" suffix="COLON" args=$basket->getPayCostVatPercent()}][{/if}] [{$basket->getPayCostVat()}] [{$currency->sign}]
|
||||
[{/if}]
|
||||
[{elseif $basket->getFPaymentCosts()}]
|
||||
[{oxmultilang ident="SURCHARGE"}] [{$basket->getFPaymentCosts()}] [{$currency->sign}]
|
||||
[{/if}]
|
||||
[{/block}]
|
||||
|
||||
[{block name="email_plain_order_cust_wrappingcosts"}]
|
||||
[{if $oViewConf->getShowGiftWrapping()}]
|
||||
[{if $basket->getWrappCostNet()}]
|
||||
[{oxmultilang ident="BASKET_TOTAL_WRAPPING_COSTS_NET"}] [{$basket->getWrappCostNet()}] [{$currency->sign}]
|
||||
[{if $basket->getWrappCostVat()}]
|
||||
[{oxmultilang ident="PLUS_VAT"}] [{$basket->getWrappCostVat()}] [{$currency->sign}]
|
||||
[{/if}]
|
||||
[{elseif $basket->getFWrappingCosts()}]
|
||||
[{oxmultilang ident="GIFT_WRAPPING"}] [{$basket->getFWrappingCosts()}] [{$currency->sign}]
|
||||
[{/if}]
|
||||
[{/if}]
|
||||
[{/block}]
|
||||
|
||||
[{block name="email_plain_order_cust_giftwrapping"}]
|
||||
[{if $oViewConf->getShowGiftWrapping()}]
|
||||
[{if $basket->getGiftCardCostNet()}]
|
||||
[{oxmultilang ident="BASKET_TOTAL_GIFTCARD_COSTS_NET"}] [{$basket->getGiftCardCostNet()}] [{$currency->sign}]
|
||||
[{if $basket->getGiftCardCostVat()}]
|
||||
[{if $basket->isProportionalCalculationOn()}][{oxmultilang ident="BASKET_TOTAL_PLUS_PROPORTIONAL_VAT"}][{else}] [{oxmultilang ident="VAT_PLUS_PERCENT_AMOUNT" suffix="COLON" args=$basket->getGiftCardCostVatPercent()}][{/if}] [{$basket->getGiftCardCostVat()}] [{$currency->sign}]
|
||||
[{/if}]
|
||||
[{elseif $basket->getFGiftCardCosts()}]
|
||||
[{oxmultilang ident="GREETING_CARD"}] [{$basket->getFGiftCardCosts()}] [{$currency->sign}]
|
||||
[{/if}]
|
||||
[{/if}]
|
||||
[{/block}]
|
||||
|
||||
[{block name="email_plain_order_cust_grandtotal"}]
|
||||
[{oxmultilang ident="GRAND_TOTAL"}] [{$basket->getFPrice()}] [{$currency->name}]
|
||||
|
||||
[{if $basket->getCard()}]
|
||||
[{oxmultilang ident="YOUR_GREETING_CARD"}]
|
||||
[{$basket->getCardMessage()}]
|
||||
[{/if}]
|
||||
[{/block}]
|
||||
|
||||
[{block name="email_plain_order_cust_userremark"}]
|
||||
[{if $order->oxorder__oxremark->value}]
|
||||
[{oxmultilang ident="WHAT_I_WANTED_TO_SAY"}] [{$order->oxorder__oxremark->getRawValue()}]
|
||||
[{/if}]
|
||||
[{/block}]
|
||||
|
||||
[{block name="email_plain_order_cust_download_link"}]
|
||||
[{if $oOrderFileList}]
|
||||
[{oxmultilang ident="MY_DOWNLOADS_DESC"}]
|
||||
[{foreach from=$oOrderFileList item="oOrderFile"}]
|
||||
[{if $order->oxorder__oxpaid->value || !$oOrderFile->oxorderfiles__oxpurchasedonly->value}]
|
||||
[{oxgetseourl ident=$oViewConf->getSelfLink()|cat:"cl=download" params="sorderfileid="|cat:$oOrderFile->getId()}]
|
||||
[{else}]
|
||||
[{$oOrderFile->oxorderfiles__oxfilename->value}] [{oxmultilang ident="DOWNLOADS_PAYMENT_PENDING"}]
|
||||
[{/if}]
|
||||
[{/foreach}]
|
||||
[{/if}]
|
||||
[{/block}]
|
||||
|
||||
[{block name="email_plain_order_cust_paymentinfo"}]
|
||||
[{if $payment->oxuserpayments__oxpaymentsid->value != "oxempty"}]
|
||||
[{oxmultilang ident="PAYMENT_METHOD"}] [{$payment->oxpayments__oxdesc->getRawValue()}] [{if $basket->getPaymentCosts()}]([{$basket->getFPaymentCosts()}] [{$currency->sign}])[{/if}]
|
||||
[{/if}]
|
||||
[{/block}]
|
||||
|
||||
[{block name="email_plain_order_cust_username"}]
|
||||
[{oxmultilang ident="EMAIL_ADDRESS"}] [{$user->oxuser__oxusername->value}]
|
||||
[{/block}]
|
||||
|
||||
[{block name="email_plain_order_cust_address"}]
|
||||
[{oxmultilang ident="BILLING_ADDRESS"}]
|
||||
[{$order->oxorder__oxbillcompany->getRawValue()}]
|
||||
[{$order->oxorder__oxbillsal->value|oxmultilangsal}] [{$order->oxorder__oxbillfname->getRawValue()}] [{$order->oxorder__oxbilllname->getRawValue()}]
|
||||
[{if $order->oxorder__oxbilladdinfo->value}][{$order->oxorder__oxbilladdinfo->getRawValue()}][{/if}]
|
||||
[{$order->oxorder__oxbillstreet->getRawValue()}] [{$order->oxorder__oxbillstreetnr->value}]
|
||||
[{$order->oxorder__oxbillstateid->value}]
|
||||
[{$order->oxorder__oxbillzip->value}] [{$order->oxorder__oxbillcity->getRawValue()}]
|
||||
[{$order->oxorder__oxbillcountry->getRawValue()}]
|
||||
[{if $order->oxorder__oxbillustid->value}][{oxmultilang ident="VAT_ID_NUMBER"}] [{$order->oxorder__oxbillustid->value}][{/if}]
|
||||
[{oxmultilang ident="PHONE"}] [{$order->oxorder__oxbillfon->value}]
|
||||
|
||||
[{if $order->oxorder__oxdellname->value}][{oxmultilang ident="SHIPPING_ADDRESS"}]
|
||||
[{$order->oxorder__oxdelcompany->getRawValue()}]
|
||||
[{$order->oxorder__oxdelsal->value|oxmultilangsal}] [{$order->oxorder__oxdelfname->getRawValue()}] [{$order->oxorder__oxdellname->getRawValue()}]
|
||||
[{if $order->oxorder__oxdeladdinfo->value}][{$order->oxorder__oxdeladdinfo->getRawValue()}][{/if}]
|
||||
[{$order->oxorder__oxdelstreet->getRawValue()}] [{$order->oxorder__oxdelstreetnr->value}]
|
||||
[{$order->oxorder__oxdelstateid->getRawValue()}]
|
||||
[{$order->oxorder__oxdelzip->value}] [{$order->oxorder__oxdelcity->getRawValue()}]
|
||||
[{$order->oxorder__oxdelcountry->getRawValue()}]
|
||||
[{/if}]
|
||||
[{/block}]
|
||||
|
||||
[{block name="email_plain_order_cust_deliveryinfo"}]
|
||||
[{if $payment->oxuserpayments__oxpaymentsid->value != "oxempty"}][{oxmultilang ident="SHIPPING_CARRIER" suffix="COLON"}] [{$order->oDelSet->oxdeliveryset__oxtitle->getRawValue()}]
|
||||
[{/if}]
|
||||
[{/block}]
|
||||
|
||||
[{block name="email_plain_order_cust_paymentinfo"}]
|
||||
[{if $payment->oxuserpayments__oxpaymentsid->value == "oxidpayadvance"}]
|
||||
[{oxmultilang ident="BANK"}] [{$shop->oxshops__oxbankname->getRawValue()}]<br>
|
||||
[{oxmultilang ident="BANK_CODE"}] [{$shop->oxshops__oxbankcode->value}]<br>
|
||||
[{oxmultilang ident="BANK_ACCOUNT_NUMBER"}] [{$shop->oxshops__oxbanknumber->value}]<br>
|
||||
[{oxmultilang ident="BIC"}] [{$shop->oxshops__oxbiccode->value}]<br>
|
||||
[{oxmultilang ident="IBAN"}] [{$shop->oxshops__oxibannumber->value}]
|
||||
[{/if}]
|
||||
[{/block}]
|
||||
|
||||
[{block name="email_plain_order_cust_orderemailend"}]
|
||||
[{oxcontent ident="oxuserorderemailendplain"}]
|
||||
[{/block}]
|
||||
|
||||
[{oxcontent ident="oxemailfooterplain"}]
|
||||
*}]
|
||||
Ihr Team von [{$shop->getFieldData('oxname')}].
|
@ -1 +1,8 @@
|
||||
Ihre Bestellung wurde storniert.
|
||||
[{assign var="shop" value=$oEmailView->getShop()}]
|
||||
|
||||
Hallo [{$order->getFieldData('oxbillfname')}] [{$order->getFieldData('oxbilllname')}],
|
||||
|
||||
Ihre Bestellung [{$order->oxorder__oxordernr->value}] wurde storniert.
|
||||
|
||||
Ihr Team von [{$shop->getFieldData('oxname')}].
|
||||
|
||||
|
@ -1 +1,7 @@
|
||||
Ihre Bestellung wurde eben versendet.
|
||||
[{assign var="shop" value=$oEmailView->getShop()}]
|
||||
|
||||
Hallo [{$order->getFieldData('oxbillfname')}] [{$order->getFieldData('oxbilllname')}],
|
||||
|
||||
Ihre Bestellung [{$order->oxorder__oxordernr->value}] wurde eben versendet. [{if $order->getFieldData('oxtrackcode')}]Der Trackingcode dazu ist: [{$order->getFieldData('oxtrackcode')}].[{/if}]
|
||||
|
||||
Ihr Team von [{$shop->getFieldData('oxname')}].
|
@ -34,7 +34,7 @@ class StartController extends StartController_parent
|
||||
|
||||
/** @var EmailCore $mail */
|
||||
$mail = oxNew(Email::class);
|
||||
$mail->d3SendOrderMessage($order);
|
||||
$mail->d3SendOrderFinishedMessageToUser($order);
|
||||
|
||||
return parent::render();
|
||||
}
|
||||
|
@ -23,9 +23,9 @@ use OxidEsales\EshopCommunity\Internal\Framework\Templating\TemplateRendererInte
|
||||
|
||||
class EmailCore extends EmailCore_parent
|
||||
{
|
||||
protected $orderCustSmsTemplate = 'd3sms_ordercust.tpl';
|
||||
protected $orderSendedNowSmsTemplate = 'd3sms_sendednow.tpl';
|
||||
protected $orderCanceledSmsTemplate = 'd3sms_ordercanceled.tpl';
|
||||
protected $d3OrderCustSmsTemplate = 'd3sms_ordercust.tpl';
|
||||
protected $d3OrderSendedNowSmsTemplate = 'd3sms_sendednow.tpl';
|
||||
protected $d3OrderCanceledSmsTemplate = 'd3sms_ordercanceled.tpl';
|
||||
|
||||
/**
|
||||
* @param Order $order
|
||||
@ -37,7 +37,7 @@ class EmailCore extends EmailCore_parent
|
||||
{
|
||||
$ret = parent::sendOrderEmailToUser($order, $subject);
|
||||
|
||||
$this->d3SendOrderMessage($order);
|
||||
$this->d3SendOrderFinishedMessageToUser($order);
|
||||
|
||||
return $ret;
|
||||
}
|
||||
@ -62,10 +62,10 @@ class EmailCore extends EmailCore_parent
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function d3SendOrderMessage(Order $order)
|
||||
public function d3SendOrderFinishedMessageToUser(Order $order)
|
||||
{
|
||||
$messageSender = oxNew(MessageSender::class);
|
||||
$messageSender->sendOrderMessage($order, $this->d3GetOrderSmsMessageBody($order));
|
||||
$messageSender->sendOrderFinishedMessage($order, $this->d3GetOrderFinishedSmsMessageBody($order));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -73,12 +73,12 @@ class EmailCore extends EmailCore_parent
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function d3GetOrderSmsMessageBody(Order $order): string
|
||||
protected function d3GetOrderFinishedSmsMessageBody(Order $order): string
|
||||
{
|
||||
$renderer = $this->d3GetTplRenderer();
|
||||
$this->setViewData("order", $order);
|
||||
|
||||
return $renderer->renderTemplate($this->orderCustSmsTemplate, $this->getViewData());
|
||||
return $renderer->renderTemplate($this->d3OrderCustSmsTemplate, $this->getViewData());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -89,7 +89,7 @@ class EmailCore extends EmailCore_parent
|
||||
public function d3SendedNowMessage(Order $order)
|
||||
{
|
||||
$messageSender = oxNew(MessageSender::class);
|
||||
$messageSender->sendOrderMessage($order, $this->d3GetSendedNowSmsMessageBody($order));
|
||||
$messageSender->sendSendedNowMessage($order, $this->d3GetSendedNowSmsMessageBody($order));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -102,7 +102,7 @@ class EmailCore extends EmailCore_parent
|
||||
$renderer = $this->d3GetTplRenderer();
|
||||
$this->setViewData("order", $order);
|
||||
|
||||
return $renderer->renderTemplate($this->orderSendedNowSmsTemplate, $this->getViewData());
|
||||
return $renderer->renderTemplate($this->d3OrderSendedNowSmsTemplate, $this->getViewData());
|
||||
}
|
||||
|
||||
public function d3SendCancelMessage($order)
|
||||
@ -121,7 +121,7 @@ class EmailCore extends EmailCore_parent
|
||||
$renderer = $this->d3GetTplRenderer();
|
||||
$this->setViewData("order", $order);
|
||||
|
||||
return $renderer->renderTemplate($this->orderCanceledSmsTemplate, $this->getViewData());
|
||||
return $renderer->renderTemplate($this->d3OrderCanceledSmsTemplate, $this->getViewData());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -129,7 +129,7 @@ class EmailCore extends EmailCore_parent
|
||||
*
|
||||
* @return TemplateRendererInterface
|
||||
*/
|
||||
protected function d3GetTplRenderer()
|
||||
protected function d3GetTplRenderer() : TemplateRendererInterface
|
||||
{
|
||||
$bridge = \OxidEsales\EshopCommunity\Internal\Container\ContainerFactory::getInstance()->getContainer()
|
||||
->get(TemplateRendererBridgeInterface::class);
|
||||
|
@ -98,6 +98,18 @@ $aModule = [
|
||||
'name' => $sModuleId.'_orderActive',
|
||||
'type' => 'bool',
|
||||
'value' => false
|
||||
],
|
||||
[
|
||||
'group' => $sModuleId.'_trigger',
|
||||
'name' => $sModuleId.'_sendedNowActive',
|
||||
'type' => 'bool',
|
||||
'value' => false
|
||||
],
|
||||
[
|
||||
'group' => $sModuleId.'_trigger',
|
||||
'name' => $sModuleId.'_cancelOrderActive',
|
||||
'type' => 'bool',
|
||||
'value' => false
|
||||
]
|
||||
]
|
||||
];
|
Loading…
Reference in New Issue
Block a user