OroPlatform Forums

Covering OroPlatform topics, including community updates and company announcements.

Forums Forums OroPlatform Platform (orocommerce 319): How to override JS?

This topic contains 5 replies, has 2 voices, and was last updated by  Frank 4 years, 8 months ago.

Starting from March 1, 2020 the forum has been switched to the read-only mode. Please head to StackOverflow for support.

  • Creator
    Topic
  • #40190

    Frank
    Participant

    Hi Oro-Team,

    I want to override following js-file:

    OroShoppingListBundle/Resources/public/js/app/views/product-add-to-shopping-list-view.js

    by a custom one:
    MyShoppingListBundle/Resources/public/js/app/views/product-add-to-shopping-list-view.js

    My steps were:

    1) MyShoppingListBundle/Resources/public/js/app/views/product-add-to-shopping-list-view.js created/added

    2) MyShoppingListBundle/Resources/config/require.js created/added:

    config:
    paths:
    ‘oroshoppinglist/js/app/views/product-add-to-shopping-list-view’: ‘bundles/myshoppinglist/js/app/views/product-add-to-shopping-list-view.js’

    3) console-command executed:
    $ php ./bin/console oro:assets:install –env=dev –symlink
    $ php ./bin/console oro:requirejs.build –env=dev
    $ php ./bin/console cache:clear

    Although assets:install and requirejs.build go through without any error, it DOES NOT WORK:

    Oro uses the core-js-file as before, NOT my custom one.

    What I am doing wrong?

    Thanks for any help.

    Kind regards
    Frank

Viewing 5 replies - 1 through 5 (of 5 total)
  • Author
    Replies
  • #40191

    Andrey Yatsenko
    Moderator
    #40193

    Andrey Yatsenko
    Moderator

    Just noticed that the above example is for the management console.

    For the store-front requirejs.yml file should be placed to Resources/views/layouts/custom/config/ folder.
    Here is an example:
    https://github.com/oroinc/orocommerce/blob/master/src/Oro/Bundle/CustomThemeBundle/Resources/views/layouts/custom/config/requirejs.yml

    #40194

    Frank
    Participant

    Great. Seems to be, what I have been looking for.

    Thank you!
    Frank

    #40196

    Frank
    Participant

    Privjet Andrej,

    hm, i was too fast … – it is NOT yet WORKING, unfortunately:

    In comparison to the example above, I think, I do not need to map ‘Templates’ as for filters …
    In OroShoppingListBundle Template-mapping is not used, too:

    So, I used as before same code, but put it under views/layouts/custom/config:
    (it was views/config before)

    Trying another placement of the requirejs.yml, like

    # MyShoppingListBundle/Resources/views/layouts/blank/config/requirejs.yml
    I do not use a custom template yet – does not work, too.

    Always the core js-file:

    IS USED by orocommerce,

    but my custom version

    is NOT USED by orocommerce.

    Everytime the console-command run through without errors:
    $ php ./bin/console oro:assets:install –env=dev –symlink

    Thank you very much.

    Kind regards from Germany
    Frank

    #40197

    Frank
    Participant

    Oops: There is a small typo in oro-requirejs.yml-path above:

    OroShoppingBundle/Resources/views/layouts/blank/config/requirejs.yml
    not ‘…/custom/…’
    Sorry.

Viewing 5 replies - 1 through 5 (of 5 total)

The forum ‘OroPlatform’ is closed to new topics and replies.

Back to top