<?xml version="1.0" encoding="utf-8"?>
<modification>
    <name>Admin Show Promotion Menu In Sidebar</name>
    <code>admin_show_promotion_menu</code>
    <version>1.0</version>
    <author>DearSoft</author>
    <link>https://dearsoft.bd/</link>
    <description>This will add Promotion link in admin left sidebar bellow marketing</description>

    <!-- Controller -->
    <file path="admin/controller/common/column_left.php">
        <operation error="skip">
            <search index="0"><![CDATA[if ($this->user->hasPermission('access', 'marketplace/extension')) {]]></search>
            <add position="before"><![CDATA[
            if ($this->user->hasPermission('access', 'marketplace/extension')) {
				$marketplace[] = array(
					'name'	   => $this->language->get('text_module'),
					'href'     => $this->url->link('marketplace/extension', [
						'user_token' => $this->session->data['user_token'],
						'type' => 'module',
					], true),
					'children' => array()
				);
			}
            ]]></add>
        </operation>

        <operation error="skip">
            <search index="0"><![CDATA[if ($this->user->hasPermission('access', 'marketing/contact')) {]]></search>
            <add position="before"><![CDATA[
            // X Extensions
            $x_extensions = array();
              if ($this->user->hasPermission('access', 'extension/module/xgift')) {
                $x_extensions[] = array(
                  'name'     => $this->language->get('text_gift'),
                  'href'     => $this->url->link('extension/module/xgift', 'user_token=' . $this->session->data['user_token'], true),
                  'children' => array()
                );
              }

              if ($this->user->hasPermission('access', 'extension/module/xdiscount')) {
                $x_extensions[] = array(
                  'name'     => $this->language->get('text_discount'),
                  'href'     => $this->url->link('extension/module/xdiscount', 'user_token=' . $this->session->data['user_token'], true),
                  'children' => array()
                );
              }

              if ($this->user->hasPermission('access', 'extension/total/xfeepro')) {
                $x_extensions[] = array(
                  'name'     => $this->language->get('text_fee'),
                  'href'     => $this->url->link('extension/total/xfeepro', 'user_token=' . $this->session->data['user_token'], true),
                  'children' => array()
                );
              }

              if ($this->user->hasPermission('access', 'extension/shipping/xshippingpro')) {
                $x_extensions[] = array(
                  'name'     => $this->language->get('text_shipping_discount'),
                  'href'     => $this->url->link('extension/shipping/xshippingpro', 'user_token=' . $this->session->data['user_token'], true),
                  'children' => array()
                );
              }

              if ($x_extensions) {
                $marketing[] = array(
                  'name'     => $this->language->get('text_promotions'),
                  'href'     => '',
                  'children' => $x_extensions
                );
              }
            ]]></add>
        </operation>
    </file>

    <!-- Language -->
    <file path="admin/language/*/common/column_left.php">
        <operation>
            <search><![CDATA[$_['text_extension']            = 'Extensions';]]></search>
            <add position="before"><![CDATA[
                    $_['text_module']               = 'Modules';
                    $_['text_promotions']           = 'Promotions';
                    $_['text_gift']                 = 'Gift';
                    $_['text_discount']             = 'Discount';
                    $_['text_fee']                  = 'Fee';
                    $_['text_shipping_discount']    = 'Shipping Discount';
            ]]></add>
        </operation>
    </file>

    <file path="admin/view/template/marketplace/extension.twig">
        <operation>
            <search><![CDATA[<div id="extension"></div>]]></search>
            <add position="before"><![CDATA[
                <style>
                .img-responsive{
                    display:none !important;
                }
                </style>
            ]]></add>
        </operation>
    </file>
</modification>