Jump to content

(Solucionado) Problema con Modulo blocksocial


Recommended Posts

Buenas tardes a todos, me sale en la web www.importelectronic.com en la parte de arriba esto:

 

Strict Standards: Declaration of SlideBlockSocial::delete() should be compatible with ObjectModelCore::delete() in /var/www/vhosts/importelectronic.com/httpdocs/modules/blocksocial/blocksocial.php on line 32

 

Alguien sabe de que podría ser, gracias de antemano y saludos

Edited by Yika (see edit history)
Link to comment
Share on other sites

Se necesita ver el codigo, en el modulo de prestashop blocksocial no existe el archivo SlideBlockSocial.php

 

aqui lo tienes

 

<?php

 

class SlideBlockSocial extends ObjectModel {

 

    public $position;

    public $img;

    public $title;

    public $url;

    public $active;

    public static $definition = array(

        'table' => 'slider_blocksocial',

        'primary' => 'id_slider',

        'multilang' => false,

        'fields' => array(

            'position' => array('type' => self::TYPE_INT, 'validate' => 'isunsignedInt'),

            'img' => array('type' => self::TYPE_STRING, 'validate' => 'isCleanHtml'),

            'title' => array('type' => self::TYPE_STRING, 'validate' => 'isCleanHtml'),

            'url' => array('type' => self::TYPE_STRING, 'validate' => 'isUrl'),

            'active' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool')

        )

    );

 

    public function __construct($id = null, $id_lang = null, $id_shop = null) {

        parent::__construct($id, $id_lang, $id_shop);

    }

 

    public function getSlides($where = '', $order = 'ORDER BY `position` ASC') {

        $result = Db::getInstance()->ExecuteS('SELECT * FROM `' . _DB_PREFIX_ . 'slider_blocksocial`

        ' . $where . '  ' . $order);

        return $result;

    }

 

    public function add($autodate = true, $null_values = false) {

 

        if (!$this->_addImage())

            return false;

 

        $position = Db::getInstance()->getValue('SELECT COUNT(*) FROM `' . _DB_PREFIX_ . 'slider_blocksocial`');

        $this->position = ($position + 1);

        $this->url = Tools::getValue('image_url');

        $this->title = Tools::getValue('image_alt');

        $this->active = (bool) Tools::getValue('image_active', false);

 

        parent::add($autodate, $null_values);

    }

 

    private function _addImage() {

        if (!empty($_FILES['image_file']['name'])) {

            $tmp_name = explode('.', $_FILES['image_file']['name']);

            $tmp_name = $tmp_name[0] . date('-d-m-Y_G_i_s.') . $tmp_name[1];

            if (ImageManager::resize($_FILES['image_file']['tmp_name'], '../modules/blocksocial/uploads/' . $tmp_name, 320, 250)) {

                $this->img = $tmp_name;

                return true;

            } else {

                return false;

            }

        } else {

            return false;

        }

    }

 

    public function update($null_values = false) {

 

        $this->id = Tools::getValue('id_slide');

        $this->url = Tools::getValue('image_url');

        $this->title = Tools::getValue('image_alt');

        $this->active = (bool) Tools::getValue('image_active', false);

        $this->position = Tools::getValue('position');

        $this->img = Tools::getValue('img');

 

        $this->_updateImage();

        parent::update($null_values);

    }

 

    private function _updateImage() {

 

        if (!empty($_FILES['image_file']['name'])) {

            $slide = $this->getSlideById(Tools::getValue('id_slide'));

            if (ImageManager::resize($_FILES['image_file']['tmp_name'], '../modules/blocksocial/uploads/' . $slide['img'], 320, 250)) {

                return true;

            }

        }

    }

 

    public function getSlideById($id) {

        $result = Db::getInstance()->getRow('SELECT * FROM `' . _DB_PREFIX_ . 'slider_blocksocial`

        WHERE id_slider = ' . (int) $id);

        return $result;

    }

 

    public function delete($id) {

 

        $slide = $this->getSlideById($id);

 

        if (file_exists('../../modules/blocksocial/uploads/' . $slide['img']))

            unlink('../../modules/blocksocial/uploads/' . $slide['img']);

 

        $this->id = $id;

        parent::delete();

    }

 

}

 

?>

 

Link to comment
Share on other sites

I think you need change the name of last function, I mean change this:

    public function delete($id) {

        $slide = $this->getSlideById($id);

        if (file_exists('../../modules/blocksocial/uploads/' . $slide['img']))
            unlink('../../modules/blocksocial/uploads/' . $slide['img']);

        $this->id = $id;
        parent::delete();
    }

Maybe for this:

    public function _delete($id) {

        $slide = $this->getSlideById($id);

        if (file_exists('../../modules/blocksocial/uploads/' . $slide['img']))
            unlink('../../modules/blocksocial/uploads/' . $slide['img']);

        $this->id = $id;
        parent::_delete();
    }

Also you will need to change that in the rest of code, where is called.

Edited by COTOKO (see edit history)
  • Like 1
Link to comment
Share on other sites

I think you need change the name of last function, I mean change this:

    public function delete($id) {

        $slide = $this->getSlideById($id);

        if (file_exists('../../modules/blocksocial/uploads/' . $slide['img']))
            unlink('../../modules/blocksocial/uploads/' . $slide['img']);

        $this->id = $id;
        parent::delete();
    }

Maybe for this:

    public function _delete($id) {

        $slide = $this->getSlideById($id);

        if (file_exists('../../modules/blocksocial/uploads/' . $slide['img']))
            unlink('../../modules/blocksocial/uploads/' . $slide['img']);

        $this->id = $id;
        parent::_delete();
    }

Also you will need to change that in the rest of code, where is called.

Superb, solved very thanks

Link to comment
Share on other sites

  • nadie locked this topic
Guest
This topic is now closed to further replies.
×
×
  • Create New...