예제 #1
0
    public function __toString()
    {
        $fpp_order_product = new fpp_order_products_Model();
        $orm_op = $fpp_order_product->db2cls();
        $products = $orm_op->fetch_where(array('product_order' => $this->id_table));
        $string = "<table border=1>\n        <tr>\n          <th>Nombre</th>\n          <th>Detalle</th>\n          <th>Precio</th>\n          <th>Cantidad</th>\n          <th>Total</th>\n        </tr>      \n    ";
        $c = 0;
        foreach ($products as $product) {
            $wind = "wind_" . $c;
            $titles = array('lineas' => 'Texto del Chocolate', 'tarjeta' => 'Dedicatoria Adjunta', 'color_choco' => 'Color  de la letra del mensaje', 'description_product' => 'Descripcion de Producto', 'type_product' => 'Tipo de Producto');
            $detail = null;
            $array2str = @unserialize($product->product_extrainfo_order);
            if (is_array($array2str)) {
                foreach ($array2str as $title => $values) {
                    if ($title == 'lineas') {
                        $values = $this->decode($values);
                    }
                    if ($title == 'color_choco') {
                        $values = "<b>" . ucfirst($values) . "</b>";
                    }
                    if ($title != 'description_product') {
                        $titles[$title] = @$titles[$title];
                        $detail .= "<h4 style='color:red'>{$titles[$title]}</h4>" . $values;
                    }
                }
            }
            $string .= <<<EOF
        <tr>
          <td>{$product->product_name_order}</td>
          <td><a href="#" class="detailwn2" id="{$wind}">ver detalles</a>
            <div id="wndt_{$wind}" style="display:none;"><div style="color:black;">{$detail}</div></div></td>
          <td>{$product->product_price_order}</td>
          <td>{$product->product_qty_order}</td>
          <td>{$product->product_price_total_order}</td>
        </tr>  
EOF;
            $c++;
        }
        $string .= "</table>";
        //       $string = (string) ;
        return $string;
    }
예제 #2
0
 function refresh_prices_product(&$data = null, &$total = null, &$empty_cart = null, &$form_cart = null)
 {
     $data = array();
     $weightcart = 0;
     $total = 0;
     $empty_cart = true;
     $this->empty_cart = true;
     //echo "<pre>";print_r($_SESSION['conf']['cart']['product']);die();
     if (is_array(@$_SESSION['conf']['cart']['product'])) {
         foreach ($_SESSION['conf']['cart']['product'] as $id => $values) {
             $values['attr_addprices'] = isset($values['attr_addprices']) ? $values['attr_addprices'] : 0;
             $data[$id] = new stdClass();
             $product = $this->table->db2cls($id);
             $data[$id]->name = $product->name_product;
             $data[$id]->image = $product->image_product;
             $data[$id]->price = $product->price_offer_product > 0 ? $product->price_offer_product : $product->price_product;
             $data[$id]->price = $data[$id]->price + $values['attr_addprices'];
             $data[$id]->weight = $product->weight_product * $values['quantity'];
             $data[$id]->quantity = $values['quantity'];
             $data[$id]->delete = url::base() . $this->__("cart") . '/' . $this->__("delete") . '/id/' . $id;
             $data[$id]->subtotal = $values['quantity'] * $data[$id]->price;
             $total += $data[$id]->subtotal;
             $empty_cart = false;
             $this->empty_cart = false;
             Basic::currency($data[$id]->price);
             Basic::currency($data[$id]->subtotal);
             $_SESSION['conf']['cart']['product'][$id]['subtotal'] = $data[$id]->subtotal;
             $_SESSION['conf']['cart']['product'][$id]['weight'] = $data[$id]->weight;
             $_SESSION['conf']['cart']['product'][$id]['name_product'] = $product->name_product;
             $_SESSION['conf']['cart']['product'][$id]['price_product'] = $data[$id]->price;
             $_SESSION['conf']['cart']['product'][$id]['description_product'] = $product->description_product;
             $message_product = $this->Get_message_lines_ToStr($id);
             //Weight
             $weightcart = $data[$id]->weight + $weightcart;
             if ($this->order_id > 0) {
                 $opro = new fpp_order_products_Model();
                 $order_product = $opro->db2cls();
                 $savedb = array('product_order' => $this->order_id, 'product_id' => $id, 'product_name_order' => $product->name_product, 'product_qty_order' => $values['quantity'], 'product_price_order' => $data[$id]->price, 'product_price_total_order' => $data[$id]->subtotal, 'product_extrainfo_order' => $message_product);
                 $order_product->set_fields($savedb);
                 $order_product->save();
             }
         }
     }
     $form_cart = form::open(url::base() . $this->__("cart") . '/' . $this->__("executor") . '/');
     $_SESSION['conf']['cart']['subtotal_noformat'] = $total;
     Basic::currency($total);
     $_SESSION['conf']['cart']['subtotal'] = $total;
     $_SESSION['conf']['cart']['weight'] = $weightcart;
 }
예제 #3
0
 function check_order()
 {
     /* Load ID */
     $id_order = $this->uri->segment($this->__('check_order'));
     /* Load DB*/
     $fpp = new fpp_order_Model();
     $fpp_order_product = new fpp_order_products_Model();
     $orm = $fpp->db2cls();
     $orm_op = $fpp_order_product->db2cls();
     $record = $orm->load(array("id_order" => $id_order, 'client_id_client' => $this->id_client));
     $yr = date("Y");
     $order['fname'] = $record->product_name_order;
     $order['address'] = $record->product_address_order;
     $order['district_name'] = $record->product_district_order;
     $order['district_price_format'] = $record->delivery_price;
     $order['district_price_format'] = $record->delivery_price;
     $cart['subtotal'] = $record->subtotal_order;
     if ($record->message != '') {
         $_POST['attach'] = true;
     }
     /* Load Products In "cart" */
     $products = $orm_op->fetch_where(array('product_order' => $id_order));
     foreach ($products as $product) {
         $cart['product'][] = array('name_product' => $product->product_name_order, 'price_product' => $product->product_price_order, 'quantity' => $product->product_qty_order, 'subtotal' => $product->product_price_total_order);
     }
     $paymentinfo->title = $record->payment_title_order;
     $_POST['tarjeta_mensaje'] = $record->message;
     $_POST['fact_name'] = $record->facturacion_name;
     $_POST['fact_address'] = $record->facturacion_address;
     $_POST['fact_ruc'] = $record->facturacion_ruc;
     $this->content = View::factory("main/confirm")->set('check_order', true)->set("href_shipping", null)->set("cart_content", $cart)->set("order", $order)->set("errormsg", null)->set("paymentinfo", $paymentinfo)->set("comments", $record->product_infoextra_order)->set("select_day", basics::datetime2human($record->deliverydate, 'd/m/Y'))->set("select_month", null)->set("select_year", null)->set("select_hour", basics::datetime2human($record->deliverydate, 'H:i:s'))->set("select_mins", null)->set("select_merid", null)->set("total", $record->total_order)->set("select_turn", null)->render();
 }