mirror of
https://github.com/openclassify/openclassify.git
synced 2026-02-10 23:36:08 -06:00
Merge pull request #1107 from openclassify/vedatakdogan
add configuration detail
This commit is contained in:
commit
cbe7a39774
@ -380,4 +380,6 @@ return [
|
|||||||
'tax' => [
|
'tax' => [
|
||||||
'name' => 'Tax'
|
'name' => 'Tax'
|
||||||
],
|
],
|
||||||
|
'name_a_z' => 'Name (A to Z)',
|
||||||
|
'name_z_a' => 'Name (Z to A)',
|
||||||
];
|
];
|
||||||
|
|||||||
@ -379,10 +379,9 @@ return [
|
|||||||
'publish_at' => [
|
'publish_at' => [
|
||||||
'name' => 'Yayın tarihi'
|
'name' => 'Yayın tarihi'
|
||||||
],
|
],
|
||||||
'tax' => [
|
|
||||||
'name' => 'Vergi'
|
|
||||||
],
|
|
||||||
'tax' => [
|
'tax' => [
|
||||||
'name' => 'KDV Oranı'
|
'name' => 'KDV Oranı'
|
||||||
],
|
],
|
||||||
|
'name_a_z' => 'İlan Başlığı (A\'dan Z\'ye)',
|
||||||
|
'name_z_a' => 'İlan Başlığı (Z\'den A\'ya)',
|
||||||
];
|
];
|
||||||
|
|||||||
@ -23,5 +23,11 @@
|
|||||||
<span class="dropdown-item sort-by-item" data-value="address_z_a">
|
<span class="dropdown-item sort-by-item" data-value="address_z_a">
|
||||||
{{ trans("visiosoft.module.advs::field.address_z_a") }}
|
{{ trans("visiosoft.module.advs::field.address_z_a") }}
|
||||||
</span>
|
</span>
|
||||||
|
<span class="dropdown-item sort-by-item" data-value="name_a_z">
|
||||||
|
{{ trans("visiosoft.module.advs::field.name_a_z") }}
|
||||||
|
</span>
|
||||||
|
<span class="dropdown-item sort-by-item" data-value="name_z_a">
|
||||||
|
{{ trans("visiosoft.module.advs::field.name_z_a") }}
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -8,6 +8,7 @@ use Illuminate\Support\Facades\Auth;
|
|||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
use Visiosoft\AdvsModule\Adv\Contract\AdvInterface;
|
use Visiosoft\AdvsModule\Adv\Contract\AdvInterface;
|
||||||
use Anomaly\Streams\Platform\Model\Advs\AdvsAdvsEntryModel;
|
use Anomaly\Streams\Platform\Model\Advs\AdvsAdvsEntryModel;
|
||||||
|
use Visiosoft\AdvsModule\OptionConfiguration\OptionConfigurationModel;
|
||||||
use Visiosoft\AdvsModule\Support\Command\Currency;
|
use Visiosoft\AdvsModule\Support\Command\Currency;
|
||||||
use Visiosoft\LocationModule\City\CityModel;
|
use Visiosoft\LocationModule\City\CityModel;
|
||||||
use Visiosoft\LocationModule\Country\CountryModel;
|
use Visiosoft\LocationModule\Country\CountryModel;
|
||||||
@ -27,6 +28,10 @@ class AdvModel extends AdvsAdvsEntryModel implements AdvInterface
|
|||||||
'thumbnail',
|
'thumbnail',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
protected $cascades = [
|
||||||
|
'configurations',
|
||||||
|
];
|
||||||
|
|
||||||
public function getDetailUrlAttribute()
|
public function getDetailUrlAttribute()
|
||||||
{
|
{
|
||||||
// Checking for slug
|
// Checking for slug
|
||||||
@ -36,6 +41,19 @@ class AdvModel extends AdvsAdvsEntryModel implements AdvInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function configurations()
|
||||||
|
{
|
||||||
|
return $this->hasMany(
|
||||||
|
OptionConfigurationModel::class,
|
||||||
|
'parent_adv_id'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getConfigurations()
|
||||||
|
{
|
||||||
|
return $this->getAttribute('configurations');
|
||||||
|
}
|
||||||
|
|
||||||
public function getCurrencyPriceAttribute()
|
public function getCurrencyPriceAttribute()
|
||||||
{
|
{
|
||||||
return app(Currency::class)->format($this->price, $this->currency);
|
return app(Currency::class)->format($this->price, $this->currency);
|
||||||
|
|||||||
@ -189,6 +189,12 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface
|
|||||||
$query = $query->join('location_cities_translations', 'advs_advs.city', '=', 'location_cities_translations.entry_id')
|
$query = $query->join('location_cities_translations', 'advs_advs.city', '=', 'location_cities_translations.entry_id')
|
||||||
->orderBy('location_cities_translations.name', 'DESC');
|
->orderBy('location_cities_translations.name', 'DESC');
|
||||||
break;
|
break;
|
||||||
|
case "name_z_a":
|
||||||
|
$query = $query->orderBy('advs_advs_translations.name', 'DESC');
|
||||||
|
break;
|
||||||
|
case "name_a_z":
|
||||||
|
$query = $query->orderBy('advs_advs_translations.name', 'ASC');
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$query = $query->orderBy('advs_advs.created_at', 'desc');
|
$query = $query->orderBy('advs_advs.created_at', 'desc');
|
||||||
|
|||||||
@ -4,5 +4,5 @@ use Anomaly\Streams\Platform\Entry\Contract\EntryInterface;
|
|||||||
|
|
||||||
interface OptionConfigurationInterface extends EntryInterface
|
interface OptionConfigurationInterface extends EntryInterface
|
||||||
{
|
{
|
||||||
public function getName();
|
public function getName($add_name = true);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,10 +7,18 @@ use Visiosoft\AdvsModule\ProductoptionsValue\Contract\ProductoptionsValueReposit
|
|||||||
|
|
||||||
class OptionConfigurationModel extends AdvsOptionConfigurationEntryModel implements OptionConfigurationInterface
|
class OptionConfigurationModel extends AdvsOptionConfigurationEntryModel implements OptionConfigurationInterface
|
||||||
{
|
{
|
||||||
public function getName()
|
protected $appends = [
|
||||||
|
'option_name'
|
||||||
|
];
|
||||||
|
|
||||||
|
public function getOptionNameAttribute()
|
||||||
{
|
{
|
||||||
if($adv = app(AdvRepositoryInterface::class)->find($this->parent_adv_id))
|
return $this->getName(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getName($add_name = true)
|
||||||
{
|
{
|
||||||
|
if ($adv = app(AdvRepositoryInterface::class)->find($this->parent_adv_id)) {
|
||||||
$configurations_item = json_decode($this->option_json, true);
|
$configurations_item = json_decode($this->option_json, true);
|
||||||
$option_group_value = "";
|
$option_group_value = "";
|
||||||
|
|
||||||
@ -19,8 +27,11 @@ class OptionConfigurationModel extends AdvsOptionConfigurationEntryModel impleme
|
|||||||
$option_group_value .= " " . $value_entry->getName();
|
$option_group_value .= " " . $value_entry->getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $adv->name . ' | ' . trim($option_group_value, ' ');
|
$name = trim($option_group_value, ' ');
|
||||||
|
|
||||||
|
return ($add_name) ? $adv->name . ' | ' . $name : $name;
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function stockControl($id, $quantity)
|
public function stockControl($id, $quantity)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user