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


PHP WishList::getInfosByIdCustomer方法代码示例

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


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

示例1: assign

 /**
  * Assign wishlist template
  */
 public function assign()
 {
     $errors = array();
     if ($this->context->customer->isLogged()) {
         $add = Tools::getIsset('add');
         $add = empty($add) === false ? 1 : 0;
         $delete = Tools::getIsset('deleted');
         $delete = empty($delete) === false ? 1 : 0;
         $default = Tools::getIsset('default');
         $default = empty($default) === false ? 1 : 0;
         $id_wishlist = Tools::getValue('id_wishlist');
         if (Tools::isSubmit('submitWishlist')) {
             if (Configuration::get('PS_TOKEN_ACTIVATED') == 1 && strcmp(Tools::getToken(), Tools::getValue('token'))) {
                 $errors[] = $this->module->l('Invalid token', 'mywishlist');
             }
             if (!count($errors)) {
                 $name = Tools::getValue('name');
                 if (empty($name)) {
                     $errors[] = $this->module->l('You must specify a name.', 'mywishlist');
                 }
                 if (WishList::isExistsByNameForUser($name)) {
                     $errors[] = $this->module->l('This name is already used by another list.', 'mywishlist');
                 }
                 if (!count($errors)) {
                     $wishlist = new WishList();
                     $wishlist->id_shop = $this->context->shop->id;
                     $wishlist->id_shop_group = $this->context->shop->id_shop_group;
                     $wishlist->name = $name;
                     $wishlist->id_customer = (int) $this->context->customer->id;
                     !$wishlist->isDefault($wishlist->id_customer) ? $wishlist->default = 1 : '';
                     list($us, $s) = explode(' ', microtime());
                     srand($s * $us);
                     $wishlist->token = strtoupper(substr(sha1(uniqid(rand(), true) . _COOKIE_KEY_ . $this->context->customer->id), 0, 16));
                     $wishlist->add();
                     Mail::Send($this->context->language->id, 'wishlink', Mail::l('Your wishlist\'s link', $this->context->language->id), array('{wishlist}' => $wishlist->name, '{message}' => $this->context->link->getModuleLink('blockwishlist', 'view', array('token' => $wishlist->token))), $this->context->customer->email, $this->context->customer->firstname . ' ' . $this->context->customer->lastname, null, strval(Configuration::get('PS_SHOP_NAME')), null, null, $this->module->getLocalPath() . 'mails/');
                     Tools::redirect($this->context->link->getModuleLink('blockwishlist', 'mywishlist'));
                 }
             }
         } else {
             if ($add) {
                 WishList::addCardToWishlist($this->context->customer->id, Tools::getValue('id_wishlist'), $this->context->language->id);
             } elseif ($delete && empty($id_wishlist) === false) {
                 $wishlist = new WishList((int) $id_wishlist);
                 if (Validate::isLoadedObject($wishlist)) {
                     $wishlist->delete();
                 } else {
                     $errors[] = $this->module->l('Cannot delete this wishlist', 'mywishlist');
                 }
             } elseif ($default) {
                 $wishlist = new WishList((int) $id_wishlist);
                 if (Validate::isLoadedObject($wishlist)) {
                     $wishlist->setDefault();
                 }
             }
         }
         $this->context->smarty->assign('wishlists', WishList::getByIdCustomer($this->context->customer->id));
         $this->context->smarty->assign('nbProducts', WishList::getInfosByIdCustomer($this->context->customer->id));
     } else {
         Tools::redirect('index.php?controller=authentication&back=' . urlencode($this->context->link->getModuleLink('blockwishlist', 'mywishlist')));
     }
     $this->context->smarty->assign(array('id_customer' => (int) $this->context->customer->id, 'errors' => $errors, 'form_link' => $errors));
     $this->setTemplate('mywishlist.tpl');
 }
开发者ID:hiousi,项目名称:blockwishlist,代码行数:66,代码来源:mywishlist.php

示例2: array

                Mail::Send($context->language->id, 'wishlink', Mail::l('Your wishlist\'s link', $context->language->id), array('{wishlist}' => $wishlist->name, '{message}' => Tools::getProtocol() . htmlentities($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8') . __PS_BASE_URI__ . 'modules/blockwishlist/view.php?token=' . $wishlist->token), $context->customer->email, $context->customer->firstname . ' ' . $context->customer->lastname, NULL, strval(Configuration::get('PS_SHOP_NAME')), NULL, NULL, dirname(__FILE__) . '/mails/');
            }
        }
    } else {
        if ($add) {
            WishList::addCardToWishlist($context->customer->id, Tools::getValue('id_wishlist'), $context->language->id);
        } else {
            if ($delete and empty($id_wishlist) === false) {
                $wishlist = new WishList((int) $id_wishlist);
                if (Validate::isLoadedObject($wishlist)) {
                    $wishlist->delete();
                } else {
                    $errors[] = $module->l('Cannot delete this wishlist', 'mywishlist');
                }
            }
        }
    }
    $context->smarty->assign('wishlists', WishList::getByIdCustomer($context->customer->id));
    $context->smarty->assign('nbProducts', WishList::getInfosByIdCustomer($context->customer->id));
} else {
    Tools::redirect('index.php?controller=authentication&back=modules/blockwishlist/mywishlist.php');
}
$context->smarty->assign(array('id_customer' => (int) $context->customer->id, 'errors' => $errors));
if (Tools::file_exists_cache(_PS_THEME_DIR_ . 'modules/blockwishlist/mywishlist.tpl')) {
    $context->smarty->display(_PS_THEME_DIR_ . 'modules/blockwishlist/mywishlist.tpl');
} elseif (Tools::file_exists_cache(dirname(__FILE__) . '/views/templates/front/mywishlist.tpl')) {
    $context->smarty->display(dirname(__FILE__) . '/views/templates/front/mywishlist.tpl');
} else {
    echo $module->l('No template found', 'mywishlist');
}
include dirname(__FILE__) . '/../../footer.php';
开发者ID:toufikadfab,项目名称:PrestaShop-1.5,代码行数:31,代码来源:mywishlist.php

示例3: list

                $wishlist->name = $name;
                $wishlist->id_customer = $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();
            }
        }
    } else {
        if ($add) {
            WishList::addCardToWishlist(intval($cookie->id_customer), intval(Tools::getValue('id_wishlist')), intval($cookie->id_lang));
        } else {
            if ($delete and empty($id_wishlist) === false) {
                $wishlist = new WishList(intval($id_wishlist));
                if (Validate::isLoadedObject($wishlist)) {
                    $wishlist->delete();
                } else {
                    $errors[] = Tools::displayError('can`t delete this whislist');
                }
            }
        }
    }
    $smarty->assign('wishlists', WishList::getByIdCustomer(intval($cookie->id_customer)));
    $smarty->assign('nbProducts', WishList::getInfosByIdCustomer(intval($cookie->id_customer)));
} else {
    Tools::redirect('authentication.php?back=/modules/blockwishlist/mywishlist.php');
}
$smarty->assign('id_customer', intval($cookie->id_customer));
$smarty->assign('errors', $errors);
$smarty->display(dirname(__FILE__) . '/mywishlist.tpl');
include dirname(__FILE__) . '/../../footer.php';
开发者ID:Bruno-2M,项目名称:prestashop,代码行数:31,代码来源:mywishlist.php


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