Merge pull request #4534 from rahulshukla-webkul/development

Issue #3572, fixes percentage for 2 decimal values
This commit is contained in:
Glenn Hermans 2021-02-01 12:27:42 +01:00 committed by GitHub
commit 2e05c832ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -4,6 +4,7 @@ namespace Webkul\Marketing\Providers;
use Illuminate\Support\ServiceProvider;
use Webkul\Marketing\Console\Commands\EmailsCommand;
use Illuminate\Console\Scheduling\Schedule;
class MarketingServiceProvider extends ServiceProvider
{
@ -17,6 +18,10 @@ class MarketingServiceProvider extends ServiceProvider
$this->loadMigrationsFrom(__DIR__ . '/../Database/Migrations');
$this->loadRoutesFrom(__DIR__ . '/../Http/routes.php');
$this->callAfterResolving(Schedule::class, function (Schedule $schedule) {
$schedule->command('campaign:process')->daily();
});
}
/**

View File

@ -959,7 +959,7 @@ abstract class AbstractType
if ($haveOffers) {
foreach ($customerGroupPrices as $key => $customerGroupPrice) {
if ($key > 0) {
if ($customerGroupPrice && $customerGroupPrice->qty > 1) {
array_push($offerLines, $this->getOfferLines($customerGroupPrice));
}
}
@ -985,7 +985,7 @@ abstract class AbstractType
public function getOfferLines($customerGroupPrice) {
$price = $this->getCustomerGroupPrice($this->product, $customerGroupPrice->qty);
$discount = (($this->product->price - $price) * 100) / ($this->product->price);
$discount = number_format((($this->product->price - $price) * 100) / ($this->product->price), 2);
$offerLines = trans('shop::app.products.offers', ['qty' => $customerGroupPrice->qty,
'price' => core()->currency($price), 'discount' => $discount]);