silvershop / silvershop-core

SilverShop is an e-commerce shopping cart module for the SilverStripe CMS
http://silvershop.github.io
BSD 2-Clause "Simplified" License
113 stars 119 forks source link

implements Buyable and extends OrderItem crashes Dev/Build #788

Closed digitweaks closed 1 year ago

digitweaks commented 1 year ago

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'
];

}

wilr commented 1 year ago

Can you please provide the specific error message you're seeing? You should see it if your site is in dev mode or if you have error logging turned on

digitweaks commented 1 year ago

Thanks for your fast reply,

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.

digitweaks commented 1 year ago

Anyone struggling with Buyable, just check the folder "vendor/silvershop/core/tests/php/Model/Product" folder and take example on CustomProduct.php and CustomProduct_OrderItem.php