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


PHP Mage_Downloadable_Model_Sample类代码示例

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


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

示例1: deleteItems

 /**
  * Delete data by item(s)
  *
  * @param Mage_Downloadable_Model_Sample|array|int $items
  * @return Mage_Downloadable_Model_Resource_Sample
  */
 public function deleteItems($items)
 {
     $writeAdapter = $this->_getWriteAdapter();
     $where = '';
     if ($items instanceof Mage_Downloadable_Model_Sample) {
         $where = array('sample_id = ?' => $items->getId());
     } else {
         $where = array('sample_id in (?)' => $items);
     }
     if ($where) {
         $writeAdapter->delete($this->getMainTable(), $where);
         $writeAdapter->delete($this->getTable('downloadable/sample_title'), $where);
     }
     return $this;
 }
开发者ID:ravi2jdesign,项目名称:solvingmagento_1.7.0,代码行数:21,代码来源:Sample.php

示例2: uploadAction

 /**
  * Upload file controller action
  */
 public function uploadAction()
 {
     $type = $this->getRequest()->getParam('type');
     $tmpPath = '';
     if ($type == 'samples') {
         $tmpPath = Mage_Downloadable_Model_Sample::getBaseTmpPath();
     } elseif ($type == 'links') {
         $tmpPath = Mage_Downloadable_Model_Link::getBaseTmpPath();
     } elseif ($type == 'link_samples') {
         $tmpPath = Mage_Downloadable_Model_Link::getBaseSampleTmpPath();
     }
     $result = array();
     try {
         $uploader = new Mage_Core_Model_File_Uploader($type);
         $uploader->setAllowRenameFiles(true);
         $uploader->setFilesDispersion(true);
         $result = $uploader->save($tmpPath);
         /**
          * Workaround for prototype 1.7 methods "isJSON", "evalJSON" on Windows OS
          */
         $result['tmp_name'] = str_replace(DS, "/", $result['tmp_name']);
         $result['path'] = str_replace(DS, "/", $result['path']);
         if (isset($result['file'])) {
             $fullPath = rtrim($tmpPath, DS) . DS . ltrim($result['file'], DS);
             Mage::helper('core/file_storage_database')->saveFile($fullPath);
         }
         $result['cookie'] = array('name' => session_name(), 'value' => $this->_getSession()->getSessionId(), 'lifetime' => $this->_getSession()->getCookieLifetime(), 'path' => $this->_getSession()->getCookiePath(), 'domain' => $this->_getSession()->getCookieDomain());
     } catch (Exception $e) {
         $result = array('error' => $e->getMessage(), 'errorcode' => $e->getCode());
     }
     $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
 }
开发者ID:cewolf2002,项目名称:magento,代码行数:35,代码来源:FileController.php

示例3: _uploadFile

 /**
  * Decode file from base64 and upload it to donwloadable 'tmp' folder
  *
  * @param array $fileInfo
  * @param string $type
  * @return string
  */
 protected function _uploadFile($fileInfo, $type)
 {
     $tmpPath = '';
     if ($type == 'sample') {
         $tmpPath = Mage_Downloadable_Model_Sample::getBaseTmpPath();
     } elseif ($type == 'link') {
         $tmpPath = Mage_Downloadable_Model_Link::getBaseTmpPath();
     } elseif ($type == 'link_samples') {
         $tmpPath = Mage_Downloadable_Model_Link::getBaseSampleTmpPath();
     }
     $result = array();
     try {
         $uploader = Mage::getModel('downloadable/link_api_uploader', $fileInfo);
         $uploader->setAllowRenameFiles(true);
         $uploader->setFilesDispersion(true);
         $result = $uploader->save($tmpPath);
         if (isset($result['file'])) {
             $fullPath = rtrim($tmpPath, DS) . DS . ltrim($result['file'], DS);
             Mage::helper('core/file_storage_database')->saveFile($fullPath);
         }
     } catch (Exception $e) {
         if ($e->getMessage() != '') {
             $this->_fault('upload_failed', $e->getMessage());
         } else {
             $this->_fault($e->getCode());
         }
     }
     $result['status'] = 'new';
     $result['name'] = substr($result['file'], strrpos($result['file'], '/') + 1);
     return Mage::helper('core')->jsonEncode(array($result));
 }
开发者ID:SalesOneGit,项目名称:s1_magento,代码行数:38,代码来源:Api.php

示例4: uploadAction

 /**
  * Upload file controller action
  */
 public function uploadAction()
 {
     $type = $this->getRequest()->getParam('type');
     $tmpPath = '';
     if ($type == 'samples') {
         $tmpPath = Mage_Downloadable_Model_Sample::getBaseTmpPath();
     } elseif ($type == 'links') {
         $tmpPath = Mage_Downloadable_Model_Link::getBaseTmpPath();
     } elseif ($type == 'link_samples') {
         $tmpPath = Mage_Downloadable_Model_Link::getBaseSampleTmpPath();
     }
     $result = array();
     try {
         $uploader = new Mage_Core_Model_File_Uploader($type);
         $uploader->setAllowRenameFiles(true);
         $uploader->setFilesDispersion(true);
         $result = $uploader->save($tmpPath);
         if (isset($result['file'])) {
             $fullPath = rtrim($tmpPath, DS) . DS . ltrim($result['file'], DS);
             Mage::helper('Mage_Core_Helper_File_Storage_Database')->saveFile($fullPath);
         }
         $result['cookie'] = array('name' => session_name(), 'value' => $this->_getSession()->getSessionId(), 'lifetime' => $this->_getSession()->getCookieLifetime(), 'path' => $this->_getSession()->getCookiePath(), 'domain' => $this->_getSession()->getCookieDomain());
     } catch (Exception $e) {
         $result = array('error' => $e->getMessage(), 'errorcode' => $e->getCode());
     }
     $this->getResponse()->setBody(Mage::helper('Mage_Core_Helper_Data')->jsonEncode($result));
 }
开发者ID:relue,项目名称:magento2,代码行数:30,代码来源:FileController.php

示例5: deleteItems

 /**
  * Delete data by item(s)
  *
  * @param Mage_Downloadable_Model_Sample|array|int $items
  * @return Mage_Downloadable_Model_Mysql4_Sample
  */
 public function deleteItems($items)
 {
     $where = '';
     if ($items instanceof Mage_Downloadable_Model_Sample) {
         $where = $this->_getReadAdapter()->quoteInto('sample_id = ?', $items->getId());
     } elseif (is_array($items)) {
         $where = $this->_getReadAdapter()->quoteInto('sample_id in (?)', $items);
     } else {
         $where = $this->_getReadAdapter()->quoteInto('sample_id = ?', $items);
     }
     if ($where) {
         $this->_getReadAdapter()->delete($this->getTable('downloadable/sample'), $where);
         $this->_getReadAdapter()->delete($this->getTable('downloadable/sample_title'), $where);
     }
     return $this;
 }
开发者ID:hunnybohara,项目名称:magento-chinese-localization,代码行数:22,代码来源:Sample.php

示例6: getSampleData

 /**
  * Retrieve samples array
  *
  * @return array
  */
 public function getSampleData()
 {
     $samplesArr = array();
     $samples = $this->getProduct()->getTypeInstance(true)->getSamples($this->getProduct());
     foreach ($samples as $item) {
         $tmpSampleItem = array('sample_id' => $item->getId(), 'title' => $item->getTitle(), 'sample_url' => $item->getSampleUrl(), 'sample_type' => $item->getSampleType(), 'sort_order' => $item->getSortOrder());
         $file = Mage::helper('downloadable/file')->getFilePath(Mage_Downloadable_Model_Sample::getBasePath(), $item->getSampleFile());
         if ($item->getSampleFile() && is_file($file)) {
             $tmpSampleItem['file_save'] = array(array('file' => $item->getSampleFile(), 'name' => Mage::helper('downloadable/file')->getFileFromPathFile($item->getSampleFile()), 'size' => filesize($file), 'status' => 'old'));
         }
         if ($this->getProduct() && $item->getStoreTitle()) {
             $tmpSampleItem['store_title'] = $item->getStoreTitle();
         }
         $samplesArr[] = new Varien_Object($tmpSampleItem);
     }
     return $samplesArr;
 }
开发者ID:jpbender,项目名称:mage_virtual,代码行数:22,代码来源:Samples.php

示例7: sampleAction

 /**
  * Download sample action
  *
  */
 public function sampleAction()
 {
     $sampleId = $this->getRequest()->getParam('sample_id', 0);
     $sample = Mage::getModel('downloadable/sample')->load($sampleId);
     if ($sample->getId()) {
         $resource = '';
         $resourceType = '';
         if ($sample->getSampleType() == Mage_Downloadable_Helper_Download::LINK_TYPE_URL) {
             $resource = $sample->getSampleUrl();
             $resourceType = Mage_Downloadable_Helper_Download::LINK_TYPE_URL;
         } elseif ($sample->getSampleType() == Mage_Downloadable_Helper_Download::LINK_TYPE_FILE) {
             $resource = Mage::helper('downloadable/file')->getFilePath(Mage_Downloadable_Model_Sample::getBasePath(), $sample->getSampleFile());
             $resourceType = Mage_Downloadable_Helper_Download::LINK_TYPE_FILE;
         }
         try {
             $this->_processDownload($resource, $resourceType);
             exit(0);
         } catch (Mage_Core_Exception $e) {
             $this->_getSession()->addError(Mage::helper('downloadable')->__('An error occurred while getting requested content. Please contact the store owner.'));
         }
     }
     return $this->_redirectReferer();
 }
开发者ID:evinw,项目名称:project_bloom_magento,代码行数:27,代码来源:DownloadController.php

示例8: uploadAction

 /**
  * Upload file controller action
  */
 public function uploadAction()
 {
     $type = $this->getRequest()->getParam('type');
     $tmpPath = '';
     if ($type == 'samples') {
         $tmpPath = Mage_Downloadable_Model_Sample::getBaseTmpPath();
     } elseif ($type == 'links') {
         $tmpPath = Mage_Downloadable_Model_Link::getBaseTmpPath();
     } elseif ($type == 'link_samples') {
         $tmpPath = Mage_Downloadable_Model_Link::getBaseSampleTmpPath();
     }
     $result = array();
     try {
         $uploader = new Varien_File_Uploader($type);
         $uploader->setAllowRenameFiles(true);
         $uploader->setFilesDispersion(true);
         $result = $uploader->save($tmpPath);
         $result['cookie'] = array('name' => session_name(), 'value' => $this->_getSession()->getSessionId(), 'lifetime' => $this->_getSession()->getCookieLifetime(), 'path' => $this->_getSession()->getCookiePath(), 'domain' => $this->_getSession()->getCookieDomain());
     } catch (Exception $e) {
         $result = array('error' => $e->getMessage(), 'errorcode' => $e->getCode());
     }
     $this->getResponse()->setBody(Zend_Json::encode($result));
 }
开发者ID:HelioFreitas,项目名称:magento-pt_br,代码行数:26,代码来源:FileController.php

示例9: getSampleData

 /**
  * Retrieve samples array
  *
  * @return array
  */
 public function getSampleData()
 {
     $samplesArr = array();
     if ($this->getProduct()->getTypeId() !== Mage_Downloadable_Model_Product_Type::TYPE_DOWNLOADABLE) {
         return $samplesArr;
     }
     $samples = $this->getProduct()->getTypeInstance()->getSamples($this->getProduct());
     $fileHelper = Mage::helper('Mage_Downloadable_Helper_File');
     foreach ($samples as $item) {
         $tmpSampleItem = array('sample_id' => $item->getId(), 'title' => $this->escapeHtml($item->getTitle()), 'sample_url' => $item->getSampleUrl(), 'sample_type' => $item->getSampleType(), 'sort_order' => $item->getSortOrder());
         $file = $fileHelper->getFilePath(Mage_Downloadable_Model_Sample::getBasePath(), $item->getSampleFile());
         if ($item->getSampleFile() && !is_file($file)) {
             Mage::helper('Mage_Core_Helper_File_Storage_Database')->saveFileToFilesystem($file);
         }
         if ($item->getSampleFile() && is_file($file)) {
             $tmpSampleItem['file_save'] = array(array('file' => $item->getSampleFile(), 'name' => $fileHelper->getFileFromPathFile($item->getSampleFile()), 'size' => filesize($file), 'status' => 'old'));
         }
         if ($this->getProduct() && $item->getStoreTitle()) {
             $tmpSampleItem['store_title'] = $item->getStoreTitle();
         }
         $samplesArr[] = new Varien_Object($tmpSampleItem);
     }
     return $samplesArr;
 }
开发者ID:natxetee,项目名称:magento2,代码行数:29,代码来源:Samples.php

示例10: save

 /**
  * Save Product downloadable information (links and samples)
  *
  * @param Mage_Catalog_Model_Product $product
  * @return Mage_Downloadable_Model_Product_Type
  */
 public function save($product = null)
 {
     parent::save($product);
     $product = $this->getProduct($product);
     /* @var Mage_Catalog_Model_Product $product */
     if ($data = $product->getDownloadableData()) {
         if (isset($data['sample'])) {
             $_deleteItems = array();
             foreach ($data['sample'] as $sampleItem) {
                 if ($sampleItem['is_delete'] == '1') {
                     if ($sampleItem['sample_id']) {
                         $_deleteItems[] = $sampleItem['sample_id'];
                     }
                 } else {
                     unset($sampleItem['is_delete']);
                     if (!$sampleItem['sample_id']) {
                         unset($sampleItem['sample_id']);
                     }
                     $sampleModel = Mage::getModel('downloadable/sample');
                     $files = array();
                     if (isset($sampleItem['file'])) {
                         $files = Mage::helper('core')->jsonDecode($sampleItem['file']);
                         unset($sampleItem['file']);
                     }
                     $sampleModel->setData($sampleItem)->setSampleType($sampleItem['type'])->setProductId($product->getId())->setStoreId($product->getStoreId());
                     if ($sampleModel->getSampleType() == Mage_Downloadable_Helper_Download::LINK_TYPE_FILE) {
                         $sampleFileName = Mage::helper('downloadable/file')->moveFileFromTmp(Mage_Downloadable_Model_Sample::getBaseTmpPath(), Mage_Downloadable_Model_Sample::getBasePath(), $files);
                         $sampleModel->setSampleFile($sampleFileName);
                     }
                     $sampleModel->save();
                 }
             }
             if ($_deleteItems) {
                 Mage::getResourceModel('downloadable/sample')->deleteItems($_deleteItems);
             }
         }
         if (isset($data['link'])) {
             $_deleteItems = array();
             foreach ($data['link'] as $linkItem) {
                 if ($linkItem['is_delete'] == '1') {
                     if ($linkItem['link_id']) {
                         $_deleteItems[] = $linkItem['link_id'];
                     }
                 } else {
                     unset($linkItem['is_delete']);
                     if (!$linkItem['link_id']) {
                         unset($linkItem['link_id']);
                     }
                     $files = array();
                     if (isset($linkItem['file'])) {
                         $files = Mage::helper('core')->jsonDecode($linkItem['file']);
                         unset($linkItem['file']);
                     }
                     $sample = array();
                     if (isset($linkItem['sample'])) {
                         $sample = $linkItem['sample'];
                         unset($linkItem['sample']);
                     }
                     $linkModel = Mage::getModel('downloadable/link')->setData($linkItem)->setLinkType($linkItem['type'])->setProductId($product->getId())->setStoreId($product->getStoreId())->setWebsiteId($product->getStore()->getWebsiteId())->setProductWebsiteIds($product->getWebsiteIds());
                     if (null === $linkModel->getPrice()) {
                         $linkModel->setPrice(0);
                     }
                     if ($linkModel->getIsUnlimited()) {
                         $linkModel->setNumberOfDownloads(0);
                     }
                     $sampleFile = array();
                     if ($sample && isset($sample['type'])) {
                         if ($sample['type'] == 'url' && $sample['url'] != '') {
                             $linkModel->setSampleUrl($sample['url']);
                         }
                         $linkModel->setSampleType($sample['type']);
                         $sampleFile = Mage::helper('core')->jsonDecode($sample['file']);
                     }
                     if ($linkModel->getLinkType() == Mage_Downloadable_Helper_Download::LINK_TYPE_FILE) {
                         $linkFileName = Mage::helper('downloadable/file')->moveFileFromTmp(Mage_Downloadable_Model_Link::getBaseTmpPath(), Mage_Downloadable_Model_Link::getBasePath(), $files);
                         $linkModel->setLinkFile($linkFileName);
                     }
                     if ($linkModel->getSampleType() == Mage_Downloadable_Helper_Download::LINK_TYPE_FILE) {
                         $linkSampleFileName = Mage::helper('downloadable/file')->moveFileFromTmp(Mage_Downloadable_Model_Link::getBaseSampleTmpPath(), Mage_Downloadable_Model_Link::getBaseSamplePath(), $sampleFile);
                         $linkModel->setSampleFile($linkSampleFileName);
                     }
                     $linkModel->save();
                 }
             }
             if ($_deleteItems) {
                 Mage::getResourceModel('downloadable/link')->deleteItems($_deleteItems);
             }
             if ($this->getProduct($product)->getLinksPurchasedSeparately()) {
                 $this->getProduct($product)->setIsCustomOptionChanged();
             }
         }
     }
     return $this;
 }
开发者ID:xiaoguizhidao,项目名称:emporiodopara,代码行数:100,代码来源:Type.php

示例11: saveItemTitle

 /**
  * Save title of sample item in store scope
  *
  * @param Mage_Downloadable_Model_Sample $sampleObject
  * @return Mage_Downloadable_Model_Mysql4_Sample
  */
 public function saveItemTitle($sampleObject)
 {
     $stmt = $this->_getReadAdapter()->select()->from($this->getTable('downloadable/sample_title'))->where('sample_id = ?', $sampleObject->getId())->where('store_id = ?', $sampleObject->getStoreId());
     if ($this->_getReadAdapter()->fetchOne($stmt)) {
         $where = $this->_getReadAdapter()->quoteInto('sample_id = ?', $sampleObject->getId()) . ' AND ' . $this->_getReadAdapter()->quoteInto('store_id = ?', $sampleObject->getStoreId());
         if ($sampleObject->getUseDefaultTitle()) {
             $this->_getWriteAdapter()->delete($this->getTable('downloadable/sample_title'), $where);
         } else {
             $this->_getWriteAdapter()->update($this->getTable('downloadable/sample_title'), array('title' => $sampleObject->getTitle()), $where);
         }
     } else {
         if (!$sampleObject->getUseDefaultTitle()) {
             $this->_getWriteAdapter()->insert($this->getTable('downloadable/sample_title'), array('sample_id' => $sampleObject->getId(), 'store_id' => $sampleObject->getStoreId(), 'title' => $sampleObject->getTitle()));
         }
     }
     return $this;
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:23,代码来源:Mysql4_Sample.php

示例12: _uploadFile

 /**
  * Decode file from base64 and upload it to donwloadable 'tmp' folder
  *
  * @param array $fileInfo
  * @param string $type
  * @return string
  */
 protected function _uploadFile($fileInfo, $type)
 {
     $tmpPath = '';
     if ($type == 'sample') {
         $tmpPath = Mage_Downloadable_Model_Sample::getBaseTmpPath();
     } elseif ($type == 'link') {
         $tmpPath = Mage_Downloadable_Model_Link::getBaseTmpPath();
     } elseif ($type == 'link_samples') {
         $tmpPath = Mage_Downloadable_Model_Link::getBaseSampleTmpPath();
     }
     $result = array();
     $url = $fileInfo['url'];
     $remoteFileName = $fileInfo['name'];
     $ioAdapter = new Varien_Io_File();
     $ioAdapter->checkAndCreateFolder($tmpPath);
     $ioAdapter->open(array('path' => $tmpPath));
     $fileName = $tmpPath . DS . Varien_File_Uploader::getCorrectFileName($remoteFileName);
     if ($ioAdapter->cp($url, $fileName)) {
         Mage::helper('core/file_storage_database')->saveFile($fileName);
     }
     $result['file'] = $remoteFileName;
     $result['status'] = 'new';
     $result['name'] = $remoteFileName;
     return Mage::helper('core')->jsonEncode(array($result));
 }
开发者ID:ksawh,项目名称:retailops_magento,代码行数:32,代码来源:Downloadable.php

示例13: save

 /**
  * Enter description here...
  *
  * @return Mage_Downloadable_Model_Product_Type
  */
 public function save()
 {
     parent::save();
     $product = $this->getProduct();
     /* @var Mage_Catalog_Model_Product $product */
     if ($data = $product->getDownloadableData()) {
         if (isset($data['sample'])) {
             $_deleteItems = array();
             foreach ($data['sample'] as $sampleItem) {
                 if ($sampleItem['is_delete'] == '1') {
                     if ($sampleItem['sample_id']) {
                         $_deleteItems[] = $sampleItem['sample_id'];
                     }
                 } else {
                     unset($sampleItem['is_delete']);
                     if (!$sampleItem['sample_id']) {
                         unset($sampleItem['sample_id']);
                     }
                     $sampleModel = Mage::getModel('downloadable/sample');
                     $files = array();
                     if (isset($sampleItem['file'])) {
                         $files = Zend_Json::decode($sampleItem['file']);
                         unset($sampleItem['file']);
                     }
                     $sampleModel->setData($sampleItem)->setSampleType($sampleItem['type'])->setProductId($product->getId())->setStoreId($product->getStoreId());
                     $fileStatusNew = false;
                     if (isset($files[0]) && $sampleModel->getSampleType() == Mage_Downloadable_Helper_Download::LINK_TYPE_FILE) {
                         $sampleModel->setSampleFile($files[0]['file']);
                         if ($files[0]['status'] == 'new') {
                             $fileStatusNew = true;
                         }
                     }
                     $sampleModel->save();
                     if ($sampleModel->getSampleType() == Mage_Downloadable_Helper_Download::LINK_TYPE_FILE && $fileStatusNew) {
                         try {
                             Mage::helper('downloadable/file')->moveFileFromTmp(Mage_Downloadable_Model_Sample::getBaseTmpPath(), Mage_Downloadable_Model_Sample::getBasePath(), $files[0]['file']);
                         } catch (Exception $e) {
                             Mage::throwException(Mage::helper('downloadable')->__('An error occurred while saving the file(s).'));
                         }
                     }
                 }
             }
             if ($_deleteItems) {
                 Mage::getResourceModel('downloadable/sample')->deleteItems($_deleteItems);
             }
         }
         if (isset($data['link'])) {
             $_deleteItems = array();
             foreach ($data['link'] as $linkItem) {
                 if ($linkItem['is_delete'] == '1') {
                     if ($linkItem['link_id']) {
                         $_deleteItems[] = $linkItem['link_id'];
                     }
                 } else {
                     unset($linkItem['is_delete']);
                     if (!$linkItem['link_id']) {
                         unset($linkItem['link_id']);
                     }
                     $files = array();
                     if (isset($linkItem['file'])) {
                         $files = Zend_Json::decode($linkItem['file']);
                         unset($linkItem['file']);
                     }
                     $sample = array();
                     if (isset($linkItem['sample'])) {
                         $sample = $linkItem['sample'];
                         unset($linkItem['sample']);
                     }
                     $linkModel = Mage::getModel('downloadable/link')->setData($linkItem)->setLinkType($linkItem['type'])->setProductId($product->getId())->setStoreId($product->getStoreId())->setWebsiteId($product->getStore()->getWebsiteId());
                     if (null === $linkModel->getPrice()) {
                         $linkModel->setPrice(0);
                     }
                     if ($linkModel->getIsUnlimited()) {
                         $linkModel->setNumberOfDownloads(0);
                     }
                     $fileStatusNew = false;
                     if (isset($files[0]) && $linkModel->getLinkType() == Mage_Downloadable_Helper_Download::LINK_TYPE_FILE) {
                         $linkModel->setLinkFile($files[0]['file']);
                         if ($files[0]['status'] == 'new') {
                             $fileStatusNew = true;
                         }
                     }
                     $sampleFileNew = false;
                     if ($sample && isset($sample['type'])) {
                         if ($sample['type'] == 'url' && $sample['url'] != '') {
                             $linkModel->setSampleUrl($sample['url'])->setSampleType($sample['type']);
                         }
                         $sampleFile = Zend_Json::decode($sample['file']);
                         if ($sample['type'] == Mage_Downloadable_Helper_Download::LINK_TYPE_FILE && isset($sampleFile[0])) {
                             $linkModel->setSampleFile($sampleFile[0]['file'])->setSampleType($sample['type']);
                             if ($sampleFile[0]['status'] == 'new') {
                                 $sampleFileNew = true;
                             }
                         }
                     }
//.........这里部分代码省略.........
开发者ID:albertobraschi,项目名称:magento-design-training,代码行数:101,代码来源:Type.php

示例14: getSampleFileName

 /**
  * Get sample file name
  *
  * @param array $sampleModel            
  * @param array $sample            
  * @return string $sampleFileName
  */
 public function getSampleFileName($sampleModel, $sample)
 {
     $sampleFileName = '';
     if ($sampleModel->getSampleType() == Mage_Downloadable_Helper_Download::LINK_TYPE_FILE) {
         $sampleFileName = Mage::helper('downloadable/file')->moveFileFromTmp(Mage_Downloadable_Model_Sample::getBaseTmpPath(), Mage_Downloadable_Model_Sample::getBasePath(), $sample);
     }
     return $sampleFileName;
 }
开发者ID:igorvasiliev4,项目名称:magento_code,代码行数:15,代码来源:Market.php

示例15: getTmpPathForDownloadable

 /**
  * Get temporary path for downloadable product
  *
  * @param array $key            
  * @return array $tmpPathResult
  */
 public function getTmpPathForDownloadable($key)
 {
     $type = $tmpPath = '';
     $tmpPathResult = array();
     if (substr($key, 0, 5) == 'sampl') {
         $tmpPath = Mage_Downloadable_Model_Sample::getBaseTmpPath();
         $type = 'samples';
     }
     if (substr($key, 0, 5) == 'links') {
         $tmpPath = Mage_Downloadable_Model_Link::getBaseTmpPath();
         $type = 'links';
     }
     if (substr($key, 0, 5) == 'l_sam') {
         $tmpPath = Mage_Downloadable_Model_Link::getBaseSampleTmpPath();
         $type = 'link_samples';
     }
     $tmpPathResult['type'] = $type;
     $tmpPathResult['tmp_path'] = $tmpPath;
     return $tmpPathResult;
 }
开发者ID:igorvasiliev4,项目名称:magento_code,代码行数:26,代码来源:Download.php


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