1 | <?php |
||
24 | class Upsell extends \Magento\Catalog\Block\Product\ProductList\Upsell |
||
25 | { |
||
26 | /** |
||
27 | * @var Config |
||
28 | */ |
||
29 | private $_config; |
||
30 | |||
31 | /** |
||
32 | * @var ProductFactory |
||
33 | */ |
||
34 | private $_productFactory; |
||
35 | |||
36 | /** |
||
37 | * @var PersonalisedUpsell |
||
38 | */ |
||
39 | private $_upsell; |
||
40 | |||
41 | /** |
||
42 | * @var bool |
||
43 | */ |
||
44 | protected $_isPredictedResults = false; |
||
45 | |||
46 | /** |
||
47 | * Upsell constructor. |
||
48 | * @param Context $context |
||
49 | * @param Cart $checkoutCart |
||
50 | * @param Visibility $productVisibility |
||
51 | * @param Session $checkoutSession |
||
52 | * @param Manager $moduleManager |
||
53 | * @param ProductFactory $productFactory |
||
54 | * @param Config $config |
||
55 | * @param PersonalisedUpsell $upsell |
||
56 | * @param CustomerSession $customerSession |
||
57 | * @param array $data |
||
58 | */ |
||
59 | public function __construct( |
||
60 | Context $context, |
||
61 | Cart $checkoutCart, |
||
62 | Visibility $productVisibility, |
||
63 | Session $checkoutSession, |
||
64 | Manager $moduleManager, |
||
65 | ProductFactory $productFactory, |
||
66 | Config $config, |
||
67 | PersonalisedUpsell $upsell, |
||
68 | CustomerSession $customerSession, |
||
69 | array $data = [] |
||
70 | ) { |
||
71 | $this->_config = $config; |
||
72 | $this->_productFactory = $productFactory; |
||
73 | $this->_upsell = $upsell; |
||
74 | $this->_customerSession = $customerSession; |
||
75 | parent::__construct( |
||
76 | $context, |
||
77 | $checkoutCart, |
||
78 | $productVisibility, |
||
79 | $checkoutSession, |
||
80 | $moduleManager, |
||
81 | $data |
||
82 | ); |
||
83 | } |
||
84 | |||
85 | /** |
||
86 | * Rewrite parent _prepareData method to use PredictionIO results when available |
||
87 | * |
||
88 | * @return $this |
||
89 | */ |
||
90 | protected function _prepareData() |
||
126 | |||
127 | /** |
||
128 | * Get the URL for product upsells block via ajax |
||
129 | * |
||
130 | * @return string |
||
131 | */ |
||
132 | public function getUpsellAjaxUrl() |
||
136 | |||
137 | /** |
||
138 | * Check if the displayed results are from PredictionIO |
||
139 | * |
||
140 | * @return bool |
||
141 | */ |
||
142 | public function isPredictedResults() |
||
146 | } |
||
147 |