Welcome, Guest
Username: Password: Remember me

TOPIC: [FIXED] Object (JSON) removed from the view

Works in params on admin 06 Apr 2013 23:04 #7028

  • Creb
  • Creb's Avatar
  • Offline
  • Junior Member
  • Posts: 20
  • Thank you received: 1
  • Karma: 0
Hello,
the problem with the parameters of the solved?
I searched the forum and found only this discussion:
http://www.j-cook.pro/forum/9-coding-inside-your-component/6441-how-to-add-a-work-with-params

I did everything as described, but not download the selected value. All write to database propertly:
{"left_path":"1","center_path":"1"}

screen:


I get _errors:protected in params sections
Array
(
    [1] => stdClass Object
        (
            [id] => 1
            [access] => 1
            [checked_out] => 522
            [published] => 1
            [checked_out_time] => 2013-04-07 00:43:25
            [columns] => 0
            [desc_en] => sdfsfs
            [desc_pl] => dfsdf
            [display] => snake
            [js_profile] => 4
            [name_en] => test
            [name_pl] => test
            [_checked_out_name] => Arkadiusz
            [params] => JObject Object
                (
                    [_errors:protected] => Array
                        (
                        )

                    [access-view] => 1
                    [access-edit] => 1
                    [access-delete] => 1
                )

        )

)

Please help, this functionality is essential to the proper functioning of my component workpath



Joomla Version 2.5.6
in sandbox can't add params to xml file - dev/live environment?
Cook VersionCook 2.0
JS: JQuery
Form Style: JDom
Features: Maximum?
DB Automation: Table
Timeout: 20 secs



regards
Creb
Last Edit: 12 Apr 2013 06:25 by Creb.
The administrator has disabled public write access.

Re: Works in params on admin 09 Apr 2013 09:26 #7035

  • Creb
  • Creb's Avatar
  • Offline
  • Junior Member
  • Posts: 20
  • Thank you received: 1
  • Karma: 0
Hello, does anyone developer j-cook looks here?
Does not work one of the most important administrative functions. Solution from forum partially solves the problem. Is there any possibility to change the code in each module to retrieve parameter values ​​work?

Best regards and hope to help
Creb
Last Edit: 09 Apr 2013 13:47 by Creb.
The administrator has disabled public write access.

Object (JSON) removed from the view 13 Jun 2013 17:41 #7462

  • Tomaselli
  • Tomaselli's Avatar
  • Online
  • Elite Member
  • Posts: 293
  • Thank you received: 87
  • Karma: 46
Scenario:
Object JSON, correctly saved in the DB, thanks to the function "SAVE" in the item model (part of the function involved).
everything is fine here:
		if (isset($data['extra_options']) && is_array($data['extra_options']))
		{
			$registry = new JRegistry;
			$registry->loadArray($data['extra_options']);
			$data['extra_options'] = (string) $registry;
		}


it is also correctly retrieved in the "populateObjects" function in the same item model through the (part of the funciton involved):
		if (!empty($item->extra_options))
		{
			$registry = new JRegistry;
			$registry->loadString($item->extra_options);
			$item->extra_options = new JObject($registry->toObject());
		}

BUT for some unknown reason, the item is overridden somewhere in the model/view and the Object Json field is become empty.

my dirty workaround is making an empty populateObjects function in the model item fork:
	public function populateObjects(&$item)
	{

	}


and using the simple json_decode in the view function of the fork view:
	protected function displayGroup($tpl = null){
		parent::displayGroup($tpl);
		
		$this->item->extra_options = json_decode($this->item->extra_options);
	}
The administrator has disabled public write access.

Re: Object (JSON) removed from the view 13 Jun 2013 17:49 #7464

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
  • Karma: 64
Hey @tomaselli,

I seem to remember this being an issue with params fields... If I remember correctly, one of the users found that the params object was in fact a protected property and therefore was not available in the view.

This could be related possibly... Anyway, just a though. Hope it helps!

Regards,

Gez
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!
The administrator has disabled public write access.
The following user(s) said Thank You: Tomaselli

Re: Object (JSON) removed from the view 13 Jun 2013 17:57 #7465

  • Tomaselli
  • Tomaselli's Avatar
  • Online
  • Elite Member
  • Posts: 293
  • Thank you received: 87
  • Karma: 46
Thanks Gez for your input,
in some way this could be a reason, but what makes the thing weird, is the fact I'm not using the params field, but the new Object json field with a custom name (extra_field), so it shouldn't be considered a joomla protected object, I think.
by the way thanks for your input, I hope the Admin, when he will have the time, may know where the problem is.
The administrator has disabled public write access.

Re: Object (JSON) removed from the view 13 Jun 2013 18:07 #7466

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
  • Karma: 64
No probs!

Try var_dump($obj) in your view to see. My guess is that, if it is related, you won't see anything but, if you also assign it elsewhere, for instance, push it into a session var from your model when you get the obj then output the session var in the view it will appear.

Of course, if this doesn't work then I'm wrong and it is unrelated.

The reason I think it probably is related is that params are also handled by joomla. Maybe the JSON type field is inheriting some of joomla's methods for dealing with params/json parsing... Of this, I can't speak to directly as I don't know. I haven't had so much time to use cook 2.5. Yes, shameful I know!!! :blush:
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!
The administrator has disabled public write access.
The following user(s) said Thank You: admin

Re: Object (JSON) removed from the view 17 Jun 2013 07:20 #7506

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
Thank you Gez,

Happy to see you here again.
K++
Coding is now a piece of cake
The administrator has disabled public write access.

Re: Object (JSON) removed from the view 17 Jun 2013 19:20 #7531

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
  • Karma: 64
Hi @admin,

I only proposed a hypothesis as to the reason it may not work... Is this because the object is protected?

Thanks again and I'm equally happy to return finally!

Gez
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!
The administrator has disabled public write access.

Re: Object (JSON) removed from the view 23 Sep 2013 22:48 #11170

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
Coding is now a piece of cake
The administrator has disabled public write access.
Time to create page: 0.096 seconds

Get Started