1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

searchresults.php with owner name

Discussion in 'Customizations' started by performancecentral, Feb 12, 2013.

  1. Hi all,
    I had a good browse on here for my query but couldn't find something that defined the right procedure.

    I use searchresults.php to display all the items by a certain seller, as this url page would be shared amongst other web sites there is nothing (apart from the ownerID) to tell them who's listings these are.

    I would like to get the sellers name to appear on the page but i'm not quite sure which field to pull out. I have tried using debug and selecting a few of the fields that look similar to seller name but couldn't get it to work

    So far I can get the ownersID to come up but not the sellers name.

    Any help would be hugely appreciated

    I was also trying to figure out how I can display the PAGE ID on a page. I want to make a shortcut link for only administrators to directly edit that particular page i'm looking at (since i use pages for articles)

    Here is my site:
    http://www.performancecentral.com.au/searchresults.php?owner=540
  2. Mike-N-Tosh Owner

    That's not available in the showlistings(2).tpl, because it is used as searchresults which could be from several different sellers at any time.

    So I'm guessing that you are getting the url you are using from one of the sellers individual listings? If yes, then I would suggest that you modify listingextras.tpl file (templates/{current template folder} OR {default}/viewlisting/listingextras.tpl)

    Find this:
    Code:
    <span class="moreads"><a href="searchresults.php?owner={$owner}">{$smarty.const.LANG_MORE_ADS_SELLER}</a></span>
    replace owner={$owner} with username={$username}

    This will change the url to use the username instead with the same results, BUT you will now have the username right in the url which you can then "get" using smarty to do whatever you want to. I would suggest something like:

    {if $smarty.get.username} <-- This might not be correct, I'm going off memory. If it's wrong check smarty.net for proper "get" syntax.
    <div class="username_title"> <-- I made this class up, but you get the idea I hope!
    Listings for {$smarty.get.username}
    </div>
    {/if}
  3. Great suggestion. I tried changing it but unfortunately the username={$username} brought up all results that contain the username. For example I have one username which is just "t" and when it does the following code:
    http://www.performancecentral.com.au/searchresults.php?owner=t it actually brings up all listings that contain or begin with "t".

    Could I have done something wrong?

    I used the following code:
    <span class="moreads"><a href="searchresults.php?username={$username}">{$smarty.const.LANG_MORE_ADS_SELLER}</a></span>

    Any suggestions if i've mixed up anything? I am so close thanks for taking the time to help me with this. Your time is really appreciated.
  4. Mike-N-Tosh Owner

    I would add the owner variable back in then and use both in the search criteria:
    owner={$owner}&username={$username}

    I haven't tested this, if you get an error because of the "&" you may need to use the html entity, "&amp;" instead.
  5. Thanks mate that works absolutely perfect thank you :)
  6. EDIT: FOUND IT. I wasn't able to get debug working as SEO mod was on.
    I used {$lid}
    The only one I didn't try lol


    The only thing I had left that I couldn't work out was how to display the page ID from within the viewlisting.tpl page

    I am making a administrator link so I will be able to directly edit the listing for corrections.

    The link I need to go to was:
    http://www.performancecentral.com.au/administration/listings.php?view=LISTINGID

    So I was going to use:
    http://www.performancecentral.com.au/administration/listings.php?view={pageid}
    but it wouldn't work

    I tried calling any one of these variables to try and display the listingID but nothing would work unfortunately.

    {$smarty.get.pID}
    {$smarty.request.pID}
    {$smarty.get.ID}
    {$smarty.request.pid}
    {$smarty.get.p.pID}
    {$smarty.request.p.pID}
    {$smarty.get.pageID}
    {$smarty.request.pageID}
    {$pid}
    {$pageID}
    {$p.pID}
  7. ozgunsales Member

    view={$entry.id}
    perhaps

Share This Page