2

I'm attempting to overwrite adminhtml/model/sales/order/create.php, specifically public function initFromOrderItem.

Text output shows the function I've overwritten is not loading to the site.

In app/etc/modules/GoddessDelivers_QObugfux.xml

 <config>
     <modules>
         <GoddessDelivers_QObugfix> <!--  app/code/<codepool>/GoddessDelivers/QObugfix  -->
             <active>true</active>
             <codePool>local</codePool>
             <depends>
                 <Mage_Core />
             </depends>
         </GoddessDelivers_QObugfix>

     </modules>
 </config>

In app/code/local/GoddessDelivers/QObugfix/etc/config.xml

 <config>
     <modules>
         <GoddessDelivers_QObugfix>
             <version>0.0.0.1</version>
         </GoddessDelivers_QObugfix>
     </modules>
     <global>
         <adminhtml>
             <sales>
                 <order>
                     <rewrite>
                         <create>GoddessDelivers_QObugfix_Adminhtml_Model_Sales_Order_Create</create>
                     </rewrite>
                 </order>
             </sales>
         </adminhtml>
     </global>

 </config>

In app/code/local/GoddessDelivers/QObugfix/Adminhtml/Model/Sales/Order/Create.php:

 class GoddessDelivers_QObugfix_Adminhtml_Model_Sales_Order_Create
 extends Mage_Adminhtml_Model_Sales_Order_Create {
     public function initFromOrderItem(Mage_Sales_Model_Order_Item $orderItem, $qty = null)
     {

What am I doing wrong?

2 Answers 2

5

You are missing the <models> node in your config. Your node nesting also needs fixing.

<config>
    <modules>
         <GoddessDelivers_QObugfix>
             <version>0.0.0.1</version>
         </GoddessDelivers_QObugfix>
     </modules>
     <global>
         <models>
             <adminhtml>
                 <rewrite>
                     <sales_order_create>GoddessDelivers_QObugfix_Adminhtml_Model_Sales_Order_Create</rewrite>
                 </adminhtml>
             </models>
         </global> 
 </config>
2
  1. Typo in file name app/etc/modules/GoddessDelivers_QObugfux.xml; probably you meant app/etc/modules/GoddessDelivers_QObugfix.xml
  2. In file app/etc/modules/GoddessDelivers_QObugf*u*x.xml you should set a the module you're overwriting from as a dependency, so <depends><Mage_Adminhtml /></depends>
  3. In config.xml the path is /config/global/models/adminhtml, so you should have:
<config>
  <global>
    <models>
      <adminhtml>
        <rewrite>
          <sales_order_create>GoddessDelivers_QObugfix_Adminhtml_Model_Sales_Order_Create</sales_order_create>
        </rewrite>
      </adminhtml>
    </models>
  </global>
</config>
  1. The modes path is non-standard; should be code/local/GoddessDelivers/QObugfix/Model/Adminhtml/Sales/Order/Create.php and the class name should reflect the path.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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