Source of file LineItemExtension.php
Size: 0,765 Bytes - Last Modified: 2021-12-23T10:24:30+00:00
/var/www/docs.ssmods.com/process/src/src/LineItemExtension.php
1234567891011121314151617181920212223242526272829303132333435 | <?php namespace SilverCommerce\DownloadableProducts; use SilverStripe\ORM\DataExtension; use SilverCommerce\OrdersAdmin\Model\Invoice; class LineItemExtension extends DataExtension { private static $casting = [ "DownloadLink" => "Varchar" ]; /** * Generate a link which can be used to download this product. * * @return string */ public function getDownloadLink() { $invoice = $this->getOwner()->Parent(); $match = $this->getOwner()->match(); if ($match && method_exists($match, "getDownloadLink") && $invoice->isPaid()) { return $match->getDownloadLink( $invoice->ID, $invoice->AccessKey ); } return ""; } } |