function find($id = 0) { global $dm; if ($cart = parent::find($id)) { $cart->Email = $dm->CartEmail()->findOneBy(array('cartId' => $cart->cartId)); $cart->Item = $dm->CartItem()->findOneBy(array('cartId' => $cart->cartId)); } return $cart; }
/** * @covers Cart\BaseCart::removeAll * @todo Implement testRemoveAll(). */ public function testRemoveAll() { $result = $this->object->removeAll(); $this->assertTrue($result['delete']); }
public function __get($strName) { switch ($strName) { case 'completed': return "nothing"; return $this->carts(array('scopes' => array('complete'))); case 'DatetimeCreated': return date(_xls_get_conf('DATE_FORMAT', 'Y-m-d'), strtotime($this->datetime_cre)); case 'cartitems': return $this->cartItems; case 'Length': return $this->GetLength(); case 'Height': return $this->GetHeight(); case 'Width': return $this->GetWidth(); case 'Weight': return $this->GetWeight(); case 'HasShippableGift': return $this->HasShippableGift(); case 'GiftAddress': return $this->GiftAddress(); case 'SubTotalTaxIncIfSet': QApplication::Log(E_USER_NOTICE, 'legacy', $strName); return $this->Subtotal; case 'tax1name': case 'tax1Name': return Tax::TaxByLsid(1); case 'tax2name': case 'tax2Name': return Tax::TaxByLsid(2); case 'tax3name': case 'tax3Name': return Tax::TaxByLsid(3); case 'tax4name': case 'tax4Name': return Tax::TaxByLsid(4); case 'tax5name': case 'tax5Name': return Tax::TaxByLsid(5); case 'tax_total': case 'TaxTotal': return round(round($this->tax1, 2) + round($this->tax2, 2) + round($this->tax3, 2) + round($this->tax4, 2) + round($this->tax5, 2), 2); case 'tax_code': if (isset($this->taxCode->code)) { return $this->taxCode->code; } else { return ''; } case 'payment': if (isset($this->payment)) { return parent::__get($strName); } else { return new CartPayment(); } case 'Taxes': $arrTaxes = Tax::model()->findAll(array('order' => 'id')); return array($arrTaxes[0]->tax => round($this->tax1, 2), $arrTaxes[1]->tax => round($this->tax2, 2), $arrTaxes[2]->tax => round($this->tax3, 2), $arrTaxes[3]->tax => round($this->tax4, 2), $arrTaxes[4]->tax => round($this->tax5, 2)); case 'Pending': return $this->GetPending(); case 'shipping_sell': if (isset($this->shipping->shipping_sell)) { return $this->shipping->getShippingSell(); } else { return 0; } default: return parent::__get($strName); } }