|
Server : Apache/2.4.18 (Ubuntu) System : Linux canvaswebdesign 3.13.0-71-generic #114-Ubuntu SMP Tue Dec 1 02:34:22 UTC 2015 x86_64 User : oppastar ( 1041) PHP Version : 7.0.33-0ubuntu0.16.04.15 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, Directory : /var/www/laciasmara.com/public_html/shop/application/helpers/ |
Upload File : |
<?php
function count_cart_content()
{
$ci = &get_instance();
$count = 0;
foreach ($ci->cart->contents() as $item) {
$count = $count + $item['qty'];
}
return $count;
}
function get_brand_name($product_detail_id)
{
$ci = &get_instance();
$ci->db->select('product_id')->from('product_details')->where('id', $product_detail_id);
$product_id = $ci->db->get()->row()->product_id;
$ci->db->select('brand_id')->from('products')->where('id_products', $product_id);
$brand_id = $ci->db->get()->row()->brand_id;
$ci->db->select('brand')->from('brands')->where('id_brands', $brand_id);
$brand_name = $ci->db->get()->row()->brand;
return $brand_name;
}
function get_thumbnail($product_detail_id)
{
$ci = &get_instance();
//get thumbnail image
$ci->db->select('image')->from('product_images')->where('product_details_id', $product_detail_id)->limit(1)->order_by('priority', 'ASC');
$image = $ci->db->get()->row();
if (count($image) == 0 || empty($image->image)) {
//use placeholder image
$ci->db->select('image_not_available')->from('configuration')->where('id_configuration', 1);
$thumbnail = 'uploads/' . $ci->db->get()->row()->image_not_available;
} else {
$thumbnail = 'uploads/product/' . $image->image;
}
return $thumbnail;
}
function get_attribute_name($attribute_detail_ids)
{
$ci = &get_instance();
$attribute_detail_names = '';
foreach ($attribute_detail_ids as $index => $id) {
//get attribute detail name
if ($ci->session->userdata('site_lang') == 'english') {
$ci->db->select('attribute_detail_en as attribute_detail')->from('product_attributes_detail')->where('id', $id);
} else {
$ci->db->select('attribute_detail')->from('product_attributes_detail')->where('id', $id);
}
$attribute_detail_name = $ci->db->get()->row()->attribute_detail;
if ($index == 0) {
$attribute_detail_names = $attribute_detail_names . $attribute_detail_name;
} else {
$attribute_detail_names = $attribute_detail_names . '-' . $attribute_detail_name;
}
}
return $attribute_detail_names;
}