[SOLVED] Using Conditional Logic Show/Hide within example_custom.php””

Home – SaaS Forums Support questions WooPrice Calculator (Pro) [SOLVED] Using Conditional Logic Show/Hide within example_custom.php””

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #7352
    Justin Leonard
    Participant

    Established a working Conditional Logic field list, works great on autogenerated theme.

    However I would like to utilize my custom layout “example_custom.php” and include the conditional logic of show/hide.

    I have included the 2 list fields below that I would like to add the Conditional Logic switch to but can’t quite translate the conversion to the custom theme code from the original implementation:

    [b]Original Conditional Logic Code Provided in “example.php”:[/b]
    data-field-id="<?php echo $data['field']->id; ?>" style="<?php echo ($this->view['conditionalLogic'][$data['field']->id] == true)?"":"display:none"; ?>"

    [b]Custom Theme Code:[/b]

    <div class="form-row">
                        <!--Field start - Left Pocket Options -->
                        <div id="<?php echo $this->view['data']['aws_price_calc_51']['elementId']; ?>" class="form-group col-md-6 awspc-field-widget" >
                            <div class="awspc-field <?php echo $this->view['data']['aws_price_calc_51']['class']; ?>">
                                <label for="<?php echo $this->view['data']['aws_price_calc_51']['elementId']; ?>_field">
    			<?php echo $this->view['fields']['aws_price_calc_51']['label_name']; ?></label>
                                <?php echo $this->view['fields']['aws_price_calc_51']['html']; ?>
                            </div>
                            <div class="awspc-field-error"></div>
                        </div>
                    <!--Field end-->
                        <!--Field start - Right Pocket Options -->
                        <div id="<?php echo $this->view['data']['aws_price_calc_52']['elementId']; ?>" class="form-group col-md-6 awspc-field-widget" >
                            <div class="awspc-field <?php echo $this->view['data']['aws_price_calc_52']['class']; ?>">
                                <label for="<?php echo $this->view['data']['aws_price_calc_52']['elementId']; ?>_field">
    			<?php echo $this->view['fields']['aws_price_calc_52']['label_name']; ?></label>
                                <?php echo $this->view['fields']['aws_price_calc_52']['html']; ?>
                            </div>
                            <div class="awspc-field-error"></div>
                        </div>
                    <!--Field end-->
                    </div>
    #7355
    Paul
    Participant

    Hello,

    We modified your custom theme. You can see it in the attachment file.
    This code for your field id 11:
    <div class="awspc-field-row" data-field-id="11" style="<?php echo ($this->view['conditionalLogic'][11] == true)?'':'display:none'; ?>">
    This code for your field id 12:
    <div class="awspc-field-row" data-field-id="12" style="<?php echo ($this->view['conditionalLogic'][12] == true)?'':'display:none'; ?>">

    So we followed [url=https://altoswebsolutions.com/manual/woo-price-calculator/using-themes]this[/url]

    Let us know if this solved your problem.

    Best Regards,
    Paul
    AT488

    #7354
    Justin Leonard
    Participant

    Thank You Paul, I will be testing this shortly and will confirm the solution status!

    #7353
    Justin Leonard
    Participant

    Tested the provided code and worked successfully.

    For others working on a similar solution you will just need to make sure the “data-field-id=12” and “($this->view[‘conditionalLogic’][12] == true)” both have matching ID’s to your fields (in this example “12”).

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