Having issue with this code.
$table2 = Mage::getModel('tag/tag_properties');
$table2->setData(array('tag_id'=>$lat,'store_id'=>1,'base_popularity'=>0));
$table2->save();
2 Answers 2
Try to do like following
$table2 = Mage::getModel('tag/tag_properties');
$table2->setTagId($lat);
$table2->setStoreId(1);
$table2->setBasePopularity(0);
$table2->save();
answered Jul 1, 2017 at 7:02
Emipro Technologies Pvt. Ltd.
4,1232 gold badges31 silver badges65 bronze badges
-
Thanks for your reply but its not working. Now show given below error. Fatal error: Call to a member function setTagId() on boolean inAjay Sharma– Ajay Sharma2017年07月01日 07:09:52 +00:00Commented Jul 1, 2017 at 7:09
-
Replace with with $table2 = Mage::getModel('tag/properties'); and then try.Emipro Technologies Pvt. Ltd.– Emipro Technologies Pvt. Ltd.2017年07月01日 07:18:29 +00:00Commented Jul 1, 2017 at 7:18
-
No, Its not working with $table2 = Mage::getModel('tag/properties'); this too.Ajay Sharma– Ajay Sharma2017年07月01日 07:29:21 +00:00Commented Jul 1, 2017 at 7:29
-
Have you create model.? Or tag_id is auto increment in db.? if it's yes then you don't need to set it. It'll automatic create.Emipro Technologies Pvt. Ltd.– Emipro Technologies Pvt. Ltd.2017年07月01日 07:33:39 +00:00Commented Jul 1, 2017 at 7:33
-
Yes, Model is already created and no its not auto increment, this field is defined in 'tag properties' table and have foreign key for 'tag' tag_id field.Ajay Sharma– Ajay Sharma2017年07月01日 07:41:03 +00:00Commented Jul 1, 2017 at 7:41
setTagId() its datatype may be boolean and $lat which value you have to stored.
answered Jul 1, 2017 at 7:13
user55776
-
No, I have checked in database table. 'tag_id' is int(10)Ajay Sharma– Ajay Sharma2017年07月01日 07:14:54 +00:00Commented Jul 1, 2017 at 7:14
-
primary key set or foreign key set is there please checked up.user55776– user557762017年07月01日 07:22:17 +00:00Commented Jul 1, 2017 at 7:22
-
Yes, foreign key is set with tag_properties table with table tag tag_id but how to resolve this issue ?Ajay Sharma– Ajay Sharma2017年07月01日 07:24:43 +00:00Commented Jul 1, 2017 at 7:24
-
remove the foreign key or get collection of tag table and check $lat is match tag_id then save it.user55776– user557762017年07月01日 07:31:49 +00:00Commented Jul 1, 2017 at 7:31
default