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


PHP Mage_Catalog_Model_Resource_Eav_Attribute::initLabels方法代码示例

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


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

示例1: _initProduct

 /**
  * Initialize product from request parameters
  *
  * @return Mage_Catalog_Model_Product
  */
 protected function _initProduct()
 {
     $productId = (int) $this->getRequest()->getParam('id');
     $product = Mage::getModel('catalog/product')->setStoreId($this->getRequest()->getParam('store', 0));
     if (!$productId) {
         if ($setId = (int) $this->getRequest()->getParam('set')) {
             $product->setAttributeSetId($setId);
         }
         if ($typeId = $this->getRequest()->getParam('type')) {
             $product->setTypeId($typeId);
         }
     }
     if ($productId) {
         $product->load($productId);
     }
     $attributes = $this->getRequest()->getParam('attributes');
     if ($attributes && $product->isConfigurable() && (!$productId || !$product->getTypeInstance()->getUsedProductAttributeIds())) {
         $product->getTypeInstance()->setUsedProductAttributeIds(explode(",", base64_decode(urldecode($attributes))));
     }
     // Init attribute label names for store selected in dropdown
     Mage_Catalog_Model_Resource_Eav_Attribute::initLabels($product->getStoreId());
     // Required attributes of simple product for configurable creation
     if ($this->getRequest()->getParam('popup') && ($requiredAttributes = $this->getRequest()->getParam('required'))) {
         $requiredAttributes = explode(",", $requiredAttributes);
         foreach ($product->getAttributes() as $attribute) {
             if (in_array($attribute->getId(), $requiredAttributes)) {
                 $attribute->setIsRequired(1);
             }
         }
     }
     if ($this->getRequest()->getParam('popup') && $this->getRequest()->getParam('product') && !is_array($this->getRequest()->getParam('product')) && $this->getRequest()->getParam('id', false) === false) {
         $configProduct = Mage::getModel('catalog/product')->setStoreId(0)->load($this->getRequest()->getParam('product'))->setTypeId($this->getRequest()->getParam('type'));
         /* @var $configProduct Mage_Catalog_Model_Product */
         $data = array();
         foreach ($configProduct->getTypeInstance()->getEditableAttributes() as $attribute) {
             /* @var $attribute Mage_Catalog_Model_Resource_Eav_Attribute */
             if (!$attribute->getIsUnique() && $attribute->getFrontend()->getInputType() != 'gallery' && $attribute->getAttributeCode() != 'required_options' && $attribute->getAttributeCode() != 'has_options' && $attribute->getAttributeCode() != $configProduct->getIdFieldName()) {
                 $data[$attribute->getAttributeCode()] = $configProduct->getData($attribute->getAttributeCode());
             }
         }
         $product->addData($data)->setWebsiteIds($configProduct->getWebsiteIds());
     }
     $product->setData('_edit_mode', true);
     Mage::register('product', $product);
     Mage::register('current_product', $product);
     return $product;
 }
开发者ID:brentwpeterson,项目名称:magento_cart_promo,代码行数:52,代码来源:GroupedController.php


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