Trying to Update the PayPal Verified Sidebox
I want to update the old 1.3 version sidebox with clickable PayPal Verified Logo to use work in 1.5.5 with new links and images. I've only ran into one problem so far and that's due to my apparent lack of PHP knowledge when it comes to integrating javascript. I want to change the link so it acts like modern PayPal logo buttons. I'd appreciate any and all help/advice.
Here's the code from the PayPal website that I want to use for my link:
Code:
<a href="https://www.paypal.com/webapps/mpp/paypal-popup" title="How PayPal Works" onclick="javascript:window.open('https://www.paypal.com/webapps/mpp/paypal-popup','WIPaypal','toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, width=1060, height=700'); return false;">
Here is the code from the plugin where I want to put the new link:
Code:
<!-- Begin Official PayPal Seal -->
<a target="_blank" href="https://www.paypal.com/webapps/mpp/paypal-popup">' .
zen_image(DIR_WS_TEMPLATE_IMAGES . MODULE_PAYPAL_SEAL_LOGO_IMAGE_FILENAME, MODULE_PAYPAL_SEAL_ALT_TEXT, 100, 100) .
'</a>
<!-- End Official PayPal Seal -->
I want the link to click into a popup box like it would on a normal webpage. I keep running into PHP errors when I tried coding it myself and I've broke my test shop enough times today so I'm asking for help. :) I've got everything working except the pop-up link. Thank you.
Re: Trying to Update the PayPal Verified Sidebox
Inside sideboxes, because you're sticking content into the $content variable, you need to "escape" the quotes.
Example:
for:
Code:
$content = ' your custom stuff here ';
to add stuff inside those quotes where you want to also use single-quotes (like your javascript stuff inside that paypal snippet), you need to add a \ before every single-quote you want to keep inside the outer-most single-quotes.
ie:
Code:
$content = ' when I\'ve got single quotes I\'ve gotta escape them! ';
Re: Trying to Update the PayPal Verified Sidebox
I think I understand what you mean. The code "works" in that is doesn't break the sidebox anymore but the javascript itself doesn't work to create a popup window. It just opens in a new tab. If I take out the _blank then it opens in the same window. Here's the full code:
Code:
define('MODULE_PAYPAL_SEAL_LOGO_IMAGE_FILENAME', 'paypal_secured.gif');
define('MODULE_PAYPAL_SEAL_VERIFIED_URL', 'https://www.paypal.com/webapps/mpp/paypal-popup');
$content = '';
$content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent">' . "\n";
$content .= '<div class="wrapper">' . "\n";
$content .=
'<center>
<!-- Begin Official PayPal Seal -->
<a target= " _blank " href= " ' .MODULE_PAYPAL_SEAL_VERIFIED_URL . ' " onclick= javascript:window.open(\'https://www.paypal.com/webapps/mpp/paypal-popup\',\'WIPaypal\',\'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, width=1060, height=700\');>' .
zen_image(DIR_WS_TEMPLATE_IMAGES . MODULE_PAYPAL_SEAL_LOGO_IMAGE_FILENAME, MODULE_PAYPAL_SEAL_ALT_TEXT, 150, 100) .
'</a>
<!-- End Official PayPal Seal -->
</center>';
$content .= '</div>' . "\n";
$content .= '</div>';
Re: Trying to Update the PayPal Verified Sidebox
it would help if you could provide a link to your site.
are you sure that your javascript is executing without errors? have you checked the console in the developers tools?
Re: Trying to Update the PayPal Verified Sidebox
I apologize, I thought I had posted a link to my site. I've been building this new store from scratch since late last night and trying to do too many things at once. Here is the link: http://shp.d9s.co/ The PayPal Sidebox is at the bottom of the left sidebar.
Re: Trying to Update the PayPal Verified Sidebox
first, i think you are missing the return false....
if you look at the source of the page (press ctrl-u), you can see that your quoting is off. i have attached a screenshot. you need to adjust the code to remove the quotes that are there.
i do not have the code worked our right this moment, but if you look at your original post as to what you want and what you are getting, you can see where the errors are.
good luck!
Re: Trying to Update the PayPal Verified Sidebox
I believe that you need one more file a .js file named jscript_positionedPopup.js with this as the contents
Code:
<script language="javascript">
var popupWindow = null;
function positionedPopup(url,winName,w,h,t,l,scroll){
settings =
'height='+h+',width='+w+',top='+t+',left='+l+',scrollbars='+scroll+',resizable'
popupWindow = window.open(url,winName,settings)
}
</script>
Place the file in your templates jscript folder
includes/templates/dream9shp/jscript/
and adjust your "onclick" code
Code:
onclick="positionedPopup...
Re: Trying to Update the PayPal Verified Sidebox
Quote:
Originally Posted by
kobra
I believe that you need one more file a .js file named jscript_positionedPopup.js with this as the contents
Code:
<script language="javascript">
var popupWindow = null;
function positionedPopup(url,winName,w,h,t,l,scroll){
settings =
'height='+h+',width='+w+',top='+t+',left='+l+',scrollbars='+scroll+',resizable'
popupWindow = window.open(url,winName,settings)
}
</script>
Place the file in your templates jscript folder
includes/templates/dream9shp/jscript/
and adjust your "onclick" code
Code:
onclick="positionedPopup...
I'm getting a syntax error on this line and my brain just went blank as to how to fix it:
Code:
popupWindow = window.open(url,winName,settings)
Re: Trying to Update the PayPal Verified Sidebox
Opps!!!
Try this
Code:
popupWindow = window.open(url,'name',settings)
Re: Trying to Update the PayPal Verified Sidebox
ok, here is my take... i agree with kobra in that it will seems easier with a .js file. i would use the following:
Code:
<script type="text/javascript"><!--
function popupWindow(url) {
window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,left=150')
}
//--></script>
replace my variables with whatever you want/need/ is provided at the top of your code.
then for the php part:
PHP Code:
//replace:
$content .=
'<center>
<!-- Begin Official PayPal Seal -->
<a target= " _blank " href= " ' .MODULE_PAYPAL_SEAL_VERIFIED_URL . ' " onclick= javascript:window.open(\'https://www.paypal.com/webapps/mpp/paypal-popup\',\'WIPaypal\',\'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, width=1060, height=700\');>' .
zen_image(DIR_WS_TEMPLATE_IMAGES . MODULE_PAYPAL_SEAL_LOGO_IMAGE_FILENAME, MODULE_PAYPAL_SEAL_ALT_TEXT, 150, 100) .
'</a>
<!-- End Official PayPal Seal -->
</center>';
//with:
$content .=
'<center>
<!-- Begin Official PayPal Seal -->
<a target= " _blank " href= " ' .MODULE_PAYPAL_SEAL_VERIFIED_URL . ' " onclick="popupWindow(this.href); return false">' .
zen_image(DIR_WS_TEMPLATE_IMAGES . MODULE_PAYPAL_SEAL_LOGO_IMAGE_FILENAME, MODULE_PAYPAL_SEAL_ALT_TEXT, 150, 100) .
'</a>
<!-- End Official PayPal Seal -->
</center>';
make sure the javascript code gets loaded...
hope that helps!
good luck!