Forum Replies Created

Viewing 15 replies - 1 through 15 (of 20 total)
  • Thread Starter iygen

    (@iygen)

    I get this error :
    Parse error: syntax error, unexpected ‘[‘ in /…/portfolio-manager-powered-by-behance/classes/eds-bpm-behance.php on line 69

    Thread Starter iygen

    (@iygen)

    I recieve this problem.
    Install plug-in Category SEO Meta Tags. Enable it. After this – change All-in-One seo plugin.

    Open “aioseop_class.php”.

    change function rewrite_title

    function rewrite_title( $header ) {
    		global $wp_query;
    		if ( ! $wp_query ) {
    			$header .= "<!-- no wp_query found! -->\n";
    
    			return $header;
    		}
    		if (is_product_category()) { } else {
    		$title = $this->wp_title();
    		if ( ! empty( $title ) ) {
    			$header = $this->replace_title( $header, $title );
    		}
    		}
    		return $header;
    	}

    find 3804 function wp_head()

    change on:

    function wp_head() {
    		if ( ! $this->is_page_included() ) {
    			return;
    		}
    		$opts = $this->meta_opts;
    		global $aioseop_update_checker, $wp_query, $aioseop_options, $posts;
    		static $aioseop_dup_counter = 0;
    		$aioseop_dup_counter ++;
    		if ( $aioseop_dup_counter > 1 ) {
    			echo "\n<!-- " . sprintf( __( 'Debug Warning: All in One SEO Pack meta data was included again from %s filter. Called %s times!', 'all-in-one-seo-pack' ), current_filter(), $aioseop_dup_counter ) . " -->\n";
    
    			return;
    		}
    		if ( is_home() && ! is_front_page() ) {
    			$post = aiosp_common::get_blog_page();
    		} else {
    			$post = $this->get_queried_object();
    		}
    		$meta_string = null;
    		$description = '';
    		// Logging - rewrite handler check for output buffering.
    		$this->check_rewrite_handler();
    		if ( AIOSEOPPRO ) {
    			//echo "\n<!-- All in One SEO Pack Pro $this->version by Michael Torbert of Semper Fi Web Design";
    		} else {
    			//echo "\n<!-- All in One SEO Pack $this->version by Michael Torbert of Semper Fi Web Design";
    		}
    		if ( $this->ob_start_detected ) {
    			echo 'ob_start_detected ';
    		}
    		//echo "[$this->title_start,$this->title_end] ";
    		//echo "-->\n";
    		if ( AIOSEOPPRO ) {
    			echo '<!-- ' . __( 'Debug String', 'all-in-one-seo-pack' ) . ': ' . $aioseop_update_checker->get_verification_code() . " -->\n";
    		}
    		$blog_page  = aiosp_common::get_blog_page( $post );
    		$save_posts = $posts;
    		if ( function_exists( 'woocommerce_get_page_id' ) && is_post_type_archive( 'product' ) && ( $post_id = woocommerce_get_page_id( 'shop' ) ) && ( $post = get_post( $post_id ) ) ) {
    			global $posts;
    			$opts    = $this->meta_opts = $this->get_current_options( array(), 'aiosp', null, $post );
    			$posts   = array();
    			$posts[] = $post;
    		}
    		$posts       = $save_posts;
    		$description = apply_filters( 'aioseop_description', $this->get_main_description( $post ) );    // Get the description.
    		// Handle the description format.
    		if ( isset( $description ) && ( $this->strlen( $description ) > $this->minimum_description_length ) && ! ( is_front_page() && is_paged() ) ) {
    			$description = $this->trim_description( $description );
    			if ( ! isset( $meta_string ) ) {
    				$meta_string = '';
    			}
    			// Description format.
    			$description = apply_filters( 'aioseop_description_full', $this->apply_description_format( $description, $post ) );
    			$desc_attr   = '';
    			if ( ! empty( $aioseop_options['aiosp_schema_markup'] ) ) {
    				$desc_attr = 'itemprop="description"';
    			}
    			$desc_attr = apply_filters( 'aioseop_description_attributes', $desc_attr );
    			if (is_product_category()) { } else {
    			$meta_string .= sprintf( "<meta name=\"description\" %s content=\"%s\" />\n", $desc_attr, $description );}
    		}
    		// Get the keywords.
    		$togglekeywords = 0;
    		if ( isset( $aioseop_options['aiosp_togglekeywords'] ) ) {
    			$togglekeywords = $aioseop_options['aiosp_togglekeywords'];
    		}
    		if ( $togglekeywords == 0 && ! ( is_front_page() && is_paged() ) ) {
    			$keywords = $this->get_main_keywords();
    			$keywords = $this->apply_cf_fields( $keywords );
    			$keywords = apply_filters( 'aioseop_keywords', $keywords );
    
    			if ( isset( $keywords ) && ! empty( $keywords ) ) {
    				if ( isset( $meta_string ) ) {
    					$meta_string .= "\n";
    				}
    				$keywords = wp_filter_nohtml_kses( str_replace( '"', '', $keywords ) );
    				$key_attr = '';
    				if ( ! empty( $aioseop_options['aiosp_schema_markup'] ) ) {
    					$key_attr = 'itemprop="keywords"';
    				}
    				$key_attr = apply_filters( 'aioseop_keywords_attributes', $key_attr );
    				$meta_string .= sprintf( "<meta name=\"keywords\" %s content=\"%s\" />\n", $key_attr, $keywords );
    			}
    		}
    		// Handle noindex, nofollow - robots meta.
    		$robots_meta = apply_filters( 'aioseop_robots_meta', $this->get_robots_meta() );
    		if ( ! empty( $robots_meta ) ) {
    			$meta_string .= '<meta name="robots" content="' . esc_attr( $robots_meta ) . '" />' . "\n";
    		}
    		// Handle site verification.
    		if ( is_front_page() ) {
    			foreach (
    				array(
    					'google'    => 'google-site-verification',
    					'bing'      => 'msvalidate.01',
    					'pinterest' => 'p:domain_verify',
    				) as $k => $v
    			) {
    				if ( ! empty( $aioseop_options["aiosp_{$k}_verify"] ) ) {
    					$meta_string .= '<meta name="' . $v . '" content="' . trim( strip_tags( $aioseop_options["aiosp_{$k}_verify"] ) ) . '" />' . "\n";
    				}
    			}
    
    			// Sitelinks search.
    			if ( ! empty( $aioseop_options['aiosp_google_sitelinks_search'] ) || ! empty( $aioseop_options['aiosp_google_set_site_name'] ) ) {
    				$meta_string .= $this->sitelinks_search_box() . "\n";
    			}
    		}
    		// Handle extra meta fields.
    		foreach ( array( 'page_meta', 'post_meta', 'home_meta', 'front_meta' ) as $meta ) {
    			if ( ! empty( $aioseop_options["aiosp_{$meta}_tags"] ) ) {
    				$$meta = html_entity_decode( stripslashes( $aioseop_options["aiosp_{$meta}_tags"] ), ENT_QUOTES );
    			} else {
    				$$meta = '';
    			}
    		}
    		if ( is_page() && isset( $page_meta ) && ! empty( $page_meta ) && ( ! is_front_page() || empty( $front_meta ) ) ) {
    			if ( isset( $meta_string ) ) {
    				$meta_string .= "\n";
    			}
    			$meta_string .= $page_meta;
    		}
    		if ( is_single() && isset( $post_meta ) && ! empty( $post_meta ) ) {
    			if ( isset( $meta_string ) ) {
    				$meta_string .= "\n";
    			}
    			$meta_string .= $post_meta;
    		}
    		// Handle authorship.
    		$authorship = $this->get_google_authorship( $post );
    		$publisher  = apply_filters( 'aioseop_google_publisher', $authorship['publisher'] );
    		if ( ! empty( $publisher ) ) {
    			$meta_string = '<link rel="publisher" href="' . esc_url( $publisher ) . '" />' . "\n" . $meta_string;
    		}
    		$author = apply_filters( 'aioseop_google_author', $authorship['author'] );
    		if ( ! empty( $author ) ) {
    			$meta_string = '<link rel="author" href="' . esc_url( $author ) . '" />' . "\n" . $meta_string;
    		}
    
    		if ( is_front_page() && ! empty( $front_meta ) ) {
    			if ( isset( $meta_string ) ) {
    				$meta_string .= "\n";
    			}
    			$meta_string .= $front_meta;
    		} else {
    			if ( is_home() && ! empty( $home_meta ) ) {
    				if ( isset( $meta_string ) ) {
    					$meta_string .= "\n";
    				}
    				$meta_string .= $home_meta;
    			}
    		}
    		$prev_next = $this->get_prev_next_links( $post );
    		$prev      = apply_filters( 'aioseop_prev_link', $prev_next['prev'] );
    		$next      = apply_filters( 'aioseop_next_link', $prev_next['next'] );
    		if ( ! empty( $prev ) ) {
    			$meta_string .= "<link rel='prev' href='" . esc_url( $prev ) . "' />\n";
    		}
    		if ( ! empty( $next ) ) {
    			$meta_string .= "<link rel='next' href='" . esc_url( $next ) . "' />\n";
    		}
    		if ( $meta_string != null ) {
    			echo "$meta_string\n";
    		}
    
    		// Handle canonical links.
    		$show_page = true;
    		if ( ! empty( $aioseop_options['aiosp_no_paged_canonical_links'] ) ) {
    			$show_page = false;
    		}
    
    		if ( $aioseop_options['aiosp_can'] ) {
    			$url = '';
    			if ( ! empty( $aioseop_options['aiosp_customize_canonical_links'] ) && ! empty( $opts['aiosp_custom_link'] ) ) {
    				$url = $opts['aiosp_custom_link'];
    			}
    			if ( empty( $url ) ) {
    				$url = $this->aiosp_mrt_get_url( $wp_query, $show_page );
    			}
    
    			$url = $this->validate_url_scheme( $url );
    
    			$url = apply_filters( 'aioseop_canonical_url', $url );
    			if ( ! empty( $url ) ) {
    				echo '<link rel="canonical" href="' . esc_url( $url ) . '" />' . "\n";
    			}
    		}
    		do_action( 'aioseop_modules_wp_head' );
    		if ( AIOSEOPPRO ) {
    			echo "<!-- /all in one seo pack pro -->\n";
    		} else {
    			echo "<!-- /all in one seo pack -->\n";
    		}
    	}
    Thread Starter iygen

    (@iygen)

    They answer can’t install in server, only this path. So, i can only use vps to let this plugin work. Thank you for your help and fast answers.

    Thread Starter iygen

    (@iygen)

    i some mistake when write path.
    Real way like: /home/c/appserv/domain.ru/public_html/wp-content/ewww/

    So path to install utility was .local/bin/

    Thread Starter iygen

    (@iygen)

    yes,thats right.

    Thread Starter iygen

    (@iygen)

    They use this path: ~/.local/bin

    Thread Starter iygen

    (@iygen)

    Thank you, problem resolved.

    Thread Starter iygen

    (@iygen)

    Yes, i mean this theme

    maybe can try add to quantity + and -, it can be recieve some problmes. And try use for quantity input attribute disabled

    Here is recieve problem: theme.

    Thread Starter iygen

    (@iygen)

    This code recieve problems with script:
    1.Hide totals in some themes;
    2.Problems with errors (sometime can happens when push update cart). More better just hide this button.

    Full code.
    wooajaxcart.php

    <?php
    /*
      Plugin Name: Woo AJAX Cart
      Plugin URI: https://ragob.com/wooajaxcart
      Description: Change the default behavior of WooCommerce Cart page, making AJAX requests when quantity field changes
      Version: 1.2
      Author: Ygen Modify, author - Moises Heberle
      Author URI: https://codecanyon.net/user/moiseh
     */
    
    // templates reference: cart.php , cart-totals.php
    
    add_action('init', 'wac_init');
    function wac_init() {
        // force to make is_cart() returns true, to make right calculations on class-wc-cart.php (WC_Cart::calculate_totals())
        // this define fix a bug that not show Shipping calculator when is WAC ajax request
        if ( !empty($_POST['is_wac_ajax']) && !defined( 'WOOCOMMERCE_CART' ) ) {
            define( 'WOOCOMMERCE_CART', true );
        }
    }
    
    add_action('woocommerce_before_cart_contents', 'wac_cart_demo');
    function wac_cart_demo() {
        if ( defined('IS_DEMO')) {
            wac_demo_msg('Change the product quantity to see the AJAX update made by WooAjaxCart plugin');
        }
    }
    
    add_action('woocommerce_archive_description', 'wac_shop_demo');
    function wac_shop_demo() {
        if ( defined('IS_DEMO')) {
            wac_demo_msg('Add some items to cart and go to the "Cart" page to see this plugin in action');
        }
    }
    
    // on submit AJAX form of the cart
    // after calculate cart form items
    add_action('woocommerce_cart_updated', 'wac_update');
    function wac_update() {
        // is_wac_ajax: flag defined on wooajaxcart.js
    
        if ( !empty($_POST['is_wac_ajax'])) {
            $resp = array();
            $resp['update_label'] = __( 'Update Cart', 'woocommerce' );
            $resp['checkout_label'] = __( 'Proceed to Checkout', 'woocommerce' );
            $resp['price'] = 0;
    
            // render the cart totals (cart-totals.php)
            ob_start();
            do_action( 'woocommerce_after_cart_table' );
            do_action( 'woocommerce_cart_collaterals' );
            do_action( 'woocommerce_after_cart' );
            $resp['html'] = ob_get_clean();
            $resp['price'] = 0;
            $resp['total'] = 0;
    
            // calculate the item price
            if ( !empty($_POST['cart_item_key']) ) {
                $items = WC()->cart->get_cart();
    	    $total = WC()->cart->get_cart_total();
                $cart_item_key = $_POST['cart_item_key'];
    
                if ( array_key_exists($cart_item_key, $items)) {
                    $cart_item = $items[$cart_item_key];
                    $_product = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key );
                    $price = apply_filters( 'woocommerce_cart_item_subtotal', WC()->cart->get_product_subtotal( $_product, $cart_item['quantity'] ), $cart_item, $cart_item_key );
                    $resp['price'] = $price;
                }
            }
    
            $total = apply_filters( 'woocommerce_cart_item_total', WC()->cart->get_cart_total());
            $resp['total'] = $total;
    
            echo json_encode($resp);
            exit;
        }
    }
    
    // on render cart table page
    add_action('woocommerce_before_cart_table', 'wac_cart_table');
    function wac_cart_table() {
        // add js hacks script
        wp_register_script('wooajaxcart', plugins_url('wooajaxcart2.js', __FILE__));
        wp_enqueue_script('wooajaxcart');
    }
    
    function wac_demo_msg($text) {
        echo sprintf('<div style="background-color: lightgreen; padding: 5px; margin: 5px; border-radius: 3px">* %s</div>', $text);
    }

    wooajaxcart2:

    jQuery(document).ready(function($){
        $('.qty').on('change', function(){
            form = $(this).closest('form');
    
            // emulates button Update cart click
            $("<input type='hidden' name='update_cart' id='update_cart' value='1'>").appendTo(form);
    
            // plugin flag
            $("<input type='hidden' name='is_wac_ajax' id='is_wac_ajax' value='1'>").appendTo(form);
    
            el_qty = $(this);
            matches = $(this).attr('name').match(/cart\[(\w+)\]/);
            cart_item_key = matches[1];
            form.append( $("<input type='hidden' name='cart_item_key' id='cart_item_key'>").val(cart_item_key) );
    
            // get the form data before disable button...
            formData = form.serialize();
    
            $("input[name='update_cart']").val('Обновление…');
            //$("input[name='update_cart']").val('Updating…').prop('disabled', true);
            //$("a.checkout-button.wc-forward").addClass('disabled').html('Updating…');
    
            $.post( form.attr('action'), formData, function(resp) {
                // ajax response
                //$('.cart-collaterals').html(resp.html);
                $('.totalik').html(resp.total);
    
                el_qty.closest('.cart_item').find('.product-subtotal').html(resp.price);
                el_qty.closest('.totalik').find('.amount').html(resp.total);
    
                $('#update_cart').remove();
                $('#is_wac_ajax').remove();
                $('#cart_item_key').remove();
    
                $("input[name='update_cart']").val('Пересчитать корзину');
    
                //$("a.checkout-button.wc-forward").removeClass('disabled').html(resp.checkout_label);
    
                // when changes to 0, remove the product from cart
                if ( el_qty.val() == 0 ) {
                    el_qty.closest('tr').remove();
                }
            },
            'json'
            );
        });
    });

    add in your cart.php theme code to show totals:
    <div><h3>Total: <div style='float:right;' class='totalik'>?<?php wc_cart_totals_order_total_html(); ?></div></h3></div>

    Thread Starter iygen

    (@iygen)

    I recieve problem with hide total.
    In my theme total hide, i change place of it more up (before time be in class “row”). All class row is hide.

    How to update totals:

    // calculate the item price
            if ( !empty($_POST['cart_item_key']) ) {
                $items = WC()->cart->get_cart();
    	    $total = WC()->cart->get_cart_total();
                $cart_item_key = $_POST['cart_item_key'];
    
                if ( array_key_exists($cart_item_key, $items)) {
                    $cart_item = $items[$cart_item_key];
                    $_product = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key );
                    $price = apply_filters( 'woocommerce_cart_item_subtotal', WC()->cart->get_product_subtotal( $_product, $cart_item['quantity'] ), $cart_item, $cart_item_key );
                    $resp['price'] = $price;
                }
            }
    
    <strong>        $total = apply_filters( 'woocommerce_cart_item_total', WC()->cart->get_cart_total());
            $resp['total'] = $total;</strong>

    after:
    el_qty.closest(‘.cart_item’).find(‘.product-subtotal’).html(resp.price)
    add:
    $(‘.amount’).html(resp.total);
    el_qty.closest(‘.amount’).html(resp.total);

    How to recieve problem when push button update change on error:
    change:
    $(“input[name=’update_cart’]”).val(‘Update’);
    //$(“a.checkout-button.wc-forward”).removeClass(‘disabled’).html(resp.checkout_label);

    Thread Starter iygen

    (@iygen)

    resolved. can use another page:
    my-account/edit-address/shipping/
    my-account/edit-address/billing/

    i use my-account/edit-address/

    Thread Starter iygen

    (@iygen)

    recieve problem use jquery

    Thread Starter iygen

    (@iygen)

    ok, thank you. But if update will have many mistakes. I try install in other server, thanks for help.

Viewing 15 replies - 1 through 15 (of 20 total)