Currently in Yii I have an AJAX call on a list box that will dynamically modify the next box on selection.
Ajax call currently indicates my controller and method. Public Function Action Dynamic Products () {Forrest ($ _ POST ['product group'] ['id'] $ product group) {$ Grouped P = Grouped Product :: Models () - & gt; FindAll ('product_group_id =: product_group_id', array (': product_group_id' = & gt; $ product group)); $ GroupedP = CHTML :: listData ($ groupedP, 'id', 'product_id'); Foreign Currency ($ grouped P $ value = & gt; $ product_id) {$ data = product :: model () - & gt; Search (all '(id =: id', array (': id' => $ product_id)); $ data = CHTML :: listData ($ data, 'id', 'title'); foreign currency ($ Value = $ as data $ & gt; $ headline} {echo CHtml :: tag ('option', array ('value' = & gt; $ value), CHtml :: encoded ($ title), true);}} }}
Currently it works perfectly well, but what I want to do for this is reverse where a group is selected, the next box is related to that I do not show the products. If I select shirts and jeans, then just show me Should show relationship. Or if I choose shirts and jeans Literacy, my relationship should not show anything. There is a mistake in your logic that generates a set of tags for each repeat option of your first 'foreach' Example: To do this, you can fix it: Hope this will help you. $ data = products :: model () - & gt; findAll ('id! =: Id', array (': id' => $ product_id)); But if there are multiple items This will not be displayed only which is not available for example
$ product = array (0 = & gt; relationship1 => shirts2 = & gt; jeans) $ group product = Array (0 = & gt; Shirts and Jeans 1 = & gt; Relationship2 = Jeans and Connection)
// status whith not absolute $ dbc = new CDBCRIIT (); $ Dbc- & gt; Adet Incandesence ('product_group_id', $ _POST ['product group'] ['id']); $ GroupedP = GroupedProducts :: Model () - & gt; FindAll ($ DBC); $ GroupedP = CHTML :: listData ($ groupedP, 'id', 'product_id'); Foreign Currency ($ grouped P $ value = & gt; $ product_id) {$ data = product :: model () - & gt; Search (all '(id =: id', array (': id' => $ product_id)); $ data = CHTML :: listData ($ data, 'id', 'title'); foreign currency ($ Value = $ as data $ & gt; $ headline} {echo CHtml :: tag ('option', array ('value' = & gt; $ value), CHtml :: encoded ($ title), true);}}
No comments:
Post a Comment