<?php 
$product = new MM_Product($p->productId);
if ($product->isValid()) {
    $context = new MM_Context();
    $context->setProduct($product);
    echo MM_SmartTagUtil::processContent($product->getPurchaseConfirmationMessage(), $context);
} else {
    echo "Invalid product ID '{$p->productId}'";
}
?>
</div>
</td></tr>

<tr><td valign="bottom" class="mm-dialog-button-bar">
	<a href="javascript:pymtutils_js.placeOrderCardOnFile(<?php 
echo $p->userId;
?>
, <?php 
echo $p->productId;
?>
, 'user', '<?php 
echo $p->isGift;
?>
');" class="mm-button orange">Confirm</a>
	<a href="<?php 
echo MM_CorePageEngine::getCheckoutPageStaticLink($p->productId);
?>
" class="mm-button">Use Different Card</a>
	<a href="javascript:pymtutils_js.closeDialog(mm_pymtdialog);" class="mm-button">Cancel</a>
</td></tr>
</table>
function generatePurchaseSection($productId)
{
    ?>
	<div id="mm-purchaselinks-<?php 
    echo $productId;
    ?>
" style="display:none;">
	<p><strong>Purchase Link SmartTag</strong><?php 
    echo MM_Utils::getInfoIcon("You can use this Purchase Link SmartTag in any post or page on your site. When using this SmartTag MemberMouse will automatically generate a link customers can click on to purchase this bundle.");
    ?>
</p>
	
	<?php 
    $smartTag = "<a href=\"[MM_Purchase_Link productId='{$productId}']\">Buy Now</a>";
    ?>
	<input id="mm-smart-tag-<?php 
    echo $productId;
    ?>
" type="text" readonly value="<?php 
    echo htmlentities($smartTag);
    ?>
" style="width:440px; font-family:courier; font-size:11px;" onclick="jQuery('#mm-smart-tag-<?php 
    echo $productId;
    ?>
').focus(); jQuery('#mm-smart-tag-<?php 
    echo $productId;
    ?>
').select();" />
	
	<ul style="margin-left:20px;">
	<li>Set the <code>isGift</code> attribute to <code>true</code> to indicate that this purchase is a gift.</li>
	</ul>
	
	<p style="margin-left:20px;">
	Read this article to 
		<a href="https://membermouse.uservoice.com/knowledgebase/articles/319170-mm-purchase-link-smarttag" target="_blank">learn more about the <code>MM_Purchase_Link</code> SmartTag</a>.
	</p>
	
	<p><strong>Static Link</strong><?php 
    echo MM_Utils::getInfoIcon("You can use this link anywhere -- in a PPC or banner ad, email, on your site, on a 3rd party site, etc. Customers can click on this link to purchase this bundle.");
    ?>
</p>
	
	<input id="mm-static-link-<?php 
    echo $productId;
    ?>
" type="text" readonly value="<?php 
    echo htmlentities(MM_CorePageEngine::getCheckoutPageStaticLink($productId));
    ?>
" style="width:440px; font-family:courier; font-size:11px;" onclick="jQuery('#mm-static-link-<?php 
    echo $productId;
    ?>
').focus(); jQuery('#mm-static-link-<?php 
    echo $productId;
    ?>
').select();" />
	
	<?php 
    $affiliateId = MM_OptionUtils::getOption(MM_OptionUtils::$OPTION_KEY_AFFILIATE);
    $subAffiliateId = MM_OptionUtils::getOption(MM_OptionUtils::$OPTION_KEY_SUB_AFFILIATE);
    ?>
	<p><strong>Add Affiliate Tracking</strong></p>
	<p>To add affiliate tracking to the above purchase links you simply need to append affiliate tracking parameters to the URL as follows:</p>
	<p><em>Purchase Link SmartTag</em>: <br/><code>&lt;a href="[MM_Purchase_Link productId='#']<strong>&<?php 
    echo $affiliateId;
    ?>
=###&<?php 
    echo $subAffiliateId;
    ?>
=###</strong>"&gt;Buy Now&lt;/a&gt;</code></p>
	<p><em>Static Link</em>: <br/><code>http://yourdomain.com/checkout/?rid=p4K7d<strong>&<?php 
    echo $affiliateId;
    ?>
=###&<?php 
    echo $subAffiliateId;
    ?>
=###</strong></code></p>
	<p>Where all <code>#</code>'s would be replaced with the appropriate values. Read this article to <a href="http://membermouse.uservoice.com/knowledgebase/articles/319248-create-an-affiliate-link" target="_blank">learn more about creating an affiliate link</a>.</p>
	</div>
<?php 
}