/** @see WP_Widget::widget */ function widget($args, $instance) { $cache = wp_cache_get('widget_recent_products', 'widget'); if ( !is_array($cache) ) $cache = array(); if ( isset($cache[$args['widget_id']]) ) { echo $cache[$args['widget_id']]; return; } ob_start(); extract($args); $title = apply_filters('widget_title', empty($instance['title']) ? __('New Products', 'jigoshop') : $instance['title'], $instance, $this->id_base); if ( !$number = (int) $instance['number'] ) $number = 10; else if ( $number < 1 ) $number = 1; else if ( $number > 15 ) $number = 15; $show_variations = $instance['show_variations'] ? '1' : '0'; $args = array('showposts' => $number, 'nopaging' => 0, 'post_status' => 'publish', 'post_type' => 'product'); if($show_variations=='0'){ $args['meta_query'] = array( array( 'key' => 'visibility', 'value' => array('catalog', 'visible'), 'compare' => 'IN' ) ); $args['parent'] = '0'; } $r = new WP_Query($args); if ($r->have_posts()) : ?> <?php echo $before_widget; ?> <?php if ( $title ) echo $before_title . $title . $after_title; ?> <ul class="product_list_widget"> <?php while ($r->have_posts()) : $r->the_post(); $_product = &new jigoshop_product(get_the_ID()); ?> <li><a href="<?php the_permalink() ?>" title="<?php echo esc_attr(get_the_title() ? get_the_title() : get_the_ID()); ?>"> <?php if (has_post_thumbnail()) the_post_thumbnail('shop_tiny'); else echo '<img src="'.jigoshop::plugin_url().'/assets/images/placeholder.png" alt="Placeholder" width="'.jigoshop::get_var('shop_tiny_w').'px" height="'.jigoshop::get_var('shop_tiny_h').'px" />'; ?> <?php if ( get_the_title() ) the_title(); else the_ID(); ?> </a> <?php echo $_product->get_price_html(); ?></li> <?php endwhile; ?> </ul> <?php echo $after_widget; ?> <?php // Reset the global $the_post as this query will have stomped on it //wp_reset_postdata(); endif; if (isset($args['widget_id']) && isset($cache[$args['widget_id']])) $cache[$args['widget_id']] = ob_get_flush(); wp_cache_set('widget_recent_products', $cache, 'widget'); }
/** @see WP_Widget::widget */ function widget($args, $instance) { if (is_cart()) { return; } extract($args); if (!empty($instance['title'])) { $title = $instance['title']; } else { $title = __('Cart', 'jigoshop'); } $title = apply_filters('widget_title', $title, $instance, $this->id_base); echo $before_widget; if ($title) { echo $before_title . $title . $after_title; } echo '<ul class="cart_list">'; if (sizeof(jigoshop_cart::$cart_contents) > 0) { foreach (jigoshop_cart::$cart_contents as $item_id => $values) { $_product = $values['data']; if ($_product->exists() && $values['quantity'] > 0) { echo '<li><a href="' . get_permalink($item_id) . '">'; if (has_post_thumbnail($item_id)) { echo get_the_post_thumbnail($item_id, 'shop_tiny'); } else { echo '<img src="' . jigoshop::plugin_url() . '/assets/images/placeholder.png" alt="Placeholder" width="' . jigoshop::get_var('shop_tiny_w') . '" height="' . jigoshop::get_var('shop_tiny_h') . '" />'; } echo apply_filters('jigoshop_cart_widget_product_title', $_product->get_title(), $_product) . '</a> ' . $values['quantity'] . ' × ' . jigoshop_price($_product->get_price()) . '</li>'; } } } else { echo '<li class="empty">' . __('No products in the cart.', 'jigoshop') . '</li>'; } echo '</ul>'; if (sizeof(jigoshop_cart::$cart_contents) > 0) { echo '<p class="total"><strong>'; if (get_option('js_prices_include_tax') == 'yes') { _e('Total', 'jigoshop'); } else { _e('Subtotal', 'jigoshop'); } echo ':</strong> ' . jigoshop_cart::get_cart_total(); echo '</p>'; do_action('jigoshop_widget_shopping_cart_before_buttons'); echo '<p class="buttons"><a href="' . jigoshop_cart::get_cart_url() . '" class="button">' . __('View Cart →', 'jigoshop') . '</a> <a href="' . jigoshop_cart::get_checkout_url() . '" class="button checkout">' . __('Checkout →', 'jigoshop') . '</a></p>'; } echo $after_widget; }
/** @see WP_Widget::widget */ function widget($args, $instance) { $cache = wp_cache_get('widget_featured_products', 'widget'); if ( !is_array($cache) ) $cache = array(); if ( isset($cache[$args['widget_id']]) ) { echo $cache[$args['widget_id']]; return; } ob_start(); extract($args); $title = apply_filters('widget_title', empty($instance['title']) ? __('Featured Products', 'jigoshop') : $instance['title'], $instance, $this->id_base); if ( !$number = (int) $instance['number'] ) $number = 10; else if ( $number < 1 ) $number = 1; else if ( $number > 15 ) $number = 15; $featured_posts = get_posts(array('numberposts' => $number, 'post_status' => 'publish', 'post_type' => 'product', 'meta_key' => 'featured', 'meta_value' => 'yes' )); if ($featured_posts) : ?> <?php echo $before_widget; ?> <?php if ( $title ) echo $before_title . $title . $after_title; ?> <ul class="product_list_widget"> <?php foreach ($featured_posts as $r) : $_product = &new jigoshop_product( $r->ID ); ?> <li><a href="<?php echo get_permalink( $r->ID ) ?>" title="<?php echo esc_attr($r->post_title ? $r->post_title : $r->ID); ?>"> <?php if (has_post_thumbnail( $r->ID )) echo get_the_post_thumbnail($r->ID, 'shop_tiny'); else echo '<img src="'.jigoshop::plugin_url().'/assets/images/placeholder.png" alt="Placeholder" width="'.jigoshop::get_var('shop_tiny_w').'px" height="'.jigoshop::get_var('shop_tiny_h').'px" />'; ?> <?php if ( $r->post_title ) echo $r->post_title; else echo $r->ID; ?> </a> <?php echo $_product->get_price_html(); ?></li> <?php endforeach; ?> </ul> <?php echo $after_widget; ?> <?php endif; $cache[$args['widget_id']] = ob_get_flush(); wp_cache_set('widget_featured_products', $cache, 'widget'); }
public function __construct() { $this->id = 'skrill'; $this->title = 'Skrill'; $this->icon = jigoshop::plugin_url() . '/assets/images/icons/skrill.png'; $this->has_fields = false; $this->enabled = get_option('jigoshop_skrill_enabled'); $this->title = get_option('jigoshop_skrill_title'); $this->email = get_option('jigoshop_skrill_email'); add_action( 'init', array(&$this, 'check_status_response') ); if(isset($_GET['skrillPayment']) && $_GET['skrillPayment'] == true): add_action( 'init', array(&$this, 'generate_skrill_form') ); endif; add_action('valid-skrill-status-report', array(&$this, 'successful_request') ); add_action('jigoshop_update_options', array(&$this, 'process_admin_options')); add_option('jigoshop_skrill_enabled', 'yes'); add_option('jigoshop_skrill_email', ''); add_option('jigoshop_skrill_title', 'skrill'); add_action('receipt_skrill', array(&$this, 'receipt_skrill')); }
clearTimeout(updateTimer); update_checkout(); }).change(); jQuery('input#billing-country, input#billing-state, #billing-postcode, input#shipping-country, input#shipping-state, #shipping-postcode').live('keydown', function(){ clearTimeout(updateTimer); updateTimer = setTimeout("update_checkout()", '1000'); }); jQuery('select#billing-country, select#billing-state, select#shipping-country, select#shipping-state, #shiptobilling input').live('change', function(){ clearTimeout(updateTimer); update_checkout(); }); /* AJAX Form Submission */ jQuery('form.checkout').submit(function(){ var form = this; jQuery(form).block({ message: null, overlayCSS: { background: '#fff url(<?php echo jigoshop::plugin_url(); ?>/assets/images/ajax-loader.gif) no-repeat center', opacity: 0.6 } }); jQuery.ajax({ type: 'POST', url: '<?php echo admin_url('admin-ajax.php?action=jigoshop-checkout') ?>', data: jQuery(form).serialize(), success: function( code ) { jQuery('.jigoshop_error, .jigoshop_message').remove(); try { success = jQuery.parseJSON( code ); window.location = decodeURI(success.redirect); } catch(err) { jQuery(form).prepend( code ); jQuery(form).unblock(); jQuery.scrollTo(jQuery(form).parent(), { easing:'swing' }); }
/** * Generate the paypal button link **/ public function generate_paypal_form( $order_id ) { $order = &new jigoshop_order( $order_id ); if ( $this->testmode == 'yes' ): $paypal_adr = $this->testurl . '?test_ipn=1&'; else : $paypal_adr = $this->liveurl . '?'; endif; $shipping_name = explode(' ', $order->shipping_method); if (in_array($order->billing_country, array('US','CA'))) : $phone_args = array( 'night_phone_a' => substr($order->billing_phone,0,3), 'night_phone_b' => substr($order->billing_phone,0,3), 'night_phone_c' => substr($order->billing_phone,0,3), 'day_phone_a' => substr($order->billing_phone,0,3), 'day_phone_b' => substr($order->billing_phone,0,3), 'day_phone_c' => substr($order->billing_phone,0,3) ); else : $phone_args = array( 'night_phone_b' => $order->billing_phone, 'day_phone_b' => $order->billing_phone ); endif; $paypal_args = array_merge( array( 'cmd' => '_cart', 'business' => $this->email, 'no_note' => 1, 'currency_code' => get_option('jigoshop_currency'), 'charset' => 'UTF-8', 'rm' => 2, 'upload' => 1, 'return' => add_query_arg('key', $order->order_key, add_query_arg('order', $order_id, get_permalink(get_option('jigoshop_thanks_page_id')))), 'cancel_return' => $order->get_cancel_order_url(), //'cancel_return' => home_url(), // Order key 'custom' => $order_id, // IPN 'notify_url' => trailingslashit(get_bloginfo('wpurl')).'?paypalListener=paypal_standard_IPN', // Address info 'first_name' => $order->billing_first_name, 'last_name' => $order->billing_last_name, 'company' => $order->billing_company, 'address1' => $order->billing_address_1, 'address2' => $order->billing_address_2, 'city' => $order->billing_city, 'state' => $order->billing_state, 'zip' => $order->billing_postcode, 'country' => $order->billing_country, 'email' => $order->billing_email, // Payment Info 'invoice' => $order->order_key, 'tax' => $order->get_total_tax(), 'tax_cart' => $order->get_total_tax(), 'amount' => $order->order_total, 'discount_amount_cart' => $order->order_discount ), $phone_args ); if ($this->send_shipping=='yes') : $paypal_args['no_shipping'] = 0; $paypal_args['address_override'] = 1; else : $paypal_args['no_shipping'] = 1; endif; // Cart Contents $item_loop = 0; if (sizeof($order->items)>0) : foreach ($order->items as $item) : $_product = &new jigoshop_product($item['id']); if ($_product->exists() && $item['qty']) : $item_loop++; $paypal_args['item_name_'.$item_loop] = $_product->get_title(); $paypal_args['quantity_'.$item_loop] = $item['qty']; $paypal_args['amount_'.$item_loop] = $_product->get_price_excluding_tax(); endif; endforeach; endif; // Shipping Cost $item_loop++; $paypal_args['item_name_'.$item_loop] = __('Shipping cost', 'jigoshop'); $paypal_args['quantity_'.$item_loop] = '1'; $paypal_args['amount_'.$item_loop] = number_format($order->order_shipping, 2); $paypal_args_array = array(); foreach ($paypal_args as $key => $value) { $paypal_args_array[] = '<input type="hidden" name="'.$key.'" value="'.$value.'" />'; } return '<form action="'.$paypal_adr.'" method="post" id="paypal_payment_form"> ' . implode('', $paypal_args_array) . ' <input type="submit" class="button-alt" id="submit_paypal_payment_form" value="'.__('Pay via PayPal', 'jigoshop').'" /> <a class="button cancel" href="'.$order->get_cancel_order_url().'">'.__('Cancel order & restore cart', 'jigoshop').'</a> <script type="text/javascript"> jQuery(function(){ jQuery("body").block( { message: "<img src=\"'.jigoshop::plugin_url().'/assets/images/ajax-loader.gif\" alt=\"Redirecting...\" />'.__('Thank you for your order. We are now redirecting you to PayPal to make payment.', 'jigoshop').'", overlayCSS: { background: "#fff", opacity: 0.6 }, css: { padding: 20, textAlign: "center", color: "#555", border: "3px solid #aaa", backgroundColor:"#fff", cursor: "wait" } }); jQuery("#submit_paypal_payment_form").click(); }); </script> </form>'; }
function jigoshop_get_product_thumbnail($size = 'shop_small', $placeholder_width = 0, $placeholder_height = 0) { global $post; if (!$placeholder_width) { $placeholder_width = jigoshop::get_var('shop_small_w'); } if (!$placeholder_height) { $placeholder_height = jigoshop::get_var('shop_small_h'); } if (has_post_thumbnail()) { $thumb = get_the_post_thumbnail($post->ID, $size); } else { $thumb = ''; } if (empty($thumb)) { $thumb = '<img src="' . jigoshop::plugin_url() . '/assets/images/placeholder.png" alt="Placeholder" width="' . $placeholder_width . '" height="' . $placeholder_height . '" />'; } return $thumb; }
function jigoshop_get_template_file_url($template_name, $ssl = false) { if (file_exists( STYLESHEETPATH . '/' . JIGOSHOP_TEMPLATE_URL . $template_name )) $return = get_bloginfo('template_url') . '/' . JIGOSHOP_TEMPLATE_URL . $template_name; elseif (file_exists( STYLESHEETPATH . '/' . $template_name )) $return = get_bloginfo('template_url') . '/' . $template_name; else $return = jigoshop::plugin_url() . '/templates/' . $template_name; if (get_option('jigoshop_force_ssl_checkout')=='yes' || is_ssl()) : if ($ssl) $return = str_replace('http:', 'https:', $return); endif; return $return; }
/** * Enqueue scripts * * Enqueue JavaScript used by the meta panels. * * @since 1.0 */ function jigoshop_write_panel_scripts() { $post_type = jigoshop_get_current_post_type(); if( $post_type !== 'product' && $post_type !== 'shop_order' ) return; wp_register_script('jigoshop-date', jigoshop::plugin_url() . '/assets/js/date.js'); wp_register_script('jigoshop-datepicker', jigoshop::plugin_url() . '/assets/js/datepicker.js', array('jquery', 'jigoshop-date')); wp_enqueue_script('jigoshop-datepicker'); wp_register_script('jigoshop-writepanel', jigoshop::plugin_url() . '/assets/js/write-panels.js', array('jquery')); wp_enqueue_script('jigoshop-writepanel'); wp_register_script( 'medialibrary-uploader', jigoshop::plugin_url() . '/assets/js/medialibrary-uploader.js', array( 'jquery', 'thickbox' ) ); wp_enqueue_script( 'medialibrary-uploader' ); wp_enqueue_script( 'media-upload' ); $data = array( 'remove_item_notice' => __("Remove this item? If you have previously reduced this item's stock, or this order was submitted by a customer, will need to manually restore the item's stock.", 'jigoshop'), 'cart_total' => __("Calc totals based on order items, discount amount, and shipping?", 'jigoshop'), 'copy_billing' => __("Copy billing information to shipping information? This will remove any currently entered shipping information.", 'jigoshop'), 'prices_include_tax' => get_option('jigoshop_prices_include_tax'), 'ID' => __('ID', 'jigoshop'), 'item_name' => __('Item Name', 'jigoshop'), 'quantity' => __('Quantity e.g. 2', 'jigoshop'), 'cost_unit' => __('Cost per unit e.g. 2.99', 'jigoshop'), 'tax_rate' => __('Tax Rate e.g. 20.0000', 'jigoshop'), ); wp_localize_script( 'jigoshop-writepanel', 'jigoshop_wp', $data ); }
/** * Function for showing the dashboard * * The dashboard shows widget for things such as: * - Products * - Sales * - Recent reviews * * @since 1.0 * @usedby jigoshop_admin_menu() */ function jigoshop_dashboard() { ?> <div class="wrap jigoshop"> <div class="icon32 jigoshop_icon"><br/></div> <h2><?php _e('Jigoshop Dashboard','jigoshop'); ?></h2> <div id="jigoshop_dashboard"> <div id="dashboard-widgets" class="metabox-holder"> <div class="postbox-container" style="width:49%;"> <div id="jigoshop_right_now" class="jigoshop_right_now postbox"> <h3><?php _e('Right Now', 'jigoshop') ?></h3> <div class="inside"> <div class="table table_content"> <p class="sub"><?php _e('Shop Content', 'jigoshop'); ?></p> <table> <tbody> <tr class="first"> <td class="first b"><a href="edit.php?post_type=product"><?php $num_posts = wp_count_posts( 'product' ); $num = number_format_i18n( $num_posts->publish ); echo $num; ?></a></td> <td class="t"><a href="edit.php?post_type=product"><?php _e('Products', 'jigoshop'); ?></a></td> </tr> <tr> <td class="first b"><a href="edit-tags.php?taxonomy=product_cat&post_type=product"><?php echo wp_count_terms('product_cat'); ?></a></td> <td class="t"><a href="edit-tags.php?taxonomy=product_cat&post_type=product"><?php _e('Product Categories', 'jigoshop'); ?></a></td> </tr> <tr> <td class="first b"><a href="edit-tags.php?taxonomy=product_tag&post_type=product"><?php echo wp_count_terms('product_tag'); ?></a></td> <td class="t"><a href="edit-tags.php?taxonomy=product_tag&post_type=product"><?php _e('Product Tag', 'jigoshop'); ?></a></td> </tr> <tr> <td class="first b"><a href="admin.php?page=attributes"><?php echo sizeof(jigoshop::$attribute_taxonomies); ?></a></td> <td class="t"><a href="admin.php?page=attributes"><?php _e('Attribute taxonomies', 'jigoshop'); ?></a></td> </tr> </tbody> </table> </div> <div class="table table_discussion"> <p class="sub"><?php _e('Orders', 'jigoshop'); ?></p> <table> <tbody> <?php $jigoshop_orders = &new jigoshop_orders(); ?> <tr class="first"> <td class="b"><a href="edit.php?post_type=shop_order&shop_order_status=pending"><span class="total-count"><?php echo $jigoshop_orders->pending_count; ?></span></a></td> <td class="last t"><a class="pending" href="edit.php?post_type=shop_order&shop_order_status=pending"><?php _e('Pending', 'jigoshop'); ?></a></td> </tr> <tr> <td class="b"><a href="edit.php?post_type=shop_order&shop_order_status=on-hold"><span class="total-count"><?php echo $jigoshop_orders->on_hold_count; ?></span></a></td> <td class="last t"><a class="onhold" href="edit.php?post_type=shop_order&shop_order_status=on-hold"><?php _e('On-Hold', 'jigoshop'); ?></a></td> </tr> <tr> <td class="b"><a href="edit.php?post_type=shop_order&shop_order_status=processing"><span class="total-count"><?php echo $jigoshop_orders->processing_count; ?></span></a></td> <td class="last t"><a class="processing" href="edit.php?post_type=shop_order&shop_order_status=processing"><?php _e('Processing', 'jigoshop'); ?></a></td> </tr> <tr> <td class="b"><a href="edit.php?post_type=shop_order&shop_order_status=completed"><span class="total-count"><?php echo $jigoshop_orders->completed_count; ?></span></a></td> <td class="last t"><a class="complete" href="edit.php?post_type=shop_order&shop_order_status=completed"><?php _e('Completed', 'jigoshop'); ?></a></td> </tr> </tbody> </table> </div> <div class="versions"> <p id="wp-version-message"><?php _e('You are using', 'jigoshop'); ?> <strong>JigoShop <?php echo JIGOSHOP_VERSION; ?>.</strong></p> </div> <div class="clear"></div> </div> </div><!-- postbox end --> <div class="postbox"> <h3 class="hndle" id="poststuff"><span><?php _e('Recent Orders', 'jigoshop') ?></span></h3> <div class="inside"> <?php $args = array( 'numberposts' => 10, 'orderby' => 'post_date', 'order' => 'DESC', 'post_type' => 'shop_order', 'post_status' => 'publish' ); $orders = get_posts( $args ); if ($orders) : echo '<ul class="recent-orders">'; foreach ($orders as $order) : $this_order = &new jigoshop_order( $order->ID ); echo ' <li> <span class="order-status '.sanitize_title($this_order->status).'">'.ucwords($this_order->status).'</span> <a href="'.admin_url('post.php?post='.$order->ID).'&action=edit">'.date_i18n('l jS \of F Y h:i:s A', strtotime($this_order->order_date)).'</a><br /> <small>'.sizeof($this_order->items).' '._n('item', 'items', sizeof($this_order->items), 'jigoshop').' <span class="order-cost">'.__('Total: ', 'jigoshop').jigoshop_price($this_order->order_total).'</span></small> </li>'; endforeach; echo '</ul>'; endif; ?> </div> </div><!-- postbox end --> <?php if (get_option('jigoshop_manage_stock')=='yes') : ?> <div class="postbox jigoshop_right_now"> <h3 class="hndle" id="poststuff"><span><?php _e('Stock Report', 'jigoshop') ?></span></h3> <div class="inside"> <?php $lowstockamount = get_option('jigoshop_notify_low_stock_amount'); if (!$lowstockamount) $lowstockamount = 1; $nostockamount = get_option('jigoshop_notify_no_stock_amount'); if (!$nostockamount) $nostockamount = 1; $outofstock = array(); $lowinstock = array(); $args = array( 'post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => -1 ); $my_query = new WP_Query($args); if ($my_query->have_posts()) : while ($my_query->have_posts()) : $my_query->the_post(); $_product = &new jigoshop_product( $my_query->post->ID ); if (!$_product->managing_stock()) continue; $thisitem = '<tr class="first"> <td class="first b"><a href="post.php?post='.$my_query->post->ID.'&action=edit">'.$_product->stock.'</a></td> <td class="t"><a href="post.php?post='.$my_query->post->ID.'&action=edit">'.$my_query->post->post_title.'</a></td> </tr>'; if ($_product->stock<=$nostockamount) : $outofstock[] = $thisitem; continue; endif; if ($_product->stock<=$lowstockamount) $lowinstock[] = $thisitem; endwhile; endif; wp_reset_query(); if (sizeof($lowinstock)==0) : $lowinstock[] = '<tr><td colspan="2">'.__('No products are low in stock.', 'jigoshop').'</td></tr>'; endif; if (sizeof($outofstock)==0) : $outofstock[] = '<tr><td colspan="2">'.__('No products are out of stock.', 'jigoshop').'</td></tr>'; endif; ?> <div class="table table_content"> <p class="sub"><?php _e('Low Stock', 'jigoshop'); ?></p> <table> <tbody> <?php echo implode('', $lowinstock); ?> </tbody> </table> </div> <div class="table table_discussion"> <p class="sub"><?php _e('Out of Stock/Backorders', 'jigoshop'); ?></p> <table> <tbody> <?php echo implode('', $outofstock); ?> </tbody> </table> </div> <div class="clear"></div> </div> </div><!-- postbox end --> <?php endif; ?> </div> <div class="postbox-container" style="width:49%; float:right;"> <?php global $current_month_offset; $current_month_offset = (int) date('m'); if (isset($_GET['month'])) $current_month_offset = (int) $_GET['month']; ?> <div class="postbox stats" id="jigoshop-stats"> <h3 class="hndle" id="poststuff"> <?php if ($current_month_offset!=date('m')) : ?><a href="admin.php?page=jigoshop&month=<?php echo $current_month_offset+1; ?>" class="next">Next Month →</a><?php endif; ?> <a href="admin.php?page=jigoshop&month=<?php echo $current_month_offset-1; ?>" class="previous">← Previous Month</a> <span><?php _e('Monthly Sales', 'jigoshop') ?></span></h3> <div class="inside"> <div id="placeholder" style="width:100%; height:300px; position:relative;"></div> <script type="text/javascript"> /* <![CDATA[ */ jQuery(function(){ function weekendAreas(axes) { var markings = []; var d = new Date(axes.xaxis.min); // go to the first Saturday d.setUTCDate(d.getUTCDate() - ((d.getUTCDay() + 1) % 7)) d.setUTCSeconds(0); d.setUTCMinutes(0); d.setUTCHours(0); var i = d.getTime(); do { // when we don't set yaxis, the rectangle automatically // extends to infinity upwards and downwards markings.push({ xaxis: { from: i, to: i + 2 * 24 * 60 * 60 * 1000 } }); i += 7 * 24 * 60 * 60 * 1000; } while (i < axes.xaxis.max); return markings; } <?php function orders_this_month( $where = '' ) { global $current_month_offset; $month = $current_month_offset; $year = (int) date('Y'); $first_day = strtotime("{$year}-{$month}-01"); $last_day = strtotime('-1 second', strtotime('+1 month', $first_day)); $after = date('Y-m-d', $first_day); $before = date('Y-m-d', $last_day); $where .= " AND post_date > '$after'"; $where .= " AND post_date < '$before'"; return $where; } add_filter( 'posts_where', 'orders_this_month' ); $args = array( 'numberposts' => -1, 'orderby' => 'post_date', 'order' => 'DESC', 'post_type' => 'shop_order', 'post_status' => 'publish' , 'suppress_filters' => false ); $orders = get_posts( $args ); $order_counts = array(); $order_amounts = array(); // Blank date ranges to begin $month = $current_month_offset; $year = (int) date('Y'); $first_day = strtotime("{$year}-{$month}-01"); $last_day = strtotime('-1 second', strtotime('+1 month', $first_day)); if ((date('m') - $current_month_offset)==0) : $up_to = date('d', strtotime('NOW')); else : $up_to = date('d', $last_day); endif; $count = 0; while ($count < $up_to) : $time = strtotime(date('Ymd', strtotime('+ '.$count.' DAY', $first_day))).'000'; $order_counts[$time] = 0; $order_amounts[$time] = 0; $count++; endwhile; if ($orders) : foreach ($orders as $order) : $order_data = &new jigoshop_order($order->ID); if ($order_data->status=='cancelled' || $order_data->status=='refunded') continue; $time = strtotime(date('Ymd', strtotime($order->post_date))).'000'; if (isset($order_counts[$time])) : $order_counts[$time]++; else : $order_counts[$time] = 1; endif; if (isset($order_amounts[$time])) : $order_amounts[$time] = $order_amounts[$time] + $order_data->order_total; else : $order_amounts[$time] = (float) $order_data->order_total; endif; endforeach; endif; remove_filter( 'posts_where', 'orders_this_month' ); ?> var d = [ <?php $values = array(); foreach ($order_counts as $key => $value) $values[] = "[$key, $value]"; echo implode(',', $values); ?> ]; for (var i = 0; i < d.length; ++i) d[i][0] += 60 * 60 * 1000; var d2 = [ <?php $values = array(); foreach ($order_amounts as $key => $value) $values[] = "[$key, $value]"; echo implode(',', $values); ?> ]; for (var i = 0; i < d2.length; ++i) d2[i][0] += 60 * 60 * 1000; var plot = jQuery.plot(jQuery("#placeholder"), [ { label: "Number of sales", data: d }, { label: "Sales amount", data: d2, yaxis: 2 } ], { series: { lines: { show: true }, points: { show: true } }, grid: { show: true, aboveData: false, color: '#ccc', backgroundColor: '#fff', borderWidth: 2, borderColor: '#ccc', clickable: false, hoverable: true, markings: weekendAreas }, xaxis: { mode: "time", timeformat: "%d %b", tickLength: 1, minTickSize: [1, "day"] }, yaxes: [ { min: 0, tickSize: 1, tickDecimals: 0 }, { position: "right", min: 0, tickDecimals: 2 } ], colors: ["#21759B", "#ed8432"] }); function showTooltip(x, y, contents) { jQuery('<div id="tooltip">' + contents + '</div>').css( { position: 'absolute', display: 'none', top: y + 5, left: x + 5, border: '1px solid #fdd', padding: '2px', 'background-color': '#fee', opacity: 0.80 }).appendTo("body").fadeIn(200); } var previousPoint = null; jQuery("#placeholder").bind("plothover", function (event, pos, item) { if (item) { if (previousPoint != item.dataIndex) { previousPoint = item.dataIndex; jQuery("#tooltip").remove(); if (item.series.label=="Number of sales") { var y = item.datapoint[1]; showTooltip(item.pageX, item.pageY, item.series.label + " - " + y); } else { var y = item.datapoint[1].toFixed(2); showTooltip(item.pageX, item.pageY, item.series.label + " - <?php echo get_jigoshop_currency_symbol(); ?>" + y); } } } else { jQuery("#tooltip").remove(); previousPoint = null; } }); }); /* ]]> */ </script> </div> </div><!-- postbox end --> <div class="postbox"> <h3 class="hndle" id="poststuff"><span><?php _e('Recent Product Reviews', 'jigoshop') ?></span></h3> <div class="inside jigoshop-reviews-widget"> <?php global $wpdb; $comments = $wpdb->get_results("SELECT *, SUBSTRING(comment_content,1,100) AS comment_excerpt FROM $wpdb->comments LEFT JOIN $wpdb->posts ON ($wpdb->comments.comment_post_ID = $wpdb->posts.ID) WHERE comment_approved = '1' AND comment_type = '' AND post_password = '' AND post_type = 'product' ORDER BY comment_date_gmt DESC LIMIT 5" ); if ($comments) : echo '<ul>'; foreach ($comments as $comment) : echo '<li>'; echo get_avatar($comment->comment_author, '32'); $rating = get_comment_meta( $comment->comment_ID, 'rating', true ); echo '<div class="star-rating" title="'.$rating.'"> <span style="width:'.($rating*16).'px">'.$rating.' '.__('out of 5', 'jigoshop').'</span></div>'; echo '<h4 class="meta"><a href="'.get_permalink($comment->ID).'#comment-'.$comment->comment_ID .'">'.$comment->post_title.'</a> reviewed by ' .strip_tags($comment->comment_author) .'</h4>'; echo '<blockquote>'.strip_tags($comment->comment_excerpt).' [...]</blockquote></li>'; endforeach; echo '</ul>'; else : echo '<p>'.__('There are no product reviews yet.', 'jigoshop').'</p>'; endif; ?> </div> </div><!-- postbox end --> <div class="postbox"> <h3 class="hndle" id="poststuff"><span><?php _e('Latest News', 'jigoshop') ?></span></h3> <div class="inside jigoshop-rss-widget"> <?php if (file_exists(ABSPATH.WPINC.'/class-simplepie.php')) { include_once(ABSPATH.WPINC.'/class-simplepie.php'); $rss = fetch_feed('http://jigoshop.com/feed'); if (!is_wp_error( $rss ) ) : $maxitems = $rss->get_item_quantity(5); $rss_items = $rss->get_items(0, $maxitems); if ( $maxitems > 0 ) : echo '<ul>'; foreach ( $rss_items as $item ) : $title = wptexturize($item->get_title(), ENT_QUOTES, "UTF-8"); $link = $item->get_permalink(); $date = $item->get_date('U'); if ( ( abs( time() - $date) ) < 86400 ) : // 1 Day $human_date = sprintf(__('%s ago','jigoshop'), human_time_diff($date)); else : $human_date = date(__('F jS Y','jigoshop'), $date); endif; echo '<li><a href="'.$link.'">'.$title.'</a> – <span class="rss-date">'.$human_date.'</span></li>'; endforeach; echo '</ul>'; else : echo '<ul><li>'.__('No items found.','jigoshop').'</li></ul>'; endif; else : echo '<ul><li>'.__('No items found.','jigoshop').'</li></ul>'; endif; } ?> </div> </div><!-- postbox end --> <div class="postbox"> <h3 class="hndle" id="poststuff"><span><?php _e('Useful Links', 'jigoshop') ?></span></h3> <div class="inside jigoshop-links-widget"> <ul class="links"> <li><a href="http://jigoshop.com/"><?php _e('Jigoshop', 'jigoshop'); ?></a> – <?php _e('Learn more about the Jigoshop plugin', 'jigoshop'); ?></li> <li><a href="http://jigoshop.com/tour/"><?php _e('Tour', 'jigoshop'); ?></a> – <?php _e('Take a tour of the plugin', 'jigoshop'); ?></li> <li><a href="http://jigoshop.com/user-guide/"><?php _e('Documentation', 'jigoshop'); ?></a> – <?php _e('Stuck? Read the plugin\'s documentation.', 'jigoshop'); ?></li> <li><a href="http://jigoshop.com/forums/"><?php _e('Forums', 'jigoshop'); ?></a> – <?php _e('Help from the community or our dedicated support team.', 'jigoshop'); ?></li> <li><a href="http://jigoshop.com/extend/extensions/"><?php _e('Jigoshop Extensions', 'jigoshop'); ?></a> – <?php _e('Extend Jigoshop with extra plugins and modules.', 'jigoshop'); ?></li> <li><a href="http://jigoshop.com/extend/themes/"><?php _e('Jigoshop Themes', 'jigoshop'); ?></a> – <?php _e('Extend Jigoshop with themes.', 'jigoshop'); ?></li> <li><a href="http://twitter.com/#!/jigoshop"><?php _e('@Jigoshop', 'jigoshop'); ?></a> – <?php _e('Follow us on Twitter.', 'jigoshop'); ?></li> <li><a href="https://github.com/jigoshop/Jigoshop"><?php _e('Jigoshop on Github', 'jigoshop'); ?></a> – <?php _e('Help extend Jigoshop.', 'jigoshop'); ?></li> <li><a href="http://wordpress.org/extend/plugins/jigoshop/"><?php _e('Jigoshop on WordPress.org', 'jigoshop'); ?></a> – <?php _e('Leave us a rating!', 'jigoshop'); ?></li> </ul> <div class="social"> <h4 class="first"><?php _e('Jigoshop Project', 'jigoshop') ?></h4> <p><?php _e('Join our growing developer community today, contribute to the jigoshop project via GitHub.') ?></p> <p><a href="https://github.com/jigoshop/Jigoshop" class="gitforked-button gitforked-forks gitforked-watchers">Fork</a></p> <script src="http://gitforked.com/api/1.1/button.js" type="text/javascript"></script> <h4><?php _e('Jigoshop Social', 'jigoshop'); ?></h4> <div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:like href="http://jigoshop.com" send="true" layout="button_count" width="250" show_faces="true" action="like" font="arial"></fb:like> <p><a href="http://twitter.com/share" class="twitter-share-button" data-url="http://jigoshop.com/" data-text="Jigoshop: A WordPress eCommerce solution that works" data-count="horizontal" data-via="jigoshop" data-related="Jigowatt:Creators">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></p> <p><g:plusone size="medium" href="http://jigoshop.com/"></g:plusone><script type="text/javascript" src="https://apis.google.com/js/plusone.js">{lang: 'en-GB'}</script></p> <h4><?php _e('Brought to you by', 'jigoshop'); ?></h4> <p><a href="http://jigowatt.co.uk/" title="Jigoshop is brought to you by Jigowatt"><img src="<?php echo jigoshop::plugin_url(); ?>/assets/images/jigowatt.png" alt="Jigowatt" /></a></p> <p><?php _e('From design to deployment Jigowatt delivers expert solutions to enterprise customers using Magento & WordPress open source platforms.') ?></p> </div> <div class="clear"></div> </div> </div><!-- postbox end --> </div> </div> </div> </div> <?php } ?>
/** * Load needed scripts to order categories */ function jigoshop_categories_scripts() { if (!isset($_GET['taxonomy']) || $_GET['taxonomy'] !== 'product_cat') { return; } wp_register_script('jigoshop-categories-ordering', jigoshop::plugin_url() . '/assets/js/categories-ordering.js', array('jquery-ui-sortable')); wp_print_scripts('jigoshop-categories-ordering'); }
/** * Settings page * * Handles the display of the settings page in admin. * * @since 1.0 * @usedby jigoshop_admin_menu2() */ function jigoshop_settings() { global $options_settings; jigoshop_update_options($options_settings); ?> <script type="text/javascript" src="<?php echo jigoshop::plugin_url(); ?>/assets/js/easyTooltip.js"></script> <div class="wrap jigoshop"> <div class="icon32 icon32-jigoshop-settings" id="icon-jigoshop"><br/></div> <h2><?php _e('General Settings','jigoshop'); ?></h2> <form method="post" id="mainform" action=""> <?php jigoshop_admin_fields($options_settings); ?> <input name="submitted" type="hidden" value="yes" /> </form> </div> <?php }
function jigoshop_cart( $atts ) { $errors = array(); // Process Discount Codes if (isset($_POST['apply_coupon']) && $_POST['apply_coupon'] && jigoshop::verify_nonce('cart')) : $coupon_code = stripslashes(trim($_POST['coupon_code'])); jigoshop_cart::add_discount($coupon_code); // Remove from cart elseif ( isset($_GET['remove_item']) && $_GET['remove_item'] > 0 && jigoshop::verify_nonce('cart', '_GET')) : jigoshop_cart::set_quantity( $_GET['remove_item'], 0 ); jigoshop::add_message( __('Cart updated.', 'jigoshop') ); // Update Cart elseif (isset($_POST['update_cart']) && $_POST['update_cart'] && jigoshop::verify_nonce('cart')) : $cart_totals = $_POST['cart']; if (sizeof(jigoshop_cart::$cart_contents)>0) : foreach (jigoshop_cart::$cart_contents as $item_id => $values) : if (isset($cart_totals[$item_id]['qty'])) jigoshop_cart::set_quantity( $item_id, $cart_totals[$item_id]['qty'] ); endforeach; endif; jigoshop::add_message( __('Cart updated.', 'jigoshop') ); // Update Shipping elseif (isset($_POST['calc_shipping']) && $_POST['calc_shipping'] && jigoshop::verify_nonce('cart')) : unset($_SESSION['_chosen_method_id']); $country = $_POST['calc_shipping_country']; $state = $_POST['calc_shipping_state']; $postcode = $_POST['calc_shipping_postcode']; if ($postcode && !jigoshop_validation::is_postcode( $postcode, $country )) : jigoshop::add_error( __('Please enter a valid postcode/ZIP.','jigoshop') ); $postcode = ''; elseif ($postcode) : $postcode = jigoshop_validation::format_postcode( $postcode, $country ); endif; if ($country) : // Update customer location jigoshop_customer::set_location( $country, $state, $postcode ); jigoshop_customer::set_shipping_location( $country, $state, $postcode ); // Re-calc price jigoshop_cart::calculate_totals(); jigoshop::add_message( __('Shipping costs updated.', 'jigoshop') ); else : jigoshop_customer::set_shipping_location( '', '', '' ); jigoshop::add_message( __('Shipping costs updated.', 'jigoshop') ); endif; endif; $result = jigoshop_cart::check_cart_item_stock(); if (is_wp_error($result)) : jigoshop::add_error( $result->get_error_message() ); endif; jigoshop::show_messages(); if (sizeof(jigoshop_cart::$cart_contents)==0) : echo '<p>'.__('Your cart is empty.', 'jigoshop').'</p>'; return; endif; ?> <form action="<?php echo jigoshop_cart::get_cart_url(); ?>" method="post"> <table class="shop_table cart" cellspacing="0"> <thead> <tr> <th class="product-remove"></th> <th class="product-thumbnail"></th> <th class="product-name"><span class="nobr"><?php _e('Product Name', 'jigoshop'); ?></span></th> <th class="product-price"><span class="nobr"><?php _e('Unit Price', 'jigoshop'); ?></span></th> <th class="product-quantity"><?php _e('Quantity', 'jigoshop'); ?></th> <th class="product-subtotal"><?php _e('Price', 'jigoshop'); ?></th> </tr> </thead> <tbody> <?php if (sizeof(jigoshop_cart::$cart_contents)>0) : foreach (jigoshop_cart::$cart_contents as $item_id => $values) : $_product = $values['data']; if ($_product->exists() && $values['quantity']>0) : echo ' <tr> <td class="product-remove"><a href="'.jigoshop_cart::get_remove_url($item_id).'" class="remove" title="Remove this item">×</a></td> <td class="product-thumbnail"><a href="'.get_permalink($item_id).'">'; if (has_post_thumbnail($item_id)) echo get_the_post_thumbnail($item_id, 'shop_tiny'); else echo '<img src="'.jigoshop::plugin_url(). '/assets/images/placeholder.png" alt="Placeholder" width="'.jigoshop::get_var('shop_tiny_w').'" height="'.jigoshop::get_var('shop_tiny_h').'" />'; echo ' </a></td> <td class="product-name"><a href="'.get_permalink($item_id).'">' . apply_filters('jigoshop_cart_product_title', $_product->get_title(), $_product) . '</a></td> <td class="product-price">'.jigoshop_price($_product->get_price()).'</td> <td class="product-quantity"><div class="quantity"><input name="cart['.$item_id.'][qty]" value="'.$values['quantity'].'" size="4" title="Qty" class="input-text qty text" maxlength="12" /></div></td> <td class="product-subtotal">'.jigoshop_price($_product->get_price()*$values['quantity']).'</td> </tr>'; endif; endforeach; endif; do_action( 'jigoshop_shop_table_cart' ); ?> <tr> <td colspan="6" class="actions"> <div class="coupon"> <label for="coupon_code"><?php _e('Coupon', 'jigoshop'); ?>:</label> <input name="coupon_code" class="input-text" id="coupon_code" value="" /> <input type="submit" class="button" name="apply_coupon" value="<?php _e('Apply Coupon', 'jigoshop'); ?>" /> </div> <?php jigoshop::nonce_field('cart') ?> <input type="submit" class="button" name="update_cart" value="<?php _e('Update Shopping Cart', 'jigoshop'); ?>" /> <a href="<?php echo jigoshop_cart::get_checkout_url(); ?>" class="checkout-button button-alt"><?php _e('Proceed to Checkout →', 'jigoshop'); ?></a> </td> </tr> </tbody> </table> </form> <div class="cart-collaterals"> <?php do_action('cart-collaterals'); ?> <div class="cart_totals"> <?php // Hide totals if customer has set location and there are no methods going there $available_methods = jigoshop_shipping::get_available_shipping_methods(); if ($available_methods || !jigoshop_customer::get_shipping_country() || !jigoshop_shipping::$enabled ) : ?> <h2><?php _e('Cart Totals', 'jigoshop'); ?></h2> <table cellspacing="0" cellpadding="0"> <tbody> <tr> <th><?php _e('Subtotal', 'jigoshop'); ?></th> <td><?php echo jigoshop_cart::get_cart_subtotal(); ?></td> </tr> <?php if (jigoshop_cart::get_cart_shipping_total()) : ?><tr> <th><?php _e('Shipping', 'jigoshop'); ?> <small><?php echo jigoshop_countries::shipping_to_prefix().' '.jigoshop_countries::$countries[ jigoshop_customer::get_shipping_country() ]; ?></small></th> <td><?php echo jigoshop_cart::get_cart_shipping_total(); ?> <small><?php echo jigoshop_cart::get_cart_shipping_title(); ?></small></td> </tr><?php endif; ?> <?php if (jigoshop_cart::get_cart_tax()) : ?><tr> <th><?php _e('Tax', 'jigoshop'); ?> <?php if (jigoshop_customer::is_customer_outside_base()) : ?><small><?php echo sprintf(__('estimated for %s', 'jigoshop'), jigoshop_countries::estimated_for_prefix() . jigoshop_countries::$countries[ jigoshop_countries::get_base_country() ] ); ?></small><?php endif; ?></th> <td><?php echo jigoshop_cart::get_cart_tax(); ?></td> </tr><?php endif; ?> <?php if (jigoshop_cart::get_total_discount()) : ?><tr class="discount"> <th><?php _e('Discount', 'jigoshop'); ?></th> <td>-<?php echo jigoshop_cart::get_total_discount(); ?></td> </tr><?php endif; ?> <tr> <th><strong><?php _e('Total', 'jigoshop'); ?></strong></th> <td><strong><?php echo jigoshop_cart::get_total(); ?></strong></td> </tr> </tbody> </table> <?php else : echo '<p>'.__('Sorry, it seems that there are no available shipping methods to your location. Please contact us if you require assistance or wish to make alternate arrangements.', 'jigoshop').'</p>'; endif; ?> </div> <?php jigoshop_shipping_calculator(); ?> </div> <?php }
function jigoshop_init() { jigoshop_post_type(); // Image sizes add_image_size( 'shop_tiny', jigoshop::get_var('shop_tiny_w'), jigoshop::get_var('shop_tiny_h'), 'true' ); add_image_size( 'shop_thumbnail', jigoshop::get_var('shop_thumbnail_w'), jigoshop::get_var('shop_thumbnail_h'), 'true' ); add_image_size( 'shop_small', jigoshop::get_var('shop_small_w'), jigoshop::get_var('shop_small_h'), 'true' ); add_image_size( 'shop_large', jigoshop::get_var('shop_large_w'), jigoshop::get_var('shop_large_h'), 'true' ); // Include template functions here so they are pluggable by themes include_once( 'jigoshop_template_functions.php' ); @ob_start(); add_role('customer', 'Customer', array( 'read' => true, 'edit_posts' => false, 'delete_posts' => false )); $css = file_exists(get_stylesheet_directory() . '/jigoshop/style.css') ? get_stylesheet_directory_uri() . '/jigoshop/style.css' : jigoshop::plugin_url() . '/assets/css/frontend.css'; if (JIGOSHOP_USE_CSS) wp_register_style('jigoshop_frontend_styles', $css ); wp_register_style('jigoshop_fancybox_styles', jigoshop::plugin_url() . '/assets/css/fancybox.css'); wp_register_style('jqueryui_styles', jigoshop::plugin_url() . '/assets/css/ui.css'); wp_register_script( 'fancybox', jigoshop::plugin_url() . '/assets/js/jquery.fancybox-1.3.4.pack.js', 'jquery', '1.0' ); wp_register_script( 'blockui', jigoshop::plugin_url() . '/assets/js/blockui.js', 'jquery', '1.0' ); wp_register_script( 'cookie', jigoshop::plugin_url() . '/assets/js/cookie.js', 'jquery', '1.0' ); wp_register_script( 'scrollto', jigoshop::plugin_url() . '/assets/js/scrollto.js', 'jquery', 'jquery', '1.0' ); wp_register_script( 'jigoshop_script', jigoshop::plugin_url() . '/assets/js/script.js.php', 'jquery', '1.0' ); wp_register_script( 'jqueryui', 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/jquery-ui.min.js', 'jquery', '1.0' ); wp_register_script( 'jquery.placeholder', jigoshop::plugin_url() . '/assets/js/jquery.placeholder.js', 'jquery', '1.0' ); if (is_admin()) : wp_register_style('jigoshop_admin_styles', jigoshop::plugin_url() . '/assets/css/admin.css'); wp_register_style('jigoshop_admin_datepicker_styles', jigoshop::plugin_url() . '/assets/css/datepicker.css'); wp_enqueue_style('jigoshop_admin_styles'); wp_enqueue_style('jigoshop_admin_datepicker_styles'); wp_register_script( 'flot', jigoshop::plugin_url() . '/assets/js/jquery.flot.min.js' ); wp_enqueue_script('flot'); wp_enqueue_script('blockui'); wp_enqueue_script('cookie'); else : wp_enqueue_style('jigoshop_frontend_styles'); wp_enqueue_style('jigoshop_fancybox_styles'); wp_enqueue_style('jqueryui_styles'); wp_enqueue_script('jquery'); wp_enqueue_script('jqueryui'); wp_enqueue_script('fancybox'); wp_enqueue_script('blockui'); wp_enqueue_script('cookie'); wp_enqueue_script('scrollto'); wp_enqueue_script('jigoshop_script'); wp_enqueue_script('jquery.placeholder'); endif; }
function jigoshop_custom_product_columns($column) { global $post; $product = &new jigoshop_product($post->ID); switch ($column) { case "thumb" : if (has_post_thumbnail($post->ID)) : echo get_the_post_thumbnail($post->ID, 'shop_tiny'); endif; break; case "summary" : echo $post->post_excerpt; break; case "price": echo $product->get_price_html(); break; case "product_cat" : echo get_the_term_list($post->ID, 'product_cat', '', ', ',''); break; case "product_tags" : echo get_the_term_list($post->ID, 'product_tag', '', ', ',''); break; case "sku" : if ( $sku = get_post_meta( $post->ID, 'SKU', true )) : echo '#'.$post->ID.' - SKU: ' . $sku; else : echo '#'.$post->ID; endif; break; case "featured" : $url = wp_nonce_url( admin_url('admin-ajax.php?action=jigoshop-feature-product&product_id=' . $post->ID) ); echo '<a href="'.$url.'" title="'.__('Change','jigoshop') .'">'; if ($product->is_featured()) echo '<a href="'.$url.'"><img src="'.jigoshop::plugin_url().'/assets/images/success.gif" alt="yes" />'; else echo '<img src="'.jigoshop::plugin_url().'/assets/images/success-off.gif" alt="no" />'; echo '</a>'; break; case "visibility" : if ( $this_data = $product->visibility ) : echo $this_data; else : echo '<span class="na">–</span>'; endif; break; case "is_in_stock" : if ( !$product->is_type( 'grouped' ) && $product->is_in_stock() ) echo '<img src="'.jigoshop::plugin_url().'/assets/images/success.gif" alt="yes" />'; else echo '<span class="na">–</span>'; break; case "inventory" : if ( $product->managing_stock() ) : echo $product->stock.' in stock'; else : echo '<span class="na">–</span>'; endif; break; case "product_type" : echo ucwords($product->product_type); break; case "id" : echo '#'.$post->ID; break; } }
function jigoshop_get_product_thumbnail($size = 'shop_small', $placeholder_width = 0, $placeholder_height = 0) { global $post; if (!$placeholder_width) { $placeholder_width = jigoshop::get_var('shop_small_w'); } if (!$placeholder_height) { $placeholder_height = jigoshop::get_var('shop_small_h'); } if (has_post_thumbnail()) { return get_the_post_thumbnail($post->ID, $size); } else { return '<img class="scale-with-grid" src="' . jigoshop::plugin_url() . '/assets/images/placeholder.png" alt="Placeholder" width="' . $placeholder_width . '" height="' . $placeholder_height . '" />'; } }
/** * Get the plugin url * * @return string url */ public static function plugin_url() { if(self::$plugin_url) return self::$plugin_url; return self::$plugin_url = WP_PLUGIN_URL . "/" . plugin_basename( dirname(dirname(__FILE__))); }