Customizing Custom Details Layout

Hi.

I would like to customize the layout of the results on the detail page. I figure to be able to do this I will need to write queries for each directly from the database. I figure I'd have to a template override of "default_customdetails.php" to do this.

How would I go about querying the respective values so I can place it where I need it on the page?

I'm not a coder by any reasonable measure, but once I understand, I should be able to format it the way I need it to. Any help would be greatly appreciated.

Comments

  • Hello

    I see that we already speaking on help desk , but maybe it would be helpful for other users.
    In advert details custom fields values taken from model are indexed by id , so if you want to show value of for example id 42 you can use code
    <?php
    if(isset($this->fields['42']->value)){
    echo $this->fields['42']->value;
    } ?>
  • Hi Lukasz,

    Thanks for the code snippet. It's working out great. I'm having a problem with handling checkbox values, though.

    I want to be able to remove the all semicolons (;) and also to break each into it's own line, like a list. How would I do that? I don't need bullets, but the values listed down.

    Also, for some of the radio groups, I also have "others" as an option and then the following field (inputbox) will allow for the value for "other" to be entered. I would like that when the "other" option is chosen, instead of putting back the word "other", it would instead use the value of the inputbox field that follow.

    I'm so close to finishing. Thanks in advanced.
  • edited December 2018
    It's ok. I figured it out.

    <?php
    if(isset($this->fields['00']->value)){
    echo str_ireplace(';', '
    ', substr($this->fields['00']->value,1,-1));
    } ?>

    I even figured out how to maintain the line breaks from textarea.

    <?php
    if(isset($this->fields['00']->value)){
    echo nl2br($this->fields['00']->value);
    } ?>
  • Hi Lukasz,

    I have completed the detail view page, but now would like to add some of the custom field values to the category items page. I'm using the table-smart layout (I think) with the clean template.

    If it is possible, I would like the codes to use, similar to the on you share with me before for the detail view page so I can manually select the fields/values to display. I know by default, these details needs to be set in the field params to display on the category items. If I need to, then I will do this for all the fields I want to display. But, if it is not necessary since I'm manually selecting them, then that's fine too. Just tell me the way that is easiest.

    I prefer to do this manually as some field values will need to be treated differently.
    Example
    • checkbox fields will need the semicolons to be replaced by line breaks.
    • Social media links, needs to be placed on the respective social media icons so that it shows icons as buttons instead of links
    • textarea fields need to maintain their line breaks
    Again, I am constraint with time. I've completed the detail view page within the timeline I gave, but will need to finish everything else over the weekend, including this. On Monday we want to start testing all the feature of the website so we can do a soft launch on 25th December.

    Thank you, in advance.
  • Hello

    Great to hear that you resolved problem with checkboxes.

    >>If it is possible, I would like the codes to use, similar to the on you share with me before for the detail view page so I can manually select the fields/values to display. I know by default, these details needs to be set in the field params to display on the category items. If I need to, then I will do this for all the fields I want to display. But, if it is not necessary since I'm manually selecting them, then that's fine too. Just tell me the way that is easiest.

    -- In first you need to enable custom field in table view , you can do it in custom field edition :


    then in each $item object you should be able to
    get value of field like

    if(isset($item->fields['42'])){
    echo $item->fields['42'];
    }


    >>I prefer to do this manually as some field values will need to be treated differently.
    Example

    checkbox fields will need the semicolons to be replaced by line breaks.
    Social media links, needs to be placed on the respective social media icons so that it shows icons as buttons instead of links
    textarea fields need to maintain their line breaks
    -- Maybe it would be better to modify existing code which display custom fields values . If you are using smart table you should be able to find it in file components/com_djclassifieds/views/items/tmpl/default_smart.php lines 490-530

    Best Regards,
    Lukasz
  • Hello Lukasz,

    Again, thank you very much. I've managed to get pages laid out the way we wanted and they look great.

    I'm now having issues with Facebook commenting. "Comment" does show up at the bottom (where the comment usually goes), but nothing is showing to allow commenting (fields). Even when logged in, nothing shows.

    I'm also having issues with permissions when I try to set up the survey to requires an account to create a survey. This particular feature is not very important, but I'm wondering if what's causing this issue is also causing the comments not to show.
  • Hello

    >>Again, thank you very much. I've managed to get pages laid out the way we wanted and they look great.
    -- Great to hear that I could help.

    >>I'm now having issues with Facebook commenting. "Comment" does show up at the bottom (where the comment usually goes), but nothing is showing to allow commenting (fields). Even when logged in, nothing shows.
    -- Does your website is online ? This plugin may won't work if there is some htaccess password for example.
    Do you have any errors in console ? Please give me link to page where you have those problems.

    >>I'm also having issues with permissions when I try to set up the survey to requires an account to create a survey. This particular feature is not very important, but I'm wondering if what's causing this issue is also causing the comments not to show.
    -- Those are separated features which shouldn't have influence on each other. To check this permissions issue I wold need admin and ftp credentials. If you want me to check it please continue on help desk.
  • "Do you have any errors in console ? Please give me link to page where you have those problems. "

    No.. No error. It shows the word "Comments" with the tool tip icon (?) at the location where it's supposed to go, but with no fields or buttons.. Not even the tool tip shows anything when mouse-over it..

    "Those are separated features which shouldn't have influence on each other. To check this permissions issue I wold need admin and ftp credentials. If you want me to check it please continue on help desk."

    Ok. I will setup a FTP and Joomla account for you and send it via the Support email.

    Thanks again, Lukasz..
  • edited January 10
    Wow.. Funny thing. I just check the website and it seems to be working on regular article pages, but not on any of the detail pages.

    Anyways, emailed you the credentials. Thanks
  • Upon further look. I just realized that I have to different extensions handling FB comments and they're conflicting on the regular articles a bit - only a CSS conflict I've found so far, though.
  • >>Upon further look. I just realized that I have to different extensions handling FB comments and they're conflicting on the regular articles a bit - only a CSS conflict I've found so far, though.
    -- I think that this could cause all errors, because DJ-Classifieds run content plugins in description. I will check this on your website and let you know via support suystem.
Sign In or Register to comment.