Bug fix

Permalink Browser Info Environment
I really like the add-on, it's very simple and looks great. However, I noticed that sometimes the block was mysteriously deleting all of it's data, specifically when I changed the padding or margin of the block using custom css in the design menu. I looked in the controller and it seems the bug is caused by the empty duplicate method. When you change certain properties of a block, concrete actually makes a duplicate copy of the block, so that earlier page versions can display the older block. When the duplicate method, the new block ends up without any data. Here is code for the duplicate method that fixes the bug:
function duplicate($nbID) {
       parent::duplicate($nbID);
       $this->getItems();
       $db = Loader::db();
      foreach($this->items as $i) {
         $db->Execute('insert into btWhaleNivoSliderItems (`bID`, `fID`, `itemTitle`, `itemDesc`, `itemUrl`, `position`) VALUES 
                  (?,?,?,?,?,?)', 
            array($nbID, $i['fID'], $i['itemTitle'], $i['itemDesc'], $i['itemURL'], $i['position'])
         );      
      }
   }


Thanks for the great block!

Type: Discussion
Status: New
cpillz
View Replies:
shahroq replied on at Permalink Reply
shahroq
Thanx Carl, i will look into the code and update it.
shahroq replied on at Permalink Reply
shahroq
I will add the code at duplicate method, thanks for contribute.
cpillz replied on at Permalink Reply
cpillz
You're welcome!

concrete5 Environment Information

Browser User-Agent String

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You have not specified a license for this support ticket. You must have a valid license assigned to a support ticket to request a refund.