Closed jameshoward closed 8 years ago
Good catch, @jameshoward. I've run into that before as well. Just created pull request #35. Assuming it passes CI I'll merge it today. @jedateach I don't think we want to require the shipping framework do we?
Two potential solutions I can think of:
getModifier
so it returns NULL
rather than throwing an error. Without knowing where else this method is called from, I can't tell if this actually breaks more than it solves.hasModifier
method. This could do a couple of lazy checks first:// Lazy checks for class existing and order having modifiers.
if (!ClassInfo::exists($className) || ($this->order->Modifiers()->count() == 0)) {
return false;
}
// Check whether the order has the modifier...
Or your 3rd option in #35 that looks much less risky! :)
@jedateach it's worth thinking about #1 above as a fix in the shop module itself.
35 is merged
This has been resolved.
How long until this is released? We're using this module and it has been over a year since anything was released. Ran into this issue today with the latest release, had to fix the package at a commit (not preferable)
@isaac-at-room9 Tagged a 1.2.0 release.
@wilr oh, i must've missed that one when I first installed the package... I can't see it on https://packagist.org/packages/silvershop/discounts
If I install the discount module on a base shop install I get the following notice:
Modifier class "ShippingFrameworkModifier" does not exist.
I've tracked this down to
Shop\Discount\Calculator
line 92:if($shipping = $this->order->getModifier("ShippingFrameworkModifier")){
In
Order::getModifier
there's aClassInfo::exists
check that's throwing theuser_error
because that class doesn't exist.Either there's a dependency on
silverstripe-shop-shipping
or a better way of determining if the order has that modifier without needing the class to exist.