Results 1 to 10 of 809

Hybrid View

  1. #1
    Join Date
    Apr 2014
    Location
    NJ
    Posts
    59
    Plugin Contributions
    0

    Default Re: Dynamic Filter - Left Col Boxes Misaligned

    This sounds like a great mod. I'm trying to figure out if it would be appropriate for my needs.
    I am working on a new site which will contain different categories of food products.
    I'd like to allow the user to be able to see all the gluten-free products, and even better, to see all gluten-free products in a particular category. So I'm wondering if it makes sense to just create a new category called "Gluten-Free". But it seems to make more sense to use the idea of a filter, and for the user to be able to click on the "Gluten-Free" filter whenever they see a list of products, so it would only show them the products in that category, or from those search results, etc., that are gluten-free.

    I have never used attributes, and I don't have any products with attribute variations. This would be more of a boolean. Either a product is gluten-free or it is not. I might come up with other filters, like nut-free.
    So, does it make sense to use this mod to accomplish that? How would I do that? Would I create an attribute called "Gluten-Free", put it on all the products, and set it to "true" when a product is gluten-free? Does that make sense? Is that going to force the user to do anything special when they want to add a product to their shopping cart? i.e., will they have to choose a value for this attribute? Or will they see something additional show up because this attribute is there? I'd really like to just set this attribute to true or false for each product, and not have it show up in a confusing way when the user views the product, but I would like the user to be able to filter on all products that have this attribute set to true. Does that make any sense? Can attributes be used like that, and would this mod make that possible?

    Thanks in advance for any help with this.

  2. #2
    Join Date
    Dec 2009
    Location
    Amersfoort, The Netherlands
    Posts
    2,845
    Plugin Contributions
    25

    Default Re: Dynamic Filter - Left Col Boxes Misaligned

    Quote Originally Posted by earth-friendly View Post
    This sounds like a great mod. I'm trying to figure out if it would be appropriate for my needs.
    I am working on a new site which will contain different categories of food products.
    I'd like to allow the user to be able to see all the gluten-free products, and even better, to see all gluten-free products in a particular category. So I'm wondering if it makes sense to just create a new category called "Gluten-Free". But it seems to make more sense to use the idea of a filter, and for the user to be able to click on the "Gluten-Free" filter whenever they see a list of products, so it would only show them the products in that category, or from those search results, etc., that are gluten-free.

    I have never used attributes, and I don't have any products with attribute variations. This would be more of a boolean. Either a product is gluten-free or it is not. I might come up with other filters, like nut-free.
    So, does it make sense to use this mod to accomplish that? How would I do that? Would I create an attribute called "Gluten-Free", put it on all the products, and set it to "true" when a product is gluten-free? Does that make sense? Is that going to force the user to do anything special when they want to add a product to their shopping cart? i.e., will they have to choose a value for this attribute? Or will they see something additional show up because this attribute is there? I'd really like to just set this attribute to true or false for each product, and not have it show up in a confusing way when the user views the product, but I would like the user to be able to filter on all products that have this attribute set to true. Does that make any sense? Can attributes be used like that, and would this mod make that possible?

    Thanks in advance for any help with this.
    I think the easiest would be to set a read only attribute, because the entities are not real optional choices. First make attribute name like "allergies". Next add value like glutenfree and nut free.
    Add these to the designated products.
    In the front end the you will be presented a new choice in the filter box called allergies. Depending on the settings you can choose one or multiple attributes.
    If you do not want to show the read only attribute in the product description, you can hide them using css

  3. #3
    Join Date
    Apr 2014
    Location
    NJ
    Posts
    59
    Plugin Contributions
    0

    Default Re: Dynamic Filter - Left Col Boxes Misaligned

    Thanks very much, Design75! This sounds like a great suggestion, and now I understand how attributes can be used here. I will try this.

  4. #4
    Join Date
    Apr 2014
    Location
    NJ
    Posts
    59
    Plugin Contributions
    0

    Default Re: Dynamic Filter - Left Col Boxes Misaligned

    Hi. You had given me a great suggestion a while ago about how to filter the products on my website by different food allergies: gluten free, nut free, etc. I have created an Option Name of Allergies (display-only), with Option Values of: Gluten Free, Tree Nut Free, Peanut Free, and Lactose Free. I have put the Allergies attribute on 2 products in the Snacks category.
    1) Don't Go Nuts Blueberry Blast is: Gluten Free, Peanut Free, and Tree Nut Free.
    2) Monk Pack Apple Quinoa is: Gluten Free and Lactose Free.
    I'm using the multiple checkboxes style. People might have multiple allergies, so if I check both Gluten Free and Lactose Free, I would expect that only the Monk Pack Apple Quinoa product would be returned, since it is the only product that has both options set. However, it is returning both of the products. I think it must be returning all products that have either of these options set, but instead, I want it to return only the products that have both of these options set. Is there any way for me to get that to happen?

    In case you want to see it in action, I have this running on my test site, test "dot" kosher4health "dot" com. You can go to the snacks category to see it work.

    Thanks very much for any help with this! It's a great mod, and I know it will be a great addition to my site.

  5. #5
    Join Date
    Dec 2009
    Location
    Amersfoort, The Netherlands
    Posts
    2,845
    Plugin Contributions
    25

    Default Re: Dynamic Filter - Left Col Boxes Misaligned

    Quote Originally Posted by earth-friendly View Post
    Hi. You had given me a great suggestion a while ago about how to filter the products on my website by different food allergies: gluten free, nut free, etc. I have created an Option Name of Allergies (display-only), with Option Values of: Gluten Free, Tree Nut Free, Peanut Free, and Lactose Free. I have put the Allergies attribute on 2 products in the Snacks category.
    1) Don't Go Nuts Blueberry Blast is: Gluten Free, Peanut Free, and Tree Nut Free.
    2) Monk Pack Apple Quinoa is: Gluten Free and Lactose Free.
    I'm using the multiple checkboxes style. People might have multiple allergies, so if I check both Gluten Free and Lactose Free, I would expect that only the Monk Pack Apple Quinoa product would be returned, since it is the only product that has both options set. However, it is returning both of the products. I think it must be returning all products that have either of these options set, but instead, I want it to return only the products that have both of these options set. Is there any way for me to get that to happen?

    In case you want to see it in action, I have this running on my test site, test "dot" kosher4health "dot" com. You can go to the snacks category to see it work.

    Thanks very much for any help with this! It's a great mod, and I know it will be a great addition to my site.
    I am on vacation right now, but as soon as I'm back (2 asks)I will take a look. Or else please remind me.

  6. #6
    Join Date
    Apr 2014
    Location
    NJ
    Posts
    59
    Plugin Contributions
    0

    Default Re: Dynamic Filter - Left Col Boxes Misaligned

    Quote Originally Posted by earth-friendly View Post
    Hi. You had given me a great suggestion a while ago about how to filter the products on my website by different food allergies: gluten free, nut free, etc. I have created an Option Name of Allergies (display-only), with Option Values of: Gluten Free, Tree Nut Free, Peanut Free, and Lactose Free. I have put the Allergies attribute on 2 products in the Snacks category.
    1) Don't Go Nuts Blueberry Blast is: Gluten Free, Peanut Free, and Tree Nut Free.
    2) Monk Pack Apple Quinoa is: Gluten Free and Lactose Free.
    I'm using the multiple checkboxes style. People might have multiple allergies, so if I check both Gluten Free and Lactose Free, I would expect that only the Monk Pack Apple Quinoa product would be returned, since it is the only product that has both options set. However, it is returning both of the products. I think it must be returning all products that have either of these options set, but instead, I want it to return only the products that have both of these options set. Is there any way for me to get that to happen?

    In case you want to see it in action, I have this running on my test site, test "dot" kosher4health "dot" com. You can go to the snacks category to see it work.

    Thanks very much for any help with this! It's a great mod, and I know it will be a great addition to my site.
    Design75, no need to look into this issue. I found a way to solve this problem.
    I created each of these allergies as a separate Option Name, and each Option Name has a single Option Value.
    So I have an Option Name: Gluten Free, and that Option has 1 Option Value, which I also call Gluten Free.
    Then I have another Option Name: Peanut Free, and that Option has 1 Option Value, which I call Peanut Free, and so on.
    Now, if you want to find products that are both Gluten Free and Peanut Free, you click on both checkboxes, and it does it correctly.
    Previously, I just had one Option Name, Allergies, and a bunch of different Option Values for that option (Gluten Free, Peanut Free, etc.) When I clicked on 2 different option values, it found the products that were either Gluten Free or Peanut Free. I can understand that in some cases you might want this behavior. For example, if you have clothing that comes in different colors, you might want to find all clothes that are either red or purple. But in my case, I want to find products that are both Gluten Free and Peanut Free, so this solution seems to work well for that.
    I fixed up the styling so that the option names don't display, and I tightened up the spacing.
    I have implemented this on my live site, so you can see it working there if you'd like.
    http://www.kosher4health.com .
    Thanks again for a great mod! I think this will be very helpful for my customers.

  7. #7
    Join Date
    Dec 2009
    Location
    Amersfoort, The Netherlands
    Posts
    2,845
    Plugin Contributions
    25

    Default Re: Dynamic Filter - Left Col Boxes Misaligned

    glad you figured it out. I am sure it will help others.

  8. #8
    Join Date
    Apr 2014
    Location
    NJ
    Posts
    59
    Plugin Contributions
    0

    Default Re: Dynamic Filter - Left Col Boxes Misaligned

    I have discovered a problem.
    If you go to my website, http://www.kosher4health.com, and go to the "Snacks" category, and then click on the checkbox for "Gluten Free", and then at the top right, instead of going to the next page, click "View All",
    then I get: "There are no products to list in this category." even though there are products.
    There is a debug file, and it has a bunch of stuff, but I think the main thing is that it is trying to divide by zero in split_page_results.php, on line 100. (I can give you the complete debug file if that will be helpful.)
    This is line 100:
    Code:
     $this->number_of_pages = ceil($this->number_of_rows / $this->number_of_rows_per_page);
    This means that
    Code:
    $this->number_of_rows_per_page
    is zero.
    Higher up in the file we have:
    Code:
    $this->number_of_rows_per_page = $max_rows;
    and a little above that we have:
    Code:
        if ($page == 'all') {
          $this->page_all = true;
          $override = $db->Execute($query);
          $max_rows = $override->RecordCount();
        }
    So it looks like the query is not returning any results.

    I'm not sure where I should go from here. I could work in my test site, and turn on debugging for sql statements. Or, does anyone have any ideas about what might be going wrong and how to fix it?
    I am using zen-cart 1.5.5a, and the Winchester Responsive template.
    I did my best to modify split_page_results.php for this mod, but there were some significant differences between this file and my version, probably because of both 1.5.5a and Winchester Responsive.
    Thanks in advance for any help with this issue!

  9. #9
    Join Date
    Apr 2014
    Location
    NJ
    Posts
    59
    Plugin Contributions
    0

    Default Re: Dynamic Filter - Left Col Boxes Misaligned

    Quote Originally Posted by earth-friendly View Post
    I have discovered a problem.
    If you go to my website, http://www.kosher4health.com, and go to the "Snacks" category, and then click on the checkbox for "Gluten Free", and then at the top right, instead of going to the next page, click "View All",
    then I get: "There are no products to list in this category." even though there are products.
    There is a debug file, and it has a bunch of stuff, but I think the main thing is that it is trying to divide by zero in split_page_results.php, on line 100. (I can give you the complete debug file if that will be helpful.)
    This is line 100:
    Code:
     $this->number_of_pages = ceil($this->number_of_rows / $this->number_of_rows_per_page);
    This means that
    Code:
    $this->number_of_rows_per_page
    is zero.
    Higher up in the file we have:
    Code:
    $this->number_of_rows_per_page = $max_rows;
    and a little above that we have:
    Code:
        if ($page == 'all') {
          $this->page_all = true;
          $override = $db->Execute($query);
          $max_rows = $override->RecordCount();
        }
    So it looks like the query is not returning any results.

    I'm not sure where I should go from here. I could work in my test site, and turn on debugging for sql statements. Or, does anyone have any ideas about what might be going wrong and how to fix it?
    I am using zen-cart 1.5.5a, and the Winchester Responsive template.
    I did my best to modify split_page_results.php for this mod, but there were some significant differences between this file and my version, probably because of both 1.5.5a and Winchester Responsive.
    Thanks in advance for any help with this issue!
    I have sort of figured this out, but not sure if my solution makes total sense.
    The file I worked with is includes/modules/MYTEMPLATE/dynamic_filter.php
    The issue seems to be in the HAVING part of the query:
    Code:
     $having .= ' FIND_IN_SET("' . $key . addslashes($value) . '", GROUP_CONCAT(CONCAT(REPLACE(po.products_options_name, " ", ""), pov.products_options_values_name)))';
    When I go to my website and click on the snacks category,
    http://www.kosher4health.com/snacks-c-1.html
    and then I click on "Gluten Free" to filter by that,
    everything works fine. The value of $having at that point is:
    Code:
    HAVING ( 
    FIND_IN_SET("GlutenFreeGluten Free", GROUP_CONCAT(CONCAT(REPLACE(po.products_options_name, " ", ""), pov.products_options_values_name)))
    However, if I then click on the "View All" link in the top right (instead of going to a particular page number), it says there are no products to list in this category. The query that is being run returns no records. And, the value of $having at that point is:
    Code:
    HAVING ( 
    FIND_IN_SET("GlutenFreeGluten%20Free", GROUP_CONCAT(CONCAT(REPLACE(po.products_options_name, " ", ""), pov.products_options_values_name)))
    So in other words, the option value that it is searching for in the database, after clicking on "Gluten Free", is "Gluten Free".
    But after clicking on "View All", the option value that it is searching for is "Gluten%20Free".

    I also noticed that the urls are a bit strange:
    After clicking on the checkbox for "Gluten Free", the url is:
    Code:
    http://www.mydomainname.com/snacks-c-1.html?main_page=index&cPath=1&fltGlutenFree%5B%5D=Gluten+Free
    and after clicking on "View All", the url is:
    Code:
    http://www.mydomainname.com/snacks-c-1.html?fltGlutenFree%5B%5D=Gluten%2520Free&sort=20a&page=all
    It looks like extra encoding happens during this process.

    The solution I came up with in my test site is to remove both a space and "%20" in $value, and then in the db search, also remove spaces from the products_options_values_name, in the same way that spaces are being removed from the search on products_options_name.
    So, I replaced :
    Code:
    $having .= ' FIND_IN_SET("' . $key . addslashes($value) . '", GROUP_CONCAT(CONCAT(REPLACE(po.products_options_name, " ", ""), pov.products_options_values_name)))';
    with
    Code:
              $having_value = str_replace(" ","",$value);
              $having_value = str_replace("%20","",$having_value);
              $having .= ' FIND_IN_SET("' . $key . addslashes($having_value) . '", GROUP_CONCAT(CONCAT(REPLACE(po.products_options_name, " ", ""), REPLACE(pov.products_options_values_name, " ", ""))))'
    And now, after clicking on the checkbox for Gluten Free, the value of $having is:
    Code:
    HAVING ( 
    FIND_IN_SET("GlutenFreeGlutenFree", GROUP_CONCAT(CONCAT(REPLACE(po.products_options_name, " ", ""), REPLACE(pov.products_options_values_name, " ", ""))))
    and after clicking on "View All", the value of $having is:
    Code:
    HAVING ( 
    FIND_IN_SET("GlutenFreeGlutenFree", GROUP_CONCAT(CONCAT(REPLACE(po.products_options_name, " ", ""), REPLACE(pov.products_options_values_name, " ", ""))))
    I haven't put this on my live site yet. I was hoping that perhaps Design75, you could please look it over to make sure it is a reasonable change.
    Also, I wonder if anyone else has had this problem, or if it has to do with the template I am using.
    Thanks in advance for your help with this!!

  10. #10
    Join Date
    Apr 2014
    Location
    NJ
    Posts
    59
    Plugin Contributions
    0

    Default Re: Dynamic Filter - Left Col Boxes Misaligned

    Just to let you know, the changes described above didn't completely solve the problem. I found that if I filtered by "Gluten Free", and then clicked to go to page 2, then to page 3, it would still double encode the space in "Gluten Free" in the url, and I would end up with finding no results.
    The solution I came up with had the following changes:
    1) In includes/modules/mytemplate/dynamic_filter.php
    Replace
    Code:
     $having .= ' FIND_IN_SET("' . $key . addslashes($value) . '", GROUP_CONCAT(CONCAT(REPLACE(po.products_options_name, " ", ""), pov.products_options_values_name)))';
    with
    Code:
     // BOF LEFP fix to remove spaces before searching for attribute values
             $having_value = str_replace(" ","",$value);
             $having_value = str_replace("%20","",$having_value);
               $having .= ' FIND_IN_SET("' . $key . addslashes($having_value) . '", GROUP_CONCAT(CONCAT(REPLACE(po.products_options_name, " ", ""), REPLACE(pov.products_options_values_name, " ", ""))))';
    // EOF LEFP fix
    2) In includes/templates/mytemplate/sideboxes/tpl_dynamic_filter.php
    Right before:
    Code:
     if ($attributes->fields['products_options_values_name'] != $savValue)
    add:
    Code:
    // BOF LEFP fix to remove spaces before searching for attribute values
             $value_without_spaces = str_replace(" ","",$attributes->fields['products_options_values_name']);
    Then, everywhere within the "if" statement, replace
    Code:
    $attributes->fields['products_options_values_name']
    with
    Code:
    $value_without_spaces
    EXCEPT where we are actually printing it out, because we want "Gluten Free" to show up with the space on the page:
    Code:
    htmlspecialchars(html_entity_decode($attributes->fields['products_options_values_name'], ENT_QUOTES)) .' 
    Also, replace
    Code:
     $savValue = $attributes->fields['products_options_values_name'];
    with
    Code:
     $savValue = $value_without_spaces;
    Note: I am using the single checkbox method, so I only made those changes in my file, so I'm not sure if the changes are identical for the other methods.
    Anyway, those are the changes I made, and it seems to work ok. I have it on my live site now, http://www.kosher4health.com. I'd love to hear comments about whether or not this change is ideal. I hope this helps someone
    I'm still not sure if this was a problem for everyone, or just for me because of the template I am using. Perhaps everyone else has single-word attribute values, and I am the first person to have an attribute value with a space?

 

 

Similar Threads

  1. Hebrew Support - latest release [Support Thread]
    By eranariel in forum Addon Language Packs
    Replies: 22
    Last Post: 26 Jan 2026, 06:47 AM
  2. Empty Dynamic Filter
    By LadyoftheCave in forum All Other Contributions/Addons
    Replies: 3
    Last Post: 6 Jun 2016, 12:47 PM
  3. v150 Dynamic filter
    By Dinoleix in forum All Other Contributions/Addons
    Replies: 1
    Last Post: 13 Aug 2013, 10:23 AM
  4. v150 Dynamic filter - All pages
    By Okkwebmedia in forum Addon Sideboxes
    Replies: 0
    Last Post: 8 Jul 2013, 08:52 AM
  5. v138a Dynamic Filter
    By SoftCorpse in forum All Other Contributions/Addons
    Replies: 9
    Last Post: 18 Jun 2012, 01:32 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg