Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Shopware Backend Order Overview Extension
//{block name="backend/order/view/detail/overview"}
// {$smarty.block.parent}
Ext.define('Shopware.apps.RahExtendOrder.view.detail.Overview', {
override: 'Shopware.apps.Order.view.detail.Overview',
/**
* Creates the XTemplate for an address information panel, including department and salutation.
*
* @return [Ext.XTemplate] generated Ext.XTemplate
*/
createAddressTemplate: function () {
console.log('createAddressTemplate');
return new Ext.XTemplate(
'{literal}<tpl for=".">',
'<div class="customer-info-pnl">',
'<div class="base-info">',
'<p>',
'<span>{company}</span>',
'</p>',
'<p>',
'<span>{department}</span>',
'</p>',
'<p>',
'<tpl if="salutationSnippet"><span>{salutationSnippet}</span>&nbsp;</tpl>',
'<tpl if="title"><span>{title}</span><br /></tpl>',
'<span>{firstName}</span>&nbsp;',
'<span>{lastName}</span>',
'</p>',
'<p>',
'<span>{street}</span>&nbsp;',
'</p>',
'<tpl if="additionalAddressLine1">',
'<p>',
'<span>{additionalAddressLine1}</span>',
'</p>',
'</tpl>',
'<tpl if="additionalAddressLine2">',
'<p>',
'<span>{additionalAddressLine2}</span>',
'</p>',
'</tpl>',
'<p>',
'<span>{zipCode}</span>&nbsp;',
'<span>{city}</span>',
'</p>',
'<tpl for="state">',
'<p>',
'<span>{name}</span>',
'</p>',
'</tpl>',
'<tpl for="country">',
'<p>',
'<span>{name}</span>',
'</p>',
'</tpl>',
'<tpl if="phone">',
'<p>',
'<span>{phone}</span>',
'</p>',
'</tpl>',
'</div>',
'</div>',
'</tpl>{/literal}'
);
}
});
//{/block}
/**
* Add phone to order overview address panels
*
* @param \Enlight_Event_EventArgs $args
* @return void
*/
public function onOrderPostDispatch(\Enlight_Event_EventArgs $args)
{
/** @var \Shopware_Controllers_Backend_Customer $controller */
$controller = $args->getSubject();
$view = $controller->View();
$request = $controller->Request();
$dir = $this->container->getParameter('rah_duschenprofis.plugin_dir');
$view->addTemplateDir($dir . '/Resources/views');
$this->container->get('pluginlogger')->debug("order action: " . $request->getActionName());
if ($request->getActionName() == 'load') {
$view->extendsTemplate('backend/rah_duschenprofis/view/detail/order_overview.js');
}
}
// Event
'Enlight_Controller_Action_PostDispatchSecure_Backend_Order' => 'onOrderPostDispatch',
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.