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


PHP Manufacturer::getNameById方法代码示例

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


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

示例1: getProductLink

 /**
  * Create a link to a product
  *
  * @param mixed $product Product object (can be an ID product, but deprecated)
  * @param string $alias
  * @param string $category
  * @param string $ean13
  * @param int $id_lang
  * @param int $id_shop (since 1.5.0) ID shop need to be used when we generate a product link for a product in a cart
  * @param int $ipa ID product attribute
  * @return string
  */
 public function getProductLink($product, $alias = null, $category = null, $ean13 = null, $id_lang = null, $id_shop = null, $ipa = 0, $force_routes = false, $relative_protocol = false, $add_anchor = false)
 {
     $dispatcher = Dispatcher::getInstance();
     if (!$id_lang) {
         $id_lang = Context::getContext()->language->id;
     }
     $url = $this->getBaseLink($id_shop, null, $relative_protocol) . $this->getLangLink($id_lang, null, $id_shop);
     if (!is_object($product)) {
         if (is_array($product) && isset($product['id_product'])) {
             $product = new Product($product['id_product'], false, $id_lang, $id_shop);
         } elseif ((int) $product) {
             $product = new Product((int) $product, false, $id_lang, $id_shop);
         } else {
             throw new PrestaShopException('Invalid product vars');
         }
     }
     // Set available keywords
     $params = array();
     $params['id'] = $product->id;
     $params['rewrite'] = !$alias ? $product->getFieldByLang('link_rewrite') : $alias;
     $params['ean13'] = !$ean13 ? $product->ean13 : $ean13;
     $params['meta_keywords'] = Tools::str2url($product->getFieldByLang('meta_keywords'));
     $params['meta_title'] = Tools::str2url($product->getFieldByLang('meta_title'));
     if ($dispatcher->hasKeyword('product_rule', $id_lang, 'manufacturer', $id_shop)) {
         $params['manufacturer'] = Tools::str2url($product->isFullyLoaded ? $product->manufacturer_name : Manufacturer::getNameById($product->id_manufacturer));
     }
     if ($dispatcher->hasKeyword('product_rule', $id_lang, 'supplier', $id_shop)) {
         $params['supplier'] = Tools::str2url($product->isFullyLoaded ? $product->supplier_name : Supplier::getNameById($product->id_supplier));
     }
     if ($dispatcher->hasKeyword('product_rule', $id_lang, 'price', $id_shop)) {
         $params['price'] = $product->isFullyLoaded ? $product->price : Product::getPriceStatic($product->id, false, null, 6, null, false, true, 1, false, null, null, null, $product->specificPrice);
     }
     if ($dispatcher->hasKeyword('product_rule', $id_lang, 'tags', $id_shop)) {
         $params['tags'] = Tools::str2url($product->getTags($id_lang));
     }
     if ($dispatcher->hasKeyword('product_rule', $id_lang, 'category', $id_shop)) {
         $params['category'] = !is_null($product->category) && !empty($product->category) ? Tools::str2url($product->category) : Tools::str2url($category);
     }
     if ($dispatcher->hasKeyword('product_rule', $id_lang, 'reference', $id_shop)) {
         $params['reference'] = Tools::str2url($product->reference);
     }
     if ($dispatcher->hasKeyword('product_rule', $id_lang, 'categories', $id_shop)) {
         $params['category'] = !$category ? $product->category : $category;
         $cats = array();
         foreach ($product->getParentCategories($id_lang) as $cat) {
             if (!in_array($cat['id_category'], Link::$category_disable_rewrite)) {
                 //remove root and home category from the URL
                 $cats[] = $cat['link_rewrite'];
             }
         }
         $params['categories'] = implode('/', $cats);
     }
     $anchor = $ipa ? $product->getAnchor((int) $ipa, (bool) $add_anchor) : '';
     return $url . $dispatcher->createUrl('product_rule', $id_lang, $params, $force_routes, $anchor, $id_shop);
 }
开发者ID:jpodracky,项目名称:dogs,代码行数:67,代码来源:Link.php

示例2: elseif

     } elseif (in_array(CAT_HANDBAG, $catIds)) {
         $category = 'Handbag';
     }
     $doc->product_link = $productObj->getLink();
     $idImage = $productObj->getCoverWs();
     if ($idImage) {
         $idImage = $productObj->id . '-' . $idImage;
     } else {
         $idImage = Language::getIsoById(1) . '-default';
     }
     $thickbox_image = $link->getImageLink($productObj->link_rewrite, $idImage, 'thickbox');
     $large_image = $link->getImageLink($productObj->link_rewrite, $idImage, 'large');
     $id_manufacturer = $productObj->id_manufacturer;
     $manufacturer = '';
     if (!empty($id_manufacturer)) {
         $manufacturer = Manufacturer::getNameById($id_manufacturer);
     }
     $productRec = array($id_product, $productObj->reference, $productObj->supplier_reference, $productObj->name, $productObj->getLink(), $productObj->getPriceWithoutReduct(), round($productObj->getPrice()), round($mrp_in_rs), round($offer_price_in_rs), strip_tags($productObj->description), '0', $availability, $manufacturer, $category, $categories, $color, $fabric, (int) $productObj->active === 1 ? 'ACTIVE' : 'INACTIVE', $quantity, $productObj->shipping_sla, $productObj->is_customizable, $large_image, $thickbox_image, date('Y-m-d', strtotime($productObj->date_add)));
     $images = $productObj->getImages(1);
     foreach ($images as $image) {
         $oImage = $link->getImageLink($productObj->link_rewrite, $image['id_image'], 'thickbox');
         if ($thickbox_image !== $oImage) {
             array_push($productRec, $oImage);
         }
     }
     //echo '"'.implode($productRec,'","').'"';
     //echo PHP_EOL;
     fputcsv($outstream, $productRec, ',', '"');
     ob_flush();
     flush();
 }
开发者ID:priyankajsr19,项目名称:shalu,代码行数:31,代码来源:OMS_bkp_new.php

示例3: ajaxCall

 public function ajaxCall()
 {
     //sleep(1);
     global $smarty, $cookie;
     $selectedFilters = $this->getSelectedFilters();
     $id_parent = (int) Tools::getValue('id_category', Tools::getValue('id_category_layered', 1));
     $id_manufacturer = Tools::getValue('id_manufacturer', false);
     $sortInfo = '';
     if (Tools::getValue('orderby') && Tools::getValue('orderway')) {
         $sortInfo = Tools::getProductsOrder('by', Tools::getValue('orderby')) . ':' . Tools::getProductsOrder('way', Tools::getValue('orderway'));
     }
     //echo print_r($selectedFilters);
     //$products = $this->getProductByFilters($selectedFilters);
     $resultSet = $this->getResults($id_parent, $this->search_query, $id_manufacturer, $selectedFilters);
     $products = $resultSet->getData();
     $products = $products['response']['docs'];
     $nbProducts = $resultSet->getNumFound();
     $range = 3;
     /* how many pages around page selected */
     $n = (int) Tools::getValue('n', Configuration::get('PS_PRODUCTS_PER_PAGE'));
     $p = Tools::getValue('p', 1);
     if ($p < 0) {
         $p = 0;
     }
     if ($p > $nbProducts / $n) {
         $p = ceil($nbProducts / $n);
     }
     $pages_nb = ceil($nbProducts / (int) $n);
     $start = (int) ($p - $range);
     if ($start < 1) {
         $start = 1;
     }
     $stop = (int) ($p + $range);
     if ($stop > $pages_nb) {
         $stop = (int) $pages_nb;
     }
     $smarty->assign('nb_products', $nbProducts);
     $pagination_infos = array('pages_nb' => (int) $pages_nb, 'p' => (int) $p, 'n' => (int) $n, 'range' => (int) $range, 'start' => (int) $start, 'stop' => (int) $stop, 'nArray' => $nArray = (int) Configuration::get('PS_PRODUCTS_PER_PAGE') != 10 ? array((int) Configuration::get('PS_PRODUCTS_PER_PAGE'), 10, 20, 50) : array(10, 20, 50));
     $smarty->assign($pagination_infos);
     $smarty->assign('static_token', Tools::getToken(false));
     $smarty->assign('products', $products);
     $category = new Category((int) $id_parent);
     $selectedCategory = $category->getName(1);
     $productsTitle = $this->search_query ? $this->search_query : ($id_manufacturer ? Manufacturer::getNameById($id_manufacturer, 1) : $selectedCategory);
     $smarty->assign('lazy', 0);
     $nextPage = $p + 1;
     if ($p == $stop) {
         $nextPage = 0;
     }
     $smarty->assign('nextPage', $nextPage);
     $autoLoad = Tools::getValue('al', false);
     header('Content-type: application/json');
     if ($cookie->image_size == IMAGE_SIZE_LARGE) {
         $productListContent = $smarty->fetch(_PS_THEME_DIR_ . 'product-list-page.tpl');
     } else {
         $productListContent = $smarty->fetch(_PS_THEME_DIR_ . 'product-list-page-small.tpl');
     }
     if ($autoLoad) {
         $smarty->assign('autoload', 1);
         return Tools::jsonEncode(array('productList' => $productListContent, 'nextPage' => $nextPage));
     } else {
         $smarty->assign('autoload', 0);
         return Tools::jsonEncode(array('filtersBlock' => $this->generateFiltersBlock($selectedFilters), 'productList' => $productListContent, 'pagination' => $smarty->fetch(_PS_THEME_DIR_ . 'pagination.tpl'), 'totalItems' => $nbProducts, 'sortInfo' => $sortInfo, 'productsTitle' => $productsTitle, 'nextPage' => $nextPage));
     }
     //	return '<div id="layered_ajax_column">'.$this->generateFiltersBlock($selectedFilters).'</div><div id="layered_ajax_products">'.$smarty->fetch(_PS_THEME_DIR_.'product-list.tpl').'</div>';
 }
开发者ID:priyankajsr19,项目名称:indusdiva2,代码行数:66,代码来源:blocklayered.php

示例4: displayFormInformations


//.........这里部分代码省略.........
							<input style="float:left;" onclick="toggleDraftWarning(true);showOptions(false);"  type="radio" name="active" id="active_off" value="0" ' . (!$this->getFieldValue($obj, 'active') ? 'checked="checked" ' : '') . '/>
							<label for="active_off" class="t"><img src="../img/admin/disabled.gif" alt="' . $this->l('Disabled') . '" title="' . $this->l('Disabled') . '" style="float:left; padding:0px 5px 0px 5px" />' . $this->l('Disabled') . ($obj->active ? '' : ' (<a href="' . $preview_url . '" alt="" target="_blank">' . $this->l('View product in shop') . '</a>)') . '</label>
						</td>
					</tr>
					<tr id="product_options" ' . (!$obj->active ? 'style="display:none"' : '') . '>
						<td style="vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;">' . $this->l('Options:') . '</td>
						<td style="padding-bottom:5px;">
							<input style="float: left;" type="checkbox" name="available_for_order" id="available_for_order" value="1" ' . ($this->getFieldValue($obj, 'available_for_order') ? 'checked="checked" ' : '') . ' onclick="if ($(this).is(\':checked\')){$(\'#show_price\').attr(\'checked\', \'checked\');$(\'#show_price\').attr(\'disabled\', \'disabled\');}else{$(\'#show_price\').attr(\'disabled\', \'\');}"/>
							<label for="available_for_order" class="t"><img src="../img/admin/products.gif" alt="' . $this->l('available for order') . '" title="' . $this->l('available for order') . '" style="float:left; padding:0px 5px 0px 5px" />' . $this->l('available for order') . '</label>
							<br class="clear" />
							<input style="float: left;" type="checkbox" name="show_price" id="show_price" value="1" ' . ($this->getFieldValue($obj, 'show_price') ? 'checked="checked" ' : '') . ' />
							<label for="show_price" class="t"><img src="../img/admin/gold.gif" alt="' . $this->l('display price') . '" title="' . $this->l('show price') . '" style="float:left; padding:0px 5px 0px 5px" />' . $this->l('show price') . '</label>
							<br class="clear" />
							<input style="float: left;" type="checkbox" name="online_only" id="online_only" value="1" ' . ($this->getFieldValue($obj, 'online_only') ? 'checked="checked" ' : '') . ' />
							<label for="online_only" class="t"><img src="../img/admin/basket_error.png" alt="' . $this->l('online only') . '" title="' . $this->l('online only') . '" style="float:left; padding:0px 5px 0px 5px" />' . $this->l('online only (not sold in store)') . '</label>
						</td>
					</tr>
					<tr>
						<td style="vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;">' . $this->l('Condition:') . '</td>
						<td style="padding-bottom:5px;">
							<select name="condition" id="condition">
								<option value="new" ' . ($obj->condition == 'new' ? 'selected="selected"' : '') . '>' . $this->l('New') . '</option>
								<option value="used" ' . ($obj->condition == 'used' ? 'selected="selected"' : '') . '>' . $this->l('Used') . '</option>
								<option value="refurbished" ' . ($obj->condition == 'refurbished' ? 'selected="selected"' : '') . '>' . $this->l('Refurbished') . '</option>
							</select>
						</td>
					</tr>
					<tr>
						<td style="vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;">' . $this->l('Manufacturer:') . '</td>
						<td style="padding-bottom:5px;">
							<select name="id_manufacturer" id="id_manufacturer">
								<option value="0">-- ' . $this->l('Choose (optional)') . ' --</option>';
        if ($id_manufacturer = $this->getFieldValue($obj, 'id_manufacturer')) {
            echo '				<option value="' . $id_manufacturer . '" selected="selected">' . Manufacturer::getNameById($id_manufacturer) . '</option>
								<option disabled="disabled">----------</option>';
        }
        echo '
							</select>&nbsp;&nbsp;&nbsp;<a href="?tab=AdminManufacturers&addmanufacturer&token=' . Tools::getAdminToken('AdminManufacturers' . (int) Tab::getIdFromClassName('AdminManufacturers') . (int) $cookie->id_employee) . '" onclick="return confirm(\'' . $this->l('Are you sure you want to delete product information entered?', __CLASS__, true, false) . '\');"><img src="../img/admin/add.gif" alt="' . $this->l('Create') . '" title="' . $this->l('Create') . '" /> <b>' . $this->l('Create') . '</b></a>
						</td>
					</tr>
					<tr>
						<td style="vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;">' . $this->l('Supplier:') . '</td>
						<td style="padding-bottom:5px;">
							<select name="id_supplier" id="id_supplier">
								<option value="0">-- ' . $this->l('Choose (optional)') . ' --</option>';
        if ($id_supplier = $this->getFieldValue($obj, 'id_supplier')) {
            echo '				<option value="' . $id_supplier . '" selected="selected">' . Supplier::getNameById($id_supplier) . '</option>
								<option disabled="disabled">----------</option>';
        }
        echo '
							</select>&nbsp;&nbsp;&nbsp;<a href="?tab=AdminSuppliers&addsupplier&token=' . Tools::getAdminToken('AdminSuppliers' . (int) Tab::getIdFromClassName('AdminSuppliers') . (int) $cookie->id_employee) . '" onclick="return confirm(\'' . $this->l('Are you sure you want to delete entered product information?', __CLASS__, true, false) . '\');"><img src="../img/admin/add.gif" alt="' . $this->l('Create') . '" title="' . $this->l('Create') . '" /> <b>' . $this->l('Create') . '</b></a>
						</td>
					</tr>
				</table>
				<div class="clear"></div>
				<table cellpadding="5" style="width: 100%;">
					<tr><td colspan="2"><hr style="width:100%;" /></td></tr>';
        $this->displayPack($obj);
        echo '		<tr><td colspan="2"><hr style="width:100%;" /></td></tr>';
        /*
         * Form for add a virtual product like software, mp3, etc...
         */
        $productDownload = new ProductDownload();
        if ($id_product_download = $productDownload->getIdFromIdProduct($this->getFieldValue($obj, 'id'))) {
            $productDownload = new ProductDownload($id_product_download);
        }
开发者ID:nicolasjeol,项目名称:hec-ecommerce,代码行数:67,代码来源:AdminProducts.php

示例5: view_product_overview


//.........这里部分代码省略.........
         // Detaillink is required for microdata (even when longdesc
         // is empty)
         $detail_url = \Cx\Core\Routing\Url::fromModuleAndCmd('Shop', 'details', FRONTEND_LANG_ID, array('productId' => $objProduct->id()))->toString();
         self::$objTemplate->setVariable('SHOP_PRODUCT_DETAIL_URL', $detail_url);
         if (!$product_id && !empty($longDescription)) {
             $detailLink = '<a href="' . $detail_url . '"' . ' title="' . $_ARRAYLANG['TXT_MORE_INFORMATIONS'] . '">' . $_ARRAYLANG['TXT_MORE_INFORMATIONS'] . '</a>';
             self::$objTemplate->setVariable('SHOP_PRODUCT_DETAILLINK', $detailLink);
         }
         // Check Product flags.
         // Only the meter flag is currently implemented and in use.
         $flagMeter = $objProduct->testFlag('__METER__');
         // Submit button name and function.
         // Calling productOptions() also sets the $flagMultipart variable
         // to the appropriate encoding type for the form if
         // any upload fields are in use.
         $flagMultipart = false;
         $productSubmitName = $productSubmitFunction = '';
         if (isset($_GET['cmd']) && $_GET['cmd'] == 'details' && isset($_GET['referer']) && $_GET['referer'] == 'cart') {
             $productSubmitName = "updateProduct[{$cart_id}]";
             $productSubmitFunction = self::productOptions($id, $formId, $cart_id, $flagMultipart);
         } else {
             $productSubmitName = 'addProduct';
             $productSubmitFunction = self::productOptions($id, $formId, $cart_id, $flagMultipart);
         }
         $shopProductFormName = "shopProductForm{$formId}";
         $row = $formId % 2 + 1;
         self::$objTemplate->setVariable(array('SHOP_ROWCLASS' => 'row' . $row, 'SHOP_PRODUCT_ID' => $objProduct->id(), 'SHOP_PRODUCT_TITLE' => contrexx_raw2xhtml($objProduct->name()), 'SHOP_PRODUCT_DESCRIPTION' => $short, 'SHOP_PRODUCT_DETAILDESCRIPTION' => $longDescription ? $longDescription : $short, 'SHOP_PRODUCT_FORM_NAME' => $shopProductFormName, 'SHOP_PRODUCT_SUBMIT_NAME' => $productSubmitName, 'SHOP_PRODUCT_SUBMIT_FUNCTION' => $productSubmitFunction, 'SHOP_FORM_ENCTYPE' => $flagMultipart ? ' enctype="multipart/form-data"' : '', 'TXT_SHOP_PRODUCT_COUNT' => $flagMeter ? $_ARRAYLANG['TXT_SHOP_PRODUCT_METER'] : $_ARRAYLANG['TXT_SHOP_PRODUCT_COUNT'], 'SHOP_CURRENCY_CODE' => Currency::getActiveCurrencyCode()));
         if ($objProduct->code()) {
             self::$objTemplate->setVariable('SHOP_PRODUCT_CUSTOM_ID', htmlentities($objProduct->code(), ENT_QUOTES, CONTREXX_CHARSET));
         }
         $manufacturer_name = $manufacturer_url = $manufacturer_link = '';
         $manufacturer_id = $objProduct->manufacturer_id();
         if ($manufacturer_id) {
             $manufacturer_name = Manufacturer::getNameById($manufacturer_id, FRONTEND_LANG_ID);
             $manufacturer_url = Manufacturer::getUrlById($manufacturer_id, FRONTEND_LANG_ID);
         }
         if (!empty($manufacturer_url) || !empty($manufacturer_name)) {
             if (empty($manufacturer_name)) {
                 $manufacturer_name = $manufacturer_url;
             }
             if (!empty($manufacturer_url)) {
                 $manufacturer_link = '<a href="' . $manufacturer_url . '">' . $manufacturer_name . '</a>';
             }
             // TODO: Test results for any combination of name and url
             self::$objTemplate->setVariable(array('SHOP_MANUFACTURER_NAME' => $manufacturer_name, 'SHOP_MANUFACTURER_URL' => $manufacturer_url, 'SHOP_MANUFACTURER_LINK' => $manufacturer_link, 'TXT_SHOP_MANUFACTURER_LINK' => $_ARRAYLANG['TXT_SHOP_MANUFACTURER_LINK']));
         }
         // This is the old Product field for the Manufacturer URI.
         // This is now extended by the Manufacturer table and should thus
         // get a new purpose.  As it is product specific, it could be
         // renamed and reused as a link to individual Products!
         $externalLink = $objProduct->uri();
         if (!empty($externalLink)) {
             self::$objTemplate->setVariable(array('SHOP_EXTERNAL_LINK' => '<a href="' . $externalLink . '" title="' . $_ARRAYLANG['TXT_SHOP_EXTERNAL_LINK'] . '" target="_blank">' . $_ARRAYLANG['TXT_SHOP_EXTERNAL_LINK'] . '</a>'));
         }
         if ($price) {
             self::$objTemplate->setGlobalVariable(array('SHOP_PRODUCT_PRICE' => $price, 'SHOP_PRODUCT_PRICE_UNIT' => Currency::getActiveCurrencySymbol()));
         }
         // Only show the discount price if it's actually in use,
         // avoid an "empty <font> tag" HTML warning
         if ($discountPrice) {
             self::$objTemplate->setGlobalVariable(array('SHOP_PRODUCT_DISCOUNTPRICE' => $discountPrice, 'SHOP_PRODUCT_DISCOUNTPRICE_UNIT' => Currency::getActiveCurrencySymbol()));
             if (self::$objTemplate->blockExists('price_discount')) {
                 self::$objTemplate->touchBlock('price_discount');
             }
         } else {
             if (self::$objTemplate->blockExists('price')) {
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:67,代码来源:Shop.class.php

示例6: renderCatalog


//.........这里部分代码省略.........
         }
         $products = Db::getInstance()->executeS($product);
         // merge product with product attribute
         $query = array_merge($products, $combinations);
         if ($this->controller_status == STATUS1) {
             $query = array_splice($query, 0, $stckmgtfr);
         }
         $nb_items = count($query);
         for ($i = 0; $i < $nb_items; ++$i) {
             $item =& $query[$i];
             // gets stock manager
             $manager = StockManagerFactory::getManager();
             // id_product_attribute pour un produit sans déclinaisons
             if (!isset($item['id_product_attribute'])) {
                 $item['id_product_attribute'] = 0;
             }
             // gets quantities and valuation
             $stock = new DbQuery();
             $stock->select('SUM(physical_quantity) as physical_quantity');
             $stock->select('SUM(usable_quantity) as usable_quantity');
             $stock->select('SUM(price_te * physical_quantity) as valuation');
             $stock->from('stock');
             if (Tools::isSubmit('id_warehouse') && Tools::getValue('id_warehouse') != "-1") {
                 $stock->where('id_product =' . (int) $item['id_product'] . ' AND id_product_attribute = ' . (int) $item['id_product_attribute'] . ' AND id_warehouse = ' . (int) $id_warehouse);
             } else {
                 $stock->where('id_product =' . (int) $item['id_product'] . ' AND id_product_attribute = ' . (int) $item['id_product_attribute']);
             }
             $res_stock = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($stock);
             $item['physical_quantity'] = $res_stock['physical_quantity'];
             // real quantity
             if (Tools::isSubmit('id_warehouse') && Tools::getValue('id_warehouse') != "-1") {
                 $item['real_quantity'] = $manager->getProductRealQuantities($item['id_product'], $item['id_product_attribute'], $id_warehouse, true);
             } else {
                 $item['real_quantity'] = $manager->getProductRealQuantities($item['id_product'], $item['id_product_attribute'], null, true);
             }
             // price tax include and tax
             $price = new DbQuery();
             $price->select('rate');
             $price->from('tax', 't');
             $price->innerjoin('tax_rule', 'tr', 'tr.id_tax = t.id_tax');
             $price->where('t.id_tax = ' . (int) $item['id_tax_rules_group']);
             $price->where('tr.id_country = ' . (int) $this->context->country->id);
             $res_price = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($price);
             $item['rate'] = $res_price['rate'];
             // if we are in product
             if (!isset($item['price_attribute'])) {
                 $item['price_ttc'] = $item['price_product'] * ($res_price['rate'] / 100) + $item['price_product'];
             } else {
                 $price = $item['price_product'] + $item['price_attribute'];
                 $item['price_ttc'] = $price * ($res_price['rate'] / 100) + $price;
             }
             // get manufacturer
             $item['manufacturer'] = Manufacturer::getNameById($item['id_manufacturer']);
             // get image product id
             $id_image = Product::getCover((int) $item['id_product']);
             // there is an image ?
             if ($id_image != false) {
                 $image = new Image($id_image['id_image']);
                 $item['url_image'] = _PS_BASE_URL_ . _THEME_PROD_DIR_ . $image->getExistingImgPath() . ".jpg";
             } else {
                 $item['url_image'] = $this->l('No image');
             }
         }
         // BASE CSV HEADER
         $header = array($this->l('PRODUCT_ID_'), $this->l('PRODUCT_ATTRIBUTE_ID'), $this->l('SKU'), $this->l('EAN13'), $this->l('MANUFACTURER'), $this->l('CATEGORY'), $this->l('PRODUCT_NAME'), $this->l('PRODUCT_WEIGHT'), $this->l('DESCRIPTION'), $this->l('DESCRIPTION_SHORT'), $this->l('URL_IMAGE'), $this->l('PHYSICAL_QTE'), $this->l('REAL_QTY'), $this->l('PURCHASE_PRICE'), $this->l('PRICES_TAX_EXCL'), $this->l('PRICES_TAX_INCL'), $this->l('VAT_RATE'));
         // CSV WITH WAREHOUSE LOCATION
         if (Tools::isSubmit('id_warehouse') && Tools::getValue('id_warehouse') != "-1") {
             if ($area != null && $subarea == null) {
                 array_push($header, $this->l('AREA'));
             }
             // filter on area and sub area
             if ($area != null && $subarea != null) {
                 array_push($header, $this->l('AREA'), $this->l('SUBAREA'));
             }
             array_push($header, $this->l('LOCATION'));
         }
         // Print header
         echo implode(';', $header) . "\r\n";
         // generate CSV file
         foreach ($query as $product) {
             if (!isset($product['price_attribute'])) {
                 $product['price_attribute'] = 0;
             }
             $content = array($product['id_product'], $product['id_product_attribute'], $product['reference'], $product['ean13'], $product['manufacturer'], self::transformText($product['category']), self::transformText($product['name']), $product['weight'], self::transformText($product['description']), self::transformText($product['description_short']), self::transformText($product['url_image']), $product['physical_quantity'], $product['real_quantity'], round($product['wholesale_price'], 2), round($product['price_product'] + $product['price_attribute'], 2), round($product['price_ttc'], 2), round($product['rate'], 2));
             if (Tools::isSubmit('id_warehouse') && Tools::getValue('id_warehouse') != "-1") {
                 if ($area != null && $subarea == null) {
                     array_push($content, $product['area']);
                 }
                 // filter on area and sub area
                 if ($area != null && $subarea != null) {
                     array_push($content, $product['area'], $product['subarea']);
                 }
                 array_push($content, $product['location']);
             }
             echo implode(';', $content) . "\r\n";
         }
         echo sprintf($this->l('You are using the free version of 1-Click ERP which limits the export to %d products'), $stckmgtfr);
         die;
     }
 }
开发者ID:prestamodule,项目名称:erpillicopresta,代码行数:101,代码来源:AdminAdvancedStock.php

示例7: displayFormInformations

    function displayFormInformations($obj, $currency, $languages, $defaultLanguage)
    {
        global $currentIndex, $cookie;
        $iso = Language::getIsoById(intval($cookie->id_lang));
        $divLangName = 'cname¤cdesc¤cdesc_short¤clink_rewrite¤cmeta_description¤cmeta_title¤cmeta_keywords¤ctags¤cavailable_now¤cavailable_later';
        $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 = '';
        }
        $cover = Product::getCover($obj->id);
        $link = new Link();
        //includeDatepicker(array('reduction_from', 'reduction_to'));
        echo '
		<div class="tab-page" id="step1">
			<h4 class="tab">1. ' . $this->l('Info.') . '</h4>
			<b>' . $this->l('Product global informations') . '</b>&nbsp;-&nbsp;';
        if (isset($obj->id)) {
            echo '
			<a href="' . $link->getProductLink($this->getFieldValue($obj, 'id'), $this->getFieldValue($obj, 'link_rewrite', $defaultLanguage), Category::getLinkRewrite($this->getFieldValue($obj, 'id_category_default'), intval($cookie->id_lang))) . '"><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=AdminStatsModules&module=statsproduct&id_product=' . $obj->id . '&token=' . Tools::getAdminToken('AdminStatsModules' . intval(Tab::getIdFromClassName('AdminStatsModules')) . intval($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:100%">
					<tr>
						<td class="col-left">' . $this->l('Name:') . '</td>
						<td style="padding-bottom:5px;">';
        foreach ($languages as $language) {
            echo '			<div id="cname_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $defaultLanguage ? 'block' : 'none') . '; float: left;">
								<input size="55" type="text" id="name_' . $language['id_lang'] . '" name="name_' . $language['id_lang'] . '"
								value="' . stripslashes(htmlspecialchars($this->getFieldValue($obj, 'name', $language['id_lang']))) . '"' . (!$obj->id ? ' onkeyup="copy2friendlyURL();"' : '') . ' onchange="updateCurrentText();" /><sup> *</sup>
								<span class="hint" name="help_box">' . $this->l('Invalid characters:') . ' <>;=#{}<span class="hint-pointer">&nbsp;</span></span>
							</div>';
        }
        $this->displayFlags($languages, $defaultLanguage, $divLangName, 'cname');
        echo '<script type="text/javascript">updateCurrentText();</script>
						</td>
					</tr>
					<tr>
						<td style="vertical-align:top">' . $this->l('Status:') . '</td>
						<td style="padding-bottom:5px;">
							<input style="float:left;" type="radio" name="active" id="active_on" value="1" ' . ($this->getFieldValue($obj, 'active') ? 'checked="checked" ' : '') . '/>
							<label for="active_on" class="t"><img src="../img/admin/enabled.gif" alt="' . $this->l('Enabled') . '" title="' . $this->l('Enabled') . '" style="float:left; padding:0px 5px 0px 5px;" />' . $this->l('Enabled') . '</label>
							<br style="clear:both;" />
							<input style="float:left;" type="radio" name="active" id="active_off" value="0" ' . (!$this->getFieldValue($obj, 'active') ? 'checked="checked" ' : '') . '/>
							<label for="active_off" class="t"><img src="../img/admin/disabled.gif" alt="' . $this->l('Disabled') . '" title="' . $this->l('Disabled') . '" style="float:left; padding:0px 5px 0px 5px" />' . $this->l('Disabled') . '</label>
						</td>
					</tr>
					<tr>
						<td>' . $this->l('Manufacturer:') . '</td>
						<td style="padding-bottom:5px;">
							<select name="id_manufacturer" id="id_manufacturer">
								<option value="0">-- ' . $this->l('Choose (optional)') . ' --</option>';
        if ($id_manufacturer = $this->getFieldValue($obj, 'id_manufacturer')) {
            echo '				<option value="' . $id_manufacturer . '" selected="selected">' . Manufacturer::getNameById($id_manufacturer) . '</option>
								<option disabled="disabled">----------</option>';
        }
        echo '
							</select>&nbsp;&nbsp;&nbsp;<a href="?tab=AdminManufacturers&addmanufacturer&token=' . Tools::getAdminToken('AdminManufacturers' . intval(Tab::getIdFromClassName('AdminManufacturers')) . intval($cookie->id_employee)) . '" onclick="return confirm(\'' . $this->l('Are you sure you want to delete entered product information?', __CLASS__, true, false) . '\');"><img src="../img/admin/add.gif" alt="' . $this->l('Create') . '" title="' . $this->l('Create') . '" /> <b>' . $this->l('Create') . '</b></a>
							<script type="text/javascript">
								var ajaxManufacturersClicked = false;
								$("select#id_manufacturer").focus(
									function() {
										if (ajaxManufacturersClicked == true) return; else ajaxManufacturersClicked = true;
										$.getJSON("' . dirname($currentIndex) . '/ajax.php",{ajaxProductManufacturers:1},
											function(j) {
												var options = \'\';
												for (var i = 0; i < getE("id_manufacturer").options.length; i++)
												{
													if (getE("id_manufacturer").options[i].innerHTML == \'----------\')
														options += \'<option disabled="disabled">----------</option>\';
													else
														options += \'<option value="\' +  getE("id_manufacturer").options[i].value + \'">\' + getE("id_manufacturer").options[i].innerHTML + \'</option>\';
												}
												for (var i = 0; i < j.length; i++)
													options += \'<option value="\' + j[i].optionValue + \'">\' + j[i].optionDisplay + \'</option>\';
												$("select#id_manufacturer").html(options);
											}
										)
									}
								);
							</script>
						</td>
					</tr>
					<tr>
						<td>' . $this->l('Supplier:') . '</td>
						<td style="padding-bottom:5px;">
							<select name="id_supplier" id="id_supplier">
								<option value="0">-- ' . $this->l('Choose (optional)') . ' --</option>';
        if ($id_supplier = $this->getFieldValue($obj, 'id_supplier')) {
//.........这里部分代码省略.........
开发者ID:raulgimenez,项目名称:dreamongraphics_shop,代码行数:101,代码来源:AdminProducts.php

示例8: getProductLink

 /**
  * Create a link to a product
  *
  * @param mixed $product Product object (can be an ID product, but deprecated)
  * @param string $alias
  * @param string $category
  * @param string $ean13
  * @param int $id_lang
  * @param int $id_shop (since 1.5.0) ID shop need to be used when we generate a product link for a product in a cart
  * @param int $ipa ID product attribute
  * @return string
  */
 public function getProductLink($product, $alias = null, $category = null, $ean13 = null, $id_lang = null, $id_shop = null, $ipa = 0, $force_routes = false)
 {
     $dispatcher = Dispatcher::getInstance();
     if (!$id_lang) {
         $id_lang = Context::getContext()->language->id;
     }
     if (!$id_shop) {
         $shop = Context::getContext()->shop;
     } else {
         $shop = new Shop($id_shop);
     }
     $url = 'http://' . $shop->domain . $shop->getBaseURI() . $this->getLangLink($id_lang);
     if (!is_object($product)) {
         if (is_array($product) && isset($product['id_product'])) {
             $product = new Product($product['id_product'], false, $id_lang);
         } else {
             if (is_numeric($product) || !$product) {
                 $product = new Product($product, false, $id_lang);
             } else {
                 throw new PrestaShopException('Invalid product vars');
             }
         }
     }
     // Set available keywords
     $params = array();
     $params['id'] = $product->id;
     $params['rewrite'] = !$alias ? $product->getFieldByLang('link_rewrite') : $alias;
     $params['ean13'] = !$ean13 ? $product->ean13 : $ean13;
     $params['category'] = !$category ? $product->category : $category;
     $params['meta_keywords'] = Tools::str2url($product->getFieldByLang('meta_keywords'));
     $params['meta_title'] = Tools::str2url($product->getFieldByLang('meta_title'));
     if ($dispatcher->hasKeyword('product_rule', $id_lang, 'manufacturer')) {
         $params['manufacturer'] = Tools::str2url($product->isFullyLoaded ? $product->manufacturer_name : Manufacturer::getNameById($product->id_manufacturer));
     }
     if ($dispatcher->hasKeyword('product_rule', $id_lang, 'supplier')) {
         $params['supplier'] = Tools::str2url($product->isFullyLoaded ? $product->supplier_name : Supplier::getNameById($product->id_supplier));
     }
     if ($dispatcher->hasKeyword('product_rule', $id_lang, 'price')) {
         $params['price'] = $product->isFullyLoaded ? $product->price : Product::getPriceStatic($product->id, false, null, 6, null, false, true, 1, false, null, null, null, $product->specificPrice);
     }
     if ($dispatcher->hasKeyword('product_rule', $id_lang, 'tags')) {
         $params['tags'] = Tools::str2url($product->getTags($id_lang));
     }
     if ($dispatcher->hasKeyword('product_rule', $id_lang, 'reference')) {
         $params['reference'] = Tools::str2url($product->reference);
     }
     if ($dispatcher->hasKeyword('product_rule', $id_lang, 'categories')) {
         $cats = array();
         foreach ($product->getParentCategories() as $cat) {
             $cats[] = $cat['link_rewrite'];
         }
         $params['categories'] = implode('/', $cats);
     }
     $anchor = $ipa ? $product->getAnchor($ipa) : '';
     return $url . $dispatcher->createUrl('product_rule', $id_lang, $params, $force_routes, $anchor);
 }
开发者ID:jicheng17,项目名称:vipinsg,代码行数:68,代码来源:Link.php

示例9: renderFormAddress

 public function renderFormAddress()
 {
     // Change table and className for addresses
     $this->table = 'address';
     $this->className = 'Address';
     $id_address = Tools::getValue('id_address');
     // Create Object Address
     $address = new Address($id_address);
     $form = array('legend' => array('title' => $this->l('Addresses'), 'image' => '../img/admin/contact.gif'));
     if (!$address->id_manufacturer || !Manufacturer::manufacturerExists($address->id_manufacturer)) {
         $form['input'][] = array('type' => 'select', 'label' => $this->l('Choose the manufacturer:'), 'name' => 'id_manufacturer', 'options' => array('query' => Manufacturer::getManufacturers(), 'id' => 'id_manufacturer', 'name' => 'name'));
     } else {
         $form['input'][] = array('type' => 'text', 'label' => $this->l('Manufacturer:'), 'name' => 'name', 'disabled' => true);
         $form['input'][] = array('type' => 'hidden', 'name' => 'id_manufacturer');
     }
     $form['input'][] = array('type' => 'hidden', 'name' => 'alias');
     $form['input'][] = array('type' => 'text', 'label' => $this->l('Last name:'), 'name' => 'lastname', 'size' => 33, 'required' => true, 'hint' => $this->l('Invalid characters:') . ' 0-9!<>,;?=+()@#"�{}_$%:');
     $form['input'][] = array('type' => 'text', 'label' => $this->l('First name:'), 'name' => 'firstname', 'size' => 33, 'required' => true, 'hint' => $this->l('Invalid characters:') . ' 0-9!<>,;?=+()@#"�{}_$%:');
     $form['input'][] = array('type' => 'text', 'label' => $this->l('Address:'), 'name' => 'address1', 'size' => 33, 'required' => true);
     $form['input'][] = array('type' => 'text', 'label' => $this->l('Address (2):'), 'name' => 'address2', 'size' => 33, 'required' => false);
     $form['input'][] = array('type' => 'text', 'label' => $this->l('Postcode / Zip Code:'), 'name' => 'postcode', 'size' => 33, 'required' => false);
     $form['input'][] = array('type' => 'text', 'label' => $this->l('City:'), 'name' => 'city', 'size' => 33, 'required' => true);
     $form['input'][] = array('type' => 'select', 'label' => $this->l('Country:'), 'name' => 'id_country', 'required' => false, 'default_value' => (int) $this->context->country->id, 'options' => array('query' => Country::getCountries($this->context->language->id), 'id' => 'id_country', 'name' => 'name'));
     $form['input'][] = array('type' => 'select', 'label' => $this->l('State:'), 'name' => 'id_state', 'required' => false, 'options' => array('query' => array(), 'id' => 'id_state', 'name' => 'name'));
     $form['input'][] = array('type' => 'text', 'label' => $this->l('Home phone:'), 'name' => 'phone', 'size' => 33, 'required' => false);
     $form['input'][] = array('type' => 'text', 'label' => $this->l('Mobile phone:'), 'name' => 'phone_mobile', 'size' => 33, 'required' => false);
     $form['input'][] = array('type' => 'textarea', 'label' => $this->l('Other:'), 'name' => 'other', 'cols' => 36, 'rows' => 4, 'required' => false, 'hint' => $this->l('Forbidden characters:') . ' <>;=#{}');
     $form['submit'] = array('title' => $this->l('   Save   '), 'class' => 'button');
     $this->fields_value = array('name' => Manufacturer::getNameById($address->id_manufacturer), 'alias' => 'manufacturer', 'id_country' => Configuration::get('PS_COUNTRY_DEFAULT'));
     $this->initToolbar();
     $this->fields_form[0]['form'] = $form;
     $this->getlanguages();
     $helper = new HelperForm();
     $helper->currentIndex = self::$currentIndex;
     $helper->token = $this->token;
     $helper->table = $this->table;
     $helper->identifier = $this->identifier;
     $helper->title = $this->l('Edit Addresses');
     $helper->id = $address->id;
     $helper->toolbar_scroll = true;
     $helper->languages = $this->_languages;
     $helper->default_form_language = $this->default_form_language;
     $helper->allow_employee_form_lang = $this->allow_employee_form_lang;
     $helper->fields_value = $this->getFieldsValue($address);
     $helper->toolbar_btn = $this->toolbar_btn;
     $this->content .= $helper->generateForm($this->fields_form);
 }
开发者ID:rrameshsat,项目名称:Prestashop,代码行数:47,代码来源:AdminManufacturersController.php

示例10: postProcess

 public function postProcess()
 {
     // If id_order is sent, we instanciate a new Order object
     if (Tools::isSubmit('id_order') && Tools::getValue('id_order') > 0) {
         $order = new Order(Tools::getValue('id_order'));
         if (!Validate::isLoadedObject($order)) {
             throw new PrestaShopException('Can\'t load Order object');
         }
         ShopUrl::cacheMainDomainForShop((int) $order->id_shop);
     }
     /* Update shipping number */
     if (Tools::isSubmit('submitShippingNumber') && isset($order)) {
         if ($this->tabAccess['edit'] === '1') {
             $order_carrier = new OrderCarrier(Tools::getValue('id_order_carrier'));
             if (!Validate::isLoadedObject($order_carrier)) {
                 $this->errors[] = Tools::displayError('The order carrier ID is invalid.');
             } elseif (!Validate::isTrackingNumber(Tools::getValue('tracking_number'))) {
                 $this->errors[] = Tools::displayError('The tracking number is incorrect.');
             } else {
                 // update shipping number
                 // Keep these two following lines for backward compatibility, remove on 1.6 version
                 $order->shipping_number = Tools::getValue('tracking_number');
                 $order->update();
                 //NOX uprav na status SHIPPED (4)
                 $stav_objednavky = $order->getCurrentState();
                 if ($stav_objednavky != 4) {
                     $order->setCurrentState(4);
                 }
                 // Update order_carrier
                 $order_carrier->tracking_number = pSQL(Tools::getValue('tracking_number'));
                 if ($order_carrier->update()) {
                     // Send mail to customer
                     $customer = new Customer((int) $order->id_customer);
                     $carrier = new Carrier((int) $order->id_carrier, $order->id_lang);
                     if (!Validate::isLoadedObject($customer)) {
                         throw new PrestaShopException('Can\'t load Customer object');
                     }
                     if (!Validate::isLoadedObject($carrier)) {
                         throw new PrestaShopException('Can\'t load Carrier object');
                     }
                     //NOX dodatecne udaje do emailu
                     $produkty = $order->getCartProducts();
                     foreach ($produkty as $key => $value) {
                         $nazev .= $value['product_name'] . ", ";
                         $znacka .= Manufacturer::getNameById($value['id_manufacturer']) . " ";
                     }
                     $nazev = substr($nazev, 0, -2);
                     $test = 123;
                     $templateVars = array('{followup}' => str_replace('@', $order->shipping_number, $carrier->url), '{firstname}' => $customer->firstname, '{lastname}' => $customer->lastname, '{id_order}' => $order->id, '{shipping_number}' => $order->shipping_number, '{order_name}' => $order->getUniqReference(), '{nazev_hodinek}' => $nazev, '{znacka}' => $znacka);
                     if (@Mail::Send((int) $order->id_lang, 'in_transit', Mail::l('Package in transit', (int) $order->id_lang), $templateVars, $customer->email, $customer->firstname . ' ' . $customer->lastname, null, null, null, null, _PS_MAIL_DIR_, true, (int) $order->id_shop)) {
                         Hook::exec('actionAdminOrdersTrackingNumberUpdate', array('order' => $order, 'customer' => $customer, 'carrier' => $carrier));
                         Tools::redirectAdmin(self::$currentIndex . '&id_order=' . $order->id . '&vieworder&conf=4&token=' . $this->token);
                     } else {
                         $this->errors[] = Tools::displayError('An error occurred while sending an email to the customer.');
                     }
                 } else {
                     $this->errors[] = Tools::displayError('The order carrier cannot be updated.');
                 }
             }
         } else {
             $this->errors[] = Tools::displayError('You do not have permission to edit this.');
         }
     } elseif (Tools::isSubmit('submitState') && isset($order)) {
         if ($this->tabAccess['edit'] === '1') {
             $order_state = new OrderState(Tools::getValue('id_order_state'));
             if (!Validate::isLoadedObject($order_state)) {
                 $this->errors[] = Tools::displayError('The new order status is invalid.');
             } else {
                 $current_order_state = $order->getCurrentOrderState();
                 if ($current_order_state->id != $order_state->id) {
                     // Create new OrderHistory
                     $history = new OrderHistory();
                     $history->id_order = $order->id;
                     $history->id_employee = (int) $this->context->employee->id;
                     $use_existings_payment = false;
                     if (!$order->hasInvoice()) {
                         $use_existings_payment = true;
                     }
                     $history->changeIdOrderState((int) $order_state->id, $order, $use_existings_payment);
                     $carrier = new Carrier($order->id_carrier, $order->id_lang);
                     $templateVars = array();
                     if ($history->id_order_state == Configuration::get('PS_OS_SHIPPING') && $order->shipping_number) {
                         $templateVars = array('{followup}' => str_replace('@', $order->shipping_number, $carrier->url));
                     }
                     // Save all changes
                     if ($history->addWithemail(true, $templateVars)) {
                         // synchronizes quantities if needed..
                         if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT')) {
                             foreach ($order->getProducts() as $product) {
                                 if (StockAvailable::dependsOnStock($product['product_id'])) {
                                     StockAvailable::synchronize($product['product_id'], (int) $product['id_shop']);
                                 }
                             }
                         }
                         Tools::redirectAdmin(self::$currentIndex . '&id_order=' . (int) $order->id . '&vieworder&token=' . $this->token);
                     }
                     $this->errors[] = Tools::displayError('An error occurred while changing order status, or we were unable to send an email to the customer.');
                 } else {
                     $this->errors[] = Tools::displayError('The order has already been assigned this status.');
                 }
//.........这里部分代码省略.........
开发者ID:h0n24,项目名称:leodig,代码行数:101,代码来源:AdminOrdersController.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: getItemXML


//.........这里部分代码省略.........
         } elseif ($p->isAvailableWhenOutOfStock((int) $p->out_of_stock) && $product['available_for_order']) {
             $xml_googleshopping .= '<g:availability>preorder</g:availability>' . "\n";
         } else {
             $xml_googleshopping .= '<g:availability>out of stock</g:availability>' . "\n";
         }
     } else {
         if ($this->module_conf['quantity'] == 1 && $product['quantity'] > 0) {
             $xml_googleshopping .= '<g:quantity>' . $product['quantity'] . '</g:quantity>' . "\n";
         }
         $xml_googleshopping .= '<g:availability>' . $this->categories_values[$product['category_default']]['gcat_avail'] . '</g:availability>' . "\n";
     }
     // Price(s)
     $currency = new Currency((int) $id_curr);
     $use_tax = $product['tax_included'] ? true : false;
     $no_tax = !$use_tax ? true : false;
     $product['price'] = (double) $p->getPriceStatic($product['id_product'], $use_tax, $combination) * $currency->conversion_rate;
     $product['price_without_reduct'] = (double) $p->getPriceWithoutReduct($no_tax, $combination) * $currency->conversion_rate;
     $product['price'] = number_format(round($product['price'], 2, PHP_ROUND_HALF_DOWN), 2, '.', ' ');
     $product['price_without_reduct'] = number_format(round($product['price_without_reduct'], 2, PHP_ROUND_HALF_DOWN), 2, '.', ' ');
     if ((double) $product['price'] < (double) $product['price_without_reduct']) {
         $xml_googleshopping .= '<g:price>' . $product['price_without_reduct'] . ' ' . $currency->iso_code . '</g:price>' . "\n";
         $xml_googleshopping .= '<g:sale_price>' . $product['price'] . ' ' . $currency->iso_code . '</g:sale_price>' . "\n";
     } else {
         $xml_googleshopping .= '<g:price>' . $product['price'] . ' ' . $currency->iso_code . '</g:price>' . "\n";
     }
     $identifier_exists = 0;
     // GTIN (EAN, UPC, JAN, ISBN)
     if (!empty($product['ean13'])) {
         $xml_googleshopping .= '<g:gtin>' . $product['ean13'] . '</g:gtin>' . "\n";
         $identifier_exists++;
     }
     // Brand
     if ($this->module_conf['no_brand'] != 0 && !empty($product['id_manufacturer'])) {
         $xml_googleshopping .= '<g:brand><![CDATA[' . htmlspecialchars(Manufacturer::getNameById((int) $product['id_manufacturer']), self::REPLACE_FLAGS, self::CHARSET, false) . ']]></g:brand>' . "\n";
         $identifier_exists++;
     }
     // MPN
     if (empty($product['supplier_reference'])) {
         $product['supplier_reference'] = ProductSupplier::getProductSupplierReference($product['id_product'], 0, $product['id_supplier']);
     }
     if ($this->module_conf['mpn_type'] == 'reference' && !empty($product['reference'])) {
         $xml_googleshopping .= '<g:mpn><![CDATA[' . $product['reference'] . ']]></g:mpn>' . "\n";
         $identifier_exists++;
     } else {
         if ($this->module_conf['mpn_type'] == 'supplier_reference' && !empty($product['supplier_reference'])) {
             $xml_googleshopping .= '<g:mpn><![CDATA[' . $product['supplier_reference'] . ']]></g:mpn>' . "\n";
             $identifier_exists++;
         }
     }
     // Tag "identifier_exists"
     if ($this->module_conf['id_exists_tag'] && $identifier_exists < 2) {
         $xml_googleshopping .= '<g:identifier_exists>FALSE</g:identifier_exists>' . "\n";
     }
     // Product gender and age_group attributes association
     $product_features = $this->getProductFeatures($product['id_product'], $id_lang, $id_shop);
     $product['gender'] = $this->categories_values[$product['category_default']]['gcat_gender'];
     $product['age_group'] = $this->categories_values[$product['category_default']]['gcat_age_group'];
     foreach ($product_features as $feature) {
         switch ($feature['id_feature']) {
             case $this->module_conf['gender']:
                 $product['gender'] = $feature['value'];
                 continue 2;
             case $this->module_conf['age_group']:
                 $product['age_group'] = $feature['value'];
                 continue 2;
         }
开发者ID:ecommercebox,项目名称:gshoppingflux,代码行数:67,代码来源:gshoppingflux.php

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

示例14: _getEbayDescription

 private static function _getEbayDescription($product, $ebay_profile, $id_lang)
 {
     $features_html = '';
     foreach ($product->getFrontFeatures((int) $id_lang) as $feature) {
         $features_html .= '<b>' . $feature['name'] . '</b> : ' . $feature['value'] . '<br/>';
     }
     return str_replace(array('{DESCRIPTION_SHORT}', '{DESCRIPTION}', '{FEATURES}', '{EBAY_IDENTIFIER}', '{EBAY_SHOP}', '{SLOGAN}', '{PRODUCT_NAME}', '{REFERENCE}', '{BRAND}', '{BRAND_ID}'), array($product->description_short, $product->description, $features_html, $ebay_profile->ebay_user_identifier, $ebay_profile->getConfiguration('EBAY_SHOP'), '', $product->name, $product->reference, Manufacturer::getNameById($product->id_manufacturer), $product->id_manufacturer), $ebay_profile->getConfiguration('EBAY_PRODUCT_TEMPLATE'));
 }
开发者ID:poonc,项目名称:ebay,代码行数:8,代码来源:EbaySynchronizer.php

示例15: getWsManufacturerName

 public function getWsManufacturerName()
 {
     return Manufacturer::getNameById((int) $this->id_manufacturer);
 }
开发者ID:srikanthash09,项目名称:codetestdatld,代码行数:4,代码来源:Product.php


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