Beispiel #1
0
 static function sendWatchEmail($controller, $watch, $product)
 {
     $itemTitle = $product->getTitle();
     $from = $controller->getNoReplyFrom();
     $memberId = $watch->getMemberId();
     if (is_numeric($memberId)) {
         $member = $controller->getSingleObject('members', 'getMemberById', array($memberId));
     } else {
         $member = $controller->getSingleObject('members', 'getMemberByEmail', array($memberId));
         if (!$member) {
             $member = self::_createFakeMemberFromEmail($memberId);
         }
     }
     if (!$member) {
         return;
     }
     $to = $member->getEmail();
     $body = self::getStockAvailableEmailBody($controller, $product, $member);
     Helper_Mail::sendEmailWithFooter($controller, $from, $to, NULL, NULL, "Item Available: {$itemTitle}", $body);
 }
Beispiel #2
0
    static function cancelOrder($controller, $order, $setRemarks = NULL)
    {
        if (isset($setRemarks)) {
            $order->setRemarks($setRemarks);
        }
        $withCancelOrders = $controller->getKrcoConfigValue('cart', 'with_cancel_orders');
        if ($withCancelOrders === FALSE) {
            return;
        }
        if ($order->getOrderStatus() == 'Cancelled') {
            return;
        }
        $currentStatus = $order->getOrderStatus();
        $order->setOrderStatus('Cancelled');
        $controller->dbCall('orders', 'updateOrder', array($order), TRUE);
        $orderedProds = $order->getOrderedProducts();
        foreach ($orderedProds as $orderedProd) {
            $item = self::_orderedProdToItem($orderedProd);
            Helper_Cart::_subtractProductStock($item, $controller, TRUE);
        }
        $memberObj = $controller->getMemberOfOrder($order);
        $controller->_processMemberPlaceOrder($order, $memberObj, TRUE);
        //revert back point earned if any
        if ($currentStatus == 'Processing') {
            self::_setMemberPoint($controller, $order, $memberObj, TRUE);
        }
        $signature = $controller->_getEmailSignature();
        $from = $controller->getNoReplyFrom();
        $to = $controller->getOrdersEmailAddress();
        $orderId = $order->getLongId();
        $orderManageLine = Helper_Krco::getOrderManageLine($controller, $order);
        $body = <<<EOD
<p>
Dear Admin,
</p>
<p>
This is to notify that the Order with ID {$orderId} is expired.
</p>
<p>
{$orderManageLine}
</p>
{$signature}

EOD;
        Helper_Mail::sendEmail($controller, $from, $to, NULL, NULL, "Expired Order: {$orderId}", $controller->_getHtmlEmailBody($body));
        $name = $order->getRecipientName();
        $userBody = $controller->_getOrderExpiredEmailBodyToUser($order);
        $smsBody = $controller->getOrderExpiredSmsBodyToUser($order);
        $emails = $controller->_getOrderEmails($order);
        Helper_Mail::sendEmailWithFooter($controller, $from, $emails['to'], $emails['cc'], NULL, "Expired Order: {$orderId}", $userBody);
        Helper_Mail::sendSms($controller, $order->getRecipientPhoneNumber(), $smsBody);
    }