Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

DO NOT SHOW prices if NOT logged in.,..UPDATE!


Tcet

Recommended Posts

ERXAMPLE HOW TO DOT DISPLAY PRICES for customest NOTlogged IN...

but display for those that ARE.

 

 

Hi ..my boss asked me the sma ething befor i started installing Oscommerce..

Here's what you can do ...

I hope you are a little familiar with looking at the code..nothing fancy required...

 

Can you find you're way around the HTML...tags...

(if not ..just mail ..me i might be able to do it for you... just a fair trade..)

(i have been planning to create an contribution for that..but have other things to do first so it might take a while..and you might notbeable to wait thatlong!)

 

If so ..you can use this.. for the prices...

 

You have to go through all the files that list prices...

And DOUBLE the code...for easy quick results..)

 

You get...something like...

For example .the SPECIALS BOx ..rightcolumn

Go to ...catalog/includes/boxes/specials.php

 

open...

 

Now you see the code/... that produces the contents( img..weight..price..name...)

that you see in the right column...

this code ..also ..LIST PRICES!!!

 

What you want to do .. and that goes for all..the price parts you want to edit...

something like..

 

if (!tep_session_is_registered('customer_id')){

 

..your edited code...(=copy code there+takeout price)

 

}else{

 

the code that was there(untouched)

 

};

 

 

 

I give you my actual code ..for ../includes/boxes/specials.php...

Look at it nade compare with your code....

and you'll see what i did....to "UNDO" the price listing..K..

There are SMARTEr way of doing this..but this way works for everyone...

 

Also ... if youhave to edit the price in the files in the catalog forlde ..or anything like that ...

 

see something like ...

<tr>

<td>

<php? echo "<img src="image/myAdvertisemetNOlogin.gif">"; ?>

</td>

</tr>

 

OR....

 

<tr>

<td>

<php? echo tep_image(DIR_WS_IMAGES . 'myAdvertismentloginok.gif'); ?>

</td>

</tr>

 

 

You can now control content..If customer is logged in..(display general info about your specials...and asking them to JOINT first to see OR..of list specials...bolow..the text for all .. that logged in....

 

If you replse the above code likethis....

 

 

<tr>

<td>

 

if (!tep_session_is_registered('customer_id')){

<php? echo "<img src="image/myAdvertisemetNOlogin.gif">"; ?>

}else{

<php? echo tep_image(DIR_WS_IMAGES . 'myAdvertismentloginok.gif'); ?>

};

 

</td>

</tr>

 

 

Hope that helps,

otherwise ...just ask, K

Alx...

 

 

I help you, you help someone else ...and before you know it ...??

 

We might actually have a COMMUNITY!

 

 

 

HERE's the example code...

from my site

 

Still working on it ... but prices are edited ..so are SOME LINKS...

NOtice how i used the same thing to BLOCK the entire shop part from users and the get REDOIECTED to the NEWSLETTER.

 

if (!tep_session_is_registered('customer_id')){

 

tep_redirect(tep_href_link(FILENAME_NIEUWSBRIEF));

}else{

 

 

<doctype...>

<html...

..the code already on your index page...untouched

</body>

../html>

 

};

 

 

 

ANYWAY ...The code i wanted to give you for the SPECIALS BOX..

IS this...

 

 

<?php
/*
$Id: specials.php,v 1.31 2003/06/09 22:21:03 hpdl Exp $

osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com

Copyright (c) 2003 osCommerce

Released under the GNU General Public License
*/

if ($random_product = tep_random_select("select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_status = '1' and p.products_id = s.products_id and pd.products_id = s.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' order by s.specials_date_added desc limit " . MAX_RANDOM_SELECT_SPECIALS)) {
?>
<!-- specials //-->
        <tr>
          <td>
<?php



if (!tep_session_is_registered('customer_id')){

 $info_box_contents = array();
  $info_box_contents[] = array('text' => BOX_HEADING_SPECIALS);

  new infoBoxHeading($info_box_contents, false, false, '');

  $info_box_contents = array();
  $info_box_contents[] = array('align' => 'center',
                               'text' => '' 
        
       . tep_image(DIR_WS_IMAGES . $random_product['products_image'], $random_product['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) 
       . '<br><br><b><font size="+">' 
        
       . $random_product['products_name'] 
       . '</font></b>' );

  new infoBox($info_box_contents);
 
}else{


  $info_box_contents = array();
  $info_box_contents[] = array('text' => BOX_HEADING_SPECIALS);

  new infoBoxHeading($info_box_contents, false, false, tep_href_link('actie_korting.php?inhoud=link2'));

  $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']) 
       . '">' 
       . $random_product['products_name'] 
       . '</a>'. '<br><s>' 
       . $currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) 
       . '</s><br><span class="productSpecialPrice">' . $currencies->display_price($random_product['specials_new_products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) 
       . '</span>');

  new infoBox($info_box_contents);

}; 


?>
          </td>
        </tr>
<!-- specials_eof //-->
<?php
}
?>

Link to comment
Share on other sites

you see..you get ....

you try...but dorget...

try try try one more time..

maybe this time it will be fine..

until everything works ...

..and your set!

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...