本文整理汇总了PHP中Mage_Core_Model_Abstract::getStoreId方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Model_Abstract::getStoreId方法的具体用法?PHP Mage_Core_Model_Abstract::getStoreId怎么用?PHP Mage_Core_Model_Abstract::getStoreId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Core_Model_Abstract
的用法示例。
在下文中一共展示了Mage_Core_Model_Abstract::getStoreId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getContent
/**
* Retrieve the content of the saved model
*
* @return array Content
*/
public function getContent()
{
// have to re-load the model as based on database datatypes the format of values changes
$className = get_class($this->_savedModel);
$model = new $className();
// Add store id if given
if ($storeId = $this->_savedModel->getStoreId()) {
$model->setStoreId($storeId);
}
$model->load($this->_savedModel->getId());
return $this->_filterObligatoryFields($model->getData());
}
示例2: _afterSave
/**
* Assign page to store views
*
* @param Mage_Core_Model_Abstract $object
*/
protected function _afterSave(Mage_Core_Model_Abstract $object)
{
$condition = $this->_getWriteAdapter()->quoteInto('post_id = ?', $object->getId());
// process faq item to store relation
$this->_getWriteAdapter()->delete($this->getTable('ves_blog/post_store'), $condition);
$stores = $object->getData('stores');
if ($stores) {
foreach ((array) $object->getData('stores') as $store) {
$storeArray = array();
$storeArray['post_id'] = $object->getId();
$storeArray['store_id'] = $store;
$this->_getWriteAdapter()->insert($this->getTable('ves_blog/post_store'), $storeArray);
}
} else {
$stores = $object->getStoreId();
if ($stores) {
foreach ((array) $stores as $store) {
$storeArray = array();
$storeArray['post_id'] = $object->getId();
$storeArray['store_id'] = $store;
$this->_getWriteAdapter()->insert($this->getTable('ves_blog/post_store'), $storeArray);
}
}
}
return parent::_afterSave($object);
}
示例3: _beforeSave
public function _beforeSave(Mage_Core_Model_Abstract $object)
{
$format = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
if ($date = $object->getDateFrom()) {
$date = Mage::app()->getLocale()->date($date, $format, null, false);
$object->setDateFrom($date->toString(Varien_Date::DATETIME_INTERNAL_FORMAT));
} else {
$object->setDateFrom(null);
}
if ($date = $object->getDateTo()) {
$date = Mage::app()->getLocale()->date($date, $format, null, false);
$object->setDateTo($date->toString(Varien_Date::DATETIME_INTERNAL_FORMAT));
} else {
$object->setDateTo(null);
}
if (!is_null($object->getDateFrom()) && !is_null($object->getDateTo()) && strtotime($object->getDateFrom()) > strtotime($object->getDateTo())) {
Mage::throwException(Mage::helper('core')->__('Start date can\'t 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 (is_null($object->getDateFrom())) {
$object->setDateFrom(new Zend_Db_Expr('null'));
}
if (is_null($object->getDateTo())) {
$object->setDateTo(new Zend_Db_Expr('null'));
}
parent::_beforeSave($object);
}
示例4: _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);
}
示例5: _afterSave
/**
* Assign page to store views
*
* @param Mage_Core_Model_Abstract $object
*/
protected function _afterSave(Mage_Core_Model_Abstract $object)
{
$condition = $this->_getWriteAdapter()->quoteInto('post_id = ?', $object->getId());
// process faq item to store relation
$this->_getWriteAdapter()->delete($this->getTable('ves_blog/post_store'), $condition);
$stores = $object->getData('stores');
if ($stores) {
foreach ((array) $object->getData('stores') as $store) {
$storeArray = array();
$storeArray['post_id'] = $object->getId();
$storeArray['store_id'] = $store;
$this->_getWriteAdapter()->insert($this->getTable('ves_blog/post_store'), $storeArray);
}
} else {
$stores = $object->getStoreId();
if ($stores) {
foreach ((array) $stores as $store) {
$storeArray = array();
$storeArray['post_id'] = $object->getId();
$storeArray['store_id'] = $store;
$this->_getWriteAdapter()->insert($this->getTable('ves_blog/post_store'), $storeArray);
}
}
}
//Rewrite blog url
$resroute = Mage::getStoreConfig('ves_blog/general_setting/route');
$extension = ".html";
Mage::getModel('core/url_rewrite')->loadByIdPath('venusblog/post/' . $object->getId())->setIdPath('venusblog/post/' . $object->getId())->setRequestPath($resroute . '/' . $object->getIdentifier() . $extension)->setTargetPath('venusblog/post/view/id/' . $object->getId())->save();
return parent::_afterSave($object);
}
示例6: loadCart
protected function loadCart(Mage_Core_Model_Abstract $object)
{
$products = array();
foreach (Mage::getModel('sales/quote')->load($object->getQuoteId())->getAllVisibleItems() as $item) {
$products[] = $this->_getCartProductEntity($item, $object->getStoreId());
}
$object->setProducts($products);
}
示例7: _saveBlockTitle
protected function _saveBlockTitle(Mage_Core_Model_Abstract $object)
{
$table = $this->getTable('customoptions/option_block_title');
$storeId = Mage_Catalog_Model_Abstract::DEFAULT_STORE_ID;
if ($object->getStoreId() != $storeId) {
$storeId = $object->getStoreId();
}
if (!$object->getData('scope', 'block_title')) {
$select = $this->_getReadAdapter()->select()->from($table)->where('option_id = ?', $object->getId())->where('store_id = ?', $storeId);
if ($this->_getReadAdapter()->fetchOne($select)) {
$this->_getWriteAdapter()->update($table, array('block_title' => $object->getBlockTitle()), 'option_id = ' . $object->getId() . ' AND store_id = ' . $storeId);
} else {
$this->_getWriteAdapter()->insert($table, array('option_id' => $object->getId(), 'store_id' => $storeId, 'block_title' => $object->getBlockTitle()));
}
} elseif ($object->getData('scope', 'block_title')) {
$this->_getWriteAdapter()->delete($table, 'option_id = ' . $object->getId() . ' AND store_id = ' . $storeId);
}
}
示例8: loadByQueryText
/**
* Custom load model only by query text (skip synonym for)
*
* @param Mage_Core_Model_Abstract $object
* @param string $value
* @return Mage_CatalogSearch_Model_Mysql4_Query
*/
public function loadByQueryText(Mage_Core_Model_Abstract $object, $value)
{
$select = $this->_getReadAdapter()->select()->from($this->getMainTable())->where('query_text = ?', $value)->where('store_id = ?', $object->getStoreId())->limit(1);
if ($data = $this->_getReadAdapter()->fetchRow($select)) {
$object->setData($data);
$this->_afterLoad($object);
}
return $this;
}
示例9: _afterSave
protected function _afterSave(Mage_Core_Model_Abstract $object)
{
$storeId = Mage_Catalog_Model_Abstract::DEFAULT_STORE_ID;
if ($object->getStoreId() != $storeId) {
$storeId = $object->getStoreId();
}
// save view_mode
$table = $this->getTable('mageworx_customoptions/option_view_mode');
if (!$object->getData('scope', 'view_mode') && !is_null($object->getViewMode())) {
$select = $this->_getReadAdapter()->select()->from($table)->where('option_id = ?', $object->getId())->where('store_id = ?', $storeId);
if ($this->_getReadAdapter()->fetchOne($select)) {
$this->_getWriteAdapter()->update($table, array('view_mode' => $object->getViewMode()), 'option_id = ' . $object->getId() . ' AND store_id = ' . $storeId);
} else {
$this->_getWriteAdapter()->insert($table, array('option_id' => $object->getId(), 'store_id' => $storeId, 'view_mode' => $object->getViewMode()));
}
} elseif ($object->getData('scope', 'view_mode') || is_null($object->getViewMode())) {
$this->_getWriteAdapter()->delete($table, 'option_id = ' . $object->getId() . ' AND store_id = ' . $storeId);
}
// save description
$table = $this->getTable('mageworx_customoptions/option_description');
if (!$object->getData('scope', 'description') && $object->getDescription()) {
$select = $this->_getReadAdapter()->select()->from($table)->where('option_id = ?', $object->getId())->where('store_id = ?', $storeId);
if ($this->_getReadAdapter()->fetchOne($select)) {
$this->_getWriteAdapter()->update($table, array('description' => $object->getDescription()), 'option_id = ' . $object->getId() . ' AND store_id = ' . $storeId);
} else {
$this->_getWriteAdapter()->insert($table, array('option_id' => $object->getId(), 'store_id' => $storeId, 'description' => $object->getDescription()));
}
} elseif ($object->getData('scope', 'description') || !$object->getDescription()) {
$this->_getWriteAdapter()->delete($table, 'option_id = ' . $object->getId() . ' AND store_id = ' . $storeId);
}
// save default text
$table = $this->getTable('mageworx_customoptions/option_default');
if (!$object->getData('scope', 'default_text') && $object->getDefaultText()) {
$select = $this->_getReadAdapter()->select()->from($table)->where('option_id = ?', $object->getId())->where('store_id = ?', $storeId);
if ($this->_getReadAdapter()->fetchOne($select)) {
$this->_getWriteAdapter()->update($table, array('default_text' => $object->getDefaultText()), 'option_id = ' . $object->getId() . ' AND store_id = ' . $storeId);
} else {
$this->_getWriteAdapter()->insert($table, array('option_id' => $object->getId(), 'store_id' => $storeId, 'default_text' => $object->getDefaultText()));
}
} elseif ($object->getData('scope', 'default_text') || !$object->getDefaultText()) {
$this->_getWriteAdapter()->delete($table, 'option_id = ' . $object->getId() . ' AND store_id = ' . $storeId);
}
return parent::_afterSave($object);
}
示例10: loadByQuery
/**
* Custom load model by search query string
*
* @param Mage_Core_Model_Abstract $object
* @param string $value
* @return Mage_CatalogSearch_Model_Mysql4_Query
*/
public function loadByQuery(Mage_Core_Model_Abstract $object, $value)
{
$select = $this->_getReadAdapter()->select()->from($this->getMainTable())->where('query_text=:query_text')->where('store_id=:store_id');
$bind = array(':query_text' => $value, ':store_id' => $object->getStoreId());
if ($data = $this->_getReadAdapter()->fetchRow($select, $bind)) {
$object->setData($data);
$this->_afterLoad($object);
}
return $this;
}
示例11: _afterLoad
protected function _afterLoad(Mage_Core_Model_Abstract $object)
{
$object->setData('store_id', $object->getStoreId());
$select = $this->_getReadAdapter()->select()->from($this->getTable('pws_faq/categories_stores'))->where('category_id = ?', $object->getId())->where('store_id = ?', $object->getData('store_id'));
if ($data = $this->_getReadAdapter()->fetchRow($select)) {
$object->setData('name', $data['name']);
$object->setData('description', $data['description']);
$object->setData('use_default', $data['use_default']);
}
//use default record
if ($object->getStoreId() != 0 && (empty($data) || $data['use_default'] == 1)) {
$select = $this->_getReadAdapter()->select()->from($this->getTable('pws_faq/categories_stores'))->where('category_id = ?', $object->getId())->where('store_id = ?', 0);
if ($data = $this->_getReadAdapter()->fetchRow($select)) {
$object->setData('name', $data['name']);
$object->setData('description', $data['description']);
$object->setData('use_default', $data['use_default']);
}
}
return parent::_afterLoad($object);
}
示例12: _afterSave
protected function _afterSave(Mage_Core_Model_Abstract $object)
{
$descriptionTable = $this->getTable('customoptiondescription/product_option_description');
if (!$object->getData('scope', 'description')) {
$statement = $this->_getReadAdapter()->select()->from($descriptionTable)->where('option_id = ' . $object->getId() . ' and store_id = ?', 0);
if ($this->_getReadAdapter()->fetchOne($statement)) {
if ($object->getStoreId() == '0') {
$this->_getWriteAdapter()->update($descriptionTable, array('description' => $object->getDescription()), $this->_getWriteAdapter()->quoteInto('option_id=' . $object->getId() . ' AND store_id=?', 0));
}
} else {
$this->_getWriteAdapter()->insert($descriptionTable, array('option_id' => $object->getId(), 'store_id' => 0, 'description' => $object->getDescription()));
}
}
if ($object->getStoreId() != '0' && !$object->getData('scope', 'description')) {
$statement = $this->_getReadAdapter()->select()->from($descriptionTable)->where('option_id = ' . $object->getId() . ' and store_id = ?', $object->getStoreId());
if ($this->_getReadAdapter()->fetchOne($statement)) {
$this->_getWriteAdapter()->update($descriptionTable, array('description' => $object->getDescription()), $this->_getWriteAdapter()->quoteInto('option_id=' . $object->getId() . ' AND store_id=?', $object->getStoreId()));
} else {
$this->_getWriteAdapter()->insert($descriptionTable, array('option_id' => $object->getId(), 'store_id' => $object->getStoreId(), 'description' => $object->getDescription()));
}
} elseif ($object->getData('scope', 'description')) {
$this->_getWriteAdapter()->delete($descriptionTable, $this->_getWriteAdapter()->quoteInto('option_id = ' . $object->getId() . ' AND store_id = ?', $object->getStoreId()));
}
return parent::_afterSave($object);
}
示例13: _saveValueTitles
/**
* Save titles
*
* @param Mage_Core_Model_Abstract $object
* @return Mage_Catalog_Model_Resource_Product_Option
*/
protected function _saveValueTitles(Mage_Core_Model_Abstract $object)
{
$readAdapter = $this->_getReadAdapter();
$writeAdapter = $this->_getWriteAdapter();
$titleTable = $this->getTable('catalog/product_option_title');
//title
if (!$object->getData('scope', 'title')) {
$statement = $readAdapter->select()->from($titleTable)->where('option_id = ?', $object->getId())->where('store_id = ?', Mage_Catalog_Model_Abstract::DEFAULT_STORE_ID);
if ($readAdapter->fetchOne($statement)) {
if ($object->getStoreId() == '0') {
$data = $this->_prepareDataForTable(new Varien_Object(array('title' => $object->getTitle(), 'class' => $object->getClass())), $titleTable);
$writeAdapter->update($titleTable, $data, array('option_id = ?' => $object->getId(), 'store_id = ?' => Mage_Catalog_Model_Abstract::DEFAULT_STORE_ID));
}
} else {
$data = $this->_prepareDataForTable(new Varien_Object(array('option_id' => $object->getId(), 'store_id' => Mage_Catalog_Model_Abstract::DEFAULT_STORE_ID, 'title' => $object->getTitle(), 'class' => $object->getClass())), $titleTable);
$writeAdapter->insert($titleTable, $data);
}
}
if ($object->getStoreId() != '0' && !$object->getData('scope', 'title')) {
$statement = $readAdapter->select()->from($titleTable)->where('option_id = ?', $object->getId())->where('store_id = ?', $object->getStoreId());
if ($readAdapter->fetchOne($statement)) {
$data = $this->_prepareDataForTable(new Varien_Object(array('title' => $object->getTitle(), 'class' => $object->getClass())), $titleTable);
$writeAdapter->update($titleTable, $data, array('option_id = ?' => $object->getId(), 'store_id = ?' => $object->getStoreId()));
} else {
$data = $this->_prepareDataForTable(new Varien_Object(array('option_id' => $object->getId(), 'store_id' => $object->getStoreId(), 'title' => $object->getTitle(), 'class' => $object->getClass())), $titleTable);
$writeAdapter->insert($titleTable, $data);
}
} elseif ($object->getData('scope', 'title')) {
$writeAdapter->delete($titleTable, array('option_id = ?' => $object->getId(), 'store_id = ?' => $object->getStoreId()));
}
}
示例14: _afterLoad
/**
* Add store date to registry type data
*
* @param Mage_Core_Model_Abstract $object
* @return Mage_Core_Model_Resource_Db_Abstract
*/
protected function _afterLoad(Mage_Core_Model_Abstract $object)
{
$adapter = $this->_getReadAdapter();
$scopeCheckExpr = $adapter->getCheckSql('store_id = 0', $adapter->quote('default'), $adapter->quote('store'));
$storeIds = array(Mage_Core_Model_App::ADMIN_STORE_ID);
if ($object->getStoreId()) {
$storeIds[] = (int) $object->getStoreId();
}
$select = $adapter->select()->from($this->_infoTable, array('scope' => $scopeCheckExpr, 'label', 'is_listed', 'sort_order'))->where('type_id = ?', (int) $object->getId())->where('store_id IN (?)', $storeIds);
$data = $adapter->fetchAssoc($select);
if (isset($data['store']) && is_array($data['store'])) {
foreach ($data['store'] as $key => $value) {
$object->setData($key, $value !== null ? $value : $data['default'][$key]);
$object->setData($key . '_store', $value);
}
} elseif (isset($data['default']) && is_array($data['default'])) {
foreach ($data['default'] as $key => $value) {
$object->setData($key, $value);
}
}
return parent::_afterLoad($object);
}
示例15: _beforeSave
public function _beforeSave(Mage_Core_Model_Abstract $object)
{
$object->setDateFrom($this->formatDate($object->getDateFrom()));
$object->setDateTo($this->formatDate($object->getDateTo()));
if (strtotime($object->getDateFrom()) > strtotime($object->getDateTo())) {
Mage::throwException(Mage::helper('core')->__('Start date can\'t 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'));
}
parent::_beforeSave($object);
}