milerwan

Members
  • Content count

    161
  • Joined

  • Last visited

  • Days Won

    6

milerwan last won the day on May 20

milerwan had the most liked content!

Community Reputation

14 Good

1 Follower

About milerwan

  • Rank
    Osc fan
  • Birthday 12/14/1976

Profile Information

  • Real Name
    Gwenn
  • Gender
    Male
  • Location
    France

Contact Methods

Recent Profile Visitors

8,701 profile views
  1. Do you mean you have a standard version of 2.3.4 and not a Boostrap version ? Is your website under construction or is it a store already in production ?
  2. If the field 'products_status' is missing from db, you have just to create a new one : products_status tinyint(1)
  3. Minify "user.css" and "custom.css" for CSS and ".js" files is enough. To get speed and better rank from "PageSpeed Insight" by Google (https://developers.google.com/speed/pagespeed/insights/?hl=fr), take a look on this threat : http://forums.oscommerce.com/topic/410238-store-v234-bs-with-newsdesk-revival-and-responsive-boxes/?p=1748049 You will have to update your "htaccess.php" file too : http://forums.oscommerce.com/topic/410238-store-v234-bs-with-newsdesk-revival-and-responsive-boxes/?p=1748042
  4. @@raiwa @@Tsimi From the code creation page in admin, I have added a "Generate Random Code" button + javasript code. This can be nice for those who lack imagination when it comes to finding an original discount code. ;) In "admin/discount_codes.php", replace all code by this one : <?php /* $Id$ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2016 osCommerce Released under the GNU General Public License Discount Code 4.1 BS */ require('includes/application_top.php'); $action = (isset($_GET['action']) ? $_GET['action'] : ''); if (tep_not_null($action)) { switch ($action) { case 'setflag': tep_db_query("update discount_codes set status = '" . (int)$_GET['flag'] . "' where discount_codes_id = '" . (int)$_GET['dID'] . "' limit 1"); tep_redirect(tep_href_link('discount_codes.php', 'page=' . $_GET['page'])); break; case 'insert': if (!empty($_POST['discount_codes']) && !empty($_POST['discount_values'])) { $exclude_specials = isset($_POST['exclude_specials']) ? (int) $_POST['exclude_specials'] : 0; $sql_data_array = array('products_id' => '', 'categories_id' => '', 'manufacturers_id' => '', 'excluded_products_id' => '', 'customers_id' => '', 'orders_total' => '0', 'shipping' => '0', 'newsletter' => (int)$_POST['newsletter'], 'order_number' => (int)$_POST['order_number'], 'order_info' => (int)$_POST['order_info'], 'exclude_specials' => $exclude_specials, 'discount_codes' => tep_db_prepare_input($_POST['discount_codes']), 'discount_values' => tep_db_prepare_input($_POST['discount_values']), 'minimum_order_amount' => tep_db_prepare_input($_POST['minimum_order_amount']), 'expires_date' => empty($_POST['expires_date']) ? '0000-00-00' : tep_db_prepare_input($_POST['expires_date']), 'number_of_use' => (int)$_POST['number_of_use'], 'number_of_products' => 0); $error = true; if ((int)$_POST['applies_to'] == 1) { if (isset($_POST['products_id']) && is_array($_POST['products_id']) && sizeof($_POST['products_id']) > 0) { $sql_data_array['products_id'] = implode(',', $_POST['products_id']); $error = false; } } elseif ((int)$_POST['applies_to'] == 2) { if (isset($_POST['categories_id']) && is_array($_POST['categories_id']) && sizeof($_POST['categories_id']) > 0) { $sql_data_array['categories_id'] = implode(',', $_POST['categories_id']); $error = false; } } elseif ((int)$_POST['applies_to'] == 3) { $sql_data_array['orders_total'] = 1; // total $error = false; } elseif ((int)$_POST['applies_to'] == 4) { if (isset($_POST['manufacturers_id']) && is_array($_POST['manufacturers_id']) && sizeof($_POST['manufacturers_id']) > 0) { $sql_data_array['manufacturers_id'] = implode(',', $_POST['manufacturers_id']); $error = false; } } elseif ((int)$_POST['applies_to'] == 5) { $sql_data_array['orders_total'] = 2; // subtotal $error = false; } elseif ((int)$_POST['applies_to'] == 6) { $sql_data_array['shipping'] = 2; // shipping $error = false; } if ((int)$_POST['applies_to'] == 2 || (int)$_POST['applies_to'] == 4) { if (isset($_POST['excluded_products_id']) && is_array($_POST['excluded_products_id']) && sizeof($_POST['excluded_products_id']) > 0) { $sql_data_array['excluded_products_id'] = implode(',', $_POST['excluded_products_id']); } } if ((int)$_POST['applies_to'] != 3 && !empty($_POST['number_of_products'])) { $sql_data_array['number_of_products'] = (int)$_POST['number_of_products']; } if (!empty($_POST['customers']) && $_POST['customers'] == 1) { if (is_array($_POST['customers_id']) && sizeof($_POST['customers_id']) > 0) { $sql_data_array['customers_id'] = implode(',', $_POST['customers_id']); } } if (!empty($_POST['newsletter']) && $_POST['newsletter'] == 1) { $sql_data_array['newsletter'] = (int)$_POST['newsletter']; } if (!empty($_POST['order_number']) && $_POST['order_number'] > 0) { $sql_data_array['order_number'] = (int)$_POST['order_number']; } if ($error == false) { if (empty($_GET['dID'])) { tep_db_perform('discount_codes', $sql_data_array); $messageStack->add_session(SUCCESS_DISCOUNT_CODE_INSERTED, 'success'); } else { tep_db_perform('discount_codes', $sql_data_array, 'update', "discount_codes_id = '" . (int)$_GET['dID'] . "'"); $messageStack->add_session(SUCCESS_DISCOUNT_CODE_UPDATED, 'success'); } tep_redirect(tep_href_link('discount_codes.php')); } } $action = 'new'; break; case 'deleteconfirm': tep_db_query("delete from customers_to_discount_codes where discount_codes_id = '" . (int)$_GET['dID'] . "'"); tep_db_query("delete from discount_codes where discount_codes_id = '" . (int)$_GET['dID'] . "' limit 1"); $messageStack->add_session(SUCCESS_DISCOUNT_CODE_REMOVED, 'success'); tep_redirect(tep_href_link('discount_codes.php', 'page=' . $_GET['page'])); break; } } require('includes/classes/currencies.php'); $currencies = new currencies(); require('includes/template_top.php'); if ($action == 'new') { ?> <?php echo tep_draw_form('new_discount_code', 'discount_codes.php', (isset($_GET['page']) ? 'page=' . $_GET['page'] . '&' : '') . 'action=insert' . (isset($_GET['dID']) ? '&dID=' . (int)$_GET['dID'] : '')); ?> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td> </tr> </table></td> </tr> <?php $dInfo = new objectInfo(array('products_id' => '', 'categories_id' => '', 'manufacturers_id' => '', 'excluded_products_id' => '', 'customers_id' => '', 'orders_total' => '2', 'shipping' => '', 'newsletter' => '', 'order_number' => '', 'order_info' => '', 'exclude_specials' => '', 'discount_codes' => substr(md5(uniqid(rand(), true)), 0, 8), 'discount_values' => '', 'minimum_order_amount' => '', 'expires_date' => '', 'number_of_orders' => '', 'number_of_use' => '1', 'number_of_products' => '1', 'status' => '')); if (isset($_GET['dID'])) { $discount_code_query = tep_db_query("select * from discount_codes where discount_codes_id = '" . (int)$_GET['dID'] . "'"); $discount_code = tep_db_fetch_array($discount_code_query); $dInfo->objectInfo($discount_code); if (!empty($discount_code['products_id'])) $dInfo->products_id = explode(',', $discount_code['products_id']); if (!empty($discount_code['categories_id'])) $dInfo->categories_id = explode(',', $discount_code['categories_id']); if (!empty($discount_code['manufacturers_id'])) $dInfo->manufacturers_id = explode(',', $discount_code['manufacturers_id']); if (!empty($discount_code['excluded_products_id'])) $dInfo->excluded_products_id = explode(',', $discount_code['excluded_products_id']); if (!empty($discount_code['customers_id'])) $dInfo->customers_id = explode(',', $discount_code['customers_id']); if ($discount_code['minimum_order_amount'] == '0.0000') $dInfo->minimum_order_amount = ''; if ($discount_code['expires_date'] == '0000-00-00') $dInfo->expires_date = ''; if ($discount_code['number_of_use'] == 0) $dInfo->number_of_use = ''; if ($discount_code['number_of_products'] == 0) $dInfo->number_of_products = ''; } $manufacturers_array = array(); $manufacturers_query = tep_db_query("select manufacturers_id, manufacturers_name from manufacturers order by manufacturers_name"); while ($manufacturers = tep_db_fetch_array($manufacturers_query)) { $manufacturers_array[] = array('id' => $manufacturers['manufacturers_id'], 'text' => $manufacturers['manufacturers_name']); } ?> <script language="javascript"> $(document).ready(function() { if (<?php echo ((basename($PHP_SELF) == 'discount_codes.php' && isset($action) && $action == 'new') ? 'true' : 'false')?>) { onload(); } }); function applies_to_onclick() { var a = document.new_discount_code.applies_to, b = document.getElementById("excluded_products_id"), c = document.getElementById("number_of_products"), d = document.getElementById("exclude_specials"); for (var i = 0, n = a.length; i < n; i++) if (a[i].checked) { b.disabled = (a[i].value == 2 || a[i].value == 4 ? false : true); c.disabled = (a[i].value == 3 || a[i].value == 5 || a[i].value == 6 ? true : false); d.disabled = (a[i].value == 3 || a[i].value == 5 || a[i].value == 6 ? true : false) } } function customers_onclick() { var d = document.getElementById("customers"), e = document.getElementById("customers_id"); e.disabled = !d.checked; } function onload() { SetFocus(); applies_to_onclick(); customers_onclick(); } var Password = { // _pattern : /[a-zA-Z0-9_\-\+\.]/, _pattern : /[a-zA-Z0-9]/, _getRandomByte : function() { // http://caniuse.com/#search=getrandomvalues if(window.crypto && window.crypto.getRandomValues) { var result = new Uint8Array(1); window.crypto.getRandomValues(result); return result[0]; } else if(window.msCrypto && window.msCrypto.getRandomValues) { var result = new Uint8Array(1); window.msCrypto.getRandomValues(result); return result[0]; } else { return Math.floor(Math.random() * 256); } }, generate : function(length) { return Array.apply(null, {'length': length}) .map(function() { var result; while(true) { result = String.fromCharCode(this._getRandomByte()); if(this._pattern.test(result)) { return result; } } }, this) .join(''); } }; </script> <tr> <td><table border="0" cellspacing="0" cellpadding="2"> <tr> <td class="main" colspan="4"><?php echo TEXT_DISCOUNT_EXPL; ?></td> <td><input type="button" value="Generate Random Code" onclick="document.getElementById('code').value = Password.generate(8)"></td> </tr> <tr> <td class="main"><?php echo TEXT_DISCOUNT_CODE; ?></td> <td class="main"><?php echo tep_draw_input_field('discount_codes', $dInfo->discount_codes, 'size="8" id="code"', true); ?></td> <td width="50"></td> <td class="main"><?php echo TEXT_NUMBER_OF_USE; ?></td> <td class="main"><?php echo tep_draw_input_field('number_of_use', $dInfo->number_of_use, 'size="4"'); ?></td> </tr> <tr> <td class="main"><?php echo TEXT_DISCOUNT; ?></td> <td class="main"><?php echo tep_draw_input_field('discount_values', $dInfo->discount_values, 'size="8"', true); ?></td> <td></td> <td class="main"><?php echo TEXT_NUMBER_OF_PRODUCTS; ?></td> <td class="main"><?php echo tep_draw_input_field('number_of_products', $dInfo->number_of_products, 'size="4" id="number_of_products"'); ?></td> </tr> <tr> <td class="main"><?php echo TEXT_MINIMUM_ORDER_SUB_TOTAL; ?></td> <td class="main"><?php echo tep_draw_input_field('minimum_order_amount', $dInfo->minimum_order_amount, 'size="8"'); ?></td> <td></td> <td class="main" colspan="2"><?php echo '<label>' . tep_draw_checkbox_field('order_info', '1', $dInfo->order_info == 1) . ' ' . TEXT_ORDER_INFO . '</label>'; ?></td> </tr> <tr> <td class="main"><?php echo TEXT_EXPIRY; ?></td> <td class="main"><?php echo tep_draw_input_field('expires_date', $dInfo->expires_date, 'id="expires_date" size="12"'); ?></td> <td></td> <td class="main" colspan="2"><?php echo '<label>' . str_replace('name="exclude_specials"', 'name="exclude_specials" id="exclude_specials"', tep_draw_checkbox_field('exclude_specials', '1', $dInfo->exclude_specials == 1)) . ' ' . TEXT_EXCLUDE_SPECIALS . '</label>'; ?></td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> <tr> <td><table border="0" cellspacing="0" cellpadding="2"> <tr> <td class="main"><?php echo TEXT_APPLIES_TO; ?></td> <td width="5"></td> <td class="main"><?php echo '<label>' . str_replace('<input type="radio"', '<input onclick="applies_to_onclick();" type="radio"', tep_draw_radio_field('applies_to', '5', $dInfo->orders_total == 2)) . ' ' . TEXT_ORDER_SUBTOTAL . '</label>'; ?></td> <td width="5"></td> <td class="main"><?php echo '<label>' . str_replace('<input type="radio"', '<input onclick="applies_to_onclick();" type="radio"', tep_draw_radio_field('applies_to', '6', $dInfo->shipping == 2)) . ' ' . TEXT_SHIPPING . '</label>'; ?></td> </tr> <tr> <td class="main"><?php echo '<label>' . str_replace('<input type="radio"', '<input onclick="applies_to_onclick();" type="radio"', tep_draw_radio_field('applies_to', '1', is_array($dInfo->products_id))) . ' ' . TEXT_PRODUCTS . '</label>'; ?></td> <td></td> <td class="main"><?php echo '<label>' . str_replace('<input type="radio"', '<input onclick="applies_to_onclick();" type="radio"', tep_draw_radio_field('applies_to', '2', is_array($dInfo->categories_id))) . ' ' . TEXT_CATEGORIES . '</label>'; ?></td> <td></td> <td class="main"><?php echo '<label>' . str_replace('<input type="radio"', '<input onclick="applies_to_onclick();" type="radio"', tep_draw_radio_field('applies_to', '4', is_array($dInfo->manufacturers_id))) . ' ' . TEXT_MANUFACTURERS . '</label>'; ?></td> </tr> <?php $products_id = ''; $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_price, s.specials_new_products_price from (products p, products_description pd) left join specials s on (p.products_id = s.products_id and s.status = '1' and ifnull(s.expires_date, now()) >= now()) where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by products_name"); while ($products = tep_db_fetch_array($products_query)) { $products_id .= '<option value="' . $products['products_id'] . '">' . $products['products_name'] . ' (' . (empty($products['specials_new_products_price']) ? '' : $currencies->format($products['specials_new_products_price']) . '/') . $currencies->format($products['products_price']) . ')</option>'; } $products_id .= '</select>'; $excluded_products_id = '<select name="excluded_products_id[]" size="10" multiple style="width: 280px;" id="excluded_products_id">' . $products_id; $products_id = '<select name="products_id[]" size="10" multiple style="width: 280px;">' . $products_id; if (is_array($dInfo->products_id)) { foreach ($dInfo->products_id as $v) { $products_id = str_replace('<option value="' . $v . '">', '<option value="' . $v . '" selected>', $products_id); } } if (is_array($dInfo->excluded_products_id)) { foreach ($dInfo->excluded_products_id as $v) { $excluded_products_id = str_replace('<option value="' . $v . '">', '<option value="' . $v . '" selected>', $excluded_products_id); } } $categories_id = str_replace('<select name="categories_id">', '<select name="categories_id[]" size="10" multiple style="width: 280px;">', tep_draw_pull_down_menu('categories_id', tep_get_category_tree('0', '', '0'))); if (is_array($dInfo->categories_id)) { foreach ($dInfo->categories_id as $v) { $categories_id = str_replace('<option value="' . $v . '">', '<option value="' . $v . '" selected>', $categories_id); } } $manufacturers_id = str_replace('<select name="manufacturers_id">', '<select name="manufacturers_id[]" size="10" multiple style="width: 280px;">', tep_draw_pull_down_menu('manufacturers_id', $manufacturers_array)); if (is_array($dInfo->manufacturers_id)) { foreach ($dInfo->manufacturers_id as $v) { $manufacturers_id = str_replace('<option value="' . $v . '">', '<option value="' . $v . '" selected>', $manufacturers_id); } } ?> <tr> <td class="main"><?php echo $products_id; ?></td> <td></td> <td class="main"><?php echo $categories_id; ?></td> <td></td> <td class="main"><?php echo $manufacturers_id; ?></td> </tr> <tr> <td class="main"><?php echo TEXT_EXCLUDED_PRODUCTS; ?></td> <td></td> <td class="main"><?php echo '<label>' . str_replace('<input type="checkbox"', '<input type="checkbox" id="customers" onclick="customers_onclick();"', tep_draw_checkbox_field('customers', '1', is_array($dInfo->customers_id))) . ' ' . TEXT_CUSTOMERS . '</label>'; ?></td> </tr> <tr> <td class="main"><?php echo $excluded_products_id; ?></td> <td></td> <?php $customers_id = '<select name="customers_id[]" size="10" multiple style="width: 280px;" id="customers_id">'; $customers_query = tep_db_query("select customers_id, concat(customers_lastname, ', ', customers_firstname, ' (', customers_email_address, ')') as customers_info from customers order by customers_lastname, customers_firstname"); while ($customers = tep_db_fetch_array($customers_query)) { $customers_id .= '<option value="' . $customers['customers_id'] . '">' . $customers['customers_info'] . '</option>'; } $customers_id .= '</select>'; if (is_array($dInfo->customers_id)) { foreach ($dInfo->customers_id as $v) { $customers_id = str_replace('<option value="' . $v . '">', '<option value="' . $v . '" selected>', $customers_id); } } ?> <td class="main"><?php echo $customers_id; ?></td> <td></td> <td class="main"><?php echo '<label>' . TEXT_NEWSLETTER_CUSTOMERS . ': ' . '<input type="checkbox" id="newsletter"', tep_draw_checkbox_field('newsletter', '1', $dInfo->newsletter == 1) . '</label>'; ?> <br><br><?php echo '<label>' . TEXT_ORDER_CUSTOMERS . ': ' . tep_draw_input_field('order_number', $dInfo->order_number, 'size="4"') . '</label><br>' . TEXT_ORDER_CUSTOMERS_NOTE; ?> </tr> </table> <script type="text/javascript"> $('#expires_date').datepicker({ dateFormat: 'yy-mm-dd' }); </script> </td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td class="smallText" align="right" valign="top" nowrap><?php echo tep_draw_button(IMAGE_SAVE, 'disk', null, 'primary') . tep_draw_button(IMAGE_CANCEL, 'close', tep_href_link('discount_codes.php', (isset($_GET['page']) ? 'page=' . $_GET['page'] . '&' : '') . (isset($_GET['dID']) ? 'dID=' . (int)$_GET['dID'] : ''))); ?></td> </tr> </table></td> </tr> </table> </form> <?php } else { ?> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td> </tr> </table></td> </tr> <?php ?> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr class="dataTableHeadingRow"> <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_DISCOUNT_CODE; ?></td> <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_APPLIES_TO; ?></td> <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_DISCOUNT; ?></td> <td class="dataTableHeadingContent" align="center" alt="<?php echo TABLE_HEADING_MINIMUM_ORDER_AMOUNT_FULL; ?>" title=" <?php echo TABLE_HEADING_MINIMUM_ORDER_AMOUNT_FULL; ?> "><?php echo TABLE_HEADING_MINIMUM_ORDER_AMOUNT; ?></td> <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_EXPIRY; ?></td> <td class="dataTableHeadingContent" align="center" alt="<?php echo TABLE_HEADING_NUMBER_OF_ORDERS_FULL; ?>" title=" <?php echo TABLE_HEADING_NUMBER_OF_ORDERS_FULL; ?> "><?php echo TABLE_HEADING_NUMBER_OF_ORDERS; ?></td> <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_STATUS; ?></td> <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?> </td> </tr> <?php $discount_codes_query_raw = "select * from discount_codes order by discount_codes_id desc"; $discount_codes_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS, $discount_codes_query_raw, $discount_codes_query_numrows); $discount_codes_query = tep_db_query($discount_codes_query_raw); while ($discount_codes = tep_db_fetch_array($discount_codes_query)) { $applies_to = ''; if (!empty($discount_codes['orders_total'])) { if ($discount_codes['orders_total'] == 2) { $applies_to = TEXT_ORDER_SUBTOTAL; } } elseif (!empty($discount_codes['shipping'])) { if ($discount_codes['shipping'] == 2) { $applies_to = TEXT_SHIPPING; } } elseif (!empty($discount_codes['products_id'])) { $applies_to = TEXT_PRODUCTS; $product_query = tep_db_query("select products_name from products_description where products_id in (" . $discount_codes['products_id'] . ") and language_id = '" . (int)$languages_id . "' order by products_name"); while ($product = tep_db_fetch_array($product_query)) { $applies_to .= (empty($applies_to) ? '' : '<br>') . $product['products_name']; } } elseif (!empty($discount_codes['categories_id'])) { $applies_to = TEXT_CATEGORIES; $category_query = tep_db_query("select c.categories_id from categories c, categories_description cd where c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' and c.categories_id in (" . $discount_codes['categories_id'] . ") order by c.parent_id, cd.categories_name"); while ($category = tep_db_fetch_array($category_query)) { $applies_to .= (empty($applies_to) ? '' : '<br>') . tep_output_generated_category_path($category['categories_id']); } } else { $applies_to = TEXT_MANUFACTURERS; $manufacturer_query = tep_db_query("select manufacturers_name from manufacturers where manufacturers_id in (" . $discount_codes['manufacturers_id'] . ") order by manufacturers_name"); while ($manufacturer = tep_db_fetch_array($manufacturer_query)) { $applies_to .= (empty($applies_to) ? '' : '<br>') . $manufacturer['manufacturers_name']; } } if (!empty($discount_codes['excluded_products_id'])) { $applies_to .= '<br>' . TEXT_EXCLUDED_PRODUCTS; $product_query = tep_db_query("select products_name from products_description where products_id in (" . $discount_codes['excluded_products_id'] . ") and language_id = '" . (int)$languages_id . "' order by products_name"); while ($product = tep_db_fetch_array($product_query)) { $applies_to .= (empty($applies_to) ? '' : '<br>') . $product['products_name']; } } if ((!isset($_GET['dID']) || (isset($_GET['dID']) && ($_GET['dID'] == $discount_codes['discount_codes_id']))) && !isset($dInfo) && (substr($action, 0, 3) != 'new')) { $dInfo = new objectInfo($discount_codes); } if (isset($dInfo) && is_object($dInfo) && ($discount_codes['discount_codes_id'] == $dInfo->discount_codes_id)) { echo ' <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link('discount_codes.php', 'page=' . $_GET['page'] . '&dID=' . $dInfo->discount_codes_id) . '\'">' . "\n"; } else { echo ' <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link('discount_codes.php', 'page=' . $_GET['page'] . '&dID=' . $discount_codes['discount_codes_id']) . '\'">' . "\n"; } ?> <td class="dataTableContent"><?php echo $discount_codes['discount_codes']; ?></td> <td class="dataTableContent"><?php echo $applies_to; ?></td> <td class="dataTableContent" align="center"> <?php switch ($discount_codes['discount_values']) { case strpos($discount_codes['discount_values'], '%') == true: $discount_codes_value = $discount_codes['discount_values']; break; default: $discount_codes_value = $currencies->format($discount_codes['discount_values']); } echo $discount_codes_value; ?> </td> <td class="dataTableContent" align="center"><?php echo $discount_codes['minimum_order_amount'] == '0.0000' ? '-' : $currencies->format($discount_codes['minimum_order_amount']); ?></td> <td class="dataTableContent" align="center"><?php echo $discount_codes['expires_date'] == '0000-00-00' ? '-' : tep_date_short($discount_codes['expires_date']); ?> </td> <td class="dataTableContent" align="center"><?php echo $discount_codes['number_of_orders']; ?></td> <td class="dataTableContent" align="right"> <?php if ($discount_codes['status'] == '1') { echo tep_image('images/icon_status_green.gif', 'Active', 10, 10) . ' <a href="' . tep_href_link('discount_codes.php', 'page=' . $_GET['page'] . '&dID=' . $discount_codes['discount_codes_id'] . '&action=setflag&flag=0') . '">' . tep_image('images/icon_status_red_light.gif', 'Set Inactive', 10, 10) . '</a>'; } else { echo '<a href="' . tep_href_link('discount_codes.php', 'page=' . $_GET['page'] . '&dID=' . $discount_codes['discount_codes_id'] . '&action=setflag&flag=1') . '">' . tep_image('images/icon_status_green_light.gif', 'Set Active', 10, 10) . '</a> ' . tep_image('images/icon_status_red.gif', 'Inactive', 10, 10); } ?></td> <td class="dataTableContent" align="right"><?php if (isset($dInfo) && is_object($dInfo) && ($discount_codes['discount_codes_id'] == $dInfo->discount_codes_id)) { echo tep_image('images/icon_arrow_right.gif', ''); } else { echo '<a href="' . tep_href_link('discount_codes.php', 'page=' . $_GET['page'] . '&dID=' . $discount_codes['discount_codes_id']) . '">' . tep_image('images/icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?> </td> </tr> <?php } ?> <tr> <td colspan="8"><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td class="smallText" valign="top"><?php echo $discount_codes_split->display_count($discount_codes_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $_GET['page'], TEXT_DISPLAY_NUMBER_OF_DISCOUNT_CODES); ?></td> <td class="smallText" align="right"><?php echo $discount_codes_split->display_links($discount_codes_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $_GET['page']); ?></td> </tr> <tr> <td class="smallText" align="right" colspan="2"><?php echo tep_draw_button(IMAGE_NEW_DISCOUNT_CODE, 'plus', tep_href_link('discount_codes.php', 'action=new')); ?></td> </tr> </table></td> </tr> </table></td> <?php $heading = array(); $contents = array(); switch ($action) { case 'delete': $heading[] = array('text' => '<strong>' . $dInfo->discount_codes . '</strong>'); $contents = array('form' => tep_draw_form('discount_codes', 'discount_codes.php', 'page=' . $_GET['page'] . '&dID=' . $dInfo->discount_codes_id . '&action=deleteconfirm')); $contents[] = array('text' => TEXT_INFO_DELETE_INTRO); $contents[] = array('align' => 'center', 'text' => '<br />' . tep_draw_button(IMAGE_DELETE, 'trash', null, 'primary') . tep_draw_button(IMAGE_CANCEL, 'close', tep_href_link('discount_codes.php', 'page=' . $_GET['page'] . '&dID=' . $_GET['dID']))); break; default: if (is_object($dInfo)) { $heading[] = array('text' => '<strong>' . $dInfo->discount_codes . '</strong>'); $contents[] = array('align' => 'center', 'text' => tep_draw_button(IMAGE_EDIT, 'document', tep_href_link('discount_codes.php', 'page=' . $_GET['page'] . '&dID=' . $dInfo->discount_codes_id . '&action=new')) . tep_draw_button(IMAGE_DELETE, 'trash', tep_href_link('discount_codes.php', 'page=' . $_GET['page'] . '&dID=' . $dInfo->discount_codes_id . '&action=delete'))); $contents[] = array('text' => '<br />'); if ($dInfo->order_info == 1) $contents[] = array('text' => tep_image('images/icons/tick.gif', TABLE_HEADING_ORDER_INFO_FULL) . ' ' . TABLE_HEADING_ORDER_INFO_FULL); if ($dInfo->exclude_specials == 1) $contents[] = array('text' => tep_image('images/icons/tick.gif', TEXT_EXCLUDE_SPECIALS) . ' ' . TEXT_EXCLUDE_SPECIALS); if ($dInfo->newsletter == 1) $contents[] = array('text' => tep_image('images/icons/tick.gif', TEXT_NEWSLETTER) . ' ' . TEXT_NEWSLETTER); if ($dInfo->order_number > 0) $contents[] = array('text' => tep_image('images/icons/tick.gif', TEXT_ORDER_NUMBER) . ' ' . TEXT_ORDER_NUMBER . $dInfo->order_number); if ($dInfo->number_of_use != 0) $contents[] = array('text' => TABLE_HEADING_NUMBER_OF_USE . ' ' . $dInfo->number_of_use); if ($dInfo->number_of_products != 0) $contents[] = array('text' => TABLE_HEADING_NUMBER_OF_PRODUCTS . ' ' . $dInfo->number_of_products); if (!empty($dInfo->customers_id)) { $select_string = ''; $customers_query = tep_db_query("select concat(customers_lastname, ', ', customers_firstname, ' (', customers_email_address, ')') as customers_info from customers where customers_id in (" . $dInfo->customers_id . ") order by customers_lastname, customers_firstname"); while ($customers = tep_db_fetch_array($customers_query)) { $select_string .= (empty($select_string) ? '' : '<br>') . $customers['customers_info']; } if (!empty($select_string)) { $contents[] = array('text' => '<br />' . TEXT_INFO_CUSTOMERS . '<br />' . $select_string); } } } break; } if ( (tep_not_null($heading)) && (tep_not_null($contents)) ) { echo ' <td width="25%" valign="top">' . "\n"; $box = new box; echo $box->infoBox($heading, $contents); echo ' </td>' . "\n"; } ?> </tr> </table></td> </tr> </table> <?php } require('includes/template_bottom.php'); require('includes/application_bottom.php'); ?> Enjoy !
  5. Try to install it on a new and unmodifed version of 2.3.4 BS to test if the modal cart works. If it works then maybe you have some missing files or code lines to launch it from your current script.
  6. You need to go to "Admin > My Store > Display Shopping Cart" and turn it to false to have Modal Cart window.
  7. Hi, Use this one for 2.3.4 BS : http://addons.oscommerce.com/info/9334 Cheers
  8. Sorry use this code, because tep_round is not good for sprintf occurence and redo the calculating error : // $amount = sprintf("%03d", $amount * $this->_getCurrencyUnit($currency)); $amount = tep_round($amount,2) * $this->_getCurrencyUnit($currency); $amount = sprintf("%03d", round($amount,2));
  9. @@Gergely @@raiwa Today I discovered a vicious bug which crashes the scrolling of the pages via the mouse wheel. To cause the bug, during (or just before) the pop-up of the "modal-cart" appears, move the mouse wheel. Once out of the "modal-cart" pop-up page, the scrolling feature with the mouse wheel is crashed and you have to close the window of the browser then re-open a new window to retrive the scrolling feature of the wheel. Let me know if you find the same bug with your test sites. Regards.
  10. @@Dan Cole It's ok, I found the way to have correct calculating of "ot_total_ht" value ($order->info['total_ht']). In "edit_orders.php" and "edit_order_ajax.php" files, add these new occurences between -> // Add ot_total_ht : if ($ot_title != '') { //7 // Add ot_total_ht if ($order_totals[$i]['code'] != 'ot_total_ht') { // Add ot_total_ht $new_order_totals[] = array('title' => $ot_title, 'text' => (($ot_class != 'ot_total') ? $order_totals[$i]['text'] : '<b>' . $currencies->format($order->info['total'], true, $order->info['currency'], $order->info['currency_value']) . '</b>'), 'value' => (($order_totals[$i]['code'] != 'ot_total') ? $order_totals[$i]['value'] : $order->info['total']), 'code' => $order_totals[$i]['code'], // 'sort_order' => $j); 'sort_order' => ((array_key_exists($order_totals[$i]['code'], $sort_order)) ? $sort_order[$order_totals[$i]['code']] : $j)); // Add ot_total_ht } else { $new_order_totals[] = array('title' => $ot_title, 'text' => $currencies->format($order->info['total_ht'], true, $order->info['currency'], $order->info['currency_value']), 'value' => $order->info['total_ht'], 'code' => 'ot_total_ht', // 'sort_order' => $j); 'sort_order' => ((array_key_exists($order_totals[$i]['code'], $sort_order)) ? $sort_order[$order_totals[$i]['code']] : $j)); } // Add ot_total_ht $written_ot_totals_array[] = $ot_class; $written_ot_titles_array[] = $ot_title; $j++; } else { //within 7 And a little lower : $new_order_totals[] = array('title' => $ot_title, 'text' => $currencies->format($ot_value, true, $order->info['currency'], $order->info['currency_value']), 'value' => $ot_value, // Add ot_discount // 'code' => 'ot_custom_' . $j, 'code' => 'ot_discount', // Add ot_discount // 'sort_order' => $j); 'sort_order' => ((array_key_exists($order_totals[$i]['code'], $sort_order)) ? $sort_order[$order_totals[$i]['code']] : $j)); $order->info['total'] += $ot_value; // Add ot_total_ht reset($order->info['tax_groups']); while (list($key, $value) = each($order->info['tax_groups'])) { if ($value != '') { $order->info['total_ht'] -= $tax_to_add - $ot_value; } else { $order->info['total_ht'] += $ot_value; } } // Add ot_total_ht $written_ot_totals_array[] = $ot_class; $written_ot_titles_array[] = $ot_title; $j++; } //end 3 Now "ot_total_ht" class is fully supported under Order Editor. :thumbsup:
  11. Here is the problem (for anyone who wants to help). In "includes/modules/order_total" you have : - ot_total.php : 'value' => $order->info['total']); - ot_tax.php : 'value' => $value); - ot_total_ht.php (mine) : 'value' => $order->info['total'] - $value); The problem is that Order Editor, to add discount value (ot_custom/discount), use this code in "edit_order(_ajax).php" files : $new_order_totals[] = array('title' => $ot_title, 'text' => $currencies->format($ot_value, true, $order->info['currency'], $order->info['currency_value']), 'value' => $ot_value, // Add ot_discount // 'code' => 'ot_custom_' . $j, 'code' => 'ot_discount', // Add ot_discount 'sort_order' => $j); $order->info['total'] += $ot_value; $order->info['total'] += $ot_value; But $order->info['total'] variable is not affected by this add if you try an "echo $order->info['total']" from any order_total module. So all is needed is to recover/transmit this updated variable to affect $order->info['total'] value from "order_total" modules. But I don't know how to proceed. ^_^'
  12. I have added new order_total module that shows "Total Excl. Tax", 100% work from catalog but, from Order Editor, when editing order, Discount amount is not applied to this new field. From Order Editor, currently I have : Sub-total TTC: 24.00 € Discount (INF10): -10.00 € Shipping cost (0.07kg): 5.40 € Total Incl. Tax: 19.40 € VAT 20%: 3.23 € Total Excl. Tax: 24.50 € But the expected result must be : Sub-total TTC: 24.00 € Discount (INF10): -10.00 € Shipping cost (0.07kg): 5.40 € Total Incl. Tax: 19.40 € VAT 20%: 3.23 € Total Excl. Tax: 16.17 € Here is my last version of order_total module Total Amount Excl. Tax (VAT) with no core change : http://addons.oscommerce.com/info/9568 I think "Order Editor" needs core changes to apply "ot_custom/discount" to this new class (ot_total_ht) because when I edit the edit_order.php or edit_order_ajax.php, the addition of "ot_custom/discount" value to "ot_total" value is forced : $new_order_totals[] = array('title' => $ot_title, 'text' => $currencies->format($ot_value, true, $order->info['currency'], $order->info['currency_value']), 'value' => $ot_value, // Add ot_discount // 'code' => 'ot_custom_' . $j, 'code' => 'ot_discount', // Add ot_discount 'sort_order' => $j); $order->info['total'] += $ot_value; $written_ot_totals_array[] = $ot_class; $written_ot_titles_array[] = $ot_title; $j++; $order->info['total'] += $ot_value; This line adds $ot_value to $order->info['total'] but it has no impact on total_ht. Here is the structure of my ot_total_ht class : function process() { global $order, $currencies; reset($order->info['tax_groups']); while (list($key, $value) = each($order->info['tax_groups'])) { if (DISPLAY_PRICE_WITH_TAX == 'true') { $total_ht = $order->info['total'] - $value; } else { $total_ht = $order->info['total'] + $value; } // $this->output[] = array('title' => $this->title . ':', $this->output[] = array('title' => (DISPLAY_PRICE_WITH_TAX == 'true' ? MODULE_ORDER_TOTAL_TOTAL_HT_TITLE : MODULE_ORDER_TOTAL_TOTAL_TTC_TITLE) .':', 'text' => $currencies->format($total_ht, true, $order->info['currency'], $order->info['currency_value']), 'value' => $total_ht); } } Ca anyone help me to get correct total calculating for "ot_total_ht" ?
  13. @@Dan Cole The sort_order does not affect the result. Just try my module and you will see what I mean. I think "Order Editor" needs core changes to apply "ot_custom/discount" to this new class (ot_total_ht) because when I edit the edit_order.php or edit_order_ajax.php, the addition of "ot_custom/discount" value to "ot_total" value is forced : $new_order_totals[] = array('title' => $ot_title, 'text' => $currencies->format($ot_value, true, $order->info['currency'], $order->info['currency_value']), 'value' => $ot_value, // Add ot_discount // 'code' => 'ot_custom_' . $j, 'code' => 'ot_discount', // Add ot_discount 'sort_order' => $j); $order->info['total'] += $ot_value; $written_ot_totals_array[] = $ot_class; $written_ot_titles_array[] = $ot_title; $j++; $order->info['total'] += $ot_value; This line adds $ot_value to $order->info['total'] but it has no impact on total_ht. Here is the structure of my ot_total_ht class : function process() { global $order, $currencies; reset($order->info['tax_groups']); while (list($key, $value) = each($order->info['tax_groups'])) { if (DISPLAY_PRICE_WITH_TAX == 'true') { $total_ht = $order->info['total'] - $value; } else { $total_ht = $order->info['total'] + $value; } // $this->output[] = array('title' => $this->title . ':', $this->output[] = array('title' => (DISPLAY_PRICE_WITH_TAX == 'true' ? MODULE_ORDER_TOTAL_TOTAL_HT_TITLE : MODULE_ORDER_TOTAL_TOTAL_TTC_TITLE) .':', 'text' => $currencies->format($total_ht, true, $order->info['currency'], $order->info['currency_value']), 'value' => $total_ht); } }
  14. Hi Dan, I have added new order_total module that shows "Total Excl. Tax", 100% work from catalog but, from Order Editor, when editing order, Discount amount is not applied to this new field. From Order Editor, currently I have : Sub-total TTC: 24.00 € Discount (INF10): -10.00 € Shipping cost (0.07kg): 5.40 € Total Incl. Tax: 19.40 € VAT 20%: 3.23 € Total Excl. Tax: 24.50 € But the expected result must be : Sub-total TTC: 24.00 € Discount (INF10): -10.00 € Shipping cost (0.07kg): 5.40 € Total Incl. Tax: 19.40 € VAT 20%: 3.23 € Total Excl. Tax: 16.17 € Here is my last version of order_total module Total Amount Excl. Tax (VAT) with no core change : http://addons.oscommerce.com/info/9568 Anyone can install it and try to find a fix. ;)
  15. Another bug when DISPLAY_PRICE_WITH_TAX from admin is disabled. Total is wrong for me :