Ejemplo n.º 1
0
 /**
  * Retrieve summary qty
  *
  * @return int
  */
 protected function getSummaryQty()
 {
     if (!$this->summaryQty) {
         $this->summaryQty = $this->cart->getSummaryQty();
     }
     return $this->summaryQty;
 }
Ejemplo n.º 2
0
 /**
  * Get shopping cart items qty based on configuration (summary qty or items qty)
  *
  * @return int|float
  */
 public function getSummaryCount()
 {
     if ($this->getData('summary_qty')) {
         return $this->getData('summary_qty');
     }
     return $this->_checkoutCart->getSummaryQty();
 }
Ejemplo n.º 3
0
 /**
  * Get shopping cart items qty based on configuration (summary qty or items qty)
  *
  * @return int|float
  */
 protected function getSummaryCount()
 {
     if (!$this->summeryCount) {
         $this->summeryCount = $this->checkoutCart->getSummaryQty() ?: 0;
     }
     return $this->summeryCount;
 }
Ejemplo n.º 4
0
 /**
  * @param boolean $useQty
  * @dataProvider useQtyDataProvider
  */
 public function testGetSummaryQty($useQty)
 {
     $quoteId = 1;
     $itemsCount = 1;
     $quoteMock = $this->getMock('Magento\\Quote\\Model\\Quote', ['getItemsCount', 'getItemsQty', '__wakeup'], [], '', false);
     $this->checkoutSessionMock->expects($this->any())->method('getQuote')->will($this->returnValue($quoteMock));
     $this->checkoutSessionMock->expects($this->at(2))->method('getQuoteId')->will($this->returnValue($quoteId));
     $this->customerSessionMock->expects($this->any())->method('isLoggedIn')->will($this->returnValue(true));
     $this->scopeConfigMock->expects($this->once())->method('getValue')->with('checkout/cart_link/use_qty', \Magento\Framework\Store\ScopeInterface::SCOPE_STORE)->will($this->returnValue($useQty));
     $qtyMethodName = $useQty ? 'getItemsQty' : 'getItemsCount';
     $quoteMock->expects($this->once())->method($qtyMethodName)->will($this->returnValue($itemsCount));
     $this->assertEquals($itemsCount, $this->cart->getSummaryQty());
 }