本文整理汇总了PHP中Mage_Eav_Model_Entity_Setup::tableExists方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Eav_Model_Entity_Setup::tableExists方法的具体用法?PHP Mage_Eav_Model_Entity_Setup::tableExists怎么用?PHP Mage_Eav_Model_Entity_Setup::tableExists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Eav_Model_Entity_Setup
的用法示例。
在下文中一共展示了Mage_Eav_Model_Entity_Setup::tableExists方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: int
/**
*
* @category Directshop
* @package Directshop_FraudDetection
* @author Ben James
* @copyright Copyright (c) 2008-2010 Directshop Pty Ltd. (http://directshop.com.au)
*/
$installer = $this;
$installer->startSetup();
$installer->run("\r\nDROP TABLE IF EXISTS {$this->getTable('frauddetection_data')};\r\nCREATE TABLE {$this->getTable('frauddetection_data')} (\r\n `entity_id` int(10) NOT NULL auto_increment,\r\n `order_id` int(10) NOT NULL,\r\n `fraud_score` int(11) NULL DEFAULT '0',\r\n `fraud_data` text NULL,\r\n `sent_data` text NULL,\r\n PRIMARY KEY (`entity_id`),\r\n KEY `order_id_idx` (`order_id`)\r\n) ENGINE=InnoDB DEFAULT CHARSET=utf8;\r\n");
// transfer any old data across
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
if ($setup->getEntityType('order_payment') !== false) {
$responseAttribute = $setup->getAttribute('order_payment', 'maxmind_response');
$scoreAttribute = $setup->getAttribute('order', 'fraud_score');
if ($responseAttribute && $setup->tableExists('sales_order_entity_text')) {
$read = Mage::getSingleton('core/resource')->getConnection('core_read');
$existingData = $read->fetchAll("select * from {$this->getTable('sales_order_entity_text')} where attribute_id = ?", array($responseAttribute['attribute_id']));
foreach ($existingData as $data) {
$parentId = $read->fetchOne("select parent_id from {$this->getTable('sales_order_entity')} where entity_id = ?", array($data['entity_id']));
$fraudScore = 0;
if ($scoreAttribute) {
$fraudScore = $read->fetchOne("select value from {$this->getTable('sales_order_int')} where entity_id = ? AND attribute_id = ?", array($parentId, $scoreAttribute['attribute_id']));
} else {
$fraudData = @unserialize($data['value']);
if (isset($fraudData['ourscore'])) {
$fraudScore = $fraudData['ourscore'];
}
}
if ($fraudScore !== FALSE && $parentId) {
$result = Mage::getModel('frauddetection/result')->loadByOrderId($data['entity_id'])->addData(array('order_id' => $parentId, 'fraud_score' => $fraudScore, 'fraud_data' => $data['value']))->save();