VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: buddy123 on August 28, 2013, 14:58:08 PM

Title: Limite Product titles in 'Related Products'
Post by: buddy123 on August 28, 2013, 14:58:08 PM
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.
Title: Re: Limite Product titles in 'Related Products'
Post by: Maxim Pishnyak on August 28, 2013, 15:48:23 PM
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
Title: Re: Limite Product titles in 'Related Products'
Post by: PRO on August 28, 2013, 18:31:24 PM
you cannot do this, because the whole display is in a single variable.

Title: Re: Limite Product titles in 'Related Products'
Post by: Maxim Pishnyak on August 28, 2013, 19:45:12 PM
Buddy123, could you give a link?
Title: Re: Limite Product titles in 'Related Products'
Post by: jenkinhill on August 28, 2013, 23:34:15 PM
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