- สถานะ
- เปิด
- รายงานสำหรับ
- WPML Multilingual & Multicurrency for WooCommerce 5.5.3.1
- ปลั๊กอิน/ธีมที่เกี่ยวข้อง
- WooCommerce Product Bundles
- แท็กหัวข้อ
- WCML
ภาพรวมของปัญหา
เมื่อแปลสินค้าจัดชุดโดยใช้ WooCommerce Multilingual และ WooCommerce Product Bundles คุณอาจพบว่ารายการสินค้าที่จัดชุดทั้งหมดในสินค้าที่แปลแล้วขาดหายไป ปัญหานี้เกิดขึ้นเมื่อฐานข้อมูลไม่สอดคล้องกัน ซึ่งทำให้ไม่สามารถซิงโครไนซ์ข้อมูลสินค้าจัดชุดในการแปลได้อย่างถูกต้อง
วิธีแก้ปัญหาชั่วคราว
โปรดตรวจสอบให้แน่ใจว่าคุณได้ทำการสำรองข้อมูลไซต์ทั้งหมดก่อนดำเนินการต่อ
- เปิดไฟล์ …/woocommerce-multilingual/compatibility/WcProductBundles/class-wcml-product-bundles.php
- ทันทีหลังจากโค้ดนี้:
if ( ! $translated_item_id ) { $menu_order = $this->wpdb->get_var( $this->wpdb->prepare( " SELECT menu_order FROM {$this->wpdb->prefix}woocommerce_bundled_items WHERE bundle_id=%d AND product_id=%d ", $bundle_id, $product_id ) ); $this->wpdb->insert( $this->wpdb->prefix . 'woocommerce_bundled_items', [ 'product_id' => $translated_product_id, 'bundle_id' => $translated_bundle_id, 'menu_order' => $menu_order, ] ); $translated_item_id = $this->wpdb->insert_id; $this->set_translated_item_id_relationship( $item_id, $translated_item_id, $lang ); } - เพิ่มโค้ดนี้:
$check = $this->wpdb->get_var( $this->wpdb->prepare( "SELECT bundled_item_id FROM {$this->wpdb->prefix}woocommerce_bundled_items WHERE bundled_item_id = %d AND bundle_id = %d", $translated_bundle_id, $translated_product_id ) ); if ( !$check ) { $menu_order = $this->wpdb->get_var( $this->wpdb->prepare( " SELECT menu_order FROM {$this->wpdb->prefix}woocommerce_bundled_items WHERE bundle_id=%d AND product_id=%d ", $bundle_id, $product_id ) ); $this->wpdb->insert( $this->wpdb->prefix . 'woocommerce_bundled_items', [ 'bundled_item_id' => $translated_item_id, 'product_id' => $translated_product_id, 'bundle_id' => $translated_bundle_id, 'menu_order' => $menu_order, ] ); } - สุดท้าย ให้บันทึกสินค้าต้นฉบับอีกครั้ง