Пример #1
0
    private function send_sale_emails(SaleVO $saleVO)
    {
        /* @var $saleItemVO ItemVO */
        $saleItemVO = $this->getItems(array($saleVO->getOwned_item_id()), true);
        $saleItemVO = $saleItemVO[0];
        $saleName = $saleItemVO->getName();
        $saleId = $saleVO->getSaleId();
        $seller = $this->getSellerEmail($saleVO->getSaleId());
        $sellerEmail = $seller['email'];
        $sellerName = $seller['name'];
        /* @var $buyerVO PersonVO */
        $buyerVO = $this->phpsession->get('personVO');
        //Buyer's email
        $buyer_email = $this->phpsession->get('personVO')->getEmail();
        $this->load->library('email');
        $config['mailtype'] = 'html';
        $config['charset'] = 'iso-8859-1';
        $config['wordwrap'] = FALSE;
        $this->email->initialize($config);
        $this->email->from('*****@*****.**', 'Klect.com');
        $this->email->to($buyerVO->getEmail());
        $this->email->subject('Klect.com - Your Purchase!');
        $message = <<<STRING
You have successfully bought {$saleName}, transaction : {$saleId} on the KLECT Marketplace!<br/>
The next steps for you is to arrange payment with the seller once they send you the total with shipping. If you do not hear from them in a reasonable time, please contact them at:<br/>
<br/>
Email: {$sellerEmail}<br/>
Shipping Name: {$sellerName}<br/>
<br/>
Once the seller has sent you the total, please provide your payment in a timely fashion. Once they receive payment and mark the item shipped, you will be able to see the update on the KLECT marketplace. Once you receive the item, mark it received and we will automatically update your inventory with the new item!<br/>
<br/>
Thank you for using KLECT.<br/>
STRING;
        $this->email->message($message, 'Congratulations!');
        $this->email->send($buyerVO->getEmail());
        //Seller's email
        $this->load->library('email');
        $this->email->from('*****@*****.**', 'Klect.com');
        $this->email->to($sellerEmail);
        $this->email->subject('Klect.com - You Made a Sale!');
        $buyer_name = $buyerVO->getFname() . ' ' . $buyerVO->getLname();
        $buyer_addr = $buyerVO->getAddr1() . ' ' . $buyerVO->getAddr2();
        $buyer_city = $buyerVO->getCity();
        $buyer_state = $buyerVO->getState();
        $buyer_zip = $buyerVO->getZip();
        $message = <<<STRING
You have successfully sold your {$saleName}, Sale Id : {$saleId} on the KLECT Marketplace!<br/>
The next steps for you is to arrange payment and shipping with the buyer. Their contact information is :<br/>
<br/>
Email: {$buyer_email}<br/>
Shipping Name: {$buyer_name}<br/>
Shipping Address: {$buyer_addr}<br/>
Shipping City: {$buyer_city}<br/>
Shipping State: {$buyer_state}<br/>
Shipping Zip: {$buyer_zip}<br/>
<br/>
Please provide the buyer with the shipping and payment details.<br/>
<br/>
Once you have received payment, update the status of the sale in the Marketplace when you have shipped the item.  Updating will send an email to the buyer and once they receive the item and confirm, KLECT will automatically remove the item from your online inventory.<br/>
<br/>
Thank you for using KLECT.<br/>
STRING;
        $this->email->message($message, 'Congratulations!');
        $this->email->send();
    }
Пример #2
0
    public function mark_as_shipped()
    {
        $saleId = $this->input->post('saleId');
        /* @var $saleVO SaleVO */
        require_once APPPATH . 'models/VOs/SaleVO' . EXT;
        $saleVO = new SaleVO($saleId);
        $saleVO->Load();
        /* @var $saleItemVO ItemVO */
        $saleItemVO = $this->getItems(array($saleVO->getOwned_item_id()), true);
        $saleItemVO = $saleItemVO[0];
        $saleVO->setShipped(true);
        if ($saleVO->Save()) {
            //Buyer's email
            $this->load->library('email');
            $config['mailtype'] = 'html';
            $config['charset'] = 'iso-8859-1';
            $config['wordwrap'] = FALSE;
            $this->email->initialize($config);
            $this->email->subject('Klect.com - Your Item Has Shipped!');
            $this->email->from('*****@*****.**', 'Klect.com');
            $this->email->to($this->getBuyerEmail($saleVO->getSaleId()));
            $saleName = $saleItemVO->getName();
            $saleId = $saleVO->getSaleId();
            /* @var $sellerVO PersonVO */
            $sellerVO = $this->phpsession->get('personVO');
            $seller_name = $sellerVO->getFname() . ' ' . $sellerVO->getLname();
            $message = <<<STRING
This email is to update you on your recent purchase of {$saleName}, Sale ID: {$saleId}.  {$seller_name} has updated that they have shipped your item. Once you receive it, click on the receipt button and your inventory will be automatically updated!<br/>
<br/>
Should you not receive your item in the expected time frame, or have any issues with the item, please contact the seller directly.<br/>
<br/>
Thank you for using KLECT!<br/>
STRING;
            $this->email->message($message);
            $this->email->send();
            return true;
        } else {
            return false;
        }
    }