且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

用于 Wordpress 的 Contact form 7 中的 CARQuery API.一些自定义代码

更新时间:2023-11-30 16:14:04

我找到的答案是在我的联系表格中没有通过我的联系表格发送修剪作为 ID 位于 carquery-api.php 文件中链接的 Javascript 文件中.

第 107 行:

wp_register_script('carquery-api-js', 'https://www.carqueryapi.com/js/carquery.0.3.4.js', array('jquery'),

'0.3.4', 真);

我转到那个文件,复制它,然后在第 867 行我将trim_id"更改为model_id"

如下图:

options += '

现在,当我使用选择器填写表单时,它将使用型号名称而不是型号的 ID 号.

抱歉,来晚了.希望这可以帮助任何可能需要它的人!

Hello i am new to the community with little knowledge of coding but with huge interest to grow bigger and bigger in the knowledge. Sorry if my English is bad, i am Bulgarian. So, recently i've isntalled CARQuery API for Wordpress. I need a contact form 7 with Year/make/model/trim dropdown fields and submit them to email. Everything is fine except the TRIM field...instead of engine size i get numbers like 74567, 34567 and so on..

This is the otput in email:

Vehichle Info

Year: 2001 Make: opel Model: Zafira Trim: 30538

it should be

Vehichle Info

Year: 2001 Make: opel Model: Zafira Trim: 2.0 Diesel

Until now i am using shortcodes for the dropdowns:

[select* cq-year id:cq-year]
[select* cq-make id:cq-make]
[select* cq-model id:cq-model]
[select* cq-trim id:cq-trim]

[submit "SEND"]

and a function in functions.php

add_action('init','load_carquery_api_scripts');
function load_carquery_api_scripts() {
    if (class_exists('CarQueryAPI')) {
        CarQueryAPI::$add_script = true;
    }
}

What could be the solutions for trim? Is there a way the get data from dropdown TRIM field and export it as text. Here is the test page:

https://car.avtopedia.com/?page_id=7285

In the page the TRIM is visualised correctly...so for me the solution is to read the data and convert it to text or something ... i do not know. Could somebody help ?

The answer I found for having the trim not be sent through my contact form as an ID was within the Javascript file linked within the carquery-api.php file.

On line 107:

wp_register_script('carquery-api-js', 'https://www.carqueryapi.com/js/carquery.0.3.4.js', array('jquery'),

'0.3.4', true);

I went to that file, copied it, and on line 867 I changed the 'trim_id' to 'model_id'

Looking like this below:

options += '<option value="' + trims[i].model_trim + '" '+s+'>' +  trim_display + '</option>';

Now when I fill out my form using the selectors, it will use the model name rather than the model's ID number.

Sorry this is late. Hope this helps anyone who might need it!