Jump to content

defender39

Members
  • Content count

    397
  • Joined

  • Last visited

Everything posted by defender39

  1. I just added the latest version of wishlist. Go check it out and post here if you need support. I want to know if someone installs this into MS2. The biggest thing added is the ability to email a friend your wishlist complete with name and link to each product. Wishlist 2.0 Contribution Download Page
  2. http://www.oscommerce.com/community/contributions,1235 This is a great contrib that I had installed and just now found the time to clean it up and fix some things I had problems with. Should be easy to install and fairly modular. Its an admin tool where you can export via PDF orders and you can select between dates, order status, and even update the status and notify. This is great for heavy volume sites. Any questions or problems please post here and hopefully we can get this tool integrated into core OSC one day.
  3. defender39

    Featured 1.5

    I installed the last version and some files that were either not used or have somehow been broken from 1.3. So here is an extremely easy Featured replacement for you front page only. It also has an sql install that will give you admin control to turn it on or off. You can also designate the amount of products you wish to display from admin. Very easy and quick install. Simple to read instructions thanks to a previous contributor who gets named in the file. http://www.oscommerce.com/community/contributions,651 any questions feel free to post them here for me to see
  4. http://www.oscommerce.com/community/contributions,2093 Quick and easy to install... ifyou have any questions please feel free to post. This just does the MYsql optimize command to your OSC database. This can help keep your site error free and even load faster.
  5. I have just completed a better version of the affiliate_banners_build.php where there is a drop down menu for the product listings...I basically ripped some code from the admin side that was in specials where all the products get pulled. This function could also be used maybe for a quick cart add on mod which I just though of while typing this... I will look into that. Basically before when affiliates wanted to create a link to a direct product they had to find the product id themselves and enter it....now they can just use the pulldown menu complete with price. I can zip this up and add it to the contrib section too if you feel thats a good idea. <?php /* $Id: affiliate_banners_build.php,v 1.0 2003/04/29 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'); if (!tep_session_is_registered('affiliate_id')) { $navigation->set_snapshot(); tep_redirect(tep_href_link(FILENAME_AFFILIATE, '', 'SSL')); } require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_AFFILIATE_BANNERS); $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_AFFILIATE_BANNERS)); $affiliate_banners_values = tep_db_query("select * from " . TABLE_AFFILIATE_BANNERS . " order by affiliate_banners_title"); ?> <!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 if ( file_exists(DIR_WS_INCLUDES . 'header_tags.php') ) { require(DIR_WS_INCLUDES . 'header_tags.php'); } else { ?> <title><?php echo TITLE ?></title> <?php } ?> <base href="<?php echo (getenv('HTTPS') == 'on' ? 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; ?>" height="28" 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 width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> <td align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_specials.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td> </tr> <tr> <td colspan=2 class="main"><?php echo TEXT_INFORMATION; ?></td> </tr> </table> </td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td><table width="100%" border="0" cellspacing="0" cellpadding="2"> <tr> <td class="infoBoxHeading" align="center"><?php echo TEXT_AFFILIATE_INDIVIDUAL_BANNER . ' ' . $affiliate_banners['affiliate_banners_title']; ?></td> </tr> <td class="smallText" align="center"><?php echo TEXT_AFFILIATE_INDIVIDUAL_BANNER_INFO . tep_draw_form('individual_banner', tep_href_link(FILENAME_AFFILIATE_BANNERS_BUILD) ) . "\n" . tep_draw_products_pull_down('individual_banner_id', 'style="font-size:10px"') . tep_image_submit('button_affiliate_build_a_link.gif', IMAGE_BUTTON_BUILD_A_LINK); ?></form></td> </tr> <?php if (tep_not_null($HTTP_POST_VARS['individual_banner_id']) || tep_not_null($HTTP_GET_VARS['individual_banner_id'])) { if (tep_not_null($HTTP_POST_VARS['individual_banner_id'])) $individual_banner_id = $HTTP_POST_VARS['individual_banner_id']; if ($HTTP_GET_VARS['individual_banner_id']) $individual_banner_id = $HTTP_GET_VARS['individual_banner_id']; $affiliate_pbanners_values = tep_db_query("select p.products_image, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . $individual_banner_id . "' and pd.products_id = '" . $individual_banner_id . "' and p.products_status = '1' and pd.language_id = '" . $languages_id . "'"); if ($affiliate_pbanners = tep_db_fetch_array($affiliate_pbanners_values)) { switch (AFFILIATE_KIND_OF_BANNERS) { case 1: $link = '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . FILENAME_PRODUCT_INFO . '?ref=' . $affiliate_id . '&products_id=' . $individual_banner_id . '&affiliate_banner_id=1" target="_blank"><img src="' . HTTP_SERVER . DIR_WS_CATALOG . DIR_WS_IMAGES . $affiliate_pbanners['affiliate_banners_image'] . '" border="0" alt="' . $affiliate_pbanners['products_name'] . '"></a>'; $link2 = '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . FILENAME_PRODUCT_INFO . '?ref=' . $affiliate_id . '&products_id=' . $individual_banner_id . '&affiliate_banner_id=1" target="_blank">' . $affiliate_pbanners['products_name'] . '</a>'; break; case 2: // Link to Products $link = '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . FILENAME_PRODUCT_INFO . '?ref=' . $affiliate_id . '&products_id=' . $individual_banner_id . '&affiliate_banner_id=1" target="_blank"><img src="' . HTTP_SERVER . DIR_WS_CATALOG . FILENAME_AFFILIATE_SHOW_BANNER . '?ref=' . $affiliate_id . '&affiliate_pbanner_id=' . $individual_banner_id . '" border="0" alt="' . $affiliate_pbanners['products_name'] . '"></a>'; $link2 = '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . FILENAME_PRODUCT_INFO . '?ref=' . $affiliate_id . '&products_id=' . $individual_banner_id . '&affiliate_banner_id=1" target="_blank">' . $affiliate_pbanners['products_name'] . '</a>'; break; } } ?> <tr> <td class="smallText" align="center"><?php echo $link; ?></td> </tr> <tr> <td class="smallText" align="center"><?php echo TEXT_AFFILIATE_INFO; ?></td> </tr> <tr> <td class="smallText" align="center"> <textarea cols="60" rows="6" class="boxText"><?php echo $link; ?></textarea> </td> </tr> <tr> <td> <td> </tr> <tr> <td class="smallText" align="center"><b>Text Version:</b> <?php echo $link2; ?></td> </tr> <tr> <td class="smallText" align="center"><?php echo TEXT_AFFILIATE_INFO; ?></td> </tr> <tr> <td class="smallText" align="center"> <textarea cols="60" rows="6" class="boxText"><?php echo $link2; ?></textarea> </td> </tr> <tr> <td> <td> </tr> <?php } ?> </td> </tr> </table> </td> </tr> </table></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 add these 2 functions to your application_top.php in /catalog/includes/ function tep_draw_products_pull_down($name, $parameters = '', $exclude = '') { global $currencies, $languages_id; if ($exclude == '') { $exclude = array(); } $select_string = '<select name="' . $name . '"'; if ($parameters) { $select_string .= ' ' . $parameters; } $select_string .= '>'; $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' order by products_name"); while ($products = tep_db_fetch_array($products_query)) { if (!tep_in_array($products['products_id'], $exclude)) { $select_string .= '<option value="' . $products['products_id'] . '">' . $products['products_name'] . ' (' . $currencies->format($products['products_price']) . ')</option>'; } } $select_string .= '</select>'; return $select_string; } function tep_in_array($lookup_value, $lookup_array) { if (function_exists('in_array')) { if (in_array($lookup_value, $lookup_array)) return true; } else { reset($lookup_array); while (list($key, $value) = each($lookup_array)) { if ($value == $lookup_value) return true; } }
  6. now you can email your friend your wishlist! <?php /* $Id: wishlist_email.php 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'); if (tep_session_is_registered('customer_id')) { $account = tep_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_id = '" . $customer_id . "'"); $account_values = tep_db_fetch_array($account); } elseif (ALLOW_GUEST_TO_TELL_A_FRIEND == 'false') { $navigation->set_snapshot(); tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL')); } require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_WISHLIST); $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_TELL_A_FRIEND, 'send_to=' . $HTTP_GET_VARS['send_to'] . '&products_id=' . $HTTP_GET_VARS['products_id'])); ?> <!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; ?>"> <script LANGUAGE="JavaScript1.2" SRC="includes/menu_animation.js"></SCRIPT> <link rel="stylesheet" type="text/css" href="stylesheet.css"> </head> <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0"> <!-- coolMenu //--> <?php require(DIR_WS_INCLUDES . 'coolmenu.php'); ?> <!-- coolMenu_eof //--> <!-- header //--> <?php require(DIR_WS_INCLUDES . 'header.php'); ?> <!-- header_eof //--> <? $wishliststring = "My Wishlist is: \n\n"; $wishlist_query_raw = "select tab2.products_id, tab1.products_name from " . TABLE_WISHLIST . " as tab2, products_description as tab1 WHERE tab2.customers_id=$customer_id and tab1.products_id = tab2.products_id order by products_name"; $wishlist_query = tep_db_query($wishlist_query_raw); while ($resultarray=mysql_fetch_row($wishlist_query)) { $wishliststring .= $resultarray[1]."\n" . HTTP_SERVER ."/product_info.php/products_id/".$resultarray[0] . "\n\n"; } ?> <!-- 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 sprintf(HEADING_TITLE1, $product_info['products_name']); ?></td> <td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_contact_us.gif', sprintf(HEADING_TITLE, $product_info['products_name']), HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <?php $error = false; if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'process') && !tep_validate_email(trim($HTTP_POST_VARS['friendemail']))) { $friendemail_error = true; $error = true; } else { $friendemail_error = false; } if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'process') && empty($HTTP_POST_VARS['friendname'])) { $friendname_error = true; $error = true; } else { $friendname_error = false; } if (tep_session_is_registered('customer_id')) { $from_name = $account_values['customers_firstname'] . ' ' . $account_values['customers_lastname']; $from_email_address = $account_values['customers_email_address']; } else { $from_name = $HTTP_POST_VARS['yourname']; $from_email_address = $HTTP_POST_VARS['from']; } if (!tep_session_is_registered('customer_id')) { if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'process') && !tep_validate_email(trim($from_email_address))) { $fromemail_error = true; $error = true; } else { $fromemail_error = false; } } if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'process') && empty($from_name)) { $fromname_error = true; $error = true; } else { $fromname_error = false; } if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'process') && ($error == false)) { $email_subject = sprintf(TEXT_EMAIL_SUBJECT, $from_name, STORE_NAME); $email_body = sprintf(TEXT_EMAIL_INTRO, $HTTP_POST_VARS['friendname'], $from_name, $HTTP_POST_VARS['products_name'], STORE_NAME) . "\n\n"; if (tep_not_null($HTTP_POST_VARS['yourmessage'])) { $email_body .= $HTTP_POST_VARS['yourmessage'] . "\n\n"; } $email_body .= sprintf(TEXT_EMAIL_SIGNATURE, STORE_NAME . "\n" . HTTP_SERVER . DIR_WS_CATALOG . "\n"); "\n\n" . $mywishlist .= $wishlist_query_array[1] ."\n"; tep_mail($HTTP_POST_VARS['friendname'], $HTTP_POST_VARS['friendemail'], $email_subject, stripslashes($email_body), '', $from_email_address); ?> <tr> <td><br><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td class="main"><?php echo sprintf(TEXT_EMAIL_SUCCESSFUL_SENT, stripslashes($HTTP_POST_VARS['products_name']), $HTTP_POST_VARS['friendemail']); ?></td> </tr> </table></td> </tr> <tr> <td class="main"><?php echo '<a href="' . tep_href_link(FILENAME_WISHLIST) . '">' . tep_image_button('button_back.gif', IMAGE_BUTTON_BACK) . '</a>'; ?></td> </tr> <?php } else { if (tep_session_is_registered('customer_id')) { $your_name_prompt = $account_values['customers_firstname'] . ' ' . $account_values['customers_lastname']; $your_email_address_prompt = $account_values['customers_email_address']; } else { $your_name_prompt = tep_draw_input_field('yourname', (($fromname_error == true) ? $HTTP_POST_VARS['yourname'] : $HTTP_GET_VARS['yourname'])); if ($fromname_error == true) $your_name_prompt .= ' ' . TEXT_REQUIRED; $your_email_address_prompt = tep_draw_input_field('from', (($fromemail_error == true) ? $HTTP_POST_VARS['from'] : $HTTP_GET_VARS['from'])); if ($fromemail_error == true) $your_email_address_prompt .= ENTRY_EMAIL_ADDRESS_CHECK_ERROR; } ?> <tr> <td><?php echo tep_draw_form('email_friend', tep_href_link(FILENAME_WISHLIST_SEND, 'action=process&products_id=' . $HTTP_GET_VARS['products_id'])) . tep_draw_hidden_field('products_name', $product_info['products_name']); ?><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td class="formAreaTitle"><?php echo FORM_TITLE_CUSTOMER_DETAILS; ?></td> </tr> <tr> <td class="main"><table border="0" width="100%" cellspacing="0" cellpadding="2" class="formArea"> <tr> <td class="main"><table border="0" cellspacing="0" cellpadding="2"> <tr> <td class="main"><?php echo FORM_FIELD_CUSTOMER_NAME; ?></td> <td class="main"><?php echo $your_name_prompt; ?></td> </tr> <tr> <td class="main"><?php echo FORM_FIELD_CUSTOMER_EMAIL; ?></td> <td class="main"><?php echo $your_email_address_prompt; ?></td> </tr> </table></td> </tr> </table></td> </tr> <tr> <td class="formAreaTitle"><br><?php echo FORM_TITLE_FRIEND_DETAILS; ?></td> </tr> <tr> <td class="main"><table border="0" width="100%" cellspacing="0" cellpadding="2" class="formArea"> <tr> <td class="main"><table border="0" cellspacing="0" cellpadding="2"> <tr> <td class="main"><?php echo FORM_FIELD_FRIEND_NAME; ?></td> <td class="main"><?php echo tep_draw_input_field('friendname', (($friendname_error == true) ? $HTTP_POST_VARS['friendname'] : $HTTP_GET_VARS['friendname'])); if ($friendname_error == true) echo ' ' . TEXT_REQUIRED;?></td> </tr> <tr> <td class="main"><?php echo FORM_FIELD_FRIEND_EMAIL; ?></td> <td class="main"><?php echo tep_draw_input_field('friendemail', (($friendemail_error == true) ? $HTTP_POST_VARS['friendemail'] : $HTTP_GET_VARS['send_to'])); if ($friendemail_error == true) echo ENTRY_EMAIL_ADDRESS_CHECK_ERROR; ?></td> </tr> </table></td> </tr> </table></td> </tr> <tr> <td class="formAreaTitle"><br><?php echo FORM_TITLE_FRIEND_MESSAGE; ?></td> </tr> <tr> <td class="main"><table border="0" width="100%" cellspacing="0" cellpadding="2" class="formArea"> <tr> <!-- hacked by chuck <td><?php echo tep_draw_textarea_field('yourmessage', 'soft', 40, 8);?></td> --> <td><textarea name="yourmessage" cols=40 rows=8><?=$wishliststring;?></textarea></td> </tr> </table></td> </tr> <tr> <td><br><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="main"><?php echo '<a href="' . tep_href_link(FILENAME_WISHLIST) . '">' . tep_image_button('button_back.gif', IMAGE_BUTTON_BACK) . '</a>'; ?></td> <td align="right" class="main"><?php echo tep_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE); ?></td> </tr> </table></td> </tr> </table></form></td> </tr> <?php } ?> </table></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 language file <?php /* $Id: wishlist.php,v 1 2003/11/20 OS Commerce - Community Made Shopping! http://www.oscommerce.com Copyright (c) 2000,2001 The Exchange Project Released under the GNU General Public License */ define('NAVBAR_TITLE', 'Wishlist'); define('HEADING_TITLE', 'Wishlist'); define('HEADING_TITLE1', 'Email your wishlist to a friend.'); define('HEADING_TITLE_BOX', 'Send your wishlist to a friend.'); define('BOX_TEXT', 'Send your wishlist to a friend.'); define('FORM_TITLE_CUSTOMER_DETAILS', 'Your Details'); define('FORM_TITLE_FRIEND_DETAILS', 'Your Friend\'s Details'); define('FORM_TITLE_FRIEND_MESSAGE', 'Your Message'); define('FORM_FIELD_CUSTOMER_NAME', 'Your Name:'); define('FORM_FIELD_CUSTOMER_EMAIL', 'Your Email Address:'); define('FORM_FIELD_FRIEND_NAME', 'Your Friend\'s Name:'); define('FORM_FIELD_FRIEND_EMAIL', 'Your Friend\'s Email Address:'); define('TEXT_EMAIL_SUCCESSFUL_SENT', 'Your email about <b>%s</b> has been successfully sent to <b>%s</b>.'); define('TEXT_EMAIL_SUBJECT', 'Your friend %s wants to share his wishlist at %s'); define('TEXT_EMAIL_INTRO', 'Hi %s!' . "\n\n" . 'Your friend, %s, thought that you would like to see his wishlist from%s %s.'); define('TEXT_EMAIL_SIGNATURE', 'Regards,' . "\n\n" . '%s'); ?>
  7. I would like to add an email button in orders.php as it stands it displays the email address as a mailto: here is how to add a button to quickly email a customer. Sometimes I needed to email a customer and the notify customer on an update doesnt really do that. look for this code around line 150 <td class="main"><?php echo '<a href="mailto:' . $order->customer['email_address'] . '"><u>' . $order->customer['email_address'] . '</u></a>'; ?></td> now after that add <td class="main"> <?php echo '<a href="' . tep_href_link(FILENAME_MAIL, 'selected_box=tools&customer=' . $order->customer['email_address'] . '">' . tep_image_button('button_email.gif', IMAGE_EMAIL) . '</a>'); ?></td> enjoy
  8. Ok I think I have it. ? ? if ($get_result['restrict_to_products']) { ? ? ? $pr_ids = split("[,]", $get_result['restrict_to_products']); ? ? ? $in_cart=false; ? ? ? $products_array = $cart->get_products(); // ? ? ? for ($i = 0; $i < sizeof($pr_ids); $i++) { // ? ? ? ? for ($ii = 1; $ii<=sizeof($products_array); $ii++) { // ? ? ? ? ? if (tep_get_prid($products_array[$ii-1]['id']) == $pr_ids[$i]) { // ? ? ? ? ? ? $in_cart=true; ? ? ? ? ? ? ? $total_price += $order_total; // ? ? ? ? ? } // ? ? ? ? } // ? ? ? } ? ? ? $order_total = $total_price; ? ? ? ? ? ? } ? } ? return $order_total; ?} ? I commented out the lines that add up the products. Then I changed ? ? ? ? ? ? $total_price += $this->get_product_price($products_array[$ii-1]['id']); to: $total_price += $order_total; I guess that's about as clean as I can make it. It seems to work as I want and I tested against a few things and it seems ok.
  9. I just read as much as I can here and didnt find one thing that I just realized is a problem. When you restrict a coupon to a product or category...but then decide on a minimum...It actually only seems to check the total of the valid products to reach the minimum of the coupon. This shouldn't be. Lets say I have X item valid and its a $10 item but I want the coupon to have a $30 minimum to reach that deal...well it only sees the $10 total and wont allow the coupon to work even if I have $50 worth in my cart. If I wanted to make only the valid product or category a $10 minimum than I would set that. I been looking at the code for a couple hours and cant seem to get it right. ? // OK thats fine for global coupons but what about restricted coupons ? ?// where you can only redeem against certain products/categories. ? ?// and I though this was going to be easy !!! ? $coupon_query=tep_db_query("select coupon_code ?from " . TABLE_COUPONS . " where coupon_id='".$cc_id."'"); ? if (tep_db_num_rows($coupon_query) !=0) { ? ? $coupon_result=tep_db_fetch_array($coupon_query); ? ? $coupon_get=tep_db_query("select coupon_amount, coupon_minimum_order,restrict_to_products,restrict_to_categories, coupon_type from " . TABLE_COUPONS . " where coupon_code='".$coupon_result['coupon_code']."'"); ? ? $get_result=tep_db_fetch_array($coupon_get); ? ? $in_cat = true; ? ? if ($get_result['restrict_to_categories']) { ? ? ? $cat_ids = split("[,]", $get_result['restrict_to_categories']); ? ? ? $in_cat=false; ? ? ? for ($i = 0; $i < count($cat_ids); $i++) { ? ? ? ? if (is_array($this->contents)) { ? ? ? ? ? reset($this->contents); ? ? ? ? ? while (list($products_id, ) = each($this->contents)) { ? ? ? ? ? ?$cat_query = tep_db_query("select products_id from products_to_categories where products_id = '" . $products_id . "' and categories_id = '" . $cat_ids[$i] . "'"); ? ? ? ? ? ? if (tep_db_num_rows($cat_query) !=0 ) { ? ? ? ? ? ? ? $in_cat = true; ? ? ? ? ? ? ? $total_price += $this->get_product_price($products_id); ? ? ? ? ? ? } ? ? ? ? ? } ? ? ? ? } ? ? ? ? ? ? } ? ? ? ? ? ? ? } ? ? $in_cart = true; ? ? if ($get_result['restrict_to_products']) { ? ? ? $pr_ids = split("[,]", $get_result['restrict_to_products']); ? ? ? $in_cart=false; ? ? ? $products_array = $cart->get_products(); ? ? ? for ($i = 0; $i < sizeof($pr_ids); $i++) { ? ? ? ? for ($ii = 1; $ii<=sizeof($products_array); $ii++) { ? ? ? ? ? if (tep_get_prid($products_array[$ii-1]['id']) == $pr_ids[$i]) { ? ? ? ? ? ? $in_cart=true; ? ? ? ? ? ? $total_price += $this->get_product_price($products_array[$ii-1]['id']); ? ? ? ? ? } ? ? ? ? } ? ? ? } ? ? ? $order_total = $total_price; ? ? ? ? ? ? } ? } ? return $order_total; ?} ? It is most likely here but I havent found out yet how to correct this. Please Please Please help me out.
  10. I have been using a product_listing_col.php instead of the rows listing and I like it's look but I recently noticed that you cannot sort by price or stock. With the regular product_listing.php module you get a header with sort option. I want to create a dropdown menu with sort options but I am having an impossible time trying to create a tep_draw_drop_down_menu with the proper array. My array is always empty. I havent written an array from scratch and all my attempts using examples from php.net still create an empty drop down list. Can someone give me a hand on this one? Here is the original contrib I am using. http://www.oscommerce.com/community/contributions,112
  11. defender39

    Product Listing Column Sorting

    That's not working for me. I am on MS1... I keep getting really close but there is always something not working right. This is the closest I got now. echo '<tr><td>'; $sort_array = array(); $sort_array = array(); $sort_array[] = array('id' => '4a', 'text' => 'Product Name Ascending'); $sort_array[] = array('id' => '4d', 'text' => 'Product Name Descending'); $sort_array[] = array('id' => '3a', 'text' => 'Product Price Ascending'); $sort_array[] = array('id' => '3d', 'text' => 'Product Price Descending'); echo tep_draw_form('sort', '', 'post'); echo tep_draw_pull_down_menu('sort', $sort_array, (isset($HTTP_GET_VARS['sort']) ? $HTTP_GET_VARS['sort'] : ''), 'onChange="this.form.submit();"'); echo '</form></td></tr>'; I added this to my index.php but I am using SEF urls. So lets say I am here: http://www.videogamedeals.com/index.php/so...th/87_19/page/2 Well when I make a change it makes the url this: http://www.videogamedeals.com/index.php/so.../page/2?sort=4d As you can see it quickly starts to make a mess of the url. So does anyone know how I might correct this?
  12. defender39

    Product Listing Column Sorting

    My latest attempt is much better: <tr> <td> <?php echo tep_draw_form('sort', '', 'post'); echo tep_draw_pull_down_menu('sort', array(array('id' => '3a', 'text' => 'Name'), array('id' => '4d', 'text' => 'Sort by Price')), '', 'onchange="this.form.submit()"'); ?> </form> </td> </tr> While this now submits the page doesnt actually work. I have the sort options correct as 3a and 4d to try to force results but neither seems to take. Hmm..any new ideas? Once this is fixed up some it can be added to the contrib so that others who use column display can have more sort options.
  13. defender39

    Product Listing Column Sorting

    OK well this is what I have that's working now as a drop down menu. <tr> <td> <?php echo tep_draw_pull_down_menu('sort', array(array('id' => 'ALA', 'text' => 'ALA'), array('id' => 'Price', 'text' => 'Sort by Price')), 'Price'); ?> </td> </tr> the problem is that I am unable to get it to submit onchange. Do I have to create a tep_draw_form?
  14. defender39

    Product Listing Column Sorting

    Here is what I have but it just uses the first letter. I know I am not even close to getting this correct. <tr> <td> <?php $sort = array( 'price', 'date', 'name', ); echo tep_draw_pull_down_menu('sort', $sort,'',''); ?> </td> </tr>
  15. defender39

    Automatic Thumbnail

    I believe the auto thumb generator works with the tep_image function so if you removed that function for the header image call then the auto thumb generator will just leave it alone. You are basically hard coding the image. If it's just one image this will work just fine.
  16. I am working on a contrib for phpesp which is a very good survey script. So far I have it installed and working great. You can see it here http://www.videogamedeals.com/survey.php I run ms1 and I still have a lot of changes to make but I hope to make this a contrib soon. One thing I would love to see is that when someone completes a survey they go to a coupon page or even better...get sent a gift voucher. Anyways take a look. It didnt take me long to install it. But the admin section is not part of OSCadmin yet... This is a live site but the survey is just a test. I havent added a link or box for it from the site. You can only access it directly. Any feedback on how we can implement this?
  17. defender39

    Display X # of products

    you can set the default higher in the admin...if 10 is too low then make it 20, 25 or whatever you think works
  18. defender39

    help with phpbb intergration please

    User has been helped...her file got corrupted and cut off...
  19. Here is what I have so far: class ot_coupon { var $title, $output; function ot_coupon() { $this->code = 'ot_coupon'; $this->header = MODULE_ORDER_TOTAL_COUPON_HEADER; $this->title = MODULE_ORDER_TOTAL_COUPON_TITLE; $this->description = MODULE_ORDER_TOTAL_COUPON_DESCRIPTION; $this->user_prompt = ''; $this->enabled = MODULE_ORDER_TOTAL_COUPON_STATUS; $this->sort_order = MODULE_ORDER_TOTAL_COUPON_SORT_ORDER; $this->include_shipping = MODULE_ORDER_TOTAL_COUPON_INC_SHIPPING; $this->include_tax = MODULE_ORDER_TOTAL_COUPON_INC_TAX; $this->calculate_tax = MODULE_ORDER_TOTAL_COUPON_CALC_TAX; $this->tax_class = MODULE_ORDER_TOTAL_COUPON_TAX_CLASS; $this->credit_class = true; $this->output = array(); } function process() { global $order, $currencies; $order_total=$this->get_order_total(); $od_amount = $this->calculate_credit($order_total); $this->deduction = $od_amount; if ($this->calculate_tax != 'none') { $tod_amount = $this->calculate_tax_deduction($order_total, $this->deduction, $this->calculate_tax); } if ($od_amount > 0) { $order->info['total'] = $order->info['total'] - $od_amount; $this->output[] = array('title' => $this->title . ':' . $this->coupon_code .':', 'text' => '<b>' . $currencies->format($od_amount) . '</b>', 'value' => $od_amount); } } function selection_test() { return false; } function pre_confirmation_check($order_total) { global $customer_id; return $this->calculate_credit($order_total); } function use_credit_amount() { return $output_string; } function credit_selection() { global $customer_id, $currencies, $language; $selection_string = ''; $selection_string .= '<tr>' . "\n"; $selection_string .= ' <td width="10">' . tep_draw_separator('pixel_trans.gif', '10', '1') .'</td>'; $selection_string .= ' <td class="main">' . "\n"; $image_submit = '<input type="image" name="submit_redeem" onClick="submitFunction()" src="' . DIR_WS_LANGUAGES . $language . '/images/buttons/button_redeem.gif" border="0" alt="' . IMAGE_REDEEM_VOUCHER . '" title = "' . IMAGE_REDEEM_VOUCHER . '">'; $selection_string .= TEXT_ENTER_COUPON_CODE . tep_draw_input_field('gv_redeem_code') . '</td>'; $selection_string .= ' <td align="right"' . $image_submit . '</td>'; $selection_string .= ' <td width="10">' . tep_draw_separator('pixel_trans.gif', '10', '1') . '</td>'; $selection_string .= '</tr>' . "\n"; return $selection_string; } function collect_posts() { global $HTTP_POST_VARS, $customer_id, $currencies, $cc_id; if ($HTTP_POST_VARS['gv_redeem_code']) { // get some info from the coupon table $coupon_query=tep_db_query("select coupon_id, coupon_amount, coupon_type,coupon_ship_type, coupon_minimum_order, uses_per_coupon, uses_per_user, restrict_to_products, restrict_to_categories from " . TABLE_COUPONS . " where coupon_code='".$HTTP_POST_VARS['gv_redeem_code']."' and coupon_active='Y'"); $coupon_result=tep_db_fetch_array($coupon_query); if ($coupon_result['coupon_type'] != 'G') { if (tep_db_num_rows($coupon_query)==0) { tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(ERROR_NO_INVALID_REDEEM_COUPON), 'SSL')); } $date_query=tep_db_query("select coupon_start_date from " . TABLE_COUPONS . " where coupon_start_date <= now() and coupon_code='".$HTTP_POST_VARS['gv_redeem_code']."'"); if (tep_db_num_rows($date_query)==0) { tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(ERROR_INVALID_STARTDATE_COUPON), 'SSL')); } $date_query=tep_db_query("select coupon_expire_date from " . TABLE_COUPONS . " where coupon_expire_date >= now() and coupon_code='".$HTTP_POST_VARS['gv_redeem_code']."'"); if (tep_db_num_rows($date_query)==0) { tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(ERROR_INVALID_FINISDATE_COUPON), 'SSL')); } $coupon_count = tep_db_query("select coupon_id from " . TABLE_COUPON_REDEEM_TRACK . " where coupon_id = '" . $coupon_result['coupon_id']."'"); $coupon_count_customer = tep_db_query("select coupon_id from " . TABLE_COUPON_REDEEM_TRACK . " where coupon_id = '" . $coupon_result['coupon_id']."' and customer_id = '" . $customer_id . "'"); if (tep_db_num_rows($coupon_count)>=$coupon_result['uses_per_coupon'] && $coupon_result['uses_per_coupon'] > 0) { tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(ERROR_INVALID_USES_COUPON . $coupon_result['uses_per_coupon'] . TIMES ), 'SSL')); } if (tep_db_num_rows($coupon_count_customer)>=$coupon_result['uses_per_user'] && $coupon_result['uses_per_user'] > 0) { tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(ERROR_INVALID_USES_USER_COUPON . $coupon_result['uses_per_user'] . TIMES ), 'SSL')); } if ($coupon_result['coupon_type']=='S' && $coupon_result['coupon_ship_type']=='Flat Rate USA ONLY') { $coupon_amount = $order->info['shipping_cost']; } else { $coupon_amount = $currencies->format($coupon_result['coupon_amount']) . ' '; } if ($coupon_result['type']=='P') $coupon_amount = $coupon_result['coupon_amount'] . '% '; if ($coupon_result['coupon_minimum_order']>0) $coupon_amount .= 'on orders greater than ' . $coupon_result['coupon_minimum_order']; // if (!tep_session_is_registered('cc_id')) tep_session_register('cc_id'); $_SESSION['cc_id'] = $coupon_result['coupon_id']; } if ($HTTP_POST_VARS['submit_redeem_coupon_x'] && !$HTTP_POST_VARS['gv_redeem_code']) tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(ERROR_NO_REDEEM_CODE), 'SSL')); } } function calculate_credit($amount) { global $customer_id, $order, $cc_id; $cc_id = $_SESSION['cc_id']; $od_amount = 0; if ($cc_id) { $coupon_query = tep_db_query("select coupon_code from " . TABLE_COUPONS . " where coupon_id = '" . $cc_id . "'"); if (tep_db_num_rows($coupon_query) !=0 ) { $coupon_result = tep_db_fetch_array($coupon_query); $this->coupon_code = $coupon_result['coupon_code']; $coupon_get = tep_db_query("select coupon_amount, coupon_minimum_order, restrict_to_products, restrict_to_categories, coupon_type from " . TABLE_COUPONS ." where coupon_code = '". $coupon_result['coupon_code'] . "'"); $get_result = tep_db_fetch_array($coupon_get); $c_deduct = $get_result['coupon_amount']; if ($get_result['coupon_type']=='S' && $coupon_result['coupon_ship_type']=='Flat Rate USA ONLY') $c_deduct = $order->info['shipping_cost']; if ($get_result['coupon_minimum_order'] <= $this->get_order_total()) { if ($get_result['restrict_to_products'] || $get_result['restrict_to_categories']) { for ($i=0; $i<sizeof($order->products); $i++) { if ($get_result['restrict_to_products']) { $pr_ids = split("[,]", $get_result['restrict_to_products']); for ($ii = 0; $ii < count($pr_ids); $ii++) { if ($pr_ids[$ii] == tep_get_prid($order->products[$i]['id'])) { if ($get_result['type'] == 'P') { $od_amount = round($amount*10)/10*$c_deduct/100; $pr_c = $order->products[$i]['final_price']*$order->products[$i]['qty']; $pod_amount = round($pr_c*10)/10*$c_deduct/100; } else { $od_amount = $c_deduct; } } } } else { $cat_ids = split("[,]", $get_result['restrict_to_categories']); for ($i=0; $i<sizeof($order->products); $i++) { $my_path = tep_get_product_path(tep_get_prid($order->products[$i]['id'])); $sub_cat_ids = split("[_]", $my_path); for ($iii = 0; $iii < count($sub_cat_ids); $iii++) { for ($ii = 0; $ii < count($cat_ids); $ii++) { if ($sub_cat_ids[$iii] == $cat_ids[$ii]) { if ($get_result['coupon_type'] == 'P') { $od_amount = round($amount*10)/10*$c_deduct/100; $pr_c = $order->products[$i]['final_price']*$order->products[$i]['qty']; $pod_amount = round($pr_c*10)/10*$c_deduct/100; } else { $od_amount = $c_deduct; } } } } } } } } else { if ($get_result['coupon_type'] !='P') { $od_amount = $c_deduct; } else { $od_amount = $amount * $get_result['coupon_amount'] / 100; } } } } if ($od_amount>$amount) $od_amount = $amount; } return $od_amount; } function calculate_tax_deduction($amount, $od_amount, $method) { global $customer_id, $order, $cc_id, $cart; $cc_id = $_SESSION['cc_id']; $coupon_query = tep_db_query("select coupon_code from " . TABLE_COUPONS . " where coupon_id = '" . $cc_id . "'"); if (tep_db_num_rows($coupon_query) !=0 ) { $coupon_result = tep_db_fetch_array($coupon_query); $coupon_get = tep_db_query("select coupon_amount, coupon_minimum_order, restrict_to_products, restrict_to_categories, coupon_type from " . TABLE_COUPONS . " where coupon_code = '". $coupon_result['coupon_code'] . "'"); $get_result = tep_db_fetch_array($coupon_get); if ($get_result['coupon_type'] != 'S') { if ($get_result['restrict_to_products'] || $get_result['restrict_to_categories']) { // What to do here. // Loop through all products and build a list of all product_ids, price, tax class // at the same time create total net amount. // then // for percentage discounts. simply reduce tax group per product by discount percentage // or // for fixed payment amount // calculate ratio based on total net // for each product reduce tax group per product by ratio amount. $products = $cart->get_products(); for ($i=0; $i<sizeof($products); $i++) { $t_prid = tep_get_prid($products[$i]['id']); $cc_query = tep_db_query("select products_tax_class_id from " . TABLE_PRODUCTS . " where products_id = '" . $t_prid . "'"); $cc_result = tep_db_fetch_array($cc_query); $valid_product = false; if ($get_result['restrict_to_products']) { $pr_ids = split("[,]", $get_result['restrict_to_products']); for ($p = 0; $p < sizeof($pr_ids); $p++) { if ($pr_ids[$p] == $t_prid) $valid_product = true; } } if ($get_result['restrict_to_categories']) { $cat_ids = split("[,]", $get_result['restrict_to_categories']); for ($c = 0; $c < sizeof($cat_ids); $c++) { $cat_query = tep_db_query("select products_id from products_to_categories where products_id = '" . $products_id . "' and categories_id = '" . $cat_ids[$i] . "'"); if (tep_db_num_rows($cat_query) !=0 ) $valid_product = true; } } if ($valid_product) { $valid_array[] = array('product_id' => $t_prid, 'products_price' => $products[$i]['final_price'] * $products[$i]['quantity'], 'products_tax_class' => $cc_result['products_tax_class_id']); $total_price += $products[$i]['final_price'] * $products[$i]['quantity']; } } if ($valid_product) { if ($get_result['coupon_type'] == 'P') { $ratio = $get_result['coupon_amount']/100; } else { $ratio = $od_amount / $total_price; } if ($get_result['coupon_type'] == 'S') $ratio = 1; if ($method=='Credit Note') { $tax_rate = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']); $tax_desc = tep_get_tax_description($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']); if ($get_result['coupon_type'] == 'P') { $tod_amount = $od_amount / (100 + $tax_rate)* $tax_rate; } else { $tod_amount = $order->info['tax_groups'][$tax_desc] * $od_amount/100; } $order->info['tax_groups'][$tax_desc] -= $tod_amount; $order->info['total'] -= $tod_amount; } else { I added to my DB a field called coupon_ship_type and its set for my flat rate shipping. I added coupon_ship_type to the $coupon_results string now as you can see I tried this: if ($coupon_result['coupon_type']=='S' && $coupon_result['coupon_ship_type']=='Flat Rate USA ONLY') { $coupon_amount = $order->info['shipping_cost']; } else { $coupon_amount = $currencies->format($coupon_result['coupon_amount']) . ' '; no luck though...
  20. Ok...I am looking at ot_coupon.php and I think this is really possible to make the free shipping force to only a certain type. Just like the other if options for the coupon uses. I want to start by making sure that I can hard code the ot_coupon.php before I modify my admin side and the DB tables. I see this line about 4 times in ot_coupon.php if ($get_result['coupon_type'] != 'S') { I would believe it can be altered to something like if ($get_result['coupon_type'] != 'S' && SHIPPING_CHOICE='cheapest shipping') { So far I am not sure how I can get ot_coupon.php to read the SHIPPING_CHOICE any help in this would be great...I will continue to try do this myself but so far no luck so my question at this point is simple. How can I get ot_coupon.php to read the shipping_method variable? I see in ot_shipping.php this $order->info['shipping_method'] but it doesnt seem to take effect if I add that to coupon.
  21. I also really need to make free shipping available to a specific shipping option. I am having serious problems with free shipping coupons and people selecting $100 overnight shipping and thats not acceptable. I need to be able to select in admin the shipping module that the free shipping coupon is good for. The coupon should error out if another selection is made. This would be great and any help in the code would be awesome.
  22. defender39

    Bundled products

    what about images? It would be nice if a bundled product displayed the image from each of the items included...
  23. excellent...just what I was looking for...I will let you know if I have any problems
  24. great contrib... one problem on my MS1... weight on all packages come out to zero pounds and 2 ouces no matter what reality is <?php $shipping_weight_ot = substr($order->totals[1]['title'],strpos($order->totals[1]['title'],'x') + 1, (strpos($order->totals[1]['title'],'lbs') - strpos($order->totals[1]['title'],'x'))-1 ); $shipping_weight = ($shipping_weight_ot < 0.1 ? 0.1 : $shipping_weight_ot); $shipping_pounds = floor ($shipping_weight); $shipping_ounces = round(16 * ($shipping_weight - floor($shipping_weight))); ?> Any ideas on why that would be...I have to assume that its not pulling my weight variable but I cant tell how it would.
  25. defender39

    What is the best BB Contribution?

    I use the PHPBB parts A and B and I have even added mods for it. http://www.videogamedeals.com for a demo
×