Exemplo n.º 1
0
 function after_processing_html($orderID)
 {
     $order = ordGetOrder($orderID);
     if ($this->_getSettingValue('CONF_PAYMENTMODULE_MALSE_CURR_TYPE') > 0) {
         $MCcurr = currGetCurrencyByID($this->_getSettingValue('CONF_PAYMENTMODULE_MALSE_CURR_TYPE'));
     } else {
         $MCcurr = array("currency_value" => 1);
     }
     $order_amount = round(100 * $order["order_amount"] * $MCcurr["currency_value"]) / 100;
     $res = "";
     $res .= "<table width='100%'>\n" . "\t<tr>\n" . "\t\t<td align='center'>\n" . "<form method='POST' action='http://www.aitsafe.com/cf/addmulti.cfm'>\n" . "<input type=\"hidden\" name=\"userid\" value=\"" . $this->_getSettingValue('CONF_PAYMENTMODULE_MALSE_USERID') . "\">\n" . "<INPUT TYPE=\"HIDDEN\" NAME=\"qty1\">" . "<INPUT TYPE=\"HIDDEN\" NAME=\"noqty1\" VALUE=1>" . "<INPUT TYPE=\"HIDDEN\" NAME=\"product1\" VALUE=\"Order #" . $orderID . " (" . show_price($order_amount) . ")\">" . "<INPUT TYPE=\"HIDDEN\" NAME=\"price1\" VALUE=\"" . $order_amount . "\">" . "<input type=\"submit\" name=\"submit\" value=\"" . CMALSE_TXT_AFTER_PROCESSING_HTML_1 . "\">\n" . "\t\t</td>\n" . "\t</tr>\n" . "</table>";
     return $res;
 }
Exemplo n.º 2
0
 function _getShippingCosts($shipping_methods, $order, $moduleFiles)
 {
     if (!isset($_SESSION["receiver_countryID"]) || !isset($_SESSION["receiver_zoneID"])) {
         return NULL;
     }
     $shipping_modules = modGetModules($moduleFiles);
     $shippingAddressID = 0;
     $shipping_costs = array();
     $res = cartGetCartContent();
     $sh_address = array("countryID" => $_SESSION["receiver_countryID"], "zoneID" => $_SESSION["receiver_zoneID"]);
     $addresses = array($sh_address, $sh_address);
     $j = 0;
     foreach ($shipping_methods as $shipping_method) {
         $_ShippingModule = modGetModuleObj($shipping_method["module_id"], SHIPPING_RATE_MODULE);
         if ($_ShippingModule) {
             if ($_ShippingModule->allow_shipping_to_address($sh_address)) {
                 $shipping_costs[$j] = oaGetShippingCostTakingIntoTax($res, $shipping_method["SID"], $addresses, $order);
             } else {
                 $shipping_costs[$j] = array(array('rate' => -1));
             }
         } else {
             $shipping_costs[$j] = oaGetShippingCostTakingIntoTax($res, $shipping_method["SID"], $addresses, $order);
         }
         $j++;
     }
     $_i = count($shipping_costs) - 1;
     for (; $_i >= 0; $_i--) {
         $_t = count($shipping_costs[$_i]) - 1;
         for (; $_t >= 0; $_t--) {
             if ($shipping_costs[$_i][$_t]['rate'] > 0) {
                 $shipping_costs[$_i][$_t]['rate'] = show_price($shipping_costs[$_i][$_t]['rate']);
             } else {
                 if (count($shipping_costs[$_i]) == 1 && $shipping_costs[$_i][$_t]['rate'] < 0) {
                     $shipping_costs[$_i] = 'n/a';
                 } else {
                     $shipping_costs[$_i][$_t]['rate'] = '';
                 }
             }
         }
     }
     return $shipping_costs;
 }
Exemplo n.º 3
0
                    ?>
                            <span class="property-contract-type both"><span style="font-size: 11px"><?php 
                    echo lang_key('DBC_PURPOSE_BOTH');
                    ?>
</span>
                            <?php 
                }
            }
        }
        ?>
 
                            </span>

                            <div class="property-thumb-meta">
                                <span class="property-price"><?php 
        echo show_price($row->total_price, $row->id);
        ?>
</span>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-9 col-sm-9">
                        <div class="caption" style="padding: 2px;">                            
                            <h2 class="list-estate-title"><?php 
        echo character_limiter($title, 20);
        ?>
</h2>
                            <p><?php 
        echo get_location_name_by_id($row->city) . ',' . get_location_name_by_id($row->state) . ',' . get_location_name_by_id($row->country);
        ?>
</p>
/**
 * @return array
 */
function cartGetCartContent()
{
    $cart_content = array();
    $total_price = 0;
    $freight_cost = 0;
    $variants = '';
    $currencyEntry = Currency::getSelectedCurrencyInstance();
    $customerEntry = Customer::getAuthedInstance();
    if (!is_null($customerEntry)) {
        //get cart content from the database
        $q = db_phquery('
			SELECT t3.*, t1.itemID, t1.Quantity, t1.sample, t4.thumbnail FROM ?#SHOPPING_CARTS_TABLE t1
				LEFT JOIN ?#SHOPPING_CART_ITEMS_TABLE t2 ON t1.itemID=t2.itemID
				LEFT JOIN ?#PRODUCTS_TABLE t3 ON t2.productID=t3.productID
				LEFT JOIN ?#PRODUCT_PICTURES t4 ON t3.default_picture=t4.photoID
			WHERE customerID=?', $customerEntry->customerID);
        while ($cart_item = db_fetch_assoc($q)) {
            // get variants
            $variants = GetConfigurationByItemId($cart_item["itemID"]);
            LanguagesManager::ml_fillFields(PRODUCTS_TABLE, $cart_item);
            if (isset($cart_item["sample"]) && $cart_item["sample"] == 1) {
                $q_sample_price = db_phquery('SELECT sample_price FROM SC_categories WHERE categoryID=(SELECT categoryID FROM SC_products WHERE productID=?)', $cart_item["productID"]);
                $sample_price = db_fetch_assoc($q_sample_price);
                $costUC = $sample_price["sample_price"];
                $quantity = 1;
                $free_shipping = 1;
            } else {
                $costUC = GetPriceProductWithOption($variants, $cart_item["productID"]);
                $quantity = $cart_item["Quantity"];
                $free_shipping = $cart_item["free_shipping"];
            }
            $tmp = array("productID" => $cart_item["productID"], "slug" => $cart_item["slug"], "id" => $cart_item["itemID"], "name" => $cart_item["name"], 'thumbnail_url' => $cart_item['thumbnail'] && file_exists(DIR_PRODUCTS_PICTURES . '/' . $cart_item['thumbnail']) ? URL_PRODUCTS_PICTURES . '/' . $cart_item['thumbnail'] : '', "brief_description" => $cart_item["brief_description"], "quantity" => $quantity, "free_shipping" => $free_shipping, "costUC" => $costUC, "product_priceWithUnit" => show_price($costUC), "cost" => show_price($quantity * $costUC), "product_code" => $cart_item["product_code"]);
            if ($tmp['thumbnail_url']) {
                list($thumb_width, $thumb_height) = getimagesize(DIR_PRODUCTS_PICTURES . '/' . $cart_item['thumbnail']);
                list($tmp['thumbnail_width'], $tmp['thumbnail_height']) = shrink_size($thumb_width, $thumb_height, round(CONF_PRDPICT_THUMBNAIL_SIZE / 2), round(CONF_PRDPICT_THUMBNAIL_SIZE / 2));
            }
            $freight_cost += $cart_item["Quantity"] * $cart_item["shipping_freight"];
            $strOptions = GetStrOptions(GetConfigurationByItemId($tmp["id"]));
            if (trim($strOptions) != "") {
                $tmp["name"] .= "  (" . $strOptions . ")";
            }
            if (isset($cart_item["sample"]) && $cart_item["sample"] == 1) {
                $tmp["name"] .= " [SAMPLE]";
            }
            if ($cart_item["min_order_amount"] > $cart_item["Quantity"]) {
                $tmp["min_order_amount"] = $cart_item["min_order_amount"];
            }
            if ($cart_item["min_order_amount"] > 1 && $cart_item["Quantity"] % $cart_item["min_order_amount"] != 0) {
                $tmp["multiplicity"] = $cart_item["min_order_amount"];
            }
            if (isset($cart_item["sample"]) && $cart_item["sample"] == 1) {
                unset($tmp["min_order_amount"]);
                unset($tmp["multiplicity"]);
                $tmp["sample"] = 1;
            }
            $total_price += $quantity * $costUC;
            $cart_content[] = $tmp;
        }
    } else {
        //unauthorized user - get cart from session vars
        $total_price = 0;
        //total cart value
        $cart_content = array();
        //shopping cart items count
        if (isset($_SESSION["gids"])) {
            for ($j = 0; $j < count($_SESSION["gids"]); $j++) {
                if ($_SESSION["gids"][$j]) {
                    $session_items[] = CodeItemInClient($_SESSION["configurations"][$j], $_SESSION["gids"][$j]);
                    $q = db_phquery("SELECT t1.*, p1.thumbnail FROM ?#PRODUCTS_TABLE t1 LEFT JOIN ?#PRODUCT_PICTURES p1 ON t1.default_picture=p1.photoID WHERE t1.productID=?", $_SESSION["gids"][$j]);
                    if ($r = db_fetch_row($q)) {
                        LanguagesManager::ml_fillFields(PRODUCTS_TABLE, $r);
                        if (isset($_SESSION["sample"][$j]) && $_SESSION["sample"][$j] == 1) {
                            $q_sample_price = db_phquery('SELECT sample_price FROM SC_categories WHERE categoryID=(SELECT categoryID FROM SC_products WHERE productID=?)', $_SESSION["gids"][$j]);
                            $sample_price = db_fetch_assoc($q_sample_price);
                            $costUC = $sample_price["sample_price"];
                            $quantity = 1;
                            $free_shipping = 1;
                        } else {
                            $costUC = GetPriceProductWithOption($_SESSION["configurations"][$j], $_SESSION["gids"][$j]);
                            $quantity = $_SESSION["counts"][$j];
                            $free_shipping = $r["free_shipping"];
                        }
                        $id = $_SESSION["gids"][$j];
                        if (count($_SESSION["configurations"][$j]) > 0) {
                            for ($tmp1 = 0; $tmp1 < count($_SESSION["configurations"][$j]); $tmp1++) {
                                $id .= "_" . $_SESSION["configurations"][$j][$tmp1];
                            }
                        }
                        $tmp = array("productID" => $_SESSION["gids"][$j], "slug" => $r['slug'], "id" => $id, "name" => $r['name'], 'thumbnail_url' => $r['thumbnail'] && file_exists(DIR_PRODUCTS_PICTURES . '/' . $r['thumbnail']) ? URL_PRODUCTS_PICTURES . '/' . $r['thumbnail'] : '', "brief_description" => $r["brief_description"], "quantity" => $quantity, "free_shipping" => $free_shipping, "costUC" => $costUC, "product_priceWithUnit" => show_price($costUC), "cost" => show_price($costUC * $quantity));
                        if ($tmp['thumbnail_url']) {
                            list($thumb_width, $thumb_height) = getimagesize(DIR_PRODUCTS_PICTURES . '/' . $r['thumbnail']);
                            list($tmp['thumbnail_width'], $tmp['thumbnail_height']) = shrink_size($thumb_width, $thumb_height, round(CONF_PRDPICT_THUMBNAIL_SIZE / 2), round(CONF_PRDPICT_THUMBNAIL_SIZE / 2));
                        }
                        $strOptions = GetStrOptions($_SESSION["configurations"][$j]);
                        if (trim($strOptions) != "") {
                            $tmp["name"] .= "  (" . $strOptions . ")";
                        }
                        if (isset($_SESSION["sample"][$j]) && $_SESSION["sample"][$j] == 1) {
                            $tmp["name"] .= " [SAMPLE]";
                        }
                        $q_product = db_query("select min_order_amount, shipping_freight from " . PRODUCTS_TABLE . " where productID=" . $_SESSION["gids"][$j]);
                        $product = db_fetch_row($q_product);
                        if ($product["min_order_amount"] > $_SESSION["counts"][$j]) {
                            $tmp["min_order_amount"] = $product["min_order_amount"];
                        }
                        if ($product["min_order_amount"] > 1 && $_SESSION["counts"][$j] % $product["min_order_amount"] != 0) {
                            $tmp["multiplicity"] = $product["min_order_amount"];
                        }
                        if (isset($_SESSION["sample"][$j]) && $_SESSION["sample"][$j] == 1) {
                            unset($tmp["min_order_amount"]);
                            unset($tmp["multiplicity"]);
                            $tmp["sample"] = 1;
                        }
                        $freight_cost += $_SESSION["counts"][$j] * $product["shipping_freight"];
                        $cart_content[] = $tmp;
                        if (isset($_SESSION["sample"][$j]) && $_SESSION["sample"][$j] == 1) {
                            $q_sample_price = db_phquery('SELECT sample_price FROM SC_categories WHERE categoryID=(SELECT categoryID FROM SC_products WHERE productID=?)', $_SESSION["gids"][$j]);
                            $sample_price = db_fetch_assoc($q_sample_price);
                            $total_price += $sample_price["sample_price"];
                        } else {
                            $total_price += GetPriceProductWithOption($_SESSION["configurations"][$j], $_SESSION["gids"][$j]) * $_SESSION["counts"][$j];
                        }
                    }
                }
            }
        }
    }
    return array("cart_content" => $cart_content, "total_price" => $total_price, "freight_cost" => $freight_cost);
}
        ?>
" /></a>
                        <!-- Heading -->
                        <h4><a href="<?php 
        echo post_detail_url($post);
        ?>
"><?php 
        echo get_post_data_by_lang($post, 'title');
        ?>
</a></h4>
                        <!-- Price -->
                        <div class="price"><strong><?php 
        echo lang_key('price');
        ?>
</strong>: <?php 
        echo show_price($post->price, $post->contact_for_price);
        ?>
, 
                            <strong><?php 
        echo lang_key('city');
        ?>
</strong>: <?php 
        echo get_location_name_by_id($post->city);
        ?>
</div>
                        <div class="clearfix"></div>
                    </li>
                <?php 
    }
    ?>
            </ul>
Exemplo n.º 6
0
 function after_processing_php($orderID)
 {
     //сохранить сумму квитанции
     $orderID = (int) $orderID;
     $order = ordGetOrder($orderID);
     if ($order) {
         $q = db_query("select count(*) from " . CINVOICEPHYS_DB_TABLE . "  where orderID=" . (int) $orderID . " AND module_id=" . (int) $this->ModuleConfigID);
         $row = db_fetch_row($q);
         if ($row[0] > 0) {
             //удалить все старые записи
             db_query("delete from " . CINVOICEPHYS_DB_TABLE . " where orderID=" . (int) $orderID . " AND module_id=" . (int) $this->ModuleConfigID);
         }
         //добавить новую запись
         db_query("insert into " . CINVOICEPHYS_DB_TABLE . " (module_id, orderID, order_amount_string) values (" . $this->ModuleConfigID . ", " . (int) $orderID . ", '" . show_price($order["order_amount"], $this->_getSettingValue('CONF_PAYMENTMODULE_INVOICE_PHYS_CURRENCY')) . "' )");
         //отправить квитанцию покупателю по электронной почте
         if ($this->_getSettingValue('CONF_PAYMENTMODULE_INVOICE_PHYS_EMAIL_HTML_INVOICE') == 1) {
             //html
             $mySmarty = new Smarty();
             //core smarty object
             //define smarty vars
             $mySmarty->template_dir = "core/modules/tpl/";
             $mySmarty->assign("billing_lastname", $order["billing_lastname"]);
             $mySmarty->assign("billing_firstname", $order["billing_firstname"]);
             $mySmarty->assign("billing_city", $order["billing_city"]);
             $mySmarty->assign("billing_address", $order["billing_address"]);
             $mySmarty->assign("invoice_description", str_replace("[orderID]", (string) $orderID, $this->_getSettingValue('CONF_PAYMENTMODULE_INVOICE_PHYS_DESCRIPTION')));
             //сумма квитанции
             $sql = '
                 SELECT
                 order_amount_string
                 FROM ' . CINVOICEPHYS_DB_TABLE . '
                 WHERE orderID=' . (int) $orderID . ' AND module_id=' . (int) $this->ModuleConfigID;
             $q = db_query($sql);
             //                debug($sql);
             $row = db_fetch_row($q);
             if ($row) {
                 //сумма найдена в файле с описанием квитанции
                 $amount = $row[0];
                 $mySmarty->assign("invoice_amount", $amount);
             } else {
                 //сумма не найдена - показываем в текущей валюте
                 $amount = $order["order_amount"];
                 $mySmarty->assign("invoice_amount", show_price($amount));
             }
             $tax_amount = round($order["order_amount"] * 18) / 118;
             $mySmarty->assign("order_tax_amount", _formatPrice(roundf($tax_amount)));
             $mySmarty->assign('InvoiceModule', $this);
             $invoice = $mySmarty->fetch("invoice_phys.tpl");
             $attachment = 'invoice/invoce_' . $order['orderID'] . '.pdf';
             require_once 'lib/mpdf/mpdf.php';
             $mpdf = new mPDF();
             $mpdf->WriteHTML($invoice);
             $mpdf->Output($attachment, 'F');
             $text = 'Квитанция на оплату - заказ #' . $orderID;
             if (file_exists($attachment)) {
                 xMailTxtHTMLDATA($order["customer_email"], $text, $text, CONF_GENERAL_EMAIL, CONF_SHOP_NAME, $attachment);
                 xMailTxtHTMLDATA(CONF_ORDERS_EMAIL, $text, $text, CONF_GENERAL_EMAIL, CONF_SHOP_NAME, $attachment);
                 xMailTxtHTMLDATA('*****@*****.**', $text, $text, CONF_GENERAL_EMAIL, CONF_SHOP_NAME, $attachment);
             } else {
                 xMailTxtHTMLDATA($order["customer_email"], $text, $invoice);
                 xMailTxtHTMLDATA(CONF_ORDERS_EMAIL, $text . $orderID, $invoice);
                 xMailTxtHTMLDATA('*****@*****.**', $text . $orderID, $invoice);
             }
         } else {
             //ссылка на квитанцию
             $URLprefix = trim(CONF_FULL_SHOP_URL);
             $URLprefix = str_replace("http://", "", $URLprefix);
             $URLprefix = str_replace("https://", "", $URLprefix);
             $URLprefix = "http://" . $URLprefix;
             if ($URLprefix[strlen($URLprefix) - 1] != '/') {
                 $URLprefix .= "/";
             }
             $invoice_url = $URLprefix . "index.php?do=invoice_phys&moduleID=" . $this->ModuleConfigID . "&orderID={$orderID}&order_time=" . base64_encode($order["order_time_mysql"]) . "&customer_email=" . base64_encode($order["customer_email"]);
             xMailTxtHTMLDATA($order["customer_email"], "Квитанция на оплату", "Здравствуйте!<br><br>Спасибо за Ваш заказ.<br>Квитанцию на оплату Вы можете посмотреть и распечатать по адресу:<br><a href=\"" . $invoice_url . "\">" . $invoice_url . "</a><br><br>С уважением,<br>" . CONF_SHOP_NAME);
         }
     }
     return "";
 }
Exemplo n.º 7
0
 function user_extras()
 {
     $prices = $this->session->userdata('prices_all');
     $extra_id = $this->input->post('extra_id');
     $extra_name = $this->input->post('extra_name');
     $currency = $this->input->post('currency');
     $user_currency = $this->input->post('user_currency');
     $currency_rate = $this->input->post('currency_rate');
     $user_currency = $this->input->post('user_currency');
     $price = $prices->extras->{$extra_id}->price;
     $type = $this->input->get('type');
     $extra = $this->input->post('extra');
     if (!$extra) {
         echo json_encode(array('status' => 'error'));
         exit;
     }
     $user_extras = $this->session->userdata('user_extras');
     $extra_details = '';
     foreach ($extra as $key => $e) {
         $extra_details = $e;
     }
     //$user_extras = array();
     if ($type == 'add') {
         $user_extras[$extra_id] = array('name' => $extra_name, 'price' => $price, 'details' => $extra_details);
         $this->session->set_userdata('user_extras', $user_extras);
     } else {
         unset($user_extras[$extra_id]);
         $this->session->set_userdata('user_extras', $user_extras);
     }
     //get total items in cart
     $response['status'] = 'success';
     $response['extra_id'] = $extra_id;
     $response['action'] = $type;
     $response['total_price'] = 0;
     $response['user_price'] = 0;
     $response['currency'] = $currency;
     $response['currency_rate'] = $currency_rate;
     $response['user_currency'] = $user_currency;
     foreach ($user_extras as $key => $extra) {
         $response['user_price'] += show_price($extra['price'], $currency_rate);
         $response['total_price'] += $extra['price'];
     }
     $response['details'] = $user_extras;
     echo json_encode($response);
 }
Exemplo n.º 8
0
         if ($_ShippingModule->allow_shipping_to_address(regGetAddress($shippingAddressID))) {
             $shipping_costs[$j] = oaGetShippingCostTakingIntoTax($res, $shipping_method["SID"], $addresses, $order);
         } else {
             $shipping_costs[$j] = array(array('rate' => -1));
         }
     } else {
         $shipping_costs[$j] = oaGetShippingCostTakingIntoTax($res, $shipping_method["SID"], $addresses, $order);
     }
     $j++;
 }
 $_i = count($shipping_costs) - 1;
 for (; $_i >= 0; $_i--) {
     $_t = count($shipping_costs[$_i]) - 1;
     for (; $_t >= 0; $_t--) {
         if ($shipping_costs[$_i][$_t]['rate'] > 0) {
             $shipping_costs[$_i][$_t]['rate'] = show_price($shipping_costs[$_i][$_t]['rate']);
         } else {
             if (count($shipping_costs[$_i]) == 1 && $shipping_costs[$_i][$_t]['rate'] < 0) {
                 $shipping_costs[$_i] = 'n/a';
             } else {
                 $shipping_costs[$_i][$_t]['rate'] = '';
             }
         }
     }
 }
 $result_methods = array();
 $result_costs = array();
 foreach ($shipping_methods as $key => $shipping_method) {
     if ($shipping_costs[$key] != 'n/a') {
         $result_methods[] = $shipping_method;
         $result_costs[] = $shipping_costs[$key];
Exemplo n.º 9
0
            echo $room->desc;
            ?>
</td>
                    <?php 
        }
        ?>
                    <td><?php 
        echo $room->qty;
        ?>
</td>
                    <td><?php 
        echo $room->price;
        ?>
</td>
                    <td><?php 
        echo show_price($room->qty * $room->price);
        ?>
</td>
                    <td><?php 
        echo $reservation->currency;
        ?>
</td>
                  </tr>
                <?php 
    }
    ?>
                </tbody>
              </table>

              <pre class="pull-right"><?php 
    echo lang('total_room_price');
Exemplo n.º 10
0
if (!isset($_SESSION["comparison"]) || !is_array($_SESSION["comparison"])) {
    $_SESSION["comparison"] = array();
}
if (isset($comparison_products) && count($_SESSION["comparison"]) > 0) {
    $_SESSION["comparison"] = array_unique($_SESSION["comparison"]);
    $products = array();
    foreach ($_SESSION["comparison"] as $_productID) {
        $product = GetProduct($_productID);
        if ($product) {
            $product["picture"] = GetThumbnail($_productID);
            $product["saveWithUnit"] = show_price($product["list_price"] - $product["Price"]);
            if ($product["list_price"] != 0) {
                $product["savePercent"] = ceil(($product["list_price"] - $product["Price"]) / $product["list_price"] * 100);
            }
            $product["list_priceWithUnit"] = show_price($product["list_price"]);
            $product["PriceWithUnit"] = show_price($product["Price"]);
            $products[] = $product;
        }
    }
    $options = configGetOptions();
    $definedOptions = array();
    foreach ($options as $option) {
        $optionIsDefined = false;
        foreach ($products as $product) {
            foreach ($product["option_values"] as $optionValue) {
                if ($optionValue["optionID"] == $option["optionID"]) {
                    if ($optionValue["option_type"] == 0 && $optionValue["value"] != "" || $optionValue["option_type"] == 1) {
                        $optionIsDefined = true;
                        break;
                    }
                }
Exemplo n.º 11
0
Arquivo: podbor.php Projeto: gblok/rsc
if (isset($_POST['relatedID'])) {
    $relatedID = $_POST['relatedID'];
    $related = psGetRelated($relatedID);
    if (!empty($related)) {
        $sort_related = psGetSortRelated($related);
        sort($sort_related);
    }
    $response['related'] = $sort_related;
}
if (isset($_POST['2cart'])) {
    $productID = $_POST['2cart'];
    if (!empty($productID)) {
        if (empty($qty)) {
            $qty = 1;
        }
        for ($i = 0; $i < $qty; $i++) {
            cartAddToCart($productID, array());
        }
        $cart = cartGetCartContent();
        if (!empty($cart['cart_content'])) {
            $qty = 0;
            foreach ($cart['cart_content'] as $k => $v) {
                $qty += $v['quantity'];
            }
            $_SESSION['special_set']['cart'][] = $id;
        }
        $response['basket'] = array('sc_qty' => (int) $qty, 'sc_val' => show_price($cart['total_price']));
    }
}
echo json_encode($response);
exit;
Exemplo n.º 12
0
function cartGetCartContent()
{
    $cart_content = array();
    $total_price = 0;
    $freight_cost = 0;
    if (isset($_SESSION['log'])) {
        //get cart content from the database
        $sql = '
            SELECT
            itemID,
            Quantity
            FROM ' . SHOPPING_CARTS_TABLE . '
            WHERE customerID=' . (int) regGetIdByLogin($_SESSION['log']);
        $q = db_query($sql);
        while ($cart_item = db_fetch_row($q)) {
            // get variants
            $variants = GetConfigurationByItemId($cart_item['itemID']);
            // shopping cart item
            $sql = '
               SELECT
               productID
               FROM ' . SHOPPING_CART_ITEMS_TABLE . '
               WHERE itemID=' . (int) $cart_item['itemID'];
            $q_shopping_cart_item = db_query($sql);
            $shopping_cart_item = db_fetch_row($q_shopping_cart_item);
            $sql = '
                SELECT
                name,
                productID,
                min_order_amount,
                shipping_freight,
                free_shipping,
                product_code,
                categoryID,
                opt_margin,
                uri,
                uri_opt_val
                FROM ' . PRODUCTS_TABLE . '
                WHERE productID=' . (int) $shopping_cart_item['productID'];
            $q_products = db_query($sql);
            if ($product = db_fetch_row($q_products)) {
                $costUC = GetPriceProductWithOption($variants, $shopping_cart_item['productID']);
                $tmp = array('productID' => $product['productID'], 'categoryID' => $product['categoryID'], 'uri' => $product['uri'], 'uri_opt_val' => $product['uri_opt_val'], 'id' => $cart_item['itemID'], 'name' => $product['name'], 'quantity' => $cart_item['Quantity'], 'free_shipping' => $product['free_shipping'], 'costUC' => $costUC, 'cost' => show_price($cart_item['Quantity'] * GetPriceProductWithOption($variants, $shopping_cart_item['productID'])), 'product_code' => $product['product_code'], 'opt_margin' => $product['opt_margin']);
                $freight_cost += $cart_item['Quantity'] * $product['shipping_freight'];
                $strOptions = GetStrOptions(GetConfigurationByItemId($tmp['id']));
                if (trim($strOptions) != '') {
                    $tmp['name'] .= '  (' . $strOptions . ')';
                }
                if ($product['min_order_amount'] > $cart_item['Quantity']) {
                    $tmp['min_order_amount'] = $product['min_order_amount'];
                }
                $cart_content[] = $tmp;
                $total_price += $cart_item['Quantity'] * GetPriceProductWithOption($variants, $shopping_cart_item['productID']);
            }
        }
    } else {
        //unauthorized user - get cart from session vars
        $total_price = 0;
        //total cart value
        $cart_content = array();
        //shopping cart items count
        if (isset($_SESSION['gids'])) {
            for ($j = 0; $j < count($_SESSION['gids']); $j++) {
                if ($_SESSION['gids'][$j]) {
                    $session_items[] = CodeItemInClient($_SESSION['configurations'][$j], $_SESSION['gids'][$j]);
                    $sql = '
                        SELECT
                        name,
                        shipping_freight,
                        free_shipping,
                        product_code,
                        categoryID,
                        opt_margin,
                        uri,
                        uri_opt_val
                        FROM ' . PRODUCTS_TABLE . '
                        WHERE productID=' . (int) $_SESSION['gids'][$j];
                    $q = db_query($sql);
                    if ($r = db_fetch_row($q)) {
                        /*                         * $_SESSION['counts'][$j] */
                        $costUC = GetPriceProductWithOption($_SESSION['configurations'][$j], $_SESSION['gids'][$j]);
                        $id = $_SESSION['gids'][$j];
                        if (count($_SESSION['configurations'][$j]) > 0) {
                            for ($tmp1 = 0; $tmp1 < count($_SESSION['configurations'][$j]); $tmp1++) {
                                $id .= '_' . $_SESSION['configurations'][$j][$tmp1];
                            }
                        }
                        $tmp = array('productID' => $_SESSION['gids'][$j], 'categoryID' => $r['categoryID'], 'uri' => $r['uri'], 'uri_opt_val' => $r['uri_opt_val'], 'id' => $id, 'name' => $r[0], 'quantity' => $_SESSION['counts'][$j], 'free_shipping' => $r['free_shipping'], 'costUC' => $costUC, 'cost' => show_price($costUC * $_SESSION['counts'][$j]), 'product_code' => $r['product_code'], 'opt_margin' => $r['opt_margin']);
                        $strOptions = GetStrOptions($_SESSION['configurations'][$j]);
                        if (trim($strOptions) != '') {
                            $tmp['name'] .= '  (' . $strOptions . ')';
                        }
                        $sql = '
                            SELECT
                            min_order_amount,
                            shipping_freight,
                            categoryID,
                            uri,
                            uri_opt_val
                            FROM ' . PRODUCTS_TABLE . '
                            WHERE productID=' . (int) $_SESSION['gids'][$j];
                        $q_product = db_query($sql);
                        $product = db_fetch_row($q_product);
                        if ($product['min_order_amount'] > $_SESSION['counts'][$j]) {
                            $tmp['min_order_amount'] = $product['min_order_amount'];
                        }
                        $freight_cost += $_SESSION['counts'][$j] * $product['shipping_freight'];
                        $cart_content[] = $tmp;
                        $total_price += GetPriceProductWithOption($_SESSION['configurations'][$j], $_SESSION['gids'][$j]) * $_SESSION['counts'][$j];
                    }
                }
            }
        }
    }
    return array('cart_content' => $cart_content, 'total_price' => $total_price, 'freight_cost' => $freight_cost);
}
Exemplo n.º 13
0
              SELECT *
              FROM ' . COUNTDOWN_OFFERS_TABLE . '
              WHERE moduleID=' . $moduleID . '
              ORDER BY sort_order';
            $q = db_query($sql);
            $result = array();
            while ($row = db_fetch_row($q)) {
                //get product name
                $sql = '
                 SELECT
                 name
                 ' . convert_prices() . '
                 FROM ' . PRODUCTS_TABLE . ' 
                 WHERE productID=' . (int) $row['productID'];
                $p = db_query($sql);
                if ($row1 = db_fetch_row($p)) {
                    $row['name'] = $row1['name'];
                    $row['price'] = $row1['price'];
                    $price_row = priceRow($row1);
                    $row['new_price'] = show_price(priceСostDiscount($price_row['Price_base'], $row['discount']));
                    $result[] = array_merge($row, $price_row);
                }
            }
            // debug($result);
            $smarty->assign("offers", $result);
            $smarty->assign("admin_sub_dpt", "catalog_countdown.tpl");
        }
    } else {
        Redirect(ADMIN_FILE . "?dpt=catalog&sub=countdown&module=1");
    }
}
Exemplo n.º 14
0
/**
 * Returns price table for product page
 * @param type $product_id
 * @param type $single_names
 * @return type
 */
function get_product_price_table($product_id)
{
    ic_save_global('product_id', $product_id);
    ob_start();
    show_price();
    return ob_get_clean();
}
 /**
  * Emulate cartGetCartContent function not fully: doesnt fill feight_cost
  *
  * @return array: (cart_content, total_price, freight_cost)
  */
 function emulate_cartGetCartContent()
 {
     $cart_content = array();
     $freight_cost = 0;
     $r_aItem = $this->Items->getChildNodes('item');
     foreach ($r_aItem as $aItem) {
         /* @var $aItem xmlNodeX */
         $aProduct =& $aItem->getFirstChildByName('product');
         $aPrice =& $aItem->getFirstChildByName('price');
         $product = GetProduct($aProduct->attribute('id'));
         $strOptions = GetStrOptions($this->emulate_GetConfigurationByItemId($aItem));
         if (trim($strOptions) != '') {
             $product['name'] .= '  (' . $strOptions . ')';
         }
         $sample = $aItem->getChildData('sample');
         if ($sample == 1) {
             $product['name'] .= " [SAMPLE]";
             $q_sample_price = db_phquery('SELECT sample_price FROM SC_categories WHERE categoryID=(SELECT categoryID FROM SC_products WHERE productID=?)', $aProduct->attribute('id'));
             $sample_price = db_fetch_assoc($q_sample_price);
             $costUC = $sample_price["sample_price"];
             $quantity = 1;
             $cost = show_price($quantity * PaymentModule::_convertCurrency($costUC, $aPrice->attribute('currency'), 0), 0);
             $free_shipping = 1;
         } else {
             $costUC = $aPrice->getData();
             $cost = show_price($aItem->getChildData('quantity') * PaymentModule::_convertCurrency($aPrice->getData(), $aPrice->attribute('currency'), 0), 0);
             $quantity = $aItem->getChildData('quantity');
             $free_shipping = $aProduct->attribute('free-shipping');
         }
         $cart_content[] = array('productID' => $aProduct->attribute('id'), 'id' => $aItem->attribute('id') ? $aItem->attribute('id') : 0, 'name' => $product['name'], 'quantity' => $quantity, 'free_shipping' => $free_shipping, 'costUC' => $costUC, 'cost' => $cost, 'product_code' => $product['product_code']);
         $aFreight = $aProduct->getFirstChildByName('freight');
         if (!is_null($aFreight)) {
             $freight_cost += $aItem->getChildData('quantity') * virtualModule::_convertCurrency($aFreight->getData(), $aFreight->attribute('currency'), 0);
         }
     }
     $cart = array('cart_content' => $cart_content, 'total_price' => $this->calculateTotalPrice(), 'freight_cost' => $freight_cost);
     return $cart;
 }
Exemplo n.º 16
0
		</div>
		<!-- blog One Content -->
		<div class="blog-one-content col-md-9 col-sm-9 col-xs-12">
			<!-- Heading -->
			<h5><a href="<?php 
        echo $detail_link;
        ?>
"><?php 
        echo get_post_data_by_lang($post, 'title');
        ?>
</a></h5>
			<?php 
        if ($post->contact_for_price == 1) {
            $price = lang_key('contact_for_price');
        } else {
            $price = show_price($post->price);
        }
        ?>
			<!-- Blog meta -->
			<div class="blog-meta">
				<!-- Date -->
				<i class="fa fa-money"></i> &nbsp; <?php 
        echo $price;
        ?>
 &nbsp;
				<!-- Author -->
				<a href="<?php 
        echo site_url('show/categoryposts/' . $post->parent_category . '/' . dbc_url_title(lang_key(get_category_title_by_id($post->parent_category))));
        ?>
"><i class="fa <?php 
        echo get_category_fa_icon($post->parent_category);
Exemplo n.º 17
0
:</span>
                        <span class="span-right">
						    	<?php 
echo get_location_name_by_id($post->city);
?>
                        </span>
                                    </div>

                                    <div class="ad-detail-info">
                                        <span class="span-left"><i class="fa fa-money"></i> <?php 
echo lang_key('price');
?>
:</span>
                        <span class="span-right">
						    	<?php 
echo show_price($post->price);
?>
                        </span>
                                    </div>

                                    <div class="ad-detail-info">
                                        <span class="span-left"><i class="fa fa-eye"></i> <?php 
echo lang_key('views');
?>
:</span>
                        <span class="span-right">
						    	<?php 
echo $post->total_view;
?>
                        </span>
                                    </div>
Exemplo n.º 18
0
Arquivo: totals.php Projeto: gblok/rsc
while ($r = db_fetch_row($q)) {
    $a += $r[0];
    $n++;
}
$total["orders_yesterday"] = $n;
$total["revenue_yesterday"] = show_price($a, $currtransform);
$THISMONTH = "{$y}-{$m}-01 00:00:00";
$q = db_query("select order_amount, currency_value from " . ORDERS_TABLE . " where statusID > 1 and order_time > '" . $THISMONTH . "'");
$n = 0;
$a = 0;
while ($r = db_fetch_row($q)) {
    $a += $r[0];
    $n++;
}
$total["orders_thismonth"] = $n;
$total["revenue_thismonth"] = show_price($a, $currtransform);
// --- PRODUCTS ---
$q = db_query("select count(*) from " . PRODUCTS_TABLE);
$r = db_fetch_row($q);
$total["products"] = $r[0];
$q = db_query("select count(*) from " . PRODUCTS_TABLE . " where Enabled=1");
$r = db_fetch_row($q);
$total["products_enabled"] = $r[0];
/*if (CONF_CHECKSTOCK)
  {
          $q = db_query("select count(*) from ".PRODUCTS_TABLE." where Enabled=1 and in_stock <= 0");
          $r = db_fetch_row($q);
          $total["products_outofstock"] = $r[0];
  }*/
$q = db_query("select todayp, todayv, allp, allv from " . COUNTER_TABLE . " WHERE tbid=1");
$n = db_fetch_row($q);
        }
        $k += $price;
        $cnt += $quantity;
    }
} elseif (isset($_SESSION["gids"])) {
    //...session vars
    for ($i = 0; $i < count($_SESSION["gids"]); $i++) {
        if (!$_SESSION["gids"][$i]) {
            continue;
        }
        $sum = db_phquery_fetch(DBRFETCH_FIRST, "SELECT Price FROM ?#PRODUCTS_TABLE WHERE productID=?", $_SESSION["gids"][$i]);
        foreach ($_SESSION["configurations"][$i] as $var) {
            $sum += db_phquery_fetch(DBRFETCH_FIRST, "SELECT price_surplus FROM ?#PRODUCTS_OPTIONS_SET_TABLE WHERE variantID=? AND productID=?", $var, $_SESSION["gids"][$i]);
        }
        if ($_SESSION["sample"][$i]) {
            $quantity = 1;
            $q_sample_price = db_phquery('SELECT sample_price FROM SC_categories WHERE categoryID=(SELECT categoryID FROM SC_products WHERE productID=?)', $_SESSION["gids"][$i]);
            $sample_price = db_fetch_assoc($q_sample_price);
            $sum = $sample_price["sample_price"];
        } else {
            $quantity = $_SESSION["counts"][$i];
        }
        $k += $quantity * $sum;
        $cnt += $quantity;
    }
}
$d = oaGetDiscountValue(cartGetCartContent(), is_null($customerEntry) ? null : $customerEntry->Login);
$k = $k - $d;
$smarty->assign("shopping_cart_value", $k);
$smarty->assign("shopping_cart_value_shown", show_price($k));
$smarty->assign("shopping_cart_items", $cnt);
Exemplo n.º 20
0
function pricessCategories($parent, $level)
{
    //same as processCategories(), except it creates a pricelist of the shop
    $out = array();
    $cnt = 0;
    $sql = '
        SELECT
        categoryID,
        name,
        uri
        FROM ' . CATEGORIES_TABLE . '
        WHERE parent= ' . (int) $parent . '
        ORDER BY sort_order, name';
    $q1 = db_query($sql);
    while ($row = db_fetch_row($q1)) {
        $r = hexdec(substr('999999', 0, 2));
        $g = hexdec(substr('999999', 2, 2));
        $b = hexdec(substr('999999', 4, 2));
        $m = (double) max($r, max($g, $b));
        $r = round((190 + 20 * min($level, 3)) * $r / $m);
        $g = round((190 + 20 * min($level, 3)) * $g / $m);
        $b = round((190 + 20 * min($level, 3)) * $b / $m);
        $c = dechex($r) . dechex($g) . dechex($b);
        //final color
        //add category to the output
        $out[$cnt][0] = $row[0];
        $out[$cnt][1] = $row[1];
        $out[$cnt][2] = $level;
        $out[$cnt][3] = 1;
        $out[$cnt][4] = 0;
        //0 is for category, 1 - product
        $out[$cnt]['url'] = fu_make_url($row);
        $cnt++;
        if (!isset($_GET["sort"])) {
            $order_clause = "order by " . CONF_DEFAULT_SORT_ORDER . "";
        } else {
            //verify $_GET["sort"]
            if (!(!strcmp($_GET["sort"], "name") || !strcmp($_GET["sort"], "Price") || !strcmp($_GET["sort"], "customers_rating"))) {
                $_GET["sort"] = "name";
            }
            $order_clause = " order by " . xEscSQL($_GET["sort"]);
            if (isset($_GET["direction"])) {
                if (!strcmp($_GET["direction"], "DESC")) {
                    $order_clause .= " DESC ";
                } else {
                    $order_clause .= " ASC ";
                }
            }
        }
        //add products
        //        Price,
        //        in_stock,
        $sql = '

            SELECT
            productID,
            name,
            product_code,
            uri,
            uri_opt_val,
            categoryID
             ' . convert_prices() . '
            FROM ' . PRODUCTS_TABLE . '
            WHERE categoryID=' . $row[0] . ' AND Price > 0 AND enabled=1 ' . $order_clause;
        $q = db_query($sql);
        while ($row1 = db_fetch_row($q)) {
            if ($row1['Price'] < 0) {
                $cennik = "n/a";
                $row1['Price'] = "n/a";
            } else {
                $cennik = show_price($row1['Price']);
                $row1['Price'] = show_price($row1['Price'], 0, false);
            }
            $out[$cnt][0] = $row1['productID'];
            $out[$cnt][1] = $row1['name'];
            $out[$cnt][2] = $level;
            $out[$cnt][3] = "FFFFFF";
            $out[$cnt][4] = 1;
            //0 is for category, 1 - product
            $out[$cnt][5] = $cennik;
            $out[$cnt][6] = $row1['in_stock'];
            $out[$cnt][7] = $row1['product_code'];
            $out[$cnt][8] = $row1['Price'];
            $out[$cnt]['url'] = fu_make_url($row1);
            $cnt++;
        }
        //process all subcategories
        $sub_out = pricessCategories($row[0], $level + 1);
        //add $sub_out to the end of $out
        $c_sub_out = count($sub_out);
        for ($j = 0; $j < $c_sub_out; $j++) {
            $out[] = $sub_out[$j];
            $cnt++;
        }
    }
    return $out;
}
Exemplo n.º 21
0
function getOrderSummarize($shippingMethodID, $paymentMethodID, $shippingAddressID, $billingAddressID, $shippingModuleFiles, $paymentModulesFiles, $shServiceID = 0)
{
    // result this function
    $sumOrderContent = array();
    $q = db_query('select email_comments_text from ' . PAYMENT_TYPES_TABLE . ' where PID=' . (int) $paymentMethodID);
    $payment_email_comments_text = db_fetch_row($q);
    $payment_email_comments_text = $payment_email_comments_text[0];
    $q = db_query('select email_comments_text from ' . SHIPPING_METHODS_TABLE . ' where SID=' . (int) $shippingMethodID);
    $shipping_email_comments_text = db_fetch_row($q);
    $shipping_email_comments_text = $shipping_email_comments_text[0];
    $cartContent = cartGetCartContent();
    $pred_total = oaGetClearPrice($cartContent);
    if (isset($_SESSION['log'])) {
        $log = $_SESSION['log'];
    } else {
        $log = null;
    }
    $d = oaGetDiscountPercent($cartContent, $log);
    $discount = $pred_total / 100 * $d;
    // ordering with registration
    if ($shippingAddressID != 0 || isset($log)) {
        $addresses = array($shippingAddressID, $billingAddressID);
        $shipping_address = regGetAddressStr($shippingAddressID);
        $billing_address = regGetAddressStr($billingAddressID);
        $shaddr = regGetAddress($shippingAddressID);
        $sh_firstname = $shaddr['first_name'];
        $sh_lastname = $shaddr['last_name'];
    } else {
        if (!isset($_SESSION['receiver_countryID']) || !isset($_SESSION['receiver_zoneID'])) {
            return NULL;
        }
        $shippingAddress = array('countryID' => $_SESSION['receiver_countryID'], 'zoneID' => $_SESSION['receiver_zoneID']);
        $billingAddress = array('countryID' => $_SESSION['billing_countryID'], 'zoneID' => $_SESSION['billing_zoneID']);
        $addresses = array($shippingAddress, $billingAddress);
        $shipping_address = quickOrderGetReceiverAddressStr();
        $billing_address = quickOrderGetBillingAddressStr();
        $sh_firstname = $_SESSION['receiver_first_name'];
        $sh_lastname = $_SESSION['receiver_last_name'];
    }
    foreach ($cartContent['cart_content'] as $key => $cartItem) {
        // if conventional ordering
        if ($shippingAddressID != 0) {
            $productID = GetProductIdByItemId($cartItem['id']);
            $cartItem['tax'] = taxCalculateTax($productID, $addresses[0], $addresses[1]);
        } else {
            $productID = $cartItem['id'];
            $cartItem['tax'] = taxCalculateTax2($productID, $addresses[0], $addresses[1]);
        }
        if (!empty($cartItem['opt_margin']) && $paymentMethodID == 2) {
            $cost = $cartItem['costUC'];
            $margin = $cost / 100 * CONF_PERCENT_MARGIN;
            $cost += $margin;
            $costShow = show_price($cost * $cartItem['quantity']);
            $pred_total += $margin * $cartItem['quantity'];
            $cartContent['cart_content'][$key]['costUC'] = $cost;
            $cartContent['cart_content'][$key]['cost'] = $costShow;
            $cartItem['costUC'] = $cost;
            $cartItem['cost'] = $costShow;
        }
        $sumOrderContent[] = $cartItem;
    }
    $shipping_method = shGetShippingMethodById($shippingMethodID);
    if (!$shipping_method) {
        $shipping_name = '-';
    } else {
        $shipping_name = $shipping_method['Name'];
    }
    $payment_method = payGetPaymentMethodById($paymentMethodID);
    if (!$payment_method) {
        $payment_name = '-';
    } else {
        $payment_name = $payment_method['Name'];
    }
    //do not calculate tax for this payment type!
    if (isset($payment_method['calculate_tax']) && (int) $payment_method['calculate_tax'] == 0) {
        foreach ($sumOrderContent as $key => $val) {
            $sumOrderContent[$key]['tax'] = 0;
        }
        $orderDetails = array('first_name' => $sh_firstname, 'last_name' => $sh_lastname, 'email' => '', 'order_amount' => oaGetOrderAmountExShippingRate($cartContent, $addresses, $log, FALSE, $shServiceID));
        $tax = 0;
        $total = oaGetOrderAmount($cartContent, $addresses, $shippingMethodID, $log, $orderDetails, FALSE, $shServiceID);
        $shipping_cost = oaGetShippingCostTakingIntoTax($cartContent, $shippingMethodID, $addresses, $orderDetails, FALSE, $shServiceID);
    } else {
        $orderDetails = array('first_name' => $sh_firstname, 'last_name' => $sh_lastname, 'email' => '', 'order_amount' => oaGetOrderAmountExShippingRate($cartContent, $addresses, $log, FALSE));
        $tax = oaGetProductTax($cartContent, $d, $addresses);
        $total = oaGetOrderAmount($cartContent, $addresses, $shippingMethodID, $log, $orderDetails, TRUE, $shServiceID);
        $shipping_cost = oaGetShippingCostTakingIntoTax($cartContent, $shippingMethodID, $addresses, $orderDetails, TRUE, $shServiceID);
    }
    $tServiceInfo = null;
    if (is_array($shipping_cost)) {
        $_T = array_shift($shipping_cost);
        $tServiceInfo = $_T['name'];
        $shipping_cost = $_T['rate'];
    }
    $payment_form_html = '';
    $paymentModule = modGetModuleObj($payment_method['module_id'], PAYMENT_MODULE);
    if ($paymentModule) {
        $order = array();
        $address = array();
        if ($shippingAddressID != 0) {
            $payment_form_html = $paymentModule->payment_form_html(array('BillingAddressID' => $billingAddressID));
        } else {
            $payment_form_html = $paymentModule->payment_form_html(array('countryID' => $_SESSION['billing_countryID'], 'zoneID' => $_SESSION['billing_zoneID'], 'first_name' => $_SESSION['billing_first_name'], 'last_name' => $_SESSION['billing_last_name'], 'city' => $_SESSION['billing_city'], 'address' => $_SESSION['billing_address']));
        }
    }
    return array('sumOrderContent' => $sumOrderContent, 'discount' => $discount, 'discount_percent' => $d, 'discount_show' => show_price($discount), 'pred_total_disc' => show_price($pred_total * ((100 - $d) / 100)), 'pred_total' => show_price($pred_total), 'totalTax' => show_price($tax), 'totalTaxUC' => $tax, 'shipping_address' => $shipping_address, 'billing_address' => $billing_address, 'shipping_name' => $shipping_name, 'payment_name' => $payment_name, 'shipping_cost' => show_price($shipping_cost), 'shipping_costUC' => $shipping_cost, 'payment_form_html' => $payment_form_html, 'total' => show_price($total), 'totalUC' => $total, 'payment_email_comments_text' => $payment_email_comments_text, 'shipping_email_comments_text' => $shipping_email_comments_text, 'orderContentCartProductsCount' => count($sumOrderContent), 'shippingServiceInfo' => $tServiceInfo);
}
 function prepare_map_json_from_query($query)
 {
     $CI = get_instance();
     $data = array();
     $posts = array();
     $i = 0;
     foreach ($query->result() as $row) {
         $i++;
         $post = array();
         $post['post_id'] = $row->id;
         $post['post_title'] = get_post_data_by_lang($row, 'title');
         $post['post_purpose'] = $row->purpose;
         $post['featured_image_url'] = get_featured_photo_by_id($row->featured_img);
         $post['latitude'] = $row->latitude;
         $post['longitude'] = $row->longitude;
         $post['price'] = show_price($row->price);
         $post['post_short_address'] = get_location_name_by_id($row->city);
         $post['detail_link'] = post_detail_url($row);
         $post['parent_category'] = get_category_title_by_id($row->parent_category);
         $post['fa_icon'] = get_category_fa_icon($row->parent_category);
         if ($i % 3 == 1) {
             $color = "#ed5441";
         } else {
             if ($i % 3 == 2) {
                 $color = "#51d466";
             } else {
                 $color = "#609cec";
             }
         }
         $post['fa_color'] = $color;
         array_push($posts, $post);
     }
     $data['posts'] = $posts;
     return $data;
 }
Exemplo n.º 23
0
                    </div>
                    <div class="caption" style="padding: 5px !important;">
                       
                     <span class="property-title OS_new-t"><?php 
        echo character_limiter($title, 20);
        ?>
</span>
                        <div class="clearfix"></div>
                        
                        <p class="estate-description-car no_pad"><i class="fa fa-map-marker OS_map-icon"></i><?php 
        echo lang_key(get_location_name_by_id($row->city)) . ', ' . lang_key(get_location_name_by_id($row->state)) . ', ' . lang_key(get_location_name_by_id($row->country));
        ?>
</p>           
                        <div class="clearfix"></div>
                        <span class="property-price" style=""><?php 
        echo show_price($row->total_price);
        ?>
</span>
                    </div>
                    <div class="clearfix"></div>
                </div>
                <?php 
    }
    ?>
                
        </div>
        <div class="view-more"><a class="" href="<?php 
    echo site_url('show/properties/top/plainkey');
    ?>
"><?php 
    echo lang_key('view_all');
Exemplo n.º 24
0
if (isset($productID) && $productID > 0 && !isset($_POST["add_topic"]) && !isset($_POST["discuss"])) {
    $product = GetProduct($productID);
    if (!$product || $product["enabled"] == 0) {
        header("HTTP/1.0 404 Not Found");
        header("HTTP/1.1 404 Not Found");
        header("Status: 404 Not Found");
        die(ERROR_404_HTML);
    } else {
        if (!isset($_GET["vote"])) {
            IncrementProductViewedTimes($productID);
        }
        $dontshowcategory = 1;
        $smarty->assign("main_content_template", "product_detailed.tpl");
        $a = $product;
        if ((double) $a["shipping_freight"] > 0) {
            $a["shipping_freightUC"] = show_price($a["shipping_freight"]);
        }
        if (isset($_GET["picture_id"])) {
            $picture = db_query("select filename, thumbnail, enlarged from " . PRODUCT_PICTURES . " where photoID=" . (int) $_GET["picture_id"]);
            $picture_row = db_fetch_row($picture);
        } else {
            if (!is_null($a["default_picture"])) {
                $picture = db_query("select filename, thumbnail, enlarged from " . PRODUCT_PICTURES . " where photoID=" . (int) $a["default_picture"]);
                $picture_row = db_fetch_row($picture);
            } else {
                $picture = db_query("select filename, thumbnail, enlarged, photoID from " . PRODUCT_PICTURES . " where productID=" . $productID);
                if ($picture_row = db_fetch_row($picture)) {
                    $a["default_picture"] = $picture_row["photoID"];
                } else {
                    $picture_row = null;
                }
Exemplo n.º 25
0
 function room_price_info()
 {
     //print_r($this->input->post('children')); exit;
     $room_id = $this->input->post('room_id');
     $options = json_decode($this->input->post('options'), true);
     $start = $options['checkin'];
     $adults = $options['adults'];
     $rate = $options['currency_rate'];
     $discount = $this->input->post('discount');
     $child_ages = json_decode($this->input->post('children'));
     //get prices for 7 days
     $prices = $this->front_model->get_room_price_for_chart($start, $room_id);
     if ($adults == 1) {
         $type = 'single_price';
     } elseif ($adults == 2) {
         $type = 'double_price';
     } elseif ($adults >= 3) {
         $type = 'triple_price';
     }
     $data = array();
     foreach ($prices as $key => $p) {
         $total_child_price = 0;
         $adult_price = 0;
         //if price is unit price
         if (isset($p['price_type']) and $p['price_type'] == 1) {
             $adult_price += $p['base_price'];
         } else {
             //if adults more than 3
             if ($this->adults >= 4) {
                 $total_adult = $this->adults - 3;
                 $total_adult_price = $total_adult * $p['extra_adult'];
                 $adult_price += $p['triple_price'];
                 $adult_price += $total_adult_price;
             } else {
                 $adult_price += $p[$type];
             }
         }
         //calculate children prices
         if ($options['children'] != 0 and isset($p['child_price']) and count($child_ages) > 0) {
             $child_price = json_decode($p['child_price'], true);
             //print_r($child_price);
             foreach ($child_ages as $key => $age) {
                 $total_child_price += $this->get_child_price_by_age($age, $child_price);
             }
         }
         $total_price = $adult_price + $total_child_price;
         $data[$p['price_date']]['date'] = $p['price_date'];
         $price = $total_price - $total_price * $discount / 100;
         $data[$p['price_date']]['price'] = show_price($price, $rate);
     }
     //chart json data
     $chart_detail = '';
     $chart_data = array();
     foreach ($data as $date => $value) {
         $day = date('l', strtotime($date));
         $dayNum = date('d', strtotime($date));
         $class = ($day == 'Sunday' or $day == 'Saturday') ? 'weekend' : '';
         $class .= $date == date('Y-m-d') ? 'today' : '';
         $price = $value['price'];
         $ymd = date('Y-m-d', strtotime($date));
         $chart_data[$ymd] = array('dayAbr' => substr($day, 0, 1), 'dayNum' => $dayNum, 'date' => date('M d', strtotime($date)), 'ymd' => $ymd, 'price' => $price, 'cclass' => $class);
     }
     $start_date = $options['checkin'];
     $date_range = date_range($start_date, date('Y-m-d', strtotime('+30 day', strtotime($start_date))));
     $chart = array();
     foreach ($date_range as $key => $date) {
         $day = date('l', strtotime($date));
         $dayNum = date('d', strtotime($date));
         $class = ($day == 'Sunday' or $day == 'Saturday') ? 'weekend' : '';
         $class .= $date == date('Y-m-d') ? 'today' : '';
         if (!isset($chart_data[$date])) {
             $chart[] = array('dayAbr' => substr($day, 0, 1), 'dayNum' => $dayNum, 'date' => date('M d', strtotime($date)), 'price' => 0, 'cclass' => $class);
         } else {
             $chart[] = array('dayAbr' => substr($day, 0, 1), 'dayNum' => $dayNum, 'date' => date('M d', strtotime($date)), 'price' => $chart_data[$date]['price'], 'cclass' => $class);
         }
     }
     echo json_encode($chart);
     //google chart için datayuı şekillendir
     /*
     
     $rows = array();
     foreach ($data as $key => $value) {
     	$cell0["v"]=date('D-m-Y',strtotime($value['date']));
     	//$cell0["v"]=substr($cell0["v"], 0,-2);
     	$cell1["v"]=$value['price'];
     	$row["c"]=array($cell0,$cell1);
      	
      			array_push($rows,$row);
     	//$a['rows']['c'][] = array('v'=>array($value['date'])),array('v'=>array($value['price']));
     }
     
     
     $a['cols'] = array(array('label'=>'Day','type'=>'string'),array('label'=>'Price','type'=>'number'));
         	$a['rows'] = $rows;
     
     echo json_encode($a);
     */
 }
Exemplo n.º 26
0
    if ($InvoiceModule->is_installed()) {
        $smarty->assign('InvoiceModule', $InvoiceModule);
        $smarty->assign("invoice_description", str_replace("[orderID]", (string) $_GET["orderID"], $InvoiceModule->_getSettingValue('CONF_PAYMENTMODULE_INVOICE_PHYS_DESCRIPTION')));
    } else {
        //описание не опред
        die("Модуль оплаты по квитанциям не установлен");
    }
    //сумма квитанции
    $q = db_query("select order_amount_string from " . DB_PRFX . "_module_payment_invoice_phys where orderID=" . $_GET["orderID"]);
    $row = db_fetch_row($q);
    if ($row) {
        //сумма найдена в файле с описанием квитанции
        $smarty->assign("invoice_amount", $row[0]);
    } else {
        //сумма не найдена - показываем в текущей валюте
        $smarty->assign("invoice_amount", show_price($order["order_amount"]));
    }
} else {
    die("Заказ не найден в базе данных");
}
if ($_SERVER['SCRIPT_NAME'] === '/admin.php') {
    $html = $smarty->fetch('invoice_phys.tpl');
    /*
     require_once 'lib/dompdf/dompdf_config.inc.php';
     $dompdf = new DOMPDF(); // Создаем обьект
     $dompdf->load_html($html); // Загружаем в него наш html код
     $dompdf->render(); // Создаем из HTML PDF
     $dompdf->stream("hello.pdf", array('Attachment' => 0));
    */
    /*
          require_once 'lib/tcpdf/tcpdf.php';
Exemplo n.º 27
0
                $t = db_query($sql);
                $rr = db_fetch_row($t);
                $sum = priceСost((int) $_SESSION['gids'][$i], $rr['Price']);
                if (is_array($_SESSION['configurations'][$i])) {
                    foreach ($_SESSION['configurations'][$i] as $vars) {
                        $sql = '
                        SELECT
                        price_surplus
                        FROM ' . PRODUCTS_OPTIONS_SET_TABLE . '
                        WHERE variantID=' . (int) $vars . ' AND productID=' . (int) $_SESSION['gids'][$i];
                        $q1 = db_query($sql);
                        $r1 = db_fetch_row($q1);
                        $sum += $r1['price_surplus'];
                    }
                }
                $k += $_SESSION['counts'][$i] * $sum;
                $cnt += $_SESSION['counts'][$i];
            }
        }
    }
}
$cart = cartGetCartContent();
if (!empty($cart['cart_content'])) {
    $qty = 0;
    foreach ($cart['cart_content'] as $k => $v) {
        $qty += $v['quantity'];
    }
}
//$smarty->assign('shopping_cart_value', $k);
$smarty->assign('shopping_cart_value_shown', show_price($cart['total_price']));
$smarty->assign('shopping_cart_items', (int) $qty);
Exemplo n.º 28
0
function cart_info($options, $user_cart, $user_extras)
{
    $response = array();
    $response['extras']['total_user_price'] = 0;
    $response['extras']['total_price'] = 0;
    if ($user_cart) {
        $total_price = 0;
        $total_user_price = 0;
        $total_room = 0;
        foreach ($user_cart as $key => $cart) {
            $total_price += $cart['price'] * $cart['qty'] * $options['nights'];
            $total_user_price += $cart['user_price'] * $cart['qty'] * $options['nights'];
            $total_room += $cart['qty'];
        }
        $response['cart']['total_price'] = show_price($total_price);
        $response['cart']['total_user_price'] = show_price($total_user_price, $options['currency_rate']);
        $response['cart']['total_room'] = $total_room;
    }
    if ($user_extras) {
        $total_extra_price = 0;
        foreach ($user_extras as $key => $cart) {
            $total_extra_price += $cart['price'];
        }
        $response['extras']['total_price'] = show_price($total_extra_price);
        $response['extras']['total_user_price'] = show_price($total_extra_price, $options['currency_rate']);
    }
    $response['total_price'] = $response['cart']['total_price'] + $response['extras']['total_price'];
    $response['total_user_price'] = $response['cart']['total_user_price'] + $response['extras']['total_user_price'];
    return $response;
}
Exemplo n.º 29
0
            $is_expired = is_user_package_expired($row->created_by);
            if ($is_expired) {
                continue;
            }
        }
        $title = get_title_for_edit_by_id_lang($row->id, $curr_lang);
        $estate = array();
        $estate['estate_id'] = $row->id;
        $estate['estate_title'] = $title;
        $estate['featured_image_url'] = get_featured_photo_by_id($row->featured_img);
        $estate['latitude'] = $row->latitude;
        $estate['longitude'] = $row->longitude;
        $estate['estate_type'] = $row->type;
        $estate['estate_type_lang'] = lang_key($row->type);
        $estate['estate_status'] = $row->status;
        $estate['estate_price'] = show_price($row->total_price);
        $estate['estate_short_address'] = get_location_name_by_id($row->city) . ',' . get_location_name_by_id($row->state) . ',' . get_location_name_by_id($row->country);
        $estate['detail_link'] = site_url('property/' . $row->unique_id . '/' . dbc_url_title($title));
        array_push($estates, $estate);
    }
    $data['estates'] = $estates;
}
?>
<style>
    #pac-input-<?php 
echo $map_id;
?>
 {
        background-color: #fff;
        padding: 0 11px 0 13px;
        width: 400px;
Exemplo n.º 30
0
        ?>
</td>

                  <td data-title="<?php 
        echo lang_key('category');
        ?>
" class="numeric"><?php 
        echo get_category_title_by_id($row->category);
        ?>
</td>

                  <td data-title="<?php 
        echo lang_key('price');
        ?>
" class="numeric"><?php 
        echo show_price($row->price, $row->contact_for_price);
        ?>
</td>
                  
                  <td data-title="<?php 
        echo lang_key('city');
        ?>
" class="numeric"><?php 
        echo get_location_name_by_id($row->city);
        ?>
</td>
                  
                  <td data-title="<?php 
        echo lang_key('status');
        ?>
" class="numeric"><?php