1

I set my slider and my banners. I inserted the block in the cms page with the correct ID but the slider is not displayed.
I checked this post too: Banner slider not showing
If I try to change the banner date it is saved on 01/01/1970 at 01:00:00

2 Answers 2

0

Locate app/code/community/Magestore/Bannerslider/controllers/Adminhtml/BannersliderController.php file

Add this function

protected function _getDate($string)
{
    $date = explode('/', $string);
    $parts = explode(' ', $date[2]);
    $year = $parts[0];
    $time = $parts[1];
    return $year . '-' . $date[1] . '-' . $date[0] . ' ' . $time . ':00';
}

And use in saveAction(), this way

public function saveAction()
{
    if ($data = $this->getRequest()->getPost()) {

        ...
        try {
             $data['start_time']=date('Y-m-d H:i:s', Mage::getModel('core/date')->gmtTimestamp($this->_getDate($data['start_time'])));
             $data['end_time']=date('Y-m-d H:i:s', Mage::getModel('core/date')->gmtTimestamp($this->_getDate($data['end_time'])));
        } catch (Exception $e) {
        }

        $model = Mage::getModel('bannerslider/bannerslider');
        $model->setData($data)
            ->setId($this->getRequest()->getParam('id'));
        ...

This fixed the issue for us, although maybe you'd need some additional changes. That depends by which module version you are using

1
  • I modified it this way but it does not work. There is something wrong? link
    – Alessio
    Dec 20, 2018 at 17:57
0

Solved by myself.
The problem is the date format of banners:
the datetimepicker produces a date in local format (in my case DD/MM/YYYY) but the plugin reads the date in MM/DD/YYYY format.
I simply entered the date in MM/DD/YYYY format by hand without using the datetimepicker

1
  • Well, that's exactly the purpose of _getDate function in my answer :) Dec 22, 2018 at 9:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.