• Resolved word45press

    (@word45press)


    Hello.
    Is it possible to add hooks in wcff_builder.php?
    Currently, on line 1336, it is as follows.
    It’s hard to rewrite every update, so if it’s possible to add a hook, I’d like to ask.

    Thank you very much

    This post uses Google Translate. I’m sorry if I sound rude.

    $search_word = $_SESSION['code'];
            $ks_valle = '';
            if (($handle = fopen('wp-content/themes/lightning_child/con_info01.csv', 'r')) !== false) {
                while (($data01 = fgetcsv($handle, 1000, ',')) !== false) {
                    $date = new DateTime();
                    $date->setTimeZone(new DateTimeZone('Asia/Tokyo'));
                    $todaytime = $date->format('Y-m-d G:i');
                    $eventtime = $data01[6];
                    if ($data01[0] == $search_word) {
                        if (strtotime($todaytime) > strtotime($eventtime)) {
                            $ks_valle = '';
                        } else {
                            if (esc_attr($_meta['name']. $_index == 'wccpf_fie_mosyumei'. $_index)) {
                                $ks_valle = $data01[5].' 様';
                            }
                            if (esc_attr($_meta['name']. $_index == 'wccpf_fie_kojinmei'. $_index)) {
                                $ks_valle = $data01[1].' 様';
                            }
                            if (esc_attr($_meta['name']. $_index == 'wccpf_fie_sikijyou'. $_index)) {
                                $ks_valle = $data01[9];
                            }
                            if (esc_attr($_meta['name']. $_index == 'wccpf_fie_funeral_code'. $_index)) {
                                $ks_valle = $data01[0];
                            }
                        }
                    }
                }
                fclose($handle);
            }
            $attrs = 'readonly value="'.$ks_valle.'" '.'name="'. esc_attr($_meta["name"] . $_index) .'" data-fkey="'. $_meta["key"] .'" '. $placeholder .' data-mandatory="' . $_meta["required"] . '" '. $_readonly .' data-field-type="'. $_meta["type"] .'" autocomplete="off" ';
Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Contributor Sark

    (@sarkware)

    Got it, I will include something like below, from next release onwards.

    $attrs = ' name="'. esc_attr($_meta["name"] . $_index) .'" data-fkey="'. $_meta["key"] .'" '. $placeholder .' data-mandatory="' . $_meta["required"] . '" '. $_readonly .' data-field-type="'. $_meta["type"] .'" autocomplete="off" ';
    if (has_filter('wccpf_before_preparing_common_attrs')) {
          $attrs = apply_filters('wccpf_before_preparing_common_attrs', $attrs, $_meta, $_ptype);
    }

    Let me know if anything needs to be updated.

    Thread Starter word45press

    (@word45press)

    good morning. Thank you for your response.
    Added the following to update

    if (has_filter(‘wccpf_before_preparing_common_attrs’)) {
    $attrs = apply_filters(‘wccpf_before_preparing_common_attrs’, $attrs, $_meta, $_ptype);
    }

    It worked fine. Now you can easily make future updates. Thank you.

    Thread Starter word45press

    (@word45press)

    It worked fine. Now you can easily make future updates. Thank you.

    By the way, do you have any plans to send gifts to multiple destinations in the future?

    The function of Cloning.? is very helpful. It would be helpful if there are multiple shipping addresses. Thank you very much.

    Thread Starter word45press

    (@word45press)

    excuse me. I thought it worked, but it didn’t. The display is properly done, but when I press the add to cart button, an unfilled alert appears and I can not move to the cart screen.Set Required to No to proceed to the next step.What’s wrong?

    function wccpf_before_preparing_common_attrs_my_func($attrs, $_meta, $_ptype) {
        $search_word = $_SESSION['code'];
        $ks_valle = '';
        if (($handle = fopen('wp-content/themes/lightning_child/con_info01.csv', 'r')) !== false) {
            while (($data01 = fgetcsv($handle, 1000, ',')) !== false) {
                $date = new DateTime();
                $date->setTimeZone(new DateTimeZone('Asia/Tokyo'));
                $todaytime = $date->format('Y-m-d G:i');
                $eventtime = $data01[6];
                if ($data01[0] == $search_word) {
                    if (strtotime($todaytime) > strtotime($eventtime)) {
                        $ks_valle = '';
                    } 
                    else {
                        if (esc_attr($_meta['name']. $_index == 'wccpf_fie_mosyumei'. $_index)) {
                            $ks_valle = $data01[5].' 様';
                        }
                        if (esc_attr($_meta['name']. $_index == 'wccpf_fie_kojinmei'. $_index)) {
                            $ks_valle = $data01[1].' 様';
                        }
                        if (esc_attr($_meta['name']. $_index == 'wccpf_fie_sikijyou'. $_index)) {
                            $ks_valle = $data01[9];
                        }
                        if (esc_attr($_meta['name']. $_index == 'wccpf_fie_funeral_code'. $_index)) {
                            $ks_valle = $data01[0];
                        }
                    }
                }
            }
            fclose($handle);
        }
        $attrs = 'readonly value="'.$ks_valle.'" '.'name="'. esc_attr($_meta["name"] . $_index) .'" data-fkey="'. $_meta["key"] .'" '. $placeholder .' data-mandatory="' . $_meta["required"] . '" '. $_readonly .' data-field-type="'. $_meta["type"] .'" autocomplete="off" ';
    
        return $attrs;
    }
    add_filter( 'wccpf_before_preparing_common_attrs','wccpf_before_preparing_common_attrs_my_func',10,3 );
    Thread Starter word45press

    (@word45press)

    I’m sorry, and at the time of cloning.?, it was displayed at first, but when I increased the quantity and cloned, it was not displayed.
    What is the problem?

    Plugin Contributor Sark

    (@sarkware)

    Is it possible to share the product url.? so that I can test.

    Thread Starter word45press

    (@word45press)

    Good morning Sark.
    still in development. We are developing locally by flywheel. I can view it with a live link, but I would like to send the username and password to Mr. Sark’s personal email address.

    Plugin Contributor Sark

    (@sarkware)

    In the above snippet you shared, $_index parameter is missing, pls update the apply_filters on the wcff_builder.php as follows.

    $attrs = ' name="'. esc_attr($_meta["name"] . $_index) .'" data-fkey="'. $_meta["key"] .'" '. $placeholder .' data-mandatory="' . $_meta["required"] . '" '. $_readonly .' data-field-type="'. $_meta["type"] .'" autocomplete="off" ';
    if (has_filter('wccpf_before_preparing_common_attrs')) {
          $attrs = apply_filters('wccpf_before_preparing_common_attrs', $attrs, $_meta, $_ptype, $_index);
    }

    Just added the $_index parameter when applying the filter.
    now in your filter handler add the $_index param like the below

    function wccpf_before_preparing_common_attrs_my_func($attrs, $_meta, $_ptype, $_index)

    Thread Starter word45press

    (@word45press)

    Good morning Sark.
    Thank you very much

    I no longer get an unfilled alert when I press the add to cart button. It went well.

    But when I increase the quantity, it disappears after cloning. The second and subsequent items are not displayed. Looking at the html source, it is value=”aaaaa”. for some reason it is not displayed.

    https://www.keizu-studio.com/wp-content/uploads/2022/09/2022-09-15-01.jpg

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘About wcff_builder.php’ is closed to new replies.