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?
683 views Asked by paptom At
1
There are 1 answers
Related Questions in OPENCART
- Display filter on all products category like the other category pages in opencart 2.3
- Open Cart: Custom Modules are Not appearing in the Site
- How can I get the link to my product page in opencart 3.0
- OpenCart Version 3.0.3.8 with Journal Theme 3 - Login Popup doesn't always direct to the correct page
- Alignment of autocomplete and live data update script
- .htaccess redirect some Opencart pages to the new domain
- Opencart on OpenServer apache2 in Ubuntu 22.04 not working. Showing only some part of code
- PHP Notice: Error: Could not load config default - OC 3.0.3.9
- How to synchronize product status changes with order status in OpenCart?
- Opencart Journal Theme saving issue
- OpenCart v3.0.3.6 return form doesn't work
- Facebook Business Extension
- OpenCart 3.0.3.8 Invalid Token / Javascript Problem
- opencart 4 Multi language Remove ?language= from Url
- Opencart 3.0.3.x changes in some controllers has no effect
Related Questions in OPENCART2.X
- My bootstrap 5.0 scrollspy is not scrolling the container in which anchor tags are when the children are scrolled
- remove vqcache and opencart 2.3 crash server error 500
- Retrieving items in cart
- Opencart setup multistore on local machine with Xamp
- OpenCart loading project goes to install/index.php which is NOT FOUND
- adding a module to popup
- Add custom tab on opencart under order history
- Opencart - Access document class in every where
- How to add new method in Opencart 2 - Redis
- OpenCart 2.3 anchor menu links
- How to make product block for full height in Bootstrap 3
- Opencart 2.0 - PayPal Commerce Platform card payment fields not showing
- Export products in Json format in two languages Opencart
- How to load a controller class from admin to controller class in catalog
- Opencart contact form sends data via get method instead of post
Related Questions in OPENCART-MODULE
- Open Cart: Custom Modules are Not appearing in the Site
- Overriding Controllers via Events in Opencart 4.x.x
- How to Access an OpenCart Extension Controller as an OpenCart API
- Opencart | Redirect to checkout success message
- Add custom tab on opencart under order history
- "cause":"INVALID_REQUEST","explanation":"Unexpected parameter 'shipping.address.city'"}
- Not sure how to debug this fatal PHP error: Call to a member function createCustomer() on null
- Opencart custom smart filters
- How to add "customer total order count" to opencart 3 Invoices
- Opencart Enabling multi store URL in sub-directory format
- Send email order OPENCART
- Opencart 4 Extension Route throws 404
- Why do I get the error given by Paypal, Opencart, Journal 3
- opencart 4 extension | overriding home Controller proplem
- Opencart 3 getProduct method causes slow page loading
Related Questions in OPENCART2.3
- Display filter on all products category like the other category pages in opencart 2.3
- Open Cart: Custom Modules are Not appearing in the Site
- Display data in product category view (from already working modification)
- OpenCart loading project goes to install/index.php which is NOT FOUND
- Undefined variable: meta_keyword
- How to add 2 modifs to the same file in OCMOD file for opencart 2.3
- Stripe Prebuilt hosted checkout with Error (Unexpected token < in JSON at position 0 ) in Opencart
- Can not get input value from controller, Opencart:3
- How to clear cache folder of opencart website
- Failed to open stream error for Images in my Opencart website Error Log
- add code on specific category id opencart 2.3.0.2
- How to reduce the number of fields requested during registration? | OpenCart 2
- PHP passing variables from controller to class error
- Changes to the code - I do not see on the site
- Replace Homepage background image used in Journal Theme 3.x for Opencart 2.x?
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?
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)
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.