</th> <?php } ?> <th scope="col" id="myAccountTotal"><?php echo HEADING_TOTAL; ?> </th> </tr> <?php for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) { ?> <tr> <!--JT mod - Product Image--> <td class="accountQuantityDisplay"><?php echo zen_get_products_image($order->products[$i]['id'], IMAGE_ON_INVOICE_IMAGE_WIDTH, IMAGE_ON_INVOICE_IMAGE_HEIGHT); ?> </td> <!--JT mod - Product Image--> <td class="accountQuantityDisplay"><?php echo $order->products[$i]['qty'] . QUANTITY_SUFFIX; ?> </td> <td class="accountProductDisplay"><?php echo $order->products[$i]['name']; if (isset($order->products[$i]['attributes']) && sizeof($order->products[$i]['attributes']) > 0) { echo '<ul id="orderAttribsList">'; for ($j = 0, $n2 = sizeof($order->products[$i]['attributes']); $j < $n2; $j++) { echo '<li>' . $order->products[$i]['attributes'][$j]['option'] . TEXT_OPTION_DIVIDER . nl2br(zen_output_string_protected($order->products[$i]['attributes'][$j]['value'])) . '</li>'; } echo '</ul>';
$small_height = SMALL_IMAGE_HEIGHT; $medium_width = MEDIUM_IMAGE_WIDTH; $medium_height = MEDIUM_IMAGE_HEIGHT; $large_width = LARGE_IMAGE_WIDTH; $large_height = LARGE_IMAGE_HEIGHT; $k = max($oiheight / $small_height, $oiwidth / $small_width); //use smallest size $small_width = round($oiwidth / $k); $small_height = round($oiheight / $k); $k = max($oiheight / $medium_height, $oiwidth / $medium_width); //use smallest size $medium_width = round($oiwidth / $k); $medium_height = round($oiheight / $k); $large_width = $oiwidth; $large_height = $oiheight; $products_image = zen_get_products_image((int) $products_id); $products_image_extension = substr($products_image, strrpos($products_image, '.')); $products_image_base = preg_replace('/' . $products_image_extension . '/', '', $products_image); $filename_medium = DIR_FS_CATALOG . DIR_WS_IMAGES . 'medium/' . $products_image_base . IMAGE_SUFFIX_MEDIUM . '.' . $fname[2]; $filename_large = DIR_FS_CATALOG . DIR_WS_IMAGES . 'large/' . $products_image_base . IMAGE_SUFFIX_LARGE . '.' . $fname[2]; // ImageMagick if (IMAGE_MANAGER_HANDLER == '1') { copy($src, $filename_large); copy($src, $filename_medium); exec(DIR_IMAGEMAGICK . "mogrify -geometry " . $large_width . " " . $filename_large); exec(DIR_IMAGEMAGICK . "mogrify -geometry " . $medium_width . " " . $filename_medium); exec(DIR_IMAGEMAGICK . "mogrify -geometry " . $small_width . " " . $filename_small); } } zen_redirect(zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $products_id . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '') . (isset($_POST['search']) ? '&search=' . $_POST['search'] : ''))); } else {
<?php /** * Side Box Template * * @package templateSystem * @copyright Copyright 2003-2005 Zen Cart Development Team * @copyright Portions Copyright 2003 osCommerce * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0 * @version $Id: tpl_best_sellers.php 2982 2006-02-07 07:56:41Z birdbrain $ */ $content = ''; $content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent">' . "\n"; $content .= '<div class="wrapper" >' . "\n" . '<ul style="list-style: none!important">' . "\n"; for ($i = 1; $i <= sizeof($bestsellers_list); $i++) { $content .= '<li ><a style="padding: 10%" href="' . zen_href_link(zen_get_info_page($bestsellers_list[$i]['id']), 'products_id=' . $bestsellers_list[$i]['id']) . '">' . zen_get_products_image($bestsellers_list[$i]['id']) . '<br/>' . zen_trunc_string($bestsellers_list[$i]['name'], BEST_SELLERS_TRUNCATE, BEST_SELLERS_TRUNCATE_MORE) . '</a></li>' . "\n"; } $content .= '</ul>' . "\n"; $content .= '</div>' . "\n"; $content .= '</div>';
$counter++; } if ($previous == -1) { $previous = $last; } $sql = "select categories_name\r\n from " . TABLE_CATEGORIES_DESCRIPTION . "\r\n where categories_id = {$current_category_id} AND language_id = '" . $_SESSION['languages_id'] . "'"; $category_name_row = $db->Execute($sql); } // if is_array // previous_next button and product image settings // include products_image status 0 = off 1= on // 0 = button only 1= button and product image 2= product image only $previous_button = zen_image_button(BUTTON_IMAGE_PREVIOUS, BUTTON_PREVIOUS_ALT); $next_item_button = zen_image_button(BUTTON_IMAGE_NEXT, BUTTON_NEXT_ALT); $previous_image = zen_get_products_image($previous, PREVIOUS_NEXT_IMAGE_WIDTH, PREVIOUS_NEXT_IMAGE_HEIGHT) . '<br />'; $next_item_image = zen_get_products_image($next_item, PREVIOUS_NEXT_IMAGE_WIDTH, PREVIOUS_NEXT_IMAGE_HEIGHT) . '<br />'; if (SHOW_PREVIOUS_NEXT_STATUS == 0) { $previous_image = ''; $next_item_image = ''; } else { if (SHOW_PREVIOUS_NEXT_IMAGES >= 1) { if (SHOW_PREVIOUS_NEXT_IMAGES == 2) { $previous_button = ''; $next_item_button = ''; } if ($previous == $next_item) { $previous_image = ''; $next_item_image = ''; } } else { $previous_image = '';
echo TABLE_HEADING_TOTAL_EXCLUDING_TAX; ?> </td> <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_TOTAL_INCLUDING_TAX; ?> </td> </tr> <?php for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) { if (DISPLAY_PRICE_WITH_TAX_ADMIN == 'true') { $priceIncTax = $currencies->format(zen_round(zen_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']), $currencies->get_decimal_places($order->info['currency'])) * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']); } else { $priceIncTax = $currencies->format(zen_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']) * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']); } echo ' <tr class="dataTableRow">' . "\n" . ' <td class="dataTableContent" valign="top" align="right"><img src="' . DIR_WS_CATALOG . DIR_WS_IMAGES . zen_get_products_image($order->products[$i]['id']) . '" align="left" width="' . IMAGE_ON_INVOICE_IMAGE_WIDTH . '" height="' . IMAGE_ON_INVOICE_IMAGE_HEIGHT . '" />' . $order->products[$i]['qty'] . ' x</td>' . "\n" . ' <td class="dataTableContent" valign="top">' . $order->products[$i]['name']; if (isset($order->products[$i]['attributes']) && sizeof($order->products[$i]['attributes']) > 0) { for ($j = 0, $k = sizeof($order->products[$i]['attributes']); $j < $k; $j++) { echo '<br /><nobr><small> <i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . nl2br(zen_output_string_protected($order->products[$i]['attributes'][$j]['value'])); if ($order->products[$i]['attributes'][$j]['price'] != '0') { echo ' (' . $order->products[$i]['attributes'][$j]['prefix'] . $currencies->format($order->products[$i]['attributes'][$j]['price'] * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . ')'; } if ($order->products[$i]['attributes'][$j]['product_attribute_is_free'] == '1' and $order->products[$i]['product_is_free'] == '1') { echo TEXT_INFO_ATTRIBUTE_FREE; } echo '</i></small></nobr>'; } } echo ' </td>' . "\n" . ' <td class="dataTableContent" valign="top">' . $order->products[$i]['model'] . '</td>' . "\n" . ' <td class="dataTableContent" align="right" valign="top">' . zen_display_tax_value($order->products[$i]['tax']) . '%</td>' . "\n" . ' <td class="dataTableContent" align="right" valign="top"><strong>' . $currencies->format($order->products[$i]['final_price'], true, $order->info['currency'], $order->info['currency_value']) . ($order->products[$i]['onetime_charges'] != 0 ? '<br />' . $currencies->format($order->products[$i]['onetime_charges'], true, $order->info['currency'], $order->info['currency_value']) : '') . '</strong></td>' . "\n" . ' <td class="dataTableContent" align="right" valign="top"><strong>' . $currencies->format(zen_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']), true, $order->info['currency'], $order->info['currency_value']) . ($order->products[$i]['onetime_charges'] != 0 ? '<br />' . $currencies->format(zen_add_tax($order->products[$i]['onetime_charges'], $order->products[$i]['tax']), true, $order->info['currency'], $order->info['currency_value']) : '') . '</strong></td>' . "\n" . ' <td class="dataTableContent" align="right" valign="top"><strong>' . $currencies->format(zen_round($order->products[$i]['final_price'], $currencies->get_decimal_places($order->info['currency'])) * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . ($order->products[$i]['onetime_charges'] != 0 ? '<br />' . $currencies->format($order->products[$i]['onetime_charges'], true, $order->info['currency'], $order->info['currency_value']) : '') . '</strong></td>' . "\n" . ' <td class="dataTableContent" align="right" valign="top"><strong>' . $priceIncTax . ($order->products[$i]['onetime_charges'] != 0 ? '<br />' . $currencies->format(zen_add_tax($order->products[$i]['onetime_charges'], $order->products[$i]['tax']), true, $order->info['currency'], $order->info['currency_value']) : '') . '</strong></td>' . "\n"; echo ' </tr>' . "\n"; }
* * @package templateSystem * @copyright Copyright 2003-2005 Zen Cart Development Team * @copyright Portions Copyright 2003 osCommerce * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0 * @version $Id: tpl_best_sellers.php 2982 2006-02-07 07:56:41Z birdbrain $ */ $content = '<ul class="recent_view pad_10px">' . "\n"; foreach ($recommendationsArray as $product) { //caizhouqing by bof $rs = $db->Execute("select s.specials_new_products_price,p.products_price from (specials s,products p) where s.products_id = p.products_id and p.products_id=" . $product); $products_price = $rs->fields['products_price']; $specials_price = $rs->fields['specials_new_products_price']; //caizhouqing update specials $rsp = $db->Execute("select products_quantity from products where products_id=" . $product); $products_quantity = $rsp->fields['products_quantity']; //product if ($products_price != "") { $discount = 100 - $specials_price / $products_price * 100; } $link = zen_href_link(zen_get_info_page($product), 'products_id=' . $product); $content .= '<li>' . "\n"; if ($products_quantity == 0) { $content .= '<span class="sold_out_cart"></span>'; } elseif (!empty($specials_price)) { $content .= '<span class="sold_discount_cart"><span class="sold_discount_cart_font">' . $discount . '</span></span>'; } //caizhouqing update by eof my_order $content .= "\n" . '<a class="ih" href="' . $link . '">' . zen_get_products_image($product, '85', '85') . '</a>' . "\n" . '<span><a href="' . $link . '">' . zen_get_products_name($product, $_SESSION['languages_id']) . '</a></span>' . "\n" . '</li>'; } $content .= '</ul>';
<th scope="col" id="ccTotalHeading"><?php echo TABLE_HEADING_TOTAL; ?> </th> </tr> <tr> <td colspan="5"><hr /></td> </tr> <?php // now loop thru all products to display quantity and price ?> <?php for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) { ?> <?php $thumbnail = zen_get_products_image($order->products[$i]['id'], 40, 42); ?> <tr class="<?php echo $order->products[$i]['rowClass']; ?> "> <td class="cartQuantity"><?php echo $order->products[$i]['qty']; ?> x</td> <td class="cartImage"><?php echo $thumbnail; ?> </td> <td class="cartProductDisplay" colspan="2"><?php echo $order->products[$i]['name'];
function back_in_stock_send($product_id = 0, $bis_id = 0, $preview = true) { global $db; cleanse_back_in_stock_subscriptions(); if ($product_id != 0) { $addtl_where = ' AND product_id=' . $product_id; } else { $addtl_where = ''; } if ($bis_id != 0) { $addtl_where .= ' AND bis_id=' . $bis_id; } // Find all Items in notifications $bis_emails = array(); $now = time(); $bis_products = $db->Execute("SELECT p.products_id, pd.products_name, b.product_id, b.last_sent, b.email, b.name, b.bis_id, b.active_til_purch, b.sub_active FROM " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_BACK_IN_STOCK . " b WHERE p.products_id = pd.products_id AND p.products_id = b.product_id AND p.products_quantity > 0 AND sub_active=1 " . $addtl_where); while (!$bis_products->EOF) { echo 'Back in stock: ' . $bis_products->fields['products_name'] . "\n" . "<br/>"; $your_date = strtotime($bis_products->fields['last_sent']); $datediff = $now - $your_date; $days_since = floor($datediff / (60 * 60 * 24)); if (BACK_IN_STOCK_DAYS_WAITING > $days_since && BACK_IN_STOCK_DAYS_WAITING != '0') { $bis_products->MoveNext(); } $bis_emails[] = array('email' => $bis_products->fields['email'], 'name' => stripslashes($bis_products->fields['name']), 'product_id' => $bis_products->fields['product_id'], 'bis_id' => $bis_products->fields['bis_id'], 'active_til_purch' => $bis_products->fields['active_til_purch']); $bis_products->MoveNext(); } $counted = 0; if (!$preview) { foreach ($bis_emails as $emails) { if ($emails['email'] == '') { continue; } if ($counted >= (int) BACK_IN_STOCK_MAX_EMAILS_PER_BATCH && BACK_IN_STOCK_MAX_EMAILS_PER_BATCH != '0') { break; } $customers_name = stripslashes($emails['name']); $customers_email = $emails['email']; $html_message = array(); $html_message['CUSTOMERS_NAME'] = $customers_name; $html_message['PRODUCT_NAME'] = strip_tags(zen_get_products_name($emails['product_id'])); $html_message['SPAM_LINK'] = HTTPS_SERVER . DIR_WS_HTTPS_CATALOG . 'index.php?main_page=back_in_stock&bis_id=' . $emails['bis_id']; $html_message['TOP_MESSAGE'] = BACK_IN_STOCK_MAIL_TOP . $html_message['PRODUCT_NAME'] . "\n" . "\n" . BACK_IN_STOCK_MAIL_AVAILABLE; if (BACK_IN_STOCK_DESC_IN_EMAIL == 1) { $html_message['PRODUCT_DESCRIPTION'] = zen_get_products_description($emails['product_id']); } else { $html_message['PRODUCT_DESCRIPTION'] = " "; } $html_message['PRODUCT_IMAGE'] = zen_get_products_image($emails['product_id'], LARGE_IMAGE_WIDTH, LARGE_IMAGE_HEIGHT); $html_message['PRODUCT_LINK'] = zen_href_link('product_info', 'products_id=' . $emails['product_id']); $html_message['BOTTOM_MESSAGE'] = BACK_IN_STOCK_MAIL_BOTTOM; $email_text = BACK_IN_STOCK_MAIL_GREETING . $customers_name . ',' . "\n" . "\n" . $html_message['TOP_MESSAGE'] . "\n" . "\n" . $html_message['PRODUCT_NAME'] . "\n" . $html_message['PRODUCT_DESCRIPTION'] . "\n" . $html_message['PRODUCT_LINK'] . "\n" . "\n" . $html_message['BOTTOM_MESSAGE'] . "\n" . "\n" . BACK_IN_STOCK_MAIL_CANCEL . "\n" . $html_message['SPAM_LINK'] . "\n"; $counted++; zen_mail($customers_name, $customers_email, $html_message['PRODUCT_NAME'] . BACK_IN_STOCK_MAIL_BACK . STORE_NAME, $email_text, STORE_NAME, EMAIL_FROM, $html_message, 'back_in_stock_notification'); if (BACK_IN_STOCK_SEND_ADMIN_EMAIL == 'true') { zen_mail('', BACK_IN_STOCK_ADMIN_EMAIL, $html_message['PRODUCT_NAME'] . BACK_IN_STOCK_MAIL_BACK . STORE_NAME, $email_text, STORE_NAME, EMAIL_FROM, $html_message, 'back_in_stock_notification'); } echo BACK_IN_STOCK_MAIL_SENT . $customers_email . "\n" . "<br/>"; $modify_subscription = array('bis_id' => $emails['bis_id'], 'sub_active' => $emails['active_til_purch'], 'last_sent' => "NOW()"); back_in_stock_subscription($modify_subscription, "modify"); } ?> <br/> Processed <?php echo $counted; ?> Notifications <?php if ($counted == (int) BACK_IN_STOCK_MAX_EMAILS_PER_BATCH) { echo BACK_IN_STOCK_MAIL_MANY; } } if ($preview) { ?> <br/>Preview:</br> <table> <tr> <th>Customers Name</th> <th>Customers Email</th> <th>Product</th> </tr> <?php foreach ($bis_emails as $emails) { if ($counted >= (int) BACK_IN_STOCK_MAX_EMAILS_PER_BATCH && BACK_IN_STOCK_MAX_EMAILS_PER_BATCH != '0') { break; } $counted++; ?> <tr> <td><?php echo stripslashes($emails['name']); ?> </td> <td><?php echo $emails['email']; ?> </td> <td><?php echo zen_get_products_name($emails['product_id']); ?> </td> </tr> <?php } ?> </table> <br/> You can Process <?php echo $counted; ?> Notifications by clicking: <?php echo '<a href="' . zen_href_link("cron/send_back_in_stock_notifications.php", zen_get_all_get_params(array('preview')), 'NONSSL', true, true, true) . '">' . 'HERE' . '</a>'; echo "\n" . '<br/>'; if ($counted == (int) BACK_IN_STOCK_MAX_EMAILS_PER_BATCH) { echo BACK_IN_STOCK_MAIL_MANY; } } }
<div style="display: none;"> <div id="back-in-stock-popup-wrapper"> <?php if (BACK_IN_STOCK_SHOW_PRODUCT_INFO == "true") { ?> <div id="back-in-stock-product"> <div id="back-in-stock-product-name"> <h2 id="productName"> <?php echo zen_get_products_name(zen_db_prepare_input($_GET[products_id])); ?> </h2> </div> <div id="back-in-stock-product-image"> <?php echo zen_get_products_image(zen_db_prepare_input($_GET[products_id])); ?> </div> </div> <div class="clearBoth"></div> <?php } ?> <div id="back-in-stock-popup-headline-wrapper"> <h2><?php echo BACK_IN_STOCK_POPUP_HEADING; ?> </h2> <h3><?php echo BACK_IN_STOCK_POPUP_SUBHEADING; ?>
function create_add_products($zf_insert_id, $zf_mode = false) { global $db, $currencies, $order_total_modules, $order_totals; // initialized for the email confirmation $this->products_ordered = ''; $this->products_ordered_html = ''; $this->subtotal = 0; $this->total_tax = 0; // lowstock email report $this->email_low_stock = ''; for ($i = 0, $n = sizeof($this->products); $i < $n; $i++) { $custom_insertable_text = ''; // Stock Update - Joao Correia if (STOCK_LIMITED == 'true') { if (DOWNLOAD_ENABLED == 'true') { $stock_query_raw = "select p.products_quantity, pad.products_attributes_filename, p.product_is_always_free_shipping\n from " . TABLE_PRODUCTS . " p\n left join " . TABLE_PRODUCTS_ATTRIBUTES . " pa\n on p.products_id=pa.products_id\n left join " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad\n on pa.products_attributes_id=pad.products_attributes_id\n WHERE p.products_id = '" . zen_get_prid($this->products[$i]['id']) . "'"; // Will work with only one option for downloadable products // otherwise, we have to build the query dynamically with a loop $products_attributes = $this->products[$i]['attributes']; if (is_array($products_attributes)) { $stock_query_raw .= " AND pa.options_id = '" . $products_attributes[0]['option_id'] . "' AND pa.options_values_id = '" . $products_attributes[0]['value_id'] . "'"; } $stock_values = $db->Execute($stock_query_raw); } else { $stock_values = $db->Execute("select * from " . TABLE_PRODUCTS . " where products_id = '" . zen_get_prid($this->products[$i]['id']) . "'"); } $this->notify('NOTIFY_ORDER_PROCESSING_STOCK_DECREMENT_BEGIN'); if ($stock_values->RecordCount() > 0) { // do not decrement quantities if products_attributes_filename exists if (DOWNLOAD_ENABLED != 'true' || $stock_values->fields['product_is_always_free_shipping'] == 2 || !$stock_values->fields['products_attributes_filename']) { $stock_left = $stock_values->fields['products_quantity'] - $this->products[$i]['qty']; $this->products[$i]['stock_reduce'] = $this->products[$i]['qty']; } else { $stock_left = $stock_values->fields['products_quantity']; } // $this->products[$i]['stock_value'] = $stock_values->fields['products_quantity']; $db->Execute("update " . TABLE_PRODUCTS . " set products_quantity = '" . $stock_left . "' where products_id = '" . zen_get_prid($this->products[$i]['id']) . "'"); // if ( ($stock_left < 1) && (STOCK_ALLOW_CHECKOUT == 'false') ) { if ($stock_left <= 0) { // only set status to off when not displaying sold out if (SHOW_PRODUCTS_SOLD_OUT == '0') { $db->Execute("update " . TABLE_PRODUCTS . " set products_status = 0 where products_id = '" . zen_get_prid($this->products[$i]['id']) . "'"); } } // for low stock email if ($stock_left <= STOCK_REORDER_LEVEL) { // WebMakers.com Added: add to low stock email $this->email_low_stock .= 'ID# ' . zen_get_prid($this->products[$i]['id']) . "\t\t" . $this->products[$i]['model'] . "\t\t" . $this->products[$i]['name'] . "\t\t" . ' Qty Left: ' . $stock_left . "\n"; } } } // Update products_ordered (for bestsellers list) // $db->Execute("update " . TABLE_PRODUCTS . " set products_ordered = products_ordered + " . sprintf('%d', $order->products[$i]['qty']) . " where products_id = '" . zen_get_prid($order->products[$i]['id']) . "'"); $db->Execute("update " . TABLE_PRODUCTS . " set products_ordered = products_ordered + " . sprintf('%f', $this->products[$i]['qty']) . " where products_id = '" . zen_get_prid($this->products[$i]['id']) . "'"); $this->notify('NOTIFY_ORDER_PROCESSING_STOCK_DECREMENT_END'); $sql_data_array = array('orders_id' => $zf_insert_id, 'products_id' => zen_get_prid($this->products[$i]['id']), 'products_model' => $this->products[$i]['model'], 'products_name' => $this->products[$i]['name'], 'products_price' => $this->products[$i]['price'], 'final_price' => $this->products[$i]['final_price'], 'onetime_charges' => $this->products[$i]['onetime_charges'], 'products_tax' => $this->products[$i]['tax'], 'products_quantity' => $this->products[$i]['qty'], 'products_priced_by_attribute' => $this->products[$i]['products_priced_by_attribute'], 'product_is_free' => $this->products[$i]['product_is_free'], 'products_discount_type' => $this->products[$i]['products_discount_type'], 'products_discount_type_from' => $this->products[$i]['products_discount_type_from'], 'products_prid' => $this->products[$i]['id']); zen_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array); $order_products_id = $db->Insert_ID(); $this->notify('NOTIFY_ORDER_DURING_CREATE_ADDED_PRODUCT_LINE_ITEM', array_merge(array('orders_products_id' => $order_products_id), $sql_data_array)); $this->notify('NOTIFY_ORDER_PROCESSING_CREDIT_ACCOUNT_UPDATE_BEGIN'); $order_total_modules->update_credit_account($i); //ICW ADDED FOR CREDIT CLASS SYSTEM $this->notify('NOTIFY_ORDER_PROCESSING_ATTRIBUTES_BEGIN'); //------ bof: insert customer-chosen options to order-------- $attributes_exist = '0'; $this->products_ordered_attributes = ''; if (isset($this->products[$i]['attributes'])) { $attributes_exist = '1'; for ($j = 0, $n2 = sizeof($this->products[$i]['attributes']); $j < $n2; $j++) { if (DOWNLOAD_ENABLED == 'true') { $attributes_query = "select popt.products_options_name, poval.products_options_values_name,\n pa.options_values_price, pa.price_prefix,\n pa.product_attribute_is_free, pa.products_attributes_weight, pa.products_attributes_weight_prefix,\n pa.attributes_discounted, pa.attributes_price_base_included, pa.attributes_price_onetime,\n pa.attributes_price_factor, pa.attributes_price_factor_offset,\n pa.attributes_price_factor_onetime, pa.attributes_price_factor_onetime_offset,\n pa.attributes_qty_prices, pa.attributes_qty_prices_onetime,\n pa.attributes_price_words, pa.attributes_price_words_free,\n pa.attributes_price_letters, pa.attributes_price_letters_free,\n pad.products_attributes_maxdays, pad.products_attributes_maxcount, pad.products_attributes_filename\n from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa\n left join " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad\n on pa.products_attributes_id=pad.products_attributes_id\n where pa.products_id = '" . zen_db_input($this->products[$i]['id']) . "'\n and pa.options_id = '" . $this->products[$i]['attributes'][$j]['option_id'] . "'\n and pa.options_id = popt.products_options_id\n and pa.options_values_id = '" . $this->products[$i]['attributes'][$j]['value_id'] . "'\n and pa.options_values_id = poval.products_options_values_id\n and popt.language_id = '" . $_SESSION['languages_id'] . "'\n and poval.language_id = '" . $_SESSION['languages_id'] . "'"; $attributes_values = $db->Execute($attributes_query); } else { $attributes_values = $db->Execute("select popt.products_options_name, poval.products_options_values_name,\n pa.options_values_price, pa.price_prefix,\n pa.product_attribute_is_free, pa.products_attributes_weight, pa.products_attributes_weight_prefix,\n pa.attributes_discounted, pa.attributes_price_base_included, pa.attributes_price_onetime,\n pa.attributes_price_factor, pa.attributes_price_factor_offset,\n pa.attributes_price_factor_onetime, pa.attributes_price_factor_onetime_offset,\n pa.attributes_qty_prices, pa.attributes_qty_prices_onetime,\n pa.attributes_price_words, pa.attributes_price_words_free,\n pa.attributes_price_letters, pa.attributes_price_letters_free\n from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa\n where pa.products_id = '" . $this->products[$i]['id'] . "' and pa.options_id = '" . (int) $this->products[$i]['attributes'][$j]['option_id'] . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . (int) $this->products[$i]['attributes'][$j]['value_id'] . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . $_SESSION['languages_id'] . "' and poval.language_id = '" . $_SESSION['languages_id'] . "'"); } //clr 030714 update insert query. changing to use values form $order->products for products_options_values. $sql_data_array = array('orders_id' => $zf_insert_id, 'orders_products_id' => $order_products_id, 'products_options' => $attributes_values->fields['products_options_name'], 'products_options_values' => $this->products[$i]['attributes'][$j]['value'], 'options_values_price' => $attributes_values->fields['options_values_price'], 'price_prefix' => $attributes_values->fields['price_prefix'], 'product_attribute_is_free' => $attributes_values->fields['product_attribute_is_free'], 'products_attributes_weight' => $attributes_values->fields['products_attributes_weight'], 'products_attributes_weight_prefix' => $attributes_values->fields['products_attributes_weight_prefix'], 'attributes_discounted' => $attributes_values->fields['attributes_discounted'], 'attributes_price_base_included' => $attributes_values->fields['attributes_price_base_included'], 'attributes_price_onetime' => $attributes_values->fields['attributes_price_onetime'], 'attributes_price_factor' => $attributes_values->fields['attributes_price_factor'], 'attributes_price_factor_offset' => $attributes_values->fields['attributes_price_factor_offset'], 'attributes_price_factor_onetime' => $attributes_values->fields['attributes_price_factor_onetime'], 'attributes_price_factor_onetime_offset' => $attributes_values->fields['attributes_price_factor_onetime_offset'], 'attributes_qty_prices' => $attributes_values->fields['attributes_qty_prices'], 'attributes_qty_prices_onetime' => $attributes_values->fields['attributes_qty_prices_onetime'], 'attributes_price_words' => $attributes_values->fields['attributes_price_words'], 'attributes_price_words_free' => $attributes_values->fields['attributes_price_words_free'], 'attributes_price_letters' => $attributes_values->fields['attributes_price_letters'], 'attributes_price_letters_free' => $attributes_values->fields['attributes_price_letters_free'], 'products_options_id' => (int) $this->products[$i]['attributes'][$j]['option_id'], 'products_options_values_id' => (int) $this->products[$i]['attributes'][$j]['value_id'], 'products_prid' => $this->products[$i]['id']); zen_db_perform(TABLE_ORDERS_PRODUCTS_ATTRIBUTES, $sql_data_array); $this->notify('NOTIFY_ORDER_DURING_CREATE_ADDED_ATTRIBUTE_LINE_ITEM', $sql_data_array); if (DOWNLOAD_ENABLED == 'true' && isset($attributes_values->fields['products_attributes_filename']) && zen_not_null($attributes_values->fields['products_attributes_filename'])) { $sql_data_array = array('orders_id' => $zf_insert_id, 'orders_products_id' => $order_products_id, 'orders_products_filename' => $attributes_values->fields['products_attributes_filename'], 'download_maxdays' => $attributes_values->fields['products_attributes_maxdays'], 'download_count' => $attributes_values->fields['products_attributes_maxcount'], 'products_prid' => $this->products[$i]['id']); zen_db_perform(TABLE_ORDERS_PRODUCTS_DOWNLOAD, $sql_data_array); $this->notify('NOTIFY_ORDER_DURING_CREATE_ADDED_ATTRIBUTE_DOWNLOAD_LINE_ITEM', $sql_data_array); } $this->products_ordered_attributes .= "\n\t" . $attributes_values->fields['products_options_name'] . ' ' . zen_decode_specialchars($this->products[$i]['attributes'][$j]['value']); } } //------eof: insert customer-chosen options ---- $this->notify('NOTIFY_ORDER_PROCESSING_ATTRIBUTES_EXIST', $attributes_exist); $this->notify('NOTIFY_ORDER_DURING_CREATE_ADD_PRODUCTS', $custom_insertable_text); /* START: ADD MY CUSTOM DETAILS * 1. calculate/prepare custom information to be added to this product entry in order-confirmation, perhaps as a function call to custom code to build a serial number etc: * Possible parameters to pass to custom functions at this point: * Product ID ordered (for this line item): $this->products[$i]['id'] * Quantity ordered (of this line-item): $this->products[$i]['qty'] * Order number: $zf_insert_id * Attribute Option Name ID: (int)$this->products[$i]['attributes'][$j]['option_id'] * Attribute Option Value ID: (int)$this->products[$i]['attributes'][$j]['value_id'] * Attribute Filename: $attributes_values->fields['products_attributes_filename'] * * 2. Add that data to the $this->products_ordered_attributes variable, using this sort of format: * $this->products_ordered_attributes .= {INSERT CUSTOM INFORMATION HERE}; */ $this->products_ordered_attributes .= $custom_insertable_text; /* END: ADD MY CUSTOM DETAILS */ // update totals counters $this->total_weight += $this->products[$i]['qty'] * $this->products[$i]['weight']; $this->total_tax += zen_calculate_tax($total_products_price * $this->products[$i]['qty'], $products_tax); $this->total_cost += $total_products_price; $this->notify('NOTIFY_ORDER_PROCESSING_ONE_TIME_CHARGES_BEGIN'); // build output for email notification $this->products_ordered .= $this->products[$i]['qty'] . ' x ' . $this->products[$i]['name'] . ($this->products[$i]['model'] != '' ? ' (' . $this->products[$i]['model'] . ') ' : '') . ' = ' . $currencies->display_price($this->products[$i]['final_price'], $this->products[$i]['tax'], $this->products[$i]['qty']) . ($this->products[$i]['onetime_charges'] != 0 ? "\n" . TEXT_ONETIME_CHARGES_EMAIL . $currencies->display_price($this->products[$i]['onetime_charges'], $this->products[$i]['tax'], 1) : '') . $this->products_ordered_attributes . "\n"; $this->products_ordered_html .= '<tr>' . "\n" . '<td class="product-details" align="left" valign="top" width="30">' . zen_get_products_image($this->products[$i]['id'], IMAGE_ON_INVOICE_IMAGE_WIDTH, IMAGE_ON_INVOICE_IMAGE_HEIGHT) . '</td>' . "\n" . '<td class="product-details" align="right" valign="top" width="30">' . $this->products[$i]['qty'] . ' x</td>' . "\n" . '<td class="product-details" valign="top">' . nl2br($this->products[$i]['name']) . ($this->products[$i]['model'] != '' ? ' (' . nl2br($this->products[$i]['model']) . ') ' : '') . "\n" . '<nobr>' . '<small><em> ' . nl2br($this->products_ordered_attributes) . '</em></small>' . '</nobr>' . '</td>' . "\n" . '<td class="product-details-num" valign="top" align="right">' . $currencies->display_price($this->products[$i]['final_price'], $this->products[$i]['tax'], $this->products[$i]['qty']) . ($this->products[$i]['onetime_charges'] != 0 ? '</td></tr>' . "\n" . '<tr><td class="product-details">' . nl2br(TEXT_ONETIME_CHARGES_EMAIL) . '</td>' . "\n" . '<td>' . $currencies->display_price($this->products[$i]['onetime_charges'], $this->products[$i]['tax'], 1) : '') . '</td></tr>' . "\n"; } $order_total_modules->apply_credit(); //ICW ADDED FOR CREDIT CLASS SYSTEM $this->notify('NOTIFY_ORDER_AFTER_ORDER_CREATE_ADD_PRODUCTS'); }
* @copyright Copyright 2003-2005 Zen Cart Development Team * @copyright Portions Copyright 2003 osCommerce * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0 * @version $Id: tpl_best_sellers.php 2982 2006-02-07 07:56:41Z birdbrain $ */ $content = '<ul>' . "\n"; foreach ($recent_viewed as $recent_product) { $link = zen_href_link(zen_get_info_page($recent_product), 'products_id=' . $recent_product); //bof by caizhouqing cart $rs = $db->Execute("select s.specials_new_products_price,p.products_price from (specials s,products p) where s.products_id = p.products_id and p.products_id=" . $recent_product); $products_price = $rs->fields['products_price']; //caizhouqing update specials $specials_price = $rs->fields['specials_new_products_price']; //--------- $rsp = $db->Execute("select products_quantity from products where products_id=" . $recent_product); $products_quantity = $rsp->fields['products_quantity']; //product if ($products_price != "") { $discount = 100 - $specials_price / $products_price * 100; } $content .= '<li style="text-align:center;">'; if ($products_quantity == 0) { $content .= '<span class="sold_out_cart"></span>'; } elseif (!empty($specials_price)) { $content .= '<span class="sold_discount_sidebox"><span class="sold_discount_font_sidebox">' . round($discount) . '</span></span>'; } $content .= "\n" . '<a class="ih" href="' . $link . '">' . zen_get_products_image($recent_product, '85', '85') . '</a>' . "<br />" . '<div style="text-align:left;"><a href="' . $link . '">' . zen_get_products_name($recent_product, $_SESSION['languages_id']) . '</a></div>' . "\n" . '</li>'; } $content .= '</ul>'; //eof by caizhouqing cart //caizhouqing update cart_up_pic
} } if ($need_tr) { if ($col > 0) { echo '<td style="border:none;" width="' . (THUMB_IMAGE_WIDTH + 6) * $col . 'px" colspan="' . $col . '">'; } echo '</tr>'; } echo '</table></td></tr>'; } $cart_contents = unserialize($lt_row->fields['cart_contents']); if (!empty($cart_contents)) { echo '<tr><td class="dataTableContent"><strong>' . TABLE_TEXT_CUSTOMERS_CART . '(value=' . $currencies->format($lt_row->fields['cart_total']) . ') : </strong><table cellspacing=0 cellpadding=0 border=0><tr>'; foreach ($cart_contents as $product_id => $qty_array) { $products_name = zen_get_products_name($product_id); echo '<td><table cellspacing=0 cellpadding=2 border=0 align="center" style="border:1px solid #000;"><tr><td align="center">' . zen_image(DIR_WS_CATALOG_IMAGES . zen_get_products_image($product_id), $products_name, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</td></tr><tr><td class="dataTableContent" align="center">' . $products_name . '</td></tr><tr><td class="dataTableContent">' . TABLE_TEXT_QUANTITY . $qty_array['qty'] . '</td></tr></table></td>'; } echo '</tr></table></td></tr>'; } echo '</table>'; $lt_row->MoveNext(); } //End While ?> <strong><a href="<?php echo zen_href_link(FILENAME_SUPERTRACKER, 'report=last_ten&offset=' . ($offset + 10) . '&filter=' . $filter . '&refer_match=' . $_GET['refer_match']); ?> "><?php echo TABLE_TEXT_NEXT_TEN_RESULTS; ?> </a></strong>