If this is your first visit, check our documentation. To post, register or login.
Forums / General Questions / General Questions / Encapsulated Plugin - CSS concerns

Encapsulated Plugin - CSS concerns

Started by chadlly2003 on 17 Jun 2026, 6:09 PM · Views: 183

Results 1 to 2 of 2
17 Jun 2026, 6:09 PM
#1
chadlly2003 avatar

chadlly2003

Totally Zenned

Join Date:
Jan 2015
Posts:
840
Plugin Contributions:
0

Post #1 by chadlly2003

This is just my opinion regarding the encapsulated plugins. I feel like this was not the best approach. Burying CSS inside isolated plugin directories is a massive step backward for the front-end workflow. It completely bypasses Zen Cart’s native template override system, meaning we lose that direct, 1-to-1 control over layouts that made the platform great. Instead of writing clean, modular styles, we're now stuck piling on redundant CSS. rules. It’s a mess that’s going to cause serious headache and maintenance issues for future site builds."

I noticed this when i was working on my demo site. It was very easy to spot and so i felt i wanted to address the issue and get some feedback

18 Jun 2026, 8:39 PM
#2
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,144
Plugin Contributions:
56

Post #2 by lat9

chadlly2003:

This is just my opinion regarding the encapsulated plugins. I feel like this was not the best approach. Burying CSS inside isolated plugin directories is a massive step backward for the front-end workflow. It completely bypasses Zen Cart’s native template override system, meaning we lose that direct, 1-to-1 control over layouts that made the platform great. Instead of writing clean, modular styles, we're now stuck piling on redundant CSS. rules. It’s a mess that’s going to cause serious headache and maintenance issues for future site builds."

I noticed this when i was working on my demo site. It was very easy to spot and so i felt i wanted to address the issue and get some feedback
Depends on the plugin. POSM, for instance, provides a default set of CSS that's loaded, but if the site's specified an override then that version's loaded next (which could override the default values. See POSM's catalog/includes/classes/observers/class.products_options_stock_observer.php:

        // -----
        // Look for any plugin's stylesheet, first in the as-distributed 'default'
        // and then for any overrides present in the site's active template.
        //
        $stylesheet = 'options_stock_styles.css';
        echo '<link rel="stylesheet" href="' . $this->getZcPluginDir() . DIR_WS_TEMPLATES . "default/css/$stylesheet" . '">' . "\n";

        $stylesheet_dir = $template->get_template_dir($stylesheet, DIR_WS_TEMPLATE, $current_page_base, 'css');
        $stylesheet_dir .= '/' . $stylesheet;
        if (!str_contains($stylesheet_dir, $this->getZcPluginDir()) && file_exists($stylesheet_dir)) {
            echo '<link rel="stylesheet" href="' . $stylesheet_dir . '">' . "\n";
        }