ดึงข้อมูล Opencart จาก sub folder มาแสดงใน wordpress

ดึงข้อมูล Opencart จาก sub folder มาแสดงใน wordpress

เอาข้อมูลของลูกค้าจากร้านค้าซึ่งใช้Opencart มาแสดงที่Wordpress ข้อมูลก็มีชื่อ กับสินค้าที่หยิบใส่ตระกร้า
โดยwordpressเป็นไซต์หลักแล้วOpencartเป็น Sub Folder (wptest/shop)
ทำเป็นPHP index.php แล้ววางไว้ที่ rootของwordpress ก็สามารถเรียกSessionมาได้ปกติ แต่ว่าไฟล์ที่ทำมันเป็นไฟล์ที่สร้างใหม่ ถ้าเรียกใช้ไฟล์สามารถทได้โโย ใส่ไว้ที่ Index.php ของธีมแล้วค่อยมาแต่ง CSSอีกที

<!doctype html>
<html lang="UTF-8">
<head>
<meta charset="UTF-8">
<?
require_once('shop/config.php');// Configuration
require_once(DIR_SYSTEM . 'library/customer.php');// Application Classes
require_once(DIR_SYSTEM . 'library/currency.php');
require_once(DIR_SYSTEM . 'library/tax.php');
require_once(DIR_SYSTEM . 'library/weight.php');
require_once(DIR_SYSTEM . 'library/cart.php');
require_once(DIR_SYSTEM . 'engine/controller.php');// Engine
require_once(DIR_SYSTEM . 'engine/registry.php');
require_once(DIR_SYSTEM . 'library/config.php');// Common
require_once(DIR_SYSTEM . 'library/db.php');
require_once(DIR_SYSTEM . 'library/session.php');
$registry = new Registry();// Registry
$config = new Config();// Config
$registry->set('config', $config);
$db = new DB(DB_DRIVER, DB_HOSTNAME, DB_USERNAME, DB_PASSWORD, DB_DATABASE);// Database
$registry->set('db', $db);
$session = new Session();// Session
$registry->set('session', $session);
$registry->set('customer', new Customer($registry));// Customer
$customer = new Customer($registry);
$logged = $registry->get('session')->data['customer_id'>;
$logged = $customer->isLogged();
$firstName = $customer->getFirstName();
$registry->set('currency', new Currency($registry));// Currency
$registry->set('cart', new Cart($registry));// Cart

require_once(DIR_APPLICATION . 'controller/module/cart.php');
      $product_id = $registry->get('cart')->session->data['cart'>;
      $tf = false;
      foreach($product_id as $p=>$val) {
        if($tf) {
            $sql .=  'OR p.product_id = "'.$p.'"'; 
        }else{
            $tf = true;
            $sql =  'p.product_id = "'.$p.'"';
        }
      }
 
      $cartSQL = mysql_query("
      SELECT DISTINCT *, pd.name AS name, p.image, m.name AS manufacturer FROM " . DB_PREFIX . "product p
      LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id)
      LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id)
      LEFT JOIN " . DB_PREFIX . "stock_status ss ON (p.stock_status_id = ss.stock_status_id)
      WHERE (" . $sql . ") AND pd.language_id = '1' AND p2s.store_id = '0' AND ss.language_id = '1' AND p.date_available <= NOW() AND p.status = '1'");

?>

</head>




<div class="homecart">
    <input type="checkbox" id="shcart" name="shcart">
<?php
if (!$logged) {
echo '<span id="cusnick">คุณยังไม่ได้เข้าสู่ระบบ <label for="shcart"> สินค้าที่สั่งซื้อ</label></span>';
echo '<div id="shcart"><span>รายการที่คุณสั่งซื้อ</span>';
} else {
echo '<span id="cusnick">สวัสดีคุณ '.$firstName. ' <label for="shcart">สินค้าที่สั่งซื้อ</label></span>';
echo '<div id="shcart"><span>รายการที่คุณสั่งซื้อ</span>';
}
?>

<?php
  // Show User name when login
$i = 0; 
echo '<ul id="cus">';
while($row = @mysql_fetch_array($cartSQL)) {
echo '<li><span>'.
'<a href="http://wptest.com/shop/index.php?route=product/product&product_id='.$row['product_id'>.'">'.'<image style="max-height:50px;margin:5px;float:left;" src="http://wptest.com/shop/image/'.$row['image'>.'" title="'.$row.'" alt="'.$row.'">'.$row.'</a></span><br /><span class="homepri">'.$row.' ฿</span></li>';
$i++; 
echo '<span class="hommen">***ราคาที่แสดงคือราคาไม่รวมส่วนลด</span>';
}
echo '</ul>';
if ($i == 0) {
echo '<span class="homtolno">คุณยังไม่มีรายการซื้อ</span>';
} else {
echo '<br /><span class="homtol">รวม :' .$i. ' รายการ</span>';
}
?>

</div>
</div>

<style>
input#shcart:checked ~ div#shcart {
display:block;
}
span#cusnick label {
  cursor: pointer;
}
.homecart {
    width: 260px;
}
#cusnick {
    float: left;
    width: 100%;
    text-align: center;
    margin-bottom: 5px;
}
div#shcart,input#shcart {
    float: left;
display:none;
}
ul#cus {
    width:250px;
padding:5px;
margin:0;
}
ul#cus li {
    display: block;
padding:3px;
    height: 60px;
  line-height: 40px;
  border: 1px solid #ff0000;
  overflow:hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

ul#cus li img {
    vertical-align: middle;
}
ul#cus li span{
    line-height:15px;
}

span.homepri {
    float: right;
    margin-right: 15px;
}
span.hommen {
    font-size: 12px;
    width: 250px;
    float: left;
    text-align: center;
margin-bottom: 5px;
display: none;
}
span.hommen:last-child {
    display: block;
}
span.homtolno {
    float: left;
    width: 100%;
    text-align: center;
}
</style>

</body>
</html>


ID=2513,MSG=2867


⭐️ เราให้คำแนะนำปรึกษา รักษาผลประโยชน์ให้ลูกค้า ของเรา
⭐️ เราอยู่เคียงข้างลูกค้าของเรา ช่วยเหลือ ดูแลบริการ
⭐️ เรารองรับช่องทางติดต่อมากมาย สะดวก เข้าถึงง่าย
⭐️ เราดำเนินธุรกิจยาวนานกว่า20 ปี คุณจึงมั่นใจได้
⭐️ คุณมีสามารถรับบริการทั้งจากบริษัทประกันเจ้าของสินค้า และ เรา (ตัวกลาง)

ไทย มีราว 80 บริษัทประกันภัย สินค้าที่แตกต่าง ทั้ง เงื่อนไข ราคา เคลม ความมั่นคง นโยบาย ฯลฯ
ขายผ่านตัวกลาง กว่า 500,000 ราย : ตัวแทน นายหน้า ธนาคาร บิ๊กซี โลตัส ค่ายรถยนต์ เฮ้าส์แบรนด์ ของประกันภัย หรือ ซื้อตรงกับบริษัทเจ้าของสินค้า
⭐️ ตัวอย่าง การบริการ กดดูที่ลิงค์นี้

"สิ่งที่ต้องคำนึงอันดับแรกในการซื้อประกัน คือ ตัวกลางประกันภัย ซึ่งจะเป็นที่ปรึกษา ช่วยเหลือ ดูแลเรา ตลอดอายุกรมธรรม์"

โปรดรอ

display:inline-block; position:relative;
โทร.(จ-ศ : 9-16) เว้นวันหยุดฯ , ลูกค้าเรา บริการ 24/7/365 , Friday เวลา 01:43:28am ...
Copyright © 2018 Cymiz.com., All rights reserved.นโยบาย,ข้อตกลงcymiz.com