The Ahmadiyya Muhammadiyya and the Shadhiliyya
The Ahmadiyya Muhammadiyya tariq of Ahmad ibn Idris, though independent, is connected to the Shadhiliyya order and based on its principles. But before we look at how these two orders are connected, let us look at the principles of the Shadhiliyya order as described by Abd al-Aziz al-Dabbagh, the shaykh of al-Tazi, who in turn was the shaykh of Ahmad ibn Idris.
Al-Dabbagh was asked the following question:
“What is the difference between the Way of al-Shadhili and his followers, and the Way of al-Ghazali and his followers? the first seems to be fully centered around gratitude and joy to the Giver without any exertion or struggle, while the other seems to be focused on spiritual exercises (Riyadah) and hunger and staying awake and tiring acts of exertion, so are they both in congruence on the necessity for Riyada? and Imam al-Shadhili seems to command (his followers) to have gratitude after coming close to Arrival (Wusul) or upon reaching it, or even to have gratitude and joy in Allah from the first moment of the Path. And could both Ways be taken at the same time by one person, or is it that you cannot benefit from one unless you avoid the other? Please give a thorough response…”
The Way of Gratitude (Shukr) is the original Way, and it was the Way traveled by the hearts of the Prophets and the Pure Ones among the Sahaba and others, and it consists of worshipful devotion (‘Ibadah) of Him Most High with sincerity in servanthood and being free of all personal aims and selfish portions, coupled with recognition and admittance of one’s own impotence and deficiency and inability to fulfill the rights of Lordship, and that all of that become established and settled in the heart in every passing moment and hour. So when He (Most Exalted) saw their truthfulness in that, He rewarded them in accordance with what His overflowing Generosity would dictate, such as an opening into His Knowledge and obtainment of the secrets of secured belief (Iman) in Him.
“And when the folk of Striving heard of the attainments of these, they made these attainments their ultimate aim and desire, and sought them through acts of fasting, praying at night, periods of solitude (Khalwa), until they obtained whatever they obtained.
“Therefore, in the first Way (of Gratitude) the move (Hijrah) was - from the beginning - towards Allah and His Messenger, and not towards spiritual illumination and unveilings, whereas in the other Way (of struggle) it was towards the obtainment of spiritual openings and levels and degrees in that. The walking in the first Way is a walking of hearts, while in the second Way is a walking of bodies; and the Opening (Fath) in the first is of-a-sudden, without the servant having any expectation or wait for it, so that while the servant is busy with repentance and seeking forgiveness, the manifest opening comes to him.
“Both Ways are correct, but the Way of Shukr is more correct and more sincere. Both Ways are agreed upon the necessity for spiritual exercises and strivings, but in the first it is a striving of the hearts, by upholding the attachment between him and Allah Most High, and stationing the heart constantly at His Door, and fleeing to Allah in both states of motion and stillness, and striving to stay away from any periods of heedlessness (ghaflah) between moments of wakeful presence (hudur)… in a word, it consists of firm attachment of the heart to Allah and perpetuity in that state, even if outwardly one does not find (in them) great acts of worship. This is why you would find such a person fasting sometimes and feasting other times, sleeping sometimes and staying awake other times, sleeping with their spouses, and performing other duties of the religion which would appear in contradistinction with a way of life of bodily and physical Riyadah.
“As for the second way, the move (Hijrah) is towards spiritual openings and levels. Then after the Opening, some of them remain stuck in their primary intention, so that his heart becomes attached to the things he witnesses, and he becomes happy and content with the unveilings and walking on water and moving long distances in short periods of time (lit: “folding up of distance”), and he sees that this is the ultimate goal. These are the people whose hearts are emptied of Allah from the beginning of their affair till its end, among “those who are the greatest of losers in their acts, whose strivings are misguided in this life, while they imagine that they perform excellently” (Qur’an 18:103-04).
“But others (among this second way) change their intentions after the Opening, and Allah has mercy on them and takes them by the hand, so that their hearts become attached to Allah, and turn away from anything else. And this state which occurs with them is the beginning state for those in the first Way (of Shukr) - so look at the great separation existing between the two!
“So in summary, the traveling in the first Way is a traveling of hearts, and in the second Way is a traveling of bodies, and the intention in the first Way is pure, and in the second is mixed and impure, and the Opening in the first is of-a-sudden and unexpected, and in the second is obtained through secondary means and efforts, and this is how the two Ways are divided. Also, in the first Path, the Opening (Fath) is only obtained by the believer (mu’min) knower (‘arif) beloved (habib) close one (qarib), in distinction with the second Path, in which one hears of certain monks and rabbis undertaking physical acts of spiritual striving through which they attain to some degrees and ranks. In all of this we speak of physical and spiritual acts of striving and exertion in an absolute sense, regardless if they come from someone on the Path of truth or falsehood, and we are not referring specifically to the Riyadah of Abu Hamid al-Ghazali (may Allah be pleased with him), for he is a true leader and a real saint.
“as for your asking whether both ways can be taken by one person at the same time, then yes it is possible, for there is no contradiction in having one’s heart attached to Allah Most High in all moments, and undertaking outward acts of Mujahadah and Riyadah (e.g., fasting, praying at night, etc…), and Allah knows best.”
It is on these principles of the Shadhili path that the Ahmadiyya Muhammadiyya tariqa is based. Shaykh AbdulGhani Saleh al-Jaafari, current head of the Jaafari branch of the Ahmadiyya Muhammadiyya (the Jaafariyya Ahmadiyya Muhammadiyya tariqa) states:
This tariq's foundation was laid by my master Abul Hassan al-Shadhili, and its base was established by my master Ahmad ibn Idris, and its building was constructed and its pillars raised by my master the Imam Saleh al-Jaafari, may God be pleased with them all. ...
And so that everyone knows this historical fact, the Shadhili school of Sufism was spread and promoted by master Ahmad ibn Idris and then my master the shaykh Saleh al-Jaafari erected its pillars and completed its building.
Therefore the Jaafari tariqa is the Jaafari Idrisi Shadhili Sufi school. 
In fact, shaykh Ahmad ibn Idris wrote a treatise called "The Treasures of the Radiant Jewels in The Principles of the Shadhiliyya Order", which he introduces by saying,
"I beheld in the Shadhiliyya Order matters of exalted import which surpass the bounds of compilation as regards their glory and beneficience, yet the order does possess (a fixed number of) principles upon which it is founded." The purpose of the treatise is to gather these principles together.
Then Ahmad ibn Idris mentions that he has taken this order "from many shaykhs" but lists only the last one he took from his shaykh al-Tazi, saying afterwords:
"About this chain, al-Mursi has said, 'This, our path, has been validated from Pole to Pole, all the way back to the Prophet (pbuh), thus it is known as the "Path of the Poles" ' ".
In the sixth principle, Ibn Idris describes how the Prophet and Khidr came to him and gave him the litanies of his own order, the Ahmadiyya Muhammadiyya. However before the Prophet (pbuh) asked Khidr to instruct Ibn Idris in the litanies, he first "ordered al-Khidr to implant in me the dhikrs of the above-mentioned Shadhiliyya order, and he implanted them in me in the Prophet's presence." 
This tells us that although the Ahmadiyya Muhammadiyya is an independent tariqa with its own litanies, it is based on the Shadhiliyya tariqa, for the Shadhiliyya litanies were implanted into shaykh Ahmad ibn Idris before he was given his own litanies.
And he who looks at Imam Muhammad bin Ali al-Sanusi's al-Manhal al-Rawiyy can find tens of different chains of the Shadhiliyya tariqa that he took, including its many branches such as the Nasiriyya, the Ghaziyya, the Rashidiyya, the Zarruqiyya, the Rashidiyya Zarruqiyya, the Bakriyya Zarruqiyya, the Arousiyya, and the Jazuliyya- all branches of the Shadhili tariqa that al-Sanusi was initiated into, most of them through his master Ahmad ibn Idris.
Regarding the last branch of the Shadhiliyya mentioned above, the Jazuliyya, it has its own history with the concept of the Tariqa Muhammadiyya. As we have mentioned elsewhere, the tasliya on the Prophet is one of the cornerstones of the Tariqa Muhammadiyya movements, and the Imam al-Jazuli (d. 1465) is the author of Dala'il al-Khayrat, the "the best known and most widely disseminated book of prayers on the Prophet Muhammad." The third major shaykh of this tariqa, the Moroccan Abdallah al-Ghazwani (d. 1529), used the term al-Tariqa al-Muhammadiyya to describe something very similar to the later Tariqa Muhammadiyya movements.
A final connection between the Shadhiliyya order and the concept of the Tariqa Muhammadiyya is the idea of seeing the Prophet while awake and being instructed by him instead of by any other human figure. These concepts were present in the Shadhili tariqa since its inception: on the former, we can quote al-Shadhili's successor al-Mursi who said, "If the Prophet (pbuh) was veiled from my eyes as long as the blink of an eye, I would not consider myself as one of the Muslims". As for the latter, al-Shadhili's companion Makin al-Din al-Asmar is quoted as saying, "I was not reared (spiritually) except by the Messenger of Allah (pbuh)".
Thus we can see the close relationship between the Shadhili tariqa and the Tariqa Muhammadiyya, and in particular the Ahmadiyya Muhammadiyya tariqa and its branches.
A special thanks goes to Ibrahim Hakim al-Shaghouri for allowing me to use his translation of al-Dabbagh's words. Jazakallah khairan.
1.Ahmad ibn al-Mubarak, al-Ibriz min Kalam Sidi Abd al-Aziz al-Dabbagh. Translated by Ibrahim Hakim al-Shaghouri on http://yaqutalarsh.wordpress.com/ with minor changes.
2. Saleh al-Jaafari, al-Ilham al-Nafi' li Kulli Qasid, Daar Jawami' al-Kalim, pg 4-5.
3. Bernd Radtke, R.S. O’Fahey and John O’Kane, "Two Sufi Treatises of Ahmad Ibn Idris", Oriens, xxxv, 1995.
4. Vincent J. Cornell, from his introduction to The Path of Muhammad, translated by shaykh Tosun Bayrak.
5. To read about al-Ghazwani's idea of the Tariqa Muhammadiyya see Vincent Cornell, Realm of the Saint, Power and Authority in Moroccan Sufism (Austin: University of Texas Press, 1998).