Plugin Directory

Changeset 2846187

Timestamp:
01/10/2023 01:57:39 PM (19 months ago)
Author:
khorshidlab
Message:

Plugin Version 1.0.6

Location:
podro-wp
Files:
4 added
32 edited
1 copied

Legend:

Unmodified
Added
Removed
  • podro-wp/tags/1.0.6/README.txt

    r2839027 r2846187  
    55Tested up to: 6.1
    66Requires PHP: 7.2
    7 Stable tag: 1.0.5
     7Stable tag: 1.0.
    88License: GPLv3 or later
    99License URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    5959== Changelog ==
    6060
     61
     62
     63
     64
     65
    6166= 1.0.5 - 2022-12-25 =
    6267* Fix the cities js conflict in checkout page
  • podro-wp/tags/1.0.6/admin/Enqueue.php

    r2839027 r2846187  
    7676
    7777        if ( is_cart() || is_checkout() || is_wc_endpoint_url( 'edit-address' ) ) {
    78             $city_select_path = PODRO_PLUGIN_ROOT_URL . 'assets/js/cities.js';
     78
     79            if ( function_exists( 'PWS' ) || class_exists('PWS_Core') || in_array( 'persian-woocommerce-shipping/woocommerce-shipping.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
     80                $city_select_path = PODRO_PLUGIN_ROOT_URL . 'assets/js/cities.js';
     81            }else{
     82                $city_select_path = PODRO_PLUGIN_ROOT_URL . 'assets/js/only-podro-cities.js';
     83            }
     84
     85
     86
    7987            wp_enqueue_script(
    8088                'wc-city-select',
  • podro-wp/tags/1.0.6/admin/views/pages/api-key-settings.php

    r2835533 r2846187  
    22$credentials_status = get_option( 'podro_plugin_status' );
    33$credentials = get_option( 'podro_plugin_credentials', true );
     4
     5
     6
     7
    48
    59?>
     
    1317            <h1><?php  esc_html_e( 'تنظیمات عمومی پادرو', 'podro-wp' ) ?></h1>
    1418            <h3><?php  esc_html_e( 'پیکربندی اتصال به پادرو پین', 'podro-wp' ) ?></h3>
    15             <form class="wp_podro-config-form" method="post" action="<?php echo esc_url(admin_url( '/admin.php?page=' . PODRO_SLUG )); ?>">
     19            <form class="wp_podro-config-form" method="post" action="<?php echo esc_url(admin_url( '/admin.php?page=' . PODRO_SETTINGS_PAGE_SLUG )); ?>">
     20
    1621                <div class="pdo-box">
    1722                    <label for="pdo_email">ایمیل</label>
     
    2227                    <input type="password" name="pdo_password" id="pdo_password" autocomplete="off">
    2328                </div>
     29
     30
     31
     32
     33
    2434                <h3><?php  esc_html_e( 'تنظیمات فروشگاه', 'podro-wp' ) ?></h3>
     35
     36
     37
     38
    2539                <div class="pdo-box">
    2640
     
    2842                    <?php
    2943                    $provinces = \WP_PODRO\Engine\WooSetting::get_provinces();
    30                     echo "<select aria-label='شهر' class='wc-enhanced-select' id='podro_store_location' name='podro_store_location' style='width:325px;' >";
     44                    echo "<select aria-label='شهر' class='wc-enhanced-select' id='podro_store_' style='width:325px;' >";
    3145                    foreach($provinces as $province){
    3246                        echo "<optgroup label='".esc_attr($province['name'])."'>";
    3347                        foreach ($province['cities'] as $key=>$city)
    34                             if(get_option('woocommerce_store_city') == $key)
     48                            if(get_option('_store_city') == $key)
    3549                                echo "<option selected value='". esc_attr($key)."'>".esc_attr($city)."</option>";
    3650                            else
     
    4862                </div>
    4963                <div class="pdo-box">
    50                     <a class="get-api-key" href="https://podro.com/plugin-pin/" target="_blank" rel="noopener noreferrer"><?php  esc_html_e('دریافت کلید API', 'podro-wp'); ?></a>
     64                    <label for="pdo_address">آدرس</label>
     65                    <textarea name="podro_store_address" id="podro_store_address" ><?php  echo esc_attr( $store_address ?? '' )  ?></textarea>
    5166                </div>
    52                 <button type="submit" class="button button-primary" name="config_podro_api_key" value="1"><?php  esc_html_e( "ذخیره", 'podro-wp' ) ?></button>
     67                <button type="submit" class="button button-primary" name="config_podro_" value="1"><?php  esc_html_e( "ذخیره", 'podro-wp' ) ?></button>
    5368            </form>
    5469        </div>
  • podro-wp/tags/1.0.6/assets/css/admin.css

    r2835533 r2846187  
    1 @font-face{font-family:IRANSansX;font-style:normal;font-weight:bold;src:url("../fonts/woff/IRANSansX-bold.woff") format("woff"),url("../fonts/woff2/IRANSansX-bold.woff2") format("woff2")}@font-face{font-family:IRANSansX;font-style:normal;font-weight:normal;src:url("../fonts/woff/IRANSansX-regular.woff") format("woff"),url("../fonts/woff2/IRANSansX-regular.woff2") format("woff2")}.pod-wrap,.toplevel_page_podro-wp,.pdo-wrapper,#woocommerce-order-podro,#woocommerce-order-podro h2,.pod-wrap h1,.pod-wrap h2,.pod-wrap h3{font-family:IRANSansX}#adminmenu #toplevel_page_podro-wp>a img{width:18px}.pod-footer{background-color:#883df2;border-radius:5px;padding:15px;display:flex;align-items:center;max-width:1202px;width:calc(100% - 30px);color:#fff}.pod-footer .pod-footer-links{width:70%;float:left}.pod-footer .pod-footer-links ul{width:100%}.pod-footer .pod-footer-links ul li{display:inline-block;margin-inline-end:15px;margin-bottom:0}.pod-footer .pod-footer-links ul li a{color:#fff;opacity:.7;text-decoration:none !important}.pod-footer .pod-footer-social{width:30%;float:right}.pod-footer .pod-footer-social .footer__social-icons{float:right;width:180px;text-align:left;direction:ltr;flex-direction:row;justify-content:space-between;display:flex}.pod-footer .pod-footer-social .footer__social-icons .footer__social-icons__link{display:block}.pod-footer .pod-footer-social .footer__social-icons .footer__social-icons__link svg{width:30px;height:30px}.pdo-wrapper{max-width:1232px;width:100%}.pdo-wrapper .pdo-card{max-width:1232px;width:calc(100% - 48px);background:#fff;background-color:#fff;box-shadow:0 2px 5px rgba(0,0,0,0.05);border-radius:5px;padding:24px;margin-bottom:20px}.pdo-box{width:390px;display:flex;align-items:center;justify-content:space-between;margin-bottom:12px}.pdo-box label{display:inline-block;height:22px;cursor:pointer;font-weight:bold}.pdo-box input{width:325px;text-align:left;direction:ltr}.pdo-box .get-api-key{display:block;width:100%;text-align:right;margin-top:10px;text-decoration:none !important}pre.xdebug-var-dump{margin-left:320px}.delivery_options{display:flex;margin-bottom:10px}.delivery_options .delivery_option{display:flex;align-items:center;flex-direction:column;padding:16px 12px;margin-bottom:10px;border:solid #bcbcbc 1px;border-radius:10px;margin-right:16px;width:136px}.delivery_options .delivery_option label{text-align:center}.delivery_options .delivery_option img{max-height:28px}ul.pod-delivery-step{display:flex;flex-direction:column;align-items:center;justify-content:center;margin-bottom:20px;margin-top:0}ul.pod-delivery-step li{display:flex;flex-direction:column;width:100%}ul.pod-delivery-step li.pod-dimension{background:#efefef;padding:10px;width:calc(100% - 20px);flex-wrap:wrap;flex-direction:row;margin-top:10px}ul.pod-delivery-step li.pod-dimension p{margin-top:0;width:100%}ul.pod-delivery-step li.pod-dimension>div{display:flex;flex-direction:column;width:33.33%}.pod-delivery-step-button{display:flex;align-items:center;justify-content:center;margin-top:10px;margin-bottom:10px;width:100%;max-width:100%;max-height:100%;cursor:pointer;background-color:#883df2;color:#fff;border:none;border-radius:5px;padding:10px;font-size:14px;font-weight:bold;text-decoration:none !important}.pod-delivery-cancel{display:flex;align-items:center;justify-content:center;margin-top:10px;margin-bottom:10px;width:100%;max-width:100%;max-height:100%;cursor:pointer;background-color:#b1b1b1;color:#fff;border:none;border-radius:5px;padding:10px;font-size:14px;font-weight:bold;text-decoration:none !important}.pod-delivery-step-2-wrapper{display:flex;flex-direction:column}.pod-delivery-step-2-wrapper .pod-delivery-step-2-option{display:flex;flex-direction:row;flex-wrap:wrap;width:calc( 100% - 40px);align-items:center;margin-bottom:12px;border-radius:12px;background-color:#f3f3f3;padding:20px;border:solid 1px transparent;cursor:pointer}.pod-delivery-step-2-wrapper .pod-delivery-step-2-option input{margin-left:10px}.pod-delivery-step-2-wrapper .pod-delivery-step-2-option.active{border:solid 1px #893df2;box-shadow:0px 0px 11px -1px #893df24d}.pod-delivery-step-2-wrapper .pod-delivery-step-2-option.active:checked::before{background-color:#883df2}.pod-delivery-step-2-wrapper .pod-delivery-step-2-option label .pod_delivery_option,.pod-delivery-step-2-wrapper .pod-delivery-step-2-option label .pod_pickup_option{display:flex;align-items:center;flex-wrap:wrap}.pod-delivery-step-2-wrapper .pod-delivery-step-2-option label img{max-width:50px;max-height:40px;margin-left:4px}.pod-delivery-step-2-wrapper .pod-delivery-step-2-option label>p{flex:1 1 100%;margin:4px 0}.pod-pickup-step-3-option-wrapper,.pod-delivery-step-3-option-wrapper{display:flex;flex-wrap:wrap}.pod-pickup-step-3-option-wrapper .pod-pickup-step-3-option,.pod-pickup-step-3-option-wrapper .pod-delivery-step-3-option,.pod-delivery-step-3-option-wrapper .pod-pickup-step-3-option,.pod-delivery-step-3-option-wrapper .pod-delivery-step-3-option{padding:10px;margin-inline-end:10px;margin-bottom:10px;box-shadow:0px 0px 11px -1px #893df24d;border-radius:6px;cursor:pointer}.pod-pickup-step-3-option-wrapper .pod-pickup-step-3-option input,.pod-pickup-step-3-option-wrapper .pod-delivery-step-3-option input,.pod-delivery-step-3-option-wrapper .pod-pickup-step-3-option input,.pod-delivery-step-3-option-wrapper .pod-delivery-step-3-option input{display:none}.pod-pickup-step-3-option-wrapper .pod-pickup-step-3-option.active,.pod-pickup-step-3-option-wrapper .pod-delivery-step-3-option.active,.pod-delivery-step-3-option-wrapper .pod-pickup-step-3-option.active,.pod-delivery-step-3-option-wrapper .pod-delivery-step-3-option.active{border:solid 1px #893df2;box-shadow:0px 0px 11px -1px #893df24d}.pod-hide{display:none}.pod-show{display:block}.pod-flex{display:flex}.rtl .delivery_options .delivery_option label{margin:0 0 0 16px}select[name="pod_delivery_option_day"]{display:block;width:100%;margin-bottom:20px}#woocommerce-order-podro .inside{padding-top:12px}#woocommerce-order-podro #loading-circle{display:none;position:absolute;top:0;bottom:0;left:0;right:0;margin:auto;width:50px;height:50px;border:8px solid #f3f3f3;border-top:8px solid #893df2;border-radius:50%;animation:spin 0.6s ease-in infinite}#woocommerce-order-podro #lock-modal{display:none;background-color:#06282e9e;opacity:1;position:absolute;top:-6px;left:0;right:0;bottom:0}#woocommerce-order-podro h3,#woocommerce-order-podro h4{margin-top:0}input.pod-error,select.pod-error{border:solid 1px #ff0000}.pod_order_details{width:100%}.pod_order_details tbody tr td{padding:10px;background-color:#efefef}.pod_order_details tbody tr th{padding:2px 10px;background-color:#caa3ff}.pdo-about{font-size:18px}.rtl .pod-footer .pod-footer-social{float:left}.rtl .pod-footer .pod-footer-social .footer__social-icons{float:left}#get_order_pdf,.get_order_pdf,#pod-cancel-order,.pod-cancel-order{cursor:pointer}
     1@font-face{font-family:IRANSansX;font-style:normal;font-weight:bold;src:url("../fonts/woff/IRANSansX-bold.woff") format("woff"),url("../fonts/woff2/IRANSansX-bold.woff2") format("woff2")}@font-face{font-family:IRANSansX;font-style:normal;font-weight:normal;src:url("../fonts/woff/IRANSansX-regular.woff") format("woff"),url("../fonts/woff2/IRANSansX-regular.woff2") format("woff2")}.pod-wrap,.toplevel_page_podro-wp,.pdo-wrapper,#woocommerce-order-podro,#woocommerce-order-podro h2,.pod-wrap h1,.pod-wrap h2,.pod-wrap h3{font-family:IRANSansX}#adminmenu #toplevel_page_podro-wp>a img{width:18px}.pod-footer{background-color:#883df2;border-radius:5px;padding:15px;display:flex;align-items:center;max-width:1202px;width:calc(100% - 30px);color:#fff}.pod-footer .pod-footer-links{width:70%;float:left}.pod-footer .pod-footer-links ul{width:100%}.pod-footer .pod-footer-links ul li{display:inline-block;margin-inline-end:15px;margin-bottom:0}.pod-footer .pod-footer-links ul li a{color:#fff;opacity:.7;text-decoration:none !important}.pod-footer .pod-footer-social{width:30%;float:right}.pod-footer .pod-footer-social .footer__social-icons{float:right;width:180px;text-align:left;direction:ltr;flex-direction:row;justify-content:space-between;display:flex}.pod-footer .pod-footer-social .footer__social-icons .footer__social-icons__link{display:block}.pod-footer .pod-footer-social .footer__social-icons .footer__social-icons__link svg{width:30px;height:30px}.pdo-wrapper{max-width:1232px;width:100%}.pdo-wrapper .pdo-card{max-width:1232px;width:calc(100% - 48px);background:#fff;background-color:#fff;box-shadow:0 2px 5px rgba(0,0,0,0.05);border-radius:5px;padding:24px;margin-bottom:20px}.pdo-box{width:390px;display:flex;align-items:center;justify-content:space-between;margin-bottom:12px}.pdo-box label{display:inline-block;height:22px;cursor:pointer;font-weight:bold}.pdo-box input{width:325px;text-align:left;direction:ltr}.pdo-box .get-api-key{display:block;width:100%;text-align:right;margin-top:10px;text-decoration:none !important}pre.xdebug-var-dump{margin-left:320px}.delivery_options{display:flex;margin-bottom:10px}.delivery_options .delivery_option{display:flex;align-items:center;flex-direction:column;padding:16px 12px;margin-bottom:10px;border:solid #bcbcbc 1px;border-radius:10px;margin-right:16px;width:136px}.delivery_options .delivery_option label{text-align:center}.delivery_options .delivery_option img{max-height:28px}ul.pod-delivery-step{display:flex;flex-direction:column;align-items:center;justify-content:center;margin-bottom:20px;margin-top:0}ul.pod-delivery-step li{display:flex;flex-direction:column;width:100%}ul.pod-delivery-step li.pod-dimension{background:#efefef;padding:10px;width:calc(100% - 20px);flex-wrap:wrap;flex-direction:row;margin-top:10px}ul.pod-delivery-step li.pod-dimension p{margin-top:0;width:100%}ul.pod-delivery-step li.pod-dimension>div{display:flex;flex-direction:column;width:33.33%}.pod-delivery-step-button{display:flex;align-items:center;justify-content:center;margin-top:10px;margin-bottom:10px;width:100%;max-width:100%;max-height:100%;cursor:pointer;background-color:#883df2;color:#fff;border:none;border-radius:5px;padding:10px;font-size:14px;font-weight:bold;text-decoration:none !important}.pod-delivery-cancel{display:flex;align-items:center;justify-content:center;margin-top:10px;margin-bottom:10px;width:100%;max-width:100%;max-height:100%;cursor:pointer;background-color:#b1b1b1;color:#fff;border:none;border-radius:5px;padding:10px;font-size:14px;font-weight:bold;text-decoration:none !important}.pod-delivery-step-2-wrapper{display:flex;flex-direction:column}.pod-delivery-step-2-wrapper .pod-delivery-step-2-option{display:flex;flex-direction:row;flex-wrap:wrap;width:calc( 100% - 40px);align-items:center;margin-bottom:12px;border-radius:12px;background-color:#f3f3f3;padding:20px;border:solid 1px transparent;cursor:pointer}.pod-delivery-step-2-wrapper .pod-delivery-step-2-option input{margin-left:10px}.pod-delivery-step-2-wrapper .pod-delivery-step-2-option.active{border:solid 1px #893df2;box-shadow:0px 0px 11px -1px #893df24d}.pod-delivery-step-2-wrapper .pod-delivery-step-2-option.active:checked::before{background-color:#883df2}.pod-delivery-step-2-wrapper .pod-delivery-step-2-option label .pod_delivery_option,.pod-delivery-step-2-wrapper .pod-delivery-step-2-option label .pod_pickup_option{display:flex;align-items:center;flex-wrap:wrap}.pod-delivery-step-2-wrapper .pod-delivery-step-2-option label img{max-width:50px;max-height:40px;margin-left:4px}.pod-delivery-step-2-wrapper .pod-delivery-step-2-option label>p{flex:1 1 100%;margin:4px 0}.pod-pickup-step-3-option-wrapper,.pod-delivery-step-3-option-wrapper{display:flex;flex-wrap:wrap}.pod-pickup-step-3-option-wrapper .pod-pickup-step-3-option,.pod-pickup-step-3-option-wrapper .pod-delivery-step-3-option,.pod-delivery-step-3-option-wrapper .pod-pickup-step-3-option,.pod-delivery-step-3-option-wrapper .pod-delivery-step-3-option{padding:10px;margin-inline-end:10px;margin-bottom:10px;box-shadow:0px 0px 11px -1px #893df24d;border-radius:6px;cursor:pointer}.pod-pickup-step-3-option-wrapper .pod-pickup-step-3-option input,.pod-pickup-step-3-option-wrapper .pod-delivery-step-3-option input,.pod-delivery-step-3-option-wrapper .pod-pickup-step-3-option input,.pod-delivery-step-3-option-wrapper .pod-delivery-step-3-option input{display:none}.pod-pickup-step-3-option-wrapper .pod-pickup-step-3-option.active,.pod-pickup-step-3-option-wrapper .pod-delivery-step-3-option.active,.pod-delivery-step-3-option-wrapper .pod-pickup-step-3-option.active,.pod-delivery-step-3-option-wrapper .pod-delivery-step-3-option.active{border:solid 1px #893df2;box-shadow:0px 0px 11px -1px #893df24d}.pod-hide{display:none}.pod-show{display:block}.pod-flex{display:flex}.rtl .delivery_options .delivery_option label{margin:0 0 0 16px}select[name="pod_delivery_option_day"]{display:block;width:100%;margin-bottom:20px}#woocommerce-order-podro .inside{padding-top:12px}#woocommerce-order-podro #loading-circle{display:none;position:absolute;top:0;bottom:0;left:0;right:0;margin:auto;width:50px;height:50px;border:8px solid #f3f3f3;border-top:8px solid #893df2;border-radius:50%;animation:spin 0.6s ease-in infinite}#woocommerce-order-podro #lock-modal{display:none;background-color:#06282e9e;opacity:1;position:absolute;top:-6px;left:0;right:0;bottom:0}#woocommerce-order-podro h3,#woocommerce-order-podro h4{margin-top:0}input.pod-error,select.pod-error{border:solid 1px #ff0000}.pod_order_details{width:100%}.pod_order_details tbody tr td{padding:10px;background-color:#efefef}.pod_order_details tbody tr th{padding:2px 10px;background-color:#caa3ff}.pdo-about{font-size:18px}.rtl .pod-footer .pod-footer-social{float:left}.rtl .pod-footer .pod-footer-social .footer__social-icons{float:left}#get_order_pdf,.get_order_pdf,#pod-cancel-order,.pod-cancel-order{cursor:pointer}
  • podro-wp/tags/1.0.6/assets/js/cities.js

    r2839027 r2846187  
    11jQuery(document).ready(function(){
    22
    3     jQuery('body').on('country_to_state_changed', function(p1,country){
    43
    5         if( 'IR' == country ){
    6             //
    7             jQuery('input#billing_city').replaceWith('<select id="billing_city" name="billing_city"></select>');
    8             jQuery('input#shipping_city').replaceWith('<select id="shipping_city" name="shipping_city"></select>');
    9             jQuery('select#billing_city').selectWoo();
    10             jQuery('select#shipping_city').selectWoo();
    11             getCities();
     4    const data = {
     5        action:'get_podro_cities',
     6        method:'post'
     7    }
     8    ajaxRequest(data, podro_cities_callback, null);
     9    let cities = [];
     10    function podro_cities_callback(response, element){
     11        cities = response;
     12
     13    }
     14
     15    jQuery('#billing_city').on('change', function(){
     16
     17        if( !is_this_podro_city(cities,jQuery(this).find('option:selected').text())){
     18            jQuery("[id*='podro_method']").prop('disabled', true);
     19            jQuery("[id*='podro_method']").prop('checked',false);
     20            jQuery("[id*='podro_method']").removeAttr('checked');
     21            const count = jQuery(this).find('#shipping_method input[type=radio]:checked').length;
     22            if(count > 0)
     23                return;
     24            if(!jQuery('#shipping_method input[type=radio]:checked').attr('id'))
     25                jQuery("[id*='podro_method']").parent().next('li').find("input[type=radio]").prop('checked',true);
    1226        }else{
    13             jQuery('#billing_city').parent().find('.select2').remove();
    14             jQuery('#shipping_city').parent().find('.select2').remove();
    15             jQuery('#billing_city').replaceWith('<input type="text" name="billing_city" id="billing_city" class="input-text "/>');
    16             jQuery('#shipping_city').replaceWith('<input type="text" name="shipping_city" id="shipping_city" class="input-text "/>');
     27            jQuery("[id*='podro_method']").prop('disabled',false);
     28
    1729        }
    1830    });
    1931
    20     function getCities(){
    21         jQuery('#billing_state, body').change(function(){
    22             const province_code = jQuery(this).val();
    23             const element = jQuery('#billing_city');
    24             if(!province_code)
     32    jQuery('body').on('updated_checkout', function() {
     33        if( !is_this_podro_city(cities,jQuery('#billing_city').find('option:selected').text())){
     34
     35            jQuery("[id*='podro_method']").prop('disabled', true);
     36            jQuery("[id*='podro_method']").prop('checked',false);
     37            jQuery("[id*='podro_method']").removeAttr('checked');
     38            const count = jQuery(this).find('#shipping_method input[type=radio]:checked').length;
     39            if(count > 0)
    2540                return;
    26             const data = {
    27                 action:'get_podro_cities_by_province',
    28                 //security: wp_podro_ajax_object.security,
    29                 province: province_code
    30             };
    3141
    32             ajaxRequest(data, callbackGetCities, element);
     42
     43            if(!jQuery('#shipping_method input[type=radio]:checked').attr('id'))
     44                jQuery("[id*='podro_method']").parent().next('li').find("input[type=radio]").prop('checked',true);
     45        }else{
     46            jQuery("[id*='podro_method']").prop('disabled',false);
     47
     48
     49        }
     50    });
     51
     52
     53    function is_this_podro_city(city_list, name){
     54
     55        let result = false;
     56        Object.keys(city_list).forEach(key => {
     57
     58            if(  city_list[key] === name ){
     59                result = true;
     60                return result;
     61            }
     62
    3363
    3464        });
     65
     66
    3567
    36         jQuery('#shipping_state, body').change(function(){
    37             const province_code = jQuery(this).val();
    38             const element = jQuery('#shipping_city');
    39             if(!province_code)
    40                 return;
    41             const data = {
    42                 action:'get_podro_cities_by_province',
    43                 //security: wp_podro_ajax_object.security,
    44                 province: province_code
    45             };
    46 
    47             ajaxRequest(data, callbackGetCities, element);
    48         });
    49 
    50     }
    5168
    5269    function callbackGetCities(response, element){
     
    5976
    6077        Object.keys(cities).forEach(function(key) {
    61             console.log('Key : ' + key + ', Value : ' + cities[key])
     78
    6279            element.append(`<option value='${key}'>${cities[key]}</option>`);
    6380
  • podro-wp/tags/1.0.6/inc/Api_Key.php

    r2835533 r2846187  
    7777    public static function set_pdo_api_key() {
    7878
    79         if( ! isset( $_POST[ 'config_podro_api_key' ] ) ) {
    80             return;
    81         }
    82         update_option('woocommerce_store_city', sanitize_text_field($_POST['podro_store_location']));
    83         $pdo_email = sanitize_email( $_POST[ 'pdo_email' ] );
    84         $pdo_password = sanitize_text_field( $_POST[ 'pdo_password' ] );
    85         if ( $pdo_email == null || $pdo_password == null || ( ! empty( $pdo_email ) && !empty( $pdo_password ) && $pdo_password === "**************" ) ) {
    86             add_action( 'admin_notices', function () {
    87                 echo wp_kses_post('<div class="notice notice-error is-dismissible">
     79
     80
     81        if(  isset( $_POST[ 'config_podro_api_key' ] ) ) {
     82            $pdo_email = sanitize_email( $_POST[ 'pdo_email' ] );
     83            $pdo_password = sanitize_text_field( $_POST[ 'pdo_password' ] );
     84            if ( $pdo_email == null || $pdo_password == null || ( ! empty( $pdo_email ) && !empty( $pdo_password ) && $pdo_password === "**************" ) ) {
     85                add_action( 'admin_notices', function () {
     86                    echo wp_kses_post('<div class="notice notice-error is-dismissible">
    8887                        <p>'. esc_html__( "لطفا موارد موردنیاز را وارد کنید.", 'podro-wp' ) .'</p>
     88
    8989                    </div>');
    90             } );
    91             return false;
    92         }
     90            } );
     91            return false;
     92        }
    9393
    94         if ( !$token = self::validate_api_key( $pdo_email, (new Encryption)->encrypt($pdo_password) ) ) {
    95             return false;
    96         }
     94        if ( !$token = self::validate_api_key( $pdo_email, (new Encryption)->encrypt($pdo_password) ) ) {
     95            return false;
     96        }
    9797
    98         $save_settings = update_option( 'podro_api_key', (new Encryption)->encrypt($token) );
     98        $save_settings = update_option( 'podro_api_key', (new Encryption)->encrypt($token) );
    9999
    100         if( $save_settings ) {
    101             update_option( 'podro_plugin_status', 'connected');
    102             update_option( 'podro_plugin_credentials', [
    103                 'email' => $pdo_email,
    104                 'password' => (new Encryption)->encrypt($pdo_password),
    105             ]);
     100        if( $save_settings ) {
     101            update_option( 'podro_plugin_status', 'connected');
     102            update_option( 'podro_plugin_credentials', [
     103                'email' => $pdo_email,
     104                'password' => (new Encryption)->encrypt($pdo_password),
     105            ]);
    106106
    107             wp_redirect( home_url( '/wp-admin/admin.php?page=' . PODRO_SLUG ) );
     107                wp_redirect( home_url( '/wp-admin/admin.php?page=' . PODRO_SETTINGS_PAGE_SLUG ) );
     108
     109                add_action( 'admin_notices', function () {
     110                    echo wp_kses_post('<div class="notice notice-success is-dismissible">
     111                        <p>'. esc_html__( "تنظیمات ذخیره شد.", 'wp-podro' ) .'</p>
     112                    </div>');
     113                } );
     114            }
     115        }else if( isset($_POST['config_podro_store_info']) ){
     116
     117            if( empty($_POST['podro_store_name']) || empty($_POST['podro_store_address']) ){
     118                add_action( 'admin_notices', function () {
     119                    echo wp_kses_post('<div class="notice notice-error is-dismissible">
     120                        <p>'. esc_html__( "نام فروشگاه، شهرو آدرس نمی تواند خالی باشد", 'wp-podro' ) .'</p>
     121                    </div>');
     122                } );
     123                return false;
     124            }
     125
     126            update_option('podro_store_name', sanitize_text_field($_POST['podro_store_name']??''));
     127            update_option('podro_store_city', sanitize_text_field($_POST['podro_store_city']??''));
     128            update_option('podro_store_address', sanitize_text_field($_POST['podro_store_address']??''));
     129
    108130
    109131            add_action( 'admin_notices', function () {
     
    111133                        <p>'. esc_html__( "تنظیمات ذخیره شد.", 'podro-wp' ) .'</p>
    112134                    </div>');
    113             } );
     135            });
    114136        }
     137
    115138
    116139    }
  • podro-wp/tags/1.0.6/inc/MetaBox.php

    r2839027 r2846187  
    136136        $woo_setting = WooSetting::get_instance();
    137137
    138         $source_city = $woo_setting->get_store_city_code_from_options();
     138
    139139        $order_id = $order->get_id();
    140140        $destination_city_code = $order->get_shipping_city();
     141
     142
     143
     144
     145
     146
     147
     148
    141149
    142150        $destination_city_name = (WooSetting::get_instance())->get_cities()[$destination_city_code];
     
    144152        if( mb_strlen($destination_address) > $this->address_length )
    145153            $destination_address = mb_substr($destination_address, 0, $this->address_length);
    146         $store_address = $woo_setting->get_store_city() . ' ' . get_option( 'woocommerce_store_address' ) . get_option( 'woocommerce_store_address_2' );
     154
     155
     156        $pod_source_city_code = $woo_setting->get_store_city_code_from_options();
     157        $pod_store_address =  mb_substr($woo_setting->get_store_city() . ' ' . $woo_setting->get_store_address() , 0 , $this->address_length) ;
     158        $pod_store_name =  mb_substr( $woo_setting->get_store_name(), 0, $this->store_name_length );
    147159
    148160        $total_weight = 0;
     
    183195        $user_billing_family = $order->get_billing_last_name();
    184196
    185         $store_name = $this->get_store_name();
     197
    186198        $customer_note = $order->get_customer_note();
    187199
    188         $option_pod_source_city = get_option('pod_source_city',false);
    189         $option_pod_store_name = get_option('pod_store_name',false);
    190 
    191         $option_pod_source_city = ( false == $option_pod_source_city ) ? $store_address : $option_pod_source_city;
    192         $option_pod_store_name = ( false == $option_pod_store_name ) ?  $store_name : $option_pod_store_name;
     200
     201
    193202
    194203
     
    198207            <li>
    199208                <label for="pod_store_name">نام فروشگاه</label>
    200                 <input type="text" name="pod_store_name" id="pod_store_name" maxlength="60" value="<?php echo esc_attr($option_pod_store_name); ?>"  />
     209                <input type="text" name="pod_store_name" id="pod_store_name" maxlength="60" value="<?php echo esc_attr($pod_store_name); ?>"  />
    201210            </li>
    202211            <li>
    203212                <label for="pod_source_city">مبدا</label>
    204                 <textarea name="pod_source_city" id="pod_source_city" rows="6"><?php echo esc_attr($option_pod_source_city); ?></textarea>
    205                 <?php if (empty($store_address)) echo '<p style="color:red">'. esc_html__('لطفا آدرس فروشگاه را از تنظیمات ووکامرس وارد کنید.', 'podro-wp') .'</p>' ; ?>
    206                 <input type="hidden" id="pod_source_city_code" name="pod_source_city_code" value="<?php echo esc_attr($source_city); ?>">
     213                <textarea name="pod_source_city" id="pod_source_city" rows="6"><?php echo esc_attr($); ?></textarea>
     214                <?php if (empty($store_address)) echo '<p style="color:red">'. esc_html__('لطفا آدرس فروشگاه را از تنظیمات ووکامرس وارد کنید.', 'podro-wp') .'</p>' ; ?>
     215                <input type="hidden" id="pod_source_city_code" name="pod_source_city_code" value="<?php echo esc_attr($); ?>">
    207216            </li>
    208217            <li>
  • podro-wp/tags/1.0.6/inc/Podro_Order_Table.php

    r2835533 r2846187  
    105105        foreach ($orders as $order){
    106106
    107             if ( $order['status'] == 'لغو شده') {
    108                 $cancel_order = 'از پیش لغو شده';
     107            if ( $order['status'] == 'درحال پردازش' ||
     108                $order['status'] == 'ثبت اولیه' ||
     109                $order['status'] == 'در حال بررسی تاخیر' ) {
     110                $cancel_order = '<a class="pod-cancel-order" data-order_id="' . $order['id'] . '">لغو ارسال</a>';
    109111            } else {
    110                 $cancel_order = '<a class="pod-cancel-order" data-order_id="' . $order['id'] . '">لغو ارسال</a>';
     112                $cancel_order = ;
    111113            }
    112114
  • podro-wp/tags/1.0.6/inc/Setup.php

    r2839027 r2846187  
    1717 * @link      https://github.com/KhorshidLab/WP-Podro
    1818 */
     19
     20
    1921use WP_PODRO\Admin\Enqueue;
    2022use WP_PODRO\Engine\API\V1\Payments;
     23
    2124
    2225class Setup {
     
    8588     * @access   private
    8689     */
     90
     91
     92
     93
     94
     95
     96
     97
     98
    8799    private function load_dependencies() {
    88100
     
    91103        $this->loader = new Loader();
    92104
    93         add_action('woocommerce_loaded', function(){
    94 
    95 
    96         // Disable Persian Woocommerce City Select
    97         if ( function_exists( 'PW' ) && PW()->get_options( 'enable_iran_cities' ) != 'no' ) {
    98             $settings                       = PW()->get_options();
    99             $settings['enable_iran_cities'] = 'no';
    100             update_option( 'PW_Options', $settings );
    101         }
    102 
    103         // Disable Persian Woocommerce shipping City Select
    104         if ( function_exists( 'PWS' ) || class_exists('PWS_Core') || in_array( 'persian-woocommerce-shipping/woocommerce-shipping.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
    105 
    106             $pws = \PWS_Core::instance();
    107 
    108 
    109             // Filters
    110             remove_filter( 'woocommerce_states', [ $pws, 'iran_states' ], 20, 1 );
    111             remove_filter( 'woocommerce_checkout_process', [ $pws, 'checkout_process' ], 20, 1 );
    112 
    113 
    114             add_action( 'wp_enqueue_scripts', function() {
    115                 wp_dequeue_script( 'pwsCheckout' );
    116             }, 999999 );
    117 
    118 
    119 
    120 }
    121 
    122         }, 21);
    123 
    124         if ( class_exists('WC_City_Select') ) {
    125 
    126             $WC_City_Select = new WC_City_Select;
    127 
    128             $this->loader->add_filter( 'woocommerce_billing_fields', $WC_City_Select, 'billing_fields', 999999, 2 );
    129             $this->loader->add_filter( 'woocommerce_shipping_fields', $WC_City_Select, 'shipping_fields', 999999, 2 );
    130             $this->loader->add_filter( 'woocommerce_form_field_city', $WC_City_Select, 'form_field_city', 999999, 4 );
    131 
    132         }
     105
     106
     107        add_action( 'wp_ajax_nopriv_get_podro_cities', [$this, 'podro_get_cities'] );
     108        add_action( 'wp_ajax_get_podro_cities', [$this, 'podro_get_cities'] );
     109
     110
    133111
    134112        $this->loader->add_action( 'admin_init', $Api_Key, 'set_pdo_api_key' );
     
    269247                __( 'تنظیمات', 'podro-wp' ),
    270248                'manage_options',
    271                 PODRO_SLUG . '-settings',
     249                PODRO_S,
    272250                [$this, 'settings_page'],
    273251            );
  • podro-wp/tags/1.0.6/inc/WooSetting.php

    r2827875 r2846187  
    356356            '0006'=>'ساوه',
    357357            '0005'=>'دلیجان',
    358             '0101'=>'آستارا',
    359             '0103'=>'بندرانزلی',
     358            '0101'=>'آستارا',
     359            '0103'=>'بندرانزلی',
    360360            '0105'=>'رشت',
    361361            '0111'=>'لاهیجان',
     
    367367            '0206'=>'رامسر',
    368368            '0207'=>'ساری',
    369             '0210'=>'قائم شهر',
     369            '0210'=>'قائمشهر',
    370370            '0214'=>'نور',
    371371            '0215'=>'نوشهر',
     
    392392            '0808'=>'کرمان',
    393393            '0908'=>'سبزوار',
    394             '0916'=>'مشهد',
     394            '0916'=>'مشهد',
    395395            '0917'=>'نیشابور',
    396396            '1002'=>'اصفهان',
    397397            '1009'=>'شهرضا',
    398398            '1010'=>'کاشان',
    399             '1018'=>'آران وبیدگل',
     399            '1018'=>'آران وبیدگل',
    400400            '1102'=>'چابهار',
    401401            '1105'=>'زاهدان',
     
    405405            '1401'=>'بروجن',
    406406            '1402'=>'شهرکرد',
    407             '1503'=>'خرم آباد',
     407            '1503'=>'خرمآباد',
    408408            '1601'=>'ایلام',
    409409            '1703'=>'گچساران',
    410             '1801'=>'بوشهر',
     410            '1801'=>'بوشهر',
    411411            '1810'=>'عسلویه',
    412412            '1901'=>'ابهر',
     
    419419            '2105'=>'یزد',
    420420            '2106'=>'میبد',
    421             '2202'=>'بندرعباس',
     421            '2202'=>'بندرعباس',
    422422            '2204'=>'قشم',
    423423            '2301'=>'تهران',
     
    430430            '2705'=>'گرگان',
    431431            '2710'=>'آزادشهر',
    432             '2706'=>'گنبدکاوس',
     432            '2706'=>'گنبدکاوس',
    433433            '2802'=>'بجنورد',
    434434            '2901'=>'بیرجند',
     
    442442    }
    443443
     444
     445
     446
     447
     448
     449
    444450    public function get_store_city(){
    445451        $current_city = $this->get_store_city_code_from_options();
     
    448454
    449455    public function get_store_city_code_from_options(){
    450         return get_option('woocommerce_store_city',0);
     456        return get_option('podro_store_city',0);
     457    }
     458
     459    public function get_store_address(){
     460        return get_option('podro_store_address', '');
     461    }
     462    public function get_store_name(){
     463        return get_option('podro_store_name', '');
    451464    }
    452465
  • podro-wp/tags/1.0.6/vendor/autoload.php

    r2839027 r2846187  
    1010require_once __DIR__ . '/composer/autoload_real.php';
    1111
    12 return ComposerAutoloaderInitb472f25f5c4461cfd343527deda3d097::getLoader();
     12return ComposerAutoloaderInit::getLoader();
  • podro-wp/tags/1.0.6/vendor/composer/autoload_classmap.php

    r2827875 r2846187  
    119119    'WP_PODRO\\Engine\\API\\V1\\Routes' => $baseDir . '/inc/API/V1/Routes.php',
    120120    'WP_PODRO\\Engine\\Api_Key' => $baseDir . '/inc/Api_Key.php',
     121
    121122    'WP_PODRO\\Engine\\Loader' => $baseDir . '/inc/Loader.php',
    122123    'WP_PODRO\\Engine\\Location' => $baseDir . '/inc/Location.php',
  • podro-wp/tags/1.0.6/vendor/composer/autoload_real.php

    r2839027 r2846187  
    33// autoload_real.php @generated by Composer
    44
    5 class ComposerAutoloaderInitb472f25f5c4461cfd343527deda3d097
     5class ComposerAutoloaderInit
    66{
    77    private static $loader;
     
    2525        require __DIR__ . '/platform_check.php';
    2626
    27         spl_autoload_register(array('ComposerAutoloaderInitb472f25f5c4461cfd343527deda3d097', 'loadClassLoader'), true, true);
     27        spl_autoload_register(array('ComposerAutoloaderInit', 'loadClassLoader'), true, true);
    2828        self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
    29         spl_autoload_unregister(array('ComposerAutoloaderInitb472f25f5c4461cfd343527deda3d097', 'loadClassLoader'));
     29        spl_autoload_unregister(array('ComposerAutoloaderInit', 'loadClassLoader'));
    3030
    3131        require __DIR__ . '/autoload_static.php';
    32         call_user_func(\Composer\Autoload\ComposerStaticInitb472f25f5c4461cfd343527deda3d097::getInitializer($loader));
     32        call_user_func(\Composer\Autoload\ComposerStaticInit::getInitializer($loader));
    3333
    3434        $loader->register(true);
  • podro-wp/tags/1.0.6/vendor/composer/autoload_static.php

    r2839027 r2846187  
    55namespace Composer\Autoload;
    66
    7 class ComposerStaticInitb472f25f5c4461cfd343527deda3d097
     7class ComposerStaticInit
    88{
    99    public static $prefixLengthsPsr4 = array (
     
    152152        'WP_PODRO\\Engine\\API\\V1\\Routes' => __DIR__ . '/../..' . '/inc/API/V1/Routes.php',
    153153        'WP_PODRO\\Engine\\Api_Key' => __DIR__ . '/../..' . '/inc/Api_Key.php',
     154
    154155        'WP_PODRO\\Engine\\Loader' => __DIR__ . '/../..' . '/inc/Loader.php',
    155156        'WP_PODRO\\Engine\\Location' => __DIR__ . '/../..' . '/inc/Location.php',
     
    166167    {
    167168        return \Closure::bind(function () use ($loader) {
    168             $loader->prefixLengthsPsr4 = ComposerStaticInitb472f25f5c4461cfd343527deda3d097::$prefixLengthsPsr4;
    169             $loader->prefixDirsPsr4 = ComposerStaticInitb472f25f5c4461cfd343527deda3d097::$prefixDirsPsr4;
    170             $loader->classMap = ComposerStaticInitb472f25f5c4461cfd343527deda3d097::$classMap;
     169            $loader->prefixLengthsPsr4 = ComposerStaticInit::$prefixLengthsPsr4;
     170            $loader->prefixDirsPsr4 = ComposerStaticInit::$prefixDirsPsr4;
     171            $loader->classMap = ComposerStaticInit::$classMap;
    171172
    172173        }, null, ClassLoader::class);
  • podro-wp/tags/1.0.6/vendor/composer/installed.php

    r2839027 r2846187  
    66        'install_path' => __DIR__ . '/../../',
    77        'aliases' => array(),
    8         'reference' => 'e61c7f2401dc8fba00d50b7d6356693315103128',
     8        'reference' => '',
    99        'name' => 'khorshid/wp_podro',
    1010        'dev' => true,
     
    3535            'install_path' => __DIR__ . '/../../',
    3636            'aliases' => array(),
    37             'reference' => 'e61c7f2401dc8fba00d50b7d6356693315103128',
     37            'reference' => '',
    3838            'dev_requirement' => false,
    3939        ),
  • podro-wp/tags/1.0.6/wp-podro.php

    r2839027 r2846187  
    1010 * Plugin URI:      https://khorshidlab.com/
    1111 * Description:     پادروپین؛ ‌مارکت‌پلیس خدمات پستی است و به فروشگاه‌های آنلاین کمک می‌��ند تا فرآیند ارسال سفارش‌های اینترنتی را مدیریت کنند. در پادروپین، بدون مراجعه و یا ثبت قرارداد با شرکت‌های پستی، می‌توان سفارش‌های اینترنتی را با هر یک از شرکت‌های پستی ارسال کرد
    12  * Version:         1.0.5
     12 * Version:         1.0.
    1313 * Author:          Khorshid, Podro
    1414 * Author URI:      https://khorshidlab.com/fa/
     
    3737 */
    3838
    39 define( 'PODRO_VERSION', '1.0.5' );
     39define( 'PODRO_VERSION', '1.0.' );
    4040define( 'PODRO_SLUG', 'podro-wp' );
     41
     42
    4143define( 'PODRO_NAME', 'WP PODRO' );
    4244define( 'PODRO_PLUGIN_ROOT', plugin_dir_path( __FILE__ ) );
  • podro-wp/trunk/README.txt

    r2839027 r2846187  
    55Tested up to: 6.1
    66Requires PHP: 7.2
    7 Stable tag: 1.0.5
     7Stable tag: 1.0.
    88License: GPLv3 or later
    99License URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    5959== Changelog ==
    6060
     61
     62
     63
     64
     65
    6166= 1.0.5 - 2022-12-25 =
    6267* Fix the cities js conflict in checkout page
  • podro-wp/trunk/admin/Enqueue.php

    r2839027 r2846187  
    7676
    7777        if ( is_cart() || is_checkout() || is_wc_endpoint_url( 'edit-address' ) ) {
    78             $city_select_path = PODRO_PLUGIN_ROOT_URL . 'assets/js/cities.js';
     78
     79            if ( function_exists( 'PWS' ) || class_exists('PWS_Core') || in_array( 'persian-woocommerce-shipping/woocommerce-shipping.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
     80                $city_select_path = PODRO_PLUGIN_ROOT_URL . 'assets/js/cities.js';
     81            }else{
     82                $city_select_path = PODRO_PLUGIN_ROOT_URL . 'assets/js/only-podro-cities.js';
     83            }
     84
     85
     86
    7987            wp_enqueue_script(
    8088                'wc-city-select',
  • podro-wp/trunk/admin/views/pages/api-key-settings.php

    r2835533 r2846187  
    22$credentials_status = get_option( 'podro_plugin_status' );
    33$credentials = get_option( 'podro_plugin_credentials', true );
     4
     5
     6
     7
    48
    59?>
     
    1317            <h1><?php  esc_html_e( 'تنظیمات عمومی پادرو', 'podro-wp' ) ?></h1>
    1418            <h3><?php  esc_html_e( 'پیکربندی اتصال به پادرو پین', 'podro-wp' ) ?></h3>
    15             <form class="wp_podro-config-form" method="post" action="<?php echo esc_url(admin_url( '/admin.php?page=' . PODRO_SLUG )); ?>">
     19            <form class="wp_podro-config-form" method="post" action="<?php echo esc_url(admin_url( '/admin.php?page=' . PODRO_SETTINGS_PAGE_SLUG )); ?>">
     20
    1621                <div class="pdo-box">
    1722                    <label for="pdo_email">ایمیل</label>
     
    2227                    <input type="password" name="pdo_password" id="pdo_password" autocomplete="off">
    2328                </div>
     29
     30
     31
     32
     33
    2434                <h3><?php  esc_html_e( 'تنظیمات فروشگاه', 'podro-wp' ) ?></h3>
     35
     36
     37
     38
    2539                <div class="pdo-box">
    2640
     
    2842                    <?php
    2943                    $provinces = \WP_PODRO\Engine\WooSetting::get_provinces();
    30                     echo "<select aria-label='شهر' class='wc-enhanced-select' id='podro_store_location' name='podro_store_location' style='width:325px;' >";
     44                    echo "<select aria-label='شهر' class='wc-enhanced-select' id='podro_store_' style='width:325px;' >";
    3145                    foreach($provinces as $province){
    3246                        echo "<optgroup label='".esc_attr($province['name'])."'>";
    3347                        foreach ($province['cities'] as $key=>$city)
    34                             if(get_option('woocommerce_store_city') == $key)
     48                            if(get_option('_store_city') == $key)
    3549                                echo "<option selected value='". esc_attr($key)."'>".esc_attr($city)."</option>";
    3650                            else
     
    4862                </div>
    4963                <div class="pdo-box">
    50                     <a class="get-api-key" href="https://podro.com/plugin-pin/" target="_blank" rel="noopener noreferrer"><?php  esc_html_e('دریافت کلید API', 'podro-wp'); ?></a>
     64                    <label for="pdo_address">آدرس</label>
     65                    <textarea name="podro_store_address" id="podro_store_address" ><?php  echo esc_attr( $store_address ?? '' )  ?></textarea>
    5166                </div>
    52                 <button type="submit" class="button button-primary" name="config_podro_api_key" value="1"><?php  esc_html_e( "ذخیره", 'podro-wp' ) ?></button>
     67                <button type="submit" class="button button-primary" name="config_podro_" value="1"><?php  esc_html_e( "ذخیره", 'podro-wp' ) ?></button>
    5368            </form>
    5469        </div>
  • podro-wp/trunk/assets/css/admin.css

    r2835533 r2846187  
    1 @font-face{font-family:IRANSansX;font-style:normal;font-weight:bold;src:url("../fonts/woff/IRANSansX-bold.woff") format("woff"),url("../fonts/woff2/IRANSansX-bold.woff2") format("woff2")}@font-face{font-family:IRANSansX;font-style:normal;font-weight:normal;src:url("../fonts/woff/IRANSansX-regular.woff") format("woff"),url("../fonts/woff2/IRANSansX-regular.woff2") format("woff2")}.pod-wrap,.toplevel_page_podro-wp,.pdo-wrapper,#woocommerce-order-podro,#woocommerce-order-podro h2,.pod-wrap h1,.pod-wrap h2,.pod-wrap h3{font-family:IRANSansX}#adminmenu #toplevel_page_podro-wp>a img{width:18px}.pod-footer{background-color:#883df2;border-radius:5px;padding:15px;display:flex;align-items:center;max-width:1202px;width:calc(100% - 30px);color:#fff}.pod-footer .pod-footer-links{width:70%;float:left}.pod-footer .pod-footer-links ul{width:100%}.pod-footer .pod-footer-links ul li{display:inline-block;margin-inline-end:15px;margin-bottom:0}.pod-footer .pod-footer-links ul li a{color:#fff;opacity:.7;text-decoration:none !important}.pod-footer .pod-footer-social{width:30%;float:right}.pod-footer .pod-footer-social .footer__social-icons{float:right;width:180px;text-align:left;direction:ltr;flex-direction:row;justify-content:space-between;display:flex}.pod-footer .pod-footer-social .footer__social-icons .footer__social-icons__link{display:block}.pod-footer .pod-footer-social .footer__social-icons .footer__social-icons__link svg{width:30px;height:30px}.pdo-wrapper{max-width:1232px;width:100%}.pdo-wrapper .pdo-card{max-width:1232px;width:calc(100% - 48px);background:#fff;background-color:#fff;box-shadow:0 2px 5px rgba(0,0,0,0.05);border-radius:5px;padding:24px;margin-bottom:20px}.pdo-box{width:390px;display:flex;align-items:center;justify-content:space-between;margin-bottom:12px}.pdo-box label{display:inline-block;height:22px;cursor:pointer;font-weight:bold}.pdo-box input{width:325px;text-align:left;direction:ltr}.pdo-box .get-api-key{display:block;width:100%;text-align:right;margin-top:10px;text-decoration:none !important}pre.xdebug-var-dump{margin-left:320px}.delivery_options{display:flex;margin-bottom:10px}.delivery_options .delivery_option{display:flex;align-items:center;flex-direction:column;padding:16px 12px;margin-bottom:10px;border:solid #bcbcbc 1px;border-radius:10px;margin-right:16px;width:136px}.delivery_options .delivery_option label{text-align:center}.delivery_options .delivery_option img{max-height:28px}ul.pod-delivery-step{display:flex;flex-direction:column;align-items:center;justify-content:center;margin-bottom:20px;margin-top:0}ul.pod-delivery-step li{display:flex;flex-direction:column;width:100%}ul.pod-delivery-step li.pod-dimension{background:#efefef;padding:10px;width:calc(100% - 20px);flex-wrap:wrap;flex-direction:row;margin-top:10px}ul.pod-delivery-step li.pod-dimension p{margin-top:0;width:100%}ul.pod-delivery-step li.pod-dimension>div{display:flex;flex-direction:column;width:33.33%}.pod-delivery-step-button{display:flex;align-items:center;justify-content:center;margin-top:10px;margin-bottom:10px;width:100%;max-width:100%;max-height:100%;cursor:pointer;background-color:#883df2;color:#fff;border:none;border-radius:5px;padding:10px;font-size:14px;font-weight:bold;text-decoration:none !important}.pod-delivery-cancel{display:flex;align-items:center;justify-content:center;margin-top:10px;margin-bottom:10px;width:100%;max-width:100%;max-height:100%;cursor:pointer;background-color:#b1b1b1;color:#fff;border:none;border-radius:5px;padding:10px;font-size:14px;font-weight:bold;text-decoration:none !important}.pod-delivery-step-2-wrapper{display:flex;flex-direction:column}.pod-delivery-step-2-wrapper .pod-delivery-step-2-option{display:flex;flex-direction:row;flex-wrap:wrap;width:calc( 100% - 40px);align-items:center;margin-bottom:12px;border-radius:12px;background-color:#f3f3f3;padding:20px;border:solid 1px transparent;cursor:pointer}.pod-delivery-step-2-wrapper .pod-delivery-step-2-option input{margin-left:10px}.pod-delivery-step-2-wrapper .pod-delivery-step-2-option.active{border:solid 1px #893df2;box-shadow:0px 0px 11px -1px #893df24d}.pod-delivery-step-2-wrapper .pod-delivery-step-2-option.active:checked::before{background-color:#883df2}.pod-delivery-step-2-wrapper .pod-delivery-step-2-option label .pod_delivery_option,.pod-delivery-step-2-wrapper .pod-delivery-step-2-option label .pod_pickup_option{display:flex;align-items:center;flex-wrap:wrap}.pod-delivery-step-2-wrapper .pod-delivery-step-2-option label img{max-width:50px;max-height:40px;margin-left:4px}.pod-delivery-step-2-wrapper .pod-delivery-step-2-option label>p{flex:1 1 100%;margin:4px 0}.pod-pickup-step-3-option-wrapper,.pod-delivery-step-3-option-wrapper{display:flex;flex-wrap:wrap}.pod-pickup-step-3-option-wrapper .pod-pickup-step-3-option,.pod-pickup-step-3-option-wrapper .pod-delivery-step-3-option,.pod-delivery-step-3-option-wrapper .pod-pickup-step-3-option,.pod-delivery-step-3-option-wrapper .pod-delivery-step-3-option{padding:10px;margin-inline-end:10px;margin-bottom:10px;box-shadow:0px 0px 11px -1px #893df24d;border-radius:6px;cursor:pointer}.pod-pickup-step-3-option-wrapper .pod-pickup-step-3-option input,.pod-pickup-step-3-option-wrapper .pod-delivery-step-3-option input,.pod-delivery-step-3-option-wrapper .pod-pickup-step-3-option input,.pod-delivery-step-3-option-wrapper .pod-delivery-step-3-option input{display:none}.pod-pickup-step-3-option-wrapper .pod-pickup-step-3-option.active,.pod-pickup-step-3-option-wrapper .pod-delivery-step-3-option.active,.pod-delivery-step-3-option-wrapper .pod-pickup-step-3-option.active,.pod-delivery-step-3-option-wrapper .pod-delivery-step-3-option.active{border:solid 1px #893df2;box-shadow:0px 0px 11px -1px #893df24d}.pod-hide{display:none}.pod-show{display:block}.pod-flex{display:flex}.rtl .delivery_options .delivery_option label{margin:0 0 0 16px}select[name="pod_delivery_option_day"]{display:block;width:100%;margin-bottom:20px}#woocommerce-order-podro .inside{padding-top:12px}#woocommerce-order-podro #loading-circle{display:none;position:absolute;top:0;bottom:0;left:0;right:0;margin:auto;width:50px;height:50px;border:8px solid #f3f3f3;border-top:8px solid #893df2;border-radius:50%;animation:spin 0.6s ease-in infinite}#woocommerce-order-podro #lock-modal{display:none;background-color:#06282e9e;opacity:1;position:absolute;top:-6px;left:0;right:0;bottom:0}#woocommerce-order-podro h3,#woocommerce-order-podro h4{margin-top:0}input.pod-error,select.pod-error{border:solid 1px #ff0000}.pod_order_details{width:100%}.pod_order_details tbody tr td{padding:10px;background-color:#efefef}.pod_order_details tbody tr th{padding:2px 10px;background-color:#caa3ff}.pdo-about{font-size:18px}.rtl .pod-footer .pod-footer-social{float:left}.rtl .pod-footer .pod-footer-social .footer__social-icons{float:left}#get_order_pdf,.get_order_pdf,#pod-cancel-order,.pod-cancel-order{cursor:pointer}
     1@font-face{font-family:IRANSansX;font-style:normal;font-weight:bold;src:url("../fonts/woff/IRANSansX-bold.woff") format("woff"),url("../fonts/woff2/IRANSansX-bold.woff2") format("woff2")}@font-face{font-family:IRANSansX;font-style:normal;font-weight:normal;src:url("../fonts/woff/IRANSansX-regular.woff") format("woff"),url("../fonts/woff2/IRANSansX-regular.woff2") format("woff2")}.pod-wrap,.toplevel_page_podro-wp,.pdo-wrapper,#woocommerce-order-podro,#woocommerce-order-podro h2,.pod-wrap h1,.pod-wrap h2,.pod-wrap h3{font-family:IRANSansX}#adminmenu #toplevel_page_podro-wp>a img{width:18px}.pod-footer{background-color:#883df2;border-radius:5px;padding:15px;display:flex;align-items:center;max-width:1202px;width:calc(100% - 30px);color:#fff}.pod-footer .pod-footer-links{width:70%;float:left}.pod-footer .pod-footer-links ul{width:100%}.pod-footer .pod-footer-links ul li{display:inline-block;margin-inline-end:15px;margin-bottom:0}.pod-footer .pod-footer-links ul li a{color:#fff;opacity:.7;text-decoration:none !important}.pod-footer .pod-footer-social{width:30%;float:right}.pod-footer .pod-footer-social .footer__social-icons{float:right;width:180px;text-align:left;direction:ltr;flex-direction:row;justify-content:space-between;display:flex}.pod-footer .pod-footer-social .footer__social-icons .footer__social-icons__link{display:block}.pod-footer .pod-footer-social .footer__social-icons .footer__social-icons__link svg{width:30px;height:30px}.pdo-wrapper{max-width:1232px;width:100%}.pdo-wrapper .pdo-card{max-width:1232px;width:calc(100% - 48px);background:#fff;background-color:#fff;box-shadow:0 2px 5px rgba(0,0,0,0.05);border-radius:5px;padding:24px;margin-bottom:20px}.pdo-box{width:390px;display:flex;align-items:center;justify-content:space-between;margin-bottom:12px}.pdo-box label{display:inline-block;height:22px;cursor:pointer;font-weight:bold}.pdo-box input{width:325px;text-align:left;direction:ltr}.pdo-box .get-api-key{display:block;width:100%;text-align:right;margin-top:10px;text-decoration:none !important}pre.xdebug-var-dump{margin-left:320px}.delivery_options{display:flex;margin-bottom:10px}.delivery_options .delivery_option{display:flex;align-items:center;flex-direction:column;padding:16px 12px;margin-bottom:10px;border:solid #bcbcbc 1px;border-radius:10px;margin-right:16px;width:136px}.delivery_options .delivery_option label{text-align:center}.delivery_options .delivery_option img{max-height:28px}ul.pod-delivery-step{display:flex;flex-direction:column;align-items:center;justify-content:center;margin-bottom:20px;margin-top:0}ul.pod-delivery-step li{display:flex;flex-direction:column;width:100%}ul.pod-delivery-step li.pod-dimension{background:#efefef;padding:10px;width:calc(100% - 20px);flex-wrap:wrap;flex-direction:row;margin-top:10px}ul.pod-delivery-step li.pod-dimension p{margin-top:0;width:100%}ul.pod-delivery-step li.pod-dimension>div{display:flex;flex-direction:column;width:33.33%}.pod-delivery-step-button{display:flex;align-items:center;justify-content:center;margin-top:10px;margin-bottom:10px;width:100%;max-width:100%;max-height:100%;cursor:pointer;background-color:#883df2;color:#fff;border:none;border-radius:5px;padding:10px;font-size:14px;font-weight:bold;text-decoration:none !important}.pod-delivery-cancel{display:flex;align-items:center;justify-content:center;margin-top:10px;margin-bottom:10px;width:100%;max-width:100%;max-height:100%;cursor:pointer;background-color:#b1b1b1;color:#fff;border:none;border-radius:5px;padding:10px;font-size:14px;font-weight:bold;text-decoration:none !important}.pod-delivery-step-2-wrapper{display:flex;flex-direction:column}.pod-delivery-step-2-wrapper .pod-delivery-step-2-option{display:flex;flex-direction:row;flex-wrap:wrap;width:calc( 100% - 40px);align-items:center;margin-bottom:12px;border-radius:12px;background-color:#f3f3f3;padding:20px;border:solid 1px transparent;cursor:pointer}.pod-delivery-step-2-wrapper .pod-delivery-step-2-option input{margin-left:10px}.pod-delivery-step-2-wrapper .pod-delivery-step-2-option.active{border:solid 1px #893df2;box-shadow:0px 0px 11px -1px #893df24d}.pod-delivery-step-2-wrapper .pod-delivery-step-2-option.active:checked::before{background-color:#883df2}.pod-delivery-step-2-wrapper .pod-delivery-step-2-option label .pod_delivery_option,.pod-delivery-step-2-wrapper .pod-delivery-step-2-option label .pod_pickup_option{display:flex;align-items:center;flex-wrap:wrap}.pod-delivery-step-2-wrapper .pod-delivery-step-2-option label img{max-width:50px;max-height:40px;margin-left:4px}.pod-delivery-step-2-wrapper .pod-delivery-step-2-option label>p{flex:1 1 100%;margin:4px 0}.pod-pickup-step-3-option-wrapper,.pod-delivery-step-3-option-wrapper{display:flex;flex-wrap:wrap}.pod-pickup-step-3-option-wrapper .pod-pickup-step-3-option,.pod-pickup-step-3-option-wrapper .pod-delivery-step-3-option,.pod-delivery-step-3-option-wrapper .pod-pickup-step-3-option,.pod-delivery-step-3-option-wrapper .pod-delivery-step-3-option{padding:10px;margin-inline-end:10px;margin-bottom:10px;box-shadow:0px 0px 11px -1px #893df24d;border-radius:6px;cursor:pointer}.pod-pickup-step-3-option-wrapper .pod-pickup-step-3-option input,.pod-pickup-step-3-option-wrapper .pod-delivery-step-3-option input,.pod-delivery-step-3-option-wrapper .pod-pickup-step-3-option input,.pod-delivery-step-3-option-wrapper .pod-delivery-step-3-option input{display:none}.pod-pickup-step-3-option-wrapper .pod-pickup-step-3-option.active,.pod-pickup-step-3-option-wrapper .pod-delivery-step-3-option.active,.pod-delivery-step-3-option-wrapper .pod-pickup-step-3-option.active,.pod-delivery-step-3-option-wrapper .pod-delivery-step-3-option.active{border:solid 1px #893df2;box-shadow:0px 0px 11px -1px #893df24d}.pod-hide{display:none}.pod-show{display:block}.pod-flex{display:flex}.rtl .delivery_options .delivery_option label{margin:0 0 0 16px}select[name="pod_delivery_option_day"]{display:block;width:100%;margin-bottom:20px}#woocommerce-order-podro .inside{padding-top:12px}#woocommerce-order-podro #loading-circle{display:none;position:absolute;top:0;bottom:0;left:0;right:0;margin:auto;width:50px;height:50px;border:8px solid #f3f3f3;border-top:8px solid #893df2;border-radius:50%;animation:spin 0.6s ease-in infinite}#woocommerce-order-podro #lock-modal{display:none;background-color:#06282e9e;opacity:1;position:absolute;top:-6px;left:0;right:0;bottom:0}#woocommerce-order-podro h3,#woocommerce-order-podro h4{margin-top:0}input.pod-error,select.pod-error{border:solid 1px #ff0000}.pod_order_details{width:100%}.pod_order_details tbody tr td{padding:10px;background-color:#efefef}.pod_order_details tbody tr th{padding:2px 10px;background-color:#caa3ff}.pdo-about{font-size:18px}.rtl .pod-footer .pod-footer-social{float:left}.rtl .pod-footer .pod-footer-social .footer__social-icons{float:left}#get_order_pdf,.get_order_pdf,#pod-cancel-order,.pod-cancel-order{cursor:pointer}
  • podro-wp/trunk/assets/js/cities.js

    r2839027 r2846187  
    11jQuery(document).ready(function(){
    22
    3     jQuery('body').on('country_to_state_changed', function(p1,country){
    43
    5         if( 'IR' == country ){
    6             //
    7             jQuery('input#billing_city').replaceWith('<select id="billing_city" name="billing_city"></select>');
    8             jQuery('input#shipping_city').replaceWith('<select id="shipping_city" name="shipping_city"></select>');
    9             jQuery('select#billing_city').selectWoo();
    10             jQuery('select#shipping_city').selectWoo();
    11             getCities();
     4    const data = {
     5        action:'get_podro_cities',
     6        method:'post'
     7    }
     8    ajaxRequest(data, podro_cities_callback, null);
     9    let cities = [];
     10    function podro_cities_callback(response, element){
     11        cities = response;
     12
     13    }
     14
     15    jQuery('#billing_city').on('change', function(){
     16
     17        if( !is_this_podro_city(cities,jQuery(this).find('option:selected').text())){
     18            jQuery("[id*='podro_method']").prop('disabled', true);
     19            jQuery("[id*='podro_method']").prop('checked',false);
     20            jQuery("[id*='podro_method']").removeAttr('checked');
     21            const count = jQuery(this).find('#shipping_method input[type=radio]:checked').length;
     22            if(count > 0)
     23                return;
     24            if(!jQuery('#shipping_method input[type=radio]:checked').attr('id'))
     25                jQuery("[id*='podro_method']").parent().next('li').find("input[type=radio]").prop('checked',true);
    1226        }else{
    13             jQuery('#billing_city').parent().find('.select2').remove();
    14             jQuery('#shipping_city').parent().find('.select2').remove();
    15             jQuery('#billing_city').replaceWith('<input type="text" name="billing_city" id="billing_city" class="input-text "/>');
    16             jQuery('#shipping_city').replaceWith('<input type="text" name="shipping_city" id="shipping_city" class="input-text "/>');
     27            jQuery("[id*='podro_method']").prop('disabled',false);
     28
    1729        }
    1830    });
    1931
    20     function getCities(){
    21         jQuery('#billing_state, body').change(function(){
    22             const province_code = jQuery(this).val();
    23             const element = jQuery('#billing_city');
    24             if(!province_code)
     32    jQuery('body').on('updated_checkout', function() {
     33        if( !is_this_podro_city(cities,jQuery('#billing_city').find('option:selected').text())){
     34
     35            jQuery("[id*='podro_method']").prop('disabled', true);
     36            jQuery("[id*='podro_method']").prop('checked',false);
     37            jQuery("[id*='podro_method']").removeAttr('checked');
     38            const count = jQuery(this).find('#shipping_method input[type=radio]:checked').length;
     39            if(count > 0)
    2540                return;
    26             const data = {
    27                 action:'get_podro_cities_by_province',
    28                 //security: wp_podro_ajax_object.security,
    29                 province: province_code
    30             };
    3141
    32             ajaxRequest(data, callbackGetCities, element);
     42
     43            if(!jQuery('#shipping_method input[type=radio]:checked').attr('id'))
     44                jQuery("[id*='podro_method']").parent().next('li').find("input[type=radio]").prop('checked',true);
     45        }else{
     46            jQuery("[id*='podro_method']").prop('disabled',false);
     47
     48
     49        }
     50    });
     51
     52
     53    function is_this_podro_city(city_list, name){
     54
     55        let result = false;
     56        Object.keys(city_list).forEach(key => {
     57
     58            if(  city_list[key] === name ){
     59                result = true;
     60                return result;
     61            }
     62
    3363
    3464        });
     65
     66
    3567
    36         jQuery('#shipping_state, body').change(function(){
    37             const province_code = jQuery(this).val();
    38             const element = jQuery('#shipping_city');
    39             if(!province_code)
    40                 return;
    41             const data = {
    42                 action:'get_podro_cities_by_province',
    43                 //security: wp_podro_ajax_object.security,
    44                 province: province_code
    45             };
    46 
    47             ajaxRequest(data, callbackGetCities, element);
    48         });
    49 
    50     }
    5168
    5269    function callbackGetCities(response, element){
     
    5976
    6077        Object.keys(cities).forEach(function(key) {
    61             console.log('Key : ' + key + ', Value : ' + cities[key])
     78
    6279            element.append(`<option value='${key}'>${cities[key]}</option>`);
    6380
  • podro-wp/trunk/inc/Api_Key.php

    r2835533 r2846187  
    7777    public static function set_pdo_api_key() {
    7878
    79         if( ! isset( $_POST[ 'config_podro_api_key' ] ) ) {
    80             return;
    81         }
    82         update_option('woocommerce_store_city', sanitize_text_field($_POST['podro_store_location']));
    83         $pdo_email = sanitize_email( $_POST[ 'pdo_email' ] );
    84         $pdo_password = sanitize_text_field( $_POST[ 'pdo_password' ] );
    85         if ( $pdo_email == null || $pdo_password == null || ( ! empty( $pdo_email ) && !empty( $pdo_password ) && $pdo_password === "**************" ) ) {
    86             add_action( 'admin_notices', function () {
    87                 echo wp_kses_post('<div class="notice notice-error is-dismissible">
     79
     80
     81        if(  isset( $_POST[ 'config_podro_api_key' ] ) ) {
     82            $pdo_email = sanitize_email( $_POST[ 'pdo_email' ] );
     83            $pdo_password = sanitize_text_field( $_POST[ 'pdo_password' ] );
     84            if ( $pdo_email == null || $pdo_password == null || ( ! empty( $pdo_email ) && !empty( $pdo_password ) && $pdo_password === "**************" ) ) {
     85                add_action( 'admin_notices', function () {
     86                    echo wp_kses_post('<div class="notice notice-error is-dismissible">
    8887                        <p>'. esc_html__( "لطفا موارد موردنیاز را وارد کنید.", 'podro-wp' ) .'</p>
     88
    8989                    </div>');
    90             } );
    91             return false;
    92         }
     90            } );
     91            return false;
     92        }
    9393
    94         if ( !$token = self::validate_api_key( $pdo_email, (new Encryption)->encrypt($pdo_password) ) ) {
    95             return false;
    96         }
     94        if ( !$token = self::validate_api_key( $pdo_email, (new Encryption)->encrypt($pdo_password) ) ) {
     95            return false;
     96        }
    9797
    98         $save_settings = update_option( 'podro_api_key', (new Encryption)->encrypt($token) );
     98        $save_settings = update_option( 'podro_api_key', (new Encryption)->encrypt($token) );
    9999
    100         if( $save_settings ) {
    101             update_option( 'podro_plugin_status', 'connected');
    102             update_option( 'podro_plugin_credentials', [
    103                 'email' => $pdo_email,
    104                 'password' => (new Encryption)->encrypt($pdo_password),
    105             ]);
     100        if( $save_settings ) {
     101            update_option( 'podro_plugin_status', 'connected');
     102            update_option( 'podro_plugin_credentials', [
     103                'email' => $pdo_email,
     104                'password' => (new Encryption)->encrypt($pdo_password),
     105            ]);
    106106
    107             wp_redirect( home_url( '/wp-admin/admin.php?page=' . PODRO_SLUG ) );
     107                wp_redirect( home_url( '/wp-admin/admin.php?page=' . PODRO_SETTINGS_PAGE_SLUG ) );
     108
     109                add_action( 'admin_notices', function () {
     110                    echo wp_kses_post('<div class="notice notice-success is-dismissible">
     111                        <p>'. esc_html__( "تنظیمات ذخیره شد.", 'wp-podro' ) .'</p>
     112                    </div>');
     113                } );
     114            }
     115        }else if( isset($_POST['config_podro_store_info']) ){
     116
     117            if( empty($_POST['podro_store_name']) || empty($_POST['podro_store_address']) ){
     118                add_action( 'admin_notices', function () {
     119                    echo wp_kses_post('<div class="notice notice-error is-dismissible">
     120                        <p>'. esc_html__( "نام فروشگاه، شهرو آدرس نمی تواند خالی باشد", 'wp-podro' ) .'</p>
     121                    </div>');
     122                } );
     123                return false;
     124            }
     125
     126            update_option('podro_store_name', sanitize_text_field($_POST['podro_store_name']??''));
     127            update_option('podro_store_city', sanitize_text_field($_POST['podro_store_city']??''));
     128            update_option('podro_store_address', sanitize_text_field($_POST['podro_store_address']??''));
     129
    108130
    109131            add_action( 'admin_notices', function () {
     
    111133                        <p>'. esc_html__( "تنظیمات ذخیره شد.", 'podro-wp' ) .'</p>
    112134                    </div>');
    113             } );
     135            });
    114136        }
     137
    115138
    116139    }
  • podro-wp/trunk/inc/MetaBox.php

    r2839027 r2846187  
    136136        $woo_setting = WooSetting::get_instance();
    137137
    138         $source_city = $woo_setting->get_store_city_code_from_options();
     138
    139139        $order_id = $order->get_id();
    140140        $destination_city_code = $order->get_shipping_city();
     141
     142
     143
     144
     145
     146
     147
     148
    141149
    142150        $destination_city_name = (WooSetting::get_instance())->get_cities()[$destination_city_code];
     
    144152        if( mb_strlen($destination_address) > $this->address_length )
    145153            $destination_address = mb_substr($destination_address, 0, $this->address_length);
    146         $store_address = $woo_setting->get_store_city() . ' ' . get_option( 'woocommerce_store_address' ) . get_option( 'woocommerce_store_address_2' );
     154
     155
     156        $pod_source_city_code = $woo_setting->get_store_city_code_from_options();
     157        $pod_store_address =  mb_substr($woo_setting->get_store_city() . ' ' . $woo_setting->get_store_address() , 0 , $this->address_length) ;
     158        $pod_store_name =  mb_substr( $woo_setting->get_store_name(), 0, $this->store_name_length );
    147159
    148160        $total_weight = 0;
     
    183195        $user_billing_family = $order->get_billing_last_name();
    184196
    185         $store_name = $this->get_store_name();
     197
    186198        $customer_note = $order->get_customer_note();
    187199
    188         $option_pod_source_city = get_option('pod_source_city',false);
    189         $option_pod_store_name = get_option('pod_store_name',false);
    190 
    191         $option_pod_source_city = ( false == $option_pod_source_city ) ? $store_address : $option_pod_source_city;
    192         $option_pod_store_name = ( false == $option_pod_store_name ) ?  $store_name : $option_pod_store_name;
     200
     201
    193202
    194203
     
    198207            <li>
    199208                <label for="pod_store_name">نام فروشگاه</label>
    200                 <input type="text" name="pod_store_name" id="pod_store_name" maxlength="60" value="<?php echo esc_attr($option_pod_store_name); ?>"  />
     209                <input type="text" name="pod_store_name" id="pod_store_name" maxlength="60" value="<?php echo esc_attr($pod_store_name); ?>"  />
    201210            </li>
    202211            <li>
    203212                <label for="pod_source_city">مبدا</label>
    204                 <textarea name="pod_source_city" id="pod_source_city" rows="6"><?php echo esc_attr($option_pod_source_city); ?></textarea>
    205                 <?php if (empty($store_address)) echo '<p style="color:red">'. esc_html__('لطفا آدرس فروشگاه را از تنظیمات ووکامرس وارد کنید.', 'podro-wp') .'</p>' ; ?>
    206                 <input type="hidden" id="pod_source_city_code" name="pod_source_city_code" value="<?php echo esc_attr($source_city); ?>">
     213                <textarea name="pod_source_city" id="pod_source_city" rows="6"><?php echo esc_attr($); ?></textarea>
     214                <?php if (empty($store_address)) echo '<p style="color:red">'. esc_html__('لطفا آدرس فروشگاه را از تنظیمات ووکامرس وارد کنید.', 'podro-wp') .'</p>' ; ?>
     215                <input type="hidden" id="pod_source_city_code" name="pod_source_city_code" value="<?php echo esc_attr($); ?>">
    207216            </li>
    208217            <li>
  • podro-wp/trunk/inc/Podro_Order_Table.php

    r2835533 r2846187  
    105105        foreach ($orders as $order){
    106106
    107             if ( $order['status'] == 'لغو شده') {
    108                 $cancel_order = 'از پیش لغو شده';
     107            if ( $order['status'] == 'درحال پردازش' ||
     108                $order['status'] == 'ثبت اولیه' ||
     109                $order['status'] == 'در حال بررسی تاخیر' ) {
     110                $cancel_order = '<a class="pod-cancel-order" data-order_id="' . $order['id'] . '">لغو ارسال</a>';
    109111            } else {
    110                 $cancel_order = '<a class="pod-cancel-order" data-order_id="' . $order['id'] . '">لغو ارسال</a>';
     112                $cancel_order = ;
    111113            }
    112114
  • podro-wp/trunk/inc/Setup.php

    r2839027 r2846187  
    1717 * @link      https://github.com/KhorshidLab/WP-Podro
    1818 */
     19
     20
    1921use WP_PODRO\Admin\Enqueue;
    2022use WP_PODRO\Engine\API\V1\Payments;
     23
    2124
    2225class Setup {
     
    8588     * @access   private
    8689     */
     90
     91
     92
     93
     94
     95
     96
     97
     98
    8799    private function load_dependencies() {
    88100
     
    91103        $this->loader = new Loader();
    92104
    93         add_action('woocommerce_loaded', function(){
    94 
    95 
    96         // Disable Persian Woocommerce City Select
    97         if ( function_exists( 'PW' ) && PW()->get_options( 'enable_iran_cities' ) != 'no' ) {
    98             $settings                       = PW()->get_options();
    99             $settings['enable_iran_cities'] = 'no';
    100             update_option( 'PW_Options', $settings );
    101         }
    102 
    103         // Disable Persian Woocommerce shipping City Select
    104         if ( function_exists( 'PWS' ) || class_exists('PWS_Core') || in_array( 'persian-woocommerce-shipping/woocommerce-shipping.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
    105 
    106             $pws = \PWS_Core::instance();
    107 
    108 
    109             // Filters
    110             remove_filter( 'woocommerce_states', [ $pws, 'iran_states' ], 20, 1 );
    111             remove_filter( 'woocommerce_checkout_process', [ $pws, 'checkout_process' ], 20, 1 );
    112 
    113 
    114             add_action( 'wp_enqueue_scripts', function() {
    115                 wp_dequeue_script( 'pwsCheckout' );
    116             }, 999999 );
    117 
    118 
    119 
    120 }
    121 
    122         }, 21);
    123 
    124         if ( class_exists('WC_City_Select') ) {
    125 
    126             $WC_City_Select = new WC_City_Select;
    127 
    128             $this->loader->add_filter( 'woocommerce_billing_fields', $WC_City_Select, 'billing_fields', 999999, 2 );
    129             $this->loader->add_filter( 'woocommerce_shipping_fields', $WC_City_Select, 'shipping_fields', 999999, 2 );
    130             $this->loader->add_filter( 'woocommerce_form_field_city', $WC_City_Select, 'form_field_city', 999999, 4 );
    131 
    132         }
     105
     106
     107        add_action( 'wp_ajax_nopriv_get_podro_cities', [$this, 'podro_get_cities'] );
     108        add_action( 'wp_ajax_get_podro_cities', [$this, 'podro_get_cities'] );
     109
     110
    133111
    134112        $this->loader->add_action( 'admin_init', $Api_Key, 'set_pdo_api_key' );
     
    269247                __( 'تنظیمات', 'podro-wp' ),
    270248                'manage_options',
    271                 PODRO_SLUG . '-settings',
     249                PODRO_S,
    272250                [$this, 'settings_page'],
    273251            );
  • podro-wp/trunk/inc/WooSetting.php

    r2827875 r2846187  
    356356            '0006'=>'ساوه',
    357357            '0005'=>'دلیجان',
    358             '0101'=>'آستارا',
    359             '0103'=>'بندرانزلی',
     358            '0101'=>'آستارا',
     359            '0103'=>'بندرانزلی',
    360360            '0105'=>'رشت',
    361361            '0111'=>'لاهیجان',
     
    367367            '0206'=>'رامسر',
    368368            '0207'=>'ساری',
    369             '0210'=>'قائم شهر',
     369            '0210'=>'قائمشهر',
    370370            '0214'=>'نور',
    371371            '0215'=>'نوشهر',
     
    392392            '0808'=>'کرمان',
    393393            '0908'=>'سبزوار',
    394             '0916'=>'مشهد',
     394            '0916'=>'مشهد',
    395395            '0917'=>'نیشابور',
    396396            '1002'=>'اصفهان',
    397397            '1009'=>'شهرضا',
    398398            '1010'=>'کاشان',
    399             '1018'=>'آران وبیدگل',
     399            '1018'=>'آران وبیدگل',
    400400            '1102'=>'چابهار',
    401401            '1105'=>'زاهدان',
     
    405405            '1401'=>'بروجن',
    406406            '1402'=>'شهرکرد',
    407             '1503'=>'خرم آباد',
     407            '1503'=>'خرمآباد',
    408408            '1601'=>'ایلام',
    409409            '1703'=>'گچساران',
    410             '1801'=>'بوشهر',
     410            '1801'=>'بوشهر',
    411411            '1810'=>'عسلویه',
    412412            '1901'=>'ابهر',
     
    419419            '2105'=>'یزد',
    420420            '2106'=>'میبد',
    421             '2202'=>'بندرعباس',
     421            '2202'=>'بندرعباس',
    422422            '2204'=>'قشم',
    423423            '2301'=>'تهران',
     
    430430            '2705'=>'گرگان',
    431431            '2710'=>'آزادشهر',
    432             '2706'=>'گنبدکاوس',
     432            '2706'=>'گنبدکاوس',
    433433            '2802'=>'بجنورد',
    434434            '2901'=>'بیرجند',
     
    442442    }
    443443
     444
     445
     446
     447
     448
     449
    444450    public function get_store_city(){
    445451        $current_city = $this->get_store_city_code_from_options();
     
    448454
    449455    public function get_store_city_code_from_options(){
    450         return get_option('woocommerce_store_city',0);
     456        return get_option('podro_store_city',0);
     457    }
     458
     459    public function get_store_address(){
     460        return get_option('podro_store_address', '');
     461    }
     462    public function get_store_name(){
     463        return get_option('podro_store_name', '');
    451464    }
    452465
  • podro-wp/trunk/vendor/autoload.php

    r2839027 r2846187  
    1010require_once __DIR__ . '/composer/autoload_real.php';
    1111
    12 return ComposerAutoloaderInitb472f25f5c4461cfd343527deda3d097::getLoader();
     12return ComposerAutoloaderInit::getLoader();
  • podro-wp/trunk/vendor/composer/autoload_classmap.php

    r2827875 r2846187  
    119119    'WP_PODRO\\Engine\\API\\V1\\Routes' => $baseDir . '/inc/API/V1/Routes.php',
    120120    'WP_PODRO\\Engine\\Api_Key' => $baseDir . '/inc/Api_Key.php',
     121
    121122    'WP_PODRO\\Engine\\Loader' => $baseDir . '/inc/Loader.php',
    122123    'WP_PODRO\\Engine\\Location' => $baseDir . '/inc/Location.php',
  • podro-wp/trunk/vendor/composer/autoload_real.php

    r2839027 r2846187  
    33// autoload_real.php @generated by Composer
    44
    5 class ComposerAutoloaderInitb472f25f5c4461cfd343527deda3d097
     5class ComposerAutoloaderInit
    66{
    77    private static $loader;
     
    2525        require __DIR__ . '/platform_check.php';
    2626
    27         spl_autoload_register(array('ComposerAutoloaderInitb472f25f5c4461cfd343527deda3d097', 'loadClassLoader'), true, true);
     27        spl_autoload_register(array('ComposerAutoloaderInit', 'loadClassLoader'), true, true);
    2828        self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
    29         spl_autoload_unregister(array('ComposerAutoloaderInitb472f25f5c4461cfd343527deda3d097', 'loadClassLoader'));
     29        spl_autoload_unregister(array('ComposerAutoloaderInit', 'loadClassLoader'));
    3030
    3131        require __DIR__ . '/autoload_static.php';
    32         call_user_func(\Composer\Autoload\ComposerStaticInitb472f25f5c4461cfd343527deda3d097::getInitializer($loader));
     32        call_user_func(\Composer\Autoload\ComposerStaticInit::getInitializer($loader));
    3333
    3434        $loader->register(true);
  • podro-wp/trunk/vendor/composer/autoload_static.php

    r2839027 r2846187  
    55namespace Composer\Autoload;
    66
    7 class ComposerStaticInitb472f25f5c4461cfd343527deda3d097
     7class ComposerStaticInit
    88{
    99    public static $prefixLengthsPsr4 = array (
     
    152152        'WP_PODRO\\Engine\\API\\V1\\Routes' => __DIR__ . '/../..' . '/inc/API/V1/Routes.php',
    153153        'WP_PODRO\\Engine\\Api_Key' => __DIR__ . '/../..' . '/inc/Api_Key.php',
     154
    154155        'WP_PODRO\\Engine\\Loader' => __DIR__ . '/../..' . '/inc/Loader.php',
    155156        'WP_PODRO\\Engine\\Location' => __DIR__ . '/../..' . '/inc/Location.php',
     
    166167    {
    167168        return \Closure::bind(function () use ($loader) {
    168             $loader->prefixLengthsPsr4 = ComposerStaticInitb472f25f5c4461cfd343527deda3d097::$prefixLengthsPsr4;
    169             $loader->prefixDirsPsr4 = ComposerStaticInitb472f25f5c4461cfd343527deda3d097::$prefixDirsPsr4;
    170             $loader->classMap = ComposerStaticInitb472f25f5c4461cfd343527deda3d097::$classMap;
     169            $loader->prefixLengthsPsr4 = ComposerStaticInit::$prefixLengthsPsr4;
     170            $loader->prefixDirsPsr4 = ComposerStaticInit::$prefixDirsPsr4;
     171            $loader->classMap = ComposerStaticInit::$classMap;
    171172
    172173        }, null, ClassLoader::class);
  • podro-wp/trunk/vendor/composer/installed.php

    r2839027 r2846187  
    66        'install_path' => __DIR__ . '/../../',
    77        'aliases' => array(),
    8         'reference' => 'e61c7f2401dc8fba00d50b7d6356693315103128',
     8        'reference' => '',
    99        'name' => 'khorshid/wp_podro',
    1010        'dev' => true,
     
    3535            'install_path' => __DIR__ . '/../../',
    3636            'aliases' => array(),
    37             'reference' => 'e61c7f2401dc8fba00d50b7d6356693315103128',
     37            'reference' => '',
    3838            'dev_requirement' => false,
    3939        ),
  • podro-wp/trunk/wp-podro.php

    r2839027 r2846187  
    1010 * Plugin URI:      https://khorshidlab.com/
    1111 * Description:     پادروپین؛ ‌مارکت‌پلیس خدمات پستی است و به فروشگاه‌های آنلاین کمک می‌کند تا فرآیند ارسال سفارش‌های اینترنتی را مدیریت کنند. در پادروپین، بدون مراجعه و یا ثبت قرارداد با شرکت‌های پستی، می‌توان سفارش‌های اینترنتی را با هر یک از شرکت‌های پستی ارسال کرد
    12  * Version:         1.0.5
     12 * Version:         1.0.
    1313 * Author:          Khorshid, Podro
    1414 * Author URI:      https://khorshidlab.com/fa/
     
    3737 */
    3838
    39 define( 'PODRO_VERSION', '1.0.5' );
     39define( 'PODRO_VERSION', '1.0.' );
    4040define( 'PODRO_SLUG', 'podro-wp' );
     41
     42
    4143define( 'PODRO_NAME', 'WP PODRO' );
    4244define( 'PODRO_PLUGIN_ROOT', plugin_dir_path( __FILE__ ) );
Note: See TracChangeset for help on using the changeset viewer.