Post by KollanH » Fri Dec 07, 2012 5:28 pm

There is a nice little work around for this kind of stuff if anyone is interested.

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">
  
From there we just need to setup our restrictions this may be a lot if you have a ton of products you need to have subscriptions but you can work around it with some additional modifications and have the controller send the item id to the view so you can filter based on item id (I have not done that here since I only needed three items to have subscriptions).

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 -->
Now some of this isn't nearly as neat as some other options out there but it does utilize the current standard paypal to setup recurring payments based on your filter.

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!

Donate | Confirm Email when registering or during guest checkout | Print Order Information


New member

Posts

Joined
Fri Dec 07, 2012 6:19 am

Post by tonytoan » Mon May 20, 2013 10:45 am

im not using it because i dont know how it look if you have image i would love to see, however i do want to thank you on behalf of everyone here who trying to save a dollar with jobless and hardtime, its nice to have people willing to offer free support

New member

Posts

Joined
Thu May 05, 2011 8:27 am
Who is online

Users browsing this forum: No registered users and 1 guest