1

I am trying to override a model in the Stripe extension, but I can't seem to get it to work. Here is what I have so far:

Stripe config.xml

<config>
 <global>
  <models>
      <compiler>
        <rewrite>
          <process>Stripe_Payments_Model_Compiler_Process</process>
        </rewrite>
      </compiler>
      <stripe_payments>
        <class>Stripe_Payments_Model</class>
        <resourceModel>stripe_payments_resource</resourceModel>
      </stripe_payments>
      <stripe_payments_resource>
        <class>Stripe_Payments_Model_Resource</class>
        <entities>
          <webhook>
            <table>stripe_webhooks</table>
          </webhook>
        </entities>
      </stripe_payments_resource>
    </models>
...

Stripe Model to override path: app/code/community/Stripe/Payments/Model/PaymentIntent.php

Stripe Model to override:

<?php

class Stripe_Payments_Model_PaymentIntent
{
...
}

My module's config.xml:

    <config>
     <global>
      <models>
          <dbcustom_stripe>
            <class>DBCustom_Stripe_Model</class>
          </dbcustom_stripe>
          <stripe_payments>
           <rewrite>
            <paymentintent>DBCustom_Stripe_Model_PaymentIntent</paymentintent>
           </rewrite>
          </stripe_payments>
      </models>
...

My overriding model path: app/code/local/DBCustom/Stripe/Model/PaymentIntent.php

My overriding model:

<?php


class DBCustom_Stripe_Model_PaymentIntent extends Stripe_Payments_Model_PaymentIntent {

...

}

My module is active and is overriding a helper class. I have also tried flushing the cache multiple times. Not sure what else to try, any help is appreciated.

5
  • Which error it show? Jul 31, 2020 at 18:01
  • There are no errors, it just doesn't work. I use Xdebug so I can tell which file it's going to when the code runs, and it keeps going into the original file to run and not the new one I setup.
    – Eric Brown
    Jul 31, 2020 at 18:52
  • share the code wht write into this one Stripe_Payments_Model_PaymentIntent Aug 1, 2020 at 4:44
  • Have you added a <depends> node to your modules xml to load your module after Stripe_Payments?
    – sv3n
    Aug 2, 2020 at 13:51
  • Yeah, I added depends, still didn't work.
    – Eric Brown
    Aug 4, 2020 at 16:19

1 Answer 1

1

Use <paymentIntent> or <payment_intent> (it’s probably the first form with an uppercase i) instead of <paymentintent> in your module’s config.xml.

1
  • Yup, that was it. Thanks.
    – Eric Brown
    Aug 4, 2020 at 16:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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