mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-11 18:01:10 -06:00
Merge pull request #980 from openclassify/dia
#3481 [advs-module] Currency error when viewing an ad
This commit is contained in:
commit
21128aa5ee
@ -14,8 +14,9 @@ return [
|
||||
'google_statistic_code',
|
||||
'ogImage',
|
||||
'free_currencyconverterapi_key',
|
||||
'hide_price_categories',
|
||||
'tcmb_exchange_url',
|
||||
'enabled_currencies',
|
||||
'tcmb_exchange_url'
|
||||
],
|
||||
],
|
||||
'ads' => [
|
||||
|
||||
@ -94,6 +94,14 @@ return [
|
||||
"default_value" => "1eea72940f3868c77420"
|
||||
]
|
||||
],
|
||||
'hide_price_categories' => [
|
||||
'type' => 'anomaly.field_type.checkboxes',
|
||||
'config' => [
|
||||
'options' => function (\Visiosoft\CatsModule\Category\Contract\CategoryRepositoryInterface $categoryRepository) {
|
||||
return $categoryRepository->mainCats()->pluck('name', 'id')->all();
|
||||
},
|
||||
],
|
||||
],
|
||||
'default_GET' => [
|
||||
'type' => 'anomaly.field_type.boolean',
|
||||
'bind' => 'adv.default_GET',
|
||||
|
||||
@ -61,6 +61,10 @@ return [
|
||||
'default_country' => [
|
||||
'name' => 'Default Ad Country',
|
||||
],
|
||||
'hide_price_categories' => [
|
||||
'name' => 'Hide Price On Categories',
|
||||
'instructions' => 'The price will be hidden when you create an ad or view an ad under these categories.'
|
||||
],
|
||||
'free_currencyconverterapi_key' => [
|
||||
'name' => 'Currency Converter API Key'
|
||||
],
|
||||
|
||||
@ -90,8 +90,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row form-group select-price
|
||||
{{ setting_value('visiosoft.module.advs::price_area_hidden') ? 'hidden' }}">
|
||||
<div class="row form-group select-price{{ hidePrice ? ' hidden' }}">
|
||||
|
||||
<label class="col-sm-2 col-xs-12">
|
||||
{{ form.fields.price.label|raw }}
|
||||
|
||||
@ -589,17 +589,21 @@ class AdvsController extends PublicController
|
||||
|
||||
$configurations = $this->optionConfigurationRepository->getConf($adv->id);
|
||||
|
||||
|
||||
|
||||
$foreign_currencies = json_decode($adv->foreign_currencies, true);
|
||||
if ($_COOKIE['currency'] && $adv->foreign_currencies && array_key_exists($_COOKIE['currency'], $foreign_currencies)) {
|
||||
if (isset($_COOKIE['currency']) && $_COOKIE['currency'] && $adv->foreign_currencies && array_key_exists($_COOKIE['currency'], $foreign_currencies)) {
|
||||
$adv->currency = $_COOKIE['currency'];
|
||||
$adv->price = $foreign_currencies[$_COOKIE['currency']];
|
||||
}
|
||||
|
||||
// Check if hide price
|
||||
$hidePrice = false;
|
||||
if ($hidePriceCats = setting_value('visiosoft.module.advs::hide_price_categories')) {
|
||||
$hidePrice = in_array($adv['cat1'], $hidePriceCats);
|
||||
}
|
||||
|
||||
if ($adv->created_by_id == isset(auth()->user()->id) or $adv->status == "approved") {
|
||||
return $this->view->make('visiosoft.module.advs::ad-detail/detail', compact('adv', 'complaints',
|
||||
'recommended_advs', 'categories', 'features', 'options', 'configurations'));
|
||||
'recommended_advs', 'categories', 'features', 'options', 'configurations', 'hidePrice'));
|
||||
} else {
|
||||
return back();
|
||||
}
|
||||
@ -956,9 +960,17 @@ class AdvsController extends PublicController
|
||||
->edit($adv, $categories, $cats);
|
||||
}
|
||||
|
||||
// Check if hide price
|
||||
$hidePrice = false;
|
||||
if (setting_value('visiosoft.module.advs::price_area_hidden')) {
|
||||
$hidePrice = true;
|
||||
} elseif ($hidePriceCats = setting_value('visiosoft.module.advs::hide_price_categories')) {
|
||||
$hidePrice = in_array($adv['cat1'], $hidePriceCats);
|
||||
}
|
||||
|
||||
return $this->view->make(
|
||||
'visiosoft.module.advs::new-ad/new-create',
|
||||
compact('id', 'cats_d', 'cats', 'Cloudinary', 'adv', 'custom_fields', 'options')
|
||||
compact('id', 'cats_d', 'cats', 'Cloudinary', 'adv', 'custom_fields', 'options', 'hidePrice')
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user