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


PHP Mage_Downloadable_Model_Link::getUseDefaultTitle方法代码示例

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


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

示例1: saveItemTitleAndPrice

 /**
  * Save title and price of link item
  *
  * @param Mage_Downloadable_Model_Link $linkObject
  * @return Mage_Downloadable_Model_Mysql4_link
  */
 public function saveItemTitleAndPrice($linkObject)
 {
     $stmt = $this->_getReadAdapter()->select()->from($this->getTable('downloadable/link_title'))->where('link_id = ?', $linkObject->getId())->where('store_id = ?', $linkObject->getStoreId());
     if ($this->_getReadAdapter()->fetchOne($stmt)) {
         $where = $this->_getReadAdapter()->quoteInto('link_id = ?', $linkObject->getId()) . ' AND ' . $this->_getReadAdapter()->quoteInto('store_id = ?', $linkObject->getStoreId());
         if ($linkObject->getUseDefaultTitle()) {
             $this->_getWriteAdapter()->delete($this->getTable('downloadable/link_title'), $where);
         } else {
             $this->_getWriteAdapter()->update($this->getTable('downloadable/link_title'), array('title' => $linkObject->getTitle()), $where);
         }
     } else {
         if (!$linkObject->getUseDefaultTitle()) {
             $this->_getWriteAdapter()->insert($this->getTable('downloadable/link_title'), array('link_id' => $linkObject->getId(), 'store_id' => $linkObject->getStoreId(), 'title' => $linkObject->getTitle()));
         }
     }
     $stmt = null;
     $stmt = $this->_getReadAdapter()->select()->from($this->getTable('downloadable/link_price'))->where('link_id = ?', $linkObject->getId())->where('website_id = ?', $linkObject->getWebsiteId());
     if ($this->_getReadAdapter()->fetchOne($stmt)) {
         $where = $this->_getReadAdapter()->quoteInto('link_id = ?', $linkObject->getId()) . ' AND ' . $this->_getReadAdapter()->quoteInto('website_id = ?', $linkObject->getWebsiteId());
         if ($linkObject->getUseDefaultPrice()) {
             $this->_getReadAdapter()->delete($this->getTable('downloadable/link_price'), $where);
         } else {
             $this->_getWriteAdapter()->update($this->getTable('downloadable/link_price'), array('price' => $linkObject->getPrice()), $where);
         }
     } else {
         if (!$linkObject->getUseDefaultPrice()) {
             $this->_getWriteAdapter()->insert($this->getTable('downloadable/link_price'), array('link_id' => $linkObject->getId(), 'website_id' => $linkObject->getWebsiteId(), 'price' => $linkObject->getPrice()));
         }
     }
     return $this;
 }
开发者ID:jauderho,项目名称:magento-mirror,代码行数:37,代码来源:Link.php

示例2: saveItemTitleAndPrice

 /**
  * Save title and price of link item
  *
  * @param Mage_Downloadable_Model_Link $linkObject
  * @return Mage_Downloadable_Model_Resource_Link
  */
 public function saveItemTitleAndPrice($linkObject)
 {
     $writeAdapter = $this->_getWriteAdapter();
     $linkTitleTable = $this->getTable('downloadable/link_title');
     $linkPriceTable = $this->getTable('downloadable/link_price');
     $select = $writeAdapter->select()->from($this->getTable('downloadable/link_title'))->where('link_id=:link_id AND store_id=:store_id');
     $bind = array(':link_id' => $linkObject->getId(), ':store_id' => (int) $linkObject->getStoreId());
     if ($writeAdapter->fetchOne($select, $bind)) {
         $where = array('link_id = ?' => $linkObject->getId(), 'store_id = ?' => (int) $linkObject->getStoreId());
         if ($linkObject->getUseDefaultTitle()) {
             $writeAdapter->delete($linkTitleTable, $where);
         } else {
             $insertData = array('title' => $linkObject->getTitle());
             $writeAdapter->update($linkTitleTable, $insertData, $where);
         }
     } else {
         if (!$linkObject->getUseDefaultTitle()) {
             $writeAdapter->insert($linkTitleTable, array('link_id' => $linkObject->getId(), 'store_id' => (int) $linkObject->getStoreId(), 'title' => $linkObject->getTitle()));
         }
     }
     $select = $writeAdapter->select()->from($linkPriceTable)->where('link_id=:link_id AND website_id=:website_id');
     $bind = array(':link_id' => $linkObject->getId(), ':website_id' => (int) $linkObject->getWebsiteId());
     if ($writeAdapter->fetchOne($select, $bind)) {
         $where = array('link_id = ?' => $linkObject->getId(), 'website_id = ?' => $linkObject->getWebsiteId());
         if ($linkObject->getUseDefaultPrice()) {
             $writeAdapter->delete($linkPriceTable, $where);
         } else {
             $writeAdapter->update($linkPriceTable, array('price' => $linkObject->getPrice()), $where);
         }
     } else {
         if (!$linkObject->getUseDefaultPrice()) {
             $dataToInsert[] = array('link_id' => $linkObject->getId(), 'website_id' => (int) $linkObject->getWebsiteId(), 'price' => (double) $linkObject->getPrice());
             if ($linkObject->getOrigData('link_id') != $linkObject->getLinkId()) {
                 $_isNew = true;
             } else {
                 $_isNew = false;
             }
             if ($linkObject->getWebsiteId() == 0 && $_isNew && !Mage::helper('catalog')->isPriceGlobal()) {
                 $websiteIds = $linkObject->getProductWebsiteIds();
                 foreach ($websiteIds as $websiteId) {
                     $baseCurrency = Mage::app()->getBaseCurrencyCode();
                     $websiteCurrency = Mage::app()->getWebsite($websiteId)->getBaseCurrencyCode();
                     if ($websiteCurrency == $baseCurrency) {
                         continue;
                     }
                     $rate = Mage::getModel('directory/currency')->load($baseCurrency)->getRate($websiteCurrency);
                     if (!$rate) {
                         $rate = 1;
                     }
                     $newPrice = $linkObject->getPrice() * $rate;
                     $dataToInsert[] = array('link_id' => $linkObject->getId(), 'website_id' => (int) $websiteId, 'price' => $newPrice);
                 }
             }
             $writeAdapter->insertMultiple($linkPriceTable, $dataToInsert);
         }
     }
     return $this;
 }
开发者ID:barneydesmond,项目名称:propitious-octo-tribble,代码行数:64,代码来源:Link.php

示例3: saveItemTitleAndPrice

 /**
  * Save title and price of link item
  *
  * @param Mage_Downloadable_Model_Link $linkObject
  * @return Mage_Downloadable_Model_Mysql4_link
  */
 public function saveItemTitleAndPrice($linkObject)
 {
     $stmt = $this->_getReadAdapter()->select()->from($this->getTable('downloadable/link_title'))->where('link_id = ?', $linkObject->getId())->where('store_id = ?', $linkObject->getStoreId());
     if ($this->_getReadAdapter()->fetchOne($stmt)) {
         $where = $this->_getReadAdapter()->quoteInto('link_id = ?', $linkObject->getId()) . ' AND ' . $this->_getReadAdapter()->quoteInto('store_id = ?', $linkObject->getStoreId());
         if ($linkObject->getUseDefaultTitle()) {
             $this->_getWriteAdapter()->delete($this->getTable('downloadable/link_title'), $where);
         } else {
             $this->_getWriteAdapter()->update($this->getTable('downloadable/link_title'), array('title' => $linkObject->getTitle()), $where);
         }
     } else {
         if (!$linkObject->getUseDefaultTitle()) {
             $this->_getWriteAdapter()->insert($this->getTable('downloadable/link_title'), array('link_id' => $linkObject->getId(), 'store_id' => $linkObject->getStoreId(), 'title' => $linkObject->getTitle()));
         }
     }
     $stmt = null;
     $stmt = $this->_getReadAdapter()->select()->from($this->getTable('downloadable/link_price'))->where('link_id = ?', $linkObject->getId())->where('website_id = ?', $linkObject->getWebsiteId());
     if ($this->_getReadAdapter()->fetchOne($stmt)) {
         $where = $this->_getReadAdapter()->quoteInto('link_id = ?', $linkObject->getId()) . ' AND ' . $this->_getReadAdapter()->quoteInto('website_id = ?', $linkObject->getWebsiteId());
         if ($linkObject->getUseDefaultPrice()) {
             $this->_getReadAdapter()->delete($this->getTable('downloadable/link_price'), $where);
         } else {
             $this->_getWriteAdapter()->update($this->getTable('downloadable/link_price'), array('price' => $linkObject->getPrice()), $where);
         }
     } else {
         if (!$linkObject->getUseDefaultPrice()) {
             $dataToInsert[] = array('link_id' => $linkObject->getId(), 'website_id' => $linkObject->getWebsiteId(), 'price' => $linkObject->getPrice());
             $_isNew = $linkObject->getOrigData('link_id') != $linkObject->getLinkId();
             if ($linkObject->getWebsiteId() == 0 && $_isNew && !Mage::helper('catalog')->isPriceGlobal()) {
                 $websiteIds = $linkObject->getProductWebsiteIds();
                 foreach ($websiteIds as $websiteId) {
                     $baseCurrency = Mage::app()->getBaseCurrencyCode();
                     $websiteCurrency = Mage::app()->getWebsite($websiteId)->getBaseCurrencyCode();
                     if ($websiteCurrency == $baseCurrency) {
                         continue;
                     }
                     $rate = Mage::getModel('directory/currency')->load($baseCurrency)->getRate($websiteCurrency);
                     if (!$rate) {
                         $rate = 1;
                     }
                     $newPrice = $linkObject->getPrice() * $rate;
                     $dataToInsert[] = array('link_id' => $linkObject->getId(), 'website_id' => $websiteId, 'price' => $newPrice);
                 }
             }
             foreach ($dataToInsert as $_data) {
                 $this->_getWriteAdapter()->insert($this->getTable('downloadable/link_price'), $_data);
             }
         }
     }
     return $this;
 }
开发者ID:jpbender,项目名称:mage_virtual,代码行数:57,代码来源:Link.php


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