Since you gave consent it was legal. However in the future never consent to any search ever. Had you not consented to the search an argument could have been made for an illegal search but that ship has sailed.
Mr. Driessen is a former Deputy DA in Orange County with over 8 years of criminal law experience. Nothing stated on this site shall in anyway be construed as legal advice, or as creating any attorney client relationship. If you would like to hire Mr. Driessen, feel free to contact him at www.theocduiguy.com.
I agree with my colleague. Additionally, if you were just given a ticket, you were not arrested. Since it doesn't sound like you were arrested, there can be no search incident to arrest.
The fact that I have answered this question does not establish an attorney client relationship between the questioner and my self or my office. For a FREE consultation, contact me at (626) 600-1439.