I find the whole XML thing difficult so I am sympathetic to your cause here.
It looks to me like there is a discrepancy with your class name and your block XML
ie
class Crusader_CLHomePage_Block_Qwerty extends Mage_Core_Block_Template
and
<block type="core/template" name="homepage" template="crusader/home.phtml">
<block type="crusaderhome/qwerty" name="homeads" as="homeads" template="crusader/homeads.phtml" />
</block>
Let's start with the block type and work backward. I think here I would expect to see something like
<block type="crusader_home/qwerty" ...
and that type would refer Magento to the class
Crusader_Home_Block_Qwerty extends Mage_Core_Block_Template
Continuing to work backward on this tack, the file app\code\local\Crusader\CLHomePage\etc\config.xml would need to be modified to something like
<global>
<blocks>
<crusader_home>
<class>Crusader_Home_Block</class>
</crusader_home>
</blocks>
</global>
It points Magento to all classes starting 'Crusader_Home_Block_*'. And now I think you need to rename your module Crusader_Home instead of Crusader_CLHomePage and change the folder names accordingly...
AND / BUT I strongly recommend you change your module name. Only ever use one capital letter at the start of the module name not three and don't put capital letters in the middle of the name either.
You may want to look into some of the tools available for generating modules. I find them very useful for avoiding typing errors. I use this one by the very clever people at MGT Commerce (it has simplicity on its side) and this one is all-encompassing and an astonishing piece of coding by Silk Software.
***EDIT following comments below
Additionally based on the error log I think the problem is that Magento can't find your class file. So double-check the caches are refreshed or off, particularly XML cache, and that the compiler is off or re-enabled.
Please try this but not sure
if(!$success){
Mage::throwException($this->__("item not in stock")); //or
Mage::throwException(Mage::helper('core')->__("item not in stock"));
}
Best Answer
From your comments I gather your module is being developed under
app/code
and you are not followingpsr-0
conventions for your classes (code is under a customsrc
folder inside of your module). This is fine, but still, since composer is not aware of modules installed underapp/code
, it won't know about yourpsr-4
definitions.As a workaround for that, you could enter your
psr-4
classpaths in the projectcomposer.json
(the one which is found in the project root), and then runcomposer dump-autoload
to regenerate thevendor/autoload.php
and all its related files. Even if it is not the cleanest solution, it would still work in your case.But very important to note: your should never manually edit the autoloader files, since they are re-generated every time you install a new module via composer for example. Also, you probably don't want to put your
vendor
folder under version control, your edits would be lost then.