Woocommerce: [Import] import csv with pre-uploaded images not working

Created on 1 Aug 2017  ยท  3Comments  ยท  Source: woocommerce/woocommerce

Prerequisites

  • [x] I have searched for similar issues in both open and closed tickets and cannot find a duplicate
  • [x] The issue still exists against the latest master branch of WooCommerce on Github
  • [x] I have attempted to find the simplest possible steps to reproduce the issue
  • [x] I have included a failing test as a pull request (Optional)

Steps to reproduce the issue

Refer to _"You can define the filename if the image already exists in the media library."_ on https://github.com/woocommerce/woocommerce/wiki/Product-CSV-Import-Schema#csv-columns-and-formatting

  1. Upload this image to media library (filename : 01-cat-wants-to-tell-you-laptop.jpg)
    01-cat-wants-to-tell-you-laptop

  2. Import a product by this csv
    dummy-data.csv.zip

  3. Error show
    screen shot 2560-08-01 at 9 27 55 pm

Expected/actual behavior

When I follow those steps, I see...

The importer doesn't look up images in medial library by filename specified in csv. Instead, it tried to download from _"http://01-cat-wants-to-tell-you-laptop.jpg"_

I was expecting to see...

The importer must map existing image (by filename specified) with the product imported

Isolating the problem

  • [x] This bug happens with only WooCommerce plugin active
  • [x] This bug happens with a default WordPress theme active, or Storefront
  • [x] I can reproduce this bug consistently using the steps above

WordPress Environment

`
### WordPress Environment ###

Home URL: http://localhost
Site URL: http://localhost
WC Version: 3.2.0
Log Directory Writable: โœ”
WP Version: 4.8
WP Multisite: โ€“
WP Memory Limit: 256 MB
WP Debug Mode: โ€“
WP Cron: โœ”
Language: en_US

### Server Environment ###

Server Info: Apache/2.2.29 (Unix) mod_wsgi/3.4 Python/2.7.8 PHP/5.6.10 mod_ssl/2.2.29 OpenSSL/0.9.8zh DAV/2 mod_fastcgi/2.4.6 mod_perl/2.0.8 Perl/v5.20.0
PHP Version: 5.6.10
PHP Post Max Size: 32 MB
PHP Time Limit: 30
PHP Max Input Vars: 1000
cURL Version: 7.41.0
OpenSSL/0.9.8zd

SUHOSIN Installed: โ€“
MySQL Version: โŒ 5.5.42 - We recommend a minimum MySQL version of 5.6. See: WordPress requirements
Max Upload Size: 32 MB
Default Timezone is UTC: โœ”
fsockopen/cURL: โœ”
SoapClient: โœ”
DOMDocument: โœ”
GZip: โœ”
Multibyte String: โœ”
Remote Post: โŒ wp_remote_post() failed. Contact your hosting provider. cURL error 35: Unsupported SSL protocol version
Remote Get: โŒ wp_remote_get() failed. Contact your hosting provider. 200

### Database ###

WC Database Version: 3.2.0
WC Database Prefix: test_
woocommerce_sessions: โœ”
woocommerce_api_keys: โœ”
woocommerce_attribute_taxonomies: โœ”
woocommerce_downloadable_product_permissions: โœ”
woocommerce_order_items: โœ”
woocommerce_order_itemmeta: โœ”
woocommerce_tax_rates: โœ”
woocommerce_tax_rate_locations: โœ”
woocommerce_shipping_zones: โœ”
woocommerce_shipping_zone_locations: โœ”
woocommerce_shipping_zone_methods: โœ”
woocommerce_payment_tokens: โœ”
woocommerce_payment_tokenmeta: โœ”
MaxMind GeoIP Database: โœ”

### Security ###

Secure connection (HTTPS): โŒYour store is not using HTTPS. Learn more about HTTPS and SSL Certificates.
Hide errors from visitors: โœ”

### Active Plugins (12) ###

Contact Form 7: by Takayuki Miyoshi โ€“ 4.8.1
EpicoMedia core: by EpicoMedia โ€“ 1.0.0
Vitrine Shortcodes: by EpicoMedia โ€“ 1.0.0
Jetpack by WordPress.com: by Automattic โ€“ 5.1
WPBakery Visual Composer: by Michael M - WPBakery.com โ€“ 5.2
Slider Revolution: by ThemePunch โ€“ 5.4.3.1
MNKY | Visual Composer Pricing Boxes: by MNKY โ€“ 1.0.1
WooCommerce Custom Product Data Fields: by Kharis Sulistiyono โ€“ 1.2.4
WooCommerce: by Automattic โ€“ 3.2.0-dev
WP Migrate DB: by Delicious Brains โ€“ 0.9.2
MailPoet Newsletters: by MailPoet โ€“ 2.7.11.3
YITH WooCommerce Wishlist: by YITHEMES โ€“ 2.1.2

### Settings ###

API Enabled: โœ”
Force SSL: โ€“
Currency: GBP (ยฃ)
Currency Position: left
Thousand Separator: ,
Decimal Separator: .
Number of Decimals: 2
Taxonomies: Product Types: external (external)
grouped (grouped)
simple (simple)
variable (variable)
variable (variable-2)

Taxonomies: Product Visibility: exclude-from-catalog (exclude-from-catalog)
exclude-from-search (exclude-from-search)
featured (featured)
outofstock (outofstock)
rated-1 (rated-1)
rated-2 (rated-2)
rated-3 (rated-3)
rated-4 (rated-4)
rated-5 (rated-5)


### WC Pages ###

Shop base: #11912 - /shop/
Cart: #11913 - /cart/
Checkout: #11914 - /checkout/
My account: #14 - /my-account/
Terms and conditions: โŒ Page not set

### Theme ###

Name: Twenty Seventeen
Version: 1.3
Author URL: https://wordpress.org/
Child Theme: โŒ โ€“ If you are modifying WooCommerce on a parent theme that you did not build personally we recommend using a child theme. See: How to create a child theme
WooCommerce Support: โœ”

### Templates ###

Overrides: โ€“
`

bug

Most helpful comment

hi
am having same problem
although the images link is working but am getting this error " Error getting remote image "

All 3 comments

Digging into the code the method WC_Product_Importer::get_attachment_id_from_url requires the full URL to the image, even if it's already been uploaded to the media library. All images are also run through the esc_url_raw function that will always append a protocol to the string.

01-cat-wants-to-tell-you-laptop.jpg should be a fully qualified URL and not just the filename and _will_ be converted to a URL on upload.

https://example.com/2017/08/01-cat-wants-to-tell-you-laptop.jpg would work in this case.

I don't know what the devs were planning here, but I reckon this might be just a lack of proper documentation?

hi
am having same problem
although the images link is working but am getting this error " Error getting remote image "

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tushonline picture tushonline  ยท  3Comments

adriandmitroca picture adriandmitroca  ยท  3Comments

pawelkmpt picture pawelkmpt  ยท  3Comments

atimmer picture atimmer  ยท  3Comments

WPprodigy picture WPprodigy  ยท  3Comments