Jump to content

Edit History

mantas393

mantas393

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

mantas393

mantas393

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 the class_index.php file.

×
×
  • Create New...