本文整理汇总了PHP中CompareProduct类的典型用法代码示例。如果您正苦于以下问题:PHP CompareProduct类的具体用法?PHP CompareProduct怎么用?PHP CompareProduct使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CompareProduct类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initContent
/**
* @see FrontController::initContent()
*/
public function initContent()
{
if ($oPrediggoResult = $this->launchSearch((int) $this->oPrediggoConfig->search_nb_items)) {
if (isset($this->context->cookie->id_compare)) {
$this->context->smarty->assign('compareProducts', CompareProduct::getCompareProducts((int) $this->context->cookie->id_compare));
}
$this->context->smarty->assign(array('page_name' => 'prediggo_search_page', 'sPrediggoQuery' => $this->sQuery, 'aPrediggoProducts' => $this->oPrediggoCall->getProducts($oPrediggoResult, (int) $this->context->cookie->id_lang), 'aDidYouMeanWords' => $oPrediggoResult->getDidYouMeanWords(), 'aSortingOptions' => $oPrediggoResult->getSortingOptions(), 'aCancellableFiltersGroups' => $oPrediggoResult->getCancellableFiltersGroups(), 'aDrillDownGroups' => $oPrediggoResult->getDrillDownGroups(), 'aChangePageLinks' => $oPrediggoResult->getChangePageLinks(), 'oSearchStatistics' => $oPrediggoResult->getSearchStatistics(), 'bSearchandizingActive' => $this->oPrediggoConfig->searchandizing_active, 'aCustomRedirections' => $oPrediggoResult->getCustomRedirections(), 'comparator_max_item' => (int) Configuration::get('PS_COMPARATOR_MAX_ITEM'), 'sImageType' => Tools::version_compare(_PS_VERSION_, '1.5.1', '>=') ? 'home_default' : 'home', 'bRewriteEnabled' => (int) Configuration::get('PS_REWRITING_SETTINGS')));
}
parent::initContent();
$this->setTemplate('search.tpl');
}
示例2: login_customer
/**
* Logs a given customer in.
*/
public static function login_customer($id_customer)
{
// Make sure that that the customers exists.
$sql = "SELECT * FROM `" . _DB_PREFIX_ . "customer` WHERE `id_customer` = '" . pSQL($id_customer) . "'";
$result = Db::getInstance()->GetRow($sql);
// The user account has been found!
if (!empty($result['id_customer'])) {
// See => CustomerCore::getByEmail
$customer = new Customer();
$customer->id = $result['id_customer'];
foreach ($result as $key => $value) {
if (key_exists($key, $customer)) {
$customer->{$key} = $value;
}
}
// See => AuthControllerCore::processSubmitLogin
Hook::exec('actionBeforeAuthentication');
$context = Context::getContext();
$context->cookie->id_compare = isset($context->cookie->id_compare) ? $context->cookie->id_compare : CompareProduct::getIdCompareByIdCustomer($customer->id);
$context->cookie->id_customer = (int) $customer->id;
$context->cookie->customer_lastname = $customer->lastname;
$context->cookie->customer_firstname = $customer->firstname;
$context->cookie->logged = 1;
$customer->logged = 1;
$context->cookie->is_guest = $customer->isGuest();
$context->cookie->passwd = $customer->passwd;
$context->cookie->email = $customer->email;
// Add customer to the context
$context->customer = $customer;
if (Configuration::get('PS_CART_FOLLOWING') && (empty($context->cookie->id_cart) || Cart::getNbProducts($context->cookie->id_cart) == 0) && ($id_cart = (int) Cart::lastNoneOrderedCart($context->customer->id))) {
$context->cart = new Cart($id_cart);
} else {
$context->cart->id_carrier = 0;
$context->cart->setDeliveryOption(null);
$context->cart->id_address_delivery = Address::getFirstCustomerAddressId((int) $customer->id);
$context->cart->id_address_invoice = Address::getFirstCustomerAddressId((int) $customer->id);
}
$context->cart->id_customer = (int) $customer->id;
$context->cart->secure_key = $customer->secure_key;
$context->cart->save();
$context->cookie->id_cart = (int) $context->cart->id;
$context->cookie->update();
$context->cart->autosetProductAddress();
Hook::exec('actionAuthentication');
// Login information have changed, so we check if the cart rules still apply
CartRule::autoRemoveFromCart($context);
CartRule::autoAddToCart($context);
// Customer is now logged in.
return true;
}
// Invalid customer specified.
return false;
}
示例3: process
public function process()
{
parent::process();
//Clean compare product table
CompareProduct::cleanCompareProducts('week');
$hasProduct = false;
if (!Configuration::get('PS_COMPARATOR_MAX_ITEM')) {
return Tools::redirect('404.php');
}
if ($product_list = Tools::getValue('compare_product_list') and $postProducts = isset($product_list) ? rtrim($product_list, '|') : '') {
$ids = array_unique(explode('|', $postProducts));
} elseif (isset(self::$cookie->id_customer)) {
$ids = CompareProduct::getCustomerCompareProducts(self::$cookie->id_customer);
} elseif (isset(self::$cookie->id_guest)) {
$ids = CompareProduct::getGuestCompareProducts(self::$cookie->id_guest);
} else {
$ids = null;
}
if ($ids) {
if (sizeof($ids) > 0) {
if (sizeof($ids) > Configuration::get('PS_COMPARATOR_MAX_ITEM')) {
$ids = array_slice($ids, 0, Configuration::get('PS_COMPARATOR_MAX_ITEM'));
}
$listProducts = array();
$listFeatures = array();
foreach ($ids as $id) {
$curProduct = new Product((int) $id, true, (int) self::$cookie->id_lang);
if (!Validate::isLoadedObject($curProduct)) {
continue;
}
if (!$curProduct->active) {
unset($ids[$k]);
continue;
}
foreach ($curProduct->getFrontFeatures(self::$cookie->id_lang) as $feature) {
$listFeatures[$curProduct->id][$feature['id_feature']] = $feature['value'];
}
$cover = Product::getCover((int) $id);
$curProduct->id_image = Tools::htmlentitiesUTF8(Product::defineProductImage(array('id_image' => $cover['id_image'], 'id_product' => $id), self::$cookie->id_lang));
$curProduct->allow_oosp = Product::isAvailableWhenOutOfStock($curProduct->out_of_stock);
$listProducts[] = $curProduct;
}
if (sizeof($listProducts) > 0) {
$width = 80 / sizeof($listProducts);
$hasProduct = true;
$ordered_features = Feature::getFeaturesForComparison($ids, self::$cookie->id_lang);
self::$smarty->assign(array('ordered_features' => $ordered_features, 'product_features' => $listFeatures, 'products' => $listProducts, 'link' => new Link(), 'width' => $width, 'homeSize' => Image::getSize('home')));
self::$smarty->assign('HOOK_EXTRA_PRODUCT_COMPARISON', Module::hookExec('extraProductComparison', array('list_ids_product' => $ids)));
}
}
}
self::$smarty->assign('hasProduct', $hasProduct);
}
示例4: preProcess
/**
* Set smarty vars
*/
public function preProcess()
{
parent::process();
if ($oPrediggoResult = $this->launchSearch((int) $this->oPrediggoSearchConfig->search_nb_items)) {
if (class_exists('CompareProduct')) {
if (method_exists('CompareProduct', 'getIdCompareByIdCustomer')) {
self::$smarty->assign('compareProducts', CompareProduct::getIdCompareByIdCustomer((int) self::$cookie->id_customer));
} elseif (isset(self::$cookie->id_customer)) {
self::$smarty->assign('compareProducts', CompareProduct::getCustomerCompareProducts((int) self::$cookie->id_customer));
} elseif (isset(self::$cookie->id_guest)) {
self::$smarty->assign('compareProducts', CompareProduct::getGuestCompareProducts((int) self::$cookie->id_guest));
}
}
self::$smarty->assign(array('page_name' => 'prediggo_search_page', 'sPrediggoQuery' => $this->sQuery, 'aPrediggoProducts' => $this->oPrediggoCall->getProducts($oPrediggoResult, (int) self::$cookie->id_lang), 'aDidYouMeanWords' => $oPrediggoResult->getDidYouMeanWords(), 'aSortingOptions' => $oPrediggoResult->getSortingOptions(), 'aCancellableFiltersGroups' => $oPrediggoResult->getCancellableFiltersGroups(), 'aDrillDownGroups' => $oPrediggoResult->getDrillDownGroups(), 'aChangePageLinks' => $oPrediggoResult->getChangePageLinks(), 'oSearchStatistics' => $oPrediggoResult->getSearchStatistics(), 'bSearchandizingActive' => $this->oPrediggoSearchConfig->searchandizing_active, 'aCustomRedirections' => $oPrediggoResult->getCustomRedirections(), 'comparator_max_item' => (int) Configuration::get('PS_COMPARATOR_MAX_ITEM')));
}
}
示例5: initContent
public function initContent()
{
parent::initContent();
if (isset($this->context->cookie->id_compare)) {
$this->context->smarty->assign('compareProducts', CompareProduct::getCompareProducts((int) $this->context->cookie->id_compare));
}
$this->productSort();
// Product sort must be called before assignProductList()
$this->assignScenes();
$this->assignSubcategories();
if ($this->category->id != 1) {
$this->assignProductList();
}
$this->context->smarty->assign(array('category' => $this->category, 'products' => isset($this->cat_products) && $this->cat_products ? $this->cat_products : null, 'id_category' => (int) $this->category->id, 'id_category_parent' => (int) $this->category->id_parent, 'return_category_name' => Tools::safeOutput($this->category->name), 'path' => Tools::getPath($this->category->id), 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), 'categorySize' => Image::getSize('category'), 'mediumSize' => Image::getSize('medium'), 'thumbSceneSize' => Image::getSize('thumb_scene'), 'homeSize' => Image::getSize('home'), 'allow_oosp' => (int) Configuration::get('PS_ORDER_OUT_OF_STOCK'), 'comparator_max_item' => (int) Configuration::get('PS_COMPARATOR_MAX_ITEM'), 'suppliers' => Supplier::getSuppliers()));
$this->setTemplate(_PS_THEME_DIR_ . 'category.tpl');
}
示例6: processData
public function processData()
{
$nbProducts = $this->getProducts(NULL, NULL, NULL, $this->orderBy, $this->orderWay, true);
$this->pagination((int) $nbProducts);
self::$smarty->assign('nb_products', (int) $nbProducts);
$seller_products = $this->getProducts((int) self::$cookie->id_lang, (int) $this->p, (int) $this->n, $this->orderBy, $this->orderWay);
AgileHelper::AssignProductImgs($seller_products);
$si_1531_later = version_compare(_PS_VERSION_, '1.5.3.1', ">=");
include_once _PS_ROOT_DIR_ . "/modules/agilemultipleshop/agilemultipleshop.php";
$module = new AgileMultipleShop();
self::$smarty->assign(array('products' => (isset($seller_products) and $seller_products) ? $seller_products : NULL, 'id_location' => $this->id_location, 'agilesellerproducts_tpl' => _PS_ROOT_DIR_ . '/modules/' . (_PS_VERSION_ > '1.5' ? 'agilemultipleshop' : 'agilesellerproducts') . '/', 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), 'categorySize' => Image::getSize($si_1531_later ? ImageType::getFormatedName('category') : 'category'), 'mediumSize' => Image::getSize($si_1531_later ? ImageType::getFormatedName('medium') : 'medium'), 'thumbSceneSize' => Image::getSize($si_1531_later ? ImageType::getFormatedName('thumb_scene') : 'thumb_scene'), 'homeSize' => Image::getSize($si_1531_later ? ImageType::getFormatedName('home') : 'home'), 'path' => $module->getL('Shop By Location')));
$ver = (int) str_replace(".", "", _PS_VERSION_);
if (isset(self::$cookie->id_compare)) {
self::$smarty->assign('compareProducts', CompareProduct::getCompareProducts((int) self::$cookie->id_compare));
}
self::$smarty->assign(array('seller_locations4page' => agilemultipleshop::getLocationListNV($this->location_level), 'location_level4page' => $this->location_level));
self::$smarty->assign(array('allow_oosp' => (int) Configuration::get('PS_ORDER_OUT_OF_STOCK'), 'comparator_max_item' => (int) Configuration::get('PS_COMPARATOR_MAX_ITEM')));
}
示例7: login_customer
/**
* Logs a given customer in.
*/
public static function login_customer($id_customer)
{
global $cart, $cookie;
// Make sure that that the customers exists.
$sql = "SELECT * FROM `" . _DB_PREFIX_ . "customer` WHERE `id_customer` = '" . pSQL($id_customer) . "'";
$result = Db::getInstance()->GetRow($sql);
// The user account has been found!
if (!empty($result['id_customer'])) {
// See => CustomerCore::getByEmail
$customer = new Customer();
$customer->id = $result['id_customer'];
foreach ($result as $key => $value) {
if (key_exists($key, $customer)) {
$customer->{$key} = $value;
}
}
// See => AuthControllerCore
Module::hookExec('beforeAuthentication');
$cookie->id_compare = isset($cookie->id_compare) ? $cookie->id_compare : CompareProduct::getIdCompareByIdCustomer($customer->id);
$cookie->id_customer = (int) $customer->id;
$cookie->customer_lastname = $customer->lastname;
$cookie->customer_firstname = $customer->firstname;
$cookie->passwd = $customer->passwd;
$cookie->logged = 1;
$cookie->email = $customer->email;
$cookie->is_guest = $customer->isGuest();
if (Configuration::get('PS_CART_FOLLOWING') and (empty($cookie->id_cart) or Cart::getNbProducts($cookie->id_cart) == 0)) {
$cookie->id_cart = (int) Cart::lastNoneOrderedCart((int) $customer->id);
}
// Update cart address.
$cart->id_carrier = 0;
$cart->id_address_delivery = Address::getFirstCustomerAddressId((int) $customer->id);
$cart->id_address_invoice = Address::getFirstCustomerAddressId((int) $customer->id);
$cart->secure_key = $customer->secure_key;
$cart->update();
Module::hookExec('authentication');
// Customer is now logged in.
return true;
}
// Invalid customer specified.
return false;
}
示例8: init
public function init()
{
self::$amz_payments = new AmzPayments();
$this->isLogged = (bool) $this->context->customer->id && Customer::customerIdExistsStatic((int) $this->context->cookie->id_customer);
parent::init();
header('Cache-Control: no-cache, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
$this->display_column_left = false;
$this->display_column_right = false;
$this->service = self::$amz_payments->getService();
$this->nbProducts = $this->context->cart->nbProducts();
if (Configuration::get('PS_CATALOG_MODE')) {
$this->errors[] = Tools::displayError('This store has not accepted your new order.');
}
if ($this->nbProducts) {
if (CartRule::isFeatureActive()) {
if (Tools::isSubmit('submitAddDiscount')) {
if (!($code = trim(Tools::getValue('discount_name')))) {
$this->errors[] = Tools::displayError('You must enter a voucher code.');
} elseif (!Validate::isCleanHtml($code)) {
$this->errors[] = Tools::displayError('The voucher code is invalid.');
} else {
if (($cart_rule = new CartRule(CartRule::getIdByCode($code))) && Validate::isLoadedObject($cart_rule)) {
if ($error = $cart_rule->checkValidity($this->context, false, true)) {
$this->errors[] = $error;
} else {
$this->context->cart->addCartRule($cart_rule->id);
if (Configuration::get('PS_ORDER_PROCESS_TYPE') == 1) {
Tools::redirect('index.php?controller=order-opc&addingCartRule=1');
}
Tools::redirect('index.php?controller=order&addingCartRule=1');
}
} else {
$this->errors[] = Tools::displayError('This voucher does not exists.');
}
}
$this->context->smarty->assign(array('errors' => $this->errors, 'discount_name' => Tools::safeOutput($code)));
} elseif (($id_cart_rule = (int) Tools::getValue('deleteDiscount')) && Validate::isUnsignedId($id_cart_rule)) {
$this->context->cart->removeCartRule($id_cart_rule);
Tools::redirect('index.php?controller=order-opc');
}
}
if ($this->context->cart->isVirtualCart()) {
$this->setNoCarrier();
}
} else {
Tools::redirect('index.php?controller=order-opc');
}
$this->context->smarty->assign('back', Tools::safeOutput(Tools::getValue('back')));
if ($this->nbProducts) {
$this->context->smarty->assign('virtual_cart', $this->context->cart->isVirtualCart());
}
$this->context->smarty->assign('is_multi_address_delivery', $this->context->cart->isMultiAddressDelivery() || (int) Tools::getValue('multi-shipping') == 1);
$this->context->smarty->assign('open_multishipping_fancybox', (int) Tools::getValue('multi-shipping') == 1);
if ($this->context->cart->nbProducts()) {
if (Tools::isSubmit('ajax')) {
if (Tools::isSubmit('method')) {
switch (Tools::getValue('method')) {
case 'setsession':
$this->context->cookie->amazon_id = Tools::getValue('amazon_id');
$this->context->cookie->amz_access_token = AmzPayments::prepareCookieValueForPrestaShopUse(Tools::getValue('access_token'));
$this->context->cookie->amz_access_token_set_time = time();
if (!$this->context->customer->isLogged() && self::$amz_payments->lpa_mode != 'pay') {
$d = self::$amz_payments->requestTokenInfo(AmzPayments::prepareCookieValueForAmazonPaymentsUse($this->context->cookie->amz_access_token));
if ($d->aud != self::$amz_payments->client_id) {
error_log('auth error LPA');
die('error');
}
$d = self::$amz_payments->requestProfile(AmzPayments::prepareCookieValueForAmazonPaymentsUse($this->context->cookie->amz_access_token));
$customer_userid = $d->user_id;
$customer_name = $d->name;
$customer_email = $d->email;
if ($customers_local_id = AmazonPaymentsCustomerHelper::findByAmazonCustomerId($customer_userid)) {
Hook::exec('actionBeforeAuthentication');
$customer = new Customer();
$authentication = AmazonPaymentsCustomerHelper::getByCustomerID($customers_local_id, true, $customer);
if (isset($authentication->active) && !$authentication->active) {
exit;
} elseif (!$authentication || !$customer->id) {
exit;
} else {
$this->context->cookie->id_compare = isset($this->context->cookie->id_compare) ? $this->context->cookie->id_compare : CompareProduct::getIdCompareByIdCustomer($customer->id);
$this->context->cookie->id_customer = (int) $customer->id;
$this->context->cookie->customer_lastname = $customer->lastname;
$this->context->cookie->customer_firstname = $customer->firstname;
$this->context->cookie->logged = 1;
$customer->logged = 1;
$this->context->cookie->is_guest = $customer->isGuest();
$this->context->cookie->passwd = $customer->passwd;
$this->context->cookie->email = $customer->email;
// Add customer to the context
$this->context->customer = $customer;
if (Configuration::get('PS_CART_FOLLOWING') && (empty($this->context->cookie->id_cart) || Cart::getNbProducts($this->context->cookie->id_cart) == 0) && ($id_cart = (int) Cart::lastNoneOrderedCart($this->context->customer->id))) {
$this->context->cart = new Cart($id_cart);
} else {
$id_carrier = (int) $this->context->cart->id_carrier;
$this->context->cart->id_carrier = 0;
$this->context->cart->setDeliveryOption(null);
$this->context->cart->id_address_delivery = (int) Address::getFirstCustomerAddressId((int) $customer->id);
$this->context->cart->id_address_invoice = (int) Address::getFirstCustomerAddressId((int) $customer->id);
//.........这里部分代码省略.........
示例9: process
public function process()
{
parent::process();
if (!($id_category = (int) Tools::getValue('id_category')) or !Validate::isUnsignedId($id_category)) {
$this->errors[] = Tools::displayError('Missing category ID');
} else {
if (!Validate::isLoadedObject($this->category)) {
$this->errors[] = Tools::displayError('Category does not exist');
} elseif (!$this->category->checkAccess((int) self::$cookie->id_customer)) {
$this->errors[] = Tools::displayError('You do not have access to this category.');
} elseif (!$this->category->active) {
self::$smarty->assign('category', $this->category);
} else {
$rewrited_url = self::$link->getCategoryLink((int) $this->category->id, $this->category->link_rewrite);
/* Scenes (could be externalised to another controler if you need them */
self::$smarty->assign('scenes', Scene::getScenes((int) $this->category->id, (int) self::$cookie->id_lang, true, false));
/* Scenes images formats */
if ($sceneImageTypes = ImageType::getImagesTypes('scenes')) {
foreach ($sceneImageTypes as $sceneImageType) {
if ($sceneImageType['name'] == 'thumb_scene') {
$thumbSceneImageType = $sceneImageType;
} elseif ($sceneImageType['name'] == 'large_scene') {
$largeSceneImageType = $sceneImageType;
}
}
self::$smarty->assign('thumbSceneImageType', isset($thumbSceneImageType) ? $thumbSceneImageType : NULL);
self::$smarty->assign('largeSceneImageType', isset($largeSceneImageType) ? $largeSceneImageType : NULL);
}
$this->category->description = nl2br2($this->category->description);
$subCategories = $this->category->getSubCategories((int) self::$cookie->id_lang);
self::$smarty->assign('category', $this->category);
if (isset($subCategories) and !empty($subCategories) and $subCategories) {
self::$smarty->assign('subcategories', $subCategories);
self::$smarty->assign(array('subcategories_nb_total' => sizeof($subCategories), 'subcategories_nb_half' => ceil(sizeof($subCategories) / 2)));
}
if ($this->category->id != 1) {
$this->productListAssign();
}
self::$smarty->assign(array('products' => (isset($this->cat_products) and $this->cat_products) ? $this->cat_products : NULL, 'id_category' => (int) $this->category->id, 'id_category_parent' => (int) $this->category->id_parent, 'return_category_name' => Tools::safeOutput($this->category->name), 'path' => Tools::getPath((int) $this->category->id), 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), 'categorySize' => Image::getSize('category'), 'mediumSize' => Image::getSize('medium'), 'thumbSceneSize' => Image::getSize('thumb_scene'), 'homeSize' => Image::getSize('home')));
if (isset(self::$cookie->id_customer)) {
self::$smarty->assign('compareProducts', CompareProduct::getCustomerCompareProducts((int) self::$cookie->id_customer));
} elseif (isset(self::$cookie->id_guest)) {
self::$smarty->assign('compareProducts', CompareProduct::getGuestCompareProducts((int) self::$cookie->id_guest));
}
}
}
self::$smarty->assign(array('allow_oosp' => (int) Configuration::get('PS_ORDER_OUT_OF_STOCK'), 'comparator_max_item' => (int) Configuration::get('PS_COMPARATOR_MAX_ITEM'), 'suppliers' => Supplier::getSuppliers()));
}
示例10: processData
public function processData()
{
$ctauohff = "nbProducts";
$lqphkm = "nbProducts";
$ysyvzjxyh = "nbProducts";
${"GLOBALS"}["dsdvggak"] = "seller_products";
${$ctauohff} = $this->getProducts(NULL, NULL, NULL, $this->orderBy, $this->orderWay, true);
${"GLOBALS"}["wfbehuenkky"] = "si_1531_later";
$this->pagination((int) ${$lqphkm});
self::$smarty->assign("nb_products", (int) ${$ysyvzjxyh});
${${"GLOBALS"}["hjmsmx"]} = $this->getProducts((int) self::$cookie->id_lang, (int) $this->p, (int) $this->n, $this->orderBy, $this->orderWay);
${"GLOBALS"}["eppbsdtlhhp"] = "si_1531_later";
AgileHelper::AssignProductImgs(${${"GLOBALS"}["dsdvggak"]});
${${"GLOBALS"}["fvpbxlqzzc"]} = version_compare(_PS_VERSION_, "1.5.3.1", ">=");
include_once _PS_ROOT_DIR_ . "/modules/agilemultipleshop/agilemultipleshop.php";
${${"GLOBALS"}["mdcknsjm"]} = new AgileMultipleShop();
self::$smarty->assign(array("products" => (isset(${${"GLOBALS"}["hjmsmx"]}) and ${${"GLOBALS"}["hjmsmx"]}) ? ${${"GLOBALS"}["hjmsmx"]} : NULL, "id_location" => $this->id_location, "agilesellerproducts_tpl" => _PS_ROOT_DIR_ . "/modules/" . (_PS_VERSION_ > "1.5" ? "agilemultipleshop" : "agilesellerproducts") . "/", "add_prod_display" => Configuration::get("PS_ATTRIBUTE_CATEGORY_DISPLAY"), "categorySize" => Image::getSize(${${"GLOBALS"}["wfbehuenkky"]} ? ImageType::getFormatedName("category") : "category"), "mediumSize" => Image::getSize(${${"GLOBALS"}["fvpbxlqzzc"]} ? ImageType::getFormatedName("medium") : "medium"), "thumbSceneSize" => Image::getSize(${${"GLOBALS"}["eppbsdtlhhp"]} ? ImageType::getFormatedName("thumb_scene") : "thumb_scene"), "homeSize" => Image::getSize(${${"GLOBALS"}["fvpbxlqzzc"]} ? ImageType::getFormatedName("home") : "home"), "path" => $module->getL("Shop By Location")));
${${"GLOBALS"}["abbgzzweqn"]} = (int) str_replace(".", "", _PS_VERSION_);
if (isset(self::$cookie->id_compare)) {
self::$smarty->assign("compareProducts", CompareProduct::getCompareProducts((int) self::$cookie->id_compare));
}
self::$smarty->assign(array("seller_locations4page" => agilemultipleshop::getLocationListNV($this->location_level), "location_level4page" => $this->location_level));
self::$smarty->assign(array("allow_oosp" => (int) Configuration::get("PS_ORDER_OUT_OF_STOCK"), "comparator_max_item" => (int) Configuration::get("PS_COMPARATOR_MAX_ITEM")));
}
示例11: processData
public function processData()
{
if (Module::isInstalled('agilemultipleshop') && Shop::$id_shop_owner > 0) {
if (!Validate::isLoadedObject($this->seller)) {
$this->errors[] = Tools::displayError('Seller does not exist');
} elseif (!$this->seller->active) {
self::$smarty->assign('seller', $this->seller);
} else {
$rewrited_url = self::$link->getAgileSellerLink((int) $this->seller->id, $this->getSellerLinkRwrite());
$this->seller_info->description = _PS_VERSION_ > '1.5' ? Tools::nl2br($this->seller_info->description) : nl2br2($this->seller_info->description);
// Setting language and language level
$language_level = explode(',', $this->seller_info->language_level);
$language = explode(',', $this->seller_info->language);
$language_array = array();
for ($x = 0; $x < count($language); $x++) {
$language_array[] = $language[$x] . ' - ' . $language_level[$x];
}
$this->seller_info->language = $language_array;
self::$smarty->assign('seller', $this->seller);
self::$smarty->assign('seller_info', $this->seller_info);
$imgPath = _PS_ROOT_DIR_ . DS . 'img' . DS . 'as' . DS . $this->seller_info->id_sellerinfo;
$licenseImg = _PS_ROOT_DIR_ . DS . 'img' . DS . 'as' . DS . $this->seller_info->id_sellerinfo . '_license';
$images = scandir($imgPath);
unset($images[0]);
unset($images[1]);
$images = array_values($images);
@($licenseDir = scandir($licenseImg));
$licenseExist = count($licenseDir) > 2 ? 1 : 0;
$this->seller_info->seller_images = $images;
$sellermodule = new AgileMultipleSeller();
$conf = Configuration::getMultiple($sellermodule->getCustomFields());
$custom_labels = $sellermodule->getCustomLabels();
self::$smarty->assign('conf', $conf);
self::$smarty->assign('custom_labels', $custom_labels);
$nbProducts = $this->getProducts(NULL, NULL, NULL, $this->orderBy, $this->orderWay, true);
$this->pagination((int) $nbProducts);
self::$smarty->assign('nb_products', (int) $nbProducts);
$seller_products = $this->getProducts((int) self::$cookie->id_lang, (int) $this->p, (int) $this->n, $this->orderBy, $this->orderWay);
AgileHelper::AssignProductImgs($seller_products);
$si_1531_later = version_compare(_PS_VERSION_, '1.5.3.1', ">=");
$HOOK_SELLER_RATINGS = '';
if (Module::isInstalled('agilesellerratings')) {
require_once _PS_ROOT_DIR_ . "/modules/agilesellerratings/agilesellerratings.php";
$rmodule = new AgileSellerRatings();
$HOOK_SELLER_RATINGS = $rmodule->getAverageRating($this->id_seller, AgileSellerRatings::RATING_TYPE_SELLER);
}
/*foreach($seller_products as $k => $v) {
$country = $v['country'];
$flagId = Country::getIdByName(1, $country);
$seller_products[$k]['img_exist'] = file_exists(_PS_ROOT_DIR_ . DS . 'flag' . DS . 'mini'. DS . $flagId . '.jpg')? 1 : 0;
$seller_products[$k]['img_name'] = $flagId . '.jpg';
}*/
foreach ($seller_products as $key => $value) {
$seller_id = $value['id_seller'];
$flagIds = self::getFlagsId($seller_id);
foreach ($flagIds as $k => $flgId) {
$seller_products[$key]['img_exist'][$k] = file_exists(_PS_ROOT_DIR_ . DS . 'flag' . DS . 'mini' . DS . $flgId . '.jpg') ? 1 : 0;
$seller_products[$key]['img_name'][$k] = $flgId . '.jpg';
}
}
// die('<pre>' . print_r($seller_products, true));
self::$smarty->assign(array('products' => (isset($seller_products) and $seller_products) ? $seller_products : NULL, 'license_exist' => $licenseExist, 'id_seller' => (int) $this->seller->id, 'path' => $this->seller_info->company, 'agilesellerproducts_tpl' => _PS_ROOT_DIR_ . "/modules/agilesellerproducts/", 'agilemultipleshop_tpl' => _PS_ROOT_DIR_ . "/modules/agilemultipleshop/", 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), 'categorySize' => Image::getSize($si_1531_later ? ImageType::getFormatedName('category') : 'category'), 'mediumSize' => Image::getSize($si_1531_later ? ImageType::getFormatedName('medium') : 'medium'), 'thumbSceneSize' => Image::getSize($si_1531_later ? ImageType::getFormatedName('thumb_scene') : 'thumb_scene'), 'homeSize' => Image::getSize($si_1531_later ? ImageType::getFormatedName('home') : 'home'), 'HOOK_SELLER_RATINGS' => $HOOK_SELLER_RATINGS, 'page_name' => 'agileseller'));
$ver = (int) str_replace(".", "", _PS_VERSION_);
if ($ver <= 1430) {
} else {
if ($ver <= 1451) {
if (isset(self::$cookie->id_customer)) {
self::$smarty->assign('compareProducts', CompareProduct::getCustomerCompareProducts((int) self::$cookie->id_customer));
} elseif (isset(self::$cookie->id_guest)) {
self::$smarty->assign('compareProducts', CompareProduct::getGuestCompareProducts((int) self::$cookie->id_guest));
}
} else {
if (isset(self::$cookie->id_compare)) {
self::$smarty->assign('compareProducts', CompareProduct::getCompareProducts((int) self::$cookie->id_compare));
}
}
}
}
self::$smarty->assign(array('allow_oosp' => (int) Configuration::get('PS_ORDER_OUT_OF_STOCK'), 'comparator_max_item' => (int) Configuration::get('PS_COMPARATOR_MAX_ITEM'), 'suppliers' => Supplier::getSuppliers()));
}
}
示例12: processLogin
private function processLogin($customer)
{
if (!Validate::isLoadedObject($customer)) {
FSLTools::returnError(Tools::displayError('Bad customer object.'));
}
Hook::exec('actionBeforeAuthentication');
$context = $this->context;
$context->cookie->id_compare = isset($context->cookie->id_compare) ? $context->cookie->id_compare : CompareProduct::getIdCompareByIdCustomer($customer->id);
$context->cookie->id_customer = (int) $customer->id;
$context->cookie->customer_lastname = $customer->lastname;
$context->cookie->customer_firstname = $customer->firstname;
$context->cookie->logged = 1;
$customer->logged = 1;
$context->cookie->is_guest = $customer->isGuest();
$context->cookie->passwd = $customer->passwd;
$context->cookie->email = $customer->email;
// Add customer to the context
$context->customer = $customer;
if (isset($context->cart)) {
if (Configuration::get('PS_CART_FOLLOWING') && (empty($context->cookie->id_cart) || Cart::getNbProducts($context->cookie->id_cart) == 0) && ($id_cart = (int) Cart::lastNoneOrderedCart($context->customer->id))) {
$context->cart = new Cart($id_cart);
} else {
$id_carrier = (int) $context->cart->id_carrier;
$context->cart->id_carrier = 0;
$context->cart->setDeliveryOption(null);
$context->cart->id_address_delivery = (int) Address::getFirstCustomerAddressId((int) $customer->id);
$context->cart->id_address_invoice = (int) Address::getFirstCustomerAddressId((int) $customer->id);
}
$context->cart->id_customer = (int) $customer->id;
$context->cart->secure_key = $customer->secure_key;
if (isset($id_carrier) && $id_carrier && Configuration::get('PS_ORDER_PROCESS_TYPE')) {
$delivery_option = array($context->cart->id_address_delivery => $id_carrier . ',');
$context->cart->setDeliveryOption($delivery_option);
}
$context->cart->save();
$context->cookie->id_cart = (int) $context->cart->id;
$context->cart->autosetProductAddress();
}
$context->cookie->write();
Hook::exec('actionAuthentication');
// Login information have changed, so we check if the cart rules still apply
CartRule::autoRemoveFromCart($context);
CartRule::autoAddToCart($context);
}
示例13: processSubmitLogin
/**
* Process login
*/
protected function processSubmitLogin()
{
Hook::exec('actionBeforeAuthentication');
$passwd = trim(Tools::getValue('passwd'));
$_POST['passwd'] = null;
$email = trim(Tools::getValue('email'));
if (empty($email)) {
$this->errors[] = Tools::displayError('An email address required.');
} elseif (!Validate::isEmail($email)) {
$this->errors[] = Tools::displayError('Invalid email address.');
} elseif (empty($passwd)) {
$this->errors[] = Tools::displayError('Password is required.');
} elseif (!Validate::isPasswd($passwd)) {
$this->errors[] = Tools::displayError('Invalid password.');
} else {
$customer = new Customer();
$authentication = $customer->getByEmail(trim($email), trim($passwd));
if (isset($authentication->active) && !$authentication->active) {
$this->errors[] = Tools::displayError('Your account isn\'t available at this time, please contact us');
} elseif (!$authentication || !$customer->id) {
$this->errors[] = Tools::displayError('Authentication failed.');
} else {
$this->context->cookie->id_compare = isset($this->context->cookie->id_compare) ? $this->context->cookie->id_compare : CompareProduct::getIdCompareByIdCustomer($customer->id);
$this->context->cookie->id_customer = (int) $customer->id;
$this->context->cookie->customer_lastname = $customer->lastname;
$this->context->cookie->customer_firstname = $customer->firstname;
$this->context->cookie->logged = 1;
$customer->logged = 1;
$this->context->cookie->is_guest = $customer->isGuest();
$this->context->cookie->passwd = $customer->passwd;
$this->context->cookie->email = $customer->email;
// Add customer to the context
$this->context->customer = $customer;
if (Configuration::get('PS_CART_FOLLOWING') && (empty($this->context->cookie->id_cart) || Cart::getNbProducts($this->context->cookie->id_cart) == 0) && ($id_cart = (int) Cart::lastNoneOrderedCart($this->context->customer->id))) {
$this->context->cart = new Cart($id_cart);
} else {
$id_carrier = (int) $this->context->cart->id_carrier;
$this->context->cart->id_carrier = 0;
$this->context->cart->setDeliveryOption(null);
$this->context->cart->id_address_delivery = (int) Address::getFirstCustomerAddressId((int) $customer->id);
$this->context->cart->id_address_invoice = (int) Address::getFirstCustomerAddressId((int) $customer->id);
}
$this->context->cart->id_customer = (int) $customer->id;
$this->context->cart->secure_key = $customer->secure_key;
if ($this->ajax && isset($id_carrier) && $id_carrier && Configuration::get('PS_ORDER_PROCESS_TYPE')) {
$delivery_option = array($this->context->cart->id_address_delivery => $id_carrier . ',');
$this->context->cart->setDeliveryOption($delivery_option);
}
$this->context->cart->save();
$this->context->cookie->id_cart = (int) $this->context->cart->id;
$this->context->cookie->write();
$this->context->cart->autosetProductAddress();
Hook::exec('actionAuthentication', array('customer' => $this->context->customer));
// Login information have changed, so we check if the cart rules still apply
CartRule::autoRemoveFromCart($this->context);
CartRule::autoAddToCart($this->context);
if (!$this->ajax) {
$back = Tools::getValue('back', 'my-account');
if ($back == Tools::secureReferrer($back)) {
Tools::redirect(html_entity_decode($back));
}
Tools::redirect('index.php?controller=' . ($this->authRedirection !== false ? urlencode($this->authRedirection) : $back));
}
}
}
if ($this->ajax) {
$return = array('hasError' => !empty($this->errors), 'errors' => $this->errors, 'token' => Tools::getToken(false));
$this->ajaxDie(Tools::jsonEncode($return));
} else {
$this->context->smarty->assign('authentification_error', $this->errors);
}
}
示例14: hookdisplayHeader
public function hookdisplayHeader()
{
//$imageSize = Image::getSize(ImageType::getFormatedName('home'));
//$this->context->controller->addCSS(($this->_path).'css/front-end/style.css');
$this->context->controller->addJS($this->_path . 'js/front-end/common.js');
$this->context->controller->addJS($this->_path . 'js/front-end/jquery.actual.min.js');
$this->context->smarty->assign(array('comparator_max_item' => (int) Configuration::get('PS_COMPARATOR_MAX_ITEM'), 'baseModuleUrl' => __PS_BASE_URI__ . 'modules/' . $this->name, 'imageSize' => $this->imageHomeSize, 'h_per_w' => round($this->imageHomeSize['height'] / $this->imageHomeSize['width'], 2)));
include_once _PS_CONTROLLER_DIR_ . 'front/CompareController.php';
if (!($this->compareProductIds = CompareProduct::getCompareProducts($this->context->cookie->id_compare))) {
$this->compareProductIds = array();
}
}
示例15: processData
public function processData()
{
if (Module::isInstalled('agilemultipleshop') && Shop::$id_shop_owner > 0) {
if (!Validate::isLoadedObject($this->seller)) {
$this->errors[] = Tools::displayError('Seller does not exist');
} elseif (!$this->seller->active) {
self::$smarty->assign('seller', $this->seller);
} else {
$rewrited_url = self::$link->getAgileSellerLink((int) $this->seller->id, $this->getSellerLinkRwrite());
$this->seller_info->description = _PS_VERSION_ > '1.5' ? Tools::nl2br($this->seller_info->description) : nl2br2($this->seller_info->description);
self::$smarty->assign('seller', $this->seller);
self::$smarty->assign('seller_info', $this->seller_info);
$sellermodule = new AgileMultipleSeller();
$conf = Configuration::getMultiple($sellermodule->getCustomFields());
$custom_labels = $sellermodule->getCustomLabels();
self::$smarty->assign('conf', $conf);
self::$smarty->assign('custom_labels', $custom_labels);
$nbProducts = $this->getProducts(NULL, NULL, NULL, $this->orderBy, $this->orderWay, true);
$this->pagination((int) $nbProducts);
self::$smarty->assign('nb_products', (int) $nbProducts);
$seller_products = $this->getProducts((int) self::$cookie->id_lang, (int) $this->p, (int) $this->n, $this->orderBy, $this->orderWay);
AgileHelper::AssignProductImgs($seller_products);
$si_1531_later = version_compare(_PS_VERSION_, '1.5.3.1', ">=");
$HOOK_SELLER_RATINGS = '';
if (Module::isInstalled('agilesellerratings')) {
require_once _PS_ROOT_DIR_ . "/modules/agilesellerratings/agilesellerratings.php";
$rmodule = new AgileSellerRatings();
$HOOK_SELLER_RATINGS = $rmodule->getAverageRating($this->id_seller, AgileSellerRatings::RATING_TYPE_SELLER);
}
self::$smarty->assign(array('products' => (isset($seller_products) and $seller_products) ? $seller_products : NULL, 'id_seller' => (int) $this->seller->id, 'path' => $this->seller_info->company, 'agilesellerproducts_tpl' => _PS_ROOT_DIR_ . "/modules/agilesellerproducts/", 'agilemultipleshop_tpl' => _PS_ROOT_DIR_ . "/modules/agilemultipleshop/", 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), 'categorySize' => Image::getSize($si_1531_later ? ImageType::getFormatedName('category') : 'category'), 'mediumSize' => Image::getSize($si_1531_later ? ImageType::getFormatedName('medium') : 'medium'), 'thumbSceneSize' => Image::getSize($si_1531_later ? ImageType::getFormatedName('thumb_scene') : 'thumb_scene'), 'homeSize' => Image::getSize($si_1531_later ? ImageType::getFormatedName('home') : 'home'), 'HOOK_SELLER_RATINGS' => $HOOK_SELLER_RATINGS, 'page_name' => 'agileseller'));
$ver = (int) str_replace(".", "", _PS_VERSION_);
if ($ver <= 1430) {
} else {
if ($ver <= 1451) {
if (isset(self::$cookie->id_customer)) {
self::$smarty->assign('compareProducts', CompareProduct::getCustomerCompareProducts((int) self::$cookie->id_customer));
} elseif (isset(self::$cookie->id_guest)) {
self::$smarty->assign('compareProducts', CompareProduct::getGuestCompareProducts((int) self::$cookie->id_guest));
}
} else {
if (isset(self::$cookie->id_compare)) {
self::$smarty->assign('compareProducts', CompareProduct::getCompareProducts((int) self::$cookie->id_compare));
}
}
}
}
self::$smarty->assign(array('allow_oosp' => (int) Configuration::get('PS_ORDER_OUT_OF_STOCK'), 'comparator_max_item' => (int) Configuration::get('PS_COMPARATOR_MAX_ITEM'), 'suppliers' => Supplier::getSuppliers()));
}
}