Skip to content

Instantly share code, notes, and snippets.

@smxsm
Last active November 25, 2019 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smxsm/00bedd891c631af209f3475d0cda9531 to your computer and use it in GitHub Desktop.
Save smxsm/00bedd891c631af209f3475d0cda9531 to your computer and use it in GitHub Desktop.
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