ChronoEngine.com homepage

Forums

Please write a review for the extension you are using on the Joomla extensions directory before posting a new question as we are being spammed by many negative reviews.

Thank you for your support!

Dropdown inside repeater

ieraora 22 Jan, 2022
Hello. Can You confirm that this is a Bug? Thank you.


In actions I set an array..

http://generaphoto.com/temp/cro01.jpg
undefined


and I want select only first line for dropdwon options, that is in a repeater

undefined
http://generaphoto.com/temp/cro02.jpg

undefined
Why I've some options? Where I wrong?

This is row 3...
http://generaphoto.com/temp/cro21.jpg
undefined


And this is row 4

http://generaphoto.com/temp/cro03.jpg
undefined
Colnem 22 Jan, 2022
Hi

You can't do that
First, if your PHP Element array change for each line of Multiline Option, the php code has to be in the loop, before Dropdown

Second: to pass a var from php to CF7, you have to use this syntax:
$this->set("var_cf7", $varPhp);

So, in Dropdown Multine Line Options, you have to do that:
{var:var_cf7}

Third: CF7 array has to be an associative array.
For example, someone like this in PHP:
$carsPhp=array(0=>'Volvo',1=>'BMW',2=>'Saab');
$this->set("cars_cf7", $);carsPhp;
Then, in CF7, Multiline Options
{var:cars_cf7}
In this case, you have a dropdown, to choose between Volvo, BMW, Saab.

But I don't understand very well that you will.
May be...
first loop:choose between Volvo, BMW, Saab
Second loop; choose between Fiat,Mercedes, Porsche
Third loop: choose between Ferrari, Lamborghini, Porsche

Is it? In this case, you have to pass the row number to php to calculate between each row of the loop.

Good luck!
ieraora 22 Jan, 2022
I've the same error.

http://generaphoto.com/temp/cro08.jpg

http://generaphoto.com/temp/cro09.jpg


http://generaphoto.com/temp/cro10.jpg
Colnem 23 Jan, 2022
Sure, if you include this php element in the Repeater....
You have to include the php element in the repeater only if you will change the array for each loop to recalculate each time.

Want do you want exactly? In your picture, I don't see the source of the repeater.
ieraora 23 Jan, 2022
The cars was an example.
The repeater connect to a list of photo, every photo has a price list id.
I need a dropdown that get all lists of this price list id
Can you help me to find right way?

For example I've Photo Id 3277, his price list is 208, and for this Photo I need to get all formats/prices
that has price list = 208




http://generaphoto.com/temp/cro11.jpg




http://generaphoto.com/temp/cro12.jpg



In dropdown, option value will be id, and option text a combine of formato and prezzo


http://generaphoto.com/temp/cro13.jpg
Colnem 23 Jan, 2022
Hi

First, can you speak french?

Two: I think you don't have to use a repeater. I see 2 methods.

1 More easy, using 2 dropdowns
You read the table to build an array of (Photo_id=>liste_id) to load in a first dropdown.
When the visitor choose a photo, you know the liste_id. Using Ajax, you load an array like (liste_id=>format_price_id) to load in a second dropdown.
Then the visitor can choose a Format/Price in the second dropdown.

2 using Relations table + special field to build an array of (photo/list=>format_price).
So you have a dropdown like:
photo1/liste:Format_price1
photo1/liste:Format_price2
photo1/liste:Format_price3
photo1/liste:Format_price4
photo2/liste:Format_price1
photo2/liste:Format_price2
photo2/liste:Format_price3
photo2/liste:Format_price4
...

In the second method, if you have many photos, your dropdown list will be very very large!
ieraora 23 Jan, 2022
Ok. First, I'm sorry but I don't speak french.

So, I was working to second methods


http://generaphoto.com/temp/cro14.jpg



http://generaphoto.com/temp/cro15.jpg
Colnem 23 Jan, 2022
I don't analyse your job in detail, but I see at least one big bug:

Not {var:read_immagini.0.Foto.cf_id} : you are reading only the firt line!
but {var:read_immagini.[n].Foto.cf_id} to read all lines.
ieraora 23 Jan, 2022
Yes Colnem, but, I should see only a element, 3277 only a time.
For ever element of repeater, this option increases by one.

first element = 1 (3277)
second = 2 (3277,3277)
then = 10 (3277, 3277,3277,3277,3277,3277,3277,....)
Colnem 23 Jan, 2022
Ok I didn't't understand.

So it's more easy. And don't use a repeater.
You read your table xijdhd_cf_prodotti_formatti with Add Where conditions in SQL Statement: id_listino = {var:read_immagini.[0].Sottogalleria.id_listino}

Then, please, post me a copy of the result...

I'm waiting for you...
ieraora 23 Jan, 2022
Sorry but if I can't use repeater, what I use?
Colnem 23 Jan, 2022
A Read data Element to read your table xijdhd_cf_prodotti_formatti with Add Where conditions in SQL Statement: id_listino = {var:read_immagini.[0].Sottogalleria.id_listino}...

The result will be an array of value that you can use to read the second table.

The result of the second table will'be used to build your var for the dropdown.
ieraora 23 Jan, 2022
I can't understand when you write "the second table".
See my work.
I haven't error written above, but I've prices of all list insert in Photos get.

http://generaphoto.com/temp/cro17.jpg



http://generaphoto.com/temp/cro18.jpg



http://generaphoto.com/temp/cro19.jpg


http://generaphoto.com/temp/cro20.jpg
Colnem 23 Jan, 2022
I retake.

Table 1: Read Element with Add SQL STatement: cf_id = 3277 to read id_listino

Table 2: Second read Element table xijdhd_cf_prodotti_formatti with Add Where conditions in SQL Statement: id_listino = {var:read_immagini.[0].Sottogalleria.id_listino}

So your result will be only id=208....
Colnem 23 Jan, 2022
If it's good, In the dropdown:
Option Value = {Prezzi.id} (for the moment).
Option Text = {Prezzi.prezzo} (for the moment).

I believe that you expect somenone like a list of Format+Prize:
prezzo1 / 2.00
prezzo / 5.00
02 / 2.00
01 / 1.00

Isn't it?

If I'am wright: Option Text = {Prezzi.formato} / {Prezzi.prezzo}
ieraora 24 Jan, 2022
Hi Colnem, thank you very much for your support.
And sorry, but I don't understand.

If I read this
A Read data Element to read your table xijdhd_cf_prodotti_formatti with Add Where conditions in SQL Statement: id_listino = {var:read_immagini.[0].Sottogalleria.id_listino}...
The result will be an array of value that you can use to read the second table.
The result of the second table will'be used to build your var for the dropdown.

I ask me: How can I read an array with Read Data? I Read Data I can only select a database table? There is another way that I don't know?

Remember that dropdown for Photo id 3277 (so with List 208) is different to Photo id 3278 (and with List 207).

Thank you so much.
Colnem 24 Jan, 2022
I've said "Read data read an array"? I'm wrong. Sorry for my bad english language.

I would say "Read Data return always results in associative array"
See up at your pictures: read_immagini)=>Array, (read_prezzi)=>Array...
ieraora 27 Jan, 2022
Hi Colnem, I read some times yours post, but I don't understand.
You say that I must not use repeater.
But I need to get a loop of items (Photos), there is another way?

Thank you so much if you can help me!!!
Colnem 28 Jan, 2022
Hi

First, you said you want a list of item in a dropdow box. To do that, you don't need a repeater.
But, may be, I've don't understand very well what you want...
You need to login to be able to post a reply.

2Checkout.com

2CheckOut.com Inc. (Ohio, USA) is an authorized retailer for goods and services provided by ChronoEngine.com