ยินดีต้อนรับคุณ, บุคคลทั่วไป กรุณา เข้าสู่ระบบ หรือ ลงทะเบียน

เข้าสู่ระบบด้วยชื่อผู้ใช้ รหัสผ่าน และระยะเวลาในเซสชั่น

ThaiSEOBoard.comพัฒนาเว็บไซต์Programmingถาม php แปลงเป็น phtml อย่างไรคับ ขอบคุณ
หน้า: [1]   ลงล่าง
พิมพ์
ผู้เขียน หัวข้อ: ถาม php แปลงเป็น phtml อย่างไรคับ ขอบคุณ  (อ่าน 595 ครั้ง)
0 สมาชิก และ 1 บุคคลทั่วไป กำลังดูหัวข้อนี้
krite2010
สมุนแก๊งเสียว
*

พลังน้ำใจ: 6
ออฟไลน์ ออฟไลน์

กระทู้: 979



ดูรายละเอียด
« เมื่อ: 10 กุมภาพันธ์ 2011, 19:31:37 »

คือ

โค๊ด:
<?php
/**
*
* AWS_Cart 0.0.1 - November 2008
* Copyright (C) awsfm.com
* AWS_Cart is licensed under a Creative Commons License
*
*/

include('config.php');

function 
priceCheck($id,$sku,$price,$type){
$request "http://ecs.amazonaws.com/onca/xml?Service=AWSECommerceService&AWSAccessKeyId=".KEYID."&AssociateTag=".AssocTag."&Version=2006-09-11&Operation=ItemLookup&ItemId=$sku&ResponseGroup=Medium,Offers";
$session curl_init($request);
curl_setopt($sessionCURLOPT_HEADERfalse);
curl_setopt($sessionCURLOPT_RETURNTRANSFERtrue);
$response curl_exec($session);
$response file_get_contents($request);
$parsed_xml simplexml_load_string($response);
$awsListPrice=$parsed_xml->Items->Item->ItemAttributes->ListPrice->FormattedPrice;
        
$awsListPriceDB=substr_replace($parsed_xml->Items->Item->ItemAttributes->ListPrice->Amount'.', -20);        
        
$awsOfferListPrice=$parsed_xml->Items->Item->Offers->Offer->OfferListing->Price->FormattedPrice;
        
$awsOfferListPriceDB=substr_replace($parsed_xml->Items->Item->Offers->Offer->OfferListing->Price->Amount'.', -20);
if($type=='regular'){
if($awsListPrice!=$price){
                  
$con mysql_connect(dbhost,dbuser,dbpass);
                  
mysql_select_db(dbname,$con);
                  
mysql_query("UPDATE catalog_product_entity_decimal SET value=$awsListPriceDB WHERE entity_id=$id AND attribute_id='59'");
                  
mysql_close($con);
          print $awsListPrice;
}else{
                  print 
$price;
}
}
if($type=='final'){
if($awsOfferListPrice!=$price){
                  
$con mysql_connect(dbhost,dbuser,dbpass);
                  
mysql_select_db(dbname,$con);
                  
mysql_query("UPDATE catalog_product_entity_decimal SET value=$awsOfferListPriceDB WHERE entity_id=$id AND attribute_id='60'");
                  
mysql_close($con);
  print $awsOfferListPrice;
}else{
                  print 
$price;
}
}
}

function 
priceCheckCheckout($id,$sku,$price){
$request "http://ecs.amazonaws.com/onca/xml?Service=AWSECommerceService&AWSAccessKeyId=".KEYID."&AssociateTag=".AssocTag."&Version=2006-09-11&Operation=ItemLookup&ItemId=$sku&ResponseGroup=Medium,Offers";
$session curl_init($request);
curl_setopt($sessionCURLOPT_HEADERfalse);
curl_setopt($sessionCURLOPT_RETURNTRANSFERtrue);
$response curl_exec($session);
$response file_get_contents($request);
$parsed_xml simplexml_load_string($response);
$awsListPrice=$parsed_xml->Items->Item->ItemAttributes->ListPrice->FormattedPrice;
        
$awsListPriceDB=substr_replace($parsed_xml->Items->Item->ItemAttributes->ListPrice->Amount'.', -20);        
        
$awsOfferListPrice=$parsed_xml->Items->Item->Offers->Offer->OfferListing->Price->FormattedPrice;
        
$awsOfferListPriceDB=substr_replace($parsed_xml->Items->Item->Offers->Offer->OfferListing->Price->Amount'.', -20);
if($awsOfferListPrice!=$price){
                  
$con mysql_connect(dbhost,dbuser,dbpass);
                  
mysql_select_db(dbname,$con);
                  
mysql_query("UPDATE catalog_product_entity_decimal SET value=$awsOfferListPriceDB WHERE entity_id=$id AND attribute_id='60'");
                  
mysql_close($con);
        }
}

function 
itemLookup($sku$qty){
     
$request "http://ecs.amazonaws.com/onca/xml?Service=AWSECommerceService&AWSAccessKeyId=".KEYID."&AssociateTag=".AssocTag."&Version=2006-09-11&Operation=ItemLookup&ItemId=$sku&ResponseGroup=Medium,Offers";
     
$session curl_init($request);
     
curl_setopt($sessionCURLOPT_HEADERfalse);
     
curl_setopt($sessionCURLOPT_RETURNTRANSFERtrue);
     
$response curl_exec($session);
     
$response file_get_contents($request);
     
$parsed_xml simplexml_load_string($response);
     
$offerListingId urlencode($parsed_xml->Items->Item->Offers->Offer->OfferListing->OfferListingId);
     
cartCreate($offerListingId$qty);
}

function 
cartCreate($offerListingId$qty){
     
$request "http://ecs.amazonaws.com/onca/xml?Service=AWSECommerceService&AWSAccessKeyId=".KEYID."&AssociateTag=".AssocTag."&Version=2006-09-11&Operation=CartCreate&Item.1.OfferListingId=$offerListingId&Item.1.Quantity=$qty";
     
$session curl_init($request);
     
curl_setopt($sessionCURLOPT_HEADERfalse);
     
curl_setopt($sessionCURLOPT_RETURNTRANSFERtrue);
     
$response curl_exec($session);
     
$response file_get_contents($request);
     
$parsed_xml simplexml_load_string($response);
     
showCartContents($parsed_xml);
}

function 
itemLookupAdd($sku$qty$cart$hmac){
     
$request "http://ecs.amazonaws.com/onca/xml?Service=AWSECommerceService&AWSAccessKeyId=".KEYID."&AssociateTag=".AssocTag."&Version=2006-09-11&Operation=ItemLookup&ItemId=$sku&ResponseGroup=Medium,Offers";
     
$session curl_init($request);
     
curl_setopt($sessionCURLOPT_HEADERfalse);
     
curl_setopt($sessionCURLOPT_RETURNTRANSFERtrue);
     
$response curl_exec($session);
     
$response file_get_contents($request);
     
$parsed_xml simplexml_load_string($response);
     
$offerListingId urlencode($parsed_xml->Items->Item->Offers->Offer->OfferListing->OfferListingId);
     
cartAdd($offerListingId$qty$cart$hmac);
}

function 
cartAdd($offerListingId$qty$cart$hmac){
     
$request="http://ecs.amazonaws.com/onca/xml?Service=AWSECommerceService&AWSAccessKeyId=".KEYID."&AssociateTag=".AssocTag."&Version=2006-09-11&Operation=CartAdd&CartId=$cart&HMAC=$hmac&Item.1.OfferListingId=$offerListingId&Item.1.Quantity=$qty";
     
$session curl_init($request);
     
curl_setopt($sessionCURLOPT_HEADERfalse);
     
curl_setopt($sessionCURLOPT_RETURNTRANSFERtrue);
     
$response curl_exec($session);
     
$response file_get_contents($request);
     
$parsed_xml simplexml_load_string($response);
     
showCartContents($parsed_xml);
}

function 
showCartContents($parsed_xml){
     global 
$checkout;
     global 
$CartId;
     global 
$HMAC;
     
$checkout $parsed_xml->Cart->PurchaseURL;
     
$CartId $parsed_xml->Cart->CartId;
     
$HMAC $parsed_xml->Cart->URLEncodedHMAC;
}
?>


ถ้าต้องการแปลงเป็น phtml ทำอย่างไรคับ ขอบคุณ
บันทึกการเข้า
ohmohm
เจ้าพ่อบอร์ดเสียว
*

พลังน้ำใจ: 170
ออฟไลน์ ออฟไลน์

กระทู้: 3,092



ดูรายละเอียด เว็บไซต์
« ตอบ #1 เมื่อ: 18 กุมภาพันธ์ 2011, 15:33:43 »

มันคือการเข้ารหัส ไม่ให้เห็น source code หรือเปล่า
บันทึกการเข้า
หน้า: [1]   ขึ้นบน
พิมพ์