/** * Sends product to Fortnox API * * @access public * @param $productId * @internal param int $productId */ public function send_product_to_fortnox($productId) { include_once "class-woo-fortnox-controller.php"; $controller = new WC_Fortnox_Controller(); $controller->send_product_to_fortnox($productId); }
function sync_product_callback() { global $wpdb; // this is how you get access to the database include_once "class-woo-fortnox-controller.php"; check_ajax_referer('fortnox_woocommerce', 'security'); $controller = new WC_Fortnox_Controller(); $message = $controller->send_product_to_fortnox($_POST['product_id']); echo json_encode($message); die; // this is required to return a proper result }
<?php require_once 'wp-load.php'; include_once 'wp-content/plugins/woocommerce-fortnox-integration/class-woo-fortnox-controller.php'; $fortnox_interface = new WC_Fortnox_Controller(); $fortnox_interface->run_inventory_cron_job();