New Zenner
- Join Date:
- Apr 2009
- Posts:
- 42
- Plugin Contributions:
- 0
Product Description On Homepage Featured Products
Hi, i have spent the last hour using various posts from here, and a trial and error based system to add product descriptions to the Featured Products section of the homepage, after getting it all sorted, i decided i didnt like it, but thought it would be a waste to just delete the code, as such here it is.
I take no credit for the code (its compiled from several other posts), i just moved bits around and laid it into a table and to be honest dont fully understand what i did myself.
Can it be changed to suit Specials and New? i believe so, what i have read says it should be possible, but we are only using featured on homepage so i havent looked at their pages.
It should lay everything out as per attached image.
To do this using the override system navigate to
includes/modules
create a new folder named after your template
copy into it featured_products.php from within the modules folder
ending with
includes/modules/your_template/featured_products.php
Open this file
Find the following line (approx line 68)
$products_price = zen_get_products_display_price($featured_products->fields['products_id']);
and ADD directly after it
$products_description = zen_trunc_string(zen_clean_html(stripslashes(zen_get_products_description($featured_products->fields['products_id'], $_SESSION['languages_id']))), PRODUCT_LIST_DESCRIPTION);
find
$list_box_contents[$row][$col] = array('params' =>'class="centerBoxContentsFeatured centeredContent back"' . ' ' . 'style="width:' . $col_width . '%;"',
'text' => (($featured_products->fields['products_image'] == '' and PRODUCTS_IMAGE_NO_IMAGE_STATUS == 0) ? '' : '<a href="' . zen_href_link(zen_get_info_page($featured_products->fields['products_id']), 'cPath=' . $productsInCategory[$featured_products->fields['products_id']] . '&products_id=' . $featured_products->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $featured_products->fields['products_image'], $featured_products->fields['products_name'], IMAGE_FEATURED_PRODUCTS_LISTING_WIDTH, IMAGE_FEATURED_PRODUCTS_LISTING_HEIGHT) . '</a><br />') . '<a href="' . zen_href_link(zen_get_info_page($featured_products->fields['products_id']), 'cPath=' . $productsInCategory[$featured_products->fields['products_id']] . '&products_id=' . $featured_products->fields['products_id']) . '">' . $featured_products->fields['products_name'] . '</a><br />' . $products_price);
and REPLACE with
$list_box_contents[$row][$col] = array('params' =>'class="centerBoxContentsFeatured centeredContent back"' . ' ' . 'style="width:' . $col_width . '%;"', 'text' => '
<table border="0" width="100%">
<tr>
<td colspan="2"><a href="' . zen_href_link(zen_get_info_page($featured_products->fields['products_id']), 'products_id=' . $featured_products->fields['products_id']) . '">' . $featured_products->fields['products_name'] . '</a></td>
</tr>
<tr>
<td valign="top" ><a href="' . zen_href_link(zen_get_info_page($featured_products->fields['products_id']), 'products_id=' . $featured_products->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $featured_products->fields['products_image'], $featured_products->fields['products_name'], IMAGE_FEATURED_PRODUCTS_LISTING_WIDTH, IMAGE_FEATURED_PRODUCTS_LISTING_HEIGHT) . '</a><br />' . $products_price. '</td>
<td align="left" valign="top"><a href="' . zen_href_link(zen_get_info_page($featured_products->fields['products_id']), 'products_id=' . $featured_products->fields['products_id']) . '">' . '</a>' . $products_description .'<br />' . $info_link . '</td>
</tr>
</table>
');
Some of you will notice i spaced the code out quite abit, i found this easier for visualising the table, and identifying which bits of code i wanted to change.
Hope this helps someone.
Pete