updateQuantity(); } /** * Generate ICML file */ function generate_icml() { if ( ! class_exists( 'WC_Retailcrm_Icml' ) ) { include_once( check_custom_icml() ); } $icml = new WC_Retailcrm_Icml(); $icml->generate(); } /** * Create order * * @param $order_id */ function retailcrm_process_order($order_id) { if ( ! class_exists( 'WC_Retailcrm_Orders' ) ) { include_once( check_custom_orders() ); } $order_class = new WC_Retailcrm_Orders(); $order_class->orderCreate($order_id); } /** * Update order status * * @param $order_id */ function retailcrm_update_order_status($order_id) { if ( ! class_exists( 'WC_Retailcrm_Orders' ) ) { include_once( check_custom_orders() ); } $order_class = new WC_Retailcrm_Orders(); $order_class->orderUpdateStatus($order_id); } /** * Update order payment * * @param $order_id */ function retailcrm_update_order_payment($order_id) { if ( ! class_exists( 'WC_Retailcrm_Orders' ) ) { include_once( check_custom_orders() ); } $order_class = new WC_Retailcrm_Orders(); $order_class->orderUpdatePayment($order_id); } /** * Update order items * * @param $order_id, $data */ function retailcrm_update_order_items($order_id, $data) { if ( ! class_exists( 'WC_Retailcrm_Orders' ) ) { include_once( check_custom_orders() ); } $order_class = new WC_Retailcrm_Orders(); $order_class->orderUpdateItems($order_id, $data); } function retailcrm_history_get() { if ( ! class_exists( 'WC_Retailcrm_History' ) ) { include_once( check_custom_history() ); } $history_class = new WC_Retailcrm_History(); $history_class->getHistory(); } function create_customer($customer_id) { if ( ! class_exists( 'WC_Retailcrm_Customers' ) ) { include_once( check_custom_customers() ); } $customer_class = new WC_Retailcrm_Customers(); $customer_class->createCustomer($customer_id); } function update_customer($customer_id) { if ( ! class_exists( 'WC_Retailcrm_Customers' ) ) { include_once( check_custom_customers() ); } $customer_class = new WC_Retailcrm_Customers(); $customer_class->updateCustomer($customer_id); } function register_icml_generation() { // Make sure this event hasn't been scheduled if( !wp_next_scheduled( 'retailcrm_icml' ) ) { // Schedule the event wp_schedule_event( time(), 'three_hours', 'retailcrm_icml' ); } } function register_retailcrm_history() { // Make sure this event hasn't been scheduled if( !wp_next_scheduled( 'retailcrm_history' ) ) { // Schedule the event wp_schedule_event( time(), 'five_minutes', 'retailcrm_history' ); } } function check_inventories() { if( !wp_next_scheduled( 'retailcrm_inventories' ) ) { // Schedule the event wp_schedule_event( time(), 'fiveteen_minutes', 'retailcrm_inventories' ); } } function filter_cron_schedules($param) { return array( 'five_minutes' => array( 'interval' => 300, // seconds 'display' => __('Every 5 minutes') ), 'three_hours' => array( 'interval' => 10800, // seconds 'display' => __('Every 3 hours') ), 'fiveteen_minutes' => array( 'interval' => 900, // seconds 'display' => __('Every 15 minutes') ) ); } function upload_to_crm() { if ( ! class_exists( 'WC_Retailcrm_Orders' ) ) { include_once( check_custom_orders() ); } if ( ! class_exists( 'WC_Retailcrm_Customers' ) ) { include_once( check_custom_customers() ); } $options = array_filter(get_option( 'woocommerce_integration-retailcrm_settings' )); $orders = new WC_Retailcrm_Orders(); $customers = new WC_Retailcrm_Customers(); $customers->customersUpload(); $orders->ordersUpload(); $options['uploads'] = 'yes'; update_option('woocommerce_integration-retailcrm_settings', $options); } function ajax_upload() { $ajax_url = admin_url('admin-ajax.php'); ?> updateOrder($order_id); } function initialize_analytics() { $options = array_filter(get_option( 'woocommerce_integration-retailcrm_settings' )); if (isset($options['ua']) && $options['ua'] == 'yes') { ?> get_items() as $item) { $uid = ($item['variation_id'] > 0) ? $item['variation_id'] : $item['product_id'] ; $_product = wc_get_product($uid); if ($_product) { $order_item = array( 'id' => $uid, 'name' => $item['name'], 'price' => (float)$_product->get_price(), 'quantity' => $item['qty'], ); } $order_items[] = $order_item; } $url = parse_url(get_site_url()); $domain = $url['host']; ?>