function cw_faq_get_product_faq($product_id) { global $tables; $ret['main_category'] = cw_query_first("select * from {$tables['faq_rubrik']} where ars_id = '{$product_id}' and ars_type = 'product'"); if (!$ret['main_category']) { cw_faq_create_product($product_id); $ret['main_category'] = cw_query_first("select * from {$tables['faq_rubrik']} where ars_id = '{$product_id}' and ars_type = 'product'"); } if ($ret['main_category']) { $ret['subcategories'] = cw_faq_get_subcategories($ret['main_category']['rubrik_id']); $ret['articles'] = cw_faq_get_articles($ret['main_category']['rubrik_id']); } $ret['is_faq'] = (bool) (count($ret['articles']) || count($ret['subcategories'])); return $ret; }
cw_group_edit_copy_product_status($product_data['status']); } if ($edited_language != $config['default_admin_language']) { cw_unset($query_fields, 'descr', 'fulldescr', 'product', 'features_text', 'specifications'); } if (!$addons['warehouse']) { $query_fields[] = 'avail'; } if (!$is_variant) { $query_fields[] = 'weight'; } cw_array2update('products', $product_data, "product_id = '{$product_id}'", $query_fields); // TODO: move to addon if ($addons['faq']) { 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); }