First you must have a paypal account and create a button for subscribe I'm not going into detail about that here if you have any questions search google.
Now we only need a little bit of the code from the button created:
Code: Select all
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="UNIQUE_ID_FOR_SUBSCRIPTION">
Next we make some core modifications to:
catalog->view->theme->YOUR_THEME_HERE->template->payment->pp_standard.tpl
With:
Code: Select all
<form action="<?php echo $action; ?>" method="post">
<!-- BEGIN EDITS -->
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="UNIQUE_ID_FOR_SUBSCRIPTION">
<!-- END EDITS -->
<input type="hidden" name="upload" value="1" />
<!--<input type="hidden" name="business" value="<?php echo $business; ?>" /> REMOVED FOR SUBSCRIPTION-->
<?php $i = 1; ?>
<?php foreach ($products as $product) { ?>
<input type="hidden" name="item_name_<?php echo $i; ?>" value="<?php echo $product['name']; ?>" />
<input type="hidden" name="item_number_<?php echo $i; ?>" value="<?php echo $product['model']; ?>" />
<input type="hidden" name="amount_<?php echo $i; ?>" value="<?php echo $product['price']; ?>" />
<input type="hidden" name="quantity_<?php echo $i; ?>" value="<?php echo $product['quantity']; ?>" />
<input type="hidden" name="weight_<?php echo $i; ?>" value="<?php echo $product['weight']; ?>" />
<?php $j = 0; ?>
<?php foreach ($product['option'] as $option) { ?>
<input type="hidden" name="on<?php echo $j; ?>_<?php echo $i; ?>" value="<?php echo $option['name']; ?>" />
<input type="hidden" name="os<?php echo $j; ?>_<?php echo $i; ?>" value="<?php echo $option['value']; ?>" />
<?php $j++; ?>
<?php } ?>
<?php $i++; ?>
<?php } ?>
<?php if ($discount_amount_cart) { ?>
<input type="hidden" name="discount_amount_cart" value="<?php echo $discount_amount_cart; ?>" />
<?php } ?>
<!-- BEGIN EDITS -->
<?php if ($product['name'] == "Basic Membership"){echo'
<input type="hidden" name="currency_code" value="'. $currency_code.'" />
<input type="hidden" name="first_name" value="'. $first_name.'" />
<input type="hidden" name="last_name" value="'. $last_name.'" />
<input type="hidden" name="address1" value="'. $address1.'" />
<input type="hidden" name="address2" value="'. $address2.'" />
<input type="hidden" name="city" value="'. $city.'" />
<input type="hidden" name="zip" value="'. $zip.'" />
<input type="hidden" name="country" value="'. $country.'" />
<input type="hidden" name="address_override" value="0" />
<input type="hidden" name="email" value="'. $email.'" />
<input type="hidden" name="invoice" value="'. $invoice.'" />
<input type="hidden" name="lc" value="'. $lc.'" />
<input type="hidden" name="rm" value="2" />
<input type="hidden" name="no_note" value="1" />
<input type="hidden" name="charset" value="utf-8" />
<input type="hidden" name="return" value="'. $return.'" />
<input type="hidden" name="notify_url" value="'. $notify_url.'" />
<input type="hidden" name="cancel_return" value="'. $cancel_return.'" />
<input type="hidden" name="paymentaction" value="'. $paymentaction.'" />
<input type="hidden" name="custom" value="'. $custom.'" />
<div class="buttons">
<div class="right">
<input type="submit" value="'. $button_confirm.'" class="button" />
</div>
</div>
';}?>
<!-- END EDITS -->
My store requires a login to shop/checkout so I wasn't worried about creating a user based on the paypal addresses, etc. so I'm not sure if that works.
But it does create the order into the store upon return from paypal.
I should note that this is only pulling the last product in the cart and matching it to the conditional statements above. This is for demonstration mostly so you have a jumping off point. It works for me because my customers only purchase one thing at a time.
If you have any questions please post them or PM me, I'm happy to help!