本文整理汇总了PHP中Shop::getShop方法的典型用法代码示例。如果您正苦于以下问题:PHP Shop::getShop方法的具体用法?PHP Shop::getShop怎么用?PHP Shop::getShop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Shop
的用法示例。
在下文中一共展示了Shop::getShop方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showLiveEditorSetting
/**
* show live editor tools
*/
protected function showLiveEditorSetting()
{
$this->context->controller->addJS(__PS_BASE_URI__ . 'js/jquery/ui/jquery.ui.dialog.min.js');
$this->context->controller->addJS(__PS_BASE_URI__ . 'js/jquery/ui/jquery.ui.draggable.min.js');
$this->context->controller->addJS(__PS_BASE_URI__ . 'js/jquery/ui/jquery.ui.droppable.min.js');
$this->context->controller->addJS(__PS_BASE_URI__ . 'modules/leobootstrapmenu/assets/admin/form.js');
$this->context->controller->addCss(__PS_BASE_URI__ . 'modules/leobootstrapmenu/assets/admin/liveeditor.css');
$this->context->controller->addJS(__PS_BASE_URI__ . 'modules/leobootstrapmenu/assets/admin/liveeditor.js');
$tcss = _PS_ROOT_DIR_ . '/themes/' . $this->context->shop->getTheme() . '/css/modules/leobootstrapmenu/megamenu.css';
if (file_exists($tcss)) {
# validate module
$this->context->controller->addCss(_THEMES_DIR_ . $this->context->shop->getTheme() . '/css/modules/leobootstrapmenu/megamenu.css');
} else {
# validate module
$this->context->controller->addCss(__PS_BASE_URI__ . 'modules/leobootstrapmenu/megamenu.css');
}
$liveedit_action = $this->base_config_url . '&liveeditor=1&do=livesave';
$action_backlink = $this->base_config_url;
$action_widget = _MODULE_DIR_ . $this->name . '/widget.php';
$action_addwidget = $this->base_config_url . '&liveeditor=1&do=addwidget';
$ajxgenmenu = $this->base_config_url . '&liveeditor=1&do=ajxgenmenu';
$ajxmenuinfo = $this->base_config_url . '&liveeditor=1&do=ajxmenuinfo';
$id_shop = $this->context->shop->id;
$shop = Shop::getShop($id_shop);
if (!empty($shop)) {
$live_site_url = $shop['uri'];
} else {
$live_site_url = __PS_BASE_URI__;
}
$model = $this->widget;
$widgets = $model->getWidgets($id_shop);
$type_menu = array('carousel', 'categoriestabs', 'manucarousel', 'map', 'producttabs', 'tab', 'accordion', 'specialcarousel');
foreach ($widgets as $key => $widget) {
if (in_array($widget['type'], $type_menu)) {
unset($widgets[$key]);
}
}
ob_start();
$this_module = $this;
require_once dirname(__FILE__) . '/liveeditor.php';
$output = ob_get_contents();
ob_end_clean();
# validate module
unset($liveedit_action);
unset($action_backlink);
unset($action_widget);
unset($action_addwidget);
unset($ajxgenmenu);
unset($ajxmenuinfo);
unset($live_site_url);
unset($this_module);
return $output;
}
示例2: initShopContext
public function initShopContext()
{
if (!$this->context->employee->isLoggedBack()) {
return;
}
// Change shop context ?
if (Shop::isFeatureActive() && Tools::getValue('setShopContext') !== false) {
$this->context->cookie->shopContext = Tools::getValue('setShopContext');
$url = parse_url($_SERVER['REQUEST_URI']);
$query = isset($url['query']) ? $url['query'] : '';
parse_str($query, $parse_query);
unset($parse_query['setShopContext'], $parse_query['conf']);
$this->redirect_after = $url['path'] . '?' . http_build_query($parse_query, '', '&');
} elseif (!Shop::isFeatureActive()) {
$this->context->cookie->shopContext = 's-' . Configuration::get('PS_SHOP_DEFAULT');
} elseif (Shop::getTotalShops(false, null) < 2) {
$this->context->cookie->shopContext = 's-' . $this->context->employee->getDefaultShopID();
}
$shop_id = '';
Shop::setContext(Shop::CONTEXT_ALL);
if ($this->context->cookie->shopContext) {
$split = explode('-', $this->context->cookie->shopContext);
if (count($split) == 2) {
if ($split[0] == 'g') {
if ($this->context->employee->hasAuthOnShopGroup($split[1])) {
Shop::setContext(Shop::CONTEXT_GROUP, $split[1]);
} else {
$shop_id = $this->context->employee->getDefaultShopID();
Shop::setContext(Shop::CONTEXT_SHOP, $shop_id);
}
} elseif (Shop::getShop($split[1]) && $this->context->employee->hasAuthOnShop($split[1])) {
$shop_id = $split[1];
Shop::setContext(Shop::CONTEXT_SHOP, $shop_id);
} else {
$shop_id = $this->context->employee->getDefaultShopID();
Shop::setContext(Shop::CONTEXT_SHOP, $shop_id);
}
}
}
// Check multishop context and set right context if need
if (!($this->multishop_context & Shop::getContext())) {
if (Shop::getContext() == Shop::CONTEXT_SHOP && !($this->multishop_context & Shop::CONTEXT_SHOP)) {
Shop::setContext(Shop::CONTEXT_GROUP, Shop::getContextShopGroupID());
}
if (Shop::getContext() == Shop::CONTEXT_GROUP && !($this->multishop_context & Shop::CONTEXT_GROUP)) {
Shop::setContext(Shop::CONTEXT_ALL);
}
}
// Replace existing shop if necessary
if (!$shop_id) {
$this->context->shop = new Shop(Configuration::get('PS_SHOP_DEFAULT'));
} elseif ($this->context->shop->id != $shop_id) {
$this->context->shop = new Shop($shop_id);
}
if ($this->context->shop->id_theme != $this->context->theme->id) {
$this->context->theme = new Theme($this->context->shop->id_theme);
}
// Replace current default country
$this->context->country = new Country((int) Configuration::get('PS_COUNTRY_DEFAULT'));
}
示例3: hookActionObjectUpdateBefore
public function hookActionObjectUpdateBefore($params)
{
// do not sync all updated object by default,
// only if certain fields are updated
self::$syncUpdatedObject = false;
$object = $params['object'];
// sync only if following fields are changed
if ($object instanceof Employee) {
$employee = new Employee();
$oldObject = $employee->getByEmail($object->email);
if ($oldObject) {
if ($object->lastname != $oldObject->lastname || $object->firstname != $oldObject->firstname || $object->email != $oldObject->email || $object->active != $oldObject->active) {
self::$syncUpdatedObject = true;
}
} else {
// sync if email change
self::$syncUpdatedObject = true;
}
} elseif ($object instanceof Shop) {
$oldShop = Shop::getShop($object->id);
if ($object->name != $oldShop['name'] || $object->active != $oldShop['active']) {
self::$syncUpdatedObject = true;
}
}
}
示例4: getCategoryOption
private function getCategoryOption($id_category = 1, $id_lang = false, $id_shop = false, $recursive = true, $link = false)
{
$html = '';
$id_lang = $id_lang ? (int) $id_lang : (int) Context::getContext()->language->id;
$category = new Category((int) $id_category, (int) $id_lang, (int) $id_shop);
if (is_null($category->id)) {
return;
}
if ($recursive) {
$children = Category::getChildren((int) $id_category, (int) $id_lang, true, (int) $id_shop);
$spacer = str_repeat(' ', 3 * (int) $category->level_depth);
}
$shop = (object) Shop::getShop((int) $category->getShopID());
if (!in_array($category->id, array(Configuration::get('PS_HOME_CATEGORY'), Configuration::get('PS_ROOT_CATEGORY')))) {
if ($link) {
$html .= '<option value="' . $this->context->link->getCategoryLink($category->id) . '">' . (isset($spacer) ? $spacer : '') . str_repeat(' ', 3 * (int) $category->level_depth) . $category->name . '</option>';
} else {
$html .= '<option value="CAT' . (int) $category->id . '">' . str_repeat(' ', 3 * (int) $category->level_depth) . $category->name . '</option>';
}
} elseif ($category->id != Configuration::get('PS_ROOT_CATEGORY')) {
$html .= '<optgroup label="' . str_repeat(' ', 3 * (int) $category->level_depth) . $category->name . '">';
}
if (isset($children) && count($children)) {
foreach ($children as $child) {
$html .= $this->getCategoryOption((int) $child['id_category'], (int) $id_lang, (int) $child['id_shop'], $recursive, $link);
}
}
return $html;
}
示例5: die
die(Tools::displayError());
}
$shop_id = '';
Shop::setContext(Shop::CONTEXT_ALL);
if (Context::getContext()->cookie->shopContext) {
$split = explode('-', Context::getContext()->cookie->shopContext);
if (count($split) == 2) {
if ($split[0] == 'g') {
if (Context::getContext()->employee->hasAuthOnShopGroup($split[1])) {
Shop::setContext(Shop::CONTEXT_GROUP, $split[1]);
} else {
$shop_id = Context::getContext()->employee->getDefaultShopID();
Shop::setContext(Shop::CONTEXT_SHOP, $shop_id);
}
} else {
if (Shop::getShop($split[1]) && Context::getContext()->employee->hasAuthOnShop($split[1])) {
$shop_id = $split[1];
Shop::setContext(Shop::CONTEXT_SHOP, $shop_id);
} else {
$shop_id = Context::getContext()->employee->getDefaultShopID();
Shop::setContext(Shop::CONTEXT_SHOP, $shop_id);
}
}
}
}
// Check multishop context and set right context if need
if (Shop::getContext()) {
if (Shop::getContext() == Shop::CONTEXT_SHOP && !Shop::CONTEXT_SHOP) {
Shop::setContext(Shop::CONTEXT_GROUP, Shop::getContextShopGroupID());
}
if (Shop::getContext() == Shop::CONTEXT_GROUP && !Shop::CONTEXT_GROUP) {
示例6: foreach
if(isset($_POST['submit'])) {
foreach($_POST AS $key => $value) {
if(in_array($key, $allowed)) {
$$key = $value;
if($common->startsWith($key, 'buy') || $common->startsWith($key, 'sell') || $common->startsWith($key, 'bundle') || $key == 'stock') {
if($value == "" || $value < 0 || empty($value)) $$key = 0;
}
if(in_array($key, $required) && empty($value) || $value == "") {
$errors[] = "The field <strong>{$key}</strong> is required.";
}
}
}
$file = $Shop->getShop($shop);
if($file == false || $file == null) {
$errors[] = "No shop with the name {$shop} was found.";
}
if(count($errors) < 1) {
$data = explode(":", $item);
$item = new Shop_Item($data[0], $data[1]);
$item->setBuy($buyprice, $bundlebuy);
$item->setSell($sellprice, $bundlesell);
$item->setStock(0, $stock);
if($Shop->addItem($item)) {
$success = "<strong>Added item</strong> ".$items->getName($data[0] . ':' . $data[1])." to <strong>{$shop}</strong> - <a href='editor.php?edit={$shop}'>view changes</a> or add another:<br />";
} else {
示例7: getCategoryOption
public function getCategoryOption($selected = null, $id_category = 1, $id_lang = false, $id_shop = false, $recursive = true)
{
$html = '';
$id_lang = $id_lang ? (int) $id_lang : (int) Context::getContext()->language->id;
$category = new Category((int) $id_category, (int) $id_lang, (int) $id_shop);
if (is_null($category->id)) {
return;
}
if ($recursive) {
$children = Category::getChildren((int) $id_category, (int) $id_lang, true, (int) $id_shop);
}
$shop = (object) Shop::getShop((int) $category->getShopID());
if ($category->id != 1) {
$html .= '<option ' . ($selected == $category->id ? 'selected="selected"' : '') . ' value="' . (int) $category->id . '">' . $category->name . '</option>';
}
if (isset($children) && count($children)) {
foreach ($children as $child) {
$html .= $this->getCategoryOption($selected, (int) $child['id_category'], (int) $id_lang, (int) $child['id_shop']);
}
}
return $html;
}
示例8: Shop
echo "<h4>Currently Under Construction...</h4>";
$shop = "";
$Shop = new Shop();
$allowed = array(
'uuid', 'name', 'world', 'creator', 'owner', 'managers', 'locationA', 'locationB', 'money', 'stock',
);
$required = array(
'uuid', 'shop', 'name', 'world', 'owner', 'locationA', 'locationB',
);
if((isset($_GET['shop']) && $_GET['shop'] != "") || (isset($_POST['shop']) && $_POST['shop'] != "")) {
$shop = (isset($_POST['shop'])) ? $_POST['shop'] : $_GET['shop'];
$exists = $Shop->getShop($shop);
$values = $Shop->readFile()->getValues();
$itemlist = $Shop->readFile()->getItems();
if(!$exists) $shop = "";
if(!$values) $shop = "";
if($shop != "") {
foreach($values AS $key => $value) {
$key = str_replace('unlimited-', '', $key);
if(in_array($key, $allowed)) {
$$key = $value;
}
}
if(isset($_POST['submit'])) {
示例9: getCategoryOption
public function getCategoryOption($id_category = 1, $selected = null, $id_lang = false, $id_shop = false, $recursive = true, $link = false)
{
$html = '';
$id_lang = $id_lang ? (int) $id_lang : (int) Context::getContext()->language->id;
$category = new Category((int) $id_category, (int) $id_lang, (int) $id_shop);
if (is_null($category->id)) {
return;
}
if ($recursive) {
$children = Category::getChildren((int) $id_category, (int) $id_lang, true, (int) $id_shop);
$spacer = str_repeat(' ', 5 * (int) $category->level_depth);
}
$shop = (object) Shop::getShop((int) $category->getShopID());
if ($category->id != 1) {
if ($link) {
$html .= '<option ' . ($selected == $category->id ? 'selected="selected" ' : '') . 'value="' . $this->context->link->getCategoryLink($category->id) . '">' . (isset($spacer) ? $spacer : '') . $category->name . '</option>';
} else {
$html .= '<option ' . ($selected == $category->id ? 'selected="selected" ' : '') . 'value="' . (int) $category->id . '">' . (isset($spacer) ? $spacer : '') . $category->name . '</option>';
}
}
if (isset($children) && count($children)) {
foreach ($children as $child) {
$html .= $this->getCategoryOption((int) $child['id_category'], $selected, (int) $id_lang, (int) $child['id_shop'], $recursive, $link);
}
}
return $html;
}
示例10: getCategoryOption
private function getCategoryOption($id_category = 1, $id_lang = false, $id_shop = false, $recursive = true)
{
$html = '';
$id_lang = $id_lang ? (int) $id_lang : (int) Context::getContext()->language->id;
$category = new Category((int) $id_category, (int) $id_lang, (int) $id_shop);
if (is_null($category->id)) {
return;
}
if ($recursive) {
$children = Category::getChildren((int) $id_category, (int) $id_lang, true, (int) $id_shop);
$spacer = '';
if ($category->level_depth > 0) {
$spacer = str_repeat('-', 2 * ((int) $category->level_depth - 1));
}
}
$shop = (object) Shop::getShop((int) $category->getShopID());
if ($category->id != Configuration::get('PS_ROOT_CATEGORY')) {
$html .= '<option value="' . (int) $category->id . '">' . $spacer . $category->name . '</option>';
}
if (isset($children) && count($children)) {
foreach ($children as $child) {
$html .= $this->getCategoryOption((int) $child['id_category'], (int) $id_lang, (int) $child['id_shop'], $recursive);
}
}
return $html;
}
示例11: getStoreUrl
private function getStoreUrl($id_shop)
{
$this->setContext();
$store_info = Shop::getShop($id_shop);
$store_url = $store_info['domain'] . $store_info['uri'];
$store_url = str_replace('http://', '', $store_url);
$store_url = str_replace('https://', '', $store_url);
preg_replace('/\\/*$/i', '', $store_url);
return $store_url;
}
示例12: generateCategoriesOption2
private function generateCategoriesOption2($categories, $frontend)
{
$return_categories = array();
foreach ($categories as $key => $category) {
$shop = (object) Shop::getShop((int) $category['id_shop']);
$return_categories[$key]['id'] = (int) $category['id_category'];
$return_categories[$key]['name'] = (!$frontend ? str_repeat(' ', $this->spacer_size * (int) $category['level_depth']) : '') . $category['name'] . ' (' . $shop->name . ')';
if (isset($category['children']) && !empty($category['children'])) {
$return_categories[$key]['children'] = $this->generateCategoriesOption2($category['children'], $frontend);
}
}
return $return_categories;
}
示例13: getFormFields
//.........这里部分代码省略.........
if (Configuration::get('PAYZEN_ONEY_CAT_MODE') == '1') {
$category = Configuration::get('PAYZEN_ONEY_COM_CAT');
} else {
$oneyCategories = @unserialize(Configuration::get('PAYZEN_ONEY_PROD_CAT'));
}
foreach ($products as $product) {
if (!isset($category)) {
// build query to get product default category
$sql = 'SELECT `id_category_default` FROM `' . _DB_PREFIX_ . 'product` WHERE `id_product` = ' . (int) $product['id_product'];
$dbCategory = Db::getInstance()->getValue($sql);
$category = $oneyCategories[$dbCategory];
}
$api->addProductRequestField($product['name'], $currency->convertAmountToInteger($product['total_wt']), $product['cart_quantity'], $product['id_product'], $category);
}
// Oney delivery options defined in admin panel
$oneyOptions = @unserialize(Configuration::get('PAYZEN_ONEY_SHIP_OPTIONS'));
// retrieve carrier ID from cart
if (isset($cart->id_carrier) && $cart->id_carrier > 0) {
$carrierId = $cart->id_carrier;
} else {
$deliveryOptionList = $cart->getDeliveryOptionList();
$deliveryOption = $cart->getDeliveryOption();
$carrierKey = $deliveryOption[$deliveryAddress->id];
foreach ($deliveryOptionList[$deliveryAddress->id][$carrierKey]['carrier_list'] as $id => $data) {
$carrierId = $id;
break;
}
}
$shopNameRegexNotAllowed = "#[^A-Z0-9ÁÀÂÄÉÈÊËÍÌÎÏÓÒÔÖÚÙÛÜÇ /'-]#ui";
if ($cart->isVirtualCart() || !isset($carrierId) || !is_array($oneyOptions) || empty($oneyOptions)) {
// No shipping options
$api->set('ship_to_type', 'ETICKET');
$api->set('ship_to_speed', 'EXPRESS');
$shop = Shop::getShop($cart->id_shop);
$api->set('ship_to_delivery_company_name', preg_replace($shopNameRegexNotAllowed, ' ', $shop['name']));
} elseif (Configuration::get('TNT_CARRIER_' . self::TNT_RELAY_POINT_PREFIX . '_ID') == $carrierId) {
$api->set('ship_to_type', 'RELAY_POINT');
$api->set('ship_to_speed', 'EXPRESS');
if ($row = Db::getInstance()->getRow("SELECT * FROM `" . _DB_PREFIX_ . "tnt_carrier_drop_off`\r\n\t\t\t\t\t\t\t\tWHERE `id_cart` = '" . $cart->id . "'")) {
$tntRelayAddress = $row['name'] . ' ' . $row['address'] . ' ' . $row['zipcode'] . ' ' . $row['city'];
$api->set('ship_to_delivery_company_name', preg_replace($shop_name_regex, ' ', $tntRelayAddress));
$api->set('ship_to_last_name', preg_replace($shop_name_regex, ' ', $row['name']));
$api->set('ship_to_street', preg_replace($shop_name_regex, ' ', $row['address']));
$api->set('ship_to_zip', $row['zipcode']);
$api->set('ship_to_city', preg_replace($shop_name_regex, ' ', $row['city']));
$api->set('ship_to_country', 'FR');
}
} else {
$deliveryType = $oneyOptions[$carrierId]['delivery_type'];
$api->set('ship_to_type', $deliveryType);
$companyName = $oneyOptions[$carrierId]['carrier_label'];
if ($deliveryType === 'RECLAIM_IN_SHOP') {
$companyName .= ' ' . $oneyOptions[$carrierId]['address'];
}
$api->set('ship_to_delivery_company_name', $companyName);
$api->set('ship_to_speed', $oneyOptions[$carrierId]['delivery_speed']);
}
$api->set('cust_status', 'PRIVATE');
// Prestashop don't manage customer type
$api->set('ship_to_status', $deliveryAddress->company != '' ? 'COMPANY' : 'PRIVATE');
$api->set('insurance_amount', '');
// not available in Prestashop by default
$api->set('tax_amount', $currency->convertAmountToInteger($cart->getOrderTotal() - $cart->getOrderTotal(false)));
$api->set('shipping_amount', $currency->convertAmountToInteger($cart->getTotalShippingCost()));
$title = Configuration::get('PAYZEN_ONEY_TITLE', $this->context->language->id);
if (!$title) {
示例14: getCategoryOption
private function getCategoryOption($id_category = 1, $id_lang = false, $id_shop = false, $recursive = true)
{
$id_lang = $id_lang ? (int) $id_lang : (int) Context::getContext()->language->id;
$category = new Category((int) $id_category, (int) $id_lang, (int) $id_shop);
if (is_null($category->id)) {
return;
}
$spacer = NULL;
if ($recursive) {
$children = Category::getChildren((int) $id_category, (int) $id_lang, true, (int) $id_shop);
$spacer = str_repeat(' ', $this->spacer_size * (int) $category->level_depth);
}
$shop = (object) Shop::getShop((int) $category->getShopID());
$cateCurrent = Configuration::get($this->name . '_list_cate');
$cateCurrent = explode(',', $cateCurrent);
$value = (int) $category->id;
if (in_array($value, $cateCurrent)) {
$this->_html .= '<option value="' . (int) $category->id . '" selected ="selected">' . (isset($spacer) ? $spacer : '') . $category->name . '</option>';
} else {
$this->_html .= '<option value="' . (int) $category->id . '">' . (isset($spacer) ? $spacer : '') . $category->name . '</option>';
}
if (isset($children) && count($children)) {
foreach ($children as $child) {
$this->getCategoryOption((int) $child['id_category'], (int) $id_lang, (int) $child['id_shop']);
}
}
}
示例15: getCategoryOption
private function getCategoryOption($id_category = 1, $id_lang = false, $id_shop = false, $recursive = true)
{
$id_lang = $id_lang ? (int) $id_lang : (int) Context::getContext()->language->id;
$category = new Category((int) $id_category, (int) $id_lang, (int) $id_shop);
if (is_null($category->id)) {
return;
}
if ($recursive) {
$children = Category::getChildren((int) $id_category, (int) $id_lang, true, (int) $id_shop);
$spacer = str_repeat(' ', $this->spacer_size * (int) $category->level_depth);
}
$shop = (object) Shop::getShop((int) $category->getShopID());
$this->_html .= '<option value="CAT' . (int) $category->id . '">' . (isset($spacer) ? $spacer : '') . $category->name . ' (' . $shop->name . ')</option>';
if (isset($children) && count($children)) {
foreach ($children as $child) {
$this->getCategoryOption((int) $child['id_category'], (int) $id_lang, (int) $child['id_shop']);
}
}
}