• 47
Votes
name

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191

Backtrace:

File: /var/www/html/cnasolution/application/views/question.php
Line: 191
Function: _error_handler

File: /var/www/html/cnasolution/application/controllers/Questions.php
Line: 419
Function: view

File: /var/www/html/cnasolution/index.php
Line: 315
Function: require_once

On Woocommerce, I have changed $show_image variable to true in email order details php template file, but I am still unable to get the image displayed in email notifications:

$sent_to_admin, 'show_image' => true, 'image_size' => array( 100, 100 ), 'plain_text' => $plain_text, 'sent_to_admin' => $sent_to_admin, ) ); ?> get_order_item_totals(); if ( $totals ) { $i = 0; foreach ( $totals as $total ) { $i++; ?> get_customer_note() ) { ?>
get_customer_note() ) ); ?>

I need to add link as well to the product image.Once the user click on the image it should redirect to the particular page.

Changed the message from false to true still the image is not displayed in the site.

enter image description here

Download script demo [LINK]
Download script demo [LINK 2] Download script demo [LINK 2]

To display the image in Email notifications, revert back your changes to original template and use instead:

add_filter( 'woocommerce_email_order_items_args', 'custom_email_order_items_args', 10, 1 ); function custom_email_order_items_args( $args ) {     $args['show_image'] = true;      return $args; } 

To add the product link to the image and to the item name (optionally) you will use:

add_filter( 'woocommerce_order_item_thumbnail', 'add_email_order_item_permalink', 10, 2 ); // Product image add_filter( 'woocommerce_order_item_name', 'add_email_order_item_permalink', 10, 2 ); // Product name function add_email_order_item_permalink( $output_html, $item, $bool = false ) {     // Only email notifications     if( is_wc_endpoint_url() )         return $output_html;      $product   = $item->get_product();      return '' . $output_html . ''; } 

Code goes in function.php file of your active child theme (or active theme). Tested and works.


Thumbnail size change:

You can also manipulate the thumbnail size in this hook which is by default 32 x 32 pixels using under $args['show_image'] = true; adding this line:

$args['image_size'] = array( 48, 48 ); 

Tested and works too.

see demo
  • 43
Reply Report