$db->beginTransaction();
/*****/
$sql = "INSERT INTO products (name, price) VALUES (:name, :price)";
$sth = $db->prepare($sql);
$sth->execute(
array(
':name'=>$product['main']['name'],
':price'=>$product['main']['price'],
)
);
// Получаем id последней вставленной записи
$idProduct = $db->lastInsertId();
/*****/
foreach ($product['attributes'] as $attribute) {
$sql = "INSERT INTO productAttribute (idProduct, nameAttribute) VALUES (:idProduct, :nameAttribute)";
$sth = $db->prepare($sql);
$sth->execute(
array(
':idProduct'=>(int)$idProduct,
':nameAttribute'=>$attribute['attribute'],
)
);
}