Source of file CustomProduct_OrderItem.php
Size: 1,024 Bytes - Last Modified: 2021-12-24T06:35:03+00:00
/var/www/docs.ssmods.com/process/src/tests/php/Model/Product/CustomProduct_OrderItem.php
1234567891011121314151617181920212223242526272829303132333435363738394041 | <?php namespace SilverShop\Tests\Model\Product; use SilverShop\Model\Product\OrderItem; use SilverStripe\Dev\TestOnly; use SilverStripe\Security\Member; class CustomProduct_OrderItem extends OrderItem implements TestOnly { private static $db = array( 'Color' => "Enum('Red,Green,Blue','Red')", 'Size' => 'Int', 'Premium' => 'Boolean', ); private static $defaults = array( 'Color' => 'Red', 'Premium' => false, ); private static $has_one = array( 'CustomProduct' => CustomProduct::class, 'Recipient' => Member::class, ); private static $buyable_relationship = "CustomProduct"; private static $required_fields = array( 'Color', 'Size', 'Premium', 'Recipient', ); private static $table_name = 'SilverShop_Test_CustomProduct_OrderItem'; public function UnitPrice() { if ($product = $this->CustomProduct()) { return $product->Price; } return 0; } } |