Removing the Price Field

Discussion in 'Templates, HTML, CSS, and Design Help' started by sporthorsebreeder, Apr 11, 2006.

  1. Is it possible to remove or rename the Price Field for certain categories?
    Thanks for any help
    Cheers
    Hugh
  2. John Snyder Staff

    Yes.

    You will need to change category.php just be for the last line to look like this:

    PHP:
    $class_tpl->assign('sec',$sec);
    $class_tpl->assign('body',$body);
            
    $class_tpl->display('layout.tpl.php');  
    Then in showlistings.tpl.php:

    find the field you wish to rename (In this case I renamed the field to Ranch for only one category (24) and gave it a specific width.)

    HTML:
    {if $sDisTitle == "Y"}
        <th {if $sec==24}width="100"{/if}>{if $sec==24}Ranch Name{else}{$smarty.const.LANG_TITLE}{/if}</th>
    {/if}
    
    To change the name in the actual ad open viewlisting.tpl.php and find the field you wish to change.

    HTML:
        {if $viewprice=="Y"}
        <tr> 
            <td><strong>{if $listingsection == "1"}Some other name {else}{$smarty.const.LANG_PRICE}{/if{:</strong></td>
            <td>{$listingprice}</td>
        </tr>
        {/if}
    Here is a post where I detailed how to hide it based on the category:

    http://www.68classifieds.com/forums/showpost.php?p=806&postcount=4
  3. Lhotch curmudgeon

    removing the price field can be done but carries with it some issues. In order to remove the price from only certain categories a check needs to be put in place in 3 difeerent templates to check the current category and if thats the category your in it wont show the price. The problem with this is if someone does a search they wont be in a category and will possibly get a mix of ads with and without prices

    What a few have done is just insert a check to see if the price field contains a zeros or is empty and if so it just puts a few dashes in the price field. Its a little cleaner solution, would that work for you?
  4. John Snyder Staff

    Here is the code to detect a 0.00 value and replace it with ------ or whatever text you wish to be displayed:

    {$entry.price|replace:'$0.00':'----------'} here '$0.00' is the value you wish to replace and '---------' is what you wish to replace it with.

    You have to open viewlisting.tpl.php and showlistings.tpl.php and find {$entry.price} and replace it with {$entry.price|replace:'$0.00':'----------'}
  5. Hello John
    I found the code {$entry.price} and replaced it with {$entry.price|replace:'$0.00':'----------'} in the showlistings.tpl.php file. It was found on line 83. I searched for {$entry.price} in viewlistings.tpl.php but it was not found.
    When I looked at the ads on the site it has made no difference.
    Any idea what I am doing wrong?
    Cheers
    Hugh
  6. John Snyder Staff

    Sorry, it has a different name in viewlistings.tpl.php:

    find:
    HTML:
    {if $viewprice=="Y"}
    <tr> 
      <td><strong>{$smarty.const.LANG_PRICE}:</strong></td>
      <td>{$listingprice}</td>
    </tr>
    {/if}
    replace with:
    HTML:
    {if $viewprice=="Y"}
    <tr> 
      <td><strong>{$smarty.const.LANG_PRICE}:</strong></td>
      <td>{$listingprice|replace:'$0.00':'----------'}</td>
    </tr>
    {/if}
  7. Hello John
    Found it now and replaced it.
    Still no joy I'm afraid
    Any ideas
    Cheers
    Hugh
  8. John Snyder Staff

    you have a link so I can be sure we are on the same page?
  9. John Snyder Staff

    have you switched out the $ in that bit of code with the €
  10. John Snyder Staff

    viewlistings.tpl.php

    Code:
     {$listingprice|replace:'€0.00':'----------'}
    showlistings.tpl.php

    Code:
     {$entry.price|replace:'€0.00':'----------'}
  11. No
    I wondered if that would make a difference
    I will do that and let you know if that sorts it
    Got to go out just now but will repy later on today.
    Cheers
    Hugh
  12. Thanks John and Larry
    Replacing the price entry is working great.
    I will now have a go at replacing the Price Title in a couple of the Categories.
    I tried it earlier following your instructions but I must of made a mistake as I was receiving errors running the script.
    I will try it again later this evening and let you know how I get on.
    Thanks for your patience
    Cheers
    Hugh
  13. SkGold Customer

    I also did $0.00 replacement, thanks guys.
    However I have horizontal Featured ads on my home page and it still showing $0.00.
    How can I replace it?
    I tried to look in includes/template/plugins/function.feature_listings_horizontal.php but I have no idea what to change.
  14. dphibb Customer

    Okay, I finally found some time to play with this. I have successfully changed showlistings.tpl.php and viewlisting.tpl.php as stated above and it works great ; however, I have one final question on this issue: How can I change the Featured ads' prices on the bottom of index.php to also say "Contact Seller?" I see that someone else already asked that question here. Any help would be much appreciated.

    Thanks,
    Phyllis
    http://www.endlessmtnads.com

Share This Page