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


PHP Product::getCover方法代码示例

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


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

示例1: setProduct

 public function setProduct($product, $combination)
 {
     // create the product
     $context = Context::getContext();
     $this->give_it_product = new GiveItSdkProduct();
     $this->give_it_product->setCurrency($context->currency->iso_code);
     $usetax = Product::getTaxCalculationMethod((int) $context->customer->id) != PS_TAX_EXC;
     if ($combination['id_product_attribute'] == 0) {
         $combination['attributes'] = '';
         $image = Product::getCover($product->id);
     } else {
         $comb = new Combination($combination['id_product_attribute']);
         if ($image = $comb->getWsImages()) {
             $image = $image[0];
             $image['id_image'] = $image['id'];
         }
     }
     $image['id_product'] = $product->id;
     $image['id_image'] = Product::defineProductImage($image, Context::getContext()->language->id);
     $img_profile = version_compare(_PS_VERSION_, '1.5', '<') ? 'home' : ImageType::getFormatedName('medium');
     $image = $image ? $context->link->getImageLink($product->link_rewrite, $image['id_image'], $img_profile) : '';
     // first, set the product details.
     $this->give_it_product->setProductDetails(array('code' => $product->id . '_' . $combination['id_product_attribute'], 'price' => (int) (Product::getPriceStatic((int) $product->id, $usetax, $combination['id_product_attribute']) * 100), 'name' => $product->name . ($combination['attributes'] ? ' : ' . $combination['attributes'] : ''), 'image' => $image));
     $delivery = $this->setDelivery();
     // add the delivery option to the product
     $this->give_it_product->addBuyerOption($delivery);
     //We should validate this product
     $this->product_valid = $this->give_it_product->validate();
 }
开发者ID:TheTypoMaster,项目名称:neotienda,代码行数:29,代码来源:giveit.class.php

示例2: hookExtraLeft

 public function hookExtraLeft($params)
 {
     /* Product informations */
     $product = new Product((int) Tools::getValue('id_product'), false, $this->context->language->id);
     $image = Product::getCover((int) $product->id);
     $this->context->smarty->assign(array('stf_product' => $product, 'stf_product_cover' => (int) $product->id . '-' . (int) $image['id_image'], 'stf_secure_key' => $this->secure_key));
     return $this->display(__FILE__, 'sendtoafriend-extra.tpl');
 }
开发者ID:Sosiashvili,项目名称:docker-prestashop,代码行数:8,代码来源:sendtoafriend.php

示例3: getItems

 /**
  * Get product pack items
  *
  * @param int $id_product
  * @param int $id_lang
  */
 public function getItems($id_product, $id_lang)
 {
     $packItems = \PackCore::getItems($id_product, $id_lang);
     foreach ($packItems as $k => $packItem) {
         $cover = $packItem->id_pack_product_attribute ? \Product::getCombinationImageById($packItem->id_pack_product_attribute, $id_lang) : \Product::getCover($packItem->id);
         $packItem->image = \Context::getContext()->link->getImageLink($packItem->link_rewrite, $cover ? $cover['id_image'] : '', 'home_default');
     }
     return $packItems;
 }
开发者ID:M03G,项目名称:PrestaShop,代码行数:15,代码来源:PackDataProvider.php

示例4: process

 public function process()
 {
     parent::process();
     $hasProduct = false;
     $product_list = Tools::getValue('compare_product_list');
     $postProducts = isset($product_list) ? rtrim($product_list, '|') : '';
     if (!Configuration::get('PS_COMPARATOR_MAX_ITEM')) {
         return Tools::redirect('404.php');
     }
     if ($postProducts) {
         $ids = array_unique(explode('|', $postProducts));
         if (sizeof($ids) > 0) {
             if (sizeof($ids) > Configuration::get('PS_COMPARATOR_MAX_ITEM')) {
                 $ids = array_slice($ids, 0, Configuration::get('PS_COMPARATOR_MAX_ITEM'));
             }
             $listProducts = array();
             $listFeatures = array();
             foreach ($ids as $id) {
                 $curProduct = new Product((int) $id, true, (int) self::$cookie->id_lang);
                 if (!Validate::isLoadedObject($curProduct)) {
                     continue;
                 }
                 if (!$curProduct->active) {
                     unset($ids[$k]);
                     continue;
                 }
                 foreach ($curProduct->getFrontFeatures(self::$cookie->id_lang) as $feature) {
                     $listFeatures[$curProduct->id][$feature['id_feature']] = $feature['value'];
                 }
                 $cover = Product::getCover((int) $id);
                 $curProduct->id_image = Tools::htmlentitiesUTF8(Product::defineProductImage(array('id_image' => $cover['id_image'], 'id_product' => $id), self::$cookie->id_lang));
                 $curProduct->allow_oosp = Product::isAvailableWhenOutOfStock($curProduct->out_of_stock);
                 $listProducts[] = $curProduct;
             }
             if (sizeof($listProducts) > 0) {
                 $width = 80 / sizeof($listProducts);
                 $hasProduct = true;
                 $ordered_features = Feature::getFeaturesForComparison($ids, self::$cookie->id_lang);
                 self::$smarty->assign(array('ordered_features' => $ordered_features, 'product_features' => $listFeatures, 'products' => $listProducts, 'link' => new Link(), 'width' => $width, 'homeSize' => Image::getSize('home')));
                 self::$smarty->assign('HOOK_EXTRA_PRODUCT_COMPARISON', Module::hookExec('extraProductComparison', array('list_ids_product' => $ids)));
             }
         }
     }
     self::$smarty->assign('hasProduct', $hasProduct);
 }
开发者ID:priyankajsr19,项目名称:indusdiva2,代码行数:45,代码来源:CompareController.php

示例5: setItemBuys

 function setItemBuys($id_order, $items)
 {
     if (count($items)) {
         $buys = array();
         foreach ($items as $item) {
             $id_image = Product::getCover($item['id']);
             $image_url = '';
             if (sizeof($id_image) > 0) {
                 $image = new Image($id_image['id_image']);
                 // get image full URL
                 $image_url = _PS_BASE_URL_ . _THEME_PROD_DIR_ . $image->getExistingImgPath() . ".jpg";
             }
             $sql = "INSERT INTO " . _DB_PREFIX_ . "neo_items_buys (id_product, id_neo_exchange, name, price, image, created_at, status)\n                    VALUES ('" . $item['id'] . "','" . $id_order . "','" . pSQL($item['name']) . "','" . $item['price'] . "','" . $image_url . "',now(),1)";
             Db::getInstance()->executeS($sql);
             $sql = "UPDATE " . _DB_PREFIX_ . "stock_available SET quantity = quantity+(-1) WHERE id_product = '" . $item['id'] . "'";
             Db::getInstance()->execute($sql);
             $buys[] = '<div style="vertical-align:top"><img style="float:left;margin-right:10px;border:1px solid rgb(204,204,204);height:79px" alt="' . $item['name'] . '" src="' . $image_url . '"/> ' . $item['name'] . '<br><br>' . $item['price'] . '</div>';
         }
         return $buys;
     } else {
         return false;
     }
 }
开发者ID:TheTypoMaster,项目名称:neotienda,代码行数:23,代码来源:Exchange.php

示例6: hookProductTabContent

 public function hookProductTabContent($params)
 {
     $this->context->controller->addJS($this->_path . 'js/jquery.rating.pack.js');
     $this->context->controller->addJS($this->_path . 'js/jquery.textareaCounter.plugin.js');
     $this->context->controller->addJS($this->_path . 'js/productcomments.js');
     $id_guest = !($id_customer = (int) $this->context->cookie->id_customer) ? (int) $this->context->cookie->id_guest : false;
     $customerComment = ProductComment::getByCustomer((int) Tools::getValue('id_product'), (int) $this->context->cookie->id_customer, true, (int) $id_guest);
     $averages = ProductComment::getAveragesByProduct((int) Tools::getValue('id_product'), $this->context->language->id);
     $averageTotal = 0;
     foreach ($averages as $average) {
         $averageTotal += (double) $average;
     }
     $averageTotal = count($averages) ? $averageTotal / count($averages) : 0;
     $image = Product::getCover((int) Tools::getValue('id_product'));
     $this->context->smarty->assign(array('logged' => (int) $this->context->customer->isLogged(true), 'action_url' => '', 'comments' => ProductComment::getByProduct((int) Tools::getValue('id_product'), 1, null, $this->context->cookie->id_customer), 'criterions' => ProductCommentCriterion::getByProduct((int) Tools::getValue('id_product'), $this->context->language->id), 'averages' => $averages, 'product_comment_path' => $this->_path, 'averageTotal' => $averageTotal, 'allow_guests' => (int) Configuration::get('PRODUCT_COMMENTS_ALLOW_GUESTS'), 'too_early' => $customerComment && strtotime($customerComment['date_add']) + Configuration::get('PRODUCT_COMMENTS_MINIMAL_TIME') > time(), 'delay' => Configuration::get('PRODUCT_COMMENTS_MINIMAL_TIME'), 'id_product_comment_form' => (int) Tools::getValue('id_product'), 'secure_key' => $this->secure_key, 'productcomment_cover' => (int) Tools::getValue('id_product') . '-' . (int) $image['id_image'], 'mediumSize' => Image::getSize('medium'), 'nbComments' => (int) ProductComment::getCommentNumber((int) Tools::getValue('id_product')), 'productcomments_controller_url' => $this->context->link->getModuleLink('productcomments'), 'productcomments_url_rewriting_activated' => Configuration::get('PS_REWRITING_SETTINGS', 0)));
     $this->context->controller->pagination((int) ProductComment::getCommentNumber((int) Tools::getValue('id_product')));
     return $this->display(__FILE__, '/productcomments.tpl');
 }
开发者ID:jicheng17,项目名称:vipinsg,代码行数:18,代码来源:productcomments.php

示例7: preparedValues

 /**
  * @param Product $product to get the product properties
  * @param array $combination to get particular properties from a declination
  * @param int $lang id lang to take all text in good language
  * @param Link $link to set the link of the product and its images.
  * @param Carrier $carrier not used now, but usable for next version, needed for calculate the shipping cost,
  * 		  But for now it's not sure enough.
  * @return array with good value for the XML.
  */
 private function preparedValues(Product $product, $combination, $lang, Link $link, Carrier $carrier)
 {
     $arr_return = array();
     $str_features = array();
     $model = array();
     $version = str_replace('.', '', _PS_VERSION_);
     // To build description and model tags.
     if (isset($combination['attributes'])) {
         foreach ($combination['attributes'] as $attribut) {
             $str_features[] = $attribut['group_name'] . ' : ' . $attribut['name'];
             $model[] = $attribut['name'];
         }
     }
     if (isset($combination['weight']) && (int) $combination['weight'] !== 0) {
         $str_features[] = 'weight : ' . $combination['weight'];
     } elseif ($product->weight !== 0) {
         $str_features[] = 'weight : ' . $product->weight;
     }
     $features = $product->getFrontFeatures($lang);
     foreach ($features as $feature) {
         $str_features[] = $feature['name'] . ' : ' . $feature['value'];
     }
     // Category tag
     $category = new Category((int) $product->id_category_default, $lang);
     $category_path = (isset($category->id) and $category->id) ? Tools::getFullPath((int) $category->id, $product->name[$lang]) : Tools::getFullPath((int) $product->id_category_default, $product->name[$lang]);
     $category_path = Configuration::get('PS_NAVIGATION_PIPE') != false && Configuration::get('PS_NAVIGATION_PIPE') !== '>' ? str_replace(Configuration::get('PS_NAVIGATION_PIPE'), '>', $category_path) : $category_path;
     // image tag
     $id_image = isset($combination['id_image']) ? $combination['id_image'] : 0;
     if ($id_image === 0 || $id_image < 0) {
         $image = $product->getCover((int) $product->id);
         $id_image = $image['id_image'];
     }
     $quantity = Product::getQuantity($product->id, isset($combination['id_combination']) ? $combination['id_combination'] : NULL);
     $condition = '';
     if (strlen((string) $version) < 2) {
         $version = (string) $version . '0';
     }
     if ((int) substr($version, 0, 2) >= 14) {
         $condition = $product->condition === 'new' ? 0 : 1;
     }
     $price = $product->getPrice(true, isset($combination['id_combination']) ? $combination['id_combination'] : NULL, 2);
     $upc_ean = strlen((string) $product->ean13) == 13 ? $product->ean13 : '';
     $arr_return['product_url'] = $link->getProductLink((int) $product->id, $product->link_rewrite[$lang], $product->ean13, $lang);
     $arr_return['designation'] = Tools::htmlentitiesUTF8($product->name[$lang] . ' ' . Manufacturer::getNameById($product->id_manufacturer) . ' ' . implode(' ', $model));
     $arr_return['price'] = $price;
     $arr_return['category'] = Tools::htmlentitiesUTF8(strip_tags($category_path));
     if (substr(_PS_VERSION_, 0, 3) == '1.3') {
         if (!Configuration::get('PS_SHOP_DOMAIN')) {
             Configuration::updateValue('PS_SHOP_DOMAIN', $_SERVER['HTTP_HOST']);
         }
         $prefix = 'http://' . Configuration::get('PS_SHOP_DOMAIN') . '/';
         $arr_return['image_url'] = $prefix . $link->getImageLink('', $product->id . '-' . $id_image, 'large');
     } else {
         $arr_return['image_url'] = $link->getImageLink($product->link_rewrite[$lang], $product->id . '-' . $id_image, 'large');
     }
     // Must description added since Twenga-module v1.1
     $arr_return['description'] = is_array($product->description) ? strip_tags($product->description[$lang]) : strip_tags($product->description);
     $arr_return['description'] = trim($arr_return['description'] . ' ' . strip_tags(implode(', ', $str_features)));
     $arr_return['description'] = Tools::htmlentitiesUTF8($arr_return['description']);
     $arr_return['brand'] = Manufacturer::getNameById($product->id_manufacturer);
     $arr_return['merchant_id'] = $product->id;
     $arr_return['manufacturer_id'] = $product->id_manufacturer;
     $arr_return['shipping_cost'] = 'NC';
     $arr_return['in_stock'] = $quantity > 0 ? 'Y' : 'N';
     $arr_return['stock_detail'] = $quantity;
     $arr_return['condition'] = $condition;
     $arr_return['upc_ean'] = $upc_ean;
     $arr_return['eco_tax'] = $product->ecotax;
     // for prestashop 1.4 and previous version these fields are not managed.
     // So default values are set.
     $arr_return['product_type'] = '1';
     $arr_return['isbn'] = '';
     return $arr_return;
 }
开发者ID:srikanthash09,项目名称:codetestdatld,代码行数:83,代码来源:twenga.php

示例8: getProductImageUrl

 private function getProductImageUrl($id_product)
 {
     $id_image = Product::getCover($id_product);
     if (count($id_image) > 0) {
         $image = new Image($id_image['id_image']);
         return $image_url = method_exists($image, 'getExistingImgPath') ? _PS_BASE_URL_ . _THEME_PROD_DIR_ . $image->getExistingImgPath() . ".jpg" : $this->getExistingImgPath($image);
     }
     return null;
 }
开发者ID:juniorhq88,项目名称:PrestaShop-modules,代码行数:9,代码来源:yotpo.php

示例9: initContent

 /**
  * Assign template vars related to page content
  * @see FrontController::initContent()
  */
 public function initContent()
 {
     parent::initContent();
     //Clean compare product table
     CompareProduct::cleanCompareProducts('week');
     $hasProduct = false;
     if (!Configuration::get('PS_COMPARATOR_MAX_ITEM')) {
         return Tools::redirect('index.php?controller=404');
     }
     if (($product_list = Tools::getValue('compare_product_list')) && ($postProducts = isset($product_list) ? rtrim($product_list, '|') : '')) {
         $ids = array_unique(explode('|', $postProducts));
     } else {
         if (isset($this->context->cookie->id_compare)) {
             $ids = CompareProduct::getCompareProducts($this->context->cookie->id_compare);
         } else {
             $ids = null;
         }
     }
     if ($ids) {
         if (count($ids) > 0) {
             if (count($ids) > Configuration::get('PS_COMPARATOR_MAX_ITEM')) {
                 $ids = array_slice($ids, 0, Configuration::get('PS_COMPARATOR_MAX_ITEM'));
             }
             $listProducts = array();
             $listFeatures = array();
             foreach ($ids as $k => &$id) {
                 $curProduct = new Product((int) $id, true, $this->context->language->id);
                 if (!Validate::isLoadedObject($curProduct) || !$curProduct->active || !$curProduct->isAssociatedToShop()) {
                     if (isset($this->context->cookie->id_compare)) {
                         CompareProduct::removeCompareProduct($this->context->cookie->id_compare, $id);
                     }
                     unset($ids[$k]);
                     continue;
                 }
                 foreach ($curProduct->getFrontFeatures($this->context->language->id) as $feature) {
                     $listFeatures[$curProduct->id][$feature['id_feature']] = $feature['value'];
                 }
                 $cover = Product::getCover((int) $id);
                 $curProduct->id_image = Tools::htmlentitiesUTF8(Product::defineProductImage(array('id_image' => $cover['id_image'], 'id_product' => $id), $this->context->language->id));
                 $curProduct->allow_oosp = Product::isAvailableWhenOutOfStock($curProduct->out_of_stock);
                 $listProducts[] = $curProduct;
             }
             if (count($listProducts) > 0) {
                 $width = 80 / count($listProducts);
                 $hasProduct = true;
                 $ordered_features = Feature::getFeaturesForComparison($ids, $this->context->language->id);
                 $this->context->smarty->assign(array('ordered_features' => $ordered_features, 'product_features' => $listFeatures, 'products' => $listProducts, 'width' => $width, 'homeSize' => Image::getSize(ImageType::getFormatedName('home'))));
                 $this->context->smarty->assign('HOOK_EXTRA_PRODUCT_COMPARISON', Hook::exec('displayProductComparison', array('list_ids_product' => $ids)));
             } else {
                 if (isset($this->context->cookie->id_compare)) {
                     $object = new CompareProduct((int) $this->context->cookie->id_compare);
                     if (Validate::isLoadedObject($object)) {
                         $object->delete();
                     }
                 }
             }
         }
     }
     $this->context->smarty->assign('hasProduct', $hasProduct);
     $this->setTemplate(_PS_THEME_DIR_ . 'products-comparison.tpl');
 }
开发者ID:FAVHYAN,项目名称:a3workout,代码行数:65,代码来源:CompareController.php

示例10: process


//.........这里部分代码省略.........
             }
             $images = $this->product->getImages((int) self::$cookie->id_lang);
             $productImages = array();
             foreach ($images as $k => $image) {
                 if ($image['cover']) {
                     self::$smarty->assign('mainImage', $images[0]);
                     $cover = $image;
                     $cover['id_image'] = Configuration::get('PS_LEGACY_IMAGES') ? $this->product->id . '-' . $image['id_image'] : $image['id_image'];
                     $cover['id_image_only'] = (int) $image['id_image'];
                 }
                 $productImages[(int) $image['id_image']] = $image;
             }
             if (!isset($cover)) {
                 $cover = array('id_image' => Language::getIsoById(self::$cookie->id_lang) . '-default', 'legend' => 'No picture', 'title' => 'No picture');
             }
             $size = Image::getSize('large');
             self::$smarty->assign(array('cover' => $cover, 'imgWidth' => (int) $size['width'], 'mediumSize' => Image::getSize('medium'), 'largeSize' => Image::getSize('large'), 'accessories' => $this->product->getAccessories((int) self::$cookie->id_lang)));
             if (sizeof($productImages)) {
                 self::$smarty->assign('images', $productImages);
             }
             if ((int) Tools::getValue('pp') == 1) {
                 $time5 = time();
                 echo 'time5: ' . $time5;
             }
             /* Attributes / Groups & colors */
             $colors = array();
             //see if the product has shades
             if ($this->product->id_group && $this->product->id_group > 0) {
                 global $link;
                 $related_productIds = $this->product->getRelatedProducts();
                 $related_products = array();
                 foreach ($related_productIds as &$productId) {
                     $relProduct = new Product((int) $productId['id_product'], true, self::$cookie->id_lang);
                     $idImage = $relProduct->getCoverWs();
                     if ($idImage) {
                         $idImage = $relProduct->id . '-' . $idImage;
                     } else {
                         $idImage = Language::getIsoById(1) . '-default';
                     }
                     $relProduct->image_link = $link->getImageLink($relProduct->link_rewrite, $idImage, 'small');
                     $relProduct->link = $relProduct->getLink();
                     $related_products[] = $relProduct;
                 }
                 self::$smarty->assign('relatedProducts', $related_products);
             }
             if ((int) Tools::getValue('pp') == 1) {
                 $time6 = time();
                 echo 'time6: ' . $time6;
             }
             $attributesGroups = $this->product->getAttributesGroups((int) self::$cookie->id_lang);
             // @todo (RM) should only get groups and not all declination ?
             if (is_array($attributesGroups) and $attributesGroups) {
                 $groups = array();
                 $combinationImages = $this->product->getCombinationImages((int) self::$cookie->id_lang);
                 foreach ($attributesGroups as $k => $row) {
                     /* Color management */
                     if ((isset($row['attribute_color']) and $row['attribute_color'] or file_exists(_PS_COL_IMG_DIR_ . $row['id_attribute'] . '.jpg')) and $row['id_attribute_group'] == $this->product->id_color_default) {
                         $colors[$row['id_attribute']]['value'] = $row['attribute_color'];
                         $colors[$row['id_attribute']]['name'] = $row['attribute_name'];
                         if (!isset($colors[$row['id_attribute']]['attributes_quantity'])) {
                             $colors[$row['id_attribute']]['attributes_quantity'] = 0;
                         }
                         $colors[$row['id_attribute']]['attributes_quantity'] += (int) $row['quantity'];
                     }
                     if (!isset($groups[$row['id_attribute_group']])) {
                         $groups[$row['id_attribute_group']] = array('name' => $row['public_group_name'], 'is_color_group' => $row['is_color_group'], 'default' => -1);
开发者ID:priyankajsr19,项目名称:indusdiva2,代码行数:67,代码来源:ProductController_20aug_bkp.php

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

示例12: addThumbnailUrlFromProductId

 public function addThumbnailUrlFromProductId($encoder, &$item, $product_id)
 {
     $cover_arr = Product::getCover($product_id);
     if (is_array($cover_arr)) {
         $encoder->addString($item, 'ThumbnailUrl', $this->getThumbnailUrlFromImageId(array_pop($cover_arr), $product_id));
     }
 }
开发者ID:sebastien-fauvel,项目名称:cartapi-plugin-prestashop,代码行数:7,代码来源:Items.php

示例13: getProductImageUrl

 private function getProductImageUrl($product_id, $link_rewrite, $image_name = 'medium')
 {
     $image_type = ImageType::getFormatedName($image_name);
     $image_url = false;
     $link_rewrite = (string) $link_rewrite;
     $image = Product::getCover($product_id);
     $id_image = (int) $image['id_image'];
     if (isset($link_rewrite[0]) && $id_image > 0) {
         $image_url = Context::getContext()->link->getImageLink($link_rewrite, $id_image, $image_type);
     }
     return $image_url;
 }
开发者ID:pacxs,项目名称:pacxscom,代码行数:12,代码来源:mobassistantconnector.php

示例14: Product

 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 {
                 $cover = Product::getCover($obj->id);
                 $products[$i]['cover'] = $obj->id . '-' . $cover['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'];
                     break;
                 }
             }
         }
         if (!isset($products[$i]['cover'])) {
             $products[$i]['cover'] = $context->language->iso_code . '-default';
         }
     }
开发者ID:toufikadfab,项目名称:PrestaShop-1.5,代码行数:31,代码来源:managewishlist.php

示例15: initContent

 /**
  * Assign template vars related to page content
  * @see FrontController::initContent()
  */
 public function initContent()
 {
     parent::initContent();
     /* id_carrier is not defined in database before choosing a carrier, set it to a default one to match a potential cart _rule */
     if (empty($this->context->cart->id_carrier)) {
         $checked = $this->context->cart->simulateCarrierSelectedOutput();
         $checked = (int) Cart::desintifier($checked);
         $this->context->cart->id_carrier = $checked;
         $this->context->cart->update();
         CartRule::autoRemoveFromCart($this->context);
         CartRule::autoAddToCart($this->context);
     }
     // SHOPPING CART
     $this->_assignSummaryInformations();
     // WRAPPING AND TOS
     $this->_assignWrappingAndTOS();
     if (Configuration::get('PS_RESTRICT_DELIVERED_COUNTRIES')) {
         $countries = Carrier::getDeliveredCountries($this->context->language->id, true, true);
     } else {
         $countries = Country::getCountries($this->context->language->id, true);
     }
     // If a rule offer free-shipping, force hidding shipping prices
     $free_shipping = false;
     foreach ($this->context->cart->getCartRules() as $rule) {
         if ($rule['free_shipping'] && !$rule['carrier_restriction']) {
             $free_shipping = true;
             break;
         }
     }
     $this->context->smarty->assign(array('free_shipping' => $free_shipping, 'isGuest' => isset($this->context->cookie->is_guest) ? $this->context->cookie->is_guest : 0, 'countries' => $countries, 'sl_country' => (int) Tools::getCountry(), 'PS_GUEST_CHECKOUT_ENABLED' => Configuration::get('PS_GUEST_CHECKOUT_ENABLED'), 'errorCarrier' => Tools::displayError('You must choose a carrier.', false), 'errorTOS' => Tools::displayError('You must accept the Terms of Service.', false), 'isPaymentStep' => isset($_GET['isPaymentStep']) && $_GET['isPaymentStep'], 'genders' => Gender::getGenders(), 'one_phone_at_least' => (int) Configuration::get('PS_ONE_PHONE_AT_LEAST'), 'HOOK_CREATE_ACCOUNT_FORM' => Hook::exec('displayCustomerAccountForm'), 'HOOK_CREATE_ACCOUNT_TOP' => Hook::exec('displayCustomerAccountFormTop')));
     $years = Tools::dateYears();
     $months = Tools::dateMonths();
     $days = Tools::dateDays();
     $this->context->smarty->assign(array('years' => $years, 'months' => $months, 'days' => $days));
     /* Load guest informations */
     if ($this->isLogged && $this->context->cookie->is_guest) {
         $this->context->smarty->assign('guestInformations', $this->_getGuestInformations());
     }
     // ADDRESS
     if ($this->isLogged) {
         $this->_assignAddress();
     }
     // CARRIER
     $this->_assignCarrier();
     // PAYMENT
     $this->_assignPayment();
     Tools::safePostVars();
     $newsletter = Configuration::get('PS_CUSTOMER_NWSL') || Module::isInstalled('blocknewsletter') && Module::getInstanceByName('blocknewsletter')->active;
     $this->context->smarty->assign('newsletter', $newsletter);
     $this->context->smarty->assign('optin', (bool) Configuration::get('PS_CUSTOMER_OPTIN'));
     $this->context->smarty->assign('field_required', $this->context->customer->validateFieldsRequiredDatabase());
     $this->_processAddressFormat();
     $link = new Link();
     if (Tools::getValue('deleteFromOrderLine')) {
         $id_product = Tools::getValue('id_product');
         $date_from = Tools::getValue('date_from');
         $date_to = Tools::getValue('date_to');
         $obj_cart_bk_data = new HotelCartBookingData();
         $cart_data_dlt = $obj_cart_bk_data->deleteRoomDataFromOrderLine($this->context->cart->id, $this->context->cart->id_guest, $id_product, $date_from, $date_to);
         if ($cart_data_dlt) {
             Tools::redirect($link->getPageLink('order', null, $this->context->language->id));
         }
     }
     if ((bool) Configuration::get('PS_ADVANCED_PAYMENT_API')) {
         $this->addJS(_THEME_JS_DIR_ . 'advanced-payment-api.js');
         $this->setTemplate(_PS_THEME_DIR_ . 'order-opc-advanced.tpl');
     } else {
         if (Module::isInstalled('hotelreservationsystem')) {
             require_once _PS_MODULE_DIR_ . 'hotelreservationsystem/define.php';
             $obj_cart_bk_data = new HotelCartBookingData();
             $obj_htl_bk_dtl = new HotelBookingDetail();
             $obj_rm_type = new HotelRoomType();
             $htl_rm_types = $this->context->cart->getProducts();
             if (!empty($htl_rm_types)) {
                 foreach ($htl_rm_types as $type_key => $type_value) {
                     $product = new Product($type_value['id_product'], false, $this->context->language->id);
                     $cover_image_arr = $product->getCover($type_value['id_product']);
                     if (!empty($cover_image_arr)) {
                         $cover_img = $this->context->link->getImageLink($product->link_rewrite, $product->id . '-' . $cover_image_arr['id_image'], 'small_default');
                     } else {
                         $cover_img = $this->context->link->getImageLink($product->link_rewrite, $this->context->language->iso_code . "-default", 'small_default');
                     }
                     $unit_price = Product::getPriceStatic($type_value['id_product'], true, null, 6, null, false, true, 1);
                     if (isset($this->context->customer->id)) {
                         $cart_bk_data = $obj_cart_bk_data->getOnlyCartBookingData($this->context->cart->id, $this->context->cart->id_guest, $type_value['id_product']);
                     } else {
                         $cart_bk_data = $obj_cart_bk_data->getOnlyCartBookingData($this->context->cart->id, $this->context->cart->id_guest, $type_value['id_product']);
                     }
                     $rm_dtl = $obj_rm_type->getRoomTypeInfoByIdProduct($type_value['id_product']);
                     $cart_htl_data[$type_key]['id_product'] = $type_value['id_product'];
                     $cart_htl_data[$type_key]['cover_img'] = $cover_img;
                     $cart_htl_data[$type_key]['name'] = $product->name;
                     $cart_htl_data[$type_key]['unit_price'] = $unit_price;
                     $cart_htl_data[$type_key]['adult'] = $rm_dtl['adult'];
                     $cart_htl_data[$type_key]['children'] = $rm_dtl['children'];
                     foreach ($cart_bk_data as $data_k => $data_v) {
//.........这里部分代码省略.........
开发者ID:Rohit-jn,项目名称:hotelcommerce,代码行数:101,代码来源:OrderOpcController.php


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