Is there a way I can create an OpenCart module that has access to all the (front-end) pages of the store? What I want is for the user to not have to “bind” this module to all the layouts in order for it to exist in all pages. Basically I want to build a module that injects some js code to every page of the app and depending on some OpenCart hooks on the back-end to run some extra js code on front or some api requests on the back-end. Thanks
How do i get access to all front end pages on an opencart module?
682 Views Asked by paptom At
1
There are 1 best solutions below
Related Questions in OPENCART
- Bug when I .load in opencart
- Base url twice with opencart site and admin
- How to edit the link of a variable in opencart register.tpl file?
- Is this possible to add multiple image type in TCPDF
- Opencart 2 - Echo Filter ID/Description in Category View
- OnClick Close DateTime Picker
- Registration page of opencart
- Show unit of weight in product page for Opencart 2
- Redirect Old URL to New URL open cart using htaccess
- Confirm order button missing from opencart 2.0 checkout flow
- Fatal error: Call to undefined method in opencart
- 403 Error when trying to remove products from Cart
- Adding product attributes
- Opencart Admin Inaccessible
- How to add one more action to the open cart registration page?
Related Questions in OPENCART2.X
- Opencart Payment gateway error after opencart 2.0 upgrade
- Opencart :- How to use different page style in paypal express checkout?
- Show unit of weight in product page for Opencart 2
- Confirm order button missing from opencart 2.0 checkout flow
- Adding price and total column in shipping invoice in opencart
- Fatal error: Call to undefined method in opencart
- mysql query mistake opencart filter price
- Opencart 2.0.3.1 - Some products not showing up in category lists
- Ajax not working in opencart 2.0.2.0
- Opencart 2 - Custom shipping Methods
- How to save table in opencart module?
- Inserting data into opencart editor on onclick over data
- Apply xml script of VQmod only when some condition satisfies opencart
- Does not show newly created module in Layout
- How to color adjustments for button in the stylesheet Opencart 2.0.3.1
Related Questions in OPENCART-MODULE
- How do i get access to all front end pages on an opencart module?
- How to fix error installation module Open Cart?
- Opencart - include additional language for content
- Add custom field on OpenCart 2.1.0.1. checkout page
- Opencart - Block adding Same product to the Cart
- Is it normal to rewrite all css classes for opencart template?
- Opencart: delete all missing items in the files when importing
- How can i add social login in checkout route of openCart?
- I want ask about opencart to remove footer nav img was there
- unserialize(): Error at offset 5399 of 11300 bytes in /home1/chiqmvaz/public_html/admin/model/extension/module/so_megamenu.php on line 150Notice
- How to Access an OpenCart Extension Controller as an OpenCart API
- Overriding Controllers via Events in Opencart 4.x.x
- Fatal error: Uncaught Error: Class 'RLFeedFactoryCommon' not found
- Opencart payment gateway integration error for Paymark
- How to show total reward points on checkout page in Opencart 3.0
Related Questions in OPENCART2.3
- opencart 2.3 install() method not working
- How to load controller in template file in Opencart 2.3x version
- PayPal search option is not displaying in admin section OpenCart
- How do i get access to all front end pages on an opencart module?
- How to fix error installation module Open Cart?
- How to make bundled product and apply recurring on the grand total amount in cart using opencart 2.3.0.2?
- how to migrate opencart 1.5.6 database to 2.3.0.0
- How to hide logo in product page in Open Cart?
- Opencart - include additional language for content
- Opencart 2.3x Theme Modification: Adding Free Shipping Teaser
- open cart tax issue
- Using Regex replace all occurences of string within VQMod
- Error in Undefined variable: languageID in Opencart 2.3.0.2
- Can not get input value from controller, Opencart:3
- How to add 2 modifs to the same file in OCMOD file for opencart 2.3
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
I am not sure exactly what you are looking for by saying you want a module to have "access" to all the (front-end) pages of the store. Modules have to be placed in layouts, and layouts can be assigned to multiple pages.
Each layout can have elements that are assigned specifically to areas you can designate (and customize). For example, you might want to create a special place for your module in the common header. You would simply create the controller, language and view files in a folder of your own designation (in my example, I will use the common folder), and let's call these files "loadjs".
Pattern these after the
common/header.phpand.tplfiles. Just be sure to change the class and file names in the controller file to match. So you would create aloadjs.phpfile in the common directory of the controller folder that contains theControllerCommonLoadjsclass, aloadjs.phpfile in thelanguage/(your language)/commonfolder, and aloadjs.tplfile in theview/theme/(your theme name)/template/commonfolder.Add a
$data['loadjs'] = $this->load->controller('common/loadjs');to yourcontroller/common/header.phpfile and<?php echo $loadjs; ?>in yourview/theme/(your theme name)/template/common/header.tplfile. You can now create your module.However, to be able to add it to your layout you will need to make some changes to some admin files.
Add $_['text_loadjs'] = 'Loadjs';to youradmin/language/(your language)/design/layout.phpfile and$data['text_loadjs'] = $this->language->get('text_loadjs');to youradmin/controller/design/layout.phpfile.You will need to make a change to your
admin/view/template/design/layout_form.tplfile as well. Look for the following code:and add the following code just below that:
Now, login to your OpenCart Dashboard and add your module to the loadjs position on your layout. And that should do it.