/** * Do we need to subscribe the customer to either of our mailing lists? * If they ticked yes then the appropriate cookies were set before they * chose their shipping provider and entered their payment details */ function SubscribeCustomerToLists($pendingOrderToken) { $orders = LoadPendingOrdersByToken($pendingOrderToken); $order = current($orders['orders']); $email = $order['ordbillemail']; $firstName = $order['ordbillfirstname']; foreach($orders['orders'] as $order) { $extraInfo =array(); if(isset($order['extrainfo']) && $order['extrainfo'] != '') { $extraInfo = @unserialize($order['extrainfo']); } $format = Interspire_EmailIntegration_Subscription::FORMAT_PREF_NONE; if (isset($extraInfo['mail_format_preference'])) { $format = (int)$extraInfo['mail_format_preference']; } // Should we add them to our newsletter mailing list? if(isset($extraInfo['join_mailing_list']) && $extraInfo['join_mailing_list'] == 1) { $subscription = new Interspire_EmailIntegration_Subscription_Newsletter($email, $firstName); $subscription->setDoubleOptIn(GetConfig('EmailIntegrationOrderDoubleOptin')); // override newsletter double-opt-in preference with order double-opt-in preference when subscribing someone to newsletter list through the checkout $subscription->setSendWelcome(GetConfig('EmailIntegrationOrderSendWelcome')); // as above $subscription->setEmailFormatPreference($format); $subscription->routeSubscription(); } // Should we add them to our special offers & discounts mailing list? if(isset($extraInfo['join_order_list']) && $extraInfo['join_order_list']) { $subscription = new Interspire_EmailIntegration_Subscription_Order($order['orderid']); $subscription->setEmailFormatPreference($format); $subscription->routeSubscription(); } } }