Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • thesdhotel Friend
    #1031447

    Hello, First of all thank you so much for creating this incredible component. It’s just fantastic and works so well.

    I’m using Megafilter for the Content Component (Joomla nativa Custom Fields).

    During the past few days I’ve been studying it and customizing it to my needs (styling etc.) and encountered a few issues and questions, as well as some ideas for some improvements. I also read all the topics in this JA Megafilter forum to make sure I had all the necessary information before opening this and not mention things that have already been mentioned by others.

    1. Sorting by Custom Fields
    I noticed that when creating a new Filter, you can’t enable the "Use to sort" option for any of the Custom Fields, but only for the Base Fields. Why? Can this feature be added? I would really love to be able to sort for custom fields type like Date or Integer values.

    2. Disable Sorting by "Modified Date" and "Created Date"
    On the other hand, I can’t seem to be able to disable the option to sort by "Modified Date" and "Created Date". They’re not listed in the Base Fields, but yet, they are displayed in the frontend as sorting options. Why are these hard coded and not available to be switched on/off from Base Fields settings? Also, same thing for the "Position" sorting option, what is it and why can’t it be switched on/off?

    3. Template override for Component Layout doesn’t work?
    I can’t seem to be able to override the Component Layouts. I was able to succesfully override the Plugin Layouts (with /html/layouts/jamegafilter/content/default) but not the Component Layout, for example the specific filters layout which are found in the component. The override path created by Joomla is for example "/html/layouts/com_jamegafilter/filter/", but what I edit inside this folder doesn’t have effect, it seems to not work. Could you please check?

    4. Showing Custom Fields in the product-item layout
    Is there anyway to show a Custom Field in the product-item layout? I tried my best to add them but I couldn’t. I tried using this: https://docs.joomla.org/J3.x:Adding_custom_fields/Overrides by assigning a variable in helper.php using baseItem->jcfields, but it didn’t work, the problem is that it says you first need to load the event onContentPrepare and I don’t know how to do that. I also tried using using this post by Mr.Cat: https://www.joomlart.com/forums/topic/description-in-product-filter/#post-1015807, by adding those tags to the product-item file but it didn’t work for me either, maybe because that post was for K2 and I’m trying to do it for Content Custom Fields so maybe it’s different. Any help for this?

    5. Suggestion: Add more Menu Items settings for the layout
    I’m customizing the layout of the Filter by overriding the files and I have no problem with that, but I think maybe not all users are capable of using overrides, so to make it easier for everybody you could implement settings that control what is displayed in the frontend (which would make the respective files have IF statements that control whether a certain object should be displayed or not). Some settings could be:

    • Show item image? YES/NO
    • Show item title? YES/NO
    • Show item description? YES/NO
    • Show item category? YES/NO
    • Show item tags? YES/NO
    • Show item published date? YES/NO
    • Show item hits? YES/NO
    • Show item rating? YES/NO
    • Show "View Detail" button? YES/NO
      etc… These settings could change based on the Component of the Filter. I assume each component has their own stuff that can be displayed. I know this would probably be a lot of work but I think it would make sense to do it, to make the component as complete as possible.
      Another Menu option could be the possibilty to choose whether you want to enable/disable the layout chooser (Grid/List) in the toolbar or choose a fixed layout:
    • Layout chooser: USE GRID / USE LIST / SHOW CHOOSER BUTTON If you choose a fixed layout, the layout chooser button will not be loaded and only the chosen layout will be used (grid or list). For a certain Filter I might want to not allow users both layouts and want to force a fixed layout on them.

    Thanks a lot in advance for the help!
    Andy

    Luna Garden Moderator
    #1032249

    Hi,

    Thanks for your feedback. We all appreciate that.

    1. Sorting by Custom Fields: This feature is in process. However as we’re focusing on several different proejcts at the moment, we are not sure when the feature could be done.

    2. Disable Sorting by "Modified Date" and "Created Date"

      They’re not listed in the Base Fields, but yet, they are displayed in the frontend as sorting options. Why are these hard coded and not available to be switched on/off from Base Fields settings?

    It’s because they’re not in Filter List so they can’t be filtered. We’ll check this.

    1. Template override for Component Layout doesn’t work?
      Each Component has the individual layout, not the same, so we put layout for each Component in plugin filter.

    2. Showing Custom Fields in the product-item layout You mean in Result Products List ?
      Pls our developer check further. Then I’ll reply to you.

    3. Suggestion: Add more Menu Items settings for the layout
      Thanks. We’ll think about it.

    thesdhotel Friend
    #1032406

    Hello, Thanks for your replies,

    1. Sorting by Custom Fields "This feature is in process"

    For this, I actually tried to change in the database directly "sort":"0" to "sort":"1" for a Custom Field and it actually worked, sorting does work for Custom Fields it seems! But right now you need to manually modify 0 to 1 in the database, because you can’t switch it on when you edit the Filter in the Joomla backend. So it seems you should just allow for the fields to be able to switched on in the Backend because they seem to indeed work already.

    2. Disable Sorting by "Modified Date" and "Created Date"
    "It’s because they’re not in Filter List so they can’t be filtered. We’ll check this."

    Oh I understand. Is there a way to manually disable them for now? Maybe you can put them in the Filter List but with a X in the published column (so they can’t be used as filters) but with the ability to swtich them on/off for sorting?

    3. Template override for Component Layout doesn’t work?
    "Each Component has the individual layout, not the same, so we put layout for each Component in plugin filter."

    Yes, but the fields filtering layout are not in the invidual plugin, they are only in the general component. I’m talking about for example "/components/com_jamegafilter/layouts/filter/filter.range.php". How can I override this?

    4. Showing Custom Fields in the product-item layout

    I think I managed to display them, you can indeed do it like this: {attr.ct3.value|s} for example, where 3 is the ID of the field.

    But I have a problem. I would like to display each option value individually so I can style them individually when one field has multiple values. For example: Right now they’re displayed like this:

    Color of this product: red,green,blue

    I would like to be able to style them so I want to add a class to each single value, how can i do this? For example:

    Color of this product: <span class="red">red</span>, <span class="green">green</span>, <span class="blue">blue</span>

    Also another question, if I want to show a date field in the product item list (either {published_date} or a custom field date), it comes out with UNIX date format. How can I change the date format of the date in the product item layout?

    Thanks!

    Mr.Cat Moderator
    #1032915

    Hi @thesdhotel,

    1 .Sorting by custom field cause some performance issue so we decided do not enable this feature. It still has bugs and need time to fix. You can test it, but do not use it for product environment.

    2 .Open file

    /components/com_jamegafilter/views/default/view.html.php

    Remove these lines

    $sorts[] = array('field'=>'created_date', 'title'=> JText::_('COM_JAMEGAFILTER_CREATED_DATE'));
    $sorts[] = array('field'=>'modified_date', 'title'=> JText::_('COM_JAMEGAFILTER_MODIFIED_DATE'));

    3 .The override engine has changed but the document hasn’t updated. We’ll update document soon.
    Back to the question, to override "filter" folder, you can copy folter "filter" to

    /templates/ {your template} /html/layouts/jamegafilter/virtuemart/default/

    And edit files as you want.

    4 .You can do like this

    <div class="{attr.ct3.value|s}" >{attr.ct3.value|s}</div>

    5 . To show created_date with your format, please open file

    /plugins/jamegafilter/virtuemart/helper.php

    Change this line

    $item->created_date = strtotime($baseItem->created_on);

    To

    $item->created_date = ($baseItem->created_on);

    But, sorting by created date will stop working.

    Wisdom is not a product of schooling but of the lifelong attempt to acquire it.

    thesdhotel Friend
    #1032963

    Hey Mr. Cat,
    Thank you so much for your detailed replies!

    1. I see, well, I hope this becomes officially supported soon 🙂

    2. Great, it worked! For now, I commented out those lines 🙂 Do you think the option to disable them will be added officially as well? For obvious reason, I’m always trying to avoid to do core overrides as they get lost upon upgrading.

    3. It worked, perfect, thanks!

    4. Here’s the problem, when a field value has multiple options selected (for example, a checkboxes field with multiple options selected), all the options are displayed together in one single value when I use {attr.ct3.value|s}.

      <div class="red,green,blue" >red,green,blue</div>

      I would instead like to target each individual field value and wrap each value in their own class.

      <div class="red" >red</div>, <div class="green" >green</div>, <div class="blue" >blue</div>

      I assume this is not possible without adding some specific code in the helper.php or somewhere else to retrieve the fields in a earlier step, but I tried everything and had no luck. Could you help me achieve this?

    5. Thanks for pointing me in the right direction! I tried using your line but I that gave me the date in the format YYYY-MM-DD, which was not as I wanted, so I looked online how to set the date format in PHP and I added this:
      $item->published_date_format = date('F j, Y',strtotime($baseItem->publish_up));

      This gave me the date in the desired format.
      Also as you can see I created a new variable (published_date_format), and then I embedded in the product item layout {published_date_format}. This way I left the original {published_date} variable untouched so it wouldn’t stop working like you mentioned, did I have a good idea?

    And also, you could also add the date format as an option for the Megafilter Menu Item as well, if you want. 🙂

    Thanks again for your support!

    Mr.Cat Moderator
    #1033058

    @thesdhotel

    4 .Oh, i misunderstood. Here is the code.

    {#attr.ct3.value}
    <p class="{.}">{.}</p>
    {/attr.ct3.value}

    Out put is

    <p class="red">red</p>
    <p class="green">green</p>
    <p class="blue">blue</p>

    5 .Nicely done ^^~
    6 .We’ll discuss about it. Thanks for your suggestion.

    Wisdom is not a product of schooling but of the lifelong attempt to acquire it.

    thesdhotel Friend
    #1033152

    fdsfjdklfjdskghfkjghfkjlfkfdfjdfkgjhj!

    Perdon the excitement! The code works perfectly and it looks amazing! I will show you the final result once we put it online 🙂

    Thank you so much!

    @joomlart give a raise to this man! Or Cat? haha.

    @Mr.Cat I have one last question (I promise). I have an integer field with numbers from 1 to 100. I want to give it an individual class based on the number. If the number is less than 50 for example, give it a red background, if it’s more than 50 a yellow background, if it’s more than 75 a green background.

    I am able to do this in PHP with IF statements (i have infact done it for the display of the field in Joomla Articles) but I don’t think PHP can read the actual value from the {attr.ct6.value} variable, right? Do you have a solution for this too? If you do, you really are the man.

    Thanks again for all your help.

    Mr.Cat Moderator
    #1033456

    Hi @thesdhotel,

    You can use js for this.

    First print out your value

    <p class="test" x-data="{attr.ct6.value|s}"  >Test</p>

    Then use javascript Event onAfterRender to find element that has x-data match with your require. For examlple.

    jQuery(document).on('afterRender', function (e) {
            jQuery('.test').each(function(index, el) {
                var x = jQuery(el).attr('x-data');
                if (x < 10) {
                    jQuery(el).css('background', 'red');
                } esle if (x < 20) {
                    jQuery(el).css('background', 'blue');
                } else {
                    jQuery(el).css('background', 'green');
                }
            });
    });
    

    Hope this can work :))

    Wisdom is not a product of schooling but of the lifelong attempt to acquire it.

    thesdhotel Friend
    #1033477

    Hey Mr. Cat, thanks so much for that!
    Unfortunately that did not seem to work, see here: https://jsfiddle.net/wamwfvb1/

    However for now we decided that we will wait to implement this field as it’s not as important as the other ones, so don’t worry.

    Thanks again by the way, you even giving me JS code is way beyond what you should have as part as the support so I really appreciate your kindness.

    Andy

    thesdhotel Friend
    #1034507

    We’re finally live with our use and customization of JA Megafilter, and wanted to show you the result as promised. Take a look : https://www.thesmackdownhotel.com/games/ 🙂

    Thanks again for your help and for this beautiful component!

    wdiggles Friend
    #1038814

    @thesdhotel, thank you for this well written and helpful post. I have been using it as my guide for customizing JA Megafilter to fit my purposes.

    @Mr.Cat, thank you for the detailed answers!

    1. Suggestion: Add more Menu Items settings for the layout

    +1 vote for all of these suggestions. These improvements will make an awesome component even better!

    wdiggles Friend
    #1084345

    Sorry, I thought there was an issue with the code after updating the component to 1.1.1 but it turned out to be something else. 🙂

    • This reply was modified 6 years, 9 months ago by  wdiggles.
Viewing 12 posts - 1 through 12 (of 12 total)

This topic contains 11 replies, has 4 voices, and was last updated by  wdiggles 6 years, 9 months ago.

We moved to new unified forum. Please post all new support queries in our New Forum