/**
  * returns an order identified by session id
  *
  * @return Order order or false
  *
  * @author Sebastian Diel <*****@*****.**>,
  *         Roland Lehmann <*****@*****.**>
  * @since 16.06.2014
  */
 public function CustomersOrder()
 {
     $id = Session::get('OrderIdForConfirmation');
     $memberID = Member::currentUserID();
     if ($id && $memberID) {
         $order = SilvercartOrder::get()->filter(array('ID' => $id, 'MemberID' => $memberID))->first();
         return $order;
     }
 }
 /**
  * Render this step with the default template
  *
  * @return void
  *
  * @author Sascha Koehler <*****@*****.**>
  * @copyright 2011 pixeltricks GmbH
  * @since 06.04.2011
  */
 public function init()
 {
     $paymentConfirmationText = '';
     $checkoutData = $this->controller->getCombinedStepData();
     if (isset($checkoutData['PaymentMethod'])) {
         $this->paymentMethodObj = SilvercartPaymentMethod::get()->byID($checkoutData['PaymentMethod']);
         if ($this->paymentMethodObj) {
             if (isset($checkoutData['orderId'])) {
                 $orderObj = SilvercartOrder::get()->byID($checkoutData['orderId']);
                 if ($orderObj) {
                     $paymentConfirmationText = $this->paymentMethodObj->processPaymentConfirmationText($orderObj);
                     $this->paymentMethodObj->processPaymentAfterOrder($orderObj);
                 }
             }
         }
     }
     $templateVariables = array('PaymentConfirmationText' => $paymentConfirmationText);
     $output = $this->customise($templateVariables)->renderWith('SilvercartCheckoutFormStepDefaultOrderConfirmation');
     return $output;
 }
 /**
  * Handles the action.
  * 
  * @param GridField $gridField GridField to handle action for
  * @param array     $recordIDs Record IDs to handle action for
  * @param array     $data      Data to handle action for
  * 
  * @return void
  *
  * @author Sebastian Diel <*****@*****.**>
  * @since 14.03.2013
  */
 public function handle(GridField $gridField, $recordIDs, $data)
 {
     foreach ($recordIDs as $orderID) {
         $order = SilvercartOrder::get_by_id('SilvercartOrder', $orderID);
         if ($order->exists()) {
             $order->markAsNotSeen();
         }
     }
 }
 /**
  * Sends a mail with the given SilvercartOrder object as data provider.
  * 
  * @param SilvercartOrder $order The order object that is used to fill the
  *                               mail template variables.
  * 
  * @return void
  * 
  * @author Sascha Koehler <*****@*****.**>
  * @since 27.10.2011
  */
 public function sendMailFor(SilvercartOrder $order)
 {
     $shopEmails = $this->SilvercartShopEmails();
     if ($shopEmails) {
         foreach ($shopEmails as $shopEmail) {
             SilvercartShopEmail::send($shopEmail->Identifier, $order->CustomersEmail, array('SilvercartOrder' => $order, 'OrderNumber' => $order->OrderNumber, 'CustomersEmail' => $order->CustomersEmail, 'FirstName' => $order->SilvercartInvoiceAddress()->FirstName, 'Surname' => $order->SilvercartInvoiceAddress()->Surname, 'Salutation' => $order->SilvercartInvoiceAddress()->Salutation));
         }
     }
     $this->extend('updateSendMailFor', $order);
 }
 /**
  * returns a single order of a logged in member identified by url param id
  *
  * @return DataObject Order object
  *
  * @author Sebastian Diel <*****@*****.**>
  * @since 16.06.2014
  */
 public function CustomersOrder()
 {
     $id = Convert::raw2sql($this->getOrderID());
     $memberID = Member::currentUserID();
     $order = false;
     if ($memberID && $id) {
         $order = SilvercartOrder::get()->filter(array('ID' => $id, 'MemberID' => $memberID))->first();
         return $order;
     }
 }
 /**
  * Creates a SilvercartOrder object from the given parameters.
  *
  * @param string $customerEmail The customers email address
  * @param array  $checkoutData  The checkout data
  * @param string $customerNote  The optional note from the customer
  *
  * @return SilvercartOrder
  *
  * @author Sascha Koehler <*****@*****.**>
  * @since 01.10.2012
  */
 public function createOrder($customerEmail, $checkoutData, $customerNote)
 {
     $order = new SilvercartOrder();
     $order->setCustomerEmail($customerEmail);
     $order->setShippingMethod($checkoutData['ShippingMethod']);
     $order->setPaymentMethod($checkoutData['PaymentMethod']);
     $order->setNote($customerNote);
     $order->setWeight();
     $order->setHasAcceptedTermsAndConditions($checkoutData['HasAcceptedTermsAndConditions']);
     $order->setHasAcceptedRevocationInstruction($checkoutData['HasAcceptedRevocationInstruction']);
     $order->createFromShoppingCart();
     return $order;
 }
Example #7
0
 /**
  * template function: returns customers orders
  * 
  * @param int $limit Limit
  *
  * @since 27.10.10
  * @author Roland Lehmann <*****@*****.**>
  * @return DataList with order objects or empty DataList
  */
 public function CurrentMembersOrders($limit = null)
 {
     $memberID = Member::currentUserID();
     if ($memberID) {
         if ($limit) {
             $orders = SilvercartOrder::get()->filter('MemberID', $memberID)->limit($limit);
         } else {
             $orders = SilvercartOrder::get()->filter('MemberID', $memberID);
         }
         return $orders;
     }
 }