Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specific pricing error #76

Closed
sparkcom opened this issue Jun 7, 2018 · 3 comments
Closed

Specific pricing error #76

sparkcom opened this issue Jun 7, 2018 · 3 comments

Comments

@sparkcom
Copy link
Contributor

sparkcom commented Jun 7, 2018

Hello ,

got the following error. I am using SS4. Wonder if there is a way around it.

[Recoverable Error] Argument 1 passed to SilverShop\Discounts\Model\SpecificPrice::filter() must be an instance of SilverStripe\ORM\DataList, instance of SilverStripe\ORM\UnsavedRelationList given, called in /home/xxx/vendor/silvershop/discounts/src/Extensions/ProductSpecificPricingExtension.php on line 37

@sparkcom
Copy link
Contributor Author

sparkcom commented Jun 7, 2018

Need to change

if ($specificprice = SpecificPrice::filter(
$this->owner->SpecificPrices()
->filter("Price:LessThan", $price), Member::currentUser()
)->first()) {

to

$list = SpecificPrice::get()->filter( array('ProductID'=>$this->owner->ID, "Price:LessThan"=> $price ));
if ($specificprice = SpecificPrice::filter(
$list, Security::getCurrentUser()
)->first())

@wilr
Copy link
Contributor

wilr commented Jun 7, 2018

Can you please set that up as a PR to be merged? Cheers. You probably need to check $list->exists() before doing the filter by member.

@wilr
Copy link
Contributor

wilr commented Oct 2, 2018

Merged! Thanks

@wilr wilr closed this as completed Oct 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants