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


PHP Varien_Date::toTimestamp方法代码示例

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


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

示例1: setSelectPeriod

 /**
  * Filters the summaries by some period
  *
  * @param string $periodType
  * @param string|int|null $customStart
  * @param string|int|null $customEnd
  * @return Mage_Reports_Model_Resource_Entity_Summary_Collection_Abstract
  */
 public function setSelectPeriod($periodType, $customStart = null, $customEnd = null)
 {
     switch ($periodType) {
         case "24h":
             $customStart = Varien_Date::toTimestamp(true) - 86400;
             $customEnd = Varien_Date::toTimestamp(true);
             break;
         case "7d":
             $customStart = Varien_Date::toTimestamp(true) - 604800;
             $customEnd = Varien_Date::toTimestamp(true);
             break;
         case "30d":
             $customStart = Varien_Date::toTimestamp(true) - 2592000;
             $customEnd = Varien_Date::toTimestamp(true);
             break;
         case "1y":
             $customStart = Varien_Date::toTimestamp(true) - 31536000;
             $customEnd = Varien_Date::toTimestamp(true);
             break;
         default:
             if (is_string($customStart)) {
                 $customStart = strtotime($customStart);
             }
             if (is_string($customEnd)) {
                 $customEnd = strtotime($customEnd);
             }
             break;
     }
     return $this;
 }
开发者ID:par-orillonsoft,项目名称:Magento,代码行数:38,代码来源:Abstract.php

示例2: _beforeSave

 /**
  * Perform actions before object save
  *
  * @param Mage_Core_Model_Abstract $object
  * @return Mage_Core_Model_Resource_Db_Abstract
  * @throws Mage_Core_Exception
  */
 public function _beforeSave(Mage_Core_Model_Abstract $object)
 {
     if ($date = $object->getDateFrom()) {
         $object->setDateFrom($this->formatDate($date));
     } else {
         $object->setDateFrom(null);
     }
     if ($date = $object->getDateTo()) {
         $object->setDateTo($this->formatDate($date));
     } else {
         $object->setDateTo(null);
     }
     if (!is_null($object->getDateFrom()) && !is_null($object->getDateTo()) && Varien_Date::toTimestamp($object->getDateFrom()) > Varien_Date::toTimestamp($object->getDateTo())) {
         Mage::throwException(Mage::helper('core')->__('Start date cannot be greater than end date.'));
     }
     $check = $this->_checkIntersection($object->getStoreId(), $object->getDateFrom(), $object->getDateTo(), $object->getId());
     if ($check) {
         Mage::throwException(Mage::helper('core')->__('Your design change for the specified store intersects with another one, please specify another date range.'));
     }
     if ($object->getDateFrom() === null) {
         $object->setDateFrom(new Zend_Db_Expr('null'));
     }
     if ($object->getDateTo() === null) {
         $object->setDateTo(new Zend_Db_Expr('null'));
     }
     parent::_beforeSave($object);
 }
开发者ID:ravi2jdesign,项目名称:solvingmagento_1.7.0,代码行数:34,代码来源:Design.php

示例3: getLoginAtTimestamp

 /**
  * Return last login at in Unix time format
  *
  * @return int
  */
 public function getLoginAtTimestamp()
 {
     $loginAt = $this->getLoginAt();
     if ($loginAt) {
         return Varien_Date::toTimestamp($loginAt);
     }
     return null;
 }
开发者ID:relue,项目名称:magento2,代码行数:13,代码来源:Customer.php

示例4: _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

示例5: _setFlagData

 /**
  * Saves flag
  *
  * @param string $code
  * @param mixed $value
  * @return Mage_Reports_Model_Resource_Report_Abstract
  */
 protected function _setFlagData($code, $value = null)
 {
     $this->_getFlag()->setReportFlagCode($code)->unsetData()->loadSelf();
     if ($value !== null) {
         $this->_getFlag()->setFlagData($value);
     }
     $time = Varien_Date::toTimestamp(true);
     // touch last_update
     $this->_getFlag()->setLastUpdate($this->formatDate($time));
     $this->_getFlag()->save();
     return $this;
 }
开发者ID:ravi2jdesign,项目名称:solvingmagento_1.7.0,代码行数:19,代码来源:Abstract.php

示例6: _beforeSave

 /**
  * Perform actions before object save
  *
  * @param Mage_Core_Model_Abstract $object
  * @return Mage_Core_Model_Resource_Db_Abstract
  * @throws Mage_Core_Exception
  */
 public function _beforeSave(Mage_Core_Model_Abstract $object)
 {
     $dateFrom = $object->getDateFrom();
     $dateTo = $object->getDateTo();
     if (!empty($dateFrom) && !empty($dateTo)) {
         $validator = new Zend_Validate_Date();
         if (!$validator->isValid($dateFrom) || !$validator->isValid($dateTo)) {
             Mage::throwException(Mage::helper('core')->__('Invalid date'));
         }
         if (Varien_Date::toTimestamp($dateFrom) > Varien_Date::toTimestamp($dateTo)) {
             Mage::throwException(Mage::helper('core')->__('Start date cannot be greater than end date.'));
         }
     }
     $check = $this->_checkIntersection($object->getStoreId(), $dateFrom, $dateTo, $object->getId());
     if ($check) {
         Mage::throwException(Mage::helper('core')->__('Your design change for the specified store intersects with another one, please specify another date range.'));
     }
     parent::_beforeSave($object);
 }
开发者ID:QiuLihua83,项目名称:magento-enterprise-1.13.1.0,代码行数:26,代码来源:Design.php

示例7: getFormatedDate

 /**
  * Get formated date in store timezone
  *
  * @param   string $date
  * @return  string
  */
 public function getFormatedDate($date)
 {
     $storeDate = Mage::app()->getLocale()->storeDate(Mage::app()->getStore(), Varien_Date::toTimestamp($date), true);
     return Mage::helper('core')->formatDate($storeDate, Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
 }
开发者ID:hientruong90,项目名称:ee_14_installer,代码行数:11,代码来源:Data.php

示例8: insertOrder

 /**
  * Insert order to pdf page
  *
  * @param Zend_Pdf_Page $page
  * @param Mage_Sales_Model_Order $obj
  * @param bool $putOrderId
  */
 protected function insertOrder(&$page, $obj, $putOrderId = true)
 {
     if ($obj instanceof Mage_Sales_Model_Order) {
         $shipment = null;
         $order = $obj;
     } elseif ($obj instanceof Mage_Sales_Model_Order_Shipment) {
         $shipment = $obj;
         $order = $shipment->getOrder();
     }
     $this->y = $this->y ? $this->y : 815;
     $top = $this->y;
     $page->setFillColor(new Zend_Pdf_Color_GrayScale(0.45));
     $page->setLineColor(new Zend_Pdf_Color_GrayScale(0.45));
     #$page->drawRectangle(25, $top, 570, $top - 55);
     $page->drawRectangle(25, $top, 570, $top - 75);
     $page->setFillColor(new Zend_Pdf_Color_GrayScale(1));
     $this->setDocHeaderCoordinates(array(25, $top, 570, $top - 55));
     $this->_setFontRegular($page, 10);
     if ($putOrderId) {
         $page->drawText(Mage::helper('sales')->__('Order # ') . $order->getRealOrderId(), 35, $top -= 30, 'UTF-8');
     }
     $page->drawText(Mage::helper('sales')->__('Order Date: ') . Mage::helper('core')->formatDate($order->getCreatedAtStoreDate(), 'medium', false), 35, $top -= 15, 'UTF-8');
     if ($order->hasInvoices()) {
         foreach ($order->getInvoiceCollection() as $invoice) {
             $invoiceIncrementID = $invoice->getIncrementId();
             $invoiceObj = Mage::getModel('sales/order_invoice')->loadByIncrementId($invoiceIncrementID);
             $invoiceDate = $invoiceObj->getCreatedAt();
             $invoiceDueDate = Mage::app()->getLocale()->storeDate($order->getStore(), Varien_Date::toTimestamp($invoiceDate) + 7 * 24 * 60 * 60, true, $format);
         }
         $page->drawText(Mage::helper('sales')->__('Invoice Due Date: ') . Mage::helper('core')->formatDate($invoiceDueDate, 'medium', false), 35, $top -= 15, 'UTF-8');
     }
     if ($order->getData('dynamics_ord') !== null) {
         $page->drawText(Mage::helper('sales')->__('Invoice Custom Comment: ') . $order->getDynamicsOrd(), 35, $top -= 15, 'UTF-8');
     }
     $top -= 10;
     $page->setFillColor(new Zend_Pdf_Color_Rgb(0.93, 0.92, 0.92));
     $page->setLineColor(new Zend_Pdf_Color_GrayScale(0.5));
     $page->setLineWidth(0.5);
     $page->drawRectangle(25, $top, 275, $top - 25);
     $page->drawRectangle(275, $top, 570, $top - 25);
     /* Calculate blocks info */
     /* Billing Address */
     $billingAddress = $this->_formatAddress($order->getBillingAddress()->format('pdf'));
     /* Payment */
     $paymentInfo = Mage::helper('payment')->getInfoBlock($order->getPayment())->setIsSecureMode(true)->toPdf();
     $paymentInfo = htmlspecialchars_decode($paymentInfo, ENT_QUOTES);
     $payment = explode('{{pdf_row_separator}}', $paymentInfo);
     foreach ($payment as $key => $value) {
         if (strip_tags(trim($value)) == '') {
             unset($payment[$key]);
         }
     }
     reset($payment);
     /* Shipping Address and Method */
     if (!$order->getIsVirtual()) {
         /* Shipping Address */
         $shippingAddress = $this->_formatAddress($order->getShippingAddress()->format('pdf'));
         $shippingMethod = $order->getShippingDescription();
     }
     $page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
     $this->_setFontBold($page, 12);
     $page->drawText(Mage::helper('sales')->__('Sold to:'), 35, $top - 15, 'UTF-8');
     if (!$order->getIsVirtual()) {
         $page->drawText(Mage::helper('sales')->__('Ship to:'), 285, $top - 15, 'UTF-8');
     } else {
         $page->drawText(Mage::helper('sales')->__('Payment Method:'), 285, $top - 15, 'UTF-8');
     }
     $addressesHeight = $this->_calcAddressHeight($billingAddress);
     if (isset($shippingAddress)) {
         $addressesHeight = max($addressesHeight, $this->_calcAddressHeight($shippingAddress));
     }
     $page->setFillColor(new Zend_Pdf_Color_GrayScale(1));
     $page->drawRectangle(25, $top - 25, 570, $top - 33 - $addressesHeight);
     $page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
     $this->_setFontRegular($page, 10);
     $this->y = $top - 40;
     $addressesStartY = $this->y;
     foreach ($billingAddress as $value) {
         if ($value !== '') {
             $text = array();
             foreach (Mage::helper('core/string')->str_split($value, 45, true, true) as $_value) {
                 $text[] = $_value;
             }
             foreach ($text as $part) {
                 $page->drawText(strip_tags(ltrim($part)), 35, $this->y, 'UTF-8');
                 $this->y -= 15;
             }
         }
     }
     $addressesEndY = $this->y;
     if (!$order->getIsVirtual()) {
         $this->y = $addressesStartY;
         foreach ($shippingAddress as $value) {
//.........这里部分代码省略.........
开发者ID:VIVEKLUCKY1848,项目名称:magentospecials,代码行数:101,代码来源:InvoiceDueDate_override_Abstract.php

示例9: mktime

 /**
  * Convert internal date to UNIX timestamp
  *
  * @param string $str
  * @return int
  */
 public function mktime($str)
 {
     return Varien_Date::toTimestamp($str);
 }
开发者ID:okite11,项目名称:frames21,代码行数:10,代码来源:Abstract.php

示例10: registerIds

 /**
  * Add information about product ids to visitor/customer
  *
  *
  * @param Mage_Reports_Model_Product_Index_Abstract $object
  * @param array $productIds
  * @return Mage_Reports_Model_Resource_Product_Index_Abstract
  */
 public function registerIds(Varien_Object $object, $productIds)
 {
     $row = array('visitor_id' => $object->getVisitorId(), 'customer_id' => $object->getCustomerId(), 'store_id' => $object->getStoreId());
     $addedAt = Varien_Date::toTimestamp(true);
     $data = array();
     foreach ($productIds as $productId) {
         $productId = (int) $productId;
         if ($productId) {
             $row['product_id'] = $productId;
             $row['added_at'] = Varien_Date::formatDate($addedAt);
             $data[] = $row;
         }
         $addedAt -= $addedAt > 0 ? 1 : 0;
     }
     $matchFields = array('product_id', 'store_id');
     foreach ($data as $row) {
         Mage::getResourceHelper('reports')->mergeVisitorProductIndex($this->getMainTable(), $row, $matchFields);
     }
     return $this;
 }
开发者ID:blazeriaz,项目名称:youguess,代码行数:28,代码来源:Abstract.php

示例11: getCreatedAtStoreDate

 /**
  * Get object created at date affected with object store timezone
  *
  * @return Zend_Date
  */
 public function getCreatedAtStoreDate()
 {
     return Mage::app()->getLocale()->storeDate($this->getStore(), Varien_Date::toTimestamp($this->getCreatedAt()), true);
 }
开发者ID:SalesOneGit,项目名称:s1_magento,代码行数:9,代码来源:Abstract.php

示例12: isExpired

 /**
  * Check if email is expired and should not
  * get send out anymore
  * 
  * @param integer $now
  * @return boolean
  */
 public function isExpired($now = null)
 {
     if (!$now) {
         $now = time();
     }
     if ($this->getExpireAt()) {
         $expireAt = Varien_Date::toTimestamp($this->getExpireAt());
         return $expireAt < $now;
     }
     return false;
 }
开发者ID:sakibanda,项目名称:emarketing,代码行数:18,代码来源:Email.php

示例13: getUpdatedAtTimestamp

 /**
  * Get the timestamp of the latest update
  *
  * @return int|null
  */
 public function getUpdatedAtTimestamp()
 {
     $date = $this->getUpdatedAt();
     if ($date) {
         return Varien_Date::toTimestamp($date);
     }
     return null;
 }
开发者ID:ThomasNegeli,项目名称:magento-language-routes,代码行数:13,代码来源:Languageroute.php

示例14: callGetTaxForQuote

 public function callGetTaxForQuote(Mage_Sales_Model_Quote $quote)
 {
     /** @var Aoe_AvaTax_Helper_Soap $helper */
     $helper = Mage::helper('Aoe_AvaTax/Soap');
     $address = $quote->getShippingAddress();
     if ($address->validate() !== true) {
         $resultArray = array('ResultCode' => 'Skip', 'Messages' => array(), 'TaxLines' => array());
         return $resultArray;
     }
     $store = $quote->getStore();
     $hideDiscountAmount = Mage::getStoreConfigFlag(Mage_Tax_Model_Config::CONFIG_XML_PATH_APPLY_AFTER_DISCOUNT, $store);
     $timestamp = $quote->getCreatedAt() ? Varien_Date::toTimestamp($quote->getCreatedAt()) : now();
     $date = new Zend_Date($timestamp);
     $request = new AvaTax\GetTaxRequest();
     $request->setCompanyCode($this->limit($helper->getConfig('company_code', $store), 25));
     $request->setDocType(AvaTax\DocumentType::$SalesOrder);
     $request->setCommit(false);
     $request->setDetailLevel(AvaTax\DetailLevel::$Tax);
     $request->setDocDate($date->toString('yyyy-MM-dd'));
     $request->setCustomerCode($helper->getCustomerDocCode($quote->getCustomer()) ?: $helper->getQuoteDocCode($quote));
     $request->setCurrencyCode($this->limit($quote->getBaseCurrencyCode(), 3));
     $request->setDiscount($hideDiscountAmount ? 0.0 : $store->roundPrice($address->getBaseDiscountAmount()));
     if ($quote->getCustomerTaxvat()) {
         $request->setBusinessIdentificationNo($this->limit($quote->getCustomerTaxvat(), 25));
     }
     $request->setOriginAddress($this->getOriginAddress($store));
     $request->setDestinationAddress($this->getAddress($address));
     $taxLines = array();
     $itemPriceIncludesTax = Mage::getStoreConfigFlag(Mage_Tax_Model_Config::CONFIG_XML_PATH_PRICE_INCLUDES_TAX, $store);
     foreach ($this->getHelper()->getActionableQuoteAddressItems($address) as $k => $item) {
         /** @var Mage_Sales_Model_Quote_Item|Mage_Sales_Model_Quote_Address_Item $item */
         $itemAmount = $store->roundPrice($itemPriceIncludesTax ? $item->getBaseRowTotalInclTax() : $item->getBaseRowTotal());
         //$itemAmount = $store->roundPrice($item->getBaseRowTotal());
         $itemAmount -= $store->roundPrice($item->getBaseDiscountAmount());
         $taxLine = new AvaTax\Line();
         $taxLine->setNo($this->limit($k, 50));
         $taxLine->setItemCode($this->limit($item->getSku(), 50));
         $taxLine->setQty(round($item->getQty(), 4));
         $taxLine->setAmount($itemAmount);
         $taxLine->setDescription($this->limit($item->getName(), 255));
         $taxLine->setTaxCode($this->limit($helper->getProductTaxCode($item->getProduct()), 25));
         $taxLine->setDiscounted($item->getBaseDiscountAmount() > 0.0);
         $taxLine->setTaxIncluded($itemPriceIncludesTax);
         $taxLine->setRef1($this->limit($helper->getQuoteItemRef1($item, $store), 250));
         $taxLine->setRef2($this->limit($helper->getQuoteItemRef2($item, $store), 250));
         $taxLines[] = $taxLine;
     }
     $shippingPriceIncludesTax = Mage::getStoreConfigFlag(Mage_Tax_Model_Config::CONFIG_XML_PATH_SHIPPING_INCLUDES_TAX, $store);
     $shippingAmount = $store->roundPrice($shippingPriceIncludesTax ? $address->getBaseShippingInclTax() : $address->getBaseShippingAmount());
     //$shippingAmount = $store->roundPrice($address->getBaseShippingAmount());
     $shippingAmount -= $store->roundPrice($address->getBaseShippingDiscountAmount());
     $taxLine = new AvaTax\Line();
     $taxLine->setNo('SHIPPING');
     $taxLine->setItemCode('SHIPPING');
     $taxLine->setQty(1);
     $taxLine->setAmount($shippingAmount);
     $taxLine->setDescription($this->limit("Shipping: " . $address->getShippingMethod(), 255));
     $taxLine->setTaxCode($this->limit($helper->getShippingTaxCode($store), 25));
     $taxLine->setDiscounted($address->getBaseShippingDiscountAmount() > 0.0);
     $taxLine->setTaxIncluded($shippingPriceIncludesTax);
     $taxLine->setRef1($this->limit($address->getShippingMethod(), 25));
     $taxLines[] = $taxLine;
     $request->setLines($taxLines);
     Mage::dispatchEvent('aoe_avatax_soapapi_get_tax_for_quote_before', array('request' => $request, 'quote' => $quote));
     // TODO: Handle giftwrapping
     return $this->callGetTax($store, $request);
 }
开发者ID:aoepeople,项目名称:aoe_avatax,代码行数:67,代码来源:SoapApi.php

示例15: transformDate

 /**
  * Transform date to store format
  *
  * @param string $date
  * @return Zend_Date
  */
 public function transformDate($date)
 {
     return Mage::app()->getLocale()->storeDate($this->getCustomer()->getStoreId(), Varien_Date::toTimestamp($date));
 }
开发者ID:xiaoguizhidao,项目名称:bb,代码行数:10,代码来源:Storedcard.php


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