Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Create New Ajax Page? 
 
bsboard
Jr. Member
 
Total Posts:  15
Joined:  2008-03-18
 

I am trying to build ‘quick view’ functionality on the category pages. What should happen is when you click on a button, a modal dialog pops up with all the information for the product, so the user doesn’t have to reload the whole page to view a product. I know how to grab all the product information while I am looping over the products of a category, but I would rather not do it there. I would much prefer to do an ajax request for the data when the button is clicked.

Can anyone inform me of how to create a new page that will accept these ajax requests? For example, if a normal product page is:
/category/product.html

I would like to create something like
/ajax/category/product.html

which would return all the information i need as json data.

Any pointers would be much appreciated.

 
Magento Community Magento Community
Magento Community
Magento Community
 
bsboard
Jr. Member
 
Total Posts:  15
Joined:  2008-03-18
 

Ok, i’ve been researching all night. So much to learn, I’ve never worked with an MVC platform before.

One main question I have is:

where in the heck does the ‘core_url_rewrite’ table in the database get queried? I am trying to figure out how a url gets converted from the seo version to the mvc version. In /core/model/url/rewrite.php I found references to a ‘getTargetPath’ function, however I couldn’t find this function anywhere grepping through code.

At any rate, here is my current plan of action. Any thoughts on weather or not it will work (or any comments at all, really) would be much appreciated:

- add javascript to the catalog list pages which sends a request to /catalog/product/viewAjax/id/{id}
- add catalog_product_viewAjax element to catalog.xml layout file, setting the template to a blank one (so nothing but the product content is returned)
- create viewAjax.phtml file which displays all the information in a format I want (may do JSON, may just keep it HTML and use javascript innerHTML to put it on page)
- add viewAjaxAction function to the ProductController.php file

The last one is what gets me. What should be in this function? Is it needed?

Please comment if you have done anything remotely similar to this before, or if it looks like it will work, or I am forgetting anything. Thanks!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Tweakmag
Guru
 
Avatar
Total Posts:  307
Joined:  2007-08-31
London, UK
 

I think you will find that the url doesn’t get converted - it is mapped instead. smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
frontier
Member
 
Total Posts:  41
Joined:  2008-04-17
 

bsboard: I am trying to do the same thing, just need to be able to get the product details separately so I can call from ajax. Did you ever find a solution to this?

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top