Results 1 to 8 of 8
  1. #1
    Join Date
    Jun 2012
    Posts
    481
    Plugin Contributions
    0

    Default 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

  2. #2
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,974
    Plugin Contributions
    96

    Default 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.

  3. #3
    Join Date
    Jun 2012
    Posts
    481
    Plugin Contributions
    0

    Default 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
    Name:  Screenshot 2025-08-04 at 12.56.48 PM.jpg
Views: 45
Size:  31.0 KB

  4. #4
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,974
    Plugin Contributions
    96

    Default Re: How to Override Styles in Encapsulated Plugins

    Quote Originally Posted by Dave224 View Post
    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
    Name:  Screenshot 2025-08-04 at 12.56.48 PM.jpg
Views: 45
Size:  31.0 KB
    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.

  5. #5
    Join Date
    Jun 2012
    Posts
    481
    Plugin Contributions
    0

    Default Re: How to Override Styles in Encapsulated Plugins

    Quote Originally Posted by lat9 View Post
    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

  6. #6
    Join Date
    Jun 2012
    Posts
    481
    Plugin Contributions
    0

    Default Re: How to Override Styles in Encapsulated Plugins

    Quote Originally Posted by lat9 View Post
    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

  7. #7
    Join Date
    Jun 2012
    Posts
    481
    Plugin Contributions
    0

    Default Re: How to Override Styles in Encapsulated Plugins

    Quote Originally Posted by Dave224 View Post
    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
    Last edited by Dave224; 4 Aug 2025 at 09:04 PM.

  8. #8
    Join Date
    Jun 2012
    Posts
    481
    Plugin Contributions
    0

    Default Re: How to Override Styles in Encapsulated Plugins

    Quote Originally Posted by Dave224 View Post
    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
    Last edited by Dave224; 5 Aug 2025 at 03:53 PM.

 

 

Similar Threads

  1. v210 jscript_*.php in encapsulated plugins
    By cstdenis2 in forum Bug Reports
    Replies: 2
    Last Post: 3 Aug 2025, 04:15 PM
  2. v210 Encapsulated Plugins
    By Congerman in forum General Questions
    Replies: 5
    Last Post: 7 Apr 2025, 08:41 PM
  3. v201 How to override/modify an encapsulated Plugin
    By torvista in forum Contribution-Writing Guidelines
    Replies: 3
    Last Post: 29 May 2024, 07:36 PM
  4. v157 Encapsulated Plugins
    By niccol in forum Bug Reports
    Replies: 6
    Last Post: 22 Jul 2021, 05:53 PM
  5. v157 encapsulated plugins require question....
    By carlwhat in forum All Other Contributions/Addons
    Replies: 19
    Last Post: 13 Oct 2020, 12:22 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg