Overwritting standard ad display (list)
rusdvl - September 30, 2009 - 01:45
| Project: | Classified Ads |
| Version: | 6.x-2.x-dev |
| Component: | User interface |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
Hey,
Just wondering how would i go about modifying the way the 'browse' section is displayed. So when i go to category that displays a list with all the ads in it. At the moment the list displays 'title', 'body', 'posted by' and 'created on'. I have added a few cck fields to the content type and would like to modify the list to display those extra custom fields and remove some of the default ones. What would be the best way to do it?
I have quite a few categories and creating a custom 'view' for each category would be a pain and hard to maintain. So maybe I need to overwrite a function in my template.php file!??? any help would be appreciated.
Cheers

#1
Can anyone point me in the right direction?
#2
This is something I've been intending to give more attention to, both for CCK field additions and for additional taxonomy browsing. But the short answer is that you can override the template file (copying node.tpl.php to node-ed_classified.tpl.php in your theme directory will allow you to tailor the output) and you should have access to all of the node variables including CCK fields. Let me know how it goes.
Cheers,
Miles
#3
I think it will be easier for me to edit the theme_ed_classified_category_list_ad_row() function in ed_classified_themefuncs.inc as it is this function that is displaying it. So i copied it and pasted it in my template.php file and renamed it accordingly. It works all nice and dandy but the question is how do I display the CCK fields? Googled to try and figure it out, but no luck. Also one of the CCK fields is an image and im resizing and cropping it using imagecache, and would like to display the thumbnail version. Any idea on how to do that?
#4
In the template.php file ive printed this code: $ad->field_price[0]['view'] and when I look at it through devel it shows me the exact value of that. BUT it does not display it... doesnt print it onto the screen... any ideas?
Its definitely there if I go by what devel says. Man this is annoying... someone please help....!!!
This is the whole function:
function theme_ed_classified_category_list_ad_row($ad, $rowcount) {module_load_include('inc', 'ed_classified', 'ed_classified_utils');
$content .= '<li';
if ($ad->sticky) {
$content .= ' class="sticky"';
}
$content .= ">\n";
$content .= theme('imagecache', 'thumbnail', $field_photos[0]['filepath']);
$content .= '<h3>'. l($ad->title, drupal_get_path_alias('node/'. $ad->nid),
array('attributes' => array('title' => 'Description here!'))) ."</h3>";
if (_ed_classified_variable_get('show_body_in_ad_list', EDI_CLASSIFIED_VAR_DEF_SHOW_BODY_IN_AD_LIST)) {
$content .= '<div class=\'classified-description\'>'. check_markup($ad->body, $ad->format, FALSE) .'</div>';
if (theme_get_setting('toggle_node_info_'. $ad->type)) {
$content .= '<div class="field-address"><label class="label-field-address-value">'.t('Address:').' </label><span class="field-address-value">'.$ad->field_address[0]['view'].'</span></div>';
$content .= '<div class="field-price"><label class="label-field-price-value">'.t('Price:').' </label><span class="field-price-value">'.$ad->field_price[0]['view'].'</span></div>';
}
}
$content .= "</li>\n";
return $content;
}
UPDATE: Figured it out... $ad->field_price[0]['view'] should've been $ad->field_price[0]['value']