Jump to content
Safir Hosting

Need a hook for changing a div class

Recommended Posts

Hello All,

I need a hook for changing a div class from col-sm-6 to col-sm-12 for Configurable Options Group on Cart. When i inspect the element it's in cart.php > secondary-cart-body > product-configurable-options i tried to explain a bit below. Any help appreciated.

image.thumb.png.7d00f32f2efcd876e68cd0e0ea2b581e.png

Share this post


Link to post
Share on other sites

Using the hook in

and just adding in

 $('#inputOptionXX').parent().parent().attr('class', 'col-sm-12');

to the html string should do the trick.  You just need to get the input field name for that option.   However, do note that you will probably have to adjust the other input also as otherwise you will get a blank area there. 

Share this post


Link to post
Share on other sites

Hello, below did the trick by product, because some products configOptions are different from others. Only thing you can select more than one products inserting product id into array in $products like 3,5,10 that has same inputConfigOption value. Appreciate for your help

<?php

add_hook('ClientAreaFooterOutput', 1, function ($vars) {
    
    // Add the product ID to the array below with commas separting them.  For example: array(1,4,5)
    $Products = array();

    if (isset($vars['templatefile']) and $vars['templatefile']==='configureproduct')
    {
        if (isset($vars['productinfo'] ) and in_array($vars['productinfo']['pid'], $Products))
        {
            $HTML = "<script> 
            $( document ).ready(function() {
                  $('#inputConfigOption19').parent().parent().attr('class', 'col-sm-12'); });
            </script>";
            return $HTML;
        }
    }
});

 

Share this post


Link to post
Share on other sites
1 hour ago, Safir Hosting said:

Hello, below did the trick by product, because some products configOptions are different from others. Only thing you can select more than one products inserting product id into array in $products like 3,5,10 that has same inputConfigOption value. Appreciate for your help

If you want that to apply to any product that has that config option, just remove the if that checks for product.  The id for that config option will be the same for any other product. 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated