6
6
use Magento \Framework \UrlInterface ;
7
7
use Magento \Framework \App \Action \Context ;
8
8
use Magento \Framework \Url \DecoderInterface ;
9
+ use Magento \Catalog \Controller \Product \View \ViewInterface ;
10
+ use Magento \Catalog \Model \Product as ModelProduct ;
11
+ use Swissup \Easytabs \Helper \Product as HelperProduct ;
9
12
10
- class Index extends \Magento \Catalog \ Controller \Product
13
+ class Index extends \Magento \Framework \ App \ Action \Action implements ViewInterface
11
14
{
12
15
/**
13
16
* @var DecoderInterface
14
17
*/
15
18
private $ decoder ;
16
19
17
20
/**
18
- * @param DecoderInterface $decode
19
- * @param Context $context
21
+ * @var HelperProduct
22
+ */
23
+ private $ helper ;
24
+
25
+ /**
26
+ * @param DecoderInterface $decoder
27
+ * @param HelperProduct $helper
28
+ * @param Context $context
20
29
*/
21
30
public function __construct (
22
31
DecoderInterface $ decoder ,
32
+ HelperProduct $ helper ,
23
33
Context $ context
24
34
) {
25
35
$ this ->decoder = $ decoder ;
36
+ $ this ->helper = $ helper ;
26
37
parent ::__construct ($ context );
27
38
}
28
39
@@ -39,4 +50,20 @@ public function execute()
39
50
40
51
return $ this ->resultFactory ->create (ResultFactory::TYPE_LAYOUT );
41
52
}
53
+
54
+ /**
55
+ * Initialize requested product object
56
+ *
57
+ * @return ModelProduct
58
+ */
59
+ protected function _initProduct ()
60
+ {
61
+ $ categoryId = (int )$ this ->getRequest ()->getParam ('category ' , false );
62
+ $ productId = (int )$ this ->getRequest ()->getParam ('id ' );
63
+
64
+ $ params = new \Magento \Framework \DataObject ();
65
+ $ params ->setCategoryId ($ categoryId );
66
+
67
+ return $ this ->helper ->initProduct ($ productId , $ this , $ params );
68
+ }
42
69
}
0 commit comments