本文整理汇总了PHP中Shop::getShopsCollection方法的典型用法代码示例。如果您正苦于以下问题:PHP Shop::getShopsCollection方法的具体用法?PHP Shop::getShopsCollection怎么用?PHP Shop::getShopsCollection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Shop
的用法示例。
在下文中一共展示了Shop::getShopsCollection方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderChoicesSelect
public function renderChoicesSelect()
{
$spacer = str_repeat(' ', $this->spacer_size);
$items = $this->getMenuItems();
$html = '<select multiple="multiple" id="availableItems" style="width: 300px; height: 160px;">';
$html .= '<optgroup label="' . $this->l('CMS') . '">';
$html .= $this->getCMSOptions(0, 1, $this->context->language->id, $items);
$html .= '</optgroup>';
// BEGIN SUPPLIER
$html .= '<optgroup label="' . $this->l('Supplier') . '">';
// Option to show all Suppliers
$html .= '<option value="ALLSUP0">' . $this->l('All suppliers') . '</option>';
$suppliers = Supplier::getSuppliers(false, $this->context->language->id);
foreach ($suppliers as $supplier) {
if (!in_array('SUP' . $supplier['id_supplier'], $items)) {
$html .= '<option value="SUP' . $supplier['id_supplier'] . '">' . $spacer . $supplier['name'] . '</option>';
}
}
$html .= '</optgroup>';
// BEGIN Manufacturer
$html .= '<optgroup label="' . $this->l('Manufacturer') . '">';
// Option to show all Manufacturers
$html .= '<option value="ALLMAN0">' . $this->l('All manufacturers') . '</option>';
$manufacturers = Manufacturer::getManufacturers(false, $this->context->language->id);
foreach ($manufacturers as $manufacturer) {
if (!in_array('MAN' . $manufacturer['id_manufacturer'], $items)) {
$html .= '<option value="MAN' . $manufacturer['id_manufacturer'] . '">' . $spacer . $manufacturer['name'] . '</option>';
}
}
$html .= '</optgroup>';
// BEGIN Categories
$shop = new Shop((int) Shop::getContextShopID());
$html .= '<optgroup label="' . $this->l('Categories') . '">';
$shops_to_get = Shop::getContextListShopID();
foreach ($shops_to_get as $shop_id) {
$html .= $this->generateCategoriesOption($this->customGetNestedCategories($shop_id, null, (int) $this->context->language->id, false), $items);
}
$html .= '</optgroup>';
// BEGIN Shops
if (Shop::isFeatureActive()) {
$html .= '<optgroup label="' . $this->l('Shops') . '">';
$shops = Shop::getShopsCollection();
foreach ($shops as $shop) {
if (!$shop->setUrl() && !$shop->getBaseURL()) {
continue;
}
if (!in_array('SHOP' . (int) $shop->id, $items)) {
$html .= '<option value="SHOP' . (int) $shop->id . '">' . $spacer . $shop->name . '</option>';
}
}
$html .= '</optgroup>';
}
// BEGIN Products
$html .= '<optgroup label="' . $this->l('Products') . '">';
$html .= '<option value="PRODUCT" style="font-style:italic">' . $spacer . $this->l('Choose product ID') . '</option>';
$html .= '</optgroup>';
// BEGIN Menu Top Links
$html .= '<optgroup label="' . $this->l('Menu Top Links') . '">';
$links = MenuTopLinks::gets($this->context->language->id, null, (int) Shop::getContextShopID());
foreach ($links as $link) {
if ($link['label'] == '') {
$default_language = Configuration::get('PS_LANG_DEFAULT');
$link = MenuTopLinks::get($link['id_linksmenutop'], $default_language, (int) Shop::getContextShopID());
if (!in_array('LNK' . (int) $link[0]['id_linksmenutop'], $items)) {
$html .= '<option value="LNK' . (int) $link[0]['id_linksmenutop'] . '">' . $spacer . Tools::safeOutput($link[0]['label']) . '</option>';
}
} elseif (!in_array('LNK' . (int) $link['id_linksmenutop'], $items)) {
$html .= '<option value="LNK' . (int) $link['id_linksmenutop'] . '">' . $spacer . Tools::safeOutput($link['label']) . '</option>';
}
}
$html .= '</optgroup>';
$html .= '</select>';
return $html;
}
示例2: getContent
//.........这里部分代码省略.........
</div>
<div class="clear"> </div>
<table style="margin-left: 130px;">
<tbody>
<tr>
<td style="padding-left: 20px;">
<select multiple="multiple" id="availableItems" style="width: 300px; height: 160px;">';
// BEGIN CMS
$this->_html .= '<optgroup label="' . $this->l('CMS') . '">';
$this->getCMSOptions(0, 1, $id_lang);
$this->_html .= '</optgroup>';
// BEGIN SUPPLIER
$this->_html .= '<optgroup label="' . $this->l('Supplier') . '">';
$suppliers = Supplier::getSuppliers(false, $id_lang);
foreach ($suppliers as $supplier) {
$this->_html .= '<option value="SUP' . $supplier['id_supplier'] . '">' . $spacer . $supplier['name'] . '</option>';
}
$this->_html .= '</optgroup>';
// BEGIN Manufacturer
$this->_html .= '<optgroup label="' . $this->l('Manufacturer') . '">';
$manufacturers = Manufacturer::getManufacturers(false, $id_lang);
foreach ($manufacturers as $manufacturer) {
$this->_html .= '<option value="MAN' . $manufacturer['id_manufacturer'] . '">' . $spacer . $manufacturer['name'] . '</option>';
}
$this->_html .= '</optgroup>';
// BEGIN Categories
$this->_html .= '<optgroup label="' . $this->l('Categories') . '">';
$this->getCategoryOption(1, (int) $id_lang, (int) Shop::getContextShopID());
$this->_html .= '</optgroup>';
// BEGIN Shops
if (Shop::isFeatureActive()) {
$this->_html .= '<optgroup label="' . $this->l('Shops') . '">';
$shops = Shop::getShopsCollection();
foreach ($shops as $shop) {
if (!$shop->setUrl() && !$shop->getBaseURL()) {
continue;
}
$this->_html .= '<option value="SHOP' . (int) $shop->id . '">' . $spacer . $shop->name . '</option>';
}
$this->_html .= '</optgroup>';
}
// BEGIN Products
$this->_html .= '<optgroup label="' . $this->l('Products') . '">';
$this->_html .= '<option value="PRODUCT" style="font-style:italic">' . $spacer . $this->l('Choose ID product') . '</option>';
$this->_html .= '</optgroup>';
// BEGIN Menu Top Links
$this->_html .= '<optgroup label="' . $this->l('Menu Top Links') . '">';
$links = MenuTopLinks_mod::gets($id_lang, null, (int) Shop::getContextShopID());
foreach ($links as $link) {
if ($link['label'] == '') {
$link = MenuTopLinks_mod::get($link['id_linksmenutop'], $default_language, (int) Shop::getContextShopID());
$this->_html .= '<option value="LNK' . (int) $link[0]['id_linksmenutop'] . '">' . $spacer . $link[0]['label'] . '</option>';
} else {
$this->_html .= '<option value="LNK' . (int) $link['id_linksmenutop'] . '">' . $spacer . $link['label'] . '</option>';
}
}
$this->_html .= '</optgroup>';
$this->_html .= '</select><br />
<br />
<a href="#" id="addItem" style="border: 1px solid rgb(170, 170, 170); margin: 2px; padding: 2px; text-align: center; display: block; text-decoration: none; background-color: rgb(250, 250, 250); color: rgb(18, 52, 86);">' . $this->l('Add') . ' >></a>
</td>
<td>
<select multiple="multiple" id="items" style="width: 300px; height: 160px;">';
$this->makeMenuOption();
$this->_html .= '</select><br/>
示例3: loadUpdateSQL
/**
* loadUpdateSQL will create default lang values when you create a new lang, based on default id lang
*
* @return bool true if succeed
*/
public function loadUpdateSQL()
{
$tables = Db::getInstance()->executeS('SHOW TABLES LIKE \'' . str_replace('_', '\\_', _DB_PREFIX_) . '%\\_lang\' ');
$langTables = array();
foreach ($tables as $table) {
foreach ($table as $t) {
if ($t != _DB_PREFIX_ . 'configuration_lang') {
$langTables[] = $t;
}
}
}
$return = true;
$shops = Shop::getShopsCollection(false);
foreach ($shops as $shop) {
/** @var Shop $shop */
$id_lang_default = Configuration::get('PS_LANG_DEFAULT', null, $shop->id_shop_group, $shop->id);
foreach ($langTables as $name) {
preg_match('#^' . preg_quote(_DB_PREFIX_) . '(.+)_lang$#i', $name, $m);
$identifier = 'id_' . $m[1];
$fields = '';
// We will check if the table contains a column "id_shop"
// If yes, we will add "id_shop" as a WHERE condition in queries copying data from default language
$shop_field_exists = $primary_key_exists = false;
$columns = Db::getInstance()->executeS('SHOW COLUMNS FROM `' . $name . '`');
foreach ($columns as $column) {
$fields .= $column['Field'] . ', ';
if ($column['Field'] == 'id_shop') {
$shop_field_exists = true;
}
if ($column['Field'] == $identifier) {
$primary_key_exists = true;
}
}
$fields = rtrim($fields, ', ');
if (!$primary_key_exists) {
continue;
}
$sql = 'INSERT IGNORE INTO `' . $name . '` (' . $fields . ') (SELECT ';
// For each column, copy data from default language
reset($columns);
foreach ($columns as $column) {
if ($identifier != $column['Field'] && $column['Field'] != 'id_lang') {
$sql .= '(
SELECT `' . bqSQL($column['Field']) . '`
FROM `' . bqSQL($name) . '` tl
WHERE tl.`id_lang` = ' . (int) $id_lang_default . '
' . ($shop_field_exists ? ' AND tl.`id_shop` = ' . (int) $shop->id : '') . '
AND tl.`' . bqSQL($identifier) . '` = `' . bqSQL(str_replace('_lang', '', $name)) . '`.`' . bqSQL($identifier) . '`
),';
} else {
$sql .= '`' . bqSQL($column['Field']) . '`,';
}
}
$sql = rtrim($sql, ', ');
$sql .= ' FROM `' . _DB_PREFIX_ . 'lang` CROSS JOIN `' . bqSQL(str_replace('_lang', '', $name)) . '`)';
$return &= Db::getInstance()->execute($sql);
}
}
return $return;
}
示例4: generateAllLinkOptions
protected function generateAllLinkOptions($selected = '')
{
$suppliers = Supplier::getSuppliers(false, false);
$manufacturers = Manufacturer::getManufacturers(false, false);
$allLink = '';
if ($selected == 'CUSTOMLINK|0') {
$allLink .= '<option selected="selected" value="CUSTOMLINK|0">' . $this->l('-- Custom Link --') . '</option>';
} else {
$allLink .= '<option value="CUSTOMLINK|0">' . $this->l('-- Custom Link --') . '</option>';
}
$allLink .= '<optgroup label="' . $this->l('Category Link') . '">' . $this->generateCategoryLinkOption(0, $selected) . '</optgroup>';
$allLink .= '<optgroup label="' . $this->l('CMS Link') . '">' . $this->generateCMSLinkOption(0, 1, false, $selected) . '</optgroup>';
$allLink .= '<optgroup label="' . $this->l('Supplier Link') . '">';
if ($selected == 'ALLSUP|0') {
$allLink .= '<option selected="selected" value="ALLSUP|0">' . $this->l('All suppliers') . '</option>';
} else {
$allLink .= '<option value="ALLSUP|0">' . $this->l('All suppliers') . '</option>';
}
foreach ($suppliers as $supplier) {
$key = 'SUP|' . $supplier['id_supplier'];
if ($key == $selected) {
$allLink .= '<option selected="selected" value="' . $key . '">|- ' . $supplier['name'] . '</option>';
} else {
$allLink .= '<option value="' . $key . '">|- ' . $supplier['name'] . '</option>';
}
}
$allLink .= '</optgroup>';
$allLink .= '<optgroup label="' . $this->l('Manufacturer Link') . '">';
if ($selected == 'ALLMAN|0') {
$allLink .= '<option selected="selected" value="ALLMAN|0">' . $this->l('All manufacturers') . '</option>';
} else {
$allLink .= '<option value="ALLMAN|0">' . $this->l('All manufacturers') . '</option>';
}
foreach ($manufacturers as $manufacturer) {
$key = 'MAN|' . $manufacturer['id_manufacturer'];
if ($key == $selected) {
$allLink .= '<option selected="selected" value="' . $key . '">|- ' . $manufacturer['name'] . '</option>';
} else {
$allLink .= '<option value="' . $key . '">|- ' . $manufacturer['name'] . '</option>';
}
}
$allLink .= '</optgroup>';
$allLink .= '<optgroup label="' . $this->l('Page Link') . '">' . $this->generatePageLinkOption(0, $selected) . '</optgroup>';
if (Shop::isFeatureActive()) {
$allLink .= '<optgroup label="' . $this->l('Shops Link') . '">';
$shops = Shop::getShopsCollection();
foreach ($shops as $shop) {
if (!$shop->setUrl() && !$shop->getBaseURL()) {
continue;
}
$key = 'SHO|' . $shop->id;
if ($key == $selected) {
$allLink .= '<option selected="selected" value="' . $key . '">' . $shop->name . '</option>';
} else {
$allLink .= '<option value="' . $key . '">' . $shop->name . '</option>';
}
}
$allLink .= '</optgroup>';
}
$allLink .= '<optgroup label="' . $this->l('Product Link') . '">';
if ($selected == 'PRODUCT|0') {
$allLink .= '<option selected value="PRODUCT|0" style="font-style:italic">' . $this->l('Choose product ID') . '</option>';
} else {
$allLink .= '<option value="PRODUCT|0" style="font-style:italic">' . $this->l('Choose product ID') . '</option>';
}
$allLink .= '</optgroup>';
return $allLink;
}
示例5: getAllLinkOptions
public function getAllLinkOptions($selected = '')
{
$suppliers = Supplier::getSuppliers(false, false);
$manufacturers = Manufacturer::getManufacturers(false, false);
$allLink = '';
if ($selected == 'CUSTOMLINK-0') {
$allLink .= '<option selected="selected" value="CUSTOMLINK-0">' . $this->l('-- Custom Link --') . '</option>';
} else {
$allLink .= '<option value="CUSTOMLINK-0">' . $this->l('-- Custom Link --') . '</option>';
}
if ($selected == 'CURRENCY-BOX') {
$allLink .= '<option selected="selected" value="CURRENCY-BOX">' . $this->l('-- Box Currency --') . '</option>';
} else {
$allLink .= '<option value="CURRENCY-BOX">' . $this->l('-- Box Currency --') . '</option>';
}
if ($selected == 'LANGUAGE-BOX') {
$allLink .= '<option selected="selected" value="LANGUAGE-BOX">' . $this->l('-- Box Languages --') . '</option>';
} else {
$allLink .= '<option value="LANGUAGE-BOX">' . $this->l('-- Box Languages --') . '</option>';
}
$allLink .= '<optgroup label="' . $this->l('Category Link') . '">' . $this->getCategoryLinkOptions(0, $selected) . '</optgroup>';
$allLink .= '<optgroup label="' . $this->l('CMS Link') . '">' . $this->getCMSOptions(0, 1, false, $selected) . '</optgroup>';
$allLink .= '<optgroup label="' . $this->l('Supplier Link') . '">';
if ($selected == 'ALLSUP-0') {
$allLink .= '<option value="ALLSUP-0">' . $this->l('All suppliers') . '</option>';
} else {
$allLink .= '<option value="ALLSUP-0">' . $this->l('All suppliers') . '</option>';
}
foreach ($suppliers as $supplier) {
$key = 'SUP-' . $supplier['id_supplier'];
if ($key == $selected) {
$allLink .= '<option selected="selected" value="' . $key . '">|- ' . $supplier['name'] . '</option>';
} else {
$allLink .= '<option value="' . $key . '">|- ' . $supplier['name'] . '</option>';
}
}
$allLink .= '</optgroup>';
$allLink .= '<optgroup label="' . $this->l('Manufacturer Link') . '">';
if ($selected == 'ALLMAN-0') {
$allLink .= '<option value="ALLMAN-0">' . $this->l('All manufacturers') . '</option>';
} else {
$allLink .= '<option value="ALLMAN-0">' . $this->l('All manufacturers') . '</option>';
}
foreach ($manufacturers as $manufacturer) {
$key = 'MAN-' . $manufacturer['id_manufacturer'];
if ($key == $selected) {
$allLink .= '<option selected="selected" value="' . $key . '">|- ' . $manufacturer['name'] . '</option>';
} else {
$allLink .= '<option value="' . $key . '">|- ' . $manufacturer['name'] . '</option>';
}
}
$allLink .= '</optgroup>';
$allLink .= '<optgroup label="' . $this->l('Page Link') . '">' . $this->getPagesOption(null, $selected) . '</optgroup>';
if (Shop::isFeatureActive()) {
$allLink .= '<optgroup label="' . $this->l('Shops Link') . '">';
$shops = Shop::getShopsCollection();
foreach ($shops as $shop) {
if (!$shop->setUrl() && !$shop->getBaseURL()) {
continue;
}
$key = 'SHO-' . $shop->id;
if ($key == $selected) {
$allLink .= '<option selected="selected" value="SHOP-' . (int) $shop->id . '">' . $shop->name . '</option>';
} else {
$allLink .= '<option value="SHOP-' . (int) $shop->id . '">' . $shop->name . '</option>';
}
}
$allLink .= '</optgroup>';
}
$allLink .= '<optgroup label="' . $this->l('Product Link') . '">';
if ($selected == 'PRODUCT-0') {
$allLink .= '<option selected value="PRODUCT-0" style="font-style:italic">' . $this->l('Choose product ID') . '</option>';
} else {
$allLink .= '<option value="PRODUCT-0" style="font-style:italic">' . $this->l('Choose product ID') . '</option>';
}
$allLink .= '</optgroup>';
return $allLink;
}
示例6: _displayForm
//.........这里部分代码省略.........
<tbody>
<tr>
<td style="padding-left: 20px;">
<select multiple="multiple" id="availableItems" style="width: 300px; height: 160px;">';
// BEGIN CMS
$this->_html .= '<optgroup label="' . $this->l('CMS') . '">';
$this->getCMSOptions(0, 1, $id_lang);
$this->_html .= '</optgroup>';
// BEGIN SUPPLIER
$this->_html .= '<optgroup label="' . $this->l('Supplier') . '">';
// Option to show all Suppliers
$this->_html .= '<option value="ALLSUP0">' . $this->l('All suppliers') . '</option>';
$suppliers = Supplier::getSuppliers(false, $id_lang);
foreach ($suppliers as $supplier) {
$this->_html .= '<option value="SUP' . $supplier['id_supplier'] . '">' . $spacer . $supplier['name'] . '</option>';
}
$this->_html .= '</optgroup>';
// BEGIN Manufacturer
$this->_html .= '<optgroup label="' . $this->l('Manufacturer') . '">';
// Option to show all Manufacturers
$this->_html .= '<option value="ALLMAN0">' . $this->l('All manufacturers') . '</option>';
$manufacturers = Manufacturer::getManufacturers(false, $id_lang);
foreach ($manufacturers as $manufacturer) {
$this->_html .= '<option value="MAN' . $manufacturer['id_manufacturer'] . '">' . $spacer . $manufacturer['name'] . '</option>';
}
$this->_html .= '</optgroup>';
// BEGIN Categories
$this->_html .= '<optgroup label="' . $this->l('Categories') . '">';
$this->getCategoryOptionLink(1, (int) $id_lang, (int) Shop::getContextShopID());
$this->_html .= '</optgroup>';
// BEGIN Shops
if (Shop::isFeatureActive()) {
$this->_html .= '<optgroup label="' . $this->l('Shops') . '">';
$shops = Shop::getShopsCollection();
foreach ($shops as $shop) {
if (!$shop->setUrl() && !$shop->getBaseURL()) {
continue;
}
$this->_html .= '<option value="SHOP' . (int) $shop->id . '">' . $spacer . $shop->name . '</option>';
}
$this->_html .= '</optgroup>';
}
// BEGIN Products
$this->_html .= '<optgroup label="' . $this->l('Products') . '">';
$this->_html .= '<option value="PRODUCT" style="font-style:italic">' . $spacer . $this->l('Choose product ID') . '</option>';
$this->_html .= '</optgroup>';
// BEGIN Menu Top Links
$this->_html .= '<optgroup label="' . $this->l('Mega menu Top Links') . '">';
$links = VegaTopLinks::gets($id_lang, null, (int) Shop::getContextShopID());
foreach ($links as $link) {
if ($link['label'] == '') {
$link = VegaTopLinks::get($link['id_linksvegatop'], $default_language, (int) Shop::getContextShopID());
$this->_html .= '<option value="LNK' . (int) $link[0]['id_linksvegatop'] . '">' . $spacer . $link[0]['label'] . '</option>';
} else {
$this->_html .= '<option value="LNK' . (int) $link['id_linksvegatop'] . '">' . $spacer . $link['label'] . '</option>';
}
}
$this->_html .= '</optgroup>';
$this->_html .= '</select><br />
<br />
<a href="#" id="addItem" style="border: 1px solid rgb(170, 170, 170); margin: 2px; padding: 2px; text-align: center; display: block; text-decoration: none; background-color: rgb(250, 250, 250); color: rgb(18, 52, 86);">' . $this->l('Add') . ' >></a>
</td>
<td>
<select multiple="multiple" id="items" style="width: 300px; height: 160px;">';
$this->makeMenuOption();
$this->_html .= '</select><br/>