PDA

View Full Version : posted_by Icon in Listing.tpl ?



Athanasios Christou
December 10, 2012, 11:21 PM
Hello community,

I want to show some logos as info in the search.

The Info vehicle acciden works.
See the example.

Now I want to display a logo to distinguish the listings, dealer or private.

I adapted the listing.tpl but unfortunately it does not work.
The field in the database, posted_by remains empty.

In the search field that exists and works.

Who can help me please?




{if $listing.vehicle_accident == '1'} <span class="" title=""><img src="{$rlTplBase}img/unfall.png" alt="{$lang.unfallpic}" title="{$lang.unfallpic}" width="35" height="25" /></span>{/if}

{if $listing.posted_by == 'buyer'} <span class="" title=""><img src="{$rlTplBase}img/haendler.png" alt="{$lang.haendlerpic}" title="{$lang.haendlerpic}" width="35" height="25" /></span>{/if}



251252253254


Thanks!!!

Peter Jonsson
December 11, 2012, 12:26 AM
Im trying to place a icon on the listing my self to see if it's a dealer or a privat listing.

Have you made a new field for the dealer icon ?

isnt it possible to take it from the account info ?

Mike
December 11, 2012, 12:12 PM
Dear Athanasios Christou,

It's likely that posted_by field used only in the search forms, to make it working for listings grid view you have to add it to the function which gets listings:

rlListings -> getListings for browse pages
rlSearch -> search
and some other functions as getListingsByPeriod

find place where script builds sql query and add posted by as below



$sql = "SELECT SQL_CALC_FOUND_ROWS DISTINCT {hook} ";
$sql .= "`T1`.*, `T3`.`Path` AS `Path`, `T3`.`Key` AS `Key`, `T3`.`Type` AS `Listing_type`, `T7`.`Type` as `posted_by`, ";


where `T7` is alias for the accounts table

Mike
December 11, 2012, 12:14 PM
Im trying to place a icon on the listing my self to see if it's a dealer or a privat listing.

Have you made a new field for the dealer icon ?

isnt it possible to take it from the account info ?


if you have icon in the account you can get it using same logic as in my previous post:




$sql = "SELECT SQL_CALC_FOUND_ROWS DISTINCT {hook} ";
$sql .= "`T1`.*, `T3`.`Path` AS `Path`, `T3`.`Key` AS `Key`, `T3`.`Type` AS `Listing_type`, `T7`.`Dealer_logo`, ";


and then access in the tpl as {$smarty.const.RL_FILES_URL}{$listing.Dealer_logo}

Dealer_logo is just example of field, please use your accounts logo field for this

Peter Jonsson
December 11, 2012, 02:20 PM
How about if i have a icon that i wanna show that arent from the dealers account.
I will have a icon at /images/dealers/dealericon.png that i want to use.

But i dont really get how to do it :/
I have added the code to rlListings.class.php and rlSearch.class.php an then the other tpl code where i wanted to show the logo from the dealer but all i get a broken image link because the image goes to "mywebsite.com/files" and nore more than this.

Also should there be a if statement ? if the listing are owned by a dealer then show this image ?

Athanasios Christou
December 11, 2012, 07:51 PM
Thanks Mike F.,

it works fine.

@ Peter Jonsson,

i use this code in listing.tpl



{if $listing.posted_by == 'dealer'} <span class="" title=""><img src="{$rlTplBase}img/haendler.png" alt="{$lang.dealerpic}" title="{$lang.dealerpic}" width="35" height="25" /></span>{/if}


I use a static Pic, haendler.png, in my tamplet-folder img.
all dealer Listings display a static pic.

255

Peter Jonsson
December 11, 2012, 10:07 PM
Thanks Mike F.,

it works fine.

@ Peter Jonsson,

i use this code in listing.tpl



{if $listing.posted_by == 'dealer'} <span class="" title=""><img src="{$rlTplBase}img/haendler.png" alt="{$lang.dealerpic}" title="{$lang.dealerpic}" width="35" height="25" /></span>{/if}


I use a static Pic, haendler.png, in my tamplet-folder img.
all dealer Listings display a static pic.

255

Thanks, but where exactly did you place the:


$sql = "SELECT SQL_CALC_FOUND_ROWS DISTINCT {hook} ";
$sql .= "`T1`.*, `T3`.`Path` AS `Path`, `T3`.`Key` AS `Key`, `T3`.`Type` AS `Listing_type`, `T7`.`Type` as `posted_by`, ";

I cant seem to get this to work :/.



EDIT:
Got it working now, just searched rlListings.class.php and rlSearch.class.php for "$sql .= "`T1`.*, `T3`.`Path` AS `Path`, `T3`.`Key` AS `Key`, `T3`.`Type` AS `Listing_type" and i just put "`T7`.`Type` as `posted_by`, " in that line.

Morgan Bohman
December 30, 2012, 05:07 PM
Hi and happy new year!
I installed this but doesn't seem to get it to work on New Listings page, anyone with a clue?

//Morgan

Mike
January 3, 2013, 06:54 AM
Hi and happy new year!
I installed this but doesn't seem to get it to work on New Listings page, anyone with a clue?

//Morgan

You probably have to add posted_by to the sql to the function getRecentlyAdded( in the rlListings class in addition to the getListings function

Morgan Bohman
January 3, 2013, 07:22 AM
Yepp you're right. BTW Mike, take a look at my site, there's a difference in the block headers width depending on if you are browsing with Safari, which shows the width and padding wrong, and FF, IE, Chrome which are right. You see it on the home page blocks left. The add above is 250 in lenght.

//Morgan

Abraham Adeyemi
May 14, 2015, 09:29 PM
Does anyone know how I put this on the listing details page? Or how do I get the account type name to show on the listing details page please? Thanks

Viktor
May 15, 2015, 04:04 AM
Hello Abraham,

I have answered in other post but I put code here to :)
put code: {$seller_info.Type_name} in listing_details.tpl file

Abraham Adeyemi
May 15, 2015, 10:06 AM
I don't know where else to put this so I'll just put it here, I need to have the listing compare box close automatically when the compare box is empty, because when you add and remove listings from it it just stays open and it's kind of annoying... Help please :P

1283

Viktor
May 16, 2015, 08:15 AM
Hello Abraham,

Please try to add new code in file: ftp://plugins>>compare>>static>>lib.js

find method: flCompare.remove = function(obj, id, nav, table){

and code:



if ( ids ) {
ids = ids.split(',');

if ( ids.indexOf(id) >= 0 ) {
ids.splice(ids.indexOf(id), 1);
}
createCookie('compare_listings', ids.join(','), 93);
}


after add new:



if ( ids == '' ) {
$('#compare_listings_tab').click();
}

save and check again.

Abraham Adeyemi
May 17, 2015, 07:41 PM
I tried it and nothing changed?? :/ Is there anything else I need to do or something? Thanks

Viktor
May 18, 2015, 03:18 AM
Hello Abraham,

May be you changed something else in the code? If you want I can try to solve it but you should send ftp access to my PM.

Abraham Adeyemi
May 18, 2015, 11:01 AM
Yeah I sent you a message, you know what I want right? I just need it to close automatically when the box is empty

Thank you :)

Viktor
May 19, 2015, 03:44 AM
Hello Abraham,

Yes my old code was a bit wrong. Sorry. I have changed code in post and in your plugin and now all working properly. Please check compare plugin.

Abraham Adeyemi
May 19, 2015, 03:49 AM
Thanks very much man :)

But I just noticed the compare table is a bit wierd, how do I control the things that show up in the table because things like title are showing up twice and things are all over the place, if you can take a look at it please and let me know

thank you so much for your help man :D

Viktor
May 20, 2015, 11:38 AM
Hello Abraham,

I have changed styles for compare plugin and now comparison table looks good, I think :)

Abraham Adeyemi
May 20, 2015, 11:51 AM
It looks beautiful man thanks very much! :D
How do I edit the fields that show up in the table though? I think I want to move a few things around....