diff --git a/addons/default/visiosoft/advs-module/resources/views/new-ad/preview/preview.twig b/addons/default/visiosoft/advs-module/resources/views/new-ad/preview/preview.twig index b227bf2a3..d4dddfe9d 100644 --- a/addons/default/visiosoft/advs-module/resources/views/new-ad/preview/preview.twig +++ b/addons/default/visiosoft/advs-module/resources/views/new-ad/preview/preview.twig @@ -25,12 +25,8 @@ {% else %} {% set continueLink = url_route('adv_detail_seo', [adv.slug, adv.id]) %} {% endif %} - {% if isActive('shipping') %} - - - {{ trans('visiosoft.module.shipping::button.create_shipping_information') }} - + {% if isActive('shipping') and adv.is_get_adv.getValue() %} + {{ addBlock('new-create/preview/actions',{'adv_id':adv.id})|raw }} {% endif %} diff --git a/addons/default/visiosoft/advs-module/src/Adv/Command/ConvertCurrency.php b/addons/default/visiosoft/advs-module/src/Adv/Command/ConvertCurrency.php new file mode 100644 index 000000000..759b40e42 --- /dev/null +++ b/addons/default/visiosoft/advs-module/src/Adv/Command/ConvertCurrency.php @@ -0,0 +1,50 @@ +price = $price; + $this->currency = $source; + $this->source = $source; + $this->to = $to; + } + + public function handle(MessageBag $message) + { + try { + $url = $this->source . "_" . $this->to; + $freeCurrencyKey = setting_value('visiosoft.module.advs::free_currencyconverterapi_key'); + + $client = new \GuzzleHttp\Client(); + $response = $client->request('GET', 'http://free.currencyconverterapi.com/api/v6/convert', ['query' => [ + 'q' => $url, + 'compact' => 'y', + 'apiKey' => $freeCurrencyKey + ]]); + + if ($response->getStatusCode() == '200') { + $response = (array)\GuzzleHttp\json_decode($response->getBody()->getContents()); + if (!empty($response)) { + $rate = $response[$url]->val; + $this->price *= $rate; + $this->currency = $this->to; + } + } + } catch (\GuzzleHttp\Exception\ClientException $e) { + $message->error(['Para birimi dönüştürme işlemi tamamlanamadı!' . $e->getMessage()]); + } + + return [ + 'currency' => $this->currency, + 'price' => $this->price, + ]; + } +}