ClavoLike
Prestashop Developer
Vipul Hadiya is an Indian expert Prestahop and Wordpress developer having 4+ years of experience of working with clients of almost 22 countries around the world.
At Konjali
P.O. Box: 364290
Mahuva, Gujarat
364290
India
vip@vipulhadiya.com
09712670188
DOB: 07/27/1991

Working with AJAX in PrestaShop

Data submission with form element is little weird in PrestaShop hence it is always a good idea to submit data using AJAX method. Not only submission but getting data from the database or any other source by AJAX is also an efficient way to handling data in PrestaShop. Here is the complete video tutorial with coding capture. Go through the tutorial and you will be able to handle AJAX request in both ways, sending and receiving.


Working with AJAX in PrestaShop

In this tutorial, we will enter ID of a category. Then submit that ID using AJAX on button click and we will fetch the list of products in that particular category. In this tutorial, just for fun, I gave the name of the module as “Deadpool” and “Logan” is the name of admin controller. Now follow the steps as below. But before going ahead note that this is the 8th part of the series and 2nd part of this Deadpool module. You can check previous video tutorials on my YouTube Channel.

  1. Take a textbox and a button in the template file of logan controller which is placed at /modules/deadpool/views/templates/admin/deadpool/logan/logan.tpl
     
  2. Our next step is to send id of category  via AJAX request to ajax.php file which is placed at  /modules/deadpool/ajax.php Here is the code of ajax.php file
     
  3. To send and receive data via ajax we need to write jQuery code. Here I attached code of logan.js
  4. Code for AdminDeadpoolLoganController.php
     
  5. Finally here is the code of module file deadpool.php
     

About Vipul Hadiya

Vipul Hadiya is full time Prestashop and Wordpress Developer. Active at both job and freelancing on Upwork.com (formerly oDesk). He has interest to share Prestahsop tutorials for beginners.

Leave a Reply

Your email address will not be published. Required fields are marked *

*