Return to Snippet

Revision: 36763
at November 26, 2010 04:10 by dmistriotis


Updated Code
/* Snipset for db query */

$dbConf = Mage::getConfig()->getNode('global/resources/default_setup/connection');
$db = new Zend_Db_Adapter_Pdo_Mysql(array('host'=> $dbConf->host, 'username' => $dbConf->username, 'password' => $dbConf->password, 'dbname'=> $dbConf->dbname));
$link_data = array(
 'product_id' => $product->getId(),
 /* etc... */
 );
$db->insert('catalog_product_link',$link_data);
$db->closeConnection();

Revision: 36762
at November 26, 2010 03:08 by dmistriotis


Initial Code
/* Snipset for db query */

$dbConf = Mage::getConfig()->getNode('global/resources/default_setup/connection');
    $db = new Zend_Db_Adapter_Pdo_Mysql(array('host'=> $dbConf->host, 'username' => $dbConf->username, 'password' => $dbConf->password, 'dbname'=> $dbConf->dbname));
     $link_data = array(
     'product_id' => $product->getId(),
     'linked_product_id' => $this->getId(),
     'link_type_id' => 3
     );
    $db->insert('catalog_product_link',$link_data);
    $db->closeConnection();

Initial URL

                                

Initial Description

                                

Initial Title
magento db query directly

Initial Tags
magento

Initial Language
PHP