I want to rewrite a model from an extension in the "local"-folder. My Extension is also in the "local"-folder but it doesn't work and i have no clue what I'm doing wrong.
The relevant part of the config.xml from the extension i want to override. (app/code/local/Customweb/Saferpay/etc/config.xml)
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<Customweb_Saferpay>
<version>1.0.0</version>
</Customweb_Saferpay>
</modules>
<global>
<models>
<saferpay>
<class>Customweb_Saferpay_Model</class>
<resourceModel>saferpay_mysql4</resourceModel>
</saferpay>
...
My config.xml (app/code/local/Etagen/SaferpayGuestOrderFix/etc/config.xml)
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<Etagen_SaferpayGuestOrderFix>
<version>0.1.0</version>
</Etagen_SaferpayGuestOrderFix>
</modules>
<global>
<models>
<etagen_saferpayguestorderfix>
<class>Etagen_SaferpayGuestOrderFix_Model</class>
</etagen_saferpayguestorderfix>
<saferpay>
<rewrite>
<method>Etagen_SaferpayGuestOrderFix_Model_Method</method>
</rewrite>
</saferpay>
</models>
</global>
</config>
My Model (app/code/local/Etagen/SaferpayGuestOrderFix/Model/Method.php)
<?php
class Etagen_SaferpayGuestOrderFix_Model_Method extends Customweb_Saferpay_Model_Method
{
public function getPaymentPageLink()
{
...code...
}
}
Extension activation (app/etc/modules/Etagen_SaferpayGuestOrderFix.xml)
<?xml version="1.0" encoding="utf-8"?>
<config>
<modules>
<Etagen_SaferpayGuestOrderFix>
<active>true</active>
<codePool>local</codePool>
<depends>
<Customweb_Saferpay />
</depends>
</Etagen_SaferpayGuestOrderFix>
</modules>
</config>
(The Extension is active in Backend System > Configuration > Advanced)
But the change i made in the getPaymentPageLink is ignored.
Thanks for help
* UPDATE *
The whole config.xml without comment part (app/code/local/Customweb/Saferpay/etc/config.xml)
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<Customweb_Saferpay>
<version>1.0.0</version>
</Customweb_Saferpay>
</modules>
<global>
<models>
<saferpay>
<class>Customweb_Saferpay_Model</class>
<resourceModel>saferpay_mysql4</resourceModel>
</saferpay>
<saferpay_mysql4>
<class>Customweb_Saferpay_Model_Mysql4</class>
<entities>
<carddata>
<table>saferpay_card_data</table>
</carddata>
</entities>
</saferpay_mysql4>
</models>
<blocks>
<saferpay><class>Customweb_Saferpay_Block</class></saferpay>
</blocks>
<helpers>
<saferpay>
<class>Customweb_Saferpay_Helper</class>
</saferpay>
</helpers>
<resources>
<saferpay_write>
<connection>
<use>core_write</use>
</connection>
</saferpay_write>
<saferpay_read>
<connection>
<use>core_read</use>
</connection>
</saferpay_read>
<saferpay_setup>
<setup>
<module>Customweb_Saferpay</module>
<class>Customweb_Saferpay_Model_Resource_Setup</class>
</setup>
</saferpay_setup>
</resources>
<events>
<core_block_abstract_to_html_before>
<observers>
<saferpay_html_before>
<type>singleton</type>
<class>Customweb_Saferpay_Model_Observer</class>
<method>htmlBefore</method>
</saferpay_html_before>
</observers>
</core_block_abstract_to_html_before>
<payment_info_block_prepare_specific_information>
<observers>
<saferpay_payment_info_block>
<type>singleton</type>
<class>Customweb_Saferpay_Model_Observer</class>
<method>paymentInfoBlock</method>
</saferpay_payment_info_block>
</observers>
</payment_info_block_prepare_specific_information>
</events>
<sales>
<order>
<statuses>
<canceled_saferpay translate="label">
<label>Canceled Saferpay</label>
</canceled_saferpay>
<pending_saferpay translate="label">
<label>Pending Saferpay</label>
</pending_saferpay>
</statuses>
<states>
<canceled>
<statuses>
<canceled_saferpay />
</statuses>
</canceled>
<pending_payment>
<statuses>
<pending_saferpay />
</statuses>
</pending_payment>
</states>
</order>
</sales>
</global>
<adminhtml>
<acl>
<resources>
<admin>
<children>
<system>
<children>
<config>
<children>
<saferpay translate="title" module="Saferpay">
<title>Saferpay</title>
</saferpay>
</children>
</config>
</children>
</system>
</children>
</admin>
</resources>
</acl>
</adminhtml>
<frontend>
<blocks>
<Saferpay>
<class>Customweb_Saferpay_Block</class>
</Saferpay>
</blocks>
<layout>
<updates>
<saferpay>
<file>saferpay.xml</file>
</saferpay>
</updates>
</layout>
<routers>
<Saferpay>
<use>standard</use>
<args>
<module>Customweb_Saferpay</module>
<frontName>Saferpay</frontName>
</args>
</Saferpay>
</routers>
<translate>
<modules>
<Customweb_Saferpay>
<files>
<default>Customweb_Saferpay.csv</default>
</files>
</Customweb_Saferpay>
</modules>
</translate>
</frontend>
<default>
<saferpay>
<general>
<mode>1</mode>
<create_pay_init_url>https://www.saferpay.com/hosting/CreatePayInit.asp</create_pay_init_url>
<verify_pay_confirm_url>https://www.saferpay.com/hosting/verifypayconfirm.asp</verify_pay_confirm_url>
<verify_enrollment_url>https://www.saferpay.com/hosting/VerifyEnrollment.asp</verify_enrollment_url>
<execute_url>https://www.saferpay.com/hosting/Execute.asp</execute_url>
<pay_complete_url>https://www.saferpay.com/hosting/PayComplete.asp</pay_complete_url>
<test_account_id>99867-94913159</test_account_id>
<test_password>XAjc3Kna</test_password>
<cardref_count>0</cardref_count>
<cardref_id_scheme>cardref_{ID}</cardref_id_scheme>
<order_id_schema>order_{ID}</order_id_schema>
<invoice_settlement>manual</invoice_settlement>
<capture_invoice>manual</capture_invoice>
<liability_shift_only>1</liability_shift_only>
<can_use_scd>0</can_use_scd>
<safe_cc_data>0</safe_cc_data>
<usernotify>0</usernotify>
<notifyaddress>0</notifyaddress>
</general>
<paymentpage>
<autoclose>0</autoclose>
<ccname>1</ccname>
<showlanguages>1</showlanguages>
</paymentpage>
</saferpay>
</default>
Mage::getModel()
factory? I assume you are trying to rewrite a payment extension. Can you post theconfig.xml
definition of the payment method? This is found in the XML nodedefault/payment/[payment method code]/model
config.xml
underdefault/payment
, this is where the payment model is defined.Customweb_Saferpay_Model_Observer::paymentInfoBlock()
, where the info block is loaded configured. From what it looks like, they don't use Magento[class_group]/[class]
convention, so it could be that they instantiate the model directly. In that case, your rewrites won't work, since they are not found in the configuration.