Latest News: (loading..)

cinolas

Members
  • Content count

    120
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by cinolas

  1. Hi, Thanks for reading :) I'm trying to add a small JS based calculator to the product_info page so that users can calculate their shoe size from a few input fields directly on the page. I'm not exactly fluent in php, or JS, but I'm usually successful with copy-pasting bits of code and replicating syntax. I duplicated the also_purchased_products.php as a starting point and replaced the code with my JS and form divs. The form grabs a few pieces of data from the user, mixes it with data from the product and sets a result input field without refreshing the page: document.getElementById('result').value = "Error: size mismatch, please contact customer service"; In order to pass some product data to the JS I use this: <?php $size_bias = tep_db_query("select products_size_bias from " . TABLE_PRODUCTS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'"); ?> and this inside the JS: var sizebias = <?php echo $size_bias ?>; The resulting product_info page seems to be cut short around these php echo at the beginning of the JS and the rest doesn't even make it on the resulting page. Any idea why? Is this not a good way to pass variables? Anything else I'm doing wrong? Thanks!
  2. @bruyndoncx right! That was it, along with a few hundred JS syntax errors (I never do JS). It's almost working now, I just need to debug the JS some more. THANK YOU SIR!
  3. Thanks for the help! @frankl So I need a semicolon both to close the php line AND one to close the JS line, like so, correct? var sizebias = <?php echo $size_bias; ?>; I found the syntax I used here: Passing PHP Variables to JavaScript and it didn't mention a semicolon inside the php. @bruyndoncx I believe I have the necessary code to fetch the data I need. My includes file looks like this: <?php if (isset($HTTP_GET_VARS['products_id'])) { $is_skates = tep_db_query("select products_is_skates from " . TABLE_PRODUCTS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'"); $available_in_half_sizes = tep_db_query("select products_available_in_half_sizes from " . TABLE_PRODUCTS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'"); $size_bias = tep_db_query("select products_size_bias from " . TABLE_PRODUCTS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'"); $narrow_appropriate = tep_db_query("select products_narrow_feet_appropriate from " . TABLE_PRODUCTS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'"); $slightly_narrow_appropriate = tep_db_query("select products_medium_narrow_feet_appropriate from " . TABLE_PRODUCTS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'"); $regular_appropriate = tep_db_query("select products_regular_feet_appropriate from " . TABLE_PRODUCTS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'"); $slightly_wide_appropriate = tep_db_query("select products_medium_wide_feet_appropriate from " . TABLE_PRODUCTS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'"); $wide_appropriate = tep_db_query("select products_wide_feet_appropriate from " . TABLE_PRODUCTS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'"); if ($is_skates = 1) { ?> <script type="text/javascript"> function sizewizard(){ var availablehalfsizes = "<?php echo $available_in_half_size; ?>"; var sizebias = "<?php echo $size_bias; ?>"; var sizebias = Number(sizebias); var narrowappropriate = "<?php echo $narrow_appropriate; ?>"; var slightlynarrowappropriate = "<?php echo $slightly_narrow_appropriate; ?>"; var regularappropriate = "<?php echo $regular_appropriate; ?>"; var slightlywideappropriate = "<?php echo $slightly_wide_appropriate; ?>"; var wideappropriate = "<?php echo $wide_appropriate; ?>"; var ssize = document.getElementById('ssize').value; ... but when I call the include on my product_info page (right before the product_available) it ends up cutting in the middle of the JS like this: <script type="text/javascript"> function sizewizard(){ var availablehalfsizes = ""; var sizebias = "</script> </div? Weird how the first variable I try to pass fails as blank, then the second one just causes the script to be truncated right there...
  4. That was it! I don't know why the line didn't make it in. Thank you so much! This is clearly above and beyond support.
  5. Thanks @raiwa! I appreciate. "NIC for QTPro" is my own tag I've added to find modifications I've made vs original code. In some places Ive tried preserving the original code by commenting it out. I'm not sure there's another add-on other than QTPro there. The checkout process works right now, other than products being turned off, so I'm very hesitant to mess with it (rebuild, clean up the checkout_process file as I know I should). In the above code, the lines: if (tep_db_num_rows($stock_query) > 0) { $stock_values = tep_db_fetch_array($stock_query); // do not decrement quantities if products_attributes_filename exists //NIC for QTPro /* if ((DOWNLOAD_ENABLED != 'true') || (!$stock_values['products_attributes_filename'])) { $stock_left = $stock_values['products_quantity'] - $order->products[$i]['qty']; } else { $stock_left = $stock_values['products_quantity']; } tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = '" . (int)$stock_left . "' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'"); if ( ($stock_left < 1) && (STOCK_ALLOW_CHECKOUT == 'false') ) { tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '0' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'"); */ $actual_stock_bought = $order->products[$i]['qty']; $download_selected = false; if ((DOWNLOAD_ENABLED == 'true') && isset($stock_values['products_attributes_filename']) && tep_not_null($stock_values['products_attributes_filename'])) { $download_selected = true; $products_stock_attributes='$$DOWNLOAD$$'; } The part I commented out with the NIC for QTPro obviously is the part that checks how much stock is left, and sets the product status to 0 if there's none left. Can this be uncommented without affecting QTPro? I'm not sure why it's commented out, it may have been my mistake. Is this code supposed to be active in a normal QTPro installation? Thanks!
  6. In this section specifically I seem to have commented out the code that turns off the product. // Stock Update - Joao Correia //NIC for QTPro /* if (STOCK_LIMITED == 'true') { if (DOWNLOAD_ENABLED == 'true') { */ //++++ QT Pro: Begin Changed code $products_stock_attributes=null; if (STOCK_LIMITED == 'true') { //$products_attributes = $order->products[$i]['attributes']; // if (DOWNLOAD_ENABLED == 'true') { //++++ QT Pro: End Changed Code //NIC for QTPro $stock_query_raw = "SELECT products_quantity, pad.products_attributes_filename FROM " . TABLE_PRODUCTS . " p LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES . " pa ON p.products_id=pa.products_id LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad ON pa.products_attributes_id=pad.products_attributes_id WHERE p.products_id = '" . tep_get_prid($order->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 = (isset($order->products[$i]['attributes'])) ? $order->products[$i]['attributes'] : ''; if (is_array($products_attributes)) { $stock_query_raw .= " AND pa.options_id = '" . (int)$products_attributes[0]['option_id'] . "' AND pa.options_values_id = '" . (int)$products_attributes[0]['value_id'] . "'"; } $stock_query = tep_db_query($stock_query_raw); } else { $stock_query = tep_db_query("select products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'"); } if (tep_db_num_rows($stock_query) > 0) { $stock_values = tep_db_fetch_array($stock_query); // do not decrement quantities if products_attributes_filename exists //NIC for QTPro /* if ((DOWNLOAD_ENABLED != 'true') || (!$stock_values['products_attributes_filename'])) { $stock_left = $stock_values['products_quantity'] - $order->products[$i]['qty']; } else { $stock_left = $stock_values['products_quantity']; } tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = '" . (int)$stock_left . "' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'"); if ( ($stock_left < 1) && (STOCK_ALLOW_CHECKOUT == 'false') ) { tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '0' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'"); */ $actual_stock_bought = $order->products[$i]['qty']; $download_selected = false; if ((DOWNLOAD_ENABLED == 'true') && isset($stock_values['products_attributes_filename']) && tep_not_null($stock_values['products_attributes_filename'])) { $download_selected = true; $products_stock_attributes='$$DOWNLOAD$$'; } But it looks like I did this for QTPro. I looked in the latest version install files and there's no instructions to comment out that part, so I'm a bit confused, I may have installed an old version but it's working well enough... Did I comment that out erroneously? Can I solve my problem by simply uncommenting that part without otherwise negatively affecting QTPro? Thanks!
  7. for ($i=0, $n=sizeof($order->products); $i<$n; $i++) { // Stock Update - Joao Correia //NIC for QTPro /* if (STOCK_LIMITED == 'true') { if (DOWNLOAD_ENABLED == 'true') { */ //++++ QT Pro: Begin Changed code $products_stock_attributes=null; if (STOCK_LIMITED == 'true') { //$products_attributes = $order->products[$i]['attributes']; // if (DOWNLOAD_ENABLED == 'true') { //++++ QT Pro: End Changed Code //NIC for QTPro $stock_query_raw = "SELECT products_quantity, pad.products_attributes_filename FROM " . TABLE_PRODUCTS . " p LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES . " pa ON p.products_id=pa.products_id LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad ON pa.products_attributes_id=pad.products_attributes_id WHERE p.products_id = '" . tep_get_prid($order->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 = (isset($order->products[$i]['attributes'])) ? $order->products[$i]['attributes'] : ''; if (is_array($products_attributes)) { $stock_query_raw .= " AND pa.options_id = '" . (int)$products_attributes[0]['option_id'] . "' AND pa.options_values_id = '" . (int)$products_attributes[0]['value_id'] . "'"; } $stock_query = tep_db_query($stock_query_raw); } else { $stock_query = tep_db_query("select products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'"); } if (tep_db_num_rows($stock_query) > 0) { $stock_values = tep_db_fetch_array($stock_query); // do not decrement quantities if products_attributes_filename exists //NIC for QTPro /* if ((DOWNLOAD_ENABLED != 'true') || (!$stock_values['products_attributes_filename'])) { $stock_left = $stock_values['products_quantity'] - $order->products[$i]['qty']; } else { $stock_left = $stock_values['products_quantity']; } tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = '" . (int)$stock_left . "' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'"); if ( ($stock_left < 1) && (STOCK_ALLOW_CHECKOUT == 'false') ) { tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '0' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'"); */ $actual_stock_bought = $order->products[$i]['qty']; $download_selected = false; if ((DOWNLOAD_ENABLED == 'true') && isset($stock_values['products_attributes_filename']) && tep_not_null($stock_values['products_attributes_filename'])) { $download_selected = true; $products_stock_attributes='$$DOWNLOAD$$'; } // If not downloadable and attributes present, adjust attribute stock if (!$download_selected && is_array($products_attributes)) { $all_nonstocked = true; $products_stock_attributes_array = array(); foreach ($products_attributes as $attribute) { if ($attribute['track_stock'] == 1) { $products_stock_attributes_array[] = $attribute['option_id'] . "-" . $attribute['value_id']; $all_nonstocked = false; } } if ($all_nonstocked) { $actual_stock_bought = $order->products[$i]['qty']; } else { asort($products_stock_attributes_array, SORT_NUMERIC); $products_stock_attributes = implode(",", $products_stock_attributes_array); $attributes_stock_query = tep_db_query("select products_stock_quantity from " . TABLE_PRODUCTS_STOCK . " where products_stock_attributes = '$products_stock_attributes' AND products_id = '" . tep_get_prid($order->products[$i]['id']) . "'"); if (tep_db_num_rows($attributes_stock_query) > 0) { $attributes_stock_values = tep_db_fetch_array($attributes_stock_query); $attributes_stock_left = $attributes_stock_values['products_stock_quantity'] - $order->products[$i]['qty']; tep_db_query("update " . TABLE_PRODUCTS_STOCK . " set products_stock_quantity = '" . $attributes_stock_left . "' where products_stock_attributes = '$products_stock_attributes' AND products_id = '" . tep_get_prid($order->products[$i]['id']) . "'"); $actual_stock_bought = ($attributes_stock_left < 1) ? $attributes_stock_values['products_stock_quantity'] : $order->products[$i]['qty']; } else { $attributes_stock_left = 0 - $order->products[$i]['qty']; tep_db_query("insert into " . TABLE_PRODUCTS_STOCK . " (products_id, products_stock_attributes, products_stock_quantity) values ('" . tep_get_prid($order->products[$i]['id']) . "', '" . $products_stock_attributes . "', '" . $attributes_stock_left . "')"); $actual_stock_bought = 0; } } } // $stock_query = tep_db_query("select products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'"); // } // if (tep_db_num_rows($stock_query) > 0) { // $stock_values = tep_db_fetch_array($stock_query); // do not decrement quantities if products_attributes_filename exists if (!$download_selected) { $stock_left = $stock_values['products_quantity'] - $actual_stock_bought; tep_db_query("UPDATE " . TABLE_PRODUCTS . " SET products_quantity = products_quantity - '" . $actual_stock_bought . "' WHERE products_id = '" . tep_get_prid($order->products[$i]['id']) . "'"); //++++ QT Pro: End Changed Code //NIC for QTPro } } //} NIC THIS SEEMS TO HAVE A BEEN AN EXTRA BRACKET.... SO I COMMENTED IT OUT AND IT WORKED, but not 1005sure it's the right bracket // Update products_ordered (for bestsellers list) tep_db_query("update " . TABLE_PRODUCTS . " set products_ordered = products_ordered + " . sprintf('%d', $order->products[$i]['qty']) . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'"); //NIC for QTPro /* $sql_data_array = array('orders_id' => $insert_id, 'products_id' => tep_get_prid($order->products[$i]['id']), 'products_model' => $order->products[$i]['model'], 'products_name' => $order->products[$i]['name'], 'products_price' => $order->products[$i]['price'], 'final_price' => $order->products[$i]['final_price'], 'products_tax' => $order->products[$i]['tax'], 'products_quantity' => $order->products[$i]['qty']); */ //++++ QT Pro: Begin Changed code if (!isset($products_stock_attributes)) $products_stock_attributes=null; $sql_data_array = array('orders_id' => $insert_id, 'products_id' => tep_get_prid($order->products[$i]['id']), 'products_model' => $order->products[$i]['model'], 'products_name' => $order->products[$i]['name'], 'products_price' => $order->products[$i]['price'], 'final_price' => $order->products[$i]['final_price'], 'products_tax' => $order->products[$i]['tax'], 'products_quantity' => $order->products[$i]['qty'], 'products_stock_attributes' => $products_stock_attributes); //++++ QT Pro: End Changed Code //NIC for QTPro Oy what a mess. I found the code that I believe does the stock adjustment, and so should also set the product status, in checkout_process My checkout_process is a mess of commented out code and added QTPro code. Somewhere along the way I ended up with a stray bracket, which I commented out, but I'm not sure it was the right one... (how does one find stray brackets in php??). You guys might see clear through this, but it's beyond my coding abilities.
  8. Hi, I'm having a possibly simple problem. I have osCommerce 2.34 BS Gold installed with QTPro (not exactly sure where to get the version #). Some products have stock quantities by attributes, some not. Everything works well except that products don't get turned off, to "Out of Stock" status, when the stock reaches 0. Specifically products that don't have stock by attribute, I'm not sure about those who do. I thought this was a simple setting on Admin side but if so I can't find it. What could cause my products not to automatically be set to "Out of Stock" when the stock runs out? and how do I change that? I'm not even sure what file contains the code that's responsible for performing that action.. Cheers!
  9. As per the title I'm running osC 2.34 BS Gold. There's more to our site than a store, so osC is installed in a subdirectory like /store/ I would like to change the rest of our website, currently all static HTML pages, to use the same bootstrap installation used by osC. The idea is to facilitate synchronizing the look and to provide a consistent user experience in and out of the store section. All I really want to replicate on my static pages is the adaptative grid system, some of the header, and the CSS... What's the best way of doing this? btw I'm a store owner, not a coder, but I've been pretending to be a coder ever since I installed osCommerce 10 years ago ;) I've considered: - Deconstructing the header part of my osC pages and shoving that in my static pages, changing the references towards the store subdirectory. - Moving the entire store to the root and adding a bunch of info pages, but that's my last option. Do I really need to switch the static pages to php to use the same header as within my osC store? Thanks for ay and all help :D
  10. Well it didn't take long looking into my first option to tell that Bootstrap is made to be easy to use, and that I can just call the bits I need from anywhere. So it looks much easier than I thought. Anyone having a similar question should look into a Bootstrap tutorial.
  11. To be clear, I don't need any osC specific widgets in my static pages, no shopping cart, no store navigation, etc Thanks!
  12. Hi, I'm on 2.34 Bootstrap Gold and I'm using an old Canada Post XML shipping module that doesn't have a sort order field (or configuration entry). Right now the module gets sorted on top and I'd like to change that, but I don't fully understand how the sorting of shipping modules works. The module doesn't create a SORT_ORDER entry on the configuration table during install, so I tried creating one manually but I don't know how to connect that row to the actual module so that the sort order value is summoned with the module. I've looked at the chekckout_shipping page but saw nothing about sorting, so I thought maybe it was being done in the class but I don't see anything about sorting the modules there either. I'm pretty sure this is easy if you know what you're doing, but I do not. I don't need a field on the admin interface, just some way of giving it a sort order. Also, the shipping options show up from most expensive to least expensive on my checkout_shipping page, it selects the right one automatically, but I'd like to show the cheapest on top. How do I do that? (if I could only find where these things are being sorted...) Thanks!
  13. I did. My apologies for being dense here. I can see the configuration entries being created in the install function of shipping modules, and I can see that the CanadaPost shipping module doesn't create a row for the SORT_ORDER. So I went and created an entry in the Configuration table manually, but that doesn't change anything. How, or where, does that value get pulled to sort the modules on the checkout_shipping page?
  14. @@greasemonkey Thank you sir!
  15. Greetings, I've installed this contribution into my 2.3.4 BS Gold and I'm having a problem with the way the form displays on the payment page. It looks like this: I'm not finding the usual HTML building bits of PHP that I normally tinker with for this sort of problem... Does anyone know how to remove the 1s and 2s? And where I can further customize the look of the form? (beyond the fields and labels, like adding classes to pretty it up in CSS) Thanks!
  16. Rainer, @@raiwa Thank you SO MUCH. This is precisely the area of php that I know nothing about, that is to say most of php hehe. What I'm saying is I could've dug for a thousand years and not figured that out. Or taken an online course in php anyway... It works beautifully! best regards.
  17. In trying to circumvent the problem I created a different Tax Class for the tax on shipping. If I give it a different description then the tax on shipping shows up on a different line, at least on checkout_confirm. On checkout_payment, the ot_tax order total module only reports the tax on the goods, where it is reporting both on checkout_confirm. So again, this means that the tax on shipping is added after the payment page. I figured another easier workaround would be to add a line after the order_total modules output, that says something like : + $0.58 tax on shipping TOTAL: $184.38 Then there's no need to alter any core functions, or set variables ahead of time, all I need to do is calculate the tax on shipping and a new super-total and display those after the order total module output. I tried a few naive things, mostly copying promising bits of code from other places, but it all failed miserably. My content module now looks like this (I've removed the long part about taxes when not logged in since that just doesn't apply on the payment page): <?php /* $Id: cm_pa_order_total.php $Loc: catalog/includes/modules/content/payment/ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com 2015 Order Totals 3.3 BS by @[member='raiwa'] info@sarplataygemas.com based on: shipping estimator Original version: Edwin Bekaert (edwin@[member='ednique'].com) Copyright (c) 2010 osCommerce Released under the GNU General Public License */ class cm_pa_order_total { var $code; var $group; var $title; var $description; var $sort_order; var $enabled = false; function __construct() { $this->code = get_class($this); $this->group = basename(dirname(__FILE__)); $this->title = MODULE_CONTENT_PA_ORDER_TOTAL_TITLE; $this->description = MODULE_CONTENT_PA_ORDER_TOTAL_DESCRIPTION; $this->description .= '<div class="secWarning">' . MODULE_CONTENT_BOOTSTRAP_ROW_DESCRIPTION . '</div>'; if ( defined('MODULE_CONTENT_PA_ORDER_TOTAL_STATUS') ) { $this->sort_order = MODULE_CONTENT_PA_ORDER_TOTAL_SORT_ORDER; $this->enabled = (MODULE_CONTENT_PA_ORDER_TOTAL_STATUS == 'True'); } } function execute() { global $oscTemplate, $cart, $order, $customer_default_address_id, $billto, $sendto; $content_width = (int)MODULE_CONTENT_PA_ORDER_TOTAL_CONTENT_WIDTH; if (($cart->count_contents() > 0)) { require('includes/classes/order_total.php'); $order_total_modules = new order_total; $order_total_modules->process(); $shiptaxrate = tep_get_tax_rate('1', $customer_country_id, $customer_zone_id); $shiptax = ($shipping['cost'] * $shiptaxrate); if ( MODULE_ORDER_TOTAL_INSTALLED ) { $pa_order_total .= ' <div class="panel-body">'; $pa_order_total .= ' <table class="pull-right">'; $pa_order_total .= $order_total_modules->output(); $pa_order_total .= ' <tr><td align="right" class="main">+ tax (' . $shiptaxrate . ') on shipping</td><td align="right" class="main">' . $shiptax . '</td></tr>'; $pa_order_total .= ' </table>'; $pa_order_total .= ' </div>'; // end body } ob_start(); include('includes/modules/content/' . $this->group . '/templates/order_total.php'); $template = ob_get_clean(); $oscTemplate->addContent($template, $this->group); } // Use only when cart_contents > 0 } function isEnabled() { return $this->enabled; } function check() { return defined('MODULE_CONTENT_PA_ORDER_TOTAL_STATUS'); } function install() { tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Order Total Module', 'MODULE_CONTENT_PA_ORDER_TOTAL_STATUS', 'True', 'Do you want to add the module to your shop?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Content Width', 'MODULE_CONTENT_PA_ORDER_TOTAL_CONTENT_WIDTH', '12', 'What width container should the content be shown in?', '6', '2', 'tep_cfg_select_option(array(\'12\', \'11\', \'10\', \'9\', \'8\', \'7\', \'6\', \'5\', \'4\', \'3\', \'2\', \'1\'), ', now())"); tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_CONTENT_PA_ORDER_TOTAL_SORT_ORDER', '1000', 'Sort order of display. Lowest is displayed first.<br>Recommended to show this module last.', '6', '3', now())"); } function remove() { tep_db_query("delete from configuration where configuration_key in ('" . implode("', '", $this->keys()) . "')"); } function keys() { return array('MODULE_CONTENT_PA_ORDER_TOTAL_STATUS', 'MODULE_CONTENT_PA_ORDER_TOTAL_CONTENT_WIDTH', 'MODULE_CONTENT_PA_ORDER_TOTAL_SORT_ORDER'); } } Go ahead, have a laugh :) So tep_get_tax_rate('1', $customer_country_id, $customer_zone_id); returns 0, and so does $shipping['cost'] Any idea how I might be able to summon those 2 variables, that is the tax rates for the customer's country and zone, and the shipping cost, from the context of a checkout_payment content module? Cheers!
  18. @@raiwa Thanks again for the tips. I've changed the code in my payment content module to the call for the order total module that I found in the checkout_confirmation page and it gives exactly the same result. So I did as you suggested and looked at the variables (that tip is going to make my osC debugging so much easier!). It appears that the "tax" variable is simply set to the tax without the tax on shipping when on the checkout_payment page (the "total" variable is also calculated without it) , and by the time you get to checkout_confirmation the "tax" variable has been changed to include the tax on shipping, and the "total" adjusted accordingly. There is no missing or unset variable, or error, the tax on shipping really is supposed to go in the tax variable, it just hasn't, at that point. Some process must do that between the two pages. I have no idea how, when, and through which process. I don't want to modify a central function, that doesn't make sense. Is there any way I can, in my content module code, alter the order "tax" variable to be what it is plus: whatever the current tax rate times "shipping_cost". Then alter "total" by the same difference. THEN call the order total module? I might be able to figure that out, but I can't seem to find a defined variable for the current tax rate, other than within the product array. I'd rather not use that because I'd have to arbitrarily chose a product, and it might be tax exempt for some reason. Again, feel free to tell me I'm on my own here. This has nothing to do with your contrib, other than I'm trying to do something similar. It's beyond what I can accomplish with my current level of understanding of osC php et al so any tips (from anyone) is VERY much appreciated :D
  19. @@raiwa Thank you so much, these are smart things to try, and exactly the nudge in the right direction I needed.
  20. Hi, I've installed v1.2 of this contrib and it looks like wipmania.com is returning "US" as location when in fact I'm in Canada. I went to wipmania.com directly and they detected my location properly as Canada. My store is in Canada, default currency is CAD, we want the currency to switch to USD only for US customers, everything else should be CAD. I've tried @@greasemonkey's version using ip2location but I found that the prices didn't show up at all on Safari/Webkit. I played with the 1.2 code a little to force USD or CAD (hard coded with no DB query), and the problem really appears to be that wipmania is returning "US" as my location (unless I go to their site). As opposed to wipmania returning "XX", or a blank $location. So I'm stumped, why is wipmania giving me mixed results? Or why is ip2location causing the no-price problem on Safari/Webkit, but not Chrome? Any help is greatly appreciated!
  21. In an effort to get a friendly hint I'll sum it down to where my no-knowledge of php stops. My first thought obv was to find where in there the taxes on shipping were calculated, but it doesn't seem to be part of this contribution. So I'm guessing it's pulling this mechanic from an existing file. The only file the contrib seems to rely on is the order class, which doesn't seem to handle shipping taxes either. Regardless, I couldn't adjust the tax calculation in a central file or it would also affect places where the totals are shown correctly. So my guess is that the problem is with the context of the code, makes sense since I copied the code out of its context to do that. So part of the code above fails because it's out of context and so the shipping tax isn't carried over. If my understanding is correct so far, then this contrib takes that same totals and tax mechanic from an existing file and uses it (successfully) out of context on the shopping cart page. So what's the difference in context between the shopping cart and checkout_payment? the shipping has been selected, and not taken from the input fields. Yet the actual amount for the shipping level that was selected does show up, as it does on the checkout_confirm, so it's getting that part of the shipping data. Just not the tax. That's where I'm lost. Any hints as to where or how this contrib gets the shipping amount and passes it to the order class, or any hints at all really, would be greatly appreciated (from any willing soul, as the dev pointed out this FAR beyond expected support).
  22. @@raiwa @@greasemonkey thank you both. It is indeed far beyond the scope of expected support :) I'll figure out something. Here's another question that's even further out of the scope of expected support... but asking never hurt and maybe it's a quick tweak. I copied the order total content module and turned it into a payment content module, so as to display the order total on the payment page. It seemed like a logical place to display the total, after selecting the shipping method, and while the user chooses how to pay for that amount. The totals display as expected but for one thing: the taxes on the shipping amount are not included, while they are on the confirmation page. Here's the code, essentially a direct copy of the shipping content module, do you guys see a reason why the shipping taxes are omitted? Thanks! <?php /* $Id: cm_pa_order_total.php $Loc: catalog/includes/modules/content/payment/ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com 2015 Order Totals 3.3 BS by @[member=raiwa] info@sarplataygemas.com based on: shipping estimator Original version: Edwin Bekaert (edwin@[member=ednique].com) Copyright (c) 2010 osCommerce Released under the GNU General Public License */ class cm_pa_order_total { var $code; var $group; var $title; var $description; var $sort_order; var $enabled = false; function __construct() { $this->code = get_class($this); $this->group = basename(dirname(__FILE__)); $this->title = MODULE_CONTENT_PA_ORDER_TOTAL_TITLE; $this->description = MODULE_CONTENT_PA_ORDER_TOTAL_DESCRIPTION; $this->description .= '<div class="secWarning">' . MODULE_CONTENT_BOOTSTRAP_ROW_DESCRIPTION . '</div>'; if ( defined('MODULE_CONTENT_PA_ORDER_TOTAL_STATUS') ) { $this->sort_order = MODULE_CONTENT_PA_ORDER_TOTAL_SORT_ORDER; $this->enabled = (MODULE_CONTENT_PA_ORDER_TOTAL_STATUS == 'True'); } } function execute() { global $oscTemplate, $cart, $order, $customer_default_address_id, $billto, $sendto; $content_width = (int)MODULE_CONTENT_PA_ORDER_TOTAL_CONTENT_WIDTH; if (($cart->count_contents() > 0)) { // BOF get taxes if not logged in if ( !tep_session_is_registered('customer_id') ) { //guest if ( $cart->get_content_type() == 'virtual') { tep_session_register('billto'); $billto = array('firstname' => null, 'lastname' => null, 'company' => null, 'street_address' => null, 'suburb' => null, 'postcode' => null, 'city' => null, 'zone_id' => STORE_ZONE, 'zone_name' => null, 'country_id' => STORE_COUNTRY, 'country_name' => null, 'country_iso_code_2' => null, 'country_iso_code_3' => null, 'address_format_id' => null, 'zone_name' => null ); if (!class_exists('order')) { require('includes/classes/order.php'); } $order = new order; } elseif (defined('MODULE_CONTENT_SC_SHIPPING_STATUS') && MODULE_CONTENT_SC_SHIPPING_STATUS == 'True') { $products = $cart->get_products(); for ($i=0, $n=sizeof($products); $i<$n; $i++) { $products_tax = tep_get_tax_rate($products[$i]['tax_class_id'], $order->delivery['country_id'], $order->delivery['zone_id']); $products_tax_description = tep_get_tax_description($products[$i]['tax_class_id'], $order->delivery['country_id'], $order->delivery['zone_id']); if ( DISPLAY_PRICE_WITH_TAX == 'true' ) { //Modified by Strider 42 to correct the tax calculation when a customer is not logged in $tax_val = (($products[$i]['final_price']/100)*$products_tax)*$products[$i]['quantity']; } else { $tax_val = (($products[$i]['final_price']*$products_tax)/100)*$products[$i]['quantity']; } if ( !empty($order->info['tax']) ) { $order->info['tax'] += $tax_val; } else { $order->info['tax'] = $tax_val; } if ( !empty($order->info['tax_groups']) ) { $order->info['tax_groups']["$products_tax_description"] += $tax_val; } else { $order->info['tax_groups']["$products_tax_description"] = $tax_val; } // Modified by Strider 42 to correct the order total figure when shop displays prices with tax if ( DISPLAY_PRICE_WITH_TAX == 'true' ) { $order->info['total']; } else { $order->info['total']+=$tax_val; } } } else { if (!tep_session_is_registered('sendto')) { tep_session_register('sendto'); $sendto = array('firstname' => null, 'lastname' => null, 'company' => null, 'street_address' => null, 'suburb' => null, 'postcode' => null, 'city' => null, 'zone_id' => STORE_ZONE, 'zone_name' => null, 'country_id' => STORE_COUNTRY, 'country_name' => null, 'country_iso_code_2' => null, 'country_iso_code_3' => null, 'address_format_id' => null, 'zone_name' => null ); if (!class_exists('order')) { require('includes/classes/order.php'); } $order = new order; } } } else { if ( $cart->get_content_type() == 'virtual' && (!defined('MODULE_CONTENT_SC_SHIPPING_STATUS') || (defined('MODULE_CONTENT_SC_SHIPPING_STATUS') && MODULE_CONTENT_SC_SHIPPING_STATUS != 'True')) ) { tep_session_register('billto'); $billto = $customer_default_address_id; } if (!class_exists('order')) { require('includes/classes/order.php'); } $order = new order; } // EOF get taxes if not logged in (seems like less code than in order class) require('includes/classes/order_total.php'); $order_total_modules = new order_total; $order_total_modules->process(); if ( MODULE_ORDER_TOTAL_INSTALLED ) { $pa_order_total .= ' <div class="panel-body">'; $pa_order_total .= ' <table class="pull-right">'; $pa_order_total .= $order_total_modules->output(); $pa_order_total .= ' </table>'; $pa_order_total .= ' </div>'; // end body } ob_start(); include('includes/modules/content/' . $this->group . '/templates/order_total.php'); $template = ob_get_clean(); $oscTemplate->addContent($template, $this->group); } // Use only when cart_contents > 0 } function isEnabled() { return $this->enabled; } function check() { return defined('MODULE_CONTENT_PA_ORDER_TOTAL_STATUS'); } function install() { tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Order Total Module', 'MODULE_CONTENT_PA_ORDER_TOTAL_STATUS', 'True', 'Do you want to add the module to your shop?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Content Width', 'MODULE_CONTENT_PA_ORDER_TOTAL_CONTENT_WIDTH', '12', 'What width container should the content be shown in?', '6', '2', 'tep_cfg_select_option(array(\'12\', \'11\', \'10\', \'9\', \'8\', \'7\', \'6\', \'5\', \'4\', \'3\', \'2\', \'1\'), ', now())"); tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_CONTENT_PA_ORDER_TOTAL_SORT_ORDER', '1000', 'Sort order of display. Lowest is displayed first.<br>Recommended to show this module last.', '6', '3', now())"); } function remove() { tep_db_query("delete from configuration where configuration_key in ('" . implode("', '", $this->keys()) . "')"); } function keys() { return array('MODULE_CONTENT_PA_ORDER_TOTAL_STATUS', 'MODULE_CONTENT_PA_ORDER_TOTAL_CONTENT_WIDTH', 'MODULE_CONTENT_PA_ORDER_TOTAL_SORT_ORDER'); } }
  23. @@Tsimi Thanks fro the quick reply! I re-installed from scratch, all the manual modifications were there proper, but after re-uploading all the files the problem went away... I'm guessing there may have been an ftp hiccup with one of the files. So, all good! Thanks for the quick support anyway :) Cheers!
  24. Greetings! Thanks for porting this contrib to BS! I've installed this version: http://addons.oscommerce.com/info/9313 from May 15th 2015 On my 2.34 BS Gold install and everything appears to work BUT for the wishlist.php and wishlist_public.php pages which are served blank. So, if I have things setup not to go to the wishlist page after adding an item, I can see it pop-up in the wish list box. But going to the wishlist.php or wishlist_public.php doesn't work, just a blank page with no source at all. What sort of problem is this likely to be? I've replaced those 2 files with the originals from the package, to be sure it wasn't a modification I may have made. I've removed and reinstalled the 3 components in the osC admin panel to get it to do it's SQL clean up. Any idea? next step is a full uninstall and re-install...
  25. Hi, thanks for the quick help! The sort order is indeed correct with the default values of 400 and 1000 for the shipping and total modules respectively. Here's the Canada Post module I use: http://addons.oscommerce.com/info/7900 The shipping quote is very simple, we charge the rates we get from the Canada Post server, with no handling fees. The rest is done on the CanadaPost server. We also use two other shipping modules: store pickup (as seen in screen grab) and snail mail when the product size allows (doesn't apply here). Here's the screen shot with example data. Thanks!