Foul call question

I'm sure it's been answered elsewhere, but....
When Shake was fouled going to the basket, he was awarded two shots. But his shot was goaltender, and that was not called.
If it was a shooting foul, why did he not get the basket and s foul shot?
When Shake was fouled going to the basket, he was awarded two shots. But his shot was goaltender, and that was not called.
If it was a shooting foul, why did he not get the basket and s foul shot?