Right now I’m trying to customize the product blocks in terms of how they look and showing what information. But I’m having a problem with the shortcode mp_product_image, which doesn’t allow me to specific a separate width and separate height.
I tried to copy the mp_product_image function from template-functions.php and created a new function that takes different parameters like this:
function mp_product_image_singleWH( $echo = true, $context = ‘single’, $post_id = NULL, $width = NULL, $height = NULL ) …
and inside the function where it has the condition for $context = ‘single’, I have:
$size = array(intval($width), intval($height));
Then in the mp_list_global_products function, where it has the condition if ($show_thumbnail), I call this:
$thumbnail = mp_product_image_singleWH( false, $context, $product->post_id, 186, 144 );
But the image that shows is not cropped to exactly 186px width and 144px height. I have one image that’s 124px (w) X 144px (h), and the other image is 184px (w) X 122px (h). So I realize it kind of take one of the length and did not do an exact crop from the original image (which is way bigger than 186×144).
So does anyone know how to accomplish the exact cropping to the specific size I aforementioned?
Thank you so much and any help would be really appreciated!