ihave problem again with my rewrite, i tried create rewrite model on my lesson
app/code/local/Lesson/Test/etc/config.xml
<?xml version="1.0"?>
<config>
<modules>
<Lesson_Test>
<version>1.0.0</version>
</Lesson_Test>
</modules>
<global>
<models>
<customer>
<rewrite>
<product>Lesson_Test_Model_Customer</product>
</rewrite>
</customer>
</models>
</global>
</config>
app/code/local/Lesson/Test/Model/Customer.php
<?php
class Lesson_Test_Model_Customer extends Mage_Customer_Model_Customer
{
public function getName()
{
$name = '';
if ($this->getPrefix()) {
$name .= $this->getPrefix() . ' ';
}
$name .= $this->getFirstname();
if ($this->getMiddlename()) {
$name .= ' ' . $this->getMiddlename();
}
$name .= ' ' . $this->getLastname();
if ($this->getSuffix()) {
$name .= ' ' . $this->getSuffix();
}
return $name.'22222222';
}
}
app/etc/modules/Lesson_all.xml
<?xml version="1.0"?>
<config>
<modules>
<Lesson_Test>
<active>true</active>
<codePool>local</codePool>
</Lesson_Test>
</modules>
</config>
i try access
http://127.0.0.1/magento/index.php/lesson
http://127.0.0.1/magento/index.php/customer/customer
http://127.0.0.1/magento/index.php/customer/product
http://127.0.0.1/magento/index.php/lesson/customer/customer
http://127.0.0.1/magento/index.php/lesson/customer/product
the all of this is Whoops, our bad…, thank you 🙂
Best Answer
As per as, your code you want to rewrite class Mage_Customer_Model_Customer.
But in
config.xml
, you try to rewrite model classMage_Customer_Model_Product
and in default magento this class does not exist. I sure you want to rewrite class Mage_Customer_Model_Customer. So, you shouldChange
to
at config.xml