85 \
Magento\Framework\Json\EncoderInterface $jsonEncoder,
95 $this->_productHelper = $productHelper;
97 $this->_jsonEncoder = $jsonEncoder;
100 $this->_localeFormat = $localeFormat;
120 return [
'productType' => $this->
getProduct()->getTypeId()];
130 if (!$this->_coreRegistry->registry(
'product') && $this->getProductId()) {
131 $product = $this->productRepository->getById($this->getProductId());
132 $this->_coreRegistry->register(
'product',
$product);
134 return $this->_coreRegistry->registry(
'product');
156 if ($this->hasCustomAddToCartUrl()) {
157 return $this->getCustomAddToCartUrl();
160 if ($this->
getRequest()->getParam(
'wishlist_next')) {
161 $additional[
'wishlist_next'] = 1;
165 $addUrlValue = $this->_urlBuilder->getUrl(
'*/*/*', [
'_use_rewrite' =>
true,
'_current' =>
true]);
166 $additional[$addUrlKey] = $this->urlEncoder->encode($addUrlValue);
168 return $this->_cartHelper->getAddUrl(
$product, $additional);
185 'priceFormat' => $this->_localeFormat->getPriceFormat()
187 return $this->_jsonEncoder->encode(
$config);
191 $tierPricesList =
$product->getPriceInfo()->getPrice(
'tier_price')->getTierPriceList();
192 foreach ($tierPricesList as $tierPrice) {
197 'priceFormat' => $this->_localeFormat->getPriceFormat(),
200 'amount' =>
$product->getPriceInfo()->getPrice(
'regular_price')->getAmount()->getValue(),
204 'amount' =>
$product->getPriceInfo()->getPrice(
'final_price')->getAmount()->getBaseAmount(),
208 'amount' =>
$product->getPriceInfo()->getPrice(
'final_price')->getAmount()->getValue(),
212 'idSuffix' =>
'_clone',
216 $responseObject = new \Magento\Framework\DataObject();
217 $this->_eventManager->dispatch(
'catalog_product_view_config', [
'response_object' => $responseObject]);
218 if (is_array($responseObject->getAdditionalOptions())) {
219 foreach ($responseObject->getAdditionalOptions() as
$option =>
$value) {
224 return $this->_jsonEncoder->encode(
$config);
260 return $this->
getProduct()->getConfigureMode() || $this->_request->getParam(
'startcustomization');
278 $configQty =
$config->getQty();
279 if ($configQty > $qty) {
293 return $this->
getProduct()->getOptionsContainer() ==
'container1' ?
'container1' :
'container2';
303 return !$this->productTypeConfig->isProductSet($this->
getProduct()->getTypeId());
314 $validators[
'required-number'] =
true;
325 $identities = $this->
getProduct()->getIdentities();
326 $category = $this->_coreRegistry->registry(
'current_category');
340 return $this->customerSession->getCustomerId();
getAddToCartUrl($product, $additional=[])
getProductDefaultQty($product=null)
const PARAM_NAME_URL_ENCODED
__construct(\Magento\Catalog\Block\Product\Context $context, \Magento\Framework\Url\EncoderInterface $urlEncoder, \Magento\Framework\Json\EncoderInterface $jsonEncoder, \Magento\Framework\Stdlib\StringUtils $string, \Magento\Catalog\Helper\Product $productHelper, \Magento\Catalog\Model\ProductTypes\ConfigInterface $productTypeConfig, \Magento\Framework\Locale\FormatInterface $localeFormat, \Magento\Customer\Model\Session $customerSession, ProductRepositoryInterface $productRepository, \Magento\Framework\Pricing\PriceCurrencyInterface $priceCurrency, array $data=[])