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

PHP Mage_Catalog_Model_Product_Type类代码示例

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

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



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

示例1: getAttributeValueField

 public function getAttributeValueField($code = '', $i, $j, $current = '')
 {
     $html = '';
     if ($code) {
         $attribute = Mage::getModel('catalog/product')->getResource()->getAttribute($code);
         if ($attribute && ($attribute->getFrontendInput() == 'select' || $attribute->getFrontendInput() == 'multiselect') || $code == 'product_type') {
             $options = array();
             if ($code == 'product_type') {
                 $attribute_options = Mage_Catalog_Model_Product_Type::getOptions();
             } else {
                 $attribute_options = $attribute->getSource()->getAllOptions();
             }
             foreach ($attribute_options as $option) {
                 extract($option);
                 $selected = '';
                 if ($current == $value) {
                     $selected = 'selected="selected"';
                 }
                 $options[] = "<option value=\"{$value}\" {$selected}>{$label}</option>";
             }
             $html = '<select style="width: 100%; border: 0pt none; padding: 0pt;" name="option[' . $i . '][condition][' . $j . '][value]">' . implode('', $options) . '</select>';
         }
     }
     if ($html) {
         return $html;
     } else {
         return '<input style="width:100%;border:0;padding:0;" type="text" class="input-text" name="option[' . $i . '][condition][' . $j . '][value]" value="' . $current . '"/>';
     }
 }
开发者ID:naz-ahmed,项目名称:ndap-magento-mirror,代码行数:29,代码来源:Data.php


示例2: items

 /**
  * Retrieve product type list
  *
  * @return array
  */
 public function items()
 {
     $result = array();
     foreach (Mage_Catalog_Model_Product_Type::getOptionArray() as $type => $label) {
         $result[] = array('type' => $type, 'label' => $label);
     }
     return $result;
 }
开发者ID:xiaoguizhidao,项目名称:blingjewelry-prod,代码行数:13,代码来源:Api.php


示例3: _construct

 /**
  * Internal Constructor
  */
 protected function _construct()
 {
     parent::_construct();
     $this->_init('widget/widget_instance');
     $this->_layoutHandles = array('anchor_categories' => self::ANCHOR_CATEGORY_LAYOUT_HANDLE, 'notanchor_categories' => self::NOTANCHOR_CATEGORY_LAYOUT_HANDLE, 'all_products' => self::PRODUCT_LAYOUT_HANDLE, 'all_pages' => self::DEFAULT_LAYOUT_HANDLE);
     $this->_specificEntitiesLayoutHandles = array('anchor_categories' => self::SINGLE_CATEGORY_LAYOUT_HANDLE, 'notanchor_categories' => self::SINGLE_CATEGORY_LAYOUT_HANDLE, 'all_products' => self::SINGLE_PRODUCT_LAYOUT_HANLDE);
     foreach (Mage_Catalog_Model_Product_Type::getTypes() as $typeId => $type) {
         $this->_layoutHandles[$typeId . '_products'] = str_replace('{{TYPE}}', $typeId, self::PRODUCT_TYPE_LAYOUT_HANDLE);
         $this->_specificEntitiesLayoutHandles[$typeId . '_products'] = self::SINGLE_PRODUCT_LAYOUT_HANLDE;
     }
 }
开发者ID:jpbender,项目名称:mage_virtual,代码行数:14,代码来源:Instance.php


示例4: _prepareForm

 protected function _prepareForm()
 {
     /* @var $form Varien_Data_Form */
     $form = new Varien_Data_Form();
     /* @var $fieldset Varien_Data_Form_Element_Fieldset */
     $fieldset = $form->addFieldset('permissions_product_create', array('legend' => Mage::helper('aitpermissions')->__('Product Creation Permissions')));
     $this->_addElementTypes($fieldset);
     $fieldset->addField('allow_create_product', 'select', array('name' => 'allow_create_product', 'label' => Mage::helper('aitpermissions')->__('Allow to Сreate Products'), 'title' => Mage::helper('aitpermissions')->__('Allow to Сreate Products'), 'values' => Mage::getModel('adminhtml/system_config_source_yesno')->toOptionArray()));
     $fieldset->addField('apply_to', 'apply', array('name' => 'apply_to[]', 'label' => Mage::helper('catalog')->__('Allow to Create'), 'values' => Mage_Catalog_Model_Product_Type::getOptions(), 'mode_labels' => array('all' => Mage::helper('catalog')->__('All Product Types'), 'custom' => Mage::helper('catalog')->__('Selected Product Types'))), 'frontend_class');
     $this->setForm($form);
     $this->_setFormValues($form);
 }
开发者ID:cabrerabywaters,项目名称:magentoSunshine,代码行数:12,代码来源:Create.php


示例5: getProductTypeInstances

 /**
  * Retrieve Product Type Instances
  * as key - type code, value - instance model
  *
  * @return array
  */
 public function getProductTypeInstances()
 {
     if (is_null($this->_productTypes)) {
         $this->_productTypes = array();
         $productEmulator = new Varien_Object();
         foreach (array_keys(Mage_Catalog_Model_Product_Type::getTypes()) as $typeId) {
             $productEmulator->setTypeId($typeId);
             $this->_productTypes[$typeId] = Mage::getSingleton('catalog/product_type')->factory($productEmulator);
         }
     }
     return $this->_productTypes;
 }
开发者ID:xiaoguizhidao,项目名称:blingjewelry-prod,代码行数:18,代码来源:Status.php


示例6: _prepareForm

 protected function _prepareForm()
 {
     $model = Mage::registry('entity_attribute');
     $form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post'));
     $fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('catalog')->__('Attribute Properties')));
     if ($model->getAttributeId()) {
         $fieldset->addField('attribute_id', 'hidden', array('name' => 'attribute_id'));
     }
     $yesno = array(array('value' => 0, 'label' => Mage::helper('catalog')->__('No')), array('value' => 1, 'label' => Mage::helper('catalog')->__('Yes')));
     $fieldset->addField('attribute_code', 'text', array('name' => 'attribute_code', 'label' => Mage::helper('catalog')->__('Attribute Identifier'), 'title' => Mage::helper('catalog')->__('Attribute Identifier'), 'note' => Mage::helper('catalog')->__('For internal use. Must be unique with no spaces'), 'class' => 'validate-code', 'required' => true));
     $fieldset->addField('is_global', 'select', array('name' => 'is_global', 'label' => Mage::helper('catalog')->__('Scope'), 'title' => Mage::helper('catalog')->__('Scope'), 'note' => Mage::helper('catalog')->__('Declare atrribute value saving scope'), 'values' => array(Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE => Mage::helper('catalog')->__('Store View'), Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE => Mage::helper('catalog')->__('Website'), Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL => Mage::helper('catalog')->__('Global'))));
     $fieldset->addField('frontend_input', 'select', array('name' => 'frontend_input', 'label' => Mage::helper('catalog')->__('Catalog Input Type for Store Owner'), 'title' => Mage::helper('catalog')->__('Catalog Input Type for Store Owner'), 'value' => 'text', 'values' => array(array('value' => 'text', 'label' => Mage::helper('catalog')->__('Text Field')), array('value' => 'textarea', 'label' => Mage::helper('catalog')->__('Text Area')), array('value' => 'date', 'label' => Mage::helper('catalog')->__('Date')), array('value' => 'boolean', 'label' => Mage::helper('catalog')->__('Yes/No')), array('value' => 'multiselect', 'label' => Mage::helper('catalog')->__('Multiple Select')), array('value' => 'select', 'label' => Mage::helper('catalog')->__('Dropdown')), array('value' => 'price', 'label' => Mage::helper('catalog')->__('Price')), array('value' => 'image', 'label' => Mage::helper('catalog')->__('Image')), array('value' => 'gallery', 'label' => Mage::helper('catalog')->__('Gallery')), array('value' => 'media_image', 'label' => Mage::helper('catalog')->__('Media Image')))));
     $fieldset->addField('default_value_text', 'text', array('name' => 'default_value_text', 'label' => Mage::helper('catalog')->__('Default value'), 'title' => Mage::helper('catalog')->__('Default value'), 'value' => $model->getDefaultValue()));
     $fieldset->addField('default_value_yesno', 'select', array('name' => 'default_value_yesno', 'label' => Mage::helper('catalog')->__('Default value'), 'title' => Mage::helper('catalog')->__('Default value'), 'values' => $yesno, 'value' => $model->getDefaultValue()));
     $fieldset->addField('default_value_date', 'date', array('name' => 'default_value_date', 'label' => Mage::helper('catalog')->__('Default value'), 'title' => Mage::helper('catalog')->__('Default value'), 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'value' => $model->getDefaultValue()));
     $fieldset->addField('default_value_textarea', 'textarea', array('name' => 'default_value_textarea', 'label' => Mage::helper('catalog')->__('Default value'), 'title' => Mage::helper('catalog')->__('Default value'), 'value' => $model->getDefaultValue()));
     $fieldset->addField('is_unique', 'select', array('name' => 'is_unique', 'label' => Mage::helper('catalog')->__('Unique Value'), 'title' => Mage::helper('catalog')->__('Unique Value (not shared with other products)'), 'note' => Mage::helper('catalog')->__('Not shared with other products'), 'values' => $yesno));
     $fieldset->addField('is_required', 'select', array('name' => 'is_required', 'label' => Mage::helper('catalog')->__('Values Required'), 'title' => Mage::helper('catalog')->__('Values Required'), 'values' => $yesno));
     $fieldset->addField('frontend_class', 'select', array('name' => 'frontend_class', 'label' => Mage::helper('catalog')->__('Input Validation for Store Owner'), 'title' => Mage::helper('catalog')->__('Input Validation for Store Owner'), 'values' => array(array('value' => '', 'label' => Mage::helper('catalog')->__('None')), array('value' => 'validate-number', 'label' => Mage::helper('catalog')->__('Decimal Number')), array('value' => 'validate-digits', 'label' => Mage::helper('catalog')->__('Integer Number')), array('value' => 'validate-email', 'label' => Mage::helper('catalog')->__('Email')), array('value' => 'validate-url', 'label' => Mage::helper('catalog')->__('Url')), array('value' => 'validate-alpha', 'label' => Mage::helper('catalog')->__('Letters')), array('value' => 'validate-alphanum', 'label' => Mage::helper('catalog')->__('Letters(a-z) or Numbers(0-9)')))));
     /*
             $fieldset->addField('use_in_super_product', 'select', array(
                 'name' => 'use_in_super_product',
                 'label' => Mage::helper('catalog')->__('Apply To Configurable/Grouped Product'),
                 'values' => $yesno,
             )); */
     $fieldset->addField('apply_to', 'multiselect', array('name' => 'apply_to[]', 'label' => Mage::helper('catalog')->__('Apply To'), 'values' => Mage_Catalog_Model_Product_Type::getOptions(), 'value' => array(Mage_Catalog_Model_Product_Type::DEFAULT_TYPE), 'required' => true));
     $fieldset->addField('is_configurable', 'select', array('name' => 'is_configurable', 'label' => Mage::helper('catalog')->__('Use To Create Configurable Product'), 'values' => $yesno));
     // -----
     // frontend properties fieldset
     $fieldset = $form->addFieldset('front_fieldset', array('legend' => Mage::helper('catalog')->__('Frontend Properties')));
     $fieldset->addField('is_searchable', 'select', array('name' => 'is_searchable', 'label' => Mage::helper('catalog')->__('Use in quick search'), 'title' => Mage::helper('catalog')->__('Use in quick search'), 'values' => $yesno));
     $fieldset->addField('is_visible_in_advanced_search', 'select', array('name' => 'is_visible_in_advanced_search', 'label' => Mage::helper('catalog')->__('Use in advanced search'), 'title' => Mage::helper('catalog')->__('Use in advanced search'), 'values' => $yesno));
     $fieldset->addField('is_comparable', 'select', array('name' => 'is_comparable', 'label' => Mage::helper('catalog')->__('Comparable on Front-end'), 'title' => Mage::helper('catalog')->__('Comparable on Front-end'), 'values' => $yesno));
     $fieldset->addField('is_filterable', 'select', array('name' => 'is_filterable', 'label' => Mage::helper('catalog')->__("Use In Layered Navigation"), 'title' => Mage::helper('catalog')->__('Can be used only with catalog input type Dropdown'), 'note' => Mage::helper('catalog')->__('Can be used only with catalog input type Dropdown'), 'values' => array(array('value' => '0', 'label' => Mage::helper('catalog')->__('No')), array('value' => '1', 'label' => Mage::helper('catalog')->__('Filterable (with results)')), array('value' => '2', 'label' => Mage::helper('catalog')->__('Filterable (no results)')))));
     if ($model->getIsUserDefined() || !$model->getId()) {
         $fieldset->addField('is_visible_on_front', 'select', array('name' => 'is_visible_on_front', 'label' => Mage::helper('catalog')->__('Visible on Catalog Pages on Front-end'), 'title' => Mage::helper('catalog')->__('Visible on Catalog Pages on Front-end'), 'values' => $yesno));
     }
     if ($model->getId()) {
         $form->getElement('attribute_code')->setDisabled(1);
         $form->getElement('frontend_input')->setDisabled(1);
     }
     if (!$model->getIsUserDefined() && $model->getId()) {
         $form->getElement('is_unique')->setDisabled(1);
     }
     $form->addValues($model->getData());
     if ($model->getApplyTo()) {
         $form->getElement('apply_to')->setValue(explode(',', $model->getApplyTo()));
     }
     $this->setForm($form);
     return parent::_prepareForm();
 }
开发者ID:arslbbt,项目名称:mangentovies,代码行数:51,代码来源:Main.php


示例7: convertAction

 public function convertAction()
 {
     if ($this->getRequest()->getParam('id') > 0) {
         try {
             $product = Mage::getModel('catalog/product')->load($this->getRequest()->getParam('id'));
             $old_type = $product->getTypeId();
             $new_type = 'subscription_' . $old_type;
             $types = Mage_Catalog_Model_Product_Type::getTypes();
             if (empty($types[$new_type]['model'])) {
                 throw new Mage_Core_Exception("The product type {$old_type} can't be converted");
             }
             $this->__beforeConvert($product, $new_type);
             $product->setTypeId($new_type)->save();
             Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('sarp')->__('Product was successfully converted to subscription'));
             $this->_redirect('*/*/');
         } catch (Exception $e) {
             Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
         }
     }
     $this->_redirectReferer();
 }
开发者ID:par-orillonsoft,项目名称:magento_work,代码行数:21,代码来源:ProductController.php


示例8: _prepareLayout

 /**
  * Creates the form for the condition based selection of product attributes.
  *
  * @return FireGento_DynamicCategory_Block_Adminhtml_Category_Dynamic Self.
  */
 public function _prepareLayout()
 {
     parent::_prepareLayout();
     $model = Mage::getSingleton('mep/rule');
     $data = array();
     if ($this->getCategory() != null) {
         $conditions = $this->getCategory()->getConditionsSerialized();
         if (!is_array($conditions)) {
             $conditions = unserialize($conditions);
         }
         $data['conditions'] = $conditions;
     }
     $model->loadPost($data);
     $form = new Varien_Data_Form();
     $form->setHtmlIdPrefix('mep_');
     $form->setDataObject($this->getCategory());
     $renderer = Mage::getBlockSingleton('adminhtml/widget_form_renderer_fieldset')->setTemplate('mep/fieldset.phtml')->setNewChildUrl($this->getUrl('adminhtml/dynamic/newConditionHtml/form/mep_conditions_fieldset'));
     $fieldset = $form->addFieldset('conditions_fieldset', array('legend' => $this->__('Export Rules')))->setRenderer($renderer);
     $fieldset->addField('conditions', 'text', array('name' => 'conditions', 'label' => $this->__('Conditions'), 'title' => $this->__('Conditions')))->setRule($model)->setRenderer(Mage::getBlockSingleton('mep/conditions'));
     $specialRules = $form->addFieldset('special_rules_fieldset', array('legend' => $this->__('Special filters')));
     $specialRules->addType('apply', 'Mage_Adminhtml_Block_Catalog_Product_Helper_Form_Apply');
     $specialRules->addField('apply_to', 'apply', array('name' => 'settings[apply_to][]', 'label' => Mage::helper('catalog')->__('Apply To'), 'values' => Mage_Catalog_Model_Product_Type::getOptions(), 'mode_labels' => array('all' => Mage::helper('catalog')->__('All Product Types'), 'custom' => Mage::helper('catalog')->__('Selected Product Types')), 'required' => true), 'frontend_class');
     $form->getElement('apply_to')->setValue($this->getApplyToValue($form));
     $specialRules->addField('is_in_stock', 'select', array('name' => 'settings[is_in_stock]', 'label' => Mage::helper('catalog')->__('Stock Availability'), 'values' => array_merge(Mage::getSingleton('cataloginventory/source_stock')->toOptionArray(), array('2' => '')), 'value' => $this->getProfilSettingsValueForKey('is_in_stock'), 'note' => $this->__('Will be used for mains and inheritors products')));
     $specialRules->addType('qty', 'Flagbit_MEP_Helper_QtyFilter');
     $specialRules->addField('qty', 'qty', array('name' => 'settings[qty][threshold]', 'dropdownName' => 'settings[qty][operator]', 'dropdownStyle' => 'width: 150px', 'dropdownValue' => $this->getQtyOperatorValue(), 'label' => Mage::helper('catalog')->__('Qty'), 'style' => 'width:50px', 'note' => $this->__('Will be used for mains and inheritors products'), 'required' => true));
     $form->getElement('qty')->setValue($this->getQtyFilterValue($form));
     $profilData = Mage::helper('mep')->getCurrentProfileData();
     $settings = $profilData['settings'];
     if (!$settings) {
         $form->getElement('apply_to')->addClass('no-display ignore-validate');
         $form->getElement('qty')->addClass('no-display ignore-validate');
     }
     $this->setForm($form);
     return $this;
 }
开发者ID:tschifftner,项目名称:Magento-MEP,代码行数:41,代码来源:Dynamic.php


示例9: assignBackendModelToAttribute

 /**
  * Automaticaly assign backend model to weee attributes
  *
  * @param   Varien_Event_Observer $observer
  * @return  Mage_Weee_Model_Observer
  */
 public function assignBackendModelToAttribute(Varien_Event_Observer $observer)
 {
     $backendModel = Mage_Weee_Model_Attribute_Backend_Weee_Tax::getBackendModelName();
     /** @var $object Mage_Eav_Model_Entity_Attribute_Abstract */
     $object = $observer->getEvent()->getAttribute();
     if ($object->getFrontendInput() == 'weee') {
         $object->setBackendModel($backendModel);
         if (!$object->getApplyTo()) {
             $applyTo = array();
             foreach (Mage_Catalog_Model_Product_Type::getOptions() as $option) {
                 if ($option['value'] == Mage_Catalog_Model_Product_Type::TYPE_GROUPED) {
                     continue;
                 }
                 $applyTo[] = $option['value'];
             }
             $object->setApplyTo($applyTo);
         }
     }
     return $this;
 }
开发者ID:relue,项目名称:magento2,代码行数:26,代码来源:Observer.php


示例10: getDisplayOnContainers

 /**
  * Generate array of parameters for every container type to create html template
  *
  * @return array
  */
 public function getDisplayOnContainers()
 {
     $container = array();
     $container['anchor'] = array('label' => 'Categories', 'code' => 'categories', 'name' => 'anchor_categories', 'layout_handle' => 'default,catalog_category_layered', 'is_anchor_only' => 1, 'product_type_id' => '');
     $container['notanchor'] = array('label' => 'Categories', 'code' => 'categories', 'name' => 'notanchor_categories', 'layout_handle' => 'default,catalog_category_default', 'is_anchor_only' => 0, 'product_type_id' => '');
     $container['all_products'] = array('label' => 'Products', 'code' => 'products', 'name' => 'all_products', 'layout_handle' => 'default,catalog_product_view', 'is_anchor_only' => '', 'product_type_id' => '');
     foreach (Mage_Catalog_Model_Product_Type::getTypes() as $typeId => $type) {
         $container[$typeId] = array('label' => 'Products', 'code' => 'products', 'name' => $typeId . '_products', 'layout_handle' => 'default,catalog_product_view,PRODUCT_TYPE_' . $typeId, 'is_anchor_only' => '', 'product_type_id' => $typeId);
     }
     return $container;
 }
开发者ID:hazaeluz,项目名称:magento_connect,代码行数:16,代码来源:Layout.php


示例11: getTypeInstance

 /**
  * @return Mage_Catalog_Model_Product_Type_Abstract
  * @throws Ess_M2ePro_Model_Exception
  */
 public function getTypeInstance()
 {
     if (is_null($this->_productModel) && $this->_productId < 0) {
         throw new Ess_M2ePro_Model_Exception('Load instance first');
     }
     /** @var Mage_Catalog_Model_Product_Type_Abstract $typeInstance */
     if ($this->isConfigurableType() && !$this->getProduct()->getData('overridden_type_instance_injected')) {
         $config = Mage_Catalog_Model_Product_Type::getTypes();
         $typeInstance = Mage::getModel('M2ePro/Magento_Product_Type_Configurable');
         $typeInstance->setProduct($this->getProduct());
         $typeInstance->setConfig($config['configurable']);
         $this->getProduct()->setTypeInstance($typeInstance);
         $this->getProduct()->setTypeInstance($typeInstance, true);
         $this->getProduct()->setData('overridden_type_instance_injected', true);
     } else {
         $typeInstance = $this->getProduct()->getTypeInstance();
     }
     $typeInstance->setStoreFilter($this->getStoreId());
     return $typeInstance;
 }
开发者ID:giuseppemorelli,项目名称:magento-extension,代码行数:24,代码来源:Product.php


示例12: getProductsCollection

 public function getProductsCollection($filterData = '', $current_page = 0, $length = 50)
 {
     if (is_null($this->_productCollection) && $this->getId()) {
         $collection = Mage::getModel('gomage_feed/product_collection')->addAttributeToSelect('*');
         $collection->addStoreFilter(Mage::app()->getStore());
         if ($length != 0) {
             $collection->setPage($current_page + 1, $length);
         }
         $collection->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes())->addMinimalPrice()->addFinalPrice()->addTaxPercents()->addUrlRewrite($this->getRootCategory()->getId());
         if ($this->getVisibility()) {
             switch ($this->getVisibility()) {
                 case Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE:
                     $collection->setVisibility(array(Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE));
                     break;
                 case Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG:
                     Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($collection);
                     break;
                 case Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_SEARCH:
                     Mage::getSingleton('catalog/product_visibility')->addVisibleInSearchFilterToCollection($collection);
                     break;
                 case Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH:
                     Mage::getSingleton('catalog/product_visibility')->addVisibleInSiteFilterToCollection($collection);
                     break;
                 case 5:
                     $collection->setVisibility(array(Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG));
                     break;
                 case 6:
                     $collection->setVisibility(array(Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_SEARCH));
                     break;
             }
         }
         if ($this->getUseLayer()) {
             $collection->joinField('is_in_stock', 'cataloginventory/stock_item', 'is_in_stock', 'product_id=entity_id');
             $collection->addAttributeToFilter('is_in_stock', array('eq' => Mage_CatalogInventory_Model_Stock::STOCK_IN_STOCK));
         }
         if ($this->getUseDisabled()) {
             Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
             $collection->addAttributeToFilter('status', array('in' => Mage_Catalog_Model_Product_Status::STATUS_ENABLED));
         }
         if ($this->getFilter()) {
             $filter_values = json_decode($this->getFilter(), true);
             $filters = array();
             foreach ((array) $filter_values as $filter) {
                 $code = trim(@$filter['attribute_code']);
                 $condition = trim(@$filter['condition']);
                 $value = trim(@$filter['value']);
                 if ($code && $condition && $value != '') {
                     if (!isset($filters[$code])) {
                         $filters[$code] = array();
                     }
                     if (!isset($filters[$code][$condition])) {
                         $filters[$code][$condition] = array();
                     }
                     $filters[$code][$condition][] = $value;
                 }
             }
             foreach ($filters as $code => $filter) {
                 if ($code == 'qty') {
                     $collection->joinField('qty', 'cataloginventory/stock_item', 'qty', 'product_id=entity_id', '{{table}}.stock_id=1', 'left');
                 }
                 foreach ($filter as $condition => $value) {
                     if ($code == 'category_id') {
                         foreach ($value as $_value) {
                             $collection->prepareFeedCategoryFilter($condition, $_value);
                         }
                     } elseif ($code == 'product_type') {
                         $all_product_type = Mage_Catalog_Model_Product_Type::getOptionArray();
                         $all_product_type = array_keys($all_product_type);
                         if (isset($filter['neq'])) {
                             $all_product_type = array_diff($all_product_type, $filter['neq']);
                         }
                         if (isset($filter['eq'])) {
                             $all_product_type = array_intersect($all_product_type, $filter['eq']);
                         }
                         $collection->addAttributeToFilter('type_id', array('in' => $all_product_type));
                         break;
                     } else {
                         switch ($condition) {
                             case 'eq':
                                 $condition = 'in';
                                 break;
                             case 'neq':
                                 $condition = 'nin';
                                 break;
                             case 'gt':
                             case 'gteq':
                                 $value = max($value);
                                 break;
                             case 'lt':
                             case 'lteq':
                                 $value = min($value);
                                 break;
                             case 'like':
                                 if (count($value) > 1) {
                                     $_attribute = array();
                                     foreach ($value as $_value) {
                                         $_attribute[] = array('attribute' => $code, $condition => $_value);
                                     }
                                     $collection->addAttributeToFilter($_attribute);
                                     continue 2;
//.........这里部分代码省略.........
开发者ID:naz-ahmed,项目名称:ndap-magento-mirror,代码行数:101,代码来源:Item.php


示例13: getAllOptions

 public function getAllOptions()
 {
     if (!$this->_ready) {
         return array(array('value' => '', 'label' => Mage::helper('widget')->__('-- Please Select --')));
     }
     $result = array(array('value' => '', 'label' => Mage::helper('widget')->__('-- Please Select --')), array('label' => Mage::helper('widget')->__('Categories'), 'value' => array(array('value' => 'catalog_category_layered', 'label' => Mage::helper('core')->jsQuoteEscape(Mage::helper('widget')->__('Anchor Categories'))), array('value' => 'catalog_category_default', 'label' => Mage::helper('core')->jsQuoteEscape(Mage::helper('widget')->__('Non-Anchor Categories'))))));
     $productTypes = array();
     foreach (Mage_Catalog_Model_Product_Type::getTypes() as $typeId => $type) {
         $productTypes[] = array('value' => 'PRODUCT_TYPE_' . $typeId, 'label' => Mage::helper('core')->jsQuoteEscape($type['label']));
     }
     array_unshift($productTypes, array('value' => 'catalog_product_view', 'label' => Mage::helper('core')->jsQuoteEscape(Mage::helper('widget')->__('All Product Types'))));
     $result[] = array('label' => Mage::helper('widget')->__('Products'), 'value' => $productTypes);
     $pages = array(array('value' => 'default', 'label' => Mage::helper('widget')->__('All Pages')));
     foreach ($this->getLayoutHandles($this->getArea(), $this->getPackage(), $this->getTheme()) as $value => $label) {
         $pages[] = array('value' => $value, 'label' => $label);
     }
     $result[] = array('label' => Mage::helper('widget')->__('Generic Pages'), 'value' => $pages);
     return $result;
 }
开发者ID:ahsanmage,项目名称:vr,代码行数:19,代码来源:Layout.php


示例14: getProductType

 public function getProductType($val)
 {
     if (is_null($this->_productTypes)) {
         $this->_productTypes = array();
         $retarray = Mage_Catalog_Model_Product_Type::getOptions();
         foreach (Mage_Catalog_Model_Product_Type::getOptions() as $value) {
             $this->_productTypes['value'][] = $value['value'];
             $this->_productTypes['label'][] = $value['label'];
         }
     }
     $val = str_replace($this->_productTypes['value'], $this->_productTypes['label'], $val);
     return $val;
 }
开发者ID:par-orillonsoft,项目名称:Magento,代码行数:13,代码来源:Export.php


示例15: _prepareForm

 /**
  * Adding product form elements for editing attribute
  *
  * @return Mage_Adminhtml_Block_Catalog_Product_Attribute_Edit_Tab_Main
  */
 protected function _prepareForm()
 {
     parent::_prepareForm();
     $attributeObject = $this->getAttributeObject();
     /* @var $form Varien_Data_Form */
     $form = $this->getForm();
     /* @var $fieldset Varien_Data_Form_Element_Fieldset */
     $fieldset = $form->getElement('base_fieldset');
     $frontendInputElm = $form->getElement('frontend_input');
     $additionalTypes = array(array('value' => 'price', 'label' => Mage::helper('catalog')->__('Price')), array('value' => 'media_image', 'label' => Mage::helper('catalog')->__('Media Image')));
     if ($attributeObject->getFrontendInput() == 'gallery') {
         $additionalTypes[] = array('value' => 'gallery', 'label' => Mage::helper('catalog')->__('Gallery'));
     }
     $response = new Varien_Object();
     $response->setTypes(array());
     Mage::dispatchEvent('adminhtml_product_attribute_types', array('response' => $response));
     $_disabledTypes = array();
     $_hiddenFields = array();
     foreach ($response->getTypes() as $type) {
         $additionalTypes[] = $type;
         if (isset($type['hide_fields'])) {
             $_hiddenFields[$type['value']] = $type['hide_fields'];
         }
         if (isset($type['disabled_types'])) {
             $_disabledTypes[$type['value']] = $type['disabled_types'];
         }
     }
     Mage::register('attribute_type_hidden_fields', $_hiddenFields);
     Mage::register('attribute_type_disabled_types', $_disabledTypes);
     $frontendInputValues = array_merge($frontendInputElm->getValues(), $additionalTypes);
     $frontendInputElm->setValues($frontendInputValues);
     $yesnoSource = Mage::getModel('adminhtml/system_config_source_yesno')->toOptionArray();
     $scopes = array(Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE => Mage::helper('catalog')->__('Store View'), Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE => Mage::helper('catalog')->__('Website'), Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL => Mage::helper('catalog')->__('Global'));
     if ($attributeObject->getAttributeCode() == 'status' || $attributeObject->getAttributeCode() == 'tax_class_id') {
         unset($scopes[Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE]);
     }
     $fieldset->addField('is_global', 'select', array('name' => 'is_global', 'label' => Mage::helper('catalog')->__('Scope'), 'title' => Mage::helper('catalog')->__('Scope'), 'note' => Mage::helper('catalog')->__('Declare attribute value saving scope'), 'values' => $scopes), 'attribute_code');
     $fieldset->addField('apply_to', 'apply', array('name' => 'apply_to[]', 'label' => Mage::helper('catalog')->__('Apply To'), 'values' => Mage_Catalog_Model_Product_Type::getOptions(), 'mode_labels' => array('all' => Mage::helper('catalog')->__('All Product Types'), 'custom' => Mage::helper('catalog')->__('Selected Product Types')), 'required' => true), 'frontend_class');
     $fieldset->addField('is_configurable', 'select', array('name' => 'is_configurable', 'label' => Mage::helper('catalog')->__('Use To Create Configurable Product'), 'values' => $yesnoSource), 'apply_to');
     // frontend properties fieldset
     $fieldset = $form->addFieldset('front_fieldset', array('legend' => Mage::helper('catalog')->__('Frontend Properties')));
     $fieldset->addField('is_searchable', 'select', array('name' => 'is_searchable', 'label' => Mage::helper('catalog')->__('Use in Quick Search'), 'title' => Mage::helper('catalog')->__('Use in Quick Search'), 'values' => $yesnoSource));
     $fieldset->addField('is_visible_in_advanced_search', 'select', array('name' => 'is_visible_in_advanced_search', 'label' => Mage::helper('catalog')->__('Use in Advanced Search'), 'title' => Mage::helper('catalog')->__('Use in Advanced Search'), 'values' => $yesnoSource));
     $fieldset->addField('is_comparable', 'select', array('name' => 'is_comparable', 'label' => Mage::helper('catalog')->__('Comparable on Front-end'), 'title' => Mage::helper('catalog')->__('Comparable on Front-end'), 'values' => $yesnoSource));
     $fieldset->addField('is_filterable', 'select', array('name' => 'is_filterable', 'label' => Mage::helper('catalog')->__("Use In Layered Navigation"), 'title' => Mage::helper('catalog')->__('Can be used only with catalog input type Dropdown, Multiple Select and Price'), 'note' => Mage::helper('catalog')->__('Can be used only with catalog input type Dropdown, Multiple Select and Price'), 'values' => array(array('value' => '0', 'label' => Mage::helper('catalog')->__('No')), array('value' => '1', 'label' => Mage::helper('catalog')->__('Filterable (with results)')), array('value' => '2', 'label' => Mage::helper('catalog')->__('Filterable (no results)')))));
     $fieldset->addField('is_filterable_in_search', 'select', array('name' => 'is_filterable_in_search', 'label' => Mage::helper('catalog')->__("Use In Search Results Layered Navigation"), 'title' => Mage::helper('catalog')->__('Can be used only with catalog input type Dropdown, Multiple Select and Price'), 'note' => Mage::helper('catalog')->__('Can be used only with catalog input type Dropdown, Multiple Select and Price'), 'values' => $yesnoSource));
     $fieldset->addField('is_used_for_promo_rules', 'select', array('name' => 'is_used_for_promo_rules', 'label' => Mage::helper('catalog')->__('Use for Promo Rule Conditions'), 'title' => Mage::helper('catalog')->__('Use for Promo Rule Conditions'), 'values' => $yesnoSource));
     $fieldset->addField('position', 'text', array('name' => 'position', 'label' => Mage::helper('catalog')->__('Position'), 'title' => Mage::helper('catalog')->__('Position in Layered Navigation'), 'note' => Mage::helper('catalog')->__('Position of attribute in layered navigation block'), 'class' => 'validate-digits'));
     $fieldset->addField('is_wysiwyg_enabled', 'select', array('name' => 'is_wysiwyg_enabled', 'label' => Mage::helper('catalog')->__('Enable WYSIWYG'), 'title' => Mage::helper('catalog')->__('Enable WYSIWYG'), 'values' => $yesnoSource));
     $htmlAllowed = $fieldset->addField('is_html_allowed_on_front', 'select', array('name' => 'is_html_allowed_on_front', 'label' => Mage::helper('catalog')->__('Allow HTML Tags on Frontend'), 'title' => Mage::helper('catalog')->__('Allow HTML Tags on Frontend'), 'values' => $yesnoSource));
     if (!$attributeObject->getId() || $attributeObject->getIsWysiwygEnabled()) {
         $attributeObject->setIsHtmlAllowedOnFront(1);
     }
     $fieldset->addField('is_visible_on_front', 'select', array('name' => 'is_visible_on_front', 'label' => Mage::helper('catalog')->__('Visible on Product View Page on Front-end'), 'title' => Mage::helper('catalog')->__('Visible on Product View Page on Front-end'), 'values' => $yesnoSource));
     $fieldset->addField('used_in_product_listing', 'select', array('name' => 'used_in_product_listing', 'label' => Mage::helper('catalog')->__('Used in Product Listing'), 'title' => Mage::helper('catalog')->__('Used in Product Listing'), 'note' => Mage::helper('catalog')->__('Depends on design theme'), 'values' => $yesnoSource));
     $fieldset->addField('used_for_sort_by', 'select', array('name' => 'used_for_sort_by', 'label' => Mage::helper('catalog')->__('Used for Sorting in Product Listing'), 'title' => Mage::helper('catalog')->__('Used for Sorting in Product Listing'), 'note' => Mage::helper('catalog')->__('Depends on design theme'), 'values' => $yesnoSource));
     $form->getElement('apply_to')->setSize(5);
     if ($applyTo = $attributeObject->getApplyTo()) {
         $applyTo = is_array($applyTo) ? $applyTo : explode(',', $applyTo);
         $form->getElement('apply_to')->setValue($applyTo);
     } else {
         $form->getElement('apply_to')->addClass('no-display ignore-validate');
     }
     // define field dependencies
     $this->setChild('form_after', $this->getLayout()->createBlock('adminhtml/widget_form_element_dependence')->addFieldMap("is_wysiwyg_enabled", 'wysiwyg_enabled')->addFieldMap("is_html_allowed_on_front", 'html_allowed_on_front')->addFieldMap("frontend_input", 'frontend_input_type')->addFieldDependence('wysiwyg_enabled', 'frontend_input_type', 'textarea')->addFieldDependence('html_allowed_on_front', 'wysiwyg_enabled', '0'));
     Mage::dispatchEvent('adminhtml_catalog_product_attribute_edit_prepare_form', array('form' => $form, 'attribute' => $attributeObject));
     return $this;
 }
开发者ID:jpbender,项目名称:mage_virtual,代码行数:73,代码来源:Main.php


示例16: array

/* @var $this Mage_Core_Model_Resource_Setup */
/** @var $indexHelper Enterprise_Index_Helper_Data */
$indexHelper = Mage::helper('enterprise_index');
/** @var $client Enterprise_Mview_Model_Client */
$client = Mage::getModel('enterprise_mview/client');
$client->init('catalogsearch_fulltext');
$client->getMetadata()->setKeyColumn('product_id')->setViewName('catalogsearch_fulltext_cl')->setStatus(Enterprise_Mview_Model_Metadata::STATUS_INVALID)->setGroupCode('catalogsearch_fulltext')->save();
$client->execute('enterprise_index/action_index_changelog_create');
$subscriptions = array($this->getTable('catalog/product') => 'entity_id', $this->getTable(array('catalog/product', 'decimal')) => 'entity_id', $this->getTable(array('catalog/product', 'int')) => 'entity_id', $this->getTable(array('catalog/product', 'text')) => 'entity_id', $this->getTable(array('catalog/product', 'varchar')) => 'entity_id', $this->getTable(array('catalog/product', 'datetime')) => 'entity_id');
/** @var $resources mage_core_model_resource */
$resources = Mage::getSingleton('core/resource');
/** @var $productType mage_catalog_model_product_type */
$productType = Mage::getSingleton('catalog/product_type');
$productEmulator = new Varien_Object();
$productEmulator->setIdFieldName('entity_id');
foreach (Mage_Catalog_Model_Product_Type::getCompositeTypes() as $typeId) {
    $productEmulator->setTypeId($typeId);
    /** @var $typeInstance Mage_Catalog_Model_Product_Type_Abstract */
    $typeInstance = $productType->factory($productEmulator);
    /** @var $relation bool|Varien_Object */
    $relation = $typeInstance->isComposite() ? $typeInstance->getRelationInfo() : false;
    if ($relation && $relation->getTable()) {
        $tableName = $resources->getTableName($relation->getTable());
        $subscriptions[$tableName] = $relation->getParentFieldName();
    }
}
foreach ($subscriptions as $targetTable => $targetColumn) {
    $arguments = array('target_table' => $targetTable, 'target_column' => $targetColumn);
    $client->execute('enterprise_mview/action_changelog_subscription_create', $arguments);
}
$events = array();
开发者ID:QiuLihua83,项目名称:magento-enterprise-1.13.1.0,代码行数:31,代码来源:install-1.13.0.0.php


示例17: testGetTypesByPriority

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Mage_Catalog_Model_Product_Type_Abstract类代码示例发布时间:2022-05-23
下一篇:
PHP Mage_Catalog_Model_Product_Option类代码示例发布时间: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