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


PHP Category::getLinkRewrite方法代码示例

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


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

示例1: getPriceList

 function getPriceList()
 {
     $this->data = $this->getYamarketShopData();
     if ($this->data['yam_name'] == "") {
         return '';
     }
     $currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
     if ($currency->iso_code == 'RUB') {
         $currency->iso_code = 'RUR';
     }
     $desc_type = Configuration::get('YAMARKET_DESC_TYPE');
     $link = $this->context->link;
     $this->ensureHttpPrefix($link);
     $xml = $this->getDocBody();
     // Offers
     $offers = $xml->createElement("offers");
     // Get products
     $categorys = $this->excluded_cats;
     foreach ($categorys as $category) {
         $products = Product::getProducts($this->id_lang, 0, 0, 'name', 'asc', $category);
         foreach ($products as $product) {
             //	if ($product['id_product'] == 228 ){
             $id_category_default = $product['id_category_default'];
             $prod_obj = new Product($product['id_product']);
             $crewrite = Category::getLinkRewrite($product['id_category_default'], $this->id_lang);
             $accessories = $this->getAccessories($product);
             $features = $this->getFeatures($product['id_product']);
             $combinations = $this->getCombinations($prod_obj, $currency);
             // template array
             $product_item = array('name' => html_entity_decode($product['name']), 'description' => html_entity_decode($product['description']), 'id_category_default' => $id_category_default, 'ean13' => $product['ean13'], 'accessories' => implode(',', $accessories), 'vendor' => $product['manufacturer_name']);
             if ($desc_type == 1) {
                 $product_item['description'] = html_entity_decode(strip_tags(str_replace("®", '', $product['description_short'])));
             }
             if ($this->country_of_origin_attr != '' && array_key_exists($this->country_of_origin_attr, $features)) {
                 $product_item['country_of_origin'] = $features[$this->country_of_origin_attr];
                 unset($features[$this->country_of_origin_attr]);
             }
             if ($this->model_name_attr != '' && array_key_exists($this->model_name_attr, $features)) {
                 $product_item['name'] = $features[$this->model_name_attr];
                 unset($features[$this->model_name_attr]);
             }
             if (!$product['available_for_order'] or !$product['active']) {
                 continue;
             }
             if (!empty($combinations)) {
                 foreach ($combinations as $combination) {
                     $prod_obj->id_product_attribute = $combination['id_product_attribute'];
                     $available_for_order = 1 <= StockAvailable::getQuantityAvailableByProduct($product['id_product'], $combination['id_product_attribute']);
                     if (!$available_for_order && !$prod_obj->checkQty(1)) {
                         continue;
                     }
                     $params = $this->getParams($combination);
                     $size = $params[0]['value'];
                     $sizes = $this->sizeConvert($size);
                     $pictures = array();
                     $pictures = $this->getPictures($product['id_product'], $product['link_rewrite']);
                     foreach ($combination['id_images'] as $id_image) {
                         $pictures[] = $link->getImageLink($product['link_rewrite'], $product['id_product'] . '-' . $id_image, $this->image_type);
                     }
                     $url = $link->getProductLink($prod_obj, $product['link_rewrite'], $crewrite, '?utm_source=rsy', null, null, $combination['id_product_attribute'], Configuration::get('PS_REWRITING_SETTINGS'), false, true);
                     //$url = $link->getProductLink($product['link_rewrite'], null, null, null, null, null, $combination['id_product_attribute'], Configuration::get('PS_REWRITING_SETTINGS'), false, true);
                     $extra_product_item = array('id_product' => $product['id_product'] . 'c' . $combination['id_product_attribute'], 'available_for_order' => $available_for_order, 'group_id' => $product['id_product'], 'price' => $prod_obj->getPrice(true, $combination['id_product_attribute']), 'oldprice' => $prod_obj->getPriceWithoutReduct(true, $combination['id_product_attribute']), 'pictures' => $pictures, 'manufacturer_warranty' => 'true', 'market_category' => $product['id_category_default'] == 102 ? Configuration::get('YAMARKET_CATEGORY') : Configuration::get('YAMARKET_CATEGORY2'), 'params' => array_merge($sizes, $features), 'url' => $url);
                     $offer = array_merge($product_item, $extra_product_item);
                     $offer['name'] = $offer['name'] . ' ' . $size;
                     $offers->appendChild($this->getOfferElem($offer, $xml, $currency));
                 }
             } else {
                 $pictures = $this->getPictures($product['id_product'], $product['link_rewrite']);
                 $available_for_order = 1 <= StockAvailable::getQuantityAvailableByProduct($product['id_product'], 0);
                 if (!$available_for_order && !$prod_obj->checkQty(1)) {
                     continue;
                 }
                 $url = $link->getProductLink($prod_obj, $product['link_rewrite'], $crewrite);
                 $extra_product_item = array('id_product' => $product['id_product'], 'available_for_order' => $available_for_order, 'price' => $prod_obj->getPrice(), 'pictures' => $pictures, 'params' => $features, 'url' => $url);
                 $offer = array_merge($product_item, $extra_product_item);
                 $offers->appendChild($this->getOfferElem($offer, $xml, $currency));
             }
             $prod_obj->clearCache(true);
         }
     }
     //}
     $shop = $xml->getElementsByTagName("shop")->item(0);
     $shop->appendChild($offers);
     return $xml->saveXML();
 }
开发者ID:evgrishin,项目名称:mh16014,代码行数:85,代码来源:yamarket.php

示例2: getFilterBlock


//.........这里部分代码省略.........
                    }
                    break;
            }
        }
        // All non indexable attribute and feature
        $nonIndexable = array();
        // Get all non indexable attribute groups
        foreach (Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
		SELECT public_name
		FROM `' . _DB_PREFIX_ . 'attribute_group_lang` agl
		LEFT JOIN `' . _DB_PREFIX_ . 'layered_indexable_attribute_group` liag
		ON liag.id_attribute_group = agl.id_attribute_group
		WHERE indexable IS NULL OR indexable = 0
		AND id_lang = ' . (int) $cookie->id_lang) as $attribute) {
            $nonIndexable[] = Tools::link_rewrite($attribute['public_name']);
        }
        // Get all non indexable features
        foreach (Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
		SELECT name
		FROM `' . _DB_PREFIX_ . 'feature_lang` fl
		LEFT JOIN  `' . _DB_PREFIX_ . 'layered_indexable_feature` lif
		ON lif.id_feature = fl.id_feature
		WHERE indexable IS NULL OR indexable = 0
		AND id_lang = ' . (int) $cookie->id_lang) as $attribute) {
            $nonIndexable[] = Tools::link_rewrite($attribute['name']);
        }
        //generate SEO link
        $paramSelected = '';
        $param_product_url = '';
        $optionCheckedArray = array();
        $paramGroupSelectedArray = array();
        $titleValues = array();
        $link = new Link();
        $linkBase = $link->getCategoryLink($id_parent, Category::getLinkRewrite($id_parent, (int) $cookie->id_lang), (int) $cookie->id_lang);
        $filterBlockList = array();
        //get filters checked by group
        foreach ($filterBlocks as $typeFilter) {
            $filterName = !empty($typeFilter['url_name']) ? $typeFilter['url_name'] : $typeFilter['name'];
            $paramGroupSelected = '';
            foreach ($typeFilter['values'] as $key => $value) {
                if (is_array($value) && array_key_exists('checked', $value)) {
                    $valueName = !empty($value['url_name']) ? $value['url_name'] : $value['name'];
                    $paramGroupSelected .= '-' . str_replace('-', '_', Tools::link_rewrite($valueName));
                    $paramGroupSelectedArray[Tools::link_rewrite($filterName)][] = Tools::link_rewrite($valueName);
                    if (!isset($titleValues[$filterName])) {
                        $titleValues[$filterName] = array();
                    }
                    $titleValues[$filterName][] = $valueName;
                } else {
                    $paramGroupSelectedArray[Tools::link_rewrite($filterName)][] = array();
                }
            }
            if (!empty($paramGroupSelected)) {
                $paramSelected .= '/' . str_replace('-', '_', Tools::link_rewrite($filterName)) . $paramGroupSelected;
                $optionCheckedArray[Tools::link_rewrite($filterName)] = $paramGroupSelected;
            }
            // select only attribute and group attribute to display an unique product combination link
            if (!empty($paramGroupSelected) && $typeFilter['type'] == 'id_attribute_group') {
                $param_product_url .= '/' . str_replace('-', '_', Tools::link_rewrite($filterName)) . $paramGroupSelected;
            }
        }
        if ($this->page > 1) {
            $paramSelected .= '/page-' . $this->page;
        }
        $blackList = array('weight', 'price');
        $nofollow = false;
开发者ID:greench,项目名称:prestashop,代码行数:67,代码来源:blocklayered.php

示例3: viewcustomer


//.........这里部分代码省略.........
					</td>
				</tr>';
            }
            echo '
			</table>';
        } else {
            echo $customer->firstname . ' ' . $customer->lastname . ' ' . $this->l('has no discount vouchers') . '.';
        }
        echo '<div class="clear">&nbsp;</div>';
        echo '<div style="float:left">
		<h2>' . $this->l('Carts') . ' (' . sizeof($carts) . ')</h2>';
        if ($carts and sizeof($carts)) {
            echo '
			<table cellspacing="0" cellpadding="0" class="table">
				<tr>
					<th class="center">' . $this->l('ID') . '</th>
					<th class="center">' . $this->l('Date') . '</th>
					<th class="center">' . $this->l('Total') . '</th>
					<th class="center">' . $this->l('Carrier') . '</th>
					<th class="center">' . $this->l('Actions') . '</th>
				</tr>';
            $tokenCarts = Tools::getAdminToken('AdminCarts' . (int) Tab::getIdFromClassName('AdminCarts') . (int) $cookie->id_employee);
            foreach ($carts as $cart) {
                $cartI = new Cart((int) $cart['id_cart']);
                $summary = $cartI->getSummaryDetails();
                $currency = new Currency((int) $cart['id_currency']);
                $carrier = new Carrier((int) $cart['id_carrier']);
                echo '
				<tr ' . ($irow++ % 2 ? 'class="alt_row"' : '') . ' style="cursor: pointer" onclick="document.location = \'?tab=AdminCarts&id_cart=' . $cart['id_cart'] . '&viewcart&token=' . $tokenCarts . '\'">
					<td class="center">' . sprintf('%06d', $cart['id_cart']) . '</td>
					<td>' . Tools::displayDate($cart['date_add'], (int) $cookie->id_lang, true) . '</td>
					<td align="right">' . Tools::displayPrice($summary['total_price'], $currency) . '</td>
					<td>' . $carrier->name . '</td>
					<td align="center"><a href="index.php?tab=AdminCarts&id_cart=' . $cart['id_cart'] . '&viewcart&token=' . $tokenCarts . '"><img src="../img/admin/details.gif" /></a></td>
				</tr>';
            }
            echo '
			</table>';
        } else {
            echo $this->l('No cart available') . '.';
        }
        echo '</div>';
        $interested = Db::getInstance()->ExecuteS('SELECT DISTINCT id_product FROM ' . _DB_PREFIX_ . 'cart_product cp INNER JOIN ' . _DB_PREFIX_ . 'cart c on c.id_cart = cp.id_cart WHERE c.id_customer = ' . (int) $customer->id . ' AND cp.id_product NOT IN (
		SELECT product_id FROM ' . _DB_PREFIX_ . 'orders o inner join ' . _DB_PREFIX_ . 'order_detail od ON o.id_order = od.id_order WHERE o.valid = 1 AND o.id_customer = ' . (int) $customer->id . ')');
        if (count($interested)) {
            echo '<div style="float:left;margin-left:20px">
			<h2>' . $this->l('Products') . ' (' . count($interested) . ')</h2>
			<table cellspacing="0" cellpadding="0" class="table">';
            foreach ($interested as $p) {
                $product = new Product((int) $p['id_product'], false, $cookie->id_lang);
                echo '
				<tr ' . ($irow++ % 2 ? 'class="alt_row"' : '') . ' style="cursor: pointer" onclick="document.location = \'' . $link->getProductLink((int) $product->id, $product->link_rewrite, Category::getLinkRewrite($product->id_category_default, (int) $cookie->id_lang)) . '\'">
					<td>' . (int) $product->id . '</td>
					<td>' . Tools::htmlentitiesUTF8($product->name) . '</td>
					<td align="center"><a href="' . $link->getProductLink((int) $product->id, $product->link_rewrite, Category::getLinkRewrite($product->id_category_default, (int) $cookie->id_lang)) . '"><img src="../img/admin/details.gif" /></a></td>
				</tr>';
            }
            echo '</table></div>';
        }
        echo '<div class="clear">&nbsp;</div>';
        /* Last connections */
        $connections = $customer->getLastConnections();
        if (sizeof($connections)) {
            echo '<h2>' . $this->l('Last connections') . '</h2>
			<table cellspacing="0" cellpadding="0" class="table">
				<tr>
					<th style="width: 200px">' . $this->l('Date') . '</th>
					<th style="width: 100px">' . $this->l('Pages viewed') . '</th>
					<th style="width: 100px">' . $this->l('Total time') . '</th>
					<th style="width: 100px">' . $this->l('Origin') . '</th>
					<th style="width: 100px">' . $this->l('IP Address') . '</th>
				</tr>';
            foreach ($connections as $connection) {
                echo '<tr>
						<td>' . Tools::displayDate($connection['date_add'], (int) $cookie->id_lang, true) . '</td>
						<td>' . (int) $connection['pages'] . '</td>
						<td>' . $connection['time'] . '</td>
						<td>' . ($connection['http_referer'] ? preg_replace('/^www./', '', parse_url($connection['http_referer'], PHP_URL_HOST)) : $this->l('Direct link')) . '</td>
						<td>' . $connection['ipaddress'] . '</td>
					</tr>';
            }
            echo '</table><div class="clear">&nbsp;</div>';
        }
        if (sizeof($referrers)) {
            echo '<h2>' . $this->l('Referrers') . '</h2>
			<table cellspacing="0" cellpadding="0" class="table">
				<tr>
					<th style="width: 200px">' . $this->l('Date') . '</th>
					<th style="width: 200px">' . $this->l('Name') . '</th>
				</tr>';
            foreach ($referrers as $referrer) {
                echo '<tr>
						<td>' . Tools::displayDate($referrer['date_add'], (int) $cookie->id_lang, true) . '</td>
						<td>' . $referrer['name'] . '</td>
					</tr>';
            }
            echo '</table><div class="clear">&nbsp;</div>';
        }
        echo '<a href="' . $currentIndex . '&token=' . $this->token . '"><img src="../img/admin/arrow2.gif" /> ' . $this->l('Back to customer list') . '</a><br />';
    }
开发者ID:srikanthash09,项目名称:codetestdatld,代码行数:101,代码来源:AdminCustomers.php

示例4: getPriceList

 function getPriceList()
 {
     $currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
     if ($currency->iso_code == 'RUB') {
         $currency->iso_code = 'RUR';
     }
     $desc_type = Configuration::get('YAMARKET_DESC_TYPE');
     $link = $this->context->link;
     $this->ensureHttpPrefix($link);
     // Get products
     $products = Product::getProducts($this->id_lang, 0, 0, 'name', 'asc');
     $xml = $this->getDocBody();
     // Offers
     $offers = $xml->createElement("offers");
     foreach ($products as $product) {
         // Get home category
         $category = $product['id_category_default'];
         if ($category == 1) {
             $temp_categories = Product::getProductCategories($product['id_product']);
             foreach ($temp_categories as $category) {
                 if ($category != 1) {
                     break;
                 }
             }
             if ($category == 1) {
                 continue;
             }
         }
         if (in_array($category, $this->excluded_cats)) {
             continue;
         }
         $prod_obj = new Product($product['id_product']);
         $crewrite = Category::getLinkRewrite($product['id_category_default'], $this->id_lang);
         $accessories = $this->getAccessories($product);
         $features = $this->getFeatures($product['id_product']);
         $combinations = $this->getCombinations($prod_obj, $currency);
         // template array
         $product_item = array('name' => html_entity_decode($product['name']), 'description' => html_entity_decode($product['description']), 'id_category_default' => $category, 'ean13' => $product['ean13'], 'accessories' => implode(',', $accessories), 'vendor' => $product['manufacturer_name']);
         if ($desc_type == 1) {
             $product_item['description'] = html_entity_decode($product['description_short']);
         }
         if ($this->country_of_origin_attr != '' && array_key_exists($this->country_of_origin_attr, $features)) {
             $product_item['country_of_origin'] = $features[$this->country_of_origin_attr];
             unset($features[$this->country_of_origin_attr]);
         }
         if ($this->model_name_attr != '' && array_key_exists($this->model_name_attr, $features)) {
             $product_item['name'] = $features[$this->model_name_attr];
             unset($features[$this->model_name_attr]);
         }
         if (!$product['available_for_order'] or !$product['active']) {
             continue;
         }
         if (!empty($combinations)) {
             foreach ($combinations as $combination) {
                 $prod_obj->id_product_attribute = $combination['id_product_attribute'];
                 $available_for_order = 1 <= StockAvailable::getQuantityAvailableByProduct($product['id_product'], $combination['id_product_attribute']);
                 if (!$available_for_order && !$prod_obj->checkQty(1)) {
                     continue;
                 }
                 $params = $this->getParams($combination);
                 $pictures = array();
                 foreach ($combination['id_images'] as $id_image) {
                     $pictures[] = $link->getImageLink($product['link_rewrite'], $product['id_product'] . '-' . $id_image, $this->image_type);
                 }
                 $mainPicture = array_shift($pictures);
                 $url = $link->getProductLink($prod_obj, $product['link_rewrite'], $crewrite, null, null, null, $combination['id_product_attribute']);
                 $extra_product_item = array('id_product' => $product['id_product'] . 'c' . $combination['id_product_attribute'], 'available_for_order' => $available_for_order, 'price' => $prod_obj->getPrice(true, $combination['id_product_attribute']), 'pictures' => $pictures, 'main_picture' => $mainPicture, 'params' => array_merge($params, $features), 'url' => $url);
                 $offer = array_merge($product_item, $extra_product_item);
                 $offers->appendChild($this->getOfferElem($offer, $xml, $currency));
             }
         } else {
             $pictures = $this->getPictures($product['id_product'], $product['link_rewrite']);
             $mainPicture = array_shift($pictures);
             $available_for_order = 1 <= StockAvailable::getQuantityAvailableByProduct($product['id_product'], 0);
             if (!$available_for_order && !$prod_obj->checkQty(1)) {
                 continue;
             }
             $url = $link->getProductLink($prod_obj, $product['link_rewrite'], $crewrite);
             $extra_product_item = array('id_product' => $product['id_product'], 'available_for_order' => $available_for_order, 'price' => $prod_obj->getPrice(), 'pictures' => $pictures, 'main_picture' => $mainPicture, 'params' => $features, 'url' => $url);
             $offer = array_merge($product_item, $extra_product_item);
             $offers->appendChild($this->getOfferElem($offer, $xml, $currency));
         }
         $prod_obj->clearCache(true);
     }
     $shop = $xml->getElementsByTagName("shop")->item(0);
     $shop->appendChild($offers);
     return $xml->saveXML();
 }
开发者ID:WhisperingTree,项目名称:etagerca,代码行数:88,代码来源:topshop.php

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

示例6: foreach

			<url><?php 
echo _PS_BASE_URL_ . __PS_BASE_URI__ . 'img/logo.jpg';
?>
</url>
			<link><?php 
echo _PS_BASE_URL_ . __PS_BASE_URI__;
?>
</link>
		</image>
<?php 
foreach ($products as $product) {
    $image = Image::getImages(intval($cookie->id_lang), $product['id_product']);
    echo "\t\t<item>\n";
    echo "\t\t\t<title><![CDATA[" . $product['name'] . " - " . html_entity_decode(Tools::displayPrice(Product::getPriceStatic($product['id_product']), $currency), ENT_COMPAT, 'UTF-8') . " ]]></title>\n";
    echo "\t\t\t<description>";
    $cdata = true;
    if (is_array($image) and sizeof($image)) {
        echo "<![CDATA[<img src='" . _PS_BASE_URL_ . __PS_BASE_URI__ . "img/p/" . $image[0]['id_product'] . "-" . $image[0]['id_image'] . "-small.jpg' title='" . str_replace('&', '', $product['name']) . "' alt='thumb' />";
        $cdata = false;
    }
    if ($cdata) {
        echo "<![CDATA[";
    }
    echo $product['description_short'] . "]]></description>\n";
    echo "\t\t\t<link><![CDATA[" . htmlspecialchars($link->getproductLink($product['id_product'], $product['link_rewrite'], Category::getLinkRewrite(intval($product['id_category_default']), $cookie->id_lang))) . $affiliate . "]]></link>\n";
    echo "\t\t</item>\n";
}
?>
	</channel>
</rss>
开发者ID:vincent,项目名称:theinvertebrates,代码行数:30,代码来源:rss.php

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

示例8: initFormSeo

 public function initFormSeo($product)
 {
     if (!$this->default_form_language) {
         $this->getLanguages();
     }
     $data = $this->createTemplate($this->tpl_form);
     $context = Context::getContext();
     $rewritten_links = array();
     foreach ($this->_languages as $language) {
         $category = Category::getLinkRewrite((int) $product->id_category_default, (int) $language['id_lang']);
         $rewritten_links[(int) $language['id_lang']] = explode('[REWRITE]', $context->link->getProductLink($product, '[REWRITE]', $category, null, (int) $language['id_lang']));
     }
     $data->assign(array('product' => $product, 'languages' => $this->_languages, 'id_lang' => $this->context->language->id, 'ps_ssl_enabled' => Configuration::get('PS_SSL_ENABLED'), 'curent_shop_url' => $this->context->shop->getBaseURL(), 'default_form_language' => $this->default_form_language, 'rewritten_links' => $rewritten_links));
     $this->tpl_form_vars['custom_form'] = $data->fetch();
 }
开发者ID:Rohit-jn,项目名称:hotelcommerce,代码行数:15,代码来源:AdminProductsController.php

示例9: generateFile

 private function generateFile($lang)
 {
     $path_parts = pathinfo(__FILE__);
     if (Configuration::get('GENERATE_FILE_IN_ROOT')) {
         $generate_file_path = dirname(__FILE__) . '/../../' . $this->_getOutputFileName($lang['iso_code']);
     } else {
         $generate_file_path = dirname(__FILE__) . '/file_exports/' . $this->_getOutputFileName($lang['iso_code']);
     }
     //Google Shopping XML
     $xml = '<?xml version="1.0" encoding="UTF-8" ?>' . "\n";
     $xml .= '<feed xmlns="http://www.w3.org/2005/Atom" xmlns:g="http://base.google.com/ns/1.0" encoding="UTF-8" >' . "\n";
     $xml .= '<title>' . Configuration::get('PS_SHOP_NAME') . '</title>' . "\n";
     $xml .= '<link href="' . htmlspecialchars($this->uri, self::REPLACE_FLAGS, self::CHARSET, false) . '" rel="alternate" type="text/html"/>' . "\n";
     $xml .= '<modified>' . date('Y-m-d') . 'T01:01:01Z</modified><author><name>' . Configuration::get('PS_SHOP_NAME') . '</name></author>' . "\n";
     $googleshoppingfile = fopen($generate_file_path, 'w');
     // add UTF-8 byte order mark
     fwrite($googleshoppingfile, pack("CCC", 0xef, 0xbb, 0xbf));
     //file header
     fwrite($googleshoppingfile, $xml);
     $sql = 'SELECT * FROM ' . _DB_PREFIX_ . 'product p' . ' LEFT JOIN ' . _DB_PREFIX_ . 'product_lang pl ON p.id_product = pl.id_product' . ' WHERE p.active = 1 AND pl.id_lang=' . $lang['id_lang'];
     $products = Db::getInstance()->ExecuteS($sql);
     $title_limit = 70;
     $description_limit = 10000;
     $languages = Language::getLanguages();
     $tailleTabLang = sizeof($languages);
     foreach ($products as $product) {
         $xml_googleshopping = '';
         $cat_link_rew = Category::getLinkRewrite($product['id_category_default'], intval($lang));
         //continue if product not have price
         $price = Product::getPriceStatic($product['id_product'], true, NULL, 2);
         if (empty($price)) {
             continue;
         }
         $product_link = $this->context->link->getProductLink((int) $product['id_product'], $product['link_rewrite'], $cat_link_rew, $product['ean13'], (int) $product['id_lang'], 1, 0, true);
         $title_crop = $product['name'];
         if (strlen($product['name']) > $title_limit) {
             $title_crop = substr($title_crop, 0, $title_limit - 1);
             $title_crop = substr($title_crop, 0, strrpos($title_crop, " "));
         }
         if (intval(Configuration::get('DESCRIPTION')) === intval(2)) {
             $description_crop = $product['description'];
         } else {
             $description_crop = $product['description_short'];
         }
         $description_crop = $this->rip_tags($description_crop);
         if (strlen($description_crop) > $description_limit) {
             $description_crop = substr($description_crop, 0, $description_limit - 1);
             $description_crop = substr($description_crop, 0, strrpos($description_crop, " "));
         }
         $xml_googleshopping .= '<entry>' . "\n";
         $xml_googleshopping .= '<g:id>' . $product['id_product'] . '-' . $lang['iso_code'] . '</g:id>' . "\n";
         $xml_googleshopping .= '<title>' . htmlentities(ucfirst(mb_strtolower($title_crop, self::CHARSET)), self::REPLACE_FLAGS, self::CHARSET) . '</title>' . "\n";
         $xml_googleshopping .= '<link>' . htmlspecialchars($product_link, self::REPLACE_FLAGS, self::CHARSET, false) . '</link>' . "\n";
         $xml_googleshopping .= '<g:price>' . $price . '</g:price>' . "\n";
         $xml_googleshopping .= '<g:description>' . htmlentities($description_crop, self::REPLACE_FLAGS, self::CHARSET) . '</g:description>' . "\n";
         $xml_googleshopping .= '<g:condition>new</g:condition>' . "\n";
         // condition = new, used, refurbished
         $images = Image::getImages($lang['id_lang'], $product['id_product']);
         $indexTabLang = 0;
         if ($tailleTabLang > 1) {
             while (sizeof($images) < 1 && $indexTabLang < $tailleTabLang) {
                 if ($languages[$indexTabLang]['id_lang'] != $lang['id_lang']) {
                     $images = Image::getImages($languages[$indexTabLang]['id_lang'], $product['id_product']);
                 }
                 $indexTabLang++;
             }
         }
         $nbimages = 0;
         $image_type = Configuration::get('GS_IMAGE');
         if ($image_type == '') {
             $image_type = 'large_default';
         }
         /* create image links */
         foreach ($images as $im) {
             $image = $this->context->link->getImageLink($product['link_rewrite'], $product['id_product'] . '-' . $im['id_image'], $image_type);
             $xml_googleshopping .= '<g:image_link>' . $image . '</g:image_link>' . "\n";
             //max images by product
             if (++$nbimages == 10) {
                 break;
             }
         }
         if (Configuration::get('QUANTITY') == 1) {
             $quantity = StockAvailable::getQuantityAvailableByProduct($product['id_product'], 0);
             if ($quantity > 0) {
                 $xml_googleshopping .= '<g:quantity>' . $quantity . '</g:quantity>' . "\n";
                 $xml_googleshopping .= '<g:availability>in stock</g:availability>' . "\n";
             } else {
                 $xml_googleshopping .= '<g:quantity>0</g:quantity>' . "\n";
                 $xml_googleshopping .= '<g:availability>out of stock</g:availability>' . "\n";
             }
         }
         // Brand
         $identifier_exists = false;
         if (Configuration::get('BRAND') && $product['id_manufacturer'] != '0') {
             $xml_googleshopping .= '<g:brand>' . htmlspecialchars(Manufacturer::getNameById(intval($product['id_manufacturer'])), self::REPLACE_FLAGS, self::CHARSET, false) . '</g:brand>' . "\n";
             $identifier_exists = true;
         }
         if (Configuration::get('MPN') && $product['supplier_reference'] != '') {
             $xml_googleshopping .= '<g:mpn>' . $product['supplier_reference'] . '</g:mpn>';
             $identifier_exists = true;
//.........这里部分代码省略.........
开发者ID:ocean123,项目名称:ps_googleshopping,代码行数:101,代码来源:googleshopping.php

示例10: getItemXML

 private function getItemXML($product, $lang, $id_curr, $id_shop, $combination = false)
 {
     $xml_googleshopping = '';
     $id_lang = (int) $lang['id_lang'];
     $title_limit = 70;
     $description_limit = 4990;
     $languages = Language::getLanguages();
     $tailleTabLang = sizeof($languages);
     $this->context->language->id = $id_lang;
     $this->context->shop->id = $id_shop;
     $p = new Product($product['id_product'], true, $id_lang, $id_shop, $this->context);
     // Get module configuration for this shop
     if (!$combination) {
         $product['quantity'] = StockAvailable::getQuantityAvailableByProduct($product['id_product'], 0, $id_shop);
     }
     // Exclude non-available products
     if ($this->module_conf['export_nap'] === 0 && $product['quantity'] < 1) {
         $this->nb_not_exported_products++;
         return;
     }
     // Check minimum product price
     $price = Product::getPriceStatic((int) $product['id_product'], true);
     if ((double) $this->module_conf['export_min_price'] > 0 && (double) $this->module_conf['export_min_price'] > (double) $price) {
         return;
     }
     $cat_link_rew = Category::getLinkRewrite($product['id_gcategory'], (int) $lang);
     $product_link = $this->context->link->getProductLink((int) $product['id_product'], $product['link_rewrite'], $cat_link_rew, $product['ean13'], (int) $product['id_lang'], $id_shop, $combination, true);
     // Product name
     $title_crop = $product['name'];
     //  Product color attribute, if any
     if (!empty($product['color'])) {
         $title_crop .= ' ' . $product['color'];
     }
     if (!empty($product['material'])) {
         $title_crop .= ' ' . $product['material'];
     }
     if (!empty($product['pattern'])) {
         $title_crop .= ' ' . $product['pattern'];
     }
     if (!empty($product['size'])) {
         $title_crop .= ' ' . $product['size'];
     }
     if (Tools::strlen($product['name']) > $title_limit) {
         $title_crop = Tools::substr($title_crop, 0, $title_limit - 1);
         $title_crop = Tools::substr($title_crop, 0, strrpos($title_crop, " "));
     }
     // Description type
     if ($this->module_conf['description'] == 'long') {
         $description_crop = $product['description'];
     } else {
         if ($this->module_conf['description'] == 'short') {
             $description_crop = $product['description_short'];
         } else {
             if ($this->module_conf['description'] == 'meta') {
                 $description_crop = $product['meta_description'];
             }
         }
     }
     $description_crop = $this->rip_tags($description_crop);
     if (Tools::strlen($description_crop) > $description_limit) {
         $description_crop = Tools::substr($description_crop, 0, $description_limit - 1);
         $description_crop = Tools::substr($description_crop, 0, strrpos($description_crop, " ")) . ' ...';
     }
     $xml_googleshopping .= '<item>' . "\n";
     $xml_googleshopping .= '<g:id>' . $product['gid'] . '</g:id>' . "\n";
     $xml_googleshopping .= '<title><![CDATA[' . $title_crop . ']]></title>' . "\n";
     $xml_googleshopping .= '<description><![CDATA[' . $description_crop . ']]></description>' . "\n";
     $xml_googleshopping .= '<link><![CDATA[' . htmlspecialchars($product_link, self::REPLACE_FLAGS, self::CHARSET, false) . ']]></link>' . "\n";
     // Image links
     $images = Image::getImages($lang['id_lang'], $product['id_product'], $combination);
     $indexTabLang = 0;
     if ($tailleTabLang > 1) {
         while (sizeof($images) < 1 && $indexTabLang < $tailleTabLang) {
             if ($languages[$indexTabLang]['id_lang'] != $lang['id_lang']) {
                 $images = Image::getImages($languages[$indexTabLang]['id_lang'], $product['id_product']);
             }
             $indexTabLang++;
         }
     }
     $nbimages = 0;
     $image_type = $this->module_conf['img_type'];
     if ($image_type == '') {
         $image_type = 'large_default';
     }
     foreach ($images as $im) {
         $image = $this->context->link->getImageLink($product['link_rewrite'], $product['id_product'] . '-' . $im['id_image'], $image_type);
         $image = preg_replace('*http://' . Tools::getHttpHost() . '/*', $this->uri, $image);
         if ($im['cover'] == 1) {
             $xml_googleshopping .= '<g:image_link><![CDATA[' . $image . ']]></g:image_link>' . "\n";
         } else {
             $xml_googleshopping .= '<g:additional_image_link><![CDATA[' . $image . ']]></g:additional_image_link>' . "\n";
         }
         // max images by product
         if (++$nbimages == 10) {
             break;
         }
     }
     // Product condition, or category's condition attribute, or its parent one...
     // Product condition = new, used, refurbished
     if (empty($product['condition'])) {
//.........这里部分代码省略.........
开发者ID:ecommercebox,项目名称:gshoppingflux,代码行数:101,代码来源:gshoppingflux.php

示例11: header15

 public function header15($params)
 {
     // get current protocol
     $s = empty($_SERVER["HTTPS"]) ? '' : $_SERVER["HTTPS"] == "on" ? "s" : "";
     $sp = strtolower($_SERVER["SERVER_PROTOCOL"]);
     $protocol = substr($sp, 0, strpos($sp, "/")) . $s;
     // Choose if you have to display open graphs. Only show them on the index, category pages, cms pages, product pages
     if (isset($this->context->controller->php_self)) {
         $og_site_name = Configuration::get('PS_SHOP_NAME');
         $og_type = '';
         // set nothing as default, we will hide og for this case
         $og_image = $this->getCustomImage('indexImage', $protocol);
         // check if a default custom image exists
         switch ($this->context->controller->php_self) {
             case 'index':
                 $og_type = 'website';
                 break;
             case 'best-sales':
                 $og_type = 'website';
                 $og_image = $this->getCustomImage('bestSalesImage', $protocol);
                 break;
             case 'new-products':
                 $og_type = 'website';
                 $og_image = $this->getCustomImage('newProductsImage', $protocol);
                 break;
             case 'prices-drop':
                 $og_type = 'website';
                 $og_image = $this->getCustomImage('priceDropImage', $protocol);
                 break;
             case 'cms':
                 $og_type = 'website';
                 break;
             case 'manufacturer':
                 $og_type = 'website';
                 $id_manufacturer = Tools::getValue('id_manufacturer');
                 // check if a manufacturer logo is set
                 if (file_exists(_PS_MANU_IMG_DIR_ . (int) $id_manufacturer . '.jpg')) {
                     $og_image = $protocol . '://' . Tools::getHttpHost() . __PS_BASE_URI__ . 'img/m/' . (int) $id_manufacturer . '.jpg';
                 } else {
                     if (file_exists(_PS_MANU_IMG_DIR_ . (int) $id_manufacturer . '.png')) {
                         $og_image = $protocol . '://' . Tools::getHttpHost() . __PS_BASE_URI__ . 'img/m/' . (int) $id_manufacturer . '.png';
                     }
                 }
                 break;
             case 'supplier':
                 $og_type = 'website';
                 $id_supplier = Tools::getValue('id_supplier');
                 // check if a manufacturer logo is set
                 if (file_exists(_PS_MANU_IMG_DIR_ . (int) $id_supplier . '.jpg')) {
                     $og_image = $protocol . '://' . Tools::getHttpHost() . __PS_BASE_URI__ . 'img/su/' . (int) $id_supplier . '.jpg';
                 } else {
                     if (file_exists(_PS_MANU_IMG_DIR_ . (int) $id_supplier . '.png')) {
                         $og_image = $protocol . '://' . Tools::getHttpHost() . __PS_BASE_URI__ . 'img/su/' . (int) $id_supplier . '.png';
                     }
                 }
                 break;
             case 'category':
                 $og_type = 'website';
                 $id_category = (int) Tools::getValue('id_category');
                 $category_image_id = $id_category && file_exists(_PS_CAT_IMG_DIR_ . (int) $id_category . '.jpg') ? (int) $id_category : false;
                 $link_rewrite = Category::getLinkRewrite($id_category, $this->context->language->id);
                 $og_image = $this->context->link->getCatImageLink($link_rewrite, $category_image_id, 'category_default');
                 break;
             case 'product':
                 $og_type = 'og:product';
                 $this->assignProductOG();
                 break;
         }
         $this->context->smarty->assign(array('og_type' => $og_type, 'og_image' => $og_image, 'og_site_name' => $og_site_name, 'remove_site_name_title' => Configuration::get('PSOGRAPH_REMOVE_SITE_NAME')));
     }
     return $this->display(__FILE__, 'psograph.tpl');
 }
开发者ID:WhisperingTree,项目名称:etagerca,代码行数:72,代码来源:psograph.php

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

示例13: process

 public function process()
 {
     global $cart, $currency;
     parent::process();
     if (!Validate::isLoadedObject($this->product)) {
         $this->errors[] = Tools::displayError('Product not found');
     } else {
         if (!$this->product->active and Tools::getValue('adtoken') != Tools::encrypt('PreviewProduct' . $this->product->id) || !file_exists(dirname(__FILE__) . '/../' . Tools::getValue('ad') . '/ajax.php')) {
             header('HTTP/1.1 404 page not found');
             $this->errors[] = Tools::displayError('Product is no longer available.');
         } elseif (!$this->product->checkAccess((int) self::$cookie->id_customer)) {
             $this->errors[] = Tools::displayError('You do not have access to this product.');
         } else {
             self::$smarty->assign('virtual', ProductDownload::getIdFromIdProduct((int) $this->product->id));
             if (!$this->product->active) {
                 self::$smarty->assign('adminActionDisplay', true);
             }
             /* Product pictures management */
             require_once 'images.inc.php';
             if ($this->product->customizable) {
                 self::$smarty->assign('customizationFormTarget', Tools::safeOutput(urldecode($_SERVER['REQUEST_URI'])));
                 if (Tools::isSubmit('submitCustomizedDatas')) {
                     $this->pictureUpload($this->product, $cart);
                     $this->textRecord($this->product, $cart);
                     $this->formTargetFormat();
                 } elseif (isset($_GET['deletePicture']) and !$cart->deletePictureToProduct((int) $this->product->id, (int) Tools::getValue('deletePicture'))) {
                     $this->errors[] = Tools::displayError('An error occurred while deleting the selected picture');
                 }
                 $files = self::$cookie->getFamily('pictures_' . (int) $this->product->id);
                 $textFields = self::$cookie->getFamily('textFields_' . (int) $this->product->id);
                 foreach ($textFields as $key => $textField) {
                     $textFields[$key] = str_replace('<br />', "\n", $textField);
                 }
                 self::$smarty->assign(array('pictures' => $files, 'textFields' => $textFields));
             }
             /* Features / Values */
             $features = $this->product->getFrontFeatures((int) self::$cookie->id_lang);
             $attachments = $this->product->cache_has_attachments ? $this->product->getAttachments((int) self::$cookie->id_lang) : array();
             /* Category */
             $category = false;
             if (isset($_SERVER['HTTP_REFERER']) and preg_match('!^(.*)\\/([0-9]+)\\-(.*[^\\.])|(.*)id_category=([0-9]+)(.*)$!', $_SERVER['HTTP_REFERER'], $regs) and !strstr($_SERVER['HTTP_REFERER'], '.html')) {
                 if (isset($regs[2]) and is_numeric($regs[2])) {
                     if (Product::idIsOnCategoryId((int) $this->product->id, array('0' => array('id_category' => (int) $regs[2])))) {
                         $category = new Category((int) $regs[2], (int) self::$cookie->id_lang);
                     }
                 } elseif (isset($regs[5]) and is_numeric($regs[5])) {
                     if (Product::idIsOnCategoryId((int) $this->product->id, array('0' => array('id_category' => (int) $regs[5])))) {
                         $category = new Category((int) $regs[5], (int) self::$cookie->id_lang);
                     }
                 }
             }
             if (!$category) {
                 $category = new Category($this->product->id_category_default, (int) self::$cookie->id_lang);
             }
             if (isset($category) and Validate::isLoadedObject($category)) {
                 self::$smarty->assign(array('path' => Tools::getPath((int) $category->id, $this->product->name, true), 'category' => $category, 'subCategories' => $category->getSubCategories((int) self::$cookie->id_lang, true), 'id_category_current' => (int) $category->id, 'id_category_parent' => (int) $category->id_parent, 'return_category_name' => Tools::safeOutput($category->name)));
             } else {
                 self::$smarty->assign('path', Tools::getPath((int) $this->product->id_category_default, $this->product->name));
             }
             self::$smarty->assign('return_link', (isset($category->id) and $category->id) ? Tools::safeOutput(self::$link->getCategoryLink($category)) : 'javascript: history.back();');
             if (Pack::isPack((int) $this->product->id) and !Pack::isInStock((int) $this->product->id)) {
                 $this->product->quantity = 0;
             }
             $id_customer = (isset(self::$cookie->id_customer) and self::$cookie->id_customer) ? (int) self::$cookie->id_customer : 0;
             $id_group = $id_customer ? (int) Customer::getDefaultGroupId($id_customer) : _PS_DEFAULT_CUSTOMER_GROUP_;
             $id_country = (int) ($id_customer ? Customer::getCurrentCountry($id_customer) : Configuration::get('PS_COUNTRY_DEFAULT'));
             $group_reduction = GroupReduction::getValueForProduct($this->product->id, $id_group);
             if ($group_reduction == 0) {
                 $group_reduction = Group::getReduction((int) self::$cookie->id_customer) / 100;
             }
             // Tax
             $tax = (double) Tax::getProductTaxRate((int) $this->product->id, $cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')});
             self::$smarty->assign('tax_rate', $tax);
             $productPriceWithTax = Product::getPriceStatic($this->product->id, true, NULL, 6);
             if (Product::$_taxCalculationMethod == PS_TAX_INC) {
                 $productPriceWithTax = Tools::ps_round($productPriceWithTax, 2);
             }
             $productPriceWithoutEcoTax = (double) ($productPriceWithTax - $this->product->ecotax);
             $ecotax_rate = (double) Tax::getProductEcotaxRate($cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')});
             $ecotaxTaxAmount = Tools::ps_round($this->product->ecotax, 2);
             if (Product::$_taxCalculationMethod == PS_TAX_INC && (int) Configuration::get('PS_TAX')) {
                 $ecotaxTaxAmount = Tools::ps_round($ecotaxTaxAmount * (1 + $ecotax_rate / 100), 2);
             }
             //usado link
             //init
             $link = new Link();
             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) $this->product->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) $this->product->supplier_reference, $row_us['link_rewrite'], $row['category_used'], $row_us['ean13']);
             //precio mall - distribuidor - lista - internet
             foreach (Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
                             SELECT pa.price
//.........这里部分代码省略.........
开发者ID:ricardo-rdfs,项目名称:Portal-BIP,代码行数:101,代码来源:ProductController.php

示例14: displayFormInformations

    function displayFormInformations($obj, $currency)
    {
        parent::displayForm(false);
        global $currentIndex, $cookie, $link;
        $default_country = new Country((int) Configuration::get('PS_COUNTRY_DEFAULT'));
        $iso = Language::getIsoById((int) $cookie->id_lang);
        $has_attribute = false;
        $qty_state = 'readonly';
        $qty = Attribute::getAttributeQty($this->getFieldValue($obj, 'id_product'));
        if ($qty === false) {
            if (Validate::isLoadedObject($obj)) {
                $qty = $this->getFieldValue($obj, 'quantity');
            } else {
                $qty = 1;
            }
            $qty_state = '';
        } else {
            $has_attribute = true;
        }
        $cover = Product::getCover($obj->id);
        $this->_applyTaxToEcotax($obj);
        echo '
		<div class="tab-page" id="step1">
			<h4 class="tab">1. ' . $this->l('Info.') . '</h4>
			<script type="text/javascript">
				$(document).ready(function() {
					updateCurrentText();
					updateFriendlyURL();
					$.ajax({
						url: "' . dirname($currentIndex) . '/ajax.php",
						cache: false,
						dataType: "json",
						data: "ajaxProductManufacturers=1",
						success: function(j) {
							var options = $("select#id_manufacturer").html();
							if (j)
							for (var i = 0; i < j.length; i++)
								options += \'<option value="\' + j[i].optionValue + \'">\' + j[i].optionDisplay + \'</option>\';
							$("select#id_manufacturer").html(options);
						},
						error: function(XMLHttpRequest, textStatus, errorThrown)
						{
							alert(\'Manufacturer ajax error: \'+textStatus);
						}

					});
					$.ajax({
						url: "' . dirname($currentIndex) . '/ajax.php",
						cache: false,
						dataType: "json",
						data: "ajaxProductSuppliers=1",
						success: function(j) {
							var options = $("select#id_supplier").html();
							if (j)
							for (var i = 0; i < j.length; i++)
								options += \'<option value="\' + j[i].optionValue + \'">\' + j[i].optionDisplay + \'</option>\';
							$("select#id_supplier").html(options);
						},
						error: function(XMLHttpRequest, textStatus, errorThrown)
						{
							alert(\'Supplier ajax error: \'+textStatus);
						}

					});
					if ($(\'#available_for_order\').is(\':checked\')){
						$(\'#show_price\').attr(\'checked\', \'checked\');
						$(\'#show_price\').attr(\'disabled\', \'disabled\');
					}
					else {
						$(\'#show_price\').attr(\'disabled\', \'\');
					}
				});
			</script>
			<b>' . $this->l('Product global information') . '</b>&nbsp;-&nbsp;';
        $preview_url = '';
        if (isset($obj->id)) {
            $preview_url = $link->getProductLink($this->getFieldValue($obj, 'id'), $this->getFieldValue($obj, 'link_rewrite', $this->_defaultFormLanguage), Category::getLinkRewrite($this->getFieldValue($obj, 'id_category_default'), (int) $cookie->id_lang));
            if (!$obj->active) {
                $admin_dir = dirname($_SERVER['PHP_SELF']);
                $admin_dir = substr($admin_dir, strrpos($admin_dir, '/') + 1);
                $token = Tools::encrypt('PreviewProduct' . $obj->id);
                $preview_url .= $obj->active ? '' : '&adtoken=' . $token . '&ad=' . $admin_dir;
            }
            echo '
			<a href="index.php?tab=AdminCatalog&id_product=' . $obj->id . '&deleteproduct&token=' . $this->token . '" style="float:right;"
			onclick="return confirm(\'' . $this->l('Are you sure?', __CLASS__, true, false) . '\');">
			<img src="../img/admin/delete.gif" alt="' . $this->l('Delete this product') . '" title="' . $this->l('Delete this product') . '" /> ' . $this->l('Delete this product') . '</a>
			<a href="' . $preview_url . '" target="_blank"><img src="../img/admin/details.gif" alt="' . $this->l('View product in shop') . '" title="' . $this->l('View product in shop') . '" /> ' . $this->l('View product in shop') . '</a>';
            if (file_exists(_PS_MODULE_DIR_ . 'statsproduct/statsproduct.php')) {
                echo '&nbsp;-&nbsp;<a href="index.php?tab=AdminStats&module=statsproduct&id_product=' . $obj->id . '&token=' . Tools::getAdminToken('AdminStats' . (int) Tab::getIdFromClassName('AdminStats') . (int) $cookie->id_employee) . '"><img src="../modules/statsproduct/logo.gif" alt="' . $this->l('View product sales') . '" title="' . $this->l('View product sales') . '" /> ' . $this->l('View product sales') . '</a>';
            }
        }
        echo '
			<hr class="clear"/>
			<br />
				<table cellpadding="5" style="width: 50%; float: left; margin-right: 20px; border-right: 1px solid #E0D0B1;">
					<tr>
						<td class="col-left">' . $this->l('Name:') . '</td>
						<td style="padding-bottom:5px;" class="translatable">';
        foreach ($this->_languages as $language) {
//.........这里部分代码省略.........
开发者ID:nicolasjeol,项目名称:hec-ecommerce,代码行数:101,代码来源:AdminProducts.php

示例15: getItems

 /**
  * @return array
  */
 public function getItems()
 {
     $categoryItems = array();
     $result = array();
     $exportRootCategories = Configuration::get('SG_EXPORT_ROOT_CATEGORIES') == 1 ? true : false;
     $skippedRootCategories = array();
     foreach (Category::getSimpleCategories($this->getPlugin()->getLanguageId()) as $category) {
         /** @var CategoryCore $categoryInfo */
         $categoryInfo = new Category($category['id_category']);
         $categoryLinkRewrite = $categoryInfo->getLinkRewrite($categoryInfo->id_category, $this->getPlugin()->getLanguageId());
         $isRootCategory = $categoryInfo->is_root_category;
         /**
          * skip root categories
          */
         if ($categoryInfo->is_root_category && !$exportRootCategories) {
             $skippedRootCategories[] = $categoryInfo->id_category;
             continue;
         }
         $categoryItem = array();
         $categoryItem['category_number'] = $categoryInfo->id_category;
         $categoryItem['category_name'] = $categoryInfo->getName($this->getPlugin()->getLanguageId());
         $categoryItem['parent_id'] = $isRootCategory || in_array($categoryInfo->id_category, $skippedRootCategories) ? '' : $categoryInfo->id_parent;
         $categoryItem['is_active'] = $categoryInfo->active;
         $categoryItem['url_deeplink'] = $this->getPlugin()->getContext()->link->getCategoryLink($categoryInfo->id_category, $categoryLinkRewrite, $this->getPlugin()->getLanguageId());
         $categoryImageUrl = $this->getPlugin()->getContext()->link->getCatImageLink($categoryLinkRewrite, $categoryInfo->id_category, sprintf(self::PS_CONST_IMAGE_TYPE_CATEGORY_DEFAULT, '_'));
         $categoryItem['url_image'] = $categoryImageUrl;
         $categoryItem['order_index'] = $categoryInfo->position;
         $categoryItems[] = $categoryItem;
     }
     /**
      * clean root categories
      */
     if (!$exportRootCategories) {
         foreach ($categoryItems as $key => $categoryItem) {
             if (in_array($categoryItem['parent_id'], $skippedRootCategories)) {
                 $categoryItems[$key]['parent_id'] = '';
             }
         }
     }
     $categoryPositionData = array();
     foreach ($categoryItems as $categoryItem) {
         $key = $categoryItem['parent_id'] == '' ? 'root' : $categoryItem['parent_id'];
         if (!array_key_exists($key, $categoryPositionData)) {
             $categoryPositionData[$key] = 0;
         } else {
             $categoryPositionData[$key]++;
         }
     }
     $categoryNewPositionData = array();
     foreach ($categoryItems as $categoryItem) {
         $key = $categoryItem['parent_id'] == '' ? 'root' : $categoryItem['parent_id'];
         if (!array_key_exists($key, $categoryNewPositionData)) {
             $categoryNewPositionData[$key] = 0;
         } else {
             $categoryNewPositionData[$key]++;
         }
         $categoryItem['order_index'] = $categoryPositionData[$key] - $categoryNewPositionData[$key];
         $result[] = $categoryItem;
     }
     return $result;
 }
开发者ID:pankajshoffex,项目名称:shoffex_prestashop,代码行数:64,代码来源:Category.php


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