Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

what is wrong with this line of code


hungryfrank

Recommended Posts

hi

why this line don't work

tep_db_query("update " . TABLE_PRODUCTS . " set products_ordered = products_ordered + " .  $QuantityPurchased . " and 	products_quantity = products_quantity- " .  $QuantityPurchased . " where products_id = '" . tep_get_prid($SKU) . "'");	
	}

in the next lines it enters the correct info into a different table

you can cut up to 4 pages of your checkout by using my three add_ons

login create account in one page

Express checkout  

login pop up modal

Link to comment
Share on other sites

Try separating the minus from products_quantity with a space

 

edit to add:

 

It would be safer to cast the variable to integers too, eg.

. (int) $QuantityPurchased .

Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released.

Looking for a payment or shipping module? Maybe I've already done it.

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x

Link to comment
Share on other sites

Tip: Stock Keeping Unit mainly associated with SKU number or products_model and rarely with products_id.

:blink:
osCommerce based shop owner with minimal design and focused on background works. When the less is more.
Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store.

Link to comment
Share on other sites

thanks guys .

@@action Hero. i am trying to enter my ebay orders into osc orders so i use the sku to know what attributes were used in the ebay listing.everything seems to work but i have two problems this is one and the other i will post shortly.

 

but i still have a problem 

if i use 

tep_db_query("update " . TABLE_PRODUCTS . " set products_ordered = products_ordered + " . sprintf('%d', $QuantityPurchased) . " where products_id = '" . $e_id . "'");
tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = products_quantity - " . sprintf('%d', $QuantityPurchased) . " where products_id = '" . $e_id . "'");

it works  but if i use one call  then products_ordered turns to zero and product s_quantity dosen't change

tep_db_query("update " . TABLE_PRODUCTS . " set products_ordered = products_ordered + " . sprintf('%d', $QuantityPurchased). " and products_quantity = products_quantity - " . sprintf('%d', $QuantityPurchased). " where products_id = '" . $e_id . "'"); 

you can cut up to 4 pages of your checkout by using my three add_ons

login create account in one page

Express checkout  

login pop up modal

Link to comment
Share on other sites

The format of the update is set a=value, b=value, not set a=value and b=value.  Also, there's no need for the spintf calls. just cast the values to int as mentioned previously: (int)$QuantityPurchased

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...