mantas393 Posted January 15, 2019 Share Posted January 15, 2019 (edited) I want to override this module file: /modules/ps_sharebuttons/ps_sharebuttons.php I created a new file in my theme's directory: modules/ps_sharebuttons/override/ps_sharebuttons.php Original file has: use PrestaShop\PrestaShop\Core\Module\WidgetInterface; class Ps_Sharebuttons extends Module implements WidgetInterface { ... public function getWidgetVariables($hookName, array $params) { ... if (Configuration::get('PS_SC_FACEBOOK')) { $social_share_links['facebook'] = array( 'label' => $this->trans('Share', array(), 'Modules.Sharebuttons.Shop'), 'class' => 'icon-h-58', 'url' => 'http://www.facebook.com/sharer.php?u='.$sharing_url, ); } ... } } This is my code: (I want to change 'class' and 'url' values) use PrestaShop\PrestaShop\Core\Module\WidgetInterface; class Ps_SharebuttonsOverride extends Ps_Sharebuttons implements WidgetInterface { ... public function getWidgetVariables($hookName, array $params) { ... if (Configuration::get('PS_SC_FACEBOOK')) { $social_share_links['facebook'] = array( 'label' => $this->trans('Share', array(), 'Modules.Sharebuttons.Shop'), 'class' => $myClass, 'url' => $myUrl, ); } ... } } I deleted /cache/dev/class_index.php and /cache/prod/class_index.php files Edited January 15, 2019 by mantas393 (see edit history) Link to comment Share on other sites More sharing options...
Daresh Posted January 15, 2019 Share Posted January 15, 2019 You don't override modules php in theme's folder, referer to the developers documentation. Link to comment Share on other sites More sharing options...
joseantgv Posted January 15, 2019 Share Posted January 15, 2019 I think it should be at /override/modules/ps_sharebuttons/ps_sharebuttons.php Link to comment Share on other sites More sharing options...
mantas393 Posted January 15, 2019 Author Share Posted January 15, 2019 Thanks, that helped. Also when overwriting had to drop 'implements WidgetInterface' because it broke the code. But since these overwrittes are not in the theme folder, this means that when i will want export my theme to a new website, I will have to export these overwritten modules separately? Link to comment Share on other sites More sharing options...
Daresh Posted January 15, 2019 Share Posted January 15, 2019 Exactly Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now