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


PHP ShopGroup类代码示例

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


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

示例1: copyShopData

    public function copyShopData($old_id, $tables_import = false, $deleted = false)
    {
        // If we duplicate some specific data, automatically duplicate other data linked to the first
        // E.g. if carriers are duplicated for the shop, duplicate carriers langs too
        if (!$old_id) {
            $old_id = Configuration::get('PS_SHOP_DEFAULT');
        }
        if (isset($tables_import['carrier'])) {
            $tables_import['carrier_tax_rules_group_shop'] = true;
            $tables_import['carrier_lang'] = true;
        }
        $tables_import['category_lang'] = true;
        if (isset($tables_import['product'])) {
            $tables_import['product_lang'] = true;
        }
        if (isset($tables_import['module'])) {
            $tables_import['module_currency'] = true;
            $tables_import['module_country'] = true;
            $tables_import['module_group'] = true;
        }
        if (isset($tables_import['hook_module'])) {
            $tables_import['hook_module_exceptions'] = true;
        }
        if (isset($tables_import['attribute_group'])) {
            $tables_import['attribute'] = true;
        }
        // Browse and duplicate data
        foreach (Shop::getAssoTables() as $table_name => $row) {
            if ($tables_import && !isset($tables_import[$table_name])) {
                continue;
            }
            // Special case for stock_available if current shop is in a share stock group
            if ($table_name == 'stock_available') {
                $group = new ShopGroup($this->id_shop_group);
                if ($group->share_stock && $group->haveShops()) {
                    continue;
                }
            }
            $id = 'id_' . $row['type'];
            if ($row['type'] == 'fk_shop') {
                $id = 'id_shop';
            } else {
                $table_name .= '_' . $row['type'];
            }
            if (!$deleted) {
                $res = Db::getInstance()->getRow('SELECT * FROM `' . _DB_PREFIX_ . $table_name . '` WHERE `' . $id . '` = ' . (int) $old_id);
                if ($res) {
                    unset($res[$id]);
                    if (isset($row['primary'])) {
                        unset($res[$row['primary']]);
                    }
                    $categories = Tools::getValue('categoryBox');
                    if ($table_name == 'product_shop' && count($categories) == 1) {
                        unset($res['id_category_default']);
                        $keys = implode('`, `', array_keys($res));
                        $sql = 'INSERT IGNORE INTO `' . _DB_PREFIX_ . $table_name . '` (`' . $keys . '`, `id_category_default`, ' . $id . ')
								(SELECT `' . $keys . '`, ' . (int) $categories[0] . ', ' . (int) $this->id . ' FROM ' . _DB_PREFIX_ . $table_name . '
								WHERE `' . $id . '` = ' . (int) $old_id . ')';
                    } else {
                        $keys = implode('`, `', array_keys($res));
                        $sql = 'INSERT IGNORE INTO `' . _DB_PREFIX_ . $table_name . '` (`' . $keys . '`, ' . $id . ')
								(SELECT `' . $keys . '`, ' . (int) $this->id . ' FROM ' . _DB_PREFIX_ . $table_name . '
								WHERE `' . $id . '` = ' . (int) $old_id . ')';
                    }
                    Db::getInstance()->execute($sql);
                }
            }
        }
        // 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) {
                if (!$tables_import || isset($tables_import['Module' . ucfirst($m['module'])])) {
                    Hook::exec('actionShopDataDuplication', array('old_id_shop' => (int) $old_id, 'new_id_shop' => (int) $this->id), $m['id_module']);
                }
            }
        }
    }
开发者ID:gks-stage,项目名称:prestashop,代码行数:78,代码来源:Shop.php

示例2: getTotalShopGroup

 /**
  * @return int Total of shop groups
  */
 public static function getTotalShopGroup($active = true)
 {
     return count(ShopGroup::getShopGroups($active));
 }
开发者ID:ortegon000,项目名称:tienda,代码行数:7,代码来源:ShopGroup.php

示例3: postProcess

 public function postProcess()
 {
     if (Tools::isSubmit('delete' . $this->table) || Tools::isSubmit('status') || Tools::isSubmit('status' . $this->table)) {
         $object = $this->loadObject();
         if (ShopGroup::getTotalShopGroup() == 1) {
             $this->errors[] = Tools::displayError('You cannot delete or disable the last shop group.');
         } elseif ($object->haveShops()) {
             $this->errors[] = Tools::displayError('You cannot delete or disable a shop group in use.');
         }
         if (count($this->errors)) {
             return false;
         }
     }
     return parent::postProcess();
 }
开发者ID:ecssjapan,项目名称:guiding-you-afteropen,代码行数:15,代码来源:AdminShopGroupController.php

示例4: 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

示例5: supplierImportOne

    protected function supplierImportOne($info, $shop_is_feature_active, $regenerate, $force_ids, $validateOnly = false)
    {
        AdminImportController::setDefaultValues($info);
        if ($force_ids && isset($info['id']) && (int) $info['id']) {
            $supplier = new Supplier((int) $info['id']);
        } else {
            if (array_key_exists('id', $info) && (int) $info['id'] && Supplier::existsInDatabase((int) $info['id'], 'supplier')) {
                $supplier = new Supplier((int) $info['id']);
            } else {
                $supplier = new Supplier();
            }
        }
        AdminImportController::arrayWalk($info, array('AdminImportController', 'fillInfo'), $supplier);
        if (($field_error = $supplier->validateFields(UNFRIENDLY_ERROR, true)) === true && ($lang_field_error = $supplier->validateFieldsLang(UNFRIENDLY_ERROR, true)) === true) {
            $res = false;
            if ($supplier->id && $supplier->supplierExists($supplier->id)) {
                $res = $validateOnly || $supplier->update();
            }
            $supplier->force_id = (bool) $force_ids;
            if (!$res) {
                $res = $validateOnly || $supplier->add();
            }
            //copying images of suppliers
            if (!$validateOnly && isset($supplier->image) && !empty($supplier->image)) {
                if (!AdminImportController::copyImg($supplier->id, null, $supplier->image, 'suppliers', !$regenerate)) {
                    $this->warnings[] = $supplier->image . ' ' . $this->trans('cannot be copied.', array(), 'Admin.Parameters.Notification');
                }
            }
            if (!$res) {
                $this->errors[] = Db::getInstance()->getMsgError() . ' ' . sprintf($this->trans('%1$s (ID: %2$s) cannot be saved', array(), 'Admin.Parameters.Notification'), isset($info['name']) && !empty($info['name']) ? Tools::safeOutput($info['name']) : 'No Name', isset($info['id']) && !empty($info['id']) ? Tools::safeOutput($info['id']) : 'No ID');
            } elseif (!$validateOnly) {
                // Associate supplier to group shop
                if ($shop_is_feature_active && $supplier->shop) {
                    Db::getInstance()->execute('
						DELETE FROM ' . _DB_PREFIX_ . 'supplier_shop
						WHERE id_supplier = ' . (int) $supplier->id);
                    $supplier->shop = explode($this->multiple_value_separator, $supplier->shop);
                    $shops = array();
                    foreach ($supplier->shop as $shop) {
                        if (empty($shop)) {
                            continue;
                        }
                        $shop = trim($shop);
                        if (!is_numeric($shop)) {
                            $shop = ShopGroup::getIdByName($shop);
                        }
                        $shops[] = $shop;
                    }
                    $supplier->associateTo($shops);
                }
            }
        } else {
            $this->errors[] = $this->l('Supplier is invalid') . ' (' . $supplier->name . ')';
            $this->errors[] = ($field_error !== true ? $field_error : '') . (isset($lang_field_error) && $lang_field_error !== true ? $lang_field_error : '');
        }
    }
开发者ID:M03G,项目名称:PrestaShop,代码行数:56,代码来源:AdminImportController.php

示例6: createShop

 public function createShop($shop_name)
 {
     // Create default group shop
     $shop_group = new ShopGroup();
     $shop_group->name = 'Default';
     $shop_group->active = true;
     if (!$shop_group->add()) {
         $this->setError($this->language->l('Cannot create group shop') . ' / ' . Db::getInstance()->getMsgError());
         return false;
     }
     // Create default shop
     $shop = new Shop();
     $shop->active = true;
     $shop->id_shop_group = $shop_group->id;
     $shop->id_category = 2;
     $shop->id_theme = 1;
     $shop->name = $shop_name;
     if (!$shop->add()) {
         $this->setError($this->language->l('Cannot create shop') . ' / ' . Db::getInstance()->getMsgError());
         return false;
     }
     Context::getContext()->shop = $shop;
     // Create default shop URL
     $shop_url = new ShopUrl();
     $shop_url->domain = Tools::getHttpHost();
     $shop_url->domain_ssl = Tools::getHttpHost();
     $shop_url->physical_uri = __PS_BASE_URI__;
     $shop_url->id_shop = $shop->id;
     $shop_url->main = true;
     $shop_url->active = true;
     if (!$shop_url->add()) {
         $this->setError($this->language->l('Cannot create shop URL') . ' / ' . Db::getInstance()->getMsgError());
         return false;
     }
     return true;
 }
开发者ID:toufikadfab,项目名称:PrestaShop-1.5,代码行数:36,代码来源:install.php

示例7: supplierImport

    public function supplierImport()
    {
        $this->receiveTab();
        $handle = $this->openCsvFile();
        AdminImportController::setLocale();
        for ($current_line = 0; $line = fgetcsv($handle, MAX_LINE_SIZE, $this->separator); $current_line++) {
            if (Tools::getValue('convert')) {
                $line = $this->utf8EncodeArray($line);
            }
            $info = AdminImportController::getMaskedRow($line);
            AdminImportController::setDefaultValues($info);
            if (Tools::getValue('forceIDs') && isset($info['id']) && (int) $info['id']) {
                $supplier = new Supplier((int) $info['id']);
            } else {
                if (array_key_exists('id', $info) && (int) $info['id'] && Supplier::existsInDatabase((int) $info['id'], 'supplier')) {
                    $supplier = new Supplier((int) $info['id']);
                } else {
                    $supplier = new Supplier();
                }
            }
            AdminImportController::arrayWalk($info, array('AdminImportController', 'fillInfo'), $supplier);
            if (($field_error = $supplier->validateFields(UNFRIENDLY_ERROR, true)) === true && ($lang_field_error = $supplier->validateFieldsLang(UNFRIENDLY_ERROR, true)) === true) {
                $res = false;
                if ($supplier->id && $supplier->supplierExists($supplier->id)) {
                    $res = $supplier->update();
                }
                $supplier->force_id = (bool) Tools::getValue('forceIDs');
                if (!$res) {
                    $res = $supplier->add();
                }
                //copying images of suppliers
                if (isset($supplier->image) && !empty($supplier->image)) {
                    if (!AdminImportController::copyImg($supplier->id, null, $supplier->image, 'suppliers', !Tools::getValue('regenerate'))) {
                        $this->warnings[] = $supplier->image . ' ' . Tools::displayError('cannot be copied.');
                    }
                }
                if (!$res) {
                    $this->errors[] = Db::getInstance()->getMsgError() . ' ' . sprintf(Tools::displayError('%1$s (ID: %2$s) cannot be saved'), isset($info['name']) && !empty($info['name']) ? Tools::safeOutput($info['name']) : 'No Name', isset($info['id']) && !empty($info['id']) ? Tools::safeOutput($info['id']) : 'No ID');
                } else {
                    // Associate supplier to group shop
                    if (Shop::isFeatureActive() && $supplier->shop) {
                        Db::getInstance()->execute('
							DELETE FROM ' . _DB_PREFIX_ . 'supplier_shop
							WHERE id_supplier = ' . (int) $supplier->id);
                        $supplier->shop = explode($this->multiple_value_separator, $supplier->shop);
                        $shops = array();
                        foreach ($supplier->shop as $shop) {
                            if (empty($shop)) {
                                continue;
                            }
                            $shop = trim($shop);
                            if (!is_numeric($shop)) {
                                $shop = ShopGroup::getIdByName($shop);
                            }
                            $shops[] = $shop;
                        }
                        $supplier->associateTo($shops);
                    }
                }
            } else {
                $this->errors[] = $this->l('Supplier is invalid') . ' (' . $supplier->name . ')';
                $this->errors[] = ($field_error !== true ? $field_error : '') . (isset($lang_field_error) && $lang_field_error !== true ? $lang_field_error : '');
            }
        }
        $this->closeCsvFile($handle);
    }
开发者ID:ecssjapan,项目名称:guiding-you-afteropen,代码行数:66,代码来源:AdminImportController.php

示例8: Product

         Shop::setContext(Shop::CONTEXT_SHOP, $id);
         echo "-Context is set to " . $type . $id . " ";
         break;
     default:
         Shop::setContext(Shop::CONTEXT_ALL, null);
         echo "-Context is set to " . $type . " ";
 }
 //code v2.4.1
 $id_product = (int) Tools::getValue('id_product');
 $id_lang = (int) Context::getContext()->language->id;
 //$product = new Product($id_product, false, $id_lang,$id_shop_source,$context); //version 5.2 - Ne duplique que dans une seule langue
 $product = new Product($id_product, false, null, $id_shop_source, $context);
 //version 5.3  All languages
 //Class product:  function __construct($id_product = null, $full = false, $id_lang = null, $id_shop = null, Context $context = null)
 if (empty($product->price) && Shop::getContext() == Shop::CONTEXT_GROUP) {
     $shops = ShopGroup::getShopsFromGroup(Shop::getContextShopGroupID());
     foreach ($shops as $shop) {
         if ($product->isAssociatedToShop($shop['id_shop'])) {
             $product_price = new Product($id_product_old, false, null, $shop['id_shop']);
             $product->price = $product_price->price;
         }
     }
 }
 if (Validate::isLoadedObject($product)) {
     $id_product_old = $product->id;
     for ($i = 1; $i <= $quantity; $i++) {
         echo $i;
         unset($product->id);
         unset($product->id_product);
         $product->indexed = 0;
         $product->active = 0;
开发者ID:EliosIT,项目名称:PS_AchatFilet,代码行数:31,代码来源:duplication.php

示例9: postProcess

 public function postProcess()
 {
     if (Tools::isSubmit('delete' . $this->table) || Tools::isSubmit('status') || Tools::isSubmit('status' . $this->table)) {
         /** @var ShopGroup $object */
         $object = $this->loadObject();
         if (ShopGroup::getTotalShopGroup() == 1) {
             $this->errors[] = $this->trans('You cannot delete or disable the last shop group.', array(), 'Admin.Notifications.Error');
         } elseif ($object->haveShops()) {
             $this->errors[] = $this->trans('You cannot delete or disable a shop group in use.', array(), 'Admin.Notifications.Error');
         }
         if (count($this->errors)) {
             return false;
         }
     }
     return parent::postProcess();
 }
开发者ID:M03G,项目名称:PrestaShop,代码行数:16,代码来源:AdminShopGroupController.php

示例10: postProcess

 public function postProcess()
 {
     $id_shops = array();
     if (Tools::isSubmit('mass_csv_form_submit')) {
         if (Shop::getContext() == Shop::CONTEXT_ALL) {
             $shops = Shop::getShops();
             if (!empty($shops)) {
                 foreach ($shops as $s) {
                     $id_shops[] = $s['id_shop'];
                 }
             }
         } elseif (Shop::getContext() == Shop::CONTEXT_GROUP) {
             $shopid = Shop::getContextShopGroupID(true);
             $shops = ShopGroup::getShopsFromGroup($shopid);
             if (!empty($shops)) {
                 foreach ($shops as $s) {
                     $id_shops[] = $s['id_shop'];
                 }
             }
         }
         if (empty($id_shops)) {
             $id_shops[] = Shop::getContextShopID();
         }
         $id_shops = array_unique($id_shops);
         if (is_uploaded_file($_FILES['csv_file']['tmp_name'])) {
             $mimes = array('application/vnd.ms-excel', 'text/plain', 'text/csv', 'text/tsv');
             if (!in_array($_FILES['csv_file']['type'], $mimes)) {
                 $this->errors[] = Tools::displayError($this->l('Error : Problem with file upload. Please retry or check your file.'));
                 return false;
             }
             if (move_uploaded_file($_FILES['csv_file']['tmp_name'], $this->mod->cache_dir . $_FILES['csv_file']['name'])) {
                 $old_file_name = $_FILES['csv_file']['name'];
                 $csv_content = Tools::file_get_contents($this->mod->cache_dir . $old_file_name);
                 $array = $this->csvToArray($csv_content);
                 if (empty($array)) {
                     $this->errors[] = Tools::displayError($this->l('Error : Problem with file upload. Please retry or check your file.'));
                     parent::postProcess();
                     return false;
                 }
                 foreach ($array as $value) {
                     if (!empty($value[0])) {
                         $new = !empty($value[1]) ? trim($value[1]) : '/';
                         $type = !empty($value[2]) ? trim($value[2]) : '301';
                         $regex = !empty($value[3]) ? (int) $value[3] : 0;
                         $redirect = new Redirect();
                         $redirect->old = trim($value[0]);
                         $redirect->new = $new;
                         $redirect->type = $type;
                         $redirect->regex = (bool) $regex;
                         $redirect->active = true;
                         $redirect->add();
                         /*foreach ($id_shops as $v) {
                               $db->execute('INSERT INTO `'._DB_PREFIX_.'redirect_shop` (`id_redirect_shop`,`id_redirect`, `id_shop`) VALUES (NULL,'.(int)$redirect->id.','.(int)$v.')');
                           }*/
                     }
                 }
             }
             Tools::redirectAdmin(self::$currentIndex . '&token=' . Tools::getAdminTokenLite('AdminRedirect') . '&conf=4');
         }
     }
     parent::postProcess();
 }
开发者ID:acreno,项目名称:pm-ps,代码行数:62,代码来源:AdminRedirectController.php

示例11: create_group

 public static function create_group($name, $shareCustomers, $shareStock, $shareOrders, $active = true)
 {
     if (!Validate::isBool($shareCustomers)) {
         return false;
     }
     if (!Validate::isBool($shareStock)) {
         return false;
     }
     if (!Validate::isBool($shareOrders)) {
         return false;
     }
     if (!Validate::isBool($active)) {
         return false;
     }
     $shopGroup = new ShopGroup();
     $shopGroup->name = $name;
     $shopGroup->active = $active;
     $shopGroup->share_customer = $shareCustomers;
     $shopGroup->share_stock = $shareStock;
     $shopGroup->share_order = $shareOrders;
     // todo: echo shopgroupid
     if ($shopGroup->add()) {
         echo "Shop group {$name} successfully created\n";
         return true;
     } else {
         echo "Error, could not create shop group {$name}\n";
         return false;
     }
 }
开发者ID:rodrisan,项目名称:ps-cli,代码行数:29,代码来源:multistore.php

示例12: getShopsIds

 public function getShopsIds()
 {
     $id_shops = array();
     if (Shop::getContext() == Shop::CONTEXT_ALL) {
         $shops = Shop::getShops();
         if (!empty($shops)) {
             foreach ($shops as $s) {
                 $id_shops[] = $s['id_shop'];
             }
         }
     } elseif (Shop::getContext() == Shop::CONTEXT_GROUP) {
         $shopid = Shop::getContextShopGroupID(true);
         $shops = ShopGroup::getShopsFromGroup($shopid);
         if (!empty($shops)) {
             foreach ($shops as $s) {
                 $id_shops[] = $s['id_shop'];
             }
         }
     }
     if (empty($id_shops)) {
         $id_shops[] = Shop::getContextShopID();
     }
     $id_shops = array_unique($id_shops);
     return $id_shops;
 }
开发者ID:acreno,项目名称:pm-ps,代码行数:25,代码来源:magicredirect.php

示例13: 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));
 }
开发者ID:paolobattistella,项目名称:aphro,代码行数:9,代码来源:AdminAphStoresController.php


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