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();  
0

Try to do like following

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

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

  • No, I have checked in database table. 'tag_id' is int(10) – Ajay Sharma Jul 1 '17 at 7:14
  • primary key set or foreign key set is there please checked up. – Vijay Khirade Jul 1 '17 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 Jul 1 '17 at 7:24
  • remove the foreign key or get collection of tag table and check $lat is match tag_id then save it. – Vijay Khirade Jul 1 '17 at 7:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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