• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Helper\Data类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Magento\Catalog\Helper\Data的典型用法代码示例。如果您正苦于以下问题:PHP Data类的具体用法?PHP Data怎么用?PHP Data使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: _prepareLayout

 /**
  * Load Wysiwyg on demand and prepare layout
  *
  * @return void
  */
 protected function _prepareLayout()
 {
     parent::_prepareLayout();
     if ($this->_catalogData->isModuleEnabled('Magento_Cms') && $this->_wysiwygConfig->isEnabled()) {
         $this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
     }
 }
开发者ID:aiesh,项目名称:magento2,代码行数:12,代码来源:Attributes.php


示例2: 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();
 }
开发者ID:opexsw,项目名称:magento2,代码行数:16,代码来源:Selection.php


示例3: _prepareCollection

 /**
  * @return Grid
  */
 protected function _prepareCollection()
 {
     $productId = $this->getRequest()->getParam('id');
     $websiteId = 0;
     if ($store = $this->getRequest()->getParam('store')) {
         $websiteId = $this->_storeManager->getStore($store)->getWebsiteId();
     }
     if ($this->_catalogData->isModuleEnabled('Magento_ProductAlert')) {
         $collection = $this->_priceFactory->create()->getCustomerCollection()->join($productId, $websiteId);
         $this->setCollection($collection);
     }
     return parent::_prepareCollection();
 }
开发者ID:aiesh,项目名称:magento2,代码行数:16,代码来源:Price.php


示例4: setUp

 protected function setUp()
 {
     $this->_helper = $this->getMock('Magento\\Catalog\\Helper\\Data', array('isPriceGlobal'), array(), '', false);
     $this->_helper->expects($this->any())->method('isPriceGlobal')->will($this->returnValue(true));
     $loggerMock = $this->getMock('Magento\\Framework\\Logger', array(), array(), '', false);
     $currencyFactoryMock = $this->getMock('Magento\\Directory\\Model\\CurrencyFactory', array(), array(), '', false);
     $storeManagerMock = $this->getMock('Magento\\Framework\\StoreManagerInterface', array(), array(), '', false);
     $productTypeMock = $this->getMock('Magento\\Catalog\\Model\\Product\\Type', array(), array(), '', false);
     $configMock = $this->getMock('Magento\\Framework\\App\\Config\\ScopeConfigInterface');
     $this->_model = $this->getMockForAbstractClass('Magento\\Catalog\\Model\\Product\\Attribute\\Backend\\Groupprice\\AbstractGroupprice', array('logger' => $loggerMock, 'currencyFactory' => $currencyFactoryMock, 'storeManager' => $storeManagerMock, 'catalogData' => $this->_helper, 'config' => $configMock, 'catalogProductType' => $productTypeMock));
     $resource = $this->getMock('StdClass', array('getMainTable'));
     $resource->expects($this->any())->method('getMainTable')->will($this->returnValue('table'));
     $this->_model->expects($this->any())->method('_getResource')->will($this->returnValue($resource));
 }
开发者ID:buskamuza,项目名称:magento2-skeleton,代码行数:14,代码来源:AbstractTest.php


示例5: _prepareLayout

 /**
  * Preparing layout
  *
  * @return \Magento\Catalog\Block\Breadcrumbs
  */
 protected function _prepareLayout()
 {
     if ($breadcrumbsBlock = $this->getLayout()->getBlock('breadcrumbs')) {
         $breadcrumbsBlock->addCrumb('home', ['label' => __('Home'), 'title' => __('Go to Home Page'), 'link' => $this->_storeManager->getStore()->getBaseUrl()]);
         $title = [];
         $path = $this->_catalogData->getBreadcrumbPath();
         foreach ($path as $name => $breadcrumb) {
             $breadcrumbsBlock->addCrumb($name, $breadcrumb);
             $title[] = $breadcrumb['label'];
         }
         $this->pageConfig->getTitle()->set(join($this->getTitleSeparator(), array_reverse($title)));
     }
     return parent::_prepareLayout();
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:19,代码来源:Breadcrumbs.php


示例6: execute

 /**
  * Set Quote information about MSRP price enabled
  *
  * @param \Magento\Framework\Event\Observer $observer
  * @return void
  */
 public function execute(\Magento\Framework\Event\Observer $observer)
 {
     /** @var $quote \Magento\Sales\Model\Quote */
     $quote = $observer->getEvent()->getQuote();
     $canApplyMsrp = false;
     if ($this->catalogData->isMsrpEnabled()) {
         foreach ($quote->getAllAddresses() as $address) {
             if ($address->getCanApplyMsrp()) {
                 $canApplyMsrp = true;
                 break;
             }
         }
     }
     $quote->setCanApplyMsrp($canApplyMsrp);
 }
开发者ID:pavelnovitsky,项目名称:magento2,代码行数:21,代码来源:SetCanApplyMsrp.php


示例7: canApplyMsrp

 /**
  * Check if can apply msrp to totals
  *
  * @return bool
  */
 public function canApplyMsrp()
 {
     if (!$this->getQuote()->hasCanApplyMsrp() && $this->_catalogData->isMsrpEnabled()) {
         $this->getQuote()->collectTotals();
     }
     return $this->getQuote()->getCanApplyMsrp();
 }
开发者ID:aiesh,项目名称:magento2,代码行数:12,代码来源:AbstractCart.php


示例8: getItems

 /**
  * {@inheritdoc}
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  */
 public function getItems()
 {
     Profiler::start(__METHOD__);
     $items = [];
     /** @var \Magento\Catalog\Model\Product $product */
     foreach ($this->collection as $product) {
         $item = ['sku' => $product->getSku(), 'name' => $product->getName(), 'url' => $product->getProductUrl(), 'description' => null, 'image' => null, 'price' => null, 'rating' => null];
         if ($this->config->isShowShortDescription()) {
             $item['description'] = html_entity_decode(strip_tags($product->getDataUsingMethod('description')));
         }
         $image = false;
         if ($product->getImage() && $product->getImage() != 'no_selection') {
             $image = $product->getImage();
         } elseif ($product->getSmallImage() && $product->getSmallImage() != 'no_selection') {
             $image = $product->getSmallImage();
         }
         if ($this->config->isShowImage() && $image) {
             $item['image'] = $this->imageHelper->init($product, false)->setImageFile($image)->resize(65 * 2, 80 * 2)->getUrl();
         }
         if ($this->config->isShowPrice()) {
             $item['price'] = $this->catalogHelper->getTaxPrice($product, $product->getFinalPrice());
             $item['price'] = $this->pricingHelper->currency($item['price'], false, false);
         }
         if ($this->config->isShowRating()) {
             $item['rating'] = $this->reviewRenderer->getReviewsSummaryHtml($product, ReviewRendererInterface::SHORT_VIEW);
         }
         $items[] = $item;
     }
     Profiler::stop(__METHOD__);
     return $items;
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:35,代码来源:Product.php


示例9: beforeSave

 /**
  * Disable MAP if it's bundle with dynamic price type
  *
  * @param \Magento\Catalog\Model\Product $product
  * @return $this
  */
 public function beforeSave($product)
 {
     if (!$product instanceof \Magento\Catalog\Model\Product || $product->getTypeId() != \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE || $product->getPriceType() != \Magento\Bundle\Model\Product\Price::PRICE_TYPE_DYNAMIC) {
         return parent::beforeSave($product);
     }
     parent::beforeSave($product);
     $attributeCode = $this->getAttribute()->getName();
     $value = $product->getData($attributeCode);
     if (empty($value)) {
         $value = $this->_catalogData->isMsrpApplyToAll();
     }
     if ($value) {
         $product->setData($attributeCode, 0);
     }
     return $this;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:22,代码来源:Msrp.php


示例10: setUp

 protected function setUp()
 {
     $this->_helper = $this->getMock('Magento\\Catalog\\Helper\\Data', ['isPriceGlobal'], [], '', false);
     $this->_helper->expects($this->any())->method('isPriceGlobal')->will($this->returnValue(true));
     $currencyFactoryMock = $this->getMock('Magento\\Directory\\Model\\CurrencyFactory', ['create'], [], '', false);
     $storeManagerMock = $this->getMock('Magento\\Store\\Model\\StoreManagerInterface', [], [], '', false);
     $productTypeMock = $this->getMock('Magento\\Catalog\\Model\\Product\\Type', [], [], '', false);
     $configMock = $this->getMock('Magento\\Framework\\App\\Config\\ScopeConfigInterface');
     $localeFormatMock = $this->getMock('\\Magento\\Framework\\Locale\\FormatInterface', [], [], '', false);
     $groupManagement = $this->getMock('Magento\\Customer\\Api\\GroupManagementInterface', [], [], '', false);
     $metadataPool = $this->getMock('Magento\\Framework\\Model\\Entity\\MetadataPool', [], [], '', false);
     $this->_model = $this->getMockForAbstractClass('Magento\\Catalog\\Model\\Product\\Attribute\\Backend\\GroupPrice\\AbstractGroupPrice', ['currencyFactory' => $currencyFactoryMock, 'storeManager' => $storeManagerMock, 'catalogData' => $this->_helper, 'config' => $configMock, 'localeFormat' => $localeFormatMock, 'catalogProductType' => $productTypeMock, 'groupManagement' => $groupManagement, 'metadataPool' => $metadataPool]);
     $resource = $this->getMock('StdClass', ['getMainTable']);
     $resource->expects($this->any())->method('getMainTable')->will($this->returnValue('table'));
     $this->_model->expects($this->any())->method('_getResource')->will($this->returnValue($resource));
 }
开发者ID:koliaGI,项目名称:magento2,代码行数:16,代码来源:AbstractTest.php


示例11: getStockOption

 /**
  * Retrieve stock option array
  *
  * @return array
  */
 public function getStockOption()
 {
     if ($this->catalogData->isModuleEnabled('Magento_CatalogInventory')) {
         return $this->stock->toOptionArray();
     }
     return array();
 }
开发者ID:aiesh,项目名称:magento2,代码行数:12,代码来源:Inventory.php


示例12: _prepareColumns

 /**
  * @return $this
  */
 protected function _prepareColumns()
 {
     $this->addColumn('entity_id', array('header' => __('ID'), 'type' => 'number', 'index' => 'entity_id', 'header_css_class' => 'col-id', 'column_css_class' => 'col-id'));
     $this->addColumn('name', array('header' => __('Name'), 'index' => 'name', 'class' => 'xxx'));
     $store = $this->_getStore();
     if ($store->getId()) {
         $this->addColumn('custom_name', array('header' => __('Name in %1', $store->getName()), 'index' => 'custom_name', 'header_css_class' => 'col-name', 'column_css_class' => 'col-name'));
     }
     $this->addColumn('type', array('header' => __('Type'), 'index' => 'type_id', 'type' => 'options', 'options' => $this->_type->getOptionArray()));
     $sets = $this->_setsFactory->create()->setEntityTypeFilter($this->_productFactory->create()->getResource()->getTypeId())->load()->toOptionHash();
     $this->addColumn('set_name', array('header' => __('Attribute Set'), 'index' => 'attribute_set_id', 'type' => 'options', 'options' => $sets, 'header_css_class' => 'col-attr-name', 'column_css_class' => 'col-attr-name'));
     $this->addColumn('sku', array('header' => __('SKU'), 'index' => 'sku'));
     $store = $this->_getStore();
     $this->addColumn('price', array('header' => __('Price'), 'type' => 'price', 'currency_code' => $store->getBaseCurrency()->getCode(), 'index' => 'price', 'header_css_class' => 'col-price', 'column_css_class' => 'col-price'));
     if ($this->_catalogData->isModuleEnabled('Magento_CatalogInventory')) {
         $this->addColumn('qty', array('header' => __('Quantity'), 'type' => 'number', 'index' => 'qty'));
     }
     $this->addColumn('visibility', array('header' => __('Visibility'), 'index' => 'visibility', 'type' => 'options', 'options' => $this->_visibility->getOptionArray(), 'header_css_class' => 'col-visibility', 'column_css_class' => 'col-visibility'));
     $this->addColumn('status', array('header' => __('Status'), 'index' => 'status', 'type' => 'options', 'options' => $this->_status->getOptionArray()));
     if (!$this->_storeManager->isSingleStoreMode()) {
         $this->addColumn('websites', array('header' => __('Websites'), 'sortable' => false, 'index' => 'websites', 'type' => 'options', 'options' => $this->_websiteFactory->create()->getCollection()->toOptionHash(), 'header_css_class' => 'col-websites', 'column_css_class' => 'col-websites'));
     }
     $this->addColumn('edit', array('header' => __('Edit'), 'type' => 'action', 'getter' => 'getId', 'actions' => array(array('caption' => __('Edit'), 'url' => array('base' => '*/*/edit', 'params' => array('store' => $this->getRequest()->getParam('store'))), 'field' => 'id')), 'filter' => false, 'sortable' => false, 'index' => 'stores', 'header_css_class' => 'col-action', 'column_css_class' => 'col-action'));
     if ($this->_catalogData->isModuleEnabled('Magento_Rss')) {
         $this->addRssList('rss/catalog/notifystock', __('Notify Low Stock RSS'));
     }
     return parent::_prepareColumns();
 }
开发者ID:aiesh,项目名称:magento2,代码行数:31,代码来源:Grid.php


示例13: collect

 /**
  * Collect information about MSRP price enabled
  *
  * @param  \Magento\Sales\Model\Quote\Address $address
  * @return $this
  */
 public function collect(\Magento\Sales\Model\Quote\Address $address)
 {
     parent::collect($address);
     $items = $this->_getAddressItems($address);
     if (!count($items)) {
         return $this;
     }
     $canApplyMsrp = false;
     foreach ($items as $item) {
         if (!$item->getParentItemId() && $this->_catalogData->canApplyMsrp($item->getProductId(), \Magento\Catalog\Model\Product\Attribute\Source\Msrp\Type::TYPE_BEFORE_ORDER_CONFIRM, true)) {
             $canApplyMsrp = true;
             break;
         }
     }
     $address->setCanApplyMsrp($canApplyMsrp);
     return $this;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:23,代码来源:Msrp.php


示例14: 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;
 }
开发者ID:whoople,项目名称:magento2-testing,代码行数:65,代码来源:Link.php


示例15: testSavePrices

 public function testSavePrices()
 {
     $rowSet = [0 => ['value_id' => '1', 'product_super_attribute_id' => '1', 'value_index' => '12', 'is_percent' => '0', 'pricing_value' => '3.0000', 'website_id' => '0'], 1 => ['value_id' => '2', 'product_super_attribute_id' => '1', 'value_index' => '13', 'is_percent' => '0', 'pricing_value' => '8.0000', 'website_id' => '0']];
     $values = [12 => ['value_index' => '12', 'pricing_value' => '', 'is_percent' => '0', 'include' => '1'], 13 => ['value_index' => '13', 'pricing_value' => '5', 'is_percent' => '0', 'include' => '1'], 14 => ['value_index' => '14', 'pricing_value' => '3', 'is_percent' => '0', 'include' => '1']];
     $attribute = $this->getMockBuilder('Magento\\ConfigurableProduct\\Model\\Product\\Type\\Configurable\\Attribute')->setMethods(['getValues', 'getId'])->disableOriginalConstructor()->getMock();
     $adapterMock = $this->getMockBuilder('Magento\\Framework\\DB\\Adapter\\AdapterInterface')->disableOriginalConstructor()->getMock();
     $selectMock = $this->getMockBuilder('Magento\\Framework\\DB\\Select')->disableOriginalConstructor()->getMock();
     $this->resource->expects($this->once())->method('getConnection')->with('core_write')->willReturn($adapterMock);
     $this->catalogData->expects($this->any())->method('isPriceGlobal')->willReturn(1);
     $attribute->expects($this->once())->method('getValues')->willReturn($values);
     $adapterMock->expects($this->once())->method('select')->willReturn($selectMock);
     $selectMock->expects($this->once())->method('from')->with(null)->will($this->returnSelf());
     $selectMock->expects($this->at(1))->method('where')->with('product_super_attribute_id = :product_super_attribute_id')->will($this->returnSelf());
     $selectMock->expects($this->at(2))->method('where')->with('website_id = :website_id')->will($this->returnSelf());
     $attribute->expects($this->any())->method('getId')->willReturn(1);
     $adapterMock->expects($this->once())->method('fetchAll')->with($selectMock, ['product_super_attribute_id' => 1, 'website_id' => 0])->willReturn($rowSet);
     $this->assertEquals($this->model, $this->model->savePrices($attribute));
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:18,代码来源:AttributeTest.php


示例16: 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;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:16,代码来源:Attribute.php


示例17: getPriceHtml

 /**
  * Returns product price block html
  *
  * @param \Magento\Catalog\Model\Product $product
  * @param boolean $displayMinimalPrice
  * @param string $idSuffix
  * @return string
  * @deprecated
  */
 public function getPriceHtml($product, $displayMinimalPrice = false, $idSuffix = '')
 {
     $typeId = $product->getTypeId();
     if ($this->_catalogData->canApplyMsrp($product)) {
         $realPriceHtml = $this->_preparePriceRenderer($typeId)->setProduct($product)->setDisplayMinimalPrice($displayMinimalPrice)->setIdSuffix($idSuffix)->toHtml();
         $product->setAddToCartUrl($this->getAddToCartUrl($product));
         $product->setRealPriceHtml($realPriceHtml);
         $typeId = $this->_mapRenderer;
     }
     return $this->_preparePriceRenderer($typeId)->setProduct($product)->setDisplayMinimalPrice($displayMinimalPrice)->setIdSuffix($idSuffix)->toHtml();
 }
开发者ID:Atlis,项目名称:docker-magento2,代码行数:20,代码来源:AbstractProduct.php


示例18: _getPriceConfiguration

 /**
  * Get price configuration
  *
  * @param \Magento\Catalog\Model\Product\Option\Value|\Magento\Catalog\Model\Product\Option $option
  * @return array
  */
 protected function _getPriceConfiguration($option)
 {
     $data = array();
     $data['price'] = $this->_coreData->currency($option->getPrice(true), false, false);
     $data['oldPrice'] = $this->_coreData->currency($option->getPrice(false), false, false);
     $data['priceValue'] = $option->getPrice(false);
     $data['type'] = $option->getPriceType();
     $data['exclTaxPrice'] = $price = $this->_catalogData->getTaxPrice($option->getProduct(), $data['price'], false);
     $data['inclTaxPrice'] = $price = $this->_catalogData->getTaxPrice($option->getProduct(), $data['price'], true);
     return $data;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:17,代码来源:Options.php


示例19: getElementHtml

 /**
  * @return string
  */
 public function getElementHtml()
 {
     /** @var \Magento\Framework\Data\Form\Element\AbstractElement $element */
     $element = $this->getElement();
     if (!$element->getValue()) {
         return parent::getElementHtml();
     }
     $element->setOnkeyup("onUrlkeyChanged('" . $element->getHtmlId() . "')");
     $element->setOnchange("onUrlkeyChanged('" . $element->getHtmlId() . "')");
     $data = array('name' => $element->getData('name') . '_create_redirect', 'disabled' => true);
     /** @var \Magento\Framework\Data\Form\Element\Hidden $hidden */
     $hidden = $this->_elementFactory->create('hidden', array('data' => $data));
     $hidden->setForm($element->getForm());
     $storeId = $element->getForm()->getDataObject()->getStoreId();
     $data['html_id'] = $element->getHtmlId() . '_create_redirect';
     $data['label'] = __('Create Permanent Redirect for old URL');
     $data['value'] = $element->getValue();
     $data['checked'] = $this->_catalogData->shouldSaveUrlRewritesHistory($storeId);
     /** @var \Magento\Framework\Data\Form\Element\Checkbox $checkbox */
     $checkbox = $this->_elementFactory->create('checkbox', array('data' => $data));
     $checkbox->setForm($element->getForm());
     return parent::getElementHtml() . '<br/>' . $hidden->getElementHtml() . $checkbox->getElementHtml() . $checkbox->getLabelHtml();
 }
开发者ID:aiesh,项目名称:magento2,代码行数:26,代码来源:Urlkey.php


示例20: categoryAttribute

 /**
  * Prepare category attribute html output
  *
  * @param ModelCategory $category
  * @param string $attributeHtml
  * @param string $attributeName
  * @return string
  */
 public function categoryAttribute($category, $attributeHtml, $attributeName)
 {
     $attribute = $this->_eavConfig->getAttribute(ModelCategory::ENTITY, $attributeName);
     if ($attribute && $attribute->getFrontendInput() != 'image' && (!$attribute->getIsHtmlAllowedOnFront() && !$attribute->getIsWysiwygEnabled())) {
         $attributeHtml = $this->_escaper->escapeHtml($attributeHtml);
     }
     if ($attribute->getIsHtmlAllowedOnFront() && $attribute->getIsWysiwygEnabled()) {
         if ($this->_catalogData->isUrlDirectivesParsingAllowed()) {
             $attributeHtml = $this->_getTemplateProcessor()->filter($attributeHtml);
         }
     }
     $attributeHtml = $this->process('categoryAttribute', $attributeHtml, ['category' => $category, 'attribute' => $attributeName]);
     return $attributeHtml;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:22,代码来源:Output.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Helper\Image类代码示例发布时间:2022-05-23
下一篇:
PHP Adminhtml\Product类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap