[-] MO : fixed bug #PSCFV-1356 - Module hometexteditor has the same text for each sub multishop

This commit is contained in:
vAugagneur
2012-05-03 14:39:40 +00:00
parent ee858b1259
commit c4417cdf0c
4 changed files with 178 additions and 180 deletions
+19 -2
View File
@@ -28,7 +28,10 @@
class EditorialClass extends ObjectModel
{
/** @var integer editorial id*/
public $id = 1;
public $id;
/** @var integer editorial id shop*/
public $id_shop;
/** @var string body_title*/
public $body_home_logo_link;
@@ -53,8 +56,8 @@ class EditorialClass extends ObjectModel
'primary' => 'id_editorial',
'multilang' => true,
'fields' => array(
'id_shop' => array('type' => self::TYPE_INT, 'validate' => 'isunsignedInt', 'required' => true),
'body_home_logo_link' => array('type' => self::TYPE_STRING, 'validate' => 'isUrl'),
// Lang fields
'body_title' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName'),
'body_subheading' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName'),
@@ -63,6 +66,20 @@ class EditorialClass extends ObjectModel
)
);
public function add($autodate = true, $null_values = false)
{
return parent::add($autodate, $null_values);
}
static public function getByIdShop($id_shop)
{
$id = Db::getInstance()->getValue('SELECT `id_editorial` FROM `'._DB_PREFIX_.'editorial` WHERE `id_shop` ='.(int)$id_shop);
if ($id)
return new EditorialClass((int)$id);
else
return false;
}
public function copyFromPost()
{
/* Classical fields */