Jump to content

Problème Thème Enfant et Assets


Recommended Posts

Bonjour à tous,

Premièrement, bonne années à tous !

j'ai scruté google et le forum de long en large (enfin je penses) et j'ai rien trouvé...

Après avoir créé un thème enfant, j'ai un soucis d'import de mes assets..

Je m'explique, le thème parent fonctionne à 100%, aucun problème, mais lorsque je passes sur mon thème enfant, il manque 2 fichiers JS qui ne sont pas importés (photos à l'appui) et j'ai donc une erreur car OwnCarousel n'est pas chargé.

J'ai pourtant mis le chargements des assets sur true dans le fichier theme.yml.

Je bloque sur une bêtise je suis sur....

Merci à ceux qui pourrons m'aider :)

Theme_Enfant.png

Theme_Parent.png

Share this post


Link to post
Share on other sites

Salut,

perso en plus d'inserer dans le thme.yml j'ai override le front controller

<?php
/**
 * Copyright since 2007 PrestaShop SA and Contributors
 * PrestaShop is an International Registered Trademark & Property of PrestaShop SA
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Open Software License (OSL 3.0)
 * that is bundled with this package in the file LICENSE.md.
 * It is also available through the world-wide-web at this URL:
 * https://opensource.org/licenses/OSL-3.0
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to [email protected]hop.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade PrestaShop to newer
 * versions in the future. If you wish to customize PrestaShop for your
 * needs please refer to https://devdocs.prestashop.com/ for more information.
 *
 * @author    PrestaShop SA and Contributors <[email protected]>
 * @copyright Since 2007 PrestaShop SA and Contributors
 * @license   https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
 */


class FrontController extends FrontControllerCore
{
/**
     * Sets controller CSS and JS files.
     *
     * @return bool
     */
public function setMedia()
{

    $this->registerStylesheet('baba-1', '/assets/css/bootstrap-grid.min.css', ['media' => 'all', 'priority' => 1]);
    /*Menu Mobile */
    //$this->registerStylesheet('baba-3', '/assets/css/slicknav.css', ['media' => 'all', 'priority' => 3]);
    /* animation header */
    //$this->registerStylesheet('baba-7', '/assets/css/animate.min.css', ['media' => 'all', 'priority' => 7]);
   // $this->registerStylesheet('baba-8', '/assets/css/animated-headline.css', ['media' => 'all', 'priority' => 8]);
    /* Global style */
    //$this->registerStylesheet('baba-14', '/assets/css/style.css', ['media' => 'all', 'priority' => 14, 'inline' =>'true']);




        //$this->registerStylesheet('baba-2', '/assets/css/owl.carousel.min.css', ['media' => 'all', 'priority' => 2]);
        //$this->registerStylesheet('baba-4', '/assets/css/flaticon.css', ['media' => 'all', 'priority' => 4]);
        //$this->registerStylesheet('baba-5', '/assets/css/progressbar_barfiller.css', ['media' => 'all', 'priority' => 5]);
        //$this->registerStylesheet('baba-6', '/assets/css/gijgo.css', ['media' => 'all', 'priority' => 6]);
        //$this->registerStylesheet('baba-9', '/assets/css/magnific-popup.css', ['media' => 'all', 'priority' => 9]);
    //$this->registerStylesheet('baba-10', '/assets/css/fontawesome-all.min.css', ['media' => 'all', 'priority' => 10]);
        //$this->registerStylesheet('baba-11', '/assets/css/themify-icons.css', ['media' => 'all', 'priority' => 11]);
        //$this->registerStylesheet('baba-12', '/assets/css/slick.css', ['media' => 'all', 'priority' => 12]);
       // $this->registerStylesheet('baba-13', '/assets/css/nice-select.css', ['media' => 'all', 'priority' => 13]);

        //$this->registerStylesheet('theme-custom', '/assets/css/custom.css', ['media' => 'all', 'priority' => 1000]);

        /*if ($this->context->language->is_rtl) {
            $this->registerStylesheet('theme-rtl', '/assets/css/rtl.css', ['media' => 'all', 'priority' => 900]);
        }*/


        /* A FAIRE JS */



 /*        <!-- JS here -->

 <script src="{$urls.js_url}vendor/modernizr-3.5.0.min.js"></script>
 <!-- Jquery, Popper, Bootstrap -->
 <script src="{$urls.js_url}vendor/jquery-1.12.4.min.js"></script>
 <script src="{$urls.js_url}popper.min.js"></script>
 <script src="{$urls.js_url}bootstrap.min.js"></script>
 <!-- Jquery Mobile Menu -->
 <script src="{$urls.js_url}jquery.slicknav.min.js"></script>

 <!-- Jquery Slick , Owl-Carousel Plugins -->
 <script src="{$urls.js_url}owl.carousel.min.js"></script>
 <script src="{$urls.js_url}slick.min.js"></script>
 <!-- One Page, Animated-HeadLin -->
 <script src="{$urls.js_url}wow.min.js"></script>
 <script src="{$urls.js_url}animated.headline.js"></script>
 <script src="{$urls.js_url}jquery.magnific-popup.js"></script>

 <!-- Date Picker -->
 <script src="{$urls.js_url}gijgo.min.js"></script>

 <!-- Video bg -->
 <script src="{$urls.js_url}jquery.vide.js"></script>

 <!-- Nice-select, sticky -->
 <script src="{$urls.js_url}jquery.nice-select.min.js"></script>
 <script src="{$urls.js_url}jquery.sticky.js"></script>
 <!-- Progress -->
 <script src="{$urls.js_url}jquery.barfiller.js"></script>

 <!-- counter , waypoint,Hover Direction -->
 <script src="{$urls.js_url}jquery.counterup.min.js"></script>
 <script src="{$urls.js_url}waypoints.min.js"></script>
 <script src="{$urls.js_url}jquery.countdown.min.js"></script>
 <script src="{$urls.js_url}hover-direction-snake.min.js"></script>

 <!-- contact js -->
 <script src="{$urls.js_url}contact.js"></script>
 <script src="{$urls.js_url}jquery.form.js"></script>
 <script src="{$urls.js_url}jquery.validate.min.js"></script>
 <script src="{$urls.js_url}mail-script.js"></script>
 <script src="{$urls.js_url}jquery.ajaxchimp.min.js"></script>

 <script src="{$urls.js_url}jquery.isotope.min.js"></script>


 <!-- Jquery Plugins, main Jquery -->  
 <script src="{$urls.js_url}plugins.js"></script>
 <script src="{$urls.js_url}main.js"></script>*/



//$this->registerJavascript('corejs', '/themes/core.js', ['position' => 'bottom', 'priority' => 0]);
 //$this->registerJavascript('baba-15', '/assets/js/vendor/modernizr-3.5.0.min.js', ['position' => 'bottom', 'priority' => 0]);

// On change la version de jquery
 //$this->registerJavascript('baba-16', '/assets/js/vendor/jquery-1.12.4.min.js', ['position' => 'bottom', 'priority' => 16]);

 //$this->registerJavascript('baba-16', '/assets/js/vendor/jquery-3.5.1.min.js', ['position' => 'bottom', 'priority' => 1, ]);

 //$this->registerJavascript('baba-17', '/assets/js/vendor/fix-jquery-3.5-passives-list.js', ['position' => 'bottom', 'priority' => 2]);



 //$this->registerJavascript('baba-17', '/assets/js/popper.min.js', ['position' => 'bottom', 'priority' => 2]);
 //$this->registerJavascript('baba-18', '/assets/js/bootstrap.min.js', ['position' => 'bottom', 'priority' => 3]);

// $this->registerJavascript('baba-19', '/assets/js/jquery.slicknav.min.js', ['position' => 'bottom', 'priority' => 4]);
 //$this->registerJavascript('baba-20', '/assets/js/owl.carousel.min.js', ['position' => 'bottom', 'priority' => 5]);
 //$this->registerJavascript('baba-21', '/assets/js/slick.min.js', ['position' => 'bottom', 'priority' => 6]);
 //$this->registerJavascript('baba-22', '/assets/js/wow.min.js', ['position' => 'bottom', 'priority' => 7]);
 //$this->registerJavascript('baba-23', '/assets/js/animated.headline.js', ['position' => 'bottom', 'priority' => 8]);
 //$this->registerJavascript('baba-24', '/assets/js/jquery.magnific-popup.js', ['position' => 'bottom', 'priority' => 9]);
 //$this->registerJavascript('baba-25', '/assets/js/gijgo.min.js', ['position' => 'bottom', 'priority' => 10]);
 //$this->registerJavascript('baba-26', '/assets/js/jquery.vide.js', ['position' => 'bottom', 'priority' => 11]);
 //$this->registerJavascript('baba-27', '/assets/js/jquery.nice-select.min.js', ['position' => 'bottom', 'priority' => 12]);
 //$this->registerJavascript('baba-28', '/assets/js/jquery.sticky.js', ['position' => 'bottom', 'priority' => 13]);
 //$this->registerJavascript('baba-29', '/assets/js/jquery.barfiller.js', ['position' => 'bottom', 'priority' => 14]);
//$this->registerJavascript('baba-30', '/assets/js/jquery.counterup.min.js', ['position' => 'bottom', 'priority' => 15]);
 //$this->registerJavascript('baba-31', '/assets/js/hover-direction-snake.min.js', ['position' => 'bottom', 'priority' => 16]);
 //$this->registerJavascript('baba-32', '/assets/js/contact.js', ['position' => 'bottom', 'priority' => 17]);
// $this->registerJavascript('baba-33', '/assets/js/jquery.form.js', ['position' => 'bottom', 'priority' => 18]);
 //$this->registerJavascript('baba-34', '/assets/js/jquery.validate.min.js', ['position' => 'bottom', 'priority' => 19]);
 //$this->registerJavascript('baba-35', '/assets/js/mail-script.js', ['position' => 'bottom', 'priority' => 20]);
 //$this->registerJavascript('baba-36', '/assets/js/jquery.ajaxchimp.min.js', ['position' => 'bottom', 'priority' => 21]);
//$this->registerJavascript('baba-38', '/assets/js/plugins.js', ['position' => 'bottom', 'priority' => 23]);
// $this->registerJavascript('baba-39', '/assets/js/main.js', ['position' => 'bottom', 'priority' => 24]);




        //$this->registerJavascript('corejs', '/themes/core.js', ['position' => 'bottom', 'priority' => 0]);
        //$this->registerJavascript('theme-main', '/assets/js/theme.js', ['position' => 'bottom', 'priority' => 50]);
        //$this->registerJavascript('theme-custom', '/assets/js/custom.js', ['position' => 'bottom', 'priority' => 1000]);


       /* $assets = $this->context->shop->theme->getPageSpecificAssets($this->php_self);
        if (!empty($assets)) {
            foreach ($assets['css'] as $css) {
                $this->registerStylesheet($css['id'], $css['path'], $css);
            }
            foreach ($assets['js'] as $js) {
                $this->registerJavascript($js['id'], $js['path'], $js);
            }
        }*/
            $page = $this->context->controller->php_self;

        if ($page =="maintenance") {
           $this->registerJavascript('baba-26', '/assets/js/jquery.vide.js', ['position' => 'bottom', 'priority' => 23]);

       } elseif ($page == "portofolio") {
        


        //$this->registerJavascript('baba-37', '/assets/js/shuffle/shuffle.min.js', ['position' => 'top', 'priority' => 4]);
        //$this->registerJavascript('baba-38', '/assets/js/shuffle/shuffle-portofolio.js', ['position' => 'bottom', 'priority' => 22]);

       } elseif ($page == "index") {
        $this->registerJavascript('baba-40', '/assets/js/lazyload.min.js', ['position' => 'bottom', 'priority' => 3]);

    }












        // Execute Hook FrontController SetMedia
       Hook::exec('actionFrontControllerSetMedia', []);

       return true;

   }


}

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More