โดย jamepiyawat » 11/07/2019 4:31 pm
category_id ในตาราง #__mzc_categories ไม่ขึ้น ครับ
ลิ้งที่ออกมา
โค้ด: เลือกทั้งหมด
http://localhost/demo-e-commerce-solutions-for-b2b/index.php/product/view/6
ลิ้งที่ถูกต้อง
โค้ด: เลือกทั้งหมด
http://localhost/demo-e-commerce-solutions-for-b2b/index.php/product/view/2/6
โค้ดเชื่อมฐานข้อมูล ครับ
โค้ด: เลือกทั้งหมด
$db = joomla\CMS\Factory::getDbo();
$query = $db->getQuery(true)
->select($db->qn('a.name_en-GB').',a.product_id,a.image,b.category_id')
->from('#__mzc_products AS a')
->leftJoin('#__mzc_categories As b ON a.product_id=b.category_id')
->order('RAND()','product_id');
$db->setQuery($query,1,4);
$items = $db->loadAssocList();
category_id ในตาราง #__mzc_categories ไม่ขึ้น ครับ
ลิ้งที่ออกมา
[code]http://localhost/demo-e-commerce-solutions-for-b2b/index.php/product/view/6[/code]
ลิ้งที่ถูกต้อง
[code]http://localhost/demo-e-commerce-solutions-for-b2b/index.php/product/view/2/6[/code]
โค้ดเชื่อมฐานข้อมูล ครับ
[code]$db = joomla\CMS\Factory::getDbo();
$query = $db->getQuery(true)
->select($db->qn('a.name_en-GB').',a.product_id,a.image,b.category_id')
->from('#__mzc_products AS a')
->leftJoin('#__mzc_categories As b ON a.product_id=b.category_id')
->order('RAND()','product_id');
$db->setQuery($query,1,4);
$items = $db->loadAssocList();[/code]