本文整理汇总了PHP中WishList::incCounter方法的典型用法代码示例。如果您正苦于以下问题:PHP WishList::incCounter方法的具体用法?PHP WishList::incCounter怎么用?PHP WishList::incCounter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WishList
的用法示例。
在下文中一共展示了WishList::incCounter方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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');
}
示例2: foreach
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;
}
}
if (!isset($products[$i]['cover'])) {
$products[$i]['cover'] = Language::getIsoById((int) $cookie->id_lang) . '-default';
}
}
}
}
WishList::incCounter((int) $wishlist['id_wishlist']);
$ajax = Configuration::get('PS_BLOCK_CART_AJAX');
$smarty->assign(array('current_wishlist' => $wishlist, 'token' => $token, 'ajax' => (isset($ajax) and (int) $ajax == 1) ? '1' : '0', 'wishlists' => WishList::getByIdCustomer((int) $wishlist['id_customer']), 'products' => $products));
}
if (Tools::file_exists_cache(_PS_THEME_DIR_ . 'modules/blockwishlist/view.tpl')) {
$smarty->display(_PS_THEME_DIR_ . 'modules/blockwishlist/view.tpl');
} elseif (Tools::file_exists_cache(dirname(__FILE__) . '/view.tpl')) {
$smarty->display(dirname(__FILE__) . '/view.tpl');
} else {
echo Tools::displayError('No template found');
}
require dirname(__FILE__) . '/../../footer.php';
示例3: foreach
$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;
}
}
if (!isset($products[$i]['cover'])) {
$products[$i]['cover'] = Language::getIsoById(intval($cookie->id_lang)) . '-default';
}
}
}
}
WishList::incCounter(intval($wishlist['id_wishlist']));
$ajax = Configuration::get('PS_BLOCK_CART_AJAX');
$smarty->assign('current_wishlist', $wishlist);
$smarty->assign('token', $token);
$smarty->assign('ajax', (isset($ajax) and intval($ajax) == 1) ? '1' : '0');
$smarty->assign('wishlists', WishList::getByIdCustomer(intval($wishlist['id_customer'])));
$smarty->assign('products', $products);
}
if (Tools::file_exists_cache(_PS_THEME_DIR_ . 'modules/blockwishlist/view.tpl')) {
$smarty->display(_PS_THEME_DIR_ . 'modules/blockwishlist/view.tpl');
} elseif (Tools::file_exists_cache(dirname(__FILE__) . '/view.tpl')) {
$smarty->display(dirname(__FILE__) . '/view.tpl');
} else {
echo Tools::displayError('No template found');
}
require dirname(__FILE__) . '/../../footer.php';