QUESTION:

I have installed  Magento 2 Catalog Price Rule per Store View v1.0.7 on my ste M2.1.2. It's throwing following error. How can we fix this?

1 exception(s):
Exception #0 (Exception): Warning: Declaration of Bss\CatalogRulePerStoreView\Model\ResourceModel\RuleFrontend::getRulePrices(DateTimeInterface $date, $websiteId, $customerGroupId, $productIds) should be compatible with Magento\CatalogRule\Model\ResourceModel\Rule::getRulePrices(DateTime $date, $websiteId, $customerGroupId, $productIds) in /var/www/html/app/code/Bss/CatalogRulePerStoreView/Model/ResourceModel/RuleFrontend.php on line 0
 

Exception #0 (Exception): Warning: Declaration of Bss\CatalogRulePerStoreView\Model\ResourceModel\RuleFrontend::getRulePrices(DateTimeInterface $date, $websiteId, $customerGroupId, $productIds) should be compatible with Magento\CatalogRule\Model\ResourceModel\Rule::getRulePrices(DateTime $date, $websiteId, $customerGroupId, $productIds) in /var/www/html/app/code/Bss/CatalogRulePerStoreView/Model/ResourceModel/RuleFrontend.php on line 0


ANSWER:

This exception/die site due to the module is not compatible with M2.1.2, the core function declaration is now different from this old version which leads to incompatibility of extend class with module Magento 2 Catalog Price Rule Per Store View.


Solution:

Please edit the two files as below to fix the issue:


File: Model/ResourceModel/RuleAdmin.php

Line 159

From 

public function getRulePrices(\DateTimeInterface $date, $websiteId, $customerGroupId, $productIds, $storeId = null)

To 

public function getRulePrices(\DateTime $date, $websiteId, $customerGroupId, $productIds, $storeId = null)


File: Model/ResourceModel/RuleFrontend.php


Line 49

From

public function getRulePrices(\DateTimeInterface $date, $websiteId, $customerGroupId, $productIds)


To

public function getRulePrices(\DateTime $date, $websiteId, $customerGroupId, $productIds)



If you need further assistant, please feel free to contact us via https://bsscommerce.com/contact. We'd be happy to support.