11
JMorris
Re: Felix, theCat!!! Re: paypal button How?
  • 2004/11/21 0:17

  • JMorris

  • XOOPS is my life!

  • Posts: 2722

  • Since: 2004/4/11


Ok, I've come up with a really good start on this one. Here's the code for the PayPal button:

echo "https://www.paypal.com/cgi-bin/webscr" method="post" />";
echo "hidden" name="cmd" value="_xclick" />";
echo 
"hidden" name="business" value=".$ads->getVar('email')," />";
echo 
"hidden" name="item_name" value=".$ads->getVar('ads_title')," />";
echo 
"hidden" name="amount" value=".$ads->getVar('price')," />";
echo 
"hidden" name="no_note" value="1" />";
echo 
"hidden" name="currency_code" value="USD" />";
echo 
"image" src="https://www.paypal.com/en_US/i/btn/x-click-butcc.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!" />";
echo "";


The Ad Title, Ad Price, and the e-mail Account of the Ad Poster dynamically updates based on which ad your visitors are viewing. So your Advertisers MUST use their PayPal when posting an Ad.

Ok, here's the down side. 1) I'm having a heck of time getting it to position correctly. 2) Only the first word of the Ad Title is sent to Paypal. 3) Only USD is currently supported.

This little hack is actually going to be quite useful for me as well, so I'm going to keep working on this as often I can.

I'll keep you updated.

12
JMorris
Re: Felix, theCat!!! Re: paypal button How?
  • 2004/11/21 2:06

  • JMorris

  • XOOPS is my life!

  • Posts: 2722

  • Since: 2004/4/11


OK, I believe this will do the trick. The following assumes you know how to work with templates. If you don't know how to work with templates, go to http://www.macambridge.com/dummies/ and read up on it.

Create a cloned template set, set it as default, and set "Update module template..." to yes.
Click on List next to Small ads in the template manager
Click edit for catads_item.html
Copy and paste the following code into the edit box:

<{if not $ad_exists and not $preview}>
    <{$smarty.const._MD_CATADS_NO_ADS}>
<{else}>
    
       
      
      <{if $annonce.date_pub == 0}>
          <{$smarty.const._MD_CATADS_ADSWAIT}>
      <{elseif $annonce.date_exp == 0}>
          <{$smarty.const._MD_CATADS_ADSEXP}>
      <{else}>
          <{$annonce.date_pub}>
     <{/if}>
     
 
     
      <{$annonce.codpost}> <{$annonce.town}>
    
  
   
     
      <{if $annonce.date_exp > 0 and $annonce.date_pub > 0}>
          <{$smarty.const._MD_CATADS_DATE_EXP}><{$annonce.date_exp}>
     <{/if}>
      
     
      <{$annonce.type}><{$annonce.title}>
    
  
   
     
      (<{$annonce.nbview}>)
       
     
      <{if $annonce.price}>
          <{$smarty.const._MD_CATADS_PRICE2}> <{$annonce.price}> <{$annonce.monnaie}>
      <{if $annonce.price_option}>
           (<{$annonce.price_option}>) 
      <{/if}>
      <{/if}>
    
  
   
     
    <{if $annonce.suspend > 0}>
        
<{$smarty.const._MD_CATADS_PUB_SUSP}>
     <{else}>
        <{$smarty.const._MD_CATADS_CONTACT}>


          <{$annonce.maillink}>
          

          <{$annonce.pmlink}>
          


          <{$smarty.const._MD_CATADS_PHONE}>  

          <{$annonce.phone}>
          
    
 
      <{/if}>



" />
" />
" />


s fast
free and secure!" />


      
    odd">left"> 
         
        <
{$annonce.description}>
        

        

        <
{$annonce.photo}>
        

        

      

      
    <{if not $preview}>
       
    left" class="foot"> 
        print.php?op=showone&ads_id=<{$annonce.id}>">images/print.gif" border=0 alt="<{$smarty.const._MD_CATADS_PRINT}>">  
      
      <{if 
$xoops_isadmin and $annonce.date_pub == 0}>
      admin/index.php?op=approve&ads_id=<{$annonce.id}>">images/valid.gif" border=0 alt="<{$smarty.const._MD_CATADS_VALIDADS}>">  
        <{/if}>
        
        <{if 
$xoops_isadmin}>
        admin/index.php?op=edit&ads_id=<{$annonce.id}>">images/modif.gif" border=0 alt="<{$smarty.const._MD_CATADS_EDITADS}>">  
        admin/index.php?op=delete&ads_id=<{$annonce.id}>">images/delete.gif" border=0 alt="<{$smarty.const._MD_CATADS_DELETEADS}>">  
        adsuserlist.php?uid=<{$annonce.uid}>">images/who.gif" border=0 alt="<{$smarty.const._MD_CATADS_ALLADS}><{$annonce.submitter}>">  
        images/ip.gif" border=0 alt="<{$annonce.poster_ip}>">  
        <{/if}>
           
    right" class="foot">left"> 
      <{if 
$annonce.isauthor}>
          <{if 
$annonce.date_exp == 0 and $annonce.countpub > 0 and $annonce.date_pub > 0}>
              adsitem.php?op=pubagain&ads_id=<{$annonce.id}>"><{$smarty.const._MD_CATADS_PUB_AGAIN}>
         <{elseif 
$annonce.date_pub > 0 and $annonce.date_exp > 0}>
              <{if 
$annonce.suspend > 0}>
                  adsitem.php?op=stopandgo&ads_id=<{$annonce.id}>"><{$smarty.const._MD_CATADS_PUB_GO}>
             <{else}>
                  adsitem.php?op=stopandgo&ads_id=<{$annonce.id}>"><{$smarty.const._MD_CATADS_PUB_STOP}>
             <{/if}>
         <{/if}>
     <{/if}>
    

      
    <{/if}>
<{/if}>





<{if not $preview}>
    center">[ <{$link_main}> | <{$link_cat}> ]


    text-aligncenterpadding3px;
    
margin:3px;">
    <
{$commentsnav}>
    <
{$lang_notice}>
    


    margin:3pxpadding3px;">
    
    <{if 
$comment_mode == "flat"}>
        <{include file="
db:system_comments_flat.html"}>
    <{elseif 
$comment_mode == "thread"}>
        <{include file="
db:system_comments_thread.html"}>
    <{elseif 
$comment_mode == "nest"}>
        <{include file="
db:system_comments_nest.html"}>
    <{/if}>
<{/if}>

Click submit
Test
Set "Update module template..." to No

Sorry to give such a rushed tutorial. The button works quite nicely, albeit with the few limitations I mentioned in my last post.

I hope this meets your needs.

Best Regards,

JMorris

13
joeiscoffee
Re: Felix, theCat!!! Re: paypal button How?

JMoris,

This looks great! I just got in and will probably install this tomorrow.

Thanks again,

I'll keep you updated as to my progress.

14
joeiscoffee
Re: Felix, theCat!!! Re: paypal button How?

JMorris,

I am not getting the user's email to pass to paypal. The variable is empty. It looks like this in the html source.
<input type="hidden" name="business" value="" />


Did I do something wrong with the template cloning?

I did not see this option mentioned in your instructions when doing the template.
Quote:
Set "Update module template..." to No



Great progress you have made on this module.

15
JMorris
Re: Felix, theCat!!! Re: paypal button How?
  • 2004/11/21 7:05

  • JMorris

  • XOOPS is my life!

  • Posts: 2722

  • Since: 2004/4/11


Sorry about that. I forgot to mention that you have to define email. Open adsitem.php with a text/php editor and look for the following line:
$annonce['codpost'] = $ads->getVar('codpost');

Directly bellow that line add the following line:
$annonce['email'] = $ads->getVar('email');

Save and re-upload.
That will define the poster's email address in the PayPal form.

RE: Templates...
System Admin > Preferences > General Settings > Set "Update module template .html files from themes/your theme/templates directory?" to "Yes" before changing templates. After you change your templates, clear the contents of the templates_c folder on the web server. Then, just set "Update module template .html files from themes/your theme/templates directory?" to "No".

Sorry, my instructions are not that great.

Hope this helps.

16
joeiscoffee
Re: Felix, theCat!!! Re: paypal button How?

Works like a champ!

Thanks JMorris. And you too theCat.

Login

Who's Online

234 user(s) are online (110 user(s) are browsing Support Forums)


Members: 0


Guests: 234


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits