The reason they went bankrupt is that a private equity company bought them in an LBO and the debt load became unserviceable.
If you go back a bit further, TRU had tried and failed a couple of years to do their own ecommerce. IIRC, both attempts were built on coldfusion, and both failed pretty hard. Not that it was necessarily solely CF's fault, but there were problems (probably a combination of technical and political) that prevented TRU from doing their own ecommerce. A deal with Amazon to handle your ecommerce was probably about the dumbest "short term thinking" move a company that size could make. I say it with the experience of having worked in ecommerce in 1998/99/2000 and saw behind the scenes of some pretty large operations. It wasn't pretty, but TRU could certainly have made things work on their own or outsourcing to a company like where I was working then, and it would have worked, without resorting to Amazon.
In the year 2000 ColdFusion was a good choice, so I would not fault them for that.
PHP because the better choice around 2004.
Interestingly Amazon is/was written in C++, which was a very unusual choice.
Either way, the tech stack has little to do with the success of the business.
They failed to embrace online, that was their downfall. They didn't take it seriously, opting to let someone else handle online for them, one of the largest players in the ecommerce space: Amazon.
It goes back to the year 2000 when Amazon and Toys R Us signed a 10 year agreement that would make Toys R Us the exlusive vendor of toys on Amazon. So what happened was when you would click on toysrus.com it would send customers to their page on Amazon.
The deal started to fall apart when Amazon started allowing other toy retailers to sell through its site, because they complained Toys R Us didn't carry enough stock. So, they sued in 2004 and terminated the contract, then did its own online thing in 2006.
Coincidentally, the same thing happened with Borders (the large book store chain) which had a similar partnership with Amazon, lost out on embracing online and owning the entire workflow of selling online. Essentially Amazon was the site customers would see when ordering from these retailers.