CalcBuilder Forum

Linked list (sql) in sections

User Dreamless 2019-02-05 22:30:36


I'm making a calculator that filters values from a database to calculate the price of a product based on its components. Basically it consists of:

Option list - that retrieves category names using sql actions;
Linked list (sql) - retrieves component names according to the category selected above.
Component is selected and price is calculated.

So far everything is simple and works fine, but the issue is that to calculate the price of a single product I need to add several components to calculation thus sections have to be used.

I know arrays are in action here, but I just can't figure out the correct syntax how to make it work. Not sure if I'm missing something, or tutorial and examples just doesn't cover this case.

Would appreciate any help or hints on the matter.

Moonsoft support 2019-02-06 09:41:13

the configuration of the fields (the list, linked list, etc) would be the same in case you want to use them inside a section. You only need to create the section, select them to be inside the section, and configure the layout. As you say, the main change is when you want to handle the data to make calculations, because now you have a list of values (array), for each field inside the section. There is a tutorial about section configuration where we have added some more tips about the code needed, you can check it here:

And also load the calculator example with sections if you want to see one working example that can also be used as template.

Hope this helps


User Dreamless 2019-02-06 12:33:35

Thanks for your reply.

Ok, so configuration of the fields should be the same when in section, but I'm having problems with my linked list (sql) field.

I removed all the code and left only the two fields. Without sections they work fine, but when I add a section and both fields in it, I receive an error:

Warning: count(): Parameter must be an array or an object that implements Countable in
/public_html/components/com_calcbuilder/models/calcbuilder.php on line 529

Option list works fine, but the linked list (sql) triggers the error.

Moonsoft support 2019-02-07 09:20:46


It's not an error itself, but a warning that can be related to a different php version. You shouldn't be seeing that kind of messages on a production site, they are intended for dev purpouses, and showing that kind of information at your site is not a good idea. They can also 'break' the format of some server responses causing problems. Please check your joomla configuration System->Global configuration->Server->Error reporting. That setting should be turned off for a live website unless you want to check any error specifically so you enable for a while.


User Dreamless 2019-02-07 19:29:59

Reading my previous post I see I didn't explain the issue right. I just assumed that the warning is indicating the source of my problem.

The problem is that the field itself doesn't work when in section.

Without sections my linked list (sql) field reacts to the change in option list and fills itself with appropriate values from the database. With sections it does not. It stays blank.

Option list field which also takes values from database works in both cases, but the linked list (sql) only works without sections.

I'll look further into this and try to figure something out.

Moonsoft support 2019-02-08 12:08:05


Ok, we have just added a new upgraded version for you to try. Please download and upgrade and try again your calculator.Please let us know if you can see any change and/or if you see a different warning message.


User Dreamless 2019-02-08 14:32:33

Hi, thanks for a brief update.

I do see changes right away, but it still doesn't work right.

So I got two fields:
Field 1 - option list
Field 2 - linked list (sql)

Field 2 still doesn't react to changes in Field 1 right away, but...
If I add another section, then field 2 reacts, but only to a field 1 in the very first section.

If I add more sections, they all react to Field 1 in Section 1 only.

Another minor thing, a text "int(565429)" appeared next to the add section button.

Moonsoft support 2019-02-08 16:02:26

we are unable to reproduce here, so we think there must be any other script affecting this behaviour at your site. Please place a private ticket at the helpdesk sharing an access to your site, so we'll check your configuration and debug directly to let you know how to fix.


User Dreamless 2019-02-12 22:47:47


Just want to let you know that it finally works! Deleting cached files in chrome solved the issues I had after the update. Thanks for your help!

List Manager

Build different lists for your site

Buy now!
Support/development 40 hours

With the peace of mind of having a professional team at your service (20% discount)

Buy now!