AbanteCart Community

AbanteCart Development => API Development => Topic started by: talha on January 01, 2025, 04:18:50 AM

Title: store front api from extension
Post by: talha on January 01, 2025, 04:18:50 AM
hi there, i have developed an extension for Teapplix.
case scenario: when order confirmed extension will send order information to teapplix. and similarly teapplix will send return back order updated information to our system via api.
extension is developed and sending order information to teapplix and what issue i am facing is the api url i created (where teapplix will send back order updated information) is giving the error the page you requested can not be found! .
please help how to create api url in extension
also i have added the file path in main.php file   
Title: Re: store front api from extension
Post by: abolabo on January 09, 2025, 07:07:21 AM
please post path to your controller or even part of main.php with it.
This route must be a name of your controller class
Title: Re: store front api from extension
Post by: talha on January 09, 2025, 09:17:10 AM
$controllers = [
    'storefront' => [
        'extension/teapplix/notify'
    ],
    'admin'      => [],
];
this is main.php file's code
and this controller name ControllerExtensionTeapplixNotify
and this is file path where notify controller exists extensions/teapplix/storefront/controller/extension/teapplix/notify.php

class ControllerExtensionTeapplixNotify extends AController {
    public function index() {
      echo 'notify index function';
     }
}
Title: Re: store front api from extension
Post by: abolabo on January 13, 2025, 06:01:13 AM
should be:
1. $controllers = array(
    'storefront' => array(
        'responses/extension/teapplix/notify'
    ),
);
Also move file to this route.
AbanteCart have only 5 types on controllers: common, blocks, pages, responses and task. If you create new one please place it into controller type directory first.
2. rename index() method to main()