การปรับ WPRobot เพื่อทำ Similar products และ Short URL(https://fbcdn-sphotos-a-a.akamaihd.net/hphotos-ak-prn2/t31/1782333_282854005202372_201967019_o.jpg)
หลายคนอาจจะไม่รู้ว่าเราสามารถปรับแต่ง WPRbot Amazon module เพื่อดึง Similar product หรือ แก้ไขปรับ เปลียนค่าบางอย่างเพื่อให้ตรงกับความต้องการ เช่นทำ Short URL แทนที่เราจะดึง URL มาเต็มๆ มันซ้ำกันกับชาวโลกที่ใช้ WPRobot นำ Title สินค้า Amazon มาเป็น Title ครับ
ตัวอย่าง Pearl Izumi Men's Elite Gel Full Finger Glove, Black,
Amzon Module ที่ผม Modify ให้คิดแค่ 4 words พร้อมใส่ _ เชื่อมคำ เพื่อเตรียมไปใช้งาน
จาก Pearl Izumi Men's Elite Gel Full Finger Glove, Black,
ได้เป็น
Pearl_Izumi_Men's_Elite_Gel
(ดูในรูปครับ ผลการดึง Similar product กับ Short URL)
[การปรับแต่ง amazon.php ใน WPRobot ที่ผมทำ ตัดมาเฉพาะส่วนที่แก้ไข]
amazon.php
function xthe_short_title($limit=55,$echo=1,$title=''){
if (empty($title)){
$tmptitle = the_title('','',false);
} else {
$tmptitle = $title;
}
// We don't need the or and
$findword = array(" and ", " or ", " with ", " a ", " an ", "-", "(", ")","[","]"," - ");
$replaceword = array(" ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ");
$tmptitle = str_replace($findword, $replaceword, $tmptitle);
$findword = array(" And ", " Or ", " With ", " A ", " An ");
$replaceword = array(" ", " ", " ", " ", " ");
$tmptitle = str_replace($findword, $replaceword, $tmptitle);
$arraytitle = explode(" ", $tmptitle);
$newtitle = "";
$mycount = 0;
foreach ($arraytitle as &$value) {
if ( $mycount == 0 ) {
$newtitle = $value;
} else {
$newtitle = $newtitle." ".$value;
}
if ( $mycount >= 4 ) {
break;
}
if (! is_numeric($value)) {
$mycount = $mycount 1;
}
}
return $newtitle;
/*
if (strlen($tmptitle)<=$limit){
}else{
$title = substr_replace($tmptitle,'...',$limit);
}
if ($echo==1){
echo $title;
}else{
return $title;
}
*/
}
...
..
..
//added Similar products
$sim0 = $item->SimilarProducts->SimilarProduct[0]->ASIN;
$sim1 = $item->SimilarProducts->SimilarProduct[1]->ASIN;
$sim2 = $item->SimilarProducts->SimilarProduct[2]->ASIN;
$sim3 = $item->SimilarProducts->SimilarProduct[3]->ASIN;
//$sim4 = $item->SimilarProducts->SimilarProduct[4]->ASIN;
// FAI: SIM4 will be used for wiki
$sim4 = str_replace(" ","_",xthe_short_title(60,0,$item->ItemAttributes->Title));
$content= str_replace("{sim0}", $sim0, $content);
$content= str_replace("{sim1}", $sim1, $content);
$content= str_replace("{sim2}", $sim2, $content);
$content= str_replace("{sim3}", $sim3, $content);
$content= str_replace("{sim4}", $sim4, $content);[การปรับ WPRobot template เพื่อเรียกใช้ Similar product และ Short URL]
<h3><font color="blue">Similar Products to {title}</font></h3>
<table border="0">
<tbody>
<tr>
<td><iframe src="http://rcm.amazon.com/e/cm?lt1=_top&bc1=FFFFFF&IS2=1&bg1=FFFFFF&fc1=000000&lc1=0000FF&t=amazon-20&o=1&p=8&l=as1&m=amazon&f=ifr&ref=tf_til&asins={sim0}" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe></td>
<td><iframe src="http://rcm.amazon.com/e/cm?lt1=_top&bc1=FFFFFF&IS2=1&bg1=FFFFFF&fc1=000000&lc1=0000FF&t=amazon-20&o=1&p=8&l=as1&m=amazon&f=ifr&ref=tf_til&asins={sim1}" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe></td>
<td><iframe src="http://rcm.amazon.com/e/cm?lt1=_top&bc1=FFFFFF&IS2=1&bg1=FFFFFF&fc1=000000&lc1=0000FF&t=amazon-20&o=1&p=8&l=as1&m=amazon&f=ifr&ref=tf_til&asins={sim2}" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe></td>
<td><iframe src="http://rcm.amazon.com/e/cm?lt1=_top&bc1=FFFFFF&IS2=1&bg1=FFFFFF&fc1=000000&lc1=0000FF&t=amazon-20&o=1&p=8&l=as1&m=amazon&f=ifr&ref=tf_til&asins={sim3}" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe></td>
</tr>
</tbody></table>
short_title (4 words): {sim4}ผมไม่ได้เป็น Programming มืออาชีพแต่มีพื้นฐานมาบ้าง ศึกษา ทดลอง และ เอาไปปรับใช้ครับ ^__^
ดูผลงานอื่นๆ หรือมาคุยกัน
https://www.facebook.com/amzseo
ผลงานการใช้ WPRobot ของผมครับ ยอดเล็กน้อย :-[
http://www.thaiseoboard.com/index.php/topic,341638.0.html
แชร์สินค้าขายดี Amazon 200 รายการที่ผมขายเดือนกุมภา มาสู่ 3 หมวดสินค้าขายดี http://www.thaiseoboard.com/index.php/topic,342715.msg4736041/topicseen.html#new
[THANKS] ด้วยครับ ถ้าชอบผลงาน :-[
ไม่ชอบไม่เป็นไร :P
ขอบคุณครับ แต่สงสัยเรื่องดึง Similar มันใช้เกณฑ์การดึงยังไงเหรอครับ คือ อเมซอนทำ Similar ไว้บนเว็บไซต์ แล้วเราไปดึงมา ???
อ้างถึงจาก: Meaw-IE ใน 12 กุมภาพันธ์ 2014, 13:16:09
ขอบคุณครับ แต่สงสัยเรื่องดึง Similar มันใช้เกณฑ์การดึงยังไงเหรอครับ คือ อเมซอนทำ Similar ไว้บนเว็บไซต์ แล้วเราไปดึงมา ???
ถูกแล้วครับ อเมซอนทำ Similar ไว้บนเว็บไซต์ แล้วเราไปดึงมา
การปรับแต่ Module ที่เขียนด้วยภาษา php ทำอะไรได้มากกว่า ในเรื่องการสร้าง HTML Tag เพื่อปรับให้ Onpage มากที่สุดครับ
อ้างถึงจาก: mth30 ใน 12 กุมภาพันธ์ 2014, 19:48:48
เอาโค๊ดไปแทรกช่วงไหนอะครับ? พอดีใช้ wprobot 3.71
Function ที่เขียนมาใหม่ผมไว้ส่วนหัวแยกออกในส่วน function
ส่วนกลุ่มของ similar จะอยู่แถว str_replace กับตัวแปร $content
อ้างถึงจาก: Ozone ใน 12 กุมภาพันธ์ 2014, 13:13:26
การปรับ WPRobot เพื่อทำ Similar products และ Short URL
(https://fbcdn-sphotos-a-a.akamaihd.net/hphotos-ak-prn2/t31/1782333_282854005202372_201967019_o.jpg)
หลายคนอาจจะไม่รู้ว่าเราสามารถปรับแต่ง WPRbot Amazon module เพื่อดึง Similar product หรือ แก้ไขปรับ เปลียนค่าบางอย่างเพื่อให้ตรงกับความต้องการ เช่นทำ Short URL แทนที่เราจะดึง URL มาเต็มๆ มันซ้ำกันกับชาวโลกที่ใช้ WPRobot นำ Title สินค้า Amazon มาเป็น Title ครับ
ตัวอย่าง Pearl Izumi Men's Elite Gel Full Finger Glove, Black,
Amzon Module ที่ผม Modify ให้คิดแค่ 4 words พร้อมใส่ _ เชื่อมคำ เพื่อเตรียมไปใช้งาน
จาก Pearl Izumi Men's Elite Gel Full Finger Glove, Black,
ได้เป็น
Pearl_Izumi_Men's_Elite_Gel
(ดูในรูปครับ ผลการดึง Similar product กับ Short URL)
[การปรับแต่ง amazon.php ใน WPRobot ที่ผมทำ ตัดมาเฉพาะส่วนที่แก้ไข]
amazon.php
function xthe_short_title($limit=55,$echo=1,$title=''){
if (empty($title)){
$tmptitle = the_title('','',false);
} else {
$tmptitle = $title;
}
// We don't need the or and
$findword = array(" and ", " or ", " with ", " a ", " an ", "-", "(", ")","[","]"," - ");
$replaceword = array(" ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ");
$tmptitle = str_replace($findword, $replaceword, $tmptitle);
$findword = array(" And ", " Or ", " With ", " A ", " An ");
$replaceword = array(" ", " ", " ", " ", " ");
$tmptitle = str_replace($findword, $replaceword, $tmptitle);
$arraytitle = explode(" ", $tmptitle);
$newtitle = "";
$mycount = 0;
foreach ($arraytitle as &$value) {
if ( $mycount == 0 ) {
$newtitle = $value;
} else {
$newtitle = $newtitle." ".$value;
}
if ( $mycount >= 4 ) {
break;
}
if (! is_numeric($value)) {
$mycount = $mycount 1;
}
}
return $newtitle;
/*
if (strlen($tmptitle)<=$limit){
}else{
$title = substr_replace($tmptitle,'...',$limit);
}
if ($echo==1){
echo $title;
}else{
return $title;
}
*/
}
...
..
..
//added Similar products
$sim0 = $item->SimilarProducts->SimilarProduct[0]->ASIN;
$sim1 = $item->SimilarProducts->SimilarProduct[1]->ASIN;
$sim2 = $item->SimilarProducts->SimilarProduct[2]->ASIN;
$sim3 = $item->SimilarProducts->SimilarProduct[3]->ASIN;
//$sim4 = $item->SimilarProducts->SimilarProduct[4]->ASIN;
// FAI: SIM4 will be used for wiki
$sim4 = str_replace(" ","_",xthe_short_title(60,0,$item->ItemAttributes->Title));
$content= str_replace("{sim0}", $sim0, $content);
$content= str_replace("{sim1}", $sim1, $content);
$content= str_replace("{sim2}", $sim2, $content);
$content= str_replace("{sim3}", $sim3, $content);
$content= str_replace("{sim4}", $sim4, $content);
[การปรับ WPRobot template เพื่อเรียกใช้ Similar product และ Short URL]
<h3><font color="blue">Similar Products to {title}</font></h3>
<table border="0">
<tbody>
<tr>
<td><iframe src="http://rcm.amazon.com/e/cm?lt1=_top&bc1=FFFFFF&IS2=1&bg1=FFFFFF&fc1=000000&lc1=0000FF&t=amazon-20&o=1&p=8&l=as1&m=amazon&f=ifr&ref=tf_til&asins={sim0}" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe></td>
<td><iframe src="http://rcm.amazon.com/e/cm?lt1=_top&bc1=FFFFFF&IS2=1&bg1=FFFFFF&fc1=000000&lc1=0000FF&t=amazon-20&o=1&p=8&l=as1&m=amazon&f=ifr&ref=tf_til&asins={sim1}" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe></td>
<td><iframe src="http://rcm.amazon.com/e/cm?lt1=_top&bc1=FFFFFF&IS2=1&bg1=FFFFFF&fc1=000000&lc1=0000FF&t=amazon-20&o=1&p=8&l=as1&m=amazon&f=ifr&ref=tf_til&asins={sim2}" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe></td>
<td><iframe src="http://rcm.amazon.com/e/cm?lt1=_top&bc1=FFFFFF&IS2=1&bg1=FFFFFF&fc1=000000&lc1=0000FF&t=amazon-20&o=1&p=8&l=as1&m=amazon&f=ifr&ref=tf_til&asins={sim3}" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe></td>
</tr>
</tbody></table>
short_title (4 words): {sim4}
ผมไม่ได้เป็น Programming มืออาชีพแต่มีพื้นฐานมาบ้าง ศึกษา ทดลอง และ เอาไปปรับใช้ครับ ^__^
ดูผลงานอื่นๆ หรือมาคุยกัน
https://www.facebook.com/pages/Hostgatorcoupongang/213145732173200
ผลงานการใช้ WPRobot ของผมครับ ยอดเล็กน้อย :-[
http://www.thaiseoboard.com/index.php/topic,341638.0.html
[THANKS] ด้วยครับ ถ้าชอบผลงาน :-[
ไม่ชอบไม่เป็นไร :P
แทงยู 3 ที จัดไป 1 ดอก อิอิ...
อ้างถึงจาก: Ozone ใน 13 กุมภาพันธ์ 2014, 08:53:00
อ้างถึงจาก: mth30 ใน 12 กุมภาพันธ์ 2014, 19:48:48
เอาโค๊ดไปแทรกช่วงไหนอะครับ? พอดีใช้ wprobot 3.71
Function ที่เขียนมาใหม่ผมไว้ส่วนหัวแยกออกในส่วน function
ส่วนกลุ่มของ similar จะอยู่แถว str_replace กับตัวแปร $content
ขอลองทำดูนะครับ ขอบคุณมากครับ
อ้างถึงจาก: Ozone ใน 13 กุมภาพันธ์ 2014, 08:53:00
อ้างถึงจาก: mth30 ใน 12 กุมภาพันธ์ 2014, 19:48:48
เอาโค๊ดไปแทรกช่วงไหนอะครับ? พอดีใช้ wprobot 3.71
Function ที่เขียนมาใหม่ผมไว้ส่วนหัวแยกออกในส่วน function
ส่วนกลุ่มของ similar จะอยู่แถว str_replace กับตัวแปร $content
ผมนั่งดูตั้งนาน ไม่เห็นเมนต์นี้ ขอบคุณมากคับ :wanwan017:
ขอโทดครับ จะเรียกว่ามือใหม่หรือซื่อบื้อก็ได้ มันอยู่ตรงไหนอ่ะครับ มี capture ก็ดีนะครับ มือใหม่ อยากรวย
อ้างถึงจาก: Meaw-IE ใน 23 กุมภาพันธ์ 2014, 16:50:59
อ้างถึงจาก: Ozone ใน 13 กุมภาพันธ์ 2014, 08:53:00
อ้างถึงจาก: mth30 ใน 12 กุมภาพันธ์ 2014, 19:48:48
เอาโค๊ดไปแทรกช่วงไหนอะครับ? พอดีใช้ wprobot 3.71
Function ที่เขียนมาใหม่ผมไว้ส่วนหัวแยกออกในส่วน function
ส่วนกลุ่มของ similar จะอยู่แถว str_replace กับตัวแปร $content
ผมนั่งดูตั้งนาน ไม่เห็นเมนต์นี้ ขอบคุณมากคับ :wanwan017: