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


PHP Shop::getContextShopGroupID方法代码示例

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


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

示例1: getRenderedShopList

 /**
  * Render shop list
  *
  * @return string
  */
 public function getRenderedShopList()
 {
     if (!Shop::isFeatureActive() || Shop::getTotalShops(false, null) < 2) {
         return '';
     }
     $shop_context = Shop::getContext();
     $context = Context::getContext();
     $tree = Shop::getTree();
     if ($shop_context == Shop::CONTEXT_ALL || $context->controller->multishop_context_group == false && $shop_context == Shop::CONTEXT_GROUP) {
         $current_shop_value = '';
         $current_shop_name = Translate::getAdminTranslation('All shops');
     } elseif ($shop_context == Shop::CONTEXT_GROUP) {
         $current_shop_value = 'g-' . Shop::getContextShopGroupID();
         $current_shop_name = sprintf(Translate::getAdminTranslation('%s group'), $tree[Shop::getContextShopGroupID()]['name']);
     } else {
         $current_shop_value = 's-' . Shop::getContextShopID();
         foreach ($tree as $group_id => $group_data) {
             foreach ($group_data['shops'] as $shop_id => $shop_data) {
                 if ($shop_id == Shop::getContextShopID()) {
                     $current_shop_name = $shop_data['name'];
                     break;
                 }
             }
         }
     }
     $tpl = $this->createTemplate('helpers/shops_list/list.tpl');
     $tpl->assign(array('tree' => $tree, 'current_shop_name' => $current_shop_name, 'current_shop_value' => $current_shop_value, 'multishop_context' => $context->controller->multishop_context, 'multishop_context_group' => $context->controller->multishop_context_group, 'is_shop_context' => $context->controller->multishop_context & Shop::CONTEXT_SHOP, 'is_group_context' => $context->controller->multishop_context & Shop::CONTEXT_GROUP, 'shop_context' => $shop_context, 'url' => $_SERVER['REQUEST_URI'] . ($_SERVER['QUERY_STRING'] ? '&' : '?') . 'setShopContext='));
     return $tpl->fetch();
 }
开发者ID:jpodracky,项目名称:dogs,代码行数:34,代码来源:HelperShop.php

示例2: getCurrentShopName

 public function getCurrentShopName()
 {
     $shop_context = Shop::getContext();
     $tree = Shop::getTree();
     if ($this->noShopSelection()) {
         $current_shop_name = Translate::getAdminTranslation('All shops');
     } elseif ($shop_context == Shop::CONTEXT_GROUP) {
         $current_shop_name = sprintf(Translate::getAdminTranslation('%s group'), $tree[Shop::getContextShopGroupID()]['name']);
     } else {
         foreach ($tree as $group_id => $group_data) {
             foreach ($group_data['shops'] as $shop_id => $shop_data) {
                 if ($shop_id == Shop::getContextShopID()) {
                     $current_shop_name = $shop_data['name'];
                     break;
                 }
             }
         }
     }
     return $current_shop_name;
 }
开发者ID:M03G,项目名称:PrestaShop,代码行数:20,代码来源:HelperShop.php

示例3: clearCategory

    public static function clearCategory()
    {
        if (version_compare(_PS_VERSION_, '1.5', '<')) {
            return Db::getInstance()->execute('
				DELETE FROM `' . _DB_PREFIX_ . self::$definition['table'] . '`
				WHERE `id_shop`=' . (int) Context::getContext()->shop->id);
        }
        $shop_context = Shop::getContext();
        if ($shop_context == Shop::CONTEXT_SHOP) {
            return Db::getInstance()->execute('
				DELETE FROM `' . _DB_PREFIX_ . self::$definition['table'] . '`
				WHERE `id_shop`=' . (int) Context::getContext()->shop->id);
        } else {
            $id_shop_group = Shop::getContext() == Shop::CONTEXT_GROUP ? Shop::getContextShopGroupID() : null;
            $shop_ids = Shop::getShops(false, $id_shop_group, true);
            foreach ($shop_ids as $id_shop) {
                Db::getInstance()->execute('
					DELETE FROM `' . _DB_PREFIX_ . self::$definition['table'] . '`
					WHERE `id_shop`=' . (int) $id_shop);
            }
        }
    }
开发者ID:ventsiwad,项目名称:presta_addons,代码行数:22,代码来源:Category.php

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

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

示例6: runAdminTab

/**
 * for retrocompatibility with old AdminTab, old index.php
 *
 * @return void
 */
function runAdminTab($tab, $ajaxMode = false)
{
    $ajaxMode = (bool) $ajaxMode;
    require_once _PS_ADMIN_DIR_ . '/init.php';
    $cookie = Context::getContext()->cookie;
    if (empty($tab) && !sizeof($_POST)) {
        $tab = 'AdminDashboard';
        $_POST['tab'] = $tab;
        $_POST['token'] = Tools::getAdminTokenLite($tab);
    }
    // $tab = $_REQUEST['tab'];
    if ($adminObj = checkingTab($tab)) {
        Context::getContext()->controller = $adminObj;
        // init is different for new tabs (AdminController) and old tabs (AdminTab)
        if ($adminObj instanceof AdminController) {
            if ($ajaxMode) {
                $adminObj->ajax = true;
            }
            $adminObj->path = dirname($_SERVER["PHP_SELF"]);
            $adminObj->run();
        } else {
            if (!$ajaxMode) {
                require_once _PS_ADMIN_DIR_ . '/header.inc.php';
            }
            $isoUser = Context::getContext()->language->id;
            $tabs = array();
            $tabs = Tab::recursiveTab($adminObj->id, $tabs);
            $tabs = array_reverse($tabs);
            $bread = '';
            foreach ($tabs as $key => $item) {
                $bread .= ' <img src="../img/admin/separator_breadcrumb.png" style="margin-right:5px" alt="&gt;" />';
                if (count($tabs) - 1 > $key) {
                    $bread .= '<a href="?tab=' . $item['class_name'] . '&token=' . Tools::getAdminToken($item['class_name'] . intval($item['id_tab']) . (int) Context::getContext()->employee->id) . '">';
                }
                $bread .= $item['name'];
                if (count($tabs) - 1 > $key) {
                    $bread .= '</a>';
                }
            }
            if (!$ajaxMode && Shop::isFeatureActive() && Shop::getContext() != Shop::CONTEXT_ALL && Context::getContext()->controller->multishop_context != Shop::CONTEXT_ALL) {
                echo '<div class="multishop_info">';
                if (Shop::getContext() == Shop::CONTEXT_GROUP) {
                    $shop_group = new ShopGroup((int) Shop::getContextShopGroupID());
                    printf(Translate::getAdminTranslation('You are configuring your store for group shop %s'), '<b>' . $shop_group->name . '</b>');
                } elseif (Shop::getContext() == Shop::CONTEXT_SHOP) {
                    printf(Translate::getAdminTranslation('You are configuring your store for shop %s'), '<b>' . Context::getContext()->shop->name . '</b>');
                }
                echo '</div>';
            }
            if (Validate::isLoadedObject($adminObj)) {
                if ($adminObj->checkToken()) {
                    if ($ajaxMode) {
                        // the differences with index.php is here
                        $adminObj->ajaxPreProcess();
                        $action = Tools::getValue('action');
                        // no need to use displayConf() here
                        if (!empty($action) && method_exists($adminObj, 'ajaxProcess' . Tools::toCamelCase($action))) {
                            $adminObj->{'ajaxProcess' . Tools::toCamelCase($action)}();
                        } else {
                            $adminObj->ajaxProcess();
                        }
                        // @TODO We should use a displayAjaxError
                        $adminObj->displayErrors();
                        if (!empty($action) && method_exists($adminObj, 'displayAjax' . Tools::toCamelCase($action))) {
                            $adminObj->{'displayAjax' . $action}();
                        } else {
                            $adminObj->displayAjax();
                        }
                    } else {
                        /* Filter memorization */
                        if (isset($_POST) && !empty($_POST) && isset($adminObj->table)) {
                            foreach ($_POST as $key => $value) {
                                if (is_array($adminObj->table)) {
                                    foreach ($adminObj->table as $table) {
                                        if (strncmp($key, $table . 'Filter_', 7) === 0 || strncmp($key, 'submitFilter', 12) === 0) {
                                            $cookie->{$key} = !is_array($value) ? $value : serialize($value);
                                        }
                                    }
                                } elseif (strncmp($key, $adminObj->table . 'Filter_', 7) === 0 || strncmp($key, 'submitFilter', 12) === 0) {
                                    $cookie->{$key} = !is_array($value) ? $value : serialize($value);
                                }
                            }
                        }
                        if (isset($_GET) && !empty($_GET) && isset($adminObj->table)) {
                            foreach ($_GET as $key => $value) {
                                if (is_array($adminObj->table)) {
                                    foreach ($adminObj->table as $table) {
                                        if (strncmp($key, $table . 'OrderBy', 7) === 0 || strncmp($key, $table . 'Orderway', 8) === 0) {
                                            $cookie->{$key} = $value;
                                        }
                                    }
                                } elseif (strncmp($key, $adminObj->table . 'OrderBy', 7) === 0 || strncmp($key, $adminObj->table . 'Orderway', 12) === 0) {
                                    $cookie->{$key} = $value;
                                }
                            }
//.........这里部分代码省略.........
开发者ID:dev-lav,项目名称:htdocs,代码行数:101,代码来源:functions.php

示例7: setQuantity

 /**
  * For a given id_product and id_product_attribute sets the quantity available
  *
  * @param int $id_product
  * @param int $id_product_attribute Optional
  * @param int $delta_quantity The delta quantity to update
  * @param int $id_shop Optional
  */
 public static function setQuantity($id_product, $id_product_attribute, $quantity, $id_shop = null)
 {
     if (!Validate::isUnsignedId($id_product)) {
         return false;
     }
     $context = Context::getContext();
     // if there is no $id_shop, gets the context one
     if ($id_shop === null && Shop::getContext() != Shop::CONTEXT_GROUP) {
         $id_shop = (int) $context->shop->id;
     }
     $depends_on_stock = StockAvailable::dependsOnStock($id_product);
     //Try to set available quantity if product does not depend on physical stock
     if (!$depends_on_stock) {
         $id_stock_available = (int) StockAvailable::getStockAvailableIdByProductId($id_product, $id_product_attribute, $id_shop);
         if ($id_stock_available) {
             $stock_available = new StockAvailable($id_stock_available);
             $stock_available->quantity = (int) $quantity;
             $stock_available->update();
         } else {
             $out_of_stock = StockAvailable::outOfStock($id_product, $id_shop);
             $stock_available = new StockAvailable();
             $stock_available->out_of_stock = (int) $out_of_stock;
             $stock_available->id_product = (int) $id_product;
             $stock_available->id_product_attribute = (int) $id_product_attribute;
             $stock_available->quantity = (int) $quantity;
             $shop_group = new ShopGroup((int) Shop::getContextShopGroupID());
             // if quantities are shared between shops of the group
             if ($shop_group->share_stock) {
                 $stock_available->id_shop = 0;
                 $stock_available->id_shop_group = (int) $shop_group->id;
             } else {
                 $stock_available->id_shop = $id_shop;
                 $stock_available->id_shop_group = Shop::getGroupFromShop($id_shop);
             }
             $stock_available->add();
         }
         Hook::exec('actionUpdateQuantity', array('id_product' => $id_product, 'id_product_attribute' => $id_product_attribute, 'quantity' => $stock_available->quantity));
     }
 }
开发者ID:jicheng17,项目名称:vipinsg,代码行数:47,代码来源:StockAvailable.php

示例8: postProcessCallback


//.........这里部分代码省略.........
                             if (!method_exists($module, $method)) {
                                 throw new PrestaShopException('Method of module cannot be found');
                             }
                             // Get the return value of current method
                             $echo = $module->{$method}();
                             // After a successful install of a single module that has a configuration method, to the configuration page
                             if ($key == 'install' && $echo === true && strpos(Tools::getValue('install'), '|') === false && method_exists($module, 'getContent')) {
                                 Tools::redirectAdmin(self::$currentIndex . '&token=' . $this->token . '&configure=' . $module->name . '&conf=12');
                             }
                         }
                         // If the method called is "configure" (getContent method), we show the html code of configure page
                         if ($key == 'configure' && Module::isInstalled($module->name)) {
                             $this->bootstrap = isset($module->bootstrap) && $module->bootstrap;
                             if (isset($module->multishop_context)) {
                                 $this->multishop_context = $module->multishop_context;
                             }
                             $back_link = self::$currentIndex . '&token=' . $this->token . '&tab_module=' . $module->tab . '&module_name=' . $module->name;
                             $hook_link = 'index.php?tab=AdminModulesPositions&token=' . Tools::getAdminTokenLite('AdminModulesPositions') . '&show_modules=' . (int) $module->id;
                             $trad_link = 'index.php?tab=AdminTranslations&token=' . Tools::getAdminTokenLite('AdminTranslations') . '&type=modules&lang=';
                             $disable_link = $this->context->link->getAdminLink('AdminModules') . '&module_name=' . $module->name . '&enable=0&tab_module=' . $module->tab;
                             $uninstall_link = $this->context->link->getAdminLink('AdminModules') . '&module_name=' . $module->name . '&uninstall=' . $module->name . '&tab_module=' . $module->tab;
                             $reset_link = $this->context->link->getAdminLink('AdminModules') . '&module_name=' . $module->name . '&reset&tab_module=' . $module->tab;
                             $update_link = $this->context->link->getAdminLink('AdminModules') . '&checkAndUpdate=1&module_name=' . $module->name;
                             $is_reset_ready = false;
                             if (method_exists($module, 'reset')) {
                                 $is_reset_ready = true;
                             }
                             $this->context->smarty->assign(array('module_name' => $module->name, 'module_display_name' => $module->displayName, 'back_link' => $back_link, 'module_hook_link' => $hook_link, 'module_disable_link' => $disable_link, 'module_uninstall_link' => $uninstall_link, 'module_reset_link' => $reset_link, 'module_update_link' => $update_link, 'trad_link' => $trad_link, 'module_languages' => Language::getLanguages(false), 'theme_language_dir' => _THEME_LANG_DIR_, 'page_header_toolbar_title' => $this->page_header_toolbar_title, 'page_header_toolbar_btn' => $this->page_header_toolbar_btn, 'add_permission' => $this->tabAccess['add'], 'is_reset_ready' => $is_reset_ready));
                             // Display checkbox in toolbar if multishop
                             if (Shop::isFeatureActive()) {
                                 if (Shop::getContext() == Shop::CONTEXT_SHOP) {
                                     $shop_context = 'shop <strong>' . $this->context->shop->name . '</strong>';
                                 } elseif (Shop::getContext() == Shop::CONTEXT_GROUP) {
                                     $shop_group = new ShopGroup((int) Shop::getContextShopGroupID());
                                     $shop_context = 'all shops of group shop <strong>' . $shop_group->name . '</strong>';
                                 } else {
                                     $shop_context = 'all shops';
                                 }
                                 $this->context->smarty->assign(array('module' => $module, 'display_multishop_checkbox' => true, 'current_url' => $this->getCurrentUrl('enable'), 'shop_context' => $shop_context));
                             }
                             $this->context->smarty->assign(array('shop_list' => Helper::renderShopList(), 'is_multishop' => Shop::isFeatureActive(), 'multishop_context' => Shop::CONTEXT_ALL | Shop::CONTEXT_GROUP | Shop::CONTEXT_SHOP));
                             if (Shop::isFeatureActive() && isset(Context::getContext()->tmpOldShop)) {
                                 Context::getContext()->shop = clone Context::getContext()->tmpOldShop;
                                 unset(Context::getContext()->tmpOldShop);
                             }
                             // Display module configuration
                             $header = $this->context->smarty->fetch('controllers/modules/configure.tpl');
                             $configuration_bar = $this->context->smarty->fetch('controllers/modules/configuration_bar.tpl');
                             $output = $header . $echo;
                             if (isset($this->_modules_ad[$module->name])) {
                                 $ad_modules = $this->getModulesByInstallation($this->_modules_ad[$module->name]);
                                 foreach ($ad_modules['not_installed'] as $key => &$module) {
                                     if (isset($module->addons_buy_url)) {
                                         $module->addons_buy_url = str_replace('utm_source=v1trunk_api', 'utm_source=back-office', $module->addons_buy_url) . '&utm_medium=related-modules&utm_campaign=back-office-' . strtoupper($this->context->language->iso_code);
                                     }
                                     if (isset($module->description_full) && trim($module->description_full) != '') {
                                         $module->show_quick_view = true;
                                     }
                                 }
                                 $this->context->smarty->assign(array('ad_modules' => $ad_modules, 'currentIndex' => self::$currentIndex));
                                 $ad_bar = $this->context->smarty->fetch('controllers/modules/ad_bar.tpl');
                                 $output .= $ad_bar;
                             }
                             $this->context->smarty->assign('module_content', $output . $configuration_bar);
                         } elseif ($echo === true) {
                             $return = 13;
开发者ID:IngenioContenidoDigital,项目名称:americana,代码行数:67,代码来源:AdminModulesController.php

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

示例10: updateLogo

 /**
  * Generic function which allows logo upload
  *
  * @param $field_name
  * @param $logo_prefix
  *
  * @return bool
  */
 protected function updateLogo($field_name, $logo_prefix)
 {
     $id_shop = Context::getContext()->shop->id;
     if (isset($_FILES[$field_name]['tmp_name']) && $_FILES[$field_name]['tmp_name'] && $_FILES[$field_name]['size']) {
         if ($error = ImageManager::validateUpload($_FILES[$field_name], Tools::getMaxUploadSize())) {
             $this->errors[] = $error;
             return false;
         }
         $tmp_name = tempnam(_PS_TMP_IMG_DIR_, 'PS');
         if (!$tmp_name || !move_uploaded_file($_FILES[$field_name]['tmp_name'], $tmp_name)) {
             return false;
         }
         $ext = $field_name == 'PS_STORES_ICON' ? '.gif' : '.jpg';
         $logo_name = Tools::link_rewrite(Context::getContext()->shop->name) . '-' . $logo_prefix . '-' . (int) Configuration::get('PS_IMG_UPDATE_TIME') . (int) $id_shop . $ext;
         if (Context::getContext()->shop->getContext() == Shop::CONTEXT_ALL || $id_shop == 0 || Shop::isFeatureActive() == false) {
             $logo_name = Tools::link_rewrite(Context::getContext()->shop->name) . '-' . $logo_prefix . '-' . (int) Configuration::get('PS_IMG_UPDATE_TIME') . $ext;
         }
         if ($field_name == 'PS_STORES_ICON') {
             if (!@ImageManager::resize($tmp_name, _PS_IMG_DIR_ . $logo_name, null, null, 'gif', true)) {
                 $this->errors[] = Tools::displayError('An error occurred while attempting to copy your logo.');
             }
         } else {
             if (!@ImageManager::resize($tmp_name, _PS_IMG_DIR_ . $logo_name)) {
                 $this->errors[] = Tools::displayError('An error occurred while attempting to copy your logo.');
             }
         }
         $id_shop = null;
         $id_shop_group = null;
         if (!count($this->errors) && @filemtime(_PS_IMG_DIR_ . Configuration::get($field_name))) {
             if (Shop::isFeatureActive()) {
                 if (Shop::getContext() == Shop::CONTEXT_SHOP) {
                     $id_shop = Shop::getContextShopID();
                     $id_shop_group = Shop::getContextShopGroupID();
                     Shop::setContext(Shop::CONTEXT_ALL);
                     $logo_all = Configuration::get($field_name);
                     Shop::setContext(Shop::CONTEXT_GROUP);
                     $logo_group = Configuration::get($field_name);
                     Shop::setContext(Shop::CONTEXT_SHOP);
                     $logo_shop = Configuration::get($field_name);
                     if ($logo_all != $logo_shop && $logo_group != $logo_shop && $logo_shop != false) {
                         @unlink(_PS_IMG_DIR_ . Configuration::get($field_name));
                     }
                 } elseif (Shop::getContext() == Shop::CONTEXT_GROUP) {
                     $id_shop_group = Shop::getContextShopGroupID();
                     Shop::setContext(Shop::CONTEXT_ALL);
                     $logo_all = Configuration::get($field_name);
                     Shop::setContext(Shop::CONTEXT_GROUP);
                     if ($logo_all != Configuration::get($field_name)) {
                         @unlink(_PS_IMG_DIR_ . Configuration::get($field_name));
                     }
                 }
             } else {
                 @unlink(_PS_IMG_DIR_ . Configuration::get($field_name));
             }
         }
         Configuration::updateValue($field_name, $logo_name, false, $id_shop_group, $id_shop);
         @unlink($tmp_name);
     }
 }
开发者ID:NathanGiesbrecht,项目名称:PrestaShopAutomationFramework,代码行数:67,代码来源:AdminThemesController.php

示例11: renderShopList

 public static function renderShopList()
 {
     if (!Shop::isFeatureActive() || Shop::getTotalShops(false, null) < 2) {
         return null;
     }
     $tree = Shop::getTree();
     $context = Context::getContext();
     // Get default value
     $shop_context = Shop::getContext();
     if ($shop_context == Shop::CONTEXT_ALL || $context->controller->multishop_context_group == false && $shop_context == Shop::CONTEXT_GROUP) {
         $value = '';
     } else {
         if ($shop_context == Shop::CONTEXT_GROUP) {
             $value = 'g-' . Shop::getContextShopGroupID();
         } else {
             $value = 's-' . Shop::getContextShopID();
         }
     }
     // Generate HTML
     $url = $_SERVER['REQUEST_URI'] . ($_SERVER['QUERY_STRING'] ? '&' : '?') . 'setShopContext=';
     $shop = new Shop(Shop::getContextShopID());
     // $html = '<a href="#"><i class="icon-home"></i> '.$shop->name.'</a>';
     $html = '<select class="shopList" onchange="location.href = \'' . htmlspecialchars($url) . '\'+$(this).val();">';
     $html .= '<option value="" class="first">' . Translate::getAdminTranslation('All shops') . '</option>';
     foreach ($tree as $gID => $group_data) {
         if (!isset($context->controller->multishop_context) || $context->controller->multishop_context & Shop::CONTEXT_GROUP) {
             $html .= '<option class="group" value="g-' . $gID . '"' . (empty($value) && $shop_context == Shop::CONTEXT_GROUP || $value == 'g-' . $gID ? ' selected="selected"' : '') . ($context->controller->multishop_context_group == false ? ' disabled="disabled"' : '') . '>' . Translate::getAdminTranslation('Group:') . ' ' . htmlspecialchars($group_data['name']) . '</option>';
         } else {
             $html .= '<optgroup class="group" label="' . Translate::getAdminTranslation('Group:') . ' ' . htmlspecialchars($group_data['name']) . '"' . ($context->controller->multishop_context_group == false ? ' disabled="disabled"' : '') . '>';
         }
         if (!isset($context->controller->multishop_context) || $context->controller->multishop_context & Shop::CONTEXT_SHOP) {
             foreach ($group_data['shops'] as $sID => $shopData) {
                 if ($shopData['active']) {
                     $html .= '<option value="s-' . $sID . '" class="shop"' . ($value == 's-' . $sID ? ' selected="selected"' : '') . '>' . ($context->controller->multishop_context_group == false ? htmlspecialchars($group_data['name']) . ' - ' : '') . $shopData['name'] . '</option>';
                 }
             }
         }
         if (!(!isset($context->controller->multishop_context) || $context->controller->multishop_context & Shop::CONTEXT_GROUP)) {
             $html .= '</optgroup>';
         }
     }
     $html .= '</select>';
     return $html;
 }
开发者ID:IngenioContenidoDigital,项目名称:americana,代码行数:44,代码来源:Helper.php

示例12: _getContextShop

 private function _getContextShop()
 {
     switch ($context_type = Shop::getContext()) {
         case Shop::CONTEXT_SHOP:
             $context_id = Shop::getContextShopID();
             break;
         case Shop::CONTEXT_GROUP:
             $context_id = Shop::getContextShopGroupID();
             break;
     }
     return array($context_type, isset($context_id) ? $context_id : null);
 }
开发者ID:anantha89,项目名称:gpprestashop,代码行数:12,代码来源:ebay.php

示例13: getConfigFieldsValues

 public function getConfigFieldsValues()
 {
     $id_shop_group = Shop::getContextShopGroupID();
     $id_shop = Shop::getContextShopID();
     return array('PAYMENTWALL_APP_KEY' => Tools::getValue('PAYMENTWALL_APP_KEY', Configuration::get('PAYMENTWALL_APP_KEY', null, $id_shop_group, $id_shop)), 'PAYMENTWALL_SECRET_KEY' => Tools::getValue('PAYMENTWALL_SECRET_KEY', Configuration::get('PAYMENTWALL_SECRET_KEY', null, $id_shop_group, $id_shop)), 'PAYMENTWALL_WIDGET_TYPE' => Tools::getValue('PAYMENTWALL_WIDGET_TYPE', Configuration::get('PAYMENTWALL_WIDGET_TYPE', null, $id_shop_group, $id_shop)), 'PAYMENTWALL_TEST_MODE' => Tools::getValue('PAYMENTWALL_TEST_MODE', Configuration::get('PAYMENTWALL_TEST_MODE', null, $id_shop_group, $id_shop)), 'PAYMENTWALL_ORDER_STATUS' => Tools::getValue('PAYMENTWALL_ORDER_STATUS', Configuration::get('PAYMENTWALL_ORDER_STATUS', null, $id_shop_group, $id_shop)));
 }
开发者ID:paymentwall,项目名称:module-prestashop,代码行数:6,代码来源:paymentwall.php

示例14: processDuplicate

 public function processDuplicate()
 {
     if (!Module::isInstalled('agilemultipleseller')) {
         parent::processDuplicate();
     } else {
         if (Validate::isLoadedObject($product = new Product((int) Tools::getValue('id_product')))) {
             $id_product_old = $product->id;
             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;
                     }
                 }
             }
             unset($product->id);
             unset($product->id_product);
             $product->indexed = 0;
             $product->active = 0;
             if ($product->add() && Category::duplicateProductCategories($id_product_old, $product->id) && ($combination_images = Product::duplicateAttributes($id_product_old, $product->id)) !== false && GroupReduction::duplicateReduction($id_product_old, $product->id) && Product::duplicateAccessories($id_product_old, $product->id) && Product::duplicateFeatures($id_product_old, $product->id) && Product::duplicateSpecificPrices($id_product_old, $product->id) && Pack::duplicate($id_product_old, $product->id) && Product::duplicateCustomizationFields($id_product_old, $product->id) && Product::duplicateTags($id_product_old, $product->id) && Product::duplicateDownload($id_product_old, $product->id)) {
                 if ($product->hasAttributes()) {
                     Product::updateDefaultAttribute($product->id);
                 }
                 AgileSellerManager::assignObjectOwner('product', $product->id, AgileSellerManager::getObjectOwnerID('product', $id_product_old));
                 if (!Tools::getValue('noimage') && !Image::duplicateProductImages($id_product_old, $product->id, $combination_images)) {
                     $this->errors[] = Tools::displayError('An error occurred while copying images.');
                 } else {
                     Hook::exec('actionProductAdd', array('product' => $product));
                     if (in_array($product->visibility, array('both', 'search')) && Configuration::get('PS_SEARCH_INDEXATION')) {
                         Search::indexation(false, $product->id);
                     }
                     $this->redirect_after = self::$currentIndex . (Tools::getIsset('id_category') ? '&id_category=' . (int) Tools::getValue('id_category') : '') . '&conf=19&token=' . $this->token;
                 }
             } else {
                 $this->errors[] = Tools::displayError('An error occurred while creating an object.');
             }
         }
     }
 }
开发者ID:evilscripts,项目名称:gy,代码行数:40,代码来源:AdminProductsController.php

示例15: getInfosByIdCustomer

    /**
     * Get Wishlists number products by Customer ID
     *
     * @return array Results
     */
    public static function getInfosByIdCustomer($id_customer)
    {
        if (Shop::getContextShopID()) {
            $shop_restriction = 'AND id_shop = ' . (int) Shop::getContextShopID();
        } elseif (Shop::getContextShopGroupID()) {
            $shop_restriction = 'AND id_shop_group = ' . (int) Shop::getContextShopGroupID();
        } else {
            $shop_restriction = '';
        }
        if (!Validate::isUnsignedId($id_customer)) {
            die(Tools::displayError());
        }
        return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
		SELECT SUM(wp.`quantity`) AS nbProducts, wp.`id_wishlist`
		  FROM `' . _DB_PREFIX_ . 'wishlist_product` wp
		INNER JOIN `' . _DB_PREFIX_ . 'wishlist` w ON (w.`id_wishlist` = wp.`id_wishlist`)
		WHERE w.`id_customer` = ' . (int) $id_customer . '
		' . $shop_restriction . '
		GROUP BY w.`id_wishlist`
		ORDER BY w.`name` ASC');
    }
开发者ID:matiasmenker,项目名称:blockwishlist,代码行数:26,代码来源:WishList.php


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