Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Ajax Requests

 
Reply
   X-Cart forums > X-Cart 5 > Modifying the design and features (X-Cart 5)
 
Thread Tools Search this Thread
  #1  
Old 09-24-2012, 12:51 PM
 
Cpt.Crashtastic Cpt.Crashtastic is offline
 

eXpert
  
Join Date: Jan 2006
Posts: 219
 

Default Ajax Requests

Is it possible to use the XCN Ajax handlers from our own code without extending what is there already?

I see when you drag an item to the cart it passes two specific paramaters, "cart" and "add" which I guess gets converted to doActionAdd() in CartAbstract.php

So if I wanted to call myFunction() in myControllerClass.php what parameters do I need to pass using the existing handlers?

Unless of course I'm barking up the wrong tree.
__________________
Xcart 4.4.?
Xcart Next
Litecommerce with Drupal
http://www.corbywebworx.com

Custom Mods, Hosting and Support for Xcart-Next and LiteCommerce
Reply With Quote
  #2  
Old 09-25-2012, 10:29 AM
  xplorer's Avatar 
xplorer xplorer is offline
 

X-Cart team
  
Join Date: Jul 2004
Posts: 925
 

Default Re: Ajax Requests

Yes, it is possible, but it depends on what you do.

You can't directly call a PHP method from JavaScript, but you can run an action in a controller class as follows:

Code:
core.post( URLHandler.buildURL({target: 'example', action: 'test'}), function(XMLHttpRequest, textStatus, data, valid) { } );

This will run \Xlite\Controller\[current-area]\Example::doActionTest().

Please could you explain the desired behavior in details?
Reply With Quote
  #3  
Old 09-26-2012, 08:02 AM
 
Cpt.Crashtastic Cpt.Crashtastic is offline
 

eXpert
  
Join Date: Jan 2006
Posts: 219
 

Default Re: Ajax Requests

That gave me enough info to do what I wanted.

It was for a button to attach an image to an order.
__________________
Xcart 4.4.?
Xcart Next
Litecommerce with Drupal
http://www.corbywebworx.com

Custom Mods, Hosting and Support for Xcart-Next and LiteCommerce
Reply With Quote

The following user thanks Cpt.Crashtastic for this useful post:
xplorer (09-26-2012)
  #4  
Old 10-02-2012, 02:37 AM
  xplorer's Avatar 
xplorer xplorer is offline
 

X-Cart team
  
Join Date: Jul 2004
Posts: 925
 

Default Re: Ajax Requests

Here is a tutorial on working with AJAX requests:
https://github.com/litecommerce/core/wiki/How-to:-Working-with-AJAX
Reply With Quote
Reply
   X-Cart forums > X-Cart 5 > Modifying the design and features (X-Cart 5)


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 08:04 PM.

   

 
X-Cart forums © 2001-2020