本文整理汇总了PHP中Mage_Core_Model_Abstract::setFromDate方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Model_Abstract::setFromDate方法的具体用法?PHP Mage_Core_Model_Abstract::setFromDate怎么用?PHP Mage_Core_Model_Abstract::setFromDate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Core_Model_Abstract
的用法示例。
在下文中一共展示了Mage_Core_Model_Abstract::setFromDate方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _beforeSave
/**
* Prepare target rule before save
*
* @param Mage_Core_Model_Abstract $object
*/
protected function _beforeSave(Mage_Core_Model_Abstract $object)
{
if ($object->getFromDate() instanceof Zend_Date) {
$object->setFromDate($object->getFromDate()->toString(Varien_Date::DATETIME_INTERNAL_FORMAT));
} else {
$object->setFromDate(null);
}
if ($object->getToDate() instanceof Zend_Date) {
$object->setToDate($object->getToDate()->toString(Varien_Date::DATETIME_INTERNAL_FORMAT));
} else {
$object->setToDate(null);
}
}
示例2: _beforeSave
/**
* Prepare object data for saving
*
* @param Mage_Core_Model_Abstract $object
*/
public function _beforeSave(Mage_Core_Model_Abstract $object)
{
if (!$object->getFromDate()) {
$date = new Zend_Date(Mage::getModel('core/date')->gmtTimestamp());
$date->setHour(0)->setMinute(0)->setSecond(0);
$object->setFromDate($date);
}
$object->setFromDate($object->getFromDate()->toString(Varien_Date::DATETIME_INTERNAL_FORMAT));
if (!$object->getToDate()) {
$object->setToDate(new Zend_Db_Expr('NULL'));
} else {
$object->setToDate($object->getToDate()->toString(Varien_Date::DATETIME_INTERNAL_FORMAT));
}
parent::_beforeSave($object);
}
示例3: _beforeSave
public function _beforeSave(Mage_Core_Model_Abstract $object)
{
if (!$object->getFromDate()) {
$object->setFromDate(new Zend_Date(Mage::getModel('core/date')->gmtTimestamp()));
}
if ($object->getFromDate() instanceof Zend_Date) {
$object->setFromDate($object->getFromDate()->toString(Varien_Date::DATETIME_INTERNAL_FORMAT));
}
if (!$object->getToDate()) {
$object->setToDate(new Zend_Db_Expr('NULL'));
} else {
if ($object->getToDate() instanceof Zend_Date) {
$object->setToDate($object->getToDate()->toString(Varien_Date::DATETIME_INTERNAL_FORMAT));
}
}
parent::_beforeSave($object);
}
示例4: _beforeSave
public function _beforeSave(Mage_Core_Model_Abstract $object)
{
$object->setFromDate($this->formatDate($object->getFromDate()));
$object->setToDate($this->formatDate($object->getToDate()));
if (!$object->getDiscountQty()) {
$object->setDiscountQty(new Zend_Db_Expr('NULL'));
}
parent::_beforeSave($object);
}
示例5: _beforeSave
/**
* Prepare object data for saving
*
* @param Mage_Core_Model_Abstract $object
*/
public function _beforeSave(Mage_Core_Model_Abstract $object)
{
if (!$object->getFromDate()) {
$date = Mage::app()->getLocale()->date();
$date->setHour(0)->setMinute(0)->setSecond(0);
$object->setFromDate($date);
}
if ($object->getFromDate() instanceof Zend_Date) {
$object->setFromDate($object->getFromDate()->toString(Varien_Date::DATETIME_INTERNAL_FORMAT));
}
if (!$object->getToDate()) {
$object->setToDate(new Zend_Db_Expr('NULL'));
} else {
if ($object->getToDate() instanceof Zend_Date) {
$object->setToDate($object->getToDate()->toString(Varien_Date::DATETIME_INTERNAL_FORMAT));
}
}
parent::_beforeSave($object);
}
示例6: _beforeSave
protected function _beforeSave(Mage_Core_Model_Abstract $object)
{
$dateFormatIso = Mage::app()->getLocale()->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM);
if (!$object->getFromDate()) {
$object->setFromDate(date("Y-m-d H:i:s", Mage::getModel('core/date')->timestamp(time())));
} else {
$object->setFromDate(Mage::app()->getLocale()->date($object->getFromDate(), $dateFormatIso));
$object->setFromDate($object->getFromDate()->toString(Varien_Date::DATETIME_INTERNAL_FORMAT));
$object->setFromDate(Mage::getSingleton('core/date')->gmtDate(null, $object->getFromDate()));
}
if (!$object->getToDate()) {
$object->setToDate();
} else {
$object->setToDate(Mage::app()->getLocale()->date($object->getToDate(), $dateFormatIso));
$object->setToDate($object->getToDate()->toString(Varien_Date::DATETIME_INTERNAL_FORMAT));
$object->setToDate(Mage::getSingleton('core/date')->gmtDate(null, $object->getToDate()));
}
return $this;
}
示例7: _beforeSave
/**
* On beforeSave
*
* @param Mage_Core_Model_Abstract $object
*/
public function _beforeSave(Mage_Core_Model_Abstract $object)
{
if (!$object->getFromDate()) {
$object->setFromDate(Mage::app()->getLocale()->date());
}
if ($object->getFromDate() instanceof Zend_Date) {
$object->setFromDate($object->getFromDate()->toString(Varien_Date::DATETIME_INTERNAL_FORMAT));
}
if (!$object->getToDate()) {
$object->setToDate(new Zend_Db_Expr('NULL'));
} else {
if ($object->getToDate() instanceof Zend_Date) {
$object->setToDate($object->getToDate()->toString(Varien_Date::DATETIME_INTERNAL_FORMAT));
}
}
if (!$object->getDiscountQty()) {
$object->setDiscountQty(new Zend_Db_Expr('NULL'));
}
parent::_beforeSave($object);
}
示例8: _beforeSave
public function _beforeSave(Mage_Core_Model_Abstract $object)
{
$startDate = $object->getFromDate();
if ($startDate == '') {
//$startDate = Mage::app()->getLocale()->date();
$startDate = Mage::getModel('core/date')->gmtDate();
}
$object->setFromDate($this->formatDate($startDate));
$object->setToDate($this->formatDate($object->getToDate()));
parent::_beforeSave($object);
}
示例9: _beforeSave
public function _beforeSave(Mage_Core_Model_Abstract $object)
{
if (is_array($object->getData('customer_group_ids'))) {
$object->setData('customer_group_ids', implode(',', $object->getData('customer_group_ids')));
}
if (is_array($object->getData('website_ids'))) {
$object->setData('website_ids', implode(',', $object->getData('website_ids')));
}
if (!$object->getFromDate()) {
$object->setFromDate(Mage::app()->getLocale()->date());
}
if ($object->getFromDate() instanceof Zend_Date) {
$object->setFromDate($object->getFromDate()->toString(Varien_Date::DATETIME_INTERNAL_FORMAT));
}
if (!$object->getToDate()) {
$object->setToDate(new Zend_Db_Expr('NULL'));
} else {
if ($object->getToDate() instanceof Zend_Date) {
$object->setToDate($object->getToDate()->toString(Varien_Date::DATETIME_INTERNAL_FORMAT));
}
}
}