How to fix row height in zen-cart product listing?
Almost one year back, I had problem with the product display in Zen-cart. I searched for help in zen-cart forum. I started a topic over there. But at last, I myself had to post the solution on that thread.. coz, I found the solution. ;) I just wanted to include that problem and solution in this post.
My problem was:-
I have ‘new products’ listing in my index page of zen-cart. I have used column grid layout. My layout is 3 columns per row. I have made the height of product image to be fixed to 80px. I also don’t have any problem with the width of the product as it is same for all the products.
But, still i have problem in product display. I have long names for some of the products. The products with long name are taking more space, hence pushing the other products below and making the display improper.
I think if I could make a constant height for each row, then the problem will be solved. But, I don’t have any idea, how to do so…
Please note that I have used Zen-cart module called “Column Layout Grid for Product Listing”.
And my solution for this problem is:-
At first, you need to add the following in your includes/templates/YOUR_TEMPLATE/css/stylesheet.css file:
<span style="color: #993366;">
Then, you need to edit in your includes/templates/YOUR_TEMPLATE/common/tpl_columnar_display.php file.
Add this code:-
if($col == (sizeof($list_box_contents[$row]) - 1))
echo "<br class=\"clearBoth\" />";
The above code should be written below this one:-
echo '<div' . $r_params . '>' . $list_box_contents[$row][$col]['text'] . '</div>' . "\n";
Hope it helps. Thanks.