Eccube\Entity\Product::_calc PHP Method

_calc() public method

public _calc ( )
    public function _calc()
    {
        if (!$this->_calc) {
            $i = 0;
            foreach ($this->getProductClasses() as $ProductClass) {
                /* @var $ProductClass \Eccube\Entity\ProductClass */
                // del_flg
                if ($ProductClass->getDelFlg() === 1) {
                    continue;
                }
                // stock_find
                $this->stockFinds[] = $ProductClass->getStockFind();
                // stock
                $this->stocks[] = $ProductClass->getStock();
                // stock_unlimited
                $this->stockUnlimiteds[] = $ProductClass->getStockUnlimited();
                // price01
                if (!is_null($ProductClass->getPrice01())) {
                    $this->price01[] = $ProductClass->getPrice01();
                    // price01IncTax
                    $this->price01IncTaxs[] = $ProductClass->getPrice01IncTax();
                }
                // price02
                $this->price02[] = $ProductClass->getPrice02();
                // price02IncTax
                $this->price02IncTaxs[] = $ProductClass->getPrice02IncTax();
                // product_code
                $this->codes[] = $ProductClass->getCode();
                if ($i === 0) {
                    if ($ProductClass->getClassCategory1() && $ProductClass->getClassCategory1()->getId()) {
                        $this->className1 = $ProductClass->getClassCategory1()->getClassName()->getName();
                    }
                    if ($ProductClass->getClassCategory2() && $ProductClass->getClassCategory2()->getId()) {
                        $this->className2 = $ProductClass->getClassCategory2()->getClassName()->getName();
                    }
                }
                if ($ProductClass->getClassCategory1()) {
                    $classCategoryId1 = $ProductClass->getClassCategory1()->getId();
                    if (!empty($classCategoryId1)) {
                        $this->classCategories1[$ProductClass->getClassCategory1()->getId()] = $ProductClass->getClassCategory1()->getName();
                        if ($ProductClass->getClassCategory2()) {
                            $this->classCategories2[$ProductClass->getClassCategory1()->getId()][$ProductClass->getClassCategory2()->getId()] = $ProductClass->getClassCategory2()->getName();
                        }
                    }
                }
                $i++;
            }
            $this->_calc = true;
        }
    }

Usage Example

 /**
  * {@inheritDoc}
  */
 public function _calc()
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, '_calc', array());
     return parent::_calc();
 }