1 回答
TA贡献1835条经验 获得超7个赞
因此,由于gallery_images字段被joomla保存到其中,因此我们编写了一些代码来手动执行此操作。
class ModelProduct extends JModelAdmin
{
public function save($data) {
if (parent::save($data)) {
$registry = new Registry;
$registry->loadArray($data['gallery_image']);
$data['gallery_image'] = (string) $registry;
$db = JFactory::getDbo();
$query = $db->getQuery(true);
// Fields to update.
$fields = array(
$db->quoteName('gallery_image') . ' = ' . $db->quote($data['gallery_image']),
);
// Conditions for which records should be updated.
$conditions = array(
$db->quoteName('id') . ' = '.$data['id'],
);
$query->update($db->quoteName('v4yn2_product'))->set($fields)->where($conditions);
$db->setQuery($query);
$result = $db->execute();
return true;
}
return false;
}
}
- 1 回答
- 0 关注
- 68 浏览
添加回答
举报