本文整理汇总了PHP中shopp_setting_enabled函数的典型用法代码示例。如果您正苦于以下问题:PHP shopp_setting_enabled函数的具体用法?PHP shopp_setting_enabled怎么用?PHP shopp_setting_enabled使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了shopp_setting_enabled函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: xreports
/**
* Registers extra conditional reports
*
* @author Jonathan Davis
* @since 1.3
*
* @param array $reports The list of registered reports
* @return array The modified list of registered reports
**/
static function xreports($reports)
{
if (shopp_setting_enabled('inventory')) {
$reports['inventory'] = array('class' => 'InventoryReport', 'name' => __('Inventory Report', 'Shopp'), 'label' => __('Inventory', 'Shopp'));
}
return $reports;
}
示例2: disabled
/**
* Determines if the shipping system is disabled
*
* @author Jonathan Davis
* @since 1.3
*
* @return void
**/
public function disabled()
{
// If shipping is disabled
if (!shopp_setting_enabled('shipping')) {
return true;
}
return false;
}
示例3: init
/**
* Initializes the Shopp dashboard widgets
*
* @author Jonathan Davis
* @since 1.0
*
* @return void
**/
public static function init()
{
$dashboard = shopp_setting('dashboard');
if (!(current_user_can('shopp_financials') && Shopp::str_true($dashboard))) {
return false;
}
wp_add_dashboard_widget('dashboard_shopp_stats', __('Sales Stats', 'Shopp'), array(__CLASS__, 'stats_widget'), array('all_link' => '', 'feed_link' => '', 'width' => 'half', 'height' => 'single'));
wp_add_dashboard_widget('dashboard_shopp_orders', __('Recent Orders', 'Shopp'), array(__CLASS__, 'orders_widget'), array('all_link' => 'admin.php?page=' . ShoppAdmin::pagename('orders'), 'feed_link' => '', 'width' => 'half', 'height' => 'single'));
if (shopp_setting_enabled('inventory')) {
wp_add_dashboard_widget('dashboard_shopp_inventory', __('Inventory Monitor', 'Shopp'), array(__CLASS__, 'inventory_widget'), array('all_link' => 'admin.php?page=' . ShoppAdmin::pagename('products'), 'feed_link' => '', 'width' => 'half', 'height' => 'single'));
}
add_action('admin_print_styles-index.php', array(__CLASS__, 'styles'));
}
示例4: recount
static function recount($terms, $taxonomy)
{
global $wpdb;
$summary_table = ShoppDatabaseObject::tablename(ProductSummary::$table);
foreach ((array) $terms as $term) {
$where = array("{$wpdb->posts}.ID = {$wpdb->term_relationships}.object_id", "post_status='publish'", "post_type='" . ShoppProduct::$posttype . "'");
if (shopp_setting_enabled('inventory') && !shopp_setting_enabled('outofstock_catalog')) {
$where[] = "( s.inventory='off' OR (s.inventory='on' AND s.stock > 0) )";
}
$where[] = "term_taxonomy_id=" . (int) $term;
$query = "SELECT COUNT(*) AS c FROM {$wpdb->term_relationships}, {$wpdb->posts} LEFT OUTER JOIN {$summary_table} AS s ON s.product={$wpdb->posts}.ID WHERE " . join(' AND ', $where);
$count = (int) sDB::query($query, 'auto', 'col', 'c');
do_action('edit_term_taxonomy', $term, $taxonomy);
$wpdb->update($wpdb->term_taxonomy, compact('count'), array('term_taxonomy_id' => $term));
do_action('edited_term_taxonomy', $term, $taxonomy);
}
}
示例5: pricing
//.........这里部分代码省略.........
// Build secondary lookup table using the price id as the key
$target->priceid[$price->id] = $price;
// Set promoprice before data aggregation
if (Shopp::str_true($price->sale)) {
$price->promoprice = $price->saleprice;
}
// Do not count disabled price lines or addon price lines in aggregate summary stats
if ('N/A' == $price->type || 'addon' == $price->context) {
return;
}
// Simple product or variant product is on sale
if (Shopp::str_true($price->sale)) {
$target->sale = $price->sale;
}
// Build third lookup table using the combined optionkey
$target->pricekey[$price->optionkey] = $price;
if (Shopp::str_true($price->inventory)) {
$target->stock += $price->stock;
$target->inventory = $price->inventory;
$target->lowstock($price->stock, $price->stocked);
}
$freeshipping = false;
if (!Shopp::str_true($price->shipping) && 'Shipped' == $price->type) {
$freeshipping = true;
}
// Calculate catalog discounts if not already calculated
if (!empty($price->discounts)) {
$discount = ShoppPromo::pricing($price->promoprice, $price->discounts);
if ($discount->freeship) {
$freeshipping = true;
}
$price->promoprice = $discount->pricetag;
}
$price->_sale = $price->sale;
// Keep a copy of the price record "sale" setting {@see issue #2797}
if ($price->promoprice < $price->price) {
$target->sale = $price->sale = 'on';
}
// Grab price and saleprice ranges (minimum - maximum)
if (!$price->price) {
$price->price = 0;
}
// Variation range index/properties
$varranges = array('price' => 'price', 'saleprice' => 'promoprice');
if (Shopp::str_true($price->inventory)) {
$varranges['stock'] = 'stock';
}
foreach ($varranges as $name => $prop) {
if (!isset($price->{$prop})) {
continue;
}
if (!isset($target->min[$name]) || $target->min[$name] == 0) {
$target->min[$name] = $price->{$prop};
} else {
$target->min[$name] = min($target->min[$name], $price->{$prop});
}
if ($target->min[$name] == $price->{$prop}) {
$target->min[$name . '_tax'] = $price->tax == "on";
}
if (!isset($target->max[$name])) {
$target->max[$name] = $price->{$prop};
} else {
$target->max[$name] = max($target->max[$name], $price->{$prop});
}
if ($target->max[$name] == $price->{$prop}) {
$target->max[$name . '_tax'] = $price->tax == "on";
}
}
// Determine savings ranges
if (Shopp::str_true($target->sale)) {
if (!isset($target->min['saved']) || $target->min['saved'] === false) {
$target->min['saved'] = $price->price;
$target->min['savings'] = 100;
$target->max['saved'] = $target->max['savings'] = 0;
}
$target->min['saved'] = min($target->min['saved'], $price->price - $price->promoprice);
$target->max['saved'] = max($target->max['saved'], $price->price - $price->promoprice);
// Find lowest savings percentage
$delta = $price->price - $price->promoprice;
if ($price->price == 0) {
// no savings possible
$target->min['savings'] = 0;
} else {
if ($delta <= 0) {
// total savings
$target->max['savings'] = 100;
} else {
$savings = $delta / $price->price * 100;
$target->min['savings'] = min($target->min['savings'], $savings);
$target->max['savings'] = max($target->max['savings'], $savings);
}
}
}
if (shopp_setting_enabled('inventory') && Shopp::str_true($target->inventory)) {
$target->outofstock = $target->stock <= 0;
}
if ($freeshipping) {
$target->freeship = 'on';
}
}
示例6: shortcodes
/**
* Sets handlers for Shopp shortcodes
*
* @author Jonathan Davis
* @since 1.1
*
* @return void
**/
public function shortcodes()
{
$this->shortcodes = array();
// Additional shortcode functionality
$this->shortcodes['catalog-product'] = array('ShoppShortcodes', 'product');
$this->shortcodes['catalog-buynow'] = array('ShoppShortcodes', 'buynow');
$this->shortcodes['catalog-collection'] = array('ShoppShortcodes', 'collection');
foreach ($this->shortcodes as $name => &$callback) {
if (shopp_setting_enabled('maintenance') || !ShoppSettings()->available() || Shopp::maintenance()) {
add_shortcode($name, array('', 'maintenance_shortcode'));
} else {
add_shortcode($name, $callback);
}
}
}
示例7: _e
if (shopp_setting_enabled('inventory')) {
echo ' checked="checked"';
}
?>
/><label for="inventory-toggle"> <?php
_e('Enable inventory tracking', 'Shopp');
?>
</label><br />
<?php
_e('Enables inventory tracking. Disable if you are exclusively selling intangible products or not keeping track of product stock.', 'Shopp');
?>
</p>
<input type="hidden" name="settings[backorders]" value="off" /><input type="checkbox" name="settings[backorders]" value="on" id="backorders-toggle"<?php
if (shopp_setting_enabled('backorders')) {
echo ' checked="checked"';
}
?>
/><label for="backorders-toggle"> <?php
_e('Allow backorders', 'Shopp');
?>
</label><br />
<?php
_e('Allows customers to order products that cannot be fulfilled because of a lack of available product in-stock. Disable to prevent customers from ordering more product than is available in-stock.', 'Shopp');
?>
</td>
</tr>
<tr>
<th scope="row" valign="top"><label><?php
_e('Shipping Carriers', 'Shopp');
示例8: _inclusive_taxes
/**
* Helper to determine when inclusive taxes apply
*
* @internal
*
* @param ShoppCartItem $O The cart item to evaluate
* @return bool True if inclusive taxes apply, false otherwise
**/
private static function _inclusive_taxes(ShoppCartItem $O)
{
return shopp_setting_enabled('tax_inclusive') && $O->includetax;
}
示例9: welcome
/**
* Displays the welcome screen
*
* @since 1.3
*
* @return boolean
**/
public static function welcome()
{
return defined('WP_ADMIN') && shopp_setting_enabled('display_welcome') && empty($_POST['setup']);
}
示例10: esc_attr
echo esc_attr(shopp_setting('business_address'));
?>
</textarea><br />
<?php
_e('Enter the mailing address for your business.', 'Shopp');
?>
</td>
</tr>
<tr>
<th scope="row" valign="top"><label for="maintenance-toggle"><?php
_e('Maintenance Mode', 'Shopp');
?>
</label></th>
<td><input type="hidden" name="settings[maintenance]" value="off" /><input type="checkbox" name="settings[maintenance]" value="on" id="maintenance-toggle"<?php
if (shopp_setting_enabled('maintenance')) {
echo ' checked="checked"';
}
?>
/><label for="maintenance-toggle"> <?php
_e('Enable maintenance mode', 'Shopp');
?>
</label><br />
<?php
_e('All storefront pages will display a maintenance mode message.', 'Shopp');
?>
</td>
</tr>
</table>
示例11: columns
/**
* Registers the column headers for the product list manager
*
* @author Jonathan Davis
* @return void
**/
public function columns()
{
$headings = array('default' => array('cb' => '<input type="checkbox" />', 'name' => __('Name', 'Shopp'), 'category' => __('Category', 'Shopp'), 'price' => __('Price', 'Shopp'), 'inventory' => __('Inventory', 'Shopp'), 'featured' => __('Featured', 'Shopp'), 'date' => __('Date', 'Shopp')), 'inventory' => array('inventory' => __('Inventory', 'Shopp'), 'sku' => __('SKU', 'Shopp'), 'name' => __('Name', 'Shopp')), 'bestselling' => array('cb' => '<input type="checkbox" />', 'name' => __('Name', 'Shopp'), 'sold' => __('Sold', 'Shopp'), 'gross' => __('Sales', 'Shopp'), 'price' => __('Price', 'Shopp'), 'inventory' => __('Inventory', 'Shopp'), 'featured' => __('Featured', 'Shopp'), 'date' => __('Date', 'Shopp')));
$columns = isset($headings[$this->view]) ? $headings[$this->view] : $headings['default'];
// Remove inventory column if inventory tracking is disabled
if (!shopp_setting_enabled('inventory')) {
unset($columns['inventory']);
}
// Remove category column from the "trash" view
if ('trash' == $this->view) {
unset($columns['category']);
}
ShoppUI::register_column_headers('toplevel_page_shopp-products', apply_filters('shopp_manage_product_columns', $columns));
}
示例12: esc_url
echo esc_url($this->url);
?>
" method="post">
<?php
wp_nonce_field('shopp-settings-checkout');
?>
<table class="form-table">
<tr>
<th scope="row" valign="top"><label for="shopping-cart-toggle"><?php
_e('Shopping Cart', 'Shopp');
?>
</label></th>
<td><input type="hidden" name="settings[shopping_cart]" value="off" /><input type="checkbox" name="settings[shopping_cart]" value="on" id="shopping-cart-toggle"<?php
if (shopp_setting_enabled('shopping_cart')) {
echo ' checked="checked"';
}
?>
/><label for="shopping-cart-toggle"> <?php
_e('Enabled', 'Shopp');
?>
</label><br />
<?php
_e('Uncheck this to disable the shopping cart and checkout. Useful for catalog-only sites.', 'Shopp');
?>
</td>
</tr>
<tr>
<th scope="row" valign="top"><label for="confirm_url"><?php
示例13: _e
echo ShoppAdminMetabox::help('product-editor-variations');
?>
</label></p>
<p><input type="hidden" name="addons" value="off" /><input type="checkbox" name="addons" value="on" id="addons-setting" tabindex="13"<?php
if ($Product->addons == "on") {
echo ' checked="checked"';
}
?>
/><label for="addons-setting"> <?php
_e('Add-ons', 'Shopp');
echo ShoppAdminMetabox::help('product-editor-addons');
?>
</label></p>
<?php
if (shopp_setting_enabled('tax_inclusive')) {
?>
<p><input type="hidden" name="meta[excludetax]" value="off" /><input type="checkbox" name="meta[excludetax]" value="on" id="excludetax-setting" tabindex="18" <?php
if (isset($Product->meta['excludetax']) && Shopp::str_true($Product->meta['excludetax']->value)) {
echo 'checked="checked"';
}
?>
/> <label for="excludetax-setting"><?php
_e('Exclude Taxes', 'Shopp');
?>
</label></p>
<?php
}
?>
<?php
示例14: maintenance
/**
* Detect if the Shopp installation needs maintenance
*
* @author Jonathan Davis
* @since 1.1
*
* @return boolean
**/
public static function maintenance()
{
return self::upgradedb() || shopp_setting_enabled('maintenance');
}
示例15: shopp_product_variant_set_saleprice
/**
* shopp_product_variant_set_saleprice - set the sale price of a variant
*
* @api
* @since 1.2
*
* @param int/Price $variant (required) The priceline id to set the sale price on, or the Price object to change. If Price object is specified, the object will be returned, but not saved to the database.
* @param bool $flag (optional default:false) true for on, false for off. Turns on or off the sale flag on the variant. If false, price is ignored.
* @param float $price the price to be set
* @param string $context (optional default:variant) enforces the priceline is a 'product','variant', or 'addon'
* @return bool/Price false on failure, true if Price saved, else the modified Price object.
**/
function shopp_product_variant_set_saleprice($variant = false, $flag = false, $price = 0.0, $context = 'variant')
{
$context = 'variant' == $context ? 'variation' : $context;
$save = true;
if (is_object($variant) && is_a($variant, 'ShoppPrice')) {
$Price = $variant;
$save = false;
} else {
if (false == $variant) {
shopp_debug(__FUNCTION__ . " failed: Variant id required.");
return false;
}
$Price = new ShoppPrice($variant);
if (empty($Price->id) || $Price->context != $context) {
shopp_debug(__FUNCTION__ . " failed: No such {$context} with id {$variant}.");
}
}
$Price->sale = "off";
if ($flag) {
$Price->sale = "on";
if (shopp_setting_enabled('tax_inclusive') && isset($Price->tax) && Shopp::str_true($Price->tax)) {
$Product = new ShoppProduct($Price->product);
$taxrate = shopp_taxrate(null, true, $Product);
$price = Shopp::floatval($price / (1 + $taxrate));
}
$Price->saleprice = $price;
}
if ($save) {
return $Price->save();
}
return $Price;
}