本文整理汇总了PHP中Mage_Core_Model_Abstract::setStoreId方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Model_Abstract::setStoreId方法的具体用法?PHP Mage_Core_Model_Abstract::setStoreId怎么用?PHP Mage_Core_Model_Abstract::setStoreId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Core_Model_Abstract
的用法示例。
在下文中一共展示了Mage_Core_Model_Abstract::setStoreId方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _afterLoad
/**
* Perform operations after object load
*
* @param Mage_Core_Model_Abstract $object
*
* @return Mage_Core_Model_Resource_Db_Abstract
*/
protected function _afterLoad(Mage_Core_Model_Abstract $object)
{
if ($object->getId()) {
$stores = $this->lookupStoreIds($object->getId());
$object->setStoreId($stores);
}
return parent::_afterLoad($object);
}
示例2: _beforeSave
protected function _beforeSave(Mage_Core_Model_Abstract $object)
{
$object->setStoreId($this->getStoreId());
if (!$this->isUniqueCategory($object)) {
Mage::throwException(Mage::helper('downloads')->__("Category '%s' already exist", $object->getTitle()));
}
return parent::_beforeSave($object);
}
示例3: _beforeSave
protected function _beforeSave(Mage_Core_Model_Abstract $object)
{
$date = new Zend_Date();
if (!$object->getId()) {
$object->setCreatedAt($date->toString(self::DATE_FORMAT));
$object->setStoreId(Mage::app()->getStore()->getId());
}
parent::_beforeSave($object);
}
示例4: _afterLoad
/**
* Load store data after loading model
*
* @param Mage_Core_Model_Abstract $object
* @return $this
*/
protected function _afterLoad(Mage_Core_Model_Abstract $object)
{
if ($object->getId()) {
$storeIds = $this->lookupStoreIds($object->getId());
$object->setData('store_ids', $storeIds);
if (!$this->isAdmin()) {
$object->setStoreId(Mage::app()->getStore(true)->getId());
}
}
return parent::_afterLoad($object);
}
示例5: _afterLoad
/**
* Function called after a model is loaded (but not when a collection of models are loaded)
* If filters set, unserialize (convert to an array)
*
* @param Mage_Core_Model_Abstract $object
* @return $this
*/
protected function _afterLoad(Mage_Core_Model_Abstract $object)
{
if ($object->getId()) {
$storeIds = $this->lookupStoreIds($object->getId());
if ($this->isAdmin()) {
$object->setData('store_id', $storeIds);
} else {
$object->setStoreId(Mage::app()->getStore(true)->getId());
if (count($storeIds) === 1) {
if ($storeIds[0] != 0) {
$object->setStoreId((int) array_shift($storeIds));
}
}
}
}
if ($this->isAdmin()) {
$this->_loadAdminData($object);
}
return parent::_afterLoad($object);
}
示例6: _afterLoad
/**
* Load store data after loading model
*
* @param Mage_Core_Model_Abstract $object
* @return $this
*/
protected function _afterLoad(Mage_Core_Model_Abstract $object)
{
if ($object->getId()) {
$storeIds = $this->lookupStoreIds($object->getId());
$object->setData('store_ids', $storeIds);
if (!$this->isAdmin()) {
$object->setStoreId(Mage::app()->getStore(true)->getId());
}
if ($object->getCustomFields()) {
$customFields = @unserialize($object->getCustomFields());
if (is_array($customFields)) {
foreach ($customFields as $field => $value) {
$object->setData($field, $value);
}
}
}
}
return parent::_afterLoad($object);
}