• anthonybuffo

    (@anthonybuffo)


    I want to keep the drop down option open so the user can see all the options at once and make a selection to . I need to know the code to do this and where it goes.

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Habibillah

    (@habibillah)

    See on faq at How can I change the listbox and discount templates?

    • This reply was modified 5 years ago by Habibillah.
    Thread Starter anthonybuffo

    (@anthonybuffo)

    I saw that previously and it only tells me how to copy a directory and make changes. It doe snot tell me the code to keep the box open. Also when I create that new directory and make changes to the php in those new folders it doesn’t do anything. No change takes place unless I modify the php in the plugins directory.

    Plugin Author Habibillah

    (@habibillah)

    You are correct. that just point you to place where you need to change it. for example you can change the <select> into <input type="radio">

    Thread Starter anthonybuffo

    (@anthonybuffo)

    Sorry I am not a coder. I need help with where to place this and what to write. I basically need the code. Or the code to keep the drop down open to display all the options at one time.

    Thread Starter anthonybuffo

    (@anthonybuffo)

    I also want to change the color of the “highlight/select”. How do I do that?

    Thread Starter anthonybuffo

    (@anthonybuffo)

    I STILL need some guidance on this. I have put the <input type=”radio”> all over the place in the wp-content/plugins/woocommerce-fixed-quantity/templates/global/quantity-input.php file and nothing seems to work. I get buttons to appear (un-formatted) and I can click/select multiple buttons at once and nothing is truly selected at all. I am obviously missing code and there is more to this than what you gave me in your intinal response to my problem.

    Again, if radio buttons are too difficult how can I just keep the entire drop box open to display all the options and where do I change the “selection” color which is currently blue.

    Plugin Author Habibillah

    (@habibillah)

    I think you need get someone help you. try to get it on freelancer or upwork

    I changed ‘[yourtheme]/woocommerce-fixed-quantity/global/quantity-input.php’ as per the above link to the code below.
    It shows radio buttons on the product pages and still the dropdown in the cart to keep it a clean display (@habibillah – feel free to use the code with a setting to turn the radio buttons off/on in your plugin):

    <?php
    /**
     * Product quantity inputs
     *
     * This template can be overrided by copying it to yourtheme/woocommerce-fixed-quantity/global/quantity-input.php
     *
     * @var string $input_name
     * @var WC_Product $product
     * @var int $selected_quantity
     */
    if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
    
    if (empty($product))
        global $product;
    
    $selected_quantity = !empty($selected_quantity)? $selected_quantity : '';
    
    $data = WoofixUtility::isFixedQtyPrice($product);
    ?>
    <div class="quantity_select">
    
        <?php
        if (!is_cart()) {
            do_action('woofix_before_quantity_input');
        }
        
        if (!is_cart()) {
            ?><div id="fq_qty_radio">
            <?php foreach ($data['woofix'] as $item): 
                $woofix_price = $item['woofix_price'];
                $woofix_qty = $item['woofix_qty'];
                $woofix_disc = $item['woofix_disc'] . '%';
                $price = wc_price($woofix_price);
                $total = wc_price($woofix_price * $woofix_qty);
        
                $woofix_desc = !empty($item['woofix_desc'])? $item['woofix_desc'] : WOOFIXCONF_QTY_DESC;
                $description = str_replace(
                    array('{qty}', '{price}', '{total}', '{discount}', ' '),
                    array($woofix_qty,  $price, $total, $woofix_disc, '&nbsp;'),
                    $woofix_desc
                );
                if ( empty ( $selected_quantity )) $selected_quantity = $woofix_qty; ?>
        
                <label for="<?php echo 'wqid.'.$woofix_qty; ?>"><input type="radio" name="<?php echo esc_attr( $input_name ); ?>" value="<?php echo $woofix_qty; ?>" id="<?php echo 'wqid.'.$woofix_qty; ?>" data-qty="<?php echo $woofix_qty; ?>" data-price="<?php echo $woofix_price; ?>" <?php echo ($selected_quantity == $woofix_qty)? "checked" : ""; ?>> <?php echo $description; ?></label><BR />
        
            <?php endforeach; ?>
            </div>
            <?php
        } else {
            ?>
        
            <select name="<?php echo esc_attr( $input_name ); ?>"
                    title="<?php _ex( 'Qty', 'Product quantity input tooltip', 'woofix' ); ?>"
                    class="qty">
                <?php foreach ($data['woofix'] as $item): ?>
        
                    <?php
                    $woofix_price = $item['woofix_price'];
                    $woofix_qty = $item['woofix_qty'];
                    $woofix_disc = $item['woofix_disc'] . '%';
                    $price = wc_price($woofix_price);
                    $total = wc_price($woofix_price * $woofix_qty);
        
                    $woofix_desc = !empty($item['woofix_desc'])? $item['woofix_desc'] : WOOFIXCONF_QTY_DESC;
                    $description = str_replace(
                        array('{qty}', '{price}', '{total}', '{discount}', ' '),
                        array($woofix_qty,  $price, $total, $woofix_disc, '&nbsp;'),
                        $woofix_desc
                    );
                    ?>
        
                    <option value="<?php echo $woofix_qty; ?>"
                            data-qty="<?php echo $woofix_qty; ?>"
                            data-price="<?php echo $woofix_price; ?>" <?php echo ($selected_quantity == $woofix_qty)? "selected" : ""; ?>>
                        
                        <?php echo $description; ?>
                    </option>
        
                <?php endforeach; ?>
            </select>
        
            <?php
        }
        
        if (!is_cart()) {
            do_action('woofix_after_quantity_input');
        }
        ?>
    
    </div>
    
Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Keep Dropdown box open’ is closed to new replies.