Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How to show specials expiry date on product_info


osjunkie

Recommended Posts

Can anyone paste the code on what would be required to produced the expiry date of a product on special?

 

This would be a benefit by making customers take advantage of a limited time price.

 

Thanks in advance.

Link to comment
Share on other sites

Can anyone paste the code on what would be required to produced the expiry date of a product on special?

 

This would be a benefit by making customers take advantage of a limited time price.

 

Thanks in advance.

 

Forgot to specify that this should be in the product_info.php file.

Link to comment
Share on other sites

try this

 

 if ($new_price = tep_get_products_special_price($product_info['products_id'])) {
     $products_price = '<s>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';
   } else {
     $products_price = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
   }

Link to comment
Share on other sites

try this

 

 if ($new_price = tep_get_products_special_price($product_info['products_id'])) {
? ? ?$products_price = '<s>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';
? ?} else {
? ? ?$products_price = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
? ?}

 

That's just for showing the price. I want to show the expiry date on for the special. You will need to query the specials table and pull information from the expiry_date column on that product.

Link to comment
Share on other sites

Sorry, i dont know how to do that. I'm not a coder, but what your trying to do would be something nice. You might wanna looking the admin files and see if you can locate it.

 

Sorry i couldnt help more.

 

$product_query = tep_db_query("select p.products_id, pd.products_name, p.products_price, s.specials_new_products_price, s.expires_date from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s " . ($admin_allowed_stores[0] == '*' ? " " : " LEFT JOIN " . TABLE_PRODUCTS_TO_STORES . " p2s ON p.products_id = p2s.products_id ") . "where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = s.products_id and s.specials_id = '" . (int)$HTTP_GET_VARS['sID'] . "'" . ($admin_allowed_stores[0] == '*' ? " " : " and s.stores_id = '" . (int)$selected_store_id  . "' and p2s.stores_id in(" . implode(',' , $admin_allowed_stores) . ") "));
     $product = tep_db_fetch_array($product_query);

 

        $contents[] = array('text' => '<br>' . TEXT_INFO_EXPIRES_DATE . ' <b>' . tep_date_short($sInfo->expires_date) . '</b>');

 

All I can located in admin/specials.php

Link to comment
Share on other sites

I just tried playing around with the code. The problem is the code on that page is for input. Their is no output code show you would have to write something to show the output of what is set in the specicals page in the admin. You would think they would have an option to display it. It really is a good idea.

Link to comment
Share on other sites

it will be something like:

 

$special_query = tep_db_query("select expires_date from specials where products_id='" . $product['products_id'] . "'");

$special_result = tep_db_fetch_array($special_query);

echo 'This special price is valid until ' . tep_date_short($special_result['expires_date']);

 

from your message it looks like you are using some sort of multistore contribution, so if you are using that functionality you will need to take that into account.

 

Matt

Link to comment
Share on other sites

specials.php

 

Add to the .sql query:

s.expires_date

 

To output the result, add:

tep_date_long($specials['expires_date'])

 

I have this working on my Store, however I am not allowed to post the URL publically. If you want to see this in action please PM me and I will provide the URL.

Link to comment
Share on other sites

specials.php

 

Add to the .sql query:

s.expires_date

 

To output the result, add:

tep_date_long($specials['expires_date'])

 

I have this working on my Store, however I am not allowed to post the URL publically.  If you want to see this in action please PM me and I will provide the URL.

 

If I put s.expires i get and error that the field doesn't exist. It's not producing the date.

Link to comment
Share on other sites

Ok, with the help of the master himself, "D_BLAKE" he has found the brokeness and made it whole.

 

Here is the final working copy.

 

//Specials Expiry Query
$special_query = tep_db_query("select expires_date from " . TABLE_SPECIALS . " where products_id='" . $product_info['products_id'] . "'");
$special = tep_db_fetch_array($special_query);

?>
  <tr>
  <td colspan="2" class="main" align="center"><?php echo 'This special price is valid until ' . tep_date_short($special['expires_date']); ?></td>
  </tr>

 

Thanks for all that participating in making this work.

Link to comment
Share on other sites

  • 1 year later...
Ok, with the help of the master himself, "D_BLAKE" he has found the brokeness and made it whole.

 

Here is the final working copy.

 

//Specials Expiry Query
$special_query = tep_db_query("select expires_date from " . TABLE_SPECIALS . " where products_id='" . $product_info['products_id'] . "'");
$special = tep_db_fetch_array($special_query);

?>
  <tr>
  <td colspan="2" class="main" align="center"><?php echo 'This special price is valid until ' . tep_date_short($special['expires_date']); ?></td>
  </tr>

 

Thanks for all that participating in making this work.

 

hmm now if only I knew what file that went in... :blink:

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...