Let's deal with the possible constipation issue first. If that is the issue there are two things I know of that can help. Feeding veiled pureed pears is said to help produce stool. The other is for many species. Many chameleons like to poop in the presence of water. A "Shower"* or extra long misting can encourage them to defecate and provide ample hydration which may help as well.
*"Shower - Another method of providing water, especially to dehydrated chameleons, is by using a shower. Place a large plant in the tub, aim the shower head against the wall, and run the water so that only a fine mist reaches the chameleon. The water should be room temperature (not hot!). They may drink for up to 30 minutes. Make sure to supervise your chameleon at all times while using this method."
As mentioned above your caging needs a serious overhaul. Your chameleons health depends on proper husbandry, unventilated glass aquariums are almost impossible to adjust to provide good husbandry. Getting a screen cage or tall glass viv will prevent a host of issues.