News:

Looking for documentation? Take a look on our wiki

Main Menu

1048 Column 'ordering' cannot be null

Started by melix, December 23, 2024, 14:38:45 PM

Previous topic - Next topic

melix

Joomla 4x and Virtuemart 4x
I found this... 1048 Column 'ordering' cannot be null
When i tried this :

Reset booleans storing if main table needs to load an xref table. It also recreates the new category optimisations by rebuilding from category_categories table

In the database, the 'ordering' column is set to NOT NULL, the problem come from :

administrator/components/com_virtuemart/models/updatesmigration.php

At this block code :
$q = 'UPDATE #__virtuemart_categories SET `has_children`=NULL,`has_medias`=NULL, `category_parent_id`=NULL, `ordering`=NULL';
$db->setQuery($q);
$db->execute();

I replaced with :
$q = 'UPDATE #__virtuemart_categories SET `has_children`=NULL,`has_medias`=NULL, `category_parent_id`=NULL';
$db->setQuery($q);
$db->execute();

Is it safe this way ?

hazael

$q = 'UPDATE #__virtuemart_categories
      SET `has_children`=NULL,
          `has_medias`=NULL,
          `category_parent_id`=NULL,
          `ordering`=0';
$db->setQuery($q);
$db->execute();

The modified query sets ordering=0 instead of NULL to avoid potential issues with the database schema if the column ordering is defined as NOT NULL.

melix

#2
Thanks mate !
But, the old 'ordering' settings (hand made) will be lost or not ?

hazael

#3
this is just the numbering of the order of added categories. Nothing will happen even if your values are duplicated. This is only useful in the admin panel. "0" is the default value for the first created item and from there each subsequent one has 1, 2 and so on.