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


PHP WishList::refreshWishList方法代码示例

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


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

示例1: dirname

*  @version  Release: $Revision: 12069 $
*  @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;
开发者ID:greench,项目名称:prestashop,代码行数:31,代码来源:view.php

示例2: 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');
 }
开发者ID:ecssjapan,项目名称:guiding-you-afteropen,代码行数:65,代码来源:view.php


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