Datafeedr Support Forums  

Go Back   Datafeedr Support Forums > Current Version (V3) Forum > Questions
Home Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Important - The support forums are now in "read-only" mode as we transition to an alternative help desk solution. Feel free to contact us here with any of your questions or search the forums for an existing solution.
 
 
Thread Tools Search this Thread Display Modes
  #1  
Old April 24th, 2011, 02:53 PM
RyanVega RyanVega is offline
 
Join Date: Mar 2011
Posts: 22
Default How to Limit Product Title Lengths On Category Pages?

Hi,

I have had a search through the forum and cant quite find the answer to this one. I would like to know how I can limit the length of product titles on my category pages, I guess limiting to a certain number of characters would be the best way.

I am using the 4 column version of template 1 and as some of my product titles are quite a bit longer than others, this screws up the layout. This is because the products with long titles are in slightly bigger boxes and title takes up 3 lines when most take up 2 lines for example.

Im thinking there must be an easier way to correct this than rewriting every single product title so they all fit on the same number of lines.

If it helps my store ID is 31130.

Thanks a lot for any assistance you guys can give.

Cheers
  #2  
Old April 24th, 2011, 03:08 PM
Eric's Avatar
Eric Eric is offline
Datafeedr Team
 
Join Date: Feb 2008
Posts: 16,902
Default

Hi

In your views you could replace this:

[product.name]

with this:

<?php echo substr($product->name, 0, 15); ?>

That would show the first 15 characters of the product title.

More information about substr() here.

Eric
  #3  
Old April 24th, 2011, 03:21 PM
RyanVega RyanVega is offline
 
Join Date: Mar 2011
Posts: 22
Default

Wow that works perfectly.

Awesome superfast support - bloody brilliant . . . thanks!
  #4  
Old April 24th, 2011, 06:30 PM
RyanVega RyanVega is offline
 
Join Date: Mar 2011
Posts: 22
Default

Hi again Eric,

After playing around with this setting on a few different pages, it doesn't quite solve the problem every time. Even when limiting the number of characters in the title, different titles can still be spread over 2 or 3 lines, especially if there are a couple of long words.

This basically means that the box sizes can still be different which then just messes up the layout for the whole page - it only takes one product to mess up everything.

Is there a way of determining what the actual size of the boxes are so that I can keep them all the same, rather than just restricting the title length?

Thanks again, Ryan
  #5  
Old April 24th, 2011, 07:02 PM
Eric's Avatar
Eric Eric is offline
Datafeedr Team
 
Join Date: Feb 2008
Posts: 16,902
Default

Hi Ryan

By default, all Datafeedr template views take product name and description into consideration on category pages where varying lengths of names and descriptions could potentially mess up the layout.

This is all done via CSS and specifically the overflow, line-height and height attributes. Here's an example:

HTML + CSS:

HTML Code:
<style type="text/css" title="text/css">
#box
{
	width: 200px;
	height: 300px;
	background-color: #6FC;
}

#box h3
{
	overflow: hidden;
	font-size: 14px;
	line-height: 1.2em;
	height: 2.4em; /* This MUST be a multiple of "line-height" */
}
</style>

<div id="box">
	<h3>
		This is a really long title which, 
		if not controlled by CSS, would 
		continue to wrap around for 3, 4 
		or possibly even 5 lines!
	</h3>
</div>
Output:



If we want to show 4 lines of the text, we modify the height attribute multiplying the "line-height" values by 4 (1.2 * 4 = 4.8). So we have height: 4.8em. Here's the output of that single code change.



Like I said, by default, all Datafeedr templates do this. You must have modified your product list modules or CSS code if this is not working. You will need to apply the same technique as above to your new code.

Eric
  #6  
Old April 25th, 2011, 08:10 AM
RyanVega RyanVega is offline
 
Join Date: Mar 2011
Posts: 22
Default

Ok thanks for that Eric.

I will have a play around with that and see how it goes. The only thing I have altered is the text size for the product titles, this was changed from H2 to H4 but that seems to be what is messing things up because when I leave the text size at the standard H2 everything is fine. I haven't done anything with the CSS yet but I will try and work out how to modify it for my views and let you know if there are any problems.

Thanks again, Ryan

Last edited by RyanVega : April 25th, 2011 at 08:24 AM.
  #7  
Old April 27th, 2011, 04:14 AM
RyanVega RyanVega is offline
 
Join Date: Mar 2011
Posts: 22
Default

Hi Eric,

I have tried to amend my CSS using the code you provided but for some reasons it does not make any difference to my views. I have changed different values but nothing has any affect.

Is there any way you could actually look into my store or give me any further guidance about what I actually need to be adding to the customer CSS box?

Thanks again, Ryan
  #8  
Old April 27th, 2011, 07:36 AM
RyanVega RyanVega is offline
 
Join Date: Mar 2011
Posts: 22
Default

OK I *think* I have sorted it.

Cheers
  #9  
Old April 27th, 2011, 08:08 AM
Eric's Avatar
Eric Eric is offline
Datafeedr Team
 
Join Date: Feb 2008
Posts: 16,902
Default

It looks good to me!
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
5000 product limit easymoney7 Questions 4 March 25th, 2011 09:57 AM
how do i make the category and product detail pages use a particular page template grooves1200 Questions 2 February 27th, 2011 10:12 AM


All times are GMT -5. The time now is 09:48 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.