Jump to content


gc_dependent_select library with condition


  • Please log in to reply
2 replies to this topic

#1 carperolm

carperolm

    Member

  • Members
  • PipPip
  • 14 posts

Posted 10 February 2016 - 12:39 PM

Hello

For dependent dropdowns I use gc_dependet_select library by Victor (amazing library)

 

But I'm not sure if I can do the following:

 

I have this database structure:

COUPONS
coupon_id
user_id
category_id
...

USERS
user_id
city_id
...

CATEGORIES
category_id
city_id
...
$fields = array(
// first field:
'user_id' => array( // first dropdown name
'table_name' => 'users', // table of country
'title' => 'username', // country title
'relate' => null // the first dropdown hasn't a relation
),
// second field
'category_id' => array( // second dropdown name
'table_name' => 'categories', // table of state
'title' => 'name', // state title
'id_field' => 'category_id', // table of state: primary key
'relate' => 'city_id', // table of state:
'data-placeholder' => 'Select users first' //dropdown's data-placeholder:
)
);

 

I would like to generate a dependant dropdown in COUPONS, where I select the users first and then the categories with the same city_id as the user selected.

 

It's possible?

 

Thanks in advance

 



#2 darkweather

darkweather

    Newbie

  • Members
  • Pip
  • 2 posts

Posted 23 February 2016 - 08:30 AM

Is gc_dependet_select library by Victor works for current version of grocery? 

 

I've been trying to implement it recently but I couldn't make it work.

On last pages of main topic it said that is not working with current of grocery.

 

Is there any particular trick?

 

Thank you



#3 carperolm

carperolm

    Member

  • Members
  • PipPip
  • 14 posts

Posted 25 February 2016 - 03:27 PM

It's working properly with the last grocerycrud version.

 

I just follow the steps.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users