したがって、ここで OpenCart 用にこのカスタム モジュールをコード化すると、次のエラーが発生します。
SELECT p.upc AS product_upc, TRIM(ma.make) AS make, IFNULL(TRIM(mo.model), 0)
AS model, p2y.begin_year, p2y.end_year, IFNULL(TRIM(en.engine), 0) AS engine,
IFNULL(TRIM(si.size), 0) AS size FROM product_to_car p2y LEFT JOIN product p ON
p.product_id = p2y.product_id LEFT JOIN make ma ON ma.id = p2y.make_id LEFT JOIN
model mo ON mo.id = p2y.model_id LEFT JOIN `size si ON si.id = p2y.size_id`engine
en ON en.id = p2y.engine_id ORDER by ma.make, mo.model, si.size, en.engine,
p2y.begin_year in C:\wamp\www\NewDev\system\database\mysql.php on line 50
そのエラーのコードは次のとおりです。
public function download($uid = 'product_id'){
if($uid == 'product_id') {
$query = $this->db->query("SELECT p2y.product_id, TRIM(ma.make) AS make, IFNULL(TRIM(mo.model), 0) AS model, p2y.begin_year, p2y.end_year, IFNULL(TRIM(en.engine), 0) AS engine, IFNULL(TRIM(si.size), 0) AS size FROM " . DB_PREFIX . "product_to_car p2y LEFT JOIN " . DB_PREFIX . "make ma ON ma.id = p2y.make_id LEFT JOIN " . DB_PREFIX . "model mo ON mo.id = p2y.model_id LEFT JOIN `" . DB_PREFIX . "size` si ON si.id = p2y.size_id`" . DB_PREFIX . "engine` en ON en.id = p2y.engine_id ORDER by ma.make, mo.model, si.size, en.engine, p2y.begin_year");
} else {
switch($uid) {
case 'model':
$identifier = 'p.model AS product_model';
break;
case 'sku':
$identifier = 'p.sku AS product_sku';
break;
case 'upc':
$identifier = 'p.upc AS product_upc';
break;
case 'ean':
$identifier = 'p.ean AS product_ean';
break;
case 'mpn':
$identifier = 'p.mpn as product_mpn';
break;
case 'isbn':
$identifier = 'p.isbn AS product_isbn';
break;
default:
$identifier = 'p2y.product_id';
break;
}
$query = $this->db->query("SELECT " . $identifier . ", TRIM(ma.make) AS make, IFNULL(TRIM(mo.model), 0) AS model, p2y.begin_year, p2y.end_year, IFNULL(TRIM(en.engine), 0) AS engine, IFNULL(TRIM(si.size), 0) AS size FROM " . DB_PREFIX . "product_to_car p2y LEFT JOIN " . DB_PREFIX . "product p ON p.product_id = p2y.product_id LEFT JOIN " . DB_PREFIX . "make ma ON ma.id = p2y.make_id LEFT JOIN " . DB_PREFIX . "model mo ON mo.id = p2y.model_id LEFT JOIN `" . DB_PREFIX . "size si ON si.id = p2y.size_id`" . DB_PREFIX . "engine en ON en.id = p2y.engine_id ORDER by ma.make, mo.model, si.size, en.engine, p2y.begin_year");
}
何度か書き直しましたが、まだうまくいきません。これを削除する`" .DB_PREFIX. "size si ON si.id = p2y.size_id
と "正常に動作します。
私もそれをsize
機能させる必要があります。
このエラーの原因についての手がかりはありますか?