| Server IP : 103.48.194.25 / Your IP : 216.73.217.33 Web Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.33 System : Linux VMHostDefault 3.10.0-1160.42.2.el7.x86_64 #1 SMP Tue Sep 7 14:49:57 UTC 2021 x86_64 User : sieuthimay ( 1016) PHP Version : 8.2.20 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/pundarikanail.com-bk/site/helpers/ |
Upload File : |
<?php
/* cart function */
/*function map_product($obj)
{
$item = new stdClass;
$item->id = $obj->proid;
$item->name = $obj->pro_name;
$item->price = $obj->price;
$item->price_old = $obj->price_old;
$item->product_id = $obj->proid;
$item->variant_id = $obj->proid;
$item->variant_title = $obj->pro_name;
$item->vendor = $obj->pro_name;
$item->weight = $obj->weight;
$item->url = site."san-pham/".alias($obj->pro_name).'-'.$obj->proid.'.html';
$item->image = urlimg.'products/800/'.$obj->proimg;
return $item;
}*/
function map_product($rs,$quantity=1)
{
$obj = new stdClass();
$obj->id = $rs->proid;
$obj->shipping_status = "";
$obj->wait_to_ship_quantity = 0;
$obj->grams = 0;
$obj->weight = 0;
$obj->price = $rs->price;
$obj->line_price = 0;
$obj->price_original = 0;
$obj->line_price_orginal = 0;
$obj->product_id = $rs->proid;
$obj->quantity = $quantity;
$obj->requires_shipping = "";
$obj->sku = $rs->proid;
$obj->title = $rs->pro_name;
$obj->variant_id = $rs->proid;
$obj->variant_title = $rs->pro_name;
$obj->vendor = "";
$obj->name = $rs->pro_name;
$obj->gift_card = "";
$obj->total_discount = 0;
$obj->shipping_service = "";
$obj->product_exist = "";
$obj->image = urlimg."products/800/".$rs->proimg;
$obj->url = site."san-pham/".alias($rs->pro_name).'-'.$rs->proid.'.html';
$obj->promotion_ref = "";
$obj->promotion_by = array();
$obj->properties = new stdClass();
return $obj;
}
function cart_default()
{
$ses_cart['token'] = "";
$ses_cart['items'] = array();
$ses_cart['note'] = "";
$ses_cart['free_shipping'] = false;
$ses_cart['total_price'] = 0;
$ses_cart['total_weight'] = 0;
$ses_cart['item_count'] = 0;
$ses_cart['requires_shipping'] = false;
$ses_cart['sub_total_price'] = 0;
$ses_cart['total_line_item_price'] = "";
$ses_cart['discount'] = 0;
$ses_cart['shipping_fee'] = 30000;
$ses_cart['attributes'] = array();
$ses_cart['total'] = 0;
$ses_cart['payment_type'] = "";
$ses_cart['promo_code'] = "";
return $ses_cart;
}
function get_ses_cart()
{
$ses_cart = isset($_SESSION['cart'])? (!empty($_SESSION['cart']) ? $_SESSION['cart'] : cart_default()) : cart_default() ;
return $ses_cart;
}
?>