Last active
November 25, 2019 14:27
-
-
Save smxsm/00bedd891c631af209f3475d0cda9531 to your computer and use it in GitHub Desktop.
Shopware Backend Order Overview Extension
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//{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> </tpl>', | |
'<tpl if="title"><span>{title}</span><br /></tpl>', | |
'<span>{firstName}</span> ', | |
'<span>{lastName}</span>', | |
'</p>', | |
'<p>', | |
'<span>{street}</span> ', | |
'</p>', | |
'<tpl if="additionalAddressLine1">', | |
'<p>', | |
'<span>{additionalAddressLine1}</span>', | |
'</p>', | |
'</tpl>', | |
'<tpl if="additionalAddressLine2">', | |
'<p>', | |
'<span>{additionalAddressLine2}</span>', | |
'</p>', | |
'</tpl>', | |
'<p>', | |
'<span>{zipCode}</span> ', | |
'<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