From 034747bd6a870b653754df107786fe66fc981038 Mon Sep 17 00:00:00 2001 From: Diatrex Date: Thu, 27 May 2021 13:00:28 +0300 Subject: [PATCH] #4080 add to cart problem --- .../visiosoft/advs-module/src/Adv/AdvModel.php | 17 ++++++++++++++++- .../src/Adv/Contract/AdvInterface.php | 2 ++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/addons/default/visiosoft/advs-module/src/Adv/AdvModel.php b/addons/default/visiosoft/advs-module/src/Adv/AdvModel.php index 7d92ad2a5..b7227eda5 100644 --- a/addons/default/visiosoft/advs-module/src/Adv/AdvModel.php +++ b/addons/default/visiosoft/advs-module/src/Adv/AdvModel.php @@ -14,10 +14,25 @@ use Visiosoft\CartsModule\Cart\Command\GetCart; use Visiosoft\LocationModule\District\DistrictModel; use Visiosoft\LocationModule\Neighborhood\NeighborhoodModel; use Visiosoft\LocationModule\Village\Contract\VillageRepositoryInterface; -use Visiosoft\LocationModule\Village\VillageModel; class AdvModel extends AdvsAdvsEntryModel implements AdvInterface { + public function getTransNameAttribute() + { + if (is_null($this->name)) { + $ad = DB::table('advs_advs') + ->join('advs_advs_translations', 'advs_advs.id', '=', 'entry_id') + ->select('name') + ->where('advs_advs.id', $this->id) + ->whereNotNull('name') + ->first(); + + return $ad ? $ad->name : '-'; + } + + return $this->name; + } + public function is_enabled($slug) { if ($addon = app('module.collection')->get($slug)) { diff --git a/addons/default/visiosoft/advs-module/src/Adv/Contract/AdvInterface.php b/addons/default/visiosoft/advs-module/src/Adv/Contract/AdvInterface.php index 8073d01bc..be650c398 100644 --- a/addons/default/visiosoft/advs-module/src/Adv/Contract/AdvInterface.php +++ b/addons/default/visiosoft/advs-module/src/Adv/Contract/AdvInterface.php @@ -4,6 +4,8 @@ use Anomaly\Streams\Platform\Entry\Contract\EntryInterface; interface AdvInterface extends EntryInterface { + public function getTransNameAttribute(); + public function is_enabled($slug); public function is_enabled_extension($slug);