本文整理汇总了PHP中obj::get_title方法的典型用法代码示例。如果您正苦于以下问题:PHP obj::get_title方法的具体用法?PHP obj::get_title怎么用?PHP obj::get_title使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类obj
的用法示例。
在下文中一共展示了obj::get_title方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validate_container
/**
* Validate container against our minimum quantity requirement
*
* @param bool $passed
* @param obj $mnm_stock
* @param obj $product
* @return void
*/
public static function validate_container($passed, $mnm_stock, $product)
{
$total_items_in_container = $mnm_stock->get_total_quantity();
$min_qty = intval(get_post_meta($product->id, '_mnm_container_size', true));
$max_qty = get_post_meta($product->id, '_mnm_max_container_size', true);
// if a max quantity exists and is not equal to the min quantity we have a non-fixed container size
if (false !== $max_qty && $min_qty != intval($max_qty)) {
$min_qty = $min_qty > 0 ? $min_qty : 1;
$max_qty = intval($max_qty);
// validate that an unlimited container is in min/max range & build a specific error message
if ($max_qty > 0 && $min_qty > 0 && ($total_items_in_container > $max_qty || $total_items_in_container < $min_qty)) {
$message = $total_items_in_container > $max_qty ? __('You have selected too many items.', 'woocommerce-mix-and-match-min-max-quantities') : __('You have selected too few items.', 'woocommerce-mix-and-match-min-max-quantities');
$message .= ' ' . sprintf(__('Please choose between %d and %d items for "%s".', 'woocommerce-mix-and-match-min-max-quantities'), $min_qty, $max_qty, $product->get_title());
wc_add_notice($message, 'error');
$passed = false;
} else {
if ($min_qty > 0 && $total_items_in_container < $min_qty) {
wc_add_notice(sprintf(__('Please choose at least %d items for "%s".', 'woocommerce-mix-and-match-min-max-quantities'), $min_qty, $product->get_title()), 'error');
$passed = false;
}
}
}
return $passed;
}
开发者ID:unsub,项目名称:woocommerce-mix-and-match-min-max,代码行数:32,代码来源:woocommerce-mix-and-match-min-max-quantities.php
示例2: wpn_low_stock
/**
* Notification options for Low stock
* @param obj $product product data
*
* @return void
*/
function wpn_low_stock($product)
{
global $woocommerce;
$title = __('Product Low Stock', 'wpn_pushbullet');
$body = sprintf(__('Product %s %s now has low stock.', 'wpn_pushbullet'), $product->id, $product->get_title());
$args = array('title' => $title, 'message' => $body);
wpn_send_notification($args);
}