* @author HamidReza Gharahzadeh * @author Sepehr Najafi */ class Ssbhesabix_Admin_Display { /** * Ssbhesabix_Admin_Display constructor. */ public function __construct() { add_action('admin_menu', array(__CLASS__, 'hesabix_add_menu')); } /** * Hook in methods * @since 1.0.0 * @access static */ /** * @since 1.0.0 * @access public */ static function hesabix_add_menu() { $iconUrl = plugins_url('/hesabix-accounting/admin/img/menu-icon.png'); add_menu_page("حسابیکس", "حسابیکس", "manage_options", "ssbhesabix-option", array(__CLASS__, 'hesabix_plugin_page'), $iconUrl, null); add_submenu_page("ssbhesabix-option", "تنظیمات حسابیکس", "تنظیمات حسابیکس", "manage_options", 'ssbhesabix-option', array(__CLASS__, 'hesabix_plugin_page')); } function hesabix_plugin_sync_products_manually() { $page = $_GET["p"]; $rpp = $_GET["rpp"]; if (isset($_GET['data'])) { $data = $_GET["data"]; $codesNotFoundInHesabix = explode(",", $data); } //set default values to page and rpp if (!$page) $page = 1; if (!$rpp) $rpp = 10; $result = self::getProductsAndRelations($page, $rpp); $pageCount = ceil($result["totalCount"] / $rpp); $i = ($page - 1) * $rpp; $rpp_options = [10, 15, 20, 30, 50]; $showTips = true; if (!isset($_COOKIE['syncProductsManuallyHelp'])) { setcookie('syncProductsManuallyHelp', 'ture'); } else { $showTips = false; } self::hesabix_plugin_header(); ?>

همسان سازی دستی کالاهای فروشگاه با حسابیکس مشاهده نکات مهم

# ID نام کالا شناسه محصول کد حسابیکس
ID; ?> post_title; ?> sku; ?>
| | برو < صفحه قبل صفحه بعد >
get_results("SELECT id_hesabix FROM " . $wpdb->prefix . "ssbhesabix WHERE obj_type = 'product' GROUP BY id_hesabix HAVING COUNT(id_hesabix) > 1;"); $rows = $wpdb->get_results( "SELECT id_hesabix FROM {$wpdb->prefix}ssbhesabix WHERE obj_type = 'product' GROUP BY id_hesabix HAVING COUNT(id_hesabix) > 1" ); $ids = array(); foreach ($rows as $row) $ids[] = $row->id_hesabix; $idsStr = implode(',', $ids); //$rows = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "ssbhesabix WHERE obj_type = 'product' AND id_hesabix IN ($idsStr) ORDER BY id_hesabix"); $rows = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}ssbhesabix WHERE obj_type = 'product' AND id_hesabix IN ($idsStr) ORDER BY id_hesabix" ) ); $i = 0; self::hesabix_plugin_header(); ?>
کد محصولات تکراری
# کد حسابیکس شناسه محصول شناسه متغیر
id_hesabix; ?> id_ps; ?> id_ps_attribute; ?>
ابزارهای افزونه حسابیکس
حذف دیتای افزونه
نصب دیتای افزونه
get_results("SELECT post.ID,post.post_title,post.post_parent,post_excerpt,wc.sku FROM `" . $wpdb->prefix . "posts` as post // LEFT OUTER JOIN `" . $wpdb->prefix . "wc_product_meta_lookup` as wc // ON post.id = wc.product_id // WHERE post.post_type IN('product','product_variation') AND post.post_status IN('publish','private') // ORDER BY post.post_title ASC LIMIT $offset,$rpp"); $rows = $wpdb->get_results( $wpdb->prepare( "SELECT post.ID, post.post_title, post.post_parent, post.post_excerpt, wc.sku FROM {$wpdb->posts} AS post LEFT OUTER JOIN {$wpdb->prefix}wc_product_meta_lookup AS wc ON post.ID = wc.product_id WHERE post.post_type IN ('product', 'product_variation') AND post.post_status IN ('publish', 'private') ORDER BY post.post_title ASC LIMIT %d, %d", $offset, $rpp ) ); // $totalCount = $wpdb->get_var("SELECT COUNT(*) FROM `" . $wpdb->prefix . "posts` as post // LEFT OUTER JOIN `" . $wpdb->prefix . "wc_product_meta_lookup` as wc // ON post.id = wc.product_id // WHERE post.post_type IN('product','product_variation') AND post.post_status IN('publish','private')"); $totalCount = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->posts} AS post LEFT OUTER JOIN {$wpdb->prefix}wc_product_meta_lookup AS wc ON post.ID = wc.product_id WHERE post.post_type IN ('product', 'product_variation') AND post.post_status IN ('publish', 'private')" ); // $links = $wpdb->get_results("SELECT * FROM `" . $wpdb->prefix . "ssbhesabix` // WHERE obj_type ='product'"); $links = $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}ssbhesabix WHERE obj_type = 'product'" ); foreach ($rows as $r) { if ($r->post_excerpt) $r->post_title = $r->post_title . ' [' . $r->post_excerpt . ']'; } foreach ($links as $link) { foreach ($rows as $r) { if ($r->ID == $link->id_ps && $link->id_ps_attribute == 0) { $r->id_hesabix = $link->id_hesabix; } else if ($r->ID == $link->id_ps_attribute) { $r->id_hesabix = $link->id_hesabix; } } } return array("data" => $rows, "totalCount" => $totalCount); } //======================================================================================================================================== /** * @since 1.0.0 * @access public */ public static function hesabix_plugin_page() { $iconsArray = ['home', 'cog', 'box-open', 'users', 'file-invoice-dollar', 'money-check-alt', 'file-export', 'sync-alt', 'file-alt', 'cog']; if (in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_option('active_plugins')))) { $setting_tabs = apply_filters('ssbhesabix_setting_tab', array( 'home' => __('Home', 'ssbhesabix'), 'api' => __('API', 'ssbhesabix'), 'catalog' => __('Catalog', 'ssbhesabix'), 'customers' => __('Customers', 'ssbhesabix'), 'invoice' => __('Invoice', 'ssbhesabix'), 'payment' => __('Payment Methods', 'ssbhesabix'), 'export' => __('Import and export data', 'ssbhesabix'), 'sync' => __('Sync', 'ssbhesabix'), 'log' => __('Log', 'ssbhesabix'), 'extra' => __('Extra Settings', 'ssbhesabix') )); $current_tab = (isset($_GET['tab'])) ? wc_clean($_GET['tab']) : 'home'; self::hesabix_plugin_header(); ?> $setting_tabvalue) { switch ($setting_tabkey) { case $current_tab: do_action('ssbhesabix_' . $setting_tabkey . '_setting_save_field'); do_action('ssbhesabix_' . $setting_tabkey . '_setting'); break; } } } else { echo '
' . __('Hesabix Plugin requires the WooCommerce to work!, Please install/activate woocommerce and try again', 'ssbhesabix') . '
'; } } //======================================================================================================================================== public static function hesabix_plugin_header() { $logoUrl = plugins_url('/hesabix-accounting/admin/img/hesabix-logo.fa.png'); ?>