motrellik Posted October 27, 2009 Share Posted October 27, 2009 Hi Guys, I have a Joomla / Mosets Tree / PayPal IPN problem that needs to be solved; I plan on integrating a free script called Digisell http://www.ngcoders.com/php/selling-digital-goods-with-paypal-ipn-and-php (Please feel free to check it out, it is actually a great stand-alone script.) with Mosets Tree (which is a component for the CMS Joomla). Here is the sub_listingDetails.tpl.php page where I want to insert the PayPal Buy button with the hidden links: <?php /* $cust_1 = $this->fields->getFieldByCaption('Custom Text'); // getFieldByCaption() allow you to get the field by the Caption. This is not the best way to get a field since changing the caption in the back-end will break the reference. echo '<br />Field ID: ' . $cust_1->getId(); $cust_2 = $this->fields->getFieldById(29); // getFieldById() is the ideal way of getting a field. The ID can be found at 'Custom Fields' section in Mosets Tree's back-end. echo '<br />Name: ' . $cust_2->getName(); echo '<br />Has Caption? ' . (($cust_2->hasCaption()) ? 'Yes' : 'No'); echo '<br />Caption: ' . $cust_1->getCaption(); echo '<br />Value: ' . $cust_2->getValue(); echo '<br />Output: ' . $cust_2->getOutput(1); echo '<hr />'; $this->fields->resetPointer(); while( $this->fields->hasNext() ) { $field = $this->fields->getField(); echo '<br /><strong>' . $field->getCaption() . '</strong>'; echo ': '; echo $field->getOutput(1); // getOutput() returns the formatted value of the field. ie: For a youtube video, the youtube player will be loaded // echo $field->getValue(); // getValue() returns the raw value without additional formatting. ie: When getting value from a Online Video field type, it will return the URL. $this->fields->next(); } */ ?> <div id="listing"> <h2><?php $link_name = $this->fields->getFieldById(1); $this->plugin( 'ahreflisting', $this->link, $link_name->getOutput(1), '', array("delete"=>true) ) ?></h2> <?php if ( !empty($this->mambotAfterDisplayTitle) ) { echo trim( implode( "\n", $this->mambotAfterDisplayTitle ) ); } // Address $address = ''; if( $this->config->getTemParam('displayAddressInOneRow','1') ) { $this->fields->resetPointer(); $address_parts = array(); $address_displayed = false; while( $this->fields->hasNext() ) { $field = $this->fields->getField(); $output = $field->getOutput(1); if(in_array($field->getId(),array(4,5,6,7,) && !empty($output)) { $address_parts[] = $output; } $this->fields->next(); } if( count($address_parts) > 0 ) { $address = implode(', ',$address_parts); } } // Other custom fields echo '<div class="fields">'; $this->fields->resetPointer(); while( $this->fields->hasNext() ) { $field = $this->fields->getField(); $value = $field->getValue(); if( ( (!$field->hasInputField() && !$field->isCore() && empty($value)) || (!empty($value) || $value == '0') ) && // This condition ensure that fields listed in array() are skipped !in_array($field->getName(),array('link_name','link_desc') ) || // Fields in array() are always displayed regardless of its value. in_array($field->getName(),array('link_featured')) ) { echo '<div class="row">'; if($this->config->getTemParam('displayAddressInOneRow','1') && in_array($field->getId(),array(4,5,6,7,) && $address_field = $this->fields->getFieldById(4)) { if( $address_displayed == false ) { echo '<div class="caption">'; if($address_field->hasCaption()) { echo $address_field->getCaption(); } echo '</div>'; echo '<div class="data">'; echo $address_field->getDisplayPrefixText(); echo $address; echo $address_field->getDisplaySuffixText(); echo '</div>'; $address_displayed = true; } } else { echo '<div class="caption">'; if($field->hasCaption()) { echo $field->getCaption(); } echo '</div>'; echo '<div class="data">'; echo $field->getDisplayPrefixText(); echo $field->getOutput(1); echo $field->getDisplaySuffixText(); echo '</div>'; } echo '</div>'; } $this->fields->next(); } echo '</div>'; if( $this->show_actions_rating_fav ) { ?> <div class="actions-rating-fav"> <?php if( $this->show_actions ) { ?> <div class="actions" style="text-align:center<?php echo ($this->show_actions_rating_fav==1)?';border:0':''; ?>"><?php $this->plugin( 'ahrefreview', $this->link, array("rel"=>"nofollow") ); $this->plugin( 'ahrefrecommend', $this->link, array("rel"=>"nofollow") ); $this->plugin( 'ahrefprint', $this->link ); $this->plugin( 'ahrefcontact', $this->link, array("rel"=>"nofollow") ); $this->plugin( 'ahrefvisit', $this->link ); $this->plugin( 'ahrefreport', $this->link, array("rel"=>"nofollow") ); $this->plugin( 'ahrefclaim', $this->link, array("rel"=>"nofollow") ); $this->plugin( 'ahrefownerlisting', $this->link ); $this->plugin( 'ahrefmap', $this->link ); ?></div><?php } if($this->config->get('show_rating')) { echo '<div class="rating">'; $this->plugin( 'ratableRating', $this->link, $this->link->link_rating, $this->link->link_votes); echo '<div id="total-votes">'; if( $this->link->link_votes <= 1 ) { echo $this->link->link_votes . " " . strtolower(JText::_( 'Vote' )); } elseif ($this->link->link_votes > 1 ) { echo $this->link->link_votes . " " . strtolower(JText::_( 'Votes' )); } echo '</div>'; echo '</div>'; } if($this->config->get('show_favourite')) { ?> <div class="favourite"> <span class="fav-caption"><?php echo JText::_( 'Favoured' ) ?>:</span> <div id="fav-count"><?php echo number_format($this->total_favourites,0,'.',',') ?></div><?php if($this->my->id > 0){ if($this->is_user_favourite) { ?><div id="fav-msg"><a href="javascript&colonfav(<?php echo $this->link->link_id ?>,-1);"><?php echo JText::_( 'Remove favourite' ) ?></a></div><?php } else { ?><div id="fav-msg"><a href="javascript&colonfav(<?php echo $this->link->link_id ?>,1);"><?php echo JText::_( 'Add as favourite' ) ?></a></div><?php } } ?> </div><?php } ?></div><?php } if ( !empty($this->mambotBeforeDisplayContent) && $this->mambotBeforeDisplayContent[0] <> '' ) { echo trim( implode( "\n", $this->mambotBeforeDisplayContent ) ); } echo '<div class="listing-desc">'; $images = $this->images; if ($this->config->getTemParam('skipFirstImage','0') == 1) { array_shift($images); } if (!empty($images) && $this->config->getTemParam('listingDetailsImagesOutputMode','1') == 3) { echo '<div class="thumbnail' . (($this->config->getTemParam('imageDirectionListingSummary','right')=='right') ? '':'-left') . '">'; echo '<a href="' . JRoute::_('index.php?option=com_mtree&task=viewimage&img_id=' . $this->link->img_id . '&Itemid=' . $this->Itemid) . '">'; $this->plugin( 'mt_image', $images[0]->filename, '3', $this->link->link_name ); echo '</a>'; if( $this->total_images > 1 ) { echo '<div style="width:' . ($this->config->get('resize_listing_size') + 10) . 'px"><a href="' . JRoute::_('index.php?option=com_mtree&task=viewgallery&link_id=' . $this->link->link_id . '&Itemid=' . $this->Itemid) . '">' . JText::_( 'View gallery' ) . '</a></div>'; } echo '</div>'; } if(!is_null($this->fields->getFieldById(2))) { $link_desc = $this->fields->getFieldById(2); echo $link_desc->getOutput(1); } echo '</div>'; if ( !empty($this->mambotAfterDisplayContent) ) { echo trim( implode( "\n", $this->mambotAfterDisplayContent ) ); } ?> </div> Here is the html PayPal Code I wish to include in the php file: <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_xclick"> <input type="hidden" name="business" value="[email protected]"> <input type="hidden" name="item_name" value="LINK_NAME?"> <input type="hidden" name="item_number" value="2"> <input type="hidden" name="amount" value=" "> <input type="hidden" name="no_shipping" value="0"> <input type="hidden" name="no_note" value="1"> <input type="hidden" name="currency_code" value="USD"> <input type="hidden" name="lc" value="US"> <input type="hidden" name="rm" value="2"> <input type="hidden" name="return" value="http://www.mysite.com/"> <input type="hidden" name="cancel_return" value="http://www.mysite.com/"> <input type="hidden" name="notify_url" value="http://www.mysite.com//paypal.php"> <input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but23.gif" border="0" name="submit" alt="Make payments with PayPal - it s fast, free and secure!"> <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1"> </form> And here is the Settings.php file which configures the commands within the script: <?php // URL of directory where script is stored ( include trailing slash ) $script_location = 'http://www.mybuisness.com/paypal/'; //URL of page from where script is called $script_page = 'http://www.mybuisness.com/'; //URL of page Thank you page ( once payment is made , payee is sent to this page ) $script_thankyou = 'http://www.mybuisness.com/thankyou.html'; // Please change thing to anything random $secret = 'DFJ#*#$NSD)Oc32j908u43jhh893'; // Various Emails $paypal_email = '[email protected]'; // Paypal Email $notify_email ='[email protected]'; // Email which will recive notification $download_email = 'My Buisness <[email protected]>'; // Email from which the mail wil be sent $currency = 'USD'; // How long will download link remain valid $download_life = '24'; // Send File as attachment $email_attachment = true; // Success Email Messages $email_subject = "Thank you for buying {product_name}"; $email_body = "Hello {first_name} {last_name}". "\n\nThank you for buying {product_name}. Here is you download link - ". "\n{product_link}". "\nThis link will remain valid for $download_life hours.". "\n\nRegards". "\nYour Signature"; // Notification Email Message $notify_subject = "Product Sale Notification for {product_name}"; $notify_body = "Hello Sir". "\n\nThis mail is to notify you about the sale of {product_name} whos product id is {product_id}.". "\nThe sale was made to {first_name} {last_name} ({payer_email}) at ".date('r',$time); "\n\nRegards". "\nYour Signature"; // product[number] = array('Name' ,'Price' , 'Download Link'); $products[2] = array('My Script','32.00','downloads/myscript.zip'); /** * No need to modify these unless you know what ur doing */ $debug = false; // Enable if you want debug log $debug_log = "digisell_debug.log"; $sandbox = false; // Enable sandbox testing // Simple PHP Mail $email_config['protocol'] = 'mail'; ?> I understand this a big ask but I really would appreciate any help with this. (Sorry about the post, it's is a mess! ) Thanks in advanced, Tom. Link to comment https://forums.phpfreaks.com/topic/179158-for-the-experts/ Share on other sites More sharing options...
trq Posted October 27, 2009 Share Posted October 27, 2009 Have you got an actual question? Link to comment https://forums.phpfreaks.com/topic/179158-for-the-experts/#findComment-945221 Share on other sites More sharing options...
motrellik Posted October 27, 2009 Author Share Posted October 27, 2009 Sorry, I would like some help integrating it. Link to comment https://forums.phpfreaks.com/topic/179158-for-the-experts/#findComment-945227 Share on other sites More sharing options...
trq Posted October 27, 2009 Share Posted October 27, 2009 And where exactly are you stuck? Were not here to write code for people. Link to comment https://forums.phpfreaks.com/topic/179158-for-the-experts/#findComment-945228 Share on other sites More sharing options...
motrellik Posted October 27, 2009 Author Share Posted October 27, 2009 The sub_listingDetails.tpl.php is a page that displays all the Mosets Tree listings and their custom fields. I attempted to use the following code for the paypal button code, specifically the item name field: <?php print $link_name->getValue() ?> When the PayPal link loaded after clicking the buy now button it took me to the intended test site sandbox.paypal.com. The item name was shown at the top, which was normal, after proceeding to the buy page and 'paying' for the item an email is sent to the PayPal address in the script which shows the download link and a message. The item name, however, in the email just says something like 'object1' or displays the actual php code. Before I can include the other fields in the email I need to start with the name. I hope I have explained this well, it is complicated for me. I have tried the Paypal forum, Mosets Tree forum, but I love solving problems and couldn't wait to solve this one. Link to comment https://forums.phpfreaks.com/topic/179158-for-the-experts/#findComment-945236 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.