Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

rhmcvey

Archived
  • Posts

    2
  • Joined

  • Last visited

Everything posted by rhmcvey

  1. :blink: Oops! Just noticed one little bug from my previous post, but it's easy to fix. When the person initially comes into your store, they're using the default currency (the first currency on the list, I guess -- I can't find a default currency setting, wouldn't that be nice...?), and the currency variable isn't in the URL for us to pick up. So it ends up as a null value. What I did to fix this was allowed the code column in the fixed_prices table to have null values, and entered a third row for my product with the price for my first currency: 28, null, 200
  2. :D :D :D I also needed what Moonfish and Martin needed, and I think I have a kludge worked out. I just whipped this up tonight with no previous PHP or OSC experience, but it seems to be working -- i.e., when people switch currencies, they see that product's fixed price for that currency. I have no idea if this will work in conjunction with specials or any other features like that, but I haven't really altered too much, so here's hoping... Anyway, here's what I did, in a nutshell: 1. Add a table to your OSC database. I called mine fixed_prices. It should have three columns: product_id, code, and products_price (and make sure that last one is called products_price, or this won't work!). This is where you'll input the product-currency price combinations. So for instance, for one of my products, whose product_id is 28, I entered two rows: 28, USD, 160 28, CDN, 200 2. Modify the database_tables.php file to recognize this database. I added this line under all the other "define" lines: define('TABLE_FIXED_PRICES', 'fixed_prices'); 3. Modify the product_info.php page so that when the product info is looked up, it looks up the price from fixed_prices, based on the product_id and currency code. The original line was this: $product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'"); I altered it to this (alterations in bold): $product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, fp.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_FIXED_PRICES . " fp where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "' and fp.product_id = p.products_id and fp.code = '" . $HTTP_GET_VARS['currency'] . "'"); And that's it! I have both US and CDN configured as currencies, just like usual, with rates of 1.0. Let me know if this works for you, or if you have any ideas to improve it, etc.
×
×
  • Create New...