コード例 #1
0
function porto_shortcode_product_attribute_filter_param($param_settings, $current_value, $map_settings, $atts)
{
    if (class_exists('Vc_Vendor_Woocommerce')) {
        $vc_vendor_wc = new Vc_Vendor_Woocommerce();
        return $vc_vendor_wc->productAttributeFilterParamValue($param_settings, $current_value, $map_settings, $atts);
    }
    return '';
}
コード例 #2
0
function porto_shortcode_product_categories_ids_render($query)
{
    if (class_exists('Vc_Vendor_Woocommerce')) {
        $vc_vendor_wc = new Vc_Vendor_Woocommerce();
        return $vc_vendor_wc->productCategoryCategoryRenderByIdExact($query);
    }
    return '';
}
コード例 #3
0
function porto_shortcode_product_id_param_value($current_value, $param_settings, $map_settings, $atts)
{
    if (class_exists('Vc_Vendor_Woocommerce')) {
        $vc_vendor_wc = new Vc_Vendor_Woocommerce();
        return $vc_vendor_wc->productIdDefaultValue($current_value, $param_settings, $map_settings, $atts);
    }
    return '';
}
コード例 #4
0
function porto_load_product_category_shortcode()
{
    $animation_type = porto_vc_animation_type();
    $animation_duration = porto_vc_animation_duration();
    $animation_delay = porto_vc_animation_delay();
    $custom_class = porto_vc_custom_class();
    $order_by_values = porto_vc_woo_order_by();
    $order_way_values = porto_vc_woo_order_way();
    $args = array('type' => 'post', 'child_of' => 0, 'parent' => '', 'orderby' => 'name', 'order' => 'ASC', 'hide_empty' => false, 'hierarchical' => 1, 'exclude' => '', 'include' => '', 'number' => '', 'taxonomy' => 'product_cat', 'pad_counts' => false);
    $categories = get_categories($args);
    $product_categories_dropdown = array();
    $vc_vendor_wc = new Vc_Vendor_Woocommerce();
    $vc_vendor_wc->getCategoryChilds(0, 0, $categories, 0, $product_categories_dropdown);
    // woocommerce product category
    vc_map(array('name' => "Porto " . __('Product category', 'js_composer'), 'base' => 'porto_product_category', 'icon' => 'porto_vc_woocommerce', 'category' => __('WooCommerce', 'js_composer'), 'description' => __('Show multiple products in a category', 'js_composer'), 'params' => array(array('type' => 'textfield', 'heading' => __('Title', 'woocommerce'), 'param_name' => 'title', 'admin_label' => true), array('type' => 'dropdown', 'heading' => __('View mode', 'porto'), 'param_name' => 'view', 'value' => porto_vc_commons('products_view_mode'), 'admin_label' => true), array('type' => 'textfield', 'heading' => __('Per page', 'js_composer'), 'value' => 12, 'param_name' => 'per_page', 'description' => __('The "per_page" shortcode determines how many products to show on the page', 'js_composer')), array('type' => 'dropdown', 'heading' => __('Columns', 'porto'), 'param_name' => 'columns', 'dependency' => array('element' => 'view', 'value' => array('products-slider', 'grid')), 'std' => '4', 'value' => porto_vc_commons('products_columns')), array('type' => 'dropdown', 'heading' => __('Column Width', 'porto'), 'param_name' => 'column_width', 'dependency' => array('element' => 'view', 'value' => array('products-slider', 'grid')), 'value' => porto_vc_commons('products_column_width')), array('type' => 'dropdown', 'heading' => __('Order by', 'js_composer'), 'param_name' => 'orderby', 'value' => $order_by_values, 'description' => sprintf(__('Select how to sort retrieved products. More at %s.', 'js_composer'), '<a href="http://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters" target="_blank">WordPress codex page</a>')), array('type' => 'dropdown', 'heading' => __('Order way', 'js_composer'), 'param_name' => 'order', 'value' => $order_way_values, 'description' => sprintf(__('Designates the ascending or descending order. More at %s.', 'js_composer'), '<a href="http://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters" target="_blank">WordPress codex page</a>')), array('type' => 'dropdown', 'heading' => __('Category', 'js_composer'), 'value' => $product_categories_dropdown, 'param_name' => 'category', 'description' => __('Product category list', 'js_composer')), array('type' => 'dropdown', 'heading' => __('Add Links Position', 'porto'), 'desc' => 'Select position of add to cart, add to wishlist, quickview.', 'param_name' => 'addlinks_pos', 'value' => porto_vc_commons('products_addlinks_pos')), array('type' => 'checkbox', 'heading' => __('Show Navigation', 'porto'), 'param_name' => 'navigation', 'std' => 'yes', 'dependency' => array('element' => 'view', 'value' => array('products-slider')), 'value' => array(__('Yes', 'js_composer') => 'yes')), array('type' => 'checkbox', 'heading' => __('Show Pagination', 'porto'), 'param_name' => 'pagination', 'std' => 'no', 'dependency' => array('element' => 'view', 'value' => array('products-slider')), 'value' => array(__('Yes', 'js_composer') => 'yes')), $animation_type, $animation_duration, $animation_delay, $custom_class)));
    if (!class_exists('WPBakeryShortCode_Porto_Product_Category')) {
        class WPBakeryShortCode_Porto_Product_Category extends WPBakeryShortCode
        {
        }
    }
}
コード例 #5
0
 public static function getOrderFieldLabel($key)
 {
     if (false === self::$order_fields_list) {
         self::$order_fields_list = array_flip(self::getOrderFieldsList());
     }
     return isset(self::$order_fields_list[$key]) ? self::$order_fields_list[$key] : '';
 }
コード例 #6
0
<?php

return array('vc_gitem_wocommerce' => array('name' => __('WooCommerce field', 'js_composer'), 'base' => 'vc_gitem_wocommerce', 'icon' => 'icon-wpb-woocommerce', 'category' => __('Content', 'js_composer'), 'description' => __('Woocommerce', 'js_composer'), 'php_class_name' => 'Vc_Gitem_Woocommerce_Shortcode', 'params' => array(array('type' => 'dropdown', 'heading' => __('Content type', 'js_composer'), 'param_name' => 'post_type', 'value' => array(__('Product', 'js_composer') => 'product', __('Order', 'js_composer') => 'order'), 'description' => __('Select Woo Commerce post type.', 'js_composer')), array('type' => 'dropdown', 'heading' => __('Product field name', 'js_composer'), 'param_name' => 'product_field_key', 'value' => Vc_Vendor_Woocommerce::getProductsFieldsList(), 'dependency' => array('element' => 'post_type', 'value' => array('product')), 'description' => __('Select field from product.', 'js_composer')), array('type' => 'textfield', 'heading' => __('Product custom key', 'js_composer'), 'param_name' => 'product_custom_key', 'description' => __('Enter custom key.', 'js_composer'), 'dependency' => array('element' => 'product_field_key', 'value' => array('_custom_'))), array('type' => 'dropdown', 'heading' => __('Order fields', 'js_composer'), 'param_name' => 'order_field_key', 'value' => Vc_Vendor_Woocommerce::getOrderFieldsList(), 'dependency' => array('element' => 'post_type', 'value' => array('order')), 'description' => __('Select field from order.', 'js_composer')), array('type' => 'textfield', 'heading' => __('Order custom key', 'js_composer'), 'param_name' => 'order_custom_key', 'dependency' => array('element' => 'order_field_key', 'value' => array('_custom_')), 'description' => __('Enter custom key.', 'js_composer')), array('type' => 'checkbox', 'heading' => __('Show label', 'js_composer'), 'param_name' => 'show_label', 'value' => array(__('Yes', 'js_composer') => 'yes'), 'description' => __('Enter label to display before key value.', 'js_composer')), array('type' => 'dropdown', 'heading' => __('Align', 'js_composer'), 'param_name' => 'align', 'value' => array(__('left', 'js_composer') => 'left', __('right', 'js_composer') => 'right', __('center', 'js_composer') => 'center', __('justify', 'js_composer') => 'justify'), 'description' => __('Select alignment.', 'js_composer')), array('type' => 'textfield', 'heading' => __('Extra class name', 'js_composer'), 'param_name' => 'el_class', 'description' => __('Style particular content element differently - add a class name and refer to it in custom CSS.', 'js_composer'))), 'post_type' => Vc_Grid_Item_Editor::postType()));
コード例 #7
0
/**
 * Gte woocommerce data for order
 *
 * @param $value
 * @param $data
 *
 * @return string
 */
function vc_gitem_template_attribute_woocommerce_order($value, $data)
{
    $label = '';
    /**
     * @var null|Wp_Post $post ;
     * @var string $data ;
     */
    extract(array_merge(array('post' => null, 'data' => ''), $data));
    require_once WC()->plugin_path() . '/includes/class-wc-order.php';
    $order = new WC_Order($post->ID);
    if (preg_match('/_labeled$/', $data)) {
        $data = preg_replace('/_labeled$/', '', $data);
        $label = apply_filters('vc_gitem_template_attribute_woocommerce_order_' . $data . '_label', Vc_Vendor_Woocommerce::getOrderFieldLabel($data) . ': ');
    }
    switch ($data) {
        case 'id':
            $value = $order->id;
            break;
        case 'order_number':
            $value = $order->get_order_number();
            break;
        case 'total':
            $value = sprintf(get_woocommerce_price_format(), wc_format_decimal($order->get_total(), 2), $order->order_currency);
            break;
        case 'payment_method':
            $value = $order->payment_method_title;
            break;
        case 'billing_address_city':
            $value = $order->billing_city;
            break;
        case 'billing_address_country':
            $value = $order->billing_country;
            break;
        case 'shipping_address_city':
            $value = $order->shipping_city;
            break;
        case 'shipping_address_country':
            $value = $order->shipping_country;
            break;
        default:
            $value = $order->{$data};
    }
    return strlen($value) > 0 ? $label . apply_filters('vc_gitem_template_attribute_woocommerce_order_' . $data . '_value', $value) : '';
}
コード例 #8
0
<?php

/**
 * @since 4.4 vendors initialization moved to hooks in autoload/vendors.
 *
 * Used to initialize plugin woocommerce vendor. (adds tons of woocommerce shortcodes and some fixes)
 */
include_once ABSPATH . 'wp-admin/includes/plugin.php';
// Require plugin.php to use is_plugin_active() below
if (is_plugin_active('woocommerce/woocommerce.php')) {
    require_once vc_path_dir('VENDORS_DIR', 'plugins/class-vc-vendor-woocommerce.php');
    $vendor = new Vc_Vendor_Woocommerce();
    $vendor->load();
}
コード例 #9
0
function porto_shortcode_products_ids_param_value($current_value, $param_settings, $map_settings, $atts)
{
    $vc_vendor_wc = new Vc_Vendor_Woocommerce();
    return $vc_vendor_wc->productsIdsDefaultValue($current_value, $param_settings, $map_settings, $atts);
}