$messageStack->add(MODULE_EASY_ADMIN_PRODUCTS_ATTRIBUTES_NOTICE_STATUS, 'success');
     } else {
         $messageStack->add(MODULE_EASY_ADMIN_PRODUCTS_ATTRIBUTES_NOTICE_STATUS_FAILED, 'error');
     }
     break;
 case 'save':
     $template = "index";
     $preload_attribute_edit_form = false;
     // set posted data
     $attribute = array();
     foreach ($_POST as $k => $v) {
         $attribute[$k] = $v;
     }
     // fix options_values_id if not require option_value type
     $options_type = $model->get_options_type($attribute['options_id']);
     if ($model->is_require_option_value($options_type) == false) {
         $attribute['options_values_id'] = PRODUCTS_OPTIONS_VALUES_TEXT_ID;
     }
     // fix attributes_image
     if ($attribute['attributes_image'] == 'none') {
         $attribute['attributes_image'] = "";
     }
     // upload attributes_image
     if (isset($_FILES['attributes_image']) && zen_not_null($_FILES['attributes_image']['name'])) {
         if ($model->upload('attributes_image', $_POST['img_dir'], $_POST['overwrite'], $attributes_image)) {
             $attribute['attributes_image'] = $attributes_image;
         } else {
             $error_upload = true;
             $attribute['attributes_image'] = $_POST['attributes_previous_image'];
         }
     } else {
    $attribute = $_REQUEST['attribute'];
} else {
    $columns = array("attributes_column" => $attributes_column);
    if ($edit_mode) {
        $attribute = $model->load_attribute($columns, $products_id, $attributes_id);
    } else {
        $attribute = $model->new_attribute($columns, $products_id);
    }
}
# get datas for display
$options_id_default = (int) $attribute['options_id'];
$options_values_id_default = (int) $attribute['options_values_id'];
$products_options = $model->get_products_options();
$options_for_json = array();
foreach ($products_options as $products_option) {
    $options_for_json[$products_option['id']] = array('label' => $products_option['options_name'], 'type' => $products_option['type_name'], 'require_value' => $model->is_require_option_value($products_option['type']));
}
$price_prefix_options = array(array("id" => "+", "text" => MODULE_EASY_ADMIN_PRODUCTS_ATTRIBUTES_PRICE_PREFIX_PLUS), array("id" => "-", "text" => MODULE_EASY_ADMIN_PRODUCTS_ATTRIBUTES_PRICE_PREFIX_MINUS), array("id" => "", "text" => MODULE_EASY_ADMIN_PRODUCTS_ATTRIBUTES_PRICE_PREFIX_REPLACE));
$weight_prefix_options = array(array("id" => "+", "text" => MODULE_EASY_ADMIN_PRODUCTS_ATTRIBUTES_WEIGHT_PREFIX_PLUS), array("id" => "-", "text" => MODULE_EASY_ADMIN_PRODUCTS_ATTRIBUTES_WEIGHT_PREFIX_MINUS), array("id" => "", "text" => MODULE_EASY_ADMIN_PRODUCTS_ATTRIBUTES_WEIGHT_PREFIX_REPLACE));
$on_overwrite = true;
$off_overwrite = false;
# open/close settings
$open_price_factor_setting = false;
if ($attribute['attributes_price_onetime'] != 0 || $attribute['attributes_price_factor'] != 0 || $attribute['attributes_price_factor_offset'] != 0 || $attribute['attributes_price_factor_onetime'] != 0 || $attribute['attributes_price_factor_onetime_offset'] != 0) {
    $open_price_factor_setting = true;
}
$open_qty_prices_setting = false;
if (zen_not_null($attribute['attributes_qty_prices']) || zen_not_null($attbibute['attributes_qty_prices_onetime'])) {
    $open_qty_prices_setting = true;
}
$open_price_words_setting = false;