25 lines
704 B
PHP
25 lines
704 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace KupShop\KupShopBundle\DiscountFieldDefinition;
|
|
|
|
/**
|
|
* Discount field definition when price for discount should be used.
|
|
*/
|
|
class PriceForDiscountFieldDefinition extends ProductDiscountFieldDefinition
|
|
{
|
|
protected function getPriceForDiscountColumn(): ?string
|
|
{
|
|
if ($this->getActivePriceList()) {
|
|
return 'COALESCE(prlv.price_for_discount * c_v.rate, prlp.price_for_discount * c.rate, pv.price_for_discount, p.price_for_discount)';
|
|
}
|
|
|
|
if (findModule(\Modules::PRODUCTS_VARIATIONS)) {
|
|
return 'COALESCE(pv.price_for_discount, p.price_for_discount)';
|
|
}
|
|
|
|
return 'p.price_for_discount';
|
|
}
|
|
}
|