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


PHP WishList::removeProduct方法代码示例

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


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

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

示例2: WishList

                $id_wishlist = (int) $wishlists[0]['id_wishlist'];
                $cookie->id_wishlist = (int) $id_wishlist;
            } else {
                $wishlist = new WishList();
                $modWishlist = new BlockWishList();
                $wishlist->name = $modWishlist->default_wishlist_name;
                $wishlist->id_customer = (int) $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();
                $cookie->id_wishlist = (int) $wishlist->id;
            }
        }
        if ($add and $quantity) {
            WishList::addProduct($cookie->id_wishlist, $cookie->id_customer, $id_product, $id_product_attribute, $quantity);
        } elseif ($delete) {
            WishList::removeProduct($cookie->id_wishlist, $cookie->id_customer, $id_product, $id_product_attribute);
        }
    }
    $smarty->assign('products', WishList::getProductByIdCustomer($cookie->id_wishlist, $cookie->id_customer, $cookie->id_lang, null, true));
    if (Tools::file_exists_cache(_PS_THEME_DIR_ . 'modules/blockwishlist/blockwishlist-ajax.tpl')) {
        $smarty->display(_PS_THEME_DIR_ . 'modules/blockwishlist/blockwishlist-ajax.tpl');
    } elseif (Tools::file_exists_cache(dirname(__FILE__) . '/blockwishlist-ajax.tpl')) {
        $smarty->display(dirname(__FILE__) . '/blockwishlist-ajax.tpl');
    } else {
        echo Tools::displayError('No template found');
    }
} else {
    echo Tools::displayError('You must be logged in to manage your wishlist.');
}
开发者ID:greench,项目名称:prestashop,代码行数:31,代码来源:cart.php

示例3: BlockWishList

            $wishlist->id_shop = $context->shop->id;
            $wishlist->id_shop_group = $context->shop->id_shop_group;
            $wishlist->default = 1;
            $mod_wishlist = new BlockWishList();
            $wishlist->name = $mod_wishlist->default_wishlist_name;
            $wishlist->id_customer = (int) $context->customer->id;
            list($us, $s) = explode(' ', microtime());
            srand($s * $us);
            $wishlist->token = strtoupper(substr(sha1(uniqid(rand(), true) . _COOKIE_KEY_ . $context->customer->id), 0, 16));
            $wishlist->add();
            $context->cookie->id_wishlist = (int) $wishlist->id;
        }
        if ($add && $quantity) {
            WishList::addProduct($context->cookie->id_wishlist, $context->customer->id, $id_product, $id_product_attribute, $quantity);
        } else {
            if ($delete) {
                WishList::removeProduct($context->cookie->id_wishlist, $context->customer->id, $id_product, $id_product_attribute);
            }
        }
    }
    $context->smarty->assign('products', WishList::getProductByIdCustomer($context->cookie->id_wishlist, $context->customer->id, $context->language->id, null, true));
    if (Tools::file_exists_cache(_PS_THEME_DIR_ . 'modules/blockwishlist/blockwishlist-ajax.tpl')) {
        $context->smarty->display(_PS_THEME_DIR_ . 'modules/blockwishlist/blockwishlist-ajax.tpl');
    } elseif (Tools::file_exists_cache(dirname(__FILE__) . '/blockwishlist-ajax.tpl')) {
        $context->smarty->display(dirname(__FILE__) . '/blockwishlist-ajax.tpl');
    } else {
        echo $module->l('No template found', 'cart');
    }
} else {
    echo $module->l('You must be logged in to manage your wishlist.', 'cart');
}
开发者ID:ortegon000,项目名称:tienda,代码行数:31,代码来源:cart.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) || !Validate::isUnsignedId($id_customer) || !Validate::isUnsignedId($id_product) || !Validate::isUnsignedFloat($quantity)) {
            die(Tools::displayError());
        }
        $qty_policy_legacy = PP::productQtyPolicyLegacy($id_product);
        $result = Db::getInstance()->getRow('
		SELECT wp.`quantity`, wp.`quantity_fractional`
		  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 && count($result)) {
            $qty = $qty_policy_legacy ? $result['quantity'] : $result['quantity'] * $result['quantity_fractional'];
            if ($qty + $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` = ' . ($qty_policy_legacy ? (int) ($quantity + $qty) : 1) . ',
				`quantity_fractional` = ' . ($qty_policy_legacy ? 0 : (double) ($quantity + $qty)) . '
				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`, `quantity_fractional`, `priority`) VALUES(
			' . (int) $id_wishlist . ',
			' . (int) $id_product . ',
			' . (int) $id_product_attribute . ',
			' . ($qty_policy_legacy ? (int) $quantity : 1) . ',
			' . ($qty_policy_legacy ? 0 : (double) $quantity) . ',
			 1)');
        }
    }
开发者ID:Oldwo1f,项目名称:yakaboutique,代码行数:43,代码来源:WishList.php


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