diff --git a/Classes/Domain/Model/Order/Product.php b/Classes/Domain/Model/Order/Product.php index f1129c94..c75fa8af 100644 --- a/Classes/Domain/Model/Order/Product.php +++ b/Classes/Domain/Model/Order/Product.php @@ -55,6 +55,12 @@ class Product extends AbstractEntity protected string $additionalData = ''; + protected bool $shippable = true; + + protected bool $cancelable = true; + + protected bool $returnable = true; + /** * @var ObjectStorage */ @@ -199,6 +205,45 @@ public function setTitle(string $title): void $this->title = $title; } + public function isShippable(): bool + { + return $this->shippable; + } + + /** + * Set once when the order is persisted, see BeforePersistOrderProductEvent. + */ + public function setShippable(bool $shippable): void + { + $this->shippable = $shippable; + } + + public function isCancelable(): bool + { + return $this->cancelable; + } + + /** + * Set once when the order is persisted, see BeforePersistOrderProductEvent. + */ + public function setCancelable(bool $cancelable): void + { + $this->cancelable = $cancelable; + } + + public function isReturnable(): bool + { + return $this->returnable; + } + + /** + * Set once when the order is persisted, see BeforePersistOrderProductEvent. + */ + public function setReturnable(bool $returnable): void + { + $this->returnable = $returnable; + } + public function addProductAdditional(ProductAdditional $productAdditional): void { $this->productAdditional->attach($productAdditional); diff --git a/Classes/Event/Order/BeforePersistOrderProductEvent.php b/Classes/Event/Order/BeforePersistOrderProductEvent.php new file mode 100644 index 00000000..a3cac9fd --- /dev/null +++ b/Classes/Event/Order/BeforePersistOrderProductEvent.php @@ -0,0 +1,114 @@ +orderItem; + } + + public function getOrderProduct(): Product + { + return $this->orderProduct; + } + + /** + * The product of the cart, the product of the backend variant if the + * ordered product is a backend variant. + */ + public function getCartProduct(): ProductInterface + { + return $this->cartProduct; + } + + /** + * The backend variant of the ordered product, null for products without + * backend variants. + */ + public function getBeVariant(): ?BeVariantInterface + { + return $this->beVariant; + } + + public function isShippable(): bool + { + return $this->shippable; + } + + /** + * Defaults to true unless the cart product is a virtual product. + */ + public function setShippable(bool $shippable): void + { + $this->shippable = $shippable; + } + + public function isCancelable(): bool + { + return $this->cancelable; + } + + /** + * Whether the ordered product may be canceled before it is shipped or + * before the service is provided, defaults to true. + * + * Rules depending on the time of the cancellation (e.g. until 14 days + * before an event) do not belong here. + */ + public function setCancelable(bool $cancelable): void + { + $this->cancelable = $cancelable; + } + + public function isReturnable(): bool + { + return $this->returnable; + } + + /** + * Whether the ordered product may be returned after it was shipped, + * defaults to true. + */ + public function setReturnable(bool $returnable): void + { + $this->returnable = $returnable; + } +} diff --git a/Classes/EventListener/Order/Create/PersistOrder/Products.php b/Classes/EventListener/Order/Create/PersistOrder/Products.php index 3d9abfbe..bbd6b3df 100644 --- a/Classes/EventListener/Order/Create/PersistOrder/Products.php +++ b/Classes/EventListener/Order/Create/PersistOrder/Products.php @@ -20,7 +20,9 @@ use Extcode\Cart\Domain\Model\Order\ProductAdditional; use Extcode\Cart\Domain\Repository\Order\ProductAdditionalRepository; use Extcode\Cart\Domain\Repository\Order\ProductRepository; +use Extcode\Cart\Event\Order\BeforePersistOrderProductEvent; use Extcode\Cart\Event\Order\PersistOrderEvent; +use Psr\EventDispatcher\EventDispatcherInterface; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager; @@ -32,11 +34,21 @@ class Products private int $storagePid; + private readonly EventDispatcherInterface $eventDispatcher; + + /** + * The event dispatcher is optional, so subclasses calling the constructor + * with the former three arguments keep working. + * + * TODO: 13.0.0 Make the event dispatcher required. + */ public function __construct( private readonly PersistenceManager $persistenceManager, private readonly ProductRepository $productRepository, - private readonly ProductAdditionalRepository $productAdditionalRepository + private readonly ProductAdditionalRepository $productAdditionalRepository, + ?EventDispatcherInterface $eventDispatcher = null ) { + $this->eventDispatcher = $eventDispatcher ?? GeneralUtility::makeInstance(EventDispatcherInterface::class); } public function __invoke(PersistOrderEvent $event): void @@ -78,6 +90,8 @@ protected function addProduct(ProductInterface $cartProduct): void $orderProduct->setAdditional($cartProduct->getAdditionals()); } + $this->setFulfillmentOptions($orderProduct, $cartProduct); + $orderProduct->setPid($this->storagePid); $this->productRepository->add($orderProduct); @@ -166,6 +180,8 @@ protected function addBeVariant(BeVariantInterface $variant, int $level): void $orderProduct->setAdditional($cartProduct->getAdditionals()); } + $this->setFulfillmentOptions($orderProduct, $cartProduct, $variant); + if (!$orderProduct->_isDirty()) { $this->productRepository->add($orderProduct); } @@ -198,4 +214,25 @@ protected function addBeVariant(BeVariantInterface $variant, int $level): void $this->orderItem->addProduct($orderProduct); } + + private function setFulfillmentOptions( + Product $orderProduct, + ProductInterface $cartProduct, + ?BeVariantInterface $beVariant = null + ): void { + $event = new BeforePersistOrderProductEvent( + $this->orderItem, + $orderProduct, + $cartProduct, + $beVariant, + !$cartProduct->isVirtualProduct(), + true, + true + ); + $this->eventDispatcher->dispatch($event); + + $orderProduct->setShippable($event->isShippable()); + $orderProduct->setCancelable($event->isCancelable()); + $orderProduct->setReturnable($event->isReturnable()); + } } diff --git a/Configuration/TCA/tx_cart_domain_model_order_product.php b/Configuration/TCA/tx_cart_domain_model_order_product.php index 17b67282..e7dd887d 100644 --- a/Configuration/TCA/tx_cart_domain_model_order_product.php +++ b/Configuration/TCA/tx_cart_domain_model_order_product.php @@ -25,7 +25,7 @@ 'hideTable' => 1, 'types' => [ '1' => [ - 'showitem' => '--palette--;;product_type_and_id, sku, title, count, --palette--;' . $_LLL . ':tx_cart_domain_model_order_product.price.group;price, product_additional, additional, additional_data', + 'showitem' => '--palette--;;product_type_and_id, sku, title, count, --palette--;' . $_LLL . ':tx_cart_domain_model_order_product.price.group;price, --palette--;' . $_LLL . ':tx_cart_domain_model_order_product.properties.group;properties, product_additional, additional, additional_data', ], ], 'palettes' => [ @@ -38,6 +38,9 @@ 'product_type_and_id' => [ 'showitem' => 'product_type, product_id', ], + 'properties' => [ + 'showitem' => 'shippable, cancelable, returnable', + ], ], 'columns' => [ 'product_id' => [ @@ -170,6 +173,33 @@ ], ], ], + 'shippable' => [ + 'exclude' => 0, + 'label' => $_LLL . ':tx_cart_domain_model_order_product.shippable', + 'config' => [ + 'type' => 'check', + 'readOnly' => 1, + 'default' => 1, + ], + ], + 'cancelable' => [ + 'exclude' => 0, + 'label' => $_LLL . ':tx_cart_domain_model_order_product.cancelable', + 'config' => [ + 'type' => 'check', + 'readOnly' => 1, + 'default' => 1, + ], + ], + 'returnable' => [ + 'exclude' => 0, + 'label' => $_LLL . ':tx_cart_domain_model_order_product.returnable', + 'config' => [ + 'type' => 'check', + 'readOnly' => 1, + 'default' => 1, + ], + ], 'additional' => [ 'exclude' => 0, 'label' => $_LLL . ':tx_cart_domain_model_order_product.additional', diff --git a/Documentation/Changelog/12.8/Feature-895-OrderProductProperties.rst b/Documentation/Changelog/12.8/Feature-895-OrderProductProperties.rst new file mode 100644 index 00000000..f7c880ff --- /dev/null +++ b/Documentation/Changelog/12.8/Feature-895-OrderProductProperties.rst @@ -0,0 +1,44 @@ +.. include:: ../../Includes.rst.txt + +===================================================================== +Feature: #895 - Shippable, cancelable and returnable ordered products +===================================================================== + +See `Issue 895 `__ + +Description +=========== + +An ordered product (``tx_cart_domain_model_order_product``) stores whether it +is shippable, cancelable and returnable in the new fields ``shippable``, +``cancelable`` and ``returnable``. The values are set once when the order is +persisted and are not changed afterwards, even if the product changes later. +The model ``\Extcode\Cart\Domain\Model\Order\Product`` provides them with +``isShippable()``, ``isCancelable()`` and ``isReturnable()``. + +Defaults: + +* ``shippable``: ``true`` unless the product in the cart is a virtual product + (``ProductInterface::isVirtualProduct()``). +* ``cancelable`` and ``returnable``: ``true``. + +The new event ``\Extcode\Cart\Event\Order\BeforePersistOrderProductEvent`` +is dispatched once per ordered product (or backend variant) before it is +stored. Product extensions can change the values with ``setShippable()``, +``setCancelable()`` and ``setReturnable()``, e.g. for personalized products +that cannot be returned. + +The order details in the backend module mark ordered products that are not +shippable, not cancelable or not returnable. + +The fields are the base for partial deliveries, cancellations and returns per +ordered product. Rules that depend on the time (e.g. a ticket can be canceled +until 14 days before the event) do not belong into these fields. + +Impact +====== + +The database schema has to be updated. Products of existing orders are +shippable, cancelable and returnable (default of the database fields). + +.. index:: Backend, Database, PHP-API diff --git a/Documentation/Changelog/12.8/Index.rst b/Documentation/Changelog/12.8/Index.rst index 9f31b09e..8f6b2e2c 100644 --- a/Documentation/Changelog/12.8/Index.rst +++ b/Documentation/Changelog/12.8/Index.rst @@ -15,6 +15,7 @@ Features ~~~~~~~~ +* :doc:`#895 - Shippable, cancelable and returnable ordered products ` * :doc:`#896 - Taxes per tax class of the discounts of an order ` Deprecations diff --git a/Documentation/Developer/Events/Index.rst b/Documentation/Developer/Events/Index.rst index 0e9527ab..5441f20f 100644 --- a/Documentation/Developer/Events/Index.rst +++ b/Documentation/Developer/Events/Index.rst @@ -93,6 +93,51 @@ events: needed information (addresses, products, tax classes, usage of coupons, payment, shipping and other data related to an order). +.. confval:: \Extcode\Cart\Event\Order\BeforePersistOrderProductEvent + + This event is triggered by the EventListener which stores the products of + the order (`PersistOrderEvent`), once per ordered product or backend + variant before it is stored. + + Product extensions can decide whether the ordered product is shippable, + cancelable and returnable with `setShippable()`, `setCancelable()` and + `setReturnable()`. The event provides the order, the ordered product, the + product of the cart and, for backend variants, the variant. + + By default an ordered product is shippable unless the product of the cart + is a virtual product, and it is cancelable and returnable. + + The values are a snapshot at order time and are not changed afterwards. + Rules depending on the time, e.g. a ticket can be canceled until 14 days + before the event, do not belong here. + + .. code-block:: php + :caption: EXT:my_extension/Classes/EventListener/Order/OrderProductProperties.php + + getCartProduct()->getProductType() !== 'MyProductType') { + return; + } + + // e.g. personalized products + $event->setCancelable(false); + $event->setReturnable(false); + } + } + .. confval:: \Extcode\Cart\Event\Order\NumberGeneratorEvent It is the second event that is called when the order is submitted. diff --git a/Resources/Private/Language/locallang.xlf b/Resources/Private/Language/locallang.xlf index 37141d3b..b5a09f82 100644 --- a/Resources/Private/Language/locallang.xlf +++ b/Resources/Private/Language/locallang.xlf @@ -390,6 +390,15 @@ Net + + not shippable + + + not cancelable + + + not returnable + Shipping diff --git a/Resources/Private/Language/locallang_db.xlf b/Resources/Private/Language/locallang_db.xlf index 2e1e6ce2..c90f0c86 100644 --- a/Resources/Private/Language/locallang_db.xlf +++ b/Resources/Private/Language/locallang_db.xlf @@ -312,6 +312,18 @@ Product Additional + + Properties at order time + + + Shippable + + + Cancelable + + + Returnable + Discount diff --git a/Resources/Private/Partials/Backend/Order/Show/CartTable/Body.html b/Resources/Private/Partials/Backend/Order/Show/CartTable/Body.html index 8ec7b86e..5df61b0e 100644 --- a/Resources/Private/Partials/Backend/Order/Show/CartTable/Body.html +++ b/Resources/Private/Partials/Backend/Order/Show/CartTable/Body.html @@ -9,6 +9,19 @@ {product.title} + +
+ + + + + + + + + +
+
{product.price} diff --git a/Tests/Functional/EventListener/Order/Create/PersistOrder/Fixtures/OrderItem.php b/Tests/Functional/EventListener/Order/Create/PersistOrder/Fixtures/OrderItem.php new file mode 100644 index 00000000..fcf40f7a --- /dev/null +++ b/Tests/Functional/EventListener/Order/Create/PersistOrder/Fixtures/OrderItem.php @@ -0,0 +1,23 @@ + [ + [ + 'uid' => 1, + 'pid' => 105, + 'currency' => '€', + ], + ], + 'tx_cart_domain_model_order_taxclass' => [ + [ + 'uid' => 1, + 'pid' => 105, + 'item' => 1, + 'title' => 'normal', + 'value' => '19', + 'calc' => 0.19, + ], + ], +]; diff --git a/Tests/Functional/EventListener/Order/Create/PersistOrder/ProductsTest.php b/Tests/Functional/EventListener/Order/Create/PersistOrder/ProductsTest.php new file mode 100644 index 00000000..7ca97325 --- /dev/null +++ b/Tests/Functional/EventListener/Order/Create/PersistOrder/ProductsTest.php @@ -0,0 +1,235 @@ +importPHPDataSet(__DIR__ . '/../../../../../Fixtures/BaseDatabase.php'); + $this->importPHPDataSet(__DIR__ . '/Fixtures/OrderItem.php'); + + $this->taxClass = new CartTaxClass(1, '19', 0.19, 'normal'); + } + + #[Test] + public function physicalProductIsShippableCancelableAndReturnable(): void + { + $this->persistProducts(new CartProduct('simple', 1, 'shirt', 'Shirt', 10.0, $this->taxClass, 1)); + + self::assertSame( + [ + ['sku' => 'shirt', 'shippable' => 1, 'cancelable' => 1, 'returnable' => 1], + ], + $this->getStoredProperties() + ); + } + + #[Test] + public function virtualProductIsNotShippable(): void + { + $cartProduct = new CartProduct('simple', 1, 'download', 'Download', 10.0, $this->taxClass, 1); + $cartProduct->setIsVirtualProduct(true); + + $this->persistProducts($cartProduct); + + self::assertSame( + [ + ['sku' => 'download', 'shippable' => 0, 'cancelable' => 1, 'returnable' => 1], + ], + $this->getStoredProperties() + ); + } + + #[Test] + public function backendVariantGetsThePropertiesOfItsProduct(): void + { + $cartProduct = new CartProduct('simple', 1, 'ticket', 'Ticket', 10.0, $this->taxClass, 0); + $cartProduct->setIsVirtualProduct(true); + $cartProduct->addBeVariant(new BeVariant('1', $cartProduct, 'Adult', 'adult', 0, 10.0, 2)); + + $this->persistProducts($cartProduct); + + self::assertSame( + [ + ['sku' => 'ticket-adult', 'shippable' => 0, 'cancelable' => 1, 'returnable' => 1], + ], + $this->getStoredProperties() + ); + } + + #[Test] + public function listenersOfTheEventCanChangeTheProperties(): void + { + $events = []; + $this->addEventListener( + BeforePersistOrderProductEvent::class, + static function (BeforePersistOrderProductEvent $event) use (&$events): void { + $events[] = $event; + if ($event->getCartProduct()->getSku() !== 'personalized') { + return; + } + $event->setShippable(false); + $event->setCancelable(false); + $event->setReturnable(false); + } + ); + + $this->persistProducts( + new CartProduct('simple', 1, 'shirt', 'Shirt', 10.0, $this->taxClass, 1), + new CartProduct('simple', 2, 'personalized', 'Personalized', 10.0, $this->taxClass, 1) + ); + + self::assertSame( + [ + ['sku' => 'shirt', 'shippable' => 1, 'cancelable' => 1, 'returnable' => 1], + ['sku' => 'personalized', 'shippable' => 0, 'cancelable' => 0, 'returnable' => 0], + ], + $this->getStoredProperties() + ); + self::assertCount(2, $events, 'The event must be dispatched once per ordered product.'); + self::assertSame(1, $events[0]->getOrderItem()->getUid()); + self::assertSame('shirt', $events[0]->getOrderProduct()->getSku()); + self::assertNull($events[0]->getBeVariant()); + } + + #[Test] + public function eventPassesTheBackendVariant(): void + { + $events = []; + $this->addEventListener( + BeforePersistOrderProductEvent::class, + static function (BeforePersistOrderProductEvent $event) use (&$events): void { + $events[] = $event; + } + ); + $cartProduct = new CartProduct('simple', 1, 'shirt', 'Shirt', 10.0, $this->taxClass, 0); + $cartProduct->addBeVariant(new BeVariant('1', $cartProduct, 'Size M', 'm', 0, 10.0, 1)); + + $this->persistProducts($cartProduct); + + self::assertCount(1, $events); + self::assertSame($cartProduct, $events[0]->getCartProduct()); + self::assertSame('shirt-m', $events[0]->getBeVariant()?->getCompleteSku()); + self::assertSame('shirt-m', $events[0]->getOrderProduct()->getSku()); + } + + #[Test] + public function eventIsDispatchedWhenTheConstructorIsCalledWithoutEventDispatcher(): void + { + $events = []; + $this->addEventListener( + BeforePersistOrderProductEvent::class, + static function (BeforePersistOrderProductEvent $event) use (&$events): void { + $events[] = $event; + $event->setReturnable(false); + } + ); + $subject = new Products( + GeneralUtility::makeInstance(PersistenceManager::class), + GeneralUtility::makeInstance(ProductRepository::class), + GeneralUtility::makeInstance(ProductAdditionalRepository::class) + ); + + $this->persistProductsWith($subject, new CartProduct('simple', 1, 'shirt', 'Shirt', 10.0, $this->taxClass, 1)); + + self::assertCount(1, $events); + self::assertSame( + [ + ['sku' => 'shirt', 'shippable' => 1, 'cancelable' => 1, 'returnable' => 0], + ], + $this->getStoredProperties() + ); + } + + private function persistProducts(CartProduct ...$cartProducts): void + { + $subject = $this->get(Products::class); + self::assertInstanceOf(Products::class, $subject); + $this->persistProductsWith($subject, ...$cartProducts); + } + + private function persistProductsWith(Products $subject, CartProduct ...$cartProducts): void + { + $cart = new Cart([1 => $this->taxClass]); + foreach ($cartProducts as $cartProduct) { + $cart->addProduct($cartProduct); + } + + $persistenceManager = GeneralUtility::makeInstance(PersistenceManager::class); + $orderItem = $persistenceManager->getObjectByIdentifier(1, Item::class); + self::assertInstanceOf(Item::class, $orderItem); + $orderTaxClass = $persistenceManager->getObjectByIdentifier(1, TaxClass::class); + self::assertInstanceOf(TaxClass::class, $orderTaxClass); + + $event = new PersistOrderEvent($cart, $orderItem, ['settings' => ['order' => ['pid' => 105]]]); + $event->setTaxClasses([1 => $orderTaxClass]); + + $subject($event); + } + + /** + * @return list> + */ + private function getStoredProperties(): array + { + $table = 'tx_cart_domain_model_order_product'; + + return $this->getConnectionPool()->getConnectionForTable($table) + ->select(['sku', 'shippable', 'cancelable', 'returnable'], $table, [], [], ['uid' => 'ASC']) + ->fetchAllAssociative() + ; + } + + private function addEventListener(string $eventClass, Closure $listener): void + { + $container = $this->getContainer(); + assert($container instanceof Container); + + $identifier = 'cart-test--event-listener--' . md5($eventClass); + $container->set($identifier, $listener); + GeneralUtility::makeInstance(ListenerProvider::class)->addListener($eventClass, $identifier); + } +} diff --git a/Tests/Functional/Templates/OrderProductPropertiesTest.php b/Tests/Functional/Templates/OrderProductPropertiesTest.php new file mode 100644 index 00000000..f563c43c --- /dev/null +++ b/Tests/Functional/Templates/OrderProductPropertiesTest.php @@ -0,0 +1,116 @@ +importPHPDataSet(__DIR__ . '/Fixtures/OrderWithTaxes.php'); + $this->getConnectionPool()->getConnectionForTable('tx_cart_domain_model_order_product')->update( + 'tx_cart_domain_model_order_product', + ['shippable' => 0, 'cancelable' => 0, 'returnable' => 0], + ['uid' => 2] + ); + + $orderItem = GeneralUtility::makeInstance(PersistenceManager::class)->getObjectByIdentifier(1, Item::class); + self::assertInstanceOf(Item::class, $orderItem); + + self::assertSame( + [ + 'Book' => [], + 'Shirt' => ['not shippable', 'not cancelable', 'not returnable'], + ], + self::getMarksPerProduct(self::render($orderItem)) + ); + } + + private static function render(Item $orderItem): string + { + $extbaseRequestParameters = new ExtbaseRequestParameters(); + $extbaseRequestParameters->setControllerExtensionName('Cart'); + $request = new Request( + (new ServerRequest('https://example.com/')) + ->withAttribute('applicationType', SystemEnvironmentBuilder::REQUESTTYPE_BE) + ->withAttribute('language', new SiteLanguage(0, 'en_US.UTF-8', new Uri('/'), [])) + ->withAttribute('extbase', $extbaseRequestParameters) + ); + + $view = GeneralUtility::makeInstance(ViewFactoryInterface::class)->create( + new ViewFactoryData( + templateRootPaths: ['EXT:cart/Tests/Functional/Fixtures/Templates/'], + partialRootPaths: ['EXT:cart/Resources/Private/Partials/'], + layoutRootPaths: ['EXT:cart/Resources/Private/Layouts/'], + request: $request, + ) + ); + $view->assign('orderItem', $orderItem); + + return $view->render('Backend/Order/Cart'); + } + + /** + * @return array> the marks per product title + */ + private static function getMarksPerProduct(string $html): array + { + $document = new DOMDocument(); + $document->loadHTML('' . $html, LIBXML_NOERROR); + $xpath = new DOMXPath($document); + + $marks = []; + foreach ($xpath->query('//tr/td[2]') ?: [] as $cell) { + self::assertInstanceOf(DOMElement::class, $cell); + $title = trim((string) $cell->firstChild?->textContent); + if (!in_array($title, ['Book', 'Shirt'], true)) { + continue; + } + $marks[$title] = []; + foreach ($xpath->query('.//span[@data-order-product-property]', $cell) ?: [] as $mark) { + self::assertInstanceOf(DOMElement::class, $mark); + $marks[$title][] = trim($mark->textContent); + } + } + + return $marks; + } +} diff --git a/Tests/Unit/Domain/Model/Order/ProductTest.php b/Tests/Unit/Domain/Model/Order/ProductTest.php index eef619f6..b1391ec8 100644 --- a/Tests/Unit/Domain/Model/Order/ProductTest.php +++ b/Tests/Unit/Domain/Model/Order/ProductTest.php @@ -129,4 +129,49 @@ public function setProductTypeSetsProductType(): void $this->product->getProductType() ); } + + #[Test] + public function isShippableInitiallyReturnsTrue(): void + { + self::assertTrue((new Product())->isShippable()); + } + + #[Test] + public function setShippableSetsShippable(): void + { + $product = new Product(); + $product->setShippable(false); + + self::assertFalse($product->isShippable()); + } + + #[Test] + public function isCancelableInitiallyReturnsTrue(): void + { + self::assertTrue((new Product())->isCancelable()); + } + + #[Test] + public function setCancelableSetsCancelable(): void + { + $product = new Product(); + $product->setCancelable(false); + + self::assertFalse($product->isCancelable()); + } + + #[Test] + public function isReturnableInitiallyReturnsTrue(): void + { + self::assertTrue((new Product())->isReturnable()); + } + + #[Test] + public function setReturnableSetsReturnable(): void + { + $product = new Product(); + $product->setReturnable(false); + + self::assertFalse($product->isReturnable()); + } } diff --git a/ext_tables.sql b/ext_tables.sql index badc22a9..9350655c 100644 --- a/ext_tables.sql +++ b/ext_tables.sql @@ -123,6 +123,10 @@ CREATE TABLE tx_cart_domain_model_order_product ( product_additional int(11) unsigned DEFAULT '0' NOT NULL, + shippable tinyint(4) unsigned DEFAULT '1' NOT NULL, + cancelable tinyint(4) unsigned DEFAULT '1' NOT NULL, + returnable tinyint(4) unsigned DEFAULT '1' NOT NULL, + INDEX `parent` (pid), INDEX `t3ver_oid` (t3ver_oid,t3ver_wsid), );