Jump to content

How to reuse Backend ajax function in frontend


bhargav1991

Recommended Posts

for eg:-

Their is a AdminProductsController in backed

which has a function -> ajaxProcessProductQuantity

 

Which performs different actions based on different action parameters

Consider our action is set_qty  (set the quantity of product)

 

url : http://abc.local/scadmin/ajax-tab.php

 

form data

  1. actionQty:
    set_qty
  2. id_product_attribute:
    46
  3. value:
    2
  4. ajaxProductQuantity:
    1
  5. id_product:
    8
  6. token:
    d7593819beca03b651c5e04a14f58da1
  7. ajax:
    1
  8. controller:
    AdminProducts
  9. action:
    productQuantity
When this url is hit by logging in to backend it gives a response (sets the product quantity)
once logged out it gives login page as a response
 
I want make an ajax call to the above url from frontend so that seller can set the product quantity and also want to provide an api for mobile application ?
 
 
 
At the moment it gives me a login page as response when i hit the above url from frontend.
 

 

 

Link to comment
Share on other sites

Probably better explain what exactly you want to achieve. Your explanation lets much room for interpretation. Who is "seller"? Is it you or a shop owner?

 

Admin calls are mostly not supposed to be used in front end. If you use them, you need an admin beeing logged in. If you change this behavior, you are going to risk 3rd parties are going to use functionality in a way you don't want to!

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...