Blog

  • Add Custom Attributes Dropdown to WooCommerce Product Page

    Add Custom Attributes Dropdown to WooCommerce Product Page

    WooCommerce product attributes let you define extra product data, such as size or colour to help customers know more about the product. The default Woocommerce template does have the features to display it in the additional information section but if you are looking to show it just above the cart button then you can use the WooCommerce hook woocommerce_before_add_to_cart_button. This is the best way to show custom product attributes on the shop page programmatically.

    Display Custom Products Attributes Dropdown

    The following code will work only for simple product or if you are using WooCommerce lottery. To show a list, select or a dropdown for all the custom attributes in the frontend just above the cart button you can add the code to functions.php file of the current theme you are using.

    add_action('woocommerce_before_add_to_cart_button', 'custom_product_attributes');
    
    function custom_product_attributes() {
    global $product;
    $attributes = $product->get_attributes();
    if ( ! $attributes ) {
    return;
    }
    if ($product->is_type( 'variable' )) {
    return;
    }
    echo '<div class="wc-prod-attributes"><h2>Custom Attributes</h2>';
    foreach ( $attributes as $attribute ) {
    $attribute_data = $attribute->get_data();
    $attribute_terms = $attribute_data['options'];
    $label = $attribute_data['name'];
    ?>
    <div class="wc-prod-single-attribute">
    <h3><?php echo $label; ?></h3>
    <select class="wc-custom-select-attribute" name="attribute[<?php echo $attribute_data['id']; ?>]" id="attribute[<?php echo $attribute_data['id']; ?>]">
                    <option value selected>Choose an option</option>
                    <?php foreach ( $attribute_terms as $pa ): ?>
                        <option value="<?php echo $pa; ?>"><?php echo $pa; ?></option>
                    <?php endforeach; ?>
                </select>
    </div>
    <?php
    }
    echo '</div>';
    }
    ?>

    Note: Don’t place the code in the woocommerce plugin folder. It is always advised to place the above code in functions.php of the theme you are using so that the files don’t overwrite when you update WooCommerce plugin.

    Adding Custom Attribute to the Backend

    We are using lottery plugin and wanted to show a custom attribute in the frontend. To add a custom attribute, click on the Attributes Tab. Select Custom product attribute and enter the name and the values. The dropdown values have to be separated by | as per the screenshot.

    Add Custom Attributes Dropdown to WooCommerce

    Custom Attribute Select Display

    As you can see the list shows all the options that we have added in the backend of the particular product. You can add any number of values in the backend which is shown as an option in the frontend.

    Select list woocommerce custom attribute

    Conclusion

    Using Custom Attributes at the right place in the product page will definitely help the customers in taking the right decision while purchasing the products. If you have any questions or face issues with the implementation of custom product attributes into your woocommerce page, then feel free to contact us. We will get back to you as soon as possible

  • How to Upgrade Joomla Using cPanel: A Comprehensive Guide

    How to Upgrade Joomla Using cPanel: A Comprehensive Guide

    This detailed tutorial will help you handle the upgrade process quickly, whether you’re considering upgrading Joomla 3 to 4, or perhaps looking to improve your older Joomla 1.5 to the latest version.

    For those wondering how to upgrade Joomla manually, or wishing to update to the latest Joomla version, this article will provide the necessary steps to make the process as smooth as possible.

    Upgrading your Joomla version regularly is essential to maintaining a secure, efficient, and feature-rich website. Let’s delve into the step-by-step process of upgrading Joomla using cPanel.

    Backup Your Website

    Before any major changes to your Joomla website, it’s always prudent to create a backup. This way, should anything go wrong during the upgrade, you can revert to the previous state. You can do this within cPanel using the Backup Wizard or by using Joomla extensions like Akeeba Backup.

    Check Extension Compatibility

    Before upgrading, make sure your extensions are compatible with the new Joomla version. You can find this information on the Joomla extensions directory or the extension developer’s website. It’s crucial to ensure smooth operation after the upgrade.

    Upgrade Your Joomla Version

    Once the backup is complete and the extensions are compatible, you can proceed with the upgrade. If you’re using Joomla 3, you can easily upgrade to Joomla 4 from your Joomla control panel.

    If you’re using an older version such as Joomla 1.5, the upgrade process might be a bit more complex. You would need to migrate your site to Joomla 2.5 before proceeding with the upgrade to Joomla 3 or 4. Here, you can follow a detailed guide on how to upgrade Joomla 1.7 to 2.5 and subsequently upgrade from Joomla 3 to Joomla 4.

    Test Your Website

    Once you’ve completed the upgrade, make sure to thoroughly test your website to ensure everything is functioning correctly. If you run into issues, you might need to refer to this guide on fixing Joomla issues.

    Update Your Extensions and Templates

    After ensuring your website works well with the new Joomla version, it’s time to update your extensions and templates. Doing this after the Joomla upgrade reduces the chances of encountering compatibility issues.

    Now that you know how to upgrade Joomla using cPanel, it’s important to regularly check for new Joomla updates to keep your website secure and running efficiently. Joomla’s latest version, Joomla 4, has introduced several new features to enhance your website’s performance and improve the user experience.

    Frequently Asked Questions​

    How often should I upgrade my Joomla version?

    Joomla regularly releases updates to enhance security and functionality. Therefore, it’s recommended to check for updates every few months.

    How do I check if my extensions are compatible with the new Joomla version?

    You can check the compatibility of your extensions by visiting the Joomla Extensions Directory or the extension developer’s website.

    What do I do if my website breaks after the Joomla upgrade?

    If your website breaks after the upgrade, you can restore your website from the backup you created before the upgrade process.

    How do I upgrade from Joomla 1.5 to Joomla 4?

    Upgrading from Joomla 1.5 to Joomla 4 involves migrating to Joomla 2.5, then upgrading to Joomla 3, and finally to Joomla 4.

    Embrace the world of enhanced features, improved user experience, and robust security with the latest Joomla version. Happy Upgrading!

  • How to Add a Module Inside an Article in Joomla 5 & 6 (loadposition and loadmodule)

    How to Add a Module Inside an Article in Joomla 5 & 6 (loadposition and loadmodule)

    To show a module inside a Joomla article, publish the module to a custom position and type {loadposition your-position} in the article, or load one specific module with {loadmodule mod_name,Module Title}. Both shortcodes come from the core Content – Load Modules plugin in Joomla 4, 5 and 6.

    Option 1: {loadposition} (load every module in a position)

    1. Go to Content → Site Modules and click New. Choose a type, for example Custom, Articles – Latest or Menu.
    2. In the Position field type a new name that your template does not use, for example article-promo, and press Enter to create it.
    3. Under Menu Assignment choose “On all pages” (or the pages where the article appears). A module assigned to no pages will not load, even inside an article.
    4. Save and close the module.
    5. Open the article and, where the module should appear, type {loadposition article-promo} on its own line. Save.

    Every published module in that position is rendered, in module ordering. Add a style to change the chrome: {loadposition article-promo,card} uses the Cassiopeia “card” style; none outputs the module without a wrapper.

    Option 2: {loadmodule} (load one module by type and title)

    Use this when you do not want to create a new position:

    {loadmodule mod_custom,Spring offer}
    {loadmodule mod_articles_latest}

    The first value is the module type (as listed in the Modules list, for example mod_custom), the second is the exact module title. Without a title, Joomla loads the first published module of that type. Joomla 4 and later also accept {loadmoduleid 97} to load a module by its ID, which is the safest choice if titles change.

    Make sure the plugin is enabled

    Go to System → Manage → Plugins, search for Content – Load Modules and check it is enabled. In its options you can set the default module style. If the shortcode appears as plain text on the page, this plugin is disabled or the text editor has wrapped the code in a link or span.

    Why the module is not showing

    SymptomFix
    Shortcode shows as textEnable Content – Load Modules; retype the shortcode in the editor’s code view
    Nothing appearsModule unpublished, assigned to no pages, or access level higher than the visitor’s
    Shows in the article but also in a sidebarThe position name is used by the template; pick a unique name
    Works in the article view but not in a blog/featured layoutCheck “Show Intro Text” and that the shortcode is in the intro, or use the full article view

    More fixes in Joomla module not showing and module position not showing. Need a module built for your site? See Joomla module development or try the free Joomla module generator.

    Frequently asked questions

    What is the difference between loadposition and loadmodule?

    loadposition renders every published module assigned to a position. loadmodule renders one module chosen by its type and title, and loadmoduleid renders one module by its ID.

    Why does {loadposition} show as plain text?

    The Content – Load Modules plugin is disabled, or the editor has inserted HTML inside the braces. Enable the plugin and retype the shortcode in code view.

    Does loadposition work in Joomla 6?

    Yes. The Content – Load Modules plugin is part of Joomla 4, 5 and 6 core.

  • Procedure to Upload an Excel Sheet on Joomla Website

    Procedure to Upload an Excel Sheet on Joomla Website

    Uploading an Excel sheet to a Joomla website involves several steps. Here’s a step-by-step procedure to help you achieve this:

    1. Login to Joomla Administrator Panel:
      • Navigate to your Joomla website’s admin URL (typically yourwebsite.com/administrator).
      • Enter your username and password to log in.
    2. Media Manager:
      • From the top menu, select Content and then click on Media.
      • This will take you to the Media Manager, where you can manage and upload files.
    3. Upload the Excel File:
      • Click on the Upload button (usually represented by an upward arrow icon).
      • Browse your computer to select the Excel file you wish to upload.
      • Once selected, click on the Start Upload button. Your Excel file will be uploaded to the Joomla server.
    4. Linking the Excel File:
      • Once the file is uploaded, you can link to it from articles or modules.
      • Edit or create a new article where you want to place the link.
      • Highlight the text you want to use as a link.
      • Click on the Insert/Edit Link button in the editor toolbar.
      • In the URL field, browse or type the path to the uploaded Excel file. It will typically be in the format: /images/yourfilename.xlsx.
      • Set the target to “_blank” if you want the file to open in a new window/tab.
      • Click on Insert to add the link.
    5. Extensions for Advanced Functionality:
      • If you want to display the Excel content directly on your Joomla site or provide advanced download features, you might consider using Joomla extensions. Extensions like “Edocman” or “Dropfiles” can help manage and display documents, including Excel sheets, more effectively.
    6. Ensure File Security:
      • Make sure that any sensitive information is removed from the Excel sheet before uploading.
      • Regularly backup your Joomla site, including the Media Manager files.
      • Consider using security extensions to protect your uploaded files from unauthorized access.
    7. Test the Upload:
      • After uploading and linking the Excel file, visit the front end of your Joomla site.
      • Click on the link you created to ensure the Excel file downloads or displays correctly.

    Remember, the exact names of buttons and the layout might vary depending on the Joomla version you’re using and any customizations or extensions you have installed. Always ensure that you’re following best practices for website security when uploading and linking to files.

  • Remove index.php from URL using htaccess

    Many PHP developers find it difficult to remove index.php from URL. The best way is to use  .htaccess file in your root directory.

    mod_rewrite must be enable with php and this will work for the php version higher than 5.2.6

    RewriteEngine On  RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /index.php?/$1 [L]

    PHP version less than 5.2.6 try this

    RewriteEngine On  RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /index.php/$1 [L]

    Save the .htaccess file. We hope the above changes to the htaccess file can help you to remove the index.php from your URL. You can use the above method for any CMS like Joomla, Magento or WordPress.


    If you need any help on this then feel free to contact us. Our experienced developers will help you fix the issue.

  • The Ultimate Guide to Migrating a Magento Store from Local to Live

    The Ultimate Guide to Migrating a Magento Store from Local to Live

    Migrating a Magento store from a local environment to a live server can be a complex process, but it’s necessary to ensure that your website is accessible to your customers. In this guide, we’ll go through the steps involved in migrating a Magento store from a local environment to a live server.

    Step 1: Backup Your Local Store

    Before you begin the migration process, it’s important to backup your local store files and database. This ensures that you can easily restore your store if anything goes wrong during the migration process. You can backup your files and database manually.

    Step 2: Move Your Files to the Live Server

    To move your Magento files to the live server, you can use an FTP client like FileZilla. Connect to your live server and navigate to the root directory where you want to install Magento. Upload all of the files from your local store to the live server using the FTP client.

    Step 3: Export Your Local Database

    Export your local database in the form of an SQL file. You can do this using phpMyAdmin, a database management tool that’s included with most web hosting plans. Open phpMyAdmin, select your local database, and click on the “Export” tab. Choose the “Quick” export method and click the “Go” button to create an SQL file of your local database.

    Step 4: Import Your Local Database to the Live Server

    Log in to the cPanel of your live server, open phpMyAdmin, and select the database where you want to import your local database. Click on the “Import” tab, select your SQL file, and click the “Go” button. Wait for the import process to finish.

    Step 5: Update Configuration Settings

    After you have moved your files and imported your database to the live server, you need to update your Magento configuration settings to reflect the new server. Open the app/etc/env.php file on your live server and update the following settings:

    Set the database name, username, and password to match your live server database credentials.
    Update the base URL of your Magento store to match the URL of your live server.

    Save the changes to the env.php file.

    Step 6: Clear Cache and Reindex

    After you have updated the configuration settings, you need to clear the cache and reindex your Magento store to ensure that all changes are reflected on the live server. You can do this by logging in to your Magento admin panel and navigating to the “System” menu. Click on “Cache Management” and select “Flush Magento Cache.” Then, click on “Index Management” and reindex all indexes.

    Step 7: Test Your Live Store

    After you have completed the migration process, you should test your live store to ensure that everything is working properly. Browse your store, place a test order, and check that all features and functionality are working as expected.

    By following these steps, you can migrate your Magento store from a local environment to a live server with minimal downtime and disruption to your customers.

  • Magento Alternatives for eCommerce Websites

    Magento Alternatives for eCommerce Websites

    Magento is a popular eCommerce platform that is widely used by businesses of all sizes to sell their products and services online. However, with the rise of new eCommerce platforms and the changing needs of businesses, there are now several Magento alternatives available. In this blog post, we’ll take a look at some of the top alternatives to Magento for eCommerce websites.

    Shopify

    One of the main benefits of Shopify is that it is a fully hosted platform, meaning that you don’t need to worry about setting up and managing your own hosting environment. Shopify also offers a range of plans to suit businesses of all sizes, making it a great option for startups as well as established businesses.

    Shopify is one of the most popular eCommerce platforms and is a great alternative to Magento for businesses of all sizes. With Shopify, you can quickly set up an online store, customize your website design, and start selling products online. Shopify also offers a wide range of integrations with third-party apps and tools, making it easy to add new features to your store.

    WooCommerce

    WooCommerce is a popular eCommerce plugin for WordPress that allows you to turn your WordPress website into a fully functional online store. With WooCommerce, you can easily add products, set up payment gateways, and customize your store’s design.

    One of the main benefits of WooCommerce is that it is open source and highly customizable. This means that you have complete control over your online store and can modify it as needed to meet the specific needs of your business. WooCommerce also offers a range of extensions and plugins to add new features to your store.

    BigCommerce

    BigCommerce is a powerful eCommerce platform that is a great alternative to Magento. With BigCommerce, you can quickly set up an online store, customize your website design, and start selling products online. BigCommerce also offers a range of built-in marketing tools, making it easy to promote your store and drive traffic to your website.

    One of the main benefits of BigCommerce is that it is a fully hosted platform, meaning that you don’t need to worry about setting up and managing your own hosting environment. BigCommerce also offers a range of plans to suit businesses of all sizes, making it a great option for startups as well as established businesses.

    PrestaShop

    PrestaShop is a popular open-source eCommerce platform that is a great alternative to Magento. With PrestaShop, you can quickly set up an online store, customize your website design, and start selling products online. PrestaShop also offers a range of built-in marketing tools, making it easy to promote your store and drive traffic to your website.

    One of the main benefits of PrestaShop is that it is open source and highly customizable. This means that you have complete control over your online store and can modify it as needed to meet the specific needs of your business. PrestaShop also offers a range of modules and plugins to add new features to your store.

    OpenCart

    OpenCart is a lightweight and easy-to-use eCommerce platform that is a great alternative to Magento. With OpenCart, you can quickly set up an online store, customize your website design, and start selling products online. OpenCart also offers a range of built-in marketing tools, making it easy to promote your store and drive traffic to your website.

    One of the main benefits of OpenCart is that it is lightweight and fast, meaning that it can handle large amounts of traffic without slowing down your website. OpenCart also offers a range of extensions and plugins to add new features to your store.

    Conclusion

    Choosing the right eCommerce platform is crucial for the success of your online store. While Magento is a powerful platform, there are now several alternatives available that offer similar or better features and functionalities. Shopify, WooCommerce, BigCommerce, PrestaShop, and Open

  • Disable deprecated Joomla messages

    Disable deprecated Joomla messages

    Disabling deprecated Joomla messages means stopping PHP E_DEPRECATED notices (and often Joomla “Log Deprecated API” noise) from flooding the front end, administrator, or log files. On Joomla 4, 5, and 6 the safe first move is Global Configuration → Server → Error Reporting set to None on production (or Simple while you triage), with Debug System off. Hiding messages is not a substitute for updating the extension or template that still calls old APIs.

    Thin guides still tell you to paste error_reporting(…) at the bottom of configuration.php. That file is a PHP class of settings, not a free-form bootstrap script, and Joomla already maps Error Reporting into $error_reporting. This guide shows the admin path, the correct DIY edits when the admin is locked, PHP host filters, what Maximum does on PHP 8, and when you should fix the real code instead of silencing it.

    What you will learn

    • What deprecated messages are (PHP vs Joomla API logging)
    • Production vs staging Error Reporting choices
    • How to turn off Log Deprecated API and Debug System
    • DIY: edit $error_reporting in configuration.php when the admin is down
    • DIY: php.ini / .htaccess filters when System Default inherits a noisy host
    • Why Maximum + PHP 8 can make a site unusable, and how to recover
    • When silencing is wrong and you need an upgrade instead

    Two different “deprecated” problems

    Source What you see Control
    PHP E_DEPRECATED Yellow/red notices on the page, or entries in the server error log Error Reporting + PHP error_reporting / display_errors
    Joomla deprecated API log Growing deprecated.php under the log path Global Configuration → Logging → Log Deprecated API
    Debug System overlays Extra debug chrome and stack traces for developers Global Configuration → System → Debug System

    Primary references: Global Configuration guide, Joomla logging, and the long PHP 8 discussion around Error Reporting set to Maximum (joomla-cms#36171).

    Error Reporting levels (what each one does)

    Setting Typical effect Use when
    System Default Uses the host php.ini / FPM value You control PHP and want one source of truth
    None No PHP errors displayed to visitors Production. Default recommendation
    Simple Basic errors (roughly errors, warnings, parse). Filters many notices and deprecations Quick triage without drowning in E_DEPRECATED
    Maximum Forces a very high reporting level (effectively all errors) Staging only. Can flood PHP 8+ sites with deprecations
    Development Full developer reporting Local clone only

    Security note: production should not display PHP errors to the public. Prefer None for visitors, and read server logs or a staging clone when you need detail.

    Step 1: Set Error Reporting in Global Configuration

    1. Log in to Administrator.
    2. System → Global Configuration → Server tab.
    3. Error Reporting: choose None for live sites, or Simple if you still need basic faults visible to admins on staging.
    4. Save & Close.
    5. Reload the front end and administrator. Deprecated banners from PHP display should be gone when None is active.

    Step 2: Turn Debug System off on production

    1. System → Global Configuration → System tab.
    2. Debug System: No.
    3. Debug Language: No unless you are translating.
    4. Save.

    Debug Mode plus Maximum is how sites become unreadable under PHP 8 when old extensions still emit deprecations.

    Step 3: Stop Log Deprecated API filling administrator/logs

    1. System → Global Configuration → Logging tab.
    2. Log Deprecated API: No on production (Yes only while you are intentionally auditing extensions).
    3. Log Almost Everything: No unless you are debugging a specific incident.
    4. Note the Path to Log Folder. If deprecated.php is huge, archive or delete it after you turn logging off (keep a copy if you still need the list of offenders).
    5. Save.

    Log Almost Everything does not include the deprecated category. Deprecated API calls use the separate Log Deprecated API switch and write to deprecated.php.

    Step 4: DIY when the administrator is locked

    If deprecated output or a fatals storm blocks the admin UI, edit configuration.php over SFTP or hosting File Manager. Change permissions temporarily if the file is read-only (often 444 → 644 on Linux hosts), edit, then lock it down again.

    Set the property Joomla already understands. Do not append a free-standing error_reporting(…) call at the bottom of the class file:

    public $error_reporting = 'none';
    public $debug = false;
    

    Useful values for $error_reporting: 'none', 'simple', 'maximum', 'development', or 'default' (system default). Matching debug:

    public $debug = false;
    

    Optional logging flags you may also see in the same file:

    public $log_everything = 0;
    public $log_deprecated = 0;
    

    Save the file, reload the site, then finish the job in Global Configuration once the admin is reachable again.

    Step 5: DIY PHP host filter (System Default or compile-time noise)

    Some deprecations fire so early that only the PHP process setting fully hides them. Prefer the host panel (MultiPHP INI, PHP-FPM pool, or “Select PHP version → Options”).

    Example php.ini / FPM style:

    display_errors = Off
    error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
    log_errors = On
    

    On Apache with AllowOverride permitting PHP flags, some hosts accept:

    php_value error_reporting 22527
    

    (22527 is a common integer for E_ALL & ~E_DEPRECATED on older PHP lines. Confirm with echo E_ALL ^ E_DEPRECATED; on your PHP version, or use the host UI instead of guessing.)

    If Global Configuration is set to Maximum, Joomla overrides the host filter for display. Switch Maximum off first, then tune PHP.

    Step 6: Verify and keep staging honest

    1. Production: Error Reporting None, Debug No, Log Deprecated API No.
    2. Staging clone: temporarily use Simple or Development, or enable Log Deprecated API, and capture which extensions appear in the log.
    3. Confirm visitors no longer see notice HTML in View Source.
    4. Confirm the server error log is not still spamming the same deprecations every request (display off does not always stop logging).
    5. Clear Joomla cache after config changes.

    What not to do

    • Do not paste error_reporting(E_ALL & ~E_DEPRECATED); at the bottom of configuration.php. That old Infyways tip (and many Stack Overflow clones) treats a settings class like index.php.
    • Do not leave Maximum + Debug on a public PHP 8 site “just in case.”
    • Do not error_reporting(0) in core index.php as your long-term strategy. Updates overwrite it and you lose real fatals you need.
    • Do not ignore a flood of deprecations forever on an abandoned extension. PHP 8.3 / 8.4 and Joomla 6 will keep raising the cost.

    Fix the cause when messages point at your stack

    Signal Likely cause Next step
    Deprecations name a third-party extension path Extension not ready for your PHP / Joomla line Update or replace the extension
    Deprecations name a template override Old PHP in the override Rewrite the override on a child template
    Only on Maximum / Development Expected noise while modernising Keep production on None; fix on staging
    Site unusable after a PHP upgrade Reporting too high + legacy code Set None/Simple via configuration.php, then plan an upgrade

    If the site is still on Joomla 3 or early 4 with abandoned extensions, silencing notices only buys time. Infyways upgrades start at $149 with a free audit within 12 hours: Joomla Upgrade Services.

    What thinner articles leave out

    Topic Typical post This guide
    First step Hack configuration.php with error_reporting() Global Configuration Error Reporting
    Joomla API log Ignored Log Deprecated API and deprecated.php
    PHP 8 + Maximum Missing Why the site can go blank or unusable
    Locked admin Vague FTP advice Edit $error_reporting and $debug properties correctly
    Host PHP One .htaccess line display_errors, logging, and Maximum override behaviour
    Root cause “Messages are annoying” Update extensions or upgrade the CMS

    Key takeaways

    1. Production: Error Reporting None, Debug System No, Log Deprecated API No.
    2. Simple is a useful middle ground for triage without full deprecation spam.
    3. Avoid Maximum on live PHP 8+ sites unless you are ready for noise.
    4. When locked out, set $error_reporting = 'none'; and $debug = false; in configuration.php.
    5. Do not append raw error_reporting() calls to configuration.php.
    6. Host PHP filters help when System Default inherits a noisy ini, but Maximum overrides them for display.
    7. Silencing is temporary. Fix or replace the extension that still uses deprecated APIs.

    Frequently asked questions

    How do I disable deprecated Joomla messages?

    Set Global Configuration → Server → Error Reporting to None on production, turn Debug System off, and set Log Deprecated API to No.

    What is the difference between Error Reporting None and Simple?

    None hides PHP error display. Simple still shows basic errors and warnings but filters much of the notice and deprecation noise.

    Why did Maximum make my PHP 8 site unusable?

    Maximum forces very high reporting, so every E_DEPRECATED from legacy extensions can dump onto every page. Switch back to None or Simple.

    How do I edit Error Reporting if the administrator will not load?

    Edit configuration.php and set public $error_reporting = ‘none’; and public $debug = false; then reload.

    Should I add error_reporting() to configuration.php?

    No. Use the $error_reporting property or the Global Configuration UI. Appending a free-standing call is an outdated and brittle hack.

    What does Log Deprecated API do?

    It writes Joomla deprecated API usage to deprecated.php in the log folder. Turn it on only while auditing, then turn it off.

    Will hiding deprecated messages fix security issues?

    No. It only stops display or API logging. Outdated extensions can still be vulnerable. Plan updates or a migration.

    Can I filter E_DEPRECATED in php.ini only?

    Yes for System Default, and for some compile-time cases. If Joomla Error Reporting is Maximum, change that setting too.

    Where do we start if deprecations come from abandoned extensions?

    Request a Joomla upgrade audit so the stack moves to current Joomla and PHP with supported replacements.

  • How to Add Custom JavaScript to Joomla 5 and 6.2 (5 Tested Methods)

    How to Add Custom JavaScript to Joomla 5 and 6.2 (5 Tested Methods)

    Updated 15 October 2026 · By Abhilash Sahoo, Founder, Infyways

    Quick answer: The fastest way to add custom JavaScript to Joomla 5 or 6 with Cassiopeia is to create media/templates/site/cassiopeia/js/user.js. Joomla loads it on every page with no code changes. For anything more, use the Web Asset Manager:

    1. For a file: $wa->registerAndUseScript('my.site', 'media/templates/site/cassiopeia/js/site.js', [], ['defer' => true]);
    2. For a snippet: $wa->addInlineScript('…');
    3. To keep it to one page, put the code in a template override.

    Avoid pasting raw <script> tags into the template or a Custom HTML module. Editors strip them, and a Content Security Policy blocks them. This all applies unchanged to Joomla 6.2, the latest version.

    I tested every method below on a real Joomla 5.4.10 site (PHP 8.2, XAMPP) and checked the browser console in Chrome. I also compared the relevant Joomla 6.2.0 source files. Images marked “real output” show what the site actually printed. References: Joomla’s Adding JavaScript and Web Asset Manager documentation.

    Which way should I add JavaScript to Joomla?

    Comparison of five ways to add custom JavaScript to Joomla
    Method Best for Needs code? defer / async Works with a CSP nonce? Pages
    Cassiopeia user.js Small site-wide tweaks No No Yes (tested) All
    Web Asset Manager in a child template Files, CDNs, load order PHP Yes Yes (tested) All, or with conditions
    Template override plus useScript() One view (article, contact form) PHP Yes Yes That view
    Custom HTML module Widgets pasted by non-developers HTML Manual No: blocked (tested) Menu assignment
    Plugin such as Easy Includes Site-wide files, CDN URLs or snippets without template edits No Yes (Normal, Defer, Async) Yes (tested) All front-end pages, minus exclusions

    Don’t edit Cassiopeia’s own index.php. Joomla updates overwrite it. My tests changed it only to show the output; for a real site, use a child template.

    How do I add JavaScript with user.js in Cassiopeia?

    1. Go to System → Site Templates → Cassiopeia Details and Files.
    2. Open media/templates/site/cassiopeia/js (shown as the js folder). Click New File, name it user, choose type .js, and click Create.
    3. Add your code and save:
    document.addEventListener('DOMContentLoaded', () => {
      // your code
    });

    Nothing else is needed. Cassiopeia’s joomla.asset.json already declares a template.user script, and index.php already calls useScript('template.user'). The tag only appears once the file exists:

    Page source before and after creating user.js in the Joomla Cassiopeia template
    Cassiopeia joomla.asset.json entry for template.user script

    Two things I found in testing:

    • No defer. user.js loads as a normal script, so wrap DOM code in DOMContentLoaded.
    • Caching. The ?970ad6 on the URL is the site’s media version, not a hash of your file. After editing user.js, visitors may still get the cached copy. Hard-reload while testing. For a change visitors must get immediately, rename the file, or load it with the Web Asset Manager and your own version number. See caching in Joomla.

    How do I add a script with the Web Asset Manager?

    The Web Asset Manager (WAM) is the official API in Joomla 4, 5 and 6. In a template file, $wa = $this->getWebAssetManager();. Elsewhere, use Factory::getApplication()->getDocument()->getWebAssetManager().

    // local file, deferred, loads after Joomla core.js
    $wa->registerAndUseScript('custom.site', 'media/templates/site/cassiopeia/js/site.js',
        ['version' => 'auto'], ['defer' => true], ['core']);
    
    // CDN file, async, no ?version query
    $wa->registerAndUseScript('custom.dayjs', 'https://cdn.jsdelivr.net/npm/dayjs@1.11.13/dayjs.min.js',
        ['version' => false], ['async' => true, 'crossorigin' => 'anonymous']);

    The arguments are name, URI, options, HTML attributes and dependencies. Here’s what Joomla actually printed:

    Script tags produced by Joomla Web Asset Manager registerAndUseScript with defer and async

    When I passed an empty options array, Joomla added the media version (?970ad6) to the CDN URL as well. Pass ['version' => false] to keep third-party URLs clean. This matters for some CDNs and for SRI hashes.

    Should I use joomla.asset.json instead?

    If you have several scripts, yes. Declare them once in your template’s or extension’s joomla.asset.json, then call $wa->useScript('name'):

    {
      "$schema": "https://developer.joomla.org/schemas/json-schema/web_assets.json",
      "name": "mytemplate",
      "version": "1.0.0",
      "assets": [
        { "name": "mytemplate.site", "type": "script", "uri": "site.js",
          "attributes": { "defer": true }, "dependencies": ["core"], "version": "auto" }
      ]
    }

    Templates and components pick up their file automatically. For a module or plugin, call $wa->getRegistry()->addExtensionRegistryFile('mod_example'); first (official docs).

    How do I add inline JavaScript or pass PHP values to JS?

    $wa->addInlineScript("document.documentElement.dataset.ready = '1';");
    
    // PHP → JS without building strings
    $this->addScriptOptions('custom.cfg', ['siteName' => $sitename]);
    // in JS: Joomla.getOptions('custom.cfg').siteName

    In my test, Joomla.getOptions('custom.cfg') returned {"siteName":"Demo"}. Your script needs core as a dependency to use Joomla.getOptions.

    How do I add JavaScript to one page only?

    Create a template override for that view, for example System → Site Templates → Cassiopeia Details and Files → Create Overrides → Components → com_content → article. Then add near the top of templates/cassiopeia/html/com_content/article/default.php:

    $wa = \Joomla\CMS\Factory::getApplication()->getDocument()->getWebAssetManager();
    $wa->registerAndUseScript('custom.article', 'media/templates/site/cassiopeia/js/article.js', [], ['defer' => true]);

    Overrides live in the html folder, and Joomla updates leave them alone. To target one menu item rather than one view, wrap the call in a check on $app->getMenu()->getActive()->id.

    How do I add JavaScript without editing the template?

    Use a system plugin that registers your scripts through the Web Asset Manager for you. One example is Easy Includes 2.0 from JoomlaX (our own extension), which supports Joomla 4, 5 and 6. Its documentation lists what it does:

    • Files tab: add a site-relative path or a full https:// CDN URL for each CSS or JS file. For each script you choose Normal, Defer or Async loading, plus optional type="module", nomodule, crossorigin and an SRI hash.
    • Inline Code tab: paste short, trusted CSS or JS snippets. Inline JavaScript isn’t HTML-filtered, so only trusted admins should manage the plugin.
    • Load Priority: rows with higher numbers register first.
    • Exclusions: skip selected user groups, components (for example com_users) or URL path fragments (for example /checkout). If any exclusion matches, nothing loads on that page. There is no include-only-on-this-menu-item option, so for single-page scripts use an override.
    • Cache busting: Off, Auto (uses the file’s modification time) or Aggressive (for testing only).
    • Front end only by default. The admin area loads the assets only if you turn on Enable in Administrator.

    Script loading is set per file, and there is no head-or-body choice. Version 2.0 replaced that option with Normal/Defer/Async. I installed the 2.0 package on the same test site, with the CSP nonce turned on:

    • A deferred file printed as <script src="/j5/images/ei-test.js?1792064452" defer nonce="…">. With Auto cache busting, the number is the file’s modification time.
    • The inline snippet also got the nonce, and Chrome ran both.
    • On the login page (com_users, excluded), neither loaded.

    Updates install from the Joomla admin with a valid JoomlaX licence.

    Can I put a script in a Custom HTML module?

    Yes, and the script runs on a site without a CSP. In my test, the module’s <script> ran normally. There are two catches:

    • Editors strip it. TinyMCE lists script under Prohibited Elements by default. Switch your user’s editor to Editor – None or CodeMirror while pasting. Make sure your group’s Text Filter (Global Configuration → Text Filters) isn’t removing it. Super Users have no filtering by default (Joomla HTML filters guide).
    • A CSP blocks it. The script has no nonce, as the next test shows.

    Will my script work with a Content Security Policy nonce?

    Only if it goes through Joomla’s API. I enabled System – HTTP Headers → Content Security Policy with Nonce on and script-src 'self' https://cdn.jsdelivr.net. Joomla prepended a fresh nonce to the header and added nonce="…" to every Web Asset Manager tag, including user.js and the addInlineScript() block. Chrome then ran those and blocked the module’s raw script:

    Joomla CSP nonce test: Web Asset Manager scripts run, raw script tag blocked

    Since Joomla 4.2 you no longer need to type {nonce} in the directive. The plugin removes the old placeholder and adds the nonce itself (from the 5.4 and 6.2 source). Every external host your scripts load from must be listed in script-src. More on headers in our Joomla .htaccess guide and the official HTTP Headers guide.

    Should I use defer, async or type=”module”?

    Attribute Runs Order kept? Use for
    none Immediately, blocks HTML parsing Yes Rarely; tiny scripts that must run first
    defer After HTML is parsed Yes Most site scripts that touch the DOM
    async As soon as downloaded No Independent third-party scripts (analytics)
    type="module" Deferred by default Yes Modern ES modules (Joomla core uses this)

    With WAM, pass these as attributes, for example ['defer' => true] or ['type' => 'module']. For tracking scripts, respect consent: see disabling cookies for visitors.

    What about Document::addScript()?

    It still works, but it’s deprecated. In both the Joomla 5.4.10 and 6.2.0 source, addScript() and addScriptDeclaration() are marked @deprecated 4.3 will be removed in 7.0. When you touch old code, replace them with registerAndUseScript() and addInlineScript(). If an old extension also uses removed classes, see fixing Class JRequest not found.

    What changed in Joomla 6.2?

    Joomla 6.2 changes relevant to adding custom JavaScript

    For custom JavaScript, very little. I compared the 6.2.0 package with 5.4.10:

    • The libraries/src/WebAsset classes are identical.
    • Cassiopeia’s index.php is identical, so user.js works the same way.
    • The HTTP Headers plugin adds a Reporting-Endpoints header option.

    Code you write for Joomla 5 with the Web Asset Manager carries over to Joomla 6.

    Troubleshooting

    Symptom Cause Fix
    user.js not in page source Wrong folder, or a non-Cassiopeia template Use media/templates/site/cassiopeia/js/user.js; other templates need WAM
    Edits to user.js don’t show Browser cache; the media version didn’t change Hard-reload; clear Joomla and CDN cache
    <script> vanished after saving TinyMCE or the Text Filter Use Editor – None or CodeMirror; check Text Filters
    Console: “violates the following Content Security Policy directive” Raw script without a nonce, or host not in script-src Load it through WAM; add the host
    Joomla is not defined Script runs before core.js Add ['core'] as a dependency
    null when selecting elements Ran before the DOM was ready Use defer or DOMContentLoaded
    CDN URL has ?abc123 appended WAM versioning ['version' => false]
    Script gone after a Joomla update Edited a core template file Move it to a child template, override or user.js
    Script loads twice Added by both a module and the template Use one method; WAM de-duplicates by asset name

    FAQs

    Where is user.js in Joomla 5?

    It doesn’t exist until you create it at media/templates/site/cassiopeia/js/user.js. Cassiopeia then loads it automatically.

    Does user.js survive Joomla updates?

    Yes. Joomla doesn’t ship a user.js, so updates don’t overwrite it. The 6.2.0 package doesn’t include one either.

    Is the Web Asset Manager required?

    Not strictly, but it’s the supported API. It handles dependencies, load order, versioning and CSP nonces. addScript() is deprecated and due for removal in Joomla 7.

    How do I add Google Analytics or Tag Manager?

    Register the vendor URL with WAM, using async and 'version' => false. Put the config snippet in addInlineScript(), and add the vendor hosts to your CSP. Load it only after consent if you need consent.

    Can I add JavaScript to a single article?

    Use a template override of the article view with a menu-item check, or a Custom HTML module assigned to that menu item. Don’t paste scripts into the article text.

    Why does my script work for Super Users but not for editors?

    Different user groups have different Text Filters. A lower group’s filter can strip <script> when they save the module or article.

    What is the difference between addInlineScript and addScriptDeclaration?

    addInlineScript() is the Web Asset Manager method, and it gets the CSP nonce. addScriptDeclaration() is the deprecated Document method.

    Can I load ES modules?

    Yes. Pass ['type' => 'module'] as an attribute. Joomla’s own scripts, such as template.min.js, load this way.

    Is there a no-code option with page exclusions?

    Yes. A system plugin such as Easy Includes lets you add JS and CSS from plugin settings on Joomla 4, 5 and 6. It can skip pages by user group, component or URL fragment. It doesn’t target single menu items, so use an override for one-page scripts. Setup steps are in the getting-started guide.

    Can you add or clean up scripts for me?

    Yes. We move hard-coded scripts into the Web Asset Manager, enable CSP and fix load-order bugs. We do this on its own or as part of a Joomla upgrade. Server settings that affect scripts are covered in Joomla php.ini settings.