diff --git a/adminfunctions.php b/adminfunctions.php index 9cbf384..422fe8a 100755 --- a/adminfunctions.php +++ b/adminfunctions.php @@ -54,9 +54,16 @@ function foxyshop_load_admin_scripts($hook) { foxyshop_date_picker(); } +//Add filter to allow blocking the CSS on non-product pages +function foxyshop_load_css() { + return apply_filters( 'foxyshop_load_css', true ); +} + //Loading in Public Style function foxyshop_load_site_scripts() { - wp_enqueue_style('foxyshop_css', FOXYSHOP_DIR . '/css/foxyshop.css', array(), FOXYSHOP_VERSION); + if (foxyshop_load_css()) { + wp_enqueue_style('foxyshop_css', FOXYSHOP_DIR . '/css/foxyshop.css', array(), FOXYSHOP_VERSION); + } } //Checking For Includes To Be Removed diff --git a/helperfunctions.php b/helperfunctions.php index fc35a91..892c40f 100755 --- a/helperfunctions.php +++ b/helperfunctions.php @@ -319,8 +319,8 @@ function foxyshop_start_form() { -//Writes Variations (showQuantity 0 = Not Shown, 1 = Above, 2 = Below) -function foxyshop_product_variations($showQuantity = 0, $showPriceVariations = true, $beforeVariation = "", $afterVariation = '
') { +//Writes Variations (showQuantity 0 = Not Shown, 1 = Above, 2 = Below; labelPosition 0 = Before, 1 = Placeholder) +function foxyshop_product_variations($showQuantity = 0, $showPriceVariations = true, $beforeVariation = "", $afterVariation = '
', $labelPosition = 0) { global $post, $product, $foxyshop_settings, $foxyshop_write_variation_include; $writeUploadInclude = 0; $write = ""; @@ -330,7 +330,7 @@ function foxyshop_product_variations($showQuantity = 0, $showPriceVariations = t if ($product['quantity_hide']) $showQuantity = 0; if ($showQuantity == 1) { $write .= foxyshop_get_shipto(); - $write .= foxyshop_quantity(apply_filters("foxyshop_default_quantity_value", 1), $beforeVariation, $afterVariation); + $write .= foxyshop_quantity(apply_filters("foxyshop_default_quantity_value", 1), $beforeVariation, $afterVariation, "", $labelPosition); } //Loop Through Variations @@ -383,15 +383,22 @@ function foxyshop_product_variations($showQuantity = 0, $showPriceVariations = t $className = "variation-" . sanitize_title_with_dashes($variationName); - $writeBeforeVariation = $beforeVariation ? str_replace("%c", $className, $beforeVariation) . "\n" : ""; - $writeAfterVariation = $afterVariation ? $afterVariation . "\n" : ""; + $writeBeforeVariationEl = $beforeVariation ? str_replace("%c", $className, $beforeVariation) . "\n" : ""; + $writeAfterVariation = $afterVariation ? $afterVariation . "\n" : ""; $writeAfterVariationEl = $afterVariation ? $afterVariation . "\n" : ""; + $writeBeforeVariation = apply_filters('foxyshop_before_variation_field', $writeBeforeVariationEl, $variationName); + $writeAfterVariation = apply_filters('foxyshop_after_variation_field', $writeAfterVariationEl, $variationName); if ($variationRequired) $className .= ' foxyshop_required'; //Text if ($variationType == "text") { $write .= $writeBeforeVariation; - $write .= ''."\n"; - $write .= '' . esc_attr(str_replace('_',' ',$variationDisplayName)) . ''."\n"; + $write .= ' 0) $write .= ' style="width: ' . (int)$arrVariationText[0] * 6.5 . 'px;"'; if ($variationDisplayKey) $write .= ' dkey="' . $variationDisplayKey . '"'; if ($arrVariationText[1]) $write .= ' maxlength="' . $arrVariationText[1] . '"'; @@ -401,8 +408,13 @@ function foxyshop_product_variations($showQuantity = 0, $showPriceVariations = t //Textarea } elseif ($variationType == "textarea") { $write .= $writeBeforeVariation; - $write .= ''."\n"; - $write .= ''."\n"; + if ($labelPosition == 0) { + $write .= ''."\n"; + $write .= ''."\n"; + } + else if ($labelPosition == 1) { + $write .= ''."\n"; + } $write .= $writeAfterVariation; //Upload @@ -430,8 +442,14 @@ function foxyshop_product_variations($showQuantity = 0, $showPriceVariations = t //Select if ($variationType == "dropdown") { $write .= $writeBeforeVariation; - $write .= ''."\n"; - $write .= ''."\n"; + } + else if ($labelPosition == 1) { + $write .= '\n"; $write .= $writeAfterVariation; @@ -457,7 +475,7 @@ function foxyshop_product_variations($showQuantity = 0, $showPriceVariations = t //Show Quantity After Variations if ($showQuantity != 1) { $write .= foxyshop_get_shipto(); - if ($showQuantity == 2) $write .= foxyshop_quantity(apply_filters("foxyshop_default_quantity_value", 1), $beforeVariation, $afterVariation); + if ($showQuantity == 2) $write .= foxyshop_quantity(apply_filters("foxyshop_default_quantity_value", 1), $beforeVariation, $afterVariation, "", $labelPosition); } if ($write && !isset($foxyshop_write_variation_include)) { @@ -626,7 +644,7 @@ function foxyshop_insert_multship_js() { //Writes the Quantity Box -function foxyshop_quantity($qty = 1, $beforeVariation = "", $afterVariation = '
', $numberPrefix = "") { +function foxyshop_quantity($qty = 1, $beforeVariation = "", $afterVariation = '
', $numberPrefix = "", $labelPosition = 0) { global $product; if ($beforeVariation) $writeBeforeVariation = str_replace("%c", "foxyshop-quantity-holder", $beforeVariation) . "\n"; @@ -637,13 +655,18 @@ function foxyshop_quantity($qty = 1, $beforeVariation = "", $afterVariation = '< $write = ""; if (isset($writeBeforeVariation)) $write .= $writeBeforeVariation; if ($product['quantity_min'] > 0) $qty = $product['quantity_min']; - $write .= ''."\n"; + if ($labelPosition == 0) { + $write .= ''."\n"; + } if ($product['quantity_max_original'] > 0) { if ($numberPrefix) { $write .= ''; } + if ($labelPosition == 1) { + $write .= '' . "\n"; + } for ($i=($product['quantity_min'] > 0 ? $product['quantity_min'] : 1); $i <= $product['quantity_max_original']; $i++) { $write .= ''."\n"; } @@ -1418,7 +1441,7 @@ function foxyshop_addon_order($orderby) { //Add-On Products -function foxyshop_addon_products($show_qty = false, $before_entry = "", $after_entry = '
') { +function foxyshop_addon_products($show_qty = false, $before_entry = "", $after_entry = '
', $labelPosition = 0) { global $foxyshop_settings, $product, $foxyshop_skip_url_link; if (!$foxyshop_settings['enable_addon_products'] || !$product['addon_products']) return; $original_product = $product; @@ -1460,7 +1483,7 @@ function foxyshop_addon_products($show_qty = false, $before_entry = "", $after_e echo ''; echo ''; foxyshop_price(0, 1); - if ($show_qty) echo foxyshop_quantity(apply_filters("foxyshop_default_quantity_value", 1), "", "", $num); + if ($show_qty) echo foxyshop_quantity(apply_filters("foxyshop_default_quantity_value", 1), "", "", $num, $labelPosition); echo $after_entry;