Link to multiple objects possible?

I’m using Complementary attributes to link 2 objects. I would like though to link to more than one object. Is that possible?

I tried adding multiple lines in the Value field, but it doesn’t work with neither newline, nor with , between them.

Product:product/class/product.class.php,Product:product/class/product.class.php

Product:product/class/product.class.php
Product:product/class/product.class.php

I can always save the field, but if I return to edit the complementary attribute again, then it is not there, only one instance of

Product:product/class/product.class.php

If I use semicolon ; then I can get it to write

Product:product/class/product.class.php;Product:product/class/product.class.php

but I still can not select multiple objects. Is it even possible, and how so?


single_object_link

I tried linking to a category, and I get this error

“This website or feature is currently temporarly not available or failed after a technical error.
This may be due to a maintenance operation. Current status of operation (2024-07-24T13:43:14Z) are on next line…
Dolibarr has detected a technical error. You can read log file or set option $dolibarr_main_prod to ‘0’ in your config file to get more information.”

And my object link is defined as this:

Categorie:categories/class/categorie.class.php

I get this error message if I turn on debug logging

JonSweet16:flask_project_registration jonbendtsen$ grep -i error /tmp/dolibarr.log
2024-07-24 11:47:14 ERR 10.0.2.100 DoliDBMysqli::query Exception in query instead of returning an error: Unknown column ‘t.ref’ in ‘field list’
2024-07-24 11:47:14 ERR 10.0.2.100 DoliDBMysqli::query SQL Error message: DB_ERROR_NOSUCHFIELD Unknown column ‘t.ref’ in ‘field list’
2024-07-24 11:47:14 ERR 10.0.2.100 Error url=/product/card.php?id=55&action=edit_extras&token=-TOKEN--DELETED-&attribute=membership_category&ignorecollapsesetup=1, query_string=id=55&action=edit_extras&token=-TOKEN--DELETED-&attribute=membership_category&ignorecollapsesetup=1, sql=SELECT t.rowid, t.ref FROM llx_categorie as t WHERE 1=1 ORDER BY t.ref ASC, db_error=Unknown column ‘t.ref’ in ‘field list’

Hi @jonbendtsen
Take a look at this module

Thanks @sonikf, I don’t think it is what I want to do, because we sell membership as an add on when people buy our dance classes and events.

Currently it is a hardcoded product that changes every 6 month, and I’d like to have both some automated lookup oh which membership to sell, yeah I can link to a single product, but I’d like to give a choice between 6 month or 12 months.

Tomorrow I’ll try:

  • linking to a product with variants and see if I can follow the variants
  • searching for a product with membership in the name
  • searching for a category with membership in the name, and then the products in that category.

My first attempt is using a search like this

(t.label:like:‘%member%’) and (t.tosell:=:1)

because if I have to get a category, then that is one extra API connection, and if I link to a product with variants then I also have to make extra API connections to follow those products.

So I think that my approach will be to keep the single object link and if that is set only present that option, but if it is not set I will do the search and present all options which are found in the search.

I ended up creating a new Complementary Attribute, checkboxes from table, and the table I use is the category table with an sqlfilter to only list product categories.

image

Here’s the value in text you can easily copy’n’paste

categorie:label:rowid::type=0

I actually create another category with optional_extra_purchase categories.

Then I just put products into them, and they’ll show up on the registration form :slight_smile:

Pretty smart :smiley:

1 Like

Here’s how it ended up looking for required extra purchase choices on a iPhone

And the optional extra purchases look like this on a iPhone

The variant column is fk_product_parent, so when it is a number it is because the product which is listed is a variant of a parent product which I’ve changed to be not for sale.

When variant column is Non, it is simply when fk_product_parent was null and thus when changed from json to a dictionary in python it became None, and then I just removed the e so I can easily distinguish between “None” and None.

On the next page, the confirmation it looks like this on a laptop

Now, you’d think I would just use the “lines” value from the proposal I create anyway, but no, I only had that thought after having created something that kind of builds a similar dictionary with sort of the same information :frowning: