Jump to content

Adding new order via AJAX POST call


Recommended Posts

Hi everyone. I'm trying to simplify the checkout process in my Prestashop by removing almost the all fields, payments and delivery choosing. All I want to keep is three fields – Name, Phone Number and Address. I’d also want to skip confirmation page.

Unfortunately I don’t familiar with PHP. I really tried to figure it but with no luck. So I decided to implement it with JS. Is it possible to make an AJAX call from JavaScript and create an order this way? Basically, I need to know the URL I need to call if that possible.

Link to comment
Share on other sites

I dont sure but you cant do with ajax calls 

 

The order is the controller more difficult to change and you need to change a lot to do that

 

Star with the 1 page orden to have all on one page with javascript you can hide some options but dont sure you can do only that without change the php files

Link to comment
Share on other sites

I dont sure but you cant do with ajax calls 

 

The order is the controller more difficult to change and you need to change a lot to do that

 

Star with the 1 page orden to have all on one page with javascript you can hide some options but dont sure you can do only that without change the php files

Well, I tried this. I hidden all the fields I don't want, but the existing implementation doesn't allow me to do it simple. You still need to type Email and Password, because this is pseudo "guest checkout" - guest account anyway saves in a DB. I don't want it at all. What could be simpler than just collect data from three input fields and send them within the order with minor validation?

Maybe there is a .PHP function that I can use to trigger order saving from PHP by handling some button click? Or it's very difficult too?

Edited by Billy Z. (see edit history)
Link to comment
Share on other sites

You need go to the controller class to check the process

 

You are going to need overriden these class. You need code because is not a direct way to do these

Could you give me a tip about the checkout algorithm?

When the guest types his info and clicks save - a new DB entry will be create?

What happens next, when user clicks on chosen payment method? In my case it's "Cash on delivery".

Link to comment
Share on other sites

Ok you need check these files

 

 

controllers/front/OrderController.php    if you use a 5 steps checkout

 

controllers/front/OrderOpcController.php    if you use a 1 step checkout  (These is help with javascript file in themes/YOURTHEME/js/order-opc.js)

 

 

These are the controller you need to follow the code to understand the process 

Link to comment
Share on other sites

Ok you need check these files

 

 

controllers/front/OrderController.php    if you use a 5 steps checkout

 

controllers/front/OrderOpcController.php    if you use a 1 step checkout  (These is help with javascript file in themes/YOURTHEME/js/order-opc.js)

 

 

These are the controller you need to follow the code to understand the process 

Thanks! Which one controller is for confirmation page? You know, when user filled the form and clicked on payment method.

 

p.s. I'm using one step checkouck

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...