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


PHP Supplier::getNameById方法代码示例

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


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

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

示例2: 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)
 {
     $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() 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($ipa) : '';
     return $url . $dispatcher->createUrl('product_rule', $id_lang, $params, $force_routes, $anchor, $id_shop);
 }
开发者ID:ecssjapan,项目名称:guiding-you-afteropen,代码行数:67,代码来源:Link.php

示例3: getProductManufacturer

 /**
  * @param \Product $product
  *
  * @return mixed
  * @throws \Exception
  * @author Panagiotis Vagenas <pan.vagenas@gmail.com>
  * @since 150213
  */
 protected function getProductManufacturer(\Product &$product)
 {
     $option = $this->Options->getValue('map_manufacturer');
     return $option == 0 ? $product->getWsManufacturerName() : \Supplier::getNameById($product->id_supplier);
 }
开发者ID:panvagenas,项目名称:prestashop-skroutz-xml-feed,代码行数:13,代码来源:Skroutz.php

示例4: supplyOrdersImportOne

 protected function supplyOrdersImportOne($info, $force_ids, $current_line, $validateOnly = false)
 {
     // sets default values if needed
     AdminImportController::setDefaultValues($info);
     // if an id is set, instanciates a supply order with this id if possible
     if (array_key_exists('id', $info) && (int) $info['id'] && SupplyOrder::exists((int) $info['id'])) {
         $supply_order = new SupplyOrder((int) $info['id']);
     } elseif (array_key_exists('reference', $info) && $info['reference'] && SupplyOrder::exists(pSQL($info['reference']))) {
         $supply_order = SupplyOrder::getSupplyOrderByReference(pSQL($info['reference']));
     } else {
         // new supply order
         $supply_order = new SupplyOrder();
     }
     // gets parameters
     $id_supplier = (int) $info['id_supplier'];
     $id_lang = (int) $info['id_lang'];
     $id_warehouse = (int) $info['id_warehouse'];
     $id_currency = (int) $info['id_currency'];
     $reference = pSQL($info['reference']);
     $date_delivery_expected = pSQL($info['date_delivery_expected']);
     $discount_rate = (double) $info['discount_rate'];
     $is_template = (bool) $info['is_template'];
     $error = '';
     // checks parameters
     if (!Supplier::supplierExists($id_supplier)) {
         $error = sprintf($this->l('Supplier ID (%d) is not valid (at line %d).'), $id_supplier, $current_line + 1);
     }
     if (!Language::getLanguage($id_lang)) {
         $error = sprintf($this->l('Lang ID (%d) is not valid (at line %d).'), $id_lang, $current_line + 1);
     }
     if (!Warehouse::exists($id_warehouse)) {
         $error = sprintf($this->l('Warehouse ID (%d) is not valid (at line %d).'), $id_warehouse, $current_line + 1);
     }
     if (!Currency::getCurrency($id_currency)) {
         $error = sprintf($this->l('Currency ID (%d) is not valid (at line %d).'), $id_currency, $current_line + 1);
     }
     if (empty($supply_order->reference) && SupplyOrder::exists($reference)) {
         $error = sprintf($this->l('Reference (%s) already exists (at line %d).'), $reference, $current_line + 1);
     }
     if (!empty($supply_order->reference) && ($supply_order->reference != $reference && SupplyOrder::exists($reference))) {
         $error = sprintf($this->l('Reference (%s) already exists (at line %d).'), $reference, $current_line + 1);
     }
     if (!Validate::isDateFormat($date_delivery_expected)) {
         $error = sprintf($this->l('Date format (%s) is not valid (at line %d). It should be: %s.'), $date_delivery_expected, $current_line + 1, $this->l('YYYY-MM-DD'));
     } elseif (new DateTime($date_delivery_expected) <= new DateTime('yesterday')) {
         $error = sprintf($this->l('Date (%s) cannot be in the past (at line %d). Format: %s.'), $date_delivery_expected, $current_line + 1, $this->l('YYYY-MM-DD'));
     }
     if ($discount_rate < 0 || $discount_rate > 100) {
         $error = sprintf($this->l('Discount rate (%d) is not valid (at line %d). %s.'), $discount_rate, $current_line + 1, $this->l('Format: Between 0 and 100'));
     }
     if ($supply_order->id > 0 && !$supply_order->isEditable()) {
         $error = sprintf($this->l('Supply Order (%d) is not editable (at line %d).'), $supply_order->id, $current_line + 1);
     }
     // if no errors, sets supply order
     if (empty($error)) {
         // adds parameters
         $info['id_ref_currency'] = (int) Currency::getDefaultCurrency()->id;
         $info['supplier_name'] = pSQL(Supplier::getNameById($id_supplier));
         if ($supply_order->id > 0) {
             $info['id_supply_order_state'] = (int) $supply_order->id_supply_order_state;
             $info['id'] = (int) $supply_order->id;
         } else {
             $info['id_supply_order_state'] = 1;
         }
         // sets parameters
         AdminImportController::arrayWalk($info, array('AdminImportController', 'fillInfo'), $supply_order);
         // updatesd($supply_order);
         $res = false;
         if ((int) $supply_order->id && ($supply_order->exists((int) $supply_order->id) || $supply_order->exists($supply_order->reference))) {
             $res = $validateOnly || $supply_order->update();
         } else {
             $supply_order->force_id = (bool) $force_ids;
             $res = $validateOnly || $supply_order->add();
         }
         // errors
         if (!$res) {
             $this->errors[] = sprintf($this->l('Supply Order could not be saved (at line %d).'), $current_line + 1);
         }
     } else {
         $this->errors[] = $error;
     }
 }
开发者ID:M03G,项目名称:PrestaShop,代码行数:82,代码来源:AdminImportController.php

示例5: __construct

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

示例6: __construct

 public function __construct($id_product = NULL, $full = false, $id_lang = NULL, $from_cache = TRUE)
 {
     global $cart;
     parent::__construct($id_product, $id_lang, $from_cache);
     if ($full and $this->id) {
         $this->tax_name = 'deprecated';
         // The applicable tax may be BOTH the product one AND the state one (moreover this variable is some deadcode)
         $this->manufacturer_name = Manufacturer::getNameById((int) $this->id_manufacturer);
         $this->supplier_name = Supplier::getNameById((int) $this->id_supplier);
         self::$_tax_rules_group[$this->id] = $this->id_tax_rules_group;
         if (is_object($cart) and $cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')} != NULL) {
             $this->tax_rate = Tax::getProductTaxRate($this->id, $cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')});
         } else {
             $this->tax_rate = Tax::getProductTaxRate($this->id, NULL);
         }
         $this->new = $this->isNew();
         $this->price = Product::getPriceStatic((int) $this->id, false, NULL, 6, NULL, false, true, 1, false, NULL, NULL, NULL, $this->specificPrice);
         $this->unit_price = $this->unit_price_ratio != 0 ? $this->price / $this->unit_price_ratio : 0;
         if ($this->id) {
             $this->tags = Tag::getProductTags((int) $this->id);
         }
         $features = $this->getFrontFeatures($id_lang);
         foreach ($features as $row) {
             if ($row['id_feature'] == 1) {
                 $this->fabric = $row['value'];
             }
             if ($row['id_feature'] == 2) {
                 $this->color = $row['value'];
             }
             if ($row['id_feature'] == 3) {
                 $this->garment_type = $row['value'];
             }
             if ($row['id_feature'] == 4) {
                 $this->work_type = $row['value'];
             }
             if ($row['id_feature'] == 5) {
                 $this->blouse_length = $row['value'];
             }
             if ($row['id_feature'] == 6) {
                 $this->wash_care = $row['value'];
             }
             if ($row['id_feature'] == 7) {
                 $this->other_info = $row['value'];
             }
             if ($row['id_feature'] == 8) {
                 $this->shipping_estimate = $row['value'];
                 $this->shipping_sla = (int) preg_replace('/\\D/', '', $this->shipping_estimate);
             }
             if ($row['id_feature'] == 9) {
                 $this->kameez_style = $row['value'];
             }
             if ($row['id_feature'] == 10) {
                 $this->salwar_style = $row['value'];
             }
             if ($row['id_feature'] == 11) {
                 $this->sleeves = $row['value'];
             }
             if ($row['id_feature'] == 12) {
                 $this->generic_color = $row['value'];
             }
             if ($row['id_feature'] == 13) {
                 $this->skirt_length = $row['value'];
             }
             if ($row['id_feature'] == 14) {
                 $this->dupatta_length = $row['value'];
             }
             if ($row['id_feature'] == 15) {
                 $this->stone = $row['value'];
             }
             if ($row['id_feature'] == 16) {
                 $this->plating = $row['value'];
             }
             if ($row['id_feature'] == 17) {
                 $this->material = $row['value'];
             }
             if ($row['id_feature'] == 18) {
                 $this->dimensions = $row['value'];
             }
             if ($row['id_feature'] == 19) {
                 $this->look = $row['value'];
             }
             if ($row['id_feature'] == 21) {
                 $this->handbag_occasion = $row['value'];
             }
             if ($row['id_feature'] == 22) {
                 $this->handbag_style = $row['value'];
             }
             if ($row['id_feature'] == 23) {
                 $this->handbag_material = $row['value'];
             }
         }
     }
     if ($this->id_category_default) {
         $this->category = Category::getLinkRewrite((int) $this->id_category_default, (int) $id_lang);
     }
 }
开发者ID:priyankajsr19,项目名称:shalu,代码行数:96,代码来源:Product.php

示例7: postProcess

 /**
  * AdminController::postProcess() override
  * @see AdminController::postProcess()
  */
 public function postProcess()
 {
     $this->is_editing_order = false;
     // Checks access
     if (Tools::isSubmit('submitAddsupply_order') && !($this->tabAccess['add'] === '1')) {
         $this->errors[] = Tools::displayError('You do not have permission to add a supply order.');
     }
     if (Tools::isSubmit('submitBulkUpdatesupply_order_detail') && !($this->tabAccess['edit'] === '1')) {
         $this->errors[] = Tools::displayError('You do not have permission to edit an order.');
     }
     // Trick to use both Supply Order as template and actual orders
     if (Tools::isSubmit('is_template')) {
         $_GET['mod'] = 'template';
     }
     // checks if supply order reference is unique
     if (Tools::isSubmit('reference')) {
         // gets the reference
         $ref = pSQL(Tools::getValue('reference'));
         if (Tools::getValue('id_supply_order') != 0 && SupplyOrder::getReferenceById((int) Tools::getValue('id_supply_order')) != $ref) {
             if ((int) SupplyOrder::exists($ref) != 0) {
                 $this->errors[] = Tools::displayError('The reference has to be unique.');
             }
         } elseif (Tools::getValue('id_supply_order') == 0 && (int) SupplyOrder::exists($ref) != 0) {
             $this->errors[] = Tools::displayError('The reference has to be unique.');
         }
     }
     if ($this->errors) {
         return;
     }
     // Global checks when add / update a supply order
     if (Tools::isSubmit('submitAddsupply_order') || Tools::isSubmit('submitAddsupply_orderAndStay')) {
         $this->action = 'save';
         $this->is_editing_order = true;
         // get supplier ID
         $id_supplier = (int) Tools::getValue('id_supplier', 0);
         if ($id_supplier <= 0 || !Supplier::supplierExists($id_supplier)) {
             $this->errors[] = Tools::displayError('The selected supplier is not valid.');
         }
         // get warehouse id
         $id_warehouse = (int) Tools::getValue('id_warehouse', 0);
         if ($id_warehouse <= 0 || !Warehouse::exists($id_warehouse)) {
             $this->errors[] = Tools::displayError('The selected warehouse is not valid.');
         }
         // get currency id
         $id_currency = (int) Tools::getValue('id_currency', 0);
         if ($id_currency <= 0 || (!($result = Currency::getCurrency($id_currency)) || empty($result))) {
             $this->errors[] = Tools::displayError('The selected currency is not valid.');
         }
         // get delivery date
         if (Tools::getValue('mod') != 'template' && strtotime(Tools::getValue('date_delivery_expected')) <= strtotime('-1 day')) {
             $this->errors[] = Tools::displayError('The specified date cannot be in the past.');
         }
         // gets threshold
         $quantity_threshold = Tools::getValue('load_products');
         if (is_numeric($quantity_threshold)) {
             $quantity_threshold = (int) $quantity_threshold;
         } else {
             $quantity_threshold = null;
         }
         if (!count($this->errors)) {
             // forces date for templates
             if (Tools::isSubmit('is_template') && !Tools::getValue('date_delivery_expected')) {
                 $_POST['date_delivery_expected'] = date('Y-m-d h:i:s');
             }
             // specify initial state
             $_POST['id_supply_order_state'] = 1;
             //defaut creation state
             // specify global reference currency
             $_POST['id_ref_currency'] = Currency::getDefaultCurrency()->id;
             // specify supplier name
             $_POST['supplier_name'] = Supplier::getNameById($id_supplier);
             //specific discount check
             $_POST['discount_rate'] = (double) str_replace(array(' ', ','), array('', '.'), Tools::getValue('discount_rate', 0));
         }
         // manage each associated product
         $this->manageOrderProducts();
         // if the threshold is defined and we are saving the order
         if (Tools::isSubmit('submitAddsupply_order') && Validate::isInt($quantity_threshold)) {
             $this->loadProducts((int) $quantity_threshold);
         }
     }
     // Manage state change
     if (Tools::isSubmit('submitChangestate') && Tools::isSubmit('id_supply_order') && Tools::isSubmit('id_supply_order_state')) {
         if ($this->tabAccess['edit'] != '1') {
             $this->errors[] = Tools::displayError('You do not have permission to change the order status.');
         }
         // get state ID
         $id_state = (int) Tools::getValue('id_supply_order_state', 0);
         if ($id_state <= 0) {
             $this->errors[] = Tools::displayError('The selected supply order status is not valid.');
         }
         // get supply order ID
         $id_supply_order = (int) Tools::getValue('id_supply_order', 0);
         if ($id_supply_order <= 0) {
             $this->errors[] = Tools::displayError('The supply order ID is not valid.');
         }
//.........这里部分代码省略.........
开发者ID:zangles,项目名称:lennyba,代码行数:101,代码来源:AdminSupplyOrdersController.php

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

示例9: __construct

 public function __construct($id_product = null, $full = false, $id_lang = null, $id_shop = null, Context $context = null)
 {
     parent::__construct($id_product, $id_lang, $id_shop);
     if (!$context) {
         $context = Context::getContext();
     }
     if ($full && $this->id) {
         $this->isFullyLoaded = $full;
         $this->tax_name = 'deprecated';
         // The applicable tax may be BOTH the product one AND the state one (moreover this variable is some deadcode)
         $this->manufacturer_name = Manufacturer::getNameById((int) $this->id_manufacturer);
         $this->supplier_name = Supplier::getNameById((int) $this->id_supplier);
         $address = null;
         if (is_object($context->cart) && $context->cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')} != null) {
             $address = $context->cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')};
         }
         $this->tax_rate = $this->getTaxesRate(new Address($address));
         $this->new = $this->isNew();
         $this->price = Product::getPriceStatic((int) $this->id, false, null, 6, null, false, true, 1, false, null, null, null, $this->specificPrice);
         $this->unit_price = $this->unit_price_ratio != 0 ? $this->price / $this->unit_price_ratio : 0;
         if ($this->id) {
             $this->tags = Tag::getProductTags((int) $this->id);
         }
         $this->loadStockData();
     }
     if ($this->id_category_default) {
         $this->category = Category::getLinkRewrite((int) $this->id_category_default, (int) $id_lang);
     }
 }
开发者ID:jicheng17,项目名称:vipinsg,代码行数:29,代码来源:Product.php

示例10: supplyOrdersImport

 /**
  * @since 1.5.0
  */
 public function supplyOrdersImport()
 {
     // opens CSV & sets locale
     $this->receiveTab();
     $handle = $this->openCsvFile();
     AdminImportController::setLocale();
     // main loop, for each supply orders to import
     for ($current_line = 0; $line = fgetcsv($handle, MAX_LINE_SIZE, $this->separator); ++$current_line) {
         // if convert requested
         if (Tools::getValue('convert')) {
             $line = $this->utf8EncodeArray($line);
         }
         $info = AdminImportController::getMaskedRow($line);
         // sets default values if needed
         AdminImportController::setDefaultValues($info);
         // if an id is set, instanciates a supply order with this id if possible
         if (array_key_exists('id', $info) && (int) $info['id'] && SupplyOrder::exists((int) $info['id'])) {
             $supply_order = new SupplyOrder((int) $info['id']);
         } elseif (array_key_exists('reference', $info) && $info['reference'] && SupplyOrder::exists(pSQL($info['reference']))) {
             $supply_order = SupplyOrder::getSupplyOrderByReference(pSQL($info['reference']));
         } else {
             // new supply order
             $supply_order = new SupplyOrder();
         }
         // gets parameters
         $id_supplier = (int) $info['id_supplier'];
         $id_lang = (int) $info['id_lang'];
         $id_warehouse = (int) $info['id_warehouse'];
         $id_currency = (int) $info['id_currency'];
         $reference = pSQL($info['reference']);
         $date_delivery_expected = pSQL($info['date_delivery_expected']);
         $discount_rate = (double) $info['discount_rate'];
         $is_template = (bool) $info['is_template'];
         $error = '';
         // checks parameters
         if (!Supplier::supplierExists($id_supplier)) {
             $error = sprintf($this->l('Supplier ID (%d) is not valid (at line %d).'), $id_supplier, $current_line + 1);
         }
         if (!Language::getLanguage($id_lang)) {
             $error = sprintf($this->l('Lang ID (%d) is not valid (at line %d).'), $id_lang, $current_line + 1);
         }
         if (!Warehouse::exists($id_warehouse)) {
             $error = sprintf($this->l('Warehouse ID (%d) is not valid (at line %d).'), $id_warehouse, $current_line + 1);
         }
         if (!Currency::getCurrency($id_currency)) {
             $error = sprintf($this->l('Currency ID (%d) is not valid (at line %d).'), $id_currency, $current_line + 1);
         }
         if (empty($supply_order->reference) && SupplyOrder::exists($reference)) {
             $error = sprintf($this->l('Reference (%s) already exists (at line %d).'), $reference, $current_line + 1);
         }
         if (!empty($supply_order->reference) && ($supply_order->reference != $reference && SupplyOrder::exists($reference))) {
             $error = sprintf($this->l('Reference (%s) already exists (at line %d).'), $reference, $current_line + 1);
         }
         if (!Validate::isDateFormat($date_delivery_expected)) {
             $error = sprintf($this->l('Date (%s) is not valid (at line %d). Format: %s.'), $date_delivery_expected, $current_line + 1, $this->l('YYYY-MM-DD'));
         } elseif (new DateTime($date_delivery_expected) <= new DateTime('yesterday')) {
             $error = sprintf($this->l('Date (%s) cannot be in the past (at line %d). Format: %s.'), $date_delivery_expected, $current_line + 1, $this->l('YYYY-MM-DD'));
         }
         if ($discount_rate < 0 || $discount_rate > 100) {
             $error = sprintf($this->l('Discount rate (%d) is not valid (at line %d). %s.'), $discount_rate, $current_line + 1, $this->l('Format: Between 0 and 100'));
         }
         if ($supply_order->id > 0 && !$supply_order->isEditable()) {
             $error = sprintf($this->l('Supply Order (%d) is not editable (at line %d).'), $supply_order->id, $current_line + 1);
         }
         // if no errors, sets supply order
         if (empty($error)) {
             // adds parameters
             $info['id_ref_currency'] = (int) Currency::getDefaultCurrency()->id;
             $info['supplier_name'] = pSQL(Supplier::getNameById($id_supplier));
             if ($supply_order->id > 0) {
                 $info['id_supply_order_state'] = (int) $supply_order->id_supply_order_state;
                 $info['id'] = (int) $supply_order->id;
             } else {
                 $info['id_supply_order_state'] = 1;
             }
             // sets parameters
             AdminImportController::arrayWalk($info, array('AdminImportController', 'fillInfo'), $supply_order);
             // updatesd($supply_order);
             $res = true;
             if ((int) $supply_order->id && ($supply_order->exists((int) $supply_order->id) || $supply_order->exists($supply_order->reference))) {
                 $res &= $supply_order->update();
             } else {
                 $supply_order->force_id = (bool) Tools::getValue('forceIDs');
                 $res &= $supply_order->add();
             }
             // errors
             if (!$res) {
                 $this->errors[] = sprintf($this->l('Supply Order could not be saved (at line %d).'), $current_line + 1);
             }
         } else {
             $this->errors[] = $error;
         }
     }
     // closes
     $this->closeCsvFile($handle);
 }
开发者ID:ecssjapan,项目名称:guiding-you-afteropen,代码行数:99,代码来源:AdminImportController.php

示例11: __construct

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

示例12: postProcess

 /**
  * AdminController::postProcess() override
  * @see AdminController::postProcess()
  */
 public function postProcess()
 {
     $this->is_editing_order = false;
     // Checks access
     if (Tools::isSubmit('submitAddsupply_order') && !($this->tabAccess['add'] === '1')) {
         $this->errors[] = Tools::displayError($this->l('You do not have permission to add a supply order.'));
     }
     if (Tools::isSubmit('submitBulkUpdatesupply_order_detail') && !($this->tabAccess['edit'] === '1')) {
         $this->errors[] = Tools::displayError($this->l('You do not have permission to edit an order.'));
     }
     // Trick to use both Supply Order as template and actual orders
     if (Tools::isSubmit('is_template')) {
         $_GET['mod'] = 'template';
     }
     // checks if supply order reference is unique
     if (Tools::isSubmit('reference')) {
         // gets the reference
         $ref = pSQL(Tools::getValue('reference'));
         if (Tools::getValue('id_supply_order') != 0 && SupplyOrder::getReferenceById((int) Tools::getValue('id_supply_order')) != $ref) {
             if ((int) SupplyOrder::exists($ref) != 0) {
                 $this->errors[] = Tools::displayError($this->l('The reference has to be unique.'));
             }
         } else {
             if (Tools::getValue('id_supply_order') == 0 && (int) SupplyOrder::exists($ref) != 0) {
                 $this->errors[] = Tools::displayError($this->l('The reference has to be unique.'));
             }
         }
     }
     if ($this->errors) {
         return;
     }
     // Global checks when add / update a supply order
     if (Tools::isSubmit('submitAddsupply_order') || Tools::isSubmit('submitAddsupply_orderAndStay')) {
         $this->action = 'save';
         $this->is_editing_order = true;
         // get supplier ID
         $id_supplier = (int) Tools::getValue('id_supplier', 0);
         if ($id_supplier <= 0 || !Supplier::supplierExists($id_supplier)) {
             $this->errors[] = Tools::displayError($this->l('The selected supplier is not valid.'));
         }
         // get warehouse id
         $id_warehouse = (int) Tools::getValue('id_warehouse', 0);
         if ($id_warehouse <= 0 || !Warehouse::exists($id_warehouse)) {
             $this->errors[] = Tools::displayError($this->l('The selected warehouse is not valid.'));
         }
         // get currency id
         $id_currency = (int) Tools::getValue('id_currency', 0);
         if ($id_currency <= 0 || (!($result = Currency::getCurrency($id_currency)) || empty($result))) {
             $this->errors[] = Tools::displayError($this->l('The selected currency is not valid.'));
         }
         // get delivery date
         $delivery_expected = new DateTime(pSQL(Tools::getValue('date_delivery_expected')));
         // converts date to timestamp
         if ($delivery_expected <= new DateTime('yesterday')) {
             $this->errors[] = Tools::displayError($this->l('The date you specified cannot be in the past.'));
         }
         // gets threshold
         $quantity_threshold = Tools::getValue('load_products');
         if (is_numeric($quantity_threshold)) {
             $quantity_threshold = (int) $quantity_threshold;
         } else {
             $quantity_threshold = null;
         }
         if (!count($this->errors)) {
             // forces date for templates
             if (Tools::isSubmit('is_template') && !Tools::getValue('date_delivery_expected')) {
                 $_POST['date_delivery_expected'] = date('Y-m-d h:i:s');
             }
             // specify initial state
             $_POST['id_supply_order_state'] = 1;
             //defaut creation state
             // specify global reference currency
             $_POST['id_ref_currency'] = Currency::getDefaultCurrency()->id;
             // specify supplier name
             $_POST['supplier_name'] = Supplier::getNameById($id_supplier);
             //specific discount check
             $_POST['discount_rate'] = (double) str_replace(array(' ', ','), array('', '.'), Tools::getValue('discount_rate', 0));
         }
         // manage each associated product
         $this->manageOrderProducts();
         // if the threshold is defined and we are saving the order
         if (Tools::isSubmit('submitAddsupply_order') && Validate::isInt($quantity_threshold)) {
             $this->loadProducts((int) $quantity_threshold);
         }
         //--ERP informations
         // updates/creates erp_supplier_order if it does not exist
         if (Tools::isSubmit('id_erpip_supply_order') && (int) Tools::getValue('id_erpip_supply_order') > 0) {
             $erp_supplier_order = new ErpSupplyOrder((int) Tools::getValue('id_erpip_supply_order'));
         } else {
             $erp_supplier_order = new ErpSupplyOrder();
         }
         // creates erp_supplier_order
         $erp_supplier_order->escompte = Tools::getValue('escompte', null);
         $erp_supplier_order->global_discount_amount = Tools::getValue('global_discount_type', null);
         $erp_supplier_order->global_discount_type = Tools::getValue('global_discount_type', null);
         $erp_supplier_order->shipping_amount = Tools::getValue('shipping_amount', null);
//.........这里部分代码省略.........
开发者ID:prestamodule,项目名称:erpillicopresta,代码行数:101,代码来源:AdminAdvancedSupplyOrder.php

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

示例14: __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));
         if (!class_exists("Vendor", false)) {
             include_once dirname(__FILE__) . '/../modules/ordervendor/Vendor.php';
         }
         $this->vendor_name = Vendor::getNameById(intval($this->id_vendor));
     }
     $this->category = Category::getLinkRewrite(intval($this->id_category_default), intval($id_lang));
     $this->tags = Tag::getProductTags($this->id);
 }
开发者ID:redb,项目名称:prestashop,代码行数:14,代码来源:Product.php


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