public static function getDisplayPriceFromHash($pProductsMixed = NULL) { global $gBitDb, $gBitUser; $ret = ''; if (STORE_STATUS == '1') { // Showcase no prices $ret = ''; } elseif (CUSTOMERS_APPROVAL == '1' && !$gBitUser->isRegistered()) { // customer must be logged in to browse $ret = ''; } elseif (CUSTOMERS_APPROVAL == '2' && !$gBitUser->isRegistered()) { // customer may browse but no prices $ret = TEXT_LOGIN_FOR_PRICE_PRICE; } elseif (CUSTOMERS_APPROVAL == '3' and TEXT_LOGIN_FOR_PRICE_PRICE_SHOWROOM != '') { // customer may browse but no prices $ret = TEXT_LOGIN_FOR_PRICE_PRICE_SHOWROOM; } elseif (CUSTOMERS_APPROVAL_AUTHORIZATION != '0' && !$gBitUser->isRegistered()) { // customer must be logged in to browse $ret = TEXT_AUTHORIZATION_PENDING_PRICE; } elseif (CUSTOMERS_APPROVAL_AUTHORIZATION != '0' and CUSTOMERS_APPROVAL_AUTHORIZATION != '3' and $_SESSION['customers_authorization'] > '0') { // customer must be logged in to browse $ret = TEXT_AUTHORIZATION_PENDING_PRICE; } else { // proceed normally if (is_array($pProductsMixed)) { $productHash = $pProductsMixed; } elseif (BitBase::verifyId($pProductsMixed)) { // $new_fields = ', `product_is_free`, `product_is_call`, `product_is_showroom_only`'; $productHash = $gBitDb->getRow("SELECT * FROM " . TABLE_PRODUCTS . " WHERE `products_id` = ? ", array((int) $pProductsMixed)); } if ($productHash) { $show_sale_discount = ''; $discountAmount = $productHash['products_price'] - $productHash['lowest_purchase_price']; // If Free, Show it if ($productHash['product_is_free'] == '1') { $final_display_price = '<span class="free">' . tra('FREE') . '</span>'; } elseif ($discountAmount > 0) { $final_display_price = '<span class="normalprice discounted">' . CommerceProduct::getNotatedPrice($productHash['products_price'], $productHash['products_tax_class_id']) . ' </span>'; $show_sale_price = ' ' . '<span class="productSpecialPrice">' . CommerceProduct::getNotatedPrice($productHash['lowest_purchase_price'], $productHash['products_tax_class_id']) . '</span>'; if (SHOW_SALE_DISCOUNT_STATUS == '1') { if (SHOW_SALE_DISCOUNT == 1) { $show_sale_discount = '<div class="productPriceDiscount">' . tra('Save: ') . number_format(100 - $productHash['lowest_purchase_price'] / $productHash['products_price'] * 100, SHOW_SALE_DISCOUNT_DECIMALS) . tra('% off') . '</div>'; } else { $show_sale_discount = '<div class="productPriceDiscount">' . tra('Save: ') . CommerceProduct::getNotatedPrice($discountAmount, $productHash['products_tax_class_id']) . PRODUCT_PRICE_DISCOUNT_AMOUNT . '</div>'; } } $final_display_price .= $show_sale_price . $show_sale_discount; } else { $final_display_price = '<span class="normalprice">' . CommerceProduct::getNotatedPrice($productHash['lowest_purchase_price'], $productHash['products_tax_class_id']) . ' </span>'; } // If Call for Price, Show it $call_tag = ''; if ($productHash['product_is_call']) { if (PRODUCTS_PRICE_IS_CALL_IMAGE_ON == '0') { $call_tag = '<br />' . PRODUCTS_PRICE_IS_CALL_FOR_PRICE_TEXT; } else { $call_tag = '<br />' . zen_image(DIR_WS_TEMPLATE_IMAGES . OTHER_IMAGE_CALL_FOR_PRICE, PRODUCTS_PRICE_IS_CALL_FOR_PRICE_TEXT); } } $ret = $final_display_price . $call_tag; } } return $ret; }