Jump to content
Latest News: (loading..)

tfoolen

Members
  • Content count

    45
  • Joined

  • Last visited

Profile Information

  • Real Name
    Tom Foolen
  1. tfoolen

    pdf invoices for admin only

    Ken, I've been havng the same problem with the blurry image. Though I cannot find the PDF_INV_IMG_CORRECTION in my files. The pieces of code related to the images I see are: //Put an image on the page if(!isset($this->images[$file])) { //First use of image, get info if($type=='') { $pos=strrpos($file,'.'); if(!$pos) $this->Error('Image file has no extension and no type was specified: '.$file); $type=substr($file,$pos+1); } $type=strtolower($type); $mqr=get_magic_quotes_runtime(); set_magic_quotes_runtime(0); if($type=='jpg' || $type=='jpeg') $info=$this->_parsejpg($file); elseif($type=='png') $info=$this->_parsepng($file); else { //Allow for additional formats $mtd='_parse'.$type; if(!method_exists($this,$mtd)) $this->Error('Unsupported image type: '.$type); $info=$this->$mtd($file); } set_magic_quotes_runtime($mqr); $info['i']=count($this->images)+1; $this->images[$file]=$info; } else $info=$this->images[$file]; //Automatic width and height calculation if needed if($w==0 && $h==0) { //Put image at 72 dpi $w=$info['w']/$this->k; $h=$info['h']/$this->k; } if($w==0) $w=$h*$info['w']/$info['h']; if($h==0) $h=$w*$info['h']/$info['w']; $this->_out(sprintf('q %.2f 0 0 %.2f %.2f %.2f cm /I%d Do Q',$w*$this->k,$h*$this->k,$x*$this->k,($this->h-($y+$h))*$this->k,$info['i'])); if($link) $this->Link($x,$y,$w,$h,$link); } in the classes/fpdf.php and the bit below in pdf_invoice.php global $HTTP_GET_VARS, $highlight_color, $date, $image_function, $customer_id; //Logo $this->$image_function(PDF_INVOICE_IMAGE,44,8, FILENAME_DEFAULT); What can I change or delete in order to stop this code messing around with my image size? I am using a 72 DPI jpeg. Thanks, Tom
  2. tfoolen

    NEW! Complete Order Editing Tool!

    Nice contrib; easy to install. However: when I add a product to the order, the order total doesn't change. Anyone a clue on that? Same goes for a new order creation (I have also installed this contrib). Furthermore: after adding a product to the order, I get Fatal error: Call to a member function count_contents() on a non-object in catalog\includes\modules\order_total\ot_qty_discount.php on line 53 Contrib for qty discount seems to work fine in the rest of the application. Ciao, Tom
  3. Hi all, Does someone have this contrib working when the order_total is null/zero/0? In my case it will just go to my payment provider, while I would like it to go to checkout_success directly (or something like that). Besides not working, I will have another problem: the discount is applied in checkout_payment.php. The customer has to choose a method of payment here. That would be a bit strange when the order_total is going to be zero. The next question therefore is: how can I apply the discount earlier in the process, in for example checkout_shipping? Then skip checkout_payment and directly go to confirmation. It i obvious that the most important problem to solve is the first one. Ciao, Tom
  4. Me again... Fixed my previous problem, but got a new one: how do I get this to work when order_total is zero. Everything will do just fine untill it's payment time. checkout_confirmation.php will take you to my payment provider. This doesn't like zero amounts. Anyone got an idea? Am I missing something? Ciao, Tom
  5. I have this module installed and wrks just fine. Also have the golden oldie Quantity Discounts http://www.oscommerce.com/community/contributions,1159 QTY discount has an option to disable it when a voucher is used. Doesn't seem to work with this contrib however. Does anyone have an idea how I can disable on of the two? I would prefer to hav the qty discount disabled when a coupon is used. See below for the code for ot_qty_discount.php. Would really appreciate it when someone could help! <?php /* $Id: ot_qty_discount.php,v 1.4 2004-08-22 dreamscape Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2004 Josh Dechant Protions Copyright (c) 2003 osCommerce Released under the GNU General Public License */ class ot_qty_discount { var $title, $output; function ot_qty_discount() { $this->code = 'ot_qty_discount'; $this->title = MODULE_QTY_DISCOUNT_TITLE; $this->description = MODULE_QTY_DISCOUNT_DESCRIPTION; $this->enabled = MODULE_QTY_DISCOUNT_STATUS; $this->sort_order = MODULE_QTY_DISCOUNT_SORT_ORDER; $this->include_shipping = MODULE_QTY_DISCOUNT_INC_SHIPPING; $this->include_tax = MODULE_QTY_DISCOUNT_INC_TAX; $this->calculate_tax = MODULE_QTY_DISCOUNT_CALC_TAX; $this->output = array(); } function process() { global $order, $currencies, $ot_subtotal; $od_amount = $this->calculate_discount($this->get_order_total()); if ($this->calculate_tax == 'true') $tod_amount = $this->calculate_tax_effect($od_amount); if ($od_amount > 0) { if (MODULE_QTY_DISCOUNT_RATE_TYPE == 'percentage') $title_ext = sprintf(MODULE_QTY_DISCOUNT_PERCENTAGE_TEXT_EXTENSION ,$this->calculate_rate($_SESSION['cart']->count_contents())); $this->deduction = $od_amount+$tod_amount; $this->output[] = array('title' => sprintf(MODULE_QTY_DISCOUNT_FORMATED_TITLE, $title_ext), 'text' => sprintf(MODULE_QTY_DISCOUNT_FORMATED_TEXT, $currencies->format($od_amount)), 'value' => $od_amount); $order->info['total'] -= $this->deduction; $order->info['tax'] -= $tod_amount; if ($this->sort_order < $ot_subtotal->sort_order) $order->info['subtotal'] -= $this->deduction; } } function calculate_discount($amount) { global $qty_discount, $order_total_array; $od_amount = 0; if ((MODULE_QTY_DISCOUNT_DISABLE_WITH_COUPON == 'true') && (isset($_SESSION['cc_id']))) return $od_amount; $qty_discount = $this->calculate_rate($_SESSION['cart']->count_contents()); if ($qty_discount > 0) { if (MODULE_QTY_DISCOUNT_RATE_TYPE == 'percentage') { $od_amount = round((($amount*10)/10)*($qty_discount/100), 2); } else { $od_amount = round((($qty_discount*10)/10), 2); } } return $od_amount; } function calculate_rate($order_qty) { $discount_rate = split("[:,]" , MODULE_QTY_DISCOUNT_RATES); $size = sizeof($discount_rate); for ($i=0, $n=$size; $i<$n; $i+=2) { if ($order_qty >= $discount_rate[$i]) { $qty_discount = $discount_rate[$i+1]; } } return $qty_discount; } function calculate_tax_effect($od_amount) { global $order; if (MODULE_QTY_DISCOUNT_RATE_TYPE == 'percentage') { $tod_amount = 0; reset($order->info['tax_groups']); while (list($key, $value) = each($order->info['tax_groups'])) { $god_amount = 0; $tax_rate = tep_get_tax_rate($key); $net = ($tax_rate * $order->info['tax_groups'][$key]); if ($net > 0) { $god_amount = $this->calculate_discount($order->info['tax_groups'][$key]); $tod_amount += $god_amount; $order->info['tax_groups'][$key] = $order->info['tax_groups'][$key] - $god_amount; } } } else { $tod_amount = 0; reset($order->info['tax_groups']); while (list($key, $value) = each($order->info['tax_groups'])) { $god_amount = 0; $tax_rate = tep_get_tax_rate($key); $net = ($tax_rate * $order->info['tax_groups'][$key]); if ($net>0) { $god_amount = ($tax_rate/100)*$od_amount; $tod_amount += $god_amount; $order->info['tax_groups'][$key] = $order->info['tax_groups'][$key] - $god_amount; } } } return $tod_amount; } function get_order_total() { global $order; $order_total = $order->info['total']; if ($this->include_tax == 'false') $order_total = ($order_total - $order->info['tax']); if ($this->include_shipping == 'false') $order_total = ($order_total - $order->info['shipping_cost']); return $order_total; } function check() { if (!isset($this->check)) { $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_QTY_DISCOUNT_STATUS'"); $this->check = mysql_num_rows($check_query); } return $this->check; } function keys() { return array('MODULE_QTY_DISCOUNT_STATUS', 'MODULE_QTY_DISCOUNT_SORT_ORDER', 'MODULE_QTY_DISCOUNT_DISABLE_WITH_COUPON', 'MODULE_QTY_DISCOUNT_RATE_TYPE', 'MODULE_QTY_DISCOUNT_RATES', 'MODULE_QTY_DISCOUNT_INC_SHIPPING', 'MODULE_QTY_DISCOUNT_INC_TAX', 'MODULE_QTY_DISCOUNT_CALC_TAX'); } 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 Quantity Discount', 'MODULE_QTY_DISCOUNT_STATUS', 'true', 'Do you want to enable the quantity discount module?', '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_QTY_DISCOUNT_SORT_ORDER', '2', 'Sort order of display.', '6', '2', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Disable If Coupon Used', 'MODULE_QTY_DISCOUNT_DISABLE_WITH_COUPON', 'true', 'Do you want to disable the quantity discount module if a discount coupon is being used by the user?', '6', '3','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, set_function ,date_added) values ('Discount Rate Type', 'MODULE_QTY_DISCOUNT_RATE_TYPE', 'percentage', 'Choose the type of discount rate - percentage or flat rate', '6', '4','tep_cfg_select_option(array(\'percentage\', \'flat rate\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Discount Rates', 'MODULE_QTY_DISCOUNT_RATES', '10:5,20:10', 'The discount is based on the total number of items. Example: 10:5,20:10.. 10 or more items get a 5% or $5 discount; 20 or more items receive a 10% or $10 disount; depending on the rate type.', '6', '5', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function ,date_added) values ('Include Shipping', 'MODULE_QTY_DISCOUNT_INC_SHIPPING', 'false', 'Include Shipping in calculation', '6', '6', '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, set_function ,date_added) values ('Include Tax', 'MODULE_QTY_DISCOUNT_INC_TAX', 'false', 'Include Tax in calculation.', '6', '7','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, set_function ,date_added) values ('Calculate Tax', 'MODULE_QTY_DISCOUNT_CALC_TAX', 'true', 'Bereken Tax on discounted amount.', '6', '8','tep_cfg_select_option(array(\'true\', \'false\'), ', now())"); } function remove() { tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); } } ?>
  6. tfoolen

    [Support] Quantity Discounts

    Still no reactions, but another question (solved the previous one myself):If the customer uses a discount voucher, two discounts are applied. Though I set the parameteras not to apply the quantity discount when the voucher is used. Anyone?
  7. tfoolen

    [Contribution] Cross Sell (X-Sell) Admin

    Hi all, Nice contrib. Seems that I am missing out on something: where can I specify the special price for a cross sell product? Ciao, Tom
  8. OK, managed it a bit further. Think I must use a htmldecode function. When I apply it (<?php echo htmldecode($article_info['articles_description']); ?>), it gives me the CALL TO AN UNDEFINED FUNCTION error. That could be right, since I haven't defined it in functions/general.php. Does anyone have the code for this?
  9. Good contrib; easy. I have added some bookmarks to suit the dutch market better, such as Hyves and LinkedIn (see my website on http://www.puntoitaliano.nl/it-in-de-media-t-2.html) A question: in the Linkedin link (and maybe also in others) I would like to include the article text, such as <span style="padding-right:<?php echo SB_PADDING; ?>"><a rel="nofollow" onclick="target='_blank'" href="http://www.linkedin.com/shareArticle?mini=true&url=<?echo tep_href_link(FILENAME_ARTICLE_INFO, 'articles_id=' . $article_info['articles_id']);?>&title=<?php echo $article_info['articles_name']; ?>&summary=<?php print stripslashes($article_info['articles_description']); ?>&source=Punto Italiano | The Art of Italian Shirting"><?php echo tep_image(DIR_WS_IMAGES . '/bookmark_icons/linkedin-icon.png','' . $article_info['articles_name'] . ' - ' . TITLE_LINKEDIN);?></a></span> The piece of code <?php print stripslashes($article_info['articles_description']); ?> behind &summary is doing exactly what I want. Untill the article text includes a <a href="xample.php">example</a>. Then it thinks that the sent URL has come to an end, though it hasn't. Trick is that it has to consider everything which is put there by the echo function, as text or parameter. There must be a way to do this, but I haven't figured it out yet. I have tried putting it between "<?php .... ?>", {<?php .... ?>} etc, but nothing worked. Anyone?
  10. Have been searching for a conrtib for a "Where do you know us from" feature in the create_account.php. Think it must be available, since lots of people have it, but no luck yet. Would like to make a admin-changeable drop down. Any suggestions? Ciao, Tom
  11. I have installed the contrib (easy discount...) for a quantity discount when ordering two products or more and everything seemed to be working as it should. Only after the first orders I noticed that the Order Total in the admin-side is calculated incorrectly. The discount is calculated twice. In the front end everything works fine, the right amount is shown and -very important- paid. Problem is particularly nasty for my invoices: they show the incorrect amount, as does the Order Total on the admin/orders.php page. Anyone who can help? Don't have a clue what code should be related to this problem. Ciao, Tom
  12. tfoolen

    [Support] Quantity Discounts

    It seems like this forum is not regularly used, but I will try it anyway: I have installed this contrib (easy...) and everything seemed to be working as it should. Only after the first orders I noticed that the Order Total in the admin-side is calculated incorrectly. The discount is calculated twice. In the front end everything works fine, the right amount is shown and -very important- paid. Problem is particularly nasty for my invoices: they show the incorrect amount, as does the Order Total on the admin/orders.php page. Anyone who can help? Don't have a clue what code should be related to this problem. Ciao, Tom
  13. tfoolen

    pdf invoices for admin only

    Fixed, thanks a lot. That was the line I was looking for. Now it really is a great contrib ;-)
  14. tfoolen

    pdf invoices for admin only

    Great contrib, but I can't seem to get it to work in my live environment. Maybe it has something to do with my config file. Keep getting this error: Warning: FPDF::include(/httpdocs/admin/fpdf/font/helveticabi.php) [function.FPDF-include]: failed to open stream: No such file or directory in /httpdocs/admin/includes/classes/fpdf.php on line 550 Warning: FPDF::include() [function.include]: Failed opening '/httpdocs/admin/fpdf/font/helveticabi.php' for inclusion (include_path='.:/usr/share/pear:/usr/share/php') in /httpdocs/admin/includes/classes/fpdf.php on line 550 FPDF error: Could not include font metric file Checked and double checked: all the necessary files are in place. Also tried to change the path in the classes/fpdf.php file into the absolute path to admin/fpdf/font/... but that is no solution either. Then it keeps expecting a { or $, at least: that is what the new error is saying. Suggestions anyone?
×