$v['membership_id'] = 0; } if ($v['quantity_old'] == 1 && $v['membership_id'] == 0) { $v['quantity'] = 1; } if ($v['quantity'] <= 0 || !$v['quantity_old'] && $v['price'] <= 0) { continue; } if (!$k) { $v['quantity_old'] = $v['quantity']; $v['membership_id_old'] = $v['membership_id']; } cw_product_update_price($product_id, $v['variant_id'], $v['membership_id'], $v['membership_id_old'], $v['quantity'], $v['quantity_old'], $v['price'], $v['list_price'], $k); if ($ge_id && $fields['w_price'][$k] && $info) { while ($pid = cw_ge_each($ge_id, 1, $product_id)) { cw_product_update_price($pid, $v['variant_id'], $v['membership_id'], $v['membership_id_old'], $v['quantity'], $v['quantity_old'], $v['price'], $v['list_price']); } } } $top_message = array('content' => cw_get_langvar_by_name('msg_adm_product_wholesale_upd'), 'type' => 'I'); cw_refresh($product_id, 'wholesale'); } if ($action == 'wholesales_delete' && is_array($wprices)) { foreach ($wprices as $id => $v) { if (!$v['del']) { continue; } if ($v['quantity_old'] > 1 || $v['membership_id'] != 0) { db_query("delete from {$tables['products_prices']} where price_id='{$id}'"); } }
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")); } if (!$is_variant) { //cw_price_lists_replace_price($product_id, $product_data['price'], 0, $is_new_product, $product_data['is_manual_price']); if (isset($product_data['price']) && isset($product_data['list_price'])) { cw_product_update_price($product_id, 0, 0, 0, 1, 1, $product_data['price'], $product_data['list_price']); } } if ($fields['price'] && !$is_variant) { if ($ge_id) { while ($pid = cw_group_edit_each($ge_id, 1, $product_id)) { if ($pid != $product_id) { cw_price_lists_replace_price($pid, $product_data['price'], 0); } } } } cw_func_call('cw_items_attribute_classes_save', array('item_id' => $product_id, 'attribute_class_ids' => $product_data['attribute_class_ids'], 'item_type' => 'P')); # kornev, it have to be product_data here - because we change the attributes in the error_check function cw_call('cw_attributes_save', array('item_id' => $product_id, 'item_type' => 'P', 'attributes' => $product_data['attributes'], 'language' => $edited_language, array('update_posted_only' => true, 'is_default' => false))); cw_attributes_group_update($ge_id, $product_id, 'P', $fields);