primedelux Posted August 22, 2011 Posted August 22, 2011 Okay so im reworking the products_new.php page to be output as an rss page, problem is the date formatting is wrong, currently it outputs as such Wednesday, 02. October 2002 Using: tep_date_long($products_new['products_date_added']) it needs to be in this format: Wed, 02 Oct 2002 15:00:00 +0200 the php for this is ("D, d M Y H:i:s O", time()) but im not sure how to implement it any ideas?
primedelux Posted August 22, 2011 Author Posted August 22, 2011 <?php require('includes/application_top.php'); // the following cPath references come from application_top.php $category_depth = 'top'; if (isset($cPath) && tep_not_null($cPath)) { $categories_products_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id = '" . (int)$current_category_id . "'"); $cateqories_products = tep_db_fetch_array($categories_products_query); if ($cateqories_products['total'] > 0) { $category_depth = 'products'; // display products } else { $category_parent_query = tep_db_query("select count(*) as total from " . TABLE_CATEGORIES . " where parent_id = '" . (int)$current_category_id . "'"); $category_parent = tep_db_fetch_array($category_parent_query); if ($category_parent['total'] > 0) { $category_depth = 'nested'; // navigate through the categories } else { $category_depth = 'products'; // category has no products, but display the 'no products' message } } } require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_DEFAULT); ?> <?php // default rss header(don't delete) // header("Content-Type: text/xml;charset=iso-8859-1"); echo '<?xml version="1.0" encoding="ISO-8859-1"?> <rss version="2.0"> <channel> <link>http://www.primedelux.com</link> <language>en-uk</language> <copyright>Copyright (C) 2011 http://www.primedelux.com</copyright> <pubDate>' . date("D, d M Y H:i:s O", time()) . '</pubDate>'; ?> <?php $products_new_array = array(); $products_new_query_raw = "select p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on (p.manufacturers_id = m.manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.products_date_added DESC, pd.products_name"; $products_new_split = new splitPageResults($products_new_query_raw, MAX_DISPLAY_PRODUCTS_NEW); ?> <?php if ($products_new_split->number_of_rows > 0) { $products_new_query = tep_db_query($products_new_split->sql_query); while ($products_new = tep_db_fetch_array($products_new_query)) { if ($new_price = tep_get_products_special_price($products_new['products_id'])) { $products_price = '<s>' . $currencies->display_price($products_new['products_price'], tep_get_tax_rate($products_new['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($products_new['products_tax_class_id'])) . '</span>'; } else { $products_price = $currencies->display_price($products_new['products_price'], tep_get_tax_rate($products_new['products_tax_class_id'])); } ?> <?php echo '<item>'; echo '<title>' . $products_new['products_name'] . '</title>'; echo '<description><![CDATA[' . tep_image('http://www.primedelux.com/images/' . $products_new['products_image']) . ' ]]>' . $products_new['products_name'] . '</description>'; echo '<link>' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_new['products_id']) . '</link>'; echo '<guid>' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_new['products_id']) . '</guid>'; echo '<pubDate>' . tep_date_long($products_new['products_date_added']) . '</pubDate>'; echo '</item>'; ?> <?php } } ?> <?php echo '</urlset>';?> <?php echo '</channel>';?> <?php echo '</rss>';?> <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
Recommended Posts
Archived
This topic is now archived and is closed to further replies.