• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP WishList类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: get_for_user

 /**
  * @param Member $member [optional] - defaults to current user
  * @return DataList
  */
 public static function get_for_user(Member $member = null)
 {
     if (!$member) {
         $member = Member::currentUser();
     }
     if (!$member) {
         return null;
     }
     return WishList::get()->filter('OwnerID', $member->ID);
 }
开发者ID:markguinn,项目名称:silverstripe-wishlist,代码行数:14,代码来源:WishList.php


示例2: updateGroupWishListResponse

 /**
  * @param SS_HTTPRequest $request
  * @param AjaxHTTPResponse $response
  * @param GroupedProduct $groupedProduct
  * @param array $data
  * @param GroupedCartForm $form [optional]
  */
 public function updateGroupWishListResponse(&$request, &$response, $groupedProduct, $data, $form = null)
 {
     if ($request->isAjax() && $this->owner->getController()->hasExtension('AjaxControllerExtension')) {
         if (!$response) {
             $response = $this->owner->getController()->getAjaxResponse();
         }
         $this->setupRenderContexts($response, $groupedProduct, $form);
         $response->triggerEvent('wishlistadd');
         $response->triggerEvent('wishlistchange', array('action' => 'add'));
         $n = 0;
         foreach ($data['Product'] as $info) {
             if ($info['Quantity'] > 0) {
                 $n++;
             }
         }
         $s = $n == 1 ? '' : 's';
         $response->triggerEvent('statusmessage', "{$n} item{$s} added to " . WishList::current()->getTitle());
     }
 }
开发者ID:markguinn,项目名称:silverstripe-shop-groupedproducts,代码行数:26,代码来源:GroupedCartFormAjax.php


示例3: uninstall

 function uninstall()
 {
     global $application;
     $query = new DB_Table_Delete(WishList::getTables());
     $application->db->getDB_Result($query);
 }
开发者ID:KICHIRO20,项目名称:-Myproject_part1-,代码行数:6,代码来源:wishlist_api.php


示例4: addProduct

    /**
     * Add product to ID wishlist
     *
     * @return boolean succeed
     */
    public static function addProduct($id_wishlist, $id_customer, $id_product, $id_product_attribute, $quantity)
    {
        if (!Validate::isUnsignedId($id_wishlist) or !Validate::isUnsignedId($id_customer) or !Validate::isUnsignedId($id_product) or !Validate::isUnsignedId($quantity)) {
            die(Tools::displayError());
        }
        $result = Db::getInstance()->getRow('
		SELECT wp.`quantity`
		  FROM `' . _DB_PREFIX_ . 'wishlist_product` wp
		JOIN `' . _DB_PREFIX_ . 'wishlist` w ON (w.`id_wishlist` = wp.`id_wishlist`)
		WHERE wp.`id_wishlist` = ' . (int) $id_wishlist . '
		AND w.`id_customer` = ' . (int) $id_customer . '
		AND wp.`id_product` = ' . (int) $id_product . '
		AND wp.`id_product_attribute` = ' . (int) $id_product_attribute);
        if (empty($result) === false and sizeof($result)) {
            if ($result['quantity'] + $quantity <= 0) {
                return WishList::removeProduct($id_wishlist, $id_customer, $id_product, $id_product_attribute);
            } else {
                return Db::getInstance()->Execute('
				UPDATE `' . _DB_PREFIX_ . 'wishlist_product` SET
				`quantity` = ' . (int) ($quantity + $result['quantity']) . '
				WHERE `id_wishlist` = ' . (int) $id_wishlist . '
				AND `id_product` = ' . (int) $id_product . '
				AND `id_product_attribute` = ' . (int) $id_product_attribute);
            }
        } else {
            return Db::getInstance()->Execute('
			INSERT INTO `' . _DB_PREFIX_ . 'wishlist_product` (`id_wishlist`, `id_product`, `id_product_attribute`, `quantity`, `priority`) VALUES(
			' . (int) $id_wishlist . ',
			' . (int) $id_product . ',
			' . (int) $id_product_attribute . ',
			' . (int) $quantity . ', 1)');
        }
    }
开发者ID:priyankajsr19,项目名称:indusdiva2,代码行数:38,代码来源:WishList.php


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


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


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


示例8: findProductByName

    {
        return $this->items;
    }
    public function findProductByName($name)
    {
        $itemKey = null;
        foreach ($this->items as $key => $item) {
            if ($name == $item->getName()) {
                $itemKey = $key + 1;
                echo "{$name} is number {$itemKey} in the array";
                break;
            }
        }
        if ($itemKey == null) {
            throw new Exception("Item was not found in cart");
        }
    }
}
$describer = new ItemDescriber();
$kramericaTV = new Television("Giant TV", "Kramerica", 3900.9, "LED", "100in");
$shirt = new Clothing("Button Down Shirt", "J Peterman", '29.88', "shirt", "medium", "red", "male");
$Wishlist = new WishList();
$Wishlist->addProduct($kramericaTV);
$Wishlist->addProduct($shirt);
$ShoppingCart = $Wishlist->createCartFromContainer($Wishlist);
$Wishlist->provideDescription();
$ShoppingCart->provideDescription();
?>
    </p>
  </body>
</html>
开发者ID:jacobfoard,项目名称:Curriculum,代码行数:31,代码来源:02_hard.php


示例9: getHashFromCart

        Tools::redirect('modules/wishlist/display.php?id=' . getHashFromCart($wishlist_cart));
    } else {
        if (Tools::isSubmit("addAllToCart")) {
            copyQty($wishlist_cart, $cart);
            Tools::redirect('modules/wishlist/display.php?id=' . getHashFromCart($wishlist_cart));
        }
    }
}
$errors = array();
$smarty->assign('errors', $errors);
$smarty->assign('mdl_dir', dirname(__FILE__) . '/');
$smarty->assign("currency_iso_code", $currency->iso_code);
$smarty->assign("currency_name", $currency->name);
$smarty->assign('cart_hash_id', $_GET['id']);
if (!$wishlist_cart->nbProducts()) {
    $smarty->assign('empty', 1);
}
if (file_exists(_PS_SHIP_IMG_DIR_ . intval($wishlist_cart->id_carrier) . '.jpg')) {
    $smarty->assign('carrierPicture', 1);
}
$summary = $wishlist_cart->getSummaryDetails();
$customizedDatas = Product::getAllCustomizedDatas(intval($wishlist_cart->id));
Product::addCustomizationPrice($summary['products'], $customizedDatas);
$smarty->assign($summary);
$smarty->assign(array('customizedDatas' => $customizedDatas, 'CUSTOMIZE_FILE' => _CUSTOMIZE_FILE_, 'CUSTOMIZE_TEXTFIELD' => _CUSTOMIZE_TEXTFIELD_, 'lastProductAdded' => $wishlist_cart->getLastProduct()));
$smarty->assign('cart', $wishlist_cart);
Tools::safePostVars();
include_once dirname(__FILE__) . '/../../header.php';
$lst = new WishList();
echo $lst->display(dirname(__FILE__) . '/wishlist.php', 'wishlist.tpl');
include dirname(__FILE__) . '/../../footer.php';
开发者ID:redb,项目名称:prestashop,代码行数:31,代码来源:display.php


示例10: testMultipleLists

 public function testMultipleLists()
 {
     WishList::set_current(null);
     $m1 = $this->objFromFixture('Member', 'm1');
     $m2 = $this->objFromFixture('Member', 'm2');
     $m1->logIn();
     $p1 = $this->objFromFixture('Product', 'p1');
     $p2 = $this->objFromFixture('Product', 'p2');
     $p3 = $this->objFromFixture('Product', 'p3');
     // should be able to retrieve a list of lists
     $allLists = WishList::get_for_user();
     $this->assertNotNull($allLists);
     $this->assertTrue($allLists instanceof DataList);
     // should initially be 0 lists
     $this->assertEquals(0, WishList::get_for_user()->count());
     $this->assertEquals(0, WishList::get_for_user($m2)->count());
     // current method should create one list
     $l1 = WishList::current();
     $l1->write();
     $l1->addBuyable($p1);
     //Debug::dump(array($l1, WishList::get_for_user()->sql(), WishList::get_for_user()->count(), WishList::get_for_user()->getIDList()));
     $this->assertEquals(1, WishList::get_for_user()->count());
     $this->assertEquals(0, WishList::get_for_user($m2)->count());
     // after manually creating a list there should be two lists
     $l2 = new WishList(array('OwnerID' => $m1->ID, 'Title' => 'Christmas'));
     $l2->write();
     $this->assertEquals(2, WishList::get_for_user()->count());
     // after adding a product to one list, it should not be present in the other one
     // but should still report that it is in a list
     $l2->addBuyable($p2);
     $this->assertTrue($p1->IsInWishList());
     $this->assertTrue($l1->hasBuyable($p1));
     $this->assertFalse($l2->hasBuyable($p1));
     $this->assertTrue($p2->IsInWishList());
     $this->assertFalse($l1->hasBuyable($p2));
     $this->assertTrue($l2->hasBuyable($p2));
     $this->assertFalse($p3->IsInWishList());
     $this->assertFalse($l1->hasBuyable($p3));
     $this->assertFalse($l2->hasBuyable($p3));
     // after creating a list for the a different user and adding
     // an item to that list, the item should not report that it is
     // in a list and should not be present in any of the other lists
     $l3 = new WishList(array('OwnerID' => $m2->ID, 'Title' => 'Christmas for someone else'));
     $l3->write();
     $l3->addBuyable($p3);
     $this->assertEquals(2, WishList::get_for_user()->count());
     $this->assertEquals(1, WishList::get_for_user($m2)->count());
     $this->assertFalse($p3->IsInWishList());
     $this->assertFalse($l1->hasBuyable($p3));
     $this->assertFalse($l2->hasBuyable($p3));
     // Buyable should be able to exist in two lists at once
     $l2->addBuyable($p1);
     $this->assertTrue($p1->IsInWishList());
     $this->assertTrue($l1->hasBuyable($p1));
     $this->assertTrue($l2->hasBuyable($p1));
     // removing an item from one list should not remove it from the other
     $l1->removeBuyable($p1);
     $this->assertTrue($p1->IsInWishList());
     $this->assertFalse($l1->hasBuyable($p1));
     $this->assertTrue($l2->hasBuyable($p1));
     // after removing item from both lists it should report as not being in a list
     $l2->removeBuyable($p1);
     $this->assertFalse($p1->IsInWishList());
     $this->assertFalse($l1->hasBuyable($p1));
     $this->assertFalse($l2->hasBuyable($p1));
 }
开发者ID:markguinn,项目名称:silverstripe-wishlist,代码行数:66,代码来源:WishListTest.php


示例11: createNewWishListForUser

 public function createNewWishListForUser(User $user, $name = 'New Wish List', $type = WishList::TYPE_PRIVATE)
 {
     if (!$user || !$user->loaded()) {
         throw new \InvalidArgumentException('User is not valid.');
     }
     $wishList = new WishList($this->pixie);
     if (!$wishList->isValidType($type)) {
         $type = WishList::TYPE_PRIVATE;
     }
     $wishList->type = $type;
     $wishList->name = $name;
     $wishList->created = date('Y-m-d H:i:s');
     $wishList->addToUser($user);
     $wishList->save();
     return $wishList;
 }
开发者ID:nchervyakov,项目名称:evolve2,代码行数:16,代码来源:Wishlist.php


示例12: WishList

            $errors[] = Tools::displayError('invalid token');
        }
        if (!sizeof($errors)) {
            $name = Tools::getValue('name');
            $wishlist = new WishList();
            $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));
                $wishlist->delete();
            }
        }
    }
    $smarty->assign('wishlists', WishList::getByIdCustomer(intval($cookie->id_customer)));
    $smarty->assign('nbProducts', WishList::getInfosByIdCustomer(intval($cookie->id_customer)));
} else {
    $errors[] = Tools::displayError('You need to be logged to manage your wishlist');
}
$smarty->assign('id_customer', intval($cookie->id_customer));
$smarty->assign('errors', $errors);
$smarty->display(dirname(__FILE__) . '/mywishlist.tpl');
include dirname(__FILE__) . '/../../footer.php';
开发者ID:sealence,项目名称:local,代码行数:31,代码来源:mywishlist.php


示例13: AllLists

 /**
  * @return DataList
  */
 public function AllLists()
 {
     return WishList::get_for_user();
 }
开发者ID:markguinn,项目名称:silverstripe-wishlist,代码行数:7,代码来源:WishListPage.php


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


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


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


示例17: ajaxProcessDeleteList

 public function ajaxProcessDeleteList()
 {
     if (!$this->context->customer->isLogged()) {
         die(Tools::jsonEncode(array('success' => false, 'error' => $this->module->l('You aren\'t logged in', 'mywishlist'))));
     }
     $default = Tools::getIsset('default');
     $default = empty($default) === false ? 1 : 0;
     $id_wishlist = Tools::getValue('id_wishlist');
     $wishlist = new WishList((int) $id_wishlist);
     if (Validate::isLoadedObject($wishlist) && $wishlist->id_customer == $this->context->customer->id) {
         $default_change = $wishlist->default ? true : false;
         $id_customer = $wishlist->id_customer;
         $wishlist->delete();
     } else {
         die(Tools::jsonEncode(array('success' => false, 'error' => $this->module->l('Cannot delete this wishlist', 'mywishlist'))));
     }
     if ($default_change) {
         $array = WishList::getDefault($id_customer);
         if (count($array)) {
             die(Tools::jsonEncode(array('success' => true, 'id_default' => $array[0]['id_wishlist'])));
         }
     }
     die(Tools::jsonEncode(array('success' => true)));
 }
开发者ID:ecssjapan,项目名称:guiding-you-afteropen,代码行数:24,代码来源:mywishlist.php


示例18: WishList

 $id_wishlist = (int) Tools::getValue('id_wishlist');
 $id_product = (int) Tools::getValue('id_product');
 $id_product_attribute = (int) Tools::getValue('id_product_attribute');
 $quantity = (int) Tools::getValue('quantity');
 $priority = Tools::getValue('priority');
 $wishlist = new WishList((int) $id_wishlist);
 $refresh = $_GET['refresh'] == 'true' ? 1 : 0;
 if (empty($id_wishlist) === false) {
     if (!strcmp($action, 'update')) {
         WishList::updateProduct($id_wishlist, $id_product, $id_product_attribute, $priority, $quantity);
     } else {
         if (!strcmp($action, 'delete')) {
             WishList::removeProduct($id_wishlist, (int) $context->customer->id, $id_product, $id_product_attribute);
         }
         $products = WishList::getProductByIdCustomer($id_wishlist, $context->customer->id, $context->language->id);
         $bought = WishList::getBoughtProduct($id_wishlist);
         for ($i = 0; $i < sizeof($products); ++$i) {
             $obj = new Product((int) $products[$i]['id_product'], false, $context->language->id);
             if (!Validate::isLoadedObject($obj)) {
                 continue;
             } else {
                 if ($products[$i]['id_product_attribute'] != 0) {
                     $combination_imgs = $obj->getCombinationImages($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 {
                     $images = $obj->getImages($context->language->id);
                     foreach ($images as $k => $image) {
                         if ($image['cover']) {
                             $products[$i]['cover'] = $obj->id . '-' . $image['id_image'];
开发者ID:jicheng17,项目名称:vipinsg,代码行数:31,代码来源:managewishlist.php


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


示例20: renderList

 public function renderList($id_wishlist)
 {
     $wishlist = new WishList($id_wishlist);
     $products = WishList::getProductByIdCustomer($id_wishlist, $wishlist->id_customer, $this->context->language->id);
     foreach ($products as $key => $val) {
         $image = Image::getCover($val['id_product']);
         $products[$key]['image'] = $this->context->link->getImageLink($val['link_rewrite'], $image['id_image'], ImageType::getFormatedName('small'));
     }
     $fields_list = array('image' => array('title' => $this->l('Image'), 'type' => 'image'), 'name' => array('title' => $this->l('Product'), 'type' => 'text'), 'attributes_small' => array('title' => $this->l('Combination'), 'type' => 'text'), 'quantity' => array('title' => $this->l('Quantity'), 'type' => 'text'), 'priority' => array('title' => $this->l('Priority'), 'type' => 'priority', 'values' => array($this->l('High'), $this->l('Medium'), $this->l('Low'))));
     $helper = new HelperList();
     $helper->shopLinkType = '';
     $helper->simple_header = true;
     $helper->no_link = true;
     $helper->actions = array('view');
     $helper->show_toolbar = false;
     $helper->module = $this;
     $helper->identifier = 'id_product';
     $helper->title = $this->l('Product list');
     $helper->table = $this->name;
     $helper->token = Tools::getAdminTokenLite('AdminModules');
     $helper->currentIndex = AdminController::$currentIndex . '&configure=' . $this->name;
     $helper->tpl_vars = array('priority' => array($this->l('High'), $this->l('Medium'), $this->l('Low')));
     return $helper->generateList($products, $fields_list);
 }
开发者ID:ortegon000,项目名称:tienda,代码行数:24,代码来源:blockwishlist.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Wizard类代码示例发布时间:2022-05-23
下一篇:
PHP WireData类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap