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


PHP Tag::getProductTags方法代码示例

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


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

示例1: getValueForProduct

 public static function getValueForProduct($id_product, $id_group)
 {
     $tags = Tag::getProductTags((int) $id_product);
     $tags = $tags[1];
     if (is_array($tags) && in_array('buy1get1', $tags)) {
         return 0;
     }
     if (!isset(self::$reductionCache[$id_product . '-' . $id_group])) {
         self::$reductionCache[$id_product . '-' . $id_group] = Db::getInstance()->getValue('SELECT `reduction` FROM `' . _DB_PREFIX_ . 'product_group_reduction_cache` WHERE `id_product` = ' . (int) $id_product . ' AND `id_group` = ' . (int) $id_group);
     }
     return self::$reductionCache[$id_product . '-' . $id_group];
 }
开发者ID:priyankajsr19,项目名称:shalu,代码行数:12,代码来源:GroupReduction.php

示例2: __construct

 public function __construct($id_product = NULL, $full = false, $id_lang = NULL)
 {
     global $cart;
     parent::__construct($id_product, $id_lang);
     if ($full and $this->id) {
         $this->tax_name = 'deprecated';
         // The applicable tax may be BOTH the product one AND the state one (moreover this variable is some deadcode)
         $this->manufacturer_name = Manufacturer::getNameById((int) $this->id_manufacturer);
         $this->supplier_name = Supplier::getNameById((int) $this->id_supplier);
         self::$_tax_rules_group[$this->id] = $this->id_tax_rules_group;
         if (is_object($cart) and $cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')} != NULL) {
             $this->tax_rate = Tax::getProductTaxRate($this->id, $cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')});
         } else {
             $this->tax_rate = Tax::getProductTaxRate($this->id, NULL);
         }
         $this->new = $this->isNew();
         $this->price = Product::getPriceStatic((int) $this->id, false, NULL, 6, NULL, false, true, 1, false, NULL, NULL, NULL, $this->specificPrice);
         $this->unit_price = $this->unit_price_ratio != 0 ? $this->price / $this->unit_price_ratio : 0;
         if ($this->id) {
             $this->tags = Tag::getProductTags((int) $this->id);
         }
     }
     if ($this->id_category_default) {
         $this->category = Category::getLinkRewrite((int) $this->id_category_default, (int) $id_lang);
     }
 }
开发者ID:srikanthash09,项目名称:codetestdatld,代码行数:26,代码来源:Product.php

示例3: productImportOne


//.........这里部分代码省略.........
                    $id_shop_list[] = (int) Shop::getIdByName($shop);
                } elseif (!empty($shop)) {
                    $id_shop_list[] = $shop;
                }
            }
            if (isset($info['reduction_price']) && $info['reduction_price'] > 0 || isset($info['reduction_percent']) && $info['reduction_percent'] > 0) {
                foreach ($id_shop_list as $id_shop) {
                    $specific_price = SpecificPrice::getSpecificPrice($product->id, $id_shop, 0, 0, 0, 1, 0, 0, 0, 0);
                    if (is_array($specific_price) && isset($specific_price['id_specific_price'])) {
                        $specific_price = new SpecificPrice((int) $specific_price['id_specific_price']);
                    } else {
                        $specific_price = new SpecificPrice();
                    }
                    $specific_price->id_product = (int) $product->id;
                    $specific_price->id_specific_price_rule = 0;
                    $specific_price->id_shop = $id_shop;
                    $specific_price->id_currency = 0;
                    $specific_price->id_country = 0;
                    $specific_price->id_group = 0;
                    $specific_price->price = -1;
                    $specific_price->id_customer = 0;
                    $specific_price->from_quantity = 1;
                    $specific_price->reduction = isset($info['reduction_price']) && $info['reduction_price'] ? $info['reduction_price'] : $info['reduction_percent'] / 100;
                    $specific_price->reduction_type = isset($info['reduction_price']) && $info['reduction_price'] ? 'amount' : 'percentage';
                    $specific_price->from = isset($info['reduction_from']) && Validate::isDate($info['reduction_from']) ? $info['reduction_from'] : '0000-00-00 00:00:00';
                    $specific_price->to = isset($info['reduction_to']) && Validate::isDate($info['reduction_to']) ? $info['reduction_to'] : '0000-00-00 00:00:00';
                    if (!$validateOnly && !$specific_price->save()) {
                        $this->addProductWarning(Tools::safeOutput($info['name']), $product->id, $this->l('Discount is invalid'));
                    }
                }
            }
            if (!$validateOnly && isset($product->tags) && !empty($product->tags)) {
                if (isset($product->id) && $product->id) {
                    $tags = Tag::getProductTags($product->id);
                    if (is_array($tags) && count($tags)) {
                        if (!empty($product->tags)) {
                            $product->tags = explode($this->multiple_value_separator, $product->tags);
                        }
                        if (is_array($product->tags) && count($product->tags)) {
                            foreach ($product->tags as $key => $tag) {
                                if (!empty($tag)) {
                                    $product->tags[$key] = trim($tag);
                                }
                            }
                            $tags[$id_lang] = $product->tags;
                            $product->tags = $tags;
                        }
                    }
                }
                // Delete tags for this id product, for no duplicating error
                Tag::deleteTagsForProduct($product->id);
                if (!is_array($product->tags) && !empty($product->tags)) {
                    $product->tags = AdminImportController::createMultiLangField($product->tags);
                    foreach ($product->tags as $key => $tags) {
                        $is_tag_added = Tag::addTags($key, $product->id, $tags, $this->multiple_value_separator);
                        if (!$is_tag_added) {
                            $this->addProductWarning(Tools::safeOutput($info['name']), $product->id, $this->l('Tags list is invalid'));
                            break;
                        }
                    }
                } else {
                    foreach ($product->tags as $key => $tags) {
                        $str = '';
                        foreach ($tags as $one_tag) {
                            $str .= $one_tag . $this->multiple_value_separator;
                        }
开发者ID:M03G,项目名称:PrestaShop,代码行数:67,代码来源:AdminImportController.php

示例4: priceCalculation

 /**
  * Price calculation / Get product price
  *
  * @param integer $id_shop Shop id
  * @param integer $id_product Product id
  * @param integer $id_product_attribute Product attribute id
  * @param integer $id_country Country id
  * @param integer $id_state State id
  * @param integer $id_currency Currency id
  * @param integer $id_group Group id
  * @param integer $quantity Quantity Required for Specific prices : quantity discount application
  * @param boolean $use_tax with (1) or without (0) tax
  * @param integer $decimals Number of decimals returned
  * @param boolean $only_reduc Returns only the reduction amount
  * @param boolean $use_reduc Set if the returned amount will include reduction
  * @param boolean $with_ecotax insert ecotax in price output.
  * @param variable_reference $specific_price_output If a specific price applies regarding the previous parameters, this variable is filled with the corresponding SpecificPrice object
  * @return float Product price
  **/
 public static function priceCalculation($id_shop, $id_product, $id_product_attribute, $id_country, $id_state, $id_county, $id_currency, $id_group, $quantity, $use_tax, $decimals, $only_reduc, $use_reduc, $with_ecotax, &$specific_price, $id_affiliate)
 {
     //Checking product tags
     $tags = Tag::getProductTags((int) $id_product);
     $tags = $tags[1];
     if (is_array($tags) && in_array('buy1get1', $tags) && empty($id_affiliate)) {
         $b1g1 = true;
         $use_reduc = false;
     }
     // Caching
     if ($id_product_attribute === NULL) {
         $product_attribute_label = 'NULL';
     } else {
         $product_attribute_label = $id_product_attribute === false ? 'false' : $id_product_attribute;
     }
     $cacheId = $id_product . '-' . $id_shop . '-' . $id_currency . '-' . $id_country . '-' . $id_state . '-' . $id_county . '-' . $id_group . '-' . $quantity . '-' . $product_attribute_label . '-' . ($use_tax ? '1' : '0') . '-' . $decimals . '-' . ($only_reduc ? '1' : '0') . '-' . ($use_reduc ? '1' : '0') . '-' . $with_ecotax . '-' . (int) $id_affiliate;
     // Cache for specific prices
     $cacheId3 = $id_product . '-' . $id_shop . '-' . $id_currency . '-' . $id_country . '-' . $id_group . '-' . $quantity;
     // reference parameter is filled before any returns
     $specific_price = SpecificPrice::getSpecificPrice((int) $id_product, $id_shop, $id_currency, $id_country, $id_group, $quantity, $id_affiliate);
     if (isset(self::$_prices[$cacheId])) {
         return self::$_prices[$cacheId];
     }
     // fetch price & attribute price
     $cacheId2 = $id_product . '-' . $id_product_attribute;
     if (!isset(self::$_pricesLevel2[$cacheId2])) {
         self::$_pricesLevel2[$cacheId2] = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
         SELECT p.`price`,
         ' . ($id_product_attribute ? 'pa.`price`' : 'IFNULL((SELECT pa.price FROM `' . _DB_PREFIX_ . 'product_attribute` pa WHERE id_product = ' . (int) $id_product . ' AND default_on = 1), 0)') . ' AS attribute_price,
         p.`ecotax`
         ' . ($id_product_attribute ? ', pa.`ecotax` AS attribute_ecotax' : '') . '
         FROM `' . _DB_PREFIX_ . 'product` p
         ' . ($id_product_attribute ? 'LEFT JOIN `' . _DB_PREFIX_ . 'product_attribute` pa ON pa.`id_product_attribute` = ' . (int) $id_product_attribute : '') . '
         WHERE p.`id_product` = ' . (int) $id_product);
     }
     $result = self::$_pricesLevel2[$cacheId2];
     $price = (double) (!$specific_price or $specific_price['price'] == 0) ? $result['price'] : $specific_price['price'];
     // convert only if the specific price is in the default currency (id_currency = 0)
     if (!$specific_price or !($specific_price['price'] > 0 and $specific_price['id_currency'])) {
         $price = Tools::convertPrice($price, $id_currency);
     }
     // Attribute price
     $attribute_price = Tools::convertPrice(array_key_exists('attribute_price', $result) ? (double) $result['attribute_price'] : 0, $id_currency);
     if ($id_product_attribute !== false) {
         // If you want the default combination, please use NULL value instead
         $price += $attribute_price;
     }
     // TaxRate calculation
     $tax_rate = Tax::getProductTaxRateViaRules((int) $id_product, (int) $id_country, (int) $id_state, (int) $id_county);
     if ($tax_rate === false) {
         $tax_rate = 0;
     }
     // Add Tax
     if ($use_tax) {
         $price = $price * (1 + $tax_rate / 100);
     }
     $price = Tools::ps_round($price, $decimals);
     // Reduction
     $reduc = 0;
     if (($only_reduc or $use_reduc) and $specific_price) {
         if ($specific_price['reduction_type'] == 'amount') {
             $reduction_amount = $specific_price['reduction'];
             if (!$specific_price['id_currency']) {
                 $reduction_amount = Tools::convertPrice($reduction_amount, $id_currency);
             }
             $reduc = Tools::ps_round(!$use_tax ? $reduction_amount / (1 + $tax_rate / 100) : $reduction_amount, $decimals);
         } else {
             $reduc = Tools::ps_round($price * $specific_price['reduction'], $decimals);
         }
     }
     if ($only_reduc && !empty($b1g1)) {
         return 0;
     } else {
         if ($only_reduc) {
             return $reduc;
         }
     }
     if ($use_reduc) {
         $price -= $reduc;
     }
     // Group reduction
//.........这里部分代码省略.........
开发者ID:priyankajsr19,项目名称:shalu,代码行数:101,代码来源:Product.php

示例5: getTags

 public function getTags($id_lang)
 {
     if (!$this->isFullyLoaded && is_null($this->tags)) {
         $this->tags = Tag::getProductTags($this->id);
     }
     if (!($this->tags && key_exists($id_lang, $this->tags))) {
         return '';
     }
     $result = '';
     foreach ($this->tags[$id_lang] as $tag_name) {
         $result .= $tag_name . ', ';
     }
     return rtrim($result, ', ');
 }
开发者ID:jicheng17,项目名称:vipinsg,代码行数:14,代码来源:Product.php

示例6: displayFormInformations


//.........这里部分代码省略.........
        echo '						<p class="clear" style="padding:10px 0 0 0">' . '<a style="cursor:pointer" class="button" onmousedown="updateFriendlyURLByName();">' . $this->l('Generate') . '</a>&nbsp;' . $this->l('Friendly-url from product\'s name.') . '<br /><br />';
        echo '						' . $this->l('Product link will look like this:') . ' ' . (Configuration::get('PS_SSL_ENABLED') ? 'https://' : 'http://') . $_SERVER['SERVER_NAME'] . '/<b>id_product</b>-<span id="friendly-url"></span>.html</p>
									</td>
								</tr>';
        echo '</td></tr></table>
						</div>
					</td></tr>
					<tr><td colspan="2" style="padding-bottom:5px;"><hr style="width:100%;" /></td></tr>
					<tr>
						<td class="col-left">' . $this->l('Short description:') . '<br /><br /><i>(' . $this->l('appears in the product lists and on the top of the product page') . ')</i></td>
						<td style="padding-bottom:5px;" class="translatable">';
        foreach ($this->_languages as $language) {
            echo '		<div class="lang_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none') . ';float: left;">
								<textarea class="rte" cols="100" rows="10" id="description_short_' . $language['id_lang'] . '" name="description_short_' . $language['id_lang'] . '">' . htmlentities(stripslashes($this->getFieldValue($obj, 'description_short', $language['id_lang'])), ENT_COMPAT, 'UTF-8') . '</textarea>
							</div>';
        }
        echo '		</td>
					</tr>
					<tr>
						<td class="col-left">' . $this->l('Description:') . '<br /><br /><i>(' . $this->l('appears in the body of the product page') . ')</i></td>
						<td style="padding-bottom:5px;" class="translatable">';
        foreach ($this->_languages as $language) {
            echo '		<div class="lang_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none') . ';float: left;">
								<textarea class="rte" cols="100" rows="20" id="description_' . $language['id_lang'] . '" name="description_' . $language['id_lang'] . '">' . htmlentities(stripslashes($this->getFieldValue($obj, 'description', $language['id_lang'])), ENT_COMPAT, 'UTF-8') . '</textarea>
							</div>';
        }
        echo '		</td>
					</tr>';
        echo '
					<tr>
						<td class="col-left">' . $this->l('Tags:') . '</td>
						<td style="padding-bottom:5px;" class="translatable">';
        if ($obj->id) {
            $obj->tags = Tag::getProductTags((int) $obj->id);
        }
        foreach ($this->_languages as $language) {
            echo '<div class="lang_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none') . '; float: left;">
							<input size="55" type="text" id="tags_' . $language['id_lang'] . '" name="tags_' . $language['id_lang'] . '"
							value="' . htmlentities(Tools::getValue('tags_' . $language['id_lang'], $obj->getTags($language['id_lang'], true)), ENT_COMPAT, 'UTF-8') . '" />
							<span class="hint" name="help_box">' . $this->l('Forbidden characters:') . ' !<>;?=+#"&deg;{}_$%<span class="hint-pointer">&nbsp;</span></span>
						  </div>';
        }
        echo '	<p class="clear">' . $this->l('Tags separated by commas (e.g., dvd, dvd player, hifi)') . '</p>
						</td>
					</tr>';
        $accessories = Product::getAccessoriesLight((int) $cookie->id_lang, $obj->id);
        if ($postAccessories = Tools::getValue('inputAccessories')) {
            $postAccessoriesTab = explode('-', Tools::getValue('inputAccessories'));
            foreach ($postAccessoriesTab as $accessoryId) {
                if (!$this->haveThisAccessory($accessoryId, $accessories) and $accessory = Product::getAccessoryById($accessoryId)) {
                    $accessories[] = $accessory;
                }
            }
        }
        echo '
					<tr>
						<td class="col-left">' . $this->l('Accessories:') . '<br /><br /><i>' . $this->l('(Do not forget to Save the product afterward)') . '</i></td>
						<td style="padding-bottom:5px;">
							<div id="divAccessories">';
        foreach ($accessories as $accessory) {
            echo htmlentities($accessory['name'], ENT_COMPAT, 'UTF-8') . (!empty($accessory['reference']) ? ' (' . $accessory['reference'] . ')' : '') . ' <span onclick="delAccessory(' . $accessory['id_product'] . ');" style="cursor: pointer;"><img src="../img/admin/delete.gif" class="middle" alt="" /></span><br />';
        }
        echo '</div>
							<input type="hidden" name="inputAccessories" id="inputAccessories" value="';
        foreach ($accessories as $accessory) {
            echo (int) $accessory['id_product'] . '-';
开发者ID:nicolasjeol,项目名称:hec-ecommerce,代码行数:67,代码来源:AdminProducts.php

示例7: agileLoadProduct

 private function agileLoadProduct($id_product)
 {
     ${"GLOBALS"}["qjcfdxciaovg"] = "id_product";
     $usvlhhp = "prod";
     ${$usvlhhp} = new Product(${${"GLOBALS"}["yywbslr"]}, true);
     $prod->price = (double) Db::getInstance()->getValue("SELECT price FROM " . _DB_PREFIX_ . "product WHERE id_product=" . (int) ${${"GLOBALS"}["yywbslr"]});
     $prod->unit_price = $prod->unit_price_ratio != 0 ? $prod->price / $prod->unit_price_ratio : 0;
     ${"GLOBALS"}["ehfbxhwhf"] = "prod";
     if ($this->product_menu == 1 && ${${"GLOBALS"}["qjcfdxciaovg"]} > 0) {
         ${"GLOBALS"}["ptammewesp"] = "id_product";
         $prod->tags = Tag::getProductTags(${${"GLOBALS"}["ptammewesp"]});
     }
     return ${${"GLOBALS"}["ehfbxhwhf"]};
 }
开发者ID:ecssjapan,项目名称:guiding-you-afteropen,代码行数:14,代码来源:sellerproductdetailbase.php

示例8: hookExtraRight

 public function hookExtraRight($params)
 {
     if (!Configuration::get('iqittag_hook')) {
         $id_product = (int) Tools::getValue('id_product');
         if (!$this->isCached('iqitproducttags.tpl', $this->getCacheId($id_product))) {
             $tags = Tag::getProductTags($id_product);
             if (is_array($tags)) {
                 $this->smarty->assign(array('tags' => $tags[1]));
             }
         }
         return $this->display(__FILE__, 'iqitproducttags.tpl', $this->getCacheId($id_product));
     }
 }
开发者ID:evgrishin,项目名称:se1614,代码行数:13,代码来源:iqitproducttags.php

示例9: productImport


//.........这里部分代码省略.........
                        $id_shop_list[] = (int) Shop::getIdByName($shop);
                    } elseif (!empty($shop)) {
                        $id_shop_list[] = $shop;
                    }
                }
                if (isset($info['reduction_price']) && $info['reduction_price'] > 0 || isset($info['reduction_percent']) && $info['reduction_percent'] > 0) {
                    foreach ($id_shop_list as $id_shop) {
                        $specific_price = SpecificPrice::getSpecificPrice($product->id, $id_shop, 0, 0, 0, 1, 0, 0, 0, 0);
                        if (is_array($specific_price) && isset($specific_price['id_specific_price'])) {
                            $specific_price = new SpecificPrice((int) $specific_price['id_specific_price']);
                        } else {
                            $specific_price = new SpecificPrice();
                        }
                        $specific_price->id_product = (int) $product->id;
                        $specific_price->id_specific_price_rule = 0;
                        $specific_price->id_shop = $id_shop;
                        $specific_price->id_currency = 0;
                        $specific_price->id_country = 0;
                        $specific_price->id_group = 0;
                        $specific_price->price = -1;
                        $specific_price->id_customer = 0;
                        $specific_price->from_quantity = 1;
                        $specific_price->reduction = isset($info['reduction_price']) && $info['reduction_price'] ? $info['reduction_price'] : $info['reduction_percent'] / 100;
                        $specific_price->reduction_type = isset($info['reduction_price']) && $info['reduction_price'] ? 'amount' : 'percentage';
                        $specific_price->from = isset($info['reduction_from']) && Validate::isDate($info['reduction_from']) ? $info['reduction_from'] : '0000-00-00 00:00:00';
                        $specific_price->to = isset($info['reduction_to']) && Validate::isDate($info['reduction_to']) ? $info['reduction_to'] : '0000-00-00 00:00:00';
                        if (!$specific_price->save()) {
                            $this->addProductWarning(Tools::safeOutput($info['name']), $product->id, $this->l('Discount is invalid'));
                        }
                    }
                }
                if (isset($product->tags) && !empty($product->tags)) {
                    if (isset($product->id) && $product->id) {
                        $tags = Tag::getProductTags($product->id);
                        if (is_array($tags) && count($tags)) {
                            if (!empty($product->tags)) {
                                $product->tags = explode($this->multiple_value_separator, $product->tags);
                            }
                            if (is_array($product->tags) && count($product->tags)) {
                                foreach ($product->tags as $key => $tag) {
                                    if (!empty($tag)) {
                                        $product->tags[$key] = trim($tag);
                                    }
                                }
                                $tags[$id_lang] = $product->tags;
                                $product->tags = $tags;
                            }
                        }
                    }
                    // Delete tags for this id product, for no duplicating error
                    Tag::deleteTagsForProduct($product->id);
                    if (!is_array($product->tags) && !empty($product->tags)) {
                        $product->tags = AdminImportController::createMultiLangField($product->tags);
                        foreach ($product->tags as $key => $tags) {
                            $is_tag_added = Tag::addTags($key, $product->id, $tags, $this->multiple_value_separator);
                            if (!$is_tag_added) {
                                $this->addProductWarning(Tools::safeOutput($info['name']), $product->id, $this->l('Tags list is invalid'));
                                break;
                            }
                        }
                    } else {
                        foreach ($product->tags as $key => $tags) {
                            $str = '';
                            foreach ($tags as $one_tag) {
                                $str .= $one_tag . $this->multiple_value_separator;
                            }
开发者ID:toufikadfab,项目名称:PrestaShop-1.5,代码行数:67,代码来源:AdminImportController.php

示例10: content_56139717aa65e8_72426751


//.........这里部分代码省略.........
							<p id="add_to_cart" class="buttons_bottom_block no-print">
								<button type="submit" name="Submit" class="xiami">
									<span><?php 
                if ($_smarty_tpl->tpl_vars['content_only']->value && (isset($_smarty_tpl->tpl_vars['product']->value->customization_required) && $_smarty_tpl->tpl_vars['product']->value->customization_required)) {
                    echo smartyTranslate(array('s' => 'Customize'), $_smarty_tpl);
                } else {
                    echo smartyTranslate(array('s' => 'Add to cart'), $_smarty_tpl);
                }
                ?>
</span>
								</button>
							</p>
						</div>
					</div> <!-- end box-cart-bottom -->
				</div> <!-- end box-info-product -->
			</form>
			<?php 
            }
            ?>
		</div> <!-- end pb-right-column-->

		</div>
		<!-- end center infos-->
		<!-- pb-right-column-->

	

	<div class="producttags">
		<span class="tags">Tagi:</span>
    <?php 
            $_smarty_tpl->tpl_vars['v'] = new Smarty_Variable();
            $_smarty_tpl->tpl_vars['v']->_loop = false;
            $_smarty_tpl->tpl_vars['k'] = new Smarty_Variable();
            $_from = Tag::getProductTags(Tools::getValue('id_product'));
            if (!is_array($_from) && !is_object($_from)) {
                settype($_from, 'array');
            }
            foreach ($_from as $_smarty_tpl->tpl_vars['v']->key => $_smarty_tpl->tpl_vars['v']->value) {
                $_smarty_tpl->tpl_vars['v']->_loop = true;
                $_smarty_tpl->tpl_vars['k']->value = $_smarty_tpl->tpl_vars['v']->key;
                ?>
        <?php 
                $_smarty_tpl->tpl_vars['value'] = new Smarty_Variable();
                $_smarty_tpl->tpl_vars['value']->_loop = false;
                $_from = $_smarty_tpl->tpl_vars['v']->value;
                if (!is_array($_from) && !is_object($_from)) {
                    settype($_from, 'array');
                }
                foreach ($_from as $_smarty_tpl->tpl_vars['value']->key => $_smarty_tpl->tpl_vars['value']->value) {
                    $_smarty_tpl->tpl_vars['value']->_loop = true;
                    ?>
            <span><a href="<?php 
                    ob_start();
                    echo urlencode($_smarty_tpl->tpl_vars['value']->value);
                    $_tmp7 = ob_get_clean();
                    echo $_smarty_tpl->tpl_vars['link']->value->getPageLink('search', true, null, "tag=" . $_tmp7);
                    ?>
"><?php 
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['value']->value, ENT_QUOTES, 'UTF-8', true);
                    ?>
</a></span>
        <?php 
                }
                ?>
    <?php 
            }
开发者ID:pgurdek,项目名称:xa,代码行数:67,代码来源:4b76fcb5826db9536e9efcca170791fe8a76a127.file.product.tpl.php

示例11: __construct

 public function __construct($id_product = NULL, $full = false, $id_lang = NULL)
 {
     parent::__construct($id_product, $id_lang);
     if ($full and $this->id) {
         $this->manufacturer_name = Manufacturer::getNameById(intval($this->id_manufacturer));
         $this->supplier_name = Supplier::getNameById(intval($this->id_supplier));
         $tax = new Tax(intval($this->id_tax), intval($id_lang));
         $this->tax_name = $tax->name;
         $this->tax_rate = floatval($tax->rate);
         $this->new = $this->isNew();
     }
     if ($this->id_category_default) {
         $this->category = Category::getLinkRewrite(intval($this->id_category_default), intval($id_lang));
     }
     if ($this->id) {
         $this->tags = Tag::getProductTags(intval($this->id));
     }
 }
开发者ID:Bruno-2M,项目名称:prestashop,代码行数:18,代码来源:Product.php

示例12: productImport


//.........这里部分代码省略.........
                        $id_shop_list[] = (int) Shop::getIdByName($shop);
                    } elseif (!empty($shop)) {
                        $id_shop_list[] = $shop;
                    }
                }
                if (isset($info['reduction_price']) && $info['reduction_price'] > 0 || isset($info['reduction_percent']) && $info['reduction_percent'] > 0) {
                    foreach ($id_shop_list as $id_shop) {
                        $specific_price = SpecificPrice::getSpecificPrice($product->id, $id_shop, 0, 0, 0, 1, 0, 0, 0, 0);
                        if (is_array($specific_price) && isset($specific_price['id_specific_price'])) {
                            $specific_price = new SpecificPrice((int) $specific_price['id_specific_price']);
                        } else {
                            $specific_price = new SpecificPrice();
                        }
                        $specific_price->id_product = (int) $product->id;
                        $specific_price->id_specific_price_rule = 0;
                        $specific_price->id_shop = $id_shop;
                        $specific_price->id_currency = 0;
                        $specific_price->id_country = 0;
                        $specific_price->id_group = 0;
                        $specific_price->price = -1;
                        $specific_price->id_customer = 0;
                        $specific_price->from_quantity = 1;
                        $specific_price->reduction = isset($info['reduction_price']) && $info['reduction_price'] ? $info['reduction_price'] : $info['reduction_percent'] / 100;
                        $specific_price->reduction_type = isset($info['reduction_price']) && $info['reduction_price'] ? 'amount' : 'percentage';
                        $specific_price->from = isset($info['reduction_from']) && Validate::isDate($info['reduction_from']) ? $info['reduction_from'] : '0000-00-00 00:00:00';
                        $specific_price->to = isset($info['reduction_to']) && Validate::isDate($info['reduction_to']) ? $info['reduction_to'] : '0000-00-00 00:00:00';
                        if (!$specific_price->save()) {
                            $this->addProductWarning(Tools::safeOutput($info['name']), $product->id, $this->l('Discount is invalid'));
                        }
                    }
                }
                if (isset($product->tags) && !empty($product->tags)) {
                    if (isset($product->id) && $product->id) {
                        $tags = Tag::getProductTags($product->id);
                        if (is_array($tags) && count($tags)) {
                            if (!empty($product->tags)) {
                                $product->tags = explode($this->multiple_value_separator, $product->tags);
                            }
                            if (is_array($product->tags) && count($product->tags)) {
                                foreach ($product->tags as $key => $tag) {
                                    if (!empty($tag)) {
                                        $product->tags[$key] = trim($tag);
                                    }
                                }
                                $tags[$id_lang] = $product->tags;
                                $product->tags = $tags;
                            }
                        }
                    }
                    Tag::deleteTagsForProduct($product->id);
                    if (!is_array($product->tags) && !empty($product->tags)) {
                        $product->tags = AdminImportController::createMultiLangField($product->tags);
                        foreach ($product->tags as $key => $tags) {
                            $is_tag_added = Tag::addTags($key, $product->id, $tags, $this->multiple_value_separator);
                            if (!$is_tag_added) {
                                $this->addProductWarning(Tools::safeOutput($info['name']), $product->id, $this->l('Tags list is invalid'));
                                break;
                            }
                        }
                    } else {
                        foreach ($product->tags as $key => $tags) {
                            $str = '';
                            foreach ($tags as $one_tag) {
                                $str .= $one_tag . $this->multiple_value_separator;
                            }
                            $str = rtrim($str, $this->multiple_value_separator);
开发者ID:Oldwo1f,项目名称:yakaboutique,代码行数:67,代码来源:AdminImportController.php

示例13: getProductCategories

 /**
  * @param \Product $product
  * @param bool $ids
  *
  * @return string
  * @throws \Exception
  * @author Panagiotis Vagenas <pan.vagenas@gmail.com>
  * @since 150213
  */
 protected function getProductCategories(\Product &$product, $ids = false)
 {
     $maxDepth = 3;
     // TODO Implement in options or remove
     $categories = array();
     if ($this->Options->getValue('map_category') == 1) {
         $info = \Tag::getProductTags($product->id);
         if ($info && !isset($info[$this->defaultLang])) {
             $categories = (array) $info[$this->defaultLang];
         }
     } else {
         $defaultCat = $product->getDefaultCategory();
         if ($ids) {
             return $defaultCat;
         }
         $category = new \Category($defaultCat);
         do {
             array_push($categories, $ids ? $category->id : $category->name[$this->defaultLang]);
             $category = new \Category($category->id_parent);
         } while ($category->id_parent && !$category->is_root_category);
         $categories = array_reverse($categories);
     }
     return is_array($categories) ? implode($ids ? ' - ' : '->', $categories) : $categories;
 }
开发者ID:panvagenas,项目名称:bestprice.gr-xml-feed-for-prestashop,代码行数:33,代码来源:BestPrice.php

示例14: __construct

 public function __construct($id_product = NULL, $full = false, $id_lang = NULL)
 {
     global $cart;
     parent::__construct($id_product, $id_lang);
     if ($full and $this->id) {
         $this->tax_name = 'deprecated';
         // The applicable tax may be BOTH the product one AND the state one (moreover this variable is some deadcode)
         $this->manufacturer_name = Manufacturer::getNameById(intval($this->id_manufacturer));
         $this->supplier_name = Supplier::getNameById(intval($this->id_supplier));
         $tax = new Tax(intval($this->id_tax));
         if (is_object($cart) and $cart->id_address_delivery != NULL) {
             $this->tax_rate = Tax::getApplicableTax(intval($this->id_tax), floatval($tax->rate));
         } else {
             $this->tax_rate = floatval($tax->rate);
         }
         $this->new = $this->isNew();
     }
     if ($this->id_category_default) {
         $this->category = Category::getLinkRewrite(intval($this->id_category_default), intval($id_lang));
     }
     if ($this->id) {
         $this->tags = Tag::getProductTags(intval($this->id));
     }
 }
开发者ID:vincent,项目名称:theinvertebrates,代码行数:24,代码来源:Product.php

示例15: getProductCategories

 /**
  * @param \Product $product
  *
  * @return string
  * @throws \Exception
  * @author Panagiotis Vagenas <pan.vagenas@gmail.com>
  * @since 150213
  */
 protected function getProductCategories(\Product &$product)
 {
     $categories = array();
     if ($this->Options->getValue('map_category') == 1) {
         $info = \Tag::getProductTags($product->id);
         if ($info && !isset($info[$this->defaultLang])) {
             $categories = (array) $info[$this->defaultLang];
         }
     } else {
         $info = \Category::getCategoryInformations($product->getCategories());
         if (!is_array($info) || empty($info)) {
             return '';
         }
         foreach ((array) $info as $cat) {
             // Todo is there a better way to check for home category?
             if ($cat['id_category'] == 2) {
                 continue;
             }
             array_push($categories, $cat['name']);
         }
     }
     return implode(' - ', (array) $categories);
 }
开发者ID:panvagenas,项目名称:prestashop-skroutz-xml-feed,代码行数:31,代码来源:Skroutz.php


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