SFC_Autoship - Version 1.3.2.11

Version Notes

Subscribe Pro Extension Release

Download this release

Release Info

Developer StoreFront Consulting
Extension SFC_Autoship
Version 1.3.2.11
Comparing to
See all releases


Code changes from version 1.3.2.10 to 1.3.2.11

Files changed (43) hide show
  1. app/code/local/SFC/Autoship/Block/Adminhtml/System/Config/Form/Fielddisabled.php +1 -1
  2. app/code/local/SFC/Autoship/Block/Checkout/Onepage/Payment/Methods.php +24 -31
  3. app/code/local/SFC/Autoship/Block/Newsubscription.php +0 -31
  4. app/code/local/SFC/Autoship/Block/Newsubscription/Form/Billing.php +0 -36
  5. app/code/local/SFC/Autoship/Block/Newsubscription/Form/Shipping.php +0 -35
  6. app/code/local/SFC/Autoship/Helper/Payment.php +23 -15
  7. app/code/local/SFC/Autoship/Helper/Platform.php +0 -1
  8. app/code/local/SFC/Autoship/Helper/Quote.php +0 -19
  9. app/code/local/SFC/Autoship/Model/Checkout/Cart/Product/Api.php +3 -0
  10. app/code/local/SFC/Autoship/Model/Enterprise/GiftCardAccount/Observer.php +63 -0
  11. app/code/local/SFC/Autoship/Model/Enterprise/Reward/Observer.php +77 -0
  12. app/code/local/SFC/Autoship/Model/Observer.php +0 -20
  13. app/code/local/SFC/Autoship/Model/Payment/Method.php +6 -0
  14. app/code/local/SFC/Autoship/Model/Quote/Address.php +1 -9
  15. app/code/local/SFC/Autoship/Model/SalesRule/Rule/Condition/Product.php +104 -54
  16. app/code/local/SFC/Autoship/Model/SalesRule/Validator.php +1 -8
  17. app/code/local/SFC/Autoship/Model/Shipping/Carrier.php +14 -1
  18. app/code/local/SFC/Autoship/controllers/MysubscriptionsController.php +0 -1
  19. app/code/local/SFC/Autoship/controllers/NewsubscriptionController.php +112 -452
  20. app/code/local/SFC/Autoship/etc/config.xml +16 -5
  21. app/code/local/SFC/Autoship/etc/system.xml +16 -34
  22. app/code/local/SFC/Autoship/sql/sfc_autoship_setup/{mysql4-install-1.3.2.10.php → mysql4-install-1.3.2.11.php} +5 -0
  23. app/code/local/SFC/Autoship/{Block/Newsubscription/Form/Payment.php → sql/sfc_autoship_setup/mysql4-upgrade-1.3.2.10-1.3.2.11.php} +17 -16
  24. app/design/frontend/base/default/layout/autoship.xml +1 -46
  25. app/design/frontend/base/default/template/autoship/cart/product/subscription.phtml +0 -2
  26. app/design/frontend/base/default/template/autoship/checkout/success.phtml +0 -2
  27. app/design/frontend/base/default/template/autoship/newsubscription.phtml +18 -18
  28. app/design/frontend/base/default/template/autoship/newsubscription/ajax_update.phtml +0 -11
  29. app/design/frontend/base/default/template/autoship/newsubscription/billing_address.phtml +0 -51
  30. app/design/frontend/base/default/template/autoship/newsubscription/delivery_date.phtml +3 -6
  31. app/design/frontend/base/default/template/autoship/newsubscription/delivery_frequency.phtml +23 -14
  32. app/design/frontend/base/default/template/autoship/newsubscription/payment.phtml +0 -80
  33. app/design/frontend/base/default/template/autoship/newsubscription/product_info.phtml +4 -3
  34. app/design/frontend/base/default/template/autoship/newsubscription/shipping_address.phtml +0 -51
  35. app/design/frontend/base/default/template/autoship/newsubscription/summary.phtml +0 -69
  36. app/design/frontend/base/default/template/autoship/product/subscribe.phtml +0 -26
  37. app/design/frontend/base/default/template/autoship/product/view/addtocart.phtml +0 -18
  38. app/design/frontend/base/default/template/autoship/product/view/type/grouped/subscribe.phtml +35 -37
  39. app/design/frontend/enterprise/default/layout/autoship.xml +8 -39
  40. app/design/frontend/{base → enterprise}/default/template/autoship/giftcardaccount/onepage/payment/scripts.phtml +0 -0
  41. package.xml +4 -4
  42. skin/frontend/base/default/css/autoship.css +6 -89
  43. skin/frontend/base/default/js/autoship/newsubscription.js +5 -110
app/code/local/SFC/Autoship/Block/Adminhtml/System/Config/Form/Fielddisabled.php CHANGED
@@ -27,7 +27,7 @@ class SFC_Autoship_Block_Adminhtml_System_Config_Form_Fielddisabled
27
  extends Mage_Adminhtml_Block_System_Config_Form_Field
28
  {
29
 
30
- protected function _getElementHtml($element)
31
  {
32
  $element->setDisabled('disabled');
33
 
27
  extends Mage_Adminhtml_Block_System_Config_Form_Field
28
  {
29
 
30
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
31
  {
32
  $element->setDisabled('disabled');
33
 
app/code/local/SFC/Autoship/Block/Checkout/Onepage/Payment/Methods.php CHANGED
@@ -51,43 +51,36 @@ class SFC_Autoship_Block_Checkout_Onepage_Payment_Methods extends SFC_Autoship_B
51
  }
52
 
53
  /** @var Mage_Payment_Model_Method_Abstract $method*/
54
- // Check if New Subscription page is enabled, or if we should create subscriptions in checkout
55
- if(Mage::getStoreConfig('autoship_subscription/subscription/use_new_subscription_page', $quote->getStore()) == '1') {
 
 
 
 
 
 
 
56
  return parent::_canUseMethod($method);
57
  }
58
  else {
59
- // We should create subs during checkout, and we are checking a payment method other than Authorize.Net CIM
60
- // If other payment method being used, only allow this when there are no subscriptions to create
61
- // Get quote helper
62
- /** @var SFC_Autoship_Helper_Quote $quoteHelper */
63
- $quoteHelper = Mage::helper('autoship/quote');
64
- // Check if quote has any subscriptions in it
65
- if(!$quoteHelper->hasProductsToCreateNewSubscription()) {
66
- // Quote has no subscriptions,
67
- // Go through normal qualification process for payment methods
 
 
 
 
68
  return parent::_canUseMethod($method);
69
  }
70
  else {
71
- // Quote has subscriptions, only allow payment methods compatible with subscriptions
72
- // Get helper
73
- /** @var SFC_Autoship_Helper_Platform $platformHelper */
74
- $platformHelper = Mage::helper('autoship/platform');
75
- /** @var SFC_Autoship_Helper_Api $apiHelper */
76
- $apiHelper = Mage::helper('autoship/api');
77
- $apiHelper->setConfigStore($quote->getStore());
78
- // Lookup payment method code based on SP config
79
- $configuredMethodCode = $platformHelper->getConfiguredPaymentMethodCode();
80
- // Check for configured payment method code
81
- if(0 === strpos($method->getCode(), $configuredMethodCode)) {
82
- // This is the pay method which is allowed by Subscribe Pro config
83
- // Run normal check
84
- return parent::_canUseMethod($method);
85
- }
86
- else {
87
- // This is some other payment method, not allowed when checking out and creating subscriptions
88
- return false;
89
- }
90
-
91
  }
92
  }
93
  }
51
  }
52
 
53
  /** @var Mage_Payment_Model_Method_Abstract $method*/
54
+ // We should create subs during checkout, and we are checking a payment method other than Authorize.Net CIM
55
+ // If other payment method being used, only allow this when there are no subscriptions to create
56
+ // Get quote helper
57
+ /** @var SFC_Autoship_Helper_Quote $quoteHelper */
58
+ $quoteHelper = Mage::helper('autoship/quote');
59
+ // Check if quote has any subscriptions in it
60
+ if(!$quoteHelper->hasProductsToCreateNewSubscription()) {
61
+ // Quote has no subscriptions,
62
+ // Go through normal qualification process for payment methods
63
  return parent::_canUseMethod($method);
64
  }
65
  else {
66
+ // Quote has subscriptions, only allow payment methods compatible with subscriptions
67
+ // Get helper
68
+ /** @var SFC_Autoship_Helper_Platform $platformHelper */
69
+ $platformHelper = Mage::helper('autoship/platform');
70
+ /** @var SFC_Autoship_Helper_Api $apiHelper */
71
+ $apiHelper = Mage::helper('autoship/api');
72
+ $apiHelper->setConfigStore($quote->getStore());
73
+ // Lookup payment method code based on SP config
74
+ $configuredMethodCode = $platformHelper->getConfiguredPaymentMethodCode();
75
+ // Check for configured payment method code
76
+ if(0 === strpos($method->getCode(), $configuredMethodCode)) {
77
+ // This is the pay method which is allowed by Subscribe Pro config
78
+ // Run normal check
79
  return parent::_canUseMethod($method);
80
  }
81
  else {
82
+ // This is some other payment method, not allowed when checking out and creating subscriptions
83
+ return false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84
  }
85
  }
86
  }
app/code/local/SFC/Autoship/Block/Newsubscription.php CHANGED
@@ -17,39 +17,8 @@
17
 
18
  class SFC_Autoship_Block_Newsubscription extends SFC_Autoship_Block_Subscription_Abstract
19
  {
20
-
21
- public function _prepareLayout()
22
- {
23
- // Set subscription on block
24
- $this->setSubscription(Mage::getSingleton('customer/session')->getNewSubscription());
25
-
26
- // Call parent
27
- parent::_prepareLayout();
28
- }
29
-
30
- public function getSummary()
31
- {
32
- try {
33
- $summary = Mage::helper('autoship/subscription')->estimateSubscriptionOrderTotals(
34
- Mage::getSingleton('customer/session')->getCustomer(),
35
- $this->getSubscription(),
36
- $this->getPlatformProduct(),
37
- $this->getProduct());
38
-
39
- // Return summary data
40
- return $summary;
41
- }
42
- catch (Exception $e) {
43
- SFC_Autoship::log('Error calculating estimated order summary: ' . $e->getMessage(), Zend_Log::ERR);
44
- SFC_Autoship::logException($e);
45
-
46
- return 'Error estimating tax and shipping!';
47
- }
48
- }
49
-
50
  public function getPostActionUrl()
51
  {
52
  return $this->getUrl('autoship/newsubscription/createpost');
53
  }
54
-
55
  }
17
 
18
  class SFC_Autoship_Block_Newsubscription extends SFC_Autoship_Block_Subscription_Abstract
19
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  public function getPostActionUrl()
21
  {
22
  return $this->getUrl('autoship/newsubscription/createpost');
23
  }
 
24
  }
app/code/local/SFC/Autoship/Block/Newsubscription/Form/Billing.php DELETED
@@ -1,36 +0,0 @@
1
- <?php
2
- /**
3
- * Subscribe Pro - Subscriptions Management Extension
4
- *
5
- * PHP version 5
6
- *
7
- * LICENSE: This source file is subject to commercial source code license of SUBSCRIBE PRO INC.
8
- *
9
- * @category SFC
10
- * @package SFC_Autoship
11
- * @author Garth Brantley <garth@subscribepro.com>
12
- * @copyright 2009-2016 SUBSCRIBE PRO INC. All Rights Reserved.
13
- * @license http://www.subscribepro.com/terms-of-service/ Subscribe Pro Terms of Service
14
- * @link http://www.subscribepro.com/
15
- *
16
- */
17
-
18
- class SFC_Autoship_Block_Newsubscription_Form_Billing extends SFC_Autoship_Block_Subscription_Form_Address
19
- {
20
-
21
- public function _prepareLayout()
22
- {
23
- // Set subscription on block
24
- $this->setSubscription(Mage::getSingleton('customer/session')->getNewSubscription());
25
-
26
- // Call parent
27
- parent::_prepareLayout();
28
- }
29
-
30
- public function getSubmitUrl()
31
- {
32
- return $this->getUrl('autoship/newsubscription/billingsave');
33
- }
34
-
35
-
36
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/SFC/Autoship/Block/Newsubscription/Form/Shipping.php DELETED
@@ -1,35 +0,0 @@
1
- <?php
2
- /**
3
- * Subscribe Pro - Subscriptions Management Extension
4
- *
5
- * PHP version 5
6
- *
7
- * LICENSE: This source file is subject to commercial source code license of SUBSCRIBE PRO INC.
8
- *
9
- * @category SFC
10
- * @package SFC_Autoship
11
- * @author Garth Brantley <garth@subscribepro.com>
12
- * @copyright 2009-2016 SUBSCRIBE PRO INC. All Rights Reserved.
13
- * @license http://www.subscribepro.com/terms-of-service/ Subscribe Pro Terms of Service
14
- * @link http://www.subscribepro.com/
15
- *
16
- */
17
-
18
- class SFC_Autoship_Block_Newsubscription_Form_Shipping extends SFC_Autoship_Block_Subscription_Form_Address
19
- {
20
-
21
- public function _prepareLayout()
22
- {
23
- // Set subscription on block
24
- $this->setSubscription(Mage::getSingleton('customer/session')->getNewSubscription());
25
-
26
- // Call parent
27
- parent::_prepareLayout();
28
- }
29
-
30
- public function getSubmitUrl()
31
- {
32
- return $this->getUrl('autoship/newsubscription/shippingsave');
33
- }
34
-
35
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/SFC/Autoship/Helper/Payment.php CHANGED
@@ -144,6 +144,8 @@ class SFC_Autoship_Helper_Payment extends SFC_Autoship_Helper_Payment_Base
144
  * Authorize-Only mode.
145
  *
146
  * @param Mage_Sales_Model_Order $order
 
 
147
  */
148
  public function reauthorizeOrder(Mage_Sales_Model_Order $order)
149
  {
@@ -156,28 +158,34 @@ class SFC_Autoship_Helper_Payment extends SFC_Autoship_Helper_Payment_Base
156
  /** @var SFC_Autoship_Model_Payment_Method $methodInstance */
157
  $methodInstance = $order->getPayment()->getMethodInstance();
158
  $methodInstance->setStore($order->getStoreId());
 
 
159
 
160
  // Check this was an authorize only transaction
161
- if (!$methodInstance->canReauthorize($order->getPayment())) {
162
  Mage::throwException("Reauthorize only applicable to orders which were ordered in authorize-only mode, where credit card was stored and other criteria were met!");
163
  }
164
 
165
  // Get amount
166
- $amount = $order->getPayment()->getData('amount_authorized') - $order->getPayment()->getData('amount_paid');
167
-
168
- try {
169
- // Void
170
- $order->getPayment()->void(
171
- new Varien_Object() // workaround for backwards compatibility
172
- );
173
- $order->save();
174
- }
175
- catch (Exception $e) {
176
- // Void failed, but lets ignore that an reauthorize anyway
177
- SFC_Autoship::log('Void failed, continuing to reauthorize!', Zend_Log::ERR);
 
 
 
 
 
 
178
  }
179
- // Reload order after void
180
- $order = Mage::getModel('sales/order')->load($order->getId());
181
 
182
  // Reauthorize
183
  $methodInstance->reauthorize($order->getPayment(), $amount);
144
  * Authorize-Only mode.
145
  *
146
  * @param Mage_Sales_Model_Order $order
147
+ * @throws Exception
148
+ * @throws Mage_Core_Exception
149
  */
150
  public function reauthorizeOrder(Mage_Sales_Model_Order $order)
151
  {
158
  /** @var SFC_Autoship_Model_Payment_Method $methodInstance */
159
  $methodInstance = $order->getPayment()->getMethodInstance();
160
  $methodInstance->setStore($order->getStoreId());
161
+ // Get payment
162
+ $payment = $order->getPayment();
163
 
164
  // Check this was an authorize only transaction
165
+ if (!$methodInstance->canReauthorize($payment)) {
166
  Mage::throwException("Reauthorize only applicable to orders which were ordered in authorize-only mode, where credit card was stored and other criteria were met!");
167
  }
168
 
169
  // Get amount
170
+ $amount = $payment->getData('amount_authorized') - $order->getPayment()->getData('amount_paid');
171
+
172
+ // Attempt a void when current Authorization transaction is still open
173
+ $transaction = $payment->getTransaction($payment->getCcTransId());
174
+ if (!$transaction->getIsClosed()) {
175
+ try {
176
+ // Void
177
+ $order->getPayment()->void(
178
+ new Varien_Object() // workaround for backwards compatibility
179
+ );
180
+ $order->save();
181
+ }
182
+ catch (Exception $e) {
183
+ // Void failed, but lets ignore that and reauthorize anyway
184
+ SFC_Autoship::log('Void failed, continuing to reauthorize!', Zend_Log::ERR);
185
+ }
186
+ // Reload order after void
187
+ $order = Mage::getModel('sales/order')->load($order->getId());
188
  }
 
 
189
 
190
  // Reauthorize
191
  $methodInstance->reauthorize($order->getPayment(), $amount);
app/code/local/SFC/Autoship/Helper/Platform.php CHANGED
@@ -27,7 +27,6 @@ class SFC_Autoship_Helper_Platform extends Mage_Core_Helper_Abstract
27
  const PAY_METHOD_CODE_SFC_CIM = 'sfc_cim_core';
28
  const PAY_METHOD_CODE_SUBSCRIBE_PRO_VAULT = 'subscribe_pro';
29
  const PAY_METHOD_CODE_SFC_CYBERSOURCE = 'sfc_cybersource';
30
- const PAY_METHOD_CODE_BRAINTREE = "braintree";
31
 
32
  protected $_methodCodeMap = array();
33
 
27
  const PAY_METHOD_CODE_SFC_CIM = 'sfc_cim_core';
28
  const PAY_METHOD_CODE_SUBSCRIBE_PRO_VAULT = 'subscribe_pro';
29
  const PAY_METHOD_CODE_SFC_CYBERSOURCE = 'sfc_cybersource';
 
30
 
31
  protected $_methodCodeMap = array();
32
 
app/code/local/SFC/Autoship/Helper/Quote.php CHANGED
@@ -774,25 +774,6 @@ class SFC_Autoship_Helper_Quote extends Mage_Core_Helper_Abstract
774
  $subscription->setData('customer_cardnumber', $payment->getData('cc_last4'));
775
  return;
776
 
777
- case SFC_Autoship_Helper_Platform::PAY_METHOD_CODE_BRAINTREE:
778
- return;
779
-
780
- case SFC_Autoship_Helper_Platform::PAY_METHOD_CODE_PARADOX_TRANSARMOR:
781
- // Lookup order corresponding to quote
782
- /** @var Mage_Sales_Model_Order $order */
783
- $order = Mage::getModel('sales/order')->getCollection()
784
- ->addFieldToFilter('quote_id', $quote->getId())
785
- ->getFirstItem();
786
- if(!strlen($order->getId())) {
787
- Mage::throwException($this->__('Failed to find order corresponding to quote to create subscriptions for TransArmor quote!'));
788
- }
789
- /** @var Mage_Sales_Model_Order_Payment $payment */
790
- $payment = $order->getPayment();
791
- // Set data on subscription
792
- $subscription->setData('payment_token', $payment->getAdditionalInformation('token'));
793
- $subscription->setData('customer_cardnumber', $payment->getData('cc_last4'));
794
- return;
795
-
796
  }
797
 
798
  }
774
  $subscription->setData('customer_cardnumber', $payment->getData('cc_last4'));
775
  return;
776
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
777
  }
778
 
779
  }
app/code/local/SFC/Autoship/Model/Checkout/Cart/Product/Api.php CHANGED
@@ -105,6 +105,9 @@ class SFC_Autoship_Model_Checkout_Cart_Product_Api extends Mage_Checkout_Model_C
105
  if (isset($productRequest['subscription_interval'])) {
106
  $quoteItem->setData('subscription_interval', $productRequest['subscription_interval']);
107
  }
 
 
 
108
  /* Subscribe Pro Changes / Additions - End Here */
109
  }
110
  catch (Mage_Core_Exception $e) {
105
  if (isset($productRequest['subscription_interval'])) {
106
  $quoteItem->setData('subscription_interval', $productRequest['subscription_interval']);
107
  }
108
+ if (isset($productRequest['subscription_reorder_ordinal'])) {
109
+ $quoteItem->setData('subscription_reorder_ordinal', $productRequest['subscription_reorder_ordinal']);
110
+ }
111
  /* Subscribe Pro Changes / Additions - End Here */
112
  }
113
  catch (Mage_Core_Exception $e) {
app/code/local/SFC/Autoship/Model/Enterprise/GiftCardAccount/Observer.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Subscribe Pro - Subscriptions Management Extension
4
+ *
5
+ * PHP version 5
6
+ *
7
+ * LICENSE: This source file is subject to commercial source code license of SUBSCRIBE PRO INC.
8
+ *
9
+ * @category SFC
10
+ * @package SFC_Autoship
11
+ * @author Garth Brantley <garth@subscribepro.com>
12
+ * @copyright 2009-2016 SUBSCRIBE PRO INC. All Rights Reserved.
13
+ * @license http://www.subscribepro.com/terms-of-service/ Subscribe Pro Terms of Service
14
+ * @link http://www.subscribepro.com/
15
+ *
16
+ */
17
+
18
+ /**
19
+ */
20
+ class SFC_Autoship_Model_Enterprise_GiftCardAccount_Observer extends Enterprise_GiftCardAccount_Model_Observer
21
+ {
22
+
23
+ /**
24
+ * Override Enterprise_GiftCardAccount implementation of this method. Allow SP Vault payment method
25
+ * in this situation when there is a subscription in cart.
26
+ *
27
+ * Force Zero Subtotal Checkout if the grand total is completely covered by SC and/or GC
28
+ *
29
+ * @param Varien_Event_Observer $observer
30
+ * @return void
31
+ */
32
+ public function togglePaymentMethods($observer)
33
+ {
34
+ /** @var SFC_Autoship_Helper_Quote $quoteHelper */
35
+ $quoteHelper = Mage::helper('autoship/quote');
36
+
37
+ $quote = $observer->getEvent()->getQuote();
38
+ if (!$quote) {
39
+ return;
40
+ }
41
+ // check if giftcard applied and then try to use free method
42
+ if (!$quote->getGiftCardAccountApplied()) {
43
+ return;
44
+ }
45
+ // disable all payment methods and enable only Zero Subtotal Checkout
46
+ if ($quote->getBaseGrandTotal() == 0 && (float)$quote->getGiftCardsAmountUsed()) {
47
+ $paymentMethod = $observer->getEvent()->getMethodInstance()->getCode();
48
+ $result = $observer->getEvent()->getResult();
49
+ // Don't do this extra check in the case where payment method is SP Vault and subscription is in cart
50
+ if (($quoteHelper->hasProductsToCreateNewSubscription($quote)
51
+ || !$quoteHelper->hasSubscriptionReorderProduct($quote))
52
+ && 0 === strpos($paymentMethod, SFC_Autoship_Helper_Platform::PAY_METHOD_CODE_SUBSCRIBE_PRO_VAULT)
53
+ ) {
54
+ // Don't do extra check
55
+ }
56
+ else {
57
+ // allow customer to place order if grand total is zero
58
+ $result->isAvailable = $paymentMethod === 'free' && empty($result->isDeniedInConfig);
59
+ }
60
+ }
61
+ }
62
+
63
+ }
app/code/local/SFC/Autoship/Model/Enterprise/Reward/Observer.php ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Subscribe Pro - Subscriptions Management Extension
4
+ *
5
+ * PHP version 5
6
+ *
7
+ * LICENSE: This source file is subject to commercial source code license of SUBSCRIBE PRO INC.
8
+ *
9
+ * @category SFC
10
+ * @package SFC_Autoship
11
+ * @author Garth Brantley <garth@subscribepro.com>
12
+ * @copyright 2009-2016 SUBSCRIBE PRO INC. All Rights Reserved.
13
+ * @license http://www.subscribepro.com/terms-of-service/ Subscribe Pro Terms of Service
14
+ * @link http://www.subscribepro.com/
15
+ *
16
+ */
17
+
18
+
19
+ /**
20
+ * Reward observer
21
+ *
22
+ * @category Enterprise
23
+ * @package Enterprise_Reward
24
+ * @author Magento Core Team <core@magentocommerce.com>
25
+ */
26
+ class SFC_Autoship_Model_Enterprise_Reward_Observer extends Enterprise_Reward_Model_Observer
27
+ {
28
+
29
+ /**
30
+ * Override Enterprise_Reward implementation of this method. Allow SP Vault payment method
31
+ * in this situation when there is a subscription in cart.
32
+ *
33
+ * Enable Zero Subtotal Checkout payment method
34
+ * if customer has enough points to cover grand total
35
+ *
36
+ * @param Varien_Event_Observer $observer
37
+ * @return Enterprise_Reward_Model_Observer
38
+ */
39
+ public function preparePaymentMethod($observer)
40
+ {
41
+ /** @var SFC_Autoship_Helper_Quote $quoteHelper */
42
+ $quoteHelper = Mage::helper('autoship/quote');
43
+
44
+ if (!Mage::helper('enterprise_reward')->isEnabledOnFront()) {
45
+ return $this;
46
+ }
47
+
48
+ $quote = $observer->getEvent()->getQuote();
49
+ if (!is_object($quote) || !$quote->getId()) {
50
+ return $this;
51
+ }
52
+
53
+ /* @var $reward Enterprise_Reward_Model_Reward */
54
+ $reward = $quote->getRewardInstance();
55
+ if (!$reward || !$reward->getId()) {
56
+ return $this;
57
+ }
58
+
59
+ $baseQuoteGrandTotal = $quote->getBaseGrandTotal() + $quote->getBaseRewardCurrencyAmount();
60
+ if ($reward->isEnoughPointsToCoverAmount($baseQuoteGrandTotal)) {
61
+ $paymentCode = $observer->getEvent()->getMethodInstance()->getCode();
62
+ $result = $observer->getEvent()->getResult();
63
+ if (($quoteHelper->hasProductsToCreateNewSubscription($quote)
64
+ || !$quoteHelper->hasSubscriptionReorderProduct($quote))
65
+ && 0 === strpos($paymentCode, SFC_Autoship_Helper_Platform::PAY_METHOD_CODE_SUBSCRIBE_PRO_VAULT)
66
+ ) {
67
+ // Don't do extra check
68
+ }
69
+ else {
70
+ $result->isAvailable = $paymentCode === 'free' && empty($result->isDeniedInConfig);
71
+ }
72
+ }
73
+ return $this;
74
+ }
75
+
76
+ }
77
+
app/code/local/SFC/Autoship/Model/Observer.php CHANGED
@@ -58,11 +58,6 @@ class SFC_Autoship_Model_Observer
58
  return;
59
  }
60
 
61
- // Only respond to this event when configured to create new subscriptions through cart
62
- if (Mage::getStoreConfig('autoship_subscription/subscription/use_new_subscription_page', $store) == '1') {
63
- return;
64
- }
65
-
66
  // Get data from $observer
67
  $product = $observer->getData('product');
68
 
@@ -100,11 +95,6 @@ class SFC_Autoship_Model_Observer
100
  return;
101
  }
102
 
103
- // Only respond to this event when configured to create new subscriptions through cart
104
- if (Mage::getStoreConfig('autoship_subscription/subscription/use_new_subscription_page', $cart->getQuote()->getStore()) == '1') {
105
- return;
106
- }
107
-
108
  // Call helper to handle this event
109
  /** @var SFC_Autoship_Helper_Quote $quoteHelper */
110
  $quoteHelper = Mage::helper('autoship/quote');
@@ -167,11 +157,6 @@ class SFC_Autoship_Model_Observer
167
  return;
168
  }
169
 
170
- // Only respond to this event when configured to create new subscriptions through cart
171
- if (Mage::getStoreConfig('autoship_subscription/subscription/use_new_subscription_page', $quote->getStore()) == '1') {
172
- return;
173
- }
174
-
175
  try {
176
  // Call helper to handle this event
177
  /** @var SFC_Autoship_Helper_Quote $quoteHelper */
@@ -193,11 +178,6 @@ class SFC_Autoship_Model_Observer
193
  return;
194
  }
195
 
196
- // Only respond to this event when configured to create new subscriptions through cart
197
- if (Mage::getStoreConfig('autoship_subscription/subscription/use_new_subscription_page') == '1') {
198
- return;
199
- }
200
-
201
  try {
202
  // Get data from $observer
203
  /** @var Mage_Sales_Model_Quote $quote */
58
  return;
59
  }
60
 
 
 
 
 
 
61
  // Get data from $observer
62
  $product = $observer->getData('product');
63
 
95
  return;
96
  }
97
 
 
 
 
 
 
98
  // Call helper to handle this event
99
  /** @var SFC_Autoship_Helper_Quote $quoteHelper */
100
  $quoteHelper = Mage::helper('autoship/quote');
157
  return;
158
  }
159
 
 
 
 
 
 
160
  try {
161
  // Call helper to handle this event
162
  /** @var SFC_Autoship_Helper_Quote $quoteHelper */
178
  return;
179
  }
180
 
 
 
 
 
 
181
  try {
182
  // Get data from $observer
183
  /** @var Mage_Sales_Model_Quote $quote */
app/code/local/SFC/Autoship/Model/Payment/Method.php CHANGED
@@ -625,6 +625,12 @@ class SFC_Autoship_Model_Payment_Method extends Mage_Payment_Model_Method_Cc
625
  ->setParentTransactionId($payment->getData('cc_trans_id'))
626
  ->setTransactionId($platformTransaction['id'])
627
  ;
 
 
 
 
 
 
628
  // Create transaction
629
  $payment->addTransaction(Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE);
630
  // Save AVS and CVV results when available
625
  ->setParentTransactionId($payment->getData('cc_trans_id'))
626
  ->setTransactionId($platformTransaction['id'])
627
  ;
628
+ // If gateway doesn't have multiple capture support, always close parent auth transaction, even on a
629
+ // partial capture
630
+ if (!$this->getConfigData('multiple_capture_support')) {
631
+ $payment
632
+ ->setShouldCloseParentTransaction(true);
633
+ }
634
  // Create transaction
635
  $payment->addTransaction(Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE);
636
  // Save AVS and CVV results when available
app/code/local/SFC/Autoship/Model/Quote/Address.php CHANGED
@@ -62,14 +62,7 @@ class SFC_Autoship_Model_Quote_Address extends Mage_Sales_Model_Quote_Address
62
  if (Mage::getStoreConfig('autoship_general/general/enabled', $this->getQuote()->getStore()) != '1') {
63
  return true;
64
  }
65
- // Check if New Sub page disabled
66
- if (Mage::getStoreConfig('autoship_subscription/subscription/use_new_subscription_page', $this->getQuote()->getStore()) != '1') {
67
- return true;
68
- }
69
- // Check shipping_method_onetime_enabled setting
70
- if (Mage::getStoreConfig('autoship_subscription/subscription/shipping_method_onetime_enabled', $this->getQuote()->getStore()) == '1') {
71
- return true;
72
- }
73
  // Check if admin store is set as current store
74
  if (Mage::app()->getStore()->isAdmin()) {
75
  return true;
@@ -90,5 +83,4 @@ class SFC_Autoship_Model_Quote_Address extends Mage_Sales_Model_Quote_Address
90
 
91
  return false;
92
  }
93
-
94
  }
62
  if (Mage::getStoreConfig('autoship_general/general/enabled', $this->getQuote()->getStore()) != '1') {
63
  return true;
64
  }
65
+
 
 
 
 
 
 
 
66
  // Check if admin store is set as current store
67
  if (Mage::app()->getStore()->isAdmin()) {
68
  return true;
83
 
84
  return false;
85
  }
 
86
  }
app/code/local/SFC/Autoship/Model/SalesRule/Rule/Condition/Product.php CHANGED
@@ -52,7 +52,11 @@ class SFC_Autoship_Model_SalesRule_Rule_Condition_Product extends SFC_Autoship_M
52
  protected function _addSpecialAttributes(array &$attributes)
53
  {
54
  parent::_addSpecialAttributes($attributes);
55
- $attributes['quote_item_part_of_subscription'] = Mage::helper('salesrule')->__('Subscription Status');
 
 
 
 
56
  }
57
 
58
  /**
@@ -64,40 +68,71 @@ class SFC_Autoship_Model_SalesRule_Rule_Condition_Product extends SFC_Autoship_M
64
  */
65
  public function validate(Varien_Object $object)
66
  {
67
- if ($this->getAttribute() == 'quote_item_part_of_subscription') {
68
- // Check quote item attributes
69
- $itemFulfilsSubscription = $object->getData('item_fulfils_subscription');
70
- $itemCreatesNewSubscription = $object->getData('create_new_subscription_at_checkout');
71
- // Get value set on rule condition
72
- $conditionValue = $this->getValueParsed();
73
- // Get operator set on rule condition
74
- $op = $this->getOperatorForValidate();
75
- // Handle different status types
76
- switch ($conditionValue) {
77
- case self::SUBSCRIPTION_STATUS_ANY:
78
- $matchResult = (bool) ($itemFulfilsSubscription || $itemCreatesNewSubscription);
79
- break;
80
- case self::SUBSCRIPTION_STATUS_NEW:
81
- $matchResult = (bool) $itemCreatesNewSubscription;
82
- break;
83
- case self::SUBSCRIPTION_STATUS_REORDER:
84
- $matchResult = (bool) ($itemFulfilsSubscription && !$itemCreatesNewSubscription);
85
- break;
86
- default:
87
- $matchResult = false;
88
- break;
89
- }
90
- // Only == or != operators supported
91
- // In case of !=, do invert $matchResult
92
- if($op != '==') {
93
- $matchResult = !$matchResult;
94
- }
95
-
96
- // Return our result
97
- return $matchResult;
98
- }
99
- else {
100
- return parent::validate($object);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
101
  }
102
  }
103
 
@@ -108,11 +143,18 @@ class SFC_Autoship_Model_SalesRule_Rule_Condition_Product extends SFC_Autoship_M
108
  */
109
  public function getInputType()
110
  {
111
- if ($this->getAttribute()=='quote_item_part_of_subscription') {
112
- return 'select';
113
- }
114
- else {
115
- return parent::getInputType();
 
 
 
 
 
 
 
116
  }
117
  }
118
 
@@ -123,25 +165,33 @@ class SFC_Autoship_Model_SalesRule_Rule_Condition_Product extends SFC_Autoship_M
123
  */
124
  public function getValueElementType()
125
  {
126
- if ($this->getAttribute()=='quote_item_part_of_subscription') {
127
- return 'select';
128
- }
129
- else {
130
- return parent::getValueElementType();
 
 
 
 
 
 
 
131
  }
132
  }
133
 
134
  public function getValueSelectOptions()
135
  {
136
- if ($this->getAttribute()=='quote_item_part_of_subscription') {
137
- return array(
138
- array('value' => self::SUBSCRIPTION_STATUS_ANY, 'label' => Mage::helper('autoship')->__('Part of Subscription (New or Re-order)')),
139
- array('value' => self::SUBSCRIPTION_STATUS_NEW, 'label' => Mage::helper('autoship')->__('Part of New Subscription Order')),
140
- array('value' => self::SUBSCRIPTION_STATUS_REORDER, 'label' => Mage::helper('autoship')->__('Part of Subscription Re-order')),
141
- );
142
- }
143
- else {
144
- return parent::getValueSelectOptions();
 
145
  }
146
  }
147
 
52
  protected function _addSpecialAttributes(array &$attributes)
53
  {
54
  parent::_addSpecialAttributes($attributes);
55
+
56
+ // Add Subscribe Pro specific attributes
57
+ $attributes['quote_item_part_of_subscription'] = Mage::helper('salesrule')->__('Subscription - Status');
58
+ $attributes['quote_item_subscription_interval'] = Mage::helper('salesrule')->__('Subscription - Current Interval');
59
+ $attributes['quote_item_subscription_reorder_ordinal'] = Mage::helper('salesrule')->__('Subscription - Re-order Ordinal');
60
  }
61
 
62
  /**
68
  */
69
  public function validate(Varien_Object $object)
70
  {
71
+ switch ($this->getAttribute()) {
72
+ case 'quote_item_part_of_subscription':
73
+ // Check quote item attributes
74
+ $itemFulfilsSubscription = $object->getData('item_fulfils_subscription');
75
+ $itemCreatesNewSubscription = $object->getData('create_new_subscription_at_checkout');
76
+ // Get value set on rule condition
77
+ $conditionValue = $this->getValueParsed();
78
+ // Get operator set on rule condition
79
+ $op = $this->getOperatorForValidate();
80
+ // Handle different status types
81
+ switch ($conditionValue) {
82
+ case self::SUBSCRIPTION_STATUS_ANY:
83
+ $matchResult = (bool) ($itemFulfilsSubscription || $itemCreatesNewSubscription);
84
+ break;
85
+ case self::SUBSCRIPTION_STATUS_NEW:
86
+ $matchResult = (bool) $itemCreatesNewSubscription;
87
+ break;
88
+ case self::SUBSCRIPTION_STATUS_REORDER:
89
+ $matchResult = (bool) ($itemFulfilsSubscription && !$itemCreatesNewSubscription);
90
+ break;
91
+ default:
92
+ $matchResult = false;
93
+ break;
94
+ }
95
+ // Only == or != operators supported
96
+ // In case of !=, do invert $matchResult
97
+ if($op != '==') {
98
+ $matchResult = !$matchResult;
99
+ }
100
+
101
+ // Return our result
102
+ return $matchResult;
103
+
104
+ case 'quote_item_subscription_interval':
105
+ // Check quote item attributes
106
+ if ($object->getData('create_new_subscription_at_checkout') == '1') {
107
+ // This is a new subscription
108
+ return parent::validateAttribute($object->getData('new_subscription_interval'));
109
+ }
110
+ else if ($object->getData('item_fulfils_subscription') == '1') {
111
+ // This is a recurring order on a subscription
112
+ return parent::validateAttribute($object->getData('subscription_interval'));
113
+ }
114
+ else {
115
+ return false;
116
+ }
117
+
118
+ case 'quote_item_subscription_reorder_ordinal':
119
+ // Check quote item attributes
120
+ if ($object->getData('create_new_subscription_at_checkout') == '1') {
121
+ // This is a new subscription
122
+ $reorderOrdinal = 0;
123
+ return parent::validateAttribute($reorderOrdinal);
124
+ }
125
+ else if ($object->getData('item_fulfils_subscription') == '1') {
126
+ // This is a recurring order on a subscription
127
+ $reorderOrdinal = $object->getData('subscription_reorder_ordinal');
128
+ return parent::validateAttribute($reorderOrdinal);
129
+ }
130
+ else {
131
+ return false;
132
+ }
133
+
134
+ default:
135
+ return parent::validate($object);
136
  }
137
  }
138
 
143
  */
144
  public function getInputType()
145
  {
146
+ switch ($this->getAttribute()) {
147
+ case 'quote_item_part_of_subscription':
148
+ return 'select';
149
+
150
+ case 'quote_item_subscription_interval':
151
+ return 'string';
152
+
153
+ case 'quote_item_subscription_reorder_ordinal':
154
+ return 'string';
155
+
156
+ default:
157
+ return parent::getInputType();
158
  }
159
  }
160
 
165
  */
166
  public function getValueElementType()
167
  {
168
+ switch ($this->getAttribute()) {
169
+ case 'quote_item_part_of_subscription':
170
+ return 'select';
171
+
172
+ case 'quote_item_subscription_interval':
173
+ return 'text';
174
+
175
+ case 'quote_item_subscription_reorder_ordinal':
176
+ return 'text';
177
+
178
+ default:
179
+ return parent::getValueElementType();
180
  }
181
  }
182
 
183
  public function getValueSelectOptions()
184
  {
185
+ switch ($this->getAttribute()) {
186
+ case 'quote_item_part_of_subscription':
187
+ return array(
188
+ array('value' => self::SUBSCRIPTION_STATUS_ANY, 'label' => Mage::helper('autoship')->__('Part of Subscription (New or Re-order)')),
189
+ array('value' => self::SUBSCRIPTION_STATUS_NEW, 'label' => Mage::helper('autoship')->__('Part of New Subscription Order')),
190
+ array('value' => self::SUBSCRIPTION_STATUS_REORDER, 'label' => Mage::helper('autoship')->__('Part of Subscription Re-order')),
191
+ );
192
+
193
+ default:
194
+ return parent::getValueSelectOptions();
195
  }
196
  }
197
 
app/code/local/SFC/Autoship/Model/SalesRule/Validator.php CHANGED
@@ -184,14 +184,7 @@ class SFC_Autoship_Model_SalesRule_Validator extends SFC_Autoship_Model_SalesRul
184
  } else {
185
  $quoteItem = $baseItem;
186
  }
187
- return ($quoteItem->getData('item_fulfils_subscription')
188
- ||
189
- (
190
- $quoteItem->getData('create_new_subscription_at_checkout')
191
- &&
192
- (Mage::getStoreConfig('autoship_subscription/subscription/use_new_subscription_page', $store) != '1')
193
- )
194
- );
195
  }
196
 
197
  /**
184
  } else {
185
  $quoteItem = $baseItem;
186
  }
187
+ return ($quoteItem->getData('item_fulfils_subscription') || $quoteItem->getData('create_new_subscription_at_checkout'));
 
 
 
 
 
 
 
188
  }
189
 
190
  /**
app/code/local/SFC/Autoship/Model/Shipping/Carrier.php CHANGED
@@ -68,8 +68,21 @@ class SFC_Autoship_Model_Shipping_Carrier
68
 
69
  // Check if quote has recurring subscription items
70
  if ($quoteHelper->hasSubscriptionReorderProduct($quote)) {
 
 
 
 
 
 
 
 
 
 
 
 
 
71
  // Make Subscribe Pro shipping method available
72
- $result->append($this->getRate($request, $quote));
73
  }
74
  }
75
  }
68
 
69
  // Check if quote has recurring subscription items
70
  if ($quoteHelper->hasSubscriptionReorderProduct($quote)) {
71
+ // Calculate rate
72
+ $rate = $this->getRate($request, $quote);
73
+ try {
74
+ // Fire event
75
+ Mage::dispatchEvent('sfc_autoship_after_calc_recurring_shipping_rate',
76
+ array('request' => $request, 'quote' => $quote, 'rate' => $rate));
77
+ }
78
+ catch(\Exception $e) {
79
+ SFC_Autoship::log('sfc_autoship_after_calc_recurring_shipping_rate event dispatching failed!', Zend_Log::ERR);
80
+ SFC_Autoship::log('Error message: ' . $e->getMessage(), Zend_Log::ERR);
81
+ // Re-calculate rate
82
+ $rate = $this->getRate($request, $quote);
83
+ }
84
  // Make Subscribe Pro shipping method available
85
+ $result->append($rate);
86
  }
87
  }
88
  }
app/code/local/SFC/Autoship/controllers/MysubscriptionsController.php CHANGED
@@ -537,7 +537,6 @@ class SFC_Autoship_MysubscriptionsController extends Mage_Core_Controller_Front_
537
  switch($helperPlatform->getConfiguredPaymentMethodCode())
538
  {
539
  default:
540
- case SFC_Autoship_Helper_Platform::PAY_METHOD_CODE_BRAINTREE:
541
  return array(
542
  'payment_token' => null,
543
  'creditcard_last_digits' => null,
537
  switch($helperPlatform->getConfiguredPaymentMethodCode())
538
  {
539
  default:
 
540
  return array(
541
  'payment_token' => null,
542
  'creditcard_last_digits' => null,
app/code/local/SFC/Autoship/controllers/NewsubscriptionController.php CHANGED
@@ -18,10 +18,6 @@
18
 
19
  /**
20
  * Controller to handle the New Subscription page and subscription creation
21
- *
22
- * Save the subscription object which is being built in customer session with code like this:
23
- * <code>Mage::getSingleton('customer/session')->setNewSubscription($subscription);</code>
24
- *
25
  */
26
  class SFC_Autoship_NewsubscriptionController extends Mage_Core_Controller_Front_Action
27
  {
@@ -38,8 +34,11 @@ class SFC_Autoship_NewsubscriptionController extends Mage_Core_Controller_Front_
38
  // Check if extension enabled
39
  if (Mage::getStoreConfig('autoship_general/general/enabled') != '1') {
40
  // Send customer to 404 page
 
 
 
 
41
  $this->_forward('defaultNoRoute');
42
- return;
43
  }
44
  }
45
 
@@ -50,510 +49,171 @@ class SFC_Autoship_NewsubscriptionController extends Mage_Core_Controller_Front_
50
  */
51
  public function indexAction()
52
  {
53
- // Check if extension enabled
54
- // Check if New Sub page enabled
55
- if (Mage::getStoreConfig('autoship_subscription/subscription/use_new_subscription_page') != '1') {
56
- // Send customer to 404 page
57
- $this->_forward('defaultNoRoute');
58
- return;
59
- }
60
  try {
61
- // Get query params
62
- $processedParams = $this->processQueryParameters();
63
-
64
- // Create subscription model
65
- $subscription = $this->initNewSubscription($processedParams);
66
-
67
- // Save subscription object in session
68
- Mage::getSingleton('customer/session')->setNewSubscription($subscription);
69
-
70
- // Load layout from XML
71
  $this->loadLayout();
72
-
73
- // Set page title for this page
74
  $this->getLayout()->getBlock('head')->setTitle($this->__('Create New Product Subscription'));
75
-
76
- // Render the layout
77
  $this->renderLayout();
78
-
79
  }
80
  catch (Exception $e) {
81
- // Send customer to 404 page
 
82
  $this->_forward('defaultNoRoute');
83
  }
84
-
85
  }
86
 
87
  /**
88
- * Grab query parameters, escape and validate them
89
- *
90
- * Parameters Accepted:
91
- * ---------------------
92
- * product_id - One of product_id or product_sku is required to locate product
93
- * product_sku - One of product_id or product_sku is required to locate product
94
- * qty - Quantity of product for subscription
95
- * interval - Subscription interval
96
- * coupon - Coupon code to be applied to subscription
97
  */
98
- protected function processQueryParameters()
99
  {
100
- // Build array to return
101
- $processedParameters = array();
102
- // Get params from request
103
- $params = $this->getRequest()->getParams();
104
-
105
- // Handle product, either by id or sku
106
- if (strlen($params['product_id'])) {
107
- $product = Mage::getModel('catalog/product')->load($params['product_id']);
108
- }
109
- else {
110
- if (strlen($params['product_sku'])) {
111
- $product = Mage::getModel('catalog/product')->load($params['product_sku'], 'sku');
112
- }
113
- else {
114
- // No product identifying parameter passed
115
- Mage::throwException($this->__('No product_id or product_sku parameter passed!'));
116
  }
117
- }
118
- // If there is no valid product, error out
119
- if (!strlen($product->getId())) {
120
- Mage::throwException($this->__('Invalid product requested!'));
121
- }
122
- $processedParameters['product'] = $product;
123
- $processedParameters['product_id'] = $product->getId();
124
- $processedParameters['product_sku'] = $product->getSku();
125
-
126
- // Handle quantity
127
- $qty = $params['qty'];
128
- // Handle qty param <= 0
129
- // If qty is not supplied or is less than 1, default to 1
130
- if ($qty <= 0) {
131
- $qty = 1;
132
- }
133
- $processedParameters['qty'] = $qty;
134
-
135
- // Handle interval
136
- $interval = $params['interval'];
137
- if (!strlen($interval)) {
138
- $interval = '';
139
- }
140
- $processedParameters['interval'] = $interval;
141
-
142
- // Coupon code
143
- if(isset($params['coupon_code'])) {
144
- $processedParameters['coupon_code'] = $params['coupon_code'];
145
- }
146
- else {
147
- $processedParameters['coupon_code'] = '';
148
- }
149
-
150
- return $processedParameters;
151
- }
152
 
153
- /**
154
- * Build a new subscription model object based on the (already processed) query parameters
155
- *
156
- * @param array $processedQueryParams Array of already validated and processed query parameters
157
- */
158
- protected function initNewSubscription(array $processedQueryParams)
159
- {
160
- // Get current customer from session
161
- $customer = Mage::getSingleton('customer/session')->getCustomer();
162
- // Lookup saved credit cards for customer
163
- $paymentProfile = Mage::getModel('authnettoken/cim_payment_profile')->getCollection()
164
- ->addFieldToFilter('customer_id', $customer->getId())
165
- ->getFirstItem();
166
- // Create default subscription
167
- $subscription = Mage::getModel('autoship/subscription');
168
- $subscription->setNextOrderDate(date('Y-m-d', strtotime('+2 days')));
169
- $subscription->setProductId($processedQueryParams['product_id']);
170
- // $subscription->setProduct($processedQueryParams['product']);
171
- $subscription->setCustomerId($customer->getId());
172
- $subscription->setBillingAddressId($customer->getDefaultBilling());
173
- $subscription->setShippingAddressId($customer->getDefaultShipping());
174
- $subscription->setShippingMethod(Mage::getStoreConfig('autoship_subscription/subscription/shipping_method'));
175
- $subscription->setQty($processedQueryParams['qty']);
176
- $subscription->setCimPaymentProfileId($paymentProfile->getData('cim_payment_profile_id'));
177
- $subscription->setInterval($processedQueryParams['interval']);
178
 
179
- // Check min / max qty
180
- $product = Mage::getModel('catalog/product')->load($subscription->getData('product_id'));
181
- $platformProduct = Mage::helper('autoship/platform')->getPlatformProduct($product);
182
- if($subscription->getData('qty') < $platformProduct->getData('min_qty')) {
183
- $subscription->setData('qty', $platformProduct->getData('min_qty'));
184
- Mage::getSingleton('customer/session')->addError($this->__('Minimum quantity for subscription is %s', $platformProduct->getData('min_qty')));
185
- }
186
- if($subscription->getData('qty') > $platformProduct->getData('max_qty')) {
187
- $subscription->setData('qty', $platformProduct->getData('max_qty'));
188
- Mage::getSingleton('customer/session')->addError($this->__('Maximum quantity for subscription is %s', $platformProduct->getData('max_qty')));
189
- }
190
 
191
- // Return the new subscription model
192
- return $subscription;
193
- }
 
 
194
 
195
- /**
196
- * Save payment method action
197
- */
198
- public function paymentsaveAction()
199
- {
200
- try {
201
- // Get POST data
202
- $data = $this->getRequest()->getParam('payment');
203
- // Get cur customer and subscription models from session
204
- $customer = Mage::getSingleton('customer/session')->getCustomer();
205
- $subscription = Mage::getSingleton('customer/session')->getNewSubscription();
206
- // switched saved card
207
- if (strpos($data['method'], '_cc4_') !== false) {
208
- // Update selection of payment profile
209
- $paymentProfile = Mage::getModel('authnettoken/cim_payment_profile')->load($data['payment_profile_id'][$data['method']]);
210
- $subscription->setCimPaymentProfileId($paymentProfile->getData('cim_payment_profile_id'));
211
  }
212
- else {
213
- // Create and save new profile to CIM and DB
214
- $paymentProfile = $this->createNewPaymentProfile($subscription, $data);
215
- // Now set profile id on subscription
216
- $subscription->setCimPaymentProfileId($paymentProfile->getData('cim_payment_profile_id'));
217
  }
218
- // Save updated subscription model in customer session
219
- Mage::getSingleton('customer/session')->setNewSubscription($subscription);
220
 
221
- // Load and render layout to output updated summary block
222
- $this->loadLayout(false);
223
- $this->renderLayout();
 
 
224
  }
225
  catch (Exception $e) {
226
- SFC_Autoship::log($e->getMessage(), Zend_Log::ERR);
227
  SFC_Autoship::logException($e);
228
- echo '<li class="error">' . $this->__($e->getMessage()) . '</li>';
229
-
230
- return;
 
 
 
231
  }
232
  }
233
 
234
  /**
235
- * Create a new Auth.Net CIM payment profile in Magento DB and on Auth.net CIM
236
  *
237
- * @param SFC_Autoship_Model_Subscription $subscription Subscription for which to create payment profile
238
- * @param array $data Array of profile details from POST
239
- * @return SFC_AuthnetToken_Model_Cim_Payment_Profile Newly created payment profile
240
- */
241
- protected function createNewPaymentProfile(SFC_Autoship_Model_Subscription $subscription, array $data)
242
- {
243
- // Get customer
244
- $customer = Mage::getSingleton('customer/session')->getCustomer();
245
- // Create new payment profile model
246
- $model = Mage::getModel('authnettoken/cim_payment_profile');
247
- // Init profile with customer defaults
248
- $model->initCimProfileWithCustomerDefault($customer->getId());
249
- // Adjust the exp fields to the proper format
250
- $data['exp_date'] = $data['cc_exp_year'] . '-' . sprintf('%02d', $data['cc_exp_month']);
251
- // Put other fields into proper field names for savCimProfileData method
252
- $data['customer_cardnumber'] = $data['cc_number'];
253
- // If customer has selected billing address, add billing address data to new CIM profile
254
- if (strlen($subscription->getBillingAddressId())) {
255
- $billingAddress = Mage::getModel('customer/address')->load($subscription->getBillingAddressId());
256
- $model->setBillingAddressFields($billingAddress);
257
- }
258
- // Set attributes that can be saved in our DB & Authorize.Net CIM
259
- $model->addData($data);
260
- try {
261
- // Now try to save payment profile to Auth.net CIM
262
- $model->saveCimProfileData(true);
263
- // Save our profile model to DB
264
- $model->save();
265
- }
266
- catch (SFC_AuthnetToken_Helper_Cim_Exception $eCim) {
267
- Mage::throwException($this->addErrorFromCimException($eCim));
268
- }
269
- catch (Exception $e) {
270
- Mage::throwException($this->__('Failed to save credit card!'));
271
- }
272
-
273
- // Return new model
274
- return $model;
275
- }
276
-
277
- /**
278
- * Update CIM payment profile with billing address
279
  *
280
- * @param SFC_Autoship_Model_Subscription $subscription Subscription for which to update payment profile
281
- * @return SFC_AuthnetToken_Model_Cim_Payment_Profile Updated payment profile
 
 
282
  */
283
- protected function updateCimPaymentProfileBillingAddress(SFC_Autoship_Model_Subscription $subscription)
284
  {
285
- // Check that we have a payment profile and billing address selected
286
- if (!strlen($subscription->getCimPaymentProfileId()) || !strlen($subscription->getBillingAddressId())) {
287
- return;
288
- }
289
- $paymentProfile = $subscription->getPaymentProfile();
290
- $paymentProfile->retrieveCimProfileData();
291
- $billingAddress = $subscription->getBillingAddress();
292
- $paymentProfile->setBillingAddressFields($billingAddress);
293
- $paymentProfile->save();
294
- $paymentProfile->saveCimProfileData();
295
-
296
- // Return new profile
297
- return $paymentProfile;
298
- }
299
 
300
- /**
301
- * Save billing address action
302
- */
303
- public function billingsaveAction()
304
- {
305
- try {
306
- // Get POST data
307
- $data = $this->getRequest()->getParams();
308
- // Get current subscription
309
- $subscription = Mage::getSingleton('customer/session')->getNewSubscription();
310
- if (!empty($data['billing_address_id'])) {
311
- // change saved address
312
- $addressId = $data['billing_address_id'];
313
- }
314
- else {
315
- // add new address
316
- $addressId = $this->saveAddress($data['billing']);
317
- }
318
- if (!is_numeric($addressId)) {
319
- Mage::throwException($this->__('Failed to save address!'));
320
- }
321
- // Set billing address on subscription
322
- $subscription->setBillingAddressId($addressId);
323
- Mage::getSingleton('customer/session')->setNewSubscription($subscription);
324
- // Check if customer already has default address
325
- // If not, set this as default
326
- $customer = Mage::getSingleton('customer/session')->getCustomer();
327
- if (strlen($customer->getDefaultBilling()) == 0) {
328
- $customer->setDefaultBilling($addressId);
329
- $customer->save();
330
- }
331
- // Check if there is no shipping address set
332
- if (!strlen($subscription->getShippingAddressId())) {
333
- // Set shipping to same address as billing
334
- $subscription->setShippingAddressId($addressId);
335
- // Check if there was no default shipping address set on customer
336
- // If not, set this as default
337
- if (strlen($customer->getDefaultShipping()) == 0) {
338
- $customer->setDefaultShipping($addressId);
339
- $customer->save();
340
- }
341
- }
342
  }
343
- catch (Exception $e) {
344
- SFC_Autoship::log($e->getMessage(), Zend_Log::ERR);
345
- SFC_Autoship::logException($e);
346
- echo '<li class="error">' . $this->__($e->getMessage()) . '</li>';
347
 
348
- return;
 
349
  }
350
 
351
- // Load and render layout
352
- $this->loadLayout(false);
353
- $this->renderLayout();
354
- }
355
 
356
- /**
357
- * Save shipping address action
358
- */
359
- public function shippingsaveAction()
360
- {
361
- try {
362
- // Get POST data
363
- $data = $this->getRequest()->getParams();
364
- // Get current subscription
365
- $subscription = Mage::getSingleton('customer/session')->getNewSubscription();
366
- if (!empty($data['shipping_address_id'])) {
367
- // change saved address
368
- $addressId = $data['shipping_address_id'];
369
- }
370
- else {
371
- // add new address
372
- $addressId = $this->saveAddress($data['shipping']);
373
- }
374
- if (!is_numeric($addressId)) {
375
- Mage::throwException($this->__('Failed to save address!'));
376
- }
377
- // Set shipping address on subscription
378
- $subscription->setShippingAddressId($addressId);
379
- Mage::getSingleton('customer/session')->setNewSubscription($subscription);
380
- // Check if customer already has default address
381
- // If not, set this as default
382
- $customer = Mage::getSingleton('customer/session')->getCustomer();
383
- if (strlen($customer->getDefaultShipping()) == 0) {
384
- $customer->setDefaultShipping($addressId);
385
- $customer->save();
386
- }
387
- // Check if there is no billing address set
388
- if (!strlen($subscription->getBillingAddressId())) {
389
- // Set billing to same address as shipping
390
- $subscription->setBillingAddressId($addressId);
391
- // Check if there was no default billing address set on customer
392
- // If not, set this as default
393
- if (strlen($customer->getDefaultBilling()) == 0) {
394
- $customer->setDefaultBilling($addressId);
395
- $customer->save();
396
- }
397
- }
398
  }
399
- catch (Exception $e) {
400
- SFC_Autoship::log($e->getMessage(), Zend_Log::ERR);
401
- SFC_Autoship::logException($e);
402
- echo '<li class="error">' . $this->__($e->getMessage()) . '</li>';
403
 
404
- return;
 
 
 
405
  }
406
 
407
- // Load and render layout
408
- $this->loadLayout(false);
409
- $this->renderLayout();
 
 
 
 
 
410
  }
411
 
412
  /**
413
- * Update subscription params action
 
 
 
 
414
  */
415
- public function updateAction()
416
  {
417
- $data = $this->getRequest()->getPost();
418
- try {
419
- $customer = Mage::getSingleton('customer/session')->getCustomer();
420
- $subscription = Mage::getSingleton('customer/session')->getNewSubscription();
421
- $subscription
422
- ->setQty($data['qty'])
423
- ->setInterval($data['interval']);
424
- Mage::getSingleton('customer/session')->setNewSubscription($subscription);
425
- }
426
- catch (Exception $e) {
427
- SFC_Autoship::log('Exception occurred: ' . $e->getMessage(), Zend_Log::ERR);
428
- SFC_Autoship::logCallStack();
429
- echo '<li class="error">' . $this->__($e->getMessage()) . '</li>';
430
- }
431
- // Load and render layout
432
- $this->loadLayout(false);
433
- $this->renderLayout();
434
- }
435
 
436
- /**
437
- * Create subscription action
438
- */
439
- public function createPostAction()
440
- {
441
- if (!$this->getRequest()->isPost()) {
442
- return;
443
- }
444
-
445
- try {
446
- // Get post data
447
- $postData = $this->getRequest()->getPost();
448
-
449
- // Update subscription from post data
450
- $subscription = Mage::getSingleton('customer/session')->getNewSubscription();
451
- /*
452
- * TODO: add ajax action to set next order date on subscription object in customer session when it is changed,
453
- * so we don't have to stuff it in the create POST
454
- */
455
- $subscription->setNextOrderDate(date_format(date_create_from_format('m/d/y', $postData['delivery_date']),
456
- 'Y-m-d 00:00:00'));
457
- // TODO: Use ajax to update and save coupon code as / when it is entered so we don't have to stuff it in postData
458
- if(isset($postData['coupon_code'])) {
459
- $subscription->setCouponCode($postData['coupon_code']);
460
- }
461
-
462
- // Update billing address on payment profile, if one exists already
463
- $this->updateCimPaymentProfileBillingAddress($subscription);
464
- // Set last 4 digits of cc number on subscription
465
- $subscription->setData('customer_cardnumber', $subscription->getPaymentProfile()->getData('customer_cardnumber'));
466
- // Create subscription via API
467
- Mage::helper('autoship/platform')->createSubscription($subscription);
468
- // Clear subscription in session
469
- Mage::getSingleton('customer/session')->setNewSubscription(null);
470
-
471
- // Return URL to redirect customer on successful sub creation
472
- $successUrl = Mage::getUrl('*/mysubscriptions/index', array('_secure' => true));
473
- echo $successUrl;
474
- }
475
- catch (Exception $e) {
476
- SFC_Autoship::log($e->getMessage());
477
- SFC_Autoship::logException($e);
478
- if (strpos($e->getMessage(), '1062 Duplicate entry')) {
479
- echo '<li class="error">' . $this->__("You already have a subscription to this product.") . '</li>';
480
- }
481
- else {
482
- echo '<li class="error">' . $this->__($e->getMessage()) . '</li>';
483
- }
484
- }
485
 
 
 
486
  }
487
 
488
  /**
489
- * Save a customer address to customer address book in Magento DB
490
- * @param array $addressData
491
- * @return mixed|string
 
492
  */
493
- protected function saveAddress(array $addressData)
494
  {
495
- // Array to hold errors
496
- $errors = array();
497
- // Get customer from session
498
- $customer = Mage::getSingleton('customer/session')->getCustomer();
499
- /* @var $address Mage_Customer_Model_Address */
500
- $address = Mage::getModel('customer/address');
501
- /* @var $addressForm Mage_Customer_Model_Form */
502
- $addressForm = Mage::getModel('customer/form');
503
- $addressForm->setFormCode('customer_address_edit')
504
- ->setEntity($address);
505
- $addressErrors = $addressForm->validateData($addressData);
506
- if ($addressErrors !== true) {
507
- $errors = $addressErrors;
508
- }
509
- // Compact address data and set customer id
510
- $addressForm->compactData($addressData);
511
- $address->setCustomerId($customer->getId());
512
- // Validate address and collect errors
513
- $addressErrors = $address->validate();
514
- if ($addressErrors !== true && is_array($addressErrors)) {
515
- $errors = array_merge($errors, $addressErrors);
516
- }
517
- // Check error count
518
- // If no errors, save address, otherwise return errors
519
- if (count($errors) === 0) {
520
- // Save address
521
- $address->save();
522
- $addressId = $address->getId();
523
 
524
- // Now return the id of created address
525
- return $addressId;
526
- }
527
- else {
528
- $html = '';
529
- foreach ($errors as $error) {
530
- $html .= '<li class="error">' . $this->__($error) . '</li>';
531
- }
532
 
533
- return $html;
 
 
 
 
 
534
  }
535
-
536
- }
537
-
538
- /**
539
- * Get customer facing error message text based on error code in Authorize.Net CIM exception
540
- */
541
- protected function addErrorFromCimException(SFC_AuthnetToken_Helper_Cim_Exception $eCim)
542
- {
543
- switch ($eCim->getResponse()->getMessageCode()) {
544
- case 'E00014':
545
- return $this->__('A required field was not entered for credit card!');
546
- break;
547
- case 'E00039':
548
- return $this->__('Credit card number is already saved in your account!');
549
- break;
550
- case 'E00042':
551
- return $this->__('You have already saved the maximum number of credit cards!');
552
- break;
553
- default:
554
- return $this->__('Failed to save credit card with gateway!');
555
- break;
556
  }
557
- }
558
 
 
 
 
559
  }
18
 
19
  /**
20
  * Controller to handle the New Subscription page and subscription creation
 
 
 
 
21
  */
22
  class SFC_Autoship_NewsubscriptionController extends Mage_Core_Controller_Front_Action
23
  {
34
  // Check if extension enabled
35
  if (Mage::getStoreConfig('autoship_general/general/enabled') != '1') {
36
  // Send customer to 404 page
37
+ SFC_Autoship::log('SFC Autoship extension not enabled.');
38
+ $this->_forward('defaultNoRoute');
39
+ } elseif (Mage::getStoreConfig('autoship_subscription/new_subscription_page/enable_new_subscription_page') != '1') {
40
+ SFC_Autoship::log('New subscription page is not enabled.');
41
  $this->_forward('defaultNoRoute');
 
42
  }
43
  }
44
 
49
  */
50
  public function indexAction()
51
  {
 
 
 
 
 
 
 
52
  try {
53
+ $subscription = $this->createSubscriptionFromArray($this->processQueryParameters());
54
+ // Load layout from XML and set page title, then render the page
 
 
 
 
 
 
 
 
55
  $this->loadLayout();
56
+ $this->getLayout()->getBlock('newsubscription')->setSubscription($subscription);
 
57
  $this->getLayout()->getBlock('head')->setTitle($this->__('Create New Product Subscription'));
 
 
58
  $this->renderLayout();
 
59
  }
60
  catch (Exception $e) {
61
+ // If we have an error, log it and show a 404 page
62
+ SFC_Autoship::log($e->getMessage());
63
  $this->_forward('defaultNoRoute');
64
  }
 
65
  }
66
 
67
  /**
68
+ * Create subscription action
 
 
 
 
 
 
 
 
69
  */
70
+ public function createPostAction()
71
  {
72
+ try {
73
+ if (!$this->getRequest()->isPost()) {
74
+ Mage::throwException('This page must be accessed via POST.');
 
 
 
 
 
 
 
 
 
 
 
 
 
75
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
 
77
+ // Set helper objects
78
+ $platform = Mage::helper('autoship/platform');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
 
80
+ $subscription = $this->createSubscriptionFromArray($this->processQueryParameters());
 
 
 
 
 
 
 
 
 
 
81
 
82
+ // Do basic data validation
83
+ // nothing complex, just checking that a value is present
84
+ if (0 >= (int) $subscription->getQty()) {
85
+ Mage::throwException('Please set a quantity of one or more.');
86
+ }
87
 
88
+ if ($subscription->getIntervalText() == '') {
89
+ Mage::throwException('Please select an interval.');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
  }
91
+
92
+ if ($subscription->getNextOrderDate() == '') {
93
+ Mage::throwException('Please select a date for your first shipment.');
 
 
94
  }
 
 
95
 
96
+ // Create subscription via API
97
+ $platform->createSubscription($subscription);
98
+
99
+ // Output URL to redirect customer on successful subscription creation
100
+ echo Mage::getUrl('*/mysubscriptions/index', array('_secure' => true));
101
  }
102
  catch (Exception $e) {
103
+ SFC_Autoship::log($e->getMessage());
104
  SFC_Autoship::logException($e);
105
+ if (strpos($e->getMessage(), '1062 Duplicate entry')) {
106
+ echo '<li class="error">' . $this->__("You already have a subscription to this product.") . '</li>';
107
+ }
108
+ else {
109
+ echo '<li class="error">' . $this->__($e->getMessage()) . '</li>';
110
+ }
111
  }
112
  }
113
 
114
  /**
115
+ * Grab query parameters, escape and validate them
116
  *
117
+ * Looks for the following parameters in the request.
118
+ * Only one of product_id and product_sku is required
119
+ * The other parameters will receive a default value if not given
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
120
  *
121
+ * product_id, product_sku, qty, interval, delivery_date,
122
+ *
123
+ * @return array Processed query parameters, ready for use
124
+ * @throws \Exception
125
  */
126
+ protected function processQueryParameters()
127
  {
128
+ // Get params from request
129
+ $params = $this->getRequest()->getParams();
 
 
 
 
 
 
 
 
 
 
 
 
130
 
131
+ $id_type = $id_value = '';
132
+ if (!empty($params['product_id'])) {
133
+ $id_type = 'id';
134
+ $id_value = !empty($params['product_id']) ? $params['product_id'] : '';
135
+ } elseif (!empty($params['product_sku'])) {
136
+ $id_type = 'sku';
137
+ $id_value = !empty($params['product_sku']) ? $params['product_sku'] : '';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
138
  }
 
 
 
 
139
 
140
+ if(empty($id_value)) {
141
+ Mage::throwException('No product_id or product_sku given.');
142
  }
143
 
144
+ $product = $this->loadProduct($id_value, $id_type);
 
 
 
145
 
146
+ if (!$product->getId()) {
147
+ Mage::throwException('Product with ' . $id_type . ' "' . $id_value . '" does not exist.');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
148
  }
 
 
 
 
149
 
150
+ $subscriptionAvailable = Mage::helper('autoship/product')->isAvailableForSubscription($product);
151
+
152
+ if (!$subscriptionAvailable) {
153
+ Mage::throwException('Product with ' . $id_type . ' "' . $id_value . '" is not enabled for subscriptions.');
154
  }
155
 
156
+ return array(
157
+ 'product' => $product,
158
+ 'product_id' => $product->getId(),
159
+ 'product_sku' => $product->getSku(),
160
+ 'qty' => !empty($params['qty']) && $params['qty'] > 0 ? $params['qty'] : 1,
161
+ 'interval' => !empty($params['interval']) ? $params['interval'] : '',
162
+ 'delivery_date' => !empty($params['delivery_date']) ? strtotime($params['delivery_date']) : strtotime('+2 days'),
163
+ );
164
  }
165
 
166
  /**
167
+ * Load a product based on Magento Product ID or SKU.
168
+ *
169
+ * @param string $value Actual ID or SKU for product
170
+ * @param string $type 'id' or 'sku'
171
+ * @return Mage_Catalog_Model_Product
172
  */
173
+ protected function loadProduct($value, $type = 'id')
174
  {
175
+ $productModel = Mage::getModel('catalog/product');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
176
 
177
+ // If we were given the product SKU, use that to get the product ID
178
+ $product_id = $type == 'sku' ? $productModel->getIdBySku($value) : $value;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
179
 
180
+ // Return the product
181
+ return $productModel->load($product_id);
182
  }
183
 
184
  /**
185
+ * Build a new subscription model object based on the (already processed) query parameters
186
+ *
187
+ * @param array $subscriptionData Array of already validated and processed query parameters
188
+ * @return SFC_Autoship_Model_Subscription
189
  */
190
+ protected function createSubscriptionFromArray(array $subscriptionData)
191
  {
192
+ // Get current customer from session
193
+ $customerSession = Mage::getSingleton('customer/session');
194
+ $customer = $customerSession->getCustomer();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
195
 
196
+ $subscription = Mage::getModel('autoship/subscription');
197
+ $subscription->setNextOrderDate(date('Y-m-d', $subscriptionData['delivery_date']))
198
+ ->setProductId($subscriptionData['product_id'])
199
+ ->setProduct($subscriptionData['product'])
200
+ ->setCustomerId($customer->getId())
201
+ ->setQty($subscriptionData['qty'])
202
+ ->setInterval($subscriptionData['interval']);
 
203
 
204
+ // Check min / max qty
205
+ $product = Mage::getModel('catalog/product')->load($subscriptionData['product_id']);
206
+ $platformProduct = Mage::helper('autoship/platform')->getPlatformProduct($product);
207
+ if($subscription->getData('qty') < $platformProduct->getData('min_qty')) {
208
+ $subscription->setData('qty', $platformProduct->getData('min_qty'));
209
+ $customerSession->addError($this->__('Minimum quantity for subscription is %s', $platformProduct->getData('min_qty')));
210
  }
211
+ if($subscription->getData('qty') > $platformProduct->getData('max_qty')) {
212
+ $subscription->setData('qty', $platformProduct->getData('max_qty'));
213
+ $customerSession->addError($this->__('Maximum quantity for subscription is %s', $platformProduct->getData('max_qty')));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
214
  }
 
215
 
216
+ // Return the new subscription model
217
+ return $subscription;
218
+ }
219
  }
app/code/local/SFC/Autoship/etc/config.xml CHANGED
@@ -19,7 +19,7 @@
19
  <config>
20
  <modules>
21
  <SFC_Autoship>
22
- <version>1.3.2.10</version>
23
  </SFC_Autoship>
24
  </modules>
25
  <global>
@@ -114,6 +114,17 @@
114
  <express>SFC_Autoship_Model_Paypal_Express</express>
115
  </rewrite>
116
  </paypal>
 
 
 
 
 
 
 
 
 
 
 
117
  </models>
118
 
119
  <resources>
@@ -340,14 +351,13 @@
340
  <options>
341
  <next_order_date_mode>1</next_order_date_mode>
342
  </options>
343
- <subscription>
344
- <shipping_method>flatrate_flatrate</shipping_method>
345
- <shipping_method_onetime_enabled>1</shipping_method_onetime_enabled>
346
- </subscription>
347
  <discount>
348
  <!-- Default to combine subscription discount with other discounts -->
349
  <cartrule_combine_type>4</cartrule_combine_type>
350
  </discount>
 
 
 
351
  </autoship_subscription>
352
  <payment>
353
  <subscribe_pro>
@@ -359,6 +369,7 @@
359
  <cctypes>AE,VI,MC,DI</cctypes>
360
  <payment_action>authorize_capture</payment_action>
361
  <reauthorize_partial_capture>0</reauthorize_partial_capture>
 
362
  <order_status>processing</order_status>
363
  <currency>USD</currency>
364
  <allow_guest_checkout>1</allow_guest_checkout>
19
  <config>
20
  <modules>
21
  <SFC_Autoship>
22
+ <version>1.3.2.11</version>
23
  </SFC_Autoship>
24
  </modules>
25
  <global>
114
  <express>SFC_Autoship_Model_Paypal_Express</express>
115
  </rewrite>
116
  </paypal>
117
+ <!-- EE Model Rewrites -->
118
+ <enterprise_giftcardaccount>
119
+ <rewrite>
120
+ <observer>SFC_Autoship_Model_Enterprise_GiftCardAccount_Observer</observer>
121
+ </rewrite>
122
+ </enterprise_giftcardaccount>
123
+ <enterprise_reward>
124
+ <rewrite>
125
+ <observer>SFC_Autoship_Model_Enterprise_Reward_Observer</observer>
126
+ </rewrite>
127
+ </enterprise_reward>
128
  </models>
129
 
130
  <resources>
351
  <options>
352
  <next_order_date_mode>1</next_order_date_mode>
353
  </options>
 
 
 
 
354
  <discount>
355
  <!-- Default to combine subscription discount with other discounts -->
356
  <cartrule_combine_type>4</cartrule_combine_type>
357
  </discount>
358
+ <new_subscription_page>
359
+ <enable_new_subscription_page>0</enable_new_subscription_page>
360
+ </new_subscription_page>
361
  </autoship_subscription>
362
  <payment>
363
  <subscribe_pro>
369
  <cctypes>AE,VI,MC,DI</cctypes>
370
  <payment_action>authorize_capture</payment_action>
371
  <reauthorize_partial_capture>0</reauthorize_partial_capture>
372
+ <multiple_capture_support>0</multiple_capture_support>
373
  <order_status>processing</order_status>
374
  <currency>USD</currency>
375
  <allow_guest_checkout>1</allow_guest_checkout>
app/code/local/SFC/Autoship/etc/system.xml CHANGED
@@ -212,55 +212,27 @@
212
  </cartrule_combine_type>
213
  </fields>
214
  </discount>
215
- <subscription translate="label">
216
  <label>New Subscription Page</label>
217
  <frontend_type>text</frontend_type>
218
  <sort_order>120</sort_order>
219
  <show_in_default>1</show_in_default>
220
  <show_in_website>1</show_in_website>
221
  <show_in_store>1</show_in_store>
222
- <comment>DO NOT USE NEW SUBSCRIPTION PAGE UNLESS INSTRUCTED TO DO SO BY SUBSCRIBE PRO SUPPORT! This is a legacy feature only.</comment>
223
  <fields>
224
- <use_new_subscription_page translate="label">
225
- <label>Use New Subscription Page</label>
226
  <frontend_type>select</frontend_type>
227
  <source_model>adminhtml/system_config_source_yesno</source_model>
228
  <sort_order>0</sort_order>
229
  <show_in_default>1</show_in_default>
230
  <show_in_website>1</show_in_website>
231
  <show_in_store>1</show_in_store>
232
- <comment>Use the New Subscription page as the default method for customers to create new subscriptions.
233
- "Create Subscription" button will appear on product details page, button will redirect customers to New
234
- Subscription page.
235
  </comment>
236
- </use_new_subscription_page>
237
- <shipping_method translate="label">
238
- <label>Subscription Shipping Method</label>
239
- <frontend_type>select</frontend_type>
240
- <source_model>autoship/system_config_source_shippingmethods</source_model>
241
- <sort_order>10</sort_order>
242
- <show_in_default>1</show_in_default>
243
- <show_in_website>1</show_in_website>
244
- <show_in_store>1</show_in_store>
245
- <comment>Select the single shipping method which shall be used for Subscribe Pro subscription orders placed
246
- via the New Subscription page. NOTE: Order placed through cart / checkout ordering process will be
247
- eligible for any shipping method available in the Magento checkout process.
248
- </comment>
249
- </shipping_method>
250
- <shipping_method_onetime_enabled translate="label">
251
- <label>Allow Method for One-Time Purchases</label>
252
- <frontend_type>select</frontend_type>
253
- <source_model>adminhtml/system_config_source_enabledisable</source_model>
254
- <sort_order>20</sort_order>
255
- <show_in_default>1</show_in_default>
256
- <show_in_website>1</show_in_website>
257
- <show_in_store>1</show_in_store>
258
- <comment>Should the shipping method selected above for subscription orders be enabled or disabled for
259
- one-time purchase checkouts by customers?
260
- </comment>
261
- </shipping_method_onetime_enabled>
262
  </fields>
263
- </subscription>
264
  </groups>
265
  </autoship_subscription>
266
  <payment>
@@ -300,6 +272,16 @@
300
  <show_in_website>1</show_in_website>
301
  <show_in_store>1</show_in_store>
302
  </title>
 
 
 
 
 
 
 
 
 
 
303
  <reauthorize_partial_capture translate="label">
304
  <label>Reauthorize After Partial Capture</label>
305
  <frontend_type>select</frontend_type>
212
  </cartrule_combine_type>
213
  </fields>
214
  </discount>
215
+ <new_subscription_page translate="label">
216
  <label>New Subscription Page</label>
217
  <frontend_type>text</frontend_type>
218
  <sort_order>120</sort_order>
219
  <show_in_default>1</show_in_default>
220
  <show_in_website>1</show_in_website>
221
  <show_in_store>1</show_in_store>
 
222
  <fields>
223
+ <enable_new_subscription_page translate="label">
224
+ <label>Enable New Subscription Page</label>
225
  <frontend_type>select</frontend_type>
226
  <source_model>adminhtml/system_config_source_yesno</source_model>
227
  <sort_order>0</sort_order>
228
  <show_in_default>1</show_in_default>
229
  <show_in_website>1</show_in_website>
230
  <show_in_store>1</show_in_store>
231
+ <comment>This option enables a page that allows customers to create a new subscription without placing an initial order.
 
 
232
  </comment>
233
+ </enable_new_subscription_page>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
234
  </fields>
235
+ </new_subscription_page>
236
  </groups>
237
  </autoship_subscription>
238
  <payment>
272
  <show_in_website>1</show_in_website>
273
  <show_in_store>1</show_in_store>
274
  </title>
275
+ <multiple_capture_support translate="label">
276
+ <label>Gateway Supports Multiple Captures</label>
277
+ <frontend_type>select</frontend_type>
278
+ <source_model>adminhtml/system_config_source_yesno</source_model>
279
+ <sort_order>3</sort_order>
280
+ <show_in_default>1</show_in_default>
281
+ <show_in_website>1</show_in_website>
282
+ <show_in_store>0</show_in_store>
283
+ <comment>Applicable in Authorize Only Mode</comment>
284
+ </multiple_capture_support>
285
  <reauthorize_partial_capture translate="label">
286
  <label>Reauthorize After Partial Capture</label>
287
  <frontend_type>select</frontend_type>
app/code/local/SFC/Autoship/sql/sfc_autoship_setup/{mysql4-install-1.3.2.10.php → mysql4-install-1.3.2.11.php} RENAMED
@@ -92,6 +92,11 @@ $installer->addAttribute('quote_item', 'subscription_interval', array(
92
  'visible' => true,
93
  'required' => false
94
  ));
 
 
 
 
 
95
 
96
  $installer->addAttribute('quote_item', 'create_new_subscription_at_checkout', array(
97
  'type' => Varien_Db_Ddl_Table::TYPE_BOOLEAN,
92
  'visible' => true,
93
  'required' => false
94
  ));
95
+ $installer->addAttribute('quote_item', 'subscription_reorder_ordinal', array(
96
+ 'type' => Varien_Db_Ddl_Table::TYPE_INTEGER,
97
+ 'visible' => false,
98
+ 'required' => false
99
+ ));
100
 
101
  $installer->addAttribute('quote_item', 'create_new_subscription_at_checkout', array(
102
  'type' => Varien_Db_Ddl_Table::TYPE_BOOLEAN,
app/code/local/SFC/Autoship/{Block/Newsubscription/Form/Payment.php → sql/sfc_autoship_setup/mysql4-upgrade-1.3.2.10-1.3.2.11.php} RENAMED
@@ -15,21 +15,22 @@
15
  *
16
  */
17
 
18
- class SFC_Autoship_Block_Newsubscription_Form_Payment extends SFC_Autoship_Block_Subscription_Form_Payment
19
- {
20
-
21
- public function _prepareLayout()
22
- {
23
- // Set subscription on block
24
- $this->setSubscription(Mage::getSingleton('customer/session')->getNewSubscription());
25
-
26
- // Call parent
27
- parent::_prepareLayout();
28
- }
29
 
30
- public function getSubmitUrl()
31
- {
32
- return $this->getUrl('autoship/newsubscription/paymentsave');
33
- }
 
 
 
 
34
 
35
- }
 
 
 
15
  *
16
  */
17
 
18
+ /**
19
+ * Installer
20
+ */
21
+ $installer = $this;
22
+ $installer->startSetup();
 
 
 
 
 
 
23
 
24
+ /**
25
+ * Add new attribute to quote item
26
+ */
27
+ $installer->addAttribute('quote_item', 'subscription_reorder_ordinal', array(
28
+ 'type' => Varien_Db_Ddl_Table::TYPE_INTEGER,
29
+ 'visible' => false,
30
+ 'required' => false
31
+ ));
32
 
33
+ /**
34
+ * Clean up installer
35
+ */
36
+ $installer->endSetup();
app/design/frontend/base/default/layout/autoship.xml CHANGED
@@ -73,7 +73,7 @@
73
  <action method="addItem"><type>skin_css</type><name>js/autoship/jquery/ui/theme/jquery-ui.css</name></action>
74
 
75
  <action method="addItem"><type>skin_js</type><name>js/autoship/jquery/noconflict.js</name></action>
76
- <action method="addItem"><type>skin_js</type><name>js/autoship/newsubscription.js</name></action>
77
 
78
  <action method="addItem"><type>js_css</type><name>calendar/calendar-win2k-1.css</name><params/><!--<if/><condition>can_load_calendar_js</condition>--></action>
79
  <action method="addItem"><type>js</type><name>calendar/calendar.js</name><!--<params/><if/><condition>can_load_calendar_js</condition>--></action>
@@ -87,56 +87,11 @@
87
  <block type="core/html_calendar" name="html_calendar" as="html_calendar" template="page/js/calendar.phtml"/>
88
  </block>
89
  <block type="autoship/newsubscription" name="newsubscription.delivery_frequency" template="autoship/newsubscription/delivery_frequency.phtml" />
90
- <block type="autoship/newsubscription" name="newsubscription.payment" template="autoship/newsubscription/payment.phtml">
91
- <block type="autoship/newsubscription_form_payment" name="payment" template="autoship/subscription/form/payment.phtml" />
92
- </block>
93
- <block type="autoship/newsubscription" name="newsubscription.billing_address" template="autoship/newsubscription/billing_address.phtml">
94
- <block type="autoship/newsubscription_form_billing" name="billing_address_select" template="autoship/subscription/form/billing.phtml"/>
95
- </block>
96
- <block type="autoship/newsubscription" name="newsubscription.shipping_address" template="autoship/newsubscription/shipping_address.phtml">
97
- <block type="autoship/newsubscription_form_shipping" name="shipping_address_select" template="autoship/subscription/form/shipping.phtml"/>
98
- </block>
99
- <block type="autoship/newsubscription" name="newsubscription.summary" template="autoship/newsubscription/summary.phtml" />
100
  </block>
101
  </reference>
102
 
103
  </autoship_newsubscription_index>
104
 
105
- <!-- This layout handle handles all ajax controllers that update new subscription page contents -->
106
- <autoship_newsubscription_update>
107
- <remove name="right"/>
108
- <remove name="left"/>
109
-
110
- <block type="autoship/newsubscription" name="root" output="toHtml" template="autoship/newsubscription/ajax_update.phtml">
111
- <block type="autoship/newsubscription" name="newsubscription.delivery_date" template="autoship/newsubscription/delivery_date.phtml">
112
- <block type="core/html_calendar" name="html_calendar" as="html_calendar" template="page/js/calendar.phtml"/>
113
- </block>
114
- <block type="autoship/newsubscription" name="newsubscription.delivery_frequency" template="autoship/newsubscription/delivery_frequency.phtml" />
115
- <block type="autoship/newsubscription" name="newsubscription.payment" template="autoship/newsubscription/payment.phtml">
116
- <block type="autoship/newsubscription_form_payment" name="payment" template="autoship/subscription/form/payment.phtml" />
117
- </block>
118
- <block type="autoship/newsubscription" name="newsubscription.billing_address" template="autoship/newsubscription/billing_address.phtml">
119
- <block type="autoship/newsubscription_form_billing" name="billing_address_select" template="autoship/subscription/form/billing.phtml"/>
120
- </block>
121
- <block type="autoship/newsubscription" name="newsubscription.shipping_address" template="autoship/newsubscription/shipping_address.phtml">
122
- <block type="autoship/newsubscription_form_shipping" name="shipping_address_select" template="autoship/subscription/form/shipping.phtml"/>
123
- </block>
124
- <block type="autoship/newsubscription" name="newsubscription.summary" template="autoship/newsubscription/summary.phtml" />
125
- </block>
126
- </autoship_newsubscription_update>
127
-
128
- <autoship_newsubscription_paymentsave>
129
- <update handle="autoship_newsubscription_update"/>
130
- </autoship_newsubscription_paymentsave>
131
-
132
- <autoship_newsubscription_billingsave>
133
- <update handle="autoship_newsubscription_update"/>
134
- </autoship_newsubscription_billingsave>
135
-
136
- <autoship_newsubscription_shippingsave>
137
- <update handle="autoship_newsubscription_update"/>
138
- </autoship_newsubscription_shippingsave>
139
-
140
  <!--
141
  Product view
142
  -->
73
  <action method="addItem"><type>skin_css</type><name>js/autoship/jquery/ui/theme/jquery-ui.css</name></action>
74
 
75
  <action method="addItem"><type>skin_js</type><name>js/autoship/jquery/noconflict.js</name></action>
76
+ <action method="addItem"><type>skin_js</type><name>js/autoship/newsubscription.js</name></action>
77
 
78
  <action method="addItem"><type>js_css</type><name>calendar/calendar-win2k-1.css</name><params/><!--<if/><condition>can_load_calendar_js</condition>--></action>
79
  <action method="addItem"><type>js</type><name>calendar/calendar.js</name><!--<params/><if/><condition>can_load_calendar_js</condition>--></action>
87
  <block type="core/html_calendar" name="html_calendar" as="html_calendar" template="page/js/calendar.phtml"/>
88
  </block>
89
  <block type="autoship/newsubscription" name="newsubscription.delivery_frequency" template="autoship/newsubscription/delivery_frequency.phtml" />
 
 
 
 
 
 
 
 
 
 
90
  </block>
91
  </reference>
92
 
93
  </autoship_newsubscription_index>
94
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95
  <!--
96
  Product view
97
  -->
app/design/frontend/base/default/template/autoship/cart/product/subscription.phtml CHANGED
@@ -17,7 +17,6 @@
17
  */
18
  ?>
19
  <?php if(Mage::getStoreConfig('autoship_general/general/enabled') == '1'): ?>
20
- <?php if(Mage::getStoreConfig('autoship_subscription/subscription/use_new_subscription_page') != '1'): ?>
21
  <?php $quoteItem = $this->getQuoteItem(); ?>
22
  <?php if ($this->isItemSubscriptionEligible()): ?>
23
  <?php if($this->isTrialProduct() || $this->getSubscriptionOptionMode() == 'subscription_only'): // Subscription Only Mode or Trial Product - Only Subscription Option Allowed ?>
@@ -91,5 +90,4 @@
91
  </div>
92
  <?php endif; ?>
93
  <?php endif; ?>
94
- <?php endif; ?>
95
  <?php endif; ?>
17
  */
18
  ?>
19
  <?php if(Mage::getStoreConfig('autoship_general/general/enabled') == '1'): ?>
 
20
  <?php $quoteItem = $this->getQuoteItem(); ?>
21
  <?php if ($this->isItemSubscriptionEligible()): ?>
22
  <?php if($this->isTrialProduct() || $this->getSubscriptionOptionMode() == 'subscription_only'): // Subscription Only Mode or Trial Product - Only Subscription Option Allowed ?>
90
  </div>
91
  <?php endif; ?>
92
  <?php endif; ?>
 
93
  <?php endif; ?>
app/design/frontend/base/default/template/autoship/checkout/success.phtml CHANGED
@@ -17,7 +17,6 @@
17
  */
18
  ?>
19
  <?php if(Mage::getStoreConfig('autoship_general/general/enabled') == '1'): ?>
20
- <?php if(Mage::getStoreConfig('autoship_subscription/subscription/use_new_subscription_page') != '1'): ?>
21
  <?php $createdSubscriptionIds = $this->getCreatedSubscriptionIds(); ?>
22
  <?php if ($this->getFailedSubscriptionCount()): ?>
23
  <?php // Output error message ?>
@@ -28,5 +27,4 @@
28
  href="%s">manage your product subscriptions</a>.', $this->getUrl('autoship/mysubscriptions')) ?>
29
  </p>
30
  <?php endif; ?>
31
- <?php endif; ?>
32
  <?php endif; ?>
17
  */
18
  ?>
19
  <?php if(Mage::getStoreConfig('autoship_general/general/enabled') == '1'): ?>
 
20
  <?php $createdSubscriptionIds = $this->getCreatedSubscriptionIds(); ?>
21
  <?php if ($this->getFailedSubscriptionCount()): ?>
22
  <?php // Output error message ?>
27
  href="%s">manage your product subscriptions</a>.', $this->getUrl('autoship/mysubscriptions')) ?>
28
  </p>
29
  <?php endif; ?>
 
30
  <?php endif; ?>
app/design/frontend/base/default/template/autoship/newsubscription.phtml CHANGED
@@ -14,6 +14,14 @@
14
  * @link http://www.subscribepro.com/
15
  *
16
  */
 
 
 
 
 
 
 
 
17
  ?>
18
 
19
  <div class="page-title">
@@ -36,30 +44,22 @@
36
  <div class="block frequency-block">
37
  <?php echo $this->getChildHtml('newsubscription.delivery_frequency') ?>
38
  </div>
39
- <div class="block payment-block">
40
- <?php echo $this->getChildHtml('newsubscription.payment') ?>
41
- </div>
42
  <div class="clearer"></div>
43
  </div><!-- end bottom-top -->
44
- <div class="bottom-bottom">
45
- <div class="block billing-address-block">
46
- <?php echo $this->getChildHtml('newsubscription.billing_address') ?>
47
- </div>
48
- <div class="block shipping-address-block">
49
- <?php echo $this->getChildHtml('newsubscription.shipping_address') ?>
50
- </div>
51
- <div class="clearer"></div>
52
- </div><!-- end bottom-bottom -->
53
  </div><!-- end bottom-left -->
54
  <div class="bottom-right">
55
- <div class="block summary-block" id="newsubscription_summary">
56
- <?php echo $this->getChildHtml('newsubscription.summary') ?>
 
 
 
 
 
 
 
57
  </div>
58
  </div><!-- end bottom-right -->
59
  </div><!-- end bottom-row -->
60
- <span class="please-wait" id="please-wait" style="display:none;">
61
- <img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" alt="<?php echo $this->__('Updating...') ?>" title="<?php echo $this->__('Updating...') ?>" class="v-middle" /> <?php echo $this->__('Updating...') ?>
62
- </span>
63
  </div><!-- end new-subscription -->
64
 
65
  <div style="clear:both;"></div>
@@ -68,7 +68,7 @@
68
 
69
  <script type="text/javascript">
70
  //<![CDATA[
71
- var regionsJson =
72
  <?php echo $this->helper('directory')->getRegionJson() ?>
73
  ;
74
  //]]>
14
  * @link http://www.subscribepro.com/
15
  *
16
  */
17
+ $subscription = $this->getSubscription();
18
+
19
+ $childBlocks = array('product_info', 'delivery_date', 'delivery_frequency');
20
+
21
+ foreach($childBlocks as $child) {
22
+ $this->getChild('newsubscription.'. $child)->setSubscription($subscription);
23
+ }
24
+
25
  ?>
26
 
27
  <div class="page-title">
44
  <div class="block frequency-block">
45
  <?php echo $this->getChildHtml('newsubscription.delivery_frequency') ?>
46
  </div>
 
 
 
47
  <div class="clearer"></div>
48
  </div><!-- end bottom-top -->
 
 
 
 
 
 
 
 
 
49
  </div><!-- end bottom-left -->
50
  <div class="bottom-right">
51
+ <div class="summary-block">
52
+ <div class="messages"></div>
53
+ </div>
54
+ <div id="newsubscription_submit">
55
+ <ul class="messages"></ul>
56
+ <div class="subscribe-button-block">
57
+ <?php $buttonTitle = $this->__('Subscribe Now'); ?>
58
+ <button type="button" title="<?php echo $buttonTitle ?>" class="button btn-cart" id="subscribe" href="<?php echo $this->getPostActionUrl() ?>"><span><span><?php echo $buttonTitle ?></span></span></button>
59
+ </div><!-- end subscribe-button-block -->
60
  </div>
61
  </div><!-- end bottom-right -->
62
  </div><!-- end bottom-row -->
 
 
 
63
  </div><!-- end new-subscription -->
64
 
65
  <div style="clear:both;"></div>
68
 
69
  <script type="text/javascript">
70
  //<![CDATA[
71
+ var regionsJson =
72
  <?php echo $this->helper('directory')->getRegionJson() ?>
73
  ;
74
  //]]>
app/design/frontend/base/default/template/autoship/newsubscription/ajax_update.phtml CHANGED
@@ -20,17 +20,6 @@
20
  <?php echo $this->getChildHtml('newsubscription.delivery_date') ?>
21
  </div>
22
 
23
- <div class="block payment-block">
24
- <?php echo $this->getChildHtml('newsubscription.payment') ?>
25
- </div>
26
-
27
- <div class="block billing-address-block">
28
- <?php echo $this->getChildHtml('newsubscription.billing_address') ?>
29
- </div>
30
-
31
- <div class="block shipping-address-block">
32
- <?php echo $this->getChildHtml('newsubscription.shipping_address') ?>
33
- </div>
34
 
35
  <div class="block summary-block" id="newsubscription_summary">
36
  <?php echo $this->getChildHtml('newsubscription.summary') ?>
20
  <?php echo $this->getChildHtml('newsubscription.delivery_date') ?>
21
  </div>
22
 
 
 
 
 
 
 
 
 
 
 
 
23
 
24
  <div class="block summary-block" id="newsubscription_summary">
25
  <?php echo $this->getChildHtml('newsubscription.summary') ?>
app/design/frontend/base/default/template/autoship/newsubscription/billing_address.phtml DELETED
@@ -1,51 +0,0 @@
1
- <?php
2
- /**
3
- * Subscribe Pro - Subscriptions Management Extension
4
- *
5
- * PHP version 5
6
- *
7
- * LICENSE: This source file is subject to commercial source code license of SUBSCRIBE PRO INC.
8
- *
9
- * @category SFC
10
- * @package SFC_Autoship
11
- * @author Garth Brantley <garth@subscribepro.com>
12
- * @copyright 2009-2016 SUBSCRIBE PRO INC. All Rights Reserved.
13
- * @license http://www.subscribepro.com/terms-of-service/ Subscribe Pro Terms of Service
14
- * @link http://www.subscribepro.com/
15
- *
16
- */
17
- ?>
18
- <?php
19
- $subscription = $this->getSubscription();
20
- $billingAddress = $subscription->getBillingAddress();
21
- ?>
22
-
23
- <div class="block-title">
24
- <h2><?php echo $this->__("Billing Address") ?></h2>
25
- </div>
26
-
27
- <div class="box-padding">
28
- <p><?php echo $this->__("Please select the address associated with your payment method:") ?> <a class="change" href=""><?php echo $this->__("(Change)") ?></a></p>
29
-
30
- <address>
31
- <?php echo $billingAddress->getFirstname() ?> <?php echo $billingAddress->getLastname() ?><br/>
32
- <?php if(strlen($billingAddress->getCompany())): ?>
33
- <?php echo $billingAddress->getCompany() ?><br/>
34
- <?php endif; ?>
35
- <?php foreach($billingAddress->getStreet() as $street): ?>
36
- <?php echo $street ?><br/>
37
- <?php endforeach; ?>
38
- <?php echo $billingAddress->getCity() ?>, <?php echo $billingAddress->getRegion() ?> <?php echo $billingAddress->getPostcode() ?><br/>
39
- </address>
40
-
41
- <input type="text" id="billing_address_id" name="billing_address_id" value="<?php echo $billingAddress->getId() ?>" class="input-text" style="display:none;" />
42
-
43
- <div class="change">
44
- <div class="block-title">
45
- <h2><?php echo $this->__("Change Billing Address") ?></h2>
46
- </div>
47
- <div class="block-content">
48
- <?php echo $this->getChildHtml("billing_address_select") ?>
49
- </div>
50
- </div>
51
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/base/default/template/autoship/newsubscription/delivery_date.phtml CHANGED
@@ -14,11 +14,8 @@
14
  * @link http://www.subscribepro.com/
15
  *
16
  */
17
- ?>
18
- <?php
19
  $subscription = $this->getSubscription();
20
  ?>
21
-
22
  <div class="box-padding">
23
  <div class="field">
24
  <label for="delivery_date"><?php echo $this->__('Your first delivery will be shipped on:') ?></label>
@@ -31,8 +28,8 @@ $subscription = $this->getSubscription();
31
  //<![CDATA[
32
  $j(function(){
33
  $j("#delivery_date").datepicker({
34
- minDate: 2,
35
- showOn: "button",
36
  buttonImage: "<?php echo $this->getSkinUrl('images/autoship/calendar_icon.png')?>",
37
  buttonImageOnly: true,
38
  buttonText: "Click to change date.",
@@ -40,4 +37,4 @@ $subscription = $this->getSubscription();
40
  });
41
  });
42
  //]]>
43
- </script>
14
  * @link http://www.subscribepro.com/
15
  *
16
  */
 
 
17
  $subscription = $this->getSubscription();
18
  ?>
 
19
  <div class="box-padding">
20
  <div class="field">
21
  <label for="delivery_date"><?php echo $this->__('Your first delivery will be shipped on:') ?></label>
28
  //<![CDATA[
29
  $j(function(){
30
  $j("#delivery_date").datepicker({
31
+ minDate: "+2",
32
+ showOn: "both",
33
  buttonImage: "<?php echo $this->getSkinUrl('images/autoship/calendar_icon.png')?>",
34
  buttonImageOnly: true,
35
  buttonText: "Click to change date.",
37
  });
38
  });
39
  //]]>
40
+ </script>
app/design/frontend/base/default/template/autoship/newsubscription/delivery_frequency.phtml CHANGED
@@ -19,26 +19,35 @@
19
  $subscription = $this->getSubscription();
20
  $qty = $subscription->getQty();
21
  $intervals = $this->getIntervals();
22
- $platformProduct = $this->getPlatformProduct();
 
 
 
 
 
 
 
 
 
23
  ?>
24
 
25
  <div class="block-title">
26
- <h2><?php echo $this->__("Delivery Frequency") ?></h2>
27
  </div>
28
 
29
  <div class="box-padding">
30
  <p>
31
- <input type="hidden" id="frequency_form" value="<?php echo Mage::getUrl('autoship/newsubscription/update') ?>" />
32
- <select id="delivery_qty" name="delivery_qty" class="" title="Quantity">
33
- <?php for($i=$platformProduct->getMinQty(); $i<=$platformProduct->getMaxQty(); $i++): ?>
34
- <option value="<?php echo $i ?>" <?php if($qty == $i): ?>selected="selected"<?php endif; ?>><?php echo $i ?></option>
35
- <?php endfor; ?>
36
- </select>
37
- <?php echo $this->__("unit(s) every") ?>
38
- <select id="delivery_interval" name="delivery_interval" class="" title="Delivery Interval">
39
- <?php foreach($intervals as $interval): ?>
40
- <option value="<?php echo $interval ?>" <?php if($interval == $subscription->getInterval()): ?>selected="selected"<?php endif; ?>><?php echo $interval ?></option>
41
- <?php endforeach; ?>
42
- </select>
43
  </p>
44
  </div>
19
  $subscription = $this->getSubscription();
20
  $qty = $subscription->getQty();
21
  $intervals = $this->getIntervals();
22
+ $platformProduct = $subscription->getPlatformProduct();
23
+
24
+ // Determine which interval should be selected when the page is loaded
25
+ // Default first to any value in the URL
26
+ // If no valid value is given there, default to any previously selected interval
27
+ // Finally, if nothing else, pre-select the default interval set on the SP product
28
+ $selected_interval = Mage::app()->getRequest()->getParam('delivery_interval');
29
+ if (!$selected_interval || !in_array($selected_interval, $intervals)) {
30
+ $selected_interval = $subscription->getInterval() ?: $platformProduct->getDefaultInterval();
31
+ }
32
  ?>
33
 
34
  <div class="block-title">
35
+ <h2><?php echo $this->__("Delivery Frequency") ?></h2>
36
  </div>
37
 
38
  <div class="box-padding">
39
  <p>
40
+ <input type="hidden" id="frequency_form" value="<?php echo Mage::getUrl('autoship/newsubscription/update') ?>" />
41
+ <select id="delivery_qty" name="delivery_qty" class="" title="Quantity">
42
+ <?php for ($i = $platformProduct->getMinQty(); $i <= $platformProduct->getMaxQty(); $i++): ?>
43
+ <option value="<?php echo $i ?>" <?php if($qty == $i): ?>selected="selected"<?php endif; ?>><?php echo $i ?></option>
44
+ <?php endfor; ?>
45
+ </select>
46
+ <?php echo $this->__("unit(s) every") ?>
47
+ <select id="delivery_interval" name="delivery_interval" class="" title="Delivery Interval">
48
+ <?php foreach ($intervals as $interval): ?>
49
+ <option value="<?php echo $interval ?>" <?php if($interval == $selected_interval): ?>selected="selected"<?php endif; ?>><?php echo $interval ?></option>
50
+ <?php endforeach; ?>
51
+ </select>
52
  </p>
53
  </div>
app/design/frontend/base/default/template/autoship/newsubscription/payment.phtml DELETED
@@ -1,80 +0,0 @@
1
- <?php
2
- /**
3
- * Subscribe Pro - Subscriptions Management Extension
4
- *
5
- * PHP version 5
6
- *
7
- * LICENSE: This source file is subject to commercial source code license of SUBSCRIBE PRO INC.
8
- *
9
- * @category SFC
10
- * @package SFC_Autoship
11
- * @author Garth Brantley <garth@subscribepro.com>
12
- * @author Dennis Rogers <dennis@storefrontconsulting.com>
13
- * @copyright 2009-2016 SUBSCRIBE PRO INC. All Rights Reserved.
14
- * @license http://www.subscribepro.com/terms-of-service/ Subscribe Pro Terms of Service
15
- * @link http://www.subscribepro.com/
16
- *
17
- */
18
- ?>
19
- <?php
20
- $subscription = $this->getSubscription();
21
- $paymentProfile = $subscription->getPaymentProfile();
22
- ?>
23
-
24
- <div class="block-title">
25
- <h2><?php echo $this->__("Payment Method") ?></h2>
26
- </div>
27
-
28
- <div class="box-padding">
29
- <?php if($paymentProfile->getCustomerCardnumber()): ?>
30
- <p><?php echo $this->__("Credit card ending in") ?> <?php echo $paymentProfile->getCustomerCardnumber() ?>. <a class="change" href=""><?php echo $this->__("(Change)") ?></a></p>
31
- <?php else: ?>
32
- <p>Haven't saved a credit card yet? <a class="change" href="">Add one now</a>.</p>
33
- <p><?php
34
- echo $this->__('Haven\'t saved a credit card yet? <a class="change" href="">Add one now</a>.');
35
- ?></p>
36
- <?php endif; ?>
37
-
38
- <?php if ($this->useCouponCode()): ?>
39
- <br/>
40
-
41
- <div class="field">
42
- <label for="coupon_code"><?php echo $this->__('Enter coupon code:') ?></label>
43
- <div class="input-box">
44
- <input type="text" id="coupon_code" name="coupon_code" value="<?php echo $subscription->getCouponCode() ?>"
45
- class="input-text"/>
46
- </div>
47
- </div>
48
- <?php endif; ?>
49
-
50
- <input type="text" id="cim_payment_profile_id" name="cim_payment_profile_id" value="<?php echo $paymentProfile->getId() ?>" class="input-text" style="display:none;" />
51
-
52
- <div class="change" style="display:none;">
53
- <div class="block-title">
54
- <h2><?php echo $this->__("Change Payment Method") ?></h2>
55
- </div>
56
- <div class="block-content">
57
- <?php echo $this->getChildHtml("payment") ?>
58
- </div>
59
- </div>
60
-
61
- </div>
62
- <script type="text/javascript">
63
- //<![CDATA[
64
- $j(function(){
65
- if($j('input[name="payment[method]"]').size() == 1){
66
- $j('input[name="payment[method]"]').parent('dt').hide();
67
- $j('input[name="payment[method]"]').click();
68
- }
69
- $j('input[name="payment[method]"]').on('change', function(){
70
- hideCcForm();
71
- });
72
- hideCcForm();
73
- });
74
- function hideCcForm(){
75
- if($j("#p_method_authnettoken").is("input")){
76
- $j(".new-cc-form-list").toggle($j("#p_method_authnettoken").is(":checked"));
77
- }
78
- }
79
- //]]>
80
- </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/base/default/template/autoship/newsubscription/product_info.phtml CHANGED
@@ -17,20 +17,21 @@
17
  ?>
18
  <?php
19
  // Get product and profile
20
- $product = $this->getProduct();
21
- $platformProduct = $this->getPlatformProduct();
22
  ?>
23
 
24
  <div class="top-image">
25
  <?php // Product Image ?>
26
  <a href="<?php echo $product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($product, 'small_image'), null, true) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($product, 'small_image')->resize(80); ?>" width="80" height="80" alt="<?php echo $this->stripTags($this->getImageLabel($product, 'small_image'), null, true) ?>" /></a>
27
  </div>
 
28
  <div class="top-name">
29
  <?php // Product Name ?>
30
  <?php $_productNameStripped = $this->stripTags($product->getName(), null, true); ?>
31
  <h2 class="product-name"><a href="<?php echo $product->getProductUrl() ?>" title="<?php echo $_productNameStripped; ?>"><?php echo $product->getName() ?></a></h2>
32
 
33
  <input type="text" id="product_id" name="product_id" value="<?php echo $product->getId() ?>" class="input-text" style="display:none;" />
34
- <input type="text" id="product_profile_id" name="product_profile_id" value="<?php echo $platformProduct->getId() ?>" class="input-text" style="display:none;" />
35
 
36
  </div>
17
  ?>
18
  <?php
19
  // Get product and profile
20
+ $product = $this->getSubscription()->getProduct();
21
+ $platformProduct = $this->getSubscription()->getPlatformProduct();
22
  ?>
23
 
24
  <div class="top-image">
25
  <?php // Product Image ?>
26
  <a href="<?php echo $product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($product, 'small_image'), null, true) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($product, 'small_image')->resize(80); ?>" width="80" height="80" alt="<?php echo $this->stripTags($this->getImageLabel($product, 'small_image'), null, true) ?>" /></a>
27
  </div>
28
+
29
  <div class="top-name">
30
  <?php // Product Name ?>
31
  <?php $_productNameStripped = $this->stripTags($product->getName(), null, true); ?>
32
  <h2 class="product-name"><a href="<?php echo $product->getProductUrl() ?>" title="<?php echo $_productNameStripped; ?>"><?php echo $product->getName() ?></a></h2>
33
 
34
  <input type="text" id="product_id" name="product_id" value="<?php echo $product->getId() ?>" class="input-text" style="display:none;" />
35
+ <input type="text" id="product_profile_id" name="product_profile_id" value="<?php echo $platformProduct->getData('id') ?>" class="input-text" style="display:none;" />
36
 
37
  </div>
app/design/frontend/base/default/template/autoship/newsubscription/shipping_address.phtml DELETED
@@ -1,51 +0,0 @@
1
- <?php
2
- /**
3
- * Subscribe Pro - Subscriptions Management Extension
4
- *
5
- * PHP version 5
6
- *
7
- * LICENSE: This source file is subject to commercial source code license of SUBSCRIBE PRO INC.
8
- *
9
- * @category SFC
10
- * @package SFC_Autoship
11
- * @author Garth Brantley <garth@subscribepro.com>
12
- * @copyright 2009-2016 SUBSCRIBE PRO INC. All Rights Reserved.
13
- * @license http://www.subscribepro.com/terms-of-service/ Subscribe Pro Terms of Service
14
- * @link http://www.subscribepro.com/
15
- *
16
- */
17
- ?>
18
- <?php
19
- $subscription = $this->getSubscription();
20
- $shippingAddress = $subscription->getShippingAddress();
21
- ?>
22
-
23
- <div class="block-title">
24
- <h2><?php echo $this->__("Shipping Address") ?></h2>
25
- </div>
26
-
27
- <div class="box-padding">
28
- <p><?php echo $this->__("Please select the address where your orders should be delivered:") ?> <a class="change" href=""><?php echo $this->__("(Change)") ?></a></p>
29
-
30
- <address>
31
- <?php echo $shippingAddress->getFirstname() ?> <?php echo $shippingAddress->getLastname() ?><br/>
32
- <?php if(strlen($shippingAddress->getCompany())): ?>
33
- <?php echo $shippingAddress->getCompany() ?><br/>
34
- <?php endif; ?>
35
- <?php foreach($shippingAddress->getStreet() as $street): ?>
36
- <?php echo $street ?><br/>
37
- <?php endforeach; ?>
38
- <?php echo $shippingAddress->getCity() ?>, <?php echo $shippingAddress->getRegion() ?> <?php echo $shippingAddress->getPostcode() ?><br/>
39
- </address>
40
-
41
- <input type="text" id="shipping_address_id" name="shipping_address_id" value="<?php echo $shippingAddress->getId() ?>" class="input-text" style="display:none;" />
42
-
43
- <div class="change">
44
- <div class="block-title">
45
- <h2><?php echo $this->__("Change Shipping Address") ?></h2>
46
- </div>
47
- <div class="block-content">
48
- <?php echo $this->getChildHtml("shipping_address_select") ?>
49
- </div>
50
- </div>
51
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/base/default/template/autoship/newsubscription/summary.phtml DELETED
@@ -1,69 +0,0 @@
1
- <?php
2
- /**
3
- * Subscribe Pro - Subscriptions Management Extension
4
- *
5
- * PHP version 5
6
- *
7
- * LICENSE: This source file is subject to commercial source code license of SUBSCRIBE PRO INC.
8
- *
9
- * @category SFC
10
- * @package SFC_Autoship
11
- * @author Garth Brantley <garth@subscribepro.com>
12
- * @copyright 2009-2016 SUBSCRIBE PRO INC. All Rights Reserved.
13
- * @license http://www.subscribepro.com/terms-of-service/ Subscribe Pro Terms of Service
14
- * @link http://www.subscribepro.com/
15
- *
16
- */
17
- ?>
18
- <?php
19
- $subscription = $this->getSubscription();
20
- $summary = $this->getSummary();
21
- $coreHelper = $this->helper('core');
22
- ?>
23
-
24
- <div class="block-title">
25
- <h2><?php echo $this->__("Estimated Order Summary") ?></h2>
26
- </div>
27
- <ul class="messages"></ul>
28
- <div class="box-padding">
29
- <?php // If $summary is an array, it has totals, otherwise it's a string with error message ?>
30
- <?php if (is_array($summary)): ?>
31
- <p><?php echo $this->__("The following are the estimated costs for each of your shipments:") ?></p>
32
- <div class="subscription-summary-table">
33
- <table>
34
- <tbody>
35
- <tr>
36
- <td class="a-right"><?php echo $this->__("Product Total") ?></td>
37
- <td class="a-right"><?php echo $coreHelper->currency($summary['product_total'], true, false); ?></td>
38
- </tr>
39
- <tr>
40
- <td class="a-right"><?php echo $this->__("Subscription Discount") ?></td>
41
- <td class="a-right"><?php echo $coreHelper->currency($summary['discount'], true, false); ?></td>
42
- </tr>
43
- <tr>
44
- <td class="a-right"><?php echo $this->__("Shipping") ?></td>
45
- <td class="a-right"><?php echo $coreHelper->currency($summary['shipping'], true, false); ?></td>
46
- </tr>
47
- <tr>
48
- <td class="a-right"><?php echo $this->__("Tax") ?></td>
49
- <td class="a-right"><?php echo $coreHelper->currency($summary['tax'], true, false); ?></td>
50
- </tr>
51
- </tbody>
52
- <tfoot>
53
- <tr>
54
- <td class="a-right"><strong><?php echo $this->__("Estimated Order Total") ?></strong></td>
55
- <td class="a-right"><strong><span class="price"><?php echo $coreHelper->currency($summary['total'], true, false); ?></span></strong></td>
56
- </tr>
57
- </tfoot>
58
- </table>
59
- </div><!-- subscription-summary-table -->
60
- <div style="clear:both;"></div>
61
- <?php // If $summary is an array, it has totals, otherwise it's a string with error message ?>
62
- <?php else: ?>
63
- <p><?php echo $summary ?></p>
64
- <?php endif; ?>
65
- </div><!-- end box-padding -->
66
- <div class="subscribe-button-block">
67
- <?php $buttonTitle = $this->__('Subscribe Now'); ?>
68
- <button type="button" title="<?php echo $buttonTitle ?>" class="button btn-cart" id="subscribe" href="<?php echo $this->getPostActionUrl() ?>"><span><span><?php echo $buttonTitle ?></span></span></button>
69
- </div><!-- end subscribe-button-block -->
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/base/default/template/autoship/product/subscribe.phtml CHANGED
@@ -68,31 +68,5 @@
68
  </ul>
69
  </div>
70
  <?php endif; ?>
71
- <?php if(Mage::getStoreConfig('autoship_subscription/subscription/use_new_subscription_page') == '1'): ?>
72
- <script type="text/javascript">
73
- //<![CDATA[
74
- $j = jQuery;
75
- $j(document).ready(function () {
76
- toggleAddToCart();
77
- $j('input[name=delivery-option]').bind('change', function () {
78
- toggleAddToCart();
79
- });
80
- $j('#subscribe_button').bind('click', function (e) {
81
- e.preventDefault();
82
- window.location = '<?php echo $this->getUrl('autoship/newsubscription/index') ?>product_id/<?php echo $this->getProduct()->getId() ?>/qty/' + $j('#qty').val() + '/interval/' + $j('#delivery-interval').val() + '/';
83
- });
84
- });
85
- function toggleAddToCart() {
86
- if ($j('#delivery-option-one-time').is(':checked')) {
87
- $j('#add_to_cart').show();
88
- $j('#subscribe').hide();
89
- } else {
90
- $j('#add_to_cart').hide();
91
- $j('#subscribe').show();
92
- }
93
- }
94
- //]]>
95
- </script>
96
- <?php endif; ?>
97
  <?php endif; ?>
98
  <?php endif; ?>
68
  </ul>
69
  </div>
70
  <?php endif; ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
  <?php endif; ?>
72
  <?php endif; ?>
app/design/frontend/base/default/template/autoship/product/view/addtocart.phtml CHANGED
@@ -16,24 +16,6 @@
16
  */
17
  ?>
18
  <?php $_product = $this->getProduct(); ?>
19
- <?php if(Mage::getStoreConfig('autoship_general/general/enabled') == '1'): ?>
20
- <?php $_useNewSubPage = Mage::getStoreConfig('autoship_subscription/subscription/use_new_subscription_page') == '1'; ?>
21
- <?php // Do autoship version of add to cart block? ?>
22
- <?php if($_useNewSubPage && $this->isProductAutoshipEligible()): ?>
23
- <?php $buttonTitle = $this->__('Subscribe Now'); ?>
24
- <?php if($_product->isSaleable()): ?>
25
- <div class="add-to-cart" id="subscribe" style="display:none;">
26
- <?php if(!$_product->isGrouped()): ?>
27
- <label for="qty"><?php echo $this->__('Qty:') ?></label>
28
- <input type="text" name="qty" id="qty" maxlength="12" value="<?php echo $this->getProductDefaultQty() * 1 ?>" title="<?php echo $this->__('Qty') ?>" class="input-text qty" />
29
- <?php endif; ?>
30
- <button id="subscribe_button" type="button" title="<?php echo $buttonTitle ?>" class="button btn-cart" onclick=""><span><span><?php echo $buttonTitle ?></span></span></button>
31
- <?php echo $this->getChildHtml('', true, true) ?>
32
- </div>
33
- <?php endif; ?>
34
- <?php endif; ?>
35
- <?php endif; ?>
36
- <?php // Spit out regular version of add to cart block? ?>
37
  <?php $buttonTitle = $this->__('Add to Cart'); ?>
38
  <?php if($_product->isSaleable()): ?>
39
  <div class="add-to-cart" id="add_to_cart">
16
  */
17
  ?>
18
  <?php $_product = $this->getProduct(); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  <?php $buttonTitle = $this->__('Add to Cart'); ?>
20
  <?php if($_product->isSaleable()): ?>
21
  <div class="add-to-cart" id="add_to_cart">
app/design/frontend/base/default/template/autoship/product/view/type/grouped/subscribe.phtml CHANGED
@@ -20,46 +20,44 @@
20
  $productId = $this->getProduct()->getId();
21
  ?>
22
  <?php if (Mage::getStoreConfig('autoship_general/general/enabled') == '1'): ?>
23
- <?php if (Mage::getStoreConfig('autoship_subscription/subscription/use_new_subscription_page') != '1'): ?>
24
- <?php if ($this->isProductAutoshipEligible()): ?>
25
- <div class="subscription-product">
26
- <ul class="options-list">
27
- <li>
28
- <input type="radio" onclick="" class="radio" id="delivery-option-one-time" name="delivery-option[<?php echo $productId ?>]"
29
- value="one-time-delivery"/>
30
 
31
- <div class="radio-text">
32
- <span class=label>
33
- <label for="delivery-option-one-time"><?php echo $this->__("One Time Delivery") ?></label>
34
- </span>
35
 
36
- <p><span class="price">Price: <?php echo $this->getOneTimePurchasePrice(true) ?></span></p>
37
- </div>
38
- <div class="clearer"></div>
39
- </li>
40
- <li>
41
- <div class="radio-text">
42
- <input type="radio" onclick="" class="radio" id="delivery-option-subscribe" name="delivery-option[<?php echo $productId ?>]"
43
- value="subscribe" checked="checked"/>
44
- <span class=label>
45
- <label for="delivery-option-subscribe"><?php echo $this->__("Regular Delivery") ?></label>
46
- </span>
47
 
48
- <p><span class="product-price"><?php echo $this->getDiscountText() ?></span></p>
49
 
50
- <p>
51
- <label for="delivery-interval"><?php echo $this->__("Delivery every:") ?></label><br/>
52
- <select onchange="" id="delivery-interval" name="delivery-interval[<?php echo $productId ?>]" class="">
53
- <?php foreach ($this->getIntervals() as $interval): ?>
54
- <option value="<?php echo $interval ?>" <?php if($interval == $this->getDefaultInterval()): ?> selected="selected"<?php endif; ?>><?php echo $interval ?></option>
55
- <?php endforeach; ?>
56
- </select>
57
- </p>
58
- </div>
59
- <div class="clearer"></div>
60
- </li>
61
- </ul>
62
- </div>
63
- <?php endif; ?>
64
  <?php endif; ?>
65
  <?php endif; ?>
20
  $productId = $this->getProduct()->getId();
21
  ?>
22
  <?php if (Mage::getStoreConfig('autoship_general/general/enabled') == '1'): ?>
23
+ <?php if ($this->isProductAutoshipEligible()): ?>
24
+ <div class="subscription-product">
25
+ <ul class="options-list">
26
+ <li>
27
+ <input type="radio" onclick="" class="radio" id="delivery-option-one-time" name="delivery-option[<?php echo $productId ?>]"
28
+ value="one-time-delivery"/>
 
29
 
30
+ <div class="radio-text">
31
+ <span class=label>
32
+ <label for="delivery-option-one-time"><?php echo $this->__("One Time Delivery") ?></label>
33
+ </span>
34
 
35
+ <p><span class="price">Price: <?php echo $this->getOneTimePurchasePrice(true) ?></span></p>
36
+ </div>
37
+ <div class="clearer"></div>
38
+ </li>
39
+ <li>
40
+ <div class="radio-text">
41
+ <input type="radio" onclick="" class="radio" id="delivery-option-subscribe" name="delivery-option[<?php echo $productId ?>]"
42
+ value="subscribe" checked="checked"/>
43
+ <span class=label>
44
+ <label for="delivery-option-subscribe"><?php echo $this->__("Regular Delivery") ?></label>
45
+ </span>
46
 
47
+ <p><span class="product-price"><?php echo $this->getDiscountText() ?></span></p>
48
 
49
+ <p>
50
+ <label for="delivery-interval"><?php echo $this->__("Delivery every:") ?></label><br/>
51
+ <select onchange="" id="delivery-interval" name="delivery-interval[<?php echo $productId ?>]" class="">
52
+ <?php foreach ($this->getIntervals() as $interval): ?>
53
+ <option value="<?php echo $interval ?>" <?php if($interval == $this->getDefaultInterval()): ?> selected="selected"<?php endif; ?>><?php echo $interval ?></option>
54
+ <?php endforeach; ?>
55
+ </select>
56
+ </p>
57
+ </div>
58
+ <div class="clearer"></div>
59
+ </li>
60
+ </ul>
61
+ </div>
 
62
  <?php endif; ?>
63
  <?php endif; ?>
app/design/frontend/enterprise/default/layout/autoship.xml CHANGED
@@ -74,7 +74,8 @@
74
  <action method="addItem"><type>skin_css</type><name>js/autoship/jquery/ui/theme/jquery-ui.css</name></action>
75
 
76
  <action method="addItem"><type>skin_js</type><name>js/autoship/jquery/noconflict.js</name></action>
77
- <action method="addItem"><type>skin_js</type><name>js/autoship/newsubscription.js</name></action>
 
78
 
79
  <action method="addItem"><type>js_css</type><name>calendar/calendar-win2k-1.css</name><params/><!--<if/><condition>can_load_calendar_js</condition>--></action>
80
  <action method="addItem"><type>js</type><name>calendar/calendar.js</name><!--<params/><if/><condition>can_load_calendar_js</condition>--></action>
@@ -88,44 +89,11 @@
88
  <block type="core/html_calendar" name="html_calendar" as="html_calendar" template="page/js/calendar.phtml"/>
89
  </block>
90
  <block type="autoship/newsubscription" name="newsubscription.delivery_frequency" template="autoship/newsubscription/delivery_frequency.phtml" />
91
- <block type="autoship/newsubscription" name="newsubscription.payment" template="autoship/newsubscription/payment.phtml">
92
- <block type="autoship/newsubscription_form_payment" name="payment" template="autoship/subscription/form/payment.phtml" />
93
- </block>
94
- <block type="autoship/newsubscription" name="newsubscription.billing_address" template="autoship/newsubscription/billing_address.phtml">
95
- <block type="autoship/newsubscription_form_billing" name="billing_address_select" template="autoship/subscription/form/billing.phtml"/>
96
- </block>
97
- <block type="autoship/newsubscription" name="newsubscription.shipping_address" template="autoship/newsubscription/shipping_address.phtml">
98
- <block type="autoship/newsubscription_form_shipping" name="shipping_address_select" template="autoship/subscription/form/shipping.phtml"/>
99
- </block>
100
- <block type="autoship/newsubscription" name="newsubscription.summary" template="autoship/newsubscription/summary.phtml" />
101
  </block>
102
  </reference>
103
 
104
  </autoship_newsubscription_index>
105
 
106
- <!-- This layout handle handles all ajax controllers that update new subscription page contents -->
107
- <autoship_newsubscription_update>
108
- <remove name="right"/>
109
- <remove name="left"/>
110
-
111
- <block type="autoship/newsubscription" name="root" output="toHtml" template="autoship/newsubscription/ajax_update.phtml">
112
- <block type="autoship/newsubscription" name="newsubscription.delivery_date" template="autoship/newsubscription/delivery_date.phtml">
113
- <block type="core/html_calendar" name="html_calendar" as="html_calendar" template="page/js/calendar.phtml"/>
114
- </block>
115
- <block type="autoship/newsubscription" name="newsubscription.delivery_frequency" template="autoship/newsubscription/delivery_frequency.phtml" />
116
- <block type="autoship/newsubscription" name="newsubscription.payment" template="autoship/newsubscription/payment.phtml">
117
- <block type="autoship/newsubscription_form_payment" name="payment" template="autoship/subscription/form/payment.phtml" />
118
- </block>
119
- <block type="autoship/newsubscription" name="newsubscription.billing_address" template="autoship/newsubscription/billing_address.phtml">
120
- <block type="autoship/newsubscription_form_billing" name="billing_address_select" template="autoship/subscription/form/billing.phtml"/>
121
- </block>
122
- <block type="autoship/newsubscription" name="newsubscription.shipping_address" template="autoship/newsubscription/shipping_address.phtml">
123
- <block type="autoship/newsubscription_form_shipping" name="shipping_address_select" template="autoship/subscription/form/shipping.phtml"/>
124
- </block>
125
- <block type="autoship/newsubscription" name="newsubscription.summary" template="autoship/newsubscription/summary.phtml" />
126
- </block>
127
- </autoship_newsubscription_update>
128
-
129
  <autoship_newsubscription_paymentsave>
130
  <update handle="autoship_newsubscription_update"/>
131
  </autoship_newsubscription_paymentsave>
@@ -252,9 +220,10 @@ Product view
252
  </checkout_onepage_index>
253
 
254
  <!-- EE Only, ensure the gift card function is not hiding subscribe pro -->
255
- <checkout_onepage_paymentmethod>
256
- <reference name="giftcardaccount_scripts">
257
- <action method="setTemplate"><template>autoship/giftcardaccount/onepage/payment/scripts.phtml</template></action>
258
- </reference>
259
- </checkout_onepage_paymentmethod>
 
260
  </layout>
74
  <action method="addItem"><type>skin_css</type><name>js/autoship/jquery/ui/theme/jquery-ui.css</name></action>
75
 
76
  <action method="addItem"><type>skin_js</type><name>js/autoship/jquery/noconflict.js</name></action>
77
+ <action method="addItem"><type>skin_js</type><name>js/autoship/newsubscription.js</name></action>
78
+
79
 
80
  <action method="addItem"><type>js_css</type><name>calendar/calendar-win2k-1.css</name><params/><!--<if/><condition>can_load_calendar_js</condition>--></action>
81
  <action method="addItem"><type>js</type><name>calendar/calendar.js</name><!--<params/><if/><condition>can_load_calendar_js</condition>--></action>
89
  <block type="core/html_calendar" name="html_calendar" as="html_calendar" template="page/js/calendar.phtml"/>
90
  </block>
91
  <block type="autoship/newsubscription" name="newsubscription.delivery_frequency" template="autoship/newsubscription/delivery_frequency.phtml" />
 
 
 
 
 
 
 
 
 
 
92
  </block>
93
  </reference>
94
 
95
  </autoship_newsubscription_index>
96
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
97
  <autoship_newsubscription_paymentsave>
98
  <update handle="autoship_newsubscription_update"/>
99
  </autoship_newsubscription_paymentsave>
220
  </checkout_onepage_index>
221
 
222
  <!-- EE Only, ensure the gift card function is not hiding subscribe pro -->
223
+ <checkout_onepage_paymentmethod>
224
+ <reference name="giftcardaccount_scripts">
225
+ <action method="setTemplate"><template>autoship/giftcardaccount/onepage/payment/scripts.phtml</template></action>
226
+ </reference>
227
+ </checkout_onepage_paymentmethod>
228
+
229
  </layout>
app/design/frontend/{base → enterprise}/default/template/autoship/giftcardaccount/onepage/payment/scripts.phtml RENAMED
File without changes
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>SFC_Autoship</name>
4
- <version>1.3.2.10</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.subscribepro.com/terms-of-service/">Subscribe Pro Commercial Software License</license>
7
  <channel>community</channel>
@@ -10,9 +10,9 @@
10
  <description>Manage your auto-ship program, customer subscription payments and recurring billing transactions to optimize customer retention and recurring revenue. The Subscribe Pro Extension for Magento allows you to easily implement subscriptions and recurring billing on your Magento website. Our extension is fully integrated into Magento and allows you to acquire and manage subscription customers directly in the Magento admin panel.</description>
11
  <notes>Subscribe Pro Extension Release</notes>
12
  <authors><author><name>Subscribe Pro</name><user>SF_Consulting</user><email>support@subscribepro.com</email></author></authors>
13
- <date>2016-03-09</date>
14
- <time>15:11:48</time>
15
- <contents><target name="magelocal"><dir name="SFC"><dir name="Autoship"><dir name="Block"><dir name="Adminhtml"><dir name="Customer"><dir name="Edit"><file name="Tabs.php" hash="324faebed3f1933a3dd46ff949257c12"/></dir><dir name="Paymentprofiles"><dir name="Edit"><file name="Form.php" hash="48dd98caa098dde6e642447f8aca0cd7"/><dir name="Tab"><file name="Form.php" hash="b5789783aac319c7e6e23bbb42cc403c"/></dir><file name="Tabs.php" hash="f86bc9159c34cb846af86bcba7ca09aa"/></dir><file name="Edit.php" hash="eac8c180a3ff1c1673edb61ef0166530"/><file name="Paymentprofile.php" hash="e4fe5d2cfa6d446783750a443584fd79"/></dir></dir><dir name="Sales"><dir name="Order"><dir name="Create"><dir name="Billing"><dir name="Method"><file name="Form.php" hash="2cc22fddd456dcc5e6ff9c4ae7ff0bab"/></dir></dir><file name="Jsonp.php" hash="4eb6d87cceeb063877f2ba86172f3a53"/><dir name="Product"><file name="Subscription.php" hash="13c3d8310779448571fba86109e2a750"/></dir></dir></dir></dir><dir name="System"><dir name="Config"><dir name="Form"><file name="Fielddisabled.php" hash="bc205c4afee290c5bc8e9173cec85fc2"/><file name="TestConnectionButton.php" hash="9af7b9a40f0220a8451360aea45ba5eb"/></dir></dir></dir></dir><dir name="Cart"><dir name="Product"><file name="Subscription.php" hash="174d55a19fb76ab001b43ff47d521c23"/></dir></dir><dir name="Checkout"><file name="Jsonp.php" hash="5df75ab21f0dd29ffe468c85669aadfa"/><dir name="Onepage"><dir name="Payment"><file name="Methods.php" hash="a01fc64048f13f5db109c30ca2301897"/></dir></dir></dir><dir name="Mysubscriptions"><dir name="Subscription"><dir name="Form"><file name="Billing.php" hash="ef440cdafd32896c586b48d8a8a75c8d"/><file name="Payment.php" hash="e8d2117f3e37d067076ffa1c41a73652"/><file name="Shipping.php" hash="01415536b26fefa6d15baf67657f3e53"/></dir></dir><file name="Subscription.php" hash="a04b9d72edb4b5ff2a36d3caac2c9de7"/></dir><file name="Mysubscriptions.php" hash="14ce3b7b0ba963142f71b39c8b04a1c5"/><dir name="Newsubscription"><dir name="Form"><file name="Billing.php" hash="08f8d7b1448ed98ea7a5e387712f0fcf"/><file name="Payment.php" hash="aa64cb7800dd136e118bf4b57bf23c12"/><file name="Shipping.php" hash="581275f5681f6a0a71155d5034491fa5"/></dir></dir><file name="Newsubscription.php" hash="ba9b88e0bce5f4d9fc4df87f0babb6f3"/><dir name="Payment"><dir name="Form"><dir name="Cc"><file name="Saved.php" hash="5637d85bb4ca453ed3ee98e40bcdbdfa"/></dir><file name="Cc.php" hash="2692488f48034b19c7558eda24e315bf"/></dir><dir name="Info"><file name="Cc.php" hash="691ccace128a5f0c9b18e7d193837849"/></dir><dir name="Profile"><file name="Edit.php" hash="a3bf4d6ce88bd9352c77ae21916ae626"/><file name="Grid.php" hash="84918b518f1d2a8a0f4fe3a75339cc5b"/></dir></dir><dir name="Product"><file name="Subscribe.php" hash="ff6c9b609aba08a6e8635a6a24fc45ce"/><dir name="View"><dir name="Type"><dir name="Grouped"><file name="Subscribe.php" hash="acfb3afc1363b5d52aba63c8fbdddc77"/></dir></dir></dir><file name="View.php" hash="f73744f52ab87c51d8a0da3a9b0b2b84"/></dir><dir name="Subscription"><file name="Abstract.php" hash="cf49b0721d8fe929c37cf8764384c5ce"/><dir name="Form"><file name="Address.php" hash="6e25cc712e5496f2fa2757d99cfb176e"/><file name="Payment.php" hash="b1b7b35b3132f638dd0b06896f15db6a"/></dir></dir></dir><dir name="Helper"><file name="Adminorder.php" hash="067c0eeb61a57aec94f264806d681a60"/><file name="Api.php" hash="03a8b41eb9727379c06817276101729d"/><file name="Data.php" hash="f3b0cd8e4a7d2517cd34c42e3d696b2e"/><file name="Payment.php" hash="4bff557ba70be303f284f61cb48fca1b"/><dir name="PaymentError"><file name="Exception.php" hash="b1031006d9ac5f024f3bf8e15bb438df"/></dir><file name="PaymentError.php" hash="bbe642f7c107e4385f91d3d09aaf9275"/><file name="Platform.php" hash="3823db7f4cfd3eb669173901c49206af"/><file name="Product.php" hash="1e4c909d23cbd8176a2de6fe29785892"/><file name="Quote.php" hash="197101fcb18d516758bbca0390a2c49a"/><file name="Schedule.php" hash="2ceda8e716e7505eb25e9ae81fb77584"/><file name="Subscription.php" hash="73265716f3e0ec6f1389198c9e14d1c6"/><file name="Vault.php" hash="e32e1ed2deb2bd4da5ee7ff000426029"/></dir><dir name="Model"><dir name="Adminhtml"><file name="Observer.php" hash="090dbea6ff7c5f799f13c7e806967f24"/></dir><dir name="Api"><dir name="Cart"><file name="Api.php" hash="26f1dcc8ce770fedc5a2ef1c92575454"/></dir></dir><dir name="Checkout"><dir name="Cart"><file name="Api.php" hash="4270cdd675ebd984f7b6f1bd6412d317"/><dir name="Product"><file name="Api.php" hash="f174774195d22f59b30d830ad3d74d99"/></dir></dir></dir><dir name="Mysql4"><dir name="Subscription"><file name="Collection.php" hash="9f7c8d5c0c9794466e4eeb2d8374ccb0"/></dir><file name="Subscription.php" hash="a2efd1f657149ed41fa3891ea35dcf58"/></dir><file name="Observer.php" hash="c76abbbbf7d39cf5d8a117513af18ea8"/><dir name="Payment"><file name="Method.php" hash="530d5edf690660df103ea3b037cea722"/><dir name="Profile"><file name="Address.php" hash="ca74a3797cba026a92ce4831da7221c0"/><file name="Collection.php" hash="d293b0970e0f91bed76c10cd9471e202"/></dir><file name="Profile.php" hash="401bcc5d078476db571fd5f3f53886ff"/></dir><dir name="Paypal"><file name="Express.php" hash="f9d9c2bad8400cd3a18926f40acb8f5b"/></dir><dir name="Platform"><file name="Product.php" hash="082d449e2c87e1c73cf557fe46bd8447"/></dir><dir name="Quote"><file name="Address.php" hash="b767e70f3f1f18ee5aceb129d651e352"/></dir><dir name="Sales"><dir name="Quote"><file name="Item.php" hash="f4ecd49673b9a8f586977aaf3002158e"/></dir></dir><dir name="SalesRule"><dir name="Rule"><dir name="Condition"><file name="Product.php" hash="3bfd24ccb50e2ef77a8b3b39f4c6b8fb"/></dir></dir><file name="Validator.php" hash="8befceb5d19283a58c93a45e6391ab6d"/></dir><dir name="Shipping"><file name="Carrier.php" hash="95e36593f0fb9b671c385bd7090619aa"/></dir><file name="Subscription.php" hash="477709643e4f8d1c5827ee42414616da"/><dir name="System"><dir name="Config"><dir name="Source"><file name="Cartrulediscountcombinetype.php" hash="06e9a101facbc36fea76594a8bad4ecc"/><file name="Cctype.php" hash="d2eac90e00f0da471f1d488ce98088c1"/><file name="Loglevel.php" hash="b43a8061d5ab01a5748edb6527c2b9dd"/><file name="Month.php" hash="547baa422940db4cfd2c8e482955fd29"/><file name="Nextorderdatemode.php" hash="b2253c01aa0c4f7845da16223f729a5d"/><file name="Shippingmethods.php" hash="9400472dcc7b4253b53a2af33bdf00ec"/><file name="Year.php" hash="14d191c257c4e7ba74c209435e993c29"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Sales"><dir name="Order"><file name="InvoiceController.php" hash="9fc85857b9e5e8e735419496fe299499"/></dir></dir><file name="SporderpaymentController.php" hash="105387c45ccb1253003f7d8307a77b0c"/><file name="SppaymentprofileController.php" hash="8a8ac37ee740f315b3620071608b0b7f"/><file name="SptestconnectionbuttonController.php" hash="31ae6cdd81d5c005bfc491c349e35d2e"/></dir><file name="MycreditcardsController.php" hash="7c80caefd52487fa883c84a6a9b5069c"/><file name="MysubscriptionsController.php" hash="d3cc7c64558b0845acc609d15a81df22"/><file name="NewsubscriptionController.php" hash="54556039eaf2ac7366f8bb6dba82af9d"/></dir><dir name="etc"><file name="adminhtml.xml" hash="c021e8ada255b1c99322c6c013028cad"/><file name="api.xml" hash="92dcea5b6884b1dc952b8f719409948d"/><file name="config.xml" hash="3d928ac745450a05f94f98c752da8f76"/><file name="system.xml" hash="367fde6744cc22bc4686850a1dcedf26"/></dir><dir name="sql"><dir name="sfc_autoship_setup"><file name="mysql4-install-1.3.2.10.php" hash="865fb75947537b5dac61ffe95c7f14f4"/><file name="mysql4-uninstall-1.3.1.4.php" hash="379f57c646a141605e25d34f1afc3c66"/><file name="mysql4-upgrade-1.1.0-1.1.1.php" hash="b9ce0c199825e7694dc04de73fbc7482"/><file name="mysql4-upgrade-1.1.2-1.2.0.php" hash="30ddfa9461bb9ebca5a21fa10a094273"/><file name="mysql4-upgrade-1.2.2.1-1.2.2.2.php" hash="1e18cb95c4a9e6d08d0a22687f5a76e1"/><file name="mysql4-upgrade-1.2.3-1.2.4.php" hash="3b32836a64d51cfc95434fa24e81a586"/><file name="mysql4-upgrade-1.2.4.6-1.2.4.7.php" hash="6b1eded8927ca927fdeeb7d9f527bd4f"/><file name="mysql4-upgrade-1.3.0.1-1.3.0.2.php" hash="c3042a6975747a0f872e40cc77efa9dc"/><file name="mysql4-upgrade-1.3.0.5-1.3.1.0.php" hash="181ce25b35accb7a8ad9b924f71581a0"/><file name="mysql4-upgrade-1.3.1.15-1.3.1.16.php" hash="27a026e80206c3774ccd2635ef7c3261"/><file name="mysql4-upgrade-1.3.1.3-1.3.1.4.php" hash="e753906c537b4cda88ed5de1c4713974"/><file name="mysql4-upgrade-1.3.1.4-1.3.1.5.php" hash="7bc2103b4c750b94e213e06c0c40eef8"/><file name="mysql4-upgrade-1.3.1.7-1.3.1.8.php" hash="f74fd035d15cb29a269591afcb19828f"/><file name="mysql4-upgrade-1.3.2.9-1.3.2.10.php" hash="3af0fd12e589977b9dc8af3ee4e54d7a"/></dir></dir></dir><file name="Autoship.php" hash="64a92742fce8a1ec9ea2537d14819b1e"/></dir></target><target name="mageetc"><dir name="modules"><file name="SFC_Autoship.xml" hash="35cd3f244a2b3249057c4c1790538f35"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="autoship.xml" hash="12f1b9e9cc47a3b5d4616942f527ab44"/></dir><dir name="template"><dir name="autoship"><dir name="cart"><dir name="product"><file name="subscription.phtml" hash="faa62a1da4a84a8cc5120aa61d343821"/></dir></dir><dir name="checkout"><file name="jsonp.phtml" hash="bd1447621e55dcc33f0853ec5d6c8a5d"/><file name="serversideapi.phtml" hash="63c89a0b18b5376971c42f9a8f7cd459"/><file name="success.phtml" hash="59739a2653933858e0614dc0218ed05e"/></dir><dir name="giftcardaccount"><dir name="onepage"><dir name="payment"><file name="scripts.phtml" hash="2236cb498a9f60c401ce05300397d653"/></dir></dir></dir><dir name="mysubscriptions"><dir name="subscription"><file name="actions.phtml" hash="e1a24c5aacb3b883c78098a29e502f52"/><file name="billing_address.phtml" hash="be8a3ceb1f8c7853c4ef807350587720"/><file name="payment.phtml" hash="09a56e4ae1ff4165fe968918c6b03064"/><file name="product_info.phtml" hash="b3a42c177326e12cd47b424a8f1b1492"/><file name="shipping_address.phtml" hash="5aaf4eaa9aac2efbab96bb3615362e85"/><file name="subscription_info.phtml" hash="6db3d2a99adcf2fb225e7990603972ed"/></dir><file name="subscription.phtml" hash="b29e1d5da54dd53b382cd5dc5a653839"/></dir><file name="mysubscriptions.phtml" hash="01538168d9bcf0c2aae97eccb58545a1"/><dir name="newsubscription"><file name="ajax_update.phtml" hash="b6e2a0d5ae5f573558160ac08686d148"/><file name="billing_address.phtml" hash="07dcf489164decae399d07ff7ee8b216"/><file name="delivery_date.phtml" hash="d6afc8039851b2a1b208bd9569b7a3fb"/><file name="delivery_frequency.phtml" hash="49024afa27ddd5c1c8bd28858e41429f"/><file name="payment.phtml" hash="efe6472d58cabdf1882b44d92ca69c2d"/><file name="product_info.phtml" hash="dd358a19b060582b1e82cda4cef0bdc6"/><file name="shipping_address.phtml" hash="61c7479bf639ae5c459e7e18d9729611"/><file name="summary.phtml" hash="3a176185738cc0f023b20b030ffc4a25"/></dir><file name="newsubscription.phtml" hash="97be1c3d0be360a1949864a6f3d9f35c"/><dir name="payment"><dir name="form"><file name="cc.phtml" hash="c7d67649c87c70683d64b755f2635175"/><file name="cc_saved.phtml" hash="0ba3f3340c0ed62ceda5197b66242f30"/></dir><dir name="profile"><file name="edit.phtml" hash="540df63a35e8b2d5039fbf8f8ff061f3"/><file name="grid.phtml" hash="12aec08dca16e01e3aa5ae6ae46f9e8e"/><file name="new.phtml" hash="6e9848e905479e8ea839e1e370f7582e"/></dir></dir><dir name="product"><file name="subscribe.phtml" hash="0850e6748dfbcd99a4e9a2e095b9cb1c"/><dir name="view"><file name="addtocart.phtml" hash="735377e75b8ddec90f0d75da2c451692"/><dir name="type"><dir name="grouped"><file name="subscribe.phtml" hash="cbeb9d9183a9ae094f127ae0384c2cd3"/></dir></dir></dir></dir><dir name="subscription"><dir name="form"><file name="billing.phtml" hash="5aa0c33a1ae03e63463047a7002b1634"/><file name="payment.phtml" hash="2cf9416fb4d306c978fe6be4c245fd23"/><file name="shipping.phtml" hash="c21cb19339568404c3bc5f4ba54c3601"/></dir></dir></dir></dir></dir></dir><dir name="enterprise"><dir name="default"><dir name="layout"><file name="autoship.xml" hash="e440dffa00c0a15eb8da723e13172b71"/></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="autoship.xml" hash="7ecb20ca381b7f24cf196b75ba480588"/></dir><dir name="template"><dir name="autoship"><dir name="payment"><dir name="form"><file name="cc.phtml" hash="d50530e33a0a2bf97007e3b49d1a9b25"/><file name="cc_saved.phtml" hash="b51bbe49479ddacba6180d83771c6273"/></dir></dir><dir name="sales"><dir name="create_order"><file name="jsonp.phtml" hash="5bed9025547f57ff573a5fa2f11b16d2"/><dir name="product"><file name="subscription.phtml" hash="054d871ae41fa6db19ae1b276ca7bb5f"/></dir></dir></dir><dir name="system"><dir name="config"><file name="test_connection_button.phtml" hash="1ab886afca2bca69d25f543e28482fc9"/></dir></dir></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><file name="autoship.css" hash="b4e2486d260c4ed08029fbe447c408e3"/></dir><dir name="images"><dir name="autoship"><file name="bkg_active-step.gif" hash="01d803ca8f4d7c7fb96c96694d233810"/><file name="bkg_block.gif" hash="df355007ee78db8a33c4e542594fe3f2"/><file name="bkg_btn-co.gif" hash="45547679e3ba34e4fd2a69750bbad05d"/><file name="bkg_thead.gif" hash="9957f9c2b564965d4d1a0ef1edcb1349"/><file name="calendar_icon.png" hash="f7073fc49641344b880a0b3218f2b261"/><file name="white_trans.png" hash="118606bdffc3e99bf15c6544cfdff1c2"/></dir></dir><dir name="js"><dir name="autoship"><file name="checkout.js" hash="aac9dbccd066fd1e614910db86f838a3"/><dir name="jquery"><file name="jquery-1.10.1.min.js" hash="33d85132f0154466fc017dd05111873d"/><file name="noconflict.js" hash="f64a7d5a68b0bf56b691aafd9a6df3e2"/><dir name="ui"><file name="jquery.ui.core.min.js" hash="739cf68f21c10e04cde3ad13fcff9063"/><file name="jquery.ui.datepicker.min.js" hash="4eac58ed8deb3189c8d05bab9187f1ce"/><dir name="theme"><dir name="images"><file name="animated-overlay.gif" hash="2b912f7c0653008ca28ebacda49025e7"/><file name="ui-bg_flat_0_aaaaaa_40x100.png" hash="2a44fbdb7360c60122bcf6dcef0387d8"/><file name="ui-bg_flat_75_ffffff_40x100.png" hash="8692e6efddf882acbff144c38ea7dfdf"/><file name="ui-bg_glass_55_fbf9ee_1x400.png" hash="f8f4558e0b92ff2cd6136781533902ec"/><file name="ui-bg_glass_65_ffffff_1x400.png" hash="e5a8f32e28fd5c27bf0fed33c8a8b9b5"/><file name="ui-bg_glass_75_dadada_1x400.png" hash="c12c6510dad3ebfa64c8a30e959a2469"/><file name="ui-bg_glass_75_e6e6e6_1x400.png" hash="f4254356c2a8c9a383205ef2c4de22c4"/><file name="ui-bg_glass_95_fef1ec_1x400.png" hash="5a3be2d8fff8324d59aec3df7b0a0c83"/><file name="ui-bg_highlight-soft_75_cccccc_1x100.png" hash="72c593d16e998952cd8d798fee33c6f3"/><file name="ui-icons_222222_256x240.png" hash="9129e086dc488d8bcaf808510bc646ba"/><file name="ui-icons_2e83ff_256x240.png" hash="25162bf857a8eb83ea932a58436e1049"/><file name="ui-icons_454545_256x240.png" hash="771099482bdc1571ece41073b1752596"/><file name="ui-icons_888888_256x240.png" hash="faf6f5dc44e713178784c1fb053990aa"/><file name="ui-icons_cd0a0a_256x240.png" hash="5d8808d43cefca6f6781a5316d176632"/></dir><file name="jquery-ui.css" hash="dfcf2d9b984ec33bc6bb11e755ca0931"/></dir></dir></dir><file name="mysubscription.js" hash="99877078a4e14af09598422a35b2e9a8"/><file name="newsubscription.js" hash="08444134c8ccb501bfd08595dff8671a"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="js"><dir name="autoship"><dir name="jquery"><file name="jquery-1.10.1.min.js" hash="33d85132f0154466fc017dd05111873d"/><file name="noconflict.js" hash="f64a7d5a68b0bf56b691aafd9a6df3e2"/></dir><file name="sales_create_order.js" hash="8155645f0cdd1d988a46f1c84bd4f88c"/></dir></dir></dir></dir></dir></target><target name="magelib"><dir name="OAuth2"><file name="Client.php" hash="fa9439393ed6483bd7d07af87df09b7e"/><dir name="GrantType"><file name="AuthorizationCode.php" hash="a1ff324a733fc33dbf938153c4c1667c"/><file name="ClientCredentials.php" hash="21b30fbb06d4b67263499d687316ae8b"/><file name="IGrantType.php" hash="ee03d4c5bc20f518716fc2c616b4d38d"/><file name="Password.php" hash="2e938e60c4af8bad71b5c4f0f1a40969"/><file name="RefreshToken.php" hash="a773f48348ad7aa510955099ba18d3ad"/></dir><file name="README" hash="8ef3bf723c93b6e091b707a546df2804"/></dir></target><target name="mage"><dir name="shell"><file name="autoship_prod_sync.php" hash="0d669938bf21b7b7d8e0fe87470d4d12"/><file name="autoship_report_dl.php" hash="996707ddf4a7a8f45e40fc7873354026"/><file name="autoship_customer_sync.php" hash="4a1364a020fec24287d4a6d24ee3d2d8"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.2.0</min><max>6.2.0</max></php></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>SFC_Autoship</name>
4
+ <version>1.3.2.11</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.subscribepro.com/terms-of-service/">Subscribe Pro Commercial Software License</license>
7
  <channel>community</channel>
10
  <description>Manage your auto-ship program, customer subscription payments and recurring billing transactions to optimize customer retention and recurring revenue. The Subscribe Pro Extension for Magento allows you to easily implement subscriptions and recurring billing on your Magento website. Our extension is fully integrated into Magento and allows you to acquire and manage subscription customers directly in the Magento admin panel.</description>
11
  <notes>Subscribe Pro Extension Release</notes>
12
  <authors><author><name>Subscribe Pro</name><user>SF_Consulting</user><email>support@subscribepro.com</email></author></authors>
13
+ <date>2016-05-11</date>
14
+ <time>15:05:32</time>
15
+ <contents><target name="magelocal"><dir name="SFC"><dir name="Autoship"><dir name="Block"><dir name="Adminhtml"><dir name="Customer"><dir name="Edit"><file name="Tabs.php" hash="324faebed3f1933a3dd46ff949257c12"/></dir><dir name="Paymentprofiles"><dir name="Edit"><file name="Form.php" hash="48dd98caa098dde6e642447f8aca0cd7"/><dir name="Tab"><file name="Form.php" hash="b5789783aac319c7e6e23bbb42cc403c"/></dir><file name="Tabs.php" hash="f86bc9159c34cb846af86bcba7ca09aa"/></dir><file name="Edit.php" hash="eac8c180a3ff1c1673edb61ef0166530"/><file name="Paymentprofile.php" hash="e4fe5d2cfa6d446783750a443584fd79"/></dir></dir><dir name="Sales"><dir name="Order"><dir name="Create"><dir name="Billing"><dir name="Method"><file name="Form.php" hash="2cc22fddd456dcc5e6ff9c4ae7ff0bab"/></dir></dir><file name="Jsonp.php" hash="4eb6d87cceeb063877f2ba86172f3a53"/><dir name="Product"><file name="Subscription.php" hash="13c3d8310779448571fba86109e2a750"/></dir></dir></dir></dir><dir name="System"><dir name="Config"><dir name="Form"><file name="Fielddisabled.php" hash="91236d63f442d2597c8fdbcc641f8ee2"/><file name="TestConnectionButton.php" hash="9af7b9a40f0220a8451360aea45ba5eb"/></dir></dir></dir></dir><dir name="Cart"><dir name="Product"><file name="Subscription.php" hash="174d55a19fb76ab001b43ff47d521c23"/></dir></dir><dir name="Checkout"><file name="Jsonp.php" hash="5df75ab21f0dd29ffe468c85669aadfa"/><dir name="Onepage"><dir name="Payment"><file name="Methods.php" hash="d251545de90864e596106acb3be60516"/></dir></dir></dir><dir name="Mysubscriptions"><dir name="Subscription"><dir name="Form"><file name="Billing.php" hash="ef440cdafd32896c586b48d8a8a75c8d"/><file name="Payment.php" hash="e8d2117f3e37d067076ffa1c41a73652"/><file name="Shipping.php" hash="01415536b26fefa6d15baf67657f3e53"/></dir></dir><file name="Subscription.php" hash="a04b9d72edb4b5ff2a36d3caac2c9de7"/></dir><file name="Mysubscriptions.php" hash="14ce3b7b0ba963142f71b39c8b04a1c5"/><file name="Newsubscription.php" hash="43e5b00478ee28396469ad7293f290f7"/><dir name="Payment"><dir name="Form"><dir name="Cc"><file name="Saved.php" hash="5637d85bb4ca453ed3ee98e40bcdbdfa"/></dir><file name="Cc.php" hash="2692488f48034b19c7558eda24e315bf"/></dir><dir name="Info"><file name="Cc.php" hash="691ccace128a5f0c9b18e7d193837849"/></dir><dir name="Profile"><file name="Edit.php" hash="a3bf4d6ce88bd9352c77ae21916ae626"/><file name="Grid.php" hash="84918b518f1d2a8a0f4fe3a75339cc5b"/></dir></dir><dir name="Product"><file name="Subscribe.php" hash="ff6c9b609aba08a6e8635a6a24fc45ce"/><dir name="View"><dir name="Type"><dir name="Grouped"><file name="Subscribe.php" hash="acfb3afc1363b5d52aba63c8fbdddc77"/></dir></dir></dir><file name="View.php" hash="f73744f52ab87c51d8a0da3a9b0b2b84"/></dir><dir name="Subscription"><file name="Abstract.php" hash="cf49b0721d8fe929c37cf8764384c5ce"/><dir name="Form"><file name="Address.php" hash="6e25cc712e5496f2fa2757d99cfb176e"/><file name="Payment.php" hash="b1b7b35b3132f638dd0b06896f15db6a"/></dir></dir></dir><dir name="Helper"><file name="Adminorder.php" hash="067c0eeb61a57aec94f264806d681a60"/><file name="Api.php" hash="03a8b41eb9727379c06817276101729d"/><file name="Data.php" hash="f3b0cd8e4a7d2517cd34c42e3d696b2e"/><file name="Payment.php" hash="ccc023897a6f65709fd6c5a72084a2f3"/><dir name="PaymentError"><file name="Exception.php" hash="b1031006d9ac5f024f3bf8e15bb438df"/></dir><file name="PaymentError.php" hash="bbe642f7c107e4385f91d3d09aaf9275"/><file name="Platform.php" hash="4aa1921c2e85c234be32c14f7c24e95b"/><file name="Product.php" hash="1e4c909d23cbd8176a2de6fe29785892"/><file name="Quote.php" hash="1da964b9fe0c5538e5ecced325e72958"/><file name="Schedule.php" hash="2ceda8e716e7505eb25e9ae81fb77584"/><file name="Subscription.php" hash="73265716f3e0ec6f1389198c9e14d1c6"/><file name="Vault.php" hash="e32e1ed2deb2bd4da5ee7ff000426029"/></dir><dir name="Model"><dir name="Adminhtml"><file name="Observer.php" hash="090dbea6ff7c5f799f13c7e806967f24"/></dir><dir name="Api"><dir name="Cart"><file name="Api.php" hash="26f1dcc8ce770fedc5a2ef1c92575454"/></dir></dir><dir name="Checkout"><dir name="Cart"><file name="Api.php" hash="4270cdd675ebd984f7b6f1bd6412d317"/><dir name="Product"><file name="Api.php" hash="b315501996442d509f170ea8ac952ecf"/></dir></dir></dir><dir name="Enterprise"><dir name="GiftCardAccount"><file name="Observer.php" hash="86588fa28c2f73f40b55dc0a73b388a5"/></dir><dir name="Reward"><file name="Observer.php" hash="b8aaf5057d974a3c3a197338392cef91"/></dir></dir><dir name="Mysql4"><dir name="Subscription"><file name="Collection.php" hash="9f7c8d5c0c9794466e4eeb2d8374ccb0"/></dir><file name="Subscription.php" hash="a2efd1f657149ed41fa3891ea35dcf58"/></dir><file name="Observer.php" hash="0e4a58ddeff4d1f5d54ba48c1ddcb5f3"/><dir name="Payment"><file name="Method.php" hash="4287fd4742178df3adfc61532bd95eb9"/><dir name="Profile"><file name="Address.php" hash="ca74a3797cba026a92ce4831da7221c0"/><file name="Collection.php" hash="d293b0970e0f91bed76c10cd9471e202"/></dir><file name="Profile.php" hash="401bcc5d078476db571fd5f3f53886ff"/></dir><dir name="Paypal"><file name="Express.php" hash="f9d9c2bad8400cd3a18926f40acb8f5b"/></dir><dir name="Platform"><file name="Product.php" hash="082d449e2c87e1c73cf557fe46bd8447"/></dir><dir name="Quote"><file name="Address.php" hash="56a5cda6311e61899b64f639b3eeceda"/></dir><dir name="Sales"><dir name="Quote"><file name="Item.php" hash="f4ecd49673b9a8f586977aaf3002158e"/></dir></dir><dir name="SalesRule"><dir name="Rule"><dir name="Condition"><file name="Product.php" hash="a23366a39be45cf357f651ba6e92f576"/></dir></dir><file name="Validator.php" hash="c2e4a55e62fdf744c27cad75a161ab54"/></dir><dir name="Shipping"><file name="Carrier.php" hash="a3a50fabf2eb4d6df20107a5ce4ccafa"/></dir><file name="Subscription.php" hash="477709643e4f8d1c5827ee42414616da"/><dir name="System"><dir name="Config"><dir name="Source"><file name="Cartrulediscountcombinetype.php" hash="06e9a101facbc36fea76594a8bad4ecc"/><file name="Cctype.php" hash="d2eac90e00f0da471f1d488ce98088c1"/><file name="Loglevel.php" hash="b43a8061d5ab01a5748edb6527c2b9dd"/><file name="Month.php" hash="547baa422940db4cfd2c8e482955fd29"/><file name="Nextorderdatemode.php" hash="b2253c01aa0c4f7845da16223f729a5d"/><file name="Shippingmethods.php" hash="9400472dcc7b4253b53a2af33bdf00ec"/><file name="Year.php" hash="14d191c257c4e7ba74c209435e993c29"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Sales"><dir name="Order"><file name="InvoiceController.php" hash="9fc85857b9e5e8e735419496fe299499"/></dir></dir><file name="SporderpaymentController.php" hash="105387c45ccb1253003f7d8307a77b0c"/><file name="SppaymentprofileController.php" hash="8a8ac37ee740f315b3620071608b0b7f"/><file name="SptestconnectionbuttonController.php" hash="31ae6cdd81d5c005bfc491c349e35d2e"/></dir><file name="MycreditcardsController.php" hash="7c80caefd52487fa883c84a6a9b5069c"/><file name="MysubscriptionsController.php" hash="cadb1fcebc9cb24c41a6ac50d59adfae"/><file name="NewsubscriptionController.php" hash="f685e166ed6a53fbfe37e4b92015c18f"/></dir><dir name="etc"><file name="adminhtml.xml" hash="c021e8ada255b1c99322c6c013028cad"/><file name="api.xml" hash="92dcea5b6884b1dc952b8f719409948d"/><file name="config.xml" hash="a79ac3fdc2723e29594a4140bb8fc4f9"/><file name="system.xml" hash="04feb822d00f06b4343c1e9c160b4d20"/></dir><dir name="sql"><dir name="sfc_autoship_setup"><file name="mysql4-install-1.3.2.11.php" hash="9d7671fe154e233f31a3508d4fcc49da"/><file name="mysql4-uninstall-1.3.1.4.php" hash="379f57c646a141605e25d34f1afc3c66"/><file name="mysql4-upgrade-1.1.0-1.1.1.php" hash="b9ce0c199825e7694dc04de73fbc7482"/><file name="mysql4-upgrade-1.1.2-1.2.0.php" hash="30ddfa9461bb9ebca5a21fa10a094273"/><file name="mysql4-upgrade-1.2.2.1-1.2.2.2.php" hash="1e18cb95c4a9e6d08d0a22687f5a76e1"/><file name="mysql4-upgrade-1.2.3-1.2.4.php" hash="3b32836a64d51cfc95434fa24e81a586"/><file name="mysql4-upgrade-1.2.4.6-1.2.4.7.php" hash="6b1eded8927ca927fdeeb7d9f527bd4f"/><file name="mysql4-upgrade-1.3.0.1-1.3.0.2.php" hash="c3042a6975747a0f872e40cc77efa9dc"/><file name="mysql4-upgrade-1.3.0.5-1.3.1.0.php" hash="181ce25b35accb7a8ad9b924f71581a0"/><file name="mysql4-upgrade-1.3.1.15-1.3.1.16.php" hash="27a026e80206c3774ccd2635ef7c3261"/><file name="mysql4-upgrade-1.3.1.3-1.3.1.4.php" hash="e753906c537b4cda88ed5de1c4713974"/><file name="mysql4-upgrade-1.3.1.4-1.3.1.5.php" hash="7bc2103b4c750b94e213e06c0c40eef8"/><file name="mysql4-upgrade-1.3.1.7-1.3.1.8.php" hash="f74fd035d15cb29a269591afcb19828f"/><file name="mysql4-upgrade-1.3.2.10-1.3.2.11.php" hash="e7b74f9f9306319ff442db0acd0b0883"/><file name="mysql4-upgrade-1.3.2.9-1.3.2.10.php" hash="3af0fd12e589977b9dc8af3ee4e54d7a"/></dir></dir></dir><file name="Autoship.php" hash="64a92742fce8a1ec9ea2537d14819b1e"/></dir></target><target name="mageetc"><dir name="modules"><file name="SFC_Autoship.xml" hash="35cd3f244a2b3249057c4c1790538f35"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="autoship.xml" hash="e219f37e3c37b677a77e01160691bfba"/></dir><dir name="template"><dir name="autoship"><dir name="cart"><dir name="product"><file name="subscription.phtml" hash="b0d19a7b27e7c807773985a040ca8faf"/></dir></dir><dir name="checkout"><file name="jsonp.phtml" hash="bd1447621e55dcc33f0853ec5d6c8a5d"/><file name="serversideapi.phtml" hash="63c89a0b18b5376971c42f9a8f7cd459"/><file name="success.phtml" hash="d33a0650af66c301a81e6a3ad476c509"/></dir><dir name="mysubscriptions"><dir name="subscription"><file name="actions.phtml" hash="e1a24c5aacb3b883c78098a29e502f52"/><file name="billing_address.phtml" hash="be8a3ceb1f8c7853c4ef807350587720"/><file name="payment.phtml" hash="09a56e4ae1ff4165fe968918c6b03064"/><file name="product_info.phtml" hash="b3a42c177326e12cd47b424a8f1b1492"/><file name="shipping_address.phtml" hash="5aaf4eaa9aac2efbab96bb3615362e85"/><file name="subscription_info.phtml" hash="6db3d2a99adcf2fb225e7990603972ed"/></dir><file name="subscription.phtml" hash="b29e1d5da54dd53b382cd5dc5a653839"/></dir><file name="mysubscriptions.phtml" hash="01538168d9bcf0c2aae97eccb58545a1"/><dir name="newsubscription"><file name="ajax_update.phtml" hash="44d61a7fd12a3a77b833f37f6baf7ed8"/><file name="delivery_date.phtml" hash="e585f864aecf7c1ba64deb27a722a99e"/><file name="delivery_frequency.phtml" hash="47bbee8aaa38b39ae42cff3f7eab3f75"/><file name="product_info.phtml" hash="3ef849f9a7a4caf99d016be1d619fc42"/></dir><file name="newsubscription.phtml" hash="309c32b1701b03ee2d69adccb3d87963"/><dir name="payment"><dir name="form"><file name="cc.phtml" hash="c7d67649c87c70683d64b755f2635175"/><file name="cc_saved.phtml" hash="0ba3f3340c0ed62ceda5197b66242f30"/></dir><dir name="profile"><file name="edit.phtml" hash="540df63a35e8b2d5039fbf8f8ff061f3"/><file name="grid.phtml" hash="12aec08dca16e01e3aa5ae6ae46f9e8e"/><file name="new.phtml" hash="6e9848e905479e8ea839e1e370f7582e"/></dir></dir><dir name="product"><file name="subscribe.phtml" hash="9f5ed89077bef4caacbc364db49e4c59"/><dir name="view"><file name="addtocart.phtml" hash="96d4bf7c1e246174d2f3a3152ab94cd6"/><dir name="type"><dir name="grouped"><file name="subscribe.phtml" hash="e102fd285c50de5f6683d8d057966a91"/></dir></dir></dir></dir><dir name="subscription"><dir name="form"><file name="billing.phtml" hash="5aa0c33a1ae03e63463047a7002b1634"/><file name="payment.phtml" hash="2cf9416fb4d306c978fe6be4c245fd23"/><file name="shipping.phtml" hash="c21cb19339568404c3bc5f4ba54c3601"/></dir></dir></dir></dir></dir></dir><dir name="enterprise"><dir name="default"><dir name="layout"><file name="autoship.xml" hash="4be1388a65169ac3b5ab55415965ca67"/></dir><dir name="template"><dir name="autoship"><dir name="giftcardaccount"><dir name="onepage"><dir name="payment"><file name="scripts.phtml" hash="2236cb498a9f60c401ce05300397d653"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="autoship.xml" hash="7ecb20ca381b7f24cf196b75ba480588"/></dir><dir name="template"><dir name="autoship"><dir name="payment"><dir name="form"><file name="cc.phtml" hash="d50530e33a0a2bf97007e3b49d1a9b25"/><file name="cc_saved.phtml" hash="b51bbe49479ddacba6180d83771c6273"/></dir></dir><dir name="sales"><dir name="create_order"><file name="jsonp.phtml" hash="5bed9025547f57ff573a5fa2f11b16d2"/><dir name="product"><file name="subscription.phtml" hash="054d871ae41fa6db19ae1b276ca7bb5f"/></dir></dir></dir><dir name="system"><dir name="config"><file name="test_connection_button.phtml" hash="1ab886afca2bca69d25f543e28482fc9"/></dir></dir></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><file name="autoship.css" hash="660e2ebc242b8e59432aac1399fc3bd4"/></dir><dir name="images"><dir name="autoship"><file name="bkg_active-step.gif" hash="01d803ca8f4d7c7fb96c96694d233810"/><file name="bkg_block.gif" hash="df355007ee78db8a33c4e542594fe3f2"/><file name="bkg_btn-co.gif" hash="45547679e3ba34e4fd2a69750bbad05d"/><file name="bkg_thead.gif" hash="9957f9c2b564965d4d1a0ef1edcb1349"/><file name="calendar_icon.png" hash="f7073fc49641344b880a0b3218f2b261"/><file name="white_trans.png" hash="118606bdffc3e99bf15c6544cfdff1c2"/></dir></dir><dir name="js"><dir name="autoship"><file name="checkout.js" hash="aac9dbccd066fd1e614910db86f838a3"/><dir name="jquery"><file name="jquery-1.10.1.min.js" hash="33d85132f0154466fc017dd05111873d"/><file name="noconflict.js" hash="f64a7d5a68b0bf56b691aafd9a6df3e2"/><dir name="ui"><file name="jquery.ui.core.min.js" hash="739cf68f21c10e04cde3ad13fcff9063"/><file name="jquery.ui.datepicker.min.js" hash="4eac58ed8deb3189c8d05bab9187f1ce"/><dir name="theme"><dir name="images"><file name="animated-overlay.gif" hash="2b912f7c0653008ca28ebacda49025e7"/><file name="ui-bg_flat_0_aaaaaa_40x100.png" hash="2a44fbdb7360c60122bcf6dcef0387d8"/><file name="ui-bg_flat_75_ffffff_40x100.png" hash="8692e6efddf882acbff144c38ea7dfdf"/><file name="ui-bg_glass_55_fbf9ee_1x400.png" hash="f8f4558e0b92ff2cd6136781533902ec"/><file name="ui-bg_glass_65_ffffff_1x400.png" hash="e5a8f32e28fd5c27bf0fed33c8a8b9b5"/><file name="ui-bg_glass_75_dadada_1x400.png" hash="c12c6510dad3ebfa64c8a30e959a2469"/><file name="ui-bg_glass_75_e6e6e6_1x400.png" hash="f4254356c2a8c9a383205ef2c4de22c4"/><file name="ui-bg_glass_95_fef1ec_1x400.png" hash="5a3be2d8fff8324d59aec3df7b0a0c83"/><file name="ui-bg_highlight-soft_75_cccccc_1x100.png" hash="72c593d16e998952cd8d798fee33c6f3"/><file name="ui-icons_222222_256x240.png" hash="9129e086dc488d8bcaf808510bc646ba"/><file name="ui-icons_2e83ff_256x240.png" hash="25162bf857a8eb83ea932a58436e1049"/><file name="ui-icons_454545_256x240.png" hash="771099482bdc1571ece41073b1752596"/><file name="ui-icons_888888_256x240.png" hash="faf6f5dc44e713178784c1fb053990aa"/><file name="ui-icons_cd0a0a_256x240.png" hash="5d8808d43cefca6f6781a5316d176632"/></dir><file name="jquery-ui.css" hash="dfcf2d9b984ec33bc6bb11e755ca0931"/></dir></dir></dir><file name="mysubscription.js" hash="99877078a4e14af09598422a35b2e9a8"/><file name="newsubscription.js" hash="f9c49e810df079cc14291b1fe8f0d1e6"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="js"><dir name="autoship"><dir name="jquery"><file name="jquery-1.10.1.min.js" hash="33d85132f0154466fc017dd05111873d"/><file name="noconflict.js" hash="f64a7d5a68b0bf56b691aafd9a6df3e2"/></dir><file name="sales_create_order.js" hash="8155645f0cdd1d988a46f1c84bd4f88c"/></dir></dir></dir></dir></dir></target><target name="magelib"><dir name="OAuth2"><file name="Client.php" hash="fa9439393ed6483bd7d07af87df09b7e"/><dir name="GrantType"><file name="AuthorizationCode.php" hash="a1ff324a733fc33dbf938153c4c1667c"/><file name="ClientCredentials.php" hash="21b30fbb06d4b67263499d687316ae8b"/><file name="IGrantType.php" hash="ee03d4c5bc20f518716fc2c616b4d38d"/><file name="Password.php" hash="2e938e60c4af8bad71b5c4f0f1a40969"/><file name="RefreshToken.php" hash="a773f48348ad7aa510955099ba18d3ad"/></dir><file name="README" hash="8ef3bf723c93b6e091b707a546df2804"/></dir></target><target name="mage"><dir name="shell"><file name="autoship_prod_sync.php" hash="0d669938bf21b7b7d8e0fe87470d4d12"/><file name="autoship_report_dl.php" hash="996707ddf4a7a8f45e40fc7873354026"/><file name="autoship_customer_sync.php" hash="4a1364a020fec24287d4a6d24ee3d2d8"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.2.0</min><max>6.2.0</max></php></required></dependencies>
18
  </package>
skin/frontend/base/default/css/autoship.css CHANGED
@@ -17,97 +17,14 @@
17
 
18
  /* New Subscription page */
19
 
20
- /* top-row */
21
- .subscription p { padding-bottom: 6px; }
22
- .subscription .top-image, .subscription .top-name { float: left; }
23
- .subscription .product-image img { margin-right: 12px; border: 1px solid #cfcfcf; padding: 6px; }
24
- .subscription .product-name { width: 486px; }
25
- .subscription .product-name a { font-size: 18px; font-weight: normal; color: #c73615; text-decoration: none; }
26
- .subscription .product-original-price { font-size: 11px; color: #989696; text-decoration: line-through; }
27
- .subscription .product-price { font-size: 18px; color: #c73615; font-weight: bold; }
28
-
29
- .subscription .block {
30
- width: 288px;
31
- height: 162px;
32
- float: left;
33
- margin: 0 14px 14px 0;
34
- border: 1px solid #cfcfcf;
35
- -webkit-border-radius: 6px;
36
- -moz-border-radius: 6px;
37
- border-radius: 6px;
38
- background: #f5f5f5 url(../images/autoship/bkg_block.gif) repeat-x 0 0;
39
- }
40
- .subscription .delivery-date-block { height: 92px; text-align: center; }
41
- .subscription .delivery-date-block input.input-text { margin: 12px 0 0 -8px; border: none; padding: 0; background: none; font-size: 22px; font-weight: bold; text-align: center; width: 96px; }
42
- .subscription .delivery-date-block .ui-datepicker-trigger { margin-top: 16px; cursor: pointer; }
43
- .subscription .summary-block { height: 340px; }
44
- .subscription .delivery-date-block, .subscription .summary-block { margin-right: 0px; margin-bottom: 0px; float: right; }
45
-
46
- .subscription .block .block-title {
47
- margin-top: -1px;
48
- -webkit-border-top-left-radius: 6px;
49
- -webkit-border-top-right-radius: 6px;
50
- -moz-border-radius-topleft: 6px;
51
- -moz-border-radius-topright: 6px;
52
- border-top-left-radius: 6px;
53
- border-top-right-radius: 6px;
54
- padding: 5px 12px 5px;
55
- background: #d12c01 url(../images/autoship/bkg_active-step.gif) repeat-x 0 -4px;
56
- }
57
-
58
- .subscription .box-padding { padding: 18px; }
59
-
60
- .subscription .block .block-title h2 { color: #ffffff; }
61
-
62
- .subscription .top-row { margin-bottom: 18px; }
63
-
64
- .subscription .bottom-left { float: left; }
65
- .subscription .bottom-top { width: 608px; }
66
- .subscription .bottom-bottom { width: 608px; }
67
- .subscription .bottom-right { float: right; }
68
-
69
- .subscription .summary-block { position: relative; background: none; }
70
- .subscription .summary-block .subscription-summary-table { float: right; }
71
- .subscription .summary-block .subscription-summary-table table th, .subscription .summary-block .subscription-summary-table table td { padding: 0 5px 5px; }
72
- .subscription .summary-block .subscription-summary-table table tfoot strong { font-size: 14px; color: #cd3800; padding: 6px 0 8px; }
73
-
74
- .subscription .summary-block .subscribe-button-block {
75
- position: absolute;
76
- bottom: 0;
77
- width: 288px;
78
- height: 72px;
79
- line-height: 72px;
80
- text-align: center;
81
- background: #fbf8f4;
82
- -webkit-border-bottom-right-radius: 6px;
83
- -webkit-border-bottom-left-radius: 6px;
84
- -moz-border-radius-bottomright: 6px;
85
- -moz-border-radius-bottomleft: 6px;
86
- border-bottom-right-radius: 6px;
87
- border-bottom-left-radius: 6px;
88
- }
89
- .subscription .summary-block .subscribe-button-block .btn-cart span {
90
- background-image: url(../images/autoship/bkg_btn-co.gif);
91
- height: 27px !important;
92
- padding: 0 0 0 13px !important;
93
- }
94
- .subscription .summary-block .subscribe-button-block .btn-cart span span {
95
- border: 0;
96
- background-image: url(../images/autoship/bkg_btn-co.gif);
97
- padding: 1px 32px 0 19px !important;
98
- color: #fff;
99
- font: bold 15px/26px Arial, Helvetica, sans-serif !important;
100
- height: 26px;
101
- text-transform: none;
102
- margin: 0 !important;
103
- }
104
-
105
- .subscription div.adjust { padding: 20px; background-color: #ffffff; }
106
-
107
 
108
  /* My Subscriptions page */
109
  #all-subscriptions-details { margin-top: 18px; border-bottom: 1px solid #cfcfcf; padding-bottom: 18px; }
110
- #all-subscriptions-details .delivery_date { margin: 2px 0 12px -6px; border: none; padding: 0; background: none; font-size: 22px; font-weight: bold; text-align: center; width: 96px; }
111
  #all-subscriptions-details .input-box .ui-datepicker-trigger { margin-top: 6px; cursor: pointer; }
112
 
113
  #mysubscriptions .clearer {clear:both;}
@@ -146,7 +63,7 @@
146
  .subscription-actions .button { padding-bottom: 6px; white-space: normal; }
147
  .subscription-actions .button span span { width: 116px; }
148
 
149
- .subscription-block .input-box input.delivery_date { margin: 2px 0 12px -6px; border: none; padding: 0; background: none; font-size: 22px; font-weight: bold; text-align: center; width: 105px; }
150
  .subscription-block .input-box .ui-datepicker-trigger { margin: 5px 0 1px 6px; cursor: pointer; display: inline;}
151
 
152
  .subscription-block .adjust .buttons-set button.button { float: none; margin-left: 0; }
17
 
18
  /* New Subscription page */
19
 
20
+ /* Make sure product preview image doesn't stretch. */
21
+ .new-subscription .top-image { display: inline-block; }
22
+ .new-subscription #delivery_date { float:left; width:261px; }
23
+ .new-subscription img.ui-datepicker-trigger { height:auto; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
 
25
  /* My Subscriptions page */
26
  #all-subscriptions-details { margin-top: 18px; border-bottom: 1px solid #cfcfcf; padding-bottom: 18px; }
27
+ #all-subscriptions-details .delivery_date { margin: 2px 0 12px -6px; border: none; padding: 0; background: none; font-size: 22px; font-weight: bold; text-align: center; width: 134px; }
28
  #all-subscriptions-details .input-box .ui-datepicker-trigger { margin-top: 6px; cursor: pointer; }
29
 
30
  #mysubscriptions .clearer {clear:both;}
63
  .subscription-actions .button { padding-bottom: 6px; white-space: normal; }
64
  .subscription-actions .button span span { width: 116px; }
65
 
66
+ .subscription-block .input-box input.delivery_date { margin: 2px 0 12px -6px; border: none; padding: 0; background: none; font-size: 22px; font-weight: bold; text-align: center; width: 134px; }
67
  .subscription-block .input-box .ui-datepicker-trigger { margin: 5px 0 1px 6px; cursor: pointer; display: inline;}
68
 
69
  .subscription-block .adjust .buttons-set button.button { float: none; margin-left: 0; }
skin/frontend/base/default/js/autoship/newsubscription.js CHANGED
@@ -17,110 +17,18 @@
17
 
18
  $j = jQuery;
19
 
20
- function updateSubscriptionData(transport) {
21
- $j('#updated-subscription-content').append(transport);
22
- $j('.new-subscription').find('.billing-address-block').html($j('#updated-subscription-content > .billing-address-block'));
23
- $j('.new-subscription').find('.shipping-address-block').html($j('#updated-subscription-content > .shipping-address-block'));
24
- $j('#updated-subscription-content > .payment-block .input-box input').val($j('.new-subscription .payment-block .input-box input').val());
25
- $j('.new-subscription').find('.payment-block').html($j('#updated-subscription-content > .payment-block'));
26
- $j('.new-subscription').find('.summary-block').html($j('#updated-subscription-content > .summary-block'));
27
- $j('#updated-subscription-content').html('');
28
-
29
- var billingForm = new VarienForm('co-billing-form-');
30
- var billingAddressRegionUpdater = new RegionUpdater(':billing:country_id', ':billing:region', ':billing:region_id', regionsJson, undefined, ':billing:postcode');
31
- var shippingForm = new VarienForm('co-shipping-form-');
32
- var shippingAddressRegionUpdater = new RegionUpdater(':shipping:country_id', ':shipping:region', ':shipping:region_id', regionsJson, undefined, ':shipping:postcode');
33
-
34
- }
35
-
36
  $j(document).ready(function(){
37
-
38
- $j(".wrapper").after("<div id='modal_overlay'></div>");
39
-
40
- $j('#modal_overlay').css({
41
- position: "absolute",
42
- top: 0,
43
- left: 0,
44
- height: $j(document).height(),
45
- width: "100%",
46
- zIndex: 900
47
- }).bind('click', function(){
48
- $j('div.change,#please-wait').hide();
49
- $j(this).hide();
50
- }).hide();
51
-
52
- $j(".new-subscription").on('click', 'a.change', function(e){
53
- e.preventDefault();
54
- var box = $j(this).parents(".block").find("div.change");
55
- box.css({
56
- "top": $j(window).scrollTop() + 50,
57
- "left": ($j(window).width() / 2) - (box.width() / 2)
58
- }).show();
59
- $j('#modal_overlay').show();
60
- }).on('change', '.billing-address-select', function(){
61
- if($j(this).val() == ""){
62
- $j('.billing-new-address-form').show();
63
- } else {
64
- $j('.billing-new-address-form').hide();
65
- }
66
- }).on('submit', '.co-billing-form', function(e){
67
- e.preventDefault();
68
- var form = $j(this);
69
- $j("#please-wait").show();
70
- $j('.billing-address-block .messages').html("");
71
- $j.post(form.attr('action'), form.serialize(), function(transport){
72
- $j("#please-wait").hide();
73
- if(transport.match("error")){
74
- $j('.billing-address-block .messages').html(transport);
75
- } else {
76
- updateSubscriptionData(transport);
77
- $j('div.change,#modal_overlay').hide();
78
- }
79
- });
80
- }).on('submit', '#co-payment-form', function(e){
81
- e.preventDefault();
82
- var form = $j(this);
83
- $j("#please-wait").show();
84
- $j('.payment-block .messages').html("");
85
- $j.post(form.attr('action'), form.serialize(), function(transport){
86
- $j("#please-wait").hide();
87
- if(transport.match("error")){
88
- $j('.payment-block .messages').html(transport);
89
- } else {
90
- updateSubscriptionData(transport);
91
- $j('div.change,#modal_overlay').hide();
92
- }
93
- });
94
- }).on('change', '.shipping-address-select', function(){
95
- if($j(this).val() == ""){
96
- $j('.shipping-new-address-form').show();
97
- } else {
98
- $j('.shipping-new-address-form').hide();
99
- }
100
- }).on('submit', '.co-shipping-form', function(e){
101
  e.preventDefault();
102
  var form = $j(this);
103
- $j("#please-wait").show();
104
- $j('.shipping-address-block .messages').html("");
105
- $j.post(form.attr('action'), form.serialize(), function(transport){
106
- $j("#please-wait").hide();
107
- if(transport.match("error")){
108
- $j('.shipping-address-block .messages').html(transport);
109
- } else {
110
- updateSubscriptionData(transport);
111
- $j('div.change,#modal_overlay').hide();
112
- }
113
- });
114
- }).on('click', '#subscribe', function(e){
115
- e.preventDefault();
116
- var form = $j(this);
117
- $j("#please-wait").show();
118
  $j('.summary-block .messages').html("");
119
  $j.post(form.attr('href'), {
 
120
  "delivery_date": $j("#delivery_date").val(),
121
- "coupon_code": $j("#coupon_code").val()
 
122
  }, function(transport){
123
- $j("#please-wait").hide();
124
  if(transport.match("error")){
125
  $j('.summary-block .messages').html(transport);
126
  } else {
@@ -128,17 +36,4 @@ $j(document).ready(function(){
128
  }
129
  });
130
  });
131
-
132
- $j("#delivery_qty,#delivery_interval").bind('change', function(e){
133
- $j("#please-wait").show();
134
- var form = $j("#frequency_form"); // fake form
135
- $j.post(form.val(), {
136
- "qty": $j("#delivery_qty").val(),
137
- "interval": $j("#delivery_interval").val()
138
- }, function(transport){
139
- $j("#please-wait").hide();
140
- updateSubscriptionData(transport);
141
- });
142
- });
143
-
144
  });
17
 
18
  $j = jQuery;
19
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  $j(document).ready(function(){
21
+ $j(".new-subscription").on('click', '#subscribe', function(e){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  e.preventDefault();
23
  var form = $j(this);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  $j('.summary-block .messages').html("");
25
  $j.post(form.attr('href'), {
26
+ "product_id": $j("#product_id").val(),
27
  "delivery_date": $j("#delivery_date").val(),
28
+ "qty": $j("#delivery_qty").val(),
29
+ "interval": $j("#delivery_interval").val()
30
  }, function(transport){
31
+ console.log(transport);
32
  if(transport.match("error")){
33
  $j('.summary-block .messages').html(transport);
34
  } else {
36
  }
37
  });
38
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  });