Jump to content

figurez

Members
  • Content count

    75
  • Joined

  • Last visited

Everything posted by figurez

  1. Thanks KGT, yes I figured that out, sorry I didn´t tell you earlier. Thanks a million for your time and support. It´s greatly apprecieated. Looks like everything is working now. :)
  2. ok, this is my includes/classes/order.php <?php /* $Id: order.php,v 1.33 2003/06/09 22:25:35 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ class order { var $info, $totals, $products, $customer, $delivery, $content_type; function order($order_id = '') { $this->info = array(); $this->totals = array(); $this->products = array(); $this->customer = array(); $this->delivery = array(); if (tep_not_null($order_id)) { $this->query($order_id); } else { $this->cart(); } } function query($order_id) { global $languages_id; $order_id = tep_db_prepare_input($order_id); $order_query = tep_db_query("select customers_id, customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, billing_name, billing_company, billing_tva_intracom, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, currency, currency_value, date_purchased, orders_status, last_modified from " . TABLE_ORDERS . " where orders_id = '" . (int)$order_id . "'"); $order = tep_db_fetch_array($order_query); $totals_query = tep_db_query("select title, text from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . (int)$order_id . "' order by sort_order"); while ($totals = tep_db_fetch_array($totals_query)) { $this->totals[] = array('title' => $totals['title'], 'text' => $totals['text']); } $order_total_query = tep_db_query("select text from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . (int)$order_id . "' and class = 'ot_total'"); $order_total = tep_db_fetch_array($order_total_query); $shipping_method_query = tep_db_query("select title from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . (int)$order_id . "' and class = 'ot_shipping'"); $shipping_method = tep_db_fetch_array($shipping_method_query); $order_status_query = tep_db_query("select orders_status_name from " . TABLE_ORDERS_STATUS . " where orders_status_id = '" . $order['orders_status'] . "' and language_id = '" . (int)$languages_id . "'"); $order_status = tep_db_fetch_array($order_status_query); $this->info = array('currency' => $order['currency'], 'currency_value' => $order['currency_value'], 'payment_method' => $order['payment_method'], 'cc_type' => $order['cc_type'], 'cc_owner' => $order['cc_owner'], 'cc_number' => $order['cc_number'], 'cc_expires' => $order['cc_expires'], 'date_purchased' => $order['date_purchased'], 'orders_status' => $order_status['orders_status_name'], 'last_modified' => $order['last_modified'], 'total' => strip_tags($order_total['text']), 'shipping_method' => ((substr($shipping_method['title'], -1) == ':') ? substr(strip_tags($shipping_method['title']), 0, -1) : strip_tags($shipping_method['title']))); $this->customer = array('id' => $order['customers_id'], 'name' => $order['customers_name'], 'company' => $order['customers_company'], 'street_address' => $order['customers_street_address'], 'suburb' => $order['customers_suburb'], 'city' => $order['customers_city'], 'postcode' => $order['customers_postcode'], 'state' => $order['customers_state'], 'country' => $order['customers_country'], 'format_id' => $order['customers_address_format_id'], 'telephone' => $order['customers_telephone'], 'email_address' => $order['customers_email_address']); $this->delivery = array('name' => $order['delivery_name'], 'company' => $order['delivery_company'], 'street_address' => $order['delivery_street_address'], 'suburb' => $order['delivery_suburb'], 'city' => $order['delivery_city'], 'postcode' => $order['delivery_postcode'], 'state' => $order['delivery_state'], 'country' => $order['delivery_country'], 'format_id' => $order['delivery_address_format_id']); if (empty($this->delivery['name']) && empty($this->delivery['street_address'])) { $this->delivery = false; } $this->billing = array('name' => $order['billing_name'], 'company' => $order['billing_company'], //BOF for VAT INTRACOM 'tva_intracom' => $order['billing_tva_intracom'], // EOF for TVA_INTRACOM 'street_address' => $order['billing_street_address'], 'suburb' => $order['billing_suburb'], 'city' => $order['billing_city'], 'postcode' => $order['billing_postcode'], 'state' => $order['billing_state'], 'country' => $order['billing_country'], 'format_id' => $order['billing_address_format_id']); $index = 0; $orders_products_query = tep_db_query("select orders_products_id, products_id, products_name, products_model, products_price, products_tax, products_quantity, final_price from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int)$order_id . "'"); while ($orders_products = tep_db_fetch_array($orders_products_query)) { $this->products[$index] = array('qty' => $orders_products['products_quantity'], 'id' => $orders_products['products_id'], 'name' => $orders_products['products_name'], 'model' => $orders_products['products_model'], 'tax' => $orders_products['products_tax'], 'price' => $orders_products['products_price'], 'final_price' => $orders_products['final_price']); $subindex = 0; $attributes_query = tep_db_query("select products_options, products_options_values, options_values_price, price_prefix from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_id = '" . (int)$order_id . "' and orders_products_id = '" . (int)$orders_products['orders_products_id'] . "'"); if (tep_db_num_rows($attributes_query)) { while ($attributes = tep_db_fetch_array($attributes_query)) { $this->products[$index]['attributes'][$subindex] = array('option' => $attributes['products_options'], 'value' => $attributes['products_options_values'], 'prefix' => $attributes['price_prefix'], 'price' => $attributes['options_values_price']); $subindex++; } } $this->info['tax_groups']["{$this->products[$index]['tax']}"] = '1'; $index++; } } function cart() { global $customer_id, $sendto, $billto, $cart, $languages_id, $currency, $currencies, $shipping, $payment; $this->content_type = $cart->get_content_type(); $customer_address_query = tep_db_query("select c.customers_firstname, c.customers_lastname, c.customers_telephone, c.customers_email_address, ab.entry_company, ab.entry_tva_intracom, ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name, co.countries_id, co.countries_name, co.countries_iso_code_2, co.countries_iso_code_3, co.address_format_id, ab.entry_state from " . TABLE_CUSTOMERS . " c, " . TABLE_ADDRESS_BOOK . " ab left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) left join " . TABLE_COUNTRIES . " co on (ab.entry_country_id = co.countries_id) where c.customers_id = '" . (int)$customer_id . "' and ab.customers_id = '" . (int)$customer_id . "' and c.customers_default_address_id = ab.address_book_id"); $customer_address = tep_db_fetch_array($customer_address_query); $shipping_address_query = tep_db_query("select ab.entry_firstname, ab.entry_lastname, ab.entry_company, ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name, ab.entry_country_id, c.countries_id, c.countries_name, c.countries_iso_code_2, c.countries_iso_code_3, c.address_format_id, ab.entry_state from " . TABLE_ADDRESS_BOOK . " ab left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) left join " . TABLE_COUNTRIES . " c on (ab.entry_country_id = c.countries_id) where ab.customers_id = '" . (int)$customer_id . "' and ab.address_book_id = '" . (int)$sendto . "'"); $shipping_address = tep_db_fetch_array($shipping_address_query); $billing_address_query = tep_db_query("select ab.entry_firstname, ab.entry_lastname, ab.entry_company, ab.entry_tva_intracom, ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name, ab.entry_country_id, c.countries_id, c.countries_name, c.countries_iso_code_2, c.countries_iso_code_3, c.address_format_id, ab.entry_state from " . TABLE_ADDRESS_BOOK . " ab left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) left join " . TABLE_COUNTRIES . " c on (ab.entry_country_id = c.countries_id) where ab.customers_id = '" . (int)$customer_id . "' and ab.address_book_id = '" . (int)$billto . "'"); $billing_address = tep_db_fetch_array($billing_address_query); $tax_address_query = tep_db_query("select ab.entry_country_id, ab.entry_zone_id from " . TABLE_ADDRESS_BOOK . " ab left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) where ab.customers_id = '" . (int)$customer_id . "' and ab.address_book_id = '" . (int)($this->content_type == 'virtual' ? $billto : $sendto) . "'"); $tax_address = tep_db_fetch_array($tax_address_query); $this->info = array('order_status' => DEFAULT_ORDERS_STATUS_ID, 'currency' => $currency, 'currency_value' => $currencies->currencies[$currency]['value'], 'payment_method' => $payment, 'cc_type' => (isset($GLOBALS['cc_type']) ? $GLOBALS['cc_type'] : ''), 'cc_owner' => (isset($GLOBALS['cc_owner']) ? $GLOBALS['cc_owner'] : ''), 'cc_number' => (isset($GLOBALS['cc_number']) ? $GLOBALS['cc_number'] : ''), 'cc_expires' => (isset($GLOBALS['cc_expires']) ? $GLOBALS['cc_expires'] : ''), 'shipping_method' => $shipping['title'], 'shipping_cost' => $shipping['cost'], 'subtotal' => 0, 'tax' => 0, 'tax_groups' => array(), //kgt - discount coupons 'coupon' => (isset($GLOBALS['coupon']) ? $GLOBALS['coupon'] : ''), 'applied_discount' => array(), //end kgt - discount coupons 'comments' => (isset($GLOBALS['comments']) ? $GLOBALS['comments'] : '')); if (isset($GLOBALS[$payment]) && is_object($GLOBALS[$payment])) { $this->info['payment_method'] = $GLOBALS[$payment]->title; if ( isset($GLOBALS[$payment]->order_status) && is_numeric($GLOBALS[$payment]->order_status) && ($GLOBALS[$payment]->order_status > 0) ) { $this->info['order_status'] = $GLOBALS[$payment]->order_status; } } $this->customer = array('firstname' => $customer_address['customers_firstname'], 'lastname' => $customer_address['customers_lastname'], 'company' => $customer_address['entry_company'], 'street_address' => $customer_address['entry_street_address'], 'suburb' => $customer_address['entry_suburb'], 'city' => $customer_address['entry_city'], 'postcode' => $customer_address['entry_postcode'], 'state' => ((tep_not_null($customer_address['entry_state'])) ? $customer_address['entry_state'] : $customer_address['zone_name']), 'zone_id' => $customer_address['entry_zone_id'], 'country' => array('id' => $customer_address['countries_id'], 'title' => $customer_address['countries_name'], 'iso_code_2' => $customer_address['countries_iso_code_2'], 'iso_code_3' => $customer_address['countries_iso_code_3']), 'format_id' => $customer_address['address_format_id'], 'telephone' => $customer_address['customers_telephone'], 'email_address' => $customer_address['customers_email_address']); $this->delivery = array('firstname' => $shipping_address['entry_firstname'], 'lastname' => $shipping_address['entry_lastname'], 'company' => $shipping_address['entry_company'], 'street_address' => $shipping_address['entry_street_address'], 'suburb' => $shipping_address['entry_suburb'], 'city' => $shipping_address['entry_city'], 'postcode' => $shipping_address['entry_postcode'], 'state' => ((tep_not_null($shipping_address['entry_state'])) ? $shipping_address['entry_state'] : $shipping_address['zone_name']), 'zone_id' => $shipping_address['entry_zone_id'], 'country' => array('id' => $shipping_address['countries_id'], 'title' => $shipping_address['countries_name'], 'iso_code_2' => $shipping_address['countries_iso_code_2'], 'iso_code_3' => $shipping_address['countries_iso_code_3']), 'country_id' => $shipping_address['entry_country_id'], 'format_id' => $shipping_address['address_format_id']); $this->billing = array('firstname' => $billing_address['entry_firstname'], 'lastname' => $billing_address['entry_lastname'], 'company' => $billing_address['entry_company'], //BOF for VAT INTRACOM 'tva_intracom' => $billing_address['entry_tva_intracom'], // EOF for TVA_INTRACOM 'street_address' => $billing_address['entry_street_address'], 'suburb' => $billing_address['entry_suburb'], 'city' => $billing_address['entry_city'], 'postcode' => $billing_address['entry_postcode'], 'state' => ((tep_not_null($billing_address['entry_state'])) ? $billing_address['entry_state'] : $billing_address['zone_name']), 'zone_id' => $billing_address['entry_zone_id'], 'country' => array('id' => $billing_address['countries_id'], 'title' => $billing_address['countries_name'], 'iso_code_2' => $billing_address['countries_iso_code_2'], 'iso_code_3' => $billing_address['countries_iso_code_3']), 'country_id' => $billing_address['entry_country_id'], 'format_id' => $billing_address['address_format_id']); $index = 0; $products = $cart->get_products(); for ($i=0, $n=sizeof($products); $i<$n; $i++) { $this->products[$index] = array('qty' => $products[$i]['quantity'], 'name' => $products[$i]['name'], 'model' => $products[$i]['model'], 'tax' => tep_get_tax_rate($products[$i]['tax_class_id'], $tax_address['entry_country_id'], $tax_address['entry_zone_id']), 'tax_description' => tep_get_tax_description($products[$i]['tax_class_id'], $tax_address['entry_country_id'], $tax_address['entry_zone_id']), 'price' => $products[$i]['price'], 'final_price' => $products[$i]['price'] + $cart->attributes_price($products[$i]['id']), 'weight' => $products[$i]['weight'], 'id' => $products[$i]['id']); if ($products[$i]['attributes']) { $subindex = 0; reset($products[$i]['attributes']); while (list($option, $value) = each($products[$i]['attributes'])) { $attributes_query = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . (int)$products[$i]['id'] . "' and pa.options_id = '" . (int)$option . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . (int)$value . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . (int)$languages_id . "' and poval.language_id = '" . (int)$languages_id . "'"); $attributes = tep_db_fetch_array($attributes_query); $this->products[$index]['attributes'][$subindex] = array('option' => $attributes['products_options_name'], 'value' => $attributes['products_options_values_name'], 'option_id' => $option, 'value_id' => $value, 'prefix' => $attributes['price_prefix'], 'price' => $attributes['options_values_price']); $subindex++; } } // BOF for TVA_intracom_v3.4 //For those who want taxes automatically if the conditions below are OK, uncomment the lines below if ($this->billing['company'] != '' && $this->billing['tva_intracom'] != '' && $this->billing['country']['id'] != STORE_COUNTRY && $this->delivery['country']['id'] != STORE_COUNTRY) { //kgt - discount coupon if( !empty( $this->info['coupon'] ) ) { if( !isset( $this_coupon ) ) { require_once( DIR_WS_CLASSES . 'discount_coupon.php' ); $this_coupon = new discount_coupon( $this->info['coupon'] ); } $applied_discount = $this_coupon->calculate_discount( $this->products[$index], $n ); if( isset( $this->info['applied_discount'][$this->products[$index]['tax_description']] ) ) { $this->info['applied_discount'][$this->products[$index]['tax_description']] += $applied_discount; } else { $this->info['applied_discount'][$this->products[$index]['tax_description']] = $applied_discount; } $this_actual_shown_price = null; if( MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DISPLAY_SUBTOTAL == 'false' ) { //we don't want to display the subtotal with the discount applied, so apply the discount then set the applied_discount variable to zero so that it's not added into the order subtotal, but is still used to correctly calculate tax $this_actual_shown_price = ( $this->products[$index]['final_price'] * $this->products[$index]['qty'] ) - $applied_discount; $applied_discount = 0; } } $shown_price = ( $this->products[$index]['final_price'] * $this->products[$index]['qty'] ) - $applied_discount; $this->info['subtotal'] += $shown_price; //if we need to display the subtotal without the discount applied, then add the shown price to the subtotal, then change shown price to the price with the applied discount in order to properly calculate taxes if( isset( $this_actual_shown_price ) ) $shown_price = $this_actual_shown_price; //end kgt - discount coupon } else { // EOF for TVA_intracom_v3.4 //kgt - discount coupon if( !empty( $this->info['coupon'] ) ) { if( !isset( $this_coupon ) ) { require_once( DIR_WS_CLASSES . 'discount_coupon.php' ); $this_coupon = new discount_coupon( $this->info['coupon'] ); } $applied_discount = $this_coupon->calculate_discount( $this->products[$index], $n, true ); if( isset( $this->info['applied_discount'][$this->products[$index]['tax_description']] ) ) { $this->info['applied_discount'][$this->products[$index]['tax_description']] += $applied_discount; } else { $this->info['applied_discount'][$this->products[$index]['tax_description']] = $applied_discount; } $this_actual_shown_price = null; if( MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DISPLAY_SUBTOTAL == 'false' ) { //we don't want to display the subtotal with the discount applied, so apply the discount then set the applied_discount variable to zero so that it's not added into the order subtotal, but is still used to correctly calculate tax $this_actual_shown_price = ( tep_add_tax( $this->products[$index]['final_price'], $this->products[$index]['tax'] ) * $this->products[$index]['qty'] ) - $applied_discount; $applied_discount = 0; } } $shown_price = ( tep_add_tax( $this->products[$index]['final_price'], $this->products[$index]['tax'] ) * $this->products[$index]['qty'] ) - $applied_discount; $this->info['subtotal'] += $shown_price; //if we need to display the subtotal without the discount applied, then add the shown price to the subtotal, then change shown price to the price with the applied discount in order to properly calculate taxes if( isset( $this_actual_shown_price ) ) $shown_price = $this_actual_shown_price; //end kgt - discount coupon // BOF for TVA_intracom_v3.4 //For those who want taxes automatically if the conditions below are OK, uncomment the line below } // EOF for TVA_intracom_v3.4 // BOF for TVA_intracom_v3.4 //For those who want taxes automatically if the conditions below are OK, uncomment the lines below if ($this->billing['company'] != '' && $this->billing['tva_intracom'] != '' && $this->billing['country']['id'] != STORE_COUNTRY && $this->delivery['country']['id'] != STORE_COUNTRY) { $products_tax = 0; $products_tax_description = NO_TAX; } else { // EOF for TVA_intracom_v3.4 $products_tax = $this->products[$index]['tax']; $products_tax_description = $this->products[$index]['tax_description']; // BOF for TVA_intracom_v3.4 //For those who want taxes automatically if the conditions below are OK, uncomment the line below } // EOF for TVA_intracom_v3.4 if (DISPLAY_PRICE_WITH_TAX == 'true') { $this->info['tax'] += $shown_price - ($shown_price / (($products_tax < 10) ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax))); if (isset($this->info['tax_groups']["$products_tax_description"])) { $this->info['tax_groups']["$products_tax_description"] += $shown_price - ($shown_price / (($products_tax < 10) ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax))); } else { $this->info['tax_groups']["$products_tax_description"] = $shown_price - ($shown_price / (($products_tax < 10) ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax))); } } else { $this->info['tax'] += ($products_tax / 100) * $shown_price; if (isset($this->info['tax_groups']["$products_tax_description"])) { $this->info['tax_groups']["$products_tax_description"] += ($products_tax / 100) * $shown_price; } else { $this->info['tax_groups']["$products_tax_description"] = ($products_tax / 100) * $shown_price; } } $index++; } if (DISPLAY_PRICE_WITH_TAX == 'true') { $this->info['total'] = $this->info['subtotal'] + $this->info['shipping_cost']; } else { $this->info['total'] = $this->info['subtotal'] + $this->info['tax'] + $this->info['shipping_cost']; } } } ?>
  3. ok, I tested the changes and it looks like it doesn´t remove the discount from the total. It count´s the tax correct but the total ammount to pay is without the discount. Any ideas? I really appreciate your time and help. Should I modify the order_total.php somehow? This is my order_total.php if you can see anything: <?php /* $Id: ot_total.php,v 1.7 2003/02/13 00:12:04 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ class ot_total { var $title, $output; function ot_total() { $this->code = 'ot_total'; $this->title = MODULE_ORDER_TOTAL_TOTAL_TITLE; $this->description = MODULE_ORDER_TOTAL_TOTAL_DESCRIPTION; $this->enabled = ((MODULE_ORDER_TOTAL_TOTAL_STATUS == 'true') ? true : false); $this->sort_order = MODULE_ORDER_TOTAL_TOTAL_SORT_ORDER; $this->output = array(); } function process() { global $order, $currencies; $this->output[] = array('title' => $this->title . ':', 'text' => '<b>' . $currencies->format($order->info['total'], true, $order->info['currency'], $order->info['currency_value']) . '</b>', 'value' => $order->info['total']); } function check() { if (!isset($this->_check)) { $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_ORDER_TOTAL_TOTAL_STATUS'"); $this->_check = tep_db_num_rows($check_query); } return $this->_check; } function keys() { return array('MODULE_ORDER_TOTAL_TOTAL_STATUS', 'MODULE_ORDER_TOTAL_TOTAL_SORT_ORDER'); } function install() { 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 Total', 'MODULE_ORDER_TOTAL_TOTAL_STATUS', 'true', 'Do you want to display the total order value?', '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_TOTAL_SORT_ORDER', '4', 'Sort order of display.', '6', '2', now())"); } function remove() { tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); } } ?>
  4. wow it at first glance it looks like it´s working. I will do some testing. I will get back to you soon. I can´t tell you how happy I am if I can get this to work. Talk to you later I have to make supper for my kid :D :D
  5. This is my whole discount_coupon.php from catalog/includes/classes <?php /* * ot_discount_coupon.php * August 4, 2006 * author: Kristen G. Thorson * * ot_discount_coupon_codes version 2.0 * * Released under the GNU General Public License * */ class discount_coupon { var $code, $error_message, $coupon; function discount_coupon( $code ) { $this->code = $code; $this->error_message = array(); $this->coupon = array(); $this->get_coupon(); } function verify_code() { //check the global number of discounts that may be used if( $this->coupon['coupons_number_available'] != 0 ) { $this->check_num_available(); } //if coupons_max_use==0, then use is unlimited, otherwise, we need to verify the customer hasn't used this coupon more than coupons_max_use times if( $this->coupon['coupons_max_use'] != 0 ) { $this->check_coupons_max_use(); } //now we need to check if the order total matches the coupons_min_order if( $this->coupon['coupons_min_order'] != 0 ) { $this->check_coupons_min_order(); } } function get_coupon() { $check_code_query = tep_db_query( $sql = "SELECT coupons_discount_percent, coupons_description, coupons_max_use, coupons_min_order, coupons_max_order, coupons_number_available FROM " . TABLE_DISCOUNT_COUPONS . " WHERE coupons_id = '" . tep_db_input( $this->code ) . "' AND ( coupons_date_start <= CURDATE() OR coupons_date_start IS NULL ) AND ( coupons_date_end >= CURDATE() OR coupons_date_end IS NULL )" ); if( tep_db_num_rows( $check_code_query ) != 1 ) { //if no rows are returned, then they haven't entered a valid code $this->error_message[] = ENTRY_DISCOUNT_COUPON_ERROR; //display the error message } else { $row = tep_db_fetch_array( $check_code_query ); //since there is one record, we have a valid code $this->coupon = $row; } } function check_coupons_min_order() { global $order, $currencies; //if we display the subtotal without the discount applied, then just compare the subtotal to the minimum order if( MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DISPLAY_SUBTOTAL == 'false' && $this->coupon['coupons_min_order'] > $order->info['subtotal'] ) { $this->error_message[] = sprintf( ENTRY_DISCOUNT_COUPON_MIN_ERROR, $currencies->format( $this->coupon['coupons_min_order'], true, $order->info['currency'], $order->info['currency_value'] ) ); //if we display the subtotal with the discount applied, then we need to compare the subtotal with the discount added back in to the minimum order } else if( MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DISPLAY_SUBTOTAL == 'true' ) { $subtotal = $order->info['subtotal']; foreach( $order->info['applied_discount'] as $discount ) { $subtotal += $discount; } if( $this->coupon['coupons_min_order'] > $subtotal ) $this->error_message[] = sprintf( ENTRY_DISCOUNT_COUPON_MIN_ERROR, $currencies->format( $this->coupon['coupons_min_order'], true, $order->info['currency'], $order->info['currency_value'] ) ); } } function check_coupons_max_use() { global $customer_id; $check_use_query = tep_db_query($sql = "SELECT COUNT(*) AS cnt FROM ".TABLE_ORDERS." AS o INNER JOIN ".TABLE_DISCOUNT_COUPONS_TO_ORDERS." dc2o ON dc2o.orders_id=o.orders_id AND o.customers_id = '".(int)$customer_id."' AND dc2o.coupons_id='".tep_db_input( $this->code )."'"); $use = tep_db_fetch_array( $check_use_query ); //show error message if coupons_max_use is equal to the number of times this customer has used the code if( $this->coupon['coupons_max_use'] <= $use['cnt'] ) $this->error_message[] = sprintf( ENTRY_DISCOUNT_COUPON_USE_ERROR, $use['cnt'], $this->coupon['coupons_max_use'] ); //display the error message for number of times used } function check_num_available() { //count the number of times this coupon has been used $check_use_query = tep_db_query( $sql = 'SELECT COUNT(*) AS cnt FROM '.TABLE_DISCOUNT_COUPONS_TO_ORDERS.' WHERE coupons_id="'.tep_db_input( $this->code ).'"' ); $use = tep_db_fetch_array( $check_use_query ); if( $this->coupon['coupons_number_available'] <= $use['cnt'] ) $this->error_message[] = ENTRY_DISCOUNT_COUPON_AVAILABLE_ERROR; //display error that this coupon is no longer valid } function is_recalc_shipping() { global $order, $language; //check if there is free shipping if( MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING == 'true' ) { include(DIR_WS_LANGUAGES . $language . '/modules/order_total/ot_shipping.php'); //if free shipping is enabled, make sure te discount does not bring the order total below free shipping limit if( $order->info['shipping_method'] == FREE_SHIPPING_TITLE ) { //if free shipping is the selected shipping method if( ( $order->info['total'] - $order->info['shipping_cost'] ) < MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER ) { //if the discount lowers the total below the free shipping limit return true; } } } return false; } function is_errors() { if( count( $this->error_message ) > 0 ) return true; return false; } function calculate_discount( $product, $product_count, $use_tax = false ) { if( $use_tax ) { //if there's a maximum order amount to apply the discount to, determine the percentage of this product's final price we should apply the discount to $max_applied_percentage = ( $this->coupon['coupons_max_order'] == 0 ? '1.00' : $this->coupon['coupons_max_order'] / ( tep_add_tax( $product['final_price'] * $product['qty'], $product['tax'] ) * $product_count ) ); $applied_discount = tep_add_tax( $product['final_price'] * $max_applied_percentage * $this->coupon['coupons_discount_percent'], $product['tax'] ) * $product['qty']; //don't allow the discount amount to be more than the product price if( $applied_discount > ( tep_add_tax( $product['final_price'], $product['tax'] ) * $product['qty'] ) ) $applied_discount = tep_add_tax( $product['final_price'], $product['tax'] ) * $product['qty']; } else { //if there's a maximum order amount to apply the discount to, determine the percentage of this product's final price we should apply the discount to $max_applied_percentage = ( $this->coupon['coupons_max_order'] == 0 ? '1.00' : $this->coupon['coupons_max_order'] / ( $product['final_price'] * $product['qty'] * $product_count ) ); $applied_discount = $product['final_price'] * $max_applied_percentage * $this->coupon['coupons_discount_percent'] * $product['qty']; //don't allow the discount amount to be more than the product price if( $applied_discount > ( $product['final_price'] * $product['qty'] ) ) $applied_discount = $product['final_price'] * $product['qty']; } return $applied_discount; } ?>
  6. Well, I added the "(" and got rid of that error. Then I got another error when I try to continue from the payment method page. The following error: Parse error: syntax error, unexpected ';', expecting T_FUNCTION in /home/xxxxx/public_html/includes/classes/discount_coupon.php on line 127 Line 127 has the following code: ?>
  7. Hi KGT and thank you for your help. I have done the modifications you suggested. When I´m trying to checkout I´m getting the following error: Parse error: syntax error, unexpected ')' in /home/xxxxx/public_html/includes/classes/order.php on line 273 The code for line 273 is: $this_actual_shown_price = ( $this->products[$index]['final_price'] ) * $this->products[$index]['qty'] ) - $applied_discount; Can I just add and "(" before the "$this" ? Sorry my php knowledge is very limited :blush:
  8. @robodude Or if you don´t have any more links underneath your last line. Do like this: Find: if ($selected_box == 'catalog') { $contents[] = array('text' => '<a href="' . tep_href_link(FILENAME_CATEGORIES, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_CATEGORIES_PRODUCTS . '</a><br>' . //kgt - discount coupons '<a href="' . tep_href_link(FILENAME_PRODUCTS_EXPECTED, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_PRODUCTS_EXPECTED . '</a><br>'. '<a href="' . tep_href_link(FILENAME_DISCOUNT_COUPONS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_DISCOUNT_COUPONS . '</a>' ); //end kgt - discount coupons '<a href="' . tep_href_link(FILENAME_MANUFACTURERS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_MANUFACTURERS . '</a><br>' . Replace with: if ($selected_box == 'catalog') { $contents[] = array('text' => '<a href="' . tep_href_link(FILENAME_CATEGORIES, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_CATEGORIES_PRODUCTS . '</a><br>' . //kgt - discount coupons '<a href="' . tep_href_link(FILENAME_PRODUCTS_EXPECTED, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_PRODUCTS_EXPECTED . '</a><br>'. '<a href="' . tep_href_link(FILENAME_DISCOUNT_COUPONS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_DISCOUNT_COUPONS . '</a><br>'. //end kgt - discount coupons '<a href="' . tep_href_link(FILENAME_MANUFACTURERS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_MANUFACTURERS . '</a>' );
  9. find this code: '<a href="' . tep_href_link(FILENAME_DISCOUNT_COUPONS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_DISCOUNT_COUPONS . '</a>' ); replace with: '<a href="' . tep_href_link(FILENAME_DISCOUNT_COUPONS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_DISCOUNT_COUPONS . '</a><br>'. That should do the trick. By the way, I still need help with my question a couple of posts above this one. Anyone? /Per
  10. Post your code for your admin/includes/boxes/catalog.php and I will see if I can help you.
  11. Looks like my posting was too long and was cut off and I wasn´t fast enough to edit it. I paste the last bit of it here again. ---------------------------- And the part from the VAT contribution I´m trying to implement looks like this. It´s supposed to go at the end of the order.php The code from the VAT contribution is marked with "// BOF for TVA_intracom_v3.4" $subindex++; } } // BOF for TVA_intracom_v3.4 //For those who want taxes automatically if the conditions below are OK, uncomment the lines below if ($this->billing['company'] != '' && $this->billing['tva_intracom'] != '' && $this->billing['country']['id'] != STORE_COUNTRY && $this->delivery['country']['id'] != STORE_COUNTRY) { $shown_price = $this->products[$index]['final_price'] * $this->products[$index]['qty']; $this->info['subtotal'] += $shown_price; } else { // EOF for TVA_intracom_v3.4 $shown_price = tep_add_tax($this->products[$index]['final_price'], $this->products[$index]['tax']) * $this->products[$index]['qty']; $this->info['subtotal'] += $shown_price; // BOF for TVA_intracom_v3.4 //For those who want taxes automatically if the conditions below are OK, uncomment the line below } // EOF for TVA_intracom_v3.4 // BOF for TVA_intracom_v3.4 //For those who want taxes automatically if the conditions below are OK, uncomment the lines below if ($this->billing['company'] != '' && $this->billing['tva_intracom'] != '' && $this->billing['country']['id'] != STORE_COUNTRY && $this->delivery['country']['id'] != STORE_COUNTRY) { $products_tax = 0; $products_tax_description = NO_TAX; } else { // EOF for TVA_intracom_v3.4 $products_tax = $this->products[$index]['tax']; $products_tax_description = $this->products[$index]['tax_description']; // BOF for TVA_intracom_v3.4 //For those who want taxes automatically if the conditions below are OK, uncomment the line below } // EOF for TVA_intracom_v3.4 if (DISPLAY_PRICE_WITH_TAX == 'true') { $this->info['tax'] += $shown_price - ($shown_price / (($products_tax < 10) ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax))); if (isset($this->info['tax_groups']["$products_tax_description"])) { $this->info['tax_groups']["$products_tax_description"] += $shown_price - ($shown_price / (($products_tax < 10) ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax))); } else { $this->info['tax_groups']["$products_tax_description"] = $shown_price - ($shown_price / (($products_tax < 10) ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax))); } } else { $this->info['tax'] += ($products_tax / 100) * $shown_price; if (isset($this->info['tax_groups']["$products_tax_description"])) { $this->info['tax_groups']["$products_tax_description"] += ($products_tax / 100) * $shown_price; } else { $this->info['tax_groups']["$products_tax_description"] = ($products_tax / 100) * $shown_price; } } $index++; } if (DISPLAY_PRICE_WITH_TAX == 'true') { $this->info['total'] = $this->info['subtotal'] + $this->info['shipping_cost']; } else { $this->info['total'] = $this->info['subtotal'] + $this->info['tax'] + $this->info['shipping_cost']; } } } ?> I would really appreciate any help with this to bring me closer to a solution. Could this even be done? I would really like to use both contributions. Thanks in advance Per
  12. Hi I´m using this contribution Discount Coupon Codes and it´s working fine. I´m trying to implement the contribution "E.U. VAT Intracom Number" http://www.oscommerce.com/community/contributions,1848 This contribution can automatically remove tax for european customers who enters a VAT-number when they register. To do this I have to implement some code in my catalog/includes/classes/order.php Where I need to implemet the code I allready have some code from the Discount Coupon Codes contribution. Is it possible to merge the two codes somehow? I have tried but when I try the tax get charged two times. I would really need some help with this. My catalog/includes/classes/order.php with Discount Codes looks like this. <?php /* $Id: order.php,v 1.33 2003/06/09 22:25:35 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ class order { var $info, $totals, $products, $customer, $delivery, $content_type; function order($order_id = '') { $this->info = array(); $this->totals = array(); $this->products = array(); $this->customer = array(); $this->delivery = array(); if (tep_not_null($order_id)) { $this->query($order_id); } else { $this->cart(); } } function query($order_id) { global $languages_id; $order_id = tep_db_prepare_input($order_id); $order_query = tep_db_query("select customers_id, customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, billing_name, billing_company, billing_tva_intracom, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, currency, currency_value, date_purchased, orders_status, last_modified from " . TABLE_ORDERS . " where orders_id = '" . (int)$order_id . "'"); $order = tep_db_fetch_array($order_query); $totals_query = tep_db_query("select title, text from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . (int)$order_id . "' order by sort_order"); while ($totals = tep_db_fetch_array($totals_query)) { $this->totals[] = array('title' => $totals['title'], 'text' => $totals['text']); } $order_total_query = tep_db_query("select text from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . (int)$order_id . "' and class = 'ot_total'"); $order_total = tep_db_fetch_array($order_total_query); $shipping_method_query = tep_db_query("select title from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . (int)$order_id . "' and class = 'ot_shipping'"); $shipping_method = tep_db_fetch_array($shipping_method_query); $order_status_query = tep_db_query("select orders_status_name from " . TABLE_ORDERS_STATUS . " where orders_status_id = '" . $order['orders_status'] . "' and language_id = '" . (int)$languages_id . "'"); $order_status = tep_db_fetch_array($order_status_query); $this->info = array('currency' => $order['currency'], 'currency_value' => $order['currency_value'], 'payment_method' => $order['payment_method'], 'cc_type' => $order['cc_type'], 'cc_owner' => $order['cc_owner'], 'cc_number' => $order['cc_number'], 'cc_expires' => $order['cc_expires'], 'date_purchased' => $order['date_purchased'], 'orders_status' => $order_status['orders_status_name'], 'last_modified' => $order['last_modified'], 'total' => strip_tags($order_total['text']), 'shipping_method' => ((substr($shipping_method['title'], -1) == ':') ? substr(strip_tags($shipping_method['title']), 0, -1) : strip_tags($shipping_method['title']))); $this->customer = array('id' => $order['customers_id'], 'name' => $order['customers_name'], 'company' => $order['customers_company'], 'street_address' => $order['customers_street_address'], 'suburb' => $order['customers_suburb'], 'city' => $order['customers_city'], 'postcode' => $order['customers_postcode'], 'state' => $order['customers_state'], 'country' => $order['customers_country'], 'format_id' => $order['customers_address_format_id'], 'telephone' => $order['customers_telephone'], 'email_address' => $order['customers_email_address']); $this->delivery = array('name' => $order['delivery_name'], 'company' => $order['delivery_company'], 'street_address' => $order['delivery_street_address'], 'suburb' => $order['delivery_suburb'], 'city' => $order['delivery_city'], 'postcode' => $order['delivery_postcode'], 'state' => $order['delivery_state'], 'country' => $order['delivery_country'], 'format_id' => $order['delivery_address_format_id']); if (empty($this->delivery['name']) && empty($this->delivery['street_address'])) { $this->delivery = false; } $this->billing = array('name' => $order['billing_name'], 'company' => $order['billing_company'], //BOF for VAT INTRACOM 'tva_intracom' => $order['billing_tva_intracom'], // EOF for TVA_INTRACOM 'street_address' => $order['billing_street_address'], 'suburb' => $order['billing_suburb'], 'city' => $order['billing_city'], 'postcode' => $order['billing_postcode'], 'state' => $order['billing_state'], 'country' => $order['billing_country'], 'format_id' => $order['billing_address_format_id']); $index = 0; $orders_products_query = tep_db_query("select orders_products_id, products_id, products_name, products_model, products_price, products_tax, products_quantity, final_price from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int)$order_id . "'"); while ($orders_products = tep_db_fetch_array($orders_products_query)) { $this->products[$index] = array('qty' => $orders_products['products_quantity'], 'id' => $orders_products['products_id'], 'name' => $orders_products['products_name'], 'model' => $orders_products['products_model'], 'tax' => $orders_products['products_tax'], 'price' => $orders_products['products_price'], 'final_price' => $orders_products['final_price']); $subindex = 0; $attributes_query = tep_db_query("select products_options, products_options_values, options_values_price, price_prefix from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_id = '" . (int)$order_id . "' and orders_products_id = '" . (int)$orders_products['orders_products_id'] . "'"); if (tep_db_num_rows($attributes_query)) { while ($attributes = tep_db_fetch_array($attributes_query)) { $this->products[$index]['attributes'][$subindex] = array('option' => $attributes['products_options'], 'value' => $attributes['products_options_values'], 'prefix' => $attributes['price_prefix'], 'price' => $attributes['options_values_price']); $subindex++; } } $this->info['tax_groups']["{$this->products[$index]['tax']}"] = '1'; $index++; } } function cart() { global $customer_id, $sendto, $billto, $cart, $languages_id, $currency, $currencies, $shipping, $payment; $this->content_type = $cart->get_content_type(); $customer_address_query = tep_db_query("select c.customers_firstname, c.customers_lastname, c.customers_telephone, c.customers_email_address, ab.entry_company, ab.entry_tva_intracom, ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name, co.countries_id, co.countries_name, co.countries_iso_code_2, co.countries_iso_code_3, co.address_format_id, ab.entry_state from " . TABLE_CUSTOMERS . " c, " . TABLE_ADDRESS_BOOK . " ab left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) left join " . TABLE_COUNTRIES . " co on (ab.entry_country_id = co.countries_id) where c.customers_id = '" . (int)$customer_id . "' and ab.customers_id = '" . (int)$customer_id . "' and c.customers_default_address_id = ab.address_book_id"); $customer_address = tep_db_fetch_array($customer_address_query); $shipping_address_query = tep_db_query("select ab.entry_firstname, ab.entry_lastname, ab.entry_company, ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name, ab.entry_country_id, c.countries_id, c.countries_name, c.countries_iso_code_2, c.countries_iso_code_3, c.address_format_id, ab.entry_state from " . TABLE_ADDRESS_BOOK . " ab left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) left join " . TABLE_COUNTRIES . " c on (ab.entry_country_id = c.countries_id) where ab.customers_id = '" . (int)$customer_id . "' and ab.address_book_id = '" . (int)$sendto . "'"); $shipping_address = tep_db_fetch_array($shipping_address_query); $billing_address_query = tep_db_query("select ab.entry_firstname, ab.entry_lastname, ab.entry_company, ab.entry_tva_intracom, ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name, ab.entry_country_id, c.countries_id, c.countries_name, c.countries_iso_code_2, c.countries_iso_code_3, c.address_format_id, ab.entry_state from " . TABLE_ADDRESS_BOOK . " ab left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) left join " . TABLE_COUNTRIES . " c on (ab.entry_country_id = c.countries_id) where ab.customers_id = '" . (int)$customer_id . "' and ab.address_book_id = '" . (int)$billto . "'"); $billing_address = tep_db_fetch_array($billing_address_query); $tax_address_query = tep_db_query("select ab.entry_country_id, ab.entry_zone_id from " . TABLE_ADDRESS_BOOK . " ab left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) where ab.customers_id = '" . (int)$customer_id . "' and ab.address_book_id = '" . (int)($this->content_type == 'virtual' ? $billto : $sendto) . "'"); $tax_address = tep_db_fetch_array($tax_address_query); $this->info = array('order_status' => DEFAULT_ORDERS_STATUS_ID, 'currency' => $currency, 'currency_value' => $currencies->currencies[$currency]['value'], 'payment_method' => $payment, 'cc_type' => (isset($GLOBALS['cc_type']) ? $GLOBALS['cc_type'] : ''), 'cc_owner' => (isset($GLOBALS['cc_owner']) ? $GLOBALS['cc_owner'] : ''), 'cc_number' => (isset($GLOBALS['cc_number']) ? $GLOBALS['cc_number'] : ''), 'cc_expires' => (isset($GLOBALS['cc_expires']) ? $GLOBALS['cc_expires'] : ''), 'shipping_method' => $shipping['title'], 'shipping_cost' => $shipping['cost'], 'subtotal' => 0, 'tax' => 0, 'tax_groups' => array(), //kgt - discount coupons 'coupon' => (isset($GLOBALS['coupon']) ? $GLOBALS['coupon'] : ''), 'applied_discount' => array(), //end kgt - discount coupons 'comments' => (isset($GLOBALS['comments']) ? $GLOBALS['comments'] : '')); if (isset($GLOBALS[$payment]) && is_object($GLOBALS[$payment])) { $this->info['payment_method'] = $GLOBALS[$payment]->title; if ( isset($GLOBALS[$payment]->order_status) && is_numeric($GLOBALS[$payment]->order_status) && ($GLOBALS[$payment]->order_status > 0) ) { $this->info['order_status'] = $GLOBALS[$payment]->order_status; } } $this->customer = array('firstname' => $customer_address['customers_firstname'], 'lastname' => $customer_address['customers_lastname'], 'company' => $customer_address['entry_company'], 'street_address' => $customer_address['entry_street_address'], 'suburb' => $customer_address['entry_suburb'], 'city' => $customer_address['entry_city'], 'postcode' => $customer_address['entry_postcode'], 'state' => ((tep_not_null($customer_address['entry_state'])) ? $customer_address['entry_state'] : $customer_address['zone_name']), 'zone_id' => $customer_address['entry_zone_id'], 'country' => array('id' => $customer_address['countries_id'], 'title' => $customer_address['countries_name'], 'iso_code_2' => $customer_address['countries_iso_code_2'], 'iso_code_3' => $customer_address['countries_iso_code_3']), 'format_id' => $customer_address['address_format_id'], 'telephone' => $customer_address['customers_telephone'], 'email_address' => $customer_address['customers_email_address']); $this->delivery = array('firstname' => $shipping_address['entry_firstname'], 'lastname' => $shipping_address['entry_lastname'], 'company' => $shipping_address['entry_company'], 'street_address' => $shipping_address['entry_street_address'], 'suburb' => $shipping_address['entry_suburb'], 'city' => $shipping_address['entry_city'], 'postcode' => $shipping_address['entry_postcode'], 'state' => ((tep_not_null($shipping_address['entry_state'])) ? $shipping_address['entry_state'] : $shipping_address['zone_name']), 'zone_id' => $shipping_address['entry_zone_id'], 'country' => array('id' => $shipping_address['countries_id'], 'title' => $shipping_address['countries_name'], 'iso_code_2' => $shipping_address['countries_iso_code_2'], 'iso_code_3' => $shipping_address['countries_iso_code_3']), 'country_id' => $shipping_address['entry_country_id'], 'format_id' => $shipping_address['address_format_id']); $this->billing = array('firstname' => $billing_address['entry_firstname'], 'lastname' => $billing_address['entry_lastname'], 'company' => $billing_address['entry_company'], //BOF for VAT INTRACOM 'tva_intracom' => $billing_address['entry_tva_intracom'], // EOF for TVA_INTRACOM 'street_address' => $billing_address['entry_street_address'], 'suburb' => $billing_address['entry_suburb'], 'city' => $billing_address['entry_city'], 'postcode' => $billing_address['entry_postcode'], 'state' => ((tep_not_null($billing_address['entry_state'])) ? $billing_address['entry_state'] : $billing_address['zone_name']), 'zone_id' => $billing_address['entry_zone_id'], 'country' => array('id' => $billing_address['countries_id'], 'title' => $billing_address['countries_name'], 'iso_code_2' => $billing_address['countries_iso_code_2'], 'iso_code_3' => $billing_address['countries_iso_code_3']), 'country_id' => $billing_address['entry_country_id'], 'format_id' => $billing_address['address_format_id']); $index = 0; $products = $cart->get_products(); for ($i=0, $n=sizeof($products); $i<$n; $i++) { $this->products[$index] = array('qty' => $products[$i]['quantity'], 'name' => $products[$i]['name'], 'model' => $products[$i]['model'], 'tax' => tep_get_tax_rate($products[$i]['tax_class_id'], $tax_address['entry_country_id'], $tax_address['entry_zone_id']), 'tax_description' => tep_get_tax_description($products[$i]['tax_class_id'], $tax_address['entry_country_id'], $tax_address['entry_zone_id']), 'price' => $products[$i]['price'], 'final_price' => $products[$i]['price'] + $cart->attributes_price($products[$i]['id']), 'weight' => $products[$i]['weight'], 'id' => $products[$i]['id']); if ($products[$i]['attributes']) { $subindex = 0; reset($products[$i]['attributes']); while (list($option, $value) = each($products[$i]['attributes'])) { $attributes_query = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . (int)$products[$i]['id'] . "' and pa.options_id = '" . (int)$option . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . (int)$value . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . (int)$languages_id . "' and poval.language_id = '" . (int)$languages_id . "'"); $attributes = tep_db_fetch_array($attributes_query); $this->products[$index]['attributes'][$subindex] = array('option' => $attributes['products_options_name'], 'value' => $attributes['products_options_values_name'], 'option_id' => $option, 'value_id' => $value, 'prefix' => $attributes['price_prefix'], 'price' => $attributes['options_values_price']); $subindex++; } } //kgt - discount coupon if( !empty( $this->info['coupon'] ) ) { if( !isset( $this_coupon ) ) { require_once( DIR_WS_CLASSES . 'discount_coupon.php' ); $this_coupon = new discount_coupon( $this->info['coupon'] ); } $applied_discount = $this_coupon->calculate_discount( $this->products[$index], $n ); if( isset( $this->info['applied_discount'][$this->products[$index]['tax_description']] ) ) { $this->info['applied_discount'][$this->products[$index]['tax_description']] += $applied_discount; } else { $this->info['applied_discount'][$this->products[$index]['tax_description']] = $applied_discount; } $this_actual_shown_price = null; if( MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DISPLAY_SUBTOTAL == 'false' ) { //we don't want to display the subtotal with the discount applied, so apply the discount then set the applied_discount variable to zero so that it's not added into the order subtotal, but is still used to correctly calculate tax $this_actual_shown_price = ( tep_add_tax( $this->products[$index]['final_price'], $this->products[$index]['tax'] ) * $this->products[$index]['qty'] ) - $applied_discount; $applied_discount = 0; } } $shown_price = ( tep_add_tax( $this->products[$index]['final_price'], $this->products[$index]['tax'] ) * $this->products[$index]['qty'] ) - $applied_discount; $this->info['subtotal'] += $shown_price; //if we need to display the subtotal without the discount applied, then add the shown price to the subtotal, then change shown price to the price with the applied discount in order to properly calculate taxes if( isset( $this_actual_shown_price ) ) $shown_price = $this_actual_shown_price; //end kgt - discount coupon $products_tax = $this->products[$index]['tax']; $products_tax_description = $this->products[$index]['tax_description']; if (DISPLAY_PRICE_WITH_TAX == 'true') { $this->info['tax'] += $shown_price - ($shown_price / (($products_tax < 10) ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax))); if (isset($this->info['tax_groups']["$products_tax_description"])) { $this->info['tax_groups']["$products_tax_description"] += $shown_price - ($shown_price / (($products_tax < 10) ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax))); } else { $this->info['tax_groups']["$products_tax_description"] = $shown_price - ($shown_price / (($products_tax < 10) ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax))); } } else { $this->info['tax'] += ($products_tax / 100) * $shown_price; if (isset($this->info['tax_groups']["$products_tax_description"])) { $this->info['tax_groups']["$products_tax_description"] += ($products_tax / 100) * $shown_price; } else { $this->info['tax_groups']["$products_tax_description"] = ($products_tax / 100) * $shown_price; } } $index++; } if (DISPLAY_PRICE_WITH_TAX == 'true') { $this->info['total'] = $this->info['subtotal'] + $this->info['shipping_cost']; } else { $this->info['total'] = $this->info['subtotal'] + $this->info['tax'] + $this->info['shipping_cost']; } //kgt - discount coupon if( !empty( $this->info['coupon'] ) && MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DISPLAY_SUBTOTAL == 'false' ) { foreach( $this->info['applied_discount'] as $discount ){ $this->info['total'] -= $discount; } } //end kgt - discount coupon } } ?> And the part from the VAT contribution I´m trying to implement looks like this. It´s supposed to go at the end of the order.php The code from the VAT contribution is marked with "// BOF for TVA_intracom_v3.4" $subindex++; } } // BOF for TVA_intracom_v3.4 //For those who want taxes automatically if the conditions below are OK, uncomment the lines below if ($this->billing['company'] != '' && $this->billing['tva_intracom'] != '' && $this->billing['country']['id'] != STORE_COUNTRY && $this->delivery['country']['id'] != STORE_COUNTRY) { $shown_price = $this->products[$index]['final_price'] * $this->products[$index]['qty']; $this->info['subtotal'] += $shown_price; } else { // EOF for TVA_intracom_v3.4 $shown_price = tep_add_tax($this->products[$index]['final_price'], $this->products[$index]['tax']) * $this->products[$index]['qty']; $this->info['subtotal'] += $shown_price; // BOF for TVA_intracom_v3.4 //For those who want taxes automatically if the conditions below are OK, uncomment the line below } // EOF for TVA_intracom_v3.4 // BOF for TVA_intracom_v3.4 //For those who want taxes automatically if the conditions below are OK, uncomment the lines below if ($this->billing['company'] != '' && $this->billing['tva_intracom'] != '' && $this->billing['country']['id'] != STORE_COUNTRY && $this->delivery['country']['id'] != STORE_COUNTRY) { $products_tax = 0; $products_tax_description = NO_TAX; } else { // EOF for TVA_intracom_v3.4 $products_tax = $this->products[$index]['tax']; $products_tax_description = $this->products[$index]['tax_description']; // BOF for TVA_intracom_v3.4 //For those who want taxes automatically if the conditions below are OK, uncomment the line below } // EOF for TVA_intracom_v3.4 if (DISPLAY_PRICE_WITH_TAX == 'true') { $this->info['tax'] += $shown_price - ($shown_price / (($products_tax < 10) ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax)
  13. The contribution I?m reffering to is: http://www.oscommerce.com/community/contributions,4085/ I?m trying to get rid of the price in featured products on my index page if the price is 0.00. I can get it to work simply by using the following code but then special prices doesn?t show up. I would like to get the special prices to work aswell. Can anybody help me out with how I can get both the special prices and "If price = 0.00 dont display price" if ($featured_products['products_price'] < 0.01 ) { $info_box_contents[$row][$col] = array('align' => 'center', 'params' => 'class="smallText" width="33%" valign="top"', 'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $featured_products['products_image'], $featured_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products['products_id']) . '">' . $featured_products['products_name'] . '</a>'); } else { $info_box_contents[$row][$col] = array('align' => 'center', 'params' => 'class="smallText" width="33%" valign="top"', 'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $featured_products['products_image'], $featured_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products['products_id']) . '">' . $featured_products['products_name'] . '</a><br>' . $currencies->display_price($featured_products['products_price'], tep_get_tax_rate($featured_products['products_tax_class_id']))); } The file I?m trying to modify is catalog/includes/modules/featured.php The code in featured.php looks like this: <?php /* osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2002 osCommerce Released under the GNU General Public License Featured Products V1.1 Displays a list of featured products, selected from admin For use as an Infobox instead of the "New Products" Infobox */ ?> <!-- featured_products //--> <?php if(FEATURED_PRODUCTS_DISPLAY == 'true') { $featured_products_category_id = $new_products_category_id; $cat_name_query = tep_db_query("select categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '" . $featured_products_category_id . "' limit 1"); $cat_name_fetch = tep_db_fetch_array($cat_name_query); $cat_name = $cat_name_fetch['categories_name']; $info_box_contents = array(); if ( (!isset($featured_products_category_id)) || ($featured_products_category_id == '0') ) { $info_box_contents[] = array('align' => 'left', 'text' => '<a class="headerNavigation" href="' . tep_href_link(FILENAME_FEATURED_PRODUCTS) . '">' . TABLE_HEADING_FEATURED_PRODUCTS . '</a>'); list($usec, $sec) = explode(' ', microtime()); srand( (float) $sec + ((float) $usec * 100000) ); $mtm= rand(); $featured_products_query = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, s.status as specstat, s.specials_new_products_price, p.products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id left join " . TABLE_FEATURED . " f on p.products_id = f.products_id where p.products_status = '1' and f.status = '1' order by rand($mtm) DESC limit " . MAX_DISPLAY_FEATURED_PRODUCTS); } else { $info_box_contents[] = array('align' => 'left', 'text' => sprintf(TABLE_HEADING_FEATURED_PRODUCTS_CATEGORY, $cat_name)); $subcategories_array = array(); tep_get_subcategories($subcategories_array, $featured_products_category_id); $featured_products_category_id_list = tep_array_values_to_string($subcategories_array); if ($featured_products_category_id_list == '') { $featured_products_category_id_list .= $featured_products_category_id; } else { $featured_products_category_id_list .= ',' . $featured_products_category_id; } $featured_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, s.status as specstat, s.specials_new_products_price, p.products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c using(products_id) left join " . TABLE_CATEGORIES . " c using(categories_id) left join " . TABLE_FEATURED . " f on p.products_id = f.products_id left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where c.parent_id = '" . $featured_products_category_id . "' and p.products_status = '1' and f.status = '1' order by rand() DESC limit " . MAX_DISPLAY_FEATURED_PRODUCTS); } $row = 0; $col = 0; $num = 0; while ($featured_products = tep_db_fetch_array($featured_products_query)) { $num ++; if ($num == 1) { new contentBoxHeading($info_box_contents); } $featured_products['products_name'] = tep_get_products_name($featured_products['products_id']); if($featured_products['specstat']) { $info_box_contents[$row][$col] = array('align' => 'center', 'params' => 'class="smallText" width="33%" valign="top"', 'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $featured_products['products_image'], $featured_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products['products_id']) . '">' . $featured_products['products_name'] . '</a><br><s>' . $currencies->display_price($featured_products['products_price'], tep_get_tax_rate($featured_products['products_tax_class_id'])) . '</s><br><span class="productSpecialPrice">' . $currencies->display_price($featured_products['specials_new_products_price'], tep_get_tax_rate($featured_products['products_tax_class_id'])) . '</span>'); } else { $info_box_contents[$row][$col] = array('align' => 'center', 'params' => 'class="smallText" width="33%" valign="top"', 'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $featured_products['products_image'], $featured_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products['products_id']) . '">' . $featured_products['products_name'] . '</a><br>' . $currencies->display_price($featured_products['products_price'], tep_get_tax_rate($featured_products['products_tax_class_id']))); } $col ++; if ($col > 2) { $col = 0; $row ++; } } if($num) { new contentBox($info_box_contents); } } else // If it's disabled, then include the original New Products box { // include (DIR_WS_MODULES . FILENAME_NEW_PRODUCTS); // disable for dont show if desactive the feature module } ?> <!-- featured_products_eof //--> Any help would be appreciated.
  14. figurez

    [Contribution] Extra Fields

    Hi I can?t get my tags right. I?m trying to insert the code for the extra fields in my product_info.php. I can get it to display but I want the extra fields to be displayed like this: Product Name------------------------------Product Price Extra fields---------------------------------Product Image Product Description--------------------------------------- I can?t get the extra fields to display left of my product picture. Can anybody help me with the code. I have tried to make new <td>?s but I can?t seem to get it right. My clean product info looks like this: <?php /* $Id: product_info.php,v 1.97 2003/07/01 14:34:54 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ require('includes/application_top.php'); require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCT_INFO); $product_check_query = tep_db_query("select count(*) as total 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 . "'"); $product_check = tep_db_fetch_array($product_check_query); ?> <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> <html <?php echo HTML_PARAMS; ?>> <head> <?php // HTC BEGIN if ( file_exists(DIR_WS_INCLUDES . 'header_tags.php') ) { require(DIR_WS_INCLUDES . 'header_tags.php'); } else { ?> <title><?php echo TITLE; ?></title> <?php } // HTC END ?> <base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>"> <link rel="stylesheet" type="text/css" href="stylesheet.css"> <script language="javascript"><!-- function popupWindow(url) { window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,res izable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,le ft=150') } //--></script> </head> <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0"> <!-- header //--> <?php require(DIR_WS_INCLUDES . 'header.php'); ?> <!-- header_eof //--> <!-- body //--> <table border="0" width="100%" cellspacing="3" cellpadding="3"> <tr> <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2"> <!-- left_navigation //--> <?php require(DIR_WS_INCLUDES . 'column_left.php'); ?> <!-- left_navigation_eof //--> </table></td> <!-- body_text //--> <td width="100%" valign="top"><?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product')); ?><table border="0" width="100%" cellspacing="0" cellpadding="0"> <?php if ($product_check['total'] < 1) { ?> <tr> <td><?php new infoBox(array(array('text' => TEXT_PRODUCT_NOT_FOUND))); ?></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox"> <tr class="infoBoxContents"> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td align="right"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> </tr> </table></td> </tr> </table></td> </tr> <?php } else { $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 . "'"); $product_info = tep_db_fetch_array($product_info_query); tep_db_query("update " . TABLE_PRODUCTS_DESCRIPTION . " set products_viewed = products_viewed+1 where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and language_id = '" . (int)$languages_id . "'"); if ($new_price = tep_get_products_special_price($product_info['products_id'])) { $products_price = '<s>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>'; } else { $products_price = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])); } if (tep_not_null($product_info['products_model'])) { $products_name = $product_info['products_name'] . '<br><span class="smallText">[' . $product_info['products_model'] . ']</span>'; } else { $products_name = $product_info['products_name']; } ?> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td valign="top"><h1><?php echo $products_name; ?></h1></td> <td align="right" valign="top"><h1><?php echo $products_price; ?></h1></td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td class="main"> <?php if (tep_not_null($product_info['products_image'])) { ?> <table border="0" cellspacing="0" cellpadding="2" align="right"> <tr> <td align="center" class="smallText"> <script language="javascript"><!-- document.write('<?php echo '<a href="java script:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '\\\')">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>'); //--></script> <noscript> <?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?> </noscript> </td> </tr> </table> <?php } ?> <p><?php echo stripslashes($product_info['products_description']); ?></p> <?php $products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "'"); $products_attributes = tep_db_fetch_array($products_attributes_query); if ($products_attributes['total'] > 0) { ?> <table border="0" cellspacing="0" cellpadding="2"> <tr> <td class="main" colspan="2"><?php echo TEXT_PRODUCT_OPTIONS; ?></td> </tr> <?php $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' order by popt.products_options_name"); while ($products_options_name = tep_db_fetch_array($products_options_name_query)) { $products_options_array = array(); $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'"); while ($products_options = tep_db_fetch_array($products_options_query)) { $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']); if ($products_options['options_values_price'] != '0') { $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') '; } } if (isset($cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']])) { $selected_attribute = $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']]; } else { $selected_attribute = false; } ?> <tr> <td class="main"><?php echo $products_options_name['products_options_name'] . ':'; ?></td> <td class="main"><?php echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute); ?></td> </tr> <?php } ?> </table> <?php } ?> </td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <?php $reviews_query = tep_db_query("select count(*) as count from " . TABLE_REVIEWS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'"); $reviews = tep_db_fetch_array($reviews_query); if ($reviews['count'] > 0) { ?> <tr> <td class="main"><?php echo TEXT_CURRENT_REVIEWS . ' ' . $reviews['count']; ?></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <?php } if (tep_not_null($product_info['products_url'])) { ?> <tr> <td class="main"><?php echo sprintf(TEXT_MORE_INFORMATION, tep_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($product_info['products_url']), 'NONSSL', true, false)); ?></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <?php } if ($product_info['products_date_available'] > date('Y-m-d H:i:s')) { ?> <tr> <td align="center" class="smallText"><?php echo sprintf(TEXT_DATE_AVAILABLE, tep_date_long($product_info['products_date_available'])); ?></td> </tr> <?php } else { ?> <tr> <td align="center" class="smallText"><?php echo sprintf(TEXT_DATE_ADDED, tep_date_long($product_info['products_date_added'])); ?></td> </tr> <?php } ?> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox"> <tr class="infoBoxContents"> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS, tep_get_all_get_params()) . '">' . tep_image_button('button_reviews.gif', IMAGE_BUTTON_REVIEWS) . '</a>'; ?></td> <td class="main" align="right"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?></td> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> </tr> </table></td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td> <?php if ((USE_CACHE == 'true') && empty($SID)) { echo tep_cache_also_purchased(3600); } else { include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS); } } ?> </td> </tr> </table></form></td> <!-- body_text_eof //--> <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2"> <!-- right_navigation //--> <?php require(DIR_WS_INCLUDES . 'column_right.php'); ?> <!-- right_navigation_eof //--> </table></td> </tr> </table> <!-- body_eof //--> <!-- footer //--> <?php require(DIR_WS_INCLUDES . 'footer.php'); ?> <!-- footer_eof //--> <br> </body> </html> <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?> And the part I?m trying to insert is: <?php // START: Extra Fields Contribution v2.0b - mintpeel display fix $extra_fields_query = tep_db_query(" SELECT pef.products_extra_fields_status as status, pef.products_extra_fields_name as name, ptf.products_extra_fields_value as value FROM ". TABLE_PRODUCTS_EXTRA_FIELDS ." pef LEFT JOIN ". TABLE_PRODUCTS_TO_PRODUCTS_EXTRA_FIELDS ." ptf ON ptf.products_extra_fields_id=pef.products_extra_fields_id WHERE ptf.products_id=". (int) $products_id ." and ptf.products_extra_fields_value<>'' and (pef.languages_id='0' or pef.languages_id='".$languages_id."') ORDER BY products_extra_fields_order"); while ($extra_fields = tep_db_fetch_array($extra_fields_query)) { if (! $extra_fields['status']) // show only enabled extra field continue; echo '<tr> <td> <table border="0" width="50%" cellspacing="0" cellpadding="2px"><tr> <td class="main" align="left" vallign="middle"><b><font size="1" color="#666666">'.$extra_fields['name'].': </b></font>'; echo '<font size="1" color="#666666">' .$extra_fields['value'].'<BR></font> </tr> </table> </td> </tr>'; } // END: Extra Fields Contribution - mintpeel display fix ?> Hope anybody can help me with this. This shouldn?t be very hard but I can?t get it to display the way I want it. Oh, I have been trying to find a solution in this tread but still can?t get it to work. Thanks in advance /Per
  15. figurez

    Visual Verify Code (VVC)

    Thanks for your reply. I begin to implement the human confirmation contrib. to my guestbook but I couldn?t work it out. Do you mind sharing how you did it? Thanks again /Per
  16. figurez

    Visual Verify Code (VVC)

    I?m trying to get the VVC to work on my guestbook_sign.php aswell but can?t get it to work. How did you implement the code? thanks in advance Per
  17. figurez

    Another coppermine issue

    I?m also looking for a fix to this. Anybody knows how to do this? This is my displayimage.php (coppermine file) if somebody is familiar with the coding. <?php require('includes/application_top.php'); define('IN_COPPERMINE', true); define('DISPLAYIMAGE_PHP', true); define('INDEX_PHP', true); //define('SMILIES_PHP', true); require('include/init.inc.php'); if ($CONFIG['enable_smilies']) include("include/smilies.inc.php"); ?> <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> <html <?php echo HTML_PARAMS; ?>> <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> <title><?php echo TITLE; ?></title> <base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>"> <link rel="stylesheet" type="text/css" href="stylesheet.css"> </head> <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0"> <!-- header //--> <?php require(DIR_WS_INCLUDES . 'header.php'); ?> <!-- header_eof //--> <!-- body //--> <table border="0" width="100%" cellspacing="3" cellpadding="3"> <tr> <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2"> <!-- left_navigation //--> <?php require(DIR_WS_INCLUDES . 'column_left.php'); ?> <!-- left_navigation_eof //--> </table></td> <!-- body_text //--> <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td> <?php // ------------------------------------------------------------------------- // // Coppermine Photo Gallery 1.3.1 // // ------------------------------------------------------------------------- // // Copyright (C) 2002-2004 Gregory DEMAR // // http://www.chezgreg.net/coppermine/ // // ------------------------------------------------------------------------- // // Updated by the Coppermine Dev Team // // (http://coppermine.sf.net/team/) // // see /docs/credits.html for details // // ------------------------------------------------------------------------- // // This program is free software; you can redistribute it and/or modify // // it under the terms of the GNU General Public License as published by // // the Free Software Foundation; either version 2 of the License, or // // (at your option) any later version. // // ------------------------------------------------------------------------- // // CVS version: $Id: displayimage.php,v 1.8 2004/07/09 06:57:34 gaugau Exp $ // ------------------------------------------------------------------------- // $breadcrumb = ''; $breadcrumb_text = ''; $cat_data = array(); if($CONFIG['read_exif_data'] ){ include("include/exif_php.inc.php"); } if($CONFIG['read_iptc_data'] ){ include("include/iptc.inc.php"); } /** * Local functions definition */ function html_picture_menu($id) { global $lang_display_image_php; return <<<EOT <a href="#" onClick="return MM_openBrWindow('picEditor.php?id=$id','Crop_Picture','scrollbars=yes,toolbar=no,status=yes,resizable=yes')" class="admin_menu" >{$lang_display_image_php['crop_pic']}</a> <a href="editOnePic.php?id=$id&what=picture" class="admin_menu">{$lang_display_image_php['edit_pic']}</a> <a href="delete.php?id=$id&what=picture" class="admin_menu" onclick="return confirm('{$lang_display_image_php['confirm_del']}'); return false; ">{$lang_display_image_php['del_pic']}</a> EOT; } // Prints the image-navigation menu function html_img_nav_menu() { global $CONFIG, $HTTP_SERVER_VARS, $HTTP_GET_VARS, $CURRENT_PIC_DATA, $PHP_SELF; global $album, $cat, $pos, $pic_count, $lang_img_nav_bar, $lang_text_dir, $template_img_navbar; $cat_link = is_numeric($album) ? '' : '&cat=' . $cat; $human_pos = $pos + 1; $page = ceil(($pos + 1) / ($CONFIG['thumbrows'] * $CONFIG['thumbcols'])); $pid = $CURRENT_PIC_DATA['pid']; if ($pos > 0) { $prev = $pos - 1; $prev_tgt = "$PHP_SELF?album=$album$cat_link&pos=$prev"; $prev_title = $lang_img_nav_bar['prev_title']; } else { $prev_tgt = "javascript:;"; $prev_title = ""; } if ($pos < ($pic_count -1)) { $next = $pos + 1; $next_tgt = "$PHP_SELF?album=$album$cat_link&pos=$next"; $next_title = $lang_img_nav_bar['next_title']; } else { $next_tgt = "javascript:;"; $next_title = ""; } if (USER_CAN_SEND_ECARDS) { $ecard_tgt = "ecard.php?album=$album$cat_link&pid=$pid&pos=$pos"; $ecard_title = $lang_img_nav_bar['ecard_title']; } else { $ecard_tgt = "javascript:alert('" . addslashes($lang_img_nav_bar['ecard_disabled_msg']) . "');"; $ecard_title = $lang_img_nav_bar['ecard_disabled']; } $thumb_tgt = "thumbnails.php?album=$album$cat_link&page=$page"; $slideshow_tgt = "$PHP_SELF?album=$album$cat_link&pid=$pid&slideshow=".$CONFIG['slideshow_interval']; $pic_pos = sprintf($lang_img_nav_bar['pic_pos'], $human_pos, $pic_count); $params = array('{THUMB_TGT}' => $thumb_tgt, '{THUMB_TITLE}' => $lang_img_nav_bar['thumb_title'], '{PIC_INFO_TITLE}' => $lang_img_nav_bar['pic_info_title'], '{SLIDESHOW_TGT}' => $slideshow_tgt, '{SLIDESHOW_TITLE}' => $lang_img_nav_bar['slideshow_title'], '{PIC_POS}' => $pic_pos, '{ECARD_TGT}' => $ecard_tgt, '{ECARD_TITLE}' => $ecard_title, '{PREV_TGT}' => $prev_tgt, '{PREV_TITLE}' => $prev_title, '{NEXT_TGT}' => $next_tgt, '{NEXT_TITLE}' => $next_title, '{PREV_IMAGE}' => ($lang_text_dir=='LTR') ? 'prev' : 'next', '{NEXT_IMAGE}' => ($lang_text_dir=='LTR') ? 'next' : 'prev', ); return template_eval($template_img_navbar, $params); } // Displays a picture function html_picture() { global $CONFIG, $CURRENT_PIC_DATA, $CURRENT_ALBUM_DATA, $USER, $HTTP_COOKIE_VARS; global $album, $comment_date_fmt, $template_display_picture; global $lang_display_image_php, $lang_picinfo; $pid = $CURRENT_PIC_DATA['pid']; if (!isset($USER['liv']) || !is_array($USER['liv'])) { $USER['liv'] = array(); } // Add 1 to hit counter if ($album != "lasthits" && !in_array($pid, $USER['liv']) && isset($HTTP_COOKIE_VARS[$CONFIG['cookie_name'] . '_data'])) { add_hit($pid); if (count($USER['liv']) > 4) array_shift($USER['liv']); array_push($USER['liv'], $pid); } if($CONFIG['thumb_use']=='ht' && $CURRENT_PIC_DATA['pheight'] > $CONFIG['picture_width'] ){ // The wierd comparision is because only picture_width is stored $condition = true; }elseif($CONFIG['thumb_use']=='wd' && $CURRENT_PIC_DATA['pwidth'] > $CONFIG['picture_width']){ $condition = true; }elseif($CONFIG['thumb_use']=='any' && max($CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight']) > $CONFIG['picture_width']){ $condition = true; }else{ $condition = false; } if ($CONFIG['make_intermediate'] && $condition ) { $picture_url = get_pic_url($CURRENT_PIC_DATA, 'normal'); } else { $picture_url = get_pic_url($CURRENT_PIC_DATA, 'fullsize'); } $pic_thumb_url = get_pic_url($CURRENT_PIC_DATA,'thumb'); $picture_menu = ((USER_ADMIN_MODE && $CURRENT_ALBUM_DATA['category'] == FIRST_USER_CAT + USER_ID) || GALLERY_ADMIN_MODE) ? html_picture_menu($pid) : ''; $image_size = compute_img_size($CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight'], $CONFIG['picture_width']); $pic_title = ''; $mime_content = get_type($CURRENT_PIC_DATA['filename']); if ($CURRENT_PIC_DATA['title'] != '') { $pic_title .= $CURRENT_PIC_DATA['title'] . "\n"; } if ($CURRENT_PIC_DATA['caption'] != '') { $pic_title .= $CURRENT_PIC_DATA['caption'] . "\n"; } if ($CURRENT_PIC_DATA['keywords'] != '') { $pic_title .= $lang_picinfo['Keywords'] . ": " . $CURRENT_PIC_DATA['keywords']; } if ($CURRENT_PIC_DATA['pwidth']==0 || $CURRENT_PIC_DATA['pheight']==0) { $image_size['geom']=''; $image_size['whole'] = ''; } elseif ($mime_content['content']=='movie' || $mime_content['content']=='audio') { $ctrl_offset['mov']=15; $ctrl_offset['wmv']=45; $ctrl_offset['swf']=0; $ctrl_offset['rm']=0; $ctrl_offset_default=45; $ctrl_height = (isset($ctrl_offset[$mime_content['extension']]))?($ctrl_offset[$mime_content['extension']]):$ctrl_offset_default; $image_size['whole']='width="'.$CURRENT_PIC_DATA['pwidth'].'" height="'.($CURRENT_PIC_DATA['pheight']+$ctrl_height).'"'; } if ($mime_content['content']=='image') { if (isset($image_size['reduced'])) { $winsizeX = $CURRENT_PIC_DATA['pwidth'] + 16; $winsizeY = $CURRENT_PIC_DATA['pheight'] + 16; $pic_html = "<a href=\"javascript:;\" onClick=\"MM_openBrWindow('displayimage.php?pid=$pid&fullsize=1','" . uniqid(rand()) . "','scrollbars=yes,toolbar=yes,status=yes,resizable=yes,width=$winsizeX,height=$winsizeY')\">"; $pic_title = $lang_display_image_php['view_fs'] . "\n==============\n" . $pic_title; $pic_html .= "<img src=\"" . $picture_url . "\" class=\"image\" border=\"0\" alt=\"{$lang_display_image_php['view_fs']}\" /><br />"; $pic_html .= "</a>\n"; } else { $pic_html = "<img src=\"" . $picture_url . "\" {$image_size['geom']} class=\"image\" border=\"0\" /><br />\n"; } } elseif ($mime_content['content']=='document') { $pic_html = "<a href=\"{$picture_url}\" target=\"_blank\" class=\"document_link\"><img src=\"".$pic_thumb_url."\" border=\"0\" class=\"image\" /></a>\n<br />"; } else { $pic_html = "<object {$image_size['whole']}><param name=\"autostart\" value=\"true\"><param name=\"src\" value=\"". $picture_url . "\"><embed {$image_size['whole']} src=\"". $picture_url . "\" autostart=\"true\"></embed></object><br />\n"; } if (!$CURRENT_PIC_DATA['title'] && !$CURRENT_PIC_DATA['caption']) { template_extract_block($template_display_picture, 'img_desc'); } else { if (!$CURRENT_PIC_DATA['title']) { template_extract_block($template_display_picture, 'title'); } if (!$CURRENT_PIC_DATA['caption']) { template_extract_block($template_display_picture, 'caption'); } } $params = array('{CELL_HEIGHT}' => '100', '{IMAGE}' => $pic_html, '{ADMIN_MENU}' => $picture_menu, '{TITLE}' => $CURRENT_PIC_DATA['title'], '{CAPTION}' => bb_decode($CURRENT_PIC_DATA['caption']), ); return template_eval($template_display_picture, $params); } function html_rating_box() { global $CONFIG, $CURRENT_PIC_DATA, $CURRENT_ALBUM_DATA; global $template_image_rating, $lang_rate_pic; if (!(USER_CAN_RATE_PICTURES && $CURRENT_ALBUM_DATA['votes'] == 'YES')) return ''; $votes = $CURRENT_PIC_DATA['votes'] ? sprintf($lang_rate_pic['rating'], round($CURRENT_PIC_DATA['pic_rating'] / 2000, 1), $CURRENT_PIC_DATA['votes']) : $lang_rate_pic['no_votes']; $pid = $CURRENT_PIC_DATA['pid']; $params = array('{TITLE}' => $lang_rate_pic['rate_this_pic'], '{VOTES}' => $votes, '{RATE0}' => "ratepic.php?pic=$pid&rate=0", '{RATE1}' => "ratepic.php?pic=$pid&rate=1", '{RATE2}' => "ratepic.php?pic=$pid&rate=2", '{RATE3}' => "ratepic.php?pic=$pid&rate=3", '{RATE4}' => "ratepic.php?pic=$pid&rate=4", '{RATE5}' => "ratepic.php?pic=$pid&rate=5", '{RUBBISH}' => $lang_rate_pic['rubbish'], '{POOR}' => $lang_rate_pic['poor'], '{FAIR}' => $lang_rate_pic['fair'], '{GOOD}' => $lang_rate_pic['good'], '{EXCELLENT}' => $lang_rate_pic['excellent'], '{GREAT}' => $lang_rate_pic['great'], ); return template_eval($template_image_rating, $params); } // Display picture information function html_picinfo() { global $CONFIG, $CURRENT_PIC_DATA, $CURRENT_ALBUM_DATA, $THEME_DIR, $FAVPICS; global $album, $lang_picinfo, $lang_display_image_php, $lang_byte_units; if ($CURRENT_PIC_DATA['owner_id'] && $CURRENT_PIC_DATA['owner_name']) { $owner_link = '<a href ="profile.php?uid=' . $CURRENT_PIC_DATA['owner_id'] . '">' . $CURRENT_PIC_DATA['owner_name'] . '</a> '; } else { $owner_link = ''; } if (GALLERY_ADMIN_MODE && $CURRENT_PIC_DATA['pic_raw_ip']) { if ($CURRENT_PIC_DATA['pic_hdr_ip']) { $ipinfo = ' (' . $CURRENT_PIC_DATA['pic_hdr_ip'] . '[' . $CURRENT_PIC_DATA['pic_raw_ip'] . ']) / '; } else { $ipinfo = ' (' . $CURRENT_PIC_DATA['pic_raw_ip'] . ') / '; } } else { if ($owner_link) { $ipinfo = '/ '; } else { $ipinfo = ''; } } $info[$lang_picinfo['Filename']] = htmlspecialchars($CURRENT_PIC_DATA['filename']); $info[$lang_picinfo['Album name']] = '<span class="alblink">' . $owner_link . $ipinfo . '<a href="thumbnails.php?album=' . $CURRENT_PIC_DATA['aid'] . '">' . $CURRENT_ALBUM_DATA['title'] . '</a></span>'; if ($CURRENT_PIC_DATA['votes'] > 0) { if (defined('THEME_HAS_RATING_GRAPHICS')) { $prefix = $THEME_DIR; } else { $prefix = ''; } $info[sprintf($lang_picinfo['Rating'], $CURRENT_PIC_DATA['votes'])] = '<img src="' . $prefix . 'images/rating' . round($CURRENT_PIC_DATA['pic_rating'] / 2000) . '.gif" align="absmiddle"/>'; } if ($CURRENT_PIC_DATA['keywords'] != "") { $info[$lang_picinfo['Keywords']] = '<span class="alblink">' . preg_replace("/(\S+)/", "<a href=\"thumbnails.php?album=search&search=\\1\">\\1</a>" , $CURRENT_PIC_DATA['keywords']) . '</span>'; } for ($i = 1; $i <= 4; $i++) { if ($CONFIG['user_field' . $i . '_name']) { if ($CURRENT_PIC_DATA['user' . $i] != "") { $info[$CONFIG['user_field' . $i . '_name']] = make_clickable($CURRENT_PIC_DATA['user' . $i]); } } } $info[$lang_picinfo['File Size']] = ($CURRENT_PIC_DATA['filesize'] > 10240 ? ($CURRENT_PIC_DATA['filesize'] >> 10) . '?' . $lang_byte_units[1] : $CURRENT_PIC_DATA['filesize'] . '?' . $lang_byte_units[0]); $info[$lang_picinfo['File Size']] = '<span dir="LTR">' . $info[$lang_picinfo['File Size']] . '</span>'; $info[$lang_picinfo['Dimensions']] = sprintf($lang_display_image_php['size'], $CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight']); $info[$lang_picinfo['Displayed']] = sprintf($lang_display_image_php['views'], $CURRENT_PIC_DATA['hits']); $path_to_pic = $CONFIG['fullpath'] . $CURRENT_PIC_DATA['filepath'] . $CURRENT_PIC_DATA['filename']; if ($CONFIG['read_exif_data']) $exif = exif_parse_file($path_to_pic); if (isset($exif) && is_array($exif)) { if (isset($exif['Camera'])) $info[$lang_picinfo['Camera']] = $exif['Camera']; if (isset($exif['DateTaken'])) $info[$lang_picinfo['Date taken']] = $exif['DateTaken']; if (isset($exif['Aperture'])) $info[$lang_picinfo['Aperture']] = $exif['Aperture']; if (isset($exif['ISO'])) $info[$lang_picinfo['ISO']] = $exif['ISO']; if (isset($exif['ExposureTime'])) $info[$lang_picinfo['Exposure time']] = $exif['ExposureTime']; if (isset($exif['FocalLength'])) $info[$lang_picinfo['Focal length']] = $exif['FocalLength']; if (@strlen(trim($exif['Comment'])) > 0 ) { $info[$lang_picinfo['Comment']] = trim($exif['Comment']); } } if ($CONFIG['read_iptc_data']) $iptc = get_IPTC($path_to_pic); if (isset($iptc) && is_array($iptc)) { if (isset($iptc['Title'])) $info[$lang_picinfo['iptcTitle']] = trim($iptc['Title']); if (isset($iptc['Copyright'])) $info[$lang_picinfo['iptcCopyright']] = trim($iptc['Copyright']); if (isset($iptc['Keywords'])) $info[$lang_picinfo['iptcKeywords']] = trim(implode(" ",$iptc['Keywords'])); if (isset($iptc['Category'])) $info[$lang_picinfo['iptcCategory']] = trim($iptc['Category']); if (isset($iptc['SubCategories'])) $info[$lang_picinfo['iptcSubCategories']] = trim(implode(" ",$iptc['SubCategories'])); } // Create the absolute URL for display in info $info['URL'] = '<a href="' . $CONFIG["ecards_more_pic_target"] . (substr($CONFIG["ecards_more_pic_target"], -1) == '/' ? '' : '/') .basename($_SERVER['PHP_SELF']) . "?pos=-$CURRENT_PIC_DATA[pid]" . '" >' . $CONFIG["ecards_more_pic_target"] . (substr($CONFIG["ecards_more_pic_target"], -1) == '/' ? '' : '/') . basename($_SERVER['PHP_SELF']) . "?pos=-$CURRENT_PIC_DATA[pid]" . '</a>'; // with subdomains the variable is $_SERVER["SERVER_NAME"] does not return the right value instead of using a new config variable I reused $CONFIG["ecards_more_pic_target"] no trailing slash in the configure // Create the add to fav link if (!in_array($CURRENT_PIC_DATA['pid'], $FAVPICS)) { $info[$lang_picinfo['addFavPhrase']] = "<a href=addfav.php?pid=" . $CURRENT_PIC_DATA['pid'] . " >" . $lang_picinfo['addFav'] . '</a>'; } else { $info[$lang_picinfo['addFavPhrase']] = "<a href=addfav.php?pid=" . $CURRENT_PIC_DATA['pid'] . " >" . $lang_picinfo['remFav'] . '</a>'; } return theme_html_picinfo($info); } // Displays comments for a specific picture function html_comments($pid) { global $CONFIG, $USER, $CURRENT_ALBUM_DATA, $comment_date_fmt, $HTML_SUBST; global $template_image_comments, $template_add_your_comment, $lang_display_comments; $html = ''; if (!$CONFIG['enable_smilies']) { $tmpl_comment_edit_box = template_extract_block($template_image_comments, 'edit_box_no_smilies', '{EDIT}'); template_extract_block($template_image_comments, 'edit_box_smilies'); template_extract_block($template_add_your_comment, 'input_box_smilies'); } else { $tmpl_comment_edit_box = template_extract_block($template_image_comments, 'edit_box_smilies', '{EDIT}'); template_extract_block($template_image_comments, 'edit_box_no_smilies'); template_extract_block($template_add_your_comment, 'input_box_no_smilies'); } $tmpl_comments_buttons = template_extract_block($template_image_comments, 'buttons', '{BUTTONS}'); $tmpl_comments_ipinfo = template_extract_block($template_image_comments, 'ipinfo', '{IPINFO}'); $result = db_query("SELECT msg_id, msg_author, msg_body, UNIX_TIMESTAMP(msg_date) AS msg_date, author_id, author_md5_id, msg_raw_ip, msg_hdr_ip FROM {$CONFIG['TABLE_COMMENTS']} WHERE pid='$pid' ORDER BY msg_id ASC"); while ($row = mysql_fetch_array($result)) { $user_can_edit = (GALLERY_ADMIN_MODE) || (USER_ID && USER_ID == $row['author_id'] && USER_CAN_POST_COMMENTS) || (!USER_ID && USER_CAN_POST_COMMENTS && ($USER['ID'] == $row['author_md5_id'])); $comment_buttons = $user_can_edit ? $tmpl_comments_buttons : ''; $comment_edit_box = $user_can_edit ? $tmpl_comment_edit_box : ''; $comment_ipinfo = ($row['msg_raw_ip'] && GALLERY_ADMIN_MODE)?$tmpl_comments_ipinfo : ''; if ($CONFIG['enable_smilies']) { $comment_body = process_smilies(make_clickable($row['msg_body'])); $smilies = generate_smilies("f{$row['msg_id']}", 'msg_body'); } else { $comment_body = make_clickable($row['msg_body']); $smilies = ''; } $params = array('{EDIT}' => &$comment_edit_box, '{BUTTONS}' => &$comment_buttons, '{IPINFO}' => &$comment_ipinfo ); $template = template_eval($template_image_comments, $params); $params = array('{MSG_AUTHOR}' => $row['msg_author'], '{MSG_ID}' => $row['msg_id'], '{EDIT_TITLE}' => &$lang_display_comments['edit_title'], '{CONFIRM_DELETE}' => &$lang_display_comments['confirm_delete'], '{MSG_DATE}' => localised_date($row['msg_date'], $comment_date_fmt), '{MSG_BODY}' => &$comment_body, '{MSG_BODY_RAW}' => $row['msg_body'], '{OK}' => &$lang_display_comments['OK'], '{SMILIES}' => $smilies, '{HDR_IP}' => $row['msg_hdr_ip'], '{RAW_IP}' => $row['msg_raw_ip'], ); $html .= template_eval($template, $params); } if (USER_CAN_POST_COMMENTS && $CURRENT_ALBUM_DATA['comments'] == 'YES') { if (USER_ID) { $user_name_input = '<input type="hidden" name="msg_author" value="' . USER_NAME . '">'; template_extract_block($template_add_your_comment, 'user_name_input', $user_name_input); $user_name = ''; } else { $user_name = isset($USER['name']) ? '"' . strtr($USER['name'], $HTML_SUBST) . '"' : '"' . $lang_display_comments['your_name'] . '" onClick="javascript:this.value=\'\';"'; } $params = array('{ADD_YOUR_COMMENT}' => $lang_display_comments['add_your_comment'], // Modified Name and comment field '{NAME}' => $lang_display_comments['name'], '{COMMENT}' => $lang_display_comments['comment'], '{PIC_ID}' => $pid, '{USER_NAME}' => $user_name, '{MAX_COM_LENGTH}' => $CONFIG['max_com_size'], '{OK}' => $lang_display_comments['OK'], '{SMILIES}' => '', ); if ($CONFIG['enable_smilies']) $params['{SMILIES}'] = generate_smilies(); $html .= template_eval($template_add_your_comment, $params); } return $html; } // Display the full size image function display_fullsize_pic() { global $CONFIG, $HTTP_GET_VARS, $THEME_DIR, $ALBUM_SET; global $lang_errors, $lang_fullsize_popup, $lang_charset; if (function_exists('theme_display_fullsize_pic')) { theme_display_fullsize_pic(); return; } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title><?php echo $CONFIG['gallery_name'] ?>: <?php echo $lang_fullsize_popup['click_to_close']; ?></title> <meta http-equiv="content-type" content="text/html; charset=<?php echo $CONFIG['charset'] == 'language file' ? $lang_charset : $CONFIG['charset'] ?>" /> <link rel="stylesheet" href="<?php echo $THEME_DIR ?>style.css" /> <script type="text/javascript" src="scripts.js"></script> </head> <body scroll="auto" marginwidth="0" marginheight="0"> <script language="JavaScript" type="text/JavaScript"> adjust_popup(); </script> <table width="100%" height="100%" border="0" cellpadding="0" cellspacing="2"> <td align="center" valign="middle"> <table cellspacing="2" cellpadding="0" style="border: 1px solid #000000; background-color: #FFFFFF;"> <td> <?php if (isset($HTTP_GET_VARS['picfile'])) { if (!GALLERY_ADMIN_MODE) cpg_die(ERROR, $lang_errors['access_denied'], __FILE__, __LINE__); $picfile = $HTTP_GET_VARS['picfile']; $picname = $CONFIG['fullpath'] . $picfile; $imagesize = @getimagesize($picname); echo "<a href=\"javascript: window.close()\"><img src=\"" . path2url($picname) . "\" $imagesize[3] class=\"image\" border=\"0\" alt=\"\" title=\"$picfile\n" . $lang_fullsize_popup['click_to_close'] . "\"/></a><br />\n"; } elseif (isset($HTTP_GET_VARS['pid'])) { $pid = (int)$HTTP_GET_VARS['pid']; $sql = "SELECT * " . "FROM {$CONFIG['TABLE_PICTURES']} " . "WHERE pid='$pid' $ALBUM_SET"; $result = db_query($sql); if (!mysql_num_rows($result)) cpg_die(ERROR, $lang_errors['non_exist_ap'], __FILE__, __LINE__); $row = mysql_fetch_array($result); $pic_url = get_pic_url($row, 'fullsize'); $geom = 'width="' . $row['pwidth'] . '" height="' . $row['pheight'] . '"'; echo "<a href=\"javascript: window.close()\"><img src=\"" . $pic_url . "\" $geom class=\"image\" border=\"0\" alt=\"\" title=\"" . htmlspecialchars($row['filename']) . "\n" . $lang_fullsize_popup['click_to_close'] . "\"></a><br />\n"; } ?> </td> </table> </td> </table> </body> </html> <?php } function slideshow() { global $CONFIG, $HTTP_GET_VARS, $lang_display_image_php, $template_display_picture; if (function_exists('theme_slideshow')) { theme_slideshow(); return; } pageheader($lang_display_image_php['slideshow']); include "include/slideshow.inc.php"; $start_slideshow = '<script language="JavaScript" type="text/JavaScript">runSlideShow()</script>'; template_extract_block($template_display_picture, 'img_desc', $start_slideshow); $params = array('{CELL_HEIGHT}' => $CONFIG['picture_width'] + 100, '{IMAGE}' => '<img src="' . $start_img . '" name="SlideShow" class="image" /><br />', '{ADMIN_MENU}' => '', ); starttable(); echo template_eval($template_display_picture, $params); endtable(); starttable(); echo <<<EOT <tr> <td align="center" class="navmenu" style="white-space: nowrap;"> <a href="javascript:endSlideShow()" class="navmenu">{$lang_display_image_php['stop_slideshow']}</a> </td> </tr> EOT; endtable(); pagefooter(); } function get_subcat_data($parent, $level) { global $CONFIG, $ALBUM_SET_ARRAY; $result = db_query("SELECT cid, name, description FROM {$CONFIG['TABLE_CATEGORIES']} WHERE parent = '$parent'"); if (mysql_num_rows($result) > 0) { $rowset = db_fetch_rowset($result); foreach ($rowset as $subcat) { $result = db_query("SELECT aid FROM {$CONFIG['TABLE_ALBUMS']} WHERE category = {$subcat['cid']}"); $album_count = mysql_num_rows($result); while ($row = mysql_fetch_array($result)) { $ALBUM_SET_ARRAY[] = $row['aid']; } // while } if ($level > 1) get_subcat_data($subcat['cid'], $level -1); } } /** * Main code */ $pos = isset($HTTP_GET_VARS['pos']) ? (int)$HTTP_GET_VARS['pos'] : 0; $cat = isset($HTTP_GET_VARS['cat']) ? (int)$HTTP_GET_VARS['cat'] : 0; $album = isset($HTTP_GET_VARS['album']) ? $HTTP_GET_VARS['album'] : ''; // Build the album set if required if (!is_numeric($album) && $cat) { // Meta albums, we need to restrict the albums to the current category if ($cat < 0) { $ALBUM_SET .= 'AND aid IN (' . (- $cat) . ') '; } else { $ALBUM_SET_ARRAY = array(); if ($cat == USER_GAL_CAT) $where = 'category > ' . FIRST_USER_CAT; else $where = "category = '$cat'"; $result = db_query("SELECT aid FROM {$CONFIG['TABLE_ALBUMS']} WHERE $where"); while ($row = mysql_fetch_array($result)) { $ALBUM_SET_ARRAY[] = $row['aid']; } // while get_subcat_data($cat, $CONFIG['subcat_level']); // Treat the album set if (count($ALBUM_SET_ARRAY)) { $set = ''; foreach ($ALBUM_SET_ARRAY as $album_id) $set .= ($set == '') ? $album_id : ',' . $album_id; $ALBUM_SET .= "AND aid IN ($set) "; } } } // Retrieve data for the current picture if ($pos < 0) { $pid = - $pos; $result = db_query("SELECT aid from {$CONFIG['TABLE_PICTURES']} WHERE pid='$pid' $ALBUM_SET LIMIT 1"); if (mysql_num_rows($result) == 0) cpg_die(ERROR, $lang_errors['non_exist_ap'], __FILE__, __LINE__); $row = mysql_fetch_array($result); $album = $row['aid']; $pic_data = get_pic_data($album, $pic_count, $album_name, -1, -1, false); for($pos = 0; $pic_data[$pos]['pid'] != $pid && $pos < $pic_count; $pos++); $pic_data = get_pic_data($album, $pic_count, $album_name, $pos, 1, false); $CURRENT_PIC_DATA = $pic_data[0]; } elseif (isset($HTTP_GET_VARS['pos'])) { $pic_data = get_pic_data($album, $pic_count, $album_name, $pos, 1, false); if ($pic_count == 0) { cpg_die(INFORMATION, $lang_errors['no_img_to_display'], __FILE__, __LINE__); } elseif (count($pic_data) == 0 && $pos >= $pic_count) { $pos = $pic_count - 1; $human_pos = $pos + 1; $pic_data = get_pic_data($album, $pic_count, $album_name, $pos, 1, false); } $CURRENT_PIC_DATA = $pic_data[0]; } // Retrieve data for the current album if (isset($CURRENT_PIC_DATA)) { $result = db_query("SELECT title, comments, votes, category, aid FROM {$CONFIG['TABLE_ALBUMS']} WHERE aid='{$CURRENT_PIC_DATA['aid']}' LIMIT 1"); if (!mysql_num_rows($result)) cpg_die(CRITICAL_ERROR, sprintf($lang_errors['pic_in_invalid_album'], $CURRENT_PIC_DATA['aid']), __FILE__, __LINE__); $CURRENT_ALBUM_DATA = mysql_fetch_array($result); if (is_numeric($album)) { $cat = - $album; $actual_cat = $CURRENT_ALBUM_DATA['category']; breadcrumb($actual_cat, $breadcrumb, $breadcrumb_text); $cat = - $album; } else { $actual_cat = $CURRENT_ALBUM_DATA['category']; breadcrumb($actual_cat, $breadcrumb, $breadcrumb_text); } } if (isset($HTTP_GET_VARS['fullsize'])) { display_fullsize_pic(); ob_end_flush(); } elseif (isset($HTTP_GET_VARS['slideshow'])) { slideshow(); ob_end_flush(); } else { if (!isset($HTTP_GET_VARS['pos'])) cpg_die(ERROR, $lang_errors['non_exist_ap'], __FILE__, __LINE__); $picture_title = $CURRENT_PIC_DATA['title'] ? $CURRENT_PIC_DATA['title'] : strtr(preg_replace("/(.+)\..*?\Z/", "\\1", htmlspecialchars($CURRENT_PIC_DATA['filename'])), "_", " "); $nav_menu = html_img_nav_menu(); $picture = html_picture(); $votes = html_rating_box(); $pic_info = html_picinfo(); $comments = html_comments($CURRENT_PIC_DATA['pid']); if ($CURRENT_PIC_DATA['keywords']) { $meta_keywords = "<meta name=\"keywords\" content=\"".$CURRENT_PIC_DATA['keywords']."\">"; } pageheader($album_name . '/' . $picture_title, $meta_keywords, false); // Display Breadcrumbs if ($breadcrumb && !(strpos($CONFIG['main_page_layout'],"breadcrumb")===false)) { theme_display_breadcrumb($breadcrumb, $cat_data); } // Display Filmstrip if the album is not search if ($album != 'search') { $film_strip = display_film_strip($album, (isset($cat) ? $cat : 0), $pos, true); } theme_display_image($nav_menu, $picture, $votes, $pic_info, $comments, $film_strip); pagefooter(); ob_end_flush(); } ?> </td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td>?</td> </tr> </table></td> <!-- body_text_eof //--> </tr> </table> <!-- body_eof //--> <!-- footer //--> <?php require(DIR_WS_INCLUDES . 'footer.php'); ?> <!-- footer_eof //--> <br> </body> </html> <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
  18. figurez

    Meta Tag Controller Support

    Couldn?t edit my post so I had to post a new one. Figured I would add the code for my info_pages.php. <?php /* $infopageid: info_pages.php,v 1.22 2003/06/05 23:26:22 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ require('includes/application_top.php'); $infopageid = (int)$HTTP_GET_VARS['pages_id']; $page_query = tep_db_query("select p.pages_id, p.status, s.pages_title, s.pages_html_text from " . TABLE_PAGES . " p LEFT JOIN " .TABLE_PAGES_DESCRIPTION . " s on p.pages_id = s.pages_id where s.language_id = '" . (int)$languages_id . "' and p.pages_id = $infopageid"); $page_check = tep_db_fetch_array($page_query); $breadcrumb->add($page_check[pages_title], tep_href_link('info_pages.php?pages_id=' . $infopageid)); ?> <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> <html <?php echo HTML_PARAMS; ?>> <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> <?php require(DIR_WS_INCLUDES . 'meta_tags.php'); ?> <title><?php echo META_TAG_TITLE; ?></title> <meta name="description" content="<?php echo META_TAG_DESCRIPTION; ?>"> <meta name="keywords" content="<?php echo META_TAG_KEYWORDS; ?>"> <base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>"> <link rel="stylesheet" type="text/css" href="stylesheet.css"> </head> <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0"> <!-- header //--> <?php require(DIR_WS_INCLUDES . 'header.php'); ?> <!-- header_eof //--> <!-- body //--> <table border="0" width="100%" cellspacing="3" cellpadding="3"> <tr> <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2"> <!-- left_navigation //--> <?php require(DIR_WS_INCLUDES . 'column_left.php'); ?> <!-- left_navigation_eof //--> </table></td> <!-- body_text //--> <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="pageHeading"><?php echo $page_check[pages_title]; ?></td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td class="main"><?php echo stripslashes("$page_check[pages_html_text]"); ?></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class=""> <tr class="infoBoxContents"> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td align="right"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> </tr> </table></td> </tr> </table></td> </tr> </table></td> <!-- body_text_eof //--> </tr> </table> <!-- body_eof //--> <!-- footer //--> <?php require(DIR_WS_INCLUDES . 'footer.php'); ?> <!-- footer_eof //--> <br> </body> </html> <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?> Thanks again
  19. figurez

    Meta Tag Controller Support

    I?m using the contribution Extra pages-info box w/ admin. On these pages I get NAVBAR_TITLE in the title of my pages. Does anybody know how I can get the extra pages to show the correct title. Thanks in advance.
  20. Hi, I will try to explain my problem. In sweden the post office charge extra for letters/packages which are over 3 centimeters high. For example a letter that weigh 20grams costs 5.50 SEK(swedish currency) , a letter with the same weight but with a hight over 3 centimeters costs 16.50 SEK. I can make one shipping table for regular letters and another shipping table for larger letters. Does anybody have a solution for this so I can mark larger products when adding them to the shop. Then if somebody adds a product wich is marked as "large" the shop will get the shipping from the appropriate shipping table. I hope this makes any sense. Thanks in advance. Kind regards Per
×