Plugin Directory

Changeset 2376342


Ignore:
Timestamp:
09/07/2020 08:36:33 AM (6 years ago)
Author:
crystalwebpro
Message:

Fix error in enable woocommerce upload addon in single product tab

Location:
upload-add-on-for-woocommerce
Files:
27 added
4 edited

Legend:

Unmodified
Added
Removed
  • upload-add-on-for-woocommerce/trunk/includes/admin/tabs_page.php

    r2375644 r2376342  
    2424                'label'         => __( 'Enable', 'my_text_domain' ),
    2525                'description'   => __( 'Enable Woocommerce Upload on this product', 'my_text_domain' ),
    26                 'default'       => '0',
     26                'default'       => '1',
    2727                'desc_tip'      => true,
    2828            ) );
  • upload-add-on-for-woocommerce/trunk/includes/woo_ua_upload.php

    r2375644 r2376342  
    3434 
    3535function woocommerce_woo_ua__add_to_cart_text() {
     36        global $product;
     37        $id = $product->get_id();
    3638    // get options
    3739        wp_cache_flush();
     
    3941        $woo_ua_enable = $options['woo_ua_enable'];
    4042        $woo_ua_cart_btn = $options['woo_ua_cart_btn'];
     43        $woo_ua_field = get_post_meta($id, "_woo_ua_field", true);
    4144       
    42         if($woo_ua_enable) {
     45        if($woo_ua_enable && $woo_ua_field == 'yes') {
    4346            if(!empty($woo_ua_cart_btn)) {
    4447                return __($woo_ua_cart_btn, 'woocommerce');
     
    5659        wp_cache_flush();
    5760        $options = get_option("woo_ua_options");
     61        $woo_ua_enable = $options['woo_ua_enable'];
    5862        $woo_ua_file_size = $options['woo_ua_file_size'];
    59        
     63        $woo_ua_field = get_post_meta($product_id, "_woo_ua_field", true);
     64
    6065        if($woo_ua_file_size == '1') {
    6166            $max_image_size = 1000 * 1000; // 1 MB (approx)
     
    7176
    7277    $addon_id = array();
    73 
     78    if($woo_ua_enable && $woo_ua_field == 'yes') {
    7479    if( isset( $_FILES ) && isset( $_FILES['wua_file_addon'] ) && $_FILES['wua_file_addon']['name'] !== '' && $_FILES['wua_file_addon']['size'] <= $max_image_size){
    7580       
     
    96101
    97102    return $cart_item_meta;
     103    }
    98104}
    99105
  • upload-add-on-for-woocommerce/trunk/readme.txt

    r2375644 r2376342  
    77Tested up to: 5.6
    88Requires PHP: 5.6
    9 Stable tag: 1.0
     9Stable tag: 1.1
    1010License: GPLv2 or later
    1111License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    4949* Initial Launch Version
    5050
     51= 1.1 =
     52* Fix error in enable woocommerce upload addon in single product tab
     53
    5154== Upgrade Notice ==
    5255
  • upload-add-on-for-woocommerce/trunk/wooua.php

    r2375644 r2376342  
    88Author URI: https://crystalwebpro.com
    99License: GPL2
    10 Version: 1.0
     10Version: 1.1
    1111*/
    1212
Note: See TracChangeset for help on using the changeset viewer.