first commit

This commit is contained in:
2025-08-02 16:30:27 +02:00
commit 23646bfcee
14851 changed files with 1750626 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
<?php
declare(strict_types=1);
namespace KupShop\KupShopBundle\DiscountFieldDefinition;
/**
* Wraps `DiscountFieldDefinitionInterface` and checks if real discount is set. When real discount is not set, no discount is displayed.
*
* @property AbstractDiscountFieldDefinition $fallback
*/
class ExplicitDiscountFieldDefinition extends AbstractDiscountFieldDefinition
{
public function __construct(DiscountFieldDefinitionInterface $fallback)
{
$this->setFallback($fallback);
}
public function getField(): string
{
// discount must be explicitly defined on the product to be displayed
return "IF({$this->fallback->getColumn()}>0, {$this->fallback->getField()}, 0)";
}
public function getSpec(): callable
{
return $this->fallback->getSpec();
}
}