Jump to content

 

sserena

Member Since 15 Sep 2007
Offline Last Active Sep 12 2016 03:36 PM
-----

#173173 Ajax response from controller

Posted by sserena on 08 December 2013 - 04:15 AM

I've never worked with microformats, but I know how I'd solve this:
  • Add your fields via hook to the admin
  • Add some javascript that makes use of $.ceAjax to send whatever you wanna send to PHP (see below)
  • Do whatever you want in PHP and attach your response to
    Registry::get('ajax')->assign('key', 'value');
    and
    exit;
    so it won't look for a template.
  • Use the callback of $.ceAjax to display the response in your template.
Here's a basic $.ceAjax function:

$.ceAjax('request', fn_url('dispatch.mode'), {
cache: false,
data: {'key': 'value','add': 'some more'},
callback: function(data) {
  // Do something with your data, such as $('#attach_me_here').append(data);
}
});

Hope this helps...


#173172 Different Prices depending on Location

Posted by sserena on 08 December 2013 - 03:52 AM

Should anyone ever stumble over this thread in search for the same functionality... I ended up creating a module which takes care of it (it's quite complex, due to some limitations of CsCart's internal structure). Feel free to contact me if you could make use of it...