9 Posts
thewedge
7 years ago
7
Topic

I have a scenario where I have a cookie value stored. I need to add that value to a Free button link to pass to the form and put it in a hidden value for storing. It can be either passed through a url get, or rather than passing it since it is already stored, echo the cookie value into a form field somehow in the form I then need to sort the list view by that cookie.

Get a VIP membership
4229 Posts
Kadministrator
7 years ago
5
Level 1

You can do this either using code plugins or by creating a new live value plugin, in any case you will need to do some (relatively easy) code.

9 Posts
thewedge
7 years ago
0
Level 2

Being a relatively newbee to Seblod can you explain please. Do I purchase and install this

SD Live CCK Field plugin and in some field I put $_COOKIE['mycookiename'] into another field inside the SD Live CCK Field plugin, or is there some kind of special code that pulls the cookie and put it in the field. I see a lot of $cck around. These plugins aren't explained very well and there usually isn't a tool tip off of field names in plugins or Seblod fields describing what they do and how to use them like other plugins I am used to.

9 Posts
thewedge
7 years ago
3
Level 2

I was able to figure out how to put a cookie into a form field using before store plugin. However, now I am not sure how to filter results in the list form based on the cookie. Watching James Morrel's videos hasn't helped. In one of his videos he stated that the first element in the list view cck is what drives the filtering. I then went to edit it and put in my own sql in Free part:

(SELECT * FROM #__cck_core_types, #__cck_store_form_panel WHERE #__cck_core_types.published = 1 AND #__cck_store_form_tayo_control_panel.propertyID = $propertyID
);

and ran it but the list still shows the same thing even when I changed the cookie to a different value. I then took out the sql, but left it on free so there would be nothing, to see if the list ran an error and it did not suggesting that the cck doesn't do anything.

How do I filter out the list to the cookie. Please provide code and where to put it in response. 

Lastly, I noted that when I first come to the list view before any of this filtering that nothing showed in the list until I filtered the list by select list to one of my form values, then if I go back to the select list start - Select an Option, then the everything showed.

1283 Posts
Bucklash
7 years ago
2
Level 3

Hi

It would be good to see screenshots of what you are doing as that can help .. (Make sure images are zoomed in as images get compressed heavily).


Have you put Search & List Type in Debug mode to see query?

And did you create you free sql query in standalone mode... 

Have you added your 'cookie' field to your search form or list?

....things like that....

9 Posts
thewedge
7 years ago
1
Level 4

Thanks for responding

Right now my issue is putting a cookie  into the sql. If I take out the cookie part in this sql everything runs. I got the cookie info from StackOverflow

SELECT *
FROM #__cck_core_types, #__cck_store_form_tayo_control_panel
WHERE #__cck_core_types.published = 1 AND #__cck_store_form_tayo_control_panel.propertyID = '" . mysql_real_escape_string($_COOKIE['propertyID']) . "'

But it runs a 1064

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'propertyID']) . "'' at line 3 SQL=SELECT * FROM #__cck_core_types, #__cck_store_form_tayo_control_panel WHERE #__cck_core_types.published = 1 AND #__cck_store_form_tayo_control_panel.propertyID = '" . mysql_real_escape_string($_COOKIE['propertyID']) . "'

I have used that routine of putting single and double quotes in other joomla sql calls, but here it doesn't like it.

There was a page on this site how to do your own SQL that I followed. Everything worked until I put in the cookie part. There is documentation about how to add a cookie and the Before Render, store plugin doesn't give me that ability to pull the cookie and turn it into a variable to use in the sql.

I have searched the internet looking for cookie variable seblod, but nothing ever shows up.

1283 Posts
Bucklash
7 years ago
0
Level 5

Hi


Have you tried displaying the value of he cookie to see if it is there? - use before render to do that.

If it is available there and not in sql quertmaybe it should be put on github as bug or feature request.

If it is available in before render I would assign that to a fields value then try and reference that fields value in the sql query - can't remember right now what you can access in the query, I know the user object is available....

4229 Posts
Kadministrator
7 years ago
0
Level 1

You can't use cookie in any of the sql related plugins. Only way to do what you need is using code pack.If you don't know enough coding to do that yourself you can use seblod service.

https://www.seblod.com/resources/extensions/plug-ins/sql-pack

Get a VIP membership