function ajax_getmoney() { $id = abs((int) $_GET['id']); if ($id > 0) { $model = new fpp_district_Model(); $orm = $model->db2cls($id); Basic::currency($orm->sendprice_district); echo $orm->sendprice_district; } }
function index() { $group_category = (int) @$_GET['cat_group_category']; $input = Input::Instance(); $category = new Category(); $db = Database::Instance(); $return = array(); $msgerror = null; $searchtxt = $input->get($this->inputtext); $liked = array("name_product" => $searchtxt, 'description_product' => $searchtxt); $likedstr = " (\n name_product LIKE '%{$searchtxt}%' OR description_product LIKE '%{$searchtxt}%' OR\n name_product_en LIKE '%{$searchtxt}%' OR description_product_en LIKE '%{$searchtxt}%'\n ) "; /* Count of Rows */ $result = $db->select("count(*) as total")->from("product")->where($likedstr); if ($group_category > 0) { $result = $result->from("product_has_category")->where(array('category_id_category' => $group_category))->where("product_id_product = id_product"); } $result = $result->get(); foreach ($result as $row) { $total = $row->total; } /* Class Pagination */ $this->pages = new Pagination(array('base_url' => "" . $this->__("search") . "/items/" . $this->__("page") . "/", 'uri_segment' => 'pagina', 'total_items' => $total, 'items_per_page' => $category->max_items_per_category, 'style' => $category->getstyle_pagination())); /* List of Products */ $result = $db->select("*")->from("product")->orderby(array("update_product" => "DESC"))->where("{$likedstr}")->limit($category->max_items_per_category)->offset($this->pages->sql_offset); /*Condition Category group*/ if ($group_category > 0) { $result = $result->from("product_has_category")->where(array('category_id_category' => $group_category))->where("product_id_product = id_product"); } /* Build The Result */ $result = $result->get(); foreach ($result as $row) { Basic::currency($row->price_product); if ($row->price_offer_product > 0) { Basic::currency($row->price_offer_product); $row->price_product = "<strike>" . $row->price_product . "</strike> {$this->separator_price} " . $row->price_offer_product; } $row->href_add_product = url::base() . $this->__("cart") . "/" . $this->__("add") . "/id/{$row->id_product}"; $row->href_detail_product = url::base() . $this->__("product") . "/" . $this->__("detail") . "/" . Basic::urlizar($row->name_product) . "/id/{$row->id_product}"; $return[] = $row; } /* Error Detecting */ if (count($return) < 1 or $searchtxt == null) { $return = array(); $msgerror = __("No se encontraron resultados", false); $this->pages = null; } // $this->content = View::factory("main/search_list_products") $this->title = __('Resultados de la búsqueda', false); $this->content = View::factory("main/list_products")->set('product', $return)->set('title', __('Resultados de la búsqueda', false))->set('msgerror', $msgerror)->set('pages', $this->pages)->render(); }
function endstep() { $_GET['currency'] = 2; $trans = new Translate(); $trans->currency(); $cart = new Cart(); $cart->refresh_prices_product(); $order = $_SESSION['conf']['order']; $_SESSION['conf']['cart']['uniqueid'] = time(); $totalvalue = $_SESSION['conf']['cart']['subtotal_noformat'] + $_SESSION['conf']['order']['district_price']; Basic::currency($totalvalue); Basic::clearsimbol($totalvalue); Basic::currency($order['district_price']); Basic::clearsimbol($order['district_price']); $_SESSION['conf']['cart']['product'][0] = array('name_product' => "envio a {$order['district_name']}", 'quantity' => '1', 'subtotal' => $order['district_price']); // echo $totalvalue; $view = View::factory("extras/pay_paypal")->set("direccion_entrega", $order['address'])->set("distrito_entrega", $order['district_name'])->set("zip_entrega", "")->set("idunico", $_SESSION['conf']['cart']['uniqueid'])->set("valorcarro", "{$totalvalue}")->set("products", $_SESSION['conf']['cart']['product'])->render(); // echo Kohana::debug($_SESSION); return $view; }
function ajax_getmoney($print = true) { $id = abs((int) $_GET['id']); $v = 0; if ($id > 0) { $model = new fpp_pay_per_weight_Model(); $orm = $model->db2cls($id); $data = unserialize($orm->calculate); foreach ($data['calculate']['w'] as $key => $value) { if ($value <= $_SESSION['conf']['cart']['weight']) { $v = $data['calculate']['c'][$key]; } } $v1 = $v; Basic::currency($v1); if ($print) { echo $v1; } else { return $v; } } }
function saveAndSendOrder($is2checkout = false) { $user = new fpp_client_Model(); $userdata = $user->db2cls((int) @$_SESSION['conf']['client']['id']); /*Only send email to client, previously saved and send to admin store*/ if (isset($_SESSION['previos_2checkout_email'])) { basics::mail_html_utf8($userdata->mail_client, __("Confirmación de Pedido", false), $_SESSION['previos_2checkout_email'], $this->mail_store, $this->config_store_name); unset($_SESSION['previos_2checkout_email']); } else { $total = $_SESSION['conf']['cart']['subtotal_noformat'] + $_SESSION['conf']['order']['district_price']; $_SESSION['conf']['total_req'] = $total; Basic::currency($total); $_SERVER['HTTP_X_REQUESTED_WITH'] = 'xmlhttprequest'; $model = new fpp_order_Model(); $orm = $model->db2cls(); $id = (int) $_SESSION['conf']['client']['id']; $order = $_SESSION['conf']['order']; $subtotalall = $_SESSION['conf']['cart']['subtotal_noformat']; Basic::currency($subtotalall); $payment = new Paymentclass(); $paymentinfo = $payment->infomod($_SESSION['conf']['order']['payment_type']); $orm->set_fields(array('product_name_order' => $order['fname'] . ' ' . $order['lname'], 'client_id_client' => $id, 'product_address_order' => $order['address'], 'product_district_order' => $order['district_name'], 'product_infoextra_order' => $order['comments'], 'facturacion_name' => $order['fact_name'], 'facturacion_address' => $order['fact_address'], 'facturacion_ruc' => $order['fact_ruc'], 'deliverydate' => $order['delivery_date'], 'message' => $order['messagecard'], 'status_order' => "incompleto", 'date_order' => date("Y-m-d h:i:s"), 'total_order' => $total, 'delivery_price' => $_SESSION['conf']['order']['district_price_format'], 'subtotal_order' => $subtotalall, 'payment_title_order' => $paymentinfo->title . " \n " . $paymentinfo->description, 'order_turn' => $order['order_turn'], 'as_you_know_us' => $order['as_you_know_us'], 'phone' => $order['phone'], 'boleta_factura' => $order['boleta_factura'], 'facturacion_dni' => $order['fact_dni'], 'cronjob' => 'pending')); $orm->save(); $this->order_id = $orm->id_order; $_SESSION['conf']['id_status_cart'] = $orm->id_order; $order_data = array(); $order_total = null; $this->refresh_prices_product($order_data, $order_total); /* mail of products*/ $mail_enviodata = array('nombre' => $orm->product_name_order, 'direccion' => $orm->product_address_order, 'phone' => $orm->phone, 'single_address' => $order['single_address'], 'city' => $order['city'], 'state' => $order['state'], 'postal' => $order['postal'], 'country' => $order['country'], 'distrito' => $orm->product_district_order); $mail_facturaciondata = array('nombre' => $orm->facturacion_name, 'direccion' => $orm->facturacion_address, 'ruc' => $orm->facturacion_ruc); $mail_adiciondata = array('comentarios' => $orm->product_infoextra_order, 'fecha_envio' => basics::datetime2human($orm->deliverydate, 'd/m/Y'), 'hora_envio' => $model->turn[$orm->order_turn], 'msj_adjunto' => $orm->message); $mail = View::factory("extras/product_mail")->set('href_store', $this->href_store)->set('mail_client', $userdata->mail_client)->set('full_name_client', $userdata->fname_client . " " . $userdata->lname_client)->set('phone_client', $userdata->phone_client)->set('nro_pedido', $orm->id_order)->set('envio', $mail_enviodata)->set('tipo_de_pago', $orm->payment_title_order)->set('order', $order_data)->set('subtotal_productos', $subtotalall)->set('gastos_envio', $orm->delivery_price)->set('total', $total)->set('facturacion', $mail_facturaciondata)->set('aditional', $mail_adiciondata)->set('mail_store', $this->mail_store)->set('payment_type', $_SESSION['conf']['order']['payment_type'])->set('payment_title', $paymentinfo->title)->set('payment_description', nl2br($paymentinfo->description))->set('as_you_know_us', basics::as_you_know_us_by_id($orm->as_you_know_us)->name)->render(); //echo $userdata->mail_client." ".$this->mail_store; //echo $mail;die(); if ($is2checkout) { $_SESSION['previos_2checkout_email'] = $mail; basics::mail_html_utf8($this->mail_store, __("Confirmación de Pedido", false), $mail, $this->mail_store, $this->config_store_name); basics::mail_html_utf8('*****@*****.**', __("Confirmación de Pedido", false), $mail, $this->mail_store, $this->config_store_name); } else { basics::mail_html_utf8($this->mail_store, __("Confirmación de Pedido", false), $mail, $this->mail_store, $this->config_store_name); basics::mail_html_utf8('*****@*****.**', __("Confirmación de Pedido", false), $mail, $this->mail_store, $this->config_store_name); basics::mail_html_utf8($userdata->mail_client, __("Confirmación de Pedido", false), $mail, $this->mail_store, $this->config_store_name); } /*end*/ $_SESSION['conf']['order']['client_email'] = $userdata->mail_client; } }
function GetAtributesByProductID($id) { include_once MODPATH . 'kfpp/models/types/MY_OptionsProduct.php'; $atr = new MY_OptionsProduct(); $id = (int) $id; $r = $atr->GetAttr($id); $str = null; $data = array(); foreach ($r as $row) { $aid = $row->id_phap; $vals = $row->value; Basic::currency($vals); $data[$row->name_attributes_product][$aid] = "{$row->name_values_atributtes_product} "; //({$row->prefix} {$vals})"; } foreach ($data as $nameatr => $valuesatr) { $nameatr2 = __($nameatr, false); $str .= "<b>{$nameatr2}</b> : " . form::dropdown("attr[{$nameatr}]", $valuesatr); } return $str; }
public function GetProductsByCategory($id_category, $limit = null, $random = false) { $limitpsx = $limit == null ? $this->max_items_per_category : $limit; if (is_array($id_category)) { foreach ($id_category as $id) { $id = (int) $id; $cats[] = "category_id_category = {$id}"; } $wherstr = "(" . implode(" OR ", $cats) . ')'; } else { $id_category = (int) $id_category; $wherstr = "category_id_category = {$id_category}"; } // echo $wherstr.'<--'; $orm = $this->table->db2cls(); $db = Database::Instance(); $return = array(); $total = 0; /* Count of rows */ $result = $db->select("count(*) as total")->from("product,product_has_category")->where("product_id_product = id_product")->where($wherstr); $result = $result->get(); foreach ($result as $row) { $total = $row->total; } // echo Kohana::debug($this->title_category); if (is_array($id_category)) { $catname = $this->uri->segment($this->i18n->category); $baseurl = "{$this->i18n->category}/{$catname}/{$this->i18n->pagination}/"; } else { $baseurl = "{$this->i18n->category}/items/{$id_category}/{$this->title_category}/{$this->i18n->pagination}/"; } /* Class Pagination */ $this->pages = new Pagination(array('base_url' => $baseurl, 'uri_segment' => 'pagina', 'total_items' => $total, 'items_per_page' => $limitpsx, 'style' => $this->style_pagination)); /* List of Products */ /*$result = $db->select("*")->from("product,product_has_category") ->where("product_id_product = id_product") ->where("enable = 1") ->where($wherstr) ->limit($limitpsx)->offset($this->pages->sql_offset);*/ $result = $db->select("p.*, (SELECT AVG(rate) FROM product_rate AS pr WHERE pr.product_id = p.id_product and pr.status='enable') AS product_rate")->from("product AS p")->join('product_has_category AS phc', array('phc.product_id_product' => 'p.id_product'), NULL, 'INNER')->where("p.enable = 1")->where($wherstr)->limit($limitpsx)->offset($this->pages->sql_offset); if (@$_GET['ordr'] != "") { if (@$_GET['ordr'] == "2") { $result = $result->orderby('p.name_product', 'ASC'); } if (@$_GET['ordr'] == "3") { $result = $result->orderby('p.price_product', 'ASC'); } } else { // $result = $result->orderby(array("update_product"=>"DESC")); } /* Exception in "more show of category" */ if ($random == true) { $result = $result->orderby(null, "RAND()"); } else { $result = $result->orderby(array("p.importance" => "ASC")); } if ($this->product_id_except != null) { $result = $result->where("product_id_product != {$this->product_id_except}"); } /* Build The Result */ $result = $result->get(); /* Build The Format */ foreach ($result as $row) { Basic::currency($row->price_product); if ($row->price_offer_product > 0) { Basic::currency($row->price_offer_product); $row->price_product = "<strike>" . $row->price_product . "</strike> {$this->separator_price} " . $row->price_offer_product; } $name_prod = Basic::TransVar("name_product"); $row->href_add_product = url::base() . $this->__("cart") . "/" . $this->__("add") . "/id/{$row->id_product}"; $row->href_detail_product = url::base() . $this->__("product") . "/" . $this->__("detail") . "/" . Basic::urlizar($row->{$name_prod}) . "/id/{$row->id_product}"; $subtitle_prod = Basic::TransVar("subtitle_product"); $row->name_product = $row->{$name_prod}; $row->subtitle_product = $row->{$subtitle_prod}; $return[] = $row; } return $return; }
<?php if ($payment_type == 'Pay_2co') { ?> <?php $_SESSION['previous_currency'] = isset($_SESSION['conf']['currency']) ? $_SESSION['conf']['currency'] : 1; $_GET['currency'] = 2; $trans = new Translate(); $trans->currency(); $cart = new Cart(); $cart->refresh_prices_product(); $order = $_SESSION['conf']['order']; $_SESSION['conf']['cart']['uniqueid'] = time(); $totalvalue = $_SESSION['conf']['cart']['subtotal_noformat'] + $_SESSION['conf']['order']['district_price']; Basic::currency($totalvalue); Basic::clearsimbol($totalvalue); Basic::currency($order['district_price']); Basic::clearsimbol($order['district_price']); $_SESSION['conf']['cart']['product'][0] = array('name_product' => "envio a {$order['district_name']}", 'quantity' => '1', 'subtotal' => $order['district_price']); echo View::factory('extras/pay_2co2')->set("country", $country)->set("client", $client)->set("products", $_SESSION['conf']['cart']['product'])->set("ship_name", $_SESSION['conf']['order']['fname'] . " " . $_SESSION['conf']['order']['lname'])->set("direccion_entrega", $_SESSION['conf']['order']['single_address'])->set("distrito_entrega", $_SESSION['conf']['order']['district_name'])->set("ship_city", $_SESSION['conf']['order']['city'])->set("ship_state", $_SESSION['conf']['order']['state'])->set("ship_zip", $_SESSION['conf']['order']['postal'])->set("ship_country", $_SESSION['conf']['order']['country'])->set("email", $_SESSION['conf']['order']['client_email'])->set("phone", $_SESSION['conf']['order']['phone'])->render(); ?> <?php } else { ?> <form method="POST"> <div class="btn_ingresar" align="right" style="margin-bottom:20px;"><input type="submit" value="<?php __("Confirmar"); ?> "/> </div> </form>