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?

    How to add a module inside an article in Joomla?

    Joomla is one of the most used CMS platform, allowing you to customize your website to your exact specifications. But, have you ever wanted to embed a Joomla module directly into an article? Well, you’re in luck. With Joomla’s built-in loadposition plugin, you can easily do this. Let’s dive in!

    What is a Joomla Module?

    Before we delve into the process, let’s take a moment to understand what a Joomla module is. Modules in Joomla are lightweight and flexible extensions used for page rendering. These modules are often boxes positioned around a component like login, menu, or a custom HTML box.

    Step-by-Step Guide: Adding a Joomla Module into an Article

    Create a new module instance

    Navigate to the ‘Extensions’ tab and select ‘Modules’. Here, click the ‘New’ button to create a new module.

    Set a position for your module

    In your new module settings, find the ‘Position’ option. Here, you can assign a unique position that doesn’t conflict with your existing module positions. Lets name it my-custom-position.

    Enable the loadposition plugin

    Now go to ‘Extensions’, > ‘Plugins’. Search for ‘Content – Load Modules’, and ensure it is enabled. If not, click on it and set the status to ‘Enabled’. The loadposition plugin allows you to load a module inside an article.

    Insert your module into an article

    Open the article where you want to insert your module. In the content area, type {loadposition my-custom-position}. Make sure to replace ‘your-position’ with the position name you set for your module.

    Now, your module will appear wherever you’ve placed the {loadposition} tag within your article.

    Save your changes

    Don’t forget to save your changes both in your module settings and your article.

    Viewing Your Joomla Module Inside an Article

    Congratulations! You’ve just learned how to insert a module inside a Joomla article. Now, when you view your article on your website, you should see your module displayed in the position you designated.

    Remember, adding a module inside an article can be beneficial for displaying extra content or functionality, such as a login form or a custom HTML box. Keep exploring and see what amazing things you can create with Joomla!

    Frequently Asked Questions​

    Absolutely! You can use the loadposition command as many times as you like within an article.

    Ensure the plugin is enabled and that you’ve correctly typed the module position in the loadposition command.

    There are many ways to customize your Joomla articles. For example, you can add custom JavaScript or even insert HTML codes into your articles.

    Joomla is a powerful and flexible platform, offering features like ecommerce solutions, various extensions, and a robust community for support. Learn more about the benefits of using Joomla on our blog.

    For more tips and guides about Joomla, check out our other posts and learn how to optimize your Joomla website speed or add a favicon in your Joomla website.

    Happy Joomla-ing!

  • 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

    How to add custom JavaScript to Joomla

    Adding custom JavaScript to Joomla means loading your own .js files, CDN scripts, or trusted inline snippets on the public site without breaking the template on every update. On Joomla 4, 5, and 6 the modern stack is the Web Asset Manager. Site owners who want an admin UI can use Easy Includes by JoomlaX. Developers who prefer files in the theme can do the same job with a child template, joomla.asset.json, and a few lines of PHP. This guide covers both.

    Old posts still paste raw <script> tags into Cassiopeia, hard-code CDN URLs in the head, or call deprecated Document::addScript. Those patterns fight updates and duplicate libraries. Use Easy Includes when you do not want to touch PHP. Use the DIY Web Asset Manager path when the script belongs to the template or a single override. The same guide shows how to remove custom JavaScript cleanly when you outgrow a snippet.

    What you will learn

    • When to choose Easy Includes by JoomlaX vs a child template DIY path
    • Exact Easy Includes setup for files, CDN, defer/async, SRI, and exclusions
    • DIY: joomla.asset.json, useScript, registerAndUseScript, and inline scripts
    • How to remove custom JavaScript again (plugin rows, template assets, leftover hard-coded tags)
    • How to pass PHP options and language strings into JavaScript
    • Where tracking scripts belong (after cookie consent)

    Pick the right place for your JavaScript

    You need to… Best place Why
    Add sitewide JS/CSS without editing PHP Easy Includes by JoomlaX Admin UI, Web Asset Manager, exclusions, survives template updates
    Ship behaviour that belongs to one template Child template + joomla.asset.json (DIY below) Assets travel with the theme; parent can still update
    Fix one component view only Template override + registerAndUseScript Loads only where needed
    Build a reusable feature Module, plugin, or component media folder Proper extension packaging
    Fire analytics / ads tags Consent module script slots See disable cookies for Joomla visitors

    Official references: Web Asset Manager and Adding JavaScript. Product: Easy Includes · JED listing.

    Why not paste scripts into the template head

    • Parent template updates overwrite index.php and media you edited in place
    • Hard-coded tags skip dependency ordering and can load jQuery or core twice
    • Document::addScript / addStyleSheet are deprecated in favour of Web Asset Manager
    • Tracking in the head often runs before visitors can Reject non-essential cookies
    • Article HTML <script> blocks are stripped by many editors and are hard to audit

    Path A: Easy Includes by JoomlaX (no template edits)

    Easy Includes 2.0 is a JoomlaX system plugin for Joomla 4, 5, and 6. It keeps custom CSS and JavaScript in plugin settings: site-relative files, CDN URLs, or trusted inline blocks. Each row can be enabled or disabled. Scripts register through Web Asset Manager with Normal, Defer, or Async loading, plus ES module, nomodule, crossorigin, and SRI options. Cache busting (Off, Auto, Aggressive) and exclusions for user groups, components, and URL fragments keep checkout and login clean.

    Step 1: Install and enable Easy Includes

    1. Download from the JED listing or your JoomlaX account.
    2. System → Install → Extensions → upload the package.
    3. System → Manage → Plugins → System – Easy Includes.
    4. Enable the plugin. Leave administrator loading off unless you need admin assets.
    5. System → Clear Cache.

    Step 2: Add a JavaScript file or CDN URL

    1. Upload your file under a stable path (for example media/templates/site/cassiopeia/js/site.js).
    2. Open Easy Includes and add a JavaScript file row.
    3. Path: site-relative such as media/templates/site/cassiopeia/js/site.js, or a full https:// CDN URL. Do not use .. traversal.
    4. Choose Normal, Defer, or Async. Prefer Defer for non-critical UI behaviour.
    5. Add SRI integrity and crossorigin when the file comes from a CDN you hash yourself.
    6. Enable the row, save, and clear cache.

    Step 3: Inline JavaScript only when you must

    Inline JS is trusted administrator input. Use it for tiny fixes, not large libraries. Prefer a file on disk for version control.

    • Keep snippets short with a comment naming the purpose
    • Do not paste secrets or unreviewed third-party blobs
    • Turn Debug logging on while testing exclusions, then off on production

    Step 4: Exclude pages that must stay clean

    Exclude Example Why
    URL fragment /checkout, /cart Avoid JS that breaks payment or cart flows
    Component com_users Keep login and reset pages minimal
    User group Staff or special front-end groups Limit experimental scripts by audience

    Step 5: Verify Easy Includes in the browser

    1. Open the front end as a guest. DevTools → Network → JS.
    2. Confirm your file loads once with the expected defer/async behaviour.
    3. Confirm excluded URLs do not load it.
    4. After editing a local file, use Auto cache busting once, then return to Off on stable production if you prefer clean URLs.
    5. Purge page cache / CDN too. Related: caching in Joomla.

    Path B: DIY with Web Asset Manager

    Use this when you own the template (or a child template) and want the script in Git next to the theme. Work on a child of Cassiopeia or your commercial template so parent updates do not wipe the files.

    Step 6: Create the JS file in template media

    1. Create or open your child template.
    2. Add a file such as media/templates/site/YOUR_CHILD/js/custom.js (replace YOUR_CHILD with the child folder name).
    3. Put real behaviour in that file. Example starter:
    document.addEventListener('DOMContentLoaded', () => {
      document.documentElement.classList.add('js-ready');
    });
    

    Step 7: Declare the asset in joomla.asset.json

    Templates ship a joomla.asset.json. Add a script entry. For template media, the uri is often just the filename under the template’s js folder (Cassiopeia style). Example asset item:

    {
      "name": "template.custom",
      "type": "script",
      "uri": "custom.js",
      "attributes": {
        "defer": true
      },
      "dependencies": [
        "core"
      ],
      "version": "1.0.0"
    }
    

    Bump version when you change the file so browsers fetch a fresh copy. If both custom.js and custom.min.js exist, Debug mode can prefer the non-minified file as documented in the manual.

    For a CDN library, set uri to the full https:// URL and list it as a dependency of your own script asset.

    Step 8: Enable the script in template PHP

    In the child template index.php (near other Web Asset Manager calls):

    /** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
    $wa = $this->getWebAssetManager();
    $wa->useScript('template.custom');
    

    Confirm the template still includes Joomla’s scripts output (the usual jdoc:include for scripts). Do not paste a raw <script src="…"> tag in the head for the same file.

    Step 9: DIY for one view only

    When only one override needs the script, register and use it from that tmpl file instead of loading it sitewide:

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

    Adjust the uri to match where you stored the file under media/ or the path style your template expects. Prefer a joomla.asset.json name when the asset is reused in many places.

    Step 10: DIY inline script and PHP options

    Tiny dynamic snippets:

    $wa = Factory::getApplication()->getDocument()->getWebAssetManager();
    $wa->addInlineScript("console.log('custom inline');");
    

    Pass PHP values safely (your JS asset should depend on core):

    $document = Factory::getApplication()->getDocument();
    $document->addScriptOptions('site.custom', [
        'endpoint' => 'index.php?option=com_ajax&format=json',
    ]);
    
    const opts = Joomla.getOptions('site.custom');
    

    Language strings: Text::script('COM_EXAMPLE_LABEL') in PHP, then Joomla.Text._('COM_EXAMPLE_LABEL') in JS. Details: Adding JavaScript.

    How to remove custom JavaScript from Joomla

    Removing is the mirror of adding. Disable or delete the registration first, then delete the file, then clear every cache layer. If you only delete the .js file while the asset is still enabled, the browser shows a 404 and can break other scripts that depend on it.

    Step 11: Remove scripts added with Easy Includes

    1. System → Manage → Plugins → System – Easy Includes.
    2. To pause a script without losing the row: turn that file or inline row off, save, clear cache, and verify Network no longer loads it.
    3. To remove it for good: delete the row (or clear the path / inline code), save, and clear cache.
    4. Optional: delete the physical file from media/… or your CDN upload once nothing references it.
    5. If you are retiring Easy Includes entirely: disable the plugin, confirm the front end, then System → Manage → Extensions to uninstall when you are sure.

    Uninstalling the plugin removes the loader. It does not always delete files you uploaded elsewhere on disk. Remove those yourself if you no longer need them.

    Step 12: Remove DIY template or override scripts

    1. Child template sitewide asset: remove or comment out $wa->useScript('template.custom'); in index.php.
    2. Remove the matching object from joomla.asset.json (or leave the file but stop calling useScript).
    3. One-view DIY: delete the registerAndUseScript / addInlineScript / addScriptOptions block from the override tmpl.
    4. Delete custom.js (and custom.min.js if present) from the template media folder when nothing else needs them.
    5. System → Clear Cache. Purge CDN / page cache. Hard-refresh DevTools with Disable cache checked and confirm the URL is gone.

    Step 13: Hunt leftover hard-coded tags

    Old sites often have scripts in more than one place. After you remove the modern registration, search for leftovers:

    • Parent or child index.php raw <script src="…"> tags
    • Template “Custom code” / head / footer fields in template options
    • Other system plugins that inject head scripts
    • Article or module HTML that still contains pasted <script> blocks
    • Consent module script slots (GA and ads belong there; remove or move them deliberately)
    Symptom after a remove Likely cause Fix
    404 for custom.js Asset still registered, file deleted Disable Easy Includes row or remove useScript / asset.json entry
    Script still loads Second copy in template or another plugin Search Network initiator and remove the other source
    Old file after edit Browser, Joomla, or CDN cache Bump asset version, clear all caches, hard refresh
    Checkout broken after uninstall Unrelated; or you removed a required shop script Restore from backup; only remove scripts you added

    Custom JavaScript vs cookie consent

    Marketing and analytics tags are still JavaScript, but they are not a design asset. Put them in a consent-aware slot so Reject all prevents them from running. Easy Includes is for UI and site behaviour you control. Easy Cookie Alert (or your CMP) owns GA, ads, and similar tags.

    What thinner articles leave out

    Topic Typical post This guide
    Joomla versions Joomla 3 template hacks Joomla 4 / 5 / 6 Web Asset Manager
    No-edit path Missing or outdated free module Easy Includes by JoomlaX
    DIY path Raw script tags in index.php joomla.asset.json + useScript / registerAndUseScript
    Load strategy “Paste in head” Defer, async, version bumps, SRI
    Tracking GA in the template Consent-first placement
    Removal “Delete the file” Disable registration, then delete file, then clear caches and hunt duplicates

    When the platform is the real problem

    If the site is stuck on Joomla 3 with a club template full of inline scripts, adding more JS will not fix Core Web Vitals or security. Upgrade first, then add assets cleanly. Infyways migrations start at $149 with a free audit within 12 hours: Joomla Upgrade Services.

    Key takeaways

    1. Use Web Asset Manager on Joomla 4, 5, and 6. Stop deprecated addScript habits.
    2. No PHP edits: Easy Includes by JoomlaX.
    3. Theme-owned scripts: child template + joomla.asset.json + useScript.
    4. One view only: registerAndUseScript in the override.
    5. Prefer files on disk over large inline blocks.
    6. Defer non-critical scripts. Bump asset version after edits.
    7. Put analytics behind consent, not in the template head.
    8. To remove: disable the Easy Includes row or useScript call first, then delete the file, then clear caches and check for hard-coded duplicates.
    9. Clear Joomla cache (and CDN/page cache) after every change.

    Frequently asked questions

    How do I add custom JavaScript to Joomla without editing the template?

    Use Easy Includes by JoomlaX: enable the plugin, add a file or CDN row, choose Defer when appropriate, save, and clear cache.

    How do I add custom JavaScript with DIY Web Asset Manager?

    Put the file in child template media, declare it in joomla.asset.json, call useScript in the template PHP, and clear cache.

    What is the Web Asset Manager?

    It is Joomla’s system for registering and loading CSS/JS with names, dependencies, and attributes so extensions do not step on each other.

    Should I still use Document::addScript?

    No for new work. Use useScript, registerScript, or registerAndUseScript instead.

    Can I add JavaScript to a single Joomla article?

    Avoid pasting scripts into article HTML. Prefer a menu-assigned module, an override with registerAndUseScript, or Easy Includes exclusions aimed at that page.

    What is the difference between Defer and Async?

    Defer runs after HTML parsing and keeps order relative to other deferred scripts. Async runs when ready and may reorder. Prefer Defer for most site UI scripts.

    Where should Google Analytics go?

    In a consent-controlled script slot, not as always-on custom JS. See the Joomla cookies for visitors guide.

    Will Easy Includes work on Joomla 6?

    Yes. Easy Includes 2.0 supports Joomla 4, 5, and 6 with Web Asset Manager registration.

    How do I stop my script on checkout pages?

    With Easy Includes, use exclusions for the checkout URL or shop component. With DIY template assets, load the script only from overrides that are not the checkout view.

    How do I remove custom JavaScript from Joomla?

    Disable or delete the Easy Includes row, or remove the useScript / registerAndUseScript call and the joomla.asset.json entry, delete the file if unused, then clear Joomla and CDN caches and confirm in Network.

    Why do I still see the script after I deleted the file?

    Something is still registering it, or a cached HTML/CDN copy remains. Remove the registration, purge caches, and search for a second hard-coded tag.

    Where do we start if the template is full of hard-coded scripts?

    Request a Joomla upgrade audit, move assets into Easy Includes or a child template, and remove the hard-coded tags.