PluginProbe
Lasso Lite – Affiliate Link Manager & Product Displays / 158
Lasso Lite – Affiliate Link Manager & Product Displays v158
158 157 155 156 154 153 152 151 150 149 148 trunk 0.9.9 104 105 106 107 108 109 110 111 112 113 114 115 All 57 releases
← All changes | classes/class-import.php +18 -5 113158 View file →
@@ -44,8 +44,13 @@
44 44 if ( '' === $import_id || '' === $import_source ) {
45 45 return false;
46 46 }
47 47
48 + // Bulk revert passes plugin slugs from the revert table; UI passes display labels.
49 + if ( isset( Setting_Enum::SUPPORT_IMPORT_PLUGINS[ $import_source ] ) ) {
50 + $import_source = Setting_Enum::SUPPORT_IMPORT_PLUGINS[ $import_source ];
51 + }
52 +
48 53 if ( 'AAWP' === $import_source && 'aawp_list' === $post_type ) {
49 54 $aawp_list = $lasso_db->get_aawp_list( $import_id );
50 55 $aawp_amazon_ids = $aawp_list->product_asins ?? '';
51 56 $aawp_amazon_ids = '' !== $aawp_amazon_ids ? explode( ',', $aawp_amazon_ids ) : array();
@@ -53,14 +58,24 @@
53 58 foreach ( $aawp_amazon_ids as $amazon_id ) {
54 59 $url_detail = $lasso_db->get_url_details_by_product_id( $amazon_id, Amazon_Api::PRODUCT_TYPE );
55 60 if ( $url_detail ) {
56 61 $import_id = $url_detail->lasso_id;
57 - wp_delete_post( $import_id );
62 + wp_update_post(
63 + array(
64 + 'ID' => $import_id,
65 + 'post_status' => 'trash',
66 + )
67 + );
58 68 $status = $lasso_db->process_revert( $import_id, false );
59 69 }
60 70 }
61 71 } elseif ( isset( $import_source ) && in_array( $import_source, array( 'AAWP', 'AmaLinks Pro', 'EasyAzon' ), true ) ) {
62 - wp_delete_post( $import_id );
72 + wp_update_post(
73 + array(
74 + 'ID' => $import_id,
75 + 'post_status' => 'trash',
76 + )
77 + );
63 78 $status = $lasso_db->process_revert( $import_id, false );
64 79 } else {
65 80 $status = $lasso_db->process_revert( $import_id );
66 81 delete_post_meta( $import_id, 'affiliate_link_type' );
@@ -65,10 +80,8 @@
65 80 $status = $lasso_db->process_revert( $import_id );
66 81 delete_post_meta( $import_id, 'affiliate_link_type' );
67 82 }
68 83
69 - $lasso_db->delete_url_details( $import_id );
70 -
71 84 // ? clear cache after reverting
72 85 Lasso_Cache_Per_Process::get_instance()->un_set( self::OBJECT_KEY . '_' . $import_id );
73 86 Lasso_Cache_Per_Process::get_instance()->un_set( 'wp_post_' . $import_id );
74 87
@@ -566,9 +579,9 @@
566 579 'price' => $product['attributes']['ListPrice'] ?? $product['lowest_price_n'] ?? '',
567 580 'default_url' => $product['url'],
568 581 'url' => $product['url'],
569 582 'image' => $product['images'][4]['url'] ?? $product['images'][ count( $product['images'] ) - 1 ]['url'],
570 - 'quantity' => 200, // Manual checks won't show out of stock for now. TODO: Add BLS to out of stock checks.
583 + 'quantity' => 200, // Deferred: BLS quantity for out-of-stock checks (product decision — see epic #496).
571 584 'is_manual' => 1,
572 585 );
573 586 $lasso_amazon_api->update_amazon_product_in_db( $store_data );
574 587 }