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(); 
asked Jul 1, 2017 at 6:58

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();
answered Jul 1, 2017 at 7:02
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.

answered Jul 1, 2017 at 7:13
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

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.