예제 #1
0
 public function testCanInstantiateItem()
 {
     $item = new Item(123, 12.5, 1);
     $this->assertEquals(123, $item->getSku());
     $this->assertEquals(12.5, $item->getPrice());
     $this->assertEquals(1, $item->getQuantity());
 }
예제 #2
0
 protected function prepareTransactionItem(Transaction $transaction, Item $item)
 {
     return $this->push('addItem', array($transaction->getId(), $item->getSku(), $item->getProduct(), $item->getCategory(), $item->getPrice(), $item->getQuantity()));
 }
예제 #3
0
 protected function prepareTransactionItem(Transaction $transaction, Item $item)
 {
     $itemParams = array('id' => $transaction->getId(), 'name' => $item->getProduct());
     $sku = $item->getSku();
     if ($sku !== null) {
         $itemParams['sku'] = $sku;
     }
     $category = $item->getCategory();
     if ($category !== null) {
         $itemParams['category'] = $category;
     }
     $price = $item->getPrice();
     if ($price !== null) {
         $itemParams['price'] = $price;
     }
     $quantity = $item->getQuantity();
     if ($quantity !== null) {
         $itemParams['quantity'] = $quantity;
     }
     $params = array('ecommerce:addItem', $itemParams);
     return $this->callGa($params);
 }