how to display only thubnails of products in related products area,my current code is showing the link too i-e inage with href tittle of product name.I just want to show the thumbnails
<?php
foreach ($this->product->customfieldsRelatedProducts as $field) {
?>
?php echo $field->display ?>
<?php } ?>
Hello,
This i think will not work with str_replace, you will use preg_replace to replace the string after img alt and before </a> ... so
$field->display = preg_replace('#(<img.*?>).*?(</a>)#', '$1$2', $field->display);
This will remove the <a> link text, so your code will look like:
<?php
foreach ($this->product->customfieldsRelatedProducts as $field)
{
$field->display = preg_replace('#(<img.*?>).*?(</a>)#', '$1$2', $field->display);
echo $field->display;
}
?>
Please test it and let me know if is working for you
Regards
there is php tag missing in the code,cant figure it out myself
Hello,
Is not missing ... may be from copy paste the editors throw it out ... i place a screenshot of the code ... Please check it
without tags also:
$field->display = preg_replace('#(<img.*?>).*?(</a>)#', '$1$2', $field->display);
Regards
[attachment cleanup by admin]
Thanks for your kind awesome help
You are welcome, good luck with your project