本文整理汇总了PHP中Magento\Catalog\Helper\Data::isPriceGlobal方法的典型用法代码示例。如果您正苦于以下问题:PHP Data::isPriceGlobal方法的具体用法?PHP Data::isPriceGlobal怎么用?PHP Data::isPriceGlobal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Catalog\Helper\Data
的用法示例。
在下文中一共展示了Data::isPriceGlobal方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setScope
/**
* Redefine Attribute scope
*
* @param \Magento\Catalog\Model\ResourceModel\Eav\Attribute $attribute
* @return $this
*/
public function setScope($attribute)
{
if ($this->_helper->isPriceGlobal()) {
$attribute->setIsGlobal(ScopedAttributeInterface::SCOPE_GLOBAL);
} else {
$attribute->setIsGlobal(ScopedAttributeInterface::SCOPE_WEBSITE);
}
return $this;
}
示例2: setScope
/**
* Redefine Attribute scope
*
* @param \Magento\Catalog\Model\Resource\Eav\Attribute $attribute
* @return $this
*/
public function setScope($attribute)
{
if ($this->_helper->isPriceGlobal()) {
$attribute->setIsGlobal(\Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_GLOBAL);
} else {
$attribute->setIsGlobal(\Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_WEBSITE);
}
return $this;
}
示例3: afterSave
/**
* Processing object before save data
*
* @return $this
*/
public function afterSave()
{
if (!$this->_catalogData->isPriceGlobal() && $this->getWebsiteId()) {
$this->getResource()->saveSelectionPrice($this);
if (!$this->getDefaultPriceScope()) {
$this->unsSelectionPriceValue();
$this->unsSelectionPriceType();
}
}
parent::afterSave();
}
示例4: build
/**
* {@inheritdoc}
*/
public function build($productId)
{
$linkField = $this->metadataPool->getMetadata(ProductInterface::class)->getLinkField();
$productTable = $this->resource->getTableName('catalog_product_entity');
$priceSelect = $this->resource->getConnection()->select()->from(['parent' => $productTable], '')->joinInner(['link' => $this->resource->getTableName('catalog_product_relation')], "link.parent_id = parent.{$linkField}", [])->joinInner(['child' => $productTable], "child.entity_id = link.child_id", ['entity_id'])->joinInner(['t' => $this->resource->getTableName('catalog_product_entity_tier_price')], "t.{$linkField} = child.{$linkField}", [])->where('parent.entity_id = ? ', $productId)->where('t.all_groups = 1 OR customer_group_id = ?', $this->customerSession->getCustomerGroupId())->where('t.qty = ?', 1)->order('t.value ' . Select::SQL_ASC)->limit(1);
$priceSelectDefault = clone $priceSelect;
$priceSelectDefault->where('t.website_id = ?', self::DEFAULT_WEBSITE_ID);
$select[] = $priceSelectDefault;
if (!$this->catalogHelper->isPriceGlobal()) {
$priceSelect->where('t.website_id = ?', $this->storeManager->getStore()->getWebsiteId());
$select[] = $priceSelect;
}
return $select;
}
示例5: build
/**
* {@inheritdoc}
*/
public function build($productId)
{
$linkField = $this->metadataPool->getMetadata(ProductInterface::class)->getLinkField();
$priceAttribute = $this->eavConfig->getAttribute(Product::ENTITY, 'price');
$productTable = $this->resource->getTableName('catalog_product_entity');
$priceSelect = $this->resource->getConnection()->select()->from(['parent' => $productTable], '')->joinInner(['link' => $this->resource->getTableName('catalog_product_relation')], "link.parent_id = parent.{$linkField}", [])->joinInner(['child' => $productTable], "child.entity_id = link.child_id", ['entity_id'])->joinInner(['t' => $priceAttribute->getBackendTable()], "t.{$linkField} = child.{$linkField}", [])->where('parent.entity_id = ? ', $productId)->where('t.attribute_id = ?', $priceAttribute->getAttributeId())->where('t.value IS NOT NULL')->order('t.value ' . Select::SQL_ASC)->limit(1);
$priceSelectDefault = clone $priceSelect;
$priceSelectDefault->where('t.store_id = ?', Store::DEFAULT_STORE_ID);
$select[] = $priceSelectDefault;
if (!$this->catalogHelper->isPriceGlobal()) {
$priceSelect->where('t.store_id = ?', $this->storeManager->getStore()->getId());
$select[] = $priceSelect;
}
return $select;
}
示例6: saveItemTitleAndPrice
/**
* Save title and price of link item
*
* @param \Magento\Downloadable\Model\Link $linkObject
* @return $this
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
public function saveItemTitleAndPrice($linkObject)
{
$connection = $this->getConnection();
$linkTitleTable = $this->getTable('downloadable_link_title');
$linkPriceTable = $this->getTable('downloadable_link_price');
$select = $connection->select()->from($this->getTable('downloadable_link_title'))->where('link_id=:link_id AND store_id=:store_id');
$bind = [':link_id' => $linkObject->getId(), ':store_id' => (int) $linkObject->getStoreId()];
if ($connection->fetchOne($select, $bind)) {
$where = ['link_id = ?' => $linkObject->getId(), 'store_id = ?' => (int) $linkObject->getStoreId()];
if ($linkObject->getUseDefaultTitle()) {
$connection->delete($linkTitleTable, $where);
} else {
$insertData = ['title' => $linkObject->getTitle()];
$connection->update($linkTitleTable, $insertData, $where);
}
} else {
if (!$linkObject->getUseDefaultTitle()) {
$connection->insert($linkTitleTable, ['link_id' => $linkObject->getId(), 'store_id' => (int) $linkObject->getStoreId(), 'title' => $linkObject->getTitle()]);
}
}
$select = $connection->select()->from($linkPriceTable)->where('link_id=:link_id AND website_id=:website_id');
$bind = [':link_id' => $linkObject->getId(), ':website_id' => (int) $linkObject->getWebsiteId()];
if ($connection->fetchOne($select, $bind)) {
$where = ['link_id = ?' => $linkObject->getId(), 'website_id = ?' => $linkObject->getWebsiteId()];
if ($linkObject->getUseDefaultPrice()) {
$connection->delete($linkPriceTable, $where);
} else {
$connection->update($linkPriceTable, ['price' => $linkObject->getPrice()], $where);
}
} else {
if (!$linkObject->getUseDefaultPrice()) {
$dataToInsert[] = ['link_id' => $linkObject->getId(), 'website_id' => (int) $linkObject->getWebsiteId(), 'price' => (double) $linkObject->getPrice()];
if ($linkObject->getOrigData('link_id') != $linkObject->getLinkId()) {
$_isNew = true;
} else {
$_isNew = false;
}
if ($linkObject->getWebsiteId() == 0 && $_isNew && !$this->_catalogData->isPriceGlobal()) {
$websiteIds = $linkObject->getProductWebsiteIds();
foreach ($websiteIds as $websiteId) {
$baseCurrency = $this->_configuration->getValue(\Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE, 'default');
$websiteCurrency = $this->_storeManager->getWebsite($websiteId)->getBaseCurrencyCode();
if ($websiteCurrency == $baseCurrency) {
continue;
}
$rate = $this->_createCurrency()->load($baseCurrency)->getRate($websiteCurrency);
if (!$rate) {
$rate = 1;
}
$newPrice = $linkObject->getPrice() * $rate;
$dataToInsert[] = ['link_id' => $linkObject->getId(), 'website_id' => (int) $websiteId, 'price' => $newPrice];
}
}
$connection->insertMultiple($linkPriceTable, $dataToInsert);
}
}
return $this;
}
示例7: loadPrices
/**
* Load prices for configurable attribute
*
* @param ConfigurableAttribute $object
* @return $this
*/
protected function loadPrices(ConfigurableAttribute $object)
{
$websiteId = $this->_catalogData->isPriceGlobal() ? 0 : (int) $this->_storeManager->getStore()->getWebsiteId();
$select = $this->_getReadAdapter()->select()->from($this->_priceTable)->where('product_super_attribute_id = ?', $object->getId())->where('website_id = ?', $websiteId);
foreach ($select->query() as $row) {
$data = ['value_index' => $row['value_index'], 'is_percent' => $row['is_percent'], 'pricing_value' => $row['pricing_value']];
$object->addPrice($data);
}
return $this;
}
示例8: build
/**
* {@inheritdoc}
*/
public function build($productId)
{
$linkField = $this->metadataPool->getMetadata(ProductInterface::class)->getLinkField();
$connection = $this->resource->getConnection();
$specialPriceAttribute = $this->eavConfig->getAttribute(Product::ENTITY, 'special_price');
$specialPriceFromDate = $this->eavConfig->getAttribute(Product::ENTITY, 'special_from_date');
$specialPriceToDate = $this->eavConfig->getAttribute(Product::ENTITY, 'special_to_date');
$timestamp = $this->localeDate->scopeTimeStamp($this->storeManager->getStore());
$currentDate = $this->dateTime->formatDate($timestamp, false);
$productTable = $this->resource->getTableName('catalog_product_entity');
$specialPrice = $this->resource->getConnection()->select()->from(['parent' => $productTable], '')->joinInner(['link' => $this->resource->getTableName('catalog_product_relation')], "link.parent_id = parent.{$linkField}", [])->joinInner(['child' => $productTable], "child.entity_id = link.child_id", ['entity_id'])->joinInner(['t' => $specialPriceAttribute->getBackendTable()], "t.{$linkField} = child.{$linkField}", [])->joinLeft(['special_from' => $specialPriceFromDate->getBackendTable()], $connection->quoteInto("t.{$linkField} = special_from.{$linkField} AND special_from.attribute_id = ?", $specialPriceFromDate->getAttributeId()), '')->joinLeft(['special_to' => $specialPriceToDate->getBackendTable()], $connection->quoteInto("t.{$linkField} = special_to.{$linkField} AND special_to.attribute_id = ?", $specialPriceToDate->getAttributeId()), '')->where('parent.entity_id = ? ', $productId)->where('t.attribute_id = ?', $specialPriceAttribute->getAttributeId())->where('t.value IS NOT NULL')->where('special_from.value IS NULL OR ' . $connection->getDatePartSql('special_from.value') . ' <= ?', $currentDate)->where('special_to.value IS NULL OR ' . $connection->getDatePartSql('special_to.value') . ' >= ?', $currentDate)->order('t.value ' . Select::SQL_ASC)->limit(1);
$specialPriceDefault = clone $specialPrice;
$specialPriceDefault->where('t.store_id = ?', Store::DEFAULT_STORE_ID);
$select[] = $specialPriceDefault;
if (!$this->catalogHelper->isPriceGlobal()) {
$specialPrice->where('t.store_id = ?', $this->storeManager->getStore()->getId());
$select[] = $specialPrice;
}
return $select;
}
示例9: getSelectionsByIds
/**
* Retrieve bundle selections collection based on ids
*
* @param array $selectionIds
* @param \Magento\Catalog\Model\Product $product
* @return \Magento\Bundle\Model\ResourceModel\Selection\Collection
*/
public function getSelectionsByIds($selectionIds, $product)
{
sort($selectionIds);
$usedSelections = $product->getData($this->_keyUsedSelections);
$usedSelectionsIds = $product->getData($this->_keyUsedSelectionsIds);
if (!$usedSelections || $usedSelectionsIds !== $selectionIds) {
$storeId = $product->getStoreId();
$usedSelections = $this->_bundleCollection->create()->addAttributeToSelect('*')->setFlag('require_stock_items', true)->setFlag('product_children', true)->addStoreFilter($this->getStoreFilter($product))->setStoreId($storeId)->setPositionOrder()->addFilterByRequiredOptions()->setSelectionIdsFilter($selectionIds);
if (!$this->_catalogData->isPriceGlobal() && $storeId) {
$websiteId = $this->_storeManager->getStore($storeId)->getWebsiteId();
$usedSelections->joinPrices($websiteId);
}
$product->setData($this->_keyUsedSelections, $usedSelections);
$product->setData($this->_keyUsedSelectionsIds, $selectionIds);
}
return $usedSelections;
}
示例10: getSelectionsByIds
/**
* Retrieve bundle selections collection based on ids
*
* @param array $selectionIds
* @param \Magento\Catalog\Model\Product $product
* @return \Magento\Bundle\Model\ResourceModel\Selection\Collection
*/
public function getSelectionsByIds($selectionIds, $product)
{
sort($selectionIds);
$usedSelections = $product->getData($this->_keyUsedSelections);
$usedSelectionsIds = $product->getData($this->_keyUsedSelectionsIds);
if (!$usedSelections || $usedSelectionsIds !== $selectionIds) {
$storeId = $product->getStoreId();
$usedSelections = $this->_bundleCollection->create()->addAttributeToSelect('*')->setFlag('require_stock_items', true)->setFlag('product_children', true)->addStoreFilter($this->getStoreFilter($product))->setStoreId($storeId)->setPositionOrder()->addFilterByRequiredOptions()->setSelectionIdsFilter($selectionIds);
if (count($usedSelections->getItems()) !== count($selectionIds)) {
throw new \Magento\Framework\Exception\LocalizedException(__('The options you selected are not available.'));
}
if (!$this->_catalogData->isPriceGlobal() && $storeId) {
$websiteId = $this->_storeManager->getStore($storeId)->getWebsiteId();
$usedSelections->joinPrices($websiteId);
}
$product->setData($this->_keyUsedSelections, $usedSelections);
$product->setData($this->_keyUsedSelectionsIds, $selectionIds);
}
return $usedSelections;
}
示例11: getWebSiteId
/**
* Get website id by code
*
* @param string $websiteCode
* @return array|int|string
*/
protected function getWebSiteId($websiteCode)
{
$result = $websiteCode == $this->_getValidator(self::VALIDATOR_WEBSITE)->getAllWebsitesValue() || $this->_catalogData->isPriceGlobal() ? 0 : $this->_storeResolver->getWebsiteCodeToId($websiteCode);
return $result;
}
示例12: _saveProducts
/**
* Gather and save information about product entities.
*
* @return $this
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings(PHPMD.NPathComplexity)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.UnusedLocalVariable)
*/
protected function _saveProducts()
{
/** @var $resource \Magento\CatalogImportExport\Model\Import\Proxy\Product\ResourceModel */
$resource = $this->_resourceFactory->create();
$priceIsGlobal = $this->_catalogData->isPriceGlobal();
$productLimit = null;
$productsQty = null;
while ($bunch = $this->_dataSourceModel->getNextBunch()) {
$entityRowsIn = [];
$entityRowsUp = [];
$attributes = [];
$this->websitesCache = [];
$this->categoriesCache = [];
$tierPrices = [];
$mediaGallery = [];
$uploadedGalleryFiles = [];
$previousType = null;
$prevAttributeSet = null;
$allImagesFromBunch = $this->_getAllBunchImages($bunch);
$existingImages = $this->_prepareAllMediaFiles($allImagesFromBunch);
foreach ($bunch as $rowNum => $rowData) {
if (!$this->validateRow($rowData, $rowNum)) {
continue;
}
if ($this->getErrorAggregator()->hasToBeTerminated()) {
$this->getErrorAggregator()->addRowToSkip($rowNum);
continue;
}
$rowScope = $this->getRowScope($rowData);
$rowSku = $rowData[self::COL_SKU];
if (null === $rowSku) {
$this->getErrorAggregator()->addRowToSkip($rowNum);
continue;
} elseif (self::SCOPE_STORE == $rowScope) {
// set necessary data from SCOPE_DEFAULT row
$rowData[self::COL_TYPE] = $this->skuProcessor->getNewSku($rowSku)['type_id'];
$rowData['attribute_set_id'] = $this->skuProcessor->getNewSku($rowSku)['attr_set_id'];
$rowData[self::COL_ATTR_SET] = $this->skuProcessor->getNewSku($rowSku)['attr_set_code'];
}
// 1. Entity phase
if (isset($this->_oldSku[$rowSku])) {
// existing row
$entityRowsUp[] = ['updated_at' => (new \DateTime())->format(DateTime::DATETIME_PHP_FORMAT), 'entity_id' => $this->_oldSku[$rowSku]['entity_id']];
} else {
if (!$productLimit || $productsQty < $productLimit) {
$entityRowsIn[$rowSku] = ['attribute_set_id' => $this->skuProcessor->getNewSku($rowSku)['attr_set_id'], 'type_id' => $this->skuProcessor->getNewSku($rowSku)['type_id'], 'sku' => $rowSku, 'has_options' => isset($rowData['has_options']) ? $rowData['has_options'] : 0, 'created_at' => (new \DateTime())->format(DateTime::DATETIME_PHP_FORMAT), 'updated_at' => (new \DateTime())->format(DateTime::DATETIME_PHP_FORMAT)];
$productsQty++;
} else {
$rowSku = null;
// sign for child rows to be skipped
$this->getErrorAggregator()->addRowToSkip($rowNum);
continue;
}
}
$this->websitesCache[$rowSku] = [];
// 2. Product-to-Website phase
if (!empty($rowData[self::COL_PRODUCT_WEBSITES])) {
$websiteCodes = explode($this->getMultipleValueSeparator(), $rowData[self::COL_PRODUCT_WEBSITES]);
foreach ($websiteCodes as $websiteCode) {
$websiteId = $this->storeResolver->getWebsiteCodeToId($websiteCode);
$this->websitesCache[$rowSku][$websiteId] = true;
}
}
// 3. Categories phase
$categoriesString = empty($rowData[self::COL_CATEGORY]) ? '' : $rowData[self::COL_CATEGORY];
$this->categoriesCache[$rowSku] = [];
if (!empty($categoriesString)) {
foreach ($this->categoryProcessor->upsertCategories($categoriesString) as $categoryId) {
$this->categoriesCache[$rowSku][$categoryId] = true;
}
}
// 4.1. Tier prices phase
if (!empty($rowData['_tier_price_website'])) {
$tierPrices[$rowSku][] = ['all_groups' => $rowData['_tier_price_customer_group'] == self::VALUE_ALL, 'customer_group_id' => $rowData['_tier_price_customer_group'] == self::VALUE_ALL ? 0 : $rowData['_tier_price_customer_group'], 'qty' => $rowData['_tier_price_qty'], 'value' => $rowData['_tier_price_price'], 'website_id' => self::VALUE_ALL == $rowData['_tier_price_website'] || $priceIsGlobal ? 0 : $this->storeResolver->getWebsiteCodeToId($rowData['_tier_price_website'])];
}
if (!$this->validateRow($rowData, $rowNum)) {
continue;
}
// 5. Media gallery phase
$mediaGalleryImages = array();
$mediaGalleryLabels = array();
if (!empty($rowData[self::COL_MEDIA_IMAGE])) {
$mediaGalleryImages = explode($this->getMultipleValueSeparator(), $rowData[self::COL_MEDIA_IMAGE]);
if (isset($rowData['_media_image_label'])) {
$mediaGalleryLabels = explode($this->getMultipleValueSeparator(), $rowData['_media_image_label']);
} else {
$mediaGalleryLabels = [];
}
if (count($mediaGalleryLabels) > count($mediaGalleryImages)) {
$mediaGalleryLabels = array_slice($mediaGalleryLabels, 0, count($mediaGalleryImages));
} elseif (count($mediaGalleryLabels) < count($mediaGalleryImages)) {
//.........这里部分代码省略.........
示例13: _loadPrices
/**
* Load attribute prices information
*
* @return $this
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings(PHPMD.NPathComplexity)
*/
protected function _loadPrices()
{
if ($this->count()) {
$pricings = array(0 => array());
if ($this->_catalogData->isPriceGlobal()) {
$websiteId = 0;
} else {
$websiteId = (int) $this->_storeManager->getStore($this->getStoreId())->getWebsiteId();
$pricing[$websiteId] = array();
}
$select = $this->getConnection()->select()->from(array('price' => $this->_priceTable))->where('price.product_super_attribute_id IN (?)', array_keys($this->_items));
if ($websiteId > 0) {
$select->where('price.website_id IN(?)', array(0, $websiteId));
} else {
$select->where('price.website_id = ?', 0);
}
$query = $this->getConnection()->query($select);
while ($row = $query->fetch()) {
$pricings[(int) $row['website_id']][] = $row;
}
$values = array();
$usedProducts = $this->getProductType()->getUsedProducts($this->getProduct());
if ($usedProducts) {
foreach ($this->_items as $item) {
$productAttribute = $item->getProductAttribute();
if (!$productAttribute instanceof \Magento\Eav\Model\Entity\Attribute\AbstractAttribute) {
continue;
}
$itemId = $item->getId();
$options = $productAttribute->getFrontend()->getSelectOptions();
foreach ($options as $option) {
foreach ($usedProducts as $associatedProduct) {
$attributeCodeValue = $associatedProduct->getData($productAttribute->getAttributeCode());
if (!empty($option['value']) && $option['value'] == $attributeCodeValue) {
// If option available in associated product
if (!isset($values[$item->getId() . ':' . $option['value']])) {
$values[$itemId . ':' . $option['value']] = array('product_super_attribute_id' => $itemId, 'value_index' => $option['value'], 'label' => $option['label'], 'default_label' => $option['label'], 'store_label' => $option['label'], 'is_percent' => 0, 'pricing_value' => null, 'use_default_value' => true);
}
}
}
}
}
}
foreach ($pricings[0] as $pricing) {
// Addding pricing to options
$valueKey = $pricing['product_super_attribute_id'] . ':' . $pricing['value_index'];
if (isset($values[$valueKey])) {
$values[$valueKey]['pricing_value'] = $pricing['pricing_value'];
$values[$valueKey]['is_percent'] = $pricing['is_percent'];
$values[$valueKey]['value_id'] = $pricing['value_id'];
$values[$valueKey]['use_default_value'] = true;
}
}
if ($websiteId && isset($pricings[$websiteId])) {
foreach ($pricings[$websiteId] as $pricing) {
$valueKey = $pricing['product_super_attribute_id'] . ':' . $pricing['value_index'];
if (isset($values[$valueKey])) {
$values[$valueKey]['pricing_value'] = $pricing['pricing_value'];
$values[$valueKey]['is_percent'] = $pricing['is_percent'];
$values[$valueKey]['value_id'] = $pricing['value_id'];
$values[$valueKey]['use_default_value'] = false;
}
}
}
foreach ($values as $data) {
$this->getItemById($data['product_super_attribute_id'])->addPrice($data);
}
}
return $this;
}
示例14: _saveProducts
/**
* Gather and save information about product entities.
*
* @return $this
*/
protected function _saveProducts()
{
/** @var $resource \Magento\CatalogImportExport\Model\Import\Proxy\Product\Resource */
$resource = $this->_resourceFactory->create();
$priceIsGlobal = $this->_catalogData->isPriceGlobal();
$productLimit = null;
$productsQty = null;
while ($bunch = $this->_dataSourceModel->getNextBunch()) {
$entityRowsIn = array();
$entityRowsUp = array();
$attributes = array();
$websites = array();
$categories = array();
$tierPrices = array();
$groupPrices = array();
$mediaGallery = array();
$uploadedGalleryFiles = array();
$previousType = null;
$prevAttributeSet = null;
foreach ($bunch as $rowNum => $rowData) {
if (!$this->validateRow($rowData, $rowNum)) {
continue;
}
$rowScope = $this->getRowScope($rowData);
if (self::SCOPE_DEFAULT == $rowScope) {
$rowSku = $rowData[self::COL_SKU];
// 1. Entity phase
if (isset($this->_oldSku[$rowSku])) {
// existing row
$entityRowsUp[] = array('updated_at' => $this->dateTime->now(), 'entity_id' => $this->_oldSku[$rowSku]['entity_id']);
} else {
// new row
if (!$productLimit || $productsQty < $productLimit) {
$entityRowsIn[$rowSku] = array('entity_type_id' => $this->_entityTypeId, 'attribute_set_id' => $this->_newSku[$rowSku]['attr_set_id'], 'type_id' => $this->_newSku[$rowSku]['type_id'], 'sku' => $rowSku, 'has_options' => isset($rowData['has_options']) ? $rowData['has_options'] : 0, 'created_at' => $this->dateTime->now(), 'updated_at' => $this->dateTime->now());
$productsQty++;
} else {
$rowSku = null;
// sign for child rows to be skipped
$this->_rowsToSkip[$rowNum] = true;
continue;
}
}
} elseif (null === $rowSku) {
$this->_rowsToSkip[$rowNum] = true;
// skip rows when SKU is NULL
continue;
} elseif (self::SCOPE_STORE == $rowScope) {
// set necessary data from SCOPE_DEFAULT row
$rowData[self::COL_TYPE] = $this->_newSku[$rowSku]['type_id'];
$rowData['attribute_set_id'] = $this->_newSku[$rowSku]['attr_set_id'];
$rowData[self::COL_ATTR_SET] = $this->_newSku[$rowSku]['attr_set_code'];
}
// 2. Product-to-Website phase
if (!empty($rowData['_product_websites'])) {
$websites[$rowSku][$this->_websiteCodeToId[$rowData['_product_websites']]] = true;
}
// 3. Categories phase
$categoryPath = empty($rowData[self::COL_CATEGORY]) ? '' : $rowData[self::COL_CATEGORY];
if (!empty($rowData[self::COL_ROOT_CATEGORY])) {
$categoryId = $this->_categoriesWithRoots[$rowData[self::COL_ROOT_CATEGORY]][$categoryPath];
$categories[$rowSku][$categoryId] = true;
} elseif (!empty($categoryPath)) {
$categories[$rowSku][$this->_categories[$categoryPath]] = true;
}
// 4.1. Tier prices phase
if (!empty($rowData['_tier_price_website'])) {
$tierPrices[$rowSku][] = array('all_groups' => $rowData['_tier_price_customer_group'] == self::VALUE_ALL, 'customer_group_id' => $rowData['_tier_price_customer_group'] == self::VALUE_ALL ? 0 : $rowData['_tier_price_customer_group'], 'qty' => $rowData['_tier_price_qty'], 'value' => $rowData['_tier_price_price'], 'website_id' => self::VALUE_ALL == $rowData['_tier_price_website'] || $priceIsGlobal ? 0 : $this->_websiteCodeToId[$rowData['_tier_price_website']]);
}
// 4.2. Group prices phase
if (!empty($rowData['_group_price_website'])) {
$groupPrices[$rowSku][] = array('all_groups' => $rowData['_group_price_customer_group'] == self::VALUE_ALL, 'customer_group_id' => $rowData['_group_price_customer_group'] == self::VALUE_ALL ? 0 : $rowData['_group_price_customer_group'], 'value' => $rowData['_group_price_price'], 'website_id' => self::VALUE_ALL == $rowData['_group_price_website'] || $priceIsGlobal ? 0 : $this->_websiteCodeToId[$rowData['_group_price_website']]);
}
// 5. Media gallery phase
foreach ($this->_imagesArrayKeys as $imageCol) {
if (!empty($rowData[$imageCol])) {
if (!array_key_exists($rowData[$imageCol], $uploadedGalleryFiles)) {
$uploadedGalleryFiles[$rowData[$imageCol]] = $this->_uploadMediaFiles($rowData[$imageCol]);
}
$rowData[$imageCol] = $uploadedGalleryFiles[$rowData[$imageCol]];
}
}
if (!empty($rowData['_media_image'])) {
$mediaGallery[$rowSku][] = array('attribute_id' => $rowData['_media_attribute_id'], 'label' => $rowData['_media_label'], 'position' => $rowData['_media_position'], 'disabled' => $rowData['_media_is_disabled'], 'value' => $rowData['_media_image']);
}
// 6. Attributes phase
$rowStore = self::SCOPE_STORE == $rowScope ? $this->_storeCodeToId[$rowData[self::COL_STORE]] : 0;
$productType = isset($rowData[self::COL_TYPE]) ? $rowData[self::COL_TYPE] : null;
if (!is_null($productType)) {
$previousType = $productType;
}
if (isset($rowData[self::COL_ATTR_SET])) {
$prevAttributeSet = $rowData[self::COL_ATTR_SET];
}
if (self::SCOPE_NULL == $rowScope) {
// for multiselect attributes only
//.........这里部分代码省略.........
示例15: isAttributesPricesReadonly
/**
* Check whether prices of configurable products can be editable
*
* @return bool
*/
public function isAttributesPricesReadonly()
{
return $this->getProduct()->getAttributesConfigurationReadonly() || $this->_catalogData->isPriceGlobal() && $this->isReadonly();
}