Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getOrderConfirmationPlainTemplateDe example
$deLangId
=
$this
->
fetchLanguageId
(
'de-DE',
$connection
)
;
// update order confirmation email templates
$this
->
updateMailTemplate
(
MailTemplateTypes::MAILTYPE_ORDER_CONFIRM,
$connection
,
$defaultLangId
,
$deLangId
,
$this
->
getOrderConfirmationHtmlTemplateEn
(
)
,
$this
->
getOrderConfirmationPlainTemplateEn
(
)
,
$this
->
getOrderConfirmationHTMLTemplateDe
(
)
,
$this
->
getOrderConfirmationPlainTemplateDe
(
)
)
;
// update delivery email templates
$this
->
updateMailTemplate
(
MailTemplateTypes::MAILTYPE_STATE_ENTER_ORDER_DELIVERY_STATE_CANCELLED,
$connection
,
$defaultLangId
,
$deLangId
,
$this
->
getDeliveryCancellationHtmlTemplateEn
(
)
,
$this
->
getDeliveryCancellationPlainTemplateEn
(
)
,
$this
->
getDeliveryCancellationHtmlTemplateDe
(
)
,
$templateId
,
$enLangId
,
$this
->
getOrderConfirmationHtmlTemplateEn
(
)
,
$this
->
getOrderConfirmationPlainTemplateEn
(
)
)
;
$this
->
updateMailTemplateTranslation
(
$connection
,
$templateId
,
$deLangId
,
$this
->
getOrderConfirmationHtmlTemplateDe
(
)
,
$this
->
getOrderConfirmationPlainTemplateDe
(
)
)
;
}
}
public
function
updateDestructive
(
Connection
$connection
)
: void
{
}
private
function
fetchSystemMailTemplateIdFromType
(
Connection
$connection
, string
$mailTemplateType
)
: ?string
{
$templateTypeId
=
$connection
->
executeQuery
(
' SELECT `id` from `mail_template_type` WHERE `technical_name` = :type ',
$deLangId
=
$this
->
fetchLanguageId
(
'de-DE',
$connection
)
;
// update order confirmation email templates
$this
->
updateMailTemplate
(
MailTemplateTypes::MAILTYPE_ORDER_CONFIRM,
$connection
,
$defaultLangId
,
$deLangId
,
$this
->
getOrderConfirmationHtmlTemplateEn
(
)
,
$this
->
getOrderConfirmationPlainTemplateEn
(
)
,
$this
->
getOrderConfirmationHTMLTemplateDe
(
)
,
$this
->
getOrderConfirmationPlainTemplateDe
(
)
)
;
// update delivery email templates
$this
->
updateMailTemplate
(
MailTemplateTypes::MAILTYPE_STATE_ENTER_ORDER_DELIVERY_STATE_CANCELLED,
$connection
,
$defaultLangId
,
$deLangId
,
$this
->
getDeliveryCancellationHtmlTemplateEn
(
)
,
$this
->
getDeliveryCancellationPlainTemplateEn
(
)
,
$this
->
getDeliveryCancellationHtmlTemplateDe
(
)
,
$this
->
getOrderConfirmationHtmlTemplateEn
(
)
,
$this
->
getOrderConfirmationPlainTemplateEn
(
)
)
;
}
if
(
$deLangId
)
{
$this
->
updateMailTemplateTranslation
(
$connection
,
$templateId
,
$deLangId
,
$this
->
getOrderConfirmationHtmlTemplateDe
(
)
,
$this
->
getOrderConfirmationPlainTemplateDe
(
)
)
;
}
}
// update customer registration
$templateId
=
$this
->
fetchSystemMailTemplateIdFromType
(
$connection
, MailTemplateTypes::MAILTYPE_CUSTOMER_REGISTER
)
;
if
(
$templateId
!== null
)
{
if
(
$defaultLangId
!==
$deLangId
)
{
$this
->
updateMailTemplateTranslation
(
$connection
,
$templateId
,
$templateId
,
$enLangId
,
$this
->
getOrderConfirmationHtmlTemplateEn
(
)
,
$this
->
getOrderConfirmationPlainTemplateEn
(
)
)
;
$this
->
updateMailTemplateTranslation
(
$connection
,
$templateId
,
$deLangId
,
$this
->
getOrderConfirmationHtmlTemplateDe
(
)
,
$this
->
getOrderConfirmationPlainTemplateDe
(
)
)
;
}
}
public
function
updateDestructive
(
Connection
$connection
)
: void
{
// implement update destructive
}
private
function
fetchSystemMailTemplateIdFromType
(
Connection
$connection
, string
$mailTemplateType
)
: ?string
{
$deLangId
=
$this
->
fetchLanguageId
(
'de-DE',
$connection
)
;
// update email templates
$this
->
updateMailTemplate
(
MailTemplateTypes::MAILTYPE_ORDER_CONFIRM,
$connection
,
$enLangId
,
$deLangId
,
$this
->
getOrderConfirmationHtmlTemplateEn
(
)
,
$this
->
getOrderConfirmationPlainTemplateEn
(
)
,
$this
->
getOrderConfirmationHTMLTemplateDe
(
)
,
$this
->
getOrderConfirmationPlainTemplateDe
(
)
)
;
}
public
function
updateDestructive
(
Connection
$connection
)
: void
{
// implement update destructive
}
private
function
updateMailTemplate
(
string
$mailTemplateType
,
Connection
$connection
,
?
if
(
$deLangId
=== null
)
{
return
;
}
// update order confirmation email templates
$this
->
updateMailTemplate
(
MailTemplateTypes::MAILTYPE_ORDER_CONFIRM,
$connection
,
$deLangId
,
$this
->
getOrderConfirmationHTMLTemplateDe
(
)
,
$this
->
getOrderConfirmationPlainTemplateDe
(
)
)
;
// update delivery email templates
$this
->
updateMailTemplate
(
MailTemplateTypes::MAILTYPE_STATE_ENTER_ORDER_DELIVERY_STATE_CANCELLED,
$connection
,
$deLangId
,
$this
->
getDeliveryCancellationHtmlTemplateDe
(
)
,
$this
->
getDeliveryCancellationPlainTemplateDe
(
)
)
;