extcode / cart_products

CartProducts is a TYPO3 extension and provides an own data storage for simple and configurable products. Products can be offered via a list and detail view and can be purchased via cart function of the Cart extension.
7 stars 25 forks source link

Add Special Prices or Quantity Discount to all users #74

Closed X-Tender closed 4 weeks ago

X-Tender commented 4 years ago

When I add one of the Options without setting a Frontend Group (Because I want that everybody get the option) then I get the following error in the Backend.

2: SQL error: 'Incorrect integer value: '' for column 'frontend_user_group' at row 1' (tx_cartproducts_domain_model_product_quantitydiscount:NEW5eea0288ed4dd577483646)

When I set a Frontend group everything works fine.

Beltshassar commented 3 years ago

I've encountered the same problem.

Add 'default' => 0, in the array _frontend_usergroup => config inside _Configuration/TCA/tx_cartproducts_domain_model_productquantitydiscount.php

    'frontend_user_group' => [
        'exclude' => 1,
        'label' => $_LLL . ':tx_cartproducts_domain_model_product_quantitydiscount.frontend_user_group',
        'config' => [
            'type' => 'select',
            'renderType' => 'selectSingle',
            'readOnly' => 0,
            'foreign_table' => 'fe_groups',
            'size' => 1,
            'items' => [
                ['',  '0'],
            ],
            'minitems' => 0,
            'maxitems' => 1,
            'default' => 0,
        ]
    ],

When having a zero as second value and the field is of type int(10) in the database, make sure to define the default value as well in TCA: 'default' => 0. Otherwise issues may arise e.g. with MySQL strict mode.

https://docs.typo3.org/m/typo3/reference-tca/master/en-us/ColumnsConfig/Type/selectSingle.html#items

Beltshassar commented 3 years ago

Btw. this issue is fixed in pull request #64

rintisch commented 4 weeks ago

Will close the ticket as it's closed as written above.