Author Topic: store front api from extension  (Read 891 times)

Online talha

  • Newbie
  • *
  • Posts: 2
  • Karma: +2/-0
    • View Profile
store front api from extension
« 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   

Offline abolabo

  • core-developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 2072
  • Karma: +328/-13
  • web for all, all for web!
    • View Profile
    • AbanteCart
Re: store front api from extension
« Reply #1 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
“No one is useless in this world who lightens the burdens of another.”
― Charles Dickens

Online talha

  • Newbie
  • *
  • Posts: 2
  • Karma: +2/-0
    • View Profile
Re: store front api from extension
« Reply #2 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';
     }
}
« Last Edit: January 09, 2025, 09:18:46 AM by talha »

Offline abolabo

  • core-developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 2072
  • Karma: +328/-13
  • web for all, all for web!
    • View Profile
    • AbanteCart
Re: store front api from extension
« Reply #3 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()
“No one is useless in this world who lightens the burdens of another.”
― Charles Dickens

 

Powered by SMFPacks Social Login Mod