Source of file CustomProduct.php
Size: 0,980 Bytes - Last Modified: 2021-12-24T06:35:03+00:00
/var/www/docs.ssmods.com/process/src/tests/php/Model/Product/CustomProduct.php
1234567891011121314151617181920212223242526272829303132333435363738394041424344 | <?php namespace SilverShop\Tests\Model\Product; use SilverShop\Model\Buyable; use SilverStripe\Dev\TestOnly; use SilverStripe\ORM\DataObject; /** * @package shop * @subpackage tests */ class CustomProduct extends DataObject implements Buyable, TestOnly { private static $db = array( 'Title' => 'Varchar', 'Price' => 'Currency', ); private static $order_item = CustomProduct_OrderItem::class; private static $table_name = 'SilverShop_Test_CustomProduct'; public function createItem($quantity = 1, $filter = array()) { $itemclass = self::config()->order_item; $item = new $itemclass(); $item->CustomProductID = $this->ID; if ($filter) { $item->update($filter); } return $item; } public function canPurchase($member = null, $quantity = 1) { return $this->Price > 0; } public function sellingPrice() { return $this->Price; } } |