Zen Cart Logo
Forums / General Questions / How to Override Styles in Encapsulated Plugins

How to Override Styles in Encapsulated Plugins

Views: 636

Results 1 to 8 of 8
4 Aug 2025, 3:23 PM
#1
dave224 avatar

dave224

Zen Follower

Join Date:
Jun 2012
Posts:
481
Plugin Contributions:
0

How to Override Styles in Encapsulated Plugins

It appears overrides in site_specific_styles.php do not affect styles in encapsulated plugins. Is there somewhere an override can be placed without modifying the core plugin code?
Thank you!
Dave

4 Aug 2025, 4:10 PM
#2
lat9 avatar

lat9

Administrator

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

Re: How to Override Styles in Encapsulated Plugins

A bit more detail on what you've tried and what you're trying to do would help me help you.

4 Aug 2025, 5:00 PM
#3
dave224 avatar

dave224

Zen Follower

Join Date:
Jun 2012
Posts:
481
Plugin Contributions:
0

Re: How to Override Styles in Encapsulated Plugins

Hi Cindy,
I'm trying to change the text and color of the no stock message in POSM without changing the plugin core files, specifically PRODUCTS_OPTIONS_STOCK_NOT_IN_STOCK in my domain/zc_plugins/POSM/v6.1.1/catalog/includes/languages/english/extra_definitions/lang.products_options_stock_extra_definitions.php. I tried changing the color to #c7c7c7 in my domain/includes/templates/myTemplate/css/site_specific_styles.php but according to Firefox development tools, the POSM styles in options_stock_styles.css have higher priority as shown in the attached screenshot. How can I override both the define and the style?
Dave
Attachment 21008

4 Aug 2025, 5:05 PM
#4
lat9 avatar

lat9

Administrator

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

Re: How to Override Styles in Encapsulated Plugins

Dave224:

Hi Cindy,
I'm trying to change the text and color of the no stock message in POSM, specifically PRODUCTS_OPTIONS_STOCK_NOT_IN_STOCK in my domain/zc_plugins/POSM/v6.1.1/catalog/includes/languages/english/extra_definitions/lang.products_options_stock_extra_definitions.php. I tried changing the color to #c7c7c7 in my domain/includes/templates/myTemplate/css/site_specific_styles.php but according to Firefox development tools, the POSM styles in options_stock_styles.css have higher priority as shown in the attached screenshot.
Dave
Attachment 21008
Yep, as documented here, it's very difficult to override an encapsulated plugin's extra_definitions constants as they're the top-of-chain in the loading hierarchy.

My ***untried *guess is that you could add another encapsulated plugin whose 'key' is alphabetically higher than POSM, e.g. XX_POSM, with its own extra_definitions overrides.

4 Aug 2025, 5:19 PM
#5
dave224 avatar

dave224

Zen Follower

Join Date:
Jun 2012
Posts:
481
Plugin Contributions:
0

Re: How to Override Styles in Encapsulated Plugins

lat9:

Yep, as documented here, it's very difficult to override an encapsulated plugin's extra_definitions constants as they're the top-of-chain in the loading hierarchy.

My ***untried *guess is that you could add another encapsulated plugin whose 'key' is alphabetically higher than POSM, e.g. XX_POSM, with its own extra_definitions overrides.

Same with css styles?
Dave

4 Aug 2025, 6:52 PM
#6
dave224 avatar

dave224

Zen Follower

Join Date:
Jun 2012
Posts:
481
Plugin Contributions:
0

Re: How to Override Styles in Encapsulated Plugins

lat9:

Yep, as documented here, it's very difficult to override an encapsulated plugin's extra_definitions constants as they're the top-of-chain in the loading hierarchy.

My ***untried *guess is that you could add another encapsulated plugin whose 'key' is alphabetically higher than POSM, e.g. XX_POSM, with its own extra_definitions overrides.

I set up an encapsulated plugin with a key alphabetically higher than POSM with modified extra_definitions and css files and enabled the plugin. The style was changed but not the text. Not sure why yet.

Dave

4 Aug 2025, 7:58 PM
#7
dave224 avatar

dave224

Zen Follower

Join Date:
Jun 2012
Posts:
481
Plugin Contributions:
0

Re: How to Override Styles in Encapsulated Plugins

Dave224:

I set up an encapsulated plugin with a key alphabetically higher than POSM with modified extra_definitions and css files and enabled the plugin. The style was changed but not the text. Not sure why yet.

Dave

So I noticed while my encapsulated plugin's key was alphabetically higher, the plugin's name was not. So updated the plugin changing the version in the directory and in the manifest file, changing the name to be alphabetically higher than POSM. I upgraded the plugin in admin successfully, but the name did not change to what was in the manifest file. I changed the name manually in the database in table plugin_control. Now the revised name appeared in the admin plugin manager. But now the style was not overridden like it was with my original plugin. So I conclude that the style is overridden by the plugin with the lowest name alphabetically, not the highest key alphabetically. Summary:
Name | Key | Result
POSM Overrides | ZPosmOverrides | Style overridden
Z POSM Overrides | ZPosmOverrides | Style not overridden

For reference POSM name and key are:
Products' Options' Stock Manager | POSM

(I wonder how you insert tabs in these posts???)

The text was not overridden in either experiment.

Dave

5 Aug 2025, 2:49 PM
#8
dave224 avatar

dave224

Zen Follower

Join Date:
Jun 2012
Posts:
481
Plugin Contributions:
0

Re: How to Override Styles in Encapsulated Plugins

Dave224:

So I noticed while my encapsulated plugin's key was alphabetically higher, the plugin's name was not. So updated the plugin changing the version in the directory and in the manifest file, changing the name to be alphabetically higher than POSM. I upgraded the plugin in admin successfully, but the name did not change to what was in the manifest file. I changed the name manually in the database in table plugin_control. Now the revised name appeared in the admin plugin manager. But now the style was not overridden like it was with my original plugin. So I conclude that the style is overridden by the plugin with the lowest name alphabetically, not the highest key alphabetically. Summary:
Name | Key | Result
POSM Overrides | ZPosmOverrides | Style overridden
Z POSM Overrides | ZPosmOverrides | Style not overridden

For reference POSM name and key are:
Products' Options' Stock Manager | POSM

(I wonder how you insert tabs in these posts???)

The text was not overridden in either experiment.

Dave

The text I was trying to override was found in table products_options_stock_names, so I was able to change the text there. Overall I feel the approach to change the style with a plugin, in my case, was way too much work. Easier just to change the core POSM plugin code, or use javascript. Thanks Cindy for the POSM plugin and your suggestion.

Dave