用于 Wordpress 的 Contact form 7 中的 CARQuery API.一些自定义代码 [英] CARQuery API in Contact form 7 for Wordpress. Some custom code

查看:19
本文介绍了用于 Wordpress 的 Contact form 7 中的 CARQuery API.一些自定义代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我是社区的新手,对编码知之甚少,但对知识的增长越来越感兴趣.对不起,如果我的英语不好,我是保加利亚人.所以,最近我为 Wordpress 安装了 CARQuery API.我需要一个带有年份/制造/型号/修剪下拉字段的联系表格 7 并将它们提交到电子邮件.除了 TRIM 字段外,一切都很好……我得到的不是引擎大小,而是 74567、34567 等数字.

这是电子邮件中的输入:

车辆信息

年份:2001品牌:欧宝型号:赛飞利修剪:30538

应该是

车辆信息

年份:2001品牌:欧宝型号:赛飞利修剪:2.0 柴油

直到现在我都在下拉菜单中使用简码:

[select* cq-year id:cq-year][选择* cq-make id:cq-make][选择* cq-model id:cq-model][选择* cq-trim id:cq-trim][提交发送"]

和functions.php中的一个函数

add_action('init','load_carquery_api_scripts');函数 load_carquery_api_scripts() {如果(class_exists('CarQueryAPI')){CarQueryAPI::$add_script = true;}}

修剪的解决方案是什么?有没有办法从下拉 TRIM 字段中获取数据并将其导出为文本.这是测试页面:

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

在页面中,TRIM 被正确显示...所以对我来说,解决方案是读取数据并将其转换为文本或其他内容...我不知道.有人可以帮忙吗?

解决方案

我找到的答案是在我的联系表格中没有通过我的联系表格发送修剪作为 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!

这篇关于用于 Wordpress 的 Contact form 7 中的 CARQuery API.一些自定义代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆