diff --git a/Plugin/ContextPlugin.php b/Plugin/ContextPlugin.php index b9a8cc1..f8efac7 100644 --- a/Plugin/ContextPlugin.php +++ b/Plugin/ContextPlugin.php @@ -34,13 +34,14 @@ public function aroundDispatch( RequestInterface $request ): mixed { - // show product offer price if shop has been selected, even in Retail mode - if ($this->settingsHelper->isDriveMode() || $this->currentStore->getRetailer()) { + if ($this->settingsHelper->isDriveMode()) { // Set a default value to have common vary for all customers without any chosen retailer. $retailerId = 'default'; - if ($this->currentStore->getRetailer() - && $this->currentStore->getRetailer()->getId()) { + if ( + $this->currentStore->getRetailer() + && $this->currentStore->getRetailer()->getId() + ) { $retailerId = $this->currentStore->getRetailer()->getId(); } diff --git a/Plugin/ProductPlugin.php b/Plugin/ProductPlugin.php index 84891c5..8950e5d 100644 --- a/Plugin/ProductPlugin.php +++ b/Plugin/ProductPlugin.php @@ -6,7 +6,6 @@ use Closure; use Magento\Catalog\Model\Product; -use Smile\Retailer\Api\Data\RetailerInterface; use Smile\RetailerOffer\Helper\Offer; use Smile\RetailerOffer\Helper\Settings; use Smile\StoreLocator\CustomerData\CurrentStore; @@ -16,7 +15,6 @@ */ class ProductPlugin { - public function __construct( private Offer $offerHelper, private Settings $settingsHelper, @@ -24,20 +22,6 @@ public function __construct( ) { } - /** - * Retrieve current retailer. - */ - private function getRetailer(): ?RetailerInterface - { - $retailer = null; - if ($this->currentStore->getRetailer() && $this->currentStore->getRetailer()->getId()) { - /** @var RetailerInterface $retailer */ - $retailer = $this->currentStore->getRetailer(); - } - - return $retailer; - } - /** * Return offer availability (if any) instead of the product one. * @@ -47,8 +31,7 @@ public function aroundIsAvailable(Product $product, Closure $proceed): bool { $isAvailable = $proceed(); - // show product availability if shop has been selected, even in Retail mode - if ($this->settingsHelper->useStoreOffers() || $this->getRetailer()) { + if ($this->settingsHelper->useStoreOffers()) { $isAvailable = false; $offer = $this->offerHelper->getCurrentOffer($product); @@ -67,8 +50,7 @@ public function aroundGetPrice(Product $product, Closure $proceed): mixed { $price = $proceed(); - // show product offer price if shop has been selected, even in Retail mode - if ($this->settingsHelper->useStoreOffers() || $this->getRetailer()) { + if ($this->settingsHelper->useStoreOffers()) { $offer = $this->offerHelper->getCurrentOffer($product); if ($offer && $offer->getPrice()) { @@ -88,8 +70,7 @@ public function aroundGetSpecialPrice(Product $product, Closure $proceed): mixed { $price = $proceed(); - // show product offer price if shop has been selected, even in Retail mode - if ($this->settingsHelper->useStoreOffers() || $this->getRetailer()) { + if ($this->settingsHelper->useStoreOffers()) { $offer = $this->offerHelper->getCurrentOffer($product); if ($offer && $offer->getSpecialPrice()) { @@ -107,8 +88,7 @@ public function aroundGetFinalPrice(Product $product, Closure $proceed, mixed $q { $price = $proceed($qty); - // show product offer price if shop has been selected, even in Retail mode - if ($this->settingsHelper->useStoreOffers() || $this->getRetailer()) { + if ($this->settingsHelper->useStoreOffers()) { $offer = $this->offerHelper->getCurrentOffer($product); if ($offer) {