我在这里阅读了文档:https://documentation.onesignal.com/docs/cordova-sdk但它完全不清楚!
我尝试几个测试没什么,我事件测试得到标题但仍然没有
document.addEventListener('deviceready', function () {
// Enable to debug issues.
// window.plugins.OneSignal.setLogLevel({logLevel: 4, visualLevel: 4});
var notificationOpenedCallback = function(jsonData) {
alert('notificationCallback: ' + JSON.stringify(jsonData)); => json data
alert('Title : '+ JSON.stringify(jsonData.payload.title)); => nothing
alert('Title2 : '+ jsonData.payload.title); => nothing
alert('Additional data: '+ jsonData.payload.additionalData); => nothing
};
window.plugins.OneSignal
.startInit("MY_ID")
.handleNotificationOpened(notificationOpenedCallback)
.endInit();
}, false);
Run Code Online (Sandbox Code Playgroud)
如何检索这些数据..
谢谢
我在A2Hosting上有一个共享主机,我最近将我的主域名public_html/移到了public_html/subdir/
这是结构:
/public_html
/subdir(site files of main domain)
/api
index.php
Run Code Online (Sandbox Code Playgroud)
我目前的htaccess(public_html)是:
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_URI} !^/subdir/
RewriteCond %{HTTP_HOST} ^(www\.)?domain\.
RewriteRule ^(.*)$ /subdir/$1 [L]
Run Code Online (Sandbox Code Playgroud)
当我之前打电话给我的APi时: domain.com/api/
但现在是: domain.com/subdir/api/
我的htaccess api是:
RewriteEngine On
RewriteBase /api/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [QSA,L]
Run Code Online (Sandbox Code Playgroud)
如何删除网址中的"subdir"以保持我之前的api?但是仍然用我当前的htaccess指向我的子目录?
谢谢
我最近尝试使用钩子修改我的所有运费以应用折扣。
这是我的代码:
add_filter( 'woocommerce_package_rates', 'woocommerce_package_rates' );
function woocommerce_package_rates( $rates ) {
$user_id = get_current_user_id();
if ( ! wc_memberships_is_user_active_member( $user_id, 'silver' ) ) { return $rates; }
$discount_amount = 30; // 30%
foreach($rates as $key => $rate ) {
$rates[$key]->cost = $rates[$key]->cost - ( $rates[$key]->cost * ( $discount_amount/100 ) );
}
return $rates;
}
Run Code Online (Sandbox Code Playgroud)
但还有一步是税收!我把税搞错了。
例如,我有我的运费,费用为3$。有了折扣,现在就到了2,10$。
我购买一件商品2$并支付运费2.10$。我收到了 1 美元的税费(相当于 3 美元的运费。看起来他不接受零钱),通常是0.82$。
我需要什么才能获得正确的税收计算?
我想在产品页面中获取当前的类别ID以显示templates/single-product/add-to-cart/simple.phpWoocommerce中的内容
If the category ID == 1 {//i'll show something}
if the category ID == 2 {//something else}
Run Code Online (Sandbox Code Playgroud)
所有这一切都在" simple.php"中
谢谢
编辑:
<?php echo $product->get_categories( ', ', '<span class="posted_in">' . _n( 'Category:', 'Categories:', $cat_count, 'woocommerce' ) . ' ', '</span>' ); ?>
Run Code Online (Sandbox Code Playgroud)
此代码给出了当前产品的产品名称,如果我无法获取ID,我怎么能得到类别名称的字符串呢?
我有我的自定义函数,它检索每个送货方式ID的id(ex flat_rate:3)
我需要通过id检索方法标题(如下图所示,我需要:
快速送货
根据文档,我发现WC_Shipping_Method::get_method_title()但我无法通过id检索.
还看到发货方法标签存储在wp_options表中option_id,因此无法管理做SQL请求.
有什么办法吗?
当我为客户创建自定义订单时,他们必须在自己的帐户中付款。但当他们访问订单支付页面时,没有显示运输和账单字段。怎么做 ?
我知道模板是form-pay.php
谢谢
我的功能有问题onclick。
这是我的代码:
$('ul.listing').append('<button onclick="openInApp("test")" class="btn btn-primary">Edit <i class="fa fa-external-link" aria-hidden="true"></i></button>');
Run Code Online (Sandbox Code Playgroud)
当我单击该按钮时,出现“ Unexpected end of input”错误消息。我也尝试像这样传递变量:
$('ul.listing').append('<button onclick="openInApp('+ edit_url +')" class="btn btn-primary">Edit <i class="fa fa-external-link" aria-hidden="true"></i></button>');
Run Code Online (Sandbox Code Playgroud)
我收到以下消息:Uncaught SyntaxError: missing ) after argument list
这两个错误都以“(”开始
我有另一个函数(总是在附录中):
$('ul.listing').append('<a href="event-details.html" onclick="saveEventID(' + data[i].ID + ');">')
Run Code Online (Sandbox Code Playgroud)
而且效果很好
我不明白
我在 Ionic 上使用 vue,代码如下:
data() {
return {
events: []
};
},
Run Code Online (Sandbox Code Playgroud)
模板:
<CardEvent
v-for="event of events"
:key="event.event_ID"
@click="router.push(`/home/evenement/` + event.event_ID)"
button
:title="event.event_title"
:picture="event.event_picture"
:addressExists="event.address_exists"
:day="event.event_day"
:month="event.event_month"
:isVirtual="event.is_virtual"
/>
Run Code Online (Sandbox Code Playgroud)
我有一个方法可以推送到我的事件数组:
loadMore() {
//Data here
this.events.push(response.data); // => error here
},
Run Code Online (Sandbox Code Playgroud)
在这一行我收到错误“ Argument of type 'any' is not assignable to parameter of type 'never'”
我看到我们可以做类似的事情:const result : string[] = []; 但是如何使用数据对象来实现这一点?
我正在使用带有会员资格的 Woocommerce 订阅,并且我想根据我的用户的会员计划对运费应用一些折扣。例如,银卡会员所有运输方式均可享受-30% 的折扣。要检查我使用的当前会员计划:
$user_id = get_current_user_id();// Get current user ID
if ( wc_memberships_is_user_active_member( $user_id, 'silver' ) ) {
//echo 'This is a special message only for Silver members!';
} else {
//echo 'I\'m sorry, you are not a silver member. There\'s nothing here for you!';
}
Run Code Online (Sandbox Code Playgroud)
但我没有找到任何方法可以通过功能来改变运费。
是否可以 ?谢谢
我想知道如何检索当前页面的名称作为变量。例如,我的菜单如下:
Item 1
Item 2 => sub-item 1
Run Code Online (Sandbox Code Playgroud)
第 1 项和第 2 项是自定义链接。sub-item1 是我的页面。
当我在此页面上时,我想检索“Item 2”名称(以构建我的自定义面包屑)
谢谢