當前位置: 首頁>>代碼示例>>PHP>>正文


PHP AbstractAttribute::isScopeGlobal方法代碼示例

本文整理匯總了PHP中Magento\Eav\Model\Entity\Attribute\AbstractAttribute::isScopeGlobal方法的典型用法代碼示例。如果您正苦於以下問題:PHP AbstractAttribute::isScopeGlobal方法的具體用法?PHP AbstractAttribute::isScopeGlobal怎麽用?PHP AbstractAttribute::isScopeGlobal使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Magento\Eav\Model\Entity\Attribute\AbstractAttribute的用法示例。


在下文中一共展示了AbstractAttribute::isScopeGlobal方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getScopeValue

 /**
  * @param ScopeInterface $scope
  * @param AbstractAttribute $attribute
  * @param bool $useDefault
  * @return string
  */
 protected function getScopeValue(ScopeInterface $scope, AbstractAttribute $attribute, $useDefault = false)
 {
     if ($attribute instanceof CatalogEavAttribute) {
         $useDefault = $useDefault || $attribute->isScopeGlobal();
     }
     return parent::getScopeValue($scope, $attribute, $useDefault);
 }
開發者ID:Doability,項目名稱:magento2dev,代碼行數:13,代碼來源:AttributePersistor.php

示例2: deleteProductData

 /**
  * Delete product data
  *
  * @param \Magento\Catalog\Model\Product $product
  * @param \Magento\Eav\Model\Entity\Attribute\AbstractAttribute $attribute
  * @return $this
  */
 public function deleteProductData($product, $attribute)
 {
     $where = ['entity_id = ?' => (int) $product->getId(), 'attribute_id = ?' => (int) $attribute->getId()];
     $connection = $this->getConnection();
     if (!$attribute->isScopeGlobal()) {
         $storeId = $product->getStoreId();
         if ($storeId) {
             $where['website_id IN(?)'] = [0, $this->_storeManager->getStore($storeId)->getWebsiteId()];
         }
     }
     $connection->delete($this->getMainTable(), $where);
     return $this;
 }
開發者ID:kidaa30,項目名稱:magento2-platformsh,代碼行數:20,代碼來源:Tax.php

示例3: createMetadataAttribute

 /**
  * @param  AbstractAttribute $attribute
  * @return Data\Eav\AttributeMetadata
  */
 private function createMetadataAttribute($attribute)
 {
     $data = $this->booleanPrefixMapper($attribute->getData());
     // fill options and validate rules
     $data[AttributeMetadata::OPTIONS] = $attribute->usesSource() ? $attribute->getSource()->getAllOptions() : array();
     $data[AttributeMetadata::VALIDATION_RULES] = $attribute->getValidateRules();
     // fill scope
     $data[AttributeMetadata::SCOPE] = $attribute->isScopeGlobal() ? 'global' : ($attribute->isScopeWebsite() ? 'website' : 'store');
     $data[AttributeMetadata::FRONTEND_LABEL] = [];
     $data[AttributeMetadata::FRONTEND_LABEL][0] = array(FrontendLabel::STORE_ID => 0, FrontendLabel::LABEL => $attribute->getFrontendLabel());
     if (is_array($attribute->getStoreLabels())) {
         foreach ($attribute->getStoreLabels() as $storeId => $label) {
             $data[AttributeMetadata::FRONTEND_LABEL][$storeId] = array(FrontendLabel::STORE_ID => $storeId, FrontendLabel::LABEL => $label);
         }
     }
     return $this->attributeMetadataBuilder->populateWithArray($data)->create();
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:21,代碼來源:MetadataService.php

示例4: deleteProductData

 /**
  * Delete product data
  *
  * @param \Magento\Catalog\Model\Product $product
  * @param \Magento\Eav\Model\Entity\Attribute\AbstractAttribute $attribute
  * @return $this
  */
 public function deleteProductData($product, $attribute)
 {
     $where = array('entity_id = ?' => (int) $product->getId(), 'attribute_id = ?' => (int) $attribute->getId());
     $adapter = $this->_getWriteAdapter();
     if (!$attribute->isScopeGlobal()) {
         $storeId = $product->getStoreId();
         if ($storeId) {
             $where['website_id IN(?)'] = array(0, $this->_storeManager->getStore($storeId)->getWebsiteId());
         }
     }
     $adapter->delete($this->getMainTable(), $where);
     return $this;
 }
開發者ID:pavelnovitsky,項目名稱:magento2,代碼行數:20,代碼來源:Tax.php


注:本文中的Magento\Eav\Model\Entity\Attribute\AbstractAttribute::isScopeGlobal方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。