Exemplo 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;
    }
}
Exemplo n.º 2
0
 /**
  * Adds product properties to analytics.track() when product is viewed.
  *
  * @since  1.0.0
  * @access public
  *
  * @uses  func_get_args() Because our abstract class doesn't know how many parameters are passed to each hook
  *                        for each different platform, we use func_get_args().
  *
  * @return array Filtered array of name and properties for analytics.track().
  */
 public function viewed_product()
 {
     $args = func_get_args();
     $track = $args[0];
     if (is_singular('wpsc-product')) {
         $track = array('event' => __('Viewed Product', 'segment'), 'properties' => array('id' => get_the_ID(), 'sku' => wpsc_product_sku(), 'name' => wpsc_the_product_title(), 'price' => wpsc_string_to_float(wpsc_the_product_price()), 'category' => implode(', ', wp_list_pluck(wpsc_get_product_terms(get_the_ID(), 'wpsc_product_category'), 'name'))));
     }
     return $track;
 }
Exemplo n.º 3
0
		
		<table class="list_productdisplay <?php echo wpsc_category_class(); ?>">
			<?php /** start the product loop here */?>
			<?php $alt = 0;	?>
			<?php while (wpsc_have_products()) :  wpsc_the_product(); ?>
				<?php
				$alt++;
				if ($alt %2 == 1) { $alt_class = 'alt'; } else { $alt_class = ''; }
				?>
				<tr  class="product_view_<?php echo wpsc_the_product_id(); ?> <?php echo $alt_class;?>">
					<td style="width: 9px;">
					</td>
					
					<td width="55%">
						<a class="wpsc_product_title" href="<?php echo wpsc_the_product_permalink(); ?>">
							<strong><?php echo wpsc_the_product_title(); ?></strong>
						</a>
					</td>
					
					<td width="10" style="text-align: center;">
						<?php if(wpsc_product_has_stock()) : ?>
							<img src="<?php echo WPSC_URL; ?>/images/yes_stock.gif" alt="Yes" title="Yes" style="margin-top: 4px;"/>
						<?php else: ?> 
							<img src="<?php echo WPSC_URL; ?>/images/no_stock.gif" title='No' alt='No' style="margin-top: 4px;"/>
						<?php endif; ?> 
					</td>
					
					<td width="10%">
						<span id="product_price_<?php echo wpsc_the_product_id(); ?>" class="pricedisplay"><?php echo wpsc_the_product_price(); ?></span>
					</td>
					
    ?>
">
			              			<img src="<?php 
    bloginfo('template_url');
    ?>
/images/facebook.svg"/>
			              		</span>
			              		<span>
			              			<a href="https://pinterest.com/pin/create/button/?url=<?php 
    echo urlencode($url);
    ?>
&media=<?php 
    echo urlencode($placeholder);
    ?>
&description=<?php 
    echo urlencode(wpsc_the_product_title());
    ?>
%20by%20T H E U N S E E N" target="_blank">
			              				<img src="<?php 
    bloginfo('template_url');
    ?>
/images/pinterest.svg"/>
			              			</a>
			              		</span>
			              	</div>
			              </div>
			              <div class="shipping_info">
			              	<h4>Shipping details</h4>
			              	<p>For delivery within the UK we charge a flat fee of £7.50 and the delivery will arrive 
							within 3-5 days of receiving your order.</p> 
							<p>For delivery within the EU we charge a flat fee of £10 and the delivery will arrive within 
						<?php if(wpsc_the_product_thumbnail()) :?>
								<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 echo wpsc_the_product_image($image_width, $image_height); ?>" />
								</a>
						<?php else: ?> 
							<div class="item_no_image">
								<a href="<?php echo wpsc_the_product_permalink(); ?>">
								<span>No Image Available</span>
								</a>
							</div>
						<?php endif; ?> 
					</div>
					<?php endif; ?> 
		
					<div class="producttext">
						<h2 class="prodtitles"><span><?php echo wpsc_the_product_title(); ?></span><?php echo wpsc_edit_the_product_link(); ?></h2>
							<?php				
								do_action('wpsc_product_before_description', wpsc_the_product_id(), $wpsc_query->product);
							?>
						<div class="wpsc_description"><?php echo wpsc_the_product_description(); ?></div>
		
						<?php
							do_action('wpsc_product_addons', wpsc_the_product_id());
						?>
						<?php if(wpsc_the_product_additional_description()) : ?>
						<div class="single_additional_description">
            <?php
							$value = '';
							$the_addl_desc = wpsc_the_product_additional_description();
							if( is_serialized($the_addl_desc) ) {
								$addl_descriptions = @unserialize($the_addl_desc);
						<?php else: ?>
							<div class="item_no_image">
								<a href="<?php echo wpsc_the_product_permalink(); ?>">
									<span>No Image Available</span>
								</a>
							</div>
						<?php endif; ?>
					</div>
				<?php endif; ?>
			
				<div class="producttext">
					<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 endif; ?> 				

						<?php echo wpsc_edit_the_product_link(); ?>
					</h2>
						<?php							
							do_action('wpsc_product_before_description', wpsc_the_product_id(), $wpsc_query->product);
							do_action('wpsc_product_addons', wpsc_the_product_id());
						?>
						
					
					
					<div class='wpsc_description'><?php echo wpsc_the_product_description(); ?></div>
					
					
					<?php if(wpsc_the_product_additional_description()) : ?>
Exemplo n.º 7
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();
}
Exemplo n.º 8
0
    function wpsc_gold_shpcrt_ajax($id)
    {
        global $wpdb;
        if (isset($_POST) && !empty($_POST)) {
            if (isset($_POST['wpsc_live_search']) && $_POST['wpsc_live_search'] == true && (get_option('show_live_search') == 1 || true == $_POST['wpsc_search_widget']) && !empty($_POST['product_search'])) {
                $keyword = $_POST['product_search'];
                $output = "<ul>";
                if (version_compare(WPSC_VERSION, '3.8', '<')) {
                    $search_sql = gold_shpcrt_search_sql($keyword);
                    $product_list = $wpdb->get_results("SELECT DISTINCT `" . WPSC_TABLE_PRODUCT_LIST . "`.* FROM `" . WPSC_TABLE_PRODUCT_LIST . "` WHERE `" . WPSC_TABLE_PRODUCT_LIST . "`.`active`='1' {$search_sql} ORDER BY `" . WPSC_TABLE_PRODUCT_LIST . "`.`name` ASC", ARRAY_A);
                    if ($product_list != null) {
                        foreach ($product_list as $product) {
                            //filter out the HTML, otherwise we get partial tags and everything breaks
                            $product['description'] = wp_kses($product['description'], false);
                            // shorten the description;
                            if (strlen($product['description']) > 68) {
                                $product_description = substr($product['description'], 0, 68) . "...";
                            } else {
                                $product_description = $product['description'];
                            }
                            //generate the HTML
                            $output .= "<li>\n\r";
                            $output .= "\t<a href='" . wpsc_product_url($product['id']) . "'>\n\r";
                            if ($product['image'] != '') {
                                $output .= "\t\t\t\t<img class='live-search-image' src='index.php?productid=" . $product['id'] . "&amp;width=50&amp;height=50'>\n\r";
                            } else {
                                $output .= "\t\t\t\t<img class='live-search-image' src='" . get_option('siteurl') . "/wp-content/plugins/" . WPSC_DIR_NAME . "/no-image-uploaded.gif' style='height: 50px; width: 50px;'>\n\r";
                            }
                            $output .= "\t\t\t\t<div class='live-search-text'>\n\r";
                            $output .= "\t\t\t\t\t<strong>" . $product['name'] . "</strong>\n\r";
                            $output .= "\t\t\t\t\t<div class='description'>" . stripslashes($product_description) . "</div>\n\r";
                            $output .= "\t\t\t\t</div>\n\r";
                            $output .= "\t\t    <br clear='both' />\n\r";
                            $output .= "\t\t</a>\n\r";
                            $output .= "</li>\n\r";
                        }
                    }
                } else {
                    wpsc_gc_start_search_query();
                    echo '<ul>';
                    while (wpsc_have_products()) {
                        wpsc_the_product();
                        ?>
					<li>
						<a style="clear:both;" href="<?php 
                        echo wpsc_the_product_permalink();
                        ?>
">
							<?php 
                        if (wpsc_the_product_thumbnail()) {
                            ?>
								<img class="live-search-image" alt="<?php 
                            echo wpsc_the_product_title();
                            ?>
" src="<?php 
                            echo wpsc_the_product_thumbnail(50, 50, 0, 'live-search');
                            ?>
" />
							<?php 
                        } else {
                            ?>
								<img class="live-search-image" alt="No Image" title="<?php 
                            echo wpsc_the_product_title();
                            ?>
" src="<?php 
                            echo WPSC_CORE_THEME_URL;
                            ?>
wpsc-images/noimage.png" style="width:50px; height:50px;" />
							<?php 
                        }
                        ?>
							<div class="live-search-text">
								<strong><?php 
                        echo wpsc_the_product_title();
                        ?>
</strong>
								<div class="description">
									<?php 
                        echo wpsc_the_product_description();
                        ?>
								</div>
							</div>
						</a>
					</li>	
					<?php 
                    }
                    echo '</ul>';
                    exit;
                }
                $output .= "</ul>";
                if (!empty($product_list)) {
                    $_SESSION['live_search_results'] = $product_list;
                }
                exit($output);
            }
        }
        if (isset($_POST['affiliate']) && $_POST['affiliate'] == true) {
            if (!function_exists('affiliate_text')) {
                function affiliate_text($id, $user)
                {
                    $output = "<a target='_blank' title='Your Shopping Cart' href='" . get_option('siteurl') . "/?action=affiliate&p={$id}&user_id=" . $user . "&height=400&width=600' class='thickbox'><img src='" . WPSC_URL . "/" . $images_dir . "/buynow.jpg'></a>";
                    return $output;
                }
            }
            $id = $_POST['prodid'];
            $product = $wpdb->get_row("SELECT * FROM `" . WPSC_TABLE_PRODUCT_LIST . "` WHERE id='{$id}' LIMIT 1", ARRAY_A);
            $product = $product[0];
            $link = affiliate_text($id, $_POST['uid']);
            echo "<textarea class='affiliate_text' onclick='this.select();' >{$link}</textarea>";
            exit;
        }
        if (isset($_POST['log_affiliate']) && $_POST['log_affiliate'] == true) {
            $uid = $_POST['uid'];
            $amount = $_POST['amount'];
            $product = $wpdb->query("UPDATE {$wpdb->prefix}wpsc_affiliates SET paid=paid+{$amount}  WHERE user_id='{$uid}'");
            echo "uid=" . $uid;
            exit;
        }
    }
Exemplo n.º 9
0
 public function my_wp_ecommerce_share_links()
 {
     $perma = wpsc_the_product_permalink();
     $title = wpsc_the_product_title();
     // $postid = get_the_ID();
     $args = array('heading' => "0", 'direction' => 'row', 'page_title' => $title, 'page_link' => $perma, 'echo' => '0');
     $adminSettings = array('size', 'spacing', 'share', 'list_style', 'email_body_text', 'share_text', 'css_images');
     foreach ($adminSettings as $item) {
         $args[$item] = $this->_options[$item];
     }
     foreach ($this->_allSites as $item => $siteValue) {
         if ($item == 'rss') {
         } else {
             if (strstr($siteValue['service'], "share")) {
                 $shareIcons[] = $item;
             }
         }
     }
     $shareIcons[] = 'post_rss';
     foreach ($shareIcons as $item) {
         $args[$item] = $this->_options[$item];
         $args[$item . '_share_text'] = $this->_options[$item . '_share_text'];
         $args[$item . '_popup_text'] = $this->_options[$item . '_popup_text'];
     }
     foreach ($adminSettings as $item) {
         $args[$item] = $this->_options[$item];
     }
     $this->social_links($args);
 }
Exemplo n.º 10
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();
    }
}
Exemplo n.º 11
0
function promotion_meta()
{
    global $post;
    global $wpsc_query, $wpdb;
    $custom = get_post_custom($post->ID);
    $link = $custom["link"][0];
    $saving = $custom["saving"][0];
    $start_date = $custom["start_date"][0];
    $end_date = $custom["end_date"][0];
    $link_type = $custom["link_type"][0];
    $promotion_link = $custom["promotion_link"][0];
    $promotion_link_category = $custom["promotion_link_category"][0];
    $category_data = $wpdb->get_results("SELECT  `id`, `name`, `nice-name`, `description`, `image` FROM `" . WPSC_TABLE_PRODUCT_CATEGORIES, ARRAY_A);
    $prettyPhoto = $custom["pretty_photo"][0];
    $link_type_options = array('Product' => array('value' => 'product', 'label' => __('Link To Product', 'flexishop')), 'Category' => array('value' => 'category', 'label' => __('Link To Category', 'flexishop')), 'External' => array('value' => 'external', 'label' => __('External Link', 'flexishop')));
    $lightbox_options = array('Enable' => array('value' => 'yes', 'label' => __('Enable Lightbox', 'flexishop')), 'Disable' => array('value' => 'no', 'label' => __('Disable Lightbox', 'flexishop')));
    ?>
<div class="input radio">
<?php 
    if (!isset($checked)) {
        $checked = '';
    }
    foreach ($link_type_options as $option) {
        if ('' != $link_type) {
            if ($link_type == $option['value']) {
                $checked = "checked=\"checked\"";
            } else {
                $checked = '';
            }
        }
        ?>
	<label class="description"><input type="radio" name="link_type" value="<?php 
        esc_attr_e($option['value']);
        ?>
" <?php 
        echo $checked;
        ?>
 class="con-check" /> <?php 
        echo $option['label'];
        ?>
</label>
	<?php 
    }
    ?>
</div>
<div id="external" class="input text hidden-field">
	<label>Links To External:</label>
	<input cols="50" name="link" value="<?php 
    echo $link;
    ?>
" />
	<div class="input radio">
	<?php 
    if (!isset($checked)) {
        $checked = '';
    }
    foreach ($lightbox_options as $option) {
        if ('' != $prettyPhoto) {
            if ($prettyPhoto == $option['value']) {
                $checked = "checked=\"checked\"";
            } else {
                $checked = '';
            }
        }
        ?>
		<label class="description"><input type="radio" name="pretty_photo" value="<?php 
        esc_attr_e($option['value']);
        ?>
" <?php 
        echo $checked;
        ?>
 /> <?php 
        echo $option['label'];
        ?>
</label>
		<?php 
    }
    ?>
	</div>
</div>
<div id="product" class="input select hidden-field">
	<label><?php 
    _e('Links To Product:', 'flexishop');
    ?>
</label>
	<select name="promotion_link">
		<?php 
    $wpsc_query = new WPSC_Query();
    while (wpsc_have_products()) {
        wpsc_the_product();
        ?>
			<?php 
        $currentlink = str_replace("&amp;", "&", wpsc_the_product_permalink());
        ?>
			<option value="<?php 
        echo wpsc_the_product_permalink();
        ?>
" <?php 
        if ($promotion_link == $currentlink) {
            echo "selected = 'selected'";
        }
        ?>
><?php 
        echo wpsc_the_product_title();
        ?>
</option>
		<?php 
    }
    ?>
	</select>
</div>
<div id="category" class="input select hidden-field">
	<label><?php 
    _e('Links To Category:', 'flexishop');
    ?>
</label>
	<select name="promotion_link_category">
	<?php 
    foreach ($category_data as $category_row) {
        $name = $category_row['name'];
        $url = str_replace("&amp;", "&", wpsc_category_url($category_row['id']));
        ?>
	<option value="<?php 
        echo $url;
        ?>
" <?php 
        if ($promotion_link_category == $url) {
            echo "selected = 'selected'";
        }
        ?>
><?php 
        echo $name;
        ?>
</option>
	<?php 
    }
    ?>
	</select>
</div>
<div class="input text">
	<label><?php 
    _e('Savings:', 'flexishop');
    ?>
</label>
	<input cols="50" name="saving" value="<?php 
    echo $saving;
    ?>
" />
</div>
<div class="input text">
	<label><?php 
    _e('Start Date:', 'flexishop');
    ?>
</label>
	<input name="start_date" value="<?php 
    echo $start_date;
    ?>
" class="date-input" />
</div>
<div class="input text">
	<label><?php 
    _e('End Date:', 'flexishop');
    ?>
</label>
	<input name="end_date" value="<?php 
    echo $end_date;
    ?>
" class="date-input" />
</div>
<?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;
}
Exemplo 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 
                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();
    }
}
Exemplo n.º 14
0
 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));
         }
     }
 }
Exemplo n.º 15
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;
}
Exemplo n.º 16
0
								<span>No Image Available</span>
								</a>
							</div>
						<?php 
        }
        ?>
 
					</div>
				<?php 
    }
    ?>
 
		
					<div class="producttext">
						<h2 class="prodtitles"><span><?php 
    echo wpsc_the_product_title();
    ?>
</span><?php 
    echo wpsc_edit_the_product_link();
    ?>
</h2>
							<?php 
    do_action('wpsc_product_before_description', wpsc_the_product_id(), $wpsc_query->product);
    ?>
						
						
						<div class="wpsc_description"><?php 
    echo wpsc_the_product_description();
    ?>
</div>
		
Exemplo n.º 17
0
    function jbst_wpec_image_gallery()
    {
        $tabs = 0;
        if (wpsc_is_single_product()) {
            global $wp_query;
            global $post;
            $id = $post->ID;
            $tabs = 0;
            $featured_image = get_post_thumbnail_id($id);
            $args = array('post_type' => 'attachment', 'orderby' => 'menu_order', 'order' => 'ASC', 'post_mime_type' => 'image', 'post_status' => null, 'post_parent' => $post->ID, 'exclude' => $featured_image, 'numberposts' => -1);
            $attachments = get_posts($args);
            ?>
		<ul id="myTab" class="nav nav-tabs">
              <?php 
            if ($attachments) {
                ?>
              <li class="active"><a href="#addimages" data-toggle="tab"><?php 
                _e('Additional Images', 'jamedo-bootstrap-start-theme');
                ?>
</a></li>
              <?php 
            }
            ?>
              <?php 
            if (wpsc_the_product_additional_description()) {
                ?>
              	<li class="<?php 
                if (!$attachments) {
                    echo 'active';
                }
                ?>
"><a href="#proddesc" data-toggle="tab"><?php 
                _e('Additional Description', 'jamedo-bootstrap-start-theme');
                ?>
</a></li>
              <?php 
            }
            ?>
              <?php 
            do_action('jbst_wpec_prod_add_tabs');
            ?>
        </ul>
		<div id="myTabContent" class="tab-content">
              
                
                <?php 
            if ($attachments) {
                $tabs = 1;
                echo '<div class="tab-pane fade active in" id="addimages">';
                echo '<div class="jbst-wpec-product-add-images"><h3>';
                //_e( 'Additional Images', 'jamedo-bootstrap-start-theme' );
                echo '</h3>';
                $thumbwidth = 125;
                $thumbheight = 125;
                foreach ($attachments as $attachment) {
                    $thumbnail = wp_get_attachment_url($attachment->ID, false);
                    $image = jbst_resize($attachment->ID, '', $thumbwidth, $thumbheight, true);
                    ?>
		     	      <a rel="<?php 
                    echo wpsc_the_product_title();
                    ?>
" class="preview_link thumbnail" href="<?php 
                    echo wp_get_attachment_url($attachment->ID, false);
                    ?>
"><img src="<?php 
                    echo $image['url'];
                    ?>
" alt="<?php 
                    the_title();
                    ?>
" width="<?php 
                    echo $thumbwidth;
                    ?>
" height="<?php 
                    echo $thumbwidth;
                    ?>
" border="0" /></a>
			<?php 
                }
                echo "<div class='clear'></div></div>";
                ?>
                
              </div>
		<?php 
            }
            ?>
			              <?php 
            if (wpsc_the_product_additional_description()) {
                $tabs = 1;
                ?>
	              <div class="tab-pane fade<?php 
                if (!$attachments) {
                    echo ' active in';
                }
                ?>
" id="proddesc">
	                <?php 
                echo wpsc_the_product_additional_description();
                ?>
	              </div>
              <?php 
            }
            ?>
              <?php 
            do_action('jbst_wpec_prod_add_tab_containers');
            ?>
            </div><?php 
        }
        if ($tabs == 0) {
            echo '<style>ul#myTab {display:none;}</style>';
        }
    }
Exemplo n.º 18
0
    function sfpaper_product_image_gallery()
    {
        if (wpsc_is_single_product()) {
            global $wp_query;
            global $post;
            $id = $post->ID;
            if (has_post_thumbnail()) {
                $featured_image = get_post_thumbnail_id($id);
            }
            $args = array('post_type' => 'attachment', 'orderby' => 'menu_order', 'order' => 'ASC', 'post_mime_type' => 'image', 'post_status' => null, 'post_parent' => $post->ID, 'exclude' => $featured_image, 'numberposts' => -1);
            $attachments = get_posts($args);
            if ($attachments) {
                $tabs = 1;
                echo '<div class="storefront-wpec-product-add-images">';
                //echo '<h3>';
                //_e( 'Additional Images', 'storefront' );
                //echo '</h3>';
                $thumbwidth = 125;
                $thumbheight = 125;
                foreach ($attachments as $attachment) {
                    $thumbnail = wp_get_attachment_url($attachment->ID, false);
                    $image = sfpaper_resize($attachment->ID, '', $thumbwidth, $thumbheight, true);
                    ?>
		     	      <a rel="<?php 
                    echo wpsc_the_product_title();
                    ?>
" class="preview_link thumbnail" href="<?php 
                    echo wp_get_attachment_url($attachment->ID, false);
                    ?>
"><img class="product_image" src="<?php 
                    echo $image['url'];
                    ?>
" alt="<?php 
                    the_title();
                    ?>
" width="<?php 
                    echo $thumbwidth;
                    ?>
" height="<?php 
                    echo $thumbwidth;
                    ?>
" border="0" /></a>
			<?php 
                }
                echo "<div class='clear'></div></div>";
            }
        }
    }