php - Magento overriding the core files -
I have problems overriding core files App / code / core / pigment / catalog / block / product / List php
My module structure is:
CompanyName / My files: App / etc / modules / CompanyName_ModuleName.xml & lt; Config & gt; & Lt; Module & gt; & Lt; CompanyName_ModuleName & gt; & Lt; Active & gt; True & lt; / Active & gt; & Lt; Codeple & gt; Local & lt; / Codeple & gt; & Lt; / CompanyName_ModuleName & gt; & Lt; / Module & gt; & Lt; / Config & gt;
../ CompanyName / ModuleName / etc / config.xml
& lt; Config & gt; & Lt; Module & gt; & Lt; CompanyName_ModuleName & gt; & Lt; Version & gt; 1.0 & lt; / Edition & gt; & Lt; / CompanyName_ModuleName & gt; & Lt; / Module & gt; & Lt; Global & gt; & Lt; Block & gt; & Lt; CompanyName_ModuleName & gt; & Lt; Classes & gt; CompanyName_ModuleName_Block & lt; / Square & gt; & Lt; / CompanyName_ModuleName & gt; & Lt; List & gt; & Lt; Rewrite & gt; & Lt; Product_list & gt; CompanyName_ModuleName_Block_Product_List & lt; / Product_list & gt; & Lt; / Rewrite & gt; & Lt; / List & gt; & Lt; / Block & gt; & Lt; / Global & gt; & Lt; / Config & gt;
and ../ CompanyName / ModuleName / block / product / list.php
class CompanyName_ModuleName_Block_Product_List Mage_Catalog_Block_Product_List {public function Increases _getProductCollection () {(...)}}
I do not know why it does not work I do not see the mistake
There is a typo in your case. In your CompanyName_ModuleName.xml
, it should be
& lt; CodePool & gt; Local & lt; / CodePool & gt;
Note codePool
in camel-letter p
Due to this typo, Magnu probably did not activate your module. This is the reason that nothing happens through your modules
In addition to rewriting a block, you do not want to define the block segment as config.xml
Under global
node
Please note that your module should remain in the local
codepole. Please also ensure that
always try to avoid unwanted camel-characters in namespace
and modulename
. This is not really wrong but instead of CompanyName_ModuleName
, you can use Companyname_Modulename
. This will help you avoid unwanted typo.
This is a small recommendation from my part
If you do not need the following section in your config.xml, here's one thing I would like to mention. If it has its own block within your module, except to rewrite the blocks, you should have this code in your config.xml
Later you will refer to your block by using unique identifier companyname_modulename
. To specify this reference node, the modules name is used for this, from the convention "It should be unique" conference. So in this case, the conference says that you have to use modulename
as a block reference but there is some time to struggle with other custom extensions, if we only reference Use the module name. So to make sure that this is unique, I strongly suggest the format of namespace_modulename
. Note that I used lowercase letters. In your case you also used the camel sheet. This is not a good practice.
But the above thing is not relevant in your case. Since your module does not keep any block of your module, but only a rewrite block. Therefore, the above mentioned code is not necessary for you. The reason for this is because in the rewrite section, we clearly tell Magenta where to look for the rewrite block. In your case, you are assigning it to CompanyName_ModuleName_Block_Product_List
.
Keep in mind that.
Comments
Post a Comment