本文整理汇总了PHP中CompareProduct::getGuestCompareProducts方法的典型用法代码示例。如果您正苦于以下问题:PHP CompareProduct::getGuestCompareProducts方法的具体用法?PHP CompareProduct::getGuestCompareProducts怎么用?PHP CompareProduct::getGuestCompareProducts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CompareProduct
的用法示例。
在下文中一共展示了CompareProduct::getGuestCompareProducts方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例2: 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')));
}
}
示例3: 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()));
}
}
示例4: 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()));
}
示例5: 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()));
}
}