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


PHP Varien_Date::formatDate方法代码示例

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


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

示例1: catalogProductImportFinishBefore

 public function catalogProductImportFinishBefore($observer)
 {
     $productIds = array();
     $adapter = $observer->getEvent()->getAdapter();
     $resource = Mage::getResourceModel('bubble_stockmovements/stock_movement');
     if ($adapter instanceof Mage_Catalog_Model_Convert_Adapter_Product) {
         $productIds = $adapter->getAffectedEntityIds();
     } else {
         Mage_ImportExport_Model_Import::getDataSourceModel()->getIterator()->rewind();
         $skus = array();
         while ($bunch = $adapter->getNextBunch()) {
             foreach ($bunch as $rowData) {
                 if (null !== $rowData['sku']) {
                     $skus[] = $rowData['sku'];
                 }
             }
         }
         if (!empty($skus)) {
             $productIds = $resource->getProductsIdBySku($skus);
         }
     }
     if (!empty($productIds)) {
         $stock = Mage::getSingleton('cataloginventory/stock');
         $stocks = Mage::getResourceModel('cataloginventory/stock')->getProductsStock($stock, $productIds);
         $stocksMovements = array();
         $datetime = Varien_Date::formatDate(time());
         foreach ($stocks as $stockData) {
             $stocksMovements[] = array('item_id' => $stockData['item_id'], 'user' => $this->_getUsername(), 'user_id' => $this->_getUserId(), 'qty' => $stockData['qty'], 'is_in_stock' => (int) $stockData['is_in_stock'], 'message' => 'Product import', 'created_at' => $datetime);
         }
         if (!empty($stocksMovements)) {
             $resource->insertStocksMovements($stocksMovements);
         }
     }
 }
开发者ID:jadhub,项目名称:magento-stock-movements,代码行数:34,代码来源:Observer.php

示例2: filterByActiveState

 /**
  * Apply filter by card active state (based on last usage date)
  *
  * @return CLS_Paypal_Model_Resource_Customerstored_Collection
  */
 public function filterByActiveState()
 {
     $now = new Zend_Date(null);
     $now->addMonth(0 - CLS_Paypal_Model_Paypal_Config::STORED_CARD_TTL_MONTHS);
     $this->getSelect()->where('date >= ?', Varien_Date::formatDate($now, false));
     return $this;
 }
开发者ID:xiaoguizhidao,项目名称:bb,代码行数:12,代码来源:Collection.php

示例3: catalogProductImportFinishBefore

 public function catalogProductImportFinishBefore($observer)
 {
     $adapter = $observer->getEvent()->getAdapter();
     Mage_ImportExport_Model_Import::getDataSourceModel()->getIterator()->rewind();
     $model = Mage::getModel('catalog/product');
     $skus = array();
     while ($bunch = $adapter->getNextBunch()) {
         foreach ($bunch as $rowData) {
             if (null !== $rowData['sku']) {
                 $skus[] = $rowData['sku'];
             }
         }
     }
     if (!empty($skus)) {
         $resource = Mage::getResourceModel('jr_stockhistory/stock_history');
         $productIds = $resource->getProductsIdBySku($skus);
         if (!empty($productIds)) {
             $stock = Mage::getSingleton('cataloginventory/stock');
             $stocks = Mage::getResourceModel('cataloginventory/stock')->getProductsStock($stock, $productIds);
             $stocksHistory = array();
             $datetime = Varien_Date::formatDate(time());
             foreach ($stocks as $stockData) {
                 $stocksHistory[] = array('item_id' => $stockData['item_id'], 'user' => $this->_getUsername(), 'user_id' => $this->_getUserId(), 'qty' => $stockData['qty'], 'is_in_stock' => (int) $stockData['is_in_stock'], 'message' => 'Product import', 'created_at' => $datetime);
             }
             if (!empty($stocksHistory)) {
                 $resource->insertStocksHistory($stocksHistory);
             }
         }
     }
 }
开发者ID:r-martins,项目名称:magento-stock-history,代码行数:30,代码来源:Observer.php

示例4: saveAction

 public function saveAction()
 {
     $installment = Mage::getModel('installment/master');
     $id = $this->getRequest()->getParam('id');
     if (!is_null($id)) {
         $installment->load($id);
     }
     try {
         $authPaid = $installment->getInstallmentMasterInstallmentAuthorized() || $installment->getInstallmentMasterInstallmentPaid();
         if ($authPaid && $this->getRequest()->getParam('suspend_installment')) {
             Mage::getSingleton('adminhtml/session')->addError(Mage::helper('installment')->__('The installment has been authorized and/or paid and can not be split.'));
             $order = Mage::getModel('sales/order')->loadByIncrementId($installment->getOrderId());
             $this->getResponse()->setRedirect($this->getUrl('*/sales_order/view', array('order_id' => $order->getId(), 'active_tab' => 'order_installment_payment')));
         }
         $reason = $this->getRequest()->getParam('suspend_installment') ? $this->getRequest()->getParam('suspended_reason') : '';
         $installment->setInstallmentMasterAmountDue($this->getRequest()->getParam('amount_due'))->setInstallmentMasterAmountDueDate(Varien_Date::formatDate($this->getRequest()->getParam('amount_due_date')))->setInstallmentMasterSuspendInstallment($this->getRequest()->getParam('suspend_installment'))->setInstallmentMasterSuspendedReason($reason)->save();
         Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('installment')->__('The installment payment has been saved.'));
         $id = Mage::getModel('sales/order')->loadByIncrementId($this->getRequest()->getParam('order_id'))->getId();
         $this->getResponse()->setRedirect($this->getUrl('*/sales_order/view', array('order_id' => $id, 'active_tab' => 'order_installment_payment')));
         return;
     } catch (Exception $e) {
         Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
         Mage::getSingleton('adminhtml/session')->setInstallmentPaymentData($installment->getData());
         $this->getResponse()->setRedirect($this->getUrl('*/sales_order_payment/edit', array('id' => $id)));
         return;
     }
 }
开发者ID:par-orillonsoft,项目名称:magento_work,代码行数:27,代码来源:PaymentController.php

示例5: send

 /**
  * Send all messages in a queue
  *
  * @return Mage_Core_Model_Email_Queue
  */
 public function send()
 {
     /** @var $collection Mage_Core_Model_Resource_Email_Queue_Collection */
     $collection = Mage::getModel('core/email_queue')->getCollection()->addOnlyForSendingFilter()->setPageSize(self::MESSAGES_LIMIT_PER_CRON_RUN)->setCurPage(1)->load();
     ini_set('SMTP', Mage::getStoreConfig('system/smtp/host'));
     ini_set('smtp_port', Mage::getStoreConfig('system/smtp/port'));
     /** @var $message Mage_Core_Model_Email_Queue */
     foreach ($collection as $message) {
         if ($message->getId()) {
             $parameters = new Varien_Object($message->getMessageParameters());
             if ($parameters->getReturnPathEmail() !== null) {
                 $mailTransport = new Zend_Mail_Transport_Sendmail("-f" . $parameters->getReturnPathEmail());
                 Zend_Mail::setDefaultTransport($mailTransport);
             }
             $mailer = new Zend_Mail('utf-8');
             foreach ($message->getRecipients() as $recipient) {
                 list($email, $name, $type) = $recipient;
                 switch ($type) {
                     case self::EMAIL_TYPE_BCC:
                         $mailer->addBcc($email, '=?utf-8?B?' . base64_encode($name) . '?=');
                         break;
                     case self::EMAIL_TYPE_TO:
                     case self::EMAIL_TYPE_CC:
                     default:
                         $mailer->addTo($email, '=?utf-8?B?' . base64_encode($name) . '?=');
                         break;
                 }
             }
             if ($parameters->getIsPlain()) {
                 $mailer->setBodyText($message->getMessageBody());
             } else {
                 $mailer->setBodyHTML($message->getMessageBody());
             }
             $mailer->setSubject('=?utf-8?B?' . base64_encode($parameters->getSubject()) . '?=');
             $mailer->setFrom($parameters->getFromEmail(), $parameters->getFromName());
             if ($parameters->getReplyTo() !== null) {
                 $mailer->setReplyTo($parameters->getReplyTo());
             }
             if ($parameters->getReturnTo() !== null) {
                 $mailer->setReturnPath($parameters->getReturnTo());
             }
             try {
                 //$mailer->send();
                 $mailer->send(Mage::helper('smtp')->getTransport());
                 unset($mailer);
                 $message->setProcessedAt(Varien_Date::formatDate(true));
                 $message->save();
             } catch (Exception $e) {
                 unset($mailer);
                 $oldDevMode = Mage::getIsDeveloperMode();
                 Mage::setIsDeveloperMode(true);
                 Mage::logException($e);
                 Mage::setIsDeveloperMode($oldDevMode);
                 return false;
             }
         }
     }
     return $this;
 }
开发者ID:TomOhme,项目名称:IP1-Webshop,代码行数:64,代码来源:Queue.php

示例6: cleanLogs

 /**
  * Clean the log table
  *
  * @param  int $keepDays Days to keep
  * @return int The number of deleted rows
  */
 public function cleanLogs($keepDays)
 {
     if (!$keepDays) {
         return 0;
     }
     $time = Mage::getModel('core/date')->gmtTimestamp() - 60 * 60 * 24 * $keepDays;
     $delete = Varien_Date::formatDate($time, false);
     return $this->_getWriteAdapter()->delete($this->getMainTable(), $this->_getWriteAdapter()->quoteInto('timestamp < ?', $delete));
 }
开发者ID:kirchbergerknorr,项目名称:firegento-logger,代码行数:15,代码来源:Entry.php

示例7: deleteOldEntries

 /**
  * Delete old entries
  *
  * @param int $minutes
  * @return int
  */
 public function deleteOldEntries($minutes)
 {
     if ($minutes > 0) {
         $adapter = $this->_getWriteAdapter();
         return $adapter->delete($this->getMainTable(), $adapter->quoteInto('type = "' . Mage_Oauth_Model_Token::TYPE_REQUEST . '" AND created_at <= ?', Varien_Date::formatDate(time() - $minutes * 60)));
     } else {
         return 0;
     }
 }
开发者ID:nemphys,项目名称:magento2,代码行数:15,代码来源:Token.php

示例8: _processOrder

 /**
  * Operate with order using information from silent post
  *
  * @param Mage_Sales_Model_Order $order
  */
 protected function _processOrder(Mage_Sales_Model_Order $order)
 {
     $response = $this->getResponse();
     $payment = $order->getPayment();
     $payment->setTransactionId($response->getPnref())->setIsTransactionClosed(0);
     $canSendNewOrderEmail = true;
     if ($response->getResult() == self::RESPONSE_CODE_FRAUDSERVICE_FILTER || $response->getResult() == self::RESPONSE_CODE_DECLINED_BY_FILTER) {
         $canSendNewOrderEmail = false;
         $fraudMessage = $this->_getFraudMessage() ? $response->getFraudMessage() : $response->getRespmsg();
         $payment->setIsTransactionPending(true)->setIsFraudDetected(true)->setAdditionalInformation('paypal_fraud_filters', $fraudMessage);
     }
     if ($response->getAvsdata() && strstr(substr($response->getAvsdata(), 0, 2), 'N')) {
         $payment->setAdditionalInformation('paypal_avs_code', substr($response->getAvsdata(), 0, 2));
     }
     if ($response->getCvv2match() && $response->getCvv2match() != 'Y') {
         $payment->setAdditionalInformation('paypal_cvv2_match', $response->getCvv2match());
     }
     switch ($response->getType()) {
         case self::TRXTYPE_AUTH_ONLY:
             $payment->registerAuthorizationNotification($payment->getBaseAmountAuthorized());
             break;
         case self::TRXTYPE_SALE:
             $payment->registerCaptureNotification($payment->getBaseAmountAuthorized());
             break;
     }
     $order->save();
     $customerId = $order->getCustomerId();
     if ($response->getResult() == self::RESPONSE_CODE_APPROVED && $response->getMethod() == 'CC' && $customerId && $payment->hasAdditionalInformation('cc_save_future') && $payment->getAdditionalInformation('cc_save_future') == 'Y') {
         // Obtain CC type
         $ccType = 'OT';
         $responseCcType = $response->getCardtype();
         if (!is_null($responseCcType)) {
             $payflowResponseCcTypesMap = array(0 => 'VI', 1 => 'MC', 2 => 'DI', 3 => 'AE', 4 => 'OT', 5 => 'JCB');
             if (isset($payflowResponseCcTypesMap[$responseCcType])) {
                 $ccType = $payflowResponseCcTypesMap[$responseCcType];
             }
         }
         $ccExpMonth = $response->getExpdate() ? substr($response->getExpdate(), 0, 2) : '';
         if ($ccExpMonth[0] == '0') {
             $ccExpMonth = $ccExpMonth[1];
         }
         // Create new stored card
         $customerstoredModel = Mage::getModel('cls_paypal/customerstored');
         $customerstoredModel->setData(array('transaction_id' => $response->getPnref(), 'customer_id' => $customerId, 'cc_type' => $ccType, 'cc_last4' => $response->getAcct() ? substr($response->getAcct(), -4) : '', 'cc_exp_month' => $ccExpMonth, 'cc_exp_year' => $response->getExpdate() ? '20' . substr($response->getExpdate(), 2) : '', 'date' => Varien_Date::formatDate(true, true), 'payment_method' => $payment->getMethod()));
         $customerstoredModel->save();
     }
     try {
         if ($canSendNewOrderEmail) {
             $order->sendNewOrderEmail();
         }
         Mage::getModel('sales/quote')->load($order->getQuoteId())->setIsActive(false)->save();
     } catch (Exception $e) {
         Mage::throwException(Mage::helper('paypal')->__('Can not send new order email.'));
     }
 }
开发者ID:xiaoguizhidao,项目名称:bb,代码行数:60,代码来源:Payflowlink.php

示例9: addChangedSinceFilter

 /**
  * Filter items that have not been changed since
  *
  * @param string|DateTime|Zend_Date $since
  * @return $this
  */
 public function addChangedSinceFilter($since)
 {
     if ($since instanceof DateTime) {
         $since = $since->format('Y-m-d H:i:s');
     }
     if ($since instanceof Zend_Date) {
         $since = Varien_Date::formatDate($since);
     }
     $this->addFieldToFilter('updated_at', array('gt' => $since));
     return $this;
 }
开发者ID:jsiefer,项目名称:mage-mock,代码行数:17,代码来源:Collection.php

示例10: sendQueuedMessages

 /**
  * Send all queued Messages
  */
 public function sendQueuedMessages()
 {
     $collection = Mage::getModel('mhauri_hipchat/queue')->getCollection()->addOnlyForSendingFilter()->setPageSize(self::MESSAGES_LIMIT_PER_CRON_RUN)->setCurPage(1)->load();
     foreach ($collection as $message) {
         try {
             $this->sendMessage(unserialize($message->getMessageParams()));
             $message->setProcessedAt(Varien_Date::formatDate(true));
             $message->save();
         } catch (Exception $e) {
             Mage::log($e->getMessage(), Zend_Log::ERR, Mhauri_HipChat_Model_Abstract::LOG_FILE);
         }
         sleep(1);
     }
 }
开发者ID:Tengisa,项目名称:magento-hipchat,代码行数:17,代码来源:Queue.php

示例11: loadChange

 /**
  * Load custom design settings for specified store and date
  *
  * @param string $storeId
  * @param string|null $date
  * @return Mage_Core_Model_Design
  */
 public function loadChange($storeId, $date = null)
 {
     if (is_null($date)) {
         $date = Varien_Date::formatDate(Mage::app()->getLocale()->storeTimeStamp($storeId), false);
     }
     $changeCacheId = 'design_change_' . md5($storeId . $date);
     $result = Mage::app()->loadCache($changeCacheId);
     if ($result === false) {
         $result = $this->getResource()->loadChange($storeId, $date);
         if (!$result) {
             $result = array();
         }
         Mage::app()->saveCache(serialize($result), $changeCacheId, array(self::CACHE_TAG), 86400);
     } else {
         $result = unserialize($result);
     }
     if ($result) {
         $this->setData($result);
     }
     return $this;
 }
开发者ID:natxetee,项目名称:magento2,代码行数:28,代码来源:Design.php

示例12: refreshSpecialPrices

 /**
  * Add products to changelog with price which depends on date
  *
  * @return void
  */
 public function refreshSpecialPrices()
 {
     $connection = $this->_connection;
     foreach (Mage::app()->getStores(true) as $store) {
         $timestamp = Mage::app()->getLocale()->storeTimeStamp($store);
         $currDate = Varien_Date::formatDate($timestamp, false);
         $currDateExpr = $connection->quote($currDate);
         // timestamp is locale based
         if (date(Zend_Date::HOUR_SHORT, $timestamp) == '00') {
             $format = '%Y-%m-%d %H:%i:%s';
             $this->_refreshSpecialPriceByStore($store->getId(), 'special_from_date', $connection->getDateFormatSql($currDateExpr, $format));
             $dateTo = $connection->getDateAddSql($currDateExpr, -1, Varien_Db_Adapter_Interface::INTERVAL_DAY);
             $this->_refreshSpecialPriceByStore($store->getId(), 'special_to_date', $connection->getDateFormatSql($dateTo, $format));
         }
     }
 }
开发者ID:QiuLihua83,项目名称:magento-enterprise-1.13.1.0,代码行数:21,代码来源:Price.php

示例13: testIsResetPasswordLinkTokenExpired

 /**
  * @magentoDbIsolation enabled
  * @magentoAppIsolation enabled
  * @magentoConfigFixture default/admin/emails/password_reset_link_expiration_period 10
  */
 public function testIsResetPasswordLinkTokenExpired()
 {
     $this->_model->loadByUsername(Magento_Test_Bootstrap::ADMIN_NAME);
     $this->assertTrue($this->_model->isResetPasswordLinkTokenExpired());
     $this->_model->changeResetPasswordLinkToken('test');
     $this->_model->save();
     $this->_model->loadByUsername(Magento_Test_Bootstrap::ADMIN_NAME);
     $this->assertFalse($this->_model->isResetPasswordLinkTokenExpired());
     $this->_model->setRpTokenCreatedAt(Varien_Date::formatDate(time() - 60 * 60 * 24 * 10 + 10));
     $this->assertFalse($this->_model->isResetPasswordLinkTokenExpired());
     $this->_model->setRpTokenCreatedAt(Varien_Date::formatDate(time() - 60 * 60 * 24 * 10 - 10));
     $this->assertTrue($this->_model->isResetPasswordLinkTokenExpired());
 }
开发者ID:nemphys,项目名称:magento2,代码行数:18,代码来源:UserTest.php

示例14: _formatDate

 /**
  * Format date to internal format
  *
  * @param string|Zend_Date $date
  * @param bool $includeTime
  *
  * @return string
  */
 protected function _formatDate($date, $includeTime = true)
 {
     return Varien_Date::formatDate($date, $includeTime);
 }
开发者ID:mgeoffray,项目名称:mg_security,代码行数:12,代码来源:Log.php

示例15: formatDate

 /**
  * Format date using current locale options
  *
  * @param   timestamp|int
  * @param   string $format
  * @param   bool $showTime
  * @return  string
  */
 public static function formatDate($timestamp = null, $format = 'short', $showTime = false)
 {
     if (empty($timestamp)) {
         return '';
     }
     $date = Mage::app()->getLocale()->date($timestamp, null, null);
     return Varien_Date::formatDate($date, $format, $showTime);
 }
开发者ID:xiaoguizhidao,项目名称:ecommerce,代码行数:16,代码来源:ApiSe.php


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