223 \
Magento\Framework\Registry $coreRegistry,
225 $templateFilterModel,
226 \
Magento\Tax\Api\
Data\TaxClassKeyInterfaceFactory $taxClassKeyFactory,
228 \
Magento\Tax\Api\
Data\QuoteDetailsInterfaceFactory $quoteDetailsFactory,
229 \
Magento\Tax\Api\
Data\QuoteDetailsItemInterfaceFactory $quoteDetailsItemFactory,
230 \
Magento\Tax\Api\TaxCalculationInterface $taxCalculationService,
240 $this->_catalogSession = $catalogSession;
241 $this->_templateFilterFactory = $templateFilterFactory;
243 $this->_catalogCategory = $catalogCategory;
244 $this->_catalogProduct = $catalogProduct;
245 $this->_coreRegistry = $coreRegistry;
246 $this->_templateFilterModel = $templateFilterModel;
247 $this->_taxClassKeyFactory = $taxClassKeyFactory;
248 $this->_taxConfig = $taxConfig;
249 $this->_quoteDetailsFactory = $quoteDetailsFactory;
250 $this->_quoteDetailsItemFactory = $quoteDetailsItemFactory;
251 $this->_taxCalculationService = $taxCalculationService;
252 $this->_customerSession = $customerSession;
259 parent::__construct($context);
282 if (!$this->_categoryPath) {
286 $pathInStore =
$category->getPathInStore();
287 $pathIds = array_reverse(explode(
',', $pathInStore));
292 foreach ($pathIds as $categoryId) {
294 $path[
'category' . $categoryId] = [
306 $this->_categoryPath =
$path;
322 if ($categoryId != $this->
getCategory()->getId()) {
335 return $this->_coreRegistry->registry(
'current_category');
345 return $this->_coreRegistry->registry(
'current_product');
355 $productId = $this->_catalogSession->getLastViewedProductId();
363 if ($this->_catalogProduct->canShow(
$product,
'catalog')) {
367 $categoryId = $this->_catalogSession->getLastViewedCategoryId();
370 $category = $this->categoryRepository->get($categoryId);
375 if (!$this->_catalogCategory->canShow(
$category)) {
393 return $this->
string->split($sku, $length,
true,
false,
'[\-\s]');
403 if ($this->_coreRegistry->registry(
'attribute_type_hidden_fields')) {
404 return $this->_coreRegistry->registry(
'attribute_type_hidden_fields');
417 return $this->scopeConfig->getValue(
418 self::XML_PATH_PRICE_SCOPE,
440 return $this->scopeConfig->isSetFlag(
441 self::CONFIG_USE_STATIC_URLS,
455 return $this->scopeConfig->isSetFlag(
456 self::CONFIG_PARSE_URL_DIRECTIVES,
470 return $this->_templateFilterFactory->create($this->_templateFilterModel);
480 return $this->scopeConfig->isSetFlag(
481 self::XML_PATH_DISPLAY_PRODUCT_COUNT,
491 private function convertDefaultTaxAddress(array $taxAddress =
null)
493 if (empty($taxAddress)) {
497 $addressDataObject = $this->addressFactory->create()
498 ->setCountryId($taxAddress[
'country_id'])
499 ->setPostcode($taxAddress[
'postcode']);
501 if (isset($taxAddress[
'region_id'])) {
502 $addressDataObject->setRegion($this->regionFactory->create()->setRegionId($taxAddress[
'region_id']));
504 return $addressDataObject;
527 $includingTax =
null,
532 $priceIncludesTax =
null,
540 if ($this->_taxConfig->needPriceConversion(
$store)) {
541 if ($priceIncludesTax ===
null) {
542 $priceIncludesTax = $this->_taxConfig->priceIncludesTax(
$store);
548 $this->convertDefaultTaxAddress($this->_customerSession->getDefaultTaxShippingAddress());
556 $this->convertDefaultTaxAddress($this->_customerSession->getDefaultTaxBillingAddress());
561 $taxClassKey = $this->_taxClassKeyFactory->create();
563 ->setValue(
$product->getTaxClassId());
565 if ($ctc ===
null && $this->_customerSession->getCustomerGroupId() !=
null) {
566 $ctc = $this->customerGroupRepository->getById($this->_customerSession->getCustomerGroupId())
570 $customerTaxClassKey = $this->_taxClassKeyFactory->create();
574 $item = $this->_quoteDetailsItemFactory->create();
575 $item->setQuantity(1)
577 ->setShortDescription(
$product->getShortDescription())
578 ->setTaxClassKey($taxClassKey)
579 ->setIsTaxIncluded($priceIncludesTax)
583 $quoteDetails = $this->_quoteDetailsFactory->create();
586 ->setCustomerTaxClassKey($customerTaxClassKey)
588 ->setCustomerId($this->_customerSession->getCustomerId());
594 $taxDetails = $this->_taxCalculationService->calculateTax($quoteDetails,
$storeId, $roundPrice);
595 $items = $taxDetails->getItems();
596 $taxDetailsItem = array_shift(
$items);
598 if ($includingTax !==
null) {
600 $price = $taxDetailsItem->getPriceInclTax();
602 $price = $taxDetailsItem->getPrice();
605 switch ($this->_taxConfig->getPriceDisplayType(
$store)) {
608 $price = $taxDetailsItem->getPrice();
611 $price = $taxDetailsItem->getPriceInclTax();
620 return $this->priceCurrency->round(
$price);
$billingAddressDataObject
elseif(isset( $params[ 'redirect_parent']))
isUsingStaticUrlsAllowed()
getAttributeHiddenFields()
const CONTEXT_CATALOG_SORT_ORDER
splitSku($sku, $length=30)
getPageTemplateProcessor()
_isCategoryLink($categoryId)
const DISPLAY_TYPE_EXCLUDING_TAX
const DISPLAY_TYPE_INCLUDING_TAX
const XML_PATH_PRICE_SCOPE
shouldDisplayProductCountOnLayer($storeId=null)
$_quoteDetailsItemFactory
isUrlDirectivesParsingAllowed()
$shippingAddressDataObject
const PRICE_SCOPE_WEBSITE
const CONTEXT_CATALOG_SORT_DIRECTION
const CONFIG_PARSE_URL_DIRECTIVES
getTaxPrice( $product, $price, $includingTax=null, $shippingAddress=null, $billingAddress=null, $ctc=null, $store=null, $priceIncludesTax=null, $roundPrice=true)
const CONTEXT_CATALOG_DISPLAY_MODE
__construct(\Magento\Framework\App\Helper\Context $context, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Model\Session $catalogSession, \Magento\Framework\Stdlib\StringUtils $string, Category $catalogCategory, Product $catalogProduct, \Magento\Framework\Registry $coreRegistry, \Magento\Catalog\Model\Template\Filter\Factory $templateFilterFactory, $templateFilterModel, \Magento\Tax\Api\Data\TaxClassKeyInterfaceFactory $taxClassKeyFactory, \Magento\Tax\Model\Config $taxConfig, \Magento\Tax\Api\Data\QuoteDetailsInterfaceFactory $quoteDetailsFactory, \Magento\Tax\Api\Data\QuoteDetailsItemInterfaceFactory $quoteDetailsItemFactory, \Magento\Tax\Api\TaxCalculationInterface $taxCalculationService, CustomerSession $customerSession, PriceCurrencyInterface $priceCurrency, ProductRepositoryInterface $productRepository, CategoryRepositoryInterface $categoryRepository, \Magento\Customer\Api\GroupRepositoryInterface $customerGroupRepository, \Magento\Customer\Api\Data\AddressInterfaceFactory $addressFactory, \Magento\Customer\Api\Data\RegionInterfaceFactory $regionFactory)
const CONTEXT_CATALOG_LIMIT
const XML_PATH_DISPLAY_PRODUCT_COUNT
const CONFIG_USE_STATIC_URLS