You are here:  » Incorporating a pop-under into product page

Support Forum



Incorporating a pop-under into product page

Submitted by ANDREWCX on Sun, 2007-07-22 14:46 in

Hi,

I would like to include code to automatically open a new page (preferably as a pop-under but failing that as a pop-up) when visitors got to a product page on my site. I'd like to do this with some conditions;

See http://rewardsdb.com/product/Taca.html as an example.

I would like to open a popunder of the URL contained in the "Support RewardsDB" link when it exists but not pop anything when it doesn't.

Any ideas?

Submitted by support on Sun, 2007-07-22 15:07

Hi Andrew,

You should be able to place the pop-under JavaScript directly into the end of html/product.php, and use the same conditional code that you currently use to determine whether or not to display the Support RewardsDB link higher up the same page. For example (I don't know what you have it called in your database), you might have something like:

<?php if ($mainProduct["supportRewardsDB"]): ?>
...insert JavaScript popup code here
<?php endif; ?>

If you're not picking supportRewardsDB up from the database then it won't be quite as above but that should point you in the general direction...

Hope this helps,
Cheers,
David.

Submitted by ANDREWCX on Sun, 2007-07-22 17:36

Thanks,

I am having 2 problems.

1st - I can't seem to get the above code to work. To clarify - the merchant name I want to use is "Support RewardsDB".

2nd - the popunder script I would like to use has a javascript command var popunder="http://url.com" - do you know of a way I can define that variable by the url the "Support RewardsDB" link uses?

You can see all the code as it currently stands (non-working) at:

http://beta.rewardsdb.com/product/Buy.html

Thanks

Andrew

Submitted by support on Sun, 2007-07-22 17:43

Hi Andrew,

Sorry - I didn't realise that Support RewardsDB was the merchant name. In that case, the code you need to be using is something like:

<?php
 
if ($mainProduct["merchant"] == "Support RewardsDB"): 
?>

...insert JavaScript popup code here
<?php
 
endif; 
?>

As you go into the JavaScript section, you will be in normal HTML mode. At this point, you should be able to bring the page URL (Buy URL) as follows:

<?php print $mainProduct["buy_url"?>

(this code would be inline with your JavaScript at the point you want the URL)

Hope this helps,
Cheers,
David.

Submitted by ANDREWCX on Sun, 2007-07-22 18:29

Thanks,

That works great!

Submitted by ANDREWCX on Fri, 2007-08-03 13:28

Hi David,

A related question. Instead of opening in a pop-under window I was considering opening in an inline frame. Do you have any suggestions on how to do that? I tried

<?php
 if ($mainProduct["merchant"] == "Support RewardsDB."):
?>
<script>
var popunder="<?php print $mainProduct["buy_url"?>"
<iframe src=popunder height="100" width="100"></iframe>
</script><?php endif; ?>
</p></div>

but nothing happens.

Thanks,

Andrew

Submitted by support on Fri, 2007-08-03 13:36

Hi Andrew,

That code doesn't look quite right - the IFRAME source is not part of the JavaScript. Try something like this:

<?php if ($mainProduct["merchant"] == "Support RewardsDB."): ?>
<script type='text/javascript'>
var popunder="<?php print $mainProduct["buy_url"?>";
document.write("<iframe src='"+popunder+"' height='100' width='100'></iframe>");
</script>
<?php endif; ?>
</p></div>

Hope this helps!
Cheers,
David.

Submitted by ANDREWCX on Sat, 2007-08-04 02:06

Hi,

It didn't work :( No errors - just nothing loading.... any other ideas?

Submitted by support on Sat, 2007-08-04 07:39

Hi Andrew,

Are you intending to have the "." on the end of "Support RewardsDB"? If not, the following line:

<?php if ($mainProduct["merchant"] == "Support RewardsDB."): ?>

...should be:

<?php if ($mainProduct["merchant"] == "Support RewardsDB"): ?>

...that may be all it is!

Cheers,
David.

Submitted by scorpionwsm on Sat, 2007-08-04 09:14

Hi Andrew,

Just to give you a warning before you do venture into this. You may get punished from the search engines if you use any form of pop up, pop under, pop snap crackle or whatever trick.

A lot of search engines might see this as a dirty tricks campagin and ban your site from the search engine.

Personally I would say this at your OWN RISK

Personally I would very much advise against it

Regards

Mark

Submitted by ANDREWCX on Sat, 2007-08-04 15:56

I got it to work by using only php - I ditched the javascript - no idea why I thought I should use that in the first place....