Source for file LC_Page_Mypage_Favorite.php
Documentation is available at LC_Page_Mypage_Favorite.php
* This file is part of EC-CUBE
* Copyright(c) 2000-2011 LOCKON CO.,LTD. All Rights Reserved.
* http://www.lockon.co.jp/
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
require_once CLASS_EX_REALDIR . 'page_extends/mypage/LC_Page_AbstractMypage_Ex.php';
* @author LOCKON CO.,LTD.
* @version $Id: LC_Page_Mypage_Favorite.php 21256 2011-09-25 04:15:51Z Seasoft $
$this->tpl_subtitle = 'お気に入り一覧';
$this->tpl_mypageno = 'favorite';
$objProduct = new SC_Product_Ex();
$objCustomer = new SC_Customer_Ex();
$customer_id = $objCustomer->getValue('customer_id');
switch ($this->getMode()) {
if (isset ($_POST['pageno'])) {
$this->arrFavorite = $this->lfGetFavoriteProduct($customer_id, $this);
$this->arrFavorite = $objProduct->setPriceTaxTo($this->arrFavorite);
echo SC_Utils_Ex::jsonEncode($this->arrFavorite);
if (isset ($_POST['pageno'])) {
$this->arrFavorite = $this->lfGetFavoriteProduct($customer_id, $this);
$this->dispNumber = SEARCH_PMAX;
* @param mixed $customer_id
* @return array お気に入り商品一覧
function lfGetFavoriteProduct($customer_id, &$objPage) {
$objQuery = SC_Query_Ex::getSingletonInstance();
$objProduct = new SC_Product_Ex();
$objQuery->setOrder('create_date DESC');
$arrProductId = $objQuery->getCol('product_id', 'dtb_customer_favorite_products', 'customer_id = ?', array($customer_id));
$objQuery = & SC_Query_Ex::getSingletonInstance();
$objQuery->setWhere($this->lfMakeWhere('alldtl.', $arrProductId));
$linemax = $objProduct->findProductCount($objQuery);
$objPage->tpl_linemax = $linemax; // 何件が該当しました。表示用
$objNavi = new SC_PageNavi_Ex($objPage->tpl_pageno, $linemax, SEARCH_PMAX, 'fnNaviPage', NAVI_PMAX);
$this->tpl_strnavi = $objNavi->strnavi; // 表示文字列
$startno = $objNavi->start_row;
$objQuery = & SC_Query_Ex::getSingletonInstance();
//$objQuery->setLimitOffset(SEARCH_PMAX, $startno);
$arrProductId = array_slice($arrProductId, $startno, SEARCH_PMAX);
$where .= ' AND del_flg = 0';
$objQuery->setWhere($where, $arrProductId);
$arrProducts = $objProduct->lists($objQuery);
foreach($arrProducts as $item) {
$arrProducts2[ $item['product_id'] ] = $item;
$arrProductsList = array();
foreach($arrProductId as $product_id) {
$arrProductsList[] = $arrProducts2[$product_id];
// 取得した表示すべきIDだけを指定して情報を取得。
if (is_array($arrProductId) && !empty($arrProductId)) {
$where = $tablename . 'product_id IN (' . implode(',', $arrProductId) . ')';
if (NOSTOCK_HIDDEN === true) {
$where .= ' AND (stock_max >= 1 OR stock_unlimited_max = 1)';
$objQuery = new SC_Query_Ex();
$count = $objQuery->count("dtb_customer_favorite_products", "customer_id = ? AND product_id = ?", array($customer_id, $product_id));
$objQuery->delete('dtb_customer_favorite_products', "customer_id = ? AND product_id = ?", array($customer_id, $product_id));
Documentation generated on Fri, 24 Feb 2012 14:02:07 +0900 by Seasoft
|