本文整理汇总了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;
}
示例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 {
//.........这里部分代码省略.........