mercredi 29 juin 2016

Telr payment gate way with wordpress

Is there any module that integrate Telr with wordpress? If yes how can I integrate? or else how can I create a new plugin from scratch to manage the payment



via Chebli Mohamed

All the data will be behind a authentication mechanism. This will I assume be built in wordpress and the same will apply to apppresser

Is there any authentication for appPresser as in Wordpress? Please explain? Thanks in Advance.



via Chebli Mohamed

WordPress shortcode displaying as plain text

we have been using a plugin on a website for over a year but for some reason the shortcode is now outputting as a plain text, so actually showing the shortcode itself. The shortcode should produce a product slider.

the plugin in question is: WPB WooCommerce Product slider

The website is: http://ift.tt/29oezrk

The entire page was created inside the WYWYG editor inclusive of the shortcodes. Im unfortunately in a position where I cant start disabling the plugins to identify if theres a conflict.

I have been looking all over the web, I did check out the shortcodes.php file thats included witihn the plugin and I can see in there:

add_shortcode('wpb-latest-product', 'wpb_wps_shortcode');

if( !function_exists( 'wpb_wps_shortcode' ) ):
    function wpb_wps_shortcode($atts){
        extract(shortcode_atts(array(
            'title' => __( 'Latest Products','wpb-wps' ),
        ), $atts));

        $return_string = '<div class="wpb_slider_area wpb_fix_cart">';
        $return_string .= '<h3 class="wpb_area_title">'.$title.'</h3>';
        $return_string .= '<div id="wpb-wps-latest" class="wpb-wps-wrapper owl-carousel '.wpb_ez_get_option( "wpb_slider_type_gen_lat", "wpb_wps_style", "grid cs-style-3" ).'">';

        $args = array(
            'post_type'         => 'product',
            'posts_per_page'    => wpb_ez_get_option( 'wpb_num_pro', 'wpb_wps_general', 12 )
        );

        $loop = new WP_Query( $args );

        if ( $loop->have_posts() ) {
            while ( $loop->have_posts() ) : $loop->the_post();
                global $post, $product;
                $return_string .= '<div class="item">';
                $return_string .= '<figure>';           
                $return_string .= '<a href="'.get_permalink().'" class="wpb_pro_img_url">';
                if (has_post_thumbnail( $loop->post->ID )){
                    $return_string .= get_the_post_thumbnail($loop->post->ID, 'shop_catalog', array('class' => "wpb_pro_img"));
                }else{
                    $return_string .= '<img id="place_holder_thm" src="'.woocommerce_placeholder_img_src().'" alt="Placeholder" />';
                }
                $return_string .='</a>';
                $return_string .='<figcaption>';
                $return_string .='<h3 class="pro_title">';
                if (strlen($post->post_title) > 20) {
                    $return_string .= substr(the_title($before = '', $after = '', FALSE), 0, wpb_ez_get_option( 'wpb_title_mx_ch', 'wpb_wps_style', 10 )) . '...';
                }else{
                    $return_string .= get_the_title();
                }
                $return_string .='</h3>';
                if( $price_html = $product->get_price_html() ){
                    $return_string .='<div class="pro_price_area">'. $price_html .'</div>';
                }
                $return_string .= '<div class="wpb_wps_cart_button"><a href="'.esc_url( $product->add_to_cart_url() ).'" rel="nofollow" data-product_id="'.esc_attr( $product->id ).'" data-product_sku="'.esc_attr( $product->get_sku() ).'" data-quantity="'.esc_attr( isset( $quantity ) ? $quantity : 1 ).'" class="button '. ($product->is_purchasable() && $product->is_in_stock() ? 'add_to_cart_button' : '') .' product_type_'.esc_attr( $product->product_type ).'">'.esc_html( $product->add_to_cart_text()).'</a></div>';
                $return_string .='</figcaption>';
                $return_string .= '</figure>';
                $return_string .= '</div>';
            endwhile;
        } else {
            echo __( 'No products found','wpb-wps' );
        }
        wp_reset_postdata();
        $return_string .= '</div>';
        $return_string .= '</div>';
        wp_reset_query();
        return $return_string;   
    }
endif;

The shortcode I am using is [wpb-latest-product title=”Latest Product”]

I am seeing if anyone else has encountered this? Or what the best steps are to diagnose such issues.

Also, I tried adding the shortcode in the 'text' tab rather than the 'visual' tab but had no effect.



via Chebli Mohamed

WordPress tinymce default link's target

I'm trying to edit the WordPress TinyMCE editor so all the links has the target = "_blank". I've tried with jquery to set the 'Open link in new tab' checkbox to be always checked but, no results. Thank you



via Chebli Mohamed

Match XML elements that contain 'X'

I'm using the WP-Property and WP-Property: Importer plugins to manage properties on a WordPress powered website. The importer uses xpath rules to help map fields in an imported XML file to their corresponding field on the site.

e.g. 'Display Address' maps to 'address/full'

I have a set of elements that look like this:

<property>
    <feature1>Feature</feature>
    <feature2>Feature</feature>
    <feature3>Feature</feature>
    <feature4>Feature</feature>
    <feature5>Feature</feature>
    <address>
        <full>abc</full>
        <street>def</street>
        <postcode>ghi</postcode>
    </address>
</property>

I want to group these together into one entry rather than setting up separate fields for each one, so I'm looking for a means to match feature* but everything I've tried so far seems to have missed the mark. Goes without saying that I've never dabbled with xpath before today!



via Chebli Mohamed

How do I show product thumbnails in Woocommerce search results?

The default Woocommerce search input I'm using is:

<div class="postcode-search col-lg-4 col-lg-offset-4">

  <input type='textbox' name="s" class="form-control form-inline" style="display: inline;" id="item-search" value="<?php the_search_query();?>" placeholder="Enter your postcode"/>
  <span class="input-group-btn">
    <button class="item-search-btn"><span class="">find stores</span></button>
  </span>
  <?php
    if ( function_exists( 'woocommerce_product_search' ) ) {
      echo woocommerce_product_search( array( 'limit' => 40 ) );
    }
  ?>

</div>

The problem I'm having is that the results page displays the text and the 'leave a comment' link below: enter image description here

Whereas I want the results to be displayed with the thumbnail as such: enter image description here

Does anyone know how I can achieve this result? All suggestions welcome and thank you in advance!



via Chebli Mohamed

How do I programmatically apply a coupon in Woocommerce for first order made by a customer?

In Woocommerce I'm trying to find a way to apply a 20% discount to the first order made by a new customer. It appears that I can use the functions woocommerce_after_checkout_validation and check_new_customer_coupon to do this but it doesn't work.

Here is my code from function.php:

add_action('woocommerce_after_checkout_validation','check_new_customer_coupon', 0);

function check_new_customer_coupon(){
    global $woocommerce;
    // you might change the name of your coupon
    $new_cust_coupon_code = 'test';

    $has_apply_coupon = false;

    foreach ( WC()->cart->get_coupons() as $code => $coupon ) {
        if($code == $new_cust_coupon_code) {
            $has_apply_coupon = true;
        }
    }

    if($has_apply_coupon) {

        if(is_user_logged_in()) {
            $user_id = get_current_user_id();

            // retrieve all orders
            $customer_orders = get_posts( array(
                    'meta_key'    => '_customer_user',
                    'meta_value'  => $user_id,
                    'post_type'   => 'shop_order',
                    'numberposts'=> -1
            ) );

            if(count($customer_orders) > 0) {
                $has_ordered = false;

                $statuses = array('wc-failed', 'wc-cancelled', 'wc-refunded');

                // loop thru orders, if the order is not falled into failed, cancelled or refund then it consider valid
                foreach($customer_orders as $tmp_order) {

                    $order = wc_get_order($tmp_order->ID);
                    if(!in_array($order->get_status(), $statuses)) {
                        $has_ordered = true;
                    }
                }

                // if this customer already ordered, we remove the coupon
                if($has_ordered == true) {
                    WC()->cart->remove_coupon( $new_cust_coupon_code );
                    wc_add_notice( sprintf( "Coupon code: %s is only applicable for new customer." , $new_cust_coupon_code), 'error' );
                    return false;
                }
            } else {
                // customer has no order, so valid to use this coupon
                return true;
            }

        } else {
            // new user is valid
            return true;
        }
    }

}



via Chebli Mohamed