function cw_group_edit_update_category($ge_id, $cat, $fields, $data) { if (!$ge_id || !$cat || !count($fields)) { return; } global $tables, $config, $edited_language; $query_fields = cw_query_column("desc {$tables['categories']}", 'Field'); $to_update = array_intersect($query_fields, array_keys($fields)); # kornev, add attributes to update if ($edited_language != $config['default_admin_language']) { cw_unset($to_update, 'category', 'description'); } if ($to_update) { cw_group_edit_copy($ge_id, 'categories', 'category_id', $cat, $to_update); } if ($fields['membership_ids']) { while ($id = cw_group_edit_each($ge_id, 1, $cat)) { cw_membership_update('categories', $id, $data['membership_ids'], 'category_id'); } } if ($fields['avail']) { while ($id = cw_group_edit_each($ge_id, 1, $cat)) { cw_category_update_status($id, $data['avail']); } } if ($fields['category'] || $fields['description']) { $to_update = array_intersect(array('category', 'description'), array_keys($fields)); cw_group_edit_copy($ge_id, 'categories_lng', 'category_id', $cat, $to_update, "code='{$edited_language}'"); } if ($fields['image']) { cw_group_edit_copy($ge_id, 'categories_images_thumb', 'id', $cat); } cw_attributes_group_update($ge_id, $cat, 'C', $fields); }
cw_load('faq'); cw_faq_create_product($product_id); } if (AREA_TYPE == 'A') { cw_insert_product_to_sections($product_id, $ins_sections); } cw_membership_update('products', $product_id, $product_data['membership_ids'], 'product_id'); if ($fields['membership_ids']) { cw_group_edit_copy_memberships($product_data['membership_ids']); } if (!empty($fields)) { $do_not_update = array('price', 'thumbnail', 'product_image', 'category_id', 'category_ids', 'membership_ids'); $to_update = array_intersect($query_fields, array_keys($fields)); $to_update = array_intersect($to_update, array_diff($to_update, $do_not_update)); if (count($to_update)) { cw_group_edit_copy($ge_id, 'products', 'product_id', $product_id, $to_update); } } if ($config['Appearance']['categories_in_products'] == '1') { cw_recalc_subcat_count($category_id); if (is_array($old_product_categories)) { $category_ids = cw_array_merge($old_product_categories, $category_ids); } $category_ids = cw_array_merge($category_ids, $product_data['category_ids'], array($category_id)); cw_recalc_subcat_count(cw_category_get_path($category_ids)); } if ($is_new_product) { cw_add_top_message(cw_get_langvar_by_name('msg_adm_product_add')); } else { cw_add_top_message(cw_get_langvar_by_name("msg_adm_product_upd")); }