Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1086955

    Hi,

    In the builder I am using the product grid and load in the main category ‘Alpincenter Bottrop’.
    So in the front-end I am getting code like this:

    <ul class="products">
    
       <li class="post-3204 product type-product status-publish product_cat-alpincenter-bottrop product_cat-winter-all-incl-dagticket-ma-t-m-vrij first instock sale shipping-taxable purchasable product-type-simple"></li>
    
       <li class="post-3206 product type-product status-publish product_cat-winter-all-incl-dagticket-ma-t-m-do product_cat-alpincenter-bottrop last instock sale shipping-taxable purchasable product-type-simple"></li>
    
       <li class="post-3211 product type-product status-publish product_cat-alpincenter-bottrop product_cat-winter-all-incl-dagticket-zat-zon last instock sale shipping-taxable purchasable product-type-simple"></li>
    
       <li class="post-3213 product type-product status-publish product_cat-alpincenter-bottrop product_cat-winter-all-incl-dagticket-zat-zon last instock sale shipping-taxable purchasable product-type-simple"></li>
    
    </ul>

    What I want is to .wrapAll() the <li> items which have the same categories both.
    So if they have both product_cat-alpincenter-bottrop and product_cat-winter-all-incl-dagticket-zat-zon for example this <li> items needs to be wrapped in a DIV called <new />.

    So the products with same subcategory will be nested with each other ;)

    Also I want to echo the category names of the products in the DIV <new />

    In the private content there is a link to the product like how it is now.

    #1087875

    Hey (Email address hidden if logged out) ,
    Sorry for the late reply, but it looks like you have already found the solution for this, I was going to suggest to try adding this code to the end of your functions.php file in Appearance > Editor:

    function custom_script(){
      ?>
      <script>
    (function($){
      $(document).ready(function(){
      $('li.product_cat-alpincenter-bottrop.product_cat-winter-all-incl-dagticket-zat-zon').wrapAll('<div class="new" />')
      });
      })(jQuery);
    </script>
    <?php
    }
    add_action('wp_footer', 'custom_script');

    Best regards,
    Mike

    #1088199

    Hi Mike,
    It needs to auto detect which elements has the same category.
    So when the customer adds a category I don’t have so edit the code again.

    #1088514

    Hi,
    That is probably possible, but it would be outside the scope of what we can do here. We have partnered with Codeable to assist in such customizations and understand Enfold very well.

    Best regards,
    Mike

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.