SilverShop compatibility with SS4.13

Silverstripe Version:
SilverStripe 4.13

Question:
Hi everyone, I’ve been trying to use SilverShop in SS4.13, I have no issue with my code until I use “implements Buyable” or “extends OrderItem”.

Basically whenever I use these, I can’t finish the Dev/Build process and I have no idea how to move forward from there. Using pages as products would be way too complicated in that project so I cannot use that solution.

My guess is SilverShop isn’t fully compatible with SS4.13 and that’s why the build keeps crashing.

I leave the code I have even though I don’t think it will be helpful, I also tried creating a class extending OrderItem with no luck.

Any insight is welcome. Thanks in advance.

use SilverShop\Model\Buyable;
use SilverShop\Model\OrderItem\OrderItem;

class RentalReservation extends DataObject implements Buyable { 
    
    private static $db = [
        'Title' => 'Varchar(128)',
        'CheckInDate' => 'Date',
        'CheckOutDate' => 'Date',
        'GuestsCount' => 'Int',
        'Price' => 'Currency'
    ];

    private static $has_one = [
        'Client' => Member::class,
        'Rental' => RentalObject::class 
    ];

    private static $summary_fields = [
        'Client.Name' => 'Client',
        'CheckInDate.Nice' => 'Reservation Check-in',
        'CheckOutDate.Nice' => 'Reservation Check-out'
    ];

}

I don’t know Silvershop but, regardlless, in PHP if your class implements an interface it must… well, implements it, otherwise what would be the purpose of the interfaces?

In short you must implement what defined in the interface, i.e. createItem, canPurchase and sellingPrice methods.

Ok, though does that crash the Dev/Build if the functions of the interface aren’t yet implemented?

Actually been checking the “vendor/silvershop/core/tests/php/Model/Product” folder and with the exemples, I’ve been able to implement the Buyable and it does go through Dev/Build

Hopefully the module has some good practical exemples.