โดย pprn » 02/10/2018 10:36 pm
ต้องการสร้างปุ่มลบค่าในตารางจาก Database ใน component ใน Joomla 3.8.11 ดังรูป
โดยปุ่ม New และ Edit ใช้ได้ปกติค่ะ
แต่ขึ้น error ว่า
An error has occurred.
0 Call to a member function delete() on boolean
D:\xampp\htdocs\joomla_***\libraries\src\MVC\Controller\AdminController.php:132
ดังรูป
ตัวอย่างโค้ด ไฟล์ view.html.php ในไฟล์ customeritems > models
โค้ด: เลือกทั้งหมด
<?php
/**
* @package com_customer
* @author Mindphp Devoloper
*
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// ป้องกันไม่ให้เรียกใช้งานโดยตรง ต้องเปิดผ่าน joomla
defined('_JEXEC') or die;
class CustomerViewCustomerItems extends JViewLegacy
{
public function display($tpl = null)
{
$this->items = $this->get('Items');
$this->state = $this->get('State');
$this->pagination = $this->get('Pagination');
$this->filterForm = $this->get('FilterForm');
$this->activeFilters = $this->get('ActiveFilters');
$this->addToolBar();
parent::display($tpl);
}
public function addToolBar()
{
JToolbarHelper::title(JText::_('COM_CUSTOMER'));
JToolbarHelper::addNew('customeritem.add');
JToolbarHelper::editList('customeritem.edit');
JToolbarHelper::deleteList('', 'customeritems.delete');
}
}
มีวิธีแก้ยังไงบ้างค่ะ
ต้องการสร้างปุ่มลบค่าในตารางจาก Database ใน component ใน Joomla 3.8.11 ดังรูป
[list][attachment=0]errr.jpg[/attachment][/list]
โดยปุ่ม New และ Edit ใช้ได้ปกติค่ะ
[color=#FF0040][size=110]แต่ขึ้น error ว่า [/size] [/color]
An error has occurred.
0 Call to a member function delete() on boolean
D:\xampp\htdocs\joomla_xxx\libraries\src\MVC\Controller\AdminController.php:132
ดังรูป
[list][attachment=1]err.jpg[/attachment][/list]
ตัวอย่างโค้ด ไฟล์ view.html.php ในไฟล์ customeritems > models
[list][code]<?php
/**
* @package com_customer
* @author Mindphp Devoloper
*
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// ป้องกันไม่ให้เรียกใช้งานโดยตรง ต้องเปิดผ่าน joomla
defined('_JEXEC') or die;
class CustomerViewCustomerItems extends JViewLegacy
{
public function display($tpl = null)
{
$this->items = $this->get('Items');
$this->state = $this->get('State');
$this->pagination = $this->get('Pagination');
$this->filterForm = $this->get('FilterForm');
$this->activeFilters = $this->get('ActiveFilters');
$this->addToolBar();
parent::display($tpl);
}
public function addToolBar()
{
JToolbarHelper::title(JText::_('COM_CUSTOMER'));
JToolbarHelper::addNew('customeritem.add');
JToolbarHelper::editList('customeritem.edit');
JToolbarHelper::deleteList('', 'customeritems.delete');
}
}[/code]
[/list]
มีวิธีแก้ยังไงบ้างค่ะ