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


PHP WishList::getByIdCustomer方法代码示例

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


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

示例1: 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

示例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';
开发者ID:greench,项目名称:prestashop,代码行数:31,代码来源:view.php

示例3: renderForm

 public function renderForm()
 {
     $_customers = WishList::getCustomers();
     foreach ($_customers as $c) {
         $_customers[$c['id_customer']]['id_customer'] = $c['id_customer'];
         $_customers[$c['id_customer']]['name'] = $c['firstname'] . ' ' . $c['lastname'];
     }
     $fields_form = array('form' => array('legend' => array('title' => $this->l('Listing'), 'icon' => 'icon-cogs'), 'input' => array(array('type' => 'select', 'label' => $this->l('Customers :'), 'name' => 'id_customer', 'options' => array('default' => array('value' => 0, 'label' => $this->l('Choose customer')), 'query' => $_customers, 'id' => 'id_customer', 'name' => 'name')))));
     if ($id_customer = Tools::getValue('id_customer')) {
         $wishlists = WishList::getByIdCustomer($id_customer);
         $fields_form['form']['input'][] = array('type' => 'select', 'label' => $this->l('Wishlist :'), 'name' => 'id_wishlist', 'options' => array('default' => array('value' => 0, 'label' => $this->l('Choose wishlist')), 'query' => $wishlists, 'id' => 'id_wishlist', 'name' => 'name'));
     }
     $helper = new HelperForm();
     $helper->show_toolbar = false;
     $helper->table = $this->table;
     $lang = new Language((int) Configuration::get('PS_LANG_DEFAULT'));
     $helper->default_form_language = $lang->id;
     $helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0;
     $helper->identifier = $this->identifier;
     $helper->submit_action = 'submitModule';
     $helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false) . '&configure=' . $this->name . '&tab_module=' . $this->tab . '&module_name=' . $this->name;
     $helper->token = Tools::getAdminTokenLite('AdminModules');
     $helper->tpl_vars = array('fields_value' => $this->getConfigFieldsValues(), 'languages' => $this->context->controller->getLanguages(), 'id_language' => $this->context->language->id);
     return $helper->generateForm(array($fields_form));
 }
开发者ID:ortegon000,项目名称:tienda,代码行数:25,代码来源:blockwishlist.php

示例4: hookAdminCustomers

 public function hookAdminCustomers($params)
 {
     require_once dirname(__FILE__) . '/WishList.php';
     $customer = new Customer((int) $params['id_customer']);
     if (!Validate::isLoadedObject($customer)) {
         die(Tools::displayError());
     }
     $this->_html = '<h2>' . $this->l('Wishlists') . '</h2>';
     $wishlists = WishList::getByIdCustomer((int) $customer->id);
     if (!sizeof($wishlists)) {
         $this->_html .= $customer->lastname . ' ' . $customer->firstname . ' ' . $this->l('No wishlist.');
     } else {
         $this->_html .= '<form action="' . Tools::safeOutput($_SERVER['REQUEST_URI']) . '" method="post" id="listing">';
         $id_wishlist = (int) Tools::getValue('id_wishlist');
         if (!$id_wishlist) {
             $id_wishlist = $wishlists[0]['id_wishlist'];
         }
         $this->_html .= '<span>' . $this->l('Wishlist') . ': </span> <select name="id_wishlist" onchange="$(\'#listing\').submit();">';
         foreach ($wishlists as $wishlist) {
             $this->_html .= '<option value="' . (int) $wishlist['id_wishlist'] . '"';
             if ($wishlist['id_wishlist'] == $id_wishlist) {
                 $this->_html .= ' selected="selected"';
                 $counter = $wishlist['counter'];
             }
             $this->_html .= '>' . htmlentities($wishlist['name'], ENT_COMPAT, 'UTF-8') . '</option>';
         }
         $this->_html .= '</select>';
         $this->_displayProducts((int) $id_wishlist);
         $this->_html .= '</form><br />';
         return $this->_html;
     }
 }
开发者ID:jicheng17,项目名称:vipinsg,代码行数:32,代码来源:blockwishlist.php

示例5: 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

示例6: 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

示例7: 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

示例8: 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';
开发者ID:vincent,项目名称:theinvertebrates,代码行数:31,代码来源:view.php

示例9: array

                        $products[$i]['cover'] = $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];
                    }
                }
            }
            $productBoughts = array();
            foreach ($products as $product) {
                if (sizeof($product['bought'])) {
                    $productBoughts[] = $product;
                }
            }
            $context->smarty->assign(array('products' => $products, 'productsBoughts' => $productBoughts, 'id_wishlist' => $id_wishlist, 'refresh' => $refresh, 'token_wish' => $wishlist->token, 'wishlists' => WishList::getByIdCustomer($cookie->id_customer)));
            // Instance of module class for translations
            $module = new BlockWishList();
            if (Tools::file_exists_cache(_PS_THEME_DIR_ . 'modules/blockwishlist/views/templates/front/managewishlist.tpl')) {
                $context->smarty->display(_PS_THEME_DIR_ . 'modules/blockwishlist/views/templates/front/managewishlist.tpl');
            } elseif (Tools::file_exists_cache(dirname(__FILE__) . '/views/templates/front/managewishlist.tpl')) {
                $context->smarty->display(dirname(__FILE__) . '/views/templates/front/managewishlist.tpl');
            } elseif (Tools::file_exists_cache(dirname(__FILE__) . '/managewishlist.tpl')) {
                $context->smarty->display(dirname(__FILE__) . '/managewishlist.tpl');
            } else {
                echo $module->l('No template found', 'managewishlist');
            }
        }
    }
}
开发者ID:prestashop,项目名称:blockwishlist,代码行数:31,代码来源:managewishlist.php


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