THE PARSHIYOS IN TEFILIN [Tefilin: Parshiyos]
Gemara
34b (Beraisa - R. Yosi): If one has two head Tefilin but no Shel Yad, he wraps leather around one of them (so it will appear like one Bayis) and ties it on his arm.
(Beraisa #1): The order of the Parshiyos - on the right are "Kadesh Li" and "Ki Yevi'acha." "Shma" and "v'Hayah Im Shamo'a" are on the left.
Contradiction: Another Beraisa (#2) gives the opposite order!
Answer (Abaye): One Beraisa gives the order for a reader (facing the wearer). The other Beraisa is with respect to the wearer.
The reader reads in order.
(Rav Chananel): If the order was changed, they are Pesulim.
(Abaye): This is only if a Parshah that should be on the outside (extreme left or right) is on the inside, but if the outside Parshiyos were switched (with each other), or the inside ones were switched, it is Kosher.
Objection (Rava): Surely, you disqualify when an outside Parshah was switched with an inside one, for a Parshah that should be 'exposed' is not (and vice-versa). Likewise, when the outside Parshiyos are switched with each other, the Parshah that should be 'exposed' to the right is not (and vice-versa)!
Rather, in either case it is Pasul.
Sanhedrin 89a (R. Zeira): If the outer boxes are not open to the air, it is Pasul.
Rishonim
Rif and Rosh (Hilchos Tefilin (after Menachos) 7a and Siman 6): Abaye said that if the outside Parshiyos were switched, or the inside ones were switched, it is Kosher. The Halachah does not follow him.
Ma'adanei Yom Tov (40): When the inside Parshiyos are switched it is Pasul, for the Parshah that should be next to the Parshah exposed to the right is not next to it.
Rambam (Hilchos Tefilin 3:5): In the head Tefilin, the last Parshah, v'Hayah Im Shamo'a, is in the box on the right of the wearer. Shma is next to it, then Ki Yevi'acha, and Kadesh Li is in the fourth box, on the left. One who faces the wearer reads in this order (Kadesh Li, Ki Yevi'acha, Shma and v'Hayah Im Shamo'a, from right to left). If he switched the order, they are Pesulim.
Rebuttal (Ra'avad): Rav Hai Gaon says that the Havayos ("v'Hayah Im Shamo'a and v'Hayah Ki Yevi'acha") are next to each other. The Gemara listed the order of the Parshiyos in a Beraisa, and said (Stam, without listing the order) that another Beraisa explains oppositely. Surely it listed the order based on the one doing the Mitzvah (like Rav Hai Gaon explains). Why should it list the order based on one facing the wearer (like the Rambam explains)?! Rather, we teach that Shma and v'Hayah Im Shamo'a are in the order of one who reads Torah (or anything in Hebrew), i.e. right to left (with respect to the wearer). It is logical to give the order (of these two Parshiyos) from the end (outside), and not from the middle.
Kesef Mishneh (citing Teshuvas ha'Rambam; also, Rashba below): All agree that the Parshiyos in the Shel Yad are in the order they appear in the Torah. The order in the Shel Rosh is the same, for R. Yosi permits wrapping leather around a Shel Rosh and using it for a Shel Rosh!
Rosh (5): Rashi explains that the reader reads in the order that the Parshiyos appear in the Torah, i.e. "Kadesh Li", "Ki Yevi'acha", "Shma" and "v'Hayah Im Shamo'a." R. Tam asked, if so why did we say separately which are on the right, and which are on the left? One could answer, this is because they are in the middle of the head, and two are to the right, and two are to the left. R. Tam explains that "Kadesh Li" and "Ki Yevi'acha" are to the right of the reader, and "Shma" and "v'Hayah Im Shamo'a" are to the left of the reader, with Shma on the outside. R. Chananel similarly explains 'if the outer boxes are not exposed to the air, the Mitzvah is invalid', i.e. the Parshiyos of "Kadesh" and "Shma." Rav Hai Gaon explained similarly, and gave a Siman - the Havayos are next to each other. Rav Shrirah Gaon explained similarly, and gave a Siman - the letters Shin (in Kadesh and Shma) are adjacent to the Shinim on the right and left sides of the box of the head Tefilin (on the outside). Teshuvas ha'Ge'onim of R. Yosef Tuv Elem says similarly. 'The reader reads in order' is the conclusion of Beraisa #1. The Gemara did not specify which order is for the wearer, and which for the reader, therefore, it cited the end of Beraisa #1, to teach that the reader reads in the order given in Beraisa #1.
Ma'adanei Yom Tov (6): Does the end of the Beraisa come to answer the Gemara's question?! Rather, the text of the Rosh should say like it says in Tosfos (34b DH veha'Korei), '('the reader reads in order') is the conclusion of Beraisa #1. It teaches that one reads them in the order they are placed in Tefilin, from right to left, Kadesh, Ki Yevi'acha, v'Hayah Im Shamo'a and Shma. Even if this is not part of the Beraisa, it is not difficult.'
Rosh (ibid): The Gemara did not specify which order is for the wearer, and which for the reader, therefore, it brought 'the reader...' to teach that the order given in Beraisa #1 is for a reader. Kadesh and Ki Yevi'acha are on his right, and v'Hayah Im Shamo'a and Shma are on his left. The Rif omitted 'the reader reads in order.' Shimusha Raba (a Ga'on's compilation of Hilchos Tefilin; the Rosh brings it after Siman 31) explains like Rashi. The Mechilta connotes like Rashi. It says that the Parshiyos Kadesh, Ki Yevi'acha, Shma and v'Hayah Im Shamo'a must be written in order. If not, we bury the Tefilin. R. Tam and those who hold like him must explain that this mandates writing them in the order they appear in the Torah. It does not teach about the order of the parchments in the boxes. (Surely, they hold that also in the hand Tefilin Shma is on the outside, i.e. last). They must explain that the scribe leaves space for v'Hayah Im Shamo'a, writes Shma, and then writes "v'Hayah Im Shamo'a. Since the greatest sages argue about this, and only one of them is Kosher, one with Yir'as Shamayim will make two pairs of Tefilin (one according to each opinion) and wear both together.i.
Rashba (Teshuvah 234, attributed to Ramban): The Rif says that Kadesh is to the right of the wearer, and Havayos are in the middle. (Note: this is not in our text of the Rif.) The Gemara only lists one order for writing Tefilin, the order in which they are written in the Torah. If one needed to skip Shma and write v'Hayah Im Shamo'a before it, the Gemara would have mentioned this! Also, it is absurd to skip. The Ra'avad said, surely the Gemara quotes the order based on the one doing the Mitzvah, and not based on one facing the wearer. The Tana of one Beraisa was not concerned for this! The Gemara said 'how does he order them.' It does not refer to the wearer, rather, to the one who puts the parchments in the boxes; he faces like one who reads them. In most texts, 'the reader reads in order' is all Abaye's words. He explains Beraisa #1, which we cited. The Ra'avad explains that the order given (in Beraisa #1) is with respect to the wearer. If so, they are not read in order! The Ra'avad says that 'in order' refers to only to Shma and v'Hayah Im Shamo'a. This is very difficult. Why did Abaye explain only these?! Rather, Abaye said it to explain Beraisa #1, which we quoted. R. Tam rejected Rashi, because the Gemara could have listed all four Parshiyos, and said which is on the (extreme) left or right. This is not difficult. Had it done so, we would have thought that only this is Me'akev (that Kadesh (or v'Hayah Im Shamo'a) is on the extreme left (or right). Even the way it was taught, Abaye thought that the middle Parshiyos may be switched. Had it just listed all four Parshiyos, we would not know if they start from the right or left. We rely on Rashi and the Rambam. Also the Ramban and R. Yonah did in practice.
Mishbetzos Zahav (1): The Ra'avad is a third opinion. According to him, we truly needed to teach that one who reads Shma reads in order, i.e. Shma and v'Hayah Im Shamo'a are to the left of the wearer. Perhaps the Beis Yosef did not bring his opinion, for he rejected it.
Poskim
Shulchan Aruch (OC 34:1): According to Rashi and the Rambam, Kadesh is on the left on the wearer, on the outside. "Ki Yevi'acha" is second, then "Shma", and then "v'Hayah Im Shamo'a on the outside to the right. According to R. Tam, v'Hayah Im Shamo'a is in the third box, and Shma is in the fourth. The universal custom is like Rashi and the Rambam.
Magen Avraham (1): This is even for a left-handed person, for we say that the reader reads in the order they appear in the Torah.
Eshel Avraham: We asked a contradiction between Beraisos. We did not answer that one of them discusses a lefty. The Magen Avraham derived that the Parshiyos are in the same order for a lefty.
Beis Yosef (DH u'Mah): The Tur, Tosfos, Rosh and others say that R. Tam agrees that the scribe must write them in the order they appear in the Torah, also regarding the hand Tefilin. Semak says that there is no argument about the hand Tefilin. Hagahos (7) was astounded, and explains that perhaps Semak means that b'Di'eved one is Yotzei either way. We learned that if the Parshiyos are in a different order, they are Pesulim, i.e. for the head Tefilin. The Poskim disagree. Rather, if the head or hand Tefilin was not written in the order they appear in the Torah, they are Pesulim. Old Tefilin were found near Yechezkeil's grave, like Rashi and the Rambam.
Mishnah Berurah (4): The Beis Yosef, Gra and Acharonim conclude that Rashi's opinion is primary.