[wp] contact form 7 ใช้ร่วมกับ Line notify ได้ไหมครับ +1 ครับ

เริ่มโดย vava, 16 กุมภาพันธ์ 2021, 04:04:28

หัวข้อก่อนหน้า - หัวข้อถัดไป

0 สมาชิก และ 1 ผู้มาเยือน กำลังดูหัวข้อนี้

vava

ผมอยากทำหน้าสั่งสินค้าแบบง่ายๆ น่ะครับ คือจบหน้าเดียวเลย ลูกค้าเห็นสินค้า ถูกใจจะซื้อ ก็กรอกแบบฟอร์ม แล้วกดสั่งซื้อเลย จากนั้นให้ไลน์แจ้งเตือนเรา จะได้เข้าไปเช็คครับ

ส่วนตัวยังไม่ชอบ woo commerce ครับ เพราะลูกค้าต้องไปหลายหน้า หลายขั้นตอน ผมขายสินค้าแค่ตัวเดียว อยากให้คลิกแล้วจบเลยครับ

ถ้าทำได้รบกวนแนะนำหน่อยนะครับ ว่าต้องทำยังไง ตอนนี้ Gen Token Line มารอละ 555
+1 ทุกท่านนะครับ ขอบคุณมากครับ
[direct=http://www.somsaishop.com]สบู่ส้มใส เก็บเงินปลายทาง[/direct]
[direct=https://www.thaiwebb.com]Thaiwebb.com[/direct]
[direct=https://skin365.shop/]SKIN365[/direct]

vipone

มีครับผม เป็นปลั๊กอินของคนไทย ลองพิมหาใน google ดู

vava

อ้างถึงจาก: vipone ใน 16 กุมภาพันธ์ 2021, 08:50:01
มีครับผม เป็นปลั๊กอินของคนไทย ลองพิมหาใน google ดู
เจอแต่ของ woo commerce ครับ ไม่เจอของ contact form 7 เลย +1 แล้วนะครับ  :wanwan020:
[direct=http://www.somsaishop.com]สบู่ส้มใส เก็บเงินปลายทาง[/direct]
[direct=https://www.thaiwebb.com]Thaiwebb.com[/direct]
[direct=https://skin365.shop/]SKIN365[/direct]

thaigoodly

มันทำได้หมดครับถ้าคุณใช้ hook เป็น

เขียน functions เพิ่มไป 2 ตัวครับ

- hook contact 7 form

add_action( 'wpcf7_mail_sent', 'your_wpcf7_function' );

function your_wpcf7_function( $contact_form ) {

$id = $contact_form->id;
$title = $contact_form->title;
$submission = WPCF7_Submission::get_instance();

$posted_data = array();
if ( $submission ) {
$posted_data = $submission->get_posted_data();
}

$text = "#".$id." - ".$title."\n"."\n";
$text .="You Name: ".$posted_data['your-name']."\n";
$text .="Your Email: ".$posted_data['your-email']."\n";
$text .="Subject: ".$posted_data['your-subject']."\n";
$text .="Your Message: "."\n".$posted_data['your-message']."\n";

// LINE Notify
notify_message($text);

}


- function linenoti

   function notify_message($message) {
        $line_api = 'https://notify-api.line.me/api/notify';
        $line_token = 'your-token';

        $queryData = array('message' => $message);
        $queryData = http_build_query($queryData,'','&');
        $headerOptions = array(
            'http'=>array(
                'method'=>'POST',
                'header'=> "Content-Type: application/x-www-form-urlencoded\r\n"
                    ."Authorization: Bearer ".$line_token."\r\n"
                    ."Content-Length: ".strlen($queryData)."\r\n",
                'content' => $queryData
            )
        );
        $context = stream_context_create($headerOptions);
        $result = file_get_contents($line_api, FALSE, $context);
        $res = json_decode($result);
        return $res;
    }


iwama

มีที่ขายอยู่ที่เจอ elementor pro (ส่วนของฟอร์ม) + line noti ได้


แต่ผมลองแล้วใช้ไม่เป็น 55

อยากหาแบบ form7 เหมือนกัน แต่ยังไม่เจอที่วางขาย
ขายยยยยยยยยยยยยยยยยยยยยยยยอะไร

vava

อ้างถึงจาก: thaigoodly ใน 16 กุมภาพันธ์ 2021, 13:00:39
มันทำได้หมดครับถ้าคุณใช้ hook เป็น

เขียน functions เพิ่มไป 2 ตัวครับ

- hook contact 7 form

add_action( 'wpcf7_mail_sent', 'your_wpcf7_function' );

function your_wpcf7_function( $contact_form ) {

$id = $contact_form->id;
$title = $contact_form->title;
$submission = WPCF7_Submission::get_instance();

$posted_data = array();
if ( $submission ) {
$posted_data = $submission->get_posted_data();
}

$text = "#".$id." - ".$title."\n"."\n";
$text .="You Name: ".$posted_data['your-name']."\n";
$text .="Your Email: ".$posted_data['your-email']."\n";
$text .="Subject: ".$posted_data['your-subject']."\n";
$text .="Your Message: "."\n".$posted_data['your-message']."\n";

// LINE Notify
notify_message($text);

}


- function linenoti

   function notify_message($message) {
        $line_api = 'https://notify-api.line.me/api/notify';
        $line_token = 'your-token';

        $queryData = array('message' => $message);
        $queryData = http_build_query($queryData,'','&');
        $headerOptions = array(
            'http'=>array(
                'method'=>'POST',
                'header'=> "Content-Type: application/x-www-form-urlencoded\r\n"
                    ."Authorization: Bearer ".$line_token."\r\n"
                    ."Content-Length: ".strlen($queryData)."\r\n",
                'content' => $queryData
            )
        );
        $context = stream_context_create($headerOptions);
        $result = file_get_contents($line_api, FALSE, $context);
        $res = json_decode($result);
        return $res;
    }



ขอบคุณครับ
[direct=http://www.somsaishop.com]สบู่ส้มใส เก็บเงินปลายทาง[/direct]
[direct=https://www.thaiwebb.com]Thaiwebb.com[/direct]
[direct=https://skin365.shop/]SKIN365[/direct]

hiomard

เวลาแก้โค้ด ถ้าอัพเดทปลั้กอินต้องคอยแก้ด้วยนะครับ

rayongall

ทำได้ครับ แต่มันน่ารำคาญตอนอัพเดท

ผมเลยเขียนใช้เองเลยจบ
[direct=https://lin.ee/KOb6VYX]ติดต่อ Line : @562gfphk[/direct]
[direct=https://project-php.com/]ScriptPHP มี 100 กว่าระบบ[/direct]
[direct=https://www.lmsthai.com/]รับวางระบบอีเลินนิง[/direct]
[direct=https://softwareth.com]ระบบ php มากมาย[/direct]
[direct=https://hostings.ruk-com.in.th/aff.php?aff=442]Hosting เร็วแรงทะลุนรก[/direct]
[direct=-ttps://shope.ee/3VGwFM0Ldw]รวมการ์ดจอ[/direct]

thaigoodly

อ้างถึงจาก: hiomard ใน 16 กุมภาพันธ์ 2021, 18:48:05
เวลาแก้โค้ด ถ้าอัพเดทปลั้กอินต้องคอยแก้ด้วยนะครับ

base on plugin ครับทุก plugin มี hook ให้ใช้เป็นมาตรฐานอยู่แล้วครับ เขาน่าจะไม่อัพเดทให้กระทบ core หลัก
เพราะเราเขียนใน functions.php ครับ น่าจะปลอดภัย

vava

อ้างถึงจาก: iwama ใน 16 กุมภาพันธ์ 2021, 15:10:56
มีที่ขายอยู่ที่เจอ elementor pro (ส่วนของฟอร์ม) + line noti ได้


แต่ผมลองแล้วใช้ไม่เป็น 55

อยากหาแบบ form7 เหมือนกัน แต่ยังไม่เจอที่วางขาย
เจอของ elementor pro ละครับ ขอบคุณมากครับผม
[direct=http://www.somsaishop.com]สบู่ส้มใส เก็บเงินปลายทาง[/direct]
[direct=https://www.thaiwebb.com]Thaiwebb.com[/direct]
[direct=https://skin365.shop/]SKIN365[/direct]


katapol