本文整理汇总了PHP中WishList::getProductByIdCustomer方法的典型用法代码示例。如果您正苦于以下问题:PHP WishList::getProductByIdCustomer方法的具体用法?PHP WishList::getProductByIdCustomer怎么用?PHP WishList::getProductByIdCustomer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WishList
的用法示例。
在下文中一共展示了WishList::getProductByIdCustomer方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dirname
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
/* SSL Management */
$useSSL = true;
require_once dirname(__FILE__) . '/../../config/config.inc.php';
require_once dirname(__FILE__) . '/../../header.php';
require_once dirname(__FILE__) . '/WishList.php';
$token = Tools::getValue('token');
if (empty($token) === false) {
$wishlist = WishList::getByToken($token);
if (empty($result) === true || $result === false) {
$errors[] = Tools::displayError('Invalid wishlist token');
}
WishList::refreshWishList($wishlist['id_wishlist']);
$products = WishList::getProductByIdCustomer((int) $wishlist['id_wishlist'], (int) $wishlist['id_customer'], (int) $cookie->id_lang, null, true);
for ($i = 0; $i < sizeof($products); ++$i) {
$obj = new Product((int) $products[$i]['id_product'], false, (int) $cookie->id_lang);
if (!Validate::isLoadedObject($obj)) {
continue;
} else {
if ($products[$i]['id_product_attribute'] != 0 && isset($combination_imgs[$products[$i]['id_product_attribute']][0])) {
$combination_imgs = $obj->getCombinationImages((int) $cookie->id_lang);
$products[$i]['cover'] = $obj->id . '-' . $combination_imgs[$products[$i]['id_product_attribute']][0]['id_image'];
} else {
$images = $obj->getImages((int) $cookie->id_lang);
foreach ($images as $k => $image) {
if ($image['cover']) {
$products[$i]['cover'] = $obj->id . '-' . $image['id_image'];
break;
}
示例2: _displayProducts
private function _displayProducts($id_wishlist)
{
include_once dirname(__FILE__) . '/WishList.php';
$wishlist = new WishList($id_wishlist);
$products = WishList::getProductByIdCustomer($id_wishlist, $wishlist->id_customer, $this->context->language->id);
for ($i = 0; $i < sizeof($products); ++$i) {
$obj = new Product((int) $products[$i]['id_product'], false, $this->context->language->id);
if (!Validate::isLoadedObject($obj)) {
continue;
} else {
$images = $obj->getImages($this->context->language->id);
foreach ($images as $k => $image) {
if ($image['cover']) {
$products[$i]['cover'] = $obj->id . '-' . $image['id_image'];
break;
}
}
if (!isset($products[$i]['cover'])) {
$products[$i]['cover'] = $this->context->language->iso_code . '-default';
}
}
}
$this->_html .= '
<table class="table">
<thead>
<tr>
<th class="first_item" style="width:600px;">' . $this->l('Product') . '</th>
<th class="item" style="text-align:center;width:150px;">' . $this->l('Quantity') . '</th>
<th class="item" style="text-align:center;width:150px;">' . $this->l('Priority') . '</th>
</tr>
</thead>
<tbody>';
$priority = array($this->l('High'), $this->l('Medium'), $this->l('Low'));
foreach ($products as $product) {
$this->_html .= '
<tr>
<td class="first_item">
<img src="' . $this->context->link->getImageLink($product['link_rewrite'], $product['cover'], 'small') . '" alt="' . htmlentities($product['name'], ENT_COMPAT, 'UTF-8') . '" style="float:left;" />
' . $product['name'];
if (isset($product['attributes_small'])) {
$this->_html .= '<br /><i>' . htmlentities($product['attributes_small'], ENT_COMPAT, 'UTF-8') . '</i>';
}
$this->_html .= '
</td>
<td class="item" style="text-align:center;">' . (int) $product['quantity'] . '</td>
<td class="item" style="text-align:center;">' . $priority[(int) $product['priority'] % 3] . '</td>
</tr>';
}
$this->_html .= '</tbody></table>';
}
示例3: BlockWishList
$wishlist->id_shop = $context->shop->id;
$wishlist->id_shop_group = $context->shop->id_shop_group;
$wishlist->default = 1;
$mod_wishlist = new BlockWishList();
$wishlist->name = $mod_wishlist->default_wishlist_name;
$wishlist->id_customer = (int) $context->customer->id;
list($us, $s) = explode(' ', microtime());
srand($s * $us);
$wishlist->token = strtoupper(substr(sha1(uniqid(rand(), true) . _COOKIE_KEY_ . $context->customer->id), 0, 16));
$wishlist->add();
$context->cookie->id_wishlist = (int) $wishlist->id;
}
if ($add && $quantity) {
WishList::addProduct($context->cookie->id_wishlist, $context->customer->id, $id_product, $id_product_attribute, $quantity);
} else {
if ($delete) {
WishList::removeProduct($context->cookie->id_wishlist, $context->customer->id, $id_product, $id_product_attribute);
}
}
}
$context->smarty->assign('products', WishList::getProductByIdCustomer($context->cookie->id_wishlist, $context->customer->id, $context->language->id, null, true));
if (Tools::file_exists_cache(_PS_THEME_DIR_ . 'modules/blockwishlist/blockwishlist-ajax.tpl')) {
$context->smarty->display(_PS_THEME_DIR_ . 'modules/blockwishlist/blockwishlist-ajax.tpl');
} elseif (Tools::file_exists_cache(dirname(__FILE__) . '/blockwishlist-ajax.tpl')) {
$context->smarty->display(dirname(__FILE__) . '/blockwishlist-ajax.tpl');
} else {
echo $module->l('No template found', 'cart');
}
} else {
echo $module->l('You must be logged in to manage your wishlist.', 'cart');
}
示例4: WishList
$action = Tools::getValue('action');
$id_wishlist = (int) Tools::getValue('id_wishlist');
$id_product = (int) Tools::getValue('id_product');
$id_product_attribute = (int) Tools::getValue('id_product_attribute');
$quantity = (int) Tools::getValue('quantity');
$priority = Tools::getValue('priority');
$wishlist = new WishList((int) $id_wishlist);
$refresh = $_GET['refresh'] == 'true' ? 1 : 0;
if (empty($id_wishlist) === false) {
if (!strcmp($action, 'update')) {
WishList::updateProduct($id_wishlist, $id_product, $id_product_attribute, $priority, $quantity);
} else {
if (!strcmp($action, 'delete')) {
WishList::removeProduct($id_wishlist, (int) $context->customer->id, $id_product, $id_product_attribute);
}
$products = WishList::getProductByIdCustomer($id_wishlist, $context->customer->id, $context->language->id);
$bought = WishList::getBoughtProduct($id_wishlist);
for ($i = 0; $i < sizeof($products); ++$i) {
$obj = new Product((int) $products[$i]['id_product'], false, $context->language->id);
if (!Validate::isLoadedObject($obj)) {
continue;
} else {
if ($products[$i]['id_product_attribute'] != 0) {
$combination_imgs = $obj->getCombinationImages($context->language->id);
if (isset($combination_imgs[$products[$i]['id_product_attribute']][0])) {
$products[$i]['cover'] = $obj->id . '-' . $combination_imgs[$products[$i]['id_product_attribute']][0]['id_image'];
}
} else {
$images = $obj->getImages($context->language->id);
foreach ($images as $k => $image) {
if ($image['cover']) {
示例5: renderList
public function renderList($id_wishlist)
{
$wishlist = new WishList($id_wishlist);
$products = WishList::getProductByIdCustomer($id_wishlist, $wishlist->id_customer, $this->context->language->id);
foreach ($products as $key => $val) {
$image = Image::getCover($val['id_product']);
$products[$key]['image'] = $this->context->link->getImageLink($val['link_rewrite'], $image['id_image'], ImageType::getFormatedName('small'));
}
$fields_list = array('image' => array('title' => $this->l('Image'), 'type' => 'image'), 'name' => array('title' => $this->l('Product'), 'type' => 'text'), 'attributes_small' => array('title' => $this->l('Combination'), 'type' => 'text'), 'quantity' => array('title' => $this->l('Quantity'), 'type' => 'text'), 'priority' => array('title' => $this->l('Priority'), 'type' => 'priority', 'values' => array($this->l('High'), $this->l('Medium'), $this->l('Low'))));
$helper = new HelperList();
$helper->shopLinkType = '';
$helper->simple_header = true;
$helper->no_link = true;
$helper->actions = array('view');
$helper->show_toolbar = false;
$helper->module = $this;
$helper->identifier = 'id_product';
$helper->title = $this->l('Product list');
$helper->table = $this->name;
$helper->token = Tools::getAdminTokenLite('AdminModules');
$helper->currentIndex = AdminController::$currentIndex . '&configure=' . $this->name;
$helper->tpl_vars = array('priority' => array($this->l('High'), $this->l('Medium'), $this->l('Low')));
return $helper->generateList($products, $fields_list);
}
示例6: WishList
$id_wishlist = (int) $wishlists[0]['id_wishlist'];
$cookie->id_wishlist = (int) $id_wishlist;
} else {
$wishlist = new WishList();
$modWishlist = new BlockWishList();
$wishlist->name = $modWishlist->default_wishlist_name;
$wishlist->id_customer = (int) $cookie->id_customer;
list($us, $s) = explode(' ', microtime());
srand($s * $us);
$wishlist->token = strtoupper(substr(sha1(uniqid(rand(), true) . _COOKIE_KEY_ . $cookie->id_customer), 0, 16));
$wishlist->add();
$cookie->id_wishlist = (int) $wishlist->id;
}
}
if ($add and $quantity) {
WishList::addProduct($cookie->id_wishlist, $cookie->id_customer, $id_product, $id_product_attribute, $quantity);
} elseif ($delete) {
WishList::removeProduct($cookie->id_wishlist, $cookie->id_customer, $id_product, $id_product_attribute);
}
}
$smarty->assign('products', WishList::getProductByIdCustomer($cookie->id_wishlist, $cookie->id_customer, $cookie->id_lang, null, true));
if (Tools::file_exists_cache(_PS_THEME_DIR_ . 'modules/blockwishlist/blockwishlist-ajax.tpl')) {
$smarty->display(_PS_THEME_DIR_ . 'modules/blockwishlist/blockwishlist-ajax.tpl');
} elseif (Tools::file_exists_cache(dirname(__FILE__) . '/blockwishlist-ajax.tpl')) {
$smarty->display(dirname(__FILE__) . '/blockwishlist-ajax.tpl');
} else {
echo Tools::displayError('No template found');
}
} else {
echo Tools::displayError('You must be logged in to manage your wishlist.');
}
示例7: initContent
public function initContent()
{
parent::initContent();
$token = Tools::getValue('token');
$module = new BlockWishList();
if ($token) {
$wishlist = WishList::getByToken($token);
WishList::refreshWishList($wishlist['id_wishlist']);
$products = WishList::getProductByIdCustomer((int) $wishlist['id_wishlist'], (int) $wishlist['id_customer'], $this->context->language->id, null, true);
$nb_products = count($products);
$priority_names = array(0 => $module->l('High'), 1 => $module->l('Medium'), 2 => $module->l('Low'));
for ($i = 0; $i < $nb_products; ++$i) {
$obj = new Product((int) $products[$i]['id_product'], true, $this->context->language->id);
if (!Validate::isLoadedObject($obj)) {
continue;
} else {
$products[$i]['priority_name'] = $priority_names[$products[$i]['priority']];
$quantity = Product::getQuantity((int) $products[$i]['id_product'], $products[$i]['id_product_attribute']);
$products[$i]['attribute_quantity'] = $quantity;
$products[$i]['product_quantity'] = $quantity;
$products[$i]['allow_oosp'] = $obj->isAvailableWhenOutOfStock((int) $obj->out_of_stock);
if ($products[$i]['id_product_attribute'] != 0) {
$combination_imgs = $obj->getCombinationImages($this->context->language->id);
if (isset($combination_imgs[$products[$i]['id_product_attribute']][0])) {
$products[$i]['cover'] = $obj->id . '-' . $combination_imgs[$products[$i]['id_product_attribute']][0]['id_image'];
} else {
$cover = Product::getCover($obj->id);
$products[$i]['cover'] = $obj->id . '-' . $cover['id_image'];
}
} else {
$images = $obj->getImages($this->context->language->id);
foreach ($images as $image) {
if ($image['cover']) {
$products[$i]['cover'] = $obj->id . '-' . $image['id_image'];
break;
}
}
}
if (!isset($products[$i]['cover'])) {
$products[$i]['cover'] = $this->context->language->iso_code . '-default';
}
}
$products[$i]['bought'] = false;
/*
for ($j = 0, $k = 0; $j < sizeof($bought); ++$j)
{
if ($bought[$j]['id_product'] == $products[$i]['id_product'] AND
$bought[$j]['id_product_attribute'] == $products[$i]['id_product_attribute']
)
$products[$i]['bought'][$k++] = $bought[$j];
}*/
}
WishList::incCounter((int) $wishlist['id_wishlist']);
$ajax = Configuration::get('PS_BLOCK_CART_AJAX');
$wishlists = WishList::getByIdCustomer((int) $wishlist['id_customer']);
foreach ($wishlists as $key => $item) {
if ($item['id_wishlist'] == $wishlist['id_wishlist']) {
unset($wishlists[$key]);
break;
}
}
$this->context->smarty->assign(array('current_wishlist' => $wishlist, 'token' => $token, 'ajax' => isset($ajax) && (int) $ajax == 1 ? '1' : '0', 'wishlists' => $wishlists, 'products' => $products));
}
$this->setTemplate('view.tpl');
}
示例8: dirname
<?php
/* SSL Management */
$useSSL = true;
require_once dirname(__FILE__) . '/../../config/config.inc.php';
require_once dirname(__FILE__) . '/../../header.php';
require_once dirname(__FILE__) . '/WishList.php';
$token = Tools::getValue('token');
if (empty($token) === false) {
$wishlist = WishList::getByToken($token);
if (empty($result) === true || $result === false) {
$errors[] = Tools::displayError('Invalid wishlist token');
}
WishList::refreshWishList($wishlist['id_wishlist']);
$products = WishList::getProductByIdCustomer(intval($wishlist['id_wishlist']), intval($wishlist['id_customer']), intval($cookie->id_lang), null, true);
for ($i = 0; $i < sizeof($products); ++$i) {
$obj = new Product(intval($products[$i]['id_product']), false, intval($cookie->id_lang));
if (!Validate::isLoadedObject($obj)) {
continue;
} else {
if ($products[$i]['id_product_attribute'] != 0) {
$combination_imgs = $obj->getCombinationImages(intval($cookie->id_lang));
$products[$i]['cover'] = $obj->id . '-' . $combination_imgs[$products[$i]['id_product_attribute']][0]['id_image'];
} else {
$images = $obj->getImages(intval($cookie->id_lang));
foreach ($images as $k => $image) {
if ($image['cover']) {
$products[$i]['cover'] = $obj->id . '-' . $image['id_image'];
break;
}
}
示例9: dirname
/* SSL Management */
$useSSL = true;
require_once dirname(__FILE__) . '/../../config/config.inc.php';
require_once dirname(__FILE__) . '/../../header.php';
require_once dirname(__FILE__) . '/WishList.php';
$context = Context::getContext();
$token = Tools::getValue('token');
// Instance of module class for translations
$module = new BlockWishList();
if (empty($token) === false) {
$wishlist = WishList::getByToken($token);
if (empty($result) === true || $result === false) {
$errors[] = $module->l('Invalid wishlist token', 'view');
}
WishList::refreshWishList($wishlist['id_wishlist']);
$products = WishList::getProductByIdCustomer((int) $wishlist['id_wishlist'], (int) $wishlist['id_customer'], $context->language->id, null, true);
for ($i = 0; $i < sizeof($products); ++$i) {
$obj = new Product($products[$i]['id_product'], false, $context->language->id);
if (!Validate::isLoadedObject($obj)) {
continue;
} else {
if ($products[$i]['id_product_attribute'] != 0 && isset($combination_imgs[$products[$i]['id_product_attribute']][0])) {
$combination_imgs = $obj->getCombinationImages($context->language->id);
$products[$i]['cover'] = $obj->id . '-' . $combination_imgs[$products[$i]['id_product_attribute']][0]['id_image'];
} else {
$images = $obj->getImages($context->language->id);
foreach ($images as $k => $image) {
if ($image['cover']) {
$products[$i]['cover'] = $obj->id . '-' . $image['id_image'];
break;
}
示例10: WishList
$action = Tools::getValue('action');
$id_wishlist = (int) Tools::getValue('id_wishlist');
$id_product = (int) Tools::getValue('id_product');
$id_product_attribute = (int) Tools::getValue('id_product_attribute');
$quantity = (int) Tools::getValue('quantity');
$priority = Tools::getValue('priority');
$wishlist = new WishList((int) $id_wishlist);
$refresh = $_GET['refresh'] == 'true' ? 1 : 0;
if (empty($id_wishlist) === false) {
if (!strcmp($action, 'update')) {
WishList::updateProduct($id_wishlist, $id_product, $id_product_attribute, $priority, $quantity);
} else {
if (!strcmp($action, 'delete')) {
WishList::removeProduct($id_wishlist, (int) $cookie->id_customer, $id_product, $id_product_attribute);
}
$products = WishList::getProductByIdCustomer($id_wishlist, $cookie->id_customer, $cookie->id_lang);
$bought = WishList::getBoughtProduct($id_wishlist);
for ($i = 0; $i < sizeof($products); ++$i) {
$obj = new Product((int) $products[$i]['id_product'], false, (int) $cookie->id_lang);
if (!Validate::isLoadedObject($obj)) {
continue;
} else {
if ($products[$i]['id_product_attribute'] != 0) {
$combination_imgs = $obj->getCombinationImages((int) $cookie->id_lang);
$products[$i]['cover'] = $obj->id . '-' . $combination_imgs[$products[$i]['id_product_attribute']][0]['id_image'];
} else {
$images = $obj->getImages((int) $cookie->id_lang);
foreach ($images as $k => $image) {
if ($image['cover']) {
$products[$i]['cover'] = $obj->id . '-' . $image['id_image'];
break;