Page 1 of 2 12 LastLast
Results 1 to 10 of 15
  1. #1
    Join Date
    Sep 2012
    Location
    Illinois
    Posts
    24
    Plugin Contributions
    0

    Default 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.

  2. #2
    Join Date
    Jan 2004
    Posts
    65,399
    Blog Entries
    7
    Plugin Contributions
    232

    Default 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! ';
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Sep 2012
    Location
    Illinois
    Posts
    24
    Plugin Contributions
    0

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

  4. #4
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    1,587
    Plugin Contributions
    5

    Default 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?
    practice #socialdistancing #staysafe
    email is hard....
    help out with the green....

  5. #5
    Join Date
    Sep 2012
    Location
    Illinois
    Posts
    24
    Plugin Contributions
    0

    Default 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.

  6. #6
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    1,587
    Plugin Contributions
    5

    Default 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!
    practice #socialdistancing #staysafe
    email is hard....
    help out with the green....

  7. #7
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,825
    Plugin Contributions
    9

    Default 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...
    Last edited by kobra; 15 Apr 2016 at 12:17 AM.
    Zen-Venom Get Bitten

  8. #8
    Join Date
    Sep 2012
    Location
    Illinois
    Posts
    24
    Plugin Contributions
    0

    Default Re: Trying to Update the PayPal Verified Sidebox

    Quote Originally Posted by kobra View Post
    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)

  9. #9
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,825
    Plugin Contributions
    9

    Default Re: Trying to Update the PayPal Verified Sidebox

    Opps!!!

    Try this
    Code:
    popupWindow = window.open(url,'name',settings)
    Zen-Venom Get Bitten

  10. #10
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    1,587
    Plugin Contributions
    5

    Default 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_FILENAMEMODULE_PAYPAL_SEAL_ALT_TEXT150100) .
    '</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_FILENAMEMODULE_PAYPAL_SEAL_ALT_TEXT150100) .
        
    '</a>
    <!-- End Official PayPal Seal -->
    </center>'

    make sure the javascript code gets loaded...

    hope that helps!

    good luck!
    practice #socialdistancing #staysafe
    email is hard....
    help out with the green....

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. paypal verified sidebox
    By moesoap in forum Addon Sideboxes
    Replies: 0
    Last Post: 6 Nov 2010, 04:35 PM
  2. sidebox html - add image/link to paypal verified sidebox
    By wasana in forum General Questions
    Replies: 0
    Last Post: 14 Jul 2006, 04:00 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR