WordPress.org

Ready to get started?Download WordPress

Forums

Cannot upload images in Woo commerce (8 posts)

  1. Water4You
    Member
    Posted 1 year ago #

    I can't upload images in Woo commerce, I am using Elegant Themes Estore. When I try to upload image in category thumbnail, I get this message, "cheatin uh?" I can upload images into the media library.
    Image file permissions are set to read and write with a 755 code.
    Any help would be appreciated.

  2. snow_walker
    Member
    Posted 1 year ago #

    If you are still having issues. Replace the js/custom_uploade.js with this

    jQuery(document).ready(function() {
    	var fileInput = '';
    
    	jQuery('.upload_image_button').click(function() {
    		post_id = jQuery('#post_ID').val();
    		if(post_id > 0){
    			fileInput = jQuery(this).prev('input');
    			//console.log(fileInput);
    			formfield = jQuery('#upload_image').attr('name');
    
    			tb_show('', 'media-upload.php?post_id='+post_id+'&type=image&TB_iframe=true');
    			return false;
    		}
    	});
    
    	// user inserts file into post. only run custom if user started process using the above process
    	// window.send_to_editor(html) is how wp would normally handle the received data
    
    	window.original_send_to_editor = window.send_to_editor;
    	window.send_to_editor = function(html){
    
    		if (fileInput) {
    			fileurl = jQuery('img',html).attr('src');
    
    			fileInput.val(fileurl);
    
    			tb_remove();
    
    		} else {
    			window.original_send_to_editor(html);
    		}
    	};
    
    });
  3. golfvilla
    Member
    Posted 1 year ago #

    Thank you snow_walker!!! I had the exact same problem and your code update was a sure fix!

  4. alfons271
    Member
    Posted 11 months ago #

    I¡m using Purity theme with woocommerce. I upload and no errors are showing, but the image is not showing on admin categories thumbnail images neither on my site:

    http://www.cestolanacachola.org/pt-pt/a-nosa-tenda/

    Any clues on that?

  5. snow_walker
    Member
    Posted 11 months ago #

    Did you upload the categories images?

  6. alfons271
    Member
    Posted 11 months ago #

    Yes snow_walker, I'm uploading them as I do for product images, when I choose use this image the pop-up window on admin is closing without throwing errors as everything went all right. But no images are appearing.

  7. ecomlearning
    Member
    Posted 9 months ago #

    alfons271, I just worked through this exact problem.

    Setting up a new site with WooCommerce. Not far in to set up so not much customisation done yet. One day I could add images to categories, today I cannot.

    Look at the javascript that is meant to happen then the Upload/Add Image button is clicked to add image to your WC category:

    // Create the media frame.
    file_frame = wp.media.frames.downloadable_file = wp.media({
        title: 'Choose an image',
        button: {
            text: 'Use image',
        },
        multiple: false
    });

    I saw no such title or button with this text. Just a standard WP media box with an "Add to Post" button.

    This told me something was stopping the JS from running properly.
    Long story short, I disabled a plugin called Wplogin Customizer and WooCommerce categories start working again as they should.

    I have not looked if this is the only plugin I want to use that will break it but I can live without it. I will investigate further and maybe contact the author of Wplogin Customizer

    Hope this helps.

  8. praisehim
    Member
    Posted 8 months ago #

    I want to confirm that this works for me. I was using the exact theme as the original poster, and added this into the /js/custom-

    jQuery(document).ready(function() {
    	var fileInput = '';
    
    	jQuery('.upload_image_button').click(function() {
    		post_id = jQuery('#post_ID').val();
    		if(post_id > 0){
    			fileInput = jQuery(this).prev('input');
    			//console.log(fileInput);
    			formfield = jQuery('#upload_image').attr('name');
    
    			tb_show('', 'media-upload.php?post_id='+post_id+'&type=image&TB_iframe=true');
    			return false;
    		}
    	});
    
    	// user inserts file into post. only run custom if user started process using the above process
    	// window.send_to_editor(html) is how wp would normally handle the received data
    
    	window.original_send_to_editor = window.send_to_editor;
    	window.send_to_editor = function(html){
    
    		if (fileInput) {
    			fileurl = jQuery('img',html).attr('src');
    
    			fileInput.val(fileurl);
    
    			tb_remove();
    
    		} else {
    			window.original_send_to_editor(html);
    		}
    	};
    
    });

    and I was able to upload photos into my categories. Many thanks! I am using Elegant estate 1.3 as well as WordPress 3.6 and Woocommerce 2.0.20

Topic Closed

This topic has been closed to new replies.

About this Topic