Plugin Directory

Changeset 2856209


Ignore:
Timestamp:
01/28/2023 09:55:13 AM (3 years ago)
Author:
holest
Message:

Fix import/export settings save problem.

Location:
excel-like-price-change-for-woocommerce-and-wp-e-commerce-light/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • excel-like-price-change-for-woocommerce-and-wp-e-commerce-light/trunk/excel-like-price-change-for-woocommerce-and-wp-e-commerce-light.php

    r2811156 r2856209  
    77 * Plugin URI: https://holest.com/spreadsheet-price-changer-for-woocommerce-and-wp-e-commerce
    88 * Description:An WooCommerce / WP E-commerce 'MS excel'-like fast input spreadsheet editor for fast product price change using web-form spreadsheet or export / import form CSV. It supports both WooCommerce and WP E-commerce. UI behaves same as in MS Excel. This is the right thing for you if your users give you a blank stare when you're trying to explain them how to update prices.;EDITABLE / IMPORTABLE FIELDS: Price, Sales Price; VIEWABLE / EXPORTABLE FIELDS: WooCommerce: Price, Sales Price, Attributes (Each pivoted as column), SKU, Category, Shipping class, Name, Slug, Stock, Featured, Status, Weight, Height, Width, Length, Tax status, Tax class; WP E-commerce: Price, Sales Price, Tags, SKU, Category, Name, Slug, Stock, Status, Weight, Height, Width, Length, Taxable, local and international shipping costs; Allows custom fields you can configure to view/export any property
    9  * Tested up to: 6.1.0
    10  * Version: 2.2.25
     9 * Tested up to: 6.1.1
     10 * Version: 2.3.0
    1111 * Author: Holest Engineering
    1212 * Author URI: http://www.holest.com
    1313 * Requires at least: 3.6
    1414 * WC requires at least: 2.5.0
    15  * WC tested up to: 6.5.1
     15 * WC tested up to: 7.3.0
    1616 * License: GPLv2
    1717 * Tags: csv, import, excel, export, bulk, fast, woo, woocommerce, products, editor, spreadsheet
     
    228228            if(current_user_can('administrator')) {
    229229                if (!wp_verify_nonce($_POST['pelm_nonce_check'], 'pelm_update_settings')) {
    230                     die("<br><br>PELM PRICE CSRF: Hmm .. looks like you didn't send any credentials.. No access for you!");
     230                    die("<br><br>PELM PRICE CSRF: Hmm .. looks like you didn't send correct credentials.. No access for you!");
    231231                }
    232232
  • excel-like-price-change-for-woocommerce-and-wp-e-commerce-light/trunk/lib/script.js

    r2723781 r2856209  
    2626});
    2727
     28function pelm_do_load(withImportSettingsSave,attach_properties){
     29    pending_load++;
     30    try{
     31        if(pending_load < 6){
     32            var n = 0;
     33            for(var key in tasks){
     34                if(tasks.hasOwnProperty(key))
     35                    n++;
     36            }
     37               
     38            if(n > 0) {
     39              setTimeout(function(){
     40                pelm_do_load();
     41              },2000);
     42              return;
     43            }
     44        }
     45    }catch(ex){
     46        pending_load = 0;
     47    }
     48
     49    var POST_DATA = {pelm_nonce_check: jQuery("input[name='pelm_nonce_check']:last").val(), pelm_security: jQuery("input[name='pelm_security']:last").val() };
     50   
     51    POST_DATA.sortOrder            = DG.sortOrder ? "ASC" : "DESC";
     52    POST_DATA.sortColumn           = pelm_get_sort_property();
     53    POST_DATA.limit                = jQuery('#txtlimit').val();
     54    POST_DATA.page_no              = jQuery('#paging_page').val();
     55   
     56    jQuery('.filter_option *[name]').each(function(ind){
     57        POST_DATA[jQuery(this).attr("name")] = jQuery(this).val();
     58    });
     59   
     60    if(typeof attributes !== 'undefined'){
     61        for(var index in attributes){
     62            if(attributes.hasOwnProperty(index)){
     63                POST_DATA["pattribute_" + attributes[index].id] = jQuery('.filter_option *[name="pattribute_' + attributes[index].id + '"]').val();
     64            }
     65        }
     66    }
     67   
     68    if(typeof custom_fields !== 'undefined'){
     69        for(var index in custom_fields){
     70            if(custom_fields.hasOwnProperty(index)){
     71                if(custom_fields[index].type == "term"){
     72                    POST_DATA[custom_fields[index].name] = jQuery('.filter_option *[name="' + custom_fields[index].name + '"]').val();
     73                }
     74            }
     75        }
     76    }
     77   
     78    if(attach_properties){
     79        for(var aprop in attach_properties){
     80            if(attach_properties.hasOwnProperty(aprop)){
     81                POST_DATA[aprop] = attach_properties[aprop];
     82            }
     83        }
     84    }
     85
     86    jQuery('#operationFRM').empty();
     87    jQuery('#operationFRM').append(jQuery("<input type='hidden' name='elpm_shop_com' value='wooc' />"));
     88   
     89    for(var key in POST_DATA){
     90        if(POST_DATA.hasOwnProperty(key)){
     91            if(POST_DATA[key])
     92                jQuery('#operationFRM').append("<INPUT type='hidden' name='" + key + "' value='" + POST_DATA[key] + "' />");
     93        }
     94    }
     95   
     96    if(withImportSettingsSave){
     97      var settings = {};
     98      jQuery('#settings-panel INPUT[name],#settings-panel TEXTAREA[name],#settings-panel SELECT[name]').each(function(i){
     99        if(jQuery(this).attr('type') == "checkbox")
     100            settings[jQuery(this).attr('name')] = jQuery(this)[0].checked ? 1 : 0;
     101        else
     102            settings[jQuery(this).attr('name')] = jQuery(this).val() instanceof Array ? jQuery(this).val().join(",") : jQuery(this).val();
     103      });
     104      settings.save_import_settings = 1;
     105     
     106      for(var key in settings){
     107          if(settings.hasOwnProperty(key)){
     108              var inp = jQuery("<INPUT type='hidden' />");
     109              inp.attr("name", key);
     110              inp.attr("value",settings[key]);
     111              jQuery('#operationFRM').append(inp);
     112          }
     113      }
     114    }
     115   
     116    jQuery('#operationFRM').submit();
     117}
     118
     119window.doLoad = pelm_do_load;
     120
    28121function pelm_store_state(){
    29122    if(!window.pelm_localStorage_clear_flag){
  • excel-like-price-change-for-woocommerce-and-wp-e-commerce-light/trunk/lib/settings_panel.php

    r2723781 r2856209  
    5454 
    5555?>
     56<input name="pelm_nonce_check" type="hidden" value="<?php echo esc_attr(wp_create_nonce('pelm_update_settings')); ?>" />
     57<input name="pelm_security" type="hidden" value="<?php echo esc_attr(pelm_get_nonce("pelm_nonce")); ?>" />
     58
    5659<div id="settings-panel" style="display:none;">
    5760<div>
  • excel-like-price-change-for-woocommerce-and-wp-e-commerce-light/trunk/readme.txt

    r2811156 r2856209  
    55License URI: http://www.gnu.org/licenses/gpl-2.0.html
    66Stable tag: 2.2.25
    7 Tested up to: 6.1.0
     7Tested up to: 6.1.1
    88WC requires at least: 2.5.0
    9 WC tested up to: 6.5.1
     9WC tested up to: 7.3.0
    1010Tags: excel, csv, import, export, woo, woocommerce, wpsc, ecommerce, e-commerce, wp-e-commerce, spreadsheet, product, editor, fast, easy, bulk, bulk edit, import products, export products
    1111Plugin URI: https://holest.com/spreadsheet-price-changer-for-woocommerce-and-wp-e-commerce
  • excel-like-price-change-for-woocommerce-and-wp-e-commerce-light/trunk/shops/wooc.php

    r2725189 r2856209  
    16241624$_num_sample = (1/2).'';
    16251625$args = array(
    1626      'post_type' => array('product')
     1626     'post_type' => array('product','product_variation')
    16271627    ,'posts_per_page' => -1
    16281628    ,'ignore_sticky_posts' => true
     
    17011701
    17021702if($sku) {
    1703     $meta_query[] =    array(
    1704                         'key' => '_sku',
    1705                         'value' => $sku,
     1703    $meta_query[] = array(
     1704                        'key'     => '_sku',
     1705                        'value'   => $sku,
    17061706                        'compare' => 'LIKE'
    17071707                    );
     
    17671767    $variat_ids = $wpdb->get_col(
    17681768        $wpdb->prepare(
    1769             "SELECT      p.ID
    1770             FROM        $wpdb->posts p
    1771          WHERE       p.post_type = 'product_variation'
    1772                         AND
    1773                      p.post_parent = %d
    1774          ORDER BY    p.ID
     1769            "SELECT
     1770                p.ID
     1771             FROM 
     1772                $wpdb->posts p
     1773             WHERE 
     1774                (p.post_type = 'product_variation' AND  p.post_parent = %d)
     1775             ORDER BY    p.ID
    17751776        ",
    1776             $p_id
     1777         $p_id
     1778         ,
     1779         $p_id
    17771780        )
    17781781    );
Note: See TracChangeset for help on using the changeset viewer.