本文整理汇总了PHP中Mage_Core_Model_Abstract::getStoreIds方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Model_Abstract::getStoreIds方法的具体用法?PHP Mage_Core_Model_Abstract::getStoreIds怎么用?PHP Mage_Core_Model_Abstract::getStoreIds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Core_Model_Abstract
的用法示例。
在下文中一共展示了Mage_Core_Model_Abstract::getStoreIds方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _afterLoad
protected function _afterLoad(Mage_Core_Model_Abstract $object)
{
if ($object->getStoreIds()) {
$object->setStoreIds(explode(',', $object->getStoreIds()));
} else {
$object->setStoreIds(array(0));
}
return parent::_afterLoad($object);
}
示例2: _beforeSave
protected function _beforeSave(Mage_Core_Model_Abstract $object)
{
if (is_array($object->getStoreIds())) {
$object->setStoreIds(implode(',', $object->getStoreIds()));
}
if (is_array($object->getCustomerGroups())) {
$object->setCustomerGroups(implode(',', $object->getCustomerGroups()));
}
}
示例3: _afterLoad
/**
* @param Mage_Core_Model_Abstract $object
*
* @return $this|Mage_Core_Model_Resource_Db_Abstract
*/
protected function _afterLoad(Mage_Core_Model_Abstract $object)
{
if (strlen($object->getStoreIds()) > 0) {
$object->setStoreIds(array_map('intval', explode(',', $object->getStoreIds())));
} else {
$object->setStoreIds(array());
}
return parent::_afterLoad($object);
}
示例4: _syncStore
protected function _syncStore(Mage_Core_Model_Abstract $object)
{
$collection = Mage::getModel('menu/item')->getCollection()->addFieldToFilter('menu_id', $object->getId());
foreach ($collection as $item) {
$item->setStoreIds($object->getStoreIds())->save();
}
}
示例5: _afterLoad
protected function _afterLoad(Mage_Core_Model_Abstract $object)
{
$productIds = '';
if ($object->getId()) {
if (!is_array($object->getStoreIds())) {
$object->setStoreIds(explode(',', $object->getStoreIds()));
}
$groups = $object->getCustomerGroups();
if ($groups) {
$object->setCustomerGroups(explode(',', $groups));
}
$product = Mage::getResourceSingleton('downloads/relation')->getProductIds($object->getId());
if ($product) {
$productIds = implode(',', $product);
}
$object->setInProducts($productIds);
}
return parent::_afterLoad($object);
}
示例6: _afterSave
public function _afterSave(Mage_Core_Model_Abstract $object)
{
/** stores */
$deleteWhere = $this->_getWriteAdapter()->quoteInto('poll_id = ?', $object->getId());
$this->_getWriteAdapter()->delete($this->getTable('poll/poll_store'), $deleteWhere);
foreach ($object->getStoreIds() as $storeId) {
$pollStoreData = array('poll_id' => $object->getId(), 'store_id' => $storeId);
$this->_getWriteAdapter()->insert($this->getTable('poll/poll_store'), $pollStoreData);
}
/** answers */
foreach ($object->getAnswers() as $answer) {
$answer->setPollId($object->getId());
$answer->save();
}
}
示例7: getData
/**
* Sets indexer metadata for product entities
*
* @param Mage_Core_Model_Abstract $product
* @return array
*/
public function getData(Mage_Core_Model_Abstract $product)
{
$data = array();
$data['entity_id'] = $product->getEntityId();
$data['type_id'] = $product->getTypeId();
$data['store_id'] = $product->getStoreId();
$data['store_ids'] = $product->getStoreIds();
$data['name_suggest'] = $this->_prepareNameSuggestField($product);
$data['name_suggest_static'] = $product->getNameSuggestInputIndexValue();
return $data;
}
示例8: _afterSave
/**
* Set store data after saving model
*
* @param Mage_Core_Model_Abstract $object
* @return $this
*/
protected function _afterSave(Mage_Core_Model_Abstract $object)
{
if ($object->getId()) {
$oldStores = $this->lookupStoreIds($object->getId());
$newStores = (array) $object->getStoreIds();
if (empty($newStores)) {
$newStores = (array) $object->getStoreId();
}
$table = $this->getStoreTable();
$insert = array_diff($newStores, $oldStores);
$delete = array_diff($oldStores, $newStores);
if ($delete) {
$this->_getWriteAdapter()->delete($table, array($this->getIdFieldName() . ' = ?' => (int) $object->getId(), 'store_id IN (?)' => $delete));
}
if ($insert) {
$data = array();
foreach ($insert as $storeId) {
$data[] = array($this->getIdFieldName() => (int) $object->getId(), 'store_id' => (int) $storeId);
}
$this->_getWriteAdapter()->insertMultiple($table, $data);
}
if (!$object->getSkipReindex()) {
$object->getResource()->reindexAll();
}
}
}
示例9: saveManufacturerStore
/**
* Delete current manufacturer from the table zeon_manufacturer_store and then
* insert to update "manufacturer to store" relations
*
* @param Mage_Core_Model_Abstract $object
*/
public function saveManufacturerStore(Mage_Core_Model_Abstract $object)
{
/** stores */
$deleteWhere = $this->_getReadAdapter()->quoteInto('manufacturer_id = ?', $object->getId());
$this->_getReadAdapter()->delete($this->getTable('zeon_manufacturer/store'), $deleteWhere);
foreach ($object->getStoreIds() as $storeId) {
$manufacturerStoreData = array('manufacturer_id' => $object->getId(), 'store_id' => $storeId);
$this->_getWriteAdapter()->insert($this->getTable('zeon_manufacturer/store'), $manufacturerStoreData);
}
}
示例10: _afterSave
/**
* After save
*
* @param Mage_Core_Model_Abstract $object
*
* @return Innoexts_StorePricing_Model_Mysql4_Catalogrule_Rule
*/
protected function _afterSave(Mage_Core_Model_Abstract $object)
{
if ($this->getVersionHelper()->isGe1700()) {
if ($object->hasStoreIds()) {
$storeIds = $object->getStoreIds();
if (!is_array($storeIds)) {
$storeIds = explode(',', (string) $storeIds);
}
$this->bindRuleToEntity($object->getId(), $storeIds, 'store');
}
}
parent::_afterSave($object);
return $this;
}
示例11: saveFaqStore
/**
* Delete current faq from the table zeon_faq_store and then
* insert to update "faq to store" relations
*
* @param Mage_Core_Model_Abstract $object
*/
public function saveFaqStore(Mage_Core_Model_Abstract $object)
{
/** stores */
$deleteWhere = $this->_getReadAdapter()->quoteInto('faq_id = ?', $object->getId());
$this->_getReadAdapter()->delete($this->getTable('zeon_faq/store'), $deleteWhere);
foreach ($object->getStoreIds() as $storeId) {
$faqStoreData = array('faq_id' => $object->getId(), 'store_id' => $storeId);
$this->_getWriteAdapter()->insert($this->getTable('zeon_faq/store'), $faqStoreData);
if ($storeId === '0') {
break;
}
}
}