I would like to limit the product title under 'Related Products' on a product view page.
I know about custom templating and on the product details view page:
<?php if (!empty($this->product->customfieldsRelatedProducts)) : ?>
<div class="product-related-products">
<h4 class="title"><?php echo JText::_('COM_VIRTUEMART_RELATED_PRODUCTS'); ?></h4>
<?php foreach ($this->product->customfieldsRelatedProducts as $field) : ?>
<div class="product-field-type-<?php echo $field->field_type ?>"> <span class="product-field-display"><?php echo $field->display ?>
</span> </div>
<?php endforeach; ?>
</div>
<?php endif; ?>
I can't figure out how to limit the length of the product title to say 15 characters. I read on the forum about using <?php echo shopFunctionsF::limitStringByWord ($product->product_name, 40, '...') ?> but I don't understand how to apply it in this context.
Check thread of this quote
Quote from: kkmediaproduction on April 28, 2013, 02:14:15 AM
you can use firebug to find out things like this
you cannot do this, because the whole display is in a single variable.
Buddy123, could you give a link?
I have used code similar to this (for VM1.1) on another component to truncate the display of a title. Maybe something similar could be used here? http://forum.virtuemart.net/index.php?topic=49564.msg159085#msg159085