Force Sell (BeRocket "Force Sell for WooCommerce")
* ---------------------------------------------------------
* Seteaza produsul de garantie SGR ** Garantie SGR Metal (#14059)
* in campul "Linked Products, that can be removed only with this product".
*
* Cheia reala de meta a pluginului: berocket_force_sell_linked (ARRAY de ID-uri)
* Importatorul CSV WooCommerce NU poate scrie un array => de aceea importul nu a functionat.
*
* MOD DE FOLOSIRE
* 1. Code Snippets -> Add New -> lipeste acest cod -> Save & Activate
* 2. Deschide in browser: https://SITE-UL-TAU.ro/wp-admin/?run_sgr_forcesell=1
* (pentru test pe un singur produs: ...?run_sgr_forcesell=1&limit=1 )
* 3. Citeste raportul afisat sus in admin.
* 4. Dezactiveaza snippet-ul dupa ce s-a terminat.
*
* Pentru anulare: ...?run_sgr_forcesell=undo
*/define( 'SGR_DEPOSIT_PRODUCT_ID', 14059 ); // ** Garantie SGR Metal
define( 'SGR_META_KEY', 'berocket_force_sell_linked' );function sgr_force_sell_skus() {
return array(
'80695', '80719', '80697', '80738', '80777', '79472', '74413', '80883', '80882', '79539', '79538', '79624',
'80721', '80941', '80938', '80940', '79328', '79329', '80017', '79327', '80935', '80936', '80937', '79330',
'79540', '80702', '80778', '80723', '80722', '80880', '80985', '80769', '80879', '80923', '80925', '81017',
'81018', '80881', '81015', '80939', '80931', '80934', '80930', '80932', '80933', '81174', '81056', '78256',
'81037', '81038', '81190', '81191', '81077', '81033', '81078', '81080', '81079', '81028', '81029', '81030',
'81027', '81257', '81246', '81215', '81214', '81314', '81315', '81316', '81317', '81313', '83406', '83402',
'83430', '81395', '81337', '83403', '83404', '81348', '81346', '81349', '81347', '81350', '83697', '83699',
'83696', '83698', '83716', '83715', '83714', '83717', '83719', '83718', '83556', '83491', '83490', '83557',
'83492', '83530', '83558', '84040', '83994', '84041', '83969', '84055', '84258', '84163', '84162', '84292',
'84389', '84423', '84628', '84413', '84421', '84649', '84651', '84652', '84746', '84792', '84650', '84843',
'84844', '84845', '84815', '84865', '84864', '84866', '84921', '84814', '84836', '84837', '84838', '84819',
'84818', '84834', '84927', '84928', '78235', '78237', '78236', '78239', '89935', '90582', '87253', '86020',
'87251', '89926', '87231', '90527', '87269', '90529', '89955', '89958', '89962', '89961', '86024', '89960',
'87264', '87255', '87265', '87266', '87254', '86029', '88124', '88125', '88126', '87406', '87258', '87259',
'87224', '87223', '89940', '86016', '88675', '87262', '89939', '89928', '89966', '87299', '87298', '87302',
'87300', '87301', '87229', '86283', '86284', '77595', '88711', '88685', '89937', '89959', '89956', '88694',
'88696', '88695', '88697', '78007', '87403', '78006', '87402', '78008', '78004', '78005', '87277', '86025',
'86021', '89929', '89927', '89949', '89941', '89950', '87532', '87533', '89965', '85009', '89957', '89424',
'89426', '89427', '89430', '89946', '89942', '87528', '87531', '88709', '89925', '88684', '89938', '88577',
'89963', '87534', '87233', '87240', '89948', '87249', '79375', '87227', '87226', '90528', '87256', '87241',
'87242', '87243', '87244', '87268', '86263', '87270', '86262', '86264', '89954', '87274', '87273', '87272',
'87271', '89947', '87295', '87297', '87296', '87294', '87293', '87292', '89924', '87225', '87288', '87230',
'87287', '89381', '89383', '89387', '87502', '87289', '87290', '85029', '85193', '89934', '87278', '86273',
'86274', '86272', '87529', '87530', '87291', '89936', '88700', '88702', '88701', '87247', '87248', '89932',
'89931', '89933', '89944', '89945', '87535', '86662', '88784', '89943', '88786', '86318', '90180', '86319',
'86317', '86320', '88121', '86656', '88291', '86657', '88123', '87245', '87246', '89368', '89369', '89370',
'86316', '86314', '86315', '88712', '89964', '88785', '88787', '85041',
);
}add_action( 'admin_notices', function () {if ( ! current_user_can( 'manage_woocommerce' ) ) return;
if ( ! isset( $_GET['run_sgr_forcesell'] ) ) return;$mode = sanitize_text_field( $_GET['run_sgr_forcesell'] );
$limit = isset( $_GET['limit'] ) ? absint( $_GET['limit'] ) : 0;$skus = sgr_force_sell_skus();
if ( $limit > 0 ) { $skus = array_slice( $skus, 0, $limit ); }$ok = 0; $lipsa = array(); $deja = 0;foreach ( $skus as $sku ) {$product_id = wc_get_product_id_by_sku( (string) $sku );
if ( ! $product_id ) { $lipsa[] = $sku; continue; }
if ( (int) $product_id === (int) SGR_DEPOSIT_PRODUCT_ID ) { continue; }if ( $mode === 'undo' ) {
delete_post_meta( $product_id, SGR_META_KEY );
$ok++;
continue;
}$current = get_post_meta( $product_id, SGR_META_KEY, true );
if ( ! is_array( $current ) ) { $current = array(); }if ( in_array( (string) SGR_DEPOSIT_PRODUCT_ID, array_map( 'strval', $current ), true ) ) {
$deja++;
continue;
}$current[] = (string) SGR_DEPOSIT_PRODUCT_ID;
update_post_meta( $product_id, SGR_META_KEY, array_values( array_unique( $current ) ) );
$ok++;
}echo '
SGR Force Sell ';
echo 'Mod: ' . esc_html( $mode ) . ' ';
echo 'SKU procesate: ' . count( $skus ) . ' ';
echo 'Actualizate: ' . $ok . ' ';
echo 'Aveau deja garantia: ' . $deja . ' ';
echo 'SKU negasite in magazin: ' . count( $lipsa ) . ' ';
if ( $lipsa ) { echo '' . esc_html( implode( ', ', $lipsa ) ) . ' '; }
echo '
';
} );
ALEX-STAR CASTRAVETI IN OTET 9-12 CM 4100GR(2B)
You're viewing: ALEX-STAR CASTRAVETI IN OTET 9-12 CM 4100GR(2B)
24.82 lei – 26.12 lei Price range: 24.82 lei through 26.12 lei
{CU TVA}
Add to basket
There are no reviews yet.