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


PHP AbstractModel::getWebsiteId方法代码示例

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


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

示例1: _getAlertRow

 /**
  * Retrieve alert row by object parameters
  *
  * @param \Magento\Framework\Model\AbstractModel $object
  * @return array|false
  */
 protected function _getAlertRow(\Magento\Framework\Model\AbstractModel $object)
 {
     $adapter = $this->_getReadAdapter();
     if ($object->getCustomerId() && $object->getProductId() && $object->getWebsiteId()) {
         $select = $adapter->select()->from($this->getMainTable())->where('customer_id = :customer_id')->where('product_id  = :product_id')->where('website_id  = :website_id');
         $bind = [':customer_id' => $object->getCustomerId(), ':product_id' => $object->getProductId(), ':website_id' => $object->getWebsiteId()];
         return $adapter->fetchRow($select, $bind);
     }
     return false;
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:16,代码来源:AbstractResource.php

示例2: _changeWebsite

 /**
  * Change store group website
  *
  * @param \Magento\Framework\Model\AbstractModel $model
  * @return $this
  */
 protected function _changeWebsite(\Magento\Framework\Model\AbstractModel $model)
 {
     if ($model->getOriginalWebsiteId() && $model->getWebsiteId() != $model->getOriginalWebsiteId()) {
         $select = $this->_getWriteAdapter()->select()->from($this->getTable('store_website'), 'default_group_id')->where('website_id = :website_id');
         $groupId = $this->_getWriteAdapter()->fetchOne($select, ['website_id' => $model->getOriginalWebsiteId()]);
         if ($groupId == $model->getId()) {
             $bind = ['default_group_id' => 0];
             $where = ['website_id = ?' => $model->getOriginalWebsiteId()];
             $this->_getWriteAdapter()->update($this->getTable('store_website'), $bind, $where);
         }
     }
     return $this;
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:19,代码来源:Group.php

示例3: _beforeSave

 /**
  * Before save action
  *
  * @param \Magento\Framework\Model\AbstractModel $object
  * @return $this
  */
 protected function _beforeSave(\Magento\Framework\Model\AbstractModel $object)
 {
     if (is_null($object->getId()) && $object->getCustomerId() && $object->getProductId() && $object->getWebsiteId()) {
         if ($row = $this->_getAlertRow($object)) {
             $object->addData($row);
             $object->setStatus(0);
         }
     }
     if (is_null($object->getAddDate())) {
         $object->setAddDate($this->_dateFactory->create()->gmtDate());
         $object->setStatus(0);
     }
     return parent::_beforeSave($object);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:20,代码来源:Stock.php

示例4: aroundSave

 /**
  * @param \Magento\Store\Model\ResourceModel\Group $object
  * @param callable $proceed
  * @param AbstractModel $group
  * @return \Magento\Store\Model\ResourceModel\Group
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function aroundSave(\Magento\Store\Model\ResourceModel\Group $object, \Closure $proceed, AbstractModel $group)
 {
     $originGroup = $group;
     $result = $proceed($originGroup);
     if (!$group->isObjectNew() && ($group->dataHasChangedFor('website_id') || $group->dataHasChangedFor('root_category_id'))) {
         $this->storeManager->reinitStores();
         foreach ($group->getStoreIds() as $storeId) {
             $this->urlPersist->deleteByData([UrlRewrite::STORE_ID => $storeId]);
         }
         $this->urlPersist->replace($this->generateCategoryUrls($group->getRootCategoryId(), $group->getStoreIds()));
         $this->urlPersist->replace($this->generateProductUrls($group->getWebsiteId(), $group->getOrigData('website_id')));
     }
     return $result;
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:21,代码来源:Group.php

示例5: _afterDelete

 /**
  * Remove configuration data after delete website
  *
  * @param \Magento\Framework\Model\AbstractModel $model
  * @return $this
  */
 protected function _afterDelete(\Magento\Framework\Model\AbstractModel $model)
 {
     $where = ['scope = ?' => \Magento\Store\Model\ScopeInterface::SCOPE_WEBSITES, 'scope_id = ?' => $model->getWebsiteId()];
     $this->getConnection()->delete($this->getTable('core_config_data'), $where);
     return $this;
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:12,代码来源:Website.php

示例6: aroundSave

 /**
  * @param \Magento\Store\Model\ResourceModel\Store $object
  * @param callable $proceed
  * @param AbstractModel $store
  * @return \Magento\Store\Model\ResourceModel\Store
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function aroundSave(\Magento\Store\Model\ResourceModel\Store $object, \Closure $proceed, AbstractModel $store)
 {
     $originStore = $store;
     $result = $proceed($originStore);
     if ($store->isObjectNew() || $store->dataHasChangedFor('group_id')) {
         if (!$store->isObjectNew()) {
             $this->urlPersist->deleteByData([UrlRewrite::STORE_ID => $store->getId()]);
         }
         $this->urlPersist->replace($this->generateCategoryUrls($store->getRootCategoryId(), $store->getId()));
         $this->urlPersist->replace($this->generateProductUrls($store->getWebsiteId(), $store->getOrigData('website_id'), $store->getId()));
     }
     return $result;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:20,代码来源:View.php


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