<?php
require_once __DIR__ . '/../config/db.php';

try {
    $pdo = getConnection();
    
    $pid = 4464; // ID for product a0004
    
    echo "Deactivating blister (pres_id = 2) and caja (pres_id = 3) for product ID $pid...\n";
    $stmt = $pdo->prepare("UPDATE producto_presentaciones SET activo = 0 WHERE producto_id = ? AND presentacion_id IN (2, 3)");
    $stmt->execute([$pid]);
    echo "Rows updated: " . $stmt->rowCount() . "\n";
    
    echo "\nVerification of presentations for product ID $pid:\n";
    $stmtVerify = $pdo->prepare("SELECT * FROM producto_presentaciones WHERE producto_id = ?");
    $stmtVerify->execute([$pid]);
    print_r($stmtVerify->fetchAll());

} catch (Exception $e) {
    echo "Error: " . $e->getMessage() . "\n";
}
