Source of file ProductVariation_OrderItem.php
Size: 2,682 Bytes - Last Modified: 2021-12-23T10:41:03+00:00
/var/www/docs.ssmods.com/process/src/src/Model/Process/ProductVariation_OrderItem.php
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 | <?php namespace Sunnysideup\EcommerceProductVariation\Model\Process; use Sunnysideup\Ecommerce\Model\ProductOrderItem; class ProductVariation_OrderItem extends ProductOrderItem { // ProductVariation Access Function public function ProductVariation($current = false) { return $this->Buyable($current); } /** * @decription: we return the product name here - * leaving the Table Sub Title for the name of the variation * * @return string - title in cart. */ public function TableTitle() { return $this->getTableTitle(); } public function getTableTitle() { $tableTitle = _t('Product.UNKNOWN', 'Unknown Product'); if ($variation = $this->ProductVariation()) { if ($product = $variation->Product()) { $tableTitle = $product->Title; } } $extendedTitle = $this->extend('updateTableTitle', $tableTitle); if ($extendedTitle !== null && is_array($extendedTitle) && count($extendedTitle)) { return implode('', $extendedTitle); } return $tableTitle; } /** * we return the product variation name here * the Table Title will return the name of the Product. * @return string - sub title in cart. **/ public function TableSubTitle() { return $this->getTableSubTitle(); } public function getTableSubTitle() { $tableSubTitle = _t('Product.VARIATIONNOTFOUND', 'Variation Not Found'); if ($variation = $this->ProductVariation()) { if ($variation->exists()) { $tableSubTitle = $variation->getTitle(true, true); } } $extendedSubTitle = $this->extend('updateTableSubTitle', $tableSubTitle); if ($extendedSubTitle !== null && is_array($extendedSubTitle) && count($extendedSubTitle)) { return implode('', $extendedSubTitle); } return $tableSubTitle; } /** * Check if this variation is new - that is, if it has yet to have been written * to the database. * * @return boolean True if this is new. */ public function isNew() { /** * This check was a problem for a self-hosted site, and may indicate a * bug in the interpreter on their server, or a bug here * Changing the condition from empty($this->ID) to * !$this->ID && !$this->record['ID'] fixed this. */ if (empty($this->ID)) { return true; } if (is_numeric($this->ID)) { return false; } return stripos($this->ID, 'new') === 0; } } |