本文整理汇总了PHP中Shop类的典型用法代码示例。如果您正苦于以下问题:PHP Shop类的具体用法?PHP Shop怎么用?PHP Shop使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Shop类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: showShop
public function showShop()
{
$shop = Shop::where('user_id', Auth::user()->id)->first();
if (!$shop) {
$shop = new Shop();
$shop->user_id = Auth::user()->id;
$shop->save();
}
$items = $shop->shopItems;
$total = 0;
foreach ($items as $item) {
$total += $item->item->price;
}
return view('shop', ['items' => $items, 'total' => $total]);
}
开发者ID:yoannamiteva,项目名称:it_talents,代码行数:15,代码来源:ShopController.php
示例2: postProcess
public function postProcess()
{
// Check if cart is valid
$cart = new Cart((int) Tools::getValue('id_cart'));
if ($cart->id_customer == 0 || $cart->id_address_delivery == 0 || $cart->id_address_invoice == 0 || !$this->module->active) {
$this->returnError('Invalid cart');
}
// Check if customer exists
$customer = new Customer($cart->id_customer);
if (!Validate::isLoadedObject($customer)) {
$this->returnError('Invalid customer');
}
$currency = new Currency((int) $cart->id_currency);
$total_paid = Tools::getValue('total_paid');
$extra_vars = array('transaction_id' => Tools::getValue('transaction_id'));
// Build the validation token
$validation_token = md5(Configuration::get('MYMOD_API_CRED_SALT') . Tools::getValue('id_cart') . $total_paid . Tools::getValue('transaction_id'));
// Check validation token
if (Tools::getValue('validation_token') != $validation_token) {
$this->returnError('Invalid token');
}
// Validate order
$this->module->validateOrder($cart->id, Configuration::get('PS_OS_PAYMENT'), $total_paid, $this->module->displayName . ' API', NULL, $extra_vars, (int) $currency->id, false, $customer->secure_key);
// Redirect on order confirmation page
$shop = new Shop(Configuration::get('PS_SHOP_DEFAULT'));
$return_url = Tools::getShopProtocol() . $shop->domain . $shop->getBaseURI();
$this->returnSuccess($return_url . 'index.php?controller=order-confirmation&id_cart=' . $cart->id . '&id_module=' . $this->module->id . '&id_order=' . $this->module->currentOrder . '&key=' . $customer->secure_key);
}
开发者ID:FabienSerny,项目名称:mymodpayment,代码行数:28,代码来源:validationAPI.php
示例3: getPhotosLink
/**
* Create a link to a photo
*
* @param mixed $photo Photos object (can be an ID supplier, but deprecated)
* @param string $alias
* @param int $id_lang
* @return string
*/
public static function getPhotosLink($photo, $alias = null, $id_lang = null, $id_shop = null)
{
if (!$id_lang) {
$id_lang = Context::getContext()->language->id;
}
if ($id_shop === null) {
$shop = Context::getContext()->shop;
} else {
$shop = new Shop($id_shop);
}
$url = 'http://' . $shop->domain . $shop->getBaseURI() . $this->getLangLink($id_lang, null, $id_shop);
$dispatcher = Dispatcher::getInstance();
if (!is_object($photo)) {
if ($alias !== null && !$dispatcher->hasKeyword('photo_rule', $id_lang, 'meta_keywords', $id_shop) && !$dispatcher->hasKeyword('photo_rule', $id_lang, 'meta_title', $id_shop)) {
return $url . $dispatcher->createUrl('photo_rule', $id_lang, array('id' => (int) $photo, 'rewrite' => (string) $alias), $this->allow, '', $id_shop);
}
$photo = new Photos($photo, $id_lang);
}
// Set available keywords
$params = array();
$params['id'] = $photo->id;
$params['rewrite'] = !$alias ? $photo->link_rewrite : $alias;
$params['meta_keywords'] = Tools::str2url($photo->meta_keywords);
$params['meta_title'] = Tools::str2url($photo->meta_title);
return $url . $dispatcher->createUrl('photo_rule', $id_lang, $params, $this->allow, '', $id_shop);
}
开发者ID:rongandat,项目名称:vatfairfoot,代码行数:34,代码来源:Link.php
示例4: _getDefaultShopUrl
private function _getDefaultShopUrl()
{
if (version_compare(_PS_VERSION_, '1.5', '>')) {
$shop = new Shop(Configuration::get('PS_SHOP_DEFAULT'));
return $shop->getBaseURL();
} else {
return __PS_BASE_URI__;
}
}
开发者ID:kevindesousa,项目名称:ebay,代码行数:9,代码来源:EbayStat.php
示例5: __construct
public function __construct()
{
$this->bootstrap = true;
$this->required_database = true;
$this->required_fields = array('company', 'address2', 'postcode', 'other', 'phone', 'phone_mobile', 'vat_number', 'dni');
$this->table = 'address';
$this->className = 'Address';
$this->lang = false;
$this->addressType = 'customer';
$this->explicitSelect = true;
$this->context = Context::getContext();
$this->addRowAction('edit');
$this->addRowAction('delete');
$this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?'), 'icon' => 'icon-trash'));
$this->allow_export = true;
if (!Tools::getValue('realedit')) {
$this->deleted = true;
}
$countries = Country::getCountries($this->context->language->id);
foreach ($countries as $country) {
$this->countries_array[$country['id_country']] = $country['name'];
}
$this->fields_list = array('id_address' => array('title' => $this->l('ID'), 'align' => 'center', 'class' => 'fixed-width-xs'), 'firstname' => array('title' => $this->l('First Name'), 'filter_key' => 'a!firstname'), 'lastname' => array('title' => $this->l('Last Name'), 'filter_key' => 'a!lastname'), 'address1' => array('title' => $this->l('Address')), 'postcode' => array('title' => $this->l('Zip/Postal Code'), 'align' => 'right'), 'city' => array('title' => $this->l('City')), 'country' => array('title' => $this->l('Country'), 'type' => 'select', 'list' => $this->countries_array, 'filter_key' => 'cl!id_country'));
parent::__construct();
$this->_select = 'cl.`name` as country';
$this->_join = '
LEFT JOIN `' . _DB_PREFIX_ . 'country_lang` cl ON (cl.`id_country` = a.`id_country` AND cl.`id_lang` = ' . (int) $this->context->language->id . ')
LEFT JOIN `' . _DB_PREFIX_ . 'customer` c ON a.id_customer = c.id_customer
';
$this->_where = 'AND a.id_customer != 0 ' . Shop::addSqlRestriction(Shop::SHARE_CUSTOMER, 'c');
}
开发者ID:dev-lav,项目名称:htdocs,代码行数:31,代码来源:AdminAddressesController.php
示例6: install
public function install()
{
if (!parent::install() || !$this->registerHook('displayHome') || !$this->registerHook('displayHeader')) {
return false;
}
$res = Db::getInstance()->execute('
CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'editorial` (
`id_editorial` int(10) unsigned NOT NULL auto_increment,
`id_shop` int(10) unsigned NOT NULL ,
`body_home_logo_link` varchar(255) NOT NULL,
PRIMARY KEY (`id_editorial`))
ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8');
if ($res) {
$res &= Db::getInstance()->execute('
CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'editorial_lang` (
`id_editorial` int(10) unsigned NOT NULL,
`id_lang` int(10) unsigned NOT NULL,
`body_title` varchar(255) NOT NULL,
`body_subheading` varchar(255) NOT NULL,
`body_paragraph` text NOT NULL,
`body_logo_subheading` varchar(255) NOT NULL,
PRIMARY KEY (`id_editorial`, `id_lang`))
ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8');
}
if ($res) {
foreach (Shop::getShops(false) as $shop) {
$res &= $this->createExampleEditorial($shop['id_shop']);
}
}
if (!$res) {
$res &= $this->uninstall();
}
return $res;
}
开发者ID:FAVHYAN,项目名称:a3workout,代码行数:34,代码来源:editorial.php
示例7: 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
示例8: getOrigins
private function getOrigins($dateBetween)
{
$directLink = $this->l('Direct link');
$sql = 'SELECT http_referer
FROM ' . _DB_PREFIX_ . 'connections
WHERE 1
' . Shop::addSqlRestriction() . '
AND date_add BETWEEN ' . $dateBetween;
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->query($sql);
$websites = array($directLink => 0);
while ($row = Db::getInstance(_PS_USE_SQL_SLAVE_)->nextRow($result)) {
if (!isset($row['http_referer']) || empty($row['http_referer'])) {
++$websites[$directLink];
} else {
$website = preg_replace('/^www./', '', parse_url($row['http_referer'], PHP_URL_HOST));
if (!isset($websites[$website])) {
$websites[$website] = 1;
} else {
++$websites[$website];
}
}
}
arsort($websites);
return $websites;
}
开发者ID:ortegon000,项目名称:tienda,代码行数:25,代码来源:statsorigin.php
示例9: init
public function init()
{
if (Tools::getValue('supplier_rewrite')) {
$name_supplier = str_replace('-', '%', Tools::getValue('supplier_rewrite'));
//
// TODO:: need to core update Prestashop code and
// DB for link_rewrite for suppliers
// Should we use the Mysql FullText Index Search ??
//
$sql = 'SELECT sp.`id_supplier`
FROM `' . _DB_PREFIX_ . 'supplier` sp
LEFT JOIN `' . _DB_PREFIX_ . 'supplier_shop` s ON (sp.`id_supplier` = s.`id_supplier`)
WHERE sp.`name` LIKE \'' . $name_supplier . '\'';
if (Shop::isFeatureActive() && Shop::getContext() == Shop::CONTEXT_SHOP) {
$sql .= ' AND s.`id_shop` = ' . (int) Shop::getContextShopID();
}
$id_supplier = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);
if ($id_supplier > 0) {
$_GET['id_supplier'] = $id_supplier;
} else {
//TODO: Do we need to send 404?
header('HTTP/1.1 404 Not Found');
header('Status: 404 Not Found');
}
}
parent::init();
}
开发者ID:codingang,项目名称:PrestaShop-modules-CleanURLs,代码行数:27,代码来源:SupplierController.php
示例10: install
public function install()
{
if (Shop::isFeatureActive()) {
Shop::setContext(Shop::CONTEXT_ALL);
}
//Ajout d'un onglet à la racine du site
$parentTab = Tab::getIdFromClassName('AdminImporter');
if (empty($parentTab)) {
$parentTab = self::createTab(0, $this->name, 'EDC feeds importer', 'AdminImporter');
}
self::createTab($parentTab, $this->name, 'Import des produits', 'AdminImporterRunning');
self::createTab($parentTab, $this->name, 'Configuration', 'AdminImporterConfiguration');
self::createTab($parentTab, $this->name, 'Counter', 'AdminImporterCounter');
self::createTab($parentTab, $this->name, 'Labo', 'AdminImporterLab');
// self::createTab($parentTab, $this->name, 'CRON', 'AdminImporterCron');
Configuration::updateValue('IMPORTER_URL_FULL_FEED', 'http://graphics.edc-internet.nl/b2b_feed.php?key=[KEY]&sort=xml&type=xml&lang=[LANG]&version=2015');
Configuration::updateValue('IMPORTER_URL_NEW_PRODUCTS', 'http://graphics.edc-internet.nl/b2b_feed.php?key=[KEY]&sort=xml&type=xml&lang=[LANG]&version=2015&new=1');
Configuration::updateValue('IMPORTER_URL_STOCK', 'http://graphics.edc-internet.nl/xml/eg_xml_feed_stock.xml');
Configuration::updateValue('IMPORTER_DISCONTINUED', 'http://graphics.edc-internet.nl/xml/deleted_products.xml');
Configuration::updateValue('IMPORTER_IMPORT_CURRENT_STEP', 0);
Configuration::updateValue('IMPORTER_IMPORT_CURRENT_KEY_IN_XML', 0);
Configuration::updateValue('IMPORTER_XML_FILE', '');
Configuration::updateValue('IMPORTER_XML_COUNT');
//Créer le dossier import
if (!parent::install() || !$this->installDb()) {
return false;
}
return true;
}
开发者ID:noveni,项目名称:importmodule,代码行数:29,代码来源:importer.php
示例11: __construct
public function __construct()
{
$this->bootstrap = true;
$this->table = 'alias';
$this->className = 'Alias';
$this->lang = false;
parent::__construct();
// Alias fields
$this->addRowAction('edit');
$this->addRowAction('delete');
if (!Tools::getValue('realedit')) {
$this->deleted = false;
}
$this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?'), 'icon' => 'icon-trash'));
$this->fields_list = array('alias' => array('title' => $this->l('Aliases')), 'search' => array('title' => $this->l('Search')), 'active' => array('title' => $this->l('Status'), 'class' => 'fixed-width-sm', 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false));
// Search options
$current_file_name = array_reverse(explode('/', $_SERVER['SCRIPT_NAME']));
$cron_url = Tools::getHttpHost(true, true) . __PS_BASE_URI__ . basename(_PS_ADMIN_DIR_) . '/searchcron.php?full=1&token=' . substr(_COOKIE_KEY_, 34, 8);
list($total, $indexed) = Db::getInstance()->getRow('SELECT COUNT(*) as "0", SUM(product_shop.indexed) as "1" FROM ' . _DB_PREFIX_ . 'product p ' . Shop::addSqlAssociation('product', 'p') . ' WHERE product_shop.`visibility` IN ("both", "search") AND product_shop.`active` = 1');
$this->fields_options = array('indexation' => array('title' => $this->l('Indexing'), 'icon' => 'icon-cogs', 'info' => '<p>' . $this->l('The "indexed" products have been analyzed by PrestaShop and will appear in the results of a Front Office search.') . '<br />
' . $this->l('Indexed products') . ' <strong>' . (int) $indexed . ' / ' . (int) $total . '</strong>.
</p>
<p>' . $this->l('Building the product index may take a few minutes.') . $this->l('If your server stops before the process ends, you can resume the indexing by clicking "Add missing products."') . '</p>
<a href="searchcron.php?token=' . substr(_COOKIE_KEY_, 34, 8) . '&redirect=1" class="btn-link"><i class="icon-external-link-sign"></i> ' . $this->l('Add missing products to the index.') . '</a><br />
<a href="searchcron.php?full=1&token=' . substr(_COOKIE_KEY_, 34, 8) . '&redirect=1" class="btn-link"><i class="icon-external-link-sign"></i> ' . $this->l('Re-build the entire index.') . '</a><br /><br />
' . $this->l('You can set a cron job that will rebuild your index using the following URL:') . ' <a href="' . Tools::safeOutput($cron_url) . '"><i class="icon-external-link-sign"></i> ' . Tools::safeOutput($cron_url) . '</a>', 'fields' => array('PS_SEARCH_INDEXATION' => array('title' => $this->l('Indexing'), 'validation' => 'isBool', 'type' => 'bool', 'cast' => 'intval', 'desc' => $this->l('Enable the automatic indexing of products. If you enable this feature, the products will be indexed in the search automatically when they are saved. If the feature is disabled, you will have to index products manually by using the links provided in the field set.'))), 'submit' => array('title' => $this->l('Save'))), 'search' => array('title' => $this->l('Search'), 'icon' => 'icon-search', 'fields' => array('PS_SEARCH_AJAX' => array('title' => $this->l('Ajax search'), 'validation' => 'isBool', 'type' => 'bool', 'cast' => 'intval', 'hint' => array($this->l('Enable ajax search for your visitors.'), $this->l('With ajax search, the first 10 products matching the user query will appear in real time below the input field.'))), 'PS_INSTANT_SEARCH' => array('title' => $this->l('Instant search'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool', 'hint' => array($this->l('Enable instant search for your visitors?'), $this->l('With instant search, the results will appear immediately as the user writes a query.'))), 'PS_SEARCH_MINWORDLEN' => array('title' => $this->l('Minimum word length (in characters)'), 'hint' => $this->l('Only words this size or larger will be indexed.'), 'validation' => 'isUnsignedInt', 'type' => 'text', 'cast' => 'intval'), 'PS_SEARCH_BLACKLIST' => array('title' => $this->l('Blacklisted words'), 'validation' => 'isGenericName', 'hint' => $this->l('Please enter the index words separated by a "|".'), 'type' => 'textLang')), 'submit' => array('title' => $this->l('Save'))), 'relevance' => array('title' => $this->l('Weight'), 'icon' => 'icon-cogs', 'info' => $this->l('The "weight" represents its importance and relevance for the ranking of the products when completing a new search.') . '<br />
' . $this->l('A word with a weight of eight will have four times more value than a word with a weight of two.') . '<br /><br />
' . $this->l('We advise you to set a greater weight for words which appear in the name or reference of a product. This will allow the search results to be as precise and relevant as possible.') . '<br /><br />
' . $this->l('Setting a weight to 0 will exclude that field from search index. Re-build of the entire index is required when changing to or from 0'), 'fields' => array('PS_SEARCH_WEIGHT_PNAME' => array('title' => $this->l('Product name weight'), 'validation' => 'isUnsignedInt', 'type' => 'text', 'cast' => 'intval'), 'PS_SEARCH_WEIGHT_REF' => array('title' => $this->l('Reference weight'), 'validation' => 'isUnsignedInt', 'type' => 'text', 'cast' => 'intval'), 'PS_SEARCH_WEIGHT_SHORTDESC' => array('title' => $this->l('Short description weight'), 'validation' => 'isUnsignedInt', 'type' => 'text', 'cast' => 'intval'), 'PS_SEARCH_WEIGHT_DESC' => array('title' => $this->l('Description weight'), 'validation' => 'isUnsignedInt', 'type' => 'text', 'cast' => 'intval'), 'PS_SEARCH_WEIGHT_CNAME' => array('title' => $this->l('Category weight'), 'validation' => 'isUnsignedInt', 'type' => 'text', 'cast' => 'intval'), 'PS_SEARCH_WEIGHT_MNAME' => array('title' => $this->l('Manufacturer weight'), 'validation' => 'isUnsignedInt', 'type' => 'text', 'cast' => 'intval'), 'PS_SEARCH_WEIGHT_TAG' => array('title' => $this->l('Tags weight'), 'validation' => 'isUnsignedInt', 'type' => 'text', 'cast' => 'intval'), 'PS_SEARCH_WEIGHT_ATTRIBUTE' => array('title' => $this->l('Attributes weight'), 'validation' => 'isUnsignedInt', 'type' => 'text', 'cast' => 'intval'), 'PS_SEARCH_WEIGHT_FEATURE' => array('title' => $this->l('Features weight'), 'validation' => 'isUnsignedInt', 'type' => 'text', 'cast' => 'intval')), 'submit' => array('title' => $this->l('Save'))));
}
开发者ID:carloslastresDev,项目名称:HealthyTaiwan_UsingPrestaShop,代码行数:30,代码来源:AdminSearchConfController.php
示例12: install
public function install()
{
$e = get_headers(ERP_WS);
if ($e[0] == 'HTTP/1.1 200 OK') {
if ($this->isCurlInstalled() == false) {
$this->_errors[] = $this->l('Error while installing the module. CURL Extension is not active on your server. Please contact your server administrator.');
return false;
}
if (Shop::isFeatureActive()) {
Shop::setContext(Shop::CONTEXT_ALL);
}
if (!Configuration::hasKey('ERP_ADMIN_PARENT_ORDERS_TAB_ID')) {
Configuration::updateValue('ERP_ADMIN_PARENT_ORDERS_TAB_ID', Tab::getIdFromClassName('AdminParentOrders'));
}
if (parent::install() != false && $this->parseSQL('install.sql') != false && $this->installStockMvtReason() != false && $this->installErpTab() != false && $this->addTrashCategory() != false && $this->addOrderState($this->l('Order to the supplier')) != false && $this->registerHook('actionOrderStatusUpdate') != false && $this->registerHook('displayBackOfficeHeader') != false) {
foreach ($this->field_name_configuration as $field_name => $param) {
Configuration::updateValue(Tools::strtoupper($field_name), $param['default']);
}
// load a licence if exits
$this->loadLicenceIfExists();
// save the first install date
if (!Configuration::hasKey('ERP_FIRST_INSTALL_DATE') || Configuration::get('ERP_FIRST_INSTALL_DATE') == '' || Configuration::get('ERP_FIRST_INSTALL_DATE') == false) {
Configuration::updateValue('ERP_FIRST_INSTALL_DATE', date("Y-m-d H:i:s"));
}
return true;
}
return false;
} else {
$this->_errors[] = $this->l('Error while getting headers of WS ! Please contact the customer service.');
return false;
}
}
开发者ID:prestamodule,项目名称:erpillicopresta,代码行数:32,代码来源:erpillicopresta.php
示例13: getData
public function getData()
{
$this->_totalCount = $this->getTotalCount();
$this->query = 'SELECT m.name, SUM(od.product_quantity) as quantity, ROUND(SUM(od.product_quantity * od.product_price) / c.conversion_rate, 2) as sales
FROM ' . _DB_PREFIX_ . 'order_detail od
LEFT JOIN ' . _DB_PREFIX_ . 'product p ON (p.id_product = od.product_id)
LEFT JOIN ' . _DB_PREFIX_ . 'orders o ON (o.id_order = od.id_order)
LEFT JOIN ' . _DB_PREFIX_ . 'currency c ON (c.id_currency = o.id_currency)
LEFT JOIN ' . _DB_PREFIX_ . 'manufacturer m ON (m.id_manufacturer = p.id_manufacturer)
WHERE o.invoice_date BETWEEN ' . $this->getDate() . '
' . Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o') . '
AND o.valid = 1
AND m.id_manufacturer IS NOT NULL
GROUP BY p.id_manufacturer';
if (Validate::IsName($this->_sort)) {
$this->query .= ' ORDER BY `' . bqSQL($this->_sort) . '`';
if (isset($this->_direction) && Validate::isSortDirection($this->_direction)) {
$this->query .= ' ' . $this->_direction;
}
}
if (($this->_start === 0 || Validate::IsUnsignedInt($this->_start)) && Validate::IsUnsignedInt($this->_limit)) {
$this->query .= ' LIMIT ' . (int) $this->_start . ', ' . (int) $this->_limit;
}
$this->_values = Db::getInstance()->executeS($this->query);
}
开发者ID:jpodracky,项目名称:dogs,代码行数:25,代码来源:statsbestmanufacturers.php
示例14: renderForm
public function renderForm()
{
$this->fields_form = array('legend' => array('title' => $this->l('Stores'), 'image' => '../img/admin/home.gif'), 'input' => array(array('type' => 'text', 'label' => $this->l('Name'), 'name' => 'name', 'size' => 33, 'required' => false, 'hint' => sprintf($this->l('Allowed characters: letters, spaces and %s'), '().-'), 'desc' => $this->l('Store name (e.g. Citycentre Mall Store)')), array('type' => 'text', 'label' => $this->l('Address'), 'name' => 'address1', 'size' => 33, 'required' => true), array('type' => 'text', 'label' => $this->l('Address (2)'), 'name' => 'address2', 'size' => 33), array('type' => 'text', 'label' => $this->l('Postal Code/Zip Code'), 'name' => 'postcode', 'size' => 6, 'required' => true), array('type' => 'text', 'label' => $this->l('City'), 'name' => 'city', 'size' => 33, 'required' => true), array('type' => 'select', 'label' => $this->l('Country'), 'name' => 'id_country', 'required' => true, 'default_value' => (int) $this->context->country->id, 'options' => array('query' => Country::getCountries($this->context->language->id), 'id' => 'id_country', 'name' => 'name')), array('type' => 'select', 'label' => $this->l('State'), 'name' => 'id_state', 'required' => true, 'options' => array('id' => 'id_state', 'name' => 'name', 'query' => null)), array('type' => 'latitude', 'label' => $this->l('Latitude / Longitude'), 'name' => 'latitude', 'required' => true, 'size' => 11, 'maxlength' => 12, 'desc' => $this->l('Store coordinates (e.g. 45.265469/-47.226478)')), array('type' => 'text', 'label' => $this->l('Phone'), 'name' => 'phone', 'size' => 33), array('type' => 'text', 'label' => $this->l('Fax'), 'name' => 'fax', 'size' => 33), array('type' => 'text', 'label' => $this->l('E-mail address'), 'name' => 'email', 'size' => 33), array('type' => 'textarea', 'label' => $this->l('Note'), 'name' => 'note', 'cols' => 42, 'rows' => 4), array('type' => 'radio', 'label' => $this->l('Status'), 'name' => 'active', 'required' => false, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'active_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'active_off', 'value' => 0, 'label' => $this->l('Disabled'))), 'desc' => $this->l('Whether or not to display this store'))), 'rightCols' => array('input' => array('type' => 'file', 'label' => $this->l('Picture'), 'name' => 'image', 'desc' => $this->l('Storefront picture'))), 'submit' => array('title' => $this->l(' Save '), 'class' => 'button'));
if (Shop::isFeatureActive()) {
$this->fields_form['input'][] = array('type' => 'shop', 'label' => $this->l('Shop association:'), 'name' => 'checkBoxShopAsso');
}
if (!($obj = $this->loadObject(true))) {
return;
}
$image = ImageManager::thumbnail(_PS_STORE_IMG_DIR_ . '/' . $obj->id . '.jpg', $this->table . '_' . (int) $obj->id . '.' . $this->imageType, 350, $this->imageType, true);
$days = array();
$days[1] = $this->l('Monday');
$days[2] = $this->l('Tuesday');
$days[3] = $this->l('Wednesday');
$days[4] = $this->l('Thursday');
$days[5] = $this->l('Friday');
$days[6] = $this->l('Saturday');
$days[7] = $this->l('Sunday');
$hours = $this->getFieldValue($obj, 'hours');
if (!empty($hours)) {
$hours_unserialized = Tools::unSerialize($hours);
}
$this->fields_value = array('latitude' => $this->getFieldValue($obj, 'latitude') ? $this->getFieldValue($obj, 'latitude') : Configuration::get('PS_STORES_CENTER_LAT'), 'longitude' => $this->getFieldValue($obj, 'longitude') ? $this->getFieldValue($obj, 'longitude') : Configuration::get('PS_STORES_CENTER_LONG'), 'image' => $image ? $image : false, 'size' => $image ? filesize(_PS_STORE_IMG_DIR_ . '/' . $obj->id . '.jpg') / 1000 : false, 'days' => $days, 'hours' => isset($hours_unserialized) ? $hours_unserialized : false);
return parent::renderForm();
}
开发者ID:rrameshsat,项目名称:Prestashop,代码行数:25,代码来源:AdminStoresController.php
示例15: initFormByStatus
public function initFormByStatus()
{
$this->fields_form = array('legend' => array('title' => $this->l('By order status'), 'image' => '../img/admin/pdf.gif'), 'input' => array(array('type' => 'checkboxStatuses', 'label' => $this->l('Statuses:'), 'name' => 'id_order_state', 'values' => array('query' => OrderState::getOrderStates($this->context->language->id), 'id' => 'id_order_state', 'name' => 'name'), 'desc' => $this->l('You can also export orders which have not been charged yet.') . ' (<img src="../img/admin/charged_ko.gif" alt="" />).')), 'submit' => array('title' => $this->l('Generate PDF file by status.'), 'class' => 'button', 'id' => 'submitPrint2'));
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
SELECT COUNT(o.id_order) as nbOrders, (
SELECT oh.id_order_state
FROM ' . _DB_PREFIX_ . 'order_history oh
WHERE oh.id_order = oi.id_order
ORDER BY oh.date_add DESC, oh.id_order_history DESC
LIMIT 1
) id_order_state
FROM ' . _DB_PREFIX_ . 'order_invoice oi
LEFT JOIN ' . _DB_PREFIX_ . 'orders o ON (oi.id_order = o.id_order)
WHERE o.id_shop IN(' . implode(', ', Shop::getContextListShopID()) . ')
GROUP BY id_order_state
');
$status_stats = array();
foreach ($result as $row) {
$status_stats[$row['id_order_state']] = $row['nbOrders'];
}
$this->tpl_form_vars = array('statusStats' => $status_stats, 'style' => '');
$this->table = 'invoice_status';
$this->show_toolbar = false;
return parent::renderForm();
}
开发者ID:toufikadfab,项目名称:PrestaShop-1.5,代码行数:25,代码来源:AdminInvoicesController.php
示例16: getTaxRulesGroups
public static function getTaxRulesGroups($only_active = true)
{
return Db::getInstance()->executeS('
SELECT DISTINCT g.id_tax_rules_group, g.name, g.active
FROM `' . _DB_PREFIX_ . 'tax_rules_group` g' . Shop::addSqlAssociation('tax_rules_group', 'g') . ($only_active ? ' WHERE g.`active` = 1' : '') . '
ORDER BY name ASC');
}
开发者ID:toufikadfab,项目名称:PrestaShop-1.5,代码行数:7,代码来源:TaxRulesGroup.php
示例17: init
public function init()
{
if ($cms_rewrite = Tools::getValue('cms_rewrite')) {
$sql = 'SELECT l.`id_cms`
FROM `' . _DB_PREFIX_ . 'cms_lang` l
LEFT JOIN `' . _DB_PREFIX_ . 'cms_shop` s ON (l.`id_cms` = s.`id_cms`)
WHERE l.`link_rewrite` = \'' . pSQL(str_replace('.html', '', $cms_rewrite)) . '\'';
if (Shop::isFeatureActive() && Shop::getContext() == Shop::CONTEXT_SHOP) {
$sql .= ' AND s.`id_shop` = ' . (int) Shop::getContextShopID();
}
$id_cms = (int) Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);
if ($id_cms > 0) {
$_GET['id_cms'] = $id_cms;
}
} elseif ($cms_category_rewrite = Tools::getValue('cms_category_rewrite')) {
$sql = 'SELECT `id_cms_category`
FROM `' . _DB_PREFIX_ . 'cms_category_lang`
WHERE `link_rewrite` = \'' . pSQL($cms_category_rewrite) . '\'';
if (Shop::isFeatureActive() && Shop::getContext() == Shop::CONTEXT_SHOP) {
$sql .= ' AND s.`id_shop` = ' . (int) Shop::getContextShopID();
}
$id_cms_category = (int) Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);
if ($id_cms_category > 0) {
$_GET['id_cms_category'] = $id_cms_category;
}
}
parent::init();
}
开发者ID:Barclee,项目名称:zzCleanURLs,代码行数:28,代码来源:CmsController.php
示例18: renderList
/**
* AdminController::renderList() override
* @see AdminController::renderList()
*/
public function renderList()
{
// removes toolbar btn
$this->toolbar_btn = array();
// overrides select
$this->_select = '
CONCAT(pl.name, \' \', GROUP_CONCAT(IFNULL(al.name, \'\'), \'\')) product_name,
CONCAT(a.employee_lastname, \' \', a.employee_firstname) as employee,
mrl.name as reason,
stock.reference as product_reference,
stock.ean13 as product_ean13,
stock.upc as product_upc,
w.id_currency as id_currency,
w.name as warehouse_name';
// overrides join
$this->_join = 'INNER JOIN ' . _DB_PREFIX_ . 'stock stock ON a.id_stock = stock.id_stock
LEFT JOIN `' . _DB_PREFIX_ . 'product_lang` pl ON (
stock.id_product = pl.id_product
AND pl.id_lang = ' . (int) $this->context->language->id . Shop::addSqlRestrictionOnLang('pl') . '
)
LEFT JOIN `' . _DB_PREFIX_ . 'stock_mvt_reason_lang` mrl ON (
a.id_stock_mvt_reason = mrl.id_stock_mvt_reason
AND mrl.id_lang = ' . (int) $this->context->language->id . '
)
LEFT JOIN `' . _DB_PREFIX_ . 'warehouse` w ON (w.id_warehouse = stock.id_warehouse)
LEFT JOIN `' . _DB_PREFIX_ . 'product_attribute_combination` pac ON (pac.id_product_attribute = stock.id_product_attribute)
LEFT JOIN `' . _DB_PREFIX_ . 'attribute_lang` al ON (
al.id_attribute = pac.id_attribute
AND pac.id_product_attribute <> 0
AND al.id_lang = ' . (int) $this->context->language->id . '
)';
// overrides group
$this->_group = 'GROUP BY a.id_stock_mvt';
// overrides where depending on the warehouse
$id_warehouse = (int) $this->getCurrentWarehouseId();
if ($id_warehouse > 0) {
$this->_where = ' AND w.id_warehouse = ' . $id_warehouse;
self::$currentIndex .= '&id_warehouse=' . $id_warehouse;
}
// sets the current warehouse
$this->tpl_list_vars['current_warehouse'] = $this->getCurrentWarehouseId();
// sets the list of warehouses
$warehouses = Warehouse::getWarehouses(true);
array_unshift($warehouses, array('id_warehouse' => -1, 'name' => $this->l('All Warehouses')));
$this->tpl_list_vars['list_warehouses'] = $warehouses;
// sets toolbar
$this->initToolbar();
// renders list
$list = parent::renderList();
// if export requested
if (Tools::isSubmit('csv')) {
if (count($this->_list) > 0) {
$this->renderCSV();
die;
} else {
$this->displayWarning($this->l('There is nothing to export as a CSV.'));
}
}
return $list;
}
开发者ID:M03G,项目名称:PrestaShop,代码行数:64,代码来源:AdminStockMvtController.php
示例19: __construct
public function __construct()
{
$this->table = 'alias';
$this->className = 'Alias';
$this->lang = false;
parent::__construct();
// Alias fields
$this->addRowAction('edit');
$this->addRowAction('delete');
if (!Tools::getValue('realedit')) {
$this->deleted = false;
}
$this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?')));
$this->fields_list = array('alias' => array('title' => $this->l('Aliases'), 'width' => 'auto'), 'search' => array('title' => $this->l('Search'), 'width' => 100), 'active' => array('title' => $this->l('Status'), 'width' => 25, 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false));
// Search options
$current_file_name = array_reverse(explode('/', $_SERVER['SCRIPT_NAME']));
$cron_url = Tools::getHttpHost(true, true) . __PS_BASE_URI__ . substr($_SERVER['SCRIPT_NAME'], strlen(__PS_BASE_URI__), -strlen($current_file_name['0'])) . 'searchcron.php?full=1&token=' . substr(_COOKIE_KEY_, 34, 8);
list($total, $indexed) = Db::getInstance()->getRow('SELECT COUNT(*) as "0", SUM(product_shop.indexed) as "1" FROM ' . _DB_PREFIX_ . 'product p ' . Shop::addSqlAssociation('product', 'p'));
$this->fields_options = array('indexation' => array('title' => $this->l('Indexation'), 'icon' => 'search', 'info' => $this->l('The "indexed" products have been analyzed by PrestaShop and will appear in the results of the Front Office search.') . '<br />
' . $this->l('Indexed products:') . ' <b>' . (int) $indexed . ' / ' . (int) $total . '</b>.
</p>
<p>' . $this->l('Building the product index can take a few minutes or more.') . $this->l('If your server stops the process before it ends, you can resume the indexation by clicking "Add missing products."') . '</p>
-> <a href="searchcron.php?token=' . substr(_COOKIE_KEY_, 34, 8) . '&redirect=1" class="bold">' . $this->l('Add missing products to index.') . '</a><br />
-> <a href="searchcron.php?full=1&token=' . substr(_COOKIE_KEY_, 34, 8) . '&redirect=1" class="bold">' . $this->l('Re-build entire index.') . '</a><br /><br />
' . $this->l('You can set a cron job that will rebuild your index using the following URL:') . ' <a href="' . $cron_url . '">' . $cron_url . '</a>', 'fields' => array('PS_SEARCH_INDEXATION' => array('title' => $this->l('Indexation'), 'validation' => 'isBool', 'type' => 'bool', 'cast' => 'intval', 'desc' => $this->l('Enable automatic indexation of the products. If you enable this feature, the products will
|
请发表评论