开发者 |
deonbotha
vsego |
---|---|
更新时间 | 2017年7月21日 19:21 |
PHP版本: | 4.6 及以上 |
WordPress版本: | 4.8 |
版权: | GPLv2 or later |
版权网址: | 版权信息 |
"It's been a pleasure working with Kite to provide a seamless print solution to our millions of creators on PicCollage. Their platform and support have made our entry into the physical product market so easy and fun!" -- Ching-Mei Chen (Co-Founder, Head of Product) - PicCollage (110 million users)Made on demand - No minimum order Upload your artwork, choose your products and you're ready to go! It's that simple. Print your designs on
kite-print-and-dropshipping-on-demand/
to the /wp-content/plugins/
directoryYes, WooCommerce is required for the plugin to work.
Below are two technical answers on how to get your theme working, but you can also "freeze" your products, which downloads their images to your Media library (thus removing the reliance on themes to replace these images on the fly). Please note that product images of "frozen" products cannot be edited unless the product is "unfrozen". Also, "freezing" takes quite a bit of time (usually around 10 minutes or more, depending on your network connection, for the full range of products).
There is a known bug in older Safaris. Please upgrade to version 10+.
There is a convenience function wookite_process_image($html, $post_id)
which accepts either HTML code or an image URL as the first argument and the variant or product's post_id
as the second, and returns the version of the HTML/URL with Kite's placeholder image URL replaced with proper image links.
Oxygen forces local thumbnails with no filters/actions to latch to, so our plugin cannot override it. A simple fix is to open oxygen/woocommerce/single-product/add-to-cart/variable.php
and replace
$image = wp_get_attachment_image_src( get_post_thumbnail_id( $variation['variation_id'] ), 'shop-thumb-4' );
with
$image = wookite_process_image(
wp_get_attachment_image_src( get_post_thumbnail_id( $variation['variation_id'] ), 'shop-thumb-4' ),
$variation['variation_id']
);
A similar fix can work on other themes, as long as you can provide the original image URL (here generated by the wp_get_attachment_image_src
call) and variation's ID (here given as $variation['variation_id']
).
This used to be issue until version 1.0.3. This answer is left here for anyone needing it for older versions.
That image is used as a placeholder that is substituted for the actual image, in order to significantly improve the performance of the plugin. However, it also relies on a properly written theme.
Specifically, for storefront product images, in the file `woocommerce/single-product/product-image.php in your theme's directory, there must be a call similar to this one:
echo apply_filters(
'woocommerce_single_product_image_html',
sprintf(
'%s',
esc_url( $props['url'] ),
esc_attr( $props['caption'] ),
$gallery,
$image
),
$post->ID
);
If there isn't one, you can find the part that is generating the image (in the above code, it is the whole sprintf(...)
part, but it can also be just <img src="..." ... />
or something similar) and enclose it in the echo apply_filters('woocommerce_single_product_image_html', ...)
call.
For other images, there should be similar calls to apply_filters
in your theme's woocommerce
directory:
woocommerce_single_product_image_thumbnail_html
in single-product/product-thumbnails.php
for product thumbnails,woocommerce_cart_item_thumbnail
for product images in carts, in cart/cart.php
,woocommerce_before_subcategory_title
for range category images in content-product_cat.php
.