Jump to content

Button not appearing


Recommended Posts

Hey all,

First off apologies, I'm new to php and programming in general but I'm giving it a punt so here goes. I have a gallery of images on my site and they are each displayed with an add to cart button. The thing is I also want to create a download button that will appear next to the add to cart button when '$gallery->image_desc' is equal to 'Y'. I have tried the following code and don't get any errors, but the download button fails to display when '$gallery->image_desc' is equal to 'Y'.

 

If anyone can see any way of making this happen I would be most appreciative.

 

			<div class="meta_wrapper">
			<div class="addto">';
				if(!$ecomm_but_image) {
					$insertgallery .= '<a class="iframe" id="addto_'.$gallery->id.'" href="' . photocrati_gallery_file_uri('ecomm-sizes.php') . '?prod_id='.$gallery->id.$action.'">

					<button id="addto" class="positive" style="margin:0 5px;">
						'.$ecomm_but_text.'
					</button>';
					//DOWNLOAD BUTTON IF STATEMENT
					if ($gallery->image_desc =="Y") 
					{
					'<a><button id="addtoDL" class="positive" style="margin:0 5px;">DOWNLOAD</button></a>';
					}
					//END OF DOWNLOAD BUTTON IF STATEMENT
				} else {
					$insertgallery .= '<a class="iframe" id="addto_'.$gallery->id.'" href="' . photocrati_gallery_file_uri('ecomm-sizes.php') . '?prod_id='.$gallery->id.$action.'">
						<img src="'.$ecomm_but_image.'" id="addto">
					</a>';

				}

			$insertgallery .= '</div>

		</div>

Link to comment
https://forums.phpfreaks.com/topic/266212-button-not-appearing/
Share on other sites

I think you have just forgot to add the variable part by looks of it

 

Your current code doesnt add to a variable to echo out as u can see below..

 

'<a><button id="addtoDL" class="positive" style="margin:0 5px;">DOWNLOAD</button></a>';

 

You either need to add it to the variable you are using

$insertgallery .= '<a><button id="addtoDL" class="positive" style="margin:0 5px;">DOWNLOAD</button></a>';

 

or echo it out

 

echo '<a><button id="addtoDL" class="positive" style="margin:0 5px;">DOWNLOAD</button></a>';

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.