Plugin Directory

Changeset 3129751


Ignore:
Timestamp:
08/01/2024 09:53:43 PM (19 months ago)
Author:
hasanyuksektepe
Message:

3.0.9

Location:
wc-trendyol
Files:
180 added
1 deleted
7 edited

Legend:

Unmodified
Added
Removed
  • wc-trendyol/trunk/README.txt

    r3127678 r3129751  
    33Donate link: https://www.patreon.com/fullstackdev/
    44Tags: Woocommerce, Trendyol, Trendyol Entegrasyon, Entegrasyon, Pazaryeri
    5 Requires at least: 6.6
    6 Tested up to: 6.6
    7 Stable tag: 3.0.8
     5Requires at least: 6.6.1
     6Tested up to: 6.6.1
     7Stable tag: 3.0.9
    88Requires PHP: 7.4
    99License: GPLv2 or later
     
    3333- <a href="https://hayatikodla.net/entegrasyon/trendyol/">Trendyol Woocommerce Trendyol müşterisini siteye çekme</a>
    3434
     35## ÜCRETSİZ EKLENTİ AYARLARI
     36
    3537https://www.youtube.com/watch?v=alAq4xD4QoE
     38
     39## ÜRÜN AKTARMA
     40
     41https://www.youtube.com/watch?v=6nBpYcvg8Jo
    3642
    3743== Installation ==
     
    8894== Changelog ==
    8995
     96= 3.0.9 =
     97* Toplu fiyat düzenleme hataları düzeltildi
     98* Ürün sıralama hatası düzeltildi
     99
    90100= 3.0.8 =
    91101* Ürün aktarma hatası giderildi
    92102* Sayfalama hataları düzeltildi
    93 
    94 = 3.0.7 =
    95 * Toplu fiyat düzenleme
    96 * Hatalar düzeltildi
    97 
    98 = 3.0.6 =
    99 * %0 KDV güncellemesi
    100 * Kategori bazlı fiyat ayarlaması
    101 * Fiyat yazım hatası otomatik düzeltme
    102 
    103 = 3.0.5 =
    104 * Trendyol api güncellemesi
  • wc-trendyol/trunk/admin/assets/js/bulk_product_processes.js

    r3122649 r3129751  
    88        $(me).prop('disabled', true)
    99
     10        var wc_cat_id               = $('select.wc_cat_id').val();
    1011        var wc_product_id           = $(this).data('wc_product_id');
    1112        var trendyol_product_title  = $(' .trendyol_product_title', parent).val();
     
    1920        var data = {
    2021            'action': 'wc_trendyol_bulk_product_processes_save_line',
     22            wc_cat_id,
    2123            wc_product_id,
    2224            trendyol_product_title,
     
    278280
    279281                var data = {
    280                     'action': 'wc_trendyol_change_all_wc_cat_website_product_price',
     282                    'action': 'wc_trendyol_change_all_website_product_price',
    281283                    wc_trendyol_change_website_price_value_input,
    282284                    wc_trendyol_change_website_price_action_input,
     
    390392                            confirmButtonText: 'Tamam',
    391393                            allowOutsideClick: false,
    392                             allowEscapeKey: false,
    393                             didOpen: () => {
     394                            allowEscapeKey   : false,
     395                            didOpen          : () => {
    394396                                // Confirm butonunu başlangıçta devre dışı bırak
    395397                                const confirmButton = Swal.getConfirmButton();
    396                                 if (confirmButton) {
     398                                if(confirmButton){
    397399                                    confirmButton.disabled = true;
    398400                                    confirmButton.classList.add('swal2-disabled'); // Butonu görsel olarak devre dışı bırak
     
    401403                                // 5 saniye sonra butonu etkinleştir
    402404                                setTimeout(() => {
    403                                     if (confirmButton) {
     405                                    if(confirmButton){
    404406                                        confirmButton.disabled = false;
    405407                                        confirmButton.classList.remove('swal2-disabled'); // Stil sınıfını kaldır
     
    473475                            confirmButtonText: 'Tamam',
    474476                            allowOutsideClick: false,
    475                             allowEscapeKey: false,
    476                             didOpen: () => {
     477                            allowEscapeKey   : false,
     478                            didOpen          : () => {
    477479                                // Confirm butonunu başlangıçta devre dışı bırak
    478480                                const confirmButton = Swal.getConfirmButton();
    479                                 if (confirmButton) {
     481                                if(confirmButton){
    480482                                    confirmButton.disabled = true;
    481483                                    confirmButton.classList.add('swal2-disabled'); // Butonu görsel olarak devre dışı bırak
     
    484486                                // 5 saniye sonra butonu etkinleştir
    485487                                setTimeout(() => {
    486                                     if (confirmButton) {
     488                                    if(confirmButton){
    487489                                        confirmButton.disabled = false;
    488490                                        confirmButton.classList.remove('swal2-disabled'); // Stil sınıfını kaldır
  • wc-trendyol/trunk/admin/assets/js/wc_trendyol_general.js

    r3127678 r3129751  
    7171    $(document).on('input', '.just_int', function(event){
    7272        var value = $(this).val();
    73         var regex = /^[1-9]\d*$/;
     73        var regex = /^[0-9]\d*$/;
    7474        if(!regex.test(value)){
    7575            $(this).val(value.slice(0, -1));
     
    8080        var value = $(this).val();
    8181        value     = value.replace(',', '.');
    82         var regex = /^[1-9]\d*(\.\d{0,2})?$/;
     82        var regex = /^[0-9]\d*(\.\d{0,2})?$/;
    8383        if(!regex.test(value)){
    8484            $(this).val(value.slice(0, -1));
  • wc-trendyol/trunk/admin/class-wc-trendyol-admin.php

    r3127678 r3129751  
    284284        }
    285285
    286         public function wc_trendyol_wc_all_products($cat = false, $just_trendyol_barcode = false, $page = 0, $line_count = 5, $all_product_list = false){
     286        public function wc_trendyol_wc_all_products($cat = false, $just_trendyol_barcode = false, $page = 0, $line_count = 5, $all_product_list = false, $stock_status = null, $post_status = null){
    287287            global $wpdb;
    288288
     
    302302            }
    303303
    304             $sub_sql      = "
     304            $sub_sql = "
    305305                    WITH RECURSIVE ProductHierarchy AS (
    306306                        (SELECT
     
    310310                            ".(isset($sql_cat) and (is_numeric($sql_cat)) ? "tt.term_taxonomy_id AS category_id," : "")."
    311311                            p.post_type,
    312                             ( SELECT meta_value FROM ".$wpdb->prefix."postmeta WHERE meta_key = '_sku' AND post_id = p.ID LIMIT 1) AS SKU
     312                            ( SELECT meta_value FROM ".$wpdb->prefix."postmeta WHERE meta_key = '_sku' AND post_id = p.ID LIMIT 1) AS SKU,
     313                            ( SELECT meta_value FROM ".$wpdb->prefix."postmeta WHERE meta_key = '_stock' AND post_id = p.ID LIMIT 1) AS STOCK
    313314                        FROM
    314315                            ".$wpdb->prefix."posts AS p
     
    317318                            p.post_type IN ( 'product', 'product_variation' )
    318319                            AND p.post_parent = 0
    319                            
     320                            ".((isset($post_status)) ? "AND p.post_status IN('".$post_status."')" : "")."
    320321                            ".($sql_text ?? '')."
    321322                            ".(($all_product_list === true) ? '' : "LIMIT ".$line_count." OFFSET ".($page * $line_count))."
     
    330331                            ".((isset($sql_cat) and is_numeric($sql_cat)) ? "ph.category_id," : "")."
    331332                            p.post_type,
    332                             ( SELECT meta_value FROM ".$wpdb->prefix."postmeta WHERE meta_key = '_sku' AND post_id = p.ID LIMIT 1) AS SKU
     333                            ( SELECT meta_value FROM ".$wpdb->prefix."postmeta WHERE meta_key = '_sku' AND post_id = p.ID LIMIT 1) AS SKU,
     334                            ( SELECT meta_value FROM ".$wpdb->prefix."postmeta WHERE meta_key = '_stock' AND post_id = p.ID LIMIT 1) AS STOCK
    333335                        FROM
    334336                            ".$wpdb->prefix."posts AS p
     
    343345                            post_parent,
    344346                            post_type,
    345                             SKU
     347                            SKU,
     348                            STOCK
    346349                    FROM ProductHierarchy
    347                     ORDER BY post_title
     350                    ".((isset($stock_status) and $stock_status == 'in_stock') ? "HAVING STOCK > 0" : ((isset($stock_status) and $stock_status=='not_in_stock')?"HAVING STOCK = 0":""))."
     351                    ORDER BY COALESCE(NULLIF(post_parent, 0), id), post_parent, id;
    348352                    ";
    349353            $all_products = null;
  • wc-trendyol/trunk/admin/inc/wc_trendyol_ajax_processes.php

    r3122649 r3129751  
    555555
    556556                    $html_body .= '<tr style="background:'.($product_type == 'variable' ? '#fff' : '#eee').';">';
    557                     $html_body .= '<td><a href="/wp-admin/post.php?post='.($parent_product_id).'&action=edit" target="_blank">'.($product_sku).'</a><br>'.mb_strtoupper(rtrim($attr_text, '| '), 'utf8').'</td>';
     557                    $html_body .= '<td><a href="/wp-admin/post.php?post='.($product_type == 'variable' ? $parent_product_id : $product_id).'&action=edit" target="_blank">'.($product_sku).'</a><br>'.mb_strtoupper(rtrim($attr_text, '| '), 'utf8').'</td>';
    558558                    $html_body .= '<td><input type="text" name="'.$product_id.'[trendyol_product_title]" class="trendyol_product_title" value="'.($get_trendyol_product_title).'" '.($product_type == 'variable' ? 'disabled' : '').' required></td>';
    559559                    $html_body .= '<td><input type="text" step="1" min="0" name="'.$product_id.'[website_stock_qty]" class="website_stock_qty just_int" value="'.($product_stock).'" '.($product_type == 'variable' ? 'disabled' : '').' ></td>';
     
    564564                    $html_body .= '<td><input type="text" step="1" min="0" name="'.$product_id.'[trendyol_discount_price]" class="trendyol_discount_price just_float" value="'.($get_trendyol_discount_price).'" '.($product_type == 'variable' ? 'disabled' : '').' ></td>';
    565565                    $html_body .= '<td style="text-align: center; z-index:'.(count($products) - $r_id).'">';
    566                     $html_body .= '<button class="wc_trendyol_btn wc_trendyol_bulk_product_processes_save_btn" data-wc_product_id="'.($product_id).'" data-tooltip="true" data-tooltip_text="Değişiklikleri Kayıt Et"><i class="fa-solid fa-floppy-disk"></i></button>';
     566                    if($product_type != 'variable'){
     567                        $html_body .= '<button class="wc_trendyol_btn wc_trendyol_bulk_product_processes_save_btn" data-wc_product_id="'.($product_id).'" data-tooltip="true" data-tooltip_text="Değişiklikleri Kayıt Et"><i class="fa-solid fa-floppy-disk"></i></button>';
     568                    }else{
     569                        $html_body .= 'Ana ürüne işlem yapılamaz';
     570                    }
    567571                    $html_body .= '</td>';
    568572                    $html_body .= '</tr>';
     
    848852        public function wc_trendyol_bulk_product_processes_save_line(){
    849853
     854            $wc_cat_id               = esc_attr($_POST['wc_cat_id']);
    850855            $wc_product_id           = esc_attr($_POST['wc_product_id']);
    851856            $trendyol_product_title  = esc_attr($_POST['trendyol_product_title']);
     
    857862            $trendyol_discount_price = esc_attr($_POST['trendyol_discount_price']);
    858863
    859             if(empty($website_stock_qty)){
    860                 $results = [
    861                     'status'  => 'danger',
    862                     'message' => 'Lütfen ürünün web site fiyatını giriniz'
    863                 ];
    864                 goto results;
    865             }
    866 
    867864            $results = $this->wc_trendyol_bulk_product_processes_save_one_product($trendyol_product_title, $wc_product_id, $website_stock_qty, $trendyol_stock_qty, $website_sale_price, $website_discount_price, $trendyol_sale_price, $trendyol_discount_price);
    868865
     
    10761073            if(strlen($value_input) > 0 and $value_input > 0){
    10771074
    1078                 $get_this_cat_products = $trendyol_admin->wc_trendyol_wc_all_products();
     1075                $get_this_cat_products = $trendyol_admin->wc_trendyol_wc_all_products(null, false, 0, 10000);
    10791076                foreach($get_this_cat_products as $get_this_cat_product){
    10801077
     
    11511148                if(strlen($value_input) > 0 and $value_input > 0){
    11521149
    1153                     $get_this_cat_products = $trendyol_admin->wc_trendyol_wc_all_products($wc_cat_id);
     1150                    $get_this_cat_products = $trendyol_admin->wc_trendyol_wc_all_products($wc_cat_id, false, 0, 10000);
    11541151                    foreach($get_this_cat_products as $get_this_cat_product){
    11551152
    1156                         $old_regular_price = (float)$trendyol_metas->get_meta_trendyol_sale_price($get_this_cat_product->id); //İNDİRİMSİZ FİYAT
    1157                         $old_sale_price    = (float)$trendyol_metas->get_meta_trendyol_discount_price($get_this_cat_product->id); //İNDİRİMLİ FİYAT
     1153                        $old_regular_price = $trendyol_metas->get_meta_trendyol_sale_price($get_this_cat_product->id); //İNDİRİMSİZ FİYAT
     1154                        $old_sale_price    = $trendyol_metas->get_meta_trendyol_discount_price($get_this_cat_product->id); //İNDİRİMLİ FİYAT
     1155
     1156                        $get_wc_product = wc_get_product($get_this_cat_product->id);
     1157
     1158                        if(is_null($old_regular_price)){
     1159                            $old_regular_price = $get_wc_product->get_regular_price(); //İNDİRİMSİZ FİYAT
     1160                        }
     1161
     1162                        if(is_null($old_sale_price)){
     1163                            $old_sale_price = $get_wc_product->get_sale_price(); //İNDİRİML FİYAT
     1164                        }
    11581165
    11591166                        if(!empty($old_regular_price)){
     
    12301237                foreach($get_this_cat_products as $get_this_cat_product){
    12311238
    1232 
    1233                     $old_regular_price = (float)$trendyol_metas->get_meta_trendyol_sale_price($get_this_cat_product->id); //İNDİRİMSİZ FİYAT
    1234                     $old_sale_price    = (float)$trendyol_metas->get_meta_trendyol_discount_price($get_this_cat_product->id); //İNDİRİMLİ FİYAT
     1239                    $old_regular_price = $trendyol_metas->get_meta_trendyol_sale_price($get_this_cat_product->id); //İNDİRİMSİZ FİYAT
     1240                    $old_sale_price    = $trendyol_metas->get_meta_trendyol_discount_price($get_this_cat_product->id); //İNDİRİMLİ FİYAT
     1241
     1242                    $get_wc_product = wc_get_product($get_this_cat_product->id);
     1243
     1244                    if(is_null($old_regular_price)){
     1245                        $old_regular_price = $get_wc_product->get_regular_price(); //İNDİRİMSİZ FİYAT
     1246                    }
     1247
     1248                    if(is_null($old_sale_price)){
     1249                        $old_sale_price = $get_wc_product->get_sale_price(); //İNDİRİML FİYAT
     1250                    }
    12351251
    12361252                    if(!empty($old_regular_price)){
     
    12701286                    'status'  => 'success',
    12711287                    'message' => 'Sitedeki tüm trendyol fiyatları güncellendi ama trendyol paneline hemen yansımaz. Lütfen kontrol ettikten sonra tümünü kaydet butonuna basın ve trendyol panelinde yansımasını sağlayın'
    1272                 ];
    1273 
    1274             }
    1275             else{
    1276                 $results = [
    1277                     'status'  => 'danger',
    1278                     'message' => 'Değer 0 dan küçük. Lütfen büyük bir değer girin.'
    1279                 ];
    1280             }
    1281 
    1282             results:
    1283             header('Content-Type: application/json; charset=utf-8');
    1284             echo json_encode($results ?? []);
    1285             wp_die();
    1286         }
    1287 
    1288         public function wc_trendyol_change_all_wc_cat_website_product_price(){
    1289             global $trendyol_admin;
    1290 
    1291             $value_input = esc_attr($_POST['wc_trendyol_change_website_price_value_input']);
    1292             $action      = esc_attr($_POST['wc_trendyol_change_website_price_action_input']);
    1293             $rate        = esc_attr($_POST['wc_trendyol_change_website_price_rate_input']);
    1294 
    1295             if(strlen($value_input) > 0 and $value_input > 0){
    1296 
    1297                 $get_this_cat_products = $trendyol_admin->wc_trendyol_wc_all_products();
    1298                 foreach($get_this_cat_products as $get_this_cat_product){
    1299 
    1300                     $wc_product = wc_get_product($get_this_cat_product->id);
    1301 
    1302                     $old_regular_price = (float)$wc_product->get_regular_price(); //İNDİRİMSİZ FİYAT
    1303                     $old_sale_price    = (float)$wc_product->get_sale_price(); //İNDİRİMLİ FİYAT
    1304 
    1305                     if(!empty($old_regular_price)){
    1306 
    1307                         $new_regular_price = 0;
    1308                         $new_sale_price    = 0;
    1309                         if($action === '-'){
    1310                             $value = $value_input * -1;
    1311                         }
    1312                         else{
    1313                             $value = $value_input;
    1314                         }
    1315 
    1316                         if($rate === 'sabit'){
    1317                             $new_regular_price = $old_regular_price + $value;
    1318                             $new_sale_price    = $old_sale_price + $value;
    1319                         }
    1320                         else if($rate === 'yuzde'){
    1321                             $new_regular_price = $old_regular_price + (($old_regular_price / 100) * $value);
    1322                             $new_sale_price    = $old_sale_price + (($old_sale_price / 100) * $value);
    1323                         }
    1324 
    1325                         $new_regular_price = number_format($new_regular_price, 2, '.', '');
    1326                         $new_sale_price    = number_format($new_sale_price, 2, '.', '');
    1327 
    1328                         $wc_product->set_regular_price($new_regular_price);
    1329 
    1330                         if(!empty($old_sale_price)){
    1331                             $wc_product->set_sale_price($new_sale_price);
    1332                         }
    1333 
    1334                         $wc_product->save();
    1335 
    1336                     }
    1337 
    1338                 }
    1339 
    1340                 $results = [
    1341                     'status'  => 'success',
    1342                     'message' => 'Bu kategorideki tüm ürünlerin web site fiyatları değişti. Sayfayı yenileyin ve kontrol edin'
    13431288                ];
    13441289
  • wc-trendyol/trunk/trendyol_inc/trendyol_metas.php

    r3122649 r3129751  
    103103
    104104        public function get_meta_trendyol_sale_price($wc_product_id){
    105             return get_post_meta($wc_product_id, 'wc_trendyol_sale_price', true);
     105            if(metadata_exists('post', $wc_product_id, 'wc_trendyol_sale_price')){
     106                return get_post_meta($wc_product_id, 'wc_trendyol_sale_price', true);
     107            }
     108            return null;
    106109        }
    107110
    108111        public function get_meta_trendyol_discount_price($wc_product_id){
    109             return get_post_meta($wc_product_id, 'wc_trendyol_discount_price', true);
     112            if(metadata_exists('post', $wc_product_id, 'wc_trendyol_discount_price')){
     113                return get_post_meta($wc_product_id, 'wc_trendyol_discount_price', true);
     114            }
     115            return null;
    110116        }
    111117
     
    244250        public function update_meta_trendyol_attr($wc_product_id, $attr_array = null){
    245251            if(!empty($attr_array)){
    246                 $attr = json_encode($attr_array,JSON_UNESCAPED_UNICODE);
     252                $attr = json_encode($attr_array, JSON_UNESCAPED_UNICODE);
    247253                return update_post_meta($wc_product_id, 'wc_trendyol_trenyol_cat_attr', $attr);
    248254            }
  • wc-trendyol/trunk/wc-trendyol.php

    r3127678 r3129751  
    1717     * Plugin URI:        https://https://hayatikodla.net
    1818     * Description:       Woocoommerce için trendyol eklentisi
    19      * Version:           3.0.8
     19     * Version:           3.0.9
    2020     * Requires at least: 6.5
    2121     * Requires PHP:      7.4
     
    3939     * Rename this for your plugin and update it as you release new versions.
    4040     */
    41     define('WC_TRENDYOL_VERSION', '3.0.8');
     41    define('WC_TRENDYOL_VERSION', '3.0.9');
    4242    if(!defined('WC_TRENDYOL_DIR_PATH')){
    4343        define('WC_TRENDYOL_DIR_PATH', __DIR__);
Note: See TracChangeset for help on using the changeset viewer.