diff --git a/packages/Webkul/Marketing/src/Providers/MarketingServiceProvider.php b/packages/Webkul/Marketing/src/Providers/MarketingServiceProvider.php index ba2ffaf37..d5f19b8ea 100644 --- a/packages/Webkul/Marketing/src/Providers/MarketingServiceProvider.php +++ b/packages/Webkul/Marketing/src/Providers/MarketingServiceProvider.php @@ -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(); + }); } /** diff --git a/packages/Webkul/Product/src/Type/AbstractType.php b/packages/Webkul/Product/src/Type/AbstractType.php index 083c38c57..eb286c93f 100644 --- a/packages/Webkul/Product/src/Type/AbstractType.php +++ b/packages/Webkul/Product/src/Type/AbstractType.php @@ -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]);