function eStore_show_product_details($id, $info)
{
    if ($id == 'no id') {
        return '<div class="eStore_error_message">You did not specify a Product ID. Please enter a Product ID with this shortcode</div>';
    }
    if (empty($info)) {
        return '<div class="eStore_error_message">You did not specify which information of the product you want to show (the "info" parameter is empty). Please check the shortcode documentation to learn the usage of this shortcode.</div>';
    }
    $condition = " id='" . $id . "'";
    $product_details = WP_eStore_Db_Access::find(WP_ESTORE_PRODUCTS_TABLE_NAME, $condition);
    //var_dump($product_details);
    if ($info == 'all') {
        var_dump($product_details);
        return "";
    }
    if ($info == "description") {
        $description = html_entity_decode($product_details->{$info}, ENT_COMPAT, "UTF-8");
        $description = do_shortcode($description);
        return $description;
    }
    if (isset($product_details->{$info})) {
        return $product_details->{$info};
    } else {
        if ($info === "price_formatted") {
            $item_price = $product_details->price;
            $defaultSymbol = WP_ESTORE_CURRENCY_SYMBOL;
            $price_formatted = print_digi_cart_payment_currency($item_price, $defaultSymbol);
            return $price_formatted;
        } else {
            if ($info === "price_tax_inclusive") {
                if (!empty($product_details->tax)) {
                    $tax_rate = $product_details->tax;
                } else {
                    $global_store_tax_rate = get_option('eStore_global_tax_rate');
                    $tax_rate = $global_store_tax_rate;
                }
                $tax_inc_price = eStore_calculate_tax_included_price_without_qty($product_details->price, $tax_rate);
                $tax_inc_price = number_format($tax_inc_price, 2, '.', '');
                return $tax_inc_price;
            } else {
                return '<div class="eStore_error_message">The value you specified for the "info" parameter does not exist in the eStore product database. Please check the shortcode documentation to learn the usage of this shortcode.</div>';
            }
        }
    }
}
Пример #2
0
function eStore_cart_display_line_item_fancy2($item, $currency_symbol, $decimal)
{
    $wp_eStore_config = WP_eStore_Config::getInstance();
    $currency_symbol = $wp_eStore_config->getValue('cart_currency_symbol');
    $output = "";
    $output .= "<tr>";
    //Display Item name
    $output .= "<td class='eStore_cart_item_name_value'><span class='eStore_cart_fancy_2_item_name'>" . $item['name'] . "</span>";
    $output .= "<span class='eStore_cart_fancy_2_remove'><form method=\"post\"  action=\"\">\n\t<input type=\"hidden\" name=\"product\" value=\"" . htmlspecialchars($item['name']) . "\" />\n\t<input type='hidden' name='eStore_delcart' value='1' />\n\t<input type='submit' value='Remove' title='" . ESTORE_REMOVE_ITEM . "' class='eStore_cart_fancy_2_remove' />\n\t</form></span>";
    $output .= "</td>";
    //Display qty
    if ($wp_eStore_config->getValue('eStore_do_not_show_qty_in_cart')) {
        $output .= '<td></td>';
    } else {
        $output .= "<td class='eStore_cart_item_qty_value'><form method=\"post\"  action=\"\" name='peStore_cquantity' style='display: inline'>\n\t\t<input type=\"hidden\" name=\"product\" value=\"" . htmlspecialchars($item['name']) . "\" />    \n\t\t<input type='hidden' name='eStore_cquantity' value='1' /><input type='text' name='quantity' value='" . $item['quantity'] . "' size='1' class='eStore_cart_item_qty' />";
        if (WP_ESTORE_SHOW_UPDATE_BUTTON_FOR_QTY_CHANGE === '1') {
            $output .= '<input type="submit" value="' . ESTORE_UPDATE . '" class="eStore_update_qty" />';
        }
        $output .= "</form></td>";
    }
    if (WP_ESTORE_DISPLAY_TAX_INCLUSIVE_PRICE === '1') {
        if (!empty($item['tax'])) {
            $tax_rate = $item['tax'];
        } else {
            $global_store_tax_rate = get_option('eStore_global_tax_rate');
            $tax_rate = $global_store_tax_rate;
        }
        $tax_included_price = eStore_calculate_tax_included_price_without_qty($item['price'], $tax_rate);
        $item_display_price_amt = $tax_included_price;
    } else {
        $item_display_price_amt = $item['price'];
    }
    //Display Price
    $output .= "<td class='eStore_cart_item_price_value'><span class='eStore_cart_fancy_2_price'>" . print_digi_cart_payment_currency($item_display_price_amt * $item['quantity'], $currency_symbol, $decimal) . "</span>";
    if (WP_ESTORE_DISPLAY_ORIGINAL_ITEM_PRICE_BEFORE_COUPON === '1' && isset($_SESSION['discount_applied_once'])) {
        $price_before_coupon = eStore_get_original_item_price_from_backed_up_cart($item['name']);
        if (!empty($price_before_coupon)) {
            if (WP_ESTORE_DISPLAY_TAX_INCLUSIVE_PRICE === '1') {
                $price_before_coupon = eStore_calculate_tax_included_price_without_qty($price_before_coupon, $tax_rate);
            }
            $output .= ' (<span class="eStore_price_before_coupon">' . print_digi_cart_payment_currency($price_before_coupon * $item['quantity'], $currency_symbol, $decimal) . '</span>)';
        }
    }
    $output .= "</td>";
    $output .= "<td></td>";
    $output .= "</tr>";
    //End of line item row
    return $output;
}
Пример #3
0
function print_digi_cart_payment_currency_with_tax($price, $symbol, $tax_rate = '', $decimal = '.', $thousands_sep = ',')
{
    if (empty($tax_rate)) {
        $tax_rate = get_option('eStore_global_tax_rate');
    }
    if (is_numeric($price)) {
        //format the price amount
        $tax_included_price = eStore_calculate_tax_included_price_without_qty($price, $tax_rate);
        return print_digi_cart_payment_currency($tax_included_price, $symbol, $decimal, $thousands_sep);
    }
    return $price;
}