Some troubleshooting tips:
Do you have a module registered in app/etc/modules?
If not, it should be as such:
<?xml version="1.0"?>
<config>
<modules>
<ThomasRyan_Checkoutajax>
<active>true</active>
<codePool>local</codePool>
</ThomasRyan_Checkoutajax>
</modules>
</config>
This module naming looks incorrect - it is expected to be separated with an underscore indicating namespace -- so, not this:
<module>Checkoutajax</module>
All modules are named as Company_Module
, etc. Checkoutajax_AjaxController is then not a valid classname. Check your general PHP error log (or Apache logs) and you should see something to the effect of class not exists
.
Change/update this to ThomasRyan_Checkoutajax
or similar. All instances of Checkoutajax will need to be updated in the module xml definition.
The frontName also has issues, namely, it should be lowercase:
<frontName>Checkoutajax</frontName>
I'm not sure if Magento forces the lowercase on the routename.
The updated code, then:
<?xml version="1.0"?>
<config>
<modules>
<ThomasRyan_Checkoutajax>
<version>0.1.0</version>
</ThomasRyan_Checkoutajax>
</modules>
<frontend>
<routers>
<Checkoutajax>
<use>standard</use>
<args>
<module>ThomasRyan_Checkoutajax</module>
<frontName>checkoutajax</frontName>
</args>
</Checkoutajax>
</routers>
<layout>
<updates>
<checkoutajax>
<file>checkoutajax.xml</file>
</checkoutajax>
</updates>
</layout>
</frontend>
</config>
And the controller:
<?php
class ThomasRyan_Checkoutajax_AjaxController extends Mage_Core_Controller_Front_Action {
public function indexAction() {
$this->loadLayout();
$this->renderLayout();
}
}
Edit:
This is just a quick update to explain how routes/controllers/actions work in Magento. Let's say that this is your URL:
www.yourstore.com/checkoutajax/ajax/index
This represents three different entities:
checkoutajax
is the route name, also called frontName
in the module definition XML
ajax
here represents the controller name. This controller file should be named AjaxController.php and located in the /controllers
directory of your module.
index
represents the indexAction
method.
So, to visualize:
www.yourstore.com/checkoutajax/ajax/index
---------route--------^
---------controller-------------^
---------action-----------------------^
1. Change your module's router configuration like this.
<routers>
<customajax>
<use>standard</use>
<args>
<module>Custom_Customajax</module>
<frontName>customajax</frontName>
</args>
</customajax>
</routers>
Note the change that you made here is using customajax
instead of Customajax
. Now Magento will recognize your customajax_ajax_index
layout handle.
2. Make sure your custom block exist. As per the definition in your layout XML file, Magento needs the following block class to be defined inside your module.
FILE : app\code\local\Custom/Customajax/Block/Customajax.php
<?php
class Custom_Customajax_Block_Customajax extends Mage_Core_Block_Template
{
}
Job is not over. Eventhough we defined our custom block, Magento do not know where exactly it needs to look for our custom block. So we need to tell to Magento that, "she" should look in our own module. For this add this code snippet in config.xml
<global>
<blocks>
<custom_customajax>
<class>Custom_Customajax_Block</class>
</custom_customajax>
</blocks>
</global>
3. I am not sure about this point. You need to set url
keyword like this
url: "www.domain.com/customajax/ajax/index",
where www.domain.com
is your site's base url.
You are done. Now clear the cache and then try again
Best Answer
So we managed to fix the Ajax extension by altering the css in our custom theme.
The extension we were using (ajax layered navigation pagination pro ) was deleting the div class causing the page to format incorrectly.
We added a new div class in the left.phtml file in our custom theme.
So after
insert another div class. I used
then before
insert a closing div
Also make sure that you alter the file /skin/frontend/base/default/js/vpager.js to the correct div classes if using a custom theme. Ours didn't so we had to alter and swap some code to our div classes.