public function add_download_info($item_id, $item, $order)
 {
     $product = $order->get_product_from_item($item);
     if (is_fancy_product($product->id) && $product->is_downloadable() && $order->is_download_permitted()) {
         $url = add_query_arg(array('order' => $order->id, 'item_id' => $item_id), get_permalink($item['product_id']));
         echo '<a href="' . esc_url($url) . '" class="fpd-order-item-download" style="font-size: 0.85em;">' . fpd_get_option('fpd_label_download_on_product_page') . '</a>';
     }
 }
 public function duplicate_fancy_product($new_id, $post)
 {
     if (is_fancy_product($post->ID)) {
         $custom_fields = get_post_custom($post->ID);
         update_post_meta($new_id, 'fpd_product_categories', unserialize($custom_fields['fpd_product_categories'][0]));
         update_post_meta($new_id, 'fpd_products', unserialize($custom_fields['fpd_products'][0]));
         update_post_meta($new_id, 'fpd_source_type', unserialize($custom_fields['fpd_source_type'][0]));
     }
 }
Example #3
0
 public function add_cart_item_data($cart_item_meta, $product_id)
 {
     if (is_fancy_product($product_id) && isset($_POST['fpd_product'])) {
         $cart_item_meta['fpd_data'] = array();
         $cart_item_meta['fpd_data']['fpd_product'] = $_POST['fpd_product'];
         $cart_item_meta['fpd_data']['fpd_product_price'] = $_POST['fpd_product_price'];
         $cart_item_meta['fpd_data']['fpd_product_thumbnail'] = $_POST['fpd_product_thumbnail'];
         $cart_item_meta['fpd_data']['fpd_remove_cart_item'] = $_POST['fpd_remove_cart_item'];
     }
     return $cart_item_meta;
 }
        public function add_product_designer_form()
        {
            global $post;
            $product_settings = new FPD_Product_Settings($post->ID);
            $open_in_lightbox = $product_settings->get_option('open_in_lightbox') && trim($product_settings->get_option('start_customizing_button')) != '';
            if (is_fancy_product($post->ID) && (!$product_settings->customize_button_enabled || $open_in_lightbox)) {
                ?>
				<input type="hidden" value="" name="fpd_product" />
				<input type="hidden" value="" name="fpd_product_price" />
				<input type="hidden" value="" name="fpd_product_thumbnail" />
				<input type="hidden" value="<?php 
                echo isset($_GET['cart_item_key']) ? $_GET['cart_item_key'] : '';
                ?>
" name="fpd_remove_cart_item" />
				<?php 
            }
        }
Example #5
0
?>

<?php 
if ($product->is_in_stock()) {
    ?>

	<?php 
    do_action('woocommerce_before_add_to_cart_form');
    ?>
	<form class="cart" method="post" enctype='multipart/form-data'>
	 	<?php 
    do_action('woocommerce_before_add_to_cart_button');
    ?>
		<?php 
    global $post;
    if (!is_fancy_product($post->ID) || isset($_GET['start_customizing'])) {
        ?>
		 	<?php 
        if (!$product->is_sold_individually()) {
            woocommerce_quantity_input(array('min_value' => apply_filters('woocommerce_quantity_input_min', 1, $product), 'max_value' => apply_filters('woocommerce_quantity_input_max', $product->backorders_allowed() ? '' : $product->get_stock_quantity(), $product)));
        }
        ?>

		 	<input type="hidden" name="add-to-cart" value="<?php 
        echo esc_attr($product->id);
        ?>
" />

		 	<button type="submit" class="single_add_to_cart_button button alt"><?php 
        echo $product->single_add_to_cart_text();
        ?>
        public function enqueue_styles()
        {
            global $post;
            if (fpd_get_option('fpd_sharing')) {
                wp_enqueue_style('fpd-jssocials');
            }
            wp_enqueue_style('jquery-fpd');
            wp_enqueue_style('fpd-single-product', plugins_url('/css/fancy-product.css', FPD_PLUGIN_ROOT_PHP), false, Fancy_Product_Designer::VERSION);
            //only enqueue css and js files when necessary
            $product_settings = new FPD_Product_Settings($post->ID);
            if (is_fancy_product($post->ID)) {
                ?>
					<style type="text/css">

						/* Styling */

						.fancy-product .fpd-primary-bg-color {
							background-color: <?php 
                echo fpd_get_option('fpd_designer_primary_color');
                ?>
;
						}

						.fancy-product .fpd-primary-text-color,
						.fancy-product .fpd-primary-text-color:hover {
							color:  <?php 
                echo fpd_get_option('fpd_designer_primary_text_color');
                ?>
;
						}

						.fancy-product .fpd-secondary-bg-color {
							background-color: <?php 
                echo fpd_get_option('fpd_designer_secondary_color');
                ?>
 !important;
						}

						.fancy-product .fpd-secondary-text-color,
						.fancy-product .fpd-secondary-text-color:hover {
							color:  <?php 
                echo fpd_get_option('fpd_designer_secondary_text_color');
                ?>
 !important;
						}

						.fancy-product .fpd-tabs > .fpd-btn.fpd-checked {
							border-color: <?php 
                echo fpd_get_option('fpd_designer_secondary_color');
                ?>
;
						}

						.fancy-product .fpd-checked i {
							color: <?php 
                echo fpd_get_option('fpd_designer_secondary_color');
                ?>
 !important;
						}

						<?php 
                if ($product_settings->get_option('background_type')) {
                    ?>
						.fpd-product-stage {
							background: <?php 
                    echo $product_settings->get_option('background_type') == 'color' ? $product_settings->get_option('background_color') : 'url(' . $product_settings->get_option('background_image') . ')';
                    ?>
 !important;
						}
						<?php 
                }
                ?>


						<?php 
                echo stripslashes(get_option('fpd_custom_css'));
                ?>

					</style>
					<?php 
                FPD_Fonts::output_webfont_links();
            }
        }
        public function add_theme_check_modal()
        {
            global $post;
            $wc_active = function_exists('get_woocommerce_currency');
            if (is_fancy_product($post->ID) || function_exists('is_cart') && is_cart()) {
                ?>
				<div class="fpd-theme-check-wrapper">
					<div class="fpd-theme-check-content">
						<h4><?php 
                _e('Theme Check', 'radykal');
                ?>
<span class="fa fa-times"></span></h4>
						<?php 
                if (function_exists('is_cart') && !is_cart() && get_post_type($post->ID) === 'product') {
                    foreach ($this->required_hooks as $key => $value) {
                        $success_log = __(' hook was found.', 'radykal');
                        $error_log = __(' hook is missing in the woocommerce templates of your theme. <a href="http://fancyproductdesigner.com/woocommerce-plugin/documentation/troubleshooting/" target="_blank">Help me fixing it</a>.', 'radykal');
                        if ($value) {
                            echo '<p class="fpd-success"><strong>' . $key . '</strong>' . $success_log;
                        } else {
                            if ($key == 'woocommerce_single_product_summary') {
                                echo '<p class="fpd-warning"><strong>' . $key . '</strong>' . $error_log;
                            } else {
                                echo '<p class="fpd-error"><strong>' . $key . '</strong>' . $error_log;
                            }
                        }
                    }
                }
                foreach ($this->required_filters as $key => $value) {
                    $success_log = __(' filter was found.', 'radykal');
                    $error_log = __(' filter is missing in the woocommerce templates of your theme. <a href="http://fancyproductdesigner.com/woocommerce-plugin/documentation/troubleshooting/" target="_blank">Help me fixing it</a>.', 'radykal');
                    if ($key == 'woocommerce_cart_item_thumbnail' && (function_exists('is_cart') && !is_cart())) {
                        continue;
                    }
                    if ($value) {
                        echo '<p class="fpd-success"><strong>' . $key . '</strong>' . $success_log;
                    } else {
                        if ($key == 'woocommerce_single_product_summary') {
                            echo '<p class="fpd-warning"><strong>' . $key . '</strong>' . $error_log;
                        } else {
                            echo '<p class="fpd-error"><strong>' . $key . '</strong>' . $error_log;
                        }
                    }
                }
                ?>
						<p>
							<?php 
                _e('If a hook or filter is missing in your theme, you can <a href="http://fancyproductdesigner.com/woocommerce-plugin/documentation/troubleshooting/">try fo fix it by yourself</a>. This is a theme issue, because authors of themes should follow the woocommerce codex and should not remove the default woocommerce hooks in the templates files. If you can not fix it by yourself after reading the "Troubleshooting" page, please contact the theme author.<br /><strong>I (developer of Fancy Product Designer) will not fix these issues for you.</strong>', 'radykal');
                ?>
						</p>
					</div>
				</div>
				<script type="text/javascript">
					jQuery(document).ready(function() {

						jQuery('.fpd-theme-check-content h4 span').click(function() {

							jQuery(this).parents('.fpd-theme-check-wrapper').fadeOut(300);
						});

					});
				</script>
				<?php 
            }
        }