function wpsc_legacy_add_mp3_preview($product_id, &$product_data) { global $wpdb; // echo "<pre>".print_r($product_data,true)."</pre>"; if (function_exists('listen_button')) { $file_data = $wpdb->get_row("SELECT * FROM `" . WPSC_TABLE_PRODUCT_FILES . "` WHERE `id`='" . $product_data['file'] . "' LIMIT 1", ARRAY_A); if ($file_data != null) { echo listen_button($file_data['idhash'], $file_data['id']); } } }
function wpsc_legacy_add_mp3_preview($product_id, &$product_data) { global $wpdb; if (function_exists('listen_button')) { $file_data = $wpdb->get_row($wpdb->prepare("SELECT * FROM `" . WPSC_TABLE_PRODUCT_FILES . "` WHERE `id` = %d LIMIT 1", $product_data['file']), ARRAY_A); if ($file_data != null) { echo listen_button($file_data['idhash'], $file_data['id']); } } }
function nzshpcrt_getproductform($prodid) { global $wpdb, $nzshpcrt_imagesize_info, $current_user; /* * makes the product form * has functions inside a function */ //$sql = "SELECT * FROM `wp_product_list` WHERE `id`=$prodid LIMIT 1"; $sql = "SELECT wp_product_list.*, wp_product_files.width, wp_product_files.height, wp_product_files.mimetype FROM wp_product_list, wp_product_files WHERE wp_product_files.id=wp_product_list.file AND wp_product_list.id={$prodid} LIMIT 1"; $product_data = $wpdb->get_results($sql, ARRAY_A); $product = $product_data[0]; /* * for security reason add to url for hires images sid - last 6 simbols of idhash * */ $sql = "SELECT `idhash` FROM `wp_product_files` WHERE `id`=" . $product['file']; $idhash_data = $wpdb->get_results($sql, ARRAY_A); if ($idhash_data != null) { $idhash = "&sid=" . substr($idhash_data[0]['idhash'], -6); } $output = "<table>\n\r"; $output .= "<tr>\n\r"; $output .= "<td class='r'>"; $output .= "Автор: "; $output .= "</td>\n\r"; $output .= "<td>\n\r"; $output .= brandslist($product['brand']); $approved = 0; //pokazh($product,"product: "); //pokazh($current_user); if ($product['approved'] == '1') { $approved = " checked='checked'"; if (isset($current_user->wp_capabilities['administrator']) && $current_user->wp_capabilities['administrator'] == 1) { $output .= "<input type='checkbox' name='approved'" . $approved . "/> Утверждено."; } else { if (isset($current_user->wp_capabilities['editor']) && $current_user->wp_capabilities['editor'] == 1) { $output .= "<input type='checkbox' name='approved'" . $approved . "/> Утвержено."; } } $output .= "<div style='color:#669900'>Картинка находится в <b>хранилище банка</b></div>"; } elseif ($product['approved'] == '0') { $approved = ""; if (isset($current_user->wp_capabilities['administrator']) && $current_user->wp_capabilities['administrator'] == 1) { $output .= "<input type='checkbox' name='approved'" . $approved . "/> Утверждено."; } $output .= "<div style='color:#9900CC'>Картинка может находиться в <b>Рабочем столе</b></div>"; } else { $approved = ""; if (isset($current_user->wp_capabilities['administrator']) && $current_user->wp_capabilities['administrator'] == 1) { $output .= "<input type='checkbox' name='approved'" . $approved . "/> Утверждено."; } $output .= "<div style='color:#FF6600'>Картинка находится в <b>прихожей банка</b> в ожидании приёма</div>"; } $output .= "</td>\n\r"; $output .= "</tr>\n\r"; $output .= "<tr>\n\r"; $output .= "<td class='r'>"; $output .= "Название рисунка: "; $output .= "</td>\n\r"; $output .= "<td>"; $output .= "<input id='productnameedit' type='text' style='width:300px;' name='title' value='" . stripslashes($product['name']) . "' /> # <a href='" . SITEURL . "/?page_id=29&cartoonid=" . $product['id'] . "' target=_blank>" . $product['id'] . "</a>"; $output .= "</td>\n\r"; $output .= "</tr>\n\r"; $output .= "<tr>\n\r"; $output .= "<td class='r'>"; $output .= "Краткое описание: "; $output .= "</td>\n\r"; $output .= "<td>"; $output .= "<textarea id='productdescredit' name='description' cols='50' rows='4' >" . stripslashes($product['description']) . "</textarea>"; $output .= "</td>\n\r"; $output .= "</tr>\n\r"; $output .= "<tr>\n\r"; $output .= "<td class='r'>"; $output .= "Ключевые слова,<br />разделённые запятыми:<br>"; $output .= "<a href='" . SITEURL . "/ales/wordassociations/words.php?id=" . $product['id'] . "' target=_blank>добавить<br>ассоциаций</a>"; $output .= "</td>\n\r"; $output .= "<td>"; $output .= "<textarea id='tagsedit' name='additional_description' cols='50' rows='4' >" . stripslashes($product['additional_description']) . "</textarea>"; $output .= "</td>\n\r"; $output .= "</tr>\n\r"; $visible = ""; if ($product['visible'] == '1') { $visible = " checked='checked'"; } $output .= "<tr>\n\r"; $output .= "</tr>\n\r"; if (isset($current_user->wp_capabilities['administrator']) && $current_user->wp_capabilities['administrator'] == 1) { $output .= "<tr>\n\r"; $output .= "<td class='r'>"; $output .= "Видно всем:"; $output .= "</td>\n\r"; $output .= "<td>"; $output .= "<input type='checkbox' name='visible'" . $visible . "/> <span style='color:#999;'>Если выключить — не будет видно покупателям</span>"; $output .= "</td>\n\r"; $output .= "</tr>\n\r"; } $colored = ""; if ($product['color'] == '1') { $colored = " checked='checked' "; } $temadnya = ""; $istemadnya_sql = "SELECT * FROM `wp_item_category_associations` where `category_id` = '777' and `product_id` = " . $product['id']; //pokazh ($istemadnya_sql); $istemadnya = $wpdb->get_results($istemadnya_sql); if ($istemadnya != null) { $temadnya = " checked='checked' "; } //pokazh($istemadnya,"istemadnya: "); $not_for_sale = ""; if ($product['not_for_sale'] == '1') { $not_for_sale = " checked='checked' "; } $license1checked = ""; if ($product['l1_price'] != '0') { $license1checked = " checked='checked' "; } $license2checked = ""; if ($product['l2_price'] != '0') { $license2checked = " checked='checked' "; } $license3checked = ""; if ($product['l3_price'] != '0') { $license3checked = " checked='checked' "; } $output .= "<tr>\n\r"; $output .= "<td class='ralt'>"; $output .= "Цветной рисунок:"; $output .= "</td>\n\r"; $output .= "<td style='background-color:#FFFF33;'>"; $output .= "<input type='checkbox' name='colored'" . $colored . "/> <span style='color:#999;'>Отключите для ч/б рисунков</span>"; $output .= "</td>\n\r"; $output .= "</tr>\n\r"; $output .= "<tr>\n\r"; $output .= "<td class='r'>"; $output .= "Не для продажи:"; $output .= "</td>\n\r"; $output .= "<td>\n\r"; $output .= "<input type='checkbox' name='not_for_sale'" . $not_for_sale . "/> <span style='color:#999;'>Не продаётся, если включено</span>"; $output .= "</td>\n\r"; $output .= "</tr>\n\r"; $output .= "<tr>\n\r"; $output .= "<td>"; $basepath = str_replace("/wp-admin", "", getcwd()); if (file_exists($basepath . "/wp-content/plugins/wp-shopping-cart/product_images/" . $product['image'])) { $image_location = "product_images/" . $product['image']; } else { $image_location = "images/" . $product['image']; } $preview_location = "product_images/" . $product['image']; $icon_location = "images/" . $product['image']; $m_image_link = SITEURL . "/wp-content/plugins/wp-shopping-cart/" . $preview_location; $output .= "<a href='" . $m_image_link . "' target=_blank><img id='previewimage' src='" . SITEURL . "/wp-content/plugins/wp-shopping-cart/{$icon_location}' alt='" . TXT_WPSC_PREVIEW . "' title='" . TXT_WPSC_PREVIEW . "' /></a>"; $output .= "Ш х В: " . $product['width'] . "x" . $product['height'] . "<br>" . $product['mimetype']; $output .= "</td>\n\r"; $output .= "<td>\n\r"; $output .= categorylist($product['id']); /* if (isset($current_user->wp_capabilities['administrator']) && $current_user->wp_capabilities['administrator']==1) { $output .= categorylist($product['id']); } else { $output .= "После утверждения рисунка модераторами Категория может быть изменена администратором"; $output .= "<div style='display:none;'>".categorylist($product['id'])."</div>"; } */ $output .= "</td>\n\r"; $output .= "</tr>\n\r"; $output .= "<tr>\n\r"; $output .= "<td class='ralt'>"; $output .= "Тема дня::"; $output .= "</td>\n\r"; $output .= "<td class='lalt'>"; $output .= "<input type='checkbox' name='temadnya'" . $temadnya . "/> <span style='color:#999;'>считаю актуальной темой</span>"; $output .= "</td>\n\r"; $output .= "</tr>\n\r"; //if (isset($current_user->wp_capabilities['administrator']) && $current_user->wp_capabilities['administrator']==1){ $output .= "<tr>\n\r"; $output .= "<td class='r'>"; $output .= "Доступны лицензии:"; $output .= "</td>\n\r"; $output .= "<td>\n\r"; $output .= " Огр: <input id='license1' type='checkbox' name='license1'" . $license1checked . "> Станд: <input id='license2' type='checkbox' name='license2'" . $license2checked . "> Расш: <input id='license3' type='checkbox' name='license3'" . $license3checked . "><br />"; $output .= "</td>\n\r"; $output .= "</tr>\n\r"; //} $output .= "<tr>\n\r"; $output .= "<td colspan='2'>"; if (isset($current_user->wp_capabilities['administrator']) && $current_user->wp_capabilities['administrator'] == 1) { $output .= "<a href='admin.php?page=wp-shopping-cart/display-items.php&deleteid=" . $product['id'] . "' onclick='return conf();'><img src='../img/trash.gif' title='удалить'></a>"; } $output .= "<a href='admin.php?page=wp-shopping-cart/display-items.php&updateimage=" . $product['id'] . "' ><img src='" . SITEURL . "/img/reload.gif' title='Обновить иконку и слайд с водяными знаками'></a>"; $output .= " <a href='index.php?admin_preview=true&product_id=" . $product['id'] . $idhash . "' style='float: left;' ><img src='http://th.cartoonbank.ru/download.gif' title='Скачать оригинальный файл' /></a>"; $output .= "</td>\n\r"; $output .= "</tr>\n\r"; // download original image if ($product['file'] > 0) { if (is_numeric($product['file']) && $product['file'] > 0) { $file_data = $wpdb->get_results("SELECT * FROM `wp_product_files` WHERE `id`='" . $product['file'] . "' LIMIT 1", ARRAY_A); if ($file_data != null && $file_data[0]['mimetype'] == 'audio/mpeg' && function_exists('listen_button')) { $output .= " " . listen_button($file_data[0]['idhash']); } } $output .= "</td>\n\r"; $output .= "</tr>\n\r"; $output .= "<tr>\n\r"; $output .= "<td class='r'>"; $output .= "Заменить файл:"; $output .= "</td>\n\r"; $output .= "<td>\n\r"; $output .= "<input type='file' name='file' value='' /> <div style='color:#999;'>Это тот файл, ссылка на который<br />будет отправлена заказчику</div>"; $output .= "</td>\n\r"; $output .= "</tr>\n\r"; } $output .= "<tr>\n\r"; $output .= "<td>\n\r"; $output .= "</td>\n\r"; $output .= "<td>\n\r"; $output .= "<input type='hidden' name='prodid' value='" . $product['id'] . "' />"; $output .= "<input type='hidden' name='submit_action' value='edit' />"; $output .= "<br /><input type=\"button\" class='edit_button' style='padding:6px; background-color:#84DF88;' name='sendit' value='Сохранить изменения' onclick=\"checkthefieldsEditForm();\"/>"; if ($product['approved'] != '1' && isset($current_user->wp_capabilities['editor']) && $current_user->wp_capabilities['editor'] == 1) { $output .= "<br /><br /><br /><br /><a class='button' href='admin.php?page=wp-shopping-cart/display-items.php&deleteid=" . $product['id'] . "' onclick=\"return conf();\" ><img src='" . SITEURL . "/img/trash.gif'> стереть изображение!</a>"; } if ($product['approved'] == '1' && isset($current_user->wp_capabilities['administrator']) && $current_user->wp_capabilities['administrator'] == 1) { $output .= "<br /><br /><br /><br /><a class='button' href='admin.php?page=wp-shopping-cart/display-items.php&deleteid=" . $product['id'] . "' onclick=\"return conf();\" ><img src='" . SITEURL . "/img/trash.gif'> стереть изображение</a>"; } $output .= "</td>\n\r"; $output .= "</tr>\n\r"; $output .= "</table>\n\r"; // TODO: Remove before upload to the server! temp! local debug only! if ($_SERVER['SERVER_NAME'] == 'localhost') { $output = Utf8ToWin($output); } return $output; }
function wpsc_product_download_forms($product_data = '') { global $wpdb, $closed_postboxes; if ($product_data == 'empty') { $display = "style='display:none;'"; } $output = ''; $upload_max = wpsc_get_max_upload_size(); $output .= "<div id='wpsc_product_download_forms' class='postbox " . (array_search('wpsc_product_download_forms', $product_data['closed_postboxes']) !== false ? 'closed' : '') . "' " . (array_search('wpsc_product_download_forms', $product_data['hidden_postboxes']) !== false ? 'style="display: none;"' : '') . ">"; $output .= "<h3 class='hndle'>" . TXT_WPSC_PRODUCTDOWNLOAD . "</h3>"; $output .= "<div class='inside'>"; $output .= "<h4>" . TXT_WPSC_DOWNLOADABLEPRODUCT . ":</h4>"; $output .= "<input type='file' name='file' value='' /><br />" . TXT_WPSC_MAX_UPLOAD_SIZE . " : <span>" . $upload_max . "</span><br /><br />"; $output .= wpsc_select_product_file($product_data['id']) . "<br />"; if ($product_data['file'] > 0) { $output .= TXT_WPSC_PREVIEW_FILE . ": "; $output .= "<a class='admin_download' href='index.php?admin_preview=true&product_id=" . $product_data['id'] . "' ><img align='absmiddle' src='" . WPSC_URL . "/images/download.gif' alt='' title='' /><span>" . TXT_WPSC_CLICKTODOWNLOAD . "</span></a>"; $file_data = $wpdb->get_row("SELECT * FROM `" . WPSC_TABLE_PRODUCT_FILES . "` WHERE `id`='" . $product_data['file'] . "' LIMIT 1", ARRAY_A); if ($file_data != null && function_exists('listen_button')) { $output .= "" . listen_button($file_data['idhash'], $file_data['id']) . "<br style='clear: both;' /><br />"; } } if (function_exists("make_mp3_preview") || function_exists("wpsc_media_player")) { $output .= "<h4>" . __("Select an MP3 file to upload as a preview") . "</h4>"; $output .= "<input type='file' name='preview_file' value='' /><br />"; $output .= "<br />"; } $output .= "</div></div>"; return $output; }
function single_product_display($product_id) { global $wpdb; $siteurl = get_option('siteurl'); if (get_option('permalink_structure') != '') { $seperator = "?"; } else { $seperator = "&"; } // what is our product? if (is_numeric($product_id)) { $product_list = $wpdb->get_results("SELECT * FROM `" . $wpdb->prefix . "product_list` WHERE `id`='" . (int) $product_id . "' LIMIT 1", ARRAY_A); } // if we have a product if ($product_list != null) { // show the breadcrumbs if (get_option("show_breadcrumbs") == '1') { $output .= "<div class='breadcrumb'>\n\r"; $output .= " <a href='" . get_option('siteurl') . "'>" . get_option('blogname') . "</a> » "; $category = $wpdb->get_var("SELECT category_id FROM {$wpdb->prefix}item_category_associations WHERE product_id='" . $product_id . "' ORDER BY id ASC LIMIT 1"); $category_info = $wpdb->get_results("SELECT * FROM {$wpdb->prefix}product_categories WHERE id='" . $category . "'", ARRAY_A); $category_name = $wpdb->get_var("SELECT name FROM {$wpdb->prefix}product_categories WHERE id='" . $category . "'"); while ($category_info[0]['category_parent'] != 0) { $category_info = $wpdb->get_results("SELECT * FROM {$wpdb->prefix}product_categories WHERE id='" . $category_info[0]['category_parent'] . "'", ARRAY_A); $output .= "<a href='" . wpsc_category_url($category_info[0]['id']) . "'>" . $category_info[0]['name'] . "</a> » "; } $output .= "<a href='" . wpsc_category_url($category) . "'>" . $category_name . "</a> » "; $output .= $product_list[0]['name'] . "\n\r"; $output .= "</div>\n\r"; } $output .= " <div class='productdisplay'>\n\r"; foreach ((array) $product_list as $product) { $num++; $output .= " <div class='single_product_display product_view_{$product['id']} '>\n\r"; $output .= " <div class='textcol'>\n\r"; // display the image $output .= " <div class='imagecol'>\n\r"; if (get_option('show_thumbnails') == 1) { if ($product['image'] != null) { if ($product['thumbnail_image'] != null) { $image_file_name = $product['thumbnail_image']; } else { $image_file_name = $product['image']; } $output .= "<a href='" . WPSC_IMAGE_URL . $product['image'] . "' class='thickbox preview_link' rel='" . str_replace(" ", "_", $product['name']) . "'>\n\r"; $src = WPSC_IMAGE_URL . $product['image']; if (get_option('single_view_image_width') >= 1 && get_option('single_view_image_height') >= 1) { $output .= "<img src='index.php?productid=" . $product['id'] . "&width=" . get_option('single_view_image_width') . "&height=" . get_option('single_view_image_height') . "' title='" . $product['name'] . "' alt='" . $product['name'] . "' id='product_image_" . $product['id'] . "' class='product_image'/>\n\r"; } else { $output .= "<img src='" . WPSC_THUMBNAIL_URL . $image_file_name . "' title='" . $product['name'] . "' alt='" . $product['name'] . "' id='product_image_" . $product['id'] . "' class='product_image'/>\n\r"; } $output .= "</a>\n\r"; if (function_exists("gold_shpcrt_display_extra_images")) { $output .= gold_shpcrt_display_extra_images($product['id'], $product['name']); } } else { if (get_option('product_image_width') != '') { $output .= "<img src='" . WPSC_URL . "/no-image-uploaded.gif' title='" . $product['name'] . "' alt='" . $product['name'] . "' width='" . get_option('product_image_width') . "' height='" . get_option('product_image_height') . "' />\n\r"; } else { $output .= "<img src='" . WPSC_URL . "/no-image-uploaded.gif' title='" . $product['name'] . "' alt='" . $product['name'] . "' />\n\r"; } } } $output .= " </div>\n\r"; // if the product is special, say so if ($product['special'] == 1) { $special = " <span class='special'>" . TXT_WPSC_SPECIAL . " - </span>\n\r"; } $output .= " <form id='product_" . $product['id'] . "' name='{$num}' method='post' action='" . get_option('product_list_url') . $seperator . "category=" . $_GET['category'] . "' onsubmit='submitform(this);return false;' >\n\r"; $output .= "<input type='hidden' name='prodid' value='" . $product['id'] . "' />\n\r"; $output .= " <div class='producttext'>\n\r"; $output .= " <h2 class='prodtitles'>{$special}" . stripslashes($product['name']) . "</h2>\n\r"; if (get_option('wpsc_selected_theme') == 'market3') { $soldout = 0; if ($product['quantity_limited'] && $product['quantity'] < 1) { $soldout = 1; } if ($soldout) { $output .= " <span class='soldout'>Sold out</span>\n\r"; } else { $output .= " <span class='price'>" . nzshpcrt_currency_display($product['price'], $product['notax']) . "</span>\n\r"; } } ob_start(); do_action('wpsc_product_addons', $product['id']); $output .= ob_get_contents(); ob_end_clean(); if (is_numeric($product['file']) && $product['file'] > 0) { $file_data = $wpdb->get_row("SELECT * FROM `" . $wpdb->prefix . "product_files` WHERE `id`='" . $product['file'] . "' LIMIT 1", ARRAY_A); if ($file_data != null && function_exists('listen_button')) { $output .= listen_button($file_data['idhash'], $file_data['id']); } } if ($product['description'] != '') { $output .= " <p class='description'>" . nl2br(stripslashes($product['description'])) . "</p>\n\r"; } if (get_option('wpsc_selected_theme') == 'market3') { $output .= " <br />"; } if ($product['additional_description'] != '') { $output .= " <p class='single_additional_description' >\n\r"; if (get_option('wpsc_selected_theme') == 'market3') { $output .= " <span class='additional'>Additional Details: </span>\n\r"; } $output .= nl2br(stripslashes($product['additional_description'])) . ""; $output .= " </p>\n\r"; } // print the custom fields here, if there are any $custom_fields = $wpdb->get_results("SELECT * FROM `{$wpdb->prefix}wpsc_productmeta` WHERE `product_id` IN('{$product['id']}') AND `custom` IN('1') ", ARRAY_A); if (count($custom_fields) > 0) { $output .= " <div class='custom_meta'>\n\r"; foreach ((array) $custom_fields as $custom_field) { $output .= " <strong>{$custom_field['meta_key']}:</strong> {$custom_field['meta_value']} <br />\n\r"; } $output .= " </div>\n\r"; } ob_start(); do_action('wpsc_product_addon_after_descr', $product['id']); $output .= ob_get_contents(); ob_end_clean(); if (function_exists('wpsc_akst_share_link') && get_option('wpsc_share_this') == 1) { $output .= wpsc_akst_share_link('return'); } $variations_procesor = new nzshpcrt_variations(); $variations_output = $variations_procesor->display_product_variations($product['id'], false, false, true); if ($variations_output[0] != '') { //will always be set, may sometimes be an empty string $output .= " <p class='wpsc_variation_forms'>" . $variations_output[0] . "</p>"; } if ($variations_output[1] !== null) { $product['price'] = $variations_output[1]; } if (get_option('wpsc_selected_theme') != 'market3') { $output .= " <p class='wpsc_product_price'>"; if ($product['donation'] == 1) { $currency_sign_location = get_option('currency_sign_location'); $currency_type = get_option('currency_type'); $currency_symbol = $wpdb->get_var("SELECT `symbol_html` FROM `" . $wpdb->prefix . "currency_list` WHERE `id`='" . $currency_type . "' LIMIT 1"); $output .= " <label for='donation_price_" . $product['id'] . "'>" . TXT_WPSC_DONATION . ":</label> {$currency_symbol}<input type='text' id='donation_price_" . $product['id'] . "' name='donation_price' value='" . number_format($product['price'], 2) . "' size='6' /><br />"; } else { if (get_option('wpsc_selected_theme') != 'market3') { if ($product['special'] == 1 && $variations_output[1] === null) { $output .= "<span class='oldprice'>" . TXT_WPSC_PRICE . ": " . nzshpcrt_currency_display($product['price'], $product['notax']) . "</span><br />"; $output .= TXT_WPSC_PRICE . ": " . nzshpcrt_currency_display($product['price'] - $product['special_price'], $product['notax'], false, $product['id']) . "<br />"; } else { $output .= TXT_WPSC_PRICE . ": <span id='product_price_" . $product['id'] . "'>" . nzshpcrt_currency_display($product['price'], $product['notax']) . "</span><br />"; } // if(get_option('display_pnp') == 1) { // $output .= TXT_WPSC_PNP.": " . nzshpcrt_currency_display($product['pnp'], 1) . "<br />"; // } } } $output .= "</p>\n\r"; } if (function_exists('wpsc_theme_html')) { $wpsc_theme = wpsc_theme_html($product); } $output .= "<input type='hidden' name='item' value='" . $product['id'] . "' />"; //AND (`quantity_limited` = '1' AND `quantity` > '0' OR `quantity_limited` = '0' ) if ($product['quantity_limited'] == 1 && $product['quantity'] < 1 && $variations_output[1] === null) { if (get_option("wpsc_selected_theme") != 'market3') { $output .= "<p class='soldout'>" . TXT_WPSC_PRODUCTSOLDOUT . "</p>"; } } else { if (get_option('hide_addtocart_button') != 1 && get_option('addtocart_or_buynow') == 0) { if (isset($wpsc_theme) && is_array($wpsc_theme) && $wpsc_theme['html'] != '') { $output .= $wpsc_theme['html']; } else { $output .= "<input type='submit' id='product_" . $product['id'] . "_submit_button' class='wpsc_buy_button' name='Buy' value='" . TXT_WPSC_ADDTOCART . "' />"; } } } if (function_exists('gold_shpcrt_display_gallery')) { $output .= gold_shpcrt_display_gallery($product['id']); } if (get_option('product_ratings') == 1) { $output .= "<div class='product_footer'>"; $output .= "<div class='product_average_vote'>"; $output .= "<strong>" . TXT_WPSC_AVGCUSTREVIEW . ":</strong>"; $output .= nzshpcrt_product_rating($product['id']); $output .= "</div>"; $output .= "<div class='product_user_vote'>"; $vote_output = nzshpcrt_product_vote($product['id'], "onmouseover='hide_save_indicator(\"saved_" . $product['id'] . "_text\");'"); if ($vote_output[1] == 'voted') { $output .= "<strong><span id='rating_" . $product['id'] . "_text'>" . TXT_WPSC_YOURRATING . ":</span>"; $output .= "<span class='rating_saved' id='saved_" . $product['id'] . "_text'> " . TXT_WPSC_RATING_SAVED . "</span>"; $output .= "</strong>"; } else { if ($vote_output[1] == 'voting') { $output .= "<strong><span id='rating_" . $product['id'] . "_text'>" . TXT_WPSC_RATETHISITEM . ":</span>"; $output .= "<span class='rating_saved' id='saved_" . $product['id'] . "_text'> " . TXT_WPSC_RATING_SAVED . "</span>"; $output .= "</strong>"; } } $output .= $vote_output[0]; $output .= "</div>"; $output .= "</div>"; } $output .= " </div>\n\r"; $output .= " </form>\n\r"; if (count($updatelink_data) > 0 && $updatelink_data[0]['meta_value'] != '') { $output .= external_link($product['id']); } else { if (get_option('addtocart_or_buynow') == '1') { if (get_option('payment_gateway') == 'google') { $output .= google_buynow($product['id']); } else { if (get_option('payment_gateway') == 'paypal_multiple') { $output .= "<form onsubmit='log_paypal_buynow(this)' target='paypal' action='" . get_option('paypal_multiple_url') . "' method='post'>\n\t\t\t\t\t\t\t<input type='hidden' name='business' value='" . get_option('paypal_multiple_business') . "'>\n\t\t\t\t\t\t\t<input type='hidden' name='cmd' value='_xclick'>\n\t\t\t\t\t\t\t<input type='hidden' name='item_name' value='" . $product['name'] . "'>\n\t\t\t\t\t\t\t<input type='hidden' id='item_number' name='item_number' value='" . $product['id'] . "'>\n\t\t\t\t\t\t\t<input type='hidden' id='amount' name='amount' value='" . $product['price'] . "'>\n\t\t\t\t\t\t\t<input type='hidden' id='unit' name='unit' value='" . $product['price'] . "'>\n\t\t\t\t\t\t\t<input type='hidden' id='shipping' name='ship11' value='" . $shipping . "'>\n\t\t\t\t\t\t\t<input type='hidden' name='handling' value='" . get_option('base_local_shipping') . "'>\n\t\t\t\t\t\t\t<input type='hidden' name='currency_code' value='" . get_option('paypal_curcode') . "'>\n\t\t\t\t\t\t\t<input type='hidden' name='undefined_quantity' value='0'>\n\t\t\t\t\t\t\t<input type='image' name='submit' border='0' src='https://www.paypal.com/en_US/i/btn/btn_buynow_LG.gif' alt='PayPal - The safer, easier way to pay online'>\n\t\t\t\t\t\t\t<img alt='' border='0' width='1' height='1' src='https://www.paypal.com/en_US/i/scr/pixel.gif' >\n\t\t\t\t\t\t</form>\n\t\t\t\t\t"; } } } } $output .= " <form id='product_extra_" . $product['id'] . "' name='product_" . $product['id'] . "' method='post' action='" . get_option('product_list_url') . $seperator . "category=" . $_GET['category'] . "' onsubmit='submitform(this);return false;' >\n\r"; $output .= " <input type='hidden' name='prodid' value='" . $product['id'] . "' />\n\r"; $output .= " <input type='hidden' name='item' value='" . $product['id'] . "' />\n\r"; $output .= " </form>\n\r"; $output .= " </div>\n\r"; $output .= " </div>\n\r"; $output .= " <div class='clear'></div>\n\r"; } $output .= wpsc_also_bought($product_id); $output .= " </div>"; } else { // otherwise, we have no product $output .= "<p>" . TXT_WPSC_NOITEMSINTHIS . " " . $group_type . ".</p>"; } // replace dollar signs with the HTML code so that PHP doesn't try to interpret them as variables. $output = str_replace('$', '$', $output); return $output; }
function nzshpcrt_getproductform($prodid) { global $wpdb, $nzshpcrt_imagesize_info; $variations_processor = new nzshpcrt_variations(); /* * makes the product form * has functions inside a function */ function brandslist($current_brand = '') { global $wpdb; $options = ""; //$options .= "<option value=''>".TXT_WPSC_SELECTACATEGORY."</option>\r\n"; $values = $wpdb->get_results("SELECT * FROM `" . $wpdb->prefix . "product_brands` WHERE `active`='1' ORDER BY `id` ASC", ARRAY_A); $options .= "<option {$selected} value='0'>" . TXT_WPSC_SELECTABRAND . "</option>\r\n"; foreach ((array) $values as $option) { if ($current_brand == $option['id']) { $selected = "selected='selected'"; } $options .= "<option {$selected} value='" . $option['id'] . "'>" . $option['name'] . "</option>\r\n"; $selected = ""; } $concat .= "<select name='brand'>" . $options . "</select>\r\n"; return $concat; } function variationslist($current_variation = '') { global $wpdb; $options = ""; //$options .= "<option value=''>".TXT_WPSC_SELECTACATEGORY."</option>\r\n"; $values = $wpdb->get_results("SELECT * FROM `" . $wpdb->prefix . "product_variations` ORDER BY `id` ASC", ARRAY_A); $options .= "<option {$selected} value='0'>" . TXT_WPSC_PLEASECHOOSE . "</option>\r\n"; foreach ((array) $values as $option) { if ($current_brand == $option['id']) { $selected = "selected='selected'"; } $options .= "<option {$selected} value='" . $option['id'] . "'>" . $option['name'] . "</option>\r\n"; $selected = ""; } $concat .= "<select name='variations' onChange='edit_variation_value_list(this.options[this.selectedIndex].value)'>" . $options . "</select>\r\n"; return $concat; } $sql = "SELECT * FROM `" . $wpdb->prefix . "product_list` WHERE `id`={$prodid} LIMIT 1"; $product_data = $wpdb->get_results($sql, ARRAY_A); $product = $product_data[0]; $sql = "SELECT * FROM `" . $wpdb->prefix . "wpsc_productmeta` WHERE `product_id`={$prodid} AND meta_key='external_link' LIMIT 1"; $meta_data = $wpdb->get_results($sql, ARRAY_A); $product['external_link'] = $meta_data[0]['meta_value']; $sql = "SELECT * FROM `" . $wpdb->prefix . "wpsc_productmeta` WHERE `product_id`={$prodid} AND meta_key='merchant_notes' LIMIT 1"; $meta_data = $wpdb->get_results($sql, ARRAY_A); $product['merchant_notes'] = $meta_data[0]['meta_value']; $engrave = get_product_meta($prodid, 'engraved', true); $can_have_uploaded_image = get_product_meta($prodid, 'can_have_uploaded_image', true); if (function_exists('wp_insert_term')) { $term_relationships = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "term_relationships WHERE object_id = {$prodid}", ARRAY_A); foreach ((array) $term_relationships as $term_relationship) { $tt_ids[] = $term_relationship['term_taxonomy_id']; } foreach ((array) $tt_ids as $tt_id) { $results = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "term_taxonomy WHERE term_taxonomy_id = " . $tt_id . " AND taxonomy = 'product_tag'", ARRAY_A); $term_ids[] = $results[0]['term_id']; } foreach ((array) $term_ids as $term_id) { if ($term_id != NULL) { $results = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "terms WHERE term_id=" . $term_id . " ", ARRAY_A); $tags[] = $results[0]['name']; } } if ($tags != NULL) { $imtags = implode(',', $tags); } } $check_variation_value_count = $wpdb->get_var("SELECT COUNT(*) as `count` FROM `" . $wpdb->prefix . "variation_values_associations` WHERE `product_id` = '" . $product['id'] . "'"); $output .= " <table class='product_editform'>\n\r"; $output .= " <tr>\n\r"; $output .= " <td class='itemfirstcol'>\n\r"; $output .= TXT_WPSC_PRODUCTNAME . ": "; $output .= " </td>\n\r"; $output .= " <td class='itemformcol'>\n\r"; $output .= " <div class='admin_product_name'>\n\r"; $output .= " <input size='30' type='text' class='text' name='title' value='" . htmlentities(stripslashes($product['name']), ENT_QUOTES, 'UTF-8') . "' />\n\r"; $output .= "\t\t\t\t <a href='#' class='shorttag_toggle'></a>\n\r"; $output .= "\t\t\t\t <div class='admin_product_shorttags'>\n\r"; $output .= "\t\t\t\t <dl>\n\r"; // $output .= " <dt>Embed Product:</dt><dd>[buy_now_button={$product['id']}]</dd>\n\r"; // $output .= " <dt>Buy Now Button:</dt><dd></dd>\n\r"; $output .= "\t\t\t\t <dt>Buy Now Shortcode:</dt><dd>[buy_now_button={$product['id']}]</dd>\n\r"; $output .= "\t\t\t\t <dt>Buy Now PHP:</dt><dd><?php echo wpsc_buy_now_button({$product['id']}); ?></dd>\n\r"; $output .= "\t\t\t\t </dl>\n\r"; $output .= "\t\t\t\t <br clear='both' />\n\r"; $output .= "\t\t\t\t </div>\n\r"; $output .= " </div>\n\r"; $output .= " </td>\n\r"; $output .= " </tr>\n\r"; $output .= " <tr>\n\r"; $output .= " <td class='itemfirstcol'>\n\r"; $output .= TXT_WPSC_SKU . ": "; $output .= " </td>\n\r"; $output .= " <td class='itemformcol'>\n\r"; $sku = get_product_meta($product['id'], 'sku'); $sku = $sku[0]; $output .= "<input size='30' type='text' class='text' name='productmeta_values[sku]' value='" . htmlentities(stripslashes($sku), ENT_QUOTES, 'UTF-8') . "' />\n\r"; $output .= " </td>\n\r"; $output .= " </tr>\n\r"; $output .= " <tr>\n\r"; $output .= " <td class='itemfirstcol'>\n\r"; $output .= TXT_WPSC_PRODUCTDESCRIPTION . ": "; $output .= " </td>\n\r"; $output .= " <td class='itemformcol'>\n\r"; $output .= "<textarea name='description' cols='40' rows='8' >" . stripslashes($product['description']) . "</textarea>"; $output .= " </td>\n\r"; $output .= " </tr>\n\r"; $output .= " <tr>\n\r"; $output .= " <td class='itemfirstcol'>\n\r"; $output .= TXT_WPSC_ADDITIONALDESCRIPTION . ": "; $output .= " </td>\n\r"; $output .= " <td class='itemformcol'>\n\r"; $output .= "<textarea name='additional_description' cols='40' rows='8' >" . stripslashes($product['additional_description']) . "</textarea>"; $output .= " </td>\n\r"; $output .= " </tr>\n\r"; $output .= " <tr>\n\r"; $output .= " <td class='itemfirstcol'>\n\r"; $output .= TXT_WPSC_PRODUCT_TAGS . ": "; $output .= " </td>\n\r"; $output .= " <td class='itemformcol'>\n\r"; $output .= "<input type='text' class='text' name='product_tags' value='{$imtags}'><br /><span class='small_italic'>Seperate with commas</span>"; $output .= " </td>\n\r"; $output .= " </tr>\n\r"; // $output .="<tr><td> </td></tr>"; $output .= " <tr>\n\r"; $output .= " <td class='itemfirstcol'>" . TXT_WPSC_CATEGORISATION . ":</td>\n\r"; $output .= " <td>\n\r"; $categorisation_groups = $wpdb->get_results("SELECT * FROM `{$wpdb->prefix}wpsc_categorisation_groups` WHERE `active` IN ('1')", ARRAY_A); foreach ((array) $categorisation_groups as $categorisation_group) { $category_count = $wpdb->get_var("SELECT COUNT(*) FROM `{$wpdb->prefix}product_categories` WHERE `group_id` IN ('{$categorisation_group['id']}')"); if ($category_count > 0) { $output .= "<p>"; $category_group_name = str_replace("[categorisation]", $categorisation_group['name'], TXT_WPSC_PRODUCT_CATEGORIES); $output .= "<strong>" . $category_group_name . ":</strong><br>"; $output .= categorylist($categorisation_group['id'], $product['id'], 'edit_'); $output .= "</p>\n\r"; } } $output .= " </td>\n\r"; $output .= " </tr>\n\r"; $output .= "<tr><td colspan='2'><div id='edit_price_and_stock' class='postbox'>\n\t<h3>\n\t\t<a class='togbox'>+</a>"; $output .= "" . TXT_WPSC_PRICE_AND_STOCK_CONTROL . ""; $output .= " </h3> <div class='inside'> <table>"; $output .= " <tr>\n\r"; $output .= " <td>\n\r"; $output .= TXT_WPSC_PRICE . ": <input type='text' name='price' size='10' value='" . number_format($product['price'], 2, '.', '') . "' />"; $output .= " </td>\n\r"; $output .= " </tr>\n\r"; if ($product['notax'] == 1) { $checked = "checked='true'"; } else { $checked = ""; } $output .= " <tr>\n\r"; $output .= " <td>\n\r"; $output .= "<input id='tax' type='checkbox' name='notax' value='yes' {$checked} /> <label for='tax'>" . TXT_WPSC_TAXALREADYINCLUDED . "</label>"; $output .= " </td>\n\r"; $output .= " </tr>\n\r"; if ($product['donation'] == 1) { $checked = "checked='true'"; } else { $checked = ""; } $output .= " <tr>\n\r"; $output .= " <td>\n\r"; $output .= "<input id='edit_form_donation' type='checkbox' {$checked} name='donation' value='yes' /> <label for='edit_form_donation'>" . TXT_WPSC_IS_DONATION . "</label>"; $output .= " </td>\n\r"; $output .= " </tr>\n\r"; if ($product['no_shipping'] == 1) { $checked = "checked='true'"; } else { $checked = ""; } $output .= " <tr>\n\r"; $output .= " <td>\n\r"; $output .= "<input id='add_form_no_shipping' type='checkbox' {$checked} name='no_shipping' value='yes' /> <label for='add_form_no_shipping'>" . TXT_WPSC_NO_SHIPPING . "</label>"; $output .= " </td>\n\r"; $output .= " </tr>\n\r"; if ($product['special'] == 1) { $checked = "checked='true'"; } else { $checked = ""; } $output .= " <tr>\n\r"; $output .= " <td>\n\r"; $disable_form = ''; if ($check_variation_value_count > 0) { if ($product['special'] != 1) { $disable_form = "disabled='true'"; $disable_form_label = " style='color: #cccccc;'"; } } $output .= "<input id='form_special' type='checkbox' {$checked} name='special' {$disable_form} value='yes' onclick='hideelement(\"edit_special\")' /> <label for='form_special' {$disable_form_label}>" . TXT_WPSC_SPECIAL . "</label>"; if ($disable_form != '') { $output .= "<br /><span class='small'>" . TXT_WPSC_VARIATIONS_AND_SPECIALS_DONT_MIX . "<span>"; } if ($product['special'] == 1) { $output .= " <div id='edit_special' style='display: block;'>\n\r"; $output .= "<input type='text' name='special_price' value='" . number_format($product['price'] - $product['special_price'], 2, '.', '') . "' size='10' />"; } else { $output .= " <div id='edit_special' style='display: none;'>\n\r"; $output .= "<input type='text' name='special_price' value='0.00' size='10' />"; } $output .= " </div>\n\r"; $output .= " </td>\n\r"; $output .= " </tr>\n\r"; if ($product['quantity_limited'] == 1) { $checked = "checked='true'"; } else { $checked = ""; } $output .= " <tr>\n\r"; $output .= " <td style='width:350px;'>\n\r"; $output .= "<input id='form_quantity_limited' type='checkbox' {$checked} name='quantity_limited' value='yes' onclick='hideelement(\"edit_stock\")' /><label for='form_quantity_limited' class='small'>" . TXT_WPSC_UNTICKBOX . "</label>"; $variations_output = $variations_processor->variations_grid_view($product['id']); if ($variations_output != '') { //$output .= $variations_output; $output .= "<div id='edit_stock' style='display: none;'>\n\r"; $output .= "<input type='hidden' name='quantity' value='" . $product['quantity'] . "' />"; $output .= "</div>\n\r"; } else { switch ($product['quantity_limited']) { case 1: $output .= " <div id='edit_stock' style='display: block;'>\n\r"; break; default: $output .= " <div id='edit_stock' style='display: none;'>\n\r"; break; } $output .= "<input type='text' name='quantity' size='10' value='" . $product['quantity'] . "' />"; $output .= " </div>\n\r"; } $output .= "</td></tr>"; $output .= "\n </table></div></div></TD></tr>"; $output .= " </td>\n\r"; $output .= " </tr>\n\r"; ob_start(); do_action('wpsc_product_form', $product['id']); $output .= ob_get_contents(); ob_end_clean(); $output .= " <tr>\n\r"; $output .= " <td colspan='2'>\n\r"; $output .= "<div id='edit_variation' class='postbox closed'>\n <h3>\n\t\t<a class='togbox'>+</a>"; $output .= "" . TXT_WPSC_VARIATION_CONTROL . ""; $output .= " </h3>\n\t<div class='inside'>\n <table>"; $output .= " <tr>\n\r"; $output .= " <td>\n\r"; $output .= TXT_WPSC_ADD_VAR . ": "; $output .= " </td>\n\r"; $output .= " <td>\n\r"; $output .= variationslist(); if ($check_variation_value_count < 1) { $output .= " \t<div id='edit_variations_container'>\n\r"; $output .= " \t</div>\n\r"; } $output .= " </td>\n\r"; $output .= " </tr>\n\r"; if ($check_variation_value_count > 0) { $output .= " <tr>\n\r"; $output .= " <td>\n\r"; $output .= TXT_WPSC_EDIT_VAR . ": "; $output .= " </td>\n\r"; $output .= " <td>\n\r"; $output .= " <div id='edit_product_variations'>"; $output .= " </div>"; $output .= " \t<div id='edit_variations_container'>\n\r"; //$variations_processor = new nzshpcrt_variations; $output .= $variations_processor->display_attached_variations($product['id']); $output .= $variations_output; $output .= " \t</div>\n\r"; $output .= " </td>\n\r"; $output .= " </tr>\n\r"; } $output .= "</table></div></div></td></tr>"; $output .= " <tr>\n\r"; $output .= " <td colspan='2'>\n\r"; $output .= " <div class='postbox closed' id='edit_shipping'>\n\t <h3>\n\t\t <a class='togbox'>+</a>" . TXT_WPSC_SHIPPING_DETAILS . ""; $output .= "</h3>\n <div class='inside'>\n <table>"; if ($product['weight_unit'] == 'pound') { $unit1 = "selected='selected'"; } else { $unit2 = "selected='selected'"; } $output .= "<tr>\n\r"; $output .= "\t<td>\n\r"; $output .= "\t\t" . TXT_WPSC_WEIGHT . "\n\r"; $output .= "\t</td>\n\r"; $output .= "\t<td>\n\r"; $output .= "\t\t<input type='text' size='5' name='weight' value='" . $product['weight'] . "'>\n\r"; $output .= " <select name='weight_unit'>\n\r"; $output .= "\t\t\t<option {$unit1} value='pound'>Pounds</option>\n\r"; $output .= "\t\t\t<option {$unit2} value='once'>Ounce</option>\n\r"; $output .= "\t\t</select>\n\r"; $output .= "\t</td>\n\r"; $output .= "</tr>"; $output .= " <tr>\n\r"; $output .= " <td>"; $output .= TXT_WPSC_LOCAL_PNP; $output .= " </td>\n\r"; $output .= " <td>\n\r"; $output .= " <input type='text' size='10' name='pnp' value='" . $product['pnp'] . "' />\n\r"; $output .= " </td>\n\r"; $output .= " </tr>\n\r"; $output .= " <tr>\n\r"; $output .= " <td>"; $output .= TXT_WPSC_INTERNATIONAL_PNP; if ($product['international_pnp'] == 0) { $product['international_pnp'] = "0.00"; } $output .= " </td>\n\r"; $output .= " <td>\n\r"; $output .= " <input type='text' size='10' name='international_pnp' value='" . $product['international_pnp'] . "' />\n\r"; $output .= " </td>\n\r"; $output .= " </tr>\n\r"; $output .= "</table></div></div></td></tr>"; $output .= "<tr><td colspan='2'>"; $output .= "<div id='edit_advanced' class='postbox closed'>\n\t <h3>\n\t\t <a class='togbox'>+</a>"; $output .= TXT_WPSC_ADVANCED_OPTIONS; $output .= "</h3><div class='inside'>"; $output .= '<table>'; $output .= " <tr>\n\r"; $output .= " <td>\n\r"; $output .= TXT_WPSC_ADMINNOTES . ": "; $output .= " </td>\n\r"; $output .= " <td>\n\r"; $output .= "<textarea name='merchant_notes' cols='40' rows='3' >" . stripslashes($product['merchant_notes']) . "</textarea>"; $output .= " </td>\n\r"; $output .= " </tr>\n\r"; $output .= " <tr>\n\r"; $output .= " <td>\n\r"; $output .= " </td>\n\r"; $output .= " <td>\n\r"; if ($product['display_frontpage'] == 1) { $output .= "<input type='checkbox' checked='true' value='yes' name='display_frontpage' id='form_display_frontpage'/>\n\r"; } else { $output .= "<input type='checkbox' value='yes' name='display_frontpage' id='form_display_frontpage'/>\n\r"; } $output .= "<label for='form_display_frontpage'>" . TXT_WPSC_DISPLAY_FRONT_PAGE . "</form>"; $output .= " </td>\n\r"; $output .= " </tr>\n\r"; if ($engrave[0] == 'on') { $engra = "checked='checked'"; } $output .= " <tr>\n\r"; $output .= " <td>\n\r"; $output .= " </td>\n\r"; $output .= " <td>\n\r"; $output .= "<input type='hidden' name='productmeta_values[engraved]' value='0'>"; $output .= "<input {$engra} type='checkbox' name='productmeta_values[engraved]'>" . TXT_WPSC_ENGRAVE . "<br />"; $output .= " </td>\n\r"; $output .= " </tr>\n\r"; if ($can_have_uploaded_image[0] == 'on') { $can_have_uploaded_image_state = "checked='checked'"; } $output .= " <tr>\n\r"; $output .= " <td>\n\r"; $output .= " </td>\n\r"; $output .= " <td>\n\r"; $output .= "<input type='hidden' name='productmeta_values[can_have_uploaded_image]' value='0'>"; $output .= "<input {$can_have_uploaded_image_state} type='checkbox' name='productmeta_values[can_have_uploaded_image]'>" . TXT_WPSC_ALLOW_UPLOADING_IMAGE . "<br />"; $output .= " </td>\n\r"; $output .= " </tr>\n\r"; if (get_option('payment_gateway') == 'google') { $output .= " <tr>\n\r"; $output .= " <td>\n\r"; $output .= TXT_WPSC_PROHIBITED . ": "; $output .= " </td>\n\r"; $output .= " <td>\n\r"; $output .= "<input type='checkbox' name='productmeta_values[\"google_prohibited\"]'/> "; $output .= "Prohibited <a href='http://checkout.google.com/support/sell/bin/answer.py?answer=75724'>by Google?</a>"; $output .= " </td>\n\r"; $output .= " </tr>\n\r"; } $output .= " <tr>\n\r"; $output .= " <td>\n\r"; $output .= TXT_WPSC_PRODUCT_ID . ": "; $output .= " </td>\n\r"; $output .= " <td>\n\r"; $output .= $product['id']; $output .= " </td>\n\r"; $output .= " </tr>\n\r"; $output .= " <tr>\n\r"; $output .= " <td>\n\r"; $output .= TXT_WPSC_EXTERNALLINK . ": "; $output .= " </td>\n\r"; $output .= " <td>\n\r"; $output .= "<input type='text' class='text' value='" . $product['external_link'] . "' name='external_link' id='external_link' size='40'> "; $output .= " </td>\n\r"; $output .= " </tr>\n\r"; $output .= " <tr>\n\r"; $output .= " <td>\n\r"; $output .= " </td>\n\r"; $output .= " <td>\n\r"; $output .= TXT_WPSC_USEONLYEXTERNALLINK; $output .= " </td>\n\r"; $output .= " </tr>\n\r"; $output .= " <tr>\n\r"; $output .= " <td>\n\r"; $output .= TXT_WPSC_ADD_CUSTOM_FIELD; $output .= " </td>\n\r"; $output .= " <td>\n\r"; //foreach $output .= "<label></label>\n <div class='product_custom_meta'>\n\t\t<label >\n\t\t" . TXT_WPSC_NAME . "\n\t\t<input type='text' class='text' value='' name='new_custom_meta[name][]' >\n\t\t</label>\n\t\t\n\t\t<label >\n\t\t" . TXT_WPSC_VALUE . "\n\t\t<input type='text' class='text' value='' name='new_custom_meta[value][]' > \n\t\t</label>\t\t\n\t\t<a href='#' class='add_more_meta' onclick='return add_more_meta(this)'>+</a>\n\t <br />\n </div>\n "; $output .= " </td>\n\r"; $output .= " </tr>\n\r"; $custom_fields = $wpdb->get_results("SELECT * FROM `{$wpdb->prefix}wpsc_productmeta` WHERE `product_id` IN('{$product['id']}') AND `custom` IN('1') ", ARRAY_A); if (count($custom_fields) > 0) { $output .= " <tr>\n\r"; $output .= " <td>\n\r"; $output .= TXT_WPSC_EDIT_CUSTOM_FIELDS; $output .= " </td>\n\r"; $output .= " <td>\n\r"; //$i = 1; foreach ((array) $custom_fields as $custom_field) { $i = $custom_field['id']; // for editing, the container needs an id, I can find no other tidyish method of passing a way to target this object through an ajax request $output .= "\n\t\t\t<div class='product_custom_meta' id='custom_meta_{$i}'>\n\t\t\t\t<label for='custom_meta_name_{$i}'>\n\t\t\t\t" . TXT_WPSC_NAME . "\n\t\t\t\t<input type='text' class='text' value='{$custom_field['meta_key']}' name='custom_meta[{$i}][name]' id='custom_meta_name_{$i}'>\n\t\t\t\t</label>\n\t\t\t\t\n\t\t\t\t<label for='custom_meta_value_{$i}'>\n\t\t\t\t" . TXT_WPSC_VALUE . "\n\t\t\t\t<input type='text' class='text' value='{$custom_field['meta_value']}' name='custom_meta[{$i}][value]' id='custom_meta_value_{$i}'> \n\t\t\t\t</label>\n\t\t\t\t<a href='#' class='remove_meta' onclick='return remove_meta(this, {$i})'>–</a>\n\t\t\t\t<br />\n\t\t\t</div>\n\t\t\t"; } $output .= " </td>\n\r"; $output .= " </tr>\n\r"; } $output .= "</table></div></div></td></tr>"; $output .= " <tr>\n\r"; $output .= " <td colspan='2'>\n\r"; $output .= "<div id='edit_product_image' class='postbox'>\n <h3> \n\t\t<a class='togbox'>+</a>" . TXT_WPSC_PRODUCTIMAGE . ""; $output .= "</h3>\n\t<div class='inside'>\n\t<table>"; if (function_exists("getimagesize")) { if ($product['image'] != '') { $imagedir = WPSC_THUMBNAIL_DIR; $image_size = @getimagesize(WPSC_THUMBNAIL_DIR . $product['image']); $output .= " <tr>\n\r"; $output .= " <td>\n\r"; $output .= TXT_WPSC_RESIZEIMAGE . ": <br />"; $output .= "<span class='image_size_text'>" . $image_size[0] . "x" . $image_size[1] . "</span>"; $output .= " </td>\n\r"; $output .= " <td>\n\r"; $output .= "<table>"; // style='border: 1px solid black' $output .= " <tr>"; $output .= " <td style='height: 1em;'>"; $output .= "<input type='hidden' id='current_thumbnail_image' name='current_thumbnail_image' value='" . $product['thumbnail_image'] . "' />"; $output .= "<input type='radio' "; // if ($product['thumbnail_state'] == 0) { $output .= "checked='true'"; // } $output .= " name='image_resize' value='0' id='image_resize0' class='image_resize' onclick='hideOptionElement(null, \"image_resize0\")' /> <label for='image_resize0'> " . TXT_WPSC_DONOTRESIZEIMAGE . "<br />"; $output .= " </td>"; // Put lightbox here so doesn't move around with DHTML bits $output .= " <td rowspan=4>"; $image_link = WPSC_IMAGE_URL . $product['image']; $output .= "<a href='" . $image_link . "' rel='edit_product_1' class='thickbox preview_link'><img id='previewimage' src='{$image_link}' alt='" . TXT_WPSC_PREVIEW . "' title='" . TXT_WPSC_PREVIEW . "' />" . "</a>"; $output .= "<br /><span style=\"font-size: 7pt;\">" . TXT_WPSC_PRODUCT_IMAGE_PREVIEW . "</span><br /><br />"; if ($product['thumbnail_image'] != null) { $output .= "<a id='preview_link' href='" . WPSC_THUMBNAIL_URL . $product['thumbnail_image'] . "' rel='edit_product_2' class='thickbox'><img id='previewimage' src='" . WPSC_THUMBNAIL_URL . $product['thumbnail_image'] . "' alt='" . TXT_WPSC_PREVIEW . "' title='" . TXT_WPSC_PREVIEW . "' />" . "</a>"; $output .= "<br /><span style=\"font-size: 7pt;\">" . TXT_WPSC_PRODUCT_THUMBNAIL_PREVIEW . "</span><br />"; } //<div id='preview_button'><a id='preview_button' href='#'>".TXT_WPSC_PREVIEW."</a></div> // onclick='return display_preview_image(".$product['id'].")' $output .= " </td>"; $output .= " </tr>"; $output .= " <tr>"; $output .= " <td>"; $output .= "<input type='radio' "; if ($product['thumbnail_state'] == 1) { //$output .= "checked='true'"; } $output .= "name='image_resize' value='1' id='image_resize1' class='image_resize' onclick='hideOptionElement(null, \"image_resize1\")' /> <label for='image_resize1'>" . TXT_WPSC_USEDEFAULTSIZE . " (" . get_option('product_image_height') . "x" . get_option('product_image_width') . ")"; $output .= " </td>"; $output .= " </tr>"; $output .= " <tr>"; $output .= " <td>"; $output .= "<input type='radio' "; if ($product['thumbnail_state'] == 2) { // $output .= "checked='true'"; } $output .= " name='image_resize' value='2' id='image_resize2' class='image_resize' onclick='hideOptionElement(\"heightWidth\", \"image_resize2\")' /> <label for='image_resize2'>" . TXT_WPSC_USESPECIFICSIZE . " </label>\n\t\t\t<div id=\"heightWidth\" style=\"display: "; if ($product['thumbnail_state'] == 2) { $output .= "block;"; } else { $output .= "none;"; } $output .= "\">\n\t\t\t<input id='image_width' type='text' size='4' name='width' value='' /><label for='image_resize2'>" . TXT_WPSC_PXWIDTH . "</label>\n\t\t\t<input id='image_height' type='text' size='4' name='height' value='' /><label for='image_resize2'>" . TXT_WPSC_PXHEIGHT . " </label></div>"; $output .= " </td>"; $output .= " </tr>"; $output .= " <tr>"; $output .= " <td>"; $output .= "<input type='radio' "; if ($product['thumbnail_state'] == 3) { // $output .= "checked='true'"; } $output .= " name='image_resize' value='3' id='image_resize3' class='image_resize' onclick='hideOptionElement(\"browseThumb\", \"image_resize3\")' /> <label for='image_resize3'> " . TXT_WPSC_SEPARATETHUMBNAIL . "</label><br />"; $output .= "<div id='browseThumb' style='display: "; if ($product['thumbnail_state'] == 3) { $output .= "block"; } else { $output .= "none"; } $output .= ";'>\n\r<input type='file' name='thumbnailImage' size='15' value='' />"; $output .= "</div>\n\r"; $output .= " </td>"; $output .= " </tr>"; // }.pe $output .= "</table>"; $output .= " </td>\n\r"; $output .= " </tr>\n\r"; } } $output .= " <tr>\n\r"; $output .= " <td>\n\r"; $output .= " </td>\n\r"; $output .= " <td>\n\r"; $output .= TXT_WPSC_UPLOADNEWIMAGE . ": <br />"; $output .= "<input type='file' name='image' value='' />"; $output .= " </td>\n\r"; $output .= " </tr>\n\r"; if (function_exists("getimagesize")) { if ($product['image'] == '') { $output .= " <tr>\n\r"; $output .= " <td></td>\n\r"; $output .= " <td>\n\r"; $output .= "<table>\n\r"; if (is_numeric(get_option('product_image_height')) && is_numeric(get_option('product_image_width'))) { $output .= " <tr>\n\r"; $output .= " <td>\n\r"; $output .= " <input type='radio' name='image_resize' value='0' id='image_resize0' class='image_resize' onclick='hideOptionElement(null, \"image_resize0\");' /> <label for='image_resize0'>" . TXT_WPSC_DONOTRESIZEIMAGE . "</label>\n\r"; $output .= " </td>\n\r"; $output .= " </tr>\n\r"; $output .= " <tr>\n\r"; $output .= " <td>\n\r"; $output .= " <input type='radio' checked='true' name='image_resize' value='1' id='image_resize1' class='image_resize' onclick='hideOptionElement(null, \"image_resize1\");' /> <label for='image_resize1'>" . TXT_WPSC_USEDEFAULTSIZE . " (" . get_option('product_image_height') . "x" . get_option('product_image_width') . ")</label>\n\r"; $output .= " </td>\n\r"; $output .= " </tr>\n\r"; } $output .= " <tr>\n\r"; $output .= " <td>\n\r"; $output .= " <input type='radio' name='image_resize' value='2' id='image_resize2' class='image_resize' onclick='hideOptionElement(\"heightWidth\", \"image_resize2\");' />\n\r"; $output .= " <label for='image_resize2'>" . TXT_WPSC_USESPECIFICSIZE . "</label>\n\r"; $output .= " <div id='heightWidth' style='display: none;'>\n\r"; $output .= " <input type='text' size='4' name='width' value='' /><label for='image_resize2'>" . TXT_WPSC_PXWIDTH . "</label>\n\r"; $output .= " <input type='text' size='4' name='height' value='' /><label for='image_resize2'>" . TXT_WPSC_PXHEIGHT . "</label>\n\r"; $output .= " </div>\n\r"; $output .= " </td>\n\r"; $output .= " </tr>\n\r"; $output .= " <tr>\n\r"; $output .= " <td>\n\r"; $output .= " <input type='radio' name='image_resize' value='3' id='image_resize3' class='image_resize' onclick='hideOptionElement(\"browseThumb\", \"image_resize3\");' />\n\r"; $output .= " <label for='image_resize3'>" . TXT_WPSC_SEPARATETHUMBNAIL . "</label><br />"; $output .= " <div id='browseThumb' style='display: none;'>\n\r"; $output .= " <input type='file' name='thumbnailImage' value='' />\n\r"; $output .= " </div>\n\r"; $output .= " </td>\n\r"; $output .= " </tr>\n\r"; $output .= " </table>\n\r"; $output .= " </td>\n\r"; $output .= " </tr>\n\r"; } } $output .= " <tr>\n\r"; $output .= " <td>\n\r"; $output .= " </td>\n\r"; $output .= " <td>\n\r"; $output .= "<input id='delete_image' type='checkbox' name='deleteimage' value='1' /> "; $output .= "<label for='delete_image'>" . TXT_WPSC_DELETEIMAGE . "</label>"; $output .= " </td>\n\r"; $output .= " </tr>\n\r"; if (function_exists('edit_multiple_image_form')) { $output .= edit_multiple_image_form($product['id']); } $output .= "</table></div></div></td></tr>"; if ($product['file'] > 0) { $output .= " <tr>\n\r"; $output .= " <td colspan='2'>\n\r"; $output .= "<div id='edit_product_download' class='postbox closed'>\n <h3>\n\t\t<a class='togbox'>+</a>" . TXT_WPSC_PRODUCTDOWNLOAD . ""; $output .= " </h3>\n\t<div class='inside'>\n\t<table>"; $output .= " <tr>\n\r"; $output .= " <td>\n\r"; $output .= TXT_WPSC_PREVIEW_FILE . ": "; $output .= " </td>\n\r"; $output .= " <td>\n\r"; $output .= "<a class='admin_download' href='index.php?admin_preview=true&product_id=" . $product['id'] . "' style='float: left;' ><img align='absmiddle' src='" . WPSC_URL . "/images/download.gif' alt='' title='' /><span>" . TXT_WPSC_CLICKTODOWNLOAD . "</span></a>"; $file_data = $wpdb->get_row("SELECT * FROM `" . $wpdb->prefix . "product_files` WHERE `id`='" . $product['file'] . "' LIMIT 1", ARRAY_A); if ($file_data != null && function_exists('listen_button')) { $output .= "" . listen_button($file_data['idhash'], $file_data['id']); } $output .= " </td>\n\r"; $output .= " </tr>\n\r"; $output .= " <tr>\n\r"; $output .= " <td>\n\r"; $output .= TXT_WPSC_DOWNLOADABLEPRODUCT . ": "; $output .= " </td>\n\r"; $output .= " <td>\n\r"; $output .= "<input type='file' name='file' value='' /><br />"; $output .= wpsc_select_product_file($product['id']); $output .= " </td>\n\r"; $output .= " </tr>\n\r"; if (function_exists("make_mp3_preview") && $file_data['mimetype'] == 'audio/mpeg' || function_exists("wpsc_media_player")) { $output .= " <tr>\n\r"; $output .= " <td>\n\r"; $output .= TXT_WPSC_NEW_PREVIEW_FILE . ": "; $output .= " </td>\n\r"; $output .= " <td>\n\r"; $output .= "<input type='file' name='preview_file' value='' /><br />"; //$output .= "<span class='admin_product_notes'>".TXT_WPSC_PREVIEW_FILE_NOTE."</span>"; $output .= "<br /><br />"; $output .= " </td>\n\r"; $output .= " </tr>\n\r"; } } else { $output .= "<tr><td colspan='2'>"; $output .= "<div id='edit_product_download' class='postbox closed'>\n <h3>\n\t\t<a class='togbox'>+</a>" . TXT_WPSC_PRODUCTDOWNLOAD . ""; $output .= " </h3>\n\t<div class='inside'>\n\t<table>"; $output .= " <tr>"; $output .= " <td>"; // $output .= "".TXT_WPSC_DOWNLOADABLEPRODUCT.":"; $output .= " </td>"; $output .= " <td>"; $output .= " <input type='file' name='file' value='' />"; $output .= wpsc_select_product_file($product['id']); $output .= " </td>"; $output .= " </tr>"; } $output .= " </table></div></div></td></tr>"; $output .= " <tr>\n\r"; $output .= " <td>\n\r"; $output .= " </td>\n\r"; $output .= " <td>\n\r"; $output .= " <br />\n\r"; $output .= "<input type='hidden' name='prodid' id='prodid' value='" . $product['id'] . "' />"; $output .= "<input type='hidden' name='submit_action' value='edit' />"; $output .= "<input class='button' style='float:left;' type='submit' name='submit' value='" . TXT_WPSC_EDIT_PRODUCT . "' />"; $output .= "<a class='button delete_button' ' href='admin.php?page=" . WPSC_DIR_NAME . "/display-items.php&deleteid=" . $product['id'] . "' onclick=\"return conf();\" >" . TXT_WPSC_DELETE_PRODUCT . "</a>"; $output .= " <td>\n\r"; $output .= " </tr>\n\r"; $output .= " </table>\n\r"; return $output; }