88namespace Magento \Catalog \Model \Product \Type ;
99
1010use Magento \Catalog \Model \Product ;
11- use Magento \Catalog \Model \Product \Price \TierPriceBuilder ;
1211use Magento \Customer \Api \GroupManagementInterface ;
1312use Magento \Framework \Pricing \PriceCurrencyInterface ;
1413use Magento \Store \Model \Store ;
@@ -94,11 +93,6 @@ class Price
9493 */
9594 private $ tierPriceExtensionFactory ;
9695
97- /**
98- * @var TierPriceBuilder
99- */
100- private $ tierPriceBuilder ;
101-
10296 /**
10397 * Constructor
10498 *
@@ -109,10 +103,9 @@ class Price
109103 * @param \Magento\Framework\Event\ManagerInterface $eventManager
110104 * @param PriceCurrencyInterface $priceCurrency
111105 * @param GroupManagementInterface $groupManagement
112- * @param \Magento\Catalog\Api\Data\ProductTierPriceInterfaceFactory $tierPriceFactory @deprecated
106+ * @param \Magento\Catalog\Api\Data\ProductTierPriceInterfaceFactory $tierPriceFactory
113107 * @param \Magento\Framework\App\Config\ScopeConfigInterface $config
114- * @param ProductTierPriceExtensionFactory|null $tierPriceExtensionFactory @deprecated
115- * @param TierPriceBuilder $tierPriceBuilder
108+ * @param ProductTierPriceExtensionFactory|null $tierPriceExtensionFactory
116109 * @SuppressWarnings(PHPMD.ExcessiveParameterList)
117110 */
118111 public function __construct (
@@ -125,8 +118,7 @@ public function __construct(
125118 GroupManagementInterface $ groupManagement ,
126119 \Magento \Catalog \Api \Data \ProductTierPriceInterfaceFactory $ tierPriceFactory ,
127120 \Magento \Framework \App \Config \ScopeConfigInterface $ config ,
128- ProductTierPriceExtensionFactory $ tierPriceExtensionFactory = null ,
129- ?TierPriceBuilder $ tierPriceBuilder = null
121+ ProductTierPriceExtensionFactory $ tierPriceExtensionFactory = null
130122 ) {
131123 $ this ->_ruleFactory = $ ruleFactory ;
132124 $ this ->_storeManager = $ storeManager ;
@@ -139,8 +131,6 @@ public function __construct(
139131 $ this ->config = $ config ;
140132 $ this ->tierPriceExtensionFactory = $ tierPriceExtensionFactory ?: ObjectManager::getInstance ()
141133 ->get (ProductTierPriceExtensionFactory::class);
142- $ this ->tierPriceBuilder = $ tierPriceBuilder ?: ObjectManager::getInstance ()
143- ->get (TierPriceBuilder::class);
144134 }
145135
146136 /**
@@ -379,7 +369,28 @@ protected function getAllCustomerGroupsId()
379369 */
380370 public function getTierPrices ($ product )
381371 {
382- return $ this ->tierPriceBuilder ->getTierPrices ($ product );
372+ $ prices = [];
373+ $ tierPrices = $ this ->getExistingPrices ($ product , 'tier_price ' );
374+ foreach ($ tierPrices as $ price ) {
375+ /** @var \Magento\Catalog\Api\Data\ProductTierPriceInterface $tierPrice */
376+ $ tierPrice = $ this ->tierPriceFactory ->create ()
377+ ->setExtensionAttributes ($ this ->tierPriceExtensionFactory ->create ());
378+ $ tierPrice ->setCustomerGroupId ($ price ['cust_group ' ]);
379+ if (array_key_exists ('website_price ' , $ price )) {
380+ $ value = $ price ['website_price ' ];
381+ } else {
382+ $ value = $ price ['price ' ];
383+ }
384+ $ tierPrice ->setValue ($ value );
385+ $ tierPrice ->setQty ($ price ['price_qty ' ]);
386+ if (isset ($ price ['percentage_value ' ])) {
387+ $ tierPrice ->getExtensionAttributes ()->setPercentageValue ($ price ['percentage_value ' ]);
388+ }
389+ $ websiteId = isset ($ price ['website_id ' ]) ? $ price ['website_id ' ] : $ this ->getWebsiteForPriceScope ();
390+ $ tierPrice ->getExtensionAttributes ()->setWebsiteId ($ websiteId );
391+ $ prices [] = $ tierPrice ;
392+ }
393+ return $ prices ;
383394 }
384395
385396 /**
0 commit comments