Product options with checkbox field

Questions around the TYPO3 integration and plugins
Forum rules
Always add your TYPO3, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
cnoelker
Advanced
Posts: 140
Joined: 20 Feb 2016, 18:21

Product options with checkbox field

Post by cnoelker » 06 May 2020, 12:24

Hello,

is there a way to configure a custom options field as a checkbox on the product detail page?
On the demo page: http://typo3.demo.aimeos.org/demo/detai ... article/0/
there is a dropdown, a text, an integer and a date field. How can I create a checkbox?

Claudia

User avatar
aimeos
Administrator
Posts: 7908
Joined: 01 Jan 1970, 00:00

Re: Product options with checkbox field

Post by aimeos » 08 May 2020, 08:15

Use "client/html/catalog/attribute/type/<code>" -> "input"
Code: https://github.com/aimeos/ai-client-htm ... #L103-L125
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

cnoelker
Advanced
Posts: 140
Joined: 20 Feb 2016, 18:21

Re: Product options with checkbox field

Post by cnoelker » 09 May 2020, 10:03

Hi,
thank you. I checked the code. In case of a custom attribute, the lines starting from 156 are relevant, not the ones which you highlighted.

So, only three types are accepted, currently: price, date and text (which is default).

I added a case for the checkbox:

Code: Select all

<?php break; case 'checkbox': ?>
<input class="form-control" type="checkbox" name="<?= $enc->attr( $this->formparam( array( 'b_prod', 0, 'attrcustid', $id ) ) ); ?>" />
Works like a charm. :)

Claudia

Post Reply