Forum Replies Created

Viewing 15 replies - 16 through 30 (of 31 total)
  • Thread Starter Tii

    (@tii)

    ok, found the issue, it was a settings in my theme that was not overridden.

    Thread Starter Tii

    (@tii)

    I found the solution following this documentation : https://developers.elementor.com/dynamic-tags/

    which indicates

    For URL, Image, Media and Gallery controls, you need to extend Elementor\Core\DynamicTags\Data_Tag instead.
    There are many types of controls you can add to your widget to make it easier to configure. We have a separate section with a full list of available controls.

    Thread Starter Tii

    (@tii)

    @flourishprosper
    Yes, I’m using Cloudflare but I could reproduce the problem in a local environment so I do not believe it is related.

    Thread Starter Tii

    (@tii)

    @egfwill your issue has nothing to do with cart persistance…

    Thread Starter Tii

    (@tii)

    right now, I have disabled the persistant cart like this :

    function d6_remove_persistent_cart($value, $id, $key) {
        if ($key == '_woocommerce_persistent_cart_1') {
            return false;
        }
        return $value;
    }
    add_filter('get_user_metadata', 'd6_remove_persistent_cart', 10, 3);
    add_filter('update_user_metadata', 'd6_remove_persistent_cart', 10, 3);
    add_filter('add_user_metadata', 'd6_remove_persistent_cart', 10, 3);

    but I would like to re-activate it at one point…

    Thread Starter Tii

    (@tii)

    I have been testing and experimenting and I could finally point out the issue.

    The problem occurs when the order is in a language different than the default one and the order is processed thru a IPN call. Then, the Stock class wrongly update the stocks.

    I managed to fix the issue by removing these lines in Stock.php

    $productID = Utilities::get_order_item_productid($item);
    $productObject = wc_get_product($productID);

    Somehow, when called thru IPN, the get_order_item_productid function returns the product id of the default language product instead of the selected product.

    I checked the wc-stock-function.php and changed thos two lines by this:

    $productObject = $item->get_product();
    $productID = $productObject->get_id();

    Then, I removed the

    unset($translations[$orderLang]);

    and simply skipped the current product in the translations loop:

    if ($ID == $productID) continue;

    And now, everything is working as expected.

    • This reply was modified 8 years, 5 months ago by Tii.
    Thread Starter Tii

    (@tii)

    Thanks for the answer but I am the host.
    The website is running on a VPS with LEMP. The only cache in places are:
    – nginx fast cgi
    – cloudflare
    – object-cache
    I tried to find the problem and I could easily reproduce it in my local environment without any cache activated.
    Here a the reproduction steps:
    – Connect with user A from browser A
    – Add a product in cart with user A
    – Open Browser B
    – Login with user B
    – Add a product in cart with user B
    – Clear all cookies and Browser storage in Browser B
    – Login with user B
    (it does not work every time I do it but repeating the steps a few times allowed me to reproduce it every 5 times or so)

    The carts somehow merged both carts into one and adding products from one user add to the other user’s cart, checking the cookie shows me that they both have the same cart hash which explain the problem.

    I really wonder how it is possible for the cart hash to be the same without any cache activated (local development environment with WP_DEBUG on);

    Thread Starter Tii

    (@tii)

    well, I want to send email with a template and an attachment, otherwise, I’m not interested as I already have a working solution with Sendgrid.

    I’m not gonna hack my way to use Sparkpost. I understand that it’s a Sparkpost problem but, I think the plugin should inform it’s users that you cannot send an attachment with a template !

    Thread Starter Tii

    (@tii)

    Your remark was good, I removed the tmeplate and the attachment went thru !

    why is that and how can I use the template with an attachment ?

    • This reply was modified 9 years, 4 months ago by Tii.
    Thread Starter Tii

    (@tii)

    http

    Thread Starter Tii

    (@tii)

    Here is the test code I was using :

    $to = "xxx@gmail.com";
    $headers = array();
    $attachments = array();
    $from = get_option('admin_email');
    $subject = sanitize_post($_POST['subject']);
    $headers[] = 'Cc: ' . $from;
    $content = sanitize_post($_POST['content']);
    $pdf_path = ABSPATH.'/pdf/document.pdf';
    $attachments[] = $pdf_path;
    if (wp_mail($to, $subject, $content, $headers, $attachments)) {
    	echo "SENT";
    }

    but, as I said, the attachment showed up in the json and, this code is working with the sendgird plugin so it seems to me like I attached it correctly…

    Thread Starter Tii

    (@tii)

    Hey agmartin,

    The code I provided does not manage the archive pages. In the function tii_pll_exclude_category, my “filter” only applies when the system query a ‘post’ :

    $query->query_vars['post_type'] === 'post'

    So you should add a condition for your archive page, maybe the is_archive() function but then it could apply to any archive so you might have to search for the solution a little.

    If you find a way, I’m also interested to know, so would be nice too share it, maybe I’ll make a plugin out of it.

    Good luck

    Hello,

    The same problem happen to our website today.

    after a customer complain for not beeing delivered, I checked our payment gateway and this is what I see:

    Customer A checked out order 5927 and the payment failed :
    order-5927 2016-02-18 09:28:52 2-Authorisation declined

    Customer B. checked out the same order number a one minute later and the payment was accepted:
    order-160218092950-5927 2016-02-18 09:29:52 9-Payment requested

    Customer C checked out the same order number 12 seconds later !
    order-160218093001-5927 2016-02-18 09:30:04 9-Payment requested

    So this order number has been checked out 3 times and paid two !

    As result the actual order in the system is the one of Customer C so I guess the order was each time overwritten and the system saved only the last one.

    We are running the latest version of Woocommerce with Polylang, autoptimze and some internally developed plugins.

    The Server is a VPS with nginx and using fastcgi cache configured on all page except :

    – it is a post request
    – query string is set
    – page = basket, order, my-account, admin-ajax, checkout
    & some other user account related pages
    – uri = /wp-*

    I could not find any another case of this and we did not have any other complain yet, I also tried to replicate the problem without success.

    My target for this website is to make all page delivered thru cache (logged in or not) and use the woocommerce fragments ajax to update user’s related informations. All our widget are already updating that way. As Woocommerce is anyway updating fragment thru an ajax call, I believe it would be the best to centralise all user related page content updates to the ajax fragments and allow all the html to be served from cache.

    This is huge problem that should never happen and it’s kind of scary.
    If my problem would be cache related,
    first, it is odd that I had only one case with more than 300 orders made and most of these orders are placed within an hour, so there was many orders placed with few seconds of interval like our case.
    Second, what happened, how a number can be shared by users as, even if the session was shared, the order was attributed to one and then the other user, which means that she system knew who was doing the order each time and still overwrote an existing order.
    Third, it would be good to know how we can have a fully cached Woocommerce for obvious performance reasons.

    Thread Starter Tii

    (@tii)

    I found the thread, it’s not about disabling the translation for the post but instead, showing a post in all languages.

    https://wordpress.org/support/topic/plugin-polylang-all-languages-option-for-posts-and-pages?replies=39

    Anyway, I managed to do it with this simple code :

    /**
     * This Code will disable polylang for post
     *
     *  = Unilang blog with multilang pages
     *
     * !! if your post have already been localized,
     * you must delete the term_relationship to the language
     * else the permalink will be broken
     */
    
    /**
     * Disable the categories and post tags translations
     */
    add_filter('pll_get_taxonomies', 'tii_remove_taxonomies');
    function tii_remove_taxonomies($taxonomies) {
        unset($taxonomies['category'], $taxonomies['post_tag']);
        return $taxonomies;
    }
    /**
     * Disable the post translations
     */
    add_filter('pll_get_post_types', 'tii_pll_get_post_types');
    function tii_pll_get_post_types($types) {
        unset ($types['post']); // you have to replace my-cpt by the name of your custom post type
        return $types;
    }
    /**
     * If wordpress query a post,
     * remove the taxonomy filter for the language
     * allowing to show all posts
     *
     * @param $query
     */
    function tii_pll_exclude_category( $query ) {
        if (( !isset($query->query_vars['post_type']) || $query->query_vars['post_type'] === 'post') && (!isset($query->queried_object->post_type) || $query->queried_object->post_type === 'post') ) {
            if (isset($query->query_vars['tax_query'])) {
                foreach ($query->query_vars['tax_query'] as $k => $tax_query) {
                    if ($tax_query['taxonomy'] === 'language') {
                        unset($query->query_vars['tax_query'][$k]);
                    }
                }
            }
        }
    }
    add_action( 'pre_get_posts', 'tii_pll_exclude_category' );
    Thread Starter Tii

    (@tii)

    I don’t believe it’s not possible and I have seen post with people asking for this and even a solution thru a plugin (that unfortunately only works for previous versions of polylang).

    Polylang is really a great plugin but it’s really bad not to have the possibility to only use it for the post types we want and post is no exception.

Viewing 15 replies - 16 through 30 (of 31 total)