0

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

0

Try to do like following

$table2 = Mage::getModel('tag/tag_properties');
$table2->setTagId($lat);
$table2->setStoreId(1);
$table2->setBasePopularity(0);
$table2->save();
6
  • Thanks for your reply but its not working. Now show given below error. Fatal error: Call to a member function setTagId() on boolean in Commented Jul 1, 2017 at 7:09
  • Replace with with $table2 = Mage::getModel('tag/properties'); and then try. Commented Jul 1, 2017 at 7:18
  • No, Its not working with $table2 = Mage::getModel('tag/properties'); this too. Commented 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. Commented 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. Commented Jul 1, 2017 at 7:41
0

setTagId() its datatype may be boolean and $lat which value you have to stored.

4
  • No, I have checked in database table. 'tag_id' is int(10) Commented Jul 1, 2017 at 7:14
  • primary key set or foreign key set is there please checked up. Commented 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 ? Commented 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. Commented Jul 1, 2017 at 7:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.