Jump to content

douxbb

Members
  • Content count

    14
  • Joined

  • Last visited

Everything posted by douxbb

  1. douxbb

    Newsletter products, HTML email

    Hi, Scottyb! I have one more little question: When i receive the newsletter, just above the attached procuct images, there are 2 Horizontal Lines (HR)...how to get rid of them? Please
  2. douxbb

    Newsletter products, HTML email

    Hey, Scottyb! You are GREAT! It works. Thanks again for this contribution!
  3. douxbb

    Newsletter products, HTML email

    Thanks Scottyb! I did change the code but the results was not what i expected. I can send the newsletter to ALL but the body message is empty. Here is my code: <?php /* $Id: newsletter_products.php,v 1.0 2005/07/29 scottyb Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright © 2002 osCommerce Released under the GNU General Public License //newsletter products */ class newsletter_products { function newsletter_products($title, $content, $products, $template) { $this->title = $title; $this->content = $content; $this->products = $products; $this->template = $template; } function choose_products() { global $HTTP_GET_VARS, $languages_id; if($HTTP_GET_VARS['nID']){ $newsletter_products_query = tep_db_query("select products from " . TABLE_NEWSLETTERS . " where newsletters_id ='" . $HTTP_GET_VARS['nID'] . "'"); $newsletter_products_string = tep_db_result($newsletter_products_query, 0, $newsletter_products_query['products']); } $current_products_query = "select pd.products_id, pd.products_name, p.products_model from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where pd.language_id = '" . $languages_id . "' and pd.products_id = p.products_id and p.products_status = '1'"; if($newsletter_products_string) $current_products_query .= " and pd.products_id in(" . $newsletter_products_string . ")"; $current_products_query .= " order by pd.products_name"; $current_products_array = array(); $current_products_query = tep_db_query($current_products_query); if($newsletter_products_string){ while ($current_products = tep_db_fetch_array($current_products_query)){ $current_products_array[] = array('id' => $current_products['products_id'], 'text' => $current_products['products_name'] . ' - ' . $current_products['products_model']); } } $products_query = "select pd.products_id, pd.products_name, p.products_model from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where pd.language_id = '" . $languages_id . "' and pd.products_id = p.products_id and p.products_status = '1'"; if($newsletter_products_string) $products_query .= " and pd.products_id not in(" . $newsletter_products_string . ")"; $products_query .= " order by pd.products_name"; $products_array = array(); $products_query = tep_db_query($products_query); while ($products = tep_db_fetch_array($products_query)) { $products_array[] = array('id' => $products['products_id'], 'text' => $products['products_name'] . ' - ' . $products['products_model']); } $choose_products_string = '<script language="javascript"><!-- function mover(move) { if (move == \'remove\') { for (x=0; x<(document.newsletter.products.length); x++) { if (document.newsletter.products.options[x].selected) { with(document.newsletter.elements[\'chosen[]\']) { options[options.length] = new Option(document.newsletter.products.options[x].text,document.newsletter.products .options[x].value); } document.newsletter.products.options[x] = null; x = -1; } } } if (move == \'add\') { for (x=0; x<(document.newsletter.elements[\'chosen[]\'].length); x++) { if (document.newsletter.elements[\'chosen[]\'].options[x].selected) { with(document.newsletter.products) { options[options.length] = new Option(document.newsletter.elements[\'chosen[]\'].options[x].text,document.newsletter.elements[\'chosen[]\'].options[x].value); } document.newsletter.elements[\'chosen[]\'].options[x] = null; x = -1; } } } return true; } function selectAll(FormName, SelectBox) { temp = "document." + FormName + ".elements[\'" + SelectBox + "\']"; Source = eval(temp); for (x=0; x<(Source.length); x++) { Source.options[x].selected = "true"; } } //--></script>'; $choose_products_string .= '<table border="0" width="100%" cellspacing="0" cellpadding="2">' . "\n" . ' <tr>' . "\n" . ' <td align="center" class="main"><b>' . TEXT_PRODUCTS . '</b><br>' . tep_draw_pull_down_menu('products', $products_array, '', 'size="20" style="width: 32em;" multiple') . '</td>' . "\n" . ' <td align="center" class="main"> <br><br><input type="button" value="' . BUTTON_SELECT . '" style="width: 8em;" onClick="mover(\'remove\');"><br><br><input type="button" value="' . BUTTON_UNSELECT . '" style="width: 8em;" onClick="mover(\'add\');"></td>' . "\n" . ' <td align="center" class="main"><b>' . TEXT_SELECTED_PRODUCTS . '</b><br>' . tep_draw_pull_down_menu('chosen[]', $current_products_array, '', 'size="20" style="width: 25em;" multiple') . '</td>' . "\n" . ' </tr>' . "\n" . '</table>'; return $choose_products_string; } function html_content() { //create HTML string containing links & pics define('COLS', 2); $width = intval(100/COLS); $html_content = '<table border="0" width="100%" height="100%" cellpadding="2" cellspacing="3"><tr><td colspan="' . COLS . '" align="center" class="content">' . $this->content . '</td></tr><tr><td colspan="2">' . tep_draw_separator('pixel_trans.gif', '1', '10') . '</td></tr><tr>'; $col = 0; if ($this->products != ''){ $images_query = tep_db_query("select p.products_id, pd.products_name, p.products_image from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where pd.products_id = p.products_id and p.products_id in(" . $this->products . ")"); } while($images = tep_db_fetch_array($images_query)){ if($col > COLS-1){ $html_content .= '</tr><tr><td class="content" align="center" width="' . $width . '%"><a href="' . tep_catalog_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $images['products_id']) . '" class="content">' . tep_image(HTTP_CATALOG_SERVER . DIR_WS_CATALOG_IMAGES . $images['products_image'], $images['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '<br>' . $images['products_name'] . '</a></td>'; $col = 0; }else{ $html_content .= '<td class="content" align="center" width="' . $width . '%"><a href="' . tep_catalog_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $images['products_id']) . '" class="content">' . tep_image(HTTP_CATALOG_SERVER . DIR_WS_CATALOG_IMAGES . $images['products_image'], $images['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '<br>' . $images['products_name'] . '</a></td>'; } $col++; } $html_content .= '</tr></table>'; if(tep_not_null($this->template)){ //HTML page from template $content = join('', file(DIR_WS_TEMPLATES . $this->template)); $content = addslashes($content); eval ("\$content = \"$content\";"); $html_content = $content; } return $html_content; } function confirm() { global $HTTP_GET_VARS; $mail_query1 = tep_db_query("select count(*) as count from " . TABLE_CUSTOMERS . " where customers_newsletter = '1'"); $mail_query2 = tep_db_query("select count(*) as count from " . TABLE_NEWSLETTER . " where customers_newsletter = '1'"); $mail1 = tep_db_fetch_array($mail_query1); $mail2 = tep_db_fetch_array($mail_query2); $mail['count'] = ($mail1['count'] + $mail2['count'] ); $confirm_string = '<table border="0" cellspacing="0" cellpadding="2">' . "\n" . ' <tr>' . "\n" . ' <td class="main"><font color="#ff0000"><b>' . sprintf(TEXT_COUNT_CUSTOMERS, $mail['count']) . '</b></font></td>' . "\n" . ' </tr>' . "\n" . ' <tr>' . "\n" . ' <td>' . tep_draw_separator('pixel_trans.gif', '1', '10') . '</td>' . "\n" . ' </tr>' . "\n" . ' <tr>' . "\n" . ' <td class="main"><b>' . $this->title . '</b></td>' . "\n" . ' </tr>' . "\n" . ' <tr>' . "\n" . ' <td>' . tep_draw_separator('pixel_trans.gif', '1', '10') . '</td>' . "\n" . ' </tr>' . "\n" . ' <tr>' . "\n" . ' <td class="main">' . $this->html_content() . '</td>' . "\n" . ' </tr>' . "\n" . ' <tr>' . "\n" . ' <td>' . tep_draw_separator('pixel_trans.gif', '1', '10') . '</td>' . "\n" . ' </tr>' . "\n" . ' <tr>' . "\n" . ' <td align="right"><a href="' . tep_href_link(FILENAME_NEWSLETTERS, 'page=' . $HTTP_GET_VARS['page'] . '&nID=' . $HTTP_GET_VARS['nID'] . '&action=confirm_send') . '">' . tep_image_button('button_send.gif', IMAGE_SEND) . '</a> <a href="' . tep_href_link(FILENAME_NEWSLETTERS, 'page=' . $HTTP_GET_VARS['page'] . '&nID=' . $HTTP_GET_VARS['nID']) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a></td>' . "\n" . ' </tr>' . "\n" . '</table>'; return $confirm_string; } function send($newsletter_id) { $mail_query1 = tep_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_newsletter = '1'"); $mail_query2 = tep_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_NEWSLETTER . " where customers_newsletter = '1'"); $mimemessage = new email(array('X-Mailer: osCommerce bulk mailer')); $mimemessage->add_text($this->content); $mimemessage->build_message(); while ($mail = tep_db_fetch_array($mail_query1)) { $mimemessage->send($mail['customers_firstname'] . ' ' . $mail['customers_lastname'], $mail['customers_email_address'], '', EMAIL_FROM, $this->title); } while ($mail = tep_db_fetch_array($mail_query2)) { $mimemessage->send($mail['customers_firstname'] . ' ' . $mail['customers_lastname'], $mail['customers_email_address'], '', EMAIL_FROM, $this->title); } $newsletter_id = tep_db_prepare_input($newsletter_id); tep_db_query("update " . TABLE_NEWSLETTERS . " set date_sent = now(), status = '1' where newsletters_id = '" . tep_db_input($newsletter_id) . "'"); } } ?> Thank you for your help.
  4. douxbb

    Newsletter products, HTML email

    Sorry, i cannot EDIT my Post..and i don't understand why.. Just to correct the previous Post: Where I wrote "table newsletter" I meant "table customers". Thank you
  5. douxbb

    Newsletter products, HTML email

    Hi scottyb, I have this contribution working, but only for the table "newsletter". I have another table "maillist" where all the visitors can subscribe to the newsletter. The problem is that only who are subscribed from the table newsletter is receiving my newsletters. Where can I change the code to allow ALL the subscriber to receive it? The structure is as follow: maillist table with 4 column: customers_firstname varchar(20) customers_lastname varchar(20) customers_email_address varchar(40) customers_newsletter char(2) primary key: customers_email_address Thank you
  6. Hi scottyb, I have this contribution working, but only for the table "newsletter". I have another table "maillist" where all the visitors can subscribe to the newsletter. The problem is that only who are subscribed from the table newsletter is receiving my newsletters. Where can I change the code to allow ALL the subscriber to receive it? The structure is as follow: maillist table with 4 column: customers_firstname varchar(20) customers_lastname varchar(20) customers_email_address varchar(40) customers_newsletter char(2) primary key: customers_email_address Thank you
  7. Warning: before_process(includes/modules/payment/paypal/classes/osC/osC.class.php): failed to open stream: No such file or directory in /hsphere/local/home/mysite/mysite.com/catalog/includes/modules/payment/paypal.php on line 141 Warning: before_process(): Failed opening 'includes/modules/payment/paypal/classes/osC/osC.class.php' for inclusion (include_path='.:/usr/local/lib/php') in /hsphere/local/home/mysite/mysite.com/catalog/includes/modules/payment/paypal.php on line 141 Fatal error: Undefined class name 'paypal_osc' in /hsphere/local/home/mysite/mysite.com/catalog/includes/modules/payment/paypal.php on line 142 ================================= I installed the CCGV516 and now I get this error for checkout confirmation when choosing Paypal method! Any help, please!! Thanks I post now my paypal.php: <?php /* $Id: paypal.php,v 1.1.1.1 2004/09/22 13:45:13 devosc Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com DevosC, Developing open source Code http://www.devosc.com Copyright © 2003 osCommerce Copyright © 2004 DevosC.com Released under the GNU General Public License LISTEN UP!!! I removed all instances of shipping in the cart => paypal transaction. What does this mean? It means that PayPal will never list shipping in any order transactions. However, should you use a coupon with free or discounted shipping in it, PayPal will always recieve the correct charge amount. -Kevin Peno -Digital-NW.com -Rent-a-Coder, Coder */ define('FILENAME_PAYPAL_INFO','popup_paypal.php'); define('FILENAME_IPN','ipn.php'); class paypal { var $code, $title, $description, $enabled; // class constructor function paypal() { global $order; $this->code = 'paypal'; $this->codeTitle = 'PayPal'; $this->title = MODULE_PAYMENT_PAYPAL_TEXT_TITLE; $this->description = MODULE_PAYMENT_PAYPAL_TEXT_DESCRIPTION; $this->sort_order = MODULE_PAYMENT_PAYPAL_SORT_ORDER; $this->enabled = ((MODULE_PAYMENT_PAYPAL_STATUS == 'True') ? true : false); if ((int)MODULE_PAYMENT_PAYPAL_ORDER_STATUS_ID > 0) { $this->order_status = MODULE_PAYMENT_PAYPAL_ORDER_STATUS_ID; } if (is_object($order)) $this->update_status(); $this->form_paypal_url = 'https://' . MODULE_PAYMENT_PAYPAL_DOMAIN . '/cgi-bin/webscr'; $this->cc_explain_url = tep_href_link(FILENAME_PAYPAL_INFO, '', 'SSL'); } // catalog payment module class methods function update_status() { global $order; if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_PAYPAL_ZONE > 0) ) { $check_flag = false; $check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_PAYPAL_ZONE . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id"); while ($check = tep_db_fetch_array($check_query)) { if ($check['zone_id'] < 1) { $check_flag = true; break; } elseif ($check['zone_id'] == $order->billing['zone_id']) { $check_flag = true; break; } } if ($check_flag == false) { $this->enabled = false; } } } function javascript_validation() { return false; } function selection() { $img_visa = DIR_WS_MODULES .'payment/paypal/images/visa.gif'; $img_mc = DIR_WS_MODULES .'payment/paypal/images/mastercard.gif'; $img_discover = DIR_WS_MODULES .'payment/paypal/images/discover.gif'; $img_amex = DIR_WS_MODULES .'payment/paypal/images/amex.gif'; $img_paypal = DIR_WS_MODULES .'payment/paypal/images/paypal_intl.gif'; $jscript_url = '<a style="cursor: pointer; cursor: hand;"' . " onclick=\"java script:popup=window.open(\'" . $this->cc_explain_url . "\',\'popup\',\'scrollbars,resizable,width=625,height=600,left=50,top=50\'); popup.focus(); return false;\">"; $cc_explain = '<div style="A.hover{cursor:hand}">' . MODULE_PAYMENT_PAYPAL_CC_DESCRIPTION .'?' . "<script>document.writeln('" . $jscript_url . MODULE_PAYMENT_PAYPAL_CC_URL_TEXT . "</a>');</script>" . '<noscript><a href="' . $this->cc_explain_url . '" target="_blank">' . MODULE_PAYMENT_PAYPAL_CC_URL_TEXT . '</noscript>' ."\n".'</div>'; $paypal_cc_txt = sprintf(MODULE_PAYMENT_PAYPAL_CC_TEXT, tep_image($img_visa,' Visa ','','','align="absmiddle"'), tep_image($img_mc,' MasterCard ','','','align="absmiddle"'), tep_image($img_discover,' Discover ','','','align="absmiddle"'), tep_image($img_amex,' American Express ','','','align="absmiddle"'), tep_image($img_paypal,' PayPal ','','','align="absmiddle"') ); $fields[] = array('title' => '', //MODULE_PAYMENT_PAYPAL_TEXT_TITLE, 'field' => '<div><b>' . $paypal_cc_txt . '</b></div>' . $cc_explain ); return array('id' => $this->code, 'module' => $this->title, 'fields' => $fields); } function pre_confirmation_check() { return false; } function confirmation() { return false; } function currency() { global $currency; if(!isset($this->currency)) { if (MODULE_PAYMENT_PAYPAL_CURRENCY == 'Selected Currency') { $this->currency = $currency; } else { $this->currency = substr(MODULE_PAYMENT_PAYPAL_CURRENCY, 5); } if (!in_array($this->currency, array('CAD', 'EUR', 'GBP', 'JPY', 'USD', 'AUD'))) { $this->currency = MODULE_PAYMENT_PAYPAL_DEFAULT_CURRENCY; } } return $this->currency; } //Returns the gross total amount to compare with paypal.mc_gross function grossPaymentAmount($my_currency) { global $order, $currencies; return number_format(($order->info['total']) * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency)); } function amount($my_currency) { global $order, $currencies; return number_format(($order->info['total']/* - $order->info['shipping_cost']*/) * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency)); } function process_button() { return false; } function before_process() { if(!class_exists('PayPal_osC')) include_once(DIR_WS_MODULES . 'payment/paypal/classes/osC/osC.class.php'); if (PayPal_osC::check_order_status()) { tep_redirect(tep_href_link(FILENAME_SHOPPING_CART, '', 'SSL')); } else { include(DIR_WS_MODULES . 'payment/paypal/catalog/checkout_process.inc.php'); } exit; } function after_process() { return false; } function output_error() { return false; } function check() { if (!isset($this->_check)) { $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_PAYPAL_STATUS'"); $this->_check = tep_db_num_rows($check_query); } return $this->_check; } 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 ('Enable PayPal Module', 'MODULE_PAYMENT_PAYPAL_STATUS', 'True', 'Do you want to accept PayPal payments?', '6', '0', '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 ('E-Mail Address', 'MODULE_PAYMENT_PAYPAL_ID','".STORE_OWNER_EMAIL_ADDRESS."', 'The e-mail address to use for the PayPal service', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Business ID', 'MODULE_PAYMENT_PAYPAL_BUSINESS_ID','".STORE_OWNER_EMAIL_ADDRESS."', 'Email address or account ID of the payment recipient', '6', '', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Default Currency', 'MODULE_PAYMENT_PAYPAL_DEFAULT_CURRENCY', 'USD', 'The <b>default</b> currency to use for when the customer chooses to checkout via the store using a currency not supported by PayPal.<br />(This currency must exist in your store)', '6', '0', 'tep_cfg_select_option(array(\'USD\',\'CAD\',\'EUR\',\'GBP\',\'JPY\',\'AUD\'), ', 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 ('Transaction Currency', 'MODULE_PAYMENT_PAYPAL_CURRENCY', 'Selected Currency', 'The currency to use for credit card transactions', '6', '0', 'tep_cfg_select_option(array(\'Selected Currency\',\'Only USD\',\'Only CAD\',\'Only EUR\',\'Only GBP\',\'Only JPY\',\'Only AUD\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Payment Zone', 'MODULE_PAYMENT_PAYPAL_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', '6', '0', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Set Pending Notification Status', 'MODULE_PAYMENT_PAYPAL_PROCESSING_STATUS_ID', '" . DEFAULT_ORDERS_STATUS_ID . "', 'Set the Pending Notification status of orders made with this payment module to this value (\'Pending\' recommended)', '6', '0', 'tep_cfg_pull_down_order_statuses(', 'tep_get_order_status_name', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Set Order Status', 'MODULE_PAYMENT_PAYPAL_ORDER_STATUS_ID', '" . DEFAULT_ORDERS_STATUS_ID . "', 'Set the status of orders made with this payment module to this value<br>(\'Processing\' recommended)', '6', '0', 'tep_cfg_pull_down_order_statuses(', 'tep_get_order_status_name', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Set On Hold Order Status', 'MODULE_PAYMENT_PAYPAL_ORDER_ONHOLD_STATUS_ID', '" . DEFAULT_ORDERS_STATUS_ID . "', 'Set the status of <b>On Hold</b> orders made with this payment module to this value', '6', '0', 'tep_cfg_pull_down_order_statuses(', 'tep_get_order_status_name', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Set Canceled Order Status', 'MODULE_PAYMENT_PAYPAL_ORDER_CANCELED_STATUS_ID', '" . DEFAULT_ORDERS_STATUS_ID . "', 'Set the status of <b>Canceled</b> orders made with this payment module to this value', '6', '0', 'tep_cfg_pull_down_order_statuses(', 'tep_get_order_status_name', 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 ('Synchronize Invoice', 'MODULE_PAYMENT_PAYPAL_INVOICE_REQUIRED', 'False', 'Do you want to specify the order number as the PayPal invoice number?', '6', '0', '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 of display.', 'MODULE_PAYMENT_PAYPAL_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Set Refunded Order Status', 'MODULE_PAYMENT_PAYPAL_ORDER_REFUNDED_STATUS_ID', '" . DEFAULT_ORDERS_STATUS_ID . "', 'Set the status of <b>Refunded</b> orders made with this payment module to this value', '6', '0', 'tep_cfg_pull_down_order_statuses(', 'tep_get_order_status_name', 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 ('Background Color', 'MODULE_PAYMENT_PAYPAL_CS', 'White', 'Select the background color of PayPal\'s payment pages.', '6', '0', 'tep_cfg_select_option(array(\'White\',\'Black\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Processing logo', 'MODULE_PAYMENT_PAYPAL_PROCESSING_LOGO', 'oscommerce.gif', 'The image file name to display the store\'s checkout process', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Store logo', 'MODULE_PAYMENT_PAYPAL_STORE_LOGO', '', 'The image file name for PayPal to display (leave empty if your store does not have SSL)', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('PayPal Page Style Name', 'MODULE_PAYMENT_PAYPAL_PAGE_STYLE', 'default', 'The name of the page style you have configured in your PayPal Account', '6', '0', 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 a note with payment', 'MODULE_PAYMENT_PAYPAL_NO_NOTE', 'No', 'Choose whether your customer should be prompted to include a note or not?', '6', '0', 'tep_cfg_select_option(array(\'Yes\',\'No\'), ', 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 ('Shopping Cart Method', 'MODULE_PAYMENT_PAYPAL_METHOD', 'Aggregate', 'What type of shopping cart do you want to use?', '6', '0', 'tep_cfg_select_option(array(\'Aggregate\',\'Itemized\'), ', 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 ('Enable PayPal Shipping Address', 'MODULE_PAYMENT_PAYPAL_SHIPPING_ALLOWED', 'No', 'Allow the customer to choose their own PayPal shipping address?', '6', '0', 'tep_cfg_select_option(array(\'Yes\',\'No\'), ', 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 ('Debug Email Notifications', 'MODULE_PAYMENT_PAYPAL_IPN_DEBUG', 'Yes', 'Enable debug email notifications', '6', '0', 'tep_cfg_select_option(array(\'Yes\',\'No\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Digest Key', 'MODULE_PAYMENT_PAYPAL_IPN_DIGEST_KEY', 'PayPal_Shopping_Cart_IPN', 'Key to use for the digest functionality', '6', '0', 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 ('Test Mode', 'MODULE_PAYMENT_PAYPAL_IPN_TEST_MODE', 'Off', 'Set test mode <a style=\"color: #0033cc;\" href=\"" . tep_href_link(FILENAME_PAYPAL, 'action=itp') . "\" target=\"ipn\">[iPN Test Panel]</a>', '6', '0', 'tep_cfg_select_option(array(\'Off\',\'On\'), ', 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 ('Cart Test', 'MODULE_PAYMENT_PAYPAL_IPN_CART_TEST', 'On', 'Set cart test mode to verify the transaction amounts', '6', '0', 'tep_cfg_select_option(array(\'Off\',\'On\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Debug Email Notification Address', 'MODULE_PAYMENT_PAYPAL_IPN_DEBUG_EMAIL','".STORE_OWNER_EMAIL_ADDRESS."', 'The e-mail address to send <b>debug</b> notifications to', '6', '0', 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 ('PayPal Domain', 'MODULE_PAYMENT_PAYPAL_DOMAIN', 'www.paypal.com', 'Select which PayPal domain to use<br>(for live production select www.paypal.com)', '6', '0', 'tep_cfg_select_option(array(\'www.paypal.com\',\'www.sandbox.paypal.com\'), ', 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 ('Return URL behavior', 'MODULE_PAYMENT_PAYPAL_RM', '1', 'How should the customer be sent back from PayPal to the specified URL?<br>0=No IPN, 1=GET, 2=POST', '6', '0', 'tep_cfg_select_option(array(\'0\',\'1\',\'2\'), ', now())"); } function remove() { tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); } function keys() { return array( 'MODULE_PAYMENT_PAYPAL_STATUS', 'MODULE_PAYMENT_PAYPAL_ID', 'MODULE_PAYMENT_PAYPAL_BUSINESS_ID', 'MODULE_PAYMENT_PAYPAL_DEFAULT_CURRENCY', 'MODULE_PAYMENT_PAYPAL_CURRENCY', 'MODULE_PAYMENT_PAYPAL_ZONE', 'MODULE_PAYMENT_PAYPAL_PROCESSING_STATUS_ID', 'MODULE_PAYMENT_PAYPAL_ORDER_STATUS_ID', 'MODULE_PAYMENT_PAYPAL_ORDER_ONHOLD_STATUS_ID', 'MODULE_PAYMENT_PAYPAL_ORDER_REFUNDED_STATUS_ID', 'MODULE_PAYMENT_PAYPAL_ORDER_CANCELED_STATUS_ID', 'MODULE_PAYMENT_PAYPAL_INVOICE_REQUIRED', 'MODULE_PAYMENT_PAYPAL_SORT_ORDER', 'MODULE_PAYMENT_PAYPAL_CS', 'MODULE_PAYMENT_PAYPAL_PROCESSING_LOGO', 'MODULE_PAYMENT_PAYPAL_STORE_LOGO', 'MODULE_PAYMENT_PAYPAL_PAGE_STYLE', 'MODULE_PAYMENT_PAYPAL_NO_NOTE', 'MODULE_PAYMENT_PAYPAL_METHOD', 'MODULE_PAYMENT_PAYPAL_SHIPPING_ALLOWED', 'MODULE_PAYMENT_PAYPAL_IPN_DIGEST_KEY', 'MODULE_PAYMENT_PAYPAL_IPN_TEST_MODE', 'MODULE_PAYMENT_PAYPAL_IPN_CART_TEST', 'MODULE_PAYMENT_PAYPAL_IPN_DEBUG', 'MODULE_PAYMENT_PAYPAL_IPN_DEBUG_EMAIL', 'MODULE_PAYMENT_PAYPAL_DOMAIN', 'MODULE_PAYMENT_PAYPAL_RM'); } function setTransactionID() { global $order, $currencies; $my_currency = $this->currency(); $trans_id = STORE_NAME . date('Ymdhis'); $this->digest = md5($trans_id . number_format($order->info['total'] * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency), '.', '') . MODULE_PAYMENT_PAYPAL_IPN_DIGEST_KEY); return $this->digest; } function formFields($txn_sign = '', $payment_amount = '', $payment_currency = '', $payment_currency_value = '', $orders_id = '', $return_url = '', $cancel_url = '' ) { global $order, $currencies; $my_currency = (!empty($payment_currency)) ? $payment_currency : $this->currency(); $my_currency_value = (!empty($payment_currency_value)) ? $payment_currency_value : $currencies->get_value($my_currency); //Merchant Info $paypal_fields = tep_draw_hidden_field('business', MODULE_PAYMENT_PAYPAL_BUSINESS_ID); //Currency $paypal_fields .= tep_draw_hidden_field('currency_code', $my_currency); //Shopping Cart Info if(MODULE_PAYMENT_PAYPAL_METHOD == 'Itemized') { $paypal_fields .= tep_draw_hidden_field('upload', sizeof($order->products)) . tep_draw_hidden_field('redirect_cmd', '_cart') . tep_draw_hidden_field('handling_cart', number_format(/*$order->info['shipping_cost']*/0 * $my_currency_value, $currencies->get_decimal_places($my_currency))); //Itemized Order Details for ($i=0,$index=1; $i<sizeof($order->products); $i++, $index++) { //$index = $i+1; $paypal_fields .= tep_draw_hidden_field('item_name_'.$index, $order->products[$i]['name']). tep_draw_hidden_field('item_number_'.$index, $order->products[$i]['model']). tep_draw_hidden_field('quantity_'.$index, $order->products[$i]['qty']). tep_draw_hidden_field('amount_'.$index, number_format($order->products[$i]['final_price']* $my_currency_value,2)); $tax = ($order->products[$i]['final_price'] * ($order->products[$i]['tax'] / 100)) * $my_currency_value; $paypal_fields .= tep_draw_hidden_field('tax_'.$index, number_format($tax, 2)); //Customer Specified Product Options: PayPal Max = 2 if ($order->products[$i]['attributes']) { //$n = sizeof($order->products[$i]['attributes']); for ($j=0; $j<2; $j++) { if($order->products[$i]['attributes'][$j]['option']){ $paypal_fields .= $this->optionSetFields($j,$index,$order->products[$i]['attributes'][$j]['option'],$order->products[$i]['attributes'][$j]['value']); } else { $paypal_fields .= $this->optionSetFields($j,$index); } } } else { for ($j=0; $j<2; $j++) { $paypal_fields .= $this->optionSetFields($j,$index); } } } } else { //Aggregate Cart (Method 1) $paypal_fields .= tep_draw_hidden_field('item_name', STORE_NAME) . tep_draw_hidden_field('redirect_cmd', '_xclick') . tep_draw_hidden_field('amount', !empty($payment_amount) ? $payment_amount : $this->amount($my_currency)) . tep_draw_hidden_field('shipping', number_format(/*$order->info['shipping_cost']*/0 * $my_currency_value, $currencies->get_decimal_places($my_currency))); $item_number = ''; for ($i=0; $i<sizeof($order->products); $i++) $item_number .= ' '.$order->products[$i]['name'].' ,'; $item_number = substr_replace($item_number,'',-2); $paypal_fields .= tep_draw_hidden_field('item_number', $item_number); } //Synchronize invoice if(MODULE_PAYMENT_PAYPAL_INVOICE_REQUIRED == 'True') $paypal_fields .= tep_draw_hidden_field('invoice', !empty($orders_id) ? $orders_id : $this->orders_id); //Allow customer to choose their own shipping address if(MODULE_PAYMENT_PAYPAL_SHIPPING_ALLOWED == 'No' ) $paypal_fields .= tep_draw_hidden_field('no_shipping', '1' ); //Customer registration fields $paypal_fields .= $this->customerDetailsFields($order); //Customer comment field $paypal_fields .= $this->noteOptionFields(MODULE_PAYMENT_PAYPAL_NO_NOTE , MODULE_PAYMENT_PAYPAL_CUSTOMER_COMMENTS); //Store Logo if(tep_not_null(MODULE_PAYMENT_PAYPAL_STORE_LOGO)) $paypal_fields .= tep_draw_hidden_field('image_url', tep_href_link(DIR_WS_IMAGES.MODULE_PAYMENT_PAYPAL_STORE_LOGO, '', 'SSL',false)); //PayPal background color $paypal_fields .= tep_draw_hidden_field('cs',(MODULE_PAYMENT_PAYPAL_CS == 'White') ? '0' : '1'); //PayPal page style if(tep_not_null(MODULE_PAYMENT_PAYPAL_PAGE_STYLE)) $paypal_fields .= tep_draw_hidden_field('page_style',MODULE_PAYMENT_PAYPAL_PAGE_STYLE); //PayPal Store Config $paypal_fields .= tep_draw_hidden_field('custom', !empty($txn_sign) ? $txn_sign : $this->digest) . tep_draw_hidden_field('return', !empty($return_url) ? $return_url : tep_href_link(FILENAME_CHECKOUT_SUCCESS, 'action=success', 'SSL')) . tep_draw_hidden_field('cancel_return', !empty($cancel_url) ? $cancel_url : tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL')) . tep_draw_hidden_field('notify_url', tep_href_link(FILENAME_IPN, '', 'SSL',false)) . tep_draw_hidden_field('rm', MODULE_PAYMENT_PAYPAL_RM) . tep_draw_hidden_field('bn', 'osc-ipn-v1'); return $paypal_fields; } function customerDetailsFields(&$order) { //Customer Details - for those who haven't signed up to PayPal $paypal_fields = tep_draw_hidden_field('cmd', '_ext-enter') . //allows the customer addr details to be passed tep_draw_hidden_field('email', $order->customer['email_address']) . tep_draw_hidden_field('first_name', $order->billing['firstname']) . tep_draw_hidden_field('last_name', $order->billing['lastname']) . tep_draw_hidden_field('address1', $order->billing['street_address']) . tep_draw_hidden_field('address2', $order->billing['suburb']) . tep_draw_hidden_field('city', $order->billing['city']) . tep_draw_hidden_field('state', tep_get_zone_code($order->billing['country']['id'],$order->billing['zone_id'],$order->billing['zone_id'])) . tep_draw_hidden_field('zip', $order->billing['postcode']) . //Note: Anguilla[AI], Dominican Republic[DO], The Netherlands[NL] have different codes to the iso codes in the osC db tep_draw_hidden_field('country', $order->billing['country']['iso_code_2']); //Telephone is problematic. /*//OMITTED SINCE NOT SPECIFICALLY BILLING ADDRESS RELATED $telephone = preg_replace('/\D/', '', $order->customer['telephone']); $paypal_fields .= tep_draw_hidden_field('night_phone_a',substr($telephone,0,3)); $paypal_fields .= tep_draw_hidden_field('night_phone_b',substr($telephone,3,3)); $paypal_fields .= tep_draw_hidden_field('night_phone_c',substr($telephone,6,4)); $paypal_fields .= tep_draw_hidden_field('day_phone_a',substr($telephone,0,3)); $paypal_fields .= tep_draw_hidden_field('day_phone_b',substr($telephone,3,3)); $paypal_fields .= tep_draw_hidden_field('day_phone_c',substr($telephone,6,4)); */ //Flow Language $paypal_fields .= tep_draw_hidden_field('lc', $order->billing['country']['iso_code_2']); return $paypal_fields; } function optionSetFields($sub_index,$index,$option=' ',$value=' ') { return tep_draw_hidden_field('on'.$sub_index.'_'.$index,$option). tep_draw_hidden_field('os'.$sub_index.'_'.$index,$value); } function noteOptionFields($option='No',$msg='Add Comments About Your Order') { $option = ($option == 'Yes') ? '0': '1'; $no_note = tep_draw_hidden_field('no_note',$option); if (!$option) return $no_note .= tep_draw_hidden_field('cn',$msg); else return $no_note; } function sendMoneyFields(&$order, $orders_id) { include_once(DIR_WS_MODULES . 'payment/paypal/database_tables.inc.php'); $orders_session_query = tep_db_query("select firstname, lastname, payment_amount, payment_currency, payment_currency_val, txn_signature from " . TABLE_ORDERS_SESSION_INFO . " where orders_id ='" . (int)$orders_id . "'"); $orders_session_info = tep_db_fetch_array($orders_session_query); $order->billing['firstname'] = $orders_session_info['firstname']; $order->billing['lastname'] = $orders_session_info['lastname']; $return_href_link = tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id='.$orders_id, 'SSL'); $cancel_href_link = $return_href_link; return $this->formFields($orders_session_info['txn_signature'], $orders_session_info['payment_amount']/* - $order->info['shipping_cost']*/, $orders_session_info['payment_currency'], $orders_session_info['payment_currency_val'], $orders_id, $return_href_link, $cancel_href_link); } }//end class ?>
  8. douxbb

    Table rate ratio

    I have a table rate like this: 100:10,500:25,1000:40,2000:60 The ratio is based on weight, meaning that if the order total weight is 100gr the shipping/weight price is 10$. But when the user check out the value doesnt change to reflect this ratio. What should I do? thank you douxbb
  9. douxbb

    Table rate ratio

    wheeloftime! Thank you. It's working now!...even if I don't know the weight unit I'm using and no way to change it. The product weight correspond to talble rate ratio...and that is how it is workig. But may I have the choice for weight unit? Thanks again
  10. I don't have this module through my admin... I see it in screenshots but I can't configure it, change or even to know which unit am I using...Kg, gr or another... Please help Douxbb
×