本文整理汇总了PHP中ShopGroup::getShopGroups方法的典型用法代码示例。如果您正苦于以下问题:PHP ShopGroup::getShopGroups方法的具体用法?PHP ShopGroup::getShopGroups怎么用?PHP ShopGroup::getShopGroups使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ShopGroup
的用法示例。
在下文中一共展示了ShopGroup::getShopGroups方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getTotalShopGroup
/**
* @return int Total of shop groups
*/
public static function getTotalShopGroup($active = true)
{
return count(ShopGroup::getShopGroups($active));
}
示例2: list_groups
public static function list_groups()
{
$groups = ShopGroup::getShopGroups(false);
$table = new Cli\Table();
$table->setHeaders(array('id', 'name', 'share customers', 'share orders', 'share stock', 'active', 'deleted'));
foreach ($groups as $group) {
$fields = $group->getFields();
$table->addRow(array($fields['id_shop_group'], $fields['name'], $fields['share_customer'], $fields['share_order'], $fields['share_stock'], $fields['active'], $fields['deleted']));
}
$table->display();
}
示例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,') . ' <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']);
}
//.........这里部分代码省略.........
示例4: fetchShopGroups
private function fetchShopGroups()
{
$groupList = array();
//$groupList[] = array('id' => '0', 'name' => $this->l('Choose your group'));
foreach (ShopGroup::getShopGroups(true) as $group) {
$groupList[] = array('id' => $group->id, 'name' => $group->name);
}
$this->context->smarty->assign(array('shop_groups' => $groupList));
}