Update data in my custom block

Permalink
Hello everybody,

I would update a data in my custom block, but without add or edit block method.

For my example, i have a field (trading) price in my custom db block, fixed in the add.php according to trading at the moment.

And in my page with custom block, when i reload page, i check new (trading) price of the day and if is different, i would update this price in my custom db block.

I know recover variable
$this->trading_price;


but i don't know set this ($this->set ... ?) in controller method.

Thank you for your attention ;)

Emixam25
 
sk01 replied on at Permalink Reply
sk01
You could put that into public function view(){} in your controller.
Emixam25 replied on at Permalink Reply
Emixam25
Hello sk01 thank you,

that ?

Can you give me a little exemple ?

I don't understand.
enlil replied on at Permalink Reply
enlil
You may want to look into page attributes. You could code the block to fetch the trading price from a page attribute. Create the attribute from in the dashboard and then you can edit the value from within the page properties dialogue or with a package like Attribute Block if you're looking for a quick solution.
Emixam25 replied on at Permalink Reply
Emixam25
Hello enlil, thank you but in my project,

this block is in 6 exemplary for calcul different prices relative to
this trading price.

Is not possible to set a db_field in custom db block with a method controller ?