/** * Render the content of the widget */ public function widget($args, $instance) { extract($args); $data = array('before_title' => $before_title, 'after_title' => $after_title, 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'title' => $instance['title']); $args = array('taxonomy' => 'product-category'); $data['categories'] = get_categories($args); $view = CC_View::get(CC_PATH . 'views/widget/html-category-sidebar.php', $data); echo $view; }
/** * Render the output for the cart66 product meta box on the product post type * * This function should echo the content */ function cc_product_meta_box_render($post, $box) { $value = get_post_meta($post->ID, '_cc_product_name', true); if (empty($value)) { $value = 'Select Product'; } $data = array('post' => $post, 'box' => $box, 'value' => $value); $template = CC_PATH . 'views/admin/html-product-meta-box.php'; $view = CC_View::get($template, $data); echo $view; }
public static function ajax_render_content() { $item_count = 0; $subtotal = 0; $api_ok = false; $cart_summary = CC_Cart::get_summary(); if (is_object($cart_summary)) { $item_count = $cart_summary->item_count; $subtotal = $cart_summary->subtotal; $api_ok = $cart_summary->api_ok; } $url = new CC_Cloud_URL(); $data = array('view_cart_url' => $url->view_cart(), 'checkout_url' => $url->checkout(), 'item_count' => $item_count, 'subtotal' => $subtotal, 'api_ok' => $api_ok); $view = CC_View::get(CC_PATH . 'views/widget/cart-sidebar-content.php', $data); echo $view; die; }
function cc_filter_product_single($content) { global $post; $post_type = get_post_type(); if (is_single() && 'cc_product' == $post_type) { wp_enqueue_script('cc-gallery-toggle', CC_URL . 'resources/js/gallery-toggle.js', 'jquery'); $thumbs = cc_get_product_thumb_sources($post->ID); $images = cc_get_product_gallery_image_sources($post->ID, false); if (count($images) > 0) { $data = array('images' => $images, 'thumbs' => $thumbs); $single_product_view = CC_View::get(CC_PATH . 'templates/partials/single-product.php', $data); } else { $single_product_view = CC_View::get(CC_PATH . 'templates/partials/single-product-no-gallery.php'); } $content = $single_product_view . $content; } return $content; }
/** * Image gallery functions */ function cc_gallery_images($post) { $list_images = cc_list_product_image_slots(); wp_enqueue_script('media-upload'); wp_enqueue_script('thickbox'); wp_enqueue_script('quicktags'); wp_enqueue_script('jquery-ui-resizable'); wp_enqueue_script('jquery-ui-draggable'); wp_enqueue_script('jquery-ui-button'); wp_enqueue_script('jquery-ui-position'); wp_enqueue_script('jquery-ui-dialog'); wp_enqueue_script('wpdialogs'); wp_enqueue_script('wplink'); wp_enqueue_script('wpdialogs-popup'); wp_enqueue_script('wp-fullscreen'); wp_enqueue_script('editor'); wp_enqueue_script('word-count'); wp_enqueue_script('img-mb', CC_URL . 'resources/js/get-images.js', array('jquery', 'media-upload', 'thickbox', 'set-post-thumbnail')); wp_enqueue_style('thickbox'); wp_nonce_field('cc-gallery-images-save_' . $post->ID, 'cc-gallery-images-nonce'); echo '<div id="droppable">'; $z = 1; foreach ($list_images as $k => $i) { $meta = get_post_meta($post->ID, $i, true); $img = isset($meta) ? '<img src="' . wp_get_attachment_thumb_url($meta) . '" width="100" height="100" alt="" draggable="false">' : ''; echo '<div class="image-entry" draggable="true">'; echo '<input type="hidden" name="' . $k . '" id="' . $k . '" class="id_img" data-num="' . $z . '" value="' . $meta . '">'; echo '<div class="img-preview" data-num="' . $z . '">' . $img . '</div>'; echo '<a href="javascript:void(0);" class="get-image button-secondary" data-num="' . $z . '">' . _x('Add New', 'file') . '</a><a href="javascript:void(0);" class="del-image button-secondary" data-num="' . $z . '">' . __('Delete') . '</a>'; echo '</div>'; $z++; } echo '</div>'; $page = CC_View::get(CC_PATH . 'views/admin/html-image-meta-box.php'); echo $page; }
/** * Show the product catalog * * Params: * - category: Limit the list to a certain product category slug (default "all") * - max: The max number of products to list per page. (default 6) * - sort: How to sort the products * - price_asc * - price_desc * - name_asc * - name_desc * - menu */ public static function cc_product_catalog($args, $content) { // Look for limit $no_paging = false; $limit = null; if (isset($args['limit']) && is_numeric($args['limit']) && $args['limit'] >= 1) { $no_paging = true; $limit = $args['limit']; } // Look for page $page = get_query_var('paged') ? get_query_var('paged') : 1; if ($page == 1) { $page = get_query_var('page') ? get_query_var('page') : 1; } // Look for number of posts to show per page $per_page = isset($args['max']) ? (int) $args['max'] : 6; if ($per_page < 1) { $per_page = 6; } // Look for catalog title $title = null; if (isset($args['title'])) { $title = $args['title']; } $params = array('post_type' => 'cc_product', 'posts_per_page' => $per_page, 'post_status' => 'publish', 'paged' => $page, 'nopaging' => $no_paging); // Limit by category if (isset($args['category'])) { $category = strtolower($args['category']); if ('all' != $category) { $params['product-category'] = $category; } } // Order the posts $params['orderby'] = 'menu_order'; if (isset($args['sort'])) { switch ($args['sort']) { case 'price_asc': $params['orderby'] = array('meta_value_num' => 'ASC', 'menu_order' => 'ASC'); $params['meta_key'] = '_cc_product_price'; break; case 'price_desc': $params['orderby'] = array('meta_value_num' => 'DESC', 'menu_order' => 'ASC'); $params['meta_key'] = '_cc_product_price'; break; case 'name_asc': $params['orderby'] = 'title'; $params['order'] = 'ASC'; break; case 'name_desc': $params['orderby'] = 'title'; $params['order'] = 'DESC'; break; case 'menu': $params['orderby'] = 'menu_order'; break; } } // $products = get_posts( $params ); global $post; $wp_query = new WP_Query($params); $product_count = 0; $out = ''; if ($wp_query->have_posts()) { if (isset($title)) { $out .= '<h3 class="cc-catalog-title">' . $title . '</h3>'; } // Include title in output if provided $out .= '<ul class="cc-product-list">'; while ($wp_query->have_posts()) { $wp_query->the_post(); $src = cc_primary_image_for_product($post->ID); $out .= CC_View::get(CC_PATH . 'templates/partials/grid-item.php', array('post' => $post, 'thumbnail_src' => $src)); if (isset($limit)) { $product_count += 1; if ($product_count >= $limit) { break; } } } $out .= '</ul>'; // Include catalog pagination $out .= CC_View::get(CC_PATH . 'templates/partials/pagination.php', array('query' => $wp_query, 'page' => $page)); } return $out; }
public static function add_media_button_popup() { $view = CC_View::get(CC_PATH . 'views/html-editor-pop-up.php'); echo $view; }
public static function show_errors() { $data = CC_Flash_Data::get_all('cart_error'); if (count($data)) { $data['link'] = add_query_arg(array('cc-task' => FALSE, 'sku' => FALSE, 'quantity' => FALSE, 'redirect' => FALSE)); CC_Log::write('Checking for cart errors in footer: ' . print_r($data, true)); $view = CC_View::get(CC_PATH . 'views/error-overlay.php', $data); echo $view; } }
public function secure_console() { $view = CC_View::get(CC_PATH . 'views/admin/html-secure-console.php'); echo $view; }