Esempio n. 1
0
/**
* wpsc buy now button code products function
* Sorry about the ugly code, this is just to get the functionality back, buy now will soon be overhauled, and this function will then be completely different
* @return string - html displaying one or more products
*/
function wpsc_buy_now_button($product_id, $replaced_shortcode = false)
{
    global $wpdb, $wpsc_query, $wpsc_cart;
    $temp_wpsc_query = new WPSC_query(array('product_id' => $product_id));
    list($wpsc_query, $temp_wpsc_query) = array($temp_wpsc_query, $wpsc_query);
    // swap the wpsc_query objects
    //  exit('<pre>'.print_r($temp_wpsc_query, true).'</pre>');
    $selected_gateways = get_option('custom_gateway_options');
    if (in_array('google', (array) $selected_gateways)) {
        $output .= google_buynow($product['id']);
    } else {
        if (in_array('paypal_multiple', (array) $selected_gateways)) {
            if ($product_id > 0) {
                //$output .= "<pre>".print_r($wpsc_query,true)."</pre>";
                while (wpsc_have_products()) {
                    wpsc_the_product();
                    $price = calculate_product_price($wpsc_query->product['id'], $wpsc_query->first_variations);
                    $shipping = $wpsc_query->product['pnp'];
                    $output .= "<form onsubmit='log_paypal_buynow(this)' target='paypal' action='" . get_option('paypal_multiple_url') . "' method='post' />\n\t\t\t\t\t<input type='hidden' name='business' value='" . get_option('paypal_multiple_business') . "' />\n\t\t\t\t\t<input type='hidden' name='cmd' value='_xclick' />\n\t\t\t\t\t<input type='hidden' name='item_name' value='" . wpsc_the_product_title() . "' />\n\t\t\t\t\t<input type='hidden' id='item_number' name='item_number' value='" . wpsc_the_product_id() . "' />\n\t\t\t\t\t<input type='hidden' id='amount' name='amount' value='" . ($price + $pnp) . "' />\n\t\t\t\t\t<input type='hidden' id='unit' name='unit' value='" . $price . "' />\n\t\t\t\t\t<input type='hidden' id='shipping' name='ship11' value='" . $shipping . "' />\n\t\t\t\t\t<input type='hidden' name='handling' value='" . get_option('base_local_shipping') . "' />\n\t\t\t\t\t<input type='hidden' name='currency_code' value='" . get_option('paypal_curcode') . "' />\n\t\t\t\t\t<input type='hidden' name='undefined_quantity' value='0' />\n\t\t\t\t\t<input type='image' name='submit' border='0' src='https://www.paypal.com/en_US/i/btn/btn_buynow_LG.gif' alt='PayPal - The safer, easier way to pay online' />\n\t\t\t\t\t<img alt='' border='0' width='1' height='1' src='https://www.paypal.com/en_US/i/scr/pixel.gif' />\n\t\t\t\t</form>\n\r";
                }
            }
        }
    }
    list($temp_wpsc_query, $wpsc_query) = array($wpsc_query, $temp_wpsc_query);
    // swap the wpsc_query objects back
    if ($replaced_shortcode == true) {
        return $output;
    } else {
        echo $output;
    }
}
Esempio n. 2
0
function cdl_get_cat()
{
    global $wp_query, $wpsc_query;
    $query_data = array();
    $cdl_post_id = wpsc_the_product_id();
    $categories = wp_get_object_terms($cdl_post_id, 'wpsc_product_category');
    //if product is associated w more than one category
    if (count($categories) > 1 && isset($wpsc_query->query_vars['wpsc_product_category'])) {
        $query_data['category'] = $wpsc_query->query_vars['wpsc_product_category'];
    } elseif (count($categories) > 0) {
        $query_data['category'] = $categories[0]->slug;
    }
    return $query_data['category'];
}
					
					<?php echo wpsc_product_rater(); ?>
						
						
					<?php
						if(function_exists('gold_shpcrt_display_gallery')) :					
							echo gold_shpcrt_display_gallery(wpsc_the_product_id());
						endif;

						echo wpsc_also_bought(wpsc_the_product_id());
					?>
					</div>
		
					<form onsubmit="submitform(this);return false;" action="<?php echo wpsc_this_page_url(); ?>" method="post" name="product_<?php echo wpsc_the_product_id(); ?>" id="product_extra_<?php echo wpsc_the_product_id(); ?>">
						<input type="hidden" value="<?php echo wpsc_the_product_id(); ?>" name="prodid"/>
						<input type="hidden" value="<?php echo wpsc_the_product_id(); ?>" name="item"/>
					</form>
				</div>
			</div>
		</div>
		
		<?php echo wpsc_product_comments(); ?>
<?php endwhile; ?>
<?php /** end the product loop here */?>

		<?php
		if(function_exists('fancy_notifications')) {
			echo fancy_notifications();
		}
		?>
	
    ?>
</a>
                    </div>
       
                </div><?php 
    if (wpsc_the_product_thumbnail()) {
        ?>
                 <div class="featured_item_image">
                    <a href="<?php 
        echo get_permalink($product->ID);
        ?>
" title="<?php 
        echo get_the_title($product->ID);
        ?>
"><?php 
        echo wpsc_the_sticky_image(wpsc_the_product_id());
        ?>
</a>
                </div><?php 
    } else {
        ?>

                <div class="item_no_image">
                    <a href="<?php 
        echo get_the_title($product->ID);
        ?>
"><span><?php 
        esc_html_e('No Image Available', 'wpsc');
        ?>
</span></a>
                </div><?php 
Esempio n. 5
0
						<?php 
        if (get_option('hide_addtocart_button') == 0 && get_option('addtocart_or_buynow') == '1') {
            ?>
							<?php 
            echo wpsc_buy_now_button(wpsc_the_product_id());
            ?>
						<?php 
        }
        ?>
						
						<?php 
        echo wpsc_product_rater();
        ?>
						<?php 
        if (function_exists('gold_shpcrt_display_gallery')) {
            echo gold_shpcrt_display_gallery(wpsc_the_product_id(), true);
        }
        ?>
					</div>
			</div>
		</div>

		<?php 
    }
    ?>
		<?php 
    /** end the product loop here */
    ?>
		
		
		<?php 
Esempio n. 6
0
								<?php /** the variation group HTML and loop ends here */?>
							<?php endif; ?>
							
							<?php if((get_option('display_addtocart') == 1) && (get_option('addtocart_or_buynow') !='1')) :?> 	   
								<?php if(wpsc_product_has_stock()) : ?>
									<input type='image' src='<?php echo WPSC_URL; ?>/themes/iShop/images/buy_button.gif' id='product_<?php echo wpsc_the_product_id(); ?>_submit_button' class='wpsc_buy_button' name='Buy'  value="<?php echo __('Add To Cart', 'wpsc'); ?>" />
								<?php else : ?>
									<p class='soldout'><?php echo __('This product has sold out.', 'wpsc'); ?></p>
								<?php endif ; ?>
							<?php endif; ?>
							
						</form>		
					</div>
					
					<?php if((get_option('display_addtocart') == 1) && (get_option('addtocart_or_buynow') == '1')) :?> 	  
						<?php echo wpsc_buy_now_button(wpsc_the_product_id()); ?>
					<?php endif ; ?>
					
				<?php endif; ?> 				
			</div>
			
			
			<?php if((get_option('grid_number_per_row') > 0) && ((($wpsc_query->current_product +1) % get_option('grid_number_per_row')) == 0)) :?>
			  <div class='grid_view_newline'></div>
			<?php endif ; ?>
		
			
			
		<?php endwhile; ?>
		
		<?php if(wpsc_product_count() < 1):?>
Esempio n. 7
0
function wpsc_you_save($args = null)
{
    $defaults = array('product_id' => false, 'type' => "percentage", 'variations' => false);
    $args = wp_parse_args($args, $defaults);
    extract($args, EXTR_SKIP);
    global $wpdb;
    if (!$product_id) {
        if (function_exists('wpsc_the_product_id')) {
            //select the variation ID with lowest price
            $product_id = $wpdb->get_var('SELECT `posts`.`id` FROM ' . $wpdb->posts . ' `posts` JOIN ' . $wpdb->postmeta . ' `postmeta` ON `posts`.`id` = `postmeta`.`post_id` WHERE `posts`.`post_parent` = ' . wpsc_the_product_id() . ' AND `posts`.`post_type` = "wpsc-product" AND `posts`.`post_status` = "inherit" AND `postmeta`.`meta_key`="_wpsc_price" ORDER BY (`postmeta`.`meta_value`)+0 ASC LIMIT 1');
            if (!$product_id) {
                $product_id = wpsc_the_product_id();
            }
        }
    }
    if (!$product_id) {
        return 0;
    }
    $regular_price = wpsc_calculate_price($product_id, $variations, false);
    $sale_price = wpsc_calculate_price($product_id, $variations, true);
    switch ($type) {
        case "amount":
            return $regular_price - $sale_price;
            break;
        default:
            if (number_format(($regular_price - $sale_price) / $regular_price * 100, 2) == 100) {
                return 99.98999999999999;
            } else {
                return number_format(($regular_price - $sale_price) / $regular_price * 100, 2);
            }
    }
}
Esempio n. 8
0
function wpsc_latest_product($args = null, $instance)
{
    global $wpdb;
    $args = wp_parse_args((array) $args, array('number' => 5));
    $siteurl = get_option('siteurl');
    $options = get_option('wpsc-widget_latest_products');
    $number = isset($instance['number']) ? (int) $instance['number'] : 5;
    $image = isset($instance['image']) ? (bool) $instance['image'] : FALSE;
    if (isset($instance['width'])) {
        $width = $instance['width'];
    }
    if (isset($instance['height'])) {
        $height = $instance['height'];
    }
    $latest_products = get_posts(array('post_type' => 'wpsc-product', 'numberposts' => $number, 'orderby' => 'post_date', 'post_parent' => 0, 'post_status' => 'publish', 'order' => 'DESC'));
    $output = '';
    if (count($latest_products) > 0) {
        foreach ($latest_products as $latest_product) {
            // Link
            $output .= '<a href="' . wpsc_product_url($latest_product->ID, null) . '" class="wpsc-product-title">' . stripslashes($latest_product->post_title) . '</a>';
            // Thumbnails, if required
            if ($image) {
                $output .= '<div class="item_image">';
                $output .= '<a href="' . wpsc_product_url($latest_product->ID, null) . '">';
                $attached_images = (array) get_posts(array('post_type' => 'attachment', 'numberposts' => 1, 'post_status' => null, 'post_parent' => $latest_product->ID, 'orderby' => 'menu_order', 'order' => 'ASC'));
                $attached_image = $attached_images[0];
                if ($attached_image->ID > 0) {
                    $output .= '<img src="' . wpsc_product_image($attached_image->ID, $width, $height) . '" title="' . $latest_product->post_title . '" alt="' . $latest_product->post_title . '" />';
                } else {
                    $output .= '<img class="no-image" id="product_image_' . wpsc_the_product_id() . '" alt="No Image" title="' . wpsc_the_product_title() . '" src="' . WPSC_URL . '/wpsc-theme/images/noimage.png" width="' . $width . '" height="' . $height . '" />';
                }
                $output .= '<span></span>';
                $output .= '</a>';
                $output .= '</div>';
            }
        }
    }
    echo $output;
}
function vtprd_show_product_you_save($product_id = null)
{
    global $post, $vtprd_setup_options, $vtprd_info;
    //can only be executed when WPEC version less than 3.8.9
    if (!(version_compare(strval('3.8.9'), strval(WPSC_VERSION), '>') == 1)) {
        //'==1' = 2nd value is lower
        return;
    }
    $pct = vtprd_get_single_product_you_save_pct($product_id);
    $amt = $vtprd_info['product_session_info']['product_yousave_total_amt'];
    $amt = vtprd_format_money_element($amt);
    //CUSTOM function created by CUSTOMER
    if (function_exists('custom_show_single_product_you_save')) {
        custom_show_single_product_you_save($product_id, $pct, $amt);
        return;
    }
    if ($pct) {
        ?>
				<p class="pricedisplay product_<?php 
        echo wpsc_the_product_id();
        ?>
"><?php 
        _e('You save', 'wpsc');
        ?>
: <span class="yousave" id="yousave_<?php 
        echo wpsc_the_product_id();
        ?>
"><?php 
        echo $amt;
        ?>
! (<?php 
        echo $pct;
        ?>
%)</span></p>
			<?php 
    } else {
        //original code from wpsc-single_product.php
        ?>
      
        <?php 
        if (wpsc_product_on_special()) {
            ?>
					<p class="pricedisplay product_<?php 
            echo wpsc_the_product_id();
            ?>
"><?php 
            _e('You save', 'wpsc');
            ?>
: <span class="yousave" id="yousave_<?php 
            echo wpsc_the_product_id();
            ?>
"><?php 
            echo wpsc_currency_display(wpsc_you_save('type=amount'), array('html' => false));
            ?>
! (<?php 
            echo wpsc_you_save();
            ?>
%)</span></p>
				<?php 
        }
        ?>
      
      <?php 
    }
    return;
}
Esempio n. 10
0
/**
 * wpsc_get_form_action
 *
 * Return the form action for use in the template files
 *
 * @global <type> $wpec_form_action
 * @return <type>
 */
function wpsc_get_form_action()
{
    global $wpec_form_action;
    $product_id = wpsc_the_product_id();
    // Function has already ran in this page load
    if (isset($wpec_form_action)) {
        $action = $wpec_form_action;
        // No global so figure it out
    } else {
        // Use external if set
        if (wpsc_is_product_external()) {
            $action = wpsc_product_external_link($product_id);
            // Otherwise use this page
        } else {
            $action = wpsc_this_page_url();
        }
    }
    // Return form action
    return $action;
}
Esempio n. 11
0
					<form onsubmit="submitform(this);return false;" action="<?php 
    echo wpsc_this_page_url();
    ?>
" method="post" name="product_<?php 
    echo wpsc_the_product_id();
    ?>
" id="product_extra_<?php 
    echo wpsc_the_product_id();
    ?>
">
						<input type="hidden" value="<?php 
    echo wpsc_the_product_id();
    ?>
" name="prodid"/>
						<input type="hidden" value="<?php 
    echo wpsc_the_product_id();
    ?>
" name="item"/>
					</form>
				</div>
			</div>
		</div>
		
		<?php 
    echo wpsc_product_comments();
}
/** end the product loop here */
?>

		<?php 
if (function_exists('fancy_notifications')) {
Esempio n. 12
0
         $product_tags = get_the_terms($post->ID, 'product_tag');
         if ($product_tags) {
             foreach ($product_tags as $product_tag) {
                 $categories .= str_replace(" ", "_", $product_tag->slug) . $NV_shortcode_id . ' ';
             }
         }
         $categories = preg_replace("/&#?[a-z0-9]+;/i", "", $categories);
     }
     if (class_exists('WPSC_Query')) {
         $wpsc_product_categories = get_the_product_category(wpsc_the_product_id());
         if ($wpsc_product_categories) {
             foreach ($wpsc_product_categories as $wpsc_product_category) {
                 $categories .= str_replace(" ", "_", $wpsc_product_category->slug) . $NV_shortcode_id . ' ';
             }
         }
         $wpsc_product_tags = wp_get_product_tags(wpsc_the_product_id());
         if ($wpsc_product_tags) {
             foreach ($wpsc_product_tags as $wpsc_product_tag) {
                 $categories .= str_replace(" ", "_", $wpsc_product_tag->slug) . $NV_shortcode_id . ' ';
             }
         }
         $categories = preg_replace("/&#?[a-z0-9]+;/i", "", $categories);
     }
 }
 /* ------------------------------------
 		
 		:: GET INDIVIDUAL SLIDE DATA
 		
 		------------------------------------ */
 if ($NV_datasource == 'data-5') {
     if (class_exists('Woocommerce')) {
Esempio n. 13
0
/**
 * Product Specials Widget content function
 *
 * Displays the latest products.
 *
 * @todo Remove marketplace theme specific code and maybe replce with a filter for the image output? (not required if themeable as above)
 *
 * Changes made in 3.8 that may affect users:
 *
 * 1. The product title link text does now not have a bold tag, it should be styled via css.
 * 2. <br /> tags have been ommitted. Padding and margins should be applied via css.
 * 3. Each product is enclosed in a <div> with a 'wpec-special-product' class.
 * 4. The product list is enclosed in a <div> with a 'wpec-special-products' class.
 * 5. Function now expect a single paramter with an array of options (used to be a string which prepended the output).
 */
function wpsc_specials($args = null, $instance)
{
    global $wpdb;
    $args = wp_parse_args((array) $args, array('number' => 5));
    $siteurl = get_option('siteurl');
    if (!($number = (int) $instance['number'])) {
        $number = 5;
    }
    $show_thumbnails = isset($instance['show_thumbnails']) ? (bool) $instance['show_thumbnails'] : FALSE;
    $show_description = isset($instance['show_description']) ? (bool) $instance['show_description'] : FALSE;
    $excludes = wpsc_specials_excludes();
    $args = array('post_type' => 'wpsc-product', 'caller_get_posts' => 1, 'post_status' => 'publish', 'post_parent' => 0, 'post__not_in' => $excludes, 'posts_per_page' => $number);
    $special_products = query_posts($args);
    $output = '';
    $product_ids[] = array();
    if (count($special_products) > 0) {
        list($wp_query, $special_products) = array($special_products, $wp_query);
        // swap the wpsc_query object
        while (wpsc_have_products()) {
            wpsc_the_product();
            if (!in_array(wpsc_the_product_id(), $product_ids)) {
                $product_ids[] = wpsc_the_product_id();
                if ($show_thumbnails) {
                    if (wpsc_the_product_thumbnail()) {
                        ?>
						<a rel="<?php 
                        echo str_replace(array(" ", '"', "'", '&quot;', '&#039;'), array("_", "", "", "", ''), wpsc_the_product_title());
                        ?>
" href="<?php 
                        echo wpsc_the_product_permalink();
                        ?>
">
							<img class="product_image" id="product_image_<?php 
                        echo wpsc_the_product_id();
                        ?>
" alt="<?php 
                        echo wpsc_the_product_title();
                        ?>
" title="<?php 
                        echo wpsc_the_product_title();
                        ?>
" src="<?php 
                        echo wpsc_the_product_thumbnail();
                        ?>
"/>
						</a>
				<?php 
                    } else {
                        ?>
							<a href="<?php 
                        echo wpsc_the_product_permalink();
                        ?>
">
							<img class="no-image" id="product_image_<?php 
                        echo wpsc_the_product_id();
                        ?>
" alt="No Image" title="<?php 
                        echo wpsc_the_product_title();
                        ?>
" src="<?php 
                        echo WPSC_URL;
                        ?>
/wpsc-theme/wpsc-images/noimage.png" width="<?php 
                        esc_attr_e(get_option('product_image_width'));
                        ?>
" height="<?php 
                        esc_attr_e(get_option('product_image_height'));
                        ?>
" />
							</a>
				<?php 
                    }
                    ?>
				<?php 
                }
                // close show thumbnails
                ?>
 
				<br />
				<span id="special_product_price_<?php 
                echo wpsc_the_product_id();
                ?>
">
				<!-- price display -->
				<?php 
                if (wpsc_have_variation_groups()) {
                    while (wpsc_have_variation_groups()) {
                        wpsc_the_variation_group();
                        ?>
								<?php 
                        /** the variation HTML and loop */
                        ?>
								<?php 
                        $variation_outputs = array();
                        ?>
								<?php 
                        while (wpsc_have_variations()) {
                            wpsc_the_variation();
                            ?>
										<?php 
                            $variation_outputs[] = '';
                            $variation_prices[] = wpsc_the_variation_price(true);
                        }
                        // Sort the variations into price order before outputting
                        $data[] = $variation_outputs;
                        $data[] = $variation_prices;
                        array_multisort($data[1], SORT_ASC, SORT_NUMERIC, $data[0], SORT_ASC, SORT_STRING);
                        ?>
						<?php 
                    }
                    echo __('From', 'wpsc') . ' : ' . wpsc_currency_display($data[1][0]);
                    ?>
				<?php 
                } else {
                    ?>
				<?php 
                    echo wpsc_currency_display(wpsc_calculate_price(wpsc_the_product_id(), null, true));
                    ?>
				
				<?php 
                }
                ?>
				</span><br />			
				<strong><a class="wpsc_product_title" href="<?php 
                echo wpsc_product_url(wpsc_the_product_id(), false);
                ?>
"><?php 
                echo wpsc_the_product_title();
                ?>
</a></strong><br /> 
				
				<?php 
                if ($show_description) {
                    ?>
					<div class="wpsc-special-description">
						<?php 
                    echo wpsc_the_product_description();
                    ?>
					</div>									
				<?php 
                }
                // close show description
                ?>
 
			
				<?php 
            }
        }
        list($wp_query, $special_products) = array($special_products, $wp_query);
        // swap the wpsc_query object
        wp_reset_query();
    }
}
function getSliderProducts($products)
{
    $products = explode(",", $products);
    global $wpsc_query, $wpdb;
    foreach ($products as $product) {
        $image_width = get_option('single_view_image_width');
        $image_height = get_option('single_view_image_height');
        $options = get_option('site_basic_options');
        $wpsc_query = new WPSC_Query(array('product_id' => $product));
        while (wpsc_have_products()) {
            wpsc_the_product();
            ?>
			<li class="feature-product">
			<?php 
            if (wpsc_the_product_thumbnail()) {
                ?>
			<div class="product-image">
				<a rel="<?php 
                echo str_replace(array(" ", '"', "'", '&quot;', '&#039;'), array("_", "", "", "", ''), wpsc_the_product_title());
                ?>
" class="thickbox preview_link" href="<?php 
                echo wpsc_the_product_image();
                ?>
">
					<img class="product_image" id="product_image_<?php 
                echo wpsc_the_product_id();
                ?>
" alt="<?php 
                echo wpsc_the_product_title();
                ?>
" title="<?php 
                echo wpsc_the_product_title();
                ?>
" src="<?php 
                if ($options['themelayout'] == 'boxed') {
                    bloginfo('template_url');
                    ?>
/timthumb.php?src=<?php 
                    echo wpsc_the_product_image($image_width, $image_height);
                    ?>
&w=457<?php 
                } else {
                    echo wpsc_the_product_image($image_width, $image_height);
                }
                ?>
" />
				</a>
			</div>
			<?php 
            } else {
                ?>
				<div class="product-image product-thumb item_no_image">
					<a href="<?php 
                echo wpsc_the_product_permalink();
                ?>
">
					<span><?php 
                _e('No Image Available', 'flexishop');
                ?>
</span>
					</a>
				</div>
			<?php 
            }
            ?>
			<div class="product-content">
			<h2 class="prodtitles">
				<?php 
            if (get_option('hide_name_link') == 1) {
                ?>
					<span><?php 
                echo wpsc_the_product_title();
                ?>
</span>
				<?php 
            } else {
                ?>
 
					<a class="wpsc_product_title" href="<?php 
                echo wpsc_the_product_permalink();
                ?>
"><?php 
                echo wpsc_the_product_title();
                ?>
</a>
				<?php 
            }
            ?>
 				
			</h2>
			<!-- <div class="wpsc_product_price">
			<?php 
            if (wpsc_product_is_donation()) {
                ?>
				<label for='donation_price_<?php 
                echo wpsc_the_product_id();
                ?>
'><?php 
                echo __('Donation', 'flexishop');
                ?>
:</label>
				<input type='text' id='donation_price_<?php 
                echo wpsc_the_product_id();
                ?>
' name='donation_price' value='<?php 
                echo $wpsc_query->product['price'];
                ?>
' size='6' />
				<br />
			
			
			<?php 
            } else {
                ?>
				<?php 
                if (wpsc_product_on_special()) {
                    ?>
					<span class='oldprice'><?php 
                    echo __('Price', 'flexishop');
                    ?>
: <?php 
                    echo wpsc_product_normal_price(get_option('wpsc_hide_decimals'));
                    ?>
</span><br />
				<?php 
                }
                ?>
				<span id="product_price_<?php 
                echo wpsc_the_product_id();
                ?>
" class="pricedisplay <?php 
                if (wpsc_product_on_special()) {
                    echo "sale-price";
                }
                ?>
"><?php 
                if (wpsc_product_on_special()) {
                    echo __("Sale Price: ", 'flexishop');
                }
                echo wpsc_the_product_price(get_option('wpsc_hide_decimals'));
                ?>
</span>					
			<?php 
            }
            ?>
			</div> -->
			<?php 
            if (wpsc_the_product_additional_description()) {
                ?>
			<div class="description">
			<?php 
                $value = '';
                $the_addl_desc = wpsc_the_product_additional_description();
                if (is_serialized($the_addl_desc)) {
                    $addl_descriptions = @unserialize($the_addl_desc);
                } else {
                    $addl_descriptions = array('addl_desc', $the_addl_desc);
                }
                if (isset($addl_descriptions['addl_desc'])) {
                    $value = $addl_descriptions['addl_desc'];
                }
                if (function_exists('wpsc_addl_desc_show')) {
                    echo wpsc_addl_desc_show($addl_descriptions);
                } else {
                    echo stripslashes(wpautop($the_addl_desc, $br = 1));
                }
                ?>
			</div>
			<?php 
            }
            ?>
			<a href="<?php 
            echo wpsc_the_product_permalink();
            ?>
" class="buy-now"><?php 
            _e('Buy Now', 'flexishop');
            ?>
</a>
			</div>
		</li>
		<?php 
        }
    }
}
function wpsc_latest_product($args = null, $instance)
{
    global $wpdb;
    $args = wp_parse_args((array) $args, array('number' => 5));
    $siteurl = get_option('siteurl');
    $options = get_option('wpsc-widget_latest_products');
    $number = isset($instance['number']) ? (int) $instance['number'] : 5;
    $image = isset($instance['image']) ? (bool) $instance['image'] : FALSE;
    if (isset($instance['width'])) {
        $width = $instance['width'];
    }
    if (isset($instance['height'])) {
        $height = $instance['height'];
    }
    $latest_products = get_posts(array('post_type' => 'wpsc-product', 'numberposts' => $number, 'orderby' => 'post_date', 'post_parent' => 0, 'post_status' => 'publish', 'order' => 'DESC'));
    $output = '';
    if (count($latest_products) > 0) {
        $output .= '<ul class="wpsc-latest-products">';
        foreach ($latest_products as $latest_product) {
            $output .= '<li class="wpsc-latest-product">';
            // Thumbnails, if required
            if ($image) {
                $output .= '<div class="item_image">';
                $output .= '<a href="' . wpsc_product_url($latest_product->ID, null) . '">';
                $thumbnail = wpsc_the_product_thumbnail($width, $height, $latest_product->ID, '');
                if ($thumbnail) {
                    $output .= '<img src="' . esc_url($thumbnail) . '" title="' . apply_filters('the_title', $latest_product->post_title) . '" alt="' . apply_filters('the_title', $latest_product->post_title) . '" />';
                } else {
                    $output .= '<img class="no-image" id="product_image_' . wpsc_the_product_id() . '" alt="' . esc_attr__('No Image', 'wpsc') . '" title="' . wpsc_the_product_title() . '" src="' . WPSC_URL . '/wpsc-theme/wpsc-images/noimage.png" width="' . $width . '" height="' . $height . '" />';
                }
                $output .= '</a>';
                $output .= '</div>';
            }
            // Link
            $output .= '<a href="' . esc_url(wpsc_product_url($latest_product->ID, null)) . '" class="wpsc-product-title">' . apply_filters('the_title', $latest_product->post_title) . '</a>';
            $output .= '</li>';
        }
        $output .= "</ul>";
    }
    echo $output;
}
Esempio n. 16
0
/**
 * Product Specials Widget content function
 *
 * Displays the latest products.
 *
 * @todo Remove marketplace theme specific code and maybe replce with a filter for the image output? (not required if themeable as above)
 *
 * Changes made in 3.8 that may affect users:
 *
 * 1. The product title link text does now not have a bold tag, it should be styled via css.
 * 2. <br /> tags have been ommitted. Padding and margins should be applied via css.
 * 3. Each product is enclosed in a <div> with a 'wpec-special-product' class.
 * 4. The product list is enclosed in a <div> with a 'wpec-special-products' class.
 * 5. Function now expect a single paramter with an array of options (used to be a string which prepended the output).
 */
function wpsc_specials($args = null, $instance)
{
    global $wpdb;
    $args = wp_parse_args((array) $args, array('number' => 5));
    $siteurl = get_option('siteurl');
    if (!($number = (int) $instance['number'])) {
        $number = 5;
    }
    $show_thumbnails = isset($instance['show_thumbnails']) ? (bool) $instance['show_thumbnails'] : FALSE;
    $show_description = isset($instance['show_description']) ? (bool) $instance['show_description'] : FALSE;
    $excludes = wpsc_specials_excludes();
    $args = array('post_type' => 'wpsc-product', 'caller_get_posts' => 1, 'post_status' => 'publish', 'post_parent' => 0, 'post__not_in' => $excludes, 'posts_per_page' => $number);
    $special_products = query_posts($args);
    $output = '';
    $product_ids[] = array();
    if (count($special_products) > 0) {
        list($wp_query, $special_products) = array($special_products, $wp_query);
        // swap the wpsc_query object
        while (wpsc_have_products()) {
            wpsc_the_product();
            if (!in_array(wpsc_the_product_id(), $product_ids)) {
                $product_ids[] = wpsc_the_product_id();
                if ($show_thumbnails) {
                    if (wpsc_the_product_thumbnail()) {
                        ?>
						<a rel="<?php 
                        echo str_replace(array(" ", '"', "'", '&quot;', '&#039;'), array("_", "", "", "", ''), wpsc_the_product_title());
                        ?>
" href="<?php 
                        echo wpsc_the_product_permalink();
                        ?>
">
							<img class="product_image" id="product_image_<?php 
                        echo wpsc_the_product_id();
                        ?>
" alt="<?php 
                        echo wpsc_the_product_title();
                        ?>
" title="<?php 
                        echo wpsc_the_product_title();
                        ?>
" src="<?php 
                        echo wpsc_the_product_thumbnail();
                        ?>
"/>
						</a>
				<?php 
                    } else {
                        ?>
							<a href="<?php 
                        echo wpsc_the_product_permalink();
                        ?>
">
							<img class="no-image" id="product_image_<?php 
                        echo wpsc_the_product_id();
                        ?>
" alt="No Image" title="<?php 
                        echo wpsc_the_product_title();
                        ?>
" src="<?php 
                        echo WPSC_URL;
                        ?>
/wpsc-theme/wpsc-images/noimage.png" width="<?php 
                        esc_attr_e(get_option('product_image_width'));
                        ?>
" height="<?php 
                        esc_attr_e(get_option('product_image_height'));
                        ?>
" />
							</a>
				<?php 
                    }
                    ?>
				<?php 
                }
                // close show thumbnails
                ?>
 
				<br />
				<span id="special_product_price_<?php 
                echo wpsc_the_product_id();
                ?>
">
				<!-- price display -->
				<?php 
                echo wpsc_the_product_price();
                ?>
				</span><br />			
				<strong><a class="wpsc_product_title" href="<?php 
                echo wpsc_product_url(wpsc_the_product_id(), false);
                ?>
"><?php 
                echo wpsc_the_product_title();
                ?>
</a></strong><br /> 
				
				<?php 
                if ($show_description) {
                    ?>
					<div class="wpsc-special-description">
						<?php 
                    echo wpsc_the_product_description();
                    ?>
					</div>									
				<?php 
                }
                // close show description
                ?>
 
			
				<?php 
            }
        }
        list($wp_query, $special_products) = array($special_products, $wp_query);
        // swap the wpsc_query object
        wp_reset_query();
    }
}
 public function send_product()
 {
     if (wpsc_is_single_product()) {
         $product = array();
         while (wpsc_have_products()) {
             wpsc_the_product();
             $product_id = (int) wpsc_the_product_id();
             $product['url'] = (string) wpsc_the_product_permalink();
             $product['product_id'] = $product_id;
             $product['name'] = (string) wpsc_the_product_title();
             $product['image_url'] = (string) wpsc_the_product_image('', '', $product_id);
             if (wpsc_product_has_variations($product_id)) {
                 $price = $this->get_lowest_product_variation_price($product_id);
             } else {
                 $price = wpsc_calculate_price($product_id, false, true);
             }
             $product['price'] = $this->format_price($price);
             if (wpsc_product_has_stock($product_id)) {
                 $product['stock'] = 1;
             } else {
                 $product['stock'] = 0;
             }
             $product['categories'] = array();
             $category_terms = wp_get_product_categories($product_id);
             foreach ($category_terms as $category_term) {
                 $category_path = $category_term;
                 if (!empty($category_path)) {
                     $product['category_name'] = $category_term->name;
                     $product['category_id'] = $category_term->term_id;
                 }
             }
             if (wpsc_product_has_variations($product_id)) {
                 $list_price = $this->get_lowest_product_variation_price($product_id);
             } else {
                 $list_price = wpsc_calculate_price($product_id, false, false);
             }
             $product['list_price'] = $this->format_price($list_price);
         }
         if (!empty($product)) {
             $this->render('sendProduct', array('product' => $product));
         }
     }
 }
    <div class="detail_form_content">
    <div class="form_outer">
          <?php 
echo do_shortcode('[contact-form-7 id="236" title="detail product"]');
?>
          </div>
          </div>
</div>
</div>
<!-- form end --> 
    <?php 
$url = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
?>
<form>
<input type="hidden" id="car" value="<?php 
echo wpsc_product_sku(wpsc_the_product_id());
?>
"/>
<input type="hidden" id="pro_url" value="<?php 
echo $url;
?>
"/>
</form>
<script>
$(window).load(function() {	 
document.getElementById('hidden_carid').value = document.getElementById('car').value
document.getElementById('url').value = document.getElementById('pro_url').value
 $("#pro_form").css("display","none");
  $(".hide").css("display","none");
 
});
Esempio n. 19
0
												<img title="Loading" alt="Loading" src="<?php echo WPSC_URL; ?>/images/indicator.gif" class="loadingimage"/>
												<?php echo __('Updating cart...', 'wpsc'); ?>
											</div>
									</div>
								<?php else : ?>
									<p class='soldout'><?php echo __('This product has sold out.', 'wpsc'); ?></p>
								<?php endif ; ?>
							<?php endif ; ?>
							
						</form>
					</td>
				</tr>

				<tr class="list_view_description">
					<td colspan="5">
						<div id="list_description_<?php echo wpsc_the_product_id(); ?>">
							<?php echo wpsc_the_product_description(); ?>
						</div>
					</td>
				</tr>

			<?php endwhile; ?>
			<?php /** end the product loop here */?>
		</table>
		
		
		<?php if(wpsc_product_count() < 1):?>
			<p><?php  echo __('There are no products in this group.', 'wpsc'); ?></p>
		<?php endif ; ?>

	<?php
Esempio n. 20
0
/**
 * Product Specials Widget content function
 *
 * Displays the latest products.
 *
 * Changes made in 3.8 that may affect users:
 *
 * 1. The product title link text does now not have a bold tag, it should be styled via css.
 * 2. <br /> tags have been ommitted. Padding and margins should be applied via css.
 * 3. Each product is enclosed in a <div> with a 'wpec-special-product' class.
 * 4. The product list is enclosed in a <div> with a 'wpec-special-products' class.
 * 5. Function now expect a single paramter with an array of options (used to be a string which prepended the output).
 */
function wpsc_specials($args = null, $instance)
{
    global $wpdb;
    $args = wp_parse_args((array) $args, array('number' => 5));
    if (!($number = (int) $instance['number'])) {
        $number = 5;
    }
    $show_thumbnails = isset($instance['show_thumbnails']) ? (bool) $instance['show_thumbnails'] : false;
    $show_description = isset($instance['show_description']) ? (bool) $instance['show_description'] : false;
    $show_discount = isset($instance['show_discount']) ? (bool) $instance['show_discount'] : false;
    $show_old_price = isset($instance['show_old_price']) ? (bool) $instance['show_old_price'] : false;
    $args = array('post_type' => 'wpsc-product', 'ignore_sticky_posts' => 1, 'post_status' => 'publish', 'post_parent' => 0, 'posts_per_page' => $number, 'no_found_rows' => true);
    add_filter('posts_join', '_wpsc_filter_special_widget_join');
    add_filter('posts_where', '_wpsc_filter_special_widget_where');
    $special_products = new WP_Query($args);
    remove_filter('posts_join', '_wpsc_filter_special_widget_join');
    remove_filter('posts_where', '_wpsc_filter_special_widget_where');
    if (!$special_products->post_count) {
        echo apply_filters('wpsc_specials_widget_no_items_message', __('We currently have no items on special.', 'wp-e-commerce'));
        return;
    }
    $product_ids = array();
    while ($special_products->have_posts()) {
        $special_products->the_post();
        ?>
		<h4><strong><a class="wpsc_product_title" href="<?php 
        echo esc_url(wpsc_product_url(wpsc_the_product_id(), false));
        ?>
"><?php 
        echo esc_html(wpsc_the_product_title());
        ?>
</a></h4></strong>

		<?php 
        if ($show_description) {
            ?>
			<div class="wpsc-special-description">
				<?php 
            echo wpsc_the_product_description();
            ?>
			</div>
		<?php 
        }
        // close show description
        if (!in_array(wpsc_the_product_id(), $product_ids)) {
            $product_ids[] = wpsc_the_product_id();
            $has_children = wpsc_product_has_children(get_the_ID());
            $width = get_option('product_image_width');
            $height = get_option('product_image_height');
            if ($show_thumbnails) {
                if (wpsc_the_product_thumbnail()) {
                    ?>
					<a rel="<?php 
                    echo str_replace(array(" ", '"', "'", '&quot;', '&#039;'), array("_", "", "", "", ''), wpsc_the_product_title());
                    ?>
" href="<?php 
                    echo esc_url(wpsc_the_product_permalink());
                    ?>
"><img class="product_image" id="product_image_<?php 
                    echo esc_attr(wpsc_the_product_id());
                    ?>
" alt="<?php 
                    echo esc_attr(wpsc_the_product_title());
                    ?>
" title="<?php 
                    echo esc_attr(wpsc_the_product_title());
                    ?>
" src="<?php 
                    echo esc_url(wpsc_the_product_thumbnail($width, $height));
                    ?>
"/></a>
				<?php 
                } else {
                    ?>
					<a href="<?php 
                    esc_url(wpsc_the_product_permalink());
                    ?>
"><img class="no-image" id="product_image_<?php 
                    echo esc_attr(wpsc_the_product_id());
                    ?>
" alt="<?php 
                    echo esc_attr(wpsc_the_product_title());
                    ?>
" title="<?php 
                    echo esc_attr(wpsc_the_product_title());
                    ?>
" src="<?php 
                    echo esc_url(WPSC_CORE_THEME_PATH . '/wpsc-images/noimage.png');
                    ?>
" width="<?php 
                    echo esc_attr($width);
                    ?>
" height="<?php 
                    echo esc_attr($height);
                    ?>
" /></a>
				<?php 
                }
                ?>
				<br />
			<?php 
            }
            // close show thumbnails
            ?>
			<div id="special_product_price_<?php 
            echo esc_attr(wpsc_the_product_id());
            ?>
">
				<?php 
            wpsc_the_product_price_display(array('output_old_price' => $show_old_price, 'output_you_save' => $show_discount));
            ?>
			</div><br />
			<?php 
        }
    }
    wp_reset_postdata();
}
<?php

// Setup globals
// @todo: Get these out of template
global $wp_query;
// Setup image width and height variables
// @todo: Investigate if these are still needed here
$image_width = get_option('single_view_image_width');
$image_height = get_option('single_view_image_height');
$product_id = wpsc_the_product_id();
$product_layout = etheme_get_option('product_layout');
$product_brand = etheme_get_option('_etheme_custom_brand');
$crop_image = etheme_get_option('wpsc_crop_images') == 1 ? true : false;
?>

<div id="single_product_page_container">

<?php 
// Breadcrumbs
etheme_wpsc_output_breadcrumbs();
// Plugin hook for adding things to the top of the products page, like the live search
do_action('wpsc_top_of_products_page');
?>
<a class="back-to" href="javascript: history.go(-1)"><?php 
_e('Return to Previous Page', ETHEME_DOMAIN);
?>
</a>

<div class="clear"></div>
<div id="product-page" class="product_layout_<?php 
echo $product_layout;
Esempio n. 22
0
		
						<?php 
    if (wpsc_the_product_additional_description()) {
        ?>
							<div class="single_additional_description">
								<p><?php 
        echo wpsc_the_product_additional_description();
        ?>
</p>
							</div><!--close single_additional_description-->
						<?php 
    }
    ?>
		
						<?php 
    do_action('wpsc_product_addon_after_descr', wpsc_the_product_id());
    ?>
						<?php 
    /**
     * Custom meta HTML and loop
     */
    ?>
                        <?php 
    if (wpsc_have_custom_meta()) {
        ?>
						<div class="custom_meta">
							<?php 
        while (wpsc_have_custom_meta()) {
            wpsc_the_custom_meta();
            ?>
								<strong><?php