/** * Send notification about created profile to the user * * @param \XLite\Model\Order $order Order object * * @return void */ public static function sendOrderTrackingInformationCustomer(\XLite\Model\Order $order) { $orderUrl = \XLite::getInstance()->getShopURL(\XLite\Core\Converter::buildURL('order', '', array('order_number' => $order->getOrderNumber()), \XLite::CART_SELF)); static::register(array('order' => $order, 'trackingNumbers' => $order->getTrackingNumbers(), 'orderURL' => $orderUrl, 'address' => $order->getProfile()->getBillingAddress(), 'recipientName' => $order->getProfile()->getName())); static::compose(static::TYPE_ORDER_TRACKING_INFORMATION_CUSTOMER, static::getOrdersDepartmentMail(), $order->getProfile()->getLogin(), 'order_tracking_information', array(), true, \XLite::CUSTOMER_INTERFACE, static::getMailer()->getLanguageCode(\XLite::CUSTOMER_INTERFACE, $order->getProfile()->getLanguage())); \XLite\Core\OrderHistory::getInstance()->registerCustomerEmailSent($order->getOrderId(), 'Tracking information is sent to the customer'); }
/** * Prepare shopping cart data * * @param \XLite\Model\Order $cart X-Cart shopping cart * @param \XLite\Model\Payment\Method $paymentMethod Payment method * @param integer $refId Transaction ID OPTIONAL * @param boolean $forceAuth Force enable AUTH mode OPTIONAL * * @return array */ public function prepareCart(\XLite\Model\Order $cart, \XLite\Model\Payment\Method $paymentMethod, $refId = null, $forceAuth = false) { $config = \XLite\Core\Config::getInstance()->CDev->XPaymentsConnector; $profile = $cart->getProfile(); if ($cart->getOrderNumber()) { $description = 'Order #' . $cart->getOrderNumber(); } elseif ($cart->getFirstOpenPaymentTransaction() && $cart->getFirstOpenPaymentTransaction()->getPublicId()) { $description = 'Payment transaction: ' . $cart->getFirstOpenPaymentTransaction()->getPublicId(); } else { $description = ''; } $result = array('login' => $profile->getLogin() . ' (User ID #' . $profile->getProfileId() . ')', 'items' => array(), 'currency' => $this->getCurrencyCode($paymentMethod), 'shippingCost' => 0.0, 'taxCost' => 0.0, 'discount' => 0.0, 'totalCost' => 0.0, 'description' => $description, 'merchantEmail' => \XLite\Core\Config::getInstance()->Company->orders_department, 'forceTransactionType' => $forceAuth ? 'A' : ''); // Send customer unique Id for Kount UNIQ field (API v1.6 and higher) if (version_compare($config->xpc_api_version, '1.6') >= 0) { $result['kountCustomerUniq'] = $this->getKountCustomerUniq($cart); } $result['billingAddress'] = $this->prepareAddress($profile); if ($profile->getShippingAddress()) { $result['shippingAddress'] = $this->prepareAddress($profile, 'shipping'); } else { $result['shippingAddress'] = $result['billingAddress']; } // Set items if ($cart->getItems()) { foreach ($cart->getItems() as $item) { $itemElement = array('sku' => strval($item->getSku() ? $item->getSku() : $item->getName()), 'name' => strval($item->getName() ? $item->getName() : $item->getSku()), 'price' => $this->roundCurrency($item->getPrice()), 'quantity' => $item->getAmount()); if (!$itemElement['sku']) { $itemElement['sku'] = 'N/A'; } if (!$itemElement['name']) { $itemElement['name'] = 'N/A'; } $result['items'][] = $itemElement; } } // Set costs $result['shippingCost'] = $this->roundCurrency($cart->getSurchargesSubtotal(\XLite\Model\Base\Surcharge::TYPE_SHIPPING, false)); $result['taxCost'] = $this->roundCurrency($cart->getSurchargesSubtotal(\XLite\Model\Base\Surcharge::TYPE_TAX, false)); $result['totalCost'] = $this->roundCurrency($cart->getTotal()); $result['discount'] = $this->roundCurrency(abs($cart->getSurchargesSubtotal(\XLite\Model\Base\Surcharge::TYPE_DISCOUNT, false))); return $result; }
/** * {@inheritDoc} */ public function getOrderNumber() { $this->__initializer__ && $this->__initializer__->__invoke($this, 'getOrderNumber', array()); return parent::getOrderNumber(); }