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


PHP Product::getFrontFeaturesStatic方法代码示例

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


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

示例1: getFrontFeatures

 public function getFrontFeatures($id_lang)
 {
     return Product::getFrontFeaturesStatic($id_lang, $this->id);
 }
开发者ID:jicheng17,项目名称:vipinsg,代码行数:4,代码来源:Product.php

示例2: getProductProperties

 public static function getProductProperties($id_lang, $row)
 {
     if (!$row['id_product']) {
         return false;
     }
     // Product::getDefaultAttribute is only called if id_product_attribute is missing from the SQL query at the origin of it: consider adding it in order to avoid unnecessary queries
     $row['allow_oosp'] = Product::isAvailableWhenOutOfStock($row['out_of_stock']);
     if ((!isset($row['id_product_attribute']) or !$row['id_product_attribute']) and (isset($row['cache_default_attribute']) and ($ipa_default = $row['cache_default_attribute']) !== NULL or $ipa_default = Product::getDefaultAttribute($row['id_product'], !$row['allow_oosp']))) {
         $row['id_product_attribute'] = $ipa_default;
     }
     if (!isset($row['id_product_attribute'])) {
         $row['id_product_attribute'] = 0;
     }
     // Tax
     $usetax = Tax::excludeTaxeOption();
     $cacheKey = $row['id_product'] . '-' . $row['id_product_attribute'] . '-' . $id_lang . '-' . (int) $usetax;
     if (array_key_exists($cacheKey, self::$producPropertiesCache)) {
         return self::$producPropertiesCache[$cacheKey];
     }
     // Datas
     $link = new Link();
     $row['category'] = Category::getLinkRewrite((int) $row['id_category_default'], (int) $id_lang);
     $row['link'] = $link->getProductLink((int) $row['id_product'], $row['link_rewrite'], $row['category'], $row['ean13']);
     $row['attribute_price'] = (isset($row['id_product_attribute']) and $row['id_product_attribute']) ? (double) Product::getProductAttributePrice($row['id_product_attribute']) : 0;
     $row['price_tax_exc'] = Product::getPriceStatic((int) $row['id_product'], false, (isset($row['id_product_attribute']) and !empty($row['id_product_attribute'])) ? (int) $row['id_product_attribute'] : NULL, self::$_taxCalculationMethod == PS_TAX_EXC ? 2 : 6);
     if (self::$_taxCalculationMethod == PS_TAX_EXC) {
         $row['price_tax_exc'] = Tools::ps_round($row['price_tax_exc'], 2);
         $row['price'] = Product::getPriceStatic((int) $row['id_product'], true, (isset($row['id_product_attribute']) and !empty($row['id_product_attribute'])) ? (int) $row['id_product_attribute'] : NULL, 6);
         $row['price_without_reduction'] = Product::getPriceStatic((int) $row['id_product'], false, (isset($row['id_product_attribute']) and !empty($row['id_product_attribute'])) ? (int) $row['id_product_attribute'] : NULL, 2, NULL, false, false);
     } else {
         $row['price'] = Tools::ps_round(Product::getPriceStatic((int) $row['id_product'], true, (isset($row['id_product_attribute']) and !empty($row['id_product_attribute'])) ? (int) $row['id_product_attribute'] : NULL, 2), 2);
         $row['price_without_reduction'] = Product::getPriceStatic((int) $row['id_product'], true, (isset($row['id_product_attribute']) and !empty($row['id_product_attribute'])) ? (int) $row['id_product_attribute'] : NULL, 6, NULL, false, false);
     }
     $row['reduction'] = Product::getPriceStatic((int) $row['id_product'], (bool) $usetax, (int) $row['id_product_attribute'], 6, NULL, true, true, 1, true, NULL, NULL, NULL, $specific_prices);
     $row['specific_prices'] = $specific_prices;
     if ($row['id_product_attribute']) {
         $row['quantity_all_versions'] = $row['quantity'];
         $row['quantity'] = Product::getQuantity((int) $row['id_product'], $row['id_product_attribute'], isset($row['cache_is_pack']) ? $row['cache_is_pack'] : NULL);
     }
     $row['id_image'] = Product::defineProductImage($row, $id_lang);
     $row['features'] = Product::getFrontFeaturesStatic((int) $id_lang, $row['id_product']);
     $row['attachments'] = (!isset($row['cache_has_attachments']) or $row['cache_has_attachments']) ? Product::getAttachmentsStatic((int) $id_lang, $row['id_product']) : array();
     // Pack management
     $row['pack'] = !isset($row['cache_is_pack']) ? Pack::isPack($row['id_product']) : (int) $row['cache_is_pack'];
     $row['packItems'] = $row['pack'] ? Pack::getItemTable($row['id_product'], $id_lang) : array();
     $row['nopackprice'] = $row['pack'] ? Pack::noPackPrice($row['id_product']) : 0;
     if ($row['pack'] and !Pack::isInStock($row['id_product'])) {
         $row['quantity'] = 0;
     }
     self::$producPropertiesCache[$cacheKey] = $row;
     return self::$producPropertiesCache[$cacheKey];
 }
开发者ID:srikanthash09,项目名称:codetestdatld,代码行数:52,代码来源:Product.php

示例3: process

 public function process()
 {
     parent::process();
     if (!($id_category = (int) Tools::getValue('id_category')) or !Validate::isUnsignedId($id_category)) {
         $this->errors[] = Tools::displayError('Missing category ID');
     } else {
         if (!Validate::isLoadedObject($this->category)) {
             $this->errors[] = Tools::displayError('Category does not exist');
         } elseif (!$this->category->checkAccess((int) self::$cookie->id_customer)) {
             $this->errors[] = Tools::displayError('You do not have access to this category.');
         } elseif (!$this->category->active) {
             self::$smarty->assign('category', $this->category);
         } else {
             $rewrited_url = self::$link->getCategoryLink((int) $this->category->id, $this->category->link_rewrite);
             /* Scenes  (could be externalised to another controler if you need them */
             self::$smarty->assign('scenes', Scene::getScenes((int) $this->category->id, (int) self::$cookie->id_lang, true, false));
             /* Scenes images formats */
             if ($sceneImageTypes = ImageType::getImagesTypes('scenes')) {
                 foreach ($sceneImageTypes as $sceneImageType) {
                     if ($sceneImageType['name'] == 'thumb_scene') {
                         $thumbSceneImageType = $sceneImageType;
                     } elseif ($sceneImageType['name'] == 'large_scene') {
                         $largeSceneImageType = $sceneImageType;
                     }
                 }
                 self::$smarty->assign('thumbSceneImageType', isset($thumbSceneImageType) ? $thumbSceneImageType : NULL);
                 self::$smarty->assign('largeSceneImageType', isset($largeSceneImageType) ? $largeSceneImageType : NULL);
             }
             $this->category->description = nl2br2($this->category->description);
             $subCategories = $this->category->getSubCategories((int) self::$cookie->id_lang);
             self::$smarty->assign('category', $this->category);
             if (Db::getInstance()->numRows()) {
                 self::$smarty->assign('subcategories', $subCategories);
                 self::$smarty->assign(array('subcategories_nb_total' => sizeof($subCategories), 'subcategories_nb_half' => ceil(sizeof($subCategories) / 2)));
             }
             if ($this->category->id != 1) {
                 $nbProducts = $this->category->getProducts(NULL, NULL, NULL, $this->orderBy, $this->orderWay, true);
                 $this->pagination((int) $nbProducts);
                 self::$smarty->assign('nb_products', (int) $nbProducts);
                 $cat_products = $this->category->getProducts((int) self::$cookie->id_lang, (int) $this->p, (int) $this->n, $this->orderBy, $this->orderWay);
                 if ($cat_products) {
                     foreach ($cat_products as $cat_product) {
                         $prod_features[$cat_product["id_product"]] = Product::getFrontFeaturesStatic(self::$cookie->id_lang, $cat_product['id_product']);
                         $aux_product = new Product($cat_product["id_product"], true, self::$cookie->id_lang);
                         $aux_attributesGroups = $aux_product->getAttributesGroups((int) self::$cookie->id_lang);
                         foreach ($aux_attributesGroups as $k => $row) {
                             $aux_combinations[$row['attribute_name']]['price'] = (double) $row['price'];
                         }
                         $prod_combinations[$cat_product["id_product"]] = $aux_combinations;
                         unset($aux_combinations);
                     }
                 }
             }
             if (isset($prod_features)) {
                 self::$smarty->assign('prod_features', $prod_features);
             }
             if (isset($prod_combinations)) {
                 self::$smarty->assign('prod_combinations', $prod_combinations);
             }
             self::$smarty->assign(array('products' => (isset($cat_products) and $cat_products) ? $cat_products : NULL, 'id_category' => (int) $this->category->id, 'id_category_parent' => (int) $this->category->id_parent, 'return_category_name' => Tools::safeOutput($this->category->name), 'path' => Tools::getPath((int) $this->category->id), 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), 'categorySize' => Image::getSize('category'), 'mediumSize' => Image::getSize('medium'), 'thumbSceneSize' => Image::getSize('thumb_scene'), 'homeSize' => Image::getSize('home')));
             foreach ($subCategories as $subCat) {
                 $secondLevelCats[$subCat["id_category"]] = $this->getSubCats($subCat["id_category"]);
             }
             if (isset($secondLevelCats)) {
                 self::$smarty->assign('secondLevelCats', $secondLevelCats);
             }
         }
     }
     self::$smarty->assign(array('allow_oosp' => (int) Configuration::get('PS_ORDER_OUT_OF_STOCK'), 'comparator_max_item' => (int) Configuration::get('PS_COMPARATOR_MAX_ITEM'), 'suppliers' => Supplier::getSuppliers()));
 }
开发者ID:ricardo-rdfs,项目名称:Portal-BIP,代码行数:70,代码来源:CategoryConfiguradorController.php

示例4: ajaxshowCalendar

 public function ajaxshowCalendar()
 {
     $id_lang = Context::getContext()->language->id;
     $id_shop = Tools::getValue('ids');
     $shop = new AphStore($id_shop, Context::getContext()->language->id);
     $shop->hours = json_decode($shop->hours, true);
     $id_currency = Validate::isLoadedObject(Context::getContext()->currency) ? (int) Context::getContext()->currency->id : (int) Configuration::get('PS_CURRENCY_DEFAULT');
     $context = Context::getContext();
     $context->shop->id = $id_shop;
     $dates = array();
     $dday = Tools::getValue('date');
     for ($i = 2; $i > 0; $i--) {
         if (date('Y-m-d', strtotime('-' . $i . ' day', strtotime($dday))) >= date('Y-m-d')) {
             $dates[] = date('Y-m-d', strtotime('-' . $i . ' day', strtotime($dday)));
         }
     }
     $dates[] = $dday;
     for ($d = sizeof($dates), $i = 1; $d < 5; $d++, $i++) {
         $dates[] = date('Y-m-d', strtotime('+' . $i . ' day', strtotime($dday)));
     }
     $id_product = Tools::getValue('id_product');
     $product = new Product($id_product, true, $id_lang, $id_shop);
     $product_need_tools = false;
     $product_need_employees = true;
     $service_duration = 0;
     $_features = Product::getFrontFeaturesStatic($id_lang, $id_product);
     foreach ($_features as &$feature) {
         if ($product->id_service_duration > 0 && $feature['id_feature'] == $product->id_service_duration) {
             $service_duration = (int) substr($feature['value'], 0, -1);
         }
         if ($product->id_service_duration < 1 && $feature['id_feature'] == Configuration::get('APH_FEATURE_DURATION')) {
             $service_duration = (int) substr($feature['value'], 0, -1);
         }
         if ($feature['id_feature'] == Configuration::get('APH_FEATURE_SERVICE_BY')) {
             if ((int) $feature['value'] == (int) Configuration::get('APH_FEATURE_SERVICE_BY_NO_EMPLOYEE')) {
                 $product_need_employees = false;
             }
         }
         $service_duration = (int) substr($feature['value'], 0, -1);
     }
     $id_tool = 0;
     $necessary_quantity_of_tool = 0;
     $products_use_this_tool = array();
     $tool = AphTool::getByShopAndProduct($id_shop, $id_product);
     if (!empty($tool)) {
         $id_tool = $tool[0]['id_tool'];
         $necessary_quantity_of_tool = $tool[0]['quantity'];
         $product_need_tools = true;
         $_products = AphTool::getProducts($id_tool);
         if (!empty($_products)) {
             foreach ($_products as &$_product) {
                 $products_use_this_tool[] = $_product['id_product'];
             }
         }
     }
     $employees = array();
     if ($product_need_employees) {
         $_employees = AphEmployeeProduct::getEmployeesByShopAndProduct($id_shop, $id_product);
         foreach ($_employees as &$employee) {
             $employees[] = $employee['id_employee'];
         }
     }
     $time_slice = (int) Configuration::get('APH_CALENDAR_TIME_SLICE_ONLINE');
     if ($service_duration > $time_slice) {
         for ($t = 1; $t <= 4; $t++) {
             if ($time_slice * $t >= $service_duration) {
                 $time_slice = $time_slice * $t;
                 break;
             }
         }
     }
     /*$attributues_by_value = array();
       $attributues = $product->getAttributesResume($id_lang, ': ', ', ');
       foreach ($attributues as &$attribute) {
           list($giorno, $orario) = explode(', ', $attribute['attribute_designation']);
           list(, $giorno) = explode(': ', $giorno);
           list(, $giorno) = explode(' ', $giorno);
           list(, $orario) = explode(': ', $orario);
           list(, $orario) = explode(' ', $orario);
           if (!array_key_exists($giorno, $attributues_by_value))
               $attributues_by_value[$giorno] = array();
           $attributues_by_value[$giorno][strval($orario)] = $attribute['id_product_attribute'];
       }*/
     $first_day = $last_day = NULL;
     $days = array();
     foreach ($dates as $day) {
         if (empty($first_day)) {
             $first_day = $day;
         }
         $last_day = $day;
         $days[$day] = array('date' => $day, 'date_ts' => strtotime($day), 'class' => 'store_opened', 'status' => 'opened', 'available' => true, 'price_from' => $product->price, 'times_tot' => 0, 'times_not_available' => 0, 'times_full' => 0, 'times' => array());
         $days[$day]['date_lang'] = date('d/m/Y', $days[$day]['date_ts']);
         $days[$day]['week_day'] = date('w', $days[$day]['date_ts']);
         $days[$day]['week_day_lang'] = $this->week_days[(int) date('w', $days[$day]['date_ts'])];
         $days[$day]['month_lang'] = $this->months[(int) date('w', $days[$day]['date_ts'])];
         if (!empty($shop->hours[date('w', $days[$day]['date_ts'])])) {
             $hour_1 = $shop->hours[date('w', $days[$day]['date_ts'])][1];
             $hour_2 = $shop->hours[date('w', $days[$day]['date_ts'])][2];
             if ($hour_1['o'] == 'X' && $hour_1['c'] == 'X' && $hour_2['o'] == 'X' && $hour_2['c'] == 'X') {
                 $days[$day]['status'] = 'closed';
//.........这里部分代码省略.........
开发者ID:paolobattistella,项目名称:aphro,代码行数:101,代码来源:blockmobilecart.php

示例5: getProductProperties

 public static function getProductProperties($id_lang, $row)
 {
     if (!$row['id_product']) {
         return false;
     }
     $row['allow_oosp'] = Product::isAvailableWhenOutOfStock($row['out_of_stock']);
     if ((!isset($row['id_product_attribute']) or !$row['id_product_attribute']) and $ipa_default = Product::getDefaultAttribute($row['id_product'], !$row['allow_oosp'])) {
         $row['id_product_attribute'] = $ipa_default;
     }
     if (!isset($row['id_product_attribute'])) {
         $row['id_product_attribute'] = 0;
     }
     // Tax
     $usetax = true;
     $tax = floatval(Tax::getApplicableTax(intval($row['id_tax']), floatval($row['rate'])));
     if (Tax::excludeTaxeOption() or !$tax) {
         $usetax = false;
     }
     $cacheKey = $row['id_product'] . '-' . $row['id_product_attribute'] . '-' . $id_lang . '-' . intval($usetax);
     if (array_key_exists($cacheKey, self::$producPropertiesCache)) {
         return self::$producPropertiesCache[$cacheKey];
     }
     // Datas
     $link = new Link();
     $row['category'] = Category::getLinkRewrite($row['id_category_default'], intval($id_lang));
     $row['link'] = $link->getProductLink($row['id_product'], $row['link_rewrite'], $row['category'], $row['ean13']);
     $row['attribute_price'] = (isset($row['id_product_attribute']) and $row['id_product_attribute']) ? floatval(Product::getProductAttributePrice($row['id_product_attribute'])) : 0;
     $row['price_tax_exc'] = Product::getPriceStatic($row['id_product'], false, (isset($row['id_product_attribute']) and !empty($row['id_product_attribute'])) ? intval($row['id_product_attribute']) : NULL, 6);
     if (self::$_taxCalculationMethod == PS_TAX_EXC) {
         $row['price_tax_exc'] = Tools::ps_round($row['price_tax_exc'], 2);
         $row['price'] = Product::getPriceStatic($row['id_product'], true, (isset($row['id_product_attribute']) and !empty($row['id_product_attribute'])) ? intval($row['id_product_attribute']) : NULL, 6);
     } else {
         $row['price'] = Tools::ps_round(Product::getPriceStatic($row['id_product'], true, (isset($row['id_product_attribute']) and !empty($row['id_product_attribute'])) ? intval($row['id_product_attribute']) : NULL, 6), 2);
     }
     $row['reduction'] = self::getReductionValue($row['reduction_price'], $row['reduction_percent'], $row['reduction_from'], $row['reduction_to'], $row['price'], $usetax, floatval($row['rate']));
     $row['price_without_reduction'] = Product::getPriceStatic($row['id_product'], true, (isset($row['id_product_attribute']) and !empty($row['id_product_attribute'])) ? intval($row['id_product_attribute']) : NULL, 6, NULL, false, false);
     $row['quantity'] = Product::getQuantity($row['id_product']);
     $row['id_image'] = Product::defineProductImage($row);
     $row['features'] = Product::getFrontFeaturesStatic(intval($id_lang), $row['id_product']);
     $row['attachments'] = Product::getAttachmentsStatic(intval($id_lang), $row['id_product']);
     $row['pack'] = Pack::isPack($row['id_product']);
     $row['packItems'] = $row['pack'] ? Pack::getItemTable($row['id_product'], $id_lang) : array();
     $row['nopackprice'] = $row['pack'] ? Pack::noPackPrice($row['id_product']) : 0;
     self::$producPropertiesCache[$cacheKey] = $row;
     return self::$producPropertiesCache[$cacheKey];
 }
开发者ID:vincent,项目名称:theinvertebrates,代码行数:46,代码来源:Product.php

示例6: getProductProperties

 public static function getProductProperties($id_lang, $row, Context $context = null)
 {
     if (!$row['id_product']) {
         return false;
     }
     if ($context == null) {
         $context = Context::getContext();
     }
     // Product::getDefaultAttribute is only called if id_product_attribute is missing from the SQL query at the origin of it:
     // consider adding it in order to avoid unnecessary queries
     $row['allow_oosp'] = Product::isAvailableWhenOutOfStock($row['out_of_stock']);
     if (Combination::isFeatureActive() && (!isset($row['id_product_attribute']) || !$row['id_product_attribute']) && (isset($row['cache_default_attribute']) && ($ipa_default = $row['cache_default_attribute']) !== null || ($ipa_default = Product::getDefaultAttribute($row['id_product'], !$row['allow_oosp'])))) {
         $row['id_product_attribute'] = $ipa_default;
     }
     if (!Combination::isFeatureActive() || !isset($row['id_product_attribute'])) {
         $row['id_product_attribute'] = 0;
     }
     // Tax
     $usetax = Tax::excludeTaxeOption();
     $cache_key = $row['id_product'] . '-' . $row['id_product_attribute'] . '-' . $id_lang . '-' . (int) $usetax;
     if (isset($row['id_product_pack'])) {
         $cache_key .= '-pack' . $row['id_product_pack'];
     }
     if (isset(self::$cacheProducProperties[$cache_key])) {
         return array_merge($row, self::$cacheProducProperties[$cache_key]);
     }
     // Datas
     $row['category'] = Category::getLinkRewrite((int) $row['id_category_default'], (int) $id_lang);
     $row['link'] = $context->link->getProductLink((int) $row['id_product'], $row['link_rewrite'], $row['category'], $row['ean13']);
     $row['attribute_price'] = 0;
     if (isset($row['id_product_attribute']) && $row['id_product_attribute']) {
         $row['attribute_price'] = (double) Product::getProductAttributePrice($row['id_product_attribute']);
     }
     $row['price_tax_exc'] = Product::getPriceStatic((int) $row['id_product'], false, isset($row['id_product_attribute']) && !empty($row['id_product_attribute']) ? (int) $row['id_product_attribute'] : null, self::$_taxCalculationMethod == PS_TAX_EXC ? 2 : 6);
     if (self::$_taxCalculationMethod == PS_TAX_EXC) {
         $row['price_tax_exc'] = Tools::ps_round($row['price_tax_exc'], 2);
         $row['price'] = Product::getPriceStatic((int) $row['id_product'], true, isset($row['id_product_attribute']) && !empty($row['id_product_attribute']) ? (int) $row['id_product_attribute'] : null, 6);
         $row['price_without_reduction'] = Product::getPriceStatic((int) $row['id_product'], false, isset($row['id_product_attribute']) && !empty($row['id_product_attribute']) ? (int) $row['id_product_attribute'] : null, 2, null, false, false);
     } else {
         $row['price'] = Tools::ps_round(Product::getPriceStatic((int) $row['id_product'], true, isset($row['id_product_attribute']) && !empty($row['id_product_attribute']) ? (int) $row['id_product_attribute'] : null, 2), 2);
         $row['price_without_reduction'] = Product::getPriceStatic((int) $row['id_product'], true, isset($row['id_product_attribute']) && !empty($row['id_product_attribute']) ? (int) $row['id_product_attribute'] : null, 6, null, false, false);
     }
     $row['reduction'] = Product::getPriceStatic((int) $row['id_product'], (bool) $usetax, (int) $row['id_product_attribute'], 6, null, true, true, 1, true, null, null, null, $specific_prices);
     $row['specific_prices'] = $specific_prices;
     $row['quantity'] = Product::getQuantity((int) $row['id_product'], 0, isset($row['cache_is_pack']) ? $row['cache_is_pack'] : null);
     $row['quantity_all_versions'] = $row['quantity'];
     if ($row['id_product_attribute']) {
         $row['quantity'] = Product::getQuantity((int) $row['id_product'], $row['id_product_attribute'], isset($row['cache_is_pack']) ? $row['cache_is_pack'] : null);
     }
     $row['id_image'] = Product::defineProductImage($row, $id_lang);
     $row['features'] = Product::getFrontFeaturesStatic((int) $id_lang, $row['id_product']);
     $row['attachments'] = array();
     if (!isset($row['cache_has_attachments']) || $row['cache_has_attachments']) {
         $row['attachments'] = Product::getAttachmentsStatic((int) $id_lang, $row['id_product']);
     }
     $row['virtual'] = !isset($row['is_virtual']) || $row['is_virtual'] ? 1 : 0;
     // Pack management
     $row['pack'] = !isset($row['cache_is_pack']) ? Pack::isPack($row['id_product']) : (int) $row['cache_is_pack'];
     $row['packItems'] = $row['pack'] ? Pack::getItemTable($row['id_product'], $id_lang) : array();
     $row['nopackprice'] = $row['pack'] ? Pack::noPackPrice($row['id_product']) : 0;
     if ($row['pack'] && !Pack::isInStock($row['id_product'])) {
         $row['quantity'] = 0;
     }
     $row['customization_required'] = false;
     if (isset($row['customizable']) && $row['customizable'] && Customization::isFeatureActive()) {
         if (count(Product::getRequiredCustomizableFieldsStatic((int) $row['id_product']))) {
             $row['customization_required'] = true;
         }
     }
     $row = Product::getTaxesInformations($row, $context);
     self::$cacheProducProperties[$cache_key] = $row;
     return self::$cacheProducProperties[$cache_key];
 }
开发者ID:abdoumej,项目名称:libsamy,代码行数:73,代码来源:groupcategory.php

示例7: getProductMetas

    /**
     * Get product meta tags
     *
     * @since 1.5.0
     * @param int $id_product
     * @param int $id_lang
     * @param string $page_name
     * @return array
     */
    public static function getProductMetas($id_product, $id_lang, $page_name)
    {
        $sql = 'SELECT `name`, `meta_title`, `meta_description`, `meta_keywords`, `reference`, `description_short`
				FROM `' . _DB_PREFIX_ . 'product` p
				LEFT JOIN `' . _DB_PREFIX_ . 'product_lang` pl ON (pl.`id_product` = p.`id_product`' . Shop::addSqlRestrictionOnLang('pl') . ')
				' . Shop::addSqlAssociation('product', 'p') . '
				WHERE pl.id_lang = ' . (int) $id_lang . '
					AND pl.id_product = ' . (int) $id_product . '
					AND product_shop.active = 1';
        if ($row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql)) {
            $features = Product::getFrontFeaturesStatic($id_lang, $id_product);
            foreach ($features as $feature) {
                switch ($feature['id_feature']) {
                    case '17':
                        $color = mb_convert_case($feature["value"], MB_CASE_LOWER);
                        break;
                    case '16':
                        $material = mb_convert_case($feature["value"], MB_CASE_LOWER);
                        break;
                    case '20':
                        $design = $feature["value"];
                        break;
                }
            }
            $price = Product::getPriceStatic($id_product, true, null, 6);
            if (Product::$_taxCalculationMethod == PS_TAX_INC) {
                $price = Tools::ps_round($price, 2);
            }
            if (empty($row['meta_description'])) {
                $row['meta_description'] = $row['name'] . ". Материал {$material}. Цвет {$color}. Артикул " . $row['reference'] . ". Цена " . $price . " руб.";
            }
            if (empty($row['meta_title'])) {
                $row['meta_title'] = $row['name'] . ": цвет {$color}, {$material}, {$design} - артикул " . $row['reference'];
            }
            return Meta::completeMetaTags($row, $row['name']);
        }
        return Meta::getHomeMetas($id_lang, $page_name);
    }
开发者ID:WhisperingTree,项目名称:etagerca,代码行数:47,代码来源:Meta.php

示例8: getProductProperties

 public static function getProductProperties($id_lang, $row)
 {
     if (!$row['id_product']) {
         return false;
     }
     // Product::getDefaultAttribute is only called if id_product_attribute is missing from the SQL query at the origin of it: consider adding it in order to avoid unnecessary queries
     $row['allow_oosp'] = Product::isAvailableWhenOutOfStock($row['out_of_stock']);
     if ((!isset($row['id_product_attribute']) or !$row['id_product_attribute']) and (isset($row['cache_default_attribute']) and ($ipa_default = $row['cache_default_attribute']) !== NULL or $ipa_default = Product::getDefaultAttribute($row['id_product'], !$row['allow_oosp']))) {
         $row['id_product_attribute'] = $ipa_default;
     }
     if (!isset($row['id_product_attribute'])) {
         $row['id_product_attribute'] = 0;
     }
     // Tax
     $usetax = Tax::excludeTaxeOption();
     $cacheKey = $row['id_product'] . '-' . $row['id_product_attribute'] . '-' . $id_lang . '-' . (int) $usetax;
     if (array_key_exists($cacheKey, self::$producPropertiesCache)) {
         return self::$producPropertiesCache[$cacheKey];
     }
     // Datas
     $row['category'] = Category::getLinkRewrite((int) $row['id_category_default'], (int) $id_lang);
     if (!preg_match("/^1.3.*/", _PS_VERSION_)) {
         // Not available in Prestashop 1.3.x
         $row['reduction'] = Product::getPriceStatic((int) $row['id_product'], (bool) $usetax, (int) $row['id_product_attribute'], 6, NULL, true, true, 1, true, NULL, NULL, NULL, $specific_prices);
         $row['specific_prices'] = $specific_prices;
     }
     if ($row['id_product_attribute']) {
         $row['quantity_all_versions'] = $row['quantity'];
         $row['quantity'] = Product::getQuantity((int) $row['id_product'], $row['id_product_attribute'], isset($row['cache_is_pack']) ? $row['cache_is_pack'] : NULL);
     }
     $row['id_image'] = Product::defineProductImage($row, $id_lang);
     $row['features'] = Product::getFrontFeaturesStatic((int) $id_lang, $row['id_product']);
     // Pack management
     $row['pack'] = !isset($row['cache_is_pack']) ? Pack::isPack($row['id_product']) : (int) $row['cache_is_pack'];
     $row['packItems'] = $row['pack'] ? Pack::getItemTable($row['id_product'], $id_lang) : array();
     $row['nopackprice'] = $row['pack'] ? Pack::noPackPrice($row['id_product']) : 0;
     if ($row['pack'] and !Pack::isInStock($row['id_product'])) {
         $row['quantity'] = 0;
     }
     $sql_combination = '
   SELECT pa.id_product_attribute, pa.price, pa.quantity, pa.id_product
   FROM `' . _DB_PREFIX_ . 'product` p
   LEFT JOIN `' . _DB_PREFIX_ . 'product_attribute` pa ON (p.`id_product` = pa.`id_product`)
   WHERE p.`id_product` =' . $row['id_product'];
     $result_combination = ProductExtended::getDbInstance()->ExecuteS($sql_combination);
     $row['combinations'] = array();
     if ($result_combination) {
         foreach ($result_combination as $combination) {
             $combination['attributes'] = array();
             /* New combinations system Prestashop 1.5.x */
             if (!preg_match("/^1.(3|4).*/", _PS_VERSION_)) {
                 $combination['quantity'] = StockAvailable::getQuantityAvailableByProduct($row['id_product'], $combination['id_product_attribute']);
             }
             if (isset($combination['id_product_attribute'])) {
                 $sql_attribute = '
         SELECT pa.id_product_attribute, agl.id_attribute_group, al.name as name_value, agl.name as name_option
         FROM `' . _DB_PREFIX_ . 'product_attribute` pa
         LEFT JOIN `' . _DB_PREFIX_ . 'product_attribute_combination` pac ON (pac.`id_product_attribute` = pa.`id_product_attribute`)
         LEFT JOIN `' . _DB_PREFIX_ . 'attribute` a ON (a.`id_attribute` = pac.`id_attribute`)
         LEFT JOIN `' . _DB_PREFIX_ . 'attribute_lang` al ON (al.`id_attribute` = a.`id_attribute` AND al.`id_lang` = ' . $id_lang . ')
         LEFT JOIN `' . _DB_PREFIX_ . 'attribute_group` ag ON (ag.`id_attribute_group` = a.`id_attribute_group`)
         LEFT JOIN `' . _DB_PREFIX_ . 'attribute_group_lang` agl ON (agl.`id_attribute_group` = ag.`id_attribute_group` AND agl.`id_lang` = ' . $id_lang . ')
         WHERE pa.`id_product_attribute` =' . $combination['id_product_attribute'];
                 $result_attribute = ProductExtended::getDbInstance()->ExecuteS($sql_attribute);
                 if ($result_attribute) {
                     foreach ($result_attribute as $attribute) {
                         array_push($combination['attributes'], $attribute);
                     }
                 }
                 array_push($row['combinations'], $combination);
             }
         }
     }
     $sql_image = '
   SELECT DISTINCT i.*, pl.link_rewrite
   FROM `' . _DB_PREFIX_ . 'product` p
   LEFT JOIN `' . _DB_PREFIX_ . 'image` i ON (p.`id_product` = i.`id_product`)
   LEFT JOIN `' . _DB_PREFIX_ . 'product_lang` pl ON (p.`id_product` = pl.`id_product`)
   WHERE p.`id_product` =' . $row['id_product'];
     $result_image = ProductExtended::getDbInstance()->ExecuteS($sql_image);
     $row['images'] = array();
     $lang = new Language($id_lang);
     $row['url_locale'] = $lang->iso_code;
     if ($result_image) {
         $link = preg_match("/^1.(3|4).*/", _PS_VERSION_) ? new Link() : Context::getContext()->link;
         foreach ($result_image as $image) {
             if (!preg_match("/^1.3.*/", _PS_VERSION_)) {
                 // Image URL gives relative version using 1.3.x-
                 $image['image_url'] = $link->getImageLink($image['link_rewrite'], $image['id_product'] . '-' . $image['id_image']);
             }
             array_push($row['images'], $image);
         }
     }
     self::$producPropertiesCache[$cacheKey] = $row;
     return self::$producPropertiesCache[$cacheKey];
 }
开发者ID:Oelan,项目名称:PrestaShop,代码行数:96,代码来源:product-extended.php

示例9: getProductProperties

    public static function getProductProperties($id_lang, $row)
    {
        if (!$row['id_product']) {
            return false;
        }
        // Product::getDefaultAttribute is only called if id_product_attribute is missing from the SQL query at the origin of it: consider adding it in order to avoid unnecessary queries
        $row['allow_oosp'] = Product::isAvailableWhenOutOfStock($row['out_of_stock']);
        if ((!isset($row['id_product_attribute']) or !$row['id_product_attribute']) and (isset($row['cache_default_attribute']) and ($ipa_default = $row['cache_default_attribute']) !== NULL or $ipa_default = Product::getDefaultAttribute($row['id_product'], !$row['allow_oosp']))) {
            $row['id_product_attribute'] = $ipa_default;
        }
        if (!isset($row['id_product_attribute'])) {
            $row['id_product_attribute'] = 0;
        }
        // Tax
        $usetax = Tax::excludeTaxeOption();
        $cacheKey = $row['id_product'] . '-' . $row['id_product_attribute'] . '-' . $id_lang . '-' . (int) $usetax;
        if (array_key_exists($cacheKey, self::$producPropertiesCache)) {
            return self::$producPropertiesCache[$cacheKey];
        }
        // Datas mbj
        $link = new Link();
        $row['category'] = Category::getLinkRewrite((int) $row['id_category_default'], (int) $id_lang);
        $row['link'] = $link->getProductLink((int) $row['id_product'], $row['link_rewrite'], $row['category'], $row['ean13']);
        //usado link
        //init
        foreach (Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
		SELECT p.*
		FROM `' . _DB_PREFIX_ . 'product` p 
                    INNER JOIN ' . _DB_PREFIX_ . 'product_lang pl ON p.id_product = pl.id_product
		WHERE p.id_product = ' . (int) $ro1w['supplier_reference']) as $subrow) {
            $row_us['id_category_default'] = $subrow['id_category_default'];
            $row_us['link_rewrite'] = $subrow['link_rewrite'];
            $row_us['ean13'] = $subrow['ean13'];
        }
        $row['category_used'] = Category::getLinkRewrite((int) $row_us['id_category_default'], (int) $id_lang);
        $row['link_used'] = $link->getProductLink((int) $row['supplier_reference'], $row_us['link_rewrite'], $row['category_used'], $row_us['ean13']);
        $row['link_extr'] = 'id::' . $row['id_product'];
        //precio mall - distribuidor - lista - internet
        foreach (Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
                    SELECT pa.price
                    FROM `' . _DB_PREFIX_ . 'product_attribute` pa 
                        INNER JOIN ' . _DB_PREFIX_ . 'product_attribute_combination pac ON pa.id_product_attribute = pac.id_product_attribute
                    WHERE pac.id_attribute = 25 and  pa.id_product = ' . (int) $row['id_product']) as $subrow) {
            $row['price_distribuidor_p'] = round($subrow['price']);
        }
        foreach (Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
                    SELECT pa.price
                    FROM `' . _DB_PREFIX_ . 'product_attribute` pa 
                        INNER JOIN ' . _DB_PREFIX_ . 'product_attribute_combination pac ON pa.id_product_attribute = pac.id_product_attribute
                    WHERE pac.id_attribute = 24 and  pa.id_product = ' . (int) $row['id_product']) as $subrow) {
            $row['price_distribuidor'] = round($subrow['price']);
        }
        foreach (Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
		SELECT pa.price
		FROM `' . _DB_PREFIX_ . 'product_attribute` pa 
                    INNER JOIN ' . _DB_PREFIX_ . 'product_attribute_combination pac ON pa.id_product_attribute = pac.id_product_attribute
		WHERE pac.id_attribute = 23 and  pa.id_product = ' . (int) $row['id_product']) as $subrow) {
            $row['price_tienda'] = round($subrow['price']);
        }
        foreach (Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
		SELECT pa.price
		FROM `' . _DB_PREFIX_ . 'product_attribute` pa 
                    INNER JOIN ' . _DB_PREFIX_ . 'product_attribute_combination pac ON pa.id_product_attribute = pac.id_product_attribute
		WHERE pac.id_attribute = 22 and  pa.id_product = ' . (int) $row['id_product']) as $subrow) {
            $row['price_mall'] = round($subrow['price']);
        }
        foreach (Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
		SELECT pa.price
		FROM `' . _DB_PREFIX_ . 'product_attribute` pa 
                    INNER JOIN ' . _DB_PREFIX_ . 'product_attribute_combination pac ON pa.id_product_attribute = pac.id_product_attribute
		WHERE pac.id_attribute = 21 and  pa.id_product = ' . (int) $row['id_product']) as $subrow) {
            $row['price_internet'] = round($subrow['price']);
        }
        $row['attribute_price'] = (isset($row['id_product_attribute']) and $row['id_product_attribute']) ? (double) Product::getProductAttributePrice($row['id_product_attribute']) : 0;
        $row['price_tax_exc'] = Product::getPriceStatic((int) $row['id_product'], false, (isset($row['id_product_attribute']) and !empty($row['id_product_attribute'])) ? (int) $row['id_product_attribute'] : NULL, self::$_taxCalculationMethod == PS_TAX_EXC ? 2 : 6);
        if (self::$_taxCalculationMethod == PS_TAX_EXC) {
            $row['price_tax_exc'] = Tools::ps_round($row['price_tax_exc'], 2);
            $row['price'] = Product::getPriceStatic((int) $row['id_product'], true, (isset($row['id_product_attribute']) and !empty($row['id_product_attribute'])) ? (int) $row['id_product_attribute'] : NULL, 6);
            $row['price_without_reduction'] = Product::getPriceStatic((int) $row['id_product'], false, (isset($row['id_product_attribute']) and !empty($row['id_product_attribute'])) ? (int) $row['id_product_attribute'] : NULL, 2, NULL, false, false);
        } else {
            $row['price'] = Tools::ps_round(Product::getPriceStatic((int) $row['id_product'], true, (isset($row['id_product_attribute']) and !empty($row['id_product_attribute'])) ? (int) $row['id_product_attribute'] : NULL, 2), 2);
            $row['price_without_reduction'] = Product::getPriceStatic((int) $row['id_product'], true, (isset($row['id_product_attribute']) and !empty($row['id_product_attribute'])) ? (int) $row['id_product_attribute'] : NULL, 6, NULL, false, false);
        }
        $row['reduction'] = Product::getPriceStatic((int) $row['id_product'], (bool) $usetax, (int) $row['id_product_attribute'], 6, NULL, true, true, 1, true, NULL, NULL, NULL, $specific_prices);
        $row['specific_prices'] = $specific_prices;
        if ($row['id_product_attribute']) {
            $row['quantity_all_versions'] = $row['quantity'];
            $row['quantity'] = Product::getQuantity((int) $row['id_product'], $row['id_product_attribute'], isset($row['cache_is_pack']) ? $row['cache_is_pack'] : NULL);
        }
        $row['id_image'] = Product::defineProductImage($row, $id_lang);
        $row['features'] = Product::getFrontFeaturesStatic((int) $id_lang, $row['id_product']);
        $row['attachments'] = (!isset($row['cache_has_attachments']) or $row['cache_has_attachments']) ? Product::getAttachmentsStatic((int) $id_lang, $row['id_product']) : array();
        // Pack management
        $row['pack'] = !isset($row['cache_is_pack']) ? Pack::isPack($row['id_product']) : (int) $row['cache_is_pack'];
        $row['packItems'] = $row['pack'] ? Pack::getItemTable($row['id_product'], $id_lang) : array();
        $row['nopackprice'] = $row['pack'] ? Pack::noPackPrice($row['id_product']) : 0;
        if ($row['pack'] and !Pack::isInStock($row['id_product'])) {
            $row['quantity'] = 0;
        }
        self::$producPropertiesCache[$cacheKey] = $row;
//.........这里部分代码省略.........
开发者ID:ricardo-rdfs,项目名称:Portal-BIP,代码行数:101,代码来源:Product.php

示例10: getProductByFilters


//.........这里部分代码省略.........
						)   GROUP BY id_product', false);
        } else {
            if ($usado === true) {
                $allProductsOut = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
                        SELECT p.`id_product` id_product
                        FROM `' . _DB_PREFIX_ . 'product` p
                        ' . $priceFilterQueryOut . '
                        ' . $queryFiltersFrom . '
                        WHERE  1 ' . $queryFiltersWhere . '  AND p.condition = "used" GROUP BY id_product', false);
                $allProductsIn = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
                        SELECT p.`id_product` id_product
                        FROM `' . _DB_PREFIX_ . 'product` p
                        ' . $priceFilterQueryIn . '
                        ' . $queryFiltersFrom . '
                        WHERE  1 ' . $queryFiltersWhere . '  AND p.condition = "used" GROUP BY id_product', false);
            } else {
                $allProductsOut = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
                    SELECT p.`id_product` id_product
                    FROM `' . _DB_PREFIX_ . 'product` p
                    ' . $priceFilterQueryOut . '
                    ' . $queryFiltersFrom . '
                    WHERE 1 ' . $queryFiltersWhere . ' GROUP BY id_product', false);
                $allProductsIn = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
                    SELECT p.`id_product` id_product
                    FROM `' . _DB_PREFIX_ . 'product` p
                    ' . $priceFilterQueryIn . '
                    ' . $queryFiltersFrom . '
                    WHERE 1 ' . $queryFiltersWhere . ' GROUP BY id_product', false);
            }
        }
        $productIdList = array();
        while ($product = DB::getInstance()->nextRow($allProductsIn)) {
            $productIdList[] = (int) $product['id_product'];
            $prod_features[$product['id_product']] = Product::getFrontFeaturesStatic($cookie->id_lang, $product['id_product']);
        }
        while ($product = DB::getInstance()->nextRow($allProductsOut)) {
            if (isset($priceFilter) && $priceFilter) {
                $price = (int) Product::getPriceStatic($product['id_product']);
                // Cast to int because we don't care about cents
                if ($price < $priceFilter['min'] || $price > $priceFilter['max']) {
                    continue;
                }
                $productIdList[] = (int) $product['id_product'];
            }
        }
        if ($whereLikeFilter != '') {
            $products_cnt = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
			SELECT p.id_product, p.on_sale, p.out_of_stock, p.available_for_order, p.quantity, p.minimal_quantity, p.id_category_default, p.customizable, p.show_price, p.`weight`,
			p.ean13, pl.available_later, pl.description_short, pl.link_rewrite, pl.name, i.id_image, il.legend,  m.name manufacturer_name, p.condition, p.id_manufacturer,
			DATEDIFF(p.`date_add`,
			DATE_SUB(NOW(), INTERVAL ' . (Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20) . ' DAY)) > 0 AS new
			FROM `' . _DB_PREFIX_ . 'category_product` cp
			LEFT JOIN ' . _DB_PREFIX_ . 'category c ON (c.id_category = cp.id_category)
			LEFT JOIN `' . _DB_PREFIX_ . 'product` p ON p.`id_product` = cp.`id_product`
			LEFT JOIN ' . _DB_PREFIX_ . 'product_lang pl ON (pl.id_product = p.id_product)
                        LEFT JOIN ' . _DB_PREFIX_ . 'category_lang cl ON p.`id_category_default` = cl.id_category
			LEFT JOIN ' . _DB_PREFIX_ . 'image i ON (i.id_product = p.id_product AND i.cover = 1)
			LEFT JOIN ' . _DB_PREFIX_ . 'image_lang il ON (i.id_image = il.id_image AND il.id_lang = ' . (int) $cookie->id_lang . ')
			LEFT JOIN ' . _DB_PREFIX_ . 'manufacturer m ON (m.id_manufacturer = p.id_manufacturer)
			WHERE p.`active` = 1 AND  pl.id_lang = ' . (int) $cookie->id_lang . '  AND (
(
' . $descrypt_reg . '
) 
OR 
(p.id_product ="' . $whereLikeFilter . '" OR p.reference = "' . $whereLikeFilter . '") 
OR
开发者ID:ricardo-rdfs,项目名称:Portal-BIP,代码行数:67,代码来源:blocklayered.php

示例11: prepareProperties

 /**
  * prepare properties
  *
  * @return array
  */
 protected function prepareProperties()
 {
     $result = array();
     $properties = Product::getFrontFeaturesStatic($this->getPlugin()->getLanguageId(), $this->currentProduct->id);
     foreach ($properties as $property) {
         $propertyItemObject = new Shopgate_Model_Catalog_Property();
         $propertyItemObject->setUid($property['id_feature']);
         $propertyItemObject->setLabel($property['name']);
         $propertyItemObject->setValue($property['value']);
         $result[] = $propertyItemObject;
     }
     return $result;
 }
开发者ID:pankajshoffex,项目名称:shoffex_prestashop,代码行数:18,代码来源:Item.php

示例12: DataForFrontSearch

 public function DataForFrontSearch($date_from, $date_to, $id_hotel, $id_product = 0, $for_room_type = 0, $adult = 0, $children = 0, $ratting = -1, $amenities = 0, $price = 0, $id_cart = 0, $id_guest = 0)
 {
     require_once _PS_MODULE_DIR_ . 'productcomments/ProductComment.php';
     $this->context = Context::getContext();
     $booking_data = $this->getBookingData($date_from, $date_to, $id_hotel, $id_product, $adult, $children, 0, 0, 1, 0, 0, 0, $id_cart, $id_guest);
     // ddd($booking_data);
     if (!$for_room_type) {
         if (!empty($booking_data)) {
             $obj_rm_type = new HotelRoomType();
             foreach ($booking_data['rm_data'] as $key => $value) {
                 if (empty($value['data']['available'])) {
                     unset($booking_data['rm_data'][$key]);
                 } else {
                     $prod_ratting = ProductComment::getAverageGrade($value['id_product'])['grade'];
                     if ($prod_ratting === NULL) {
                         $prod_ratting = 0;
                     }
                     if ($prod_ratting < $ratting && $ratting != -1) {
                         unset($booking_data['rm_data'][$key]);
                     } else {
                         $product = new Product($value['id_product'], false, $this->context->language->id);
                         $product_feature = $product->getFrontFeaturesStatic($this->context->language->id, $value['id_product']);
                         $prod_amen = array();
                         if (!empty($amenities) && $amenities) {
                             $prod_amen = $amenities;
                             foreach ($product_feature as $a_key => $a_val) {
                                 if (($pa_key = array_search($a_val['id_feature'], $prod_amen)) !== false) {
                                     unset($prod_amen[$pa_key]);
                                     if (empty($prod_amen)) {
                                         break;
                                     }
                                 }
                             }
                             if (!empty($prod_amen)) {
                                 unset($booking_data['rm_data'][$key]);
                             }
                         }
                         if (empty($prod_amen)) {
                             $prod_price = Product::getPriceStatic($value['id_product']);
                             if (empty($price) || $price['from'] <= $prod_price && $price['to'] >= $prod_price) {
                                 $cover_image_arr = $product->getCover($value['id_product']);
                                 if (!empty($cover_image_arr)) {
                                     $cover_img = $this->context->link->getImageLink($product->link_rewrite, $product->id . '-' . $cover_image_arr['id_image'], 'home_default');
                                 } else {
                                     $cover_img = $this->context->link->getImageLink($product->link_rewrite, $this->context->language->iso_code . "-default", 'home_default');
                                 }
                                 $room_left = count($booking_data['rm_data'][$key]['data']['available']);
                                 $rm_dtl = $obj_rm_type->getRoomTypeInfoByIdProduct($value['id_product']);
                                 $booking_data['rm_data'][$key]['name'] = $product->name;
                                 $booking_data['rm_data'][$key]['image'] = $cover_img;
                                 $booking_data['rm_data'][$key]['description'] = $product->description_short;
                                 $booking_data['rm_data'][$key]['feature'] = $product_feature;
                                 $booking_data['rm_data'][$key]['price'] = $prod_price;
                                 if ($room_left <= (int) Configuration::get('WK_ROOM_LEFT_WARNING_NUMBER')) {
                                     $booking_data['rm_data'][$key]['room_left'] = $room_left;
                                 }
                                 $booking_data['rm_data'][$key]['adult'] = $rm_dtl['adult'];
                                 $booking_data['rm_data'][$key]['children'] = $rm_dtl['children'];
                                 $booking_data['rm_data'][$key]['ratting'] = $prod_ratting;
                                 $booking_data['rm_data'][$key]['num_review'] = ProductComment::getCommentNumber($value['id_product']);
                                 if (Configuration::get('PS_REWRITING_SETTINGS')) {
                                     $booking_data['rm_data'][$key]['product_link'] = $this->context->link->getProductLink($product) . '?date_from=' . $date_from . '&date_to=' . $date_to;
                                 } else {
                                     $booking_data['rm_data'][$key]['product_link'] = $this->context->link->getProductLink($product) . '&date_from=' . $date_from . '&date_to=' . $date_to;
                                 }
                             } else {
                                 unset($booking_data['rm_data'][$key]);
                             }
                         }
                     }
                 }
             }
         }
     }
     return $booking_data;
 }
开发者ID:Rohit-jn,项目名称:hotelcommerce,代码行数:76,代码来源:HotelBookingDetail.php

示例13: initContent

 /**
  * Assign template vars related to page content
  * @see FrontController::initContent()
  */
 public function initContent()
 {
     parent::initContent();
     $flag_pack = true;
     if (!$this->errors) {
         //                        if(!isset($_GET['quick_view']))
         //                            if (Pack::isPack((int)$this->product->id) && !Pack::isInStock((int)$this->product->id))
         //                        if (Pack::isPack((int)$this->product->id))
         //                            $this->product->quantity = 0;
         //                        else
         //                            $flag_pack = false;
         //                        else
         //                            $flag_pack = false;
         if (!Pack::isPack((int) $this->product->id)) {
             $flag_pack = false;
         }
         $this->product->description = $this->transformDescriptionWithImg($this->product->description);
         // Assign to the template the id of the virtual product. "0" if the product is not downloadable.
         $this->context->smarty->assign('virtual', ProductDownload::getIdFromIdProduct((int) $this->product->id));
         $this->context->smarty->assign('customizationFormTarget', Tools::safeOutput(urldecode($_SERVER['REQUEST_URI'])));
         if (Tools::isSubmit('submitCustomizedDatas')) {
             // If cart has not been saved, we need to do it so that customization fields can have an id_cart
             // We check that the cookie exists first to avoid ghost carts
             if (!$this->context->cart->id && isset($_COOKIE[$this->context->cookie->getName()])) {
                 $this->context->cart->add();
                 $this->context->cookie->id_cart = (int) $this->context->cart->id;
             }
             $this->pictureUpload();
             $this->textRecord();
             $this->formTargetFormat();
         } else {
             if (Tools::getIsset('deletePicture') && !$this->context->cart->deleteCustomizationToProduct($this->product->id, Tools::getValue('deletePicture'))) {
                 $this->errors[] = Tools::displayError('An error occurred while deleting the selected picture.');
             }
         }
         $pictures = array();
         $text_fields = array();
         if ($this->product->customizable) {
             $files = $this->context->cart->getProductCustomization($this->product->id, Product::CUSTOMIZE_FILE, true);
             foreach ($files as $file) {
                 $pictures['pictures_' . $this->product->id . '_' . $file['index']] = $file['value'];
             }
             $texts = $this->context->cart->getProductCustomization($this->product->id, Product::CUSTOMIZE_TEXTFIELD, true);
             foreach ($texts as $text_field) {
                 $text_fields['textFields_' . $this->product->id . '_' . $text_field['index']] = str_replace('<br />', "\n", $text_field['value']);
             }
         }
         $this->context->smarty->assign(array('pictures' => $pictures, 'textFields' => $text_fields));
         // Assign template vars related to the category + execute hooks related to the category
         $this->assignCategory();
         // Assign template vars related to the price and tax
         $this->assignPriceAndTax();
         // Assign template vars related to the images
         $this->assignImages();
         $this->assign3dImages();
         // Assign attribute groups to the template
         $this->assignAttributesGroups();
         // Assign attributes combinations to the template
         $this->assignAttributesCombinations();
         // Pack management
         $pack_items = $this->product->cache_is_pack ? Pack::getItemTable($this->product->id, $this->context->language->id, true) : array();
         if (is_array($pack_items) && count($pack_items)) {
             foreach ($pack_items as &$pack_item) {
                 $pack_item['features'] = Product::getFrontFeaturesStatic($this->context->language->id, $pack_item['id_product']);
             }
         }
         $this->context->smarty->assign('packItems', $pack_items);
         $this->context->smarty->assign('packs', Pack::getPacksTable($this->product->id, $this->context->language->id, true, 1));
         if (isset($this->category->id) && $this->category->id) {
             $return_link = Tools::safeOutput($this->context->link->getCategoryLink($this->category));
         } else {
             $return_link = 'javascript: history.back();';
         }
         //reviews
         //                        $average = ProductComment::getAverageGrade((int)Tools::getValue('id_product'));
         $nbComments = (int) ProductComment::getCommentNumber((int) Tools::getValue('id_product'));
         $act_pack = 0;
         //паки
         if (!$flag_pack) {
             $sql = "SELECT DISTINCT(id_product_pack) FROM " . _DB_PREFIX_ . "pack WHERE id_product_item={$this->product->id}";
             $pack_products = array();
             $result_packs = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
             if (is_array($result_packs) && count($result_packs)) {
                 foreach ($result_packs as $k => $id_product_pack) {
                     $prod = new Product($id_product_pack['id_product_pack'], $this->context->language->id, true);
                     $cover = $prod->getCover((int) $prod->id);
                     if ($cover) {
                         $pack_products[$k]['id_image'] = $cover['id_image'];
                     } else {
                         $pack_products[$k]['id_image'] = null;
                     }
                     $price = $prod->getPrice(true, null, 2);
                     $price_old = $prod->getPriceWithoutReduct(false, null, 2);
                     if (isset($prod->specificPrice) && is_array($prod->specificPrice)) {
                         $pack_products[$k]['sale_percentage'] = $prod->specificPrice['reduction_type'] == 'percentage' ? $prod->specificPrice['reduction'] * 100 : $prod->specificPrice['reduction'] / $price_old * 100;
                     }
//.........这里部分代码省略.........
开发者ID:WhisperingTree,项目名称:etagerca,代码行数:101,代码来源:ProductController.php

示例14: getProductProperties

 public static function getProductProperties($id_lang, $row)
 {
     if (!$row['id_product']) {
         return false;
     }
     $link = new Link();
     // Tax
     $usetax = true;
     $tax = floatval(Tax::getApplicableTax(intval($row['id_tax']), floatval($row['rate'])));
     if (Tax::excludeTaxeOption() or !$tax) {
         $usetax = false;
     }
     // Datas
     $row['category'] = Category::getLinkRewrite($row['id_category_default'], intval($id_lang));
     $row['link'] = $link->getProductLink($row['id_product'], $row['link_rewrite'], $row['category'], $row['ean13']);
     $row['allow_oosp'] = Product::isAvailableWhenOutOfStock($row['out_of_stock']);
     if ((!isset($row['id_product_attribute']) or !$row['id_product_attribute']) and $ipa_default = Product::getDefaultAttribute($row['id_product'], !$row['allow_oosp'])) {
         $row['id_product_attribute'] = $ipa_default;
     }
     $row['attribute_price'] = isset($row['id_product_attribute']) and $row['id_product_attribute'] ? floatval(Product::getProductAttributePrice($row['id_product_attribute'])) : 0;
     $row['price_tax_exc'] = Product::getPriceStatic($row['id_product'], false, (isset($row['id_product_attribute']) and !empty($row['id_product_attribute'])) ? intval($row['id_product_attribute']) : NULL, 2);
     $row['price'] = Product::getPriceStatic($row['id_product'], true, (isset($row['id_product_attribute']) and !empty($row['id_product_attribute'])) ? intval($row['id_product_attribute']) : NULL, 2);
     $row['reduction'] = self::getReductionValue($row['reduction_price'], $row['reduction_percent'], $row['reduction_from'], $row['reduction_to'], $row['price'], $usetax, floatval($row['rate']));
     $row['price_without_reduction'] = Product::getPriceStatic($row['id_product'], true, (isset($row['id_product_attribute']) and !empty($row['id_product_attribute'])) ? intval($row['id_product_attribute']) : NULL, 2, NULL, false, false);
     $row['quantity'] = Product::getQuantity($row['id_product']);
     $row['id_image'] = Product::defineProductImage($row);
     $row['features'] = Product::getFrontFeaturesStatic(intval($id_lang), $row['id_product']);
     $row['attachments'] = Product::getAttachmentsStatic(intval($id_lang), $row['id_product']);
     $row['pack'] = Pack::isPack($row['id_product']);
     $row['packItems'] = $row['pack'] ? Pack::getItemTable($row['id_product'], $id_lang) : array();
     $row['nopackprice'] = $row['pack'] ? Pack::noPackPrice($row['id_product']) : 0;
     return $row;
 }
开发者ID:sealence,项目名称:local,代码行数:33,代码来源:Product.php


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