Jump to content
jhilgeman

NEW! Complete Order Editing Tool!

Recommended Posts

did not work got

Parse error: syntax error, unexpected $end in /home/content/l/a/d/lady3597/html/includes/modules/order_total/ot_taxrates.php on line 202

Share this post


Link to post
Share on other sites

I guess u didn't accurately do what I wrote...probably left out the } at the bottom of the function (under the last return $tax_data;)

copy and paste it EXACTLY as I wrote, and it won't error.

Share this post


Link to post
Share on other sites

I did and just checked it again. There is a } at the end. I copied and pasted your file.

Share this post


Link to post
Share on other sites

I have to step a way for about an hour. Will check back and see what you have come up with. I not a programmer. I know enough to get around and that is about it. The only good thing is that I don't use Order Editor often but when we need it I need it to work. Thanks for your help. Look forward to working with you and getting a fix for it.

Share this post


Link to post
Share on other sites

I'm back. Ok this is what I have done.

1st removed the "ot_taxrates" that I changed in admin/edit_orders.php and edit_orders_ajax.php back to "ot_tax".

2nd then I went back to the original include/modules/order_total/to_taxrate.php and repasted your fix from above,

leaving everything in the file intact.

<?php

 

/**

* ot_taxrates order-total module

*

* @package orderTotal

* @@copyright Copyright 2013 adTumbler, Inc.

* @version 2.2.TR 2014-01-04 16:00:00Z ajeh $

*/

 

/**

* osCommerce Sales Tax Rates

*

*/

 

class ot_taxrates {

var $title, $output;

 

function ot_taxrates() {

$this->code = 'ot_taxrates';

$this->title = MODULE_ORDER_TOTAL_TAXRATES_TITLE;

$this->description = MODULE_ORDER_TOTAL_TAXRATES_DESCRIPTION;

$this->enabled = ((MODULE_ORDER_TOTAL_TAXRATES_STATUS == 'true') ? true : false);

$this->sort_order = MODULE_ORDER_TOTAL_TAXRATES_SORT_ORDER;

 

$this->output = array();

}

 

function process() {

 

/**

* Method used to calculate sales tax using TaxRates.com and produce the<br>

* output shown on the checkout pages

*/

 

// Calculate Tax

// require_once DIR_WS_MODULES . 'taxrates/func.taxrates.php';

 

function taxrates_lookup_tax($order, $products) {

global $db, $messageStack;

 

// Calculate the coupon discount amount for fixed value coupons only

if ($_SESSION['cc_id']) {

$coupon = tep_db_query("select * from " . TABLE_COUPONS . " where coupon_id = '" . (int)$_SESSION['cc_id'] . "'");

if ($coupon->fields['coupon_type'] == 'F') {

$coupon_value = $coupon->fields['coupon_amount'] * -1;

}

}

 

// Get taxable address information.

if (MODULE_ORDER_TOTAL_TAXRATES_ADDRESS == "shipping") {

$region = $order->delivery['state'];

$zip = $order->delivery['postcode'];

}

else {

$region = $order->billing['state'];

$zip = $order->billing['postcode'];

}

 

// State data used to convert state long names to two character abbreviation

$states = array(

'AL' => ('Alabama'),

'AK' => ('Alaska'),

'AZ' => ('Arizona'),

'AR' => ('Arkansas'),

'CA' => ('California'),

'CO' => ('Colorado'),

'CT' => ('Connecticut'),

'DE' => ('Delaware'),

'DC' => ('District Of Columbia'),

'FL' => ('Florida'),

'GA' => ('Georgia'),

'HI' => ('Hawaii'),

'ID' => ('Idaho'),

'IL' => ('Illinois'),

'IN' => ('Indiana'),

'IA' => ('Iowa'),

'KS' => ('Kansas'),

'KY' => ('Kentucky'),

'LA' => ('Louisiana'),

'ME' => ('Maine'),

'MD' => ('Maryland'),

'MA' => ('Massachusetts'),

'MI' => ('Michigan'),

'MN' => ('Minnesota'),

'MS' => ('Mississippi'),

'MO' => ('Missouri'),

'MT' => ('Montana'),

'NE' => ('Nebraska'),

'NV' => ('Nevada'),

'NH' => ('New Hampshire'),

'NJ' => ('New Jersey'),

'NM' => ('New Mexico'),

'NY' => ('New York'),

'NC' => ('North Carolina'),

'ND' => ('North Dakota'),

'OH' => ('Ohio'),

'OK' => ('Oklahoma'),

'OR' => ('Oregon'),

'PA' => ('Pennsylvania'),

'RI' => ('Rhode Island'),

'SC' => ('South Carolina'),

'SD' => ('South Dakota'),

'TN' => ('Tennessee'),

'TX' => ('Texas'),

'UT' => ('Utah'),

'VT' => ('Vermont'),

'VA' => ('Virginia'),

'WA' => ('Washington'),

'WV' => ('West Virginia'),

'WI' => ('Wisconsin'),

'WY' => ('Wyoming'),

'AA' => ('Armed Forces (Americas)'),

'AE' => ('Armed Forces (Europe, Canada, Middle East, Africa)'),

'AP' => ('Armed Forces (Pacific)'),

'AS' => ('American Samoa'),

'FM' => ('Federated States of Micronesia'),

'GU' => ('Guam'),

'MH' => ('Marshall Islands'),

'MP' => ('Northern Mariana Islands'),

'PW' => ('Palau'),

'PR' => ('Puerto Rico'),

'VI' => ('Virgin Islands'),

);

 

// Array of states that require separately identified shipping to be taxed

$shipping_states = array('AR','CT','DC','GA','HI','IN','KS','KY','MI','MN','MS','NE','NJ','NM','NY','NC','ND','OH','PA','SC','SD','TN','TX','VT','WA','WV','WY');

 

$tr_state = array_search($region, $states);

$rate_date = MODULE_ORDER_TOTAL_TAXRATES_DATE;

 

$tax_rate = 0;

$n = 0;

 

// Exit if delivery state is not a TaxRate state.

$taxrates_states = array();

$taxrates_states_str = MODULE_ORDER_TOTAL_TAXRATES_STATES;

if ($taxrates_states_str) {

$taxrates_states = explode(", ", $taxrates_states_str);

if (in_array($tr_state, $taxrates_states)) {

if (file_exists(DIR_WS_MODULES . 'taxrates/taxtables/TAXRATES_ZIP5_' . $tr_state . '' . $rate_date . '.csv')) {

$file = fopen(DIR_WS_MODULES . 'taxrates/taxtables/TAXRATES_ZIP5_' . $tr_state . '' . $rate_date . '.csv', 'r');

$data = array();

while($row = fgetcsv($file)) {

$data[] = $row;

if ($data[$n][1] == $zip) {

$tax_rate = $data[$n][4];

break;

}

$n ++;

}

fclose($file);

}

else {

$messageStack->add('checkout_confirmation', 'Error: TaxRates did not find a data file for this selected state.', 'error');

if ($messageStack->size('checkout_confirmation') > 0) echo $messageStack->output('checkout_confirmation');

}

}

}

else {

$messageStack->add('checkout_confirmation', 'Error: Please configure the TaxRates states.', 'error');

if ($messageStack->size('checkout_confirmation') > 0) echo $messageStack->output('checkout_confirmation');

}

 

$taxable_amount = 0;

$total_amount = 0;

foreach ($products as $k => $product) {

$line_value = $product['final_price'] * $product['qty'];

$taxable_amount = $taxable_amount + $line_value;

$total_amount = $total_amount + $line_value;

}

 

// Adjust taxable amount for fixed coupon amount

if ($coupon->fields['coupon_type'] == 'F') {

$taxable_amount = $taxable_amount + $coupon_value;

$total_amount = $total_amount + $coupon_value;

}

 

// Adjust taxable amount for percentage coupon amount

if ($coupon->fields['coupon_type'] == 'P') {

$taxable_amount = $taxable_amount + (int)$coupon->fields['coupon_amount'] * -1 * $prod_total /100;

$total_amount = $total_amount + (int)$coupon->fields['coupon_amount'] * -1 * $prod_total /100;

}

 

// Include shipping cost in taxable amount for selected States

if (in_array($tr_state, $shipping_states)) {

$ship_tax = $order->info['shipping_cost'];

$taxable_amount = $taxable_amount + $ship_tax;

}

$total_amount = $total_amount + $ship_tax;

 

// Calculate sales tax - rate * total taxable amount

$sales_tax = $taxable_amount*$tax_rate;

 

// Return sales tax data

$tax_data = array(

'tax_amount' => $sales_tax,

'taxable_amount' => $taxable_amount,

'total_amount' => $total_amount + $sales_tax,

);

return $tax_data;

}

global $order, $currencies;

 

$tax_data = taxrates_lookup_tax($order, $order->products);

$tax_amt = $tax_data['tax_amount'];

 

$order->info['tax'] = $tax_amt;

 

$loccode = $order->delivery['city'];

 

// Get taxable city name information.

if (MODULE_ORDER_TOTAL_TAXRATES_ADDRESS == "shipping") {

$loccode = $order->delivery['city'];

}

else {

$loccode = $order->billing['city'];

}

 

$namesuf = '';

if (MODULE_ORDER_TOTAL_TAXRATES_LOCATION == 'true') {

$namesuf = ' (' . $loccode . ') ';

}

$taxname = MODULE_ORDER_TOTAL_TAXRATES_DESCRIPTION . $namesuf . '';

 

$order->info['tax_groups'] = array ($taxname => $tax_amt);

 

// Produce Sales Tax output for the checkout page

reset($order->info['tax_groups']);

$taxDescription = '';

$taxValue = 0;

 

while (list($key, $value) = each($order->info['tax_groups'])) {

if ($value > 0 || ($value == 0 && STORE_TAX_DISPLAY_STATUS == 1)) {

$taxDescription .= ((is_numeric($key) && $key == 0) ? TEXT_UNKNOWN_TAX_RATE : $key) . ' + ';

$taxValue += $value;

 

$order->info['total'] += $taxValue;

 

$this->output[] = array(

'title' => substr($taxDescription, 0 , strlen($taxDescription)-3) . ':' ,

'text' => $currencies->format($taxValue, true, $order->info['currency'], $order->info['currency_value']) ,

'value' => $taxValue);

}

}

}

 

function check() {

global $db;

if (!isset($this->_check)) {

$check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_ORDER_TOTAL_TAXRATES_STATUS'");

$this->_check = tep_db_num_rows($check_query);

}

return $this->_check;

}

 

function keys() {

return array('MODULE_ORDER_TOTAL_TAXRATES_STATUS', 'MODULE_ORDER_TOTAL_TAXRATES_SORT_ORDER', 'MODULE_ORDER_TOTAL_TAXRATES_ADDRESS', 'MODULE_ORDER_TOTAL_TAXRATES_DATE', 'MODULE_ORDER_TOTAL_TAXRATES_STATES', 'MODULE_ORDER_TOTAL_TAXRATES_DESCRIPTION', 'MODULE_ORDER_TOTAL_TAXRATES_LOCATION');

}

 

function install() {

global $db;

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Display TaxRates', 'MODULE_ORDER_TOTAL_TAXRATES_STATUS', 'true', 'Do you want this module to display?', '6', '1','tep_cfg_select_option(array(\'true\', \'false\'), ', now())");

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_ORDER_TOTAL_TAXRATES_SORT_ORDER', '3', 'Sort order of display', '6', '2', now())");

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Sales Tax Address', 'MODULE_ORDER_TOTAL_TAXRATES_ADDRESS', 'shipping', 'Select address for calculating sales tax', '6', '3','tep_cfg_select_option(array(\'shipping\', \'billing\'), ', now())");

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('TaxRate Date', 'MODULE_ORDER_TOTAL_TAXRATES_DATE', '', 'Enter the Year & Month e.g. 201312 - of tax rate files', '6', '4', now())");

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('TaxRate Date', 'MODULE_ORDER_TOTAL_TAXRATES_STATES', '', 'List states that require sales tax calculated e.g. CA, NV, WA ', '6', '5', now())");

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sales Tax Description', 'MODULE_ORDER_TOTAL_TAXRATES_DESCRIPTION', 'Sales Tax', 'The Sales Tax description to be displayed', '6', '6', now())");

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Show Location Code', 'MODULE_ORDER_TOTAL_TAXRATES_LOCATION', 'true', 'Include a City name in your Sales Tax description', '6', '7', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now())");

}

 

function remove() {

global $db;

$keys = '';

$keys_array = $this->keys();

$keys_size = sizeof($keys_array);

for ($i=0; $i<$keys_size; $i++) {

$keys .= "'" . $keys_array[$i] . "',";

}

$keys = substr($keys, 0, -1);

tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in (" . $keys . ")");

}

}

 

------------------------------------------------------

This is what I go when I went into order edit and tried to add an item.

 

Fatal error: Call to undefined method messageStack::size() in /home/content/l/a/d/lady3597/html/includes/modules/order_total/ot_taxrates.php on line 156

-------------------------------------------------

156=if ($messageStack->size('checkout_confirmation') > 0) echo $messageStack->output('checkout_confirmation');

from your above fix.

 

else {

$messageStack->add('checkout_confirmation', 'Error: Please configure the TaxRates states.', 'error');

if ($messageStack->size('checkout_confirmation') > 0) echo $messageStack->output('checkout_confirmation');

}

---------------------------

I checked the customer ordering side all seems to still be working there.

Share this post


Link to post
Share on other sites

OK - I have been working on this issue. I put back the original ot_taxrate.php file. Did away with the above. Then I added the following to admin:

 

admin/includes/modules/taxrates/func.taxrates.php

admin/includes/modules/taxrates/taxtable/(cvs file)

 

The error messages went away. The tax in the order total column is correct. But the tax in the item area is way wrong. Need to know where it is pulling its informantion and how to fix it. I have attached a picture, I hope. I have not had much luck in attaching anything.

 

post-303521-0-20780400-1397755391_thumb.jpg

 

Also the order edit is not picking all the shipping methods. In this case the item weighs less then 3oz and should ship First Class. But it is not coming up an option. On the customer side of ordering through the web site all shipping options shows.

 

Thanks

Share this post


Link to post
Share on other sites

I have same problem, did you solve it?

 

thanks

 

Thank you very much, John. Yes, I am using RC2a.

I don't think the thread you mentioned is related to my issue, although I might be wrong.

To clarify, my issue, as reported by multiple other members on this thread for the past few years, is this:

When there are products with attributes in the order, the total weight calculation calculates only 1 listed attribute line and skips the rest, for example:

 

Product-1

5pc x size 3

3pc x size 6

9pc x size 7

 

Product-2 (no attributes) x 10pc

 

Product-3 (no attributes) x 8pc

 

Product-4

5pc x size 7

12pc x size 9

 

Product-5 (no attributes) x 11pc

 

 

In this case, it will calculate the total weight of Products 2,3 & 5 just fine, as they have no attribute.

But, for products 1 and 4 it calculates only 1 from the list, so for product-1 it may calculate its weight as

either Product-1 x 5pc

or

Product-1 x 3pc

or

Product-1 x 9pc

 

Ignoring the rest of the attribute lines.

 

Same goes for product-4. It will calculate its weight as

either Product-4 x 5pc

or

Product-4 x 12pc

 

 

Weight calculations work just fine on the catalog side, the only problem is in the order editor. Any solution? (I'm really desperate...)

Share this post


Link to post
Share on other sites

Installed order_editor_for2.3_v1.0 and have two different problems that make it unusable.

 

1.  With Ajax turned on, the email notification sent with order status change does not include the order status.  Email says "your order status has been changed to:         "  (that is blank.)

 

2.  With Ajax turned off, if customer has selected shipping insurance, and has been charged for it, that charge does not appear in the order once pulled up in edit_order.php.  Verified it is in the database before selecting to edit, and shows as $0.00 when page is opened, and any changes to shipping insurance are not being updated to database.

 

I have spent a good deal of time trying to figure out the causes, but so far have not found it (them)  Any help would be appreciated.

Share this post


Link to post
Share on other sites

Hi

 

I found that there is some issue when you use this add-ons with QT Pro.

 

When i add a product with Edit order, first thing i found that on "orders_products" table > there is a "products_stock_attributes" field, which is not updated when adding a new product.

 

And when delete a product from order, it will not update the stock quantity and hence it will result it sick product from QTPro.

 

Can anyone have any idea about this issue?

 

Thanks in adv.

Share this post


Link to post
Share on other sites

Hi

 

I found that there is some issue when you use this add-ons with QT Pro.

 

When i add a product with Edit order, first thing i found that on "orders_products" table > there is a "products_stock_attributes" field, which is not updated when adding a new product.

 

And when delete a product from order, it will not update the stock quantity and hence it will result it sick product from QTPro.

 

Can anyone have any idea about this issue?

 

Thanks in adv.

 

Hi Tejas,

 

I was facing the same issue, I was able to fix the problem with the Qtpro stock, the stock was not updated deleting or changing the product quantity. If you still facing this issue I can share the fix.

 

I was also noticed the issue with the "products_stock_attributes". this field is updated correctly for the product added but somehow this field if updated as null for the other products.

 

Did you found a solution for this?

Share this post


Link to post
Share on other sites

I have order editor V5.0.9c installed. Was working perfectly, till I started messing with shipping zones. Now the javascript/ajax does not work at all when set to true. I went back over the code and made sure everything was right (even though I never touched the code prior this) with no change. It does work with Allow the use of Ajax... set to false but it's annoying that way and I hate not having the add product in a new tab rather than the pop-up. 

 

How can I get my ajax update back? What happened to lose it? 

 

Help!

 

Thanks in advance. 

Share this post


Link to post
Share on other sites

Anyone having problems with ajax not working although it is turned on, here's what I had wrong - you MUST have atleast one Zone in the localization.

I deleted mine for later setup and the javascript for the editor gets stuck on a zone call.

 

tags: ajax, no ajax, ajax problem

 

I did see this. I have no clue what "at least one Zone in the localization" means. 

Share this post


Link to post
Share on other sites

Does anyone know how to add the # in stock to the titles in the drop down box of the edit_orders_add_product.php?

 

Something like this:

 

post-124357-0-05675900-1435766503_thumb.jpg

 

Also, anyone know how to have it change the product status to "Out of Stock" if the product # in stock drops to 0 (or less) after the product is saved on the order?

 

post-124357-0-36181100-1435766719_thumb.jpg

 

Can we change the product status to "In Stock" when we delete an item and the stock increases to any number above 0?

 

Thank you in advance for your assistance. 

Share this post


Link to post
Share on other sites

Figured this one out...

Does anyone know how to add the # in stock to the titles in the drop down box of the edit_orders_add_product.php?

 

Something like this:

 

attachicon.gifSTOCK.jpg

 

 

Around line 218 (through to 251) find this:


    $products_query = tep_db_query("select p.products_id, p.products_price, p.products_model, pd.products_name from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on (p.products_id = pd.products_id) where pd.language_id = '" . $languages_id . "' and (" . $product_search . ") order by pd.products_name");
    $not_found = ((tep_db_num_rows($products_query)) ? false : true);
  } 
  
  if (!isset($_POST['search'])) {
    $product_search = " where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id ";
    
    $_GET['inc_subcat'] = '1';
    if ($_GET['inc_subcat'] == '1') {
      $subcategories_array = array();
      oe_get_subcategories($subcategories_array, $add_product_categories_id);
      $product_search .= " and p2c.products_id = p.products_id and p2c.products_id = pd.products_id and (p2c.categories_id = '" . (int)$add_product_categories_id . "'";
      for ($i=0, $n=sizeof($subcategories_array); $i<$n; $i++ ) {
        $product_search .= " or p2c.categories_id = '" . $subcategories_array[$i] . "'";
      }
      $product_search .= ")";
    } else {
      $product_search .= " and p2c.products_id = p.products_id and p2c.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and p2c.categories_id = '" . (int)$add_product_categories_id . "'";
    }

    $products_query = tep_db_query("select distinct p.products_id, p.products_price, p.products_model, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c " . $product_search . " order by pd.products_name");
    $not_found = ((tep_db_num_rows($products_query)) ? false : true);
  }

  $category_array = array(array('id' => '', 'text' => TEXT_SELECT_CATEGORY),
                          array('id' => '0', 'text' => TEXT_ALL_CATEGORIES));
  
  if (($step > 1) && (!$not_found)) {
    $product_array = array(array('id' => 0, 'text' => TEXT_SELECT_PRODUCT));
    while($products = tep_db_fetch_array($products_query)) {
      $product_array[] = array('id' => $products['products_id'],
                               'text' => $products['products_name'] . ' (' . $products['products_model'] . ')' . ': ' . $currencies->format($products['products_price'], true, $order->info['currency'], $order->info['currency_value']));
    }
  }

 

and replace with this:

    $products_query = tep_db_query("select p.products_id, p.products_price, p.products_quantity, p.products_model, pd.products_name from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on (p.products_id = pd.products_id) where pd.language_id = '" . $languages_id . "' and (" . $product_search . ") order by pd.products_name");
    $not_found = ((tep_db_num_rows($products_query)) ? false : true);
  } 
  
  if (!isset($_POST['search'])) {
    $product_search = " where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id ";
    
    $_GET['inc_subcat'] = '1';
    if ($_GET['inc_subcat'] == '1') {
      $subcategories_array = array();
      oe_get_subcategories($subcategories_array, $add_product_categories_id);
      $product_search .= " and p2c.products_id = p.products_id and p2c.products_id = pd.products_id and (p2c.categories_id = '" . (int)$add_product_categories_id . "'";
      for ($i=0, $n=sizeof($subcategories_array); $i<$n; $i++ ) {
        $product_search .= " or p2c.categories_id = '" . $subcategories_array[$i] . "'";
      }
      $product_search .= ")";
    } else {
      $product_search .= " and p2c.products_id = p.products_id and p2c.products_quantity = p.products_quantity and p2c.products_quantity = pd.products_quantity and p2c.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and p2c.categories_id = '" . (int)$add_product_categories_id . "'";
    }

    $products_query = tep_db_query("select distinct p.products_id, p.products_price, p.products_model, p.products_quantity, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c " . $product_search . " order by pd.products_name");
    $not_found = ((tep_db_num_rows($products_query)) ? false : true);
  }

  $category_array = array(array('id' => '', 'text' => TEXT_SELECT_CATEGORY),
                          array('id' => '0', 'text' => TEXT_ALL_CATEGORIES));
  
  if (($step > 1) && (!$not_found)) {
    $product_array = array(array('id' => 0, 'text' => TEXT_SELECT_PRODUCT));
    while($products = tep_db_fetch_array($products_query)) {
      $product_array[] = array('id' => $products['products_id'],
                               'text' => $products['products_name'] . ' (' . $products['products_quantity'] . ' In Stock)' . ' (' . $products['products_model'] . ')' . ': ' . $currencies->format($products['products_price'], true, $order->info['currency'], $order->info['currency_value']));
    }
  }

Edited by queenzukie

Share this post


Link to post
Share on other sites

Still working on changing the status. I was trying combinations of this (below) but couldn't get it to work right. :(

		            $stock_left = $products_details["qty"];
        			if ( ($stock_left < 1) && (STOCK_ALLOW_CHECKOUT == 'false') ) {
          			tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '0' where products_id = '" . (int)$order_products['products_id'] . "'");
					}

Sad that I am alone here. Just talking to myself. 

Share this post


Link to post
Share on other sites

@

 

Not sure if this will make a difference but this....

 

$products_details["qty"]; >

 

is usually...

 

$products_details['qty']; >

 

Dan

Edited by Dan Cole

Share this post


Link to post
Share on other sites

Thank you Dan, I do remember trying that. Maybe I just didn't change it in the four places I put it. I'll try it again. 

Share this post


Link to post
Share on other sites

I tried this:

        	//update product status
	
        			if ($products_details['qty'] < 1){
          			tep_db_query("UPDATE " . TABLE_PRODUCTS . " SET 
          			products_status = '0' 
          			where products_id = '" . (int)$order_products['products_id'] . "'"); }

        			elseif ($products_details['qty'] >= 1){
          			tep_db_query("UPDATE " . TABLE_PRODUCTS . " SET 
          			products_status = '1' 
                                where products_id = '" . (int)$order_products['products_id'] . "'"); }

It will update the status when a product is deleted (quantity 1 status 1 (in stock) )

 

It will not update the status when a product is added to an order. (showing quantity 0 status 1 (in stock) ) Where it should be quantity 0 status 0 (out of stock)

 

It appears to be working on the second set of code however it is never reading the first set. 

Share this post


Link to post
Share on other sites

@

 

Can you echo out the variable $products_details['qty'] just before the if statement and see what the valve is at that point?

 

Dan

Share this post


Link to post
Share on other sites

Greetings,

 

How can I have additional payment methods and shipping methods available in the order editing module, but not have them available in the store?

 

We have customers that may phone, FAX or email an order, and I will enter the order into the store (to help keep track of inventory). These customers may have special shipping needs, or be on an open net-30 account with us ... features that we don't have on the store side.

 

Thanks!

 

Malcolm


Get the latest Responsive osCommerce CE (community edition) here .

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×