本文整理汇总了PHP中shopp_setting_enabled函数的典型用法代码示例。如果您正苦于以下问题:PHP shopp_setting_enabled函数的具体用法?PHP shopp_setting_enabled怎么用?PHP shopp_setting_enabled使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了shopp_setting_enabled函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:msigley,项目名称:shopp,代码行数:16,代码来源:Reports.php
示例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;
}
开发者ID:forthrobot,项目名称:inuvik,代码行数:16,代码来源:Shiprates.php
示例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'));
}
开发者ID:forthrobot,项目名称:inuvik,代码行数:21,代码来源:Dashboard.php
示例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);
}
}
开发者ID:forthrobot,项目名称:inuvik,代码行数:17,代码来源:Collection.php
示例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';
}
}
开发者ID:jonathandavis,项目名称:shopp,代码行数:101,代码来源:Product.php
示例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);
}
}
}
开发者ID:BlessySoftwares,项目名称:anvelocom,代码行数:23,代码来源:Storefront.php
示例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');
开发者ID:BlessySoftwares,项目名称:anvelocom,代码行数:31,代码来源:shipping.php
示例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;
}
开发者ID:crunnells,项目名称:shopp,代码行数:12,代码来源:cartitem.php
示例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']);
}
开发者ID:forthrobot,项目名称:inuvik,代码行数:11,代码来源:Flow.php
示例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>
开发者ID:BlessySoftwares,项目名称:anvelocom,代码行数:31,代码来源:setup.php
示例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));
}
开发者ID:forthrobot,项目名称:inuvik,代码行数:20,代码来源:Warehouse.php
示例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
开发者ID:forthrobot,项目名称:inuvik,代码行数:31,代码来源:checkout.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
开发者ID:forthrobot,项目名称:inuvik,代码行数:31,代码来源:settings.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');
}
开发者ID:BlessySoftwares,项目名称:anvelocom,代码行数:12,代码来源:Core.php
示例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;
}
开发者ID:forthrobot,项目名称:inuvik,代码行数:44,代码来源:product.php
示例16: calculate
/**
* Calculate taxes for a taxable amount using the given tax rates
*
* @author Jonathan Davis
* @since 1.3
*
* @param array $rates A list of ShoppItemTax objects
* @param float $taxable The amount to calculate taxes on
* @return float The total tax amount
**/
public static function calculate(array &$rates, $taxable)
{
$compound = 0;
$total = 0;
$inclusive = shopp_setting_enabled('tax_inclusive');
foreach ($rates as $label => $taxrate) {
if (is_null($taxrate->total)) {
continue;
}
// Skip taxes flagged to be removed from the item
$taxrate->amount = 0;
// Reset the captured tax amount @see Issue #2430
// Calculate tax amount
if ($inclusive) {
$tax = $taxable - $taxable / (1 + $taxrate->rate);
} else {
$tax = $taxable * $taxrate->rate;
}
if ($taxrate->compound) {
if (0 == $compound) {
$compound = $taxable;
} else {
if ($inclusive) {
$tax = $compound - $compound / (1 + $taxrate->rate);
} else {
$tax = $compound * $taxrate->rate;
}
// Compounded tax amount
}
$compound += $tax;
// Set compound taxable amount for next compound rate
}
$taxrate->amount = $tax;
// Capture the tax amount calculate for this taxrate
$total += $tax;
// Sum all of the taxes to get the total tax for the item
}
return $total;
}
开发者ID:BlessySoftwares,项目名称:anvelocom,代码行数:49,代码来源:Tax.php
示例17: totals
/**
* Calculates the order Totals
*
* @author Jonathan Davis
* @since 1.3
*
* @return void
**/
public function totals()
{
// Setup totals counter
if (false === $this->Totals) {
$this->Totals = new OrderTotals();
}
$Totals = $this->Totals;
do_action('shopp_cart_totals_init', $Totals);
$Shipping = ShoppOrder()->Shiprates;
$Discounts = ShoppOrder()->Discounts;
// Identify downloadable products
$downloads = $this->downloads();
$shipped = $this->shipped();
do_action('shopp_cart_item_totals', $Totals);
// Update cart item totals
$items = $this->keys();
// Use local array for iterating
foreach ($items as $itemid) {
// Allow other code to iterate the cart in this loop
$Item = $this->get($itemid);
$Item->totals();
}
$Totals->register(new OrderAmountShipping(array('id' => 'cart', 'amount' => $Shipping->calculate())));
if (apply_filters('shopp_tax_shipping', shopp_setting_enabled('tax_shipping'))) {
$Totals->register(new OrderAmountShippingTax($Totals->total('shipping')));
}
// Calculate discounts
$Totals->register(new OrderAmountDiscount(array('id' => 'cart', 'amount' => $Discounts->amount())));
// Apply credits to discount the order
$Discounts->credits();
if ($Discounts->shipping()) {
// If shipping discounts changed, recalculate shipping amount
$Totals->register(new OrderAmountShipping(array('id' => 'cart', 'amount' => $Shipping->calculate())));
}
// Ensure taxes are recalculated
$Totals->total('tax');
do_action_ref_array('shopp_cart_retotal', array(&$Totals));
return $Totals;
}
开发者ID:BlessySoftwares,项目名称:anvelocom,代码行数:47,代码来源:Cart.php
示例18: _inclusive_taxes
/**
* Helper function to determine if inclusive taxes apply to a given product
*
* @internal
* @since 1.3
*
* @param ShoppProduct $O The Shopp product to compare
* @return boolean True if inclusive taxes apply, false otherwise
**/
private static function _inclusive_taxes($O)
{
return shopp_setting_enabled('tax_inclusive') && !Shopp::str_true($O->excludetax);
}
开发者ID:BlessySoftwares,项目名称:anvelocom,代码行数:13,代码来源:product.php
示例19: instock
/**
* Verifies the item is in stock
*
* @author Jonathan Davis
* @since 1.1
*
* @return boolean
**/
public function instock($qty = false)
{
if (!shopp_setting_enabled('inventory') || shopp_setting_enabled('backorders')) {
return true;
}
if (!$this->inventory) {
// base item doesn't track inventory and no addons
if (empty($this->addons)) {
return true;
}
$addon_inventory = false;
foreach ($this->addons as $addon) {
if (Shopp::str_true($addon->inventory)) {
$addon_inventory = true;
}
}
// base item doesn't track inventory, but an addon does
if (!$addon_inventory) {
return true;
}
}
// need to get the current minimum stock for item + addons
$this->option->stock = $this->getstock();
if ($qty) {
return $this->option->stock >= $qty;
}
return $this->option->stock > 0;
}
开发者ID:borkweb,项目名称:shopp,代码行数:36,代码来源:Item.php
示例20: success
/**
* Separate class of order notifications for "successful" orders
*
* A successful order is conditionally based on the type of order being processed. An order
* is successful on the "authed" order event for shipped orders (any order that has any shipped
* items including mixed-type orders) or, it will fire on the "captured" order event
* for non-tangible orders (downloads, donation, virtual, etc)
*
* Keeping this behavior behind the success markers (authed/captured) prevents email
* servers from getting overloaded if the server is getting hit with bot-triggered order
* attempts.
*
* @author Jonathan Davis
* @since 1.2
*
* @return void
**/
public static function success($Purchase)
{
$templates = array('email-order.php', 'order.php', 'order.html');
// Generic filter hook for specifying global email messages
$messages = apply_filters('shopp_order_success_emails', array('customer' => array("{$Purchase->firstname} {$Purchase->lastname}", $Purchase->email, Shopp::__('Your order with %s', shopp_setting('business_name')), $templates), 'merchant' => array(shopp_setting('business_name'), shopp_setting('merchant_email'), Shopp::__('New Order - %s', $Purchase->id), array_merge(array('email-merchant-order.php'), $templates))), $Purchase);
// Remove merchant notification if disabled in receipt copy setting
if (!shopp_setting_enabled('receipt_copy')) {
unset($messages['merchant']);
}
foreach ($messages as $message) {
list($addressee, $email, $subject, $templates) = $message;
// Send email if the specific template is available
// and if an email has not already been sent to the recipient
$Purchase->email($addressee, $email, $subject, $templates);
}
}
开发者ID:borkweb,项目名称:shopp,代码行数:33,代码来源:Purchase.php
注:本文中的shopp_setting_enabled函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论