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


PHP Referrer::getAjaxProduct方法代码示例

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


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

示例1: define

* needs please refer to http://www.prestashop.com for more information.
*
*  @author PrestaShop SA <contact@prestashop.com>
*  @copyright  2007-2012 PrestaShop SA
*  @version  Release: $Revision: 14002 $
*  @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*/
if (!defined('PS_ADMIN_DIR')) {
    define('PS_ADMIN_DIR', getcwd() . '/..');
}
include_once PS_ADMIN_DIR . '/../config/config.inc.php';
include_once PS_ADMIN_DIR . '/init.php';
if (Tools::getValue('token') == Tools::getAdminToken('AdminReferrers' . (int) Tab::getIdFromClassName('AdminReferrers') . (int) Tools::getValue('id_employee'))) {
    if (Tools::isSubmit('ajaxProductFilter')) {
        Referrer::getAjaxProduct((int) Tools::getValue('id_referrer'), (int) Tools::getValue('id_product'), new Employee((int) Tools::getValue('id_employee')));
    } elseif (Tools::isSubmit('ajaxFillProducts')) {
        $jsonArray = array();
        $result = Db::getInstance()->ExecuteS('
		SELECT p.id_product, pl.name
		FROM ' . _DB_PREFIX_ . 'product p
		LEFT JOIN ' . _DB_PREFIX_ . 'product_lang pl ON (p.id_product = pl.id_product AND pl.id_lang = ' . (int) Tools::getValue('id_lang') . ')
		' . (Tools::getValue('filter') != 'undefined' ? 'WHERE name LIKE "%' . pSQL(Tools::getValue('filter')) . '%"' : ''));
        foreach ($result as $row) {
            $jsonArray[] = '{id_product:' . (int) $row['id_product'] . ',name:\'' . addslashes($row['name']) . '\'}';
        }
        die('[' . implode(',', $jsonArray) . ']');
    }
}
include_once dirname(__FILE__) . '/AdminStats.php';
class AdminReferrers extends AdminTab
开发者ID:nicolasjeol,项目名称:hec-ecommerce,代码行数:31,代码来源:AdminReferrers.php

示例2: postProcess

    public function postProcess()
    {
        global $cookie, $smarty;
        if (Tools::isSubmit('ajaxProductFilter')) {
            $fakeEmployee = new Employee();
            $fakeEmployee->stats_date_from = $cookie->stats_date_from;
            $fakeEmployee->stats_date_to = $cookie->stats_date_to;
            $result = Db::getInstance()->getRow('
			SELECT `id_referrer`
			FROM `' . _DB_PREFIX_ . 'referrer`
			WHERE `id_referrer` = ' . intval(Tools::getValue('id_referrer')) . ' AND `passwd` = \'' . pSQL(Tools::getValue('token')) . '\'');
            if (isset($result['id_referrer']) ? $result['id_referrer'] : false) {
                Referrer::getAjaxProduct(intval(Tools::getValue('id_referrer')), intval(Tools::getValue('id_product')), $fakeEmployee);
            }
        } elseif (Tools::isSubmit('logout_tracking')) {
            unset($cookie->tracking_id);
            unset($cookie->tracking_passwd);
            Tools::redirect('modules/trackingfront/stats.php');
        } elseif (Tools::isSubmit('submitLoginTracking')) {
            $errors = array();
            $login = trim(Tools::getValue('login'));
            $passwd = trim(Tools::getValue('passwd'));
            if (empty($login)) {
                $errors[] = $this->l('login is required');
            } elseif (!Validate::isGenericName($login)) {
                $errors[] = $this->l('invalid login');
            } elseif (empty($passwd)) {
                $errors[] = $this->l('password is required');
            } elseif (!Validate::isPasswd($passwd)) {
                $errors[] = $this->l('invalid password');
            } else {
                $passwd = Tools::encrypt($passwd);
                $result = Db::getInstance()->getRow('
				SELECT `id_referrer`
				FROM `' . _DB_PREFIX_ . 'referrer`
				WHERE `name` = \'' . pSQL($login) . '\' AND `passwd` = \'' . pSQL($passwd) . '\'');
                if (!isset($result['id_referrer']) or !($tracking_id = intval($result['id_referrer']))) {
                    $errors[] = $this->l('authentication failed');
                } else {
                    $cookie->tracking_id = $tracking_id;
                    $cookie->tracking_passwd = $passwd;
                    Tools::redirect('modules/trackingfront/stats.php');
                }
            }
            $smarty->assign('errors', $errors);
        }
        if (Tools::isSubmit('submitDatePicker')) {
            $cookie->stats_date_from = Tools::getValue('datepickerFrom');
            $cookie->stats_date_to = Tools::getValue('datepickerTo');
        }
        if (Tools::isSubmit('submitDateDay')) {
            $from = date('Y-m-d');
            $to = date('Y-m-d');
        }
        if (Tools::isSubmit('submitDateDayPrev')) {
            $yesterday = time() - 60 * 60 * 24;
            $from = date('Y-m-d', $yesterday);
            $to = date('Y-m-d', $yesterday);
        }
        if (Tools::isSubmit('submitDateMonth')) {
            $from = date('Y-m-01');
            $to = date('Y-m-t');
        }
        if (Tools::isSubmit('submitDateMonthPrev')) {
            $m = date('m') == 1 ? 12 : date('m') - 1;
            $y = $m == 12 ? date('Y') - 1 : date('Y');
            $from = $y . '-' . $m . '-01';
            $to = $y . '-' . $m . date('-t', mktime(12, 0, 0, $m, 15, $y));
        }
        if (Tools::isSubmit('submitDateYear')) {
            $from = date('Y-01-01');
            $to = date('Y-12-31');
        }
        if (Tools::isSubmit('submitDateYearPrev')) {
            $from = date('Y') - 1 . date('-01-01');
            $to = date('Y') - 1 . date('-12-31');
        }
    }
开发者ID:vincent,项目名称:theinvertebrates,代码行数:78,代码来源:trackingfront.php

示例3: define

 * @category admin
 *
 * @author PrestaShop <support@prestashop.com>
 * @copyright PrestaShop
 * @license http://www.opensource.org/licenses/osl-3.0.php Open-source licence 3.0
 * @version 1.2
 *
 */
if (!defined('PS_ADMIN_DIR')) {
    define('PS_ADMIN_DIR', getcwd() . '/..');
}
include_once PS_ADMIN_DIR . '/../config/config.inc.php';
include_once PS_ADMIN_DIR . '/init.php';
if (Tools::getValue('token') == Tools::getAdminToken('AdminReferrers' . intval(Tab::getIdFromClassName('AdminReferrers')) . intval(Tools::getValue('id_employee')))) {
    if (Tools::isSubmit('ajaxProductFilter')) {
        Referrer::getAjaxProduct(intval(Tools::getValue('id_referrer')), intval(Tools::getValue('id_product')), new Employee(intval(Tools::getValue('id_employee'))));
    } else {
        if (Tools::isSubmit('ajaxFillProducts')) {
            $jsonArray = array();
            $result = Db::getInstance()->ExecuteS('
		SELECT p.id_product, pl.name
		FROM ' . _DB_PREFIX_ . 'product p
		LEFT JOIN ' . _DB_PREFIX_ . 'product_lang pl ON (p.id_product = pl.id_product AND pl.id_lang = ' . intval(Tools::getValue('id_lang')) . ')
		' . (Tools::getValue('filter') != 'undefined' ? 'WHERE name LIKE "%' . pSQL(Tools::getValue('filter')) . '%"' : ''));
            foreach ($result as $row) {
                $jsonArray[] = '{id_product:' . intval($row['id_product']) . ',name:\'' . addslashes($row['name']) . '\'}';
            }
            die('[' . implode(',', $jsonArray) . ']');
        }
    }
}
开发者ID:sealence,项目名称:local,代码行数:31,代码来源:AdminReferrers.php


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