コード例 #1
0
ファイル: categories.php プロジェクト: forthrobot/inuvik
 function widget($args, $options)
 {
     extract($args);
     $title = $before_title . $options['title'] . $after_title;
     unset($options['title']);
     $menu = shopp('catalog', 'get-category-list', $options);
     echo $before_widget . $title . $menu . $after_widget;
 }
コード例 #2
0
function george_display_shopp_cart_count($url)
{
    $count = 0;
    if (shopp('cart', 'hasitems')) {
        while (shopp('cart', 'items')) {
            $count++;
        }
    }
    return '<a href="' . $url . '">Shopping Cart (' . $count . ')</a>';
}
コード例 #3
0
ファイル: product.php プロジェクト: forthrobot/inuvik
 function widget($args, $options)
 {
     $Shopp = Shopp::object();
     extract($args);
     $title = $before_title . $options['title'] . $after_title;
     unset($options['title']);
     $content = shopp('storefront', 'get-sideproduct', $options);
     if (empty($content)) {
         return false;
     }
     echo $before_widget . $title . $content . $after_widget;
 }
コード例 #4
0
ファイル: section.php プロジェクト: forthrobot/inuvik
 function widget($args, $options)
 {
     $Shopp = Shopp::object();
     extract($args);
     $title = $before_title . $options['title'] . $after_title;
     unset($options['title']);
     if (empty(ShoppCollection()->id)) {
         return false;
     }
     $menu = shopp(ShoppCollection(), 'get-section-list', $options);
     echo $before_widget . $title . $menu . $after_widget;
 }
コード例 #5
0
 function widget($args, $options)
 {
     $Shopp = Shopp::object();
     if (!empty($args)) {
         extract($args);
     }
     if (empty($options['title'])) {
         $options['title'] = "Product Tags";
     }
     $title = $before_title . $options['title'] . $after_title;
     $tagcloud = shopp('catalog', 'get-tagcloud', $options);
     echo $before_widget . $title . $tagcloud . $after_widget;
 }
コード例 #6
0
ファイル: search.php プロジェクト: forthrobot/inuvik
 function widget($args, $options)
 {
     $Shopp = Shopp::object();
     if (!empty($args)) {
         extract($args);
     }
     if (empty($options['title'])) {
         $options['title'] = __('Shop Search', 'Shopp');
     }
     $title = $before_title . $options['title'] . $after_title;
     $content = shopp('catalog', 'get-searchform');
     echo $before_widget . $title . $content . $after_widget;
 }
コード例 #7
0
ファイル: shoppers.php プロジェクト: forthrobot/inuvik
 function widget($args, $options)
 {
     if (!empty($args)) {
         extract($args);
     }
     if (empty($options['title'])) {
         $options['title'] = __('Recent Shoppers', 'Shopp');
     }
     $title = $before_title . $options['title'] . $after_title;
     $content = shopp('catalog', 'get-recent-shoppers', $options);
     if (empty($content)) {
         return false;
     }
     // No recent shoppers, hide it
     echo $before_widget . $title . $content . $after_widget;
 }
コード例 #8
0
ファイル: facetedmenu.php プロジェクト: forthrobot/inuvik
 /**
  * Display the widget content
  *
  * @param array $args Display arguments including before_title, after_title, before_widget, and after_widget.
  * @param array $options The settings for the particular instance of the widget
  */
 function widget($args, $options)
 {
     if (!empty($args)) {
         extract($args);
     }
     if (empty($options['title'])) {
         $options['title'] = __('Product Filters', 'Shopp');
     }
     $title = $before_title . $options['title'] . $after_title;
     $Collection = ShoppCollection();
     if (empty($Collection)) {
         return;
     }
     if ('' != shopp('collection.get-id') && shopp('collection.has-faceted-menu')) {
         $menu = shopp('collection.get-faceted-menu', $options);
         echo $before_widget . $title . $menu . $after_widget;
     }
 }
コード例 #9
0
ファイル: cart.php プロジェクト: forthrobot/inuvik
 function widget($args, $options)
 {
     if (!empty($args)) {
         extract($args);
     }
     if (empty($options['title'])) {
         $options['title'] = __('Your Cart', 'Shopp');
     }
     $title = $before_title . $options['title'] . $after_title;
     if ('on' == $options['hide-empty'] && shopp_cart_items_count() == 0) {
         return;
     }
     $sidecart = shopp('cart', 'get-sidecart', $options);
     if (empty($sidecart)) {
         return;
     }
     echo $before_widget . $title . $sidecart . $after_widget;
 }
コード例 #10
0
ファイル: OfflinePayment.php プロジェクト: forthrobot/inuvik
 /**
  * Adds shopp('checkout.offlineinstructions') Theme API support
  *
  * @author Jonathan Davis
  * @since 1.1
  *
  * @return void
  **/
 public function instructions($result, $options)
 {
     add_filter('shopp_offline_payment_instructions', 'stripslashes');
     add_filter('shopp_offline_payment_instructions', 'wptexturize');
     add_filter('shopp_offline_payment_instructions', 'convert_chars');
     add_filter('shopp_offline_payment_instructions', 'wpautop');
     $paymethod = shopp('purchase', 'get-paymethod');
     $Payments = ShoppOrder()->Payments;
     if (!$Payments->exists($paymethod)) {
         return false;
     }
     $Paymethod = $Payments->get($paymethod);
     list($module, $id) = explode('-', $Paymethod->setting);
     if (!isset($this->settings[$id])) {
         return false;
     }
     $settings = $this->settings[$id];
     if (!empty($settings['instructions'])) {
         return apply_filters('shopp_offline_payment_instructions', $settings['instructions']);
     }
     return false;
 }
コード例 #11
0
ファイル: cart.php プロジェクト: forthrobot/inuvik
 /**
  * Displays the shipping estimate widget
  *
  * The shipping estimate widget allows shoppers to provide location
  * information so that shipping costs can be calculated.
  *
  * @api `shopp('cart.shipping-estimates')`
  * @since 1.0
  *
  * @param string    $result  The output
  * @param array     $options The options
  * - **class**: CSS class names to apply to the widget
  * - **postcode**: `on` (on, off) Show the post code field in the widget
  * @param ShoppCart $O       The working object
  * @return string The markup for the shipping estimate widget
  **/
 public static function shipping_estimates($result, $options, $O)
 {
     $defaults = array('postcode' => 'on', 'class' => 'ship-estimates', 'label' => Shopp::__('Estimate Shipping & Taxes'));
     $options = array_merge($defaults, $options);
     extract($options);
     if (empty($O->shipped)) {
         return '';
     }
     $markets = shopp_setting('target_markets');
     $Shipping = ShoppOrder()->Shipping;
     if (empty($markets)) {
         return '';
     }
     if (!empty($Shipping->country)) {
         $selected = $Shipping->country;
     } else {
         $selected = ShoppBaseLocale()->country();
     }
     $postcode = Shopp::str_true($postcode) || $O->showpostcode;
     $_ = '<div class="' . $class . '">';
     if (count($markets) > 1) {
         $_ .= '<span>';
         $_ .= '<select name="shipping[country]" id="shipping-country">';
         $_ .= menuoptions($markets, $selected, true);
         $_ .= '</select>';
         $_ .= '</span>';
     } else {
         $_ .= '<input type="hidden" name="shipping[country]" id="shipping-country" value="' . key($markets) . '" />';
     }
     if ($postcode) {
         $_ .= '<span>';
         $_ .= '<input type="text" name="shipping[postcode]" id="shipping-postcode" size="6" value="' . $Shipping->postcode . '"' . inputattrs($options) . ' />&nbsp;';
         $_ .= '</span>';
         $_ .= shopp('cart', 'get-update-button', array('value' => $label));
     }
     return $_ . '</div>';
 }
コード例 #12
0
ファイル: DB.php プロジェクト: crunnells/shopp
 /**
  * shopp('...','...') tags
  *
  * @author Jonathan Davis
  * @since 1.0
  * @version 1.2
  * @deprecated Retained for compatibility
  *
  * @param string $property The property to handle
  * @param array $options (optional) The tag options to process
  * @return mixed
  **/
 public function tag($property, array $options = array())
 {
     $options = array_merge(array('return' => true), shopp_parse_options($options));
     return shopp($this, $property, $options);
 }
コード例 #13
0
ファイル: email-order.php プロジェクト: forthrobot/inuvik
?>

<html>
	<div id="header">
		<h1><?php 
bloginfo('name');
?>
</h1>
		<h2><?php 
_e('Order', 'Shopp');
?>
 <?php 
shopp('purchase.id');
?>
</h2>
	</div>
	<div id="body">
		<?php 
shopp('purchase.receipt');
?>
		<?php 
if (shopp('purchase.notpaid') && shopp('checkout.get-offline-instructions')) {
    ?>
			<?php 
    shopp('checkout.offline-instructions');
    ?>
		<?php 
}
?>
	</div>
</html>
コード例 #14
0
ファイル: product.php プロジェクト: jimdough/Roadmaster
        ?>
            
                <?php 
        shopp('product.addons', 'mode=menu&label=true&defaults=' . __('Select an add-on', 'Shopp') . '&before_menu=<div class="addons_shopp">&after_menu=</div>');
        ?>
            
            <?php 
    }
    ?>
    
        </form>
        
    </div>

	<?php 
    shopp('product.description');
    ?>

	<?php 
    /* if ( shopp( 'product.has-specs' ) ) : ?>
    		<dl class="details">
    			<?php while ( shopp( 'product.specs' ) ) : ?>
    				<dt><?php shopp( 'product.spec', 'name' ); ?>:</dt>
    				<dd><?php shopp( 'product.spec', 'content' ); ?></dd>
    			<?php endwhile; ?>
    		</dl>
    	<?php endif; */
    ?>

<?php 
} else {
コード例 #15
0
ファイル: Cart.php プロジェクト: BlessySoftwares/anvelocom
 /**
  * Responds to AJAX-based cart requests
  *
  * @author Jonathan Davis
  * @since 1.0
  *
  * @return void
  **/
 public function ajax()
 {
     if ('html' == strtolower($_REQUEST['response'])) {
         shopp('cart.sidecart');
         exit;
     }
     $AjaxCart = new StdClass();
     $AjaxCart->url = Shopp::url(false, 'cart');
     $AjaxCart->label = __('Edit shopping cart', 'Shopp');
     $AjaxCart->checkouturl = Shopp::url(false, 'checkout', ShoppOrder()->security());
     $AjaxCart->checkoutLabel = __('Proceed to Checkout', 'Shopp');
     $AjaxCart->imguri = '' != get_option('permalink_structure') ? trailingslashit(Shopp::url('images')) : Shopp::url() . '&siid=';
     $AjaxCart->Totals = json_decode((string) $this->Totals);
     $AjaxCart->Contents = array();
     foreach ($this as $Item) {
         $CartItem = clone $Item;
         unset($CartItem->options);
         $AjaxCart->Contents[] = $CartItem;
     }
     if (isset($this->added)) {
         $AjaxCart->Item = clone $this->added();
     } else {
         $AjaxCart->Item = new ShoppCartItem();
     }
     unset($AjaxCart->Item->options);
     echo json_encode($AjaxCart);
     exit;
 }
コード例 #16
0
ファイル: account.php プロジェクト: jimdough/Roadmaster
<ul class="shopp account">
	<?php 
while (shopp('storefront.account-menu')) {
    ?>
		<li>
			<a href="<?php 
    shopp('storefront.account-menuitem', 'url');
    ?>
"><?php 
    shopp('storefront.account-menuitem');
    ?>
</a>
		</li>
	<?php 
}
?>
</ul>
コード例 #17
0
 /**
  * Wraps mark-up in a #shopp container, if needed
  *
  * @author Jonathan Davis
  * @since 1.1
  *
  * @param string $string The content markup to be wrapped
  * @param array $classes CSS classes to add to the container
  * @return string The wrapped markup
  **/
 static function wrapper($string)
 {
     $classes = array('shoppage', 'shopp_page');
     $views = array('list', 'grid');
     $view = shopp_setting('default_catalog_view');
     if (empty($view)) {
         $view = 'grid';
     }
     // Handle catalog view style cookie preference
     if (isset($_COOKIE['shopp_catalog_view'])) {
         $view = $_COOKIE['shopp_catalog_view'];
     }
     if (in_array($view, $views)) {
         $classes[] = $view;
     }
     $boxes = shopp_setting('row_products');
     if (empty($boxes)) {
         $boxes = 3;
     }
     $classes[] = 'shopp_grid-' . abs($boxes);
     // Add collection slug
     $Collection = ShoppCollection();
     if (!empty($Collection)) {
         if ($category = shopp('collection.get-slug')) {
             $classes[] = $category;
         }
     }
     // Add product id & slug classes
     $Product = ShoppProduct();
     if (!empty($Product)) {
         if ($productid = shopp('product.get-id')) {
             $classes[] = 'product-' . $productid;
         }
         if ($product = shopp('product.get-slug')) {
             $classes[] = $product;
         }
     }
     $classes = apply_filters('shopp_content_container_classes', $classes);
     $classes = esc_attr(join(' ', $classes));
     $id = false === strpos($string, 'id="shopp"') ? ' id="shopp" ' : '';
     return '<div' . $id . (!empty($classes) ? ' class="' . $classes . '"' : '') . '>' . $string . '</div>';
 }
コード例 #18
0
ファイル: cartitem.php プロジェクト: crunnells/shopp
 /**
  * Helper function that maps the current cart item's addons to the cart item's configured product menu options
  *
  * @internal
  * @since 1.3
  *
  * @param int $id The product ID to retrieve addon menus from
  * @return array A combined list of the menu labels list and addons menu map
  **/
 private static function _addon_menus()
 {
     return ShoppProductThemeAPI::_addon_menus(shopp('cartitem.get-product'));
 }
コード例 #19
0
ファイル: searchform.php プロジェクト: xentek/shopp-architect
<form method="get" id="searchform" action="<?php 
bloginfo('url');
?>
/">
    Search: <label class="searchbutton2">
      <?php 
shopp('catalog', 'search', 'type=radio&option=shopp');
?>
<span class="labelgap">Store</span>
    </label>
    <label class="searchbutton1">
    <?php 
shopp('catalog', 'search', 'type=radio&option=blog');
?>
<span class="labelgap">Blog</span></label><br />
      
    <input type="text" value="" name="s" id="s" class="searchfield" />
    <input type="submit" class="searchsubmit" name="searchsubmit" value="Find"><br />
    </form>
<script type="text/javascript" charset="utf-8">
  jQuery(document).ready(function(){
    searchclicker();
  });
  function searchclicker()
  {
    jQuery("input[name='st']")[0].checked = true;
  }
</script>
コード例 #20
0
ファイル: email.php プロジェクト: jimdough/Roadmaster
shopp('purchase.email-subject');
?>

<html>
	<div id="header">
		<h1><?php 
bloginfo('name');
?>
</h1>
		<h2><?php 
_e('Order Update', 'Shopp');
?>
</h2>
	</div>
	<div id="body">
		<?php 
shopp('purchase.email-note');
?>
		<p class="status"><?php 
_e('Your order is', 'Shopp');
?>
: <strong><?php 
shopp('purchase.status');
?>
</strong></p>
		<?php 
shopp('purchase.receipt');
?>
	</div>
</html>
コード例 #21
0
ファイル: Pages.php プロジェクト: jonathandavis/shopp
    /**
     * Handles rendering the [product-buynow] shortcode
     *
     * @author Jonathan Davis
     * @since 1.1
     *
     * @param array $attrs The parsed shortcode attributes
     * @return string The processed content
     **/
    static function buynow(array $atts = array())
    {
        $properties = array('name', 'slug', 'id');
        foreach ($properties as $prop) {
            if (!isset($atts[$prop])) {
                continue;
            }
            $Product = new ShoppProduct($atts[$prop], $prop);
        }
        if (!empty($Product->id)) {
            ShoppProduct($Product);
        } elseif (!isset(ShoppProduct()->id)) {
            return "";
        }
        ob_start();
        ?>
		<form action="<?php 
        shopp('cart.url');
        ?>
" method="post" class="shopp product">
			<input type="hidden" name="redirect" value="checkout" />
			<?php 
        if (isset($atts['variations'])) {
            ?>
				<?php 
            if (shopp('product.has-variations')) {
                ?>
				<ul class="variations">
					<?php 
                shopp('product.variations', 'mode=multiple&label=true&defaults=' . __('Select an option', 'Shopp') . '&before_menu=<li>&after_menu=</li>');
                ?>
				</ul>
				<?php 
            }
            ?>
			<?php 
        }
        ?>
			<?php 
        if (isset($atts['addons'])) {
            ?>
				<?php 
            if (shopp('product.has-addons')) {
                ?>
					<ul class="addons">
						<?php 
                shopp('product.addons', 'mode=menu&label=true&defaults=' . __('Select an add-on', 'Shopp') . '&before_menu=<li>&after_menu=</li>');
                ?>
					</ul>
				<?php 
            }
            ?>
			<?php 
        }
        ?>
			<p><?php 
        if (isset($atts['quantity'])) {
            $quantity = empty($atts['quantity']) ? 'class=selectall&input=menu' : html_entity_decode($atts['quantity']);
            ?>
				<?php 
            shopp('product.quantity', $quantity);
            ?>
			<?php 
        }
        ?>
			<?php 
        $button = 'label=' . (isset($atts['label']) ? $atts['label'] : __('Buy Now', 'Shopp'));
        $button .= isset($atts['ajax']) && Shopp::str_true($atts['ajax']) ? '&ajax=on' : '';
        if (isset($atts['button'])) {
            $button = html_entity_decode($atts['button']);
        }
        ?>
			<?php 
        shopp('product.addtocart', $button);
        ?>
</p>
		</form>
		<?php 
        $markup = ob_get_contents();
        ob_end_clean();
        ShoppStorefront()->shortcoded[] = get_the_ID();
        return apply_filters('shopp_buynow_shortcode', $markup);
    }
コード例 #22
0
ファイル: schema.php プロジェクト: msigley/shopp
        ?>

			<?php 
        if ('GTIN14' == shopp('product.get-spec', 'name')) {
            ?>
				<meta itemprop="gtin14" content="<?php 
            shopp('product.spec');
            ?>
" />
			<?php 
        }
        ?>

			<?php 
        if ('MPN' == shopp('product.get-spec', 'name')) {
            ?>
				<meta itemprop="mpn" content="<?php 
            shopp('product.spec');
            ?>
" />
			<?php 
        }
        ?>

		<?php 
    }
    ?>
	<?php 
}
?>
</div>
コード例 #23
0
ファイル: checkout.php プロジェクト: forthrobot/inuvik
					</li>
				<?php 
        }
        ?>

			<?php 
    }
    ?>

			<li>
				<div class="inline">
					<label for="marketing"><?php 
    shopp('checkout', 'marketing');
    ?>
 <?php 
    _e('Yes, I would like to receive e-mail updates and special offers!', 'Shopp');
    ?>
</label>
				</div>
			</li>
		</ul>
		<p class="submit"><?php 
    shopp('checkout.submit', 'value=' . __('Submit Order', 'Shopp'));
    ?>
</p>

	<?php 
}
?>
</form>
コード例 #24
0
ファイル: index.php プロジェクト: fwelections/fwelections
function all_images_shopp()
{
    // Gets all the images of a product of Shopp
    $the_images = array();
    if (preg_match_all('/<img (.+?)>/', shopp('product', 'coverimage', 'width=320&height=200&fit=all&quality=100&return=1'), $matches)) {
        // Gets the images in the post content
        foreach ($matches[1] as $match) {
            foreach (wp_kses_hair($match, array('http')) as $attr) {
                $img[$attr['name']] = $attr['value'];
            }
            $the_images[] = "<meta property='og:image' content='" . $img['src'] . "' />\n";
        }
    } else {
        $the_images[] = "<meta property='og:image' content='" . get_bloginfo('template_directory') . "/images/facebook-default.jpg' />\n";
        // Default image if none
    }
    return $the_images;
}
コード例 #25
0
 <?php 
        _e('Downloads', 'Shopp');
        ?>
</small>
				</td>
			</tr>
		<?php 
    }
    ?>
	</table>
<?php 
} else {
    ?>
	<p>
		<?php 
    _e('You have no digital product downloads available.', 'Shopp');
    ?>
	</p>
<?php 
}
// end 'has-downloads'
?>
<p>
	<a href="<?php 
shopp('customer.url');
?>
">&laquo; <?php 
_e('Return to Account Management', 'Shopp');
?>
</a>
</p>
コード例 #26
0
ファイル: categories.php プロジェクト: forthrobot/inuvik
                    ?>
 &quot;<?php 
                    echo esc_attr($CategoryName);
                    ?>
&quot;' href="<?php 
                    echo esc_url($deleteurl);
                    ?>
" rel="<?php 
                    echo $Category->id;
                    ?>
"><?php 
                    _e('Delete', 'Shopp');
                    ?>
</a> | </span>
							<span class='view'><a href="<?php 
                    shopp($Category, 'url');
                    ?>
" title="<?php 
                    _e('View', 'Shopp');
                    ?>
 &quot;<?php 
                    echo esc_attr($CategoryName);
                    ?>
&quot;" rel="permalink" target="_blank"><?php 
                    _e('View', 'Shopp');
                    ?>
</a></span>
						</div>
					</td>
				<?php 
                    break;
コード例 #27
0
ファイル: editor.php プロジェクト: msigley/shopp
</span><span id="editable-slug-full"><?php 
    echo esc_attr($Product->slug);
    ?>
</span><?php 
    echo user_trailingslashit("");
    ?>
</span>
							<span id="edit-slug-buttons">
								<button type="button" class="edit button"><?php 
    _e('Edit', 'Shopp');
    ?>
</button><?php 
    if ($Product->status == "publish") {
        ?>
<a href="<?php 
        echo esc_url(shopp($Product, 'get-url'));
        ?>
" id="view-product" class="view button"><?php 
        _e('View', 'Shopp');
        ?>
</a><?php 
    }
    ?>
</span>
							<span id="editor-slug-buttons">
								<button type="button" class="save button"><?php 
    _e('Save', 'Shopp');
    ?>
</button> <button type="button" class="cancel button"><?php 
    _e('Cancel', 'Shopp');
    ?>
コード例 #28
0
ファイル: email-shipped.php プロジェクト: jimdough/Roadmaster
						<tr>
							<td>
								<?php 
        shopp('purchase.item-name');
        shopp('purchase.item-options', 'before= – ');
        ?>
<br />
								<?php 
        shopp('purchase.item-sku');
        ?>
<br />
								<?php 
        shopp('purchase.item-addons-list');
        ?>
							</td>
							<td><?php 
        shopp('purchase.item-quantity');
        ?>
</td>
						</tr>
					<?php 
    }
    ?>

				</table>
			<?php 
}
?>
		</div>
	</div>
</html>
コード例 #29
0
ファイル: catalog.php プロジェクト: forthrobot/inuvik
<?php

/**
 ** WARNING! DO NOT EDIT!
 **
 ** These templates are part of the core Shopp files
 ** and will be overwritten when upgrading Shopp.
 **
 ** For editable templates, setup Shopp theme templates:
 ** http://shopplugin.com/docs/the-catalog/theme-templates/
 **
 **/
?>

<?php 
shopp('storefront.catalog-products');
コード例 #30
0
ファイル: Collection.php プロジェクト: forthrobot/inuvik
 public function load_facets()
 {
     if ('off' == $this->facetedmenus) {
         return;
     }
     $output = '';
     $this->filters();
     $Storefront = ShoppStorefront();
     if (!$Storefront) {
         return;
     }
     $CategoryFilters =& $Storefront->browsing[$this->slug];
     $Filtered = new ProductCategory($this->id);
     $filtering = array_merge($Filtered->facetsql(array()), array('ids' => true, 'limit' => 1000));
     $Filtered->load($filtering);
     $ids = join(',', $Filtered->worklist());
     // Load price facet filters first
     if ('disabled' != $this->pricerange) {
         $Facet = $this->facets['price'];
         $Facet->link = add_query_arg(array('s_ff' => 'on', urlencode($Facet->slug) => ''), shopp('category', 'get-url'));
         if (!$this->loaded) {
             $this->load();
         }
         if ('auto' == $this->pricerange) {
             $ranges = auto_ranges($this->pricing->average, $this->pricing->max, $this->pricing->min, $this->pricing->uniques);
         } else {
             $ranges = $this->priceranges;
         }
         if (!empty($ranges)) {
             $casewhen = '';
             foreach ($ranges as $index => $r) {
                 $minprice = $r['max'] > 0 ? " AND minprice <= {$r['max']}" : "";
                 $casewhen .= " WHEN (minprice >= {$r['min']}{$minprice}) THEN {$index}";
             }
             $sumtable = ShoppDatabaseObject::tablename(ProductSummary::$table);
             $query = "SELECT count(*) AS total, CASE {$casewhen} END AS rangeid\n\t\t\t\t\tFROM {$sumtable}\n\t\t\t\t\tWHERE product IN ({$ids}) GROUP BY rangeid";
             $counts = sDB::query($query, 'array', 'col', 'total', 'rangeid');
             foreach ($ranges as $id => $range) {
                 if (!isset($counts[$id]) || $counts[$id] < 1) {
                     continue;
                 }
                 $label = money($range['min']) . ' &mdash; ' . money($range['max']);
                 if ($range['min'] == 0) {
                     $label = sprintf(__('Under %s', 'Shopp'), money($range['max']));
                 }
                 if ($range['max'] == 0) {
                     $label = sprintf(__('%s and up', 'Shopp'), money($range['min']));
                 }
                 $FacetFilter = new ProductCategoryFacetFilter();
                 $FacetFilter->label = $label;
                 $FacetFilter->param = urlencode($range['min'] . '-' . $range['max']);
                 $FacetFilter->count = $counts[$id];
                 $Facet->filters[$FacetFilter->param] = $FacetFilter;
             }
         }
         // END !empty($ranges)
     }
     // Identify facet menu types to treat numeric and string contexts properly @bug #2014
     $custom = array();
     foreach ($this->facets as $Facet) {
         if ('custom' == $Facet->type) {
             $custom[] = sDB::escape($Facet->name);
         }
     }
     // Load spec aggregation data
     $spectable = ShoppDatabaseObject::tablename(Spec::$table);
     $query = "SELECT spec.name,spec.value,\n\t\t\tIF(0 >= FIND_IN_SET(spec.name,'" . join(",", $custom) . "'),IF(spec.numeral > 0,spec.name,spec.value),spec.value) AS merge, count(DISTINCT spec.value) AS uniques,\n\t\t\tcount(*) AS count,avg(numeral) AS avg,max(numeral) AS max,min(numeral) AS min\n\t\t\tFROM {$spectable} AS spec\n\t\t\tWHERE spec.parent IN ({$ids}) AND spec.context='product' AND spec.type='spec' AND (spec.value != '' OR spec.numeral > 0) GROUP BY merge";
     $specdata = sDB::query($query, 'array', 'index', 'name', true);
     foreach ($this->specs as $spec) {
         if ('disabled' == $spec['facetedmenu']) {
             continue;
         }
         $slug = sanitize_title_with_dashes($spec['name']);
         if (!isset($this->facets[$slug])) {
             continue;
         }
         $Facet =& $this->facets[$slug];
         $Facet->link = add_query_arg(array('s_ff' => 'on', urlencode($Facet->slug) => ''), shopp('category', 'get-url'));
         // For custom menu presets
         switch ($spec['facetedmenu']) {
             case 'custom':
                 $data = $specdata[$Facet->name];
                 $counts = array();
                 foreach ($data as $d) {
                     $counts[$d->value] = $d->count;
                 }
                 foreach ($spec['options'] as $option) {
                     if (!isset($counts[$option['name']]) || $counts[$option['name']] < 1) {
                         continue;
                     }
                     $FacetFilter = new ProductCategoryFacetFilter();
                     $FacetFilter->label = $option['name'];
                     $FacetFilter->param = urlencode($option['name']);
                     $FacetFilter->count = $counts[$FacetFilter->label];
                     $Facet->filters[$FacetFilter->param] = $FacetFilter;
                 }
                 break;
             case 'ranges':
                 foreach ($spec['options'] as $i => $option) {
                     $matches = array();
                     $format = '%s-%s';
                     $next = 0;
                     if (isset($spec['options'][$i + 1])) {
                         if (preg_match('/(\\d+[\\.\\,\\d]*)/', $spec['options'][$i + 1]['name'], $matches)) {
                             $next = $matches[0];
                         }
                     }
                     $matches = array();
                     $range = array("min" => 0, "max" => 0);
                     if (preg_match('/^(.*?)(\\d+[\\.\\,\\d]*)(.*)$/', $option['name'], $matches)) {
                         $base = $matches[2];
                         $format = $matches[1] . '%s' . $matches[3];
                         if (!isset($spec['options'][$i + 1])) {
                             $range['min'] = $base;
                         } else {
                             $range = array("min" => $base, "max" => $next - 1);
                         }
                     }
                     if ($i == 1) {
                         $href = add_query_arg($slug, urlencode(sprintf($format, '0', $range['min'])), $link);
                         $label = __('Under ', 'Shopp') . sprintf($format, $range['min']);
                         $list .= '<li><a href="' . $href . '">' . $label . '</a></li>';
                     }
                     $href = add_query_arg($slug, urlencode(sprintf($format, $range['min'], $range['max'])), $link);
                     $label = sprintf($format, $range['min']) . ' &mdash; ' . sprintf($format, $range['max']);
                     if ($range['max'] == 0) {
                         $label = sprintf($format, $range['min']) . ' ' . __('and up', 'Shopp');
                     }
                     $list .= '<li><a href="' . $href . '">' . $label . '</a></li>';
                 }
                 break;
             default:
                 if (!isset($specdata[$Facet->name])) {
                     break;
                 }
                 $data = $specdata[$Facet->name];
                 if (!is_array($data)) {
                     $data = array($data);
                 }
                 if ($data[0]->min + $data[0]->max + $data[0]->avg == 0) {
                     // Generate facet filters from text values
                     foreach ($data as $option) {
                         $FacetFilter = new ProductCategoryFacetFilter();
                         $FacetFilter->label = $option->value;
                         $FacetFilter->param = urlencode($option->value);
                         $FacetFilter->count = $option->count;
                         $Facet->filters[$FacetFilter->param] = $FacetFilter;
                     }
                 } else {
                     $data = reset($data);
                     $format = '%s';
                     if (preg_match('/^(.*?)(\\d+[\\.\\,\\d]*)(.*)$/', $data->value, $matches)) {
                         $format = $matches[1] . '%s' . $matches[3];
                     }
                     $ranges = auto_ranges($data->avg, $data->max, $data->min, $data->uniques);
                     if (!empty($ranges)) {
                         $casewhen = '';
                         foreach ($ranges as $index => $r) {
                             $max = $r['max'] > 0 ? " AND spec.numeral <= {$r['max']}" : "";
                             $casewhen .= " WHEN (spec.numeral >= {$r['min']}{$max}) THEN {$index}";
                         }
                         $query = "SELECT count(*) AS total, CASE {$casewhen} END AS rangeid\n\t\t\t\t\t\t\t\tFROM {$spectable} AS spec\n\t\t\t\t\t\t\t\tWHERE spec.parent IN ({$ids}) AND spec.name='{$Facet->name}' AND spec.context='product' AND spec.type='spec' AND spec.numeral > 0 GROUP BY rangeid";
                         $counts = sDB::query($query, 'array', 'col', 'total', 'rangeid');
                         foreach ($ranges as $id => $range) {
                             if (!isset($counts[$id]) || $counts[$id] < 1) {
                                 continue;
                             }
                             $label = sprintf($format, $range['min']) . ' &mdash; ' . sprintf($format, $range['max']);
                             if ($range['min'] == 0) {
                                 $label = __('Under ', 'Shopp') . sprintf($format, $range['max']);
                             } elseif ($range['max'] == 0) {
                                 $label = sprintf($format, $range['min']) . ' ' . __('and up', 'Shopp');
                             }
                             $FacetFilter = new ProductCategoryFacetFilter();
                             $FacetFilter->label = $label;
                             $FacetFilter->param = urlencode($range['min'] . '-' . $range['max']);
                             $FacetFilter->count = $counts[$id];
                             $Facet->filters[$FacetFilter->param] = $FacetFilter;
                         }
                     }
                     // END !empty($ranges)
                 }
         }
         // END switch
     }
 }