44
55namespace Smile \StoreLocator \Block \View ;
66
7- use Magento \Framework \Exception \NoSuchEntityException ;
87use Magento \Framework \Registry ;
98use Magento \Framework \UrlInterface ;
109use Magento \Framework \View \Element \Template \Context ;
11- use Magento \Store \Model \Store ;
1210use Smile \Map \Api \Data \GeoPointInterface ;
1311use Smile \Map \Api \MapInterface ;
1412use Smile \Map \Api \MapProviderInterface ;
1917use Smile \Retailer \Model \ResourceModel \Retailer \CollectionFactory as RetailerCollectionFactory ;
2018use Smile \StoreLocator \Api \Data \RetailerAddressInterface ;
2119use Smile \StoreLocator \Block \AbstractView ;
20+ use Smile \StoreLocator \Helper \Contact ;
2221use Smile \StoreLocator \Helper \Data ;
2322use Smile \StoreLocator \Helper \Schedule ;
2423use Smile \StoreLocator \Model \Retailer \ScheduleManagement ;
@@ -39,6 +38,7 @@ public function __construct(
3938 Context $ context ,
4039 Registry $ coreRegistry ,
4140 MapProviderInterface $ mapProvider ,
41+ private Contact $ contactHelper ,
4242 private Data $ storeLocatorHelper ,
4343 private AddressFormatter $ addressFormatter ,
4444 private Schedule $ scheduleHelper ,
@@ -168,38 +168,6 @@ public function getDescription(): ?string
168168 return $ this ->getRetailer ()->getData ('description ' );
169169 }
170170
171- /**
172- * * Get base media url.
173- *
174- * @throws NoSuchEntityException
175- */
176- public function getImageUrl (): string
177- {
178- /** @var Store $currentStore */
179- $ currentStore = $ this ->_storeManager ->getStore ();
180-
181- return $ currentStore ->getBaseUrl (UrlInterface::URL_TYPE_MEDIA );
182- }
183-
184- /**
185- * Get image name.
186- */
187- protected function getMediaPath (): string |bool
188- {
189- return $ this ->getRetailer ()->getMediaPath () ?: false ;
190- }
191-
192- /**
193- * Get full image url.
194- */
195- public function getImage (): string |bool
196- {
197- $ mediaPath = $ this ->getMediaPath ();
198- $ imageUrlRetailer = $ this ->getImageUrl () . 'seller/ ' ;
199-
200- return $ mediaPath ? $ imageUrlRetailer . $ mediaPath : false ;
201- }
202-
203171 /**
204172 * Get store name.
205173 */
@@ -294,4 +262,20 @@ private function getSetStorePostData(RetailerInterface $retailer): array
294262
295263 return ['action ' => $ setUrl , 'data ' => $ postData ];
296264 }
265+
266+ /**
267+ * Check if we can display contact form for current retailer.
268+ */
269+ public function showContactForm (): bool
270+ {
271+ return $ this ->contactHelper ->canDisplayContactForm ($ this ->getRetailer ());
272+ }
273+
274+ /**
275+ * Retrieve Contact form Url for current retailer.
276+ */
277+ public function getContactFormUrl (): string
278+ {
279+ return $ this ->contactHelper ->getContactFormUrl ($ this ->getRetailer ());
280+ }
297281}
0 commit comments