Latest News: (loading..)

cinolas

Members
  • Content count

    117
  • Joined

  • Last visited

  • Days Won

    2

cinolas last won the day on January 7

cinolas had the most liked content!

About cinolas

Profile Information

  • Real Name
    Nicolas

Recent Profile Visitors

5,363 profile views
  1. 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.
  2. 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!
  3. 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!
  4. 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.
  5. 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!
  6. 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.
  7. To be clear, I don't need any osC specific widgets in my static pages, no shopping cart, no store navigation, etc Thanks!
  8. 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
  9. 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?
  10. 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!
  11. @@greasemonkey Thank you sir!
  12. 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!
  13. 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.
  14. 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!
  15. @@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