Implemented
customized product thumbnail in order email?
Hi,
I have the problem that the procuct thumbnail in woocommerce order e-mail ist not the customized one. It is showing the basic procut image instead of the customized product. Is there any way to achieve this?
With the plugin as it is currently not, no sorry. You could make a feature request for this or support and existing one (I have not checked for one).
My clients are certainly curious about getting images of the customized product in the order confirmation email....please add this feature!
I am close to have this done. Are you interested in the code?
Please, yes share the code. I can go ahead and put it in wherever you recommend. Let me know, thanks!
Try to add the following code to your theme functions. That should change the thumbnail to fancy product thumbnail. Let me know if it works. I would recommend to add this function to the plugin in general as it's an important feature.
Hi Christian,
thank you for your code. Unfortunately the image is appearing as broken. There is some base64 content in there. Does it work on your installation? Can you assist me?
Thanks!
This code doesn't work for me as well.
it works fine for me on the email-template.
But is there a solution for the review-order-Page, too?
With this little code it will show the original thumb
but when I'll change this with the "filter" for the e-mail-image
That will show only the original Thumb not the designed.
Is there a quick solution?
It would make sense that the designed image will displayed on my orders. The color-settings, too. Or?
Thanks!
Same here. Did anyone find a way to change the Admin Order Screen thumbnail?
it is possible only in 3.4.8 or below (after that FPD didn't store image in (_)fpd_data meta field due some mistaken code)
in yourtheme/woocommerce/emails/email-order-items.php (copy it from plugin):
$count = 1;
foreach ( $items as $item_id => $item ) :
...
...
do_action( 'woocommerce_order_item_meta_end', $item_id, $item, $order, $plain_text );
$cid = 'item_' . $count . '.png';
$img = $item['_fpd_data']['fpd_product_thumbnail'];
if($img)
{
echo '<br>Эскизы сторон:<br>';
echo '<img src="cid:';
echo $cid;
echo '">';
$imgdata = base64_decode(explode(',',$img)[1]);
#$imgdata = explode(',',$img)[1];
#write_log('img = ' . $imgdata);
add_action( 'phpmailer_init', function($phpmailer)use($cid, $imgdata){
//$phpmailer->SMTPKeepAlive = true;
write_log('cid = ' . $cid);
write_log('imgdata = ' . $imgdata);
$phpmailer->addStringEmbeddedImage($imgdata, $cid, $cid, 'base64', 'image/png');
remove_action( 'phpmailer_init', __function__ );
});
}
$count++;
Once again for v 3.7.0
1. We need to correct bugs in FancyProductDesigner due to it don't save order thumbnails in "woocommerce_order_itemmeta" table:
1.1 Change all 'fpd_data' (with quota) in "fancy-product-designer/woo/class-wc-cart.php" to '_fpd_data' (with quota) - 33 entries.
1.2 Change in "fancy-product-designer/woo/class-wc-order.php" function add_order_item_meta:
Now custom thumbnails will be saved.
To be continued...
2. Now as mention above:
in yourtheme/woocommerce/emails/email-order-items.php (copy it from plugin templates dir) edit:
$count = 1;
foreach ( $items as $item_id => $item ) :
...
...
do_action( 'woocommerce_order_item_meta_end', $item_id, $item, $order, $plain_text );
$cid = 'item_' . $count . '.png';
$img = $item['_fpd_data']['fpd_product_thumbnail'];
if($img)
{
echo '<br>Product:<br>';
echo '<img src="cid:';
echo $cid;
echo '">';
$imgdata = base64_decode(explode(',',$img)[1]);
#$imgdata = explode(',',$img)[1];
add_action( 'phpmailer_init', function($phpmailer)use($cid, $imgdata){
//$phpmailer->SMTPKeepAlive = true;
write_log('cid = ' . $cid);
write_log('imgdata = ' . $imgdata);
$phpmailer->addStringEmbeddedImage($imgdata, $cid, $cid, 'base64', 'image/png');
remove_action( 'phpmailer_init', __function__ );
});
}
$count++;
3. (Optional) Now suppose you want to see not only first view thumbnail of product but all of them?:
Go for "fancy-product-designer/woo/class-wc-product.php" and change "fancyProductDesigner.viewInstances[0].toDataURL(function(dataURL) {" to "fancyProductDesigner.getProductDataURL(function(dataURL) {" in two places. Viola!