Prestashop 1.7 Hook admin product does not display











up vote
0
down vote

favorite












I have a module on Prestashop that works on versions 1.6 and 1.7.



In version 1.6, I managed to display an additional field on the product sheet in the bacok office. I wish to do the same for version 1.7, but without success for now ...



I try with the displayAdminProductsMainStepLeftColumnMiddle hook



my controller of the module:



public function displayAdminProductsMainStepLeftColumnMiddle($params) {
$product = new Product($params['id_product']);

$this->context->smarty->assign(array(
'id_product_jshop' => $product->id_product_jshop
)
);

return $this->display(__FILE__, '/views/templates/1.7/admin/jshop.tpl');


The recording of the hook



$this->registerHook('displayAdminProductsMainStepLeftColumnMiddle');


and my view:



<div class="m-b-1 m-t-1">
<h2>{l s='Custom Attribute from module' mod='jshopimport'}</h2>

<fieldset class="form-group">
<div class="col-lg-12 col-xl-4">

<label class="form-control-label">{l s='ID JSHOP' mod='jshopimport'}</label>
<input type="text" name="id_product_jshop" class="form-control" {if $id_product_jshop && $id_product_jshop != ''}value="{$id_product_jshop}"{/if}/>

</div>
</fieldset>

<div class="clearfix"></div>
</div>


Have you an idea what is wrong?










share|improve this question


























    up vote
    0
    down vote

    favorite












    I have a module on Prestashop that works on versions 1.6 and 1.7.



    In version 1.6, I managed to display an additional field on the product sheet in the bacok office. I wish to do the same for version 1.7, but without success for now ...



    I try with the displayAdminProductsMainStepLeftColumnMiddle hook



    my controller of the module:



    public function displayAdminProductsMainStepLeftColumnMiddle($params) {
    $product = new Product($params['id_product']);

    $this->context->smarty->assign(array(
    'id_product_jshop' => $product->id_product_jshop
    )
    );

    return $this->display(__FILE__, '/views/templates/1.7/admin/jshop.tpl');


    The recording of the hook



    $this->registerHook('displayAdminProductsMainStepLeftColumnMiddle');


    and my view:



    <div class="m-b-1 m-t-1">
    <h2>{l s='Custom Attribute from module' mod='jshopimport'}</h2>

    <fieldset class="form-group">
    <div class="col-lg-12 col-xl-4">

    <label class="form-control-label">{l s='ID JSHOP' mod='jshopimport'}</label>
    <input type="text" name="id_product_jshop" class="form-control" {if $id_product_jshop && $id_product_jshop != ''}value="{$id_product_jshop}"{/if}/>

    </div>
    </fieldset>

    <div class="clearfix"></div>
    </div>


    Have you an idea what is wrong?










    share|improve this question
























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I have a module on Prestashop that works on versions 1.6 and 1.7.



      In version 1.6, I managed to display an additional field on the product sheet in the bacok office. I wish to do the same for version 1.7, but without success for now ...



      I try with the displayAdminProductsMainStepLeftColumnMiddle hook



      my controller of the module:



      public function displayAdminProductsMainStepLeftColumnMiddle($params) {
      $product = new Product($params['id_product']);

      $this->context->smarty->assign(array(
      'id_product_jshop' => $product->id_product_jshop
      )
      );

      return $this->display(__FILE__, '/views/templates/1.7/admin/jshop.tpl');


      The recording of the hook



      $this->registerHook('displayAdminProductsMainStepLeftColumnMiddle');


      and my view:



      <div class="m-b-1 m-t-1">
      <h2>{l s='Custom Attribute from module' mod='jshopimport'}</h2>

      <fieldset class="form-group">
      <div class="col-lg-12 col-xl-4">

      <label class="form-control-label">{l s='ID JSHOP' mod='jshopimport'}</label>
      <input type="text" name="id_product_jshop" class="form-control" {if $id_product_jshop && $id_product_jshop != ''}value="{$id_product_jshop}"{/if}/>

      </div>
      </fieldset>

      <div class="clearfix"></div>
      </div>


      Have you an idea what is wrong?










      share|improve this question













      I have a module on Prestashop that works on versions 1.6 and 1.7.



      In version 1.6, I managed to display an additional field on the product sheet in the bacok office. I wish to do the same for version 1.7, but without success for now ...



      I try with the displayAdminProductsMainStepLeftColumnMiddle hook



      my controller of the module:



      public function displayAdminProductsMainStepLeftColumnMiddle($params) {
      $product = new Product($params['id_product']);

      $this->context->smarty->assign(array(
      'id_product_jshop' => $product->id_product_jshop
      )
      );

      return $this->display(__FILE__, '/views/templates/1.7/admin/jshop.tpl');


      The recording of the hook



      $this->registerHook('displayAdminProductsMainStepLeftColumnMiddle');


      and my view:



      <div class="m-b-1 m-t-1">
      <h2>{l s='Custom Attribute from module' mod='jshopimport'}</h2>

      <fieldset class="form-group">
      <div class="col-lg-12 col-xl-4">

      <label class="form-control-label">{l s='ID JSHOP' mod='jshopimport'}</label>
      <input type="text" name="id_product_jshop" class="form-control" {if $id_product_jshop && $id_product_jshop != ''}value="{$id_product_jshop}"{/if}/>

      </div>
      </fieldset>

      <div class="clearfix"></div>
      </div>


      Have you an idea what is wrong?







      hook prestashop-1.7






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 19 at 16:46









      user1450740

      90112




      90112
























          2 Answers
          2






          active

          oldest

          votes

















          up vote
          0
          down vote













          The function must to start with "hook" and



          public function hookDisplayAdminProductsMainStepLeftColumnMiddle($params)


          and then you registering without hook



          $this->registerHook('displayAdminProductsMainStepLeftColumnMiddle');





          share|improve this answer





















          • Yes I try this and it does not work yet
            – user1450740
            Nov 23 at 13:20










          • after that, try to go in your module page and reset it
            – Gabriele Carbonai
            Nov 23 at 13:42










          • I uninstall my module, and install it again.. it does not work..
            – user1450740
            Nov 23 at 14:01


















          up vote
          0
          down vote



          accepted










          For information, I found my error.



          Before I was done in my install function :



          $this->registerHook('displayAdminProductsMainStepLeftColumnMiddle'));

          return parent::install();


          With this solution, the hook was nor registered !!



          The goot practice is :



          if (!parent::install()
          || !$this->registerHook('displayAdminProductsExtra')
          || !$this->registerHook('displayAdminProductsMainStepLeftColumnMiddle')) {
          return false;
          }


          It is important to do first



          parent::install()





          share|improve this answer





















            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














             

            draft saved


            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53379194%2fprestashop-1-7-hook-admin-product-does-not-display%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            0
            down vote













            The function must to start with "hook" and



            public function hookDisplayAdminProductsMainStepLeftColumnMiddle($params)


            and then you registering without hook



            $this->registerHook('displayAdminProductsMainStepLeftColumnMiddle');





            share|improve this answer





















            • Yes I try this and it does not work yet
              – user1450740
              Nov 23 at 13:20










            • after that, try to go in your module page and reset it
              – Gabriele Carbonai
              Nov 23 at 13:42










            • I uninstall my module, and install it again.. it does not work..
              – user1450740
              Nov 23 at 14:01















            up vote
            0
            down vote













            The function must to start with "hook" and



            public function hookDisplayAdminProductsMainStepLeftColumnMiddle($params)


            and then you registering without hook



            $this->registerHook('displayAdminProductsMainStepLeftColumnMiddle');





            share|improve this answer





















            • Yes I try this and it does not work yet
              – user1450740
              Nov 23 at 13:20










            • after that, try to go in your module page and reset it
              – Gabriele Carbonai
              Nov 23 at 13:42










            • I uninstall my module, and install it again.. it does not work..
              – user1450740
              Nov 23 at 14:01













            up vote
            0
            down vote










            up vote
            0
            down vote









            The function must to start with "hook" and



            public function hookDisplayAdminProductsMainStepLeftColumnMiddle($params)


            and then you registering without hook



            $this->registerHook('displayAdminProductsMainStepLeftColumnMiddle');





            share|improve this answer












            The function must to start with "hook" and



            public function hookDisplayAdminProductsMainStepLeftColumnMiddle($params)


            and then you registering without hook



            $this->registerHook('displayAdminProductsMainStepLeftColumnMiddle');






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Nov 23 at 12:48









            Gabriele Carbonai

            18713




            18713












            • Yes I try this and it does not work yet
              – user1450740
              Nov 23 at 13:20










            • after that, try to go in your module page and reset it
              – Gabriele Carbonai
              Nov 23 at 13:42










            • I uninstall my module, and install it again.. it does not work..
              – user1450740
              Nov 23 at 14:01


















            • Yes I try this and it does not work yet
              – user1450740
              Nov 23 at 13:20










            • after that, try to go in your module page and reset it
              – Gabriele Carbonai
              Nov 23 at 13:42










            • I uninstall my module, and install it again.. it does not work..
              – user1450740
              Nov 23 at 14:01
















            Yes I try this and it does not work yet
            – user1450740
            Nov 23 at 13:20




            Yes I try this and it does not work yet
            – user1450740
            Nov 23 at 13:20












            after that, try to go in your module page and reset it
            – Gabriele Carbonai
            Nov 23 at 13:42




            after that, try to go in your module page and reset it
            – Gabriele Carbonai
            Nov 23 at 13:42












            I uninstall my module, and install it again.. it does not work..
            – user1450740
            Nov 23 at 14:01




            I uninstall my module, and install it again.. it does not work..
            – user1450740
            Nov 23 at 14:01












            up vote
            0
            down vote



            accepted










            For information, I found my error.



            Before I was done in my install function :



            $this->registerHook('displayAdminProductsMainStepLeftColumnMiddle'));

            return parent::install();


            With this solution, the hook was nor registered !!



            The goot practice is :



            if (!parent::install()
            || !$this->registerHook('displayAdminProductsExtra')
            || !$this->registerHook('displayAdminProductsMainStepLeftColumnMiddle')) {
            return false;
            }


            It is important to do first



            parent::install()





            share|improve this answer

























              up vote
              0
              down vote



              accepted










              For information, I found my error.



              Before I was done in my install function :



              $this->registerHook('displayAdminProductsMainStepLeftColumnMiddle'));

              return parent::install();


              With this solution, the hook was nor registered !!



              The goot practice is :



              if (!parent::install()
              || !$this->registerHook('displayAdminProductsExtra')
              || !$this->registerHook('displayAdminProductsMainStepLeftColumnMiddle')) {
              return false;
              }


              It is important to do first



              parent::install()





              share|improve this answer























                up vote
                0
                down vote



                accepted







                up vote
                0
                down vote



                accepted






                For information, I found my error.



                Before I was done in my install function :



                $this->registerHook('displayAdminProductsMainStepLeftColumnMiddle'));

                return parent::install();


                With this solution, the hook was nor registered !!



                The goot practice is :



                if (!parent::install()
                || !$this->registerHook('displayAdminProductsExtra')
                || !$this->registerHook('displayAdminProductsMainStepLeftColumnMiddle')) {
                return false;
                }


                It is important to do first



                parent::install()





                share|improve this answer












                For information, I found my error.



                Before I was done in my install function :



                $this->registerHook('displayAdminProductsMainStepLeftColumnMiddle'));

                return parent::install();


                With this solution, the hook was nor registered !!



                The goot practice is :



                if (!parent::install()
                || !$this->registerHook('displayAdminProductsExtra')
                || !$this->registerHook('displayAdminProductsMainStepLeftColumnMiddle')) {
                return false;
                }


                It is important to do first



                parent::install()






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered 2 days ago









                user1450740

                90112




                90112






























                     

                    draft saved


                    draft discarded



















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53379194%2fprestashop-1-7-hook-admin-product-does-not-display%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Feedback on college project

                    Futebolista

                    Albești (Vaslui)