jonathan66
Forum Replies Created
-
Forum: Plugins
In reply to: [WPC Composite Products for WooCommerce] Error UGS / IDCorrection :
$product_id = wc_get_product_id_by_sku( $component[‘default’] );
$product_default = wc_get_product( $product_id );- This reply was modified 1 year ago by jonathan66.
Forum: Plugins
In reply to: [WPC Composite Products for WooCommerce] Error UGS / IDHello. The difference between UGS and SKU isn’t the issue. Why do you keep talking to me about this?Pretend I never mentioned it and let’s get back to the problem.
If SKU (e.g., 602) has an equivalent Product ID (e.g., 602), then Problem.
Can you check this piece of code please?
file : class-woocoo.php line 426
if ( ! empty( $component[‘default’] ) ) {
if ( is_numeric( $component[‘default’] ) ) { // ← 🚩 Problem HERE!!!!!!!!!!
// id
$product_default = wc_get_product( $component[‘default’] );
} else {
// sku
$product_default = wc_get_product( wc_get_product_id_by_sku( $component[‘default’] ) );
}if ( $product_default ) { echo '<option value="' . esc_attr( $component['default'] ) . '" selected="selected">' . wp_kses_post( $product_default->get_formatted_name() ) . '</option>'; }}
is_numeric()considers anything that looks like a number (e.g.,"1234") as a number.So if your SKU is
"1234"(which is a string of digits), it will pass this test.But WooCommerce will then try to fetch a product using the ID
1234:$product_default = wc_get_product( $component['default'] );… instead of using the function that searches by SKU:
- This reply was modified 1 year ago by jonathan66.
Forum: Plugins
In reply to: [WPC Composite Products for WooCommerce] Error UGS / IDHello.
No, I’m not confusing SKU and SKU. UGS = SKU in French. (See image)
Let’s stick with the word SKU to avoid adding complexity. I’m simply telling you that when I upgrade from version 7.5.4 to 7.5.5, you see BOTH the SKU and the product ID. I showed you the proof in my previous images.
Pay more attention to the previous images. In the “default option,” I only have one product. However, when I look at the smart composite product and the drop-down list, a product has been added called “Ph moins piscines… …” even though it shouldn’t be there.
I’m telling you that its SKU (602), coincidentally, is identical to the ID of the product “Tuyau PVC souple…” (602).
And I think that’s why I have 2 products when I only need 1.
Forum: Plugins
In reply to: [WPC Composite Products for WooCommerce] Error UGS / IDHello. I’m having trouble importing some images here.
Here’s a URL with the images. https://imgur.com/a/iqacJ3O
I did this with the latest version, 7.5.5. I restored my website when I noticed this problem.