Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filtering datasource by select box link with number string doesn't seem to work #83

Open
jude86-7 opened this issue May 20, 2016 · 9 comments
Assignees
Labels

Comments

@jude86-7
Copy link

Hi,

I wonder if someone can please help.
I have a site set up in symphony 2.6.7 using select box link 2.0

I have two sections;

  1. Gallery Categories - Title (forms SBL) and Image
  2. Gallery Images - Image, Select a Category (SBL)

I give a gallery category the title of '2015'.
I upload some images to the gallery images section and link them to the '2015' category. All is working great.

However I then create a data source for Gallery Images.

I filter the 'select a category' field for gallery images by the url parameter I have created for the gallery category title '{$gallery-cat-title}'. However this returns no results in the data source output.

If I change the gallery category title to 'test 2015' the gallery image data source is filtered properly and outputs the XML I would expect.

If anyone has seen this happen before or know of why it might be happening I would be grateful.

Thanks in advance

@brendo
Copy link
Member

brendo commented May 21, 2016

From memory, the SBL does a fuzzy search when the value is a string to try and find the related entry by that value in the associated section. My guess is 2015 is being interpreted as a number, so it think it already has an entry ID and attempts to pull in the data for an entry with the ID of 2015.

This would explain why adding characters to the title worked :) Is that always possible?

@jude86-7
Copy link
Author

Hi @brendo thanks for coming back to me on this. Unfortunately for this project the title does need to be just numbers i.e. '2015'

Do you know if there would be a way around this at all?

Thanks

@brendo
Copy link
Member

brendo commented May 23, 2016

The code that causes this is these lines. So commenting them out should resolve the issue.

You may need a more comprehensive solution if you have other SBL fields in your system that need this behaviour though.

Ideally we'd just do a stricter check for integer, but often ID's are passed around as strings in Symphony which makes this difficult at the moment!

@jonmifsud
Copy link
Member

A quick way around this would be to 'use' the following trick:

  1. Use the reflection field and append a string to your 'title' to make the
    select read something like Id: xx
  2. In the filters append the prefix as part of your filter eg Id: {$param}

On Mon, 23 May 2016 at 11:37 jude86-7 [email protected] wrote:

Hi @brendo https://github.com/brendo thanks for coming back to me on
this. Unfortunately for this project the title does need to be just numbers
i.e. '2015'

Do you know if there would be a way around this at all?

Thanks


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
#83 (comment)

@nitriques
Copy link
Member

@brendo also, L896 is dangerous since not all fields implement the fetchIDfromValue function.

I had this problem before, but do not remember how I fixed it...

@nitriques nitriques added the bug label May 24, 2016
@nitriques nitriques self-assigned this May 24, 2016
@jude86-7
Copy link
Author

Hi Guys

Thanks for your help and comments, much appreciated. I've taken @jonmifsud advice and set up a reflection field for now to get us up and running, it works a treat. Thanks!

@nitriques
Copy link
Member

Great! But I'll still try to fix this issue! Thanks!

@jude86-7
Copy link
Author

That's great thanks, I just needed a quick fix to get something up and running but I'll keep an eye on the thread for a more permanent fix. If I can help in anyway just let me know! thanks again

@nitriques
Copy link
Member

Ok perfect!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants