function applyChanges( $module, $http, $productCategories = false )
{
    $errors = array();
    if ( $productCategories === false )
        $productCategories = eZProductCategory::fetchList();

    $db = eZDB::instance();
    $db->begin();
    foreach ( $productCategories as $cat )
    {
        $id = $cat->attribute( 'id' );

        if ( !$http->hasPostVariable( "category_name_" . $id ) )
            continue;

        $name = $http->postVariable( "category_name_" . $id );

        if ( !$name )
        {
            $errors[] = ezpI18n::tr( 'kernel/shop/productcategories', 'Empty category names are not allowed (corrected).' );
            continue;
        }

        $cat->setAttribute( 'name', $name );
        $cat->store();
    }
    $db->commit();

    return $errors;
}
 function fetchProductCategoryList()
 {
     return array( 'result' => eZProductCategory::fetchList() );
 }
<?php

/**
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
 * @license For full copyright and license information view LICENSE file distributed with this source code.
 * @version //autogentag//
 * @package kernel
 */
// Parameters: ruleID (optional)
$module = $Params['Module'];
$errors = false;
$errorHeader = false;
$productCategories = eZProductCategory::fetchList();
/**
 * Check entered data.
 *
 * \return list of errors found, or false if the data is ok.
 */
function checkEnteredData($country, $categories, $vatType, $productCategories, $ruleID)
{
    $errors = false;
    $errorHeader = '';
    /*
     * Check if the data was entered correctly.
     */
    if (!$country || !is_numeric($vatType)) {
        $errors = array();
        $errorHeader = ezpI18n::tr('kernel/shop/editvatrule', 'Invalid data entered');
        if (!$country) {
            $errors[] = ezpI18n::tr('kernel/shop/editvatrule', 'Choose a country.');
        }