Exemple #1
0
/**
 * Body Class Filter
 * @modified:     2009-10-14 by Ben
 * @description:  Adds additional wpsc classes to the body tag.
 * @param:        $classes = Array of body classes
 * @return:       (Array) of classes
 *
 * @uses get_permalink()                Returns WP permalink given post_id
 * @uses get_option()                   Returns option value given key
 * @uses get_post_type()                Returns string for registered post_type name
 * @uses wpsc_is_single_product()       Returns true if we are on a single product
 * @uses wpsc_is_in_category()          Returns true if we are on a WPSC product cat
 * @uses wpsc_is_in_tag()               Returns true if we are on a WPSC product tag
 * @usse esc_attr()                     Keeping things safe just in case
 */
function wpsc_body_class($classes)
{
    global $wp_query, $wpsc_query;
    $post_id = get_the_ID();
    if ($post_id) {
        $page_url = get_permalink($post_id);
        // If on a product or category page...
        if (get_option('product_list_url') == $page_url || get_post_type($post_id) === 'wpsc-product') {
            $classes[] = 'wp-e-commerce';
            if (!is_array($wpsc_query->query)) {
                $classes[] = 'wpsc-home';
            }
            if (wpsc_is_single_product()) {
                $object = $wp_query->get_queried_object();
                $classes[] = 'wpsc-single-product';
                if (absint($object->ID) > 0) {
                    $classes[] = 'wpsc-single-product-' . absint($object->ID);
                }
            }
            if (wpsc_is_in_category() && !wpsc_is_single_product()) {
                $classes[] = 'wpsc-category';
                $tax_object = $wp_query->get_queried_object();
                $classes[] = 'wpsc-category-' . esc_attr($tax_object->slug);
            }
            if (wpsc_is_in_tag() && !wpsc_is_single_product()) {
                $classes[] = 'wpsc-tag';
                $tax_object = $wp_query->get_queried_object();
                $classes[] = 'wpsc-tag-' . esc_attr($tax_object->slug);
            }
        }
        // If viewing the shopping cart...
        if (get_option('shopping_cart_url') == $page_url) {
            $classes[] = 'wp-e-commerce';
            $classes[] = 'wpsc-shopping-cart';
        }
        // If viewing the transaction...
        if (get_option('transact_url') == $page_url) {
            $classes[] = 'wp-e-commerce';
            $classes[] = 'wpsc-transaction-details';
        }
        // If viewing your account...
        if (get_option('user_account_url') == $page_url) {
            $classes[] = 'wp-e-commerce';
            $classes[] = 'wpsc-user-account';
        }
    }
    return $classes;
}
/**
 * Body Class Filter
 * @modified:     2009-10-14 by Ben
 * @description:  Adds additional wpsc classes to the body tag.
 * @param:        $classes = Array of body classes
 * @return:       (Array) of classes
 */
function wpsc_body_class($classes)
{
    global $wp_query, $wpsc_query;
    $post_id = $wp_query->post->ID;
    $page_url = get_permalink($post_id);
    // If on a product or category page...
    if (get_option('product_list_url') == $page_url) {
        $classes[] = 'wpsc';
        if (!is_array($wpsc_query->query)) {
            $classes[] = 'wpsc-home';
        }
        if (wpsc_is_single_product()) {
            $classes[] = 'wpsc-single-product';
            if (absint($wpsc_query->products[0]['id']) > 0) {
                $classes[] = 'wpsc-single-product-' . $wpsc_query->products[0]['id'];
            }
        }
        if (wpsc_is_in_category() && !wpsc_is_single_product()) {
            $classes[] = 'wpsc-category';
        }
        if (absint($wpsc_query->query_vars['category_id']) > 0) {
            $classes[] = 'wpsc-category-' . $wpsc_query->query_vars['category_id'];
        }
        if (absint(wpsc_category_group()) > 0) {
            $classes[] = 'wpsc-group-' . wpsc_category_group();
        }
    }
    // If viewing the shopping cart...
    if (get_option('shopping_cart_url') == $page_url) {
        $classes[] = 'wpsc';
        $classes[] = 'wpsc-shopping-cart';
    }
    // If viewing the transaction...
    if (get_option('transact_url') == $page_url) {
        $classes[] = 'wpsc';
        $classes[] = 'wpsc-transaction-details';
    }
    // If viewing your account...
    if (get_option('user_account_url') == $page_url) {
        $classes[] = 'wpsc';
        $classes[] = 'wpsc-user-account';
    }
    return $classes;
}
 public function product_page_bottom()
 {
     if (wpsc_is_single_product()) {
         $default_element_ids = array('productpage-retargeting-1', 'productpage-retargeting-2', 'productpage-retargeting-3');
         $element_ids = apply_filters('wpecnt_product_page_bottom', $default_element_ids);
         if (is_array($element_ids) && !empty($element_ids)) {
             $this->render('retargeting-elements', array('element_ids' => $element_ids));
         }
     }
 }
Exemple #4
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>';
        }
    }
Exemple #5
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>";
            }
        }
    }