CoreCommunity ExtensionsIncubatorDistributionsTYPO3 4.5 ProjectsTYPO3 4.7 ProjectsTYPO3 6.0 ProjectsTYPO3 6.1 ProjectsTYPO3 6.2 Projects (+)

Bug #5382

Unable to remove attributes from category or products

Added by Morten Haggren over 3 years ago. Updated 10 months ago.

Status:New Start date:2009-11-16
Priority:Should have Due date:
Assignee:- % Done:

0%

Category:- Spent time: -
Target version:-
Votes: 0

Description

Once a product or category has been given a (select) attribute it's no longer possible to remove all of those attributes you can exchange the last attribute but removing all articles and saving will result in no change.

History

Updated by Ralf Merz 10 months ago

Hi,

i could still reproduce that. The last attribute, no matter in which correlation field, can not be removed.
So in lib/class.tx_commerce_belib.php->saveRelations() i added:

    // ralf: no attributes are set, so delete all attribute relations of this product
        if (empty($relationData)) {
            $GLOBALS['TYPO3_DB']->exec_DELETEquery(
                $relationTable,
                'uid_local=' .$uid_local .$where
            );
        }
          // end ralf

        if ($delete && (count($delWhere) > 0)) {
            $where = '';
            if (count($delWhere) > 0)    {
                $where = ' AND NOT ((' .implode(') OR (', $delWhere) .'))';
            }
            $GLOBALS['TYPO3_DB']->exec_DELETEquery(
                $relationTable,
                'uid_local=' .$uid_local .$where
            );
        }

So, if there´s no relationData, there are no selected attributes, and the mm-Relations can be deleted.

Do you think that´s ok?
For me, it now works.

Regards
Ralf
(merzilla)

Also available in: Atom PDF