Hi Robert,
thanks for your reply. i can add them manually but the Senetic.php file isnt triggered. I would of thought the addon would do this on installation automatically.
the init.php
<?php
if (!defined('BOOTSTRAP')) { die('Access denied'); }
fn_register_hooks('shippings_get_services_post');
//file_put_contents(__DIR__ . '/init_debug.txt', "✅ init.php ran\n", FILE_APPEND);
i can see the debug init file generated
func.php i dont see the hook executed
<?php
if (!defined('BOOTSTRAP')) { die('Access denied'); }
//file_put_contents(__DIR__ . '/func_check.txt', "✅ func.php loaded\n", FILE_APPEND);
function fn_senetic_shipping_live_shippings_get_services_post(&$services)
{
file_put_contents(__DIR__ . '/hook_debug_fn.txt', "✅ Hook executed\n", FILE_APPEND);
$services['senetic'] = [
'name' => 'senetic',
'description' => 'Senetic Live Shipping',
'rate_calculation' => 'r',
'service_code' => 'senetic',
'sp_file' => 'Senetic',
'dependencies' => ['zipcode', 'country', 'weight', 'subtotal'],
];
}
services.php i dont see the scheme_debug.txt file been generated as a debug method to see if its triggered.
<?php
file_put_contents(fn_get_files_dir_path() . 'senetic_schema_debug.txt', "✅ schema loaded\n", FILE_APPEND);
return [
'senetic' => [ // This key should match 'service_code' and the class name (Senetic)
'name' => __('senetic'),
'description' => __('senetic_live_shipping_description'),
'rate_calculation' => 'R',
'service_code' => 'senetic',
'sp_file' => 'Senetic',
'status' => 'A',
'display_info' => [
'name' => __('senetic'),
],
'settings' => [
'auth_token' => [
'title' => __('senetic_auth_token'),
'type' => 'input',
'default' => '',
'tooltip' => __('senetic_auth_token_tooltip'),
'required' => true,
],
// You can add more settings here if you want to make other parameters
// of your request body configurable (e.g., isTesting, default payment method)
],
'dependencies' => ['zipcode', 'country', 'weight', 'subtotal'],
'tracking_url' => '',
]
];
Senetic.php in Tygh folder of the addon
<?php
namespace Tygh\Shippings\Services;
use Tygh\Shippings\IService;
use Tygh\Shippings\Service;
use Tygh\Http;
use Tygh\Registry;
class Senetic extends Service implements IService
{
// Logic
}
I would prefer if the addon installation done all the inserts into the DB automatically.
If anyone can see anything wrong with my approach please let me know.
Thanks