GoodsOptionAdapter.php 678 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: Administrator
  5. * Date: 2021/4/15
  6. * Time: 15:46
  7. */
  8. namespace app\frontend\modules\cart\manager;
  9. use app\common\models\GoodsOption;
  10. class GoodsOptionAdapter extends GoodsAdapter
  11. {
  12. public function getPrice()
  13. {
  14. return $this->currentCalculator()->product_price;
  15. }
  16. public function getMarketPrice()
  17. {
  18. return $this->currentCalculator()->market_price;
  19. }
  20. public function getCostPrice()
  21. {
  22. return $this->currentCalculator()->cost_price;
  23. }
  24. /**
  25. * @return GoodsOption
  26. */
  27. public function currentCalculator()
  28. {
  29. return $this->cart->goodsOption;
  30. }
  31. }