How to Show and Hide Module Subpanel?

Hello Everyone, I was able to fixed it. I added a custom tpl at custom/module name/tps/DetailView.tpl

My DetailView.tpl Codes:

<script>
    {literal}
    var productsViewDetail = {
        init: function () {
            productsViewDetail.controlDisplay();
        },
controlDisplay: function () {
let checkbundled = $('[id=part_number]').text();
            $('#whole_subpanel_aos_products_ptt_subproduct_1').hide();
            if( checkbundled.substring(7, 8) == "B" ){
                console.log(checkbundled.substring(7, 8));
                $('#whole_subpanel_aos_products_ptt_subproduct_1').show();
            }
        }
  };
productsViewDetail.init();
    {/literal}
</script>

I added the DetailView.tpl to my view.detail.php:

<?php

require_once 'modules/Documents/views/view.detail.php';

class customAOS_ProductsViewDetail extends ViewDetail{
    public function display()
    {
        parent::display(); // TODO: Change the autogenerated stub
        $this->ss->display("custom/modules/AOS_Products/tpls/DetailView.tpl");
    }
}
1 Like