พอดีว่าผมกำลังจะสร้าง modules ครับพอที่จะเขียนให้แสดงข้อมูลชื่อสินค้าออกมาได้แล้วแต่ว่าผมไม่ทราบว่าจะให้ชื่อสิ้นค้าพวกนี้สุ่มออกมาได้ยังไง
จึงอยากจะทราบว่าจะมีวิธีใดที่จะให้รายชื่อสินค้าที่เราดึงออกมาแล้วแสดงแบบสุ่มได้บ้างครับ
- Selection_923.png (98.4 KiB) Viewed 756 times
โค้นที่ใช้ในไฟล์ halper ครับ
โค้ด: เลือกทั้งหมด
class ModxxxHelper
{
Public function getItems()
{
$db = joomla\CMS\Factory::getDbo();
$query = $db->getQuery(true)
->select('*')
->from('#__mzc_products');
$db->setQuery($query);
$items = $db->loadAssocList();
return $items;
}
}
พอดีว่าผมกำลังจะสร้าง modules ครับพอที่จะเขียนให้แสดงข้อมูลชื่อสินค้าออกมาได้แล้วแต่ว่าผมไม่ทราบว่าจะให้ชื่อสิ้นค้าพวกนี้สุ่มออกมาได้ยังไง
จึงอยากจะทราบว่าจะมีวิธีใดที่จะให้รายชื่อสินค้าที่เราดึงออกมาแล้วแสดงแบบสุ่มได้บ้างครับ
[attachment=0]Selection_923.png[/attachment]
โค้นที่ใช้ในไฟล์ halper ครับ
[code=php]class ModxxxHelper
{
Public function getItems()
{
$db = joomla\CMS\Factory::getDbo();
$query = $db->getQuery(true)
->select('*')
->from('#__mzc_products');
$db->setQuery($query);
$items = $db->loadAssocList();
return $items;
}
} [/code]