I am using Event catalog_category_save_after
. In observer fetch query is working fine but insert and delete query is not working.
Below is my code :
$resource = Mage::getSingleton('core/resource');
$readConnection = $resource->getConnection('core_read');
$writeConnection = $resource->getConnection('core_write');
$tableName = $resource->getTableName('catalog_category_product');
$query = 'INSERT INTO ' . $tableName .' (`category_id`,`product_id`,`position`)VALUES("215","33702","5");';
$test1 = $writeConnection->query($query);
Below querey is generating:
INSERT INTO catalog_category_product (`category_id`,`product_id`,`position`)VALUES("215","33702","5");
Can anyone help me in this?