require_once dirname(__FILE__) . '/../../init.php'; require_once dirname(__FILE__) . '/WishList.php'; require_once dirname(__FILE__) . '/blockwishlist.php'; $context = Context::getContext(); if ($context->customer->isLogged()) { $action = Tools::getValue('action'); $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'];