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


PHP Varien_Date::now方法代码示例

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


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

示例1: _create

 protected function _create(array $data)
 {
     try {
         if (!empty($data)) {
             foreach ($data['items'] as $cmspages) {
                 $identifier = trim($cmspages['identifier']);
                 $cmsPage = Mage::getModel('cms/page');
                 $cmsCheck = $cmsPage->getResource()->checkIdentifier($identifier, $cmspages['store_ids']);
                 if ($cmsCheck) {
                     $cmsPage->load($cmsCheck);
                 }
                 if ($cmsPage->isObjectNew()) {
                     $cmsPage->setIdentifier($identifier)->setCreationTime(Varien_Date::now());
                 }
                 $cmsPage->setUpdateTime(Varien_Date::now())->setStores(array($cmspages['store_ids']))->setIsActive($cmspages['is_active'])->setTitle($cmspages['title'])->setContent($cmspages['content'])->setRootTemplate($cmspages['root_template'])->setMetaKeywords($cmspages['meta_keywords'])->setMetaDescription($cmspages['meta_description'])->setContentHeading($cmspages['content_heading'])->setSortOrder($cmspages['sort_order'])->setLayoutUpdateXml($cmspages['layout_update_xml'])->setCustomTheme($cmspages['custom_theme'])->setCustomRootTemplate($cmspages['custom_root_template'])->setCustomLayoutUpdateXml($cmspages['custom_layout_update_xml'])->setCustomThemeFrom($cmspages['custom_theme_from'])->setCustomThemeTo($cmspages['custom_theme_to'])->save();
             }
         } else {
             $this->_critical('Empty data found');
         }
     } catch (Mage_Eav_Model_Entity_Attribute_Exception $e) {
         $this->_critical(sprintf('Invalid attribute "%s": %s', $e->getAttributeCode(), $e->getMessage()), Mage_Api2_Model_Server::HTTP_BAD_REQUEST);
     } catch (Mage_Core_Exception $e) {
         $this->_critical($e->getMessage(), Mage_Api2_Model_Server::HTTP_INTERNAL_ERROR);
     } catch (Exception $e) {
         $this->_critical(self::RESOURCE_UNKNOWN_ERROR);
     }
 }
开发者ID:brentwpeterson,项目名称:magento-cms-update-api,代码行数:27,代码来源:V1.php

示例2: startAction

 /**
  * Start edit order initialization
  */
 public function startAction()
 {
     $this->_getSession()->clear();
     $orderId = $this->getRequest()->getParam('order_id');
     $order = Mage::getModel('sales/order')->load($orderId);
     if ($order->getId()) {
         $this->_getSession()->setUseOldShippingMethod(true);
         $this->_getOrderCreateModel()->initFromOrder($order);
         /**
          * Lock Order Here
          */
         $write = Mage::getSingleton('core/resource')->getConnection('core_write');
         $condition = array($write->quoteInto('order_id=?', $order->getIncrementId()));
         $write->delete('lockorder', $condition);
         $sql = "INSERT INTO lockorder values (?,?,?,?,?)";
         //insert query
         $write->query($sql, array('', $order->getIncrementId(), '1', Varien_Date::now(), ''));
         //write to database
         /**
          * End of Lock Order Here
          */
         $this->_redirect('*/*');
     } else {
         $this->_redirect('*/sales_order/');
     }
 }
开发者ID:sagmahajan,项目名称:aswan_release,代码行数:29,代码来源:EditController.php

示例3: updateCustomerFromVisitor

 /**
  * Update Customer from visitor (Customer logged in)
  *
  * @param Mage_Reports_Model_Product_Index_Abstract $object
  * @return Mage_Reports_Model_Resource_Product_Index_Abstract
  */
 public function updateCustomerFromVisitor(Mage_Reports_Model_Product_Index_Abstract $object)
 {
     /**
      * Do nothing if customer not logged in
      */
     if (!$object->getCustomerId() || !$object->getVisitorId()) {
         return $this;
     }
     $adapter = $this->_getWriteAdapter();
     $select = $adapter->select()->from($this->getMainTable())->where('visitor_id = ?', $object->getVisitorId());
     $rowSet = $select->query()->fetchAll();
     foreach ($rowSet as $row) {
         /* We need to determine if there are rows with known
              customer for current product.
            */
         $select = $adapter->select()->from($this->getMainTable())->where('customer_id = ?', $object->getCustomerId())->where('product_id = ?', $row['product_id']);
         $idx = $adapter->fetchRow($select);
         if ($idx) {
             /* If we are here it means that we have two rows: one with known customer, but second just visitor is set
              * One row should be updated with customer_id, second should be deleted
              *
              */
             $adapter->delete($this->getMainTable(), array('index_id = ?' => $row['index_id']));
             $where = array('index_id = ?' => $idx['index_id']);
             $data = array('visitor_id' => $object->getVisitorId(), 'store_id' => $object->getStoreId(), 'added_at' => Varien_Date::now());
         } else {
             $where = array('index_id = ?' => $row['index_id']);
             $data = array('customer_id' => $object->getCustomerId(), 'store_id' => $object->getStoreId(), 'added_at' => Varien_Date::now());
         }
         $adapter->update($this->getMainTable(), $data, $where);
     }
     return $this;
 }
开发者ID:blazeriaz,项目名称:youguess,代码行数:39,代码来源:Abstract.php

示例4: _create

 protected function _create(array $data)
 {
     try {
         if (!empty($data)) {
             foreach ($data['items'] as $cmsblocks) {
                 $storeArray = array();
                 $storeArray = explode(',', $cmsblocks['store_ids']);
                 $identifier = trim($cmsblocks['identifier']);
                 $cmsBlock = Mage::getModel('cms/block');
                 $collection = Mage::getModel('cms/block')->getCollection()->addStoreFilter($storeArray, false)->addFieldToFilter('identifier', $identifier);
                 //->toArray();
                 $collectionData = $collection->getData();
                 if (isset($collectionData[0]['block_id'])) {
                     $cmsBlock->load($collectionData[0]['block_id']);
                 }
                 if ($cmsBlock->isObjectNew()) {
                     $cmsBlock->setIdentifier($identifier)->setCreationTime(Varien_Date::now());
                 }
                 $cmsBlock->setUpdateTime(Varien_Date::now())->setStores(array($cmsblocks['store_ids']))->setIsActive($cmsblocks['is_active'])->setTitle($cmsblocks['title'])->setContent($cmsblocks['content'])->save();
             }
         } else {
             $this->_critical('Empty data found');
         }
     } catch (Mage_Eav_Model_Entity_Attribute_Exception $e) {
         $this->_critical(sprintf('Invalid attribute "%s": %s', $e->getAttributeCode(), $e->getMessage()), Mage_Api2_Model_Server::HTTP_BAD_REQUEST);
     } catch (Mage_Core_Exception $e) {
         $this->_critical($e->getMessage(), Mage_Api2_Model_Server::HTTP_INTERNAL_ERROR);
     } catch (Exception $e) {
         $this->_critical(self::RESOURCE_UNKNOWN_ERROR);
     }
 }
开发者ID:brentwpeterson,项目名称:magento-cms-update-api,代码行数:31,代码来源:V1.php

示例5: setDate

 protected function setDate()
 {
     $currentTime = Varien_Date::now();
     if ((!$this->getId() || $this->isObjectNew()) && !$this->getCreatedAt()) {
         $this->setCreatedAt($currentTime);
     }
     return $this;
 }
开发者ID:Rodrifer,项目名称:candyclub,代码行数:8,代码来源:Log.php

示例6: beforeSave

 /**
  * Set created date
  *
  * @param Mage_Core_Model_Object $object
  * @return Mage_Eav_Model_Entity_Attribute_Backend_Time_Created
  */
 public function beforeSave($object)
 {
     $attributeCode = $this->getAttribute()->getAttributeCode();
     if ($object->isObjectNew() && is_null($object->getData($attributeCode))) {
         $object->setData($attributeCode, Varien_Date::now());
     }
     return $this;
 }
开发者ID:ravi2jdesign,项目名称:solvingmagento_1.7.0,代码行数:14,代码来源:Created.php

示例7: _beforeSave

 /**
  * If object is new adds creation date
  *
  * @return NoPro_Bluemoon_Model_Bluemoon
  */
 protected function _beforeSave()
 {
     parent::_beforeSave();
     if ($this->isObjectNew()) {
         $this->setData('created_at', Varien_Date::now());
     }
     return $this;
 }
开发者ID:nopro,项目名称:bluemoon,代码行数:13,代码来源:Bluemoon.php

示例8: now

 /**
  * Return the current date in internal format.
  *
  * @param bool $withoutTime day only flag
  *
  * @return string
  */
 public function now($withoutTime = false)
 {
     if (method_exists("Varien_Date", "now")) {
         return Varien_Date::now($withoutTime);
     } else {
         $format = $withoutTime ? "Y-m-d" : "Y-m-d H:i:s";
         return date($format);
     }
 }
开发者ID:mSupply,项目名称:runnable_test_repo,代码行数:16,代码来源:Compat.php

示例9: _updateDiscountPercents

 /**
  * Update tax percents for WEEE based on products condition
  *
  * @param mixed $productCondition
  * @return Mage_Weee_Model_Resource_Tax
  */
 protected function _updateDiscountPercents($productCondition = null)
 {
     $now = Varien_Date::toTimestamp(Varien_Date::now());
     $adapter = $this->_getWriteAdapter();
     $select = $this->_getReadAdapter()->select();
     $select->from(array('data' => $this->getTable('catalogrule/rule_product')));
     $deleteCondition = '';
     if ($productCondition) {
         if ($productCondition instanceof Mage_Catalog_Model_Product) {
             $select->where('product_id = ?', (int) $productCondition->getId());
             $deleteCondition = $adapter->quoteInto('entity_id=?', (int) $productCondition->getId());
         } elseif ($productCondition instanceof Mage_Catalog_Model_Product_Condition_Interface) {
             $productCondition = $productCondition->getIdsSelect($adapter)->__toString();
             $select->where("product_id IN ({$productCondition})");
             $deleteCondition = "entity_id IN ({$productCondition})";
         } else {
             $select->where('product_id = ?', (int) $productCondition);
             $deleteCondition = $adapter->quoteInto('entity_id = ?', (int) $productCondition);
         }
     } else {
         $select->where('(from_time <= ? OR from_time = 0)', $now)->where('(to_time >= ? OR to_time = 0)', $now);
     }
     $adapter->delete($this->getTable('weee/discount'), $deleteCondition);
     $select->order(array('data.website_id', 'data.customer_group_id', 'data.product_id', 'data.sort_order'));
     $data = $this->_getReadAdapter()->query($select);
     $productData = array();
     $stops = array();
     $prevKey = false;
     while ($row = $data->fetch()) {
         $key = "{$row['product_id']}-{$row['website_id']}-{$row['customer_group_id']}";
         if (isset($stops[$key]) && $stops[$key]) {
             continue;
         }
         if ($prevKey && $prevKey != $key) {
             foreach ($productData as $product) {
                 $adapter->insert($this->getTable('weee/discount'), $product);
             }
             $productData = array();
         }
         if ($row['action_operator'] == 'by_percent') {
             if (isset($productData[$key])) {
                 $productData[$key]['value'] -= $productData[$key]['value'] / 100 * $row['action_amount'];
             } else {
                 $productData[$key] = array('entity_id' => $row['product_id'], 'customer_group_id' => $row['customer_group_id'], 'website_id' => $row['website_id'], 'value' => 100 - $row['action_amount']);
             }
         }
         if ($row['action_stop']) {
             $stops[$key] = true;
         }
         $prevKey = $key;
     }
     foreach ($productData as $product) {
         $adapter->insert($this->getTable('weee/discount'), $product);
     }
     return $this;
 }
开发者ID:axovel,项目名称:easycarcare,代码行数:62,代码来源:Tax.php

示例10: _beforeSave

 /**
  * Processing object before save data
  *
  * @return Mage_Core_Model_Abstract
  */
 protected function _beforeSave()
 {
     if (!$this->hasTrackCode()) {
         $this->_dataSaveAllowed = false;
     } else {
         $this->setCreatedAt(Varien_Date::now());
         $this->setRemoteIp(Mage::helper('core/http')->getRemoteAddr());
     }
     return parent::_beforeSave();
 }
开发者ID:vpietri,项目名称:adm_abandonedcart,代码行数:15,代码来源:Tracker.php

示例11: _prepareDataForSave

 /**
  * Prepare data for save
  *
  * @param Mage_Core_Model_Abstract $object
  * @return array
  */
 protected function _prepareDataForSave(Mage_Core_Model_Abstract $object)
 {
     $currentTime = Varien_Date::now();
     if ((!$object->getId() || $object->isObjectNew()) && !$object->getCreatedAt()) {
         $object->setCreatedAt($currentTime);
     }
     $object->setUpdatedAt($currentTime);
     $data = parent::_prepareDataForSave($object);
     return $data;
 }
开发者ID:par-orillonsoft,项目名称:magento_work,代码行数:16,代码来源:Abstract.php

示例12: _beforeSave

 protected function _beforeSave(Mage_Core_Model_Abstract $object)
 {
     foreach ($this->_serializedAttr as $attrCode) {
         if (is_array($object->getData($attrCode))) {
             $object->setData($attrCode, serialize($object->getData($attrCode)));
         }
     }
     $now = Varien_Date::now(false);
     $object->setUpdatedAt($now);
 }
开发者ID:tschifftner,项目名称:Magento-MEP,代码行数:10,代码来源:Profile.php

示例13: _initCollection

 /**
  * Setup the prepared design change collection.
  * 
  * @param int    $storeId The current store ID.
  * @param string $date    The current date.
  * 
  * @return Mage_Core_Model_Resource_Design_Collection
  */
 protected function _initCollection($storeId, $date = null)
 {
     if (!$this->_preparedCollection) {
         if (is_null($date)) {
             $date = Varien_Date::now();
         }
         $collection = $this->getCollection()->addStoreFilter($storeId);
         $collection->getSelect()->where('enabled = 1')->where('date_from <= ? or date_from IS NULL', $date)->where('date_to >= ? or date_to IS NULL', $date);
         $this->_preparedCollection = $collection;
     }
     return $this->_preparedCollection;
 }
开发者ID:n2bh,项目名称:mage-design2,代码行数:20,代码来源:Design.php

示例14: _beforeSave

 /**
  * Prepare some data before save processing
  *
  * @param Mage_Core_Model_Abstract $object
  *
  * @return MatheusGontijo_EasyShippingRules_Model_Resource_Custommethod
  */
 protected function _beforeSave(Mage_Core_Model_Abstract $object)
 {
     if (!$object->getPricePercentage()) {
         $object->setPricePercentage(null);
     }
     if (!$object->getId()) {
         $object->setCreatedAt(Varien_Date::now());
     } else {
         $object->setUpdatedAt(Varien_Date::now());
     }
     return $this;
 }
开发者ID:xiaoguizhidao,项目名称:easy-shipping-rules,代码行数:19,代码来源:Rule.php

示例15: sales_order_creditmemo_refund

 /**
  *
  * @param <type> $observer
  * @return <type>
  * @desciption After saving credit memo, Relase Lock
  */
 public function sales_order_creditmemo_refund($observer)
 {
     $orderId = Mage::app()->getFrontController()->getRequest()->getParam('order_id');
     $order = Mage::getModel('sales/order')->load($orderId);
     $connection = Mage::getSingleton('core/resource')->getConnection('core_write');
     $connection->beginTransaction();
     $fields = array();
     $fields['status'] = '0';
     $fields['lock_released'] = Varien_Date::now();
     $where = $connection->quoteInto('order_id =?', $order->getIncrementId());
     $connection->update('lockorder', $fields, $where);
     $connection->commit();
     return;
 }
开发者ID:sagmahajan,项目名称:aswan_release,代码行数:20,代码来源:Observer.php


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