當前位置: 首頁>>代碼示例>>PHP>>正文


PHP GlobalConfig::getDefaultPrice方法代碼示例

本文整理匯總了PHP中GlobalConfig::getDefaultPrice方法的典型用法代碼示例。如果您正苦於以下問題:PHP GlobalConfig::getDefaultPrice方法的具體用法?PHP GlobalConfig::getDefaultPrice怎麽用?PHP GlobalConfig::getDefaultPrice使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在GlobalConfig的用法示例。


在下文中一共展示了GlobalConfig::getDefaultPrice方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: utilHtmlDefaultPrice

 public function utilHtmlDefaultPrice()
 {
     $defaultPriceValue = GlobalConfig::getDefaultPrice();
     $selectOptions = "";
     for ($i = 1; $i <= 5; $i++) {
         $isSelected = $i == $defaultPriceValue ? "selected" : "";
         $selectOptions .= "<option value='" . $i . "' " . $isSelected . ">" . $this->l('Price') . " " . $i . "</option>";
     }
     $html = '<select name="osi_default_price" style="width:360px">' . $selectOptions . '</select>';
     return $html;
 }
開發者ID:rtajmahal,項目名稱:PrestaShop-modules,代碼行數:11,代碼來源:opensi.php

示例2: createProductXml

 public static function createProductXml($product, $isMainProduct = true, $attributesMap, $featuresMap, $productChildInfos)
 {
     $docXml = self::createResponseXml();
     $request = $docXml->createElement("request");
     $ProductElem = $docXml->createElement("Article");
     $ProductElem->setAttribute('Reference', trim($product['reference']));
     $ProductElem->setAttribute('Designation', self::cut($product['product_name'], 100));
     if ($product['description_short'] != "") {
         $description1 = $product['description_short'];
         $description1 = self::convertToUTF8($description1);
         $ProductElem->setAttribute('Description_1', $description1);
     }
     if ($product['description'] != "") {
         $description2 = $product['description'];
         $description2 = self::convertToUTF8($description2);
         $ProductElem->setAttribute('Description_2', $description2);
     }
     if ($product['id_manufacturer'] != 0) {
         //if this Id == 0, manufacturer not exists
         $ProductElem->setAttribute('Marque', $product['manufacturer_name']);
     }
     if ($product['rate'] != null) {
         $tax = round(floatval($product['rate']), 4);
     } else {
         $tax = 0;
     }
     if ($product['price'] != null) {
         $ProductElem->setAttribute('Taux_Tva', $tax);
         if (substr(_PS_VERSION_, 0, 3) > 1.3) {
             /* Prestashop 1.4 */
             if (!$isMainProduct) {
                 $ht = round(floatval($product['price']) + floatval($productChildInfos['price']), 4);
                 $ttc = round(floatval($product['price']) + $product['price'] * $tax / 100, 2) + round(floatval($productChildInfos['price']) + floatval($productChildInfos['price'] * $tax / 100), 2);
             } else {
                 $ht = round(floatval($product['price']), 4);
                 $ttc = round(floatval($ht + $ht * $tax / 100), 4);
             }
         } else {
             /* Prestashop 1.3 */
             $ht = round(floatval($product['price']), 4);
             $ttc = round(floatval($ht + $ht * $tax / 100), 4);
             /* Set the price for child article (attribute article) */
             if (!$isMainProduct) {
                 $ttc += round(floatval($productChildInfos['price']), 4);
             }
         }
         if (GlobalConfig::getDefaultPrice() == 1) {
             $ProductElem->setAttribute('Tarif_TTC_1', $ttc);
         } else {
             $ProductElem->setAttribute('Tarif_TTC_1', 0);
             $ProductElem->setAttribute('Tarif_TTC_' . GlobalConfig::getDefaultPrice(), $ttc);
         }
         $purchasePrice = round(floatval($product['wholesale_price']), 4);
         /* Set the wholesale price for child article (attribute article) */
         if (!$isMainProduct && $productChildInfos['wholesale_price'] != 0) {
             $purchasePrice = round(floatval($productChildInfos['wholesale_price']), 4);
         }
         if ($purchasePrice != 0) {
             $ProductElem->setAttribute('Prix_Achat', $purchasePrice);
         }
     }
     $weight = $product['weight'];
     if (!$isMainProduct && $productChildInfos['weight'] != 0) {
         $weight += $productChildInfos['weight'];
     }
     $ProductElem->setAttribute('Poids', $weight);
     $ean13 = $product['ean13'];
     if (!$isMainProduct && $productChildInfos['ean13'] != "") {
         /* If child ean13 not defined, used main product ean13 */
         $ean13 = $productChildInfos['ean13'];
     }
     if ($ean13 != "") {
         $ProductElem->setAttribute('Code_Barre', $ean13);
     }
     /* Families */
     if ($product['families'] != null) {
         $ProductElem->setAttribute('Famille_1', 'NC');
     }
     /* Init attributes and features */
     $attAndFeatures = array("Attribut_1" => "", "Attribut_2" => "", "Attribut_3" => "", "Attribut_4" => "", "Attribut_5" => "", "Attribut_6" => "", "Volume" => "0");
     /* Set attributes */
     if (is_array($attributesMap)) {
         foreach ($attributesMap as $attributKey => $attributeName) {
             $attAndFeatures[$attributKey] = $attributeName;
         }
     }
     /* Set features */
     if (is_array($featuresMap)) {
         foreach ($featuresMap as $key => $value) {
             $attAndFeatures[$key] = $value;
             $ProductElem->setAttribute($key, self::convertToUTF8($value));
         }
     }
     /* Add xml for attributes and features */
     $featNumeric = array("Volume");
     foreach ($attAndFeatures as $key => $value) {
         if (in_array($key, $featNumeric)) {
             if (is_numeric($value)) {
                 $ProductElem->setAttribute($key, $value);
             } else {
//.........這裏部分代碼省略.........
開發者ID:rtajmahal,項目名稱:PrestaShop-modules,代碼行數:101,代碼來源:xml.class.php


注:本文中的GlobalConfig::getDefaultPrice方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。