当前位置: 首页>>代码示例>>PHP>>正文


PHP Mage_Eav_Model_Entity_Setup::getTable方法代码示例

本文整理汇总了PHP中Mage_Eav_Model_Entity_Setup::getTable方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Eav_Model_Entity_Setup::getTable方法的具体用法?PHP Mage_Eav_Model_Entity_Setup::getTable怎么用?PHP Mage_Eav_Model_Entity_Setup::getTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mage_Eav_Model_Entity_Setup的用法示例。


在下文中一共展示了Mage_Eav_Model_Entity_Setup::getTable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: catalogProductPrepareSave

 public function catalogProductPrepareSave($event)
 {
     $productData = $event->getRequest()->getPost('product');
     if ($productData) {
         foreach (Mage::helper('davidjordan_lazyloadingoption')->getAttributeCodes() as $attributeCode) {
             if (empty($productData[$attributeCode])) {
                 $post = $event->getRequest()->getPost();
                 if (!empty($post['product']["{$attributeCode}_visible_input"])) {
                     $label = $post['product']["{$attributeCode}_visible_input"];
                     $attributeModel = Mage::getModel('catalog/resource_eav_attribute')->loadByCode(4, $attributeCode);
                     $foundVal = array_reduce($attributeModel->getSource()->getAllOptions(false), function ($acc, $val) use($label) {
                         return $acc ?: ($val['label'] == $label ? $val['value'] : $acc);
                     }, "");
                     if ($foundVal) {
                         $productData[$attributeCode] = $foundVal;
                     } else {
                         $setup = new Mage_Eav_Model_Entity_Setup('core_write');
                         $setup->addAttributeOption(array('attribute_id' => $attributeModel->getId(), 'values' => array($label)));
                         $connection = Mage::getSingleton('core/resource')->getConnection('core_write');
                         $optionValueId = $connection->lastInsertId();
                         $optionId = $connection->fetchOne("SELECT option_id FROM " . $setup->getTable('eav/attribute_option_value') . " WHERE value_id = ?", $optionValueId);
                         $productData[$attributeCode] = $optionId;
                     }
                     $event->getProduct()->setData($attributeCode, $productData[$attributeCode]);
                 } elseif ($origData = $event->getProduct()->getOrigData($attributeCode)) {
                     $event->getProduct()->setData($attributeCode, $origData);
                 }
             }
         }
     }
 }
开发者ID:suspiciousfellow,项目名称:Lazyloadingoption,代码行数:31,代码来源:Observer.php

示例2: explode

                     // se il prodotto ha più colori, salverò nell'attributo filtraggio_colore tutti i colori presenti (se non esiste già)
                     $filtraggio_colori = explode("/", $stringaIdAttributo);
                     $filtraggio_coloriName = explode("/", $stringaValoreAttributo);
                     for ($u = 0; $u < count($filtraggio_colori); $u++) {
                         $stringQuery = "select id_magento from " . $resource->getTableName('wsca_filtraggio_colore') . " where id_ws='" . $filtraggio_colori[$u] . "'";
                         $id_filtraggioColoreMage = $readConnection->fetchOne($stringQuery);
                         if ($id_filtraggioColoreMage == null) {
                             // Colori misti non esiste
                             $attribute_model = Mage::getModel('eav/entity_attribute');
                             $attribute_options_model = Mage::getModel('eav/entity_attribute_source_table');
                             $attribute_code = $attribute_model->getIdByCode('catalog_product', 'ca_filtraggio_colore');
                             $attribute = $attribute_model->load($attribute_code);
                             $attribute->setData('option', array('value' => array('option' => array($filtraggio_coloriName[$u], $filtraggio_coloriName[$u]))));
                             $attribute->save();
                             $setup = new Mage_Eav_Model_Entity_Setup('core_setup');
                             $optionTable = $setup->getTable('eav/attribute_option');
                             $id_filtraggioColoreMage = getLastInsertId($optionTable, 'option_id');
                             $query = "insert into " . $resource->getTableName('wsca_filtraggio_colore') . " (id_magento,id_ws) values('" . $id_filtraggioColoreMage . "','" . $filtraggio_colori[$u] . "')";
                             $writeConnection->query($query);
                         }
                     }
                 }
             }
         }
     }
 }
 // recupero varianti
 foreach ($varianti as $key => $value) {
     $scalare = $key;
     $misura = $value;
     // inserimento prodotto semplice
开发者ID:technomagegithub,项目名称:colb2b,代码行数:31,代码来源:importCatalogoUpdate.php

示例3: array

<?php

$installer = new Mage_Eav_Model_Entity_Setup('core_setup');
$installer->startSetup();
/**
 * Fixes all indexes
 */
$installer->getConnection()->addKey($installer->getTable('payperrentals/reservationorders'), 'IDX_start_end', array('start_date', 'end_date'));
$installer->getConnection()->addKey($installer->getTable('payperrentals/reservationorders'), 'IDX_send_return_id', 'sendreturn_id');
$installer->getConnection()->addKey($installer->getTable('payperrentals/reservationorders'), 'IDX_turnover_start_end', array('start_turnover_before', 'end_turnover_after'));
$installer->getConnection()->dropKey($installer->getTable('payperrentals/reservationprices'), 'entity_id');
$installer->getConnection()->addKey($installer->getTable('payperrentals/reservationprices'), 'IDX_entity_id', 'entity_id');
$installer->getConnection()->addKey($installer->getTable('payperrentals/reservationprices'), 'IDX_store_id', 'store_id');
$installer->getConnection()->addKey($installer->getTable('payperrentals/reservationprices'), 'IDX_date_from_to', array('date_from', 'date_to'));
$installer->getConnection()->addKey($installer->getTable('payperrentals/reservationprices'), 'IDX_ptype', 'ptype');
$installer->getConnection()->addKey($installer->getTable('payperrentals/reservationprices'), 'IDX_numberof', 'numberof');
$installer->getConnection()->dropKey($installer->getTable('payperrentals/sendreturn'), 'order_id');
$installer->getConnection()->addKey($installer->getTable('payperrentals/sendreturn'), 'IDX_order_id', 'order_id');
$installer->getConnection()->addKey($installer->getTable('payperrentals/sendreturn'), 'IDX_order_id', 'order_id');
$installer->getConnection()->addKey($installer->getTable('payperrentals/sendreturn'), 'IDX_res_start_end', array('res_startdate', 'res_enddate'));
$installer->getConnection()->addKey($installer->getTable('payperrentals/sendreturn'), 'IDX_send_return', array('send_date', 'return_date'));
$installer->getConnection()->dropKey($installer->getTable('payperrentals/serialnumbers'), 'entity_id');
$installer->getConnection()->addKey($installer->getTable('payperrentals/serialnumbers'), 'IDX_entity_id', 'entity_id');
$installer->getConnection()->addKey($installer->getTable('payperrentals/serialnumbers'), 'IDX_status', 'status');
$installer->getConnection()->addKey($installer->getTable('payperrentals/ordertodates'), 'IDX_event_date', 'event_date');
$installer->getConnection()->addKey($installer->getTable('payperrentals/rentalqueue'), 'IDX_customer_id', 'customer_id');
$installer->getConnection()->addKey($installer->getTable('payperrentals/rentalqueue'), 'IDX_sendreturn_id', 'sendreturn_id');
$installer->getConnection()->dropKey($installer->getTable('payperrentals/rentalqueue'), 'product_id');
$installer->getConnection()->addKey($installer->getTable('payperrentals/rentalqueue'), 'IDX_product_id', 'product_id');
$installer->getConnection()->addKey($installer->getTable('payperrentals/reservationquotes'), 'IDX_quote_item_id', 'quote_item_id');
$installer->getConnection()->addKey($installer->getTable('payperrentals/reservationquotes'), 'IDX_quote_id', 'quote_id');
开发者ID:hueyl77,项目名称:fourwindsgear,代码行数:31,代码来源:mysql4-upgrade-1.1.9.9-1.2.0.0.php

示例4: import

 public function import()
 {
     $resource = Mage::getSingleton('core/resource');
     $readConnection = $resource->getConnection('core_read');
     $writeConnection = $resource->getConnection('core_write');
     $username = Mage::getStoreConfig('config_ws_sezione/gruppo_cliente/username');
     $password = Mage::getStoreConfig('config_ws_sezione/gruppo_cliente/password');
     $service_url = Mage::getStoreConfig('config_ws_sezione/gruppo_cliente/endpoint');
     if (isset($username) && $username != "" && isset($password) && $password != "" && isset($service_url) && $service_url != "") {
         $filename = "catalogo";
         $logFileName = $filename . '.log';
         try {
             // controllo in che stato mi trovo dell'esecuzione dell'importazione
             $dataCorrente = date('Y-m-d', strtotime('+2 hours', strtotime(date('Y-m-d'))));
             $stringQuery = "select page_number,running,finish from " . $resource->getTableName('wsca_import_new_log') . " where dataImport='" . $dataCorrente . "'";
             $importLog = $readConnection->fetchAll($stringQuery);
             $page_number = 0;
             $finish = 0;
             $running = 0;
             foreach ($importLog as $row) {
                 $page_number = $row['page_number'];
                 $finish = $row['finish'];
                 $running = $row['running'];
             }
             $page_number = $page_number + 1;
             if ($page_number != "" && $running == 0 && $finish == 0) {
                 $pCollection = Mage::getSingleton('index/indexer')->getProcessesCollection();
                 foreach ($pCollection as $process) {
                     $process->setMode(Mage_Index_Model_Process::MODE_MANUAL)->save();
                 }
                 if ($page_number == 1) {
                     // salvo la pagina in cui sono arrivato
                     $query = "insert into " . $resource->getTableName('wsca_import_new_log') . " (page_number,running,finish,dataImport) values('" . $page_number . "','1','" . $finish . "','" . $dataCorrente . "')";
                     $writeConnection->query($query);
                 } else {
                     // salvo la pagina in cui sono arrivato
                     $query = "update " . $resource->getTableName('wsca_import_new_log') . " set page_number='" . $page_number . "',running='1',finish='" . $finish . "' where dataImport='" . $dataCorrente . "'";
                     $writeConnection->query($query);
                 }
                 $controllo = $this->getAttributes($resource, $readConnection, $writeConnection, $username, $password, $service_url);
                 if ($controllo == true) {
                     $service_urlPost = $service_url . "/user/token";
                     $curlPost = curl_init($service_urlPost);
                     $headersPost = array('Content-Type:application/json;charset=utf-8', 'Content-Length: 0', 'Authorization: Basic ' . base64_encode($username . ":" . $password));
                     curl_setopt($curlPost, CURLOPT_POST, true);
                     // indico che la richiesta è di tipo POST
                     curl_setopt($curlPost, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
                     curl_setopt($curlPost, CURLOPT_SSL_VERIFYPEER, false);
                     // disabilito la verifica del certificato SSL; è necessario perchè altrimenti non esegue la chiamata rest
                     curl_setopt($curlPost, CURLOPT_RETURNTRANSFER, true);
                     curl_setopt($curlPost, CURLOPT_SSL_VERIFYHOST, false);
                     curl_setopt($curlPost, CURLOPT_HTTPHEADER, $headersPost);
                     $curl_responsePost = curl_exec($curlPost);
                     if ($curl_responsePost === false) {
                         $infoPost = curl_getinfo($curlPost);
                         curl_close($curlPost);
                         $page_number = $page_number - 1;
                         // salvo la pagina in cui sono arrivato
                         $query = "update " . $resource->getTableName('wsca_import_new_log') . " set page_number='" . $page_number . "',running='0' where dataImport='" . $dataCorrente . "'";
                         $writeConnection->query($query);
                         $readConnection->closeConnection();
                         $writeConnection->closeConnection();
                     } else {
                         curl_close($curlPost);
                         $decodedPost = json_decode($curl_responsePost);
                         if (is_object($decodedPost)) {
                             $arrayPost = get_object_vars($decodedPost);
                         }
                         $aToken = $arrayPost["access_token"];
                         $headersGet = array('Authorization: Bearer ' . $aToken);
                         $dataFine = $dataCorrente . "T00:00:00Z";
                         // recupero solo l'header della richiesta
                         $service_urlGet = $service_url . "/products?images=true&attributes=true&limit=100&until_updated_at=" . $dataFine;
                         Mage::log($service_urlGet, null, $logFileName);
                         //$service_urlGet = $service_url . "/products?images=true&attributes=true&limit=100&id=151431UGH000003-001S";
                         //$service_urlGet = $service_url . "/products?images=true&attributes=true&limit=100";
                         $curlGet = curl_init($service_urlGet);
                         curl_setopt($curlGet, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
                         // accetto ogni autenticazione. Il sitema utilizzerà la migliore
                         curl_setopt($curlGet, CURLOPT_SSL_VERIFYPEER, false);
                         // disabilito la verifica del certificato SSL; è necessario perchè altrimenti non esegue la chiamata rest
                         curl_setopt($curlGet, CURLOPT_RETURNTRANSFER, true);
                         // salvo l'output della richiesta in una variabile
                         curl_setopt($curlGet, CURLOPT_HEADER, true);
                         curl_setopt($curlGet, CURLOPT_SSL_VERIFYHOST, false);
                         curl_setopt($curlGet, CURLOPT_NOBODY, true);
                         curl_setopt($curlGet, CURLOPT_HTTPHEADER, $headersGet);
                         // setto l'header della richiesta
                         $header = curl_exec($curlGet);
                         if ($header === false) {
                             $infoGet = curl_getinfo($curlGet);
                             curl_close($curlGet);
                             $page_number = $page_number - 1;
                             // salvo la pagina in cui sono arrivato
                             $query = "update " . $resource->getTableName('wsca_import_new_log') . " set page_number='" . $page_number . "',running='0' where dataImport='" . $dataCorrente . "'";
                             $writeConnection->query($query);
                             $readConnection->closeConnection();
                             $writeConnection->closeConnection();
                         } else {
                             // costrusico un array dell'header e recupero il totale delle pagine
//.........这里部分代码省略.........
开发者ID:technomagegithub,项目名称:colb2b,代码行数:101,代码来源:Observer.php

示例5: int

<?php

/**
 * Start
 */
$installer = new Mage_Eav_Model_Entity_Setup('core_setup');
$installer->startSetup();
/**
 * Exclude dates
 */
$installer->run("\n    ALTER TABLE {$this->getTable('payperrentals/excludeddates')}\n      CHANGE `entity_id` `product_id` int(10) unsigned NOT NULL DEFAULT '0',\n      MODIFY `store_id`  smallint(5) unsigned NOT NULL DEFAULT '0';\n\n    ALTER TABLE {$this->getTable('payperrentals/excludeddates')}\n      ADD CONSTRAINT `FK_PPR_EXCLUDEDATES_STORE_ID_CORE_STORE_STORE_ID` FOREIGN KEY (`store_id`) REFERENCES {$installer->getTable('core_store')} (`store_id`) ON DELETE CASCADE ON UPDATE CASCADE,\n      ADD CONSTRAINT `FK_PPR_EXCLUDEDATES_PRODUCT_ID_CATALOG_PRODUCT_ID` FOREIGN KEY (`product_id`) REFERENCES {$installer->getTable('catalog_product_entity')} (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE;\n\n");
/**
 * End
 */
$installer->endSetup();
开发者ID:hueyl77,项目名称:fourwindsgear,代码行数:15,代码来源:mysql4-upgrade-1.0.6-1.1.0.php

示例6: getAttributes


//.........这里部分代码省略.........
                        return false;
                    } else {
                        curl_close($curlGet);
                        // parse del contenuto
                        $decodedGet = json_decode($curl_responseGet);
                        $countP = 0;
                        $array_sku = array("");
                        if (is_object($decodedGet)) {
                            $decodedGet = get_object_vars($decodedGet);
                        }
                        $l = 1;
                        foreach ($decodedGet as $key => $value) {
                            $l = $l + 1;
                            $id_attributo = $key;
                            $valoreProdotti = $value;
                            $description = null;
                            $valoriAttributi = null;
                            foreach ($valoreProdotti as $key => $value) {
                                // recupero campi prodotto
                                if ($key == "description") {
                                    $nome_attributo = $value;
                                    if (is_object($nome_attributo)) {
                                        $nome_attributo = get_object_vars($nome_attributo);
                                    }
                                }
                                if ($key == "values") {
                                    $subattributes = $value;
                                    if (is_object($subattributes)) {
                                        $subattributes = get_object_vars($subattributes);
                                    }
                                }
                            }
                            // controllo esistenza dell'attributo in magento
                            $stringQuery = "select id_magento from " . $resource->getTableName('wsca_attributes') . " where id_ws='" . $id_attributo . "'";
                            $id_attributoMage = $readConnection->fetchOne($stringQuery);
                            if ($id_attributoMage == null) {
                                $model = Mage::getModel('eav/entity_setup', 'core_setup');
                                if (count($subattributes) == 0) {
                                    $input = "text";
                                    $dbInput = "testo";
                                } else {
                                    $input = "multiselect";
                                    $dbInput = "select";
                                }
                                $data = array('global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE, 'group' => 'General', 'type' => 'varchar', 'backend' => '', 'frontend' => '', 'label' => ucfirst(strtolower(replace_accents($nome_attributo))), 'input' => $input, 'unique' => false, 'required' => false, 'is_configurable' => false, 'searchable' => false, 'visible_in_advanced_search' => false, 'comparable' => false, 'filterable' => false, 'filterable_in_search' => false, 'used_for_promo_rules' => false, 'visible_on_front' => false, 'used_in_product_listing' => false, 'used_for_sort_by' => false, 'user_defined' => true);
                                $nome_attributoMage = substr("ca_" . $id_attributo, 0, 30);
                                $model->addAttribute('catalog_product', $nome_attributoMage, $data);
                                $setup = new Mage_Eav_Model_Entity_Setup('core_setup');
                                $optionTable = $setup->getTable('eav/attribute');
                                $id_attributoMage = getLastInsertId($optionTable, 'attribute_id');
                                $query = "insert into " . $resource->getTableName('wsca_attributes') . " (id_magento,id_ws,tipo) values('" . $id_attributoMage . "','" . $id_attributo . "','" . $dbInput . "')";
                                $writeConnection->query($query);
                            } else {
                                $nome_attributoMage = substr("ca_" . $id_attributo, 0, 30);
                            }
                            // se l'attributo è il supercolore utilizzo anche l'attributo colore
                            if ($nome_attributo == "Supercolore") {
                            } else {
                                foreach ($subattributes as $key => $value) {
                                    $id_valoreattributo = $key;
                                    $nome_valoreattributo = $value;
                                    // controllo esistenza opzione in magento per l'attributo in questione
                                    $stringQuery = "select id_magento from " . $resource->getTableName('wsca_subattributes') . " where id_ws='" . $id_valoreattributo . "' and id_attributes='" . $id_attributo . "'";
                                    $id_valoreattributoMage = $readConnection->fetchOne($stringQuery);
                                    if ($id_valoreattributoMage == null) {
                                        if ($nome_valoreattributo == "" || $nome_valoreattributo == null) {
开发者ID:technomagegithub,项目名称:colb2b,代码行数:67,代码来源:import.php

示例7: getTable

 public function getTable($tableName)
 {
     if ($this->isNewDdlModel()) {
         return parent::getTable($tableName);
     }
     if (is_array($tableName)) {
         list($tableName, $suffix) = $tableName;
         $cacheName = $tableName . '_' . $suffix;
     } else {
         $cacheName = $tableName;
     }
     if (!isset($this->_tables[$cacheName])) {
         $this->_tables[$cacheName] = Mage::getSingleton('core/resource')->getTableName($tableName);
         if (isset($suffix)) {
             $this->_tables[$cacheName] = $this->_tables[$cacheName] . '_' . $suffix;
         }
     }
     return $this->_tables[$cacheName];
 }
开发者ID:eniuz,项目名称:entitytype-manager,代码行数:19,代码来源:Setup.php

示例8: import

 public function import()
 {
     $resource = Mage::getSingleton('core/resource');
     $readConnection = $resource->getConnection('core_read');
     $writeConnection = $resource->getConnection('core_write');
     $username = Mage::getStoreConfig('config_ws_sezione/gruppo_cliente/username');
     $password = Mage::getStoreConfig('config_ws_sezione/gruppo_cliente/password');
     $service_url = Mage::getStoreConfig('config_ws_sezione/gruppo_cliente/endpoint');
     if (isset($username) && $username != "" && isset($password) && $password != "" && isset($service_url) && $service_url != "") {
         $filename = "catalogo";
         $logFileName = $filename . '.log';
         $filename2 = "catalogoErrore";
         $logFileName2 = $filename2 . '.log';
         try {
             // controllo in che stato mi trovo dell'esecuzione dell'importazione
             $dataCorrente = date('Y-m-d', strtotime('+2 hours', strtotime(date('Y-m-d'))));
             $stringQuery = "select page_number,running,finish from " . $resource->getTableName('wsca_import_log') . " where dataImport='" . $dataCorrente . "'";
             $importLog = $readConnection->fetchAll($stringQuery);
             $page_number = 0;
             $finish = 0;
             $running = 0;
             foreach ($importLog as $row) {
                 $page_number = $row['page_number'];
                 $finish = $row['finish'];
                 $running = $row['running'];
             }
             $page_number = $page_number + 1;
             if ($page_number != "" && $running == 0 && $finish == 0) {
                 $pCollection = Mage::getSingleton('index/indexer')->getProcessesCollection();
                 foreach ($pCollection as $process) {
                     $process->setMode(Mage_Index_Model_Process::MODE_MANUAL)->save();
                 }
                 if ($page_number == 1) {
                     // salvo la pagina in cui sono arrivato
                     $query = "insert into " . $resource->getTableName('wsca_import_log') . " (page_number,running,finish,dataImport) values('" . $page_number . "','1','" . $finish . "','" . $dataCorrente . "')";
                     $writeConnection->query($query);
                 } else {
                     // salvo la pagina in cui sono arrivato
                     $query = "update " . $resource->getTableName('wsca_import_log') . " set page_number='" . $page_number . "',running='1',finish='" . $finish . "' where dataImport='" . $dataCorrente . "'";
                     $writeConnection->query($query);
                 }
                 $controllo = $this->getAttributes($resource, $readConnection, $writeConnection, $username, $password, $service_url);
                 if ($controllo == true) {
                     $service_urlPost = $service_url . "/user/token";
                     $curlPost = curl_init($service_urlPost);
                     $headersPost = array('Content-Type:application/json;charset=utf-8', 'Content-Length: 0', 'Authorization: Basic ' . base64_encode($username . ":" . $password));
                     curl_setopt($curlPost, CURLOPT_POST, true);
                     // indico che la richiesta è di tipo POST
                     curl_setopt($curlPost, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
                     curl_setopt($curlPost, CURLOPT_SSL_VERIFYPEER, false);
                     // disabilito la verifica del certificato SSL; è necessario perchè altrimenti non esegue la chiamata rest
                     curl_setopt($curlPost, CURLOPT_RETURNTRANSFER, true);
                     curl_setopt($curlPost, CURLOPT_SSL_VERIFYHOST, false);
                     curl_setopt($curlPost, CURLOPT_HTTPHEADER, $headersPost);
                     $curl_responsePost = curl_exec($curlPost);
                     if ($curl_responsePost === false) {
                         $infoPost = curl_getinfo($curlPost);
                         curl_close($curlPost);
                         $page_number = $page_number - 1;
                         // salvo la pagina in cui sono arrivato
                         $query = "update " . $resource->getTableName('wsca_import_log') . " set page_number='" . $page_number . "',running='0' where dataImport='" . $dataCorrente . "'";
                         $writeConnection->query($query);
                         $readConnection->closeConnection();
                         $writeConnection->closeConnection();
                     } else {
                         curl_close($curlPost);
                         $decodedPost = json_decode($curl_responsePost);
                         if (is_object($decodedPost)) {
                             $arrayPost = get_object_vars($decodedPost);
                         }
                         $aToken = $arrayPost["access_token"];
                         $headersGet = array('Authorization: Bearer ' . $aToken);
                         $dataSistema = date('Y-m-d', strtotime('-1 day', strtotime(date('Y-m-d'))));
                         $dataFine = $dataCorrente . "T00:00:00Z";
                         $dataImport = $dataSistema . "T00:01:00Z";
                         // recupero solo l'header della richiesta
                         $service_urlGet = $service_url . "/products?images=true&attributes=true&limit=100&since_updated_at=" . $dataImport . "&until_updated_at=" . $dataFine;
                         Mage::log($service_urlGet, null, $logFileName);
                         $curlGet = curl_init($service_urlGet);
                         curl_setopt($curlGet, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
                         // accetto ogni autenticazione. Il sitema utilizzerà la migliore
                         curl_setopt($curlGet, CURLOPT_SSL_VERIFYPEER, false);
                         // disabilito la verifica del certificato SSL; è necessario perchè altrimenti non esegue la chiamata rest
                         curl_setopt($curlGet, CURLOPT_RETURNTRANSFER, true);
                         // salvo l'output della richiesta in una variabile
                         curl_setopt($curlGet, CURLOPT_HEADER, true);
                         curl_setopt($curlGet, CURLOPT_SSL_VERIFYHOST, false);
                         curl_setopt($curlGet, CURLOPT_NOBODY, true);
                         curl_setopt($curlGet, CURLOPT_HTTPHEADER, $headersGet);
                         // setto l'header della richiesta
                         $header = curl_exec($curlGet);
                         if ($header === false) {
                             $infoGet = curl_getinfo($curlGet);
                             curl_close($curlGet);
                             $page_number = $page_number - 1;
                             // salvo la pagina in cui sono arrivato
                             $query = "update " . $resource->getTableName('wsca_import_log') . " set page_number='" . $page_number . "',running='0' where dataImport='" . $dataCorrente . "'";
                             $writeConnection->query($query);
                             $readConnection->closeConnection();
                             $writeConnection->closeConnection();
//.........这里部分代码省略.........
开发者ID:technomagegithub,项目名称:colb2b,代码行数:101,代码来源:Observer.php

示例9: ON

<?php

/**
 * Start
 */
$installer = new Mage_Eav_Model_Entity_Setup('core_setup');
$installer->startSetup();
/**
 * Reservation orders and reservation quotes separation
 */
$installer->run("\n    UPDATE {$this->getTable('payperrentals/reservationorders')} AS `reservation`\n      INNER JOIN {$this->getTable('sales/order')} AS `order` ON (`reservation`.`order_id` = `order`.`increment_id`)\n      SET  `reservation`.`order_id` = `order`.`entity_id`\n    WHERE `otype`='order';\n\n    CREATE TABLE {$this->getTable('payperrentals/reservationquotes')} LIKE {$this->getTable('payperrentals/reservationorders')};\n\n    INSERT INTO {$this->getTable('payperrentals/reservationquotes')} (SELECT * FROM {$this->getTable('payperrentals/reservationorders')} WHERE `otype`='quote');\n\n    DELETE FROM {$this->getTable('payperrentals/reservationorders')} WHERE `otype`='quote';\n\n    ALTER TABLE {$this->getTable('payperrentals/reservationorders')}\n      DROP COLUMN `otype`,\n      DROP COLUMN `quote_id`,\n      MODIFY `order_id`  int(10) unsigned NOT NULL,\n      MODIFY `order_item_id` int(10) unsigned NOT NULL;\n\n    ALTER TABLE {$this->getTable('payperrentals/reservationquotes')}\n      DROP COLUMN `otype`,\n      DROP COLUMN `order_item_id`,\n      CHANGE `order_id` `quote_item_id`  int(10) unsigned NOT NULL,\n      MODIFY `quote_id` int(10) unsigned NOT NULL;\n\n     ALTER TABLE {$this->getTable('payperrentals/reservationquotes')}\n      ADD CONSTRAINT `FK_PPR_QUOTES_QUOTE_ID_SALES_QUOTE_ENTITY_ID` FOREIGN KEY (`quote_id`) REFERENCES {$installer->getTable('sales/quote')} (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE,\n      ADD CONSTRAINT `FK_PPR_QUOTES_ORDER_ID_SALES_QUOTE_ITEM_ID` FOREIGN KEY (`quote_item_id`) REFERENCES {$installer->getTable('sales/quote_item')} (`item_id`) ON DELETE CASCADE ON UPDATE CASCADE;\n");
/**
 * End
 */
$installer->endSetup();
开发者ID:hueyl77,项目名称:fourwindsgear,代码行数:15,代码来源:mysql4-upgrade-1.1.0-1.1.1.php

示例10: array

<?php

$installer = new Mage_Eav_Model_Entity_Setup('core_setup');
$installer->getConnection()->addColumn($installer->getTable('catalog/eav_attribute'), 'enable_layered_swatch', array('type' => Varien_Db_Ddl_Table::TYPE_BOOLEAN, 'nullable' => true, 'default' => '0', 'comment' => 'Enable swatch in layered navigation'));
$installer->endSetup();
开发者ID:aayushKhandpur,项目名称:aayush-renting,代码行数:5,代码来源:mysql4-upgrade-1.0.0-1.0.1.php

示例11: import

 public function import()
 {
     $resource = Mage::getSingleton('core/resource');
     $readConnection = $resource->getConnection('core_read');
     $writeConnection = $resource->getConnection('core_write');
     $username = Mage::getStoreConfig('config_ws_sezione/gruppo_cliente/username');
     $password = Mage::getStoreConfig('config_ws_sezione/gruppo_cliente/password');
     $service_url = Mage::getStoreConfig('config_ws_sezione/gruppo_cliente/endpoint');
     if (isset($username) && $username != "" && isset($password) && $password != "" && isset($service_url) && $service_url != "") {
         $filename = "immagini";
         $logFileName = $filename . '.log';
         $filename2 = "immaginiErrore";
         $logFileName2 = $filename2 . '.log';
         $dataCorrente = date('Y-m-d', strtotime('+2 hours', strtotime(date('Y-m-d'))));
         $stringQuery = "select product_number,running,finish from " . $resource->getTableName('wsca_immagini_log') . " where dataImport='" . $dataCorrente . "'";
         $importLog = $readConnection->fetchAll($stringQuery);
         $product_number = 0;
         $finish = 0;
         $running = 0;
         foreach ($importLog as $row) {
             $product_number = $row['product_number'];
             $finish = $row['finish'];
             $running = $row['running'];
         }
         $product_number = $product_number + 1;
         if ($product_number != "" && $running == 0 && $finish == 0) {
             Mage::log("INIZIO IMMAGINI", null, $logFileName);
             if ($product_number == 1) {
                 // salvo la pagina in cui sono arrivato
                 $query = "insert into " . $resource->getTableName('wsca_immagini_log') . " (product_number,running,finish,dataImport) values('" . $product_number . "','1','" . $finish . "','" . $dataCorrente . "')";
                 $writeConnection->query($query);
             } else {
                 // salvo la pagina in cui sono arrivato
                 $query = "update " . $resource->getTableName('wsca_immagini_log') . " set product_number='" . $product_number . "',running='1',finish='" . $finish . "' where dataImport='" . $dataCorrente . "'";
                 $writeConnection->query($query);
             }
             // recupero tutti i prodotti configurabili
             $collection = Mage::getModel('catalog/product')->getCollection()->addAttributeToFilter('type_id', 'configurable')->addAttributeToFilter('visibility', 4)->addAttributeToFilter('entity_id', array('gteq' => $product_number));
             $count_prodotti = 0;
             foreach ($collection as $product) {
                 try {
                     $productConfigurable = Mage::getModel("catalog/product")->load($product->getId());
                     $images = $productConfigurable->getMediaGalleryImages();
                     if (count($images) == 0) {
                         Mage::log($product->getId(), null, $logFileName);
                         $skuUrl = $productConfigurable->getSku();
                         $skuUrl = str_replace(" ", "%20", $skuUrl);
                         Mage::log($skuUrl, null, $logFileName);
                         $service_urlPost = $service_url . "/user/token";
                         $curlPost = curl_init($service_urlPost);
                         $headersPost = array('Content-Type:application/json;charset=utf-8', 'Content-Length: 0', 'Authorization: Basic ' . base64_encode($username . ":" . $password));
                         curl_setopt($curlPost, CURLOPT_POST, true);
                         // indico che la richiesta è di tipo POST
                         curl_setopt($curlPost, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
                         curl_setopt($curlPost, CURLOPT_SSL_VERIFYPEER, false);
                         // disabilito la verifica del certificato SSL; è necessario perchè altrimenti non esegue la chiamata rest
                         curl_setopt($curlPost, CURLOPT_RETURNTRANSFER, true);
                         curl_setopt($curlPost, CURLOPT_SSL_VERIFYHOST, false);
                         curl_setopt($curlPost, CURLOPT_HTTPHEADER, $headersPost);
                         $curl_responsePost = curl_exec($curlPost);
                         if ($curl_responsePost === false) {
                             $infoPost = curl_getinfo($curlPost);
                             curl_close($curlPost);
                         } else {
                             curl_close($curlPost);
                             $decodedPost = json_decode($curl_responsePost);
                             if (is_object($decodedPost)) {
                                 $arrayPost = get_object_vars($decodedPost);
                             }
                             $aToken = $arrayPost["access_token"];
                             $headersGet = array('Authorization: Bearer ' . $aToken);
                             $service_urlGet = $service_url . "/products?&id=" . $skuUrl;
                             $curlGet = curl_init($service_urlGet);
                             curl_setopt($curlGet, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
                             // accetto ogni autenticazione. Il sitema utilizzerà la migliore
                             curl_setopt($curlGet, CURLOPT_SSL_VERIFYPEER, false);
                             // disabilito la verifica del certificato SSL; è necessario perchè altrimenti non esegue la chiamata rest
                             curl_setopt($curlGet, CURLOPT_RETURNTRANSFER, true);
                             // salvo l'output della richiesta in una variabile
                             curl_setopt($curlGet, CURLOPT_HTTPHEADER, $headersGet);
                             // setto l'header della richiesta
                             curl_setopt($curlGet, CURLOPT_SSL_VERIFYHOST, false);
                             $curl_responseGet = curl_exec($curlGet);
                             if ($curl_responseGet === false) {
                                 $infoGet = curl_getinfo($curlGet);
                                 curl_close($curlGet);
                             } else {
                                 curl_close($curlGet);
                                 // parse del contenuto
                                 $decodedGet = json_decode($curl_responseGet);
                                 $countP = 0;
                                 $array_sku = array("");
                                 if (is_object($decodedGet)) {
                                     $decodedGet = get_object_vars($decodedGet);
                                 }
                                 $l = 1;
                                 foreach ($decodedGet as $key => $value) {
                                     $qtaTot = 0;
                                     $l = $l + 1;
                                     $id = $key;
//.........这里部分代码省略.........
开发者ID:technomagegithub,项目名称:colb2b,代码行数:101,代码来源:Observer.php

示例12: _removeResources

 protected function _removeResources($module)
 {
     $modulePreffix = preg_replace('|[^a-z]|', '', strtolower($module));
     $this->_setup->getConnection()->delete($this->_setup->getTable('core/resource'), 'code LIKE "' . $modulePreffix . '%"');
 }
开发者ID:Jonathonbyrd,项目名称:Optimized-Magento-1.9.x,代码行数:5,代码来源:Abstract.php

示例13: array

<?php

$installer = $this;
$installer->startSetup();
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
/**
$setup->addAttribute('order', Vikont_EVOConnector_Helper_Data::ORDER_EVO_STATUS_FIELD, array(
	'position'      => 1,
	'input'         => 'text',
	'type'          => 'tinyint',
	'label'         => 'EVO Order State',
	'visible'       => 0,
	'required'      => 0,
	'user_defined'	=> 0,
	'global'        => 1,
	'default'		=> 0,
	'visible_on_front'  => 0,
));/**/
$setup->addAttribute(Mage_Sales_Model_Order::ENTITY, Vikont_EVOConnector_Helper_Data::ORDER_EVO_STATUS_FIELD, array('type' => 'static', 'required' => 0, 'label' => 'EVO Order State', 'default' => 0, 'visible' => false, 'input' => 'text', 'global' => 1));
$setup->getConnection()->addColumn($setup->getTable('sales_flat_order'), Vikont_EVOConnector_Helper_Data::ORDER_EVO_STATUS_FIELD, 'TINYINT(1) UNSIGNED NOT NULL DEFAULT 0');
$setup->run("UPDATE `{$setup->getTable('sales_flat_order')}` SET " . Vikont_EVOConnector_Helper_Data::ORDER_EVO_STATUS_FIELD . "=1 WHERE status<>'pending'");
$installer->run('');
$installer->endSetup();
开发者ID:rcclaudrey,项目名称:dev,代码行数:23,代码来源:mysql4-upgrade-1.0-1.0.1.php

示例14: array

<?php

$installer = new Mage_Eav_Model_Entity_Setup('core_setup');
$installer->getConnection()->addColumn($installer->getTable('catalog/eav_attribute'), 'layered_filter_option', array('type' => Varien_Db_Ddl_Table::TYPE_INTEGER, 'nullable' => true, 'default' => '-1', 'comment' => 'Attribute options on layred navigation'));
$installer->endSetup();
开发者ID:aayushKhandpur,项目名称:aayush-renting,代码行数:5,代码来源:mysql4-upgrade-1.0.2-1.0.3.php

示例15: array

<?php

require_once 'app/Mage.php';
Mage::app();
$installer = new Mage_Eav_Model_Entity_Setup('core_setup');
$installer->startSetup();
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$entityTypeId = $setup->getEntityTypeId('catalog_category');
$attributeSetId = $setup->getDefaultAttributeSetId($entityTypeId);
$attributeGroupId = $setup->getDefaultAttributeGroupId($entityTypeId, $attributeSetId);
$attribute = array('input' => 'select', 'type' => 'int', 'source' => 'eav/entity_attribute_source_boolean', 'label' => 'Integrar com AnyMarket', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, 'visible' => true, 'position' => 0, 'required' => true, 'user_defined' => true, 'default' => "", 'group' => "General Information");
$setup->addAttribute('catalog_category', 'categ_integra_anymarket', $attribute);
$attributeId = $setup->getAttributeId($entityTypeId, 'categ_integra_anymarket');
$setup->run("\nINSERT IGNORE INTO `{$installer->getTable('catalog_category_entity_int')}`\n(`entity_type_id`, `attribute_id`, `entity_id`, `value`)\n    SELECT '{$entityTypeId}', '{$attributeId}', `entity_id`, '1'\n        FROM `{$installer->getTable('catalog_category_entity')}`;\n");
$installer->endSetup();
开发者ID:AnyMarket,项目名称:magento,代码行数:15,代码来源:createCategoriaAnymarket.php


注:本文中的Mage_Eav_Model_Entity_Setup::getTable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。