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


PHP ShopGroup::hasDependency方法代码示例

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


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

示例1: renderForm

 public function renderForm()
 {
     $this->fields_form = array('legend' => array('title' => $this->l('Shop Group')), 'description' => $this->l('Warning: it is not recommended to enable the "share customers" and "share orders" options, because once they are activated and customers or orders are created, you will not be able to disable these options. If you need these options, try to first consider using several categories instead on several shops.'), 'input' => array(array('type' => 'text', 'label' => $this->l('Shop group name:'), 'name' => 'name', 'required' => true), array('type' => 'radio', 'label' => $this->l('Share customers:'), 'name' => 'share_customer', 'required' => true, 'class' => 't', 'is_bool' => true, 'disabled' => $this->id_object && $this->display == 'edit' && ShopGroup::hasDependency($this->id_object, 'customer') ? true : false, 'values' => array(array('id' => 'share_customer_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'share_customer_off', 'value' => 0, 'label' => $this->l('Disabled'))), 'desc' => $this->l('Once the option is enabled, the shops in this group will share their customers: if a customer registers on one of this group\'s shops, the account will automatically be available on the others shops of this goup. Warning: you will not be able to disable this option once you have customers registered on at least one shop of this group.')), array('type' => 'radio', 'label' => $this->l('Share available quantities to sell:'), 'name' => 'share_stock', 'required' => true, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'share_stock_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'share_stock_off', 'value' => 0, 'label' => $this->l('Disabled'))), 'desc' => $this->l('Share available quantities to sell between shops of this group. When changing this option, all products available quantities for this group will be reset to 0.')), array('type' => 'radio', 'label' => $this->l('Share orders:'), 'name' => 'share_order', 'required' => true, 'class' => 't', 'is_bool' => true, 'disabled' => $this->id_object && $this->display == 'edit' && ShopGroup::hasDependency($this->id_object, 'order') ? true : false, 'values' => array(array('id' => 'share_order_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'share_order_off', 'value' => 0, 'label' => $this->l('Disabled'))), 'desc' => $this->l('Once this option is enabled (which is only possible if customers and available quantities are shared among shops), the customer\'s cart will be shared among all the shops in this group. This way, any purchase started on one of the shops in this group will be able to be finished in another shop from the same shop group. Warning: you will not be able to disable this option once you have orders on at least one shop of this group.')), array('type' => 'radio', 'label' => $this->l('Status:'), 'name' => 'active', 'required' => true, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'active_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'active_off', 'value' => 0, 'label' => $this->l('Disabled'))), 'desc' => $this->l('Enable or disable group shop'))), 'submit' => array('title' => $this->l('Save'), 'class' => 'button'));
     if (!($obj = $this->loadObject(true))) {
         return;
     }
     if (Shop::getTotalShops() > 1 && $obj->id) {
         $disabled = array('share_customer' => true, 'share_stock' => true, 'share_order' => true, 'active' => false);
     } else {
         $disabled = false;
     }
     $default_shop = new Shop(Configuration::get('PS_SHOP_DEFAULT'));
     $this->tpl_form_vars = array('disabled' => $disabled, 'checked' => Tools::getValue('addshop_group') !== false ? true : false, 'defaultGroup' => $default_shop->id_shop_group);
     $this->fields_value = array('active' => true);
     return parent::renderForm();
 }
开发者ID:jicheng17,项目名称:pengwine,代码行数:16,代码来源:AdminShopGroupController.php

示例2: renderForm

 public function renderForm()
 {
     $this->fields_form = array('legend' => array('title' => $this->l('Shop group'), 'icon' => 'icon-shopping-cart'), 'description' => $this->l('Warning: Enabling the "share customers" and "share orders" options is not recommended. Once activated and orders are created, you will not be able to disable these options. If you need these options, we recommend using several categories rather than several shops.'), 'input' => array(array('type' => 'text', 'label' => $this->l('Shop group name'), 'name' => 'name', 'required' => true), array('type' => 'switch', 'label' => $this->l('Share customers'), 'name' => 'share_customer', 'required' => true, 'class' => 't', 'is_bool' => true, 'disabled' => $this->id_object && $this->display == 'edit' && ShopGroup::hasDependency($this->id_object, 'customer') ? true : false, 'values' => array(array('id' => 'share_customer_on', 'value' => 1), array('id' => 'share_customer_off', 'value' => 0)), 'desc' => $this->l('Once this option is enabled, the shops in this group will share customers. If a customer registers in any one of these shops, the account will automatically be available in the others shops of this group.') . '<br/>' . $this->l('Warning: you will not be able to disable this option once you have registered customers.')), array('type' => 'switch', 'label' => $this->l('Share available quantities to sell'), 'name' => 'share_stock', 'required' => true, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'share_stock_on', 'value' => 1), array('id' => 'share_stock_off', 'value' => 0)), 'desc' => $this->l('Share available quantities between shops of this group. When changing this option, all available products quantities will be reset to 0.')), array('type' => 'switch', 'label' => $this->l('Share orders'), 'name' => 'share_order', 'required' => true, 'class' => 't', 'is_bool' => true, 'disabled' => $this->id_object && $this->display == 'edit' && ShopGroup::hasDependency($this->id_object, 'order') ? true : false, 'values' => array(array('id' => 'share_order_on', 'value' => 1), array('id' => 'share_order_off', 'value' => 0)), 'desc' => $this->l('Once this option is enabled (which is only possible if customers and available quantities are shared among shops), the customer\'s cart will be shared by all shops in this group. This way, any purchase started in one shop will be able to be completed in another shop from the same group.') . '<br/>' . $this->l('Warning: You will not be able to disable this option once you\'ve started to accept orders.')), array('type' => 'switch', 'label' => $this->l('Status'), 'name' => 'active', 'required' => true, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'active_on', 'value' => 1), array('id' => 'active_off', 'value' => 0)), 'desc' => $this->l('Enable or disable this shop group?'))), 'submit' => array('title' => $this->l('Save')));
     if (!($obj = $this->loadObject(true))) {
         return;
     }
     if (Shop::getTotalShops() > 1 && $obj->id) {
         $disabled = array('share_customer' => true, 'share_stock' => true, 'share_order' => true, 'active' => false);
     } else {
         $disabled = false;
     }
     $default_shop = new Shop(Configuration::get('PS_SHOP_DEFAULT'));
     $this->tpl_form_vars = array('disabled' => $disabled, 'checked' => Tools::getValue('addshop_group') !== false ? true : false, 'defaultGroup' => $default_shop->id_shop_group);
     $this->fields_value = array('active' => true);
     return parent::renderForm();
 }
开发者ID:jpodracky,项目名称:dogs,代码行数:16,代码来源:AdminShopGroupController.php

示例3: renderForm

 public function renderForm()
 {
     if (!($obj = $this->loadObject(true))) {
         return;
     }
     $this->fields_form = array('legend' => array('title' => $this->l('Shop'), 'icon' => 'icon-shopping-cart'), 'input' => array(array('type' => 'text', 'label' => $this->l('Shop name'), 'desc' => array($this->l('This field does not refer to the shop name visible in the front office.'), sprintf($this->l('Follow %sthis link%s to edit the shop name used on the Front Office.'), '<a href="' . $this->context->link->getAdminLink('AdminStores') . '#store_fieldset_general">', '</a>')), 'name' => 'name', 'required' => true)));
     $display_group_list = true;
     if ($this->display == 'edit') {
         $group = new ShopGroup($obj->id_shop_group);
         if ($group->share_customer || $group->share_order || $group->share_stock) {
             $display_group_list = false;
         }
     }
     if ($display_group_list) {
         $options = array();
         foreach (ShopGroup::getShopGroups() as $group) {
             if ($this->display == 'edit' && ($group->share_customer || $group->share_order || $group->share_stock) && ShopGroup::hasDependency($group->id)) {
                 continue;
             }
             $options[] = array('id_shop_group' => $group->id, 'name' => $group->name);
         }
         if ($this->display == 'add') {
             $group_desc = $this->l('Warning: You won\'t be able to change the group of this shop if this shop belongs to a group with one of these options activated: Share Customers, Share Quantities or Share Orders.');
         } else {
             $group_desc = $this->l('You can only move your shop to a shop group with all "share" options disabled -- or to a shop group with no customers/orders.');
         }
         $this->fields_form['input'][] = array('type' => 'select', 'label' => $this->l('Shop group'), 'desc' => $group_desc, 'name' => 'id_shop_group', 'options' => array('query' => $options, 'id' => 'id_shop_group', 'name' => 'name'));
     } else {
         $this->fields_form['input'][] = array('type' => 'hidden', 'name' => 'id_shop_group', 'default' => $group->name);
         $this->fields_form['input'][] = array('type' => 'textShopGroup', 'label' => $this->l('Shop group'), 'desc' => $this->l('You can\'t edit the shop group because the current shop belongs to a group with the "share" option enabled.'), 'name' => 'id_shop_group', 'value' => $group->name);
     }
     $categories = Category::getRootCategories($this->context->language->id);
     $this->fields_form['input'][] = array('type' => 'select', 'label' => $this->l('Category root'), 'desc' => $this->l('This is the root category of the store that you\'ve created. To define a new root category for your store,') . '&nbsp;<a href="' . $this->context->link->getAdminLink('AdminCategories') . '&addcategoryroot" target="_blank">' . $this->l('Please click here') . '</a>', 'name' => 'id_category', 'options' => array('query' => $categories, 'id' => 'id_category', 'name' => 'name'));
     if (Tools::isSubmit('id_shop')) {
         $shop = new Shop((int) Tools::getValue('id_shop'));
         $id_root = $shop->id_category;
     } else {
         $id_root = $categories[0]['id_category'];
     }
     $id_shop = (int) Tools::getValue('id_shop');
     self::$currentIndex = self::$currentIndex . '&id_shop_group=' . (int) (Tools::getValue('id_shop_group') ? Tools::getValue('id_shop_group') : (isset($obj->id_shop_group) ? $obj->id_shop_group : Shop::getContextShopGroupID()));
     $shop = new Shop($id_shop);
     $selected_cat = Shop::getCategories($id_shop);
     if (empty($selected_cat)) {
         // get first category root and preselect all these children
         $root_categories = Category::getRootCategories();
         $root_category = new Category($root_categories[0]['id_category']);
         $children = $root_category->getAllChildren($this->context->language->id);
         $selected_cat[] = $root_categories[0]['id_category'];
         foreach ($children as $child) {
             $selected_cat[] = $child->id;
         }
     }
     if (Shop::getContext() == Shop::CONTEXT_SHOP && Tools::isSubmit('id_shop')) {
         $root_category = new Category($shop->id_category);
     } else {
         $root_category = new Category($id_root);
     }
     $this->fields_form['input'][] = array('type' => 'categories', 'name' => 'categoryBox', 'label' => $this->l('Associated categories'), 'tree' => array('id' => 'categories-tree', 'selected_categories' => $selected_cat, 'root_category' => $root_category->id, 'use_search' => true, 'use_checkbox' => true), 'desc' => $this->l('By selecting associated categories, you are choosing to share the categories between shops. Once associated between shops, any alteration of this category will impact every shop.'));
     /*$this->fields_form['input'][] = array(
     			'type' => 'switch',
     			'label' => $this->l('Enabled'),
     			'name' => 'active',
     			'required' => true,
     			'is_bool' => true,
     			'values' => array(
     				array(
     					'id' => 'active_on',
     					'value' => 1
     				),
     				array(
     					'id' => 'active_off',
     					'value' => 0
     				)
     			),
     			'desc' => $this->l('Enable or disable your store?')
     		);*/
     $themes = Theme::getThemes();
     if (!isset($obj->id_theme)) {
         foreach ($themes as $theme) {
             if (isset($theme->id)) {
                 $id_theme = $theme->id;
                 break;
             }
         }
     }
     $this->fields_form['input'][] = array('type' => 'theme', 'label' => $this->l('Theme'), 'name' => 'theme', 'values' => $themes);
     $this->fields_form['submit'] = array('title' => $this->l('Save'));
     if (Shop::getTotalShops() > 1 && $obj->id) {
         $disabled = array('active' => false);
     } else {
         $disabled = false;
     }
     $import_data = array('carrier' => $this->l('Carriers'), 'cms' => $this->l('CMS pages'), 'contact' => $this->l('Contact information'), 'country' => $this->l('Countries'), 'currency' => $this->l('Currencies'), 'discount' => $this->l('Discount prices'), 'employee' => $this->l('Employees'), 'image' => $this->l('Images'), 'lang' => $this->l('Languages'), 'manufacturer' => $this->l('Manufacturers'), 'module' => $this->l('Modules'), 'hook_module' => $this->l('Module hooks'), 'meta_lang' => $this->l('Meta'), 'product' => $this->l('Products'), 'product_attribute' => $this->l('Combinations'), 'scene' => $this->l('Scenes'), 'stock_available' => $this->l('Available quantities for sale'), 'store' => $this->l('Stores'), 'warehouse' => $this->l('Warehouses'), 'webservice_account' => $this->l('Webservice accounts'), 'attribute_group' => $this->l('Attribute groups'), 'feature' => $this->l('Features'), 'group' => $this->l('Customer groups'), 'tax_rules_group' => $this->l('Tax rules groups'), 'supplier' => $this->l('Suppliers'), 'referrer' => $this->l('Referrers/affiliates'), 'zone' => $this->l('Zones'), 'cart_rule' => $this->l('Cart rules'));
     // Hook for duplication of shop data
     $modules_list = Hook::getHookModuleExecList('actionShopDataDuplication');
     if (is_array($modules_list) && count($modules_list) > 0) {
         foreach ($modules_list as $m) {
             $import_data['Module' . ucfirst($m['module'])] = Module::getModuleName($m['module']);
         }
//.........这里部分代码省略.........
开发者ID:gks-stage,项目名称:prestashop,代码行数:101,代码来源:AdminShopController.php


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