aresman Posted March 28, 2005 Share Posted March 28, 2005 Hi - I need to figure out a way to pull some products, including name and price, from my OSC database which resides on a subdomain and then display that information on another site that is on my root and is not OSC. So, basically, the idea is that in my content site, I would have a box that would have 3-4 products that would change on a monthly basis. It would put the "special" product in the first box, and then 2 or 3 other random products and then change monthly. Anyone have any ideas? If no one wants or can help, I'd be willing to pay a developer to help me figure it out... Thanks. Link to comment Share on other sites More sharing options...
Wendy James Posted March 28, 2005 Share Posted March 28, 2005 http://www.oscommerce.com/community/contributions,1444 that contribution may help and I think there are a couple of others. Just try searching the contribution area. Wendy James Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep. Link to comment Share on other sites More sharing options...
aresman Posted March 28, 2005 Author Share Posted March 28, 2005 http://www.oscommerce.com/community/contributions,1444 that contribution may help and I think there are a couple of others. Just try searching the contribution area. <{POST_SNAPBACK}> Thanks Wendy! This looks like the perfect contrib. But, it seems to have some issues that I'm hoping someone can help me with. Here's the code (below)... Basically, it's showing the picture of the product just fine, but not showing the title or price for it. Anyone have some ideas on how to fix it? Thanks! <?php /******************************************************** CONTENT OUTSIDE OF OSC V1.1 Author: David Vance == Adapted for MS2 by Anthony Date: 20. 11, 2004 OSC 2.2 MS2 PHP Version 4.3.2 This snippet is an example of placing osCommerce content on your site outside of the OSC directory structure. It allows you to display the products_new table. ********************************************************/ //saves current working directory for later return $cwd=getcwd(); //changes current working directory to osc root install directory; something like: /home/david/public_html/catalog/ but not DIR_FS_CATALOG chdir('/home/mysite/public_html/'); //need all of application_top's configurations and includes; NO OUTPUT ABOVE THIS POINT! include('includes/application_top.php'); //need the language file require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCTS_NEW); //start buffering ob_start(); /* BEGIN: From the products_new.php page: */ if ($random_product = tep_random_select("select products_id, products_image, products_tax_class_id, products_price from " . TABLE_PRODUCTS . " where products_status = '1' order by products_date_added desc limit " . MAX_RANDOM_SELECT_NEW)) { ?> <?php $random_product['products_name'] = tep_get_products_name($random_product['products_id']); $random_product['specials_new_products_price'] = tep_get_products_special_price($random_product['products_id']); $info_box_contents = array(); $info_box_contents[] = array('text' => HEADING_TITLE); new infoBoxHeading($info_box_contents, false, false, tep_href_link(FILENAME_PRODUCTS_NEW)); if (tep_not_null($random_product['specials_new_products_price'])) { $whats_new_price = '<s>' . $currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</s><br>'; $whats_new_price .= '<span class="productSpecialPrice">' . $currencies->display_price($random_product['specials_new_products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</span>'; } else { $whats_new_price = $currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])); } $info_box_contents = array(); $info_box_contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $random_product['products_image'], $random_product['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '" target="_blank">' . $random_product['products_name'] . '</a><br>' . $whats_new_price); new infoBox($info_box_contents); } ?> <?php $newProductsTable = ob_get_contents(); //stop buffering ob_end_clean(); ?> <?php //start buffering ob_start(); if (isset($current_category_id) && ($current_category_id > 0)) { $best_sellers_query = tep_db_query("select distinct p.products_id, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c where p.products_status = '1' and p.products_ordered > 0 and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and '" . (int)$current_category_id . "' in (c.categories_id, c.parent_id) order by p.products_ordered desc, pd.products_name limit " . MAX_DISPLAY_BESTSELLERS); } else { $best_sellers_query = tep_db_query("select distinct p.products_id, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_ordered > 0 and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.products_ordered desc, pd.products_name limit " . MAX_DISPLAY_BESTSELLERS); } if (tep_db_num_rows($best_sellers_query) >= MIN_DISPLAY_BESTSELLERS) { ?> <?php $info_box_contents = array(); $info_box_contents[] = array('text' => '<div class=left>Our Best Sellers</div>'); new infoBoxHeading($info_box_contents, false, false); $rows = 0; $bestsellers_list = '<table border="0" width="100%" cellspacing="0" cellpadding="1" align="center">'; while ($best_sellers = tep_db_fetch_array($best_sellers_query)) { $rows++; $bestsellers_list .= '<tr><td class="infoBoxContents" valign="top">' . tep_row_number_format($rows) . '.</td><td class="infoBoxContents"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $best_sellers['products_id']) . '">' . $best_sellers['products_name'] . '</a></td></tr>'; } $bestsellers_list .= '</table>'; $info_box_contents = array(); $info_box_contents[] = array('text' => $bestsellers_list); new infoBox($info_box_contents); } ?> <?php $bestsellersTable = ob_get_contents(); //stop buffering ob_end_clean(); ?> <?php /* END: From the products_new.php page */ //replace relative image paths with absolute urls (you may not need this. i did.) $newProductsTable=str_replace('src="', 'src="http://buy.mysite.com/',$newProductsTable); $bestsellersTable=str_replace('src="', 'src="http://buy.mysite.com/',$bestsellersTable); //change back to original working directory chdir($cwd); //********* COPY THE CODE ABOVE TO THE TOP OF THE FILE YOU WANT YOUR BOX IN *******\\ ?> <!-- ********* SAMPLE PAGE USAGE BELOW ********* --> <html><head> <!--make sure to include the stylesheet if you want the box to have same style as your shop--> <!-- <link rel="stylesheet" type="text/css" href="http://buy.mysite.com/stylesheet.css" /> --> </head> <body> <center> <table> <tr><td width="150" align="center"> <?php echo $newProductsTable; //output your table here (or wherever) ?> <!-- </td> --> <!-- <td width=125> <?php // echo $bestsellersTable; //output your table here (or wherever) ?> --> </td> </tr> </table> </center> </body> </html> Link to comment Share on other sites More sharing options...
aresman Posted March 28, 2005 Author Share Posted March 28, 2005 FYI - I'm using this on a Mambo install... Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.