PDA

View Full Version : Display parent category along with the sub-category in the 'category' field



autocy
December 26, 2012, 12:41 PM
Hello,
I use auto classifieds version 4.1 and i need to display the parent category (maker) along with the sub-category(model) in the 'category' field in the listing details. See attached images to understand what i'm talking about. Anyone has any ideas how i can do it?

In the attached screenshot, it's a BMW 3 series so in the category field i want to display BMW 3 Series and not just '3 Series' as it is now. But only there. i don't want to mess up anything else.

Thanks in advance,
Alex

Viktor
December 26, 2012, 01:07 PM
Hello Alex,

You can use variable in template {$bread_crumbs}

ftp:templates>>your_template>>tpl>>controllers>>listing_details.tpl

and check this array {$bread_crumbs|@print_r} - smarty syntax.
if you want we can do it. But you should create ticket for that with your request and we will do it ASAP.

autocy
December 26, 2012, 02:02 PM
Hi Viktor,
Thanks for your quick reply. I did this but i thought it would also take effect in the listings boxes (see attached screenshot). sorry for this. How can i change that as well?

Also, what i did in listing_details.tpl is this:


<li><span class="name">{$lang.category}: </span> <a title="{$lang[$listing_data.Category_pName]}" href="{$rlBase}{if $config.mod_rewrite}{$pages[$listing_type.Page_key]}/{$listing_data.Path}{if $listing_type.Cat_postfix}.html{else}/{/if}{else}?page={$pages[$listing_type.Page_key]}&amp;category={$listing_data.Category_ID}{/if}">{$bread_crumbs[2].title}&nbsp;{$lang[$listing_data.Category_pName]}</a></li>

can you confirm i did it right?

If you can do it for me, check ticket ESF-310216 for ftp access.

Thank you

Viktor
December 27, 2012, 03:54 AM
Hello Alex,

yes you are right,

I have did it for browse and search pages too.

You can see it in ftp://includes>>classes>>rlListings.class.php at line ~ 843

after that:



if ( $config['cache'] )
{
$fields = $this -> getFormFields( $value['Category_ID'], 'short_forms', $value['Listing_type'] );
}


add this code:



$parent_cat = $this -> getOne('Key', "`ID` = '{$listings[$key]['Parent_ID']}'", 'categories');
$listings[$key]['Parent_cat_pName'] = 'categories+name+'.$parent_cat;


Then open ftp://includes>>classes>>rlSearch.class.php at line ~ 481

after that:



$fields = $rlListings -> getFormFields($value['Category_ID'], 'short_forms', $value['Listing_type']);


add new code:



$parent_cat = $this -> getOne('Key', "`ID` = '{$listings[$key]['Parent_ID']}'", 'categories');

$listings[$key]['Parent_cat_pName'] = 'categories+name+'.$parent_cat;


Then go to: ftp://templates>>your_template>>tpl>>blocks>>listing.tpl

find code at line ~44



{$listing.name}


and add:


{$lang[$listing.Parent_cat_pName]}

then at line ~ 101 find:


{$listing.name}

before add:

{$lang[$listing.Parent_cat_pName]}

I have added it on your site. You can check it only. But I wrote instruction for other people if anybody want same customization :)

autocy
December 27, 2012, 08:21 AM
Hi Viktor,
It works as asked and thank you very much but you missed two pages:
1. http://auto.demoflynax.com/recently-added.html <--didn't change on the recently added listings page
2. http://auto.demoflynax.com/autos/ford/mustang/ <--and also on the individual listing type it didn't change

I can't figure out what files to change for these pages. Can you help?

Thanks for your time and help Viktor

Viktor
December 27, 2012, 09:20 AM
Hello Alex,

Yes you are right I forgot about it.

Please go to ftp://includes>>classes>>rlListings.class.php

find method: getListings and code:



/* populate fields */
if ( $config['cache'] )
{
$fields = $this -> getFormFields( $value['Category_ID'], 'short_forms', $value['Listing_type'] );
}


and after it add new:



$parent_cat = $this -> getOne('Key', "`ID` = '{$listings[$key]['Parent_ID']}'", 'categories');

$listings[$key]['Parent_cat_pName'] = 'categories+name+'.$parent_cat;


then find method: getListingsByAccount

find code:



/* populate fields */
$fields = $this -> getFormFields( $value['Category_ID'], 'short_forms', $value['Listing_type'] );


after it add new:



$parent_cat = $this -> getOne('Key', "`ID` = '{$listings[$key]['Parent_ID']}'", 'categories');

$listings[$key]['Parent_cat_pName'] = 'categories+name+'.$parent_cat;


then find method: getRecentlyAdded
find code:



$fields = $this -> getFormFields( $value['Category_ID'], 'short_forms', $value['Listing_type'] );


after it add new:



$parent_cat = $this -> getOne('Key', "`ID` = '{$listings[$key]['Parent_ID']}'", 'categories');

$listings[$key]['Parent_cat_pName'] = 'categories+name+'.$parent_cat;


save and check again.


P.S. For Alex I have added this code already. Please check it only.

autocy
December 27, 2012, 09:46 AM
Hey,
It works :) Thanks