-1

I want to override module\sales\view\adminhtml\web\js\order\create\scripts.js in my Custom Module. So, generally i asked question, How to add sales.js file in this xml.

<adminhtml_sales_order_create_index>
    <reference name="billing_method">
        <block type="module_namespace/customer_account" name="use_wallet" template="vendor/module/checkout/onepage/payment.phtml" />
    </reference>
    <reference name="head">
        <action method="addJs">
            <file>module/namespace/mage/adminhtml/sales.js</file>
        </action>
    </reference>
</adminhtml_sales_order_create_index>

closed as unclear what you're asking by Prince Patel, Jai, Manoj Deswal, Piyush, Amit Bera Mar 6 '18 at 11:08

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • code provide by you. is magento1 code. Please try magento two code. – Amit Bera Mar 6 '18 at 11:09
  • This question looks related to M1 Why m2 tags were there , clear that then only I will cast reopen vote – Murtuza Zabuawala Mar 7 '18 at 7:24
3

This is an example of adding a js file:

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <head>
        <script src="sales.js"/>
    </head>
    <reference name="billing_method">
        <block type="module_namespace/customer_account" name="use_wallet" template="module/namespace/checkout/onepage/payment.phtml" />
    </reference>
</page>

You do not have to declare that it is a file for admin because you have the XML file in the admin path: /app/code/Vendorname/Module/view/adminhtml/web/js/sales.js

0

Create vendor/module/view/adminhtml/layout/sales_order_create_index.xml and add

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <head>
        <link src="Vendor_Module::js/sales.js" />
    </head>
    <body>
        <referenceBlock name="billing_method">
            <block type="vendor/module/customer/account" name="use_wallet" template="Vendor_Module::checkout/onepage/payment.phtml" />
        </referenceBlock>
    </body>
</page>
0

Place your js file in vendor/module/view/adminhtml/web/js/sales.js

and then call it in your xml file.

<head>   
   <script src="Vendor_Module::js/sales.js"/>
</head>

Not the answer you're looking for? Browse other questions tagged or ask your own question.