我最近使用CSV导入套件将200多种产品导入我的系统,但正如我所见,我无法自动编辑预订时间和产品可用性。这意味着如果我想设置正确的预订时间,我必须单独查看每个产品。
有没有办法按下面的一个(或任何)选项进行编辑?
(*this)[i]
查询。如果可能,哪个表?答案 0 :(得分:0)
我在数据库中找到了我需要的所有属性,并创建了一个要更新的脚本。如果有人需要,请参阅下面的代码。记住要适应你的需要。
REPLACE INTO `db_site`.one_postmeta (post_id, meta_key, meta_value) (SELECT ID, '_wc_booking_base_cost', '' FROM `db_site`.one_posts WHERE post_type = 'product');
REPLACE INTO `db_site`.one_postmeta (post_id, meta_key, meta_value) (SELECT ID, '_wc_booking_calendar_display_mode', 'always_visible' FROM `db_site`.one_posts WHERE post_type = 'product');
REPLACE INTO `db_site`.one_postmeta (post_id, meta_key, meta_value) (SELECT ID, '_wc_booking_duration_type', 'fixed' FROM `db_site`.one_posts WHERE post_type = 'product');
REPLACE INTO `db_site`.one_postmeta (post_id, meta_key, meta_value) (SELECT ID, '_wc_booking_duration', 21 FROM `db_site`.one_posts WHERE post_type = 'product');
REPLACE INTO `db_site`.one_postmeta (post_id, meta_key, meta_value) (SELECT ID, '_wc_booking_duration_unit', 'day' FROM `db_site`.one_posts WHERE post_type = 'product');
REPLACE INTO `db_site`.one_postmeta (post_id, meta_key, meta_value) (SELECT ID, '_wc_booking_user_can_cancel', 'yes' FROM `db_site`.one_posts WHERE post_type = 'product');
REPLACE INTO `db_site`.one_postmeta (post_id, meta_key, meta_value) (SELECT ID, '_wc_booking_cancel_limit', 8 FROM `db_site`.one_posts WHERE post_type = 'product');
REPLACE INTO `db_site`.one_postmeta (post_id, meta_key, meta_value) (SELECT ID, '_wc_booking_cancel_limit_unit', 'day' FROM `db_site`.one_posts WHERE post_type = 'product');
REPLACE INTO `db_site`.one_postmeta (post_id, meta_key, meta_value) (SELECT ID, '_wc_booking_min_date', 2 FROM `db_site`.one_posts WHERE post_type = 'product');
REPLACE INTO `db_site`.one_postmeta (post_id, meta_key, meta_value) (SELECT ID, '_wc_booking_min_date_unit', 'week' FROM `db_site`.one_posts WHERE post_type = 'product');
REPLACE INTO `db_site`.one_postmeta (post_id, meta_key, meta_value) (SELECT ID, '_wc_booking_buffer_period', 8 FROM `db_site`.one_posts WHERE post_type = 'product');
REPLACE INTO `db_site`.one_postmeta (post_id, meta_key, meta_value) (SELECT ID, '_wc_review_count', 0 FROM `db_site`.one_posts WHERE post_type = 'product');
REPLACE INTO `db_site`.one_postmeta (post_id, meta_key, meta_value) (SELECT ID, '_wc_booking_cost', '' FROM `db_site`.one_posts WHERE post_type = 'product');
REPLACE INTO `db_site`.one_postmeta (post_id, meta_key, meta_value) (SELECT ID, '_wc_display_cost', '' FROM `db_site`.one_posts WHERE post_type = 'product');
REPLACE INTO `db_site`.one_postmeta (post_id, meta_key, meta_value) (SELECT ID, '_wc_booking_min_duration', 1 FROM `db_site`.one_posts WHERE post_type = 'product');
REPLACE INTO `db_site`.one_postmeta (post_id, meta_key, meta_value) (SELECT ID, '_wc_booking_max_duration', 1 FROM `db_site`.one_posts WHERE post_type = 'product');
REPLACE INTO `db_site`.one_postmeta (post_id, meta_key, meta_value) (SELECT ID, '_wc_booking_enable_range_picker', 'no' FROM `db_site`.one_posts WHERE post_type = 'product');
REPLACE INTO `db_site`.one_postmeta (post_id, meta_key, meta_value) (SELECT ID, '_wc_booking_qty', 1 FROM `db_site`.one_posts WHERE post_type = 'product');
REPLACE INTO `db_site`.one_postmeta (post_id, meta_key, meta_value) (SELECT ID, '_wc_booking_has_persons', 'no' FROM `db_site`.one_posts WHERE post_type = 'product');
REPLACE INTO `db_site`.one_postmeta (post_id, meta_key, meta_value) (SELECT ID, '_wc_booking_person_qty_multiplier', 'no' FROM `db_site`.one_posts WHERE post_type = 'product');
REPLACE INTO `db_site`.one_postmeta (post_id, meta_key, meta_value) (SELECT ID, '_wc_booking_person_cost_multiplier', 'no' FROM `db_site`.one_posts WHERE post_type = 'product');
REPLACE INTO `db_site`.one_postmeta (post_id, meta_key, meta_value) (SELECT ID, '_wc_booking_min_persons_group', 1 FROM `db_site`.one_posts WHERE post_type = 'product');
REPLACE INTO `db_site`.one_postmeta (post_id, meta_key, meta_value) (SELECT ID, '_wc_booking_max_persons_group', '' FROM `db_site`.one_posts WHERE post_type = 'product');
REPLACE INTO `db_site`.one_postmeta (post_id, meta_key, meta_value) (SELECT ID, '_wc_booking_has_person_types', 'no' FROM `db_site`.one_posts WHERE post_type = 'product');
REPLACE INTO `db_site`.one_postmeta (post_id, meta_key, meta_value) (SELECT ID, '_wc_booking_has_resources', 'no' FROM `db_site`.one_posts WHERE post_type = 'product');
REPLACE INTO `db_site`.one_postmeta (post_id, meta_key, meta_value) (SELECT ID, '_wc_booking_resources_assignment', 'customer' FROM `db_site`.one_posts WHERE post_type = 'product');
REPLACE INTO `db_site`.one_postmeta (post_id, meta_key, meta_value) (SELECT ID, '_wc_booking_max_date', 12 FROM `db_site`.one_posts WHERE post_type = 'product');
REPLACE INTO `db_site`.one_postmeta (post_id, meta_key, meta_value) (SELECT ID, '_wc_booking_max_date_unit', 'month' FROM `db_site`.one_posts WHERE post_type = 'product');
REPLACE INTO `db_site`.one_postmeta (post_id, meta_key, meta_value) (SELECT ID, '_wc_booking_first_block_time', '' FROM `db_site`.one_posts WHERE post_type = 'product');
REPLACE INTO `db_site`.one_postmeta (post_id, meta_key, meta_value) (SELECT ID, '_wc_booking_requires_confirmation', 'no' FROM `db_site`.one_posts WHERE post_type = 'product');
REPLACE INTO `db_site`.one_postmeta (post_id, meta_key, meta_value) (SELECT ID, '_wc_booking_default_date_availability', 'available' FROM `db_site`.one_posts WHERE post_type = 'product');
REPLACE INTO `db_site`.one_postmeta (post_id, meta_key, meta_value) (SELECT ID, '_wc_booking_check_availability_against', '' FROM `db_site`.one_posts WHERE post_type = 'product');
REPLACE INTO `db_site`.one_postmeta (post_id, meta_key, meta_value) (SELECT ID, '_wc_booking_resouce_label', '' FROM `db_site`.one_posts WHERE post_type = 'product');
REPLACE INTO `db_site`.one_postmeta (post_id, meta_key, meta_value) (SELECT ID, '_wc_booking_availability', 'a:0:{}' FROM `db_site`.one_posts WHERE post_type = 'product');
REPLACE INTO `db_site`.one_postmeta (post_id, meta_key, meta_value) (SELECT ID, '_wc_booking_pricing', 'a:0:{}' FROM `db_site`.one_posts WHERE post_type = 'product');
REPLACE INTO `db_site`.one_postmeta (post_id, meta_key, meta_value) (SELECT ID, '_wc_memberships_product_viewing_restricted_message', '' FROM `db_site`.one_posts WHERE post_type = 'product');
REPLACE INTO `db_site`.one_postmeta (post_id, meta_key, meta_value) (SELECT ID, '_wc_memberships_use_custom_product_viewing_restricted_message', 'no' FROM `db_site`.one_posts WHERE post_type = 'product');
REPLACE INTO `db_site`.one_postmeta (post_id, meta_key, meta_value) (SELECT ID, '_wc_memberships_product_purchasing_restricted_message', '' FROM `db_site`.one_posts WHERE post_type = 'product');
REPLACE INTO `db_site`.one_postmeta (post_id, meta_key, meta_value) (SELECT ID, '_wc_memberships_use_custom_product_purchasing_restricted_message', 'no' FROM `db_site`.one_posts WHERE post_type = 'product');
REPLACE INTO `db_site`.one_postmeta (post_id, meta_key, meta_value) (SELECT ID, '_wc_memberships_force_public', 'no' FROM `db_site`.one_posts WHERE post_type = 'product');
REPLACE INTO `db_site`.one_postmeta (post_id, meta_key, meta_value) (SELECT ID, '_wc_memberships_exclude_discounts', 'no' FROM `db_site`.one_posts WHERE post_type = 'product');
不是我创建的最好的SQL脚本,但它完成了工作:)