V4.1.x Custom Category Templates Mod Problem

Discussion in 'Modules / Plugins / Modifications' started by rockabilly, Jun 14, 2009.

  1. rockabilly Customer

    Hello,
    I just uploaded the Custom Category Templates mod to my modules folder.
    I activated it, and attemped to enter the admin link. I get this error message:

    Warning: Smarty error: unable to read resource: "customcats_browse.tpl" in /home7/myelvisw/public_html/vanportads/includes/classes/smarty/Smarty.class.php on line 1092


    I am running v4.1.3 Developer

    Any ideas how to get this up and running?

    Just to confirm, will this module allow me to remove the price from a specific category such as "jobs", so when a person places an employment ad, there is not a field for "price'?

    Thanks in advance!!
  2. seymourjames All Hands On Deck

    Possibly a FTP corruption. Deactivate , delete and upload it again.


    Rather than writing info each time: Please post your 68 Classifieds type (Designer, Developer), version (4.0.x, 4.1.x) and template in your postings asking for help. This information will help you get better answers for your posts. A great place to do this is in your signature!
  3. Mike-N-Tosh Developer & Moderator

    This module does not remove anything from a category (IE: there will still be a price field when the seller goes through the checkout process). This module allows you to have a custom template for the display of a listing when viewed in search results in the showlistings(2).tpl templates. This includes whether you would want to show the price field or not.
  4. rockabilly Customer

    Hello,
    Thanks for your help guys. I did get this module working. It must have been corrupted during upload.
    I do see that it works just as you have explained below. Is there a way that I can remove the "price" field when a user posts an ad, and a way for it to not show on the main page of the ad? I am creating a category for jobs, so having a price filed would not really be applicable to this category.

    Thank you.

  5. seymourjames All Hands On Deck

    FTP corruption is a problem which occurs more often than we all like to think. No problem.
  6. MrGForce Customer

    Does anyone have an answer to rockabilly's question? Is there a way to tell the checkout process not to display the price name and field anywhere during the checkout process if it is a category that's not using it?

    And if the answer is posted elsewhere in the forum, could you please include the link to that thread, because I've searched and searched for the answer and can't find it.

    I found the thread for taking the price out of the showlistings but can't find anything about this.

    Your help would be greatly appreciated.

    Thanks.
  7. Lhotch curmudgeon

    You will need to edit step3.tpl of checkout where the price field is displayed.

    enable debug in layout.tpl so you can see the available variables, login to your site and start the ad placement process.

    On step3 where you see the ad fields, look at the debug console and you will see there is a smarty variable for category.

    Add logic around the display section for the price and specify the category IDs of thye cats where no price is needed so it effectivly hides the display of that field.
  8. MrGForce Customer

    I'll try that Larry. I haven't worked with smarty logic yet, but I'll give it a try and see what I can come up with.

    Thanks.
  9. Lhotch curmudgeon

    if the category where you want to hide the price is category 4 then use something like this...

    {if $category != "4"}
    display the default price display code here
    {/if}
  10. MrGForce Customer

    That'll do it Larry. As always, you're right there with the solution. I really appreciate it.
  11. MrGForce Customer

    Well as always, I spoke to soon.

    I must have gone brain dead, but for some reason I can't get it to accept more than 1 category ID. I'm presenting it with the or ( || ) command, as I do in my cgi scripts, but it's not working.

    When I put in the line {if $checkoutDisPrice=="Y" && $category != "45"} it works just fine for that one category. When I try to add in the other categories with the || command, it removes the price from ALL categories.

    If we could use the "ccnoprice" category field, it would solve all the problems, because that field is either Y, N, or Blank when you look at it in the database itself. Only problem is, that field doesn't show up in the information when you run the {debug} command.

    Any thoughts?
  12. Mike-N-Tosh Developer & Moderator

    What if you just put the ID's in like this?
    $category != "45", "47", "52"
  13. MrGForce Customer

    Didn't work. I get this parse error ....

    Parse error: syntax error, unexpected ',' in ...... step3 ......

    I removed the commas and got a similar parse error.
  14. Lhotch curmudgeon

    unfortunately that wont work. Smarty is not very advanced when it comes to comparing multiple values and doesnt directly support the creation of arrays BUT you can get tricky and do something like this.....

    nopricecat becomes the variable we want to evaluate for to determine if we should display the price field or not.

    the numbers at the end of the following line represent the categories where we WANT the price field displayed.

    {assign var='nopricecat' value=','|explode:'5,9,10,15'}


    {if in_array($nopricecat) }

    display normal price display code here

    {/if}


    EDIT: To more accuratly reflect the contents of the variable above you could change "nopricecat" to "pricecat" or anything you like, just make sure you use the same veriable name in both the assign and the in_array lines.
  15. MrGForce Customer

    I just did that and all the price fields are gone. This is the code that I have in my step3.tpl file ....

    {assign var='nopricecat' value=','|explode:'17,18,19,20'}
    {if $checkoutDisPrice=="Y" && in_array($nopricecat)}
    <p>
    <label for="price">{if $checkoutRequirePrice==Y}{$smarty.const.LANG_STAR} {/if} {$smarty.const.LANG_PRICE}{$smarty.const.LANG_COLON}</label>
    {$currency_symbol}<input name="price" id="price" value="{$price}" type="text" size="{$smarty.const.FIELD_SIZE}" />
    </p>
    {/if}
  16. Lhotch curmudgeon

    in_array is actually php so may not be playing nice with the smarty, try it like this....


    {assign var='nopricecat' value=','|explode:'17,18,19,20'}
    {if in_array($nopricecat)}
    {if $checkoutDisPrice=="Y"}
    <p>
    <label for="price">{if $checkoutRequirePrice==Y}{$smarty.const.LANG_STAR} {/if} {$smarty.const.LANG_PRICE}{$smarty.const.LANG_COLO N}</label>
    {$currency_symbol}<input name="price" id="price" value="{$price}" type="text" size="{$smarty.const.FIELD_SIZE}" />
    </p>
    {/if}
    {/if}
  17. MrGForce Customer

    No. Still takes out all the price fields from all the categories.

    I put it in just as you stated above.


    I need to run out on a job real quick, but if you have any more suggestions, I'll try them when I get back.

    I really appreciate your help with this.
  18. Lhotch curmudgeon

    doah! Sorry,I forgot the needle in the arguement. The in array line should be like this....

    {if in_array($category,$nopricecat)}

    Basically says if the value of the variable $category is in the array $nopricecat then process....
  19. MrGForce Customer

    Hi Larry;

    I just revised the tpl again and it still removes the price from ALL the categories. Before responding back, I went into the "Manage Categories" and checked the "Allow Price" (ccnoprice ) in each one that I want it showing up in. I did this, because while I was going through some of the categories after putting in the code, I noticed that the categories that I had not checked the box "Allow Price" were coming up with the following ....

    PriceLANG_COLO then the price field.

    After checking the box, that message went away, and so did the price field completely.

    Is there anything that I can check for you that would cause your code to not work?

    Sorry about this.
  20. MrGForce Customer

    I've just now taken the step3.tpl file back to the original format and have a new problem.

    After replacing the step3 file with the original, the price field wasn't showing up on about half of the categories.

    So, just for the heck of it, I went into the admin and deactivated the "Custom Category" Module.

    Now all the categories are back to normal and displaying the price field. Go figure.

    Does the Custom Categories module change the Step3 template? Just curious.

    Any other suggestions on the removal of the price field in the "step3.tpl file????????

Share This Page