Example #1
0
 function give_feedback()
 {
     $saleId = (int) $this->input->post('saleId');
     $rating_val = (int) $this->input->post('rating_val');
     $person_id = $this->phpsession->get('personVO')->getPerson_id();
     $mysqltime = date("Y-m-d H:i:s");
     require_once APPPATH . 'models/VOs/SaleVO' . EXT;
     $saleVO = new SaleVO($saleId);
     $saleVO->Load();
     if ($saleVO->getBuyerId() == $person_id && $saleVO->getSeller_rating() == "0") {
         $saleVO->setSeller_rating($rating_val);
     } elseif ($saleVO->getSellerId() == $person_id && $saleVO->getBuyer_rating() == "0") {
         $saleVO->setBuyer_rating($rating_val);
     }
     if ($saleVO->Save()) {
         return true;
     } else {
         return false;
     }
 }
Example #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;
        }
    }