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
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>';

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.