function get_product_details() { $product_alias = $_GET["product_alias"]; $conn = connDB(); $get_info = mysql_query("\n\t\tSELECT * from tbl_product AS product INNER JOIN tbl_product_type AS p_type\n\t\tON product.id = p_type.product_id\n\t\tWHERE product_alias = '{$product_alias}' AND type_delete!='1'\n\t\tORDER BY type_order\n\t", $conn); if (mysql_num_rows($get_info) != null) { for ($counter = 1; $counter <= mysql_num_rows($get_info); $counter++) { $get_info_array = mysql_fetch_array($get_info); if ($counter == 1) { $data['collection_id'] = $get_info_array["collection_id"]; $data['product_id'] = $get_info_array["product_id"]; $data['product_category'] = $get_info_array["product_category"]; $data['product_name'] = $get_info_array["product_name"]; $data['product_size_type_id'] = $get_info_array["product_size_type_id"]; $data['product_alias'] = $get_info_array["product_alias"]; $data['page_title'] = $get_info_array["page_title"]; $data['page_description'] = $get_info_array["page_description"]; } $data['type_code'][$counter] = $get_info_array["type_code"]; $data['type_name'][$counter] = $get_info_array["type_name"]; $data['type_price'][$counter] = $get_info_array["type_price"]; $data['color_id'][$counter] = $get_info_array["color_id"]; $data['type_description'][$counter] = $get_info_array["type_description"]; $data['type_weight'][$counter] = $get_info_array["type_weight"]; //$type_image[$counter] = $get_info_array["type_image"]; $data['type_code'][$counter] = $get_info_array["type_code"]; $data['type_id'][$counter] = $get_info_array["type_id"]; $data['product_image'][$counter] = get_product_image($data['type_id'][$counter]); $data['quantity'][$counter] = get_type_quantity($data['type_id'][$counter], $counter); } } $data['total_type'] = $counter - 1; return $data; }
/** * 上传图片 * @author huajie <*****@*****.**> */ public function uploadPicture() { /* 返回标准数据 */ $return = array('status' => 1, 'info' => '上传成功', 'data' => ''); /* 调用文件上传组件上传文件 */ $Picture = D('Picture'); $pic_driver = C('PICTURE_UPLOAD_DRIVER'); $info = $Picture->upload($_FILES, C('PICTURE_UPLOAD'), C('PICTURE_UPLOAD_DRIVER'), C("UPLOAD_{$pic_driver}_CONFIG")); //TODO:上传到远程服务器 /* 记录图片信息 */ if ($info) { $return['status'] = 1; $return = array_merge($info['download'], $return); } else { $return['status'] = 0; $return['info'] = $Picture->getError(); } //如果开启水印 if ($config['img_water_on'] == 2) { /*添加水印*/ $config['img_water_on'] = get_config('IMG_WATER_ON'); $config['img_water'] = get_product_image(get_config('IMG_WATER')); $config['img_water_postion'] = get_config('IMG_WATER_POSTION'); $img_path = '.' . $info['download']['path']; $image = new \Think\Image(); $image->open($img_path)->water('.' . $config['img_water'], $config['img_water_postion'])->save($img_path); } $this->ajaxReturn($return); }
function product($id, $url = null) { $total_products = $this->database->GetMaxProductID(); $url = $this->beautify($url, '_'); $result = $this->database->GetProductById($id); if ($result) { $next = $prev = 0; $this->GetNextPreviousIds($result['product_id'], $next, $prev, $total_products); $data['product'] = $result; $data['total_products'] = $total_products; $data['product_state'] = $result['product_state']; $data['next_id'] = product_url($this->database->GetProductById($next), false); $data['prev_id'] = product_url($this->database->GetProductById($prev), false); $data['small_stock'] = ""; $data['medium_stock'] = ""; $data['large_stock'] = ""; $data['xl_stock'] = ""; $data['size_chart'] = site_url($this->config->item('size_chart')); $data['images'] = get_product_image($result['product_id']); if ($result['product_count_small'] <= 0) { $data['small_stock'] = 'disabled'; } if ($result['product_count_medium'] <= 0) { $data['medium_stock'] = 'disabled'; } if ($result['product_count_large'] <= 0) { $data['large_stock'] = 'disabled'; } if ($result['product_count_xl'] <= 0) { $data['xl_stock'] = 'disabled'; } //Generate Suggestions $data['suggested_products'] = $this->GenerateSuggestions($result, 3); $data['recently_viewed'] = $this->GetRecentlyViewed(); $this->AddToRecentlyViewed($result); display('product', $data); } else { $data['heading'] = 'No Products Found'; $data['content'] = "I am sure, this has something to do with G-Man, anyways just go somewhere else, try some other product"; display('basic', $data); } }
$head = array(lang('name'), lang('value')); $ebay_url = 'http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item='; $item_title_str = str_replace(',', '<br/>', $order->item_title_str); $item_ids = explode(',', $order->item_id_str); $skus = explode(',', $order->sku_str); $qties = explode(',', $order->qty_str); $count = count($skus); $item_sku_html = ''; $item_sku_html .= "<div id='item_div_{$order->id}'>"; for ($i = 0; $i < $count; $i++) { $config = array('name' => 'submit', 'value' => lang('delete'), 'type' => 'button', 'onclick' => "delete_sku('sku_{$skus[$i]}');"); $item_sku_html .= "<div id='sku_{$skus[$i]}' style='margin-top: 5px;'>"; $qty = element($i, $qties); $item_sku_html .= '<input name="sku[]" type="hidden" value="' . $skus[$i] . '" />' . ' SKU: ' . (isset($skus[$i]) ? $skus[$i] . ' * ' . '<input type="text" name="qty[]" value="' . $qty . '" />' . ' (' . get_product_name($skus[$i]) . ')' : ''); $item_sku_html .= block_button($config) . '<br/>' . block_image(get_product_image($skus[$i])); $item_sku_html .= '</div>'; } $item_sku_html .= '</div>'; $product_info = <<<PRODUCT <div style='padding: 10px;'> {$item_sku_html} </div> PRODUCT; $data = array(array(lang('item_number'), $order->item_no), array(lang('item_id_str'), $order->item_id_str), array(lang('name'), $order->name), array(lang('buyer_id'), $order->buyer_id), array(lang('address_line_1'), $order->address_line_1), array(lang('address_line_2'), $order->address_line_2), array(lang('town_city'), $order->town_city), array(lang('state_province'), $order->state_province), array(lang('country'), $order->country), array(lang('zip_code'), $order->zip_code), array(lang('contact_phone_number'), $order->contact_phone_number), array(lang('is_register'), $order->is_register), array(lang('product_list'), $product_info), array(lang('net'), $order->net . '(' . $order->currency . ')'), array(lang('transaction_id'), $order->transaction_id), array(lang('description'), $order->descript), array(lang('ship_remark'), $order->ship_remark), array(lang('item_no'), $order->item_no)); $config = array('name' => 'sys_remark', 'value' => $order->sys_remark, 'cols' => 90, 'rows' => 3, 'readonly' => 'ture'); $data[] = array(lang('sys_remark'), form_textarea($config)); $options_status = array('waiting_for_testing' => lang('waiting_for_testing'), 'perfect' => lang('perfect'), 'repairing' => lang('repairing'), 'fixed' => lang('fixed'), 'beyond_repair' => lang('beyond_repair')); $options_cause = array('quality_problems' => lang('quality_problems'), 'address_unknown' => lang('address_unknown'), 'request_for_replacement' => lang('request_for_replacement'), 'customer_reject' => lang('customer_reject'), 'prohibit_importing' => lang('prohibit_importing'), 'address_not_arrived' => lang('address_not_arrived'), 'customer_removal' => lang('customer_removal'), 'unclaimed' => lang('unclaimed'), 'undeliverable' => lang('undeliverable'), 'customer_returned' => lang('customer_returned'), 'no_send' => lang('no_send'), 'other' => lang('other')); $data[] = array($this->block->generate_required_mark(lang('recommend_status')), form_dropdown('recommend_status', $options_status, 'waiting_for_testing')); $config = array('name' => 'recommend_no', 'id' => 'recommend_no', 'maxlength' => '90', 'size' => '35');